1 /* DirectMusicLoader Main
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "dmloader_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmloader
);
27 ICOM_VFIELD(IClassFactory
);
31 /******************************************************************
32 * DirectMusicLoader ClassFactory
34 static HRESULT WINAPI
LoaderCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
36 ICOM_THIS(IClassFactoryImpl
,iface
);
38 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
42 static ULONG WINAPI
LoaderCF_AddRef(LPCLASSFACTORY iface
)
44 ICOM_THIS(IClassFactoryImpl
,iface
);
48 static ULONG WINAPI
LoaderCF_Release(LPCLASSFACTORY iface
)
50 ICOM_THIS(IClassFactoryImpl
,iface
);
51 /* static class, won't be freed */
55 static HRESULT WINAPI
LoaderCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
57 ICOM_THIS(IClassFactoryImpl
,iface
);
59 TRACE ("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
60 if (IsEqualIID (&IID_IDirectMusicLoader
, riid
) ||
61 IsEqualIID (&IID_IDirectMusicLoader8
, riid
)) {
62 return DMUSIC_CreateDirectMusicLoader(riid
, (LPDIRECTMUSICLOADER8
*) ppobj
, pOuter
);
65 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
69 static HRESULT WINAPI
LoaderCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
71 ICOM_THIS(IClassFactoryImpl
,iface
);
72 FIXME("(%p)->(%d),stub!\n", This
, dolock
);
76 static ICOM_VTABLE(IClassFactory
) LoaderCF_Vtbl
= {
77 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
78 LoaderCF_QueryInterface
,
81 LoaderCF_CreateInstance
,
85 static IClassFactoryImpl Loader_CF
= {&LoaderCF_Vtbl
, 1 };
87 /******************************************************************
88 * DirectMusicContainer ClassFactory
90 static HRESULT WINAPI
ContainerCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
92 ICOM_THIS(IClassFactoryImpl
,iface
);
94 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
98 static ULONG WINAPI
ContainerCF_AddRef(LPCLASSFACTORY iface
)
100 ICOM_THIS(IClassFactoryImpl
,iface
);
101 return ++(This
->ref
);
104 static ULONG WINAPI
ContainerCF_Release(LPCLASSFACTORY iface
)
106 ICOM_THIS(IClassFactoryImpl
,iface
);
107 /* static class, won't be freed */
108 return --(This
->ref
);
111 static HRESULT WINAPI
ContainerCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
113 ICOM_THIS(IClassFactoryImpl
,iface
);
115 TRACE ("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
116 if (IsEqualIID (riid
, &IID_IDirectMusicContainer
)) {
117 return DMUSIC_CreateDirectMusicContainer (riid
, (LPDIRECTMUSICCONTAINER
*) ppobj
, pOuter
);
118 } else if (IsEqualIID (riid
, &IID_IDirectMusicObject
)) {
119 return DMUSIC_CreateDirectMusicContainerObject (riid
, (LPDIRECTMUSICOBJECT
*) ppobj
, pOuter
);
122 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
123 return E_NOINTERFACE
;
126 static HRESULT WINAPI
ContainerCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
128 ICOM_THIS(IClassFactoryImpl
,iface
);
129 FIXME("(%p)->(%d),stub!\n", This
, dolock
);
133 static ICOM_VTABLE(IClassFactory
) ContainerCF_Vtbl
= {
134 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
135 ContainerCF_QueryInterface
,
138 ContainerCF_CreateInstance
,
139 ContainerCF_LockServer
142 static IClassFactoryImpl Container_CF
= {&ContainerCF_Vtbl
, 1 };
144 /******************************************************************
149 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
151 if (fdwReason
== DLL_PROCESS_ATTACH
)
153 DisableThreadLibraryCalls(hinstDLL
);
154 /* FIXME: Initialisation */
156 else if (fdwReason
== DLL_PROCESS_DETACH
)
165 /******************************************************************
166 * DllCanUnloadNow (DMLOADER.1)
170 HRESULT WINAPI
DMLOADER_DllCanUnloadNow(void)
172 FIXME("(void): stub\n");
178 /******************************************************************
179 * DllGetClassObject (DMLOADER.2)
183 HRESULT WINAPI
DMLOADER_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
185 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
186 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicLoader
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
187 *ppv
= (LPVOID
) &Loader_CF
;
188 IClassFactory_AddRef((IClassFactory
*)*ppv
);
190 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicContainer
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
191 *ppv
= (LPVOID
) &Container_CF
;
192 IClassFactory_AddRef((IClassFactory
*)*ppv
);
196 WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
197 return CLASS_E_CLASSNOTAVAILABLE
;