1 | /*
|
---|
2 | * IMM32OS2 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 <initdll.h>
|
---|
21 | #include <exitlist.h>
|
---|
22 | #include <dbglog.h>
|
---|
23 |
|
---|
24 | #include "im32.h"
|
---|
25 |
|
---|
26 | // Win32 resource table (produced by wrc)
|
---|
27 | extern DWORD imm32os2_PEResTab;
|
---|
28 |
|
---|
29 | static HMODULE dllHandle = 0;
|
---|
30 |
|
---|
31 | BOOL WINAPI ImmLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
32 | {
|
---|
33 | switch (fdwReason)
|
---|
34 | {
|
---|
35 | case DLL_PROCESS_ATTACH:
|
---|
36 | return TRUE;
|
---|
37 |
|
---|
38 | case DLL_THREAD_ATTACH:
|
---|
39 | case DLL_THREAD_DETACH:
|
---|
40 | return TRUE;
|
---|
41 |
|
---|
42 | case DLL_PROCESS_DETACH:
|
---|
43 | return TRUE;
|
---|
44 | }
|
---|
45 | return FALSE;
|
---|
46 | }
|
---|
47 |
|
---|
48 | ULONG SYSTEM DLL_InitImm32(ULONG hModule)
|
---|
49 | {
|
---|
50 | if (!InitializeKernel32())
|
---|
51 | return -1;
|
---|
52 |
|
---|
53 | if (!IM32Init())
|
---|
54 | dprintf(("IM32Init failed"));
|
---|
55 |
|
---|
56 | CheckVersionFromHMOD(PE2LX_VERSION, hModule);
|
---|
57 | dllHandle = RegisterLxDll(hModule, ImmLibMain, (PVOID)&imm32os2_PEResTab,
|
---|
58 | IMM32_MAJORIMAGE_VERSION, IMM32_MINORIMAGE_VERSION,
|
---|
59 | IMAGE_SUBSYSTEM_WINDOWS_GUI);
|
---|
60 | if (dllHandle == 0)
|
---|
61 | return -1;
|
---|
62 |
|
---|
63 | dprintf(("imm32 init %s %s (%x)", __DATE__, __TIME__, DLL_InitImm32));
|
---|
64 |
|
---|
65 | return EXITLIST_NONCRITDLL;
|
---|
66 | }
|
---|
67 |
|
---|
68 | void SYSTEM DLL_TermImm32(ULONG hModule)
|
---|
69 | {
|
---|
70 | dprintf(("imm32 exit"));
|
---|
71 |
|
---|
72 | if(dllHandle)
|
---|
73 | UnregisterLxDll(dllHandle);
|
---|
74 | }
|
---|
75 |
|
---|
76 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
77 | {
|
---|
78 | if (DLL_InitDefault(hModule) == -1)
|
---|
79 | return -1;
|
---|
80 | return DLL_InitImm32(hModule);
|
---|
81 | }
|
---|
82 |
|
---|
83 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
84 | {
|
---|
85 | DLL_TermImm32(hModule);
|
---|
86 | DLL_TermDefault(hModule);
|
---|
87 | }
|
---|