[10605] | 1 | /*
|
---|
[21818] | 2 | * IMM32OS2 DLL entry point
|
---|
[10605] | 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>
|
---|
[21818] | 17 | #include <win32type.h>
|
---|
[10605] | 18 | #include <winconst.h>
|
---|
| 19 | #include <odinlx.h>
|
---|
| 20 | #include <initdll.h>
|
---|
[21818] | 21 | #include <exitlist.h>
|
---|
[10605] | 22 | #include <dbglog.h>
|
---|
| 23 |
|
---|
| 24 | #include "im32.h"
|
---|
| 25 |
|
---|
[21818] | 26 | // Win32 resource table (produced by wrc)
|
---|
| 27 | extern DWORD imm32os2_PEResTab;
|
---|
[10605] | 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 | }
|
---|
[21818] | 47 |
|
---|
| 48 | ULONG SYSTEM DLL_InitImm32(ULONG hModule)
|
---|
[10605] | 49 | {
|
---|
[21978] | 50 | if (!InitializeKernel32())
|
---|
| 51 | return -1;
|
---|
| 52 |
|
---|
[21818] | 53 | if (!IM32Init())
|
---|
| 54 | dprintf(("IM32Init failed"));
|
---|
[10605] | 55 |
|
---|
[21818] | 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)
|
---|
[21976] | 61 | return -1;
|
---|
[10605] | 62 |
|
---|
[21824] | 63 | dprintf(("imm32 init %s %s (%x)", __DATE__, __TIME__, DLL_InitImm32));
|
---|
[10605] | 64 |
|
---|
[21818] | 65 | return EXITLIST_NONCRITDLL;
|
---|
| 66 | }
|
---|
[10605] | 67 |
|
---|
[21818] | 68 | void SYSTEM DLL_TermImm32(ULONG hModule)
|
---|
| 69 | {
|
---|
| 70 | dprintf(("imm32 exit"));
|
---|
[10605] | 71 |
|
---|
[21818] | 72 | if(dllHandle)
|
---|
| 73 | UnregisterLxDll(dllHandle);
|
---|
| 74 | }
|
---|
[10605] | 75 |
|
---|
[21818] | 76 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 77 | {
|
---|
| 78 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 79 | return -1;
|
---|
| 80 | return DLL_InitImm32(hModule);
|
---|
| 81 | }
|
---|
[10605] | 82 |
|
---|
[21818] | 83 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 84 | {
|
---|
| 85 | DLL_TermImm32(hModule);
|
---|
| 86 | DLL_TermDefault(hModule);
|
---|
[10605] | 87 | }
|
---|