检查dll是32位还是64位?
- #include "stdafx.h"
- #include <Windows.h>
- int _tmain(int argc, _TCHAR* argv[])
- {
- BYTE buf[4];
- FILE *fp = fopen("D:\\plugin_d.dll", "rb");
- fseek(fp, 0x40-4, 0);
- fread(buf, sizeof(char), 4, fp);
- int a = int(buf[0]);
- int b = int(buf[1])*256;
- int c = int(buf[2])*256*256;
- int d = int(buf[3])*256*256*256;
- int sum = a+b+c+d;
- fseek(fp, sum+4, 0);
- BYTE bufMachine[2];
- fread(bufMachine, sizeof(char), 2, fp);
- int machine = (int)bufMachine[0] + (int)(bufMachine[1])*256;
- if(machine == 0x14C)//332
- {
- printf("32 bit\r\n");
- }
- else if(machine == 0x8664)//34404
- {
- printf("64 bit\r\n");
- }
- else
- {
- printf("Unknow bit\r\n");
- }
- //system("pause");
- getchar();
- return 0;
- }
https://blog.csdn.net/hellokandy/article/details/73863510