From 148a481266f9e67e4a2255c349235c35baa09a02 Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Tue, 4 Apr 2006 13:15:51 -0500 Subject: [PATCH] advpack: Factor out advpack error handling into ADV_HRESULT. --- dlls/advpack/install.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c index c8ce340c23..a33d429108 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -39,6 +39,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack); #define SPAPI_MASK 0xFFFFL #define HRESULT_FROM_SPAPI(x) ((x & SPAPI_MASK) | SPAPI_PREFIX) +#define ADV_HRESULT(x) ((x & SPAPI_ERROR) ? HRESULT_FROM_SPAPI(x) : HRESULT_FROM_WIN32(x)) + /* this structure very closely resembles parameters of RunSetupCommand() */ typedef struct { @@ -366,7 +368,6 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, DWORD dwFlags, LPVOID pvReserved ) { HINF hinf; - DWORD err; TRACE("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p)\n", hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection), @@ -384,13 +385,7 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, hinf = SetupOpenInfFileW(szCmdName, NULL, INF_STYLE_WIN4, NULL); if (hinf == INVALID_HANDLE_VALUE) - { - err = GetLastError(); - if (err & SPAPI_ERROR) - return HRESULT_FROM_SPAPI(err); - else - return HRESULT_FROM_WIN32(err); - } + return ADV_HRESULT(GetLastError()); SetupCloseInfFile(hinf); return E_UNEXPECTED; -- 2.32.0.93.g670b81a890