4 * Copyright 2004 Raphael Junqueira
6 * This library 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 library 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 library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
34 #include "wine/debug.h"
37 #include "dpnet_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
41 static HINSTANCE instance;
43 /* At process attach */
44 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
46 TRACE("%p,%x,%p\n", hInstDLL, fdwReason, lpvReserved);
47 if (fdwReason == DLL_PROCESS_ATTACH) {
49 DisableThreadLibraryCalls(hInstDLL);
54 /***********************************************************************
55 * DirectPlay8Create (DPNET.@)
57 HRESULT WINAPI DirectPlay8Create(REFGUID lpGUID, LPVOID *ppvInt, LPUNKNOWN punkOuter)
59 TRACE("(%s, %p, %p): stub\n", debugstr_guid(lpGUID), ppvInt, punkOuter);
63 /*******************************************************************************
64 * DirectPlay ClassFactory
69 IClassFactory IClassFactory_iface;
72 HRESULT (*pfnCreateInstanceFactory)(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj);
75 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
77 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
80 static HRESULT WINAPI DICF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
81 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
83 FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
87 static ULONG WINAPI DICF_AddRef(LPCLASSFACTORY iface) {
88 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
89 return InterlockedIncrement(&This->ref);
92 static ULONG WINAPI DICF_Release(LPCLASSFACTORY iface) {
93 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
94 /* static class, won't be freed */
95 return InterlockedDecrement(&This->ref);
98 static HRESULT WINAPI DICF_CreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj) {
99 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
101 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
102 return This->pfnCreateInstanceFactory(iface, pOuter, riid, ppobj);
105 static HRESULT WINAPI DICF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
106 IClassFactoryImpl *This = impl_from_IClassFactory(iface);
107 FIXME("(%p)->(%d),stub!\n",This,dolock);
111 static const IClassFactoryVtbl DICF_Vtbl = {
119 static IClassFactoryImpl DPNET_CFS[] = {
120 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8Client, DPNET_CreateDirectPlay8Client },
121 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8Server, DPNET_CreateDirectPlay8Server },
122 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8Peer, DPNET_CreateDirectPlay8Peer },
123 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8Address, DPNET_CreateDirectPlay8Address },
124 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8LobbiedApplication, DPNET_CreateDirectPlay8LobbiedApp },
125 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8ThreadPool, DPNET_CreateDirectPlay8ThreadPool},
126 { { NULL }, 0, NULL, NULL }
129 /***********************************************************************
130 * DllCanUnloadNow (DPNET.@)
132 HRESULT WINAPI DllCanUnloadNow(void)
137 /***********************************************************************
138 * DllGetClassObject (DPNET.@)
140 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
144 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
146 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
147 *ppv = (LPVOID)&DPNET_CF;
148 IClassFactory_AddRef((IClassFactory*)*ppv);
152 while (NULL != DPNET_CFS[i].rclsid) {
153 if (IsEqualGUID(rclsid, DPNET_CFS[i].rclsid)) {
154 DICF_AddRef(&DPNET_CFS[i].IClassFactory_iface);
155 *ppv = &DPNET_CFS[i];
161 FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
162 return CLASS_E_CLASSNOTAVAILABLE;
165 /***********************************************************************
166 * DllRegisterServer (DPNET.@)
168 HRESULT WINAPI DllRegisterServer(void)
170 return __wine_register_resources( instance, NULL );
173 /***********************************************************************
174 * DllUnregisterServer (DPNET.@)
176 HRESULT WINAPI DllUnregisterServer(void)
178 return __wine_unregister_resources( instance, NULL );