Author: akhaldi Date: Fri Aug 26 11:39:53 2011 New Revision: 53452
URL: http://svn.reactos.org/svn/reactos?rev=53452&view=rev Log: [NEWCC] * Sync some fixes.
Modified: branches/arty-newcc/ntoskrnl/cache/fssup.c branches/arty-newcc/ntoskrnl/cache/section/fault.c branches/arty-newcc/ntoskrnl/cache/section/io.c branches/arty-newcc/ntoskrnl/cache/section/newmm.h branches/arty-newcc/ntoskrnl/cache/section/reqtools.c branches/arty-newcc/ntoskrnl/cache/section/sptab.c branches/arty-newcc/ntoskrnl/mm/section.c
Modified: branches/arty-newcc/ntoskrnl/cache/fssup.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/fssup.... ============================================================================== --- branches/arty-newcc/ntoskrnl/cache/fssup.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/fssup.c [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -337,14 +337,7 @@ { ToWrite = MIN(UpperBound.QuadPart - LowerBound.QuadPart, (PAGE_SIZE - LowerBound.QuadPart) & (PAGE_SIZE - 1)); DPRINT("Zero last half %08x%08x %x\n", Target.u.HighPart, Target.u.LowPart, ToWrite); - Status = MiSimpleRead(FileObject, - &Target, - ZeroBuf, - PAGE_SIZE, -#ifdef __ROS_CMAKE__ - TRUE, -#endif - &IOSB); + Status = MiSimpleRead(FileObject, &Target, ZeroBuf, PAGE_SIZE, TRUE, &IOSB); if (!NT_SUCCESS(Status)) { ExFreePool(ZeroBuf); @@ -380,14 +373,7 @@ { ToWrite = UpperBound.QuadPart - Target.QuadPart; DPRINT("Zero first half %08x%08x %x\n", Target.u.HighPart, Target.u.LowPart, ToWrite); - Status = MiSimpleRead(FileObject, - &Target, - ZeroBuf, - PAGE_SIZE, -#ifdef __ROS_CMAKE__ - TRUE, -#endif - &IOSB); + Status = MiSimpleRead(FileObject, &Target, ZeroBuf, PAGE_SIZE, TRUE, &IOSB); if (!NT_SUCCESS(Status)) { ExFreePool(ZeroBuf);
Modified: branches/arty-newcc/ntoskrnl/cache/section/fault.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/sectio... ============================================================================== --- branches/arty-newcc/ntoskrnl/cache/section/fault.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/section/fault.c [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -395,6 +395,8 @@ BOOLEAN Locked = FromMdl; MM_REQUIRED_RESOURCES Resources = { 0 }; WORK_QUEUE_WITH_CONTEXT Context; + + RtlZeroMemory(&Context, sizeof(WORK_QUEUE_WITH_CONTEXT));
DPRINT("MmAccessFault(Mode %d, Address %x)\n", Mode, Address);
@@ -590,6 +592,8 @@ WORK_QUEUE_WITH_CONTEXT Context; NTSTATUS Status = STATUS_SUCCESS;
+ RtlZeroMemory(&Context, sizeof(WORK_QUEUE_WITH_CONTEXT)); + if (!FromMdl) { MmLockAddressSpace(AddressSpace);
Modified: branches/arty-newcc/ntoskrnl/cache/section/io.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/sectio... ============================================================================== --- branches/arty-newcc/ntoskrnl/cache/section/io.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/section/io.c [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -66,43 +66,12 @@
NTSTATUS NTAPI -MiSimpleReadComplete -(PDEVICE_OBJECT DeviceObject, - PIRP Irp, - PVOID Context) -{ - PMDL Mdl = Irp->MdlAddress; - - /* Unlock MDL Pages, page 167. */ - DPRINT("MiSimpleReadComplete %x\n", Irp); - while (Mdl) - { - DPRINT("MDL Unlock %x\n", Mdl); - MmUnlockPages(Mdl); - Mdl = Mdl->Next; - } - - /* Check if there's an MDL */ - while ((Mdl = Irp->MdlAddress)) - { - /* Clear all of them */ - Irp->MdlAddress = Mdl->Next; - IoFreeMdl(Mdl); - } - - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI MiSimpleRead (PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, PVOID Buffer, ULONG Length, -#ifdef __ROS_CMAKE__ BOOLEAN Paging, -#endif PIO_STATUS_BLOCK ReadStatus) { NTSTATUS Status; @@ -116,6 +85,9 @@ ASSERT(Buffer); ASSERT(ReadStatus);
+ // This reference is consumed when the IRP is completed below + // It will be consumed by line 231 of irp.c + ObReferenceObject(FileObject); DeviceObject = MmGetDeviceObjectForFile(FileObject); ReadStatus->Status = STATUS_INTERNAL_ERROR; ReadStatus->Information = 0; @@ -142,26 +114,17 @@
if (!Irp) { + ObDereferenceObject(FileObject); return STATUS_NO_MEMORY; }
-#ifndef __ROS_CMAKE__ - Irp->Flags |= IRP_PAGING_IO | IRP_SYNCHRONOUS_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_API; -#else Irp->Flags |= (Paging ? IRP_PAGING_IO | IRP_SYNCHRONOUS_PAGING_IO | IRP_NOCACHE : 0) | IRP_SYNCHRONOUS_API; -#endif
Irp->UserEvent = &ReadWait; Irp->Tail.Overlay.OriginalFileObject = FileObject; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); IrpSp = IoGetNextIrpStackLocation(Irp); - IrpSp->Control |= SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR; IrpSp->FileObject = FileObject; - IrpSp->CompletionRoutine = MiSimpleReadComplete; - -#ifdef __ROS_CMAKE__ - ObReferenceObject(FileObject); -#endif
Status = IoCallDriver(DeviceObject, Irp); if (Status == STATUS_PENDING) @@ -176,14 +139,15 @@ NULL))) { DPRINT1("Warning: Failed to wait for synchronous IRP\n"); + ObDereferenceObject(FileObject); ASSERT(FALSE); return Status; } }
DPRINT("Paging IO Done: %08x\n", ReadStatus->Status); - Status = - ReadStatus->Status == STATUS_END_OF_FILE ? + Status = + ReadStatus->Status == STATUS_END_OF_FILE ? STATUS_SUCCESS : ReadStatus->Status; return Status; } @@ -210,6 +174,8 @@ ASSERT(Buffer); ASSERT(ReadStatus);
+ // This reference is consumed when the IRP is completed below + // It will be consumed by line 231 of irp.c ObReferenceObject(FileObject); DeviceObject = MmGetDeviceObjectForFile(FileObject); ASSERT(DeviceObject); @@ -232,27 +198,27 @@ Length, FileOffset, ReadStatus); - + if (!Irp) { ObDereferenceObject(FileObject); return STATUS_NO_MEMORY; } - + Irp->Flags = IRP_PAGING_IO | IRP_SYNCHRONOUS_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_API; - + Irp->UserEvent = &ReadWait; Irp->Tail.Overlay.OriginalFileObject = FileObject; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); IrpSp = IoGetNextIrpStackLocation(Irp); - IrpSp->Control |= SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR; IrpSp->FileObject = FileObject; - IrpSp->CompletionRoutine = MiSimpleReadComplete; - + DPRINT("Call Driver\n"); Status = IoCallDriver(DeviceObject, Irp); DPRINT("Status %x\n", Status);
+ // XXX hack: I need to find the reference that matches this one. + // The one above should be consumed by irp.c ObDereferenceObject(FileObject);
if (Status == STATUS_PENDING) @@ -260,18 +226,19 @@ DPRINT("KeWaitForSingleObject(&ReadWait)\n"); if (!NT_SUCCESS (KeWaitForSingleObject - (&ReadWait, - Suspended, - KernelMode, - FALSE, + (&ReadWait, + Suspended, + KernelMode, + FALSE, NULL))) { DPRINT1("Warning: Failed to wait for synchronous IRP\n"); + ObDereferenceObject(FileObject); ASSERT(FALSE); return Status; } } - + DPRINT("Paging IO Done: %08x\n", ReadStatus->Status); return ReadStatus->Status; }
Modified: branches/arty-newcc/ntoskrnl/cache/section/newmm.h URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/sectio... ============================================================================== --- branches/arty-newcc/ntoskrnl/cache/section/newmm.h [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/section/newmm.h [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -170,9 +170,7 @@ PLARGE_INTEGER FileOffset, PVOID Buffer, ULONG Length, -#ifdef __ROS_CMAKE__ BOOLEAN Paging, -#endif PIO_STATUS_BLOCK ReadStatus);
NTSTATUS
Modified: branches/arty-newcc/ntoskrnl/cache/section/reqtools.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/sectio... ============================================================================== --- branches/arty-newcc/ntoskrnl/cache/section/reqtools.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/section/reqtools.c [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -148,9 +148,7 @@ FileOffset, PageBuf, RequiredResources->Amount, -#ifdef __ROS_CMAKE__ TRUE, -#endif &IOSB); RtlZeroMemory ((PCHAR)PageBuf+RequiredResources->Amount,
Modified: branches/arty-newcc/ntoskrnl/cache/section/sptab.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/cache/sectio... ============================================================================== --- branches/arty-newcc/ntoskrnl/cache/section/sptab.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/cache/section/sptab.c [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -105,9 +105,11 @@ PLARGE_INTEGER FileOffset) { LARGE_INTEGER SearchFileOffset; - CACHE_SECTION_PAGE_TABLE SectionZeroPageTable; + CACHE_SECTION_PAGE_TABLE SectionZeroPageTable; PCACHE_SECTION_PAGE_TABLE PageTableSlice = MiSectionPageTableGet(Table, FileOffset); + // Please zero memory when taking away zero initialization. + RtlZeroMemory(&SectionZeroPageTable, sizeof(CACHE_SECTION_PAGE_TABLE)); if (!PageTableSlice) { SearchFileOffset.QuadPart = ROUND_DOWN(FileOffset->QuadPart, ENTRIES_PER_ELEMENT * PAGE_SIZE);
Modified: branches/arty-newcc/ntoskrnl/mm/section.c URL: http://svn.reactos.org/svn/reactos/branches/arty-newcc/ntoskrnl/mm/section.c... ============================================================================== --- branches/arty-newcc/ntoskrnl/mm/section.c [iso-8859-1] (original) +++ branches/arty-newcc/ntoskrnl/mm/section.c [iso-8859-1] Fri Aug 26 11:39:53 2011 @@ -3238,15 +3238,7 @@
UsedSize = 0;
- Status = MiSimpleRead - (FileObject, - &FileOffset, - Buffer, - BufferSize, -#ifdef __ROS_CMAKE__ - TRUE, -#endif - &Iosb); + Status = MiSimpleRead(FileObject, &FileOffset, Buffer, BufferSize, TRUE, &Iosb);
UsedSize = Iosb.Information;