Changeset 2650 for trunk/src/ddraw/initterm.cpp
- Timestamp:
- Feb 5, 2000, 3:19:44 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ddraw/initterm.cpp
r1502 r2650 1 /* $Id: initterm.cpp,v 1.1 1 1999-10-28 22:39:21 hughExp $ */1 /* $Id: initterm.cpp,v 1.12 2000-02-05 01:55:52 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 #include "initterm.h"38 38 39 39 extern "C" { 40 40 void CDECL _ctordtorInit( void ); 41 41 void CDECL _ctordtorTerm( void ); 42 43 //Win32 resource table (produced by wrc) 44 extern DWORD _Resource_PEResTab; 42 45 } 43 46 44 47 char ddrawPath[CCHMAXPATH] = ""; 45 48 46 /*-------------------------------------------------------------------*/ 47 /* A clean up routine registered with DosExitList must be used if */ 48 /* runtime calls are required and the runtime is dynamically linked. */ 49 /* This will guarantee that this clean up routine is run before the */ 50 /* library DLL is terminated. */ 51 /*-------------------------------------------------------------------*/ 52 static void APIENTRY cleanup(ULONG reason); 49 //****************************************************************************** 50 //****************************************************************************** 51 BOOL WINAPI LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 52 { 53 switch (fdwReason) 54 { 55 case DLL_PROCESS_ATTACH: 56 return TRUE; 53 57 58 case DLL_THREAD_ATTACH: 59 case DLL_THREAD_DETACH: 60 return TRUE; 54 61 62 case DLL_PROCESS_DETACH: 63 _ctordtorTerm(); 64 return TRUE; 65 } 66 return FALSE; 67 } 55 68 /****************************************************************************/ 56 69 /* _DLL_InitTerm is the function that gets called by the operating system */ … … 78 91 _ctordtorInit(); 79 92 80 DosQueryModuleName(hModule, CCHMAXPATH, ddrawPath);93 DosQueryModuleName(hModule, CCHMAXPATH, ddrawPath); 81 94 char *endofpath = strrchr(ddrawPath, '\\'); 82 95 if(endofpath) *(endofpath+1) = 0; … … 84 97 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 85 98 86 /*******************************************************************/ 87 /* A DosExitList routine must be used to clean up if runtime calls */ 88 /* are required and the runtime is dynamically linked. */ 89 /*******************************************************************/ 90 91 if(RegisterLxDll(hModule, 0, 0) == FALSE) 92 return 0UL; 93 94 rc = DosExitList(0x0000F000|EXLST_ADD, cleanup); 95 if(rc) 96 return 0UL; 99 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 100 return 0UL; 97 101 98 102 break; 99 103 } 100 104 case 1 : 101 105 UnregisterLxDll(hModule); 102 106 break; 103 107 default : … … 110 114 return 1UL; 111 115 } 112 113 114 static void APIENTRY cleanup(ULONG ulReason) 115 { 116 _ctordtorTerm(); 117 DosExitList(EXLST_EXIT, cleanup); 118 return ; 119 } 116 //****************************************************************************** 117 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.