OSR Dev Blog

MmMapLockedPages(SpecifyCache) with AccessMode == UserMode
(By: Hector J. Rodriguez | Published: 20-Jun-02| Modified: 30-Jul-02)

It's seem that there's been some info missing from the DDK documentation for quite a while.

When you call either MmMapLockedPagesSpecifyCache or the (now deprecated) MmMapLockedPages, and you specify UserMode (to map the pages into the user address space), you must wrap this call with an exception handler.

So, for example:

    __try {
        mappedVa = MmMapLockedPagesSpecifyCache(myMdl,
            UserMode,
            MmNonCached,
            NULL,
            FALSE,
            NormalPagePriority);

    }
    __except(EXCEPTION_EXECUTE_HANDLER) {
        NTSTATUS code;
        code = GetExceptionCode();
        DbgPrint("Call to MmMapLocked failed due to exception 0x%0x\n",
            code);

This article was printed from OSR Online http://www.osronline.com

Copyright 2017 OSR Open Systems Resources, Inc.