IsBadReadPtr

  BOOL IsBadReadPtr(lpv, cb)    
  CONST VOID *lpv; /* pointer to test */
  UINT cb; /* number of bytes to test */

The IsBadReadPtr function verifies that the specified range of memory can be read by the calling process.

Parameters

lpv

Points to the beginning of a block of allocated memory.

cb

Specifies the number of bytes of memory to be checked. If this parameter is zero, the return value is always FALSE.

Return Value

The return value is TRUE if the calling process does not have read access to the entire specified memory range.

The return value is FALSE if all pages within the specified range can be read, or if cb is zero.

Comments

Because Win32 is a pre-emptive multi-tasking environment, the results of this test are only meaningful if no other thread in the process manipulates the range of memory being tested. Even after a pointer validation, an application should use structured exception handling to guard access through pointers that it does not control.

See Also

IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtr, IsBadWritePtr