mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
[NTUSER][USER32] Populate dwExpWinVer (#7095)
This value is needed for SetWindowPlacement and IMM. JIRA issue: CORE-19675 JIRA issue: CORE-19268 - Add RtlGetExpWinVer function into win32ss/user/rtl/image.c. - Add RtlGetExpWinVer prototype into win32ss/include/ntuser.h. - Delete RtlGetExpWinVer definition in win32ss/user/user32/windows/window.c. - Populate THREADINFO.dwExpWinVer and CLIENTINFO.dwExpWinVer by using RtlGetExpWinVer in InitThreadCallback function.
This commit is contained in:
parent
a9bdd62d84
commit
6c74e69d12
6 changed files with 58 additions and 29 deletions
|
@ -164,6 +164,7 @@ list(APPEND SOURCE
|
|||
user/ntuser/winpos.c
|
||||
user/ntuser/winsta.c
|
||||
user/ntuser/object.c
|
||||
user/rtl/image.c
|
||||
user/rtl/text.c
|
||||
gdi/ntgdi/arc.c
|
||||
gdi/ntgdi/bezier.c
|
||||
|
|
|
@ -3628,6 +3628,9 @@ NtUserSetScrollBarInfo(
|
|||
LONG idObject,
|
||||
SETSCROLLBARINFO *info);
|
||||
|
||||
ULONG
|
||||
RtlGetExpWinVer(_In_ PVOID BaseAddress);
|
||||
|
||||
#endif /* __WIN32K_NTUSER_H */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -451,7 +451,6 @@ UserThreadDestroy(PETHREAD Thread)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Win: xxxCreateThreadInfo */
|
||||
NTSTATUS NTAPI
|
||||
InitThreadCallback(PETHREAD Thread)
|
||||
{
|
||||
|
@ -556,6 +555,13 @@ InitThreadCallback(PETHREAD Thread)
|
|||
pci->CodePage = pDefKL->CodePage;
|
||||
}
|
||||
|
||||
/* Populate dwExpWinVer */
|
||||
if (Process->Peb)
|
||||
ptiCurrent->dwExpWinVer = RtlGetExpWinVer(Process->SectionBaseAddress);
|
||||
else
|
||||
ptiCurrent->dwExpWinVer = WINVER_WINNT4;
|
||||
pci->dwExpWinVer = ptiCurrent->dwExpWinVer;
|
||||
|
||||
/* Need to pass the user Startup Information to the current process. */
|
||||
if ( ProcessParams )
|
||||
{
|
||||
|
|
46
win32ss/user/rtl/image.c
Normal file
46
win32ss/user/rtl/image.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* PROJECT: ReactOS user32.dll and win32k.sys
|
||||
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
||||
* PURPOSE: RtlGetExpWinVer function
|
||||
* COPYRIGHT: Copyright 2019 James Tabor <james.tabor@reactos.org>
|
||||
* Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#ifdef _WIN32K_
|
||||
#include <win32k.h>
|
||||
DBG_DEFAULT_CHANNEL(UserMisc);
|
||||
#else
|
||||
#include <user32.h>
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(user32);
|
||||
#endif
|
||||
|
||||
/* Get the expected OS version from the application module */
|
||||
ULONG
|
||||
RtlGetExpWinVer(_In_ PVOID BaseAddress)
|
||||
{
|
||||
ULONG dwMajorVersion = 3, dwMinorVersion = 10; /* Set default to Windows 3.10 (WINVER_WIN31) */
|
||||
PIMAGE_NT_HEADERS pNTHeader;
|
||||
ULONG_PTR AlignedAddress = (ULONG_PTR)BaseAddress;
|
||||
|
||||
TRACE("(%p)\n", BaseAddress);
|
||||
|
||||
/* Remove the magic flag for non-mapped images */
|
||||
if (AlignedAddress & 1)
|
||||
AlignedAddress = (AlignedAddress & ~1);
|
||||
|
||||
if (AlignedAddress && !LOWORD(AlignedAddress))
|
||||
{
|
||||
pNTHeader = RtlImageNtHeader((PVOID)AlignedAddress);
|
||||
if (pNTHeader)
|
||||
{
|
||||
dwMajorVersion = pNTHeader->OptionalHeader.MajorSubsystemVersion;
|
||||
if (dwMajorVersion == 1)
|
||||
dwMajorVersion = 3;
|
||||
else
|
||||
dwMinorVersion = pNTHeader->OptionalHeader.MinorSubsystemVersion;
|
||||
}
|
||||
}
|
||||
|
||||
return MAKEWORD(dwMinorVersion, dwMajorVersion);
|
||||
}
|
|
@ -62,6 +62,7 @@ list(APPEND SOURCE
|
|||
windows/text.c
|
||||
windows/window.c
|
||||
windows/winpos.c
|
||||
${REACTOS_SOURCE_DIR}/win32ss/user/rtl/image.c
|
||||
${REACTOS_SOURCE_DIR}/win32ss/user/rtl/text.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/user32_stubs.c
|
||||
include/user32.h)
|
||||
|
|
|
@ -148,34 +148,6 @@ RtlFreeLargeString(
|
|||
}
|
||||
}
|
||||
|
||||
DWORD
|
||||
FASTCALL
|
||||
RtlGetExpWinVer(HMODULE hModule)
|
||||
{
|
||||
DWORD dwMajorVersion = 3; // Set default to Windows 3.10.
|
||||
DWORD dwMinorVersion = 10;
|
||||
PIMAGE_NT_HEADERS pinth;
|
||||
|
||||
if (hModule && !LOWORD((ULONG_PTR)hModule))
|
||||
{
|
||||
pinth = RtlImageNtHeader(hModule);
|
||||
if (pinth)
|
||||
{
|
||||
dwMajorVersion = pinth->OptionalHeader.MajorSubsystemVersion;
|
||||
|
||||
if (dwMajorVersion == 1)
|
||||
{
|
||||
dwMajorVersion = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwMinorVersion = pinth->OptionalHeader.MinorSubsystemVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
return MAKELONG(MAKEWORD(dwMinorVersion, dwMajorVersion), 0);
|
||||
}
|
||||
|
||||
HWND WINAPI
|
||||
User32CreateWindowEx(DWORD dwExStyle,
|
||||
LPCSTR lpClassName,
|
||||
|
|
Loading…
Reference in a new issue