[BROWSEUI]
authorDavid Quintana <gigaherz@gmail.com>
Mon, 28 Apr 2014 15:29:38 +0000 (15:29 +0000)
committerDavid Quintana <gigaherz@gmail.com>
Mon, 28 Apr 2014 15:29:38 +0000 (15:29 +0000)
* Make use of the IID_PPV_ARG for typesafe interface return pointers, and a few other cosmetic changes.
CORE-7330

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

dll/win32/browseui/aclmulti.cpp
dll/win32/browseui/addressband.cpp
dll/win32/browseui/bandproxy.cpp
dll/win32/browseui/basebar.cpp
dll/win32/browseui/basebarsite.cpp
dll/win32/browseui/brandband.cpp
dll/win32/browseui/internettoolbar.cpp
dll/win32/browseui/shellbrowser.cpp
dll/win32/browseui/toolsband.cpp
dll/win32/browseui/travellog.cpp

index 7702439..765a089 100644 (file)
@@ -57,9 +57,9 @@ HRESULT STDMETHODCALLTYPE CACLMulti::Append(IUnknown *punk)
         CoTaskMemRealloc(fObjects, sizeof(fObjects[0]) * (fObjectCount + 1)));
     fObjects[fObjectCount].punk = punk;
     punk->AddRef();
-    if (FAILED(punk->QueryInterface(IID_IEnumString, reinterpret_cast<void **>(&fObjects[fObjectCount].pEnum))))
+    if (FAILED(punk->QueryInterface(IID_PPV_ARG(IEnumString, &fObjects[fObjectCount].pEnum))))
         fObjects[fObjectCount].pEnum = NULL;
-    if (FAILED(punk->QueryInterface(IID_IACList, reinterpret_cast<void **>(&fObjects[fObjectCount].pACL))))
+    if (FAILED(punk->QueryInterface(IID_PPV_ARG(IACList, &fObjects[fObjectCount].pACL))))
         fObjects[fObjectCount].pACL = NULL;
     fObjectCount++;
     return S_OK;
index 29f04b4..c33b983 100644 (file)
@@ -100,8 +100,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
     CComPtr<IShellService>                  shellService;
     CComPtr<IUnknown>                       offset34;
     HWND                                    parentWindow;
-    IOleWindow                              *oleWindow;
-    HWND                                    toolbar;
+    HWND                                    combobox;
     static const TBBUTTON                   buttonInfo[] = { {0, 1, TBSTATE_ENABLED, 0} };
     HIMAGELIST                              normalImagelist;
     HIMAGELIST                              hotImageList;
@@ -112,28 +111,24 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
     if (pUnkSite == NULL)
         return S_OK;
 
-    hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fSite));
+    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
     if (FAILED(hResult))
         return hResult;
 
     // get window handle of parent
     parentWindow = NULL;
-    hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
-    if (SUCCEEDED(hResult))
-    {
-        oleWindow->GetWindow(&parentWindow);
-        oleWindow->Release();
-    }
+    hResult = IUnknown_GetWindow(pUnkSite, &parentWindow);
+
     if (!::IsWindow(parentWindow))
         return E_FAIL;
 
     // create combo box ex
-    toolbar = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
+    combobox = CreateWindowEx(WS_EX_TOOLWINDOW, WC_COMBOBOXEXW, NULL, WS_CHILD | WS_VISIBLE |
                     WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY,
                     0, 0, 500, 250, parentWindow, (HMENU)0xa205, _AtlBaseModule.GetModuleInstance(), 0);
-    if (toolbar == NULL)
+    if (combobox == NULL)
         return E_FAIL;
-    SubclassWindow(toolbar);
+    SubclassWindow(combobox);
 
     SendMessage(CBEM_SETEXTENDEDSTYLE,
         CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT, CBES_EX_CASESENSITIVE | CBES_EX_NOSIZELIMIT);
@@ -142,17 +137,17 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
     fComboBox = reinterpret_cast<HWND>(SendMessage(CBEM_GETCOMBOCONTROL, 0, 0));
 #if 1
     hResult = CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER,
-        IID_IAddressEditBox, reinterpret_cast<void **>(&fAddressEditBox));
+        IID_PPV_ARG(IAddressEditBox, &fAddressEditBox));
     if (FAILED(hResult))
         return hResult;
 #else
     // instantiate new version
 #endif
 
-    hResult = fAddressEditBox->QueryInterface(IID_IShellService, reinterpret_cast<void **>(&shellService));
+    hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &shellService));
     if (FAILED(hResult))
         return hResult;
-    hResult = fAddressEditBox->Init(toolbar, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/ );
+    hResult = fAddressEditBox->Init(combobox, fEditControl, 8, pUnkSite /*(IAddressBand *)this*/);
     if (FAILED(hResult))
         return hResult;
     hResult = shellService->SetOwner(pUnkSite);
@@ -239,7 +234,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::QueryStatus(
     CComPtr<IOleCommandTarget>              oleCommandTarget;
     HRESULT                                 hResult;
 
-    hResult = fAddressEditBox->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+    hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
     if (FAILED(hResult))
         return hResult;
     return oleCommandTarget->QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
@@ -272,7 +267,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::UIActivateIO(BOOL fActivate, LPMSG lpMsg
 
     if (fActivate)
     {
-        hResult = fSite->QueryInterface(IID_IInputObjectSite, reinterpret_cast<void **>(&inputObjectSite));
+        hResult = fSite->QueryInterface(IID_PPV_ARG(IInputObjectSite, &inputObjectSite));
         if (FAILED(hResult))
             return hResult;
         hResult = inputObjectSite->OnFocusChangeIS(static_cast<IDeskBand *>(this), fActivate);
@@ -300,7 +295,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
             }
             break;
     }
-    hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
+    hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
     if (FAILED(hResult))
         return hResult;
     return winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
@@ -313,7 +308,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::IsWindowOwner(HWND hWnd)
 
     if (fAddressEditBox)
     {
-        hResult = fAddressEditBox->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
+        hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
         if (FAILED(hResult))
             return hResult;
         return winEventHandler->IsWindowOwner(hWnd);
@@ -326,7 +321,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::FileSysChange(long param8, long paramC)
     CComPtr<IAddressBand>                   addressBand;
     HRESULT                                 hResult;
 
-    hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
+    hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IAddressBand, &addressBand));
     if (FAILED(hResult))
         return hResult;
     return addressBand->FileSysChange(param8, paramC);
