Alternative for MFC AfxIsValidAddress in c++ ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That function actually does not do what it says…
It says that it checks the memory range to see whether it is mapped to the space address of the process. But actually, in most versions of the library, it just checks for a NULL value.
The rationale seems to be that in older versions of Windows, it relied on IsBadReadPtr() and friends. But these functions are totally obsolete, and should not be used in newer code (according to MSDN), thus the change in behavior.
That said, if you want to really check for a memory range, your best option is VirtualQuery().