James Hawkins : advpack: Factor out advpack error handling into ADV_HRESULT .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 5 04:46:30 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 148a481266f9e67e4a2255c349235c35baa09a02
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=148a481266f9e67e4a2255c349235c35baa09a02

Author: James Hawkins <truiken at gmail.com>
Date:   Tue Apr  4 13:15:51 2006 -0500

advpack: Factor out advpack error handling into ADV_HRESULT.

---

 dlls/advpack/install.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index c8ce340..a33d429 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 hWn
                                 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 hWn
 
     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;




More information about the wine-cvs mailing list