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
32 #include "wine/debug.h"
33 #include "wine/unicode.h"
34 #include "hnetcfg_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg
);
38 typedef struct fw_manager
40 INetFwMgr INetFwMgr_iface
;
44 static inline fw_manager
*impl_from_INetFwMgr( INetFwMgr
*iface
)
46 return CONTAINING_RECORD(iface
, fw_manager
, INetFwMgr_iface
);
49 static ULONG WINAPI
fw_manager_AddRef(
52 fw_manager
*fw_manager
= impl_from_INetFwMgr( iface
);
53 return InterlockedIncrement( &fw_manager
->refs
);
56 static ULONG WINAPI
fw_manager_Release(
59 fw_manager
*fw_manager
= impl_from_INetFwMgr( iface
);
60 LONG refs
= InterlockedDecrement( &fw_manager
->refs
);
63 TRACE("destroying %p\n", fw_manager
);
64 HeapFree( GetProcessHeap(), 0, fw_manager
);
69 static HRESULT WINAPI
fw_manager_QueryInterface(
74 fw_manager
*This
= impl_from_INetFwMgr( iface
);
76 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
78 if ( IsEqualGUID( riid
, &IID_INetFwMgr
) ||
79 IsEqualGUID( riid
, &IID_IDispatch
) ||
80 IsEqualGUID( riid
, &IID_IUnknown
) )
86 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
89 INetFwMgr_AddRef( iface
);
93 static HRESULT WINAPI
fw_manager_GetTypeInfoCount(
97 fw_manager
*This
= impl_from_INetFwMgr( iface
);
99 TRACE("%p %p\n", This
, pctinfo
);
104 static HRESULT WINAPI
fw_manager_GetTypeInfo(
108 ITypeInfo
**ppTInfo
)
110 fw_manager
*This
= impl_from_INetFwMgr( iface
);
112 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
113 return get_typeinfo( INetFwMgr_tid
, ppTInfo
);
116 static HRESULT WINAPI
fw_manager_GetIDsOfNames(
124 fw_manager
*This
= impl_from_INetFwMgr( iface
);
128 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
130 hr
= get_typeinfo( INetFwMgr_tid
, &typeinfo
);
133 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
134 ITypeInfo_Release( typeinfo
);
139 static HRESULT WINAPI
fw_manager_Invoke(
145 DISPPARAMS
*pDispParams
,
147 EXCEPINFO
*pExcepInfo
,
150 fw_manager
*This
= impl_from_INetFwMgr( iface
);
154 TRACE("%p %d %s %d %d %p %p %p %p\n", This
, dispIdMember
, debugstr_guid(riid
),
155 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
157 hr
= get_typeinfo( INetFwMgr_tid
, &typeinfo
);
160 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwMgr_iface
, dispIdMember
,
161 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
162 ITypeInfo_Release( typeinfo
);
167 static HRESULT WINAPI
fw_manager_get_LocalPolicy(
169 INetFwPolicy
**localPolicy
)
171 fw_manager
*This
= impl_from_INetFwMgr( iface
);
173 TRACE("%p, %p\n", This
, localPolicy
);
174 return NetFwPolicy_create( NULL
, (void **)localPolicy
);
177 static HRESULT WINAPI
fw_manager_get_CurrentProfileType(
179 NET_FW_PROFILE_TYPE
*profileType
)
181 fw_manager
*This
= impl_from_INetFwMgr( iface
);
183 FIXME("%p, %p\n", This
, profileType
);
187 static HRESULT WINAPI
fw_manager_RestoreDefaults(
190 fw_manager
*This
= impl_from_INetFwMgr( iface
);
196 static HRESULT WINAPI
fw_manager_IsPortAllowed(
199 NET_FW_IP_VERSION ipVersion
,
202 NET_FW_IP_PROTOCOL ipProtocol
,
204 VARIANT
*restricted
)
206 fw_manager
*This
= impl_from_INetFwMgr( iface
);
208 FIXME("%p, %s, %u, %d, %s, %u, %p, %p\n", This
, debugstr_w(imageFileName
),
209 ipVersion
, portNumber
, debugstr_w(localAddress
), ipProtocol
, allowed
, restricted
);
213 static HRESULT WINAPI
fw_manager_IsIcmpTypeAllowed(
215 NET_FW_IP_VERSION ipVersion
,
219 VARIANT
*restricted
)
221 fw_manager
*This
= impl_from_INetFwMgr( iface
);
223 FIXME("%p, %u, %s, %u, %p, %p\n", This
, ipVersion
, debugstr_w(localAddress
),
224 type
, allowed
, restricted
);
228 static const struct INetFwMgrVtbl fw_manager_vtbl
=
230 fw_manager_QueryInterface
,
233 fw_manager_GetTypeInfoCount
,
234 fw_manager_GetTypeInfo
,
235 fw_manager_GetIDsOfNames
,
237 fw_manager_get_LocalPolicy
,
238 fw_manager_get_CurrentProfileType
,
239 fw_manager_RestoreDefaults
,
240 fw_manager_IsPortAllowed
,
241 fw_manager_IsIcmpTypeAllowed
244 HRESULT
NetFwMgr_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
248 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
250 fm
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fm
) );
251 if (!fm
) return E_OUTOFMEMORY
;
253 fm
->INetFwMgr_iface
.lpVtbl
= &fw_manager_vtbl
;
256 *ppObj
= &fm
->INetFwMgr_iface
;
258 TRACE("returning iface %p\n", *ppObj
);