annotate src/uninstal.c @ 505:7e6d264ec0a2 v7.0141

updated for version 7.0141
author vimboss
date Mon, 05 Sep 2005 22:14:46 +0000
parents 3fc0f57ecb91
children 120502692d82
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * uninstal.c: Minimalistic uninstall program for Vim on MS-Windows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * Removes:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 * - the "Edit with Vim" popup menu entry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 * - the Vim "Open With..." popup menu entry
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 * - any Vim Batch files in the path
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 * - icons for Vim on the Desktop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 * - the Vim entry in the Start Menu
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 /* Include common code for dosinst.c and uninstal.c. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 #include "dosinst.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 * Return TRUE if the user types a 'y' or 'Y', FALSE otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 confirm(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 char answer[10];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 fflush(stdout);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 * Check if the popup menu entry exists and what gvim it refers to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 * Returns non-zero when it's found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 popup_gvim_path(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 HKEY key_handle;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 DWORD value_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 DWORD bufsize = BUFSIZE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 int r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 /* Open the key where the path to gvim.exe is stored. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, KEY_READ,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 &key_handle) != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 /* get the DisplayName out of it to show the user */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 r = RegQueryValueEx(key_handle, "path", 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 &value_type, (LPBYTE)buf, &bufsize);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 RegCloseKey(key_handle);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 return (r == ERROR_SUCCESS);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 * Check if the "Open With..." menu entry exists and what gvim it refers to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 * Returns non-zero when it's found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 openwith_gvim_path(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 HKEY key_handle;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 DWORD value_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 DWORD bufsize = BUFSIZE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 int r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 /* Open the key where the path to gvim.exe is stored. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 "Applications\\gvim.exe\\shell\\edit\\command", 0, KEY_READ,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 &key_handle) != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 /* get the DisplayName out of it to show the user */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf, &bufsize);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 RegCloseKey(key_handle);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 return (r == ERROR_SUCCESS);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 remove_popup(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 int fail = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 HKEY kh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 if (RegDeleteKey(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 if (RegDeleteKey(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\shellex\\ContextMenuHandlers\\gvim") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0, KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 RegCloseKey(kh);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 if (RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 if (RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Vim") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 if (fail == 6)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 printf("No Vim popup registry entries could be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 else if (fail > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 printf("Some Vim popup registry entries could not be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 printf("The Vim popup registry entries have been removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 remove_openwith(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 int fail = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 if (RegDeleteKey(HKEY_CLASSES_ROOT, "Applications\\gvim.exe") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 if (RegDeleteKey(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 if (RegDeleteKey(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 if (fail == 7)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 printf("No Vim open-with registry entries could be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 else if (fail > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 printf("Some Vim open-with registry entries could not be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 printf("The Vim open-with registry entries have been removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 * Check if a batch file is really for the current version. Don't delete a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 * batch file that was written for another (possibly newer) version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 batfile_thisversion(char *path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 char line[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 int ver_len = strlen(VIM_VERSION_NODOT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 int found = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 fd = fopen(path, "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 while (fgets(line, BUFSIZE, fd) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 for (p = line; *p != 0; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 /* don't accept "vim60an" when looking for "vim60". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 && !isdigit(p[ver_len])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 && !isalpha(p[ver_len]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 found = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 if (found)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 return found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 remove_batfiles(int doit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 char *batfile_path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 int found = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 for (i = 1; i < TARGET_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 batfile_path = searchpath_save(targets[i].batname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 if (batfile_path != NULL && batfile_thisversion(batfile_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 ++found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 if (doit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 printf("removing %s\n", batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 remove(batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 printf(" - the batch file %s\n", batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 free(batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 return found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 remove_if_exists(char *path, char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 char buf[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 sprintf(buf, "%s\\%s", path, filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 fd = fopen(buf, "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 printf("removing %s\n", buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 remove(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 remove_icons(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 if (get_shell_folder_path(path, "desktop"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 for (i = 0; i < ICON_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 remove_if_exists(path, icon_link_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 remove_start_menu(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 struct stat st;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 if (get_shell_folder_path(path, VIM_STARTMENU))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 for (i = 1; i < TARGET_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 remove_if_exists(path, targets[i].lnkname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 remove_if_exists(path, "uninstall.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 remove_if_exists(path, "Help.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 /* Win95 uses .pif, WinNT uses .lnk */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 remove_if_exists(path, "Vim tutor.pif");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 remove_if_exists(path, "Vim tutor.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 remove_if_exists(path, "Vim online.url");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 if (stat(path, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 printf("removing %s\n", path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 rmdir(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 #if 0 /* currently not used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 * Return TRUE when we're on Windows 95/98/ME.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 win95(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 static int done = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 static DWORD PlatformId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 if (!done)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 OSVERSIONINFO ovi;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 ovi.dwOSVersionInfoSize = sizeof(ovi);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 GetVersionEx(&ovi);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 PlatformId = ovi.dwPlatformId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 done = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 /* Win NT/2000/XP is VER_PLATFORM_WIN32_NT */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 return PlatformId == VER_PLATFORM_WIN32_WINDOWS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 delete_uninstall_key(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 RegDeleteKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 char buf[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 * On DJGPP we delete registry entries by creating a .inf file and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 * installing it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 fd = fopen("vim.inf", "w");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 fprintf(fd, "[version]\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 fprintf(fd, "signature=\"$CHICAGO$\"\n\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 fprintf(fd, "[DefaultInstall]\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 fprintf(fd, "DelReg=DeleteMe\n\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 fprintf(fd, "[DeleteMe]\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 fprintf(fd, "HKLM,\"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT "\"\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 /* Don't know how to detect Win NT with DJGPP. Hack: Just try the Win
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 * 95/98/ME method, since the DJGPP version can't use long filenames
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 * on Win NT anyway. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 sprintf(buf, "rundll setupx.dll,InstallHinfSection DefaultInstall 132 %s\\vim.inf", installdir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 run_command(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 #if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 /* Windows NT method (untested). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 sprintf(buf, "rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 %s\\vim.inf", installdir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 run_command(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 remove("vim.inf");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 main(int argc, char *argv[])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 int found = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 struct stat st;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 char icon[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 char popup_path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 /* The nsis uninstaller calls us with a "-nsis" argument. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 if (argc == 2 && stricmp(argv[1], "-nsis") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 interactive = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 interactive = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 /* Initialize this program. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 do_inits(argv);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 printf("This program will remove the following items:\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 if (popup_gvim_path(popup_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 printf(" - the \"Edit with Vim\" entry in the popup menu\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 printf(" which uses \"%s\"\n", popup_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 if (confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 remove_popup();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 /* Assume the "Open With" entry can be removed as well, don't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 * bother the user with asking him again. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 remove_openwith();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 else if (openwith_gvim_path(popup_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 printf(" - the Vim \"Open With...\" entry in the popup menu\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 printf(" which uses \"%s\"\n", popup_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 if (confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 remove_openwith();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 if (get_shell_folder_path(path, "desktop"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 printf("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 for (i = 0; i < ICON_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 sprintf(icon, "%s\\%s", path, icon_link_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 if (stat(icon, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 printf(" - the \"%s\" icon on the desktop\n", icon_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 ++found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 if (found > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 remove_icons();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 if (get_shell_folder_path(path, VIM_STARTMENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 && stat(path, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 printf("\n - the \"%s\" entry in the Start Menu\n", VIM_STARTMENU);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 remove_start_menu();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 printf("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 found = remove_batfiles(0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 if (found > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 remove_batfiles(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 fd = fopen("gvim.exe", "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 printf("gvim.exe detected. Attempting to unregister gvim with OLE\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 system("gvim.exe -silent -unregister");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 delete_uninstall_key();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 printf("\nYou may now want to delete the Vim executables and runtime files.\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 printf("(They are still where you unpacked them.)\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 rewind(stdin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 printf("\nPress Enter to exit...");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 (void)getchar();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 }