Changeset 167 for sbliveos2/trunk/drv16/dwavestrm.cpp
- Timestamp:
- Mar 23, 2001, 12:33:12 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sbliveos2/trunk/drv16/dwavestrm.cpp
r166 r167 31 31 #include <dbgos2.h> 32 32 #include "ioctl.h" 33 #include "malloc.h" 33 34 34 35 … … 55 56 } 56 57 DevHelp_VMFree((LIN)temp->pBuffptr); 57 DevHelp_VMUnLock(temp->hLock); 58 DevHelp_VMUnLock(temp->linLock); 59 free(temp->pLock); 58 60 delete temp; 59 61 } … … 65 67 { 66 68 PSTREAMBUFFEREX pStreamBuf; 67 ULONG pGlobalAddr;68 LIN linAddr = (LIN)&pGlobalAddr;69 ULONG lock;70 LIN linLock = (LIN)&lock;69 LIN linAddr; 70 PULONG pLock; 71 ULONG PageListCount; 72 LIN linLock; 71 73 int rc; 72 74 73 rc = DevHelp_VirtToLin(SELECTOROF(linAddr), OFFSETOF(linAddr), &linAddr); 75 pLock = (PULONG)malloc(12); 76 if(pLock == NULL) { 77 DebugInt3(); 78 return 1; 79 } 80 81 rc = DevHelp_VirtToLin(SELECTOROF(pLock), OFFSETOF(pLock), &linLock); 74 82 if(rc) { 75 83 DebugInt3(); … … 77 85 } 78 86 79 rc = DevHelp_VirtToLin(SELECTOROF(linLock), OFFSETOF(linLock), &linLock); 87 rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE, (LIN)pbuf, uLength, -1L, linLock, (PULONG)&PageListCount); 88 if(rc) { 89 DebugInt3(); 90 DevHelp_VMFree(linAddr); 91 return rc; 92 } 93 94 rc = DevHelp_VMProcessToGlobal(VMDHGP_WRITE, (LIN)pbuf, uLength, (PLIN)&linAddr); 80 95 if(rc) { 81 96 DebugInt3(); … … 83 98 } 84 99 85 rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE, (LIN)pbuf, uLength, -1L, linLock, (PULONG)-1L); 86 if(rc) { 87 DebugInt3(); 88 return rc; 89 } 100 pStreamBuf = new STREAMBUFFEREX(uLength, (PSTREAMBUF)linAddr, linLock, pLock); 90 101 91 rc = DevHelp_VMProcessToGlobal(VMDHGP_WRITE, (LIN)pbuf, uLength, (PLIN)linAddr); 92 if(rc) { 93 return rc; 94 } 95 96 pStreamBuf = new STREAMBUFFEREX(uLength, (PSTREAMBUF)pGlobalAddr, lock); 97 98 return WAVESTREAM::Write((STREAMBUFFER *)pStreamBuf); 102 return WAVESTREAM::Write((PSTREAMBUFFER)pStreamBuf); 99 103 } 100 104 … … 111 115 else { 112 116 DevHelp_VMFree((LIN)temp->pBuffptr); 113 DevHelp_VMUnLock(temp->hLock); 117 DevHelp_VMUnLock(temp->linLock); 118 free(temp->pLock); 114 119 delete temp; 115 120 } … … 117 122 } 118 123 124 ULONG DWAVESTREAM::Register(PDDCMDREGISTER pReg) 125 { 126 hSem = pReg->hStream; 127 128 if(DevHelp_OpenEventSem(hSem) != 0) { 129 dprintf(("DevHlp_OpenEventSem %lx failed!", hSem)); 130 hSem = 0; 131 return 1; 132 } 133 return WAVESTREAM::Register(pReg); 134 } 135 136 void DWAVESTREAM::DeRegister(void) 137 { 138 if(DevHelp_CloseEventSem(hSem) != 0) { 139 dprintf(("DevHlp_CloseEventSemaphore %lx failed!", hSem)); 140 return; 141 } 142 hSem = 0; 143 WAVESTREAM::DeRegister(); 144 } 145 146 119 147 DWAVESTREAM::DWAVESTREAM(ULONG streamtype, LPMCI_AUDIO_INIT pinit, USHORT filesysnum): 120 WAVESTREAM(streamtype, pinit, filesysnum), fError(FALSE), hCtxHook(0) 148 WAVESTREAM(streamtype, pinit, filesysnum), fError(FALSE), hCtxHook(0), hSem(0) 121 149 { 122 150 if(DevHelp_AllocateCtxHook((NPFN)HookHandlerAsm, &hCtxHook)) { … … 132 160 StopStream(&cParm); 133 161 } 162 else ReturnBuffers(); 163 164 if(hSem) { 165 if(DevHelp_CloseEventSem(hSem) != 0) { 166 dprintf(("DevHlp_CloseEventSemaphore %lx failed!", hSem)); 167 } 168 } 134 169 if(hCtxHook) { 135 170 DevHelp_FreeCtxHook(hCtxHook);
Note:
See TracChangeset
for help on using the changeset viewer.