[ros-diffs] [janderwald] 43941: - Implement IDirectSoundCaptureBuffer8::Lock, IDirectSoundCaptureBuffer8::Unlock - Fix pin handle leakage

janderwald at svn.reactos.org janderwald at svn.reactos.org
Tue Nov 3 23:11:43 CET 2009


Author: janderwald
Date: Tue Nov  3 23:11:43 2009
New Revision: 43941

URL: http://svn.reactos.org/svn/reactos?rev=43941&view=rev
Log:
- Implement IDirectSoundCaptureBuffer8::Lock, IDirectSoundCaptureBuffer8::Unlock
- Fix pin handle leakage

Modified:
    trunk/reactos/dll/directx/dsound_new/capturebuffer.c
    trunk/reactos/dll/directx/dsound_new/primary.c

Modified: trunk/reactos/dll/directx/dsound_new/capturebuffer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/capturebuffer.c?rev=43941&r1=43940&r2=43941&view=diff
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/capturebuffer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/capturebuffer.c [iso-8859-1] Tue Nov  3 23:11:43 2009
@@ -274,16 +274,50 @@
 WINAPI
 IDirectSoundCaptureBufferImpl_Lock(
     LPDIRECTSOUNDCAPTUREBUFFER8 iface,
-    DWORD dwReadCusor,
-    DWORD dwReadBytes,
-    LPVOID* lplpvAudioPtr1,
-    LPDWORD lpdwAudioBytes1,
-    LPVOID* lplpvAudioPtr2,
-    LPDWORD lpdwAudioBytes2,
+    DWORD dwOffset,
+    DWORD dwBytes,
+    LPVOID* ppvAudioPtr1,
+    LPDWORD pdwAudioBytes1,
+    LPVOID* ppvAudioPtr2,
+    LPDWORD pdwAudioBytes2,
     DWORD dwFlags )
 {
-    UNIMPLEMENTED
-    return DSERR_INVALIDPARAM;
+    LPCDirectSoundCaptureBufferImpl This = (LPCDirectSoundCaptureBufferImpl)CONTAINING_RECORD(iface, CDirectSoundCaptureBufferImpl, lpVtbl);
+
+    DPRINT("This %p dwOffset %u dwBytes %u ppvAudioPtr1 %p pdwAudioBytes1 %p ppvAudioPtr2 %p pdwAudioBytes2 %p dwFlags %x This->BufferSize %u\n",
+           This, dwOffset, dwBytes, ppvAudioPtr1, pdwAudioBytes1, ppvAudioPtr2, pdwAudioBytes2, dwFlags, This->BufferSize);
+
+    if (dwFlags == DSBLOCK_ENTIREBUFFER)
+    {
+        *ppvAudioPtr1 = (LPVOID)This->Buffer;
+        *pdwAudioBytes1 = This->BufferSize;
+        if (ppvAudioPtr2)
+            *ppvAudioPtr2 = NULL;
+        if (pdwAudioBytes2)
+            *pdwAudioBytes2 = 0;
+
+        return DS_OK;
+    }
+    else if (dwFlags & DSBLOCK_FROMWRITECURSOR)
+    {
+        UNIMPLEMENTED
+        return DSERR_UNSUPPORTED;
+    }
+    else
+    {
+        ASSERT(dwOffset < This->BufferSize);
+        ASSERT(dwBytes < This->BufferSize);
+        ASSERT(dwBytes + dwOffset <= This->BufferSize);
+
+        *ppvAudioPtr1 = This->Buffer + dwOffset;
+        *pdwAudioBytes1 = dwBytes;
+        if (ppvAudioPtr2)
+            *ppvAudioPtr2 = NULL;
+        if (pdwAudioBytes2)
+            *pdwAudioBytes2 = 0;
+
+        return DS_OK;
+    }
 }
 
 HRESULT
@@ -369,8 +403,7 @@
     LPVOID lpvAudioPtr2,
     DWORD dwAudioBytes2 )
 {
-    UNIMPLEMENTED
-    return DSERR_INVALIDPARAM;
+    return DS_OK;
 }
 
 HRESULT

Modified: trunk/reactos/dll/directx/dsound_new/primary.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dsound_new/primary.c?rev=43941&r1=43940&r2=43941&view=diff
==============================================================================
--- trunk/reactos/dll/directx/dsound_new/primary.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/dsound_new/primary.c [iso-8859-1] Tue Nov  3 23:11:43 2009
@@ -76,6 +76,12 @@
 
     if (!ref)
     {
+        if (This->hPin)
+        {
+            /* close pin handle */
+            CloseHandle(This->hPin);
+        }
+        /* free primary buffer */
         HeapFree(GetProcessHeap(), 0, This);
     }
 




More information about the Ros-diffs mailing list