Alexandre Julliard : mountmgr: Add a Wine-specific ioctl to define a drive for a Unix path.
Alexandre Julliard
julliard at winehq.org
Fri Oct 24 08:12:21 CDT 2008
Module: wine
Branch: master
Commit: 8faceff2f9db704a3ca411da7c4be7c124b5bc22
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8faceff2f9db704a3ca411da7c4be7c124b5bc22
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Oct 23 15:48:08 2008 +0200
mountmgr: Add a Wine-specific ioctl to define a drive for a Unix path.
---
dlls/mountmgr.sys/mountmgr.c | 49 ++++++++++++++++++++++++++++++++++++++++++
dlls/mountmgr.sys/mountmgr.h | 1 +
include/ddk/mountmgr.h | 16 +++++++++++++
3 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 79418cc..c633588 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -223,6 +223,48 @@ static NTSTATUS query_mount_points( const void *in_buff, SIZE_T insize,
return STATUS_SUCCESS;
}
+/* implementation of IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE */
+static NTSTATUS define_unix_drive( const void *in_buff, SIZE_T insize )
+{
+ const struct mountmgr_unix_drive *input = in_buff;
+ const char *mount_point = NULL, *device = NULL;
+ unsigned int i;
+ WCHAR letter = tolowerW( input->letter );
+
+ if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER;
+ if (input->type > DRIVE_RAMDISK) return STATUS_INVALID_PARAMETER;
+ if (input->mount_point_offset > insize || input->device_offset > insize)
+ return STATUS_INVALID_PARAMETER;
+
+ /* make sure string are null-terminated */
+ if (input->mount_point_offset)
+ {
+ mount_point = (const char *)in_buff + input->mount_point_offset;
+ for (i = input->mount_point_offset; i < insize; i++)
+ if (!*((const char *)in_buff + i)) break;
+ if (i >= insize) return STATUS_INVALID_PARAMETER;
+ }
+ if (input->device_offset)
+ {
+ device = (const char *)in_buff + input->device_offset;
+ for (i = input->device_offset; i < insize; i++)
+ if (!*((const char *)in_buff + i)) break;
+ if (i >= insize) return STATUS_INVALID_PARAMETER;
+ }
+
+ if (input->type != DRIVE_NO_ROOT_DIR)
+ {
+ TRACE( "defining %c: dev %s mount %s type %u\n",
+ letter, debugstr_a(device), debugstr_a(mount_point), input->type );
+ return add_dos_device( letter - 'a', NULL, device, mount_point, input->type );
+ }
+ else
+ {
+ TRACE( "removing %c:\n", letter );
+ return remove_dos_device( letter - 'a', NULL );
+ }
+}
+
/* handler for ioctls on the mount manager device */
static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp )
{
@@ -244,6 +286,13 @@ static NTSTATUS WINAPI mountmgr_ioctl( DEVICE_OBJECT *device, IRP *irp )
irpsp->Parameters.DeviceIoControl.OutputBufferLength,
&irp->IoStatus );
break;
+ case IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE:
+ if (irpsp->Parameters.DeviceIoControl.InputBufferLength < sizeof(struct mountmgr_unix_drive))
+ return STATUS_INVALID_PARAMETER;
+ irp->IoStatus.Information = 0;
+ irp->IoStatus.u.Status = define_unix_drive( irpsp->Parameters.DeviceIoControl.Type3InputBuffer,
+ irpsp->Parameters.DeviceIoControl.InputBufferLength );
+ break;
default:
FIXME( "ioctl %x not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode );
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h
index 57c7b38..1b4b3f6 100644
--- a/dlls/mountmgr.sys/mountmgr.h
+++ b/dlls/mountmgr.sys/mountmgr.h
@@ -32,6 +32,7 @@
#include "ntddstor.h"
#include "ntddcdrm.h"
#include "ddk/wdm.h"
+#define WINE_MOUNTMGR_EXTENSIONS
#include "ddk/mountmgr.h"
extern void initialize_hal(void);
diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h
index db0f21c..05eeeac 100644
--- a/include/ddk/mountmgr.h
+++ b/include/ddk/mountmgr.h
@@ -49,6 +49,22 @@ static const WCHAR MOUNTMGR_DOS_DEVICE_NAME[] = {'\\','\\','.','\\','M','o','u',
#define IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES CTL_CODE(MOUNTMGRCONTROLTYPE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION CTL_CODE(MOUNTMGRCONTROLTYPE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
+/* Wine extensions */
+#ifdef WINE_MOUNTMGR_EXTENSIONS
+
+#define IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 32, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
+
+struct mountmgr_unix_drive
+{
+ ULONG size;
+ ULONG type;
+ WCHAR letter;
+ USHORT mount_point_offset;
+ USHORT device_offset;
+};
+
+#endif
+
typedef struct _MOUNTMGR_CREATE_POINT_INPUT
{
USHORT SymbolicLinkNameOffset;
More information about the wine-cvs
mailing list