LockPages (Windows Embedded Compact 7)
This function locks into memory the specified region of the virtual address space of the process, ensuring that subsequent access to the region does not incur a page fault. This function can be called only in kernel mode.
BOOL LockPages( LPVOID lpvAddress, DWORD cbSize, PDWORD pPFNs, int fOptions );
[in] Starting address of a region of committed pages; that is, to be locked.
[in] Number of bytes to lock.
[out] Array of page physical frame numbers representing the CPU-dependent physical addresses of the pages.
This parameter can be set to NULL if the associated physical pages of the locked region does not matter to the caller.
[in] Option flag.
The following table shows possible values for this parameter.
Query the physical to virtual mapping of a memory allocation. No pages are locked, and no reference counters are incremented.
Read access is required, as opposed to page present but PAGE_NOACCESS.
Write access is required. This means that locking excludes other writers.
TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError.
To determine the actual physical address, the value returned in pPFNs must be shifted to the left by a number of bits. The shift count can be found in UserKInfo[KINX_PFN_SHIFT]. Shift the returned values to the left by this value to get the actual physical address.
The physical pages are stored in increasing order, but are not guaranteed to be contiguous.
If LockPages is called with the LOCKFLAG_QUERY_ONLY flag in the fOptions parameter, no reference counters are incremented, and UnlockPages need not be called. If UnlockPages is called on pages for which LockPages has been called only with the LOCKFLAG_QUERY_ONLY flag, UnlockPages will return ERROR_INVALID_PARAMETER.