profdracula
January 13th, 2005, 09:24
Hi all!
I'm a newbee to ASM-coding. I'm writing a patch for an app, but don't know how to write bytes(from an array) to the target-app using a loop. My code writes first byte at required offset sucessfully. But how to write remaining bytes? [ Of course Offsets are also at random locations in EXE].
Part of my code is:
bytPatch DB Byte1, Byte2,.............., Byte-n
ofsOffset DD Offset1, Offset2,.........., Offset-n
;----------------------------------------------------------------]
invoke SetFilePointer, hFile, ofsOffset, 0, 0
.IF eax==-1
;Handle-error
.ENDIF
invoke WriteFile, hFile, offset bytPatch, 1, offset bWrite, 0
.IF !eax
;Handle-error
.ENDIF
;----------------------------------------------------------------]
I'm a newbee to ASM-coding. I'm writing a patch for an app, but don't know how to write bytes(from an array) to the target-app using a loop. My code writes first byte at required offset sucessfully. But how to write remaining bytes? [ Of course Offsets are also at random locations in EXE].
Part of my code is:
bytPatch DB Byte1, Byte2,.............., Byte-n
ofsOffset DD Offset1, Offset2,.........., Offset-n
;----------------------------------------------------------------]
invoke SetFilePointer, hFile, ofsOffset, 0, 0
.IF eax==-1
;Handle-error
.ENDIF
invoke WriteFile, hFile, offset bytPatch, 1, offset bWrite, 0
.IF !eax
;Handle-error
.ENDIF
;----------------------------------------------------------------]