i'm using this:
...
.data
blocksize dd 8192
...
.data?
buffer db 8192 dup (?)
rw dd ?
hfile dd ?
...
invoke CreateFile, filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
mov hfile, eax
.if (eax == INVALID_HANDLE_VALUE)
; return file-open error
or eax, -1
ret
.endif
invoke ReadFile, hfile, addr buffer, blocksize, addr rw, 0
invoke CloseHandle, hfile
...
whenever i call ReadFile i get an error message box (see image). so no data is read, and the app quits. why?
...
.data
blocksize dd 8192
...
.data?
buffer db 8192 dup (?)
rw dd ?
hfile dd ?
...
invoke CreateFile, filename, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
mov hfile, eax
.if (eax == INVALID_HANDLE_VALUE)
; return file-open error
or eax, -1
ret
.endif
invoke ReadFile, hfile, addr buffer, blocksize, addr rw, 0
invoke CloseHandle, hfile
...
whenever i call ReadFile i get an error message box (see image). so no data is read, and the app quits. why?
How are you defining filename?
If it's something like
filename db 250 dup(?)
then you need to use ADDR filename in your CreateFile invoke.
If it's something like
filename db 250 dup(?)
then you need to use ADDR filename in your CreateFile invoke.
actually the calls to CreateFile and ReadFile are in a proc. filename is a dword...
like this:
ProcessFile proc uses edi ebx filename: dword
...
ret
ProcessFile endp
this is called with
invoke ProcessFile, addr lpstrFilename
lpstrFilename is dup MAX_PATH (?)
like this:
ProcessFile proc uses edi ebx filename: dword
...
ret
ProcessFile endp
this is called with
invoke ProcessFile, addr lpstrFilename
lpstrFilename is dup MAX_PATH (?)