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?
Attachments:
Posted on 2005-04-11 04:36:58 by ploptor
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.
Posted on 2005-04-11 05:07:15 by tenkey
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 (?)
Posted on 2005-04-11 06:52:07 by ploptor