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

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehran
  3. From: mehran@monet.uwaterloo.ca (Mehran Farimani)
  4. Subject: Re: modifying a variable in a Windows .EXE without re-linking???
  5. Message-ID: <C0EuK8.5DH@watserv1.uwaterloo.ca>
  6. Sender: news@watserv1.uwaterloo.ca
  7. Organization: University of Waterloo
  8. References: <1993Jan3.205027.28520@emr1.emr.ca>
  9. Date: Wed, 6 Jan 1993 02:21:44 GMT
  10. Lines: 41
  11.  
  12. In article <1993Jan3.205027.28520@emr1.emr.ca> jagrant@emr1.emr.ca (John Grant) writes:
  13. >Now, I really don't feel like re-linking the program with a different
  14. >value of lockfilesize tied to each data set distributed, so is there
  15. >a way of modifying this value in an already-linked .EXE, but not
  16. >allowing anyone else to do it?
  17. >
  18. >Although I'm sure there are many ways to hack this, I would prefer
  19. >a formal solution which is all 'up-front', so I can automate it
  20. >somehow using a .BAT file.
  21. >-- 
  22. >John A. Grant                        jagrant@emr1.emr.ca
  23. >Airborne Geophysics
  24. >Geological Survey of Canada, Ottawa
  25.  
  26. One solution is to put an identifier string as a part of a structure
  27. following which is all your "post-configurable" variables. So,
  28. for example in your case we'd have something like this:
  29.  
  30. typedef struct
  31. {
  32.    BYTE byIDString [10];
  33.    LONG lLockFileSize;
  34. } CONFIGINFO;
  35.  
  36. CONFIGINFO cnf =
  37. {
  38.    "012345678",
  39.    -1
  40. };
  41.  
  42. Then, you can write a small program which searches your exec for the ID
  43. and writes all your configuration data in to the exec. Of course, for the
  44. final version of your executable you can replace the search part with a
  45. simple lseek() if you like.
  46.  
  47. Hope this helps ....
  48.  
  49. Regards,
  50.  
  51. --Mehran
  52.  
  53.