diff --git a/reactos/ntoskrnl/cache/cachesub.c b/reactos/ntoskrnl/cache/cachesub.c index 6f816cba0dd..b59af8f1f47 100644 --- a/reactos/ntoskrnl/cache/cachesub.c +++ b/reactos/ntoskrnl/cache/cachesub.c @@ -143,7 +143,7 @@ _CcpFlushCache(IN PNOCC_CACHE_MAP Map, PNOCC_BCB Bcb = NULL; LARGE_INTEGER LowerBound, UpperBound; PLIST_ENTRY ListEntry; - IO_STATUS_BLOCK IOSB = { }; + IO_STATUS_BLOCK IOSB = {0}; DPRINT1("CcFlushCache (while file) (%s:%d)\n", File, Line); @@ -164,7 +164,7 @@ _CcpFlushCache(IN PNOCC_CACHE_MAP Map, while (ListEntry != &Map->AssociatedBcb) { Bcb = CONTAINING_RECORD(ListEntry, NOCC_BCB, ThisFileList); - CcpReferenceCache(Bcb - CcCacheSections); + CcpReferenceCache((ULONG)(Bcb - CcCacheSections)); if (Bcb->FileOffset.QuadPart + Bcb->Length >= LowerBound.QuadPart && Bcb->FileOffset.QuadPart < UpperBound.QuadPart) @@ -186,7 +186,7 @@ _CcpFlushCache(IN PNOCC_CACHE_MAP Map, if (Delete && Bcb->RefCount < 2) { Bcb->RefCount = 1; - CcpDereferenceCache(Bcb - CcCacheSections, FALSE); + CcpDereferenceCache((ULONG)(Bcb - CcCacheSections), FALSE); } else CcpUnpinData(Bcb, TRUE); @@ -276,9 +276,10 @@ PVOID NTAPI CcRemapBcb(IN PVOID Bcb) { + ULONG Number = (ULONG)(((PNOCC_BCB)Bcb) - CcCacheSections); CcpLock(); - ASSERT(RtlTestBit(CcCacheBitmap, ((PNOCC_BCB)Bcb) - CcCacheSections)); - CcpReferenceCache(((PNOCC_BCB)Bcb) - CcCacheSections); + ASSERT(RtlTestBit(CcCacheBitmap, Number)); + CcpReferenceCache(Number); CcpUnlock(); return Bcb; } @@ -315,10 +316,11 @@ VOID NTAPI CcRepinBcb(IN PVOID Bcb) { + ULONG Number = (ULONG)(((PNOCC_BCB)Bcb) - CcCacheSections); CcpLock(); - ASSERT(RtlTestBit(CcCacheBitmap, ((PNOCC_BCB)Bcb) - CcCacheSections)); - DPRINT("CcRepinBcb(#%x)\n", ((PNOCC_BCB)Bcb) - CcCacheSections); - CcpReferenceCache(((PNOCC_BCB)Bcb) - CcCacheSections); + ASSERT(RtlTestBit(CcCacheBitmap, Number)); + DPRINT("CcRepinBcb(#%x)\n", Number); + CcpReferenceCache(Number); CcpUnlock(); } diff --git a/reactos/ntoskrnl/cache/fssup.c b/reactos/ntoskrnl/cache/fssup.c index 4af45ec85f1..a501c6e6fc5 100644 --- a/reactos/ntoskrnl/cache/fssup.c +++ b/reactos/ntoskrnl/cache/fssup.c @@ -297,9 +297,11 @@ CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes) { PNOCC_CACHE_MAP Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + PNOCC_BCB Bcb; + if (!Map) return; Map->FileSizes = *FileSizes; - PNOCC_BCB Bcb = Map->AssociatedBcb.Flink == &Map->AssociatedBcb ? + Bcb = Map->AssociatedBcb.Flink == &Map->AssociatedBcb ? NULL : CONTAINING_RECORD(Map->AssociatedBcb.Flink, NOCC_BCB, ThisFileList); if (!Bcb) return; MmExtendCacheSection(Bcb->SectionObject, &FileSizes->FileSize, FALSE); diff --git a/reactos/ntoskrnl/cache/pinsup.c b/reactos/ntoskrnl/cache/pinsup.c index c2a46398306..46605a7fade 100644 --- a/reactos/ntoskrnl/cache/pinsup.c +++ b/reactos/ntoskrnl/cache/pinsup.c @@ -318,6 +318,8 @@ CcpMapData PMM_CACHE_SECTION_SEGMENT SectionObject = NULL; NTSTATUS Status; PNOCC_CACHE_MAP Map = (PNOCC_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + ULONG SectionSize; + ULONG ViewSize = CACHE_STRIPE; if (!Map) { @@ -358,8 +360,6 @@ CcpMapData goto cleanup; } - ULONG SectionSize; - DPRINT("File size %08x%08x\n", Map->FileSizes.ValidDataLength.HighPart, Map->FileSizes.ValidDataLength.LowPart); if (Map->FileSizes.ValidDataLength.QuadPart) @@ -424,7 +424,6 @@ retry: } DPRINT("Selected BCB #%x\n", BcbHead); - ULONG ViewSize = CACHE_STRIPE; Bcb = &CcCacheSections[BcbHead]; Status = MmMapCacheViewInSystemSpaceAtOffset diff --git a/reactos/ntoskrnl/cache/section/fault.c b/reactos/ntoskrnl/cache/section/fault.c index 204c264b579..b655f0745df 100644 --- a/reactos/ntoskrnl/cache/section/fault.c +++ b/reactos/ntoskrnl/cache/section/fault.c @@ -266,12 +266,13 @@ MiCowCacheSectionPage Region->Protect == PAGE_EXECUTE_READWRITE) #endif { + ULONG Entry; DPRINTC("setting non-cow page %x %x:%x offset %x (%x) to writable\n", Segment, Process, PAddress, Offset.u.LowPart, MmGetPfnForProcess(Process, Address)); if (Segment->FileObject) { DPRINTC("file %wZ\n", &Segment->FileObject->FileName); } - ULONG Entry = MiGetPageEntryCacheSectionSegment(Segment, &Offset); + Entry = MiGetPageEntryCacheSectionSegment(Segment, &Offset); DPRINT("Entry %x\n", Entry); if (Entry && !IS_SWAP_FROM_SSE(Entry) && @@ -478,7 +479,7 @@ MmpSectionAccessFaultInner { if (Thread->ActiveFaultCount > 0) { - WORK_QUEUE_WITH_CONTEXT Context = { }; + WORK_QUEUE_WITH_CONTEXT Context = {0}; DPRINT("Already fault handling ... going to work item (%x)\n", Address); Context.AddressSpace = AddressSpace; Context.MemoryArea = MemoryArea; @@ -659,7 +660,7 @@ MmNotPresentFaultCacheSectionInner { if (Thread->ActiveFaultCount > 1) { - WORK_QUEUE_WITH_CONTEXT Context = { }; + WORK_QUEUE_WITH_CONTEXT Context = {0}; DPRINTC("Already fault handling ... going to work item (%x)\n", Address); Context.AddressSpace = AddressSpace; Context.MemoryArea = MemoryArea; diff --git a/reactos/ntoskrnl/cache/section/newmm.h b/reactos/ntoskrnl/cache/section/newmm.h index e11db95cf7d..f4671e324f0 100644 --- a/reactos/ntoskrnl/cache/section/newmm.h +++ b/reactos/ntoskrnl/cache/section/newmm.h @@ -19,7 +19,7 @@ #define MEMORY_AREA_CACHE (2) #define MM_SEGMENT_FINALIZE (0x40000000) -#define RMAP_SEGMENT_MASK ~0xff +#define RMAP_SEGMENT_MASK ~((ULONG_PTR)0xff) #define RMAP_IS_SEGMENT(x) (((ULONG_PTR)(x) & RMAP_SEGMENT_MASK) == RMAP_SEGMENT_MASK) #define MIN(x,y) (((x)<(y))?(x):(y)) diff --git a/reactos/ntoskrnl/cache/section/sptab.c b/reactos/ntoskrnl/cache/section/sptab.c index 0b71764b865..45098290360 100644 --- a/reactos/ntoskrnl/cache/section/sptab.c +++ b/reactos/ntoskrnl/cache/section/sptab.c @@ -107,7 +107,7 @@ MiSectionPageTableGetOrAllocate MiSectionPageTableGet(Table, FileOffset); if (!PageTableSlice) { - CACHE_SECTION_PAGE_TABLE SectionZeroPageTable = { }; + CACHE_SECTION_PAGE_TABLE SectionZeroPageTable = {0}; SearchFileOffset.QuadPart = ROUND_DOWN(FileOffset->QuadPart, ENTRIES_PER_ELEMENT * PAGE_SIZE); SectionZeroPageTable.FileOffset = SearchFileOffset; SectionZeroPageTable.Refcount = 1; diff --git a/reactos/ntoskrnl/cache/section/swapout.c b/reactos/ntoskrnl/cache/section/swapout.c index 691635dc58d..1e1cc9188e1 100644 --- a/reactos/ntoskrnl/cache/section/swapout.c +++ b/reactos/ntoskrnl/cache/section/swapout.c @@ -422,6 +422,8 @@ bail: if (Segment) { + ULONG RefCount; + DPRINTC("About to finalize section page %x (%x:%x) Status %x %s\n", Page, Segment, FileOffset.LowPart, Status, Dirty ? "dirty" : "clean"); if (!NT_SUCCESS(Status) || @@ -438,7 +440,6 @@ bail: } // Alas, we had the last reference - ULONG RefCount; if ((RefCount = InterlockedDecrementUL(&Segment->ReferenceCount)) == 0) MmFinalizeSegment(Segment); } diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index bde920327c8..00556d82fe9 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -1290,7 +1290,8 @@ MiReadPage(PMEMORY_AREA MemoryArea, * Page - Variable that receives a page contains the read data. */ { - MM_REQUIRED_RESOURCES Resources = { }; + MM_REQUIRED_RESOURCES Resources = {0}; + NTSTATUS Status; Resources.Context = MemoryArea->Data.SectionData.Section->FileObject; Resources.FileOffset.QuadPart = SegOffset + @@ -1300,7 +1301,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, DPRINT1("%S, offset %x, len %d, page %x\n", ((PFILE_OBJECT)Resources.Context)->FileName.Buffer, Resources.FileOffset.LowPart, Resources.Amount, Resources.Page[0]); - NTSTATUS Status = MiReadFilePage(NULL, NULL, &Resources); + Status = MiReadFilePage(NULL, NULL, &Resources); *Page = Resources.Page[0]; return Status; }