zoukankan      html  css  js  c++  java
  • 检测dll是32/64位?(直接读dll文件包含的某几个字节进行判断)

    检查dll是32位还是64位?

    [cpp] view plain copy
     
    1. #include "stdafx.h"  
    2. #include <Windows.h>  
    3.   
    4. int _tmain(int argc, _TCHAR* argv[])  
    5. {  
    6.     BYTE buf[4];  
    7.     FILE *fp = fopen("D:\plugin_d.dll", "rb");  
    8.     fseek(fp, 0x40-4, 0);  
    9.     fread(buf, sizeof(char), 4, fp);  
    10.   
    11.     int a = int(buf[0]);  
    12.     int b = int(buf[1])*256;  
    13.     int c = int(buf[2])*256*256;  
    14.     int d = int(buf[3])*256*256*256;  
    15.     int sum = a+b+c+d;  
    16.     fseek(fp, sum+4, 0);  
    17.   
    18.     BYTE bufMachine[2];  
    19.     fread(bufMachine, sizeof(char), 2, fp);  
    20.   
    21.     int machine = (int)bufMachine[0] + (int)(bufMachine[1])*256;  
    22.   
    23.     if(machine == 0x14C)//332  
    24.     {  
    25.         printf("32 bit ");  
    26.     }  
    27.     else if(machine == 0x8664)//34404  
    28.     {  
    29.         printf("64 bit ");  
    30.     }  
    31.     else  
    32.     {  
    33.         printf("Unknow bit ");  
    34.     }  
    35.   
    36.     //system("pause");  
    37.     getchar();  
    38.     return 0;  
    39. }  

    https://blog.csdn.net/hellokandy/article/details/73863510

  • 相关阅读:
    背水一战 Windows 10 (97)
    背水一战 Windows 10 (96)
    背水一战 Windows 10 (95)
    背水一战 Windows 10 (94)
    背水一战 Windows 10 (93)
    Vue项目用于Ios和Android端开发
    Android assets文件夹之位置放置和作用
    轻松搭建Xposed Hook
    cordov vue项目中调用手机原生api
    Android 直接修改dex破解
  • 原文地址:https://www.cnblogs.com/findumars/p/8734176.html
Copyright © 2011-2022 走看看