@@ -337,7 +332,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::Refresh(long param8)
     CComPtr<IAddressBand>                   addressBand;
     HRESULT                                 hResult;
 
-    hResult = fAddressEditBox->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
+    hResult = fAddressEditBox->QueryInterface(IID_PPV_ARG(IAddressBand, &addressBand));
     if (FAILED(hResult))
         return hResult;
     return addressBand->Refresh(param8);
index fbbfb33..c5563dc 100644 (file)
@@ -43,7 +43,7 @@ HRESULT CBandProxy::FindBrowserWindow(IUnknown **browser)
 
     if (browser == NULL)
         return E_POINTER;
-    hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return hResult;
     hResult = serviceProvider->QueryService(
@@ -98,15 +98,15 @@ HRESULT STDMETHODCALLTYPE CBandProxy::NavigateToPIDL(LPCITEMIDLIST pidl)
     hResult = FindBrowserWindow(&webBrowserUnknown);
     if (FAILED(hResult))
         return hResult;
-    hResult = webBrowserUnknown->QueryInterface(IID_IWebBrowserApp, reinterpret_cast<void **>(&webBrowser));
+    hResult = webBrowserUnknown->QueryInterface(IID_PPV_ARG(IWebBrowser2, &webBrowser));
     if (FAILED(hResult))
         return hResult;
     hResult = webBrowser->put_Visible(TRUE);
-    hResult = webBrowser->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = webBrowser->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (SUCCEEDED(hResult))
     {
         hResult = serviceProvider->QueryService(SID_STopLevelBrowser,
-            IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+            IID_PPV_ARG(IOleWindow, &oleWindow));
         if (SUCCEEDED(hResult))
         {
             hResult = oleWindow->GetWindow(&browserWindow);
index f6379b6..2ca63c6 100644 (file)
@@ -179,7 +179,7 @@ HRESULT CBaseBar::ReserveBorderSpace()
     RECT                                    neededBorderSpace;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&dockingWindowSite));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
     if (FAILED(hResult))
         return hResult;
     hResult = dockingWindowSite->GetBorderDW(static_cast<IDeskBar *>(this), &availableBorderSpace);
@@ -272,7 +272,7 @@ HRESULT STDMETHODCALLTYPE CBaseBar::QueryService(REFGUID guidService, REFIID rii
 
     if (fSite == NULL)
         return E_FAIL;
-    hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return hResult;
     // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
@@ -309,10 +309,10 @@ HRESULT STDMETHODCALLTYPE CBaseBar::SetClient(IUnknown *punkClient)
         fClient.Release();
     else
     {
-        hResult = punkClient->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&fClient));
+        hResult = punkClient->QueryInterface(IID_PPV_ARG(IUnknown, &fClient));
         if (FAILED(hResult))
             return hResult;
-        hResult = fSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+        hResult = fSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
         if (FAILED(hResult))
             return hResult;
         hResult = oleWindow->GetWindow(&ownerWindow);
@@ -471,7 +471,7 @@ LRESULT CBaseBar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
     result = 0;
     if (fClient.p != NULL)
     {
-        hResult = fClient->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
+        hResult = fClient->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
         if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
             hResult = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
     }
index 1c1a04a..77986c8 100644 (file)
@@ -170,19 +170,19 @@ HRESULT CBaseBarSite::InsertBar(IUnknown *newBar)
     DWORD                                   thisBandID;
     HRESULT                                 hResult;
 
-    hResult = newBar->QueryInterface(IID_IPersist, reinterpret_cast<void **>(&persist));
+    hResult = newBar->QueryInterface(IID_PPV_ARG(IPersist, &persist));
     if (FAILED(hResult))
         return hResult;
-    hResult = newBar->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&site));
+    hResult = newBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &site));
     if (FAILED(hResult))
         return hResult;
-    hResult = newBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+    hResult = newBar->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
     if (FAILED(hResult))
         return hResult;
-    hResult = newBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
+    hResult = newBar->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
     if (FAILED(hResult))
         return hResult;
-    hResult = newBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
+    hResult = newBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
     if (FAILED(hResult))
         return hResult;
     hResult = site->SetSite(static_cast<IOleWindow *>(this));
@@ -266,7 +266,7 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::QueryService(REFGUID guidService, REFIID
 
     if (fDeskBarSite == NULL)
         return E_FAIL;
-    hResult = fDeskBarSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fDeskBarSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return hResult;
     // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser
@@ -290,7 +290,7 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(
         notifyHeader = (NMHDR *)lParam;
         if (notifyHeader->hwndFrom == m_hWnd && notifyHeader->code == RBN_AUTOSIZE)
         {
-            hResult = fDeskBarSite->QueryInterface(IID_IDeskBar, reinterpret_cast<void **>(&deskBar));
+            hResult = fDeskBarSite->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
             GetClientRect(&newBounds);
             hResult = deskBar->OnPosRectChangeDB(&newBounds);
         }
@@ -298,7 +298,7 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(
     if (fCurrentActiveBar != NULL)
     {
         hResult = fCurrentActiveBar->fTheBar->QueryInterface(
-            IID_IWinEventHandler, reinterpret_cast<void **>(&winEventHandler));
+            IID_PPV_ARG(IWinEventHandler, &winEventHandler));
         if (SUCCEEDED(hResult) && winEventHandler.p != NULL)
             hResult = winEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
     }
@@ -325,10 +325,10 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::SetDeskBarSite(IUnknown *punkSite)
         fDeskBarSite.Release();
     else
     {
-        hResult = punkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+        hResult = punkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
         if (FAILED(hResult))
             return hResult;
-        hResult = punkSite->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&fDeskBarSite));
+        hResult = punkSite->QueryInterface(IID_PPV_ARG(IUnknown, &fDeskBarSite));
         if (FAILED(hResult))
             return hResult;
         hResult = oleWindow->GetWindow(&ownerWindow);
index 378d87e..d78a76c 100644 (file)
@@ -170,11 +170,11 @@ HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite)
     }
 
     // get window handle of parent
-    hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fSite));
+    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fSite));
     if (FAILED(hResult))
         return hResult;
     parentWindow = NULL;
