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.

229 lines
7.7 KiB

  1. /*++
  2. Copyright (c) 1988-1999 Microsoft Corporation
  3. Module Name:
  4. cdata.c
  5. Abstract:
  6. Global data
  7. --*/
  8. #include "cmd.h"
  9. TCHAR CrLf[] = TEXT("\r\n"); // M022
  10. TCHAR DBkSpc[] = TEXT("\b \b"); // M022
  11. #if defined(FE_SB)
  12. TCHAR DDBkSpc[] = TEXT("\b\b \b\b");
  13. #endif // defined(FE_SB)
  14. //
  15. // M010 - std_(e)printf format strings
  16. //
  17. TCHAR Fmt00[] = TEXT(" ");
  18. TCHAR Fmt01[] = TEXT(" ");
  19. TCHAR Fmt02[] = TEXT(" %s ");
  20. TCHAR Fmt03[] = TEXT("%-9s%-4s");
  21. TCHAR Fmt04[] = TEXT("%02d%s%02d%s"); // DD/DD?
  22. TCHAR Fmt05[] = TEXT("%2d%s%02d%s%02d"); // DD/DD/DD
  23. TCHAR Fmt06[] = TEXT("%2d%s%02d%s%02d%s%02d"); // DD:DD:DD.DD
  24. TCHAR Fmt08[] = TEXT("%10lu ");
  25. TCHAR Fmt09[] = TEXT("[%s]");
  26. TCHAR Fmt10[] = TEXT("%02d%s%02d%s%02d"); // OO/DD/DD
  27. TCHAR Fmt11[] = TEXT("%s ");
  28. TCHAR Fmt12[] = TEXT("%s %s%s ");
  29. TCHAR Fmt13[] = TEXT("(%s) %s ");
  30. TCHAR Fmt15[] = TEXT("%s %s ");
  31. TCHAR Fmt16[] = TEXT("%s=%s\r\n");
  32. TCHAR Fmt17[] = TEXT("%s\r\n");
  33. TCHAR Fmt18[] = TEXT("%c%c"); // M016 - I/O redirection echo
  34. TCHAR Fmt19[] = TEXT("%c");
  35. TCHAR Fmt20[] = TEXT(">"); // M016 - Additional append symbol
  36. TCHAR Fmt21[] = TEXT(" %03d");
  37. TCHAR Fmt22[] = TEXT("%s%s %03d");
  38. TCHAR Fmt26[] = TEXT("%04X-%04X"); // for volume serial number
  39. TCHAR Fmt27[] = TEXT("%s>"); // default prompt string
  40. //
  41. // M010 - command name strings
  42. //
  43. TCHAR AppendStr[] = TEXT("DPATH"); // @@ - Added APPEND command
  44. TCHAR CallStr[] = TEXT("CALL"); // M005 - Added CALL command
  45. TCHAR CdStr[] = TEXT("CD");
  46. TCHAR ColorStr[] = TEXT("COLOR");
  47. TCHAR TitleStr[] = TEXT("TITLE");
  48. TCHAR ChdirStr[] = TEXT("CHDIR");
  49. TCHAR ClsStr[] = TEXT("CLS");
  50. TCHAR CmdExtVerStr[]= TEXT("CMDEXTVERSION");
  51. TCHAR DefinedStr[] = TEXT("DEFINED");
  52. TCHAR CopyStr[] = TEXT("COPY");
  53. TCHAR CPathStr[] = TEXT("PATH");
  54. TCHAR CPromptStr[] = TEXT("PROMPT");
  55. TCHAR PushDirStr[] = TEXT("PUSHD");
  56. TCHAR PopDirStr[] = TEXT("POPD");
  57. TCHAR AssocStr[] = TEXT("ASSOC");
  58. TCHAR FTypeStr[] = TEXT("FTYPE");
  59. TCHAR DatStr[] = TEXT("DATE");
  60. TCHAR DelStr[] = TEXT("DEL");
  61. TCHAR DirStr[] = TEXT("DIR");
  62. TCHAR DoStr[] = TEXT("DO");
  63. TCHAR EchoStr[] = TEXT("ECHO");
  64. TCHAR ElseStr[] = TEXT("ELSE");
  65. TCHAR EndlocalStr[] = TEXT("ENDLOCAL"); // M004 - For Endlocal command
  66. TCHAR EraStr[] = TEXT("ERASE");
  67. TCHAR ErrStr[] = TEXT("ERRORLEVEL");
  68. TCHAR ExitStr[] = TEXT("EXIT");
  69. TCHAR ExsStr[] = TEXT("EXIST");
  70. TCHAR BreakStr[] = TEXT("BREAK");
  71. #if 0
  72. TCHAR ExtprocStr[] = TEXT("EXTPROC"); // M007 - For EXTPROC command
  73. #endif
  74. TCHAR ForStr[] = TEXT("FOR");
  75. TCHAR ForHelpStr[] = TEXT("FOR/?");
  76. TCHAR ForLoopStr[] = TEXT("/L");
  77. TCHAR ForDirTooStr[]= TEXT("/D");
  78. TCHAR ForParseStr[] = TEXT("/F");
  79. TCHAR ForRecurseStr[]=TEXT("/R");
  80. TCHAR GotoStr[] = TEXT("GOTO");
  81. TCHAR GotoEofStr[] = TEXT(":EOF");
  82. TCHAR IfStr[] = TEXT("IF");
  83. TCHAR IfHelpStr[] = TEXT("IF/?");
  84. TCHAR InStr[] = TEXT("IN");
  85. CHAR InternalError[] = "\nCMD Internal Error %s\n"; // M028 10,...,10
  86. TCHAR KeysStr[] = TEXT("KEYS"); // @@5 - Keys internal command
  87. TCHAR MkdirStr[] = TEXT("MKDIR");
  88. TCHAR MdStr[] = TEXT("MD");
  89. TCHAR NotStr[] = TEXT("NOT");
  90. TCHAR PausStr[] = TEXT("PAUSE");
  91. TCHAR RdStr[] = TEXT("RD");
  92. TCHAR RemStr[] = TEXT("REM");
  93. TCHAR RemHelpStr[] = TEXT("REM/?");
  94. TCHAR MovStr[] = TEXT("MOVE");
  95. TCHAR RenamStr[] = TEXT("RENAME");
  96. TCHAR RenStr[] = TEXT("REN");
  97. TCHAR RmdirStr[] = TEXT("RMDIR");
  98. TCHAR SetStr[] = TEXT("SET");
  99. TCHAR SetArithStr[] = TEXT("/A");
  100. TCHAR SetPromptStr[]= TEXT("/P");
  101. TCHAR SetlocalStr[] = TEXT("SETLOCAL"); // M004 - For Setlocal command
  102. TCHAR ShiftStr[] = TEXT("SHIFT");
  103. TCHAR StartStr[] = TEXT("START"); // @@ - Start Command
  104. TCHAR TimStr[] = TEXT("TIME");
  105. TCHAR TypStr[] = TEXT("TYPE");
  106. TCHAR VeriStr[] = TEXT("VERIFY");
  107. TCHAR VerStr[] = TEXT("VER");
  108. TCHAR VolStr[] = TEXT("VOL");
  109. //
  110. // Strings for string compares
  111. //
  112. TCHAR BatExt[] = TEXT(".BAT"); // @@ old bat file extionsion
  113. TCHAR CmdExt[] = TEXT(".CMD"); // @@ new bat file extionsion
  114. TCHAR ComSpec[] = TEXT("\\CMD.EXE"); // M017
  115. TCHAR ComSpecStr[] = TEXT("COMSPEC");
  116. TCHAR ComExt[] = TEXT(".COM");
  117. TCHAR Delimiters[] = TEXT("=,;");
  118. TCHAR Delim2[] = TEXT(":.+/[]\\ \t\""); // 20H,09H,22H;
  119. TCHAR Delim3[] = TEXT("=,"); // Delimiters - no semicolon
  120. TCHAR Delim4[] = TEXT("=,;+/[] \t\""); // Command delimeters - no path characters
  121. TCHAR Delim5[] = TEXT(":.\\"); // Possible command delimeters - path characters
  122. TCHAR DevNul[] = TEXT("\\DEV\\NUL");
  123. TCHAR ExeExt[] = TEXT(".EXE");
  124. TCHAR PathStr[] = TEXT("PATH");
  125. TCHAR PathExtStr[] = TEXT("PATHEXT");
  126. TCHAR PathExtDefaultStr[] = TEXT(".COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS");
  127. TCHAR PromptStr[] = TEXT("PROMPT");
  128. TCHAR VolSrch[] = TEXT(" :\\*"); // Vol ID search (ctools1.c) LNS
  129. //
  130. // Character Definitions
  131. //
  132. TCHAR BSlash = BSLASH; // M017 - Restored this char
  133. TCHAR DPSwitch = TEXT('P');
  134. TCHAR DWSwitch = TEXT('W');
  135. TCHAR EqualSign = EQ;
  136. TCHAR PathChar = BSLASH; // M000
  137. TCHAR PCSwitch = TEXT('p');
  138. TCHAR BCSwitch = TEXT('k'); // @@ - add /K switch to cmd.exe
  139. TCHAR SCSwitch = TEXT('c');
  140. TCHAR QCSwitch = TEXT('q'); // @@dv - add /Q switch to cmd.exe
  141. TCHAR DCSwitch = TEXT('b'); // add /B switch to cmd.exe
  142. TCHAR UCSwitch = TEXT('u'); // add /U switch to cmd.exe
  143. TCHAR ACSwitch = TEXT('a'); // add /A switch to cmd.exe
  144. TCHAR XCSwitch = TEXT('x'); // add /X switch to cmd.exe
  145. TCHAR YCSwitch = TEXT('y'); // add /Y switch to cmd.exe
  146. TCHAR SwitChar = SWITCHAR; // M000
  147. //
  148. // TmpBuf is a TMPBUFLEN byte temporary buffer which can be used by any function
  149. // so long as the function's use does not confict with any of the other uses
  150. // of the buffer. It is HIGHLY reccommended that this buffer be used in place
  151. // of mallocing data or declaring new global variables whenever possible.
  152. //
  153. // Once you have determined that your new use of the buffer does not conflict
  154. // with current uses of the buffer, add an entry in the table below.
  155. //
  156. //
  157. // TCHAR RANGE
  158. // USED WHERE USED REFERENCED BY HOW LONG NEEDED
  159. // -----------+-------------+---------------------+--------------------------
  160. // 0 - 1024| cparse.c | All of the parser | During parsing and lexing
  161. // | | via TokBuf |
  162. // 0 - 128 | cinit.c | SetUpEnvironment() | During init
  163. // | | Init() |
  164. // 0 - 513 | cbatch.c | BatLoop(), SetBat() | During batch processing
  165. // | | eGoTo() | During label search
  166. // 0 - 141 | cfile.c | DelWork() | Tmp buffer for path
  167. // 0 - 141 | | RenWork() | Tmp buffer for path
  168. //
  169. //
  170. // *** NOTE: In some circumstances it may be beneficial to break up allocation
  171. // of this buffer and intermix other labels in it. In this way, you can
  172. // address a particular portion of the buffer without having to declare
  173. // another variable in your code to do so.
  174. //
  175. // *** WARNING *** If this buffer is used incorrectly bad things may happen
  176. // Bugs which are EXTREMELY difficult to track down could be introduce
  177. // if we are not VERY careful using this buffer.
  178. //
  179. // *** WARNING *** When referencing TmpBuf in C files, make sure that TmpBuf
  180. // is declared as an array; NOT as a pointer.
  181. //
  182. //
  183. TCHAR TmpBuf[TMPBUFLEN];
  184. CHAR AnsiBuf[LBUFLEN];
  185. HMODULE hKernel32 = INVALID_HANDLE_VALUE;