[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
This commit is contained in:
Hermès Bélusca-Maïto 2016-06-04 22:50:33 +00:00
parent fe2ef00a13
commit 1b3d6dfdc1

View file

@ -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;