-    hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
     if (SUCCEEDED(hResult))
         hResult = oleWindow->GetWindow(&parentWindow);
     if (!::IsWindow(parentWindow))
@@ -188,16 +188,16 @@ HRESULT STDMETHODCALLTYPE CBrandBand::SetSite(IUnknown* pUnkSite)
     SubclassWindow(hwnd);
 
     // take advice to watch events
-    hResult = pUnkSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (SUCCEEDED(hResult))
     {
         hResult = serviceProvider->QueryService(
-            SID_SBrandBand, IID_IProfferService, reinterpret_cast<void **>(&profferService));
+            SID_SBrandBand, IID_PPV_ARG(IProfferService, &profferService));
         if (SUCCEEDED(hResult))
             hResult = profferService->ProfferService(SID_SBrandBand,
                 static_cast<IServiceProvider *>(this), &fProfferCookie);
         hResult = serviceProvider->QueryService(SID_SShellBrowser,
-            IID_IBrowserService, reinterpret_cast<void **>(&browserService));
+            IID_PPV_ARG(IBrowserService, &browserService));
         if (SUCCEEDED(hResult))
             hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
     }
@@ -355,7 +355,7 @@ HRESULT STDMETHODCALLTYPE CBrandBand::QueryService(REFGUID guidService, REFIID r
 
     if (IsEqualIID(guidService, SID_SBrandBand))
         return this->QueryInterface(riid, ppvObject);
-    hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return hResult;
     return serviceProvider->QueryService(guidService, riid, ppvObject);
index c2ee979..79e7760 100644 (file)
@@ -161,13 +161,13 @@ HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser
     REBARBANDINFOW                          bandInfo;
     HRESULT                                 hResult;
 
-    hResult = containedBand->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&site));
+    hResult = containedBand->QueryInterface(IID_PPV_ARG(IObjectWithSite, &site));
     if (FAILED(hResult))
         return hResult;
-    hResult = containedBand->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+    hResult = containedBand->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
     if (FAILED(hResult))
         return hResult;
-    hResult = containedBand->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
+    hResult = containedBand->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
     if (FAILED(hResult))
         return hResult;
     fContainedBand = containedBand;
@@ -199,7 +199,7 @@ HRESULT CDockSite::GetRBBandInfo(REBARBANDINFOW &bandInfo)
     CComPtr<IDeskBand>                      deskBand;
     HRESULT                                 hResult;
 
-    hResult = fContainedBand->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(&deskBand));
+    hResult = fContainedBand->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
     if (FAILED(hResult))
         return hResult;
 
@@ -362,7 +362,7 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
     if (fFavoritesMenu.p == NULL)
     {
         // create favorites menu
-        hResult = psmd->punk->QueryInterface(IID_IShellMenu, reinterpret_cast<void **>(&parentMenu));
+        hResult = psmd->punk->QueryInterface(IID_PPV_ARG(IShellMenu, &parentMenu));
         if (FAILED(hResult))
             return hResult;
         hResult = parentMenu->GetMenu(&parentHMenu, &ownerWindow, NULL);
@@ -382,11 +382,11 @@ HRESULT STDMETHODCALLTYPE CMenuCallback::GetObject(LPSMDATA psmd, REFIID riid, v
         else
         {
             hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
-                IID_IShellMenu, reinterpret_cast<void **>(&newMenu));
+                IID_PPV_ARG(IShellMenu, &newMenu));
         }
 #else
         hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
-            IID_IShellMenu, reinterpret_cast<void **>(&newMenu));
+            IID_PPV_ARG(IShellMenu, &newMenu));
 #endif
         if (FAILED(hResult))
             return hResult;
@@ -521,7 +521,7 @@ HRESULT CInternetToolbar::ReserveBorderSpace()
     RECT                                    neededBorderSpace;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&dockingWindowSite));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite));
     if (FAILED(hResult))
         return hResult;
     hResult = dockingWindowSite->GetBorderDW(static_cast<IDockingWindow *>(this), &availableBorderSpace);
@@ -573,27 +573,27 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
     if (FAILED(hResult))
     {
         hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
-            IID_IShellMenu, reinterpret_cast<void **>(menuBar));
+            IID_PPV_ARG(IShellMenu, menuBar));
     }
 #else
     hResult = CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,
-        IID_IShellMenu, reinterpret_cast<void **>(menuBar));
+        IID_PPV_ARG(IShellMenu, menuBar));
 #endif
     if (FAILED(hResult))
         return hResult;
-    hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback, reinterpret_cast<void **>(&callback));
+    hResult = fMenuCallback.QueryInterface(IID_PPV_ARG(IShellMenuCallback, &callback));
     if (FAILED(hResult))
         return hResult;
     hResult = (*menuBar)->Initialize(callback, -1, ANCESTORDEFAULT, SMINIT_HORIZONTAL | SMINIT_TOPLEVEL);
     if (FAILED(hResult))
         return hResult;
-    hResult = fSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
     if (FAILED(hResult))
         return hResult;
     hResult = oleWindow->GetWindow(&ownerWindow);
     if (FAILED(hResult))
         return hResult;
-    hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&siteCommandTarget));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &siteCommandTarget));
     if (FAILED(hResult))
         return hResult;
     hResult = siteCommandTarget->Exec(&CGID_Explorer, 0x35, 0, NULL, &menuOut);
@@ -604,7 +604,7 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
     hResult = (*menuBar)->SetMenu((HMENU)V_INTREF(&menuOut), ownerWindow, SMSET_DONTOWN);
     if (FAILED(hResult))
         return hResult;
-    hResult = (*menuBar)->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+    hResult = (*menuBar)->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return hResult;
     hResult = commandTarget->Exec(&CGID_MenuBand, 3, 1, NULL, NULL);
@@ -619,7 +619,7 @@ HRESULT CInternetToolbar::CreateBrandBand(IUnknown **logoBar)
     HRESULT                                 hResult;
 
 #if 1
-    hResult = ::CreateBrandBand(IID_IUnknown, reinterpret_cast<void **>(logoBar));
+    hResult = ::CreateBrandBand(IID_PPV_ARG(IUnknown, logoBar));
 #else
     hResult = CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown,
         reinterpret_cast<void **>(logoBar));
