I can get window text, then how do I compare the buffer and do X if its "this" or Y if its not "this"

I have this, but if I append anything to the end of the password, it still reads it, example is "guardxx" or "guard-_-~:D" it still says its right.

passwordx db "guard", 0
invoke GetWindowText, hwndEdit, offset buffer, 128
mov eax, dword ptr [buffer]
cmp eax, dword ptr [passwordx]
jne Wrong
invoke MessageBox, 0, offset Text1text, offset Text1text, 0
jmp lblELSE
invoke MessageBox, 0, offset WrongMSG, offset Text1text, 0
Posted on 2003-06-08 16:39:36 by KewLexX
The easiest way is to use lstrcmp API. Just look in the documentation for it.'
Then you can

test eax, eax
jnz _not
;strings are equal
jmp _endif
;string are not equal

or just
.if eax == 0
;not equal
Posted on 2003-06-08 16:48:07 by Milos
Thanks, but just so I can learn, why doesn't the code I pasted on top work right?
Posted on 2003-06-08 18:00:37 by KewLexX
mov eax, dword ptr
cmp eax, dword ptr

Is wrong... I guess it just gets 4 bytes from buffer and stores them in eax,
then compares these with 4 bytes from passwordx. You need to check 6 bytes so that is why it's not working.
Posted on 2003-06-08 18:10:36 by Milos