Skip to content

Commit

Permalink
Merge pull request #3 from Gcenx/patch-1
Browse files Browse the repository at this point in the history
Fixup reporting Windows reporting, default to Win10 and add Win11
  • Loading branch information
IsaacMarovitz authored Apr 12, 2024
2 parents 1f91010 + f5cf25b commit 2121e28
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 119 deletions.
10 changes: 5 additions & 5 deletions dlls/kernel32/version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
#define WINE_FILEDESCRIPTION_STR "Wine kernel DLL"
#define WINE_FILENAME_STR "kernel32.dll"

/* these values come from Windows 10 Version 1909 */
#define WINE_FILEVERSION 10,0,18362,1350
#define WINE_FILEVERSION_STR "10.0.18362.1350"
#define WINE_PRODUCTVERSION 10,0,18362,1350
#define WINE_PRODUCTVERSION_STR "10.0.18362.1350"
/* these values come from Windows 10 Version 2009 */
#define WINE_FILEVERSION 10,0,19043,1466
#define WINE_FILEVERSION_STR "10.0.19043.1466"
#define WINE_PRODUCTVERSION 10,0,19043,1466
#define WINE_PRODUCTVERSION_STR "10.0.19043.1466"

#include "wine/wine_common_ver.rc"
2 changes: 1 addition & 1 deletion dlls/kernelbase/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static const struct
},
/* Windows 10 */
{
{ 10, 0, 18362 },
{ 10, 0, 19043 },
{0x8e0f7a12,0xbfb3,0x4fe8,{0xb9,0xa5,0x48,0xfd,0x50,0xa1,0x5a,0x9a}}
}
};
Expand Down
66 changes: 33 additions & 33 deletions dlls/msi/tests/package.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,17 +2137,17 @@ static void test_condition(void)
DeleteFileA(msifile);
}

