home *** CD-ROM | disk | FTP | other *** search
/ KeyGen Studio 2002 / KeyGen_Studio_2002.iso / Tutorials / CrackMesCbjNet / nh-k4n3.ZIP / nhDlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-23  |  3.4 KB  |  158 lines

  1. // nhDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "nh.h"
  6. #include "nhDlg.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CNhDlg dialog
  16.  
  17. CNhDlg::CNhDlg(CWnd* pParent /*=NULL*/)
  18.     : CDialog(CNhDlg::IDD, pParent)
  19. {
  20.     //{{AFX_DATA_INIT(CNhDlg)
  21.         // NOTE: the ClassWizard will add member initialization here
  22.     //}}AFX_DATA_INIT
  23.     // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  24.     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  25. }
  26.  
  27. void CNhDlg::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(CNhDlg)
  31.     DDX_Control(pDX, IDC_EDIT2, m_Edit2);
  32.     DDX_Control(pDX, IDC_EDIT1, m_edit1);
  33.     //}}AFX_DATA_MAP
  34. }
  35.  
  36. BEGIN_MESSAGE_MAP(CNhDlg, CDialog)
  37.     //{{AFX_MSG_MAP(CNhDlg)
  38.     ON_WM_PAINT()
  39.     ON_WM_QUERYDRAGICON()
  40.     ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
  41.     //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CNhDlg message handlers
  46.  
  47. BOOL CNhDlg::OnInitDialog()
  48. {
  49.     CDialog::OnInitDialog();
  50.  
  51.     // Set the icon for this dialog.  The framework does this automatically
  52.     //  when the application's main window is not a dialog
  53.     SetIcon(m_hIcon, TRUE);            // Set big icon
  54.     SetIcon(m_hIcon, FALSE);        // Set small icon
  55.     
  56.     // TODO: Add extra initialization here
  57.     
  58.     return TRUE;  // return TRUE  unless you set the focus to a control
  59. }
  60.  
  61. // If you add a minimize button to your dialog, you will need the code below
  62. //  to draw the icon.  For MFC applications using the document/view model,
  63. //  this is automatically done for you by the framework.
  64.  
  65. void CNhDlg::OnPaint() 
  66. {
  67.     if (IsIconic())
  68.     {
  69.         CPaintDC dc(this); // device context for painting
  70.  
  71.         SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  72.  
  73.         // Center icon in client rectangle
  74.         int cxIcon = GetSystemMetrics(SM_CXICON);
  75.         int cyIcon = GetSystemMetrics(SM_CYICON);
  76.         CRect rect;
  77.         GetClientRect(&rect);
  78.         int x = (rect.Width() - cxIcon + 1) / 2;
  79.         int y = (rect.Height() - cyIcon + 1) / 2;
  80.  
  81.         // Draw the icon
  82.         dc.DrawIcon(x, y, m_hIcon);
  83.     }
  84.     else
  85.     {
  86.         CDialog::OnPaint();
  87.     }
  88. }
  89.  
  90. // The system calls this to obtain the cursor to display while the user drags
  91. //  the minimized window.
  92. HCURSOR CNhDlg::OnQueryDragIcon()
  93. {
  94.     return (HCURSOR) m_hIcon;
  95. }
  96.  
  97. void CNhDlg::OnOK() 
  98. {
  99.     // TODO: Add extra validation here
  100.     
  101.     CDialog::OnOK();
  102. }
  103.  
  104. void CNhDlg::OnChangeEdit1() 
  105. {
  106.     const int a[16]={
  107.         0x12,
  108.         0x5C,
  109.         0x34,
  110.         0x22,
  111.         0x0AB,
  112.         0x9D,
  113.         0x54,
  114.         0x0,
  115.         0x0DD,
  116.         0x84,
  117.         0x0AE,
  118.         0x66,
  119.         0x31,
  120.         0x78,
  121.         0x73,
  122.         0x0CF};
  123.     char s1[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  124.     char sss[]="KEYGENNING4NEWBIES";
  125.     CString s;
  126.     m_edit1.GetWindowText(s);
  127.     if (!s.IsEmpty())
  128.     {
  129.         unsigned long l=0x68656865;
  130.         s=s+" is a whore.";
  131.         char sq[0x40];
  132.         strcpy(sq,(LPCTSTR)s);
  133.         for(int i=s.GetLength();i<0x40;i++) sq[i]=0x0;
  134.         for(i=0;i<16;i++)
  135.         {
  136.             unsigned long l1;
  137.             strncpy((char *)&l1,&(sq[4*i]),4);
  138.             l1+=(a[i]^i);
  139.             __asm rol l1,7;
  140.             l=l^l1;
  141.         }
  142.         CString key;
  143.         for(i=0;i<=17;i++)
  144.         {
  145.             key.Insert(key.GetLength(),(s1[l%0x1a]^i^sss[i])+0x30);
  146.             l=l<<3;
  147.             __asm {
  148.                 mov eax,l
  149.                 mov edx,0x12345
  150.                 imul eax
  151.                 add eax,edx
  152.                 mov l,eax
  153.             }
  154.         }
  155.         m_Edit2.SetWindowText(key);
  156.     }
  157. }
  158.