Whats the best inter-process communication for a C++ DLL that's injected into a third-party process and a C# application? Here's the current situation:
// This gets executed within the target process memory region
LRESULT CALLBACK HookProc(int code, WPARAM wParam, LPARAM lParam)
{
if (code > 0)
{
auto csharpApplicationFunctionPointerAddress = 0xdeadbeef;
auto csharpApplicationFunctionResult = call csharp function with N parameters here
// Do something with the result
if (csharpApplicationFunctionResult == "foo")
{
}
}
return CallNextHookEx(hookInstance, code, wParam, lParam);
}
I've come across this and figured out I'd need a RPC, however I can't seem to find the best suitable RPC for this problem, as that communication requires passing N parameters and getting the result back as fast as possible.
NOTES:
Are even there any options left? Feel free to correct me the notes above.
I ended up creating an invisible dummy window to serve as a central point for receiving messages through SendMessage
calls from the DLL.
User contributions licensed under CC BY-SA 3.0