shithub: choc

Download patch

ref: 0a94c0f99d6c34b30d2ac6fd7d5e516bd14dffb5
parent: 46547d4b48f3e52c12a4de526d11e877b2185cd2
author: Simon Howard <fraggle@gmail.com>
date: Sat Aug 17 16:53:22 EDT 2013

Fix IWAD registry locations when using 64-bit Windows. Change imported
from Odamex r4128 (thanks AlexMax).

Subversion-branch: /branches/v2-branch
Subversion-revision: 2618

--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -100,13 +100,21 @@
 //
 // With some munging we can find where Doom was installed.
 
-static registry_value_t uninstall_values[] = 
+// [AlexMax] From the persepctive of a 64-bit executable, 32-bit registry
+// keys are located in a different spot.
+#if _WIN64
+#define SOFTWARE_KEY "Software\\Wow6432Node"
+#else
+#define SOFTWARE_KEY "Software"
+#endif
+
+static registry_value_t uninstall_values[] =
 {
     // Ultimate Doom, CD version (Depths of Doom trilogy)
 
     {
-        HKEY_LOCAL_MACHINE, 
-        "Software\\Microsoft\\Windows\\CurrentVersion\\"
+        HKEY_LOCAL_MACHINE,
+        SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
             "Uninstall\\Ultimate Doom for Windows 95",
         "UninstallString",
     },
@@ -114,8 +122,8 @@
     // Doom II, CD version (Depths of Doom trilogy)
 
     {
-        HKEY_LOCAL_MACHINE, 
-        "Software\\Microsoft\\Windows\\CurrentVersion\\"
+        HKEY_LOCAL_MACHINE,
+        SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
             "Uninstall\\Doom II for Windows 95",
         "UninstallString",
     },
@@ -123,8 +131,8 @@
     // Final Doom
 
     {
-        HKEY_LOCAL_MACHINE, 
-        "Software\\Microsoft\\Windows\\CurrentVersion\\"
+        HKEY_LOCAL_MACHINE,
+        SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
             "Uninstall\\Final Doom for Windows 95",
         "UninstallString",
     },
@@ -132,8 +140,8 @@
     // Shareware version
 
     {
-        HKEY_LOCAL_MACHINE, 
-        "Software\\Microsoft\\Windows\\CurrentVersion\\"
+        HKEY_LOCAL_MACHINE,
+        SOFTWARE_KEY "\\Microsoft\\Windows\\CurrentVersion\\"
             "Uninstall\\Doom Shareware for Windows 95",
         "UninstallString",
     },
@@ -144,7 +152,7 @@
 static registry_value_t collectors_edition_value =
 {
     HKEY_LOCAL_MACHINE,
-    "Software\\Activision\\DOOM Collector's Edition\\v1.0",
+    SOFTWARE_KEY "\\Activision\\DOOM Collector's Edition\\v1.0",
     "INSTALLPATH",
 };
 
@@ -162,7 +170,7 @@
 static registry_value_t steam_install_location =
 {
     HKEY_LOCAL_MACHINE,
-    "Software\\Valve\\Steam",
+    SOFTWARE_KEY "\\Valve\\Steam",
     "InstallPath",
 };