Add AppDefaults app selection to control panel
[wine/gsoc-2012-control.git] / dlls / hnetcfg / service.c
blobfa214b67601b7e6342d4d0e0103d4633f03f075e
1 /*
2 * Copyright 2009 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
20 #include <stdarg.h>
21 #include <stdio.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "netfw.h"
31 #include "wine/debug.h"
32 #include "wine/unicode.h"
33 #include "hnetcfg_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
37 typedef struct fw_service
39 INetFwService INetFwService_iface;
40 LONG refs;
41 } fw_service;
43 static inline fw_service *impl_from_INetFwService( INetFwService *iface )
45 return CONTAINING_RECORD(iface, fw_service, INetFwService_iface);
48 static ULONG WINAPI fw_service_AddRef(
49 INetFwService *iface )
51 fw_service *fw_service = impl_from_INetFwService( iface );
52 return InterlockedIncrement( &fw_service->refs );
55 static ULONG WINAPI fw_service_Release(
56 INetFwService *iface )
58 fw_service *fw_service = impl_from_INetFwService( iface );
59 LONG refs = InterlockedDecrement( &fw_service->refs );
60 if (!refs)
62 TRACE("destroying %p\n", fw_service);
63 HeapFree( GetProcessHeap(), 0, fw_service );
65 return refs;
68 static HRESULT WINAPI fw_service_QueryInterface(
69 INetFwService *iface,
70 REFIID riid,
71 void **ppvObject )
73 fw_service *This = impl_from_INetFwService( iface );
75 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
77 if ( IsEqualGUID( riid, &IID_INetFwService ) ||
78 IsEqualGUID( riid, &IID_IDispatch ) ||
79 IsEqualGUID( riid, &IID_IUnknown ) )
81 *ppvObject = iface;
83 else
85 FIXME("interface %s not implemented\n", debugstr_guid(riid));
86 return E_NOINTERFACE;
88 INetFwService_AddRef( iface );
89 return S_OK;
92 static HRESULT WINAPI fw_service_GetTypeInfoCount(
93 INetFwService *iface,
94 UINT *pctinfo )
96 fw_service *This = impl_from_INetFwService( iface );
98 FIXME("%p %p\n", This, pctinfo);
99 return E_NOTIMPL;
102 static HRESULT WINAPI fw_service_GetTypeInfo(
103 INetFwService *iface,
104 UINT iTInfo,
105 LCID lcid,
106 ITypeInfo **ppTInfo )
108 fw_service *This = impl_from_INetFwService( iface );
110 FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
111 return E_NOTIMPL;
114 static HRESULT WINAPI fw_service_GetIDsOfNames(
115 INetFwService *iface,
116 REFIID riid,
117 LPOLESTR *rgszNames,
118 UINT cNames,
119 LCID lcid,
120 DISPID *rgDispId )
122 fw_service *This = impl_from_INetFwService( iface );
124 FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
125 return E_NOTIMPL;
128 static HRESULT WINAPI fw_service_Invoke(
129 INetFwService *iface,
130 DISPID dispIdMember,
131 REFIID riid,
132 LCID lcid,
133 WORD wFlags,
134 DISPPARAMS *pDispParams,
135 VARIANT *pVarResult,
136 EXCEPINFO *pExcepInfo,
137 UINT *puArgErr )
139 fw_service *This = impl_from_INetFwService( iface );
141 FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
142 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
143 return E_NOTIMPL;
146 static HRESULT WINAPI fw_service_get_Name(
147 INetFwService *iface,
148 BSTR *name )
150 fw_service *This = impl_from_INetFwService( iface );
152 FIXME("%p %p\n", This, name);
153 return E_NOTIMPL;
156 static HRESULT WINAPI fw_service_get_Type(
157 INetFwService *iface,
158 NET_FW_SERVICE_TYPE *type )
160 fw_service *This = impl_from_INetFwService( iface );
162 FIXME("%p %p\n", This, type);
163 return E_NOTIMPL;
166 static HRESULT WINAPI fw_service_get_Customized(
167 INetFwService *iface,
168 VARIANT_BOOL *customized )
170 fw_service *This = impl_from_INetFwService( iface );
172 FIXME("%p %p\n", This, customized);
173 return E_NOTIMPL;
176 static HRESULT WINAPI fw_service_get_IpVersion(
177 INetFwService *iface,
178 NET_FW_IP_VERSION *ipVersion )
180 fw_service *This = impl_from_INetFwService( iface );
182 FIXME("%p %p\n", This, ipVersion);
183 return E_NOTIMPL;
186 static HRESULT WINAPI fw_service_put_IpVersion(
187 INetFwService *iface,
188 NET_FW_IP_VERSION ipVersion )
190 fw_service *This = impl_from_INetFwService( iface );
192 FIXME("%p %u\n", This, ipVersion);
193 return E_NOTIMPL;
196 static HRESULT WINAPI fw_service_get_Scope(
197 INetFwService *iface,
198 NET_FW_SCOPE *scope )
200 fw_service *This = impl_from_INetFwService( iface );
202 FIXME("%p %p\n", This, scope);
203 return E_NOTIMPL;
206 static HRESULT WINAPI fw_service_put_Scope(
207 INetFwService *iface,
208 NET_FW_SCOPE scope )
210 fw_service *This = impl_from_INetFwService( iface );
212 FIXME("%p %u\n", This, scope);
213 return E_NOTIMPL;
216 static HRESULT WINAPI fw_service_get_RemoteAddresses(
217 INetFwService *iface,
218 BSTR *remoteAddrs )
220 fw_service *This = impl_from_INetFwService( iface );
222 FIXME("%p %p\n", This, remoteAddrs);
223 return E_NOTIMPL;
226 static HRESULT WINAPI fw_service_put_RemoteAddresses(
227 INetFwService *iface,
228 BSTR remoteAddrs )
230 fw_service *This = impl_from_INetFwService( iface );
232 FIXME("%p %s\n", This, debugstr_w(remoteAddrs));
233 return E_NOTIMPL;
236 static HRESULT WINAPI fw_service_get_Enabled(
237 INetFwService *iface,
238 VARIANT_BOOL *enabled )
240 fw_service *This = impl_from_INetFwService( iface );
242 FIXME("%p %p\n", This, enabled);
243 return E_NOTIMPL;
246 static HRESULT WINAPI fw_service_put_Enabled(
247 INetFwService *iface,
248 VARIANT_BOOL enabled )
250 fw_service *This = impl_from_INetFwService( iface );
252 FIXME("%p %d\n", This, enabled);
253 return E_NOTIMPL;
256 static HRESULT WINAPI fw_service_get_GloballyOpenPorts(
257 INetFwService *iface,
258 INetFwOpenPorts **openPorts )
260 fw_service *This = impl_from_INetFwService( iface );
262 TRACE("%p %p\n", This, openPorts);
263 return NetFwOpenPorts_create( NULL, (void **)openPorts );
266 static const struct INetFwServiceVtbl fw_service_vtbl =
268 fw_service_QueryInterface,
269 fw_service_AddRef,
270 fw_service_Release,
271 fw_service_GetTypeInfoCount,
272 fw_service_GetTypeInfo,
273 fw_service_GetIDsOfNames,
274 fw_service_Invoke,
275 fw_service_get_Name,
276 fw_service_get_Type,
277 fw_service_get_Customized,
278 fw_service_get_IpVersion,
279 fw_service_put_IpVersion,
280 fw_service_get_Scope,
281 fw_service_put_Scope,
282 fw_service_get_RemoteAddresses,
283 fw_service_put_RemoteAddresses,
284 fw_service_get_Enabled,
285 fw_service_put_Enabled,
286 fw_service_get_GloballyOpenPorts
289 static HRESULT NetFwService_create( IUnknown *pUnkOuter, LPVOID *ppObj )
291 fw_service *fp;
293 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
295 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
296 if (!fp) return E_OUTOFMEMORY;
298 fp->INetFwService_iface.lpVtbl = &fw_service_vtbl;
299 fp->refs = 1;
301 *ppObj = &fp->INetFwService_iface;
303 TRACE("returning iface %p\n", *ppObj);
304 return S_OK;
307 typedef struct fw_services
309 INetFwServices INetFwServices_iface;
310 LONG refs;
311 } fw_services;
313 static inline fw_services *impl_from_INetFwServices( INetFwServices *iface )
315 return CONTAINING_RECORD(iface, fw_services, INetFwServices_iface);
318 static ULONG WINAPI fw_services_AddRef(
319 INetFwServices *iface )
321 fw_services *fw_services = impl_from_INetFwServices( iface );
322 return InterlockedIncrement( &fw_services->refs );
325 static ULONG WINAPI fw_services_Release(
326 INetFwServices *iface )
328 fw_services *fw_services = impl_from_INetFwServices( iface );
329 LONG refs = InterlockedDecrement( &fw_services->refs );
330 if (!refs)
332 TRACE("destroying %p\n", fw_services);
333 HeapFree( GetProcessHeap(), 0, fw_services );
335 return refs;
338 static HRESULT WINAPI fw_services_QueryInterface(
339 INetFwServices *iface,
340 REFIID riid,
341 void **ppvObject )
343 fw_services *This = impl_from_INetFwServices( iface );
345 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
347 if ( IsEqualGUID( riid, &IID_INetFwServices ) ||
348 IsEqualGUID( riid, &IID_IDispatch ) ||
349 IsEqualGUID( riid, &IID_IUnknown ) )
351 *ppvObject = iface;
353 else
355 FIXME("interface %s not implemented\n", debugstr_guid(riid));
356 return E_NOINTERFACE;
358 INetFwServices_AddRef( iface );
359 return S_OK;
362 static HRESULT WINAPI fw_services_GetTypeInfoCount(
363 INetFwServices *iface,
364 UINT *pctinfo )
366 fw_services *This = impl_from_INetFwServices( iface );
368 FIXME("%p %p\n", This, pctinfo);
369 return E_NOTIMPL;
372 static HRESULT WINAPI fw_services_GetTypeInfo(
373 INetFwServices *iface,
374 UINT iTInfo,
375 LCID lcid,
376 ITypeInfo **ppTInfo )
378 fw_services *This = impl_from_INetFwServices( iface );
380 FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
381 return E_NOTIMPL;
384 static HRESULT WINAPI fw_services_GetIDsOfNames(
385 INetFwServices *iface,
386 REFIID riid,
387 LPOLESTR *rgszNames,
388 UINT cNames,
389 LCID lcid,
390 DISPID *rgDispId )
392 fw_services *This = impl_from_INetFwServices( iface );
394 FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
395 return E_NOTIMPL;
398 static HRESULT WINAPI fw_services_Invoke(
399 INetFwServices *iface,
400 DISPID dispIdMember,
401 REFIID riid,
402 LCID lcid,
403 WORD wFlags,
404 DISPPARAMS *pDispParams,
405 VARIANT *pVarResult,
406 EXCEPINFO *pExcepInfo,
407 UINT *puArgErr )
409 fw_services *This = impl_from_INetFwServices( iface );
411 FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
412 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
413 return E_NOTIMPL;
416 static HRESULT WINAPI fw_services_get_Count(
417 INetFwServices *iface,
418 LONG *count )
420 fw_services *This = impl_from_INetFwServices( iface );
422 FIXME("%p, %p\n", This, count);
424 *count = 0;
425 return S_OK;
428 static HRESULT WINAPI fw_services_Item(
429 INetFwServices *iface,
430 NET_FW_SERVICE_TYPE svcType,
431 INetFwService **service )
433 fw_services *This = impl_from_INetFwServices( iface );
435 FIXME("%p, %u, %p\n", This, svcType, service);
436 return NetFwService_create( NULL, (void **)service );
439 static HRESULT WINAPI fw_services_get__NewEnum(
440 INetFwServices *iface,
441 IUnknown **newEnum )
443 fw_services *This = impl_from_INetFwServices( iface );
445 FIXME("%p, %p\n", This, newEnum);
446 return E_NOTIMPL;
449 static const struct INetFwServicesVtbl fw_services_vtbl =
451 fw_services_QueryInterface,
452 fw_services_AddRef,
453 fw_services_Release,
454 fw_services_GetTypeInfoCount,
455 fw_services_GetTypeInfo,
456 fw_services_GetIDsOfNames,
457 fw_services_Invoke,
458 fw_services_get_Count,
459 fw_services_Item,
460 fw_services_get__NewEnum
463 HRESULT NetFwServices_create( IUnknown *pUnkOuter, LPVOID *ppObj )
465 fw_services *fp;
467 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
469 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
470 if (!fp) return E_OUTOFMEMORY;
472 fp->INetFwServices_iface.lpVtbl = &fw_services_vtbl;
473 fp->refs = 1;
475 *ppObj = &fp->INetFwServices_iface;
477 TRACE("returning iface %p\n", *ppObj);
478 return S_OK;