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.

183 lines
4.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: uuids.h
  8. //
  9. //--------------------------------------------------------------------------
  10. const LONG UNINITIALIZED = -1;
  11. enum SCOPE_TYPES
  12. {
  13. UNINITIALIZED_ITEM = 0,
  14. SCOPE_LEVEL_ITEM = 111,
  15. RESULT_ITEM = 222,
  16. CA_LEVEL_ITEM = 333,
  17. };
  18. // Sample folder types
  19. enum FOLDER_TYPES
  20. {
  21. // certsvr machine node
  22. MACHINE_INSTANCE = 0x8000,
  23. // certsvr root node
  24. SERVER_INSTANCE = 0x8007,
  25. // server instance sub-folders
  26. SERVERFUNC_CRL_PUBLICATION = 0x8100,
  27. SERVERFUNC_ISSUED_CERTIFICATES = 0x8101,
  28. SERVERFUNC_PENDING_CERTIFICATES = 0x8102,
  29. SERVERFUNC_FAILED_CERTIFICATES = 0x8103,
  30. SERVERFUNC_ALIEN_CERTIFICATES = 0x8104,
  31. SERVERFUNC_ALL_FOLDERS = 0x81ff,
  32. NONE = 0xFFFF
  33. };
  34. /////////////////////////////////////////////////////////////////////////////
  35. // Helper functions
  36. template<class TYPE>
  37. inline void SAFE_RELEASE(TYPE*& pObj)
  38. {
  39. if (pObj != NULL)
  40. {
  41. pObj->Release();
  42. pObj = NULL;
  43. }
  44. else
  45. {
  46. #ifdef _DEBUG
  47. OutputDebugString(L"CERTMMC: Release called on NULL interface ptr\n");
  48. #endif
  49. }
  50. }
  51. extern const CLSID CLSID_Snapin; // In-Proc server GUID
  52. extern const CLSID CLSID_About;
  53. ///////////////////////////////////////////////////////////////////////////////
  54. //
  55. // OBJECT TYPES
  56. //
  57. //
  58. // OBJECT TYPE for Scope Nodes.
  59. //
  60. // Static NodeType GUID in numeric & string formats.
  61. extern const GUID cNodeTypeMachineInstance;
  62. extern const WCHAR* cszNodeTypeMachineInstance;
  63. extern const GUID cNodeTypeServerInstance;
  64. extern const WCHAR* cszNodeTypeServerInstance;
  65. extern const GUID cNodeTypeCRLPublication;
  66. extern const WCHAR* cszNodeTypeCRLPublication;
  67. // nodetype for Issued Certs
  68. extern const GUID cNodeTypeIssuedCerts;
  69. extern const WCHAR* cszNodeTypeIssuedCerts;
  70. // nodetype for Pending Certs
  71. extern const GUID cNodeTypePendingCerts;
  72. extern const WCHAR* cszNodeTypePendingCerts;
  73. // nodetype for Failed Certs
  74. extern const GUID cNodeTypeFailedCerts;
  75. extern const WCHAR* cszNodeTypeFailedCerts;
  76. // nodetype for Alien Certs
  77. extern const GUID cNodeTypeAlienCerts;
  78. extern const WCHAR* cszNodeTypeAlienCerts;
  79. // Dynamically created objects.
  80. extern const GUID cNodeTypeDynamic;
  81. extern const wchar_t* cszNodeTypeDynamic;
  82. //
  83. // OBJECT TYPE for result items.
  84. //
  85. // Result items object type GUID in numeric & string formats.
  86. extern const GUID cObjectTypeResultItem;
  87. extern const wchar_t* cszObjectTypeResultItem;
  88. //
  89. //
  90. //////////////////////////////////////////////////////////////////////////////
  91. extern const WCHAR* SNAPIN_INTERNAL;
  92. // Published context information for extensions to extend
  93. extern const WCHAR* SNAPIN_CA_INSTALL_TYPE;
  94. extern const WCHAR* SNAPIN_CA_COMMON_NAME;
  95. extern const WCHAR* SNAPIN_CA_MACHINE_NAME;
  96. extern const WCHAR* SNAPIN_CA_SANITIZED_NAME;
  97. struct INTERNAL
  98. {
  99. INTERNAL()
  100. {
  101. m_type = CCT_UNINITIALIZED;
  102. m_cookie = -1;
  103. ZeroMemory(&m_clsid, sizeof(CLSID));
  104. };
  105. ~INTERNAL() {}
  106. DATA_OBJECT_TYPES m_type; // What context is the data object.
  107. MMC_COOKIE m_cookie; // What object the cookie represents
  108. CString m_string; //
  109. CLSID m_clsid; // Class ID of who created this data object
  110. INTERNAL & operator=(const INTERNAL& rhs)
  111. {
  112. if (&rhs == this)
  113. return *this;
  114. // Deep copy the information
  115. m_type = rhs.m_type;
  116. m_cookie = rhs.m_cookie;
  117. m_string = rhs.m_string;
  118. memcpy(&m_clsid, &rhs.m_clsid, sizeof(CLSID));
  119. return *this;
  120. }
  121. BOOL operator==(const INTERNAL& rhs)
  122. {
  123. return rhs.m_string == m_string;
  124. }
  125. };
  126. // Debug instance counter
  127. #ifdef _DEBUG
  128. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  129. {
  130. char buf[100];
  131. wsprintfA(buf, "%s has %d instances left over.", pszClassName, cInstRem);
  132. ::MessageBoxA(NULL, buf, "CertMMC: Memory Leak!!!", MB_OK);
  133. }
  134. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  135. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  136. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  137. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  138. extern int s_cInst_##cls; \
  139. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  140. #else
  141. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  142. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  143. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  144. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  145. #endif