home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.ms-windows.programmer.misc
- Path: sparky!uunet!utcsri!torn!nott!emr1!jagrant
- From: jagrant@emr1.emr.ca (John Grant)
- Subject: modifying a variable in a Windows .EXE without re-linking???
- Message-ID: <1993Jan3.205027.28520@emr1.emr.ca>
- Organization: Energy, Mines, and Resources, Ottawa
- Date: Sun, 3 Jan 1993 20:50:27 GMT
- Lines: 27
-
- I want to distribute my application with a 'lock' to the data set
- provided with it, i.e. it can't be used for any other data sets.
- Rather than put a key in the data set and in the program, it is
- sufficient to lock the .EXE to a file of a certain size. I have
- a global variable:
- static long int lockfilesize=-1L;
-
- If this is -1, then the app can be used with any file, otherwise
- the file size must be the same as lockfilesize.
-
- Now, I really don't feel like re-linking the program with a different
- value of lockfilesize tied to each data set distributed, so is there
- a way of modifying this value in an already-linked .EXE, but not
- allowing anyone else to do it?
-
- I was hoping to do this perhaps with the map file produced by the
- linker but I don't know what I'm looking for, i.e. how do I find the
- position of a variable in the .EXE, knowing the offset etc into
- a segment like DGROUP. I'm using Borland C++ 3.1.
-
- Although I'm sure there are many ways to hack this, I would prefer
- a formal solution which is all 'up-front', so I can automate it
- somehow using a .BAT file.
- --
- John A. Grant jagrant@emr1.emr.ca
- Airborne Geophysics
- Geological Survey of Canada, Ottawa
-