mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Implement IO_NO_PARAMETER_CHECKING flag
svn path=/trunk/; revision=13256
This commit is contained in:
parent
d7aea92eeb
commit
93551abbd2
3 changed files with 46 additions and 12 deletions
|
@ -160,6 +160,11 @@ enum
|
|||
#define SL_INVOKE_ON_SUCCESS 0x40
|
||||
#define SL_INVOKE_ON_ERROR 0x80
|
||||
|
||||
/*
|
||||
* IoCreateFile options
|
||||
*/
|
||||
#define IO_NO_PARAMETER_CHECKING 0x100
|
||||
|
||||
/*
|
||||
* Possible flags for the device object flags
|
||||
*/
|
||||
|
|
|
@ -321,7 +321,7 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
|||
* @implemented
|
||||
*/
|
||||
NTSTATUS STDCALL
|
||||
IoCreateFile(OUT PHANDLE FileHandle,
|
||||
IoCreateFile(OUT PHANDLE FileHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||||
|
@ -341,7 +341,9 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackLoc;
|
||||
IO_SECURITY_CONTEXT SecurityContext;
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
KPROCESSOR_MODE PreviousMode;
|
||||
HANDLE LocalFileHandle;
|
||||
IO_STATUS_BLOCK LocalIoStatusBlock;
|
||||
|
||||
DPRINT("IoCreateFile(FileHandle %x, DesiredAccess %x, "
|
||||
"ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
|
||||
|
@ -350,14 +352,14 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
|
||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||
|
||||
if (IoStatusBlock == NULL)
|
||||
return STATUS_ACCESS_VIOLATION;
|
||||
if (IoStatusBlock == NULL || FileHandle == NULL)
|
||||
return STATUS_ACCESS_VIOLATION;
|
||||
|
||||
*FileHandle = 0;
|
||||
LocalFileHandle = 0;
|
||||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
Status = ObCreateObject(PreviousMode,
|
||||
Status = ObCreateObject(0 == (Options & IO_NO_PARAMETER_CHECKING) ? PreviousMode : KernelMode,
|
||||
IoFileObjectType,
|
||||
ObjectAttributes,
|
||||
PreviousMode,
|
||||
|
@ -380,7 +382,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
DesiredAccess,
|
||||
0,
|
||||
NULL,
|
||||
FileHandle);
|
||||
&LocalFileHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("ObInsertObject() failed! (Status %lx)\n", Status);
|
||||
|
@ -418,14 +420,14 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, FALSE);
|
||||
if (Irp == NULL)
|
||||
{
|
||||
ZwClose(*FileHandle);
|
||||
ZwClose(LocalFileHandle);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
//trigger FileObject/Event dereferencing
|
||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
||||
Irp->RequestorMode = PreviousMode;
|
||||
Irp->UserIosb = IoStatusBlock;
|
||||
Irp->UserIosb = &LocalIoStatusBlock;
|
||||
Irp->AssociatedIrp.SystemBuffer = EaBuffer;
|
||||
Irp->Tail.Overlay.AuxiliaryBuffer = NULL;
|
||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||
|
@ -493,7 +495,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
PreviousMode,
|
||||
FALSE,
|
||||
NULL);
|
||||
Status = IoStatusBlock->Status;
|
||||
Status = LocalIoStatusBlock.Status;
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -501,7 +503,34 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
FileObject->DeviceObject = NULL;
|
||||
FileObject->Vpb = NULL;
|
||||
|
||||
ZwClose(*FileHandle);
|
||||
ZwClose(LocalFileHandle);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (KernelMode == PreviousMode || 0 != (Options & IO_NO_PARAMETER_CHECKING))
|
||||
{
|
||||
*FileHandle = LocalFileHandle;
|
||||
*IoStatusBlock = LocalIoStatusBlock;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
ProbeForWrite(FileHandle,
|
||||
sizeof(HANDLE),
|
||||
sizeof(ULONG));
|
||||
*FileHandle = LocalFileHandle;
|
||||
ProbeForWrite(IoStatusBlock,
|
||||
sizeof(IO_STATUS_BLOCK),
|
||||
sizeof(ULONG));
|
||||
*IoStatusBlock = LocalIoStatusBlock;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||
|
|
|
@ -833,7 +833,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
|
|||
0,
|
||||
CreateFileTypeNone,
|
||||
NULL,
|
||||
SL_OPEN_PAGING_FILE);
|
||||
SL_OPEN_PAGING_FILE | IO_NO_PARAMETER_CHECKING);
|
||||
RtlReleaseCapturedUnicodeString(&CapturedFileName,
|
||||
PreviousMode,
|
||||
FALSE);
|
||||
|
|
Loading…
Reference in a new issue