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.

178 lines
4.4 KiB

  1. //
  2. // securdlg.cpp: secur dialog box
  3. //
  4. #include "stdafx.h"
  5. #define TRC_GROUP TRC_GROUP_UI
  6. #define TRC_FILE "securdlg"
  7. #include <atrcapi.h>
  8. #include "securdlg.h"
  9. #include "msrdprc.h"
  10. #ifndef OS_WINCE //CE_FIXNOTE: Not ported for CE yet
  11. CSecurDlg::CSecurDlg( HWND hwndOwner, HINSTANCE hInst):
  12. CDlgBase( hwndOwner, hInst, IDD_SECURITY_POPUP)
  13. {
  14. DC_BEGIN_FN("CSecurDlg");
  15. SetRedirDrives(FALSE);
  16. SetRedirPorts(FALSE);
  17. SetRedirSCard(FALSE);
  18. DC_END_FN();
  19. }
  20. CSecurDlg::~CSecurDlg()
  21. {
  22. }
  23. INT CSecurDlg::DoModal()
  24. {
  25. INT retVal = 0;
  26. DC_BEGIN_FN("DoModal");
  27. retVal = CreateModalDialog(MAKEINTRESOURCE(_dlgResId));
  28. TRC_ASSERT((retVal != 0 && retVal != -1),
  29. (TB, _T("DialogBoxParam failed - make sure mlang resources are appened\n")));
  30. DC_END_FN();
  31. return retVal;
  32. }
  33. //
  34. // Name: DialogBoxProc
  35. //
  36. // Purpose: Handles Secur Box dialog
  37. //
  38. // Returns: TRUE if message dealt with
  39. // FALSE otherwise
  40. //
  41. // Params: See window documentation
  42. //
  43. //
  44. INT_PTR CALLBACK CSecurDlg::DialogBoxProc (HWND hwndDlg,
  45. UINT uMsg,
  46. WPARAM wParam,
  47. LPARAM lParam)
  48. {
  49. DC_BEGIN_FN("DialogBoxProc");
  50. INT_PTR rc;
  51. TRC_DBG((TB, _T("SecurBox dialog")));
  52. switch (uMsg)
  53. {
  54. case WM_INITDIALOG:
  55. {
  56. //Center the secur dialog on the screen
  57. CenterWindow(NULL);
  58. SetDialogAppIcon(hwndDlg);
  59. //
  60. // Set settings to UI settings and but don't allow
  61. // user to turn on props that have been initially off
  62. //
  63. CheckDlgButton(hwndDlg, IDC_CHECK_ENABLE_DRIVES,
  64. (GetRedirDrives() ? BST_CHECKED : BST_UNCHECKED));
  65. EnableDlgItem(IDC_CHECK_ENABLE_DRIVES, GetRedirDrives());
  66. CheckDlgButton(hwndDlg, IDC_CHECK_ENABLE_PORTS,
  67. (GetRedirPorts() ? BST_CHECKED : BST_UNCHECKED));
  68. EnableDlgItem(IDC_CHECK_ENABLE_PORTS, GetRedirPorts());
  69. CheckDlgButton(hwndDlg, IDC_CHECK_ENABLE_SMARTCARDS,
  70. (GetRedirSCard() ? BST_CHECKED : BST_UNCHECKED));
  71. EnableDlgItem(IDC_CHECK_ENABLE_SMARTCARDS, GetRedirSCard());
  72. #ifndef OS_WINCE
  73. if(!CUT::IsSCardReaderInstalled())
  74. {
  75. #endif //OS_WINCE
  76. //
  77. // Hide the SCard checkbox (always hidden on CE since
  78. // we don't support scards on CE yet).
  79. //
  80. ShowWindow(GetDlgItem(hwndDlg, IDC_CHECK_ENABLE_SMARTCARDS),
  81. SW_HIDE);
  82. #ifndef OS_WINCE
  83. }
  84. #endif
  85. rc = TRUE;
  86. }
  87. break;
  88. case WM_DESTROY:
  89. {
  90. SaveDlgSettings();
  91. rc = TRUE;
  92. }
  93. break; //WM_DESTROY
  94. case WM_COMMAND:
  95. {
  96. switch(DC_GET_WM_COMMAND_ID(wParam))
  97. {
  98. case IDOK:
  99. {
  100. SaveDlgSettings();
  101. EndDialog(hwndDlg, IDOK);
  102. rc = TRUE;
  103. }
  104. break;
  105. case IDCANCEL:
  106. {
  107. EndDialog(hwndDlg, IDCANCEL);
  108. rc = TRUE;
  109. }
  110. break;
  111. }
  112. }
  113. break;
  114. default:
  115. {
  116. rc = CDlgBase::DialogBoxProc(hwndDlg,
  117. uMsg,
  118. wParam,
  119. lParam);
  120. }
  121. break;
  122. }
  123. DC_END_FN();
  124. return(rc);
  125. }
  126. VOID CSecurDlg::SaveDlgSettings()
  127. {
  128. //
  129. // Save fields
  130. //
  131. DC_BEGIN_FN("SaveDlgSettings");
  132. TRC_ASSERT(_hwndDlg,
  133. (TB,_T("_hwndDlg not set")));
  134. BOOL fDriveRedir = IsDlgButtonChecked(_hwndDlg,
  135. IDC_CHECK_ENABLE_DRIVES);
  136. SetRedirDrives(fDriveRedir);
  137. BOOL fPortRedir = IsDlgButtonChecked(_hwndDlg,
  138. IDC_CHECK_ENABLE_PORTS);
  139. SetRedirPorts(fPortRedir);
  140. BOOL fSCardRedir = IsDlgButtonChecked(_hwndDlg,
  141. IDC_CHECK_ENABLE_SMARTCARDS);
  142. SetRedirSCard(fSCardRedir);
  143. DC_END_FN();
  144. }
  145. #endif