@@ -633,7 +633,7 @@ HRESULT CInternetToolbar::CreateToolsBar(IUnknown **toolsBar)
 {
     HRESULT                                 hResult;
 
-    hResult = ::CreateToolsBar(IID_IUnknown, reinterpret_cast<void **>(toolsBar));
+    hResult = ::CreateToolsBar(IID_PPV_ARG(IUnknown, toolsBar));
     if (FAILED(hResult))
         return hResult;
     return S_OK;
@@ -645,14 +645,14 @@ HRESULT CInternetToolbar::CreateAddressBand(IUnknown **toolsBar)
     HRESULT                                 hResult;
 
 #if 1
-    hResult = ::CreateAddressBand(IID_IUnknown, reinterpret_cast<void **>(toolsBar));
+    hResult = ::CreateAddressBand(IID_PPV_ARG(IUnknown, toolsBar));
 #else
     hResult = CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown,
         reinterpret_cast<void **>(toolsBar));
 #endif
     if (FAILED(hResult))
         return hResult;
-    hResult = (*toolsBar)->QueryInterface(IID_IAddressBand, reinterpret_cast<void **>(&addressBand));
+    hResult = (*toolsBar)->QueryInterface(IID_PPV_ARG(IAddressBand, &addressBand));
     return S_OK;
 }
 
@@ -719,13 +719,13 @@ HRESULT CInternetToolbar::CreateAndInitBandProxy()
     CComPtr<IServiceProvider>               serviceProvider;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return hResult;
-    hResult = serviceProvider->QueryService(SID_IBandProxy, IID_IBandProxy, reinterpret_cast<void **>(&fBandProxy));
+    hResult = serviceProvider->QueryService(SID_IBandProxy, IID_PPV_ARG(IBandProxy, &fBandProxy));
     if (FAILED(hResult))
     {
-        hResult = CreateBandProxy(IID_IBandProxy, reinterpret_cast<void **>(&fBandProxy));
+        hResult = CreateBandProxy(IID_PPV_ARG(IBandProxy, &fBandProxy));
         if (FAILED(hResult))
             return hResult;
         hResult = fBandProxy->SetSite(fSite);
@@ -770,7 +770,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::ShowDW(BOOL fShow)
 
     // show the bar here
     hResult = ReserveBorderSpace();
-    hResult = fMenuBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
+    hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
     hResult = dockingWindow->ShowDW(fShow);
     return S_OK;
 }
@@ -832,7 +832,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
     AddDockItem(menuBar, ITBBID_MENUBAND,
         CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
 
-    hResult = menuBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&menuOleWindow));
+    hResult = menuBar->QueryInterface(IID_PPV_ARG(IOleWindow, &menuOleWindow));
     hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
     fMenuBar.Attach(menuBar.Detach());                  // transfer the ref count
 
@@ -850,7 +850,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
         return hResult;
     AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE | CDockSite::ITF_NEWBANDALWAYS);
     fControlsBar.Attach(toolsBar.Detach());             // transfer the ref count
-    hResult = fControlsBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&toolbarOleWindow));
+    hResult = fControlsBar->QueryInterface(IID_PPV_ARG(IOleWindow, &toolbarOleWindow));
     if (FAILED(hResult))
         return hResult;
     hResult = toolbarOleWindow->GetWindow(&fToolbarWindow);
@@ -862,7 +862,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::InitNew()
     if (FAILED(hResult))
         return hResult;
     AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS);
-    hResult = navigationBar->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&navigationOleWindow));
+    hResult = navigationBar->QueryInterface(IID_PPV_ARG(IOleWindow, &navigationOleWindow));
     hResult = navigationOleWindow->GetWindow(&fNavigationWindow);
     fNavigationBar.Attach(navigationBar.Detach());
 
@@ -1002,7 +1002,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetCommandTarget(IUnknown *theTarget
     HRESULT                                 hResult;
 
     fCommandTarget.Release();
-    hResult = theTarget->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&fCommandTarget));
+    hResult = theTarget->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &fCommandTarget));
     if (FAILED(hResult))
         return hResult;
     fCommandCategory = *category;
@@ -1109,7 +1109,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
     else
     {
         // get window handle of owner
-        hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+        hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
         if (FAILED(hResult))
             return hResult;
         hResult = oleWindow->GetWindow(&ownerWindow);
@@ -1135,9 +1135,9 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::SetSite(IUnknown *pUnkSite)
             return E_FAIL;
 
         // take advice to watch events
-        hResult = pUnkSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+        hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
         hResult = serviceProvider->QueryService(
-            SID_SShellBrowser, IID_IBrowserService, reinterpret_cast<void **>(&browserService));
+            SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
         hResult = AtlAdvise(browserService, static_cast<IDispatch *>(this), DIID_DWebBrowserEvents, &fAdviseCookie);
     }
     return S_OK;
