2 * PROJECT: ReactOS kernel-mode tests
3 * LICENSE: LGPLv2+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Kernel-Mode Test Suite Io Regressions KM-Test (Mdl)
5 * PROGRAMMER: Aleksey Bragin <aleksey@reactos.org>
18 ULONG MdlSize
= 2*4096+184; // 2 pages and some random value
20 // Try to alloc 2Gb MDL
21 Mdl
= IoAllocateMdl(NULL
, 2048UL*0x100000, FALSE
, FALSE
, NULL
);
24 "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X",
30 // Now create a valid MDL
31 VirtualAddress
= ExAllocatePool(NonPagedPool
, MdlSize
);
32 Mdl
= IoAllocateMdl(VirtualAddress
, MdlSize
, FALSE
, FALSE
, NULL
);
33 ok(Mdl
!= NULL
, "Mdl allocation failed");
34 // Check fields of the allocated struct
35 ok(Mdl
->Next
== NULL
, "Mdl->Next should be NULL, but is 0x%X",
37 ok(Mdl
->ByteCount
== MdlSize
,
38 "Mdl->ByteCount should be equal to MdlSize, but is 0x%X",
39 (UINT_PTR
)Mdl
->ByteCount
);
40 // TODO: Check other fields of MDL struct
43 // Allocate now with pointer to an Irp
44 Irp
= IoAllocateIrp(1, FALSE
);
45 ok(Irp
!= NULL
, "IRP allocation failed");
46 Mdl
= IoAllocateMdl(VirtualAddress
, MdlSize
, FALSE
, FALSE
, Irp
);
47 ok(Mdl
!= NULL
, "Mdl allocation failed");
48 ok(Irp
->MdlAddress
== Mdl
, "Irp->MdlAddress should be 0x%X, but is 0x%X",
49 (UINT_PTR
)Mdl
, (UINT_PTR
)Irp
->MdlAddress
);
53 // TODO: Check a case when SecondaryBuffer == TRUE
56 ExFreePool(VirtualAddress
);