diff options
Diffstat (limited to '')
-rw-r--r-- | src/dutil/wuautil.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/dutil/wuautil.cpp b/src/dutil/wuautil.cpp index 94ab659d..dfb28818 100644 --- a/src/dutil/wuautil.cpp +++ b/src/dutil/wuautil.cpp | |||
@@ -3,6 +3,21 @@ | |||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | 5 | ||
6 | // Exit macros | ||
7 | #define WuaExitOnLastError(x, s, ...) ExitOnLastErrorSource(DUTIL_SOURCE_WUAUTIL, x, s, __VA_ARGS__) | ||
8 | #define WuaExitOnLastErrorDebugTrace(x, s, ...) ExitOnLastErrorDebugTraceSource(DUTIL_SOURCE_WUAUTIL, x, s, __VA_ARGS__) | ||
9 | #define WuaExitWithLastError(x, s, ...) ExitWithLastErrorSource(DUTIL_SOURCE_WUAUTIL, x, s, __VA_ARGS__) | ||
10 | #define WuaExitOnFailure(x, s, ...) ExitOnFailureSource(DUTIL_SOURCE_WUAUTIL, x, s, __VA_ARGS__) | ||
11 | #define WuaExitOnRootFailure(x, s, ...) ExitOnRootFailureSource(DUTIL_SOURCE_WUAUTIL, x, s, __VA_ARGS__) | ||
12 | #define WuaExitOnFailureDebugTrace(x, s, ...) ExitOnFailureDebugTraceSource(DUTIL_SOURCE_WUAUTIL, x, s, __VA_ARGS__) | ||
13 | #define WuaExitOnNull(p, x, e, s, ...) ExitOnNullSource(DUTIL_SOURCE_WUAUTIL, p, x, e, s, __VA_ARGS__) | ||
14 | #define WuaExitOnNullWithLastError(p, x, s, ...) ExitOnNullWithLastErrorSource(DUTIL_SOURCE_WUAUTIL, p, x, s, __VA_ARGS__) | ||
15 | #define WuaExitOnNullDebugTrace(p, x, e, s, ...) ExitOnNullDebugTraceSource(DUTIL_SOURCE_WUAUTIL, p, x, e, s, __VA_ARGS__) | ||
16 | #define WuaExitOnInvalidHandleWithLastError(p, x, s, ...) ExitOnInvalidHandleWithLastErrorSource(DUTIL_SOURCE_WUAUTIL, p, x, s, __VA_ARGS__) | ||
17 | #define WuaExitOnWin32Error(e, x, s, ...) ExitOnWin32ErrorSource(DUTIL_SOURCE_WUAUTIL, e, x, s, __VA_ARGS__) | ||
18 | #define WuaExitOnGdipFailure(g, x, s, ...) ExitOnGdipFailureSource(DUTIL_SOURCE_WUAUTIL, g, x, s, __VA_ARGS__) | ||
19 | |||
20 | |||
6 | // internal function declarations | 21 | // internal function declarations |
7 | 22 | ||
8 | static HRESULT GetAutomaticUpdatesService( | 23 | static HRESULT GetAutomaticUpdatesService( |
@@ -18,10 +33,10 @@ extern "C" HRESULT DAPI WuaPauseAutomaticUpdates() | |||
18 | IAutomaticUpdates *pAutomaticUpdates = NULL; | 33 | IAutomaticUpdates *pAutomaticUpdates = NULL; |
19 | 34 | ||
20 | hr = GetAutomaticUpdatesService(&pAutomaticUpdates); | 35 | hr = GetAutomaticUpdatesService(&pAutomaticUpdates); |
21 | ExitOnFailure(hr, "Failed to get the Automatic Updates service."); | 36 | WuaExitOnFailure(hr, "Failed to get the Automatic Updates service."); |
22 | 37 | ||
23 | hr = pAutomaticUpdates->Pause(); | 38 | hr = pAutomaticUpdates->Pause(); |
24 | ExitOnFailure(hr, "Failed to pause the Automatic Updates service."); | 39 | WuaExitOnFailure(hr, "Failed to pause the Automatic Updates service."); |
25 | 40 | ||
26 | LExit: | 41 | LExit: |
27 | ReleaseObject(pAutomaticUpdates); | 42 | ReleaseObject(pAutomaticUpdates); |
@@ -35,10 +50,10 @@ extern "C" HRESULT DAPI WuaResumeAutomaticUpdates() | |||
35 | IAutomaticUpdates *pAutomaticUpdates = NULL; | 50 | IAutomaticUpdates *pAutomaticUpdates = NULL; |
36 | 51 | ||
37 | hr = GetAutomaticUpdatesService(&pAutomaticUpdates); | 52 | hr = GetAutomaticUpdatesService(&pAutomaticUpdates); |
38 | ExitOnFailure(hr, "Failed to get the Automatic Updates service."); | 53 | WuaExitOnFailure(hr, "Failed to get the Automatic Updates service."); |
39 | 54 | ||
40 | hr = pAutomaticUpdates->Resume(); | 55 | hr = pAutomaticUpdates->Resume(); |
41 | ExitOnFailure(hr, "Failed to resume the Automatic Updates service."); | 56 | WuaExitOnFailure(hr, "Failed to resume the Automatic Updates service."); |
42 | 57 | ||
43 | LExit: | 58 | LExit: |
44 | ReleaseObject(pAutomaticUpdates); | 59 | ReleaseObject(pAutomaticUpdates); |
@@ -55,10 +70,10 @@ extern "C" HRESULT DAPI WuaRestartRequired( | |||
55 | VARIANT_BOOL bRestartRequired; | 70 | VARIANT_BOOL bRestartRequired; |
56 | 71 | ||
57 | hr = ::CoCreateInstance(__uuidof(SystemInformation), NULL, CLSCTX_INPROC_SERVER, __uuidof(ISystemInformation), reinterpret_cast<LPVOID*>(&pSystemInformation)); | 72 | hr = ::CoCreateInstance(__uuidof(SystemInformation), NULL, CLSCTX_INPROC_SERVER, __uuidof(ISystemInformation), reinterpret_cast<LPVOID*>(&pSystemInformation)); |
58 | ExitOnRootFailure(hr, "Failed to get WUA system information interface."); | 73 | WuaExitOnRootFailure(hr, "Failed to get WUA system information interface."); |
59 | 74 | ||
60 | hr = pSystemInformation->get_RebootRequired(&bRestartRequired); | 75 | hr = pSystemInformation->get_RebootRequired(&bRestartRequired); |
61 | ExitOnRootFailure(hr, "Failed to determine if restart is required from WUA."); | 76 | WuaExitOnRootFailure(hr, "Failed to determine if restart is required from WUA."); |
62 | 77 | ||
63 | *pfRestartRequired = (VARIANT_FALSE != bRestartRequired); | 78 | *pfRestartRequired = (VARIANT_FALSE != bRestartRequired); |
64 | 79 | ||
@@ -79,10 +94,10 @@ static HRESULT GetAutomaticUpdatesService( | |||
79 | CLSID clsidAutomaticUpdates = { }; | 94 | CLSID clsidAutomaticUpdates = { }; |
80 | 95 | ||
81 | hr = ::CLSIDFromProgID(L"Microsoft.Update.AutoUpdate", &clsidAutomaticUpdates); | 96 | hr = ::CLSIDFromProgID(L"Microsoft.Update.AutoUpdate", &clsidAutomaticUpdates); |
82 | ExitOnFailure(hr, "Failed to get CLSID for Microsoft.Update.AutoUpdate."); | 97 | WuaExitOnFailure(hr, "Failed to get CLSID for Microsoft.Update.AutoUpdate."); |
83 | 98 | ||
84 | hr = ::CoCreateInstance(clsidAutomaticUpdates, NULL, CLSCTX_INPROC_SERVER, IID_IAutomaticUpdates, reinterpret_cast<LPVOID*>(ppAutomaticUpdates)); | 99 | hr = ::CoCreateInstance(clsidAutomaticUpdates, NULL, CLSCTX_INPROC_SERVER, IID_IAutomaticUpdates, reinterpret_cast<LPVOID*>(ppAutomaticUpdates)); |
85 | ExitOnFailure(hr, "Failed to create instance of Microsoft.Update.AutoUpdate."); | 100 | WuaExitOnFailure(hr, "Failed to create instance of Microsoft.Update.AutoUpdate."); |
86 | 101 | ||
87 | LExit: | 102 | LExit: |
88 | return hr; | 103 | return hr; |