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.

152 lines
3.9 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: WMILFile.H
  4. // Copyright (c) 1994-2001 Microsoft Corporation, All Rights Reserved
  5. // All rights reserved.
  6. //
  7. //
  8. //
  9. //-----------------------------------------------------------------------------
  10. #ifndef WMILOCFIL_H
  11. #define WMILOCFIL_H
  12. #include <vector>
  13. const FileType ftWMIFileType = ftUnknown+1;
  14. class CWMILocFile : public ILocFile, public CLObject
  15. {
  16. public:
  17. CWMILocFile(ILocParser *);
  18. static void GetFileDescriptions(CEnumCallback &);
  19. typedef std::vector<_bstr_t> VectorString;
  20. protected:
  21. //
  22. // Standard IUnknown methods
  23. //
  24. STDMETHOD_(ULONG, AddRef)();
  25. STDMETHOD_(ULONG, Release)();
  26. STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppvObj);
  27. //
  28. // Standard Debugging interfaces
  29. //
  30. STDMETHOD_(void, AssertValidInterface)(THIS) CONST_METHOD;
  31. //
  32. // ILocFile methods.
  33. //
  34. STDMETHOD_(BOOL, OpenFile)(const CFileSpec REFERENCE,
  35. CReporter REFERENCE);
  36. STDMETHOD_(FileType, GetFileType)(void) const;
  37. STDMETHOD_(void, GetFileTypeDescription)(CLString REFERENCE) const;
  38. STDMETHOD_(BOOL, GetAssociatedFiles)(CStringList REFERENCE) const;
  39. STDMETHOD_(BOOL, EnumerateFile)(CLocItemHandler REFERENCE,
  40. const CLocLangId &, const DBID REFERENCE);
  41. STDMETHOD_(BOOL, GenerateFile)(const CPascalString REFERENCE,
  42. CLocItemHandler REFERENCE, const CLocLangId REFERENCE,
  43. const CLocLangId REFERENCE, const DBID REFERENCE);
  44. //
  45. // CLObect implementation
  46. //
  47. #ifdef _DEBUG
  48. void AssertValid(void) const;
  49. void Dump(CDumpContext &) const;
  50. #endif
  51. private:
  52. //
  53. // Private methods to prevent callers access.
  54. //
  55. ~CWMILocFile();
  56. CWMILocFile();
  57. const CWMILocFile &operator=(const CWMILocFile &);
  58. //
  59. // Private data for C.O.M. implementation
  60. ILocParser *m_pParentClass;
  61. ULONG m_ulRefCount;
  62. //
  63. // WMI specific private data.
  64. //
  65. enum WMIFileError
  66. {
  67. WMINoError,
  68. WMIOOM,
  69. WMICantOpenSourceFile,
  70. WMICantOpenTargetFile,
  71. WMINoOpenFile,
  72. WMINotWMIFile,
  73. WMICantWriteFile,
  74. WMISyntaxError,
  75. WMIFileError2,
  76. WMIHandlerError,
  77. WMIUnknownError,
  78. WMIIncompleteObj,
  79. WMINoMore
  80. };
  81. enum WMILineTypes
  82. {
  83. wltUnknown,
  84. wltNamespaceName,
  85. wltClassName,
  86. wltPropertyName
  87. };
  88. UINT m_uiLineNumber;
  89. DBID m_didFileId;
  90. _bstr_t m_pstrFileName;
  91. _bstr_t m_pstrTargetFile;
  92. FILE *m_pOpenSourceFile;
  93. FILE *m_pOpenTargetFile;
  94. CodePage m_cpSource;
  95. CodePage m_cpTarget;
  96. WORD m_wSourceId;
  97. WORD m_wTargetId;
  98. _bstr_t m_sCurrentNamespace;
  99. BOOL ReadLines(CLocItemHandler &, const DBID &, BOOL);
  100. WMIFileError GetNextItemSet(DWORD dwCurrPos,const _bstr_t &, CLocItemSet &,
  101. const DBID &, UINT &uiStartPos) ;
  102. BOOL GetNextQualifierPos(const wchar_t *, const wchar_t *, UINT &uiPos, UINT uiStartingPos = 0);
  103. BOOL EnumerateItem(CLocItemHandler &, CLocItemSet &);
  104. BOOL GenerateItem(CLocItemHandler &, CLocItemSet &, wchar_t **, UINT &uiStartingPos);
  105. void SetFlags(CLocItem *, CLocString &) const;
  106. void GetFullContext(CLString &) const;
  107. void ReportFileError(const _bstr_t &pstrFileName,
  108. const DBID &didFileId, CFileException *pFileException,
  109. CReporter &Reporter) const;
  110. void ReportUnicodeError(CUnicodeException *pUnicodeException,
  111. CReporter &Reporter, const CLocation &Location) const;
  112. void ReportException(CException *pException,
  113. CReporter &Reporter, const CLocation &) const;
  114. BOOL GetQualifierValue(wchar_t *, UINT &, _bstr_t &, UINT &);
  115. BOOL SetQualifierValue(wchar_t *, wchar_t **, UINT &, _bstr_t &, UINT &, BOOL bQuotes = TRUE);
  116. BOOL WriteNewFile(wchar_t *);
  117. wchar_t *FindPrevious(wchar_t *, const wchar_t *pTop, const wchar_t *);
  118. wchar_t *GetCurrentNamespace(wchar_t *, UINT uPos);
  119. wchar_t *FindTop(wchar_t *, wchar_t *, BOOL &);
  120. void ParseArray(wchar_t *, VectorString &);
  121. void WriteWaterMark();
  122. };
  123. CVC::ValidationCode ValidateString(const CLocTypeId &, const CLocString &clsOutputLine,
  124. CReporter &repReporter, const CLocation &loc, const CLString &strContext);
  125. #endif // WMILOCFIL_H