[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.

svn path=/trunk/; revision=75127
This commit is contained in:
Giannis Adamopoulos 2017-06-19 14:27:51 +00:00
parent ee591f5b01
commit d19f4a3169
18 changed files with 103 additions and 145 deletions

View file

@ -112,7 +112,7 @@ GetExplorerRegValueSet(IN HKEY hKey,
*/
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);

View file

@ -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)
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv)
{
if (ghRShell)
{
PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(ghRShell, "CStartMenu_Constructor");
PSTARTMENU_CREATEINSTANCE func = (PSTARTMENU_CREATEINSTANCE)GetProcAddress(ghRShell, "CStartMenu_CreateInstance");
if (func)
{
return func(riid, ppv);

View file

@ -59,15 +59,7 @@ CreateStartMenu(IN ITrayWindow *Tray,
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;

View file

@ -56,11 +56,11 @@ 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);
}
DWORD WINAPI WinList_Init(void)
@ -226,19 +226,19 @@ public:
*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;
}

View file

@ -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);

View file

@ -75,8 +75,8 @@ HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv)
#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 @@ HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv)
if (hRShell)
{
PMERGEDFOLDER_CONSTRUCTOR pCMergedFolder_Constructor = (PMERGEDFOLDER_CONSTRUCTOR)
GetProcAddress(hRShell, "CMergedFolder_Constructor");
PMERGEDFOLDER_CREATEINSTANCE pCMergedFolder_CreateInstance = (PMERGEDFOLDER_CREATEINSTANCE)
GetProcAddress(hRShell, "CMergedFolder_CreateInstance");
if (pCMergedFolder_Constructor)
if (pCMergedFolder_CreateInstance)
{
return pCMergedFolder_Constructor(riid, ppv);
return pCMergedFolder_CreateInstance(riid, ppv);
}
}
#endif
@ -109,7 +109,7 @@ HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv)
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);

View file

@ -86,16 +86,6 @@ HRESULT GetDisplayName(LPCITEMIDLIST pidlDirectory,TCHAR *szDisplayName,UINT cch
return hr;
}
extern "C"
HRESULT WINAPI CExplorerBand_Constructor(REFIID riid, LPVOID *ppv)
{
#ifdef __REACTOS__
return ShellObjectCreator<CExplorerBand>(riid, ppv);
#else
return S_OK;
#endif
}
/*
This is a Windows hack, because shell event messages in Windows gives an
ill-formed PIDL stripped from useful data that parses incorrectly with SHGetFileInfo.

View file

@ -205,6 +205,3 @@ public:
// MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
END_MSG_MAP()
};
extern "C"
HRESULT WINAPI CExplorerBand_Constructor(REFIID riid, LPVOID *ppv);

View file

@ -831,7 +831,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *)
}
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);
}

View file

@ -223,7 +223,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteMenu::HandleMenuMsg2(UINT uMsg, WPARAM wParam
}
extern "C"
HRESULT WINAPI CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
HRESULT WINAPI RSHELL_CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
{
return ShellObjectCreator<CBandSiteMenu>(riid, ppv);
}

View file

@ -208,7 +208,7 @@ public:
*ppv = NULL;
if (pv != NULL)
return CLASS_E_NOAGGREGATION;
return CStartMenu_Constructor(riid, ppv);
return RSHELL_CStartMenu_CreateInstance(riid, ppv);
}
};
};

View file

@ -32,12 +32,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(CMenuBand);
#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),
m_SFToolbar(NULL),
@ -1056,25 +1050,11 @@ HRESULT CMenuBand::_OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RE
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 @@ HRESULT STDMETHODCALLTYPE CMenuBand::QueryStatus(const GUID *pguidCmdGroup, ULON
UNIMPLEMENTED;
return S_OK;
}
extern "C"
HRESULT WINAPI RSHELL_CMenuBand_CreateInstance(REFIID riid, LPVOID *ppv)
{
return ShellObjectCreator<CMenuBand>(riid, ppv);
}

View file

@ -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 @@ HRESULT CMenuDeskBar::_AdjustForTheme(BOOL bFlatStyle)
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);
}

View file

@ -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 @@ HRESULT STDMETHODCALLTYPE CMenuSite::OnFocusChangeIS(IUnknown *punkObj, BOOL fSe
{
return S_OK;
}
extern "C"
HRESULT WINAPI RSHELL_CMenuSite_CreateInstance(REFIID riid, LPVOID *ppv)
{
return ShellObjectCreator<CMenuSite>(riid, ppv);
}

View file

@ -1467,7 +1467,7 @@ HRESULT CMenuSFToolbar::InternalPopupItem(INT iItem, INT index, DWORD_PTR dwData
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;

View file

@ -383,12 +383,6 @@ HRESULT STDMETHODCALLTYPE CEnumMergedFolder::Clone(
//-----------------------------------------------------------------------------
// 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 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::BindToObject(
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 @@ HRESULT STDMETHODCALLTYPE CMergedFolder::QueryNameSpace2(ULONG, QUERYNAMESPACEIN
UNIMPLEMENTED;
return E_NOTIMPL;
}
extern "C"
HRESULT WINAPI RSHELL_CMergedFolder_CreateInstance(REFIID riid, LPVOID *ppv)
{
return ShellObjectCreator<CMergedFolder>(riid, ppv);
}

View file

@ -155,14 +155,7 @@ private:
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 @@ static HRESULT GetMergedFolder(int folder1, int folder2, IShellFolder ** ppsfSta
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 @@ static HRESULT GetProgramsFolder(IShellFolder ** ppsfStartMenu)
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 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
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
hr = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &pShellMenu));
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
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;
@ -476,6 +444,7 @@ CStartMenu_Constructor(REFIID riid, void **ppv)
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);

View file

@ -17,13 +17,6 @@
#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);
}