Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. change variable value

change variable value

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestionlearning
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Scozturk
    wrote on last edited by
    #1

    Hi! I have a variable declared like this in my application: int i = 2; What I want to do is to change the value from 2 to 3 (with the help of another exe application) without recompiling... Well I have the file offset which is 5030 but I don't know how to change it! Can someone help me? Thank you very much for your answers in advance! Well... I am a beginner ...

    J 1 Reply Last reply
    0
    • S Scozturk

      Hi! I have a variable declared like this in my application: int i = 2; What I want to do is to change the value from 2 to 3 (with the help of another exe application) without recompiling... Well I have the file offset which is 5030 but I don't know how to change it! Can someone help me? Thank you very much for your answers in advance! Well... I am a beginner ...

      J Offline
      J Offline
      Jon Hulatt
      wrote on last edited by
      #2

      You really don't want to be doing that. If your program needs a parameter, which another program must change, then there are a whole bunch of sensible ways to achieve that. A fairly good idea might be to use the registry.

      #include <beer.h>

      S 1 Reply Last reply
      0
      • J Jon Hulatt

        You really don't want to be doing that. If your program needs a parameter, which another program must change, then there are a whole bunch of sensible ways to achieve that. A fairly good idea might be to use the registry.

        #include <beer.h>

        S Offline
        S Offline
        Scozturk
        wrote on last edited by
        #3

        yes I could use something like that or just append the variable values at the end of the exe and read them from there but I am making an installer and I want to use that for the password... I don't really understand what the file offset is... is it just a position or something like a pointer? Well... I am a beginner ...

        R D 2 Replies Last reply
        0
        • S Scozturk

          yes I could use something like that or just append the variable values at the end of the exe and read them from there but I am making an installer and I want to use that for the password... I don't really understand what the file offset is... is it just a position or something like a pointer? Well... I am a beginner ...

          R Offline
          R Offline
          Robert A T Kaldy
          wrote on last edited by
          #4

          The standard approach is to store the password value in encrypted form in an inifile or registry. When the program asks for the password, it encrypts the user's input and compare the encypted user's input with the encrypted password from registry. If they are equal, the user's password is correct. For encrypting, you should use SHA hashing algorithm. Try google for 'SHA C++ library'. Robert-Antonio Endless loop: see Loop, endless Loop, endless: see Endless loop

          1 Reply Last reply
          0
          • S Scozturk

            yes I could use something like that or just append the variable values at the end of the exe and read them from there but I am making an installer and I want to use that for the password... I don't really understand what the file offset is... is it just a position or something like a pointer? Well... I am a beginner ...

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            A much simpler way would be to store it in the file's resource table. See this article for ideas.


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            S 1 Reply Last reply
            0
            • D David Crow

              A much simpler way would be to store it in the file's resource table. See this article for ideas.


              "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

              S Offline
              S Offline
              Scozturk
              wrote on last edited by
              #6

              Thank you very much... I will try using the resource because putting the password in another file wont work for my program... Well... I am a beginner ...

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups