Register recovery error(is this a bug or faults of my code?)
Posted: Fri Jul 22, 2005 11:27 pm
I recently wrote these code,and suffered written to readonly memory error.
I debuged the code in IDA,and found after all the code of this function executed,the return address in stack is pointed error by ESP(four bytes lower than the exact address which stored the correct return address)
Some one help me?
*Note1:The messagebox call--MessageRequester("Hello","HelloText") is added for easy deassembly,you can rip it out.
*Note2:The purpose of these code is to process a line in the specific CSV format file.
I debuged the code in IDA,and found after all the code of this function executed,the return address in stack is pointed error by ESP(four bytes lower than the exact address which stored the correct return address)
Some one help me?
*Note1:The messagebox call--MessageRequester("Hello","HelloText") is added for easy deassembly,you can rip it out.
*Note2:The purpose of these code is to process a line in the specific CSV format file.
Code: Select all
Procedure.s GetCsvItemString(*FullString.s)
MessageRequester("Hello","HelloText")
StartPos.l=0
EndPos.l=0
RtString.s = ""
If (Chr(34)=Left(*FullString.s,1))
StartPos.l=2
EndPos.l = FindString(*FullString.s,Chr(34)+",",2)
RtString.s = Mid(*FullString.s,StartPos.l,EndPos-StartPos)
*FullString.s = Mid(*FullString.s,EndPos+2,Len(*FullString.s)-EndPos+1-2)
Else
StartPos.l=1
EndPos.l = FindString(*FullString.s,",",1)
RtString.s = Mid(*FullString.s,StartPos.l,EndPos-StartPos)
*FullString.s = Mid(*FullString.s,EndPos+1,Len(*FullString.s)-EndPos+1-1)
EndIf
MessageRequester("Hello","HelloText")
ProcedureReturn RtString
EndProcedure
Title.s = GetCsvItemString(CurrLineText$)