sapi: Use standard C functions for memory allocation in token.c.
[wine.git] / dlls / dpnet / lobbiedapp.c
blobbbc7c55639c2f2311e728311e6a984c2a7c09707
1 /*
2 * DirectPlay8 LobbiedApplication
4 * Copyright 2007 Jason Edmeades
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
23 #include <stdarg.h>
25 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wingdi.h"
29 #include "winuser.h"
30 #include "objbase.h"
31 #include "wine/debug.h"
33 #include "dpnet_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(dpnet);
37 static inline IDirectPlay8LobbiedApplicationImpl *impl_from_IDirectPlay8LobbiedApplication(IDirectPlay8LobbiedApplication *iface)
39 return CONTAINING_RECORD(iface, IDirectPlay8LobbiedApplicationImpl,
40 IDirectPlay8LobbiedApplication_iface);
43 /* IDirectPlay8LobbiedApplication IUnknown parts follow: */
44 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_QueryInterface(IDirectPlay8LobbiedApplication *iface,
45 REFIID riid, void **ret_iface)
47 if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlay8LobbiedApplication)) {
48 IDirectPlay8LobbiedApplication_AddRef(iface);
49 *ret_iface = iface;
50 return S_OK;
53 WARN("(%p)->(%s,%p): not found\n", iface, debugstr_guid(riid), ret_iface);
54 return E_NOINTERFACE;
57 static ULONG WINAPI IDirectPlay8LobbiedApplicationImpl_AddRef(IDirectPlay8LobbiedApplication *iface)
59 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
60 ULONG refCount = InterlockedIncrement(&This->ref);
62 TRACE("(%p)->(ref before=%lu)\n", This, refCount - 1);
64 return refCount;
67 static ULONG WINAPI IDirectPlay8LobbiedApplicationImpl_Release(IDirectPlay8LobbiedApplication *iface)
69 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
70 ULONG refCount = InterlockedDecrement(&This->ref);
72 TRACE("(%p)->(ref before=%lu)\n", This, refCount + 1);
74 if (!refCount) {
75 HeapFree(GetProcessHeap(), 0, This);
77 return refCount;
80 /* IDirectPlay8LobbiedApplication Interface follow: */
82 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Initialize(IDirectPlay8LobbiedApplication *iface,
83 void * const pvUserContext, const PFNDPNMESSAGEHANDLER pfn,
84 DPNHANDLE * const pdpnhConnection, const DWORD dwFlags)
86 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
88 TRACE("(%p)->(%p %p %p %lx)\n", This, pvUserContext, pfn, pdpnhConnection, dwFlags);
90 if(!pfn)
91 return DPNERR_INVALIDPOINTER;
93 This->msghandler = pfn;
94 This->flags = dwFlags;
95 This->usercontext = pvUserContext;
96 This->connection = pdpnhConnection;
98 init_winsock();
100 return DPN_OK;
103 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_RegisterProgram(IDirectPlay8LobbiedApplication *iface,
104 PDPL_PROGRAM_DESC pdplProgramDesc, const DWORD dwFlags)
106 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
107 FIXME("(%p): stub\n", This);
108 return DPN_OK;
111 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_UnRegisterProgram(IDirectPlay8LobbiedApplication *iface,
112 GUID *pguidApplication, const DWORD dwFlags)
114 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
115 FIXME("(%p): stub\n", This);
116 return DPN_OK;
119 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Send(IDirectPlay8LobbiedApplication *iface,
120 const DPNHANDLE hConnection, BYTE * const pBuffer, const DWORD pBufferSize,
121 const DWORD dwFlags)
123 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
124 FIXME("(%p): stub\n", This);
125 return DPN_OK;
128 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_SetAppAvailable(IDirectPlay8LobbiedApplication *iface,
129 const BOOL fAvailable, const DWORD dwFlags)
131 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
132 FIXME("(%p): stub\n", This);
133 return DPN_OK;
136 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_UpdateStatus(IDirectPlay8LobbiedApplication *iface,
137 const DPNHANDLE hConnection, const DWORD dwStatus, const DWORD dwFlags)
139 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
140 FIXME("(%p): stub\n", This);
141 return DPN_OK;
144 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_Close(IDirectPlay8LobbiedApplication *iface,
145 const DWORD dwFlags)
147 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
148 FIXME("(%p): stub\n", This);
149 return DPN_OK;
152 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_GetConnectionSettings(IDirectPlay8LobbiedApplication *iface,
153 const DPNHANDLE hConnection, DPL_CONNECTION_SETTINGS * const pdplSessionInfo,
154 DWORD *pdwInfoSize, const DWORD dwFlags)
156 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
157 FIXME("(%p): stub\n", This);
158 return DPN_OK;
161 static HRESULT WINAPI IDirectPlay8LobbiedApplicationImpl_SetConnectionSettings(IDirectPlay8LobbiedApplication *iface,
162 const DPNHANDLE hConnection, const DPL_CONNECTION_SETTINGS * const pdplSessionInfo,
163 const DWORD dwFlags)
165 IDirectPlay8LobbiedApplicationImpl *This = impl_from_IDirectPlay8LobbiedApplication(iface);
166 FIXME("(%p): stub\n", This);
167 return DPN_OK;
170 static const IDirectPlay8LobbiedApplicationVtbl DirectPlay8LobbiedApplication_Vtbl =
172 IDirectPlay8LobbiedApplicationImpl_QueryInterface,
173 IDirectPlay8LobbiedApplicationImpl_AddRef,
174 IDirectPlay8LobbiedApplicationImpl_Release,
175 IDirectPlay8LobbiedApplicationImpl_Initialize,
176 IDirectPlay8LobbiedApplicationImpl_RegisterProgram,
177 IDirectPlay8LobbiedApplicationImpl_UnRegisterProgram,
178 IDirectPlay8LobbiedApplicationImpl_Send,
179 IDirectPlay8LobbiedApplicationImpl_SetAppAvailable,
180 IDirectPlay8LobbiedApplicationImpl_UpdateStatus,
181 IDirectPlay8LobbiedApplicationImpl_Close,
182 IDirectPlay8LobbiedApplicationImpl_GetConnectionSettings,
183 IDirectPlay8LobbiedApplicationImpl_SetConnectionSettings
188 HRESULT DPNET_CreateDirectPlay8LobbiedApp(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, REFIID riid, LPVOID *ppobj) {
189 IDirectPlay8LobbiedApplicationImpl* app;
191 TRACE("(%p, %s, %p)\n", punkOuter, debugstr_guid(riid), ppobj);
193 app = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlay8LobbiedApplicationImpl));
194 if (NULL == app) {
195 *ppobj = NULL;
196 return E_OUTOFMEMORY;
198 app->IDirectPlay8LobbiedApplication_iface.lpVtbl = &DirectPlay8LobbiedApplication_Vtbl;
199 app->ref = 0;
200 return IDirectPlay8LobbiedApplicationImpl_QueryInterface(&app->IDirectPlay8LobbiedApplication_iface,
201 riid, ppobj);