wined3d: Rename wined3d_cull enum values.
[wine.git] / dlls / dpvoice / main.c
blobaab0859e2825f3c65e40d1d644ca1e92993c91b2
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 "config.h"
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "objbase.h"
27 #include "rpcproxy.h"
28 #include "wine/debug.h"
30 #include "initguid.h"
31 #include "dvoice.h"
32 #include "dvoice_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
36 static HINSTANCE DPVOICE_hInstance;
38 typedef struct
40 IClassFactory IClassFactory_iface;
41 LONG ref;
42 REFCLSID rclsid;
43 HRESULT (*pfnCreateInstanceFactory)(IClassFactory *iface, IUnknown *punkOuter, REFIID riid, void **ppobj);
44 } IClassFactoryImpl;
46 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
48 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
51 static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,void **ppobj)
53 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
55 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
56 return E_NOINTERFACE;
59 static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface)
61 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
62 return InterlockedIncrement(&This->ref);
65 static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface)
67 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
68 /* static class, won't be freed */
69 return InterlockedDecrement(&This->ref);
72 static HRESULT WINAPI DICF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
74 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
76 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
77 return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
80 static HRESULT WINAPI DICF_LockServer(IClassFactory *iface,BOOL dolock)
82 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
83 FIXME("(%p)->(%d),stub!\n",This,dolock);
84 return S_OK;
87 static const IClassFactoryVtbl DICF_Vtbl = {
88 DICF_QueryInterface,
89 DICF_AddRef,
90 DICF_Release,
91 DICF_CreateInstance,
92 DICF_LockServer
95 static IClassFactoryImpl DPVOICE_CFS[] =
97 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceClient, DPVOICE_CreateDirectPlayVoiceClient },
98 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceServer, DPVOICE_CreateDirectPlayVoiceServer },
99 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceTest, DPVOICE_CreateDirectPlayVoiceTest },
100 { { NULL }, 0, NULL, NULL }
103 HRESULT WINAPI DirectPlayVoiceCreate(LPCGUID pIID, void **ppvInterface)
105 FIXME("(%p, %p) stub\n", pIID, ppvInterface);
106 return E_NOTIMPL;
109 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
111 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
113 DPVOICE_hInstance = hinstDLL;
115 switch (fdwReason)
117 case DLL_WINE_PREATTACH:
118 return FALSE; /* prefer native version */
119 case DLL_PROCESS_ATTACH:
120 DisableThreadLibraryCalls(hinstDLL);
121 break;
122 default:
123 break;
126 return TRUE;
129 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
131 int i = 0;
133 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
135 while (NULL != DPVOICE_CFS[i].rclsid)
137 if (IsEqualGUID(rclsid, DPVOICE_CFS[i].rclsid))
139 DICF_AddRef(&DPVOICE_CFS[i].IClassFactory_iface);
140 *ppv = &DPVOICE_CFS[i];
141 return S_OK;
143 ++i;
146 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
147 return CLASS_E_CLASSNOTAVAILABLE;
150 HRESULT WINAPI DllCanUnloadNow(void)
152 return S_FALSE;
155 HRESULT WINAPI DllRegisterServer(void)
157 return __wine_register_resources( DPVOICE_hInstance );
160 HRESULT WINAPI DllUnregisterServer(void)
162 return __wine_unregister_resources( DPVOICE_hInstance );