Ejemplo n.º 1
0
 static WebBrowser()
 {
     if (WebBrowser.IsWebOCPermissionRestricted)
     {
         if (BrowserInteropHelper.IsBrowserHosted)
         {
             if ((BrowserInteropHelper.HostingFlags & HostingFlags.hfHostedInIEorWebOC) == (HostingFlags)0)
             {
                 int num = AppSecurityManager.MapUrlToZone(BrowserInteropHelper.Source);
                 if (num != 1 && num != 2 && num != 0 && !RegistryKeys.ReadLocalMachineBool("Software\\Microsoft\\.NETFramework\\Windows Presentation Foundation\\Hosting", "UnblockWebBrowserControl"))
                 {
                     throw new SecurityException(SR.Get("AffectedByMsCtfIssue", new object[]
                     {
                         "http://go.microsoft.com/fwlink/?LinkID=168882"
                     }));
                 }
             }
         }
         else
         {
             string fileName = Path.GetFileName(UnsafeNativeMethods.GetModuleFileName(default(HandleRef)));
             if (string.Compare(fileName, "AppLaunch.exe", StringComparison.OrdinalIgnoreCase) == 0)
             {
                 SecurityHelper.DemandWebBrowserPermission();
             }
         }
         WebBrowser.RegisterWithRBW();
     }
     WebBrowser.TurnOnFeatureControlKeys();
     ControlsTraceLogger.AddControl(TelemetryControls.WebBrowser);
 }