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.

167 lines
8.0 KiB

  1. /******************************************************************************
  2. Copyright(c) Microsoft Corporation
  3. Module Name:
  4. Query.h
  5. Abstract:
  6. This module contains the macros, user defined structures & function
  7. definitions needed by Query.cpp , QueryTasks.cpp files.
  8. Author:
  9. G.Surender Reddy 10-sept-2000
  10. Revision History:
  11. G.Surender Reddy 10-sept-2000 : Created it
  12. G.Surender Reddy 25-sep-2000 : Modified it
  13. [ Added macro constants,Function
  14. definitions ]
  15. ******************************************************************************/
  16. #ifndef __QUERY_H
  17. #define __QUERY_H
  18. #pragma once // include header file only once
  19. //width constants for the fields
  20. #define WIDTH_HOSTNAME AsLong( GetResString( IDS_WIDTH_HOSTNAME ), 10 )
  21. #define WIDTH_TASKNAME AsLong( GetResString( IDS_WIDTH_TASKNAME ), 10 )
  22. #define WIDTH_NEXTRUNTIME AsLong( GetResString( IDS_WIDTH_NEXTRUNTIME ), 10 )
  23. #define WIDTH_LASTRUNTIME AsLong( GetResString( IDS_WIDTH_LASTRUNTIME ), 10 )
  24. #define WIDTH_STATUS AsLong( GetResString( IDS_WIDTH_STATUS ), 10 )
  25. #define WIDTH_LASTRESULT AsLong( GetResString( IDS_WIDTH_LASTRESULT ), 10 )
  26. #define WIDTH_CREATOR AsLong( GetResString( IDS_WIDTH_CREATOR ), 10 )
  27. #define WIDTH_SCHEDULE AsLong( GetResString( IDS_WIDTH_SCHEDULE ), 10 )
  28. #define WIDTH_APPNAME AsLong( GetResString( IDS_WIDTH_APPNAME ), 10 )
  29. #define WIDTH_WORKDIRECTORY AsLong( GetResString( IDS_WIDTH_WORKDIRECTORY ), 10 )
  30. #define WIDTH_COMMENT AsLong( GetResString( IDS_WIDTH_COMMENT ), 10 )
  31. #define WIDTH_TASKSTATE AsLong( GetResString( IDS_WIDTH_TASKSTATE ), 10 )
  32. #define WIDTH_TASKTYPE AsLong( GetResString( IDS_WIDTH_TASKTYPE ), 10 )
  33. #define WIDTH_TASKSTIME AsLong( GetResString( IDS_WIDTH_TASKSTIME ), 10 )
  34. #define WIDTH_TASKSDATE AsLong( GetResString( IDS_WIDTH_TASKSDATE ), 10 )
  35. #define WIDTH_TASKEDATE AsLong( GetResString( IDS_WIDTH_TASKEDATE ), 10 )
  36. #define WIDTH_TASKDAYS AsLong( GetResString( IDS_WIDTH_TASKDAYS ), 10 )
  37. #define WIDTH_TASKMONTHS AsLong( GetResString( IDS_WIDTH_TASKMONTHS ), 10 )
  38. #define WIDTH_TASKRUNASUSER AsLong( GetResString( IDS_WIDTH_TASKRUNASUSER ), 10 )
  39. #define WIDTH_TASKDELETE AsLong( GetResString( IDS_WIDTH_TASKDELETE ), 10 )
  40. #define WIDTH_TASKSTOP AsLong( GetResString( IDS_WIDTH_TASKSTOP ), 10 )
  41. #define WIDTH_TASK_RPTEVERY AsLong( GetResString( IDS_WIDTH_TASK_RPTEVERY ), 10 )
  42. #define WIDTH_TASK_UNTILRPTTIME AsLong( GetResString( IDS_WIDTH_TASK_UNTILRPTTIME ), 10 )
  43. #define WIDTH_TASK_RPTDURATION AsLong( GetResString( IDS_WIDTH_TASK_RPTDURATION ), 10 )
  44. #define WIDTH_TASK_RPTRUNNING AsLong( GetResString( IDS_WIDTH_TASK_RPTRUNNING ), 10 )
  45. #define WIDTH_TASKIDLE AsLong( GetResString( IDS_WIDTH_TASKIDLE ), 10 )
  46. #define WIDTH_TASKPOWER AsLong( GetResString( IDS_WIDTH_TASKPOWERMGMT ), 10 )
  47. //constants of Task properties column numbers
  48. #define HOSTNAME_COL_NUMBER AsLong( GetResString( IDS_HOSTNAME_COL_NUMBER ), 10 )
  49. #define TASKNAME_COL_NUMBER AsLong( GetResString( IDS_TASKNAME_COL_NUMBER ), 10 )
  50. #define NEXTRUNTIME_COL_NUMBER AsLong( GetResString( IDS_NEXTRUNTIME_COL_NUMBER ), 10 )
  51. #define LASTRUNTIME_COL_NUMBER AsLong( GetResString( IDS_LASTRUNTIME_COL_NUMBER ), 10 )
  52. #define STATUS_COL_NUMBER AsLong( GetResString( IDS_STATUS_COL_NUMBER ), 10 )
  53. #define LASTRESULT_COL_NUMBER AsLong( GetResString( IDS_LASTRESULT_COL_NUMBER ), 10 )
  54. #define CREATOR_COL_NUMBER AsLong( GetResString( IDS_CREATOR_COL_NUMBER ), 10 )
  55. #define SCHEDULE_COL_NUMBER AsLong( GetResString( IDS_SCHEDULE_COL_NUMBER ), 10 )
  56. #define TASKTORUN_COL_NUMBER AsLong( GetResString( IDS_TASKTORUN_COL_NUMBER ), 10 )
  57. #define STARTIN_COL_NUMBER AsLong( GetResString( IDS_STARTIN_COL_NUMBER ), 10 )
  58. #define COMMENT_COL_NUMBER AsLong( GetResString( IDS_COMMENT_COL_NUMBER ), 10 )
  59. #define TASKSTATE_COL_NUMBER AsLong( GetResString( IDS_TASKSTATE_COL_NUMBER ), 10 )
  60. #define TASKTYPE_COL_NUMBER AsLong( GetResString( IDS_TASKTYPE_COL_NUMBER ), 10 )
  61. #define STARTTIME_COL_NUMBER AsLong( GetResString( IDS_STARTTIME_COL_NUMBER ), 10 )
  62. #define STARTDATE_COL_NUMBER AsLong( GetResString( IDS_STARTDATE_COL_NUMBER ), 10 )
  63. #define ENDDATE_COL_NUMBER AsLong( GetResString( IDS_ENDDATE_COL_NUMBER ), 10 )
  64. #define DAYS_COL_NUMBER AsLong( GetResString( IDS_DAYS_COL_NUMBER ), 10 )
  65. #define MONTHS_COL_NUMBER AsLong( GetResString( IDS_MONTHS_COL_NUMBER ), 10 )
  66. #define RUNASUSER_COL_NUMBER AsLong( GetResString( IDS_RUNASUSER_COL_NUMBER ), 10 )
  67. #define DELETE_IFNOTRESCHEDULED_COL_NUMBER AsLong( GetResString( IDS_DELETE_IFNOTRESCHEDULED_COL_NUMBER ), 10 )
  68. #define STOPTASK_COL_NUMBER AsLong( GetResString( IDS_STOPTASK_COL_NUMBER ), 10 )
  69. #define REPEAT_EVERY_COL_NUMBER AsLong( GetResString( IDS_REPEAT_EVERY_COL_NUMBER ), 10 )
  70. #define REPEAT_UNTILTIME_COL_NUMBER AsLong( GetResString( IDS_REPEAT_UNTILTIME_COL_NUMBER ), 10 )
  71. #define REPEAT_DURATION_COL_NUMBER AsLong( GetResString( IDS_REPEAT_DURATION_COL_NUMBER ), 10 )
  72. #define REPEAT_STOP_COL_NUMBER AsLong( GetResString( IDS_REPEAT_STOP_COL_NUMBER ), 10 )
  73. #define IDLE_COL_NUMBER AsLong( GetResString( IDS_IDLE_COL_NUMBER ), 10 )
  74. #define POWER_COL_NUMBER AsLong( GetResString( IDS_POWER_MGMT_COL_NUMBER ), 10 )
  75. #define COL_FORMAT_STRING _T("%s")
  76. #define COL_FORMAT_HEX _T("%d")
  77. #define COL_SIZE_VERBOSE 3 //for Non-verbose mode only 3 columns
  78. #define COL_SIZE_LIST 4 //for LIST non-verbose mode only 4 columns
  79. #define TIME_DATE_SEPERATOR _T(", ")
  80. #define MAX_DATETIME_LEN 256
  81. #define MAX_TIME_FORMAT_LEN 9
  82. #define VARIABLE_ARGS 2 //for now 2 variable arguments used in FormatMessage() API
  83. //Constants used in GetTaskTime to identify the type of time needed
  84. #define TASK_NEXT_RUNTIME 0x0
  85. #define TASK_LAST_RUNTIME 0x1
  86. #define TASK_START_RUNTIME 0x2
  87. // for -delete option
  88. #define OI_DELSERVER 1 // Index of -s option in cmdOptions structure.
  89. #define OI_DELTASKNAME 2 // Index of -f option in cmdOptions structure.
  90. #define OI_DELFORCE 3 // Index of -f option in cmdOptions structure.
  91. #define OI_DELUSERNAME 5 // Index of -u option in cmdOptions structure.
  92. #define OI_DELPASSWORD 6 // Index of -p option in cmdOptions structure.
  93. // for -query option
  94. #define OI_QSERVER 1 // Index of -s option in cmdOptions structure.
  95. #define OI_QFORMAT 2 // Index of -fo option in cmdOptions structure.
  96. #define OI_QUSERNAME 6 // Index of -u option in cmdOptions structure.
  97. #define OI_QPASSWORD 7 // Index of -p option in cmdOptions structure.
  98. //TaskProperties structure
  99. typedef struct _tagTaskProperties
  100. {
  101. _TCHAR szTaskType[MAX_RES_STRING];
  102. _TCHAR szTaskEndDate[MAX_RES_STRING];
  103. _TCHAR szTaskDays[MAX_RES_STRING];
  104. _TCHAR szTaskMonths[MAX_RES_STRING];
  105. _TCHAR szTaskStartTime[MAX_DATETIME_LEN];
  106. _TCHAR szTaskStartDate[MAX_DATETIME_LEN];
  107. _TCHAR szRepeatEvery[MAX_DATETIME_LEN];
  108. _TCHAR szRepeatUntilTime[MAX_RES_STRING];
  109. _TCHAR szRepeatDuration[MAX_RES_STRING];
  110. _TCHAR szRepeatStop[MAX_RES_STRING];
  111. }TASKPROPS;
  112. //Function prototype declarations
  113. VOID DisplayQueryUsage();
  114. HRESULT DisplayTasks(ITaskScheduler* pITS,BOOL bFilter,DWORD dwFormatType,BOOL bHeader);
  115. HRESULT GetTaskRunTime(ITask* pITask,_TCHAR* pszRunTime,_TCHAR* pszRunDate,DWORD dwTimetype,
  116. WORD wCurrentTrigger);
  117. HRESULT GetApplicationToRun(ITask* pIT,_TCHAR* pszApplicationName);
  118. HRESULT GetWorkingDirectory(ITask* pIT,_TCHAR* pszWorkingDirectory);
  119. HRESULT GetComment(ITask* pIT,_TCHAR* pwszComment);
  120. HRESULT GetCreator(ITask* pITask,_TCHAR* pszCreator);
  121. HRESULT GetTriggerString(ITask* pITask,_TCHAR* pszTrigger,WORD wCurrentTrigger);
  122. HRESULT GetTaskState(ITask* pITask,_TCHAR* pszTaskState,DWORD dwFlag);
  123. HRESULT GetRunAsUser(ITask* pIT,_TCHAR* pszRunAsUser);
  124. HRESULT GetMaxRunTime(ITask* pIT,_TCHAR* pszMaxRunTime);
  125. HRESULT GetTaskProps(ITask* pIT,TASKPROPS* pTaskProps,WORD wCurrentTrigger,_TCHAR* pszScName );
  126. HRESULT GetStatusCode(ITask* pITask,_TCHAR* pszStatusCode);
  127. VOID CheckWeekDay(DWORD dwFlag,_TCHAR* pWeekDay);
  128. VOID CheckMonth(DWORD dwFlag,_TCHAR* pWhichMonth);
  129. VOID CheckWeek(DWORD dwFlag,_TCHAR* pWhichWeek);
  130. LCID GetSupportedUserLocale( BOOL& bLocaleChanged );
  131. #endif