some more win32k 64 bit fixes
[reactos.git] / reactos / base / shell / cmd / cmd.h
1 /*
2 * CMD.H - header file for the modules in CMD.EXE
3 *
4 *
5 * History:
6 *
7 * 7-15-95 Tim Norman
8 * started
9 *
10 * 06/29/98 (Rob Lake)
11 * Moved error messages in here
12 *
13 * 07/12/98 (Rob Lake)
14 * Moved more error messages here.
15 *
16 * 30-Jul-1998 (John P Price <linux-guru@gcfl.net>)
17 * Added compile date to version.
18 *
19 * 26-Feb-1999 (Eric Kohl)
20 * Introduced a new version string.
21 * Thanks to Emanuele Aliberti!
22 */
23
24 #ifndef _CMD_H_INCLUDED_
25 #define _CMD_H_INCLUDED_
26
27 #include "config.h"
28
29 #include <windows.h>
30 #include <tchar.h>
31
32 #include "cmdver.h"
33
34 #include "cmddbg.h"
35
36 #define BREAK_BATCHFILE 1
37 #define BREAK_OUTOFBATCH 2
38 #define BREAK_INPUT 3
39 #define BREAK_IGNORE 4
40
41 /* define some error messages */
42
43 #define D_ON _T("on")
44 #define D_OFF _T("off")
45
46
47 /* command line buffer length */
48 #define CMDLINE_LENGTH 8192
49
50 /* 16k = max buffer size */
51 #define BUFF_SIZE 16384
52
53 /* global variables */
54 extern HANDLE hOut;
55 extern HANDLE hIn;
56 extern HANDLE hConsole;
57 extern WORD wColor;
58 extern WORD wDefColor;
59 extern BOOL bCtrlBreak;
60 extern BOOL bIgnoreEcho;
61 extern BOOL bExit;
62 extern INT nErrorLevel;
63 extern SHORT maxx;
64 extern SHORT maxy;
65 extern OSVERSIONINFO osvi;
66
67
68
69 /* Prototypes for ALIAS.C */
70 VOID ExpandAlias (LPTSTR, INT);
71 INT CommandAlias (LPTSTR, LPTSTR);
72
73 /* Prototypes for ATTRIB.C */
74 INT CommandAttrib (LPTSTR, LPTSTR);
75
76
77 /* Prototypes for BEEP.C */
78 INT cmd_beep (LPTSTR, LPTSTR);
79
80
81 /* Prototypes for CALL.C */
82 INT cmd_call (LPTSTR, LPTSTR);
83
84
85 /* Prototypes for CHCP.C */
86 INT CommandChcp (LPTSTR, LPTSTR);
87
88
89 /* Prototypes for CHOICE.C */
90 INT CommandChoice (LPTSTR, LPTSTR);
91
92
93 /* Prototypes for CLS.C */
94 INT cmd_cls (LPTSTR, LPTSTR);
95
96
97 /* Prototypes for CMD.C */
98 INT ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperator);
99 VOID ParseCommandLine (LPTSTR);
100 LPCTSTR GetEnvVarOrSpecial ( LPCTSTR varName );
101 VOID AddBreakHandler (VOID);
102 VOID RemoveBreakHandler (VOID);
103 VOID DoCommand (LPTSTR line);
104 int cmd_main (int argc, const TCHAR *argv[]);
105
106 extern HANDLE CMD_ModuleHandle;
107
108
109 /* Prototypes for CMDINPUT.C */
110 VOID ReadCommand (LPTSTR, INT);
111
112
113 /* Prototypes for CMDTABLE.C */
114 #define CMD_SPECIAL 1
115 #define CMD_BATCHONLY 2
116 #define CMD_HIDE 4
117
118 typedef struct tagCOMMAND
119 {
120 LPTSTR name;
121 INT flags;
122 INT (*func) (LPTSTR, LPTSTR);
123 } COMMAND, *LPCOMMAND;
124
125 extern COMMAND cmds[]; /* The internal command table */
126
127 VOID PrintCommandList (VOID);
128 VOID PrintCommandListDetail (VOID);
129
130
131 LPCTSTR GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA );
132
133 /* Prototypes for COLOR.C */
134 VOID SetScreenColor(WORD wArgColor, BOOL bFill);
135 INT CommandColor (LPTSTR, LPTSTR);
136
137 VOID ConInDummy (VOID);
138 VOID ConInDisable (VOID);
139 VOID ConInEnable (VOID);
140 VOID ConInFlush (VOID);
141 VOID ConInKey (PINPUT_RECORD);
142 VOID ConInString (LPTSTR, DWORD);
143
144 VOID ConOutChar (TCHAR);
145 VOID ConOutPuts (LPTSTR);
146 VOID ConOutPrintf (LPTSTR, ...);
147 INT ConOutPrintfPaging (BOOL NewPage, LPTSTR, ...);
148 VOID ConErrChar (TCHAR);
149 VOID ConErrPuts (LPTSTR);
150 VOID ConErrPrintf (LPTSTR, ...);
151 VOID ConOutFormatMessage (DWORD MessageId, ...);
152 VOID ConErrFormatMessage (DWORD MessageId, ...);
153
154 SHORT GetCursorX (VOID);
155 SHORT GetCursorY (VOID);
156 VOID GetCursorXY (PSHORT, PSHORT);
157 VOID SetCursorXY (SHORT, SHORT);
158
159 VOID GetScreenSize (PSHORT, PSHORT);
160 VOID SetCursorType (BOOL, BOOL);
161
162 VOID ConOutResPuts (UINT resID);
163 VOID ConErrResPuts (UINT resID);
164 VOID ConOutResPaging(BOOL NewPage, UINT resID);
165
166 /* Prototypes for COPY.C */
167 INT cmd_copy (LPTSTR, LPTSTR);
168
169
170 /* Prototypes for DATE.C */
171 INT cmd_date (LPTSTR, LPTSTR);
172
173
174 /* Prototypes for DEL.C */
175 INT CommandDelete (LPTSTR, LPTSTR);
176
177
178 /* Prototypes for DELAY.C */
179 INT CommandDelay (LPTSTR, LPTSTR);
180
181
182 /* Prototypes for DIR.C */
183 INT CommandDir (LPTSTR, LPTSTR);
184
185
186 /* Prototypes for DIRSTACK.C */
187 VOID InitDirectoryStack (VOID);
188 VOID DestroyDirectoryStack (VOID);
189 INT GetDirectoryStackDepth (VOID);
190 INT CommandPushd (LPTSTR, LPTSTR);
191 INT CommandPopd (LPTSTR, LPTSTR);
192 INT CommandDirs (LPTSTR, LPTSTR);
193
194
195 /* Prototypes for ECHO.C */
196 INT CommandEcho (LPTSTR, LPTSTR);
197 INT CommandEchos (LPTSTR, LPTSTR);
198 INT CommandEchoerr (LPTSTR, LPTSTR);
199 INT CommandEchoserr (LPTSTR, LPTSTR);
200
201
202 /* Prototypes for ERROR.C */
203 VOID ErrorMessage (DWORD, LPTSTR, ...);
204
205 VOID error_no_pipe (VOID);
206 VOID error_bad_command (VOID);
207 VOID error_invalid_drive (VOID);
208 VOID error_req_param_missing (VOID);
209 VOID error_sfile_not_found (LPTSTR);
210 VOID error_file_not_found (VOID);
211 VOID error_path_not_found (VOID);
212 VOID error_too_many_parameters (LPTSTR);
213 VOID error_parameter_format(TCHAR);
214 VOID error_invalid_switch (TCHAR);
215 VOID error_invalid_parameter_format (LPTSTR);
216 VOID error_out_of_memory (VOID);
217 VOID error_syntax (LPTSTR);
218
219 VOID msg_pause (VOID);
220
221
222 /* Prototypes for FILECOMP.C */
223 #ifdef FEATURE_UNIX_FILENAME_COMPLETION
224 VOID CompleteFilename (LPTSTR, UINT);
225 INT ShowCompletionMatches (LPTSTR, INT);
226 #endif
227 #ifdef FEATURE_4NT_FILENAME_COMPLETION
228 VOID CompleteFilename (LPTSTR, BOOL, LPTSTR, UINT);
229 #endif
230
231
232 /* Prototypes for FOR.C */
233 INT cmd_for (LPTSTR, LPTSTR);
234
235
236 /* Prototypes for FREE.C */
237 INT CommandFree (LPTSTR, LPTSTR);
238
239
240 /* Prototypes for GOTO.C */
241 INT cmd_goto (LPTSTR, LPTSTR);
242
243
244 /* Prototypes for HISTORY.C */
245 #ifdef FEATURE_HISTORY
246 LPCTSTR PeekHistory(INT);
247 VOID History (INT, LPTSTR);/*add entries browse history*/
248 VOID History_move_to_bottom(VOID);/*F3*/
249 VOID InitHistory(VOID);
250 VOID CleanHistory(VOID);
251 VOID History_del_current_entry(LPTSTR str);/*CTRL-D*/
252 INT CommandHistory (LPTSTR cmd, LPTSTR param);
253 #endif
254
255
256 /* Prototypes for INTERNAL.C */
257 VOID InitLastPath (VOID);
258 VOID FreeLastPath (VOID);
259 INT cmd_chdir (LPTSTR, LPTSTR);
260 INT cmd_mkdir (LPTSTR, LPTSTR);
261 INT cmd_rmdir (LPTSTR, LPTSTR);
262 INT CommandExit (LPTSTR, LPTSTR);
263 INT CommandRem (LPTSTR, LPTSTR);
264 INT CommandShowCommands (LPTSTR, LPTSTR);
265 INT CommandShowCommandsDetail (LPTSTR, LPTSTR);
266
267 /* Prototypes for LABEL.C */
268 INT cmd_label (LPTSTR, LPTSTR);
269
270
271 /* Prototypes for LOCALE.C */
272 extern TCHAR cDateSeparator;
273 extern INT nDateFormat;
274 extern TCHAR cTimeSeparator;
275 extern INT nTimeFormat;
276 extern TCHAR cThousandSeparator;
277 extern TCHAR cDecimalSeparator;
278 extern INT nNumberGroups;
279
280
281 VOID InitLocale (VOID);
282 VOID PrintDate (VOID);
283 VOID PrintTime (VOID);
284
285 /* cache codepage */
286 extern UINT InputCodePage;
287 extern UINT OutputCodePage;
288
289 /* Prototypes for MEMORY.C */
290 INT CommandMemory (LPTSTR, LPTSTR);
291
292
293 /* Prototypes for MISC.C */
294 INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size);
295 BOOL SetRootPath(TCHAR *InPath);
296 TCHAR cgetchar (VOID);
297 BOOL CheckCtrlBreak (INT);
298 BOOL add_entry (LPINT ac, LPTSTR **arg, LPCTSTR entry);
299 LPTSTR *split (LPTSTR, LPINT, BOOL);
300 VOID freep (LPTSTR *);
301 LPTSTR _stpcpy (LPTSTR, LPCTSTR);
302 BOOL IsValidPathName (LPCTSTR);
303 BOOL IsExistingFile (LPCTSTR);
304 BOOL IsExistingDirectory (LPCTSTR);
305 BOOL FileGetString (HANDLE, LPTSTR, INT);
306 VOID GetPathCase(TCHAR *, TCHAR *);
307
308 #define PROMPT_NO 0
309 #define PROMPT_YES 1
310 #define PROMPT_ALL 2
311 #define PROMPT_BREAK 3
312
313 INT PagePrompt (VOID);
314 INT FilePromptYN (LPTSTR, ...);
315 INT FilePromptYNA (LPTSTR, ...);
316
317
318 /* Prototypes for MOVE.C */
319 INT cmd_move (LPTSTR, LPTSTR);
320
321
322 /* Prototypes for MSGBOX.C */
323 INT CommandMsgbox (LPTSTR, LPTSTR);
324
325
326 /* Prototypes from PATH.C */
327 INT cmd_path (LPTSTR, LPTSTR);
328
329
330 /* Prototypes from PROMPT.C */
331 VOID PrintPrompt (VOID);
332 INT cmd_prompt (LPTSTR, LPTSTR);
333
334
335 /* Prototypes for REDIR.C */
336 #define INPUT_REDIRECTION 1
337 #define OUTPUT_REDIRECTION 2
338 #define OUTPUT_APPEND 4
339 #define ERROR_REDIRECTION 8
340 #define ERROR_APPEND 16
341 INT GetRedirection (LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPINT);
342
343
344 /* Prototypes for REN.C */
345 INT cmd_rename (LPTSTR, LPTSTR);
346
347 /* Prototypes for REN.C */
348 INT cmd_replace (LPTSTR, LPTSTR);
349
350 /* Prototypes for SCREEN.C */
351 INT CommandScreen (LPTSTR, LPTSTR);
352
353
354 /* Prototypes for SET.C */
355 INT cmd_set (LPTSTR, LPTSTR);
356
357 /* Prototypes for SETLOCAL.C */
358 INT cmd_setlocal (LPTSTR, LPTSTR);
359 INT cmd_endlocal (LPTSTR, LPTSTR);
360
361 /* Prototypes for START.C */
362 INT cmd_start (LPTSTR, LPTSTR);
363
364
365 /* Prototypes for STRTOCLR.C */
366 BOOL StringToColor (LPWORD, LPTSTR *);
367
368
369 /* Prototypes for TIME.C */
370 INT cmd_time (LPTSTR, LPTSTR);
371
372
373 /* Prototypes for TIMER.C */
374 INT CommandTimer (LPTSTR cmd, LPTSTR param);
375
376
377 /* Prototypes for TITLE.C */
378 INT cmd_title (LPTSTR, LPTSTR);
379
380
381 /* Prototypes for TYPE.C */
382 INT cmd_type (LPTSTR, LPTSTR);
383
384
385 /* Prototypes for VER.C */
386 VOID ShortVersion (VOID);
387 INT cmd_ver (LPTSTR, LPTSTR);
388
389
390 /* Prototypes for VERIFY.C */
391 INT cmd_verify (LPTSTR, LPTSTR);
392
393
394 /* Prototypes for VOL.C */
395 INT cmd_vol (LPTSTR, LPTSTR);
396
397
398 /* Prototypes for WHERE.C */
399 BOOL SearchForExecutable (LPCTSTR, LPTSTR);
400
401 /* Prototypes for WINDOW.C */
402 INT CommandActivate (LPTSTR, LPTSTR);
403 INT CommandWindow (LPTSTR, LPTSTR);
404
405
406 /* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
407 int cmd_if(TCHAR *, TCHAR *);
408 int cmd_pause(TCHAR *, TCHAR *);
409 int cmd_shift(TCHAR *, TCHAR *);
410
411 #endif /* _CMD_H_INCLUDED_ */