my string code below works but crashes when it invokes a messagebox. i commented out the messagebox and the code works flawlessly so it seems that when the messagebox is invoked it modifies some registers which i need to preserve. my problem is how do i determine which registers i need to preserve in my code and for that matter any code i write?

im including some code here and maybe someone can verify that it is the preserving issue. to code tests for the character "d" at the begining of every new line.
              xor ecx,ecx

mov al,byte ptr [buffer0 + ecx]
.if al == "d"
invoke MessageBox,0,0,0,0
;add a directory
.elseif al == "-"
;add a file
.endif
@@:
inc ecx
mov al,byte ptr [buffer0 + ecx]
cmp al,0
je @up
cmp al,13
jne @B
add ecx,2
mov al,byte ptr [buffer0 + ecx]
.if al == "d"
;add a directory
invoke MessageBox,0,0,0,0
.elseif al == "-"
;add a file
.endif
dec ecx
jmp @B
@up:
Posted on 2002-01-30 20:27:26 by smurf
Any windows API has the right to destroy EAX, EDX, ECX - you should save them if you want them to be the same after the API call.
Posted on 2002-01-30 21:00:17 by bitRAKE
thanks bitrake. some more good info.:alright: i never would have thought that the ecx register would be modifed in that particualr api call.
Posted on 2002-01-30 21:07:53 by smurf