Commit 0692d07f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

ntdll: Look at CurrentMajor/MinorVersionNumber registry values before CurrentVersion.

parent 65a3e149
...@@ -276,18 +276,36 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version ) ...@@ -276,18 +276,36 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
memset( version, 0, sizeof(*version) ); memset( version, 0, sizeof(*version) );
RtlInitUnicodeString( &valueW, L"CurrentVersion" ); RtlInitUnicodeString( &valueW, L"CurrentMajorVersionNumber" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count )) if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ) &&
info->Type == REG_DWORD)
{ {
WCHAR *p, *str = (WCHAR *)info->Data; version->dwMajorVersion = *(DWORD *)info->Data;
str[info->DataLength / sizeof(WCHAR)] = 0;
p = wcschr( str, '.' ); RtlInitUnicodeString( &valueW, L"CurrentMinorVersionNumber" );
if (p) if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ) &&
info->Type == REG_DWORD)
{ {
*p++ = 0; version->dwMinorVersion = *(DWORD *)info->Data;
version->dwMinorVersion = wcstoul( p, NULL, 10 ); }
else version->dwMajorVersion = 0;
}
if (!version->dwMajorVersion)
{
RtlInitUnicodeString( &valueW, L"CurrentVersion" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
{
WCHAR *p, *str = (WCHAR *)info->Data;
str[info->DataLength / sizeof(WCHAR)] = 0;
p = wcschr( str, '.' );
if (p)
{
*p++ = 0;
version->dwMinorVersion = wcstoul( p, NULL, 10 );
}
version->dwMajorVersion = wcstoul( str, NULL, 10 );
} }
version->dwMajorVersion = wcstoul( str, NULL, 10 );
} }
if (version->dwMajorVersion) /* we got the main version, now fetch the other fields */ if (version->dwMajorVersion) /* we got the main version, now fetch the other fields */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment