1 /* DirectMusic Wave 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
37 #include "dswave_private.h"
40 WINE_DEFAULT_DEBUG_CHANNEL(dswave
);
42 LONG DSWAVE_refCount
= 0;
45 IClassFactory IClassFactory_iface
;
48 /******************************************************************
49 * DirectMusicWave ClassFactory
51 static HRESULT WINAPI
WaveCF_QueryInterface(IClassFactory
* iface
, REFIID riid
, void **ppv
)
56 if (IsEqualGUID(&IID_IUnknown
, riid
))
57 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
58 else if (IsEqualGUID(&IID_IClassFactory
, riid
))
59 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
61 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
67 IUnknown_AddRef((IUnknown
*)*ppv
);
71 static ULONG WINAPI
WaveCF_AddRef(IClassFactory
* iface
)
75 return 2; /* non-heap based object */
78 static ULONG WINAPI
WaveCF_Release(IClassFactory
* iface
)
80 DSWAVE_UnlockModule();
82 return 1; /* non-heap based object */
85 static HRESULT WINAPI
WaveCF_CreateInstance(IClassFactory
* iface
, IUnknown
*outer_unk
, REFIID riid
,
88 TRACE ("(%p, %s, %p)\n", outer_unk
, debugstr_dmguid(riid
), ret_iface
);
92 return CLASS_E_NOAGGREGATION
;
95 return create_dswave(riid
, ret_iface
);
98 static HRESULT WINAPI
WaveCF_LockServer(IClassFactory
* iface
, BOOL dolock
)
100 TRACE("(%d)\n", dolock
);
105 DSWAVE_UnlockModule();
110 static const IClassFactoryVtbl WaveCF_Vtbl
= {
111 WaveCF_QueryInterface
,
114 WaveCF_CreateInstance
,
118 static IClassFactoryImpl Wave_CF
= {{&WaveCF_Vtbl
}};
120 /******************************************************************
121 * DllCanUnloadNow (DSWAVE.@)
125 HRESULT WINAPI
DllCanUnloadNow(void)
127 return DSWAVE_refCount
!= 0 ? S_FALSE
: S_OK
;
131 /******************************************************************
132 * DllGetClassObject (DSWAVE.@)
136 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
138 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
139 if (IsEqualCLSID (rclsid
, &CLSID_DirectSoundWave
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
141 IClassFactory_AddRef((IClassFactory
*)*ppv
);
145 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
146 return CLASS_E_CLASSNOTAVAILABLE
;