网站首页  词典首页

请输入您要查询的函数:

 

术语 virtualprotectex
释义 VirtualProtectEx
语法:
C++
BOOL WINAPI VirtualProtectEx(
__in HANDLE hProcess,
__in LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD flNewProtect,
__out PDWORD lpflOldProtect
);
VirtualProtectEx函数
就在一个特定进程的虚拟地址空间的页面地区的变化致力于保护。
参数
hProcess [in]
句柄的进程的内存保护,是要改变。句柄必须有PROCESS_VM_OPERATION访问权。有关更多信息,请参见过程的安全性和访问权限。
lpAddress [in]
是对的网页的访问保护属性的区域基址指针改变。
在指定区域的所有网页,必须在同一保留分配到调用VirtualAlloc或VirtualAllocEx区域功能使用MEM_RESERVE。该页面无法跨越相邻保留那些由不同的要求,以VirtualAlloc使用MEM_RESERVE或VirtualAllocEx分配的地区。
dwSize [in]
因为其访问保护属性被改变区域的大小,以字节为单位。受影响的地区包括网页的所有网页包含从lpAddress参数(lpAddress + dwSize的一个或多个字节)。这意味着,2个字节的范围跨越1页边界导致保护这两个网页属性的改变。
flNewProtect [in]
在内存保护选项。此参数可以为内存保护常量之一。
此值必须符合的使用VirtualAlloc或VirtualAllocEx网页中指定的访问保护。
lpflOldProtect [out]
一个变量,它接收第一页前访问的网页中指定的区域保护指针。如果此参数为NULL或不指向一个有效的变量,函数失败。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
访问保护的价值只能设置在提交页面。如果任何网页在指定的区域状态不是承诺,函数失败并没有修改在指定区域的任何页面访问保护的回报。
保护剂的PAGE_GUARD建立保护页。卫队的网页作为一次性接入报警。有关更多信息,请参阅创建卫队页。
最好是避免使用VirtualProtectEx发生变化,由GlobalAlloc,HeapAlloc,或LocalAlloc分配的内存块的页面保护,因为多个内存块可以存在于一个单一的页面。堆管理假设,在所有网页堆金至少读写访问。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
内存管理功能
虚拟内存函数
VirtualAlloc
VirtualProtect
VirtualQueryEx
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==VirtualProtectEx Function
Changes the protection on a region of committed pages in the virtual address space of a specified process.
Syntax
C++
BOOL WINAPI VirtualProtectEx(
__in HANDLE hProcess,
__in LPVOID lpAddress,
__in SIZE_T dwSize,
__in DWORD flNewProtect,
__out PDWORD lpflOldProtect
);
Parameters
hProcess [in]
A handle to the process whose memory protection is to be changed. The handle must have the PROCESS_VM_OPERATION access right. For more information, see Process Security and Access Rights .
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 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 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
The access protection value can be set only on committed pages. 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 VirtualProtectEx 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
VirtualProtect
VirtualQueryEx
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366899(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:24:40