1 /* DirectMusicComposer Main
3 * Copyright (C) 2003-2004 Rok Mandeljc
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.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
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
35 #include "dmcompos_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(dmcompos
);
42 IClassFactory IClassFactory_iface
;
43 HRESULT (*fnCreateInstance
)(REFIID riid
, void **ret_iface
);
46 static HRESULT
create_direct_music_template(REFIID riid
, void **ret_iface
)
48 FIXME("(%s, %p) stub\n", debugstr_dmguid(riid
), ret_iface
);
50 return CLASS_E_CLASSNOTAVAILABLE
;
53 /******************************************************************
54 * IClassFactory implementation
56 static inline IClassFactoryImpl
*impl_from_IClassFactory(IClassFactory
*iface
)
58 return CONTAINING_RECORD(iface
, IClassFactoryImpl
, IClassFactory_iface
);
61 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
66 if (IsEqualGUID(&IID_IUnknown
, riid
))
67 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
68 else if (IsEqualGUID(&IID_IClassFactory
, riid
))
69 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
71 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
77 IUnknown_AddRef((IUnknown
*)*ppv
);
81 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
83 return 2; /* non-heap based object */
86 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
88 return 1; /* non-heap based object */
91 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pUnkOuter
,
92 REFIID riid
, void **ppv
)
94 IClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
96 TRACE ("(%p, %s, %p)\n", pUnkOuter
, debugstr_dmguid(riid
), ppv
);
100 return CLASS_E_NOAGGREGATION
;
103 return This
->fnCreateInstance(riid
, ppv
);
106 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
108 TRACE("(%d)\n", dolock
);
112 static const IClassFactoryVtbl classfactory_vtbl
= {
113 ClassFactory_QueryInterface
,
115 ClassFactory_Release
,
116 ClassFactory_CreateInstance
,
117 ClassFactory_LockServer
120 static IClassFactoryImpl ChordMap_CF
= {{&classfactory_vtbl
}, create_dmchordmap
};
121 static IClassFactoryImpl Composer_CF
= {{&classfactory_vtbl
}, create_dmcomposer
};
122 static IClassFactoryImpl ChordMapTrack_CF
= {{&classfactory_vtbl
}, create_dmchordmaptrack
};
123 static IClassFactoryImpl Template_CF
= {{&classfactory_vtbl
}, create_direct_music_template
};
124 static IClassFactoryImpl SignPostTrack_CF
= {{&classfactory_vtbl
}, create_dmsignposttrack
};
127 /******************************************************************
128 * DllGetClassObject (DMCOMPOS.@)
132 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
) {
133 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
134 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicChordMap
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
136 IClassFactory_AddRef((IClassFactory
*)*ppv
);
138 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicComposer
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
140 IClassFactory_AddRef((IClassFactory
*)*ppv
);
142 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicChordMapTrack
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
143 *ppv
= &ChordMapTrack_CF
;
144 IClassFactory_AddRef((IClassFactory
*)*ppv
);
146 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicTemplate
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
148 IClassFactory_AddRef((IClassFactory
*)*ppv
);
150 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicSignPostTrack
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
151 *ppv
= &SignPostTrack_CF
;
152 IClassFactory_AddRef((IClassFactory
*)*ppv
);
156 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
157 return CLASS_E_CLASSNOTAVAILABLE
;