Alex Henrie : mountmgr: Symlink WoW64 Wine ports key to regular Wine ports key.

Alexandre Julliard julliard at winehq.org
Tue Oct 31 13:16:02 CDT 2017


Module: wine
Branch: master
Commit: c296e7de4d6d7eab56ab3ee5d8f2dc2c913ae05f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c296e7de4d6d7eab56ab3ee5d8f2dc2c913ae05f

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Sun Oct 29 21:58:52 2017 +0100

mountmgr: Symlink WoW64 Wine ports key to regular Wine ports key.

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mountmgr.sys/device.c   |  3 ++-
 dlls/mountmgr.sys/mountmgr.c | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 5101f2b..20c96d0 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -1136,7 +1136,8 @@ static void create_port_devices( DRIVER_OBJECT *driver )
     }
     p += 3;
 
-    RegOpenKeyExW( HKEY_LOCAL_MACHINE, ports_keyW, 0, KEY_QUERY_VALUE, &wine_ports_key );
+    RegCreateKeyExW( HKEY_LOCAL_MACHINE, ports_keyW, 0, NULL, 0,
+                     KEY_QUERY_VALUE, NULL, &wine_ports_key, NULL );
     RegCreateKeyExW( HKEY_LOCAL_MACHINE, windows_ports_key_name, 0, NULL, REG_OPTION_VOLATILE,
                      KEY_ALL_ACCESS, NULL, &windows_ports_key, NULL );
 
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 1eb0a78..b792be4 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -422,6 +422,17 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
     static const WCHAR driver_serialW[] = {'\\','D','r','i','v','e','r','\\','S','e','r','i','a','l',0};
     static const WCHAR driver_parallelW[] = {'\\','D','r','i','v','e','r','\\','P','a','r','a','l','l','e','l',0};
 
+#ifdef _WIN64
+    static const WCHAR qualified_ports_keyW[] = {'\\','R','E','G','I','S','T','R','Y','\\',
+                                                 'M','A','C','H','I','N','E','\\','S','o','f','t','w','a','r','e','\\',
+                                                 'W','i','n','e','\\','P','o','r','t','s'}; /* no null terminator */
+    static const WCHAR wow64_ports_keyW[] = {'S','o','f','t','w','a','r','e','\\',
+                                             'W','o','w','6','4','3','2','N','o','d','e','\\','W','i','n','e','\\',
+                                             'P','o','r','t','s',0};
+    static const WCHAR symbolic_link_valueW[] = {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e',0};
+    HKEY wow64_ports_key = NULL;
+#endif
+
     UNICODE_STRING nameW, linkW;
     DEVICE_OBJECT *device;
     NTSTATUS status;
@@ -449,6 +460,15 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
     initialize_dbus();
     initialize_diskarbitration();
 
+#ifdef _WIN64
+    /* create a symlink so that the Wine port overrides key can be edited with 32-bit reg or regedit */
+    RegCreateKeyExW( HKEY_LOCAL_MACHINE, wow64_ports_keyW, 0, NULL, REG_OPTION_CREATE_LINK,
+                     KEY_SET_VALUE, NULL, &wow64_ports_key, NULL );
+    RegSetValueExW( wow64_ports_key, symbolic_link_valueW, 0, REG_LINK,
+                    (BYTE *)qualified_ports_keyW, sizeof(qualified_ports_keyW) );
+    RegCloseKey( wow64_ports_key );
+#endif
+
     RtlInitUnicodeString( &nameW, driver_serialW );
     IoCreateDriver( &nameW, serial_driver_entry );
 




More information about the wine-cvs mailing list