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.
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
Wrong:
invoke MessageBox, 0, offset WrongMSG, offset Text1text, 0
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
_not:
;string are not equal
_endif:
or just
.if eax == 0
;equal
.else
;not equal
.endif
Then you can
test eax, eax
jnz _not
;strings are equal
jmp _endif
_not:
;string are not equal
_endif:
or just
.if eax == 0
;equal
.else
;not equal
.endif
Thanks, but just so I can learn, why doesn't the code I pasted on top work right?
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.
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.