ReactOS 0.4.17-dev-934-g091855f
dmband_main.c
Go to the documentation of this file.
1/* DirectMusicBand 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 "initguid.h"
21#include "dmband_private.h"
22#include "rpcproxy.h"
23#include "dmusic_band.h"
24#include "dmobject.h"
25
27
28typedef struct {
29 IClassFactory IClassFactory_iface;
30 HRESULT (*fnCreateInstance)(REFIID riid, void **ret_iface);
32
33/******************************************************************
34 * IClassFactory implementation
35 */
37{
38 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
39}
40
42{
43 if (ppv == NULL)
44 return E_POINTER;
45
47 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
49 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
50 else {
51 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
52 *ppv = NULL;
53 return E_NOINTERFACE;
54 }
55
56 *ppv = iface;
57 IClassFactory_AddRef(iface);
58 return S_OK;
59}
60
62{
63 return 2; /* non-heap based object */
64}
65
67{
68 return 1; /* non-heap based object */
69}
70
72 REFIID riid, void **ppv)
73{
75
76 TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv);
77
78 if (pUnkOuter) {
79 *ppv = NULL;
81 }
82
83 return This->fnCreateInstance(riid, ppv);
84}
85
87{
88 TRACE("(%d)\n", dolock);
89 return S_OK;
90}
91
92static const IClassFactoryVtbl classfactory_vtbl = {
98};
99
102
103
104/******************************************************************
105 * DllGetClassObject (DMBAND.@)
106 *
107 *
108 */
110{
111 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
112
113 if (IsEqualCLSID(rclsid, &CLSID_DirectMusicBand))
114 return IClassFactory_QueryInterface(&Band_CF.IClassFactory_iface, riid, ppv);
115 else if (IsEqualCLSID(rclsid, &CLSID_DirectMusicBandTrack))
116 return IClassFactory_QueryInterface(&BandTrack_CF.IClassFactory_iface, riid, ppv);
117
118 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
120}
HRESULT create_dmband(REFIID lpcGUID, void **ppobj)
Definition: band.c:457
HRESULT create_dmbandtrack(REFIID lpcGUID, void **ppobj)
Definition: bandtrack.c:653
#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
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
Definition: dmband_main.c:86
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv)
Definition: dmband_main.c:71
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: dmband_main.c:66
static IClassFactoryImpl Band_CF
Definition: dmband_main.c:100
static const IClassFactoryVtbl classfactory_vtbl
Definition: dmband_main.c:92
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: dmband_main.c:41
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: dmband_main.c:109
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: dmband_main.c:61
static IClassFactoryImpl BandTrack_CF
Definition: dmband_main.c:101
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: dmband_main.c:36
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 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