wined3d: Don't use persistent BOs from the client thread if we might need to do verte...
[wine.git] / dlls / dpvoice / main.c
blob6a7d6b96dd0e2f0e39595ce53bbe13c04ecb3907
1 /*
2 * DirectPlay Voice
4 * Copyright (C) 2014 Alistair Leslie-Hughes
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "objbase.h"
26 #include "rpcproxy.h"
27 #include "wine/debug.h"
29 #include "initguid.h"
30 #include "dvoice.h"
31 #include "dvoice_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
35 typedef struct
37 IClassFactory IClassFactory_iface;
38 LONG ref;
39 REFCLSID rclsid;
40 HRESULT (*pfnCreateInstanceFactory)(IClassFactory *iface, IUnknown *punkOuter, REFIID riid, void **ppobj);
41 } IClassFactoryImpl;
43 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
45 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
48 static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,void **ppobj)
50 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
52 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
53 return E_NOINTERFACE;
56 static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface)
58 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
59 return InterlockedIncrement(&This->ref);
62 static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface)
64 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
65 /* static class, won't be freed */
66 return InterlockedDecrement(&This->ref);
69 static HRESULT WINAPI DICF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
71 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
73 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
74 return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
77 static HRESULT WINAPI DICF_LockServer(IClassFactory *iface,BOOL dolock)
79 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
80 FIXME("(%p)->(%d),stub!\n",This,dolock);
81 return S_OK;
84 static const IClassFactoryVtbl DICF_Vtbl = {
85 DICF_QueryInterface,
86 DICF_AddRef,
87 DICF_Release,
88 DICF_CreateInstance,
89 DICF_LockServer
92 static IClassFactoryImpl DPVOICE_CFS[] =
94 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceClient, DPVOICE_CreateDirectPlayVoiceClient },
95 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceServer, DPVOICE_CreateDirectPlayVoiceServer },
96 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceTest, DPVOICE_CreateDirectPlayVoiceTest },
97 { { NULL }, 0, NULL, NULL }
100 HRESULT WINAPI DirectPlayVoiceCreate(LPCGUID pIID, void **ppvInterface)
102 FIXME("(%s, %p) stub\n", debugstr_guid(pIID), ppvInterface);
103 return E_NOTIMPL;
106 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
108 int i = 0;
110 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
112 while (NULL != DPVOICE_CFS[i].rclsid)
114 if (IsEqualGUID(rclsid, DPVOICE_CFS[i].rclsid))
116 DICF_AddRef(&DPVOICE_CFS[i].IClassFactory_iface);
117 *ppv = &DPVOICE_CFS[i];
118 return S_OK;
120 ++i;
123 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
124 return CLASS_E_CLASSNOTAVAILABLE;