How would I read a file into a buffer at a certain offset say 40424 to EOF for example?
Posted on 2001-01-06 00:11:00 by moxy
Use SetFilePointer to move the file pointer, and GetFileSize to figure out how many bytes there are till the end of the file. After that you just use ReadFile. For example: ... push 0 push 0 push OPEN_EXISTING push 0 push 0 push GENERIC_READ push offset FileName call CreateFile mov FileHandle,eax push FILE_BEGIN push 0 push 40424 push FileHandle call SetFilePointer push 0 push offset BytesRead push 0 push FileHandle call GetFileSize sub eax,40424 push eax push eax push 0 call GlobalAlloc mov Buffer,eax push eax push FileHandle call ReadFile push FileHandle call CloseHandle ...
Posted on 2001-01-06 00:45:00 by Varunun
Can anybody else read that shit in the post above this one? Wouldn't code been written like this be easyier: invoke CreateFile ,ADDR FileName,GENERIC_READ,0,NULL,OPEN_EXISTING,\ FILE_ATTRIBUTE_NORMAL,NULL mov FileHandle,eax invoke SetFilePointer ,FileHandle,40424,NULL,FILE_BEGIN invoke GetFileSize ,FileHandle,NULL sub eax,40424 push eax invoke GlobalAlloc ,GMEM_FIXED,eax mov Buffer,eax pop eax invoke ReadFile ,FileHandle,Buffer,eax,ADDR BytesRead,NULL invoke CloseHandle ,FileHandle
Posted on 2001-01-06 22:39:00 by tasmblowsmymonkey