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.

283 lines
8.2 KiB

  1. /****************************************************************************
  2. Copyright information : Copyright (c) 1998-1999 Microsoft Corporation
  3. File Name : FormatEngine.h
  4. Project Name : WMI Command Line
  5. Author Name : Ch. Sriramachandramurthy
  6. Date of Creation (dd/mm/yy) : 27th-September-2000
  7. Version Number : 1.0
  8. Brief Description : This file consist of class declaration of
  9. class CFormatEngine
  10. Revision History :
  11. Last Modified By : Ch. Sriramachandramurthy
  12. Last Modified Date : 12th-March-2001
  13. ****************************************************************************/
  14. /*-------------------------------------------------------------------
  15. Class Name : CFormatEngine
  16. Class Type : Concrete
  17. Brief Description : This class encapsulates the functionality needed
  18. for displaying the following:
  19. 1. results in the user desired format
  20. 2. error code(s) with description
  21. 3. success/failure status
  22. Super Classes : None
  23. Sub Classes : None
  24. Classes Used : CParsedInfo
  25. CErrorInfo
  26. CWMICliLog
  27. Interfaces Used : WMI XML Adapter
  28. --------------------------------------------------------------------*/
  29. // forward declaration of classes
  30. class CParsedInfo;
  31. class CErrorInfo;
  32. //class CWMICliLog;
  33. class CWMICliXMLLog;
  34. class CFileOutputStream;
  35. ////////////////////////////////////////////////////////////////////////
  36. // CFormatEngine
  37. class CFormatEngine
  38. {
  39. public:
  40. // Construction
  41. CFormatEngine();
  42. // Destruction
  43. ~CFormatEngine();
  44. // Attributes
  45. private:
  46. // Pointer to object of type IXMLDOMDocument,
  47. // points to XML document containing result set.
  48. IXMLDOMDocument2 *m_pIXMLDoc;
  49. // Pointer to object of type IXMLDOMDocument,
  50. // points to XSL document containing format of
  51. // the output result.
  52. IXMLDOMDocument2 *m_pIXSLDoc;
  53. // Object of type CErrorInfo, Used for handling
  54. // Error information.
  55. CErrorInfo m_ErrInfo;
  56. // Object of type CWMICliLog, Used for logging
  57. // the input and output to the logfile.
  58. //CWMICliLog m_WmiCliLog;
  59. // SRIRAM - xml logging
  60. CWMICliXMLLog m_WmiCliLog;
  61. // SRIRAM - xml logging
  62. // Loggin option
  63. ERRLOGOPT m_eloErrLogOpt;
  64. // help vector
  65. CHARVECTOR m_cvHelp;
  66. // Help flag
  67. BOOL m_bHelp;
  68. // Record flag
  69. BOOL m_bRecord;
  70. // Trace flag
  71. BOOL m_bTrace;
  72. // Display LIST flag.
  73. OUTPUTSPEC m_opsOutputOpt;
  74. // Get output option.
  75. BOOL m_bGetOutOpt;
  76. // Display CALL flag.
  77. BOOL m_bDispCALL;
  78. // Display SET flag.
  79. BOOL m_bDispSET;
  80. // Display LIST flag.
  81. BOOL m_bDispLIST;
  82. // Flag to specify availibilty of Append file pointer to format engine.
  83. BOOL m_bGetAppendFilePinter;
  84. // File pointer of append file.
  85. FILE* m_fpAppendFile;
  86. // Flag to specify availibilty of output file pointer to format engine.
  87. BOOL m_bGetOutputFilePinter;
  88. // File pointer of out file.
  89. FILE* m_fpOutFile;
  90. BOOL m_bLog;
  91. CHString m_chsOutput;
  92. BOOL m_bInteractiveHelp;
  93. // Specifies that output is going to stream if TRUE.
  94. BOOL m_bOutputGoingToStream;
  95. // Operations
  96. private:
  97. // Creates an empty XML Document and returns the same
  98. // in Passed Parameter.
  99. HRESULT CreateEmptyDocument(IXMLDOMDocument2** pIDoc);
  100. // Applies a XSL style sheet containing format of the
  101. // display to a XML file Containing result set.
  102. BOOL ApplyXSLFormatting(CParsedInfo& rParsedInfo);
  103. // Displays GET verb usage.
  104. void DisplayGETUsage(CParsedInfo& rParsedInfo);
  105. // Displays LIST verb usage.
  106. void DisplayLISTUsage(CParsedInfo& rParsedInfo);
  107. // Displays CALL verb usage.
  108. void DisplayCALLUsage(CParsedInfo& rParsedInfo);
  109. // Displays SET verb usage.
  110. void DisplaySETUsage(CParsedInfo& rParsedInfo);
  111. // Displays ASSOC verb usage.
  112. void DisplayASSOCUsage(CParsedInfo& rParsedInfo);
  113. // Displays CREATE verb usage.
  114. void DisplayCREATEUsage(CParsedInfo& rParsedInfo);
  115. // Displays DELETE verb usage
  116. void DisplayDELETEUsage(CParsedInfo& rParsedInfo);
  117. // Frames the help vector
  118. void FrameHelpVector(CParsedInfo& refParsedInfo);
  119. // Displays help for Alias
  120. void DisplayAliasHelp(CParsedInfo& rParsedInfo);
  121. // Displays help for Alias PATH
  122. void DisplayPATHHelp(CParsedInfo& refParsedInfo);
  123. // Displays help for WHERE
  124. void DisplayWHEREHelp(CParsedInfo& refParsedInfo);
  125. // Displays help for CLASS
  126. void DisplayCLASSHelp(CParsedInfo& refParsedInfo);
  127. // Displays help for PWhere
  128. void DisplayPWhereHelp(CParsedInfo& refParsedInfo);
  129. // Displays alias names
  130. void DisplayAliasFriendlyNames(CParsedInfo& refParsedInfo,
  131. _TCHAR* pszAlias = NULL);
  132. // Display help for Alias verbs
  133. void DisplayMethodDetails(CParsedInfo& refParsedInfo);
  134. // Display help for /GET /?
  135. void DisplayPropertyDetails(CParsedInfo& refParsedInfo);
  136. // Displays help for standard verbs
  137. void DisplayStdVerbDescriptions(CParsedInfo& refParsedInfo);
  138. // Displays localized string given the resource string ID
  139. void DisplayString(UINT uID, BOOL bAddToVector = TRUE,
  140. LPTSTR lpszParam = NULL,
  141. BOOL bIsError = FALSE);
  142. // Displays help for global switches
  143. void DisplayGlobalSwitchesAndOtherDesc(CParsedInfo&
  144. refParsedInfo);
  145. // Displays help for global switches in brief
  146. void DisplayGlobalSwitchesBrief();
  147. // Displays the page-by-page help
  148. void DisplayPagedHelp(CParsedInfo& rParsedInfo);
  149. // Displays all usages of standard verb available.
  150. void DisplayStdVerbsUsage(_bstr_t bstrBeginStr,
  151. BOOL bClass = FALSE);
  152. // Displays help for /TRANSLATE switch.
  153. void DisplayTRANSLATEHelp(CParsedInfo& rParsedInfo);
  154. // Displays help for /EVERY switch.
  155. void DisplayEVERYHelp(CParsedInfo& rParsedInfo);
  156. // Displays help for /FORMAT switch.
  157. void DisplayFORMATHelp(CParsedInfo& rParsedInfo);
  158. // Displays help for Verb Switches.
  159. void DisplayVERBSWITCHESHelp(CParsedInfo& rParsedInfo);
  160. // Translates the output.
  161. void ApplyTranslateTable(STRING& strString,
  162. CParsedInfo& rParsedInfo);
  163. // Displays the environment variables.
  164. void DisplayContext(CParsedInfo& rParsedInfo);
  165. // Displays the help on CONTEXT keyword
  166. void DisplayContextHelp();
  167. // Displays invalid properties if any.
  168. void DisplayInvalidProperties(CParsedInfo& rParsedInfo,
  169. BOOL bSetVerb = FALSE);
  170. // Displays the large string line by line.
  171. void DisplayLargeString(CParsedInfo& rParsedInfo,
  172. STRING& strLargeString);
  173. // Travese through XML stream node by node and translate all nodes
  174. BOOL TraverseNode(CParsedInfo& rParsedInfo);
  175. // Displays help for /RESULTCLASS assoc switch.
  176. void DisplayRESULTCLASSHelp();
  177. // Displays help for /RESULTROLE assoc switch.
  178. void DisplayRESULTROLEHelp();
  179. // Displays help for /ASSOCCLASS assoc switch.
  180. void DisplayASSOCCLASSHelp();
  181. // Displays help for /REPEAT
  182. void DisplayREPEATHelp();
  183. // Apply cascading transforms and return the result data in bstrOutput
  184. BOOL DoCascadeTransforms(CParsedInfo& rParsedInfo,
  185. _bstr_t& bstrOutput);
  186. // Add the parameters to the IXSLProcessor object
  187. HRESULT AddParameters(CParsedInfo& rParsedInfo,
  188. IXSLProcessor *pIProcessor,
  189. BSTRMAP bstrmapParam);
  190. // Set output stream.
  191. BOOL SetOutputStream(CFileOutputStream& fosFileOutputStream,
  192. VARIANT& vtStream);
  193. public:
  194. // Displays the result referring CcommandSwitches and
  195. // CGlobalSwitches Objects of the CParsedInfo object.
  196. BOOL DisplayResults(CParsedInfo&, BOOL bInteractiveHelp = FALSE);
  197. // Displays localized string given the information to be displayed.
  198. void DisplayString(LPTSTR lpszMsg, BOOL bScreen = TRUE,
  199. BOOL bIsError = FALSE);
  200. // Carries out the releasing process.
  201. void Uninitialize(BOOL bFinal = FALSE);
  202. // Appends the output or prompt messages to the output string
  203. // Useful in the case of CALL, CREATE, DELETE and SET for logging
  204. // the output to XML log.
  205. void AppendtoOutputString(_TCHAR* pszOutput);
  206. // Returns Error info Object
  207. CErrorInfo& GetErrorInfoObject() {return m_ErrInfo; };
  208. // Displays COM error message
  209. void DisplayCOMError(CParsedInfo& rParsedInfo);
  210. };