Changeset 2650 for trunk/src/wing32/initterm.cpp
- Timestamp:
- Feb 5, 2000, 3:19:44 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wing32/initterm.cpp
r1647 r2650 1 /* $Id: initterm.cpp,v 1. 1 1999-11-08 22:10:00 hughExp $ */1 /* $Id: initterm.cpp,v 1.2 2000-02-05 02:13:34 sandervl Exp $ */ 2 2 3 3 /* … … 33 33 #include <odin.h> 34 34 #include <win32type.h> 35 #include <winconst.h> 35 36 #include <odinlx.h> 36 37 #include <misc.h> /*PLF Wed 98-03-18 23:18:15*/ 37 38 #include "wing32impl.h" 38 #include "initterm.h"39 39 40 40 extern "C" { 41 41 void CDECL _ctordtorInit( void ); 42 42 void CDECL _ctordtorTerm( void ); 43 44 //Win32 resource table (produced by wrc) 45 extern DWORD _Resource_PEResTab; 43 46 } 47 //****************************************************************************** 48 //****************************************************************************** 49 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 50 { 51 switch (fdwReason) 52 { 53 case DLL_PROCESS_ATTACH: 54 return TRUE; 44 55 45 char wing32Path[CCHMAXPATH] = ""; 56 case DLL_THREAD_ATTACH: 57 case DLL_THREAD_DETACH: 58 return TRUE; 46 59 47 /*-------------------------------------------------------------------*/ 48 /* A clean up routine registered with DosExitList must be used if */ 49 /* runtime calls are required and the runtime is dynamically linked. */ 50 /* This will guarantee that this clean up routine is run before the */ 51 /* library DLL is terminated. */ 52 /*-------------------------------------------------------------------*/ 53 static void APIENTRY cleanup(ULONG reason); 54 55 60 case DLL_PROCESS_DETACH: 61 _ctordtorTerm(); 62 return TRUE; 63 } 64 return FALSE; 65 } 56 66 /****************************************************************************/ 57 67 /* _DLL_InitTerm is the function that gets called by the operating system */ … … 80 90 _ctordtorInit(); 81 91 82 DosQueryModuleName(hModule, CCHMAXPATH, wing32Path);83 char *endofpath = strrchr(wing32Path, '\\');84 if(endofpath)85 *(endofpath+1) = 0;86 87 92 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 88 89 /*******************************************************************/90 /* A DosExitList routine must be used to clean up if runtime calls */91 /* are required and the runtime is dynamically linked. */92 /*******************************************************************/93 94 if(RegisterLxDll(hModule, 0, 0) == FALSE)95 return 0UL;96 93 97 94 if(!InitWing32()) 98 95 return 0UL; 99 96 100 rc = DosExitList(0x0000F000|EXLST_ADD, cleanup); 101 if(rc) 97 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 102 98 return 0UL; 103 99 … … 116 112 return 1UL; 117 113 } 118 119 120 static void APIENTRY cleanup(ULONG ulReason)121 {122 _ctordtorTerm();123 DosExitList(EXLST_EXIT, cleanup);124 return ;125 }
Note:
See TracChangeset
for help on using the changeset viewer.