mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 06:43:01 +00:00
[FORMATTING] - Fix formatting in IoCreateFile
svn path=/trunk/; revision=22868
This commit is contained in:
parent
284101e016
commit
54c6ba2513
1 changed files with 188 additions and 297 deletions
|
@ -795,199 +795,121 @@ IoCheckQuotaBufferValidity(IN PFILE_QUOTA_INFORMATION QuotaBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NAME EXPORTED
|
|
||||||
* IoCreateFile@56
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Either causes a new file or directory to be created, or it
|
|
||||||
* opens an existing file, device, directory or volume, giving
|
|
||||||
* the caller a handle for the file object. This handle can be
|
|
||||||
* used by subsequent calls to manipulate data within the file
|
|
||||||
* or the file object's state of attributes.
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* FileHandle (OUT)
|
|
||||||
* Points to a variable which receives the file handle
|
|
||||||
* on return;
|
|
||||||
*
|
|
||||||
* DesiredAccess
|
|
||||||
* Desired access to the file;
|
|
||||||
*
|
|
||||||
* ObjectAttributes
|
|
||||||
* Structure describing the file;
|
|
||||||
*
|
|
||||||
* IoStatusBlock (OUT)
|
|
||||||
* Receives information about the operation on return;
|
|
||||||
*
|
|
||||||
* AllocationSize [OPTIONAL]
|
|
||||||
* Initial size of the file in bytes;
|
|
||||||
*
|
|
||||||
* FileAttributes
|
|
||||||
* Attributes to create the file with;
|
|
||||||
*
|
|
||||||
* ShareAccess
|
|
||||||
* Type of shared access the caller would like to the
|
|
||||||
* file;
|
|
||||||
*
|
|
||||||
* CreateDisposition
|
|
||||||
* Specifies what to do, depending on whether the
|
|
||||||
* file already exists;
|
|
||||||
*
|
|
||||||
* CreateOptions
|
|
||||||
* Options for creating a new file;
|
|
||||||
*
|
|
||||||
* EaBuffer [OPTIONAL]
|
|
||||||
* Undocumented;
|
|
||||||
*
|
|
||||||
* EaLength
|
|
||||||
* Undocumented;
|
|
||||||
*
|
|
||||||
* CreateFileType
|
|
||||||
* Type of file (normal, named pipe, mailslot) to create;
|
|
||||||
*
|
|
||||||
* ExtraCreateParameters [OPTIONAL]
|
|
||||||
* Additional creation data for named pipe and mailsots;
|
|
||||||
*
|
|
||||||
* Options
|
|
||||||
* Undocumented.
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* Status
|
|
||||||
*
|
|
||||||
* NOTE
|
|
||||||
* Prototype taken from Bo Branten's ntifs.h v15.
|
|
||||||
* Description taken from old NtCreateFile's which is
|
|
||||||
* now a wrapper of this call.
|
|
||||||
*
|
|
||||||
* REVISIONS
|
|
||||||
*
|
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
NTAPI
|
||||||
IoCreateFile(OUT PHANDLE FileHandle,
|
IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
IN ACCESS_MASK DesiredAccess,
|
IN ACCESS_MASK DesiredAccess,
|
||||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||||
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
OUT PIO_STATUS_BLOCK IoStatusBlock,
|
||||||
IN PLARGE_INTEGER AllocationSize OPTIONAL,
|
IN PLARGE_INTEGER AllocationSize OPTIONAL,
|
||||||
IN ULONG FileAttributes,
|
IN ULONG FileAttributes,
|
||||||
IN ULONG ShareAccess,
|
IN ULONG ShareAccess,
|
||||||
IN ULONG CreateDisposition,
|
IN ULONG CreateDisposition,
|
||||||
IN ULONG CreateOptions,
|
IN ULONG CreateOptions,
|
||||||
IN PVOID EaBuffer OPTIONAL,
|
IN PVOID EaBuffer OPTIONAL,
|
||||||
IN ULONG EaLength,
|
IN ULONG EaLength,
|
||||||
IN CREATE_FILE_TYPE CreateFileType,
|
IN CREATE_FILE_TYPE CreateFileType,
|
||||||
IN PVOID ExtraCreateParameters OPTIONAL,
|
IN PVOID ExtraCreateParameters OPTIONAL,
|
||||||
IN ULONG Options)
|
IN ULONG Options)
|
||||||
{
|
{
|
||||||
PFILE_OBJECT FileObject = NULL;
|
PFILE_OBJECT FileObject = NULL;
|
||||||
//PDEVICE_OBJECT DeviceObject;
|
PIRP Irp;
|
||||||
PIRP Irp;
|
PEXTENDED_IO_STACK_LOCATION StackLoc;
|
||||||
PEXTENDED_IO_STACK_LOCATION StackLoc;
|
IO_SECURITY_CONTEXT SecurityContext;
|
||||||
IO_SECURITY_CONTEXT SecurityContext;
|
KPROCESSOR_MODE AccessMode;
|
||||||
KPROCESSOR_MODE AccessMode;
|
HANDLE LocalHandle = 0;
|
||||||
HANDLE LocalHandle;
|
LARGE_INTEGER SafeAllocationSize;
|
||||||
LARGE_INTEGER SafeAllocationSize;
|
PVOID SystemEaBuffer = NULL;
|
||||||
PVOID SystemEaBuffer = NULL;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
AUX_DATA AuxData;
|
||||||
AUX_DATA AuxData;
|
ACCESS_STATE AccessState;
|
||||||
ACCESS_STATE AccessState;
|
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PKNORMAL_ROUTINE NormalRoutine;
|
PKNORMAL_ROUTINE NormalRoutine;
|
||||||
PVOID NormalContext;
|
PVOID NormalContext;
|
||||||
|
PAGED_CODE();
|
||||||
|
|
||||||
DPRINT("IoCreateFile(FileHandle 0x%p, DesiredAccess %x, "
|
if(Options & IO_NO_PARAMETER_CHECKING)
|
||||||
"ObjectAttributes 0x%p ObjectAttributes->ObjectName->Buffer %S)\n",
|
{
|
||||||
FileHandle,DesiredAccess,ObjectAttributes,
|
AccessMode = KernelMode;
|
||||||
ObjectAttributes->ObjectName->Buffer);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AccessMode = ExGetPreviousMode();
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
if(AccessMode != KernelMode)
|
||||||
|
{
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
|
ProbeForWriteHandle(FileHandle);
|
||||||
|
ProbeForWrite(IoStatusBlock,
|
||||||
|
sizeof(IO_STATUS_BLOCK),
|
||||||
|
sizeof(ULONG));
|
||||||
|
if (AllocationSize)
|
||||||
|
{
|
||||||
|
SafeAllocationSize = ProbeForReadLargeInteger(AllocationSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SafeAllocationSize.QuadPart = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (IoStatusBlock == NULL || FileHandle == NULL)
|
if ((EaBuffer) && (EaLength))
|
||||||
return STATUS_ACCESS_VIOLATION;
|
{
|
||||||
|
ProbeForRead(EaBuffer,
|
||||||
|
EaLength,
|
||||||
|
sizeof(ULONG));
|
||||||
|
|
||||||
LocalHandle = 0;
|
/* marshal EaBuffer */
|
||||||
|
SystemEaBuffer = ExAllocatePool(NonPagedPool, EaLength);
|
||||||
|
if(!SystemEaBuffer)
|
||||||
|
{
|
||||||
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
_SEH_LEAVE;
|
||||||
|
}
|
||||||
|
|
||||||
if(Options & IO_NO_PARAMETER_CHECKING)
|
RtlCopyMemory(SystemEaBuffer, EaBuffer, EaLength);
|
||||||
AccessMode = KernelMode;
|
}
|
||||||
else
|
}
|
||||||
AccessMode = ExGetPreviousMode();
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
|
||||||
if(AccessMode != KernelMode)
|
if(!NT_SUCCESS(Status)) return Status;
|
||||||
{
|
}
|
||||||
_SEH_TRY
|
else
|
||||||
{
|
{
|
||||||
ProbeForWriteHandle(FileHandle);
|
if (AllocationSize)
|
||||||
ProbeForWrite(IoStatusBlock,
|
{
|
||||||
sizeof(IO_STATUS_BLOCK),
|
SafeAllocationSize = *AllocationSize;
|
||||||
sizeof(ULONG));
|
}
|
||||||
if(AllocationSize != NULL)
|
else
|
||||||
{
|
{
|
||||||
SafeAllocationSize = ProbeForReadLargeInteger(AllocationSize);
|
SafeAllocationSize.QuadPart = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
SafeAllocationSize.QuadPart = 0;
|
|
||||||
|
|
||||||
if(EaBuffer != NULL && EaLength > 0)
|
if ((EaBuffer) && (EaLength)) SystemEaBuffer = EaBuffer;
|
||||||
{
|
}
|
||||||
ProbeForRead(EaBuffer,
|
|
||||||
EaLength,
|
|
||||||
sizeof(ULONG));
|
|
||||||
|
|
||||||
/* marshal EaBuffer */
|
if(Options & IO_CHECK_CREATE_PARAMETERS)
|
||||||
SystemEaBuffer = ExAllocatePool(NonPagedPool,
|
{
|
||||||
EaLength);
|
DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n");
|
||||||
if(SystemEaBuffer == NULL)
|
}
|
||||||
{
|
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
_SEH_LEAVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlCopyMemory(SystemEaBuffer,
|
RtlMapGenericMask(&DesiredAccess, &IoFileObjectType->TypeInfo.GenericMapping);
|
||||||
EaBuffer,
|
|
||||||
EaLength);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_SEH_HANDLE
|
|
||||||
{
|
|
||||||
Status = _SEH_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH_END;
|
|
||||||
|
|
||||||
if(!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(AllocationSize != NULL)
|
|
||||||
SafeAllocationSize = *AllocationSize;
|
|
||||||
else
|
|
||||||
SafeAllocationSize.QuadPart = 0;
|
|
||||||
|
|
||||||
if(EaBuffer != NULL && EaLength > 0)
|
|
||||||
{
|
|
||||||
SystemEaBuffer = EaBuffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Options & IO_CHECK_CREATE_PARAMETERS)
|
|
||||||
{
|
|
||||||
DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
RtlMapGenericMask(&DesiredAccess, &IoFileObjectType->TypeInfo.GenericMapping);
|
|
||||||
|
|
||||||
/* First try to open an existing named object */
|
|
||||||
Status = ObOpenObjectByName(ObjectAttributes,
|
|
||||||
NULL,
|
|
||||||
AccessMode,
|
|
||||||
NULL,
|
|
||||||
DesiredAccess,
|
|
||||||
NULL,
|
|
||||||
&LocalHandle);
|
|
||||||
|
|
||||||
|
/* First try to open an existing named object */
|
||||||
|
Status = ObOpenObjectByName(ObjectAttributes,
|
||||||
|
NULL,
|
||||||
|
AccessMode,
|
||||||
|
NULL,
|
||||||
|
DesiredAccess,
|
||||||
|
NULL,
|
||||||
|
&LocalHandle);
|
||||||
ObReferenceObjectByHandle(LocalHandle,
|
ObReferenceObjectByHandle(LocalHandle,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -999,10 +921,6 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
FileObject->Type = IO_TYPE_FILE;
|
FileObject->Type = IO_TYPE_FILE;
|
||||||
FileObject->Size = sizeof(FILE_OBJECT);
|
FileObject->Size = sizeof(FILE_OBJECT);
|
||||||
|
|
||||||
//
|
|
||||||
// stop stuff that should be in IopParseDevice
|
|
||||||
//
|
|
||||||
|
|
||||||
if (CreateOptions &
|
if (CreateOptions &
|
||||||
(FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))
|
(FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT))
|
||||||
{
|
{
|
||||||
|
@ -1034,107 +952,84 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
{
|
{
|
||||||
FileObject->Flags |= FO_OPENED_CASE_SENSITIVE;
|
FileObject->Flags |= FO_OPENED_CASE_SENSITIVE;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* FIXME: We should get the access state from Ob once this function becomes
|
|
||||||
* a parse routine once the Ob is refactored.
|
|
||||||
*/
|
|
||||||
SeCreateAccessState(&AccessState, &AuxData, FILE_ALL_ACCESS, NULL);
|
|
||||||
|
|
||||||
SecurityContext.SecurityQos = NULL; /* ?? */
|
SeCreateAccessState(&AccessState, &AuxData, FILE_ALL_ACCESS, NULL);
|
||||||
SecurityContext.AccessState = &AccessState;
|
SecurityContext.SecurityQos = NULL; /* ?? */
|
||||||
SecurityContext.DesiredAccess = DesiredAccess;
|
SecurityContext.AccessState = &AccessState;
|
||||||
SecurityContext.FullCreateOptions = CreateOptions;
|
SecurityContext.DesiredAccess = DesiredAccess;
|
||||||
|
SecurityContext.FullCreateOptions = CreateOptions;
|
||||||
|
|
||||||
KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, TRUE);
|
KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, TRUE);
|
||||||
KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE);
|
KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
DPRINT("FileObject 0x%p\n", FileObject);
|
Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, FALSE);
|
||||||
DPRINT("FileObject->DeviceObject 0x%p\n", FileObject->DeviceObject);
|
if (!Irp)
|
||||||
/*
|
{
|
||||||
* Create a new IRP to hand to
|
ZwClose(LocalHandle);
|
||||||
* the FS driver: this may fail
|
return STATUS_UNSUCCESSFUL;
|
||||||
* due to resource shortage.
|
}
|
||||||
*/
|
|
||||||
Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, FALSE);
|
|
||||||
if (Irp == NULL)
|
|
||||||
{
|
|
||||||
ZwClose(LocalHandle);
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now set the IRP data */
|
/* Now set the IRP data */
|
||||||
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
Irp->Tail.Overlay.OriginalFileObject = FileObject;
|
||||||
Irp->RequestorMode = AccessMode;
|
Irp->RequestorMode = AccessMode;
|
||||||
Irp->Flags = IRP_CREATE_OPERATION |
|
Irp->Flags = IRP_CREATE_OPERATION |
|
||||||
IRP_SYNCHRONOUS_API |
|
IRP_SYNCHRONOUS_API |
|
||||||
IRP_DEFER_IO_COMPLETION;
|
IRP_DEFER_IO_COMPLETION;
|
||||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
Irp->UserEvent = &FileObject->Event;
|
Irp->UserEvent = &FileObject->Event;
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = IoStatusBlock;
|
||||||
Irp->MdlAddress = NULL;
|
Irp->MdlAddress = NULL;
|
||||||
Irp->PendingReturned = FALSE;
|
Irp->PendingReturned = FALSE;
|
||||||
Irp->UserEvent = NULL;
|
Irp->UserEvent = NULL;
|
||||||
Irp->Cancel = FALSE;
|
Irp->Cancel = FALSE;
|
||||||
Irp->CancelRoutine = NULL;
|
Irp->CancelRoutine = NULL;
|
||||||
Irp->Tail.Overlay.AuxiliaryBuffer = NULL;
|
Irp->Tail.Overlay.AuxiliaryBuffer = NULL;
|
||||||
|
|
||||||
/*
|
StackLoc = (PEXTENDED_IO_STACK_LOCATION)IoGetNextIrpStackLocation(Irp);
|
||||||
* Get the stack location for the new
|
StackLoc->Control = 0;
|
||||||
* IRP and prepare it.
|
StackLoc->FileObject = FileObject;
|
||||||
*/
|
|
||||||
StackLoc = (PEXTENDED_IO_STACK_LOCATION)IoGetNextIrpStackLocation(Irp);
|
|
||||||
StackLoc->Control = 0;
|
|
||||||
StackLoc->FileObject = FileObject;
|
|
||||||
|
|
||||||
switch (CreateFileType)
|
switch (CreateFileType)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case CreateFileTypeNone:
|
case CreateFileTypeNone:
|
||||||
StackLoc->MajorFunction = IRP_MJ_CREATE;
|
StackLoc->MajorFunction = IRP_MJ_CREATE;
|
||||||
StackLoc->Flags = Options;
|
StackLoc->Flags = Options;
|
||||||
StackLoc->Parameters.Create.EaLength = SystemEaBuffer != NULL ? EaLength : 0;
|
StackLoc->Parameters.Create.EaLength = SystemEaBuffer != NULL ? EaLength : 0;
|
||||||
StackLoc->Flags |= !(ObjectAttributes->Attributes & OBJ_CASE_INSENSITIVE) ? SL_CASE_SENSITIVE: 0;
|
StackLoc->Flags |= !(ObjectAttributes->Attributes & OBJ_CASE_INSENSITIVE) ? SL_CASE_SENSITIVE: 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CreateFileTypeNamedPipe:
|
case CreateFileTypeNamedPipe:
|
||||||
StackLoc->MajorFunction = IRP_MJ_CREATE_NAMED_PIPE;
|
StackLoc->MajorFunction = IRP_MJ_CREATE_NAMED_PIPE;
|
||||||
StackLoc->Parameters.CreatePipe.Parameters = ExtraCreateParameters;
|
StackLoc->Parameters.CreatePipe.Parameters = ExtraCreateParameters;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CreateFileTypeMailslot:
|
case CreateFileTypeMailslot:
|
||||||
StackLoc->MajorFunction = IRP_MJ_CREATE_MAILSLOT;
|
StackLoc->MajorFunction = IRP_MJ_CREATE_MAILSLOT;
|
||||||
StackLoc->Parameters.CreateMailslot.Parameters = ExtraCreateParameters;
|
StackLoc->Parameters.CreateMailslot.Parameters = ExtraCreateParameters;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the common data */
|
/* Set the common data */
|
||||||
Irp->Overlay.AllocationSize = SafeAllocationSize;
|
Irp->Overlay.AllocationSize = SafeAllocationSize;
|
||||||
Irp->AssociatedIrp.SystemBuffer = SystemEaBuffer;
|
Irp->AssociatedIrp.SystemBuffer = SystemEaBuffer;
|
||||||
StackLoc->Parameters.Create.Options = (CreateDisposition << 24) | (CreateOptions & 0x00FFFFFF);
|
StackLoc->Parameters.Create.Options = (CreateDisposition << 24) | (CreateOptions & 0x00FFFFFF);
|
||||||
StackLoc->Parameters.Create.FileAttributes = FileAttributes;
|
StackLoc->Parameters.Create.FileAttributes = FileAttributes;
|
||||||
StackLoc->Parameters.Create.ShareAccess = ShareAccess;
|
StackLoc->Parameters.Create.ShareAccess = ShareAccess;
|
||||||
StackLoc->Parameters.Create.SecurityContext = &SecurityContext;
|
StackLoc->Parameters.Create.SecurityContext = &SecurityContext;
|
||||||
|
|
||||||
/*
|
Status = IofCallDriver(FileObject->DeviceObject, Irp );
|
||||||
* Now call the driver and
|
if (Status == STATUS_PENDING)
|
||||||
* possibly wait if it can
|
{
|
||||||
* not complete the request
|
KeWaitForSingleObject(&FileObject->Event,
|
||||||
* immediately.
|
Executive,
|
||||||
*/
|
AccessMode,
|
||||||
Status = IofCallDriver(FileObject->DeviceObject, Irp );
|
FALSE,
|
||||||
DPRINT("Status :%x\n", Status);
|
NULL);
|
||||||
|
Status = IoStatusBlock->Status;
|
||||||
if (Status == STATUS_PENDING)
|
}
|
||||||
{
|
else
|
||||||
KeWaitForSingleObject(&FileObject->Event,
|
{
|
||||||
Executive,
|
|
||||||
AccessMode,
|
|
||||||
FALSE,
|
|
||||||
NULL);
|
|
||||||
Status = IoStatusBlock->Status;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* We'll have to complete it ourselves */
|
/* We'll have to complete it ourselves */
|
||||||
ASSERT(!Irp->PendingReturned);
|
ASSERT(!Irp->PendingReturned);
|
||||||
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
KeRaiseIrql(APC_LEVEL, &OldIrql);
|
||||||
|
@ -1144,38 +1039,34 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
(PVOID*)&FileObject,
|
(PVOID*)&FileObject,
|
||||||
&NormalContext);
|
&NormalContext);
|
||||||
KeLowerIrql(OldIrql);
|
KeLowerIrql(OldIrql);
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT("Failing create request with status %x\n", Status);
|
|
||||||
FileObject->DeviceObject = NULL;
|
|
||||||
FileObject->Vpb = NULL;
|
|
||||||
ObDereferenceObject(FileObject);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_SEH_TRY
|
|
||||||
{
|
|
||||||
*FileHandle = LocalHandle;
|
|
||||||
}
|
|
||||||
_SEH_HANDLE
|
|
||||||
{
|
|
||||||
Status = _SEH_GetExceptionCode();
|
|
||||||
}
|
|
||||||
_SEH_END;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* cleanup EABuffer if captured */
|
if (!NT_SUCCESS(Status))
|
||||||
if(AccessMode != KernelMode && SystemEaBuffer != NULL)
|
{
|
||||||
{
|
FileObject->DeviceObject = NULL;
|
||||||
ExFreePool(SystemEaBuffer);
|
FileObject->Vpb = NULL;
|
||||||
}
|
ObDereferenceObject(FileObject);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_SEH_TRY
|
||||||
|
{
|
||||||
|
*FileHandle = LocalHandle;
|
||||||
|
}
|
||||||
|
_SEH_HANDLE
|
||||||
|
{
|
||||||
|
Status = _SEH_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH_END;
|
||||||
|
}
|
||||||
|
|
||||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
/* cleanup EABuffer if captured */
|
||||||
|
if (AccessMode != KernelMode && (SystemEaBuffer))
|
||||||
|
{
|
||||||
|
ExFreePool(SystemEaBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("Finished IoCreateFile() (*FileHandle) 0x%p\n", (*FileHandle));
|
return Status;
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue