mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Remove the permanent flag from an object if ObInserObject failed (in IoCreateFile).
- Bypass the driver for FilePositionInformation and FileAlignmentInformation in NtQueryInformationFile and NtSetInformationFile. svn path=/trunk/; revision=16755
This commit is contained in:
parent
dd90242aa7
commit
1bae97d5ce
1 changed files with 74 additions and 5 deletions
|
@ -845,6 +845,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n");
|
||||
}
|
||||
|
||||
/* First try to open an existing named object */
|
||||
Status = ObOpenObjectByName(ObjectAttributes,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -910,6 +911,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("ObInsertObject() failed! (Status %lx)\n", Status);
|
||||
ObMakeTemporaryObject(FileObject);
|
||||
ObDereferenceObject (FileObject);
|
||||
return Status;
|
||||
}
|
||||
|
@ -2429,11 +2431,6 @@ NtQueryInformationFile(HANDLE FileHandle,
|
|||
Failed = TRUE;
|
||||
break;
|
||||
|
||||
case FileAlignmentInformation:
|
||||
if (!(FileObject->Flags & FO_NO_INTERMEDIATE_BUFFERING))
|
||||
Failed = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -2445,6 +2442,30 @@ NtQueryInformationFile(HANDLE FileHandle,
|
|||
return STATUS_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
if (FileInformationClass == FilePositionInformation)
|
||||
{
|
||||
if (Length < sizeof(FILE_POSITION_INFORMATION))
|
||||
{
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
((PFILE_POSITION_INFORMATION)FileInformation)->CurrentByteOffset = FileObject->CurrentByteOffset;
|
||||
IoStatusBlock->Information = sizeof(FILE_POSITION_INFORMATION);
|
||||
Status = IoStatusBlock->Status = STATUS_SUCCESS;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
ObDereferenceObject(FileObject);
|
||||
return Status;
|
||||
}
|
||||
|
||||
DPRINT("FileObject 0x%p\n", FileObject);
|
||||
|
||||
/* Check if this is a direct open or not */
|
||||
|
@ -2457,6 +2478,30 @@ NtQueryInformationFile(HANDLE FileHandle,
|
|||
DeviceObject = IoGetRelatedDeviceObject(FileObject);
|
||||
}
|
||||
|
||||
if (FileInformationClass == FileAlignmentInformation)
|
||||
{
|
||||
if (Length < sizeof(FILE_ALIGNMENT_INFORMATION))
|
||||
{
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
((PFILE_ALIGNMENT_INFORMATION)FileInformation)->AlignmentRequirement = DeviceObject->AlignmentRequirement;
|
||||
IoStatusBlock->Information = sizeof(FILE_ALIGNMENT_INFORMATION);
|
||||
Status = IoStatusBlock->Status = STATUS_SUCCESS;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
ObDereferenceObject(FileObject);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check if we should use Sync IO or not */
|
||||
if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
{
|
||||
|
@ -2895,6 +2940,30 @@ NtSetInformationFile(HANDLE FileHandle,
|
|||
|
||||
DPRINT("FileObject 0x%p\n", FileObject);
|
||||
|
||||
if (FileInformationClass == FilePositionInformation)
|
||||
{
|
||||
if (Length < sizeof(FILE_POSITION_INFORMATION))
|
||||
{
|
||||
Status = STATUS_BUFFER_OVERFLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
FileObject->CurrentByteOffset = ((PFILE_POSITION_INFORMATION)FileInformation)->CurrentByteOffset;
|
||||
IoStatusBlock->Information = 0;
|
||||
Status = IoStatusBlock->Status = STATUS_SUCCESS;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
ObDereferenceObject(FileObject);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* FIXME: Later, we can implement a lot of stuff here and avoid a driver call */
|
||||
/* Handle IO Completion Port quickly */
|
||||
if (FileInformationClass == FileCompletionInformation)
|
||||
|
|
Loading…
Reference in a new issue