source: trunk/src/msacm32/initterm.cpp@ 22010

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

Merge branch gcc-kmk to trunk.

File size: 1.7 KB
Line 
1/*
2 * MSACM32 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 <misc.h> /*PLF Wed 98-03-18 23:18:15*/
18#include <win32type.h>
19#include <winconst.h>
20#include <odinlx.h>
21#include <initdll.h>
22
23// Win32 resource table (produced by wrc)
24extern DWORD msacm32_PEResTab;
25
26static HMODULE dllHandle = 0;
27
28BOOL WINAPI MSACM32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
29
30BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
31{
32 switch (fdwReason)
33 {
34 case DLL_PROCESS_ATTACH:
35 case DLL_THREAD_ATTACH:
36 case DLL_THREAD_DETACH:
37 return MSACM32_LibMain(hinstDLL, fdwReason, fImpLoad);
38
39 case DLL_PROCESS_DETACH:
40 MSACM32_LibMain(hinstDLL, fdwReason, fImpLoad);
41#ifdef __IBMC__
42 ctordtorTerm();
43#endif
44 return TRUE;
45 }
46 return FALSE;
47}
48
49ULONG SYSTEM DLL_InitMSAcm32(ULONG hModule)
50{
51 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
52
53 dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&msacm32_PEResTab);
54 if(dllHandle == 0)
55 return -1;
56
57 return 0;
58}
59
60void SYSTEM DLL_TermMSAcm32(ULONG hModule)
61{
62 if (dllHandle)
63 UnregisterLxDll(dllHandle);
64}
65
66ULONG SYSTEM DLL_Init(ULONG hModule)
67{
68 if (DLL_InitDefault(hModule) == -1)
69 return -1;
70 return DLL_InitMSAcm32(hModule);
71}
72
73void SYSTEM DLL_Term(ULONG hModule)
74{
75 DLL_TermMSAcm32(hModule);
76 DLL_TermDefault(hModule);
77}
Note: See TracBrowser for help on using the repository browser.