sdvxhook: address comments
This commit is contained in:
@@ -28,3 +28,5 @@ src_sdvxhook2 := \
|
|||||||
bi2a.c \
|
bi2a.c \
|
||||||
dllmain.c \
|
dllmain.c \
|
||||||
config-io.c \
|
config-io.c \
|
||||||
|
nvapi.c \
|
||||||
|
power.c \
|
||||||
|
|||||||
@@ -152,17 +152,14 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
|||||||
ac_io_port_init(config_io.com1_card_reader);
|
ac_io_port_init(config_io.com1_card_reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
// camera hooks
|
|
||||||
if (!config_cam.disable_emu) {
|
if (!config_cam.disable_emu) {
|
||||||
camhook_init(&config_cam);
|
camhook_init(&config_cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
// power hooks
|
|
||||||
if (!config_io.disable_power_hooks) {
|
if (!config_io.disable_power_hooks) {
|
||||||
powerhook_init();
|
powerhook_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// nvapi hooks
|
|
||||||
if (!config_io.disable_nvapi_hooks) {
|
if (!config_io.disable_nvapi_hooks) {
|
||||||
nvapihook_init();
|
nvapihook_init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,8 @@
|
|||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
static HMODULE my_LoadLibraryExW(const wchar_t *name, HANDLE hFile, DWORD dwFlags);
|
|
||||||
static void *my_GetProcAddress(HMODULE dll, const char *name);
|
static void *my_GetProcAddress(HMODULE dll, const char *name);
|
||||||
|
|
||||||
static HMODULE(*real_LoadLibraryExW)(const wchar_t *name, HANDLE hFile, DWORD dwFlags);
|
|
||||||
static void *(*real_GetProcAddress)(HMODULE dll, const char *name);
|
static void *(*real_GetProcAddress)(HMODULE dll, const char *name);
|
||||||
|
|
||||||
// nvapi64.dll
|
// nvapi64.dll
|
||||||
@@ -28,29 +26,13 @@ static void *my_nvapi_QueryInterface(uint32_t FunctionOffset);
|
|||||||
static void *(*real_nvapi_QueryInterface)(uint32_t FunctionOffset);
|
static void *(*real_nvapi_QueryInterface)(uint32_t FunctionOffset);
|
||||||
|
|
||||||
static struct hook_symbol nvapihook_kernel_syms[] = {
|
static struct hook_symbol nvapihook_kernel_syms[] = {
|
||||||
{.name = "LoadLibraryExW",
|
|
||||||
.patch = my_LoadLibraryExW,
|
|
||||||
.link = (void *) &real_LoadLibraryExW},
|
|
||||||
{.name = "GetProcAddress",
|
{.name = "GetProcAddress",
|
||||||
.patch = my_GetProcAddress,
|
.patch = my_GetProcAddress,
|
||||||
.link = (void *) &real_GetProcAddress},
|
.link = (void *) &real_GetProcAddress},
|
||||||
};
|
};
|
||||||
|
|
||||||
static HMODULE my_LoadLibraryExW(const wchar_t *name, HANDLE hFile, DWORD dwFlags)
|
|
||||||
{
|
|
||||||
// if (wcsicmp(name, L"nvpowerapi.dll") == 0 || wcsicmp(name, L"nvapi64.dll") == 0)) {
|
|
||||||
// return NULL;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return real_LoadLibraryExW(name, hFile, dwFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *my_GetProcAddress(HMODULE dll, const char *name)
|
static void *my_GetProcAddress(HMODULE dll, const char *name)
|
||||||
{
|
{
|
||||||
// if (dll != NULL) {
|
|
||||||
// return real_GetProcAddress(dll, name);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (strcmp("nvapi_QueryInterface", name) == 0) {
|
if (strcmp("nvapi_QueryInterface", name) == 0) {
|
||||||
log_info("Request for stub %s", name);
|
log_info("Request for stub %s", name);
|
||||||
real_nvapi_QueryInterface = real_GetProcAddress(dll, name);
|
real_nvapi_QueryInterface = real_GetProcAddress(dll, name);
|
||||||
|
|||||||
Reference in New Issue
Block a user