1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2024-11-28 00:10:51 +01:00

sdvxhook2: fix crash when using sdvxhook2 on certain OS versions

This commit is contained in:
Will Xyen 2022-05-19 20:52:45 -07:00 committed by 6fe20d9b80a9661a09ef66dfd58832d49592386b
parent bd2d722031
commit 537b1fa384

View File

@ -1,4 +1,4 @@
#define LOG_MODULE "power-hook"
#define LOG_MODULE "nvapi-hook"
// clang-format off
// Don't format because the order is important here
@ -33,10 +33,14 @@ static struct hook_symbol nvapihook_kernel_syms[] = {
static void *my_GetProcAddress(HMODULE dll, const char *name)
{
if (strcmp("nvapi_QueryInterface", name) == 0) {
log_info("Request for stub %s", name);
real_nvapi_QueryInterface = real_GetProcAddress(dll, name);
return &my_nvapi_QueryInterface;
if (name != NULL && ((intptr_t) name) > UINT16_MAX) {
// only strcmp is non-ordinal
// https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getprocaddress
if (strcmp("nvapi_QueryInterface", name) == 0) {
log_info("Request for stub %s", name);
real_nvapi_QueryInterface = real_GetProcAddress(dll, name);
return &my_nvapi_QueryInterface;
}
}
// log_warning("Request for unknown stub %s", name);