I am getting A2068: instruction prefix not allowed with the last statement.



.data

string      db      '―Œž“’ΗΙΫ'    ; not $ = Ϋ (Alt 219)MUST BE AT THE END !!
;msgText1 db "No debugger detected!",0h
NoNo        db      ' ',0

.data?

storage      db      (sizeof string) dup (?) ; contains decrypted string


Burn:
        xor    eax,eax
        mov    edi,offset storage
        mov    ecx,sizeof string
        repnz  stosb                  ; Zero data area

Posted on 2010-06-12 10:38:22 by skywalker
I think the problem is with the 'nz' variation of rep.
repz/repnz are meant for use with cmps and scas. These do a compare-operation and then set flags, which can trigger the rep to stop.
With stos you just use rep, not repz/repnz/repe/repne.
Posted on 2010-06-12 16:57:36 by Scali
Thanks, here is my finished project.


; decrypt.asm Component program to crypt.asm
;            string value comes from output from crypt.asm
;            Ex. decrypt >> test.txt
include \masm32\include\masm32rt.inc

.data

string      db      '³”ί’žΣί‘ίŒ‹–‘˜ΡΫ'    ; not $ = Ϋ (Alt 219)MUST BE AT THE END !!
NoNo        db      ' ',0

.data?

storage      db      (sizeof string) dup (?) ; contains decrypted string

.code

start:

mov      ebx,offset storage
mov      esi,offset string

descramble:

lodsb
not          al
mov          ,eax
inc          bx
cmp          al,'$'
jz          next
jmp          descramble

next:

dec          bx        ;  backspace and write a null over
mov          al,00h    ;  the '$'
mov          ,al       

print ADDR storage       

invoke  MessageBox, NULL, addr storage, addr NoNo, MB_OK

; Erase the string after it's been shown in MessageBox
Burn:

xor    eax,eax
mov    edi,offset storage
mov    ecx,sizeof string
rep    stosb                  ; Zero data area

invoke ExitProcess,0

end start

Posted on 2010-06-12 18:56:38 by skywalker