@joebigelow / wix-1 / commits / 096784ea

Require Vista (Server 2008) SP2 or newer.

#6318

Sean Hall committed Feb 7, 2021 at 18:54 UTC 096784ea5114cb5bf99151cc047d69951035d152
13 files changed +21 -71
src/engine/condition.cpp
+2 -6
@@ -187,13 +187,9 @@ extern "C" HRESULT ConditionGlobalCheck(
187 HRESULT hr = S_OK;
188 BOOL fSuccess = TRUE;
189 HRESULT hrError = HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION);
190 - OS_VERSION osv = OS_VERSION_UNKNOWN;
191 - DWORD dwServicePack = 0;
190
193 - OsGetVersion(&osv, &dwServicePack);
194 -
195 - // Always error on Windows 2000 or lower
196 - if (OS_VERSION_WIN2000 >= osv)
191 + // Only run on Windows Vista SP2 or newer, or Windows Server 2008 SP2 or newer.
192 + if (!::IsWindowsVistaSP2OrGreater())
193 {
194 fSuccess = FALSE;
195 }
src/engine/engine.cpp
+3 -7
@@ -95,7 +95,7 @@ extern "C" HRESULT EngineRun(
95 BOOL fWiuInitialized = FALSE;
96 BOOL fXmlInitialized = FALSE;
97 SYSTEM_INFO si = { };
98 - OSVERSIONINFOEXW ovix = { };
98 + RTL_OSVERSIONINFOEXW ovix = { };
99 LPWSTR sczExePath = NULL;
100 BOOL fRunNormal = FALSE;
101 BOOL fRestart = FALSE;
@@ -150,12 +150,8 @@ extern "C" HRESULT EngineRun(
150 ExitOnFailure(hr, "Failed to initialize XML util.");
151 fXmlInitialized = TRUE;
152
153 - ovix.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
154 - #pragma warning(suppress: 4996)
155 - if (!::GetVersionExW((LPOSVERSIONINFOW)&ovix))
156 - {
157 - ExitWithLastError(hr, "Failed to get OS info.");
158 - }
153 + hr = OsRtlGetVersion(&ovix);
154 + ExitOnFailure(hr, "Failed to get OS info.");
155
156 #if defined(_M_ARM64)
157 LPCSTR szBurnPlatform = "ARM64";
src/engine/engine.vcxproj
+2 -2
@@ -1,7 +1,7 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 - <Import Project="..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" />
4 + <Import Project="..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props')" />
5 <ItemGroup Label="ProjectConfigurations">
6 <ProjectConfiguration Include="Debug|Win32">
7 <Configuration>Debug</Configuration>
@@ -167,7 +167,7 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command>
167 <PropertyGroup>
168 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
169 </PropertyGroup>
170 - <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props'))" />
170 + <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props'))" />
171 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" />
172 </Target>
173 </Project>
\ No newline at end of file
src/engine/msuengine.cpp
+1 -5
@@ -90,14 +90,10 @@ extern "C" HRESULT MsuEnginePlanCalculatePackage(
90 BOOTSTRAPPER_ACTION_STATE execute = BOOTSTRAPPER_ACTION_STATE_NONE;
91 BOOTSTRAPPER_ACTION_STATE rollback = BOOTSTRAPPER_ACTION_STATE_NONE;
92 BOOL fBARequestedCache = FALSE;
93 -
93 BOOL fAllowUninstall = FALSE;
95 - OS_VERSION osVersion = OS_VERSION_UNKNOWN;
96 - DWORD dwServicePack = 0;
94
95 // We can only uninstall MSU packages if they have a KB and we are on Win7 or newer.
99 - OsGetVersion(&osVersion, &dwServicePack);
100 - fAllowUninstall = (pPackage->Msu.sczKB && *pPackage->Msu.sczKB) && OS_VERSION_WIN7 <= osVersion;
96 + fAllowUninstall = pPackage->Msu.sczKB && *pPackage->Msu.sczKB && ::IsWindows7OrGreater();
97
98 // execute action
99 switch (pPackage->currentState)
src/engine/packages.config
+1 -1
@@ -1,5 +1,5 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <packages>
3 <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" />
4 - <package id="WixToolset.DUtil" version="4.0.59" targetFramework="native" />
4 + <package id="WixToolset.DUtil" version="4.0.61" targetFramework="native" />
5 </packages>
\ No newline at end of file
src/engine/pipe.cpp
+1 -4
@@ -391,16 +391,13 @@ extern "C" HRESULT PipeLaunchChildProcess(
391 HRESULT hr = S_OK;
392 DWORD dwCurrentProcessId = ::GetCurrentProcessId();
393 LPWSTR sczParameters = NULL;
394 - OS_VERSION osVersion = OS_VERSION_UNKNOWN;
395 - DWORD dwServicePack = 0;
394 LPCWSTR wzVerb = NULL;
395 HANDLE hProcess = NULL;
396
397 hr = StrAllocFormatted(&sczParameters, L"-q -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_ELEVATED, pConnection->sczName, pConnection->sczSecret, dwCurrentProcessId);
398 ExitOnFailure(hr, "Failed to allocate parameters for elevated process.");
399
402 - OsGetVersion(&osVersion, &dwServicePack);
403 - wzVerb = (OS_VERSION_VISTA > osVersion) || !fElevate ? L"open" : L"runas";
400 + wzVerb = !fElevate ? L"open" : L"runas";
401
402 // Since ShellExecuteEx doesn't support passing inherited handles, don't bother with CoreAppendFileHandleSelfToCommandLine.
403 // We could fallback to using ::DuplicateHandle to inject the file handle later if necessary.
src/engine/precomp.h
+1
@@ -18,6 +18,7 @@
18 #include <lmcons.h>
19 #include <wininet.h>
20 #include <stddef.h>
21 +#include <VersionHelpers.h>
22
23 #include <dutilsources.h>
24 #include <burnsources.h>
src/engine/registration.cpp
-11
@@ -1178,20 +1178,9 @@ static HRESULT UpdateResumeMode(
1178 HKEY hkRun = NULL;
1179 LPWSTR sczResumeCommandLine = NULL;
1180 LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY;
1181 - OS_VERSION osv = OS_VERSION_UNKNOWN;
1182 - DWORD dwServicePack = 0;
1181
1182 LogId(REPORT_STANDARD, MSG_SESSION_UPDATE, pRegistration->sczRegistrationKey, LoggingResumeModeToString(resumeMode), LoggingBoolToString(fRestartInitiated), LoggingBoolToString(pRegistration->fDisableResume));
1183
1186 - // On Windows XP and Server 2003, write the resume information to the Run key
1187 - // instead of RunOnce. That avoids the problem that driver installation might
1188 - // trigger RunOnce commands to be executed before the reboot.
1189 - OsGetVersion(&osv, &dwServicePack);
1190 - if (osv < OS_VERSION_VISTA)
1191 - {
1192 - sczResumeKey = REGISTRY_RUN_KEY;
1193 - }
1194 -
1184 // write resume information
1185 if (hkRegistration)
1186 {
src/engine/variable.cpp
+4 -29
@@ -1638,33 +1638,17 @@ LExit:
1638 return hr;
1639 }
1640
1641 -extern "C" typedef NTSTATUS (NTAPI *RTL_GET_VERSION)(_Out_ PRTL_OSVERSIONINFOEXW lpVersionInformation);
1642 -
1641 static HRESULT InitializeVariableVersionNT(
1642 __in DWORD_PTR dwpData,
1643 __inout BURN_VARIANT* pValue
1644 )
1645 {
1646 HRESULT hr = S_OK;
1649 - HMODULE ntdll = NULL;
1650 - RTL_GET_VERSION rtlGetVersion = NULL;
1647 RTL_OSVERSIONINFOEXW ovix = { };
1648 BURN_VARIANT value = { };
1649 VERUTIL_VERSION* pVersion = NULL;
1650
1655 - if (!::GetModuleHandleExW(0, L"ntdll", &ntdll))
1656 - {
1657 - ExitWithLastError(hr, "Failed to locate NTDLL.");
1658 - }
1659 -
1660 - rtlGetVersion = reinterpret_cast<RTL_GET_VERSION>(::GetProcAddress(ntdll, "RtlGetVersion"));
1661 - if (NULL == rtlGetVersion)
1662 - {
1663 - ExitWithLastError(hr, "Failed to locate RtlGetVersion.");
1664 - }
1665 -
1666 - ovix.dwOSVersionInfoSize = sizeof(RTL_OSVERSIONINFOEXW);
1667 - hr = static_cast<HRESULT>(rtlGetVersion(&ovix));
1651 + hr = OsRtlGetVersion(&ovix);
1652 ExitOnFailure(hr, "Failed to get OS info.");
1653
1654 switch ((OS_INFO_VARIABLE)dwpData)
@@ -1712,11 +1696,6 @@ static HRESULT InitializeVariableVersionNT(
1696 ExitOnFailure(hr, "Failed to set variant value.");
1697
1698 LExit:
1715 - if (NULL != ntdll)
1716 - {
1717 - FreeLibrary(ntdll);
1718 - }
1719 -
1699 ReleaseVerutilVersion(pVersion);
1700
1701 return hr;
@@ -1728,15 +1707,11 @@ static HRESULT InitializeVariableOsInfo(
1707 )
1708 {
1709 HRESULT hr = S_OK;
1731 - OSVERSIONINFOEXW ovix = { };
1710 + RTL_OSVERSIONINFOEXW ovix = { };
1711 BURN_VARIANT value = { };
1712
1734 - ovix.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
1735 - #pragma warning(suppress: 4996)
1736 - if (!::GetVersionExW((LPOSVERSIONINFOW)&ovix))
1737 - {
1738 - ExitWithLastError(hr, "Failed to get OS info.");
1739 - }
1713 + hr = OsRtlGetVersion(&ovix);
1714 + ExitOnFailure(hr, "Failed to get OS info.");
1715
1716 switch ((OS_INFO_VARIABLE)dwpData)
1717 {
src/stub/packages.config
+1 -1
@@ -4,5 +4,5 @@
4 <package id="Microsoft.SourceLink.Common" version="1.0.0" targetFramework="native" developmentDependency="true" />
5 <package id="Microsoft.SourceLink.GitHub" version="1.0.0" targetFramework="native" developmentDependency="true" />
6 <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" />
7 - <package id="WixToolset.DUtil" version="4.0.59" targetFramework="native" />
7 + <package id="WixToolset.DUtil" version="4.0.61" targetFramework="native" />
8 </packages>
\ No newline at end of file
src/stub/stub.vcxproj
+2 -2
@@ -5,7 +5,7 @@
5 <Import Project="..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props" Condition="Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" />
6 <Import Project="..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props" Condition="Exists('..\..\packages\Microsoft.SourceLink.Common.1.0.0\build\Microsoft.SourceLink.Common.props')" />
7 <Import Project="..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props" Condition="Exists('..\..\packages\Microsoft.Build.Tasks.Git.1.0.0\build\Microsoft.Build.Tasks.Git.props')" />
8 - <Import Project="..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" />
8 + <Import Project="..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props')" />
9
10 <ItemGroup Label="ProjectConfigurations">
11 <ProjectConfiguration Include="Debug|Win32">
@@ -117,6 +117,6 @@
117 <Error Condition="!Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.props'))" />
118 <Error Condition="!Exists('..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.SourceLink.GitHub.1.0.0\build\Microsoft.SourceLink.GitHub.targets'))" />
119 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" />
120 - <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props'))" />
120 + <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props'))" />
121 </Target>
122 </Project>
\ No newline at end of file
src/test/BurnUnitTest/BurnUnitTest.vcxproj
+2 -2
@@ -4,7 +4,7 @@
4
5 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6 <Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.props" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.props')" />
7 - <Import Project="..\..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" />
7 + <Import Project="..\..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props')" />
8 <ItemGroup Label="ProjectConfigurations">
9 <ProjectConfiguration Include="Debug|ARM64">
10 <Configuration>Debug</Configuration>
@@ -95,6 +95,6 @@
95 </PropertyGroup>
96 <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.props'))" />
97 <Error Condition="!Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.targets'))" />
98 - <Error Condition="!Exists('..\..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props'))" />
98 + <Error Condition="!Exists('..\..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.DUtil.4.0.61\build\WixToolset.DUtil.props'))" />
99 </Target>
100 </Project>
\ No newline at end of file
src/test/BurnUnitTest/packages.config
+1 -1
@@ -10,5 +10,5 @@
10 <package id="xunit.runner.visualstudio" version="2.4.1" />
11 <package id="WixBuildTools.TestSupport" version="4.0.47" />
12 <package id="WixBuildTools.TestSupport.Native" version="4.0.47" />
13 - <package id="WixToolset.DUtil" version="4.0.59" targetFramework="native" />
13 + <package id="WixToolset.DUtil" version="4.0.61" targetFramework="native" />
14 </packages>
\ No newline at end of file