/* Allocate memory for our structure */
ObjectNameInfo = ExAllocatePoolWithTag(PagedPool,
1024,
- TAG('M', 'm', ' ', ' '));
+ ' mM');
if (!ObjectNameInfo) return STATUS_NO_MEMORY;
/* Query the name */
if (!NT_SUCCESS(Status))
{
/* Failed, free memory */
- ExFreePoolWithTag(ObjectNameInfo, TAG('M', 'm', ' ', ' '));
+ ExFreePoolWithTag(ObjectNameInfo, ' mM');
return Status;
}
MmGetFileNameForAddress(IN PVOID Address,
OUT PUNICODE_STRING ModuleName)
{
- /*
- * FIXME: TODO.
- * Filip says to get the MM_AVL_TABLE from EPROCESS,
- * then use the MmMarea routines to locate the Marea that
- * corresponds to the address. Then make sure it's a section
- * view type (MEMORY_AREA_SECTION_VIEW) and use the marea's
- * per-type union to get the .u.SectionView.Section pointer to
- * the SECTION_OBJECT. Then we can use MmGetFileNameForSection
- * to get the full filename.
- */
- RtlCreateUnicodeString(ModuleName, L"C:\\ReactOS\\system32\\ntdll.dll");
- return STATUS_SUCCESS;
+ PROS_SECTION_OBJECT Section;
+ PMEMORY_AREA MemoryArea;
+ PMMSUPPORT AddressSpace;
+ POBJECT_NAME_INFORMATION ModuleNameInformation;
+ NTSTATUS Status = STATUS_ADDRESS_NOT_ASSOCIATED;
+
+ /* Get the MM_AVL_TABLE from EPROCESS */
+ if (Address >= MmSystemRangeStart)
+ {
+ AddressSpace = MmGetKernelAddressSpace();
+ }
+ else
+ {
+ AddressSpace = &PsGetCurrentProcess()->Vm;
+ }
+
+ /* Lock address space */
+ MmLockAddressSpace(AddressSpace);
+
+ /* Locate the memory area for the process by address */
+ MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace, Address);
+
+ /* Make sure it's a section view type */
+ if ((MemoryArea != NULL) && (MemoryArea->Type == MEMORY_AREA_SECTION_VIEW))
+ {
+ /* Get the section pointer to the SECTION_OBJECT */
+ Section = MemoryArea->Data.SectionData.Section;
+
+ /* Unlock address space */
+ MmUnlockAddressSpace(AddressSpace);
+
+ /* Get the filename of the section */
+ Status = MmGetFileNameForSection(Section,&ModuleNameInformation);
+
+ if (NT_SUCCESS(Status))
+ {
+ /* Init modulename */
+ RtlCreateUnicodeString(ModuleName,
+ ModuleNameInformation->Name.Buffer);
+
+ /* Free temp taged buffer from MmGetFileNameForSection() */
+ ExFreePoolWithTag(ModuleNameInformation, ' mM');
+ DPRINT("Found ModuleName %S by address %p\n",
+ ModuleName->Buffer,Address);
+ }
+ }
+ else
+ {
+ /* Unlock address space */
+ MmUnlockAddressSpace(AddressSpace);
+ }
+
+ return Status;
}
/* Note: Mmsp prefix denotes "Memory Manager Section Private". */
{
DPRINT1("Image segment %d still referenced (was %d)\n", i,
SectionSegments[i].ReferenceCount);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmFreePageTablesSectionSegment(&SectionSegments[i]);
}
if (Segment->ReferenceCount != 0)
{
DPRINT1("Data segment still referenced\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmFreePageTablesSectionSegment(Segment);
ExFreePool(Segment);
TAG_SECTION_PAGE_TABLE);
if (Table == NULL)
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
memset(Table, 0, sizeof(SECTION_PAGE_TABLE));
DPRINT("Table %x\n", Table);
if (Entry == 0)
{
DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (SHARE_COUNT_FROM_SSE(Entry) == MAX_SHARE_COUNT)
{
DPRINT1("Maximum share count reached\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (IS_SWAP_FROM_SSE(Entry))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) + 1);
MmSetPageEntrySectionSegment(Segment, Offset, Entry);
if (Entry == 0)
{
DPRINT1("Entry == 0 for MmUnsharePageEntrySectionSegment\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (SHARE_COUNT_FROM_SSE(Entry) == 0)
{
DPRINT1("Zero share count for unshare\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (IS_SWAP_FROM_SSE(Entry))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) - 1);
/*
if (!NT_SUCCESS(Status))
{
DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
}
if (!NT_SUCCESS(Status))
{
DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
MmSetPageEntrySectionSegment(Segment, Offset, MAKE_SWAP_SSE(SavedSwapEntry));
else
{
DPRINT1("Found a swapentry for a non private page in an image or data file sgment\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
}
return FALSE;
}
+NTSTATUS
+NTAPI
+MiCopyFromUserPage(PFN_TYPE DestPage, PVOID SourceAddress)
+{
+ PEPROCESS Process;
+ KIRQL Irql;
+ PVOID TempAddress;
+
+ Process = PsGetCurrentProcess();
+ TempAddress = MiMapPageInHyperSpace(Process, DestPage, &Irql);
+ if (TempAddress == NULL)
+ {
+ return(STATUS_NO_MEMORY);
+ }
+ memcpy(TempAddress, SourceAddress, PAGE_SIZE);
+ MiUnmapPageInHyperSpace(Process, TempAddress, Irql);
+ return(STATUS_SUCCESS);
+}
+
NTSTATUS
NTAPI
MiReadPage(PMEMORY_AREA MemoryArea,
}
else
{
+ PEPROCESS Process;
+ KIRQL Irql;
PVOID PageAddr;
ULONG CacheSegOffset;
+
/*
* Allocate a page, this is rather complicated by the possibility
* we might have to move other things out of memory
return Status;
}
}
- PageAddr = MmCreateHyperspaceMapping(*Page);
+
+ Process = PsGetCurrentProcess();
+ PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset;
Length = RawLength - SegOffset;
if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
else
{
memcpy(PageAddr, (char*)BaseAddress + FileOffset - BaseOffset, CacheSegOffset);
+ MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
Status = CcRosGetCacheSegment(Bcb,
FileOffset + CacheSegOffset,
&CacheSeg);
if (!NT_SUCCESS(Status))
{
- MmDeleteHyperspaceMapping(PageAddr);
return(Status);
}
if (!UptoDate)
if (!NT_SUCCESS(Status))
{
CcRosReleaseCacheSegment(Bcb, CacheSeg, FALSE, FALSE, FALSE);
- MmDeleteHyperspaceMapping(PageAddr);
return Status;
}
}
+ PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
if (Length < PAGE_SIZE)
{
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, Length - CacheSegOffset);
memcpy((char*)PageAddr + CacheSegOffset, BaseAddress, PAGE_SIZE - CacheSegOffset);
}
}
+ MiUnmapPageInHyperSpace(Process, PageAddr, Irql);
CcRosReleaseCacheSegment(Bcb, CacheSeg, TRUE, FALSE, FALSE);
- MmDeleteHyperspaceMapping(PageAddr);
}
return(STATUS_SUCCESS);
}
NTSTATUS
NTAPI
-MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
+MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked)
PMM_REGION Region;
BOOLEAN HasSwapEntry;
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
+ KIRQL OldIrql;
/*
* There is a window between taking the page fault and locking the
{
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(MmGetPfnForProcess(Process, Address));
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
return(STATUS_SUCCESS);
}
if (PageOp == NULL)
{
DPRINT1("MmGetPageOp failed\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
if (Status != STATUS_SUCCESS)
{
DPRINT1("Failed to wait for page op, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (PageOp->Status == STATUS_PENDING)
{
DPRINT1("Woke for page op before completion\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmLockAddressSpace(AddressSpace);
/*
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create virtual mapping\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmInsertRmap(Page, Process, (PVOID)PAddress);
}
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
MmUnlockSectionSegment(Segment);
PageOp->Status = STATUS_SUCCESS;
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
{
DPRINT1("Found a swaped out private page in a pagefile section.\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmUnlockSectionSegment(Segment);
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Status = MmReadFromSwapPage(SwapEntry, Page);
if (!NT_SUCCESS(Status))
{
DPRINT1("MmReadFromSwapPage failed, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmLockAddressSpace(AddressSpace);
Status = MmCreateVirtualMapping(Process,
if (!NT_SUCCESS(Status))
{
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
return(Status);
}
*/
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
PageOp->Status = STATUS_SUCCESS;
MmspCompleteAndReleasePageOp(PageOp);
if (!NT_SUCCESS(Status))
{
DPRINT("MmCreateVirtualMappingUnsafe failed, not out of memory\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
return(Status);
}
/*
*/
if (Locked)
{
- MmLockPageUnsafe(Page);
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
+ MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
/*
}
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Status = MmCreateVirtualMapping(Process,
Address,
if (!NT_SUCCESS(Status))
{
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
return(Status);
}
MmInsertRmap(Page, Process, (PVOID)PAddress);
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
/*
if (Entry != Entry1)
{
DPRINT1("Someone changed ppte entry while we slept\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create virtual mapping\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmInsertRmap(Page, Process, (PVOID)PAddress);
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
PageOp->Status = STATUS_SUCCESS;
MmspCompleteAndReleasePageOp(PageOp);
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Status = MmReadFromSwapPage(SwapEntry, Page);
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
if (Entry != Entry1)
{
DPRINT1("Someone changed ppte entry while we slept\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create virtual mapping\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmInsertRmap(Page, Process, (PVOID)PAddress);
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
PageOp->Status = STATUS_SUCCESS;
MmspCompleteAndReleasePageOp(PageOp);
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create virtual mapping\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmInsertRmap(Page, Process, (PVOID)PAddress);
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
PageOp->Status = STATUS_SUCCESS;
MmspCompleteAndReleasePageOp(PageOp);
NTSTATUS
NTAPI
-MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace,
+MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
BOOLEAN Locked)
PMM_REGION Region;
ULONG Entry;
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
+ KIRQL OldIrql;
DPRINT("MmAccessFaultSectionView(%x, %x, %x, %x)\n", AddressSpace, MemoryArea, Address, Locked);
if (PageOp == NULL)
{
DPRINT1("MmGetPageOp failed\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
if (Status == STATUS_TIMEOUT)
{
DPRINT1("Failed to wait for page op, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (PageOp->Status == STATUS_PENDING)
{
DPRINT1("Woke for page op before completion\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
* Restart the operation
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &NewPage);
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
if (!NT_SUCCESS(Status))
{
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
return(Status);
}
if (!NT_SUCCESS(Status))
{
DPRINT1("Unable to create virtual mapping\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (Locked)
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmLockPage(NewPage);
MmUnlockPage(OldPage);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
/*
PageOutContext = (MM_SECTION_PAGEOUT_CONTEXT*)Context;
if (Process)
{
- MmLockAddressSpace(&Process->VadRoot);
+ MmLockAddressSpace(&Process->Vm);
}
MmDeleteVirtualMapping(Process,
}
if (Process)
{
- MmUnlockAddressSpace(&Process->VadRoot);
+ MmUnlockAddressSpace(&Process->Vm);
}
if (PageOutContext->Private)
NTSTATUS
NTAPI
-MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
+MmPageOutSectionView(PMMSUPPORT AddressSpace,
MEMORY_AREA* MemoryArea,
PVOID Address,
PMM_PAGEOP PageOp)
BOOLEAN DirectMapped;
BOOLEAN IsImageSection;
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
+ KIRQL OldIrql;
Address = (PVOID)PAGE_ROUND_DOWN(Address);
DPRINT1("Trying to page out from physical memory section address 0x%X "
"process %d\n", Address,
Process ? Process->UniqueProcessId : 0);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
{
DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n",
Process ? Process->UniqueProcessId : 0, Address);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Page = MmGetPfnForProcess(Process, Address);
SwapEntry = MmGetSavedSwapEntryPage(Page);
if(!MiIsPageFromCache(MemoryArea, Context.Offset))
{
DPRINT1("Direct mapped non private page is not associated with the cache.\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
else
{
+ OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmReferencePage(Page);
+ KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
}
MmDeleteAllRmaps(Page, (PVOID)&Context, MmPageOutDeleteMapping);
if (!(Context.Segment->Flags & MM_PAGEFILE_SEGMENT) &&
!(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
{
DPRINT1("Found a %s private page (address %x) in a pagefile segment.\n",
Context.WasDirty ? "dirty" : "clean", Address);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (!Context.WasDirty && SwapEntry != 0)
{
{
DPRINT1("Found a %s private page (address %x) in a shared section segment.\n",
Context.WasDirty ? "dirty" : "clean", Address);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
if (!Context.WasDirty || SwapEntry != 0)
{
{
DPRINT1("Found a swapentry for a non private and direct mapped page (address %x)\n",
Address);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE);
if (!NT_SUCCESS(Status))
{
DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
PageOp->Status = STATUS_SUCCESS;
MmspCompleteAndReleasePageOp(PageOp);
{
DPRINT1("Found a swap entry for a non dirty, non private and not direct mapped page (address %x)\n",
Address);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmReleasePageMemoryConsumer(MC_USER, Page);
PageOp->Status = STATUS_SUCCESS;
MmUnlockAddressSpace(AddressSpace);
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmReleasePageMemoryConsumer(MC_USER, Page);
PageOp->Status = STATUS_SUCCESS;
MmUnlockAddressSpace(AddressSpace);
if (!NT_SUCCESS(Status))
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
else
NTSTATUS
NTAPI
-MmWritePageSectionView(PMM_AVL_TABLE AddressSpace,
+MmWritePageSectionView(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID Address,
PMM_PAGEOP PageOp)
DPRINT1("Trying to write back page from physical memory mapped at %X "
"process %d\n", Address,
Process ? Process->UniqueProcessId : 0);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
{
DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n",
Process ? Process->UniqueProcessId : 0, Address);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Page = MmGetPfnForProcess(Process, Address);
SwapEntry = MmGetSavedSwapEntryPage(Page);
return(STATUS_SUCCESS);
}
-VOID static
-MmAlterViewAttributes(PMM_AVL_TABLE AddressSpace,
+static VOID
+MmAlterViewAttributes(PMMSUPPORT AddressSpace,
PVOID BaseAddress,
ULONG RegionSize,
ULONG OldType,
NTSTATUS
NTAPI
-MmProtectSectionView(PMM_AVL_TABLE AddressSpace,
+MmProtectSectionView(PMMSUPPORT AddressSpace,
PMEMORY_AREA MemoryArea,
PVOID BaseAddress,
ULONG Length,
return(Status);
}
-NTSTATUS STDCALL
+NTSTATUS NTAPI
MmQuerySectionView(PMEMORY_AREA MemoryArea,
PVOID Address,
PMEMORY_BASIC_INFORMATION Info,
- PULONG ResultLength)
+ PSIZE_T ResultLength)
{
PMM_REGION Region;
PVOID RegionBaseAddress;
}
}
-VOID STDCALL
+VOID NTAPI
MmpDeleteSection(PVOID ObjectBody)
{
PROS_SECTION_OBJECT Section = (PROS_SECTION_OBJECT)ObjectBody;
}
}
-VOID STDCALL
+VOID NTAPI
MmpCloseSection(IN PEPROCESS Process OPTIONAL,
IN PVOID Object,
IN ACCESS_MASK GrantedAccess,
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create PhysicalMemory section\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
Status = ObInsertObject(PhysSection,
NULL,
ObjectTypeInitializer.CloseProcedure = MmpCloseSection;
ObjectTypeInitializer.ValidAccessMask = SECTION_ALL_ACCESS;
ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &MmSectionObjectType);
+
+ MmCreatePhysicalMemorySection();
return(STATUS_SUCCESS);
}
/*
* Initialize it
*/
+ RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
Section->SectionPageProtection = SectionPageProtection;
Section->AllocationAttributes = AllocationAttributes;
- Section->Segment = NULL;
- Section->FileObject = NULL;
Section->MaximumSize = MaximumSize;
Segment = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_SECTION_SEGMENT),
TAG_MM_SECTION_SEGMENT);
LARGE_INTEGER Offset;
CHAR Buffer;
FILE_STANDARD_INFORMATION FileInfo;
+ ULONG Length;
/*
* Create the section
/*
* Initialize it
*/
+ RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
Section->SectionPageProtection = SectionPageProtection;
Section->AllocationAttributes = AllocationAttributes;
- Section->Segment = NULL;
/*
* Check file access required
FileStandardInformation,
sizeof(FILE_STANDARD_INFORMATION),
&FileInfo,
- &Iosb.Information);
+ &Length);
+ Iosb.Information = Length;
if (!NT_SUCCESS(Status))
{
ObDereferenceObject(Section);
* FIXME: Revise this once a locking order for file size changes is
* decided
*/
- if (UMaximumSize != NULL)
+ if ((UMaximumSize != NULL) && (UMaximumSize->QuadPart != 0))
{
- MaximumSize = *UMaximumSize;
+ MaximumSize = *UMaximumSize;
}
else
{
if(Length == 0)
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
FileOffset = *Offset;
/* Negative/special offset: it cannot be used in this context */
if(FileOffset.u.HighPart < 0)
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
AdjustOffset = PAGE_ROUND_DOWN(FileOffset.u.LowPart);
*/
Buffer = ExAllocatePoolWithTag(PagedPool,
BufferSize,
- TAG('M', 'm', 'X', 'r'));
+ 'rXmM');
+ if (!Buffer)
+ {
+ KeBugCheck(MEMORY_MANAGEMENT);
+ }
UsedSize = 0;
}
else
{
- ExFreePoolWithTag(Buffer, TAG('M', 'm', 'X', 'r'));
+ ExFreePoolWithTag(Buffer, 'rXmM');
}
return Status;
*/
else
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
}
}
break;
}
- ExFreePoolWithTag(FileHeaderBuffer, TAG('M', 'm', 'X', 'r'));
+ ExFreePoolWithTag(FileHeaderBuffer, 'rXmM');
/*
* No loader handled the format
/*
* Initialize it
*/
+ RtlZeroMemory(Section, sizeof(ROS_SECTION_OBJECT));
Section->SectionPageProtection = SectionPageProtection;
Section->AllocationAttributes = AllocationAttributes;
ImageSectionObject, NULL))
{
/*
- * An other thread has initialized the some image in the background
+ * An other thread has initialized the same image in the background
*/
ExFreePool(ImageSectionObject->Segments);
ExFreePool(ImageSectionObject);
/*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
NtCreateSection (OUT PHANDLE SectionHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
LARGE_INTEGER SafeMaximumSize;
PVOID SectionObject;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
- if(MaximumSize != NULL && PreviousMode != KernelMode)
+ if(PreviousMode != KernelMode)
{
- _SEH_TRY
- {
- /* make a copy on the stack */
- SafeMaximumSize = ProbeForReadLargeInteger(MaximumSize);
- MaximumSize = &SafeMaximumSize;
- }
- _SEH_HANDLE
+ _SEH2_TRY
{
- Status = _SEH_GetExceptionCode();
+ if (MaximumSize != NULL)
+ {
+ /* make a copy on the stack */
+ SafeMaximumSize = ProbeForReadLargeInteger(MaximumSize);
+ MaximumSize = &SafeMaximumSize;
+ }
+ ProbeForWriteHandle(SectionHandle);
}
- _SEH_END;
-
- if(!NT_SUCCESS(Status))
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- return Status;
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
+ _SEH2_END;
}
Status = MmCreateSection(&SectionObject,
*
* REVISIONS
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
NtOpenSection(PHANDLE SectionHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
HANDLE hSection;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
{
- _SEH_TRY
+ _SEH2_TRY
{
ProbeForWriteHandle(SectionHandle);
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if(!NT_SUCCESS(Status))
- {
- return Status;
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
+ _SEH2_END;
}
Status = ObOpenObjectByName(ObjectAttributes,
if(NT_SUCCESS(Status))
{
- _SEH_TRY
+ _SEH2_TRY
{
*SectionHandle = hSection;
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH_GetExceptionCode();
+ Status = _SEH2_GetExceptionCode();
}
- _SEH_END;
+ _SEH2_END;
}
return(Status);
}
-NTSTATUS static
-MmMapViewOfSegment(PMM_AVL_TABLE AddressSpace,
+static NTSTATUS
+MmMapViewOfSegment(PMMSUPPORT AddressSpace,
PROS_SECTION_OBJECT Section,
PMM_SECTION_SEGMENT Segment,
PVOID* BaseAddress,
*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
NtMapViewOfSection(IN HANDLE SectionHandle,
IN HANDLE ProcessHandle,
IN OUT PVOID* BaseAddress OPTIONAL,
- IN ULONG ZeroBits OPTIONAL,
- IN ULONG CommitSize,
+ IN ULONG_PTR ZeroBits OPTIONAL,
+ IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
PROS_SECTION_OBJECT Section;
PEPROCESS Process;
KPROCESSOR_MODE PreviousMode;
- PMM_AVL_TABLE AddressSpace;
- NTSTATUS Status = STATUS_SUCCESS;
+ PMMSUPPORT AddressSpace;
+ NTSTATUS Status;
ULONG tmpProtect;
+ ACCESS_MASK DesiredAccess;
/*
* Check the protection
SafeSectionOffset.QuadPart = 0;
SafeViewSize = 0;
- _SEH_TRY
+ _SEH2_TRY
{
if(BaseAddress != NULL)
{
ProbeForWriteSize_t(ViewSize);
SafeViewSize = *ViewSize;
}
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if(!NT_SUCCESS(Status))
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- return Status;
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
+ _SEH2_END;
}
else
{
return(Status);
}
- AddressSpace = &Process->VadRoot;
+ AddressSpace = &Process->Vm;
+
+ /* Convert NT Protection Attr to Access Mask */
+ if (Protect == PAGE_READONLY)
+ {
+ DesiredAccess = SECTION_MAP_READ;
+ }
+ else if (Protect == PAGE_READWRITE)
+ {
+ DesiredAccess = SECTION_MAP_WRITE;
+ }
+ else if (Protect == PAGE_WRITECOPY)
+ {
+ DesiredAccess = SECTION_QUERY;
+ }
+ /* FIXME: Handle other Protection Attributes. For now keep previous behavior */
+ else
+ {
+ DesiredAccess = SECTION_MAP_READ;
+ }
Status = ObReferenceObjectByHandle(SectionHandle,
- SECTION_MAP_READ,
+ DesiredAccess,
MmSectionObjectType,
PreviousMode,
(PVOID*)(PVOID)&Section,
if(NT_SUCCESS(Status))
{
/* copy parameters back to the caller */
- _SEH_TRY
+ _SEH2_TRY
{
if(BaseAddress != NULL)
{
*ViewSize = SafeViewSize;
}
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH_GetExceptionCode();
+ Status = _SEH2_GetExceptionCode();
}
- _SEH_END;
+ _SEH2_END;
}
return(Status);
}
-VOID static
+static VOID
MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
PFN_TYPE Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
{
NTSTATUS Status;
PROS_SECTION_OBJECT Section;
PMM_SECTION_SEGMENT Segment;
- PMM_AVL_TABLE AddressSpace;
+ PMMSUPPORT AddressSpace;
PEPROCESS Process;
- AddressSpace = (PMM_AVL_TABLE)Context;
+ AddressSpace = (PMMSUPPORT)Context;
Process = MmGetAddressSpaceOwner(AddressSpace);
Address = (PVOID)PAGE_ROUND_DOWN(Address);
if (Status != STATUS_SUCCESS)
{
DPRINT1("Failed to wait for page op, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmLockAddressSpace(AddressSpace);
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
{
DPRINT1("Found a swap entry for a page in a pagefile section.\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmFreeSwapPage(SwapEntry);
}
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
{
DPRINT1("Found a private page in a pagefile section.\n");
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
/*
* Just dereference private pages
}
static NTSTATUS
-MmUnmapViewOfSegment(PMM_AVL_TABLE AddressSpace,
+MmUnmapViewOfSegment(PMMSUPPORT AddressSpace,
PVOID BaseAddress)
{
NTSTATUS Status;
/*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
MmUnmapViewOfSection(PEPROCESS Process,
PVOID BaseAddress)
{
NTSTATUS Status;
PMEMORY_AREA MemoryArea;
- PMM_AVL_TABLE AddressSpace;
+ PMMSUPPORT AddressSpace;
PROS_SECTION_OBJECT Section;
PMM_PAGEOP PageOp;
ULONG_PTR Offset;
ASSERT(Process);
- AddressSpace = &Process->VadRoot;
+ AddressSpace = &Process->Vm;
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
if (Status != STATUS_SUCCESS)
{
DPRINT1("Failed to wait for page op, status = %x\n", Status);
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
MmLockAddressSpace(AddressSpace);
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
}
if (i >= NrSegments)
{
- ASSERT(FALSE);
+ KeBugCheck(MEMORY_MANAGEMENT);
}
for (i = 0; i < NrSegments; i++)
Status = MmUnmapViewOfSegment(AddressSpace, BaseAddress);
}
+ MmUnlockAddressSpace(AddressSpace);
+
/* Notify debugger */
if (ImageBaseAddress) DbgkUnMapViewOfSection(ImageBaseAddress);
- MmUnlockAddressSpace(AddressSpace);
return(STATUS_SUCCESS);
}
*
* REVISIONS
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
NtUnmapViewOfSection (HANDLE ProcessHandle,
PVOID BaseAddress)
{
*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
NtQuerySection(IN HANDLE SectionHandle,
IN SECTION_INFORMATION_CLASS SectionInformationClass,
OUT PVOID SectionInformation,
- IN ULONG SectionInformationLength,
- OUT PULONG ResultLength OPTIONAL)
+ IN SIZE_T SectionInformationLength,
+ OUT PSIZE_T ResultLength OPTIONAL)
{
PROS_SECTION_OBJECT Section;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
+ PAGED_CODE();
PreviousMode = ExGetPreviousMode();
sizeof(ExSectionInfoClass) / sizeof(ExSectionInfoClass[0]),
SectionInformation,
SectionInformationLength,
+ NULL,
ResultLength,
PreviousMode);
{
PSECTION_BASIC_INFORMATION Sbi = (PSECTION_BASIC_INFORMATION)SectionInformation;
- _SEH_TRY
+ _SEH2_TRY
{
Sbi->Attributes = Section->AllocationAttributes;
if (Section->AllocationAttributes & SEC_IMAGE)
}
Status = STATUS_SUCCESS;
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH_GetExceptionCode();
+ Status = _SEH2_GetExceptionCode();
}
- _SEH_END;
+ _SEH2_END;
break;
}
{
PSECTION_IMAGE_INFORMATION Sii = (PSECTION_IMAGE_INFORMATION)SectionInformation;
- _SEH_TRY
+ _SEH2_TRY
{
memset(Sii, 0, sizeof(SECTION_IMAGE_INFORMATION));
if (Section->AllocationAttributes & SEC_IMAGE)
}
Status = STATUS_SUCCESS;
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH_GetExceptionCode();
+ Status = _SEH2_GetExceptionCode();
}
- _SEH_END;
+ _SEH2_END;
break;
}
* @todo Move the actual code to internal function MmExtendSection.
* @unimplemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
NtExtendSection(IN HANDLE SectionHandle,
IN PLARGE_INTEGER NewMaximumSize)
{
LARGE_INTEGER SafeNewMaximumSize;
PROS_SECTION_OBJECT Section;
KPROCESSOR_MODE PreviousMode;
- NTSTATUS Status = STATUS_SUCCESS;
+ NTSTATUS Status;
PreviousMode = ExGetPreviousMode();
if(PreviousMode != KernelMode)
{
- _SEH_TRY
+ _SEH2_TRY
{
/* make a copy on the stack */
SafeNewMaximumSize = ProbeForReadLargeInteger(NewMaximumSize);
NewMaximumSize = &SafeNewMaximumSize;
}
- _SEH_HANDLE
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if(!NT_SUCCESS(Status))
- {
- return Status;
+ /* Return the exception code */
+ _SEH2_YIELD(return _SEH2_GetExceptionCode());
}
+ _SEH2_END;
}
Status = ObReferenceObjectByHandle(SectionHandle,
if (!(Section->AllocationAttributes & SEC_FILE))
{
- ObfDereferenceObject(Section);
+ ObDereferenceObject(Section);
return STATUS_INVALID_PARAMETER;
}
*
* REVISIONS
*/
-PVOID STDCALL
+PVOID NTAPI
MmAllocateSection (IN ULONG Length, PVOID BaseAddress)
{
PVOID Result;
MEMORY_AREA* marea;
NTSTATUS Status;
- PMM_AVL_TABLE AddressSpace;
+ PMMSUPPORT AddressSpace;
PHYSICAL_ADDRESS BoundaryAddressMultiple;
DPRINT("MmAllocateSection(Length %x)\n",Length);
*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
MmMapViewOfSection(IN PVOID SectionObject,
IN PEPROCESS Process,
IN OUT PVOID *BaseAddress,
- IN ULONG ZeroBits,
- IN ULONG CommitSize,
+ IN ULONG_PTR ZeroBits,
+ IN SIZE_T CommitSize,
IN OUT PLARGE_INTEGER SectionOffset OPTIONAL,
IN OUT PSIZE_T ViewSize,
IN SECTION_INHERIT InheritDisposition,
IN ULONG Protect)
{
PROS_SECTION_OBJECT Section;
- PMM_AVL_TABLE AddressSpace;
+ PMMSUPPORT AddressSpace;
ULONG ViewOffset;
NTSTATUS Status = STATUS_SUCCESS;
ASSERT(Process);
- if (Protect != PAGE_READONLY &&
- Protect != PAGE_READWRITE &&
- Protect != PAGE_WRITECOPY &&
- Protect != PAGE_EXECUTE &&
- Protect != PAGE_EXECUTE_READ &&
- Protect != PAGE_EXECUTE_READWRITE &&
- Protect != PAGE_EXECUTE_WRITECOPY)
+ if (!Protect || Protect & ~PAGE_FLAGS_VALID_FOR_SECTION)
{
return STATUS_INVALID_PAGE_PROTECTION;
}
Section = (PROS_SECTION_OBJECT)SectionObject;
- AddressSpace = &Process->VadRoot;
+ AddressSpace = &Process->Vm;
AllocationType |= (Section->AllocationAttributes & SEC_NO_CHANGE);
if ((Protect & (PAGE_READWRITE|PAGE_EXECUTE_READWRITE)) &&
!(Section->SectionPageProtection & (PAGE_READWRITE|PAGE_EXECUTE_READWRITE)))
{
+ MmUnlockAddressSpace(AddressSpace);
return STATUS_SECTION_PROTECTION;
}
/* check for read access */
if ((Protect & (PAGE_READONLY|PAGE_WRITECOPY|PAGE_EXECUTE_READ|PAGE_EXECUTE_WRITECOPY)) &&
!(Section->SectionPageProtection & (PAGE_READONLY|PAGE_READWRITE|PAGE_WRITECOPY|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY)))
{
+ MmUnlockAddressSpace(AddressSpace);
return STATUS_SECTION_PROTECTION;
}
/* check for execute access */
if ((Protect & (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY)) &&
!(Section->SectionPageProtection & (PAGE_EXECUTE|PAGE_EXECUTE_READ|PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY)))
{
+ MmUnlockAddressSpace(AddressSpace);
return STATUS_SECTION_PROTECTION;
}
(*ViewSize) = Section->MaximumSize.u.LowPart - ViewOffset;
}
+ *ViewSize = PAGE_ROUND_UP(*ViewSize);
+
MmLockSectionSegment(Section->Segment);
Status = MmMapViewOfSegment(AddressSpace,
Section,
/*
* @unimplemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
MmCanFileBeTruncated (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN PLARGE_INTEGER NewFileSize)
{
- UNIMPLEMENTED;
- return (FALSE);
+ /* Check whether an ImageSectionObject exists */
+ if (SectionObjectPointer->ImageSectionObject != NULL)
+ {
+ DPRINT1("ERROR: File can't be truncated because it has an image section\n");
+ return FALSE;
+ }
+
+ if (SectionObjectPointer->DataSectionObject != NULL)
+ {
+ PMM_SECTION_SEGMENT Segment;
+
+ Segment = (PMM_SECTION_SEGMENT)SectionObjectPointer->
+ DataSectionObject;
+
+ if (Segment->ReferenceCount != 0)
+ {
+ /* Check size of file */
+ if (SectionObjectPointer->SharedCacheMap)
+ {
+ PBCB Bcb = SectionObjectPointer->SharedCacheMap;
+ if (NewFileSize->QuadPart <= Bcb->FileSize.QuadPart)
+ {
+ return FALSE;
+ }
+ }
+ }
+ else
+ {
+ /* Something must gone wrong
+ * how can we have a Section but no
+ * reference? */
+ DPRINT("ERROR: DataSectionObject without reference!\n");
+ }
+ }
+
+ DPRINT("FIXME: didn't check for outstanding write probes\n");
+
+ return TRUE;
}
/*
* @unimplemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
MmDisableModifiedWriteOfSection (ULONG Unknown0)
{
UNIMPLEMENTED;
/*
* @implemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
MmFlushImageSection (IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN MMFLUSH_TYPE FlushType)
{
/*
* @unimplemented
*/
-BOOLEAN STDCALL
+BOOLEAN NTAPI
MmForceSectionClosed (
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
IN BOOLEAN DelayClose)
/*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
MmMapViewInSystemSpace (IN PVOID SectionObject,
OUT PVOID * MappedBase,
- IN OUT PULONG ViewSize)
+ IN OUT PSIZE_T ViewSize)
{
PROS_SECTION_OBJECT Section;
- PMM_AVL_TABLE AddressSpace;
+ PMMSUPPORT AddressSpace;
NTSTATUS Status;
DPRINT("MmMapViewInSystemSpace() called\n");
* @unimplemented
*/
NTSTATUS
-STDCALL
+NTAPI
MmMapViewInSessionSpace (
IN PVOID Section,
OUT PVOID *MappedBase,
/*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
MmUnmapViewInSystemSpace (IN PVOID MappedBase)
{
- PMM_AVL_TABLE AddressSpace;
+ PMMSUPPORT AddressSpace;
NTSTATUS Status;
DPRINT("MmUnmapViewInSystemSpace() called\n");
* @unimplemented
*/
NTSTATUS
-STDCALL
+NTAPI
MmUnmapViewInSessionSpace (
IN PVOID MappedBase
)
return STATUS_NOT_IMPLEMENTED;
}
-/*
- * @unimplemented
- */
-NTSTATUS STDCALL
-MmSetBankedSection (ULONG Unknown0,
- ULONG Unknown1,
- ULONG Unknown2,
- ULONG Unknown3,
- ULONG Unknown4,
- ULONG Unknown5)
-{
- UNIMPLEMENTED;
- return (STATUS_NOT_IMPLEMENTED);
-}
-
-
/**********************************************************************
* NAME EXPORTED
* MmCreateSection@
*
* @implemented
*/
-NTSTATUS STDCALL
+NTSTATUS NTAPI
MmCreateSection (OUT PVOID * Section,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
* Check the protection
*/
Protection = SectionPageProtection & ~(PAGE_GUARD|PAGE_NOCACHE);
- if (Protection != PAGE_NOACCESS &&
- Protection != PAGE_READONLY &&
+ if (Protection != PAGE_READONLY &&
Protection != PAGE_READWRITE &&
Protection != PAGE_WRITECOPY &&
Protection != PAGE_EXECUTE &&
AllocationAttributes));
}
-NTSTATUS
-NTAPI
-NtAllocateUserPhysicalPages(IN HANDLE ProcessHandle,
- IN OUT PULONG NumberOfPages,
- IN OUT PULONG UserPfnArray)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-NtMapUserPhysicalPages(IN PVOID VirtualAddresses,
- IN ULONG NumberOfPages,
- IN OUT PULONG UserPfnArray)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-NtMapUserPhysicalPagesScatter(IN PVOID *VirtualAddresses,
- IN ULONG NumberOfPages,
- IN OUT PULONG UserPfnArray)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
-NTSTATUS
-NTAPI
-NtFreeUserPhysicalPages(IN HANDLE ProcessHandle,
- IN OUT PULONG NumberOfPages,
- IN OUT PULONG UserPfnArray)
-{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS
NTAPI
NtAreMappedFilesTheSame(IN PVOID File1MappedAsAnImage,