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;
81 ULONG refCount = InterlockedIncrement(&This->ref);
83 TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
90 static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
92 SecManagerImpl *This = (SecManagerImpl *)iface;
93 ULONG refCount = InterlockedDecrement(&This->ref);
95 TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
97 /* destroy the object if there's no more reference on it */
99 HeapFree(GetProcessHeap(),0,This);
102 URLMON_UnlockModule();
107 static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
108 IInternetSecurityMgrSite *pSite)
110 FIXME("(%p)->(%p)\n", iface, pSite);
114 static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManager *iface,
115 IInternetSecurityMgrSite **ppSite)
117 FIXME("(%p)->( %p)\n", iface, ppSite);
121 static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *iface,
122 LPCWSTR pwszUrl, DWORD *pdwZone,
125 FIXME("(%p)->(%s %p %08lx)\n", iface, debugstr_w(pwszUrl), pdwZone, dwFlags);
129 static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *iface,
131 BYTE *pbSecurityId, DWORD *pcbSecurityId,
134 FIXME("(%p)->(%s %p %p %08lx)\n", iface, debugstr_w(pwszUrl), pbSecurityId, pcbSecurityId,
140 static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager *iface,
141 LPCWSTR pwszUrl, DWORD dwAction,
142 BYTE *pPolicy, DWORD cbPolicy,
143 BYTE *pContext, DWORD cbContext,
144 DWORD dwFlags, DWORD dwReserved)
146 FIXME("(%p)->(%s %08lx %p %08lx %p %08lx %08lx %08lx)\n", iface, debugstr_w(pwszUrl), dwAction,
147 pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
152 static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager *iface,
153 LPCWSTR pwszUrl, REFGUID guidKey,
154 BYTE **ppPolicy, DWORD *pcbPolicy,
155 BYTE *pContext, DWORD cbContext,
158 FIXME("(%p)->(%s %s %p %p %p %08lx %08lx )\n", iface, debugstr_w(pwszUrl), debugstr_guid(guidKey),
159 ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
163 static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface,
164 DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
166 FIXME("(%p)->(%08lx %s %08lx)\n", iface, dwZone, debugstr_w(pwszPattern),dwFlags);
170 static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManager *iface,
171 DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
173 FIXME("(%p)->(%08lx %p %08lx)\n", iface, dwZone, ppenumString,dwFlags);
177 static IInternetSecurityManagerVtbl VT_SecManagerImpl =
179 SecManagerImpl_QueryInterface,
180 SecManagerImpl_AddRef,
181 SecManagerImpl_Release,
182 SecManagerImpl_SetSecuritySite,
183 SecManagerImpl_GetSecuritySite,
184 SecManagerImpl_MapUrlToZone,
185 SecManagerImpl_GetSecurityId,
186 SecManagerImpl_ProcessUrlAction,
187 SecManagerImpl_QueryCustomPolicy,
188 SecManagerImpl_SetZoneMapping,
189 SecManagerImpl_GetZoneMappings
192 HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
194 SecManagerImpl *This;
196 TRACE("(%p,%p)\n",pUnkOuter,ppobj);
197 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
199 /* Initialize the virtual function table. */
200 This->lpvtbl1 = &VT_SecManagerImpl;
207 /***********************************************************************
208 * InternetZoneManager implementation
212 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);
255 /********************************************************************
256 * IInternetZoneManager_Release
258 static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManager* iface)
260 ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
261 ULONG refCount = InterlockedDecrement(&This->ref);
263 TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
266 HeapFree(GetProcessHeap(), 0, This);
268 URLMON_UnlockModule();
273 /********************************************************************
274 * IInternetZoneManager_GetZoneAttributes
276 static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributes(IInternetZoneManager* iface,
278 ZONEATTRIBUTES* pZoneAttributes)
280 FIXME("(%p)->(%ld %p) stub\n", iface, dwZone, pZoneAttributes);
284 /********************************************************************
285 * IInternetZoneManager_SetZoneAttributes
287 static HRESULT WINAPI ZoneMgrImpl_SetZoneAttributes(IInternetZoneManager* iface,
289 ZONEATTRIBUTES* pZoneAttributes)
291 FIXME("(%p)->(%08lx %p) stub\n", iface, dwZone, pZoneAttributes);
295 /********************************************************************
296 * IInternetZoneManager_GetZoneCustomPolicy
298 static HRESULT WINAPI ZoneMgrImpl_GetZoneCustomPolicy(IInternetZoneManager* iface,
303 URLZONEREG ulrZoneReg)
305 FIXME("(%p)->(%08lx %s %p %p %08x) stub\n", iface, dwZone, debugstr_guid(guidKey),
306 ppPolicy, pcbPolicy, ulrZoneReg);
310 /********************************************************************
311 * IInternetZoneManager_SetZoneCustomPolicy
313 static HRESULT WINAPI ZoneMgrImpl_SetZoneCustomPolicy(IInternetZoneManager* iface,
318 URLZONEREG ulrZoneReg)
320 FIXME("(%p)->(%08lx %s %p %08lx %08x) stub\n", iface, dwZone, debugstr_guid(guidKey),
321 ppPolicy, cbPolicy, ulrZoneReg);
325 /********************************************************************
326 * IInternetZoneManager_GetZoneActionPolicy
328 static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicy(IInternetZoneManager* iface,
333 URLZONEREG urlZoneReg)
335 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface, dwZone, dwAction, pPolicy,
336 cbPolicy, urlZoneReg);
340 /********************************************************************
341 * IInternetZoneManager_SetZoneActionPolicy
343 static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicy(IInternetZoneManager* iface,
348 URLZONEREG urlZoneReg)
350 FIXME("(%p)->(%08lx %08lx %p %08lx %08x) stub\n", iface, dwZone, dwAction, pPolicy,
351 cbPolicy, urlZoneReg);
355 /********************************************************************
356 * IInternetZoneManager_LogAction
358 static HRESULT WINAPI ZoneMgrImpl_LogAction(IInternetZoneManager* iface,
364 FIXME("(%p)->(%08lx %s %s %08lx) stub\n", iface, dwAction, debugstr_w(pwszUrl),
365 debugstr_w(pwszText), dwLogFlags);
369 /********************************************************************
370 * IInternetZoneManager_CreateZoneEnumerator
372 static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManager* iface,
377 FIXME("(%p)->(%p %p %08lx) stub\n", iface, pdwEnum, pdwCount, dwFlags);
381 /********************************************************************
382 * IInternetZoneManager_GetZoneAt
384 static HRESULT WINAPI ZoneMgrImpl_GetZoneAt(IInternetZoneManager* iface,
389 FIXME("(%p)->(%08lx %08lx %p) stub\n", iface, dwEnum, dwIndex, pdwZone);
393 /********************************************************************
394 * IInternetZoneManager_DestroyZoneEnumerator
396 static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManager* iface,
399 FIXME("(%p)->(%08lx) stub\n", iface, dwEnum);
403 /********************************************************************
404 * IInternetZoneManager_CopyTemplatePoliciesToZone
406 static HRESULT WINAPI ZoneMgrImpl_CopyTemplatePoliciesToZone(IInternetZoneManager* iface,
411 FIXME("(%p)->(%08lx %08lx %08lx) stub\n", iface, dwTemplate, dwZone, dwReserved);
415 /********************************************************************
416 * IInternetZoneManager_Construct
418 static IInternetZoneManagerVtbl ZoneMgrImplVtbl = {
419 ZoneMgrImpl_QueryInterface,
422 ZoneMgrImpl_GetZoneAttributes,
423 ZoneMgrImpl_SetZoneAttributes,
424 ZoneMgrImpl_GetZoneCustomPolicy,
425 ZoneMgrImpl_SetZoneCustomPolicy,
426 ZoneMgrImpl_GetZoneActionPolicy,
427 ZoneMgrImpl_SetZoneActionPolicy,
428 ZoneMgrImpl_LogAction,
429 ZoneMgrImpl_CreateZoneEnumerator,
430 ZoneMgrImpl_GetZoneAt,
431 ZoneMgrImpl_DestroyZoneEnumerator,
432 ZoneMgrImpl_CopyTemplatePoliciesToZone,
434 HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
436 ZoneMgrImpl* ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ZoneMgrImpl));
438 TRACE("(%p %p)\n", pUnkOuter, ppobj);
439 ret->lpVtbl = &ZoneMgrImplVtbl;
441 *ppobj = (IInternetZoneManager*)ret;
446 /***********************************************************************
447 * CoInternetCreateSecurityManager (URLMON.@)
450 HRESULT WINAPI CoInternetCreateSecurityManager( IServiceProvider *pSP,
451 IInternetSecurityManager **ppSM, DWORD dwReserved )
453 TRACE("%p %p %ld\n", pSP, ppSM, dwReserved );
454 return SecManagerImpl_Construct(NULL, (void**) ppSM);
457 /********************************************************************
458 * CoInternetCreateZoneManager (URLMON.@)
460 HRESULT WINAPI CoInternetCreateZoneManager(IServiceProvider* pSP, IInternetZoneManager** ppZM, DWORD dwReserved)
462 TRACE("(%p %p %lx)\n", pSP, ppZM, dwReserved);
463 return ZoneMgrImpl_Construct(NULL, (void**)ppZM);