判断内存指针的可用性

API    IsBadCodePt

BASIC
BOOL WINAPI IsBadCodePtr(
  __in  FARPROC lpfn);


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函数原型

BASIC
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。



评论
暂无评论

登录后可发表评论

点击登录

遇到问题?请给我们留言

请填写您的电话号码,我们将回复您电话