Changeset 7196 for trunk/src/winmm/initwinmm.cpp
- Timestamp:
- Oct 25, 2001, 12:47:43 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/winmm/initwinmm.cpp
r6640 r7196 1 /* $Id: initwinmm.cpp,v 1. 3 2001-09-05 10:30:21 birdExp $1 /* $Id: initwinmm.cpp,v 1.4 2001-10-24 22:47:41 sandervl Exp $ 2 2 * 3 3 * WINMM DLL entry point … … 28 28 #define INCL_DOSPROCESS 29 29 #define INCL_DOSSEMAPHORES 30 #include <os2wrap.h> //Odin32 OS/2 api wrappers 30 #define INCL_DOSERRORS 31 #define INCL_OS2MM 32 #include <os2wrap.h> //Odin32 OS/2 api wrappers 33 #include <os2mewrap.h> //Odin32 OS/2 MMPM/2 api wrappers 31 34 #include <stdlib.h> 32 35 #include <stdio.h> … … 43 46 #include "waveoutbase.h" 44 47 #include <win\options.h> 48 #include "initwinmm.h" 45 49 46 50 #define DBG_LOCALLOG DBG_initterm … … 58 62 } 59 63 static HMODULE dllHandle = 0; 64 static HMODULE MMPMLibraryHandle = 0; 65 66 BOOL fMMPMAvailable = FALSE; 67 68 DWORD (APIENTRY *pfnmciSendCommand)(WORD wDeviceID, 69 WORD wMessage, 70 DWORD dwParam1, 71 PVOID dwParam2, 72 WORD wUserParm) = NULL; 73 DWORD (APIENTRY *pfnmciGetErrorString)(DWORD dwError, 74 LPSTR lpstrBuffer, 75 WORD wLength) = NULL; 60 76 61 77 //****************************************************************************** … … 63 79 BOOL WINAPI LibMainWinmm(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) 64 80 { 65 static BOOL bInitDone = FALSE; 81 static BOOL bInitDone = FALSE; 82 char szError[CCHMAXPATH]; 66 83 67 84 switch (fdwReason) … … 85 102 dwVolume = (dwVolume << 16) | dwVolume; 86 103 WaveOut::setDefaultVolume(dwVolume); 104 105 // try to load the MDM library, not MMPM directly!!! 106 if (DosLoadModule(szError, sizeof(szError), 107 "MDM.DLL", &MMPMLibraryHandle) != NO_ERROR) 108 { 109 // this system has no MMPM :-( 110 fMMPMAvailable = FALSE; 111 } 112 else 113 { 114 /* detect if MMPM is available */ 115 if (DosQueryProcAddr(MMPMLibraryHandle, 116 1, /* ORD_MCISENDCOMMAND */ 117 NULL, 118 (PFN*)&pfnmciSendCommand) != NO_ERROR) 119 { 120 fMMPMAvailable = FALSE; 121 } 122 else 123 { 124 fMMPMAvailable = TRUE; 125 } 126 127 /* see if we can get the address for the mciGetErrorString function */ 128 if (fMMPMAvailable == TRUE) 129 { 130 if (DosQueryProcAddr(MMPMLibraryHandle, 131 3, /* ORD_MCIGETERRORSTRING */ 132 NULL, 133 (PFN*)&pfnmciGetErrorString) != NO_ERROR) 134 pfnmciGetErrorString = NULL; 135 } 136 dprintf(("MMPM/2 is available; hmod %x", MMPMLibraryHandle)); 137 dprintf(("mciSendCommand %x", pfnmciSendCommand)); 138 dprintf(("mciGetErrorString %x", pfnmciGetErrorString)); 139 } 140 87 141 return TRUE; 88 142 } … … 96 150 auxOS2Close(); /* SvL: Close aux device if necessary */ 97 151 IRTMidiShutdown; /* JT: Shutdown RT Midi subsystem, if running. */ 152 153 if(MMPMLibraryHandle) DosFreeModule(MMPMLibraryHandle); 98 154 return TRUE; 99 155 } … … 144 200 //****************************************************************************** 145 201 //****************************************************************************** 146 147 148 202 DWORD APIENTRY mymciSendCommand(WORD wDeviceID, 203 WORD wMessage, 204 DWORD dwParam1, 205 PVOID dwParam2, 206 WORD wUserParm) 207 { 208 if(pfnmciSendCommand == NULL) { 209 DebugInt3(); 210 return MCIERR_CANNOT_LOAD_DRIVER; 211 } 212 USHORT sel = GetFS(); 213 DWORD ret = pfnmciSendCommand(wDeviceID, wMessage, dwParam1, dwParam2, wUserParm); 214 SetFS(sel); 215 return ret; 216 } 217 //****************************************************************************** 218 //****************************************************************************** 219 DWORD APIENTRY mymciGetErrorString(DWORD dwError, 220 LPSTR lpstrBuffer, 221 WORD wLength) 222 { 223 if(pfnmciGetErrorString == NULL) { 224 DebugInt3(); 225 return MCIERR_CANNOT_LOAD_DRIVER; 226 } 227 USHORT sel = GetFS(); 228 DWORD ret = pfnmciGetErrorString(dwError, lpstrBuffer, wLength); 229 SetFS(sel); 230 return ret; 231 } 232 //****************************************************************************** 233 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.