home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Copyright Shadow 1999
- ;
- .586p
- .model flat,stdcall
- locals
- jumps
-
- UNICODE = 0
-
-
-
- extrn GetDlgItemTextA:proc
- extrn _wsprintfA:proc
-
-
- DIALOG_1 equ 100
- IDC_EDIT1 equ 105
- IDC_EDIT2 equ 107
-
- include w32.inc
-
-
- .data
-
- hinstance dd 0
- paint PAINTSTRUCT <?>
- username db 30 dup(0)
- hdc dd 0
- key db 30 dup(0)
- format db "%lu",0
- number dd 0
- temp dd 0
- er db "too short username!",0
- hf db "Keygen for HF crackme II by Shadow/hf",0
- visit db "http://members.xoom.com/hell_crack",0
- .code
-
- start:
- ;
- ; this starts program only if there is no other copies running
- ;
- mov edx,offset visit
- call FindWindow,0,offset hf
- .if eax == 0
- call GetModuleHandle,0
- mov hinstance,eax
- ;
- ; create modal dialogbox from key.rc (template 100)
- ;
- call DialogBoxParamA,hinstance,DIALOG_1,0,offset dialogf,0
- .endif
- call ExitProcess,0
-
-
- PUBLIC dialogf
- dialogf proc hwnd:DWORD,umsg:DWORD,wparam:DWORD,lparam:DWORD
- ;
- ; This is basic callback procedure used by gui programs..
- ;
- xor eax,eax
- mov ax,word ptr umsg
-
- .if ax == WM_DESTROY
- call EndDialog,hwnd,0
- .elseif ax == WM_CLOSE
- call EndDialog,hwnd,0
- .elseif ax == WM_COMMAND
- mov ax,word ptr wparam
- ;
- ; Text char(s) entered to dialog?
- ;
- .if ax == IDC_EDIT1
- ;
- ; Read username
- ;
- call GetDlgItemTextA,hwnd,IDC_EDIT1,offset username,30
- ;
- ; If it's len > 4, then calculate and print keycode
- ;
- .if eax > 4
- call Calculate,offset username
- call _wsprintfA,offset key,offset format,eax
- call SetDlgItemTextA,hwnd,IDC_EDIT2,offset key
- .else
- ;
- ; no, print message username too short...
- ;
- call SetDlgItemTextA,hwnd,IDC_EDIT2,offset er
- .endif
- .endif
- .elseif ax == WM_INITDIALOG
- ; to do-- add some stuff?
- .elseif ax == WM_PAINT
- call BeginPaint,hwnd,offset paint
- mov hdc,eax
- call EndPaint,hwnd,offset paint
- .endif
- xor eax,eax
- ret
-
-
- dialogf endp
-
- Calculate proc pstr1:DWORD
- mov esi,pstr1
- xor eax,eax
- mov number,0
-
- ; because I use assembler I almost ripped whole routine from
- ; crackme..
-
- ;
- ; 1 char
- ;
- lodsb
- shl eax,2
- lea eax,[eax+2*eax]
- add number,eax
-
- ;
- ; 2 char
- ;
-
- xor eax,eax
- lodsb
- lea eax,[eax+4*eax]
- lea eax,[eax+4*eax]
- add number,eax
-
- ;
- ; 3 char
- ;
- xor eax,eax
- lodsb
- add eax,eax
- add number,eax
-
- ;
- ; 4 char
- ;
-
- xor eax,eax
- lodsb
- imul eax,eax,0bh
- add number,eax
- ;
- ; final stage
- ;
- call Strlen,pstr1
- ; strlen = eax
-
- mov edx,number
- imul edx,number
- imul edx
- ret
- Calculate endp
-
- ;
- ; High optimized strlen - size and speed ;)
- ;
- Strlen proc pstr:DWORD
- xor al,al ; scan for '0'
- mov edi,pstr ; edi = pointer to buffer to search
- or ecx,0ffffffffh ; how many times?
- repnz ;
- scasb ; repeat while not zero and ecx != 0
- not ecx ; invert all bits
- dec ecx ; ecx-1
- xchg eax,ecx ; eax = strlen
- ret ; return
- Strlen endp
- ends
- end start
-