http://bugs.winehq.org/show_bug.cgi?id=33391
Bug #: 33391 Summary: Microsoft .NET Framework Version 2.0 x64 installer prerequisite check fails (incorrect "VersionNT64" msi property value) Product: Wine Version: 1.5.28 Platform: x86-64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: msi AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net Classification: Unclassified
Hello folks,
while investigating some 64-bit application installer I found a problem with "VersionNT64" msi installer property.
--- snip --- 0027:trace:msi:MSI_EvaluateConditionW L"( ((VersionNT64 < 502) OR (VersionNT64 = 502 AND WindowsBuild < 3506)) )" ... 0027:trace:msi:MSI_EvaluateConditionW 1 <- L"( ((VersionNT64 < 502) OR (VersionNT64 = 502 AND WindowsBuild < 3506)) )" 0027:trace:msi:ACTION_PerformAction Performing action (L"CA_Check64OS.3643236F_FC70_11D3_A536_0090278A1BB8") ... --- snip ---
It's ok to fail in Windows XP mode (VersionNT64 should be 501) but to my surprise it also failed in later WinVer settings (Windows 2003, ...).
The reason is a "reuse" of string buffer which ought to hold WinVer encoded as MajorVersion * 100 + MinorVersion.
Source: http://source.winehq.org/git/wine.git/blob/40f3a9fa590b1e4ab785509bb389efbe4...
--- snip --- 671 static VOID set_installer_properties(MSIPACKAGE *package) 672 { 673 WCHAR *ptr; 674 OSVERSIONINFOEXW OSVersion; 675 MEMORYSTATUSEX msex; 676 DWORD verval, len; 677 WCHAR pth[MAX_PATH], verstr[11], bufstr[22]; ... 860 /* set the os things */ 861 OSVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); 862 GetVersionExW((OSVERSIONINFOW *)&OSVersion); 863 verval = OSVersion.dwMinorVersion + OSVersion.dwMajorVersion * 100; 864 len = sprintfW( verstr, szFormat, verval ); 865 switch (OSVersion.dwPlatformId) 866 { 867 case VER_PLATFORM_WIN32_WINDOWS: 868 msi_set_property( package->db, szVersion9x, verstr, len ); 869 break; 870 case VER_PLATFORM_WIN32_NT: 871 msi_set_property( package->db, szVersionNT, verstr, len ); 872 len = sprintfW( verstr, szFormat,OSVersion.wProductType ); 873 msi_set_property( package->db, szMsiNTProductType, verstr, len ); 874 break; 875 } 876 len = sprintfW( verstr, szFormat, OSVersion.dwBuildNumber ); 877 msi_set_property( package->db, szWindowsBuild, verstr, len ); 878 len = sprintfW( verstr, szFormat, OSVersion.wServicePackMajor ); 879 msi_set_property( package->db, szServicePackLevel, verstr, len ); 880 881 len = sprintfW( bufstr, szFormat2, MSI_MAJORVERSION, MSI_MINORVERSION ); 882 msi_set_property( package->db, szVersionMsi, bufstr, len ); 883 len = sprintfW( bufstr, szFormat, MSI_MAJORVERSION * 100 ); 884 msi_set_property( package->db, szVersionDatabase, bufstr, len ); 885 886 GetNativeSystemInfo( &sys_info ); 887 len = sprintfW( bufstr, szIntFormat, sys_info.wProcessorLevel ); 888 msi_set_property( package->db, szIntel, bufstr, len ); 889 if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) 890 { ... 902 } 903 else if (sys_info.u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) 904 { 905 msi_set_property( package->db, szMsiAMD64, bufstr, -1 ); 906 msi_set_property( package->db, szMsix64, bufstr, -1 ); 907 msi_set_property( package->db, szVersionNT64, verstr, -1 ); ... --- snip ---
"verstr" is overwritten several times. At the point of setting "szVersionNT64" msi property, "verstr" simply contains the last string buffer "reuse" value which is obviously not what we want here ...
Regards