wine-staging/patches/mountmgr-DosDevices/0001-mountmgr.sys-Write-usable-device-paths-into-HKLM-SYS.patch

76 lines
3.3 KiB
Diff
Raw Normal View History

From e6e95fe8edfaa85796f533f3f7a485bc721fe930 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 30 Mar 2015 04:01:51 +0200
Subject: [PATCH] mountmgr.sys: Write usable device paths into
HKLM\SYSTEM\MountedDevices.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on a patch by Bernhard Übelacker.
---
dlls/mountmgr.sys/device.c | 4 ++--
dlls/mountmgr.sys/mountmgr.c | 11 +++++++++--
dlls/mountmgr.sys/mountmgr.h | 3 ++-
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index fc32b57cf70..4d837315311 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -1083,8 +1083,8 @@ static NTSTATUS set_volume_info( struct volume *volume, struct dos_drive *drive,
id = disk_device->unix_mount;
id_len = strlen( disk_device->unix_mount ) + 1;
}
- if (volume->mount) set_mount_point_id( volume->mount, id, id_len );
- if (drive && drive->mount) set_mount_point_id( drive->mount, id, id_len );
+ if (volume->mount) set_mount_point_id( volume->mount, id, id_len, -1 );
+ if (drive && drive->mount) set_mount_point_id( drive->mount, id, id_len, drive->drive );
return STATUS_SUCCESS;
}
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 2e3ff80c36a..6898bb98c62 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -52,14 +52,21 @@ static HKEY mount_key;
unixlib_handle_t mountmgr_handle = 0;
-void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len )
+void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len, int drive )
{
+ WCHAR logicalW[] = {'\\','\\','.','\\','a',':',0};
RtlFreeHeap( GetProcessHeap(), 0, mount->id );
mount->id_len = max( MIN_ID_LEN, id_len );
if ((mount->id = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, mount->id_len )))
{
memcpy( mount->id, id, id_len );
- RegSetValueExW( mount_key, mount->link.Buffer, 0, REG_BINARY, mount->id, mount->id_len );
+ if (drive < 0)
+ RegSetValueExW( mount_key, mount->link.Buffer, 0, REG_BINARY, mount->id, mount->id_len );
+ else
+ {
+ logicalW[4] = 'a' + drive;
+ RegSetValueExW( mount_key, mount->link.Buffer, 0, REG_BINARY, (BYTE*)logicalW, sizeof(logicalW) );
+ }
}
else mount->id_len = 0;
}
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h
index 0297f6f11fe..b347a9cef6a 100644
--- a/dlls/mountmgr.sys/mountmgr.h
+++ b/dlls/mountmgr.sys/mountmgr.h
@@ -110,6 +110,7 @@ extern struct mount_point *add_dosdev_mount_point( DEVICE_OBJECT *device, UNICOD
extern struct mount_point *add_volume_mount_point( DEVICE_OBJECT *device, UNICODE_STRING *device_name,
const GUID *guid ) DECLSPEC_HIDDEN;
extern void delete_mount_point( struct mount_point *mount ) DECLSPEC_HIDDEN;
-extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len ) DECLSPEC_HIDDEN;
+
+extern void set_mount_point_id( struct mount_point *mount, const void *id, unsigned int id_len, int drive ) DECLSPEC_HIDDEN;
#endif /* __WINE_MOUNTMGR_H */
--
2.33.0