advpack: Run the install test in a temporary directory.
[wine/multimedia.git] / dlls / urlmon / sec_mgr.c
blob943b6dd767802417ebfdf4aa360dab5de5cb23cc
1 /*
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdio.h>
24 #include "urlmon_main.h"
25 #include "winreg.h"
26 #include "wininet.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
32 static const WCHAR fileW[] = {'f','i','l','e',0};
34 static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
36 DWORD res, size;
37 HKEY hkey;
39 static const WCHAR wszZoneMapProtocolKey[] =
40 {'S','o','f','t','w','a','r','e','\\',
41 'M','i','c','r','o','s','o','f','t','\\',
42 'W','i','n','d','o','w','s','\\',
43 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
44 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\',
45 'Z','o','n','e','M','a','p','\\',
46 'P','r','o','t','o','c','o','l','D','e','f','a','u','l','t','s',0};
48 res = RegOpenKeyW(HKEY_CURRENT_USER, wszZoneMapProtocolKey, &hkey);
49 if(res != ERROR_SUCCESS) {
50 ERR("Could not open key %s\n", debugstr_w(wszZoneMapProtocolKey));
51 return E_UNEXPECTED;
54 size = sizeof(DWORD);
55 res = RegQueryValueExW(hkey, schema, NULL, NULL, (PBYTE)zone, &size);
56 RegCloseKey(hkey);
57 if(res == ERROR_SUCCESS)
58 return S_OK;
60 res = RegOpenKeyW(HKEY_LOCAL_MACHINE, wszZoneMapProtocolKey, &hkey);
61 if(res != ERROR_SUCCESS) {
62 ERR("Could not open key %s\n", debugstr_w(wszZoneMapProtocolKey));
63 return E_UNEXPECTED;
66 size = sizeof(DWORD);
67 res = RegQueryValueExW(hkey, schema, NULL, NULL, (PBYTE)zone, &size);
68 RegCloseKey(hkey);
69 if(res == ERROR_SUCCESS)
70 return S_OK;
72 *zone = 3;
73 return S_OK;
76 static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
78 LPWSTR secur_url;
79 WCHAR schema[64];
80 DWORD size=0;
81 HRESULT hres;
83 secur_url = heap_alloc(INTERNET_MAX_URL_LENGTH*sizeof(WCHAR));
84 *zone = -1;
86 hres = CoInternetParseUrl(url, PARSE_SECURITY_URL, 0, secur_url, INTERNET_MAX_URL_LENGTH, &size, 0);
87 if(hres != S_OK)
88 strcpyW(secur_url, url);
90 hres = CoInternetParseUrl(secur_url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(WCHAR), &size, 0);
91 if(FAILED(hres) || !*schema) {
92 heap_free(secur_url);
93 return E_INVALIDARG;
96 /* file protocol is a special case */
97 if(!strcmpW(schema, fileW)) {
98 WCHAR path[MAX_PATH], root[20];
99 WCHAR *ptr;
101 hres = CoInternetParseUrl(secur_url, PARSE_PATH_FROM_URL, 0, path,
102 sizeof(path)/sizeof(WCHAR), &size, 0);
104 if(SUCCEEDED(hres) && (ptr = strchrW(path, '\\')) && ptr-path < sizeof(root)/sizeof(WCHAR)) {
105 UINT type;
107 memcpy(root, path, (ptr-path)*sizeof(WCHAR));
108 root[ptr-path] = 0;
110 type = GetDriveTypeW(root);
112 switch(type) {
113 case DRIVE_UNKNOWN:
114 case DRIVE_NO_ROOT_DIR:
115 break;
116 case DRIVE_REMOVABLE:
117 case DRIVE_FIXED:
118 case DRIVE_CDROM:
119 case DRIVE_RAMDISK:
120 *zone = 0;
121 hres = S_OK;
122 break;
123 case DRIVE_REMOTE:
124 *zone = 3;
125 hres = S_OK;
126 break;
127 default:
128 FIXME("unsupported drive type %d\n", type);
133 if(*zone == -1) {
134 WARN("domains are not yet implemented\n");
135 hres = get_zone_from_reg(schema, zone);
138 if(FAILED(hres) || !ret_url)
139 heap_free(secur_url);
140 else
141 *ret_url = secur_url;
143 return hres;
146 static HRESULT open_zone_key(HKEY parent_key, DWORD zone, HKEY *hkey)
148 static const WCHAR wszZonesKey[] =
149 {'S','o','f','t','w','a','r','e','\\',
150 'M','i','c','r','o','s','o','f','t','\\',
151 'W','i','n','d','o','w','s','\\',
152 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
153 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\',
154 'Z','o','n','e','s','\\',0};
155 static const WCHAR wszFormat[] = {'%','s','%','l','d',0};
157 WCHAR key_name[sizeof(wszZonesKey)/sizeof(WCHAR)+8];
158 DWORD res;
160 wsprintfW(key_name, wszFormat, wszZonesKey, zone);
162 res = RegOpenKeyW(parent_key, key_name, hkey);
164 if(res != ERROR_SUCCESS) {
165 WARN("RegOpenKey failed\n");
166 return E_INVALIDARG;
169 return S_OK;
172 static HRESULT get_action_policy(DWORD zone, DWORD action, BYTE *policy, DWORD size, URLZONEREG zone_reg)
174 HKEY parent_key;
175 HKEY hkey;
176 LONG res;
177 HRESULT hres;
179 switch(action) {
180 case URLACTION_SCRIPT_OVERRIDE_SAFETY:
181 *(DWORD*)policy = URLPOLICY_DISALLOW;
182 return S_OK;
185 switch(zone_reg) {
186 case URLZONEREG_DEFAULT:
187 case URLZONEREG_HKCU:
188 parent_key = HKEY_CURRENT_USER;
189 break;
190 case URLZONEREG_HKLM:
191 parent_key = HKEY_LOCAL_MACHINE;
192 break;
193 default:
194 WARN("Unknown URLZONEREG: %d\n", zone_reg);
195 return E_FAIL;
198 hres = open_zone_key(parent_key, zone, &hkey);
199 if(SUCCEEDED(hres)) {
200 WCHAR action_str[16];
201 DWORD len = size;
203 static const WCHAR formatW[] = {'%','X',0};
205 wsprintfW(action_str, formatW, action);
207 res = RegQueryValueExW(hkey, action_str, NULL, NULL, policy, &len);
208 if(res == ERROR_MORE_DATA) {
209 hres = E_INVALIDARG;
210 }else if(res == ERROR_FILE_NOT_FOUND) {
211 hres = E_FAIL;
212 }else if(res != ERROR_SUCCESS) {
213 ERR("RegQueryValue failed: %d\n", res);
214 hres = E_UNEXPECTED;
217 RegCloseKey(hkey);
220 if(FAILED(hres) && zone_reg == URLZONEREG_DEFAULT)
221 return get_action_policy(zone, action, policy, size, URLZONEREG_HKLM);
223 return hres;
226 /***********************************************************************
227 * InternetSecurityManager implementation
230 typedef struct {
231 const IInternetSecurityManagerVtbl* lpInternetSecurityManagerVtbl;
233 LONG ref;
235 IInternetSecurityMgrSite *mgrsite;
236 IInternetSecurityManager *custom_manager;
237 } SecManagerImpl;
239 #define SECMGR_THIS(iface) DEFINE_THIS(SecManagerImpl, InternetSecurityManager, iface)
241 static HRESULT WINAPI SecManagerImpl_QueryInterface(IInternetSecurityManager* iface,REFIID riid,void** ppvObject)
243 SecManagerImpl *This = SECMGR_THIS(iface);
245 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppvObject);
247 /* Perform a sanity check on the parameters.*/
248 if ( (This==0) || (ppvObject==0) )
249 return E_INVALIDARG;
251 /* Initialize the return parameter */
252 *ppvObject = 0;
254 /* Compare the riid with the interface IDs implemented by this object.*/
255 if (IsEqualIID(&IID_IUnknown, riid) ||
256 IsEqualIID(&IID_IInternetSecurityManager, riid))
257 *ppvObject = iface;
259 /* Check that we obtained an interface.*/
260 if (!*ppvObject) {
261 WARN("not supported interface %s\n", debugstr_guid(riid));
262 return E_NOINTERFACE;
265 /* Query Interface always increases the reference count by one when it is successful */
266 IInternetSecurityManager_AddRef(iface);
268 return S_OK;
271 static ULONG WINAPI SecManagerImpl_AddRef(IInternetSecurityManager* iface)
273 SecManagerImpl *This = SECMGR_THIS(iface);
274 ULONG refCount = InterlockedIncrement(&This->ref);
276 TRACE("(%p) ref=%u\n", This, refCount);
278 return refCount;
281 static ULONG WINAPI SecManagerImpl_Release(IInternetSecurityManager* iface)
283 SecManagerImpl *This = SECMGR_THIS(iface);
284 ULONG refCount = InterlockedDecrement(&This->ref);
286 TRACE("(%p) ref=%u\n", This, refCount);
288 /* destroy the object if there's no more reference on it */
289 if (!refCount){
290 if(This->mgrsite)
291 IInternetSecurityMgrSite_Release(This->mgrsite);
292 if(This->custom_manager)
293 IInternetSecurityManager_Release(This->custom_manager);
295 heap_free(This);
297 URLMON_UnlockModule();
300 return refCount;
303 static HRESULT WINAPI SecManagerImpl_SetSecuritySite(IInternetSecurityManager *iface,
304 IInternetSecurityMgrSite *pSite)
306 SecManagerImpl *This = SECMGR_THIS(iface);
308 TRACE("(%p)->(%p)\n", This, pSite);
310 if(This->mgrsite)
311 IInternetSecurityMgrSite_Release(This->mgrsite);
313 if(This->custom_manager) {
314 IInternetSecurityManager_Release(This->custom_manager);
315 This->custom_manager = NULL;
318 This->mgrsite = pSite;
320 if(pSite) {
321 IServiceProvider *servprov;
322 HRESULT hres;
324 IInternetSecurityMgrSite_AddRef(pSite);
326 hres = IInternetSecurityMgrSite_QueryInterface(pSite, &IID_IServiceProvider,
327 (void**)&servprov);
328 if(SUCCEEDED(hres)) {
329 IServiceProvider_QueryService(servprov, &SID_SInternetSecurityManager,
330 &IID_IInternetSecurityManager, (void**)&This->custom_manager);
331 IServiceProvider_Release(servprov);
335 return S_OK;
338 static HRESULT WINAPI SecManagerImpl_GetSecuritySite(IInternetSecurityManager *iface,
339 IInternetSecurityMgrSite **ppSite)
341 SecManagerImpl *This = SECMGR_THIS(iface);
343 TRACE("(%p)->(%p)\n", This, ppSite);
345 if(!ppSite)
346 return E_INVALIDARG;
348 if(This->mgrsite)
349 IInternetSecurityMgrSite_AddRef(This->mgrsite);
351 *ppSite = This->mgrsite;
352 return S_OK;
355 static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *iface,
356 LPCWSTR pwszUrl, DWORD *pdwZone,
357 DWORD dwFlags)
359 SecManagerImpl *This = SECMGR_THIS(iface);
360 HRESULT hres;
362 TRACE("(%p)->(%s %p %08x)\n", iface, debugstr_w(pwszUrl), pdwZone, dwFlags);
364 if(This->custom_manager) {
365 hres = IInternetSecurityManager_MapUrlToZone(This->custom_manager,
366 pwszUrl, pdwZone, dwFlags);
367 if(hres != INET_E_DEFAULT_ACTION)
368 return hres;
371 if(!pwszUrl) {
372 *pdwZone = -1;
373 return E_INVALIDARG;
376 if(dwFlags)
377 FIXME("not supported flags: %08x\n", dwFlags);
379 return map_url_to_zone(pwszUrl, pdwZone, NULL);
382 static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *iface,
383 LPCWSTR pwszUrl, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
385 SecManagerImpl *This = SECMGR_THIS(iface);
386 LPWSTR url, ptr, ptr2;
387 DWORD zone, len;
388 HRESULT hres;
390 static const WCHAR wszFile[] = {'f','i','l','e',':'};
392 TRACE("(%p)->(%s %p %p %08lx)\n", iface, debugstr_w(pwszUrl), pbSecurityId,
393 pcbSecurityId, dwReserved);
395 if(This->custom_manager) {
396 hres = IInternetSecurityManager_GetSecurityId(This->custom_manager,
397 pwszUrl, pbSecurityId, pcbSecurityId, dwReserved);
398 if(hres != INET_E_DEFAULT_ACTION)
399 return hres;
402 if(!pwszUrl || !pbSecurityId || !pcbSecurityId)
403 return E_INVALIDARG;
405 if(dwReserved)
406 FIXME("dwReserved is not supported\n");
408 hres = map_url_to_zone(pwszUrl, &zone, &url);
409 if(FAILED(hres))
410 return hres == 0x80041001 ? E_INVALIDARG : hres;
412 /* file protocol is a special case */
413 if(strlenW(url) >= sizeof(wszFile)/sizeof(WCHAR)
414 && !memcmp(url, wszFile, sizeof(wszFile)) && strchrW(url, '\\')) {
416 static const BYTE secidFile[] = {'f','i','l','e',':'};
418 heap_free(url);
420 if(*pcbSecurityId < sizeof(secidFile)+sizeof(zone))
421 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
423 memcpy(pbSecurityId, secidFile, sizeof(secidFile));
424 *(DWORD*)(pbSecurityId+sizeof(secidFile)) = zone;
426 *pcbSecurityId = sizeof(secidFile)+sizeof(zone);
427 return S_OK;
430 ptr = strchrW(url, ':');
431 ptr2 = ++ptr;
432 while(*ptr2 == '/')
433 ptr2++;
434 if(ptr2 != ptr)
435 memmove(ptr, ptr2, (strlenW(ptr2)+1)*sizeof(WCHAR));
437 ptr = strchrW(ptr, '/');
438 if(ptr)
439 *ptr = 0;
441 len = WideCharToMultiByte(CP_ACP, 0, url, -1, NULL, 0, NULL, NULL)-1;
443 if(len+sizeof(DWORD) > *pcbSecurityId) {
444 heap_free(url);
445 return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
448 WideCharToMultiByte(CP_ACP, 0, url, -1, (LPSTR)pbSecurityId, len, NULL, NULL);
449 heap_free(url);
451 *(DWORD*)(pbSecurityId+len) = zone;
453 *pcbSecurityId = len+sizeof(DWORD);
455 return S_OK;
459 static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager *iface,
460 LPCWSTR pwszUrl, DWORD dwAction,
461 BYTE *pPolicy, DWORD cbPolicy,
462 BYTE *pContext, DWORD cbContext,
463 DWORD dwFlags, DWORD dwReserved)
465 SecManagerImpl *This = SECMGR_THIS(iface);
466 DWORD zone, policy;
467 HRESULT hres;
469 TRACE("(%p)->(%s %08x %p %08x %p %08x %08x %08x)\n", iface, debugstr_w(pwszUrl), dwAction,
470 pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
472 if(This->custom_manager) {
473 hres = IInternetSecurityManager_ProcessUrlAction(This->custom_manager, pwszUrl, dwAction,
474 pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
475 if(hres != INET_E_DEFAULT_ACTION)
476 return hres;
479 if(pContext || cbContext || dwFlags || dwReserved)
480 FIXME("Unsupported arguments\n");
482 if(!pwszUrl)
483 return E_INVALIDARG;
485 hres = map_url_to_zone(pwszUrl, &zone, NULL);
486 if(FAILED(hres))
487 return hres;
489 hres = get_action_policy(zone, dwAction, (BYTE*)&policy, sizeof(policy), URLZONEREG_DEFAULT);
490 if(FAILED(hres))
491 return hres;
493 TRACE("policy %x\n", policy);
495 switch(GetUrlPolicyPermissions(policy)) {
496 case URLPOLICY_ALLOW:
497 case URLPOLICY_CHANNEL_SOFTDIST_PRECACHE:
498 return S_OK;
499 case URLPOLICY_DISALLOW:
500 return S_FALSE;
501 case URLPOLICY_QUERY:
502 FIXME("URLPOLICY_QUERY not implemented\n");
503 return E_FAIL;
504 default:
505 FIXME("Not implemented policy %x\n", policy);
508 return E_FAIL;
512 static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager *iface,
513 LPCWSTR pwszUrl, REFGUID guidKey,
514 BYTE **ppPolicy, DWORD *pcbPolicy,
515 BYTE *pContext, DWORD cbContext,
516 DWORD dwReserved)
518 SecManagerImpl *This = SECMGR_THIS(iface);
519 HRESULT hres;
521 TRACE("(%p)->(%s %s %p %p %p %08x %08x )\n", iface, debugstr_w(pwszUrl), debugstr_guid(guidKey),
522 ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
524 if(This->custom_manager) {
525 hres = IInternetSecurityManager_QueryCustomPolicy(This->custom_manager, pwszUrl, guidKey,
526 ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
527 if(hres != INET_E_DEFAULT_ACTION)
528 return hres;
531 FIXME("Default action is not implemented\n");
532 return E_NOTIMPL;
535 static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface,
536 DWORD dwZone, LPCWSTR pwszPattern, DWORD dwFlags)
538 SecManagerImpl *This = SECMGR_THIS(iface);
539 HRESULT hres;
541 TRACE("(%p)->(%08x %s %08x)\n", iface, dwZone, debugstr_w(pwszPattern),dwFlags);
543 if(This->custom_manager) {
544 hres = IInternetSecurityManager_SetZoneMapping(This->custom_manager, dwZone,
545 pwszPattern, dwFlags);
546 if(hres != INET_E_DEFAULT_ACTION)
547 return hres;
550 FIXME("Default action is not implemented\n");
551 return E_NOTIMPL;
554 static HRESULT WINAPI SecManagerImpl_GetZoneMappings(IInternetSecurityManager *iface,
555 DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags)
557 SecManagerImpl *This = SECMGR_THIS(iface);
558 HRESULT hres;
560 TRACE("(%p)->(%08x %p %08x)\n", iface, dwZone, ppenumString,dwFlags);
562 if(This->custom_manager) {
563 hres = IInternetSecurityManager_GetZoneMappings(This->custom_manager, dwZone,
564 ppenumString, dwFlags);
565 if(hres != INET_E_DEFAULT_ACTION)
566 return hres;
569 FIXME("Default action is not implemented\n");
570 return E_NOTIMPL;
573 static const IInternetSecurityManagerVtbl VT_SecManagerImpl =
575 SecManagerImpl_QueryInterface,
576 SecManagerImpl_AddRef,
577 SecManagerImpl_Release,
578 SecManagerImpl_SetSecuritySite,
579 SecManagerImpl_GetSecuritySite,
580 SecManagerImpl_MapUrlToZone,
581 SecManagerImpl_GetSecurityId,
582 SecManagerImpl_ProcessUrlAction,
583 SecManagerImpl_QueryCustomPolicy,
584 SecManagerImpl_SetZoneMapping,
585 SecManagerImpl_GetZoneMappings
588 HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
590 SecManagerImpl *This;
592 TRACE("(%p,%p)\n",pUnkOuter,ppobj);
593 This = heap_alloc(sizeof(*This));
595 /* Initialize the virtual function table. */
596 This->lpInternetSecurityManagerVtbl = &VT_SecManagerImpl;
598 This->ref = 1;
599 This->mgrsite = NULL;
600 This->custom_manager = NULL;
602 *ppobj = This;
604 URLMON_LockModule();
606 return S_OK;
609 /***********************************************************************
610 * InternetZoneManager implementation
613 typedef struct {
614 const IInternetZoneManagerVtbl* lpVtbl;
615 LONG ref;
616 } ZoneMgrImpl;
618 /********************************************************************
619 * IInternetZoneManager_QueryInterface
621 static HRESULT WINAPI ZoneMgrImpl_QueryInterface(IInternetZoneManager* iface, REFIID riid, void** ppvObject)
623 ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
625 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppvObject);
627 if(!This || !ppvObject)
628 return E_INVALIDARG;
630 if(!IsEqualIID(&IID_IUnknown, riid) && !IsEqualIID(&IID_IInternetZoneManager, riid)) {
631 FIXME("Unknown interface: %s\n", debugstr_guid(riid));
632 *ppvObject = NULL;
633 return E_NOINTERFACE;
636 *ppvObject = iface;
637 IInternetZoneManager_AddRef(iface);
639 return S_OK;
642 /********************************************************************
643 * IInternetZoneManager_AddRef
645 static ULONG WINAPI ZoneMgrImpl_AddRef(IInternetZoneManager* iface)
647 ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
648 ULONG refCount = InterlockedIncrement(&This->ref);
650 TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
652 return refCount;
655 /********************************************************************
656 * IInternetZoneManager_Release
658 static ULONG WINAPI ZoneMgrImpl_Release(IInternetZoneManager* iface)
660 ZoneMgrImpl* This = (ZoneMgrImpl*)iface;
661 ULONG refCount = InterlockedDecrement(&This->ref);
663 TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
665 if(!refCount) {
666 heap_free(This);
667 URLMON_UnlockModule();
670 return refCount;
673 /********************************************************************
674 * IInternetZoneManager_GetZoneAttributes
676 static HRESULT WINAPI ZoneMgrImpl_GetZoneAttributes(IInternetZoneManager* iface,
677 DWORD dwZone,
678 ZONEATTRIBUTES* pZoneAttributes)
680 FIXME("(%p)->(%d %p) stub\n", iface, dwZone, pZoneAttributes);
681 return E_NOTIMPL;
684 /********************************************************************
685 * IInternetZoneManager_SetZoneAttributes
687 static HRESULT WINAPI ZoneMgrImpl_SetZoneAttributes(IInternetZoneManager* iface,
688 DWORD dwZone,
689 ZONEATTRIBUTES* pZoneAttributes)
691 FIXME("(%p)->(%08x %p) stub\n", iface, dwZone, pZoneAttributes);
692 return E_NOTIMPL;
695 /********************************************************************
696 * IInternetZoneManager_GetZoneCustomPolicy
698 static HRESULT WINAPI ZoneMgrImpl_GetZoneCustomPolicy(IInternetZoneManager* iface,
699 DWORD dwZone,
700 REFGUID guidKey,
701 BYTE** ppPolicy,
702 DWORD* pcbPolicy,
703 URLZONEREG ulrZoneReg)
705 FIXME("(%p)->(%08x %s %p %p %08x) stub\n", iface, dwZone, debugstr_guid(guidKey),
706 ppPolicy, pcbPolicy, ulrZoneReg);
707 return E_NOTIMPL;
710 /********************************************************************
711 * IInternetZoneManager_SetZoneCustomPolicy
713 static HRESULT WINAPI ZoneMgrImpl_SetZoneCustomPolicy(IInternetZoneManager* iface,
714 DWORD dwZone,
715 REFGUID guidKey,
716 BYTE* ppPolicy,
717 DWORD cbPolicy,
718 URLZONEREG ulrZoneReg)
720 FIXME("(%p)->(%08x %s %p %08x %08x) stub\n", iface, dwZone, debugstr_guid(guidKey),
721 ppPolicy, cbPolicy, ulrZoneReg);
722 return E_NOTIMPL;
725 /********************************************************************
726 * IInternetZoneManager_GetZoneActionPolicy
728 static HRESULT WINAPI ZoneMgrImpl_GetZoneActionPolicy(IInternetZoneManager* iface,
729 DWORD dwZone, DWORD dwAction, BYTE* pPolicy, DWORD cbPolicy, URLZONEREG urlZoneReg)
731 TRACE("(%p)->(%d %08x %p %d %d)\n", iface, dwZone, dwAction, pPolicy,
732 cbPolicy, urlZoneReg);
734 if(!pPolicy)
735 return E_INVALIDARG;
737 return get_action_policy(dwZone, dwAction, pPolicy, cbPolicy, urlZoneReg);
740 /********************************************************************
741 * IInternetZoneManager_SetZoneActionPolicy
743 static HRESULT WINAPI ZoneMgrImpl_SetZoneActionPolicy(IInternetZoneManager* iface,
744 DWORD dwZone,
745 DWORD dwAction,
746 BYTE* pPolicy,
747 DWORD cbPolicy,
748 URLZONEREG urlZoneReg)
750 FIXME("(%p)->(%08x %08x %p %08x %08x) stub\n", iface, dwZone, dwAction, pPolicy,
751 cbPolicy, urlZoneReg);
752 return E_NOTIMPL;
755 /********************************************************************
756 * IInternetZoneManager_PromptAction
758 static HRESULT WINAPI ZoneMgrImpl_PromptAction(IInternetZoneManager* iface,
759 DWORD dwAction,
760 HWND hwndParent,
761 LPCWSTR pwszUrl,
762 LPCWSTR pwszText,
763 DWORD dwPromptFlags)
765 FIXME("%p %08x %p %s %s %08x\n", iface, dwAction, hwndParent,
766 debugstr_w(pwszUrl), debugstr_w(pwszText), dwPromptFlags );
767 return E_NOTIMPL;
770 /********************************************************************
771 * IInternetZoneManager_LogAction
773 static HRESULT WINAPI ZoneMgrImpl_LogAction(IInternetZoneManager* iface,
774 DWORD dwAction,
775 LPCWSTR pwszUrl,
776 LPCWSTR pwszText,
777 DWORD dwLogFlags)
779 FIXME("(%p)->(%08x %s %s %08x) stub\n", iface, dwAction, debugstr_w(pwszUrl),
780 debugstr_w(pwszText), dwLogFlags);
781 return E_NOTIMPL;
784 /********************************************************************
785 * IInternetZoneManager_CreateZoneEnumerator
787 static HRESULT WINAPI ZoneMgrImpl_CreateZoneEnumerator(IInternetZoneManager* iface,
788 DWORD* pdwEnum,
789 DWORD* pdwCount,
790 DWORD dwFlags)
792 FIXME("(%p)->(%p %p %08x) stub\n", iface, pdwEnum, pdwCount, dwFlags);
793 return E_NOTIMPL;
796 /********************************************************************
797 * IInternetZoneManager_GetZoneAt
799 static HRESULT WINAPI ZoneMgrImpl_GetZoneAt(IInternetZoneManager* iface,
800 DWORD dwEnum,
801 DWORD dwIndex,
802 DWORD* pdwZone)
804 FIXME("(%p)->(%08x %08x %p) stub\n", iface, dwEnum, dwIndex, pdwZone);
805 return E_NOTIMPL;
808 /********************************************************************
809 * IInternetZoneManager_DestroyZoneEnumerator
811 static HRESULT WINAPI ZoneMgrImpl_DestroyZoneEnumerator(IInternetZoneManager* iface,
812 DWORD dwEnum)
814 FIXME("(%p)->(%08x) stub\n", iface, dwEnum);
815 return E_NOTIMPL;
818 /********************************************************************
819 * IInternetZoneManager_CopyTemplatePoliciesToZone
821 static HRESULT WINAPI ZoneMgrImpl_CopyTemplatePoliciesToZone(IInternetZoneManager* iface,
822 DWORD dwTemplate,
823 DWORD dwZone,
824 DWORD dwReserved)
826 FIXME("(%p)->(%08x %08x %08x) stub\n", iface, dwTemplate, dwZone, dwReserved);
827 return E_NOTIMPL;
830 /********************************************************************
831 * IInternetZoneManager_Construct
833 static const IInternetZoneManagerVtbl ZoneMgrImplVtbl = {
834 ZoneMgrImpl_QueryInterface,
835 ZoneMgrImpl_AddRef,
836 ZoneMgrImpl_Release,
837 ZoneMgrImpl_GetZoneAttributes,
838 ZoneMgrImpl_SetZoneAttributes,
839 ZoneMgrImpl_GetZoneCustomPolicy,
840 ZoneMgrImpl_SetZoneCustomPolicy,
841 ZoneMgrImpl_GetZoneActionPolicy,
842 ZoneMgrImpl_SetZoneActionPolicy,
843 ZoneMgrImpl_PromptAction,
844 ZoneMgrImpl_LogAction,
845 ZoneMgrImpl_CreateZoneEnumerator,
846 ZoneMgrImpl_GetZoneAt,
847 ZoneMgrImpl_DestroyZoneEnumerator,
848 ZoneMgrImpl_CopyTemplatePoliciesToZone,
851 HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj)
853 ZoneMgrImpl* ret = heap_alloc(sizeof(ZoneMgrImpl));
855 TRACE("(%p %p)\n", pUnkOuter, ppobj);
856 ret->lpVtbl = &ZoneMgrImplVtbl;
857 ret->ref = 1;
858 *ppobj = (IInternetZoneManager*)ret;
860 URLMON_LockModule();
862 return S_OK;
865 /***********************************************************************
866 * CoInternetCreateSecurityManager (URLMON.@)
869 HRESULT WINAPI CoInternetCreateSecurityManager( IServiceProvider *pSP,
870 IInternetSecurityManager **ppSM, DWORD dwReserved )
872 TRACE("%p %p %d\n", pSP, ppSM, dwReserved );
874 if(pSP)
875 FIXME("pSP not supported\n");
877 return SecManagerImpl_Construct(NULL, (void**) ppSM);
880 /********************************************************************
881 * CoInternetCreateZoneManager (URLMON.@)
883 HRESULT WINAPI CoInternetCreateZoneManager(IServiceProvider* pSP, IInternetZoneManager** ppZM, DWORD dwReserved)
885 TRACE("(%p %p %x)\n", pSP, ppZM, dwReserved);
886 return ZoneMgrImpl_Construct(NULL, (void**)ppZM);