annotate src/uninstal.c @ 7085:48f2b6bd763c

Added tag v7.4.854 for changeset 1c039023af1c2fed2ea6b5e3f439071ad28364d3
author Christian Brabandt <cb@256bit.org>
date Tue, 01 Sep 2015 21:30:05 +0200
parents 6768ebd0bc04
children 05b88224cea1
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
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
36
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
37 static int
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
38 reg_delete_key(HKEY hRootKey, const char *key)
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
39 {
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
40 static int did_load = FALSE;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
41 static HANDLE advapi_lib = NULL;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
42 static LONG (WINAPI *delete_key_ex)(HKEY, LPCTSTR, REGSAM, DWORD) = NULL;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
43
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
44 if (!did_load)
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
45 {
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
46 /* The RegDeleteKeyEx() function is only available on new systems. It
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
47 * is required for 64-bit registry access. For other systems fall
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
48 * back to RegDeleteKey(). */
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
49 did_load = TRUE;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
50 advapi_lib = LoadLibrary("ADVAPI32.DLL");
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
51 if (advapi_lib != NULL)
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
52 delete_key_ex = (LONG (WINAPI *)(HKEY, LPCTSTR, REGSAM, DWORD))GetProcAddress(advapi_lib, "RegDeleteKeyExA");
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
53 }
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
54 if (delete_key_ex != NULL) {
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
55 return (*delete_key_ex)(hRootKey, key, KEY_WOW64_64KEY, 0);
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
56 }
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
57 return RegDeleteKey(hRootKey, key);
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
58 }
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
59
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 * Check if the popup menu entry exists and what gvim it refers to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 * Returns non-zero when it's found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 popup_gvim_path(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 HKEY key_handle;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 DWORD value_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 DWORD bufsize = BUFSIZE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 int r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 /* Open the key where the path to gvim.exe is stored. */
2449
943280505f72 Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents: 2287
diff changeset
73 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
943280505f72 Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents: 2287
diff changeset
74 KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 /* get the DisplayName out of it to show the user */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 r = RegQueryValueEx(key_handle, "path", 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 &value_type, (LPBYTE)buf, &bufsize);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 RegCloseKey(key_handle);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 return (r == ERROR_SUCCESS);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 }
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 * Check if the "Open With..." menu entry exists and what gvim it refers to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 * Returns non-zero when it's found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 openwith_gvim_path(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 HKEY key_handle;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 DWORD value_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 DWORD bufsize = BUFSIZE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 int r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 /* Open the key where the path to gvim.exe is stored. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
2449
943280505f72 Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents: 2287
diff changeset
99 "Applications\\gvim.exe\\shell\\edit\\command", 0,
943280505f72 Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents: 2287
diff changeset
100 KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 /* get the DisplayName out of it to show the user */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 r = RegQueryValueEx(key_handle, "", 0, &value_type, (LPBYTE)buf, &bufsize);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 RegCloseKey(key_handle);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 return (r == ERROR_SUCCESS);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 remove_popup(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 int fail = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 HKEY kh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
116 if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
118 if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
120 if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\shellex\\ContextMenuHandlers\\gvim") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 ++fail;
2449
943280505f72 Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents: 2287
diff changeset
122 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0,
943280505f72 Fix that uninstaller isn't found on 64-bit Windows.
Bram Moolenaar <bram@vim.org>
parents: 2287
diff changeset
123 KEY_WOW64_64KEY | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 RegCloseKey(kh);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 }
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
131 if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
133 if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 if (fail == 6)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 printf("No Vim popup registry entries could be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 else if (fail > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 printf("Some Vim popup registry entries could not be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 printf("The Vim popup registry entries have been removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 remove_openwith(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 int fail = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
149 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
151 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
153 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
155 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
157 if (reg_delete_key(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
159 if (reg_delete_key(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 ++fail;
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
161 if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe") != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 ++fail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 if (fail == 7)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 printf("No Vim open-with registry entries could be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 else if (fail > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 printf("Some Vim open-with registry entries could not be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 printf("The Vim open-with registry entries have been removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 * 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
175 * batch file that was written for another (possibly newer) version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 batfile_thisversion(char *path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 char line[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 int ver_len = strlen(VIM_VERSION_NODOT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 int found = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 fd = fopen(path, "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 while (fgets(line, BUFSIZE, fd) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 for (p = line; *p != 0; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 /* don't accept "vim60an" when looking for "vim60". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 && !isdigit(p[ver_len])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 && !isalpha(p[ver_len]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 found = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 if (found)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 return found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 remove_batfiles(int doit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 char *batfile_path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 int found = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 for (i = 1; i < TARGET_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 batfile_path = searchpath_save(targets[i].batname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 if (batfile_path != NULL && batfile_thisversion(batfile_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 ++found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 if (doit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 printf("removing %s\n", batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 remove(batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 printf(" - the batch file %s\n", batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 free(batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 return found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 remove_if_exists(char *path, char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 char buf[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 sprintf(buf, "%s\\%s", path, filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 fd = fopen(buf, "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 printf("removing %s\n", buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 remove(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 remove_icons(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 if (get_shell_folder_path(path, "desktop"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 for (i = 0; i < ICON_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 remove_if_exists(path, icon_link_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 remove_start_menu(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 struct stat st;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 if (get_shell_folder_path(path, VIM_STARTMENU))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 for (i = 1; i < TARGET_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 remove_if_exists(path, targets[i].lnkname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 remove_if_exists(path, "uninstall.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 remove_if_exists(path, "Help.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 /* Win95 uses .pif, WinNT uses .lnk */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 remove_if_exists(path, "Vim tutor.pif");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 remove_if_exists(path, "Vim tutor.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 remove_if_exists(path, "Vim online.url");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 if (stat(path, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 printf("removing %s\n", path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 rmdir(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 delete_uninstall_key(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 #ifdef WIN3264
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
293 reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 char buf[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 * On DJGPP we delete registry entries by creating a .inf file and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 * installing it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 fd = fopen("vim.inf", "w");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 fprintf(fd, "[version]\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 fprintf(fd, "signature=\"$CHICAGO$\"\n\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 fprintf(fd, "[DefaultInstall]\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 fprintf(fd, "DelReg=DeleteMe\n\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 fprintf(fd, "[DeleteMe]\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 fprintf(fd, "HKLM,\"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT "\"\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 /* 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
314 * 95/98/ME method, since the DJGPP version can't use long filenames
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 * on Win NT anyway. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 sprintf(buf, "rundll setupx.dll,InstallHinfSection DefaultInstall 132 %s\\vim.inf", installdir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 run_command(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 #if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 /* Windows NT method (untested). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 sprintf(buf, "rundll32 syssetup,SetupInfObjectInstallAction DefaultInstall 128 %s\\vim.inf", installdir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 run_command(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 remove("vim.inf");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 main(int argc, char *argv[])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 int found = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 struct stat st;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 char icon[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 char popup_path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 /* The nsis uninstaller calls us with a "-nsis" argument. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 if (argc == 2 && stricmp(argv[1], "-nsis") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 interactive = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 interactive = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 /* Initialize this program. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 do_inits(argv);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 printf("This program will remove the following items:\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 if (popup_gvim_path(popup_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 printf(" - the \"Edit with Vim\" entry in the popup menu\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 printf(" which uses \"%s\"\n", popup_path);
2217
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
358 if (interactive)
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
359 printf("\nRemove it (y/n)? ");
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
360 if (!interactive || confirm())
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 remove_popup();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 /* Assume the "Open With" entry can be removed as well, don't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 * bother the user with asking him again. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 remove_openwith();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 else if (openwith_gvim_path(popup_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 printf(" - the Vim \"Open With...\" entry in the popup menu\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 printf(" which uses \"%s\"\n", popup_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 if (confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 remove_openwith();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 if (get_shell_folder_path(path, "desktop"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 printf("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 for (i = 0; i < ICON_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 sprintf(icon, "%s\\%s", path, icon_link_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 if (stat(icon, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 printf(" - the \"%s\" icon on the desktop\n", icon_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 ++found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 if (found > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 remove_icons();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 if (get_shell_folder_path(path, VIM_STARTMENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 && stat(path, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 printf("\n - the \"%s\" entry in the Start Menu\n", VIM_STARTMENU);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 remove_start_menu();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 printf("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 found = remove_batfiles(0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 if (found > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 remove_batfiles(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 fd = fopen("gvim.exe", "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 printf("gvim.exe detected. Attempting to unregister gvim with OLE\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 system("gvim.exe -silent -unregister");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 delete_uninstall_key();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 printf("\nYou may now want to delete the Vim executables and runtime files.\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 printf("(They are still where you unpacked them.)\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434
2217
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
435 if (interactive)
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
436 {
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
437 rewind(stdin);
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
438 printf("\nPress Enter to exit...");
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
439 (void)getchar();
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
440 }
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
441 else
2287
573da4dac306 Make the dos installer work with more compilers.
Bram Moolenaar <bram@vim.org>
parents: 2217
diff changeset
442 sleep(3);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 }