commit
5bfa5c5a04
|
@ -196,8 +196,16 @@ _FX BOOL WINAPI DllMain(
|
|||
|
||||
Dll_InitGeneric(hInstance);
|
||||
SbieDll_HookInit();
|
||||
if (SbieApi_QueryConfBool(NULL, "UseSandboxDesktop", FALSE)) {
|
||||
wchar_t* boxName = { L'\0' },*Temp=L"Desktop_";
|
||||
SbieApi_QueryBoxPath(&boxName, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
lstrcat(Temp, boxName);
|
||||
HDESK hDesk = OpenDesktopA(Temp, 0, FALSE, GENERIC_ALL);
|
||||
if(hDesk)
|
||||
SetThreadDesktop(hDesk);
|
||||
}
|
||||
|
||||
} else if (dwReason == DLL_PROCESS_DETACH) {
|
||||
} else if (dwReason == DLL_PROCESS_DETACH) {
|
||||
|
||||
if (Dll_InitComplete && Dll_BoxName) {
|
||||
|
||||
|
|
|
@ -246,6 +246,7 @@ static HWND Gui_CreateWindowExA(
|
|||
HINSTANCE hInstance,
|
||||
LPVOID lpParam);
|
||||
|
||||
|
||||
static HWND Gui_CreateWindowExW(
|
||||
DWORD dwExStyle,
|
||||
void *lpClassName,
|
||||
|
@ -416,7 +417,18 @@ _FX BOOLEAN Gui_Init(HMODULE module)
|
|||
GUI_IMPORT___(ClipCursor);
|
||||
GUI_IMPORT___(GetClipCursor);
|
||||
GUI_IMPORT___(GetCursorPos);
|
||||
GUI_IMPORT___(SetCursorPos);
|
||||
GUI_IMPORT___(SetCursorPos);
|
||||
|
||||
GUI_IMPORT___(SetTimer);
|
||||
HMODULE temp = module;
|
||||
module = Dll_Kernel32;
|
||||
GUI_IMPORT___(Sleep);
|
||||
GUI_IMPORT___(SleepEx);
|
||||
GUI_IMPORT___(GetTickCount);
|
||||
GUI_IMPORT___(GetTickCount64);
|
||||
GUI_IMPORT___(QueryUnbiasedInterruptTime);
|
||||
GUI_IMPORT___(QueryPerformanceCounter);
|
||||
module = temp;
|
||||
|
||||
GUI_IMPORT___(MsgWaitForMultipleObjects);
|
||||
GUI_IMPORT_AW(PeekMessage);
|
||||
|
@ -1344,6 +1356,8 @@ _FX HWND Gui_CreateWindowExW(
|
|||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
SetDesktop();
|
||||
|
||||
THREAD_DATA *TlsData = Dll_GetTlsData(NULL);
|
||||
void *new_WindowName;
|
||||
WCHAR *clsnm;
|
||||
|
@ -1479,6 +1493,8 @@ _FX HWND Gui_CreateWindowExA(
|
|||
HINSTANCE hInstance,
|
||||
LPVOID lpParam)
|
||||
{
|
||||
SetDesktop();
|
||||
|
||||
THREAD_DATA *TlsData = Dll_GetTlsData(NULL);
|
||||
void *new_WindowName;
|
||||
UCHAR *clsnm;
|
||||
|
@ -2849,3 +2865,13 @@ _FX BOOLEAN ComDlg32_Init(HMODULE module)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
void SetDesktop() {
|
||||
if (SbieApi_QueryConfBool(NULL, "UseSandboxDesktop", FALSE)) {
|
||||
wchar_t* boxName = { L'\0' }, * Temp = L"Desktop_";
|
||||
SbieApi_QueryBoxPath(&boxName, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
lstrcat(Temp, boxName);
|
||||
HDESK hDesk = OpenDesktopA(Temp, 0, FALSE, GENERIC_ALL);
|
||||
if (hDesk)
|
||||
SetThreadDesktop(hDesk);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,29 @@ typedef void (*P_SwitchToThisWindow)(HWND hWnd, BOOL fAlt);
|
|||
|
||||
typedef HWND(*P_SetActiveWindow)(HWND hWnd);
|
||||
|
||||
typedef DWORD(*P_GetTickCount)();
|
||||
|
||||
typedef ULONGLONG (*P_GetTickCount64)();
|
||||
|
||||
typedef BOOL(*P_QueryUnbiasedInterruptTime)(
|
||||
PULONGLONG UnbiasedTime
|
||||
);
|
||||
|
||||
typedef void(*P_Sleep)(DWORD dwMiSecond);
|
||||
|
||||
typedef DWORD(*P_SleepEx)(DWORD dwMiSecond, BOOL bAlert);
|
||||
|
||||
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);
|
||||
|
@ -618,6 +641,14 @@ GUI_SYS_VAR_2(PostMessage)
|
|||
GUI_SYS_VAR_2(PostThreadMessage)
|
||||
GUI_SYS_VAR_2(DispatchMessage)
|
||||
|
||||
GUI_SYS_VAR(Sleep)
|
||||
GUI_SYS_VAR(SleepEx)
|
||||
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)
|
||||
GUI_SYS_VAR(ScreenToClient)
|
||||
|
@ -909,6 +940,7 @@ BOOLEAN Ole_DoDragDrop(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
|||
|
||||
BOOLEAN Gui_InitMisc(HMODULE module);
|
||||
|
||||
static void SetDesktop();
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ _FX HHOOK Gui_SetWindowsHookExA(
|
|||
int idHook, HOOKPROC lpfn, HINSTANCE hMod, DWORD dwThreadId)
|
||||
{
|
||||
HHOOK hhook;
|
||||
|
||||
SetDesktop();
|
||||
if ( idHook == WH_JOURNALRECORD || idHook == WH_JOURNALPLAYBACK ||
|
||||
idHook == WH_KEYBOARD_LL || idHook == WH_MOUSE_LL ||
|
||||
//Gui_IsThreadInThisProcess(dwThreadId)
|
||||
|
@ -241,7 +241,7 @@ _FX HHOOK Gui_SetWindowsHookExW(
|
|||
//
|
||||
|
||||
HHOOK hhook;
|
||||
|
||||
SetDesktop();
|
||||
if ( idHook == WH_JOURNALRECORD || idHook == WH_JOURNALPLAYBACK ||
|
||||
idHook == WH_KEYBOARD_LL || idHook == WH_MOUSE_LL ||
|
||||
//Gui_IsThreadInThisProcess(dwThreadId)
|
||||
|
|
|
@ -121,6 +121,27 @@ static BOOL Gui_ShutdownBlockReasonCreate(HWND hWnd, LPCWSTR pwszReason);
|
|||
|
||||
static EXECUTION_STATE Gui_SetThreadExecutionState(EXECUTION_STATE esFlags);
|
||||
|
||||
static DWORD Gui_GetTickCount();
|
||||
|
||||
static ULONGLONG Gui_GetTickCount64();
|
||||
|
||||
static BOOL Gui_QueryUnbiasedInterruptTime(
|
||||
PULONGLONG UnbiasedTime
|
||||
);
|
||||
|
||||
static void Gui_Sleep(DWORD dwMiSecond);
|
||||
|
||||
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
|
||||
);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -286,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);
|
||||
|
@ -295,7 +316,24 @@ _FX BOOLEAN Gui_InitMisc(HMODULE module)
|
|||
|
||||
SBIEDLL_HOOK(Gui_, SetThreadExecutionState);
|
||||
}
|
||||
|
||||
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");
|
||||
if (GetTickCount64)
|
||||
SBIEDLL_HOOK(Gui_, GetTickCount64);
|
||||
P_QueryUnbiasedInterruptTime QueryUnbiasedInterruptTime = Ldr_GetProcAddrNew(Dll_Kernel32, "QueryUnbiasedInterruptTime", "QueryUnbiasedInterruptTime");
|
||||
if (QueryUnbiasedInterruptTime)
|
||||
SBIEDLL_HOOK(Gui_, QueryUnbiasedInterruptTime);
|
||||
SBIEDLL_HOOK(Gui_, QueryPerformanceCounter);
|
||||
SBIEDLL_HOOK(Gui_, Sleep);
|
||||
SBIEDLL_HOOK(Gui_, SleepEx);
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1699,3 +1737,45 @@ _FX void Gui_SwitchToThisWindow(HWND hWnd, BOOL fAlt)
|
|||
return;
|
||||
__sys_SwitchToThisWindow(hWnd, fAlt);
|
||||
}
|
||||
|
||||
_FX DWORD Gui_GetTickCount() {
|
||||
return __sys_GetTickCount() * SbieApi_QueryConfNumber(NULL, L"AddTickSpeed", 1) / SbieApi_QueryConfNumber(NULL,L"LowTickSpeed", 1);
|
||||
}
|
||||
|
||||
_FX ULONGLONG Gui_GetTickCount64() {
|
||||
return __sys_GetTickCount64() * SbieApi_QueryConfNumber(NULL, L"AddTickSpeed", 1) / SbieApi_QueryConfNumber(NULL, L"LowTickSpeed", 1);
|
||||
}
|
||||
|
||||
_FX BOOL Gui_QueryUnbiasedInterruptTime(
|
||||
PULONGLONG UnbiasedTime
|
||||
) {
|
||||
BOOL rtn = __sys_QueryUnbiasedInterruptTime(UnbiasedTime);
|
||||
*UnbiasedTime *= SbieApi_QueryConfNumber(NULL, L"AddTickSpeed", 1) / SbieApi_QueryConfNumber(NULL, L"LowTickSpeed", 1);
|
||||
return rtn;
|
||||
}
|
||||
|
||||
_FX void Gui_Sleep(DWORD dwMiSecond) {
|
||||
__sys_Sleep(dwMiSecond * SbieApi_QueryConfNumber(NULL, L"AddSleepSpeed", 1) / SbieApi_QueryConfNumber(NULL, L"LowSleepSpeed", 1));
|
||||
}
|
||||
|
||||
_FX DWORD Gui_SleepEx(DWORD dwMiSecond, BOOL bAlert) {
|
||||
return __sys_SleepEx(dwMiSecond * SbieApi_QueryConfNumber(NULL, L"AddSleepSpeed", 1) / SbieApi_QueryConfNumber(NULL, L"LowSleepSpeed", 1),bAlert);
|
||||
}
|
||||
|
||||
_FX BOOL Gui_QueryPerformanceCounter(
|
||||
LARGE_INTEGER* lpPerformanceCount
|
||||
) {
|
||||
BOOL rtn = __sys_QueryPerformanceCounter(lpPerformanceCount);
|
||||
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