summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
authorjacksonmj <mj-pt@jacksonmj.co.uk>2011-03-27 17:13:52 (GMT)
committer Simon <simon@hardwired.org.uk>2011-04-04 15:10:03 (GMT)
commit592b923b6610bf5f90812a8f514abb8ce4f677d1 (patch)
tree059e5360acf98cc7cdcdd43f4918e6216ad8259c /src/misc.c
parent651208c5fbba5d0703e174a6abe2c8a228730803 (diff)
downloadpowder-592b923b6610bf5f90812a8f514abb8ce4f677d1.zip
powder-592b923b6610bf5f90812a8f514abb8ce4f677d1.tar.gz
Finish WIN32 register_extension, fix Visual Studio compile
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/misc.c b/src/misc.c
index ee09788..4ebd8ad 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -16,6 +16,9 @@
#include "interface.h"
#include "graphics.h"
#include "powder.h"
+#if defined WIN32
+#include <windows.h>
+#endif
//Signum function
#if defined(WIN32) && !defined(__GNUC__)
@@ -403,16 +406,17 @@ int register_extension()
{
#if defined INSTALLABLE
#if defined WIN32
-
LONG rresult;
HKEY newkey;
- char *currentfilename;
+ char currentfilename[MAX_PATH] = "";
char *iconname;
char *opencommand;
- currentfilename = exe_name();
- iconname = malloc(strlen(currentfilename)+3);
+ if (!GetModuleFileName(NULL, currentfilename, MAX_PATH))
+ return 0;
+ currentfilename[MAX_PATH-1] = 0;
+ iconname = malloc(strlen(currentfilename)+6);
opencommand = malloc(strlen(currentfilename)+13);
- sprintf(iconname, "%s,1", currentfilename);
+ sprintf(iconname, "%s,-101", currentfilename);
sprintf(opencommand, "\"%s\" open:\"%%1\"", currentfilename);
//Create extension entry