Author: dquintana
Date: Sun May 18 18:05:16 2014
New Revision: 63357
URL:
http://svn.reactos.org/svn/reactos?rev=63357&view=rev
Log:
[EXPLORER-NEW]
* Fix the fallback for when rshell functions are not exported or rshell is not present.
* While at it, avoid unnecessary calls to LoadLibrary.
Modified:
branches/shell-experiments/base/shell/explorer-new/rshell.c
Modified: branches/shell-experiments/base/shell/explorer-new/rshell.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/rshell.c [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/explorer-new/rshell.c [iso-8859-1] Sun May 18
18:05:16 2014
@@ -20,14 +20,16 @@
#include "precomp.h"
+static HINSTANCE hRShell = NULL;
+
typedef HRESULT(*PSTARTMENU_CONSTRUCTOR)(REFIID riid, void **ppv);
-HRESULT
-CStartMenu_Constructor(
- REFIID riid,
- void **ppv)
+HRESULT CStartMenu_Constructor(REFIID riid, void **ppv)
{
- HINSTANCE hRShell = LoadLibraryW(L"rshell.dll");
+ if (!hRShell)
+ {
+ hRShell = LoadLibraryW(L"rshell.dll");
+ }
if (hRShell)
{
@@ -49,7 +51,12 @@
HANDLE WINAPI SHCreateDesktop(IShellDesktopTray *ShellDesk)
{
- HINSTANCE hRShell = LoadLibraryW(L"rshell.dll");
+ HINSTANCE hFallback;
+
+ if (!hRShell)
+ {
+ hRShell = LoadLibraryW(L"rshell.dll");
+ }
if (hRShell)
{
@@ -60,11 +67,11 @@
}
}
- hRShell = LoadLibraryW(L"shell32.dll");
+ hFallback = GetModuleHandleW(L"shell32.dll");
- if (hRShell)
+ if (hFallback)
{
- PSHCREATEDESKTOP func = (PSHCREATEDESKTOP)GetProcAddress(hRShell,
"SHCreateDesktop");
+ PSHCREATEDESKTOP func = (PSHCREATEDESKTOP) GetProcAddress(hFallback, (LPCSTR)
200);
if (func)
{
return func(ShellDesk);
@@ -78,7 +85,12 @@
BOOL WINAPI SHDesktopMessageLoop(HANDLE hDesktop)
{
- HINSTANCE hRShell = LoadLibraryW(L"rshell.dll");
+ HINSTANCE hFallback;
+
+ if (!hRShell)
+ {
+ hRShell = LoadLibraryW(L"rshell.dll");
+ }
if (hRShell)
{
@@ -89,11 +101,11 @@
}
}
- hRShell = LoadLibraryW(L"shell32.dll");
+ hFallback = GetModuleHandleW(L"shell32.dll");
- if (hRShell)
+ if (hFallback)
{
- PSHDESKTOPMESSAGELOOP func = (PSHDESKTOPMESSAGELOOP)GetProcAddress(hRShell,
"SHDesktopMessageLoop");
+ PSHDESKTOPMESSAGELOOP func = (PSHDESKTOPMESSAGELOOP) GetProcAddress(hFallback,
(LPCSTR) 201);
if (func)
{
return func(hDesktop);
@@ -107,7 +119,12 @@
DWORD WINAPI WinList_Init(void)
{
- HINSTANCE hRShell = LoadLibraryW(L"rshell.dll");
+ HINSTANCE hFallback;
+
+ if (!hRShell)
+ {
+ hRShell = LoadLibraryW(L"rshell.dll");
+ }
if (hRShell)
{
@@ -118,11 +135,11 @@
}
}
- hRShell = LoadLibraryW(L"shdocvw.dll");
+ hFallback = GetModuleHandleW(L"shdocvw.dll");
- if (hRShell)
+ if (hFallback)
{
- PWINLIST_INIT func = (PWINLIST_INIT)GetProcAddress(hRShell,
"WinList_Init");
+ PWINLIST_INIT func = (PWINLIST_INIT) GetProcAddress(hFallback, (LPCSTR) 110);
if (func)
{
return func();
@@ -136,7 +153,12 @@
void WINAPI ShellDDEInit(BOOL bInit)
{
- HINSTANCE hRShell = LoadLibraryW(L"rshell.dll");
+ HINSTANCE hFallback;
+
+ if (!hRShell)
+ {
+ hRShell = LoadLibraryW(L"rshell.dll");
+ }
if (hRShell)
{
@@ -148,15 +170,15 @@
}
}
- hRShell = LoadLibraryW(L"shell32.dll");
+ hFallback = GetModuleHandleW(L"shell32.dll");
- if (hRShell)
+ if (hFallback)
{
- PSHELLDDEINIT func = (PSHELLDDEINIT)GetProcAddress(hRShell,
"ShellDDEInit");
+ PSHELLDDEINIT func = (PSHELLDDEINIT) GetProcAddress(hFallback, (LPCSTR) 188);
if (func)
{
func(bInit);
return;
}
}
-}
+}