2014-02-04 10:41:02 +00:00
|
|
|
/*
|
|
|
|
* ReactOS Explorer
|
|
|
|
*
|
|
|
|
* Copyright 2014 Giannis Adamopoulos
|
|
|
|
*
|
|
|
|
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
|
|
|
|
2017-04-16 19:29:27 +00:00
|
|
|
static HINSTANCE ghRShell = NULL;
|
2014-05-18 18:05:16 +00:00
|
|
|
|
2017-06-19 14:27:51 +00:00
|
|
|
typedef HRESULT(WINAPI * PSTARTMENU_CREATEINSTANCE)(REFIID riid, void **ppv);
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2017-04-16 19:29:27 +00:00
|
|
|
VOID InitRSHELL(VOID)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2017-04-16 19:29:27 +00:00
|
|
|
ghRShell = LoadLibraryW(L"rshell.dll");
|
|
|
|
}
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2017-06-19 14:27:51 +00:00
|
|
|
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv)
|
2017-04-16 19:29:27 +00:00
|
|
|
{
|
|
|
|
if (ghRShell)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2017-06-19 14:27:51 +00:00
|
|
|
PSTARTMENU_CREATEINSTANCE func = (PSTARTMENU_CREATEINSTANCE)GetProcAddress(ghRShell, "CStartMenu_CreateInstance");
|
2016-06-04 14:09:20 +00:00
|
|
|
if (func)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
|
|
|
return func(riid, ppv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-02 20:18:54 +00:00
|
|
|
return CoCreateInstance(CLSID_StartMenu,
|
2014-02-04 10:41:02 +00:00
|
|
|
NULL,
|
|
|
|
CLSCTX_INPROC_SERVER,
|
|
|
|
riid,
|
2017-04-16 19:29:27 +00:00
|
|
|
ppv);
|
2014-02-04 10:41:02 +00:00
|
|
|
}
|
|
|
|
|
2014-06-07 23:26:35 +00:00
|
|
|
typedef HANDLE(WINAPI * PSHCREATEDESKTOP)(IShellDesktopTray *ShellDesk);
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2014-11-02 20:18:54 +00:00
|
|
|
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
HINSTANCE hFallback;
|
|
|
|
|
2017-04-16 19:29:27 +00:00
|
|
|
if (ghRShell)
|
2014-05-18 18:05:16 +00:00
|
|
|
{
|
2017-04-16 19:29:27 +00:00
|
|
|
PSHCREATEDESKTOP func = (PSHCREATEDESKTOP)GetProcAddress(ghRShell, "SHCreateDesktop");
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
return func(ShellDesk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
hFallback = GetModuleHandleW(L"shell32.dll");
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
if (hFallback)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
PSHCREATEDESKTOP func = (PSHCREATEDESKTOP) GetProcAddress(hFallback, (LPCSTR) 200);
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
return func(ShellDesk);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef BOOL(WINAPI *PSHDESKTOPMESSAGELOOP)(HANDLE hDesktop);
|
|
|
|
|
2014-11-02 20:18:54 +00:00
|
|
|
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
HINSTANCE hFallback;
|
|
|
|
|
2017-04-16 19:29:27 +00:00
|
|
|
if (ghRShell)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2017-04-16 19:29:27 +00:00
|
|
|
PSHDESKTOPMESSAGELOOP func = (PSHDESKTOPMESSAGELOOP)GetProcAddress(ghRShell, "SHDesktopMessageLoop");
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
return func(hDesktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
hFallback = GetModuleHandleW(L"shell32.dll");
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
if (hFallback)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
PSHDESKTOPMESSAGELOOP func = (PSHDESKTOPMESSAGELOOP) GetProcAddress(hFallback, (LPCSTR) 201);
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
return func(hDesktop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef DWORD(WINAPI* PWINLIST_INIT)(void);
|
|
|
|
|
2014-11-02 20:18:54 +00:00
|
|
|
DWORD WINAPI _WinList_Init(void)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
HINSTANCE hFallback;
|
|
|
|
|
2017-04-16 19:29:27 +00:00
|
|
|
if (ghRShell)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2017-04-16 19:29:27 +00:00
|
|
|
PWINLIST_INIT func = (PWINLIST_INIT)GetProcAddress(ghRShell, "WinList_Init");
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
return func();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-11 21:18:36 +00:00
|
|
|
hFallback = LoadLibraryW(L"shdocvw.dll");
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
if (hFallback)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
PWINLIST_INIT func = (PWINLIST_INIT) GetProcAddress(hFallback, (LPCSTR) 110);
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
return func();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef void (WINAPI *PSHELLDDEINIT)(BOOL bInit);
|
|
|
|
|
2014-11-02 20:18:54 +00:00
|
|
|
void WINAPI _ShellDDEInit(BOOL bInit)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
HINSTANCE hFallback;
|
|
|
|
|
2017-04-16 19:29:27 +00:00
|
|
|
if (ghRShell)
|
2014-05-18 18:05:16 +00:00
|
|
|
{
|
2017-04-16 19:29:27 +00:00
|
|
|
PSHELLDDEINIT func = (PSHELLDDEINIT)GetProcAddress(ghRShell, "ShellDDEInit");
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
func(bInit);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
hFallback = GetModuleHandleW(L"shell32.dll");
|
2014-02-04 10:41:02 +00:00
|
|
|
|
2014-05-18 18:05:16 +00:00
|
|
|
if (hFallback)
|
2014-02-04 10:41:02 +00:00
|
|
|
{
|
2014-05-18 18:05:16 +00:00
|
|
|
PSHELLDDEINIT func = (PSHELLDDEINIT) GetProcAddress(hFallback, (LPCSTR) 188);
|
2014-02-04 10:41:02 +00:00
|
|
|
if (func)
|
|
|
|
{
|
|
|
|
func(bInit);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2014-05-18 18:05:16 +00:00
|
|
|
}
|
2017-04-16 19:29:27 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|