From e020a9a95d33d0c36cd558a20bf16e8b77fbbf49 Mon Sep 17 00:00:00 2001 From: James Juran Date: Sun, 15 Aug 1999 16:32:03 +0000 Subject: [PATCH] New routine DllEntryPoint for shell.dll. Loads shell32.dll, since most shell.dll functions call their 32-bit counterparts. --- dlls/shell32/shell.c | 55 +++++++++++++++++++++++++++++++++++++++++ dlls/shell32/shell.spec | 2 +- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/dlls/shell32/shell.c b/dlls/shell32/shell.c index 6a1765550f4..50743bd1d7a 100644 --- a/dlls/shell32/shell.c +++ b/dlls/shell32/shell.c @@ -64,6 +64,61 @@ static HHOOK SHELL_hHook = 0; static UINT16 uMsgWndCreated = 0; static UINT16 uMsgWndDestroyed = 0; static UINT16 uMsgShellActivate = 0; +HINSTANCE16 SHELL_hInstance = 0; +HINSTANCE SHELL_hInstance32; +static int SHELL_Attach = 0; + +/*********************************************************************** + * SHELL_DllEntryPoint [SHELL.entry] + * + * Initialization code for shell.dll. Automatically loads the + * 32-bit shell32.dll to allow thunking up to 32-bit code. + * + * RETURNS: + */ +BOOL WINAPI SHELL_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, + WORD ds, WORD HeapSize, DWORD res1, WORD res2) +{ + TRACE_(shell)("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", + Reason, hInst, ds, HeapSize, res1, res2); + + switch(Reason) + { + case DLL_PROCESS_ATTACH: + SHELL_Attach++; + if (SHELL_hInstance) + { + ERR_(shell)("shell.dll instantiated twice!\n"); + /* + * We should return FALSE here, but that will break + * most apps that use CreateProcess because we do + * not yet support seperate address-spaces. + */ + return TRUE; + } + + SHELL_hInstance = hInst; + if(!SHELL_hInstance32) + { + if(!(SHELL_hInstance32 = LoadLibraryA("shell32.dll"))) + { + ERR_(shell)("Could not load sibling shell32.dll\n"); + return FALSE; + } + } + break; + + case DLL_PROCESS_DETACH: + if(!--SHELL_Attach) + { + SHELL_hInstance = 0; + if(SHELL_hInstance32) + FreeLibrary(SHELL_hInstance32); + } + break; + } + return TRUE; +} /************************************************************************* * DragAcceptFiles32 [SHELL32.54] diff --git a/dlls/shell32/shell.spec b/dlls/shell32/shell.spec index bd84c6ff7a9..656c321a9c1 100644 --- a/dlls/shell32/shell.spec +++ b/dlls/shell32/shell.spec @@ -27,7 +27,7 @@ type win16 #100 4 0550 HERETHARBETYGARS exported, shared data #101 8 010e FINDEXEDLGPROC exported, shared data -#101 DLLENTRYPOINT #win95 SHELL.DLL +101 pascal DllEntryPoint(long word word word long word) SHELL_DllEntryPoint 102 pascal16 RegisterShellHook(word word) RegisterShellHook16 103 pascal ShellHookProc(word word long) ShellHookProc16