https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ff5ccb5948b32b46bb4a1b4e59255b865dfbbae3

commit ff5ccb5948b32b46bb4a1b4e59255b865dfbbae3
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Tue Sep 19 11:02:59 2023 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Tue Sep 19 11:02:59 2023 +0900

    [SHLWAPI][SHLWAPI_APITEST] Fix SHGetPerScreenResName (#5701)
    
    Use HORZRES and VERTRES instead of SM_CXFULLSCREEN and SM_CYFULLSCREEN.
    CORE-9283
---
 dll/win32/shlwapi/propbag.cpp                       |  7 +++++--
 modules/rostests/apitests/shlwapi/CMakeLists.txt    |  2 +-
 modules/rostests/apitests/shlwapi/SHPropertyBag.cpp | 10 +++++++---
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dll/win32/shlwapi/propbag.cpp b/dll/win32/shlwapi/propbag.cpp
index c355647166e..98d2bc45926 100644
--- a/dll/win32/shlwapi/propbag.cpp
+++ b/dll/win32/shlwapi/propbag.cpp
@@ -1947,9 +1947,12 @@ SHGetPerScreenResName(
     if (dwReserved)
         return 0;
 
-    INT cxWidth = ::GetSystemMetrics(SM_CXFULLSCREEN);
-    INT cyHeight = ::GetSystemMetrics(SM_CYFULLSCREEN);
+    HDC hDC = ::GetDC(NULL);
+    INT cxWidth = ::GetDeviceCaps(hDC, HORZRES);
+    INT cyHeight = ::GetDeviceCaps(hDC, VERTRES);
     INT cMonitors = ::GetSystemMetrics(SM_CMONITORS);
+    ::ReleaseDC(NULL, hDC);
+
     StringCchPrintfW(pszBuffer, cchBuffer, L"%dx%d(%d)", cxWidth, cyHeight, 
cMonitors);
     return lstrlenW(pszBuffer);
 }
diff --git a/modules/rostests/apitests/shlwapi/CMakeLists.txt 
b/modules/rostests/apitests/shlwapi/CMakeLists.txt
index d5c4d32562e..8eeb818902c 100644
--- a/modules/rostests/apitests/shlwapi/CMakeLists.txt
+++ b/modules/rostests/apitests/shlwapi/CMakeLists.txt
@@ -25,6 +25,6 @@ add_rc_deps(testdata.rc 
${CMAKE_CURRENT_BINARY_DIR}/shlwapi_resource_dll/shlwapi
 add_executable(shlwapi_apitest ${SOURCE})
 set_module_type(shlwapi_apitest win32cui)
 target_link_libraries(shlwapi_apitest ${PSEH_LIB} uuid)
-add_importlibs(shlwapi_apitest shlwapi oleaut32 ole32 user32 advapi32 msvcrt 
kernel32)
+add_importlibs(shlwapi_apitest shlwapi oleaut32 ole32 user32 gdi32 advapi32 
msvcrt kernel32)
 add_dependencies(shlwapi_apitest shlwapi_resource_dll)
 add_rostests_file(TARGET shlwapi_apitest)
diff --git a/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp 
b/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp
index eae457b698e..c155693e214 100644
--- a/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp
+++ b/modules/rostests/apitests/shlwapi/SHPropertyBag.cpp
@@ -826,10 +826,14 @@ static void SHPropertyBag_OnIniFile(void)
 
 static void SHPropertyBag_PerScreenRes(void)
 {
+    HDC hDC = GetDC(NULL);
+    INT cxWidth = GetDeviceCaps(hDC, HORZRES);
+    INT cyHeight = GetDeviceCaps(hDC, VERTRES);
+    INT cMonitors = GetSystemMetrics(SM_CMONITORS);
+    ReleaseDC(NULL, hDC);
+
     WCHAR szBuff1[64], szBuff2[64];
-    StringCchPrintfW(szBuff1, _countof(szBuff1), L"%dx%d(%d)",
-                     GetSystemMetrics(SM_CXFULLSCREEN), 
GetSystemMetrics(SM_CYFULLSCREEN),
-                     GetSystemMetrics(SM_CMONITORS));
+    StringCchPrintfW(szBuff1, _countof(szBuff1), L"%dx%d(%d)", cxWidth, 
cyHeight, cMonitors);
 
     szBuff2[0] = UNICODE_NULL;
     SHGetPerScreenResName(szBuff2, _countof(szBuff2), 0);

Reply via email to