[Win32SS] Support Module Versioning.

Set the appropriate flags supporting versions of software modules.
Fix arguments for getting desktop DC.
This commit is contained in:
James Tabor 2019-09-24 17:40:18 -05:00
parent 6bf7a8edfb
commit 1f78e8ec47
5 changed files with 64 additions and 14 deletions

View file

@ -148,6 +148,32 @@ RtlFreeLargeString(
}
}
DWORD
FASTCALL
RtlGetExpWinVer( HMODULE hModule )
{
DWORD dwMajorVersion = 3; // Set default to Windows 3.10.
DWORD dwMinorVersion = 10;
PIMAGE_NT_HEADERS pinth;
if ( hModule && !((ULONG_PTR)hModule >> 16))
{
pinth = RtlImageNtHeader( hModule );
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,
@ -177,11 +203,15 @@ User32CreateWindowEx(DWORD dwExStyle,
LPCWSTR lpszClsVersion;
LPCWSTR lpLibFileName = NULL;
HANDLE pCtx = NULL;
DWORD dwFlagsVer;
#if 0
DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent);
#endif
dwFlagsVer = RtlGetExpWinVer( hInstance ? hInstance : GetModuleHandleW(NULL) );
TRACE("Module Version %x\n",dwFlagsVer);
if (!RegisterDefaultClasses)
{
TRACE("RegisterSystemControls\n");
@ -299,8 +329,8 @@ User32CreateWindowEx(DWORD dwExStyle,
hMenu,
hInstance,
lpParam,
dwFlags,
NULL);
dwFlagsVer,
pCtx );
if (Handle) break;
if (!lpLibFileName) break;
if (!ClassFound)