]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0468: GvimExt does not consult HKEY_CURRENT_USER v9.1.0468
authorDavid Wagner <dwagner@rydia.us>
Wed, 5 Jun 2024 18:01:19 +0000 (20:01 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 5 Jun 2024 18:01:19 +0000 (20:01 +0200)
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 <dwagner@rydia.us>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/GvimExt/gvimext.cpp
src/version.c

index e58b142555c57153105d0ac1adc846fc0136874d..f98423c15f87ba0a7fe345c904a4f33630e10905 100644 (file)
@@ -55,9 +55,11 @@ getGvimName(char *name, int runtime)
     HKEY       keyhandle;
     DWORD      hlen;
 
-    // Get the location of gvim from the registry.
+    // Get the location of gvim from the registry.  Try
+    // HKEY_CURRENT_USER first, then fall back to HKEY_LOCAL_MACHINE if
+    // not found.
     name[0] = 0;
-    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
+    if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Vim\\Gvim", 0,
                                       KEY_READ, &keyhandle) == ERROR_SUCCESS)
     {
        hlen = BUFSIZE;
@@ -69,6 +71,19 @@ getGvimName(char *name, int runtime)
        RegCloseKey(keyhandle);
     }
 
+    if ((name[0] == 0) &&
+           (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
+                                      KEY_READ, &keyhandle) == ERROR_SUCCESS))
+    {
+       hlen = BUFSIZE;
+       if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen)
+                                                            != ERROR_SUCCESS)
+           name[0] = 0;
+       else
+           name[hlen] = 0;
+       RegCloseKey(keyhandle);
+    }
+
     // Registry didn't work, use the search path.
     if (name[0] == 0)
        strcpy(name, searchpath((char *)"gvim.exe"));
index 92498e1dae636c67f73672067a1cb3a6a8e2cb98..92106bc3a40e53713d10d1f64ff3de9e0389d10a 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    468,
 /**/
     467,
 /**/