DAVID@ches.cs.vims.edu (03/12/91)
With regard to incorporating bitmaps into program files as requested by Dan.Bjorklund@samba.acs.unc.edu:- You can incorporate auxiliary data files into your program with the help of the BINOBJ utility supplied by Borland. Let's assume your file, DATA.REC is a 'file of rectyp', where *rectyp* is a type. Run BINOBJ using the command: BINOBJ DATA.REC DATA.OBJ MYDATA. This will generate an OBJ file that thinks it's a program with entry point MYDATA (or words to that effect). In the program that uses the data, include the statement: procedure MYDATA; external; {$L DATA.OBJ} To access the data, define a variable, p of pointer type: var p : pointer; and use typecasting to access the fields of the record: p := @mydata; with rectyp(p^) do begin { .... access the fields of the first record } end; {to skip to the next record, re-assign p} p := ptr( seg(p^), ofs(p^)+sizeof(rectyp) ); { or use similar assignments to calculate the pointer to any record in your data } Hope this helps - I've managed to use this technique without problems. If you need to update your data you have to go through the whole routine with BINOBJ and then re-compile the program. Something I've been looking at is incorporating a (hopefully) unique tag in the file so I can scan the executable EXE file for it, locate where the stuff is stored in the EXE file and replace it *in situ* without having to recompile. David Evans, DAVID@CHES.CS.VIMS.EDU
cd5340@mars.njit.edu (David Charlap) (03/12/91)
In article <26239@adm.brl.mil> DAVID@ches.cs.vims.edu writes: >Hope this helps - I've managed to use this technique without >problems. If you need to update your data you have to go through >the whole routine with BINOBJ and then re-compile the program. >Something I've been looking at is incorporating a (hopefully) >unique tag in the file so I can scan the executable EXE file for >it, locate where the stuff is stored in the EXE file and replace >it *in situ* without having to recompile. To do this, (assuming Borland is making full use of DOS's EXE header facilities), you should be able to locate the data segment(s) of a program by reading the .EXE header. From there, if you know the contents of the old data, you should be able to find it quickly. Of course, I wouldn't want to change it to anything of a different length from the original, or bad things could happen. Also, you must beware of compressed EXE files. Many programs today will LZW compress an executable file, placing the decompress code in the EXE header. This will completely ruin any chance of finding (let alone changing) your data without recompiling. Personally, if you're going to be changing the data, why do you want to compile it into the code? Leave it in a data file somewhere. The time to load it won't be very much longer, and your life will be much easier. I've only linked BINOBJ data when the data is static. As in color title screens, or separately compiled object modules (like BGI drivers). -- David Charlap "Invention is the mother of necessity" cd5340@mars.njit.edu "Necessity is a mother" Operators are standing by "mother!" - Daffy Duck