编程相关

易语言培训教程

东拉西扯

当前位置:首页 > 编程相关 > 东拉西扯 > 正文

判断内存指针的可用性

jellybean 2016-06-05 13:47:33 编程相关 199 0

分享

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。




发表评论 已有 0 评论

×