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
101 lines
2.4 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 11/05/2000
|
|
// Last modification: 08/10/2003
|
|
// Project Intruder Position Indicator
|
|
// SUBSYSTEM: Password Dialog
|
|
// FILE: PasswordDlg.cpp
|
|
// AUTHOR: Chizhevskiy Sergey
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file for implemenation of class CPasswordDlg
|
|
//----------------------------------------------------------------------------
|
|
|
|
#include "stdafx.h"
|
|
#include "..\LgLib\Version.h"
|
|
|
|
#include "PasswordDlg.h"
|
|
|
|
CPasswordDlg::CPasswordDlg()
|
|
{
|
|
m_pProfile = NULL;
|
|
m_bSuper = FALSE;
|
|
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CPasswordDlg::CPasswordDlg" );
|
|
}
|
|
|
|
CPasswordDlg::~CPasswordDlg()
|
|
{
|
|
LGLOG( LOG_LEVEL_MEDIUM, LOG_TYPE_INFO, this, "CPasswordDlg::~CPasswordDlg" );
|
|
}
|
|
|
|
BOOL CPasswordDlg::DoModal(HWND hParent, CProfile *pProfile)
|
|
{
|
|
m_pProfile = pProfile;
|
|
|
|
if( !_tcsicmp( m_pProfile->SettingsPassword(), _T("")) &&
|
|
!_tcsicmp( m_pProfile->SettingsSuperPassword(), _T("")) )
|
|
{
|
|
m_bSuper = TRUE;
|
|
return TRUE;
|
|
}
|
|
|
|
return ::DialogBoxParam((HINSTANCE)::GetWindowLong(hParent, GWL_HINSTANCE),
|
|
MAKEINTRESOURCE(IDD_PASSWORD_DLG), hParent,
|
|
WndProcPasswordDlg, (LPARAM)this) == IDOK;
|
|
}
|
|
// ????
|
|
BOOL CPasswordDlg::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
static CPasswordDlg *self = NULL;
|
|
TCHAR pBuffer[0x500];
|
|
|
|
switch(uMsg)
|
|
{
|
|
case WM_INITDIALOG:
|
|
::SetFocus(::GetDlgItem(hWnd, IDC_EDIT_PASSWORD));
|
|
return TRUE;
|
|
|
|
case WM_COMMAND:
|
|
switch(LOWORD(wParam))
|
|
{
|
|
case IDOK:
|
|
::GetWindowText(::GetDlgItem(hWnd, IDC_EDIT_PASSWORD), pBuffer, 100);
|
|
|
|
if( !_tcsicmp(pBuffer, m_pProfile->SettingsPassword()) )
|
|
{
|
|
m_bSuper = FALSE;
|
|
::EndDialog(hWnd, IDOK);
|
|
}
|
|
else
|
|
if( !_tcsicmp(pBuffer, _T("www.laserguard.com")) ||
|
|
!_tcsicmp(pBuffer, m_pProfile->SettingsSuperPassword()) )
|
|
{
|
|
m_bSuper = TRUE;
|
|
::EndDialog(hWnd, IDOK);
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
case IDCANCEL:
|
|
::EndDialog(hWnd, IDCANCEL);
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL CALLBACK WndProcPasswordDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
static CPasswordDlg *self = NULL;
|
|
|
|
if(uMsg == WM_INITDIALOG)
|
|
self = (CPasswordDlg*)lParam;
|
|
|
|
if(self)
|
|
return self->WndProc(hwndDlg, uMsg, wParam, lParam);
|
|
|
|
return FALSE;
|
|
}
|