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.

194 lines
5.1 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_ISSUED_CRLS = 0x8105,
  32. SERVERFUNC_ALL_FOLDERS = 0x81ff,
  33. NONE = 0xFFFF
  34. };
  35. #if DBG
  36. #define _DEBUGUUIDS
  37. #endif
  38. /////////////////////////////////////////////////////////////////////////////
  39. // Helper functions
  40. template<class TYPE>
  41. inline void SAFE_RELEASE(TYPE*& pObj)
  42. {
  43. if (pObj != NULL)
  44. {
  45. pObj->Release();
  46. pObj = NULL;
  47. }
  48. else
  49. {
  50. #ifdef _DEBUGUUIDS
  51. OutputDebugString(L"CERTMMC: Release called on NULL interface ptr\n");
  52. #endif
  53. }
  54. }
  55. extern const CLSID CLSID_Snapin; // In-Proc server GUID
  56. extern const CLSID CLSID_About;
  57. ///////////////////////////////////////////////////////////////////////////////
  58. //
  59. // OBJECT TYPES
  60. //
  61. //
  62. // OBJECT TYPE for Scope Nodes.
  63. //
  64. // Static NodeType GUID in numeric & string formats.
  65. extern const GUID cNodeTypeMachineInstance;
  66. extern const WCHAR* cszNodeTypeMachineInstance;
  67. extern const GUID cNodeTypeServerInstance;
  68. extern const WCHAR* cszNodeTypeServerInstance;
  69. extern const GUID cNodeTypeCRLPublication;
  70. extern const WCHAR* cszNodeTypeCRLPublication;
  71. // nodetype for Issued Certs
  72. extern const GUID cNodeTypeIssuedCerts;
  73. extern const WCHAR* cszNodeTypeIssuedCerts;
  74. // nodetype for Pending Certs
  75. extern const GUID cNodeTypePendingCerts;
  76. extern const WCHAR* cszNodeTypePendingCerts;
  77. // nodetype for Failed Certs
  78. extern const GUID cNodeTypeFailedCerts;
  79. extern const WCHAR* cszNodeTypeFailedCerts;
  80. // nodetype for Alien Certs
  81. extern const GUID cNodeTypeAlienCerts;
  82. extern const WCHAR* cszNodeTypeAlienCerts;
  83. // nodetype for Issued CRLs
  84. extern const GUID cNodeTypeIssuedCRLs;
  85. extern const WCHAR* cszNodeTypeIssuedCRLs;
  86. extern BOOL g_fCertViewOnly;
  87. // Dynamically created objects.
  88. extern const GUID cNodeTypeDynamic;
  89. extern const wchar_t* cszNodeTypeDynamic;
  90. //
  91. // OBJECT TYPE for result items.
  92. //
  93. // Result items object type GUID in numeric & string formats.
  94. extern const GUID cObjectTypeResultItem;
  95. extern const wchar_t* cszObjectTypeResultItem;
  96. //
  97. //
  98. //////////////////////////////////////////////////////////////////////////////
  99. extern const WCHAR* SNAPIN_INTERNAL;
  100. // Published context information for extensions to extend
  101. extern const WCHAR* SNAPIN_CA_INSTALL_TYPE;
  102. extern const WCHAR* SNAPIN_CA_COMMON_NAME;
  103. extern const WCHAR* SNAPIN_CA_MACHINE_NAME;
  104. extern const WCHAR* SNAPIN_CA_SANITIZED_NAME;
  105. extern const WCHAR* SNAPIN_CA_ROLES;
  106. struct INTERNAL
  107. {
  108. INTERNAL()
  109. {
  110. m_type = CCT_UNINITIALIZED;
  111. m_cookie = -1;
  112. ZeroMemory(&m_clsid, sizeof(CLSID));
  113. };
  114. ~INTERNAL() {}
  115. DATA_OBJECT_TYPES m_type; // What context is the data object.
  116. MMC_COOKIE m_cookie; // What object the cookie represents
  117. CString m_string; //
  118. CLSID m_clsid; // Class ID of who created this data object
  119. INTERNAL & operator=(const INTERNAL& rhs)
  120. {
  121. if (&rhs == this)
  122. return *this;
  123. // Deep copy the information
  124. m_type = rhs.m_type;
  125. m_cookie = rhs.m_cookie;
  126. m_string = rhs.m_string;
  127. memcpy(&m_clsid, &rhs.m_clsid, sizeof(CLSID));
  128. return *this;
  129. }
  130. BOOL operator==(const INTERNAL& rhs)
  131. {
  132. return rhs.m_string == m_string;
  133. }
  134. };
  135. // Debug instance counter
  136. #ifdef _DEBUGUUIDS
  137. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  138. {
  139. char buf[100];
  140. wsprintfA(buf, "%hs has %d instances left over.", pszClassName, cInstRem);
  141. ::MessageBoxA(NULL, buf, "CertMMC: Memory Leak!!!", MB_OK);
  142. }
  143. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  144. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  145. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  146. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  147. extern int s_cInst_##cls; \
  148. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  149. #else
  150. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  151. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  152. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  153. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  154. #endif