Let us start here, from square one. No, from Zero!

This commit is contained in:
smpn2
2022-09-30 22:45:51 +09:00
parent 14215af0d1
commit b7a60638a4
1005 changed files with 303069 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
#include "powrprof.h"
#include <windows.h>
#include <powrprof.h>
#include "util/detour.h"
#include "util/logging.h"
/*
* These hooks are required because Sound Voltex Exceed Gear sets `GUID_PROCESSOR_IDLE_DISABLE` to
* minimize CPU idle downclocking. While this may be good for cab use, it causes unnecessary power
* usage, battery drain on laptops, and requires a manual `powercfg` command to fix later on, which
* is annoying.
*/
//static decltype(PowerGetActiveScheme) *PowerGetActiveScheme_orig = nullptr;
//static decltype(PowerSetActiveScheme) *PowerSetActiveScheme_orig = nullptr;
//static decltype(PowerWriteACValueIndex) *PowerWriteACValueIndex_orig = nullptr;
static DWORD WINAPI PowerGetActiveScheme_hook(HKEY UserRootPowerKey, GUID **ActivePolicyGuid) {
// stubbed
return ERROR_SUCCESS;
}
static DWORD WINAPI PowerSetActiveScheme_hook(HKEY UserRootPowerKey, const GUID *SchemeGuid) {
// stubbed
return ERROR_SUCCESS;
}
static DWORD WINAPI PowerWriteACValueIndex_hook(
HKEY RootPowerKey,
const GUID *SchemeGuid,
const GUID *SubGroupOfPowerSettingsGuid,
const GUID *PowerSettingGuid,
DWORD AcValueIndex)
{
// stubbed
return ERROR_SUCCESS;
}
void powrprof_hook_init(HMODULE module) {
log_info("powrprof", "initializing");
detour::iat_try("PowerGetActiveScheme", &PowerGetActiveScheme_hook, module);
detour::iat_try("PowerSetActiveScheme", &PowerSetActiveScheme_hook, module);
detour::iat_try("PowerWriteACValueIndex", &PowerWriteACValueIndex_hook, module);
}