diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/osutil.cpp')
-rw-r--r-- | src/libs/dutil/WixToolset.DUtil/osutil.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/osutil.cpp b/src/libs/dutil/WixToolset.DUtil/osutil.cpp index 880ec3ea..4798dc58 100644 --- a/src/libs/dutil/WixToolset.DUtil/osutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/osutil.cpp | |||
@@ -16,6 +16,7 @@ | |||
16 | #define OsExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_OSUTIL, p, x, s, __VA_ARGS__) | 16 | #define OsExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_OSUTIL, p, x, s, __VA_ARGS__) |
17 | #define OsExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_OSUTIL, e, x, s, __VA_ARGS__) | 17 | #define OsExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_OSUTIL, e, x, s, __VA_ARGS__) |
18 | #define OsExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_OSUTIL, g, x, s, __VA_ARGS__) | 18 | #define OsExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_OSUTIL, g, x, s, __VA_ARGS__) |
19 | #define OsExitOnPathFailure(x, b, s, ...) ExitOnPathFailureSource(DUTIL_SOURCE_OSUTIL, x, b, s, __VA_ARGS__) | ||
19 | 20 | ||
20 | typedef NTSTATUS(NTAPI* PFN_RTL_GET_VERSION)(_Out_ PRTL_OSVERSIONINFOEXW lpVersionInformation); | 21 | typedef NTSTATUS(NTAPI* PFN_RTL_GET_VERSION)(_Out_ PRTL_OSVERSIONINFOEXW lpVersionInformation); |
21 | 22 | ||
@@ -186,23 +187,26 @@ extern "C" HRESULT DAPI OsIsUacEnabled( | |||
186 | { | 187 | { |
187 | HRESULT hr = S_OK; | 188 | HRESULT hr = S_OK; |
188 | HKEY hk = NULL; | 189 | HKEY hk = NULL; |
190 | BOOL fExists = FALSE; | ||
189 | DWORD dwUacEnabled = 0; | 191 | DWORD dwUacEnabled = 0; |
190 | 192 | ||
191 | *pfUacEnabled = FALSE; // assume UAC not enabled. | 193 | *pfUacEnabled = FALSE; // assume UAC not enabled. |
192 | 194 | ||
193 | hr = RegOpen(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", KEY_READ, &hk); | 195 | hr = RegOpen(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", KEY_READ, &hk); |
194 | if (E_FILENOTFOUND == hr) | 196 | OsExitOnPathFailure(hr, fExists, "Failed to open system policy key to detect UAC."); |
197 | |||
198 | if (!fExists) | ||
195 | { | 199 | { |
196 | ExitFunction1(hr = S_OK); | 200 | ExitFunction(); |
197 | } | 201 | } |
198 | OsExitOnFailure(hr, "Failed to open system policy key to detect UAC."); | ||
199 | 202 | ||
200 | hr = RegReadNumber(hk, L"EnableLUA", &dwUacEnabled); | 203 | hr = RegReadNumber(hk, L"EnableLUA", &dwUacEnabled); |
201 | if (E_FILENOTFOUND == hr) | 204 | OsExitOnPathFailure(hr, fExists, "Failed to read registry value to detect UAC."); |
205 | |||
206 | if (!fExists) | ||
202 | { | 207 | { |
203 | ExitFunction1(hr = S_OK); | 208 | ExitFunction(); |
204 | } | 209 | } |
205 | OsExitOnFailure(hr, "Failed to read registry value to detect UAC."); | ||
206 | 210 | ||
207 | *pfUacEnabled = (0 != dwUacEnabled); | 211 | *pfUacEnabled = (0 != dwUacEnabled); |
208 | 212 | ||