shell32: Use proper macros when calling COM methods

Nikolay Sivov nsivov at codeweavers.com
Mon Jul 30 01:13:03 CDT 2012


  Use proper macros when calling COM methods
-------------- next part --------------
>From 8f667bc9865e7f01eb244997926f20c30d388087 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun, 29 Jul 2012 12:51:05 +0400
Subject: [PATCH 4/7] Use proper macros when calling COM methods

---
 dlls/shell32/assoc.c            |    2 +-
 dlls/shell32/cpanelfolder.c     |    2 +-
 dlls/shell32/ebrowser.c         |   12 ++++++------
 dlls/shell32/recyclebin.c       |    2 +-
 dlls/shell32/shellitem.c        |    6 +++---
 dlls/shell32/shfldr_desktop.c   |    6 +++---
 dlls/shell32/shfldr_fs.c        |    8 ++++----
 dlls/shell32/shfldr_mycomp.c    |   14 +++++++-------
 dlls/shell32/shfldr_netplaces.c |    2 +-
 dlls/shell32/shfldr_unixfs.c    |   12 ++++++------
 dlls/shell32/shlfolder.c        |    8 ++++----
 11 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c
index 0131da7..e565591 100644
--- a/dlls/shell32/assoc.c
+++ b/dlls/shell32/assoc.c
@@ -901,7 +901,7 @@ HRESULT WINAPI ApplicationAssociationRegistration_Constructor(IUnknown *outer, R
     This->IApplicationAssociationRegistration_iface.lpVtbl = &IApplicationAssociationRegistration_vtbl;
     This->ref = 0;
 
-    hr = IUnknown_QueryInterface(&This->IApplicationAssociationRegistration_iface, riid, ppv);
+    hr = IApplicationAssociationRegistration_QueryInterface(&This->IApplicationAssociationRegistration_iface, riid, ppv);
     if (FAILED(hr))
         SHFree(This);
 
diff --git a/dlls/shell32/cpanelfolder.c b/dlls/shell32/cpanelfolder.c
index ff862ce..7d2b9ff 100644
--- a/dlls/shell32/cpanelfolder.c
+++ b/dlls/shell32/cpanelfolder.c
@@ -776,7 +776,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetDetailsOf(IShellFolder2 *iface, LPCI
 	psd->str.uType = STRRET_CSTR;
 	switch(iColumn) {
 	case 0:		/* name */
-	    hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
+	    hr = IShellFolder2_GetDisplayNameOf(iface, pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
 	    break;
 	case 1:		/* comment */
             pcpanel = _ILGetCPanelPointer(pidl);
diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c
index f398228..90be5f8 100644
--- a/dlls/shell32/ebrowser.c
+++ b/dlls/shell32/ebrowser.c
@@ -417,9 +417,9 @@ static void get_interfaces_from_site(ExplorerBrowserImpl *This)
 
     if(This->pcdb_site)
     {
-        IUnknown_Release(This->pcdb_site);
-        if(This->pcdb2_site) IUnknown_Release(This->pcdb2_site);
-        if(This->pcdb3_site) IUnknown_Release(This->pcdb3_site);
+        ICommDlgBrowser_Release(This->pcdb_site);
+        if(This->pcdb2_site) ICommDlgBrowser2_Release(This->pcdb2_site);
+        if(This->pcdb3_site) ICommDlgBrowser3_Release(This->pcdb3_site);
 
         This->pcdb_site = NULL;
         This->pcdb2_site = NULL;
@@ -666,8 +666,8 @@ static LRESULT navpane_on_wm_size_move(ExplorerBrowserImpl *This)
 
 static LRESULT navpane_on_wm_destroy(ExplorerBrowserImpl *This)
 {
-    INameSpaceTreeControl_TreeUnadvise(This->navpane.pnstc2, This->navpane.nstc_cookie);
-    INameSpaceTreeControl_Release(This->navpane.pnstc2);
+    INameSpaceTreeControl2_TreeUnadvise(This->navpane.pnstc2, This->navpane.nstc_cookie);
+    INameSpaceTreeControl2_Release(This->navpane.pnstc2);
     This->navpane.pnstc2 = NULL;
     return TRUE;
 }
@@ -1197,7 +1197,7 @@ static HRESULT WINAPI IExplorerBrowser_fnBrowseToIDList(IExplorerBrowser *iface,
         hr = SHCreateItemFromIDList(This->current_pidl, &IID_IShellItem, (void**)&psi);
         if(SUCCEEDED(hr))
         {
-            INameSpaceTreeControl_EnsureItemVisible(This->navpane.pnstc2, psi);
+            INameSpaceTreeControl2_EnsureItemVisible(This->navpane.pnstc2, psi);
             IShellItem_Release(psi);
         }
     }
diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c
index a10bffa..70673d2 100644
--- a/dlls/shell32/recyclebin.c
+++ b/dlls/shell32/recyclebin.c
@@ -154,7 +154,7 @@ static ULONG WINAPI RecycleBinMenu_Release(IContextMenu2 *iface)
     {
         TRACE("Destroying object\n");
         _ILFreeaPidl(This->apidl,This->cidl);
-        IShellFolder_Release(This->folder);
+        IShellFolder2_Release(This->folder);
         SHFree(This);
     }
     return result;
diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
index b2093a1..83102c9 100644
--- a/dlls/shell32/shellitem.c
+++ b/dlls/shell32/shellitem.c
@@ -285,7 +285,7 @@ static HRESULT WINAPI ShellItem_Compare(IShellItem2 *iface, IShellItem *oth,
     if(hint & (SICHINT_CANONICAL | SICHINT_ALLFIELDS))
         FIXME("Unsupported flags 0x%08x\n", hint);
 
-    ret = IShellItem_GetDisplayName(iface, SIGDN_DESKTOPABSOLUTEEDITING, &dispname);
+    ret = IShellItem2_GetDisplayName(iface, SIGDN_DESKTOPABSOLUTEEDITING, &dispname);
     if(SUCCEEDED(ret))
     {
         ret = IShellItem_GetDisplayName(oth, SIGDN_DESKTOPABSOLUTEEDITING, &dispname_oth);
@@ -303,7 +303,7 @@ static HRESULT WINAPI ShellItem_Compare(IShellItem2 *iface, IShellItem *oth,
         LPWSTR dispname, dispname_oth;
 
         TRACE("Testing filesystem path.\n");
-        ret = IShellItem_GetDisplayName(iface, SIGDN_FILESYSPATH, &dispname);
+        ret = IShellItem2_GetDisplayName(iface, SIGDN_FILESYSPATH, &dispname);
         if(SUCCEEDED(ret))
         {
             ret = IShellItem_GetDisplayName(oth, SIGDN_FILESYSPATH, &dispname_oth);
@@ -571,7 +571,7 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
         {
             IPersistFolder2* ppf2Parent;
 
-            if (FAILED(IPersistFolder2_QueryInterface(psfParent, &IID_IPersistFolder2, (void**)&ppf2Parent)))
+            if (FAILED(IShellFolder_QueryInterface(psfParent, &IID_IPersistFolder2, (void**)&ppf2Parent)))
             {
                 FIXME("couldn't get IPersistFolder2 interface of parent\n");
                 return E_NOINTERFACE;
diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c
index 43d4108..6d52fd0 100644
--- a/dlls/shell32/shfldr_desktop.c
+++ b/dlls/shell32/shfldr_desktop.c
@@ -556,7 +556,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetUIObjectOf (IShellFolder2 * iface,
     }
     else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
     {
-        hr = IShellFolder_QueryInterface (iface,
+        hr = IShellFolder2_QueryInterface (iface,
                                           &IID_IDropTarget, (LPVOID *) & pObj);
     }
     else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
@@ -827,7 +827,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
     switch (iColumn)
     {
     case 0:        /* name */
-        hr = IShellFolder_GetDisplayNameOf(iface, pidl,
+        hr = IShellFolder2_GetDisplayNameOf(iface, pidl,
                    SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
         break;
     case 1:        /* size */
@@ -978,5 +978,5 @@ HRESULT WINAPI ISF_Desktop_Constructor (
         }
     }
 
-    return IUnknown_QueryInterface( &cached_sf->IShellFolder2_iface, riid, ppv );
+    return IShellFolder2_QueryInterface( &cached_sf->IShellFolder2_iface, riid, ppv );
 }
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index 3bbe26e..e724b07 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -542,7 +542,7 @@ IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner,
         *ppvOut = NULL;
 
         if (IsEqualIID (riid, &IID_IDropTarget)) {
-            hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, ppvOut);
+            hr = IShellFolder2_QueryInterface (iface, &IID_IDropTarget, ppvOut);
         } else if (IsEqualIID (riid, &IID_IContextMenu)) {
             FIXME ("IContextMenu not implemented\n");
             hr = E_NOTIMPL;
@@ -676,7 +676,7 @@ HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface,
     if(FAILED(hr))
         return hr;
 
-    hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_FORPARSING, &path);
+    hr = IShellFolder2_GetDisplayNameOf(iface, pidl, SHGDN_FORPARSING, &path);
     if(SUCCEEDED(hr))
         hr = StrRetToStrW(&path, NULL, &file);
     if(FAILED(hr)) {
@@ -760,7 +760,7 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
             SHFree (pidl);
             hr = S_OK;
         } else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1)) {
-            hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget,
+            hr = IShellFolder2_QueryInterface (iface, &IID_IDropTarget,
              (LPVOID *) & pObj);
         } else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
          IsEqualIID(riid,&IID_IShellLinkA)) && (cidl == 1)) {
@@ -1070,7 +1070,7 @@ IShellFolder_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl,
         /* the data from the pidl */
         switch (iColumn) {
         case 0:                /* name */
-            hr = IShellFolder_GetDisplayNameOf (iface, pidl,
+            hr = IShellFolder2_GetDisplayNameOf (iface, pidl,
              SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
             break;
         case 1:                /* size */
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c
index 200ad86..77a1c01 100644
--- a/dlls/shell32/shfldr_mycomp.c
+++ b/dlls/shell32/shfldr_mycomp.c
@@ -112,9 +112,9 @@ HRESULT WINAPI ISF_MyComputer_Constructor (IUnknown * pUnkOuter, REFIID riid, LP
     sf->IPersistFolder2_iface.lpVtbl = &vt_PersistFolder2;
     sf->pidlRoot = _ILCreateMyComputer ();    /* my qualified pidl */
 
-    if (FAILED (IUnknown_QueryInterface (&sf->IShellFolder2_iface, riid, ppv)))
+    if (FAILED (IShellFolder2_QueryInterface (&sf->IShellFolder2_iface, riid, ppv)))
     {
-        IUnknown_Release (&sf->IShellFolder2_iface);
+        IShellFolder2_Release (&sf->IShellFolder2_iface);
         return E_NOINTERFACE;
     }
 
@@ -556,7 +556,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetUIObjectOf (IShellFolder2 * iface,
     }
     else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
     {
-        hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget,
+        hr = IShellFolder2_QueryInterface (iface, &IID_IDropTarget,
                                           (LPVOID *) &pObj);
     }
     else if ((IsEqualIID(riid,&IID_IShellLinkW) ||
@@ -844,7 +844,7 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDetailsOf (IShellFolder2 *iface,
     switch (iColumn)
     {
         case 0:        /* name */
-            hr = IShellFolder_GetDisplayNameOf (iface, pidl,
+            hr = IShellFolder2_GetDisplayNameOf (iface, pidl,
                        SHGDN_NORMAL | SHGDN_INFOLDER, &psd->str);
             break;
         case 1:        /* type */
@@ -912,7 +912,7 @@ static HRESULT WINAPI IMCFldr_PersistFolder2_QueryInterface (
 {
     IMyComputerFolderImpl *This = impl_from_IPersistFolder2(iface);
     TRACE ("(%p)\n", This);
-    return IUnknown_QueryInterface (&This->IShellFolder2_iface, iid, ppvObj);
+    return IShellFolder2_QueryInterface (&This->IShellFolder2_iface, iid, ppvObj);
 }
 
 /************************************************************************
@@ -922,7 +922,7 @@ static ULONG WINAPI IMCFldr_PersistFolder2_AddRef (IPersistFolder2 * iface)
 {
     IMyComputerFolderImpl *This = impl_from_IPersistFolder2(iface);
     TRACE ("(%p)->(count=%u)\n", This, This->ref);
-    return IUnknown_AddRef (&This->IShellFolder2_iface);
+    return IShellFolder2_AddRef (&This->IShellFolder2_iface);
 }
 
 /************************************************************************
@@ -932,7 +932,7 @@ static ULONG WINAPI IMCFldr_PersistFolder2_Release (IPersistFolder2 * iface)
 {
     IMyComputerFolderImpl *This = impl_from_IPersistFolder2(iface);
     TRACE ("(%p)->(count=%u)\n", This, This->ref);
-    return IUnknown_Release (&This->IShellFolder2_iface);
+    return IShellFolder2_Release (&This->IShellFolder2_iface);
 }
 
 /************************************************************************
diff --git a/dlls/shell32/shfldr_netplaces.c b/dlls/shell32/shfldr_netplaces.c
index 39f748b..a75efef 100644
--- a/dlls/shell32/shfldr_netplaces.c
+++ b/dlls/shell32/shfldr_netplaces.c
@@ -449,7 +449,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetUIObjectOf (IShellFolder2 * iface,
     }
     else if (IsEqualIID (riid, &IID_IDropTarget) && (cidl >= 1))
     {
-        hr = IShellFolder_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
+        hr = IShellFolder2_QueryInterface (iface, &IID_IDropTarget, (LPVOID *) & pObj);
     }
     else
         hr = E_NOINTERFACE;
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index 3f9e57c..22a376c 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -1022,7 +1022,7 @@ static HRESULT WINAPI ShellFolder2_BindToObject(IShellFolder2* iface, LPCITEMIDL
 
     hr = CreateUnixFolder(NULL, &IID_IPersistFolder3, (void**)&persistFolder, clsidChild);
     if (FAILED(hr)) return hr;
-    hr = IPersistFolder_QueryInterface(persistFolder, riid, ppvOut);
+    hr = IPersistFolder3_QueryInterface(persistFolder, riid, ppvOut);
 
     if (SUCCEEDED(hr)) {
         UnixFolder *subfolder = impl_from_IPersistFolder3(persistFolder);
@@ -1097,7 +1097,7 @@ static HRESULT WINAPI ShellFolder2_CompareIDs(IShellFolder2* iface, LPARAM lPara
     else if (isEmpty2)
         return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (WORD)1);
     else if (SUCCEEDED(IShellFolder2_BindToObject(iface, firstpidl, NULL, &IID_IShellFolder, (void**)&psf))) {
-        hr = IShellFolder_CompareIDs(psf, lParam, pidl1, pidl2);
+        hr = IShellFolder2_CompareIDs(psf, lParam, pidl1, pidl2);
         IShellFolder2_Release(psf);
     }
 
@@ -1261,13 +1261,13 @@ static HRESULT WINAPI ShellFolder2_GetDisplayNameOf(IShellFolder2* iface,
             /* We are looking for the complete path to a file */
 
             /* Get the complete path for the current folder object */
-            hr = IShellFolder_GetDisplayNameOf(iface, (LPITEMIDLIST)&emptyIDL, uFlags, &str);
+            hr = IShellFolder2_GetDisplayNameOf(iface, (LPITEMIDLIST)&emptyIDL, uFlags, &str);
             if (SUCCEEDED(hr)) {
                 hr = StrRetToStrW(&str, NULL, &path);
                 if (SUCCEEDED(hr)) {
 
                     /* Get the child filename */
-                    hr = IShellFolder_GetDisplayNameOf(iface, pidl, SHGDN_FORPARSING | SHGDN_INFOLDER, &str);
+                    hr = IShellFolder2_GetDisplayNameOf(iface, pidl, SHGDN_FORPARSING | SHGDN_INFOLDER, &str);
                     if (SUCCEEDED(hr)) {
                         hr = StrRetToStrW(&str, NULL, &file);
                         if (SUCCEEDED(hr)) {
@@ -1297,7 +1297,7 @@ static HRESULT WINAPI ShellFolder2_GetDisplayNameOf(IShellFolder2* iface,
         } else {
             IShellFolder *pSubFolder;
 
-            hr = IShellFolder_BindToObject(iface, pidl, NULL, &IID_IShellFolder, (void**)&pSubFolder);
+            hr = IShellFolder2_BindToObject(iface, pidl, NULL, &IID_IShellFolder, (void**)&pSubFolder);
             if (SUCCEEDED(hr)) {
                 hr = IShellFolder_GetDisplayNameOf(pSubFolder, (LPITEMIDLIST)&emptyIDL, uFlags, lpName);
                 IShellFolder_Release(pSubFolder);
@@ -1307,7 +1307,7 @@ static HRESULT WINAPI ShellFolder2_GetDisplayNameOf(IShellFolder2* iface,
 
                 /* Might be a file, try binding to its parent */
                 ILRemoveLastID(pidl_parent);
-                hr = IShellFolder_BindToObject(iface, pidl_parent, NULL, &IID_IShellFolder, (void**)&pSubFolder);
+                hr = IShellFolder2_BindToObject(iface, pidl_parent, NULL, &IID_IShellFolder, (void**)&pSubFolder);
                 if (SUCCEEDED(hr)) {
                     hr = IShellFolder_GetDisplayNameOf(pSubFolder, pidl_child, uFlags, lpName);
                     IShellFolder_Release(pSubFolder);
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index f663f48..c4066b9 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -159,7 +159,7 @@ HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc,
     TRACE ("(%p, %p, %p, %s)\n", psf, pbc, pidlInOut ? *pidlInOut : NULL, debugstr_w (szNext));
 
     /* get the shellfolder for the child pidl and let it analyse further */
-    hr = IShellFolder_BindToObject (psf, *pidlInOut, pbc, &IID_IShellFolder, (LPVOID *) & psfChild);
+    hr = IShellFolder2_BindToObject (psf, *pidlInOut, pbc, &IID_IShellFolder, (LPVOID *) & psfChild);
 
     if (SUCCEEDED(hr)) {
 	hr = IShellFolder_ParseDisplayName (psfChild, hwndOwner, pbc, szNext, pEaten, &pidlOut, pdwAttributes);
@@ -350,17 +350,17 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
     if (pidlFirst) {
 	IShellFolder2 *psfChild;
 
-	hr = IShellFolder_BindToObject (psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID *) & psfChild);
+	hr = IShellFolder2_BindToObject (psf, pidlFirst, NULL, &IID_IShellFolder, (LPVOID *) & psfChild);
 	if (SUCCEEDED (hr)) {
 	    STRRET strTemp;
 	    LPITEMIDLIST pidlNext = ILGetNext (pidl);
 
-	    hr = IShellFolder_GetDisplayNameOf (psfChild, pidlNext, dwFlags, &strTemp);
+	    hr = IShellFolder2_GetDisplayNameOf (psfChild, pidlNext, dwFlags, &strTemp);
 	    if (SUCCEEDED (hr)) {
 		if(!StrRetToStrNW (szOut, dwOutLen, &strTemp, pidlNext))
                     hr = E_FAIL;
 	    }
-	    IShellFolder_Release (psfChild);
+	    IShellFolder2_Release (psfChild);
 	}
 	ILFree (pidlFirst);
     } else
-- 
1.5.6.5



More information about the wine-patches mailing list