[SHELL32]
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 7 Nov 2014 11:30:38 +0000 (11:30 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 7 Nov 2014 11:30:38 +0000 (11:30 +0000)
* Another partial sync of pidl.c with Wine 1.7.27.
* Move some functions where they are used, and remove some unused ones.
* Mark some of our changes with history revisions.
CORE-8540

svn path=/branches/shell-experiments/; revision=65306

dll/win32/shell32/folders/CDrivesFolder.cpp
dll/win32/shell32/folders/CFontsFolder.cpp
dll/win32/shell32/folders/CNetFolder.cpp
dll/win32/shell32/wine/pidl.c
dll/win32/shell32/wine/pidl.h

index ac21211..c7b945c 100644 (file)
@@ -330,6 +330,17 @@ HRESULT WINAPI CDrivesFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVO
     return hr;
 }
 
     return hr;
 }
 
+static BOOL _ILIsControlPanel(LPCITEMIDLIST pidl)
+{
+    IID *iid = _ILGetGUIDPointer(pidl);
+
+    TRACE("(%p)\n", pidl);
+
+    if (iid)
+        return IsEqualIID(iid, CLSID_ControlPanel);
+    return FALSE;
+}
+
 /**************************************************************************
 *  CDrivesFolder::GetAttributesOf
 */
 /**************************************************************************
 *  CDrivesFolder::GetAttributesOf
 */
index 639827e..6d4507e 100644 (file)
@@ -49,6 +49,11 @@ CFontsFolder::~CFontsFolder()
     SHFree(pidlRoot);
 }
 
     SHFree(pidlRoot);
 }
 
+static LPITEMIDLIST _ILCreateFont(void)
+{
+    return _ILCreateGuid(PT_GUID, CLSID_FontsFolderShortcut);
+}
+
 HRESULT WINAPI CFontsFolder::FinalConstruct()
 {
     HRESULT hr;
 HRESULT WINAPI CFontsFolder::FinalConstruct()
 {
     HRESULT hr;
@@ -73,7 +78,6 @@ HRESULT WINAPI CFontsFolder::FinalConstruct()
     return hr;
 }
 
     return hr;
 }
 
-
 HRESULT WINAPI CFontsFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
         ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
 {
 HRESULT WINAPI CFontsFolder::ParseDisplayName(HWND hwndOwner, LPBC pbc, LPOLESTR lpszDisplayName,
         ULONG *pchEaten, PIDLIST_RELATIVE *ppidl, ULONG *pdwAttributes)
 {
index 3630394..fe72098 100644 (file)
@@ -56,7 +56,7 @@ CNetFolder::~CNetFolder()
 
 HRESULT WINAPI CNetFolder::FinalConstruct()
 {
 
 HRESULT WINAPI CNetFolder::FinalConstruct()
 {
-    pidlRoot = _ILCreateNetHood();    /* my qualified pidl */
+    pidlRoot = _ILCreateGuid(PT_GUID, CLSID_NetworkPlaces); /* my qualified pidl */
     if (pidlRoot == NULL)
         return E_OUTOFMEMORY;
     return S_OK;
     if (pidlRoot == NULL)
         return E_OUTOFMEMORY;
     return S_OK;
index d89f674..5e098ca 100644 (file)
@@ -107,47 +107,44 @@ BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWO
             return FALSE;
     }
 
             return FALSE;
     }
 
-    if (type <= 2)
+    switch (type)
     {
     {
-        switch (type)
-        {
-            case ILGDN_FORPARSING:
-                flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
-                break;
-            case ILGDN_NORMAL:
-                flag = SHGDN_NORMAL;
-                break;
-            case ILGDN_INFOLDER:
-                flag = SHGDN_INFOLDER;
-                break;
-            default:
-                FIXME("Unknown type parameter = %x\n", type);
-                flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
-                break;
-        }
+    case ILGDN_FORPARSING:
+        flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+        break;
+    case ILGDN_NORMAL:
+        flag = SHGDN_NORMAL;
+        break;
+    case ILGDN_INFOLDER:
+        flag = SHGDN_INFOLDER;
+        break;
+    default:
+        FIXME("Unknown type parameter = %x\n", type);
+        flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+        break;
+    }
 
 
-        if (!*(const WORD*)pidl || type == ILGDN_FORPARSING)
+    if (!*(const WORD*)pidl || type == ILGDN_FORPARSING)
+    {
+        ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret);
+        if (SUCCEEDED(ret))
         {
         {
-            ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret);
-            if (SUCCEEDED(ret))
-            {
-                if(!StrRetToStrNW(path, MAX_PATH, &strret, pidl))
-                    ret = E_FAIL;
-            }
+            if(!StrRetToStrNW(path, MAX_PATH, &strret, pidl))
+                ret = E_FAIL;
         }
         }
-        else
+    }
+    else
+    {
+        ret = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidllast);
+        if (SUCCEEDED(ret))
         {
         {
-            ret = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidllast);
+            ret = IShellFolder_GetDisplayNameOf(psfParent, pidllast, flag, &strret);
             if (SUCCEEDED(ret))
             {
             if (SUCCEEDED(ret))
             {
-                ret = IShellFolder_GetDisplayNameOf(psfParent, pidllast, flag, &strret);
-                if (SUCCEEDED(ret))
-                {
-                    if(!StrRetToStrNW(path, MAX_PATH, &strret, pidllast))
-                        ret = E_FAIL;
-                }
-                IShellFolder_Release(psfParent);
+                if(!StrRetToStrNW(path, MAX_PATH, &strret, pidllast))
+                    ret = E_FAIL;
             }
             }
+            IShellFolder_Release(psfParent);
         }
     }
 
         }
     }
 
