本帖最后由 pananning 于 2024-8-4 00:47 编辑
[C++] 纯文本查看 复制代码 #include <iostream>
#include <vector>
#include <windows.h>
typedef struct A {
DWORD a;
} A, * PA;
typedef struct k {
DWORD unk0;
DWORD unk1;
WCHAR Guid[36];
DWORD unk2;
DWORD unk3;
DWORD Policy;
DWORD64 KeyLen;
DWORD64 Key2Len;
DWORD64 Key3Len;
DWORD64 Key4Len;
PA Key;
} k, * Pk;
class B
{
public:
MasterFile()
{
_binFile.resize(256);
for (int i = 0; i < 256; ++i) {
_binFile[i] = i;
}
}
BOOL File();
std::vector<BYTE> _binFile;
Pk _Keys;
};
BOOL B::File() {
_Keys = (Pk)_binFile.data();
std::wcout << *(DWORD*)&_binFile[128] << std::endl;
_Keys->Key = (PA)(&_binFile[128]);
std::wcout << *(DWORD*)&_binFile[128] << std::endl;
return TRUE;
}
int main() {
B mf;
mf.File();
return 0;
}
中间只是让一个指针指向这个地址,并没有改变内存数据,为什么两次输出值就不一样了呢 |