Alexandre Julliard : mountmgr: Return a copy of the strings in query_dos_device.
Alexandre Julliard
julliard at winehq.org
Thu Jul 23 09:59:20 CDT 2009
Module: wine
Branch: master
Commit: 134feaab05ae382aabc14aeb9268a6e68f035a38
URL: http://source.winehq.org/git/wine.git/?a=commit;h=134feaab05ae382aabc14aeb9268a6e68f035a38
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jul 22 21:02:47 2009 +0200
mountmgr: Return a copy of the strings in query_dos_device.
---
dlls/mountmgr.sys/device.c | 7 +++----
dlls/mountmgr.sys/mountmgr.c | 10 +++++++---
dlls/mountmgr.sys/mountmgr.h | 3 +--
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 20a7826..bdade97 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -807,8 +807,7 @@ NTSTATUS remove_dos_device( int letter, const char *udi )
}
/* query information about an existing dos drive, by letter or udi */
-NTSTATUS query_dos_device( int letter, enum device_type *type,
- const char **device, const char **mount_point )
+NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point )
{
struct dos_drive *drive;
struct disk_device *disk_device;
@@ -818,8 +817,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type,
if (drive->drive != letter) continue;
disk_device = drive->volume->device;
if (type) *type = disk_device->type;
- if (device) *device = disk_device->unix_device;
- if (mount_point) *mount_point = disk_device->unix_mount;
+ if (device) *device = strdupA( disk_device->unix_device );
+ if (mount_point) *mount_point = strdupA( disk_device->unix_mount );
return STATUS_SUCCESS;
}
return STATUS_NO_SUCH_DEVICE;
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index bbf5d64..a80d492 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -276,7 +276,7 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
{
const struct mountmgr_unix_drive *input = in_buff;
struct mountmgr_unix_drive *output = out_buff;
- const char *device, *mount_point;
+ char *device, *mount_point;
int letter = tolowerW( input->letter );
NTSTATUS status;
DWORD size, type = DEVICE_UNKNOWN;
@@ -314,7 +314,8 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
output->type = type;
iosb->Information = FIELD_OFFSET( struct mountmgr_unix_drive, type ) + sizeof(output->type);
}
- return STATUS_MORE_ENTRIES;
+ status = STATUS_MORE_ENTRIES;
+ goto done;
}
output->size = size;
output->letter = letter;
@@ -341,7 +342,10 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
letter, debugstr_a(device), debugstr_a(mount_point), type );
iosb->Information = ptr - (char *)output;
- return STATUS_SUCCESS;
+done:
+ RtlFreeHeap( GetProcessHeap(), 0, device );
+ RtlFreeHeap( GetProcessHeap(), 0, mount_point );
+ return status;
}
/* handler for ioctls on the mount manager device */
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h
index 0ba1086..3d57ba1 100644
--- a/dlls/mountmgr.sys/mountmgr.h
+++ b/dlls/mountmgr.sys/mountmgr.h
@@ -57,8 +57,7 @@ extern NTSTATUS remove_volume( const char *udi );
extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device,
const char *mount_point, enum device_type type, const GUID *guid );
extern NTSTATUS remove_dos_device( int letter, const char *udi );
-extern NTSTATUS query_dos_device( int letter, enum device_type *type,
- const char **device, const char **mount_point );
+extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point );
extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path );
/* mount point functions */
More information about the wine-cvs
mailing list