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.

182 lines
4.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1996.
  5. //
  6. // File: parse.hxx
  7. //
  8. // Contents: Types and prototypes for command line parsing routines.
  9. //
  10. // History: 04-20-95 DavidMun Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __PARSE_HXX_
  14. #define __PARSE_HXX_
  15. //
  16. // Types
  17. //
  18. // TOKEN - when words are read from the command line and recognized, they're
  19. // assigned a token value.
  20. //
  21. enum TOKEN
  22. {
  23. //
  24. // The following tokens have a 1:1 mapping to the strings in g_awszTokens
  25. //
  26. //
  27. // Commands
  28. //
  29. // CAUTION: if you insert before the first or after the last command,
  30. // make sure that you update FIRST_COMMAND and LAST_COMMAND appropriately
  31. //
  32. FIRST_COMMAND,
  33. TKN_ABORTJOB = FIRST_COMMAND,
  34. TKN_ABORTQUEUE,
  35. TKN_ADDJOBTOQUEUE,
  36. TKN_CONVERTSAGETASKSTOJOBS,
  37. TKN_CREATETRIGGERJOB,
  38. TKN_CREATETRIGGERQUEUE,
  39. TKN_DELETETRIGGERJOB,
  40. TKN_DELETETRIGGERQUEUE,
  41. TKN_EDITJOB,
  42. TKN_EDITJOBINQUEUE,
  43. TKN_ENUMCLONE,
  44. TKN_ENUMNEXT,
  45. TKN_ENUMRESET,
  46. TKN_ENUMSKIP,
  47. TKN_GETCREDENTIALS,
  48. TKN_GETMACHINE,
  49. TKN_LOADJOB,
  50. TKN_LOADQUEUE,
  51. TKN_NSGETACCOUNTINFO,
  52. TKN_NSSETACCOUNTINFO,
  53. TKN_PRINTJOB,
  54. TKN_PRINTQUEUE,
  55. TKN_PRINTRUNTIMEJOB,
  56. TKN_PRINTRUNTIMEQUEUE,
  57. TKN_PRINTSTRINGJOB,
  58. TKN_PRINTSTRINGQUEUE,
  59. TKN_PRINTTRIGGERJOB,
  60. TKN_PRINTTRIGGERQUEUE,
  61. TKN_RUNJOB,
  62. TKN_RUNQUEUE,
  63. TKN_REMOVEJOBFROMQUEUE,
  64. TKN_SCHEDACTIVATE,
  65. TKN_SCHEDADDJOB,
  66. TKN_SCHEDADDQUEUE,
  67. TKN_SETCREDENTIALS,
  68. TKN_SCHEDCREATEENUM,
  69. TKN_SCHEDDELETE,
  70. TKN_SCHEDENUM,
  71. TKN_SCHEDISJOBORQUEUE,
  72. TKN_SETJOB,
  73. TKN_SETMACHINE,
  74. TKN_SCHEDNEWJOB,
  75. TKN_SCHEDNEWQUEUE,
  76. TKN_SETQUEUE,
  77. TKN_SETTRIGGERJOB,
  78. TKN_SETTRIGGERQUEUE,
  79. TKN_SAVEJOB,
  80. TKN_SAVEQUEUE,
  81. LAST_COMMAND = TKN_SAVEQUEUE,
  82. // properties for creating/editing jobs & triggers
  83. TKN_APPNAME,
  84. TKN_PARAMS,
  85. TKN_WORKINGDIRECTORY,
  86. TKN_COMMENT,
  87. TKN_CREATOR,
  88. TKN_PRIORITY,
  89. TKN_MAXRUNTIME,
  90. TKN_TASKFLAGS,
  91. TKN_INTERACTIVE,
  92. TKN_DELETEWHENDONE,
  93. TKN_SUSPEND,
  94. TKN_NETSCHEDULE,
  95. TKN_DONTRUNONBATTERIES,
  96. TKN_KILLIFGOINGONBATS,
  97. TKN_RUNONLYIFLOGGEDON,
  98. TKN_HIDDEN,
  99. TKN_STARTDATE,
  100. TKN_ENDDATE,
  101. TKN_STARTTIME,
  102. TKN_MINUTESDURATION,
  103. TKN_HASENDDATE,
  104. TKN_KILLATDURATION,
  105. TKN_ONLYIFIDLE,
  106. TKN_KILLATIDLEEND,
  107. TKN_RESTARTONIDLERESUME,
  108. TKN_SYSTEMREQUIRED,
  109. TKN_DISABLED,
  110. TKN_MINUTESINTERVAL,
  111. TKN_TYPE,
  112. TKN_TYPEARGUMENTS,
  113. TKN_IDLE,
  114. TKN_NORMAL,
  115. TKN_HIGH,
  116. TKN_REALTIME,
  117. TKN_ONEDAY,
  118. TKN_DAILY,
  119. TKN_WEEKLY,
  120. TKN_MONTHLYDATE,
  121. TKN_MONTHLYDOW,
  122. TKN_YEARLYDATE,
  123. TKN_YEARLYDOW,
  124. TKN_ONIDLE,
  125. TKN_ATSTARTUP,
  126. TKN_ATLOGON,
  127. // misc
  128. TKN_TODAY,
  129. TKN_NOW,
  130. TKN_EQUAL,
  131. TKN_ATSIGN,
  132. TKN_QUESTION,
  133. TKN_COLON,
  134. TKN_COMMA,
  135. TKN_BANG,
  136. //
  137. // The following tokens map to more than one string and are therefore not
  138. // represented in g_awszTokens.
  139. //
  140. TKN_SWITCH,
  141. TKN_STRING,
  142. TKN_NUMBER,
  143. //
  144. // The following metatokens do not correspond to any specific string.
  145. //
  146. TKN_EOL,
  147. TKN_INVALID
  148. };
  149. inline BOOL IsCommandToken(TOKEN tkn)
  150. {
  151. return tkn >= FIRST_COMMAND && tkn <= LAST_COMMAND;
  152. }
  153. HRESULT ProcessCommandLine(WCHAR *pwszCommandLine);
  154. VOID LogSyntaxError(TOKEN tkn, WCHAR *pwszExpected);
  155. TOKEN GetToken(WCHAR **ppwsz);
  156. TOKEN PeekToken(WCHAR **ppwsz);
  157. HRESULT GetFilename(WCHAR **ppwsz, WCHAR *wszExpected);
  158. HRESULT Expect(TOKEN tknExpected, WCHAR **ppwsz, WCHAR *wszExpected);
  159. HRESULT ParseDate(WCHAR **ppwsz, WORD *pwMonth, WORD *pwDay, WORD *pwYear);
  160. HRESULT ParseTime(WCHAR **ppwsz, WORD *pwHour, WORD *pwMinute);
  161. HRESULT ParseDaysOfWeek(WCHAR **ppwsz, WORD *pwDaysOfTheWeek);
  162. HRESULT ParseMonths(WCHAR **ppwsz, WORD *pwMonths);
  163. HRESULT ParseDaysOfMonth(WCHAR **ppwsz, DWORD *pdwDays);
  164. WCHAR *GetTokenStringForLogging(TOKEN tkn);
  165. #endif // __PARSE_HXX_