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.

140 lines
4.1 KiB

  1. /*****************************************************************************
  2. Copyright (c) Microsoft Corporation
  3. Module Name:
  4. ETQuery.h
  5. Abstract:
  6. This module contanins function definations required by ETQuery.cpp
  7. Author:
  8. Akhil Gokhale 03-Oct.-2000
  9. Revision History:
  10. ******************************************************************************/
  11. #ifndef _ETQUERY
  12. #define _ETQUERY
  13. #define COL_HOSTNAME GetResString(IDS_HOSTNAME)
  14. #define COL_TRIGGER_ID GetResString(IDS_TRIGGER_ID)
  15. #define COL_TRIGGER_NAME GetResString(IDS_TRIGGER_NAME)
  16. #define COL_TASK GetResString(IDS_TASK)
  17. #define COL_EVENT_QUERY GetResString(IDS_EVENT_QUERY)
  18. #define COL_DESCRIPTION GetResString(IDS_DESCRIPTION)
  19. #define COL_WQL GetResString(IDS_QUERY_LAGUAGE)
  20. #define COL_TASK_USERNAME GetResString(IDS_TASK_USERNAME)
  21. #define MAX_COL_LENGTH MAX_RES_STRING - 1
  22. #define V_WIDTH_TRIG_ID 10
  23. #define V_WIDTH_TRIG_NAME 25
  24. #define V_WIDTH_TASK 40
  25. #define WIDTH_HOSTNAME lstrlen(COL_HOSTNAME)+2
  26. #define WIDTH_TRIGGER_ID lstrlen(COL_TRIGGER_ID)+2
  27. #define WIDTH_TRIGGER_NAME lstrlen(COL_TRIGGER_NAME)
  28. #define WIDTH_TASK lstrlen(COL_TASK) + 2
  29. #define WIDTH_EVENT_QUERY lstrlen(COL_EVENT_QUERY)+2
  30. #define WIDTH_DESCRIPTION lstrlen(COL_DESCRIPTION)+2
  31. #define WIDTH_TASK_USERNAME 64 //lstrlen(COL_TASK_USERNAME)+20
  32. #define HOST_NAME 0
  33. #define TRIGGER_ID 1
  34. #define TRIGGER_NAME 2
  35. #define TASK 3
  36. #define EVENT_QUERY 4
  37. #define EVENT_DESCRIPTION 5
  38. #define TASK_USERNAME 6
  39. #define MAX_COMMANDLINE_Q_OPTION 7 // Maximum Command Line List
  40. #define NO_OF_COLUMNS 7
  41. #define ID_Q_QUERY 0
  42. #define ID_Q_SERVER 1
  43. #define ID_Q_USERNAME 2
  44. #define ID_Q_PASSWORD 3
  45. #define ID_Q_FORMAT 4
  46. #define ID_Q_NOHEADER 5
  47. #define ID_Q_VERBOSE 6
  48. class CETQuery
  49. {
  50. public:
  51. BOOL ExecuteQuery();
  52. void Initialize();
  53. void ProcessOption(DWORD argc, LPCTSTR argv[]);
  54. CETQuery();
  55. virtual ~CETQuery();
  56. CETQuery::CETQuery(LONG lMinMemoryReq,BOOL bNeedPassword);
  57. private:
  58. LONG FindAndReplace(LPTSTR* lpszSource,LPCTSTR lpszFind,
  59. LPCTSTR lpszReplace);
  60. LPTSTR m_pszBuffer;
  61. TARRAY m_arrColData;
  62. void PrepareColumns();
  63. void CheckAndSetMemoryAllocation(LPTSTR pszStr,LONG lSize);
  64. void CalcColWidth(LONG lOldLength,LONG *plNewLength,LPTSTR pszString);
  65. HRESULT GetRunAsUserName(LPCWSTR pszScheduleTaskName);
  66. void PrepareCMDStruct();
  67. void CheckRpRu(void);
  68. CONSOLE_SCREEN_BUFFER_INFO m_ScreenBufferInfo;
  69. HANDLE m_hStdHandle;
  70. LPTSTR m_pszServerName;
  71. LPTSTR m_pszUserName;
  72. LPTSTR m_pszPassword;
  73. LPTSTR m_pszFormat;
  74. BOOL m_bVerbose;
  75. BOOL m_bNoHeader;
  76. BOOL m_bNeedPassword;
  77. BOOL m_bUsage;
  78. BOOL m_bQuery;
  79. BOOL m_bLocalSystem;
  80. BOOL m_bNeedDisconnect;
  81. BOOL m_bIsCOMInitialize;
  82. LONG m_lMinMemoryReq;
  83. LPTSTR m_pszEventDesc;
  84. LPTSTR m_pszTask;
  85. LPTSTR m_pszTaskUserName;
  86. LONG m_lHostNameColWidth;
  87. LONG m_lTriggerIDColWidth;
  88. LONG m_lETNameColWidth;
  89. LONG m_lTaskColWidth;
  90. LONG m_lQueryColWidth;
  91. LONG m_lDescriptionColWidth;
  92. LONG m_lTaskUserName;
  93. // variables required to show results..
  94. LPTSTR m_pszEventQuery;
  95. LONG m_lWQLColWidth;
  96. // WMI / COM interfaces
  97. IWbemLocator* m_pWbemLocator;
  98. IWbemServices* m_pWbemServices;
  99. IWbemClassObject* m_pObj; // Temp. pointers which holds
  100. //next instance
  101. IWbemClassObject* m_pTriggerEventConsumer;
  102. IWbemClassObject* m_pEventFilter;
  103. IWbemClassObject* m_pClass;
  104. IWbemClassObject* m_pInClass;
  105. IWbemClassObject* m_pInInst;
  106. IWbemClassObject* m_pOutInst;
  107. // WMI connectivity
  108. COAUTHIDENTITY* m_pAuthIdentity;
  109. // Array to store command line options
  110. TCMDPARSER cmdOptions[MAX_COMMANDLINE_Q_OPTION];
  111. TCOLUMNS mainCols[NO_OF_COLUMNS];
  112. };
  113. #endif