@@ -1181,7 +1181,7 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::OnWinEvent(
 
     if (fMenuBar)
     {
-        hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
+        hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
         if (menuWinEventHandler->IsWindowOwner(hWnd))
         {
             return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam, lParam, theResult);
@@ -1212,9 +1212,9 @@ HRESULT STDMETHODCALLTYPE CInternetToolbar::QueryBand(DWORD dwBandID,
     if (ppstb == NULL)
         return E_POINTER;
     if (dwBandID == ITBBID_MENUBAND && fMenuBar.p != NULL)
-        return fMenuBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(ppstb));
+        return fMenuBar->QueryInterface(IID_PPV_ARG(IDeskBand, ppstb));
     //if (dwBandID == ITBBID_BRANDBAND && fLogoBar.p != NULL)
-    //    return fLogoBar->QueryInterface(IID_IDeskBand, reinterpret_cast<void **>(ppstb));
+    //    return fLogoBar->QueryInterface(IID_PPV_ARG(IDeskBand, ppstb));
     *ppstb = NULL;
     return E_FAIL;
 }
@@ -1250,11 +1250,11 @@ LRESULT CInternetToolbar::OnTravelBack(WORD wNotifyCode, WORD wID, HWND hWndCtl,
     CComPtr<IWebBrowser>                    webBrowser;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return 0;
     hResult = serviceProvider->QueryService(SID_SShellBrowser,
-        IID_IWebBrowser, reinterpret_cast<void **>(&webBrowser));
+        IID_PPV_ARG(IWebBrowser, &webBrowser));
     if (FAILED(hResult))
         return 0;
     hResult = webBrowser->GoBack();
@@ -1267,11 +1267,11 @@ LRESULT CInternetToolbar::OnTravelForward(WORD wNotifyCode, WORD wID, HWND hWndC
     CComPtr<IWebBrowser>                    webBrowser;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return 0;
     hResult = serviceProvider->QueryService(
-        SID_SShellBrowser, IID_IWebBrowser, reinterpret_cast<void **>(&webBrowser));
+        SID_SShellBrowser, IID_PPV_ARG(IWebBrowser, &webBrowser));
     if (FAILED(hResult))
         return 0;
     hResult = webBrowser->GoForward();
@@ -1283,7 +1283,7 @@ LRESULT CInternetToolbar::OnUpLevel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
     CComPtr<IOleCommandTarget>              oleCommandTarget;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
     if (FAILED(hResult))
         return hResult;
     hResult = oleCommandTarget->Exec(&CGID_ShellBrowser, IDM_GOTO_UPONELEVEL, 0, NULL, NULL);
@@ -1307,10 +1307,10 @@ LRESULT CInternetToolbar::OnSearch(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO
     commandInfo.nShow = SW_SHOWNORMAL;
 
     hResult = CoCreateInstance(CLSID_ShellSearchExt, NULL, CLSCTX_INPROC_SERVER,
-        IID_IContextMenu, reinterpret_cast<void **>(&contextMenu));
+        IID_PPV_ARG(IContextMenu, &contextMenu));
     if (FAILED(hResult))
         return 0;
-    hResult = contextMenu->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&objectWithSite));
+    hResult = contextMenu->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
     if (FAILED(hResult))
         return 0;
     hResult = objectWithSite->SetSite(fSite);
@@ -1326,7 +1326,7 @@ LRESULT CInternetToolbar::OnFolders(WORD wNotifyCode, WORD wID, HWND hWndCtl, BO
     CComPtr<IOleCommandTarget>              oleCommandTarget;
     HRESULT                                 hResult;
 
-    hResult = fSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+    hResult = fSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
     if (FAILED(hResult))
         return hResult;
     hResult = oleCommandTarget->Exec(&CGID_Explorer, 0x23, 0, NULL, NULL);
@@ -1372,12 +1372,12 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
     {
         case gBackCommandID:
             newMenu = CreatePopupMenu();
-            hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+            hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
             hResult = serviceProvider->QueryService(
-                SID_SShellBrowser, IID_IBrowserService, reinterpret_cast<void **>(&browserService));
+                SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
             hResult = browserService->GetTravelLog(&travelLog);
             hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_BACK);
-            hResult = browserService->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+            hResult = browserService->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
             commandInfo.cmdID = 0x1d;
             hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL);
             if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED &&
@@ -1402,12 +1402,12 @@ LRESULT CInternetToolbar::OnMenuDropDown(UINT idControl, NMHDR *pNMHDR, BOOL &bH
             break;
         case gForwardCommandID:
             newMenu = CreatePopupMenu();
-            hResult = fSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+            hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider));
             hResult = serviceProvider->QueryService(SID_SShellBrowser, IID_IBrowserService,
                 reinterpret_cast<void **>(&browserService));
             hResult = browserService->GetTravelLog(&travelLog);
             hResult = travelLog->InsertMenuEntries(browserService, newMenu, 0, 1, 9, TLMENUF_FORE);
-            hResult = browserService->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+            hResult = browserService->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &commandTarget));
             commandInfo.cmdID = 0x1d;
             hResult = commandTarget->QueryStatus(&CGID_Explorer, 1, &commandInfo, NULL);
             if ((commandInfo.cmdf & (OLECMDF_ENABLED | OLECMDF_LATCHED)) == OLECMDF_ENABLED &&
@@ -1564,7 +1564,7 @@ LRESULT CInternetToolbar::OnTipText(UINT idControl, NMHDR *pNMHDR, BOOL &bHandle
         if (nID == (UINT)gBackCommandID || nID == (UINT)gForwardCommandID)
         {
             // TODO: Should this call QueryService?
-            hResult = fSite->QueryInterface(IID_IBrowserService, reinterpret_cast<void **>(&browserService));
+            hResult = fSite->QueryInterface(IID_PPV_ARG(IBrowserService, &browserService));
             hResult = browserService->GetTravelLog(&travelLog);
             hResult = travelLog->GetToolTipText(browserService,
                 (nID == (UINT)gBackCommandID) ? TLOG_BACK : TLOG_FORE,
@@ -1594,7 +1594,7 @@ LRESULT CInternetToolbar::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
     if (fMenuBar)
     {
         CComPtr<IWinEventHandler> menuWinEventHandler;
-        hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
+        hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
         if (SUCCEEDED(hResult))
         {
             if (menuWinEventHandler->IsWindowOwner(target) == S_OK)
@@ -1608,7 +1608,7 @@ LRESULT CInternetToolbar::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
     if (fNavigationBar)
     {
         CComPtr<IWinEventHandler> menuWinEventHandler;
-        hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
+        hResult = fNavigationBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
         if (SUCCEEDED(hResult))
         {
             if (menuWinEventHandler->IsWindowOwner(target) == S_OK)
@@ -1632,7 +1632,7 @@ LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
     if (fMenuBar)
     {
         CComPtr<IWinEventHandler> menuWinEventHandler;
-        hResult = fMenuBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
+        hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
         if (SUCCEEDED(hResult))
         {
             if (menuWinEventHandler->IsWindowOwner(notifyHeader->hwndFrom) == S_OK)
@@ -1646,7 +1646,7 @@ LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
     if (fNavigationBar)
     {
         CComPtr<IWinEventHandler> menuWinEventHandler;
-        hResult = fNavigationBar->QueryInterface(IID_IWinEventHandler, reinterpret_cast<void **>(&menuWinEventHandler));
+        hResult = fNavigationBar->QueryInterface(IID_PPV_ARG(IWinEventHandler, &menuWinEventHandler));
         if (SUCCEEDED(hResult))
         {
             if (menuWinEventHandler->IsWindowOwner(notifyHeader->hwndFrom) == S_OK)
index f74b5c1..a7485c0 100644 (file)
@@ -203,7 +203,7 @@ HRESULT WINAPI SHBindToFolder(LPCITEMIDLIST path, IShellFolder **newFolder)
         desktop.p->AddRef ();
         return S_OK;
     }
-    return desktop->BindToObject (path, NULL, IID_IShellFolder, reinterpret_cast<void **>(newFolder));
+    return desktop->BindToObject (path, NULL, IID_PPV_ARG(IShellFolder, newFolder));
 }
 
 static const TCHAR szCabinetWndClass[] = TEXT("CabinetWClassX");
@@ -243,7 +243,7 @@ void CToolbarProxy::Initialize(HWND parent, IUnknown *explorerToolbar)
         SubclassWindow(myWindow);
         SetWindowPos(NULL, -32000, -32000, 0, 0, SWP_NOOWNERZORDER | SWP_NOZORDER);
         hResult = explorerToolbar->QueryInterface(
-            IID_IExplorerToolbar, reinterpret_cast<void **>(&fExplorerToolbar));
+            IID_PPV_ARG(IExplorerToolbar, &fExplorerToolbar));
     }
 }
 
@@ -754,19 +754,19 @@ HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
 
     // create interfaces
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
+        IID_PPV_ARG(IDockingWindow, &dockingWindow));
     if (FAILED(hResult))
         return hResult;
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IPersistStreamInit, reinterpret_cast<void **>(&persistStreamInit));
+        IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
     if (FAILED(hResult))
         return hResult;
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return hResult;
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IObjectWithSite, reinterpret_cast<void **>(&objectSite));
+        IID_PPV_ARG(IObjectWithSite, &objectSite));
     if (FAILED(hResult))
         return hResult;
 
@@ -952,7 +952,7 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
     }
 
     // create view object
-    hResult = newShellFolder->CreateViewObject(m_hWnd, IID_IShellView, reinterpret_cast<void **>(&newShellView));
+    hResult = newShellFolder->CreateViewObject(m_hWnd, IID_PPV_ARG(IShellView, &newShellView));
     if (FAILED(hResult))
         return hResult;
     previousView = fCurrentShellViewWindow;
@@ -964,7 +964,7 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
         ::SendMessage(fCurrentShellViewWindow, WM_SETREDRAW, 0, 0);
 
     // set site
-    hResult = newShellView->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&objectWithSite));
+    hResult = newShellView->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
     if (SUCCEEDED(hResult) && objectWithSite.p != NULL)
         hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
 
