一般分为代码判断和非代码判断
代码判断方法:
判断int*类型的sizeof值
if (sizeof(int*) == 4)
{
// 32-bit
}
else if (sizeof(int*) == 8)
{
// 64-bit
}
else
{
// The future is now!
}
非代码判断:
查看文件的PE头
"This program cannot be run in DOS mode..."之后的数据
"PE..L" (hex code: 504500004C) = 32 bit
or
"PE..d†" (hex code: 504500006486) = 64 bit
代码判断方法:
判断int*类型的sizeof值
if (sizeof(int*) == 4)
{
// 32-bit
}
else if (sizeof(int*) == 8)
{
// 64-bit
}
else
{
// The future is now!
}
非代码判断:
查看文件的PE头
"This program cannot be run in DOS mode..."之后的数据
"PE..L" (hex code: 504500004C) = 32 bit
or
"PE..d†" (hex code: 504500006486) = 64 bit
用记事本打开exe文件