From 1b3d6dfdc1814e2e6751ab3d7ce72352c002b4f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 4 Jun 2016 22:50:33 +0000 Subject: [PATCH] [RSHELL]: When rshell is compiled and used on Windows (as a testing replacement for shell32), it should correctly initialize the shell32_instance handle so that the rest of shell32 code can use something valid! svn path=/trunk/; revision=71520 --- reactos/base/shell/rshell/misc.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/reactos/base/shell/rshell/misc.cpp b/reactos/base/shell/rshell/misc.cpp index 88a2a117581..e466b54595e 100644 --- a/reactos/base/shell/rshell/misc.cpp +++ b/reactos/base/shell/rshell/misc.cpp @@ -20,8 +20,6 @@ #include "shellmenu.h" -HINSTANCE shell32_hInstance = NULL; - DWORD WINAPI WinList_Init(void) { /* do something here (perhaps we may want to add our own implementation fo win8) */ @@ -38,10 +36,10 @@ class CRShellModule : public CComModule public: }; -CRShellModule gModule; -CAtlWinModule gWinModule; +CRShellModule gModule; +CAtlWinModule gWinModule; -HINSTANCE g_hRShell; +HINSTANCE shell32_hInstance = NULL; static LSTATUS inline _RegSetStringValueW(HKEY hKey, LPCWSTR lpValueName, LPCWSTR lpStringData) { @@ -59,7 +57,7 @@ static HRESULT RegisterComponent(REFGUID clsid, LPCWSTR szDisplayName) if (!StringFromGUID2(clsid, szClsid, _countof(szClsid))) return E_FAIL; - if (!GetModuleFileNameW(g_hRShell, szFilename, _countof(szFilename))) + if (!GetModuleFileNameW(shell32_hInstance, szFilename, _countof(szFilename))) return E_FAIL; HRESULT hr = StringCchPrintfW(szRoot, 0x104u, L"CLSID\\%s", szClsid); @@ -117,13 +115,14 @@ STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad) { if (dwReason == DLL_PROCESS_ATTACH) { - g_hRShell = hInstance; + shell32_hInstance = hInstance; gModule.Init(NULL, hInstance, NULL); DisableThreadLibraryCalls(hInstance); } else if (dwReason == DLL_PROCESS_DETACH) { + shell32_hInstance = NULL; gModule.Term(); } return TRUE;