dmusic: Handle GUID_NULL when creating IDirectMusicBuffer.

This commit is contained in:
Christian Costa 2012-04-26 08:08:26 +02:00 committed by Alexandre Julliard
parent 0a588385fb
commit 51942db811
2 changed files with 7 additions and 2 deletions

View File

@ -18,6 +18,8 @@
*/
#include "dmusic_private.h"
#include "initguid.h"
#include "dmksctrl.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
@ -242,7 +244,10 @@ HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_i
dmbuffer->IDirectMusicBuffer_iface.lpVtbl = &DirectMusicBuffer_Vtbl;
dmbuffer->ref = 0; /* Will be inited by QueryInterface */
memcpy(&dmbuffer->format, &desc->guidBufferFormat, sizeof(GUID));
if (IsEqualGUID(&desc->guidBufferFormat, &GUID_NULL))
dmbuffer->format = KSDATAFORMAT_SUBTYPE_MIDI;
else
dmbuffer->format = desc->guidBufferFormat;
dmbuffer->size = (desc->cbBuffer + 3) & ~3; /* Buffer size must be multiple of 4 bytes */
dmbuffer->data = HeapAlloc(GetProcessHeap(), 0, dmbuffer->size);

View File

@ -130,7 +130,7 @@ static void test_dmbuffer(void)
hr = IDirectMusicBuffer_GetBufferFormat(dmbuffer, &format);
ok(hr == S_OK, "IDirectMusicBuffer_GetBufferFormat returned %x\n", hr);
todo_wine ok(IsEqualGUID(&format, &KSDATAFORMAT_SUBTYPE_MIDI), "Wrong format returned %s\n", debugstr_guid(&format));
ok(IsEqualGUID(&format, &KSDATAFORMAT_SUBTYPE_MIDI), "Wrong format returned %s\n", debugstr_guid(&format));
hr = IDirectMusicBuffer_GetMaxBytes(dmbuffer, &size);
ok(hr == S_OK, "IDirectMusicBuffer_GetMaxBytes returned %x\n", hr);
ok(size == 1024, "Buffer size is %u instead of 1024\n", size);