The documentation for SetWindowsHookEx says,
If an application requires the use of hooks in other processes, it is required that a 32-bit application call SetWindowsHookEx to inject a 32-bit DLL into 32-bit processes, and a 64-bit application call SetWindowsHookEx to inject a 64-bit DLL into 64-bit processes.
This strongly implies that when the hook filter callback is called, it is the code inside the hooked application's copy of the hook DLL that is run.
However, when I install the hook, I need to pass a function pointer to my filter callback function. This strongly implies that it is the code inside the application that installs the hook that is run when the hook is called. This is because a function pointer inside one process' address space is not valid inside the address space of another process.
So which is it? When a hook filter callback is called, which code is actually run, the code inside the targeted (hooked) application, or the code inside the application that installed the hook?
Thank you