winreg-rs icon indicating copy to clipboard operation
winreg-rs copied to clipboard

Don't set the internet Settings correctly

Open irocn opened this issue 2 years ago • 2 comments

Hello,

I want to set windows proxy as "socks=127.0.0.1" and port 1080, but it will be "http://socks=127.0.0.1". How to fix it?

    let (key, _) = RegKey::predef(HKEY_CURRENT_USER).create_subkey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")?;
    if isOpen{
        key.set_value("ProxyEnable", &1u32)?;
        key.set_value("ProxyServer", &format!("{}:{}", "socks=127.0.0.1", 1080))?;
        key.set_value("ProxyOverride", &"<local>")?;
    }else{
        key.set_value("ProxyEnable", &0u32)?;
    }

irocn avatar Feb 24 '23 12:02 irocn

I don't understand the question. Your code does exactly what it should and sets the proxy settings like this: изображение

"http://socks=127.0.0.1/"

is this what appears in the address string of the browser?

gentoo90 avatar Feb 25 '23 18:02 gentoo90

yes, but in the socks address box is "http://socks=127.0.0.1", the prefix "http://" will be added auto. my os is windows 11.

btw, "http://socks=127.0.0.1" don't work, "socks=127.0.0.1" work well.

irocn avatar Feb 26 '23 02:02 irocn