shell32: Solve the problem about 'OK' button is always disable when call SHBrowseForFolder with flags including both BIF_BROWSEFORCOMPUTER and BIF_RETURNONLYFSDIRS

许文龙 myxuan475 at 126.com
Wed Apr 5 00:39:00 CDT 2017


From 65f06c86553e0c31aeef167637ef65af0f1c8754 Mon Sep 17 00:00:00 2001
From: Xu Wenlong <myxuan475 at 126.com>
Date: Wed, 29 Mar 2017 15:32:55 +0800
Subject: shell32: Solve the problem about 'OK' button is always gray when call SHBrowseForFolder with flags including both BIF_BROWSEFORCOMPUTER and BIF_RETURNONLYFSDIRS
To: wine-patches <wine-patches at winehq.org>
Reply-To: wine-devel <wine-devel at winehq.org>


Signed-off-by: Xu Wenlong <myxuan475 at 126.com>
---
 dlls/shell32/brsfolder.c       | 10 +++++++---
 dlls/shell32/tests/brsfolder.c |  5 +++++
 2 files changed, 12 insertions(+), 3 deletions(-)


diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index 4040407..1728b1f 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -476,9 +476,13 @@ static void BrsFolder_CheckValidSelection( browse_info *info, LPTV_ITEMDATA lptv
     DWORD dwAttributes;
     HRESULT r;
 
-    if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
-        !PIDLIsType(pidl, PT_COMP))
-        bEnabled = FALSE;
+    if (!(lpBrowseInfo->ulFlags & BIF_RETURNONLYFSDIRS))
+    {
+        if ((lpBrowseInfo->ulFlags & BIF_BROWSEFORCOMPUTER) &&
+            !PIDLIsType(pidl, PT_COMP))
+            bEnabled = FALSE;
+    }
+
     if (lpBrowseInfo->ulFlags & BIF_RETURNFSANCESTORS)
     {
         dwAttributes = SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM;
diff --git a/dlls/shell32/tests/brsfolder.c b/dlls/shell32/tests/brsfolder.c
index bf29d11..fecca81 100644
--- a/dlls/shell32/tests/brsfolder.c
+++ b/dlls/shell32/tests/brsfolder.c
@@ -351,6 +351,11 @@ static void test_selection(void)
     pidl = SHBrowseForFolderA(&bi);
     CoTaskMemFree(pidl);
 
+    /* test with flag */
+    bi.ulFlags = BIF_BROWSEFORCOMPUTER | BIF_RETURNONLYFSDIRS;
+    pidl = SHBrowseForFolderA(&bi);
+    CoTaskMemFree(pidl);
+
     IShellFolder_Release(desktop_object);
 
     CoUninitialize();
-- 
2.8.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20170405/69f4cb7a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-shell32-Fix-the-bug-about-the-OK-button-in-folder-br.patch
Type: application/octet-stream
Size: 1898 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20170405/69f4cb7a/attachment.obj>


More information about the wine-patches mailing list