Author: arty Date: Fri Nov 21 18:13:31 2008 New Revision: 37538
URL: http://svn.reactos.org/svn/reactos?rev=37538&view=rev Log: merge from trunk: fastfat that boots real windows
Modified: branches/arty-newcc/drivers/filesystems/fastfat/cleanup.c branches/arty-newcc/drivers/filesystems/fastfat/create.c branches/arty-newcc/drivers/filesystems/fastfat/dirwr.c branches/arty-newcc/drivers/filesystems/fastfat/fastio.c branches/arty-newcc/drivers/filesystems/fastfat/fcb.c branches/arty-newcc/drivers/filesystems/fastfat/finfo.c branches/arty-newcc/drivers/filesystems/fastfat/fsctl.c branches/arty-newcc/drivers/filesystems/fastfat/misc.c branches/arty-newcc/drivers/filesystems/fastfat/rw.c
Modified: branches/arty-newcc/drivers/filesystems/fastfat/cleanup.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -82,12 +82,7 @@ ObDereferenceObject(tmpFileObject); }
-#if 0 - /* FIXME: - * CcPurgeCacheSection is unimplemented. - */ CcPurgeCacheSection(FileObject->SectionObjectPointer, NULL, 0, FALSE); -#endif } /* Uninitialize file cache if. */ if (FileObject->SectionObjectPointer->SharedCacheMap)
Modified: branches/arty-newcc/drivers/filesystems/fastfat/create.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/create.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/create.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -198,7 +198,7 @@
DPRINT ("FindFile(Parent %p, FileToFind '%wZ', DirIndex: %d)\n", Parent, FileToFindU, DirContext->DirIndex); - DPRINT ("FindFile: Path %wZ)\n",&Parent->PathNameU); + DPRINT ("FindFile: Path %wZ\n",&Parent->PathNameU);
PathNameBufferLength = LONGNAME_MAX_LENGTH * sizeof(WCHAR); PathNameBuffer = ExAllocatePoolWithTag(NonPagedPool, PathNameBufferLength + sizeof(WCHAR), TAG_VFAT);
Modified: branches/arty-newcc/drivers/filesystems/fastfat/dirwr.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/dirwr.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -25,7 +25,6 @@ ULONG dirIndex;
ASSERT(pFcb); - ASSERT(pFcb->parentFcb);
if (pFcb->Flags & FCB_IS_FATX_ENTRY) { @@ -479,7 +478,7 @@ if (RequestedOptions & FILE_DIRECTORY_FILE) { FileOffset.QuadPart = 0; - CcMapData((*Fcb)->FileObject, &FileOffset, DeviceExt->FatInfo.BytesPerCluster, TRUE, + CcPinRead((*Fcb)->FileObject, &FileOffset, DeviceExt->FatInfo.BytesPerCluster, TRUE, &Context, (PVOID*)&pFatEntry); /* clear the new directory cluster */ RtlZeroMemory(pFatEntry, DeviceExt->FatInfo.BytesPerCluster);
Modified: branches/arty-newcc/drivers/filesystems/fastfat/fastio.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/fastio.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/fastio.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -175,7 +175,7 @@ IN PDEVICE_OBJECT DeviceObject) { DPRINT("VfatAcquireForModWrite\n"); - return STATUS_UNSUCCESSFUL; + return STATUS_INVALID_DEVICE_REQUEST; }
static BOOLEAN NTAPI @@ -289,23 +289,41 @@ IN PDEVICE_OBJECT DeviceObject) { DPRINT("VfatReleaseForModWrite\n"); - return STATUS_UNSUCCESSFUL; + return STATUS_INVALID_DEVICE_REQUEST; }
static NTSTATUS NTAPI VfatAcquireForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject) { + PVFATFCB Fcb = (PVFATFCB)FileObject->FsContext; + DPRINT("VfatAcquireForCcFlush\n"); - return STATUS_UNSUCCESSFUL; + + /* Make sure it is not a volume lock */ + ASSERT(!(Fcb->Flags & FCB_IS_VOLUME)); + + /* Acquire the resource */ + ExAcquireResourceExclusiveLite(&(Fcb->MainResource), TRUE); + + return STATUS_SUCCESS; }
static NTSTATUS NTAPI VfatReleaseForCcFlush(IN PFILE_OBJECT FileObject, IN PDEVICE_OBJECT DeviceObject) { + PVFATFCB Fcb = (PVFATFCB)FileObject->FsContext; + DPRINT("VfatReleaseForCcFlush\n"); - return STATUS_UNSUCCESSFUL; + + /* Make sure it is not a volume lock */ + ASSERT(!(Fcb->Flags & FCB_IS_VOLUME)); + + /* Release the resource */ + ExReleaseResourceLite(&(Fcb->MainResource)); + + return STATUS_SUCCESS; }
BOOLEAN NTAPI @@ -378,7 +396,6 @@ FastIoDispatch->ReleaseFileForNtCreateSection = VfatReleaseFileForNtCreateSection; FastIoDispatch->FastIoDetachDevice = VfatFastIoDetachDevice; FastIoDispatch->FastIoQueryNetworkOpenInfo = VfatFastIoQueryNetworkOpenInfo; - FastIoDispatch->AcquireForModWrite = VfatAcquireForModWrite; FastIoDispatch->MdlRead = VfatMdlRead; FastIoDispatch->MdlReadComplete = VfatMdlReadComplete; FastIoDispatch->PrepareMdlWrite = VfatPrepareMdlWrite; @@ -388,6 +405,7 @@ FastIoDispatch->MdlReadCompleteCompressed = VfatMdlReadCompleteCompressed; FastIoDispatch->MdlWriteCompleteCompressed = VfatMdlWriteCompleteCompressed; FastIoDispatch->FastIoQueryOpen = VfatFastIoQueryOpen; + FastIoDispatch->AcquireForModWrite = VfatAcquireForModWrite; FastIoDispatch->ReleaseForModWrite = VfatReleaseForModWrite; FastIoDispatch->AcquireForCcFlush = VfatAcquireForCcFlush; FastIoDispatch->ReleaseForCcFlush = VfatReleaseForCcFlush;
Modified: branches/arty-newcc/drivers/filesystems/fastfat/fcb.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -332,7 +332,7 @@
CcInitializeCacheMap(fileObject, (PCC_FILE_SIZES)(&fcb->RFCB.AllocationSize), - FALSE, + TRUE, &VfatGlobalData->CacheMgrCallbacks, fcb);
Modified: branches/arty-newcc/drivers/filesystems/fastfat/finfo.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -91,7 +91,7 @@ StandardInfo->EndOfFile = FCB->RFCB.FileSize; StandardInfo->Directory = FALSE; } - StandardInfo->NumberOfLinks = 0; + StandardInfo->NumberOfLinks = 1; StandardInfo->DeletePending = FCB->Flags & FCB_DELETE_PENDING ? TRUE : FALSE;
*BufferLength -= sizeof(FILE_STANDARD_INFORMATION); @@ -271,7 +271,7 @@ PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; #endif
- DPRINT ("FsdSetDispositionInformation()\n"); + DPRINT ("FsdSetDispositionInformation(<%wZ>, Delete %d)\n", &FCB->PathNameU, DispositionInfo->DeleteFile);
ASSERT(DeviceExt != NULL); ASSERT(DeviceExt->FatInfo.BytesPerCluster != 0); @@ -338,15 +338,33 @@ * FUNCTION: Retrieve the file name information */ { + ULONG BytesToCopy; ASSERT(NameInfo != NULL); ASSERT(FCB != NULL);
+ /* If buffer can't hold at least the file name length, bail out */ + if (*BufferLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) + return STATUS_BUFFER_OVERFLOW; + + /* Save file name length, and as much file len, as buffer length allows */ NameInfo->FileNameLength = FCB->PathNameU.Length; - if (*BufferLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + FCB->PathNameU.Length) + + /* Calculate amount of bytes to copy not to overflow the buffer */ + BytesToCopy = min(FCB->PathNameU.Length, + *BufferLength - FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])); + + /* Fill in the bytes */ + RtlCopyMemory(NameInfo->FileName, FCB->PathNameU.Buffer, BytesToCopy); + + /* Check if we could write more but are not able to */ + if (*BufferLength < FCB->PathNameU.Length + FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) + { + /* Return number of bytes written */ + *BufferLength -= FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + BytesToCopy; return STATUS_BUFFER_OVERFLOW; - - RtlCopyMemory(NameInfo->FileName, FCB->PathNameU.Buffer, FCB->PathNameU.Length); - + } + + /* We filled up as many bytes, as needed */ *BufferLength -= (FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]) + FCB->PathNameU.Length);
return STATUS_SUCCESS; @@ -551,7 +569,8 @@ ULONG NCluster; BOOLEAN AllocSizeChanged = FALSE;
- DPRINT("VfatSetAllocationSizeInformation()\n"); + DPRINT("VfatSetAllocationSizeInformation(File <%wZ>, AllocationSize %d %d)\n", &Fcb->PathNameU, + AllocationSize->HighPart, AllocationSize->LowPart);
if (Fcb->Flags & FCB_IS_FATX_ENTRY) OldSize = Fcb->entry.FatX.FileSize; @@ -748,7 +767,7 @@ FILE_INFORMATION_CLASS FileInformationClass; PVFATFCB FCB = NULL;
- NTSTATUS RC = STATUS_SUCCESS; + NTSTATUS Status = STATUS_SUCCESS; PVOID SystemBuffer; ULONG BufferLength;
@@ -779,44 +798,44 @@ switch (FileInformationClass) { case FileStandardInformation: - RC = VfatGetStandardInformation(FCB, + Status = VfatGetStandardInformation(FCB, SystemBuffer, &BufferLength); break; case FilePositionInformation: - RC = VfatGetPositionInformation(IrpContext->FileObject, + Status = VfatGetPositionInformation(IrpContext->FileObject, FCB, IrpContext->DeviceObject, SystemBuffer, &BufferLength); break; case FileBasicInformation: - RC = VfatGetBasicInformation(IrpContext->FileObject, + Status = VfatGetBasicInformation(IrpContext->FileObject, FCB, IrpContext->DeviceObject, SystemBuffer, &BufferLength); break; case FileNameInformation: - RC = VfatGetNameInformation(IrpContext->FileObject, + Status = VfatGetNameInformation(IrpContext->FileObject, FCB, IrpContext->DeviceObject, SystemBuffer, &BufferLength); break; case FileInternalInformation: - RC = VfatGetInternalInformation(FCB, + Status = VfatGetInternalInformation(FCB, SystemBuffer, &BufferLength); break; case FileNetworkOpenInformation: - RC = VfatGetNetworkOpenInformation(FCB, + Status = VfatGetNetworkOpenInformation(FCB, IrpContext->DeviceExt, SystemBuffer, &BufferLength); break; case FileAllInformation: - RC = VfatGetAllInformation(IrpContext->FileObject, + Status = VfatGetAllInformation(IrpContext->FileObject, FCB, IrpContext->DeviceObject, SystemBuffer, @@ -824,7 +843,7 @@ break;
case FileEaInformation: - RC = VfatGetEaInformation(IrpContext->FileObject, + Status = VfatGetEaInformation(IrpContext->FileObject, FCB, IrpContext->DeviceObject, SystemBuffer, @@ -832,18 +851,18 @@ break;
case FileAlternateNameInformation: - RC = STATUS_NOT_IMPLEMENTED; + Status = STATUS_NOT_IMPLEMENTED; break; default: - RC = STATUS_INVALID_PARAMETER; + Status = STATUS_INVALID_PARAMETER; }
if (!(FCB->Flags & FCB_IS_PAGE_FILE)) { ExReleaseResourceLite(&FCB->MainResource); } - IrpContext->Irp->IoStatus.Status = RC; - if (NT_SUCCESS(RC)) + IrpContext->Irp->IoStatus.Status = Status; + if (NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW) IrpContext->Irp->IoStatus.Information = IrpContext->Stack->Parameters.QueryFile.Length - BufferLength; else @@ -851,7 +870,7 @@ IoCompleteRequest(IrpContext->Irp, IO_NO_INCREMENT); VfatFreeIrpContext(IrpContext);
- return RC; + return Status; }
NTSTATUS VfatSetInformation(PVFAT_IRP_CONTEXT IrpContext)
Modified: branches/arty-newcc/drivers/filesystems/fastfat/fsctl.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -372,6 +372,7 @@ PVFATFCB VolumeFcb = NULL; PVFATCCB Ccb = NULL; PDEVICE_OBJECT DeviceToMount; + PVPB Vpb; UNICODE_STRING NameU = RTL_CONSTANT_STRING(L"\$$Fat$$"); UNICODE_STRING VolumeNameU = RTL_CONSTANT_STRING(L"\$$Volume$$"); ULONG HashTableSize; @@ -389,6 +390,7 @@ }
DeviceToMount = IrpContext->Stack->Parameters.MountVolume.DeviceObject; + Vpb = IrpContext->Stack->Parameters.MountVolume.Vpb;
Status = VfatHasFileSystem (DeviceToMount, &RecognizedFS, &FatInfo); if (!NT_SUCCESS(Status)) @@ -422,7 +424,7 @@ Status = IoCreateDevice(VfatGlobalData->DriverObject, ROUND_UP(sizeof (DEVICE_EXTENSION), sizeof(ULONG)) + sizeof(HASHENTRY*) * HashTableSize, NULL, - FILE_DEVICE_FILE_SYSTEM, + FILE_DEVICE_DISK_FILE_SYSTEM, 0, FALSE, &DeviceObject); @@ -438,7 +440,9 @@ DeviceExt->HashTableSize = HashTableSize;
/* use same vpb as device disk */ - DeviceObject->Vpb = DeviceToMount->Vpb; + DeviceObject->Vpb = Vpb; + DeviceToMount->Vpb = Vpb; + Status = VfatMountDevice(DeviceExt, DeviceToMount); if (!NT_SUCCESS(Status)) { @@ -538,7 +542,7 @@
CcInitializeCacheMap(DeviceExt->FATFileObject, (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize), - FALSE, + TRUE, &VfatGlobalData->CacheMgrCallbacks, Fcb);
Modified: branches/arty-newcc/drivers/filesystems/fastfat/misc.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/misc.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/misc.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -156,11 +156,6 @@ } else { - if (KeGetCurrentIrql() > PASSIVE_LEVEL) - { - DPRINT1("Vfat is entered at irql = %d\n", KeGetCurrentIrql()); - } - FsRtlEnterFileSystem(); Status = VfatDispatchRequest (IrpContext); FsRtlExitFileSystem();
Modified: branches/arty-newcc/drivers/filesystems/fastfat/rw.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/drivers/filesystems/f... ============================================================================== --- branches/arty-newcc/drivers/filesystems/fastfat/rw.c [iso-8859-1] (original) +++ branches/arty-newcc/drivers/filesystems/fastfat/rw.c [iso-8859-1] Fri Nov 21 18:13:31 2008 @@ -678,7 +678,7 @@ (BOOLEAN)(IrpContext->Flags & IRPCONTEXT_CANWAIT), Buffer, &IrpContext->Irp->IoStatus)) { - Status = IrpContext->Irp->IoStatus.Status;//STATUS_PENDING; + Status = STATUS_PENDING; goto ByeBye; } if (!NT_SUCCESS(IrpContext->Irp->IoStatus.Status))