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.

108 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: Cookie.cpp
  7. //
  8. // Contents: Implementation of CCertTmplCookie and related classes
  9. //
  10. //----------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "cookie.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. #pragma warning(push,3)
  19. #pragma warning (disable : 4702)
  20. #include "atlimpl.cpp"
  21. #pragma warning (default : 4702)
  22. #pragma warning(pop)
  23. #include "stdcooki.cpp"
  24. #include "stdutils.cpp"
  25. //
  26. // CCertTmplCookie
  27. //
  28. // returns <0, 0 or >0
  29. CCertTmplCookie::CCertTmplCookie (CertTmplObjectType objecttype,
  30. PCWSTR objectName)
  31. : m_objecttype (objecttype),
  32. m_objectName (objectName),
  33. m_resultDataID (0)
  34. {
  35. _ASSERT (IsValidObjectType (m_objecttype));
  36. if ( m_objectName.IsEmpty () )
  37. {
  38. AFX_MANAGE_STATE (AfxGetStaticModuleState ());
  39. VERIFY (m_objectName.LoadString (IDS_CERTTMPL));
  40. }
  41. }
  42. CCertTmplCookie::~CCertTmplCookie ()
  43. {
  44. }
  45. HRESULT CCertTmplCookie::CompareSimilarCookies( CCookie* pOtherCookie, int* pnResult )
  46. {
  47. _ASSERT (pOtherCookie);
  48. CCertTmplCookie* pcookie = dynamic_cast <CCertTmplCookie*>(pOtherCookie);
  49. _ASSERT (pcookie);
  50. if ( pcookie && m_objecttype != pcookie->m_objecttype )
  51. {
  52. *pnResult = ((int)m_objecttype) - ((int)pcookie->m_objecttype); // arbitrary ordering
  53. return S_OK;
  54. }
  55. return E_UNEXPECTED;
  56. }
  57. CCookie* CCertTmplCookie::QueryBaseCookie(int i)
  58. {
  59. _ASSERT(!i);
  60. return (CCookie*)this;
  61. }
  62. int CCertTmplCookie::QueryNumCookies()
  63. {
  64. return 1;
  65. }
  66. PCWSTR CCertTmplCookie::GetObjectName() const
  67. {
  68. return m_objectName;
  69. }
  70. HRESULT CCertTmplCookie::Commit()
  71. {
  72. return S_OK;
  73. }
  74. CString CCertTmplCookie::GetManagedDomainDNSName() const
  75. {
  76. return m_szManagedDomainDNSName;
  77. }
  78. void CCertTmplCookie::SetManagedDomainDNSName(const CString &szManagedDomainDNSName)
  79. {
  80. m_szManagedDomainDNSName = szManagedDomainDNSName;
  81. }
  82. void CCertTmplCookie::SetObjectName(const CString& strObjectName)
  83. {
  84. m_objectName = strObjectName;
  85. }