Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.4 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 11/05/2000
  5. // Last modification: 08/10/2003
  6. // Project Intruder Position Indicator
  7. // SUBSYSTEM: Password Dialog
  8. // FILE: PasswordDlg.cpp
  9. // AUTHOR: Chizhevskiy Sergey
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Source file for implemenation of class CPasswordDlg
  13. //----------------------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "..\LgLib\Version.h"
  16. #include "PasswordDlg.h"
  17. CPasswordDlg::CPasswordDlg()
  18. {
  19. m_pProfile = NULL;
  20. m_bSuper = FALSE;
  21. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CPasswordDlg::CPasswordDlg" );
  22. }
  23. CPasswordDlg::~CPasswordDlg()
  24. {
  25. LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CPasswordDlg::~CPasswordDlg" );
  26. }
  27. BOOL CPasswordDlg::DoModal(HWND hParent, CProfile *pProfile)
  28. {
  29. m_pProfile = pProfile;
  30. if( !_tcsicmp( m_pProfile->SettingsPassword(), _T("")) &&
  31. !_tcsicmp( m_pProfile->SettingsSuperPassword(), _T("")) )
  32. {
  33. m_bSuper = TRUE;
  34. return TRUE;
  35. }
  36. return ::DialogBoxParam((HINSTANCE)::GetWindowLong(hParent, GWL_HINSTANCE),
  37. MAKEINTRESOURCE(IDD_PASSWORD_DLG), hParent,
  38. WndProcPasswordDlg, (LPARAM)this) == IDOK;
  39. }
  40. // ????
  41. BOOL CPasswordDlg::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  42. {
  43. static CPasswordDlg *self = NULL;
  44. TCHAR pBuffer[0x500];
  45. switch(uMsg)
  46. {
  47. case WM_INITDIALOG:
  48. ::SetFocus(::GetDlgItem(hWnd, IDC_EDIT_PASSWORD));
  49. return TRUE;
  50. case WM_COMMAND:
  51. switch(LOWORD(wParam))
  52. {
  53. case IDOK:
  54. ::GetWindowText(::GetDlgItem(hWnd, IDC_EDIT_PASSWORD), pBuffer, 100);
  55. if( !_tcsicmp(pBuffer, m_pProfile->SettingsPassword()) )
  56. {
  57. m_bSuper = FALSE;
  58. ::EndDialog(hWnd, IDOK);
  59. }
  60. else
  61. if( !_tcsicmp(pBuffer, _T("www.laserguard.com")) ||
  62. !_tcsicmp(pBuffer, m_pProfile->SettingsSuperPassword()) )
  63. {
  64. m_bSuper = TRUE;
  65. ::EndDialog(hWnd, IDOK);
  66. }
  67. return TRUE;
  68. case IDCANCEL:
  69. ::EndDialog(hWnd, IDCANCEL);
  70. return TRUE;
  71. }
  72. }
  73. return FALSE;
  74. }
  75. BOOL CALLBACK WndProcPasswordDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  76. {
  77. static CPasswordDlg *self = NULL;
  78. if(uMsg == WM_INITDIALOG)
  79. self = (CPasswordDlg*)lParam;
  80. if(self)
  81. return self->WndProc(hwndDlg, uMsg, wParam, lParam);
  82. return FALSE;
  83. }