Force IDA decompiler to use different function signature of static functions in namespaces

会有一股神秘感。 提交于 2019-12-11 04:38:29

问题


I'm testing IDA with some simple code to learn how to use it and I'm getting stuck because it doesn't decompile properly a static function in a namespace:

function declared this way:

namespace pvrtex
{
    bool transcode(CPVRTexture& tex,
        const PixelType fmt,
        const EPVRTVariableType chType,
        const EPVRTColourSpace clrSpace,
        const ECompressorQuality q,
        const bool dither = false);    
}

this function ends up wiht this signature: ?transcode@pvrtex@@YA_NAAVCPVRTexture@1@TPixelType@1@W4EPVRTVariableType@@W4EPVRTColourSpace@@W4ECompressorQuality@1@_N@Z. Online demangler produces correct c++ signature. When I load my executable in IDA it also shows this same function signature, however, when I try to decompile this function IDA incorrectly treats this function as if it was some member function of pvrtex class and internally all the code ends up with some random mess:

bool __cdecl pvrtex::transcode(pvrtex *__hidden this, struct pvrtex::CPVRTexture *, union pvrtex::PixelType, enum EPVRTVariableType, enum EPVRTColourSpace, enum pvrtex::ECompressorQuality, bool).

Is it a bug? What can be done to fix it? I tried to rclick function and edit it and specify that it was static, but nothing changes: IDA still treats it as if it was a member function that has a hidden pvrtex *__hidden this.

来源:https://stackoverflow.com/questions/48373565/force-ida-decompiler-to-use-different-function-signature-of-static-functions-in

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!