C# - Storing data in executable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NickPLee
    New Member
    • Dec 2007
    • 3

    C# - Storing data in executable

    Hello all,

    I recently saw an application that stored all of its data inside itself, in the .exe. I was wondering how to do this in C#.
    I tried editing the "this program cannot be run in ms-dos mode" to store SOMETHING in the executable, as editing those specific bytes will not cause the application to fail, however the app can't read data back from its own executable when it's in use. If anyone has any insight on this, please let me know.

    Thanks,
    Nick
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by NickPLee
    Hello all,

    I recently saw an application that stored all of its data inside itself, in the .exe. I was wondering how to do this in C#.
    I tried editing the "this program cannot be run in ms-dos mode" to store SOMETHING in the executable, as editing those specific bytes will not cause the application to fail, however the app can't read data back from its own executable when it's in use. If anyone has any insight on this, please let me know.

    Thanks,
    Nick
    I'm not exactly sure what you are talking about.
    Normally if you want to store persistent data for an application, you either use a database or serialize your data to be used at a later date.

    -Frinny

    Comment

    • NickPLee
      New Member
      • Dec 2007
      • 3

      #3
      For example, there are some applications that will store things (files?) (variables?) in their own binary, so everything is self contained in one EXE, yet it can retain settings.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        There is a the resource section and the properties section.
        Properties would store things like integers/strings/other simple datatypes.
        Resources can store images(bitmaps, icons whatever) and other more complex datatypes.

        In your solution explorer, under the name of the project should be a section on it.

        Comment

        • NickPLee
          New Member
          • Dec 2007
          • 3

          #5
          thanks for your help! also, is it possible to change these values in a hex editor or something, or must it be done either within the program or in Visual Studio during development?

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Originally posted by NickPLee
            thanks for your help! also, is it possible to change these values in a hex editor or something, or must it be done either within the program or in Visual Studio during development?
            I believe all of them are possible, however I believe using visual studio (or .net object durring runtime) would be the prefered method(s).

            Comment

            Working...