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 const IInternetSecurityManagerVtbl
* lpvtbl1
; /* VTable relative to the IInternetSecurityManager interface.*/
46 LONG 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
;
81 ULONG refCount
= InterlockedIncrement(&This
->ref
);
83 TRACE("(%p)->(ref before=%lu)\n",This
, refCount
- 1);
88 static ULONG WINAPI
SecManagerImpl_Release(IInternetSecurityManager
* iface
)
90 SecManagerImpl
*This
= (SecManagerImpl
*)iface
;
91 ULONG refCount
= InterlockedDecrement(&This
->ref
);
93 TRACE("(%p)->(ref before=%lu)\n",This
, refCount
+ 1);
95 /* destroy the object if there's no more reference on it */
97 HeapFree(GetProcessHeap(),0,This
);
98 URLMON_UnlockModule();
104 static HRESULT WINAPI
SecManagerImpl_SetSecuritySite(IInternetSecurityManager
*iface
,
105 IInternetSecurityMgrSite
*pSite
)
107 FIXME("(%p)->(%p)\n", iface
, pSite
);
111 static HRESULT WINAPI
SecManagerImpl_GetSecuritySite(IInternetSecurityManager
*iface
,
112 IInternetSecurityMgrSite
**ppSite
)
114 FIXME("(%p)->( %p)\n", iface
, ppSite
);
118 static HRESULT WINAPI
SecManagerImpl_MapUrlToZone(IInternetSecurityManager
*iface
,
119 LPCWSTR pwszUrl
, DWORD
*pdwZone
,
122 FIXME("(%p)->(%s %p %08lx)\n", iface
, debugstr_w(pwszUrl
), pdwZone
, dwFlags
);
126 static HRESULT WINAPI
SecManagerImpl_GetSecurityId(IInternetSecurityManager
*iface
,
128 BYTE
*pbSecurityId
, DWORD
*pcbSecurityId
,
131 FIXME("(%p)->(%s %p %p %08lx)\n", iface
, debugstr_w(pwszUrl
), pbSecurityId
, pcbSecurityId
,
137 static HRESULT WINAPI
SecManagerImpl_ProcessUrlAction(IInternetSecurityManager
*iface
,
138 LPCWSTR pwszUrl
, DWORD dwAction
,
139 BYTE
*pPolicy
, DWORD cbPolicy
,
140 BYTE
*pContext
, DWORD cbContext
,
141 DWORD dwFlags
, DWORD dwReserved
)
143 FIXME("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface
, debugstr_w(pwszUrl
), dwAction
,
144 pPolicy
, cbPolicy
, pContext
, cbContext
, dwFlags
, dwReserved
);
149 static HRESULT WINAPI
SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager
*iface
,
150 LPCWSTR pwszUrl
, REFGUID guidKey
,
151 BYTE
**ppPolicy
, DWORD
*pcbPolicy
,
152 BYTE
*pContext
, DWORD cbContext
,
155 FIXME("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface
, debugstr_w(pwszUrl
), debugstr_guid(guidKey
),
156 ppPolicy
, pcbPolicy
, pContext
, cbContext
, dwReserved
);
160 static HRESULT WINAPI
SecManagerImpl_SetZoneMapping(IInternetSecurityManager
*iface
,
161 DWORD dwZone
, LPCWSTR pwszPattern
, DWORD dwFlags
)
163 FIXME("(%p)->(%08lx %s %08lx)\n", iface
, dwZone
, debugstr_w(pwszPattern
),dwFlags
);
167 static HRESULT WINAPI
SecManagerImpl_GetZoneMappings(IInternetSecurityManager
*iface
,
168 DWORD dwZone
, IEnumString
**ppenumString
, DWORD dwFlags
)
170 FIXME("(%p)->(%08lx %p %08lx)\n", iface
, dwZone
, ppenumString
,dwFlags
);
174 static const IInternetSecurityManagerVtbl VT_SecManagerImpl
=
176 SecManagerImpl_QueryInterface
,
177 SecManagerImpl_AddRef
,
178 SecManagerImpl_Release
,
179 SecManagerImpl_SetSecuritySite
,
180 SecManagerImpl_GetSecuritySite
,
181 SecManagerImpl_MapUrlToZone
,
182 SecManagerImpl_GetSecurityId
,
183 SecManagerImpl_ProcessUrlAction
,
184 SecManagerImpl_QueryCustomPolicy
,
185 SecManagerImpl_SetZoneMapping
,
186 SecManagerImpl_GetZoneMappings
189 HRESULT
SecManagerImpl_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
191 SecManagerImpl
*This
;
193 TRACE("(%p,%p)\n",pUnkOuter
,ppobj
);
194 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
196 /* Initialize the virtual function table. */
197 This
->lpvtbl1
= &VT_SecManagerImpl
;
207 /***********************************************************************
208 * InternetZoneManager implementation
212 const IInternetZoneManagerVtbl
* lpVtbl
;
216 /********************************************************************
217 * IInternetZoneManager_QueryInterface
219 static HRESULT WINAPI
ZoneMgrImpl_QueryInterface(IInternetZoneManager
* iface
, REFIID riid
, void** ppvObject
)
221 ZoneMgrImpl
* This
= (ZoneMgrImpl
*)iface
;
223 TRACE("(%p)->(%s,%p)\n", This
, debugstr_guid(riid
), ppvObject
);
225 if(!This
|| !ppvObject
)
228 if(!IsEqualIID(&IID_IUnknown
, riid
) && !IsEqualIID(&IID_IInternetZoneManager
, riid
)) {
229 FIXME("Unknown interface: %s\n", debugstr_guid(riid
));
231 return E_NOINTERFACE
;
235 IInternetZoneManager_AddRef(iface
);
240 /********************************************************************
241 * IInternetZoneManager_AddRef
243 static ULONG WINAPI
ZoneMgrImpl_AddRef(IInternetZoneManager
* iface
)
245 ZoneMgrImpl
* This
= (ZoneMgrImpl
*)iface
;
246 ULONG refCount
= InterlockedIncrement(&This
->ref
);
248 TRACE("(%p)->(ref before=%lu)\n",This
, refCount
- 1);
253 /********************************************************************
254 * IInternetZoneManager_Release
256 static ULONG WINAPI
ZoneMgrImpl_Release(IInternetZoneManager
* iface
)
258 ZoneMgrImpl
* This
= (ZoneMgrImpl
*)iface
;
259 ULONG refCount
= InterlockedDecrement(&This
->ref
);
261 TRACE("(%p)->(ref before=%lu)\n",This
, refCount
+ 1);
264 HeapFree(GetProcessHeap(), 0, This
);
265 URLMON_UnlockModule();
271 /********************************************************************
272 * IInternetZoneManager_GetZoneAttributes
274 static HRESULT WINAPI
ZoneMgrImpl_GetZoneAttributes(IInternetZoneManager
* iface
,
276 ZONEATTRIBUTES
* pZoneAttributes
)
278 FIXME("(%p)->(%ld %p) stub\n", iface
, dwZone
, pZoneAttributes
);
282 /********************************************************************
283 * IInternetZoneManager_SetZoneAttributes
285 static HRESULT WINAPI
ZoneMgrImpl_SetZoneAttributes(IInternetZoneManager
* iface
,
287 ZONEATTRIBUTES
* pZoneAttributes
)
289 FIXME("(%p)->(%08lx %p) stub\n", iface
, dwZone
, pZoneAttributes
);
293 /********************************************************************
294 * IInternetZoneManager_GetZoneCustomPolicy
296 static HRESULT WINAPI
ZoneMgrImpl_GetZoneCustomPolicy(IInternetZoneManager
* iface
,
301 URLZONEREG ulrZoneReg
)
303 FIXME("(%p)->(%08lx %s %p %p %08x) stub\n", iface
, dwZone
, debugstr_guid(guidKey
),
304 ppPolicy
, pcbPolicy
, ulrZoneReg
);
308 /********************************************************************
309 * IInternetZoneManager_SetZoneCustomPolicy
311 static HRESULT WINAPI
ZoneMgrImpl_SetZoneCustomPolicy(IInternetZoneManager
* iface
,
316 URLZONEREG ulrZoneReg
)
318 FIXME("(%p)->(%08lx %s %p %08lx %08x) stub\n", iface
, dwZone
, debugstr_guid(guidKey
),
319 ppPolicy
, cbPolicy
, ulrZoneReg
);
323 /********************************************************************
324 * IInternetZoneManager_GetZoneActionPolicy
326 static HRESULT WINAPI
ZoneMgrImpl_GetZoneActionPolicy(IInternetZoneManager
* iface
,
331 URLZONEREG urlZoneReg
)
333 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface
, dwZone
, dwAction
, pPolicy
,
334 cbPolicy
, urlZoneReg
);
338 /********************************************************************
339 * IInternetZoneManager_SetZoneActionPolicy
341 static HRESULT WINAPI
ZoneMgrImpl_SetZoneActionPolicy(IInternetZoneManager
* iface
,
346 URLZONEREG urlZoneReg
)
348 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface
, dwZone
, dwAction
, pPolicy
,
349 cbPolicy
, urlZoneReg
);
353 /********************************************************************
354 * IInternetZoneManager_PromptAction
356 static HRESULT WINAPI
ZoneMgrImpl_PromptAction(IInternetZoneManager
* iface
,
363 FIXME("%p %08lx %p %s %s %08lx\n", iface
, dwAction
, hwndParent
,
364 debugstr_w(pwszUrl
), debugstr_w(pwszText
), dwPromptFlags
);
368 /********************************************************************
369 * IInternetZoneManager_LogAction
371 static HRESULT WINAPI
ZoneMgrImpl_LogAction(IInternetZoneManager
* iface
,
377 FIXME("(%p)->(%08lx %s %s %08lx) stub\n", iface
, dwAction
, debugstr_w(pwszUrl
),
378 debugstr_w(pwszText
), dwLogFlags
);
382 /********************************************************************
383 * IInternetZoneManager_CreateZoneEnumerator
385 static HRESULT WINAPI
ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManager
* iface
,
390 FIXME("(%p)->(%p %p %08lx) stub\n", iface
, pdwEnum
, pdwCount
, dwFlags
);
394 /********************************************************************
395 * IInternetZoneManager_GetZoneAt
397 static HRESULT WINAPI
ZoneMgrImpl_GetZoneAt(IInternetZoneManager
* iface
,
402 FIXME("(%p)->(%08lx %08lx %p) stub\n", iface
, dwEnum
, dwIndex
, pdwZone
);
406 /********************************************************************
407 * IInternetZoneManager_DestroyZoneEnumerator
409 static HRESULT WINAPI
ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManager
* iface
,
412 FIXME("(%p)->(%08lx) stub\n", iface
, dwEnum
);
416 /********************************************************************
417 * IInternetZoneManager_CopyTemplatePoliciesToZone
419 static HRESULT WINAPI
ZoneMgrImpl_CopyTemplatePoliciesToZone(IInternetZoneManager
* iface
,
424 FIXME("(%p)->(%08lx %08lx %08lx) stub\n", iface
, dwTemplate
, dwZone
, dwReserved
);
428 /********************************************************************
429 * IInternetZoneManager_Construct
431 static const IInternetZoneManagerVtbl ZoneMgrImplVtbl
= {
432 ZoneMgrImpl_QueryInterface
,
435 ZoneMgrImpl_GetZoneAttributes
,
436 ZoneMgrImpl_SetZoneAttributes
,
437 ZoneMgrImpl_GetZoneCustomPolicy
,
438 ZoneMgrImpl_SetZoneCustomPolicy
,
439 ZoneMgrImpl_GetZoneActionPolicy
,
440 ZoneMgrImpl_SetZoneActionPolicy
,
441 ZoneMgrImpl_PromptAction
,
442 ZoneMgrImpl_LogAction
,
443 ZoneMgrImpl_CreateZoneEnumerator
,
444 ZoneMgrImpl_GetZoneAt
,
445 ZoneMgrImpl_DestroyZoneEnumerator
,
446 ZoneMgrImpl_CopyTemplatePoliciesToZone
,
449 HRESULT
ZoneMgrImpl_Construct(IUnknown
*pUnkOuter
, LPVOID
*ppobj
)
451 ZoneMgrImpl
* ret
= HeapAlloc(GetProcessHeap(), 0, sizeof(ZoneMgrImpl
));
453 TRACE("(%p %p)\n", pUnkOuter
, ppobj
);
454 ret
->lpVtbl
= &ZoneMgrImplVtbl
;
456 *ppobj
= (IInternetZoneManager
*)ret
;
463 /***********************************************************************
464 * CoInternetCreateSecurityManager (URLMON.@)
467 HRESULT WINAPI
CoInternetCreateSecurityManager( IServiceProvider
*pSP
,
468 IInternetSecurityManager
**ppSM
, DWORD dwReserved
)
470 TRACE("%p %p %ld\n", pSP
, ppSM
, dwReserved
);
471 return SecManagerImpl_Construct(NULL
, (void**) ppSM
);
474 /********************************************************************
475 * CoInternetCreateZoneManager (URLMON.@)
477 HRESULT WINAPI
CoInternetCreateZoneManager(IServiceProvider
* pSP
, IInternetZoneManager
** ppZM
, DWORD dwReserved
)
479 TRACE("(%p %p %lx)\n", pSP
, ppZM
, dwReserved
);
480 return ZoneMgrImpl_Construct(NULL
, (void**)ppZM
);