Also register .stm extension in Windows
This commit is contained in:
parent
29e41a0a0c
commit
4aeac8b316
@ -20,7 +20,7 @@
|
|||||||
#ifndef UPDATE_H
|
#ifndef UPDATE_H
|
||||||
#define UPDATE_H
|
#define UPDATE_H
|
||||||
|
|
||||||
static char *exe_name(void);
|
char *exe_name(void);
|
||||||
int update_start(char *data, int len);
|
int update_start(char *data, int len);
|
||||||
int update_finish(void);
|
int update_finish(void);
|
||||||
void update_cleanup(void);
|
void update_cleanup(void);
|
||||||
|
16
src/misc.c
16
src/misc.c
@ -419,12 +419,9 @@ int register_extension()
|
|||||||
#if defined WIN32
|
#if defined WIN32
|
||||||
LONG rresult;
|
LONG rresult;
|
||||||
HKEY newkey;
|
HKEY newkey;
|
||||||
char currentfilename[MAX_PATH] = "";
|
char *currentfilename = exe_name();
|
||||||
char *iconname;
|
char *iconname;
|
||||||
char *opencommand;
|
char *opencommand;
|
||||||
if (!GetModuleFileName(NULL, currentfilename, MAX_PATH))
|
|
||||||
return 0;
|
|
||||||
currentfilename[MAX_PATH-1] = 0;
|
|
||||||
iconname = malloc(strlen(currentfilename)+6);
|
iconname = malloc(strlen(currentfilename)+6);
|
||||||
opencommand = malloc(strlen(currentfilename)+13);
|
opencommand = malloc(strlen(currentfilename)+13);
|
||||||
sprintf(iconname, "%s,-102", currentfilename);
|
sprintf(iconname, "%s,-102", currentfilename);
|
||||||
@ -442,6 +439,17 @@ int register_extension()
|
|||||||
}
|
}
|
||||||
RegCloseKey(newkey);
|
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
|
//Create program entry
|
||||||
rresult = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Classes\\PowderToySave", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &newkey, NULL);
|
rresult = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Classes\\PowderToySave", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &newkey, NULL);
|
||||||
if (rresult != ERROR_SUCCESS) {
|
if (rresult != ERROR_SUCCESS) {
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include <update.h>
|
#include <update.h>
|
||||||
|
|
||||||
static char *exe_name(void)
|
char *exe_name(void)
|
||||||
{
|
{
|
||||||
#if defined WIN32
|
#if defined WIN32
|
||||||
char *name= (char *)malloc(64), max=64, res;
|
char *name= (char *)malloc(64), max=64, res;
|
||||||
|
Reference in New Issue
Block a user