网站首页  词典首页

请输入您要查询的函数:

 

术语 isbadstringptr
释义 IsBadStringPtr
语法:
C++
BOOL WINAPI IsBadStringPtr(
__in LPCTSTR lpsz,
__in UINT_PTR ucchMax
);
IsBadStringPtr功能
验证调用进程具有读取访问指定范围的内存。
重要此功能已经过时,不应使用。尽管它的名字,它并不能保证有效的指针,或指向的内存可以安全使用。有关更多信息,看到注释。
参数
lpsz [in]
一个指向 null 结尾的字符串指针,Unicode或ASCII。
ucchMax [in]
字符串的最大长度,在TCHARs。为读访问的所有字符到字符串的函数检查终止空字符或直至由该参数,以较少者为准指定的字符数。如果此参数为0,返回值是零。
返回值
如果调用进程读取访问所有字符的字符串的终止空字符或直至由ucchMax指定的字符数,则返回值是零。
如果调用进程没有读访问所有字符的字符串的终止空字符或直至由ucchMax指定的字符数,则返回值为非零。
如果应用程序被编译为调试版本,这一过程没有读访问整个内存范围规定,该函数会导致断言,到调试器中断。离开调试器,功能如常,并返回一个非零值,此行为是设计为一个调试援助。
备注
此功能通常用于从第三时返回指针,党库,工作,您不能确定的第三方DLL内存管理的行为。
进程中的线程,预计这种方式进行合作,一个不会释放内存,其他的需要。使用此函数不否认需要这样做。如果不这样做,应用程序可能会失败,不可预知的方式。
提领潜在的无效指针可以禁用其他线程堆栈扩展。一个线程的堆栈耗尽时,堆叠的扩展已被禁用,结果在父进程没有立即终止了错误的诊断信息窗口或弹出。
如果调用进程读取访问一些,但并非所有指定的内存范围,则返回值为非零。
在抢占式多任务环境中,可能有其他线程改变进程的存取存储器被测试。即使函数表明,这一进程具有读取访问指定的内存,您应该使用结构化异常处理时,试图访问内存。结构化异常处理使用使系统通知进程,如果访问冲突异常时,推动这一进程的机会来处理异常。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinbase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesIsBadStringPtrW(Unicode)和IsBadStringPtrA(ANSI)的
参见
IsBadCodePtr
IsBadReadPtr
IsBadWritePtr
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年8月27日
==英文原文==IsBadStringPtr Function
Verifies that the calling process has read 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 IsBadStringPtr(
__in LPCTSTR lpsz,
__in UINT_PTR ucchMax
);
Parameters
lpsz [in]
A pointer to a null-terminated string, either Unicode or ASCII.
ucchMax [in]
The maximum size of the string, in TCHARs. The function checks for read access in all characters up to the string's terminating null character or up to the number of characters specified by this parameter, whichever is smaller. If this parameter is zero, the return value is zero.
Return Value
If the calling process has read access to all characters up to the string's terminating null character or up to the number of characters specified by ucchMax, the return value is zero.
If the calling process does not have read access to all characters up to the string's terminating null character or up to the number of characters specified by ucchMax, the return value is nonzero.
If the application is compiled as a debugging version, and the process does not have read access to the entire memory range specified, the function causes an assertion and breaks into the debugger. Leaving the debugger, the function continues as usual, and returns a nonzero value This behavior is by design, 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 read access to some, but not all, of 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 read 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.
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesIsBadStringPtrW (Unicode) and IsBadStringPtrA (ANSI)
See Also
IsBadCodePtr
IsBadReadPtr
IsBadWritePtr
Send comments about this topic to Microsoft
Build date: 8/27/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa366714(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:24:36