[6712] | 1 | /*
|
---|
[21916] | 2 | * MSACM32 entry point
|
---|
[779] | 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*/
|
---|
[951] | 18 | #include <win32type.h>
|
---|
[2650] | 19 | #include <winconst.h>
|
---|
[951] | 20 | #include <odinlx.h>
|
---|
[5130] | 21 | #include <initdll.h>
|
---|
[779] | 22 |
|
---|
[21916] | 23 | // Win32 resource table (produced by wrc)
|
---|
| 24 | extern DWORD msacm32_PEResTab;
|
---|
| 25 |
|
---|
[3993] | 26 | static HMODULE dllHandle = 0;
|
---|
[779] | 27 |
|
---|
| 28 | BOOL WINAPI MSACM32_LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
---|
| 29 |
|
---|
[2650] | 30 | BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
| 31 | {
|
---|
[21916] | 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);
|
---|
[779] | 38 |
|
---|
[21916] | 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;
|
---|
[2650] | 47 | }
|
---|
[21916] | 48 |
|
---|
| 49 | ULONG SYSTEM DLL_InitMSAcm32(ULONG hModule)
|
---|
[779] | 50 | {
|
---|
[21916] | 51 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
[779] | 52 |
|
---|
[21916] | 53 | dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&msacm32_PEResTab);
|
---|
| 54 | if(dllHandle == 0)
|
---|
| 55 | return -1;
|
---|
[779] | 56 |
|
---|
[21916] | 57 | return 0;
|
---|
| 58 | }
|
---|
[779] | 59 |
|
---|
[21916] | 60 | void SYSTEM DLL_TermMSAcm32(ULONG hModule)
|
---|
| 61 | {
|
---|
| 62 | if (dllHandle)
|
---|
| 63 | UnregisterLxDll(dllHandle);
|
---|
| 64 | }
|
---|
[779] | 65 |
|
---|
[21916] | 66 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 67 | {
|
---|
| 68 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 69 | return -1;
|
---|
| 70 | return DLL_InitMSAcm32(hModule);
|
---|
| 71 | }
|
---|
[951] | 72 |
|
---|
[21916] | 73 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 74 | {
|
---|
| 75 | DLL_TermMSAcm32(hModule);
|
---|
| 76 | DLL_TermDefault(hModule);
|
---|
[779] | 77 | }
|
---|