quartz: Don't cast WSTR to BSTR, convert properly instead.
[wine/testsucceed.git] / dlls / hnetcfg / apps.c
blobfbd603cd6109b8c9f1a8af95ea3b9acba34eaf62
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 const INetFwAuthorizedApplicationVtbl *vtbl;
40 LONG refs;
41 } fw_app;
43 static inline fw_app *impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication *iface )
45 return (fw_app *)((char *)iface - FIELD_OFFSET( fw_app, vtbl ));
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 FIXME("%p %p\n", This, pctinfo);
99 return E_NOTIMPL;
102 static HRESULT WINAPI fw_app_GetTypeInfo(
103 INetFwAuthorizedApplication *iface,
104 UINT iTInfo,
105 LCID lcid,
106 ITypeInfo **ppTInfo )
108 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
110 FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
111 return E_NOTIMPL;
114 static HRESULT WINAPI fw_app_GetIDsOfNames(
115 INetFwAuthorizedApplication *iface,
116 REFIID riid,
117 LPOLESTR *rgszNames,
118 UINT cNames,
119 LCID lcid,
120 DISPID *rgDispId )
122 fw_app *This = impl_from_INetFwAuthorizedApplication( 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_app_Invoke(
129 INetFwAuthorizedApplication *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_app *This = impl_from_INetFwAuthorizedApplication( 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_app_get_Name(
147 INetFwAuthorizedApplication *iface,
148 BSTR *name )
150 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
152 FIXME("%p, %p\n", This, name);
153 return E_NOTIMPL;
156 static HRESULT WINAPI fw_app_put_Name(
157 INetFwAuthorizedApplication *iface,
158 BSTR name )
160 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
162 FIXME("%p, %s\n", This, debugstr_w(name));
163 return S_OK;
166 static HRESULT WINAPI fw_app_get_ProcessImageFileName(
167 INetFwAuthorizedApplication *iface,
168 BSTR *imageFileName )
170 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
172 FIXME("%p, %p\n", This, imageFileName);
173 return E_NOTIMPL;
176 static HRESULT WINAPI fw_app_put_ProcessImageFileName(
177 INetFwAuthorizedApplication *iface,
178 BSTR imageFileName )
180 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
182 FIXME("%p, %s\n", This, debugstr_w(imageFileName));
183 return S_OK;
186 static HRESULT WINAPI fw_app_get_IpVersion(
187 INetFwAuthorizedApplication *iface,
188 NET_FW_IP_VERSION *ipVersion )
190 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
192 FIXME("%p, %p\n", This, ipVersion);
193 return E_NOTIMPL;
196 static HRESULT WINAPI fw_app_put_IpVersion(
197 INetFwAuthorizedApplication *iface,
198 NET_FW_IP_VERSION ipVersion )
200 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
202 FIXME("%p, %u\n", This, ipVersion);
203 return E_NOTIMPL;
206 static HRESULT WINAPI fw_app_get_Scope(
207 INetFwAuthorizedApplication *iface,
208 NET_FW_SCOPE *scope )
210 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
212 FIXME("%p, %p\n", This, scope);
213 return E_NOTIMPL;
216 static HRESULT WINAPI fw_app_put_Scope(
217 INetFwAuthorizedApplication *iface,
218 NET_FW_SCOPE scope )
220 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
222 FIXME("%p, %u\n", This, scope);
223 return E_NOTIMPL;
226 static HRESULT WINAPI fw_app_get_RemoteAddresses(
227 INetFwAuthorizedApplication *iface,
228 BSTR *remoteAddrs )
230 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
232 FIXME("%p, %p\n", This, remoteAddrs);
233 return E_NOTIMPL;
236 static HRESULT WINAPI fw_app_put_RemoteAddresses(
237 INetFwAuthorizedApplication *iface,
238 BSTR remoteAddrs )
240 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
242 FIXME("%p, %s\n", This, debugstr_w(remoteAddrs));
243 return E_NOTIMPL;
246 static HRESULT WINAPI fw_app_get_Enabled(
247 INetFwAuthorizedApplication *iface,
248 VARIANT_BOOL *enabled )
250 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
252 FIXME("%p, %p\n", This, enabled);
254 *enabled = VARIANT_FALSE;
255 return S_OK;
258 static HRESULT WINAPI fw_app_put_Enabled(
259 INetFwAuthorizedApplication *iface,
260 VARIANT_BOOL enabled )
262 fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
264 FIXME("%p, %d\n", This, enabled);
265 return E_NOTIMPL;
268 static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl =
270 fw_app_QueryInterface,
271 fw_app_AddRef,
272 fw_app_Release,
273 fw_app_GetTypeInfoCount,
274 fw_app_GetTypeInfo,
275 fw_app_GetIDsOfNames,
276 fw_app_Invoke,
277 fw_app_get_Name,
278 fw_app_put_Name,
279 fw_app_get_ProcessImageFileName,
280 fw_app_put_ProcessImageFileName,
281 fw_app_get_IpVersion,
282 fw_app_put_IpVersion,
283 fw_app_get_Scope,
284 fw_app_put_Scope,
285 fw_app_get_RemoteAddresses,
286 fw_app_put_RemoteAddresses,
287 fw_app_get_Enabled,
288 fw_app_put_Enabled
291 HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
293 fw_app *fa;
295 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
297 fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
298 if (!fa) return E_OUTOFMEMORY;
300 fa->vtbl = &fw_app_vtbl;
301 fa->refs = 1;
303 *ppObj = &fa->vtbl;
305 TRACE("returning iface %p\n", *ppObj);
306 return S_OK;
308 typedef struct fw_apps
310 const INetFwAuthorizedApplicationsVtbl *vtbl;
311 LONG refs;
312 } fw_apps;
314 static inline fw_apps *impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications *iface )
316 return (fw_apps *)((char *)iface - FIELD_OFFSET( fw_apps, vtbl ));
319 static ULONG WINAPI fw_apps_AddRef(
320 INetFwAuthorizedApplications *iface )
322 fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
323 return InterlockedIncrement( &fw_apps->refs );
326 static ULONG WINAPI fw_apps_Release(
327 INetFwAuthorizedApplications *iface )
329 fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
330 LONG refs = InterlockedDecrement( &fw_apps->refs );
331 if (!refs)
333 TRACE("destroying %p\n", fw_apps);
334 HeapFree( GetProcessHeap(), 0, fw_apps );
336 return refs;
339 static HRESULT WINAPI fw_apps_QueryInterface(
340 INetFwAuthorizedApplications *iface,
341 REFIID riid,
342 void **ppvObject )
344 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
346 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
348 if ( IsEqualGUID( riid, &IID_INetFwAuthorizedApplications ) ||
349 IsEqualGUID( riid, &IID_IDispatch ) ||
350 IsEqualGUID( riid, &IID_IUnknown ) )
352 *ppvObject = iface;
354 else
356 FIXME("interface %s not implemented\n", debugstr_guid(riid));
357 return E_NOINTERFACE;
359 INetFwAuthorizedApplications_AddRef( iface );
360 return S_OK;
363 static HRESULT WINAPI fw_apps_GetTypeInfoCount(
364 INetFwAuthorizedApplications *iface,
365 UINT *pctinfo )
367 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
369 FIXME("%p %p\n", This, pctinfo);
370 return E_NOTIMPL;
373 static HRESULT WINAPI fw_apps_GetTypeInfo(
374 INetFwAuthorizedApplications *iface,
375 UINT iTInfo,
376 LCID lcid,
377 ITypeInfo **ppTInfo )
379 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
381 FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
382 return E_NOTIMPL;
385 static HRESULT WINAPI fw_apps_GetIDsOfNames(
386 INetFwAuthorizedApplications *iface,
387 REFIID riid,
388 LPOLESTR *rgszNames,
389 UINT cNames,
390 LCID lcid,
391 DISPID *rgDispId )
393 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
395 FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
396 return E_NOTIMPL;
399 static HRESULT WINAPI fw_apps_Invoke(
400 INetFwAuthorizedApplications *iface,
401 DISPID dispIdMember,
402 REFIID riid,
403 LCID lcid,
404 WORD wFlags,
405 DISPPARAMS *pDispParams,
406 VARIANT *pVarResult,
407 EXCEPINFO *pExcepInfo,
408 UINT *puArgErr )
410 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
412 FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
413 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
414 return E_NOTIMPL;
417 static HRESULT WINAPI fw_apps_get_Count(
418 INetFwAuthorizedApplications *iface,
419 LONG *count )
421 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
423 FIXME("%p, %p\n", This, count);
424 return E_NOTIMPL;
427 static HRESULT WINAPI fw_apps_Add(
428 INetFwAuthorizedApplications *iface,
429 INetFwAuthorizedApplication *app )
431 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
433 FIXME("%p, %p\n", This, app);
434 return S_OK;
437 static HRESULT WINAPI fw_apps_Remove(
438 INetFwAuthorizedApplications *iface,
439 BSTR imageFileName )
441 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
443 FIXME("%p, %s\n", This, debugstr_w(imageFileName));
444 return S_OK;
447 static HRESULT WINAPI fw_apps_Item(
448 INetFwAuthorizedApplications *iface,
449 BSTR imageFileName,
450 INetFwAuthorizedApplication **app )
452 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
454 TRACE("%p, %s, %p\n", This, debugstr_w(imageFileName), app);
455 return NetFwAuthorizedApplication_create( NULL, (void **)app );
458 static HRESULT WINAPI fw_apps_get__NewEnum(
459 INetFwAuthorizedApplications *iface,
460 IUnknown **newEnum )
462 fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
464 FIXME("%p, %p\n", This, newEnum);
465 return E_NOTIMPL;
468 static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl =
470 fw_apps_QueryInterface,
471 fw_apps_AddRef,
472 fw_apps_Release,
473 fw_apps_GetTypeInfoCount,
474 fw_apps_GetTypeInfo,
475 fw_apps_GetIDsOfNames,
476 fw_apps_Invoke,
477 fw_apps_get_Count,
478 fw_apps_Add,
479 fw_apps_Remove,
480 fw_apps_Item,
481 fw_apps_get__NewEnum
484 HRESULT NetFwAuthorizedApplications_create( IUnknown *pUnkOuter, LPVOID *ppObj )
486 fw_apps *fa;
488 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
490 fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
491 if (!fa) return E_OUTOFMEMORY;
493 fa->vtbl = &fw_apps_vtbl;
494 fa->refs = 1;
496 *ppObj = &fa->vtbl;
498 TRACE("returning iface %p\n", *ppObj);
499 return S_OK;