Click here to Skip to main content
15,890,973 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
Stephen Hewitt13-Mar-08 14:08
Stephen Hewitt13-Mar-08 14:08 
AnswerRe: error C2228: left of '.m_FindNoPlat' must have class/struct/union type ???? Pin
David Crow13-Mar-08 16:23
David Crow13-Mar-08 16:23 
Generalstatic_cast and reinterpret_cast Pin
LCI13-Mar-08 12:06
LCI13-Mar-08 12:06 
GeneralRe: static_cast and reinterpret_cast Pin
Mark Salsbery13-Mar-08 13:29
Mark Salsbery13-Mar-08 13:29 
GeneralRe: static_cast and reinterpret_cast Pin
Peter Weyzen13-Mar-08 13:57
Peter Weyzen13-Mar-08 13:57 
GeneralRe: static_cast and reinterpret_cast Pin
Eytukan13-Mar-08 16:11
Eytukan13-Mar-08 16:11 
GeneralRe: static_cast and reinterpret_cast Pin
LCI14-Mar-08 2:32
LCI14-Mar-08 2:32 
QuestionRe: static_cast and reinterpret_cast Pin
Rajkumar R14-Mar-08 3:02
Rajkumar R14-Mar-08 3:02 
GeneralRe: static_cast and reinterpret_cast Pin
LCI14-Mar-08 5:05
LCI14-Mar-08 5:05 
GeneralRe: static_cast and reinterpret_cast Pin
Rajkumar R15-Mar-08 18:59
Rajkumar R15-Mar-08 18:59 
GeneralRe: static_cast and reinterpret_cast Pin
LCI17-Mar-08 2:09
LCI17-Mar-08 2:09 
QuestionRe: static_cast and reinterpret_cast Pin
Rajkumar R17-Mar-08 4:17
Rajkumar R17-Mar-08 4:17 
GeneralRe: static_cast and reinterpret_cast Pin
LCI17-Mar-08 4:30
LCI17-Mar-08 4:30 
QuestionIdentify 32 bit binary or 64 bit binary Pin
tingu13-Mar-08 9:03
tingu13-Mar-08 9:03 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
led mike13-Mar-08 9:15
led mike13-Mar-08 9:15 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
ThatsAlok13-Mar-08 19:56
ThatsAlok13-Mar-08 19:56 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
led mike14-Mar-08 6:44
led mike14-Mar-08 6:44 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
Mark Salsbery13-Mar-08 9:16
Mark Salsbery13-Mar-08 9:16 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
led mike13-Mar-08 10:21
led mike13-Mar-08 10:21 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
Mark Salsbery13-Mar-08 10:39
Mark Salsbery13-Mar-08 10:39 
GeneralRe: Identify 32 bit binary or 64 bit binary [modified] Pin
Randor 13-Mar-08 10:25
professional Randor 13-Mar-08 10:25 
Im feeling generous today. I created a function for you.

DWORD GetPEMachineType(LPTSTR sz)
{
	HANDLE hFile = CreateFile(sz,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
	if(NULL != hFile)
	{
		LARGE_INTEGER bigInt;
		BOOL diditWork = GetFileSizeEx(hFile, &bigInt);
		HANDLE hFileMap = CreateFileMapping(hFile,NULL,PAGE_READWRITE,bigInt.HighPart,bigInt.LowPart + 0x2000 ,_T("someGUID"));
		if(NULL != hFileMap)
		{
			LPVOID hMap = MapViewOfFile(hFileMap,FILE_MAP_READ,0,0,0);
			if(NULL != hMap)
			{
				HMODULE hModule = (HMODULE)hMap;
				IMAGE_DOS_HEADER * pDosHeader = (IMAGE_DOS_HEADER *)hModule;
				IMAGE_FILE_HEADER * pFileHeader = (IMAGE_FILE_HEADER *)(((LPBYTE)hModule) + pDosHeader->e_lfanew + sizeof(IMAGE_NT_SIGNATURE));
				return pFileHeader->Machine;
			}
		}
	}
}


Here is a link to the current PE format specification:

http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx[^]

The possibilities include:

IMAGE_FILE_MACHINE_UNKNOWN 0x0 The contents of this field are assumed to be applicable to any machine type
IMAGE_FILE_MACHINE_AM33 0x1d3 Matsushita AM33
IMAGE_FILE_MACHINE_AMD64 0x8664 x64
IMAGE_FILE_MACHINE_ARM 0x1c0 ARM little endian
IMAGE_FILE_MACHINE_EBC 0xebc EFI byte code
IMAGE_FILE_MACHINE_I386 0x14c Intel 386 or later processors and compatible processors
IMAGE_FILE_MACHINE_IA64 0x200 Intel Itanium processor family
IMAGE_FILE_MACHINE_M32R 0x9041 Mitsubishi M32R little endian
IMAGE_FILE_MACHINE_MIPS16 0x266 MIPS16
IMAGE_FILE_MACHINE_MIPSFPU 0x366 MIPS with FPU
IMAGE_FILE_MACHINE_MIPSFPU16 0x466 MIPS16 with FPU
IMAGE_FILE_MACHINE_POWERPC 0x1f0 Power PC little endian
IMAGE_FILE_MACHINE_POWERPCFP 0x1f1 Power PC with floating point support
IMAGE_FILE_MACHINE_R4000 0x166 MIPS little endian
IMAGE_FILE_MACHINE_SH3 0x1a2 Hitachi SH3
IMAGE_FILE_MACHINE_SH3DSP 0x1a3 Hitachi SH3 DSP
IMAGE_FILE_MACHINE_SH4 0x1a6 Hitachi SH4
IMAGE_FILE_MACHINE_SH5 0x1a8 Hitachi SH5
IMAGE_FILE_MACHINE_THUMB 0x1c2 Thumb
IMAGE_FILE_MACHINE_WCEMIPSV2 0x169 MIPS little-endian WCE v2

Best Wishes,
-David Delaune

modified on Thursday, March 13, 2008 4:32 PM

GeneralRe: Identify 32 bit binary or 64 bit binary Pin
led mike13-Mar-08 10:33
led mike13-Mar-08 10:33 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
Randor 13-Mar-08 10:38
professional Randor 13-Mar-08 10:38 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
ThatsAlok13-Mar-08 19:58
ThatsAlok13-Mar-08 19:58 
GeneralRe: Identify 32 bit binary or 64 bit binary Pin
Rajkumar R14-Mar-08 3:05
Rajkumar R14-Mar-08 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.