Leaked source code of windows server 2003
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.

217 lines
5.3 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: statdlg.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // StatDlg.h : header file
  11. //
  12. #if !defined(AFX_STATDLG_H__2F127494_0854_11D1_BC85_00C04FC298B7__INCLUDED_)
  13. #define AFX_STATDLG_H__2F127494_0854_11D1_BC85_00C04FC298B7__INCLUDED_
  14. #if _MSC_VER >= 1000
  15. #pragma once
  16. #endif // _MSC_VER >= 1000
  17. /////////////////////////////////////////////////////////////////////////////
  18. //
  19. // Includes
  20. //
  21. #include "cmnstat.h"
  22. #include "statmon.h"
  23. /////////////////////////////////////////////////////////////////////////////
  24. //
  25. // Constants for dialog
  26. //
  27. // Columns in list view
  28. #define READER_COLUMN 0
  29. #define CARD_COLUMN 1
  30. #define STATUS_COLUMN 2
  31. #define MAX_ITEMLEN 255
  32. // Image list properties
  33. #define IMAGE_WIDTH 16
  34. #define IMAGE_HEIGHT 16
  35. #define NUMBER_IMAGES 5
  36. const UINT IMAGE_LIST_IDS[] = {IDI_SC_READERLOADED_V2,
  37. IDI_SC_READEREMPTY_V2,
  38. IDI_SC_READERERR,
  39. IDI_SC_INFO,
  40. IDI_SC_LOGONLOCK };
  41. // Image list indicies
  42. #define READERLOADED 0
  43. #define READEREMPTY 1
  44. #define READERERROR 2
  45. #define READERINFO 3
  46. #define READERLOCK 4
  47. // Card status string IDs
  48. const UINT CARD_STATUS_IDS[] = {IDS_SC_STATUS_NO_CARD,
  49. IDS_SC_STATUS_UNKNOWN,
  50. IDS_SC_STATUS_AVAILABLE,
  51. IDS_SC_STATUS_SHARED,
  52. IDS_SC_STATUS_IN_USE,
  53. IDS_SC_STATUS_ERROR};
  54. #define MAX_INDEX 255
  55. /////////////////////////////////////////////////////////////////////////////
  56. //
  57. // CSCStatusDlg dialog
  58. //
  59. class CSCStatusDlg : public CDialog
  60. {
  61. // members
  62. private:
  63. BOOL m_fEventsGood; // is the thread alive?
  64. SCARDCONTEXT m_hSCardContext; // Context with smartcard resource manager
  65. CScStatusMonitor m_monitor; // see statmon.h
  66. CSCardReaderStateArray m_aReaderState; // ""
  67. CStringArray m_aIdleList;
  68. CString* m_pstrLogonReader; // from scalert.h
  69. CString* m_pstrRemovalText; // ""
  70. BOOL m_fLogonLock;
  71. // Construction
  72. public:
  73. CSCStatusDlg(CWnd* pParent = NULL); // standard constructor
  74. // Dialog Data
  75. //{{AFX_DATA(CSCStatusDlg)
  76. enum { IDD = IDD_SCSTATUS_DIALOG };
  77. CListCtrl m_SCardList;
  78. CButton m_btnAlert;
  79. CEdit m_ediInfo;
  80. //}}AFX_DATA
  81. // ClassWizard generated virtual function overrides
  82. //{{AFX_VIRTUAL(CSCStatusDlg)
  83. public:
  84. virtual BOOL DestroyWindow();
  85. protected:
  86. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  87. //}}AFX_VIRTUAL
  88. // Implementation
  89. private:
  90. // UI routines
  91. void CleanUp( void );
  92. void DoErrorMessage( void ); // TODO: maybe take an error code?
  93. // Smartcard related routines
  94. void InitSCardListCtrl( void );
  95. LONG UpdateSCardListCtrl( void );
  96. public:
  97. void SetContext(SCARDCONTEXT hSCardContext);
  98. void RestartMonitor( void );
  99. void UpdateStatusText( void );
  100. void SetIdleList(CStringArray* paIdleList);
  101. void UpdateLogonLockInfo( void );
  102. protected:
  103. HICON m_hIcon;
  104. // Generated message map functions
  105. //{{AFX_MSG(CSCStatusDlg)
  106. virtual BOOL OnInitDialog();
  107. afx_msg void OnPaint();
  108. afx_msg HCURSOR OnQueryDragIcon();
  109. afx_msg LONG OnReaderStatusChange( UINT , LONG );
  110. afx_msg void OnAlertOptions();
  111. //}}AFX_MSG
  112. DECLARE_MESSAGE_MAP()
  113. };
  114. ///////////////////////////////////////////////////////////////////////////
  115. //
  116. // CSCStatusDlgThrd
  117. //
  118. class CSCStatusDlgThrd: public CWinThread
  119. {
  120. // Declare class dynamically creatable
  121. DECLARE_DYNCREATE(CSCStatusDlgThrd)
  122. public:
  123. // Construction / Destruction
  124. CSCStatusDlgThrd()
  125. {
  126. m_bAutoDelete = FALSE;
  127. m_hCallbackWnd = NULL;
  128. m_fStatusDlgUp = FALSE;
  129. }
  130. ~CSCStatusDlgThrd() {}
  131. // Implementation
  132. void Close( void );
  133. virtual BOOL InitInstance();
  134. void ShowDialog( int nCmdShow, CStringArray* paIdleList );
  135. void Update( void );
  136. void UpdateStatus( CStringArray* paIdleList );
  137. void UpdateStatusText( void );
  138. // members
  139. private:
  140. CSCStatusDlg m_StatusDlg;
  141. BOOL m_fStatusDlgUp;
  142. public:
  143. HWND m_hCallbackWnd;
  144. };
  145. /////////////////////////////////////////////////////////////////////////////
  146. // COptionsDlg dialog
  147. class COptionsDlg : public CDialog
  148. {
  149. // Construction
  150. public:
  151. COptionsDlg(CWnd* pParent = NULL); // standard constructor
  152. // Dialog Data
  153. //{{AFX_DATA(COptionsDlg)
  154. enum { IDD = IDD_OPTIONSDLG };
  155. BOOL m_fDlg;
  156. BOOL m_fSound;
  157. //}}AFX_DATA
  158. // Overrides
  159. // ClassWizard generated virtual function overrides
  160. //{{AFX_VIRTUAL(COptionsDlg)
  161. protected:
  162. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  163. //}}AFX_VIRTUAL
  164. // Implementation
  165. protected:
  166. // Generated message map functions
  167. //{{AFX_MSG(COptionsDlg)
  168. virtual void OnOK();
  169. //}}AFX_MSG
  170. DECLARE_MESSAGE_MAP()
  171. };
  172. //{{AFX_INSERT_LOCATION}}
  173. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  174. #endif // !defined(AFX_STATDLG_H__2F127494_0854_11D1_BC85_00C04FC298B7__INCLUDED_)