Results 1 to 33 of 33

Thread: [2005] Append exe onto exe?

  1. #1

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Exclamation [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

    Last edited by knxrb; Nov 20th, 2008 at 02:29 PM.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Append exe onto exe?

    All that does is make both exe files unusable...

  3. #3

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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).

  5. #5

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    Thanks for that I didn't know I could do that 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]
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  6. #6
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    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.
    why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
    for every question you ask provide an answer on another thread.

  7. #7

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  8. #8
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    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.

  9. #9

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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?
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  10. #10
    Lively Member
    Join Date
    Nov 2008
    Location
    Greece
    Posts
    64

    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

  11. #11
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  12. #12

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  13. #13
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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?

  14. #14

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    When the user clicks a certain button in my app.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  15. #15
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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?

  16. #16

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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]
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  17. #17
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  18. #18

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    Oh, didn't think of that. Any ideas?
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  19. #19
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Append exe onto exe?

    the first question to ask yourself is do you really expect this game.exe to be pirated?

  20. #20

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    Simple answer is Yes. The games will possibly be sold in the future.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  21. #21
    Addicted Member
    Join Date
    May 2008
    Location
    Denmark
    Posts
    178

    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?

  22. #22

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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.
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  23. #23
    Addicted Member
    Join Date
    May 2008
    Location
    Denmark
    Posts
    178

    Re: [2005] Append exe onto exe?

    make a settings file where you store the exe files bytes. Then encrypt it in some way.

  24. #24
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2005] Append exe onto exe?

    you really are being naive.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  25. #25

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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)
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  26. #26
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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.

  27. #27

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    So your verdict is that it's not possible without people being able to copy it?
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  28. #28
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: [2005] Append exe onto exe?

    as matt keeps pointing out, there is no easy way to do this.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  29. #29
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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..

  30. #30

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    That's a really good idea! Thanks, I'll start right away!
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  31. #31
    Junior Member
    Join Date
    Sep 2008
    Posts
    21

    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
    Last edited by Gencast; Nov 20th, 2008 at 11:42 PM.

  32. #32

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    Re: [2005] Append exe onto exe?

    Woo! Thanks, you'll definitely be in the credits
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

  33. #33

    Thread Starter
    Hyperactive Member knxrb's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    321

    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!
    Did I help you with your problem? If I did rate me by clicking here: Rate knxrb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width