术语 | virtualprotect |
释义 | VirtualProtect 语法: C++ BOOL WINAPI VirtualProtect( __in LPVOID lpAddress, __in SIZE_T dwSize, __in DWORD flNewProtect, __out PDWORD lpflOldProtect ); VirtualProtect函数 就在调用进程的虚拟地址空间的页面地区的变化致力于保护。 要更改任何程序访问保护,使用VirtualProtectEx功能。 参数 lpAddress [in] 是对的网页的访问保护属性的区域基址指针改变。 在指定区域的所有网页,必须在同一保留分配到调用VirtualAlloc或VirtualAllocEx区域功能使用MEM_RESERVE。该页面无法跨越相邻保留那些由不同的要求,以VirtualAlloc使用MEM_RESERVE或VirtualAllocEx分配的地区。 dwSize [in] 该区域的访问保护属性是改变大小,以字节。受影响的地区包括网页的所有网页包含从lpAddress参数(lpAddress + dwSize的一个或多个字节)。这意味着,2个字节的范围跨越1页边界导致保护这两个网页属性的改变。 flNewProtect [in] 在内存保护选项。 This parameter can be one of the memory protection constants . 此值必须符合的使用VirtualAlloc或VirtualAllocEx网页中指定的访问保护。 lpflOldProtect [out] 对变量的接收,在指定区域的网页上获得第一页的保护价值的指针。如果此参数为NULL或不指向一个有效的变量,函数失败。 返回值 如果函数成功,返回值为非零。 如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。 备注 您可以设置网页上犯下的访问保护价值。如果任何网页在指定的区域状态不是承诺,函数失败并没有修改在指定区域的任何页面访问保护的回报。 保护剂的PAGE_GUARD建立保护页。卫队的网页作为一次性接入报警。有关更多信息,请参阅创建卫队页。 最好是避免使用VirtualProtect发生变化,由GlobalAlloc,HeapAlloc,或LocalAlloc分配的内存块的页面保护,因为多个内存块可以存在于一个单一的页面。堆管理假设,在所有网页堆金至少读写访问。 要求: 最低支持:client-Windows 2000专业版 最低支持server-Windows 2000服务器 HeaderWinbase.h(头文件:winuser.h) LibraryKernel32.lib DLLKernel32.dll 参见 内存管理功能 虚拟内存函数 VirtualAlloc VirtualProtectEx 如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com) 生成日期:2009年8月27日 ==英文原文==VirtualProtect Function Changes the protection on a region of committed pages in the virtual address space of the calling process. To change the access protection of any process, use the VirtualProtectEx function. Syntax C++ BOOL WINAPI VirtualProtect( __in LPVOID lpAddress, __in SIZE_T dwSize, __in DWORD flNewProtect, __out PDWORD lpflOldProtect ); Parameters lpAddress [in] A pointer to the base address of the region of pages whose access protection attributes are to be changed. All pages in the specified region must be within the same reserved region allocated when calling the VirtualAlloc or VirtualAllocEx function using MEM_RESERVE. The pages cannot span adjacent reserved regions that were allocated by separate calls to VirtualAlloc or VirtualAllocEx using MEM_RESERVE. dwSize [in] The size of the region whose access protection attributes are to be changed, in bytes. The region of affected pages includes all pages containing 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 the protection attributes of both pages to be changed. flNewProtect [in] The memory protection option. This parameter can be one of the memory protection constants . This value must be compatible with the access protection specified for the pages using VirtualAlloc or VirtualAllocEx. lpflOldProtect [out] A pointer to a variable that receives the previous access protection value of the first page in the specified region of pages. If this parameter is NULL or does not point to a valid variable, the function fails. 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 You can set the access protection value on committed pages only. If the state of any page in the specified region is not committed, the function fails and returns without modifying the access protection of any pages in the specified region. The PAGE_GUARD protection modifier establishes guard pages. Guard pages act as one-shot access alarms. For more information, see Creating Guard Pages . It is best to avoid using VirtualProtect to change page protections on memory blocks allocated by GlobalAlloc , HeapAlloc , or LocalAlloc , because multiple memory blocks can exist on a single page. The heap manager assumes that all pages in the heap grant at least read and write access. 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 Virtual Memory Functions VirtualAlloc VirtualProtectEx Send comments about this topic to Microsoft Build date: 8/27/2009 ==原始网址==http://msdn.microsoft.com/en-us/library/aa366898(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。