Article View: comp.os.msdos.programmer
Article #196Re: changes to exe (binary) file --- THANKS ALL!
From: jim
Date: Mon, 03 Aug 1992 12:47
Date: Mon, 03 Aug 1992 12:47
40 lines
2474 bytes
2474 bytes
well, with the help of several people from this group, I now have a neat little registration program that does, in fact, directly modify the executable. it looks for a certain string, and if it doesn't find it, it complains about the exe either having been tampered with or compressed. if it does find it, it gets the user's registration key, their name, Amateur Radio callsign, etc., and inserts them into the executable. THANKS TO ALL WHO HELPED OUT. I finally ended up with a simple process where the filesize is determined, a buffer large enough to hold the file is malloc'ed (in smaller chunks to avoid one block of data > 64k...geez, you'd think the people writing C compilers could handle that in the background and make a more correctly behaved C compiler). by the way, never did get turbo c++ to report the correct file size using their filelength() function....it refused to do anything past the first EOF. I did get the correct file size, though, thanks to one person who said to fseek to the end of the file, ftell, and then fseek back to the start. and just to make things more interesting, I even setup a program to modify the registration program..... only this one, *I* use (it inserts a serial number for the user). naturally, this program simply took the code for the other one and changed a few bits here and there. neat stuff! thanks again, --jim \input std_disclaimer % 73 DE N5IAL (/9) ------------------------------------------------------------------------------ "[...] the plural of `mongoose' ought to be `polygoose'." [Jargon file 2.9.10] INTERNET: jim@n5ial.chi.il.us | grahj@gagme.chi.il.us | j.graham@ieee.org UUCP: gagme!n5ial!jim@clout.chi.il.us AMATEUR RADIO: n5ial@n9hsi (Chicago.IL.US.Earth) ------------------------------------------------------------------------------
Technical Details
Message-ID:
<1992Aug3.124703.15770@hou.amoco.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!noc.msc.net!uc.msc.edu!apctrc!wsc!jimReferences:
<1992Jul29.125540.7401@hou.amoco.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!noc.msc.net!uc.msc.edu!apctrc!wsc!jim From: jim@n5ial.chi.il.us Subject: Re: changes to exe (binary) file --- THANKS ALL! Message-ID: <1992Aug3.124703.15770@hou.amoco.com> Summary: once again the net proves to be the right place to ask Originator: jim@eddie Sender: news@hou.amoco.com Reply-To: jim@n5ial.chi.il.us Organization: me? have you seen my desk? : -) References: <1992Jul29.125540.7401@hou.amoco.com> Date: Mon, 3 Aug 1992 12:47:03 GMT Lines: 41