For https://bugs.winehq.org/show_bug.cgi?id=37355.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/tests/driver.c | 21 +++++++++++++++++++++ include/ddk/wdm.h | 1 + 2 files changed, 22 insertions(+)
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index e2eaf79..9cfdec5 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -152,6 +152,26 @@ todo_wine ok(current != NULL, "Expected current process to be non-NULL\n"); }
+static void test_mdl_map(void) +{ + char buffer[20] = "test buffer"; + void *addr; + MDL *mdl; + + mdl = IoAllocateMdl(buffer, sizeof(buffer), FALSE, FALSE, NULL); + ok(mdl != NULL, "IoAllocateMdl failed\n"); + + MmProbeAndLockPages(mdl, KernelMode, IoReadAccess); + + addr = MmMapLockedPagesSpecifyCache(mdl, KernelMode, MmCached, NULL, FALSE, NormalPagePriority); +todo_wine + ok(addr != NULL, "MmMapLockedPagesSpecifyCache failed\n"); + + /* MmUnmapLockedPages(addr, mdl); */ + + IoFreeMdl(mdl); +} + static NTSTATUS main_test(IRP *irp, IO_STACK_LOCATION *stack, ULONG_PTR *info) { ULONG length = stack->Parameters.DeviceIoControl.OutputBufferLength; @@ -176,6 +196,7 @@ static NTSTATUS main_test(IRP *irp, IO_STACK_LOCATION *stack, ULONG_PTR *info) ZwOpenFile(&okfile, FILE_APPEND_DATA, &attr, &io, 0, 0);
test_currentprocess(); + test_mdl_map();
/* print process report */ if (test_input->winetest_debug) diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 5b7c9e6..77370b9 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1421,6 +1421,7 @@ PMDL WINAPI MmAllocatePagesForMdl(PHYSICAL_ADDRESS,PHYSICAL_ADDRESS,PHYSICA void WINAPI MmFreeNonCachedMemory(PVOID,SIZE_T); PVOID WINAPI MmMapLockedPagesSpecifyCache(PMDL,KPROCESSOR_MODE,MEMORY_CACHING_TYPE,PVOID,ULONG,ULONG); MM_SYSTEMSIZE WINAPI MmQuerySystemSize(void); +void WINAPI MmProbeAndLockPages(PMDLX, KPROCESSOR_MODE, LOCK_OPERATION);
static inline void *MmGetSystemAddressForMdlSafe(MDL *mdl, ULONG priority) {