Changeset 21841 for branches/gcc-kmk/src/winmm/initterm.cpp
- Timestamp:
- Dec 1, 2011, 10:19:11 PM (14 years ago)
- File:
-
- 1 moved
-
branches/gcc-kmk/src/winmm/initterm.cpp (moved) (moved from branches/gcc-kmk/src/winmm/initwinmm.cpp ) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/gcc-kmk/src/winmm/initterm.cpp
r21796 r21841 1 /* $Id: init winmm.cpp,v 1.15 2004-04-13 12:49:03 sandervlExp $1 /* $Id: initterm.cpp,v 1.20 2001-09-05 10:30:39 bird Exp $ 2 2 * 3 3 * WINMM DLL entry point … … 7 7 * Copyright 2000 Chris Wohlgemuth 8 8 * 9 *10 9 * Project Odin Software License can be found in LICENSE.TXT 11 *12 10 */ 13 11 14 /*-------------------------------------------------------------*/15 /* INITERM.C -- Source for a custom dynamic link library */16 /* initialization and termination (_DLL_InitTerm) */17 /* function. */18 /* */19 /* When called to perform initialization, this sample function */20 /* gets storage for an array of integers, and initializes its */21 /* elements with random integers. At termination time, it */22 /* frees the array. Substitute your own special processing. */23 /*-------------------------------------------------------------*/24 25 26 /* Include files */27 12 #define INCL_DOSMODULEMGR 28 13 #define INCL_DOSPROCESS … … 35 20 #include <stdio.h> 36 21 #include <string.h> 22 #ifndef __GNUC__ 37 23 #include <builtin.h> 24 #endif 38 25 #include <misc.h> /*PLF Wed 98-03-18 23:19:26*/ 39 26 #include <odin.h> … … 47 34 #include "waveoutbase.h" 48 35 #include <win/options.h> 49 #include "init winmm.h"36 #include "initterm.h" 50 37 #include <custombuild.h> 51 38 #include "mixer.h" … … 58 45 void MULTIMEDIA_DeleteIData(void); 59 46 60 extern "C" { 61 void IRTMidiShutdown(); // IRTMidi shutdown routine 62 63 //Win32 resource table (produced by wrc) 64 extern DWORD winmm_PEResTab; 65 } 47 extern "C" void IRTMidiShutdown(); // IRTMidi shutdown routine 48 49 // Win32 resource table (produced by wrc) 50 extern DWORD winmm_PEResTab; 51 66 52 static HMODULE dllHandle = 0; 67 53 static HMODULE MMPMLibraryHandle = 0; 68 54 69 static char *szBuggyAudio[] = { 70 "CWAUD", 71 "BSAUD", 72 "CRYSTAL" 55 static const char *szBuggyAudio[] = 56 { 57 "CWAUD", 58 "BSAUD", 59 "CRYSTAL" 73 60 }; 74 61 … … 76 63 77 64 DWORD (APIENTRY *pfnmciSendCommand)(WORD wDeviceID, 78 WORD wMessage,79 DWORD dwParam1,80 PVOID dwParam2,81 WORD wUserParm) = NULL;65 WORD wMessage, 66 DWORD dwParam1, 67 PVOID dwParam2, 68 WORD wUserParm) = NULL; 82 69 DWORD (APIENTRY *pfnmciGetErrorString)(DWORD dwError, 83 LPSTR lpstrBuffer, 84 WORD wLength) = NULL; 85 86 //****************************************************************************** 87 //****************************************************************************** 70 LPSTR lpstrBuffer, 71 WORD wLength) = NULL; 72 88 73 void WIN32API DisableWaveAudio() 89 74 { … … 92 77 pfnmciSendCommand = NULL; 93 78 } 94 //****************************************************************************** 95 //****************************************************************************** 79 96 80 BOOL WINAPI LibMainWinmm(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 97 81 { … … 216 200 return FALSE; 217 201 } 218 /****************************************************************************/ 219 /* _DLL_InitTerm is the function that gets called by the operating system */ 220 /* loader when it loads and frees this DLL for each process that accesses */ 221 /* this DLL. However, it only gets called the first time the DLL is loaded */ 222 /* and the last time it is freed for a particular process. The system */ 223 /* linkage convention MUST be used because the operating system loader is */ 224 /* calling this function. */ 225 /****************************************************************************/ 226 ULONG APIENTRY inittermWinmm(ULONG hModule, ULONG ulFlag) 227 { 228 /*-------------------------------------------------------------------------*/ 229 /* If ulFlag is zero then the DLL is being loaded so initialization should */ 230 /* be performed. If ulFlag is 1 then the DLL is being freed so */ 231 /* termination should be performed. */ 232 /*-------------------------------------------------------------------------*/ 233 234 switch (ulFlag) 235 { 236 case 0 : 237 ParseLogStatusWINMM(); 238 239 dllHandle = RegisterLxDll(hModule, LibMainWinmm, (PVOID)&winmm_PEResTab); 240 if(dllHandle == 0) 241 return 0UL;/* Error */ 242 243 dprintf(("winmm init %s %s (%x)", __DATE__, __TIME__, inittermWinmm)); 244 break; 245 case 1 : 246 auxOS2Close(); /* SvL: Close aux device if necessary */ 247 if(dllHandle) { 248 UnregisterLxDll(dllHandle); 249 } 250 break; 251 default : 252 return 0UL; 253 } 254 255 /***********************************************************/ 256 /* A non-zero value must be returned to indicate success. */ 257 /***********************************************************/ 258 return 1UL; 259 } 260 //****************************************************************************** 261 //****************************************************************************** 202 262 203 DWORD APIENTRY mymciSendCommand(WORD wDeviceID, 263 204 WORD wMessage, … … 275 216 return ret; 276 217 } 277 //****************************************************************************** 278 //****************************************************************************** 218 279 219 DWORD APIENTRY mymciGetErrorString(DWORD dwError, 280 220 LPSTR lpstrBuffer, … … 290 230 return ret; 291 231 } 292 //****************************************************************************** 293 //****************************************************************************** 232 233 ULONG SYSTEM DLL_InitWinMM32(ULONG hModule) 234 { 235 CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed 98-03-18 05:28:48*/ 236 237 ParseLogStatusWINMM(); 238 239 dllHandle = RegisterLxDll(hModule, LibMainWinmm, (PVOID)&winmm_PEResTab); 240 if (dllHandle == 0) 241 return -1; 242 243 dprintf(("winmm init %s %s (%x)", __DATE__, __TIME__, DLL_InitWinMM32)); 244 245 return 0; 246 } 247 248 void SYSTEM DLL_TermWinMM32(ULONG hModule) 249 { 250 auxOS2Close(); /* SvL: Close aux device if necessary */ 251 252 if(dllHandle) 253 UnregisterLxDll(dllHandle); 254 } 255 256 ULONG SYSTEM DLL_Init(ULONG hModule) 257 { 258 if (DLL_InitDefault(hModule) == -1) 259 return -1; 260 return DLL_InitWinMM32(hModule); 261 } 262 263 void SYSTEM DLL_Term(ULONG hModule) 264 { 265 DLL_TermWinMM32(hModule); 266 DLL_TermDefault(hModule); 267 }
Note:
See TracChangeset
for help on using the changeset viewer.
