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.

193 lines
5.1 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. extern const wchar_t* CA_ROLES;
  98. // Clipboard format for SCE's mode DWORD
  99. extern const wchar_t* CCF_SCE_MODE_TYPE;
  100. // Clipboard format for GPT's IUnknown interface
  101. extern const wchar_t* CCF_SCE_GPT_UNKNOWN;
  102. struct INTERNAL
  103. {
  104. INTERNAL()
  105. {
  106. m_type = CCT_UNINITIALIZED;
  107. m_cookie = -1;
  108. ZeroMemory(&m_clsid, sizeof(CLSID));
  109. };
  110. ~INTERNAL() {}
  111. DATA_OBJECT_TYPES m_type; // What context is the data object.
  112. MMC_COOKIE m_cookie; // What object the cookie represents
  113. CString m_string; //
  114. CLSID m_clsid; // Class ID of who created this data object
  115. INTERNAL & operator=(const INTERNAL& rhs)
  116. {
  117. if (&rhs == this)
  118. return *this;
  119. // Deep copy the information
  120. m_type = rhs.m_type;
  121. m_cookie = rhs.m_cookie;
  122. m_string = rhs.m_string;
  123. memcpy(&m_clsid, &rhs.m_clsid, sizeof(CLSID));
  124. return *this;
  125. }
  126. BOOL operator==(const INTERNAL& rhs)
  127. {
  128. return rhs.m_string == m_string;
  129. }
  130. };
  131. // Debug instance counter
  132. #ifdef _DEBUG
  133. inline void DbgInstanceRemaining(char * pszClassName, int cInstRem)
  134. {
  135. char buf[100];
  136. wsprintfA(buf, "%hs has %d instances left over.", pszClassName, cInstRem);
  137. ::MessageBoxA(NULL, buf, "CAPESNPN: Memory Leak!!!", MB_OK);
  138. }
  139. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls) extern int s_cInst_##cls = 0;
  140. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls) ++(s_cInst_##cls);
  141. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls) --(s_cInst_##cls);
  142. #define DEBUG_VERIFY_INSTANCE_COUNT(cls) \
  143. extern int s_cInst_##cls; \
  144. if (s_cInst_##cls) DbgInstanceRemaining(#cls, s_cInst_##cls);
  145. #else
  146. #define DEBUG_DECLARE_INSTANCE_COUNTER(cls)
  147. #define DEBUG_INCREMENT_INSTANCE_COUNTER(cls)
  148. #define DEBUG_DECREMENT_INSTANCE_COUNTER(cls)
  149. #define DEBUG_VERIFY_INSTANCE_COUNT(cls)
  150. #endif
  151. #endif //__UUIDS_H_