Results 1 to 8 of 8

Thread: Storing data inside .exe

  1. #1

    Storing data inside .exe

    I'd like to store some data inside the .exe (build). Some vars, and some records. Each time the program runs I 'd like to write to these addresses.
    Using Delphi and Lazarus.

    How would I proceed?
    Marmin^.Style

  2. #2

    Storing data inside .exe

    Not possible.
    Binaries of running programs are locked.
    ... as far as I know

    Edit:
    Ok, I take it back. It actually *has* to be possible somehow.
    However its not easy.

  3. #3

    Storing data inside .exe

    I may ask it to the fpc developers. They will know it.
    Marmin^.Style

  4. #4

    Storing data inside .exe

    win32: writeprocessmemory, but you need to know the exact address of data and that may change a lot..
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  5. #5
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Storing data inside .exe

    Create a const record in your code:

    Const
    MyData = Record ID : String; Data : String; End = (ID:"My Unique ID"ata="Custom Data that is exactly XYZ in length);

    In your code do a search through the EXE file (Using Block Read), until you find the ID string. Then at the correct offset for the Data block write your custom Data.

    Its been YEARS since I last did that. If I remember the structure of an EXE file changed betwen DOS and Windows. In Dos the strings were stored at the start of the file (so reading from the front was faster) in windows (95 IIRC) ity was mnore efficient to start reading from the back of the file.

    The EXE that is currently running can be changed as far as I remmeber.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  6. #6

    Storing data inside .exe

    In general, don't. Windows' own security and 3rd party security software make this increasingly difficult to deploy, even if you pull it of. It's only a matter of time till only the windows installer (the thing that interprets .msi's) can write to c:\program files\

    The next release of FPC/Lazarus will probably improve the resource system so it gets more similar to Delphi. (using "windows" resources on windows)

  7. #7

    Storing data inside .exe

    Maybe a little late, but I found this Delphi unit called ExeMod. The download link is on top:

    http://www.geocities.com/gacarpenter386/

    The algorithms are quiet simple.

  8. #8

    Storing data inside .exe

    cronodragon~ thanks for the link, it will help me
    From brazil (:

    Pascal pownz!

Bookmarks

Posting Permissions

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