@@ -1009,7 +1009,7 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
 
     // get command target
     oleCommandTarget.Release();
-    hResult = newShellView->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+    hResult = newShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
 
     // no use
     saveCurrentShellView.Release();
@@ -1057,10 +1057,10 @@ HRESULT CShellBrowser::GetMenuBand(REFIID riid, void **shellMenu)
     if (fClientBars[BIInternetToolbar].clientBar.p == NULL)
         return E_FAIL;
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IServiceProvider, reinterpret_cast<void **>(&serviceProvider));
+        IID_PPV_ARG(IServiceProvider, &serviceProvider));
     if (FAILED(hResult))
         return hResult;
-    hResult = serviceProvider->QueryService(SID_IBandSite, IID_IBandSite, reinterpret_cast<void **>(&bandSite));
+    hResult = serviceProvider->QueryService(SID_IBandSite, IID_PPV_ARG(IBandSite, &bandSite));
     if (FAILED(hResult))
         return hResult;
     hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
@@ -1085,15 +1085,15 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
         cache = &fClientBars[BIHorizontalBaseBar].clientBar.p;
     if (*cache == NULL)
     {
-        hResult = CreateBaseBar(IID_IUnknown, reinterpret_cast<void **>(&newBaseBar));
+        hResult = CreateBaseBar(IID_PPV_ARG(IUnknown, &newBaseBar));
         if (FAILED(hResult))
             return hResult;
-        hResult = CreateBaseBarSite(IID_IUnknown, reinterpret_cast<void **>(&newBaseBarSite));
+        hResult = CreateBaseBarSite(IID_PPV_ARG(IUnknown, &newBaseBarSite));
         if (FAILED(hResult))
             return hResult;
 
         // tell the new base bar about the shell browser
-        hResult = newBaseBar->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&objectWithSite));
+        hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
         if (FAILED(hResult))
             return hResult;
         hResult = objectWithSite->SetSite(static_cast<IDropTarget *>(this));
@@ -1101,7 +1101,7 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
             return hResult;
 
         // tell the new base bar about the new base bar site
-        hResult = newBaseBar->QueryInterface(IID_IDeskBar, reinterpret_cast<void **>(&deskBar));
+        hResult = newBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
         if (FAILED(hResult))
             return hResult;
         hResult = deskBar->SetClient(newBaseBarSite);
@@ -1109,7 +1109,7 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
             return hResult;
 
         // tell the new base bar site about the new base bar
-        hResult = newBaseBarSite->QueryInterface(IID_IDeskBarClient, reinterpret_cast<void **>(&deskBarClient));
+        hResult = newBaseBarSite->QueryInterface(IID_PPV_ARG(IDeskBarClient, &deskBarClient));
         if (FAILED(hResult))
             return hResult;
         hResult = deskBarClient->SetDeskBarSite(newBaseBar);
@@ -1118,7 +1118,7 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, IUnknown **theBaseBar)
 
         *cache = newBaseBar.Detach();
     }
-    return (*cache)->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(theBaseBar));
+    return (*cache)->QueryInterface(IID_PPV_ARG(IUnknown, theBaseBar));
 }
 
 HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
@@ -1132,6 +1132,8 @@ HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
     VARIANT                                 vaIn;
     HRESULT                                 hResult;
 
+    __debugbreak();
+
     hResult = GetBaseBar(vertical, (IUnknown **)&theBaseBar);
     if (FAILED(hResult))
         return hResult;
@@ -1139,16 +1141,16 @@ HRESULT CShellBrowser::ShowBand(const CLSID &classID, bool vertical)
         reinterpret_cast<void **>(&newBand));
     if (FAILED(hResult))
         return hResult;
-    hResult = theBaseBar->QueryInterface(IID_IDeskBar, reinterpret_cast<void **>(&deskBar));
+    hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDeskBar, &deskBar));
     if (FAILED(hResult))
         return hResult;
     hResult = deskBar->GetClient(&baseBarSite);
     if (FAILED(hResult))
         return hResult;
