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.

190 lines
4.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: uuids.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef __UUIDS_H_
  11. #define __UUIDS_H_
  12. const long UNINITIALIZED = -1;
  13. // Constants used in samples
  14. const int MAX_ITEM_NAME = 64;
  15. enum SCOPE_TYPES
  16. {
  17. UNINITIALIZED_ITEM = 0,
  18. SCOPE_LEVEL_ITEM = 111,
  19. RESULT_ITEM = 222,
  20. //CA_LEVEL_ITEM = 333,
  21. };
  22. // Sample folder types
  23. enum FOLDER_TYPES
  24. {
  25. STATIC = 0x8000,
  26. // policy settings node
  27. POLICYSETTINGS = 0x8007,
  28. // cert types manager node
  29. SCE_EXTENSION = 0x8100,
  30. // cert types displayed in results pane for policy settings node
  31. CA_CERT_TYPE = 0x8107,
  32. // cert types displayed in results pane for cert types manager node
  33. GLOBAL_CERT_TYPE = 0x8110,
  34. NONE = 0xFFFF
  35. };
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Helper functions
  38. template<class TYPE>
  39. inline void SAFE_RELEASE(TYPE*& pObj)
  40. {
  41. if (pObj != NULL)
  42. {
  43. pObj->Release();
  44. pObj = NULL;
  45. }
  46. else
  47. {
  48. #ifdef _DEBUG
  49. OutputDebugString(L"CAPESNPN: Release called on NULL interface ptr\n");
  50. #endif
  51. }
  52. }
  53. extern const CLSID CLSID_CAPolicyExtensionSnapIn;
  54. extern const CLSID CLSID_CACertificateTemplateManager;
  55. extern const CLSID CLSID_CertTypeAbout;
  56. extern const CLSID CLSID_CAPolicyAbout;
  57. extern const CLSID CLSID_CertTypeShellExt;
  58. extern const CLSID CLSID_CAShellExt;
  59. ///////////////////////////////////////////////////////////////////////////////
  60. //
  61. // OBJECT TYPES
  62. //
  63. //
  64. // OBJECT TYPE for Scope Nodes.
  65. //
  66. // Static NodeType GUID in numeric & string formats.
  67. extern const GUID cNodeTypePolicySettings;
  68. extern const WCHAR* cszNodeTypePolicySettings;
  69. extern const GUID cNodeTypeCertificateTemplate;
  70. extern const WCHAR* cszNodeTypeCertificateTemplate;
  71. //
  72. // OBJECT TYPE for result items.
  73. //
  74. // Result items object type GUID in numeric & string formats.
  75. extern const GUID cObjectTypeResultItem;
  76. extern const wchar_t* cszObjectTypeResultItem;
  77. // CA Manager snapin parent node
  78. extern const CLSID cCAManagerParentNodeID;
  79. extern const WCHAR* cszCAManagerParentNodeID;
  80. // CA Manager snapin parent node
  81. extern const CLSID cSCEParentNodeIDUSER;
  82. extern const WCHAR* cszSCEParentNodeIDUSER;
  83. extern const CLSID cSCEParentNodeIDCOMPUTER;
  84. extern const WCHAR* cszSCEParentNodeIDCOMPUTER;
  85. //
  86. //
  87. //////////////////////////////////////////////////////////////////////////////
  88. // New Clipboard format that has the Type and Cookie
  89. extern const wchar_t* SNAPIN_INTERNAL;
  90. // Published context information for extensions to extend
  91. extern const wchar_t* SNAPIN_WORKSTATION;
  92. // format for getting CA name from parent node
  93. extern const wchar_t* CA_COMMON_NAME;
  94. // format for getting CA name from parent node
  95. extern const wchar_t* CA_SANITIZED_NAME;
  96. extern const wchar_t* SNAPIN_CA_INSTALL_TYPE;
  97. // Clipboard format for SCE's mode DWORD
  98. extern const wchar_t* CCF_SCE_MODE_TYPE;
  99. // Clipboard format for GPT's IUnknown interface
  100. extern const wchar_t* CCF_SCE_GPT_UNKNOWN;
  101. struct INTERNAL
  102. {
  103. INTERNAL()
  104. {
  105. m_type = CCT_UNINITIALIZED;
  106. m_cookie = -1;
  107. ZeroMemory(&m_clsid, sizeof(CLSID));
  108. };
  109. ~INTERNAL() {}
  110. DATA_OBJECT_TYPES m_type; // What context is the data object.
  111. MMC_COOKIE m_cookie; // What object the cookie represents
  112. CString m_string; //
  113. CLSID m_clsid; // Class ID of who created this data object
  114. INTERNAL & operator=(const INTERNAL& rhs)
  115. {
  116. if (&rhs == this)
  117. return *this;
  118. // Deep copy the information
  119. m_type = rhs.m_type;
  120. m_cookie = rhs.m_cookie;
  121. m_string = rhs.m_string;
  122. memcpy(&m_clsid, &rhs.m_clsid, sizeof(CLSID));
  123. return *this;
  124. }
  125. BOOL operator==(const INTERNAL& rhs)
  126. {
  127. return rhs.m_string == m_string;
  128. }
  129. };
  130. // Debug instance counter
  131. #ifdef _DEBUG
  132. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  133. {
  134. char buf[100];
  135. wsprintfA(buf, "%s has %d instances left over.", pszClassName, cInstRem);
  136. ::MessageBoxA(NULL, buf, "CAPESNPN: Memory Leak!!!", MB_OK);
  137. }
  138. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  139. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  140. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  141. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  142. extern int s_cInst_##cls; \
  143. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  144. #else
  145. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  146. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  147. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  148. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  149. #endif
  150. #endif //__UUIDS_H_