网站首页  词典首页

请输入您要查询的函数:

 

术语 isbadwriteptr
释义 IsBadWritePtr
语法:
C++
BOOL WINAPI IsBadWritePtr(
__in LPVOID lp,
__in UINT_PTR ucb
);
IsBadWritePtr功能
验证调用进程具有写访问指定范围的内存。
重要此功能已经过时,不应使用。尽管它的名字,它并不能保证有效的指针,或指向的内存可以安全使用。有关更多信息,看到注释。
参数
脂蛋白 [in]
一个内存块的第一个字节的指针。
联合银行 [in]
该内存块的大小,以字节。如果此参数为0,返回值是零。
返回值
如果调用进程具有写访问权,在指定的内存范围内的所有字节,返回值是零。
如果调用进程没有写权限,在指定的内存范围内的所有字节,则返回值为非零。
如果应用程序在调试器下运行的进程没有写权限在指定范围内的所有字节内存的功能,当第一次机会STATUS_ACCESS_VIOLATION例外。调试器可以被配置为打破这种情况。恢复过程后,在调试器中执行的功能如常,并返回一个非零值,此行为是设计,调试援助服务。
备注
此功能通常用于从第三时返回指针,党库,工作,您不能确定的第三方DLL内存管理的行为。
进程中的线程,预计这种方式进行合作,一个不会释放内存,其他的需要。使用此函数不否认需要这样做。如果不这样做,应用程序可能会失败,不可预知的方式。
提领潜在的无效指针可以禁用其他线程堆栈扩展。一个线程的堆栈耗尽时,堆叠的扩展已被禁用,结果在父进程没有立即终止了错误的诊断信息窗口或弹出。
如果调用进程具有写访问一些,但并非所有在指定的内存范围的字节,则返回值为非零。
在抢占式多任务环境中,可能有其他线程改变进程的存取存储器被测试。即使函数表明,这一进程写访问指定的内存,您应该使用结构化异常处理时,试图访问内存。结构化异常处理使用使系统通知进程,如果访问冲突异常时,推动这一进程的机会来处理异常。
IsBadWritePtr不是线程安全的。正确使用它由多个线程共享一个指针,调用的代码内的关键区域,只允许一个线程访问内存被检查。使用的操作系统,如重要路段或互斥或互锁功能级别的对象创建的代码的关键区域。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
参见
IsBadCodePtr
IsBadReadPtr
IsBadStringPtr
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==IsBadWritePtr Function
Verifies that the calling process has write access to the specified range of memory.
Important This function is obsolete and should not be used. Despite its name, it does not guarantee that the pointer is valid or that the memory pointed to is safe to use. For more information, see Remarks on this page.
Syntax
C++
BOOL WINAPI IsBadWritePtr(
__in LPVOID lp,
__in UINT_PTR ucb
);
Parameters
lp [in]
A pointer to the first byte of the memory block.
ucb [in]
The size of the memory block, in bytes. If this parameter is zero, the return value is zero.
Return Value
If the calling process has write access to all bytes in the specified memory range, the return value is zero.
If the calling process does not have write access to all bytes in the specified memory range, the return value is nonzero.
If the application is run under a debugger and the process does not have write access to all bytes in the specified memory range, the function causes a first chance STATUS_ACCESS_VIOLATION exception. The debugger can be configured to break for this condition. After resuming process execution in the debugger, the function continues as usual and returns a nonzero value This behavior is by design and serves as a debugging aid.
Remarks
This function is typically used when working with pointers returned from third-party libraries, where you cannot determine the memory management behavior in the third-party DLL.
Threads in a process are expected to cooperate in such a way that one will not free memory that the other needs. Use of this function does not negate the need to do this. If this is not done, the application may fail in an unpredictable manner.
Dereferencing potentially invalid pointers can disable stack expansion in other threads. A thread exhausting its stack, when stack expansion has been disabled, results in the immediate termination of the parent process, with no pop-up error window or diagnostic information.
If the calling process has write access to some, but not all, of the bytes in the specified memory range, the return value is nonzero.
In a preemptive multitasking environment, it is possible for some other thread to change the process's access to the memory being tested. Even when the function indicates that the process has write access to the specified memory, you should use structured exception handling when attempting to access the memory. Use of structured exception handling enables the system to notify the process if an access violation exception occurs, giving the process an opportunity to handle the exception.
IsBadWritePtr is not multithread safe. To use it properly on a pointer shared by multiple threads, call it inside a critical region of code that allows only one thread to access the memory being checked. Use operating system–level objects such as critical sections or mutexes or the interlocked functions to create the critical region of code.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
See Also
IsBadCodePtr
IsBadReadPtr
IsBadStringPtr
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366716(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 13:18:54