abracadabra
November 26th, 2011, 11:05
What is the problem....
I have a piece of freeware, closed-source software which has stopped working as of an operating system update that occurred a year or so ago. The software developer is MIA and will not answer user emails, etc, and is no longer developing. The software throws a bad access exception. I would like to fix the big by decompiling or disassembling the software, fixing the issue, and recompiling/reassembling. I am a fairly experienced C/C++ developer so I'm hoping to be able to get some kind of compileable source code from Hex Rays, then recompile the program, debug it using my usual toolchain, and recompile a fixed version. Unfortunately, I am having a good deal of trouble compiling the decompiler output. Specifically, it seems like it is using classes/namespaces/structs (eg Foo::something()) before they are declared. I would think that the "generate C Header file" command would create a header file to declare all of these classes/member functions would work, but the resulting header file only has a handful of class declarations which are not really relevant. When compiling the file (just gcc outputFile.c) it raises errors about all of these declarations.
What is the protection.....
There is no protection per se, just a bug I'd like to fix.
What tools are you using....
IDA 6.1 with Hex Rays decompiler 1.5.
What tutorials have you read....
Skimmed inAbOol's IDA tutorial (didn't mention the decompiler), watched Hex Ray's videos
Show your output listing WITH comments....
There are many function declarations like
but Foo is not declared as a namespace, class, or struct anywhere, so the compiler barfs.
NOW ask your question....
Am I missing a step to generate a declaration of all of these namespace/class/structs? Or is trying to recompile the decompiler output a trivial pursuit, and not the intended use of the software? My reason for wanting to do it this way is that I can't figure out a good way to debug the binary in IDA itself - the binary is a plugin, so it runs as part of another program, and the host operating system doesn't run IDA/Hex Rays Decompiler, so I'd have to set up a debugging server... etc.
Thanks in advance for any advice!
I have a piece of freeware, closed-source software which has stopped working as of an operating system update that occurred a year or so ago. The software developer is MIA and will not answer user emails, etc, and is no longer developing. The software throws a bad access exception. I would like to fix the big by decompiling or disassembling the software, fixing the issue, and recompiling/reassembling. I am a fairly experienced C/C++ developer so I'm hoping to be able to get some kind of compileable source code from Hex Rays, then recompile the program, debug it using my usual toolchain, and recompile a fixed version. Unfortunately, I am having a good deal of trouble compiling the decompiler output. Specifically, it seems like it is using classes/namespaces/structs (eg Foo::something()) before they are declared. I would think that the "generate C Header file" command would create a header file to declare all of these classes/member functions would work, but the resulting header file only has a handful of class declarations which are not really relevant. When compiling the file (just gcc outputFile.c) it raises errors about all of these declarations.
What is the protection.....
There is no protection per se, just a bug I'd like to fix.
What tools are you using....
IDA 6.1 with Hex Rays decompiler 1.5.
What tutorials have you read....
Skimmed inAbOol's IDA tutorial (didn't mention the decompiler), watched Hex Ray's videos
Show your output listing WITH comments....
There are many function declarations like
Code:
int __cdecl Foo::PreDestructor(int a1);
but Foo is not declared as a namespace, class, or struct anywhere, so the compiler barfs.
NOW ask your question....
Am I missing a step to generate a declaration of all of these namespace/class/structs? Or is trying to recompile the decompiler output a trivial pursuit, and not the intended use of the software? My reason for wanting to do it this way is that I can't figure out a good way to debug the binary in IDA itself - the binary is a plugin, so it runs as part of another program, and the host operating system doesn't run IDA/Hex Rays Decompiler, so I'd have to set up a debugging server... etc.
Thanks in advance for any advice!