[USER32] Introduce user32_vista and stubplement GetDpiForWindow() (#6208)

Add user32_vista.dll to introduce new NT6+ User32 features without changing the existing User32.dll when compiled as NT5.x. Also implements a stub for GetDpiForWindow(). The GetDpiForWindow() function will be required to Wine-sync common controls to modern Wine versions.

Changes:
Expose GetDpiForWindow() function and USER_DEFAULT_SCREEN_DPI to appropriate versions in winuser.h
Introduce a basic user32_vista library that can be expanded as needed.
This commit is contained in:
Carl J. Bialorucki 2024-06-04 10:19:32 -06:00 committed by GitHub
parent 063997f2e0
commit ad73e17418
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 89 additions and 1 deletions

View file

@ -4924,6 +4924,15 @@ BOOL WINAPI GetWindowInfo(_In_ HWND, _Inout_ PWINDOWINFO);
BOOL WINAPI GetMonitorInfoA(_In_ HMONITOR, _Inout_ LPMONITORINFO);
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO);
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
#define USER_DEFAULT_SCREEN_DPI 96
#endif /* _WIN32_WINNT >= _WIN32_WINNT_VISTA */
#if (_WIN32_WINNT >= 0x0605) /* Windows 10 pre-Threshold */
UINT WINAPI GetDpiForSystem(VOID);
UINT WINAPI GetDpiForWindow(_In_ HWND hwnd);
#endif /* _WIN32_WINNT >= 0x0605 */
UINT
WINAPI
GetWindowModuleFileNameA(

View file

@ -19,6 +19,7 @@ add_subdirectory(gdi/gdi32_vista)
add_subdirectory(printing)
add_subdirectory(reactx)
add_subdirectory(user/user32)
add_subdirectory(user/user32_vista)
add_subdirectory(user/winsrv)
spec2def(win32k.sys win32k.spec ADD_IMPORTLIB)

View file

@ -80,7 +80,7 @@ add_library(user32 MODULE
${CMAKE_CURRENT_BINARY_DIR}/user32.def)
set_module_type(user32 win32dll UNICODE ENTRYPOINT DllMain 12)
target_link_libraries(user32 user32_wsprintf wine win32ksys ${PSEH_LIB})
target_link_libraries(user32 user32_vista_static user32_wsprintf wine win32ksys ${PSEH_LIB})
add_dependencies(user32 asm)
if(MSVC AND (ARCH STREQUAL "i386"))

View file

@ -282,6 +282,8 @@
279 stdcall GetDlgItemTextA(long long ptr long)
280 stdcall GetDlgItemTextW(long long ptr long)
281 stdcall GetDoubleClickTime() NtUserGetDoubleClickTime
@ stdcall -version=0xA00+ GetDpiForSystem()
@ stdcall -version=0xA00+ GetDpiForWindow(ptr)
282 stdcall GetFocus()
283 stdcall GetForegroundWindow() NtUserGetForegroundWindow
284 stdcall GetGUIThreadInfo(long ptr) NtUserGetGUIThreadInfo

View file

@ -0,0 +1,25 @@
spec2def(user32_vista.dll user32_vista.spec ADD_IMPORTLIB)
include_directories(
include
${REACTOS_SOURCE_DIR}/win32ss/include)
list(APPEND SOURCE
dpi.c)
add_library(user32_vista_static
${SOURCE})
target_link_libraries(user32_vista_static win32ksys)
add_dependencies(user32_vista_static psdk)
add_library(user32_vista MODULE
${SOURCE}
user32_vista.rc
${CMAKE_CURRENT_BINARY_DIR}/user32_vista.def)
set_module_type(user32_vista win32dll UNICODE ENTRYPOINT 0)
add_importlibs(user32_vista user32 gdi32 ntdll)
target_link_libraries(user32_vista user32_vista_static win32ksys)
add_dependencies(user32_vista psdk)
add_cd_file(TARGET user32_vista DESTINATION reactos/system32 FOR all)

View file

@ -0,0 +1,44 @@
/*
* PROJECT: ReactOS Kernel - Vista+ APIs
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
* PURPOSE: DPI functions for user32 and user32_vista.
* COPYRIGHT: Copyright 2024 Carl Bialorucki <cbialo2@outlook.com>
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <windef.h>
#include <wingdi.h>
#include <winuser.h>
#define NDEBUG
#include <debug.h>
/*
* @stub
*/
UINT
WINAPI
GetDpiForSystem(VOID)
{
HDC hDC;
UINT Dpi;
hDC = GetDC(NULL);
Dpi = GetDeviceCaps(hDC, LOGPIXELSY);
ReleaseDC(NULL, hDC);
return Dpi;
}
/*
* @stub
*/
UINT
WINAPI
GetDpiForWindow(
_In_ HWND hWnd)
{
UNIMPLEMENTED_ONCE;
UNREFERENCED_PARAMETER(hWnd);
return GetDpiForSystem();
}

View file

@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "User32 Extensions DLL"
#define REACTOS_STR_INTERNAL_NAME "user32_vista"
#define REACTOS_STR_ORIGINAL_FILENAME "user32_vista.dll"
#include <reactos/version.rc>

View file

@ -0,0 +1,2 @@
@ stdcall GetDpiForSystem()
@ stdcall GetDpiForWindow(ptr)