Andrew Eikum : shell32: Correctly construct the PIDL given to SHChangeNotify in AddFolder.

Alexandre Julliard julliard at winehq.org
Mon Dec 6 13:18:36 CST 2010


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

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Fri Dec  3 11:50:12 2010 -0600

shell32: Correctly construct the PIDL given to SHChangeNotify in AddFolder.

---

 dlls/shell32/shfldr_fs.c |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index 850424d..084dffd 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -1232,12 +1232,34 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName,
 
     bRes = CreateDirectoryW (wszNewDir, NULL);
     if (bRes) {
-        SHChangeNotify (SHCNE_MKDIR, SHCNF_PATHW, wszNewDir, NULL);
+        LPITEMIDLIST relPidl;
 
-        hres = S_OK;
+        lstrcpyW(wszNewDir, pwszName);
+
+        hres = IShellFolder_ParseDisplayName((IShellFolder*)&This->lpvtblShellFolder,
+                hwnd, NULL, wszNewDir, NULL, &relPidl, NULL);
+
+        if (SUCCEEDED(hres)) {
+            LPITEMIDLIST fullPidl;
+
+            fullPidl = ILCombine(This->pidlRoot, relPidl);
+
+            if (fullPidl) {
+                SHChangeNotify(SHCNE_MKDIR, SHCNF_IDLIST, fullPidl, NULL);
+                ILFree(fullPidl);
+
+                if (ppidlOut)
+                    *ppidlOut = relPidl;
+                else
+                    ILFree(relPidl);
+            } else {
+                WARN("failed to combine %s into a full PIDL\n", wine_dbgstr_w(pwszName));
+                ILFree(relPidl);
+            }
+
+        } else
+            WARN("failed to parse %s into a PIDL\n", wine_dbgstr_w(pwszName));
 
-        if (ppidlOut)
-                hres = _ILCreateFromPathW(wszNewDir, ppidlOut);
     } else {
         WCHAR wszText[128 + MAX_PATH];
         WCHAR wszTempText[128];




More information about the wine-cvs mailing list