Fix NtWriteFile: Get right Deviceobject, Use FileObject->FinalStatus, use FileObject-.CurrentByteOffset if ByteOffset == FILE_USER_FILE_POINTER_POSITION, add SEH, use right event requested access, set IRP_WRITE_OPERATION flag, add support for IRP_NOCACHE and add support for SL_WRITE_THROUGH if FO_WRITE_THROUGH is enabled. Modified: trunk/reactos/ntoskrnl/io/file.c _____
Modified: trunk/reactos/ntoskrnl/io/file.c --- trunk/reactos/ntoskrnl/io/file.c 2005-05-09 02:04:53 UTC (rev 15174) +++ trunk/reactos/ntoskrnl/io/file.c 2005-05-09 02:15:03 UTC (rev 15175) @@ -3,7 +3,7 @@
* PROJECT: ReactOS kernel * FILE: ntoskrnl/io/file.c * PURPOSE: I/O File Object & NT File Handle Access/Managment of Files. - * + * * PROGRAMMERS: David Welch (welch@mcmail.com) */
@@ -23,8 +23,8 @@
/* INTERNAL FUNCTIONS ********************************************************/
-static -NTSTATUS +static +NTSTATUS STDCALL IopLockFileCompletionRoutine(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, @@ -38,16 +38,16 @@ /* * NAME INTERNAL * IopCreateFile - * + * * DESCRIPTION - * + * * ARGUMENTS - * + * * RETURN VALUE * * REVISIONS */ -NTSTATUS +NTSTATUS STDCALL IopCreateFile(PVOID ObjectBody, PVOID Parent, @@ -173,7 +173,7 @@ return(STATUS_SUCCESS); }
-VOID +VOID STDCALL IopDeleteFile(PVOID ObjectBody) { @@ -183,11 +183,11 @@ NTSTATUS Status; KEVENT Event; PDEVICE_OBJECT DeviceObject; - + DPRINT("IopDeleteFile()\n");
if (FileObject->DeviceObject) - { + { /* Check if this is a direct open or not */ if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) { @@ -197,46 +197,46 @@ { DeviceObject = IoGetRelatedDeviceObject(FileObject); } - + /* Clear and set up Events */ KeClearEvent(&FileObject->Event); KeInitializeEvent(&Event, SynchronizationEvent, FALSE); - + /* Allocate an IRP */ Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); - + /* Set it up */ Irp->UserEvent = &Event; Irp->UserIosb = &Irp->IoStatus; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Tail.Overlay.OriginalFileObject = FileObject; Irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API; - + /* Set up Stack Pointer Data */ StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr->MajorFunction = IRP_MJ_CLOSE; StackPtr->DeviceObject = DeviceObject; StackPtr->FileObject = FileObject; - + /* Call the FS Driver */ Status = IoCallDriver(DeviceObject, Irp); - + /* Wait for completion */ if (Status == STATUS_PENDING) { KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); } IoFreeIrp(Irp); - + }
- /* Clear the file name */ + /* Clear the file name */ if (FileObject->FileName.Buffer) { ExFreePool(FileObject->FileName.Buffer); FileObject->FileName.Buffer = NULL; } - + /* Free the completion context */ if (FileObject->CompletionContext) { @@ -245,7 +245,7 @@ } }
-static +static NTSTATUS IopSetDefaultSecurityDescriptor(SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor, @@ -489,7 +489,7 @@ return Status; }
-VOID +VOID STDCALL IopCloseFile(PVOID ObjectBody, ULONG HandleCount) @@ -500,9 +500,9 @@ PIO_STACK_LOCATION StackPtr; NTSTATUS Status; PDEVICE_OBJECT DeviceObject; - + DPRINT("IopCloseFile()\n"); - + if (HandleCount > 1 || FileObject->DeviceObject == NULL) return;
/* Check if this is a direct open or not */ @@ -514,29 +514,29 @@ { DeviceObject = IoGetRelatedDeviceObject(FileObject); } - + /* Clear and set up Events */ KeClearEvent(&FileObject->Event); KeInitializeEvent(&Event, SynchronizationEvent, FALSE); - + /* Allocate an IRP */ Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); - + /* Set it up */ Irp->UserEvent = &Event; Irp->UserIosb = &Irp->IoStatus; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Tail.Overlay.OriginalFileObject = FileObject; Irp->Flags = IRP_CLOSE_OPERATION | IRP_SYNCHRONOUS_API; - + /* Set up Stack Pointer Data */ StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr->MajorFunction = IRP_MJ_CLEANUP; StackPtr->FileObject = FileObject; - + /* Call the FS Driver */ Status = IoCallDriver(DeviceObject, Irp); - + /* Wait for completion */ if (Status == STATUS_PENDING) { @@ -576,60 +576,60 @@ /* * 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 * @@ -637,12 +637,12 @@ * 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 */ -NTSTATUS +NTSTATUS STDCALL IoCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, @@ -670,12 +670,12 @@ LARGE_INTEGER SafeAllocationSize; PVOID SystemEaBuffer = NULL; NTSTATUS Status = STATUS_SUCCESS; - + DPRINT("IoCreateFile(FileHandle %x, DesiredAccess %x, " "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", FileHandle,DesiredAccess,ObjectAttributes, ObjectAttributes->ObjectName->Buffer); - + ASSERT_IRQL(PASSIVE_LEVEL);
if (IoStatusBlock == NULL || FileHandle == NULL) @@ -687,7 +687,7 @@ AccessMode = KernelMode; else AccessMode = ExGetPreviousMode(); - + if(AccessMode != KernelMode) { _SEH_TRY @@ -733,7 +733,7 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; - + if(!NT_SUCCESS(Status)) { return Status; @@ -775,7 +775,7 @@ AccessMode, (PVOID*)&DeviceObject, NULL); - ZwClose(LocalHandle); + ZwClose(LocalHandle); if (!NT_SUCCESS(Status)) { return Status; @@ -808,9 +808,9 @@ return Status; } } - RtlMapGenericMask(&DesiredAccess, + RtlMapGenericMask(&DesiredAccess, BODY_TO_HEADER(FileObject)->ObjectType->Mapping); - + Status = ObInsertObject ((PVOID)FileObject, NULL, DesiredAccess, @@ -840,10 +840,10 @@ SecurityContext.AccessState = NULL; /* ?? */ SecurityContext.DesiredAccess = DesiredAccess; SecurityContext.FullCreateOptions = 0; /* ?? */ - + KeInitializeEvent(&FileObject->Lock, SynchronizationEvent, TRUE); KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE); - + DPRINT("FileObject %x\n", FileObject); DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject); /* @@ -867,7 +867,7 @@ Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->UserEvent = &FileObject->Event; Irp->Overlay.AllocationSize = SafeAllocationSize; - + /* * Get the stack location for the new * IRP and prepare it. @@ -891,7 +891,7 @@ StackLoc->Parameters.Create.ShareAccess = (USHORT)ShareAccess; StackLoc->Parameters.Create.EaLength = SystemEaBuffer != NULL ? EaLength : 0; break; - + case CreateFileTypeNamedPipe: StackLoc->MajorFunction = IRP_MJ_CREATE_NAMED_PIPE; StackLoc->Parameters.CreatePipe.SecurityContext = &SecurityContext; @@ -919,7 +919,7 @@ */ Status = IofCallDriver(FileObject->DeviceObject, Irp ); DPRINT("Status :%x\n", Status); - + if (Status == STATUS_PENDING) { KeWaitForSingleObject(&FileObject->Event, @@ -992,25 +992,25 @@ /* * NAME EXPORTED * IoCreateStreamFileObject@8 - * + * * DESCRIPTION - * + * * ARGUMENTS * FileObject * ? - * + * * DeviceObject * ? - * + * * RETURN VALUE * * NOTE - * + * * REVISIONS - * + * * @implemented */ -PFILE_OBJECT +PFILE_OBJECT STDCALL IoCreateStreamFileObject(PFILE_OBJECT FileObject, PDEVICE_OBJECT DeviceObject) @@ -1046,14 +1046,14 @@
DPRINT("DeviceObject %x\n", DeviceObject);
- if (DeviceObject->Vpb && + if (DeviceObject->Vpb && DeviceObject->Vpb->DeviceObject) { CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject; } else { - CreatedFileObject->DeviceObject = DeviceObject; + CreatedFileObject->DeviceObject = DeviceObject; } CreatedFileObject->Vpb = DeviceObject->Vpb; CreatedFileObject->Type = IO_TYPE_FILE; @@ -1093,7 +1093,7 @@ /* * @implemented */ -PGENERIC_MAPPING +PGENERIC_MAPPING STDCALL IoGetFileObjectGenericMapping(VOID) { @@ -1126,7 +1126,7 @@ /* * @implemented */ -NTSTATUS +NTSTATUS STDCALL IoQueryFileInformation(IN PFILE_OBJECT FileObject, IN FILE_INFORMATION_CLASS FileInformationClass, @@ -1141,20 +1141,20 @@ BOOLEAN LocalEvent = FALSE; KEVENT Event; NTSTATUS Status; - + ASSERT(FileInformation != NULL); - + Status = ObReferenceObjectByPointer(FileObject, FILE_READ_ATTRIBUTES, IoFileObjectType, KernelMode); if (!NT_SUCCESS(Status)) return(Status); - + DPRINT("FileObject %x\n", FileObject); - + /* Get the Device Object */ DeviceObject = IoGetRelatedDeviceObject(FileObject); - + /* Check if we should use Sync IO or not */ if (FileObject->Flags & FO_SYNCHRONOUS_IO) { @@ -1167,10 +1167,10 @@ KeInitializeEvent(&Event, SynchronizationEvent, FALSE); LocalEvent = TRUE; } - + /* Allocate the IRP */ Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); - + /* Set the IRP */ Irp->Tail.Overlay.OriginalFileObject = FileObject; Irp->RequestorMode = KernelMode; @@ -1179,42 +1179,42 @@ Irp->UserEvent = (LocalEvent) ? &Event : NULL; Irp->Flags = (LocalEvent) ? IRP_SYNCHRONOUS_API : 0; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); - + /* Set the Stack Data */ StackPtr = IoGetNextIrpStackLocation(Irp); - StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION; + StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION; StackPtr->FileObject = FileObject; - + /* Set Parameters */ StackPtr->Parameters.QueryFile.FileInformationClass = FileInformationClass; StackPtr->Parameters.QueryFile.Length = Length; - + /* Call the Driver */ Status = IoCallDriver(FileObject->DeviceObject, Irp); - + if (Status == STATUS_PENDING) { if (LocalEvent) { - KeWaitForSingleObject(&Event, - Executive, - KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FileObject->Flags & FO_ALERTABLE_IO, NULL); Status = IoStatusBlock.Status; } else { KeWaitForSingleObject(&FileObject->Event, - Executive, - KernelMode, - FileObject->Flags & FO_ALERTABLE_IO, + Executive, + KernelMode, + FileObject->Flags & FO_ALERTABLE_IO, NULL); Status = FileObject->FinalStatus; } } - - + + /* Return the Length and Status. ReturnedLength is NOT optional */ *ReturnedLength = IoStatusBlock.Information; return Status; @@ -1235,7 +1235,7 @@ /** * @name NtCancelIoFile * - * Cancel all pending I/O operations in the current thread for specified + * Cancel all pending I/O operations in the current thread for specified * file object. * * @param FileHandle @@ -1249,7 +1249,7 @@ * * @implemented */ -NTSTATUS +NTSTATUS STDCALL NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock) @@ -1293,7 +1293,7 @@ /* Don't break here, we want to cancel all IRPs for the file object. */ OurIrpsInList = TRUE; } - } + }
KfLowerIrql(OldIrql);
@@ -1349,14 +1349,14 @@ /* * NAME EXPORTED * NtCreateFile@44 - * + * * DESCRIPTION * Entry point to call IoCreateFile with * default parameters. * * ARGUMENTS * See IoCreateFile. - * + * * RETURN VALUE * See IoCreateFile. * @@ -1366,7 +1366,7 @@ * * @implemented */ -NTSTATUS +NTSTATUS STDCALL NtCreateFile(PHANDLE FileHandle, ACCESS_MASK DesiredAccess, @@ -1409,14 +1409,14 @@ IN PLARGE_INTEGER TimeOut) { MAILSLOT_CREATE_PARAMETERS Buffer; - + DPRINT("NtCreateMailslotFile(FileHandle %x, DesiredAccess %x, " "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n", FileHandle,DesiredAccess,ObjectAttributes, ObjectAttributes->ObjectName->Buffer); - + ASSERT_IRQL(PASSIVE_LEVEL); - + if (TimeOut != NULL) { Buffer.ReadTimeout.QuadPart = TimeOut->QuadPart; @@ -1506,9 +1506,9 @@ /* * NAME EXPORTED * NtDeleteFile@4 - * + * * DESCRIPTION - * + * * ARGUMENTS * ObjectAttributes * ? @@ -1516,10 +1516,10 @@ * RETURN VALUE * * REVISIONS - * + * * @unimplemented */ -NTSTATUS +NTSTATUS STDCALL NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes) { @@ -1539,10 +1539,10 @@ * FUNCTION: Flushes cached file data to disk * ARGUMENTS: * FileHandle = Points to the file - * IoStatusBlock = Caller must supply storage to receive the result of + * IoStatusBlock = Caller must supply storage to receive the result of * the flush buffers operation. The information field is * set to number of bytes flushed to disk. - * RETURNS: Status + * RETURNS: Status * REMARKS: This function maps to the win32 FlushFileBuffers */ NTSTATUS @@ -1577,7 +1577,7 @@ { DeviceObject = IoGetRelatedDeviceObject(FileObject); } - + /* Check if we should use Sync IO or not */ if (FileObject->Flags & FO_SYNCHRONOUS_IO) { @@ -1597,7 +1597,7 @@ ObDereferenceObject(FileObject); return STATUS_INSUFFICIENT_RESOURCES; } - + /* Set up the IRP */ Irp->Flags = (LocalEvent) ? IRP_SYNCHRONOUS_API : 0; Irp->RequestorMode = PreviousMode; @@ -1610,26 +1610,26 @@ StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr->MajorFunction = IRP_MJ_FLUSH_BUFFERS; StackPtr->FileObject = FileObject; - + /* Call the Driver */ Status = IoCallDriver(DeviceObject, Irp); if (Status == STATUS_PENDING) { if (LocalEvent) { - KeWaitForSingleObject(&Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, + KeWaitForSingleObject(&Event, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, NULL); Status = IoStatusBlock->Status; } else { KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, NULL); Status = FileObject->FinalStatus; } @@ -1645,9 +1645,9 @@ NTSTATUS STDCALL NtNotifyChangeDirectoryFile(IN HANDLE FileHandle, - IN HANDLE Event OPTIONAL, - IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, - IN PVOID ApcContext OPTIONAL, + IN HANDLE Event OPTIONAL, + IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, + IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID Buffer, IN ULONG BufferSize, @@ -1660,13 +1660,13 @@ PIO_STACK_LOCATION IoStack; KPROCESSOR_MODE PreviousMode; NTSTATUS Status = STATUS_SUCCESS; - + DPRINT("NtNotifyChangeDirectoryFile()\n"); - + PAGED_CODE();
PreviousMode = ExGetPreviousMode(); - + if(PreviousMode != KernelMode) { _SEH_TRY @@ -1686,7 +1686,7 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; - + if(!NT_SUCCESS(Status)) { return Status; @@ -1700,18 +1700,18 @@ (PVOID *)&FileObject, NULL); if (Status != STATUS_SUCCESS) return(Status); - - + + DeviceObject = FileObject->DeviceObject; - - + + Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE); if (Irp==NULL) { ObDereferenceObject(FileObject); return STATUS_UNSUCCESSFUL; } - + if (Event == NULL) { Event = &FileObject->Event; @@ -1727,16 +1727,16 @@ Irp->UserBuffer = Buffer; Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - + IoStack = IoGetNextIrpStackLocation(Irp); - + IoStack->MajorFunction = IRP_MJ_DIRECTORY_CONTROL; IoStack->MinorFunction = IRP_MN_NOTIFY_CHANGE_DIRECTORY; IoStack->Flags = 0; IoStack->Control = 0; IoStack->DeviceObject = DeviceObject; IoStack->FileObject = FileObject; - + if (WatchTree) { IoStack->Flags = SL_WATCH_TREE; @@ -1744,7 +1744,7 @@
IoStack->Parameters.NotifyDirectory.CompletionFilter = CompletionFilter; IoStack->Parameters.NotifyDirectory.Length = BufferSize; - + Status = IoCallDriver(FileObject->DeviceObject,Irp);
/* FIXME: Should we wait here or not for synchronously opened files? */ @@ -1915,39 +1915,39 @@ /* * NAME EXPORTED * NtOpenFile@24 - * + * * DESCRIPTION * Opens an existing file (simpler than NtCreateFile). * * ARGUMENTS * FileHandle (OUT) * Variable that receives the file handle on return; - * + * * DesiredAccess * Access desired by the caller to the file; - * + * * ObjectAttributes * Structue describing the file to be opened; - * + * * IoStatusBlock (OUT) * Receives details about the result of the * operation; - * + * * ShareAccess * Type of shared access the caller requires; - * + * * OpenOptions * Options for the file open. * * RETURN VALUE * Status. - * + * * NOTE * Undocumented. * * @implemented */ -NTSTATUS +NTSTATUS STDCALL NtOpenFile(PHANDLE FileHandle, ACCESS_MASK DesiredAccess, @@ -1973,7 +1973,7 @@ 0); }
-NTSTATUS +NTSTATUS STDCALL NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_BASIC_INFORMATION FileInformation) @@ -2028,10 +2028,10 @@ * FileBothDirectoryInformation FILE_BOTH_DIR_INFORMATION * * Length = Size of the storage supplied - * FileInformationClass = Indicates the type of information requested. - * ReturnSingleEntry = Specify true if caller only requests the first + * FileInformationClass = Indicates the type of information requested. + * ReturnSingleEntry = Specify true if caller only requests the first * directory found. - * FileName = Initial directory name to query, that may contain wild + * FileName = Initial directory name to query, that may contain wild * cards. * RestartScan = Number of times the action should be repeated * RETURNS: Status [ STATUS_SUCCESS, STATUS_ACCESS_DENIED, STATUS_INSUFFICIENT_RESOURCES, @@ -2039,7 +2039,7 @@ * STATUS_INVALID_INFO_CLASS, STATUS_NO_SUCH_FILE, STATUS_NO_MORE_FILES ] */ NTSTATUS -STDCALL +STDCALL NtQueryDirectoryFile(IN HANDLE FileHandle, IN HANDLE PEvent OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, @@ -2060,10 +2060,10 @@ NTSTATUS Status = STATUS_SUCCESS; BOOLEAN LocalEvent = FALSE; PKEVENT Event = NULL; - + DPRINT("NtQueryDirectoryFile()\n"); PAGED_CODE(); - + /* Validate User-Mode Buffers */ if(PreviousMode != KernelMode) { @@ -2093,7 +2093,7 @@ (PVOID *)&FileObject, NULL); if (Status != STATUS_SUCCESS) return(Status); - + /* Get Event Object */ if (PEvent) { @@ -2116,7 +2116,7 @@ { DeviceObject = IoGetRelatedDeviceObject(FileObject); } - + /* Check if we should use Sync IO or not */ if (FileObject->Flags & FO_SYNCHRONOUS_IO) { @@ -2127,14 +2127,14 @@ { LocalEvent = TRUE; } - + /* Allocate the IRP */ if (!(Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE))) { ObDereferenceObject(FileObject); return STATUS_INSUFFICIENT_RESOURCES; } - + /* Set up the IRP */ Irp->RequestorMode = PreviousMode; Irp->UserIosb = IoStatusBlock; @@ -2144,13 +2144,13 @@ Irp->UserBuffer = FileInformation; Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine; Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext; - + /* Set up Stack Data */ StackPtr = IoGetNextIrpStackLocation(Irp); StackPtr->FileObject = FileObject; StackPtr->MajorFunction = IRP_MJ_DIRECTORY_CONTROL; StackPtr->MinorFunction = IRP_MN_QUERY_DIRECTORY; - + /* Set Parameters */ StackPtr->Parameters.QueryDirectory.FileInformationClass = FileInformationClass; StackPtr->Parameters.QueryDirectory.FileName = FileName; @@ -2159,7 +2159,7 @@ StackPtr->Flags = 0; if (RestartScan) StackPtr->Flags = SL_RESTART_SCAN; if (ReturnSingleEntry) StackPtr->Flags |= SL_RETURN_SINGLE_ENTRY; - + /* Call the Driver */ Status = IoCallDriver(DeviceObject, Irp); if (Status == STATUS_PENDING) @@ -2167,9 +2167,9 @@ if (!LocalEvent) { KeWaitForSingleObject(&FileObject->Event, - Executive, - PreviousMode, - FileObject->Flags & FO_ALERTABLE_IO, + Executive, + PreviousMode, + FileObject->Flags & FO_ALERTABLE_IO, NULL); Status = FileObject->FinalStatus; } @@ -2197,7 +2197,7 @@ return STATUS_NOT_IMPLEMENTED; }
-NTSTATUS +NTSTATUS STDCALL NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation) @@ -2302,7 +2302,7 @@ }
DPRINT("FileObject %x\n", FileObject); - + /* Check if this is a direct open or not */ if (FileObject->Flags & FO_DIRECT_DEVICE_OPEN) { @@ -2312,7 +2312,7 @@ { DeviceObject = IoGetRelatedDeviceObject(FileObject); } - + /* Check if we should use Sync IO or not */ if (FileObject->Flags & FO_SYNCHRONOUS_IO) { @@ -2332,10 +2332,10 @@ ObDereferenceObject(FileObject); return STATUS_INSUFFICIENT_RESOURCES; } - + /* Allocate the System Buffer */ - if (!(Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, - Length, + if (!(Irp->AssociatedIrp.SystemBuffer = ExAllocatePoolWithTag(NonPagedPool, + Length,
TAG_SYSB))) [truncated at 1000 lines; 487 more skipped]
ion@svn.reactos.com wrote:
Fix NtWriteFile: Get right Deviceobject, Use FileObject->FinalStatus, use FileObject-.CurrentByteOffset if ByteOffset == FILE_USER_FILE_POINTER_POSITION, add SEH, use right event requested access, set IRP_WRITE_OPERATION flag, add support for IRP_NOCACHE and add support for SL_WRITE_THROUGH if FO_WRITE_THROUGH is enabled.
Modified: trunk/reactos/ntoskrnl/io/file.c
io/file.c: In function 'NtWriteFile': io/file.c:3151: error: 'SL_WRITE_THROUGH' undeclared (first use in this function)
Best Regards,
Thomas