Release 6.15.
[wine.git] / dlls / hnetcfg / profile.c
blobd0e9f48dab4d0e940083dee6aa132d8608b27f1e
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 <stdarg.h>
20 #include <stdio.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
28 #include "netfw.h"
30 #include "wine/debug.h"
31 #include "hnetcfg_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
35 typedef struct fw_profile
37 INetFwProfile INetFwProfile_iface;
38 LONG refs;
39 } fw_profile;
41 static inline fw_profile *impl_from_INetFwProfile( INetFwProfile *iface )
43 return CONTAINING_RECORD(iface, fw_profile, INetFwProfile_iface);
46 static ULONG WINAPI fw_profile_AddRef(
47 INetFwProfile *iface )
49 fw_profile *fw_profile = impl_from_INetFwProfile( iface );
50 return InterlockedIncrement( &fw_profile->refs );
53 static ULONG WINAPI fw_profile_Release(
54 INetFwProfile *iface )
56 fw_profile *fw_profile = impl_from_INetFwProfile( iface );
57 LONG refs = InterlockedDecrement( &fw_profile->refs );
58 if (!refs)
60 TRACE("destroying %p\n", fw_profile);
61 HeapFree( GetProcessHeap(), 0, fw_profile );
63 return refs;
66 static HRESULT WINAPI fw_profile_QueryInterface(
67 INetFwProfile *iface,
68 REFIID riid,
69 void **ppvObject )
71 fw_profile *This = impl_from_INetFwProfile( iface );
73 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
75 if ( IsEqualGUID( riid, &IID_INetFwProfile ) ||
76 IsEqualGUID( riid, &IID_IDispatch ) ||
77 IsEqualGUID( riid, &IID_IUnknown ) )
79 *ppvObject = iface;
81 else
83 FIXME("interface %s not implemented\n", debugstr_guid(riid));
84 return E_NOINTERFACE;
86 INetFwProfile_AddRef( iface );
87 return S_OK;
90 static HRESULT WINAPI fw_profile_GetTypeInfoCount(
91 INetFwProfile *iface,
92 UINT *pctinfo )
94 fw_profile *This = impl_from_INetFwProfile( iface );
96 TRACE("%p %p\n", This, pctinfo);
97 *pctinfo = 1;
98 return S_OK;
101 static HRESULT WINAPI fw_profile_GetTypeInfo(
102 INetFwProfile *iface,
103 UINT iTInfo,
104 LCID lcid,
105 ITypeInfo **ppTInfo )
107 fw_profile *This = impl_from_INetFwProfile( iface );
109 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
110 return get_typeinfo( INetFwProfile_tid, ppTInfo );
113 static HRESULT WINAPI fw_profile_GetIDsOfNames(
114 INetFwProfile *iface,
115 REFIID riid,
116 LPOLESTR *rgszNames,
117 UINT cNames,
118 LCID lcid,
119 DISPID *rgDispId )
121 fw_profile *This = impl_from_INetFwProfile( iface );
122 ITypeInfo *typeinfo;
123 HRESULT hr;
125 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
127 hr = get_typeinfo( INetFwProfile_tid, &typeinfo );
128 if (SUCCEEDED(hr))
130 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
131 ITypeInfo_Release( typeinfo );
133 return hr;
136 static HRESULT WINAPI fw_profile_Invoke(
137 INetFwProfile *iface,
138 DISPID dispIdMember,
139 REFIID riid,
140 LCID lcid,
141 WORD wFlags,
142 DISPPARAMS *pDispParams,
143 VARIANT *pVarResult,
144 EXCEPINFO *pExcepInfo,
145 UINT *puArgErr )
147 fw_profile *This = impl_from_INetFwProfile( iface );
148 ITypeInfo *typeinfo;
149 HRESULT hr;
151 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
152 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
154 hr = get_typeinfo( INetFwProfile_tid, &typeinfo );
155 if (SUCCEEDED(hr))
157 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwProfile_iface, dispIdMember,
158 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
159 ITypeInfo_Release( typeinfo );
161 return hr;
164 static HRESULT WINAPI fw_profile_get_Type(
165 INetFwProfile *iface,
166 NET_FW_PROFILE_TYPE *type )
168 fw_profile *This = impl_from_INetFwProfile( iface );
170 FIXME("%p, %p\n", This, type);
171 return E_NOTIMPL;
174 static HRESULT WINAPI fw_profile_get_FirewallEnabled(
175 INetFwProfile *iface,
176 VARIANT_BOOL *enabled )
178 fw_profile *This = impl_from_INetFwProfile( iface );
180 FIXME("%p, %p\n", This, enabled);
182 *enabled = VARIANT_FALSE;
183 return S_OK;
186 static HRESULT WINAPI fw_profile_put_FirewallEnabled(
187 INetFwProfile *iface,
188 VARIANT_BOOL enabled )
190 fw_profile *This = impl_from_INetFwProfile( iface );
192 FIXME("%p, %d\n", This, enabled);
193 return E_NOTIMPL;
196 static HRESULT WINAPI fw_profile_get_ExceptionsNotAllowed(
197 INetFwProfile *iface,
198 VARIANT_BOOL *notAllowed )
200 fw_profile *This = impl_from_INetFwProfile( iface );
202 FIXME("%p, %p\n", This, notAllowed);
203 return E_NOTIMPL;
206 static HRESULT WINAPI fw_profile_put_ExceptionsNotAllowed(
207 INetFwProfile *iface,
208 VARIANT_BOOL notAllowed )
210 fw_profile *This = impl_from_INetFwProfile( iface );
212 FIXME("%p, %d\n", This, notAllowed);
213 return E_NOTIMPL;
216 static HRESULT WINAPI fw_profile_get_NotificationsDisabled(
217 INetFwProfile *iface,
218 VARIANT_BOOL *disabled )
220 fw_profile *This = impl_from_INetFwProfile( iface );
222 FIXME("%p, %p\n", This, disabled);
223 return E_NOTIMPL;
226 static HRESULT WINAPI fw_profile_put_NotificationsDisabled(
227 INetFwProfile *iface,
228 VARIANT_BOOL disabled )
230 fw_profile *This = impl_from_INetFwProfile( iface );
232 FIXME("%p, %d\n", This, disabled);
233 return E_NOTIMPL;
236 static HRESULT WINAPI fw_profile_get_UnicastResponsesToMulticastBroadcastDisabled(
237 INetFwProfile *iface,
238 VARIANT_BOOL *disabled )
240 fw_profile *This = impl_from_INetFwProfile( iface );
242 FIXME("%p, %p\n", This, disabled);
243 return E_NOTIMPL;
246 static HRESULT WINAPI fw_profile_put_UnicastResponsesToMulticastBroadcastDisabled(
247 INetFwProfile *iface,
248 VARIANT_BOOL disabled )
250 fw_profile *This = impl_from_INetFwProfile( iface );
252 FIXME("%p, %d\n", This, disabled);
253 return E_NOTIMPL;
256 static HRESULT WINAPI fw_profile_get_RemoteAdminSettings(
257 INetFwProfile *iface,
258 INetFwRemoteAdminSettings **remoteAdminSettings )
260 fw_profile *This = impl_from_INetFwProfile( iface );
262 FIXME("%p, %p\n", This, remoteAdminSettings);
263 return E_NOTIMPL;
266 static HRESULT WINAPI fw_profile_get_IcmpSettings(
267 INetFwProfile *iface,
268 INetFwIcmpSettings **icmpSettings )
270 fw_profile *This = impl_from_INetFwProfile( iface );
272 FIXME("%p, %p\n", This, icmpSettings);
273 return E_NOTIMPL;
276 static HRESULT WINAPI fw_profile_get_GloballyOpenPorts(
277 INetFwProfile *iface,
278 INetFwOpenPorts **openPorts )
280 fw_profile *This = impl_from_INetFwProfile( iface );
282 TRACE("%p, %p\n", This, openPorts);
283 return NetFwOpenPorts_create( NULL, (void **)openPorts );
286 static HRESULT WINAPI fw_profile_get_Services(
287 INetFwProfile *iface,
288 INetFwServices **Services )
290 fw_profile *This = impl_from_INetFwProfile( iface );
292 TRACE("%p, %p\n", This, Services);
293 return NetFwServices_create( NULL, (void **)Services );
296 static HRESULT WINAPI fw_profile_get_AuthorizedApplications(
297 INetFwProfile *iface,
298 INetFwAuthorizedApplications **apps )
300 fw_profile *This = impl_from_INetFwProfile( iface );
302 TRACE("%p, %p\n", This, apps);
303 return NetFwAuthorizedApplications_create( NULL, (void **)apps );
306 static const struct INetFwProfileVtbl fw_profile_vtbl =
308 fw_profile_QueryInterface,
309 fw_profile_AddRef,
310 fw_profile_Release,
311 fw_profile_GetTypeInfoCount,
312 fw_profile_GetTypeInfo,
313 fw_profile_GetIDsOfNames,
314 fw_profile_Invoke,
315 fw_profile_get_Type,
316 fw_profile_get_FirewallEnabled,
317 fw_profile_put_FirewallEnabled,
318 fw_profile_get_ExceptionsNotAllowed,
319 fw_profile_put_ExceptionsNotAllowed,
320 fw_profile_get_NotificationsDisabled,
321 fw_profile_put_NotificationsDisabled,
322 fw_profile_get_UnicastResponsesToMulticastBroadcastDisabled,
323 fw_profile_put_UnicastResponsesToMulticastBroadcastDisabled,
324 fw_profile_get_RemoteAdminSettings,
325 fw_profile_get_IcmpSettings,
326 fw_profile_get_GloballyOpenPorts,
327 fw_profile_get_Services,
328 fw_profile_get_AuthorizedApplications
331 HRESULT NetFwProfile_create( IUnknown *pUnkOuter, LPVOID *ppObj )
333 fw_profile *fp;
335 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
337 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
338 if (!fp) return E_OUTOFMEMORY;
340 fp->INetFwProfile_iface.lpVtbl = &fw_profile_vtbl;
341 fp->refs = 1;
343 *ppObj = &fp->INetFwProfile_iface;
345 TRACE("returning iface %p\n", *ppObj);
346 return S_OK;