Fix that uninstaller isn't found on 64-bit Windows.
diff --git a/src/dosinst.c b/src/dosinst.c
index 6dcb5e3..979d6fe 100644
--- a/src/dosinst.c
+++ b/src/dosinst.c
@@ -462,8 +462,8 @@
DWORD new_num_keys;
int foundone = 0;
- code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, uninstall_key, 0, KEY_READ,
- &key_handle);
+ code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, uninstall_key, 0,
+ KEY_WOW64_64KEY | KEY_READ, &key_handle);
CHECK_REG_ERROR(code);
for (key_index = 0;
@@ -475,8 +475,8 @@
if (strncmp("Vim", subkey_name_buff, 3) == 0)
{
/* Open the key named Vim* */
- code = RegOpenKeyEx(key_handle, subkey_name_buff, 0, KEY_READ,
- &uninstall_key_handle);
+ code = RegOpenKeyEx(key_handle, subkey_name_buff, 0,
+ KEY_WOW64_64KEY | KEY_READ, &uninstall_key_handle);
CHECK_REG_ERROR(code);
/* get the DisplayName out of it to show the user */
@@ -1352,14 +1352,6 @@
}
#if defined(WIN3264)
-/*
- * Modern way of creating registry entries, also works on 64 bit windows when
- * compiled as a 32 bit program.
- */
-# ifndef KEY_WOW64_64KEY
-# define KEY_WOW64_64KEY 0x0100
-# endif
-
static LONG
reg_create_key(
HKEY root,
diff --git a/src/dosinst.h b/src/dosinst.h
index 86e65e9..b33426a 100644
--- a/src/dosinst.h
+++ b/src/dosinst.h
@@ -83,6 +83,14 @@
# define TRUE 1
#endif
+/*
+ * Modern way of creating registry entries, also works on 64 bit windows when
+ * compiled as a 32 bit program.
+ */
+# ifndef KEY_WOW64_64KEY
+# define KEY_WOW64_64KEY 0x0100
+# endif
+
#define VIM_STARTMENU "Programs\\Vim " VIM_VERSION_SHORT
int interactive; /* non-zero when running interactively */
diff --git a/src/if_ole.cpp b/src/if_ole.cpp
index 1f73705..53c12de 100644
--- a/src/if_ole.cpp
+++ b/src/if_ole.cpp
@@ -50,14 +50,6 @@
WORD wVerMinor, LCID lcid, SYSKIND syskind);
#endif
-/*
- * Modern way of creating registry entries, also works on 64 bit windows when
- * compiled as a 32 bit program.
- */
-# ifndef KEY_WOW64_64KEY
-# define KEY_WOW64_64KEY 0x0100
-# endif
-
/*****************************************************************************
1. Internal definitions for this file
*****************************************************************************/
@@ -166,7 +158,7 @@
// RegCreateKeyEx succeeds even if key exists. W.Briscoe W2K 20021011
if (RegCreateKeyEx(HKEY_CLASSES_ROOT, MYVIPROGID, 0, NULL,
REG_OPTION_NON_VOLATILE,
- KEY_WOW64_64KEY | KEY_ALL_ACCESS, NULL, &hKey, NULL))
+ KEY_ALL_ACCESS, NULL, &hKey, NULL))
{
delete me;
return NULL; // Unable to write to registry. Quietly fail.
@@ -658,7 +650,8 @@
{
// Open the child
HKEY hKeyChild;
- LONG result = RegOpenKeyEx(hKeyParent, child, 0, KEY_ALL_ACCESS, &hKeyChild);
+ LONG result = RegOpenKeyEx(hKeyParent, child, 0,
+ KEY_ALL_ACCESS, &hKeyChild);
if (result != ERROR_SUCCESS)
return;
@@ -701,7 +694,7 @@
long result = RegCreateKeyEx(HKEY_CLASSES_ROOT,
buffer,
0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_WOW64_64KEY | KEY_ALL_ACCESS, NULL,
+ KEY_ALL_ACCESS, NULL,
&hKey, NULL);
if (result != ERROR_SUCCESS)
return;
diff --git a/src/uninstal.c b/src/uninstal.c
index b18a326..4b4b6f2 100644
--- a/src/uninstal.c
+++ b/src/uninstal.c
@@ -46,8 +46,8 @@
int r;
/* Open the key where the path to gvim.exe is stored. */
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, KEY_READ,
- &key_handle) != ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
+ KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
return 0;
/* get the DisplayName out of it to show the user */
@@ -72,8 +72,8 @@
/* Open the key where the path to gvim.exe is stored. */
if (RegOpenKeyEx(HKEY_CLASSES_ROOT,
- "Applications\\gvim.exe\\shell\\edit\\command", 0, KEY_READ,
- &key_handle) != ERROR_SUCCESS)
+ "Applications\\gvim.exe\\shell\\edit\\command", 0,
+ KEY_WOW64_64KEY | KEY_READ, &key_handle) != ERROR_SUCCESS)
return 0;
/* get the DisplayName out of it to show the user */
@@ -95,7 +95,8 @@
++fail;
if (RegDeleteKey(HKEY_CLASSES_ROOT, "*\\shellex\\ContextMenuHandlers\\gvim") != ERROR_SUCCESS)
++fail;
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0, KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved", 0,
+ KEY_WOW64_64KEY | KEY_ALL_ACCESS, &kh) != ERROR_SUCCESS)
++fail;
else
{