Article View: comp.os.ms-windows.programmer.misc
Article #2500Re: modifying a variable in a Windows .EXE without re-linking???
From: Mehran Farimani
Date: Wed, 06 Jan 1993 02:21
Date: Wed, 06 Jan 1993 02:21
40 lines
1726 bytes
1726 bytes
In article <1993Jan3.205027.28520@emr1.emr.ca> jagrant@emr1.emr.ca (John Grant) writes:
>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?
>
>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
One solution is to put an identifier string as a part of a structure
following which is all your "post-configurable" variables. So,
for example in your case we'd have something like this:
typedef struct
{
BYTE byIDString [10];
LONG lLockFileSize;
} CONFIGINFO;
CONFIGINFO cnf =
{
"012345678",
-1
};
Then, you can write a small program which searches your exec for the ID
and writes all your configuration data in to the exec. Of course, for the
final version of your executable you can replace the search part with a
simple lseek() if you like.
Hope this helps ....
Regards,
--Mehran
Technical Details
Message-ID:
<C0EuK8.5DH@watserv1.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehranReferences:
<1993Jan3.205027.28520@emr1.emr.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!torn!watserv2.uwaterloo.ca!watserv1!monet.uwaterloo.ca!mehran From: mehran@monet.uwaterloo.ca (Mehran Farimani) Subject: Re: modifying a variable in a Windows .EXE without re-linking??? Message-ID: <C0EuK8.5DH@watserv1.uwaterloo.ca> Sender: news@watserv1.uwaterloo.ca Organization: University of Waterloo References: <1993Jan3.205027.28520@emr1.emr.ca> Date: Wed, 6 Jan 1993 02:21:44 GMT Lines: 41