Changeset 21916 for trunk/src/ws2_32/initterm.cpp
- Timestamp:
- Dec 18, 2011, 10:28:22 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 bin 2 Makefile.inc 1 env.cmd 2 LocalConfig.kmk
-
-
Property svn:mergeinfo
set to
/branches/gcc-kmk merged eligible
- Property svn:ignore
-
trunk/src/ws2_32/initterm.cpp
r7040 r21916 1 1 /* $Id: initterm.cpp,v 1.3 2001-10-13 18:50:52 sandervl Exp $ 2 2 * 3 * DLL entry point3 * WS2_32 DLL entry point 4 4 * 5 5 * Copyright 1998 Sander van Leeuwen 6 6 * Copyright 1998 Peter Fitzsimmons 7 7 * 8 *9 8 * Project Odin Software License can be found in LICENSE.TXT 10 *11 9 */ 12 10 13 /*-------------------------------------------------------------*/14 /* INITERM.C -- Source for a custom dynamic link library */15 /* initialization and termination (_DLL_InitTerm) */16 /* function. */17 /* */18 /* When called to perform initialization, this sample function */19 /* gets storage for an array of integers, and initializes its */20 /* elements with random integers. At termination time, it */21 /* frees the array. Substitute your own special processing. */22 /*-------------------------------------------------------------*/23 24 25 /* Include files */26 11 #define INCL_DOSMODULEMGR 27 12 #define INCL_DOSPROCESS … … 40 25 #include "dbglocal.h" 41 26 42 extern "C" { 43 //Win32 resource table (produced by wrc) 44 extern DWORD _Resource_PEResTab; 45 } 27 // Win32 resource table (produced by wrc) 28 extern DWORD ws2_32_PEResTab; 29 46 30 static HMODULE dllHandle = 0; 47 31 48 //******************************************************************************49 //******************************************************************************50 32 BOOL WINAPI OdinLibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 51 33 { 52 switch (fdwReason)53 {54 case DLL_PROCESS_ATTACH:55 return TRUE;34 switch (fdwReason) 35 { 36 case DLL_PROCESS_ATTACH: 37 return TRUE; 56 38 57 case DLL_THREAD_ATTACH:58 case DLL_THREAD_DETACH:59 return TRUE;39 case DLL_THREAD_ATTACH: 40 case DLL_THREAD_DETACH: 41 return TRUE; 60 42 61 case DLL_PROCESS_DETACH: 62 ctordtorTerm(); 63 return TRUE; 64 } 65 return FALSE; 43 case DLL_PROCESS_DETACH: 44 #ifdef __IBMC__ 45 ctordtorTerm(); 46 #endif 47 return TRUE; 48 } 49 return FALSE; 66 50 } 67 /****************************************************************************/ 68 /* _DLL_InitTerm is the function that gets called by the operating system */ 69 /* loader when it loads and frees this DLL for each process that accesses */ 70 /* this DLL. However, it only gets called the first time the DLL is loaded */ 71 /* and the last time it is freed for a particular process. The system */ 72 /* linkage convention MUST be used because the operating system loader is */ 73 /* calling this function. */ 74 /****************************************************************************/ 75 ULONG DLLENTRYPOINT_CCONV DLLENTRYPOINT_NAME(ULONG hModule, ULONG ulFlag) 51 52 ULONG SYSTEM DLL_InitWS2_32(ULONG hModule) 76 53 { 77 size_t i; 78 APIRET rc; 54 ParseLogStatus(); 79 55 80 /*-------------------------------------------------------------------------*/ 81 /* If ulFlag is zero then the DLL is being loaded so initialization should */ 82 /* be performed. If ulFlag is 1 then the DLL is being freed so */ 83 /* termination should be performed. */ 84 /*-------------------------------------------------------------------------*/ 56 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 85 57 86 switch (ulFlag) {87 case 0 :88 ctordtorInit();58 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&ws2_32_PEResTab); 59 if(dllHandle == 0) 60 return -1; 89 61 90 ParseLogStatus(); 62 return 0; 63 } 91 64 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 65 void SYSTEM DLL_TermWS2_32(ULONG hModule) 66 { 67 if (dllHandle) 68 UnregisterLxDll(dllHandle); 69 } 93 70 94 dllHandle = RegisterLxDll(hModule, OdinLibMain, (PVOID)&_Resource_PEResTab); 95 if(dllHandle == 0) 96 return 0UL; 71 ULONG SYSTEM DLL_Init(ULONG hModule) 72 { 73 if (DLL_InitDefault(hModule) == -1) 74 return -1; 75 return DLL_InitWS2_32(hModule); 76 } 97 77 98 break; 99 case 1 : 100 if(dllHandle) { 101 UnregisterLxDll(dllHandle); 102 } 103 break; 104 default : 105 return 0UL; 106 } 107 108 /***********************************************************/ 109 /* A non-zero value must be returned to indicate success. */ 110 /***********************************************************/ 111 return 1UL; 78 void SYSTEM DLL_Term(ULONG hModule) 79 { 80 DLL_TermWS2_32(hModule); 81 DLL_TermDefault(hModule); 112 82 } 113 //******************************************************************************114 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.