Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!cs.uoregon.edu!ogicse!intelhf!ichips!iwarp.intel.com!pdxgate!eecs!mwizard From: mwizard@eecs.cs.pdx.edu (Craig Nelson) Newsgroups: comp.lang.pascal Subject: Re: Store password in exe file Message-ID: <2330@pdxgate.UUCP> Date: 11 Apr 91 15:14:59 GMT References: <26530@adm.brl.mil> Sender: news@pdxgate.UUCP Lines: 42 ZCCBJSB%EB0UB011.BITNET@cunyvm.cuny.edu (Josep Sau B.) writes: >Going on with passwords, Cathy Anderson >says: >>I had written one myself ...! I have it so it reads the password >>from a file and it can be changed without the code. >>The problem is that I need an external file (which can be typed so >>you can get an idea of the password). Reading a chunk of text from a .EXE file is a piece of cake. Just declare a section in any INTERFACE section of an including unit, and mark the section with an identifiable string. For instance: Interface Const MarkText:String[20] = 'INSTALLATION SECTION'; PassBuff:String[20] = ''; This will set up an interesting effect in the .EXE. You open the .EXE file like any other file, and read the first 21 bytes into a String variable using BlockRead(). Then you enter a loop by reading the next 21 bytes and check every position for a string that is the above. Once you find the string , immediately after it is the location you can write/read to for accessing your password (or whatever else you feel like using in that section). Remember to use the PassBuff vairable as well as the MarkText variable in a "used" piece of code somewhere, or that nifty little optimizing compiler Borland makes will strip the unused variable (and the space it allocates) out of the finished .EXE file. Cheers! []====================================================================[] || Craig R. Nelson | CCSofD Software Inc. || || Programmer | Beaverton, OR, 97005 || || mwizard@eecs.ee.pdx.edu | (unlisted on the net) ||