From 51942db8116dabd670854211e2bf4677b15eccc9 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Thu, 26 Apr 2012 08:08:26 +0200 Subject: [PATCH] dmusic: Handle GUID_NULL when creating IDirectMusicBuffer. --- dlls/dmusic/buffer.c | 7 ++++++- dlls/dmusic/tests/dmusic.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/dmusic/buffer.c b/dlls/dmusic/buffer.c index 838ceeed830..062627668a4 100644 --- a/dlls/dmusic/buffer.c +++ b/dlls/dmusic/buffer.c @@ -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); diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 1e55961a0e4..21607cb5f4e 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -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);