mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 05:00:27 +00:00
[NTFS]
- Implement NtfsGetUserBuffer() that will (attempt to) return the user output buffer for METHOD_NEITHER IOCTL. - Implement parameters checking GetVolumeBitmap() CORE-8725 svn path=/trunk/; revision=65638
This commit is contained in:
parent
508364d0b2
commit
c16d33beae
4 changed files with 68 additions and 0 deletions
|
@ -20,6 +20,7 @@ list(APPEND SOURCE
|
||||||
|
|
||||||
add_library(ntfs SHARED ${SOURCE} ntfs.rc)
|
add_library(ntfs SHARED ${SOURCE} ntfs.rc)
|
||||||
set_module_type(ntfs kernelmodedriver)
|
set_module_type(ntfs kernelmodedriver)
|
||||||
|
target_link_libraries(ntfs ${PSEH_LIB})
|
||||||
add_importlibs(ntfs ntoskrnl hal)
|
add_importlibs(ntfs ntoskrnl hal)
|
||||||
add_pch(ntfs ntfs.h SOURCE)
|
add_pch(ntfs ntfs.h SOURCE)
|
||||||
add_cd_file(TARGET ntfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
|
add_cd_file(TARGET ntfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
|
||||||
|
|
|
@ -661,8 +661,58 @@ NTSTATUS
|
||||||
GetVolumeBitmap(PDEVICE_EXTENSION DeviceExt,
|
GetVolumeBitmap(PDEVICE_EXTENSION DeviceExt,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
PIO_STACK_LOCATION Stack;
|
||||||
|
PVOLUME_BITMAP_BUFFER BitmapBuffer;
|
||||||
|
|
||||||
DPRINT1("GetVolumeBitmap(%p, %p)\n", DeviceExt, Irp);
|
DPRINT1("GetVolumeBitmap(%p, %p)\n", DeviceExt, Irp);
|
||||||
|
|
||||||
|
Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
|
if (Stack->Parameters.FileSystemControl.InputBufferLength < sizeof(STARTING_LCN_INPUT_BUFFER))
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid input! %d\n", Stack->Parameters.FileSystemControl.InputBufferLength);
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Stack->Parameters.FileSystemControl.OutputBufferLength < sizeof(VOLUME_BITMAP_BUFFER))
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid output! %d\n", Stack->Parameters.FileSystemControl.OutputBufferLength);
|
||||||
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapBuffer = NtfsGetUserBuffer(Irp);
|
||||||
|
if (Irp->RequestorMode == UserMode)
|
||||||
|
{
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
ProbeForRead(Stack->Parameters.FileSystemControl.Type3InputBuffer,
|
||||||
|
Stack->Parameters.FileSystemControl.InputBufferLength,
|
||||||
|
sizeof(CHAR));
|
||||||
|
ProbeForWrite(BitmapBuffer, Stack->Parameters.FileSystemControl.OutputBufferLength,
|
||||||
|
sizeof(CHAR));
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Stack->Parameters.FileSystemControl.Type3InputBuffer == NULL ||
|
||||||
|
BitmapBuffer == NULL)
|
||||||
|
{
|
||||||
|
Status = STATUS_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("Invalid buffer! %p %p\n", Stack->Parameters.FileSystemControl.Type3InputBuffer, BitmapBuffer);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,4 +112,17 @@ NtfsFileFlagsToAttributes(ULONG NtfsAttributes,
|
||||||
*FileAttributes = FILE_ATTRIBUTE_NORMAL;
|
*FileAttributes = FILE_ATTRIBUTE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NtfsGetUserBuffer(PIRP Irp)
|
||||||
|
{
|
||||||
|
if (Irp->MdlAddress != NULL)
|
||||||
|
{
|
||||||
|
return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, HighPagePriority);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Irp->UserBuffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define NTFS_H
|
#define NTFS_H
|
||||||
|
|
||||||
#include <ntifs.h>
|
#include <ntifs.h>
|
||||||
|
#include <pseh/pseh2.h>
|
||||||
|
|
||||||
#define CACHEPAGESIZE(pDeviceExt) \
|
#define CACHEPAGESIZE(pDeviceExt) \
|
||||||
((pDeviceExt)->NtfsInfo.UCHARsPerCluster > PAGE_SIZE ? \
|
((pDeviceExt)->NtfsInfo.UCHARsPerCluster > PAGE_SIZE ? \
|
||||||
|
@ -729,6 +730,9 @@ PNTFS_IRP_CONTEXT
|
||||||
NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
|
NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp);
|
PIRP Irp);
|
||||||
|
|
||||||
|
PVOID
|
||||||
|
NtfsGetUserBuffer(PIRP Irp);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
wstrcmpjoki(PWSTR s1, PWSTR s2);
|
wstrcmpjoki(PWSTR s1, PWSTR s2);
|
||||||
|
|
Loading…
Reference in a new issue