wininet: Support the Cache-Control max-age directive for setting url cache entry...
[wine/testsucceed.git] / dlls / hnetcfg / policy.c
blobdd5a1fecc128c87a440068551cde751377190e2f
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_policy
39 INetFwPolicy INetFwPolicy_iface;
40 LONG refs;
41 } fw_policy;
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(
49 INetFwPolicy *iface )
51 fw_policy *fw_policy = impl_from_INetFwPolicy( iface );
52 return InterlockedIncrement( &fw_policy->refs );
55 static ULONG WINAPI fw_policy_Release(
56 INetFwPolicy *iface )
58 fw_policy *fw_policy = impl_from_INetFwPolicy( iface );
59 LONG refs = InterlockedDecrement( &fw_policy->refs );
60 if (!refs)
62 TRACE("destroying %p\n", fw_policy);
63 HeapFree( GetProcessHeap(), 0, fw_policy );
65 return refs;
68 static HRESULT WINAPI fw_policy_QueryInterface(
69 INetFwPolicy *iface,
70 REFIID riid,
71 void **ppvObject )
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 ) )
81 *ppvObject = iface;
83 else
85 FIXME("interface %s not implemented\n", debugstr_guid(riid));
86 return E_NOINTERFACE;
88 INetFwPolicy_AddRef( iface );
89 return S_OK;
92 static HRESULT WINAPI fw_policy_GetTypeInfoCount(
93 INetFwPolicy *iface,
94 UINT *pctinfo )
96 fw_policy *This = impl_from_INetFwPolicy( iface );
98 FIXME("%p %p\n", This, pctinfo);
99 return E_NOTIMPL;
102 static HRESULT WINAPI fw_policy_GetTypeInfo(
103 INetFwPolicy *iface,
104 UINT iTInfo,
105 LCID lcid,
106 ITypeInfo **ppTInfo )
108 fw_policy *This = impl_from_INetFwPolicy( iface );
110 FIXME("%p %u %u %p\n", This, iTInfo, lcid, ppTInfo);
111 return E_NOTIMPL;
114 static HRESULT WINAPI fw_policy_GetIDsOfNames(
115 INetFwPolicy *iface,
116 REFIID riid,
117 LPOLESTR *rgszNames,
118 UINT cNames,
119 LCID lcid,
120 DISPID *rgDispId )
122 fw_policy *This = impl_from_INetFwPolicy( iface );
124 FIXME("%p %s %p %u %u %p\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
125 return E_NOTIMPL;
128 static HRESULT WINAPI fw_policy_Invoke(
129 INetFwPolicy *iface,
130 DISPID dispIdMember,
131 REFIID riid,
132 LCID lcid,
133 WORD wFlags,
134 DISPPARAMS *pDispParams,
135 VARIANT *pVarResult,
136 EXCEPINFO *pExcepInfo,
137 UINT *puArgErr )
139 fw_policy *This = impl_from_INetFwPolicy( iface );
141 FIXME("%p %d %s %d %d %p %p %p %p\n", This, dispIdMember, debugstr_guid(riid),
142 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
143 return E_NOTIMPL;
146 static HRESULT WINAPI fw_policy_get_CurrentProfile(
147 INetFwPolicy *iface,
148 INetFwProfile **profile )
150 fw_policy *This = impl_from_INetFwPolicy( iface );
152 TRACE("%p, %p\n", This, profile);
153 return NetFwProfile_create( NULL, (void **)profile );
156 static HRESULT WINAPI fw_policy_GetProfileByType(
157 INetFwPolicy *iface,
158 NET_FW_PROFILE_TYPE profileType,
159 INetFwProfile **profile )
161 fw_policy *This = impl_from_INetFwPolicy( iface );
163 FIXME("%p, %u, %p\n", This, profileType, profile);
164 return E_NOTIMPL;
167 static const struct INetFwPolicyVtbl fw_policy_vtbl =
169 fw_policy_QueryInterface,
170 fw_policy_AddRef,
171 fw_policy_Release,
172 fw_policy_GetTypeInfoCount,
173 fw_policy_GetTypeInfo,
174 fw_policy_GetIDsOfNames,
175 fw_policy_Invoke,
176 fw_policy_get_CurrentProfile,
177 fw_policy_GetProfileByType
180 HRESULT NetFwPolicy_create( IUnknown *pUnkOuter, LPVOID *ppObj )
182 fw_policy *fp;
184 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
186 fp = HeapAlloc( GetProcessHeap(), 0, sizeof(*fp) );
187 if (!fp) return E_OUTOFMEMORY;
189 fp->INetFwPolicy_iface.lpVtbl = &fw_policy_vtbl;
190 fp->refs = 1;
192 *ppObj = &fp->INetFwPolicy_iface;
194 TRACE("returning iface %p\n", *ppObj);
195 return S_OK;