Owen Rudge : shell32: Add Unicode version of GetFileNameFromBrowse.

Alexandre Julliard julliard at winehq.org
Thu Nov 12 10:22:11 CST 2009


Module: wine
Branch: master
Commit: e8f05eeff3c786c47bdb318f53ad714a29003917
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e8f05eeff3c786c47bdb318f53ad714a29003917

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Wed Nov 11 10:07:09 2009 -0600

shell32: Add Unicode version of GetFileNameFromBrowse.

Implement GetFileNameFromBrowse as an AW function.

---

 dlls/shell32/shell32.spec |    2 +-
 dlls/shell32/shellord.c   |   71 +++++++++++++++++++++++++++++++++++++++++++--
 include/shlobj.h          |    2 +-
 3 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index 546e6a5..f95690c 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -58,7 +58,7 @@
   60 stdcall -noname ExitWindowsDialog(long)
   61 stdcall -noname RunFileDlg(long long long str str long) RunFileDlgAW
   62 stdcall -noname PickIconDlg(long long long long)
-  63 stdcall -noname GetFileNameFromBrowse(long long long long str str str)
+  63 stdcall -noname GetFileNameFromBrowse(long long long long str str str) GetFileNameFromBrowseAW
   64 stdcall -noname DriveType(long)
   65 stdcall -noname InvalidateDriveType(long)
   66 stdcall -noname IsNetDrive(long)
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index ac06e4b..fd942f7 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -167,10 +167,9 @@ DWORD WINAPI ParseFieldAW(LPCVOID src, DWORD nField, LPVOID dst, DWORD len)
 }
 
 /*************************************************************************
- * GetFileNameFromBrowse			[SHELL32.63]
- *
+ * GetFileNameFromBrowseA			[internal]
  */
-BOOL WINAPI GetFileNameFromBrowse(
+BOOL WINAPI GetFileNameFromBrowseA(
 	HWND hwndOwner,
 	LPSTR lpstrFile,
 	DWORD nMaxFile,
@@ -215,6 +214,72 @@ BOOL WINAPI GetFileNameFromBrowse(
 }
 
 /*************************************************************************
+ * GetFileNameFromBrowseW			[internal]
+ */
+BOOL WINAPI GetFileNameFromBrowseW(
+	HWND hwndOwner,
+	LPWSTR lpstrFile,
+	DWORD nMaxFile,
+	LPCWSTR lpstrInitialDir,
+	LPCWSTR lpstrDefExt,
+	LPCWSTR lpstrFilter,
+	LPCWSTR lpstrTitle)
+{
+    HMODULE hmodule;
+    BOOL (WINAPI *pGetOpenFileNameW)(LPOPENFILENAMEW);
+    OPENFILENAMEW ofn;
+    BOOL ret;
+
+    TRACE("%p, %s, %d, %s, %s, %s, %s)\n",
+	  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);
+    ofn.hwndOwner = hwndOwner;
+    ofn.lpstrFilter = lpstrFilter;
+    ofn.lpstrFile = lpstrFile;
+    ofn.nMaxFile = nMaxFile;
+    ofn.lpstrInitialDir = lpstrInitialDir;
+    ofn.lpstrTitle = lpstrTitle;
+    ofn.lpstrDefExt = lpstrDefExt;
+    ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
+    ret = pGetOpenFileNameW(&ofn);
+
+    FreeLibrary(hmodule);
+    return ret;
+}
+
+/*************************************************************************
+ * GetFileNameFromBrowse			[SHELL32.63]
+ *
+ */
+BOOL WINAPI GetFileNameFromBrowseAW(
+	HWND hwndOwner,
+	LPVOID lpstrFile,
+	DWORD nMaxFile,
+	LPCVOID lpstrInitialDir,
+	LPCVOID lpstrDefExt,
+	LPCVOID lpstrFilter,
+	LPCVOID lpstrTitle)
+{
+    if (SHELL_OsIsUnicode())
+        return GetFileNameFromBrowseW(hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt, lpstrFilter, lpstrTitle);
+
+    return GetFileNameFromBrowseA(hwndOwner, lpstrFile, nMaxFile, lpstrInitialDir, lpstrDefExt, lpstrFilter, lpstrTitle);
+}
+
+/*************************************************************************
  * SHGetSetSettings				[SHELL32.68]
  */
 VOID WINAPI SHGetSetSettings(LPSHELLSTATE lpss, DWORD dwMask, BOOL bSet)
diff --git a/include/shlobj.h b/include/shlobj.h
index 15128c7..171cf3b 100644
--- a/include/shlobj.h
+++ b/include/shlobj.h
@@ -53,7 +53,7 @@ void         WINAPI SHDestroyPropSheetExtArray(HPSXA);
 BOOL         WINAPI SHFindFiles(LPCITEMIDLIST,LPCITEMIDLIST);
 DWORD        WINAPI SHFormatDrive(HWND,UINT,UINT,UINT);
 void         WINAPI SHFree(LPVOID);
-BOOL         WINAPI GetFileNameFromBrowse(HWND,LPSTR,DWORD,LPCSTR,LPCSTR,LPCSTR,LPCSTR);
+BOOL         WINAPI GetFileNameFromBrowse(HWND,LPWSTR,DWORD,LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
 HRESULT      WINAPI SHGetInstanceExplorer(IUnknown**);
 HRESULT      WINAPI SHGetFolderPathAndSubDirA(HWND,int,HANDLE,DWORD,LPCSTR,LPSTR);
 HRESULT      WINAPI SHGetFolderPathAndSubDirW(HWND,int,HANDLE,DWORD,LPCWSTR,LPWSTR);




More information about the wine-cvs mailing list