1c2c66affSColin Finck /*
2c2c66affSColin Finck * Copyright 2009 Hans Leidekker for CodeWeavers
3c2c66affSColin Finck *
4c2c66affSColin Finck * This library is free software; you can redistribute it and/or
5c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
6c2c66affSColin Finck * License as published by the Free Software Foundation; either
7c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
8c2c66affSColin Finck *
9c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
10c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
11c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12c2c66affSColin Finck * Lesser General Public License for more details.
13c2c66affSColin Finck *
14c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
15c2c66affSColin Finck * License along with this library; if not, write to the Free Software
16c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17c2c66affSColin Finck */
18c2c66affSColin Finck
1936755f12SAmine Khaldi #include <stdarg.h>
2036755f12SAmine Khaldi #include <stdio.h>
2136755f12SAmine Khaldi
2236755f12SAmine Khaldi #define COBJMACROS
2336755f12SAmine Khaldi
2436755f12SAmine Khaldi #include "windef.h"
2536755f12SAmine Khaldi #include "winbase.h"
2636755f12SAmine Khaldi #include "winuser.h"
2736755f12SAmine Khaldi #include "ole2.h"
2836755f12SAmine Khaldi #include "netfw.h"
29*7c98f220SAmine Khaldi #include "natupnp.h"
30*7c98f220SAmine Khaldi #ifdef __REACTOS__
31*7c98f220SAmine Khaldi #include "winnetwk.h"
32*7c98f220SAmine Khaldi #endif
3336755f12SAmine Khaldi
3436755f12SAmine Khaldi #include "wine/debug.h"
35*7c98f220SAmine Khaldi #include "wine/heap.h"
36c2c66affSColin Finck #include "hnetcfg_private.h"
37c2c66affSColin Finck
3836755f12SAmine Khaldi WINE_DEFAULT_DEBUG_CHANNEL(hnetcfg);
39c2c66affSColin Finck
40c2c66affSColin Finck typedef struct fw_app
41c2c66affSColin Finck {
42c2c66affSColin Finck INetFwAuthorizedApplication INetFwAuthorizedApplication_iface;
43c2c66affSColin Finck LONG refs;
4436755f12SAmine Khaldi BSTR filename;
45c2c66affSColin Finck } fw_app;
46c2c66affSColin Finck
impl_from_INetFwAuthorizedApplication(INetFwAuthorizedApplication * iface)47c2c66affSColin Finck static inline fw_app *impl_from_INetFwAuthorizedApplication( INetFwAuthorizedApplication *iface )
48c2c66affSColin Finck {
49c2c66affSColin Finck return CONTAINING_RECORD(iface, fw_app, INetFwAuthorizedApplication_iface);
50c2c66affSColin Finck }
51c2c66affSColin Finck
fw_app_AddRef(INetFwAuthorizedApplication * iface)52c2c66affSColin Finck static ULONG WINAPI fw_app_AddRef(
53c2c66affSColin Finck INetFwAuthorizedApplication *iface )
54c2c66affSColin Finck {
55c2c66affSColin Finck fw_app *fw_app = impl_from_INetFwAuthorizedApplication( iface );
56c2c66affSColin Finck return InterlockedIncrement( &fw_app->refs );
57c2c66affSColin Finck }
58c2c66affSColin Finck
fw_app_Release(INetFwAuthorizedApplication * iface)59c2c66affSColin Finck static ULONG WINAPI fw_app_Release(
60c2c66affSColin Finck INetFwAuthorizedApplication *iface )
61c2c66affSColin Finck {
62c2c66affSColin Finck fw_app *fw_app = impl_from_INetFwAuthorizedApplication( iface );
63c2c66affSColin Finck LONG refs = InterlockedDecrement( &fw_app->refs );
64c2c66affSColin Finck if (!refs)
65c2c66affSColin Finck {
66c2c66affSColin Finck TRACE("destroying %p\n", fw_app);
671d62a5beSAmine Khaldi SysFreeString( fw_app->filename );
68c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, fw_app );
69c2c66affSColin Finck }
70c2c66affSColin Finck return refs;
71c2c66affSColin Finck }
72c2c66affSColin Finck
fw_app_QueryInterface(INetFwAuthorizedApplication * iface,REFIID riid,void ** ppvObject)73c2c66affSColin Finck static HRESULT WINAPI fw_app_QueryInterface(
74c2c66affSColin Finck INetFwAuthorizedApplication *iface,
75c2c66affSColin Finck REFIID riid,
76c2c66affSColin Finck void **ppvObject )
77c2c66affSColin Finck {
78c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
79c2c66affSColin Finck
80c2c66affSColin Finck TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
81c2c66affSColin Finck
82c2c66affSColin Finck if ( IsEqualGUID( riid, &IID_INetFwAuthorizedApplication ) ||
83c2c66affSColin Finck IsEqualGUID( riid, &IID_IDispatch ) ||
84c2c66affSColin Finck IsEqualGUID( riid, &IID_IUnknown ) )
85c2c66affSColin Finck {
86c2c66affSColin Finck *ppvObject = iface;
87c2c66affSColin Finck }
88c2c66affSColin Finck else
89c2c66affSColin Finck {
90c2c66affSColin Finck FIXME("interface %s not implemented\n", debugstr_guid(riid));
91c2c66affSColin Finck return E_NOINTERFACE;
92c2c66affSColin Finck }
93c2c66affSColin Finck INetFwAuthorizedApplication_AddRef( iface );
94c2c66affSColin Finck return S_OK;
95c2c66affSColin Finck }
96c2c66affSColin Finck
fw_app_GetTypeInfoCount(INetFwAuthorizedApplication * iface,UINT * pctinfo)97c2c66affSColin Finck static HRESULT WINAPI fw_app_GetTypeInfoCount(
98c2c66affSColin Finck INetFwAuthorizedApplication *iface,
99c2c66affSColin Finck UINT *pctinfo )
100c2c66affSColin Finck {
101c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
102c2c66affSColin Finck
103c2c66affSColin Finck TRACE("%p %p\n", This, pctinfo);
104c2c66affSColin Finck *pctinfo = 1;
105c2c66affSColin Finck return S_OK;
106c2c66affSColin Finck }
107c2c66affSColin Finck
108c2c66affSColin Finck static ITypeLib *typelib;
109c2c66affSColin Finck static ITypeInfo *typeinfo[last_tid];
110c2c66affSColin Finck
111c2c66affSColin Finck static REFIID tid_id[] =
112c2c66affSColin Finck {
113c2c66affSColin Finck &IID_INetFwAuthorizedApplication,
114c2c66affSColin Finck &IID_INetFwAuthorizedApplications,
115c2c66affSColin Finck &IID_INetFwMgr,
116c2c66affSColin Finck &IID_INetFwOpenPort,
117c2c66affSColin Finck &IID_INetFwOpenPorts,
118c2c66affSColin Finck &IID_INetFwPolicy,
119c2c66affSColin Finck &IID_INetFwPolicy2,
120*7c98f220SAmine Khaldi &IID_INetFwProfile,
121*7c98f220SAmine Khaldi &IID_IUPnPNAT
122c2c66affSColin Finck };
123c2c66affSColin Finck
get_typeinfo(enum type_id tid,ITypeInfo ** ret)124c2c66affSColin Finck HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
125c2c66affSColin Finck {
126c2c66affSColin Finck HRESULT hr;
127c2c66affSColin Finck
128c2c66affSColin Finck if (!typelib)
129c2c66affSColin Finck {
130c2c66affSColin Finck ITypeLib *lib;
131c2c66affSColin Finck
132c2c66affSColin Finck hr = LoadRegTypeLib( &LIBID_NetFwPublicTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &lib );
133c2c66affSColin Finck if (FAILED(hr))
134c2c66affSColin Finck {
135c2c66affSColin Finck ERR("LoadRegTypeLib failed: %08x\n", hr);
136c2c66affSColin Finck return hr;
137c2c66affSColin Finck }
138c2c66affSColin Finck if (InterlockedCompareExchangePointer( (void **)&typelib, lib, NULL ))
139c2c66affSColin Finck ITypeLib_Release( lib );
140c2c66affSColin Finck }
141c2c66affSColin Finck if (!typeinfo[tid])
142c2c66affSColin Finck {
143c2c66affSColin Finck ITypeInfo *info;
144c2c66affSColin Finck
145c2c66affSColin Finck hr = ITypeLib_GetTypeInfoOfGuid( typelib, tid_id[tid], &info );
146c2c66affSColin Finck if (FAILED(hr))
147c2c66affSColin Finck {
148c2c66affSColin Finck ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_id[tid]), hr);
149c2c66affSColin Finck return hr;
150c2c66affSColin Finck }
151c2c66affSColin Finck if (InterlockedCompareExchangePointer( (void **)(typeinfo + tid), info, NULL ))
152c2c66affSColin Finck ITypeInfo_Release( info );
153c2c66affSColin Finck }
154c2c66affSColin Finck *ret = typeinfo[tid];
155c2c66affSColin Finck ITypeInfo_AddRef(typeinfo[tid]);
156c2c66affSColin Finck return S_OK;
157c2c66affSColin Finck }
158c2c66affSColin Finck
release_typelib(void)159c2c66affSColin Finck void release_typelib(void)
160c2c66affSColin Finck {
161c2c66affSColin Finck unsigned i;
162c2c66affSColin Finck
163*7c98f220SAmine Khaldi for (i = 0; i < ARRAY_SIZE(typeinfo); i++)
164c2c66affSColin Finck if (typeinfo[i])
165c2c66affSColin Finck ITypeInfo_Release(typeinfo[i]);
166c2c66affSColin Finck
167c2c66affSColin Finck if (typelib)
168c2c66affSColin Finck ITypeLib_Release(typelib);
169c2c66affSColin Finck }
170c2c66affSColin Finck
fw_app_GetTypeInfo(INetFwAuthorizedApplication * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)171c2c66affSColin Finck static HRESULT WINAPI fw_app_GetTypeInfo(
172c2c66affSColin Finck INetFwAuthorizedApplication *iface,
173c2c66affSColin Finck UINT iTInfo,
174c2c66affSColin Finck LCID lcid,
175c2c66affSColin Finck ITypeInfo **ppTInfo )
176c2c66affSColin Finck {
177c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
178c2c66affSColin Finck
179c2c66affSColin Finck TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
180c2c66affSColin Finck return get_typeinfo( INetFwAuthorizedApplication_tid, ppTInfo );
181c2c66affSColin Finck }
182c2c66affSColin Finck
fw_app_GetIDsOfNames(INetFwAuthorizedApplication * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)183c2c66affSColin Finck static HRESULT WINAPI fw_app_GetIDsOfNames(
184c2c66affSColin Finck INetFwAuthorizedApplication *iface,
185c2c66affSColin Finck REFIID riid,
186c2c66affSColin Finck LPOLESTR *rgszNames,
187c2c66affSColin Finck UINT cNames,
188c2c66affSColin Finck LCID lcid,
189c2c66affSColin Finck DISPID *rgDispId )
190c2c66affSColin Finck {
191c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
192c2c66affSColin Finck ITypeInfo *typeinfo;
193c2c66affSColin Finck HRESULT hr;
194c2c66affSColin Finck
195c2c66affSColin Finck TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
196c2c66affSColin Finck
197c2c66affSColin Finck hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo );
198c2c66affSColin Finck if (SUCCEEDED(hr))
199c2c66affSColin Finck {
200c2c66affSColin Finck hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
201c2c66affSColin Finck ITypeInfo_Release( typeinfo );
202c2c66affSColin Finck }
203c2c66affSColin Finck return hr;
204c2c66affSColin Finck }
205c2c66affSColin Finck
fw_app_Invoke(INetFwAuthorizedApplication * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)206c2c66affSColin Finck static HRESULT WINAPI fw_app_Invoke(
207c2c66affSColin Finck INetFwAuthorizedApplication *iface,
208c2c66affSColin Finck DISPID dispIdMember,
209c2c66affSColin Finck REFIID riid,
210c2c66affSColin Finck LCID lcid,
211c2c66affSColin Finck WORD wFlags,
212c2c66affSColin Finck DISPPARAMS *pDispParams,
213c2c66affSColin Finck VARIANT *pVarResult,
214c2c66affSColin Finck EXCEPINFO *pExcepInfo,
215c2c66affSColin Finck UINT *puArgErr )
216c2c66affSColin Finck {
217c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
218c2c66affSColin Finck ITypeInfo *typeinfo;
219c2c66affSColin Finck HRESULT hr;
220c2c66affSColin Finck
221c2c66affSColin Finck TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
222c2c66affSColin Finck lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
223c2c66affSColin Finck
224c2c66affSColin Finck hr = get_typeinfo( INetFwAuthorizedApplication_tid, &typeinfo );
225c2c66affSColin Finck if (SUCCEEDED(hr))
226c2c66affSColin Finck {
227c2c66affSColin Finck hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplication_iface, dispIdMember,
228c2c66affSColin Finck wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
229c2c66affSColin Finck ITypeInfo_Release( typeinfo );
230c2c66affSColin Finck }
231c2c66affSColin Finck return hr;
232c2c66affSColin Finck }
233c2c66affSColin Finck
fw_app_get_Name(INetFwAuthorizedApplication * iface,BSTR * name)234c2c66affSColin Finck static HRESULT WINAPI fw_app_get_Name(
235c2c66affSColin Finck INetFwAuthorizedApplication *iface,
236c2c66affSColin Finck BSTR *name )
237c2c66affSColin Finck {
238c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
239c2c66affSColin Finck
240c2c66affSColin Finck FIXME("%p, %p\n", This, name);
241c2c66affSColin Finck return E_NOTIMPL;
242c2c66affSColin Finck }
243c2c66affSColin Finck
fw_app_put_Name(INetFwAuthorizedApplication * iface,BSTR name)244c2c66affSColin Finck static HRESULT WINAPI fw_app_put_Name(
245c2c66affSColin Finck INetFwAuthorizedApplication *iface,
246c2c66affSColin Finck BSTR name )
247c2c66affSColin Finck {
248c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
249c2c66affSColin Finck
250c2c66affSColin Finck FIXME("%p, %s\n", This, debugstr_w(name));
251c2c66affSColin Finck return S_OK;
252c2c66affSColin Finck }
253c2c66affSColin Finck
fw_app_get_ProcessImageFileName(INetFwAuthorizedApplication * iface,BSTR * imageFileName)254c2c66affSColin Finck static HRESULT WINAPI fw_app_get_ProcessImageFileName(
255c2c66affSColin Finck INetFwAuthorizedApplication *iface,
256c2c66affSColin Finck BSTR *imageFileName )
257c2c66affSColin Finck {
258c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
259c2c66affSColin Finck
260c2c66affSColin Finck FIXME("%p, %p\n", This, imageFileName);
26136755f12SAmine Khaldi
26236755f12SAmine Khaldi if (!imageFileName)
2631d62a5beSAmine Khaldi return E_POINTER;
26436755f12SAmine Khaldi
26536755f12SAmine Khaldi *imageFileName = SysAllocString( This->filename );
2661d62a5beSAmine Khaldi return *imageFileName || !This->filename ? S_OK : E_OUTOFMEMORY;
267c2c66affSColin Finck }
268c2c66affSColin Finck
fw_app_put_ProcessImageFileName(INetFwAuthorizedApplication * iface,BSTR image)269c2c66affSColin Finck static HRESULT WINAPI fw_app_put_ProcessImageFileName(
270*7c98f220SAmine Khaldi INetFwAuthorizedApplication *iface, BSTR image )
271c2c66affSColin Finck {
272c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
273*7c98f220SAmine Khaldi UNIVERSAL_NAME_INFOW *info;
274*7c98f220SAmine Khaldi DWORD sz, longsz;
275*7c98f220SAmine Khaldi WCHAR *path;
276*7c98f220SAmine Khaldi DWORD res;
277c2c66affSColin Finck
278*7c98f220SAmine Khaldi FIXME("%p, %s\n", This, debugstr_w(image));
27936755f12SAmine Khaldi
280*7c98f220SAmine Khaldi if (!image || !image[0])
2811d62a5beSAmine Khaldi return E_INVALIDARG;
282c2c66affSColin Finck
283*7c98f220SAmine Khaldi sz = 0;
284*7c98f220SAmine Khaldi res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, NULL, &sz);
285*7c98f220SAmine Khaldi if (res == WN_MORE_DATA)
286*7c98f220SAmine Khaldi {
287*7c98f220SAmine Khaldi if (!(path = heap_alloc(sz)))
288*7c98f220SAmine Khaldi return E_OUTOFMEMORY;
289*7c98f220SAmine Khaldi
290*7c98f220SAmine Khaldi info = (UNIVERSAL_NAME_INFOW *)&path;
291*7c98f220SAmine Khaldi res = WNetGetUniversalNameW(image, UNIVERSAL_NAME_INFO_LEVEL, &info, &sz);
292*7c98f220SAmine Khaldi if (res == NO_ERROR)
293*7c98f220SAmine Khaldi {
2941d62a5beSAmine Khaldi SysFreeString(This->filename);
295*7c98f220SAmine Khaldi This->filename = SysAllocString(info->lpUniversalName);
296*7c98f220SAmine Khaldi }
297*7c98f220SAmine Khaldi heap_free(path);
298*7c98f220SAmine Khaldi return HRESULT_FROM_WIN32(res);
299*7c98f220SAmine Khaldi }
300*7c98f220SAmine Khaldi
301*7c98f220SAmine Khaldi sz = GetFullPathNameW(image, 0, NULL, NULL);
302*7c98f220SAmine Khaldi if (!(path = heap_alloc(++sz * sizeof(WCHAR))))
303*7c98f220SAmine Khaldi return E_OUTOFMEMORY;
304*7c98f220SAmine Khaldi GetFullPathNameW(image, sz, path, NULL);
305*7c98f220SAmine Khaldi
306*7c98f220SAmine Khaldi longsz = GetLongPathNameW(path, path, sz);
307*7c98f220SAmine Khaldi if (longsz > sz)
308*7c98f220SAmine Khaldi {
309*7c98f220SAmine Khaldi if (!(path = heap_realloc(path, longsz * sizeof(WCHAR))))
310*7c98f220SAmine Khaldi {
311*7c98f220SAmine Khaldi heap_free(path);
312*7c98f220SAmine Khaldi return E_OUTOFMEMORY;
313*7c98f220SAmine Khaldi }
314*7c98f220SAmine Khaldi GetLongPathNameW(path, path, longsz);
315*7c98f220SAmine Khaldi }
316*7c98f220SAmine Khaldi
317*7c98f220SAmine Khaldi SysFreeString( This->filename );
318*7c98f220SAmine Khaldi This->filename = SysAllocString(path);
319*7c98f220SAmine Khaldi heap_free(path);
32036755f12SAmine Khaldi return This->filename ? S_OK : E_OUTOFMEMORY;
32136755f12SAmine Khaldi }
32236755f12SAmine Khaldi
fw_app_get_IpVersion(INetFwAuthorizedApplication * iface,NET_FW_IP_VERSION * ipVersion)323c2c66affSColin Finck static HRESULT WINAPI fw_app_get_IpVersion(
324c2c66affSColin Finck INetFwAuthorizedApplication *iface,
325c2c66affSColin Finck NET_FW_IP_VERSION *ipVersion )
326c2c66affSColin Finck {
327c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
328c2c66affSColin Finck
329c2c66affSColin Finck TRACE("%p, %p\n", This, ipVersion);
330c2c66affSColin Finck
331c2c66affSColin Finck if (!ipVersion)
332c2c66affSColin Finck return E_POINTER;
333c2c66affSColin Finck *ipVersion = NET_FW_IP_VERSION_ANY;
334c2c66affSColin Finck return S_OK;
335c2c66affSColin Finck }
336c2c66affSColin Finck
fw_app_put_IpVersion(INetFwAuthorizedApplication * iface,NET_FW_IP_VERSION ipVersion)337c2c66affSColin Finck static HRESULT WINAPI fw_app_put_IpVersion(
338c2c66affSColin Finck INetFwAuthorizedApplication *iface,
339c2c66affSColin Finck NET_FW_IP_VERSION ipVersion )
340c2c66affSColin Finck {
341c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
342c2c66affSColin Finck
343c2c66affSColin Finck TRACE("%p, %u\n", This, ipVersion);
344c2c66affSColin Finck return S_OK;
345c2c66affSColin Finck }
346c2c66affSColin Finck
fw_app_get_Scope(INetFwAuthorizedApplication * iface,NET_FW_SCOPE * scope)347c2c66affSColin Finck static HRESULT WINAPI fw_app_get_Scope(
348c2c66affSColin Finck INetFwAuthorizedApplication *iface,
349c2c66affSColin Finck NET_FW_SCOPE *scope )
350c2c66affSColin Finck {
351c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
352c2c66affSColin Finck
353c2c66affSColin Finck FIXME("%p, %p\n", This, scope);
354c2c66affSColin Finck return E_NOTIMPL;
355c2c66affSColin Finck }
356c2c66affSColin Finck
fw_app_put_Scope(INetFwAuthorizedApplication * iface,NET_FW_SCOPE scope)357c2c66affSColin Finck static HRESULT WINAPI fw_app_put_Scope(
358c2c66affSColin Finck INetFwAuthorizedApplication *iface,
359c2c66affSColin Finck NET_FW_SCOPE scope )
360c2c66affSColin Finck {
361c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
362c2c66affSColin Finck
363c2c66affSColin Finck FIXME("%p, %u\n", This, scope);
364c2c66affSColin Finck return S_OK;
365c2c66affSColin Finck }
366c2c66affSColin Finck
fw_app_get_RemoteAddresses(INetFwAuthorizedApplication * iface,BSTR * remoteAddrs)367c2c66affSColin Finck static HRESULT WINAPI fw_app_get_RemoteAddresses(
368c2c66affSColin Finck INetFwAuthorizedApplication *iface,
369c2c66affSColin Finck BSTR *remoteAddrs )
370c2c66affSColin Finck {
371c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
372c2c66affSColin Finck
373c2c66affSColin Finck FIXME("%p, %p\n", This, remoteAddrs);
374c2c66affSColin Finck return E_NOTIMPL;
375c2c66affSColin Finck }
376c2c66affSColin Finck
fw_app_put_RemoteAddresses(INetFwAuthorizedApplication * iface,BSTR remoteAddrs)377c2c66affSColin Finck static HRESULT WINAPI fw_app_put_RemoteAddresses(
378c2c66affSColin Finck INetFwAuthorizedApplication *iface,
379c2c66affSColin Finck BSTR remoteAddrs )
380c2c66affSColin Finck {
381c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
382c2c66affSColin Finck
383c2c66affSColin Finck FIXME("%p, %s\n", This, debugstr_w(remoteAddrs));
384c2c66affSColin Finck return E_NOTIMPL;
385c2c66affSColin Finck }
386c2c66affSColin Finck
fw_app_get_Enabled(INetFwAuthorizedApplication * iface,VARIANT_BOOL * enabled)387c2c66affSColin Finck static HRESULT WINAPI fw_app_get_Enabled(
388c2c66affSColin Finck INetFwAuthorizedApplication *iface,
389c2c66affSColin Finck VARIANT_BOOL *enabled )
390c2c66affSColin Finck {
391c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
392c2c66affSColin Finck
393c2c66affSColin Finck FIXME("%p, %p\n", This, enabled);
394c2c66affSColin Finck
395c2c66affSColin Finck *enabled = VARIANT_FALSE;
396c2c66affSColin Finck return S_OK;
397c2c66affSColin Finck }
398c2c66affSColin Finck
fw_app_put_Enabled(INetFwAuthorizedApplication * iface,VARIANT_BOOL enabled)399c2c66affSColin Finck static HRESULT WINAPI fw_app_put_Enabled(
400c2c66affSColin Finck INetFwAuthorizedApplication *iface,
401c2c66affSColin Finck VARIANT_BOOL enabled )
402c2c66affSColin Finck {
403c2c66affSColin Finck fw_app *This = impl_from_INetFwAuthorizedApplication( iface );
404c2c66affSColin Finck
405c2c66affSColin Finck FIXME("%p, %d\n", This, enabled);
406c2c66affSColin Finck return S_OK;
407c2c66affSColin Finck }
408c2c66affSColin Finck
409c2c66affSColin Finck static const struct INetFwAuthorizedApplicationVtbl fw_app_vtbl =
410c2c66affSColin Finck {
411c2c66affSColin Finck fw_app_QueryInterface,
412c2c66affSColin Finck fw_app_AddRef,
413c2c66affSColin Finck fw_app_Release,
414c2c66affSColin Finck fw_app_GetTypeInfoCount,
415c2c66affSColin Finck fw_app_GetTypeInfo,
416c2c66affSColin Finck fw_app_GetIDsOfNames,
417c2c66affSColin Finck fw_app_Invoke,
418c2c66affSColin Finck fw_app_get_Name,
419c2c66affSColin Finck fw_app_put_Name,
420c2c66affSColin Finck fw_app_get_ProcessImageFileName,
421c2c66affSColin Finck fw_app_put_ProcessImageFileName,
422c2c66affSColin Finck fw_app_get_IpVersion,
423c2c66affSColin Finck fw_app_put_IpVersion,
424c2c66affSColin Finck fw_app_get_Scope,
425c2c66affSColin Finck fw_app_put_Scope,
426c2c66affSColin Finck fw_app_get_RemoteAddresses,
427c2c66affSColin Finck fw_app_put_RemoteAddresses,
428c2c66affSColin Finck fw_app_get_Enabled,
429c2c66affSColin Finck fw_app_put_Enabled
430c2c66affSColin Finck };
431c2c66affSColin Finck
NetFwAuthorizedApplication_create(IUnknown * pUnkOuter,LPVOID * ppObj)432c2c66affSColin Finck HRESULT NetFwAuthorizedApplication_create( IUnknown *pUnkOuter, LPVOID *ppObj )
433c2c66affSColin Finck {
434c2c66affSColin Finck fw_app *fa;
435c2c66affSColin Finck
436c2c66affSColin Finck TRACE("(%p,%p)\n", pUnkOuter, ppObj);
437c2c66affSColin Finck
438c2c66affSColin Finck fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
439c2c66affSColin Finck if (!fa) return E_OUTOFMEMORY;
440c2c66affSColin Finck
441c2c66affSColin Finck fa->INetFwAuthorizedApplication_iface.lpVtbl = &fw_app_vtbl;
442c2c66affSColin Finck fa->refs = 1;
44336755f12SAmine Khaldi fa->filename = NULL;
444c2c66affSColin Finck
445c2c66affSColin Finck *ppObj = &fa->INetFwAuthorizedApplication_iface;
446c2c66affSColin Finck
447c2c66affSColin Finck TRACE("returning iface %p\n", *ppObj);
448c2c66affSColin Finck return S_OK;
449c2c66affSColin Finck }
450c2c66affSColin Finck typedef struct fw_apps
451c2c66affSColin Finck {
452c2c66affSColin Finck INetFwAuthorizedApplications INetFwAuthorizedApplications_iface;
453c2c66affSColin Finck LONG refs;
454c2c66affSColin Finck } fw_apps;
455c2c66affSColin Finck
impl_from_INetFwAuthorizedApplications(INetFwAuthorizedApplications * iface)456c2c66affSColin Finck static inline fw_apps *impl_from_INetFwAuthorizedApplications( INetFwAuthorizedApplications *iface )
457c2c66affSColin Finck {
458c2c66affSColin Finck return CONTAINING_RECORD(iface, fw_apps, INetFwAuthorizedApplications_iface);
459c2c66affSColin Finck }
460c2c66affSColin Finck
fw_apps_AddRef(INetFwAuthorizedApplications * iface)461c2c66affSColin Finck static ULONG WINAPI fw_apps_AddRef(
462c2c66affSColin Finck INetFwAuthorizedApplications *iface )
463c2c66affSColin Finck {
464c2c66affSColin Finck fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
465c2c66affSColin Finck return InterlockedIncrement( &fw_apps->refs );
466c2c66affSColin Finck }
467c2c66affSColin Finck
fw_apps_Release(INetFwAuthorizedApplications * iface)468c2c66affSColin Finck static ULONG WINAPI fw_apps_Release(
469c2c66affSColin Finck INetFwAuthorizedApplications *iface )
470c2c66affSColin Finck {
471c2c66affSColin Finck fw_apps *fw_apps = impl_from_INetFwAuthorizedApplications( iface );
472c2c66affSColin Finck LONG refs = InterlockedDecrement( &fw_apps->refs );
473c2c66affSColin Finck if (!refs)
474c2c66affSColin Finck {
475c2c66affSColin Finck TRACE("destroying %p\n", fw_apps);
476c2c66affSColin Finck HeapFree( GetProcessHeap(), 0, fw_apps );
477c2c66affSColin Finck }
478c2c66affSColin Finck return refs;
479c2c66affSColin Finck }
480c2c66affSColin Finck
fw_apps_QueryInterface(INetFwAuthorizedApplications * iface,REFIID riid,void ** ppvObject)481c2c66affSColin Finck static HRESULT WINAPI fw_apps_QueryInterface(
482c2c66affSColin Finck INetFwAuthorizedApplications *iface,
483c2c66affSColin Finck REFIID riid,
484c2c66affSColin Finck void **ppvObject )
485c2c66affSColin Finck {
486c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
487c2c66affSColin Finck
488c2c66affSColin Finck TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
489c2c66affSColin Finck
490c2c66affSColin Finck if ( IsEqualGUID( riid, &IID_INetFwAuthorizedApplications ) ||
491c2c66affSColin Finck IsEqualGUID( riid, &IID_IDispatch ) ||
492c2c66affSColin Finck IsEqualGUID( riid, &IID_IUnknown ) )
493c2c66affSColin Finck {
494c2c66affSColin Finck *ppvObject = iface;
495c2c66affSColin Finck }
496c2c66affSColin Finck else
497c2c66affSColin Finck {
498c2c66affSColin Finck FIXME("interface %s not implemented\n", debugstr_guid(riid));
499c2c66affSColin Finck return E_NOINTERFACE;
500c2c66affSColin Finck }
501c2c66affSColin Finck INetFwAuthorizedApplications_AddRef( iface );
502c2c66affSColin Finck return S_OK;
503c2c66affSColin Finck }
504c2c66affSColin Finck
fw_apps_GetTypeInfoCount(INetFwAuthorizedApplications * iface,UINT * pctinfo)505c2c66affSColin Finck static HRESULT WINAPI fw_apps_GetTypeInfoCount(
506c2c66affSColin Finck INetFwAuthorizedApplications *iface,
507c2c66affSColin Finck UINT *pctinfo )
508c2c66affSColin Finck {
509c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
510c2c66affSColin Finck
511c2c66affSColin Finck FIXME("%p %p\n", This, pctinfo);
512c2c66affSColin Finck return E_NOTIMPL;
513c2c66affSColin Finck }
514c2c66affSColin Finck
fw_apps_GetTypeInfo(INetFwAuthorizedApplications * iface,UINT iTInfo,LCID lcid,ITypeInfo ** ppTInfo)515c2c66affSColin Finck static HRESULT WINAPI fw_apps_GetTypeInfo(
516c2c66affSColin Finck INetFwAuthorizedApplications *iface,
517c2c66affSColin Finck UINT iTInfo,
518c2c66affSColin Finck LCID lcid,
519c2c66affSColin Finck ITypeInfo **ppTInfo )
520c2c66affSColin Finck {
521c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
522c2c66affSColin Finck
523c2c66affSColin Finck TRACE("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
524c2c66affSColin Finck return get_typeinfo( INetFwAuthorizedApplications_tid, ppTInfo );
525c2c66affSColin Finck }
526c2c66affSColin Finck
fw_apps_GetIDsOfNames(INetFwAuthorizedApplications * iface,REFIID riid,LPOLESTR * rgszNames,UINT cNames,LCID lcid,DISPID * rgDispId)527c2c66affSColin Finck static HRESULT WINAPI fw_apps_GetIDsOfNames(
528c2c66affSColin Finck INetFwAuthorizedApplications *iface,
529c2c66affSColin Finck REFIID riid,
530c2c66affSColin Finck LPOLESTR *rgszNames,
531c2c66affSColin Finck UINT cNames,
532c2c66affSColin Finck LCID lcid,
533c2c66affSColin Finck DISPID *rgDispId )
534c2c66affSColin Finck {
535c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
536c2c66affSColin Finck ITypeInfo *typeinfo;
537c2c66affSColin Finck HRESULT hr;
538c2c66affSColin Finck
539c2c66affSColin Finck TRACE("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
540c2c66affSColin Finck
541c2c66affSColin Finck hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo );
542c2c66affSColin Finck if (SUCCEEDED(hr))
543c2c66affSColin Finck {
544c2c66affSColin Finck hr = ITypeInfo_GetIDsOfNames( typeinfo, rgszNames, cNames, rgDispId );
545c2c66affSColin Finck ITypeInfo_Release( typeinfo );
546c2c66affSColin Finck }
547c2c66affSColin Finck return hr;
548c2c66affSColin Finck }
549c2c66affSColin Finck
fw_apps_Invoke(INetFwAuthorizedApplications * iface,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS * pDispParams,VARIANT * pVarResult,EXCEPINFO * pExcepInfo,UINT * puArgErr)550c2c66affSColin Finck static HRESULT WINAPI fw_apps_Invoke(
551c2c66affSColin Finck INetFwAuthorizedApplications *iface,
552c2c66affSColin Finck DISPID dispIdMember,
553c2c66affSColin Finck REFIID riid,
554c2c66affSColin Finck LCID lcid,
555c2c66affSColin Finck WORD wFlags,
556c2c66affSColin Finck DISPPARAMS *pDispParams,
557c2c66affSColin Finck VARIANT *pVarResult,
558c2c66affSColin Finck EXCEPINFO *pExcepInfo,
559c2c66affSColin Finck UINT *puArgErr )
560c2c66affSColin Finck {
561c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
562c2c66affSColin Finck ITypeInfo *typeinfo;
563c2c66affSColin Finck HRESULT hr;
564c2c66affSColin Finck
565c2c66affSColin Finck TRACE("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
566c2c66affSColin Finck lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
567c2c66affSColin Finck
568c2c66affSColin Finck hr = get_typeinfo( INetFwAuthorizedApplications_tid, &typeinfo );
569c2c66affSColin Finck if (SUCCEEDED(hr))
570c2c66affSColin Finck {
571c2c66affSColin Finck hr = ITypeInfo_Invoke( typeinfo, &This->INetFwAuthorizedApplications_iface, dispIdMember,
572c2c66affSColin Finck wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr );
573c2c66affSColin Finck ITypeInfo_Release( typeinfo );
574c2c66affSColin Finck }
575c2c66affSColin Finck return hr;
576c2c66affSColin Finck }
577c2c66affSColin Finck
fw_apps_get_Count(INetFwAuthorizedApplications * iface,LONG * count)578c2c66affSColin Finck static HRESULT WINAPI fw_apps_get_Count(
579c2c66affSColin Finck INetFwAuthorizedApplications *iface,
580c2c66affSColin Finck LONG *count )
581c2c66affSColin Finck {
582c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
583c2c66affSColin Finck
584c2c66affSColin Finck FIXME("%p, %p\n", This, count);
585c2c66affSColin Finck return E_NOTIMPL;
586c2c66affSColin Finck }
587c2c66affSColin Finck
fw_apps_Add(INetFwAuthorizedApplications * iface,INetFwAuthorizedApplication * app)588c2c66affSColin Finck static HRESULT WINAPI fw_apps_Add(
589c2c66affSColin Finck INetFwAuthorizedApplications *iface,
590c2c66affSColin Finck INetFwAuthorizedApplication *app )
591c2c66affSColin Finck {
592c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
593c2c66affSColin Finck
594c2c66affSColin Finck FIXME("%p, %p\n", This, app);
595c2c66affSColin Finck return S_OK;
596c2c66affSColin Finck }
597c2c66affSColin Finck
fw_apps_Remove(INetFwAuthorizedApplications * iface,BSTR imageFileName)598c2c66affSColin Finck static HRESULT WINAPI fw_apps_Remove(
599c2c66affSColin Finck INetFwAuthorizedApplications *iface,
600c2c66affSColin Finck BSTR imageFileName )
601c2c66affSColin Finck {
602c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
603c2c66affSColin Finck
604c2c66affSColin Finck FIXME("%p, %s\n", This, debugstr_w(imageFileName));
605c2c66affSColin Finck return S_OK;
606c2c66affSColin Finck }
607c2c66affSColin Finck
fw_apps_Item(INetFwAuthorizedApplications * iface,BSTR imageFileName,INetFwAuthorizedApplication ** app)608c2c66affSColin Finck static HRESULT WINAPI fw_apps_Item(
609c2c66affSColin Finck INetFwAuthorizedApplications *iface,
610c2c66affSColin Finck BSTR imageFileName,
611c2c66affSColin Finck INetFwAuthorizedApplication **app )
612c2c66affSColin Finck {
613c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
614c2c66affSColin Finck
615c2c66affSColin Finck TRACE("%p, %s, %p\n", This, debugstr_w(imageFileName), app);
616c2c66affSColin Finck return NetFwAuthorizedApplication_create( NULL, (void **)app );
617c2c66affSColin Finck }
618c2c66affSColin Finck
fw_apps_get__NewEnum(INetFwAuthorizedApplications * iface,IUnknown ** newEnum)619c2c66affSColin Finck static HRESULT WINAPI fw_apps_get__NewEnum(
620c2c66affSColin Finck INetFwAuthorizedApplications *iface,
621c2c66affSColin Finck IUnknown **newEnum )
622c2c66affSColin Finck {
623c2c66affSColin Finck fw_apps *This = impl_from_INetFwAuthorizedApplications( iface );
624c2c66affSColin Finck
625c2c66affSColin Finck FIXME("%p, %p\n", This, newEnum);
626c2c66affSColin Finck return E_NOTIMPL;
627c2c66affSColin Finck }
628c2c66affSColin Finck
629c2c66affSColin Finck static const struct INetFwAuthorizedApplicationsVtbl fw_apps_vtbl =
630c2c66affSColin Finck {
631c2c66affSColin Finck fw_apps_QueryInterface,
632c2c66affSColin Finck fw_apps_AddRef,
633c2c66affSColin Finck fw_apps_Release,
634c2c66affSColin Finck fw_apps_GetTypeInfoCount,
635c2c66affSColin Finck fw_apps_GetTypeInfo,
636c2c66affSColin Finck fw_apps_GetIDsOfNames,
637c2c66affSColin Finck fw_apps_Invoke,
638c2c66affSColin Finck fw_apps_get_Count,
639c2c66affSColin Finck fw_apps_Add,
640c2c66affSColin Finck fw_apps_Remove,
641c2c66affSColin Finck fw_apps_Item,
642c2c66affSColin Finck fw_apps_get__NewEnum
643c2c66affSColin Finck };
644c2c66affSColin Finck
NetFwAuthorizedApplications_create(IUnknown * pUnkOuter,LPVOID * ppObj)645c2c66affSColin Finck HRESULT NetFwAuthorizedApplications_create( IUnknown *pUnkOuter, LPVOID *ppObj )
646c2c66affSColin Finck {
647c2c66affSColin Finck fw_apps *fa;
648c2c66affSColin Finck
649c2c66affSColin Finck TRACE("(%p,%p)\n", pUnkOuter, ppObj);
650c2c66affSColin Finck
651c2c66affSColin Finck fa = HeapAlloc( GetProcessHeap(), 0, sizeof(*fa) );
652c2c66affSColin Finck if (!fa) return E_OUTOFMEMORY;
653c2c66affSColin Finck
654c2c66affSColin Finck fa->INetFwAuthorizedApplications_iface.lpVtbl = &fw_apps_vtbl;
655c2c66affSColin Finck fa->refs = 1;
656c2c66affSColin Finck
657c2c66affSColin Finck *ppObj = &fa->INetFwAuthorizedApplications_iface;
658c2c66affSColin Finck
659c2c66affSColin Finck TRACE("returning iface %p\n", *ppObj);
660c2c66affSColin Finck return S_OK;
661c2c66affSColin Finck }
662