2000-05-13 13:51:08 +00:00
|
|
|
/* $Id: section.c,v 1.30 2000/05/13 13:51:05 dwelch Exp $
|
1999-08-29 06:59:11 +00:00
|
|
|
*
|
1998-08-25 04:27:26 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* FILE: ntoskrnl/mm/section.c
|
|
|
|
* PURPOSE: Implements section objects
|
|
|
|
* PROGRAMMER: David Welch (welch@mcmail.com)
|
|
|
|
* UPDATE HISTORY:
|
|
|
|
* Created 22/05/98
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
|
|
|
#include <ddk/ntddk.h>
|
1998-09-05 17:34:23 +00:00
|
|
|
#include <internal/mm.h>
|
1998-10-05 04:01:30 +00:00
|
|
|
#include <internal/ob.h>
|
|
|
|
#include <internal/io.h>
|
|
|
|
#include <internal/ps.h>
|
1999-03-25 00:37:06 +00:00
|
|
|
#include <wchar.h>
|
1998-08-25 04:27:26 +00:00
|
|
|
|
1998-10-05 04:01:30 +00:00
|
|
|
#define NDEBUG
|
1998-08-25 04:27:26 +00:00
|
|
|
#include <internal/debug.h>
|
|
|
|
|
1998-10-05 04:01:30 +00:00
|
|
|
/* GLOBALS *******************************************************************/
|
|
|
|
|
2000-04-02 13:32:43 +00:00
|
|
|
POBJECT_TYPE EXPORTED MmSectionObjectType = NULL;
|
1998-10-05 04:01:30 +00:00
|
|
|
|
1998-08-25 04:27:26 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
VOID MmLockSection(PSECTION_OBJECT Section)
|
|
|
|
{
|
|
|
|
KeWaitForSingleObject(&Section->Lock,
|
|
|
|
UserRequest,
|
|
|
|
KernelMode,
|
|
|
|
FALSE,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID MmUnlockSection(PSECTION_OBJECT Section)
|
|
|
|
{
|
|
|
|
KeReleaseMutex(&Section->Lock, FALSE);
|
|
|
|
}
|
|
|
|
|
2000-04-03 21:54:42 +00:00
|
|
|
VOID MmSetPageEntrySection(PSECTION_OBJECT Section,
|
|
|
|
ULONG Offset,
|
|
|
|
PVOID Entry)
|
|
|
|
{
|
|
|
|
PSECTION_PAGE_TABLE Table;
|
|
|
|
ULONG DirectoryOffset;
|
|
|
|
ULONG TableOffset;
|
|
|
|
|
|
|
|
DirectoryOffset = PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(Offset);
|
|
|
|
Table = Section->PageDirectory.PageTables[DirectoryOffset];
|
|
|
|
if (Table == NULL)
|
|
|
|
{
|
|
|
|
Table =
|
|
|
|
Section->PageDirectory.PageTables[DirectoryOffset] =
|
|
|
|
ExAllocatePool(NonPagedPool, sizeof(SECTION_PAGE_TABLE));
|
|
|
|
}
|
|
|
|
TableOffset = PAGE_TO_SECTION_PAGE_TABLE_OFFSET(Offset);
|
|
|
|
Table->Pages[TableOffset] = Entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
PVOID MmGetPageEntrySection(PSECTION_OBJECT Section,
|
|
|
|
ULONG Offset)
|
|
|
|
{
|
|
|
|
PSECTION_PAGE_TABLE Table;
|
|
|
|
PVOID Entry;
|
|
|
|
ULONG DirectoryOffset;
|
|
|
|
ULONG TableOffset;
|
|
|
|
|
|
|
|
DirectoryOffset = PAGE_TO_SECTION_PAGE_DIRECTORY_OFFSET(Offset);
|
|
|
|
Table = Section->PageDirectory.PageTables[DirectoryOffset];
|
|
|
|
if (Table == NULL)
|
|
|
|
{
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
TableOffset = PAGE_TO_SECTION_PAGE_TABLE_OFFSET(Offset);
|
|
|
|
Entry = Table->Pages[TableOffset];
|
|
|
|
return(Entry);
|
|
|
|
}
|
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
NTSTATUS MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
|
|
|
MEMORY_AREA* MemoryArea,
|
|
|
|
PVOID Address)
|
1999-11-24 11:51:55 +00:00
|
|
|
{
|
2000-05-13 13:51:08 +00:00
|
|
|
LARGE_INTEGER Offset;
|
|
|
|
IO_STATUS_BLOCK IoStatus;
|
|
|
|
PMDL Mdl;
|
|
|
|
PVOID Page;
|
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG PAddress;
|
|
|
|
PSECTION_OBJECT Section;
|
|
|
|
PVOID Entry;
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
DPRINT("MmSectionHandleFault(MemoryArea %x, Address %x)\n",
|
|
|
|
MemoryArea,Address);
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
if (MmIsPagePresent(NULL, Address))
|
|
|
|
{
|
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
PAddress = (ULONG)PAGE_ROUND_DOWN(((ULONG)Address));
|
|
|
|
Offset.QuadPart = (PAddress - (ULONG)MemoryArea->BaseAddress) +
|
|
|
|
MemoryArea->Data.SectionData.ViewOffset;
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
Section = MemoryArea->Data.SectionData.Section;
|
|
|
|
|
|
|
|
MmLockSection(Section);
|
|
|
|
|
|
|
|
Entry = MmGetPageEntrySection(Section, Offset.QuadPart);
|
|
|
|
|
|
|
|
if (Entry == NULL)
|
|
|
|
{
|
|
|
|
Mdl = MmCreateMdl(NULL, NULL, PAGESIZE);
|
|
|
|
MmBuildMdlFromPages(Mdl);
|
|
|
|
Page = MmGetMdlPageAddress(Mdl, 0);
|
|
|
|
MmUnlockSection(Section);
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
Status = IoPageRead(MemoryArea->Data.SectionData.Section->FileObject,
|
|
|
|
Mdl,
|
|
|
|
&Offset,
|
|
|
|
&IoStatus);
|
|
|
|
if (!NT_SUCCESS(Status))
|
1999-11-24 11:51:55 +00:00
|
|
|
{
|
2000-05-13 13:51:08 +00:00
|
|
|
return(Status);
|
1999-11-24 11:51:55 +00:00
|
|
|
}
|
2000-05-13 13:51:08 +00:00
|
|
|
|
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
MmLockSection(Section);
|
|
|
|
|
|
|
|
Entry = MmGetPageEntrySection(Section, Offset.QuadPart);
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
if (Entry == NULL)
|
|
|
|
{
|
|
|
|
MmSetPageEntrySection(Section,
|
|
|
|
Offset.QuadPart,
|
|
|
|
Page);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MmDereferencePage(Page);
|
|
|
|
Page = Entry;
|
|
|
|
MmReferencePage(Page);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Page = Entry;
|
|
|
|
MmReferencePage(Page);
|
1999-11-24 11:51:55 +00:00
|
|
|
}
|
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
MmSetPage(NULL,
|
|
|
|
Address,
|
|
|
|
MemoryArea->Attributes,
|
|
|
|
(ULONG)Page);
|
|
|
|
MmUnlockSection(Section);
|
|
|
|
|
|
|
|
return(STATUS_SUCCESS);
|
1999-11-24 11:51:55 +00:00
|
|
|
}
|
|
|
|
|
1999-02-01 20:58:37 +00:00
|
|
|
VOID MmpDeleteSection(PVOID ObjectBody)
|
|
|
|
{
|
2000-04-07 02:24:03 +00:00
|
|
|
DPRINT("MmpDeleteSection(ObjectBody %x)\n", ObjectBody);
|
2000-04-03 21:54:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID MmpCloseSection(PVOID ObjectBody,
|
|
|
|
ULONG HandleCount)
|
|
|
|
{
|
2000-04-07 02:24:03 +00:00
|
|
|
DPRINT("MmpCloseSection(OB %x, HC %d) RC %d\n",
|
2000-04-03 21:54:42 +00:00
|
|
|
ObjectBody, HandleCount, ObGetReferenceCount(ObjectBody));
|
1999-02-01 20:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS MmpCreateSection(PVOID ObjectBody,
|
|
|
|
PVOID Parent,
|
1999-03-25 00:37:06 +00:00
|
|
|
PWSTR RemainingPath,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
1999-02-01 20:58:37 +00:00
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
2000-01-12 19:05:32 +00:00
|
|
|
DPRINT("MmpCreateDevice(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
1999-02-01 20:58:37 +00:00
|
|
|
ObjectBody, Parent, RemainingPath);
|
|
|
|
|
|
|
|
if (RemainingPath == NULL)
|
|
|
|
{
|
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
|
|
|
|
1999-11-25 23:37:02 +00:00
|
|
|
if (wcschr(RemainingPath+1, L'\\') != NULL)
|
1999-02-01 20:58:37 +00:00
|
|
|
{
|
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = ObReferenceObjectByPointer(Parent,
|
|
|
|
STANDARD_RIGHTS_REQUIRED,
|
|
|
|
ObDirectoryType,
|
|
|
|
UserMode);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return(Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
ObAddEntryDirectory(Parent, ObjectBody, RemainingPath+1);
|
1999-04-18 08:56:23 +00:00
|
|
|
ObDereferenceObject(Parent);
|
|
|
|
|
1999-02-01 20:58:37 +00:00
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
|
|
|
|
1998-10-05 04:01:30 +00:00
|
|
|
NTSTATUS MmInitSectionImplementation(VOID)
|
|
|
|
{
|
2000-04-02 13:32:43 +00:00
|
|
|
MmSectionObjectType = ExAllocatePool(NonPagedPool,sizeof(OBJECT_TYPE));
|
|
|
|
|
2000-04-03 21:54:42 +00:00
|
|
|
RtlInitUnicodeString(&MmSectionObjectType->TypeName, L"Section");
|
|
|
|
|
2000-04-02 13:32:43 +00:00
|
|
|
MmSectionObjectType->TotalObjects = 0;
|
|
|
|
MmSectionObjectType->TotalHandles = 0;
|
|
|
|
MmSectionObjectType->MaxObjects = ULONG_MAX;
|
|
|
|
MmSectionObjectType->MaxHandles = ULONG_MAX;
|
|
|
|
MmSectionObjectType->PagedPoolCharge = 0;
|
|
|
|
MmSectionObjectType->NonpagedPoolCharge = sizeof(SECTION_OBJECT);
|
|
|
|
MmSectionObjectType->Dump = NULL;
|
|
|
|
MmSectionObjectType->Open = NULL;
|
2000-04-03 21:54:42 +00:00
|
|
|
MmSectionObjectType->Close = MmpCloseSection;
|
2000-04-02 13:32:43 +00:00
|
|
|
MmSectionObjectType->Delete = MmpDeleteSection;
|
|
|
|
MmSectionObjectType->Parse = NULL;
|
|
|
|
MmSectionObjectType->Security = NULL;
|
|
|
|
MmSectionObjectType->QueryName = NULL;
|
|
|
|
MmSectionObjectType->OkayToClose = NULL;
|
|
|
|
MmSectionObjectType->Create = MmpCreateSection;
|
1998-10-05 04:01:30 +00:00
|
|
|
|
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-02 13:32:43 +00:00
|
|
|
/* FIXME: NtCS should call MmCS */
|
1999-11-24 11:51:55 +00:00
|
|
|
NTSTATUS STDCALL NtCreateSection (OUT PHANDLE SectionHandle,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
|
|
|
IN PLARGE_INTEGER MaximumSize OPTIONAL,
|
|
|
|
IN ULONG SectionPageProtection OPTIONAL,
|
|
|
|
IN ULONG AllocationAttributes,
|
|
|
|
IN HANDLE FileHandle OPTIONAL)
|
1998-09-05 17:34:23 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Creates a section object.
|
|
|
|
* ARGUMENTS:
|
|
|
|
* SectionHandle (OUT) = Caller supplied storage for the resulting
|
|
|
|
* handle
|
|
|
|
* DesiredAccess = Specifies the desired access to the section can be a
|
|
|
|
* combination of STANDARD_RIGHTS_REQUIRED |
|
|
|
|
* SECTION_QUERY | SECTION_MAP_WRITE |
|
|
|
|
* SECTION_MAP_READ | SECTION_MAP_EXECUTE.
|
|
|
|
* ObjectAttribute = Initialized attributes for the object can be used
|
|
|
|
* to create a named section
|
|
|
|
* MaxiumSize = Maximizes the size of the memory section. Must be
|
|
|
|
* non-NULL for a page-file backed section.
|
|
|
|
* If value specified for a mapped file and the file is
|
|
|
|
* not large enough, file will be extended.
|
|
|
|
* SectionPageProtection = Can be a combination of PAGE_READONLY |
|
|
|
|
* PAGE_READWRITE | PAGE_WRITEONLY |
|
|
|
|
* PAGE_WRITECOPY.
|
|
|
|
* AllocationAttributes = can be a combination of SEC_IMAGE |
|
|
|
|
* SEC_RESERVE
|
|
|
|
* FileHandle = Handle to a file to create a section mapped to a file
|
|
|
|
* instead of a memory backed section.
|
|
|
|
* RETURNS: Status
|
|
|
|
*/
|
|
|
|
{
|
1998-10-05 04:01:30 +00:00
|
|
|
PSECTION_OBJECT Section;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
1999-06-18 22:11:21 +00:00
|
|
|
DPRINT("NtCreateSection()\n");
|
1999-01-01 22:03:17 +00:00
|
|
|
|
1999-02-01 20:58:37 +00:00
|
|
|
Section = ObCreateObject(SectionHandle,
|
|
|
|
DesiredAccess,
|
|
|
|
ObjectAttributes,
|
2000-04-02 13:32:43 +00:00
|
|
|
MmSectionObjectType);
|
1999-12-30 01:51:42 +00:00
|
|
|
DPRINT("SectionHandle %x\n", SectionHandle);
|
1999-02-06 18:34:14 +00:00
|
|
|
if (Section == NULL)
|
|
|
|
{
|
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
1998-10-05 04:01:30 +00:00
|
|
|
if (MaximumSize != NULL)
|
|
|
|
{
|
|
|
|
Section->MaximumSize = *MaximumSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-04-27 14:15:56 +00:00
|
|
|
Section->MaximumSize.QuadPart = 0xffffffff;
|
1998-10-05 04:01:30 +00:00
|
|
|
}
|
|
|
|
Section->SectionPageProtection = SectionPageProtection;
|
1999-02-01 20:58:37 +00:00
|
|
|
Section->AllocateAttributes = AllocationAttributes;
|
1999-11-24 11:51:55 +00:00
|
|
|
InitializeListHead(&Section->ViewListHead);
|
|
|
|
KeInitializeSpinLock(&Section->ViewListLock);
|
2000-05-13 13:51:08 +00:00
|
|
|
KeInitializeMutex(&Section->Lock, 0);
|
1999-02-01 20:58:37 +00:00
|
|
|
|
1999-12-30 01:51:42 +00:00
|
|
|
if (FileHandle != (HANDLE)0xffffffff)
|
1998-10-05 04:01:30 +00:00
|
|
|
{
|
1999-02-01 20:58:37 +00:00
|
|
|
Status = ObReferenceObjectByHandle(FileHandle,
|
|
|
|
FILE_READ_DATA,
|
2000-03-26 19:38:32 +00:00
|
|
|
IoFileObjectType,
|
1999-02-01 20:58:37 +00:00
|
|
|
UserMode,
|
|
|
|
(PVOID*)&Section->FileObject,
|
|
|
|
NULL);
|
1999-12-30 01:51:42 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
1999-02-01 20:58:37 +00:00
|
|
|
{
|
1999-06-18 22:11:21 +00:00
|
|
|
DPRINT("NtCreateSection() = %x\n",Status);
|
1999-12-20 02:14:40 +00:00
|
|
|
ZwClose(SectionHandle);
|
|
|
|
ObDereferenceObject(Section);
|
1999-02-01 20:58:37 +00:00
|
|
|
return(Status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Section->FileObject = NULL;
|
1998-10-05 04:01:30 +00:00
|
|
|
}
|
1999-12-22 14:48:30 +00:00
|
|
|
|
1999-06-18 22:11:21 +00:00
|
|
|
DPRINT("NtCreateSection() = STATUS_SUCCESS\n");
|
1999-12-22 14:48:30 +00:00
|
|
|
ObDereferenceObject(Section);
|
1998-10-05 04:01:30 +00:00
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
|
|
|
|
1998-09-05 17:34:23 +00:00
|
|
|
|
1999-08-29 06:59:11 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* NAME
|
|
|
|
* NtOpenSection
|
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
* SectionHandle
|
|
|
|
*
|
|
|
|
* DesiredAccess
|
|
|
|
*
|
|
|
|
* ObjectAttributes
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
|
|
|
*
|
|
|
|
* REVISIONS
|
|
|
|
*
|
|
|
|
*/
|
1999-11-24 11:51:55 +00:00
|
|
|
NTSTATUS STDCALL NtOpenSection(PHANDLE SectionHandle,
|
|
|
|
ACCESS_MASK DesiredAccess,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
2000-05-13 13:51:08 +00:00
|
|
|
PVOID Object;
|
|
|
|
NTSTATUS Status;
|
1998-10-05 04:01:30 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
*SectionHandle = 0;
|
1999-02-01 20:58:37 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
Status = ObReferenceObjectByName(ObjectAttributes->ObjectName,
|
|
|
|
ObjectAttributes->Attributes,
|
|
|
|
NULL,
|
|
|
|
DesiredAccess,
|
2000-04-02 13:32:43 +00:00
|
|
|
MmSectionObjectType,
|
1999-11-24 11:51:55 +00:00
|
|
|
UserMode,
|
|
|
|
NULL,
|
|
|
|
&Object);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
1999-08-29 06:59:11 +00:00
|
|
|
return Status;
|
1999-11-24 11:51:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Status = ObCreateHandle(PsGetCurrentProcess(),
|
|
|
|
Object,
|
|
|
|
DesiredAccess,
|
|
|
|
FALSE,
|
|
|
|
SectionHandle);
|
|
|
|
ObDereferenceObject(Object);
|
|
|
|
return(Status);
|
1998-10-05 04:01:30 +00:00
|
|
|
}
|
|
|
|
|
1999-08-29 06:59:11 +00:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* NAME EXPORTED
|
|
|
|
* NtMapViewOfSection
|
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
* Maps a view of a section into the virtual address space of a
|
|
|
|
* process.
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
* SectionHandle
|
|
|
|
* Handle of the section.
|
|
|
|
*
|
|
|
|
* ProcessHandle
|
|
|
|
* Handle of the process.
|
|
|
|
*
|
|
|
|
* BaseAddress
|
|
|
|
* Desired base address (or NULL) on entry;
|
|
|
|
* Actual base address of the view on exit.
|
|
|
|
*
|
|
|
|
* ZeroBits
|
|
|
|
* Number of high order address bits that must be zero.
|
|
|
|
*
|
|
|
|
* CommitSize
|
|
|
|
* Size in bytes of the initially committed section of
|
|
|
|
* the view.
|
|
|
|
*
|
|
|
|
* SectionOffset
|
|
|
|
* Offset in bytes from the beginning of the section
|
|
|
|
* to the beginning of the view.
|
|
|
|
*
|
|
|
|
* ViewSize
|
|
|
|
* Desired length of map (or zero to map all) on entry
|
|
|
|
* Actual length mapped on exit.
|
|
|
|
*
|
|
|
|
* InheritDisposition
|
|
|
|
* Specified how the view is to be shared with
|
|
|
|
* child processes.
|
|
|
|
*
|
|
|
|
* AllocateType
|
|
|
|
* Type of allocation for the pages.
|
|
|
|
*
|
|
|
|
* Protect
|
|
|
|
* Protection for the committed region of the view.
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
|
|
|
* Status.
|
|
|
|
*/
|
1999-11-24 11:51:55 +00:00
|
|
|
NTSTATUS STDCALL NtMapViewOfSection(HANDLE SectionHandle,
|
|
|
|
HANDLE ProcessHandle,
|
|
|
|
PVOID* BaseAddress,
|
|
|
|
ULONG ZeroBits,
|
|
|
|
ULONG CommitSize,
|
|
|
|
PLARGE_INTEGER SectionOffset,
|
|
|
|
PULONG ViewSize,
|
2000-05-13 13:51:08 +00:00
|
|
|
SECTION_INHERIT InheritDisposition,
|
1999-11-24 11:51:55 +00:00
|
|
|
ULONG AllocationType,
|
|
|
|
ULONG Protect)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
2000-05-13 13:51:08 +00:00
|
|
|
PSECTION_OBJECT Section;
|
|
|
|
PEPROCESS Process;
|
|
|
|
MEMORY_AREA* Result;
|
|
|
|
NTSTATUS Status;
|
1999-11-24 11:51:55 +00:00
|
|
|
KIRQL oldIrql;
|
|
|
|
ULONG ViewOffset;
|
2000-03-29 13:11:55 +00:00
|
|
|
PMADDRESS_SPACE AddressSpace;
|
1999-03-19 05:55:55 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
DPRINT("NtMapViewOfSection(Section:%08lx, Process:%08lx,\n"
|
|
|
|
" Base:%08lx, ZeroBits:%08lx, CommitSize:%08lx,\n"
|
|
|
|
" SectionOffs:%08lx, *ViewSize:%08lx, InheritDisp:%08lx,\n"
|
|
|
|
" AllocType:%08lx, Protect:%08lx)\n",
|
|
|
|
SectionHandle, ProcessHandle, BaseAddress, ZeroBits,
|
|
|
|
CommitSize, SectionOffset, *ViewSize, InheritDisposition,
|
|
|
|
AllocationType, Protect);
|
1998-10-05 04:01:30 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
DPRINT(" *Base:%08lx\n", *BaseAddress);
|
1998-10-05 04:01:30 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
Status = ObReferenceObjectByHandle(SectionHandle,
|
|
|
|
SECTION_MAP_READ,
|
2000-04-02 13:32:43 +00:00
|
|
|
MmSectionObjectType,
|
1999-11-24 11:51:55 +00:00
|
|
|
UserMode,
|
|
|
|
(PVOID*)&Section,
|
|
|
|
NULL);
|
|
|
|
if (!(NT_SUCCESS(Status)))
|
|
|
|
{
|
|
|
|
DPRINT("ObReference failed rc=%x\n",Status);
|
|
|
|
return Status;
|
|
|
|
}
|
1999-03-19 05:55:55 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
DPRINT("Section %x\n",Section);
|
2000-05-13 13:51:08 +00:00
|
|
|
MmLockSection(Section);
|
1999-03-19 05:55:55 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
Status = ObReferenceObjectByHandle(ProcessHandle,
|
|
|
|
PROCESS_VM_OPERATION,
|
|
|
|
PsProcessType,
|
|
|
|
UserMode,
|
|
|
|
(PVOID*)&Process,
|
|
|
|
NULL);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
1999-11-25 10:47:58 +00:00
|
|
|
DPRINT("ObReferenceObjectByHandle(ProcessHandle, ...) failed (%x)\n",
|
|
|
|
Status);
|
2000-05-13 13:51:08 +00:00
|
|
|
MmUnlockSection(Section);
|
1999-11-24 11:51:55 +00:00
|
|
|
ObDereferenceObject(Section);
|
|
|
|
return Status;
|
|
|
|
}
|
1998-10-05 04:01:30 +00:00
|
|
|
|
2000-03-29 13:11:55 +00:00
|
|
|
AddressSpace = &Process->Pcb.AddressSpace;
|
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
DPRINT("Process %x\n", Process);
|
|
|
|
DPRINT("ViewSize %x\n",ViewSize);
|
|
|
|
|
|
|
|
if (SectionOffset == NULL)
|
|
|
|
{
|
|
|
|
ViewOffset = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ViewOffset = SectionOffset->u.LowPart;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (((*ViewSize)+ViewOffset) > Section->MaximumSize.u.LowPart)
|
1999-08-29 06:59:11 +00:00
|
|
|
{
|
1999-11-24 11:51:55 +00:00
|
|
|
(*ViewSize) = Section->MaximumSize.u.LowPart - ViewOffset;
|
1999-08-29 06:59:11 +00:00
|
|
|
}
|
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
DPRINT("Creating memory area\n");
|
2000-03-29 13:11:55 +00:00
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
Status = MmCreateMemoryArea(Process,
|
|
|
|
&Process->Pcb.AddressSpace,
|
1999-11-24 11:51:55 +00:00
|
|
|
MEMORY_AREA_SECTION_VIEW_COMMIT,
|
|
|
|
BaseAddress,
|
|
|
|
*ViewSize,
|
|
|
|
Protect,
|
|
|
|
&Result);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT("NtMapViewOfSection() = %x\n",Status);
|
|
|
|
|
2000-03-29 13:11:55 +00:00
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
1999-11-24 11:51:55 +00:00
|
|
|
ObDereferenceObject(Process);
|
2000-05-13 13:51:08 +00:00
|
|
|
MmUnlockSection(Section);
|
1999-08-29 06:59:11 +00:00
|
|
|
ObDereferenceObject(Section);
|
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
return Status;
|
|
|
|
}
|
|
|
|
|
|
|
|
KeAcquireSpinLock(&Section->ViewListLock, &oldIrql);
|
|
|
|
InsertTailList(&Section->ViewListHead,
|
|
|
|
&Result->Data.SectionData.ViewListEntry);
|
|
|
|
KeReleaseSpinLock(&Section->ViewListLock, oldIrql);
|
|
|
|
|
|
|
|
Result->Data.SectionData.Section = Section;
|
|
|
|
Result->Data.SectionData.ViewOffset = ViewOffset;
|
|
|
|
|
|
|
|
DPRINT("SectionOffset %x\n",SectionOffset);
|
|
|
|
|
|
|
|
|
|
|
|
DPRINT("*BaseAddress %x\n",*BaseAddress);
|
2000-03-29 13:11:55 +00:00
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
1999-11-24 11:51:55 +00:00
|
|
|
ObDereferenceObject(Process);
|
2000-05-13 13:51:08 +00:00
|
|
|
MmUnlockSection(Section);
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-02-13 16:05:19 +00:00
|
|
|
DPRINT("NtMapViewOfSection() returning (Status %x)\n", STATUS_SUCCESS);
|
1999-11-24 11:51:55 +00:00
|
|
|
return(STATUS_SUCCESS);
|
1998-10-05 04:01:30 +00:00
|
|
|
}
|
|
|
|
|
2000-04-02 13:32:43 +00:00
|
|
|
NTSTATUS STDCALL MmUnmapViewOfSection(PEPROCESS Process,
|
2000-05-13 13:51:08 +00:00
|
|
|
PMEMORY_AREA MemoryArea)
|
1999-11-24 11:51:55 +00:00
|
|
|
{
|
|
|
|
PSECTION_OBJECT Section;
|
|
|
|
KIRQL oldIrql;
|
|
|
|
|
|
|
|
Section = MemoryArea->Data.SectionData.Section;
|
2000-04-03 21:54:42 +00:00
|
|
|
|
2000-04-07 02:24:03 +00:00
|
|
|
DPRINT("MmUnmapViewOfSection(Section %x) SectionRC %d\n",
|
2000-04-03 21:54:42 +00:00
|
|
|
Section, ObGetReferenceCount(Section));
|
|
|
|
|
2000-05-13 13:51:08 +00:00
|
|
|
MmLockSection(Section);
|
1999-11-24 11:51:55 +00:00
|
|
|
KeAcquireSpinLock(&Section->ViewListLock, &oldIrql);
|
|
|
|
RemoveEntryList(&MemoryArea->Data.SectionData.ViewListEntry);
|
|
|
|
KeReleaseSpinLock(&Section->ViewListLock, oldIrql);
|
2000-05-13 13:51:08 +00:00
|
|
|
MmUnlockSection(Section);
|
1999-12-22 14:48:30 +00:00
|
|
|
ObDereferenceObject(Section);
|
1999-11-24 11:51:55 +00:00
|
|
|
|
|
|
|
return(STATUS_SUCCESS);
|
|
|
|
}
|
1998-08-25 04:27:26 +00:00
|
|
|
|
1999-08-29 06:59:11 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* NAME EXPORTED
|
|
|
|
* NtUnmapViewOfSection
|
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
* ProcessHandle
|
|
|
|
*
|
|
|
|
* BaseAddress
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
|
|
|
* Status.
|
|
|
|
*
|
|
|
|
* REVISIONS
|
|
|
|
*
|
|
|
|
*/
|
1999-11-24 11:51:55 +00:00
|
|
|
NTSTATUS STDCALL NtUnmapViewOfSection (HANDLE ProcessHandle,
|
|
|
|
PVOID BaseAddress)
|
1998-10-05 04:01:30 +00:00
|
|
|
{
|
1999-11-24 11:51:55 +00:00
|
|
|
PEPROCESS Process;
|
|
|
|
NTSTATUS Status;
|
|
|
|
PMEMORY_AREA MemoryArea;
|
2000-03-29 13:11:55 +00:00
|
|
|
PMADDRESS_SPACE AddressSpace;
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-02-13 16:05:19 +00:00
|
|
|
DPRINT("NtUnmapViewOfSection(ProcessHandle %x, BaseAddress %x)\n",
|
2000-04-07 02:24:03 +00:00
|
|
|
ProcessHandle, BaseAddress);
|
2000-02-13 16:05:19 +00:00
|
|
|
|
|
|
|
DPRINT("Referencing process\n");
|
1999-11-24 11:51:55 +00:00
|
|
|
Status = ObReferenceObjectByHandle(ProcessHandle,
|
|
|
|
PROCESS_VM_OPERATION,
|
|
|
|
PsProcessType,
|
|
|
|
UserMode,
|
|
|
|
(PVOID*)&Process,
|
|
|
|
NULL);
|
2000-02-13 16:05:19 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
DPRINT("ObReferenceObjectByHandle failed (Status %x)\n", Status);
|
|
|
|
return(Status);
|
|
|
|
}
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-03-29 13:11:55 +00:00
|
|
|
AddressSpace = &Process->Pcb.AddressSpace;
|
|
|
|
|
2000-02-13 16:05:19 +00:00
|
|
|
DPRINT("Opening memory area Process %x BaseAddress %x\n",
|
2000-04-07 02:24:03 +00:00
|
|
|
Process, BaseAddress);
|
2000-03-29 13:11:55 +00:00
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
MemoryArea = MmOpenMemoryAreaByAddress(AddressSpace,
|
|
|
|
BaseAddress);
|
1999-11-24 11:51:55 +00:00
|
|
|
if (MemoryArea == NULL)
|
|
|
|
{
|
2000-03-29 13:11:55 +00:00
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
1999-08-29 06:59:11 +00:00
|
|
|
ObDereferenceObject(Process);
|
1999-11-24 11:51:55 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
|
|
|
}
|
|
|
|
|
2000-03-29 13:11:55 +00:00
|
|
|
Status = MmUnmapViewOfSection(Process,
|
|
|
|
MemoryArea);
|
1999-11-24 11:51:55 +00:00
|
|
|
|
2000-04-07 02:24:03 +00:00
|
|
|
DPRINT("MmFreeMemoryArea()\n");
|
2000-03-29 13:11:55 +00:00
|
|
|
Status = MmFreeMemoryArea(&Process->Pcb.AddressSpace,
|
1999-11-24 11:51:55 +00:00
|
|
|
BaseAddress,
|
|
|
|
0,
|
|
|
|
TRUE);
|
2000-03-29 13:11:55 +00:00
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
1999-11-24 11:51:55 +00:00
|
|
|
ObDereferenceObject(Process);
|
1999-08-29 06:59:11 +00:00
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
return Status;
|
1998-10-05 04:01:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
NTSTATUS STDCALL NtQuerySection (IN HANDLE SectionHandle,
|
|
|
|
IN CINT SectionInformationClass,
|
|
|
|
OUT PVOID SectionInformation,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ResultLength)
|
1998-10-05 04:01:30 +00:00
|
|
|
/*
|
|
|
|
* FUNCTION: Queries the information of a section object.
|
|
|
|
* ARGUMENTS:
|
|
|
|
* SectionHandle = Handle to the section link object
|
|
|
|
* SectionInformationClass = Index to a certain information structure
|
|
|
|
* SectionInformation (OUT)= Caller supplies storage for resulting
|
|
|
|
* information
|
|
|
|
* Length = Size of the supplied storage
|
|
|
|
* ResultLength = Data written
|
|
|
|
* RETURNS: Status
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
{
|
1999-11-24 11:51:55 +00:00
|
|
|
return(STATUS_UNSUCCESSFUL);
|
1998-10-05 04:01:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-24 11:51:55 +00:00
|
|
|
NTSTATUS STDCALL NtExtendSection(IN HANDLE SectionHandle,
|
|
|
|
IN ULONG NewMaximumSize)
|
1998-08-25 04:27:26 +00:00
|
|
|
{
|
1999-11-24 11:51:55 +00:00
|
|
|
UNIMPLEMENTED;
|
1998-08-25 04:27:26 +00:00
|
|
|
}
|
1999-08-29 06:59:11 +00:00
|
|
|
|
|
|
|
|
2000-03-19 09:14:52 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* NAME INTERNAL
|
|
|
|
* MmAllocateSection@4
|
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
* Length
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
|
|
|
*
|
|
|
|
* NOTE
|
|
|
|
* Code taken from ntoskrnl/mm/special.c.
|
|
|
|
*
|
|
|
|
* REVISIONS
|
|
|
|
*
|
|
|
|
*/
|
2000-03-29 13:11:55 +00:00
|
|
|
PVOID STDCALL MmAllocateSection (IN ULONG Length)
|
2000-03-19 09:14:52 +00:00
|
|
|
{
|
2000-03-29 13:11:55 +00:00
|
|
|
PVOID Result;
|
|
|
|
MEMORY_AREA* marea;
|
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG i;
|
|
|
|
PMADDRESS_SPACE AddressSpace;
|
|
|
|
|
|
|
|
DPRINT("MmAllocateSection(Length %x)\n",Length);
|
|
|
|
|
|
|
|
AddressSpace = MmGetKernelAddressSpace();
|
|
|
|
Result = NULL;
|
|
|
|
MmLockAddressSpace(AddressSpace);
|
|
|
|
Status = MmCreateMemoryArea (NULL,
|
|
|
|
AddressSpace,
|
|
|
|
MEMORY_AREA_SYSTEM,
|
|
|
|
&Result,
|
|
|
|
Length,
|
|
|
|
0,
|
|
|
|
&marea);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
return (NULL);
|
2000-03-19 09:14:52 +00:00
|
|
|
}
|
2000-03-29 13:11:55 +00:00
|
|
|
DPRINT("Result %p\n",Result);
|
|
|
|
for (i = 0; (i <= (Length / PAGESIZE)); i++)
|
|
|
|
{
|
|
|
|
MmSetPage (NULL,
|
|
|
|
(Result + (i * PAGESIZE)),
|
|
|
|
PAGE_READWRITE,
|
|
|
|
(ULONG) MmAllocPage ());
|
|
|
|
}
|
|
|
|
MmUnlockAddressSpace(AddressSpace);
|
|
|
|
return ((PVOID)Result);
|
2000-03-19 09:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-04-02 13:32:43 +00:00
|
|
|
/**********************************************************************
|
|
|
|
* NAME EXPORTED
|
|
|
|
* MmMapViewOfSection@40
|
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
* FIXME: stack space allocated is 40 bytes, but nothing
|
|
|
|
* is known about what they are filled with.
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
|
|
|
* Status.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
PVOID
|
|
|
|
STDCALL
|
|
|
|
MmMapViewOfSection (
|
|
|
|
DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3,
|
|
|
|
DWORD Unknown4,
|
|
|
|
DWORD Unknown5,
|
|
|
|
DWORD Unknown6,
|
|
|
|
DWORD Unknown7,
|
|
|
|
DWORD Unknown8,
|
|
|
|
DWORD Unknown9
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
STDCALL
|
|
|
|
MmCanFileBeTruncated (
|
|
|
|
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
|
|
|
|
IN PLARGE_INTEGER NewFileSize
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
STDCALL
|
|
|
|
MmDisableModifiedWriteOfSection (
|
|
|
|
DWORD Unknown0
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
STDCALL
|
|
|
|
MmFlushImageSection (
|
|
|
|
IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
|
|
|
|
IN MMFLUSH_TYPE FlushType
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
STDCALL
|
|
|
|
MmForceSectionClosed (
|
|
|
|
DWORD Unknown0,
|
|
|
|
DWORD Unknown1
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
MmMapViewInSystemSpace (
|
|
|
|
IN PVOID Section,
|
|
|
|
OUT PVOID * MappedBase,
|
|
|
|
IN PULONG ViewSize
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (STATUS_NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
MmUnmapViewInSystemSpace (
|
|
|
|
DWORD Unknown0
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (STATUS_NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
MmSetBankedSection (
|
|
|
|
DWORD Unknown0,
|
|
|
|
DWORD Unknown1,
|
|
|
|
DWORD Unknown2,
|
|
|
|
DWORD Unknown3,
|
|
|
|
DWORD Unknown4,
|
|
|
|
DWORD Unknown5
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
|
|
|
return (STATUS_NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* NAME EXPORTED
|
|
|
|
* MmCreateSection@
|
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
* Creates a section object.
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
* SectionObjiect (OUT)
|
|
|
|
* Caller supplied storage for the resulting pointer
|
|
|
|
* to a SECTION_BOJECT instance;
|
|
|
|
*
|
|
|
|
* DesiredAccess
|
|
|
|
* Specifies the desired access to the section can be a
|
|
|
|
* combination of:
|
|
|
|
* STANDARD_RIGHTS_REQUIRED |
|
|
|
|
* SECTION_QUERY |
|
|
|
|
* SECTION_MAP_WRITE |
|
|
|
|
* SECTION_MAP_READ |
|
|
|
|
* SECTION_MAP_EXECUTE
|
|
|
|
*
|
|
|
|
* ObjectAttributes [OPTIONAL]
|
|
|
|
* Initialized attributes for the object can be used
|
|
|
|
* to create a named section;
|
|
|
|
*
|
|
|
|
* MaximumSize
|
|
|
|
* Maximizes the size of the memory section. Must be
|
|
|
|
* non-NULL for a page-file backed section.
|
|
|
|
* If value specified for a mapped file and the file is
|
|
|
|
* not large enough, file will be extended.
|
|
|
|
*
|
|
|
|
* SectionPageProtection
|
|
|
|
* Can be a combination of:
|
|
|
|
* PAGE_READONLY |
|
|
|
|
* PAGE_READWRITE |
|
|
|
|
* PAGE_WRITEONLY |
|
|
|
|
* PAGE_WRITECOPY
|
|
|
|
*
|
|
|
|
* AllocationAttributes
|
|
|
|
* Can be a combination of:
|
|
|
|
* SEC_IMAGE |
|
|
|
|
* SEC_RESERVE
|
|
|
|
*
|
|
|
|
* FileHandle
|
|
|
|
* Handle to a file to create a section mapped to a file
|
|
|
|
* instead of a memory backed section;
|
|
|
|
*
|
|
|
|
* File
|
|
|
|
* Unknown.
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
|
|
|
* Status.
|
|
|
|
*/
|
|
|
|
NTSTATUS
|
|
|
|
STDCALL
|
|
|
|
MmCreateSection (
|
|
|
|
OUT PSECTION_OBJECT * SectionObject,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
|
|
|
|
IN PLARGE_INTEGER MaximumSize,
|
|
|
|
IN ULONG SectionPageProtection,
|
|
|
|
IN ULONG AllocationAttributes,
|
|
|
|
IN HANDLE FileHandle OPTIONAL,
|
|
|
|
IN PFILE_OBJECT File OPTIONAL
|
|
|
|
)
|
|
|
|
{
|
|
|
|
return (STATUS_NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
1999-08-29 06:59:11 +00:00
|
|
|
/* EOF */
|