summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-11-20 15:17:47 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-20 15:17:47 +0100
commit86c50f77bdf53599d3f8835001e2110347cd3662 (patch)
treeefa93080e4b56bfc69a6978e40b698915fa2e0ee
parent0df815469658a0df4218f131041a9037991db388 (diff)
downloadwindows-86c50f77bdf53599d3f8835001e2110347cd3662.tar.gz
Add 'toggleproxy' programHEADmaster
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).
-rw-r--r--toggleproxy/toggleproxy.c24
-rw-r--r--toggleproxy/toggleproxy.exebin0 -> 53760 bytes
2 files changed, 24 insertions, 0 deletions
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 <stdio.h>
+#include <windows.h>
+#include <wininet.h>
+
+#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
--- /dev/null
+++ b/toggleproxy/toggleproxy.exe
Binary files differ