#include <iostream>
#include <windows.h>
#include <string>
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib")
#include <fstream>
using namespace std;
typedef char(*pDecrypt)(LPVOID a, int** b); // 函数指针
pDecrypt Decrypt = NULL; // 后面调用 Decrypt 即可
int main()
{
WCHAR pszPath;
pszPath = 0;
bool ret = PathAppendW(&pszPath, L"1.dat"); // 参数一:待解密文件
if (ret == 1 ) {
cout << &pszPath << "文件读取成功!" << endl;
}
FILE * fp1 = fopen("1.dat", "rb");
//cout << &fp1.seek() << endl;
cout << fp1 << "测试文件" << endl;
int *v8; // 参数二
v8 = 0;
HMODULE hDLL;
hDLL = LoadLibrary("1.dll");
if (hDLL) {
cout << typeid(hDLL).name() << endl;
int offset = 0xEB0; // 3AC0h / 4 = EB0h
hDLL = hDLL + offset; // hDLL 此时保存“函数”的偏移地址
cout << "函数地址" << hDLL << endl;
Decrypt = (pDecrypt)hDLL;
if (Decrypt) {
Decrypt(&fp1, &v8);
cout << "下面是 v8 数据." << endl;
cout << &v8 << endl;
cout << v8 << endl;
}
}
system("pause");
FreeLibrary(hDLL);
return 0;
}