[SHELL32] -Remove IShellView_Constructor and CDefView_Constructor. Use SHCreateShellF...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 5 Jul 2017 21:36:20 +0000 (21:36 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 5 Jul 2017 21:36:20 +0000 (21:36 +0000)
svn path=/trunk/; revision=75289

reactos/dll/win32/shell32/CDefView.cpp
reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
reactos/dll/win32/shell32/folders/CDrivesFolder.cpp
reactos/dll/win32/shell32/folders/CFSFolder.cpp
reactos/dll/win32/shell32/folders/CNetFolder.cpp
reactos/dll/win32/shell32/folders/CPrinterFolder.cpp
reactos/dll/win32/shell32/folders/CRecycleBin.cpp
reactos/dll/win32/shell32/wine/shell32_main.h
reactos/dll/win32/shell32/wine/shellord.c

index 09cd0aa..27fcb44 100644 (file)
@@ -3153,15 +3153,49 @@ HRESULT CDefView::_MergeToolbar()
 
     return S_OK;
 }
-/**********************************************************
- *    IShellView_Constructor
- */
-HRESULT WINAPI IShellView_Constructor(IShellFolder *pFolder, IShellView **newView)
+
+HRESULT CDefView_CreateInstance(IShellFolder *pFolder, REFIID riid, LPVOID * ppvOut)
 {
-    return ShellObjectCreatorInit<CDefView>(pFolder, IID_PPV_ARG(IShellView, newView));
+    return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut);
 }
 
-HRESULT WINAPI CDefView_Constructor(IShellFolder *pFolder, REFIID riid, LPVOID * ppvOut)
+HRESULT WINAPI SHCreateShellFolderViewEx(
+    LPCSFV psvcbi,    /* [in] shelltemplate struct */
+    IShellView **ppsv) /* [out] IShellView pointer */
 {
-    return ShellObjectCreatorInit<CDefView>(pFolder, riid, ppvOut);
+    CComPtr<IShellView> psv;
+    HRESULT hRes;
+
+    TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n",
+      psvcbi->pshf, psvcbi->pidl, psvcbi->pfnCallback,
+      psvcbi->fvm, psvcbi->psvOuter);
+
+    *ppsv = NULL;
+    hRes = CDefView_CreateInstance(psvcbi->pshf, IID_PPV_ARG(IShellView, &psv));
+    if (FAILED_UNEXPECTEDLY(hRes))
+        return hRes;
+
+    *ppsv = psv.Detach();
+    return hRes;
+}
+
+HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv,
+                        IShellView **ppsv)
+{
+    CComPtr<IShellView> psv;
+    HRESULT hRes;
+
+    *ppsv = NULL;
+    if (!pcsfv || pcsfv->cbSize != sizeof(*pcsfv))
+        return E_INVALIDARG;
+
+    TRACE("sf=%p outer=%p callback=%p\n",
+      pcsfv->pshf, pcsfv->psvOuter, pcsfv->psfvcb);
+
+    hRes = CDefView_CreateInstance(pcsfv->pshf, IID_PPV_ARG(IShellView, &psv));
+    if (FAILED(hRes))
+        return hRes;
+
+    *ppsv = psv.Detach();
+    return hRes;
 }
index 03abfe6..62540ab 100644 (file)
@@ -394,7 +394,8 @@ HRESULT WINAPI CControlPanelFolder::CreateViewObject(HWND hwndOwner, REFIID riid
             WARN("IContextMenu not implemented\n");
             hr = E_NOTIMPL;
         } else if (IsEqualIID(riid, IID_IShellView)) {
-            hr = CDefView_Constructor(this, riid, ppvOut);
+            SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+            hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
         }
     }
     TRACE("--(%p)->(interface=%p)\n", this, ppvOut);
