Author: pschweitzer
Date: Tue Sep 22 18:05:45 2015
New Revision: 69318
URL:
http://svn.reactos.org/svn/reactos?rev=69318&view=rev
Log:
[KMTESTS:MM]
MmAllocatePagesForMdlEx() was added on Windows 2003 SP1. Import it for "older"
systems.
Modified:
trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c
Modified: trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/MmReserve…
==============================================================================
--- trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_mm/MmReservedMapping.c [iso-8859-1] Tue Sep 22 18:05:45
2015
@@ -29,6 +29,19 @@
#define MiAddressToPte(x) _MiAddressToPte((PVOID)(x))
#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
@@ -84,16 +97,21 @@
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,
- MaxPhysical,
- ZeroPhysical,
- PAGE_SIZE,
- MmCached,
- 0);
+ Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
+ MaxPhysical,
+ ZeroPhysical,
+ PAGE_SIZE,
+ MmCached,
+ 0);
if (skip(Mdl != NULL, "No MDL\n"))
{
return;
@@ -153,12 +171,12 @@
MmFreePagesFromMdl(Mdl);
/* Map all pages */
- Mdl = MmAllocatePagesForMdlEx(ZeroPhysical,
- MaxPhysical,
- ZeroPhysical,
- TotalPtes * PAGE_SIZE,
- MmCached,
- 0);
+ Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
+ MaxPhysical,
+ ZeroPhysical,
+ TotalPtes * PAGE_SIZE,
+ MmCached,
+ 0);
if (skip(Mdl != NULL, "No MDL\n"))
{
return;
@@ -196,12 +214,12 @@
MmFreePagesFromMdl(Mdl);
/* Try to map more pages than we reserved */
- Mdl = MmAllocatePagesForMdlEx(ZeroPhysical,
- MaxPhysical,
- ZeroPhysical,
- (TotalPtes + 1) * PAGE_SIZE,
- MmCached,
- 0);
+ Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
+ MaxPhysical,
+ ZeroPhysical,
+ (TotalPtes + 1) * PAGE_SIZE,
+ MmCached,
+ 0);
if (skip(Mdl != NULL, "No MDL\n"))
{
return;
@@ -226,6 +244,8 @@
{
PVOID Mapping;
+ pMmAllocatePagesForMdlEx =
KmtGetSystemRoutineAddress(L"MmAllocatePagesForMdlEx");
+
/* one byte - single page */
Mapping = MmAllocateMappingAddress(1, 'MRmK');
ok(Mapping != NULL, "MmAllocateMappingAddress failed\n");