Commit 76695731 authored by Alexandre Julliard's avatar Alexandre Julliard

Avoid local WINAPI function pointers to work around gcc bug.

parent 14c96c10
...@@ -44,11 +44,13 @@ typedef struct { ...@@ -44,11 +44,13 @@ typedef struct {
DWORD WINAPI SHLWAPI_2(LPCWSTR x, UNKNOWN_SHLWAPI_2 *y); DWORD WINAPI SHLWAPI_2(LPCWSTR x, UNKNOWN_SHLWAPI_2 *y);
/* Macro to get function pointer for a module*/ /* Macro to get function pointer for a module*/
#define GET_FUNC(module, name, fail) \ #define GET_FUNC(func, module, name, fail) \
if (!SHLWAPI_h##module) SHLWAPI_h##module = LoadLibraryA(#module ".dll"); \ do { \
if (!SHLWAPI_h##module) return fail; \ if (!func) { \
if (!pfnFunc) pfnFunc = (void*)GetProcAddress(SHLWAPI_h##module, name); \ if (!SHLWAPI_h##module && !(SHLWAPI_h##module = LoadLibraryA(#module ".dll"))) return fail; \
if (!pfnFunc) return fail if (!(func = (void*)GetProcAddress(SHLWAPI_h##module, name))) return fail; \
} \
} while (0)
extern HMODULE SHLWAPI_hshell32; extern HMODULE SHLWAPI_hshell32;
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
/* function pointers for GET_FUNC macro; these need to be global because of gcc bug */
static BOOL (WINAPI *pIsNetDrive)(DWORD);
/************************************************************************* /*************************************************************************
* PathAppendA [SHLWAPI.@] * PathAppendA [SHLWAPI.@]
* *
...@@ -3313,7 +3316,6 @@ VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath) ...@@ -3313,7 +3316,6 @@ VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath)
*/ */
BOOL WINAPI PathIsNetworkPathA(LPCSTR lpszPath) BOOL WINAPI PathIsNetworkPathA(LPCSTR lpszPath)
{ {
static BOOL (WINAPI *pfnFunc)(DWORD);
DWORD dwDriveNum; DWORD dwDriveNum;
TRACE("(%s)\n",debugstr_a(lpszPath)); TRACE("(%s)\n",debugstr_a(lpszPath));
...@@ -3325,8 +3327,8 @@ BOOL WINAPI PathIsNetworkPathA(LPCSTR lpszPath) ...@@ -3325,8 +3327,8 @@ BOOL WINAPI PathIsNetworkPathA(LPCSTR lpszPath)
dwDriveNum = PathGetDriveNumberA(lpszPath); dwDriveNum = PathGetDriveNumberA(lpszPath);
if (dwDriveNum == -1) if (dwDriveNum == -1)
return FALSE; return FALSE;
GET_FUNC(shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */ GET_FUNC(pIsNetDrive, shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */
return pfnFunc(dwDriveNum); return pIsNetDrive(dwDriveNum);
} }
/************************************************************************* /*************************************************************************
...@@ -3336,7 +3338,6 @@ BOOL WINAPI PathIsNetworkPathA(LPCSTR lpszPath) ...@@ -3336,7 +3338,6 @@ BOOL WINAPI PathIsNetworkPathA(LPCSTR lpszPath)
*/ */
BOOL WINAPI PathIsNetworkPathW(LPCWSTR lpszPath) BOOL WINAPI PathIsNetworkPathW(LPCWSTR lpszPath)
{ {
static BOOL (WINAPI *pfnFunc)(DWORD);
DWORD dwDriveNum; DWORD dwDriveNum;
TRACE("(%s)\n", debugstr_w(lpszPath)); TRACE("(%s)\n", debugstr_w(lpszPath));
...@@ -3348,8 +3349,8 @@ BOOL WINAPI PathIsNetworkPathW(LPCWSTR lpszPath) ...@@ -3348,8 +3349,8 @@ BOOL WINAPI PathIsNetworkPathW(LPCWSTR lpszPath)
dwDriveNum = PathGetDriveNumberW(lpszPath); dwDriveNum = PathGetDriveNumberW(lpszPath);
if (dwDriveNum == -1) if (dwDriveNum == -1)
return FALSE; return FALSE;
GET_FUNC(shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */ GET_FUNC(pIsNetDrive, shell32, (LPCSTR)66, FALSE); /* ord 66 = shell32.IsNetDrive */
return pfnFunc(dwDriveNum); return pIsNetDrive(dwDriveNum);
} }
/************************************************************************* /*************************************************************************
......
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