Split the dmusic interfaces.
diff --git a/dlls/dmsynth/Makefile.in b/dlls/dmsynth/Makefile.in
index fcedb30..c9cc6d9 100644
--- a/dlls/dmsynth/Makefile.in
+++ b/dlls/dmsynth/Makefile.in
@@ -3,13 +3,17 @@
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = dmsynth.dll
-IMPORTS = dmusic kernel32
+IMPORTS = winmm ole32 user32 advapi32 kernel32
+EXTRALIBS = $(LIBUUID)
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
- dmsynth_main.c
+ dmsynth_main.c \
+ regsvr.c \
+ synth.c \
+ synthsink.c
RC_SRCS = version.rc
diff --git a/dlls/dmsynth/dmsynth.spec b/dlls/dmsynth/dmsynth.spec
index bd5a7b5..cfc6964 100644
--- a/dlls/dmsynth/dmsynth.spec
+++ b/dlls/dmsynth/dmsynth.spec
@@ -1,6 +1,4 @@
-# Linked to main dmusic.dll for easier implementation
-
-1 stdcall DllCanUnloadNow() dmusic.DllCanUnloadNow
-2 stdcall DllGetClassObject( long long ptr ) dmusic.DllGetClassObject
-3 stdcall DllRegisterServer() dmusic.DllRegisterServer
-4 stdcall DllUnregisterServer() dmusic.DllUnregisterServer
+1 stdcall DllCanUnloadNow() DMSYNTH_DllCanUnloadNow
+2 stdcall DllGetClassObject( long long ptr ) DMSYNTH_DllGetClassObject
+3 stdcall DllRegisterServer() DMSYNTH_DllRegisterServer
+4 stdcall DllUnregisterServer() DMSYNTH_DllUnregisterServer
diff --git a/dlls/dmsynth/dmsynth_main.c b/dlls/dmsynth/dmsynth_main.c
index 67a01ed..d7df8be 100644
--- a/dlls/dmsynth/dmsynth_main.c
+++ b/dlls/dmsynth/dmsynth_main.c
@@ -1 +1,141 @@
-/* nothing here yet */
+/* DirectMusicSynthesizer Main
+ *
+ * Copyright (C) 2003 Rok Mandeljc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "dmsynth_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
+
+
+/******************************************************************
+ * DirectMusicSynthesizer ClassFactory
+ *
+ *
+ */
+
+typedef struct
+{
+ /* IUnknown fields */
+ ICOM_VFIELD(IClassFactory);
+ DWORD ref;
+} IClassFactoryImpl;
+
+static HRESULT WINAPI DMSYCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
+{
+ ICOM_THIS(IClassFactoryImpl,iface);
+
+ FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI DMSYCF_AddRef(LPCLASSFACTORY iface)
+{
+ ICOM_THIS(IClassFactoryImpl,iface);
+ return ++(This->ref);
+}
+
+static ULONG WINAPI DMSYCF_Release(LPCLASSFACTORY iface)
+{
+ ICOM_THIS(IClassFactoryImpl,iface);
+ /* static class, won't be freed */
+ return --(This->ref);
+}
+
+static HRESULT WINAPI DMSYCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
+{
+ ICOM_THIS(IClassFactoryImpl,iface);
+
+ TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
+ if (IsEqualGUID (riid, &IID_IDirectMusicSynth) ||
+ IsEqualGUID (riid, &IID_IDirectMusicSynth8)) {
+ return DMUSIC_CreateDirectMusicSynth (riid, (LPDIRECTMUSICSYNTH8*)ppobj, pOuter);
+ } else if (IsEqualGUID (riid, &IID_IDirectMusicSynthSink)) {
+ return DMUSIC_CreateDirectMusicSynthSink (riid, (LPDIRECTMUSICSYNTHSINK*)ppobj, pOuter);
+ }
+ WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
+ return E_NOINTERFACE;
+}
+
+static HRESULT WINAPI DMSYCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
+{
+ ICOM_THIS(IClassFactoryImpl,iface);
+ FIXME("(%p)->(%d),stub!\n", This, dolock);
+ return S_OK;
+}
+
+static ICOM_VTABLE(IClassFactory) DMSYCF_Vtbl = {
+ ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+ DMSYCF_QueryInterface,
+ DMSYCF_AddRef,
+ DMSYCF_Release,
+ DMSYCF_CreateInstance,
+ DMSYCF_LockServer
+};
+
+static IClassFactoryImpl DMSYNTH_CF = {&DMSYCF_Vtbl, 1 };
+
+/******************************************************************
+ * DllMain
+ *
+ *
+ */
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ {
+ DisableThreadLibraryCalls(hinstDLL);
+ /* FIXME: Initialisation */
+ }
+ else if (fdwReason == DLL_PROCESS_DETACH)
+ {
+ /* FIXME: Cleanup */
+ }
+
+ return TRUE;
+}
+
+
+/******************************************************************
+ * DllCanUnloadNow (DMSYNTH.1)
+ *
+ *
+ */
+HRESULT WINAPI DMSYNTH_DllCanUnloadNow(void)
+{
+ FIXME("(void): stub\n");
+
+ return S_FALSE;
+}
+
+
+/******************************************************************
+ * DllGetClassObject (DMSYNTH.2)
+ *
+ *
+ */
+HRESULT WINAPI DMSYNTH_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
+{
+ TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+ if (IsEqualCLSID (&IID_IClassFactory, riid)) {
+ *ppv = (LPVOID) &DMSYNTH_CF;
+ IClassFactory_AddRef((IClassFactory*)*ppv);
+ return S_OK;
+ }
+ WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
diff --git a/dlls/dmsynth/dmsynth_private.h b/dlls/dmsynth/dmsynth_private.h
new file mode 100644
index 0000000..a255837
--- /dev/null
+++ b/dlls/dmsynth/dmsynth_private.h
@@ -0,0 +1,129 @@
+/* DirectMusicSynthesizer Private Include
+ *
+ * Copyright (C) 2003 Rok Mandeljc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __WINE_DMSYNTH_PRIVATE_H
+#define __WINE_DMSYNTH_PRIVATE_H
+
+#include "windef.h"
+#include "wine/debug.h"
+#include "winbase.h"
+#include "winnt.h"
+#include "dmusicc.h"
+#include "dmusici.h"
+#include "dmusics.h"
+#include "dmplugin.h"
+#include "dmusicf.h"
+#include "dsound.h"
+
+/*****************************************************************************
+ * Interfaces
+ */
+typedef struct IDirectMusicSynth8Impl IDirectMusicSynth8Impl;
+typedef struct IDirectMusicSynthSinkImpl IDirectMusicSynthSinkImpl;
+
+/*****************************************************************************
+ * Predeclare the interface implementation structures
+ */
+extern ICOM_VTABLE(IDirectMusicSynth8) DirectMusicSynth8_Vtbl;
+extern ICOM_VTABLE(IDirectMusicSynthSink) DirectMusicSynthSink_Vtbl;
+
+/*****************************************************************************
+ * ClassFactory
+ */
+/* can support IID_IDirectMusicSynth and IID_IDirectMusicSynth8
+ * return always an IDirectMusicSynthImpl
+ */
+extern HRESULT WINAPI DMUSIC_CreateDirectMusicSynth (LPCGUID lpcGUID, LPDIRECTMUSICSYNTH8* ppDMSynth, LPUNKNOWN pUnkOuter);
+/* can support IID_IDirectMusicSynthSink
+ * return always an IDirectMusicSynthSinkImpl
+ */
+extern HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSink (LPCGUID lpcGUID, LPDIRECTMUSICSYNTHSINK* ppDMSynthSink, LPUNKNOWN pUnkOuter);
+
+/*****************************************************************************
+ * IDirectMusicSynth8Impl implementation structure
+ */
+struct IDirectMusicSynth8Impl
+{
+ /* IUnknown fields */
+ ICOM_VFIELD(IDirectMusicSynth8);
+ DWORD ref;
+
+ /* IDirectMusicSynth8 fields */
+ DMUS_PORTCAPS pCaps;
+ BOOL fActive;
+ IReferenceClock* pLatencyClock;
+ IDirectMusicSynthSinkImpl* pSynthSink;
+};
+
+/* IUnknown: */
+extern HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface, REFIID riid, LPVOID *ppobj);
+extern ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface);
+extern ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface);
+/* IDirectMusicSynth: */
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Open (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTPARAMS pPortParams);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Close (LPDIRECTMUSICSYNTH8 iface);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_SetNumChannelGroups (LPDIRECTMUSICSYNTH8 iface, DWORD dwGroups);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Download (LPDIRECTMUSICSYNTH8 iface, LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Unload (LPDIRECTMUSICSYNTH8 iface, HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_PlayBuffer (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetRunningStats (LPDIRECTMUSICSYNTH8 iface, LPDMUS_SYNTHSTATS pStats);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTCAPS pCaps);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_SetMasterClock (LPDIRECTMUSICSYNTH8 iface, IReferenceClock* pClock);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock (LPDIRECTMUSICSYNTH8 iface, IReferenceClock** ppClock);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Activate (LPDIRECTMUSICSYNTH8 iface, BOOL fEnable);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_SetSynthSink (LPDIRECTMUSICSYNTH8 iface, IDirectMusicSynthSink* pSynthSink);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Render (LPDIRECTMUSICSYNTH8 iface, short* pBuffer, DWORD dwLength, LONGLONG llPosition);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_SetChannelPriority (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat (LPDIRECTMUSICSYNTH8 iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend (LPDIRECTMUSICSYNTH8 iface, DWORD* pdwAppend);
+/* IDirectMusicSynth8: */
+extern HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, long prPitch, long vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_StopVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_GetVoiceState (LPDIRECTMUSICSYNTH8 iface, DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[]);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_Refresh (LPDIRECTMUSICSYNTH8 iface, DWORD dwDownloadID, DWORD dwFlags);
+extern HRESULT WINAPI IDirectMusicSynth8Impl_AssignChannelToBuses (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses);
+
+/*****************************************************************************
+ * IDirectMusicSynthSinkImpl implementation structure
+ */
+struct IDirectMusicSynthSinkImpl
+{
+ /* IUnknown fields */
+ ICOM_VFIELD(IDirectMusicSynthSink);
+ DWORD ref;
+
+ /* IDirectMusicSynthSinkImpl fields */
+};
+
+/* IUnknown: */
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj);
+extern ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface);
+extern ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface);
+/* IDirectMusicSynthSinkImpl: */
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_Init (LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* pSynth);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_SetMasterClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock* pClock);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_GetLatencyClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock** ppClock);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_Activate (LPDIRECTMUSICSYNTHSINK iface, BOOL fEnable);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_SampleToRefTime (LPDIRECTMUSICSYNTHSINK iface, LONGLONG llSampleTime, REFERENCE_TIME* prfTime);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_RefTimeToSample (LPDIRECTMUSICSYNTHSINK iface, REFERENCE_TIME rfTime, LONGLONG* pllSampleTime);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer);
+extern HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples);
+
+#endif /* __WINE_DMSYNTH_PRIVATE_H */
diff --git a/dlls/dmsynth/regsvr.c b/dlls/dmsynth/regsvr.c
new file mode 100644
index 0000000..9a23de9
--- /dev/null
+++ b/dlls/dmsynth/regsvr.c
@@ -0,0 +1,560 @@
+/*
+ * self-registerable dll functions for dmsynth.dll
+ *
+ * Copyright (C) 2003 John K. Hohm
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <string.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winreg.h"
+#include "winerror.h"
+
+#include "dmusics.h"
+#include "dmusici.h"
+#include "dmplugin.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
+
+/*
+ * Near the bottom of this file are the exported DllRegisterServer and
+ * DllUnregisterServer, which make all this worthwhile.
+ */
+
+/***********************************************************************
+ * interface for self-registering
+ */
+struct regsvr_interface
+{
+ IID const *iid; /* NULL for end of list */
+ LPCSTR name; /* can be NULL to omit */
+ IID const *base_iid; /* can be NULL to omit */
+ int num_methods; /* can be <0 to omit */
+ CLSID const *ps_clsid; /* can be NULL to omit */
+ CLSID const *ps_clsid32; /* can be NULL to omit */
+};
+
+static HRESULT register_interfaces(struct regsvr_interface const *list);
+static HRESULT unregister_interfaces(struct regsvr_interface const *list);
+
+struct regsvr_coclass
+{
+ CLSID const *clsid; /* NULL for end of list */
+ LPCSTR name; /* can be NULL to omit */
+ LPCSTR ips; /* can be NULL to omit */
+ LPCSTR ips32; /* can be NULL to omit */
+ LPCSTR ips32_tmodel; /* can be NULL to omit */
+ LPCSTR progid; /* can be NULL to omit */
+ LPCSTR viprogid; /* can be NULL to omit */
+ LPCSTR progid_extra; /* can be NULL to omit */
+};
+
+static HRESULT register_coclasses(struct regsvr_coclass const *list);
+static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
+
+/***********************************************************************
+ * static string constants
+ */
+static WCHAR const interface_keyname[10] = {
+ 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
+static WCHAR const base_ifa_keyname[14] = {
+ 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
+ 'e', 0 };
+static WCHAR const num_methods_keyname[11] = {
+ 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
+static WCHAR const ps_clsid_keyname[15] = {
+ 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
+ 'i', 'd', 0 };
+static WCHAR const ps_clsid32_keyname[17] = {
+ 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
+ 'i', 'd', '3', '2', 0 };
+static WCHAR const clsid_keyname[6] = {
+ 'C', 'L', 'S', 'I', 'D', 0 };
+static WCHAR const curver_keyname[7] = {
+ 'C', 'u', 'r', 'V', 'e', 'r', 0 };
+static WCHAR const ips_keyname[13] = {
+ 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
+ 0 };
+static WCHAR const ips32_keyname[15] = {
+ 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
+ '3', '2', 0 };
+static WCHAR const progid_keyname[7] = {
+ 'P', 'r', 'o', 'g', 'I', 'D', 0 };
+static WCHAR const viprogid_keyname[25] = {
+ 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
+ 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D',
+ 0 };
+static char const tmodel_valuename[] = "ThreadingModel";
+
+/***********************************************************************
+ * static helper functions
+ */
+static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
+static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
+ WCHAR const *value);
+static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
+ char const *value);
+static LONG register_progid(WCHAR const *clsid,
+ char const *progid, char const *curver_progid,
+ char const *name, char const *extra);
+static LONG recursive_delete_key(HKEY key);
+static LONG recursive_delete_keyA(HKEY base, char const *name);
+static LONG recursive_delete_keyW(HKEY base, WCHAR const *name);
+
+/***********************************************************************
+ * register_interfaces
+ */
+static HRESULT register_interfaces(struct regsvr_interface const *list)
+{
+ LONG res = ERROR_SUCCESS;
+ HKEY interface_key;
+
+ res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
+ if (res != ERROR_SUCCESS) goto error_return;
+
+ for (; res == ERROR_SUCCESS && list->iid; ++list) {
+ WCHAR buf[39];
+ HKEY iid_key;
+
+ StringFromGUID2(list->iid, buf, 39);
+ res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
+ if (res != ERROR_SUCCESS) goto error_close_interface_key;
+
+ if (list->name) {
+ res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
+ (CONST BYTE*)(list->name),
+ strlen(list->name) + 1);
+ if (res != ERROR_SUCCESS) goto error_close_iid_key;
+ }
+
+ if (list->base_iid) {
+ register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
+ if (res != ERROR_SUCCESS) goto error_close_iid_key;
+ }
+
+ if (0 <= list->num_methods) {
+ static WCHAR const fmt[3] = { '%', 'd', 0 };
+ HKEY key;
+
+ res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &key, NULL);
+ if (res != ERROR_SUCCESS) goto error_close_iid_key;
+
+ wsprintfW(buf, fmt, list->num_methods);
+ res = RegSetValueExW(key, NULL, 0, REG_SZ,
+ (CONST BYTE*)buf,
+ (lstrlenW(buf) + 1) * sizeof(WCHAR));
+ RegCloseKey(key);
+
+ if (res != ERROR_SUCCESS) goto error_close_iid_key;
+ }
+
+ if (list->ps_clsid) {
+ register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
+ if (res != ERROR_SUCCESS) goto error_close_iid_key;
+ }
+
+ if (list->ps_clsid32) {
+ register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
+ if (res != ERROR_SUCCESS) goto error_close_iid_key;
+ }
+
+ error_close_iid_key:
+ RegCloseKey(iid_key);
+ }
+
+error_close_interface_key:
+ RegCloseKey(interface_key);
+error_return:
+ return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
+}
+
+/***********************************************************************
+ * unregister_interfaces
+ */
+static HRESULT unregister_interfaces(struct regsvr_interface const *list)
+{
+ LONG res = ERROR_SUCCESS;
+ HKEY interface_key;
+
+ res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
+ KEY_READ | KEY_WRITE, &interface_key);
+ if (res == ERROR_FILE_NOT_FOUND) return S_OK;
+ if (res != ERROR_SUCCESS) goto error_return;
+
+ for (; res == ERROR_SUCCESS && list->iid; ++list) {
+ WCHAR buf[39];
+
+ StringFromGUID2(list->iid, buf, 39);
+ res = recursive_delete_keyW(interface_key, buf);
+ }
+
+ RegCloseKey(interface_key);
+error_return:
+ return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
+}
+
+/***********************************************************************
+ * register_coclasses
+ */
+static HRESULT register_coclasses(struct regsvr_coclass const *list)
+{
+ LONG res = ERROR_SUCCESS;
+ HKEY coclass_key;
+
+ res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
+ if (res != ERROR_SUCCESS) goto error_return;
+
+ for (; res == ERROR_SUCCESS && list->clsid; ++list) {
+ WCHAR buf[39];
+ HKEY clsid_key;
+
+ StringFromGUID2(list->clsid, buf, 39);
+ res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
+ if (res != ERROR_SUCCESS) goto error_close_coclass_key;
+
+ if (list->name) {
+ res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
+ (CONST BYTE*)(list->name),
+ strlen(list->name) + 1);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+ }
+
+ if (list->ips) {
+ res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+ }
+
+ if (list->ips32) {
+ HKEY ips32_key;
+
+ res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL,
+ &ips32_key, NULL);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+
+ res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
+ (CONST BYTE*)list->ips32,
+ lstrlenA(list->ips32) + 1);
+ if (res == ERROR_SUCCESS && list->ips32_tmodel)
+ res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
+ (CONST BYTE*)list->ips32_tmodel,
+ strlen(list->ips32_tmodel) + 1);
+ RegCloseKey(ips32_key);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+ }
+
+ if (list->progid) {
+ res = register_key_defvalueA(clsid_key, progid_keyname,
+ list->progid);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+
+ res = register_progid(buf, list->progid, NULL,
+ list->name, list->progid_extra);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+ }
+
+ if (list->viprogid) {
+ res = register_key_defvalueA(clsid_key, viprogid_keyname,
+ list->viprogid);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+
+ res = register_progid(buf, list->viprogid, list->progid,
+ list->name, list->progid_extra);
+ if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+ }
+
+ error_close_clsid_key:
+ RegCloseKey(clsid_key);
+ }
+
+error_close_coclass_key:
+ RegCloseKey(coclass_key);
+error_return:
+ return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
+}
+
+/***********************************************************************
+ * unregister_coclasses
+ */
+static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
+{
+ LONG res = ERROR_SUCCESS;
+ HKEY coclass_key;
+
+ res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
+ KEY_READ | KEY_WRITE, &coclass_key);
+ if (res == ERROR_FILE_NOT_FOUND) return S_OK;
+ if (res != ERROR_SUCCESS) goto error_return;
+
+ for (; res == ERROR_SUCCESS && list->clsid; ++list) {
+ WCHAR buf[39];
+
+ StringFromGUID2(list->clsid, buf, 39);
+ res = recursive_delete_keyW(coclass_key, buf);
+ if (res != ERROR_SUCCESS) goto error_close_coclass_key;
+
+ if (list->progid) {
+ res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
+ if (res != ERROR_SUCCESS) goto error_close_coclass_key;
+ }
+
+ if (list->viprogid) {
+ res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->viprogid);
+ if (res != ERROR_SUCCESS) goto error_close_coclass_key;
+ }
+ }
+
+error_close_coclass_key:
+ RegCloseKey(coclass_key);
+error_return:
+ return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
+}
+
+/***********************************************************************
+ * regsvr_key_guid
+ */
+static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
+{
+ WCHAR buf[39];
+
+ StringFromGUID2(guid, buf, 39);
+ return register_key_defvalueW(base, name, buf);
+}
+
+/***********************************************************************
+ * regsvr_key_defvalueW
+ */
+static LONG register_key_defvalueW(
+ HKEY base,
+ WCHAR const *name,
+ WCHAR const *value)
+{
+ LONG res;
+ HKEY key;
+
+ res = RegCreateKeyExW(base, name, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &key, NULL);
+ if (res != ERROR_SUCCESS) return res;
+ res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
+ (lstrlenW(value) + 1) * sizeof(WCHAR));
+ RegCloseKey(key);
+ return res;
+}
+
+/***********************************************************************
+ * regsvr_key_defvalueA
+ */
+static LONG register_key_defvalueA(
+ HKEY base,
+ WCHAR const *name,
+ char const *value)
+{
+ LONG res;
+ HKEY key;
+
+ res = RegCreateKeyExW(base, name, 0, NULL, 0,
+ KEY_READ | KEY_WRITE, NULL, &key, NULL);
+ if (res != ERROR_SUCCESS) return res;
+ res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
+ lstrlenA(value) + 1);
+ RegCloseKey(key);
+ return res;
+}
+
+/***********************************************************************
+ * regsvr_progid
+ */
+static LONG register_progid(
+ WCHAR const *clsid,
+ char const *progid,
+ char const *curver_progid,
+ char const *name,
+ char const *extra)
+{
+ LONG res;
+ HKEY progid_key;
+
+ res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
+ NULL, 0, KEY_READ | KEY_WRITE, NULL,
+ &progid_key, NULL);
+ if (res != ERROR_SUCCESS) return res;
+
+ if (name) {
+ res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
+ (CONST BYTE*)name, strlen(name) + 1);
+ if (res != ERROR_SUCCESS) goto error_close_progid_key;
+ }
+
+ if (clsid) {
+ res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
+ if (res != ERROR_SUCCESS) goto error_close_progid_key;
+ }
+
+ if (curver_progid) {
+ res = register_key_defvalueA(progid_key, curver_keyname,
+ curver_progid);
+ if (res != ERROR_SUCCESS) goto error_close_progid_key;
+ }
+
+ if (extra) {
+ HKEY extra_key;
+
+ res = RegCreateKeyExA(progid_key, extra, 0,
+ NULL, 0, KEY_READ | KEY_WRITE, NULL,
+ &extra_key, NULL);
+ if (res == ERROR_SUCCESS)
+ RegCloseKey(extra_key);
+ }
+
+error_close_progid_key:
+ RegCloseKey(progid_key);
+ return res;
+}
+
+/***********************************************************************
+ * recursive_delete_key
+ */
+static LONG recursive_delete_key(HKEY key)
+{
+ LONG res;
+ WCHAR subkey_name[MAX_PATH];
+ DWORD cName;
+ HKEY subkey;
+
+ for (;;) {
+ cName = sizeof(subkey_name) / sizeof(WCHAR);
+ res = RegEnumKeyExW(key, 0, subkey_name, &cName,
+ NULL, NULL, NULL, NULL);
+ if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {
+ res = ERROR_SUCCESS; /* presumably we're done enumerating */
+ break;
+ }
+ res = RegOpenKeyExW(key, subkey_name, 0,
+ KEY_READ | KEY_WRITE, &subkey);
+ if (res == ERROR_FILE_NOT_FOUND) continue;
+ if (res != ERROR_SUCCESS) break;
+
+ res = recursive_delete_key(subkey);
+ RegCloseKey(subkey);
+ if (res != ERROR_SUCCESS) break;
+ }
+
+ if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0);
+ return res;
+}
+
+/***********************************************************************
+ * recursive_delete_keyA
+ */
+static LONG recursive_delete_keyA(HKEY base, char const *name)
+{
+ LONG res;
+ HKEY key;
+
+ res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
+ if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
+ if (res != ERROR_SUCCESS) return res;
+ res = recursive_delete_key(key);
+ RegCloseKey(key);
+ return res;
+}
+
+/***********************************************************************
+ * recursive_delete_keyW
+ */
+static LONG recursive_delete_keyW(HKEY base, WCHAR const *name)
+{
+ LONG res;
+ HKEY key;
+
+ res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key);
+ if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
+ if (res != ERROR_SUCCESS) return res;
+ res = recursive_delete_key(key);
+ RegCloseKey(key);
+ return res;
+}
+
+/***********************************************************************
+ * coclass list
+ */
+static struct regsvr_coclass const coclass_list[] = {
+ { &CLSID_DirectMusicSynth,
+ "DirectMusicSynth",
+ NULL,
+ "dmsynth.dll",
+ "Both",
+ "Microsoft.DirectMusicSynth.1",
+ "Microsoft.DirectMusicSynth",
+ },
+ { &CLSID_DirectMusicSynthSink,
+ "DirectMusicSynthSink",
+ NULL,
+ "dmsynth.dll",
+ "Both",
+ "Microsoft.DirectMusicSynthSink.1",
+ "Microsoft.DirectMusicSynthSink"
+ },
+ { NULL } /* list terminator */
+};
+
+/***********************************************************************
+ * interface list
+ */
+
+static struct regsvr_interface const interface_list[] = {
+ { NULL } /* list terminator */
+};
+
+/***********************************************************************
+ * DllRegisterServer (DMSYNTH.3)
+ */
+HRESULT WINAPI DMSYNTH_DllRegisterServer(void)
+{
+ HRESULT hr;
+
+ TRACE("\n");
+
+ hr = register_coclasses(coclass_list);
+ if (SUCCEEDED(hr))
+ hr = register_interfaces(interface_list);
+ return hr;
+}
+
+/***********************************************************************
+ * DllUnregisterServer (DMSYNTH.4)
+ */
+HRESULT WINAPI DMSYNTH_DllUnregisterServer(void)
+{
+ HRESULT hr;
+
+ TRACE("\n");
+
+ hr = unregister_coclasses(coclass_list);
+ if (SUCCEEDED(hr))
+ hr = unregister_interfaces(interface_list);
+ return hr;
+}
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c
new file mode 100644
index 0000000..10a965c
--- /dev/null
+++ b/dlls/dmsynth/synth.c
@@ -0,0 +1,338 @@
+/* IDirectMusicSynth8 Implementation
+ *
+ * Copyright (C) 2003 Rok Mandeljc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wingdi.h"
+#include "wine/debug.h"
+#include "winnls.h"
+
+#include "dmsynth_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
+
+/* IDirectMusicSynth8 IUnknown parts follow: */
+HRESULT WINAPI IDirectMusicSynth8Impl_QueryInterface (LPDIRECTMUSICSYNTH8 iface, REFIID riid, LPVOID *ppobj)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_IDirectMusicSynth) ||
+ IsEqualGUID(riid, &IID_IDirectMusicSynth8))
+ {
+ IDirectMusicSynth8Impl_AddRef(iface);
+ *ppobj = This;
+ return S_OK;
+ }
+ WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
+ return E_NOINTERFACE;
+}
+
+ULONG WINAPI IDirectMusicSynth8Impl_AddRef (LPDIRECTMUSICSYNTH8 iface)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+ TRACE("(%p) : AddRef from %ld\n", This, This->ref);
+ return ++(This->ref);
+}
+
+ULONG WINAPI IDirectMusicSynth8Impl_Release (LPDIRECTMUSICSYNTH8 iface)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+ ULONG ref = --This->ref;
+ TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
+ if (ref == 0)
+ {
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+ return ref;
+}
+
+/* IDirectMusicSynth Interface parts follow: */
+HRESULT WINAPI IDirectMusicSynth8Impl_Open (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTPARAMS pPortParams)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pPortParams);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_Close (LPDIRECTMUSICSYNTH8 iface)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p): stub\n", This);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_SetNumChannelGroups (LPDIRECTMUSICSYNTH8 iface, DWORD dwGroups)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %ld): stub\n", This, dwGroups);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_Download (LPDIRECTMUSICSYNTH8 iface, LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p, %p, %p): stub\n", This, phDownload, pvData, pbFree);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_Unload (LPDIRECTMUSICSYNTH8 iface, HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p, %p): stub\n", This, hDownload, hUserData);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_PlayBuffer (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %lli, %p, %ld): stub\n", This, rt, pbBuffer, cbBuffer);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetRunningStats (LPDIRECTMUSICSYNTH8 iface, LPDMUS_SYNTHSTATS pStats)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pStats);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetPortCaps (LPDIRECTMUSICSYNTH8 iface, LPDMUS_PORTCAPS pCaps)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ TRACE("(%p, %p)\n", This, pCaps);
+ *pCaps = This->pCaps;
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_SetMasterClock (LPDIRECTMUSICSYNTH8 iface, IReferenceClock* pClock)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pClock);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock (LPDIRECTMUSICSYNTH8 iface, IReferenceClock** ppClock)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ TRACE("(%p, %p)\n", This, ppClock);
+ *ppClock = This->pLatencyClock;
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_Activate (LPDIRECTMUSICSYNTH8 iface, BOOL fEnable)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ TRACE("(%p, %d)\n", This, fEnable);
+ This->fActive = fEnable;
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_SetSynthSink (LPDIRECTMUSICSYNTH8 iface, IDirectMusicSynthSink* pSynthSink)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ TRACE("(%p, %p)\n", This, pSynthSink);
+ This->pSynthSink = (IDirectMusicSynthSinkImpl*)pSynthSink;
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_Render (LPDIRECTMUSICSYNTH8 iface, short* pBuffer, DWORD dwLength, LONGLONG llPosition)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p, %ld, %lli): stub\n", This, pBuffer, dwLength, llPosition);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_SetChannelPriority (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority)
+{
+ /*ICOM_THIS(IDirectMusicSynth8Impl,iface); */
+
+ /* silenced because of too many messages - 1000 groups * 16 channels ;=) */
+ /*FIXME("(%p, %ld, %ld, %ld): stub\n", This, dwChannelGroup, dwChannel, dwPriority); */
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetChannelPriority (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %ld, %ld, %p): stub\n", This, dwChannelGroup, dwChannel, pdwPriority);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetFormat (LPDIRECTMUSICSYNTH8 iface, LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p, %p): stub\n", This, pWaveFormatEx, pdwWaveFormatExSiz);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetAppend (LPDIRECTMUSICSYNTH8 iface, DWORD* pdwAppend)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pdwAppend);
+
+ return S_OK;
+}
+
+/* IDirectMusicSynth8 Interface parts follow: */
+HRESULT WINAPI IDirectMusicSynth8Impl_PlayVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, long prPitch, long vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %lli, %ld, %ld, %ld, %ld, %li, %li,%lli, %lli, %lli): stub\n", This, rt, dwVoiceId, dwChannelGroup, dwChannel, dwDLId, prPitch, vrVolume, stVoiceStart, stLoopStart, stLoopEnd);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_StopVoice (LPDIRECTMUSICSYNTH8 iface, REFERENCE_TIME rt, DWORD dwVoiceId)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %lli, %ld): stub\n", This, rt, dwVoiceId);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_GetVoiceState (LPDIRECTMUSICSYNTH8 iface, DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[])
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %p, %ld, %p): stub\n", This, dwVoice, cbVoice, dwVoiceState);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_Refresh (LPDIRECTMUSICSYNTH8 iface, DWORD dwDownloadID, DWORD dwFlags)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %ld, %ld): stub\n", This, dwDownloadID, dwFlags);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynth8Impl_AssignChannelToBuses (LPDIRECTMUSICSYNTH8 iface, DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses)
+{
+ ICOM_THIS(IDirectMusicSynth8Impl,iface);
+
+ FIXME("(%p, %ld, %ld, %p, %ld): stub\n", This, dwChannelGroup, dwChannel, pdwBuses, cBuses);
+
+ return S_OK;
+}
+
+ICOM_VTABLE(IDirectMusicSynth8) DirectMusicSynth8_Vtbl =
+{
+ ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+ IDirectMusicSynth8Impl_QueryInterface,
+ IDirectMusicSynth8Impl_AddRef,
+ IDirectMusicSynth8Impl_Release,
+ IDirectMusicSynth8Impl_Open,
+ IDirectMusicSynth8Impl_Close,
+ IDirectMusicSynth8Impl_SetNumChannelGroups,
+ IDirectMusicSynth8Impl_Download,
+ IDirectMusicSynth8Impl_Unload,
+ IDirectMusicSynth8Impl_PlayBuffer,
+ IDirectMusicSynth8Impl_GetRunningStats,
+ IDirectMusicSynth8Impl_GetPortCaps,
+ IDirectMusicSynth8Impl_SetMasterClock,
+ IDirectMusicSynth8Impl_GetLatencyClock,
+ IDirectMusicSynth8Impl_Activate,
+ IDirectMusicSynth8Impl_SetSynthSink,
+ IDirectMusicSynth8Impl_Render,
+ IDirectMusicSynth8Impl_SetChannelPriority,
+ IDirectMusicSynth8Impl_GetChannelPriority,
+ IDirectMusicSynth8Impl_GetFormat,
+ IDirectMusicSynth8Impl_GetAppend,
+ IDirectMusicSynth8Impl_PlayVoice,
+ IDirectMusicSynth8Impl_StopVoice,
+ IDirectMusicSynth8Impl_GetVoiceState,
+ IDirectMusicSynth8Impl_Refresh,
+ IDirectMusicSynth8Impl_AssignChannelToBuses
+};
+
+/* for ClassFactory */
+HRESULT WINAPI DMUSIC_CreateDirectMusicSynth (LPCGUID lpcGUID, LPDIRECTMUSICSYNTH8* ppDMSynth, LPUNKNOWN pUnkOuter)
+{
+ IDirectMusicSynth8Impl *dmsynth;
+
+ TRACE("(%p,%p,%p)\n", lpcGUID, ppDMSynth, pUnkOuter);
+ if (IsEqualGUID (lpcGUID, &IID_IDirectMusicSynth) ||
+ IsEqualGUID (lpcGUID, &IID_IDirectMusicSynth8)) {
+ dmsynth = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynth8Impl));
+ if (NULL == dmsynth) {
+ *ppDMSynth = (LPDIRECTMUSICSYNTH8) NULL;
+ return E_OUTOFMEMORY;
+ }
+ dmsynth->lpVtbl = &DirectMusicSynth8_Vtbl;
+ dmsynth->ref = 1;
+ /* fill in caps */
+ dmsynth->pCaps.dwSize = sizeof(DMUS_PORTCAPS);
+ dmsynth->pCaps.dwFlags = DMUS_PC_DLS | DMUS_PC_SOFTWARESYNTH | DMUS_PC_DIRECTSOUND | DMUS_PC_DLS2 | DMUS_PC_AUDIOPATH | DMUS_PC_WAVE;
+ dmsynth->pCaps.guidPort = CLSID_DirectMusicSynth;
+ dmsynth->pCaps.dwClass = DMUS_PC_OUTPUTCLASS;
+ dmsynth->pCaps.dwType = DMUS_PORT_WINMM_DRIVER;
+ dmsynth->pCaps.dwMemorySize = DMUS_PC_SYSTEMMEMORY;
+ dmsynth->pCaps.dwMaxChannelGroups = 1000;
+ dmsynth->pCaps.dwMaxVoices = 1000;
+ dmsynth->pCaps.dwMaxAudioChannels = -1;
+ dmsynth->pCaps.dwEffectFlags = DMUS_EFFECT_REVERB | DMUS_EFFECT_CHORUS | DMUS_EFFECT_DELAY;
+ MultiByteToWideChar (CP_ACP, 0, "Microsotf Synthesizer", -1, dmsynth->pCaps.wszDescription, sizeof(dmsynth->pCaps.wszDescription)/sizeof(WCHAR));
+ /* assign latency clock */
+ /*DMUSIC_CreateReferenceClock (&IID_IReferenceClock, (LPREFERENCECLOCK*)&This->pLatencyClock, NULL); */
+
+ *ppDMSynth = (LPDIRECTMUSICSYNTH8) dmsynth;
+ return S_OK;
+ }
+ WARN("No interface found\n");
+
+ return E_NOINTERFACE;
+}
diff --git a/dlls/dmsynth/synthsink.c b/dlls/dmsynth/synthsink.c
new file mode 100644
index 0000000..0432f65
--- /dev/null
+++ b/dlls/dmsynth/synthsink.c
@@ -0,0 +1,174 @@
+/* IDirectMusicSynthSink Implementation
+ *
+ * Copyright (C) 2003 Rok Mandeljc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wingdi.h"
+#include "wine/debug.h"
+
+#include "dmsynth_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
+
+/* IDirectMusicSynthSink IUnknown parts follow: */
+HRESULT WINAPI IDirectMusicSynthSinkImpl_QueryInterface (LPDIRECTMUSICSYNTHSINK iface, REFIID riid, LPVOID *ppobj)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ if (IsEqualGUID(riid, &IID_IUnknown) ||
+ IsEqualGUID(riid, &IID_IDirectMusicSynthSink))
+ {
+ IDirectMusicSynthSinkImpl_AddRef(iface);
+ *ppobj = This;
+ return S_OK;
+ }
+ WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
+ return E_NOINTERFACE;
+}
+
+ULONG WINAPI IDirectMusicSynthSinkImpl_AddRef (LPDIRECTMUSICSYNTHSINK iface)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+ TRACE("(%p) : AddRef from %ld\n", This, This->ref);
+ return ++(This->ref);
+}
+
+ULONG WINAPI IDirectMusicSynthSinkImpl_Release (LPDIRECTMUSICSYNTHSINK iface)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+ ULONG ref = --This->ref;
+ TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
+ if (ref == 0)
+ {
+ HeapFree(GetProcessHeap(), 0, This);
+ }
+ return ref;
+}
+
+/* IDirectMusicSynth Interface follow: */
+HRESULT WINAPI IDirectMusicSynthSinkImpl_Init (LPDIRECTMUSICSYNTHSINK iface, IDirectMusicSynth* pSynth)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pSynth);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_SetMasterClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock* pClock)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pClock);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_GetLatencyClock (LPDIRECTMUSICSYNTHSINK iface, IReferenceClock** ppClock)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %p): stub\n", This, ppClock);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_Activate (LPDIRECTMUSICSYNTHSINK iface, BOOL fEnable)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %d): stub\n", This, fEnable);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_SampleToRefTime (LPDIRECTMUSICSYNTHSINK iface, LONGLONG llSampleTime, REFERENCE_TIME* prfTime)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %lli, %p): stub\n", This, llSampleTime, prfTime);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_RefTimeToSample (LPDIRECTMUSICSYNTHSINK iface, REFERENCE_TIME rfTime, LONGLONG* pllSampleTime)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %lli, %p): stub\n", This, rfTime, pllSampleTime );
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_SetDirectSound (LPDIRECTMUSICSYNTHSINK iface, LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %p, %p): stub\n", This, pDirectSound, pDirectSoundBuffer);
+
+ return S_OK;
+}
+
+HRESULT WINAPI IDirectMusicSynthSinkImpl_GetDesiredBufferSize (LPDIRECTMUSICSYNTHSINK iface, LPDWORD pdwBufferSizeInSamples)
+{
+ ICOM_THIS(IDirectMusicSynthSinkImpl,iface);
+
+ FIXME("(%p, %p): stub\n", This, pdwBufferSizeInSamples);
+
+ return S_OK;
+}
+
+ICOM_VTABLE(IDirectMusicSynthSink) DirectMusicSynthSink_Vtbl =
+{
+ ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+ IDirectMusicSynthSinkImpl_QueryInterface,
+ IDirectMusicSynthSinkImpl_AddRef,
+ IDirectMusicSynthSinkImpl_Release,
+ IDirectMusicSynthSinkImpl_Init,
+ IDirectMusicSynthSinkImpl_SetMasterClock,
+ IDirectMusicSynthSinkImpl_GetLatencyClock,
+ IDirectMusicSynthSinkImpl_Activate,
+ IDirectMusicSynthSinkImpl_SampleToRefTime,
+ IDirectMusicSynthSinkImpl_RefTimeToSample,
+ IDirectMusicSynthSinkImpl_SetDirectSound,
+ IDirectMusicSynthSinkImpl_GetDesiredBufferSize
+};
+
+/* for ClassFactory */
+HRESULT WINAPI DMUSIC_CreateDirectMusicSynthSink (LPCGUID lpcGUID, LPDIRECTMUSICSYNTHSINK* ppDMSynthSink, LPUNKNOWN pUnkOuter)
+{
+ IDirectMusicSynthSinkImpl *dmsink;
+
+ TRACE("(%p,%p,%p)\n", lpcGUID, ppDMSynthSink, pUnkOuter);
+ if (IsEqualGUID (lpcGUID, &IID_IDirectMusicSynthSink)) {
+ dmsink = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSynthSinkImpl));
+ if (NULL == dmsink) {
+ *ppDMSynthSink = (LPDIRECTMUSICSYNTHSINK) NULL;
+ return E_OUTOFMEMORY;
+ }
+ dmsink->lpVtbl = &DirectMusicSynthSink_Vtbl;
+ dmsink->ref = 1;
+ *ppDMSynthSink = (LPDIRECTMUSICSYNTHSINK) dmsink;
+ return S_OK;
+ }
+ WARN("No interface found\n");
+
+ return E_NOINTERFACE;
+}