@@ -1849,17 +1846,6 @@ BOOL _ILIsMyDocuments(LPCITEMIDLIST pidl)
     return FALSE;
 }
 
     return FALSE;
 }
 
-BOOL _ILIsControlPanel(LPCITEMIDLIST pidl)
-{
-    IID *iid = _ILGetGUIDPointer(pidl);
-
-    TRACE("(%p)\n", pidl);
-
-    if (iid)
-        return IsEqualIID(iid, &CLSID_ControlPanel);
-    return FALSE;
-}
-
 BOOL _ILIsNetHood(LPCITEMIDLIST pidl)
 {
     IID *iid = _ILGetGUIDPointer(pidl);
 BOOL _ILIsNetHood(LPCITEMIDLIST pidl)
 {
     IID *iid = _ILGetGUIDPointer(pidl);
@@ -1871,17 +1857,6 @@ BOOL _ILIsNetHood(LPCITEMIDLIST pidl)
     return FALSE;
 }
 
     return FALSE;
 }
 
-
-LPITEMIDLIST _ILCreateNetHood(void)
-{
-    return _ILCreateGuid(PT_GUID, &CLSID_NetworkPlaces);
-}
-
-LPITEMIDLIST _ILCreateFont(void)
-{
-    return _ILCreateGuid(PT_GUID, &CLSID_FontsFolderShortcut);
-}
-
 BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
 {
     REFIID iid = _ILGetGUIDPointer(pidl);
 BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
 {
     REFIID iid = _ILGetGUIDPointer(pidl);
@@ -1893,17 +1868,6 @@ BOOL _ILIsMyComputer(LPCITEMIDLIST pidl)
     return FALSE;
 }
 
     return FALSE;
 }
 
-BOOL _ILIsPrinter(LPCITEMIDLIST pidl)
-{
-    IID *iid = _ILGetGUIDPointer(pidl);
-
-    TRACE("(%p)\n", pidl);
-
-    if (iid)
-        return IsEqualIID(iid, &CLSID_Printers);
-    return FALSE;
-}
-
 BOOL _ILIsBitBucket(LPCITEMIDLIST pidl)
 {
     IID *iid = _ILGetGUIDPointer(pidl);
 BOOL _ILIsBitBucket(LPCITEMIDLIST pidl)
 {
     IID *iid = _ILGetGUIDPointer(pidl);
@@ -1915,18 +1879,6 @@ BOOL _ILIsBitBucket(LPCITEMIDLIST pidl)
     return FALSE;
 }
 
     return FALSE;
 }
 
-BOOL _ILIsAdminTools(LPCITEMIDLIST pidl)
-{
-    IID *iid = _ILGetGUIDPointer(pidl);
-
-    TRACE("(%p)\n", pidl);
-
-    if (iid)
-        return IsEqualIID(iid, &CLSID_AdminFolderShortcut);
-    else
-        return FALSE;
-}
-
 BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl)
 {
     LPPIDLDATA lpPData = _ILGetDataPointer(pidl);
 BOOL _ILIsSpecialFolder (LPCITEMIDLIST pidl)
 {
     LPPIDLDATA lpPData = _ILGetDataPointer(pidl);
@@ -2258,8 +2210,10 @@ LPSTR _ILGetTextPointer(LPCITEMIDLIST pidl)
     case PT_SHARE:
         return pdata->u.network.szNames;
 
     case PT_SHARE:
         return pdata->u.network.szNames;
 
+#ifdef __REACTOS__ /* r54423 */
     case PT_CPLAPPLET:
         return pdata->u.cpanel.szName;
     case PT_CPLAPPLET:
         return pdata->u.cpanel.szName;
+#endif
     }
     return NULL;
 }
     }
     return NULL;
 }
