I am having a bugger of a time tracking down why I do not get a "Crash" (in this case not BSOD, but "Windows has encountered a problem") that does not occur until closing, and only if I follow a certain sequence of steps. (Thankfully it is in one of my troubleshooting routines, so how often could it occur?, but on the other hand, How much faith can you have in a product if it causes an eventual crash when the tool was meant to SOLVE a problem?)
Anyways, I have debugged for any errors that could be caught by the debugger. And I have made sure any threads are not left open via WaitObject, and I have set a flag in all my loops to escape if ending while in my loop. And I have added Error Handling routines to log an error if one occurs that I have not thought of.
Now I am looking at bad pointers, or some other memory corrupted area and looking at the Windows API about "IsBadPtr", "IsBad______Ptr" functions, and I am a lil confused by the documentation, but I get the most part.
Since I am pretty weak on pointers (getting better at it, but still weak), I am hoping someone can explain a lil better than the documentation can.
Hard to follow I bet, but I am trying to understand the "basics" before I jump into the "Legal-ize" of what it all means.
Up until now, I have been using the following basic concept
Conflict of terms I know...but in this case I just wanted to know if the pointer existed...is there a better way?
Anyways, I have debugged for any errors that could be caught by the debugger. And I have made sure any threads are not left open via WaitObject, and I have set a flag in all my loops to escape if ending while in my loop. And I have added Error Handling routines to log an error if one occurs that I have not thought of.
Now I am looking at bad pointers, or some other memory corrupted area and looking at the Windows API about "IsBadPtr", "IsBad______Ptr" functions, and I am a lil confused by the documentation, but I get the most part.
Since I am pretty weak on pointers (getting better at it, but still weak), I am hoping someone can explain a lil better than the documentation can.
- If I use VARPTR or STRPTR, and the next line check if it is 0 or some value, how long is this value good for? (Assuming I make no changes on the variable that the VARPTR or STRPTR is pointing at), is it good for just in the function? or good for the scope that I declared the variable?, or technically though unlikely, but maybe possible, from the moment I ask till the moment that Windows happens to change it? (AKA, if I ask in 1 line and then the next line I do something, although its unlikely if even possible, that in that time the value could go from good to bad)
- Variables declared as actual pointers...."AS BYTE POINTER", "AS STRING POINTER", and etc....Are they valid for the scope I assign them? (AKA, if Global, or Local, or even the forgiving "Dim" (Which I will admit I have to learn to stop using Dim when its not an array, but thats another story)
- Temporarily until I totally understand pointers, I am hoping "IsBadCodePtr" is my save all to at least tell me is the pointer valid?, but I am confused about the remarks "If the calling process does not have read access to the specified memory, the return value is nonzero."...I do not get if the word "READ" means, as in "Read/Write" access....or if it means "Has access to" ???? Also, since it is "BadCode" does it mean the pointer to a function? or that a pointer is valid period? (for that matter, is there a function that just says the pointer is valid?...I will worry about the block it points to later, but for now I just want to understand better)
Hard to follow I bet, but I am trying to understand the "basics" before I jump into the "Legal-ize" of what it all means.
Up until now, I have been using the following basic concept
Code:
StringPointer = VARPTR(CharsToFind) 'Get the location of the pointer SELECT CASE StringPointer CASE 0 FUNCTION = %False EXIT FUNCTION CASE ELSE END SELECT ....Do whatever comes next
Comment