summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-11-03 13:28:05 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-11-20 15:17:34 +0100
commit0df815469658a0df4218f131041a9037991db388 (patch)
tree239aae9866f9273d703e41ee95104df316ecea5e
downloadwindows-0df815469658a0df4218f131041a9037991db388.tar.gz
Add 'default' tool
The default program can be used to quickly set the default browser, at least on Windows XP.
-rw-r--r--.gitignore1
-rw-r--r--default/default.c31
-rw-r--r--default/default.exebin0 -> 54272 bytes
-rw-r--r--default/reg/chrome.regbin0 -> 6910 bytes
-rw-r--r--default/reg/mypal.regbin0 -> 4768 bytes
5 files changed, 32 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..281748d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.obj \ No newline at end of file
diff --git a/default/default.c b/default/default.c
new file mode 100644
index 0000000..5b75c6e
--- /dev/null
+++ b/default/default.c
@@ -0,0 +1,31 @@
+#include <shlobj.h>
+#include <stdio.h>
+#include <windows.h>
+
+#pragma comment(lib, "Shell32.lib")
+
+int main(int argc, char *argv[]) {
+ char cmd[500], path[500], *p;
+ int r;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s browser\n", argv[0]);
+ return 1;
+ }
+
+ r = GetModuleFileNameA(NULL, path, 500);
+ if (r == 0 || r == 500) {
+ fprintf(stderr, "Could not get path of executable (%d).\n", GetLastError());
+ return 1;
+ }
+
+ p = path + strlen(path) - 1;
+ while (*p != '\\') p--;
+ *p = '\0';
+
+ sprintf(cmd, "reg import \"%s\\reg\\%s.reg\"", path, argv[1]);
+ r = system(cmd);
+ if (r == 0)
+ SHChangeNotify(SHCNE_ASSOCCHANGED, 0, 0, 0);
+ return r;
+} \ No newline at end of file
diff --git a/default/default.exe b/default/default.exe
new file mode 100644
index 0000000..79040dd
--- /dev/null
+++ b/default/default.exe
Binary files differ
diff --git a/default/reg/chrome.reg b/default/reg/chrome.reg
new file mode 100644
index 0000000..8c00c8b
--- /dev/null
+++ b/default/reg/chrome.reg
Binary files differ
diff --git a/default/reg/mypal.reg b/default/reg/mypal.reg
new file mode 100644
index 0000000..bcafc08
--- /dev/null
+++ b/default/reg/mypal.reg
Binary files differ