Module: wine Branch: master Commit: 45f61965dc386f76c139adb358edc780d144a0f1 URL: https://gitlab.winehq.org/wine/wine/-/commit/45f61965dc386f76c139adb358edc78...
Author: Rémi Bernon rbernon@codeweavers.com Date: Thu Aug 31 17:21:09 2023 +0200
dmusic: Implement synth port IDirectMusicPortDownload_GetDLId.
---
dlls/dmusic/port.c | 12 ++++++++++-- dlls/dmusic/tests/dmusic.c | 8 ++++---- 2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index 7f61e2d1ef7..7cc30b525c1 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -40,6 +40,8 @@ struct synth_port { DMUS_PORTPARAMS params; int nrofgroups; DMUSIC_PRIVATE_CHANNEL_GROUP group[1]; + + DWORD next_dlid; };
static inline IDirectMusicDownloadedInstrumentImpl* impl_from_IDirectMusicDownloadedInstrument(IDirectMusicDownloadedInstrument *iface) @@ -595,11 +597,17 @@ static HRESULT WINAPI synth_port_download_AllocateBuffer(IDirectMusicPortDownloa return S_OK; }
-static HRESULT WINAPI synth_port_download_GetDLId(IDirectMusicPortDownload *iface, DWORD *start_DLId, DWORD count) +static HRESULT WINAPI synth_port_download_GetDLId(IDirectMusicPortDownload *iface, DWORD *first, DWORD count) { struct synth_port *This = synth_from_IDirectMusicPortDownload(iface);
- FIXME("(%p/%p, %p, %lu): stub\n", iface, This, start_DLId, count); + TRACE("(%p/%p, %p, %lu)\n", iface, This, first, count); + + if (!first) return E_POINTER; + if (!count) return E_INVALIDARG; + + *first = This->next_dlid; + This->next_dlid += count;
return S_OK; } diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c index 6df37e3d63d..05568208fee 100644 --- a/dlls/dmusic/tests/dmusic.c +++ b/dlls/dmusic/tests/dmusic.c @@ -1081,14 +1081,14 @@ static void test_port_download(void)
/* GetDLId allocates the given number of slots and returns only the first */ hr = IDirectMusicPortDownload_GetDLId(port, NULL, 0); - todo_wine ok(hr == E_POINTER, "got %#lx\n", hr); + ok(hr == E_POINTER, "got %#lx\n", hr); hr = IDirectMusicPortDownload_GetDLId(port, ids, 0); - todo_wine ok(hr == E_INVALIDARG, "got %#lx\n", hr); + ok(hr == E_INVALIDARG, "got %#lx\n", hr);
memset(ids, 0xcc, sizeof(ids)); hr = IDirectMusicPortDownload_GetDLId(port, ids, 4); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(ids[0] == 0, "got %#lx\n", ids[0]); + ok(ids[0] == 0, "got %#lx\n", ids[0]); ok(ids[1] == 0xcccccccc, "got %#lx\n", ids[1]);
/* GetBuffer looks up allocated ids to find downloaded buffers */ @@ -1168,7 +1168,7 @@ static void test_port_download(void) /* DLIds are never released */ hr = IDirectMusicPortDownload_GetDLId(port, ids, 1); ok(hr == S_OK, "got %#lx\n", hr); - todo_wine ok(ids[0] == 4, "got %#lx\n", ids[0]); + ok(ids[0] == 4, "got %#lx\n", ids[0]);
IDirectMusicDownload_Release(download);