ReactOS 0.4.17-dev-934-g091855f
dswave_main.c
Go to the documentation of this file.
1/* DirectMusic Wave 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
21#include <stdio.h>
22#include <stdarg.h>
23
24#define COBJMACROS
25
26#include "windef.h"
27#include "winbase.h"
28#include "winnt.h"
29#include "wingdi.h"
30#include "winuser.h"
31#include "winreg.h"
32#include "objbase.h"
33#include "rpcproxy.h"
34#include "initguid.h"
35#include "dmusici.h"
36
37#include "dswave_private.h"
38#include "dmusic_wave.h"
39#include "dmobject.h"
40
42
43typedef struct {
44 IClassFactory IClassFactory_iface;
46
47/******************************************************************
48 * DirectMusicWave ClassFactory
49 */
51{
52 if (ppv == NULL)
53 return E_POINTER;
54
56 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
58 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
59 else {
60 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
61 *ppv = NULL;
62 return E_NOINTERFACE;
63 }
64
65 *ppv = iface;
66 IUnknown_AddRef((IUnknown*)*ppv);
67 return S_OK;
68}
69
71{
72 return 2; /* non-heap based object */
73}
74
76{
77 return 1; /* non-heap based object */
78}
79
81 void **ret_iface)
82{
83 IDirectMusicObject *object;
84 HRESULT hr;
85
86 TRACE("(%p, %s, %p)\n", outer_unk, debugstr_dmguid(riid), ret_iface);
87
88 *ret_iface = NULL;
89 if (outer_unk) return CLASS_E_NOAGGREGATION;
90 if (FAILED(hr = wave_create(&object))) return hr;
91 hr = IDirectMusicObject_QueryInterface(object, riid, ret_iface);
93 return hr;
94}
95
97{
98 TRACE("(%d)\n", dolock);
99 return S_OK;
100}
101
102static const IClassFactoryVtbl WaveCF_Vtbl = {
108};
109
111
112/******************************************************************
113 * DllGetClassObject (DSWAVE.@)
114 *
115 *
116 */
118{
119 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
120 if (IsEqualCLSID (rclsid, &CLSID_DirectSoundWave) && IsEqualIID (riid, &IID_IClassFactory)) {
121 *ppv = &Wave_CF;
122 IClassFactory_AddRef((IClassFactory*)*ppv);
123 return S_OK;
124 }
125
126 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
128}
#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
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
const char * debugstr_dmguid(const GUID *id)
Definition: dmobject.c:36
HRESULT wave_create(IDirectMusicObject **ret_iface)
Definition: wave.c:277
#define IDirectMusicObject_QueryInterface(p, a, b)
Definition: dmusici.h:842
#define IDirectMusicObject_Release(p)
Definition: dmusici.h:844
static ULONG WINAPI WaveCF_Release(IClassFactory *iface)
Definition: dswave_main.c:75
static HRESULT WINAPI WaveCF_CreateInstance(IClassFactory *iface, IUnknown *outer_unk, REFIID riid, void **ret_iface)
Definition: dswave_main.c:80
static IClassFactoryImpl Wave_CF
Definition: dswave_main.c:110
static const IClassFactoryVtbl WaveCF_Vtbl
Definition: dswave_main.c:102
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: dswave_main.c:117
static HRESULT WINAPI WaveCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: dswave_main.c:96
static ULONG WINAPI WaveCF_AddRef(IClassFactory *iface)
Definition: dswave_main.c:70
static HRESULT WINAPI WaveCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: dswave_main.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#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
uint32_t ULONG
Definition: typedefs.h:59
#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