问题
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