Author: gadamopoulos
Date: Sun Apr 16 19:29:27 2017
New Revision: 74329
URL:
http://svn.reactos.org/svn/reactos?rev=74329&view=rev
Log:
[EXPLORER] -If rshell is present and CBandSiteMenu_CreateInstance or
CBandSite_CreateInstance are exported, use them instead of using the one provided by the
system. Now we can start developing CBandSite and CBandSiteMenu on windows to implement
support for taskbar toolbars.
Modified:
trunk/reactos/base/shell/explorer/explorer.cpp
trunk/reactos/base/shell/explorer/precomp.h
trunk/reactos/base/shell/explorer/rshell.cpp
trunk/reactos/base/shell/explorer/tbsite.cpp
Modified: trunk/reactos/base/shell/explorer/explorer.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explor…
==============================================================================
--- trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] Sun Apr 16 19:29:27 2017
@@ -205,6 +205,8 @@
*/
SetProcessShutdownParameters(2, 0);
+ InitRSHELL();
+
#if !WIN7_COMPAT_MODE
BOOL CreateShellDesktop = FALSE;
Modified: trunk/reactos/base/shell/explorer/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precom…
==============================================================================
--- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Sun Apr 16 19:29:27 2017
@@ -108,11 +108,14 @@
* rshell.c
*/
+VOID InitRSHELL(VOID);
HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv);
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk);
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop);
DWORD WINAPI _WinList_Init(void);
void WINAPI _ShellDDEInit(BOOL bInit);
+HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv);
+HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv);
/*
* traywnd.c
Modified: trunk/reactos/base/shell/explorer/rshell.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/rshell…
==============================================================================
--- trunk/reactos/base/shell/explorer/rshell.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/rshell.cpp [iso-8859-1] Sun Apr 16 19:29:27 2017
@@ -20,20 +20,20 @@
#include "precomp.h"
-static HINSTANCE hRShell = NULL;
+static HINSTANCE ghRShell = NULL;
typedef HRESULT(WINAPI * PSTARTMENU_CONSTRUCTOR)(REFIID riid, void **ppv);
+VOID InitRSHELL(VOID)
+{
+ ghRShell = LoadLibraryW(L"rshell.dll");
+}
+
HRESULT WINAPI _CStartMenu_Constructor(REFIID riid, void **ppv)
{
- if (!hRShell)
- {
- hRShell = LoadLibraryW(L"rshell.dll");
- }
-
- if (hRShell)
- {
- PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(hRShell,
"CStartMenu_Constructor");
+ if (ghRShell)
+ {
+ PSTARTMENU_CONSTRUCTOR func = (PSTARTMENU_CONSTRUCTOR)GetProcAddress(ghRShell,
"CStartMenu_Constructor");
if (func)
{
return func(riid, ppv);
@@ -44,7 +44,7 @@
NULL,
CLSCTX_INPROC_SERVER,
riid,
- ppv);
+ ppv);
}
typedef HANDLE(WINAPI * PSHCREATEDESKTOP)(IShellDesktopTray *ShellDesk);
@@ -53,14 +53,9 @@
{
HINSTANCE hFallback;
- if (!hRShell)
- {
- hRShell = LoadLibraryW(L"rshell.dll");
- }
-
- if (hRShell)
- {
- PSHCREATEDESKTOP func = (PSHCREATEDESKTOP)GetProcAddress(hRShell,
"SHCreateDesktop");
+ if (ghRShell)
+ {
+ PSHCREATEDESKTOP func = (PSHCREATEDESKTOP)GetProcAddress(ghRShell,
"SHCreateDesktop");
if (func)
{
return func(ShellDesk);
@@ -87,14 +82,9 @@
{
HINSTANCE hFallback;
- if (!hRShell)
- {
- hRShell = LoadLibraryW(L"rshell.dll");
- }
-
- if (hRShell)
- {
- PSHDESKTOPMESSAGELOOP func = (PSHDESKTOPMESSAGELOOP)GetProcAddress(hRShell,
"SHDesktopMessageLoop");
+ if (ghRShell)
+ {
+ PSHDESKTOPMESSAGELOOP func = (PSHDESKTOPMESSAGELOOP)GetProcAddress(ghRShell,
"SHDesktopMessageLoop");
if (func)
{
return func(hDesktop);
@@ -121,14 +111,9 @@
{
HINSTANCE hFallback;
- if (!hRShell)
- {
- hRShell = LoadLibraryW(L"rshell.dll");
- }
-
- if (hRShell)
- {
- PWINLIST_INIT func = (PWINLIST_INIT)GetProcAddress(hRShell,
"WinList_Init");
+ if (ghRShell)
+ {
+ PWINLIST_INIT func = (PWINLIST_INIT)GetProcAddress(ghRShell,
"WinList_Init");
if (func)
{
return func();
@@ -155,14 +140,9 @@
{
HINSTANCE hFallback;
- if (!hRShell)
- {
- hRShell = LoadLibraryW(L"rshell.dll");
- }
-
- if (hRShell)
- {
- PSHELLDDEINIT func = (PSHELLDDEINIT)GetProcAddress(hRShell,
"ShellDDEInit");
+ if (ghRShell)
+ {
+ PSHELLDDEINIT func = (PSHELLDDEINIT)GetProcAddress(ghRShell,
"ShellDDEInit");
if (func)
{
func(bInit);
@@ -182,3 +162,42 @@
}
}
}
+
+typedef HRESULT (WINAPI *CBANDSITEMENU_CREATEINSTANCE)(REFIID riid, void **ppv);
+HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
+{
+ if (ghRShell)
+ {
+ CBANDSITEMENU_CREATEINSTANCE func =
(CBANDSITEMENU_CREATEINSTANCE)GetProcAddress(ghRShell,
"CBandSiteMenu_CreateInstance");
+ if (func)
+ {
+ return func(riid, ppv);
+ }
+ }
+
+ return CoCreateInstance(CLSID_BandSiteMenu,
+ NULL,
+ CLSCTX_INPROC_SERVER,
+ riid,
+ ppv);
+}
+
+typedef HRESULT (WINAPI *CBANDSITE_CREATEINSTANCE)(LPUNKNOWN pUnkOuter, REFIID riid, void
**ppv);
+HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
+{
+ if (ghRShell)
+ {
+ CBANDSITE_CREATEINSTANCE func =
(CBANDSITE_CREATEINSTANCE)GetProcAddress(ghRShell, "CBandSite_CreateInstance");
+ if (func)
+ {
+ return func(pUnkOuter, riid, ppv);
+ }
+ }
+
+ return CoCreateInstance(CLSID_RebarBandSite,
+ pUnkOuter,
+ CLSCTX_INPROC_SERVER,
+ riid,
+ ppv);
+}
+
Modified: trunk/reactos/base/shell/explorer/tbsite.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/tbsite…
==============================================================================
--- trunk/reactos/base/shell/explorer/tbsite.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/tbsite.cpp [iso-8859-1] Sun Apr 16 19:29:27 2017
@@ -285,26 +285,17 @@
IN UINT uFlags,
OUT IContextMenu **ppcm)
{
+ HRESULT hRet;
+
if (m_ContextMenu == NULL)
{
- HRESULT hRet;
- CComPtr<IShellService> pSs;
-
/* Cache the context menu so we don't need to CoCreateInstance all the
time... */
- hRet = CoCreateInstance(CLSID_BandSiteMenu, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IShellService, &pSs));
- TRACE("CoCreateInstance(CLSID_BandSiteMenu) for IShellService returned:
0x%x\n", hRet);
- if (!SUCCEEDED(hRet))
+ hRet = _CBandSiteMenu_CreateInstance(IID_PPV_ARG(IContextMenu,
&m_ContextMenu));
+ if (FAILED_UNEXPECTEDLY(hRet))
return hRet;
- hRet = pSs->SetOwner((IBandSite*)this);
- if (!SUCCEEDED(hRet))
- {
- return hRet;
- }
-
- hRet = pSs->QueryInterface(IID_PPV_ARG(IContextMenu,
&m_ContextMenu));
-
- if (!SUCCEEDED(hRet))
+ hRet = IUnknown_SetOwner(m_ContextMenu, (IBandSite*)this);
+ if (FAILED_UNEXPECTEDLY(hRet))
return hRet;
}
@@ -315,7 +306,11 @@
}
/* Add the menu items */
- return m_ContextMenu->QueryContextMenu(hmenu, indexMenu, idCmdFirst,
idCmdLast, uFlags);
+ hRet = m_ContextMenu->QueryContextMenu(hmenu, indexMenu, idCmdFirst,
idCmdLast, uFlags);
+ if (FAILED_UNEXPECTEDLY(hRet))
+ return hRet;
+
+ return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE Lock(IN BOOL bLock)
@@ -643,10 +638,7 @@
m_TaskBand = pTaskBand;
/* Create the RebarBandSite */
- hRet = CoCreateInstance(CLSID_RebarBandSite,
- static_cast<IBandSite*>(this),
- CLSCTX_INPROC_SERVER,
- IID_PPV_ARG(IUnknown, &m_Inner));
+ hRet = _CBandSite_CreateInstance(static_cast<IBandSite*>(this),
IID_PPV_ARG(IUnknown, &m_Inner));
if (FAILED_UNEXPECTEDLY(hRet))
return hRet;