Skip to content

Commit

Permalink
Merge pull request #3 from love-code-yeyixiao/FixAndCheckAutoDelete
Browse files Browse the repository at this point in the history
Fix and add two feature
  • Loading branch information
love-code-yeyixiao committed Mar 2, 2024
2 parents e45246e + 44d9792 commit b264e37
Show file tree
Hide file tree
Showing 6 changed files with 332 additions and 279 deletions.
25 changes: 25 additions & 0 deletions Sandboxie/core/dll/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,8 @@ _FX LRESULT Gui_WindowProcA(

if (uMsg == WM_SETTEXT && Gui_ShouldCreateTitle(hWnd))
new_lParam = (LPARAM)Gui_CreateTitleA((UCHAR *)lParam);
if (uMsg == WM_CREATE)
ProtectScreen(hWnd);
else
new_lParam = lParam;

Expand Down Expand Up @@ -2702,3 +2704,26 @@ _FX BOOLEAN ComDlg32_Init(HMODULE module)

return TRUE;
}

_FX VOID ProtectScreen(HWND hWnd) {
WCHAR buffer[BOXNAME_COUNT] = { L"\0" };
SbieApi_QueryProcess(GetCurrentProcess(), buffer, 0, 0, 0);
if (SbieApi_QueryConfBool(buffer, L"IsProtectScreen", FALSE)) {
OSVERSIONINFOEX os;
os.dwOSVersionInfoSize = sizeof(os);
if (GetVersionEx(&os))
{
if (os.dwMajorVersion == 6) {
HMODULE hDll = GetModuleHandleW(L"user32.dll");
if (hDll != NULL && hDll != INVALID_HANDLE_VALUE) {
typedef BOOL(*LPSETWINDOWDISPLAYAFFINITY)(HWND, DWORD);
LPSETWINDOWDISPLAYAFFINITY swda = GetProcAddress(hDll, "SetWindowDisplayAffinity");
if (swda) {
swda(hWnd, 0x00000001);
}

}
}
}
}
}

0 comments on commit b264e37

Please sign in to comment.