2 * Internet Security and Zone Manager
4 * Copyright (c) 2004 Huw D M Davies
5 * Copyright 2004 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "wine/debug.h"
32 #include "wine/unicode.h"
34 #include "urlmon_main.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(urlmon
);
38 /***********************************************************************
39 * InternetSecurityManager implementation
42 typedef struct SecManagerImpl
{
44 IInternetSecurityManagerVtbl
* lpvtbl1
; /* VTable relative to the IInternetSecurityManager interface.*/
46 ULONG ref
; /* reference counter for this object */
50 static HRESULT WINAPI
SecManagerImpl_QueryInterface(IInternetSecurityManager
* iface
,REFIID riid
,void** ppvObject
)
52 SecManagerImpl
*This
= (SecManagerImpl
*)iface
;
54 TRACE("(%p)->(%s,%p)\n",This
,debugstr_guid(riid
),ppvObject
);
56 /* Perform a sanity check on the parameters.*/
57 if ( (This
==0) || (ppvObject
==0) )
60 /* Initialize the return parameter */
63 /* Compare the riid with the interface IDs implemented by this object.*/
64 if (IsEqualIID(&IID_IUnknown
, riid
) ||
65 IsEqualIID(&IID_IInternetSecurityManager
, riid
))
68 /* Check that we obtained an interface.*/
72 /* Query Interface always increases the reference count by one when it is successful */
73 IInternetSecurityManager_AddRef(iface
);
78 static ULONG WINAPI
SecManagerImpl_AddRef(IInternetSecurityManager
* iface
)
80 SecManagerImpl
*This
= (SecManagerImpl
*)iface
;
84 return InterlockedIncrement(&This
->ref
);
87 static ULONG WINAPI
SecManagerImpl_Release(IInternetSecurityManager
* iface
)
89 SecManagerImpl
*This
= (SecManagerImpl
*)iface
;
93 ref
= InterlockedDecrement(&This
->ref
);
95 /* destroy the object if there's no more reference on it */
97 HeapFree(GetProcessHeap(),0,This
);
102 static HRESULT WINAPI
SecManagerImpl_SetSecuritySite(IInternetSecurityManager
*iface
,
103 IInternetSecurityMgrSite
*pSite
)
105 FIXME("(%p)->(%p)\n", iface
, pSite
);
109 static HRESULT WINAPI
SecManagerImpl_GetSecuritySite(IInternetSecurityManager
*iface
,
110 IInternetSecurityMgrSite
**ppSite
)
112 FIXME("(%p)->( %p)\n", iface
, ppSite
);
116 static HRESULT WINAPI
SecManagerImpl_MapUrlToZone(IInternetSecurityManager
*iface
,
117 LPCWSTR pwszUrl
, DWORD
*pdwZone
,
120 FIXME("(%p)->(%s %p %08lx)\n", iface
, debugstr_w(pwszUrl
), pdwZone
, dwFlags
);
124 static HRESULT WINAPI
SecManagerImpl_GetSecurityId(IInternetSecurityManager
*iface
,
126 BYTE
*pbSecurityId
, DWORD
*pcbSecurityId
,
129 FIXME("(%p)->(%s %p %p %08lx)\n", iface
, debugstr_w(pwszUrl
), pbSecurityId
, pcbSecurityId
,
135 static HRESULT WINAPI
SecManagerImpl_ProcessUrlAction(IInternetSecurityManager
*iface
,
136 LPCWSTR pwszUrl
, DWORD dwAction
,
137 BYTE
*pPolicy
, DWORD cbPolicy
,
138 BYTE
*pContext
, DWORD cbContext
,
139 DWORD dwFlags
, DWORD dwReserved
)
141 FIXME("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface
, debugstr_w(pwszUrl
), dwAction
,
142 pPolicy
, cbPolicy
, pContext
, cbContext
, dwFlags
, dwReserved
);
147 static HRESULT WINAPI
SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager
*iface
,
148 LPCWSTR pwszUrl
, REFGUID guidKey
,
149 BYTE
**ppPolicy
, DWORD
*pcbPolicy
,
150 BYTE
*pContext
, DWORD cbContext
,
153 FIXME("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface
, debugstr_w(pwszUrl
), debugstr_guid(guidKey
),
154 ppPolicy
, pcbPolicy
, pContext
, cbContext
, dwReserved
);
158 static HRESULT WINAPI
SecManagerImpl_SetZoneMapping(IInternetSecurityManager
*iface
,
159 DWORD dwZone
, LPCWSTR pwszPattern
, DWORD dwFlags
)
161 FIXME("(%p)->(%08lx %s %08lx)\n", iface
, dwZone
, debugstr_w(pwszPattern
),dwFlags
);
165 static HRESULT WINAPI
SecManagerImpl_GetZoneMappings(IInternetSecurityManager
*iface
,
166 DWORD dwZone
, IEnumString
**ppenumString
, DWORD dwFlags
)
168 FIXME("(%p)->(%08lx %p %08lx)\n", iface
, dwZone
, ppenumString
,dwFlags
);
172 static IInternetSecurityManagerVtbl VT_SecManagerImpl
=
174 SecManagerImpl_QueryInterface
,
175 SecManagerImpl_AddRef
,
176 SecManagerImpl_Release
,
177 SecManagerImpl_SetSecuritySite
,
178 SecManagerImpl_GetSecuritySite
,
179 SecManagerImpl_MapUrlToZone
,
180 SecManagerImpl_GetSecurityId
,
181 SecManagerImpl_ProcessUrlAction
,
182 SecManagerImpl_QueryCustomPolicy
,
183 SecManagerImpl_SetZoneMapping
,
184 SecManagerImpl_GetZoneMappings
187 HRESULT
SecManagerImpl_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
189 SecManagerImpl
*This
;
191 TRACE("(%p,%p)\n",pUnkOuter
,ppobj
);
192 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
194 /* Initialize the virtual function table. */
195 This
->lpvtbl1
= &VT_SecManagerImpl
;
202 /***********************************************************************
203 * InternetZoneManager implementation
207 IInternetZoneManagerVtbl
* lpVtbl
;
211 /********************************************************************
212 * IInternetZoneManager_QueryInterface
214 static HRESULT WINAPI
ZoneMgrImpl_QueryInterface(IInternetZoneManager
* iface
, REFIID riid
, void** ppvObject
)
216 ZoneMgrImpl
* This
= (ZoneMgrImpl
*)iface
;
218 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid(riid
), ppvObject
);
220 if(!This
|| !ppvObject
)
223 if(!IsEqualIID(&IID_IUnknown
, riid
) && !IsEqualIID(&IID_IInternetZoneManager
, riid
)) {
224 FIXME("Unknown interface: %s\n", debugstr_guid(riid
));
226 return E_NOINTERFACE
;
230 IInternetZoneManager_AddRef(iface
);
235 /********************************************************************
236 * IInternetZoneManager_AddRef
238 static ULONG WINAPI
ZoneMgrImpl_AddRef(IInternetZoneManager
* iface
)
240 ZoneMgrImpl
* This
= (ZoneMgrImpl
*)iface
;
242 TRACE("(%p) was %lu\n", This
, This
->ref
);
244 return InterlockedIncrement(&This
->ref
);
247 /********************************************************************
248 * IInternetZoneManager_Release
250 static ULONG WINAPI
ZoneMgrImpl_Release(IInternetZoneManager
* iface
)
252 ZoneMgrImpl
* This
= (ZoneMgrImpl
*)iface
;
255 TRACE("(%p) was %lu\n", This
, This
->ref
);
256 ref
= InterlockedDecrement(&This
->ref
);
259 HeapFree(GetProcessHeap(), 0, This
);
264 /********************************************************************
265 * IInternetZoneManager_GetZoneAttributes
267 static HRESULT WINAPI
ZoneMgrImpl_GetZoneAttributes(IInternetZoneManager
* iface
,
269 ZONEATTRIBUTES
* pZoneAttributes
)
271 FIXME("(%p)->(%ld %p) stub\n", iface
, dwZone
, pZoneAttributes
);
275 /********************************************************************
276 * IInternetZoneManager_SetZoneAttributes
278 static HRESULT WINAPI
ZoneMgrImpl_SetZoneAttributes(IInternetZoneManager
* iface
,
280 ZONEATTRIBUTES
* pZoneAttributes
)
282 FIXME("(%p)->(%08lx %p) stub\n", iface
, dwZone
, pZoneAttributes
);
286 /********************************************************************
287 * IInternetZoneManager_GetZoneCustomPolicy
289 static HRESULT WINAPI
ZoneMgrImpl_GetZoneCustomPolicy(IInternetZoneManager
* iface
,
294 URLZONEREG ulrZoneReg
)
296 FIXME("(%p)->(%08lx %s %p %p %08x) stub\n", iface
, dwZone
, debugstr_guid(guidKey
),
297 ppPolicy
, pcbPolicy
, ulrZoneReg
);
301 /********************************************************************
302 * IInternetZoneManager_SetZoneCustomPolicy
304 static HRESULT WINAPI
ZoneMgrImpl_SetZoneCustomPolicy(IInternetZoneManager
* iface
,
309 URLZONEREG ulrZoneReg
)
311 FIXME("(%p)->(%08lx %s %p %08lx %08x) stub\n", iface
, dwZone
, debugstr_guid(guidKey
),
312 ppPolicy
, cbPolicy
, ulrZoneReg
);
316 /********************************************************************
317 * IInternetZoneManager_GetZoneActionPolicy
319 static HRESULT WINAPI
ZoneMgrImpl_GetZoneActionPolicy(IInternetZoneManager
* iface
,
324 URLZONEREG urlZoneReg
)
326 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface
, dwZone
, dwAction
, pPolicy
,
327 cbPolicy
, urlZoneReg
);
331 /********************************************************************
332 * IInternetZoneManager_SetZoneActionPolicy
334 static HRESULT WINAPI
ZoneMgrImpl_SetZoneActionPolicy(IInternetZoneManager
* iface
,
339 URLZONEREG urlZoneReg
)
341 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface
, dwZone
, dwAction
, pPolicy
,
342 cbPolicy
, urlZoneReg
);
346 /********************************************************************
347 * IInternetZoneManager_LogAction
349 static HRESULT WINAPI
ZoneMgrImpl_LogAction(IInternetZoneManager
* iface
,
355 FIXME("(%p)->(%08lx %s %s %08lx) stub\n", iface
, dwAction
, debugstr_w(pwszUrl
),
356 debugstr_w(pwszText
), dwLogFlags
);
360 /********************************************************************
361 * IInternetZoneManager_CreateZoneEnumerator
363 static HRESULT WINAPI
ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManager
* iface
,
368 FIXME("(%p)->(%p %p %08lx) stub\n", iface
, pdwEnum
, pdwCount
, dwFlags
);
372 /********************************************************************
373 * IInternetZoneManager_GetZoneAt
375 static HRESULT WINAPI
ZoneMgrImpl_GetZoneAt(IInternetZoneManager
* iface
,
380 FIXME("(%p)->(%08lx %08lx %p) stub\n", iface
, dwEnum
, dwIndex
, pdwZone
);
384 /********************************************************************
385 * IInternetZoneManager_DestroyZoneEnumerator
387 static HRESULT WINAPI
ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManager
* iface
,
390 FIXME("(%p)->(%08lx) stub\n", iface
, dwEnum
);
394 /********************************************************************
395 * IInternetZoneManager_CopyTemplatePoliciesToZone
397 static HRESULT WINAPI
ZoneMgrImpl_CopyTemplatePoliciesToZone(IInternetZoneManager
* iface
,
402 FIXME("(%p)->(%08lx %08lx %08lx) stub\n", iface
, dwTemplate
, dwZone
, dwReserved
);
406 /********************************************************************
407 * IInternetZoneManager_Construct
409 static IInternetZoneManagerVtbl ZoneMgrImplVtbl
= {
410 ZoneMgrImpl_QueryInterface
,
413 ZoneMgrImpl_GetZoneAttributes
,
414 ZoneMgrImpl_SetZoneAttributes
,
415 ZoneMgrImpl_GetZoneCustomPolicy
,
416 ZoneMgrImpl_SetZoneCustomPolicy
,
417 ZoneMgrImpl_GetZoneActionPolicy
,
418 ZoneMgrImpl_SetZoneActionPolicy
,
419 ZoneMgrImpl_LogAction
,
420 ZoneMgrImpl_CreateZoneEnumerator
,
421 ZoneMgrImpl_GetZoneAt
,
422 ZoneMgrImpl_DestroyZoneEnumerator
,
423 ZoneMgrImpl_CopyTemplatePoliciesToZone
,
425 HRESULT
ZoneMgrImpl_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
427 ZoneMgrImpl
* ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(ZoneMgrImpl
));
429 TRACE("(%p %p)\n", pUnkOuter
, ppobj
);
430 ret
->lpVtbl
= &ZoneMgrImplVtbl
;
432 *ppobj
= (IInternetZoneManager
*)ret
;
437 /***********************************************************************
438 * CoInternetCreateSecurityManager (URLMON.@)
441 HRESULT WINAPI
CoInternetCreateSecurityManager( IServiceProvider
*pSP
,
442 IInternetSecurityManager
**ppSM
, DWORD dwReserved
)
444 TRACE("%p %p %ld\n", pSP
, ppSM
, dwReserved
);
445 return SecManagerImpl_Construct(NULL
, (void**) ppSM
);
448 /********************************************************************
449 * CoInternetCreateZoneManager (URLMON.@)
451 HRESULT WINAPI
CoInternetCreateZoneManager(IServiceProvider
* pSP
, IInternetZoneManager
** ppZM
, DWORD dwReserved
)
453 TRACE("(%p %p %lx)\n", pSP
, ppZM
, dwReserved
);
454 return ZoneMgrImpl_Construct(NULL
, (void**)ppZM
);