Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 1 | /* DirectMusicScript Main |
| 2 | * |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame] | 3 | * Copyright (C) 2003-2004 Rok Mandeljc |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 4 | * |
Alexandre Julliard | 7718d2b | 2007-05-30 12:54:07 +0200 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Alexandre Julliard | 7718d2b | 2007-05-30 12:54:07 +0200 | [diff] [blame] | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 14 | * |
Alexandre Julliard | 7718d2b | 2007-05-30 12:54:07 +0200 | [diff] [blame] | 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
Rob Shearman | 5dd2f1e | 2008-02-29 11:24:58 +0000 | [diff] [blame] | 20 | #include "config.h" |
| 21 | #include "wine/port.h" |
| 22 | |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 23 | #include "dmscript_private.h" |
Alexandre Julliard | e559640 | 2010-12-03 13:41:43 +0100 | [diff] [blame] | 24 | #include "rpcproxy.h" |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 25 | |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 26 | WINE_DEFAULT_DEBUG_CHANNEL(dmscript); |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 27 | |
Alexandre Julliard | e559640 | 2010-12-03 13:41:43 +0100 | [diff] [blame] | 28 | static HINSTANCE instance; |
James Hawkins | 0994b85 | 2005-02-02 09:31:28 +0000 | [diff] [blame] | 29 | LONG DMSCRIPT_refCount = 0; |
| 30 | |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame] | 31 | typedef struct { |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 32 | IClassFactory IClassFactory_iface; |
| 33 | HRESULT WINAPI (*fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter); |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 34 | } IClassFactoryImpl; |
| 35 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 36 | static HRESULT WINAPI create_unimpl_instance(REFIID riid, void **ppv, IUnknown *pUnkOuter) |
| 37 | { |
| 38 | FIXME("(%p, %s, %p) stub\n", pUnkOuter, debugstr_dmguid(riid), ppv); |
James Hawkins | 0994b85 | 2005-02-02 09:31:28 +0000 | [diff] [blame] | 39 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 40 | return E_NOINTERFACE; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 41 | } |
| 42 | |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 43 | /****************************************************************** |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 44 | * IClassFactory implementation |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 45 | */ |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 46 | static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) |
| 47 | { |
| 48 | return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 49 | } |
| 50 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 51 | static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) |
| 52 | { |
| 53 | if (ppv == NULL) |
| 54 | return E_POINTER; |
James Hawkins | 0994b85 | 2005-02-02 09:31:28 +0000 | [diff] [blame] | 55 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 56 | if (IsEqualGUID(&IID_IUnknown, riid)) |
| 57 | TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv); |
| 58 | else if (IsEqualGUID(&IID_IClassFactory, riid)) |
| 59 | TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv); |
| 60 | else { |
| 61 | FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv); |
| 62 | *ppv = NULL; |
| 63 | return E_NOINTERFACE; |
| 64 | } |
| 65 | |
| 66 | *ppv = iface; |
| 67 | IUnknown_AddRef((IUnknown*)*ppv); |
| 68 | return S_OK; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 69 | } |
| 70 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 71 | static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) |
| 72 | { |
| 73 | DMSCRIPT_LockModule(); |
James Hawkins | 0994b85 | 2005-02-02 09:31:28 +0000 | [diff] [blame] | 74 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 75 | return 2; /* non-heap based object */ |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 78 | static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) |
| 79 | { |
| 80 | DMSCRIPT_UnlockModule(); |
| 81 | |
| 82 | return 1; /* non-heap based object */ |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 85 | static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, |
| 86 | REFIID riid, void **ppv) |
| 87 | { |
| 88 | IClassFactoryImpl *This = impl_from_IClassFactory(iface); |
James Hawkins | 0994b85 | 2005-02-02 09:31:28 +0000 | [diff] [blame] | 89 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 90 | TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv); |
| 91 | |
| 92 | return This->fnCreateInstance(riid, ppv, pUnkOuter); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 95 | static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) |
| 96 | { |
| 97 | TRACE("(%d)\n", dolock); |
| 98 | |
| 99 | if (dolock) |
| 100 | DMSCRIPT_LockModule(); |
| 101 | else |
| 102 | DMSCRIPT_UnlockModule(); |
| 103 | |
| 104 | return S_OK; |
| 105 | } |
| 106 | |
| 107 | static const IClassFactoryVtbl classfactory_vtbl = { |
| 108 | ClassFactory_QueryInterface, |
| 109 | ClassFactory_AddRef, |
| 110 | ClassFactory_Release, |
| 111 | ClassFactory_CreateInstance, |
| 112 | ClassFactory_LockServer |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 113 | }; |
| 114 | |
Michael Stefaniuc | 6c1e349 | 2011-07-29 11:59:11 +0200 | [diff] [blame] | 115 | static IClassFactoryImpl ScriptAutoImplSegment_CF = {{&classfactory_vtbl}, create_unimpl_instance}; |
| 116 | static IClassFactoryImpl ScriptTrack_CF = {{&classfactory_vtbl}, |
| 117 | DMUSIC_CreateDirectMusicScriptTrack}; |
| 118 | static IClassFactoryImpl AudioVBScript_CF = {{&classfactory_vtbl}, create_unimpl_instance}; |
| 119 | static IClassFactoryImpl Script_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicScriptImpl}; |
| 120 | static IClassFactoryImpl ScriptAutoImplPerformance_CF = {{&classfactory_vtbl}, |
| 121 | create_unimpl_instance}; |
| 122 | static IClassFactoryImpl ScriptSourceCodeLoader_CF = {{&classfactory_vtbl}, create_unimpl_instance}; |
| 123 | static IClassFactoryImpl ScriptAutoImplSegmentState_CF = {{&classfactory_vtbl}, |
| 124 | create_unimpl_instance}; |
| 125 | static IClassFactoryImpl ScriptAutoImplAudioPathConfig_CF = {{&classfactory_vtbl}, |
| 126 | create_unimpl_instance}; |
| 127 | static IClassFactoryImpl ScriptAutoImplAudioPath_CF = {{&classfactory_vtbl}, |
| 128 | create_unimpl_instance}; |
| 129 | static IClassFactoryImpl ScriptAutoImplSong_CF = {{&classfactory_vtbl}, create_unimpl_instance}; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 130 | |
| 131 | /****************************************************************** |
| 132 | * DllMain |
| 133 | * |
| 134 | * |
| 135 | */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame] | 136 | BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { |
| 137 | if (fdwReason == DLL_PROCESS_ATTACH) { |
Alexandre Julliard | e559640 | 2010-12-03 13:41:43 +0100 | [diff] [blame] | 138 | instance = hinstDLL; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 139 | DisableThreadLibraryCalls(hinstDLL); |
| 140 | /* FIXME: Initialisation */ |
Rok Mandeljc | 0382ea1 | 2004-01-20 00:21:40 +0000 | [diff] [blame] | 141 | } else if (fdwReason == DLL_PROCESS_DETACH) { |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 142 | /* FIXME: Cleanup */ |
| 143 | } |
| 144 | |
| 145 | return TRUE; |
| 146 | } |
| 147 | |
| 148 | |
| 149 | /****************************************************************** |
Francois Gouget | 1de5d3c | 2005-08-10 14:45:58 +0000 | [diff] [blame] | 150 | * DllCanUnloadNow (DMSCRIPT.@) |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 151 | * |
| 152 | * |
| 153 | */ |
Alexandre Julliard | d37f0ab | 2005-08-08 17:35:28 +0000 | [diff] [blame] | 154 | HRESULT WINAPI DllCanUnloadNow(void) |
| 155 | { |
James Hawkins | 0994b85 | 2005-02-02 09:31:28 +0000 | [diff] [blame] | 156 | return DMSCRIPT_refCount != 0 ? S_FALSE : S_OK; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | |
| 160 | /****************************************************************** |
Vincent Béron | 21e3ba8 | 2005-08-10 09:53:47 +0000 | [diff] [blame] | 161 | * DllGetClassObject (DMSCRIPT.@) |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 162 | * |
| 163 | * |
| 164 | */ |
Alexandre Julliard | d37f0ab | 2005-08-08 17:35:28 +0000 | [diff] [blame] | 165 | HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) |
| 166 | { |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 167 | TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv); |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 168 | if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegment) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 169 | *ppv = &ScriptAutoImplSegment_CF; |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 170 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 171 | return S_OK; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 172 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptTrack) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 173 | *ppv = &ScriptTrack_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 174 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 175 | return S_OK; |
| 176 | } else if (IsEqualCLSID (rclsid, &CLSID_AudioVBScript) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 177 | *ppv = &AudioVBScript_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 178 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 179 | return S_OK; |
| 180 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScript) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 181 | *ppv = &Script_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 182 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 183 | return S_OK; |
| 184 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpPerformance) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 185 | *ppv = &ScriptAutoImplPerformance_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 186 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 187 | return S_OK; |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 188 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptSourceCodeLoader) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 189 | *ppv = &ScriptSourceCodeLoader_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 190 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 191 | return S_OK; |
| 192 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 193 | *ppv = &ScriptAutoImplSegmentState_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 194 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 195 | return S_OK; |
| 196 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPathConfig) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 197 | *ppv = &ScriptAutoImplAudioPathConfig_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 198 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 199 | return S_OK; |
| 200 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 201 | *ppv = &ScriptAutoImplAudioPath_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 202 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 203 | return S_OK; |
| 204 | } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSong) && IsEqualIID (riid, &IID_IClassFactory)) { |
Michael Stefaniuc | d62a0ee | 2009-01-13 10:56:48 +0100 | [diff] [blame] | 205 | *ppv = &ScriptAutoImplSong_CF; |
Rok Mandeljc | df167d1 | 2003-08-22 23:53:27 +0000 | [diff] [blame] | 206 | IClassFactory_AddRef((IClassFactory*)*ppv); |
| 207 | return S_OK; |
| 208 | } |
| 209 | |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 210 | WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv); |
Rok Mandeljc | 473c565 | 2003-07-21 22:10:14 +0000 | [diff] [blame] | 211 | return CLASS_E_CLASSNOTAVAILABLE; |
| 212 | } |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 213 | |
| 214 | |
Alexandre Julliard | e559640 | 2010-12-03 13:41:43 +0100 | [diff] [blame] | 215 | /*********************************************************************** |
| 216 | * DllRegisterServer (DMSCRIPT.@) |
| 217 | */ |
| 218 | HRESULT WINAPI DllRegisterServer(void) |
| 219 | { |
Alexandre Julliard | b56dc9a | 2011-08-02 15:51:55 +0200 | [diff] [blame] | 220 | return __wine_register_resources( instance ); |
Alexandre Julliard | e559640 | 2010-12-03 13:41:43 +0100 | [diff] [blame] | 221 | } |
| 222 | |
| 223 | /*********************************************************************** |
| 224 | * DllUnregisterServer (DMSCRIPT.@) |
| 225 | */ |
| 226 | HRESULT WINAPI DllUnregisterServer(void) |
| 227 | { |
Alexandre Julliard | b56dc9a | 2011-08-02 15:51:55 +0200 | [diff] [blame] | 228 | return __wine_unregister_resources( instance ); |
Alexandre Julliard | e559640 | 2010-12-03 13:41:43 +0100 | [diff] [blame] | 229 | } |
| 230 | |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 231 | /****************************************************************** |
| 232 | * Helper functions |
| 233 | * |
| 234 | * |
| 235 | */ |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 236 | |
| 237 | /* FOURCC to string conversion for debug messages */ |
| 238 | const char *debugstr_fourcc (DWORD fourcc) { |
| 239 | if (!fourcc) return "'null'"; |
| 240 | return wine_dbg_sprintf ("\'%c%c%c%c\'", |
| 241 | (char)(fourcc), (char)(fourcc >> 8), |
| 242 | (char)(fourcc >> 16), (char)(fourcc >> 24)); |
| 243 | } |
| 244 | |
| 245 | /* DMUS_VERSION struct to string conversion for debug messages */ |
Alexandre Julliard | a806d65 | 2008-12-01 13:25:18 +0100 | [diff] [blame] | 246 | static const char *debugstr_dmversion (const DMUS_VERSION *version) { |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 247 | if (!version) return "'null'"; |
| 248 | return wine_dbg_sprintf ("\'%i,%i,%i,%i\'", |
Marcus Meissner | 7c0de33 | 2006-11-09 15:42:46 +0100 | [diff] [blame] | 249 | (int)((version->dwVersionMS & 0xFFFF0000) >> 8), (int)(version->dwVersionMS & 0x0000FFFF), |
| 250 | (int)((version->dwVersionLS & 0xFFFF0000) >> 8), (int)(version->dwVersionLS & 0x0000FFFF)); |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | /* returns name of given GUID */ |
| 254 | const char *debugstr_dmguid (const GUID *id) { |
| 255 | static const guid_info guids[] = { |
| 256 | /* CLSIDs */ |
| 257 | GE(CLSID_AudioVBScript), |
| 258 | GE(CLSID_DirectMusic), |
| 259 | GE(CLSID_DirectMusicAudioPath), |
| 260 | GE(CLSID_DirectMusicAudioPathConfig), |
| 261 | GE(CLSID_DirectMusicAuditionTrack), |
| 262 | GE(CLSID_DirectMusicBand), |
| 263 | GE(CLSID_DirectMusicBandTrack), |
| 264 | GE(CLSID_DirectMusicChordMapTrack), |
| 265 | GE(CLSID_DirectMusicChordMap), |
| 266 | GE(CLSID_DirectMusicChordTrack), |
| 267 | GE(CLSID_DirectMusicCollection), |
| 268 | GE(CLSID_DirectMusicCommandTrack), |
| 269 | GE(CLSID_DirectMusicComposer), |
| 270 | GE(CLSID_DirectMusicContainer), |
| 271 | GE(CLSID_DirectMusicGraph), |
| 272 | GE(CLSID_DirectMusicLoader), |
| 273 | GE(CLSID_DirectMusicLyricsTrack), |
| 274 | GE(CLSID_DirectMusicMarkerTrack), |
| 275 | GE(CLSID_DirectMusicMelodyFormulationTrack), |
| 276 | GE(CLSID_DirectMusicMotifTrack), |
| 277 | GE(CLSID_DirectMusicMuteTrack), |
| 278 | GE(CLSID_DirectMusicParamControlTrack), |
| 279 | GE(CLSID_DirectMusicPatternTrack), |
| 280 | GE(CLSID_DirectMusicPerformance), |
| 281 | GE(CLSID_DirectMusicScript), |
| 282 | GE(CLSID_DirectMusicScriptAutoImpSegment), |
| 283 | GE(CLSID_DirectMusicScriptAutoImpPerformance), |
| 284 | GE(CLSID_DirectMusicScriptAutoImpSegmentState), |
| 285 | GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig), |
| 286 | GE(CLSID_DirectMusicScriptAutoImpAudioPath), |
| 287 | GE(CLSID_DirectMusicScriptAutoImpSong), |
| 288 | GE(CLSID_DirectMusicScriptSourceCodeLoader), |
| 289 | GE(CLSID_DirectMusicScriptTrack), |
| 290 | GE(CLSID_DirectMusicSection), |
| 291 | GE(CLSID_DirectMusicSegment), |
| 292 | GE(CLSID_DirectMusicSegmentState), |
| 293 | GE(CLSID_DirectMusicSegmentTriggerTrack), |
| 294 | GE(CLSID_DirectMusicSegTriggerTrack), |
| 295 | GE(CLSID_DirectMusicSeqTrack), |
| 296 | GE(CLSID_DirectMusicSignPostTrack), |
| 297 | GE(CLSID_DirectMusicSong), |
| 298 | GE(CLSID_DirectMusicStyle), |
| 299 | GE(CLSID_DirectMusicStyleTrack), |
| 300 | GE(CLSID_DirectMusicSynth), |
| 301 | GE(CLSID_DirectMusicSynthSink), |
| 302 | GE(CLSID_DirectMusicSysExTrack), |
| 303 | GE(CLSID_DirectMusicTemplate), |
| 304 | GE(CLSID_DirectMusicTempoTrack), |
| 305 | GE(CLSID_DirectMusicTimeSigTrack), |
| 306 | GE(CLSID_DirectMusicWaveTrack), |
| 307 | GE(CLSID_DirectSoundWave), |
| 308 | /* IIDs */ |
| 309 | GE(IID_IDirectMusic), |
| 310 | GE(IID_IDirectMusic2), |
| 311 | GE(IID_IDirectMusic8), |
| 312 | GE(IID_IDirectMusicAudioPath), |
| 313 | GE(IID_IDirectMusicBand), |
| 314 | GE(IID_IDirectMusicBuffer), |
| 315 | GE(IID_IDirectMusicChordMap), |
| 316 | GE(IID_IDirectMusicCollection), |
| 317 | GE(IID_IDirectMusicComposer), |
| 318 | GE(IID_IDirectMusicContainer), |
| 319 | GE(IID_IDirectMusicDownload), |
| 320 | GE(IID_IDirectMusicDownloadedInstrument), |
| 321 | GE(IID_IDirectMusicGetLoader), |
| 322 | GE(IID_IDirectMusicGraph), |
| 323 | GE(IID_IDirectMusicInstrument), |
| 324 | GE(IID_IDirectMusicLoader), |
| 325 | GE(IID_IDirectMusicLoader8), |
| 326 | GE(IID_IDirectMusicObject), |
| 327 | GE(IID_IDirectMusicPatternTrack), |
| 328 | GE(IID_IDirectMusicPerformance), |
| 329 | GE(IID_IDirectMusicPerformance2), |
| 330 | GE(IID_IDirectMusicPerformance8), |
| 331 | GE(IID_IDirectMusicPort), |
| 332 | GE(IID_IDirectMusicPortDownload), |
| 333 | GE(IID_IDirectMusicScript), |
| 334 | GE(IID_IDirectMusicSegment), |
| 335 | GE(IID_IDirectMusicSegment2), |
| 336 | GE(IID_IDirectMusicSegment8), |
| 337 | GE(IID_IDirectMusicSegmentState), |
| 338 | GE(IID_IDirectMusicSegmentState8), |
| 339 | GE(IID_IDirectMusicStyle), |
| 340 | GE(IID_IDirectMusicStyle8), |
| 341 | GE(IID_IDirectMusicSynth), |
| 342 | GE(IID_IDirectMusicSynth8), |
| 343 | GE(IID_IDirectMusicSynthSink), |
| 344 | GE(IID_IDirectMusicThru), |
| 345 | GE(IID_IDirectMusicTool), |
| 346 | GE(IID_IDirectMusicTool8), |
| 347 | GE(IID_IDirectMusicTrack), |
| 348 | GE(IID_IDirectMusicTrack8), |
| 349 | GE(IID_IUnknown), |
| 350 | GE(IID_IPersistStream), |
| 351 | GE(IID_IStream), |
| 352 | GE(IID_IClassFactory), |
| 353 | /* GUIDs */ |
| 354 | GE(GUID_DirectMusicAllTypes), |
| 355 | GE(GUID_NOTIFICATION_CHORD), |
| 356 | GE(GUID_NOTIFICATION_COMMAND), |
| 357 | GE(GUID_NOTIFICATION_MEASUREANDBEAT), |
| 358 | GE(GUID_NOTIFICATION_PERFORMANCE), |
| 359 | GE(GUID_NOTIFICATION_RECOMPOSE), |
| 360 | GE(GUID_NOTIFICATION_SEGMENT), |
| 361 | GE(GUID_BandParam), |
| 362 | GE(GUID_ChordParam), |
| 363 | GE(GUID_CommandParam), |
| 364 | GE(GUID_CommandParam2), |
| 365 | GE(GUID_CommandParamNext), |
| 366 | GE(GUID_IDirectMusicBand), |
| 367 | GE(GUID_IDirectMusicChordMap), |
| 368 | GE(GUID_IDirectMusicStyle), |
| 369 | GE(GUID_MuteParam), |
| 370 | GE(GUID_Play_Marker), |
| 371 | GE(GUID_RhythmParam), |
| 372 | GE(GUID_TempoParam), |
| 373 | GE(GUID_TimeSignature), |
| 374 | GE(GUID_Valid_Start_Time), |
| 375 | GE(GUID_Clear_All_Bands), |
| 376 | GE(GUID_ConnectToDLSCollection), |
| 377 | GE(GUID_Disable_Auto_Download), |
| 378 | GE(GUID_DisableTempo), |
| 379 | GE(GUID_DisableTimeSig), |
| 380 | GE(GUID_Download), |
| 381 | GE(GUID_DownloadToAudioPath), |
| 382 | GE(GUID_Enable_Auto_Download), |
| 383 | GE(GUID_EnableTempo), |
| 384 | GE(GUID_EnableTimeSig), |
| 385 | GE(GUID_IgnoreBankSelectForGM), |
| 386 | GE(GUID_SeedVariations), |
| 387 | GE(GUID_StandardMIDIFile), |
| 388 | GE(GUID_Unload), |
| 389 | GE(GUID_UnloadFromAudioPath), |
| 390 | GE(GUID_Variations), |
| 391 | GE(GUID_PerfMasterTempo), |
| 392 | GE(GUID_PerfMasterVolume), |
| 393 | GE(GUID_PerfMasterGrooveLevel), |
| 394 | GE(GUID_PerfAutoDownload), |
| 395 | GE(GUID_DefaultGMCollection), |
| 396 | GE(GUID_Synth_Default), |
| 397 | GE(GUID_Buffer_Reverb), |
| 398 | GE(GUID_Buffer_EnvReverb), |
| 399 | GE(GUID_Buffer_Stereo), |
| 400 | GE(GUID_Buffer_3D_Dry), |
| 401 | GE(GUID_Buffer_Mono), |
| 402 | GE(GUID_DMUS_PROP_GM_Hardware), |
| 403 | GE(GUID_DMUS_PROP_GS_Capable), |
| 404 | GE(GUID_DMUS_PROP_GS_Hardware), |
| 405 | GE(GUID_DMUS_PROP_DLS1), |
| 406 | GE(GUID_DMUS_PROP_DLS2), |
| 407 | GE(GUID_DMUS_PROP_Effects), |
| 408 | GE(GUID_DMUS_PROP_INSTRUMENT2), |
| 409 | GE(GUID_DMUS_PROP_LegacyCaps), |
| 410 | GE(GUID_DMUS_PROP_MemorySize), |
| 411 | GE(GUID_DMUS_PROP_SampleMemorySize), |
| 412 | GE(GUID_DMUS_PROP_SamplePlaybackRate), |
| 413 | GE(GUID_DMUS_PROP_SetSynthSink), |
| 414 | GE(GUID_DMUS_PROP_SinkUsesDSound), |
| 415 | GE(GUID_DMUS_PROP_SynthSink_DSOUND), |
| 416 | GE(GUID_DMUS_PROP_SynthSink_WAVE), |
| 417 | GE(GUID_DMUS_PROP_Volume), |
| 418 | GE(GUID_DMUS_PROP_WavesReverb), |
| 419 | GE(GUID_DMUS_PROP_WriteLatency), |
| 420 | GE(GUID_DMUS_PROP_WritePeriod), |
| 421 | GE(GUID_DMUS_PROP_XG_Capable), |
| 422 | GE(GUID_DMUS_PROP_XG_Hardware) |
| 423 | }; |
| 424 | |
| 425 | unsigned int i; |
| 426 | |
| 427 | if (!id) return "(null)"; |
| 428 | |
| 429 | for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) { |
Andrew Talbot | 5d0f2bb | 2007-09-21 00:02:21 +0100 | [diff] [blame] | 430 | if (IsEqualGUID(id, guids[i].guid)) |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 431 | return guids[i].name; |
| 432 | } |
| 433 | /* if we didn't find it, act like standard debugstr_guid */ |
| 434 | return debugstr_guid(id); |
| 435 | } |
| 436 | |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 437 | /* generic flag-dumping function */ |
Alexandre Julliard | a806d65 | 2008-12-01 13:25:18 +0100 | [diff] [blame] | 438 | static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){ |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 439 | char buffer[128] = "", *ptr = &buffer[0]; |
Andrew Talbot | 4a57874 | 2008-07-30 22:35:56 +0100 | [diff] [blame] | 440 | unsigned int i; |
| 441 | int size = sizeof(buffer); |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 442 | |
| 443 | for (i=0; i < num_names; i++) |
| 444 | { |
| 445 | if ((flags & names[i].val) || /* standard flag*/ |
| 446 | ((!flags) && (!names[i].val))) { /* zero value only */ |
| 447 | int cnt = snprintf(ptr, size, "%s ", names[i].name); |
| 448 | if (cnt < 0 || cnt >= size) break; |
| 449 | size -= cnt; |
| 450 | ptr += cnt; |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | return wine_dbg_sprintf("%s", buffer); |
| 455 | } |
| 456 | |
| 457 | /* dump DMUS_OBJ flags */ |
Alexandre Julliard | a806d65 | 2008-12-01 13:25:18 +0100 | [diff] [blame] | 458 | static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) { |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 459 | static const flag_info flags[] = { |
| 460 | FE(DMUS_OBJ_OBJECT), |
| 461 | FE(DMUS_OBJ_CLASS), |
| 462 | FE(DMUS_OBJ_NAME), |
| 463 | FE(DMUS_OBJ_CATEGORY), |
| 464 | FE(DMUS_OBJ_FILENAME), |
| 465 | FE(DMUS_OBJ_FULLPATH), |
| 466 | FE(DMUS_OBJ_URL), |
| 467 | FE(DMUS_OBJ_VERSION), |
| 468 | FE(DMUS_OBJ_DATE), |
| 469 | FE(DMUS_OBJ_LOADED), |
| 470 | FE(DMUS_OBJ_MEMORY), |
| 471 | FE(DMUS_OBJ_STREAM) |
| 472 | }; |
| 473 | return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); |
| 474 | } |
| 475 | |
| 476 | /* dump whole DMUS_OBJECTDESC struct */ |
| 477 | const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) { |
| 478 | if (pDesc) { |
| 479 | char buffer[1024] = "", *ptr = &buffer[0]; |
| 480 | |
| 481 | ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc); |
Michael Stefaniuc | 34a323d | 2006-10-08 23:52:35 +0200 | [diff] [blame] | 482 | ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize); |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 483 | ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData)); |
| 484 | if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass)); |
| 485 | if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject)); |
| 486 | if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n"); |
| 487 | if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion)); |
| 488 | if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName)); |
| 489 | if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory)); |
| 490 | if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName)); |
Stefan Leichter | 6a87f2b | 2006-09-13 22:30:06 +0200 | [diff] [blame] | 491 | if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n", |
| 492 | wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData); |
Rok Mandeljc | b26d65b | 2004-02-25 01:30:03 +0000 | [diff] [blame] | 493 | if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream); |
| 494 | |
| 495 | return wine_dbg_sprintf("%s", buffer); |
| 496 | } else { |
| 497 | return wine_dbg_sprintf("(NULL)"); |
| 498 | } |
| 499 | } |