oleaut32: Fix default parameter variant leak (Valgrind).
[wine.git] / dlls / hnetcfg / profile.c
blobf1d724d74b1ff68eb5e657e896fd1078ef1b3b2a
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_profile
39 INetFwProfile INetFwProfile_iface;
40 LONG refs;
41 } fw_profile;
43 static inline fw_profile *impl_from_INetFwProfile( INetFwProfile *iface )
45 return CONTAINING_RECORD(iface, fw_profile, INetFwProfile_iface);
48 static ULONG WINAPI fw_profile_AddRef(
49 INetFwProfile *iface )
51 fw_profile *fw_profile = impl_from_INetFwProfile( iface );
52 return InterlockedIncrement( &fw_profile->refs );
55 static ULONG WINAPI fw_profile_Release(
56 INetFwProfile *iface )
58 fw_profile *fw_profile = impl_from_INetFwProfile( iface );
59 LONG refs = InterlockedDecrement( &fw_profile->refs );
60 if (!refs)
62 TRACE("destroying %p\n", fw_profile);
63 HeapFree( GetProcessHeap(), 0, fw_profile );
65 return refs;
68 static HRESULT WINAPI fw_profile_QueryInterface(
69 INetFwProfile *iface,
70 REFIID riid,
71 void **ppvObject )
73 fw_profile *This = impl_from_INetFwProfile( iface );
75 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
77 if ( IsEqualGUID( riid, &IID_INetFwProfile ) ||
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 INetFwProfile_AddRef( iface );
89 return S_OK;
92 static HRESULT WINAPI fw_profile_GetTypeInfoCount(
93 INetFwProfile *iface,
94 UINT *pctinfo )
96 fw_profile *This = impl_from_INetFwProfile( iface );
98 FIXME("%p %p\n", This, pctinfo);
99 return E_NOTIMPL;
102 static HRESULT WINAPI fw_profile_GetTypeInfo(
103 INetFwProfile *iface,
104 UINT iTInfo,
105 LCID lcid,
106 ITypeInfo **ppTInfo )
108 fw_profile *This = impl_from_INetFwProfile( iface );
110 FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
111 return E_NOTIMPL;
114 static HRESULT WINAPI fw_profile_GetIDsOfNames(
115 INetFwProfile *iface,
116 REFIID riid,
117 LPOLESTR *rgszNames,
118 UINT cNames,
119 LCID lcid,
120 DISPID *rgDispId )
122 fw_profile *This = impl_from_INetFwProfile( 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_profile_Invoke(
129 INetFwProfile *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_profile *This = impl_from_INetFwProfile( 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_profile_get_Type(
147 INetFwProfile *iface,
148 NET_FW_PROFILE_TYPE *type )
150 fw_profile *This = impl_from_INetFwProfile( iface );
152 FIXME("%p, %p\n", This, type);
153 return E_NOTIMPL;
156 static HRESULT WINAPI fw_profile_get_FirewallEnabled(
157 INetFwProfile *iface,
158 VARIANT_BOOL *enabled )
160 fw_profile *This = impl_from_INetFwProfile( iface );
162 FIXME("%p, %p\n", This, enabled);
164 *enabled = VARIANT_FALSE;
165 return S_OK;
168 static HRESULT WINAPI fw_profile_put_FirewallEnabled(
169 INetFwProfile *iface,
170 VARIANT_BOOL enabled )
172 fw_profile *This = impl_from_INetFwProfile( iface );
174 FIXME("%p, %d\n", This, enabled);
175 return E_NOTIMPL;
178 static HRESULT WINAPI fw_profile_get_ExceptionsNotAllowed(
179 INetFwProfile *iface,
180 VARIANT_BOOL *notAllowed )
182 fw_profile *This = impl_from_INetFwProfile( iface );
184 FIXME("%p, %p\n", This, notAllowed);
185 return E_NOTIMPL;
188 static HRESULT WINAPI fw_profile_put_ExceptionsNotAllowed(
189 INetFwProfile *iface,
190 VARIANT_BOOL notAllowed )
192 fw_profile *This = impl_from_INetFwProfile( iface );
194 FIXME("%p, %d\n", This, notAllowed);
195 return E_NOTIMPL;
198 static HRESULT WINAPI fw_profile_get_NotificationsDisabled(
199 INetFwProfile *iface,
200 VARIANT_BOOL *disabled )
202 fw_profile *This = impl_from_INetFwProfile( iface );
204 FIXME("%p, %p\n", This, disabled);
205 return E_NOTIMPL;
208 static HRESULT WINAPI fw_profile_put_NotificationsDisabled(
209 INetFwProfile *iface,
210 VARIANT_BOOL disabled )
212 fw_profile *This = impl_from_INetFwProfile( iface );
214 FIXME("%p, %d\n", This, disabled);
215 return E_NOTIMPL;
218 static HRESULT WINAPI fw_profile_get_UnicastResponsesToMulticastBroadcastDisabled(
219 INetFwProfile *iface,
220 VARIANT_BOOL *disabled )
222 fw_profile *This = impl_from_INetFwProfile( iface );
224 FIXME("%p, %p\n", This, disabled);
225 return E_NOTIMPL;
228 static HRESULT WINAPI fw_profile_put_UnicastResponsesToMulticastBroadcastDisabled(
229 INetFwProfile *iface,
230 VARIANT_BOOL disabled )
232 fw_profile *This = impl_from_INetFwProfile( iface );
234 FIXME("%p, %d\n", This, disabled);
235 return E_NOTIMPL;
238 static HRESULT WINAPI fw_profile_get_RemoteAdminSettings(
239 INetFwProfile *iface,
240 INetFwRemoteAdminSettings **remoteAdminSettings )
242 fw_profile *This = impl_from_INetFwProfile( iface );
244 FIXME("%p, %p\n", This, remoteAdminSettings);
245 return E_NOTIMPL;
248 static HRESULT WINAPI fw_profile_get_IcmpSettings(
249 INetFwProfile *iface,
250 INetFwIcmpSettings **icmpSettings )
252 fw_profile *This = impl_from_INetFwProfile( iface );
254 FIXME("%p, %p\n", This, icmpSettings);
255 return E_NOTIMPL;
258 static HRESULT WINAPI fw_profile_get_GloballyOpenPorts(
259 INetFwProfile *iface,
260 INetFwOpenPorts **openPorts )
262 fw_profile *This = impl_from_INetFwProfile( iface );
264 TRACE("%p, %p\n", This, openPorts);
265 return NetFwOpenPorts_create( NULL, (void **)openPorts );
268 static HRESULT WINAPI fw_profile_get_Services(
269 INetFwProfile *iface,
270 INetFwServices **Services )
272 fw_profile *This = impl_from_INetFwProfile( iface );
274 TRACE("%p, %p\n", This, Services);
275 return NetFwServices_create( NULL, (void **)Services );
278 static HRESULT WINAPI fw_profile_get_AuthorizedApplications(
279 INetFwProfile *iface,
280 INetFwAuthorizedApplications **apps )
282 fw_profile *This = impl_from_INetFwProfile( iface );
284 TRACE("%p, %p\n", This, apps);
285 return NetFwAuthorizedApplications_create( NULL, (void **)apps );
288 static const struct INetFwProfileVtbl fw_profile_vtbl =
290 fw_profile_QueryInterface,
291 fw_profile_AddRef,
292 fw_profile_Release,
293 fw_profile_GetTypeInfoCount,
294 fw_profile_GetTypeInfo,
295 fw_profile_GetIDsOfNames,
296 fw_profile_Invoke,
297 fw_profile_get_Type,
298 fw_profile_get_FirewallEnabled,
299 fw_profile_put_FirewallEnabled,
300 fw_profile_get_ExceptionsNotAllowed,
301 fw_profile_put_ExceptionsNotAllowed,
302 fw_profile_get_NotificationsDisabled,
303 fw_profile_put_NotificationsDisabled,
304 fw_profile_get_UnicastResponsesToMulticastBroadcastDisabled,
305 fw_profile_put_UnicastResponsesToMulticastBroadcastDisabled,
306 fw_profile_get_RemoteAdminSettings,
307 fw_profile_get_IcmpSettings,
308 fw_profile_get_GloballyOpenPorts,
309 fw_profile_get_Services,
310 fw_profile_get_AuthorizedApplications
313 HRESULT NetFwProfile_create( IUnknown *pUnkOuter, LPVOID *ppObj )
315 fw_profile *fp;
317 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
319 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
320 if (!fp) return E_OUTOFMEMORY;
322 fp->INetFwProfile_iface.lpVtbl = &fw_profile_vtbl;
323 fp->refs = 1;
325 *ppObj = &fp->INetFwProfile_iface;
327 TRACE("returning iface %p\n", *ppObj);
328 return S_OK;