annotate src/uninstal.c @ 12788:cb9b2774f21f v8.0.1271

patch 8.0.1271: still too many old style tests commit https://github.com/vim/vim/commit/fb094e14c19337de824d4e6710ca6a2617930ab0 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 5 20:59:28 2017 +0100 patch 8.0.1271: still too many old style tests Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes #2290)
author Christian Brabandt <cb@256bit.org>
date Sun, 05 Nov 2017 21:00:04 +0100
parents aca41efd888c
children e43b5e6d9190
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 8212
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
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
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
35 static int
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
36 reg_delete_key(HKEY hRootKey, const char *key, DWORD flag)
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
37 {
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
38 static int did_load = FALSE;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
39 static HANDLE advapi_lib = NULL;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
40 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
41
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
42 if (!did_load)
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 /* 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
45 * 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
46 * back to RegDeleteKey(). */
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
47 did_load = TRUE;
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
48 advapi_lib = LoadLibrary("ADVAPI32.DLL");
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
49 if (advapi_lib != NULL)
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
50 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
51 }
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
52 if (delete_key_ex != NULL) {
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
53 return (*delete_key_ex)(hRootKey, key, flag, 0);
2475
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
54 }
7d1044b27eb5 Windows uninstaller: Instead of calling RegDeleteKeyEx() directly load it
Bram Moolenaar <bram@vim.org>
parents: 2466
diff changeset
55 return RegDeleteKey(hRootKey, key);
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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 * Check if the popup menu entry exists and what gvim it refers to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 * Returns non-zero when it's found.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 popup_gvim_path(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 HKEY key_handle;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 DWORD value_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 DWORD bufsize = BUFSIZE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 int r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 /* 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
71 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
72 KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
73 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
74 KEY_WOW64_32KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
75 return 0;
7
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;
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
114 int i;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
115 int loop = is_64bit_os() ? 2 : 1;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
116 int maxfail = loop * 6;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
117 DWORD flag;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 HKEY kh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
120 for (i = 0; i < loop; i++)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 {
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
122 if (i == 0)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
123 flag = KEY_WOW64_32KEY;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
124 else
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
125 flag = KEY_WOW64_64KEY;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
126
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
127 if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\\InProcServer32", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
128 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
129 if (reg_delete_key(HKEY_CLASSES_ROOT, "CLSID\\{51EEE242-AD87-11d3-9C1E-0090278BBD99}", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
130 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
131 if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\shellex\\ContextMenuHandlers\\gvim", flag) != ERROR_SUCCESS)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 ++fail;
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
133 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0,
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
134 flag | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
135 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
136 else
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
137 {
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
138 if (RegDeleteValue(kh, "{51EEE242-AD87-11d3-9C1E-0090278BBD99}") != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
139 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
140 RegCloseKey(kh);
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
141 }
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
142 if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
143 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
144 if (reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Vim", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
145 ++fail;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
148 if (fail == maxfail)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 printf("No Vim popup registry entries could be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 else if (fail > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 printf("Some Vim popup registry entries could not be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 printf("The Vim popup registry entries have been removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 remove_openwith(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 int fail = 0;
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
160 int i;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
161 int loop = is_64bit_os() ? 2 : 1;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
162 int maxfail = loop * 7;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
163 DWORD flag;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
165 for (i = 0; i < loop; i++)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
166 {
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
167 if (i == 0)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
168 flag = KEY_WOW64_32KEY;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
169 else
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
170 flag = KEY_WOW64_64KEY;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
172 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit\\command", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
173 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
174 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell\\edit", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
175 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
176 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe\\shell", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
177 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
178 if (reg_delete_key(HKEY_CLASSES_ROOT, "Applications\\gvim.exe", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
179 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
180 if (reg_delete_key(HKEY_CLASSES_ROOT, ".htm\\OpenWithList\\gvim.exe", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
181 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
182 if (reg_delete_key(HKEY_CLASSES_ROOT, ".vim\\OpenWithList\\gvim.exe", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
183 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
184 if (reg_delete_key(HKEY_CLASSES_ROOT, "*\\OpenWithList\\gvim.exe", flag) != ERROR_SUCCESS)
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
185 ++fail;
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
186 }
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
187
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
188 if (fail == maxfail)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 printf("No Vim open-with registry entries could be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 else if (fail > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 printf("Some Vim open-with registry entries could not be removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 printf("The Vim open-with registry entries have been removed\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 * 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
198 * batch file that was written for another (possibly newer) version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 batfile_thisversion(char *path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 char line[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 int ver_len = strlen(VIM_VERSION_NODOT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 int found = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 fd = fopen(path, "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 while (fgets(line, BUFSIZE, fd) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 for (p = line; *p != 0; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 /* don't accept "vim60an" when looking for "vim60". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 if (strnicmp(p, VIM_VERSION_NODOT, ver_len) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 && !isdigit(p[ver_len])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 && !isalpha(p[ver_len]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 found = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 if (found)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 return found;
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 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 remove_batfiles(int doit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 char *batfile_path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 int found = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 for (i = 1; i < TARGET_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 batfile_path = searchpath_save(targets[i].batname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 if (batfile_path != NULL && batfile_thisversion(batfile_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 ++found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 if (doit)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 printf("removing %s\n", batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 remove(batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 printf(" - the batch file %s\n", batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 free(batfile_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 return found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 remove_if_exists(char *path, char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 char buf[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 sprintf(buf, "%s\\%s", path, filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 fd = fopen(buf, "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 printf("removing %s\n", buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 remove(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 remove_icons(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 if (get_shell_folder_path(path, "desktop"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 for (i = 0; i < ICON_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 remove_if_exists(path, icon_link_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 remove_start_menu(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 struct stat st;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 if (get_shell_folder_path(path, VIM_STARTMENU))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 for (i = 1; i < TARGET_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 remove_if_exists(path, targets[i].lnkname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 remove_if_exists(path, "uninstall.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 remove_if_exists(path, "Help.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 /* Win95 uses .pif, WinNT uses .lnk */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 remove_if_exists(path, "Vim tutor.pif");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 remove_if_exists(path, "Vim tutor.lnk");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 remove_if_exists(path, "Vim online.url");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 if (stat(path, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 printf("removing %s\n", path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 rmdir(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 delete_uninstall_key(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 {
12626
aca41efd888c patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
313 reg_delete_key(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT, KEY_WOW64_64KEY);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 main(int argc, char *argv[])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 int found = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 struct stat st;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 char icon[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 char path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 char popup_path[BUFSIZE];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 /* The nsis uninstaller calls us with a "-nsis" argument. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 if (argc == 2 && stricmp(argv[1], "-nsis") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 interactive = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 interactive = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 /* Initialize this program. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 do_inits(argv);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 printf("This program will remove the following items:\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 if (popup_gvim_path(popup_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 printf(" - the \"Edit with Vim\" entry in the popup menu\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 printf(" which uses \"%s\"\n", popup_path);
2217
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
342 if (interactive)
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
343 printf("\nRemove it (y/n)? ");
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
344 if (!interactive || confirm())
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 remove_popup();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 /* Assume the "Open With" entry can be removed as well, don't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 * bother the user with asking him again. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 remove_openwith();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 else if (openwith_gvim_path(popup_path))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 printf(" - the Vim \"Open With...\" entry in the popup menu\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 printf(" which uses \"%s\"\n", popup_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 if (confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 remove_openwith();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 if (get_shell_folder_path(path, "desktop"))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 printf("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 for (i = 0; i < ICON_COUNT; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 sprintf(icon, "%s\\%s", path, icon_link_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 if (stat(icon, &st) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 printf(" - the \"%s\" icon on the desktop\n", icon_names[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 ++found;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 if (found > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 remove_icons();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 if (get_shell_folder_path(path, VIM_STARTMENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 && stat(path, &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("\n - the \"%s\" entry in the Start Menu\n", VIM_STARTMENU);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 printf("\nRemove it (y/n)? ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 remove_start_menu();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 printf("\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 found = remove_batfiles(0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 if (found > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 printf("\nRemove %s (y/n)? ", found > 1 ? "them" : "it");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 if (!interactive || confirm())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 remove_batfiles(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 fd = fopen("gvim.exe", "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 if (fd != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 printf("gvim.exe detected. Attempting to unregister gvim with OLE\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 system("gvim.exe -silent -unregister");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 delete_uninstall_key();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 if (interactive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 printf("\nYou may now want to delete the Vim executables and runtime files.\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 printf("(They are still where you unpacked them.)\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417
2217
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
418 if (interactive)
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
419 {
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
420 rewind(stdin);
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
421 printf("\nPress Enter to exit...");
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
422 (void)getchar();
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
423 }
120502692d82 Improve the MS-Windows installer.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
424 else
2287
573da4dac306 Make the dos installer work with more compilers.
Bram Moolenaar <bram@vim.org>
parents: 2217
diff changeset
425 sleep(3);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 }