home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / misc / 4567 < prev    next >
Encoding:
Text File  |  1993-01-04  |  1.5 KB  |  37 lines

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