The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Antihaxer on March 14, 2009, 04:52:56 PM

Title: File Mapping
Post by: Antihaxer on March 14, 2009, 04:52:56 PM
I am using file mapping to get text from a file and I am having problems with the file mapping over writing my other variables in my program.  How would I fix this?  Below is my current code.
invoke CreateFile,addr FilePath,GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
mov hFile,eax
invoke GetFileSize,hFile,0
mov FileSize,eax
invoke CreateFileMapping,hFile,0,PAGE_READONLY,0,0,0
mov hMap,eax
invoke MapViewOfFile,hMap,FILE_MAP_READ,0,0,0
mov hMapView,eax
invoke UnmapViewOfFile,hMapView
invoke CloseHandle,hMap
invoke CloseHandle,hFile
Title: Re: File Mapping
Post by: Antihaxer on March 14, 2009, 09:18:07 PM
Fixed problem.
Title: Re: File Mapping
Post by: ecube on March 14, 2009, 10:20:32 PM
can you post the fix please, so others can benefit, thanks,
Title: Re: File Mapping
Post by: Antihaxer on March 14, 2009, 11:55:25 PM
Quote from: E^cube on March 14, 2009, 10:20:32 PM
can you post the fix please, so others can benefit, thanks,
I thought the file being mapped was fucking up my buffers, but it was actually another code segment that was doing it.  The code I posted works perfectly fine.