taskmgr: Remove dead code.
[wine/multimedia.git] / dlls / hnetcfg / apps.c
blobd21ed983b316edcdbf70f6d74405c893f9d5a449
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_INetFwPolicy,
113 &IID_INetFwProfile
116 HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
118 HRESULT hr;
120 if (!typelib)
122 ITypeLib *lib;
124 hr = LoadRegTypeLib( &LIBID_NetFwPublicTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &lib );
125 if (FAILED(hr))
127 ERR("LoadRegTypeLib failed: %08x\n", hr);
128 return hr;
130 if (InterlockedCompareExchangePointer( (void **)&typelib, lib, NULL ))
131 ITypeLib_Release( lib );
133 if (!typeinfo[tid])
135 ITypeInfo *info;
137 hr = ITypeLib_GetTypeInfoOfGuid( typelib, tid_id[tid], &info );
138 if (FAILED(hr))
140 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id[tid]), hr);
141 return hr;
143 if (InterlockedCompareExchangePointer( (void **)(typeinfo + tid), info, NULL ))
144 ITypeInfo_Release( info );
146 *ret = typeinfo[tid];
147 ITypeInfo_AddRef(typeinfo[tid]);
148 return S_OK;
151 void release_typelib(void)
153 unsigned i;
155 for (i = 0; i < sizeof(typeinfo)/sizeof(*typeinfo); i++)
156 if (typeinfo[i])
157 ITypeInfo_Release(typeinfo[i]);
159 if (typelib)
160 ITypeLib_Release(typelib);
163 static HRESULT WINAPI fw_app_GetTypeInfo(
164 INetFwAuthorizedApplication *iface,
165 UINT iTInfo,
166 LCID lcid,
167 ITypeInfo **ppTInfo )
169 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
171 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
172 return get_typeinfo( INetFwAuthorizedApplication_tid, ppTInfo );
175 static HRESULT WINAPI fw_app_GetIDsOfNames(
176 INetFwAuthorizedApplication *iface,
177 REFIID riid,
178 LPOLESTR *rgszNames,
179 UINT cNames,
180 LCID lcid,
181 DISPID *rgDispId )
183 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
184 ITypeInfo *typeinfo;
185 HRESULT hr;
187 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
189 hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo );
190 if (SUCCEEDED(hr))
192 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
193 ITypeInfo_Release( typeinfo );
195 return hr;
198 static HRESULT WINAPI fw_app_Invoke(
199 INetFwAuthorizedApplication *iface,
200 DISPID dispIdMember,
201 REFIID riid,
202 LCID lcid,
203 WORD wFlags,
204 DISPPARAMS *pDispParams,
205 VARIANT *pVarResult,
206 EXCEPINFO *pExcepInfo,
207 UINT *puArgErr )
209 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
210 ITypeInfo *typeinfo;
211 HRESULT hr;
213 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
214 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
216 hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo );
217 if (SUCCEEDED(hr))
219 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplication_iface, dispIdMember,
220 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
221 ITypeInfo_Release( typeinfo );
223 return hr;
226 static HRESULT WINAPI fw_app_get_Name(
227 INetFwAuthorizedApplication *iface,
228 BSTR *name )
230 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
232 FIXME("%p, %p\n", This, name);
233 return E_NOTIMPL;
236 static HRESULT WINAPI fw_app_put_Name(
237 INetFwAuthorizedApplication *iface,
238 BSTR name )
240 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
242 FIXME("%p, %s\n", This, debugstr_w(name));
243 return S_OK;
246 static HRESULT WINAPI fw_app_get_ProcessImageFileName(
247 INetFwAuthorizedApplication *iface,
248 BSTR *imageFileName )
250 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
252 FIXME("%p, %p\n", This, imageFileName);
253 return E_NOTIMPL;
256 static HRESULT WINAPI fw_app_put_ProcessImageFileName(
257 INetFwAuthorizedApplication *iface,
258 BSTR imageFileName )
260 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
262 FIXME("%p, %s\n", This, debugstr_w(imageFileName));
263 return S_OK;
266 static HRESULT WINAPI fw_app_get_IpVersion(
267 INetFwAuthorizedApplication *iface,
268 NET_FW_IP_VERSION *ipVersion )
270 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
272 TRACE("%p, %p\n", This, ipVersion);
274 if (!ipVersion)
275 return E_POINTER;
276 *ipVersion = NET_FW_IP_VERSION_ANY;
277 return S_OK;
280 static HRESULT WINAPI fw_app_put_IpVersion(
281 INetFwAuthorizedApplication *iface,
282 NET_FW_IP_VERSION ipVersion )
284 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
286 TRACE("%p, %u\n", This, ipVersion);
287 return S_OK;
290 static HRESULT WINAPI fw_app_get_Scope(
291 INetFwAuthorizedApplication *iface,
292 NET_FW_SCOPE *scope )
294 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
296 FIXME("%p, %p\n", This, scope);
297 return E_NOTIMPL;
300 static HRESULT WINAPI fw_app_put_Scope(
301 INetFwAuthorizedApplication *iface,
302 NET_FW_SCOPE scope )
304 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
306 FIXME("%p, %u\n", This, scope);
307 return S_OK;
310 static HRESULT WINAPI fw_app_get_RemoteAddresses(
311 INetFwAuthorizedApplication *iface,
312 BSTR *remoteAddrs )
314 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
316 FIXME("%p, %p\n", This, remoteAddrs);
317 return E_NOTIMPL;
320 static HRESULT WINAPI fw_app_put_RemoteAddresses(
321 INetFwAuthorizedApplication *iface,
322 BSTR remoteAddrs )
324 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
326 FIXME("%p, %s\n", This, debugstr_w(remoteAddrs));
327 return E_NOTIMPL;
330 static HRESULT WINAPI fw_app_get_Enabled(
331 INetFwAuthorizedApplication *iface,
332 VARIANT_BOOL *enabled )
334 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
336 FIXME("%p, %p\n", This, enabled);
338 *enabled = VARIANT_FALSE;
339 return S_OK;
342 static HRESULT WINAPI fw_app_put_Enabled(
343 INetFwAuthorizedApplication *iface,
344 VARIANT_BOOL enabled )
346 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
348 FIXME("%p, %d\n", This, enabled);
349 return S_OK;
352 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl =
354 fw_app_QueryInterface,
355 fw_app_AddRef,
356 fw_app_Release,
357 fw_app_GetTypeInfoCount,
358 fw_app_GetTypeInfo,
359 fw_app_GetIDsOfNames,
360 fw_app_Invoke,
361 fw_app_get_Name,
362 fw_app_put_Name,
363 fw_app_get_ProcessImageFileName,
364 fw_app_put_ProcessImageFileName,
365 fw_app_get_IpVersion,
366 fw_app_put_IpVersion,
367 fw_app_get_Scope,
368 fw_app_put_Scope,
369 fw_app_get_RemoteAddresses,
370 fw_app_put_RemoteAddresses,
371 fw_app_get_Enabled,
372 fw_app_put_Enabled
375 HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
377 fw_app *fa;
379 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
381 fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
382 if (!fa) return E_OUTOFMEMORY;
384 fa->INetFwAuthorizedApplication_iface.lpVtbl = &fw_app_vtbl;
385 fa->refs = 1;
387 *ppObj = &fa->INetFwAuthorizedApplication_iface;
389 TRACE("returning iface %p\n", *ppObj);
390 return S_OK;
392 typedef struct fw_apps
394 INetFwAuthorizedApplications INetFwAuthorizedApplications_iface;
395 LONG refs;
396 } fw_apps;
398 static inline fw_apps *impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications *iface )
400 return CONTAINING_RECORD(iface, fw_apps, INetFwAuthorizedApplications_iface);
403 static ULONG WINAPI fw_apps_AddRef(
404 INetFwAuthorizedApplications *iface )
406 fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
407 return InterlockedIncrement( &fw_apps->refs );
410 static ULONG WINAPI fw_apps_Release(
411 INetFwAuthorizedApplications *iface )
413 fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
414 LONG refs = InterlockedDecrement( &fw_apps->refs );
415 if (!refs)
417 TRACE("destroying %p\n", fw_apps);
418 HeapFree( GetProcessHeap(), 0, fw_apps );
420 return refs;
423 static HRESULT WINAPI fw_apps_QueryInterface(
424 INetFwAuthorizedApplications *iface,
425 REFIID riid,
426 void **ppvObject )
428 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
430 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
432 if ( IsEqualGUID( riid, &IID_INetFwAuthorizedApplications ) ||
433 IsEqualGUID( riid, &IID_IDispatch ) ||
434 IsEqualGUID( riid, &IID_IUnknown ) )
436 *ppvObject = iface;
438 else
440 FIXME("interface %s not implemented\n", debugstr_guid(riid));
441 return E_NOINTERFACE;
443 INetFwAuthorizedApplications_AddRef( iface );
444 return S_OK;
447 static HRESULT WINAPI fw_apps_GetTypeInfoCount(
448 INetFwAuthorizedApplications *iface,
449 UINT *pctinfo )
451 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
453 FIXME("%p %p\n", This, pctinfo);
454 return E_NOTIMPL;
457 static HRESULT WINAPI fw_apps_GetTypeInfo(
458 INetFwAuthorizedApplications *iface,
459 UINT iTInfo,
460 LCID lcid,
461 ITypeInfo **ppTInfo )
463 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
465 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
466 return get_typeinfo( INetFwAuthorizedApplications_tid, ppTInfo );
469 static HRESULT WINAPI fw_apps_GetIDsOfNames(
470 INetFwAuthorizedApplications *iface,
471 REFIID riid,
472 LPOLESTR *rgszNames,
473 UINT cNames,
474 LCID lcid,
475 DISPID *rgDispId )
477 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
478 ITypeInfo *typeinfo;
479 HRESULT hr;
481 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
483 hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo );
484 if (SUCCEEDED(hr))
486 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
487 ITypeInfo_Release( typeinfo );
489 return hr;
492 static HRESULT WINAPI fw_apps_Invoke(
493 INetFwAuthorizedApplications *iface,
494 DISPID dispIdMember,
495 REFIID riid,
496 LCID lcid,
497 WORD wFlags,
498 DISPPARAMS *pDispParams,
499 VARIANT *pVarResult,
500 EXCEPINFO *pExcepInfo,
501 UINT *puArgErr )
503 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
504 ITypeInfo *typeinfo;
505 HRESULT hr;
507 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
508 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
510 hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo );
511 if (SUCCEEDED(hr))
513 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplications_iface, dispIdMember,
514 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
515 ITypeInfo_Release( typeinfo );
517 return hr;
520 static HRESULT WINAPI fw_apps_get_Count(
521 INetFwAuthorizedApplications *iface,
522 LONG *count )
524 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
526 FIXME("%p, %p\n", This, count);
527 return E_NOTIMPL;
530 static HRESULT WINAPI fw_apps_Add(
531 INetFwAuthorizedApplications *iface,
532 INetFwAuthorizedApplication *app )
534 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
536 FIXME("%p, %p\n", This, app);
537 return S_OK;
540 static HRESULT WINAPI fw_apps_Remove(
541 INetFwAuthorizedApplications *iface,
542 BSTR imageFileName )
544 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
546 FIXME("%p, %s\n", This, debugstr_w(imageFileName));
547 return S_OK;
550 static HRESULT WINAPI fw_apps_Item(
551 INetFwAuthorizedApplications *iface,
552 BSTR imageFileName,
553 INetFwAuthorizedApplication **app )
555 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
557 TRACE("%p, %s, %p\n", This, debugstr_w(imageFileName), app);
558 return NetFwAuthorizedApplication_create( NULL, (void **)app );
561 static HRESULT WINAPI fw_apps_get__NewEnum(
562 INetFwAuthorizedApplications *iface,
563 IUnknown **newEnum )
565 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
567 FIXME("%p, %p\n", This, newEnum);
568 return E_NOTIMPL;
571 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl =
573 fw_apps_QueryInterface,
574 fw_apps_AddRef,
575 fw_apps_Release,
576 fw_apps_GetTypeInfoCount,
577 fw_apps_GetTypeInfo,
578 fw_apps_GetIDsOfNames,
579 fw_apps_Invoke,
580 fw_apps_get_Count,
581 fw_apps_Add,
582 fw_apps_Remove,
583 fw_apps_Item,
584 fw_apps_get__NewEnum
587 HRESULT NetFwAuthorizedApplications_create( IUnknown *pUnkOuter, LPVOID *ppObj )
589 fw_apps *fa;
591 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
593 fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
594 if (!fa) return E_OUTOFMEMORY;
596 fa->INetFwAuthorizedApplications_iface.lpVtbl = &fw_apps_vtbl;
597 fa->refs = 1;
599 *ppObj = &fa->INetFwAuthorizedApplications_iface;
601 TRACE("returning iface %p\n", *ppObj);
602 return S_OK;