Hi, I've a problem with "IF" in MASM.

        .elseif eax==IDC_CHECK
            invoke Generate,hWnd
            invoke GetDlgItemText,hWnd,IDC_SERIAL,addr userSerial,40
    (x)  .if (userSerial==SerialBuffer )
                invoke SetDlgItemText,hWnd,IDC_NAME,addr SerialBuffer
             
         
             
             
      .endif


The variabales are declared like this:

   1. NameBuffer      db      40 dup(?)
  2. SerialBuffer              db      40 dup(?)
  3. SerialSection            db      32 dup(?)
  4. userSerial                db      40 dup(?)



If you klick the Button "IDC_Check" you call the routine to calculate the serial.
The Serial is saved in "SerialBuffer"

Last line from the routine:

    invoke lstrcat,addr SerialBuffer,addr SerialSection


I want to check if SerialBuffer is equal to userSerial.
If they are the same, the programm should write the serial into the field "IDC_Name".

But I always get an error.

What is the problem?


Thanks.


PS: Sorry for my bad english, I'm german ;)
Posted on 2009-02-27 09:34:08 by Sy1ux
You can't just compare the strings using ".if (userSerial==SerialBuffer )" - that isnt doing what you think.

Use the lstrcmp or lstrcmpi functions to compare the strings, note for future reference that these api can lead to exploits of your application so they're not a long term solution, just a way to get your code working.
Posted on 2009-02-27 10:07:35 by Homer
Thank you Homer =)
Posted on 2009-02-27 11:17:40 by Sy1ux
Use the lstrcmp or lstrcmpi functions to compare the strings, note for future reference that these api can lead to exploits of your application so they're not a long term solution, just a way to get your code working.
Yeah Sy1ux, you gotta be careful no one exploits your keygen  :mrgreen: :mrgreen: :mrgreen:

sry, I had to :twisted:
Posted on 2009-02-27 22:36:23 by drizz
Hey, I'm an optimist, I'm assuming he's writing his own serial verification control in a vain attempt to protect his own work from software piracy... hah  :twisted:
Posted on 2009-03-01 09:13:49 by Homer