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
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_policy
39 INetFwPolicy INetFwPolicy_iface
;
43 static inline fw_policy
*impl_from_INetFwPolicy( INetFwPolicy
*iface
)
45 return CONTAINING_RECORD(iface
, fw_policy
, INetFwPolicy_iface
);
48 static ULONG WINAPI
fw_policy_AddRef(
51 fw_policy
*fw_policy
= impl_from_INetFwPolicy( iface
);
52 return InterlockedIncrement( &fw_policy
->refs
);
55 static ULONG WINAPI
fw_policy_Release(
58 fw_policy
*fw_policy
= impl_from_INetFwPolicy( iface
);
59 LONG refs
= InterlockedDecrement( &fw_policy
->refs
);
62 TRACE("destroying %p\n", fw_policy
);
63 HeapFree( GetProcessHeap(), 0, fw_policy
);
68 static HRESULT WINAPI
fw_policy_QueryInterface(
73 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
75 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
77 if ( IsEqualGUID( riid
, &IID_INetFwPolicy
) ||
78 IsEqualGUID( riid
, &IID_IDispatch
) ||
79 IsEqualGUID( riid
, &IID_IUnknown
) )
85 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
88 INetFwPolicy_AddRef( iface
);
92 static HRESULT WINAPI
fw_policy_GetTypeInfoCount(
96 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
98 TRACE("%p %p\n", This
, pctinfo
);
103 static HRESULT WINAPI
fw_policy_GetTypeInfo(
107 ITypeInfo
**ppTInfo
)
109 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
111 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
112 return get_typeinfo( INetFwPolicy_tid
, ppTInfo
);
115 static HRESULT WINAPI
fw_policy_GetIDsOfNames(
123 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
127 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
129 hr
= get_typeinfo( INetFwPolicy_tid
, &typeinfo
);
132 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
133 ITypeInfo_Release( typeinfo
);
138 static HRESULT WINAPI
fw_policy_Invoke(
144 DISPPARAMS
*pDispParams
,
146 EXCEPINFO
*pExcepInfo
,
149 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
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( INetFwPolicy_tid
, &typeinfo
);
159 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwPolicy_iface
, dispIdMember
,
160 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
161 ITypeInfo_Release( typeinfo
);
166 static HRESULT WINAPI
fw_policy_get_CurrentProfile(
168 INetFwProfile
**profile
)
170 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
172 TRACE("%p, %p\n", This
, profile
);
173 return NetFwProfile_create( NULL
, (void **)profile
);
176 static HRESULT WINAPI
fw_policy_GetProfileByType(
178 NET_FW_PROFILE_TYPE profileType
,
179 INetFwProfile
**profile
)
181 fw_policy
*This
= impl_from_INetFwPolicy( iface
);
183 FIXME("%p, %u, %p\n", This
, profileType
, profile
);
187 static const struct INetFwPolicyVtbl fw_policy_vtbl
=
189 fw_policy_QueryInterface
,
192 fw_policy_GetTypeInfoCount
,
193 fw_policy_GetTypeInfo
,
194 fw_policy_GetIDsOfNames
,
196 fw_policy_get_CurrentProfile
,
197 fw_policy_GetProfileByType
200 HRESULT
NetFwPolicy_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
204 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
206 fp
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fp
) );
207 if (!fp
) return E_OUTOFMEMORY
;
209 fp
->INetFwPolicy_iface
.lpVtbl
= &fw_policy_vtbl
;
212 *ppObj
= &fp
->INetFwPolicy_iface
;
214 TRACE("returning iface %p\n", *ppObj
);