Reputation: 1838
Unfortunately, for some reason I cannot fathom, I haven't been able to get windbg to recognise my extension.
#ifndef EXPT_API
#define EXPT_API __declspec(dllexport)
#endif
extern "C" EXPT_API HRESULT CALLBACK help(PDEBUG_CLIENT Client, PCSTR args)
{
IDebugControl* Control;
IDebugSymbols* Symbols;
DebugCreate(__uuidof(IDebugClient),(void **)&Client);
Client->QueryInterface(__uuidof(IDebugControl), (void **)&Control);
Client->QueryInterface(__uuidof(IDebugSymbols), (void **)&Symbols);
// TODO: Extension code goes here:
Control->Output(DEBUG_OUTPUT_NORMAL, "A sample help message.");
return S_OK;
}
It all compiles fine, however, whenever I attempt to load the extension from windbg, I get this:
!Extension.help
No export help found
I load up my .dll into IDA Pro Free, and look at the exports, and there it is: "help". I have been trying to figure this out for hours. Any help you could offer would be very greatly appreciated. Thanks a lot.
Upvotes: 0
Views: 447
Reputation: 32398
The chances are you're using the stdcall calling convention which results in name mangling even with extern "C". If you were using the cdecl this would not be the case. It's possible that you require stdcall if you're following the standard method of writing a WinDBG extension so the best way to work around the name mangling is to use a .def file which will allow you to call the exports exactly what you want.
See this previous question for a good rundown on the subtleties:
__cdecl or __stdcall on Windows?
Upvotes: 1