summaryrefslogtreecommitdiff
path: root/default/default.c
diff options
context:
space:
mode:
Diffstat (limited to 'default/default.c')
-rw-r--r--default/default.c31
1 files changed, 31 insertions, 0 deletions
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