Created
June 10, 2013 05:27
-
-
Save blaquee/5746724 to your computer and use it in GitHub Desktop.
Map view of File, return base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LPVOID createMapAndGetBase(LPCTSTR filePath) | |
{ | |
LPVOID fBase = 0; | |
__try{ | |
hFile = CreateFile( filePath, | |
GENERIC_READ|GENERIC_EXECUTE, | |
FILE_SHARE_READ|FILE_SHARE_WRITE, | |
NULL, | |
OPEN_EXISTING, | |
FILE_ATTRIBUTE_NORMAL, | |
NULL); | |
if(hFile == INVALID_HANDLE_VALUE) | |
{ | |
MessageBox(0, "failed to open game.exe! crc bypass will not function.", "error", 0); | |
__leave; | |
} | |
hMap = CreateFileMapping(hFile, | |
NULL, | |
PAGE_READONLY, | |
0,0, | |
NULL); | |
if(hMap == NULL)__leave; | |
hView = MapViewOfFile(hMap,FILE_MAP_READ,0,0,0); | |
return hView; | |
}__finally{ | |
if(hFile != INVALID_HANDLE_VALUE) | |
CloseHandle(hFile); | |
if(hMap != NULL) | |
CloseHandle(hMap); | |
} | |
return hView; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment