mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 05:00:27 +00:00
[MOUNTMGR] Few fixes and improvements (#7896)
- `MountMgrVolumeMountPointChanged()`: Set status code in all failure paths and correct the check for remote or removable media. - `DeleteRemoteDatabaseEntry()`: Do not allow the database with size of zero. - `QueryVolumeName()`: Use reparse point file reference when no file name is supplied.
This commit is contained in:
parent
26e0a5472f
commit
3d9b919814
2 changed files with 12 additions and 6 deletions
|
@ -255,8 +255,8 @@ DeleteRemoteDatabaseEntry(IN HANDLE Database,
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate parameters: ensure we won't get negative size */
|
/* Validate parameters: ensure we won't get zero or negative size */
|
||||||
if (Entry->EntrySize + StartingOffset > DatabaseSize)
|
if (Entry->EntrySize + StartingOffset >= DatabaseSize)
|
||||||
{
|
{
|
||||||
/* If we get invalid parameters, truncate the whole database
|
/* If we get invalid parameters, truncate the whole database
|
||||||
* starting the wrong entry. We can't rely on the rest
|
* starting the wrong entry. We can't rely on the rest
|
||||||
|
@ -1303,12 +1303,14 @@ QueryVolumeName(IN HANDLE RootDirectory,
|
||||||
PFILE_NAME_INFORMATION FileNameInfo;
|
PFILE_NAME_INFORMATION FileNameInfo;
|
||||||
PREPARSE_DATA_BUFFER ReparseDataBuffer;
|
PREPARSE_DATA_BUFFER ReparseDataBuffer;
|
||||||
|
|
||||||
UNREFERENCED_PARAMETER(ReparsePointInformation);
|
|
||||||
|
|
||||||
if (!FileName)
|
if (!FileName)
|
||||||
{
|
{
|
||||||
|
UNICODE_STRING Reference;
|
||||||
|
|
||||||
|
Reference.Length = Reference.MaximumLength = sizeof(ReparsePointInformation->FileReference);
|
||||||
|
Reference.Buffer = (PWSTR)&(ReparsePointInformation->FileReference);
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
NULL,
|
&Reference,
|
||||||
OBJ_KERNEL_HANDLE,
|
OBJ_KERNEL_HANDLE,
|
||||||
RootDirectory,
|
RootDirectory,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -2062,13 +2062,17 @@ MountMgrVolumeMountPointChanged(IN PDEVICE_EXTENSION DeviceExtension,
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mount points can be stored only on storage disks */
|
||||||
if (FsDeviceInfo.DeviceType != FILE_DEVICE_DISK && FsDeviceInfo.DeviceType != FILE_DEVICE_VIRTUAL_DISK)
|
if (FsDeviceInfo.DeviceType != FILE_DEVICE_DISK && FsDeviceInfo.DeviceType != FILE_DEVICE_VIRTUAL_DISK)
|
||||||
{
|
{
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FsDeviceInfo.Characteristics != (FILE_REMOTE_DEVICE | FILE_REMOVABLE_MEDIA))
|
/* And they can be on local fixed disks only */
|
||||||
|
if (FsDeviceInfo.Characteristics & (FILE_REMOTE_DEVICE | FILE_REMOVABLE_MEDIA))
|
||||||
{
|
{
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue