how to access bad pointers?
-
i worked in a company before. many apps shared to use a public database, the db (not SQL one) consisted lots of arrays, which hold pointers to some type of objects. unfortunately, some apps saved bad pointers (pointed to nothing but not null) to the db. once other apps accessed to those bad pointers, the apps crashed. do u know how to access to bad pointers with no crash (i.e. find they are bad then skip them)? thx includeh10
-
i worked in a company before. many apps shared to use a public database, the db (not SQL one) consisted lots of arrays, which hold pointers to some type of objects. unfortunately, some apps saved bad pointers (pointed to nothing but not null) to the db. once other apps accessed to those bad pointers, the apps crashed. do u know how to access to bad pointers with no crash (i.e. find they are bad then skip them)? thx includeh10
Can you provide more detail on the file structure and details of what the crashes are. In the good old days of DOS, I used to have to manually fix bad pointers in files with a hex editor. Michael :-) Time flies like an arrow. Fruit flies like a banana
-
Can you provide more detail on the file structure and details of what the crashes are. In the good old days of DOS, I used to have to manually fix bad pointers in files with a hex editor. Michael :-) Time flies like an arrow. Fruit flies like a banana
similar to this, i think: //the database is called "Object Store" //did by some one else MyClass p=new MyClass; delete p; ary.Add(p); //ary is an Array db.Save(); //Save to database //i do db.Open(file_name); int i,iNum=ary.GetSize(); for(i=0;i < iNum;i++) { int iSomeValue=ary.GetAt(i)->iSomeValue; } note: one of ary.GetAt(i) above gets bad pointer. thx includeh10
-
similar to this, i think: //the database is called "Object Store" //did by some one else MyClass p=new MyClass; delete p; ary.Add(p); //ary is an Array db.Save(); //Save to database //i do db.Open(file_name); int i,iNum=ary.GetSize(); for(i=0;i < iNum;i++) { int iSomeValue=ary.GetAt(i)->iSomeValue; } note: one of ary.GetAt(i) above gets bad pointer. thx includeh10
-
similar to this, i think: //the database is called "Object Store" //did by some one else MyClass p=new MyClass; delete p; ary.Add(p); //ary is an Array db.Save(); //Save to database //i do db.Open(file_name); int i,iNum=ary.GetSize(); for(i=0;i < iNum;i++) { int iSomeValue=ary.GetAt(i)->iSomeValue; } note: one of ary.GetAt(i) above gets bad pointer. thx includeh10
;)That's your mistake. You should check your code before running Hung Son A Vietnamese student i-g.hypermart.net dlhson2001@yahoo.com
-
i worked in a company before. many apps shared to use a public database, the db (not SQL one) consisted lots of arrays, which hold pointers to some type of objects. unfortunately, some apps saved bad pointers (pointed to nothing but not null) to the db. once other apps accessed to those bad pointers, the apps crashed. do u know how to access to bad pointers with no crash (i.e. find they are bad then skip them)? thx includeh10
You can check some bap pointers with a function like IsBadReadPtr and similar functions but it will not detect all bad pointers (and maybe none with our sample). You can also uses exception handling to catch access violation and do so other validation to ensure that the pointer do point to valid data. So any solution are a patch but when we want to handle corrupted files, we often have no choice than to fully validate the data and skip any data that does not appears to be good! Or if you can fix the data itself, simply correct existing files and create new files without corrupted data (you may in that case want to add some means to detect that you have a new file and skip validation in that case). Philippe Mori
-
i worked in a company before. many apps shared to use a public database, the db (not SQL one) consisted lots of arrays, which hold pointers to some type of objects. unfortunately, some apps saved bad pointers (pointed to nothing but not null) to the db. once other apps accessed to those bad pointers, the apps crashed. do u know how to access to bad pointers with no crash (i.e. find they are bad then skip them)? thx includeh10
You can try to use
AfxIsValidAddress
, look up in MSDN on its parameters and explaination Philip Patrick Web-site: www.stpworks.com "Two beer or not two beer?" Shakesbeer