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