Rev | Line | |
---|
[6640] | 1 | /* $Id: initterm.cpp,v 1.6 2001-09-05 10:32:33 bird Exp $
|
---|
| 2 | *
|
---|
[21916] | 3 | * WING32 DLL entry point
|
---|
[1647] | 4 | *
|
---|
| 5 | * Copyright 1998 Sander van Leeuwen
|
---|
| 6 | * Copyright 1998 Peter Fitzsimmons
|
---|
| 7 | *
|
---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 9 | */
|
---|
| 10 |
|
---|
| 11 | #define INCL_DOSMODULEMGR
|
---|
| 12 | #define INCL_DOSPROCESS
|
---|
| 13 | #include <os2wrap.h> //Odin32 OS/2 api wrappers
|
---|
| 14 | #include <stdlib.h>
|
---|
| 15 | #include <stdio.h>
|
---|
| 16 | #include <string.h>
|
---|
| 17 | #include <odin.h>
|
---|
| 18 | #include <win32type.h>
|
---|
[2650] | 19 | #include <winconst.h>
|
---|
[1647] | 20 | #include <odinlx.h>
|
---|
| 21 | #include <misc.h> /*PLF Wed 98-03-18 23:18:15*/
|
---|
[5130] | 22 | #include <initdll.h>
|
---|
[1647] | 23 | #include "wing32impl.h"
|
---|
| 24 |
|
---|
[21916] | 25 | // Win32 resource table (produced by wrc)
|
---|
| 26 | extern DWORD wing32_PEResTab;
|
---|
| 27 |
|
---|
[3993] | 28 | static HMODULE dllHandle = 0;
|
---|
| 29 |
|
---|
[2650] | 30 | BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
---|
| 31 | {
|
---|
[21916] | 32 | switch (fdwReason)
|
---|
| 33 | {
|
---|
| 34 | case DLL_PROCESS_ATTACH:
|
---|
[5130] | 35 | if(!InitWing32())
|
---|
[6640] | 36 | return FALSE;
|
---|
[5130] | 37 |
|
---|
[21916] | 38 | return TRUE;
|
---|
[1647] | 39 |
|
---|
[21916] | 40 | case DLL_THREAD_ATTACH:
|
---|
| 41 | case DLL_THREAD_DETACH:
|
---|
| 42 | return TRUE;
|
---|
[1647] | 43 |
|
---|
[21916] | 44 | case DLL_PROCESS_DETACH:
|
---|
| 45 | #ifdef __IBMC__
|
---|
| 46 | ctordtorTerm();
|
---|
| 47 | #endif
|
---|
| 48 | return TRUE;
|
---|
| 49 | }
|
---|
| 50 | return FALSE;
|
---|
[2650] | 51 | }
|
---|
[21916] | 52 |
|
---|
| 53 | ULONG SYSTEM DLL_InitWing32(ULONG hModule)
|
---|
[1647] | 54 | {
|
---|
[21916] | 55 | CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/
|
---|
[1647] | 56 |
|
---|
[21916] | 57 | dllHandle = RegisterLxDll(hModule, LibMain, (PVOID)&wing32_PEResTab);
|
---|
| 58 | if (dllHandle == 0)
|
---|
| 59 | return -1;
|
---|
[1647] | 60 |
|
---|
[21916] | 61 | return 0;
|
---|
| 62 | }
|
---|
[1647] | 63 |
|
---|
[21916] | 64 | void SYSTEM DLL_TermWing32(ULONG hModule)
|
---|
| 65 | {
|
---|
| 66 | if (dllHandle)
|
---|
| 67 | UnregisterLxDll(dllHandle);
|
---|
| 68 | }
|
---|
[1647] | 69 |
|
---|
[21916] | 70 | ULONG SYSTEM DLL_Init(ULONG hModule)
|
---|
| 71 | {
|
---|
| 72 | if (DLL_InitDefault(hModule) == -1)
|
---|
| 73 | return -1;
|
---|
| 74 | return DLL_InitWing32(hModule);
|
---|
| 75 | }
|
---|
[1647] | 76 |
|
---|
[21916] | 77 | void SYSTEM DLL_Term(ULONG hModule)
|
---|
| 78 | {
|
---|
| 79 | DLL_TermWing32(hModule);
|
---|
| 80 | DLL_TermDefault(hModule);
|
---|
[1647] | 81 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.