PDFS_PREFIX_TABLE_ENTRY _AllocatePrefixTableEntry(PDFS_PREFIX_TABLE pTable) { PDFS_PREFIX_TABLE_ENTRY pEntry = NULL; #ifdef KERNEL_MODE NTSTATUS status; PVOID pSegment = NULL; pSegment = ExAllocatePool(PagedPool,PREFIX_TABLE_ENTRY_SEGMENT_SIZE); if (pSegment != NULL) { status = ExExtendZone(&pTable->PrefixTableEntryZone, pSegment, PREFIX_TABLE_ENTRY_SEGMENT_SIZE); if (NT_SUCCESS(status)) { pEntry = ALLOCATE_DFS_PREFIX_TABLE_ENTRY(pTable); } else { DfsDbgTrace(0, Dbg, "ExExtendZone returned %lx\n", status); } } #endif return pEntry; }
NTSTATUS ExInterlockedExtendZone( __inout PZONE_HEADER Zone, __inout PVOID Segment, __in ULONG SegmentSize, __inout PKSPIN_LOCK Lock ) /*++ Routine Description: This function extends a zone by adding another segment's worth of blocks to the zone. Arguments: Zone - Supplies the address of a zone header to be extended. Segment - Supplies the address of a segment of storage. The first ZONE_SEGMENT_HEADER-sized portion of the segment is used by the zone allocator. The remainder of the segment is carved up into fixed-size (BlockSize) blocks and is added to the zone. The address of the segment must be aligned on a 64- bit boundary. SegmentSize - Supplies the size in bytes of Segment. Lock - pointer to spinlock to use Return Value: STATUS_UNSUCCESSFUL - BlockSize or Segment was not aligned on 64-bit boundaries, or BlockSize was larger than the segment size. STATUS_SUCCESS - The zone was successfully extended. --*/ { NTSTATUS Status; KIRQL OldIrql; #ifdef NT_UP UNREFERENCED_PARAMETER (Lock); #endif ExAcquireSpinLock( Lock, &OldIrql ); Status = ExExtendZone( Zone, Segment, SegmentSize ); ExReleaseSpinLock( Lock, OldIrql ); return Status; }
/* * @implemented */ NTSTATUS NTAPI ExInterlockedExtendZone(PZONE_HEADER Zone, PVOID Segment, ULONG SegmentSize, PKSPIN_LOCK Lock) { NTSTATUS Status; KIRQL OldIrql; /* Get the lock */ KeAcquireSpinLock(Lock, &OldIrql); /* Extend the Zone */ Status = ExExtendZone(Zone, Segment, SegmentSize); /* Release lock and return status */ KeReleaseSpinLock(Lock, OldIrql); return Status; }