Hi.
I am using a low level mouse hook to grab mouse events. In there, I roll my own double click detection and set that in local static bool MouseDoubleClick.
For the sake of speed I thought it good to send the address of bool MouseDoubleClick over to the my application (a dll plugin) that needs to know about this by casting the received address to a pointer to a bool, and using the pointer to the bool value over in the dll plugin to make logic determinations.
This works great with a 32 bit low level hook and a 32 bit instance of the plugin dll.
However with a 64 bit low level hook (same code as 32 bit, just recompiled) and a 64 bit instance of the plugin dll (Also same code as 32 bit, just recompiled)something weird is happening.
The 64 bit value of MouseDoubleClick that comes over is indeed a 64bit value and also correct. I cast that to a pointer and away we go except down stream, at the end of an unrelated function it crashes at the closing brace of this downstream function, claiming there was a fatal exception reading 0xffffffffffffffff.
I have surmised that this is the return address off the stack and is obviously wrong.
If I comment out the exported function in the DEF file that is called by the mousehook (where I sen over the address of bool MouseDoubleClick) everything runs smooth except the pointer to that bool is 0 and checks for that skip over and don't use it because it's null.
I have no idea what I am doing wrong, but there must be something amiss.
Thanks in advance.
Here is the "relevant" code
// Low Level Mouse Hook Sniplet
typedef void (LPFNDLLFUNC1)(bool*);
static bool MouseDoubleClick = false;
HINSTANCE hDLL = LoadLibrary("<Path to the plugin DLL x64 version>");
lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL, "SetMouseDoubleClick");
lpfnDllFunc1(&MouseDoubleClick);
// Plugin DLL MouseDoubleClick pointer receiver function.
bool *pMDC = NULL;
void SetMouseDoubleClick(INT_PTR HooksMDC)
{
pMDC = (bool*) HooksMDC;
}
// Ooh, the DEF File!
EXPORTS
SetMouseDoubleClick