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.

188 lines
5.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. schemadynamic.h
  5. Abstract:
  6. This file contains the definition of the CDynSchema class.
  7. This class contains the dynamic schema structures.
  8. It also contains the rules for populating the schema structures.
  9. Author:
  10. Mohit Srivastava 28-Nov-00
  11. Revision History:
  12. --*/
  13. #ifndef _schemadynamic_h_
  14. #define _schemadynamic_h_
  15. #include "hashtable.h"
  16. #include "schema.h"
  17. #include "schemaextensions.h"
  18. //
  19. // Prefix added to all auto-generated classes/associations
  20. //
  21. const LPWSTR g_wszIIs_ = L"";
  22. const ULONG g_cchIIs_ = wcslen(g_wszIIs_);
  23. //
  24. // Suffix added to "Settings" classes
  25. //
  26. const WCHAR g_wszSettings[] = L"Setting";
  27. const ULONG g_cchSettings = sizeof(g_wszSettings)/sizeof(WCHAR) - 1;
  28. //
  29. // These properties are ignored when building the property list
  30. // for a class.
  31. //
  32. const DWORD g_adwPropIgnoreList[] = { MD_LOCATION, MD_KEY_TYPE, MD_IP_SEC, MD_ADMIN_ACL };
  33. const ULONG g_cElemPropIgnoreList = sizeof(g_adwPropIgnoreList) / sizeof(DWORD);
  34. class CDynSchema
  35. {
  36. public:
  37. CDynSchema() : m_bInitCalled(false),
  38. m_bInitSuccessful(false),
  39. m_bRulesRun(false),
  40. m_abKtContainers(NULL)
  41. {
  42. }
  43. ~CDynSchema()
  44. {
  45. delete [] m_abKtContainers;
  46. }
  47. CHashTable<METABASE_PROPERTY *> *GetHashProps()
  48. {
  49. return &m_hashProps;
  50. }
  51. CHashTable<WMI_CLASS *> *GetHashClasses()
  52. {
  53. return &m_hashClasses;
  54. }
  55. CHashTable<WMI_ASSOCIATION *> *GetHashAssociations()
  56. {
  57. return &m_hashAssociations;
  58. }
  59. CHashTable<METABASE_KEYTYPE *> *GetHashKeyTypes()
  60. {
  61. return &m_hashKeyTypes;
  62. }
  63. HRESULT Initialize();
  64. HRESULT RunRules(CSchemaExtensions* catalog, bool biUseExtensions = true);
  65. bool IsContainedUnder(METABASE_KEYTYPE* i_pktParent, METABASE_KEYTYPE* i_pktChild);
  66. void ToConsole();
  67. private:
  68. void LogConflicts(LPCWSTR wszSettingsClassName);
  69. HRESULT RulePopulateFromStatic();
  70. HRESULT Rule2PopulateFromStatic();
  71. HRESULT RulePopulateFromDynamic(
  72. CSchemaExtensions* i_pCatalog,
  73. BOOL i_bUserDefined);
  74. //
  75. // KeyType stuff
  76. //
  77. HRESULT RuleKeyType(
  78. const CTableMeta *i_pTableMeta);
  79. HRESULT RuleWmiClassInverseCCL(
  80. const METABASE_KEYTYPE* pktGroup,
  81. METABASE_KEYTYPE* pktPart);
  82. HRESULT ConstructFlatInverseContainerList();
  83. void ConstructFlatInverseContainerListHelper(
  84. const METABASE_KEYTYPE* i_pkt,
  85. bool* io_abList);
  86. //
  87. // Wmi Class
  88. //
  89. HRESULT RuleWmiClass(
  90. const CTableMeta* i_pTableMeta,
  91. WMI_CLASS** o_ppElementClass,
  92. WMI_CLASS** o_ppSettingClass,
  93. DWORD io_adwIgnoredProps[],
  94. BOOL i_bUserDefined);
  95. HRESULT RuleProperties(
  96. const CTableMeta* i_pTableMeta,
  97. ULONG i_cPropsAndTagsRO,
  98. WMI_CLASS* io_pWmiClass,
  99. ULONG i_cPropsAndTagsRW,
  100. WMI_CLASS* io_pWmiSettingsClass,
  101. DWORD io_adwIgnoredProps[]);
  102. HRESULT RulePropertiesHelper(
  103. const CColumnMeta* i_pColumnMeta,
  104. METABASE_PROPERTY** o_ppMbp,
  105. ULONG* i_idxTag);
  106. HRESULT RuleWmiClassDescription(
  107. const CTableMeta* i_pTableMeta,
  108. WMI_CLASS* i_pElementClass,
  109. WMI_CLASS* i_pSettingClass) const;
  110. void RuleWmiClassServices(
  111. WMI_CLASS* i_pElement,
  112. WMI_CLASS* i_pSetting);
  113. //
  114. // Associations
  115. //
  116. HRESULT RuleGroupPartAssociations(
  117. const CTableMeta *i_pTableMeta);
  118. HRESULT RuleGenericAssociations(
  119. WMI_CLASS* i_pcElement,
  120. WMI_CLASS* i_pcSetting,
  121. WMI_ASSOCIATION_TYPE* i_pAssocType,
  122. ULONG i_iShipped);
  123. HRESULT RuleSpecialAssociations(
  124. DWORD i_adwIgnoredProps[],
  125. WMI_CLASS* i_pElement);
  126. #if 0
  127. bool IgnoreProperty(LPCWSTR i_wszProp);
  128. #endif
  129. bool IgnoreProperty(
  130. METABASE_KEYTYPE* io_pkt,
  131. DWORD i_dwPropId,
  132. DWORD io_adwIgnored[]);
  133. CHashTable<METABASE_PROPERTY *> m_hashProps;
  134. CPool<METABASE_PROPERTY> m_poolProps;
  135. CHashTable<WMI_CLASS *> m_hashClasses;
  136. CPool<WMI_CLASS> m_poolClasses;
  137. CHashTable<WMI_ASSOCIATION *> m_hashAssociations;
  138. CPool<WMI_ASSOCIATION> m_poolAssociations;
  139. CHashTable<METABASE_KEYTYPE *> m_hashKeyTypes;
  140. CPool<METABASE_KEYTYPE> m_poolKeyTypes;
  141. bool* m_abKtContainers;
  142. CStringPool m_spoolStrings;
  143. CArrayPool<METABASE_PROPERTY*, 10> m_apoolPMbp;
  144. CArrayPool<BYTE, 10> m_apoolBytes;
  145. CPool<METABASE_KEYTYPE_NODE> m_poolKeyTypeNodes;
  146. bool m_bInitCalled;
  147. bool m_bInitSuccessful;
  148. bool m_bRulesRun;
  149. };
  150. #endif // _schemadynamic_h_