home *** CD-ROM | disk | FTP | other *** search
- include windows.inc
- includelib user32.lib
- includelib kernel32.lib
- includelib gdi32.lib
-
- AboutProc PROTO :HWND, :DWORD, :DWORD, :DWORD
- DrawIcon PROTO ,:dword,:dword,:dword,:dword
-
- .data
- AppName db "KeyGen for PC trial crackme -- by Bjanes",0
- ClassName db "DLGCLASS",0
- MenuName db "MyMenu",0
- DlgName db "MyDialog",0
- NoName db "You have to enter the name!",0
-
- .data?
- hInstance HINSTANCE ?
- CommandLine LPSTR ?
- username db 40 dup(?),0
- serial db 4 dup(?),0
- paints PAINTSTRUCT <?>
- Iconh dd ?
- hand dd ?
-
- .const
- IDC_EDIT equ 3000
- IDC_EDIT2 equ 3003
- IDC_BUTTON equ 3001
- IDC_BUTTON2 equ 3004
- IDM_EXIT equ 11
- IDM_GETTEXT equ 32000
- IDM_CLEAR equ 32001
- IDI_ICON equ 01h
- IDM_ABOUT equ 02h
-
- .code
- start:
- invoke GetModuleHandle, NULL
- mov hInstance,eax
- invoke GetCommandLine
- invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
- invoke ExitProcess,eax
- WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:SDWORD
- LOCAL wc:WNDCLASSEX
- LOCAL msg:MSG
- LOCAL hDlg:HWND
- mov wc.cbSize,SIZEOF WNDCLASSEX
- mov wc.style, CS_HREDRAW or CS_VREDRAW
- mov wc.lpfnWndProc, OFFSET WndProc
- mov wc.cbClsExtra,NULL
- mov wc.cbWndExtra,DLGWINDOWEXTRA
- push hInstance
- pop wc.hInstance
- mov wc.hbrBackground,COLOR_BTNFACE+1
- mov wc.lpszMenuName,OFFSET MenuName
- mov wc.lpszClassName,OFFSET ClassName
- invoke LoadIcon,hInst,IDI_ICON
- mov Iconh, eax
- mov wc.hIcon,eax
- mov wc.hIconSm,0
- invoke LoadCursor,NULL,IDC_ARROW
- mov wc.hCursor,eax
- invoke RegisterClassEx, addr wc
- invoke CreateDialogParam,hInstance,ADDR DlgName,NULL,NULL,NULL
- mov hDlg,eax
- invoke ShowWindow, hDlg,SW_SHOWNORMAL
- invoke UpdateWindow, hDlg
- invoke GetDlgItem,hDlg,IDC_EDIT
- invoke SetFocus,eax
- .WHILE TRUE
- invoke GetMessage, ADDR msg,NULL,0,0
- .BREAK .IF (!eax)
- invoke IsDialogMessage, hDlg, ADDR msg
- .IF eax ==FALSE
- invoke TranslateMessage, ADDR msg
- invoke DispatchMessage, ADDR msg
- .ENDIF
- .ENDW
- mov eax,msg.wParam
- ret
- WinMain endp
-
- WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
- mov eax,uMsg
- .IF eax==WM_DESTROY
- invoke PostQuitMessage,NULL
- .ELSEIF eax==WM_COMMAND
- mov eax,wParam
- .IF lParam==0
- .IF ax==IDM_ABOUT
- invoke DialogBoxParam, hInstance, IDM_ABOUT, hWnd, ADDR AboutProc, NULL
- .ELSEIF ax==IDM_EXIT
- invoke DestroyWindow,hWnd
- invoke PostQuitMessage,NULL
- .ENDIF
- .ELSE
- .IF ax==IDC_BUTTON
- shr eax,16
- .IF ax==BN_CLICKED ;'GET SERIAL' BUTTON IS PUSHED
- invoke GetDlgItemText,hWnd,IDC_EDIT, ADDR username,40 ;GET NAME FROM TEXTBOX
- xor eax,eax ; EAX = 0
- xor edx,edx ; EDX = 0
- xor ecx,ecx ; ECX = 0
- mov eax, OFFSET username ; EAX = Address of Name
- cmp BYTE PTR [eax], dl ; Is there name?
- jz @end2 ; If not the jump to @end2
- mov edi,offset serial ; EDI = Address for Serial
- mov [edi], ecx ; Clear memory for Serial
- @loop: ; DO
- mov cl, BYTE PTR [eax] ; AL = First char of Name
- ror ecx,08 ; Rotate bits in ECX to the right 8 times
- add edx,ecx ; EDX = EDX + ECX
- inc eax ; EAX = EAX + 1; Point to the next char of name
- cmp BYTE PTR [eax], 0 ; Is END of name
- jnz @loop ; If no the LOOP this
- ror edx,08 ; Rotate bits in EDX to the right 8 times
- cmp dl, 0 ; Is DL(first byte of EDX) = 0 ?
- jz @nedodaj ; If yes then skip next two lines
- mov [edi], dl ; If no then DL is first char of correct serial
- inc edi ; EDI = EDI + 1; Where to save next char of Serial
- @nedodaj:
- xor ebx,ebx ; EBX = 0
- xor ecx,ecx ; ECX = 0
- mov esi, 3 ; ESI = 3
-
- @loop2: ; DO
- mov bl, dl ; BL = DL
- rol edx, 08 ; Rotate bits in EDX to the right 8 times
- mov cl,dl ; CL = DL
- sub cl,bl ; CL = CL - BL
- jz @nedodaj2 ; If CL = 0 then skip next two lines
- mov [edi], cl ; If not then CL is next char of correct serial
- inc edi ; EDI = EDI + 1; Where to save next char of Serial
- @nedodaj2:
- dec esi ; ESI = ESI - 1
- jnz @loop2 ; Loop until ESI = 0
-
- invoke SetDlgItemText,hWnd,IDC_EDIT2,ADDR serial ; Print correct Serial
- jmp @end ; Jump to END
- @end2: ; If there is no name entered then execute next few lines
- xor eax,eax ; EAX = 0
- xor edx,edx ; EDX = 0
- mov edx, OFFSET username ; EDX = Address of Name
- mov [edx], EAX ; Clear memory location for Serial
- invoke SetDlgItemText,hWnd,IDC_EDIT2,ADDR NoName ; Display "You have to enter the name"
- @end: ; END
-
- .ENDIF
- .IF ax==BN_CLICKED
- invoke SendMessage,hWnd,WM_COMMAND,IDM_EXIT,0
- .ENDIF
- .ENDIF
- .ENDIF
- .ELSE
- invoke DefWindowProc,hWnd,uMsg,wParam,lParam
- ret
- .ENDIF
- xor eax,eax
- ret
- WndProc endp
-
- AboutProc PROC hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM
- mov eax,iMsg
- .if eax==WM_INITDIALOG
- invoke GetDlgItem,hWnd,IDC_EDIT
- invoke SetFocus,eax
- .ELSEIF eax==WM_PAINT
- call _printicon
-
- .elseif eax==WM_CLOSE
- invoke EndDialog,hWnd,NULL
- .elseif eax==WM_COMMAND
- mov eax,wParam
- .if eax==IDC_BUTTON2
- invoke EndDialog,hWnd,NULL
- .endif
- .else
- mov eax,FALSE
- ret
- .endif
- mov eax,TRUE
- ret
-
- _printicon:
- push offset paints
- push hWnd
- call BeginPaint
- push Iconh
- push 7
- push 15
- mov hand, eax
- push hand
- call DrawIcon
- push Iconh
- push 7
- push 180
- push hand
- call DrawIcon
- push offset paints
- push hWnd
- call EndPaint
-
- ret
-
- AboutProc endp
- END start