Expand Minimize

MmUnlockPagableImageSection routine

The MmUnlockPagableImageSection routine releases a section of driver code or driver data, previously locked into system space with MmLockPagableCodeSection, MmLockPagableDataSection or MmLockPagableSectionByHandle, so the section can be paged out again.

Syntax


VOID MmUnlockPagableImageSection(
  _In_  PVOID ImageSectionHandle
);

Parameters

ImageSectionHandle [in]

Specifies the handle returned by a call to MmLockPagableCodeSection or MmLockPagableDataSection.

Return value

None

Remarks

The handle for a driver's pageable section must not be released if the driver has any outstanding IRPs in its device queue(s) or internal queue(s). A call to MmUnlockPagableImageSection restores the pageability of that entire section when there are no more references to the handle for that section.

The memory manager maintains the reference count on the handle to a section. A pageable section is only available to be paged out when the reference count is zero. Every lock request increments the count; every unlock request decrements the count. A driver must unlock a section as many times as it locks a section to make the section available to be paged out.

A handle is always valid, no matter what the count. If the count on a handle is zero and a call is made to MmLockPagableSectionByHandle, the count is set to one, and if the section has been paged out, it will be paged in.

In most cases, MmUnlockPagableImageSection is called before a driver's Unload routine. That is, a driver with a pageable section is likely to have its DispatchClose and/or DispatchShutdown routine call MmUnlockPagableImageSection before its Unload routine is called. However, care should be taken in unloadable drivers to release any pageable section before the driver itself is unloaded from the system.

For more information about paging code and data, see Making Drivers Pageable.

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

<=APC_LEVEL

DDI compliance rules

IrqlMmApcLte, HwStorPortProhibitedDDIs

See also

MmPageEntireDriver
MmResetDriverPaging
MmLockPagableCodeSection
MmLockPagableDataSection
MmLockPagableSectionByHandle

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft