2 * Internet Security Manager
4 * Copyright (c) 2004 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "urlmon_main.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
35 typedef struct SecManagerImpl{
37 IInternetSecurityManagerVtbl* lpvtbl1; /* VTable relative to the IInternetSecurityManager interface.*/
39 ULONG ref; /* reference counter for this object */
43 /* IUnknown prototype functions */
44 static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* iface,REFIID riid,void** ppvObject);
45 static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface);
46 static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface);
48 static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
49 IInternetSecurityMgrSite *pSite);
50 static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManager *iface,
51 IInternetSecurityMgrSite **ppSite);
52 static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *iface,
53 LPCWSTR pwszUrl, DWORD *pdwZone,
55 static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *iface,
57 BYTE *pbSecurityId, DWORD *pcbSecurityId,
59 static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager *iface,
60 LPCWSTR pwszUrl, DWORD dwAction,
61 BYTE *pPolicy, DWORD cbPolicy,
62 BYTE *pContext, DWORD cbContext,
63 DWORD dwFlags, DWORD dwReserved);
64 static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager *iface,
65 LPCWSTR pwszUrl, REFGUID guidKey,
66 BYTE **ppPolicy, DWORD *pcbPolicy,
67 BYTE *pContext, DWORD cbContext,
69 static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface,
70 DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags);
71 static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManager *iface,
72 DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags);
74 static HRESULT SecManagerImpl_Destroy(SecManagerImpl* This);
75 HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj);
77 static IInternetSecurityManagerVtbl VT_SecManagerImpl =
79 SecManagerImpl_QueryInterface,
80 SecManagerImpl_AddRef,
81 SecManagerImpl_Release,
82 SecManagerImpl_SetSecuritySite,
83 SecManagerImpl_GetSecuritySite,
84 SecManagerImpl_MapUrlToZone,
85 SecManagerImpl_GetSecurityId,
86 SecManagerImpl_ProcessUrlAction,
87 SecManagerImpl_QueryCustomPolicy,
88 SecManagerImpl_SetZoneMapping,
89 SecManagerImpl_GetZoneMappings
92 static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* iface,REFIID riid,void** ppvObject)
94 SecManagerImpl *This = (SecManagerImpl *)iface;
96 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
98 /* Perform a sanity check on the parameters.*/
99 if ( (This==0) || (ppvObject==0) )
102 /* Initialize the return parameter */
105 /* Compare the riid with the interface IDs implemented by this object.*/
106 if (IsEqualIID(&IID_IUnknown, riid) ||
107 IsEqualIID(&IID_IInternetSecurityManager, riid))
110 /* Check that we obtained an interface.*/
112 return E_NOINTERFACE;
114 /* Query Interface always increases the reference count by one when it is successful */
115 SecManagerImpl_AddRef(iface);
120 static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface)
122 SecManagerImpl *This = (SecManagerImpl *)iface;
124 TRACE("(%p)\n",This);
126 return InterlockedIncrement(&This->ref);
129 static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
131 SecManagerImpl *This = (SecManagerImpl *)iface;
133 TRACE("(%p)\n",This);
135 ref = InterlockedDecrement(&This->ref);
137 /* destroy the object if there's no more reference on it */
140 SecManagerImpl_Destroy(This);
147 static HRESULT SecManagerImpl_Destroy(SecManagerImpl* This)
149 TRACE("(%p)\n",This);
151 HeapFree(GetProcessHeap(),0,This);
156 HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
158 SecManagerImpl *This;
160 TRACE("(%p,%p)\n",pUnkOuter,ppobj);
161 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
163 /* Initialize the virtual function table. */
164 This->lpvtbl1 = &VT_SecManagerImpl;
171 static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
172 IInternetSecurityMgrSite *pSite)
174 FIXME("(%p)->(%p)\n", iface, pSite);
178 static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManager *iface,
179 IInternetSecurityMgrSite **ppSite)
181 FIXME("(%p)->( %p)\n", iface, ppSite);
185 static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *iface,
186 LPCWSTR pwszUrl, DWORD *pdwZone,
189 FIXME("(%p)->(%s %p %08lx)\n", iface, debugstr_w(pwszUrl), pdwZone, dwFlags);
193 static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *iface,
195 BYTE *pbSecurityId, DWORD *pcbSecurityId,
198 FIXME("(%p)->(%s %p %p %08lx)\n", iface, debugstr_w(pwszUrl), pbSecurityId, pcbSecurityId,
204 static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager *iface,
205 LPCWSTR pwszUrl, DWORD dwAction,
206 BYTE *pPolicy, DWORD cbPolicy,
207 BYTE *pContext, DWORD cbContext,
208 DWORD dwFlags, DWORD dwReserved)
210 FIXME("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface, debugstr_w(pwszUrl), dwAction,
211 pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
216 static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager *iface,
217 LPCWSTR pwszUrl, REFGUID guidKey,
218 BYTE **ppPolicy, DWORD *pcbPolicy,
219 BYTE *pContext, DWORD cbContext,
222 FIXME("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface, debugstr_w(pwszUrl), debugstr_guid(guidKey),
223 ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
227 static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface,
228 DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
230 FIXME("(%p)->(%08lx %s %08lx)\n", iface, dwZone, debugstr_w(pwszPattern),dwFlags);
234 static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManager *iface,
235 DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
237 FIXME("(%p)->(%08lx %p %08lx)\n", iface, dwZone, ppenumString,dwFlags);
241 /***********************************************************************
242 * CoInternetCreateSecurityManager (URLMON.@)
245 HRESULT WINAPI CoInternetCreateSecurityManager( IServiceProvider *pSP,
246 IInternetSecurityManager **ppSM, DWORD dwReserved )
248 TRACE("%p %p %ld\n", pSP, ppSM, dwReserved );
249 return SecManagerImpl_Construct(NULL, (void**) ppSM);