Skip to content

Commit 84d9611

Browse files
dwagner0chrisbra
authored andcommitted
patch 9.1.0468: GvimExt does not consult HKEY_CURRENT_USER
Problem: GvimExt does not consult HKEY_CURRENT_USER Solution: Make GvimExt first consult HKEY_CURRENT_USER and then fall back to HKEY_LOCAL_MACHINE to find gvim (David Wagner) fixes: #14904 closes: #14917 Signed-off-by: David Wagner <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 9c60890 commit 84d9611

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/GvimExt/gvimext.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ getGvimName(char *name, int runtime)
5555
HKEY keyhandle;
5656
DWORD hlen;
5757

58-
// Get the location of gvim from the registry.
58+
// Get the location of gvim from the registry. Try
59+
// HKEY_CURRENT_USER first, then fall back to HKEY_LOCAL_MACHINE if
60+
// not found.
5961
name[0] = 0;
60-
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
62+
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Vim\\Gvim", 0,
6163
KEY_READ, &keyhandle) == ERROR_SUCCESS)
6264
{
6365
hlen = BUFSIZE;
@@ -69,6 +71,19 @@ getGvimName(char *name, int runtime)
6971
RegCloseKey(keyhandle);
7072
}
7173

74+
if ((name[0] == 0) &&
75+
(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
76+
KEY_READ, &keyhandle) == ERROR_SUCCESS))
77+
{
78+
hlen = BUFSIZE;
79+
if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen)
80+
!= ERROR_SUCCESS)
81+
name[0] = 0;
82+
else
83+
name[hlen] = 0;
84+
RegCloseKey(keyhandle);
85+
}
86+
7287
// Registry didn't work, use the search path.
7388
if (name[0] == 0)
7489
strcpy(name, searchpath((char *)"gvim.exe"));

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
468,
707709
/**/
708710
467,
709711
/**/

0 commit comments

Comments
 (0)