То, что вводит реестр окон, отключает параметр соединения IE, “Автоматически Обнаруживают Настройки”?

Иронически там программируют конструкции, которые используют точно, что Вы описываете.

, Например, SQL Server Integration Services, которые включают поток логики кодирования путем перетаскивания компонентов на поверхность визуального проектирования, сохраняется как XML-файлы, описывающие точно тот бэкэнд.

, С другой стороны, SSIS является довольно трудным к управлению исходным кодом. Также довольно трудно разработать любой вид сложной логики в него: при необходимости в немного большем количестве "управления" необходимо будет кодировать код VB.NET в компонент, который приносит нам назад туда, где мы запустили.

я предполагаю, что, как кодер, необходимо рассмотреть то, что для каждого решения проблемы существуют последствия, которые следуют. Не все могло (и некоторые спорят, должен) быть представленным в UML. Не все могло быть визуально представлено. Не все могло быть упрощено достаточно для имения последовательного представления двоичного файла.

Однако я установил бы это недостатки понижения кода к двоичным форматам (большинство которых будет также иметь тенденцию быть собственным) далеко перевешивают преимущества наличия их в простом тексте.

24
задан leo 4 November 2009 в 14:33
поделиться

2 ответа

Я нашел решение: это 9-й байт этого ключа:

[HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings \ Connections] "DefaultConnectionSettings"=hex:3c,00,00,00,1f,00,00,00,05,00,00,00,00,00,00, 00,00,00,00,00,00,00,00,00,01,00,00,00,1f,00,00,00,68,74,74,70,3a,2f,2f,31, 34,34,2e,31,33,31,2e,32,32,32,2e,31,36,37,2f,77,70,61,64,2e,64,61,74,90,0e, 1e,66,d3,88,c5,01,01,00,00,00,8d,a8,4e,9e,00,00,00,00,00,00,00,00

It's a bitfield:

  • 0x1: (Always 1)
  • 0x2: Proxy enabled
  • 0x4: "Use automatic configuration script" checked
  • 0x8: "Automatically detect settings" checked

Mask 0x8 to turn it off, i.e., subtract 8 if it's higher than 8.

Thanks to Jamie on google groups.

Update

Based on the VBScript by WhoIsRich combined with details in this answer, here's a PowerShell script to amend these & related settings:

function Set-ProxySettings {
    [CmdletBinding()]
    param ( #could improve with parameter sets 
        [Parameter(Mandatory = $false)]
        [bool]$AutomaticDetect = $true
        ,
        [Parameter(Mandatory = $false)]
        [bool]$UseProxyForLAN = $false
        ,
        [Parameter(Mandatory = $false)]
        [AllowNull()][AllowEmptyString()]
        [string]$ProxyAddress = $null
        ,
        [Parameter(Mandatory = $false)]
        [int]$ProxyPort = 8080 #closest we have to a default port for proxies
        ,
        [AllowNull()][AllowEmptyString()]
        [bool]$UseAutomaticConfigurationScript = $false
    )
    begin {
        [string]$ProxyRegRoot = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'
        [string]$DefaultConnectionSettingsPath = (Join-Path $ProxyRegRoot 'Connections')
        [byte]$MaskProxyEnabled = 2
        [byte]$MaskUseAutomaticConfigurationScript = 4
        [byte]$MaskAutomaticDetect = 8
        [int]$ProxyConnectionSettingIndex = 8
    }
    process {
    #this setting is affected by multiple options, so fetch once here 
    [byte[]]$DefaultConnectionSettings = Get-ItemProperty -Path $DefaultConnectionSettingsPath -Name 'DefaultConnectionSettings' | Select-Object -ExpandProperty 'DefaultConnectionSettings'

    #region auto detect
    if($AutomaticDetect) { 
        Set-ItemProperty -Path $ProxyRegRoot -Name AutoDetect -Value 1
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskAutomaticDetect
    } else {
        Set-ItemProperty -Path $ProxyRegRoot -Name AutoDetect -Value 0
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskAutomaticDetect)
    }
    #endregion

    #region defined proxy
    if($UseProxyForLAN) {
        if(-not ([string]::IsNullOrWhiteSpace($ProxyAddress))) {
            Set-ItemProperty -Path $ProxyRegRoot -Name ProxyServer -Value ("{0}:{1}" -f $ProxyAddress,$ProxyPort)
        }
        Set-ItemProperty -Path $ProxyRegRoot -Name ProxyEnable -Value 1
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskProxyEnabled
    } else {
        Set-ItemProperty -Path $ProxyRegRoot -Name ProxyEnable -Value 0        
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskProxyEnabled)
    }
    #endregion

    #region config script
    if($UseAutomaticConfigurationScript){
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -bor $MaskUseAutomaticConfigurationScript
    }else{
        $DefaultConnectionSettings[$ProxyConnectionSettingIndex] = $DefaultConnectionSettings[$ProxyConnectionSettingIndex] -band (-bnot $MaskUseAutomaticConfigurationScript) 
    }
    #endregion

    #persist the updates made above
    Set-ItemProperty -Path $DefaultConnectionSettingsPath -Name 'DefaultConnectionSettings' -Value $DefaultConnectionSettings
    }
}
43
ответ дан 28 November 2019 в 22:47
поделиться

You can always just export the registry, change the setting, then export the registry again and do a diff.

0
ответ дан 28 November 2019 в 22:47
поделиться
Другие вопросы по тегам:

Похожие вопросы: