diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-07 18:54:54 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-02-07 18:59:06 -0600 |
| commit | 096784ea5114cb5bf99151cc047d69951035d152 (patch) | |
| tree | 28adaf67c91518395ea72bfe89f835ef89f121b1 /src/engine | |
| parent | 63cf6f589a35466aa73ff3ec021b5052be733409 (diff) | |
| download | wix-096784ea5114cb5bf99151cc047d69951035d152.tar.gz wix-096784ea5114cb5bf99151cc047d69951035d152.tar.bz2 wix-096784ea5114cb5bf99151cc047d69951035d152.zip | |
Require Vista (Server 2008) SP2 or newer.
#6318
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/condition.cpp | 8 | ||||
| -rw-r--r-- | src/engine/engine.cpp | 10 | ||||
| -rw-r--r-- | src/engine/engine.vcxproj | 4 | ||||
| -rw-r--r-- | src/engine/msuengine.cpp | 6 | ||||
| -rw-r--r-- | src/engine/packages.config | 2 | ||||
| -rw-r--r-- | src/engine/pipe.cpp | 5 | ||||
| -rw-r--r-- | src/engine/precomp.h | 1 | ||||
| -rw-r--r-- | src/engine/registration.cpp | 11 | ||||
| -rw-r--r-- | src/engine/variable.cpp | 33 |
9 files changed, 15 insertions, 65 deletions
diff --git a/src/engine/condition.cpp b/src/engine/condition.cpp index 06591567..316224db 100644 --- a/src/engine/condition.cpp +++ b/src/engine/condition.cpp | |||
| @@ -187,13 +187,9 @@ extern "C" HRESULT ConditionGlobalCheck( | |||
| 187 | HRESULT hr = S_OK; | 187 | HRESULT hr = S_OK; |
| 188 | BOOL fSuccess = TRUE; | 188 | BOOL fSuccess = TRUE; |
| 189 | HRESULT hrError = HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION); | 189 | HRESULT hrError = HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION); |
| 190 | OS_VERSION osv = OS_VERSION_UNKNOWN; | ||
| 191 | DWORD dwServicePack = 0; | ||
| 192 | 190 | ||
| 193 | OsGetVersion(&osv, &dwServicePack); | 191 | // Only run on Windows Vista SP2 or newer, or Windows Server 2008 SP2 or newer. |
| 194 | 192 | if (!::IsWindowsVistaSP2OrGreater()) | |
| 195 | // Always error on Windows 2000 or lower | ||
| 196 | if (OS_VERSION_WIN2000 >= osv) | ||
| 197 | { | 193 | { |
| 198 | fSuccess = FALSE; | 194 | fSuccess = FALSE; |
| 199 | } | 195 | } |
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 7e6e2922..458386d4 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp | |||
| @@ -95,7 +95,7 @@ extern "C" HRESULT EngineRun( | |||
| 95 | BOOL fWiuInitialized = FALSE; | 95 | BOOL fWiuInitialized = FALSE; |
| 96 | BOOL fXmlInitialized = FALSE; | 96 | BOOL fXmlInitialized = FALSE; |
| 97 | SYSTEM_INFO si = { }; | 97 | SYSTEM_INFO si = { }; |
| 98 | OSVERSIONINFOEXW ovix = { }; | 98 | RTL_OSVERSIONINFOEXW ovix = { }; |
| 99 | LPWSTR sczExePath = NULL; | 99 | LPWSTR sczExePath = NULL; |
| 100 | BOOL fRunNormal = FALSE; | 100 | BOOL fRunNormal = FALSE; |
| 101 | BOOL fRestart = FALSE; | 101 | BOOL fRestart = FALSE; |
| @@ -150,12 +150,8 @@ extern "C" HRESULT EngineRun( | |||
| 150 | ExitOnFailure(hr, "Failed to initialize XML util."); | 150 | ExitOnFailure(hr, "Failed to initialize XML util."); |
| 151 | fXmlInitialized = TRUE; | 151 | fXmlInitialized = TRUE; |
| 152 | 152 | ||
| 153 | ovix.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); | 153 | hr = OsRtlGetVersion(&ovix); |
| 154 | #pragma warning(suppress: 4996) | 154 | ExitOnFailure(hr, "Failed to get OS info."); |
| 155 | if (!::GetVersionExW((LPOSVERSIONINFOW)&ovix)) | ||
| 156 | { | ||
| 157 | ExitWithLastError(hr, "Failed to get OS info."); | ||
| 158 | } | ||
| 159 | 155 | ||
| 160 | #if defined(_M_ARM64) | 156 | #if defined(_M_ARM64) |
| 161 | LPCSTR szBurnPlatform = "ARM64"; | 157 | LPCSTR szBurnPlatform = "ARM64"; |
diff --git a/src/engine/engine.vcxproj b/src/engine/engine.vcxproj index cb179a23..bc724a40 100644 --- a/src/engine/engine.vcxproj +++ b/src/engine/engine.vcxproj | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 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. --> | 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"> | 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"> | 5 | <ItemGroup Label="ProjectConfigurations"> |
| 6 | <ProjectConfiguration Include="Debug|Win32"> | 6 | <ProjectConfiguration Include="Debug|Win32"> |
| 7 | <Configuration>Debug</Configuration> | 7 | <Configuration>Debug</Configuration> |
| @@ -167,7 +167,7 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> | |||
| 167 | <PropertyGroup> | 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> | 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> | 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'))" /> | 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> | 172 | </Target> |
| 173 | </Project> \ No newline at end of file | 173 | </Project> \ No newline at end of file |
diff --git a/src/engine/msuengine.cpp b/src/engine/msuengine.cpp index b7a503ad..499e1da6 100644 --- a/src/engine/msuengine.cpp +++ b/src/engine/msuengine.cpp | |||
| @@ -90,14 +90,10 @@ extern "C" HRESULT MsuEnginePlanCalculatePackage( | |||
| 90 | BOOTSTRAPPER_ACTION_STATE execute = BOOTSTRAPPER_ACTION_STATE_NONE; | 90 | BOOTSTRAPPER_ACTION_STATE execute = BOOTSTRAPPER_ACTION_STATE_NONE; |
| 91 | BOOTSTRAPPER_ACTION_STATE rollback = BOOTSTRAPPER_ACTION_STATE_NONE; | 91 | BOOTSTRAPPER_ACTION_STATE rollback = BOOTSTRAPPER_ACTION_STATE_NONE; |
| 92 | BOOL fBARequestedCache = FALSE; | 92 | BOOL fBARequestedCache = FALSE; |
| 93 | |||
| 94 | BOOL fAllowUninstall = FALSE; | 93 | BOOL fAllowUninstall = FALSE; |
| 95 | OS_VERSION osVersion = OS_VERSION_UNKNOWN; | ||
| 96 | DWORD dwServicePack = 0; | ||
| 97 | 94 | ||
| 98 | // We can only uninstall MSU packages if they have a KB and we are on Win7 or newer. | 95 | // We can only uninstall MSU packages if they have a KB and we are on Win7 or newer. |
| 99 | OsGetVersion(&osVersion, &dwServicePack); | 96 | fAllowUninstall = pPackage->Msu.sczKB && *pPackage->Msu.sczKB && ::IsWindows7OrGreater(); |
| 100 | fAllowUninstall = (pPackage->Msu.sczKB && *pPackage->Msu.sczKB) && OS_VERSION_WIN7 <= osVersion; | ||
| 101 | 97 | ||
| 102 | // execute action | 98 | // execute action |
| 103 | switch (pPackage->currentState) | 99 | switch (pPackage->currentState) |
diff --git a/src/engine/packages.config b/src/engine/packages.config index f074ae43..102b8bee 100644 --- a/src/engine/packages.config +++ b/src/engine/packages.config | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <packages> | 2 | <packages> |
| 3 | <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" /> | 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 | 5 | </packages> \ No newline at end of file |
diff --git a/src/engine/pipe.cpp b/src/engine/pipe.cpp index eb3eb863..67eeae87 100644 --- a/src/engine/pipe.cpp +++ b/src/engine/pipe.cpp | |||
| @@ -391,16 +391,13 @@ extern "C" HRESULT PipeLaunchChildProcess( | |||
| 391 | HRESULT hr = S_OK; | 391 | HRESULT hr = S_OK; |
| 392 | DWORD dwCurrentProcessId = ::GetCurrentProcessId(); | 392 | DWORD dwCurrentProcessId = ::GetCurrentProcessId(); |
| 393 | LPWSTR sczParameters = NULL; | 393 | LPWSTR sczParameters = NULL; |
| 394 | OS_VERSION osVersion = OS_VERSION_UNKNOWN; | ||
| 395 | DWORD dwServicePack = 0; | ||
| 396 | LPCWSTR wzVerb = NULL; | 394 | LPCWSTR wzVerb = NULL; |
| 397 | HANDLE hProcess = NULL; | 395 | HANDLE hProcess = NULL; |
| 398 | 396 | ||
| 399 | hr = StrAllocFormatted(&sczParameters, L"-q -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_ELEVATED, pConnection->sczName, pConnection->sczSecret, dwCurrentProcessId); | 397 | hr = StrAllocFormatted(&sczParameters, L"-q -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_ELEVATED, pConnection->sczName, pConnection->sczSecret, dwCurrentProcessId); |
| 400 | ExitOnFailure(hr, "Failed to allocate parameters for elevated process."); | 398 | ExitOnFailure(hr, "Failed to allocate parameters for elevated process."); |
| 401 | 399 | ||
| 402 | OsGetVersion(&osVersion, &dwServicePack); | 400 | wzVerb = !fElevate ? L"open" : L"runas"; |
| 403 | wzVerb = (OS_VERSION_VISTA > osVersion) || !fElevate ? L"open" : L"runas"; | ||
| 404 | 401 | ||
| 405 | // Since ShellExecuteEx doesn't support passing inherited handles, don't bother with CoreAppendFileHandleSelfToCommandLine. | 402 | // Since ShellExecuteEx doesn't support passing inherited handles, don't bother with CoreAppendFileHandleSelfToCommandLine. |
| 406 | // We could fallback to using ::DuplicateHandle to inject the file handle later if necessary. | 403 | // We could fallback to using ::DuplicateHandle to inject the file handle later if necessary. |
diff --git a/src/engine/precomp.h b/src/engine/precomp.h index 53fa949a..1b3e9bdc 100644 --- a/src/engine/precomp.h +++ b/src/engine/precomp.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <lmcons.h> | 18 | #include <lmcons.h> |
| 19 | #include <wininet.h> | 19 | #include <wininet.h> |
| 20 | #include <stddef.h> | 20 | #include <stddef.h> |
| 21 | #include <VersionHelpers.h> | ||
| 21 | 22 | ||
| 22 | #include <dutilsources.h> | 23 | #include <dutilsources.h> |
| 23 | #include <burnsources.h> | 24 | #include <burnsources.h> |
diff --git a/src/engine/registration.cpp b/src/engine/registration.cpp index d3732e74..a2ed2a0d 100644 --- a/src/engine/registration.cpp +++ b/src/engine/registration.cpp | |||
| @@ -1178,20 +1178,9 @@ static HRESULT UpdateResumeMode( | |||
| 1178 | HKEY hkRun = NULL; | 1178 | HKEY hkRun = NULL; |
| 1179 | LPWSTR sczResumeCommandLine = NULL; | 1179 | LPWSTR sczResumeCommandLine = NULL; |
| 1180 | LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY; | 1180 | LPCWSTR sczResumeKey = REGISTRY_RUN_ONCE_KEY; |
| 1181 | OS_VERSION osv = OS_VERSION_UNKNOWN; | ||
| 1182 | DWORD dwServicePack = 0; | ||
| 1183 | 1181 | ||
| 1184 | LogId(REPORT_STANDARD, MSG_SESSION_UPDATE, pRegistration->sczRegistrationKey, LoggingResumeModeToString(resumeMode), LoggingBoolToString(fRestartInitiated), LoggingBoolToString(pRegistration->fDisableResume)); | 1182 | LogId(REPORT_STANDARD, MSG_SESSION_UPDATE, pRegistration->sczRegistrationKey, LoggingResumeModeToString(resumeMode), LoggingBoolToString(fRestartInitiated), LoggingBoolToString(pRegistration->fDisableResume)); |
| 1185 | 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 | |||
| 1195 | // write resume information | 1184 | // write resume information |
| 1196 | if (hkRegistration) | 1185 | if (hkRegistration) |
| 1197 | { | 1186 | { |
diff --git a/src/engine/variable.cpp b/src/engine/variable.cpp index 51dbdff4..fed23151 100644 --- a/src/engine/variable.cpp +++ b/src/engine/variable.cpp | |||
| @@ -1638,33 +1638,17 @@ LExit: | |||
| 1638 | return hr; | 1638 | return hr; |
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | extern "C" typedef NTSTATUS (NTAPI *RTL_GET_VERSION)(_Out_ PRTL_OSVERSIONINFOEXW lpVersionInformation); | ||
| 1642 | |||
| 1643 | static HRESULT InitializeVariableVersionNT( | 1641 | static HRESULT InitializeVariableVersionNT( |
| 1644 | __in DWORD_PTR dwpData, | 1642 | __in DWORD_PTR dwpData, |
| 1645 | __inout BURN_VARIANT* pValue | 1643 | __inout BURN_VARIANT* pValue |
| 1646 | ) | 1644 | ) |
| 1647 | { | 1645 | { |
| 1648 | HRESULT hr = S_OK; | 1646 | HRESULT hr = S_OK; |
| 1649 | HMODULE ntdll = NULL; | ||
| 1650 | RTL_GET_VERSION rtlGetVersion = NULL; | ||
| 1651 | RTL_OSVERSIONINFOEXW ovix = { }; | 1647 | RTL_OSVERSIONINFOEXW ovix = { }; |
| 1652 | BURN_VARIANT value = { }; | 1648 | BURN_VARIANT value = { }; |
| 1653 | VERUTIL_VERSION* pVersion = NULL; | 1649 | VERUTIL_VERSION* pVersion = NULL; |
| 1654 | 1650 | ||
| 1655 | if (!::GetModuleHandleExW(0, L"ntdll", &ntdll)) | 1651 | hr = OsRtlGetVersion(&ovix); |
| 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)); | ||
| 1668 | ExitOnFailure(hr, "Failed to get OS info."); | 1652 | ExitOnFailure(hr, "Failed to get OS info."); |
| 1669 | 1653 | ||
| 1670 | switch ((OS_INFO_VARIABLE)dwpData) | 1654 | switch ((OS_INFO_VARIABLE)dwpData) |
| @@ -1712,11 +1696,6 @@ static HRESULT InitializeVariableVersionNT( | |||
| 1712 | ExitOnFailure(hr, "Failed to set variant value."); | 1696 | ExitOnFailure(hr, "Failed to set variant value."); |
| 1713 | 1697 | ||
| 1714 | LExit: | 1698 | LExit: |
| 1715 | if (NULL != ntdll) | ||
| 1716 | { | ||
| 1717 | FreeLibrary(ntdll); | ||
| 1718 | } | ||
| 1719 | |||
| 1720 | ReleaseVerutilVersion(pVersion); | 1699 | ReleaseVerutilVersion(pVersion); |
| 1721 | 1700 | ||
| 1722 | return hr; | 1701 | return hr; |
| @@ -1728,15 +1707,11 @@ static HRESULT InitializeVariableOsInfo( | |||
| 1728 | ) | 1707 | ) |
| 1729 | { | 1708 | { |
| 1730 | HRESULT hr = S_OK; | 1709 | HRESULT hr = S_OK; |
| 1731 | OSVERSIONINFOEXW ovix = { }; | 1710 | RTL_OSVERSIONINFOEXW ovix = { }; |
| 1732 | BURN_VARIANT value = { }; | 1711 | BURN_VARIANT value = { }; |
| 1733 | 1712 | ||
| 1734 | ovix.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); | 1713 | hr = OsRtlGetVersion(&ovix); |
| 1735 | #pragma warning(suppress: 4996) | 1714 | ExitOnFailure(hr, "Failed to get OS info."); |
| 1736 | if (!::GetVersionExW((LPOSVERSIONINFOW)&ovix)) | ||
| 1737 | { | ||
| 1738 | ExitWithLastError(hr, "Failed to get OS info."); | ||
| 1739 | } | ||
| 1740 | 1715 | ||
| 1741 | switch ((OS_INFO_VARIABLE)dwpData) | 1716 | switch ((OS_INFO_VARIABLE)dwpData) |
| 1742 | { | 1717 | { |
