// // Dump the IMAGE_FILE_HEADER for a PE file or an OBJ // void DumpHeader(PIMAGE_FILE_HEADER pImageFileHeader) { UINT headerFieldWidth = 30; UINT i; printf("File Header\n"); printf(" %-*s%04X (%s)\n", headerFieldWidth, "Machine:", pImageFileHeader->Machine, GetMachineTypeName(pImageFileHeader->Machine) ); printf(" %-*s%04X\n", headerFieldWidth, "Number of Sections:", pImageFileHeader->NumberOfSections); printf(" %-*s%08X -> %s", headerFieldWidth, "TimeDateStamp:", pImageFileHeader->TimeDateStamp, ctime((time_t *)&pImageFileHeader->TimeDateStamp)); printf(" %-*s%08X\n", headerFieldWidth, "PointerToSymbolTable:", pImageFileHeader->PointerToSymbolTable); printf(" %-*s%08X\n", headerFieldWidth, "NumberOfSymbols:", pImageFileHeader->NumberOfSymbols); printf(" %-*s%04X\n", headerFieldWidth, "SizeOfOptionalHeader:", pImageFileHeader->SizeOfOptionalHeader); printf(" %-*s%04X\n", headerFieldWidth, "Characteristics:", pImageFileHeader->Characteristics); for ( i=0; i < NUMBER_IMAGE_HEADER_FLAGS; i++ ) { if ( pImageFileHeader->Characteristics & ImageFileHeaderCharacteristics[i].flag ) printf( " %s\n", ImageFileHeaderCharacteristics[i].name ); } }
void DumpImageDbgHeader(MPanelItem *pRoot, PIMAGE_SEPARATE_DEBUG_HEADER pImageSepDbgHeader) { UINT headerFieldWidth = 30; pRoot->printf(" %-*s%04X\n", headerFieldWidth, "Flags:", pImageSepDbgHeader->Flags); pRoot->printf(" %-*s%04X %s\n", headerFieldWidth, "Machine:", pImageSepDbgHeader->Machine, GetMachineTypeName(pImageSepDbgHeader->Machine)); pRoot->printf(" %-*s%04X\n", headerFieldWidth, "Characteristics:", pImageSepDbgHeader->Characteristics); __time32_t timeStamp = pImageSepDbgHeader->TimeDateStamp; pRoot->printf(" %-*s%08X -> %s", headerFieldWidth, "TimeDateStamp:", pImageSepDbgHeader->TimeDateStamp, _ctime32(&timeStamp) ); pRoot->printf(" %-*s%08X\n", headerFieldWidth, "CheckSum:", pImageSepDbgHeader->CheckSum); pRoot->printf(" %-*s%08X\n", headerFieldWidth, "ImageBase:", pImageSepDbgHeader->ImageBase); pRoot->printf(" %-*s%08X\n", headerFieldWidth, "Size of Image:", pImageSepDbgHeader->SizeOfImage); pRoot->printf(" %-*s%04X\n", headerFieldWidth, "Number of Sections:", pImageSepDbgHeader->NumberOfSections); pRoot->printf(" %-*s%04X\n", headerFieldWidth, "ExportedNamesSize:", pImageSepDbgHeader->ExportedNamesSize); pRoot->printf(" %-*s%08X\n", headerFieldWidth, "DebugDirectorySize:", pImageSepDbgHeader->DebugDirectorySize); pRoot->printf(" %-*s%08X\n", headerFieldWidth, "SectionAlignment:", pImageSepDbgHeader->SectionAlignment); }