ddraw/tests: Rewrite StructSizeTest().
[wine.git] / dlls / hnetcfg / profile.c
blob835e82ed14b0de47ffecc040a3b753c81d0f7623
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 TRACE("%p %p\n", This, pctinfo);
99 *pctinfo = 1;
100 return S_OK;
103 static HRESULT WINAPI fw_profile_GetTypeInfo(
104 INetFwProfile *iface,
105 UINT iTInfo,
106 LCID lcid,
107 ITypeInfo **ppTInfo )
109 fw_profile *This = impl_from_INetFwProfile( iface );
111 TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
112 return get_typeinfo( INetFwProfile_tid, ppTInfo );
115 static HRESULT WINAPI fw_profile_GetIDsOfNames(
116 INetFwProfile *iface,
117 REFIID riid,
118 LPOLESTR *rgszNames,
119 UINT cNames,
120 LCID lcid,
121 DISPID *rgDispId )
123 fw_profile *This = impl_from_INetFwProfile( iface );
124 ITypeInfo *typeinfo;
125 HRESULT hr;
127 TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
129 hr = get_typeinfo( INetFwProfile_tid, &typeinfo );
130 if (SUCCEEDED(hr))
132 hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
133 ITypeInfo_Release( typeinfo );
135 return hr;
138 static HRESULT WINAPI fw_profile_Invoke(
139 INetFwProfile *iface,
140 DISPID dispIdMember,
141 REFIID riid,
142 LCID lcid,
143 WORD wFlags,
144 DISPPARAMS *pDispParams,
145 VARIANT *pVarResult,
146 EXCEPINFO *pExcepInfo,
147 UINT *puArgErr )
149 fw_profile *This = impl_from_INetFwProfile( iface );
150 ITypeInfo *typeinfo;
151 HRESULT hr;
153 TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
154 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
156 hr = get_typeinfo( INetFwProfile_tid, &typeinfo );
157 if (SUCCEEDED(hr))
159 hr = ITypeInfo_Invoke( typeinfo, &This->INetFwProfile_iface, dispIdMember,
160 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
161 ITypeInfo_Release( typeinfo );
163 return hr;
166 static HRESULT WINAPI fw_profile_get_Type(
167 INetFwProfile *iface,
168 NET_FW_PROFILE_TYPE *type )
170 fw_profile *This = impl_from_INetFwProfile( iface );
172 FIXME("%p, %p\n", This, type);
173 return E_NOTIMPL;
176 static HRESULT WINAPI fw_profile_get_FirewallEnabled(
177 INetFwProfile *iface,
178 VARIANT_BOOL *enabled )
180 fw_profile *This = impl_from_INetFwProfile( iface );
182 FIXME("%p, %p\n", This, enabled);
184 *enabled = VARIANT_FALSE;
185 return S_OK;
188 static HRESULT WINAPI fw_profile_put_FirewallEnabled(
189 INetFwProfile *iface,
190 VARIANT_BOOL enabled )
192 fw_profile *This = impl_from_INetFwProfile( iface );
194 FIXME("%p, %d\n", This, enabled);
195 return E_NOTIMPL;
198 static HRESULT WINAPI fw_profile_get_ExceptionsNotAllowed(
199 INetFwProfile *iface,
200 VARIANT_BOOL *notAllowed )
202 fw_profile *This = impl_from_INetFwProfile( iface );
204 FIXME("%p, %p\n", This, notAllowed);
205 return E_NOTIMPL;
208 static HRESULT WINAPI fw_profile_put_ExceptionsNotAllowed(
209 INetFwProfile *iface,
210 VARIANT_BOOL notAllowed )
212 fw_profile *This = impl_from_INetFwProfile( iface );
214 FIXME("%p, %d\n", This, notAllowed);
215 return E_NOTIMPL;
218 static HRESULT WINAPI fw_profile_get_NotificationsDisabled(
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_NotificationsDisabled(
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_UnicastResponsesToMulticastBroadcastDisabled(
239 INetFwProfile *iface,
240 VARIANT_BOOL *disabled )
242 fw_profile *This = impl_from_INetFwProfile( iface );
244 FIXME("%p, %p\n", This, disabled);
245 return E_NOTIMPL;
248 static HRESULT WINAPI fw_profile_put_UnicastResponsesToMulticastBroadcastDisabled(
249 INetFwProfile *iface,
250 VARIANT_BOOL disabled )
252 fw_profile *This = impl_from_INetFwProfile( iface );
254 FIXME("%p, %d\n", This, disabled);
255 return E_NOTIMPL;
258 static HRESULT WINAPI fw_profile_get_RemoteAdminSettings(
259 INetFwProfile *iface,
260 INetFwRemoteAdminSettings **remoteAdminSettings )
262 fw_profile *This = impl_from_INetFwProfile( iface );
264 FIXME("%p, %p\n", This, remoteAdminSettings);
265 return E_NOTIMPL;
268 static HRESULT WINAPI fw_profile_get_IcmpSettings(
269 INetFwProfile *iface,
270 INetFwIcmpSettings **icmpSettings )
272 fw_profile *This = impl_from_INetFwProfile( iface );
274 FIXME("%p, %p\n", This, icmpSettings);
275 return E_NOTIMPL;
278 static HRESULT WINAPI fw_profile_get_GloballyOpenPorts(
279 INetFwProfile *iface,
280 INetFwOpenPorts **openPorts )
282 fw_profile *This = impl_from_INetFwProfile( iface );
284 TRACE("%p, %p\n", This, openPorts);
285 return NetFwOpenPorts_create( NULL, (void **)openPorts );
288 static HRESULT WINAPI fw_profile_get_Services(
289 INetFwProfile *iface,
290 INetFwServices **Services )
292 fw_profile *This = impl_from_INetFwProfile( iface );
294 TRACE("%p, %p\n", This, Services);
295 return NetFwServices_create( NULL, (void **)Services );
298 static HRESULT WINAPI fw_profile_get_AuthorizedApplications(
299 INetFwProfile *iface,
300 INetFwAuthorizedApplications **apps )
302 fw_profile *This = impl_from_INetFwProfile( iface );
304 TRACE("%p, %p\n", This, apps);
305 return NetFwAuthorizedApplications_create( NULL, (void **)apps );
308 static const struct INetFwProfileVtbl fw_profile_vtbl =
310 fw_profile_QueryInterface,
311 fw_profile_AddRef,
312 fw_profile_Release,
313 fw_profile_GetTypeInfoCount,
314 fw_profile_GetTypeInfo,
315 fw_profile_GetIDsOfNames,
316 fw_profile_Invoke,
317 fw_profile_get_Type,
318 fw_profile_get_FirewallEnabled,
319 fw_profile_put_FirewallEnabled,
320 fw_profile_get_ExceptionsNotAllowed,
321 fw_profile_put_ExceptionsNotAllowed,
322 fw_profile_get_NotificationsDisabled,
323 fw_profile_put_NotificationsDisabled,
324 fw_profile_get_UnicastResponsesToMulticastBroadcastDisabled,
325 fw_profile_put_UnicastResponsesToMulticastBroadcastDisabled,
326 fw_profile_get_RemoteAdminSettings,
327 fw_profile_get_IcmpSettings,
328 fw_profile_get_GloballyOpenPorts,
329 fw_profile_get_Services,
330 fw_profile_get_AuthorizedApplications
333 HRESULT NetFwProfile_create( IUnknown *pUnkOuter, LPVOID *ppObj )
335 fw_profile *fp;
337 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
339 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
340 if (!fp) return E_OUTOFMEMORY;
342 fp->INetFwProfile_iface.lpVtbl = &fw_profile_vtbl;
343 fp->refs = 1;
345 *ppObj = &fp->INetFwProfile_iface;
347 TRACE("returning iface %p\n", *ppObj);
348 return S_OK;