-
[2005] Append exe onto exe?
I want to read an exe and then add it onto the end of another exe.
I can append text from a text file but when I try and read the exe file it comes back with only 3 chars, I've tried a binaryreader/writer and a streamreader/writer and I can't get it to work.
Please help, thanks :D
http://www.rkwebcreations.co.uk/exegif.gif
-
Re: [2005] Append exe onto exe?
All that does is make both exe files unusable...
-
Re: [2005] Append exe onto exe?
The main exe still runs as I have already seen this before(can't get source though :(), the idea is that when the main exe runs it will read itself and creates the exe in the same directory from the appended data.
-
Re: [2005] Append exe onto exe?
If that is all you want to do, then there is a very simple solution built right into VB.NET
Just go into project properties, and go to the resources tab. Drag the exe you want to be embedded into this screen, and it will add it as a resource (which means it gets compiled inside the app)
Then, in your code, to extract and write the embedded exe to disk, its just one line of code:
Code:
My.Computer.FileSystem.WriteAllBytes("C:\newfilename.exe", My.Resources.EmbeddedExeName, False)
EmbeddedExeName will be whatever the name of the resource you added was (by default it will be the exe name without .exe on it).
-
Re: [2005] Append exe onto exe?
Thanks for that I didn't know I could do that:D but I want this so that the user can specify an exe and then my app will append it onto a predefined exe.
[Edit] Is it possible to add resources to my application during runtime? [EDIT]
-
Re: [2005] Append exe onto exe?
In runtime you don't need to append an .exe
- You either start it...
- Copy it as a binary to somewhere else...
- Add the Path to the exe to your config file for some reason.
You can not include it into your .exe because that's running, hence readonly.
Quetion why do you want to append an exe at runtime other then...
- including viruses/trojans after you've passed as firewall...
If you want to have a dynamic setup to your application use modules (in dll's)
this way you can easily add functionality if a license provides rights to a certain functionallity.
-
Re: [2005] Append exe onto exe?
When people make games using Game Maker they create the game exe and anyone can play it. I want to create an application that stops people running the exe until my application says it can be run, so I wanted it appended to my exe and then created when it should be run.
If you have any other ideas then please tell me as I really want something like this, thanks :D
-
Re: [2005] Append exe onto exe?
it can be done, but i wouldn't recommend it. antivirus programs will pick it up as a malicious file.
-
Re: [2005] Append exe onto exe?
Ok, anyone got any other way I could do something like this? Either with the exe embedded in something or the exe being changed in some way so the user cannot run it?
-
Re: [2005] Append exe onto exe?
you can use it like this, give the exe to the people who you want them to be able to play it so if someone doesn't have the exe he will be getting an error message like "file.exe is missing" and he won't be able to run it :D
-
Re: [2005] Append exe onto exe?
Well lets say you could do this, when you extract the game exe so that it can be loaded into memory, it could simply be copied from the location it was extracted to, to another location on disk. Then and the user has bypassed your copy protection.
-
Re: [2005] Append exe onto exe?
Darkaar: But then the people who have the other exe will just send a copy to other people.
klienma: I have already made it so that the exe requires a certain code sequence to be sent to it for it to run properly. Therefore if they copy it it won't run.
-
Re: [2005] Append exe onto exe?
out of curiosity, how was your app going to decide when they should be allowed to use the given exe?
-
Re: [2005] Append exe onto exe?
When the user clicks a certain button in my app.
-
Re: [2005] Append exe onto exe?
So instead of just having game.exe and launching that, they launch YOUR exe, and click a button which in turn launches game.exe???
How is that preventing anything?
-
Re: [2005] Append exe onto exe?
Because if they try and run the exe without using my application it won't run.
[EDIT] I think I've already solved it by having it not run unless using my app! [EDIT]
-
Re: [2005] Append exe onto exe?
Glad you figured it out, because it still makes no sense ;)
If you don't want them to give game.exe to someone, and your only copy protection is having your app launch the said exe, then someone could again just give out your exe to launch the game.exe.
-
Re: [2005] Append exe onto exe?
Oh, didn't think of that. Any ideas?
-
Re: [2005] Append exe onto exe?
the first question to ask yourself is do you really expect this game.exe to be pirated?
-
Re: [2005] Append exe onto exe?
Simple answer is Yes. The games will possibly be sold in the future.
-
Re: [2005] Append exe onto exe?
just put the exe as a resource then extract it some wierd place on the computer, when they click the button to play?
-
Re: [2005] Append exe onto exe?
That's already been suggested but it needs to be so that the user can specify an exe and then it does everything during runtime.
So if there is a way to add resources at runtime that would be really good.
-
Re: [2005] Append exe onto exe?
make a settings file where you store the exe files bytes. Then encrypt it in some way.
-
Re: [2005] Append exe onto exe?
you really are being naive.
-
Re: [2005] Append exe onto exe?
dbasnett: Me or Link?
Link: How do I read the exe file bytes and then store them in another file?
And then how do I read this file and create an exe from it?
(I can already do the encryption bits)
-
Re: [2005] Append exe onto exe?
the bottom line is once the game.exe can be loaded, it will be extracted to disk. You can't extract the bytes of game.exe and magically load that into memory as a process without putting it on disk first.
The very act of copying this exe to disk after extracting it from your exe, means the user could then simply copy the exe. It doesn't matter if you put it in some "obscure" place, it is very very simply to find out where a given exe is running from.
On that note as well, if you simply embedded the game.exe as an array of bytes into your main.exe as a resource, there are tools made specifically for simple extraction of resources from a .NET file.
-
Re: [2005] Append exe onto exe?
So your verdict is that it's not possible without people being able to copy it?
-
Re: [2005] Append exe onto exe?
as matt keeps pointing out, there is no easy way to do this.
-
Re: [2005] Append exe onto exe?
Quote:
Originally Posted by knxrb
So your verdict is that it's not possible without people being able to copy it?
does game maker have any time of internet connectivity in its framework (ie can you write code in it to actually connect out to the web?)
If so, then you could do some login based system to play the game, and require an internet connection.
Take a system live Valve's steam platform. You can install it anywhere, and log into your account, and download and play any games you own, but you can only be doing this in one place at one time, because it knows you logged in. Once you login elsewhere, the last login is invalid.
Based on the fact that you didn't actually make this game, but you used some tool that is a scripting language on top of a game engine, you have much less control over the end result, and that makes any sensible copy protection likely to be a bit harder.
Perhaps if you plan to sell this game, you could entice buyers by offering free updates for life, and issuing some new levels to paid customers for free at some point or something like that..
-
Re: [2005] Append exe onto exe?
That's a really good idea! Thanks, I'll start right away!
-
Re: [2005] Append exe onto exe?
Note i will recommended you learn C++ for that... Because it might end up being more of a game server and so far i have seen it done on C++. But if all you want is to create log ins/ registration might want to try php and MySQL
anyways back to Visual Basics. you might want to use this code:
Code:
Public Class SplashScreen3
Dim file As String
Dim gameloaded As Process
Sub loader()
Dim program As New Process()
Me.file = "temp.exe"
Dim file_resource As Byte()
file_resource = My.Resources.<<X>>
Me.file = "temp.exe"
Dim b As Byte() = file_resource
Try
Dim Game As System.IO.FileStream = IO.File.Create(file)
Dim attribute As System.IO.FileAttributes = IO.FileAttributes.Hidden
System.IO.File.SetAttributes(file, attribute)
Game.Write(b, 0, b.Length)
Game.Close()
Try
Me.gameloaded = Process.Start(file)
Catch
System.Windows.Forms.MessageBox.Show("by Gencast")
If My.Computer.FileSystem.FileExists(file) Then
My.Computer.FileSystem.DeleteFile(file)
End If
Me.Dispose()
End Try
Me.Dispose()
Catch
Try
Me.gameloaded = Process.Start(file)
Me.Dispose()
Catch ex As Exception
Me.Dispose()
End Try
Me.Dispose()
End Try
End Sub
yes i pretty much gave you the damm code. how nice i am... anyways the file will not be seen unless user has there settings set to "See all file including hidden files"
The program will read a resource file in this case a .exe and create a temporary hidden file that one fully extracted will lunch automatically. You migth want to use a splashscreen.
To make it more privet add a sing in box (username and password). you may want to link it some how to a server or make one apart from server.
NOTE: for every 1 programmer there are 10+ hackers and this may include the programmer in some cases. So now that in one way or another this can be pirated, unless you are a pro in 64bit which I don't think you are...
Enjoy and please add me to your credits sense i pretty much made the runner for you;)
need anything else PM me ;)
-
Re: [2005] Append exe onto exe?
Woo! Thanks, you'll definitely be in the credits:D
-
Re: [2005] Append exe onto exe?
How would I get it to delete the file after it has finished running?
I tried adding this code after the 'Me.gameloaded = Process.Start(file)'
Code:
Me.gameloaded.WaitForExit()
If My.Computer.FileSystem.FileExists(file) Then
My.Computer.FileSystem.DeleteFile(file)
End If
...but it didn't delete it!