1 | /*
|
---|
2 | * SHELL32 DLL entry point
|
---|
3 | *
|
---|
4 | * Copyright 1998 Sander van Leeuwen
|
---|
5 | * Copyright 1998 Peter Fitzsimmons
|
---|
6 | *
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | */
|
---|
9 |
|
---|
10 | #define INCL_DOSMODULEMGR
|
---|
11 | #define INCL_DOSPROCESS
|
---|
12 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
13 | #include <stdlib.h>
|
---|
14 | #include <stdio.h>
|
---|
15 | #include <string.h>
|
---|
16 | #include <odin.h>
|
---|
17 | #include <win32type.h>
|
---|
18 | #include <winconst.h>
|
---|
19 | #include <odinlx.h>
|
---|
20 | #include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
|
---|
21 | #include <initdll.h>
|
---|
22 |
|
---|
23 | // Win32 resource table (produced by wrc)
|
---|
24 | extern DWORD shell32_PEResTab;
|
---|
25 |
|
---|
26 | static HMODULE dllHandle = 0;
|
---|
27 |
|
---|
28 | BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad);
|
---|
29 |
|
---|
30 | BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
31 | {
|
---|
32 | BOOL ret;
|
---|
33 |
|
---|
34 | switch (fdwReason)
|
---|
35 | {
|
---|
36 | case DLL_PROCESS_ATTACH:
|
---|
37 | case DLL_THREAD_ATTACH:
|
---|
38 | case DLL_THREAD_DETACH:
|
---|
39 | return Shell32LibMain(hinstDLL, fdwReason, fImpLoad);
|
---|
40 |
|
---|
41 | case DLL_PROCESS_DETACH:
|
---|
42 | ret = Shell32LibMain(hinstDLL, fdwReason, fImpLoad);
|
---|
43 | return ret;
|
---|
44 | }
|
---|
45 | return FALSE;
|
---|
46 | }
|
---|
47 |
|
---|
48 | ULONG SYSTEM DLL_InitShell32(ULONG hModule)
|
---|
49 | {
|
---|
50 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
51 |
|
---|
52 | dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&shell32_PEResTab,
|
---|
53 | SHELL32_MAJORIMAGE_VERSION, SHELL32_MINORIMAGE_VERSION,
|
---|
54 | IMAGE_SUBSYSTEM_WINDOWS_GUI);
|
---|
55 | if (dllHandle == 0)
|
---|
56 | return -1;
|
---|
57 |
|
---|
58 | return 0;
|
---|
59 | }
|
---|
60 |
|
---|
61 | void SYSTEM DLL_TermShell32(ULONG hModule)
|
---|
62 | {
|
---|
63 | if (dllHandle)
|
---|
64 | UnregisterLxDll(dllHandle);
|
---|
65 | }
|
---|
66 |
|
---|
67 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
68 | {
|
---|
69 | if (DLL_InitDefault(hModule) == -1)
|
---|
70 | return -1;
|
---|
71 | return DLL_InitShell32(hModule);
|
---|
72 | }
|
---|
73 |
|
---|
74 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
75 | {
|
---|
76 | DLL_TermShell32(hModule);
|
---|
77 | DLL_TermDefault(hModule);
|
---|
78 | }
|
---|