summaryrefslogtreecommitdiffstats
path: root/src/GvimExt/gvimext.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:56 +0000
commit75a9fa68f6cdd6769813a8c5e055bfb00a08c089 (patch)
treedaf1676b4e5ea491b7a370467a24b8181cc21827 /src/GvimExt/gvimext.cpp
parentAdding upstream version 2:9.1.0377. (diff)
downloadvim-upstream/2%9.1.0496.tar.xz
vim-upstream/2%9.1.0496.zip
Adding upstream version 2:9.1.0496.upstream/2%9.1.0496
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/GvimExt/gvimext.cpp')
-rw-r--r--src/GvimExt/gvimext.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/GvimExt/gvimext.cpp b/src/GvimExt/gvimext.cpp
index e58b142..f98423c 100644
--- a/src/GvimExt/gvimext.cpp
+++ b/src/GvimExt/gvimext.cpp
@@ -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"));