BOOL VirtualLock(lpvMem, cbMem) | |||||
LPVOID lpvMem; | /* address of first byte of range to lock | */ | |||
DWORD cbMem; | /* number of bytes in range to lock | */ |
The VirtualLock function locks the specified range of the processes address space into memory. This range is present whenever the application is running. All pages covered by the range must be committed.
lpvMem
Points to the first byte in the range to be locked.
cbMem
Specifies the number of bytes to lock.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
This function cannot be used to lock memory allocated with the PAGE_NOACCESS flag.
The specified range is used to compute the range of pages covered by the lock. A two-byte lock that straddles a page boundary locks both of the pages covered by the range.
VirtualUnlock