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.

186 lines
4.8 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. HRESULT RulePopulateFromStatic();
  69. HRESULT Rule2PopulateFromStatic();
  70. HRESULT RulePopulateFromDynamic(
  71. CSchemaExtensions* i_pCatalog,
  72. BOOL i_bUserDefined);
  73. //
  74. // KeyType stuff
  75. //
  76. HRESULT RuleKeyType(
  77. const CTableMeta *i_pTableMeta);
  78. HRESULT RuleWmiClassInverseCCL(
  79. const METABASE_KEYTYPE* pktGroup,
  80. METABASE_KEYTYPE* pktPart);
  81. HRESULT ConstructFlatInverseContainerList();
  82. void ConstructFlatInverseContainerListHelper(
  83. const METABASE_KEYTYPE* i_pkt,
  84. bool* io_abList);
  85. //
  86. // Wmi Class
  87. //
  88. HRESULT RuleWmiClass(
  89. const CTableMeta* i_pTableMeta,
  90. WMI_CLASS** o_ppElementClass,
  91. WMI_CLASS** o_ppSettingClass,
  92. DWORD io_adwIgnoredProps[]);
  93. HRESULT RuleProperties(
  94. const CTableMeta* i_pTableMeta,
  95. ULONG i_cPropsAndTagsRO,
  96. WMI_CLASS* io_pWmiClass,
  97. ULONG i_cPropsAndTagsRW,
  98. WMI_CLASS* io_pWmiSettingsClass,
  99. DWORD io_adwIgnoredProps[]);
  100. HRESULT RulePropertiesHelper(
  101. const CColumnMeta* i_pColumnMeta,
  102. METABASE_PROPERTY** o_ppMbp,
  103. ULONG* i_idxTag);
  104. HRESULT RuleWmiClassDescription(
  105. const CTableMeta* i_pTableMeta,
  106. WMI_CLASS* i_pElementClass,
  107. WMI_CLASS* i_pSettingClass) const;
  108. void RuleWmiClassServices(
  109. WMI_CLASS* i_pElement,
  110. WMI_CLASS* i_pSetting);
  111. //
  112. // Associations
  113. //
  114. HRESULT RuleGroupPartAssociations(
  115. const CTableMeta *i_pTableMeta);
  116. HRESULT RuleGenericAssociations(
  117. WMI_CLASS* i_pcElement,
  118. WMI_CLASS* i_pcSetting,
  119. WMI_ASSOCIATION_TYPE* i_pAssocType,
  120. ULONG i_iShipped);
  121. HRESULT RuleSpecialAssociations(
  122. DWORD i_adwIgnoredProps[],
  123. WMI_CLASS* i_pElement);
  124. #if 0
  125. bool IgnoreProperty(LPCWSTR i_wszProp);
  126. #endif
  127. bool IgnoreProperty(
  128. METABASE_KEYTYPE* io_pkt,
  129. DWORD i_dwPropId,
  130. DWORD io_adwIgnored[]);
  131. CHashTable<METABASE_PROPERTY *> m_hashProps;
  132. CPool<METABASE_PROPERTY> m_poolProps;
  133. CHashTable<WMI_CLASS *> m_hashClasses;
  134. CPool<WMI_CLASS> m_poolClasses;
  135. CHashTable<WMI_ASSOCIATION *> m_hashAssociations;
  136. CPool<WMI_ASSOCIATION> m_poolAssociations;
  137. CHashTable<METABASE_KEYTYPE *> m_hashKeyTypes;
  138. CPool<METABASE_KEYTYPE> m_poolKeyTypes;
  139. bool* m_abKtContainers;
  140. CStringPool m_spoolStrings;
  141. CArrayPool<METABASE_PROPERTY*, 10> m_apoolPMbp;
  142. CArrayPool<BYTE, 10> m_apoolBytes;
  143. CPool<METABASE_KEYTYPE_NODE> m_poolKeyTypeNodes;
  144. bool m_bInitCalled;
  145. bool m_bInitSuccessful;
  146. bool m_bRulesRun;
  147. };
  148. #endif // _schemadynamic_h_