-    hResult = theBaseBar->QueryInterface(IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
+    hResult = theBaseBar->QueryInterface(IID_PPV_ARG(IDockingWindow, &dockingWindow));
     if (FAILED(hResult))
         return hResult;
-    hResult = baseBarSite->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+    hResult = baseBarSite->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
     if (FAILED(hResult))
         return hResult;
     V_VT(&vaIn) = VT_UNKNOWN;
@@ -1205,12 +1207,12 @@ HRESULT CShellBrowser::DoFolderOptions()
 
     // create sheet object
     hResult = CoCreateInstance(CLSID_ShellFldSetExt, NULL, CLSCTX_INPROC_SERVER,
-        IID_IShellPropSheetExt, reinterpret_cast<void **>(&folderOptionsSheet));
+        IID_PPV_ARG(IShellPropSheetExt, &folderOptionsSheet));
     if (FAILED(hResult))
         return E_FAIL;
 
     // must set site in order for Apply to all Folders on Advanced page to be enabled
-    hResult = folderOptionsSheet->QueryInterface(IID_IObjectWithSite, reinterpret_cast<void **>(&objectWithSite));
+    hResult = folderOptionsSheet->QueryInterface(IID_PPV_ARG(IObjectWithSite, &objectWithSite));
     if (SUCCEEDED(hResult) && objectWithSite.p != NULL)
         hResult = objectWithSite->SetSite(static_cast<IDispatch *>(this));
     m_PropSheet.phpage = m_psp;
@@ -1263,7 +1265,7 @@ LRESULT CALLBACK CShellBrowser::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam,
     previousMessage = pThis->m_pCurrentMsg;
     pThis->m_pCurrentMsg = &msg;
 
-    hResult = pThis->GetMenuBand(IID_IMenuBand, reinterpret_cast<void **>(&menuBand));
+    hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
     if (SUCCEEDED(hResult) && menuBand.p != NULL)
     {
         hResult = menuBand->TranslateMenuMessage(&msg, &lResult);
@@ -1366,7 +1368,7 @@ HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arg
         {
             CComPtr<IDispatch>          theDispatch;
 
-            hResult = (*pp)->QueryInterface(IID_IDispatch, reinterpret_cast<void **>(&theDispatch));
+            hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
             hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
         }
         pp++;
@@ -1378,7 +1380,7 @@ HRESULT CShellBrowser::FireEvent(DISPID dispIdMember, int argCount, VARIANT *arg
         {
             CComPtr<IDispatch>          theDispatch;
 
-            hResult = (*pp)->QueryInterface(IID_IDispatch, reinterpret_cast<void **>(&theDispatch));
+            hResult = (*pp)->QueryInterface(IID_PPV_ARG(IDispatch, &theDispatch));
             hResult = theDispatch->Invoke(dispIdMember, GUID_NULL, 0, DISPATCH_METHOD, &params, NULL, NULL, NULL);
         }
         pp++;
@@ -1499,7 +1501,7 @@ void CShellBrowser::UpdateViewMenu(HMENU theMenu)
     commandList[4].cmdID = ITID_CUSTOMIZEENABLED;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
     if (SUCCEEDED(hResult))
         hResult = oleCommandTarget->QueryStatus(&CGID_PrivCITCommands, 5, commandList, NULL);
     if (FAILED(hResult))
@@ -1536,10 +1538,10 @@ bool IUnknownIsEqual(IUnknown *int1, IUnknown *int2)
         return true;
     if (int1 == NULL || int2 == NULL)
         return false;
-    hResult = int1->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&int1Retry));
+    hResult = int1->QueryInterface(IID_PPV_ARG(IUnknown, &int1Retry));
     if (FAILED(hResult))
         return false;
-    hResult = int2->QueryInterface(IID_IUnknown, reinterpret_cast<void **>(&int2Retry));
+    hResult = int2->QueryInterface(IID_PPV_ARG(IUnknown, &int2Retry));
     if (FAILED(hResult))
         return false;
     if (int1Retry == int2Retry)
@@ -1795,7 +1797,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SetMenuSB(HMENU hmenuShared, HOLEMENU h
 
     if (IsMenu(hmenuShared) == FALSE)
         return E_FAIL;
-    hResult = GetMenuBand(IID_IShellMenu, reinterpret_cast<void **>(&shellMenu));
+    hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
     if (FAILED(hResult))
         return hResult;
     hResult = shellMenu->SetMenu(hmenuShared, NULL, SMSET_DONTOWN);
@@ -2006,7 +2008,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::GetTravelLog(ITravelLog **pptl)
         *pptl = NULL;
     if (fTravelLog.p == NULL)
     {
-        hResult = CreateTravelLog(IID_ITravelLog, reinterpret_cast<void **>(&fTravelLog));
+        hResult = CreateTravelLog(IID_PPV_ARG(ITravelLog, &fTravelLog));
         if (FAILED(hResult))
             return hResult;
     }
@@ -2527,7 +2529,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::Refresh2(VARIANT *Level)
     CComPtr<IOleCommandTarget>              oleCommandTarget;
     HRESULT                                 hResult;
 
-    hResult = fCurrentShellView->QueryInterface(IID_IOleCommandTarget, reinterpret_cast<void **>(&oleCommandTarget));
+    hResult = fCurrentShellView->QueryInterface(IID_PPV_ARG(IOleCommandTarget, &oleCommandTarget));
     if (FAILED(hResult))
         return hResult;
     return oleCommandTarget->Exec(NULL, 22, 1, Level, NULL);
@@ -2905,7 +2907,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::LoadHistory(IStream *pStream, IBindCtx
         return E_FAIL;
     }
     hResult = CoCreateInstance(oldState.persistClass, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_INPROC_SERVER,
-        IID_IOleObject, reinterpret_cast<void **>(&viewHistoryObject));
+        IID_PPV_ARG(IOleObject, &viewHistoryObject));
     fHistoryObject = viewHistoryObject;
     fHistoryStream = pStream;
     fHistoryBindContext = pbc;
