I have a vb6 exe that starts a thread hook injected into another process.
The hook installer code is in the dll that is written in c
After the installhook call is made I am finished with the dll and it is now injected into the target process so I call FreeLibrary which is returning 1 which means it succeeded but a look at
Process Explorer shows not only the injected hookproc in the target process but an instance of the dll code is still hanging around and being held onto by the this process that installed the hook. This is causing an issue in deleting the hook dll when the injected code terminates saying it is in use by the installing process.
I hope this is remotely clear.
VB6 "hook starter"
hinstDLL = LoadLibrary(AppFilePath + "\\BCRMultiUnit\BCRBitBridgeHelper.dll")
hkprcSysMsg = GetProcAddress(hinstDLL, "ReadVSTStripNumProc")
InstallHookProc = GetProcAddress(hinstDLL, "installhook")
BitBridgeThread = GetWindowThreadProcessId(HwndBitBridge, 0)
installhook ByVal hinstDLL, ByVal BitBridgeThread
FreeLibrary (hinstDLL) '' I expect this to unload the dll from this process
The hook installer function in the hook dll
BOOL __declspec(dllexport)__stdcall installhook(HINSTANCE hinstDLL, long BitBridgeThread)
{
hBitBridge = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)ReadVSTStripNumProc, hinstDLL, BitBridgeThread);
return TRUE;
}
Help? :-)
Thanks in advance!
:Ron