Commit 6befc98d authored by Alexandre Julliard's avatar Alexandre Julliard

mountmgr.sys: Add devices to the MountedDevices registry key.

parent 2143dee7
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "winbase.h" #include "winbase.h"
#include "winternl.h" #include "winternl.h"
#include "winioctl.h" #include "winioctl.h"
#include "winreg.h"
#include "ddk/wdm.h" #include "ddk/wdm.h"
#include "ddk/mountmgr.h" #include "ddk/mountmgr.h"
#include "wine/library.h" #include "wine/library.h"
...@@ -56,6 +57,7 @@ struct mount_point ...@@ -56,6 +57,7 @@ struct mount_point
}; };
static struct mount_point mount_points[MAX_MOUNT_POINTS]; static struct mount_point mount_points[MAX_MOUNT_POINTS];
static HKEY mount_key;
static inline UNICODE_STRING *get_device_name( DEVICE_OBJECT *dev ) static inline UNICODE_STRING *get_device_name( DEVICE_OBJECT *dev )
{ {
...@@ -207,6 +209,11 @@ static NTSTATUS add_mount_point( DRIVER_OBJECT *driver, DWORD type, int drive, ...@@ -207,6 +209,11 @@ static NTSTATUS add_mount_point( DRIVER_OBJECT *driver, DWORD type, int drive,
TRACE( "created device %s symlinks %s %s\n", debugstr_w(get_device_name(mount_drive->device)->Buffer), TRACE( "created device %s symlinks %s %s\n", debugstr_w(get_device_name(mount_drive->device)->Buffer),
debugstr_w(mount_drive->link.Buffer), debugstr_w(mount_volume->link.Buffer) ); debugstr_w(mount_drive->link.Buffer), debugstr_w(mount_volume->link.Buffer) );
RegSetValueExW( mount_key, mount_drive->link.Buffer, 0, REG_BINARY,
mount_drive->id, mount_drive->id_len );
RegSetValueExW( mount_key, mount_volume->link.Buffer, 0, REG_BINARY,
mount_volume->id, mount_volume->id_len );
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
...@@ -278,6 +285,8 @@ static void create_drive_mount_points( DRIVER_OBJECT *driver ) ...@@ -278,6 +285,8 @@ static void create_drive_mount_points( DRIVER_OBJECT *driver )
/* driver entry point for the harddisk driver */ /* driver entry point for the harddisk driver */
static NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) static NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path )
{ {
static const WCHAR mounted_devicesW[] = {'S','y','s','t','e','m','\\',
'M','o','u','n','t','e','d','D','e','v','i','c','e','s',0};
static const WCHAR harddisk0W[] = {'\\','D','e','v','i','c','e', static const WCHAR harddisk0W[] = {'\\','D','e','v','i','c','e',
'\\','H','a','r','d','d','i','s','k','0',0}; '\\','H','a','r','d','d','i','s','k','0',0};
static const WCHAR physdrive0W[] = {'\\','?','?','\\','P','h','y','s','i','c','a','l','D','r','i','v','e','0',0}; static const WCHAR physdrive0W[] = {'\\','?','?','\\','P','h','y','s','i','c','a','l','D','r','i','v','e','0',0};
...@@ -288,6 +297,9 @@ static NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STR ...@@ -288,6 +297,9 @@ static NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STR
driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = harddisk_ioctl; driver->MajorFunction[IRP_MJ_DEVICE_CONTROL] = harddisk_ioctl;
RegCreateKeyExW( HKEY_LOCAL_MACHINE, mounted_devicesW, 0, NULL,
REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &mount_key, NULL );
RtlInitUnicodeString( &nameW, harddisk0W ); RtlInitUnicodeString( &nameW, harddisk0W );
RtlInitUnicodeString( &linkW, physdrive0W ); RtlInitUnicodeString( &linkW, physdrive0W );
if (!(status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device ))) if (!(status = IoCreateDevice( driver, 0, &nameW, 0, 0, FALSE, &device )))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment