kernel32: Update version to Win 10.
[wine.git] / dlls / dpvoice / main.c
blob66d67586276745844b60ee57a654dd598a062bbe
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 static HINSTANCE DPVOICE_hInstance;
37 typedef struct
39 IClassFactory IClassFactory_iface;
40 LONG ref;
41 REFCLSID rclsid;
42 HRESULT (*pfnCreateInstanceFactory)(IClassFactory *iface, IUnknown *punkOuter, REFIID riid, void **ppobj);
43 } IClassFactoryImpl;
45 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
47 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
50 static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,void **ppobj)
52 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
54 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
55 return E_NOINTERFACE;
58 static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface)
60 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
61 return InterlockedIncrement(&This->ref);
64 static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface)
66 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
67 /* static class, won't be freed */
68 return InterlockedDecrement(&This->ref);
71 static HRESULT WINAPI DICF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
73 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
75 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
76 return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
79 static HRESULT WINAPI DICF_LockServer(IClassFactory *iface,BOOL dolock)
81 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
82 FIXME("(%p)->(%d),stub!\n",This,dolock);
83 return S_OK;
86 static const IClassFactoryVtbl DICF_Vtbl = {
87 DICF_QueryInterface,
88 DICF_AddRef,
89 DICF_Release,
90 DICF_CreateInstance,
91 DICF_LockServer
94 static IClassFactoryImpl DPVOICE_CFS[] =
96 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceClient, DPVOICE_CreateDirectPlayVoiceClient },
97 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceServer, DPVOICE_CreateDirectPlayVoiceServer },
98 { { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceTest, DPVOICE_CreateDirectPlayVoiceTest },
99 { { NULL }, 0, NULL, NULL }
102 HRESULT WINAPI DirectPlayVoiceCreate(LPCGUID pIID, void **ppvInterface)
104 FIXME("(%s, %p) stub\n", debugstr_guid(pIID), ppvInterface);
105 return E_NOTIMPL;
108 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
110 TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
112 switch (fdwReason)
114 case DLL_PROCESS_ATTACH:
115 DPVOICE_hInstance = hinstDLL;
116 DisableThreadLibraryCalls(hinstDLL);
117 break;
118 default:
119 break;
122 return TRUE;
125 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
127 int i = 0;
129 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
131 while (NULL != DPVOICE_CFS[i].rclsid)
133 if (IsEqualGUID(rclsid, DPVOICE_CFS[i].rclsid))
135 DICF_AddRef(&DPVOICE_CFS[i].IClassFactory_iface);
136 *ppv = &DPVOICE_CFS[i];
137 return S_OK;
139 ++i;
142 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
143 return CLASS_E_CLASSNOTAVAILABLE;
146 HRESULT WINAPI DllCanUnloadNow(void)
148 return S_FALSE;
151 HRESULT WINAPI DllRegisterServer(void)
153 return __wine_register_resources( DPVOICE_hInstance );
156 HRESULT WINAPI DllUnregisterServer(void)
158 return __wine_unregister_resources( DPVOICE_hInstance );