Procedure is as follows:
HANDLE hFile=CreateFile (
TheFileName,//PE file name
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL.
NULL);
HANDLE hFileMapping=CreateFileMapping (PAGE_READONLY hFile, NULL, 0, 0, NULL);
LPBYTE lpBaseAddress=(LPBYTE) MapViewOfFile (hFileMapping,//handle to the map object
FILE_MAP_READ, 0, 0, 0);
CodePudding user response:
Dare to dare not to put the specific message posted?CodePudding user response:
I'm sorry! This program is this: I read a PE file import table, know the DLL file loading information, I want to open the DLL to see these DLL import table of information, for example, I know a DLL file is MFC42. DLL, theFileName="c: \ Windows \ system32 \ MFC42 DLL" get lpBaseAddress value of 0, can't get the import tableCodePudding user response:
MFC DLL DLL is not necessarily the system.CodePudding user response:
The code, you need to determine whether to perform each step of the success, such as the CreateFile to open the file, you need to determine whether hFile is an effective handle, and then you can continue to the next step,CodePudding user response:
Yes, I have made the judgment, display is an invalid handle, is createfile can't use? I'll find a lot of information, don't say that there is a problem ahCodePudding user response:
CreateFile GetLastError after get the error code