quartz: Free two assert calls from having side effects.
[wine/testsucceed.git] / dlls / dpnet / dpnet_main.c
blob9b328b919597057d92fe9c6e4f07865a6af58ae0
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_DirectPlay8ThreadPool, DPNET_CreateDirectPlay8ThreadPool},
126 { { NULL }, 0, NULL, NULL }
129 /***********************************************************************
130 * DllCanUnloadNow (DPNET.@)
132 HRESULT WINAPI DllCanUnloadNow(void)
134 return S_FALSE;
137 /***********************************************************************
138 * DllGetClassObject (DPNET.@)
140 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
142 int i = 0;
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);
149 return S_OK;
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];
156 return S_OK;
158 ++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 );
173 /***********************************************************************
174 * DllUnregisterServer (DPNET.@)
176 HRESULT WINAPI DllUnregisterServer(void)
178 return __wine_unregister_resources( instance );