From 86c50f77bdf53599d3f8835001e2110347cd3662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 20 Nov 2020 15:17:47 +0100 Subject: Add 'toggleproxy' program toggleproxy is used to enable/disable the current proxy in Internet Options. This affects Internet Explorer and Google Chrome (until they start using their own proxy settings, like Mozilla Firefox). --- toggleproxy/toggleproxy.c | 24 ++++++++++++++++++++++++ toggleproxy/toggleproxy.exe | Bin 0 -> 53760 bytes 2 files changed, 24 insertions(+) create mode 100644 toggleproxy/toggleproxy.c create mode 100644 toggleproxy/toggleproxy.exe (limited to 'toggleproxy') diff --git a/toggleproxy/toggleproxy.c b/toggleproxy/toggleproxy.c new file mode 100644 index 0000000..cf44226 --- /dev/null +++ b/toggleproxy/toggleproxy.c @@ -0,0 +1,24 @@ +#include +#include +#include + +#pragma comment(lib, "Wininet.lib") + +int main(int argc, char *argv[]) { + int r; + + if (argc != 2) { + fprintf(stderr, "usage: %s {1|0}\n", argv[0]); + return 1; + } + + if (argv[1][0] == '0') + r = system("reg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable /t REG_DWORD /d 0 /f"); + else + r = system("reg add \"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\" /v ProxyEnable /t REG_DWORD /d 1 /f"); + if (r == 0) { + InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0); + InternetSetOption(NULL, INTERNET_OPTION_REFRESH, NULL, 0); + } + return r; +} \ No newline at end of file diff --git a/toggleproxy/toggleproxy.exe b/toggleproxy/toggleproxy.exe new file mode 100644 index 0000000..2f0e2d4 Binary files /dev/null and b/toggleproxy/toggleproxy.exe differ -- cgit v1.2.3