dmime: Don't set DSBCAPS_CTRLPAN together with DSBCAPS_CTRL3D.
[wine.git] / dlls / hnetcfg / apps.c
blobea6d4115683dc2bf27489de94ec1c6d978ffc6dd
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_app
39 INetFwAuthorizedApplication INetFwAuthorizedApplication_iface;
40 LONG refs;
41 } fw_app;
43 static inline fw_app *impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication *iface )
45 return CONTAINING_RECORD(iface, fw_app, INetFwAuthorizedApplication_iface);
48 static ULONG WINAPI fw_app_AddRef(
49 INetFwAuthorizedApplication *iface )
51 fw_app *fw_app = impl_from_INetFwAuthorizedApplication( iface );
52 return InterlockedIncrement( &fw_app->refs );
55 static ULONG WINAPI fw_app_Release(
56 INetFwAuthorizedApplication *iface )
58 fw_app *fw_app = impl_from_INetFwAuthorizedApplication( iface );
59 LONG refs = InterlockedDecrement( &fw_app->refs );
60 if (!refs)
62 TRACE("destroying %p\n", fw_app);
63 HeapFree( GetProcessHeap(), 0, fw_app );
65 return refs;
68 static HRESULT WINAPI fw_app_QueryInterface(
69 INetFwAuthorizedApplication *iface,
70 REFIID riid,
71 void **ppvObject )
73 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
75 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
77 if ( IsEqualGUID( riid, &IID_INetFwAuthorizedApplication ) ||
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 INetFwAuthorizedApplication_AddRef( iface );
89 return S_OK;
92 static HRESULT WINAPI fw_app_GetTypeInfoCount(
93 INetFwAuthorizedApplication *iface,
94 UINT *pctinfo )
96 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
98 TRACE("%p %p\n", This, pctinfo);
99 *pctinfo = 1;
100 return S_OK;
103 static ITypeLib *typelib;
104 static ITypeInfo *typeinfo[last_tid];
106 static REFIID tid_id[] =
108 &IID_INetFwAuthorizedApplication,
109 &IID_INetFwAuthorizedApplications,
110 &IID_INetFwMgr,
111 &IID_INetFwOpenPort,
112 &IID_INetFwOpenPorts,
113 &IID_INetFwPolicy,
114 &IID_INetFwProfile
117 HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
119 HRESULT hr;
121 if (!typelib)
123 ITypeLib *lib;
125 hr = LoadRegTypeLib( &LIBID_NetFwPublicTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &lib );
126 if (FAILED(hr))
128 ERR("LoadRegTypeLib failed: %08x\n", hr);
129 return hr;
131 if (InterlockedCompareExchangePointer( (void **)&typelib, lib, NULL ))
132 ITypeLib_Release( lib );
134 if (!typeinfo[tid])
136 ITypeInfo *info;
138 hr = ITypeLib_GetTypeInfoOfGuid( typelib, tid_id[tid], &info );
139 if (FAILED(hr))
141 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id[tid]), hr);
142 return hr;
144 if (InterlockedCompareExchangePointer( (void **)(typeinfo + tid), info, NULL ))
145 ITypeInfo_Release( info );
147 *ret = typeinfo[tid];
148 ITypeInfo_AddRef(typeinfo[tid]);
149 return S_OK;
152 void release_typelib(void)
154 unsigned i;
156 for (i = 0; i < sizeof(typeinfo)/sizeof(*typeinfo); i++)
157 if (typeinfo[i])
158 ITypeInfo_Release(typeinfo[i]);
160 if (typelib)
161 ITypeLib_Release(typelib);
164 static HRESULT WINAPI fw_app_GetTypeInfo(
165 INetFwAuthorizedApplication *iface,
166 UINT iTInfo,
167 LCID lcid,
168 ITypeInfo **ppTInfo )
170 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
172 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
173 return get_typeinfo( INetFwAuthorizedApplication_tid, ppTInfo );
176 static HRESULT WINAPI fw_app_GetIDsOfNames(
177 INetFwAuthorizedApplication *iface,
178 REFIID riid,
179 LPOLESTR *rgszNames,
180 UINT cNames,
181 LCID lcid,
182 DISPID *rgDispId )
184 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
185 ITypeInfo *typeinfo;
186 HRESULT hr;
188 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
190 hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo );
191 if (SUCCEEDED(hr))
193 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
194 ITypeInfo_Release( typeinfo );
196 return hr;
199 static HRESULT WINAPI fw_app_Invoke(
200 INetFwAuthorizedApplication *iface,
201 DISPID dispIdMember,
202 REFIID riid,
203 LCID lcid,
204 WORD wFlags,
205 DISPPARAMS *pDispParams,
206 VARIANT *pVarResult,
207 EXCEPINFO *pExcepInfo,
208 UINT *puArgErr )
210 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
211 ITypeInfo *typeinfo;
212 HRESULT hr;
214 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
215 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
217 hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo );
218 if (SUCCEEDED(hr))
220 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplication_iface, dispIdMember,
221 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
222 ITypeInfo_Release( typeinfo );
224 return hr;
227 static HRESULT WINAPI fw_app_get_Name(
228 INetFwAuthorizedApplication *iface,
229 BSTR *name )
231 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
233 FIXME("%p, %p\n", This, name);
234 return E_NOTIMPL;
237 static HRESULT WINAPI fw_app_put_Name(
238 INetFwAuthorizedApplication *iface,
239 BSTR name )
241 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
243 FIXME("%p, %s\n", This, debugstr_w(name));
244 return S_OK;
247 static HRESULT WINAPI fw_app_get_ProcessImageFileName(
248 INetFwAuthorizedApplication *iface,
249 BSTR *imageFileName )
251 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
253 FIXME("%p, %p\n", This, imageFileName);
254 return E_NOTIMPL;
257 static HRESULT WINAPI fw_app_put_ProcessImageFileName(
258 INetFwAuthorizedApplication *iface,
259 BSTR imageFileName )
261 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
263 FIXME("%p, %s\n", This, debugstr_w(imageFileName));
264 return S_OK;
267 static HRESULT WINAPI fw_app_get_IpVersion(
268 INetFwAuthorizedApplication *iface,
269 NET_FW_IP_VERSION *ipVersion )
271 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
273 TRACE("%p, %p\n", This, ipVersion);
275 if (!ipVersion)
276 return E_POINTER;
277 *ipVersion = NET_FW_IP_VERSION_ANY;
278 return S_OK;
281 static HRESULT WINAPI fw_app_put_IpVersion(
282 INetFwAuthorizedApplication *iface,
283 NET_FW_IP_VERSION ipVersion )
285 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
287 TRACE("%p, %u\n", This, ipVersion);
288 return S_OK;
291 static HRESULT WINAPI fw_app_get_Scope(
292 INetFwAuthorizedApplication *iface,
293 NET_FW_SCOPE *scope )
295 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
297 FIXME("%p, %p\n", This, scope);
298 return E_NOTIMPL;
301 static HRESULT WINAPI fw_app_put_Scope(
302 INetFwAuthorizedApplication *iface,
303 NET_FW_SCOPE scope )
305 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
307 FIXME("%p, %u\n", This, scope);
308 return S_OK;
311 static HRESULT WINAPI fw_app_get_RemoteAddresses(
312 INetFwAuthorizedApplication *iface,
313 BSTR *remoteAddrs )
315 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
317 FIXME("%p, %p\n", This, remoteAddrs);
318 return E_NOTIMPL;
321 static HRESULT WINAPI fw_app_put_RemoteAddresses(
322 INetFwAuthorizedApplication *iface,
323 BSTR remoteAddrs )
325 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
327 FIXME("%p, %s\n", This, debugstr_w(remoteAddrs));
328 return E_NOTIMPL;
331 static HRESULT WINAPI fw_app_get_Enabled(
332 INetFwAuthorizedApplication *iface,
333 VARIANT_BOOL *enabled )
335 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
337 FIXME("%p, %p\n", This, enabled);
339 *enabled = VARIANT_FALSE;
340 return S_OK;
343 static HRESULT WINAPI fw_app_put_Enabled(
344 INetFwAuthorizedApplication *iface,
345 VARIANT_BOOL enabled )
347 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
349 FIXME("%p, %d\n", This, enabled);
350 return S_OK;
353 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl =
355 fw_app_QueryInterface,
356 fw_app_AddRef,
357 fw_app_Release,
358 fw_app_GetTypeInfoCount,
359 fw_app_GetTypeInfo,
360 fw_app_GetIDsOfNames,
361 fw_app_Invoke,
362 fw_app_get_Name,
363 fw_app_put_Name,
364 fw_app_get_ProcessImageFileName,
365 fw_app_put_ProcessImageFileName,
366 fw_app_get_IpVersion,
367 fw_app_put_IpVersion,
368 fw_app_get_Scope,
369 fw_app_put_Scope,
370 fw_app_get_RemoteAddresses,
371 fw_app_put_RemoteAddresses,
372 fw_app_get_Enabled,
373 fw_app_put_Enabled
376 HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
378 fw_app *fa;
380 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
382 fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
383 if (!fa) return E_OUTOFMEMORY;
385 fa->INetFwAuthorizedApplication_iface.lpVtbl = &fw_app_vtbl;
386 fa->refs = 1;
388 *ppObj = &fa->INetFwAuthorizedApplication_iface;
390 TRACE("returning iface %p\n", *ppObj);
391 return S_OK;
393 typedef struct fw_apps
395 INetFwAuthorizedApplications INetFwAuthorizedApplications_iface;
396 LONG refs;
397 } fw_apps;
399 static inline fw_apps *impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications *iface )
401 return CONTAINING_RECORD(iface, fw_apps, INetFwAuthorizedApplications_iface);
404 static ULONG WINAPI fw_apps_AddRef(
405 INetFwAuthorizedApplications *iface )
407 fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
408 return InterlockedIncrement( &fw_apps->refs );
411 static ULONG WINAPI fw_apps_Release(
412 INetFwAuthorizedApplications *iface )
414 fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
415 LONG refs = InterlockedDecrement( &fw_apps->refs );
416 if (!refs)
418 TRACE("destroying %p\n", fw_apps);
419 HeapFree( GetProcessHeap(), 0, fw_apps );
421 return refs;
424 static HRESULT WINAPI fw_apps_QueryInterface(
425 INetFwAuthorizedApplications *iface,
426 REFIID riid,
427 void **ppvObject )
429 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
431 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
433 if ( IsEqualGUID( riid, &IID_INetFwAuthorizedApplications ) ||
434 IsEqualGUID( riid, &IID_IDispatch ) ||
435 IsEqualGUID( riid, &IID_IUnknown ) )
437 *ppvObject = iface;
439 else
441 FIXME("interface %s not implemented\n", debugstr_guid(riid));
442 return E_NOINTERFACE;
444 INetFwAuthorizedApplications_AddRef( iface );
445 return S_OK;
448 static HRESULT WINAPI fw_apps_GetTypeInfoCount(
449 INetFwAuthorizedApplications *iface,
450 UINT *pctinfo )
452 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
454 FIXME("%p %p\n", This, pctinfo);
455 return E_NOTIMPL;
458 static HRESULT WINAPI fw_apps_GetTypeInfo(
459 INetFwAuthorizedApplications *iface,
460 UINT iTInfo,
461 LCID lcid,
462 ITypeInfo **ppTInfo )
464 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
466 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
467 return get_typeinfo( INetFwAuthorizedApplications_tid, ppTInfo );
470 static HRESULT WINAPI fw_apps_GetIDsOfNames(
471 INetFwAuthorizedApplications *iface,
472 REFIID riid,
473 LPOLESTR *rgszNames,
474 UINT cNames,
475 LCID lcid,
476 DISPID *rgDispId )
478 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
479 ITypeInfo *typeinfo;
480 HRESULT hr;
482 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
484 hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo );
485 if (SUCCEEDED(hr))
487 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
488 ITypeInfo_Release( typeinfo );
490 return hr;
493 static HRESULT WINAPI fw_apps_Invoke(
494 INetFwAuthorizedApplications *iface,
495 DISPID dispIdMember,
496 REFIID riid,
497 LCID lcid,
498 WORD wFlags,
499 DISPPARAMS *pDispParams,
500 VARIANT *pVarResult,
501 EXCEPINFO *pExcepInfo,
502 UINT *puArgErr )
504 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
505 ITypeInfo *typeinfo;
506 HRESULT hr;
508 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
509 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
511 hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo );
512 if (SUCCEEDED(hr))
514 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplications_iface, dispIdMember,
515 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
516 ITypeInfo_Release( typeinfo );
518 return hr;
521 static HRESULT WINAPI fw_apps_get_Count(
522 INetFwAuthorizedApplications *iface,
523 LONG *count )
525 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
527 FIXME("%p, %p\n", This, count);
528 return E_NOTIMPL;
531 static HRESULT WINAPI fw_apps_Add(
532 INetFwAuthorizedApplications *iface,
533 INetFwAuthorizedApplication *app )
535 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
537 FIXME("%p, %p\n", This, app);
538 return S_OK;
541 static HRESULT WINAPI fw_apps_Remove(
542 INetFwAuthorizedApplications *iface,
543 BSTR imageFileName )
545 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
547 FIXME("%p, %s\n", This, debugstr_w(imageFileName));
548 return S_OK;
551 static HRESULT WINAPI fw_apps_Item(
552 INetFwAuthorizedApplications *iface,
553 BSTR imageFileName,
554 INetFwAuthorizedApplication **app )
556 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
558 TRACE("%p, %s, %p\n", This, debugstr_w(imageFileName), app);
559 return NetFwAuthorizedApplication_create( NULL, (void **)app );
562 static HRESULT WINAPI fw_apps_get__NewEnum(
563 INetFwAuthorizedApplications *iface,
564 IUnknown **newEnum )
566 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
568 FIXME("%p, %p\n", This, newEnum);
569 return E_NOTIMPL;
572 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl =
574 fw_apps_QueryInterface,
575 fw_apps_AddRef,
576 fw_apps_Release,
577 fw_apps_GetTypeInfoCount,
578 fw_apps_GetTypeInfo,
579 fw_apps_GetIDsOfNames,
580 fw_apps_Invoke,
581 fw_apps_get_Count,
582 fw_apps_Add,
583 fw_apps_Remove,
584 fw_apps_Item,
585 fw_apps_get__NewEnum
588 HRESULT NetFwAuthorizedApplications_create( IUnknown *pUnkOuter, LPVOID *ppObj )
590 fw_apps *fa;
592 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
594 fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
595 if (!fa) return E_OUTOFMEMORY;
597 fa->INetFwAuthorizedApplications_iface.lpVtbl = &fw_apps_vtbl;
598 fa->refs = 1;
600 *ppObj = &fa->INetFwAuthorizedApplications_iface;
602 TRACE("returning iface %p\n", *ppObj);
603 return S_OK;