Changeset 2650 for trunk/src/dsound/initterm.cpp
- Timestamp:
- Feb 5, 2000, 3:19:44 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/dsound/initterm.cpp
r1744 r2650 1 /* $Id: initterm.cpp,v 1. 8 1999-11-14 22:12:15 hughExp $ */1 /* $Id: initterm.cpp,v 1.9 2000-02-05 01:58:50 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 char 47 char dsoundPath[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 */ … … 76 89 case 0 : 77 90 { 78 _ctordtorInit(); 79 80 DosQueryModuleName(hModule, CCHMAXPATH, dsoundPath); 91 DosQueryModuleName(hModule, CCHMAXPATH, dsoundPath); 81 92 char *endofpath = strrchr(dsoundPath, '\\'); 82 93 if(endofpath) *(endofpath+1) = 0; 94 _ctordtorInit(); 83 95 84 96 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 85 97 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; 98 if(RegisterLxDll(hModule, LibMain, (PVOID)&_Resource_PEResTab) == FALSE) 99 return 0UL; 97 100 98 101 break; 99 102 } 100 103 case 1 : 101 104 UnregisterLxDll(hModule); 102 105 break; 103 106 default : … … 110 113 return 1UL; 111 114 } 112 113 114 static void APIENTRY cleanup(ULONG ulReason) 115 { 116 _ctordtorTerm(); 117 DosExitList(EXLST_EXIT, cleanup); 118 return ; 119 } 115 //****************************************************************************** 116 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.