Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencmd.h
Go to the documentation of this file.
00001 /* 00002 * CMD.H - header file for the modules in CMD.EXE 00003 * 00004 * 00005 * History: 00006 * 00007 * 7-15-95 Tim Norman 00008 * started 00009 * 00010 * 06/29/98 (Rob Lake) 00011 * Moved error messages in here 00012 * 00013 * 07/12/98 (Rob Lake) 00014 * Moved more error messages here. 00015 * 00016 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>) 00017 * Added compile date to version. 00018 * 00019 * 26-Feb-1999 (Eric Kohl) 00020 * Introduced a new version string. 00021 * Thanks to Emanuele Aliberti! 00022 */ 00023 00024 #pragma once 00025 00026 #include "config.h" 00027 00028 #include <windows.h> 00029 #include <tchar.h> 00030 00031 #include "cmdver.h" 00032 00033 #include "cmddbg.h" 00034 00035 #define BREAK_BATCHFILE 1 00036 #define BREAK_OUTOFBATCH 2 00037 #define BREAK_INPUT 3 00038 #define BREAK_IGNORE 4 00039 00040 /* define some error messages */ 00041 00042 #define D_ON _T("on") 00043 #define D_OFF _T("off") 00044 00045 00046 /* command line buffer length */ 00047 #define CMDLINE_LENGTH 8192 00048 00049 /* 16k = max buffer size */ 00050 #define BUFF_SIZE 16384 00051 00052 /* global variables */ 00053 extern HANDLE hOut; 00054 extern HANDLE hIn; 00055 extern LPTSTR lpOriginalEnvironment; 00056 extern WORD wColor; 00057 extern WORD wDefColor; 00058 extern BOOL bCtrlBreak; 00059 extern BOOL bIgnoreEcho; 00060 extern BOOL bExit; 00061 extern BOOL bDisableBatchEcho; 00062 extern BOOL bDelayedExpansion; 00063 extern INT nErrorLevel; 00064 extern SHORT maxx; 00065 extern SHORT maxy; 00066 extern OSVERSIONINFO osvi; 00067 extern BOOL bUnicodeOutput; 00068 00069 00070 /* Prototypes for ALIAS.C */ 00071 VOID ExpandAlias (LPTSTR, INT); 00072 INT CommandAlias (LPTSTR); 00073 00074 /* Prototypes for ASSOC.C */ 00075 INT CommandAssoc (LPTSTR); 00076 00077 /* Prototypes for ATTRIB.C */ 00078 INT CommandAttrib (LPTSTR); 00079 00080 00081 /* Prototypes for BEEP.C */ 00082 INT cmd_beep (LPTSTR); 00083 00084 00085 /* Prototypes for CALL.C */ 00086 INT cmd_call (LPTSTR); 00087 00088 00089 /* Prototypes for CHCP.C */ 00090 INT CommandChcp (LPTSTR); 00091 00092 00093 /* Prototypes for CHOICE.C */ 00094 INT CommandChoice (LPTSTR); 00095 00096 00097 /* Prototypes for CLS.C */ 00098 INT cmd_cls (LPTSTR); 00099 00100 00101 /* Prototypes for CMD.C */ 00102 INT ConvertULargeInteger(ULONGLONG num, LPTSTR des, UINT len, BOOL bPutSeperator); 00103 HANDLE RunFile(DWORD, LPTSTR, LPTSTR, LPTSTR, INT); 00104 INT ParseCommandLine(LPTSTR); 00105 struct _PARSED_COMMAND; 00106 INT ExecuteCommand(struct _PARSED_COMMAND *Cmd); 00107 LPCTSTR GetEnvVarOrSpecial ( LPCTSTR varName ); 00108 VOID AddBreakHandler (VOID); 00109 VOID RemoveBreakHandler (VOID); 00110 BOOL SubstituteVars(TCHAR *Src, TCHAR *Dest, TCHAR Delim); 00111 BOOL SubstituteForVars(TCHAR *Src, TCHAR *Dest); 00112 LPTSTR DoDelayedExpansion(LPTSTR Line); 00113 INT DoCommand(LPTSTR first, LPTSTR rest, struct _PARSED_COMMAND *Cmd); 00114 BOOL ReadLine(TCHAR *commandline, BOOL bMore); 00115 int cmd_main (int argc, const TCHAR *argv[]); 00116 00117 extern HANDLE CMD_ModuleHandle; 00118 00119 00120 /* Prototypes for CMDINPUT.C */ 00121 BOOL ReadCommand (LPTSTR, INT); 00122 00123 00124 /* Prototypes for CMDTABLE.C */ 00125 #define CMD_SPECIAL 1 00126 #define CMD_BATCHONLY 2 00127 #define CMD_HIDE 4 00128 00129 typedef struct tagCOMMAND 00130 { 00131 LPTSTR name; 00132 INT flags; 00133 INT (*func)(LPTSTR); 00134 } COMMAND, *LPCOMMAND; 00135 00136 extern COMMAND cmds[]; /* The internal command table */ 00137 00138 VOID PrintCommandList (VOID); 00139 VOID PrintCommandListDetail (VOID); 00140 00141 00142 LPCTSTR GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA ); 00143 00144 /* Prototypes for COLOR.C */ 00145 VOID SetScreenColor(WORD wArgColor, BOOL bFill); 00146 INT CommandColor (LPTSTR); 00147 00148 VOID ConInDummy (VOID); 00149 VOID ConInDisable (VOID); 00150 VOID ConInEnable (VOID); 00151 VOID ConInFlush (VOID); 00152 VOID ConInKey (PINPUT_RECORD); 00153 VOID ConInString (LPTSTR, DWORD); 00154 00155 VOID ConOutChar (TCHAR); 00156 VOID ConOutPuts (LPTSTR); 00157 VOID ConPrintf(LPTSTR, va_list, DWORD); 00158 INT ConPrintfPaging(BOOL NewPage, LPTSTR, va_list, DWORD); 00159 VOID ConOutPrintf (LPTSTR, ...); 00160 INT ConOutPrintfPaging (BOOL NewPage, LPTSTR, ...); 00161 VOID ConErrChar (TCHAR); 00162 VOID ConErrPuts (LPTSTR); 00163 VOID ConErrPrintf (LPTSTR, ...); 00164 VOID ConOutFormatMessage (DWORD MessageId, ...); 00165 VOID ConErrFormatMessage (DWORD MessageId, ...); 00166 00167 SHORT GetCursorX (VOID); 00168 SHORT GetCursorY (VOID); 00169 VOID GetCursorXY (PSHORT, PSHORT); 00170 VOID SetCursorXY (SHORT, SHORT); 00171 00172 VOID GetScreenSize (PSHORT, PSHORT); 00173 VOID SetCursorType (BOOL, BOOL); 00174 00175 VOID ConOutResPuts (UINT resID); 00176 VOID ConErrResPuts (UINT resID); 00177 VOID ConOutResPrintf (UINT resID, ...); 00178 VOID ConErrResPrintf (UINT resID, ...); 00179 VOID ConOutResPaging(BOOL NewPage, UINT resID); 00180 00181 /* Prototypes for COPY.C */ 00182 INT cmd_copy (LPTSTR); 00183 00184 00185 /* Prototypes for DATE.C */ 00186 INT cmd_date (LPTSTR); 00187 00188 00189 /* Prototypes for DEL.C */ 00190 INT CommandDelete (LPTSTR); 00191 00192 00193 /* Prototypes for DELAY.C */ 00194 INT CommandDelay (LPTSTR); 00195 00196 00197 /* Prototypes for DIR.C */ 00198 INT FormatDate (TCHAR *, LPSYSTEMTIME, BOOL); 00199 INT FormatTime (TCHAR *, LPSYSTEMTIME); 00200 INT CommandDir (LPTSTR); 00201 00202 00203 /* Prototypes for DIRSTACK.C */ 00204 VOID InitDirectoryStack (VOID); 00205 VOID DestroyDirectoryStack (VOID); 00206 INT GetDirectoryStackDepth (VOID); 00207 INT CommandPushd (LPTSTR); 00208 INT CommandPopd (LPTSTR); 00209 INT CommandDirs (LPTSTR); 00210 00211 00212 /* Prototypes for ECHO.C */ 00213 BOOL OnOffCommand(LPTSTR param, LPBOOL flag, INT message); 00214 INT CommandEcho (LPTSTR); 00215 INT CommandEchos (LPTSTR); 00216 INT CommandEchoerr (LPTSTR); 00217 INT CommandEchoserr (LPTSTR); 00218 00219 00220 /* Prototypes for ERROR.C */ 00221 VOID ErrorMessage (DWORD, LPTSTR, ...); 00222 00223 VOID error_no_pipe (VOID); 00224 VOID error_bad_command (LPTSTR); 00225 VOID error_invalid_drive (VOID); 00226 VOID error_req_param_missing (VOID); 00227 VOID error_sfile_not_found (LPTSTR); 00228 VOID error_file_not_found (VOID); 00229 VOID error_path_not_found (VOID); 00230 VOID error_too_many_parameters (LPTSTR); 00231 VOID error_parameter_format(TCHAR); 00232 VOID error_invalid_switch (TCHAR); 00233 VOID error_invalid_parameter_format (LPTSTR); 00234 VOID error_out_of_memory (VOID); 00235 VOID error_syntax (LPTSTR); 00236 00237 VOID msg_pause (VOID); 00238 00239 00240 /* Prototypes for FILECOMP.C */ 00241 #ifdef FEATURE_UNIX_FILENAME_COMPLETION 00242 VOID CompleteFilename (LPTSTR, UINT); 00243 INT ShowCompletionMatches (LPTSTR, INT); 00244 #endif 00245 #ifdef FEATURE_4NT_FILENAME_COMPLETION 00246 VOID CompleteFilename (LPTSTR, BOOL, LPTSTR, UINT); 00247 #endif 00248 00249 00250 /* Prototypes for FOR.C */ 00251 #define FOR_DIRS 1 /* /D */ 00252 #define FOR_F 2 /* /F */ 00253 #define FOR_LOOP 4 /* /L */ 00254 #define FOR_RECURSIVE 8 /* /R */ 00255 INT cmd_for (LPTSTR); 00256 INT ExecuteFor(struct _PARSED_COMMAND *Cmd); 00257 00258 00259 /* Prototypes for FREE.C */ 00260 INT CommandFree (LPTSTR); 00261 00262 00263 /* Prototypes for GOTO.C */ 00264 INT cmd_goto (LPTSTR); 00265 00266 00267 /* Prototypes for HISTORY.C */ 00268 #ifdef FEATURE_HISTORY 00269 LPCTSTR PeekHistory(INT); 00270 VOID History (INT, LPTSTR);/*add entries browse history*/ 00271 VOID History_move_to_bottom(VOID);/*F3*/ 00272 VOID InitHistory(VOID); 00273 VOID CleanHistory(VOID); 00274 VOID History_del_current_entry(LPTSTR str);/*CTRL-D*/ 00275 INT CommandHistory (LPTSTR param); 00276 #endif 00277 00278 00279 /* Prototypes for IF.C */ 00280 #define IFFLAG_NEGATE 1 /* NOT */ 00281 #define IFFLAG_IGNORECASE 2 /* /I */ 00282 enum { IF_CMDEXTVERSION, IF_DEFINED, IF_ERRORLEVEL, IF_EXIST, 00283 IF_STRINGEQ, /* == */ 00284 IF_EQU, IF_GTR, IF_GEQ, IF_LSS, IF_LEQ, IF_NEQ }; 00285 INT ExecuteIf(struct _PARSED_COMMAND *Cmd); 00286 00287 00288 /* Prototypes for INTERNAL.C */ 00289 VOID InitLastPath (VOID); 00290 VOID FreeLastPath (VOID); 00291 INT cmd_chdir (LPTSTR); 00292 INT cmd_mkdir (LPTSTR); 00293 INT cmd_rmdir (LPTSTR); 00294 INT CommandExit (LPTSTR); 00295 INT CommandRem (LPTSTR); 00296 INT CommandShowCommands (LPTSTR); 00297 INT CommandShowCommandsDetail (LPTSTR); 00298 00299 /* Prototypes for LABEL.C */ 00300 INT cmd_label (LPTSTR); 00301 00302 00303 /* Prototypes for LOCALE.C */ 00304 extern TCHAR cDateSeparator; 00305 extern INT nDateFormat; 00306 extern TCHAR cTimeSeparator; 00307 extern INT nTimeFormat; 00308 extern TCHAR cThousandSeparator; 00309 extern TCHAR cDecimalSeparator; 00310 extern INT nNumberGroups; 00311 00312 00313 VOID InitLocale (VOID); 00314 LPTSTR GetDateString (VOID); 00315 LPTSTR GetTimeString (VOID); 00316 00317 /* cache codepage */ 00318 extern UINT InputCodePage; 00319 extern UINT OutputCodePage; 00320 00321 /* Prototypes for MEMORY.C */ 00322 INT CommandMemory (LPTSTR); 00323 00324 00325 /* Prototypes for MKLINK.C */ 00326 INT cmd_mklink(LPTSTR); 00327 00328 00329 /* Prototypes for MISC.C */ 00330 INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size); 00331 BOOL SetRootPath(TCHAR *oldpath,TCHAR *InPath); 00332 TCHAR cgetchar (VOID); 00333 BOOL CheckCtrlBreak (INT); 00334 BOOL add_entry (LPINT ac, LPTSTR **arg, LPCTSTR entry); 00335 LPTSTR *split (LPTSTR, LPINT, BOOL, BOOL); 00336 LPTSTR *splitspace (LPTSTR, LPINT); 00337 VOID freep (LPTSTR *); 00338 LPTSTR _stpcpy (LPTSTR, LPCTSTR); 00339 VOID StripQuotes(LPTSTR); 00340 BOOL IsValidPathName (LPCTSTR); 00341 BOOL IsExistingFile (LPCTSTR); 00342 BOOL IsExistingDirectory (LPCTSTR); 00343 BOOL FileGetString (HANDLE, LPTSTR, INT); 00344 VOID GetPathCase(TCHAR *, TCHAR *); 00345 00346 #define PROMPT_NO 0 00347 #define PROMPT_YES 1 00348 #define PROMPT_ALL 2 00349 #define PROMPT_BREAK 3 00350 00351 INT PagePrompt (VOID); 00352 INT FilePromptYN (UINT); 00353 INT FilePromptYNA (UINT); 00354 00355 00356 /* Prototypes for MOVE.C */ 00357 INT cmd_move (LPTSTR); 00358 00359 00360 /* Prototypes for MSGBOX.C */ 00361 INT CommandMsgbox (LPTSTR); 00362 00363 00364 /* Prototypes from PARSER.C */ 00365 enum { C_COMMAND, C_QUIET, C_BLOCK, C_MULTI, C_IFFAILURE, C_IFSUCCESS, C_PIPE, C_IF, C_FOR }; 00366 typedef struct _PARSED_COMMAND 00367 { 00368 struct _PARSED_COMMAND *Subcommands; 00369 struct _PARSED_COMMAND *Next; 00370 struct _REDIRECTION *Redirections; 00371 BYTE Type; 00372 union 00373 { 00374 struct 00375 { 00376 TCHAR *Rest; 00377 TCHAR First[]; 00378 } Command; 00379 struct 00380 { 00381 BYTE Flags; 00382 BYTE Operator; 00383 TCHAR *LeftArg; 00384 TCHAR *RightArg; 00385 } If; 00386 struct 00387 { 00388 BYTE Switches; 00389 TCHAR Variable; 00390 LPTSTR Params; 00391 LPTSTR List; 00392 struct tagFORCONTEXT *Context; 00393 } For; 00394 }; 00395 } PARSED_COMMAND; 00396 PARSED_COMMAND *ParseCommand(LPTSTR Line); 00397 VOID EchoCommand(PARSED_COMMAND *Cmd); 00398 TCHAR *Unparse(PARSED_COMMAND *Cmd, TCHAR *Out, TCHAR *OutEnd); 00399 VOID FreeCommand(PARSED_COMMAND *Cmd); 00400 00401 00402 /* Prototypes from PATH.C */ 00403 INT cmd_path (LPTSTR); 00404 00405 00406 /* Prototypes from PROMPT.C */ 00407 VOID PrintPrompt (VOID); 00408 INT cmd_prompt (LPTSTR); 00409 00410 00411 /* Prototypes for REDIR.C */ 00412 enum { REDIR_READ, REDIR_WRITE, REDIR_APPEND }; 00413 typedef struct _REDIRECTION 00414 { 00415 struct _REDIRECTION *Next; 00416 HANDLE OldHandle; 00417 BYTE Number; 00418 BYTE Type; 00419 TCHAR Filename[]; 00420 } REDIRECTION; 00421 BOOL PerformRedirection(REDIRECTION *); 00422 VOID UndoRedirection(REDIRECTION *, REDIRECTION *End); 00423 INT GetRedirection(LPTSTR, REDIRECTION **); 00424 VOID FreeRedirection(REDIRECTION *); 00425 00426 00427 /* Prototypes for REN.C */ 00428 INT cmd_rename (LPTSTR); 00429 00430 /* Prototypes for REN.C */ 00431 INT cmd_replace (LPTSTR); 00432 00433 /* Prototypes for SCREEN.C */ 00434 INT CommandScreen (LPTSTR); 00435 00436 00437 /* Prototypes for SET.C */ 00438 INT cmd_set (LPTSTR); 00439 00440 /* Prototypes for SETLOCAL.C */ 00441 LPTSTR DuplicateEnvironment(VOID); 00442 INT cmd_setlocal (LPTSTR); 00443 INT cmd_endlocal (LPTSTR); 00444 00445 /* Prototypes for START.C */ 00446 INT cmd_start (LPTSTR); 00447 00448 00449 /* Prototypes for STRTOCLR.C */ 00450 BOOL StringToColor (LPWORD, LPTSTR *); 00451 00452 00453 /* Prototypes for TIME.C */ 00454 INT cmd_time (LPTSTR); 00455 00456 00457 /* Prototypes for TIMER.C */ 00458 INT CommandTimer (LPTSTR param); 00459 00460 00461 /* Prototypes for TITLE.C */ 00462 INT cmd_title (LPTSTR); 00463 00464 00465 /* Prototypes for TYPE.C */ 00466 INT cmd_type (LPTSTR); 00467 00468 00469 /* Prototypes for VER.C */ 00470 VOID ShortVersion (VOID); 00471 INT cmd_ver (LPTSTR); 00472 00473 00474 /* Prototypes for VERIFY.C */ 00475 INT cmd_verify (LPTSTR); 00476 00477 00478 /* Prototypes for VOL.C */ 00479 INT cmd_vol (LPTSTR); 00480 00481 00482 /* Prototypes for WHERE.C */ 00483 BOOL SearchForExecutable (LPCTSTR, LPTSTR); 00484 00485 /* Prototypes for WINDOW.C */ 00486 INT CommandActivate (LPTSTR); 00487 INT CommandWindow (LPTSTR); 00488 00489 00490 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */ 00491 int cmd_if(TCHAR *); 00492 int cmd_pause(TCHAR *); 00493 int cmd_shift(TCHAR *); Generated on Sun May 27 2012 04:18:10 for ReactOS by
1.7.6.1
|