Hello! There is a code task (from the program of the problem). Two lines are entered into the program (login password \ serial). What should be the serial for the program to be successful?
Here is the part of the code where working with these strings occurs:
.text:004012F9 sub_4012F9 proc near ; CODE XREF: sub_401123+113 p .text:004012F9 push ebp .text:004012FA mov ebp, esp .text:004012FC push esi .text:004012FD push edi .text:004012FE lea esi, String .text:00401304 lea edi, String2 .text:0040130A xor eax, eax .text:0040130C xor ecx, ecx .text:0040130E mov bl, 1Ah .text:00401310 .text:00401310 loc_401310: ; CODE XREF: sub_4012F9+2F j .text:00401310 cmp byte ptr [esi], 0 .text:00401313 jz short loc_40132A .text:00401315 mov al, [esi] .text:00401317 add al, cl .text:00401319 xor al, cl .text:0040131B div bl .text:0040131D shr ax, 8 .text:00401321 add al, 41h .text:00401323 mov [edi], al .text:00401325 inc edi .text:00401326 inc esi .text:00401327 inc ecx .text:00401328 jmp short loc_401310 .text:0040132A ; --------------------------------------------------------------------------- .text:0040132A .text:0040132A loc_40132A: ; CODE XREF: sub_4012F9+1A j .text:0040132A mov byte ptr [edi], 0 .text:0040132D xor eax, eax .text:0040132F cmp ecx, 0 .text:00401332 jz short loc_40134E .text:00401334 push offset String2 ; lpString2 .text:00401339 push offset String1 ; lpString1 .text:0040133E call lstrcmpA .text:00401343 cmp eax, 0 .text:00401346 jz short loc_40134C .text:00401348 xor eax, eax .text:0040134A jmp short loc_40134E .text:0040134C ; --------------------------------------------------------------------------- .text:0040134C .text:0040134C loc_40134C: ; CODE XREF: sub_4012F9+4D j .text:0040134C mov eax, ecx
then if cmp eax, 0 serial is not true, otherwise it is correct.
For the first time I come across these things))) The task is easy ... But I am not an ace and I don’t really understand what is happening there ... Can you describe in general terms what happens during the serial check?