[PATCH] comdlg32: When FOS_PICKFOLDERS is specified item selection box should contain full path name.

Dmitry Timoshkov dmitry at baikal.ru
Thu Dec 20 08:17:22 CST 2018


Otherwise when selecting a folder using IFileOpenDialog interface
the caller instead of C:\Temp receives C:\Temp\Temp. This matches
both an old GetOpenFileName behaviour and what IFileOpenDialog returns
under Windows.

This patch fixes the folder selection dialog in a very widely used
management software in Russia.

Unfortunately after examining existing IFileOpenDialog tests I don't
see a way to add a test for this behaviour.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/comdlg32/filedlg.c | 2 +-
 dlls/comdlg32/itemdlg.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index deae8660a9..541410ccb7 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -639,7 +639,7 @@ void COMDLG32_GetCanonicalPath(PCIDLIST_ABSOLUTE pidlAbsCurrent,
   }
   PathAddBackslashW(lpstrPathAndFile);
 
-  TRACE("current directory=%s\n", debugstr_w(lpstrPathAndFile));
+  TRACE("current directory=%s, file=%s\n", debugstr_w(lpstrPathAndFile), debugstr_w(lpstrFile));
 
   /* if the user specified a fully qualified path use it */
   if(PathIsRelativeW(lpstrFile))
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index ff97ae26d4..5f36d2bdee 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -424,7 +424,7 @@ static void fill_filename_from_selection(FileDialogImpl *This)
                 (!(This->options & FOS_PICKFOLDERS) &&  (attr & SFGAO_FOLDER))))
                 continue;
 
-            hr = IShellItem_GetDisplayName(psi, SIGDN_PARENTRELATIVEPARSING, &names[valid_count]);
+            hr = IShellItem_GetDisplayName(psi, (This->options & FOS_PICKFOLDERS) ? SIGDN_FILESYSPATH : SIGDN_PARENTRELATIVEPARSING, &names[valid_count]);
             if(SUCCEEDED(hr))
             {
                 len_total += lstrlenW(names[valid_count]) + 3;
-- 
2.19.2




More information about the wine-devel mailing list