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.

391 lines
11 KiB

  1. /****************************************************************************
  2. Copyright information : Copyright (c) 1998-1999 Microsoft Corporation
  3. File Name : CommandSwitches.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 GlobalSwitches
  10. Revision History :
  11. Last Modified by : Ch. Sriramachandramurthy
  12. Last Modified on : 17th-November-2000
  13. ****************************************************************************/
  14. /*-------------------------------------------------------------------
  15. Class Name : CGlobalSwitches
  16. Class Type : Concrete
  17. Brief Description : This class encapsulates the functionality needed
  18. for accessing and storing the global switches
  19. information, which will be used by Parsing,
  20. Execution and Format Engines depending upon the
  21. applicablity.
  22. Super Classes : None
  23. Sub Classes : None
  24. Classes Used : None
  25. Interfaces Used : None
  26. --------------------------------------------------------------------*/
  27. #pragma once
  28. class CGlobalSwitches
  29. {
  30. public:
  31. // Construction
  32. CGlobalSwitches();
  33. // Destruction
  34. ~CGlobalSwitches();
  35. // Restrict Assignment
  36. CGlobalSwitches& operator=(CGlobalSwitches& rGlblSwitches);
  37. // Attributes
  38. private:
  39. // Mapping b/w allowed strings for implevel and
  40. // the corresponding integer values.
  41. CHARINTMAP m_cimImpLevel;
  42. // Mapping b/w allowed strings for authlevel and
  43. // the corresponding integer values.
  44. CHARINTMAP m_cimAuthLevel;
  45. //String type, It stores the authority value.
  46. _TCHAR* m_pszAuthority;
  47. //String type, It stores Namespace specified in the command.
  48. _TCHAR* m_pszNameSpace;
  49. //String type, It stores Role specified in the command.
  50. _TCHAR* m_pszRole;
  51. //String type, It stores Node specified in the command.
  52. _TCHAR* m_pszNode;
  53. //CHARVECTOR type, It stores the Nodes specified in the command.
  54. CHARVECTOR m_cvNodesList;
  55. //String type, It stores User specified in the command.
  56. _TCHAR* m_pszUser;
  57. //String type, It stores Password specified in the command.
  58. _TCHAR* m_pszPassword;
  59. //String type, It stores Locale value specified
  60. //in the command
  61. _TCHAR* m_pszLocale;
  62. //String type, It stores the Record specified in the command.
  63. _TCHAR* m_pszRecordPath;
  64. //Boolean type, It stores the value of the Privileges option specified
  65. //in the conmmand
  66. BOOL m_bPrivileges;
  67. //Boolean type, It stores the value of the Aggregate option specified
  68. //in the conmmand
  69. BOOL m_bAggregateFlag;
  70. //enumerated data type, It stores the value of the ImpersonationLevel
  71. //specified in the command.
  72. IMPLEVEL m_ImpLevel;
  73. //enumerated data type, It stores the value of the Authentication Level
  74. //specified in the command.
  75. AUTHLEVEL m_AuthLevel;
  76. // Boolean type, It specifies presence of the Interactive option
  77. //in the command
  78. BOOL m_bInteractive;
  79. //Boolean type, It specifies presence of the trace option in
  80. //the command
  81. BOOL m_bTrace;
  82. //Boolean type, It specifies Help(/?) option in the command
  83. BOOL m_bHelp;
  84. //HELPOPTION type, to specify type of help needed ( help option ).
  85. HELPOPTION m_HelpOption;
  86. //CONNECTION information flag
  87. UINT m_uConnInfoFlag;
  88. // role change flag
  89. BOOL m_bRoleFlag;
  90. // namespace change flag
  91. BOOL m_bNSFlag;
  92. // locale change flag
  93. BOOL m_bLocaleFlag;
  94. // prompt for password flag
  95. BOOL m_bAskForPassFlag;
  96. // change of recordpath flag
  97. BOOL m_bRPChange;
  98. // FailFast flag.
  99. BOOL m_bFailFast;
  100. // Output option.
  101. OUTPUTSPEC m_opsOutputOpt;
  102. // Append option.
  103. OUTPUTSPEC m_opsAppendOpt;
  104. // Output file name.
  105. _TCHAR* m_pszOutputFileName;
  106. // File pointer to output file stream..
  107. FILE* m_fpOutFile;
  108. // Append file name.
  109. _TCHAR* m_pszAppendFileName;
  110. // File pointer to append file stream..
  111. FILE* m_fpAppendFile;
  112. WMICLIINT m_nSeqNum;
  113. _TCHAR* m_pszLoggedOnUser;
  114. _TCHAR* m_pszNodeName;
  115. _TCHAR* m_pszStartTime;
  116. // Operations
  117. public:
  118. //Sets the authority value
  119. BOOL SetAuthority(_TCHAR* pszAuthority);
  120. //Sets the namespace passed in parameter to m_pszNameSpace.
  121. BOOL SetNameSpace(_TCHAR* pszNameSpace);
  122. //Sets the role passed in parameter to m_pszRole.
  123. BOOL SetRole(_TCHAR* pszRole);
  124. //Assigns the locale passed in parameter to m_pszLocale.
  125. BOOL SetLocale(_TCHAR* pszLocale);
  126. //Assigns the node passed in parameter to m_pszNode
  127. BOOL SetNode(_TCHAR* pszNode);
  128. //Adds the node passed in parameter to m_cvNodesList vector.
  129. BOOL AddToNodesList(_TCHAR* pszNode);
  130. //Assigns the user passed in parameter to m_pszUser
  131. BOOL SetUser(_TCHAR* pszUser);
  132. //Assigns the password passed in parameter to m_pszPassword
  133. BOOL SetPassword(_TCHAR* pszPassword);
  134. //Assigns the record file passed in parameter to m_pszRecordPath
  135. BOOL SetRecordPath(_TCHAR* pszRecordPath);
  136. //Assigns the bool value passed in parameter to m_bPrivileges
  137. void SetPrivileges(BOOL bEnable);
  138. //Assigns the impersonation level passed in parameter to
  139. //m_ImpLevel.
  140. BOOL SetImpersonationLevel(_TCHAR* const pszImpLevel);
  141. //Assigns the authentication level passed in parameter to
  142. //m_AuthLevel.
  143. BOOL SetAuthenticationLevel(_TCHAR* const pszAuthLevel);
  144. //This function sets the m_bTrace to TRUE,If Trace mode
  145. //is specified in the command
  146. void SetTraceMode(BOOL bTrace);
  147. //This function sets the m_bInteractive to TRUE,If
  148. //interactive mode is specified in the command
  149. void SetInteractiveMode(BOOL bInteractive);
  150. //sets the m_bHelp to TRUE, If /? is specified in the
  151. //command
  152. void SetHelpFlag(BOOL bHelp);
  153. // Sets the namespace change status flag with bNSFlag value
  154. void SetNameSpaceFlag(BOOL bNSFlag);
  155. // Sets the role change status flag with bRoleFlag value
  156. void SetRoleFlag(BOOL bRoleFlag);
  157. // Sets the locale change status flag with bLocaleFlag value
  158. void SetLocaleFlag(BOOL bLocaleFlag);
  159. // Sets the recordpath change status flag with bRPChange value
  160. void SetRPChangeStatus(BOOL bRPChange);
  161. //This function specifies whether the help should
  162. //be brief or full
  163. void SetHelpOption(HELPOPTION helpOption);
  164. //This function sets the Connection Info flag
  165. void SetConnInfoFlag(UINT uFlag);
  166. // Set AskForPass flag.
  167. void SetAskForPassFlag(BOOL bFlag);
  168. // Set m_bFailFast
  169. void SetFailFast(BOOL bFlag);
  170. //This function returns the Connection Info flag
  171. UINT GetConnInfoFlag();
  172. //Returns the string held in m_pszAuthority
  173. _TCHAR* GetAuthority();
  174. //Returns the string held in m_pszNameSpace
  175. _TCHAR* GetNameSpace();
  176. //Returns the string held in m_pszRole
  177. _TCHAR* GetRole();
  178. //Returns the string held in m_pszLocale
  179. _TCHAR* GetLocale();
  180. //Returns the string held in m_pszNode
  181. _TCHAR* GetNode();
  182. //Returns the referrence to m_cvNodesList.
  183. CHARVECTOR& GetNodesList();
  184. //Returns the string held in m_pszUser
  185. _TCHAR* GetUser();
  186. //Returns the string held in m_pszPassword
  187. _TCHAR* GetPassword();
  188. //Returns the string held in m_pszRecordPath
  189. _TCHAR* GetRecordPath();
  190. //Returns the m_bPrivileges value
  191. BOOL GetPrivileges();
  192. // Return the string equivalent of the boolean value
  193. // contained in m_bPrivilges flag
  194. void GetPrivilegesTextDesc(_bstr_t& bstrPriv);
  195. // Return the string equivalent of the boolean value
  196. // contained in m_bFailFast flag
  197. void GetFailFastTextDesc(_bstr_t& bstrFailFast);
  198. // Return the string equivalent of the OUTPUTSPEC value
  199. // contained in m_opsOutputOpt member.
  200. void GetOutputOrAppendTextDesc(_bstr_t& bstrOutputOpt,
  201. BOOL bIsOutput);
  202. // Return the string equivalent of the boolean value
  203. // contained in m_bTrace flag
  204. void GetTraceTextDesc(_bstr_t& bstrTrace);
  205. // Return the string equivalent of the boolean value
  206. // contained in m_bInteractive flag
  207. void GetInteractiveTextDesc(_bstr_t& bstrInteractive);
  208. // Returns the string equivalent of the implevel value
  209. // contained in m_ImpLevel
  210. void GetImpLevelTextDesc(_bstr_t& bstrImpLevel);
  211. // Returns the string equivalent of the authlevel value
  212. // contained in m_AuthLevel
  213. void GetAuthLevelTextDesc(_bstr_t& bstrAuthLevel);
  214. // Returns the ',' separated node string of the available
  215. // nodes
  216. void GetNodeString(_bstr_t& bstrNString);
  217. // Returns the content of the m_pszRecordPath
  218. // if NULL returns "N/A"
  219. void GetRecordPathDesc(_bstr_t& bstrRP);
  220. //Returns impersonation level held in m_ImpLevel
  221. LONG GetImpersonationLevel();
  222. //Returns authentication level held in m_AuthLevel
  223. LONG GetAuthenticationLevel();
  224. //Returns Trace status held in m_bTrace
  225. BOOL GetTraceStatus();
  226. //Returns Interactive status held in m_bInteractive
  227. BOOL GetInteractiveStatus();
  228. //Returns helpflag held in m_bHelp
  229. BOOL GetHelpFlag();
  230. // Returns the change of role status
  231. BOOL GetRoleFlag();
  232. // Returns the change of namespace status
  233. BOOL GetNameSpaceFlag();
  234. // Returns TRUE if message for password
  235. // needs to be prompted.
  236. BOOL GetAskForPassFlag();
  237. // Returns the change of locale status flag
  238. BOOL GetLocaleFlag();
  239. // Returns the change of recordpath status flag
  240. BOOL GetRPChangeStatus();
  241. //Returns helpflagOption held in m_bHelpOption
  242. HELPOPTION GetHelpOption();
  243. // Returns the m_bFailFast flag.
  244. BOOL GetFailFast();
  245. // Initialize the necessary member varialbes
  246. void Initialize();
  247. // General functions
  248. void Uninitialize();
  249. // Clears the Nodes List
  250. BOOL ClearNodesList();
  251. // Set Output option.
  252. void SetOutputOrAppendOption(OUTPUTSPEC opsOpt,
  253. BOOL bIsOutput);
  254. // Get Output option.
  255. OUTPUTSPEC GetOutputOrAppendOption(BOOL bIsOutput);
  256. // Set Output or append File Name, bOutput == TRUE for Output FALSE
  257. // for Append.
  258. BOOL SetOutputOrAppendFileName(const _TCHAR* pszFileName,
  259. BOOL bOutput);
  260. // Get Output or append file name, bOutput == TRUE for Output FALSE for
  261. // Append.
  262. _TCHAR* GetOutputOrAppendFileName(BOOL bOutput);
  263. // Set output or append file pointer, bOutput == TRUE for Output FALSE
  264. // for Append.
  265. void SetOutputOrAppendFilePointer(FILE* fpOutFile, BOOL bOutput);
  266. // Get output file pointer, bOutput == TRUE for Output FALSE for Append.
  267. FILE* GetOutputOrAppendFilePointer(BOOL bOutput);
  268. WMICLIINT GetSequenceNumber();
  269. _TCHAR* GetLoggedonUser();
  270. _TCHAR* GetMgmtStationName();
  271. _TCHAR* GetStartTime();
  272. BOOL SetStartTime();
  273. //Assigns the Aggregate flag passed in parameter to m_bAggregateFlag
  274. void SetAggregateFlag(BOOL bAggregateFlag);
  275. //Gets the agregate flag contained in m_bAggregateFlag
  276. BOOL GetAggregateFlag();
  277. // This function checks and Returns the string equivalent of the
  278. // boolean value contained in m_bAggregateFlag flag
  279. void GetAggregateTextDesc(_bstr_t& bstrAggregate);
  280. };