Hi!
Maybe it's too hot here, but I am just stuck with a stupid error and can't get my head free to solve it.



[...]
.data
[...]
szLine db 512 dup (?)

sz01 db 323 dup (?)
[...]
.code
[...]
invoke ReadFile, hInFile, pMem, nSize, addr nTemp, 0

lea esi, szLine
mov edi, pMem

.while nSize != 0
mov al, byte ptr [edi]
mov byte ptr [esi], al
inc edi
inc esi

.if al == 13
mov byte ptr [edi-1], 0
push edi
invoke MessageBox, 0, addr szLine, 0, 0

lea esi, szLine

lea ebx, sz01 ; ###################
xor eax, eax
@@:
mov al, byte ptr [esi]
mov byte ptr [ebx], al ; <--- ERROR!
inc esi
inc ebx
inc eax
cmp eax, 322
jne @B
[...]


I always get a access violation at the marked point and have no idea why :/

Thanks in advance!

bAZiK
Posted on 2002-06-19 13:16:12 by bazik


xor eax, eax
@@:
mov al, byte ptr [esi]
mov byte ptr [ebx], al ; <--- ERROR!
inc esi
inc ebx
inc eax
cmp eax, 322
jne @B


i seriously doubt that eax will ever be >255 in this case ;)

#edit:
except you got a few 0xff bytes in your string ;)
Posted on 2002-06-19 13:43:29 by Tola
@@:

mov al, byte ptr [esi]
mov byte ptr [ebx], al ; <--- ERROR!
inc esi
inc ebx
inc eax
cmp eax, 322
jne @B
    [*]Probably the ebx register is screwing the program
    [*]your using eax as a counter and the al as a placeholder for the transfer of byte values from one string to the other.
    [*]I bet this error doesn't happen on the first few executions, this probably happens a bit later on the loop.
    [*]I bet it isn't code!!! :grin:
Posted on 2002-06-19 13:52:09 by stryker
>your using eax as a counter and
>the al as a placeholder for the
>transfer of byte values from one string
>to the other.

Yeah, that was the problem :/ I hate this hot weather... it's 9:30pm and I have 32.5?C in my room... my computer makes the room about 4 degree warmer :)
Posted on 2002-06-19 14:36:37 by bazik