ReactOS 0.4.17-dev-934-g091855f
dmloader_main.c
Go to the documentation of this file.
1/* DirectMusicLoader Main
2 *
3 * Copyright (C) 2003-2004 Rok Mandeljc
4 *
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.
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
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
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
18 */
19
20#include <stdarg.h>
21
22#define COBJMACROS
23
24#include "windef.h"
25#include "winbase.h"
26#include "winnt.h"
27#include "wingdi.h"
28#include "winuser.h"
29#include "winreg.h"
30#include "objbase.h"
31#include "rpcproxy.h"
32#include "initguid.h"
33#include "dmusici.h"
34
35#include "dmloader_private.h"
36
38
39typedef struct {
40 IClassFactory IClassFactory_iface;
43
44/******************************************************************
45 * IClassFactory implementation
46 */
48{
49 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
50}
51
53{
54 if (ppv == NULL)
55 return E_POINTER;
56
58 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
60 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
61 else {
62 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
63 *ppv = NULL;
64 return E_NOINTERFACE;
65}
66
67 *ppv = iface;
68 IClassFactory_AddRef(iface);
69 return S_OK;
70}
71
73{
74 return 2; /* non-heap based object */
75}
76
78{
79 return 1; /* non-heap based object */
80}
81
83 REFIID riid, void **ret_iface)
84{
86
87 TRACE ("(%s, %p)\n", debugstr_dmguid(riid), ret_iface);
88
89 if (pUnkOuter) {
90 *ret_iface = NULL;
92 }
93
94 return This->fnCreateInstance(riid, ret_iface);
95}
96
98{
99 TRACE("(%d)\n", dolock);
100 return S_OK;
101}
102
103static const IClassFactoryVtbl classfactory_vtbl = {
109};
110
113
114
115/******************************************************************
116 * DllGetClassObject (DMLOADER.@)
117 */
119{
120 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
121 if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
122 IClassFactory_AddRef(&dm_loader_CF.IClassFactory_iface);
124 return S_OK;
125 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicContainer) && IsEqualIID (riid, &IID_IClassFactory)) {
126 IClassFactory_AddRef(&dm_container_CF.IClassFactory_iface);
128 return S_OK;
129 }
130
131 WARN(": no class found\n");
133}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define NULL
Definition: types.h:112
HRESULT create_dmcontainer(REFIID lpcGUID, void **ppobj)
Definition: container.c:649
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: dmloader_main.c:97
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: dmloader_main.c:77
static IClassFactoryImpl dm_loader_CF
static const IClassFactoryVtbl classfactory_vtbl
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: dmloader_main.c:52
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ret_iface)
Definition: dmloader_main.c:82
static IClassFactoryImpl dm_container_CF
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: dmloader_main.c:72
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dmloader_main.c:47
HRESULT create_dmloader(REFIID riid, void **ret_iface)
Definition: loader.c:910
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
unsigned int BOOL
Definition: ntddk_ex.h:94
HRESULT(* fnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: hnetcfg.c:35
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define TRACE(s)
Definition: solgame.cpp:4
IClassFactory IClassFactory_iface
Definition: main.c:44
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define E_POINTER
Definition: winerror.h:3480
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772