所以我在做一些逆向作业,在处理类时经常遇到一些看起来像这样的代码,这是伪代码。
int __thiscall sub_858F90(_DWORD *this, int a2)
{
int result; // eax
result = a2;
this[0x657] = a2;
return result;
}
我想知道我可以读取“this[0x657]”的值,我有类实例指针,我试图查看实例+0x657偏移量,但我想要的值应该是与 id 相对应的整数操作,
// Assuming you have a valid pointer to the instance
YourClass* instancePointer = ...;
// Access the member at offset 0x657
int value = instancePointer->yourMemberName; // Replace "yourMemberName" with the actual member name
在此代码中,将 YourClass 替换为类或结构的实际名称,并将 yourMemberName 替换为您尝试在偏移量 0x657 处访问的成员变量的实际名称。
请记住,确切的语法可能会有所不同,具体取决于使用此代码的编程语言和上下文。此外,偏移量 0x657 可能不是访问类成员的标准方法,因此了解您正在使用的类或对象的结构非常重要。