msxml3: Added IDispatchEx support for IXMLDOMImplementation.
[wine] / dlls / dpnet / lobbiedapp.c
1 /*
2  * DirectPlay8 LobbiedApplication
3  *
4  * Copyright 2007 Jason Edmeades
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #include "config.h"
23
24 #include <stdarg.h>
25
26 #define COBJMACROS
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "objbase.h"
32 #include "wine/debug.h"
33
34 #include "dplay8.h"
35 #include "dplobby8.h"
36 #include "dpnet_private.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
39
40 static inline IDirectPlay8LobbiedApplicationImpl *impl_from_IDirectPlay8LobbiedApplication(IDirectPlay8LobbiedApplication *iface)
41 {
42     return CONTAINING_RECORD(iface, IDirectPlay8LobbiedApplicationImpl,
43             IDirectPlay8LobbiedApplication_iface);
44 }
45
46 /* IDirectPlay8LobbiedApplication IUnknown parts follow: */
47 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_QueryInterface(IDirectPlay8LobbiedApplication *iface,
48         REFIID riid, void **ppobj)
49 {
50     IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
51
52     if (IsEqualGUID(riid, &IID_IUnknown)
53         || IsEqualGUID(riid, &IID_IDirectPlay8LobbiedApplication)) {
54         IUnknown_AddRef(iface);
55         *ppobj = This;
56         return DPN_OK;
57     }
58
59     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
60     return E_NOINTERFACE;
61 }
62
63 static ULONG WINAPI IDirectPlay8LobbiedApplicationImpl_AddRef(IDirectPlay8LobbiedApplication *iface)
64 {
65     IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
66     ULONG refCount = InterlockedIncrement(&This->ref);
67
68     TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
69
70     return refCount;
71 }
72
73 static ULONG WINAPI IDirectPlay8LobbiedApplicationImpl_Release(IDirectPlay8LobbiedApplication *iface)
74 {
75     IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
76     ULONG refCount = InterlockedDecrement(&This->ref);
77
78     TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
79
80     if (!refCount) {
81         HeapFree(GetProcessHeap(), 0, This);
82     }
83     return refCount;
84 }
85
86 /* IDirectPlay8LobbiedApplication Interface follow: */
87
88 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Initialize(IDirectPlay8LobbiedApplication *iface,
89         void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn,
90         DPNHANDLE * const pdpnhConnection, const DWORD dwFlags)
91 {
92   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
93   FIXME("(%p): stub\n", This);
94   return DPN_OK;
95 }
96
97 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_RegisterProgram(IDirectPlay8LobbiedApplication *iface,
98         PDPL_PROGRAM_DESC pdplProgramDesc, const DWORD dwFlags)
99 {
100   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
101   FIXME("(%p): stub\n", This);
102   return DPN_OK;
103 }
104
105 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_UnRegisterProgram(IDirectPlay8LobbiedApplication *iface,
106         GUID *pguidApplication, const DWORD dwFlags)
107 {
108   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
109   FIXME("(%p): stub\n", This);
110   return DPN_OK;
111 }
112
113 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Send(IDirectPlay8LobbiedApplication *iface,
114         const DPNHANDLE hConnection, BYTE * const pBuffer, const DWORD pBufferSize,
115         const DWORD dwFlags)
116 {
117   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
118   FIXME("(%p): stub\n", This);
119   return DPN_OK;
120 }
121
122 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_SetAppAvailable(IDirectPlay8LobbiedApplication *iface,
123         const BOOL fAvailable, const DWORD dwFlags)
124 {
125   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
126   FIXME("(%p): stub\n", This);
127   return DPN_OK;
128 }
129
130 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_UpdateStatus(IDirectPlay8LobbiedApplication *iface,
131         const DPNHANDLE hConnection, const DWORD dwStatus, const DWORD dwFlags)
132 {
133   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
134   FIXME("(%p): stub\n", This);
135   return DPN_OK;
136 }
137
138 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Close(IDirectPlay8LobbiedApplication *iface,
139         const DWORD dwFlags)
140 {
141   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
142   FIXME("(%p): stub\n", This);
143   return DPN_OK;
144 }
145
146 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_GetConnectionSettings(IDirectPlay8LobbiedApplication *iface,
147         const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo,
148         DWORD *pdwInfoSize, const DWORD dwFlags)
149 {
150   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
151   FIXME("(%p): stub\n", This);
152   return DPN_OK;
153 }
154
155 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_SetConnectionSettings(IDirectPlay8LobbiedApplication *iface,
156         const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo,
157         const DWORD dwFlags)
158 {
159   IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
160   FIXME("(%p): stub\n", This);
161   return DPN_OK;
162 }
163
164 static const IDirectPlay8LobbiedApplicationVtbl DirectPlay8LobbiedApplication_Vtbl =
165 {
166     IDirectPlay8LobbiedApplicationImpl_QueryInterface,
167     IDirectPlay8LobbiedApplicationImpl_AddRef,
168     IDirectPlay8LobbiedApplicationImpl_Release,
169     IDirectPlay8LobbiedApplicationImpl_Initialize,
170     IDirectPlay8LobbiedApplicationImpl_RegisterProgram,
171     IDirectPlay8LobbiedApplicationImpl_UnRegisterProgram,
172     IDirectPlay8LobbiedApplicationImpl_Send,
173     IDirectPlay8LobbiedApplicationImpl_SetAppAvailable,
174     IDirectPlay8LobbiedApplicationImpl_UpdateStatus,
175     IDirectPlay8LobbiedApplicationImpl_Close,
176     IDirectPlay8LobbiedApplicationImpl_GetConnectionSettings,
177     IDirectPlay8LobbiedApplicationImpl_SetConnectionSettings
178 };
179
180
181
182 HRESULT DPNET_CreateDirectPlay8LobbiedApp(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
183   IDirectPlay8LobbiedApplicationImpl* app;
184
185   TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
186
187   app = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8LobbiedApplicationImpl));
188   if (NULL == app) {
189     *ppobj = NULL;
190     return E_OUTOFMEMORY;
191   }
192   app->IDirectPlay8LobbiedApplication_iface.lpVtbl = &DirectPlay8LobbiedApplication_Vtbl;
193   app->ref = 0;
194   return IDirectPlay8LobbiedApplicationImpl_QueryInterface(&app->IDirectPlay8LobbiedApplication_iface,
195           riid, ppobj);
196 }