🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2450

modifying a variable in a Windows .EXE without re-linking???

#2450
From: John Grant
Date: Sun, 03 Jan 1993 20:50
27 lines
1559 bytes
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
Technical Details
Message-ID: <1993Jan3.205027.28520@emr1.emr.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!torn!nott!emr1!jagrant

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!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