From 54d69aeec139b523f24c3c25dccfb0591925b37d Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 22 May 2017 09:14:09 +0200 Subject: [PATCH] daea1bba62ba514ed13d716ca5b5b1c89763c8f9 reverted --- MsiUseFeature/Main.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/MsiUseFeature/Main.cpp b/MsiUseFeature/Main.cpp index 59290e9..77bc98a 100644 --- a/MsiUseFeature/Main.cpp +++ b/MsiUseFeature/Main.cpp @@ -47,32 +47,7 @@ static int MsiUseFeature() } // Perform the Microsoft Installer's feature completeness check. - switch (MsiUseFeatureW(_L(PRODUCT_VERSION_GUID), pwcArglist[1])) { - case INSTALLSTATE_LOCAL: - // All components of the feature were checked and present. - break; - - case INSTALLSTATE_BROKEN: { - // Some of the components are reported missing. - // - // Unfortunately, the feature state is falsely reported as broken, when MsiUseFeature() lacks privilege - // to check the presence of at least one component installed in an inaccessible folder or registry key. - // If our process is not elevated and feature does contain such components, this is the expected result. - // However, even when we are "Run as Administrator", this does not guarantee we can access all the - // components. Some might be restricted from Administrators group aswell. - win_handle token; - TOKEN_ELEVATION Elevation; DWORD dwSize; - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token) && - GetTokenInformation(token, TokenElevation, &Elevation, sizeof(Elevation), &dwSize) && - !Elevation.TokenIsElevated) - { - // We are not elevated. - OutputDebugStr(_T("The feature is reported broken and the elevation is required for a more reliable test. Silently assuming the feature is complete.\n")); - break; - } - } - - default: + if (MsiUseFeatureW(_L(PRODUCT_VERSION_GUID), pwcArglist[1]) != INSTALLSTATE_LOCAL) { OutputDebugStr(_T("The feature is not installed locally.\n")); return 2; }