From 63fae07d12791d45f6924cf063d7285254e25ddf Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Mon, 7 Aug 2023 09:50:30 +0900 Subject: [PATCH] [SHELL32][SDK] Implement SHIsTempDisplayMode (#5523) CORE-9277 --- .../shell32/shelldesktop/CDesktopBrowser.cpp | 30 +++++++++++++++++++ dll/win32/shell32/stubs.cpp | 11 ------- sdk/include/reactos/undocshell.h | 2 ++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp b/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp index 3e45650e9c6..95327468757 100644 --- a/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp +++ b/dll/win32/shell32/shelldesktop/CDesktopBrowser.cpp @@ -520,3 +520,33 @@ BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop) return TRUE; } + +/************************************************************************* + * SHIsTempDisplayMode [SHELL32.724] + * + * Is the current display settings temporary? + */ +EXTERN_C BOOL WINAPI SHIsTempDisplayMode(VOID) +{ + TRACE("\n"); + + if (GetSystemMetrics(SM_REMOTESESSION) || GetSystemMetrics(SM_REMOTECONTROL)) + return FALSE; + + DEVMODEW DevMode; + ZeroMemory(&DevMode, sizeof(DevMode)); + DevMode.dmSize = sizeof(DevMode); + + if (!EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, &DevMode)) + return FALSE; + + if (!DevMode.dmPelsWidth || !DevMode.dmPelsHeight) + return FALSE; + + HDC hDC = GetDC(NULL); + DWORD cxWidth = GetDeviceCaps(hDC, HORZRES); + DWORD cyHeight = GetDeviceCaps(hDC, VERTRES); + ReleaseDC(NULL, hDC); + + return (cxWidth != DevMode.dmPelsWidth || cyHeight != DevMode.dmPelsHeight); +} diff --git a/dll/win32/shell32/stubs.cpp b/dll/win32/shell32/stubs.cpp index f3c79305971..bc8bf50f7b5 100644 --- a/dll/win32/shell32/stubs.cpp +++ b/dll/win32/shell32/stubs.cpp @@ -130,17 +130,6 @@ GetFileDescriptor(FILEGROUPDESCRIPTOR *pFileGroupDesc, BOOL bUnicode, INT iIndex return NULL; } -/* - * Unimplemented - */ -EXTERN_C BOOL -WINAPI -SHIsTempDisplayMode(VOID) -{ - FIXME("SHIsTempDisplayMode() stub\n"); - return FALSE; -} - /* * Unimplemented */ diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 1d87844e1a9..0b2b247f668 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -189,6 +189,8 @@ DWORD WINAPI SHNetConnectionDialog( LPCWSTR lpstrRemoteName, DWORD dwType); +BOOL WINAPI SHIsTempDisplayMode(VOID); + /**************************************************************************** * Cabinet Window Messages */