@@ -2506,7 +2460,9 @@ BOOL _ILGetExtension (LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
  */
 void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
 {
  */
 void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
 {
+#ifdef __REACTOS__ /* r32966 */
     char sType[64];
     char sType[64];
+#endif
 
     if(_ILIsValue(pidl))
     {
 
     if(_ILIsValue(pidl))
     {
@@ -2514,6 +2470,7 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
 
         if(uOutSize > 0)
             pOut[0] = 0;
 
         if(uOutSize > 0)
             pOut[0] = 0;
+#ifdef __REACTOS__ /* r32966 */
         if (_ILGetExtension (pidl, sType, 64))
         {
             if (HCR_MapTypeToValueA(sType, sTemp, 64, TRUE))
         if (_ILGetExtension (pidl, sType, 64))
         {
             if (HCR_MapTypeToValueA(sType, sTemp, 64, TRUE))
@@ -2534,14 +2491,29 @@ void _ILGetFileType(LPCITEMIDLIST pidl, LPSTR pOut, UINT uOutSize)
                 strcat(pOut, sTemp);
             }
         }
                 strcat(pOut, sTemp);
             }
         }
+#else
+        if (_ILGetExtension (pidl, sTemp, 64))
+        {
+            if (!( HCR_MapTypeToValueA(sTemp, sTemp, 64, TRUE)
+                && HCR_MapTypeToValueA(sTemp, pOut, uOutSize, FALSE )))
+            {
+                lstrcpynA (pOut, sTemp, uOutSize - 6);
+                strcat (pOut, "-file");
+            }
+        }
+#endif
     }
     else
     }
     else
+#ifdef __REACTOS__ /* r32966 */
     {
         pOut[0] = '\0';
         LoadStringA(shell32_hInstance, IDS_DIRECTORY, pOut, uOutSize);
         /* make sure its null terminated */
         pOut[uOutSize-1] = '\0';
     }
     {
         pOut[0] = '\0';
         LoadStringA(shell32_hInstance, IDS_DIRECTORY, pOut, uOutSize);
         /* make sure its null terminated */
         pOut[uOutSize-1] = '\0';
     }
+#else
+        lstrcpynA(pOut, "Folder", uOutSize);
+#endif
 }
 
 /*************************************************************************
 }
 
 /*************************************************************************
index 464a9c1..19275bb 100644 (file)
@@ -236,11 +236,8 @@ BOOL       _ILIsUnicode            (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
 BOOL   _ILIsDesktop            (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
 BOOL   _ILIsMyComputer         (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
 #ifdef __REACTOS__
 BOOL   _ILIsDesktop            (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
 BOOL   _ILIsMyComputer         (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
 #ifdef __REACTOS__
-BOOL   _ILIsPrinter            (LPCITEMIDLIST pidl);
 BOOL   _ILIsMyDocuments        (LPCITEMIDLIST pidl);
 BOOL   _ILIsMyDocuments        (LPCITEMIDLIST pidl);
-BOOL   _ILIsControlPanel       (LPCITEMIDLIST pidl);
 BOOL   _ILIsBitBucket          (LPCITEMIDLIST pidl);
 BOOL   _ILIsBitBucket          (LPCITEMIDLIST pidl);
-BOOL   _ILIsAdminTools         (LPCITEMIDLIST pidl);
 BOOL   _ILIsNetHood            (LPCITEMIDLIST pidl);
 #endif
 BOOL   _ILIsDrive              (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
 BOOL   _ILIsNetHood            (LPCITEMIDLIST pidl);
 #endif
 BOOL   _ILIsDrive              (LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
@@ -286,7 +283,6 @@ LPITEMIDLIST        _ILCreateNetwork        (void) DECLSPEC_HIDDEN;
 LPITEMIDLIST   _ILCreateNetHood        (void) DECLSPEC_HIDDEN;
 #ifdef __REACTOS__
 LPITEMIDLIST   _ILCreateAdminTools     (void);
 LPITEMIDLIST   _ILCreateNetHood        (void) DECLSPEC_HIDDEN;
 #ifdef __REACTOS__
 LPITEMIDLIST   _ILCreateAdminTools     (void);
-LPITEMIDLIST   _ILCreateFont           (void);
 #endif
 LPITEMIDLIST   _ILCreateBitBucket      (void) DECLSPEC_HIDDEN;
 LPITEMIDLIST   _ILCreateDrive          (LPCWSTR) DECLSPEC_HIDDEN;
 #endif
 LPITEMIDLIST   _ILCreateBitBucket      (void) DECLSPEC_HIDDEN;
 LPITEMIDLIST   _ILCreateDrive          (LPCWSTR) DECLSPEC_HIDDEN;