ReactOS  0.4.14-dev-606-g14ebc0b
internet.c
Go to the documentation of this file.
1 /*
2  * Copyright 2005 Jacek Caban
3  * Copyright 2011 Thomas Mullaly for CodeWeavers
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19 
20 #include "urlmon_main.h"
21 #include "winreg.h"
22 #include "shlwapi.h"
23 
24 #include "wine/debug.h"
25 
27 
28 static const WCHAR feature_control_keyW[] =
29  {'S','o','f','t','w','a','r','e','\\',
30  'M','i','c','r','o','s','o','f','t','\\',
31  'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
32  'M','a','i','n','\\',
33  'F','e','a','t','u','r','e','C','o','n','t','r','o','l',0};
34 
36  {'F','E','A','T','U','R','E','_','O','B','J','E','C','T','_','C','A','C','H','I','N','G',0};
38  {'F','E','A','T','U','R','E','_','Z','O','N','E','_','E','L','E','V','A','T','I','O','N',0};
39 static const WCHAR feature_mime_handlingW[] =
40  {'F','E','A','T','U','R','E','_','M','I','M','E','_','H','A','N','D','L','I','N','G',0};
41 static const WCHAR feature_mime_sniffingW[] =
42  {'F','E','A','T','U','R','E','_','M','I','M','E','_','S','N','I','F','F','I','N','G',0};
44  {'F','E','A','T','U','R','E','_','W','I','N','D','O','W','_','R','E','S','T','R','I','C','T','I','O','N','S',0};
46  {'F','E','A','T','U','R','E','_','W','E','B','O','C','_','P','O','P','U','P','M','A','N','A','G','E','M','E','N','T',0};
47 static const WCHAR feature_behaviorsW[] =
48  {'F','E','A','T','U','R','E','_','B','E','H','A','V','I','O','R','S',0};
50  {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','M','K','_','P','R','O','T','O','C','O','L',0};
52  {'F','E','A','T','U','R','E','_','L','O','C','A','L','M','A','C','H','I','N','E','_','L','O','C','K','D','O','W','N',0};
53 static const WCHAR feature_securitybandW[] =
54  {'F','E','A','T','U','R','E','_','S','E','C','U','R','I','T','Y','B','A','N','D',0};
56  {'F','E','A','T','U','R','E','_','R','E','S','T','R','I','C','T','_','A','C','T','I','V','E','X','I','N','S','T','A','L','L',0};
58  {'F','E','A','T','U','R','E','_','V','A','L','I','D','A','T','E','_','N','A','V','I','G','A','T','E','_','U','R','L',0};
60  {'F','E','A','T','U','R','E','_','R','E','S','T','R','I','C','T','_','F','I','L','E','D','O','W','N','L','O','A','D',0};
62  {'F','E','A','T','U','R','E','_','A','D','D','O','N','_','M','A','N','A','G','E','M','E','N','T',0};
64  {'F','E','A','T','U','R','E','_','P','R','O','T','O','C','O','L','_','L','O','C','K','D','O','W','N',0};
66  {'F','E','A','T','U','R','E','_','H','T','T','P','_','U','S','E','R','N','A','M','E','_',
67  'P','A','S','S','W','O','R','D','_','D','I','S','A','B','L','E',0};
69  {'F','E','A','T','U','R','E','_','S','A','F','E','_','B','I','N','D','T','O','O','B','J','E','C','T',0};
71  {'F','E','A','T','U','R','E','_','U','N','C','_','S','A','V','E','D','F','I','L','E','C','H','E','C','K',0};
73  {'F','E','A','T','U','R','E','_','G','E','T','_','U','R','L','_','D','O','M','_',
74  'F','I','L','E','P','A','T','H','_','U','N','E','N','C','O','D','E','D',0};
76  {'F','E','A','T','U','R','E','_','T','A','B','B','E','D','_','B','R','O','W','S','I','N','G',0};
77 static const WCHAR feature_ssluxW[] =
78  {'F','E','A','T','U','R','E','_','S','S','L','U','X',0};
80  {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','N','A','V','I','G','A','T','I','O','N','_',
81  'S','O','U','N','D','S',0};
83  {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','L','E','G','A','C','Y','_',
84  'C','O','M','P','R','E','S','S','I','O','N',0};
86  {'F','E','A','T','U','R','E','_','F','O','R','C','E','_','A','D','D','R','_','A','N','D','_',
87  'S','T','A','T','U','S',0};
88 static const WCHAR feature_xmlhttpW[] =
89  {'F','E','A','T','U','R','E','_','X','M','L','H','T','T','P',0};
91  {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','T','E','L','N','E','T','_',
92  'P','R','O','T','O','C','O','L',0};
93 static const WCHAR feature_feedsW[] =
94  {'F','E','A','T','U','R','E','_','F','E','E','D','S',0};
96  {'F','E','A','T','U','R','E','_','B','L','O','C','K','_','I','N','P','U','T','_','P','R','O','M','P','T','S',0};
97 
100 {
101  0, 0, &process_features_cs,
103  0, 0, { (DWORD_PTR)(__FILE__ ": process features") }
104 };
105 static CRITICAL_SECTION process_features_cs = { &process_features_cs_dbg, -1, 0, 0, 0, 0 };
106 
107 typedef struct feature_control {
112 
113 /* IMPORTANT!!!
114  *
115  * This array is indexed using INTERNETFEATURELIST values, so everything must
116  * appear in the same order as it does in INTERNETFEATURELIST.
117  */
118 static feature_control process_feature_controls[FEATURE_ENTRY_COUNT] = {
147 };
148 
150 {
151  WCHAR *ptr;
152  DWORD len = 0;
153 
154  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
155 
156  if(flags)
157  ERR("wrong flags\n");
158 
159  ptr = wcschr(url, ':');
160  if(ptr)
161  len = ptr-url;
162 
163  if(rsize)
164  *rsize = len;
165 
166  if(len >= size)
167  return E_POINTER;
168 
169  if(len)
170  memcpy(result, url, len*sizeof(WCHAR));
171  result[len] = 0;
172 
173  return S_OK;
174 }
175 
177  DWORD size, DWORD *rsize)
178 {
180  DWORD prsize = size;
181  HRESULT hres;
182 
183  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
184 
186 
187  if(protocol_info) {
188  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_CANONICALIZE,
189  flags, result, size, rsize, 0);
190  IInternetProtocolInfo_Release(protocol_info);
191  if(SUCCEEDED(hres))
192  return hres;
193  }
194 
195  hres = UrlCanonicalizeW(url, result, &prsize, flags);
196 
197  if(rsize)
198  *rsize = prsize;
199  return hres;
200 }
201 
203 {
205  HRESULT hres;
206 
207  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
208 
210 
211  if(protocol_info) {
212  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL,
213  flags, result, size, rsize, 0);
214  IInternetProtocolInfo_Release(protocol_info);
215  return hres;
216  }
217 
218  return E_FAIL;
219 }
220 
222 {
224  DWORD prsize;
225  HRESULT hres;
226 
227  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
228 
230 
231  if(protocol_info) {
232  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, action,
233  flags, result, size, rsize, 0);
234  IInternetProtocolInfo_Release(protocol_info);
235  if(SUCCEEDED(hres))
236  return hres;
237  }
238 
239  prsize = size;
240  hres = UrlUnescapeW((LPWSTR)url, result, &prsize, flags);
241 
242  if(rsize)
243  *rsize = prsize;
244 
245  return hres;
246 }
247 
249 {
251  DWORD prsize;
252  HRESULT hres;
253 
254  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
255 
257 
258  if(protocol_info) {
259  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_PATH_FROM_URL,
260  flags, result, size, rsize, 0);
261  IInternetProtocolInfo_Release(protocol_info);
262  if(SUCCEEDED(hres))
263  return hres;
264  }
265 
266  prsize = size;
267  hres = PathCreateFromUrlW(url, result, &prsize, 0);
268 
269  if(rsize)
270  *rsize = prsize;
271  return hres;
272 }
273 
275  DWORD size, DWORD *rsize)
276 {
278  HRESULT hres;
279 
280  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
281 
283 
284  if(protocol_info) {
285  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_DOMAIN,
286  flags, result, size, rsize, 0);
287  IInternetProtocolInfo_Release(protocol_info);
288  if(SUCCEEDED(hres))
289  return hres;
290  }
291 
292  return E_FAIL;
293 }
294 
296  DWORD size, DWORD *rsize)
297 {
299  HRESULT hres;
300 
301  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
302 
304 
305  if(protocol_info) {
306  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_DOMAIN,
307  flags, result, size, rsize, 0);
308  IInternetProtocolInfo_Release(protocol_info);
309  if(SUCCEEDED(hres))
310  return hres;
311  }
312 
314  if(rsize)
315  *rsize = size;
316 
317  if(hres == E_POINTER)
318  return S_FALSE;
319 
320  if(FAILED(hres))
321  return E_FAIL;
322  return S_OK;
323 }
324 
326  DWORD size, DWORD *rsize)
327 {
330  HRESULT hres;
331 
332  TRACE("(%s %08x %p %d %p)\n", debugstr_w(url), flags, result, size, rsize);
333 
335 
336  if(protocol_info) {
337  hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_ROOTDOCUMENT,
338  flags, result, size, rsize, 0);
339  IInternetProtocolInfo_Release(protocol_info);
340  if(SUCCEEDED(hres))
341  return hres;
342  }
343 
344  url_info.cbSize = sizeof(url_info);
345  if(FAILED(ParseURLW(url, &url_info)))
346  return E_FAIL;
347 
348  switch(url_info.nScheme) {
349  case URL_SCHEME_FTP:
350  case URL_SCHEME_HTTP:
351  case URL_SCHEME_HTTPS:
352  if(url_info.cchSuffix<3 || *(url_info.pszSuffix)!='/'
353  || *(url_info.pszSuffix+1)!='/')
354  return E_FAIL;
355 
356  if(size < url_info.cchProtocol+3) {
357  size = 0;
359 
360  if(rsize)
361  *rsize = size+url_info.cchProtocol+3;
362 
363  if(hres == E_POINTER)
364  return S_FALSE;
365 
366  return hres;
367  }
368 
369  size -= url_info.cchProtocol+3;
370  hres = UrlGetPartW(url, result+url_info.cchProtocol+3,
372 
373  if(hres == E_POINTER)
374  return S_FALSE;
375 
376  if(FAILED(hres))
377  return E_FAIL;
378 
379  if(rsize)
380  *rsize = size+url_info.cchProtocol+3;
381 
382  memcpy(result, url, (url_info.cchProtocol+3)*sizeof(WCHAR));
383  return hres;
384  default:
385  return E_FAIL;
386  }
387 }
388 
389 /**************************************************************************
390  * CoInternetParseUrl (URLMON.@)
391  */
393  LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
394 {
395  if(dwReserved)
396  WARN("dwReserved = %d\n", dwReserved);
397 
398  switch(ParseAction) {
399  case PARSE_CANONICALIZE:
400  return parse_canonicalize_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
401  case PARSE_SECURITY_URL:
402  return parse_security_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
403  case PARSE_ENCODE:
404  case PARSE_UNESCAPE:
405  return parse_encode(pwzUrl, ParseAction, dwFlags, pszResult, cchResult, pcchResult);
406  case PARSE_PATH_FROM_URL:
407  return parse_path_from_url(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
408  case PARSE_SCHEMA:
409  return parse_schema(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
410  case PARSE_SECURITY_DOMAIN:
411  return parse_security_domain(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
412  case PARSE_DOMAIN:
413  return parse_domain(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
414  case PARSE_ROOTDOCUMENT:
415  return parse_rootdocument(pwzUrl, dwFlags, pszResult, cchResult, pcchResult);
416  default:
417  FIXME("not supported action %d\n", ParseAction);
418  }
419 
420  return E_NOTIMPL;
421 }
422 
423 /**************************************************************************
424  * CoInternetCombineUrl (URLMON.@)
425  */
426 HRESULT WINAPI CoInternetCombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
427  DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult,
429 {
431  DWORD size = cchResult;
432  HRESULT hres;
433 
434  TRACE("(%s,%s,0x%08x,%p,%d,%p,%d)\n", debugstr_w(pwzBaseUrl),
435  debugstr_w(pwzRelativeUrl), dwCombineFlags, pwzResult, cchResult, pcchResult,
436  dwReserved);
437 
438  protocol_info = get_protocol_info(pwzBaseUrl);
439 
440  if(protocol_info) {
441  hres = IInternetProtocolInfo_CombineUrl(protocol_info, pwzBaseUrl, pwzRelativeUrl,
442  dwCombineFlags, pwzResult, cchResult, pcchResult, dwReserved);
443  IInternetProtocolInfo_Release(protocol_info);
444  if(SUCCEEDED(hres))
445  return hres;
446  }
447 
448 
449  hres = UrlCombineW(pwzBaseUrl, pwzRelativeUrl, pwzResult, &size, dwCombineFlags);
450 
451  if(pcchResult)
452  *pcchResult = size;
453 
454  return hres;
455 }
456 
457 /**************************************************************************
458  * CoInternetCompareUrl (URLMON.@)
459  */
460 HRESULT WINAPI CoInternetCompareUrl(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
461 {
463  HRESULT hres;
464 
465  TRACE("(%s,%s,%08x)\n", debugstr_w(pwzUrl1), debugstr_w(pwzUrl2), dwCompareFlags);
466 
467  protocol_info = get_protocol_info(pwzUrl1);
468 
469  if(protocol_info) {
470  hres = IInternetProtocolInfo_CompareUrl(protocol_info, pwzUrl1, pwzUrl2, dwCompareFlags);
471  IInternetProtocolInfo_Release(protocol_info);
472  if(SUCCEEDED(hres))
473  return hres;
474  }
475 
476  return UrlCompareW(pwzUrl1, pwzUrl2, dwCompareFlags) ? S_FALSE : S_OK;
477 }
478 
479 /***********************************************************************
480  * CoInternetQueryInfo (URLMON.@)
481  *
482  * Retrieves information relevant to a specified URL
483  *
484  */
486  DWORD dwQueryFlags, LPVOID pvBuffer, DWORD cbBuffer, DWORD *pcbBuffer,
488 {
490  HRESULT hres;
491 
492  TRACE("(%s, %x, %x, %p, %x, %p, %x)\n", debugstr_w(pwzUrl),
493  QueryOption, dwQueryFlags, pvBuffer, cbBuffer, pcbBuffer, dwReserved);
494 
496 
497  if(protocol_info) {
498  hres = IInternetProtocolInfo_QueryInfo(protocol_info, pwzUrl, QueryOption, dwQueryFlags,
499  pvBuffer, cbBuffer, pcbBuffer, dwReserved);
500  IInternetProtocolInfo_Release(protocol_info);
501 
502  return SUCCEEDED(hres) ? hres : E_FAIL;
503  }
504 
505  switch(QueryOption) {
506  case QUERY_USES_NETWORK:
507  if(!pvBuffer || cbBuffer < sizeof(DWORD))
508  return E_FAIL;
509 
510  *(DWORD*)pvBuffer = 0;
511  if(pcbBuffer)
512  *pcbBuffer = sizeof(DWORD);
513  break;
514 
515  default:
516  FIXME("Not supported option %d\n", QueryOption);
517  return E_NOTIMPL;
518  }
519 
520  return S_OK;
521 }
522 
524 {
526 
529 
531 }
532 
534 {
535  const DWORD supported_flags = SET_FEATURE_ON_PROCESS;
536 
537  if(feature >= FEATURE_ENTRY_COUNT)
538  return E_FAIL;
539 
540  if(flags & ~supported_flags)
541  FIXME("Unsupported flags: %08x\n", flags & ~supported_flags);
542 
543  if(flags & SET_FEATURE_ON_PROCESS)
545 
546  return S_OK;
547 }
548 
550 {
551  DWORD type, value, size;
552  HKEY feature;
553  DWORD res;
554 
555  static const WCHAR wildcardW[] = {'*',0};
556 
557  res = RegOpenKeyW(feature_control, feature_name, &feature);
558  if(res != ERROR_SUCCESS)
559  return FALSE;
560 
561  size = sizeof(DWORD);
562  res = RegQueryValueExW(feature, process_name, NULL, &type, (BYTE*)&value, &size);
563  if(res != ERROR_SUCCESS || type != REG_DWORD) {
564  size = sizeof(DWORD);
566  }
567 
569  if(res != ERROR_SUCCESS)
570  return FALSE;
571 
572  if(type != REG_DWORD) {
573  WARN("Unexpected registry value type %d (expected REG_DWORD) for %s\n", type, debugstr_w(wildcardW));
574  return FALSE;
575  }
576 
577  *enabled = value == 1;
578  return TRUE;
579 }
580 
581 /* Assumes 'process_features_cs' is held. */
583 {
584  DWORD res;
587  LPCWSTR process_name, feature_name;
588  HRESULT hres = S_FALSE;
589  BOOL check_hklm = FALSE;
590  BOOL enabled;
591 
593  ERR("Failed to get module file name: %u\n", GetLastError());
594  return E_UNEXPECTED;
595  }
596 
597  process_name = wcsrchr(module_name, '\\');
598  if(!process_name) {
599  ERR("Invalid module file name: %s\n", debugstr_w(module_name));
600  return E_UNEXPECTED;
601  }
602 
603  /* Skip past the '\\' in front of the filename. */
604  ++process_name;
605 
607 
609  if(res == ERROR_SUCCESS) {
610  if(get_feature_from_reg(feature_control, feature_name, process_name, &enabled)) {
611  hres = enabled ? S_OK : S_FALSE;
613  } else
614  /* We didn't find anything in HKCU, so check HKLM. */
615  check_hklm = TRUE;
616 
618  }
619 
620  if(check_hklm) {
622  if(res == ERROR_SUCCESS) {
623  if(get_feature_from_reg(feature_control, feature_name, process_name, &enabled)) {
624  hres = enabled ? S_OK : S_FALSE;
626  }
628  }
629  }
630 
631  /* Don't bother checking the registry again for this feature. */
633 
634  return hres;
635 }
636 
638 {
639  HRESULT hres = S_OK;
640 
642 
643  /* Try loading the feature from the registry, if it hasn't already
644  * been done.
645  */
646  if(process_feature_controls[feature].check_registry)
648  if(SUCCEEDED(hres))
650 
652 
653  return hres;
654 }
655 
657 {
658  HRESULT hres;
659 
660  if(feature >= FEATURE_ENTRY_COUNT)
661  return E_FAIL;
662 
663  if(flags == GET_FEATURE_FROM_PROCESS)
665  else {
666  FIXME("Unsupported flags: %08x\n", flags);
667  hres = E_NOTIMPL;
668  }
669 
670  return hres;
671 }
672 
673 /***********************************************************************
674  * CoInternetSetFeatureEnabled (URLMON.@)
675  */
677 {
678  TRACE("(%d, %08x, %x)\n", FeatureEntry, dwFlags, fEnable);
679  return set_internet_feature(FeatureEntry, dwFlags, fEnable);
680 }
681 
682 /***********************************************************************
683  * CoInternetIsFeatureEnabled (URLMON.@)
684  */
686 {
687  TRACE("(%d, %08x)\n", FeatureEntry, dwFlags);
688  return get_internet_feature(FeatureEntry, dwFlags);
689 }
690 
691 /***********************************************************************
692  * CoInternetIsFeatureEnabledForUrl (URLMON.@)
693  */
695  IInternetSecurityManager *pSecMgr)
696 {
697  DWORD urlaction = 0;
698  HRESULT hres;
699 
700  TRACE("(%d %08x %s %p)\n", FeatureEntry, dwFlags, debugstr_w(szURL), pSecMgr);
701 
702  if(FeatureEntry == FEATURE_MIME_SNIFFING)
703  urlaction = URLACTION_FEATURE_MIME_SNIFFING;
704  else if(FeatureEntry == FEATURE_WINDOW_RESTRICTIONS)
705  urlaction = URLACTION_FEATURE_WINDOW_RESTRICTIONS;
706  else if(FeatureEntry == FEATURE_ZONE_ELEVATION)
707  urlaction = URLACTION_FEATURE_ZONE_ELEVATION;
708 
709  if(!szURL || !urlaction || !pSecMgr)
710  return CoInternetIsFeatureEnabled(FeatureEntry, dwFlags);
711 
712  switch(dwFlags) {
713  case GET_FEATURE_FROM_THREAD:
714  case GET_FEATURE_FROM_THREAD_LOCALMACHINE:
715  case GET_FEATURE_FROM_THREAD_INTRANET:
716  case GET_FEATURE_FROM_THREAD_TRUSTED:
717  case GET_FEATURE_FROM_THREAD_INTERNET:
718  case GET_FEATURE_FROM_THREAD_RESTRICTED:
719  FIXME("unsupported flags %x\n", dwFlags);
720  return E_NOTIMPL;
721 
722  case GET_FEATURE_FROM_PROCESS:
723  hres = CoInternetIsFeatureEnabled(FeatureEntry, dwFlags);
724  if(hres != S_OK)
725  return hres;
726  /* fall through */
727 
728  default: {
729  DWORD policy = URLPOLICY_DISALLOW;
730 
731  hres = IInternetSecurityManager_ProcessUrlAction(pSecMgr, szURL, urlaction,
732  (BYTE*)&policy, sizeof(DWORD), NULL, 0, PUAF_NOUI, 0);
733  if(hres!=S_OK || policy!=URLPOLICY_ALLOW)
734  return S_OK;
735  return S_FALSE;
736  }
737  }
738 }
739 
740 /***********************************************************************
741  * CoInternetIsFeatureZoneElevationEnabled (URLMON.@)
742  */
745 {
746  HRESULT hres;
747 
748  TRACE("(%s %s %p %x)\n", debugstr_w(szFromURL), debugstr_w(szToURL), pSecMgr, dwFlags);
749 
750  if(!pSecMgr || !szToURL)
752 
753  switch(dwFlags) {
754  case GET_FEATURE_FROM_THREAD:
755  case GET_FEATURE_FROM_THREAD_LOCALMACHINE:
756  case GET_FEATURE_FROM_THREAD_INTRANET:
757  case GET_FEATURE_FROM_THREAD_TRUSTED:
758  case GET_FEATURE_FROM_THREAD_INTERNET:
759  case GET_FEATURE_FROM_THREAD_RESTRICTED:
760  FIXME("unsupported flags %x\n", dwFlags);
761  return E_NOTIMPL;
762 
763  case GET_FEATURE_FROM_PROCESS:
765  if(hres != S_OK)
766  return hres;
767  /* fall through */
768 
769  default: {
770  DWORD policy = URLPOLICY_DISALLOW;
771 
772  hres = IInternetSecurityManager_ProcessUrlAction(pSecMgr, szToURL,
773  URLACTION_FEATURE_ZONE_ELEVATION, (BYTE*)&policy, sizeof(DWORD),
774  NULL, 0, PUAF_NOUI, 0);
775  if(FAILED(hres))
776  return S_OK;
777 
778  switch(policy) {
779  case URLPOLICY_ALLOW:
780  return S_FALSE;
781  case URLPOLICY_QUERY:
782  FIXME("Ask user dialog not implemented\n");
783  default:
784  return S_OK;
785  }
786  }
787  }
788 }
static PARSEACTION
Definition: misc.c:73
static const WCHAR feature_validate_navigate_urlW[]
Definition: internet.c:57
INTERNETFEATURELIST feature
Definition: misc.c:1719
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:609
static feature_control process_feature_controls[FEATURE_ENTRY_COUNT]
Definition: internet.c:118
HRESULT WINAPI PathCreateFromUrlW(LPCWSTR pszUrl, LPWSTR pszPath, LPDWORD pcchPath, DWORD dwReserved)
Definition: path.c:3334
static HRESULT get_internet_feature(INTERNETFEATURELIST feature, DWORD flags)
Definition: internet.c:656
#define TRUE
Definition: types.h:120
static HRESULT parse_security_domain(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:274
static const WCHAR feature_behaviorsW[]
Definition: internet.c:47
static const WCHAR feature_get_url_dom_filepath_unencodedW[]
Definition: internet.c:72
static const WCHAR feature_disable_legacy_compressionW[]
Definition: internet.c:82
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD_PTR
Definition: treelist.c:76
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HRESULT WINAPI CoInternetQueryInfo(LPCWSTR pwzUrl, QUERYOPTION QueryOption, DWORD dwQueryFlags, LPVOID pvBuffer, DWORD cbBuffer, DWORD *pcbBuffer, DWORD dwReserved)
Definition: internet.c:485
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
static IInternetProtocolInfo protocol_info
Definition: misc.c:947
static const WCHAR feature_disable_navigation_soundsW[]
Definition: internet.c:79
static const WCHAR feature_http_username_password_disableW[]
Definition: internet.c:65
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static const WCHAR feature_mime_handlingW[]
Definition: internet.c:39
#define WARN(fmt,...)
Definition: debug.h:111
static const WCHAR feature_securitybandW[]
Definition: internet.c:53
static HRESULT parse_security_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:202
static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:149
IInternetProtocolInfo * get_protocol_info(LPCWSTR url)
Definition: session.c:181
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HRESULT WINAPI CoInternetCombineUrl(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: internet.c:426
static HRESULT load_process_feature(INTERNETFEATURELIST feature)
Definition: internet.c:582
WINE_DEFAULT_DEBUG_CHANNEL(urlmon)
HRESULT WINAPI CoInternetParseUrl(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwFlags, LPWSTR pszResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
Definition: internet.c:392
static const WCHAR feature_disable_mk_protocolW[]
Definition: internet.c:49
static const WCHAR feature_weboc_popupmanagementW[]
Definition: internet.c:45
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define E_FAIL
Definition: ddrawi.h:102
LPCWSTR feature_name
Definition: internet.c:108
static const WCHAR feature_object_cachingW[]
Definition: internet.c:35
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
HRESULT WINAPI CoInternetIsFeatureEnabled(INTERNETFEATURELIST FeatureEntry, DWORD dwFlags)
Definition: internet.c:685
static DWORD
Definition: internet.c:33
HRESULT WINAPI UrlUnescapeW(LPWSTR pszUrl, LPWSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags)
Definition: url.c:1367
static const WCHAR feature_xmlhttpW[]
Definition: internet.c:88
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
static CRITICAL_SECTION process_features_cs
Definition: internet.c:98
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
#define S_FALSE
Definition: winerror.h:2357
BOOL check_registry
Definition: internet.c:110
smooth NULL
Definition: ftsmooth.c:416
static CRITICAL_SECTION_DEBUG process_features_cs_dbg
Definition: internet.c:99
static QUERYOPTION
Definition: misc.c:74
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(_In_z_ const wchar_t *_Str, _In_ wchar_t _Ch)
HRESULT WINAPI UrlGetPartW(LPCWSTR pszIn, LPWSTR pszOut, LPDWORD pcchOut, DWORD dwPart, DWORD dwFlags)
Definition: url.c:2269
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
#define MAX_PATH
Definition: compat.h:26
#define WINAPI
Definition: msvc.h:6
HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized, LPDWORD pcchCanonicalized, DWORD dwFlags)
Definition: url.c:282
unsigned long DWORD
Definition: ntddk_ex.h:95
INT WINAPI UrlCompareW(LPCWSTR pszUrl1, LPCWSTR pszUrl2, BOOL fIgnoreSlash)
Definition: url.c:1537
HRESULT WINAPI CoInternetIsFeatureEnabledForUrl(INTERNETFEATURELIST FeatureEntry, DWORD dwFlags, LPCWSTR szURL, IInternetSecurityManager *pSecMgr)
Definition: internet.c:694
static HRESULT parse_encode(LPCWSTR url, PARSEACTION action, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:221
static const WCHAR feature_protocol_lockdownW[]
Definition: internet.c:63
GLbitfield flags
Definition: glext.h:7161
static void set_feature_on_process(INTERNETFEATURELIST feature, BOOL enable)
Definition: internet.c:523
static const WCHAR feature_tabbed_browsingW[]
Definition: internet.c:75
HRESULT WINAPI ParseURLW(LPCWSTR x, PARSEDURLW *y)
Definition: url.c:197
static const WCHAR feature_ssluxW[]
Definition: internet.c:77
struct feature_control feature_control
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
static HRESULT set_internet_feature(INTERNETFEATURELIST feature, DWORD flags, BOOL enable)
Definition: internet.c:533
unsigned char BYTE
Definition: mem.h:68
static const WCHAR feature_block_input_promptsW[]
Definition: internet.c:95
LIST_ENTRY ProcessLocksList
Definition: winbase.h:855
static const WCHAR feature_control_keyW[]
Definition: internet.c:28
GLsizei const GLfloat * value
Definition: glext.h:6069
HRESULT WINAPI CoInternetSetFeatureEnabled(INTERNETFEATURELIST FeatureEntry, DWORD dwFlags, BOOL fEnable)
Definition: internet.c:676
HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, LPWSTR pszCombined, LPDWORD pcchCombined, DWORD dwFlags)
Definition: url.c:662
static const WCHAR feature_zone_elevationW[]
Definition: internet.c:37
#define ERR(fmt,...)
Definition: debug.h:109
static HRESULT parse_domain(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:295
#define S_OK
Definition: intsafe.h:59
GLboolean enable
Definition: glext.h:11120
static const WCHAR feature_mime_sniffingW[]
Definition: internet.c:41
const WCHAR * action
Definition: action.c:7783
#define ARRAY_SIZE(a)
Definition: main.h:24
static const WCHAR feature_restrict_activexinstallW[]
Definition: internet.c:55
static const WCHAR feature_addon_managementW[]
Definition: internet.c:61
#define E_NOTIMPL
Definition: ddrawi.h:99
static const WCHAR feature_window_restrictionsW[]
Definition: internet.c:43
static const WCHAR feature_safe_bindtoobjectW[]
Definition: internet.c:68
#define E_UNEXPECTED
Definition: winerror.h:2456
static HRESULT parse_path_from_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:248
Definition: icif.c:77
GLuint res
Definition: glext.h:9613
static const WCHAR feature_unc_savedfilecheckW[]
Definition: internet.c:70
static HRESULT parse_rootdocument(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:325
static const WCHAR feature_restrict_filedownloadW[]
Definition: internet.c:59
static HRESULT parse_canonicalize_url(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize)
Definition: internet.c:176
static const WCHAR wildcardW[]
Definition: actctx.c:709
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static const WCHAR feature_localmachine_lockdownW[]
Definition: internet.c:51
static HRESULT get_feature_from_process(INTERNETFEATURELIST feature)
Definition: internet.c:637
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const WCHAR feature_disable_telnet_protocolW[]
Definition: internet.c:90
#define E_POINTER
Definition: winerror.h:2365
static const WCHAR feature_force_addr_and_statusW[]
Definition: internet.c:85
GLuint64EXT * result
Definition: glext.h:11304
#define REG_DWORD
Definition: sdbapi.c:596
HRESULT WINAPI CoInternetIsFeatureZoneElevationEnabled(LPCWSTR szFromURL, LPCWSTR szToURL, IInternetSecurityManager *pSecMgr, DWORD dwFlags)
Definition: internet.c:743
static const WCHAR feature_feedsW[]
Definition: internet.c:93
HRESULT WINAPI CoInternetCompareUrl(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
Definition: internet.c:460
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
static BOOL get_feature_from_reg(HKEY feature_control, LPCWSTR feature_name, LPCWSTR process_name, BOOL *enabled)
Definition: internet.c:549