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.

134 lines
2.8 KiB

  1. // File: dlgauth.cpp
  2. #include "precomp.h"
  3. #include "resource.h"
  4. #include "ConfUtil.h"
  5. #include "dlgauth.h"
  6. extern GUID g_csguidSecurity;
  7. /* C D L G A U T H */
  8. /*-------------------------------------------------------------------------
  9. %%Function: CDlgAuth
  10. -------------------------------------------------------------------------*/
  11. CDlgAuth::CDlgAuth(INmCall * pCall):
  12. m_hwnd(NULL),
  13. m_pCall(pCall)
  14. {
  15. }
  16. CDlgAuth::~CDlgAuth(void)
  17. {
  18. }
  19. INT_PTR CDlgAuth::DoModal(void)
  20. {
  21. return DialogBoxParam(::GetInstanceHandle(), MAKEINTRESOURCE(IDD_SECURE_CALL_INFO),
  22. ::GetMainWindow(), CDlgAuth::DlgProcAuth, (LPARAM) this);
  23. }
  24. /* D L G P R O C A U T H */
  25. /*-------------------------------------------------------------------------
  26. %%Function: DlgProcAuth
  27. -------------------------------------------------------------------------*/
  28. BOOL CALLBACK CDlgAuth::DlgProcAuth(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  29. {
  30. switch (uMsg)
  31. {
  32. case WM_INITDIALOG:
  33. {
  34. ASSERT(NULL != lParam);
  35. ::SetWindowLongPtr(hdlg, DWLP_USER, lParam);
  36. CDlgAuth * pDlg = (CDlgAuth *) lParam;
  37. pDlg->m_hwnd = hdlg;
  38. pDlg->OnInitDialog();
  39. return TRUE; // default focus is ok
  40. }
  41. case WM_COMMAND:
  42. {
  43. CDlgAuth * pDlg = (CDlgAuth*) GetWindowLongPtr(hdlg, DWLP_USER);
  44. if (NULL != pDlg)
  45. {
  46. pDlg->OnCommand(wParam, lParam);
  47. }
  48. break;
  49. }
  50. default:
  51. break;
  52. }
  53. return FALSE;
  54. }
  55. /* O N C O M M A N D */
  56. /*-------------------------------------------------------------------------
  57. %%Function: OnCommand
  58. -------------------------------------------------------------------------*/
  59. BOOL CDlgAuth::OnCommand(WPARAM wParam, LPARAM lParam)
  60. {
  61. ASSERT(NULL != m_hwnd);
  62. WORD wCmd = LOWORD(wParam);
  63. switch (wCmd)
  64. {
  65. case IDOK:
  66. {
  67. ::EndDialog(m_hwnd, wCmd);
  68. return TRUE;
  69. }
  70. case IDCANCEL:
  71. {
  72. ::EndDialog(m_hwnd, wCmd);
  73. return TRUE;
  74. }
  75. default:
  76. break;
  77. }
  78. return FALSE;
  79. }
  80. /* O N I N I T D I A L O G */
  81. /*-------------------------------------------------------------------------
  82. %%Function: OnInitDialog
  83. -------------------------------------------------------------------------*/
  84. VOID CDlgAuth::OnInitDialog(void)
  85. {
  86. PBYTE pb = NULL;
  87. ULONG cb = 0;
  88. CenterWindow(m_hwnd,HWND_DESKTOP);
  89. ASSERT(NULL != m_pCall);
  90. if (NULL != m_pCall && S_OK == m_pCall->GetUserData(g_csguidSecurity,&pb,&cb)) {
  91. if (cb > 0) {
  92. // Data was properly validated.
  93. SetDlgItemText(m_hwnd,IDC_SECURE_CALL_CERT,(LPCTSTR)pb);
  94. CoTaskMemFree(pb);
  95. }
  96. else {
  97. // Something went wrong. Print an error message in the dialog box.
  98. TCHAR szTextBuf[MAX_PATH];
  99. if (FLoadString(IDS_SECURITY_INVALID_CERT,
  100. szTextBuf, CCHMAX(szTextBuf)))
  101. SetDlgItemText(m_hwnd,IDC_SECURE_CALL_CERT,szTextBuf);
  102. }
  103. }
  104. }
  105.