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.

145 lines
4.6 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2002.
  5. //
  6. // File: cmutils.h
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __CMUTILS_H
  12. #define __CMUTILS_H
  13. #include "cookie.h"
  14. typedef CArray<CCertMgrCookie*, CCertMgrCookie*> CCookiePtrArray;
  15. // Get subject or issuer name from a certificate context
  16. CString GetNameString (PCCERT_CONTEXT pCertContext, DWORD dwFlag);
  17. // Convert win32 error code to a text message and display
  18. void DisplaySystemError (HWND hParent, DWORD dwErr);
  19. CString GetSystemMessage (DWORD dwErr);
  20. // Convert an OID to a displayable name
  21. bool MyGetOIDInfo (CString & string, LPCSTR pszObjId);
  22. // The certificate has File Encryption key usage
  23. bool CertHasEFSKeyUsage (PCCERT_CONTEXT pCertContext);
  24. HRESULT FormatDate (
  25. FILETIME utcDateTime,
  26. CString & pszDateTime,
  27. DWORD dwDateFlags = 0,
  28. bool bGetTime = false);
  29. HRESULT ConvertNameBlobToString(CERT_NAME_BLOB nameBlob, CString & pszName);
  30. bool IsWindowsNT ();
  31. LRESULT RegDelnode (HKEY hKeyRoot, CString pszSubKey);
  32. HRESULT DisplayCertificateCountByStore (LPCONSOLE pConsole, CCertStore* pCertStore, bool bIsGPE = false);
  33. // Help File for F1 and ? help
  34. CString GetF1HelpFilename();
  35. #ifndef szOID_EFS_RECOVERY
  36. #define szOID_EFS_RECOVERY "1.3.6.1.4.1.311.10.3.4.1"
  37. #endif
  38. #define IID_PPV_ARG(Type, Expr) IID_##Type, \
  39. reinterpret_cast<void**>(static_cast<Type **>(Expr))
  40. extern LPCWSTR CM_HELP_TOPIC;
  41. extern LPCWSTR CM_HELP_FILE;
  42. extern LPCWSTR CM_LINKED_HELP_FILE;
  43. extern LPCWSTR PKP_LINKED_HELP_FILE;
  44. extern LPCWSTR PKP_HELP_FILE;
  45. extern LPCWSTR PKP_HELP_TOPIC;
  46. extern LPCWSTR SAFER_WINDOWS_HELP_FILE;
  47. extern LPCWSTR SAFER_WINDOWS_LINKED_HELP_FILE;
  48. extern LPCWSTR SAFER_HELP_TOPIC;
  49. extern LPCWSTR CM_CONTEXT_HELP;
  50. extern LPCWSTR WINDOWS_HELP;
  51. extern LPCWSTR EFS_LINKED_HELP_FILE;
  52. extern LPCWSTR EFS_HELP_TOPIC;
  53. HRESULT RenewCertificate (
  54. CCertificate* pCert,
  55. bool bNewKey,
  56. const CString& machineName,
  57. DWORD dwLocation,
  58. const CString& managedComputer,
  59. const CString& managedService,
  60. HWND hwndParent,
  61. LPCONSOLE pConsole,
  62. LPDATAOBJECT pDataObject);
  63. int LocaleStrCmp(PCWSTR ptsz1, PCWSTR ptsz2); // calls CompareString () API.
  64. #define STR_BLOBCOUNT L"BlobCount"
  65. #define STR_BLOB L"Blob"
  66. #define STR_BLOB0 L"Blob0"
  67. #define STR_BLOBLENGTH L"BlobLength"
  68. #define STR_WQL L"WQL"
  69. #define STR_SELECT_STATEMENT L"SELECT * FROM RSOP_RegistryPolicySetting"
  70. #define STR_PROP_VALUENAME L"valueName"
  71. #define STR_PROP_REGISTRYKEY L"registryKey"
  72. #define STR_PROP_VALUE L"value"
  73. #define STR_PROP_PRECEDENCE L"precedence"
  74. #define STR_PROP_GPOID L"GPOID"
  75. #define STR_REGKEY_CERTIFICATES L"\\Certificates"
  76. #define STR_REGKEY_CTLS L"\\CTLs"
  77. #define STR_REGKEY_CRLS L"\\CRLs"
  78. #define DEBUGKEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AdminDebug\\CertMgr"
  79. #define SAFER_CODEID_KEY \
  80. SAFER_HKLM_REGBASE L"\\" SAFER_CODEIDS_REGSUBKEY
  81. // Registry path to the trusted publisher store
  82. #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_TRUSTED_PUBLISHER_STORE_REGPATH \
  83. CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\TrustedPublisher"
  84. // Registry path to the disallowed store
  85. #define CERT_TRUST_PUB_SAFER_GROUP_POLICY_DISALLOWED_STORE_REGPATH \
  86. CERT_GROUP_POLICY_SYSTEM_STORE_REGPATH L"\\Disallowed"
  87. // Registry path to the EFS settings
  88. #define EFS_SETTINGS_REGPATH L"Software\\Policies\\Microsoft\\Windows NT\\CurrentVersion\\EFS"
  89. // Registry value for EFS settings
  90. #define EFS_SETTINGS_REGVALUE L"EfsConfiguration"
  91. // Enabling themes
  92. #ifdef UNICODE
  93. #define PROPSHEETPAGE_V3 PROPSHEETPAGEW_V3
  94. #else
  95. #define PROPSHEETPAGE_V3 PROPSHEETPAGEA_V3
  96. #endif
  97. HPROPSHEETPAGE MyCreatePropertySheetPage(AFX_OLDPROPSHEETPAGE* psp);
  98. class CThemeContextActivator
  99. {
  100. public:
  101. CThemeContextActivator() : m_ulActivationCookie(0)
  102. { SHActivateContext (&m_ulActivationCookie); }
  103. ~CThemeContextActivator()
  104. { SHDeactivateContext (m_ulActivationCookie); }
  105. private:
  106. ULONG_PTR m_ulActivationCookie;
  107. };
  108. void CheckDomainVersion ();
  109. VOID DataToHex (PBYTE pSrc, CString & dest, int cb, bool bIncludeSpaces = true);
  110. typedef CTypedPtrList<CPtrList, CERT_CONTEXT*> CERT_CONTEXT_LIST;
  111. BOOL GetCertificateChain (CERT_CONTEXT* pCertContext, CERT_CONTEXT_LIST& certChainList);
  112. #endif