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.

118 lines
4.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000-2001.
  5. //
  6. // File: SaferEntry.h
  7. //
  8. // Contents: Declaration of CSaferEntry
  9. //
  10. //----------------------------------------------------------------------------
  11. #if !defined(AFX_SAFERENTRY_H__CF4D8002_5484_40E9_B4F6_CC4A0030D738__INCLUDED_)
  12. #define AFX_SAFERENTRY_H__CF4D8002_5484_40E9_B4F6_CC4A0030D738__INCLUDED_
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif // _MSC_VER > 1000
  16. #include <winsafer.h>
  17. #include "cookie.h"
  18. #include "certifct.h"
  19. #include "SaferUtil.h"
  20. typedef enum {
  21. SAFER_ENTRY_TYPE_UNKNOWN = 0,
  22. SAFER_ENTRY_TYPE_HASH,
  23. SAFER_ENTRY_TYPE_PATH,
  24. SAFER_ENTRY_TYPE_URLZONE,
  25. SAFER_ENTRY_TYPE_CERT
  26. } SAFER_ENTRY_TYPE;
  27. extern const DWORD AUTHZ_UNKNOWN_LEVEL;
  28. class CSaferEntry : public CCertMgrCookie
  29. {
  30. public:
  31. CSaferEntry (
  32. SAFER_ENTRY_TYPE saferEntryType,
  33. bool bIsMachine,
  34. PCWSTR pszMachineName,
  35. PCWSTR pszObjectName,
  36. PSAFER_IDENTIFICATION_HEADER pAuthzInfo,
  37. DWORD dwLevelID,
  38. IGPEInformation* m_pGPEInformation,
  39. CCertificate* pCertificate,
  40. CSaferEntries* pSaferEntries,
  41. CRSOPObjectArray& rRSOPArray,
  42. PCWSTR pszRSOPRegistryKey = 0);
  43. virtual ~CSaferEntry();
  44. public:
  45. virtual void Refresh ();
  46. CString GetRSOPRegistryKey () const;
  47. void SetHashFriendlyName (const CString& szFriendlyName);
  48. CString GetHashFriendlyName ();
  49. void SetURLZoneID (DWORD dwURLZoneID);
  50. int CompareLastModified (const CSaferEntry& saferEntry) const;
  51. HRESULT Delete (bool bCommit);
  52. HRESULT GetCertificate (CCertificate** ppCert);
  53. CString GetDescription ();
  54. HRESULT GetFlags (DWORD& dwFlags);
  55. HRESULT GetHash (
  56. BYTE rgbFileHash[SAFER_MAX_HASH_SIZE],
  57. DWORD& cbFileHash,
  58. __int64& m_nFileSize,
  59. ALG_ID& algId) const;
  60. CString GetShortLastModified () const;
  61. CString GetLongLastModified () const;
  62. DWORD GetLevel () const;
  63. CString GetLevelFriendlyName () const;
  64. CString GetPath ();
  65. HRESULT GetSaferEntriesNode (CSaferEntries** ppSaferEntries);
  66. SAFER_ENTRY_TYPE GetType () const;
  67. CString GetTypeString () const;
  68. DWORD GetURLZoneID() const;
  69. HRESULT PolicyChanged();
  70. HRESULT Save ();
  71. HRESULT SetCertificate (CCertificate* pCert);
  72. void SetDescription(const CString& szDescription);
  73. void SetFlags (DWORD dwFlags);
  74. HRESULT SetHash (
  75. BYTE rgbFileHash[SAFER_MAX_HASH_SIZE],
  76. DWORD cbFileHash,
  77. __int64 m_nFileSize,
  78. ALG_ID hashAlgid);
  79. HRESULT SetLevel (DWORD dwLevelID);
  80. void SetPath (const CString& szPath);
  81. CString GetDisplayName () const
  82. {
  83. return m_szDisplayName;
  84. }
  85. private:
  86. CString m_szHashFriendlyName;
  87. DWORD m_dwFlags;
  88. PSAFER_IDENTIFICATION_HEADER m_pAuthzInfo;
  89. DWORD m_dwLevelID;
  90. DWORD m_dwOriginalLevelID;
  91. CString m_szLevelFriendlyName;
  92. CCertificate* m_pCertificate;
  93. CSaferEntries* m_pSaferEntries;
  94. IGPEInformation* m_pGPEInformation;
  95. const SAFER_ENTRY_TYPE m_saferEntryType;
  96. CString m_szDescription;
  97. CString m_szPath;
  98. bool m_bDeleted;
  99. BYTE m_rgbFileHash[SAFER_MAX_HASH_SIZE];
  100. DWORD m_cbFileHash;
  101. DWORD m_UrlZoneId;
  102. __int64 m_nHashFileSize;
  103. ALG_ID m_hashAlgid;
  104. CString m_szDisplayName;
  105. CString m_szRSOPRegistryKey;
  106. const bool m_bIsComputer;
  107. };
  108. #endif // !defined(AFX_SAFERENTRY_H__CF4D8002_5484_40E9_B4F6_CC4A0030D738__INCLUDED_)