index 7a81c9f..cf1656f 100644 (file)
@@ -514,7 +514,6 @@ HRESULT WINAPI CDesktopFolder::CreateViewObject(
     REFIID riid,
     LPVOID *ppvOut)
 {
-    CComPtr<IShellView> pShellView;
     HRESULT hr = E_INVALIDARG;
 
     TRACE ("(%p)->(hwnd=%p,%s,%p)\n",
@@ -549,9 +548,8 @@ HRESULT WINAPI CDesktopFolder::CreateViewObject(
     }
     else if (IsEqualIID (riid, IID_IShellView))
     {
-        hr = IShellView_Constructor((IShellFolder *)this, &pShellView);
-        if (pShellView)
-            hr = pShellView->QueryInterface(riid, ppvOut);
+        SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+        hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
     }
     TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
     return hr;
index 2280cfb..1accb7a 100644 (file)
@@ -531,7 +531,8 @@ HRESULT WINAPI CDrivesFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVO
     }
     else if (IsEqualIID(riid, IID_IShellView))
     {
-        hr = CDefView_Constructor(this, riid, ppvOut);
+            SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+            hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
     }
     TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
     return hr;
index e4487ca..518877b 100644 (file)
@@ -393,7 +393,8 @@ HRESULT WINAPI CFSFolder::CreateViewObject(HWND hwndOwner,
         }
         else if (IsEqualIID (riid, IID_IShellView))
         {
-            hr = CDefView_Constructor(this, riid, ppvOut);
+            SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+            hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
         }
     }
     TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
index 2bbd358..b0bfdce 100644 (file)
@@ -362,7 +362,8 @@ HRESULT WINAPI CNetFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPVOID
     }
     else if (IsEqualIID(riid, IID_IShellView))
     {
-        hr = CDefView_Constructor(this, riid, ppvOut);
+            SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+            hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
     }
     TRACE("-- (%p)->(interface=%p)\n", this, ppvOut);
     return hr;
index 1448d25..85a8968 100644 (file)
@@ -285,7 +285,8 @@ HRESULT WINAPI CPrinterFolder::CreateViewObject(HWND hwndOwner, REFIID riid, LPV
     }
     else if(IsEqualIID(riid, IID_IShellView))
     {
-        hr = CDefView_Constructor(this, riid, ppvOut);
+        SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+        hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppvOut);
     }
     TRACE ("-- (%p)->(interface=%p)\n", this, ppvOut);
     return hr;
index e866203..853c81e 100644 (file)
@@ -564,7 +564,8 @@ HRESULT WINAPI CRecycleBin::CreateViewObject(HWND hwndOwner, REFIID riid, void *
     }
     else if (IsEqualIID (riid, IID_IShellView))
     {
-        hr = CDefView_Constructor(this, riid, ppv);
+        SFV_CREATE sfvparams = {sizeof(SFV_CREATE), this};
+        hr = SHCreateShellFolderView(&sfvparams, (IShellView**)ppv);
     }
     else
         return hr;
index 66a9859..489ad42 100644 (file)
@@ -69,8 +69,6 @@ IContextMenu2 *       ISvItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pid
 HRESULT WINAPI INewItem_Constructor(IUnknown * pUnkOuter, REFIID riif, LPVOID *ppv);
 IContextMenu2 * ISvStaticItemCm_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST pidl, LPCITEMIDLIST *apidl, UINT cidl, HKEY hKey);
 IContextMenu2 *        ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
-HRESULT WINAPI IShellView_Constructor(IShellFolder *pFolder, IShellView **newView);
-HRESULT WINAPI CDefView_Constructor(IShellFolder *pFolder, REFIID riid, LPVOID * ppvOut);
 HRESULT WINAPI CDefViewDual_Constructor(REFIID riid, LPVOID * ppvOut);
 HRESULT WINAPI CShellDispatch_Constructor(REFIID riid, LPVOID * ppvOut);
 
index df2c520..cf5796e 100644 (file)
@@ -1046,6 +1046,8 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv)
  * NOTES
  *  see IShellFolder::CreateViewObject
  */
+ #ifndef __REACTOS__
+
 HRESULT WINAPI SHCreateShellFolderViewEx(
        LPCSFV psvcbi,    /* [in] shelltemplate struct */
        IShellView **ppv) /* [out] IShellView pointer */
@@ -1068,6 +1070,8 @@ HRESULT WINAPI SHCreateShellFolderViewEx(
 
        return hRes;
 }
+#endif
+
 /*************************************************************************
  *  SHWinHelp                                  [SHELL32.127]
  *
@@ -2108,6 +2112,8 @@ HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
     return ret;
 }
 
+#ifndef __REACTOS__
+
 /*************************************************************************
  * SHCreateShellFolderView                     [SHELL32.256]
  *
@@ -2142,3 +2148,4 @@ HRESULT WINAPI SHCreateShellFolderView(const SFV_CREATE *pcsfv,
 
        return hRes;
 }
+#endif