VOID FillPeInfo(VOID) { pinfo.ModuleBase = (ULONG_PTR)GetModuleHandleA(NULL); pinfo.ModuleSize = (DWORD)ParsePE(pinfo.ModuleBase, SIZE_OF_IMAGE); pinfo.ModuleNbSections = (DWORD)ParsePE(pinfo.ModuleBase, NB_SECTIONS); pinfo.ModuleSections = (ULONG_PTR)ParsePE(pinfo.ModuleBase, PE_SECTIONS); pinfo.EntryPoint = (DWORD)ParsePE(pinfo.ModuleBase, ENTRY_POINT); MyRtlPcToFileHeader((ULONG_PTR)&pinfo, &pinfo.ModuleInjectedBase); pinfo.ModuleInjectedSize = (DWORD)ParsePE(pinfo.ModuleInjectedBase, SIZE_OF_IMAGE); PrintPeInfo(); }
int _tmain(int argc, _TCHAR* argv[]) { HANDLE hFile = NULL; CFilex Filex; CImage peImage; hFile = Filex.Open(FILE_PATH,OPEN_EXISTING,GENERIC_READ); if(hFile == NULL) return -1; if(peImage.Load(hFile,MAP_READ,0,Filex.GetSize()) == FALSE) return -1; //Parse .NET MF pe Files ParsePE(peImage.GetBuff()); peImage.UnLoad(); Filex.Close(hFile); return 0; }