Michael Stefaniuc : dmstyle: Implement IDirectMusicStyle8_EnumMotif().

Alexandre Julliard julliard at winehq.org
Tue Nov 26 16:21:25 CST 2019


Module: wine
Branch: master
Commit: ce275f38a02dd5f809eea45ff3fa02f645b56a7c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ce275f38a02dd5f809eea45ff3fa02f645b56a7c

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Tue Nov 26 21:14:41 2019 +0100

dmstyle: Implement IDirectMusicStyle8_EnumMotif().

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmstyle/style.c | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c
index b3bce9bba2..5ebe6589d4 100644
--- a/dlls/dmstyle/style.c
+++ b/dlls/dmstyle/style.c
@@ -158,12 +158,37 @@ static HRESULT WINAPI IDirectMusicStyle8Impl_GetDefaultBand(IDirectMusicStyle8 *
 	return S_OK;
 }
 
-static HRESULT WINAPI IDirectMusicStyle8Impl_EnumMotif(IDirectMusicStyle8 *iface, DWORD dwIndex,
-        WCHAR *pwszName)
+static HRESULT WINAPI IDirectMusicStyle8Impl_EnumMotif(IDirectMusicStyle8 *iface, DWORD index,
+        WCHAR *name)
 {
-        IDirectMusicStyle8Impl *This = impl_from_IDirectMusicStyle8(iface);
-	FIXME("(%p, %d, %p): stub\n", This, dwIndex, pwszName);
-	return S_OK;
+    IDirectMusicStyle8Impl *This = impl_from_IDirectMusicStyle8(iface);
+    const struct style_motif *motif = NULL;
+    const struct list *cursor;
+    unsigned int i = 0;
+
+    TRACE("(%p, %u, %p)\n", This, index, name);
+
+    if (!name)
+        return E_POINTER;
+
+    /* index is zero based */
+    LIST_FOR_EACH(cursor, &This->motifs) {
+        if (i == index) {
+            motif = LIST_ENTRY(cursor, struct style_motif, entry);
+            break;
+        }
+        i++;
+    }
+    if (!motif)
+        return S_FALSE;
+
+    if (motif->desc.dwValidData & DMUS_OBJ_NAME)
+        lstrcpynW(name, motif->desc.wszName, DMUS_MAX_NAME);
+    else
+        name[0] = 0;
+
+    TRACE("returning name: %s\n", debugstr_w(name));
+    return S_OK;
 }
 
 static HRESULT WINAPI IDirectMusicStyle8Impl_GetMotif(IDirectMusicStyle8 *iface, WCHAR *pwszName,




More information about the wine-cvs mailing list