ReactOS  0.4.14-dev-614-gbfd8a84
rshell.cpp
Go to the documentation of this file.
1 /*
2  * ReactOS Explorer
3  *
4  * Copyright 2014 Giannis Adamopoulos
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "precomp.h"
22 
24 
26 
28 {
29  ghRShell = LoadLibraryW(L"rshell.dll");
30 }
31 
33 {
34  if (ghRShell)
35  {
37  if (func)
38  {
39  return func(riid, ppv);
40  }
41  }
42 
44  NULL,
45  CLSCTX_INPROC_SERVER,
46  riid,
47  ppv);
48 }
49 
50 typedef HANDLE(WINAPI * PSHCREATEDESKTOP)(IShellDesktopTray *ShellDesk);
51 
52 HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk)
53 {
54  HINSTANCE hFallback;
55 
56  if (ghRShell)
57  {
59  if (func)
60  {
61  return func(ShellDesk);
62  }
63  }
64 
65  hFallback = GetModuleHandleW(L"shell32.dll");
66 
67  if (hFallback)
68  {
70  if (func)
71  {
72  return func(ShellDesk);
73  }
74  }
75 
76  return 0;
77 }
78 
80 
82 {
83  HINSTANCE hFallback;
84 
85  if (ghRShell)
86  {
88  if (func)
89  {
90  return func(hDesktop);
91  }
92  }
93 
94  hFallback = GetModuleHandleW(L"shell32.dll");
95 
96  if (hFallback)
97  {
99  if (func)
100  {
101  return func(hDesktop);
102  }
103  }
104 
105  return FALSE;
106 }
107 
109 
111 {
112  HINSTANCE hFallback;
113 
114  if (ghRShell)
115  {
117  if (func)
118  {
119  return func();
120  }
121  }
122 
123  hFallback = LoadLibraryW(L"shdocvw.dll");
124 
125  if (hFallback)
126  {
127  PWINLIST_INIT func = (PWINLIST_INIT) GetProcAddress(hFallback, (LPCSTR) 110);
128  if (func)
129  {
130  return func();
131  }
132  }
133 
134  return 0;
135 }
136 
137 typedef void (WINAPI *PSHELLDDEINIT)(BOOL bInit);
138 
140 {
141  HINSTANCE hFallback;
142 
143  if (ghRShell)
144  {
146  if (func)
147  {
148  func(bInit);
149  return;
150  }
151  }
152 
153  hFallback = GetModuleHandleW(L"shell32.dll");
154 
155  if (hFallback)
156  {
157  PSHELLDDEINIT func = (PSHELLDDEINIT) GetProcAddress(hFallback, (LPCSTR) 188);
158  if (func)
159  {
160  func(bInit);
161  return;
162  }
163  }
164 }
165 
168 {
169  if (ghRShell)
170  {
172  if (func)
173  {
174  return func(riid, ppv);
175  }
176  }
177 
178  return CoCreateInstance(CLSID_BandSiteMenu,
179  NULL,
180  CLSCTX_INPROC_SERVER,
181  riid,
182  ppv);
183 }
184 
187 {
188  if (ghRShell)
189  {
191  if (func)
192  {
193  return func(pUnkOuter, riid, ppv);
194  }
195  }
196 
197  return CoCreateInstance(CLSID_RebarBandSite,
198  pUnkOuter,
199  CLSCTX_INPROC_SERVER,
200  riid,
201  ppv);
202 }
203 
GLenum func
Definition: glext.h:6028
#define HRESULT
Definition: msvc.h:7
BOOL(WINAPI * PSHDESKTOPMESSAGELOOP)(HANDLE hDesktop)
Definition: rshell.cpp:79
HRESULT(WINAPI * PSTARTMENU_CREATEINSTANCE)(REFIID riid, void **ppv)
Definition: rshell.cpp:25
#define REFIID
Definition: guiddef.h:118
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
static HINSTANCE ghRShell
Definition: rshell.cpp:23
HRESULT WINAPI _CBandSiteMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:167
HRESULT WINAPI _CBandSite_CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
Definition: rshell.cpp:186
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT(WINAPI * CBANDSITEMENU_CREATEINSTANCE)(REFIID riid, void **ppv)
Definition: rshell.cpp:166
static LPUNKNOWN
Definition: ndr_ole.c:49
HRESULT(WINAPI * CBANDSITE_CREATEINSTANCE)(LPUNKNOWN pUnkOuter, REFIID riid, void **ppv)
Definition: rshell.cpp:185
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
void(WINAPI * PSHELLDDEINIT)(BOOL bInit)
Definition: rshell.cpp:137
DWORD(WINAPI * PWINLIST_INIT)(void)
Definition: rshell.cpp:108
const GUID CLSID_StartMenu
LONG HRESULT
Definition: typedefs.h:77
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
BOOL WINAPI _SHDesktopMessageLoop(HANDLE hDesktop)
Definition: rshell.cpp:81
HANDLE(WINAPI * PSHCREATEDESKTOP)(IShellDesktopTray *ShellDesk)
Definition: rshell.cpp:50
static const WCHAR L[]
Definition: oid.c:1250
HANDLE WINAPI _SHCreateDesktop(IShellDesktopTray *ShellDesk)
Definition: rshell.cpp:52
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
VOID InitRSHELL(VOID)
Definition: rshell.cpp:27
DWORD WINAPI _WinList_Init(void)
Definition: rshell.cpp:110
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
#define GetProcAddress(x, y)
Definition: compat.h:418
HRESULT WINAPI _CStartMenu_CreateInstance(REFIID riid, void **ppv)
Definition: rshell.cpp:32
void WINAPI _ShellDDEInit(BOOL bInit)
Definition: rshell.cpp:139