source: trunk/src/imm32/initterm.cpp@ 21916

Last change on this file since 21916 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 1.8 KB
Line 
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)
27extern DWORD imm32os2_PEResTab;
28
29static HMODULE dllHandle = 0;
30
31BOOL 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
48ULONG SYSTEM DLL_InitImm32(ULONG hModule)
49{
50 if (!IM32Init())
51 dprintf(("IM32Init failed"));
52
53 CheckVersionFromHMOD(PE2LX_VERSION, hModule);
54 dllHandle = RegisterLxDll(hModule, ImmLibMain, (PVOID)&imm32os2_PEResTab,
55 IMM32_MAJORIMAGE_VERSION, IMM32_MINORIMAGE_VERSION,
56 IMAGE_SUBSYSTEM_WINDOWS_GUI);
57 if (dllHandle == 0)
58 return 0UL;
59
60 dprintf(("imm32 init %s %s (%x)", __DATE__, __TIME__, DLL_InitImm32));
61
62 return EXITLIST_NONCRITDLL;
63}
64
65void SYSTEM DLL_TermImm32(ULONG hModule)
66{
67 dprintf(("imm32 exit"));
68
69 if(dllHandle)
70 UnregisterLxDll(dllHandle);
71}
72
73ULONG SYSTEM DLL_Init(ULONG hModule)
74{
75 if (DLL_InitDefault(hModule) == -1)
76 return -1;
77 return DLL_InitImm32(hModule);
78}
79
80void SYSTEM DLL_Term(ULONG hModule)
81{
82 DLL_TermImm32(hModule);
83 DLL_TermDefault(hModule);
84}
Note: See TracBrowser for help on using the repository browser.