My SDK-on-disk does not have the 'obsolete' disclaimer, so I looked at MSDN"
The 'obsolete' disclaimer is qualified by "see remarks" so I read those, too.
All such disclaimers seem to this observer related to sloppy thread management; however, the "tag" added as communtity content seems to describe a reason to avoid these fuctions.
Announcement
Collapse
No announcement yet.
isbadreadptr isbadwriteptr etc
Collapse
X
-
...and it doesn't help with the second case either, so I think the advice stands - don't use it.
Leave a comment:
-
but if you are using a 3rd party library, you won't even know whether you have a problem.
However, this is generally going to a problem for the library USER (that would be you)... to ensure you are not calling a library function from your program when a thread switch could conceivably invalidate a passed address.
MCM
Leave a comment:
-
Originally posted by Michael Mattias View PostThis is the purpose for which synchronization objects exist.
Leave a comment:
-
From Mr Osterman's comments:
There’s nothing to prevent another thread in the application from unmapping the virtual address passed into IsBadReadPtr immediately after the call is made. Which means that any error checks you made based on the results of this API aren’t valid (this is called out in the documentation for IsBadWritePtr/IsBadReadPtr).
If you are creating multi-threaded applications, the CRITICAL_SECTION would be the object of choice.
Leave a comment:
-
isbadreadptr isbadwriteptr etc
If you were thinking about using the above API functions, you would do well to read first the MSDN (not WIN32.HLP) entry for isbadreadptr taking particular note of the "user content" - also http://blogs.msdn.com/larryosterman/...18/134471.aspx. The way I read these sources is "DON'T!".
It is not as simple as "oh, my application is a single thread, so no problem"!
Not for nothing have these functions been described as
“CrashMyApplication” and “CorruptMemoryAndCrashMySystem""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."
Actually I haven't checked that my WIn32Programmer Reference is bang up to date on these functions - anyone?Tags: None
Leave a comment: