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