hey i cant explain this
szFileName BYTE 255, 0 ;will hold the filename
;get the path
push 255
push offset szFileName
push NULL
call GetModuleFileName
;get the strlen
push offset szFileName
call lstrlen
;change the extension in the string to .dll
mov [szFileName+eax-3], 'd'
mov [szFileName+eax-2], 'l'
mov [szFileName+eax-1], 'l'
now a simple test
push MB_OK
push NULL
push offset szFileName
push NULL
call MessageBox
the string is correct !
but if i try to use the string again, it screws up majorly
eg: i call the EXACT same messagebox code as above
but this time it prints like "C:\Doc" instead of the full path
You're only allocated 2 bytes with the values 255 for the first and 0 for the second one, use this instead:
; alloc an array of 255 bytes
szFileName BYTE 255 dup(0) ;will hold the filename
Also you should use MAX_PATH (defined in Windows.inc) constant instead of 255.
Quote from: hitchhikr on April 23, 2005, 07:10:41 PM
You're only allocated 2 bytes with the values 255 for the first and 0 for the second one, use this instead:
; alloc an array of 255 bytes
szFileName BYTE 255 dup(0) ;will hold the filename
Also you should use MAX_PATH (defined in Windows.inc) constant instead of 255.
works thanks, was only chapter 4 of the masm programmers guide
dup is chapter 5 xD