Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8222345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:14:53+00:00 2026-06-07T14:14:53+00:00

So I have been solving this crackme today. I managed to locate and understand

  • 0

So I have been solving this crackme today. I managed to locate and understand the serial generating routine except for a few last instructions. I decided to write a keygen in assembly for the first time. Everything was going nicely until I came to the last few instructions of the serial routine. I’m using MASM and Intel assembly (Intel, AT&T, how do you call these?) This is my current code:

.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc
include     \masm32\include\user32.inc
includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib

DlgProc     proto :DWORD,:DWORD,:DWORD,:DWORD
SerialCalc  proto :DWORD

.data
EnterText   db      "...enter a name...",0
temp        db      "temp",0
Format      db      "%i-x019871",0

.data?
NameBuffer      db          100 dup(?)
SerialBuffer    db          150 dup(?)
SerialLength    dd          ?
hInstance       HINSTANCE   ?

.const
IDC_NAME            equ     1002
IDC_SERIAL          equ     1003
IDC_GENERATE        equ     1004
IDC_NAMELABEL       equ     1005
IDC_SERIALLABEL     equ     1006
IDD_MAIN            equ     1001

.code
start:

    invoke GetModuleHandle, NULL
    mov hInstance,eax
    invoke DialogBoxParam, hInstance, IDD_MAIN, NULL, addr DlgProc, NULL
    invoke ExitProcess, 0

DlgProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
    .if uMsg == WM_INITDIALOG
        invoke GetDlgItem,hWnd,IDC_NAME ;get IDC_NAME
        invoke SetFocus,eax             ;focus on it
    .elseif uMsg == WM_COMMAND
        mov eax, wParam ;wParam = control that issued the WM_COMMAND message
        .if ax == IDC_NAME ;if it was the name box
            shr eax, 16 ;shift right and get more info?
            .if ax == EN_CHANGE ;if the text was changed
                invoke GetDlgItemText, hWnd, IDC_NAME, addr NameBuffer, 100 ;get text
                invoke lstrlen, addr NameBuffer ;get length
                mov SerialLength, eax ;move length into var
                .if eax == 0 ;if length is 0
                    invoke SetDlgItemTextA, hWnd, IDC_SERIAL, addr EnterText ;"...enter a name..."
                .elseif eax > 0 ;if length is bigger than 0
                    invoke SerialCalc, hWnd ;calc
                    invoke SetDlgItemTextA, hWnd, IDC_SERIAL, addr SerialBuffer ;"serial"
                .endif
            .endif
        .endif
    .elseif uMsg == WM_CLOSE
        invoke EndDialog, hWnd, 0
    .endif

    xor eax,eax
    ret
DlgProc endp

SerialCalc proc hWnd:HWND
    ;push ecx allocate space for 1 local variable; i was trying to do something with local variables, but I failed
    mov edx, SerialLength
    imul edx, edx, 875CDh
    mov eax, 51EB851Fh
    mul edx
    mov eax, edx
    shr eax, 5h
    imul eax, eax, -370h
    xor edx, edx ;mov edx, 0
    ;problems start here; I took this code from a solution i found
    ;push edx
    ;push eax
    ;fild qword ptr [esp]
    ;add esp, 8
    ;fstp real8 ptr [SerialBuffer]
            ;more stuff should come here sprintf etc.. but since I haven't solved my main problem yet I decided not to rush
SerialCalc endp

end start

And this is the actual serial routine in the program itself:

MOV EDX,EAX
IMUL EDX,EDX,875CD
MOV EAX,51EB851F
MUL EDX
MOV EAX,EDX
SHR EAX,5
IMUL EAX,EAX,-370
MOV EDX,0
PUSH EDX                                                            ; ||format = NULL
PUSH EAX                                                            ; ||s = FE8BC1A0
FILD QWORD PTR SS:[ESP]                                             ; ||
LEA ESP,DWORD PTR SS:[ESP+8]                                        ; ||
FSTP QWORD PTR SS:[EBP-410]                                         ; ||
FLD QWORD PTR SS:[EBP-410]                                          ; ||
FSTP QWORD PTR SS:[ESP+8]                                           ; ||
MOV DWORD PTR SS:[ESP+4],Crackme_.00401469                          ; ||ASCII "%i-x019871"
LEA EAX,[LOCAL.194]                                                 ; ||
MOV DWORD PTR SS:[ESP],EAX                                          ; ||
CALL <JMP.&msvcrt.sprintf>                                          ; |\sprintf
LEA EAX,[LOCAL.194]                                                 ; |
MOV DWORD PTR SS:[ESP+4],EAX                                        ; |
LEA EAX,[LOCAL.130]                                                 ; |
MOV DWORD PTR SS:[ESP],EAX                                          ; |
CALL <JMP.&msvcrt.strcmp>                                           ; \strcmp

The routine calculates the serial which finishes in EAX, pushes it onto the stack and then, as far as I understand, uses FILD to push it onto the FPU stack, FSPT to take it off of the FPU and put it into EBP-410, FLD to push EBP-410 onto the FPU again and finally, uses the FSTP to store it into ESP+8 as a parameter for sprintf. The sprint and strcmp don’t really matter here but I included them anyway so you can get a better understanding of what’s going on.

By the way, this LOCAL 194. is the place where the formatted string will be placed.

I searched the Internet and found these instructions’ descriptions but haven’t found any actual examples or material that could help me transfer this to my keygen.

So the final question is: how do I transfer this to my keygen? I always get the “Program has stopped working” message or nothing shows up in the serial box. The commented stuff in my SerialCalc routine is the part which I ripped off of another guy’s solution just to try if it’ll work, but unfortunately, it didn’t.

Tell me if you need more details about the problem or any extra information.

I apologize for my noobiness!

Thanks in advance,
Tuntuni.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:14:55+00:00Added an answer on June 7, 2026 at 2:14 pm

    I finally got it! It seems I haven’t balanced the stack correctly after the instructions or something. Anyway, I used Visual Studio to write inline assembly and finally got it work. Thanks for reading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dudes, been trying for very long time on solving this. I have been looking
I'm winding throught this Yabe tutorial and have been happily get bugs and solving
Ok, I have been working on solving this problem all day, and I am
I understand this is a basic question... but I have been stuck on it
I have been extensively searching all over the net last night until today and
Have been working on this question for a couple hours and have come close
I have been solving a lot of memory leaks but have been unsuccessful in
I have been trying this for a little while nut just cannot get to
I've been trying to wrap my head around solving this issue but I can't
I have been at this all day and I just can't figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.