-rw-r--r-- | install/install.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/install/install.cpp b/install/install.cpp index aa474d5..bbc2b3b 100644 --- a/install/install.cpp +++ b/install/install.cpp | |||
@@ -1,65 +1,73 @@ | |||
1 | #include "resource.h" | 1 | #include "resource.h" |
2 | #include "../shared-code/install.h" | 2 | #include "../shared-code/install.h" |
3 | 3 | ||
4 | #define KINAME"KINSole 1.1" | 4 | #define VERSION "1.1.1" |
5 | #define KINAME"KINSole " VERSION | ||
5 | #define SKINAME"KINSole" | 6 | #define SKINAME"KINSole" |
6 | 7 | ||
7 | BOOL Install(void) | 8 | BOOL Install(void) |
8 | { | 9 | { |
9 | STRING tPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group",SKINAME "Path"); | 10 | STRING tPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group",SKINAME "Path"); |
10 | STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath"); | 11 | STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath"); |
11 | LPCSTR qPath = ((LPCSTR)tPath)?(LPCSTR)tPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings"); | 12 | LPCSTR qPath = ((LPCSTR)tPath)?(LPCSTR)tPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings"); |
12 | STRING path = REQUESTPATH(" " KINAME,"Note: KINSole program file will be installed into your windows directory so that you can rely on it's presence in your search path\nEnter destination path:",qPath); | 13 | STRING path = REQUESTPATH(" " KINAME,"Note: KINSole program file will be installed into your windows directory so that you can rely on it's presence in your search path\nEnter destination path:",qPath); |
13 | if(!path) | 14 | if(!path) |
14 | return NULL; | 15 | return NULL; |
15 | STRING winDir(_MAX_PATH); | 16 | STRING winDir(_MAX_PATH); |
16 | 17 | ||
17 | GetWindowsDirectory(winDir,_MAX_PATH); | 18 | GetWindowsDirectory(winDir,_MAX_PATH); |
18 | INSTALLFILE("KINSole.ex_",winDir,"KINSole.exe"); | 19 | INSTALLFILE("KINSole.ex_",winDir,"KINSole.exe"); |
19 | MAKE_PATH(path); | 20 | MAKE_PATH(path); |
20 | STRING shortPath = GET_SHORT_PATH(path); | 21 | STRING shortPath = GET_SHORT_PATH(path); |
21 | if(!shortPath){ | 22 | if(!shortPath){ |
22 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); | 23 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); |
23 | return FALSE; | 24 | return FALSE; |
24 | } | 25 | } |
25 | if(!( | 26 | if(!( |
26 | INSTALLFILE("KINSole.hl_",path,"KINSole.hlp") && | 27 | INSTALLFILE("KINSole.hl_",path,"KINSole.hlp") && |
27 | INSTALLFILE("KINSole.cn_",path,"KINSole.cnt") | 28 | INSTALLFILE("KINSole.cn_",path,"KINSole.cnt") |
28 | )){ | 29 | )){ |
29 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); | 30 | MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); |
30 | return FALSE; | 31 | return FALSE; |
31 | } | 32 | } |
32 | ADDMENU("Klever Group","KINSole Help",path,SKINAME ".hlp"); | 33 | ADDMENU("Klever Group","KINSole Help",path,SKINAME ".hlp"); |
33 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group", SKINAME "Path",path); | 34 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group", SKINAME "Path",path); |
34 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath",path); | 35 | strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group","KINPath",path); |
35 | FILE* inf=CREATE_INF_FILE(path, SKINAME ".INF"); | 36 | FILE* inf=CREATE_INF_FILE(path, SKINAME ".INF"); |
36 | if(!inf){ | 37 | if(!inf){ |
37 | MessageBox(NULL,"Failed to install " KINAME,NULL,MB_ICONERROR|MB_OK); | 38 | MessageBox(NULL,"Failed to install " KINAME,NULL,MB_ICONERROR|MB_OK); |
38 | return FALSE; | 39 | return FALSE; |
39 | } | 40 | } |
40 | INF_FILE_HEADER(inf); | 41 | INF_FILE_HEADER(inf); |
41 | INF_FILE_SECTION(inf,"Uninstall"); | 42 | INF_FILE_SECTION(inf,"Uninstall"); |
42 | fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n"); | 43 | fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n"); |
43 | 44 | ||
44 | INF_FILE_SECTION(inf,"kFiles"); | 45 | INF_FILE_SECTION(inf,"kFiles"); |
45 | INF_REMOVE_ROOT(inf,SKINAME "Files",shortPath); | 46 | INF_REMOVE_ROOT(inf,SKINAME "Files",shortPath); |
46 | INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME); | 47 | INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME); |
47 | INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf"); | 48 | INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf"); |
48 | 49 | ||
49 | INF_REMOVE_ROOT(inf,SKINAME "WFiles",winDir); | 50 | INF_REMOVE_ROOT(inf,SKINAME "WFiles",winDir); |
50 | INF_REMOVE_FILE(inf,SKINAME "WFiles",SKINAME ".exe"); | 51 | INF_REMOVE_FILE(inf,SKINAME "WFiles",SKINAME ".exe"); |
51 | 52 | ||
52 | INF_FILE_SECTION(inf,"kReg"); | 53 | INF_FILE_SECTION(inf,"kReg"); |
53 | INF_UNINSTALL_REG(inf,SKINAME); | 54 | INF_UNINSTALL_REG(inf,SKINAME); |
54 | 55 | ||
55 | INF_FILE_SECTION(inf,"kMenu"); | 56 | INF_FILE_SECTION(inf,"kMenu"); |
56 | INF_MENU_GROUP(inf,1,"Klever Group"); | 57 | INF_MENU_GROUP(inf,1,"Klever Group"); |
57 | INF_MENU_ITEM(inf,1,"KINSole Help"); | 58 | INF_MENU_ITEM(inf,1,"KINSole Help"); |
58 | fclose(inf); | 59 | fclose(inf); |
59 | 60 | ||
60 | REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall"); | 61 | REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall"); |
62 | REG_UNINSTALL_ICON(SKINAME,path,SKINAME ".exe",0); | ||
63 | REG_UNINSTALL_COMMENT(SKINAME,"Klever " KINAME); | ||
64 | REG_UNINSTALL_VERSION(SKINAME,VERSION); | ||
65 | REG_UNINSTALL_LOCATION(SKINAME,path); | ||
66 | REG_UNINSTALL_PUBLISHER(SKINAME,"Klever Group"); | ||
67 | REG_UNINSTALL_URLS(SKINAME,"http://www.klever.net/","http://kin.klever.net/kinsole/"); | ||
68 | |||
61 | 69 | ||
62 | MessageBox(NULL,KINAME " installed successfully, you may now run it from command line, read documentation in 'Programs/Klever Group' menu or simply remove it using Control Panel Add/Remove Programs applet."," Rejoice!",MB_ICONINFORMATION|MB_OK); | 70 | MessageBox(NULL,KINAME " installed successfully, you may now run it from command line, read documentation in 'Programs/Klever Group' menu or simply remove it using Control Panel Add/Remove Programs applet."," Rejoice!",MB_ICONINFORMATION|MB_OK); |
63 | 71 | ||
64 | return TRUE; | 72 | return TRUE; |
65 | } | 73 | } |