diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/misc.c | 16 | ||||
| -rw-r--r-- | src/update.c | 2 |
2 files changed, 13 insertions, 5 deletions
@@ -419,12 +419,9 @@ int register_extension() #if defined WIN32 LONG rresult; HKEY newkey; - char currentfilename[MAX_PATH] = ""; + char *currentfilename = exe_name(); char *iconname; char *opencommand; - 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,-102", currentfilename); @@ -442,6 +439,17 @@ int register_extension() } RegCloseKey(newkey); + rresult = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Classes\\.stm", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &newkey, NULL); + if (rresult != ERROR_SUCCESS) { + return 0; + } + rresult = RegSetValueEx(newkey, 0, 0, REG_SZ, (LPBYTE)"PowderToySave", strlen("PowderToySave")+1); + if (rresult != ERROR_SUCCESS) { + RegCloseKey(newkey); + return 0; + } + RegCloseKey(newkey); + //Create program entry rresult = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Classes\\PowderToySave", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &newkey, NULL); if (rresult != ERROR_SUCCESS) { diff --git a/src/update.c b/src/update.c index 46712d7..e2c6faf 100644 --- a/src/update.c +++ b/src/update.c @@ -39,7 +39,7 @@ #include <update.h> -static char *exe_name(void) +char *exe_name(void) { #if defined WIN32 char *name= (char *)malloc(64), max=64, res; |
