Commit a1ffd507 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

shell32: Don't use GetProcAddress for GetOpenFileName[AW].

parent a6218a81
MODULE = shell32.dll
IMPORTLIB = shell32
IMPORTS = uuid shlwapi user32 gdi32 advapi32
DELAYIMPORTS = ole32 oleaut32 shdocvw version comctl32 gdiplus
DELAYIMPORTS = ole32 oleaut32 shdocvw version comctl32 comdlg32 gdiplus
C_SRCS = \
appbar.c \
......
......@@ -271,8 +271,6 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
case IDC_RUNDLG_BROWSE :
{
HMODULE hComdlg = NULL ;
LPFNOFN ofnProc = NULL ;
WCHAR szFName[1024] = {0};
WCHAR filter_exe[256], filter_all[256], filter[MAX_PATH], szCaption[MAX_PATH];
OPENFILENAMEW ofn;
......@@ -292,15 +290,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
ofn.lpstrInitialDir = prfdp->lpstrDirectory;
if (NULL == (hComdlg = LoadLibraryExW (L"comdlg32.dll", NULL, 0)) ||
NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameW")))
{
ERR("Couldn't get GetOpenFileName function entry (lib=%p, proc=%p)\n", hComdlg, ofnProc);
ShellMessageBoxW(shell32_hInstance, hwnd, MAKEINTRESOURCEW(IDS_RUNDLG_BROWSE_ERROR), NULL, MB_OK | MB_ICONERROR);
return TRUE ;
}
if (ofnProc(&ofn))
if (GetOpenFileNameW(&ofn))
{
SetFocus (GetDlgItem (hwnd, IDOK)) ;
SetWindowTextW (GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH), szFName) ;
......@@ -308,8 +298,6 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR
SetFocus (GetDlgItem (hwnd, IDOK)) ;
}
FreeLibrary (hComdlg) ;
return TRUE ;
}
}
......
......@@ -188,8 +188,6 @@ static BOOL GetFileNameFromBrowseA(
LPCSTR lpstrFilter,
LPCSTR lpstrTitle)
{
HMODULE hmodule;
BOOL (WINAPI *pGetOpenFileNameA)(LPOPENFILENAMEA);
OPENFILENAMEA ofn;
BOOL ret;
......@@ -197,15 +195,6 @@ static BOOL GetFileNameFromBrowseA(
hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt,
lpstrFilter, lpstrTitle);
hmodule = LoadLibraryA("comdlg32.dll");
if(!hmodule) return FALSE;
pGetOpenFileNameA = (void *)GetProcAddress(hmodule, "GetOpenFileNameA");
if(!pGetOpenFileNameA)
{
FreeLibrary(hmodule);
return FALSE;
}
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
......@@ -217,9 +206,8 @@ static BOOL GetFileNameFromBrowseA(
ofn.lpstrTitle = lpstrTitle;
ofn.lpstrDefExt = lpstrDefExt;
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
ret = pGetOpenFileNameA(&ofn);
ret = GetOpenFileNameA(&ofn);
FreeLibrary(hmodule);
return ret;
}
......@@ -235,8 +223,6 @@ static BOOL GetFileNameFromBrowseW(
LPCWSTR lpstrFilter,
LPCWSTR lpstrTitle)
{
HMODULE hmodule;
BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW);
OPENFILENAMEW ofn;
BOOL ret;
......@@ -244,15 +230,6 @@ static BOOL GetFileNameFromBrowseW(
hwndOwner, debugstr_w(lpstrFile), nMaxFile, debugstr_w(lpstrInitialDir), debugstr_w(lpstrDefExt),
debugstr_w(lpstrFilter), debugstr_w(lpstrTitle));
hmodule = LoadLibraryA("comdlg32.dll");
if(!hmodule) return FALSE;
pGetOpenFileNameW = (void *)GetProcAddress(hmodule, "GetOpenFileNameW");
if(!pGetOpenFileNameW)
{
FreeLibrary(hmodule);
return FALSE;
}
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
......@@ -264,9 +241,8 @@ static BOOL GetFileNameFromBrowseW(
ofn.lpstrTitle = lpstrTitle;
ofn.lpstrDefExt = lpstrDefExt;
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
ret = pGetOpenFileNameW(&ofn);
ret = GetOpenFileNameW(&ofn);
FreeLibrary(hmodule);
return ret;
}
......
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