Author: gadamopoulos Date: Mon Jun 19 14:27:51 2017 New Revision: 75127 URL: http://svn.reactos.org/svn/reactos?rev=75127&view=rev Log: [SHELL32] -Rename constructors from Class_Creator to Class_CreateInstance. Prepend the ones that are exported from rshell with RSHELL_. The reasoning is that rshell will always use our code but whether or not internal classes will be used in shellmenu lib will be controlled by preprocessor definitions in shellmenu.h
[BROWSEUI] -Rename more constructors to use the _CreateInstance suffix. [RSHELL] - The functions that let rshell export some objects have the RSHELL_ postfix but they are not exported as such. [EXPLORER] - Rename _CStartMenu_Constructor to _CStartMenu_CreateInstance. Modified: trunk/reactos/base/shell/explorer/precomp.h trunk/reactos/base/shell/explorer/rshell.cpp trunk/reactos/base/shell/explorer/startmnu.cpp trunk/reactos/base/shell/rshell/misc.cpp trunk/reactos/base/shell/rshell/rshell.spec trunk/reactos/dll/win32/browseui/browseui.cpp trunk/reactos/dll/win32/browseui/explorerband.cpp trunk/reactos/dll/win32/browseui/explorerband.h trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp trunk/reactos/dll/win32/shell32/shell32.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h Modified: trunk/reactos/base/shell/explorer/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp.h?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -112,7 +112,7 @@ */ VOID InitRSHELL(VOID); -HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv); +HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv); HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk); BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop); DWORD WINAPI _WinList_Init(void); Modified: trunk/reactos/base/shell/explorer/rshell.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/rshell.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/rshell.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/rshell.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -22,18 +22,18 @@ static HINSTANCE ghRShell = NULL; -typedef HRESULT(WINAPI * PSTARTMENU_CONSTRUCTOR)(REFIID riid, void **ppv); +typedef HRESULT(WINAPI * PSTARTMENU_CREATEINSTANCE)(REFIID riid, void **ppv); VOID InitRSHELL(VOID) { ghRShell = LoadLibraryW(L"rshell.dll"); } -HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv) -{ - if (ghRShell) - { - PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(ghRShell, "CStartMenu_Constructor"); +HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv) +{ + if (ghRShell) + { + PSTARTMENU_CREATEINSTANCE func = (PSTARTMENU_CREATEINSTANCE)GetProcAddress(ghRShell, "CStartMenu_CreateInstance"); if (func) { return func(riid, ppv); Modified: trunk/reactos/base/shell/explorer/startmnu.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startmnu.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/startmnu.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/startmnu.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -59,15 +59,7 @@ if (FAILED_UNEXPECTEDLY(hr)) return NULL; -#if 0 - hr = CoCreateInstance(&CLSID_StartMenu, - NULL, - CLSCTX_INPROC_SERVER, - &IID_IMenuPopup, - (PVOID *)&pMp); -#else - hr = _CStartMenu_Constructor(IID_PPV_ARG(IMenuPopup, &pMp)); -#endif + hr = _CStartMenu_CreateInstance(IID_PPV_ARG(IMenuPopup, &pMp)); if (FAILED_UNEXPECTEDLY(hr)) return NULL; Modified: trunk/reactos/base/shell/rshell/misc.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/misc.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -56,11 +56,11 @@ { extern HINSTANCE shell32_hInstance; -HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); -HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv); +HRESULT WINAPI RSHELL_CMenuDeskBar_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CMenuSite_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CMenuBand_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CMergedFolder_CreateInstance(REFIID riid, LPVOID *ppv); } DWORD WINAPI WinList_Init(void) @@ -226,19 +226,19 @@ *ppvObject = NULL; if (IsEqualCLSID(m_Clsid, CLSID_StartMenu)) - return CStartMenu_Constructor(riid, ppvObject); + return RSHELL_CStartMenu_CreateInstance(riid, ppvObject); if (IsEqualCLSID(m_Clsid, CLSID_MenuDeskBar)) - return CMenuDeskBar_Constructor(riid, ppvObject); + return RSHELL_CMenuDeskBar_CreateInstance(riid, ppvObject); if (IsEqualCLSID(m_Clsid, CLSID_MenuBand)) - return CMenuBand_Constructor(riid, ppvObject); + return RSHELL_CMenuBand_CreateInstance(riid, ppvObject); if (IsEqualCLSID(m_Clsid, CLSID_MenuBandSite)) - return CMenuSite_Constructor(riid, ppvObject); + return RSHELL_CMenuSite_CreateInstance(riid, ppvObject); if (IsEqualCLSID(m_Clsid, CLSID_MergedFolder)) - return CMergedFolder_Constructor(riid, ppvObject); + return RSHELL_CMergedFolder_CreateInstance(riid, ppvObject); return E_NOINTERFACE; } Modified: trunk/reactos/base/shell/rshell/rshell.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/rshell.spec?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/base/shell/rshell/rshell.spec [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/rshell.spec [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -2,13 +2,13 @@ @ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllRegisterServer() @ stdcall -private DllUnregisterServer() -@ stdcall CStartMenu_Constructor(ptr ptr) -@ stdcall CMenuDeskBar_Constructor(ptr ptr); -@ stdcall CMenuSite_Constructor(ptr ptr); -@ stdcall CMenuBand_Constructor(ptr ptr); -@ stdcall CMergedFolder_Constructor(ptr ptr); -@ stdcall CBandSite_CreateInstance(ptr ptr ptr) -@ stdcall CBandSiteMenu_CreateInstance(ptr ptr) +@ stdcall CStartMenu_CreateInstance(ptr ptr) RSHELL_CStartMenu_CreateInstance +@ stdcall CMenuDeskBar_CreateInstance(ptr ptr) RSHELL_CMenuDeskBar_CreateInstance +@ stdcall CMenuSite_CreateInstance(ptr ptr) RSHELL_CMenuSite_CreateInstance +@ stdcall CMenuBand_CreateInstance(ptr ptr) RSHELL_CMenuBand_CreateInstance +@ stdcall CMergedFolder_CreateInstance(ptr ptr) RSHELL_CMergedFolder_CreateInstance +@ stdcall CBandSite_CreateInstance(ptr ptr ptr) RSHELL_CBandSite_CreateInstance +@ stdcall CBandSiteMenu_CreateInstance(ptr ptr) RSHELL_CBandSiteMenu_CreateInstance @ stdcall ShellDDEInit(long); @ stdcall SHCreateDesktop(ptr); @ stdcall SHDesktopMessageLoop(ptr); Modified: trunk/reactos/dll/win32/browseui/browseui.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseui.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/browseui/browseui.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/browseui.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -75,8 +75,8 @@ #endif } -typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv); -typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv); +typedef HRESULT(WINAPI * PMENUBAND_CREATEINSTANCE)(REFIID riid, void **ppv); +typedef HRESULT(WINAPI * PMERGEDFOLDER_CREATEINSTANCE)(REFIID riid, void **ppv); HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv) { @@ -87,12 +87,12 @@ if (hRShell) { - PMERGEDFOLDER_CONSTRUCTOR pCMergedFolder_Constructor = (PMERGEDFOLDER_CONSTRUCTOR) - GetProcAddress(hRShell, "CMergedFolder_Constructor"); - - if (pCMergedFolder_Constructor) + PMERGEDFOLDER_CREATEINSTANCE pCMergedFolder_CreateInstance = (PMERGEDFOLDER_CREATEINSTANCE) + GetProcAddress(hRShell, "CMergedFolder_CreateInstance"); + + if (pCMergedFolder_CreateInstance) { - return pCMergedFolder_Constructor(riid, ppv); + return pCMergedFolder_CreateInstance(riid, ppv); } } #endif @@ -109,7 +109,7 @@ if (hRShell) { - PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hRShell, "CMenuBand_Constructor"); + PMENUBAND_CREATEINSTANCE func = (PMENUBAND_CREATEINSTANCE) GetProcAddress(hRShell, "CMenuBand_CreateInstance"); if (func) { return func(iid , ppv); Modified: trunk/reactos/dll/win32/browseui/explorerband.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/explorerband.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/browseui/explorerband.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/explorerband.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -84,16 +84,6 @@ pShellFolder->Release(); } return hr; -} - -extern "C" -HRESULT WINAPI CExplorerBand_Constructor(REFIID riid, LPVOID *ppv) -{ -#ifdef __REACTOS__ - return ShellObjectCreator<CExplorerBand>(riid, ppv); -#else - return S_OK; -#endif } /* Modified: trunk/reactos/dll/win32/browseui/explorerband.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/explorerband.h?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/browseui/explorerband.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/explorerband.h [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -205,6 +205,3 @@ // MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus) END_MSG_MAP() }; - -extern "C" -HRESULT WINAPI CExplorerBand_Constructor(REFIID riid, LPVOID *ppv); Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -831,7 +831,7 @@ } extern "C" -HRESULT WINAPI CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv) +HRESULT WINAPI RSHELL_CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv) { return CBandSite::_CreatorClass::CreateInstance(pUnkOuter, riid, ppv); } Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -223,7 +223,7 @@ } extern "C" -HRESULT WINAPI CBandSiteMenu_CreateInstance(REFIID riid, void **ppv) +HRESULT WINAPI RSHELL_CBandSiteMenu_CreateInstance(REFIID riid, void **ppv) { return ShellObjectCreator<CBandSiteMenu>(riid, ppv); } Modified: trunk/reactos/dll/win32/shell32/shell32.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -208,7 +208,7 @@ *ppv = NULL; if (pv != NULL) return CLASS_E_NOAGGREGATION; - return CStartMenu_Constructor(riid, ppv); + return RSHELL_CStartMenu_CreateInstance(riid, ppv); } }; }; Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -31,12 +31,6 @@ #undef UNIMPLEMENTED #define UNIMPLEMENTED TRACE("%s is UNIMPLEMENTED!\n", __FUNCTION__) - -extern "C" -HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv) -{ - return ShellObjectCreator<CMenuBand>(riid, ppv); -} CMenuBand::CMenuBand() : m_staticToolbar(NULL), @@ -1056,25 +1050,11 @@ CComPtr<IDeskBar> pDeskBar; // Create the necessary objects -#if USE_SYSTEM_MENUSITE - hr = CoCreateInstance(CLSID_MenuBandSite, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IBandSite, &pBandSite)); -#else - hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite)); -#endif + hr = CMenuSite_CreateInstance(IID_PPV_ARG(IBandSite, &pBandSite)); if (FAILED_UNEXPECTEDLY(hr)) return hr; -#if USE_SYSTEM_MENUDESKBAR - hr = CoCreateInstance(CLSID_MenuDeskBar, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IDeskBar, &pDeskBar)); -#else - hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar)); -#endif + hr = CMenuDeskBar_CreateInstance(IID_PPV_ARG(IDeskBar, &pDeskBar)); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -1319,3 +1299,9 @@ UNIMPLEMENTED; return S_OK; } + +extern "C" +HRESULT WINAPI RSHELL_CMenuBand_CreateInstance(REFIID riid, LPVOID *ppv) +{ + return ShellObjectCreator<CMenuBand>(riid, ppv); +} Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuDeskBar.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -45,12 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuDeskBar); -extern "C" -HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv) -{ - return ShellObjectCreator<CMenuDeskBar>(riid, ppv); -} - CMenuDeskBar::CMenuDeskBar() : m_Client(NULL), m_ClientWindow(NULL), @@ -852,3 +846,9 @@ SHSetWindowBits(m_hWnd, GWL_STYLE, mask, style); return S_OK; } + +extern "C" +HRESULT WINAPI RSHELL_CMenuDeskBar_CreateInstance(REFIID riid, LPVOID *ppv) +{ + return ShellObjectCreator<CMenuDeskBar>(riid, ppv); +} Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuSite.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -25,12 +25,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(menusite); -extern "C" -HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv) -{ - return ShellObjectCreator<CMenuSite>(riid, ppv); -} - CMenuSite::CMenuSite() : m_DeskBarSite(NULL), m_BandObject(NULL), @@ -362,3 +356,9 @@ { return S_OK; } + +extern "C" +HRESULT WINAPI RSHELL_CMenuSite_CreateInstance(REFIID riid, LPVOID *ppv) +{ + return ShellObjectCreator<CMenuSite>(riid, ppv); +} Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuToolbars.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -1467,7 +1467,7 @@ if (!pidl) return E_FAIL; - hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &shellMenu)); + hr = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &shellMenu)); if (FAILED_UNEXPECTEDLY(hr)) return hr; Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMergedFolder.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -383,12 +383,6 @@ //----------------------------------------------------------------------------- // CMergedFolder -extern "C" -HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv) -{ - return ShellObjectCreator<CMergedFolder>(riid, ppv); -} - CMergedFolder::CMergedFolder() : m_UserLocal(NULL), m_AllUsers(NULL), @@ -546,7 +540,7 @@ return hr; CComPtr<IAugmentedShellFolder> pasf; - hr = CMergedFolder_Constructor(IID_PPV_ARG(IAugmentedShellFolder, &pasf)); + hr = CMergedFolder_CreateInstance(IID_PPV_ARG(IAugmentedShellFolder, &pasf)); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -814,3 +808,9 @@ UNIMPLEMENTED; return E_NOTIMPL; } + +extern "C" +HRESULT WINAPI RSHELL_CMergedFolder_CreateInstance(REFIID riid, LPVOID *ppv) +{ + return ShellObjectCreator<CMergedFolder>(riid, ppv); +} Modified: trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CStartMenu.cpp [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -155,14 +155,7 @@ int csidl = 0; IShellMenu *pShellMenu; -#if USE_SYSTEM_MENUBAND - hr = CoCreateInstance(CLSID_MenuBand, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellMenu, &pShellMenu)); -#else - hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu)); -#endif + hr = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &pShellMenu)); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -384,11 +377,7 @@ if (FAILED_UNEXPECTEDLY(hr)) return hr; -#if !USE_SYSTEM_MERGED_FOLDERS - hr = CMergedFolder_Constructor(IID_PPV_ARG(IAugmentedShellFolder, &pasf)); -#else - hr = CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IAugmentedShellFolder, &pasf)); -#endif + hr = CMergedFolder_CreateInstance(IID_PPV_ARG(IAugmentedShellFolder, &pasf)); if (FAILED_UNEXPECTEDLY(hr)) { *ppsfStartMenu = psfUserStartMenu.Detach(); @@ -426,7 +415,7 @@ extern "C" HRESULT WINAPI -CStartMenu_Constructor(REFIID riid, void **ppv) +RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv) { CComPtr<IShellMenu> pShellMenu; CComPtr<IBandSite> pBandSite; @@ -439,36 +428,15 @@ LPITEMIDLIST pidlPrograms; CComPtr<IShellFolder> psfPrograms; -#if USE_SYSTEM_MENUBAND - hr = CoCreateInstance(CLSID_MenuBand, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IShellMenu, &pShellMenu)); -#else - hr = CMenuBand_Constructor(IID_PPV_ARG(IShellMenu, &pShellMenu)); -#endif - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - -#if USE_SYSTEM_MENUSITE - hr = CoCreateInstance(CLSID_MenuBandSite, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IBandSite, &pBandSite)); -#else - hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite)); -#endif - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - -#if USE_SYSTEM_MENUDESKBAR - hr = CoCreateInstance(CLSID_MenuDeskBar, - NULL, - CLSCTX_INPROC_SERVER, - IID_PPV_ARG(IDeskBar, &pDeskBar)); -#else - hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar)); -#endif + hr = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &pShellMenu)); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + hr = CMenuSite_CreateInstance(IID_PPV_ARG(IBandSite, &pBandSite)); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + hr = CMenuDeskBar_CreateInstance(IID_PPV_ARG(IDeskBar, &pDeskBar)); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -476,6 +444,7 @@ hr = CComObject<CShellMenuCallback>::CreateInstance(&pCallback); if (FAILED_UNEXPECTEDLY(hr)) return hr; + pCallback->AddRef(); // CreateInstance returns object with 0 ref count */ pCallback->Initialize(pShellMenu, pBandSite, pDeskBar); Modified: trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h?rev=75127&r1=75126&r2=75127&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] Mon Jun 19 14:27:51 2017 @@ -16,13 +16,6 @@ #pragma warning(disable:4244) // possible loss of data #pragma warning(disable:4512) // assignment operator could not be gernerated #endif - -#define USE_SYSTEM_MENUDESKBAR 0 -#define USE_SYSTEM_MENUSITE 0 -#define USE_SYSTEM_MENUBAND 0 -#define USE_SYSTEM_MERGED_FOLDERS 0 - -#define MERGE_FOLDERS 1 #include <stdio.h> #include <tchar.h> @@ -69,14 +62,45 @@ #pragma warning(pop) #endif +#define USE_SYSTEM_MENUDESKBAR 0 +#define USE_SYSTEM_MENUSITE 0 +#define USE_SYSTEM_MENUBAND 0 +#define USE_SYSTEM_MERGED_FOLDERS 0 + +#define MERGE_FOLDERS 1 + +#if USE_SYSTEM_MENUDESKBAR +#define CMenuDeskBar_CreateInstance(riid, ppv) (CoCreateInstance(CLSID_MenuDeskBar, NULL, CLSCTX_INPROC_SERVER,riid, ppv)) +#else +#define CMenuDeskBar_CreateInstance RSHELL_CMenuDeskBar_CreateInstance +#endif + +#if USE_SYSTEM_MENUBAND +#define CMenuBand_CreateInstance(riid, ppv) (CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER,riid, ppv)) +#else +#define CMenuBand_CreateInstance RSHELL_CMenuBand_CreateInstance +#endif + +#if USE_SYSTEM_MENUSITE +#define CMenuSite_CreateInstance(riid, ppv) (CoCreateInstance(CLSID_MenuBandSite, NULL, CLSCTX_INPROC_SERVER,riid, ppv)) +#else +#define CMenuSite_CreateInstance RSHELL_CMenuSite_CreateInstance +#endif + +#if USE_SYSTEM_MERGED_FOLDERS +#define CMergedFolder_CreateInstance(riid, ppv) (CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER,riid, ppv)) +#else +#define CMergedFolder_CreateInstance RSHELL_CMergedFolder_CreateInstance +#endif + extern "C" { extern HINSTANCE shell32_hInstance; -HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); -HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CStartMenu_CreateInstance(REFIID riid, void **ppv); +HRESULT WINAPI RSHELL_CMenuDeskBar_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CMenuSite_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CMenuBand_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT WINAPI RSHELL_CMergedFolder_CreateInstance(REFIID riid, LPVOID *ppv); }