- Merge from trunk up to r45543
[reactos.git] / dll / directx / dsound_new / directsound.c
index 754f56b..8a630c2 100644 (file)
@@ -121,6 +121,12 @@ IDirectSound8_fnCreateSoundBuffer(
             return DSERR_INVALIDPARAM;
         }
 
+        if (lpcDSBufferDesc->dwBufferBytes != 0)
+        {
+            /* buffer size must be zero for primary sound buffer */
+            return DSERR_INVALIDPARAM;
+        }
+
         if (This->PrimaryBuffer)
         {
             /* primary buffer already exists */
@@ -129,7 +135,7 @@ IDirectSound8_fnCreateSoundBuffer(
             return S_OK;
         }
 
-        hResult = NewPrimarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel);
+        hResult = NewPrimarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel, lpcDSBufferDesc->dwFlags);
         if (SUCCEEDED(hResult))
         {
             /* store primary buffer */
@@ -145,9 +151,15 @@ IDirectSound8_fnCreateSoundBuffer(
             return DSERR_INVALIDPARAM;
         }
 
+        if (lpcDSBufferDesc->dwBufferBytes < DSBSIZE_MIN || lpcDSBufferDesc->dwBufferBytes > DSBSIZE_MAX)
+        {
+            /* buffer size must be within bounds for secondary sound buffer*/
+            return DSERR_INVALIDPARAM;
+        }
+
         if (!This->PrimaryBuffer)
         {
-            hResult = NewPrimarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel);
+            hResult = NewPrimarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel, lpcDSBufferDesc->dwFlags);
             if (SUCCEEDED(hResult))
             {
                 /* store primary buffer */