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
30 #include "wine/debug.h"
31 #include "hnetcfg_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg
);
35 typedef struct fw_manager
37 INetFwMgr INetFwMgr_iface
;
41 static inline fw_manager
*impl_from_INetFwMgr( INetFwMgr
*iface
)
43 return CONTAINING_RECORD(iface
, fw_manager
, INetFwMgr_iface
);
46 static ULONG WINAPI
fw_manager_AddRef(
49 fw_manager
*fw_manager
= impl_from_INetFwMgr( iface
);
50 return InterlockedIncrement( &fw_manager
->refs
);
53 static ULONG WINAPI
fw_manager_Release(
56 fw_manager
*fw_manager
= impl_from_INetFwMgr( iface
);
57 LONG refs
= InterlockedDecrement( &fw_manager
->refs
);
60 TRACE("destroying %p\n", fw_manager
);
61 HeapFree( GetProcessHeap(), 0, fw_manager
);
66 static HRESULT WINAPI
fw_manager_QueryInterface(
71 fw_manager
*This
= impl_from_INetFwMgr( iface
);
73 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
75 if ( IsEqualGUID( riid
, &IID_INetFwMgr
) ||
76 IsEqualGUID( riid
, &IID_IDispatch
) ||
77 IsEqualGUID( riid
, &IID_IUnknown
) )
83 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
86 INetFwMgr_AddRef( iface
);
90 static HRESULT WINAPI
fw_manager_GetTypeInfoCount(
94 fw_manager
*This
= impl_from_INetFwMgr( iface
);
96 TRACE("%p %p\n", This
, pctinfo
);
101 static HRESULT WINAPI
fw_manager_GetTypeInfo(
105 ITypeInfo
**ppTInfo
)
107 fw_manager
*This
= impl_from_INetFwMgr( iface
);
109 TRACE("%p %u %u %p\n", This
, iTInfo
, lcid
, ppTInfo
);
110 return get_typeinfo( INetFwMgr_tid
, ppTInfo
);
113 static HRESULT WINAPI
fw_manager_GetIDsOfNames(
121 fw_manager
*This
= impl_from_INetFwMgr( iface
);
125 TRACE("%p %s %p %u %u %p\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
127 hr
= get_typeinfo( INetFwMgr_tid
, &typeinfo
);
130 hr
= ITypeInfo_GetIDsOfNames( typeinfo
, rgszNames
, cNames
, rgDispId
);
131 ITypeInfo_Release( typeinfo
);
136 static HRESULT WINAPI
fw_manager_Invoke(
142 DISPPARAMS
*pDispParams
,
144 EXCEPINFO
*pExcepInfo
,
147 fw_manager
*This
= impl_from_INetFwMgr( iface
);
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( INetFwMgr_tid
, &typeinfo
);
157 hr
= ITypeInfo_Invoke( typeinfo
, &This
->INetFwMgr_iface
, dispIdMember
,
158 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
159 ITypeInfo_Release( typeinfo
);
164 static HRESULT WINAPI
fw_manager_get_LocalPolicy(
166 INetFwPolicy
**localPolicy
)
168 fw_manager
*This
= impl_from_INetFwMgr( iface
);
170 TRACE("%p, %p\n", This
, localPolicy
);
171 return NetFwPolicy_create( NULL
, (void **)localPolicy
);
174 static HRESULT WINAPI
fw_manager_get_CurrentProfileType(
176 NET_FW_PROFILE_TYPE
*profileType
)
178 fw_manager
*This
= impl_from_INetFwMgr( iface
);
180 FIXME("%p, %p\n", This
, profileType
);
184 static HRESULT WINAPI
fw_manager_RestoreDefaults(
187 fw_manager
*This
= impl_from_INetFwMgr( iface
);
193 static HRESULT WINAPI
fw_manager_IsPortAllowed(
196 NET_FW_IP_VERSION ipVersion
,
199 NET_FW_IP_PROTOCOL ipProtocol
,
201 VARIANT
*restricted
)
203 fw_manager
*This
= impl_from_INetFwMgr( iface
);
205 FIXME("%p, %s, %u, %d, %s, %u, %p, %p\n", This
, debugstr_w(imageFileName
),
206 ipVersion
, portNumber
, debugstr_w(localAddress
), ipProtocol
, allowed
, restricted
);
210 static HRESULT WINAPI
fw_manager_IsIcmpTypeAllowed(
212 NET_FW_IP_VERSION ipVersion
,
216 VARIANT
*restricted
)
218 fw_manager
*This
= impl_from_INetFwMgr( iface
);
220 FIXME("%p, %u, %s, %u, %p, %p\n", This
, ipVersion
, debugstr_w(localAddress
),
221 type
, allowed
, restricted
);
225 static const struct INetFwMgrVtbl fw_manager_vtbl
=
227 fw_manager_QueryInterface
,
230 fw_manager_GetTypeInfoCount
,
231 fw_manager_GetTypeInfo
,
232 fw_manager_GetIDsOfNames
,
234 fw_manager_get_LocalPolicy
,
235 fw_manager_get_CurrentProfileType
,
236 fw_manager_RestoreDefaults
,
237 fw_manager_IsPortAllowed
,
238 fw_manager_IsIcmpTypeAllowed
241 HRESULT
NetFwMgr_create( IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
245 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
247 fm
= HeapAlloc( GetProcessHeap(), 0, sizeof(*fm
) );
248 if (!fm
) return E_OUTOFMEMORY
;
250 fm
->INetFwMgr_iface
.lpVtbl
= &fw_manager_vtbl
;
253 *ppObj
= &fm
->INetFwMgr_iface
;
255 TRACE("returning iface %p\n", *ppObj
);