1

我想知道“this”关键字在 IDA pro 伪 C++ 代码中的确切含义是什么。

假设我有一个函数调用:

v2 = sub_100010B3((int)&v12, "QtGui4.dll");

调用此函数:

int __thiscall sub_100010B3(int this, const char *Str1)
  {
  int result; // eax@2
  int v3; // eax@4
  int v4; // [sp+0h] [bp-8h]@1
  int v5; // [sp+4h] [bp-4h]@1

  v4 = this;
  v5 = sub_10001090(this, 1);
  if ( v5 )
  {
    while ( *(_DWORD *)(v5 + 16) )
    {
      v3 = sub_10001470(v4, *(_DWORD *)(v5 + 12));
      if ( !stricmp(Str1, (const char *)v3) )
        return v5;
      v5 += 20;
    }
    result = 0;
  }
  else
  {
    result = 0;
  }
  return result;
}

好的,所以在函数中我们可以看到定义“int this”,根据文档,它是指向用于调用对象的对象的指针。我想知道的是如何重写函数,以便它们运行相同但不需要传递“this”参数?

4

1 回答 1

4

thiscall 意味着它是一个 Class 成员函数,因此您希望将其重写为

class MyClass {
   int sub_100010B3(const char* Str1);
};

MyClass::sub_100010B3(const char* Str1)
{
  // .. implementation
}
于 2010-12-24T21:40:53.713 回答