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.

174 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. schemaextensions.h
  5. Abstract:
  6. This file contains the definition of the CSchemaExtensions class.
  7. This is the only class that talks to the catalog.
  8. Author:
  9. MarcelV
  10. Revision History:
  11. Mohit Srivastava 28-Nov-00
  12. --*/
  13. #ifndef _schemaextensions_h_
  14. #define _schemaextensions_h_
  15. #include "catalog.h"
  16. #include "catmeta.h"
  17. #include <atlbase.h>
  18. //forward decl
  19. struct CTableMeta;
  20. struct CColumnMeta
  21. {
  22. CColumnMeta() {paTags = 0; cbDefaultValue = 0; cNrTags = 0;}
  23. ~CColumnMeta() {delete [] paTags;}
  24. tCOLUMNMETARow ColumnMeta;
  25. ULONG cbDefaultValue;
  26. ULONG cNrTags;
  27. tTAGMETARow **paTags;
  28. };
  29. struct CTableMeta
  30. {
  31. CTableMeta () {paColumns=0;}
  32. ~CTableMeta () {delete []paColumns;}
  33. ULONG ColCount () const
  34. {
  35. return *(TableMeta.pCountOfColumns);
  36. }
  37. tTABLEMETARow TableMeta;
  38. CColumnMeta **paColumns;
  39. };
  40. typedef tTAGMETARow * LPtTAGMETA;
  41. typedef CColumnMeta * LPCColumnMeta;
  42. /********************************************************************++
  43. Class Name:
  44. NULL_Logger
  45. Class Description:
  46. We don't want any IST errors logged to the event log or the text
  47. log. We are only reading the schema bin file. Any errors we see
  48. will probably be redundant with those in IIS anyways.
  49. Constraints
  50. --********************************************************************/
  51. class NULL_Logger : public ICatalogErrorLogger2
  52. {
  53. public:
  54. NULL_Logger() : m_cRef(0){}
  55. virtual ~NULL_Logger(){}
  56. //IUnknown
  57. STDMETHOD (QueryInterface) (REFIID riid, OUT void **ppv)
  58. {
  59. if (NULL == ppv)
  60. return E_INVALIDARG;
  61. *ppv = NULL;
  62. if (riid == IID_ICatalogErrorLogger2)
  63. *ppv = (ICatalogErrorLogger2*) this;
  64. else if (riid == IID_IUnknown)
  65. *ppv = (ICatalogErrorLogger2*) this;
  66. if (NULL == *ppv)
  67. return E_NOINTERFACE;
  68. ((ICatalogErrorLogger2*)this)->AddRef ();
  69. return S_OK;
  70. }
  71. STDMETHOD_(ULONG,AddRef) ()
  72. {
  73. return InterlockedIncrement((LONG*) &m_cRef);
  74. }
  75. STDMETHOD_(ULONG,Release) ()
  76. {
  77. long cref = InterlockedDecrement((LONG*) &m_cRef);
  78. if (cref == 0)
  79. delete this;
  80. return cref;
  81. }
  82. //ICatalogErrorLogger2
  83. STDMETHOD(ReportError) (ULONG i_BaseVersion_DETAILEDERRORS,
  84. ULONG i_ExtendedVersion_DETAILEDERRORS,
  85. ULONG i_cDETAILEDERRORS_NumberOfColumns,
  86. ULONG * i_acbSizes,
  87. LPVOID * i_apvValues){return S_OK;}
  88. private:
  89. ULONG m_cRef;
  90. };
  91. class CSchemaExtensions
  92. {
  93. public:
  94. CSchemaExtensions ();
  95. ~CSchemaExtensions ();
  96. HRESULT Initialize (bool i_bUseExtensions = true);
  97. CTableMeta* EnumTables(ULONG *io_idx);
  98. HRESULT GetMbSchemaTimeStamp(FILETIME* io_pFileTime) const;
  99. private:
  100. HRESULT GenerateIt ();
  101. HRESULT GetTables ();
  102. HRESULT GetColumns ();
  103. HRESULT GetTags ();
  104. HRESULT GetRelations ();
  105. HRESULT BuildInternalStructures ();
  106. CComPtr<ISimpleTableDispenser2> m_spDispenser;
  107. CComPtr<IMetabaseSchemaCompiler> m_spIMbSchemaComp;
  108. CComPtr<ISimpleTableRead2> m_spISTTableMeta;
  109. CComPtr<ISimpleTableRead2> m_spISTColumnMeta;
  110. CComPtr<ISimpleTableRead2> m_spISTTagMeta;
  111. CComPtr<ISimpleTableRead2> m_spISTRelationMeta;
  112. LPWSTR m_wszBinFileName;
  113. LPTSTR m_tszBinFilePath;
  114. CTableMeta* m_paTableMetas; // all table information
  115. ULONG m_cNrTables;
  116. CColumnMeta* m_paColumnMetas; // all column information
  117. ULONG m_cNrColumns;
  118. tTAGMETARow* m_paTags; // all tag information
  119. ULONG m_cNrTags;
  120. ULONG m_cQueryCells;
  121. STQueryCell* m_pQueryCells;
  122. bool m_bBinFileLoaded;
  123. };
  124. #endif // _schemaextensions_h_