|Yep, you are right. But here with this stuff i got more and more problems. For example, i cannot return bytes from function, (this code is a function, which should read a file into BYTE array and return this array among with nr of bytes read).
BYTE *ReadBytes(HANDLE hDevice, LPDWORD lpdwBytesRead)
SIZE_T BASE_BUFFER_SIZE = 512;
BYTE * bInitialBuffer = NULL;
bInitialBuffer = (BYTE *)VirtualAlloc(0,
BASE_BUFFER_SIZE, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
if(bInitialBuffer == NULL)
while (FALSE != ReadFile(hDevice, bInitialBuffer, BASE_BUFFER_SIZE,
(LPDWORD)&dwReadBytes, 0) && dwReadBytes > 0)
TRACE1("got some buffer! %d", dwReadBytes);
lpdwBytesRead += dwReadBytes;
and if i call it:
DWORD read = 0;
BYTE *DataBuffer = ReadBytes(hFile, &read);
read is always zero, and i got no bytes returned from function... And i cannot use just defined size (skip memory allocation).