- Fix launching of properties dialog in the detail view
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 17 Oct 2011 13:22:20 +0000 (13:22 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 17 Oct 2011 13:22:20 +0000 (13:22 +0000)
- Based on Edijus patch (terminedijsatyahoodotcom)
See issue #6571 for more details.

svn path=/trunk/; revision=54176

reactos/dll/win32/shell32/fprop.cpp
reactos/dll/win32/shell32/shv_def_cmenu.cpp

index 7eee167..26b2871 100644 (file)
@@ -846,6 +846,7 @@ SH_ShowPropertiesDialog(WCHAR *lpf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *api
     INT_PTR res;
     CComPtr<IDataObject>        pDataObj;
     HRESULT hResult;
+    DWORD wLength;
 
     TRACE("SH_ShowPropertiesDialog entered filename %s\n", debugstr_w(lpf));
 
@@ -873,6 +874,18 @@ SH_ShowPropertiesDialog(WCHAR *lpf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST *api
         wcscpy(wFileName, lpf);
     }
 
+    //
+    // get length
+    //
+    wLength = wcslen(wFileName);
+    if (wFileName[wLength-1] == L'\\' && wLength > 3)
+    {
+        //
+        // remove trailing \\ at the end of path
+        //
+        wFileName[wLength-1] = L'\0';
+    }
+
     if (PathIsDirectoryW(wFileName))
     {
         return SH_ShowFolderProperties(wFileName, pidlFolder, apidl);
index b50c1c1..61fcc49 100644 (file)
@@ -1435,7 +1435,7 @@ IDefaultContextMenuImpl::DoProperties(
          ShellExecuteW(lpcmi->hwnd, L"open", L"rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl", NULL, NULL, SW_SHOWNORMAL);
          return S_OK;
     }
-    else if (dcm.cidl == 0 && _ILIsDesktop(dcm.pidlFolder))
+    else if (dcm.cidl == 0 && dcm.pidlFolder != NULL && _ILIsDesktop(dcm.pidlFolder))
     {
         ShellExecuteW(lpcmi->hwnd, L"open", L"rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL);
         return S_OK;