Source code of Windows XP (NT5)
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.

109 lines
2.3 KiB

  1. // SecTransTestDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Driver.h"
  5. #import "\bin\McsVarSetMin.tlb" no_namespace, named_guids
  6. #import "\bin\McsDctWorkerObjects.tlb" no_namespace, named_guids
  7. #include "SecTrans.h"
  8. #include "VSEdit.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CSecTransTestDlg property page
  16. IMPLEMENT_DYNCREATE(CSecTransTestDlg, CPropertyPage)
  17. CSecTransTestDlg::CSecTransTestDlg() : CPropertyPage(CSecTransTestDlg::IDD)
  18. {
  19. //{{AFX_DATA_INIT(CSecTransTestDlg)
  20. // NOTE: the ClassWizard will add member initialization here
  21. //}}AFX_DATA_INIT
  22. }
  23. CSecTransTestDlg::~CSecTransTestDlg()
  24. {
  25. }
  26. void CSecTransTestDlg::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CPropertyPage::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(CSecTransTestDlg)
  30. // NOTE: the ClassWizard will add DDX and DDV calls here
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(CSecTransTestDlg, CPropertyPage)
  34. //{{AFX_MSG_MAP(CSecTransTestDlg)
  35. ON_BN_CLICKED(IDC_EDIT_VARSET, OnEditVarset)
  36. ON_BN_CLICKED(IDC_PROCESS, OnProcess)
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CSecTransTestDlg message handlers
  41. void CSecTransTestDlg::OnEditVarset()
  42. {
  43. CVarSetEditDlg vedit;
  44. vedit.SetVarSet(pVarSet);
  45. vedit.DoModal();
  46. pVarSet = vedit.GetVarSet();
  47. }
  48. void CSecTransTestDlg::OnProcess()
  49. {
  50. UpdateData(TRUE);
  51. CWaitCursor w;
  52. if ( pVarSet == NULL )
  53. {
  54. OnEditVarset();
  55. }
  56. if ( pVarSet != NULL )
  57. {
  58. IUnknown * pUnk = NULL;
  59. pVarSet.QueryInterface(IID_IUnknown,&pUnk);
  60. HRESULT hr = pST->raw_Process(pUnk);
  61. if (SUCCEEDED(hr) )
  62. {
  63. MessageBox(L"SecTrans::Process succeeded!");
  64. }
  65. else
  66. {
  67. CString str;
  68. str.Format(L"SecTrans::Process failed, hr=%lx",hr);
  69. MessageBox(str);
  70. }
  71. pUnk->Release();
  72. }
  73. else
  74. {
  75. MessageBox(L"The varset pointer is NULL.");
  76. }
  77. }
  78. BOOL CSecTransTestDlg::OnSetActive()
  79. {
  80. HRESULT hr = pST.CreateInstance(CLSID_SecTranslator);
  81. if ( FAILED(hr) )
  82. {
  83. CString msg;
  84. msg.Format(L"Failed to create Security Translator, CoCreateInstance returned %lx",hr);
  85. MessageBox(msg);
  86. }
  87. return CPropertyPage::OnSetActive();
  88. }