If the calling process has read access to the specified memory, the return value is zero.
If the calling process does not have read access to the specified memory, the return value is nonzero. To get extended error information, call GetLastError.
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.
msdn说过时了不应试用,不过我们还是可以用其他的API
IsBadReadPtr函数原型
BOOL WINAPI IsBadReadPtr(
__in const VOID* lp,
__in UINT_PTR ucb
);
复制代码
Return ValueIf the calling process has read access to all bytes in the specified memory range, the return value is zero.
如果调用进程有权限访问该内存,返回0。