[KMTESTS:MM]

MmAllocatePagesForMdlEx() was added on Windows 2003 SP1. Import it for "older" systems.

svn path=/trunk/; revision=69318
This commit is contained in:
Pierre Schweitzer 2015-09-22 18:05:45 +00:00
parent bff3154159
commit 49b29b7594

View file

@ -30,6 +30,19 @@ _MiAddressToPte(PVOID Address)
#endif
static
_Must_inspect_result_
_IRQL_requires_max_ (DISPATCH_LEVEL)
PMDL
(NTAPI
*pMmAllocatePagesForMdlEx)(
_In_ PHYSICAL_ADDRESS LowAddress,
_In_ PHYSICAL_ADDRESS HighAddress,
_In_ PHYSICAL_ADDRESS SkipBytes,
_In_ SIZE_T TotalBytes,
_In_ MEMORY_CACHING_TYPE CacheType,
_In_ ULONG Flags);
static
BOOLEAN
ValidateMapping(
@ -84,11 +97,16 @@ TestMap(
PPFN_NUMBER MdlPages;
ULONG i;
if (skip(pMmAllocatePagesForMdlEx != NULL, "MmAllocatePagesForMdlEx unavailable\n"))
{
return;
}
ZeroPhysical.QuadPart = 0;
MaxPhysical.QuadPart = 0xffffffffffffffffLL;
/* Create a one-page MDL and map it */
Mdl = MmAllocatePagesForMdlEx(ZeroPhysical,
Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
MaxPhysical,
ZeroPhysical,
PAGE_SIZE,
@ -153,7 +171,7 @@ TestMap(
MmFreePagesFromMdl(Mdl);
/* Map all pages */
Mdl = MmAllocatePagesForMdlEx(ZeroPhysical,
Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
MaxPhysical,
ZeroPhysical,
TotalPtes * PAGE_SIZE,
@ -196,7 +214,7 @@ TestMap(
MmFreePagesFromMdl(Mdl);
/* Try to map more pages than we reserved */
Mdl = MmAllocatePagesForMdlEx(ZeroPhysical,
Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
MaxPhysical,
ZeroPhysical,
(TotalPtes + 1) * PAGE_SIZE,
@ -226,6 +244,8 @@ START_TEST(MmReservedMapping)
{
PVOID Mapping;
pMmAllocatePagesForMdlEx = KmtGetSystemRoutineAddress(L"MmAllocatePagesForMdlEx");
/* one byte - single page */
Mapping = MmAllocateMappingAddress(1, 'MRmK');
ok(Mapping != NULL, "MmAllocateMappingAddress failed\n");