Commit 148a4812 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

advpack: Factor out advpack error handling into ADV_HRESULT.

parent 5a5b35ce
...@@ -39,6 +39,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack); ...@@ -39,6 +39,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack);
#define SPAPI_MASK 0xFFFFL #define SPAPI_MASK 0xFFFFL
#define HRESULT_FROM_SPAPI(x) ((x & SPAPI_MASK) | SPAPI_PREFIX) #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() */ /* this structure very closely resembles parameters of RunSetupCommand() */
typedef struct typedef struct
{ {
...@@ -366,7 +368,6 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, ...@@ -366,7 +368,6 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName,
DWORD dwFlags, LPVOID pvReserved ) DWORD dwFlags, LPVOID pvReserved )
{ {
HINF hinf; HINF hinf;
DWORD err;
TRACE("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p)\n", TRACE("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p)\n",
hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection), hWnd, debugstr_w(szCmdName), debugstr_w(szInfSection),
...@@ -384,13 +385,7 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName, ...@@ -384,13 +385,7 @@ HRESULT WINAPI RunSetupCommandW(HWND hWnd, LPCWSTR szCmdName,
hinf = SetupOpenInfFileW(szCmdName, NULL, INF_STYLE_WIN4, NULL); hinf = SetupOpenInfFileW(szCmdName, NULL, INF_STYLE_WIN4, NULL);
if (hinf == INVALID_HANDLE_VALUE) if (hinf == INVALID_HANDLE_VALUE)
{ return ADV_HRESULT(GetLastError());
err = GetLastError();
if (err & SPAPI_ERROR)
return HRESULT_FROM_SPAPI(err);
else
return HRESULT_FROM_WIN32(err);
}
SetupCloseInfFile(hinf); SetupCloseInfFile(hinf);
return E_UNEXPECTED; return E_UNEXPECTED;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment