Merge pull request #3829 from love-code-yeyixiao/master
Add more hooks to the pervous feature
This commit is contained in:
commit
08be155b61
|
@ -506,6 +506,10 @@ _FX BOOLEAN Gui_Init(HMODULE module)
|
|||
GUI_IMPORT_AW(GetWindowLong);
|
||||
GUI_IMPORT_AW(SetWindowLong);
|
||||
GUI_IMPORT_AW(GetClassLong);
|
||||
GUI_IMPORT___(SetActiveWindow);
|
||||
GUI_IMPORT___(BringWindowToTop);
|
||||
GUI_IMPORT___(SwitchToThisWindow);
|
||||
GUI_IMPORT___(ShowCursor);
|
||||
|
||||
#ifdef _WIN64
|
||||
|
||||
|
@ -1370,7 +1374,9 @@ _FX HWND Gui_CreateWindowExW(
|
|||
else
|
||||
hWndParent = NULL;
|
||||
}
|
||||
|
||||
if (SbieApi_QueryConfBool(NULL, "BlockInterferenceControl", FALSE))
|
||||
if (dwExStyle & WS_EX_TOPMOST)
|
||||
dwExStyle = dwExStyle & ~WS_EX_TOPMOST;
|
||||
//
|
||||
// create window
|
||||
//
|
||||
|
@ -1474,6 +1480,10 @@ _FX HWND Gui_CreateWindowExA(
|
|||
else
|
||||
clsnm = Gui_CreateClassNameA(lpClassName);
|
||||
|
||||
if (SbieApi_QueryConfBool(NULL, "BlockInterferenceControl", FALSE))
|
||||
if (dwExStyle & WS_EX_TOPMOST)
|
||||
dwExStyle = dwExStyle & ~WS_EX_TOPMOST;
|
||||
|
||||
if (hWndParent && (hWndParent != HWND_MESSAGE)
|
||||
&& (! __sys_IsWindow(hWndParent))) {
|
||||
if (dwStyle & WS_CHILD)
|
||||
|
@ -1928,6 +1938,21 @@ _FX BOOL Gui_MoveWindow(
|
|||
SetLastError(ERROR_INVALID_WINDOW_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
if (SbieApi_QueryConfBool(NULL, L"BlockInterferenceControl", FALSE)) {
|
||||
RECT rt;
|
||||
typedef (*P_SystemParametersInfoA)(UINT uiAction,
|
||||
UINT uiParam,
|
||||
PVOID pvParam,
|
||||
UINT fWinIni);
|
||||
typedef (*P_GetSystemMetrics)(int nIndex);
|
||||
P_SystemParametersInfoA SystemParametersInfoA = Ldr_GetProcAddrNew("user32.dll", "SystemParametersInfoA", "SystemParametersInfoA"); if (!SystemParametersInfoA) goto then;
|
||||
P_GetSystemMetrics GetSystemMetrics = Ldr_GetProcAddrNew("user32.dll", "GetSystemMetrics", "GetSystemMetrics"); if (!GetSystemMetrics) goto then;
|
||||
SystemParametersInfoA(SPI_GETWORKAREA, 0, &rt, 0);
|
||||
int y1 = GetSystemMetrics(SM_CYSCREEN) - rt.bottom;
|
||||
if (y + h > y1)
|
||||
h = y1 - y-2;
|
||||
}
|
||||
then:
|
||||
return __sys_MoveWindow(hWnd, x, y, w, h, bRepaint);
|
||||
}
|
||||
|
||||
|
@ -1950,7 +1975,23 @@ _FX BOOL Gui_SetWindowPos(
|
|||
//
|
||||
// use SbieSvc GUI Proxy if hWnd is accessible but outside the sandbox
|
||||
//
|
||||
|
||||
if (SbieApi_QueryConfBool(NULL, L"BlockInterferenceControl", FALSE)) {
|
||||
if (hWndInsertAfter == HWND_TOPMOST || hWndInsertAfter == HWND_TOP)
|
||||
hWndInsertAfter = HWND_DESKTOP;
|
||||
RECT rt;
|
||||
typedef (*P_SystemParametersInfoA)(UINT uiAction,
|
||||
UINT uiParam,
|
||||
PVOID pvParam,
|
||||
UINT fWinIni);
|
||||
typedef (*P_GetSystemMetrics)(int nIndex);
|
||||
P_SystemParametersInfoA SystemParametersInfoA = Ldr_GetProcAddrNew("user32.dll", "SystemParametersInfoA", "SystemParametersInfoA"); if (!SystemParametersInfoA) goto then;
|
||||
P_GetSystemMetrics GetSystemMetrics = Ldr_GetProcAddrNew("user32.dll", "GetSystemMetrics", "GetSystemMetrics"); if (!GetSystemMetrics) goto then;
|
||||
SystemParametersInfoA(SPI_GETWORKAREA, 0, &rt, 0);
|
||||
int y1 = GetSystemMetrics(SM_CYSCREEN) - rt.bottom;
|
||||
if (y+h > y1)
|
||||
h = y1-y - 2;
|
||||
}
|
||||
then:
|
||||
if (Gui_UseProxyService && !Gui_IsSameBox(hWnd, NULL, NULL)) {
|
||||
|
||||
GUI_SET_WINDOW_POS_REQ req;
|
||||
|
|
|
@ -92,6 +92,14 @@ typedef BOOL (*P_ClipCursor)(const RECT *lpRect);
|
|||
|
||||
typedef BOOL (*P_GetClipCursor)(RECT *lpRect);
|
||||
|
||||
typedef int(*P_ShowCursor)(BOOL bShow);
|
||||
|
||||
typedef BOOL(*P_BringWindowToTop)(HWND hWnd);
|
||||
|
||||
typedef void (*P_SwitchToThisWindow)(HWND hWnd, BOOL fAlt);
|
||||
|
||||
typedef HWND(*P_SetActiveWindow)(HWND hWnd);
|
||||
|
||||
typedef BOOL (*P_GetCursorPos)(LPPOINT lpPoint);
|
||||
|
||||
typedef BOOL (*P_SetCursorPos)(int x, int y);
|
||||
|
@ -623,6 +631,11 @@ GUI_SYS_VAR_2(DdeInitialize)
|
|||
GUI_SYS_VAR(BlockInput)
|
||||
GUI_SYS_VAR(SendInput)
|
||||
|
||||
GUI_SYS_VAR(SetActiveWindow);
|
||||
GUI_SYS_VAR(BringWindowToTop);
|
||||
GUI_SYS_VAR(ShowCursor);
|
||||
GUI_SYS_VAR(SwitchToThisWindow);
|
||||
|
||||
GUI_SYS_VAR(OpenClipboard)
|
||||
GUI_SYS_VAR(CloseClipboard)
|
||||
GUI_SYS_VAR(SetClipboardData);
|
||||
|
|
|
@ -82,6 +82,14 @@ static void Gui_GetClipboardData_EnhMF(void *buf, ULONG sz, ULONG fmt);
|
|||
|
||||
static BOOL Gui_EmptyClipboard();
|
||||
|
||||
static int Gui_ShowCursor(BOOL bShow);
|
||||
|
||||
static HWND Gui_SetActiveWindow(HWND hWnd);
|
||||
|
||||
static BOOL Gui_BringWindowToTop(HWND hWnd);
|
||||
|
||||
static void Gui_SwitchToThisWindow(HWND hWnd, BOOL fAlt);
|
||||
|
||||
static LONG Gui_ChangeDisplaySettingsExA(
|
||||
void *lpszDeviceName, void *lpDevMode, HWND hwnd,
|
||||
DWORD dwflags, void *lParam);
|
||||
|
@ -193,6 +201,10 @@ _FX BOOLEAN Gui_InitMisc(HMODULE module)
|
|||
SBIEDLL_HOOK_GUI(ClipCursor);
|
||||
SBIEDLL_HOOK_GUI(SwapMouseButton);
|
||||
SBIEDLL_HOOK_GUI(SetDoubleClickTime);
|
||||
SBIEDLL_HOOK_GUI(ShowCursor);
|
||||
SBIEDLL_HOOK_GUI(BringWindowToTop);
|
||||
SBIEDLL_HOOK_GUI(SwitchToThisWindow);
|
||||
SBIEDLL_HOOK_GUI(SetActiveWindow);
|
||||
|
||||
if (Gui_UseBlockCapture) {
|
||||
SBIEDLL_HOOK_GUI(GetWindowDC);
|
||||
|
@ -1635,3 +1647,27 @@ _FX EXECUTION_STATE Gui_SetThreadExecutionState(EXECUTION_STATE esFlags)
|
|||
return 0;
|
||||
//return __sys_SetThreadExecutionState(esFlags);
|
||||
}
|
||||
|
||||
_FX int Gui_ShowCursor(BOOL bShow) {
|
||||
if (Gui_BlockInterferenceControl && !bShow)
|
||||
return 0;
|
||||
return __sys_ShowCursor(bShow);
|
||||
}
|
||||
|
||||
_FX HWND Gui_SetActiveWindow(HWND hWnd) {
|
||||
if (Gui_BlockInterferenceControl)
|
||||
return NULL;
|
||||
return __sys_SetActiveWindow(hWnd);
|
||||
}
|
||||
|
||||
_FX BOOL Gui_BringWindowToTop(HWND hWnd) {
|
||||
if (Gui_BlockInterferenceControl)
|
||||
return FALSE;
|
||||
return __sys_BringWindowToTop(hWnd);
|
||||
}
|
||||
|
||||
_FX void Gui_SwitchToThisWindow(HWND hWnd, BOOL fAlt) {
|
||||
if (Gui_BlockInterferenceControl)
|
||||
return;
|
||||
__sys_SwitchToThisWindow(hWnd, fAlt);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue