From 93699b5dc07b8b05f5d2266523e0630b1cb1e4b1 Mon Sep 17 00:00:00 2001 From: love-code-yeyixiao <188240888@qq.com> Date: Sat, 20 Apr 2024 15:42:30 +0800 Subject: [PATCH] Fix --- Sandboxie/core/dll/gui.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Sandboxie/core/dll/gui.c b/Sandboxie/core/dll/gui.c index 90bb5b8d..f4db6abb 100644 --- a/Sandboxie/core/dll/gui.c +++ b/Sandboxie/core/dll/gui.c @@ -1949,8 +1949,15 @@ _FX BOOL Gui_MoveWindow( 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; + int y1 = GetSystemMetrics(SM_CYSCREEN) - rt.bottom, x1 = GetSystemMetrics(SM_CXSCREEN) - rt.right, y2 = GetSystemMetrics(SM_CYSCREEN) - rt.top, x2 = GetSystemMetrics(SM_CXSCREEN) - rt.left; if (y + h > y1) - h = y1 - y-2; + h = y1 - y - 2; + if (y < y2) + y = y2 + 2; + if (x + w > x1) + w = x1 - x; + if (x < x2) + x = x2 + 2; } then: return __sys_MoveWindow(hWnd, x, y, w, h, bRepaint); @@ -1987,9 +1994,15 @@ _FX BOOL Gui_SetWindowPos( 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; + int y1 = GetSystemMetrics(SM_CYSCREEN) - rt.bottom,x1= GetSystemMetrics(SM_CXSCREEN)-rt.right, y2 = GetSystemMetrics(SM_CYSCREEN) - rt.top, x2 = GetSystemMetrics(SM_CXSCREEN) - rt.left; if (y+h > y1) h = y1-y - 2; + if (y < y2) + y = y2 + 2; + if (x + w > x1) + w = x1 - x; + if (x < x2) + x = x2+2; } then: if (Gui_UseProxyService && !Gui_IsSameBox(hWnd, NULL, NULL)) {