I am having trouble getting ReadFile to work for me.
I am runnng an AMD with XP SP1. I compile with a .cpp
extention normally using Borland Bcc32 but I have
also compiled using cl.exe.
I declare LPVOID lpBuffer and have tried assigning
memory using malloc. I also tried GlobalAlloc. Using
GlobalAlloc, I have tried GMEM_FIXED, GPTR and GHND.
I have also tried GlobalLock with lpBuffer in the
() to reassign lpBuffer from a handle (hmem) to a
pointer as described in WIN32.HLP. All failures
crash at the same point.
My CreateFile works fine and returns a good handle.
CreateFile sucessfully loads the file location into
memory. GetLastError tells me that CreateFile worked
and my memory allocation has been successful. I also
tried a call to GetFileSize which worked fine before
calling ReadFile.
Tracking what happens in SoftIce, all is well until
the ReadFile function calls a tick count. Before the
tick count, lpBuffer "seems" to be pointing to a good
location. On return from the tick count, EBP+0x14
contains zero. This is later used as a memory
address which naturally fails.
I'm at a loss to see what I'm doing wrong. Any
ideas?