home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / 2a.asm < prev    next >
Encoding:
Assembly Source File  |  1999-06-27  |  11.6 KB  |  404 lines

  1. .386
  2. .MODEL FLAT, STDCALL
  3.  
  4. UNICODE=0
  5. include w32.inc
  6.  
  7. WinMain PROTO :HINSTANCE,:HINSTANCE,:LPSTR,:SDWORD
  8. DrawIcon PROTO :DWORD,:DWORD,:DWORD,:DWORD
  9. wsprintfA PROTO C :DWORD,:DWORD,:DWORD
  10. extrn BeginPaint :PROC
  11. extrn EndPaint :PROC
  12.  
  13. .data
  14. DlgName              db "MainWindow",0
  15. ChildName              db "AboutChild",0
  16. wsdec                 db "%X",0
  17. nullie                 db "Name must have at least 2 chars!",0
  18.  
  19. YourName             db "Your name:",0
  20. YourSerial             db "Your serial:",0
  21. FontName             db "Arial",0
  22.  
  23. About1                 db "Fully 32b KeyGenerator by Duelist.",0
  24. About2                 db "This KeyGen was coded using TASM",0
  25. About3                 db "and LCC Resource Editor.",0
  26. About4                 db "Visit iNSiDE on EFNet at #iNSiDE99!",0
  27.  
  28. table1 db 05Ah,000h,002h,000h,002h,002h,00Ah,008h,00Eh,006h,006h,006h,006h,006h,00Ah,008h,00Ah,018h,01Ah,010h,012h,01Ah,00Ah,014h,026h,01Eh,02Eh,010h,02Ah,020h,032h,01Eh,00Eh,03Eh,01Ah,006h,00Eh,042h,04Ah,00Ch
  29.        db 00Ah,024h,036h,04Ch,022h,024h,026h,02Eh,026h,01Ch,046h,034h,04Eh,04Ch,052h,064h,016h,018h,002h,036h,072h,064h,01Ah,076h,03Eh,048h,002h,01Eh,082h,06Eh,052h,03Ah,06Ah,08Ah,056h,064h,036h,002h,05Ah,07Eh
  30.        db 076h,076h,022h,070h,08Ah,020h,04Eh,090h,05Ah,098h,02Ah,074h,072h,03Eh,002h,00Ah,062h,004h,08Eh,098h,03Ah,096h,03Eh,088h,086h,09Ah,02Eh,034h,0B2h,058h,096h,00Eh,08Eh,03Ah,04Ah,062h,066h,086h,066h,052h
  31.        db 0D6h,0EEh,016h,0A8h,01Ah,050h,07Ah,0B6h,02Eh,0B6h,022h,0F4h,092h,072h,056h,0A6h,05Ah,08Ch,092h,04Ah,056h,066h,0E6h,082h,01Eh,000h,07Ah,034h,046h,05Ch,01Ah,0F0h,08Eh,058h,072h,068h,0C6h,0ECh,01Ah,006h
  32.        db 072h,014h,056h,014h,06Ah,086h,02Ah,026h,07Ah,0A4h,062h,080h,09Ah,048h,0E6h,042h,08Eh,078h,052h,078h,026h,076h,046h,0ECh,02Ah,0E8h,082h,060h,072h,03Eh,052h,01Eh,0F2h,07Ch,09Ah,0FAh,036h,01Eh,06Ah,0D2h
  33.        db 0D6h,05Ah,01Eh,038h,0D2h,09Eh,0AAh,062h,022h,048h,056h,06Ah,0FEh,09Eh,00Ah,03Ah,09Eh,0D8h,022h,018h,036h,064h,0AEh,046h,092h,008h,06Ah,060h,04Ah,0C0h,072h,0F2h,0EEh,01Ah,07Ah,032h,0CEh,0A0h,0DEh,022h
  34.        db 04Ah,098h,07Eh,0C8h,09Ah,016h,03Ah,010h,056h,0BAh,08Eh,012h,07Eh,0FEh,03Ah,01Eh
  35.  
  36.  
  37. table2 db 000h,000h,000h,000h,046h,020h,056h,0F5h,002h,000h,0A8h,00Ah,002h,000h,0BFh,005h,000h,000h,000h,000h,006h,089h,008h,002h,036h,001h,010h,002h,037h,001h,000h,000h,000h,000h,000h,000h,000h,000h,046h,020h
  38.        db 09Ch,008h,043h,001h,0FDh,001h,02Ah,001h,06Bh,002h,037h,001h,0FDh,001h,002h,000h,000h,000h,046h,020h,09Ch,008h,043h,001h,008h,002h,036h,001h,010h,002h,037h,001h,008h,002h,036h,001h,010h,002h,037h,001h
  39.        db 0DAh,088h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0BAh,089h,042h,000h,096h,00Dh,0EEh,088h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,0CEh,089h,0DFh,006h,04Fh,004h
  40.        db 08Eh,089h,0DFh,011h,000h,003h,0FEh,088h,0DFh,011h,000h,000h,000h,000h,0A8h,00Ah,0BFh,005h,0A4h,0F5h,0BFh,005h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,056h,0F5h,07Ah,007h,0D7h,016h,000h,000h
  41.        db 07Ah,007h,008h,002h,036h,001h,008h,002h,036h,001h,010h,002h,037h,001h,08Eh,089h,0DFh,011h,002h,000h,056h,0F5h,0A8h,0F5h,002h,000h,001h,06Ch,000h,000h,0CAh,0FBh,036h,001h,016h,002h,0BFh,005h,056h,0F5h
  42.        db 0BFh,005h,0D1h,089h,0AAh,01Bh,04Fh,004h,0A8h,0F5h,0BFh,005h,0C0h,0C0h,0C0h,000h,000h,000h,046h,020h,001h,06Ch,000h,000h,0C0h,000h,000h,000h,0C0h,0C0h,0C0h,000h,0DEh,089h,05Bh,01Ah,000h,000h,000h,080h 
  43.        db 07Ah,007h,000h,000h,0D7h,016h,024h,08Bh,05Ch,072h,0B7h,017h,0C0h,0C0h,0C0h,000h
  44.  
  45. table3                 db 110h dup (0)
  46.  
  47. IconHandle             dd ?
  48. BitmapHandle             dd ?
  49. hInstance             HINSTANCE ?
  50. thename                db 100h dup (0)
  51. outputbuffer             db 100h dup (0)
  52. values                 db 100h dup (0)
  53. hDcMem                 dd ?
  54. hfont                 dd ?
  55. DlgRect             RECT <>            
  56. DlgWidth              dd ?
  57. DlgHeight              dd ?
  58. DesktopRect              RECT <>
  59. keeper                 db 10 dup (0)
  60.  
  61. IDC_OK                   equ 1
  62. IDC_GENERATE             equ 101
  63. IDC_ABOUT             equ 102
  64. IDC_EXIT              equ 103
  65. IDC_NAME             equ 104
  66. IDC_SERIAL             equ 105
  67. ID_ABOUTTEXT             equ 201
  68. IDI_ICON                   equ 115
  69. IDI_BITMAP                 equ 116
  70. ICON_SMALL             equ 0
  71. DEFAULT_PITCH            equ 0
  72. DEFAULT_QUALITY             equ 0
  73. OEM_CHARSET               equ 255
  74. CLIP_CHARACTER_PRECIS        equ 1
  75. CLIP_DEFAULT_PRECIS          equ 0
  76. OUT_DEFAULT_PRECIS           equ 0
  77.  
  78. .code
  79. start:
  80.     call GetModuleHandle, NULL
  81.     mov  hInstance,eax
  82.         call WinMain, hInstance,NULL,0, SW_SHOWDEFAULT
  83.     call ExitProcess,eax
  84. WinMain proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:SDWORD
  85.         mov  eax, OFFSET DlgProc
  86.         call DialogBoxParam, hInst, offset DlgName,NULL,eax,NULL
  87.         ret
  88. WinMain endp
  89.  
  90. Morph proc Value:DWORD
  91.     pushad
  92.     xor ecx, ecx
  93.     mov esi, Value
  94.     aa:
  95.     mov eax, esi
  96.     xor eax, 0BADC0DEh
  97.     test ecx, ecx
  98.     jne bb
  99.     mov edi, 100h
  100.     jmp cc
  101.     bb:
  102.     mov edi, ecx
  103.     cc:
  104.     xor edx, edx
  105.     idiv edi
  106.     mov byte ptr [table3+ecx], dl
  107.     mov al, byte ptr [table3+ecx]
  108.     add eax, eax
  109.     and al, 0FFh
  110.     mov byte ptr [table3+ecx], al
  111.     movsx edx, byte ptr [table3+ecx]
  112.     imul edx, ecx
  113.     xor esi, edx
  114.     inc ecx
  115.     cmp ecx, 100h
  116.     jb aa
  117.     popad
  118.     ret
  119. Morph endp
  120.  
  121. MyProc proc
  122.     pushad
  123.     xor eax, eax
  124.     vv:
  125.     movsx edx, byte ptr [table2+eax]
  126.     mov dword ptr [table3+eax], edx
  127.     inc eax
  128.     cmp eax, 100h
  129.     jb vv    
  130.     xor esi, esi
  131.     mov dword ptr [keeper], 00000000
  132.     call lstrlen, offset thename
  133.     mov edi, eax
  134.     a:
  135.     call lstrlen, offset thename
  136.     sub eax, esi
  137.     dec eax
  138.     movsx edx, byte ptr [table1+eax]
  139.     imul edx, eax
  140.     inc eax  
  141.     call Morph, edx
  142.     movsx eax, byte ptr [thename+eax-1]
  143.     cmp eax, 0
  144.     je b
  145.     movsx edx, byte ptr [table3+eax]
  146.     call lstrlen, offset thename
  147.     imul edi, edx
  148.     inc esi
  149.     sub eax, esi
  150.     dec esi
  151.     mov ecx, eax
  152.     mov eax, edi
  153.     and ecx, 3
  154.     inc ecx
  155.     cdq
  156.     xor edx, edx
  157.     div ecx
  158.     mov edi, eax
  159.     movsx eax, byte ptr [thename+esi]
  160.     movsx edx, byte ptr [table3+eax]
  161.     sub edi, edx
  162.     mov edx, esi
  163.     imul edx, 4
  164.     mov dword ptr [values+edx], edi
  165.     inc esi
  166.     jmp a
  167.     b:
  168.     sub esi, 2
  169.     imul esi, 4
  170.     xor edx, edx
  171.     c:
  172.     mov eax, dword ptr [values+edx]
  173.     xor dword ptr [keeper], eax
  174.     add edx, 4
  175.     cmp edx, esi
  176.     jbe c
  177.     call Sleep,0
  178.     mov eax, dword ptr [keeper]
  179.     test eax, eax
  180.     jns ll
  181.     imul eax, -1
  182.     mov dword ptr [outputbuffer], 02Dh
  183.     call wsprintfA, offset outputbuffer+1, offset wsdec, eax
  184.     jmp d
  185.     ll:
  186.     call wsprintfA, offset outputbuffer, offset wsdec, eax
  187.     d:
  188.     popad
  189.     ret
  190. MyProc endp
  191.  
  192. DlgProc proc Handle: HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
  193.         LOCAL hdc:HDC
  194.         LOCAL ps:PAINTSTRUCT
  195.         LOCAL rect:RECT
  196.     mov eax, uMsg
  197.     cmp eax, WM_CTLCOLORDLG
  198.     je create_brush
  199.     cmp eax, WM_PAINT
  200.     je write_labels
  201.         cmp eax, WM_DESTROY
  202.     jne next
  203.         call PostQuitMessage, NULL
  204.         xor eax, eax    
  205.     next:    
  206.     cmp eax, WM_INITDIALOG
  207.     jne fourth
  208.     call LoadIconA, hInstance, IDI_ICON
  209.         mov IconHandle, eax
  210.     call LoadBitmap, hInstance, IDI_BITMAP
  211.     mov BitmapHandle, eax
  212.         call GetDlgItem, Handle, IDC_NAME
  213.         call SetFocus,eax
  214.         call SendMessage, Handle, WM_SETICON, ICON_SMALL, IconHandle
  215.     push offset DlgRect
  216.        push Handle
  217.     call GetWindowRect
  218.        call GetDesktopWindow
  219.     push offset DesktopRect
  220.     push eax
  221.     call GetWindowRect
  222.     push 0
  223.     mov eax,DlgRect.rc_bottom
  224.     sub eax,DlgRect.rc_top
  225.     mov DlgHeight,eax
  226.     push eax
  227.     mov eax,DlgRect.rc_right
  228.     sub eax,DlgRect.rc_left
  229.     mov DlgWidth,eax
  230.     push eax
  231.     mov eax, DesktopRect.rc_bottom
  232.     sub eax, DlgHeight
  233.     shr eax, 1
  234.     push eax
  235.     mov eax, DesktopRect.rc_right
  236.     sub eax, DlgWidth
  237.     shr eax, 1
  238.     push eax
  239.     push Handle
  240.     call MoveWindow
  241.     fourth:
  242.     cmp  eax, WM_CLOSE
  243.     jne  fifth
  244.         call EndDialog, Handle, NULL
  245.     fifth:
  246.         cmp eax, WM_COMMAND
  247.     jne msg_done
  248.         mov eax, wParam
  249.         cmp ax, IDC_NAME
  250.     jne not_name
  251.         call GetDlgItemTextA, Handle, IDC_NAME, offset thename, 100h
  252.         cmp eax, 2
  253.     jae do_the_calc
  254.     call SetDlgItemText, Handle, IDC_SERIAL, offset nullie
  255.         ret
  256.         do_the_calc:
  257.     call MyProc
  258.         call SetDlgItemText, Handle, IDC_SERIAL, offset outputbuffer
  259.     jmp msg_done    
  260.     not_name:                        
  261.         cmp ax, IDC_EXIT
  262.     jne is_it_about
  263.     shr eax, 16
  264.     cmp ax, BN_CLICKED
  265.     jne msg_done
  266.         call DestroyWindow, Handle
  267.     jmp msg_done
  268.     is_it_about:
  269.     cmp ax, IDC_ABOUT
  270.     jne msg_done
  271.     shr eax, 16
  272.     cmp ax, BN_CLICKED
  273.     jne msg_done
  274.     call DialogBoxParam, hInstance, offset ChildName, Handle, offset ChildProc, NULL
  275.     jmp msg_done
  276.     create_brush:
  277.         call CreateSolidBrush, 00000000h
  278.     mov eax, 1
  279.         ret
  280.     write_labels:
  281.     lea eax, ps
  282.     push eax
  283.     push [Handle]
  284.     call BeginPaint
  285.         mov hdc,eax
  286.         call CreateCompatibleDC, hdc
  287.         mov hDcMem, eax
  288.      call SelectObject, hDcMem, BitmapHandle
  289.     call BitBlt, hdc, 0, 0, 442, 284, hDcMem, 0, 0, SRCCOPY OR BLACKNESS
  290.         call ReleaseDC, Handle, hdc
  291.         call DeleteDC, hDcMem
  292.       call CreateFont,15,0,0,0,400,0,0,0, OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, offset FontName 
  293.         call SelectObject, hdc, eax
  294.         mov hfont, eax
  295.         call SetTextColor,hdc, 00ffffffh
  296.         call SetBkColor,hdc,00000000h
  297.         call lstrlen, offset YourName
  298.         call TextOut,hdc, 24, 122, offset YourName, eax
  299.         call lstrlen, offset YourSerial
  300.         call TextOut,hdc, 24, 162, offset YourSerial, eax
  301.     lea eax, ps
  302.     call EndPaint, Handle, eax                     
  303.     msg_done:
  304.         xor eax, eax
  305.     ret
  306. DlgProc endp
  307.  
  308.  
  309. ChildProc proc Handle:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
  310.         LOCAL hdc:HDC
  311.         LOCAL ps:PAINTSTRUCT
  312.         LOCAL rect:RECT
  313.     mov eax, uMsg
  314.         cmp eax, WM_DESTROY
  315.     je destroy_window
  316.         cmp eax, WM_CLOSE
  317.     jne create_abt_brush
  318.     destroy_window:
  319.         call EndDialog, Handle, NULL
  320.         xor eax, eax
  321.     ret
  322.     create_abt_brush:
  323.     cmp eax, WM_CTLCOLORDLG
  324.     jne do_the_painting
  325.     call CreateSolidBrush, 00000000h
  326.         ret
  327.     do_the_painting:
  328.         cmp eax, WM_PAINT
  329.     jne init_about
  330.     lea eax, ps
  331.     call BeginPaint, Handle, eax
  332.         mov  hdc,eax
  333.         call CreateFont,15,0,0,0,400,0,0,0, OEM_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, offset FontName 
  334.         call SelectObject, hdc, eax
  335.         mov hfont,eax
  336.         call SetTextColor,hdc, 00ffffffh
  337.         call SetBkColor,hdc,00000000h
  338.     push offset About1
  339.     call lstrlen
  340.         call TextOut, hdc, 10, 10, offset About1, eax
  341.     push offset About2
  342.     call lstrlen
  343.         call TextOut, hdc, 10, 30, offset About2, eax    
  344.     push offset About3
  345.     call lstrlen
  346.         call TextOut, hdc, 10, 50, offset About3, eax
  347.     push offset About4
  348.     call lstrlen
  349.         call TextOut, hdc, 10, 90, offset About4, eax
  350.     lea eax, ps
  351.     call EndPaint, Handle, eax
  352.     jmp about_done
  353.         init_about:
  354.     cmp eax, WM_INITDIALOG
  355.     jne about_command
  356.         call SetFocus, Handle
  357.     push offset DlgRect
  358.        push Handle
  359.     call GetWindowRect
  360.        call GetDesktopWindow
  361.     push offset DesktopRect
  362.     push eax
  363.     call GetWindowRect
  364.     push 0
  365.     mov eax,DlgRect.rc_bottom
  366.     sub eax,DlgRect.rc_top
  367.     mov DlgHeight,eax
  368.     push eax
  369.     mov eax,DlgRect.rc_right
  370.     sub eax,DlgRect.rc_left
  371.     mov DlgWidth,eax
  372.     push eax
  373.     mov eax, DesktopRect.rc_bottom
  374.     sub eax, DlgHeight
  375.     shr eax, 1
  376.     push eax
  377.     mov eax, DesktopRect.rc_right
  378.     sub eax, DlgWidth
  379.     shr eax, 1
  380.     push eax
  381.     push Handle
  382.     call MoveWindow
  383.     mov eax, FALSE
  384.     ret
  385.     about_command:
  386.     cmp eax, WM_COMMAND
  387.     jne about_done
  388.         mov eax, wParam
  389.     cmp lParam, 1
  390.     je about_done
  391.         cmp ax, IDC_ABOUT
  392.     jne about_done
  393.         shr eax,16
  394.     cmp ax, BN_CLICKED
  395.     jne about_done
  396.     call EndDialog, Handle,NULL
  397.     mov eax,FALSE
  398.         ret    
  399.     about_done:
  400.         xor eax, eax
  401.     ret
  402. ChildProc endp
  403.  
  404. end start