static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int match_case)
static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int match_case, int todo_value)
{
char buffer[MAX_PATH] = "x";
DWORD sz = sizeof(buffer);
UINT r = MsiGetPropertyA(hpkg, prop, buffer, &sz);
ok(!r, "'%s': got %u\n", prop, r);
ok(sz == lstrlenA(buffer), "'%s': expected %u, got %lu\n", prop, lstrlenA(buffer), sz);
if (match_case)
ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
todo_wine_if (todo_value) ok(!strcmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
else
ok(!_stricmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
todo_wine_if (todo_value) ok(!_stricmp(buffer, expect), "'%s': expected '%s', got '%s'\n", prop, expect, buffer);
}

static void test_props(void)
Expand Down Expand Up @@ -2220,29 +2220,29 @@ static void test_props(void)

r = MsiSetPropertyA( hpkg, "=", "asdf" );
ok(!r, "got %u\n", r);
check_prop(hpkg, "=", "asdf", 1);
check_prop(hpkg, "=", "asdf", 1, 0);

r = MsiSetPropertyA( hpkg, " ", "asdf" );
ok(!r, "got %u\n", r);
check_prop(hpkg, " ", "asdf", 1);
check_prop(hpkg, " ", "asdf", 1, 0);

r = MsiSetPropertyA( hpkg, "'", "asdf" );
ok(!r, "got %u\n", r);
check_prop(hpkg, "'", "asdf", 1);
check_prop(hpkg, "'", "asdf", 1, 0);

/* set empty values */
r = MsiSetPropertyA( hpkg, "boo", NULL );
ok(!r, "got %u\n", r);
check_prop(hpkg, "boo", "", 1);
check_prop(hpkg, "boo", "", 1, 0);

r = MsiSetPropertyA( hpkg, "boo", "" );
ok(!r, "got %u\n", r);
check_prop(hpkg, "boo", "", 1);
check_prop(hpkg, "boo", "", 1, 0);

/* set a non-empty value */
r = MsiSetPropertyA( hpkg, "boo", "xyz" );
ok(!r, "got %u\n", r);
check_prop(hpkg, "boo", "xyz", 1);
check_prop(hpkg, "boo", "xyz", 1, 0);

r = MsiGetPropertyA(hpkg, "boo", NULL, NULL);
ok(!r, "got %u\n", r);
Expand Down Expand Up @@ -2317,10 +2317,10 @@ static void test_props(void)
ok(sz == 3, "got size %lu\n", sz);

/* properties are case-sensitive */
check_prop(hpkg, "BOO", "", 1);
check_prop(hpkg, "BOO", "", 1, 0);

/* properties set in Property table should work */
check_prop(hpkg, "MetadataCompName", "Photoshop.dll", 1);
check_prop(hpkg, "MetadataCompName", "Photoshop.dll", 1, 0);

MsiCloseHandle( hpkg );
DeleteFileA(msifile);
Expand Down Expand Up @@ -5734,70 +5734,70 @@ static void test_installprops(void)
GetNativeSystemInfo(&si);

sprintf(buf, "%d", LOBYTE(LOWORD(GetVersion())) * 100 + HIBYTE(LOWORD(GetVersion())));
check_prop(hpkg, "VersionNT", buf, 1);
check_prop(hpkg, "VersionNT", buf, 1, 1);

if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
{
sprintf(buf, "%d", si.wProcessorLevel);
check_prop(hpkg, "Intel", buf, 1);
check_prop(hpkg, "MsiAMD64", buf, 1);
check_prop(hpkg, "Msix64", buf, 1);
check_prop(hpkg, "Intel", buf, 1, 0);
check_prop(hpkg, "MsiAMD64", buf, 1, 0);
check_prop(hpkg, "Msix64", buf, 1, 0);
sprintf(buf, "%d", LOBYTE(LOWORD(GetVersion())) * 100 + HIBYTE(LOWORD(GetVersion())));
check_prop(hpkg, "VersionNT64", buf, 1);
check_prop(hpkg, "VersionNT64", buf, 1, 1);

GetSystemDirectoryA(path, MAX_PATH);
strcat(path, "\\");
check_prop(hpkg, "System64Folder", path, 0);
check_prop(hpkg, "System64Folder", path, 0, 0);

GetSystemWow64DirectoryA(path, MAX_PATH);
strcat(path, "\\");
check_prop(hpkg, "SystemFolder", path, 0);
check_prop(hpkg, "SystemFolder", path, 0, 0);

size = MAX_PATH;
r = RegQueryValueExA(pathkey, "ProgramFilesDir (x86)", 0, &type, (BYTE *)path, &size);
strcat(path, "\\");
check_prop(hpkg, "ProgramFilesFolder", path, 0);
check_prop(hpkg, "ProgramFilesFolder", path, 0, 0);

size = MAX_PATH;
RegQueryValueExA(pathkey, "ProgramFilesDir", 0, &type, (BYTE *)path, &size);
strcat(path, "\\");
check_prop(hpkg, "ProgramFiles64Folder", path, 0);
check_prop(hpkg, "ProgramFiles64Folder", path, 0, 0);

size = MAX_PATH;
RegQueryValueExA(pathkey, "CommonFilesDir (x86)", 0, &type, (BYTE *)path, &size);
strcat(path, "\\");
check_prop(hpkg, "CommonFilesFolder", path, 0);
check_prop(hpkg, "CommonFilesFolder", path, 0, 0);

size = MAX_PATH;
RegQueryValueExA(pathkey, "CommonFilesDir", 0, &type, (BYTE *)path, &size);
strcat(path, "\\");
check_prop(hpkg, "CommonFiles64Folder", path, 0);
check_prop(hpkg, "CommonFiles64Folder", path, 0, 0);
}
else if (S(U(si)).wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{
sprintf(buf, "%d", si.wProcessorLevel);
check_prop(hpkg, "Intel", buf, 1);
check_prop(hpkg, "Intel", buf, 1, 0);

GetSystemDirectoryA(path, MAX_PATH);
strcat(path, "\\");
check_prop(hpkg, "SystemFolder", path, 0);
check_prop(hpkg, "SystemFolder", path, 0, 0);

size = MAX_PATH;
RegQueryValueExA(pathkey, "ProgramFilesDir", 0, &type, (BYTE *)path, &size);
strcat(path, "\\");
check_prop(hpkg, "ProgramFilesFolder", path, 0);
check_prop(hpkg, "ProgramFilesFolder", path, 0, 0);

size = MAX_PATH;
RegQueryValueExA(pathkey, "CommonFilesDir", 0, &type, (BYTE *)path, &size);
strcat(path, "\\");
check_prop(hpkg, "CommonFilesFolder", path, 0);

check_prop(hpkg, "MsiAMD64", "", 1);
check_prop(hpkg, "Msix64", "", 1);
check_prop(hpkg, "VersionNT64", "", 1);
check_prop(hpkg, "System64Folder", "", 0);
check_prop(hpkg, "ProgramFiles64Dir", "", 0);
check_prop(hpkg, "CommonFiles64Dir", "", 0);
check_prop(hpkg, "CommonFilesFolder", path, 0, 0);

check_prop(hpkg, "MsiAMD64", "", 1, 0);
check_prop(hpkg, "Msix64", "", 1, 0);
check_prop(hpkg, "VersionNT64", "", 1, 0);
check_prop(hpkg, "System64Folder", "", 0, 0);
check_prop(hpkg, "ProgramFiles64Dir", "", 0, 0);
check_prop(hpkg, "CommonFiles64Dir", "", 0, 0);
}

CloseHandle(hkey1);
Expand Down
10 changes: 2 additions & 8 deletions dlls/ntdll/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -3843,13 +3843,7 @@ static NTSTATUS query_string_option( HANDLE hkey, LPCWSTR name, ULONG type,
NTSTATUS WINAPI LdrQueryImageFileExecutionOptions( const UNICODE_STRING *key, LPCWSTR value, ULONG type,
void *data, ULONG in_size, ULONG *out_size )
{
static const WCHAR optionsW[] = {'M','a','c','h','i','n','e','\\',
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s',' ','N','T','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'I','m','a','g','e',' ','F','i','l','e',' ',
'E','x','e','c','u','t','i','o','n',' ','O','p','t','i','o','n','s','\\'};
static const WCHAR optionsW[] = L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options";
WCHAR path[MAX_PATH + ARRAY_SIZE( optionsW )];
OBJECT_ATTRIBUTES attr;
UNICODE_STRING name_str;
Expand Down Expand Up @@ -4291,7 +4285,7 @@ static void load_global_options(void)
attr.Attributes = OBJ_CASE_INSENSITIVE;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &name_str, L"Machine\\System\\CurrentControlSet\\Control\\Session Manager" );
RtlInitUnicodeString( &name_str, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" );

if (!NtOpenKey( &hkey, KEY_QUERY_VALUE, &attr ))
{
Expand Down
12 changes: 7 additions & 5 deletions dlls/ntdll/unix/env.c
Original file line number Diff line number Diff line change
Expand Up @@ -1722,11 +1722,13 @@ static ULONG get_dword_option( HANDLE key, const WCHAR *name, ULONG defval )
*/
static void load_global_options( const UNICODE_STRING *image )
{
static const WCHAR optionsW[] = {'M','a','c','h','i','n','e','\\','S','o','f','t','w','a','r','e','\\',
static const WCHAR optionsW[] = {'\\','R','e','g','i','s','t','r','y','\\',
'M','a','c','h','i','n','e','\\','S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s',' ','N','T','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'I','m','a','g','e',' ','F','i','l','e',' ','E','x','e','c','u','t','i','o','n',' ','O','p','t','i','o','n','s',0};
static const WCHAR sessionW[] = {'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
static const WCHAR sessionW[] = {'\\','R','e','g','i','s','t','r','y','\\',
'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\',
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
'C','o','n','t','r','o','l','\\','S','e','s','s','i','o','n',' ','M','a','n','a','g','e','r',0};
static const WCHAR globalflagW[] = {'G','l','o','b','a','l','F','l','a','g',0};
Expand Down Expand Up @@ -1839,9 +1841,9 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
{
peb->ImageBaseAddress = module;
peb->ProcessParameters = params;
peb->OSMajorVersion = 6;
peb->OSMinorVersion = 1;
peb->OSBuildNumber = 0x1db1;
peb->OSMajorVersion = 10;
peb->OSMinorVersion = 0;
peb->OSBuildNumber = 19043;
peb->OSPlatformId = VER_PLATFORM_WIN32_NT;
peb->ImageSubSystem = main_image_info.SubSystemType;
peb->ImageSubSystemMajorVersion = main_image_info.MajorSubsystemVersion;
Expand Down
3 changes: 2 additions & 1 deletion dlls/ntdll/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,8 @@ static void find_reg_tz_info(RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi, const char*
static const WCHAR mui_stdW[] = { 'M','U','I','_','S','t','d',0 };
static const WCHAR mui_dltW[] = { 'M','U','I','_','D','l','t',0 };
static const WCHAR tziW[] = { 'T','Z','I',0 };
static const WCHAR Time_ZonesW[] = { 'M','a','c','h','i','n','e','\\',
static const WCHAR Time_ZonesW[] = { '\\','R','e','g','i','s','t','r','y','\\',
'M','a','c','h','i','n','e','\\',
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s',' ','N','T','\\',
Expand Down
56 changes: 40 additions & 16 deletions dlls/ntdll/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ typedef enum
WIN8, /* Windows 8 */
WIN81, /* Windows 8.1 */
WIN10, /* Windows 10 */
WIN11, /* Windows 11 */
NB_WINDOWS_VERSIONS
} WINDOWS_VERSION;

Expand Down Expand Up @@ -167,10 +168,14 @@ static const RTL_OSVERSIONINFOEXW VersionData[NB_WINDOWS_VERSIONS] =
},
/* WIN10 */
{
sizeof(RTL_OSVERSIONINFOEXW), 10, 0, 18362, VER_PLATFORM_WIN32_NT,
sizeof(RTL_OSVERSIONINFOEXW), 10, 0, 19043, VER_PLATFORM_WIN32_NT,
L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},
/* WIN11 */
{
sizeof(RTL_OSVERSIONINFOEXW), 10, 0, 22000, VER_PLATFORM_WIN32_NT,
L"", 0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
},

};

static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] =
Expand Down Expand Up @@ -201,6 +206,7 @@ static const struct { WCHAR name[12]; WINDOWS_VERSION ver; } version_names[] =
{ L"win8", WIN8 },
{ L"win81", WIN81 },
{ L"win10", WIN10 },
{ L"win11", WIN11 },
};


Expand Down Expand Up @@ -264,24 +270,42 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, L"Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion" );
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion" );

if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return FALSE;

memset( version, 0, sizeof(*version) );

RtlInitUnicodeString( &valueW, L"CurrentVersion" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ))
RtlInitUnicodeString( &valueW, L"CurrentMajorVersionNumber" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ) &&
info->Type == REG_DWORD)
{
WCHAR *p, *str = (WCHAR *)info->Data;
str[info->DataLength / sizeof(WCHAR)] = 0;
p = wcschr( str, '.' );
if (p)
version->dwMajorVersion = *(DWORD *)info->Data;

RtlInitUnicodeString( &valueW, L"CurrentMinorVersionNumber" );
if (!NtQueryValueKey( hkey, &valueW, KeyValuePartialInformation, tmp, sizeof(tmp)-1, &count ) &&
info->Type == REG_DWORD)
{
*p++ = 0;
version->dwMinorVersion = wcstoul( p, NULL, 10 );
version->dwMinorVersion = *(DWORD *)info->Data;
}
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 */
Expand Down Expand Up @@ -311,7 +335,7 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )

/* get service pack version */

RtlInitUnicodeString( &nameW, L"Machine\\System\\CurrentControlSet\\Control\\Windows" );
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Windows" );
if (!NtOpenKey( &hkey2, KEY_ALL_ACCESS, &attr ))
{
RtlInitUnicodeString( &valueW, L"CSDVersion" );
Expand All @@ -329,7 +353,7 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version )

/* get product type */

RtlInitUnicodeString( &nameW, L"Machine\\System\\CurrentControlSet\\Control\\ProductOptions" );
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\ProductOptions" );
if (!NtOpenKey( &hkey2, KEY_ALL_ACCESS, &attr ))
{
RtlInitUnicodeString( &valueW, L"ProductType" );
Expand Down Expand Up @@ -373,7 +397,7 @@ static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version )
attr.Attributes = 0;
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
RtlInitUnicodeString( &nameW, L"Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion" );

if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr )) return FALSE;

Expand Down Expand Up @@ -476,7 +500,7 @@ void version_init(void)

NtQuerySystemInformation( SystemWineVersionInformation, wine_version, sizeof(wine_version), NULL );

current_version = &VersionData[WIN7];
current_version = &VersionData[WIN10];

/* awful CrossOver hack^H^H^H^Hproprietary enhancement */
{
Expand Down
Loading

0 comments on commit 2121e28

Please sign in to comment.