IDA pro“这个”关键词

发布于 2024-10-08 19:27:04 字数 750 浏览 0 评论 0原文

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

假设我有一个函数调用:

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”参数?

I am wondering what the exact meaning of the 'this' keyword is in the IDA pro pseudo c++ code.

Lets say that I have a function call:

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

Which call this function:

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;
}

Ok, so in the function we can see the definition 'int this' which according to the docs is a pointer to the object which is used to invoke the object. What I am wondering is how I can rewrite the function so that they will operate the same but do not need to pass the 'this' parameter?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你列表最软的妹 2024-10-15 19:27:04

thiscall 意味着它是一个类成员函数,因此您需要将其重写为

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

MyClass::sub_100010B3(const char* Str1)
{
  // .. implementation
}

The thiscall means it is a Class member function so you would want to rewrite it as

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

MyClass::sub_100010B3(const char* Str1)
{
  // .. implementation
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文