网站首页  词典首页

请输入您要查询的函数:

 

术语 virtuallock
释义 VirtualLock
语法:
C++
BOOL WINAPI VirtualLock(
__in LPVOID lpAddress,
__in SIZE_T dwSize
);
VirtualLock功能
锁到物理内存的进程的虚拟地址空间的指定区域,以确保后续访问该地区将不会导致页面错误。
参数
lpAddress [in]
是对地区的页面基址指针被锁定。
dwSize [in]
该地区被锁定的大小,以字节为单位。受影响的地区包括所有网页的页面中包含由lpAddress参数(lpAddress + dwSize的一个或多个字节)。这意味着,2个字节的范围跨越边界造成的网页都被锁定页面。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
在指定区域的所有网页都必须承诺。与PAGE_NOACCESS受保护的内存不能被锁定。
锁定到内存中的网页可能会降低,减少了可用的RAM和强制系统换出其他关键页的页面文件的系统的性能。每一个版本的Windows上有一个最大的网页数量限制的进程可以锁定。这是有意限制小,避免严重的性能下降。应用程序需要更多的页面锁定号码必须首先调用SetProcessWorkingSetSize函数增加最小和最大工作集大小。的网页,一个进程可以锁的最大数量是等于在其工作的最低网页数量减去一套小的开销。
页面一进程已锁定留在物理内存,直到该进程解开他们或终止。保证这些网页不被写入页面文件,而它们锁定。
要解除锁定的网页的地区,使用VirtualUnlock功能。锁定的网页时会自动解锁进程终止。
这个功能就像是GlobalLock或LocalLock不是因为它不增加一锁计数和翻译成一个句柄指针功能。没有虚拟页面锁计数,所以多个调用VirtualUnlock函数从未要求解锁地区的网页。
实例
有关示例,请参阅创建卫队页。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
内存管理功能
SetProcessWorkingSetSize
虚拟内存函数
VirtualUnlock
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==VirtualLock Function
Locks the specified region of the process's virtual address space into physical memory, ensuring that subsequent access to the region will not incur a page fault.
Syntax
C++
BOOL WINAPI VirtualLock(
__in LPVOID lpAddress,
__in SIZE_T dwSize
);
Parameters
lpAddress [in]
A pointer to the base address of the region of pages to be locked.
dwSize [in]
The size of the region to be locked, in bytes. The region of affected pages includes all pages that contain one or more bytes in the range from the lpAddress parameter to (lpAddress+dwSize). This means that a 2-byte range straddling a page boundary causes both pages to be locked.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
All pages in the specified region must be committed. Memory protected with PAGE_NOACCESS cannot be locked.
Locking pages into memory may degrade the performance of the system by reducing the available RAM and forcing the system to swap out other critical pages to the paging file. Each version of Windows has a limit on the maximum number of pages a process can lock. This limit is intentionally small to avoid severe performance degradation. Applications that need to lock larger numbers of pages must first call the SetProcessWorkingSetSize function to increase their minimum and maximum working set sizes. The maximum number of pages that a process can lock is equal to the number of pages in its minimum working set minus a small overhead.
Pages that a process has locked remain in physical memory until the process unlocks them or terminates. These pages are guaranteed not to be written to the pagefile while they are locked.
To unlock a region of locked pages, use the VirtualUnlock function. Locked pages are automatically unlocked when the process terminates.
This function is not like the GlobalLock or LocalLock function in that it does not increment a lock count and translate a handle into a pointer. There is no lock count for virtual pages, so multiple calls to the VirtualUnlock function are never required to unlock a region of pages.
Examples
For an example, see Creating Guard Pages .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
Memory Management Functions
SetProcessWorkingSetSize
Virtual Memory Functions
VirtualUnlock
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366895(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:25:28