.if wParam == 1002

invoke GetDlgItemText,hWin,IDC_EDT1,addr username,sizeof username
invoke MessageBox,hWin,addr username,addr username,MB_OK
invoke lstrlen,addr username
invoke crc32,addr username,eax
mov edx,eax
invoke GetDlgItemInt,hWin,IDC_EDT3,NULL,FALSE
invoke wsprintf,addr formatted,addr format,eax
invoke MessageBox,hWin,addr formatted,addr ok,MB_OK
cmp edx,eax
jne @@@@badd
invoke MessageBox,hWin,addr goodtxt,addr goodcap,MB_OK
@@@@badd:
invoke MessageBox,hWin,addr badtxt,addr badcap,MB_OK
.endif


Okay everything works fine up until the compare. It generates a serial then compares the entered one to the generated one. The thing is that it generates the right serial (i used wsprintf to check this) and it gets the entered serial fine (used wsprintf as well) but the check is where it screws up.. any suggestions on how to make it work?

Thx,
RIF
Posted on 2003-07-28 19:47:09 by resistance_is_futile
Edx isn't being preserved by API calls? Try ebx maybe.
Posted on 2003-07-28 20:15:56 by Eóin
nope... ebx doesnt work either...
Posted on 2003-07-28 20:25:14 by resistance_is_futile
I fixed it :alright: . I just wsprintf both the name and serial then compare the results from both wsprintf's. Easier that way..
Posted on 2003-07-28 20:52:20 by resistance_is_futile
No offence but for the sake of understanding I really recommend you try to get your origional method to work, its cleaner, much faster and should work.

As it stands in your code eax isn't preserved either. In fact it's the return value for MessageBox so it definatly won't contain the crc it started with. You have to be very careful with registers. eax, ecx & edx are never guaranteed to be preserved.

See this thread
Posted on 2003-07-29 12:56:50 by Eóin
hmmm what register do you recommend me using?
Posted on 2003-07-30 19:46:58 by resistance_is_futile
Use the stack.

Raymond
Posted on 2003-07-30 22:30:31 by Raymond
Or if you already saved the other registers but aren't using them at the moment, use those
Posted on 2003-07-30 22:50:00 by Sephiroth3