- How long you been coding/hacking?
- More than a year
So I'm currently working on a dxgkrnl function hook to be able communicate with usermode using the win32u.dll wrapper.
I succeeded with the kernelmode part, so the function now redirects execution flow to my hookHandler function which can handle usermode requests.
The problem is with my usermode part, I get an access violation when I try to call the function in win32u.dll.
Here is the code (RoutineName is a placeholder for the hooked routine):
However after loading the kdriver , the usermode program (ran as admin) crashes at this line
with the exception:
I pretty sure this might be a permission issue or me doing some stupid things with my hook .
Any ideas?
Thanks in advance.
I succeeded with the kernelmode part, so the function now redirects execution flow to my hookHandler function which can handle usermode requests.
The problem is with my usermode part, I get an access violation when I try to call the function in win32u.dll.
Here is the code (RoutineName is a placeholder for the hooked routine):
Usermode:
template<typename T>
__int64 call_hook(const T arg)
{
using RoutineName = __int64(__stdcall*)(T);
auto hooked_func = (RoutineName)GetProcAddress(LoadLibrary("win32u.dll"), "RoutineName");
return hooked_func(arg);
}
C++:
return hooked_func(arg);
Error:
Exception thrown at 0x00007FF87A4BFDDB (ntdll.dll) in UserModeProgram.exe: 0xC0000005: Access violation reading location 0x00000000000002A0.
Any ideas?
Thanks in advance.