@@ -2926,7 +2928,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::SaveHistory(IStream *pStream)
     HRESULT                                 hResult;
 
     hResult = fCurrentShellView->GetItemObject(
-        SVGIO_BACKGROUND, IID_IPersistHistory, reinterpret_cast<void **>(&viewPersistHistory));
+        SVGIO_BACKGROUND, IID_PPV_ARG(IPersistHistory, &viewPersistHistory));
     memset(&newState, 0, sizeof(newState));
     newState.dwSize = sizeof(newState);
     newState.browseType = 2;
@@ -2985,7 +2987,7 @@ LRESULT CShellBrowser::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHa
             if (fClientBars[x].clientBar != NULL)
             {
                 hResult = fClientBars[x].clientBar->QueryInterface(
-                    IID_IDockingWindow, reinterpret_cast<void **>(&dockingWindow));
+                    IID_PPV_ARG(IDockingWindow, &dockingWindow));
                 if (SUCCEEDED(hResult) && dockingWindow != NULL)
                 {
                     hResult = dockingWindow->ResizeBorderDW(
@@ -3122,7 +3124,7 @@ LRESULT CShellBrowser::OnToggleToolbarLock(WORD wNotifyCode, WORD wID, HWND hWnd
     HRESULT                                 hResult;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return 0;
     hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_TOOLBARLOCKED, 0, NULL, NULL);
@@ -3135,7 +3137,7 @@ LRESULT CShellBrowser::OnToggleToolbarBandVisible(WORD wNotifyCode, WORD wID, HW
     HRESULT                                 hResult;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return 0;
     hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_TOOLBARBANDSHOWN, 0, NULL, NULL);
@@ -3148,7 +3150,7 @@ LRESULT CShellBrowser::OnToggleAddressBandVisible(WORD wNotifyCode, WORD wID, HW
     HRESULT                                 hResult;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return 0;
     hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_ADDRESSBANDSHOWN, 0, NULL, NULL);
@@ -3161,7 +3163,7 @@ LRESULT CShellBrowser::OnToggleLinksBandVisible(WORD wNotifyCode, WORD wID, HWND
     HRESULT                                 hResult;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return 0;
     hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_LINKSBANDSHOWN, 0, NULL, NULL);
@@ -3174,7 +3176,7 @@ LRESULT CShellBrowser::OnToggleTextLabels(WORD wNotifyCode, WORD wID, HWND hWndC
     HRESULT                                 hResult;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return 0;
     hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_TEXTLABELS, 0, NULL, NULL);
@@ -3187,7 +3189,7 @@ LRESULT CShellBrowser::OnToolbarCustomize(WORD wNotifyCode, WORD wID, HWND hWndC
     HRESULT                                 hResult;
 
     hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
-        IID_IOleCommandTarget, reinterpret_cast<void **>(&commandTarget));
+        IID_PPV_ARG(IOleCommandTarget, &commandTarget));
     if (FAILED(hResult))
         return 0;
     hResult = commandTarget->Exec(&CGID_PrivCITCommands, ITID_CUSTOMIZEENABLED, 0, NULL, NULL);
@@ -3246,7 +3248,7 @@ DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter)
     ATLTRY (theCabinet = new CComObject<CShellBrowser>);
     if (theCabinet == NULL)
         return E_OUTOFMEMORY;
-    hResult = theCabinet->QueryInterface(IID_IShellBrowser, reinterpret_cast<void **>(&shellBrowser));
+    hResult = theCabinet->QueryInterface(IID_PPV_ARG(IShellBrowser, &shellBrowser));
     if (FAILED(hResult))
     {
         delete theCabinet;
index 79f8998..f04815b 100644 (file)
@@ -246,11 +246,11 @@ HRESULT STDMETHODCALLTYPE CToolsBand::SetSite(IUnknown* pUnkSite)
         fDockSite->Release();
     if (pUnkSite == NULL)
         return S_OK;
-    hResult = pUnkSite->QueryInterface(IID_IDockingWindowSite, reinterpret_cast<void **>(&fDockSite));
+    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &fDockSite));
     if (FAILED(hResult))
         return hResult;
     parentWindow = NULL;
-    hResult = pUnkSite->QueryInterface(IID_IOleWindow, reinterpret_cast<void **>(&oleWindow));
+    hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
     if (SUCCEEDED(hResult))
     {
         oleWindow->GetWindow(&parentWindow);
index cc086ce..0bddc94 100644 (file)
@@ -142,7 +142,7 @@ HRESULT STDMETHODCALLTYPE CTravelEntry::Invoke(IUnknown *punk)
     CComPtr<IStream>                        globalStream;
     HRESULT                                 hResult;
 
-    hResult = punk->QueryInterface(IID_IPersistHistory, reinterpret_cast<void **>(&persistHistory));
+    hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory, &persistHistory));
     if (FAILED(hResult))
         return hResult;
     hResult = CreateStreamOnHGlobal(fPersistState, FALSE, &globalStream);
@@ -167,10 +167,10 @@ HRESULT STDMETHODCALLTYPE CTravelEntry::Update(IUnknown *punk, BOOL fIsLocalAnch
     fPIDL = NULL;
     GlobalFree(fPersistState);
     fPersistState = NULL;
-    hResult = punk->QueryInterface(IID_ITravelLogClient, reinterpret_cast<void **>(&travelLogClient));
+    hResult = punk->QueryInterface(IID_PPV_ARG(ITravelLogClient, &travelLogClient));
     if (FAILED(hResult))
         return hResult;
-    hResult = punk->QueryInterface(IID_IPersistHistory, reinterpret_cast<void **>(&persistHistory));
+    hResult = punk->QueryInterface(IID_PPV_ARG(IPersistHistory, &persistHistory));
     if (FAILED(hResult))
         return hResult;
     globalStorage = GlobalAlloc(GMEM_FIXED, 0);
@@ -364,7 +364,7 @@ HRESULT STDMETHODCALLTYPE CTravelLog::GetTravelEntry(IUnknown *punk, int iOffset
     hResult = FindRelativeEntry(iOffset, &destinationEntry);
     if (FAILED(hResult))
         return hResult;
-    return destinationEntry->QueryInterface(IID_ITravelEntry, reinterpret_cast<void **>(ppte));
+    return destinationEntry->QueryInterface(IID_PPV_ARG(ITravelEntry, ppte));
 }
 
 HRESULT STDMETHODCALLTYPE CTravelLog::FindTravelEntry(IUnknown *punk, LPCITEMIDLIST pidl, ITravelEntry **ppte)