msxml3: Update pure_parser directive to avoid a deprecation warning.
[wine.git] / dlls / dpnet / dpnet_main.c
blob042b95a515ec52ea55abe5c721150a9fd1a68d10
1 /*
2 * DirectPlay
3 *
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
22 #include "config.h"
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "objbase.h"
31 #include "oleauto.h"
32 #include "oleidl.h"
33 #include "rpcproxy.h"
34 #include "wine/debug.h"
36 #include "initguid.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) {
48 instance = hInstDLL;
49 DisableThreadLibraryCalls(hInstDLL);
51 return TRUE;
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);
60 return S_OK;
63 /*******************************************************************************
64 * DirectPlay ClassFactory
66 typedef struct
68 /* IUnknown fields */
69 IClassFactory IClassFactory_iface;
70 LONG ref;
71 REFCLSID rclsid;
72 HRESULT (*pfnCreateInstanceFactory)(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj);
73 } IClassFactoryImpl;
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);
84 return E_NOINTERFACE;
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);
108 return S_OK;
111 static const IClassFactoryVtbl DICF_Vtbl = {
112 DICF_QueryInterface,
113 DICF_AddRef,
114 DICF_Release,
115 DICF_CreateInstance,
116 DICF_LockServer
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_DirectPlay8LobbyClient, DPNET_CreateDirectPlay8LobbyClient },
126 { { &DICF_Vtbl }, 1, &CLSID_DirectPlay8ThreadPool, DPNET_CreateDirectPlay8ThreadPool},
127 { { NULL }, 0, NULL, NULL }
130 /***********************************************************************
131 * DllCanUnloadNow (DPNET.@)
133 HRESULT WINAPI DllCanUnloadNow(void)
135 return S_FALSE;
138 /***********************************************************************
139 * DllGetClassObject (DPNET.@)
141 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
143 int i = 0;
145 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
147 if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
148 *ppv = (LPVOID)&DPNET_CF;
149 IClassFactory_AddRef((IClassFactory*)*ppv);
150 return S_OK;
153 while (NULL != DPNET_CFS[i].rclsid) {
154 if (IsEqualGUID(rclsid, DPNET_CFS[i].rclsid)) {
155 DICF_AddRef(&DPNET_CFS[i].IClassFactory_iface);
156 *ppv = &DPNET_CFS[i];
157 return S_OK;
159 ++i;
162 FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
163 return CLASS_E_CLASSNOTAVAILABLE;
166 /***********************************************************************
167 * DllRegisterServer (DPNET.@)
169 HRESULT WINAPI DllRegisterServer(void)
171 return __wine_register_resources( instance );
174 /***********************************************************************
175 * DllUnregisterServer (DPNET.@)
177 HRESULT WINAPI DllUnregisterServer(void)
179 return __wine_unregister_resources( instance );