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.

157 lines
4.8 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 StringLength(COL_HOSTNAME,0)+2
  26. #define WIDTH_TRIGGER_ID StringLength(COL_TRIGGER_ID,0)+2
  27. #define WIDTH_TRIGGER_NAME StringLength(COL_TRIGGER_NAME,0)
  28. #define WIDTH_TASK StringLength(COL_TASK,0) + 2
  29. #define WIDTH_EVENT_QUERY StringLength(COL_EVENT_QUERY,0)+2
  30. #define WIDTH_DESCRIPTION StringLength(COL_DESCRIPTION,0)+2
  31. #define WIDTH_TASK_USERNAME 64
  32. #define DOMAIN_U_STRING L"\\\\"
  33. #define NULL_U_CHAR L'\0'
  34. #define BACK_SLASH_U L'\\'
  35. #define HOST_NAME 0
  36. #define TRIGGER_ID 1
  37. #define TRIGGER_NAME 2
  38. #define TASK 3
  39. #define EVENT_QUERY 4
  40. #define EVENT_DESCRIPTION 5
  41. #define TASK_USERNAME 6
  42. #define MAX_COMMANDLINE_Q_OPTION 8 // Maximum Command Line List
  43. #define NO_OF_COLUMNS 7
  44. #define ID_Q_QUERY 0
  45. #define ID_Q_SERVER 1
  46. #define ID_Q_USERNAME 2
  47. #define ID_Q_PASSWORD 3
  48. #define ID_Q_FORMAT 4
  49. #define ID_Q_NOHEADER 5
  50. #define ID_Q_VERBOSE 6
  51. #define ID_Q_TRIGGERID 7
  52. class CETQuery
  53. {
  54. public:
  55. BOOL ExecuteQuery();
  56. void Initialize();
  57. void ProcessOption( IN DWORD argc, IN LPCTSTR argv[]);
  58. BOOL GetNValidateTriggerId( IN OUT DWORD *szLower,
  59. IN OUT DWORD *szUpper );
  60. CETQuery();
  61. virtual ~CETQuery();
  62. CETQuery::CETQuery(LONG lMinMemoryReq,BOOL bNeedPassword);
  63. private:
  64. LONG FindAndReplace( IN OUT LPTSTR lpszSource, IN LPCTSTR lpszFind,
  65. IN LPCTSTR lpszReplace);
  66. TCHAR m_szBuffer[MAX_STRING_LENGTH * 4];
  67. TARRAY m_arrColData;
  68. void PrepareColumns();
  69. void CheckAndSetMemoryAllocation( IN OUT LPTSTR pszStr, IN LONG lSize);
  70. void CalcColWidth( IN LONG lOldLength, OUT LONG *plNewLength,
  71. IN LPTSTR pszString);
  72. HRESULT GetRunAsUserName( IN LPCWSTR pszScheduleTaskName, IN BOOL bXPorNET = FALSE);
  73. HRESULT GetApplicationToRun(void);
  74. void PrepareCMDStruct();
  75. void CheckRpRu(void);
  76. BOOL IsSchSvrcRunning();
  77. BOOL SetTaskScheduler();
  78. BOOL DisplayXPResults();
  79. LPTSTR m_pszServerName;
  80. LPTSTR m_pszUserName;
  81. LPTSTR m_pszPassword;
  82. LPTSTR m_pszFormat;
  83. LPTSTR m_pszTriggerID;
  84. BOOL m_bVerbose;
  85. BOOL m_bNoHeader;
  86. BOOL m_bNeedPassword;
  87. BOOL m_bUsage;
  88. BOOL m_bQuery;
  89. BOOL m_bLocalSystem;
  90. BOOL m_bNeedDisconnect;
  91. BOOL m_bIsCOMInitialize;
  92. LONG m_lMinMemoryReq;
  93. TCHAR m_szEventDesc[MAX_STRING_LENGTH];
  94. TCHAR m_szTask[MAX_TASK_NAME];
  95. TCHAR m_szTaskUserName[MAX_STRING_LENGTH];
  96. TCHAR m_szScheduleTaskName[MAX_STRING_LENGTH];
  97. LONG m_lHostNameColWidth;
  98. LONG m_lTriggerIDColWidth;
  99. LONG m_lETNameColWidth;
  100. LONG m_lTaskColWidth;
  101. LONG m_lQueryColWidth;
  102. LONG m_lDescriptionColWidth;
  103. LONG m_lTaskUserName;
  104. DWORD m_dwLowerBound;
  105. DWORD m_dwUpperBound;
  106. // variables required to show results..
  107. LPTSTR m_pszEventQuery;
  108. LONG m_lWQLColWidth;
  109. // WMI / COM interfaces
  110. IWbemLocator* m_pWbemLocator;
  111. IWbemServices* m_pWbemServices;
  112. IWbemClassObject* m_pObj; // Temp. pointers which holds
  113. //next instance
  114. IWbemClassObject* m_pTriggerEventConsumer;
  115. IWbemClassObject* m_pEventFilter;
  116. IWbemClassObject* m_pClass;
  117. IWbemClassObject* m_pInClass;
  118. IWbemClassObject* m_pInInst;
  119. IWbemClassObject* m_pOutInst;
  120. ITaskScheduler* m_pITaskScheduler;
  121. // WMI connectivity
  122. COAUTHIDENTITY* m_pAuthIdentity;
  123. // Array to store command line options
  124. TCMDPARSER2 cmdOptions[MAX_COMMANDLINE_Q_OPTION];
  125. TCOLUMNS mainCols[NO_OF_COLUMNS];
  126. };
  127. #endif