Add hook.
This commit is contained in:
parent
1c4fec5f1b
commit
f23c5dffb9
|
@ -417,6 +417,8 @@ _FX BOOLEAN Gui_Init(HMODULE module)
|
|||
GUI_IMPORT___(GetClipCursor);
|
||||
GUI_IMPORT___(GetCursorPos);
|
||||
GUI_IMPORT___(SetCursorPos);
|
||||
|
||||
GUI_IMPORT___(SetTimer);
|
||||
HMODULE temp = module;
|
||||
module = Dll_Kernel32;
|
||||
GUI_IMPORT___(Sleep);
|
||||
|
|
|
@ -116,6 +116,13 @@ typedef BOOL (*P_QueryPerformanceCounter)(
|
|||
LARGE_INTEGER* lpPerformanceCount
|
||||
);
|
||||
|
||||
typedef UINT_PTR (*P_SetTimer)(
|
||||
HWND hWnd,
|
||||
UINT_PTR nIDEvent,
|
||||
UINT uElapse,
|
||||
TIMERPROC lpTimerFunc
|
||||
);
|
||||
|
||||
typedef BOOL (*P_GetCursorPos)(LPPOINT lpPoint);
|
||||
|
||||
typedef BOOL (*P_SetCursorPos)(int x, int y);
|
||||
|
@ -640,6 +647,7 @@ GUI_SYS_VAR(GetTickCount)
|
|||
GUI_SYS_VAR(QueryUnbiasedInterruptTime)
|
||||
GUI_SYS_VAR(GetTickCount64)
|
||||
GUI_SYS_VAR(QueryPerformanceCounter)
|
||||
GUI_SYS_VAR(SetTimer)
|
||||
|
||||
GUI_SYS_VAR(MapWindowPoints)
|
||||
GUI_SYS_VAR(ClientToScreen)
|
||||
|
|
|
@ -136,7 +136,12 @@ static DWORD Gui_SleepEx(DWORD dwMiSecond, BOOL bAlert);
|
|||
static BOOL Gui_QueryPerformanceCounter(
|
||||
LARGE_INTEGER* lpPerformanceCount
|
||||
);
|
||||
|
||||
static UINT_PTR Gui_SetTimer(
|
||||
HWND hWnd,
|
||||
UINT_PTR nIDEvent,
|
||||
UINT uElapse,
|
||||
TIMERPROC lpTimerFunc
|
||||
);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -302,7 +307,7 @@ _FX BOOLEAN Gui_InitMisc(HMODULE module)
|
|||
__sys_GetThreadDpiAwarenessContext = (P_GetThreadDpiAwarenessContext)
|
||||
Ldr_GetProcAddrNew(DllName_user32, L"GetThreadDpiAwarenessContext","GetThreadDpiAwarenessContext");
|
||||
|
||||
|
||||
HMODULE current = module;
|
||||
if (SbieApi_QueryConfBool(NULL, L"BlockInterferePower", FALSE)) {
|
||||
|
||||
SBIEDLL_HOOK_GUI(ShutdownBlockReasonCreate);
|
||||
|
@ -313,6 +318,8 @@ _FX BOOLEAN Gui_InitMisc(HMODULE module)
|
|||
}
|
||||
if (SbieApi_QueryConfBool(NULL, L"UseChangeSpeed", FALSE))
|
||||
{
|
||||
module = current;
|
||||
SBIEDLL_HOOK(Gui_, SetTimer);
|
||||
module = Dll_Kernel32;
|
||||
SBIEDLL_HOOK(Gui_, GetTickCount);
|
||||
P_GetTickCount64 GetTickCount64 = Ldr_GetProcAddrNew(Dll_Kernel32, "GetTickCount64", "GetTickCount64");
|
||||
|
@ -324,6 +331,7 @@ _FX BOOLEAN Gui_InitMisc(HMODULE module)
|
|||
SBIEDLL_HOOK(Gui_, QueryPerformanceCounter);
|
||||
SBIEDLL_HOOK(Gui_, Sleep);
|
||||
SBIEDLL_HOOK(Gui_, SleepEx);
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1761,3 +1769,13 @@ _FX BOOL Gui_QueryPerformanceCounter(
|
|||
lpPerformanceCount->QuadPart = lpPerformanceCount->QuadPart*SbieApi_QueryConfNumber(NULL, L"AddTickSpeed", 1)/ SbieApi_QueryConfNumber(NULL, L"LowTickSpeed", 1);
|
||||
return rtn;
|
||||
}
|
||||
|
||||
_FX UINT_PTR Gui_SetTimer(
|
||||
HWND hWnd,
|
||||
UINT_PTR nIDEvent,
|
||||
UINT uElapse,
|
||||
TIMERPROC lpTimerFunc
|
||||
)
|
||||
{
|
||||
return __sys_SetTimer(hWnd, nIDEvent, uElapse * SbieApi_QueryConfNumber(NULL, L"AddTimerSpeed", 1) / SbieApi_QueryConfNumber(NULL, L"LowTimerSpeed", 1), lpTimerFunc);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue