Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: system.ini device= system.ini binaryindex binaryread binarypokestr 386enh
The following example shows how. This is from the BinaryPokeStr function:
; This example writes a new device= line to SYSTEM.INI ; It is *very* fast NewDevice = "DEVICE=COOLAPP.386" ; ; Change to the Windows Directory DirChange(DirWindows(0)) ; ; Obtain filesize and allocate binary buffers fs1=FileSize("SYSTEM.INI") srcbuf = BinaryAlloc(fs1) editbuf = BinaryAlloc(fs1+100) ; ; Read existing system.ini into memory BinaryRead( srcbuf, "SYSTEM.INI") ; ; See if this change was already installed. If so, quit a = BinaryIndex( srcbuf, 0, "COOLAPP.386", @FWDSCAN) if a != 0 then goto AlreadyDone ; ; Find 386Enh section. a = BinaryIndex( srcbuf, 0, "[386Enh]", @FWDSCAN) ; ; ; Find beginning of next line ( add 2 to skip over our crlf ) cuthere = BinaryIndex( srcbuf, a, @CRLF, @FWDSCAN) + 2 ; ; Copy data from beginning of file to just after [386Enh] ; to the edit buffer BinaryCopy( editbuf, 0, srcbuf, 0, cuthere) ; ; Add the device= line to the end of the edit buffer, and add a CRLF BinaryPokeStr( editbuf, BinaryEodGet(editbuf), strcat(NewDevice,@CRLF)) ; ; Copy remaining part of source buffer to the edit buffer a = BinaryEodGet(editbuf) b = BinaryEodGet(srcbuf) BinaryCopy( editbuf, a, srcbuf, cuthere, b-cuthere) ; ; Save file out to disk. Use system.tst until it is ; completely debugged BinaryWrite( editbuf, "SYSTEM.TST") ; ; Close binary buffers :AlreadyDone BinaryFree(editbuf) BinaryFree(srcbuf)
Article ID: W12738
Filename: System.Ini and Device lines.txt
File Created: 1999:04:15:16:49:18
Last Updated: 1999:04:15:16:49:18