Author: dquintana
Date: Mon Oct 20 21:09:55 2014
New Revision: 64854
URL:
http://svn.reactos.org/svn/reactos?rev=64854&view=rev
Log:
[RSHELL]
[SHELL32]
[BROWSEUI]
* Move undocshell.h to a shared location, and move some shared utility functions into it.
* Replace all the COM object constructor functions with generic equivalents.
* Fixes a big bunch of "problems" found by Coverity Scan, but I don't have
the list of CID at the moment.
Added:
branches/shell-experiments/include/reactos/undocshell.h
- copied, changed from r64853,
branches/shell-experiments/dll/win32/shell32/undocshell.h
Removed:
branches/shell-experiments/dll/win32/shell32/undocshell.h
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/dll/win32/browseui/addressband.cpp
branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp
branches/shell-experiments/dll/win32/browseui/bandproxy.cpp
branches/shell-experiments/dll/win32/browseui/basebar.cpp
branches/shell-experiments/dll/win32/browseui/basebarsite.cpp
branches/shell-experiments/dll/win32/browseui/brandband.cpp
branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
branches/shell-experiments/dll/win32/browseui/precomp.h
branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
branches/shell-experiments/dll/win32/browseui/toolsband.cpp
branches/shell-experiments/dll/win32/browseui/travellog.cpp
branches/shell-experiments/dll/win32/shell32/dataobject.cpp
branches/shell-experiments/dll/win32/shell32/enumidlist.cpp
branches/shell-experiments/dll/win32/shell32/extracticon.cpp
branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp
branches/shell-experiments/dll/win32/shell32/folders/cpanel.cpp
branches/shell-experiments/dll/win32/shell32/folders/desktop.cpp
branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp
branches/shell-experiments/dll/win32/shell32/folders/fs.cpp
branches/shell-experiments/dll/win32/shell32/folders/mycomp.cpp
branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp
branches/shell-experiments/dll/win32/shell32/folders/printers.cpp
branches/shell-experiments/dll/win32/shell32/folders/recyclebin.cpp
branches/shell-experiments/dll/win32/shell32/openwithmenu.cpp
branches/shell-experiments/dll/win32/shell32/precomp.h
branches/shell-experiments/dll/win32/shell32/shellole.cpp
branches/shell-experiments/dll/win32/shell32/shlview.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -35,27 +35,7 @@
extern "C"
HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv)
{
- HRESULT hr;
-#if USE_SYSTEM_MENUBAND
- hr = CoCreateInstance(CLSID_MenuBand,
- NULL,
- CLSCTX_INPROC_SERVER,
- riid, ppv);
-#else
- *ppv = NULL;
-
- CMenuBand * site = new CComObject<CMenuBand>();
-
- if (!site)
- return E_OUTOFMEMORY;
-
- hr = site->QueryInterface(riid, ppv);
-
- if (FAILED_UNEXPECTEDLY(hr))
- delete site;
-#endif
-
- return hr;
+ return ShellObjectCreator<CMenuBand>(riid, ppv);
}
CMenuBand::CMenuBand() :
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -30,27 +30,7 @@
extern "C"
HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv)
{
- HRESULT hr;
-#if USE_SYSTEM_MENUDESKBAR
- hr = CoCreateInstance(CLSID_MenuDeskBar,
- NULL,
- CLSCTX_INPROC_SERVER,
- riid, ppv);
-#else
- *ppv = NULL;
-
- CMenuDeskBar * deskbar = new CComObject<CMenuDeskBar>();
-
- if (!deskbar)
- return E_OUTOFMEMORY;
-
- hr = deskbar->QueryInterface(riid, ppv);
-
- if (FAILED_UNEXPECTEDLY(hr))
- delete deskbar;
-
-#endif
- return hr;
+ return ShellObjectCreator<CMenuDeskBar>(riid, ppv);
}
CMenuDeskBar::CMenuDeskBar() :
Modified: branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -28,27 +28,7 @@
extern "C"
HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv)
{
- HRESULT hr;
-#if USE_SYSTEM_MENUSITE
- hr = CoCreateInstance(CLSID_MenuBandSite,
- NULL,
- CLSCTX_INPROC_SERVER,
- riid, ppv);
-#else
- *ppv = NULL;
-
- CMenuSite * site = new CComObject<CMenuSite>();
-
- if (!site)
- return E_OUTOFMEMORY;
-
- hr = site->QueryInterface(riid, ppv);
-
- if (FAILED_UNEXPECTEDLY(hr))
- delete site;
-#endif
-
- return hr;
+ return ShellObjectCreator<CMenuSite>(riid, ppv);
}
CMenuSite::CMenuSite() :
Modified: branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -356,20 +356,7 @@
extern "C"
HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv)
{
- *ppv = NULL;
-
- CMergedFolder * fld = new CComObject<CMergedFolder>();
-
- if (!fld)
- return E_OUTOFMEMORY;
-
- HRESULT hr;
-
- hr = fld->QueryInterface(riid, ppv);
- if (FAILED_UNEXPECTEDLY(hr))
- delete fld;
-
- return hr;
+ return ShellObjectCreator<CMergedFolder>(riid, ppv);
}
CMergedFolder::CMergedFolder() :
Modified: branches/shell-experiments/base/shell/rshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -53,6 +53,8 @@
#include <atlbase.h>
#include <atlcom.h>
+#include <undocshell.h>
+
#include <wine/debug.h>
#if _MSC_VER
@@ -73,115 +75,3 @@
extern "C" HRESULT WINAPI CMenuBand_Wrapper(IShellMenu * sm, REFIID riid,
LPVOID *ppv);
extern "C" HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv);
extern "C" HRESULT WINAPI CStartMenuSite_Wrapper(ITrayPriv * trayPriv, REFIID
riid, LPVOID *ppv);
-
-static __inline ULONG
-Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
-{
- char szMsg[512];
- char *szMsgStart;
- const char *fname;
- va_list vl;
- ULONG uRet;
-
- fname = strrchr(filename, '\\');
- if (fname == NULL)
- {
- fname = strrchr(filename, '/');
- }
-
- if (fname == NULL)
- fname = filename;
- else
- fname++;
-
- szMsgStart = szMsg + sprintf(szMsg, "[%10lu] %s:%d: ", GetTickCount(),
fname, line);
-
- va_start(vl, lpFormat);
- uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl);
- va_end(vl);
-
- OutputDebugStringA(szMsg);
-
- return uRet;
-}
-
-#define DbgPrint(fmt, ...) \
- Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
-
-#if 1
-#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (DbgPrint("Unexpected failure
%08x.\n", hr), TRUE))
-#else
-#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
-#endif
-
-
-template <class Base>
-class CComDebugObject : public Base
-{
-public:
- CComDebugObject(void * = NULL)
- {
- _pAtlModule->Lock();
- }
-
- virtual ~CComDebugObject()
- {
- this->FinalRelease();
- _pAtlModule->Unlock();
- }
-
- STDMETHOD_(ULONG, AddRef)()
- {
- int rc = this->InternalAddRef();
- DbgPrint("RefCount is now %d(++)!\n", rc);
- return rc;
- }
-
- STDMETHOD_(ULONG, Release)()
- {
- ULONG newRefCount;
-
- newRefCount = this->InternalRelease();
- DbgPrint("RefCount is now %d(--)!\n", newRefCount);
- if (newRefCount == 0)
- delete this;
- return newRefCount;
- }
-
- STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
- {
- return this->_InternalQueryInterface(iid, ppvObject);
- }
-
- static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
- {
- CComDebugObject<Base> *newInstance;
- HRESULT hResult;
-
- ATLASSERT(pp != NULL);
- if (pp == NULL)
- return E_POINTER;
-
- hResult = E_OUTOFMEMORY;
- newInstance = NULL;
- ATLTRY(newInstance = new CComDebugObject<Base>())
- if (newInstance != NULL)
- {
- newInstance->SetVoid(NULL);
- newInstance->InternalFinalConstructAddRef();
- hResult = newInstance->_AtlInitialConstruct();
- if (SUCCEEDED(hResult))
- hResult = newInstance->FinalConstruct();
- if (SUCCEEDED(hResult))
- hResult = newInstance->_AtlFinalConstruct();
- newInstance->InternalFinalConstructRelease();
- if (hResult != S_OK)
- {
- delete newInstance;
- newInstance = NULL;
- }
- }
- *pp = newInstance;
- return hResult;
- }
-};
Modified: branches/shell-experiments/dll/win32/browseui/addressband.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -668,20 +668,5 @@
HRESULT CreateAddressBand(REFIID riid, void **ppv)
{
- CAddressBand *theMenuBar;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theMenuBar = new CComObject<CAddressBand>);
- if (theMenuBar == NULL)
- return E_OUTOFMEMORY;
- hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theMenuBar;
- return hResult;
- }
- return S_OK;
-}
+ return ShellObjectCreator<CAddressBand>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/addresseditbox.cpp [iso-8859-1] Mon Oct
20 21:09:55 2014
@@ -283,20 +283,5 @@
HRESULT CreateAddressEditBox(REFIID riid, void **ppv)
{
- CComObject<CAddressEditBox> *theMenuBar;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theMenuBar = new CComObject<CAddressEditBox>);
- if (theMenuBar == NULL)
- return E_OUTOFMEMORY;
- hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theMenuBar;
- return hResult;
- }
- return S_OK;
-}
+ return ShellObjectCreator<CAddressEditBox>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/browseui/bandproxy.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/bandproxy.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/bandproxy.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -133,20 +133,5 @@
HRESULT CreateBandProxy(REFIID riid, void **ppv)
{
- CComObject<CBandProxy> *theBandProxy;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theBandProxy = new CComObject<CBandProxy>);
- if (theBandProxy == NULL)
- return E_OUTOFMEMORY;
- hResult = theBandProxy->QueryInterface(riid, reinterpret_cast<void
**>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theBandProxy;
- return hResult;
- }
- return S_OK;
+ return ShellObjectCreator<CBandProxy>(riid, ppv);
}
Modified: branches/shell-experiments/dll/win32/browseui/basebar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/basebar.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/basebar.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -514,20 +514,5 @@
HRESULT CreateBaseBar(REFIID riid, void **ppv)
{
- CComObject<CBaseBar> *theBaseBar;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theBaseBar = new CComObject<CBaseBar>);
- if (theBaseBar == NULL)
- return E_OUTOFMEMORY;
- hResult = theBaseBar->QueryInterface (riid, reinterpret_cast<void
**>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theBaseBar;
- return hResult;
- }
- return S_OK;
-}
+ return ShellObjectCreator<CBaseBar>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/browseui/basebarsite.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/basebarsite.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/basebarsite.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -477,20 +477,5 @@
HRESULT CreateBaseBarSite(REFIID riid, void **ppv)
{
- CComObject<CBaseBarSite> *theBaseBarSite;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theBaseBarSite = new CComObject<CBaseBarSite>);
- if (theBaseBarSite == NULL)
- return E_OUTOFMEMORY;
- hResult = theBaseBarSite->QueryInterface(riid, reinterpret_cast<void
**>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theBaseBarSite;
- return hResult;
- }
- return S_OK;
-}
+ return ShellObjectCreator<CBaseBarSite>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/browseui/brandband.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/brandband.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/brandband.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -470,20 +470,5 @@
HRESULT CreateBrandBand(REFIID riid, void **ppv)
{
- CComObject<CBrandBand> *theMenuBar;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theMenuBar = new CComObject<CBrandBand>);
- if (theMenuBar == NULL)
- return E_OUTOFMEMORY;
- hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theMenuBar;
- return hResult;
- }
- return S_OK;
-}
+ return ShellObjectCreator<CBrandBand>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Mon Oct
20 21:09:55 2014
@@ -437,7 +437,11 @@
CComPtr<IShellFolder> psfCommonFavorites;
CComPtr<IAugmentedShellFolder> pasf;
- *ppsfFavorites = NULL;
+ if (ppsfFavorites)
+ *ppsfFavorites = NULL;
+
+ if (ppidl)
+ *ppidl = NULL;
hr = SHGetSpecialFolderLocation(NULL, CSIDL_FAVORITES, &pidlUserFavorites);
if (FAILED(hr))
@@ -498,6 +502,8 @@
hr = pasf->QueryInterface(IID_PPV_ARG(IShellFolder, ppsfFavorites));
pasf.Release();
+
+ // TODO: obtain the folder's PIDL
ILFree(pidlCommonFavorites);
ILFree(pidlUserFavorites);
@@ -578,7 +584,8 @@
return hResult;
hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey,
SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID);
- ILFree(favoritesPIDL);
+ if (favoritesPIDL)
+ ILFree(favoritesPIDL);
if (SUCCEEDED(hResult))
fFavoritesMenu.Attach(newMenu.Detach());
}
@@ -1989,20 +1996,5 @@
HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
{
- CInternetToolbar *theToolbar;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theToolbar = new CComObject<CInternetToolbar>);
- if (theToolbar == NULL)
- return E_OUTOFMEMORY;
- hResult = theToolbar->QueryInterface (riid, reinterpret_cast<void
**>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theToolbar;
- return hResult;
- }
- return S_OK;
-}
+ return ShellObjectCreator<CInternetToolbar>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/browseui/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/precomp.h [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -23,6 +23,7 @@
#include <exdispid.h>
#include <shlwapi.h>
#include <shlwapi_undoc.h>
+#include <undocshell.h>
#include <wine/debug.h>
#include "resource.h"
@@ -40,161 +41,6 @@
#include "regtreeoptions.h"
#include <stdio.h>
-static __inline ULONG
-Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
-{
- char szMsg[512];
- char *szMsgStart;
- const char *fname;
- va_list vl;
- ULONG uRet;
-
- fname = strrchr(filename, '\\');
- if (fname == NULL)
- {
- fname = strrchr(filename, '/');
- if (fname != NULL)
- fname++;
- }
- else
- fname++;
-
- if (fname == NULL)
- fname = filename;
-
- szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line);
-
- va_start(vl, lpFormat);
- uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl);
- va_end(vl);
-
- OutputDebugStringA(szMsg);
-
- return uRet;
-}
-
-#define DbgPrint(fmt, ...) \
- Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
-
-static void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
-{
- WCHAR label[128];
-
- padding[padlevel] = '.';
- padding[padlevel + 1] = '.';
- padding[padlevel + 2] = 0;
-
- int count = GetMenuItemCount(hmenu);
- for (int i = 0; i < count; i++)
- {
- MENUITEMINFOW mii = { 0 };
-
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU | MIIM_STATE | MIIM_ID;
- mii.dwTypeData = label;
- mii.cch = _countof(label);
-
- GetMenuItemInfo(hmenu, i, TRUE, &mii);
-
- if (mii.fType & MFT_BITMAP)
- DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n",
padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" :
"FALSE");
- else if (mii.fType & MFT_SEPARATOR)
- DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
- else
- DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding,
i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" :
"FALSE");
-
- if (mii.hSubMenu)
- DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
-
- }
-
- padding[padlevel] = 0;
-}
-
-static __inline void DbgDumpMenu(HMENU hmenu)
-{
- char padding[128];
- DbgDumpMenuInternal(hmenu, padding, 0);
-}
-
-#if 1
-#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (DbgPrint("Unexpected failure
%08x.\n", hr), TRUE))
-#else
-#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
-#endif
-
-
-template <class Base>
-class CComDebugObject : public Base
-{
-public:
- CComDebugObject(void * = NULL)
- {
- _pAtlModule->Lock();
- }
-
- virtual ~CComDebugObject()
- {
- this->FinalRelease();
- _pAtlModule->Unlock();
- }
-
- STDMETHOD_(ULONG, AddRef)()
- {
- int rc = this->InternalAddRef();
- DbgPrint("RefCount is now %d(++)!\n", rc);
- return rc;
- }
-
- STDMETHOD_(ULONG, Release)()
- {
- ULONG newRefCount;
-
- newRefCount = this->InternalRelease();
- DbgPrint("RefCount is now %d(--)!\n", newRefCount);
- if (newRefCount == 0)
- delete this;
- return newRefCount;
- }
-
- STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
- {
- return this->_InternalQueryInterface(iid, ppvObject);
- }
-
- static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
- {
- CComDebugObject<Base> *newInstance;
- HRESULT hResult;
-
- ATLASSERT(pp != NULL);
- if (pp == NULL)
- return E_POINTER;
-
- hResult = E_OUTOFMEMORY;
- newInstance = NULL;
- ATLTRY(newInstance = new CComDebugObject<Base>())
- if (newInstance != NULL)
- {
- newInstance->SetVoid(NULL);
- newInstance->InternalFinalConstructAddRef();
- hResult = newInstance->_AtlInitialConstruct();
- if (SUCCEEDED(hResult))
- hResult = newInstance->FinalConstruct();
- if (SUCCEEDED(hResult))
- hResult = newInstance->_AtlFinalConstruct();
- newInstance->InternalFinalConstructRelease();
- if (hResult != S_OK)
- {
- delete newInstance;
- newInstance = NULL;
- }
- }
- *pp = newInstance;
- return hResult;
- }
-};
-
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
#endif /* _BROWSEUI_PCH_ */
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -3431,15 +3431,11 @@
DispatchMessage(&Msg);
}
}
-
- //TerminateProcess(GetCurrentProcess(), hResult);
int nrc = theCabinet->Release();
if (nrc > 0)
{
- DbgPrint("WARNING: There are %d references to the CShellBrowser active or
leaked, process will never terminate. Terminating forcefully.\n", nrc);
-
- //TerminateProcess(GetCurrentProcess(), 1);
+ DbgPrint("WARNING: There are %d references to the CShellBrowser active or
leaked.\n", nrc);
}
theCabinet.Detach();
Modified: branches/shell-experiments/dll/win32/browseui/toolsband.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/toolsband.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/toolsband.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -313,15 +313,11 @@
BITMAP bitmapInfo;
GetObjectW(imgNormal, sizeof(bitmapInfo), &bitmapInfo);
HIMAGELIST himlNormal = ImageList_Create(bitmapInfo.bmHeight,
bitmapInfo.bmHeight, ILC_COLOR32, 4, 4);
-
ImageList_Add(himlNormal, imgNormal, NULL);
- DeleteObject(imgNormal);
GetObjectW(imgHot, sizeof(bitmapInfo), &bitmapInfo);
HIMAGELIST himlHot = ImageList_Create(bitmapInfo.bmHeight, bitmapInfo.bmHeight,
ILC_COLOR32, 4, 4);
-
ImageList_Add(himlHot, imgHot, NULL);
- DeleteObject(imgHot);
SendMessage(TB_SETIMAGELIST, 0, (LPARAM) himlNormal);
SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM) himlHot);
@@ -329,6 +325,11 @@
SendMessage(TB_ADDBUTTONSW, numShownButtons, (LPARAM)&tbButtonsAdd);
+ if (imgNormal)
+ DeleteObject(imgNormal);
+ if (imgHot)
+ DeleteObject(imgHot);
+
return hResult;
}
@@ -440,21 +441,6 @@
HRESULT CreateToolsBar(REFIID riid, void **ppv)
{
- CToolsBand *theToolbar;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY(theToolbar = new CComObject<CToolsBand>);
- if (theToolbar == NULL)
- return E_OUTOFMEMORY;
- hResult = theToolbar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theToolbar;
- return hResult;
- }
- return S_OK;
-}
-
+ return ShellObjectCreator<CToolsBand>(riid, ppv);
+}
+
Modified: branches/shell-experiments/dll/win32/browseui/travellog.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/travellog.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/travellog.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -621,23 +621,5 @@
HRESULT CreateTravelLog(REFIID riid, void **ppv)
{
- CComObject<CTravelLog> *theTravelLog;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theTravelLog = new CComObject<CTravelLog>);
- if (theTravelLog == NULL)
- return E_OUTOFMEMORY;
- hResult = theTravelLog->QueryInterface(riid, reinterpret_cast<void
**>(ppv));
- if (FAILED_UNEXPECTEDLY(hResult))
- {
- delete theTravelLog;
- return hResult;
- }
- hResult = theTravelLog->Initialize();
- if (FAILED_UNEXPECTEDLY(hResult))
- return hResult;
- return S_OK;
-}
+ return ShellObjectCreatorInit<CTravelLog>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/shell32/dataobject.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/dataobject.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/dataobject.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -127,30 +127,9 @@
return (*ppenum)->Skip(posFmt);
}
-HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC
**enumerator)
-{
- CComObject<IEnumFORMATETCImpl> *theEnumerator;
- CComPtr<IEnumFORMATETC> result;
- HRESULT hResult;
-
- if (enumerator == NULL)
- return E_POINTER;
- *enumerator = NULL;
- ATLTRY (theEnumerator = new CComObject<IEnumFORMATETCImpl>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface (IID_PPV_ARG(IEnumFORMATETC,
&result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize (cfmt, afmt);
- if (FAILED (hResult))
- return hResult;
- *enumerator = result.Detach ();
- TRACE("(%p)->(%u,%p)\n", *enumerator, cfmt, afmt);
- return S_OK;
+HRESULT IEnumFORMATETC_Constructor(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC
**ppFormat)
+{
+ return ShellObjectCreatorInit<IEnumFORMATETCImpl>(cfmt, afmt,
IID_IEnumFORMATETC, ppFormat);
}
@@ -416,28 +395,7 @@
*/
HRESULT IDataObject_Constructor(HWND hwndOwner, LPCITEMIDLIST pMyPidl, LPCITEMIDLIST *
apidl, UINT cidl, IDataObject **dataObject)
{
- CComObject<IDataObjectImpl> *theDataObject;
- CComPtr<IDataObject> result;
- HRESULT hResult;
-
- if (dataObject == NULL)
- return E_POINTER;
- *dataObject = NULL;
- ATLTRY (theDataObject = new CComObject<IDataObjectImpl>);
- if (theDataObject == NULL)
- return E_OUTOFMEMORY;
- hResult = theDataObject->QueryInterface(IID_PPV_ARG(IDataObject, &result));
- if (FAILED (hResult))
- {
- delete theDataObject;
- return hResult;
- }
- hResult = theDataObject->Initialize (hwndOwner, pMyPidl, apidl, cidl);
- if (FAILED (hResult))
- return hResult;
- *dataObject = result.Detach ();
- TRACE("(%p)->(apidl=%p cidl=%u)\n", *dataObject, apidl, cidl);
- return S_OK;
+ return ShellObjectCreatorInit<IDataObjectImpl>(hwndOwner, pMyPidl, apidl, cidl,
IID_IDataObject, dataObject);
}
/*************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/enumidlist.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/enumidlist.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/enumidlist.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -281,22 +281,5 @@
*/
HRESULT IEnumIDList_Constructor(IEnumIDList **enumerator)
{
- CComObject<IEnumIDListImpl> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- if (enumerator == NULL)
- return E_POINTER;
- *enumerator = NULL;
- ATLTRY (theEnumerator = new CComObject<IEnumIDListImpl>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- *enumerator = result.Detach ();
- return S_OK;
-}
+ return ShellObjectCreator<IEnumIDListImpl>(IID_IEnumIDList, enumerator);
+}
Modified: branches/shell-experiments/dll/win32/shell32/extracticon.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/extracticon.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/extracticon.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -337,22 +337,5 @@
HRESULT WINAPI SHCreateDefaultExtractIcon(REFIID riid, void **ppv)
{
- CComObject<IconExtraction> *theExtractor;
- CComPtr<IUnknown> result;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theExtractor = new CComObject<IconExtraction>);
- if (theExtractor == NULL)
- return E_OUTOFMEMORY;
- hResult = theExtractor->QueryInterface (riid, (void **)&result);
- if (FAILED (hResult))
- {
- delete theExtractor;
- return hResult;
- }
- *ppv = result.Detach ();
- return S_OK;
-}
+ return ShellObjectCreator<IconExtraction>(riid, ppv);
+}
Modified: branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/admintools.cpp [iso-8859-1] Mon
Oct 20 21:09:55 2014
@@ -136,32 +136,7 @@
*/
HRESULT WINAPI CAdminToolsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- CComObject<CDesktopFolderEnumY> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CDesktopFolderEnumY>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize (szTarget, dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach ();
-
- TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CDesktopFolderEnumY>(szTarget, dwFlags,
IID_IEnumIDList, ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/cpanel.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/cpanel.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/cpanel.cpp [iso-8859-1] Mon Oct
20 21:09:55 2014
@@ -371,37 +371,9 @@
/**************************************************************************
* CControlPanelFolder::EnumObjects
*/
-HRESULT WINAPI CControlPanelFolder::EnumObjects(
- HWND hwndOwner,
- DWORD dwFlags,
- LPENUMIDLIST *ppEnumIDList)
-{
- CComObject<CControlPanelEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CControlPanelEnum>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize (dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach ();
-
- TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+HRESULT WINAPI CControlPanelFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags,
LPENUMIDLIST *ppEnumIDList)
+{
+ return ShellObjectCreatorInit<CControlPanelEnum>(dwFlags, IID_IEnumIDList,
ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/desktop.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/desktop.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/desktop.cpp [iso-8859-1] Mon Oct
20 21:09:55 2014
@@ -421,41 +421,9 @@
/**************************************************************************
* CDesktopFolder::EnumObjects
*/
-HRESULT WINAPI CDesktopFolder::EnumObjects(
- HWND hwndOwner,
- DWORD dwFlags,
- LPENUMIDLIST *ppEnumIDList)
-{
- CComObject<CDesktopFolderEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
-
- ATLTRY (theEnumerator = new CComObject<CDesktopFolderEnum>);
-
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
-
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
-
- hResult = theEnumerator->Initialize (this, hwndOwner, dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach ();
-
- TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+HRESULT WINAPI CDesktopFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
+{
+ return ShellObjectCreatorInit<CDesktopFolderEnum>(this, hwndOwner, dwFlags,
IID_IEnumIDList, ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/fonts.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -219,32 +219,7 @@
*/
HRESULT WINAPI CFontsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- CComObject<CDesktopFolderEnumZ> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CDesktopFolderEnumZ>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize (dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach ();
-
- TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CDesktopFolderEnumZ>(dwFlags, IID_IEnumIDList,
ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/fs.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/fs.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/folders/fs.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -260,32 +260,7 @@
DWORD dwFlags,
LPENUMIDLIST *ppEnumIDList)
{
- CComObject<CFileSysEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CFileSysEnum>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED(hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize (sPathTarget, dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach();
-
- TRACE("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CFileSysEnum>(sPathTarget, dwFlags,
IID_IEnumIDList, ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/mycomp.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/mycomp.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/mycomp.cpp [iso-8859-1] Mon Oct
20 21:09:55 2014
@@ -252,36 +252,7 @@
*/
HRESULT WINAPI CDrivesFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- CComObject<CDrivesFolderEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
-
- *ppEnumIDList = NULL;
- ATLTRY(theEnumerator = new CComObject<CDrivesFolderEnum>);
-
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
-
- hResult = theEnumerator->QueryInterface(IID_IEnumIDList, (void **)&result);
- if (FAILED(hResult))
- {
- delete theEnumerator;
- return hResult;
- }
-
- hResult = theEnumerator->Initialize(hwndOwner, dwFlags);
- if (FAILED(hResult))
- return hResult;
- *ppEnumIDList = result.Detach();
-
- TRACE("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CDrivesFolderEnum>(hwndOwner, dwFlags,
IID_IEnumIDList, ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/mydocuments.cpp [iso-8859-1] Mon
Oct 20 21:09:55 2014
@@ -214,32 +214,7 @@
*/
HRESULT WINAPI CMyDocsFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- CComObject<CFileSysEnumX> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CFileSysEnumX>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_IEnumIDList, (void **)&result);
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize(dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach();
-
- TRACE("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CFileSysEnumX>(dwFlags, IID_IEnumIDList,
ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/printers.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/printers.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/printers.cpp [iso-8859-1] Mon Oct
20 21:09:55 2014
@@ -185,27 +185,7 @@
*/
static HRESULT WINAPI IEI_Printers_Constructor(LPCITEMIDLIST pidl, REFIID riid, IUnknown
**ppv)
{
- CComObject<CPrintersExtractIconW> *theExtractor;
- CComPtr<IUnknown> result;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theExtractor = new CComObject<CPrintersExtractIconW>);
- if (theExtractor == NULL)
- return E_OUTOFMEMORY;
- hResult = theExtractor->QueryInterface(riid, (void **)&result);
- if (FAILED (hResult))
- {
- delete theExtractor;
- return hResult;
- }
- hResult = theExtractor->Initialize(pidl);
- if (FAILED (hResult))
- return hResult;
- *ppv = result.Detach();
- return S_OK;
+ return ShellObjectCreatorInit<CPrintersExtractIconW>(pidl, riid, ppv);
}
/***********************************************************************
@@ -379,32 +359,7 @@
*/
HRESULT WINAPI CPrinterFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *
ppEnumIDList)
{
- CComObject<CPrintersEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CPrintersEnum>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize(hwndOwner, dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach();
-
- TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CPrintersEnum>(hwndOwner, dwFlags,
IID_IEnumIDList, ppEnumIDList);
}
/**************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/folders/recyclebin.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/folders/recyclebin.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/shell32/folders/recyclebin.cpp [iso-8859-1] Mon
Oct 20 21:09:55 2014
@@ -403,34 +403,6 @@
return E_NOTIMPL;
}
-static HRESULT WINAPI CRecycleBinItemContextMenuConstructor(REFIID riid, LPCITEMIDLIST
pidl, LPVOID *ppv)
-{
- CComObject<CRecycleBinItemContextMenu> *theMenu;
- CComPtr<IUnknown> result;
- HRESULT hResult;
-
- TRACE("%s\n", shdebugstr_guid(&riid));
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY(theMenu = new CComObject<CRecycleBinItemContextMenu>);
- if (theMenu == NULL)
- return E_OUTOFMEMORY;
- hResult = theMenu->QueryInterface(riid, (void **)&result);
- if (FAILED(hResult))
- {
- delete theMenu;
- return hResult;
- }
- hResult = theMenu->Initialize(pidl);
- if (FAILED(hResult))
- return hResult;
- *ppv = result.Detach();
- TRACE ("--(%p)\n", *ppv);
- return S_OK;
-}
-
/**************************************************************************
* registers clipboardformat once
*/
@@ -509,32 +481,7 @@
HRESULT WINAPI CRecycleBin::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST
*ppEnumIDList)
{
- CComObject<CRecycleBinEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner,
dwFlags, ppEnumIDList);
-
- if (ppEnumIDList == NULL)
- return E_POINTER;
- *ppEnumIDList = NULL;
- ATLTRY (theEnumerator = new CComObject<CRecycleBinEnum>);
- if (theEnumerator == NULL)
- return E_OUTOFMEMORY;
- hResult = theEnumerator->QueryInterface(IID_PPV_ARG(IEnumIDList, &result));
- if (FAILED (hResult))
- {
- delete theEnumerator;
- return hResult;
- }
- hResult = theEnumerator->Initialize(dwFlags);
- if (FAILED (hResult))
- return hResult;
- *ppEnumIDList = result.Detach();
-
- TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList);
-
- return S_OK;
+ return ShellObjectCreatorInit<CRecycleBinEnum>(dwFlags, IID_IEnumIDList,
ppEnumIDList);
}
HRESULT WINAPI CRecycleBin::BindToObject(PCUIDLIST_RELATIVE pidl, LPBC pbc, REFIID riid,
void **ppv)
@@ -617,12 +564,12 @@
if ((IsEqualIID (riid, IID_IContextMenu) || IsEqualIID(riid, IID_IContextMenu2))
&& (cidl >= 1))
{
- hr = CRecycleBinItemContextMenuConstructor(riid, apidl[0], (void **)&pObj);
+ hr = ShellObjectCreatorInit<CRecycleBinItemContextMenu>(apidl[0], riid,
&pObj);
}
else if (IsEqualIID (riid, IID_IDropTarget) && (cidl == 1))
{
IDropTarget * pDt = NULL;
- hr = this->QueryInterface(IID_PPV_ARG(IDropTarget, &pDt));
+ hr = QueryInterface(IID_PPV_ARG(IDropTarget, &pDt));
pObj = pDt;
}
else
Modified: branches/shell-experiments/dll/win32/shell32/openwithmenu.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/openwithmenu.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/openwithmenu.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -1376,7 +1376,6 @@
{
MSG msg;
HWND hwnd;
- COpenWithDialog *pDialog;
TRACE("SHOpenWithDialog hwndParent %p poainfo %p\n", hwndParent, poainfo);
@@ -1385,11 +1384,9 @@
if (poainfo->pcszClass == NULL && poainfo->pcszFile == NULL)
return E_FAIL;
- pDialog = new COpenWithDialog(poainfo);
- if (!pDialog)
- return E_OUTOFMEMORY;
-
- hwnd = CreateDialogParam(shell32_hInstance, MAKEINTRESOURCE(IDD_OPEN_WITH),
hwndParent, COpenWithDialog::DialogProc, (LPARAM)pDialog);
+ COpenWithDialog pDialog(poainfo);
+
+ hwnd = CreateDialogParam(shell32_hInstance, MAKEINTRESOURCE(IDD_OPEN_WITH),
hwndParent, COpenWithDialog::DialogProc, (LPARAM)&pDialog);
if (hwnd == NULL)
{
ERR("Failed to create dialog\n");
@@ -1407,7 +1404,5 @@
}
}
- delete pDialog;
-
return S_OK;
}
Modified: branches/shell-experiments/dll/win32/shell32/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/precomp.h [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -30,6 +30,7 @@
#include <atlbase.h>
#include <atlcom.h>
#include <powrprof.h>
+#include <undocshell.h>
//#include "base/shell/explorer-new/todo.h"
//#include "dlgs.h"
Modified: branches/shell-experiments/dll/win32/shell32/shellole.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/shellole.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/shellole.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -376,27 +376,7 @@
HRESULT IDefClF_fnConstructor(LPFNCREATEINSTANCE lpfnCI, PLONG pcRefDll, const IID
*riidInst, IClassFactory **theFactory)
{
- CComObject<IDefClFImpl> *theClassObject;
- CComPtr<IClassFactory> result;
- HRESULT hResult;
-
- if (theFactory == NULL)
- return E_POINTER;
- *theFactory = NULL;
- ATLTRY (theClassObject = new CComObject<IDefClFImpl>);
- if (theClassObject == NULL)
- return E_OUTOFMEMORY;
- hResult = theClassObject->QueryInterface (IID_PPV_ARG(IClassFactory,
&result));
- if (FAILED (hResult))
- {
- delete theClassObject;
- return hResult;
- }
- hResult = theClassObject->Initialize (lpfnCI, pcRefDll, riidInst);
- if (FAILED (hResult))
- return hResult;
- *theFactory = result.Detach ();
- return S_OK;
+ return ShellObjectCreatorInit<IDefClFImpl>(lpfnCI, pcRefDll, riidInst,
IID_IClassFactory, theFactory);
}
/******************************************************************************
Modified: branches/shell-experiments/dll/win32/shell32/shlview.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -2974,30 +2974,5 @@
*/
HRESULT WINAPI IShellView_Constructor(IShellFolder *pFolder, IShellView **newView)
{
- CComObject<CDefView> *theView;
- CComPtr<IShellView> result;
- HRESULT hResult;
-
- if (newView == NULL)
- return E_POINTER;
-
- *newView = NULL;
- ATLTRY (theView = new CComObject<CDefView>);
-
- if (theView == NULL)
- return E_OUTOFMEMORY;
-
- hResult = theView->QueryInterface(IID_PPV_ARG(IShellView, &result));
- if (FAILED (hResult))
- {
- delete theView;
- return hResult;
- }
-
- hResult = theView->Initialize (pFolder);
- if (FAILED (hResult))
- return hResult;
- *newView = result.Detach ();
-
- return S_OK;
-}
+ return ShellObjectCreatorInit<CDefView>(pFolder, IID_IShellView, newView);
+}
Removed: branches/shell-experiments/dll/win32/shell32/undocshell.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/undocshell.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/undocshell.h (removed)
@@ -1,536 +0,0 @@
-/*
- * Copyright 1999, 2000 Juergen Schmied
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifndef __WINE_UNDOCSHELL_H
-#define __WINE_UNDOCSHELL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* defined(__cplusplus) */
-
-/****************************************************************************
- * IDList Functions
- */
-BOOL WINAPI ILGetDisplayName(
- LPCITEMIDLIST pidl,
- LPVOID path);
-
-/* type parameter for ILGetDisplayNameEx() */
-#define ILGDN_FORPARSING 0
-#define ILGDN_NORMAL 1
-#define ILGDN_INFOLDER 2
-
-BOOL WINAPI ILGetDisplayNameEx(
- LPSHELLFOLDER psf,
- LPCITEMIDLIST pidl,
- LPVOID path,
- DWORD type);
-
-LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl);
-void WINAPI ILGlobalFree(LPITEMIDLIST pidl);
-LPITEMIDLIST WINAPI SHSimpleIDListFromPathA (LPCSTR lpszPath); //FIXME
-LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPCWSTR lpszPath);
-
-HRESULT WINAPI SHILCreateFromPathA (
- LPCSTR path,
- LPITEMIDLIST * ppidl,
- DWORD *attributes);
-
-HRESULT WINAPI SHILCreateFromPathW (
- LPCWSTR path,
- LPITEMIDLIST * ppidl,
- DWORD *attributes);
-
-/*
- string functions
-*/
-BOOL WINAPI StrRetToStrNA(LPSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
-BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
-
-
-/****************************************************************************
-* SHChangeNotifyRegister API
-*/
-#define SHCNRF_InterruptLevel 0x0001
-#define SHCNRF_ShellLevel 0x0002
-#define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with SHCNRF_InterruptLevel
*/
-#define SHCNRF_NewDelivery 0x8000 /* Messages use shared memory */
-
-
-/****************************************************************************
- * Shell Common Dialogs
- */
-
-/* RunFileDlg flags */
-#define RFF_NOBROWSE 0x01
-#define RFF_NODEFAULT 0x02
-#define RFF_CALCDIRECTORY 0x04
-#define RFF_NOLABEL 0x08
-#define RFF_NOSEPARATEMEM 0x20 /* NT only */
-
-#define DE_SAMEFILE 0x71
-
-/* RunFileFlg notification structure */
-typedef struct
-{
- NMHDR hdr;
- LPCSTR lpFile;
- LPCSTR lpDirectory;
- int nShow;
-} NM_RUNFILEDLG, * LPNM_RUNFILEDLG;
-
-/* RunFileDlg notification return values */
-#define RF_OK 0x00
-#define RF_CANCEL 0x01
-#define RF_RETRY 0x02
-
-void WINAPI RunFileDlg(
- HWND hwndOwner,
- HICON hIcon,
- LPCWSTR lpstrDirectory,
- LPCWSTR lpstrTitle,
- LPCWSTR lpstrDescription,
- UINT uFlags);
-
-void WINAPI ExitWindowsDialog(HWND hwndOwner);
-
-BOOL WINAPI SHFindComputer(
- LPCITEMIDLIST pidlRoot,
- LPCITEMIDLIST pidlSavedSearch);
-
-void WINAPI SHHandleDiskFull(HWND hwndOwner,
- UINT uDrive);
-
-int WINAPI SHOutOfMemoryMessageBox(
- HWND hwndOwner,
- LPCSTR lpCaption,
- UINT uType);
-
-DWORD WINAPI SHNetConnectionDialog(
- HWND hwndOwner,
- LPCWSTR lpstrRemoteName,
- DWORD dwType);
-
-/****************************************************************************
- * Cabinet Window Messages
- */
-
-#define CWM_SETPATH (WM_USER + 2)
-#define CWM_WANTIDLE (WM_USER + 3)
-#define CWM_GETSETCURRENTINFO (WM_USER + 4)
-#define CWM_SELECTITEM (WM_USER + 5)
-#define CWM_SELECTITEMSTR (WM_USER + 6)
-#define CWM_GETISHELLBROWSER (WM_USER + 7)
-#define CWM_TESTPATH (WM_USER + 9)
-#define CWM_STATECHANGE (WM_USER + 10)
-#define CWM_GETPATH (WM_USER + 12)
-
-/* CWM_TESTPATH types */
-#define CWTP_ISEQUAL 0
-#define CWTP_ISCHILD 1
-
-/* CWM_TESTPATH structure */
-typedef struct
-{
- DWORD dwType;
- ITEMIDLIST idl;
-} CWTESTPATHSTRUCT,* LPCWTESTPATHSTRUCT;
-
-/****************************************************************************
- * System Imagelist Routines
- */
-
-int WINAPI Shell_GetCachedImageIndexA(
- LPCSTR lpszFileName,
- int nIconIndex,
- UINT bSimulateDoc);
-
-BOOL WINAPI Shell_GetImageLists(
- HIMAGELIST *lphimlLarge,
- HIMAGELIST *lphimlSmall);
-
-HICON WINAPI SHGetFileIcon(
- DWORD dwReserved,
- LPCSTR lpszPath,
- DWORD dwFileAttributes,
- UINT uFlags);
-
-BOOL WINAPI FileIconInit(BOOL bFullInit);
-
-/****************************************************************************
- * File Menu Routines
- */
-/* FileMenu_Create nSelHeight constants */
-#define FM_DEFAULT_SELHEIGHT -1
-#define FM_FULL_SELHEIGHT 0
-
-/* FileMenu_Create flags */
-#define FMF_SMALL_ICONS 0x00
-#define FMF_LARGE_ICONS 0x08
-#define FMF_NO_COLUMN_BREAK 0x10
-
-HMENU WINAPI FileMenu_Create(
- COLORREF crBorderColor,
- int nBorderWidth,
- HBITMAP hBorderBmp,
- int nSelHeight,
- UINT uFlags);
-
-void WINAPI FileMenu_Destroy(HMENU hMenu);
-
-/* FileMenu_AppendItem constants */
-#define FM_SEPARATOR (LPCSTR)1
-#define FM_BLANK_ICON -1
-#define FM_DEFAULT_HEIGHT 0
-
-BOOL WINAPI FileMenu_AppendItem(
- HMENU hMenu,
- LPCSTR lpszText,
- UINT uID,
- int iIcon,
- HMENU hMenuPopup,
- int nItemHeight);
-
-/* FileMenu_InsertUsingPidl flags */
-#define FMF_NO_EMPTY_ITEM 0x01
-#define FMF_NO_PROGRAM_GROUPS 0x04
-
-/* FileMenu_InsertUsingPidl callback function */
-typedef void (CALLBACK *LPFNFMCALLBACK)(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST
pidlFile);
-
-int WINAPI FileMenu_InsertUsingPidl(
- HMENU hMenu,
- UINT uID,
- LPCITEMIDLIST pidl,
- UINT uFlags,
- UINT uEnumFlags,
- LPFNFMCALLBACK lpfnCallback);
-
-int WINAPI FileMenu_ReplaceUsingPidl(
- HMENU hMenu,
- UINT uID,
- LPCITEMIDLIST pidl,
- UINT uEnumFlags,
- LPFNFMCALLBACK lpfnCallback);
-
-void WINAPI FileMenu_Invalidate(HMENU hMenu);
-
-HMENU WINAPI FileMenu_FindSubMenuByPidl(
- HMENU hMenu,
- LPCITEMIDLIST pidl);
-
-BOOL WINAPI FileMenu_TrackPopupMenuEx(
- HMENU hMenu,
- UINT uFlags,
- int x,
- int y,
- HWND hWnd,
- LPTPMPARAMS lptpm);
-
-BOOL WINAPI FileMenu_GetLastSelectedItemPidls(
- UINT uReserved,
- LPCITEMIDLIST *ppidlFolder,
- LPCITEMIDLIST *ppidlItem);
-
-LRESULT WINAPI FileMenu_MeasureItem(
- HWND hWnd,
- LPMEASUREITEMSTRUCT lpmis);
-
-LRESULT WINAPI FileMenu_DrawItem(
- HWND hWnd,
- LPDRAWITEMSTRUCT lpdis);
-
-BOOL WINAPI FileMenu_InitMenuPopup(HMENU hMenu);
-
-void WINAPI FileMenu_AbortInitMenu(void);
-
-LRESULT WINAPI FileMenu_HandleMenuChar(
- HMENU hMenu,
- WPARAM wParam);
-
-BOOL WINAPI FileMenu_DeleteAllItems(HMENU hMenu);
-
-BOOL WINAPI FileMenu_DeleteItemByCmd(
- HMENU hMenu,
- UINT uID);
-
-BOOL WINAPI FileMenu_DeleteItemByIndex(
- HMENU hMenu,
- UINT uPos);
-
-BOOL WINAPI FileMenu_DeleteMenuItemByFirstID(
- HMENU hMenu,
- UINT uID);
-
-BOOL WINAPI FileMenu_DeleteSeparator(HMENU hMenu);
-
-BOOL WINAPI FileMenu_EnableItemByCmd(
- HMENU hMenu,
- UINT uID,
- BOOL bEnable);
-
-DWORD WINAPI FileMenu_GetItemExtent(
- HMENU hMenu,
- UINT uPos);
-
-int WINAPI FileMenu_AppendFilesForPidl(
- HMENU hMenu,
- LPCITEMIDLIST pidl,
- BOOL bAddSeparator);
-
-int WINAPI FileMenu_AddFilesForPidl(
- HMENU hMenu,
- UINT uReserved,
- UINT uID,
- LPCITEMIDLIST pidl,
- UINT uFlags,
- UINT uEnumFlags,
- LPFNFMCALLBACK lpfnCallback);
-
-/****************************************************************************
- * Drag And Drop Routines
- */
-
-HRESULT WINAPI SHRegisterDragDrop(
- HWND hWnd,
- LPDROPTARGET lpDropTarget);
-
-HRESULT WINAPI SHRevokeDragDrop(HWND hWnd);
-
-BOOL WINAPI DAD_DragEnter(HWND hWnd);
-
-BOOL WINAPI DAD_SetDragImageFromListView(
- HWND hWnd,
- POINT pt);
-
-BOOL WINAPI DAD_ShowDragImage(BOOL bShow);
-
-/****************************************************************************
- * Path Manipulation Routines
- */
-
-BOOL WINAPI PathAppendAW(LPVOID lpszPath1, LPCVOID lpszPath2);
-
-LPVOID WINAPI PathCombineAW(LPVOID szDest, LPCVOID lpszDir, LPCVOID lpszFile);
-
-LPVOID WINAPI PathAddBackslashAW(LPVOID path);
-
-LPVOID WINAPI PathBuildRootAW(LPVOID lpszPath, int drive);
-
-LPVOID WINAPI PathFindExtensionAW(LPCVOID path);
-
-LPVOID WINAPI PathFindFileNameAW(LPCVOID path);
-
-LPVOID WINAPI PathGetExtensionAW(LPCVOID lpszPath, DWORD void1, DWORD void2);
-
-LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath);
-
-BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath);
-
-void WINAPI PathRemoveBlanksAW(LPVOID lpszPath);
-
-VOID WINAPI PathQuoteSpacesAW(LPVOID path);
-
-void WINAPI PathUnquoteSpacesAW(LPVOID lpszPath);
-
-BOOL WINAPI PathIsUNCAW(LPCVOID lpszPath);
-
-BOOL WINAPI PathIsRelativeAW(LPCVOID lpszPath);
-
-BOOL WINAPI PathIsRootAW(LPCVOID x);
-
-BOOL WINAPI PathIsExeAW(LPCVOID lpszPath);
-
-BOOL WINAPI PathIsDirectoryAW(LPCVOID lpszPath);
-
-BOOL WINAPI PathFileExistsAW(LPCVOID lpszPath);
-
-BOOL WINAPI PathMatchSpecAW(LPVOID lpszPath, LPVOID lpszSpec);
-
-BOOL WINAPI PathMakeUniqueNameAW(
- LPVOID lpszBuffer,
- DWORD dwBuffSize,
- LPCVOID lpszShortName,
- LPCVOID lpszLongName,
- LPCVOID lpszPathName);
-
-BOOL WINAPI PathYetAnotherMakeUniqueName(
- LPWSTR lpszBuffer,
- LPCWSTR lpszPathName,
- LPCWSTR lpszShortName,
- LPCWSTR lpszLongName);
-
-BOOL WINAPI PathQualifyAW(LPCVOID path);
-
-
-/* PathResolve flags */
-#define PRF_CHECKEXISTANCE 0x01
-#define PRF_EXECUTABLE 0x02
-#define PRF_QUALIFYONPATH 0x04
-#define PRF_WINDOWS31 0x08
-
-BOOL WINAPI PathResolveAW(LPVOID lpszPath, LPCVOID *alpszPaths, DWORD dwFlags);
-
-VOID WINAPI PathSetDlgItemPathAW(HWND hDlg, int nIDDlgItem, LPCVOID lpszPath);
-
-/* PathProcessCommand flags */
-#define PPCF_QUOTEPATH 0x01 /* implies PPCF_INCLUDEARGS */
-#define PPCF_INCLUDEARGS 0x02
-//#define PPCF_NODIRECTORIES 0x10 move to shlobj
-#define PPCF_DONTRESOLVE 0x20
-#define PPCF_PATHISRELATIVE 0x40
-
-HRESULT WINAPI PathProcessCommandAW(LPCVOID lpszPath, LPVOID lpszBuff,
- DWORD dwBuffSize, DWORD dwFlags);
-
-void WINAPI PathStripPathAW(LPVOID lpszPath);
-
-BOOL WINAPI PathStripToRootAW(LPVOID lpszPath);
-
-void WINAPI PathRemoveArgsAW(LPVOID lpszPath);
-
-void WINAPI PathRemoveExtensionAW(LPVOID lpszPath);
-
-int WINAPI PathParseIconLocationAW(LPVOID lpszPath);
-
-BOOL WINAPI PathIsSameRootAW(LPCVOID lpszPath1, LPCVOID lpszPath2);
-
-BOOL WINAPI PathFindOnPathAW(LPVOID sFile, LPCVOID *sOtherDirs);
-
-/****************************************************************************
- * Shell Namespace Routines
- */
-
-/* Generic structure used by several messages */
-typedef struct
-{
- DWORD dwReserved;
- DWORD dwReserved2;
- LPCITEMIDLIST pidl;
- LPDWORD lpdwUser;
-} SFVCBINFO, * LPSFVCBINFO;
-typedef const SFVCBINFO * LPCSFVCBINFO;
-
-/* SFVCB_SELECTIONCHANGED structure */
-typedef struct
-{
- UINT uOldState;
- UINT uNewState;
- LPCITEMIDLIST pidl;
- LPDWORD lpdwUser;
-} SFVSELECTSTATE, * LPSFVSELECTSTATE;
-typedef const SFVSELECTSTATE * LPCSFVSELECTSTATE;
-
-/* SFVCB_COPYHOOKCALLBACK structure */
-typedef struct
-{
- HWND hwnd;
- UINT wFunc;
- UINT wFlags;
- LPCSTR pszSrcFile;
- DWORD dwSrcAttribs;
- LPCSTR pszDestFile;
- DWORD dwDestAttribs;
-} SFVCOPYHOOKINFO, * LPSFVCOPYHOOKINFO;
-typedef const SFVCOPYHOOKINFO * LPCSFVCOPYHOOKINFO;
-
-/* SFVCB_GETDETAILSOF structure */
-typedef struct
-{
- LPCITEMIDLIST pidl;
- int fmt;
- int cx;
- STRRET lpText;
-} SFVCOLUMNINFO, * LPSFVCOLUMNINFO;
-
-/****************************************************************************
- * Misc Stuff
- */
-
-/* SHWaitForFileToOpen flags */
-#define SHWFF_ADD 0x01
-#define SHWFF_REMOVE 0x02
-#define SHWFF_WAIT 0x04
-
-BOOL WINAPI SHWaitForFileToOpen(
- LPCITEMIDLIST pidl,
- DWORD dwFlags,
- DWORD dwTimeout);
-
-WORD WINAPI ArrangeWindows(
- HWND hwndParent,
- DWORD dwReserved,
- LPCRECT lpRect,
- WORD cKids,
- CONST HWND * lpKids);
-
-/* RegisterShellHook types */
-#define RSH_DEREGISTER 0
-#define RSH_REGISTER 1
-#define RSH_REGISTER_PROGMAN 2
-#define RSH_REGISTER_TASKMAN 3
-
-BOOL WINAPI RegisterShellHook(
- HWND hWnd,
- DWORD dwType);
-
-/* SHCreateDefClassObject callback function */
-typedef HRESULT (CALLBACK *LPFNCDCOCALLBACK)(
- LPUNKNOWN pUnkOuter,
- REFIID riidObject,
- LPVOID *ppvObject);
-
-HRESULT WINAPI SHCreateDefClassObject(
- REFIID riidFactory,
- LPVOID *ppvFactory,
- LPFNCDCOCALLBACK lpfnCallback,
- LPDWORD lpdwUsage,
- REFIID riidObject);
-
-void WINAPI SHFreeUnusedLibraries(void);
-
-/* SHCreateLinks flags */
-#define SHCLF_PREFIXNAME 0x01
-#define SHCLF_CREATEONDESKTOP 0x02
-
-HRESULT WINAPI SHCreateLinks(
- HWND hWnd,
- LPCSTR lpszDir,
- LPDATAOBJECT lpDataObject,
- UINT uFlags,
- LPITEMIDLIST *lppidlLinks);
-
-DWORD WINAPI CheckEscapesA(LPSTR string, DWORD len);
-DWORD WINAPI CheckEscapesW(LPWSTR string, DWORD len);
-
-/* policy functions */
-BOOL WINAPI SHInitRestricted(LPCVOID unused, LPCVOID inpRegKey);
-
-/* Shell Desktop functions */
-
-#define WM_GETISHELLBROWSER (WM_USER+7)
-
-BOOL WINAPI SHDesktopMessageLoop(HANDLE);
-
-#define CSIDL_FOLDER_MASK 0x00ff
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif /* defined(__cplusplus) */
-
-#endif /* __WINE_UNDOCSHELL_H */
Copied: branches/shell-experiments/include/reactos/undocshell.h (from r64853,
branches/shell-experiments/dll/win32/shell32/undocshell.h)
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/undocshell.h [iso-8859-1] (original)
+++ branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] Mon Oct 20
21:09:55 2014
@@ -529,8 +529,315 @@
#define CSIDL_FOLDER_MASK 0x00ff
+/* Utility functions */
+#include <stdio.h>
+
+static inline ULONG
+Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
+{
+ char szMsg[512];
+ char *szMsgStart;
+ const char *fname;
+ va_list vl;
+ ULONG uRet;
+
+ fname = strrchr(filename, '\\');
+ if (fname == NULL)
+ {
+ fname = strrchr(filename, '/');
+ if (fname != NULL)
+ fname++;
+ }
+ else
+ fname++;
+
+ if (fname == NULL)
+ fname = filename;
+
+ szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line);
+
+ va_start(vl, lpFormat);
+ uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl);
+ va_end(vl);
+
+ OutputDebugStringA(szMsg);
+
+ return uRet;
+}
+
+#define DbgPrint(fmt, ...) \
+ Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
+
+static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel)
+{
+ WCHAR label[128];
+
+ padding[padlevel] = '.';
+ padding[padlevel + 1] = '.';
+ padding[padlevel + 2] = 0;
+
+ int count = GetMenuItemCount(hmenu);
+ for (int i = 0; i < count; i++)
+ {
+ MENUITEMINFOW mii = { 0 };
+
+ mii.cbSize = sizeof(mii);
+ mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU | MIIM_STATE | MIIM_ID;
+ mii.dwTypeData = label;
+ mii.cch = _countof(label);
+
+ GetMenuItemInfo(hmenu, i, TRUE, &mii);
+
+ if (mii.fType & MFT_BITMAP)
+ DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n",
padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" :
"FALSE");
+ else if (mii.fType & MFT_SEPARATOR)
+ DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID);
+ else
+ DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding,
i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" :
"FALSE");
+
+ if (mii.hSubMenu)
+ DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2);
+
+ }
+
+ padding[padlevel] = 0;
+}
+
+static __inline void DbgDumpMenu(HMENU hmenu)
+{
+ char padding[128];
+ DbgDumpMenuInternal(hmenu, padding, 0);
+}
+
+#if 1
+#define FAILED_UNEXPECTEDLY(hr) (FAILED(hr) && (DbgPrint("Unexpected failure
%08x.\n", hr), TRUE))
+#else
+#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
+#endif
+
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */
+#ifdef __cplusplus
+template <class Base>
+class CComDebugObject : public Base
+{
+public:
+ CComDebugObject(void * = NULL)
+ {
+ _pAtlModule->Lock();
+ }
+
+ virtual ~CComDebugObject()
+ {
+ this->FinalRelease();
+ _pAtlModule->Unlock();
+ }
+
+ STDMETHOD_(ULONG, AddRef)()
+ {
+ int rc = this->InternalAddRef();
+ DbgPrint("RefCount is now %d(++)!\n", rc);
+ return rc;
+ }
+
+ STDMETHOD_(ULONG, Release)()
+ {
+ ULONG newRefCount;
+
+ newRefCount = this->InternalRelease();
+ DbgPrint("RefCount is now %d(--)!\n", newRefCount);
+ if (newRefCount == 0)
+ delete this;
+ return newRefCount;
+ }
+
+ STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
+ {
+ return this->_InternalQueryInterface(iid, ppvObject);
+ }
+
+ static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
+ {
+ CComDebugObject<Base> *newInstance;
+ HRESULT hResult;
+
+ ATLASSERT(pp != NULL);
+ if (pp == NULL)
+ return E_POINTER;
+
+ hResult = E_OUTOFMEMORY;
+ newInstance = NULL;
+ ATLTRY(newInstance = new CComDebugObject<Base>())
+ if (newInstance != NULL)
+ {
+ newInstance->SetVoid(NULL);
+ newInstance->InternalFinalConstructAddRef();
+ hResult = newInstance->_AtlInitialConstruct();
+ if (SUCCEEDED(hResult))
+ hResult = newInstance->FinalConstruct();
+ if (SUCCEEDED(hResult))
+ hResult = newInstance->_AtlFinalConstruct();
+ newInstance->InternalFinalConstructRelease();
+ if (hResult != S_OK)
+ {
+ delete newInstance;
+ newInstance = NULL;
+ }
+ }
+ *pp = newInstance;
+ return hResult;
+ }
+};
+
+template<class T, class R>
+HRESULT inline ShellObjectCreator(REFIID riid, R ** ppv)
+{
+ CComPtr<T> obj;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY(obj = new CComObject<T>);
+ if (obj.p == NULL)
+ return E_OUTOFMEMORY;
+ hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
+ if (FAILED(hResult))
+ return hResult;
+ return S_OK;
+}
+
+template<class T, class R>
+HRESULT inline ShellObjectCreatorInit(REFIID riid, R ** ppv)
+{
+ CComPtr<T> obj;
+ CComPtr<R> result;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY(obj = new CComObject<T>);
+ if (obj.p == NULL)
+ return E_OUTOFMEMORY;
+ hResult = obj->QueryInterface(riid, reinterpret_cast<void
**>(&result));
+ if (FAILED(hResult))
+ return hResult;
+
+ hResult = obj->Initialize();
+ if (FAILED(hResult))
+ return hResult;
+
+ *ppv = result.Detach();
+
+ return S_OK;
+}
+
+template<class T, class T1, class R>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, REFIID riid, R ** ppv)
+{
+ CComPtr<T> obj;
+ CComPtr<R> result;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY(obj = new CComObject<T>);
+ if (obj.p == NULL)
+ return E_OUTOFMEMORY;
+ hResult = obj->QueryInterface(riid, reinterpret_cast<void
**>(&result));
+ if (FAILED(hResult))
+ return hResult;
+
+ hResult = obj->Initialize(initArg1);
+ if (FAILED(hResult))
+ return hResult;
+
+ *ppv = result.Detach();
+
+ return S_OK;
+}
+
+template<class T, class T1, class T2, class R>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, REFIID riid, R ** ppv)
+{
+ CComPtr<T> obj;
+ CComPtr<R> result;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY(obj = new CComObject<T>);
+ if (obj.p == NULL)
+ return E_OUTOFMEMORY;
+ hResult = obj->QueryInterface(riid, reinterpret_cast<void
**>(&result));
+ if (FAILED(hResult))
+ return hResult;
+
+ hResult = obj->Initialize(initArg1, initArg2);
+ if (FAILED(hResult))
+ return hResult;
+
+ *ppv = result.Detach();
+
+ return S_OK;
+}
+
+template<class T, class T1, class T2, class T3, class R>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, REFIID riid,
R ** ppv)
+{
+ CComPtr<T> obj;
+ CComPtr<R> result;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY(obj = new CComObject<T>);
+ if (obj.p == NULL)
+ return E_OUTOFMEMORY;
+ hResult = obj->QueryInterface(riid, reinterpret_cast<void
**>(&result));
+ if (FAILED(hResult))
+ return hResult;
+
+ hResult = obj->Initialize(initArg1, initArg2, initArg3);
+ if (FAILED(hResult))
+ return hResult;
+
+ *ppv = result.Detach();
+
+ return S_OK;
+}
+
+template<class T, class T1, class T2, class T3, class T4, class R>
+HRESULT inline ShellObjectCreatorInit(T1 initArg1, T2 initArg2, T3 initArg3, T4 initArg4,
REFIID riid, R ** ppv)
+{
+ CComPtr<T> obj;
+ CComPtr<R> result;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY(obj = new CComObject<T>);
+ if (obj.p == NULL)
+ return E_OUTOFMEMORY;
+ hResult = obj->QueryInterface(riid, reinterpret_cast<void
**>(&result));
+ if (FAILED(hResult))
+ return hResult;
+
+ hResult = obj->Initialize(initArg1, initArg2, initArg3, initArg4);
+ if (FAILED(hResult))
+ return hResult;
+
+ *ppv = result.Detach();
+
+ return S_OK;
+}
+#endif /* __cplusplus */
+
#endif /* __WINE_UNDOCSHELL_H */