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.

251 lines
5.4 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. ChooHsm.cpp
  5. Abstract:
  6. Initial property page Wizard implementation. Allows the setting
  7. of who the snapin will manage.
  8. Author:
  9. Rohde Wakefield [rohde] 12-Aug-1997
  10. Revision History:
  11. --*/
  12. #include "stdafx.h"
  13. #include "ChooHsm.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CChooseHsmDlg property page
  16. CChooseHsmDlg::CChooseHsmDlg(
  17. CWnd* /*pParent*/ /*=NULL*/
  18. )
  19. : CPropertyPage( )
  20. {
  21. WsbTraceIn( L"CChooseHsmDlg::CChooseHsmDlg", L"" );
  22. //{{AFX_DATA_INIT( CChooseHsmDlg )
  23. //}}AFX_DATA_INIT
  24. Construct( IDD_CHOOSE_HSM_2 );
  25. WsbTraceOut( L"CChooseHsmDlg::CChooseHsmDlg", L"" );
  26. }
  27. CChooseHsmDlg::~CChooseHsmDlg(
  28. )
  29. {
  30. }
  31. void
  32. CChooseHsmDlg::DoDataExchange(
  33. CDataExchange* pDX
  34. )
  35. {
  36. CPropertyPage::DoDataExchange( pDX );
  37. //{{AFX_DATA_MAP( CChooseHsmDlg )
  38. DDX_Control( pDX, IDC_MANAGE_LOCAL, m_ManageLocal );
  39. DDX_Control( pDX, IDC_MANAGE_REMOTE, m_ManageRemote );
  40. DDX_Text( pDX, IDC_MANAGE_NAME, m_ManageName );
  41. DDV_MaxChars( pDX, m_ManageName, 15 );
  42. //}}AFX_DATA_MAP
  43. }
  44. BEGIN_MESSAGE_MAP( CChooseHsmDlg, CPropertyPage )
  45. //{{AFX_MSG_MAP( CChooseHsmDlg )
  46. ON_BN_CLICKED( IDC_MANAGE_LOCAL, OnManageLocal )
  47. ON_BN_CLICKED( IDC_MANAGE_REMOTE, OnManageRemote )
  48. //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP( )
  50. BOOL CChooseHsmDlg::OnInitDialog( ) {
  51. WsbTraceIn( L"CChooseHsmDlg::OnInitDialog", L"" );
  52. AFX_MANAGE_STATE( AfxGetStaticModuleState( ) );
  53. CPropertyPage::OnInitDialog( );
  54. HRESULT hr = S_OK;
  55. try {
  56. SetButtons( CHOOSE_LOCAL );
  57. // m_WizardAnim.Seek( Use256ColorBitmap( ) ? 0 : 1 );
  58. // m_WizardAnim.Play( 0, -1, -1 );
  59. }WsbCatch( hr );
  60. WsbTraceOut( L"CChooseHsmDlg::OnInitDialog", L"" );
  61. return( FALSE );
  62. }
  63. // Set the finish button correctly based on the validity of the contents of the
  64. // controls in this dialog page.
  65. void
  66. CChooseHsmDlg::SetButtons(
  67. CHOOSE_STATE state
  68. )
  69. {
  70. WsbTraceIn( L"CChooseHsmDlg::SetButtons", L"" );
  71. ::PropSheet_SetWizButtons( GetParent( )->m_hWnd, PSWIZB_FINISH );
  72. #define CTL_ENABLE( _id,_enable ) GetDlgItem( _id )->EnableWindow( _enable )
  73. #define CTL_SHOW( _id,_show ) GetDlgItem( _id )->ShowWindow( ( _show ) ? SW_SHOWNA : SW_HIDE )
  74. CTL_ENABLE( IDC_MANAGE_NAME, state & CHOOSE_REMOTE );
  75. CTL_ENABLE( IDC_MANAGE_BROWSE, state & CHOOSE_REMOTE );
  76. if( state & CHOOSE_LOCAL ) {
  77. if( ! m_ManageLocal.GetCheck( ) ) {
  78. m_ManageLocal.SetCheck( 1 );
  79. m_ManageRemote.SetCheck( 0 );
  80. }
  81. // m_WizardAnim.Open( m_AllowSetup ? IDR_WIZARD_AVI : IDR_LOCAL_AVI );
  82. // m_WizardAnim.Seek( Use256ColorBitmap( ) ? 0 : 1 );
  83. // m_WizardAnim.Play( 0, -1, -1 );
  84. } else {
  85. if( ! m_ManageRemote.GetCheck( ) ) {
  86. m_ManageRemote.SetCheck( 1 );
  87. m_ManageLocal.SetCheck( 0 );
  88. }
  89. // m_WizardAnim.Open( IDR_REMOTE_AVI );
  90. // m_WizardAnim.Seek( Use256ColorBitmap( ) ? 0 : 1 );
  91. // m_WizardAnim.Play( 0, -1, -1 );
  92. }
  93. WsbTraceOut( L"CChooseHsmDlg::SetButtons", L"" );
  94. }
  95. BOOL
  96. CChooseHsmDlg::OnWizardFinish(
  97. )
  98. {
  99. WsbTraceIn( L"CChooseHsmDlg::OnWizardFinish", L"" );
  100. AFX_MANAGE_STATE( AfxGetStaticModuleState( ) );
  101. // m_WizardAnim.Stop( );
  102. //
  103. // Otherwise connect
  104. //
  105. if( m_ManageRemote.GetCheck( ) ) {
  106. GetDlgItemText( IDC_MANAGE_NAME, *m_pHsmName );
  107. while( *m_pHsmName[0] == '\\' ) {
  108. *m_pHsmName = m_pHsmName->Right( m_pHsmName->GetLength( ) - 1 );
  109. }
  110. } else {
  111. *m_pManageLocal = TRUE;
  112. }
  113. BOOL retval = CPropertyPage::OnWizardFinish( );
  114. WsbTraceOut( L"CChooseHsmDlg::OnWizardFinish", L"" );
  115. return( retval );
  116. }
  117. void
  118. CChooseHsmDlg::OnManageLocal(
  119. )
  120. {
  121. SetButtons( CHOOSE_LOCAL );
  122. }
  123. void
  124. CChooseHsmDlg::OnManageRemote(
  125. )
  126. {
  127. SetButtons( CHOOSE_REMOTE );
  128. }
  129. /////////////////////////////////////////////////////////////////////////////
  130. // CChooseHsmQuickDlg dialog
  131. CChooseHsmQuickDlg::CChooseHsmQuickDlg( CWnd* pParent /*=NULL*/ )
  132. : CDialog( CChooseHsmQuickDlg::IDD, pParent )
  133. {
  134. //{{AFX_DATA_INIT( CChooseHsmQuickDlg )
  135. // NOTE: the ClassWizard will add member initialization here
  136. //}}AFX_DATA_INIT
  137. }
  138. void
  139. CChooseHsmQuickDlg::DoDataExchange(
  140. CDataExchange* pDX
  141. )
  142. {
  143. CDialog::DoDataExchange( pDX );
  144. //{{AFX_DATA_MAP( CChooseHsmQuickDlg )
  145. // NOTE: the ClassWizard will add DDX and DDV calls here
  146. //}}AFX_DATA_MAP
  147. }
  148. BEGIN_MESSAGE_MAP( CChooseHsmQuickDlg, CDialog )
  149. //{{AFX_MSG_MAP( CChooseHsmQuickDlg )
  150. //}}AFX_MSG_MAP
  151. END_MESSAGE_MAP( )
  152. /////////////////////////////////////////////////////////////////////////////
  153. // CChooseHsmQuickDlg message handlers
  154. BOOL
  155. CChooseHsmQuickDlg::OnInitDialog(
  156. )
  157. {
  158. CDialog::OnInitDialog( );
  159. //
  160. // ??? At some point do we want to store in the registry
  161. // or the console the last machine contact was attempted to?
  162. //
  163. return( TRUE );
  164. }
  165. void
  166. CChooseHsmQuickDlg::OnOK(
  167. )
  168. {
  169. GetDlgItemText( IDC_MANAGE_NAME, *m_pHsmName );
  170. while( *m_pHsmName[0] == '\\' ) {
  171. *m_pHsmName = m_pHsmName->Right( m_pHsmName->GetLength( ) - 1 );
  172. }
  173. CDialog::OnOK( );
  174. }