Click to See Complete Forum and Search --> : Alternatives to IsBadReadPtr and IsBadWrite Ptr in Windows Vsita
Venkat K
July 6th, 2008, 11:40 AM
Hi,
We have to port our current legacy code to Windows Vista.. We have certain checks like IsBadReadPtr, IsBadWritePtr,IsBadStringPtr at sevaral places in our code. As these checks donot work in Windows vista. We have to find out alternatives. Can I know what could be the better subsitutes for these api's. Can someone send me a code snippet .
Thanks in advance..
Venkat
VladimirF
July 6th, 2008, 12:27 PM
We have to port our current legacy code to Windows Vista.. We have certain checks like IsBadReadPtr, IsBadWritePtr,IsBadStringPtr at sevaral places in our code. As these checks donot work in Windows vista. We have to find out alternatives. Can I know what could be the better subsitutes for these api's.You can handle Access Violation exception yorself
Paul McKenzie
July 6th, 2008, 01:01 PM
Hi,
We have to port our current legacy code to Windows Vista.. We have certain checks like IsBadReadPtr, IsBadWritePtr,IsBadStringPtr at sevaral places in our code. As these checks donot work in Windows vista. We have to find out alternatives. Can I know what could be the better subsitutes for these api's. Can someone send me a code snippet .As VladimirF pointed out, you can catch the exception yourself, as accessing invalid memory is an error.
But that begs the question -- why is your app needing to call these functions? Unless you're debugging the program, the correct thing to do is to fix the program so that you don't need to call these functions.
Regards,
Paul McKenzie
Venkat K
July 6th, 2008, 11:51 PM
Thank.. But Can you suggest me what could be the better substitutes for handling illegal memory access.
Paul McKenzie
July 7th, 2008, 12:16 AM
Thank.. But Can you suggest me what could be the better substitutes for handling illegal memory access.I did -- fixing your program so that it doesn't cause illegal accesses is the best substitute for handling illegal memory accesses.
Any program that has an illegal memory access is broken and needs to be fixed. Releasing software where you are needing to use IsBadReadPtr() shows a lack of faith in the program itself. It implies that the program is unstable.
Regards,
Paul McKenzie
kirants
July 7th, 2008, 05:30 PM
Some more good arguments against using such checks in code when it shouldn't be there. Read up on all comments here:http://msdn.microsoft.com/en-us/library/aa366713(VS.85).aspx
codeguru.com
Copyright 2007 Jupitermedia Corporation All Rights Reserved.