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