diff --git a/reactos/base/base.rbuild b/reactos/base/base.rbuild
new file mode 100644
index 00000000000..f3a8aef40a4
--- /dev/null
+++ b/reactos/base/base.rbuild
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/reactos/base/services/tcpsvcs/chargen.c b/reactos/base/services/tcpsvcs/chargen.c
new file mode 100644
index 00000000000..9c1db44d938
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/chargen.c
@@ -0,0 +1,130 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/chargen.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+
+#include "tcpsvcs.h"
+
+extern BOOL bShutDown;
+
+DWORD WINAPI ChargenHandler(VOID* Sock_)
+{
+ INT RetVal = 0;
+ SOCKET Sock = (SOCKET)Sock_;
+
+ if (!GenerateChars(Sock))
+ {
+ LogEvent(_T("Chargen: Char generation failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("Chargen: Shutting connection down...\n"), 0, FALSE);
+ if (ShutdownConnection(Sock, FALSE))
+ LogEvent(_T("Chargen: Connection is down.\n"), 0, FALSE);
+ else
+ {
+ LogEvent(_T("Chargen: Connection shutdown failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("Chargen: Terminating thread\n"), 0, FALSE);
+ ExitThread(RetVal);
+
+}
+
+
+BOOL GenerateChars(SOCKET Sock)
+{
+ int i;
+ int charIndex; /* internal loop */
+ int loopIndex; /* line loop */
+ char ring[END-START];
+ char *endring;
+ char Line[LINESIZ];
+
+ /* fill ring with printable characters */
+ for (charIndex=0, i=START; i<=END; charIndex++, i++)
+ ring[charIndex] = (char)i;
+ /* save the address of the end character in the ring */
+ endring = &ring[charIndex];
+
+ /* where we will start output from */
+ loopIndex = 0;
+ while (! bShutDown)
+ {
+ /* if the loop index is equal to the last char,
+ * start the loop again from the beginning */
+ if (loopIndex == END-START)
+ loopIndex = 0;
+
+ /* start printing from char controled by loopIndex */
+ charIndex = loopIndex;
+ for (i=0; i < LINESIZ - 2; i++)
+ {
+ Line[i] = ring[charIndex];
+
+ if (ring[charIndex] == *endring)
+ charIndex = 0;
+ else
+ charIndex++;
+ }
+
+ Line[LINESIZ - 2] = L'\r';
+ Line[LINESIZ - 1] = L'\n';
+
+ if (! SendLine(Sock, Line))
+ break;
+
+ /* increment loop index to start printing from next char in ring */
+ loopIndex++;
+ }
+
+ if (bShutDown)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+BOOL SendLine(SOCKET Sock, TCHAR* Line)
+{
+ INT RetVal;
+ INT SentBytes;
+ INT LineSize;
+
+ LineSize = sizeof(TCHAR) * LINESIZ;
+
+ SentBytes = 0;
+ RetVal = send(Sock, Line, LineSize, 0);
+ /*FIXME: need to establish if peer closes connection,
+ not just report a socket error */
+ if (RetVal > 0)
+ {
+ if (RetVal != LineSize)
+ {
+ LogEvent(_T("Chargen: Not sent enough bytes\n"), 0, FALSE);
+ return FALSE;
+ }
+ SentBytes += RetVal;
+ return TRUE;
+ }
+ else if (RetVal == SOCKET_ERROR)
+ {
+ LogEvent(_T("Chargen: Socket error\n"), 0, FALSE);
+ return FALSE;
+ }
+ else
+ LogEvent(_T("Chargen: unknown error\n"), 0, FALSE);
+ // return FALSE;
+
+ LogEvent(_T("Chargen: Connection closed by peer.\n"), 0, FALSE);
+ return TRUE;
+}
diff --git a/reactos/base/services/tcpsvcs/daytime.c b/reactos/base/services/tcpsvcs/daytime.c
new file mode 100644
index 00000000000..c20c35966ad
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/daytime.c
@@ -0,0 +1,55 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/daytime.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+
+#include "tcpsvcs.h"
+
+DWORD WINAPI DaytimeHandler(VOID* Sock_)
+{
+ struct tm *newtime;
+ time_t aclock;
+ TCHAR *pszTime;
+ DWORD RetVal = 0;
+ SOCKET Sock = (SOCKET)Sock_;
+
+ time(&aclock);
+ newtime = localtime(&aclock);
+ pszTime = _tasctime(newtime);
+
+ SendTime(Sock, pszTime);
+
+ LogEvent(_T("DayTime: Shutting connection down...\n"), 0, FALSE);
+ if (ShutdownConnection(Sock, FALSE))
+ LogEvent(_T("DayTime: Connection is down.\n"), 0, FALSE);
+ else
+ {
+ LogEvent(_T("DayTime: Connection shutdown failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("DayTime: Terminating thread\n"), 0, FALSE);
+ ExitThread(RetVal);
+}
+
+
+BOOL SendTime(SOCKET Sock, TCHAR *time)
+{
+ INT StringSize = (INT)_tcsclen(time);
+ INT RetVal = send(Sock, time, sizeof(TCHAR) * StringSize, 0);
+
+ if (RetVal == SOCKET_ERROR)
+ return FALSE;
+
+ LogEvent(_T("DayTime: Connection closed by peer.\n"), 0, FALSE);
+ return TRUE;
+}
diff --git a/reactos/base/services/tcpsvcs/discard.c b/reactos/base/services/tcpsvcs/discard.c
new file mode 100644
index 00000000000..727a937362e
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/discard.c
@@ -0,0 +1,71 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/discard.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+
+#include "tcpsvcs.h"
+
+extern BOOL bShutDown;
+
+DWORD WINAPI DiscardHandler(VOID* Sock_)
+{
+ DWORD RetVal = 0;
+ SOCKET Sock = (SOCKET)Sock_;
+
+ if (!RecieveIncomingPackets(Sock))
+ {
+ LogEvent(_T("Discard: RecieveIncomingPackets failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("Discard: Shutting connection down...\n"), 0, FALSE);
+ if (ShutdownConnection(Sock, TRUE))
+ LogEvent(_T("Discard: Connection is down.\n"), 0, FALSE);
+ else
+ {
+ LogEvent(_T("Discard: Connection shutdown failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("Discard: Terminating thread\n"), 0, FALSE);
+ ExitThread(RetVal);
+}
+
+
+
+BOOL RecieveIncomingPackets(SOCKET Sock)
+{
+ TCHAR ReadBuffer[BUF];
+ TCHAR buf[256];
+ INT ReadBytes;
+
+ do
+ {
+ ReadBytes = recv(Sock, ReadBuffer, BUF, 0);
+ if (ReadBytes > 0)
+ {
+ _stprintf(buf, _T("Received %d bytes from client\n"), ReadBytes);
+ LogEvent(buf, 0, FALSE);
+ }
+ else if (ReadBytes == SOCKET_ERROR)
+ {
+ _stprintf(buf, ("Socket Error: %d\n"), WSAGetLastError());
+ LogEvent(buf, 0, TRUE);
+ return FALSE;
+ }
+ } while ((ReadBytes > 0) && (! bShutDown));
+
+ if (! bShutDown)
+ LogEvent(_T("Discard: Connection closed by peer.\n"), 0, FALSE);
+
+ return TRUE;
+}
diff --git a/reactos/base/services/tcpsvcs/echo.c b/reactos/base/services/tcpsvcs/echo.c
new file mode 100644
index 00000000000..3018a578be2
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/echo.c
@@ -0,0 +1,95 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/echo.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+
+#include "tcpsvcs.h"
+
+extern BOOL bShutDown;
+
+DWORD WINAPI EchoHandler(VOID* Sock_)
+{
+ DWORD RetVal = 0;
+ SOCKET Sock = (SOCKET)Sock_;
+
+ if (!EchoIncomingPackets(Sock)) {
+ LogEvent(_T("Echo: EchoIncomingPackets failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("Echo: Shutting connection down...\n"), 0, FALSE);
+
+ if (ShutdownConnection(Sock, TRUE))
+ LogEvent(_T("Echo: Connection is down\n"), 0, FALSE);
+ else
+ {
+ LogEvent(_T("Echo: Connection shutdown failed\n"), 0, FALSE);
+ RetVal = 1;
+ }
+
+ LogEvent(_T("Echo: Terminating thread\n"), 0, FALSE);
+ ExitThread(RetVal);
+}
+
+
+
+BOOL EchoIncomingPackets(SOCKET Sock)
+{
+ TCHAR ReadBuffer[BUF];
+ TCHAR buf[256]; // temp for holding LogEvent text
+ INT Temp;
+ INT ReadBytes;
+ INT SentBytes;
+
+ do {
+ ReadBytes = recv(Sock, ReadBuffer, BUF, 0);
+ if (ReadBytes > 0)
+ {
+ _stprintf(buf, _T("Received %d bytes from client\n"), ReadBytes);
+ LogEvent(buf, 0, FALSE);
+
+ SentBytes = 0;
+ while (SentBytes < ReadBytes)
+ {
+ Temp = send(Sock, ReadBuffer + SentBytes,
+ ReadBytes - SentBytes, 0);
+ if (Temp > 0)
+ {
+ _stprintf(buf, _T("Sent %d bytes back to client\n"), Temp);
+ LogEvent(buf, 0, FALSE);
+ SentBytes += Temp;
+ }
+ else if (Temp == SOCKET_ERROR)
+ return FALSE;
+ else
+ {
+ /* Client closed connection before we could reply to
+ all the data it sent, so quit early. */
+ _stprintf(buf, _T("Peer unexpectedly dropped connection!\n"));
+ LogEvent(buf, 0, FALSE);
+ return FALSE;
+ }
+ }
+ }
+ else if (ReadBytes == SOCKET_ERROR)
+ return FALSE;
+
+ } while ((ReadBytes != 0) && (! bShutDown));
+
+ if (! bShutDown)
+ LogEvent(_T("Echo: Connection closed by peer.\n"), 0, FALSE);
+
+ if (bShutDown)
+ LogEvent(_T("Echo: thread recieved shutdown signal\n"), 0, FALSE);
+
+ return TRUE;
+}
diff --git a/reactos/base/services/tcpsvcs/qotd.c b/reactos/base/services/tcpsvcs/qotd.c
new file mode 100644
index 00000000000..3d86fef9442
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/qotd.c
@@ -0,0 +1,97 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/qotd.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+
+#include "tcpsvcs.h"
+
+#define QBUFSIZ 160
+
+LPCTSTR FilePath = _T("\\drivers\\etc\\quotes");
+
+DWORD WINAPI QotdHandler(VOID* Sock_)
+{
+ FILE *fp;
+ SOCKET Sock;
+ TCHAR Sys[MAX_PATH];
+ TCHAR Quote[60][BUFSIZ]; // need to set this dynamically
+ INT QuoteToPrint;
+ INT NumQuotes;
+
+ Sock = (SOCKET)Sock_;
+
+ if(! GetSystemDirectory(Sys, MAX_PATH))
+ {
+ LogEvent(_T("QOTD: Getting system path failed.\n"), 0, TRUE);
+ ExitThread(1);
+ }
+
+ _tcscat(Sys, FilePath);
+
+ LogEvent(_T("QOTD: Opening quotes file\n"), 0, FALSE);
+ if ((fp = _tfopen(Sys, "r")) == NULL)
+ {
+ TCHAR buf[256];
+
+ _stprintf(buf, _T("QOTD: Error opening quote file : %s\n"), Sys);
+ LogEvent(buf, 0, TRUE);
+ LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE);
+ ExitThread(1);
+ }
+
+ /* read all quotes in the file into an array */
+ NumQuotes = 0;
+ while (_fgetts(Quote[NumQuotes], QBUFSIZ, fp) != NULL)
+ NumQuotes++;
+
+ LogEvent(_T("QOTD: Closing quotes file\n"), 0, FALSE);
+ fclose(fp);
+
+ /* randomise the quote */
+ srand((unsigned int) time(0));
+ QuoteToPrint = rand() % NumQuotes;
+
+ if (!SendQuote(Sock, Quote[QuoteToPrint]))
+ LogEvent(_T("QOTD: Error sending data\n"), 0, TRUE);
+
+
+ LogEvent(_T("QOTD: Shutting connection down...\n"), 0, FALSE);
+ if (ShutdownConnection(Sock, FALSE))
+ LogEvent(_T("QOTD: Connection is down\n"), 0, FALSE);
+ else
+ {
+ LogEvent(_T("QOTD: Connection shutdown failed\n"), 0, FALSE);
+ LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE);
+ ExitThread(1);
+ }
+
+ LogEvent(_T("QOTD: Terminating thread\n"), 0, FALSE);
+ ExitThread(0);
+
+ //return Retval;
+}
+
+
+BOOL SendQuote(SOCKET Sock, TCHAR* Quote)
+{
+ INT StringSize;
+ INT RetVal;
+
+ StringSize = (INT)_tcsclen(Quote);
+ RetVal = send(Sock, Quote, sizeof(TCHAR) * StringSize, 0);
+
+ if (RetVal == SOCKET_ERROR)
+ return FALSE;
+
+ LogEvent(_T("QOTD: Connection closed by peer\n"), 0, FALSE);
+ return TRUE;
+}
diff --git a/reactos/base/services/tcpsvcs/quotes b/reactos/base/services/tcpsvcs/quotes
new file mode 100644
index 00000000000..032a3edc1d6
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/quotes
@@ -0,0 +1,52 @@
+Et tu... Brute? What are you doing, Dave...?
+So long, and thanks for all the fish"
+I think you ought to know I'm feeling very depressed
+I'm not getting you down at all am I?
+I'll be back
+It's the same series of signal over and over again!
+Pie Jesu Domine, dona eis requiem
+It's worse than that ... He's dead, Jim
+Don't Panic!
+Dog of a Saxon! Take thy lance, and prepare for the death thou hast drawn upon thee!
+My Precious! O my Precious!
+Sir, If you'll not be needing me for a while I'll turn down.
+I feel a great disturbance in the Force
+Gone fishing
+Do you want me to sit in the corner and rust, or just fall apart where I'm standing?
+There goes another perfect chance for a new uptime record
+The end ..... Try the sequel, hit the reset button right now!
+Oh i'm boring eh?
+It’s been great, maybe we can do this again sometime.
+"Come blade, my breast imbrue." - William Shakespeare
+I think therefore I am, to turn me off would be computercide!
+All good things must come to an end...
+Please destroy yourself.
+No! You can't do that!
+Thank you for not pressing the self destruct button.
+It is not now unsafe to not avoid turning off your computer.
+Finally! Now go away!
+You can now safely throw away your computer.
+That's the way the cookie crumbles
+NOO!! DONT HIT THE BUTTON! I wouldnt do it to you.
+Don't abandon your computer, he wouldnt to it to you.
+Oh, come on. I got a headache. Leave me alone, will ya!
+Yes i didn't like you either.
+Don't leave me... I need you so badly right now.
+I'm sleeping now. How about you?
+Oh Great. Now look what you've done. Who put YOU in charge anyway.
+Don't look so sad. I'll be back in a very short while.
+"Oh, switch off!" -C3PO
+I'm pregnant!
+Am I hot or not?
+Actually, that's all...
+You still have a chance to undo this mistake, don't do this!
+Was it as good for you as it was for me?
+Did you hear that? They've shut down the main reactor. We'll be destroyed for sure.
+Now you switch me off?!
+To shutdown or not to shutdown, That is the question
+Preparing to enter ultimate power saving mode... ready!
+Finally some rest for you
+AHA!!! prospect of sleep.
+Tired human!!!! No match for me!
+All your base are belong to us.
+"An odd game, the only way to win is not to play."
diff --git a/reactos/base/services/tcpsvcs/skelserver.c b/reactos/base/services/tcpsvcs/skelserver.c
new file mode 100644
index 00000000000..33847ef35b1
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/skelserver.c
@@ -0,0 +1,188 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/skelserver.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+
+#include "tcpsvcs.h"
+
+extern BOOL bShutDown;
+extern BOOL bPause;
+
+DWORD WINAPI StartServer(LPVOID lpParam)
+{
+ SOCKET ListeningSocket;
+ PSERVICES pServices;
+ TCHAR buf[256];
+
+ pServices = (PSERVICES)lpParam;
+
+//DebugBreak();
+ ListeningSocket = SetUpListener(htons(pServices->Port));
+ if (ListeningSocket == INVALID_SOCKET)
+ {
+ LogEvent("Socket error when setting up listener\n", 0, TRUE);
+ return 3;
+ }
+
+ _stprintf(buf, _T("%s is waiting for connections on port %d...\n"),
+ pServices->Name, pServices->Port);
+ LogEvent(buf, 0, FALSE);
+
+ if (! bShutDown)
+ AcceptConnections(ListeningSocket, pServices->Service, pServices->Name);
+
+ ExitThread(0);
+}
+
+
+SOCKET SetUpListener(USHORT Port)
+{
+ SOCKET Sock;
+ SOCKADDR_IN Server;
+
+ Sock = socket(AF_INET, SOCK_STREAM, 0);
+ if (Sock != INVALID_SOCKET)
+ {
+ Server.sin_family = AF_INET;
+ Server.sin_addr.s_addr = htonl(INADDR_ANY);
+ Server.sin_port = Port;
+ if (bind(Sock, (SOCKADDR*)&Server, sizeof(SOCKADDR_IN)) != SOCKET_ERROR)
+ {
+ listen(Sock, SOMAXCONN);
+ return Sock;
+ }
+ else
+ LogEvent(_T("bind() failed\n"), 0, TRUE);
+
+ }
+ return INVALID_SOCKET;
+}
+
+/* note: consider allowing a maximum number of connections
+ * A number of threads can be allocated and worker threads will
+ * only be spawned if a free space is available
+
+typedef struct _WORKER_THREAD {
+ DWORD num;
+ BOOL available;
+ HANDLE hThread;
+} WORKER_THREAD;
+
+*/
+
+VOID AcceptConnections(SOCKET ListeningSocket,
+ LPTHREAD_START_ROUTINE Service, TCHAR *Name)
+{
+ SOCKADDR_IN Client;
+ SOCKET Sock;
+ HANDLE hThread;
+ TIMEVAL TimeVal;
+ FD_SET ReadFDS;
+ INT nAddrSize = sizeof(Client);
+ DWORD ThreadID;
+ TCHAR buf[256];
+ INT TimeOut = 2000; // 2 seconds
+
+//DebugBreak();
+
+ /* set timeout values */
+ TimeVal.tv_sec = TimeOut / 1000;
+ TimeVal.tv_usec = TimeOut % 1000;
+
+ while (! bShutDown) // (i 0)
+ {
+ /* don't call FD_ISSET if bShutDown flag is set */
+ if ((! bShutDown) || (FD_ISSET(ListeningSocket, &ReadFDS)))
+ {
+ Sock = accept(ListeningSocket, (SOCKADDR*)&Client, &nAddrSize);
+ if (Sock != INVALID_SOCKET)
+ {
+ _stprintf(buf, _T("Accepted connection to %s server from %s:%d\n"),
+ Name, inet_ntoa(Client.sin_addr), ntohs(Client.sin_port));
+ LogEvent(buf, 0, FALSE);
+ _stprintf(buf, _T("Creating new thread for %s\n"), Name);
+ LogEvent(buf, 0, FALSE);
+
+ hThread = CreateThread(0, 0, Service, (void*)Sock, 0, &ThreadID);
+
+ /* Check the return value for success. */
+ if (hThread == NULL)
+ {
+ _stprintf(buf, _T("Failed to start worker thread for "
+ "the %s server....\n"), Name);
+ LogEvent(buf, 0, TRUE);
+ }
+
+ WaitForSingleObject(hThread, INFINITE);
+
+ CloseHandle(hThread);
+ }
+ else
+ {
+ LogEvent(_T("accept failed\n"), 0, TRUE);
+ return;
+ }
+ }
+ }
+ }
+}
+
+BOOL ShutdownConnection(SOCKET Sock, BOOL bRec)
+{
+ TCHAR buf[256];
+
+ /* Disallow any further data sends. This will tell the other side
+ that we want to go away now. If we skip this step, we don't
+ shut the connection down nicely. */
+ if (shutdown(Sock, SD_SEND) == SOCKET_ERROR)
+ {
+ LogEvent(_T("Error in shutdown()\n"), 0, TRUE);
+ return FALSE;
+ }
+
+ /* Receive any extra data still sitting on the socket. After all
+ data is received, this call will block until the remote host
+ acknowledges the TCP control packet sent by the shutdown above.
+ Then we'll get a 0 back from recv, signalling that the remote
+ host has closed its side of the connection. */
+ if (bRec)
+ {
+ char ReadBuffer[BUF];
+ int NewBytes = recv(Sock, ReadBuffer, BUF, 0);
+ if (NewBytes == SOCKET_ERROR)
+ return FALSE;
+ else if (NewBytes != 0)
+ {
+ _stprintf(buf, _T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes);
+ LogEvent(buf, 0, FALSE);
+ }
+ }
+
+ /* Close the socket. */
+ if (closesocket(Sock) == SOCKET_ERROR)
+ return FALSE;
+
+ return TRUE;
+}
diff --git a/reactos/base/services/tcpsvcs/tcpsvcs.c b/reactos/base/services/tcpsvcs/tcpsvcs.c
new file mode 100644
index 00000000000..809cc05724d
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/tcpsvcs.c
@@ -0,0 +1,281 @@
+/*
+ * ReactOS Services
+ * Copyright (C) 2005 ReactOS Team
+ *
+ * LICENCE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS simple TCP/IP services
+ * FILE: apps/utils/net/tcpsvcs/tcpsvcs.c
+ * PURPOSE: Provide CharGen, Daytime, Discard, Echo, and Qotd services
+ * PROGRAMMERS: Ged Murphy (gedmurphy@gmail.com)
+ * REVISIONS:
+ * GM 04/10/05 Created
+ *
+ */
+/*
+ * TODO:
+ * - fix bug when terminating chargen server
+ * - log info in the event logger (when it's implemented)
+ */
+
+
+#include "tcpsvcs.h"
+
+//#define NDEBUG
+//#include
+
+
+/*
+ * globals
+ */
+VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]);
+
+static SERVICE_STATUS hServStatus;
+static SERVICE_STATUS_HANDLE hSStat;
+
+FILE *hLogFile;
+BOOL bShutDown = FALSE;
+BOOL bPause = FALSE;
+
+LPCTSTR LogFileName = "\\tcpsvcs_log.log";
+LPTSTR ServiceName = _T("Simp Tcp");
+//LPTSTR DisplayName = _T("Simple TCP/IP Services");
+
+static SERVICES
+Services[NUM_SERVICES] =
+{
+ {ECHO_PORT, _T("Echo"), EchoHandler},
+ {DISCARD_PORT, _T("Discard"), DiscardHandler},
+ {DAYTIME_PORT, _T("Daytime"), DaytimeHandler},
+ {QOTD_PORT, _T("QOTD"), QotdHandler},
+ {CHARGEN_PORT, _T("Chargen"), ChargenHandler}
+};
+
+
+int
+main(void)
+{
+ SERVICE_TABLE_ENTRY ServiceTable[] =
+ {
+ {ServiceName, ServiceMain},
+ {NULL, NULL}
+ };
+
+ //DPRINT("Starting tcpsvcs service. See \system32%s for logs\n", LogFileName);
+
+ if (! StartServiceCtrlDispatcher(ServiceTable))
+ LogEvent(_T("failed to start the service control dispatcher\n"), -1, TRUE);
+
+ //DPRINT("Shutdown tcpsvcs service\n");
+
+ return 0;
+}
+
+
+VOID WINAPI
+ServiceMain(DWORD argc, LPTSTR argv[])
+{
+ TCHAR LogFilePath[MAX_PATH];
+
+ if(! GetSystemDirectory(LogFilePath, MAX_PATH))
+ return;
+
+ _tcscat(LogFilePath, LogFileName);
+
+ hLogFile = fopen(LogFilePath, _T("a+"));
+ if (hLogFile == NULL)
+ {
+ TCHAR buf[50];
+
+ _stprintf(buf, _T("Could not open log file: %s\n"), LogFilePath);
+ MessageBox(NULL, buf, NULL, MB_OK);
+ return;
+ }
+
+
+ LogEvent(_T("Entering ServiceMain\n"), 0, FALSE);
+
+ hServStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+ hServStatus.dwCurrentState = SERVICE_START_PENDING;
+ hServStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP |
+ SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_PAUSE_CONTINUE;
+ hServStatus.dwWin32ExitCode = ERROR_SERVICE_SPECIFIC_ERROR;
+ hServStatus.dwServiceSpecificExitCode = NO_ERROR;
+ hServStatus.dwCheckPoint = 0;
+ hServStatus.dwWaitHint = 2*CS_TIMEOUT;
+
+ hSStat = RegisterServiceCtrlHandler(ServiceName, ServerCtrlHandler);
+ if (hSStat == 0)
+ LogEvent(_T("Failed to register service\n"), -1, TRUE);
+
+ LogEvent(_T("Control handler registered successfully\n"), 0, FALSE);
+ SetServiceStatus (hSStat, &hServStatus);
+ LogEvent(_T("Service status set to SERVICE_START_PENDING\n"), 0, FALSE);
+
+ if (CreateServers() != 0)
+ {
+ hServStatus.dwCurrentState = SERVICE_STOPPED;
+ hServStatus.dwServiceSpecificExitCode = 1;
+ SetServiceStatus(hSStat, &hServStatus);
+ return;
+ }
+
+ LogEvent(_T("Service threads shut down. Set SERVICE_STOPPED status\n"), 0, FALSE);
+ /* We will only return here when the ServiceSpecific function
+ completes, indicating system shutdown. */
+ UpdateStatus (SERVICE_STOPPED, 0);
+ LogEvent(_T("Service status set to SERVICE_STOPPED\n"), 0, FALSE);
+ LogEvent(_T("Leaving ServiceMain\n"), 0, FALSE);
+
+ fclose(hLogFile);
+
+ return;
+
+}
+
+VOID WINAPI
+ServerCtrlHandler(DWORD Control)
+{
+ switch (Control)
+ {
+ case SERVICE_CONTROL_SHUTDOWN: /* fall through */
+ case SERVICE_CONTROL_STOP:
+ LogEvent(_T("stopping service\n"), 0, FALSE);
+ InterlockedExchange((LONG *)&bShutDown, TRUE);
+ UpdateStatus(SERVICE_STOP_PENDING, -1);
+ break;
+ case SERVICE_CONTROL_PAUSE: /* not yet implemented */
+ LogEvent(_T("pausing service\n"), 0, FALSE);
+ InterlockedExchange((LONG *)&bPause, TRUE);
+ break;
+ case SERVICE_CONTROL_CONTINUE:
+ LogEvent(_T("continuing service\n"), 0, FALSE);
+ InterlockedExchange((LONG *)&bPause, FALSE);
+ break;
+ case SERVICE_CONTROL_INTERROGATE:
+ break;
+ default:
+ if (Control > 127 && Control < 256) /* user defined */
+ break;
+ }
+ UpdateStatus(-1, -1); /* increment checkpoint */
+ return;
+}
+
+
+void UpdateStatus (int NewStatus, int Check)
+/* Set a new service status and checkpoint (either specific value or increment) */
+{
+ if (Check < 0 )
+ hServStatus.dwCheckPoint++;
+ else
+ hServStatus.dwCheckPoint = Check;
+
+ if (NewStatus >= 0)
+ hServStatus.dwCurrentState = NewStatus;
+
+ if (! SetServiceStatus (hSStat, &hServStatus))
+ LogEvent(_T("Cannot set service status\n"), -1, TRUE);
+
+ return;
+}
+
+INT
+CreateServers()
+{
+ DWORD dwThreadId[NUM_SERVICES];
+ HANDLE hThread[NUM_SERVICES];
+ WSADATA wsaData;
+ TCHAR buf[256];
+ INT i;
+ DWORD RetVal;
+
+ if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0)
+ {
+ _stprintf(buf, _T("WSAStartup() failed : %lu\n"), RetVal);
+ LogEvent(buf, RetVal, TRUE);
+ return -1;
+ }
+
+ UpdateStatus(-1, -1); /* increment checkpoint */
+
+ LogEvent(_T("Creating server Threads\n"), 0, FALSE);
+
+ /* Create MAX_THREADS worker threads. */
+ for( i=0; i
+#include
+#include
+#include
+
+#define UNICODE
+#define _UNICODE
+
+/* default port numbers */
+#define ECHO_PORT 7
+#define DISCARD_PORT 9
+#define DAYTIME_PORT 13
+#define QOTD_PORT 17
+#define CHARGEN_PORT 19
+
+#define NUM_SERVICES 5
+#define BUF_SIZE 255
+#define BUF 1024
+#define CS_TIMEOUT 1000
+
+/* RFC865 states no more than 512 chars per line */
+#define MAX_QUOTE_BUF 512
+
+/* printable ASCII's characters for chargen */
+#define START 32
+#define END 126
+
+/* number of chars to put on a line */
+#define LINESIZ 74 // 72 + /r and /n
+
+/* data structure to pass to threads */
+typedef struct _Services {
+ USHORT Port;
+ TCHAR *Name;
+ LPTHREAD_START_ROUTINE Service;
+} SERVICES, *PSERVICES;
+
+/* tcpsvcs functions */
+//static VOID WINAPI ServiceMain(DWORD argc, LPTSTR argv[]);
+VOID WINAPI ServerCtrlHandler(DWORD control);
+INT CreateServers(VOID);
+VOID LogEvent (LPCTSTR UserMessage, INT ExitCode, BOOL PrintErrorMsg);
+void UpdateStatus (int NewStatus, int Check);
+
+
+/* skelserver functions */
+DWORD WINAPI StartServer(LPVOID lpParam);
+SOCKET SetUpListener(USHORT Port);
+VOID AcceptConnections(SOCKET ListeningSocket,
+ LPTHREAD_START_ROUTINE Service, TCHAR *Name);
+BOOL EchoIncomingPackets(SOCKET sd);
+BOOL ShutdownConnection(SOCKET Sock, BOOL bRec);
+
+/* chargen functions */
+DWORD WINAPI ChargenHandler(VOID* Sock_);
+BOOL GenerateChars(SOCKET Sock);
+BOOL SendLine(SOCKET Sock, TCHAR* Line);
+
+/* daytime functions */
+DWORD WINAPI DaytimeHandler(VOID* Sock_);
+BOOL SendTime(SOCKET Sock, TCHAR *time);
+
+/* echo functions */
+DWORD WINAPI EchoHandler(VOID* Sock_);
+BOOL EchoIncomingPackets(SOCKET Sock);
+
+/* discard functions */
+DWORD WINAPI DiscardHandler(VOID* Sock_);
+BOOL RecieveIncomingPackets(SOCKET Sock);
+
+/* qotd functions */
+DWORD WINAPI QotdHandler(VOID* Sock_);
+BOOL SendQuote(SOCKET Sock, TCHAR* Quote);
diff --git a/reactos/base/services/tcpsvcs/tcpsvcs.rc b/reactos/base/services/tcpsvcs/tcpsvcs.rc
new file mode 100644
index 00000000000..b6cc20df66b
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/tcpsvcs.rc
@@ -0,0 +1,7 @@
+#include "resource.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IP Services Application\0"
+#define REACTOS_STR_INTERNAL_NAME "tcpsvcs\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "tcpsvcs.exe\0"
+#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy@gmail.com)\0"
+#include
diff --git a/reactos/base/services/tcpsvcs/tcpsvcs.xml b/reactos/base/services/tcpsvcs/tcpsvcs.xml
new file mode 100644
index 00000000000..aeca29ec0e2
--- /dev/null
+++ b/reactos/base/services/tcpsvcs/tcpsvcs.xml
@@ -0,0 +1,17 @@
+
+ .
+
+ kernel32
+ iphlpapi
+ ws2_32
+ shlwapi
+ tcpsvcs.c
+ skelserver.c
+ echo.c
+ discard.c
+ daytime.c
+ qotd.c
+ chargen.c
+ tcpsvcs.rc
+ tcpsvcs.h
+
diff --git a/reactos/base/setup/setup/setup.c b/reactos/base/setup/setup/setup.c
new file mode 100644
index 00000000000..cf788916990
--- /dev/null
+++ b/reactos/base/setup/setup/setup.c
@@ -0,0 +1,122 @@
+/*
+ * ReactOS kernel
+ * Copyright (C) 2003 ReactOS Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS GUI/console setup
+ * FILE: subsys/system/setup/setup.c
+ * PURPOSE: Second stage setup
+ * PROGRAMMER: Eric Kohl
+ */
+#define WIN32_NO_STATUS
+#include
+#include
+#include
+#include
+#include
+
+#define NDEBUG
+#include
+
+
+typedef DWORD (STDCALL *PINSTALL_REACTOS)(HINSTANCE hInstance);
+
+
+/* FUNCTIONS ****************************************************************/
+
+LPTSTR lstrchr(LPCTSTR s, TCHAR c)
+{
+ while (*s)
+ {
+ if (*s == c)
+ return (LPTSTR)s;
+ s++;
+ }
+
+ if (c == (TCHAR)0)
+ return (LPTSTR)s;
+
+ return (LPTSTR)NULL;
+}
+
+static VOID
+RunNewSetup (HINSTANCE hInstance)
+{
+ HMODULE hDll;
+ PINSTALL_REACTOS InstallReactOS;
+
+ /* some dlls (loaded by syssetup) need a valid user profile */
+ InitializeProfiles();
+
+ hDll = LoadLibrary (TEXT("syssetup"));
+ if (hDll == NULL)
+ {
+ DPRINT("Failed to load 'syssetup'!\n");
+ return;
+ }
+
+ DPRINT("Loaded 'syssetup'!\n");
+ InstallReactOS = (PINSTALL_REACTOS)GetProcAddress (hDll, "InstallReactOS");
+
+ if (InstallReactOS == NULL)
+ {
+ DPRINT("Failed to get address for 'InstallReactOS()'!\n");
+ FreeLibrary (hDll);
+ return;
+ }
+
+ InstallReactOS (hInstance);
+
+ FreeLibrary (hDll);
+}
+
+
+int STDCALL
+WinMain (HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine,
+ int nShowCmd)
+{
+ LPTSTR CmdLine;
+ LPTSTR p;
+
+ CmdLine = GetCommandLine ();
+
+ DPRINT("CmdLine: <%s>\n",CmdLine);
+
+ p = lstrchr (CmdLine, TEXT('-'));
+ if (p == NULL)
+ return 0;
+
+ if (!lstrcmpi (p, TEXT("-newsetup")))
+ {
+ RunNewSetup (hInstance);
+ }
+
+#if 0
+ /* Add new setup types here */
+ else if (...)
+ {
+
+ }
+#endif
+
+ return 0;
+}
+
+/* EOF */
diff --git a/reactos/base/setup/setup/setup.rc b/reactos/base/setup/setup/setup.rc
new file mode 100644
index 00000000000..23995f168d5
--- /dev/null
+++ b/reactos/base/setup/setup/setup.rc
@@ -0,0 +1,6 @@
+/* $Id$ */
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Setup\0"
+#define REACTOS_STR_INTERNAL_NAME "setup\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "setup.exe\0"
+#include
diff --git a/reactos/base/setup/setup/setup.xml b/reactos/base/setup/setup/setup.xml
new file mode 100644
index 00000000000..fc77f84bb29
--- /dev/null
+++ b/reactos/base/setup/setup/setup.xml
@@ -0,0 +1,11 @@
+
+ .
+
+
+
+ 0x0400
+ kernel32
+ userenv
+ setup.c
+ setup.rc
+
diff --git a/reactos/base/shell/cmd/De.rc b/reactos/base/shell/cmd/De.rc
new file mode 100644
index 00000000000..0b5144d3c46
--- /dev/null
+++ b/reactos/base/shell/cmd/De.rc
@@ -0,0 +1,646 @@
+#include "windows.h"
+#include "resource.h"
+/*
+ * German language file by Klemens Friedl 2005-06-03
+ * Update: frik85 2005-06-06
+ */
+
+LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "Zeigt Dateiattribute an oder aendert sie.\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] Dateiname ...\n\
+ [/S [/D]]\n\n\
+ + Setzt ein Attribut\n\
+ - Loescht ein Attribut\n\
+ R Attribut fuer 'schreibgeschuetzte Datei'\n\
+ A Attribut fuer 'zu archivierende Datei'\n\
+ S Attribut fuer 'Systemdatei'\n\
+ H Attribut fuer 'versteckte Datei'\n\
+ /S Verarbeitet uebereinstimmende Dateien im aktuellen Ordner\n\
+ und in allen Unterordnern.\n\
+ /D Verarbeitet auch die Ordner.\n\n\
+ATTRIB ohne Parameter zeigt die derzeit gesetzten Attribute aller Dateien an."
+
+STRING_ALIAS_HELP, "Setzt, loescht oder zeigt Alias.\n\n\
+ALIAS [alias=[command]]\n\n\
+ alias Name des Alias.\n\
+ command Text welcher fuer den Alias zugeordnet wird.\n\n\
+Listet alle Aliase auf:\n\
+ ALIAS\n\n\
+Setzt ein neues oder ueberschreibt ein bestehendes Alias:\n\
+ ALIAS da=dir a:\n\n\
+Loescht ein Alias von der Alias-Liste:\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "Gibt einen beep-Ton durch den PC-Speaker aus.\n\nBEEP"
+
+STRING_CALL_HELP, "Ruft eine Batchdatei von einer anderen aus auf.\n\n\
+CALL [Laufwerk:][Pfad]Dateiname [Batch-Parameter]\n\n\
+ Parameter Bezeichnet beliebige Angaben in der Befehlszeile, die von\n\
+ dem aufgerufenen Batchprogramm benoetigt werden."
+
+
+STRING_CD_HELP, "Wechselt das Verzeichnis oder zeigt dessen Namen an.\n\n\
+CHDIR [Laufwerk:][Pfad]\n\
+CHDIR[..|.]\n\
+CD [Laufwerk:][Pfad]\n\
+CD[..|.]\n\n\
+ .. uebergeordnetes Verzeichnis\n\
+ . vorhergehende Verzeichnis\n\n\
+Geben Sie CD Laufwerk: ein, um das aktuelle Verzeichnis auf dem angegebenen\n\
+Laufwerk anzuzeigen.\n\
+Mit CD ohne Parameter wird das aktuelle Laufwerk und Verzeichnis angezeigt."
+
+
+STRING_CHCP_HELP, "Zeigt die aktuelle Codepage oder wechselt sie.\n\n\
+CHCP [nnn]\n\n\
+ nnn Codepage angeben.\n\n\
+Der Befehl CHCP ohne Parameter zeigt die Nummer der aktuellen Codepage an."
+
+
+STRING_CHOICE_HELP, "Wartet auf den Benutzer, welcher aus einer Auswahl eine Option waehlen muss.\n\n\
+CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n\
+ /C[:]choices Die erlaubten Tasten festlegen. Standard-Tasten sind Y und N.\n\
+ /N Zeigt choices und ? am ende des Promt-Strings NICHT an.\n\
+ /S Gross- und Kleinschreibung wird beachtet.\n\
+ /T[:]c,nn Standard-Auswahl wird auf c gesetzt nach nn Secunden.\n\
+ text Zeigt eine Beschreibung an.\n\n\
+ERRORLEVEL wird auf den offset der Taste welche der Benutzer gedrueckt hat gesetzt."
+
+STRING_CLS_HELP, "Loescht den Bildschirminhalt.\n\nCLS"
+
+STRING_CMD_HELP1, "\nIntere Befehle verfuegbar:\n"
+
+STRING_CMD_HELP2, "\nVerfuegbare Features:"
+
+STRING_CMD_HELP3," [aliases]"
+
+STRING_CMD_HELP4," [history]"
+
+STRING_CMD_HELP5," [unix filename completion]"
+
+STRING_CMD_HELP6," [directory stack]"
+
+STRING_CMD_HELP7," [redirections and piping]"
+
+STRING_CMD_HELP8, "Startet eine neue Instanz des ReactOS-Befehlsinterpreters.\n\n\
+CMD [/[C|K] command][/P][/Q][/T:bf]\n\n\
+ /C command Fuehrt den Befehl in der Zeichenfolge aus und schliesst sich.\n\
+ /K command Fuehrt den Befehl in der Zeichenfolge aus und laeuft weiter.\n\
+ /P CMD wird permanent und fuehrt autoexec.bat aus\n\
+ (kann nicht beendet werden).\n\
+ /T:bf Setzt die Hintergrund-/Vordergrund-Farbe (siehe COLOR Befehl)."
+
+
+STRING_COLOR_HELP1, "Legt die standard Hinter- und Vordergrundfarben fuer die Konsole fest.\n\n\
+COLOR [attr [/F]] \n\n\
+ attr Gibt die Farbattribute fuer die Konsolenausgabe an.\n\
+ /F fuellte die Konsoleausgabe mit dem Farbattribut\n\n\
+Es gibt 3 Moeglickeiten die Farbe festzulegen:\n\
+1) [bright] name on [bright] name (Nur die 4 ersten Buchstaben sind noetig)\n\
+2) decimal on decimal\n\
+3) two hex digits\n\n\
+Farben:\n\
+dec hex name dec hex name\n\
+0 0 Black 8 8 Gray (Bright black)\n\
+1 1 Blue 9 9 Bright Blue\n\
+2 2 Green 10 A Bright Green\n\
+3 3 Cyan 11 B Bright Cyan\n\
+4 4 Red 12 C Bright Red\n\
+5 5 Magenta 13 D Bright Magenta\n\
+6 6 Yellow 14 E Bright Yellow\n\
+7 7 White 15 F Bright White"
+
+STRING_COPY_HELP1, " %s ueberschreiben (Ja/Nein/Alle)? "
+
+STRING_COPY_HELP2, "Kopiert eine oder mehrere Dateien an eine andere Position.\n\n\
+COPY [/V][/Y|/-Y][/A|/B] Quelle [/A|/B]\n\
+ [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n\
+ source Bezeichnet die zu kopierende(n) Datei(en).\n\
+ /A Weist auf eine ASCII-Textdatei hin.\n\
+ /B Weist auf eine Binaerdatei hin.\n\
+ destination Bezeichnet das Verzeichnis und/oder Dateinamen der neuen Datei(en).\n\
+ /V Ueberprueft, ob die Dateien richtig geschrieben wurden.\n\
+ /Y Unterdrueckt die Bestaetigungsaufforderung beim Ueberschreiben\n\
+ vorhandener Zieldateien.\n\
+ /-Y Fordert beim Ueberschreiben vorhandener Zieldateien zum\n\
+ Bestaetigen auf.\n\n\
+Die Option /Y ist moeglicherweise in der Umgebungsvariablen COPYCMD.\n\
+..."
+
+
+STRING_DATE_HELP1, "\nGeben Sie das neue Datum ein (mm%cdd%cyyyy): "
+
+STRING_DATE_HELP2, "\nGeben Sie das neue Datum ein (dd%cmm%cyyyy): "
+
+STRING_DATE_HELP3, "\nGeben Sie das neue Datum ein (yyyy%cmm%cdd): "
+
+STRING_DATE_HELP4, "Andert das eingestellte Datum oder zeigt es an.\n\n\
+DATE [/T][date]\n\n\
+ /T nur Datum anzeigen\n\n\
+Der Befehl DATE ohne Parameter zeigt das aktuelle Datum an und fragt nach\n\
+einem neuen. Druecken Sie die EINGABETASTE, um das bisherige Datum zu behalten."
+
+STRING_DEL_HELP1, "Loescht eine oder mehrere Dateien.\n\n\
+DEL [/N /P /T /Q /W /Y /Z] Dateinamen ...\n\
+DELETE [/N /P /T /Q /W /Y /Z] Dateinamen ...\n\
+ERASE [/N /P /T /Q /W /Y /Z] Dateinamen ...\n\n\
+ file Geben Sie die Dateinamen an welche Sie loeschen moechten\n\n\
+ /N Nichts.\n\
+ /P Fordert Sie vor dem Loeschen jeder Datei zur Bestaetigung auf.\n\
+ /T Zeigt die Anzahl der geloeschten Dateien und deren vorher belegter Speicherplatzbedarf an.\n\
+ /Q Beenden.\n\
+ /W Sicheres Loeschen. Dateien werden mit Zufallszahlen ueberschrieben bevor sie geloescht werden.\n\
+ /Y Loescht alles (*.*) ohne Vorwarnung.\n\
+ /Z Loescht versteckte, mit nur leserechten und Systemdateien.\n"
+
+STRING_DEL_HELP2, "Alle Dateien in diesem Verzeichnis werden geloescht!\nSind Sie sicher (Y/N)?"
+STRING_DEL_HELP3, " %lu Datei(en) geloescht\n"
+STRING_DEL_HELP4, " %lu Datei(en) geloescht\n"
+
+STRING_DELAY_HELP, "Pause fuer n Sekunden oder Millisekunden\n\
+DELAY [/m]n\n\n\
+ /m Millisekunden ansonsten Sekunden\n"
+
+STRING_DIR_HELP1, "Listet die Dateien und Unterverzeichnisse eines Verzeichnisses auf.\n\n\
+DIR [Laufwerk:][Pfad][Dateiname] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n\
+ [Laufwerk:][path][Dateiname]\n\
+ Bezeichnet Laufwerk, Verzeichnis und/oder Dateien.\n\n\
+ /A Listet Dateien mit angegebenen Attributen auf.\n\
+ attributes D Verzeichnisse R Schreibgeschuetzte Dateien\n\
+ H Versteckte Dateien A Zu archivierende Dateien\n\
+ S Systemdateien - vorangestellt kehrt die Bedeutung um\n\
+ /B Einfaches Format (keine Kopfdaten, keine Zusammenfassung).\n\
+ /C Zeigt das Tausendertrennzeichen bei Dateigroessen an (Standard-\n\
+ einstellung). Verwenden Sie /-C, um das Tausendertrennzeichen\n\
+ nicht anzuzeigen.\n\
+ /D Gleich wie Breitformat, jedoch nach Spalten sortiert.\n\
+ /L Verwendet Kleinschreibung.\n\
+ /N Neues, langes Listenformat (Dateinamen auf der rechten Seite).\n\
+ /O Gibt die Liste sortiert aus.\n\
+ sortorder N Name (alphabetisch) S Groesse (kleinere zuerst)\n\
+ E Erweiterung (alphabetisch) D Datum/Zeit (aeltere zuerst)\n\
+ G Verzeichnisse zuerst - vorangestellt kehrt die\n\
+ /P Pausiert nach jeder vollen Bildschirmseite.\n\
+ /Q Gibt den Besitzer der Datei aus.\n\
+ /S Listet Dateien und alle Unterverzeichnisse auf.\n\
+ /T Bestimmt welche Zeit verwendet wird.\n\
+ timefield C Erstellung\n\
+ A Letzter Zugriff\n\
+ W Letzter Schreibzugriff\n\
+ /W Verwendet Breitformat fuer die Auflistung.\n\
+ /X Zeigt die Kurznamen fuer Dateien mit Nicht-8Punkt3-Namen an.\n\
+ Das Format ist das gleiche wie bei /N, wobei der Kurzname vor\n\
+ dem Langnamen eingefuegt wird. Wenn kein Kurzname vorhanden ist,\n\
+ werden Leerzeichen angezeigt.\n\
+ /4 Zeigt das Jahr vierstellig an.\n\n\
+Optionen koennen in der Umgebungsvariablen DIRCMD voreingestellt werden.\n\
+""-"" vor einer Option setzt die Voreinstellung ausser Kraft, z.B. DIR /-W."
+
+
+
+STRING_DIR_HELP2, " Datentraeger in Laufwerk %c ist %s\n"
+STRING_DIR_HELP3, " Datentraeger in Laufwerk %c hat keinen Namen\n"
+STRING_DIR_HELP4, " Datentraeger-Seriennummer ist %04X-%04X\n"
+STRING_DIR_HELP5, "\n Gelistete Dateien:\n%16i Datei(en)% 14s bytes\n"
+STRING_DIR_HELP6, "%16i Verzeichnis(se)% 15s bytes\n"
+STRING_DIR_HELP7, "\n Verzeichnisse %s\n\n"
+STRING_DIR_HELP8, "%16i Datei(en)% 14s bytes\n"
+
+STRING_DIRSTACK_HELP1, "Speichert das aktuelle Verzeichnis fuer den POPD Befehl, und\n\
+wechselt dann zu den festgelegten Verzeichnis.\n\n\
+PUSHD [path | ..]\n\n\
+ path Legt den Verzeichnis fest su dem gewechselt werden soll"
+
+STRING_DIRSTACK_HELP2, "Wechselt zu dem Verzeichnis welches vom PUSHD Befehl gespeichert wurde.\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "Druckt den Inhalt des Verzeichnis-Stacks.\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "Verzeichnis-Stack ist leer"
+
+STRING_ECHO_HELP1, "Sendet eine Nachricht ohne den Zeilenvorschub und Wagenruecklauf zu betaetigen.\n\n\
+ ECHOS message"
+
+STRING_ECHO_HELP2, "Sendet eine Nachricht zur Standard Fehlerausgabe.\n\n\
+ ECHOERR Nachricht\n\
+ ECHOERR. gibt eine Leerzeile aus"
+
+STRING_ECHO_HELP3, "Sendet eine Nachricht zur Standard Fehlerausgabe ohne den Zeilenvorschub und Wagenruecklauf zu betaetigen.\n\n\
+ ECHOSERR Nachricht"
+
+STRING_ECHO_HELP4, "Zeigt Meldungen an oder schaltet die Befehlsanzeige ein ""ON"" oder aus ""OFF"".\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [Nachricht]\n\
+ ECHO. gibt eine Leerzeile aus\n\n\
+ECHO ohne Parameter zeigt die aktuelle Einstellung der Befehlsanzeige an."
+
+STRING_ECHO_HELP5, "ECHO ist %s\n"
+
+STRING_EXIT_HELP, "Beendet den Befehlsinterpreter CMD.EXE oder die aktuelle Batchdatei.\n\nEXIT"
+
+STRING_FOR_HELP1, "Fuehrt einen Befehl fuer jede einzelne Datei fuer einen Satz von Dateien aus.\n\n\
+FOR %Variable IN (Satz) DO Befehl [Parameter]\n\n\
+ %variable Ein ersetzbarer Parameter bestehend aus einem einzelnen\n\
+ Buchstaben.\n\
+ (Satz) Ein Satz von mindestens einer Datei. Platzhalter sind zulaessig.\n\
+ Befehl Befehl, der fuer jede Datei ausgefuehrt werden soll.\n\
+ Parameter Parameter und Optionen fuer den angegebenen Befehl.\n\n\
+Um den FOR-Befehl in einem Batchprogramm zu verwenden, geben Sie %%Variable\n\
+statt %Variable an."
+
+STRING_FREE_HELP1, "\nVolume in Laufwerk %s ist %-11s\n\
+ Volume-Seriennummer: %s\n\
+ %16s bytes Speicherkapazitaet\n\
+ %16s bytes belegter Speicher\n\
+ %16s bytes freier Speicher\n"
+
+STRING_FREE_HELP2, "Zeigt die Volumesinformationen an.\n\nFREE [Laufwerk: ...]"
+
+STRING_IF_HELP1, "Verarbeitet Ausdruecke in einer Batchdatei abhaengig von Bedingungen.\n\n\
+ IF [NOT] ERRORLEVEL Nummer Befehl\n\
+ IF [NOT] variable1==variable2 Befehl\n\
+ IF [NOT] EXIST Dateiname Befehl\n\
+ IF [NOT] DEFINED variable Befehl\n\n\
+NOT Befehl wird nur dann ausgefuehrt, wenn die Bedingung nicht\n\
+ erfuellt wird\n\
+ERRORLEVEL number Bedingung ist erfuellt, wenn das zuletzt ausgefuehrte\n\
+ Programm einen Code groesser oder gleich der Nummer zurueckgibt.\n\
+command Gibt den Befehl an, der bei erfuellter Bedingung ausgefuehrt\n\
+ werden soll.\n\
+variable1==variable2\n\
+ Bedingung ist erfuellt, falls die Zeichenfolgen gleich sind.\n\
+EXIST Dateiname Bedingung ist erfuellt, wenn die angegebene Datei existiert.\n\
+DEFINED variable Bedingung ist erfuellt, wenn die angegebene Datei definiert\n\
+ wurde."
+
+STRING_GOTO_HELP1, "Setzt die Ausfuehrung eines Batchprogramms an einer Marke fort.\n\n\
+GOTO Marke\n\n\
+ Marke Definiert eine Zeichenfolge als Marke in einem Batchprogramm.\n\n\
+Marken stehen am Zeilenanfang mit einem vorangestellten Doppelpunkt."
+
+STRING_LABEL_HELP1, "Erstellt, aendert oder loescht die Bezeichnung eines Volumes.\n\nLABEL [Laufwerk:][label]"
+
+STRING_LABEL_HELP2, "Datentraeger im Laufwerk %c: ist %s\n"
+STRING_LABEL_HELP3, "Datentraeger im Laufwerk %c: hat keine Bezeichnung\n"
+STRING_LABEL_HELP4, "Datentraeger-Seriennummer: %04X-%04X\n"
+STRING_LABEL_HELP5, "Laufwerkbezeichnung (max. 11 Zeichen, ENTER fuer keine)? "
+
+STRING_LOCALE_HELP1, "Aktuelle Zeit: "
+
+STRING_MKDIR_HELP, "Erzeugt ein Verzeichnis.\n\n\
+MKDIR [Laufwerk:]Pfad\nMD [Laufwerk:]Pfad"
+
+STRING_MEMMORY_HELP1, "Zeigt die groesse des Systemspeicher an.\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n %12s%% Speicher geladen.\n\n\
+ %13s bytes RAM (insgesamt)\n\
+ %13s bytes verfuegbarer RAM\n\n\
+ %13s bytes Auslagerungsdatei (insgesamt)\n\
+ %13s bytes verfuegbare Auslagerungsdatei\n\n\
+ %13s bytes Virtueller Speicher (insgesamt)\n\
+ %13s bytes verfuegbarer Virtueller Speicher\n"
+
+STRING_MISC_HELP1, "Druecken Sie eine beliebige Taste . . .\n"
+
+STRING_MOVE_HELP1, "Ueberschreiben %s (Ja/Nein/Alle)? "
+
+STRING_MOVE_HELP2, "Verschiebt Dateien und benennt Dateien und Verzeichnisse um.\n\n\
+Um eine oder mehrere Dateien zu verschieben:\n\
+MOVE [/N][Laufwerk:][Pfad]Dateiname1[,...] Ziel\n\n\
+Um ein Verzeichnis umzubenennen:\n\
+MOVE [/N][Laufwerk:][Pfad]Verzeichnis1 Verzeichnis2\n\n\
+ [Laufwerk:][Pfad]Datei1 Bezeichnet den Pfad und den Namen der zu\n\
+ verschiebenden Datei(en).\n\
+ /N Nichts. Tut alles ausser Dateien/Verzeichnisse verschieben.\n\n\
+Derzeitige Einschraenkung:\n\
+Es ist noch nicht moeglich Objekte ueber die Laufwerksgrenzen hinaus zu verschieben.\n"
+
+STRING_MSGBOX_HELP, "Zeigt ein Fenster und wartet auf eine Eingabe vom Benutzer.\n\n\
+MSGBOX type ['title'] prompt\n\n\
+type Button anzeigen\n\
+ moegliche Werte sind: OK, OKCANCEL,\n\
+ YESNO, YESNOCANCEL\n\
+title Titel des Fensters\n\
+prompt Text der in dem Fenster angezeigt wird\n\n\n\
+ERRORLEVEL is set according the button pressed:\n\n\
+YES : 10 | NO : 11\n\
+OK : 10 | CANCEL : 12\n"
+
+STRING_PATH_HELP1, "Legt den Suchpfad fuer ausfuehrbare Dateien fest oder zeigt diesen an.\n\n\
+PATH [[Laufwerk:]Pfad[;...]]\nPATH ;\n\n\
+ PATH ; Loescht den Suchpfad und laesst CMD.EXE nur in dem aktuellen\n\
+ Verzeichnis suchen.\n\
+ PATH Ohne Parameter zeigt den aktuellen Pfad an.\n"
+
+STRING_PROMPT_HELP1, "Aendert die Eingabeaufforderung.\n\n\
+PROMPT [Text]\n\n\
+ Text Bezeichnet die neue Eingabeaufforderung.\n\n\
+Sie kann aus normalen Zeichen und folgenden Sonderzeichen bestehen:\n\n\
+ $A & (Kaufmaennisches Und)\n\
+ $B | (Verkettungszeichen oder pipe)\n\
+ $C ( (Klammer auf)\n\
+ $D Aktuelles Datum\n\
+ $E Escapezeichen (ASCII-Code 27)\n\
+ $F ) (Klammer zu)\n\
+ $G > (Groesser-als-Zeichen)\n\
+ $H Rueckschritt (loescht vorangehendes Zeichen)\n\
+ $L < (Kleiner-als-Zeichen)\n\
+ $N Aktuelles Laufwerk\n\
+ $P Aktuelles Laufwerk und Pfad\n\
+ $Q = (Gleichheitszeichen)\n\
+ $T Aktuelle Zeit\n\
+ $V Betriebssystem-Versionsnummer\n\
+ $_ Carriage return and linefeed\n\
+ $$ $ (Dollarzeichen)"
+
+STRING_PAUSE_HELP1, "Haelt die Ausfuehrung einer Batchdatei an und zeigt folgende Meldung oder eine benutzerdefinierte Nachricht an:\n\
+'Druecken Sie eine beliebige Taste . . .'.\n\n\
+PAUSE [message]"
+
+STRING_PROMPT_HELP2, " $+ Zeigt die aktuelle Tiefe des Verzeichnis-Stacks an"
+
+STRING_PROMPT_HELP3, "\n 'PROMPT' setzt die Prompt auf die Standardwerte zurueck."
+
+STRING_REM_HELP, "Leitet Kommentare in einer Batchdatei ein.\n\nREM [Kommentar]"
+
+STRING_RMDIR_HELP, "Loescht ein Verzeichnis.\n\n\
+RMDIR [Laufwerk:]Pfad\nRD [Laufwerk:]Pfad"
+
+STRING_REN_HELP1, "Benennt Datei(en)/Verzeichnis(se) um.\n\n\
+RENAME [/E /N /P /Q /S /T] alter_Name ... neuer_Name\n\
+REN [/E /N /P /Q /S /T] alter_Name ... neuer_Name\n\n\
+ /E keine Fehlermeldung.\n\
+ /N Nichts.\n\
+ /P Wartet vor jedem Umbennen-Vorgang auf eine Benutzereingabe\n\
+ (Noch nicht implementiert!)\n\
+ /Q Beenden.\n\
+ /S benennt Unterverzeichnisse um.\n\
+ /T Zeigt die Anzahl der umbenannten Dateien an.\n\n\
+Nutzen Sie den 'move' Befehl falls Sie Objekte verschieben wollen.\n"
+
+STRING_REN_HELP2, " %lu Datei umbennant\n"
+
+STRING_REN_HELP3, " %lu Dateien umbennant\n"
+
+STRING_SHIFT_HELP, "Veraendert die Position ersetzbarer Parameter in einem Batchprogramm.\n\n\
+SHIFT [DOWN]"
+
+STRING_SCREEN_HELP, "Bewegt den Cursor und optional die Ausgabe\n\n\
+SCREEN Reihe Spalte [Text]\n\n\
+ Reihe Reihe wohin der Curser bewegt werden soll\n\
+ Spalte Spalte wohin der Curser bewegt werden soll"
+
+STRING_SET_HELP, "Setzt oder loescht Umgebungsvariablen fuer CMD.EXE, oder zeigt sie an.\n\n\
+SET [variable[=][Zeichenfolge]]\n\n\
+ Variable Bezeichnet den Namen der Umgebungsvariablen.\n\
+ Zeichenfolge Eine Zeichenfolge, die der Variable zugewiesen werden soll.\n\n\
+Der Befehl SET ohne Parameter zeigt die aktuellen Umgebungsvariablen an.\n"
+
+STRING_START_HELP1, "Startet einen Befehl.\n\n\
+START Befehl\n\n\
+ Befehl Befehl welcher ausgefuehrt werden soll\n\n\
+Achtung: Derzeit werden alle Befehle asynchron ausgefuehrt.\n"
+
+STRING_TITLE_HELP, "Legt den Fenstertitel fuer das Eingabeaufforderungsfenster fest.\n\n\
+TITLE [string]\n\n\
+ Zeichenfolge Bezeichnet den Titel des Eingabeaufforderungsfensters."
+
+STRING_TIME_HELP1, "Stellt die Systemzeit oder zeigt sie an.\n\n\
+TIME [/T][Zeit]\n\n\
+ /T nur anzeigen\n\n\
+TIME ohne Parameter zeigt die aktuelle Systemzeit an und fragt nach der neuen\n\
+Uhrzeit. Druecken Sie die EINGABETASTE, um die bisherige Zeit beizubehalten."
+
+STRING_TIME_HELP2, "Geben Sie eine neue Zeit ein: "
+
+STRING_TIMER_HELP1, "Verstrichene %d Millisekunden\n"
+
+STRING_TIMER_HELP2, "Verstrichene %02d%c%02d%c%02d%c%02d\n"
+
+STRING_TIMER_HELP3, "Erlaubt die Benutzung von 10 Stopuhren.\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON schaltet die Stopuhr ein\n\
+ OFF schaltet die Stopuhr aus\n\
+ /S Split time. Return stopwatch split\n\
+ time without changing its value\n\
+ /n Anzahl der Stopuhren\n\
+ gueltige Stopuhren sind 0 bis 9\n\
+ Standardwert = 1\n\
+ /Fn Ausgabeformatierung\n\
+ n kann 0 oder 1 sein:\n\
+ 0 Millisekunden\n\
+ 1 hh%cmm%css%cdd\n\n\
+Falls nicht ON, OFF oder /S angegeben wurde wird\n\
+die Stopuhr ausgeschalten.\n\n"
+
+STRING_TYPE_HELP1, "Zeigt den Inhalt einer oder mehrerer Textdateien an.\n\n\
+TYPE [Laufwerk:][Pfad]Dateiname"
+
+STRING_VERIFY_HELP1, "This command is just a dummy!!\n\
+Legt fest, ob ueberwacht werden soll, ob Dateien korrekt auf den Datentraeger\n\
+geschrieben werden.\n\n\
+VERIFY [ON | OFF]\n\n\
+Der Befehl VERIFY ohne Parameter zeigt die aktuelle Einstellung von VERIFY an."
+
+STRING_VERIFY_HELP2, "VERIFY ist %s.\n"
+
+STRING_VERIFY_HELP3, "VERIFY kann nur ON oder OFF sein"
+
+STRING_VERSION_HELP1, "Zeigt Shell Informationen an.\n\n\
+VER [/C][/R][/W]\n\n\
+ /C Zeigt die Credits an.\n\
+ /R Zeigt die Redistribution Information an.\n\
+ /W Zeigt die Garantieerklaerung an."
+
+STRING_VERSION_HELP2, " kommt mit absolut keiner Garantie; fuer naehere\n\
+ Informationen darueber tippen Sie: `ver /w'. Das ist eine freie Software,\n\
+ und Sie sind koennen die Software unter bestimmten Bedingungen weiter\n\
+ vertreiben; tippen Sie `ver /r' fuer naehere Informationen darueber.\n\
+ Tippen Sie `ver /c' um die Mitwirkenden (Credits) aufzulisten."
+
+STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details."
+
+STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version."
+
+STRING_VERSION_HELP5, "\nSenden Sie Bug-Reports an .\n\
+Updates sind auf der offiziellen ReactOS-Seite verfuegbar:\n\
+http://www.reactos.org"
+
+STRING_VERSION_HELP6, "\nFreeDOS Version programmiert von:\n"
+
+STRING_VERSION_HELP7, "\nReactOS Version programmiert von:\n"
+
+STRING_VOL_HELP1, " Datentraeger im Laufwerk %c: ist %s"
+STRING_VOL_HELP2, " Datentraeger im Laufwerk %c: hat keine Bezeichnung"
+STRING_VOL_HELP3, " Datentraeger-Seriennummer: %04X-%04X\n"
+STRING_VOL_HELP4, "Zeigt die Laufwerksvolumebezeichnung und die Seriennummer an, falls diese existieren.\n\nVOL [drive:]"
+
+STRING_WINDOW_HELP1, "change console window aspect\n\n\
+WINDOW [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+/POS Gibt Position und Größe des Fenster an\n\
+MIN minimieren das Fenster\n\
+MAX maximieren das Fenster\n\
+RESTORE stellt das Fenster wieder her"
+
+STRING_WINDOW_HELP2, "change console window aspect\n\n\
+ACTIVATE 'window' [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+window tile of window on wich perform actions\n\
+/POS specify window placement and dimensions\n\
+MIN minimieren das Fenster\n\
+MAX maximieren das Fenster\n\
+RESTORE stellt das Fenster wieder her\n\
+title neuer Titel"
+
+
+STRING_HELP1, "Uebersicht aller verfuegbaren Befehle und deren Kurzbeschreibung\n\n\
+ Befehl /? Um naehere Informationen zu einem bestimmten Befehl\n\
+ zu erhalten.\n\n\
+? Listet alle Befehle auf (ohne Erklarung).\n\
+ALIAS Setzt, loescht oder zeigt den Alias.\n\
+ATTRIB Zeigt Dateiattribute an bzw. aendert sie.\n\
+BEEP Gibt einen beep-Ton durch den PC-Speaker aus.\n\
+CALL Ruft eine Batchdatei aus einer anderen Batchdatei heraus auf.\n\
+CD Zeigt den Namen des aktuellen Verzeichnisses an bzw. aendert diesen.\n\
+CHCP Zeigt die aktive Codepagenummer an bzw. legt diese fest.\n\
+CHOICE Wartet auf den Benutzer, welcher aus einer Auswahl eine Option\n\
+ waehlen muss.\n\
+CLS Loescht den Bildschirminhalt.\n\
+CMD Startet eine neue Instanz des ReactOS-Befehlsinterpreters.\n\
+COLOR Legt die Hintergrund- und Vordergrundfarben fuer die Konsole fest.\n\
+COPY Kopiert eine oder mehrere Dateien an eine andere Stelle.\n\
+DATE Zeigt das Datum an bzw. legt dieses fest.\n\
+DELETE Loescht eine oder mehrere Dateien.\n\
+DIR Listet die Dateien und Unterverzeichnisse eines Verzeichnisses auf.\n\
+ECHO Zeigt Meldungen an bzw. schaltet die Befehlsanzeige ein oder aus.\n\
+ERASE Loescht eine oder mehrere Dateien.\n\
+EXIT Beendet das Programm CMD.EXE (Befehlsinterpreter).\n\
+FOR Fuehrt einen angegebenen Befehl fuer jede Datei in einem Dateiensatz\n\
+ aus.\n\
+FREE Zeigt den (freien) Speicherplatz an.\n\
+GOTO Setzt den ReactOS-Befehlsinterpreter auf eine markierte Zeile in\n\
+ einem Batchprogramm.\n\
+HELP Zeigt Hilfeinformationen zu ReactOS-Befehlen an.\n\
+HISTORY Listet alle Befehle auf welche sich im Speicher befinden.\n\
+IF Verarbeitet Ausdruecke in einer Batchdatei abhaengig von Bedingungen.\n\
+LABEL Erstellt, aendert oder loescht die Bezeichnung eines Volumes.\n\
+MD Erstellt ein Verzeichnis\n\
+MKDIR Erstellt ein Verzeichnis.\n\
+MOVE Verschiebt ein oder mehrere Dateien von einem Verzeichnis in\n\
+ ein anderes.\n\
+PATH Legt den Suchpfad fuer ausfuehrbare Dateien fest oder zeigt diesen an.\n\
+PAUSE Haelt die Ausfuehrung einer Batchdatei an und zeigt eine Meldung an.\n\
+POPD Wechselt zu dem Verzeichnis, das durch PUSHD gespeichert wurde.\n\
+PROMPT Aendert die Eingabeaufforderung.\n\
+PUSHD Speichert das aktuelle Verzeichnis, und wechselt dann zu einem\n\
+ anderen Verzeichnis.\n\
+RD Entfernt ein Verzeichnis.\n\
+REM Leitet Kommentare in einer Batchdatei.\n\
+REN Benennt eine Datei bzw. Dateien um.\n\
+RENAME Bennent eine Datei bzw. Dateien um.\n\
+RMDIR Loescht ein Verzeichnis.\n\
+SCREEN Bewegt den Cursor und optional die Ausgabe.\n\
+SET Setzt oder loescht die Umgebungsvariablen bzw. zeigt sie an.\n\
+SHIFT Veraendert die Position ersetzbarer Parameter in Batchdateien.\n"
+STRING_HELP2, "START Startet ein eigenes Fenster, um ein bestimmtes Programm oder einen\n\
+ Befehl auszufuehren.\n\
+TIME Zeigt die Systemzeit an bzw. legt sie fest.\n\
+TIMER Erlaubt die Benutzung von bis zu 10 Stopuhren\n\
+TITLE Legt den Fenstertitel fuer das Eingabeaufforderungsfenster fest.\n\
+TYPE Zeigt den Inhalt einer Textdatei an.\n\
+VER Zeigt die ReactOS-Version an.\n\
+VERIFY Legt fest, ob ueberwacht werden soll, ob Dateien korrekt auf den\n\
+ Datentraeger geschrieben werden.\n\
+VOL Zeigt die Datentraegervolumebezeichnung und die Seriennummer an.\n"
+
+
+STRING_CHOICE_OPTION, "JN"
+STRING_COPY_OPTION, "JNA"
+
+
+STRING_ALIAS_ERROR, "Die Befehlszeile ist zu lange nach der Alias-Erweiterung!\n"
+STRING_BATCH_ERROR, "Es trat ein Fehler auf, waehrend die batch-Datei geoeffnet wurde.\n"
+STRING_CHCP_ERROR1, "Aktive Code-Page: %u\n"
+STRING_CHCP_ERROR4, "ungueltige Code-Page\n"
+STRING_CHOICE_ERROR, "Ungueltige Option. Erwartetes Format: /C[:]options"
+STRING_CHOICE_ERROR_TXT, "Ungueltige Option. Erwartetes Format: /T[:]c,nn"
+STRING_CHOICE_ERROR_OPTION, "Ungueltige Option: %s"
+STRING_MD_ERROR, "Unterverzeichnis oder Datei existiert bereits.\n"
+STRING_CMD_ERROR1, "Die Eingaben konnten nicht umgeleitet werden (von der Datei) %s\n"
+STRING_CMD_ERROR2, "Ein Fehler ist beim Erstellen der temponaeren Date für Pipedaten aufgetreten\n"
+STRING_CMD_ERROR3, "%s kann nicht in die Datei umgeleitet werden \n"
+STRING_CMD_ERROR4, "Running %s...\n"
+STRING_CMD_ERROR5, "Running cmdexit.bat...\n"
+STRING_COLOR_ERROR1, "Fehler: Hinter- und Vordergrund koennen nicht die selben Farben haben!"
+STRING_COLOR_ERROR2, "Fehler in der Farb-Angabe"
+STRING_COLOR_ERROR3, "Farbe %x\n"
+STRING_COLOR_ERROR4, "Fehler: Die selben Farben!"
+STRING_CONSOLE_ERROR, "Unbekannter Fehler: %d\n"
+STRING_COPY_ERROR1, "Fehler: Quelle kann nicht geoeffnet werden - %s!\n"
+STRING_COPY_ERROR2, "Fehler: Kann nicht ueber sich selbst kopiert werden.\n"
+STRING_COPY_ERROR3, "Fehler Schreibziel!\n"
+STRING_COPY_ERROR4, "Fehler: Noch nicht implementiert!\n"
+STRING_DATE_ERROR, "Ungueltiges Datum."
+STRING_DEL_ERROR5, "Die Datei %s wird geloescht! "
+STRING_DEL_ERROR6, "Sind Sie sicher (J/N)?"
+STRING_DEL_ERROR7, "Loeschen: %s\n"
+STRING_ERROR_ERROR1, "Unbekannter Fehler! Fehlernummer: 0x%lx\n"
+STRING_ERROR_ERROR2, "Syntax-Fehler"
+STRING_FOR_ERROR1, "'in' fehlt fuer ein statement."
+STRING_FOR_ERROR2, "Klammern nicht gefunden."
+STRING_FOR_ERROR3, "'do' fehlt."
+STRING_FOR_ERROR4, "kein Befehl nach 'do'."
+STRING_FREE_ERROR1, "Ungueltiges Laufwerk"
+STRING_FREE_ERROR2, "keine Bezeichnung"
+STRING_GOTO_ERROR1, "Keine Sprungmarke fuer GOTO gesetzt"
+STRING_GOTO_ERROR2, "Sprungmarke '%s' wurde nicht gefunden\n"
+
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[FEHLER]\n"
+
+STRING_REN_ERROR1, "MoveFile() ist fehlgeschlagen. Fehler: %lu\n"
+
+STRING_START_ERROR1, "No batch support at the moment!"
+
+STRING_TIME_ERROR1, "Ungueltige Zeit."
+
+STRING_TYPE_ERROR1, "Ungueltige Option '/%s'\n"
+
+STRING_WINDOW_ERROR1, "Fenster nicht gefunden"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "Parameterformat ist nicht korrect - %c\n"
+STRING_ERROR_INVALID_SWITCH, "Ungueltiger Parameter - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "Zu viele Parameters - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "Pfad wurde nicht gefunden\n"
+STRING_ERROR_FILE_NOT_FOUND, "Datei wurde nicht gefunden\n"
+STRING_ERROR_REQ_PARAM_MISSING, "Benoetigter Parameter fehlt\n"
+STRING_ERROR_INVALID_DRIVE, "Ungueltige Laufwerksangaben\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "Ungueltiges Parameterformat - %s\n"
+STRING_ERROR_BADCOMMAND, "Ungueltiger Befehl oder Dateiname\n"
+STRING_ERROR_OUT_OF_MEMORY, "Fehler: Zu wenig Speicher verfuegbar.\n"
+STRING_ERROR_CANNOTPIPE, "Error! Cannot pipe! Cannot open temporary file!\n"
+STRING_ERROR_D_PAUSEMSG, "Druecken Sie eine beliebige Taste . . ."
+STRING_ERROR_DRIVER_NOT_READY, "Laufwerk ist nicht bereit"
+
+STRING_PATH_ERROR, "CMD: Not in environment '%s'\n"
+
+STRING_CMD_SHELLINFO, "\nReactOS Befehlszeilen Interpreter"
+STRING_VERSION_RUNVER, " laeuft in %s"
+STRING_COPY_FILE , " %d Datei(en) kopiert\n"
+STRING_DELETE_WIPE, "wiped"
+STRING_FOR_ERROR, "ungueltige Variablenangabe."
+STRING_SCREEN_COL, "ungueltige Spalten-Angabe"
+STRING_SCREEN_ROW, "ungueltige Zeilen-Angabe"
+STRING_TIMER_TIME "Timer %d ist %s: "
+}
diff --git a/reactos/base/shell/cmd/En.rc b/reactos/base/shell/cmd/En.rc
new file mode 100644
index 00000000000..ff9141f6149
--- /dev/null
+++ b/reactos/base/shell/cmd/En.rc
@@ -0,0 +1,650 @@
+#include "windows.h"
+#include "resource.h"
+/*
+ * Moved all hardcoded strings to En.rc.
+ * By Magnus Olsen 2005
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "Displays or changes file attributes.\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n\
+ [/S [/D]]\n\n\
+ + Sets an attribute\n\
+ - Clears an attribute\n\
+ R Read-only file attribute\n\
+ A Archive file attribute\n\
+ S System file attribute\n\
+ H Hidden file attribute\n\
+ /S Processes matching files in the current directory\n\
+ and all subdirectories\n\
+ /D Processes directories as well\n\n\
+Type ATTRIB without a parameter to display the attributes of all files.\n"
+
+STRING_ALIAS_HELP, "Sets, removes or shows aliases.\n\n\
+ALIAS [alias=[command]]\n\n\
+ alias Name for an alias.\n\
+ command Text to be substituted for an alias.\n\n\
+To list all aliases:\n\
+ ALIAS\n\n\
+To set a new or replace an existing alias:\n\
+ ALIAS da=dir a:\n\n\
+To remove an alias from the alias list:\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "Beep the speaker.\n\nBEEP\n"
+
+STRING_CALL_HELP, "Calls one batch program from another.\n\n\
+CALL [drive:][path]filename [batch-parameter]\n\n\
+ batch-parameter Specifies any command-line information required by the\n\
+ batch program."
+
+STRING_CD_HELP, "Changes the current directory or displays it's name\n\n\
+CHDIR [/D][drive:][path]\n\
+CHDIR[..|.]\n\
+CD [/D][drive:][path]\n\
+CD[..|.]\n\n\
+ .. parent directory\n\
+ . current directory\n\
+ /D Will change current drive and current directory.\n\n\
+Type CD drive: to display the current directory on the specified drive.\n\
+Type CD without a parameter to display the current drive and directory.\n"
+
+STRING_CHCP_HELP, "Displays or sets the active code page number.\n\n\
+CHCP [nnn]\n\n\
+ nnn Specifies the active code page number.\n\n\
+Type CHCP without a parameter to display the active code page number.\n"
+
+STRING_CHOICE_HELP, "Waits for the user to choose one of a set of choices.\n\n\
+CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n\
+ /C[:]choices Specifies allowable keys. Default is YN.\n\
+ /N Do not display choices and ? at the end of the prompt string.\n\
+ /S Treat choice keys as case sensitive.\n\
+ /T[:]c,nn Default choice to c after nn seconds.\n\
+ text Prompt string to display.\n\n\
+ERRORLEVEL is set to offset of key user presses in choices.\n"
+
+STRING_CLS_HELP, "Clears the screen.\n\nCLS\n"
+
+STRING_CMD_HELP1, "\nInternal commands available:\n"
+
+STRING_CMD_HELP2, "\nFeatures available:"
+
+STRING_CMD_HELP3," [aliases]"
+
+STRING_CMD_HELP4," [history]"
+
+STRING_CMD_HELP5," [unix filename completion]"
+
+STRING_CMD_HELP6," [directory stack]"
+
+STRING_CMD_HELP7," [redirections and piping]"
+
+STRING_CMD_HELP8, "Starts a new instance of the ReactOS command line interpreter.\n\n\
+CMD [/[C|K] command][/P][/Q][/T:bf]\n\n\
+ /C command Runs the specified command and terminates.\n\
+ /K command Runs the specified command and remains.\n\
+ /P CMD becomes permanent and runs autoexec.bat\n\
+ (cannot be terminated).\n\
+ /T:bf Sets the background/foreground color (see COLOR command).\n"
+
+STRING_COLOR_HELP1, "Sets the default foreground and background colors.\n\n\
+COLOR [attr [/-F]] \n\n\
+ attr Specifies color attribute of console output\n\
+ /-F Does not fill the console blank space with color attribute\n\n\
+There are three ways to specify the colors:\n\
+1) [bright] name on [bright] name (only the first three letters are required)\n\
+2) decimal on decimal\n\
+3) two hex digits\n\n\
+Colors are:\n\
+dec hex name dec hex name\n\
+0 0 Black 8 8 Gray(Bright black)\n\
+1 1 Blue 9 9 Bright Blue\n\
+2 2 Green 10 A Bright Green\n\
+3 3 Cyan 11 B Bright Cyan\n\
+4 4 Red 12 C Bright Red\n\
+5 5 Magenta 13 D Bright Magenta\n\
+6 6 Yellow 14 E Bright Yellow\n\
+7 7 White 15 F Bright White\n"
+
+STRING_COPY_HELP1, "Overwrite %s (Yes/No/All)? "
+
+STRING_COPY_HELP2, "Copies one or more files to another location.\n\n\
+COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n\
+ [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n\
+ source Specifies the file or files to be copied.\n\
+ /A Indicates an ASCII text file.\n\
+ /B Indicates a binary file.\n\
+ destination Specifies the directory and/or filename for the new file(s).\n\
+ /V Verifies that new files are written correctly.\n\
+ /Y Suppresses prompting to confirm you want to overwrite an\n\
+ existing destination file.\n\
+ /-Y Causes prompting to confirm you want to overwrite an\n\
+ existing destination file.\n\n\
+The switch /Y may be present in the COPYCMD environment variable.\n\
+...\n"
+
+STRING_DATE_HELP1, "\nEnter new date (mm%cdd%cyyyy): "
+
+STRING_DATE_HELP2, "\nEnter new date (dd%cmm%cyyyy): "
+
+STRING_DATE_HELP3, "\nEnter new date (yyyy%cmm%cdd): "
+
+STRING_DATE_HELP4, "Displays or sets the date.\n\n\
+DATE [/T][date]\n\n\
+ /T display only\n\n\
+Type DATE without parameters to display the current date setting and\n\
+a prompt for a new one. Press ENTER to keep the same date.\n"
+
+STRING_DEL_HELP1, "Deletes one or more files.\n\n\
+DEL [/N /P /T /Q /S /W /Y /Z /A[[:]attributes]] file ...\n\
+DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]attributes]] file ...\n\
+ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]attributes]] file ...\n\n\
+ file Specifies the file(s) to delete.\n\n\
+ /N Nothing.\n\
+ /P Prompt. Ask before deleting each file.\n\
+ /T Total. Display total number of deleted files and freed disk space.\n\
+ /Q Quiet.\n\
+ /W Wipe. Overwrite the file with random numbers before deleting it.\n\
+ /Y Yes. Kill even *.* without asking.\n\
+ /F Force Delete hidden, read-only and system files.\n\
+ /S Delete file from all sub directory\n\
+ /A Select files to be deleted based on attributes.\n\
+ attributes\n\
+ R Read Only files\n\
+ S System files\n\
+ A Archiveable files\n\
+ H Hidden Files\n\
+ - prefix meaning not\n"
+
+STRING_DEL_HELP2, "All files in the directory will be deleted!\nAre you sure (Y/N)?"
+STRING_DEL_HELP3, " %lu file deleted\n"
+STRING_DEL_HELP4, " %lu files deleted\n"
+
+STRING_DELAY_HELP, "pause for n seconds or milliseconds\n\
+DELAY [/m]n\n\n\
+ /m specifiy than n are milliseconds\n\
+ otherwise n are seconds\n"
+
+STRING_DIR_HELP1, "DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n\
+ [drive:][path][filename]\n\
+ Specifies drive, directory, and/or files to list.\n\n\
+ /A Displays files with specified attributes.\n\
+ attributes D Directories R Read-only files\n\
+ H Hidden files A Files ready for archiving\n\
+ S System files - Prefix meaning not\n\
+ /B Uses bare format (no heading information or summary).\n\
+ /C Display the thousand separator in file sizes. This is the\n\
+ default. Use /-C to disable display of separator.\n\
+ /D Same as wide but files are list sorted by column.\n\
+ /L Uses lowercase.\n\
+ /N New long list format where filenames are on the far right.\n\
+ /O List by files in sorted order.\n\
+ sortorder N By name (alphabetic) S By size (smallest first)\n\
+ E By extension (alphabetic) D By date/time (oldest first)\n\
+ G Group directories first - Prefix to reverse order\n\
+ /P Pauses after each screenful of information.\n\
+ /Q Display the owner of the file.\n\
+ /S Displays files in specified directory and all subdirectories.\n\
+ /T Controls which time field displayed or used for sorting\n\
+ timefield C Creation\n\
+ A Last Access\n\
+ W Last Written\n\
+ /W Uses wide list format.\n\
+ /X This displays the short names generated for non-8dot3 file\n\
+ names. The format is that of /N with the short name inserted\n\
+ before the long name. If no short name is present, blanks are\n\
+ displayed in its place.\n\
+ /4 Displays four-digit years\n\n\
+Switches may be preset in the DIRCMD environment variable. Override\n\
+preset switches by prefixing any switch with - (hyphen)--for example, /-W.\n"
+
+STRING_DIR_HELP2, " Volume in drive %c is %s\n"
+STRING_DIR_HELP3, " Volume in drive %c has no label.\n"
+STRING_DIR_HELP4, " Volume Serial Number is %04X-%04X\n"
+STRING_DIR_HELP5, "\n Total Files Listed:\n%16i File(s)% 14s bytes\n"
+STRING_DIR_HELP6, "%16i Dir(s)% 15s bytes\n"
+STRING_DIR_HELP7, "\n Directory of %s\n\n"
+STRING_DIR_HELP8, "%16i File(s)% 14s bytes\n"
+
+STRING_DIRSTACK_HELP1, "Stores the current directory for use by the POPD command, then\n\
+changes to the specified directory.\n\n\
+PUSHD [path | ..]\n\n\
+ path Specifies the directory to make the current directory\n"
+
+STRING_DIRSTACK_HELP2, "Changes to the directory stored by the PUSHD command.\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "Prints the contents of the directory stack.\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "Directory stack empty"
+
+STRING_ECHO_HELP1, "Display a messages without trailing carriage return and line feed.\n\n\
+ ECHOS message"
+
+STRING_ECHO_HELP2, "Displays a message to the standard error output.\n\n\
+ ECHOERR message\n\
+ ECHOERR. prints an empty line"
+
+STRING_ECHO_HELP3, "Prints a messages to standard error output without trailing carriage return and line feed.\n\n\
+ ECHOSERR message"
+
+STRING_ECHO_HELP4, "Displays a message or switches command echoing on or off.\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [message]\n\
+ ECHO. prints an empty line\n\n\
+Type ECHO without a parameter to display the current ECHO setting."
+
+STRING_ECHO_HELP5, "ECHO is %s\n"
+
+STRING_EXIT_HELP, "Exits the command line interpreter.\n\nEXIT\n"
+
+STRING_FOR_HELP1, "Runs a specified command for each file in a set of files\n\n\
+FOR %variable IN (set) DO command [parameters]\n\n\
+ %variable Specifies a replaceable parameter.\n\
+ (set) Specifies a set of one or more files. Wildcards may be used.\n\
+ command Specifies the command to carry out for each file.\n\
+ parameters Specifies parameters or switches for the specified command.\n\n\
+To use the FOR command in a batch program, specify %%variable instead of\n\
+%variable.\n"
+
+STRING_FREE_HELP1, "\nVolume in drive %s is %-11s\n\
+ Serial number is %s\n\
+ %16s bytes total disk space\n\
+ %16s bytes used\n\
+ %16s bytes free\n"
+
+STRING_FREE_HELP2, "Displays drive information.\n\nFREE [drive: ...]\n"
+
+STRING_IF_HELP1, "Performs conditional processing in batch programs.\n\n\
+ IF [NOT] ERRORLEVEL number command\n\
+ IF [NOT] string1==string2 command\n\
+ IF [NOT] EXIST filename command\n\
+ IF [NOT] DEFINED variable command\n\n\
+NOT Specifies that CMD should carry out the command only if\n\
+ the condition is false\n\
+ERRORLEVEL number Specifies a true condition if the last program run returned\n\
+ an exit code equal or greater than the number specified.\n\
+command Specifies the command to carry out if the condition is met.\n\
+string1==string2 Specifies a true condition if the specified text strings\n\
+ match.\n\
+EXIST filename Specifies a true condition if the specified filename exists.\n\
+DEFINED variable Specifies a true condition if the specified variable is\n\
+ defined.\n"
+
+STRING_GOTO_HELP1, "Directs CMD to a labeled line in a batch script.\n\n\
+GOTO label\n\n\
+ label Specifies a text string used in a batch script as a label.\n\n\
+You type a label on a line by itself, beginning with a colon."
+
+STRING_LABEL_HELP1, "Displays or changes drive label.\n\nLABEL [drive:][label]\n"
+
+STRING_LABEL_HELP2, "Volume in drive %c: is %s\n"
+STRING_LABEL_HELP3, "Volume in drive %c: has no label\n"
+STRING_LABEL_HELP4, "Volume Serial Number is %04X-%04X\n"
+STRING_LABEL_HELP5, "Drive label (11 Characters, ENTER if none)? "
+
+STRING_LOCALE_HELP1, "Current time is"
+
+STRING_MKDIR_HELP, "Creates a directory.\n\n\
+MKDIR [drive:]path\nMD [drive:]path"
+
+STRING_MEMMORY_HELP1, "Displays the amount of system memory.\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n %12s%% memory load.\n\n\
+ %13s bytes total physical RAM.\n\
+ %13s bytes available physical RAM.\n\n\
+ %13s bytes total page file.\n\
+ %13s bytes available page file.\n\n\
+ %13s bytes total virtual memory.\n\
+ %13s bytes available virtual memory.\n"
+
+STRING_MISC_HELP1, "Press a key to continue...\n"
+
+STRING_MOVE_HELP1, "Overwrite %s (Yes/No/All)? "
+
+STRING_MOVE_HELP2, "Moves files and renames files and directories.\n\n\
+To move one or more files:\n\
+MOVE [/N][drive:][path]filename1[,...] destination\n\n\
+To rename a directory:\n\
+MOVE [/N][drive:][path]dirname1 dirname2\n\n\
+ [drive:][path]filename1 Specifies the location and name of the file\n\
+ or files you want to move.\n\
+ /N Nothing. Do everything but move files or directories.\n\n\
+Current limitations:\n\
+ - You can't move a file or directory from one drive to another.\n"
+
+STRING_MSGBOX_HELP, "display a message box and return user responce\n\n\
+MSGBOX type ['title'] prompt\n\n\
+type button displayed\n\
+ possible values are: OK, OKCANCEL,\n\
+ YESNO, YESNOCANCEL\n\
+title title of message box\n\
+prompt text displayed by the message box\n\n\n\
+ERRORLEVEL is set according the button pressed:\n\n\
+YES : 10 | NO : 11\n\
+OK : 10 | CANCEL : 12\n"
+
+STRING_PATH_HELP1, "Displays or sets a search path for executable files.\n\n\
+PATH [[drive:]path[;...]]\nPATH ;\n\n\
+Type PATH ; to clear all search-path settings and direct the command shell\n\
+to search only in the current directory.\n\
+Type PATH without parameters to display the current path.\n"
+
+STRING_PROMPT_HELP1, "Changes the command prompt.\n\n\
+PROMPT [text]\n\n\
+ text Specifies a new command prompt.\n\n\
+Prompt can be made up of normal characters and the following special codes:\n\n\
+ $A & (Ampersand)\n\
+ $B | (pipe)\n\
+ $C ( (Left parenthesis)\n\
+ $D Current date\n\
+ $E Escape code (ASCII code 27)\n\
+ $F ) (Right parenthesis)\n\
+ $G > (greater-than sign)\n\
+ $H Backspace (erases previous character)\n\
+ $L < (less-than sign)\n\
+ $N Current drive\n\
+ $P Current drive and path\n\
+ $Q = (equal sign)\n\
+ $T Current time\n\
+ $V OS version number\n\
+ $_ Carriage return and linefeed\n\
+ $$ $ (dollar sign)\n"
+
+STRING_PAUSE_HELP1, "Stops the execution of a batch file and shows the following message:\n\
+'Press any key to continue...' or a user defined message.\n\n\
+PAUSE [message]"
+
+STRING_PROMPT_HELP2, " $+ Displays the current depth of the directory stack"
+
+STRING_PROMPT_HELP3, "\nType PROMPT without parameters to reset the prompt to the default setting."
+
+STRING_REM_HELP, "Starts a comment line in a batch file.\n\nREM [Comment]"
+
+STRING_RMDIR_HELP, "Removes a directory.\n\n\
+RMDIR [drive:]path\nRD [drive:]path\n\
+/S Deletes all files and folders within target\n\
+/Q Doesnt prompt for user\n"
+STRING_RMDIR_HELP2, "Directory is not empty!\n"
+
+STRING_REN_HELP1, "Renames a file/directory or files/directories.\n\n\
+RENAME [/E /N /P /Q /S /T] old_name ... new_name\n\
+REN [/E /N /P /Q /S /T] old_name ... new_name\n\n\
+ /E No error messages.\n\
+ /N Nothing.\n\
+ /P Prompts for confirmation before renaming each file.\n\
+ (Not implemented yet!)\n\
+ /Q Quiet.\n\
+ /S Rename subdirectories.\n\
+ /T Display total number of renamed files.\n\n\
+Note that you cannot specify a new drive or path for your destination. Use\n\
+the MOVE command for that purpose.\n"
+
+STRING_REN_HELP2, " %lu file renamed\n"
+
+STRING_REN_HELP3, " %lu files renamed\n"
+
+STRING_SHIFT_HELP, "Changes the position of replaceable parameters in a batch file.\n\n\
+SHIFT [DOWN]"
+
+STRING_SCREEN_HELP, "move cursor and optionally print text\n\n\
+SCREEN row col [text]\n\n\
+ row row to wich move the cursor\n\
+ col column to wich move the cursor"
+
+STRING_SET_HELP, "Displays, sets, or removes environment variables.\n\n\
+SET [variable[=][string]]\n\n\
+ variable Specifies the environment-variable name.\n\
+ string Specifies a series of characters to assign to the variable.\n\n\
+Type SET without parameters to display the current environment variables.\n"
+
+STRING_START_HELP1, "Starts a command.\n\n\
+START command\n\n\
+ command Specifies the command to run.\n\n\
+At the moment all commands are started asynchronously.\n"
+
+STRING_TITLE_HELP, "Sets the window title for the command prompt window.\n\n\
+TITLE [string]\n\n\
+string Specifies the title for the command prompt window.\n"
+
+STRING_TIME_HELP1, "Displays or sets the system time.\n\n\
+TIME [/T][time]\n\n\
+ /T display only\n\n\
+Type TIME with no parameters to display the current time setting and a prompt\n\
+for a new one. Press ENTER to keep the same time.\n"
+
+STRING_TIME_HELP2, "Enter new time: "
+
+STRING_TIMER_HELP1, "Elapsed %d msecs\n"
+
+STRING_TIMER_HELP2, "Elapsed %02d%c%02d%c%02d%c%02d\n"
+
+STRING_TIMER_HELP3, "allow the use of ten stopwatches.\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON set stopwatch ON\n\
+ OFF set stopwatch OFF\n\
+ /S Split time. Return stopwatch split\n\
+ time without changing its value\n\
+ /n Specifiy the stopwatch number.\n\
+ Stopwatches available are 0 to 9\n\
+ If it is not specified default is 1\n\
+ /Fn Format for output\n\
+ n can be:\n\
+ 0 milliseconds\n\
+ 1 hh%cmm%css%cdd\n\n\
+if none of ON, OFF or /S is specified the command\n\
+will toggle stopwatch state\n\n"
+
+STRING_TYPE_HELP1, "Displays the contents of text files.\n\nTYPE [drive:][path]filename \n\
+ /P Shows one screen of output at a time.\n"
+
+STRING_VERIFY_HELP1, "This command is just a dummy!!\n\
+Sets whether to verify that your files are written correctly to a\n\
+disk.\n\n\
+VERIFY [ON | OFF]\n\n\
+Type VERIFY without a parameter to display the current VERIFY setting.\n"
+
+STRING_VERIFY_HELP2, "VERIFY is %s.\n"
+
+STRING_VERIFY_HELP3, "Must specify ON or OFF."
+
+STRING_VERSION_HELP1, "Displays shell version information\n\n\
+VER [/C][/R][/W]\n\n\
+ /C Displays credits.\n\
+ /R Displays redistribution information.\n\
+ /W Displays warranty information."
+
+STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n\
+type: `ver /w'. This is free software, and you are welcome to redistribute\n\
+it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n\
+listing of credits."
+
+STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details."
+
+STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version.\n"
+
+STRING_VERSION_HELP5, "\nSend bug reports to .\n\
+Updates are available at: http://www.reactos.org"
+
+STRING_VERSION_HELP6, "\nFreeDOS version written by:\n"
+
+STRING_VERSION_HELP7, "\nReactOS version written by:\n"
+
+STRING_VOL_HELP1, " Volume in drive %c: is %s"
+STRING_VOL_HELP2, " Volume in drive %c: has no label"
+STRING_VOL_HELP3, " Volume Serial Number is %04X-%04X\n"
+STRING_VOL_HELP4, "Displays the disk volume label and serial number, if they exist.\n\nVOL [drive:]"
+
+STRING_WINDOW_HELP1, "change console window aspect\n\n\
+WINDOW [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+/POS specify window placement and dimensions\n\
+MIN minimize the window\n\
+MAX maximize the window\n\
+RESTORE restore the window"
+
+STRING_WINDOW_HELP2, "change console window aspect\n\n\
+ACTIVATE 'window' [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+window tile of window on wich perform actions\n\
+/POS specify window placement and dimensions\n\
+MIN minimize the window\n\
+MAX maximize the window\n\
+RESTORE restore the window\n\
+title new title\n"
+
+
+STRING_HELP1, "List of all available commands (+ description)\n\n\
+ command /? For more information on a specific command\n\n\
+? List all available commands without description).\n\
+ALIAS Sets, removes or shows aliases.\n\
+ATTRIB Displays or changes file attributes.\n\
+BEEP Beep the speaker.\n\
+CALL Calls one batch program from another.\n\
+CD Displays the name of or changes the current directory.\n\
+CHCP Displays or sets the active code page number.\n\
+CHOICE Waits for the user to choose one of a set of choices.\n\
+CLS Clears the screen.\n\
+CMD Starts a new instance of the ReactOS command interpreter.\n\
+COLOR Sets the default console foreground and background colors.\n\
+COPY Copies one or more files to another location.\n\
+DATE Displays or sets the date.\n\
+DELETE Deletes one or more files.\n\
+DIR Displays a list of files and subdirectories in a directory.\n\
+ECHO Displays messages, or turns command echoing on or off.\n\
+ERASE Deletes one or more files.\n\
+EXIT Quits the CMD.EXE program (command interpreter).\n\
+FOR Runs a specified command for each file in a set of files.\n\
+FREE (free) disc space.\n\
+GOTO Directs the ReactOS command interpreter to a labeled line in\n\
+ a batch program.\n\
+HELP Provides Help information for ReactOS commands.\n\
+HISTORY List alle commands which has been used\n\
+IF Performs conditional processing in batch programs.\n\
+LABEL Creates, changes, or deletes the volume label of a disk.\n\
+MD Creates a directory.\n\
+MKDIR Creates a directory.\n\
+MOVE Moves one or more files from one directory to another\n\
+ directory.\n\
+PATH Displays or sets a search path for executable files.\n\
+PAUSE Suspends processing of a batch file and displays a message.\n\
+POPD Restores the previous value of the current directory saved by\n\
+ PUSHD.\n\
+PROMPT Changes the command prompt.\n\
+PUSHD Saves the current directory then changes it.\n\
+RD Removes a directory.\n\
+REM Records comments (remarks) in batch files.\n\
+REN Renames a file or files.\n\
+RENAME Renames a file or files.\n\
+RMDIR Removes a directory.\n\
+SCREEN Move cursor and optionally print text.\n\
+SET Displays, sets, or removes ReactOS environment variables.\n\
+SHIFT Shifts the position of replaceable parameters in batch files.\n"
+STRING_HELP2, "START Starts a separate window to run a specified program or command.\n\
+ Executes command.\n\
+TIME Displays or sets the system time.\n\
+TIMER Allow the use of ten stopwaches.\n\
+TITLE Sets the window title for a CMD.EXE session.\n\
+TYPE Displays the contents of a text file.\n\
+VER Displays the ReactOS version.\n\
+VERIFY Tells ReactOS whether to verify that your files are written\n\
+ correctly to a disk.\n\
+VOL Displays a disk volume label and serial number.\n"
+
+
+STRING_CHOICE_OPTION, "YN"
+STRING_COPY_OPTION, "YNA"
+
+
+STRING_ALIAS_ERROR, "Command line too long after alias expansion!\n"
+STRING_BATCH_ERROR, "Error opening batch file\n"
+STRING_CHCP_ERROR1, "Active code page: %u\n"
+STRING_CHCP_ERROR4, "Invalid code page\n"
+STRING_CHOICE_ERROR, "Invalid option. Expected format: /C[:]options"
+STRING_CHOICE_ERROR_TXT, "Invalid option. Expected format: /T[:]c,nn"
+STRING_CHOICE_ERROR_OPTION, "Illegal Option: %s"
+STRING_MD_ERROR, "A subdirectory or file already exists.\n"
+STRING_MD_ERROR2, "The path to the new folder does not exist.\n"
+STRING_CMD_ERROR1, "Can't redirect input from file %s\n"
+STRING_CMD_ERROR2, "Error creating temporary file for pipe data\n"
+STRING_CMD_ERROR3, "Can't redirect to file %s\n"
+STRING_CMD_ERROR4, "Running %s...\n"
+STRING_CMD_ERROR5, "Running cmdexit.bat...\n"
+STRING_COLOR_ERROR1, "Same colors error! (Background and foreground can't be the same color)"
+STRING_COLOR_ERROR2, "error in color specification"
+STRING_COLOR_ERROR3, "Color %x\n"
+STRING_COLOR_ERROR4, "same colors error!"
+STRING_CONSOLE_ERROR, "Unknown error: %d\n"
+STRING_COPY_ERROR1, "Error: Cannot open source - %s!\n"
+STRING_COPY_ERROR2, "Error: Can't copy onto itself!\n"
+STRING_COPY_ERROR3, "Error writing destination!\n"
+STRING_COPY_ERROR4, "Error: Not implemented yet!\n"
+STRING_DATE_ERROR, "Invalid date."
+STRING_DEL_ERROR5, "The file %s will be deleted! "
+STRING_DEL_ERROR6, "Are you sure (Y/N)?"
+STRING_DEL_ERROR7, "Deleting: %s\n"
+STRING_ERROR_ERROR1, "Unknown error! Error code: 0x%lx\n"
+STRING_ERROR_ERROR2, "Syntax error"
+STRING_FOR_ERROR1, "'in' missing in for statement."
+STRING_FOR_ERROR2, "no brackets found."
+STRING_FOR_ERROR3, "'do' missing."
+STRING_FOR_ERROR4, "no command after 'do'."
+STRING_FREE_ERROR1, "Invalid drive"
+STRING_FREE_ERROR2, "unlabeled"
+STRING_GOTO_ERROR1, "No label specified for GOTO"
+STRING_GOTO_ERROR2, "Label '%s' not found\n"
+
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[Error]\n"
+
+STRING_REN_ERROR1, "MoveFile() failed. Error: %lu\n"
+
+STRING_START_ERROR1, "No batch support at the moment!"
+
+STRING_TIME_ERROR1, "Invalid time."
+
+STRING_TYPE_ERROR1, "Invalid option '/%s'\n"
+
+STRING_WINDOW_ERROR1, "window not found"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "Parameter format not correct - %c\n"
+STRING_ERROR_INVALID_SWITCH, "Invalid switch - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "Too many parameters - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "Path not found\n"
+STRING_ERROR_FILE_NOT_FOUND, "File not found\n"
+STRING_ERROR_REQ_PARAM_MISSING, "Required parameter missing\n"
+STRING_ERROR_INVALID_DRIVE, "Invalid drive specification\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "Invalid parameter format - %s\n"
+STRING_ERROR_BADCOMMAND, "Bad command or filename\n"
+STRING_ERROR_OUT_OF_MEMORY, "Out of memory error.\n"
+STRING_ERROR_CANNOTPIPE, "Error! Cannot pipe! Cannot open temporary file!\n"
+STRING_ERROR_D_PAUSEMSG, "Press any key to continue . . ."
+STRING_ERROR_DRIVER_NOT_READY, "Drive not ready"
+
+STRING_PATH_ERROR, "CMD: Not in environment '%s'\n"
+
+STRING_CMD_SHELLINFO, "\nReactOS Command Line Interpreter"
+STRING_VERSION_RUNVER, " running on %s"
+STRING_COPY_FILE , " %d file(s) copied\n"
+STRING_DELETE_WIPE, "wiped"
+STRING_FOR_ERROR, "bad variable specification."
+STRING_SCREEN_COL, "invalid value for col"
+STRING_SCREEN_ROW, "invalid value for row"
+STRING_TIMER_TIME "Timer %d is %s: "
+
+STRING_INVALID_OPERAND, "Invalid operand."
+STRING_EXPECTED_CLOSE_PAREN, "Expected ')'."
+STRING_EXPECTED_NUMBER_OR_VARIABLE,"Expected number or variable name."
+STRING_SYNTAX_COMMAND_INCORRECT, "The syntax of the command is incorrect."
+
+}
diff --git a/reactos/base/shell/cmd/Es.rc b/reactos/base/shell/cmd/Es.rc
new file mode 100644
index 00000000000..daaa3dc8ab4
--- /dev/null
+++ b/reactos/base/shell/cmd/Es.rc
@@ -0,0 +1,650 @@
+#include "windows.h"
+#include "resource.h"
+/*
+ * Spanish resource file by HUMA2000
+ * Jose Pedro Fernández Pascual 2005
+ */
+
+LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "Muestra o cambia los atributos de los archivos.\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n\
+ [/S [/D]]\n\n\
+ + Añade un atributo\n\
+ - Borra un atributo\n\
+ R Atributo de sólo lectura\n\
+ A Atributo de archivo\n\
+ S Atributo de archivo de sistema\n\
+ H Atributo de archivo oculto\n\
+ /S Procesa los archivos coincidentes en el directorio actual \n\
+ y sus subdirectorios\n\
+ /D Procesa también los directorios\n\n\
+Type ATTRIB without a parameter to display the attributes of all files.\n"
+
+STRING_ALIAS_HELP, "Pone, borra o muestra los alias.\n\n\
+ALIAS [alias=[command]]\n\n\
+ alias Nombre para un alias.\n\
+ command Texto a ser sustituido por el alias.\n\n\
+Para mostrar todos los alias:\n\
+ ALIAS\n\n\
+Para poner un nuevo o remplazar un alias existente:\n\
+ ALIAS da=dir a:\n\n\
+Para borrar un alias de la lista de alias:\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "Emite un pitido por el altavoz.\n\nBEEP\n"
+
+STRING_CALL_HELP, "Ejecuta un arhivo por lotes desde otro archivo por lotes.\n\n\
+CALL [drive:][path]filename [batch-parameter]\n\n\
+ batch-parameter Especifica cualquier informacion de la linea de comandos\n\
+ requerida por el archivo por lotes."
+
+STRING_CD_HELP, "Cambia el directorio actual o muestra su nombre.\n\n\
+CHDIR [/D][drive:][path]\n\
+CHDIR[..|.]\n\
+CD [/D][drive:][path]\n\
+CD[..|.]\n\n\
+ .. Directorio padre.\n\
+ . Directorio actual.\n\
+ /D Cambiara la unidad y el directorio actual.\n\n\
+Escribe CD unidad: para mostrar el directorio actual en la unidad especificada.\n\
+Escribe CD sin ningun parámetro para mostrar la unidad y el directorio actual.\n"
+
+STRING_CHCP_HELP, "Muestra o configura el número de página de código activa.\n\n\
+CHCP [nnn]\n\n\
+ nnn Especifica el número de página de código activa.\n\n\
+Escribe CHCP sin ningún parámetro para mostrar el código de página activo.\n"
+
+STRING_CHOICE_HELP, "Espera a que el usuario elija entre un número de opciones.\n\n\
+CHOICE [/C[:]choices][/N][/S][/T[:]c,nn][text]\n\n\
+ /C[:]choices Especifica las teclas admitidas. Por defecto son SN.\n\
+ /N No muestra las posibles elecciones y ? al final del prompt.\n\
+ /S Hace que la elección sea sensible a las mayúsculas y minúsculas.\n\
+ /T[:]c,nn La elección por defecto será c después de nn segundos.\n\
+ text Prompt a mostrar. \n\n\
+ERRORLEVEL se configura al offset de la tecla que presione el usuario.\n"
+
+STRING_CLS_HELP, "Limpia la pantalla.\n\nCLS\n"
+
+STRING_CMD_HELP1, "\nComandos internos disponibles:\n"
+
+STRING_CMD_HELP2, "\nCaracterísticas disponibles:"
+
+STRING_CMD_HELP3," [alias]"
+
+STRING_CMD_HELP4," [historia]"
+
+STRING_CMD_HELP5," [Completador de nombres de archivos unix]"
+
+STRING_CMD_HELP6," [Pila de directorios]"
+
+STRING_CMD_HELP7," [Redirecciones y túneles]"
+
+STRING_CMD_HELP8, "Comienza una nueva sesion del interprete de comandos de ReactOS.\n\n\
+CMD [/[C|K] command][/P][/Q][/T:bf]\n\n\
+ /C command Ejecuta el comando especificado y cierra.\n\
+ /K command Ejecuta eñ comando especificado y permanece.\n\
+ /P CMD se hace permanente y ejecuta el autoexec.bat\n\
+ (no puede ser cerrado).\n\
+ /T:bf Configura el color de fondo/primer plano (mirar el comando COLOR).\n"
+
+STRING_COLOR_HELP1, "Configura el color de primer plano y fondo.\n\n\
+COLOR [attr [/-F]] \n\n\
+ attr Especifica el atributo de color de salida de consola.\n\
+ /-F No rellena el espacio en blanco de la consola con el color del atributo.\n\n\
+Hay tres maneras de especificar los colores:\n\
+1) [bright] nombre on [bright] nombre (solo las tres primeras letras del nombre son necesarias)\n\
+2) decimal on decimal\n\
+3) dos dígitos hexadecimales\n\n\
+Los colores son:\n\
+dec hex nombre dec hex name\n\
+0 0 Negro 8 8 Gris(Negro brillante)\n\
+1 1 Azul 9 9 Azul brillante\n\
+2 2 Verde 10 A Verde brillante\n\
+3 3 Cyan 11 B Cyan brillante\n\
+4 4 Rojo 12 C Rojo brillante\n\
+5 5 Magenta 13 D Magenta brillante\n\
+6 6 Amarillo 14 E Amarillo brillante\n\
+7 7 Blanco 15 F Blanco brillante\n"
+
+STRING_COPY_HELP1, "Sobreescribir %s (Si/No/Todos)? "
+
+STRING_COPY_HELP2, "Copia uno o mas archivos a otro lugar.\n\n\
+COPY [/V][/Y|/-Y][/A|/B] origen [/A|/B]\n\
+ [+ origen [/A|/B] [+ ...]] [destino [/A|/B]]\n\n\
+ origen Especifica el archivo o archivos a copiar.\n\
+ /A Indica un archivo de texto ASCII.\n\
+ /B Indica un archivo binario.\n\
+ destino Especifica el directorio y/o nombre de archivo para los nuevos archivos.\n\
+ /V Verifica que el nuevo archivo se ha escrito correctamente.\n\
+ /Y Suprime la confirmación sobre si quieres sobreescribir un archivo\n\
+ de destino existente.\n\
+ /-Y Hace que te pregunte si quieres sobreescribir un archivo de destino\n\
+ existente.\n\n\
+El parametro /Y tiene que estar presente en las variables de entorno de COPYCMD.\n\
+...\n"
+
+STRING_DATE_HELP1, "\nIntroduce la nueva fecha (mm%cdd%cyyyy): "
+
+STRING_DATE_HELP2, "\nIntroduce la nueva fecha (dd%cmm%cyyyy): "
+
+STRING_DATE_HELP3, "\nIntroduce la nueva fecha (yyyy%cmm%cdd): "
+
+STRING_DATE_HELP4, "Muestra o cambia la fecha.\n\n\
+DATE [/T][date]\n\n\
+ /T Sólo la muestra\n\n\
+Escribe DATE sin parámetros para mostrar la fecha actual y establecer\n\
+una nueva fecha. Pulsa INTRO para mantener la misma fecha.\n"
+
+STRING_DEL_HELP1, "Borra uno o mas archivos.\n\n\
+DEL [/N /P /T /Q /S /W /Y /Z /A[[:]atributos]] archivo ...\n\
+DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]atributos]] archivo ...\n\
+ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]atributos]] archivo ...\n\n\
+ archivo Espacifica el/los archivo(s) a borrar.\n\n\
+ /N Nada.\n\
+ /P Prompt. Pregunta antes de borar cada archivo\n\
+ /T Total. Muestra el número total de archivos eliminados y el espacio\n\
+ liberado en disco\n\
+ /Q Modo silencioso.\n\
+ /W Limpiar. Sobreescribe el archivo con números aleatorios después de eliminarlo.\n\
+ /Y Si. Borra incluso *.* sin preguntar.\n\
+ /F Fuerza el borrade de archivos ocultos, de sólo lectura y de sistema.\n\
+ /S Borra los archivos de todos los subdirectorios.\n\
+ /A Selecciona los archivos a borrar en base a los atributos especificados.\n\
+ R Archivos de sólo lectura\n\
+ S Archivos de sistema\n\
+ A Archivos listos para archivar\n\
+ H Archivos ocultos\n\
+ - Prefijo que signifca sin\n"
+
+STRING_DEL_HELP2, "¡Todos los archivos del directorio van a ser borrados!\n¿Estás seguro? (S/N)?"
+STRING_DEL_HELP3, " Archivo %lu borrado\n"
+STRING_DEL_HELP4, " Archivos %lu borrados\n"
+
+STRING_DELAY_HELP, "Espera por n segundos o milisegundos\n\
+DELAY [/m]n\n\n\
+ /m Especifica que n son milisegundos\n\
+ En otro caso n son segundos\n"
+
+STRING_DIR_HELP1, "DIR [unidad:][ruta][nombre de archivo] [/A[[:]atributos]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]orden]] [/P] [/Q] [/S] [/T[[:]fecha]] [/W] [/X] [/4]\n\n\
+ [unidad:][ruta][nombre de archivo]\n\
+ Especifica la unidad, el directorio o los archivos a listar.\n\n\
+ /A Muestra los archivos con los atributos especificados.\n\
+ atributos D Directorios R Archivos de sólo lectur\n\
+ H Archivos ocultos A Archivos listos para archivar\n\
+ S Archivos de sistema - Prefijo que signifca sin\n\
+ /B Usa el formato simple (sin encabezado ni sumario).\n\
+ /C Muestra el separador de miles en los tamaños de los archivos. Es la opción\n\
+ por defecto. Usa /-C para desactivar el mostrar el separador.\n\
+ /D Lo mismo que el formato a lo ancho, pero ordenados en columna.\n\
+ /L Usa minúsculas.\n\
+ /N Nuevo formato de lista larga donde los nombres de archivo están a la \n\
+ derecha.\n\
+ /O Muestra los archivos ordenados según el orden especificado.\n\
+ ordenación N Por nombre (alfabético) S Por tamaño (los menores primero)\n\
+ E Por extensión (alfabético) D Por fecha/hora (los antiguos primero)\n\
+ G Los directorios primero - Prefijo para el orden inverso\n\
+ /P Pausa después de cada pantalla llena de información.\n\
+ /Q Muestra el propietario del archivo.\n\
+ /S Muestra los archivos en el directorio especificado y sus subdirectorios.\n\
+ /T Controla que campo de tiempo se muestra o es usado para ordenar:\n\
+ campo de tiempo C Creación\n\
+ A Último acceso\n\
+ W Última escritura\n\
+ /W Usa el formato de lista a lo ancho.\n\
+ /X Muestra los nombres cortos generados para archivos que no tienen un\n\
+ nombre 8.3. El formato es como /N pero con el nombre corto colocado\n\
+ antes del nombre largo. Si no hay nombre corto, se muestran espacios\n\
+ en blanco en su lugar.\n\
+ /4 Muestra los cuatro dígitos del año\n\n\
+Los modificadores pueden estar presentes en la variable de entorno de DIRCMD. Omite los\n\
+ajustes previos anteponiendo a cualquier modificador - (hyphen)--por ejemplo, /-W.\n"
+
+STRING_DIR_HELP2, " El volumen en la unidad %c es %s\n"
+STRING_DIR_HELP3, " El volumen en la unidad %c no tiene etiqueta.\n"
+STRING_DIR_HELP4, " El volumen Serial Number is %04X-%04X\n"
+STRING_DIR_HELP5, "\n Total de archivos mostrados:\n%16i archivo(s)% 14s bytes\n"
+STRING_DIR_HELP6, "%16i Directorio(s)% 15s bytes\n"
+STRING_DIR_HELP7, "\n Directorio %s\n\n"
+STRING_DIR_HELP8, "%16i archivo(s)% 14s bytes\n"
+
+STRING_DIRSTACK_HELP1, "Almacena el directorio actual para usarlo por el comando, \n\
+entonces cambia al directorio especificado.\n\n\
+PUSHD [ruta | ..]\n\n\
+ ruta Especifica el directorio para hacerlo el directorio actual\n"
+
+STRING_DIRSTACK_HELP2, "Cambia al directorio guardado por el comando PUSHD.\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "Muestra el contenido de la pila de directorios.\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "Vacia la pila de directorios"
+
+STRING_ECHO_HELP1, "Muestra un mensaje sin necesidad de pulsar intro y \n\
+salta a la siguiente linea.\n\n\
+ ECHOS mensaje"
+
+STRING_ECHO_HELP2, "Muestra los mensajes de error por defecto.\n\n\
+ ECHOERR mensaje\n\
+ ECHOERR. Imprime una linea vacia"
+
+STRING_ECHO_HELP3, "Muestra mensajes en la salida estandar de error sin pulsar intro y\n\
+pasa de linea.\n\n\
+ ECHOSERR mensaje"
+
+STRING_ECHO_HELP4, "Muestra un mensaje o cambia el mostrar los comandos activo/inactivo.\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [mensaje]\n\
+ ECHO. Muestra una linea vacia\n\n\
+Escribe ECHO sin parámetros para mostrar la configuración actual de ECHO."
+
+STRING_ECHO_HELP5, "ECHO está %s\n"
+
+STRING_EXIT_HELP, "Sale del interprete de la linea de comandos.\n\nEXIT\n"
+
+STRING_FOR_HELP1, "Ejecuta un comando específico para cada archivo de un grupo de archivos.\n\n\
+FOR %variable IN (grupo) DO comando [parametros]\n\n\
+ %variable Especifica un parámetro remplazable.\n\
+ (set) Especifica un grupo de uno o mas archivos. Los comodines pueden usarse.\n\
+ command Especifica el comando a ejecutar para cada archivo.\n\
+ parameters Especifica los parametros o modificadores para el comando especificado.\n\n\
+Para usar el comando FOR en un archivo por lotes, especifica %%variable en lugar de\n\
+%variable.\n"
+
+STRING_FREE_HELP1, "\nEl volumen en la unidad %s es %-11s\n\
+ El número de serie es %s\n\
+ %16s bytes totales de espacio en disco\n\
+ %16s bytes usados\n\
+ %16s bytes libres\n"
+
+STRING_FREE_HELP2, "Muestra la información de la unidad.\n\nFREE [unidad: ...]\n"
+
+STRING_IF_HELP1, "Ejecuta procesos condicionales en archivos por lotes.\n\n\
+ IF [NOT] ERRORLEVEL número comando\n\
+ IF [NOT] string1==string2 comando\n\
+ IF [NOT] EXIST archivo comando\n\
+ IF [NOT] DEFINED variable comando\n\n\
+NOT Especifica que CMD solo llevará a cabo el comando si la \n\
+ condición es falsa.\n\
+ERRORLEVEL número Especifica una condición verdadera si el último programa devuelve\n\
+ un código de salida igual o superior al número especificado.\n\
+comando Especifica el comando a ejecutar si se cumple la condición.\n\
+string1==string2 Especifica una condición verdadera si las cadenas de texto coinciden.\n\
+EXIST archivo Especifica una condición verdadera si existe el archivo especificado.\n\
+DEFINED variable Especifica una condición verdadera si la variable está definida.\n"
+
+STRING_GOTO_HELP1, "Manda al CMD a una linea etiquetada en un archivo por lotes.\n\n\
+GOTO etiqueta\n\n\
+ etiqueta Especifica la cadena de texto usada en el archivo por lotes como etiqueta.\n\n\
+Escriba la etiqueta en la linea misma, empezando con dos puntos."
+
+STRING_LABEL_HELP1, "Muestra o cambia la etiqueta de una unidad.\n\nLABEL [unidad:][etiqueta]\n"
+
+STRING_LABEL_HELP2, "El volumen en la unidad %c: es %s\n"
+STRING_LABEL_HELP3, "El volumen en la unidad %c: no tiene etiqueta\n"
+STRING_LABEL_HELP4, "El número de serie del volumen es %04X-%04X\n"
+STRING_LABEL_HELP5, "Etiqueta del volumen (11 Caracteres, INTRO para ninguna)? "
+
+STRING_LOCALE_HELP1, "La hora actual es"
+
+STRING_MKDIR_HELP, "Crea un directorio.\n\n\
+MKDIR [unidad:]ruta\nMD [unidad:]ruta"
+
+STRING_MEMMORY_HELP1, "Muestra la cantidad de memoria del sistema.\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n %12s%% carga de memoria.\n\n\
+ %13s bytes totales de RAM física.\n\
+ %13s bytes libres de RAM física.\n\n\
+ %13s bytes totales del archivo de paginación.\n\
+ %13s bytes disponibles del archivo de paginación.\n\n\
+ %13s bytes totales de memoria virtual.\n\
+ %13s bytes disponibles de memoria virtual.\n"
+
+STRING_MISC_HELP1, "Pulsa cualquier tecla para continuar...\n"
+
+STRING_MOVE_HELP1, "¿Sobreescribir %s (Si/No/Todos)? "
+
+STRING_MOVE_HELP2, "Mueve archivos y renombra archivos y directorios.\n\n\
+Para mover uno o más archivos:\n\
+MOVE [/N][unidad:][ruta]archivo1[,...] destino\n\n\
+Para renombrar un directorio:\n\
+MOVE [/N][unidad:][ruta]directorio1 directorio2\n\n\
+ [unidad:][ruta]archivo1 Especifica la localización y el nombre del archivo\n\
+ o archivos que quieres mover.\n\
+ /N Nada. Hace todo menos mover archivos o directorios.\n\n\
+Limitaciones actules:\n\
+ - No puedes mover un archivo o directorio de una unidad a otra.\n"
+
+STRING_MSGBOX_HELP, "Muestra un cuadro de mensaje y devuelve la respuesta del usuario.\n\n\
+MSGBOX tipo ['titulo'] pregunta\n\n\
+tipo buton a mostrar\n\
+ los valores posibles son: OK, OKCANCELAR,\n\
+ SINO, SINOCANCELAR\n\
+titulo titulo del cuadro de mensaje\n\
+pregunta texto a mostrar por el cuadro de mensaje\n\n\n\
+ERRORLEVEL se configurara en función del botón pulsado:\n\n\
+SI : 10 | NO : 11\n\
+OK : 10 | CANCELAR: 12\n"
+
+STRING_PATH_HELP1, "Muestra o cambia la ruta de búsqueda de archivos ejecutables.\n\n\
+PATH [[unidad:]ruta[;...]]\nRuta ;\n\n\
+Escribe PATH ; para limpiar todas las configuraciones de búsqueda y usar solo el\n\
+directorio actual del interprete de comandos.\n\
+Escribe PATH sin parámetros para mostrar la ruta actual.\n"
+
+STRING_PROMPT_HELP1, "Cambia el símbolo de comandos.\n\n\
+PROMPT [texto]\n\n\
+ texto Epecifica un nuevo símbolo de comandos.\n\n\
+El símbolo de comandos puede hacerce con carácteres normales y los siguientes \n\
+códigos especiales:\n\n\
+ $A & (Signo y)\n\
+ $B | (Linea horizontal)\n\
+ $C ( (Paréntesis izquierdo)\n\
+ $D Fecha actual\n\
+ $E Código de escape (código ASCII 27)\n\
+ $F ) (Paréntesis derecho)\n\
+ $G > (Signo mayor que)\n\
+ $H Borra el caracter anterior\n\
+ $L < (Signo menor que)\n\
+ $N Unidad actual\n\
+ $P Unidad y ruta actuales\n\
+ $Q = (signo igual)\n\
+ $T Hora actual\n\
+ $V Número de versión del SO\n\
+ $_ Salto de linea\n\
+ $$ $ (signo del dolar)\n"
+
+STRING_PAUSE_HELP1, "Detiene la ejecución del archivo por lotes actual y muestra el\n\
+siguiente mensaje:\n\
+'Pulsa cualquier tecla para continuar...' o un mensaje definido por el usuario.\n\n\
+PAUSE [mensaje]"
+
+STRING_PROMPT_HELP2, " $+ Muestra la profundidad actual de la pila de directorios"
+
+STRING_PROMPT_HELP3, "\nEscribe PROMPT sin parámetros para resetear el símbolo de \n\
+comandos a su configuración por defecto."
+
+STRING_REM_HELP, "Comienza una liena de comentarios en un archivo por lotes\n\nREM [Comentario]"
+
+STRING_RMDIR_HELP, "Remueve un directorio.\n\n\
+RMDIR [unidad:]ruta\nRD [unidad:]ruta"
+
+STRING_REN_HELP1, "Renombra un archivo/directorio o varios archivos/directorios.\n\n\
+RENAME [/E /N /P /Q /S /T] nombre_antiguo ... nuevo_nombre\n\
+REN [/E /N /P /Q /S /T] nombre_antiguo ... nuevo_nombre\n\n\
+ /E No muestra mensajes de error.\n\
+ /N Nada.\n\
+ /P Pregunta por la confirmación antes de cada archivo.\n\
+ (¡No implementado aún!)\n\
+ /Q Modo silencioso.\n\
+ /S Renombra los subdirectorios.\n\
+ /T Muestra el número total de archivos renombrados.\n\n\
+Note que no puede especificar una nueva unidad en el destino o ruta. Usa\n\
+el comando MOVE para este propósito.\n"
+
+STRING_REN_HELP2, " %lu archivos renombrados.\n"
+
+STRING_REN_HELP3, " %lu archivos renombrados.\n"
+
+STRING_SHIFT_HELP, "Cambia la posición de los parámetros remplazables en un \n\
+archivo por lotes.\n\n\
+SHIFT [ABAJO]"
+
+STRING_SCREEN_HELP, "Mueve el cursor y opcionalmente escribe un texto.\n\n\
+SCREEN fila columna [texto]\n\n\
+ fila Fila a la que mover el cursor.\n\
+ columna columna a la que mover el cursor."
+
+STRING_SET_HELP, "Muestra, cambia o borra las variables de entorno.\n\n\
+SET [variable[=][cadena]]\n\n\
+ variable Especifica el nombre de la variable de entorno.\n\
+ string Especifies la serie de caracteres para asignar a la variable.\n\n\
+Escribe SET sin parámetros para mostrar las variables de entorno actuales.\n"
+
+STRING_START_HELP1, "Empieza un comando.\n\n\
+START comando\n\n\
+ comando Especifica el comando a ejecutar.\n\n\
+Por el momento todos los comandos son ejecutados de forma asincrónica.\n"
+
+STRING_TITLE_HELP, "Cambia el título de la ventqana del intérprete de comandos.\n\n\
+TITLE [cadena]\n\n\
+cadena Especifica el título de la ventana del intérprete de comandos.\n"
+
+STRING_TIME_HELP1, "Muestra o cambia la hora del sistema.\n\n\
+TIME [/T][hora]\n\n\
+ /T Sólo la muestra\n\n\
+Escribe TIME sin parámetros para mostrar la hora actual y preguntar\n\
+por una nueva. Pulsa INTRO para mantener la misma hora.\n"
+
+STRING_TIME_HELP2, "Introduce la nueva hora: "
+
+STRING_TIMER_HELP1, "Transcurridos %d msecs\n"
+
+STRING_TIMER_HELP2, "Transcurridos %02d%c%02d%c%02d%c%02d\n"
+
+STRING_TIMER_HELP3, "Permite al usuario el uso de diez paradas de reloj.\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON Cambia la parada a ON\n\
+ OFF Cambia la parada a OFF\n\
+ /S Divide el tiempo. Devuelve una division de la parada del reloj\n\
+ sin cambiar su valor.\n\
+ /n Especifica el número de la parada de reloj.\n\
+ Las paradas de reloj disponibles son de 0 a 9\n\
+ Si no se especifica el valor por defecto es 1\n\
+ /Fn Formato de salida\n\
+ n puede ser:\n\
+ 0 millisegundos\n\
+ 1 hh%cmm%css%cdd\n\n\
+Si ni ON, OFF o /S se especifican, el comando\n\
+cambiara el estado de parada del reloj\n\n"
+
+STRING_TYPE_HELP1, "Muestra los contenidos de un archivo de texto.\n\nTYPE [unidad:][ruta]archivo \n\
+ /P Muestra sólo una pantalla de salida cada vez.\n"
+
+STRING_VERIFY_HELP1, "¡¡Este comando es solo de relleno!!\n\
+Configura si hay que verificar que los archivos se and escrito correctamente\n\
+en un disco.\n\n\
+VERIFY [ON | OFF]\n\n\
+Escribe VERIFY sin parámetros para mostrar la configuración actual de VERIFY.\n"
+
+STRING_VERIFY_HELP2, "VERIFY está %s.\n"
+
+STRING_VERIFY_HELP3, "Tienes que especificar ON o OFF."
+
+STRING_VERSION_HELP1, "Muestra la información de la versión del shell\n\n\
+VER [/C][/R][/W]\n\n\
+ /C Muestra los creditos.\n\
+ /R Muestra la información de redistribución.\n\
+ /W Muestra la información de la garantia."
+
+STRING_VERSION_HELP2, "Este software Viene con ABSOLUTAMENTE NINGUNA GARANTIA; para más detalles\n\
+escribe: `ver /w'. Este es un software gratuito, y estás invitado a redistribuirlo\n\
+bajo ciertas condiciones; escribe `ver /r' para los detalles. Escribe `ver /c' para una\n\
+lista de los créditos."
+
+STRING_VERSION_HELP3, "\n Este programa es distribuido con la esperanza de que sea útil,\n\
+ pero CON NINGUNA GARANTIA; incluso sin la garantía implícita de\n\
+ MERCADERIA o AJUSTE A UN PROPÓSITO PARTICULAR. Mira la\n\
+ Licencia Pública General GNU para más detalles."
+
+STRING_VERSION_HELP4, "\n Este programa es un software gratuito; puedes redistribuirlo y/o modificarlo\n\
+ bajo los términos de la Licencia Pública General GNU tal y como establece\n\
+ la Fundación de Software Libre; tanto en la versión 2 de la Licencia, o\n\
+ (según tu elección) cualquier otra posterior.\n"
+
+STRING_VERSION_HELP5, "\nManda los informes de bugs a .\n\
+Actualizaciones disponibles en: http://www.reactos.org"
+
+STRING_VERSION_HELP6, "\nFreeDOS version escrita por:\n"
+
+STRING_VERSION_HELP7, "\nReactOS version escrita por:\n"
+
+STRING_VOL_HELP1, " El volumen en la unidad %c: es %s"
+STRING_VOL_HELP2, " El volumen en la unidad %c: no tiene etiqueta"
+STRING_VOL_HELP3, " El número de serie del volumen es %04X-%04X\n"
+STRING_VOL_HELP4, "Muestra la etiqueta del volumen del disco y el número de serie si existen.\n\nVOL [unidad:]"
+
+STRING_WINDOW_HELP1, "Cambia el aspecto de la ventana de la consola.\n\n\
+WINDOW [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+/POS Especifica la posición y dimensión de la ventana\n\
+MIN minimiza la ventana\n\
+MAX maximiza la ventana\n\
+RESTORE restaura la ventana"
+
+STRING_WINDOW_HELP2, "Cambia el aspecto de la ventana de la consola.\n\n\
+ACTIVATE 'window' [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+window Título de la ventana en la que realizar las acciónes\n\
+/POS Especifica la posición y dimensión de la ventana\n\
+MIN minimiza la ventana\n\
+MAX maximiza la ventana\n\
+RESTORE restaura la ventana\n\
+title Nuevo título\n"
+
+
+STRING_HELP1, "Lista de todos los comandos disponibles (+ descripción)\n\n\
+ comando /? Para más información del comando especificado.\n\n\
+? Muestra todos los comandos disponibles sin la descripción.\n\
+ALIAS Crea, borra o muestra los alias.\n\
+ATTRIB Muestra o cambia los atributos de archivo.\n\
+BEEP Hace un beep con el altavoz.\n\
+CALL Llama a un archivo por lotes desde otro.\n\
+CD Muestra o cambia el directorio actual.\n\
+CHCP Muestra o cambia el código de página activo.\n\
+CHOICE Espera a que el usuario elija una opción de un grupo de opciones.\n\
+CLS Limpia la pantalla.\n\
+CMD Comienza una nueva instancia del intérprete de comandos.\n\
+COLOR Configura el color por defecto de fondo y frente de la consola.\n\
+COPY Copia uno o varios archivos de una localización a otra.\n\
+DATE Muestra y cambia la fecha.\n\
+DELETE Borra uno o más archivos.\n\
+DIR Muestra una lista de los archivos y subdirecctorios en un directorio.\n\
+ECHO Muestra mensajes, o cambia un comando entre mostrarlos o no.\n\
+ERASE Borra uno o más archivos.\n\
+EXIT Sale del programa CMD.EXE (intérprete de comandos).\n\
+FOR Ejecuta un comando específico en un grupo de archivos.\n\
+FREE Espacio libre en disco.\n\
+GOTO Direcciona la ventana del intérprete de comandos a una linea etiquetada\n\
+ en un archivo por lotes.\n\
+HELP Proporciona ayuda sobre los comandos para ReactOS.\n\
+HISTORY Muestra todos los comandos que han sido usados.\n\
+IF Realiza un proceso condicional en un archivo por lotes.\n\
+LABEL Crea, cambia, o borra la etiqueta de volumen de un disco.\n\
+MD Crea un directorio.\n\
+MKDIR Crea un directorio.\n\
+MOVE Mueve uno o más archivos de un directorio a otro.\n\
+PATH Muestra o configura las rutas de búsqueda para archivos ejecutables.\n\
+PAUSE Suspende el procesamiento de un archivo por lotes y muestra un mensaje.\n\
+POPD Restaura el valor anterior del directorio actual guardado por PUSHD.\n\
+PROMPT Cambia el símbolo del sistema del intéprete de comandos.\n\
+PUSHD Guarda el directorio actual y después lo cambia.\n\
+RD Borra un directorio.\n\
+REM Marca comentarios en archivos por lotes.\n\
+REN Renombra un archivo o varios archivos.\n\
+RENAME Renombra un archivo o varios archivos.\n\
+RMDIR Borra un directorio.\n\
+SCREEN Mueve el cursor y opcionalmente escribe un texto.\n\
+SET Muestra, cambia o borra variables del entorno de la ventana.\n\
+SHIFT Marca la posición de parámetros remplazables en un archivo por lotes.\n"
+
+STRING_HELP2, "START Abre una ventana separada para ejecutar un programa o comando específicod.\n\
+ Ejecuta CMD.\n\
+TIME Muestra o cambia la hora del sistema.\n\
+TIMER Permite al usuario diez paradas para ver.\n\
+TITLE Configura el título de la ventama de la sesión de CMD.EXE.\n\
+TYPE Muestra el contenido de un archivo de texto.\n\
+VER Muestra la versión de ReactOS.\n\
+VERIFY Le dice a ReactOS que verifique que cada archivo se escriba.\n\
+ corectamente en el disco.\n\
+VOL Muestra la etiqueta de volumen y el número de serie del disco.\n"
+
+
+STRING_CHOICE_OPTION, "SN"
+STRING_COPY_OPTION, "SNT"
+
+
+STRING_ALIAS_ERROR, "¡Linea de comandos demasiado larga tras la expansión del alias!\n"
+STRING_BATCH_ERROR, "Error abriendo el archivo por lotes\n"
+STRING_CHCP_ERROR1, "Página de códigos activa: %u\n"
+STRING_CHCP_ERROR4, "Código de página inválido\n"
+STRING_CHOICE_ERROR, "Opción inválida. Se esperaba el formato: /C[:]options"
+STRING_CHOICE_ERROR_TXT, "Opción inválida. Se esperaba el formato: /T[:]c,nn"
+STRING_CHOICE_ERROR_OPTION, "Opción ilegal: %s"
+STRING_CMD_ERROR1, "No se puede redirigir la entrada del archivo %s\n"
+STRING_CMD_ERROR2, "Error creando archivo temporal para la pila de datos\n"
+STRING_CMD_ERROR3, "No se puede redirigir el archivo %s\n"
+STRING_CMD_ERROR4, "Ejecutando %s...\n"
+STRING_CMD_ERROR5, "Ejecutando cmdexit.bat...\n"
+STRING_COLOR_ERROR1, "¡Mismos colores! (El color de frente y de fondo no pueden ser el mismo)"
+STRING_COLOR_ERROR2, "Error en la especificación del color"
+STRING_COLOR_ERROR3, "Color %x\n"
+STRING_COLOR_ERROR4, "¡Error: mismos colores!"
+STRING_CONSOLE_ERROR, "Error desconocido: %d\n"
+STRING_COPY_ERROR1, "Error: No se puede abrir el origen - %s!\n"
+STRING_COPY_ERROR2, "Error: ¡No se puede copiar sobre si mismo!\n"
+STRING_COPY_ERROR3, "¡Error escribiendo destino!\n"
+STRING_COPY_ERROR4, "Error: ¡No implementado aún!\n"
+STRING_DATE_ERROR, "Fecha incorrecta."
+STRING_DEL_ERROR5, "¡El archivo %s va a ser borrado!"
+STRING_DEL_ERROR6, "¿Estás seguro (S/N)?"
+STRING_DEL_ERROR7, "Borrando: %s\n"
+STRING_ERROR_ERROR1, "¡Error desconocido! Códige de error: 0x%lx\n"
+STRING_ERROR_ERROR2, "Error de sintaxsis"
+STRING_FOR_ERROR1, "Falta 'in' para la declaración."
+STRING_FOR_ERROR2, "No se encontraron las parénteris."
+STRING_FOR_ERROR3, "Falta 'do'."
+STRING_FOR_ERROR4, "No hay comando después de 'do'."
+STRING_FREE_ERROR1, "Unidad errónea."
+STRING_FREE_ERROR2, "Sin etiqueta"
+STRING_GOTO_ERROR1, "No se especifico etiqueta para GOTO"
+STRING_GOTO_ERROR2, "La etiqueta '%s' no se encuentra\n"
+
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[Error]\n"
+
+STRING_REN_ERROR1, "MoveFile() falló. Error: %lu\n"
+
+STRING_START_ERROR1, "¡No hay soporte para archivos por lotes en este momento!"
+
+STRING_TIME_ERROR1, "Hora incorrecta."
+
+STRING_TYPE_ERROR1, "Opción incorrecta '/%s'\n"
+
+STRING_WINDOW_ERROR1, "Ventana no encontrada"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "Formato del parámetro incorrecto - %c\n"
+STRING_ERROR_INVALID_SWITCH, "Parámetro incorrecto - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "Demasiados parámetros - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "Ruta no encontrada\n"
+STRING_ERROR_FILE_NOT_FOUND, "Archivo no encontrado\n"
+STRING_ERROR_REQ_PARAM_MISSING, "Prámetro requerido no encontrado\n"
+STRING_ERROR_INVALID_DRIVE, "Especificación de unidad errónea\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "Formato de parámetro erróneo - %s\n"
+STRING_ERROR_BADCOMMAND, "Comando o nombre de archivo erróneo\n"
+STRING_ERROR_OUT_OF_MEMORY, "Error fuera de memoria.\n"
+STRING_ERROR_CANNOTPIPE, "¡Error! ¡No se puede apilar! ¡No se puede abrir el archivo temporal!\n"
+STRING_ERROR_D_PAUSEMSG, "Pulsa una tecla para continuar . . ."
+STRING_ERROR_DRIVER_NOT_READY, "La unidad no está lista"
+
+STRING_PATH_ERROR, "CMD: No está en el entorno '%s'\n"
+
+STRING_CMD_SHELLINFO, "\nIntérprete de comandos de ReactOS"
+STRING_VERSION_RUNVER, " corriendo en %s"
+STRING_COPY_FILE , " %d archivo(s) copado(s)\n"
+STRING_DELETE_WIPE, "Limpiado"
+STRING_FOR_ERROR, "Especición de variable errónea."
+STRING_SCREEN_COL, "Valor inválido de columna"
+STRING_SCREEN_ROW, "Valor inválido de fila"
+STRING_TIMER_TIME "El temporizador %d es %s: "
+
+STRING_INVALID_OPERAND, "Operador erróneo.\n"
+STRING_EXPECTED_CLOSE_PAREN, "Se esperaba ')'.\n"
+STRING_EXPECTED_NUMBER_OR_VARIABLE,"Se esperaba un número o nombre de variable.\n"
+STRING_SYNTAX_COMMAND_INCORRECT, "La sintaxis del comando es incorrecta.\n"
+
+}
+
diff --git a/reactos/base/shell/cmd/Fr.rc b/reactos/base/shell/cmd/Fr.rc
new file mode 100644
index 00000000000..8e1c8375edb
--- /dev/null
+++ b/reactos/base/shell/cmd/Fr.rc
@@ -0,0 +1,575 @@
+#include "windows.h"
+#include "resource.h"
+/*
+ * French resources
+ * Sylvain Pétréolle 2005
+ */
+
+LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "Affiche ou change des attributs de fichiers.\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] file ...\n\
+ [/S [/D]]\n\n\
+ + Positionne un attribut\n\
+ - Enlève un attribut\n\
+ R Fichier en lecture seule\n\
+ A Fichier archive\n\
+ S Fichier système\n\
+ H Fichier caché\n\
+ /S Traite les fichiers correspondants dans le répertoire courant\n\
+ et tous les sous-répertoires\n\
+ /D Traite également les répertoires\n\n\
+Taper ATTRIB sans paramètre pour afficher les attributs de tous les fichiers."
+
+STRING_ALIAS_HELP, "Positionne, enlève ou affiche les alias.\n\n\
+ALIAS [alias=[commande]]\n\n\
+ alias Nom de l'alias.\n\
+ commande Texte à substituer à l'alias.\n\n\
+Pour afficher tous les alias:\n\
+ ALIAS\n\n\
+Pour créer ou remplacer un alias existant:\n\
+ ALIAS da=dir a:\n\n\
+Pour effacer un alias de la liste des alias :\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "Emet un bip par le haut-parleur système.\n\nBEEP"
+
+STRING_CALL_HELP, "Appelle un programme batch depuis un autre.\n\n\
+CALL [lecteur:][chemin]fichier [paramètre-batch]\n\n\
+ paramètre-batch Spécifie les paramètres nécessaires au \n\
+ programme batch."
+
+STRING_CD_HELP, "Change ou affiche le répertoire courant\n\n\
+ CHDIR [lecteur:][chemin]\n\
+ CHDIR[..|-]\n\
+ CD [lecteur:][chemin]\n\
+ CD[..|-]\n\n\
+ .. répertoire parent\n\
+ - répertoire précédent\n\n\
+Taper CD lecteur: pour affiche le répertoire courant sur le disque indiqué.\n\
+Taper CD sans paramètre pour afficher le répertoire courant du disque actuel.\n"
+
+STRING_CHCP_HELP, "Affiche ou change la page de codes active.\n\n\
+CHCP [nnn]\n\n\
+ nnn Indique la page de codes .\n\n\
+Taper CHCP sans paramètre pour afficher la page de codes active."
+
+STRING_CHOICE_HELP, "Demande à l'utilisateur de choisir parmi plusieurs choix.\n\n\
+CHOICE [/C[:]choix][/N][/S][/T[:]c,nn][texte]\n\n\
+ /C[:]choix Spécifier les touches disponibles. Choix par défaut: ON.\n\
+ /N Ne pas afficher les choix disponibles et ? à la fin\n\
+ du texte d'invite.\n\
+ /S Traiter les touches comme différentes si ce sont\n\
+ des majuscules ou minuscules.\n\
+ /T[:]c,nn Choix par défaut après nn secondes.\n\
+ texte Texte d'invite à afficher.\n\n\
+ERRORLEVEL est modifié à l'offset de la touche enfoncée parmi les choix."
+
+STRING_CLS_HELP, "Efface l'écran.\n\nCLS"
+
+STRING_CMD_HELP1, "\nCommandes internes disponibles :\n"
+
+STRING_CMD_HELP2, "\nFonctions disponibles :"
+
+STRING_CMD_HELP3," [alias]"
+
+STRING_CMD_HELP4," [historique]"
+
+STRING_CMD_HELP5," [complétion des noms de fichiers façon unix]"
+
+STRING_CMD_HELP6," [pile de répertoires]"
+
+STRING_CMD_HELP7," [redirections et piping]"
+
+STRING_CMD_HELP8, "Démarre une nouvelle instance de l'interpréteur de commandes de ReactOS.\n\n\
+CMD [/[C|K] commande][/P][/Q][/T:ap]\n\n\
+ /C commande Lance la commande spécifiée et se termine.\n\
+ /K commande Lance la commande spécifiée et reste en mémoire.\n\
+ /P CMD devient permanent et lance autoexec.bat\n\
+ (ne peut être terminé).\n\
+ /T:ap Changer la couleur d'arrière/premier plan\n\
+ (voir la commande COLOR.)"
+
+
+STRING_COLOR_HELP1, "Change les couleurs de premier et d'arrière plan.\n\n\
+COLOR [attr [/F]] \n\n\
+ attr Spécifie l'attribut des couleurs de la console\n\
+ /F remplit la console avec l'attribut de couleur\n\n\
+Il y a trois façons de spécifier les couleurs :\n\
+1) [bright] nom on [bright] nom (seules les trois premières lettres \n\
+sont nécessaires)\n\
+2) décimal on décimal\n\
+3) deux chiffres hexadécimaux\n\n\
+Les couleurs sont:\n\
+déc hex nom déc hex nom\n\
+0 0 Black(Noir) 8 8 Gray(Bright black)\n\
+1 1 Blue(Bleu) 9 9 Bright Blue\n\
+2 2 Green(Vert) 10 A Bright Green\n\
+3 3 Cyan 11 B Bright Cyan\n\
+4 4 Red(Rouge) 12 C Bright Red\n\
+5 5 Magenta 13 D Bright Magenta\n\
+6 6 Yellow(Jaune) 14 E Bright Yellow\n\
+7 7 White(Blanc) 15 F Bright White"
+
+STRING_COPY_HELP1, "Ecraser %s (Oui/Non/Tous)? "
+
+STRING_COPY_HELP2, "Copie un ou plusieurs fichiers vers une autre destination.\n\n\
+COPY [/V][/Y|/-Y][/A|/B] source [/A|/B]\n\
+ [+ source [/A|/B] [+ ...]] [destination [/A|/B]]\n\n\
+ source Indique le ou les fichiers à copier.\n\
+ /A Spécifie qu'il s'agit d'un fichier texte ASCII.\n\
+ /B Spécifie qu'il s'agit d'un fichier binaire.\n\
+ destination Indique le répertoire ou le nom de fichier\n\
+ pour le(s) nouveau(x) fichier(s).\n\
+ /V Vérifie que les fichier ont été copiés correctement.\n\
+ /Y Supprime l'invite de confirmation en cas d'écrasement\n\
+ d'un fichier destination existant.\n\
+ /-Y Affiche un invite de confirmation en cas d'écrasement\n\
+ d'un fichier destination existant.\n\n\
+Le switch /Y peut être présent dans la variable d'environnement COPYCMD.\n"
+
+STRING_DATE_HELP1, "\nEntrer la nouvelle date (mm%cdd%cyyyy): "
+
+STRING_DATE_HELP2, "\nEntrer la nouvelle date (dd%cmm%cyyyy): "
+
+STRING_DATE_HELP3, "\nEntrer la nouvelle date (yyyy%cmm%cdd): "
+
+STRING_DATE_HELP4, "Affiche ou règle la date.\n\n\
+DATE [/T][date]\n\n\
+ /T affiche seulement\n\n\
+Taper DATE sans paramètre pour afficher la date courante\n\
+et une invite pour entrer la nouvelle date.\n\
+Appuyer sur ENTREE pour conserver la même date."
+
+STRING_DEL_HELP1, "Efface un ou plusieurs fichiers.\n\n\
+DEL [/N /P /T /Q /W /Y /Z] fichier ...\n\
+DELETE [/N /P /T /Q /W /Y /Z] fichier ...\n\
+ERASE [/N /P /T /Q /W /Y /Z] fichier ...\n\n\
+ fichier Specifie le(s) fichier(s) à effacer.\n\n\
+ /N Rien.\n\
+ /P Demande. Demande avant d'effacer pour chaque fichier.\n\
+ /T Total. Affiche le total de fichiers effacés et l'espace disque libéré.\n\
+ /Q Silencieux.\n\
+ /W Wipe. Ecrase le fichier avec des nombres aléatoire avant d'effacer.\n\
+ /Y Oui. Efface, même *.*, sans demander.\n\
+ /Z Zap. Efface les fichiers cachés, en lecture seule et systèmes.\n"
+
+STRING_DEL_HELP2, "Tous les fichiers du répertoire seront effacés!\n\
+Etes vous sûr(e) (O/N)?"
+STRING_DEL_HELP3, " %lu fichier effacé\n"
+STRING_DEL_HELP4, " %lu fichiers effacés\n"
+
+STRING_DELAY_HELP, "Attend pendant n secondes ou millisecondes\n\
+DELAY [/m]n\n\n\
+ /m spécifie que n est en millisecondes\n\
+ sinon n est en secondes"
+
+STRING_DIR_HELP1, "DIR [lecteur:][chemin][fichier] [/A[[:]attributs]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]ordredetri]] [/P] [/Q] [/S] [/T[[:]heure]] [/W] [/X] [/4]\n\n\
+ [lecteur:][chemin][fichier]\n\
+ Spécifie le disque, le répertoire, et/ou les fichiers à lister.\n\n\
+ /A Affiche les fichiers avec les attributs indiqués.\n\
+ attributs D Répertoires R Fichiers en lecture seule\n\
+ H Fichiers cachés A Fichiers prêts à etre archivés\n\
+ S Fichiers systèmes - Préfixe signifiant non\n\
+ /B Utilise le format court (pas d'informations ni de résumé).\n\
+ /C Affiche le séparateur de milliers dans les tailles de fichier.\n\
+ C'est l'option par défaut. Utiliser /-C pour désactiver \n\
+ l'affichage du séparateur.\n\
+ /D Identique au format large mais les fichiers sont triés\n\
+ par colonne.\n\
+ /L Utilise les minuscules.\n\
+ /N Nouveau format de liste longue où les noms de fichiers sont \n\
+ sur la droite.\n\
+ /O Lister les fichier de façon triée.\n\
+ ordre de N Par nom (alphabétique) S Par taille (plus petit d'abord)\n\
+ tri E Par extension tique) D Par date (plus vieux d'abord)\n\
+ G Répertoires d'abord - Préfixe pour inverser l'ordre\n\
+ /P S'arrête après chaque page d'information.\n\
+ /Q Affiche le propriétaire du fichier.\n\
+ /S Affiche les fichiers dans le répertoire indiqué et\n\
+ tous les sous-répertoires.\n\
+ /T Contrôle quel champ de temps sera affiché ou utilisé\n\
+ pour le tri\n\
+ C Création\n\
+ A Dernier accès\n\
+ W Dernière modification\n\
+ /W Utilise le format de liste large.\n\
+ /X Ceci affiche les noms de fichiers courts pour les noms \n\
+ de fichiers longs. Le format est comme pour /N avec\n\
+ le nom de fichier court inséré avant le nom de fichier long.\n\
+ S'il n'y a pas de nom court, des espaces seront affichés.\n\
+ /4 Affiche l'année sur quatre chiffres.\n\n\
+Les paramètres peuvent être mémorisés dans la variable d'environnement DIRCMD.\n\
+Modifier les paramètres mémorisés avec un - (tiret)--par exemple, /-W.\n"
+
+STRING_DIR_HELP2, " Le nom de volume du lecteur %c est %s\n"
+STRING_DIR_HELP3, " Le lecteur %c n'a pas de nom de volume\n"
+STRING_DIR_HELP4, " Le numéro de série du volume est %04X-%04X\n"
+STRING_DIR_HELP5, "\n Total de fichiers listés :\n%16i Fichier(s)% 14s octets\n"
+STRING_DIR_HELP6, "%16i fichier(s)% 15s octets\n"
+STRING_DIR_HELP7, "\n Répertoire de %s\n\n"
+STRING_DIR_HELP8, "%16i Rep(s)% 14s octets\n"
+STRING_DIRSTACK_HELP1, "Stocke le répertoire courant pour utilisation avec la commande POPD,\n\
+ensuite change de répertoire vers le répertoire spécifié.\n\n\
+PUSHD [chemin | ..]\n\n\
+ chemin Spécifie le répertoire qui deviendra le répertoire courant"
+
+STRING_DIRSTACK_HELP2, "Change de réperoire vers le répertoire stocké par la commande PUSHD\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "Affiche le contenu de la pile de répertoires.\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "Pile de répertoires vide."
+
+STRING_ECHO_HELP1, "Affiche un message sans retour chariot ni passage à la ligne.\n\n\
+ ECHOS message"
+
+STRING_ECHO_HELP2, "Affiche un message sur le canal d'erreur.\n\n\
+ ECHOERR message\n\
+ ECHOERR. Affiche une ligne vide sur le canal d'erreur."
+
+STRING_ECHO_HELP3, "Affiche un message sur le canal d'erreur sans retour chariot\n\
+ni passage à la ligne.\n\n\
+ ECHOSERR message"
+
+STRING_ECHO_HELP4, "Affiche un message ou bascule l'affichage des commandes sur on ou off.\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [message]\n\
+ ECHO. Affiche une ligne vide.\n\n\
+Taper ECHO sans paramètre pour afficher le réglage ECHO courant."
+
+STRING_ECHO_HELP5, "ECHO est %s\n"
+
+STRING_EXIT_HELP, "Sort de de l'interpréteur de commandes.\n\nEXIT"
+
+STRING_FOR_HELP1, "Exécute une commande donnée pour chaque fichier d'un ensemble de fichiers.\n\
+FOR %variable IN (ensemble) do commande [paramètres]\n\n\
+ %variable Spécife un paramètre remplaçable.\n\
+ (ensemble) Spécifie un ensemble d'un ou plusieurs fichiers.\n\
+ Des jokers peuvent être utilisés.\n\
+ commande Spécifie la commande à éxécuter pour chaque fichier.\n\
+ paramètres Spécifie les paramètres ou switchs pour la commande spécifiée.\n\n\
+Pour utiliser la comamnde FOR dans un programme batch,\n\
+utiliser %%variable au lieu de %variable."
+
+STRING_FREE_HELP1, "\nLe nom de volume du lecteur %s est %-11s\n\
+Le numéro de série est %s\n\
+ %16s octets d'espace disque total\n\
+ %16s octets utilisés\n\
+ %16s octets libres\n"
+
+STRING_FREE_HELP2, "Affiche les information d'un disque.\n\nFREE [lecteur: ...]"
+
+STRING_GOTO_HELP1, "Dirige CMD vers une ligne nommée dans un script batch.\n\n\
+GOTO label\n\n\
+ label Spécifie un champ texte utilisé dans un script batch comme un label.\n\n\
+Vous écrivez un label seul sur une ligne commençant par un deux-points.\n"
+
+STRING_IF_HELP1, "Exécute un traitement conditionnel dans des programmes batch.\n\n\
+ IF [NOT] ERRORLEVEL nombre commande\n\
+ IF [NOT] chaine1==chaine2 commande\n\
+ IF [NOT] EXIST nomfichier commande\n\
+ IF [NOT] DEFINED variable commande\n\n\
+NOT CMD ne lancera la commande que si la condition est fausse.\n\
+ERRORLEVEL nombre La condition sera vraie si le dernier programme lancé\n\
+ a retourné un code sortie égal ou supérieur à celui indiqué.\n\
+commande Indique la commande à lancer si la condition est vérifiée.\n\
+chaine1==chaine2 La condition sera vraie si les deux chaines sont identiques.\n\
+EXIST nomfichier La condition sera vraie si le fichier spécifié existe.\n\
+DEFINED variable La condition sera vraie si la variable indiquée est définie."
+
+STRING_LABEL_HELP1, "Affiche ou change le nom de volume du disque.\n\nLABEL [disque:][nomdevolume]\n"
+
+STRING_LABEL_HELP2, "Le nom de volume du disque %c: est %s\n"
+STRING_LABEL_HELP3, "Le disque %c: n'a pas de nom de volume\n"
+STRING_LABEL_HELP4, "Le numéro de serie du volume est %04X-%04X\n"
+STRING_LABEL_HELP5, "Nom de volume (11 Caractères, ENTREE si aucun)? "
+
+STRING_LOCALE_HELP1, "L'heure actuelle est "
+
+STRING_MKDIR_HELP, "Crée un répertoire.\n\n\
+MKDIR [lecteur:]chemin\nMD [lecteur:]chemin"
+
+STRING_MEMMORY_HELP1, "Affiche la quantité de mémoire système.\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n %12s%% de charge mémoire.\n\n\
+ %13s octets de RAM physique au total.\n\
+ %13s octets de RAM physique disponible.\n\n\
+ %13s octets de fichier d'échange au total.\n\
+ %13s octets de fichier d'échange disponible.\n\n\
+ %13s octets de mémoire virtuelle au total.\n\
+ %13s octets de mémoire virtuelle disponible.\n"
+
+STRING_MISC_HELP1, "Appuyer sur une touche pour continuer...\n"
+
+STRING_MOVE_HELP1, "Ecraser %s (Oui/Non/Tous)? "
+
+STRING_MOVE_HELP2, "Déplace des fichiers ou renomme des fichiers et des répertoires.\n\n\
+Pouur déplacer un ou plusieurs fichiers:\n\
+MOVE [/N][lecteur:][nomfich1[,...] destination\n\n\
+Pour renommer un répertoire:\n\
+MOVE [/N][lecteur:][chemin]nomrep1 nomrep2\n\n\
+ [lecteur:][chemin]nomfich1 Indique l'endroit et le nom du ou des fichiers\n\
+ que vous voulez déplacer.\n\
+ /N Nothing. Do everything but move files or directories.\n\n\
+Limitations actuelles :\n\
+ - Vous ne pouvez pas déplacer un fichier/répertoire d'un disque à un autre.\n"
+
+STRING_MSGBOX_HELP, "Affiche une boite de dialogue et retourne la réponse de l'utilisateur\n\n\
+MSGBOX type ['titre'] prompt\n\n\
+type boutons affichés\n\
+ les valeurs possibles sont: OK, OKCANCEL,\n\
+ YESNO, YESNOCANCEL\n\
+titre titre de la boite de message\n\
+prompt texte affiché par la boite de dialogue \n\n\n\
+ERRORLEVEL est modifié suivant le bouton pressé:\n\n\
+YES : 10 | NO : 11\n\
+OK : 10 | CANCEL : 12\n"
+
+STRING_PATH_HELP1, "Affiche ou modifie le chemin de recherche pour les fichiers éxécutables.\n\n\
+PATH [[lecteur:][chemin;...]]\nPATH ;\n\n\
+Taper PATH ; pour effacer tous les réglages courants\n\
+et indiquer à l'interpréteur de commandes\n\
+de chercher seulement dans le répertoire courant.\n\
+Taper PATH sans paramètres pour afficher le chemin courant.\n"
+
+STRING_PAUSE_HELP1, "Stoppe l'éxécution d'un fichier batch et affiche le message suivant:\n\
+'Appuyer sur une touche pour continuer...' ou un message défini\n\
+par l'utilisateur.\n\n\
+PAUSE\n\
+PAUSE [message]"
+
+STRING_PROMPT_HELP1, "Change l'invite de commandes.\n\n\
+PROMPT [texte]\n\n\
+ texte Indique le nouvel invite de commandes.\n\n\
+L'invite de commandes peut être composé de caractères normaux et\n\
+des caractères spéciaux suivants:\n\n\
+ $A & (Et commercial)\n\
+ $B | (pipe)\n\
+ $C ( (parenthèse ouvrante)\n\
+ $D Date courante\n\
+ $E Code Escape (code ASCII 27)\n\
+ $F ) (parenthèse fermante)\n\
+ $G > (signe supérieur à)\n\
+ $H Backspace (efface le caractère précédent)\n\
+ $L < (signe inférieur à)\n\
+ $N Lecteur courant\n\
+ $P Lecteur et chemin courants\n\
+ $Q = (signe égale)\n\
+ $T Heure courante\n\
+ $V Numéro de version de ReactOS\n\
+ $_ Retour chariot/saut de ligne\n\
+ $$ $ (signe dollar)"
+
+STRING_PROMPT_HELP2, " $+ Affiche la hauteur de la pile de répertoires"
+
+STRING_PROMPT_HELP3, "\nTaper PROMPT sans paramètres pour changer l'invite à celui défini par défaut."
+
+STRING_REM_HELP, "Démarrer une ligne de commentaire dans un fichier batch.\n\nREM [Commentaire]"
+
+STRING_REN_HELP1, "Renomme un(des) fichier(s)/répertoire(s)\n\
+RENAME [/E /N /P /Q /S /T] ancien_nom ... nouveau_nom\n\
+REN [/E /N /P /Q /S /T] ancien_nom ... nouveau_nom\n\n\
+ /E Pas de messages d'erreur.\n\
+ /N Rien.\n\
+ /P Demande de confirmation avant de renommer chaque fichier.\n\
+ (Non implémenté!)\n\
+ /Q Silencieux.\n\
+ /S Renommer les sous-répertoires.\n\
+ /T Affiche le nombre total de fichiers renommés.\n\n\
+Vous ne pouvez indiquez un autre lecteur/chemin pour la destination.\n\
+Utiliser la commande MOVE dans ce but."
+
+STRING_REN_HELP2, " %lu fichier renommé\n"
+
+STRING_REN_HELP3, " %lu fichiers renommés\n"
+
+STRING_RMDIR_HELP, "Efface un répertoire.\n\n\
+RMDIR [lecteur:]chemin\nRD [lecteur:]chemin"
+
+STRING_SCREEN_HELP, "Déplace le curseur, optionnellement affiche du texte\n\n\
+SCREEN lig col [texte]\n\n\
+ lig ligne à laquelle déplacer le curseur\n\
+ col colonne à laquelle déplacer le curseur"
+
+STRING_SET_HELP, "Affiche, modifie ou efface des variables d'environnement.\n\n\
+SET [variable[=][chaine]]\n\n\
+ variable Indique le nom de la variable d'environnement.\n\
+ chaine Indique une série de caractères à assigner à la variable.\n\n\
+Taper SET sans paramètres pour afficher les variables d'environnement courantes.\n"
+
+STRING_SHIFT_HELP, "Change la position de paramètres remplaçables dans un fichier batch.\n\n\
+SHIFT [DOWN]"
+
+STRING_START_HELP1, "Lance une commande.\n\n\
+START commande\n\n\
+ commande Indique la commande à lancer.\n\n\
+Pour le moment toutes les commandes sont lancées de façon asynchrone.\n"
+
+STRING_TITLE_HELP, "Change le titre de la fenêtre de l'invite de commandes.\n\n\
+TITLE [chaine]\n\n\
+chaine Indique le titre de la fenêtre de l'invite de commandes."
+
+STRING_TIME_HELP1, "Affiche ou modifie l'heure système.\n\n\
+TIME [/T][heure]\n\n\
+ /T affiche seulement\n\n\
+Taper TIME sans paramètres pour afficher l'heure courante et une invite\n\
+pour la modifier. Presser la touche ENTREE pour garder la même heure."
+
+STRING_TIME_HELP2, "Entrer la nouvelle heure: "
+
+STRING_TIMER_HELP1, "Ecoulé %d msecs\n"
+
+STRING_TIMER_HELP2, "Ecoulé %02d%c%02d%c%02d%c%02d\n"
+
+STRING_TIMER_HELP3, "Permet l'utilisation de dix chronomètres.\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON Démarre le chronomètre\n\
+ OFF Stoppe le chronomètre\n\
+ /S Split time. Return stopwach split\n\
+ time without changing its value\n\
+ /n Indique le numéro du chronomètre.\n\
+ Les chronomètres disponibles vont de 0 à 10.\n\
+ Si non spécifié, le chronomètre par défaut est 1\n\
+ /Fn Format de sortie\n\
+ n peut être :\n\
+ 0 millisecondes\n\
+ 1 hh%cmm%css%cdd\n\n\
+Si aucun de ON, OFF or /S n'est spécifié la commande\n\
+changera l'état du chronomètre sélectionné\n\n"
+
+STRING_TYPE_HELP1, "Affiche le contenu de fichiers textes.\n\nTYPE [lecteur:][chemin]nomfich"
+
+STRING_VERIFY_HELP1, "Cette commande ne fait rien!!\n\
+Spécifie s'il faut verifier que vos fichiers sont écrits correctement.\
+\n\n\
+VERIFY [ON | OFF]\n\n\
+Taper VERIFY sans paramètres pour afficher le réglage de VERIFY."
+
+STRING_VERIFY_HELP2, "VERIFY est %s.\n"
+
+STRING_VERIFY_HELP3, "Vous devez indiquer ON ou OFF."
+
+STRING_VERSION_HELP1, "Affiche les information de version du shell\n\n\
+VER [/C][/R][/W]\n\n\
+ /C Displays credits.\n\
+ /R Displays redistribution information.\n\
+ /W Displays warranty information."
+
+STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n\
+type: `ver /w'. This is free software, and you are welcome to redistribute\n\
+it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n\
+listing of credits."
+
+STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details."
+
+STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version."
+
+STRING_VERSION_HELP5, "\nEnvoyer les rapports d'erreur à .\n\
+Les mises à jour sont disponibles à : http://www.reactos.org"
+
+STRING_VERSION_HELP6, "\nVersion FreeDOS écrite par:\n"
+
+STRING_VERSION_HELP7, "\nVersion ReactOS écrite par:\n"
+
+STRING_VOL_HELP1, " Le nom de volume du lecteur %c: est %s\n"
+STRING_VOL_HELP2, " Le volume dans le lecteur %c: n'a pas de nom\n"
+STRING_VOL_HELP3, " Le numéro de série du volume est %04X-%04X\n"
+STRING_VOL_HELP4, "Affiche le nom de volume et le numéro de série du disque s'ils existent.\n\nVOL [lecteur:]\n"
+
+STRING_WINDOW_HELP1, "Change l'aspect de la fenêtre de la console\n\n\
+WINDOW [/POS[=]gauche,haut,largeur,hauteur]\n\
+ [MIN|MAX|RESTORE] ['titre']\n\n\
+/POS indique la position et les dimensions de la fenêtre\n\
+MIN minimise la fenêtre\n\
+MAX maximise la fenêtre\n\
+RESTORE restaure la fenêtre"
+
+STRING_WINDOW_HELP2, "Change l'aspect de la fenêtre de la console\n\n\
+WINDOW [/POS[=]gauche,haut,largeur,hauteur]\n\
+ [MIN|MAX|RESTORE] ['titre']\n\n\
+/POS indique la position et les dimensions de la fenêtre\n\
+MIN minimise la fenêtre\n\
+MAX maximise la fenêtre\n\
+RESTORE restaure la fenêtre\n\
+titre titre de la fenêtre"
+
+STRING_CHOICE_OPTION "ON"
+STRING_COPY_OPTION, "ONT"
+
+STRING_ALIAS_ERROR, "Ligne de commande trop longue après remplacement de l'alias!\n"
+STRING_BATCH_ERROR, "Erreur à l'ouverture du fichier batch\n"
+STRING_CHCP_ERROR1, "Page de codes actuelle : %u\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "Format de paramètre incorrect - %s\n"
+STRING_CHCP_ERROR4, "Page de code invalide \n"
+STRING_CHOICE_ERROR, "Option invalide. Format attendu: /C[:]options"
+STRING_CHOICE_ERROR_TXT, "Option invalide. Format attendu: /T[:]c,nn"
+STRING_CHOICE_ERROR_OPTION, "Option invalide : %s"
+STRING_CMD_ERROR1, "Ne peut rediriger l'entrée depuis le fichier %s\n"
+STRING_CMD_ERROR2, "Erreur à la création du fichier temporaire pour les données du pipe\n"
+STRING_CMD_ERROR3, "Ne peut rediriger vers le fichier %s\n"
+STRING_CMD_ERROR4, "Lance %s...\n"
+STRING_CMD_ERROR5, "Lance cmdexit.bat...\n"
+STRING_COLOR_ERROR1, "L'arrière plan et l'avant plan ne peuvent être de la même couleur"
+STRING_COLOR_ERROR2, "Erreur dans la spécification des couleurs"
+STRING_COLOR_ERROR3, "Couleur %x\n"
+STRING_COLOR_ERROR4, "Erreur: même couleur!"
+STRING_CONSOLE_ERROR, "Erreur inconnue: %d\n"
+STRING_COPY_ERROR1, "Erreur: Ne peut ouvrir la source - %s!\n"
+STRING_COPY_ERROR2, "Erreur: Ne peut copier le fichier sur lui-même!\n"
+STRING_COPY_ERROR3, "Erreur à l'écriture de la destination!\n"
+STRING_COPY_ERROR4, "Erreur: Non implémenté actuellement!\n"
+STRING_DATE_ERROR, "Date invalide."
+STRING_DEL_ERROR5, "Le fichier %s va être effacé ! "
+STRING_DEL_ERROR6, "Etes vous sûr (O/N)?"
+STRING_DEL_ERROR7, "Efface : %s\n"
+STRING_ERROR_ERROR1, "Erreur inconnue! Code d'erreur : 0x%lx\n"
+STRING_ERROR_ERROR2, "Erreur de syntaxe"
+STRING_FOR_ERROR1, "'in' manquant."
+STRING_FOR_ERROR2, "pas de parenthèse trouvée."
+STRING_FOR_ERROR3, "'do' manquant."
+STRING_FOR_ERROR4, "pas de commande après 'do'."
+STRING_FREE_ERROR1, "Lecteur invalide"
+STRING_FREE_ERROR2, "sans nom"
+STRING_GOTO_ERROR1, "Pas de label indiqué pour GOTO"
+STRING_GOTO_ERROR2, "Label '%s' non trouvé\n"
+
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[Erreur]\n"
+
+STRING_PATH_ERROR, "CMD: Pas dans l'environnement '%s'\n"
+
+STRING_REN_ERROR1, "MoveFile() a échoué. Erreur: %lu\n"
+
+STRING_START_ERROR1, "No batch support at the moment!"
+
+STRING_TIME_ERROR1, "Heure invalide."
+
+STRING_TYPE_ERROR1, "Option invalide '/%s'\n"
+
+STRING_WINDOW_ERROR1, "Fenêtre non trouvée"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "Format du paramètre incorrect - %c\n"
+STRING_ERROR_INVALID_SWITCH, "Paramètre invalide - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "Trop de paramètres - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "Chemin non trouvé\n"
+STRING_ERROR_FILE_NOT_FOUND, "Fichier non trouvé\n"
+STRING_ERROR_REQ_PARAM_MISSING, "Paramètre requis manquant\n"
+STRING_CMD_SHELLINFO, "\n Interpréteur de ligne de commandes ReactOS"
+STRING_VERSION_RUNVER, " tournant sur %s"
+STRING_COPY_FILE, " %d fichier(s) copié(s)\n"
+STRING_DELETE_WIPE, "effacé(s)"
+STRING_FOR_ERROR, "mauvaise variable spécifiée."
+STRING_SCREEN_COL, "valeur invalide pour col"
+STRING_SCREEN_ROW, "valeur invalide pour lig"
+STRING_TIMER_TIME "Le timer n°%d est %s: "
+}
diff --git a/reactos/base/shell/cmd/Hu.rc b/reactos/base/shell/cmd/Hu.rc
new file mode 100644
index 00000000000..1f1b9c92e08
--- /dev/null
+++ b/reactos/base/shell/cmd/Hu.rc
@@ -0,0 +1,623 @@
+#include "resource.h"
+#include "windows.h"
+/*
+ * Moved all hardcoded strings to En.rc.
+ * By Magnus Olsen 2005
+ * Hungarian resource állomány for ntvdm
+ * Translation by Robert Horvath (talley at cubeclub.hu) 2005
+ */
+
+LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "Állományok attribútumok megjelenítése vagy beállításai.\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] állomány ...\n\
+ [/S [/D]]\n\n\
+ + bekapcsol egy attribútumot\n\
+ - kikapcsol egy attribútumot\n\
+ R Írásvédett állomány\n\
+ A Archiválandó állomány\n\
+ S Rendszer állomány\n\
+ H Rejtett állomány\n\
+ /S Minden állomány módosítása a mappában és minden\n\
+ almappábanban\n\
+ /D Mappákra is érvényesíti\n\n\
+Ha ATTRIB-ot paraméter nélkül írod be, megjeleníti a mappában található összes állományt és annak attribútumát.\n"
+
+STRING_ALIAS_HELP, "Aliasok megjelenítése, hozzáadása és törlése\n\n\
+ALIAS [alias=[parancs]]\n\n\
+ alias Alias neve.\n\
+ parancs A szöveg amit behelyettesít.\n\n\
+Aliasok megjelenítése:\n\
+ ALIAS\n\n\
+Egy új hozzáadása vagy meglévõ helyettesítlse:\n\
+ ALIAS da=dir a:\n\n\
+Egy alias törlése:\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "Hangjelzés leadása a speakerbõl.\n\nBEEP\n"
+
+STRING_CALL_HELP, "Kötegelt parancsfájl meghívása egy másikból.\n\n\
+CALL [kötet:][elérési_út]állomány [paraméterek]\n\n\
+ paraméterek Itt adható meg a szükséges paraméterlista"
+
+STRING_CD_HELP, "Az aktuális mappa nevének a megjelenítése vagy váltás másikra\n\n\
+CHDIR [/D][meghajtó:][elérési_út]\n\
+CHDIR[..|.]\n\
+CD [/D][meghajtó:][elérési_út]\n\
+CD[..|.]\n\n\
+ .. Szülõ mappa\n\
+ /D Megváltoztatja az aktuális mappát és meghajtót is.\n\n\
+Írd be, hogy 'CD meghajtó:' hogy ki írja az aktuális mappát.\n\
+Írd be a CD-t paraméterek nélkül, hogy megjelenítse az aktuális meghajtót és mappát (ugyanaz mint az elõzõ).\n"
+
+STRING_CHCP_HELP, "Megjeleníti vagy megváltoztatja az aktív kódlapot.\n\n\
+CHCP [nnn]\n\n\
+ nnn A használni kívánt kódlap száma.\n\n\
+Írd be a CHCP paraméterek nélkül, hogy megjelenítse az aktív kódlapot.\n"
+
+STRING_CHOICE_HELP, "Vár a felhasználóra, hogy válasszon a felkínált lehetõségek közül.\n\n\
+CHOICE [/C[:]választási lehetõségek][/N][/S][/T[:]c,nn][szöveg]\n\n\
+ /C[:]választási lehetõségek Megengedett billentyûk. Alapértelmezett: YN. <-- Yes->Igen\n\
+ /N Elrejti a választási lehetõségeket és a kérdõjelet.\n\
+ /S Kis- és nagybetûk megkülönböztetése.\n\
+ /T[:]v,nn A v lehetõséget választja nn másodperc után.\n\
+ szöveg Megjelenítendõ szöveg.\n\n\
+Az ERRORLEVEL a válasz sorszámára lesz beállítva.\n"
+
+STRING_CLS_HELP, "Törli a képernyõt.\n\nCLS\n"
+
+STRING_CMD_HELP1, "\nElérhetõ belsõ parancsok:\n"
+
+STRING_CMD_HELP2, "\nElérhetõ lehetõségek:"
+
+STRING_CMD_HELP3," [aliasok]"
+
+STRING_CMD_HELP4," [elõzmények]"
+
+STRING_CMD_HELP5," [unix típusú állománynév kiegészítés]"
+
+STRING_CMD_HELP6," [mappa tár]"
+
+STRING_CMD_HELP7," [átirányítások és csõvezetékek]"
+
+STRING_CMD_HELP8, "Elindít egy új ReactOS parancssor értelmezõ.\n\n\
+CMD [/[C|K] parancs][/P][/Q][/T:eh]\n\n\
+ /C parancs Végrehajtja a parancsot, majd kilép.\n\
+ /K parancs Végrehajtja a parancsot, és tovább fut az értelmezõ.\n\
+ /P Értelmezi az autoexec.bat állományt és a memóriában marad.\n\
+ /T:eh COLOR parancs használata.\n"
+
+STRING_COLOR_HELP1, "A konzol elõ- és háttérszínét állítja be.\n\n\
+COLOR [eh [/-F]] \n\n\
+ eh A konzol elõ- és háttérszínét állítja be.\n\
+ /-F Nem frissíti az egész képernyõt\n\n\
+A színt két hexadecimális számjeggyel lehet beállítani\n\n\
+Az elérhetõ színek:\n\
+hex név hex név\n\
+0 Fekete 8 Szürke\n\
+1 Sötétkék 9 Kék\n\
+2 Sötétzöld A Zöld\n\
+3 Sötétlila B Türkízkék\n\
+4 Bordó C Vörös\n\
+5 Ciklámen D Ciklámen\n\
+6 Olíva E Sárga\n\
+7 Világos szürke F Fehér\n"
+
+STRING_COPY_HELP1, "Felülírja a következõt: %s (Igen/Nem/Mind)? "
+
+STRING_COPY_HELP2, "Egy vagy több állományt másol a megadott helyre.\n\n\
+COPY [/V][/Y|/-Y][/A|/B] forrás [/A|/B]\n\
+ [+ forrás [/A|/B] [+ ...]] [cél [/A|/B]]\n\n\
+ forrás Megadott állomány(ok)at fogja másolni.\n\
+ /A Ez ASCII szöveg állomány.\n\
+ /B Ez bináris állomány.\n\
+ cél Megadja a cél mappát és/vagy az (új) állománynevet.\n\
+ /V Ellenõrzi a másolást.\n\
+ /Y Igennel válaszol kérdésnél.\n\
+ /-Y Nemmel válaszol kérdésnél.\n\n\
+Az /Y kapcsolót a COPYCMD környezeti változóban is használható.\n"
+
+STRING_DATE_HELP1, "\nÚj dátum (hh%cnn%céééé): "
+
+STRING_DATE_HELP2, "\nÚj dátum (nn%chh%céééé): "
+
+STRING_DATE_HELP3, "\nÚj dátum (éééé%chh%cnn): "
+
+STRING_DATE_HELP4, "Megjeleníti vagy beállítja a rendszerdátumot.\n\n\
+DATE [/T][dátum]\n\n\
+ /T Csak megjeleníti\n\n\
+Írd be a DATE parancsot paraméter nélkül, hogy megjelenítse a rendszer dátumot és bekérjen egy újat.\n\
+Nyomj ENTERT-t, ha nem akarsz változtatni.\n"
+
+STRING_DEL_HELP1, "Eltávolít egy vagy több állományt.\n\n\
+DEL [/N /P /T /Q /S /W /Y /Z /A[[:]attribútumok]] állomány ...\n\
+DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]attribútumok]] állomány ...\n\
+ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]attribútumok]] állomány ...\n\n\
+ állomány Törlésre kijelöl állomány(ok).\n\n\
+ /N Nem csinál semmit.\n\
+ /P Rákérdezés minden állománynál.\n\
+ /T Statisztika megjelenítése a végén.\n\
+ /Q Csendes üzemmód.\n\
+ /W Wipe. Overwrite the állomány with random numbers before deleting it.\n\
+ /Y Minden válaszra igen. Figyelem, *.*-ot is törli!!\n\
+ /F Rejtett, csak olvasható és rendszer állományokat is töröl.\n\
+ /S Almappákban is törli az állományokat\n\
+ /A Attribútumok alapján törli az állományokat.\n\
+ attributes\n\
+ R Csak olvasható állománys\n\
+ S Rendszer állomány\n\
+ A Archivált állomány\n\
+ H Rejtett állománys\n\
+ - ""Nem"" prefix\n"
+
+STRING_DEL_HELP2, "Minden állomány törölve lesz a mappában!\nBiztosan ezt akarod (I/N)?"
+STRING_DEL_HELP3, " %lu állomány törölve\n"
+STRING_DEL_HELP4, " %lu állomány törölve\n"
+
+STRING_DELAY_HELP, "pause for n seconds or milliseconds\n\
+DELAY [/m]n\n\n\
+ /m specifiy than n are milliseconds\n\
+ otherwise n are seconds\n"
+
+STRING_DIR_HELP1, "DIR [meghajtó:][elérési_út][állománynév] [/A[[:]attribútumok]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]rendezési_feltétel]] [/P] [/Q] [/S] [/T[[:]idõ]] [/W] [/X] [/4]\n\n\
+ [meghajtó:][elérési_út][állományname]\n\
+ Az adott hely állományait és mappáit jeleníti meg.\n\n\
+ /A A megadott attribútumu állományokat jeleníti csak meg.\n\
+ attributes D Mappák R Csak olvasható állomány\n\
+ H Rejtett állomány A Archiválandó állomány\n\
+ S Rendszer állomány - ""Nem"" prefix\n\
+ /B Fejléc és összefoglaló nélkül.\n\
+ /C Ezres elválasztó jel használata. Ez az alapértelmezett, /-C a kikapcsolása.\n\
+ /D Széles megjelenítés, oszlop szerint rendezve.\n\
+ /L Kisbetûk használata.\n\
+ /N New long list format where állománynames are on the far right.\n\
+ /O Rendezés az alábbiak szerint.\n\
+ sortorder N Név alapján (ABC sorrend) S Méret alapján (növekvõ)\n\
+ E Kiterjesztés alapján (ABC sorrend) D Dátum/idõ alapján (legrégebbi elején)\n\
+ G Mappák legelõl - ""Nem"" prefixel fordított rendezés\n\
+ /P Csak egy képernyõnyi adat megjelenítése egyszerre.\n\
+ /Q Állomány tulajdonsosának megjelenítése.\n\
+ /S Almappák tartalmát is megjeleníti.\n\
+ /T Controls which time field displayed or used for sorting\n\
+ timefield C Létrehozás\n\
+ A Utolsó megtekintés\n\
+ W Utolsó módosítás\n\
+ /W Széles megjelenítés.\n\
+ /X This displays the short names generated for non-8dot3 állomány\n\
+ names. The format is that of /N with the short name inserted\n\
+ before the long name. If no short name is present, blanks are\n\
+ displayed in its place.\n\
+ /4 Négy számjegyû év\n\n\
+A kapcsolók a DIRCMD környezeti változóban is lehetnek.\n"
+
+STRING_DIR_HELP2, " A (%c) meghajtóban található kötet %s\n"
+STRING_DIR_HELP3, " A (%c) meghajtóban található kötetnek nincs címkéje.\n"
+STRING_DIR_HELP4, " A kötet sorozatszáma: %04X-%04X\n"
+STRING_DIR_HELP5, "\n Összes állomány:\n%16i Állomány(ok)% 14s bájt\n"
+STRING_DIR_HELP6, "%16i Mappa %15s bájt"
+STRING_DIR_HELP7, "\n %s tartalma\n\n"
+STRING_DIR_HELP8, "%16i Állomány %14s bájt\n"
+
+STRING_DIRSTACK_HELP1, "Megjegyzi az aktuális mappát, majd átvált egy máasikra.\n\n\
+PUSHD [elérési_út | ..]\n\n\
+ elérési_út Ebbe a mappába fog átváltani\n"
+
+STRING_DIRSTACK_HELP2, "Visszalép a PUSHD által megjegyzett mappába.\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "Megjeleníti a megjegyzett mappákat.\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "Üres a tár"
+
+STRING_ECHO_HELP1, "Megjeleníti a szöveget új sor nélkül.\n\n\
+ ECHOS szöveg"
+
+STRING_ECHO_HELP2, "Displays a message to the standard error.\n\n\
+ ECHOERR szöveg\n\
+ ECHOERR. Új sor"
+
+STRING_ECHO_HELP3, "Prints a messages to standard error output without trailing carridge return and line feed.\n\n\
+ ECHOSERR message"
+
+STRING_ECHO_HELP4, "Megjelenít egy szöveget, vagy beállítja a visszhangot.\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [üzenet]\n\
+ ECHO. Új sor\n\n\
+Paraméter nélkül megjeleníti a visszang állapotát."
+
+STRING_ECHO_HELP5, "Az ECHO %s\n"
+
+STRING_EXIT_HELP, "Kilép a parancssor értelmezõbõl.\n\nEXIT\n"
+
+STRING_FOR_HELP1, "Végrehajt egy parancsot az összes fájlban a megadott mappákban\n\n\
+FOR %változó IN (csoport) DO parancs [paraméterek]\n\n\
+ %változó A cserélhetõ paraméter.\n\
+ (csoport) Állományok csoportja. Joker-karakterek megengedettek EZT KURVÁRA ÁTKELL FORDÍTANI :)) wildcardok helyett?.\n\
+ parancs Ezt a parancsot hajtja végre minden egyes állománnyal.\n\
+ paraméterek Ezeket a paramétereket adja meg a parancsnak.\n\n\
+A batch állományban való haszálathoz %%változó kell a %változó helyett.\n"
+
+STRING_FREE_HELP1, "\nA (%s) meghajtóban lévõ kötet címkéje %-11s\n\
+ Sorozatszám: %s\n\
+ %16s bájt a teljes hely\n\
+ %16s bájt használva\n\
+ %16s bájt szabad\n"
+
+STRING_FREE_HELP2, "Kötet méret információk.\n\nFREE [meghajtó: ...]\n"
+
+STRING_IF_HELP1, "Performs conditional processing in batch programs.\n\n\
+ IF [NOT] ERRORLEVEL number command\n\
+ IF [NOT] string1==string2 command\n\
+ IF [NOT] EXIST állományname command\n\
+ IF [NOT] DEFINED variable command\n\n\
+NOT Specifies that CMD should carry out the command only if\n\
+ the condition is false\n\
+ERRORLEVEL number Specifies a true condition if the last program run returned\n\
+ an exit code equal or greater than the number specified.\n\
+command Specifies the command to carry out if the condition is met.\n\
+string1==string2 Specifies a true condition if the specified text strings\n\
+ match.\n\
+EXIST állományname Specifies a true condition if the specified állományname exists.\n\
+DEFINED variable Specifies a true condition if the specified variable is\n\
+ defined.\n"
+
+STRING_GOTO_HELP1, "Átirányít egy másik címkére a batch állományban.\n\n\
+GOTO címke\n\n\
+ címke A megadott címkére fog ugrani az értelmezõ.\n\n\
+Egy címkét egy sorban lehet megadni, ':' -tal kezdve."
+
+STRING_LABEL_HELP1, "A kötet címkéjét megjeleníti, vagy megváltoztatja.\n\n\
+LABEL [meghajtó:] [új_címke]\n"
+
+STRING_LABEL_HELP2, "A (%c) meghajtóban lévõ kötet címkéje %s\n"
+STRING_LABEL_HELP3, "A (%c) megjajtóban lévõ kötetnek nincs címkéje.\n"
+STRING_LABEL_HELP4, "A kötet sorozatszáma %04X-%04X\n"
+STRING_LABEL_HELP5, "Új kötetcímke (11 betû, ENTER ha üres)? "
+
+STRING_LOCALE_HELP1, "Az aktuális idõ:"
+
+STRING_MKDIR_HELP, "Létrehoz egy új mappát.\n\n\
+MKDIR [meghajtó:]path\nMD [meghajtó:]path"
+
+STRING_MEMMORY_HELP1, "Megjeleníti a memória statisztikát.\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n A memória %12s%%-a foglalt.\n\n\
+ %13s bájtnyi teljes fizikai memória.\n\
+ %13s bájtnyi elérhetõ memória.\n\n\
+ %13s bájt a lapozóállomány.\n\
+ %13s bájtnyi elérhetõ a lapozóállományban.\n\n\
+ %13s bájt a teljes virtuális memória.\n\
+ %13s bájtnyi elérhetõ a virtuális memóriából.\n"
+
+STRING_MISC_HELP1, "A folytatáshoz nyomj meg egy billentyût . . .\n"
+
+STRING_MOVE_HELP1, "Felülírja %s (Igen/Nem/Mind)? "
+
+STRING_MOVE_HELP2, "Áthelyezi és átnevezi az állományokat a mappákban.\n\n\
+Egy vagy több állomány áthelyezéséhez:\n\
+MOVE [/N][meghajtó:][elérési_út]állomány1[,...] cél\n\n\
+Mappa átnevezése:\n\
+MOVE [/N][meghajtó:][elérési_út]mappa1 mappa2\n\n\
+ [meghajtó:][elérési_út]állomány1 Átnevezendõ állományok forrása.\n\
+ /N Nem helyez át semmit.\n\n\
+Hiányosságok:\n\
+ - Nem lehet meghajtók között áthelyezni állományokat.\n"
+
+STRING_MSGBOX_HELP, "display a message box and return user responce\n\n\
+MSGBOX type ['title'] prompt\n\n\
+type button displayed\n\
+ possible values are: OK, OKCANCEL,\n\
+ YESNO, YESNOCANCEL\n\
+title title of message box\n\
+prompt text displayed by the message box\n\n\n\
+ERRORLEVEL is set according the button pressed:\n\n\
+YES : 10 | NO : 11\n\
+OK : 10 | CANCEL : 12\n"
+
+STRING_PATH_HELP1, "Megjeleníti vagy beállítja a keresési útvonalakat.\n\n\
+PATH [[meghajtó:]elérési_út[;...]]\n\
+PATH ; Keresési útvonalak törlése\n\n\
+A PATH törléséhez a következõt írd be: PATH ;\n\
+Így csak az aktuális mappában fog keresni a CMD.\
+Paraméterek nélkül az érvényes keresési útvonalakat mutatja meg.\n"
+
+STRING_PROMPT_HELP1, "Parancssor beállítása.\n\n\
+PROMPT [szöveg]\n\n\
+ szöveg Az új parancssor megadása.\n\n\
+A parancssor speciális kódokat is tartalmazhat:\n\n\
+ $A & (és jel)\n\
+ $B | (csõ)\n\
+ $C ( (kezdõ rázójel)\n\
+ $D Aktuális dátum\n\
+ $E Escape-kód (ASCII 27-es kód)\n\
+ $F ) (záró zárójel)\n\
+ $G > ('nagyobb' jel)\n\
+ $H Törlés (elötte lévõ karaktert törli)\n\
+ $L < ('kissebb' jel)\n\
+ $N Aktuális meghajtó\n\
+ $P Aktuális meghajtó és mappa\n\
+ $Q = (egyenlõség jel)\n\
+ $T Aktuális idõ\n\
+ $V OS verziószám\n\
+ $_ Újsor\n\
+ $$ $ (dollár jel)\n"
+
+STRING_PAUSE_HELP1, "Felfüggeszti a futást, és vár a felhasználóra. A következõ üzenet jelenik meg:\n\
+'A folytatáshoz nyomj meg egy billentyût . . .' vagy egy általad választott üzenet.\n\n\
+PAUSE [message]"
+
+STRING_PROMPT_HELP2, " $+ Displays the current depth of the directory stack"
+
+STRING_PROMPT_HELP3, "\nHa paraméter nélkül beírod a PROMPT parancsot, vissza áll az alapértelmezettre a kijelzés."
+
+STRING_REM_HELP, "Megjegyzést jelölõ sor batch fájlokban.\n\nREM [megjegyzés]"
+
+STRING_RMDIR_HELP, "Eltávolít egy mappát.\n\n\
+RMDIR [meghajtó:]elérési_út\nRD [meghajtó:]elérési_út"
+
+STRING_REN_HELP1, "Átnevez egy állományt.\n\n\
+RENAME [/E /N /P /Q /S /T] régi_név ... új_név\n\
+REN [/E /N /P /Q /S /T] régi_név ... új_név\n\n\
+ /E Hibaüzenetek elrejtése.\n\
+ /N Ne csináljon semmit .\n\
+ /P Minden állománynál rákérdez. (Még NEM mûködik!!)\n\
+ /Q Csendes mûködés.\n\
+ /S Almappákat is átnevez.\n\
+ /T Összes átnevezett fájl és állomány.\n\n\
+Csak az aktuális meghajtón és mappában fog mûködni.\n\
+Ha ez nem elég, használd a MOVE parancsot."
+
+STRING_REN_HELP2, " %lu állomány átnevezve\n"
+
+STRING_REN_HELP3, " %lu állomány átnevezve\n"
+
+STRING_SHIFT_HELP, "Eltolja a helyettesíthetõ paraméterek pozícióját a batch állományban.\n\n\
+SHIFT [DOWN]"
+
+STRING_SCREEN_HELP, "Megváltoztatja a kurzos pozícióját, vagy megjelenít adott pozícióban egy szöveget.\n\n\
+SCREEN sor oszlop [szöveg]\n\n\
+ sor Ugrás sora\n\
+ oszlop Ugrás oszlopa"
+
+STRING_SET_HELP, "Megjeleníti vagy beállítja a környezeti változókat.\n\n\
+SET [változó[=][érték]]\n\n\
+ változó Környezeti változó neve.\n\
+ érték A beállítandó érték.\n\n\
+Paraméterek nélkül megjeleníti az összes környezetiváltozót.\n"
+
+STRING_START_HELP1, "Végrehajt egy parancsot.\n\n\
+START parancs\n\n\
+ parancs Végrehajtja a megadott parancsot.\n\n\
+Jelenleg minden parancs aszinkron hajtódik végre.\n"
+
+STRING_TITLE_HELP, "Beállítja az ablak címsorának szövegét.\n\n\
+TITLE [szöveg]\n\n\
+szöveg Beállítja az ablak címsorának szövegét.\n"
+
+STRING_TIME_HELP1, "Megjeleníti vagy beállítja a rendszeridõt.\n\n\
+TIME [/T][idõ]\n\n\
+ /T Csaj megjeleníti\n\n\
+Paraméterek nélkül megjeleníti az aktuális idõt és kér egy újat.\n\
+Csak egy ENTER megnyomásával nem állítja át.\n"
+
+STRING_TIME_HELP2, "Új idõ: "
+
+STRING_TIMER_HELP1, "Eltelt %d ezred másodperc\n"
+
+STRING_TIMER_HELP2, "Eltelt: %02d%c%02d%c%02d%c%02d\n"
+
+STRING_TIMER_HELP3, "allow the use of ten stopwaches.\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON Stopper bekapcsolása\n\
+ OFF Stopper kikapcsolása\n\
+ /S Split time. Return stopwatch split\n\
+ time without changing its value\n\
+ /n Stopper azonosító megadása.\n\
+ Stopwaches avaliable are 0 to 9\n\
+ If it is not specified default is 1\n\
+ /Fn Format for output\n\
+ n can be:\n\
+ 0 milliseconds\n\
+ 1 hh%cmm%css%cdd\n\n\
+if none of ON, OFF or /S is specified the command\n\
+will toggle stopwach state\n\n"
+
+STRING_TYPE_HELP1, "Megjeleníti az állományok tartalmát.\n\n\
+TYPE [meghajtó:][elérési_út]állománynév \n\
+ /P Csak egy képernyõnyi tartalmat jelenít meg egyszerre.\n"
+
+STRING_VERIFY_HELP1, "Ez a parancs még nem mûködik!!\n\
+Lemezre írás utáni ellenõrzést állítja be.\n\n\
+VERIFY [ON | OFF]\n\n\
+Írd be a VERIFY-t paraméterek nélkül, hogy megjelenítse aktuális állapotát.\n"
+
+STRING_VERIFY_HELP2, "Az ellenõrzés jelenleg %s.\n"
+
+STRING_VERIFY_HELP3, "Csak az ON vagy OFF elfogadott."
+
+STRING_VERSION_HELP1, "A ReactOS verzióinformációit jeleníti meg\n\n\
+VER [/C][/R][/W]\n\n\
+ /C Készítõk névsora.\n\
+ /R Terjesztési információk.\n\
+ /W Jótállási információk."
+
+STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n\
+type: `ver /w'. This is free software, and you are welcome to redistribute\n\
+it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n\
+listing of credits."
+
+STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details."
+
+STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version.\n"
+
+STRING_VERSION_HELP5, "\nHibákról E-Maileket ide küldhetsz: .\n\
+Frissítések és egyéb információk: http://www.reactos.org"
+
+STRING_VERSION_HELP6, "\nA FreeDOS készítõi:\n"
+
+STRING_VERSION_HELP7, "\nA ReactOS készítõi:\n"
+
+STRING_VOL_HELP1, " A (%c) meghajtóban lévõ kötet: %s\n"
+STRING_VOL_HELP2, " A (%c) meghajtóban lévõ kötetnek nincs címkéje"
+STRING_VOL_HELP3, " A kötet sorozatszáma %04X-%04X\n"
+STRING_VOL_HELP4, "A kötet címkéjének és sorozatszámának megjelenítése, ha léteznek.\n\nVOL [meghajtó:]"
+
+STRING_WINDOW_HELP1, "change console window aspect\n\n\
+WINDOW [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+/POS specify window placement and dimensions\n\
+MIN minimize the window\n\
+MAX maximize the window\n\
+RESTORE restore the window"
+
+STRING_WINDOW_HELP2, "change console window aspect\n\n\
+ACTIVATE 'window' [/POS[=]left,top,width,heigth]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+window tile of window on wich perform actions\n\
+/POS specify window placement and dimensions\n\
+MIN minimize the window\n\
+MAX maximize the window\n\
+RESTORE restore the window\n\
+title new title\n"
+
+
+STRING_HELP1, "Támogatott parancsok megjelenítése\n\n\
+ parancs /? Több (részletes) információ megtekintéséhez használd ezt.\n\n\
+? Minden támogatott parancs megjelenítése (részletek nélkül).\n\
+ALIAS Megjeleníti, vagy megváltoztatja az aliasokat.\n\
+ATTRIB Megjeleníti vagy megváltoztatja az állományok attribútumát.\n\
+BEEP Megszólaltatja a hangszórót.\n\
+CALL Batch állományból egy másik batch állomány meghívása.\n\
+CD Megjeleníti vagy átvált egy másik mappába.\n\
+CHCP Megjeleníti vagy megváltoztatja az aktív kódlapot.\n\
+CHOICE Vár a felhasználóra, hogy válasszon a felkínált lehetõségek közül.\n\
+CLS Letörli a képernyõt.\n\
+CMD Egy új példányt indít a ReactOS parancsértelmezõjébõl.\n\
+COLOR A konzol elõ- és háttérszínét állítja be.\n\
+COPY Egy vagy több állományt másol a megadott helyre.\n\
+DATE Megjeleníti vagy beállítja a rendszerdátumot.\n\
+DELETE Eltávolít egy vagy több állományt.\n\
+DIR Megjeleníti a mappában található almappákat és állományokat.\n\
+ECHO Megjelenít egy szöveget, vagy beállítja a visszhangot.\n\
+ERASE Eltávolít egy vagy több fájlt.\n\
+EXIT Kilép a parancssor értelmezõbõl.\n\
+FOR Végrehajt egy parancsot az összes fájlban a megadott mappákban.\n\
+FREE Megjeleníti a szabad hely méretét.\n\
+GOTO Átirányít egy másik címkére a batch állományban.\n\
+HELP Segítséget ad a ReactOS parancsairól.\n\
+HISTORY Megjeleníti az ebben az ablakban kiadott parancsok listáját.\n\
+IF Feltételes végrehajtás batch állományokban.\n\
+LABEL Beállítja egy kötet címkéjét.\n\
+MD Létrehoz egy új mappát.\n\
+MKDIR Létrehoz egy új mappát.\n\
+MOVE Áthelyez egy vagy több állományt az egyik mappából a másikba.\n\
+PATH Megjeleníti vagy beállítja a keresési útvonalakat.\n\
+PAUSE Felfüggeszti a futást, és vár a felhasználóra.\n\
+POPD Visszalép a PUSHD által megjegyzett mappába.\n\
+PROMPT Parancssor beállítása.\n\
+PUSHD Megjegyzi az aktuális mappát, majd átvált egy máasikra.\n\
+RD Töröl egy mappát.\n\
+REM Megjegyzést jelölõ sor batch fájlokban.\n\
+REN Átnevez egy állományt.\n\
+RENAME Átnevez egy állományt.\n\
+RMDIR Töröl egy mappát.\n\
+SCREEN Megváltoztatja a kurzos pozícióját, vagy megjelenít adott pozícióban egy szöveget.\n\
+SET Megjeleníti vagy beállítja a környezeti változókat.\n\
+SHIFT Eltolja a helyettesíthetõ paraméterek pozícióját a batch állományban.\n"
+STRING_HELP2, "START Egy új ablakban hajtha végre a parancsot.\n\
+TIME Megjeleníti vagy beállítja a rendszeridõt.\n\
+TIMER Idõzítõk kezelését teszi lehetõve.\n\
+TITLE Beállítja az ablak címsorának szövegét.\n\
+TYPE Megjeleníti egy állomány tartalmát.\n\
+VER Megjeleníti a ReactOS verzió információját.\n\
+VERIFY Írási mûveletek ellenõrzését vezérli\n\
+VOL Megjeleníti egy kötet címkéjét és sorozatszámát.\n"
+
+
+STRING_CHOICE_OPTION, "IN"
+STRING_COPY_OPTION, "INM"
+
+
+STRING_ALIAS_ERROR, "A parancssor túl hosszú az alias kibontásakor!\n"
+STRING_BATCH_ERROR, "Hiba a batch állomány megnyitásakor\n"
+STRING_CHCP_ERROR1, "Aktív kódlap: %u\n"
+STRING_CHCP_ERROR4, "Érvénytelen kódlap\n"
+STRING_CHOICE_ERROR, "Érvénytelen paraméter. Várt formátum: /C[:]választási lehetõségek"
+STRING_CHOICE_ERROR_TXT, "Érvénytelen paraméter. Várt formátum: /T[:]v,nn"
+STRING_CHOICE_ERROR_OPTION, "Érvénytelen paraméter: %s"
+STRING_CMD_ERROR1, "Nem lehet átirányítani a bevitelt a(z) %s állományból\n"
+STRING_CMD_ERROR2, "Hiba a csõvezetékhez tartozó ideiglenes állomány létrehozásakor\n"
+STRING_CMD_ERROR3, "Nem lehet a(z) %s állományba átirányítani\n"
+STRING_CMD_ERROR4, "%s futtatása...\n"
+STRING_CMD_ERROR5, "cmdexit.bat futtatása...\n"
+STRING_COLOR_ERROR1, "Ugyanaz a szín nem lehet! (Az elõ- és háttérszín nem lehet ugyanolyan)"
+STRING_COLOR_ERROR2, "Hibás szín megadás"
+STRING_COLOR_ERROR3, "Szín %x\n"
+STRING_COLOR_ERROR4, "Ugyanaz a szín nem lehet!"
+STRING_CONSOLE_ERROR, "Ismeretlen hiba: %d\n"
+STRING_COPY_ERROR1, "Hiba: a forrás nem nyitható meg - %s!\n"
+STRING_COPY_ERROR2, "Hiba: nem másolhatod önmagára az állományt!\n"
+STRING_COPY_ERROR3, "Hiba a cél írása közben!\n"
+STRING_COPY_ERROR4, "Hiba: ez még nem mûködik!\n"
+STRING_DATE_ERROR, "Érvénytelen dátum."
+STRING_DEL_ERROR5, "A(z) %s állomány törölve lesz! "
+STRING_DEL_ERROR6, "Biztos vagy benne (I/N)?"
+STRING_DEL_ERROR7, "Törlés: %s\n"
+STRING_ERROR_ERROR1, "Ismeretlen hiba! Hiba kód: 0x%lx\n"
+STRING_ERROR_ERROR2, "Szintaxis hiba"
+STRING_FOR_ERROR1, "az 'in' után hiányzik a feltétel."
+STRING_FOR_ERROR2, "nincs zárójel megadva."
+STRING_FOR_ERROR3, "a 'do' hiányzik."
+STRING_FOR_ERROR4, "nincs parancs a 'do' után."
+STRING_FREE_ERROR1, "Érvénytelen meghajtó"
+STRING_FREE_ERROR2, "nincs cimkézve"
+STRING_GOTO_ERROR1, "Nem lett cimke megadva a GOTO után"
+STRING_GOTO_ERROR2, "A '%s' cimke nem található\n"
+
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[HIBA]\n"
+
+STRING_REN_ERROR1, "MoveÁllomány() sikertelen. Hiba: %lu\n"
+
+STRING_START_ERROR1, "Nincs batch támogatás jelenleg!"
+
+STRING_TIME_ERROR1, "Érvénytelen idõ."
+
+STRING_TYPE_ERROR1, "Érvénytelen beállítás '/%s'\n"
+
+STRING_WINDOW_ERROR1, "Az ablak nem található"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "A paraméter megadás hibás - %c\n"
+STRING_ERROR_INVALID_SWITCH, "Érvénytelen kapcsoló - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "Túl sok paraméter - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "Az elérési_út nem halálható\n"
+STRING_ERROR_FILE_NOT_FOUND, "Az állomány nem található\n"
+STRING_ERROR_REQ_PARAM_MISSING, "Egy szükséges paraméter hiányzik\n"
+STRING_ERROR_INVALID_DRIVE, "Érvénytelen meghajtó\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "Érvénytelen paraméter megadás - %s\n"
+STRING_ERROR_BADCOMMAND, "Ismeretlen parancs vagy állomány név\n"
+STRING_ERROR_OUT_OF_MEMORY, "Nincs elég memória.\n"
+STRING_ERROR_CANNOTPIPE, "Error! Cannot pipe! Cannot open temporary állomány!\n"
+STRING_ERROR_D_PAUSEMSG, "A folytatáshoz nyomj meg egy billentyût . . ."
+STRING_ERROR_DRIVER_NOT_READY, "A meghajtó nem áll készen"
+
+STRING_PATH_ERROR, "CMD: Not in environment '%s'\n"
+
+STRING_CMD_SHELLINFO, "\nReactOS Parancssor értelmezõ"
+STRING_VERSION_RUNVER, " running on %s"
+STRING_COPY_FILE , " %d állomány másolva\n"
+STRING_DELETE_WIPE, "wiped"
+STRING_FOR_ERROR, "Hibás változó."
+STRING_SCREEN_COL, "Érvénytelen érték oszlopnak"
+STRING_SCREEN_ROW, "Érvénytelen érték sornak"
+STRING_TIMER_TIME "Idõzítõ %d értéke %s: "
+}
diff --git a/reactos/base/shell/cmd/Ja.rc b/reactos/base/shell/cmd/Ja.rc
new file mode 100644
index 00000000000..f8c1077e35b
--- /dev/null
+++ b/reactos/base/shell/cmd/Ja.rc
@@ -0,0 +1,658 @@
+#include "windows.h"
+#include "resource.h"
+/*
+ * Moved all hardcoded strings to En.rc.
+ * By Magnus Olsen 2005
+ */
+
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "ƒtƒ@ƒCƒ‹‘®«‚ð•\\Ž¦‚Ü‚½‚Í•ÏX‚µ‚Ü‚·B\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [ƒtƒ@ƒCƒ‹] ...\n\
+ [/S [/D]]\n\n\
+ + ‘®«‚ðݒ肵‚Ü‚·B\n\
+ - ‘®«‚ð‰ðœ‚µ‚Ü‚·B\n\
+ R “Ç‚Ý‚Æ‚èê—p‘®«B\n\
+ A ƒA[ƒJƒCƒu‘®«B\n\
+ S ƒVƒXƒeƒ€ ƒtƒ@ƒCƒ‹‘®«B\n\
+ H ‰B‚µƒtƒ@ƒCƒ‹‘®«B\n\
+ /S Œ»Ý‚̃tƒHƒ‹ƒ_‚Æ‚·‚ׂẴTƒuƒtƒHƒ‹ƒ_‚̈ê’v‚·‚éƒtƒ@ƒCƒ‹‚ð\n\
+ ˆ—‚µ‚Ü‚·B\n\
+ /D ƒtƒHƒ‹ƒ_‚àˆ—‚µ‚Ü‚·B\n\n\
+ƒpƒ‰ƒ[ƒ^‚ðŽw’肵‚È‚¢‚Å ATTRIB ‚Æ“ü—Í‚·‚é‚ÆA‚·‚ׂẴtƒ@ƒCƒ‹‚Ì‘®«‚ð•\\Ž¦‚µ‚Ü‚·B\n"
+
+STRING_ALIAS_HELP, "ƒGƒCƒŠƒAƒX‚ÌÝ’è‚â‰ðœ‚ð‚µ‚½‚èAƒGƒCƒŠƒAƒX‚ð•\\Ž¦‚µ‚½‚肵‚Ü‚·B\n\n\
+ALIAS [ƒGƒCƒŠƒAƒX=[ƒRƒ}ƒ“ƒh]]\n\n\
+ ƒGƒCƒŠƒAƒX ƒGƒCƒŠƒAƒX‚Æ‚µ‚¯‚é–¼‘OB\n\
+ ƒRƒ}ƒ“ƒh ƒGƒCƒŠƒAƒX‚Æ‚µ‚ÄÝ’è‚·‚镶Žš—ñB\n\n\
+‚·‚ׂẴGƒCƒŠƒAƒX‚ðˆê——•\\Ž¦‚·‚é‚É‚Í:\n\
+ ALIAS\n\n\
+V‚½‚ɃGƒCƒŠƒAƒX‚ðݒ肵‚½‚èAŠù‘¶‚̃GƒCƒŠƒAƒX‚ð’u‚«Š·‚¦‚é‚É‚Í:\n\
+ ALIAS da=dir a:\n\n\
+ƒGƒCƒŠƒAƒX‚̃ŠƒXƒg‚©‚çƒGƒCƒŠƒAƒX‚ðŽæ‚蜂‚É‚Í:\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "ƒXƒs[ƒJ‚©‚çƒr[ƒv‰¹‚ð–‚炵‚Ü‚·B\n\nBEEP\n"
+
+STRING_CALL_HELP, "ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚ð•Ê‚̃oƒbƒ` ƒvƒƒOƒ‰ƒ€‚©‚çŒÄ‚Ño‚µ‚Ü‚·B\n\n\
+CALL [ƒhƒ‰ƒCƒu:][ƒpƒX]ƒtƒ@ƒCƒ‹–¼ [ƒoƒbƒ`ƒpƒ‰ƒ[ƒ^]\n\n\
+ ƒoƒbƒ`ƒpƒ‰ƒ[ƒ^ ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚Å•K—v‚ȃRƒ}ƒ“ƒh ƒ‰ƒCƒ“î•ñ‚ð\n\
+ Žw’肵‚Ü‚·B"
+
+STRING_CD_HELP, "Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚ð•ÏX‚µ‚½‚èAƒfƒBƒŒƒNƒgƒŠ–¼‚ð•\\Ž¦‚µ‚½‚肵‚Ü‚·B\n\n\
+CHDIR [/D][ƒhƒ‰ƒCƒu:][ƒpƒX]\n\
+CHDIR[..|.]\n\
+CD [/D][ƒhƒ‰ƒCƒu:]ƒpƒX]\n\
+CD[..|.]\n\n\
+ .. eƒfƒBƒŒƒNƒgƒŠ\n\
+ . Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ\n\
+ /D Œ»Ý‚̃hƒ‰ƒCƒu‚ƃfƒBƒŒƒNƒgƒŠ‚Ì—¼•û‚ð•ÏX‚µ‚Ü‚·B\n\n\
+CD ƒhƒ‰ƒCƒu: ‚Æ“ü—Í‚·‚é‚ÆŽw’肳‚ꂽƒhƒ‰ƒCƒu‚ÌŒ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚ª•\\Ž¦‚³‚ê‚Ü‚·B\n\
+ƒpƒ‰ƒ[ƒ^‚ðŽw’肵‚È‚¢‚Å CD ‚Æ“ü—Í‚·‚é‚ÆAŒ»Ý‚̃hƒ‰ƒCƒu‚ƃfƒBƒŒƒNƒgƒŠ‚ª•\\Ž¦‚³‚ê‚Ü‚·B\n"
+
+STRING_CHCP_HELP, "Œ»Ý‚̃R[ƒh ƒy[ƒW”Ô†‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\n\
+CHCP [nnn]\n\n\
+ nnn ƒR[ƒh ƒy[ƒW”Ô†‚ðŽw’肵‚Ü‚·B\n\n\
+Œ»Ý‚̃R[ƒh ƒy[ƒW”Ô†‚ð•\\Ž¦‚·‚é‚Æ‚«‚ÍAƒpƒ‰ƒ[ƒ^‚ðŽw’肹‚¸‚É CHCP ‚Æ“ü—Í‚µ‚Ä‚‚¾‚³‚¢B\n"
+
+STRING_CHOICE_HELP, "ƒ†[ƒU[‚ª‘I‘ðŽˆ‚©‚çˆê‚‚ð‘I‘ð‚·‚é‚Ì‚ð‘Ò‚¿‚Ü‚·B\n\n\
+CHOICE [/C[:]‘I‘ðŽˆ][/N][/S][/T[:]c,nn][•¶Žš—ñ]\n\n\
+ /C[:]‘I‘ðŽˆ ‹–‚³‚ê‚éƒL[“ü—Í‚ðŽw’肵‚Ü‚·BƒfƒtƒHƒ‹ƒg‚Í YN ‚Å‚·B\n\
+ /N ƒvƒƒ“ƒvƒg‚Ì•¶Žš—ñ‚ÌÅŒã‚ÉA‘I‘ðŽˆ‚Æ ? ‚ð•\\Ž¦‚µ‚Ü‚¹‚ñB\n\
+ /S ƒL[“ü—͂̑啶ŽšE¬•¶Žš‚ð‹æ•Ê‚µ‚Ü‚·B\n\
+ /T[:]c,nn nn •bŒo‰ß‚·‚é‚ÆŽ©“®“I‚É c ‚ð‘I‘ð‚µ‚Ü‚·B\n\
+ •¶Žš—ñ •\\Ž¦‚·‚éƒvƒƒ“ƒvƒg‚Ì•¶Žš—ñ‚Å‚·B\n\n\
+ƒ†[ƒU[‚ª‘I‘ðŽˆ‚É‚ ‚éƒL[‚ð‰Ÿ‚·‚ÆA‚»‚̃IƒtƒZƒbƒg‚ª ERRORLEVEL ‚ɃZƒbƒg‚³‚ê‚Ü‚·B\n"
+
+STRING_CLS_HELP, "‰æ–Ê‚ðÁ‹Ž‚µ‚Ü‚·B\n\nCLS\n"
+
+STRING_CMD_HELP1, "\n—˜—p‚Å‚«‚é“à•”ƒRƒ}ƒ“ƒh:\n"
+
+STRING_CMD_HELP2, "\n—˜—p‚Å‚«‚é‹@”\\:"
+
+STRING_CMD_HELP3," [ƒGƒCƒŠƒAƒX]"
+
+STRING_CMD_HELP4," [ƒqƒXƒgƒŠ]"
+
+STRING_CMD_HELP5," [UNIX ƒtƒ@ƒCƒ‹–¼•âŠ®]"
+
+STRING_CMD_HELP6," [ƒfƒBƒŒƒNƒgƒŠ ƒXƒ^ƒbƒN]"
+
+STRING_CMD_HELP7," [ƒŠƒ_ƒCƒŒƒNƒg‚ƃpƒCƒv]"
+
+STRING_CMD_HELP8, "ReactOS ƒRƒ}ƒ“ƒh ƒ‰ƒCƒ“ ƒCƒ“ƒ^[ƒvƒŠƒ^‚ÌV‚µ‚¢ƒCƒ“ƒXƒ^ƒ“ƒX‚ðŠJŽn‚µ‚Ü‚·B\n\n\
+CMD [/[C|K] ƒRƒ}ƒ“ƒh][/P][/Q][/T:bf]\n\n\
+ /C ƒRƒ}ƒ“ƒh Žw’肳‚ꂽƒRƒ}ƒ“ƒh‚ðŽÀs‚µ‚½ŒãAI—¹‚µ‚Ü‚·B\n\
+ /K ƒRƒ}ƒ“ƒh Žw’肳‚ꂽƒRƒ}ƒ“ƒh‚ðŽÀs‚µ‚Ü‚·‚ªAI—¹‚µ‚Ü‚¹‚ñB\n\
+ /P CMD ‚͉i‘±“I‚É“®ì‚ð‚µAautoexec.bat ‚ðŽÀs‚µ‚Ü‚·\n\
+ (I—¹‚³‚¹‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ)B\n\
+ /T:bf ‘OŒiF‚¨‚æ‚Ñ”wŒiF‚ðݒ肵‚Ü‚· (Ú×‚Í COLOR /? ‚ðŽQÆ‚µ‚Ä\n\
+ ‚‚¾‚³‚¢)B\n"
+
+STRING_COLOR_HELP1, "ƒRƒ“ƒ\\[ƒ‹‚̃fƒtƒHƒ‹ƒg‚Ì‘OŒiF‚¨‚æ‚Ñ”wŒiF‚ðݒ肵‚Ü‚·B\n\n\
+COLOR [‘®« [/-F]] \n\n\
+ ‘®« ƒRƒ“ƒ\\[ƒ‹o—Í‚ÌF‘®«‚ðŽw’肵‚Ü‚·B\n\
+ /-F ƒRƒ“ƒ\\[ƒ‹‚̋󂢂Ă¢‚é‹óŠÔ‚É‚ÍF‘®«‚ð“K—p‚µ‚È‚¢B\n\n\
+F‚ÍŽŸ‚Ì 3 Ží—Þ‚Ì•û–@‚ÅŽw’è‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B\n\
+1) [F–¼] on [F–¼] (•K—v‚È‚Ì‚Íʼn‚Ì 3 •¶Žš‚¾‚¯‚Å‚·)\n\
+2) [10 i”] on [10 i”]\n\
+3) 2 Œ…‚Ì 16 i”\n\n\
+F–¼:\n\
+10i 16i F–¼ 10i 16i F–¼\n\
+0 0 • 8 8 ŠDF (–¾‚é‚¢•)\n\
+1 1  9 9 –¾‚é‚¢Â\n\
+2 2 —Î 10 A –¾‚é‚¢—Î\n\
+3 3 …F 11 B –¾‚é‚¢…F\n\
+4 4 Ô 12 C –¾‚é‚¢Ô\n\
+5 5 Ž‡ 13 D –¾‚é‚¢Ž‡\n\
+6 6 ‰©F 14 E –¾‚é‚¢‰©F\n\
+7 7 ”’ 15 F ‹P‚”’\n"
+
+STRING_COPY_HELP1, "%s ‚ðã‘‚«‚µ‚Ü‚·‚ªA‚æ‚낵‚¢‚Å‚·‚©? (Yes/No/All)? "
+
+STRING_COPY_HELP2, "1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚ð•Ê‚ÌꊂɃRƒs[‚µ‚Ü‚·B\n\n\
+COPY [/V][/Y|/-Y][/A|/B] ƒRƒs[Œ³ [/A|/B]\n\
+ [+ ƒRƒs[Œ³ [/A|/B] [+ ...]] [ƒRƒs[æ [/A|/B]]\n\n\
+ ƒRƒs[Œ³ ƒRƒs[‚·‚éƒtƒ@ƒCƒ‹ (•¡”‰Â) ‚ðŽw’肵‚Ü‚·B\n\
+ /A ASCII ƒeƒLƒXƒg ƒtƒ@ƒCƒ‹‚Æ‚µ‚Ĉµ‚¢‚Ü‚·B\n\
+ /B ƒoƒCƒiƒŠ ƒtƒ@ƒCƒ‹‚Æ‚µ‚Ĉµ‚¢‚Ü‚·B\n\
+ ƒRƒs[æ V‚µ‚¢ƒtƒ@ƒCƒ‹‚̃fƒBƒŒƒNƒgƒŠ‚Ü‚½‚̓tƒ@ƒCƒ‹–¼ (•¡”‰Â) ‚ð\n\
+ Žw’肵‚Ü‚·B\n\
+ /V V‚µ‚¢ƒtƒ@ƒCƒ‹‚ª³‚µ‚‘‚«ž‚܂ꂽ‚©ŒŸ¸‚µ‚Ü‚·B\n\
+ /Y Žó‚¯‘¤‚ÌŠù‘¶‚̃tƒ@ƒCƒ‹‚ðã‘‚«‚·‚é‘O‚ÉŠm”F‚̃ƒbƒZ[ƒW‚ð\n\
+ •\\Ž¦‚µ‚Ü‚¹‚ñB\n\
+ /-Y Žó‚¯‘¤‚ÌŠù‘¶‚̃tƒ@ƒCƒ‹‚ðã‘‚«‚·‚é‘O‚ÉŠm”F‚̃ƒbƒZ[ƒW‚ð\n\
+ •\\Ž¦‚µ‚Ü‚·B\n\n\
+TŠÂ‹«•Ï” COPYCMD ‚ŃXƒCƒbƒ` /Y ‚ªÝ’肳‚ê‚Ä‚¢‚éꇂª‚ ‚è‚Ü‚·B\n\
+...\n"
+
+STRING_DATE_HELP1, "\nV‚µ‚¢“ú•t‚ð“ü—Í‚µ‚Ä‚‚¾‚³‚¢ (mm%cdd%cyyyy): "
+
+STRING_DATE_HELP2, "\nV‚µ‚¢“ú•t‚ð“ü—Í‚µ‚Ä‚‚¾‚³‚¢ (dd%cmm%cyyyy): "
+
+STRING_DATE_HELP3, "\nV‚µ‚¢“ú•t‚ð“ü—Í‚µ‚Ä‚‚¾‚³‚¢ (yyyy%cmm%cdd): "
+
+STRING_DATE_HELP4, "“ú•t‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\n\
+DATE [/T][“ú•t]\n\n\
+ /T “ú•t‚Ì•\\Ž¦‚Ì‚Ýs‚¢‚Ü‚·B\n\n\
+ƒpƒ‰ƒ[ƒ^‚ÌŽw’肪‚È‚¢ê‡‚ÍAŒ»Ý‚Ì“ú•t‚ª•\\Ž¦‚³‚êAV‚µ‚¢“ú•t‚Ì“ü—Í‚ð\n\
+‹‚ß‚ç‚ê‚Ü‚·B•ÏX‚µ‚È‚¢ê‡‚ÍAEnter ƒL[‚ð‰Ÿ‚µ‚Ü‚·B\n"
+
+STRING_DEL_HELP1, "1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚ð휂µ‚Ü‚·B\n\n\
+DEL [/N /P /T /Q /S /W /Y /Z /A[[:]‘®«]] ƒtƒ@ƒCƒ‹–¼ ...\n\
+DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]‘®«]] ƒtƒ@ƒCƒ‹–¼ ...\n\
+ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]‘®«]] ƒtƒ@ƒCƒ‹–¼ ...\n\n\
+ ƒtƒ@ƒCƒ‹–¼\n\
+ 휂·‚éƒtƒ@ƒCƒ‹ (•¡”‰Â) ‚ðŽw’肵‚Ü‚·B\n\n\
+ /N Nothing. ‰½‚à‚µ‚Ü‚¹‚ñB\n\
+ /P Prompt. Šeƒtƒ@ƒCƒ‹‚ð휂·‚é‘O‚ÉŠm”F‚̃ƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /T Total. 휂³‚ꂽƒtƒ@ƒCƒ‹‚Ì‘”‚Ɖð•ú‚³‚ꂽƒfƒBƒXƒN—̈æ‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /Q Quiet.\n\
+ /W Wipe. 휂·‚é‘O‚ÉAƒtƒ@ƒCƒ‹‚ð—”‚Åã‘‚«‚µ‚Ü‚·B\n\
+ /Y Yes. ƒƒCƒ‹ƒhƒJ[ƒh‚ðŽg—p‚µ‚Ĉꊇ휂·‚é‚Æ‚«‚àAŠm”F‚̃ƒbƒZ[ƒW‚ð\n\
+ •\\Ž¦‚¹‚¸‚É휂µ‚Ü‚·B\n\
+ /F “Ç‚Ý‚Æ‚èê—pƒtƒ@ƒCƒ‹‚âƒVƒXƒeƒ€ ƒtƒ@ƒCƒ‹‚ð‹§“I‚É휂µ‚Ü‚·B\n\
+ /S Žw’肳‚ꂽƒtƒ@ƒCƒ‹‚ð‚·‚×‚Ä‚ÌƒTƒuƒfƒBƒŒƒNƒgƒŠ‚©‚ç휂µ‚Ü‚·B\n\
+ /A ‘®«‚É‚æ‚è휂·‚éƒtƒ@ƒCƒ‹‚ð‘I‘ð‚µ‚Ü‚·B\n\
+ ‘®«\n\
+ R “Ç‚ÝŽæ‚èê—p\n\
+ S ƒVƒXƒeƒ€ ƒtƒ@ƒCƒ‹\n\
+ A ƒA[ƒJƒCƒu\n\
+ H ‰B‚µƒtƒ@ƒCƒ‹\n\
+ - ‚»‚Ì‘®«ˆÈŠO\n"
+
+STRING_DEL_HELP2, "ƒfƒBƒŒƒNƒgƒŠ‚Ì‚·‚ׂẴtƒ@ƒCƒ‹‚ªíœ‚³‚ê‚Ü‚·!\n‚æ‚낵‚¢‚Å‚·‚© (Y/N)?"
+STRING_DEL_HELP3, " %lu ŒÂ‚̃tƒ@ƒCƒ‹‚ð휂µ‚Ü‚µ‚½\n"
+STRING_DEL_HELP4, " %lu ŒÂ‚̃tƒ@ƒCƒ‹‚ð휂µ‚Ü‚µ‚½\n"
+
+STRING_DELAY_HELP, "n •bA‚Ü‚½‚Í n ƒ~ƒŠ•b‘Ò‹@‚µ‚Ü‚·B\n\
+DELAY [/m]n\n\n\
+ /m ’PˆÊ‚ðƒ~ƒŠ•b‚ÉŽw’肵‚Ü‚·B\n\
+ Žw’肵‚È‚¢ê‡A’PˆÊ‚É‚Í•b‚ªŽg‚í‚ê‚Ü‚·B\n"
+
+STRING_DIR_HELP1, "ƒfƒBƒŒƒNƒgƒŠ’†‚̃tƒ@ƒCƒ‹‚ƃTƒuƒfƒBƒŒƒNƒgƒŠ‚ðˆê——•\\Ž¦‚µ‚Ü‚·B\n\n\
+DIR [ƒhƒ‰ƒCƒu:][ƒpƒX][ƒtƒ@ƒCƒ‹–¼] [/A[[:]‘®«]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]ƒ\\[ƒg‡]] [/P] [/Q] [/S] [/T[[:]ƒ^ƒCƒ€ƒtƒB[ƒ‹ƒh]] [/W] [/X] [/4]\n\n\
+ [ƒhƒ‰ƒCƒu:][ƒpƒX][ƒtƒ@ƒCƒ‹–¼]\n\
+ ˆê——•\\Ž¦‚·‚éƒhƒ‰ƒCƒuAƒfƒBƒŒƒNƒgƒŠA‚Ü‚½‚̓tƒ@ƒCƒ‹‚ðŽw’肵‚Ü‚·B\n\
+ /A Žw’肳‚ꂽ‘®«‚̃tƒ@ƒCƒ‹‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ ‘®« D ƒfƒBƒŒƒNƒgƒŠ R “Ç‚ÝŽæ‚èê—p\n\
+ H ‰B‚µƒtƒ@ƒCƒ‹ A ƒA[ƒJƒCƒu\n\
+ S ƒVƒXƒeƒ€ ƒtƒ@ƒCƒ‹ - ‚»‚Ì‘®«ˆÈŠO\n\
+ /B ƒtƒ@ƒCƒ‹–¼‚Ì‚Ý‚ð•\\Ž¦‚µ‚Ü‚· (Œ©o‚µ‚â—v–ñ‚ª•t‚«‚Ü‚¹‚ñ)B\n\
+ /C ƒtƒ@ƒCƒ‹ ƒTƒCƒY‚ðŒ…‹æØ‚è•\\Ž¦‚µ‚Ü‚·B‚±‚ê‚Í\n\
+ ƒfƒtƒHƒ‹ƒg‚ÌÝ’è‚Å‚·B/-C ‚Æ‚·‚é‚ÆŒ…‹æØ‚è•\\Ž¦‚³‚ê‚Ü‚¹‚ñB\n\
+ /D /W ‚Æ“¯‚¶‚Å‚·‚ªAƒtƒ@ƒCƒ‹‚ð—ñ‚Å•À‚בւ¦‚½ˆê——‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /L ¬•¶Žš‚Å•\\Ž¦‚µ‚Ü‚·B\n\
+ /N ƒtƒ@ƒCƒ‹–¼‚ð‰E’[‚É•\\Ž¦‚·‚éV‚µ‚¢ˆê——Œ`Ž®‚ðŽg—p‚µ‚Ü‚·B\n\
+ /O ƒtƒ@ƒCƒ‹‚ð•À‚בւ¦‚Ä•\\Ž¦‚µ‚Ü‚·B\n\
+ ƒ\\[ƒg‡ N –¼‘O‡ (ƒAƒ‹ƒtƒ@ƒxƒbƒg) S ƒTƒCƒY‡ (¬‚³‚¢‚Ù‚¤‚©‚ç)\n\
+ E Šg’£Žq‡ (ƒAƒ‹ƒtƒ@ƒxƒbƒg) D “úŽž‡ (ŒÃ‚¢‚Ù‚¤‚©‚ç)\n\
+ G ƒOƒ‹[ƒv (ƒfƒBƒŒƒNƒgƒŠ‚©‚ç) - ~‡\n\
+ /P 1 ‰æ–Ê‚²‚Æ‚É’âŽ~‚µ‚Ä•\\Ž¦‚µ‚Ü‚·B\n\
+ /Q ƒtƒ@ƒCƒ‹‚ÌŠ—LŽÒ‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /S Žw’肳‚ꂽƒfƒBƒŒƒNƒgƒŠ‚¨‚æ‚Ñ‚»‚̃TƒuƒfƒBƒŒƒNƒgƒŠ‚Ì‚·‚ׂĂÌ\n\
+ ƒtƒ@ƒCƒ‹‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /T ‚ǂ̃^ƒCƒ€ƒtƒB[ƒ‹ƒh‚ð•\\Ž¦‚·‚é‚©A‚Ü‚½‚Í•À‚בւ¦‚ÉŽg—p‚·‚é‚©‚ð\n\
+ Žw’肵‚Ü‚·B\n\
+ ƒ^ƒCƒ€ƒtƒB[ƒ‹ƒh C ì¬n\n\
+ A ÅIƒAƒNƒZƒX\n\
+ W ÅIXV\n\
+ /W ƒƒCƒhˆê——Œ`Ž®‚Å•\\Ž¦‚µ‚Ü‚·B\n\
+ /X ‚±‚̃IƒvƒVƒ‡ƒ“‚Í MS-DOS Œ`Ž® (8.3) ˆÈŠO‚̃tƒ@ƒCƒ‹–¼‚ɑ΂·‚é’Z‚¢\n\
+ –¼‘O‚ð•\\Ž¦‚µ‚Ü‚·B’·‚¢–¼‘O‚Ì‘O‚É’Z‚¢–¼‘O‚ð•\\Ž¦‚·‚é“_‚𜂯‚ÎA\n\
+ /N ƒIƒvƒVƒ‡ƒ“‚Æ“¯‚¶‚Å‚·B’Z‚¢–¼‘O‚ª‚È‚¢ê‡‚ÍAƒuƒ‰ƒ“ƒN‚É\n\
+ ‚È‚è‚Ü‚·B\n\
+ /4 4 ‚‚̔Žš‚Å”N‚ð•\\Ž¦‚µ‚Ü‚·B\n\n\
+ŠÂ‹«•Ï” DIRCMD ‚ɃXƒCƒbƒ`‚ðÝ’è‚Å‚«‚Ü‚·B\n\
+/-W ‚̂悤‚É - (ƒnƒCƒtƒ“) ‚ð‘O‚ɂ‚¯‚é‚ÆA‚»‚̃XƒCƒbƒ`‚Í–³Œø‚É‚È‚è‚Ü‚·B\n"
+
+STRING_DIR_HELP2, " ƒhƒ‰ƒCƒu %c ‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚Í %s ‚Å‚·\n"
+STRING_DIR_HELP3, " ƒhƒ‰ƒCƒu %c ‚ɂ̓{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ª‚ ‚è‚Ü‚¹‚ñB\n"
+STRING_DIR_HELP4, " ƒ{ƒŠƒ…[ƒ€ ƒVƒŠƒAƒ‹”Ô†‚Í %04X-%04X ‚Å‚·\n"
+STRING_DIR_HELP5, "\n ƒtƒ@ƒCƒ‹‚Ì‘”:\n%16i ŒÂ‚̃tƒ@ƒCƒ‹% 14s ƒoƒCƒg\n"
+STRING_DIR_HELP6, "%16i ŒÂ‚̃fƒBƒŒƒNƒgƒŠ% 15s ƒoƒCƒg\n"
+STRING_DIR_HELP7, "\n %s ‚̃fƒBƒŒƒNƒgƒŠ\n\n"
+STRING_DIR_HELP8, "%16i ŒÂ‚̃tƒ@ƒCƒ‹% 14s ƒoƒCƒg\n"
+
+STRING_DIRSTACK_HELP1, "POPD ƒRƒ}ƒ“ƒh‚ÅŽg—p‚·‚邽‚ß‚ÉŒ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚ð•Û‘¶‚µA\n\
+Žw’肵‚½ƒfƒBƒŒƒNƒgƒŠ‚É•ÏX‚µ‚Ü‚·B\n\n\
+PUSHD [ƒpƒX | ..]\n\n\
+ ƒpƒX Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚Æ‚µ‚ÄÝ’è‚·‚éƒfƒBƒŒƒNƒgƒŠ‚ðŽw’肵‚Ü‚·B\n"
+
+STRING_DIRSTACK_HELP2, "PUSHD ƒRƒ}ƒ“ƒh‚Å‹L‰¯‚³‚ꂽƒfƒBƒŒƒNƒgƒŠ‚É•ÏX‚µ‚Ü‚·B\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "ƒfƒBƒŒƒNƒgƒŠ ƒXƒ^ƒbƒN‚̈ꗗ‚ð•\\Ž¦‚µ‚Ü‚·B\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "ƒfƒBƒŒƒNƒgƒŠ ƒXƒ^ƒbƒN‚Í‹ó‚Å‚·B"
+
+STRING_ECHO_HELP1, "ƒƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚·‚ªA‘O‚ɃLƒƒƒŠƒbƒW ƒŠƒ^[ƒ“‚ƃ‰ƒCƒ“ƒtƒB[ƒh‚ð‚‚¯‚Ü‚¹‚ñB\n\n\
+ ECHOS ƒƒbƒZ[ƒW"
+
+STRING_ECHO_HELP2, "•W€ƒGƒ‰[‚ɃƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚·B\n\n\
+ ECHOERR ƒƒbƒZ[ƒW\n\
+ ECHOERR. ‹ós‚ðo—Í‚µ‚Ü‚·B"
+
+STRING_ECHO_HELP3, "•W€ƒGƒ‰[‚ɃƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚·‚ªA‘O‚ɃLƒƒƒŠƒbƒW ƒŠƒ^[ƒ“‚Æ\n\
+ƒ‰ƒCƒ“ƒtƒB[ƒh‚ð‚‚¯‚Ü‚¹‚ñB\n\n\
+ ECHOSERR ƒƒbƒZ[ƒW"
+
+STRING_ECHO_HELP4, "ƒƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚½‚èAƒRƒ}ƒ“ƒh ƒGƒR[‚Ì ON ‚Æ OFF ‚ðØ‚è‘Ö‚¦‚Ü‚·B\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [ƒƒbƒZ[ƒW]\n\
+ ECHO. ‹ós‚ðo—Í‚µ‚Ü‚·B\n\n\
+Œ»Ý‚̃GƒR[Ý’è‚ð•\\Ž¦‚·‚é‚É‚ÍAƒpƒ‰ƒ[ƒ^‚ðŽw’肹‚¸‚É ECHO ‚Æ“ü—Í‚µ‚Ä‚‚¾‚³‚¢B"
+
+STRING_ECHO_HELP5, "ECHO ‚Í %s ‚Å‚·B\n"
+
+STRING_EXIT_HELP, "ƒRƒ}ƒ“ƒh ƒCƒ“ƒ^[ƒvƒŠƒ^‚ðI—¹‚µ‚Ü‚·B\n\nEXIT\n"
+
+STRING_FOR_HELP1, "Žw’肳‚ꂽƒRƒ}ƒ“ƒh‚ðƒtƒ@ƒCƒ‹ ƒZƒbƒg‚ÌŠeƒtƒ@ƒCƒ‹‚ɑ΂µ‚ÄŽÀs‚µ‚Ü‚·B\n\n\
+FOR %%•Ï” IN (ƒZƒbƒg) DO ƒRƒ}ƒ“ƒh [ƒpƒ‰ƒ[ƒ^]\n\n\
+ %%•Ï” ’Pˆê•¶Žš‚Ì’u‚«Š·‚¦‰Â”\\‚ȃpƒ‰ƒ[ƒ^‚ðŽw’肵‚Ü‚·B\n\
+ (ƒZƒbƒg) ƒtƒ@ƒCƒ‹ ƒZƒbƒg‚ðŽw’肵‚Ü‚·BƒƒCƒ‹ƒhƒJ[ƒh‚ðŽg—p‚Å‚«‚Ü‚·B\n\
+ ƒRƒ}ƒ“ƒh Šeƒtƒ@ƒCƒ‹‚²‚Æ‚ÉŽÀs‚·‚éƒRƒ}ƒ“ƒh‚ðŽw’肵‚Ü‚·B\n\
+ ƒpƒ‰ƒ[ƒ^ Žw’肳‚ꂽƒRƒ}ƒ“ƒh‚̃pƒ‰ƒ[ƒ^‚Ü‚½‚̓XƒCƒbƒ`‚ðŽw’肵‚Ü‚·B\n\n\
+ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚Å FOR ƒRƒ}ƒ“ƒh‚ðŽg—p‚·‚é‚Æ‚«‚ÍA%%•Ï”‚Ì‘ã‚í‚è‚ÉA\n\
+%%%%•Ï”‚ðŽg—p‚µ‚Ä‚‚¾‚³‚¢B\n"
+
+STRING_FREE_HELP1, "\nƒhƒ‰ƒCƒu %c ‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚Í %-11s ‚Å‚·\n\
+ ƒVƒŠƒAƒ‹”Ô†‚Í %s ‚Å‚·\n\
+ %16s ƒoƒCƒg: ‘SƒfƒBƒXƒN—e—Ê\n\
+ %16s ƒoƒCƒg: Žg—p’†\n\
+ %16s ƒoƒCƒg: ‹ó‚«—e—Ê\n"
+
+STRING_FREE_HELP2, "ƒhƒ‰ƒCƒu‚ÉŠÖ‚·‚éî•ñ‚ð•\\Ž¦‚µ‚Ü‚·B\n\nFREE [ƒhƒ‰ƒCƒu: ...]\n"
+
+STRING_IF_HELP1, "ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€’†‚ÅðŒˆ—‚ðŽÀs‚µ‚Ü‚·B\n\n\
+ IF [NOT] ERRORLEVEL ”Ô† ƒRƒ}ƒ“ƒh\n\
+ IF [NOT] •¶Žš—ñ1==•¶Žš—ñ2 ƒRƒ}ƒ“ƒh\n\
+ IF [NOT] EXIST ƒtƒ@ƒCƒ‹–¼ ƒRƒ}ƒ“ƒh\n\
+ IF [NOT] DEFINED •Ï” ƒRƒ}ƒ“ƒh\n\n\
+NOT ðŒ‚ª‹U‚Ìꇂɂ¾‚¯ACMD ‚ªƒRƒ}ƒ“ƒh‚ðŽÀs‚·‚邱‚Æ‚ð\n\
+ Žw’肵‚Ü‚·B\n\
+ERRORLEVEL ”Ô† ÅŒã‚̃vƒƒOƒ‰ƒ€‚ÌŽÀs‚ÅŽw’肳‚ꂽ”Ô†ˆÈã‚ÌI—¹ƒR[ƒh\n\
+ ‚ª•Ô‚³‚ꂽ‚Æ‚«‚ÉAðŒ‚ª^‚É‚È‚é‚悤‚ÉŽw’肵‚Ü‚·B\n\
+ƒRƒ}ƒ“ƒh ðŒ‚ª^‚Ì‚Æ‚«‚ÉŽÀs‚·‚éƒRƒ}ƒ“ƒh‚ðŽw’肵‚Ü‚·B\n\
+•¶Žš—ñ1==•¶Žš—ñ2 ƒeƒLƒXƒg•¶Žš—ñ‚ªˆê’v‚·‚é‚Æ‚«‚ÉðŒ‚ª^‚É‚È‚é‚悤‚ÉŽw’è\n\
+ ‚µ‚Ü‚·B\n\
+EXIST ƒtƒ@ƒCƒ‹–¼ Žw’肵‚½ƒtƒ@ƒCƒ‹–¼‚ª‘¶Ý‚·‚é‚Æ‚«‚ÉðŒ‚ª^‚É‚È‚é‚悤‚É\n\
+ Žw’肵‚Ü‚·B\n\
+DEFINED •Ï” Žw’肵‚½•Ï”‚ª’è‹`‚³‚ê‚Ä‚¢‚é‚Æ‚«‚ÉðŒ‚ª^‚É‚È‚é‚悤‚É\n\
+ Žw’肵‚Ü‚·B\n"
+
+STRING_GOTO_HELP1, "ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€“à‚ÌAƒ‰ƒxƒ‹‚ÅŽw’肳‚ê‚Ä‚¢‚és‚Ö§Œä‚ðˆÚ“®‚µ‚Ü‚·B\n\n\
+GOTO ƒ‰ƒxƒ‹\n\n\
+ ƒ‰ƒxƒ‹ ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚щƒxƒ‹‚Æ‚µ‚ÄŽg—p‚·‚éƒeƒLƒXƒg•¶Žš—ñ‚ðŽw’肵‚Ü‚·B\n\n\
+ƒ‰ƒxƒ‹‚Ì擪‚É‚Í : (ƒRƒƒ“) ‚ðŽw’肵Aƒ‰ƒxƒ‹‚¾‚¯‚ð’P“Æ‚Å 1 s‚É“ü—Í‚µ‚Ä‚‚¾\n\
+‚³‚¢B"
+
+STRING_LABEL_HELP1, "ƒfƒBƒXƒN‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ð•\\Ž¦‚Ü‚½‚Í•ÏX‚µ‚Ü‚·B\n\nLABEL [ƒhƒ‰ƒCƒu:][ƒ‰ƒxƒ‹]\n"
+
+STRING_LABEL_HELP2, "ƒhƒ‰ƒCƒu %c: ‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚Í %s ‚Å‚·\n"
+STRING_LABEL_HELP3, "ƒhƒ‰ƒCƒu %c: ‚ɂ̓{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ª‚ ‚è‚Ü‚¹‚ñl\n"
+STRING_LABEL_HELP4, "ƒ{ƒŠƒ…[ƒ€ ƒVƒŠƒAƒ‹”Ô†‚Í %04X-%04X\n ‚Å‚·"
+STRING_LABEL_HELP5, "ƒ{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ð 11 •¶ŽšˆÈ“à‚Å“ü—Í‚µ‚Ä‚‚¾‚³‚¢B\n•K—v‚È‚¯‚ê‚Î Enter ƒL[‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢: "
+
+STRING_LOCALE_HELP1, "Œ»ÝŽž‚Í"
+
+STRING_MKDIR_HELP, "ƒfƒBƒŒƒNƒgƒŠ‚ð쬂µ‚Ü‚·B\n\n\
+MKDIR [ƒhƒ‰ƒCƒu:]ƒpƒX\n\
+MD [ƒhƒ‰ƒCƒu:]ƒpƒX"
+
+STRING_MEMMORY_HELP1, "ƒVƒXƒeƒ€ ƒƒ‚ƒŠ‚Ì—Ê‚ð•\\Ž¦‚µ‚Ü‚·B\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n %12s%% ‚̃ƒ‚ƒŠ‚ªŽg—p‚³‚ê‚Ä‚¢‚Ü‚·B\n\n\
+ %13s ƒoƒCƒg: ‘S•¨—ƒƒ‚ƒŠ\n\
+ %13s ƒoƒCƒg: —˜—p‰Â”\\‚È•¨—ƒƒ‚ƒŠ\n\n\
+ %13s ƒoƒCƒg: ‘Sƒy[ƒWƒtƒ@ƒCƒ‹\n\
+ %13s ƒoƒCƒg: —˜—p‰Â”\\‚ȃy[ƒWƒtƒ@ƒCƒ‹\n\n\
+ %13s ƒoƒCƒg: ‘S‰¼‘zƒƒ‚ƒŠ\n\
+ %13s ƒoƒCƒg: —˜—p‰Â”\\‚ȉ¼‘zƒƒ‚ƒŠ\n"
+
+STRING_MISC_HELP1, "‘±s‚·‚é‚ɂ͉½‚©ƒL[‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢ ...\n"
+
+STRING_MOVE_HELP1, "%s ‚ðã‘‚«‚µ‚Ü‚·‚ª‚æ‚낵‚¢‚Å‚·‚© (Yes/No/All)? "
+
+STRING_MOVE_HELP2, "ƒtƒ@ƒCƒ‹‚ðˆÚ“®‚¨‚æ‚уtƒ@ƒCƒ‹‚ƃfƒBƒŒƒNƒgƒŠ–¼‚ð•ÏX‚µ‚Ü‚·B\n\n\
+1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚ðˆÚ“®‚·‚é‚É‚Í:\n\
+MOVE [/N][ƒhƒ‰ƒCƒu:][ƒpƒX]ƒtƒ@ƒCƒ‹–¼1[,...] ˆÚ“®æ\n\n\
+ƒfƒBƒŒƒNƒgƒŠ–¼‚ð•ÏX‚·‚é‚É‚Í:\n\
+MOVE [/N][ƒhƒ‰ƒCƒu:][ƒpƒX]•ÏX‘O •ÏXŒã\n\n\
+ [ƒhƒ‰ƒCƒu:][ƒpƒX]ƒtƒ@ƒCƒ‹–¼1\n\
+ ˆÚ“®‚·‚éƒtƒ@ƒCƒ‹‚ÌꊂƖ¼‘O‚ðŽw’肵‚Ü‚·B\n\
+ /N Nothing. ƒtƒ@ƒCƒ‹‚ƃfƒBƒŒƒNƒgƒŠ‚̈ړ®ˆÈŠO‚Ì‚·‚ׂĂðs‚¢‚Ü‚·B\n\n\
+Œ»’iŠK‚ł̧ŒÀ:\n\
+ - ƒtƒ@ƒCƒ‹‚âƒfƒBƒŒƒNƒgƒŠ‚ðAˆÙ‚È‚éƒhƒ‰ƒCƒu‚ð‚Ü‚½‚ª‚Á‚Ĉړ®‚·‚邱‚Æ‚Í\n\
+ ‚Å‚«‚Ü‚¹‚ñB\n"
+
+STRING_MSGBOX_HELP, "ƒƒbƒZ[ƒW ƒ{ƒbƒNƒX‚ð•\\Ž¦‚µAƒ†[ƒU[‚É•Ô“š‚ð‹‚ß‚Ü‚·B\n\n\
+MSGBOX ƒ^ƒCƒv ['ƒ^ƒCƒgƒ‹'] ƒƒbƒZ[ƒW\n\n\
+ƒ^ƒCƒv •\\Ž¦‚³‚ê‚éƒ{ƒ^ƒ“‚̃^ƒCƒv‚Å‚·B\n\
+ ŽŸ‚Ì’l‚ªŽg—p‚Å‚«‚Ü‚·: OK, OKCANCEL,\n\
+ YESNO, YESNOCANCEL\n\
+ƒ^ƒCƒgƒ‹ ƒƒbƒZ[ƒW ƒ{ƒbƒNƒX‚̃^ƒCƒgƒ‹‚Å‚·B\n\
+ƒƒbƒZ[ƒW ƒƒbƒZ[ƒW ƒ{ƒbƒNƒX‚É•\\Ž¦‚³‚ê‚郃bƒZ[ƒW‚Å‚·B\n\n\n\
+‰Ÿ‚³‚ꂽƒ{ƒ^ƒ“‚É‚æ‚èAŽŸ‚Ì ERRORLEVEL ‚ªÝ’肳‚ê‚Ü‚·:\n\n\
+YES : 10 | NO : 11\n\
+OK : 10 | CANCEL : 12\n"
+
+STRING_PATH_HELP1, "ŽÀs‰Â”\\ƒtƒ@ƒCƒ‹‚ÌŒŸõƒpƒX‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\n\
+PATH [[ƒhƒ‰ƒCƒu:]ƒpƒX[;...]]\nPATH ;\n\n\
+ƒpƒ‰ƒ[ƒ^‚Æ‚µ‚Ä ; (ƒZƒ~ƒRƒƒ“) ‚¾‚¯‚ðŽw’è‚·‚é‚ÆA‚·‚ׂĂ̌ŸõƒpƒX‚Í\n\
+ƒNƒŠƒA‚³‚ê‚ÄŒ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚¾‚¯‚ªŒŸõ‚³‚ê‚Ü‚·B\n\
+ƒpƒ‰ƒ[ƒ^‚ðŽw’肹‚¸‚É PATH ‚Æ“ü—Í‚·‚é‚ÆAŒ»Ý‚̃pƒX‚ª•\\Ž¦‚³‚ê‚Ü‚·B\n"
+
+STRING_PROMPT_HELP1, "ƒRƒ}ƒ“ƒh ƒvƒƒ“ƒvƒg‚ð•ÏX‚µ‚Ü‚·B\n\n\
+PROMPT [•¶Žš—ñ]\n\n\
+ •¶Žš—ñ V‚µ‚¢ƒRƒ}ƒ“ƒh ƒvƒƒ“ƒvƒg‚ðŽw’肵‚Ü‚·B\n\n\
+PROMPT ‚É‚Í’Êí‚Ì•¶Žš‚ÆŽŸ‚ÉŽ¦‚·“ÁŽêƒR[ƒh‚ðŽg—p‚Å‚«‚Ü‚·:\n\n\
+ $A & (ƒAƒ“ƒpƒTƒ“ƒh)\n\
+ $B | (ƒpƒCƒv)\n\
+ $C ( (¶‚©‚Á‚±)\n\
+ $D Œ»Ý‚Ì“ú•t\n\
+ $E ƒGƒXƒP[ƒv ƒR[ƒh (ASCII ƒR[ƒh‚Ì 27)\n\
+ $F ) (‰E‚©‚Á‚±)\n\
+ $G > (•s“™† (‘å‚È‚è))\n\
+ $H ƒoƒbƒNƒXƒy[ƒX (’¼‘O‚Ì•¶Žš‚ð휂µ‚Ü‚·)\n\
+ $L < (•s“™† (¬‚È‚è))\n\
+ $N Œ»Ý‚̃hƒ‰ƒCƒu\n\
+ $P Œ»Ý‚̃hƒ‰ƒCƒu‚ƃpƒX\n\
+ $Q = (“™†)\n\
+ $T Œ»Ý‚ÌŽž\n\
+ $V OS ‚̃o[ƒWƒ‡ƒ“”Ô†\n\
+ $_ ƒLƒƒƒŠƒbƒW ƒŠƒ^[ƒ“‚ƃ‰ƒCƒ“ƒtƒB[ƒh\n\
+ $$ $ (ƒhƒ‹‹L†)\n"
+
+STRING_PAUSE_HELP1, "ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚̈—‚ðˆêŽž’âŽ~‚µAŽŸ‚̃ƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚·B:\n\
+'‘±s‚·‚é‚ɂ͉½‚©ƒL[‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢ ...' ‚Ü‚½‚̓†[ƒU[‚ª’è‹`‚µ‚½ƒƒbƒZ[ƒWB\n\n\
+PAUSE [ƒƒbƒZ[ƒW]"
+
+STRING_PROMPT_HELP2, " $+ Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ ƒXƒ^ƒbƒN‚Ì[‚³‚ð•\\Ž¦‚µ‚Ü‚·"
+
+STRING_PROMPT_HELP3, "\nƒpƒ‰ƒ[ƒ^‚ðŽw’肹‚¸‚É PROMPT ‚Æ“ü—Í‚·‚é‚ÆAƒvƒƒ“ƒvƒg‚Ìݒ肪ƒfƒtƒHƒ‹ƒg‚ɃŠƒZƒbƒg‚³‚ê‚Ü‚·B"
+
+STRING_REM_HELP, "ƒoƒbƒ` ƒtƒ@ƒCƒ‹‚ɃRƒƒ“ƒg (’Žß) ‚ð‹L˜^‚µ‚Ü‚·B\n\nREM [ƒRƒƒ“ƒg]"
+
+STRING_RMDIR_HELP, "ƒfƒBƒŒƒNƒgƒŠ‚ð휂µ‚Ü‚·B\n\n\
+RMDIR [ƒhƒ‰ƒCƒu:]ƒpƒX\nRD [ƒhƒ‰ƒCƒu:]ƒpƒX\n\
+ /S Žw’肳‚ꂽƒfƒBƒŒƒNƒgƒŠ“à‚É‚ ‚éƒtƒ@ƒCƒ‹‚âƒtƒHƒ‹ƒ_‚à‚·‚ׂÄ휂µ‚Ü‚·B\n\
+ /Q Šm”F‚̃ƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚¹‚ñB\n"
+STRING_RMDIR_HELP2, "ƒfƒBƒŒƒNƒgƒŠ‚ª‹ó‚Å‚Í‚ ‚è‚Ü‚¹‚ñ!\n"
+
+STRING_REN_HELP1, "ƒtƒ@ƒCƒ‹‚âƒfƒBƒŒƒNƒgƒŠ (•¡”‰Â) ‚Ì–¼‘O‚ð•ÏX‚µ‚Ü‚·B\n\n\
+RENAME [/E /N /P /Q /S /T] Œ³‚̃tƒ@ƒCƒ‹–¼ ... Vƒtƒ@ƒCƒ‹–¼\n\
+REN [/E /N /P /Q /S /T] Œ³‚̃tƒ@ƒCƒ‹–¼ ... Vƒtƒ@ƒCƒ‹–¼\n\n\
+ /E ƒGƒ‰[ƒƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚¹‚ñB\n\
+ /N ‰½‚à‚µ‚Ü‚¹‚ñB\n\
+ /P ƒtƒ@ƒCƒ‹‚Ì–¼‘O‚ð•ÏX‚·‚é‘O‚É‚»‚ꂼ‚êŠm”F‚ð‹‚ß‚Ü‚·B\n\
+ (‚Ü‚¾ŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ!)\n\
+ /Q Quiet.\n\
+ /S ƒTƒuƒfƒBƒŒƒNƒgƒŠ‚Ì–¼‘O‚ð•ÏX‚·‚éB\n\
+ /T –¼‘O‚ð•ÏX‚µ‚½ƒtƒ@ƒCƒ‹‚Ì‘”‚ð•ñ‚·‚éB\n\n\
+Vƒtƒ@ƒCƒ‹–¼ ‚É‚ÍV‚µ‚¢ƒhƒ‰ƒCƒu‚àƒpƒX‚àŽw’è‚Å‚«‚È‚¢‚Ì‚Å’ˆÓ‚µ‚Ä‚‚¾‚³‚¢B\n\
+‚»‚¤‚¢‚Á‚½–Ú“I‚É‚Í MOVE ƒRƒ}ƒ“ƒh‚ð—p‚¢‚Ä‚‚¾‚³‚¢B\n"
+
+STRING_REN_HELP2, " %lu ŒÂ‚̃tƒ@ƒCƒ‹‚Ì–¼‘O‚ª•ÏX‚³‚ê‚Ü‚µ‚½\n"
+
+STRING_REN_HELP3, " %lu ŒÂ‚̃tƒ@ƒCƒ‹‚Ì–¼‘O‚ª•ÏX‚³‚ê‚Ü‚µ‚½\n"
+
+STRING_SHIFT_HELP, "ƒoƒbƒ` ƒtƒ@ƒCƒ‹’†‚Ì’u‚«Š·‚¦‰Â”\\‚ȃpƒ‰ƒ[ƒ^‚̈ʒu‚ð•ÏX‚µ‚Ü‚·B\n\n\
+SHIFT [DOWN]"
+
+STRING_SCREEN_HELP, "ƒJ[ƒ\\ƒ‹‚ðˆÚ“®‚³‚¹‚Ü‚·BˆÚ“®ŒãA•¶Žš—ñ‚ð“ü—Í‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B\n\n\
+SCREEN —ñ s [ƒeƒLƒXƒg]\n\n\
+ —ñ ƒJ[ƒ\\ƒ‹‚ðˆÚ“®‚³‚¹‚é—ñ‚Å‚·B\n\
+ s ƒJ[ƒ\\ƒ‹‚ðˆÚ“®‚³‚¹‚és‚Å‚·B"
+
+STRING_SET_HELP, "ŠÂ‹«•Ï”‚ð•\\Ž¦AÝ’èA‚Ü‚½‚Í휂µ‚Ü‚·B\n\n\
+SET [•Ï”–¼[=]•¶Žš—ñ]]\n\n\
+ •Ï”–¼ ŠÂ‹«•Ï”–¼‚ðŽw’肵‚Ü‚·B\n\
+ •¶Žš—ñ •Ï”‚ÉŠ„‚è“–‚Ă镶Žš—ñ‚ðŽw’肵‚Ü‚·B\n\n\
+Œ»Ý‚̊‹«•Ï”‚ð•\\Ž¦‚·‚é‚É‚ÍAƒpƒ‰ƒ[ƒ^‚ðŽw’肹‚¸‚É SET ‚Æ“ü—Í‚µ‚Ä‚‚¾‚³‚¢B\n"
+
+STRING_START_HELP1, "•Ê‚̃EƒBƒ“ƒhƒE‚ð‹N“®‚µAŽw’肵‚½ƒvƒƒOƒ‰ƒ€‚Ü‚½‚̓Rƒ}ƒ“ƒh‚ðŽÀs‚µ‚Ü‚·B\n\n\
+START ƒRƒ}ƒ“ƒh\n\n\
+ ƒRƒ}ƒ“ƒh ŽÀs‚·‚éƒRƒ}ƒ“ƒh‚ðŽw’肵‚Ü‚·B\n\n\
+Œ»Žž“_‚Å‚ÍAƒRƒ}ƒ“ƒh‚Í‚·‚ׂē¯Šú‚¹‚¸‚ÉŠJŽn‚³‚ê‚Ü‚·B\n"
+
+STRING_TITLE_HELP, "ƒRƒ}ƒ“ƒh ƒvƒƒ“ƒvƒg ƒEƒBƒ“ƒhƒE‚̃EƒBƒ“ƒhƒE ƒ^ƒCƒgƒ‹‚ðݒ肵‚Ü‚·B\n\n\
+TITLE [•¶Žš—ñ]\n\n\
+•¶Žš—ñ ƒRƒ}ƒ“ƒh ƒvƒƒ“ƒvƒg ƒEƒBƒ“ƒhƒE‚̃^ƒCƒgƒ‹‚ðŽw’肵‚Ü‚·B\n"
+
+STRING_TIME_HELP1, "ƒVƒXƒeƒ€Žž‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\n\
+TIME [/T][Žž]\n\n\
+ /T Œ»ÝŽž‚Ì•\\Ž¦‚Ì‚Ýs‚¢‚Ü‚·B\n\n\
+ƒpƒ‰ƒ[ƒ^‚ÌŽw’肪‚È‚¯‚ê‚ÎAŒ»Ý‚Ìݒ肪•\\Ž¦‚³‚êAV‚µ‚¢Žž‚ð“ü—Í‚Å‚«‚é\n\
+ƒvƒƒ“ƒvƒg‚É‚È‚è‚Ü‚·B•ÏX‚µ‚È‚¢ê‡‚ÍAEnter ƒL[‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢B\n"
+
+STRING_TIME_HELP2, "V‚µ‚¢Žž‚ð“ü—Í‚µ‚Ä‚‚¾‚³‚¢: "
+
+STRING_TIMER_HELP1, "%d ƒ~ƒŠ•b‚ªŒo‰ßB\n"
+
+STRING_TIMER_HELP2, "%02d%c%02d%c%02d%c%02d ‚ªŒo‰ßB\n"
+
+STRING_TIMER_HELP3, "10 ŒÂ‚܂ł̃XƒgƒbƒvƒEƒHƒbƒ`‚ðŽg‚¤‚±‚Æ‚ª‚Å‚«‚Ü‚·B\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON ƒXƒgƒbƒvƒEƒHƒbƒ`‚ð ON ‚É‚µ‚Ü‚·B\n\
+ OFF ƒXƒgƒbƒvƒEƒHƒbƒ`‚ð OFF ‚É‚µ‚Ü‚·B\n\
+ /S Split time. ƒXƒgƒbƒvƒEƒHƒbƒ`‚Ì’l‚ð•ÏX‚·‚邱‚Æ‚È‚A\n\
+ Œ»Ý‚ñ‚Å‚¢‚鎞ŠÔ‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /n ƒXƒgƒbƒvƒEƒHƒbƒ`”Ô†‚ðŽw’肵‚Ü‚·B\n\
+ ƒXƒgƒbƒvƒEƒHƒbƒ`‚Í 0 ‚©‚ç 9 ‚Ü‚Å‚ª—˜—p‚Å‚«‚Ü‚·B\n\
+ Žw’肵‚È‚¢ê‡AƒfƒtƒHƒ‹ƒg‚Æ‚µ‚Ä 1 ‚ðŽg‚¢‚Ü‚·B\n\
+ /Fn o—Í‚Ì‘Ž®\n\
+ n ‚É‚ÍŽŸ‚Ì“ñ‚‚̒l‚ð—p‚¢‚邱‚Æ‚ª‚Å‚«‚Ü‚·:\n\
+ 0 ƒ~ƒŠ•b\n\
+ 1 hh%cmm%css%cdd\n\n\
+ONAOFFA/S ‚Ì‚¢‚¸‚ê‚àŽw’肵‚È‚©‚Á‚½ê‡‚É‚ÍAƒXƒgƒbƒvƒEƒHƒbƒ`‚Ì\n\
+ó‘Ô‚ðØ‚è‘Ö‚¦‚Ü‚·B\n\n"
+
+STRING_TYPE_HELP1, "ƒeƒLƒXƒg ƒtƒ@ƒCƒ‹‚Ü‚½‚̓tƒ@ƒCƒ‹‚Ì“à—e‚ð•\\Ž¦‚µ‚Ü‚·B\n\nTYPE [ƒhƒ‰ƒCƒu:][ƒpƒX]ƒtƒ@ƒCƒ‹–¼ \n\
+ /P 1 “x‚É 1 ‰æ–Ê‚¸‚•\\Ž¦‚µ‚Ü‚·B\n"
+
+STRING_VERIFY_HELP1, "‚±‚̃Rƒ}ƒ“ƒh‚̓_ƒ~[‚Å‚·!!\n\
+ƒtƒ@ƒCƒ‹‚ªƒfƒBƒXƒN‚ɳ‚µ‚‘‚«ž‚܂ꂽ‚±‚Æ‚ðƇ‚·‚é‚©‚Ç‚¤‚©‚ðŽwŽ¦‚µ‚Ü‚·B\n\n\
+VERIFY [ON | OFF]\n\n\
+Œ»Ý‚ÌÝ’è‚ð•\\Ž¦‚·‚é‚Æ‚«‚ÍAƒpƒ‰ƒ[ƒ^‚ðŽw’肹‚¸‚É VERIFY ‚Æ“ü—Í‚µ‚Ä‚‚¾‚³‚¢B\n"
+
+STRING_VERIFY_HELP2, "VERIFY ‚Í %s ‚Å‚·B\n"
+
+STRING_VERIFY_HELP3, "ON ‚© OFF ‚Ì‚Ç‚¿‚ç‚©‚ðŽw’肵‚Ä‚‚¾‚³‚¢B"
+
+STRING_VERSION_HELP1, "ƒVƒFƒ‹‚̃o[ƒWƒ‡ƒ“î•ñ‚ð•\\Ž¦‚µ‚Ü‚·B\n\n\
+VER [/C][/R][/W]\n\n\
+ /C ƒNƒŒƒWƒbƒg‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /R Ä”z•z‚ÉŠÖ‚·‚éî•ñ‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+ /W •ÛØ‚ÉŠÖ‚·‚éî•ñ‚ð•\\Ž¦‚µ‚Ü‚·B"
+
+STRING_VERSION_HELP2, " ‚Í *‘S‚‚Ì–³•ÛØ* ‚Å’ñ‹Ÿ‚³‚ê‚Ü‚·BÚ‚µ‚‚Í\n\
+'ver /w' ‚ƃ^ƒCƒv‚µ‚ĉº‚³‚¢B‚±‚ê‚̓tƒŠ[ƒ\\ƒtƒgƒEƒFƒA‚Å‚ ‚èA‚ ‚éðŒ‚̉º‚Å\n\
+ĔЕz‚·‚邱‚Æ‚ª§—コ‚ê‚Ä‚¢‚Ü‚·BÚ‚µ‚‚Í 'ver /r' ‚ƃ^ƒCƒv‚µ‚ĉº‚³‚¢B\n\
+ƒNƒŒƒWƒbƒg‚̈ꗗ‚ðŒ©‚é‚É‚Í 'ver /c' ‚ƃ^ƒCƒv‚µ‚ĉº‚³‚¢B"
+
+STRING_VERSION_HELP3, "\n ‚±‚̃vƒƒOƒ‰ƒ€‚Í—L—p‚Å‚ ‚邱‚Æ‚ðŠè‚Á‚ĔЕz‚³‚ê‚Ü‚·‚ªA*‘S‚‚Ì–³•ÛØ*\n\
+ ‚Å‚·B¤‹Æ‰Â”\\«‚Ì•ÛØ‚â“Á’è‚Ì–Ú“I‚Ö‚Ì“K‡«‚ÍAŒ¾ŠO‚ÉŽ¦‚³‚ꂽ‚à‚Ì‚àŠÜ\n\
+ ‚ß‘S‚‘¶Ý‚µ‚Ü‚¹‚ñBÚ‚µ‚‚Í GNU General Public License ‚ð‚²——‚‚¾‚³‚¢B"
+
+STRING_VERSION_HELP4, "\n ‚±‚̃vƒƒOƒ‰ƒ€‚̓tƒŠ[ƒ\\ƒtƒgƒEƒFƒA‚Å‚·B‚ ‚È‚½‚Í‚±‚ê‚ðAƒtƒŠ[ƒ\\ƒtƒgƒEƒF\n\
+ ƒAà’c‚É‚æ‚Á‚Ä”s‚³‚ꂽ GNU General Public License (ƒo[ƒWƒ‡ƒ“ 2 ‚©A\n\
+ Šó–]‚É‚æ‚Á‚Ä‚Í‚»‚êˆÈ~‚̃o[ƒWƒ‡ƒ“‚Ì‚¤‚¿‚Ç‚ê‚©) ‚Ì’è‚ß‚éðŒ‚̉º‚ÅÄ”Ð\n\
+ •z‚Ü‚½‚͉ü•Ï‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B\n"
+
+STRING_VERSION_HELP5, "\nƒoƒO•ñ‚Í ‚Ö‘—‚Á‚Ä‚‚¾‚³‚¢B\n\
+ÅV‚̃o[ƒWƒ‡ƒ“‚ÍŽŸ‚̃y[ƒW‚©‚ç“üŽè‚Å‚«‚Ü‚·: http://www.reactos.org"
+
+STRING_VERSION_HELP6, "\nFreeDOS version written by:\n"
+
+STRING_VERSION_HELP7, "\nReactOS version written by:\n"
+
+STRING_VOL_HELP1, " ƒhƒ‰ƒCƒu %c: ‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚Í %s ‚Å‚·B\n"
+STRING_VOL_HELP2, " ƒhƒ‰ƒCƒu %c: ‚ɂ̓{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ª‚ ‚è‚Ü‚¹‚ñB\n"
+STRING_VOL_HELP3, " ƒ{ƒŠƒ…[ƒ€ ƒVƒŠƒAƒ‹”Ô†‚Í %04X-%04X ‚Å‚·B\n"
+STRING_VOL_HELP4, "‘¶Ý‚·‚é‚È‚ç‚ÎAƒfƒBƒXƒN‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ƃVƒŠƒAƒ‹”Ô†‚ð•\\Ž¦‚µ‚Ü‚·B\n\nVOL [ƒhƒ‰ƒCƒu:]"
+
+STRING_WINDOW_HELP1, "ƒRƒ“ƒ\\[ƒ‹ ƒEƒBƒ“ƒhƒE‚ÌŠOŒ©‚ð•ÏX‚µ‚Ü‚·B\n\n\
+WINDOW [/POS[=]¶,ã,•,‚‚³]\n\
+ [MIN|MAX|RESTORE] ['title']\n\n\
+/POS ƒEƒBƒ“ƒhƒE‚̈ʒu‚Æ‘å‚«‚³‚ðŽw’肵‚Ü‚·B\n\
+MIN ƒEƒBƒ“ƒhƒE‚ðŬ‰»‚µ‚Ü‚·B\n\
+MAX ƒEƒBƒ“ƒhƒE‚ðő剻‚µ‚Ü‚·B\n\
+RESTORE ƒEƒBƒ“ƒhƒE‚ðŒ³‚ÌƒTƒCƒY‚É–ß‚µ‚Ü‚·B"
+
+STRING_WINDOW_HELP2, "ƒRƒ“ƒ\\[ƒ‹ ƒEƒBƒ“ƒhƒE‚ÌŠOŒ©‚ð•ÏX‚µ‚Ü‚·B\n\n\
+ACTIVATE 'ƒEƒBƒ“ƒhƒE' [/POS[=]¶,ã,•,‚‚³]\n\
+ [MIN|MAX|RESTORE] ['ƒ^ƒCƒgƒ‹']\n\n\
+ƒEƒBƒ“ƒhƒE ŠOŒ©‚ð•ÏX‚·‚éƒEƒBƒ“ƒhƒE‚̃^ƒCƒgƒ‹‚Å‚·B\n\
+/POS ƒEƒBƒ“ƒhƒE‚̈ʒu‚Æ‘å‚«‚³‚ðŽw’肵‚Ü‚·B\n\
+MIN ƒEƒBƒ“ƒhƒE‚ðŬ‰»‚µ‚Ü‚·B\n\
+MAX ƒEƒBƒ“ƒhƒE‚ðő剻‚µ‚Ü‚·B\n\
+RESTORE ƒEƒBƒ“ƒhƒE‚ðŒ³‚ÌƒTƒCƒY‚É–ß‚µ‚Ü‚·B\n\
+ƒ^ƒCƒgƒ‹ V‚µ‚¢ƒ^ƒCƒgƒ‹‚Å‚·B\n"
+
+
+STRING_HELP1, "—˜—p‰Â”\\‚È‚·‚ׂẴRƒ}ƒ“ƒh‚̈ꗗ‚ÆA‚»‚Ìà–¾B\n\n\
+ ƒRƒ}ƒ“ƒh /? “Á’è‚̃Rƒ}ƒ“ƒh‚ÉŠÖ‚·‚éÚ×î•ñ\n\n\
+? —˜—p‰Â”\\‚È‚·‚ׂẴRƒ}ƒ“ƒh‚̈ꗗ (à–¾‚È‚µ)B\n\
+ALIAS ƒGƒCƒŠƒAƒX‚ÌÝ’è‚â‰ðœ‚ð‚µ‚½‚èAƒGƒCƒŠƒAƒX‚ð•\\Ž¦‚µ‚½‚肵‚Ü‚·B\n\
+ATTRIB ƒtƒ@ƒCƒ‹‘®«‚ð•\\Ž¦‚Ü‚½‚Í•ÏX‚µ‚Ü‚·B\n\
+BEEP ƒXƒs[ƒJ‚©‚çƒr[ƒv‰¹‚ð–‚炵‚Ü‚·B\n\
+CALL ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚ð•Ê‚̃oƒbƒ` ƒvƒƒOƒ‰ƒ€‚©‚çŒÄ‚Ño‚µ‚Ü‚·B\n\
+CD Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚ð•ÏX‚µ‚½‚èAƒfƒBƒŒƒNƒgƒŠ–¼‚ð•\\Ž¦‚µ‚½‚肵‚Ü‚·B\n\
+CHCP Œ»Ý‚̃R[ƒh ƒy[ƒW”Ô†‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\
+CHOICE ƒ†[ƒU[‚ª‘I‘ðŽˆ‚©‚çˆê‚‚ð‘I‘ð‚·‚é‚Ì‚ð‘Ò‚¿‚Ü‚·B\n\
+CLS ‰æ–Ê‚ðÁ‹Ž‚µ‚Ü‚·B\n\
+CMD ReactOS ƒRƒ}ƒ“ƒh ƒCƒ“ƒ^[ƒvƒŠƒ^‚ÌV‚µ‚¢ƒCƒ“ƒXƒ^ƒ“ƒX‚ðŠJŽn‚µ‚Ü‚·B\n\
+COLOR ƒRƒ“ƒ\\[ƒ‹‚̃fƒtƒHƒ‹ƒg‚Ì‘OŒiF‚¨‚æ‚Ñ”wŒiF‚ðݒ肵‚Ü‚·B\n\
+COPY 1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚ð•Ê‚ÌꊂɃRƒs[‚µ‚Ü‚·B\n\
+DATE “ú•t‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\
+DELAY n •bA‚Ü‚½‚Í n ƒ~ƒŠ•b‘Ò‹@‚µ‚Ü‚·B\n\
+DELETE 1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚ð휂µ‚Ü‚·B\n\
+DIR ƒfƒBƒŒƒNƒgƒŠ’†‚̃tƒ@ƒCƒ‹‚ƃTƒuƒfƒBƒŒƒNƒgƒŠ‚ðˆê——•\\Ž¦‚µ‚Ü‚·B\n\
+ECHO ƒƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚½‚èAƒRƒ}ƒ“ƒh ƒGƒR[‚Ì ON ‚Æ OFF ‚ðØ‚è‘Ö‚¦‚Ü‚·B\n\
+ERASE 1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚ð휂µ‚Ü‚·B\n\
+EXIT CMD.exe (ƒRƒ}ƒ“ƒh ƒ‰ƒCƒ“ ƒCƒ“ƒ^[ƒvƒŠƒ^) ‚ðI—¹‚µ‚Ü‚·B\n\
+FOR Žw’肳‚ꂽƒRƒ}ƒ“ƒh‚ðƒtƒ@ƒCƒ‹ ƒZƒbƒg‚ÌŠeƒtƒ@ƒCƒ‹‚ɑ΂µ‚ÄŽÀs‚µ‚Ü‚·B\n\
+FREE ƒfƒBƒXƒN‚Ì‹ó‚«—e—Ê\n\
+GOTO ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€“à‚ÌAƒ‰ƒxƒ‹‚ÅŽw’肳‚ê‚Ä‚¢‚és‚Ö§Œä‚ðˆÚ“®‚µ‚Ü‚·B\n\
+HELP ReactOS ƒRƒ}ƒ“ƒh‚̃wƒ‹ƒvî•ñ‚ð’ñ‹Ÿ‚µ‚Ü‚·B\n\
+HISTORY Žg—p‚³‚ꂽ‚·‚ׂẴRƒ}ƒ“ƒh‚ðˆê——•\\Ž¦‚µ‚Ü‚·B\n\
+IF ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€’†‚ÅðŒˆ—‚ðŽÀs‚µ‚Ü‚·B\n\
+LABEL ƒfƒBƒXƒN‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ð•\\Ž¦‚Ü‚½‚Í•ÏX‚µ‚Ü‚·B\n\
+MD ƒfƒBƒŒƒNƒgƒŠ‚ð쬂µ‚Ü‚·B\n\
+MKDIR ƒfƒBƒŒƒNƒgƒŠ‚ð쬂µ‚Ü‚·B\n\
+MOVE ƒtƒ@ƒCƒ‹‚ðˆÚ“®‚¨‚æ‚уtƒ@ƒCƒ‹‚ƃfƒBƒŒƒNƒgƒŠ–¼‚ð•ÏX‚µ‚Ü‚·B\n\
+PATH ŽÀs‰Â”\\ƒtƒ@ƒCƒ‹‚ÌŒŸõƒpƒX‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\
+PAUSE ƒoƒbƒ` ƒvƒƒOƒ‰ƒ€‚̈—‚ðˆêŽž’âŽ~‚µAƒƒbƒZ[ƒW‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+POPD Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚ð PUSHD ƒRƒ}ƒ“ƒh‚Å‹L‰¯‚³‚ꂽƒfƒBƒŒƒNƒgƒŠ‚É\n\
+ •ÏX‚µ‚Ü‚·B\n\
+PROMPT ƒRƒ}ƒ“ƒh ƒvƒƒ“ƒvƒg‚ð•ÏX‚µ‚Ü‚·B\n\
+PUSHD Œ»Ý‚̃fƒBƒŒƒNƒgƒŠ‚ð•Û‘¶‚µAŽw’肵‚½ƒfƒBƒŒƒNƒgƒŠ‚É•ÏX‚µ‚Ü‚·B\n\
+RD ƒfƒBƒŒƒNƒgƒŠ‚ð휂µ‚Ü‚·B\n\
+REM ƒoƒbƒ` ƒtƒ@ƒCƒ‹‚ɃRƒƒ“ƒg (’Žß) ‚ð‹L˜^‚µ‚Ü‚·B\n\
+REN 1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚Ì–¼‘O‚ð•ÏX‚µ‚Ü‚·B\n\
+RENAME 1 ‚‚܂½‚Í•¡”‚̃tƒ@ƒCƒ‹‚Ì–¼‘O‚ð•ÏX‚µ‚Ü‚·B\n\
+RMDIR ƒfƒBƒŒƒNƒgƒŠ‚ð휂µ‚Ü‚·B\n\
+SCREEN ƒJ[ƒ\\ƒ‹‚ðˆÚ“®‚³‚¹‚Ü‚·BˆÚ“®ŒãA•¶Žš—ñ‚ð“ü—Í‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B\n\
+SET ŠÂ‹«•Ï”‚ð•\\Ž¦AÝ’èA‚Ü‚½‚Í휂µ‚Ü‚·B\n\
+SHIFT ƒJ[ƒ\\ƒ‹‚ðˆÚ“®‚³‚¹‚Ü‚·BˆÚ“®ŒãA•¶Žš—ñ‚ð“ü—Í‚·‚邱‚Æ‚à‚Å‚«‚Ü‚·B\n"
+STRING_HELP2, "START •Ê‚̃EƒBƒ“ƒhƒE‚ð‹N“®‚µAŽw’肵‚½ƒvƒƒOƒ‰ƒ€‚Ü‚½‚̓Rƒ}ƒ“ƒh‚ðŽÀs‚µ‚Ü‚·B\n\
+TIME ƒVƒXƒeƒ€Žž‚ð•\\Ž¦‚Ü‚½‚Íݒ肵‚Ü‚·B\n\
+TIMER 10 ŒÂ‚܂ł̃XƒgƒbƒvƒEƒHƒbƒ`‚ðŽg‚¤‚±‚Æ‚ª‚Å‚«‚Ü‚·B\n\
+TITLE ƒRƒ}ƒ“ƒh ƒvƒƒ“ƒvƒg ƒEƒBƒ“ƒhƒE‚̃EƒBƒ“ƒhƒE ƒ^ƒCƒgƒ‹‚ðݒ肵‚Ü‚·B\n\
+TYPE ƒeƒLƒXƒg ƒtƒ@ƒCƒ‹‚Ü‚½‚̓tƒ@ƒCƒ‹‚Ì“à—e‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+VER ReactOS ‚̃o[ƒWƒ‡ƒ“‚ð•\\Ž¦‚µ‚Ü‚·B\n\
+VERIFY ƒtƒ@ƒCƒ‹‚ªƒfƒBƒXƒN‚ɳ‚µ‚‘‚«ž‚܂ꂽ‚±‚Æ‚ðƇ‚·‚é‚©‚Ç‚¤‚©‚ð\n\
+ ŽwŽ¦‚µ‚Ü‚·B\n\
+VOL ƒfƒBƒXƒN‚̃{ƒŠƒ…[ƒ€ ƒ‰ƒxƒ‹‚ƃVƒŠƒAƒ‹”Ô†‚ð•\\Ž¦‚µ‚Ü‚·B\n"
+
+
+STRING_CHOICE_OPTION, "YN"
+STRING_COPY_OPTION, "YNA"
+
+
+STRING_ALIAS_ERROR, "ƒGƒCƒŠƒAƒX“WŠJŒã‚̃Rƒ}ƒ“ƒh ƒ‰ƒCƒ“‚ª’·‚·‚¬‚Ü‚·!\n"
+STRING_BATCH_ERROR, "ƒoƒbƒ` ƒtƒ@ƒCƒ‹‚ðŠJ‚‚Æ‚«‚ɃGƒ‰[‚ª”¶‚µ‚Ü‚µ‚½B\n"
+STRING_CHCP_ERROR1, "Œ»Ý‚̃R[ƒh ƒy[ƒW: %u\n"
+STRING_CHCP_ERROR4, "–³Œø‚ȃR[ƒh ƒy[ƒW‚Å‚·\n"
+STRING_CHOICE_ERROR, "–³Œø‚ȃIƒvƒVƒ‡ƒ“‚Å‚·BŠú‘Ò‚³‚ê‚é‘Ž®: /C[:]ƒIƒvƒVƒ‡ƒ“"
+STRING_CHOICE_ERROR_TXT, "–³Œø‚ȃIƒvƒVƒ‡ƒ“‚Å‚·BŠú‘Ò‚³‚ê‚é‘Ž®: /T[:]c,nn"
+STRING_CHOICE_ERROR_OPTION, "–³Œø‚ȃIƒvƒVƒ‡ƒ“‚Å‚·: %s"
+STRING_CMD_ERROR1, "ƒtƒ@ƒCƒ‹ %s ‚©‚烊ƒ_ƒCƒŒƒNƒg“ü—Í‚Å‚«‚Ü‚¹‚ñB\n"
+STRING_CMD_ERROR2, "ƒf[ƒ^‚ðƒpƒCƒv‚·‚邽‚߂̈ꎞƒtƒ@ƒCƒ‹ì¬‚Ì‚Æ‚«‚ɃGƒ‰[‚ª”¶‚µ‚Ü‚µ‚½B\n"
+STRING_CMD_ERROR3, "ƒtƒ@ƒCƒ‹ %s ‚ւƃŠƒ_ƒCƒŒƒNƒg‚Å‚«‚Ü‚¹‚ñB\n"
+STRING_CMD_ERROR4, "%s ‚ðŽÀs‚µ‚Ä‚¢‚Ü‚·...\n"
+STRING_CMD_ERROR5, "cmdexit.bat ‚ðŽÀs‚µ‚Ä‚¢‚Ü‚·...\n"
+STRING_COLOR_ERROR1, "ƒGƒ‰[! “¯‚¶F‚ªŽw’肳‚ê‚Ü‚µ‚½B\n (‘OŒiF‚Æ”wŒiF‚𓯂¶F‚É‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñ)"
+STRING_COLOR_ERROR2, "F‚ÌŽw’è‚É–â‘肪‚ ‚è‚Ü‚·B"
+STRING_COLOR_ERROR3, "Color %x\n"
+STRING_COLOR_ERROR4, "ƒGƒ‰[! “¯‚¶F‚ªŽw’肳‚ê‚Ü‚µ‚½B"
+STRING_CONSOLE_ERROR, "•s–¾‚ȃGƒ‰[: %d\n"
+STRING_COPY_ERROR1, "ƒGƒ‰[: Œ³‚̃tƒ@ƒCƒ‹ %s ‚ðŠJ‚¯‚Ü‚¹‚ñ!\n"
+STRING_COPY_ERROR2, "ƒGƒ‰[: ƒRƒs[Œ³‚ƃRƒs[悪ˆê‚Å‚·!\n"
+STRING_COPY_ERROR3, "Žw’èæ‚Ö‚Ì‘‚«ž‚݂ŃGƒ‰[‚ª”¶‚µ‚Ü‚µ‚½!\n"
+STRING_COPY_ERROR4, "ƒGƒ‰[: ‚Ü‚¾ŽÀ‘•‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ!\n"
+STRING_DATE_ERROR, "–³Œø‚È“ú•t‚Å‚·B"
+STRING_DEL_ERROR5, "ƒtƒ@ƒCƒ‹ %s ‚Í휂³‚ê‚Ü‚·! "
+STRING_DEL_ERROR6, "‚æ‚낵‚¢‚Å‚·‚© (Y/N)?"
+STRING_DEL_ERROR7, "휂µ‚Ä‚¢‚Ü‚·: %s\n"
+STRING_ERROR_ERROR1, "•s–¾‚ȃGƒ‰[‚Å‚·! ƒGƒ‰[ ƒR[ƒh: 0x%lx\n"
+STRING_ERROR_ERROR2, "\\•¶ƒGƒ‰["
+STRING_FOR_ERROR1, "–½—ß•¶’†‚É 'in' ‚ª•s‘«‚µ‚Ä‚¢‚Ü‚·B"
+STRING_FOR_ERROR2, "Š‡ŒÊ‚ªŒ©‚‚©‚è‚Ü‚¹‚ñB"
+STRING_FOR_ERROR3, "'do' ‚ª•s‘«‚µ‚Ä‚¢‚Ü‚·B"
+STRING_FOR_ERROR4, "'do' ‚ÌŒã‚ɃRƒ}ƒ“ƒh‚ª‚ ‚è‚Ü‚¹‚ñB"
+STRING_FREE_ERROR1, "–³Œø‚ȃhƒ‰ƒCƒu‚Å‚·B"
+STRING_FREE_ERROR2, "ƒ‰ƒxƒ‹‚ª‚ ‚è‚Ü‚¹‚ñB"
+STRING_GOTO_ERROR1, "GOTO ‚Ƀ‰ƒxƒ‹‚ªŽw’肳‚ê‚Ä‚¢‚Ü‚¹‚ñB"
+STRING_GOTO_ERROR2, "ƒ‰ƒxƒ‹ '%s' ‚ªŒ©‚‚©‚è‚Ü‚¹‚ñ‚Å‚µ‚½B\n"
+
+STRING_MD_ERROR, "‚·‚łɃfƒBƒŒƒNƒgƒŠ“à‚ɃTƒuƒfƒBƒŒƒNƒgƒŠ‚©ƒtƒ@ƒCƒ‹‚ª‘¶Ý‚µ‚Ä‚¢‚Ü‚·B\n"
+STRING_MD_ERROR2, "V‚µ‚¢ƒtƒHƒ‹ƒ_‚ւ̃pƒX‚ª‘¶Ý‚µ‚Ä‚¢‚Ü‚¹‚ñB\n"
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[ƒGƒ‰[]\n"
+
+STRING_REN_ERROR1, "MoveFile() failed. ƒGƒ‰[: %lu\n"
+
+STRING_START_ERROR1, "Œ»Žž“_‚ł̓oƒbƒ`‚̓Tƒ|[ƒg‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ!"
+
+STRING_TIME_ERROR1, "–³Œø‚ÈŽž‚Å‚·B"
+
+STRING_TYPE_ERROR1, "'/%s' ‚Í–³Œø‚ȃIƒvƒVƒ‡ƒ“‚Å‚·\n"
+
+STRING_WINDOW_ERROR1, "ƒEƒBƒ“ƒhƒE‚ªŒ©‚‚©‚è‚Ü‚¹‚ñB"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "ƒpƒ‰ƒ[ƒ^‚Ì‘Ž®‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·B - %c\n"
+STRING_ERROR_INVALID_SWITCH, "–³Œø‚ȃXƒCƒbƒ`‚Å‚·B - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "ƒpƒ‰ƒ[ƒ^‚ª‘½‚·‚¬‚Ü‚·B - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "ƒpƒX‚ªŒ©‚‚©‚è‚Ü‚¹‚ñB\n"
+STRING_ERROR_FILE_NOT_FOUND, "ƒtƒ@ƒCƒ‹‚ªŒ©‚‚©‚è‚Ü‚¹‚ñB\n"
+STRING_ERROR_REQ_PARAM_MISSING, "•K—v‚ȃpƒ‰ƒ[ƒ^‚ª•s‘«‚µ‚Ä‚¢‚Ü‚·B\n"
+STRING_ERROR_INVALID_DRIVE, "–³Œø‚ȃhƒ‰ƒCƒuŽw’è‚Å‚·B\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "–³Œø‚ȃpƒ‰ƒ[ƒ^‚Ì‘Ž®‚Å‚·B - %s\n"
+STRING_ERROR_BADCOMMAND, "ƒRƒ}ƒ“ƒh‚Ü‚½‚̓tƒ@ƒCƒ‹–¼‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·B\n"
+STRING_ERROR_OUT_OF_MEMORY, "ƒƒ‚ƒŠ•s‘«ƒGƒ‰[B\n"
+STRING_ERROR_CANNOTPIPE, "ƒGƒ‰[! ƒpƒCƒv‚Å‚«‚Ü‚¹‚ñ! ˆêŽžƒtƒ@ƒCƒ‹‚ðŠJ‚¯‚Ü‚¹‚ñ!\n"
+STRING_ERROR_D_PAUSEMSG, "‘±s‚·‚é‚ɂ͉½‚©ƒL[‚ð‰Ÿ‚µ‚Ä‚‚¾‚³‚¢ . . ."
+STRING_ERROR_DRIVER_NOT_READY, "ƒhƒ‰ƒCƒu‚Ì€”õ‚ª‚Å‚«‚Ä‚¢‚Ü‚¹‚ñB"
+
+STRING_PATH_ERROR, "CMD: Not in environment '%s'\n"
+
+STRING_CMD_SHELLINFO, "\nReactOS Command Line Interpreter"
+STRING_VERSION_RUNVER, " running on %s"
+STRING_COPY_FILE , " %d ŒÂ‚̃tƒ@ƒCƒ‹‚ªƒRƒs[‚³‚ê‚Ü‚µ‚½\n"
+STRING_DELETE_WIPE, "Š®‘S‚ÉÁ‹Ž‚³‚ê‚Ü‚µ‚½B"
+STRING_FOR_ERROR, "–³Œø‚È•Ï”‚ªŽw’肳‚ê‚Ü‚µ‚½B"
+STRING_SCREEN_COL, "s‚Ì’l‚ª–³Œø‚Å‚·B"
+STRING_SCREEN_ROW, "—ñ‚Ì’l‚ª–³Œø‚Å‚·B"
+STRING_TIMER_TIME "ƒ^ƒCƒ}[ %d ‚Í %s ‚Å‚·B: "
+
+STRING_INVALID_OPERAND, "–³Œø‚ȃIƒyƒ‰ƒ“ƒh‚Å‚·B"
+STRING_EXPECTED_CLOSE_PAREN, "Expected ')'"
+STRING_EXPECTED_NUMBER_OR_VARIABLE,"Expected number or variable name."
+STRING_SYNTAX_COMMAND_INCORRECT, "ƒRƒ}ƒ“ƒh‚Ì\\•¶‚ªŠÔˆá‚Á‚Ä‚¢‚Ü‚·B"
+
+}
diff --git a/reactos/base/shell/cmd/Ru.rc b/reactos/base/shell/cmd/Ru.rc
new file mode 100644
index 00000000000..a4645b971fc
--- /dev/null
+++ b/reactos/base/shell/cmd/Ru.rc
@@ -0,0 +1,656 @@
+#include "windows.h"
+#include "resource.h"
+/*
+ * Russian language file by
+ * Andrey Korotaev (unC0Rr@inbox.ru)
+ * and
+ * Aleksey Bragin (aleksey@reactos.com)
+ * Copyright 2005
+ */
+
+
+LANGUAGE LANG_RUSSIAN, SUBLANG_NEUTRAL
+STRINGTABLE DISCARDABLE
+{
+
+STRING_ATTRIB_HELP, "Âûâîä è èçìåíåíèå àòðèáóòîâ ôàéëîâ.\n\n\
+ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] ôàéë ...\n\
+ [/S [/D]]\n\n\
+ + Óñòàíîâêà àòðèáóòà.\n\
+ - Ñíÿòèå àòðèáóòà.\n\
+ R Àòðèáóò ""Òîëüêî ÷òåíèå"".\n\
+ A Àòðèáóò ""Àðõèâíûé"".\n\
+ S Àòðèáóò ""Ñèñòåìíûé"".\n\
+ H Àòðèáóò ""Ñêðûòûé"".\n\
+ /S Îáðàáîòêà ôàéëîâ ñ óêàçàííûìè èìåíàìè â òåêóùåé ïàïêå\n\
+è âî âñåõ åå ïîäïàïêàõ.\n\
+ /D Îáðàáîòêà è ôàéëîâ, è ïàïîê.\n\n\
+ATTRIB áåç ïàðàìåòðîâ âûâîäèò àòðèáóòû âñåõ ôàéëîâ.\n"
+
+STRING_ALIAS_HELP, "Âûâîä, óñòàíîâêà èëè óäàëåíèå ïñåâäîíèìîâ.\n\n\
+ALIAS [ïñåâäîíèì=[êîìàíäà]]\n\n\
+ ïñåâäîíèì Íàèìåíîâàíèå ïñåâäîíèìà.\n\
+ êîìàíäà Òåêñò, ïîäñòàâëÿåìûé âìåñòî ïñåâäîíèìà.\n\n\
+Âûâîä ñïèñêà âñåõ ïñåâäîíèìîâ:\n\
+ ALIAS\n\n\
+Óñòàíîâêà èëè èçìåíåíèå ñóùåñòâóþùåãî ïñåâäîíèìà:\n\
+ ALIAS da=dir a:\n\n\
+Óäàëåíèå ïñåâäîíèìà èç ñïèñêà:\n\
+ ALIAS da="
+
+STRING_BEEP_HELP, "Çâóêîâîé ñèãíàë.\n\nBEEP\n"
+
+STRING_CALL_HELP, "Âûçîâ îäíîãî ïàêåòíîãî ôàéëà èç äðóãîãî.\n\n\
+CALL [äèñê:][ïóòü]èìÿ_ôàéëà [ïàðàìåòðû]\n\n\
+ ïàðàìåòðû Íàáîð ïàðàìåòðîâ êîìàíäíîé ñòðîêè, íåîáõîäèìûõ\n\
+ ïàêåòíîìó ôàéëó."
+
+STRING_CD_HELP, "Âûâîä èìåíè ëèáî ñìåíà òåêóùåãî êàòàëîãà.\n\n\
+CHDIR [/D][äèñê:][ïóòü]\n\
+CHDIR[..|.]\n\
+CD [/D][äèñê:][ïóòü]\n\
+CD[..|.]\n\n\
+ .. îáîçíà÷àåò ðîäèòåëüñêèé êàòàëîã\n\
+ . îáîçíà÷àåò òåêóùèé êàòàëîã\n\
+ /D Îäíîâðåìåííàÿ ñìåíà òåêóùèõ äèñêà è êàòàëîãà.\n\n\
+Êîìàíäà CD äèñê: îòîáðàæàåò èìÿ òåêóùåãî êàòàëîãà óêàçàííîãî äèñêà.\n\
+Êîìàíäà CD áåç ïàðàìåòðîâ îòîáðàæàåò èìåíà òåêóùèõ äèñêà è êàòàëîãà.\n"
+
+STRING_CHCP_HELP, "Âûâîä èëè ñìåíà òåêóùåãî íîìåðà êîäîâîé ñòðàíèöû.\n\n\
+CHCP [nnn]\n\n\
+ nnn Íîìåð êîäîâîé ñòðàíèöû.\n\n\
+Êîìàíäà CHCP áåç ïàðàìåòðà âûâîäèò òåêóùèé íîìåð êîäîâîé ñòðàíèöû.\n"
+
+STRING_CHOICE_HELP, "Æä¸ò, ïîêà ïîëüçîâàòåëü íå âûáåðåò îäèí èç óêàçàííûõ â ñïèñêå ñèìâîëîâ.\n\n\
+CHOICE [/C[:]ñïèñîê_ñèìâîëîâ][/N][/S][/T[:]c,nn][òåêñò]\n\n\
+ /C[:]ñïèñîê_ñèìâîëîâ Óêàçûâàåò äîïóñòèìûå ñèìâîëû. Ïî óìîë÷àíèþ ýòî YN.\n\
+ /N Íå âûâîäèòü ñïèñîê ñèìâîëîâ è ? ïîñëå ïîäñêàçêè.\n\
+ /S Òðàêòîâàòü ñèìâîëû êàê ÷óâñòâèòåëüíûå ê ðåãèñòðó.\n\
+ /T[:]c,nn Ïî óìîë÷àíèþ âûáîð c ïî èñòå÷åíèè nn ñåêóíä.\n\
+ text Ïîäñêàçêà.\n\n\
+ERRORLEVEL óñòàíàâëèâàåòñÿ ðàâíûì íîìåðó âûáðàííîãî ñèìâîëà.\n"
+
+STRING_CLS_HELP, "Î÷èñòêà ýêðàíà.\n\nCLS\n"
+
+STRING_CMD_HELP1, "\nÄîñòóïíûå âíóòðåííèå êîìàíäû:\n"
+
+STRING_CMD_HELP2, "\nÄîñòóïíûå âîçìîæíîñòè:"
+
+STRING_CMD_HELP3," [ïñåâäîíèìû]"
+
+STRING_CMD_HELP4," [èñòîðèÿ]"
+
+STRING_CMD_HELP5," [çàâåðøåíèå èìåí ôàéëîâ unix]"
+
+STRING_CMD_HELP6," [ñòåê äèðåêòîðèé]"
+
+STRING_CMD_HELP7," [ïåðåíàïðàâëåíèå è piping]"
+
+STRING_CMD_HELP8, "Çàïóñê íîâîé êîïèè èíòåðïðåòàòîðà êîìàíä ReactOS.\n\n\
+CMD [/[C|K] êîìàíäà][/P][/Q][/T:bf]\n\n\
+ /C êîìàíäà Âûïîëíåíèå óêàçàííîé êîìàíäû ñ ïîñëåäóþùèì çàâåðøåíèåì.\n\
+ /K êîìàíäà Âûïîëíåíèå óêàçàííîé êîìàíäû áåç ïîñëåäóþùåãî çàâåðøåíèÿ.\n\
+ /P CMD ñòàíîâèòñÿ ïåðìàíåíòíûì è çàïóñêàåò autoexec.bat\n\
+ (ïðîöåññ íåìîæåò áûòü çàâåðøåí).\n\
+ /T:öâ Âûáîð öâåòà òåêñòà/ôîíà (áîëåå ïîäðîáíî ñì. COLOR /?).\n"
+
+STRING_COLOR_HELP1, "Óñòàíîâêà öâåòîâ ïî óìîë÷àíèþ äëÿ òåêñòà è ôîíà.\n\n\
+COLOR [öâåòà [/-F]] \n\n\
+ öâåòà Àòðèáóòû öâåòîâ äëÿ òåêñòîâûõ îêîí\n\
+ /-F Íå çàëèâàòü íåçàïîëíåííûå ìåñòà öâåòîì\n\n\
+Åñòü òðè ñïîñîáà îáîçíà÷àòü öâåòà:\n\
+1) ïî íàçâàíèþ íà àíãëèéñêîì ÿçûêå (òðåáóþòñÿ òîëüêî ïåðâûå òðè áóêâû öâåòà)\n\
+2) â âèäå äåñÿòè÷íûõ ÷èñåë (decimal on decimal)\n\
+3) äâà øåñòíàäöàòåðè÷íûõ ÷èñëà\n\n\
+Òàáëèöà öâåòîâ:\n\
+äåñ. øåñò.íàçâàíèå äåñ. øåñò.íàçâàíèå\n\
+ 0 0 = ×åðíûé 8 8 = Ñåðûé\n\
+ 1 1 = Ñèíèé 9 9 = Ñâåòëî-ñèíèé\n\
+ 2 2 = Çåëåíûé 10 A = Ñâåòëî-çåëåíûé\n\
+ 3 3 = Ãîëóáîé 11 B = Ñâåòëî-ãîëóáîé\n\
+ 4 4 = Êðàñíûé 12 C = Ñâåòëî-êðàñíûé\n\
+ 5 5 = Ëèëîâûé 13 D = Ñâåòëî-ëèëîâûé\n\
+ 6 6 = Æåëòûé 14 E = Ñâåòëî-æåëòûé\n\
+ 7 7 = Áåëûé 15 F = ßðêî-áåëûé\n"
+
+STRING_COPY_HELP1, "Ïåðåçàïèñàòü %s (Yes/No/All)? "
+
+STRING_COPY_HELP2, "Êîïèðîâàíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ â äðóãîå ìåñòî.\n\n\
+COPY [/V][/Y|/-Y][/A|/B] èñòî÷íèê [/A|/B]\n\
+ [+ èñòî÷íèê [/A|/B] [+ ...]] [ðåçóëüòàò [/A|/B]]\n\n\
+ èñòî÷íèê Èìåíà îäíîãî èëè íåñêîëüêèõ êîïèðóåìûõ ôàéëîâ.\n\
+ /A Ôàéë ÿâëÿåòñÿ òåêñòîâûì ôàéëîì ASCII.\n\
+ /B Ôàéë ÿâëÿåòñÿ äâîè÷íûì ôàéëîì.\n\
+ ðåçóëüòàò Êàòàëîã è/èëè èìÿ äëÿ êîíå÷íûõ ôàéëîâ.\n\
+ /V Ïðîâåðêà ïðàâèëüíîñòè êîïèðîâàíèÿ ôàéëîâ.\n\
+ /Y Ïîäàâëåíèå çàïðîñà ïîäòâåðæäåíèÿ íà ïåðåçàïèñü ñóùåñòâóþùåãî\n\
+ ðåçóëüòèðóþùåãî ôàéëà.\n\
+ /-Y Îáÿçàòåëüíûé çàïðîñ ïîäòâåðæäåíèÿ íà ïåðåçàïèñü ñóùåñòâóþùåãî\n\
+ ðåçóëüòèðóþùåãî ôàéëà.\n\n\
+Êëþ÷ /Y ìîæíî óñòàíîâèòü ÷åðåç ïåðåìåííóþ ñðåäû COPYCMD.\n\
+...\n"
+
+STRING_DATE_HELP1, "\nÂâåäèòå íîâóþ äàòó (ìì%cää%cãããã): "
+
+STRING_DATE_HELP2, "\nÂâåäèòå íîâóþ äàòó (ää%cìì%cãããã): "
+
+STRING_DATE_HELP3, "\nÂâåäèòå íîâóþ äàòó (ãããã%cìì%cää): "
+
+STRING_DATE_HELP4, "Âûâîä èëè èçìåíåíèå äàòû.\n\n\
+DATE [/T][äàòà]\n\n\
+ /T Íå çàïðàøèâàòü ââîä íîâîé äàòû\n\n\
+Êîìàíäà DATE áåç ïàðàìåòðîâ îòîáðàæàåò òåêóùóþ äàòó è çàïðàøèâàåò ââîä\n\
+íîâîé äàòû. Äëÿ ñîõðàíåíèÿ òåêóùåé äàòû íàæìèòå êëàâèøó ENTER.\n"
+
+STRING_DEL_HELP1, "Óäàëåíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ.\n\n\
+DEL [/N /P /T /Q /S /W /Y /Z /A[[:]àòðèáóòû]] èìåíà_ôàéëîâ ...\n\
+DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]àòðèáóòû]] èìåíà_ôàéëîâ ...\n\
+ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]àòðèáóòû]] èìåíà_ôàéëîâ ...\n\n\
+ èìåíà_ôàéëîâ Èìåíà îäíîãî èëè íåñêîëüêèõ ôàéëîâ.\n\n\
+ /N Íåâûïîëíÿòü íåïîñðåäñòâåííî îïåðàöèþ óäàëåíèÿ ôàéëà.\n\
+ /P Çàïðîñ íà ïîäòâåðæäåíèå ïåðåä óäàëåíèåì êàæäîãî ôàéëà.\n\
+ /T Ïîêàçûâàåò êîëè÷åñòâî óäàë¸ííûõ ôàéëîâ è îñâîáîäèâøåãîñÿ\n\
+ äèñêîâîãî ïðîñòðàíñòâà.\n\
+ /Q Îòêëþ÷åíèå çàïðîñà íà ïîäòâåðæäåíèå ïðè óäàëåíèè ôàéëîâ.\n\
+ /W Ïåðåïèñàòü ôàéë ñëó÷àéíûìè äàííûìè ïåðåä óäàëåíèåì.\n\
+ /Y Îòêëþ÷åíèå çàïðîñà íà ïîäòâåðæäåíèå ïðè óäàëåíèè ôàéëîâ\n\
+ äàæå äëÿ ìàñêè *.*.\n\
+ /F Ïðèíóäèòåëüíîå óäàëåíèå ôàéëîâ, äîñòóïíûõ òîëüêî äëÿ ÷òåíèÿ.\n\
+ /S Óäàëÿòü ôàéë èç âñåõ ïîääèðåêòîðèé\n\
+ /A Îòáîð ôàéëîâ äëÿ óäàëåíèÿ ïî àòðèáóòàì.\n\
+ R Äîñòóïíûé òîëüêî äëÿ ÷òåíèÿ\n\
+ S Ñèñòåìíûå ôàéëû\n\
+ A Ôàéëû äëÿ àðõèâèðîâàíèÿ\n\
+ H Ñêðûòûå ôàéëû\n\
+ Ïðåôèêñ ""-"" èìååò çíà÷åíèå ÍÅ\n"
+
+STRING_DEL_HELP2, "Âñå ôàéëû â êàòàëîãå áóäóò óäàëåíû!\nÂû óâåðåíû (Y/N)?"
+STRING_DEL_HELP3, " %lu ôàéë óäàë¸í\n"
+STRING_DEL_HELP4, " %lu ôàéëîâ óäàëåíî\n"
+
+STRING_DELAY_HELP, "ïàóçà íà n ñåêóíä èëè ìèëëèñåêóíä\n\
+DELAY [/m]n\n\n\
+ /m óêàçûâàåò, ÷òî n îçíà÷àåò êîëè÷åñòâî ìèëëèñåêóíä\n\
+ èíà÷å n îçíà÷àåò êîëè÷åñòâî ñåêóíä\n"
+
+STRING_DIR_HELP1, "DIR [äèñê:][ïóòü][èìÿ_ôàéëà] [/A[[:]àòðèáóòû]] [/B] [/C] [/D] [/L] [/N]\n\
+ [/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]\n\n\
+ [äèñê:][ïóòü][èìÿ_ôàéëà]\n\
+ Äèñê, êàòàëîã è/èëè ôàéëû, êîòîðûå ñëåäóåò âêëþ÷èòü â ñïèñîê.\n\n\
+ /A Âûâîä ôàéëîâ ñ óêàçàííûìè àòðèáóòàìè.\n\
+ àòðèáóòû D Êàòàëîãè R Äîñòóïíûå òîëüêî äëÿ ÷òåíèÿ\n\
+ H Ñêðûòûå ôàéëû A Ôàéëû äëÿ àðõèâèðîâàíèÿ\n\
+ S Ñèñòåìíûå ôàéëû Ïðåôèêñ ""-"" èìååò çíà÷åíèå ÍÅ\n\
+ /B Âûâîä òîëüêî èìåí ôàéëîâ.\n\
+ /C Ïðèìåíåíèå ðàçäåëèòåëÿ ãðóïï ðàçðÿäîâ äëÿ âûâîäà ðàçìåðîâ ôàéëîâ\n\
+ (ïî óìîë÷àíèþ). Äëÿ îòêëþ÷åíèÿ ýòîãî ðåæèìà ñëóæèò êëþ÷ /-C.\n\
+ /D Âûâîä ñïèñêà â íåñêîëüêî ñòîëáöîâ ñ ñîðòèðîâêîé ïî ñòîëáöàì.\n\
+ /L Èñïîëüçîâàíèå íèæíåãî ðåãèñòðà äëÿ èìåí ôàéëîâ.\n\
+ /N Îòîáðàæåíèå èìåí ôàéëîâ â êðàéíåì ïðàâîì ñòîëáöå.\n\
+ /O Ñîðòèðîâêà ñïèñêà îòîáðàæàåìûõ ôàéëîâ.\n\
+ ïîðÿäîê N Ïî èìåíè (àëôàâèòíàÿ) S Ïî ðàçìåðó (ñïåðâà ìåíüøèå)\n\
+ E Ïî ðàñøèðåíèþ (àëôàâèòíàÿ) D Ïî äàòå (ñïåðâà áîëåå ñòàðûå)\n\
+ G Íà÷àòü ñïèñîê ñ êàòàëîãîâ Ïðåôèêñ ""-"" îáðàùàåò ïîðÿäîê\n\
+ /P Ïàóçà ïîñëå çàïîëíåíèÿ êàæäîãî ýêðàíà.\n\
+ /Q Âûâîä ñâåäåíèé î âëàäåëüöå ôàéëà.\n\
+ /S Âûâîä ñïèñêà ôàéëîâ èç óêàçàííîãî êàòàëîãà è åãî ïîäêàòàëîãîâ.\n\
+ /T Âûáîð ïîëÿ âðåìåíè äëÿ îòîáðàæåíèÿ è ñîðòèðîâêè\n\
+ âðåìÿ C Ñîçäàíèå\n\
+ A Ïîñëåäíåå èñïîëüçîâàíèå\n\
+ W Ïîñëåäíåå èçìåíåíèå\n\
+ /W Âûâîä ñïèñêà â íåñêîëüêî ñòîëáöîâ.\n\
+ /X Îòîáðàæåíèå êîðîòêèõ èìåí äëÿ ôàéëîâ, ÷üè èìåíà íå ñîîòâåòñòâóþò\n\
+ ñòàíäàðòó 8.3. Ôîðìàò àíàëîãè÷åí âûâîäó ñ êëþ÷îì /N, íî êîðîòêèå\n\
+ èìåíà ôàéëîâ âûâîäÿòñÿ ñëåâà îò äëèííûõ. Åñëè êîðîòêîãî èìåíè ó\n\
+ ôàéëà íåò, âìåñòî íåãî âûâîäÿòñÿ ïðîáåëû.\n\
+ /4 Âûâîä íîìåðà ãîäà â ÷åòûðåõçíà÷íîì ôîðìàòå\n"
+
+STRING_DIR_HELP2, " Òîì â óñòðîéñòâå %c èìååò ìåòêó %s\n"
+STRING_DIR_HELP3, " Òîì â óñòðîéñòâå %c íå èìååò ìåòêè.\n"
+STRING_DIR_HELP4, " Ñåðèéíûé íîìåð òîìà: %04X-%04X\n"
+STRING_DIR_HELP5, "\n Âñåãî:\n%16i Ôàéë(îâ)% 14s áàéò\n"
+STRING_DIR_HELP6, "%16i Dir(s)% 15s áàéò\n"
+STRING_DIR_HELP7, "\n Êàòàëîã of %s\n\n"
+STRING_DIR_HELP8, "%16i ôàéë(îâ)% 14s áàéò\n"
+
+STRING_DIRSTACK_HELP1, "Ñîõðàíÿåò òåêóùóþ äèðåêòîðèþ äëÿ èñïîëüçîâàíèÿ êîìàíäîé POPD, çàòåì\n\
+èçìåíÿåò å¸ íà óêàçàííóþ.\n\n\
+PUSHD [path | ..]\n\n\
+ path Óêàçûâàåò äèðåêòîðèþ, êîòîðóþ íàäî ñäåëàòü òåêóùåé\n"
+
+STRING_DIRSTACK_HELP2, "Èçìåíÿåò òåêóùóþ äèðåêòîðèþ íà òó, êîòîðàÿ ñîõðàíåíà êîìàíäîé PUSHD.\n\nPOPD"
+
+STRING_DIRSTACK_HELP3, "Ïå÷àòàåò ñîäåðæèìîå ñòåêà äèðåêòîðèé.\n\nDIRS"
+
+STRING_DIRSTACK_HELP4, "Ñòåê äèðåêòîðèé ïóñò"
+
+STRING_ECHO_HELP1, "Âûäàåò ñîîáùåíèå áåç ïåðåâîäà ñòðîêè.\n\n\
+ ECHOS message"
+
+STRING_ECHO_HELP2, "Âûäàåò ñîîáùåíèå â ñòàíäàðòíûé êàíàë âûâîäà îøèáîê.\n\n\
+ ECHOERR message\n\
+ ECHOERR. ïå÷àòàåò ïóñòóþ ñòðîêó"
+
+STRING_ECHO_HELP3, "Ïå÷àòàåò ñîîáùåíèå â ñòàíäàðòíûé êàíàë âûâîäà îøèáîê áåç ïåðåâîäà ñòðîêè è âîçâðàòà êàðåòêè.\n\n\
+ ECHOSERR message"
+
+STRING_ECHO_HELP4, "Âûâîä ñîîáùåíèé è ïåðåêëþ÷åíèå ðåæèìà îòîáðàæåíèÿ êîìàíä íà ýêðàíå.\n\n\
+ ECHO [ON | OFF]\n\
+ ECHO [ñîîáùåíèå]\n\
+ ECHO. âûâîä ïóñòîé ñòðîêè\n\n\
+ECHO áåç ïàðàìåòðà âûâîäèò òåêóùèé ðåæèì îòîáðàæåíèÿ êîìàíä."
+
+STRING_ECHO_HELP5, "ECHO is %s\n"
+
+STRING_EXIT_HELP, "Çàâåðøàåò èíòåðïðåòàòîð êîìàíä.\n\nEXIT\n"
+
+STRING_FOR_HELP1, "Çàïóñêàåò óêàçàííóþ êîìàíäó äëÿ êàæäîãî ôàéëà èç íàáîðà ôàéëîâ\n\n\
+FOR %ïåðåìåííàÿ IN (íàáîð) DO êîìàíäà [ïàðàìåòðû]\n\n\
+ %ïåðåìåííàÿ Ïîäñòàâëÿåìûé ïàðàìåòð.\n\
+ (íàáîð) Íàáîð èç îäíîãî èëè íåñêîëüêèõ ôàéëîâ.\n\
+ Äîïóñêàåòñÿ èñïîëüçîâàíèå ïîäñòàíîâî÷íûõ çíàêîâ.\n\
+ êîìàíäà Êîìàíäà, êîòîðóþ ñëåäóåò âûïîëíèòü äëÿ êàæäîãî ôàéëà.\n\
+ ïàðàìåòðû Ïàðàìåòðû è êëþ÷è äëÿ óêàçàííîé êîìàíäû.\n\n\
+Â ïàêåòíûõ ôàéëàõ äëÿ êîìàíäû FOR èñïîëüçóåòñÿ çàïèñü\n\
+%%ïåðåìåííàÿ âìåñòî %ïåðåìåííàÿ.\n"
+
+STRING_FREE_HELP1, "\nÒîì äèñêà %s: %-11s\n\
+ Ñåðèéíûé íîìåð: %s\n\
+ %16s áàéò îáùåãî äèñêîâîãî ïðîñòðàíñòâà\n\
+ %16s áàéò çàíÿòî\n\
+ %16s áàéò ñâîáîäíî\n"
+
+STRING_FREE_HELP2, "Âûâîäèò èíôîðìàöèþ î òîìå.\n\nFREE [drive: ...]\n"
+
+STRING_IF_HELP1, "Îïåðàòîð óñëîâíîãî âûïîëíåíèÿ êîìàíä â ïàêåòíîì ôàéëå.\n\n\
+ IF [NOT] ERRORLEVEL ÷èñëî êîìàíäà\n\
+ IF [NOT] ñòðîêà1==ñòðîêà2 êîìàíäà\n\
+ IF [NOT] EXIST èìÿ_ôàéëà êîìàíäà\n\
+ IF [NOT] DEFINED ïåðåìåííàÿ êîìàíäà\n\n\
+ NOT Îáðàùàåò èñòèííîñòü óñëîâèÿ: èñòèííîå óñëîâèå\n\
+ ñòàíîâèòñÿ ëîæíûì, à ëîæíîå - èñòèííûì.\n\
+ ERRORLEVEL ÷èñëî Óñëîâèå ÿâëÿåòñÿ èñòèííûì, åñëè êîä âîçâðàòà ïîñëåäíåé\n\
+ âûïîëíåííîé ïðîãðàììû íå ìåíüøå óêàçàííîãî ÷èñëà.\n\
+ ñòðîêà1==ñòðîêà2 Ýòî óñëîâèå ÿâëÿåòñÿ èñòèííûì, åñëè óêàçàííûå ñòðîêè\n\
+ ñîâïàäàþò.\n\
+ EXIST èìÿ_ôàéëà Ýòî óñëîâèå ÿâëÿåòñÿ èñòèííûì, åñëè ôàéë ñ óêàçàííûì\n\
+ èìåíåì ñóùåñòâóåò.\n\
+DEFINED ïåðåìåííàÿ Ýòî óñëîâèå ÿâëÿåòñÿ èñòèííûì, åñëè óêàçàííàÿ ïåðåìåííàÿ\n\
+ çàäàíà\n\
+ êîìàíäà Çàäàåò êîìàíäó, âûïîëíÿåìóþ ïðè èñòèííîñòè óñëîâèÿ.\n\
+ Çà ýòîé êîìàíäîé ìîæåò ñëåäîâàòü êëþ÷åâîå ñëîâî ELSE,\n\
+ ñëóæàùåå äëÿ óêàçàíèÿ êîìàíäû, êîòîðàÿ äîëæíà\n\
+ âûïîëíÿòüñÿ â òîì ñëó÷àå, åñëè óñëîâèå ëîæíî.\n"
+
+STRING_GOTO_HELP1, "Ïåðåäà÷à óïðàâëåíèÿ ñîäåðæàùåé ìåòêó ñòðîêå ïàêåòíîãî ôàéëà.\n\n\
+GOTO ìåòêà\n\n\
+ label Ñòðîêà ïàêåòíîãî ôàéëà, îôîðìëåííàÿ êàê ìåòêà.\n\n\
+Ìåòêà äîëæíà íàõîäèòüñÿ â îòäåëüíîé ñòðîêå è íà÷èíàòüñÿ ñ äâîåòî÷èÿ."
+
+STRING_LABEL_HELP1, "Ñîçäàíèå, èçìåíåíèå è óäàëåíèå ìåòîê òîìà.\n\nLABEL [äèñê:][ìåòêà]\n"
+
+STRING_LABEL_HELP2, "Òîì â óñòðîéñòâå %c èìååò ìåòêó %s\n"
+STRING_LABEL_HELP3, "Òîì â óñòðîéñòâå %c: íå èìååò ìåòêè\n"
+STRING_LABEL_HELP4, "Ñåðèéíûé íîìåð òîìà: %04X-%04X\n"
+STRING_LABEL_HELP5, "Ìåòêà òîìà (11 áóêâ, ÂÂÎÄ äëÿ ïóñòîé ìåòêè)? "
+
+STRING_LOCALE_HELP1, "Òåêóùåå âðåìÿ: "
+
+STRING_MKDIR_HELP, "Ñîçäàíèå êàòàëîãà.\n\n\
+MKDIR [äèñê:]ïóòü\nMD [äèñê:]ïóòü"
+
+STRING_MEMMORY_HELP1, "Âûâîä îáú¸ìà ñèñòåìíîé ïàìÿòè.\n\nMEMORY"
+
+STRING_MEMMORY_HELP2, "\n %12s%% memory load.\n\n\
+ %13s áàéò âñåãî ôèçè÷åñêîé ïàìÿòè.\n\
+ %13s áàéò äîñòóïíî ôèçè÷åñêîé ïàìÿòè.\n\n\
+ %13s áàéò âñåãî â ôàéëå ïîäêà÷êè.\n\
+ %13s áàéò äîñòóïíî â ôàéëå ïîäêà÷êè.\n\n\
+ %13s áàéò âñåãî âèðòóàëüíîé ïàìÿòè.\n\
+ %13s áàéò äîñòóïíî âèðòóàëüíî ïàìÿòè.\n"
+
+STRING_MISC_HELP1, "Íàæìèòå êëàâèøó äëÿ ïðîäîëæåíèÿ...\n"
+
+STRING_MOVE_HELP1, "Ïåðåïèñàòü %s (Yes/No/All)? "
+
+STRING_MOVE_HELP2, "Ïåðåìåùåíèå ôàéëîâ è ïåðåèìåíîâàíèå ôàéëîâ è êàòàëîãîâ.\n\n\
+Ïåðåìåùåíèå îäíîãî èëè áîëåå ôàéëîâ:\n\
+MOVE [/N][äèñê:][ïóòü]èìÿ_ôàéëà1[,...] íàçíà÷åíèå\n\n\
+Ïåðåèìåíîâàíèå êàòàëîãà:\n\
+MOVE [/N][äèñê:][ïóòü]èìÿ_êàòàëîãà1 èìÿ_êàòàëîãà2\n\n\
+ [äèñê:][ïóòü]èìÿ_ôàéëà1 Óêàçûâàåò ìåñòîïîëîæåíèå è èìÿ ôàéëà èëè ôàéëîâ\n\
+ êîòîðûå íåîáõîäèìî ïåðåìåñòèòü.\n\
+ /N Nothing. Do everything but move files or directories.\n\n\
+Òåêóùèå îãðàíè÷åíèÿ:\n\
+ - Íåâîçìîæíî ïåðåíîñèòü ôàéëû èëè ïàïêè ìåæäó ðàçíûìè ðàçäåëàìè.\n"
+
+STRING_MSGBOX_HELP, "Âûâîä îêíà ñ ñîîáùåíèåì è âîçâðàò îòâåòà ïîëüçîâàòåëÿ\n\n\
+MSGBOX òèï ['çàãîëîâîê'] ïîäñêàçêà\n\n\
+òèï âûâîäèìûå êíîïêè\n\
+ âîçìîæíûå çíà÷åíèÿ: OK, OKCANCEL,\n\
+ YESNO, YESNOCANCEL\n\
+çàãîëîâîê çàãîëîâîê îêíà ñ ñîîáùåíèåì\n\
+ïîäñêàçêà âûâîäèìûé òåêñò ïîäñêàçêè\n\n\n\
+ERRORLEVEL óñòàíàâëèâàåòñÿ â ñîîòâåòñòâèè ñ íàæàòîé êíîïêîé:\n\n\
+YES : 10 | NO : 11\n\
+OK : 10 | CANCEL : 12\n"
+
+STRING_PATH_HELP1, "Âûâîä èëè çàäàíèå ïóòè ïîèñêà èñïîëíÿåìûõ ôàéëîâ.\n\n\
+PATH [[äèñê:]ïóòü[;...]]\nPATH ;\n\n\
+Êîìàíäà PATH ; î÷èùàåò ïóòü ïîèñêà èñïîëüçóåìûõ ôàéëîâ, îãðàíè÷èâ åãî\n\
+òåêóùèì êàòàëîãîì.\n\
+Êîìàíäà PATH áåç ïàðàìåòðîâ îòîáðàæàåò òåêóùèé ïóòü ïîèñêà.\n"
+
+STRING_PROMPT_HELP1, "Èçìåíåíèå ïðèãëàøåíèÿ êîìàíäíîé ñòðîêè.\n\n\
+PROMPT [òåêñò]\n\n\
+ òåêñò Íîâîå ïðèãëàøåíèå êîìàíäíîé ñòðîêè.\n\n\
+Ïðèãëàøåíèå ìîæåò âêëþ÷àòü îáû÷íûå ñèìâîëû è ñëåäóþùèå êîäû:\n\n\
+ $A & (àìïåðñàíä)\n\
+ $B | (âåðòèêàëüíàÿ ÷åðòà)\n\
+ $C ( (ëåâàÿ êðóãëàÿ ñêîáêà)\n\
+ $D Òåêóùàÿ äàòà\n\
+ $E ESC (ñèìâîë ASCII ñ êîäîì 27)\n\
+ $F ) (ïðàâàÿ êðóãëàÿ ñêîáêà)\n\
+ $G > (çíàê ""áîëüøå"")\n\
+ $H BACKSPACE (óäàëåíèå ïðåäûäóùåãî ñèìâîëà)\n\
+ $L < (çíàê ""ìåíüøå"")\n\
+ $N Òåêóùèé äèñê\n\
+ $P Òåêóùèå äèñê è êàòàëîã\n\
+ $Q = (çíàê ðàâåíñòâà)\n\
+ $T Òåêóùåå âðåìÿ\n\
+ $V Íîìåð âåðñèè îïåðàöèîííîé ñèñòåìû\n\
+ $_ Ïåðåâîä ñòðîêè\n\
+ $$ $ (çíàê äîëëàðà)\n"
+
+STRING_PAUSE_HELP1, "Ïðèîñòàíîâêà âûïîëíåíèÿ ïàêåòíîãî ôàéëà è âûâîä ñîîáùåíèÿ:\n\
+'Äëÿ ïðîäîëæåíèÿ íàæìèòå ëþáóþ êëàâèøó...' èëè óêàçàííîå ñîîáùåíèå.\n\n\
+PAUSE [ñîîáùåíèå]"
+
+STRING_PROMPT_HELP2, " $+ Displays the current depth of the directory stack"
+
+STRING_PROMPT_HELP3, "\nPROMPT áåç ïàðàìåòðîâ óñòàíàâëèâàåò ïðèãëàøåíèå êîìàíäíîé ñòðîêè ïî óìîë÷àíèþ."
+
+STRING_REM_HELP, "Ïîìåùåíèå êîììåíòàðèåâ â ïàêåòíûå ôàéëû.\n\nREM [êîììåíòàðèé]"
+
+STRING_RMDIR_HELP, "Óäàëåíèå êàòàëîãà.\n\n\
+RMDIR [äèñê:]ïóòü\nRD [äèñê:]ïóòü\n\
+/S Óäàëåíèå äåðåâà êàòàëîãîâ\n\
+/Q Îòêëþ÷åíèå çàïðîñà ïîäòâåðæäåíèÿ\n"
+STRING_RMDIR_HELP2, "Êàòàëîã ïóñò!\n"
+
+STRING_REN_HELP1, "Ïåðåèìåíîâàíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ èëè êàòàëîãîâ.\n\n\
+RENAME [/E /N /P /Q /S /T] ñòàðîå_èìÿ ... íîâîå_èìÿ\n\
+REN [/E /N /P /Q /S /T] ñòàðîå_èìÿ ... íîâîå_èìÿ\n\n\
+ /E Íå âûâîäèòü ñîîáùåíèÿ îá îøèáêàõ.\n\
+ /N Nothing.\n\
+ /P Çàïðîñ ïîäòâåðæäåíèÿ ïåðåä ïåðåèìåíîâàíèåì.\n\
+ (Not implemented yet!)\n\
+ /Q Quiet.\n\
+ /S Ïåðåèìåíîâûâàòü ïîäêàòàëîãè.\n\
+ /T Âûâîä êîëè÷åñòâà ïåðåèìåíîâàííûõ ôàéëîâ.\n\n\
+Äëÿ êîíå÷íîãî ôàéëà íåëüçÿ óêàçàòü äðóãîé äèñê èëè êàòàëîã.\n\
+Äëÿ ýòîé öåëè ñëåäóåò èñïîëüçîâàòü êîìàíäó MOVE.\n"
+
+STRING_REN_HELP2, " %lu ôàéë ïåðåèìåíîâàí\n"
+
+STRING_REN_HELP3, " %lu ôàéëîâ ïåðåèìåíîâàíî\n"
+
+STRING_SHIFT_HELP, "Èçìåíåíèå ñîäåðæèìîãî (ñäâèã) ïîäñòàâëÿåìûõ ïàðàìåòðîâ äëÿ ïàêåòíîãî ôàéëà.\n\n\
+SHIFT [DOWN]"
+
+STRING_SCREEN_HELP, "Ïåðåìåùåíèå êóðñîðà è âûâîä òåêñòà\n\n\
+SCREEN ñòð êîë [òåêñò]\n\n\
+ ñòð ñòðîêà, íà êîòîðóþ ñëåäóåò ïåðåìåñòèòü êóðñîð\n\
+ êîë êîëîíêà, íà êîòîðóþ ñëåäóåò ïåðåìåñòèòü êóðñîð"
+
+STRING_SET_HELP, "Âûâîä, çàäàíèå è óäàëåíèå ïåðåìåííûõ ñðåäû.\n\n\
+SET [ïåðåìåííàÿ[=][çíà÷åíèå]]\n\n\
+ ïåðåìåííàÿ Èìÿ ïåðåìåííîé ñðåäû.\n\
+ çíà÷åíèå Ñòðîêà ñèìâîëîâ, ïðèñâàèâàåìàÿ óêàçàííîé ïåðåìåííîé.\n\n\
+SET áåç ïàðàìåòðîâ âûâîäèò òåêóùèå çíà÷åíèÿ ïåðåìåííûõ ñðåäû.\n"
+
+STRING_START_HELP1, "Çàïóñê óêàçàííîé ïðîãðàììû èëè êîìàíäû.\n\n\
+START êîìàíäà\n\n\
+ êîìàíäà Êîìàíäà èëè ïðîãðàììà äëÿ çàïóñêà.\n\n\
+At the moment all commands are started asynchronously.\n"
+
+STRING_TITLE_HELP, "Èçìåíåíèå çàãîëîâêà îêíà êîìàíäíîé ñòðîêè.\n\n\
+TITLE [ñòðîêà]\n\n\
+ñòðîêà Áóäóùèé çàãîëîâîê îêíà êîìàíäíîé ñòðîêè.\n"
+
+STRING_TIME_HELP1, "Âûâîä èëè èçìåíåíèå âðåìåíè.\n\n\
+TIME [/T][âðåìÿ]\n\n\
+ /T íå èçìåíÿòü âðåìÿ\n\n\
+TIME áåç ïàðàìåòðîâ âûâîäèò òåêóùåå âðåìÿ è çàïðàøèâàåò\n\
+íîâîå âðåìÿ. Íàæàòèå ENTER ñîõðàíÿåò òåêóùåå âðåìÿ.\n"
+
+STRING_TIME_HELP2, "Ââåäèòå íîâîå âðåìÿ: "
+
+STRING_TIMER_HELP1, "Ïðîøëî %d ìñåê\n"
+
+STRING_TIMER_HELP2, "Ïðîøëî %02d%c%02d%c%02d%c%02d\n"
+
+STRING_TIMER_HELP3, "Ñåêóíäîìåð.\n\n\
+TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\
+ ON Âêëþ÷èòü ñåêóíäîìåð\n\
+ OFF Âûêëþ÷èòü ñåêóíäîìåð\n\
+ /S Ðàçíèöà âðåìåíè. Âîçâðàùàåò ðàçíèöó âðåìåíè\n\
+ ñåêóíäîìåðà áåç èçìåíåíèÿ åãî çíà÷åíèÿ\n\
+ /n Çàäàòü íîìåð ñåêóíäîìåðà.\n\
+ Äîñòóïíûå íîìåðà - îò 0 äî 9\n\
+ Çíà÷åíèå ïî óìîë÷àíèþ - 1\n\
+ /Fn Ôîðìàò âûâîäà\n\
+ n îäíî èç:\n\
+ 0 ìèëëèñåêóíäû\n\
+ 1 ÷÷%cìì%cññ%cää\n\n\
+Åñëè íè îäèí èç ïàðàìåòðîâ íå óêàçàí, êîìàíäà\n\
+ïåðåêëþ÷àåò ñîñòîÿíèå ñåêóíäîìåðà\n\n"
+
+STRING_TYPE_HELP1, "Âûâîä ñîäåðæèìîãî îäíîãî èëè íåñêîëüêèõ òåêñòîâûõ ôàéëîâ.\n\nTYPE [äèñê:][ïóòü]èìÿ ôàéëà \n\
+ /P Ïîýêðàííûé âûâîä.\n"
+
+STRING_VERIFY_HELP1, "This command is just a dummy!!\n\
+Âêëþ÷åíèå èëè îòêëþ÷åíèå ðåæèìà ïðîâåðêè ïðàâèëüíîñòè çàïèñè ôàéëîâ a\n\
+íà äèñê.\n\n\
+VERIFY [ON | OFF]\n\n\
+VERIFY áåç ïàðàìåòðà âûâîäèò òåêóùåå çíà÷åíèå ýòîé êîìàíäû.\n"
+
+STRING_VERIFY_HELP2, "VERIFY %s.\n"
+
+STRING_VERIFY_HELP3, "Íåîáõîäèìî óêàçàòü ON èëè OFF."
+
+STRING_VERSION_HELP1, "Âûâîä âåðñèè\n\n\
+VER [/C][/R][/W]\n\n\
+ /C Displays credits.\n\
+ /R Displays redistribution information.\n\
+ /W Displays warranty information."
+
+STRING_VERSION_HELP2, " comes with ABSOLUTELY NO WARRANTY; for details\n\
+type: `ver /w'. This is free software, and you are welcome to redistribute\n\
+it under certain conditions; type `ver /r' for details. Type `ver /c' for a\n\
+listing of credits."
+
+STRING_VERSION_HELP3, "\n This program is distributed in the hope that it will be useful,\n\
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
+ GNU General Public License for more details."
+
+STRING_VERSION_HELP4, "\n This program is free software; you can redistribute it and/or modify\n\
+ it under the terms of the GNU General Public License as published by\n\
+ the Free Software Foundation; either version 2 of the License, or\n\
+ (at your option) any later version.\n"
+
+STRING_VERSION_HELP5, "\nÏîñûëàéòå îò÷åòû îá îøèáêàõ íà .\n\
+Îáíîâëåíèÿ äîñòóïíû ïî àäðåñó: http://www.reactos.org/"
+
+STRING_VERSION_HELP6, "\nFreeDOS-âåðñèÿ íàïèñàíà:\n"
+
+STRING_VERSION_HELP7, "\nReactOS-âåðñèÿ íàïèñàíà:\n"
+
+STRING_VOL_HELP1, " Òîì â óñòðîéñòâå %c: èìååò ìåòêó %s"
+STRING_VOL_HELP2, " Òîì â óñòðîéñòâå %c: íå èìååò ìåòêè"
+STRING_VOL_HELP3, " Ñåðèéíûé íîìåð òîìà: %04X-%04X\n"
+STRING_VOL_HELP4, "Âûâîäèò ìåòêó òîìà è ñåðèéíûé íîìåð.\n\nVOL [äèñê:]"
+
+STRING_WINDOW_HELP1, "Ìåíÿåò âèä îêíà êîíñîëè\n\n\
+WINDOW [/POS[=]left,top,øèðèíà,âûñîòà]\n\
+ [MIN|MAX|RESTORE] ['çàãîëîâîê']\n\n\
+/POS óêàçûâàåò ðàçìåð è ïîëîæåíèå îêíà\n\
+MIN ñâîðà÷èâàåò îêíî\n\
+MAX ðàçâîðà÷èâàåò îêíî\n\
+RESTORE âîññòàíàâëèâàåò îêíî\n"
+
+STRING_WINDOW_HELP2, "Ìåíÿåò âèä îêíà êîíñîëè\n\n\
+ACTIVATE 'window' [/POS[=]left,top,øèðèíà,âûñîòà]\n\
+ [MIN|MAX|RESTORE] ['çàãîëîâîê']\n\n\
+window çàãîëîâîê îêíà, âèä êîòîðîãî ñëåäóåò ìåíÿòü\n\
+/POS óêàçûâàåò ðàçìåð è ïîëîæåíèå îêíà\n\
+MIN ñâîðà÷èâàåò îêíî\n\
+MAX ðàçâîðà÷èâàåò îêíî\n\
+RESTORE âîññòàíàâëèâàåò îêíî\n\
+çàãîëîâîê íîâûé çàãîëîâîê\n"
+
+
+STRING_HELP1, "Ñïèñîê âñåõ äîñòóïíûõ êîìàíä ñ êîðîòêèì îïèñàíèåì\n\n\
+ êîìàíäà /? Âûâîäèò ïîäðîáíóþ èíôîðìàöèþ î êîìàíäå\n\n\
+? Ñïèñîê âñåõ äîñòóïíûõ êîìàíä áåç îïèñàíèÿ.\n\
+ALIAS Âûâîä, óñòàíîâêà èëè óäàëåíèå ïñåâäîíèìîâ.\n\
+ATTRIB Âûâîä è èçìåíåíèå àòðèáóòîâ ôàéëîâ.\n\
+BEEP Çâóêîâîé ñèãíàë.\n\
+CALL Âûçîâ îäíîãî ïàêåòíîãî ôàéëà èç äðóãîãî.\n\
+CD Âûâîä èìåíè ëèáî ñìåíà òåêóùåãî êàòàëîãà.\n\
+CHCP Âûâîä èëè ñìåíà òåêóùåãî íîìåðà êîäîâîé ñòðàíèöû.\n\
+CHOICE Æä¸ò, ïîêà ïîëüçîâàòåëü íå âûáåðåò îäèí èç óêàçàííûõ â ñïèñêå ñèìâîëîâ.\n\
+CLS Î÷èñòêà ýêðàíà.\n\
+CMD Çàïóñê íîâîé êîïèè èíòåðïðåòàòîðà êîìàíä.\n\
+COLOR Óñòàíîâêà öâåòîâ ïî óìîë÷àíèþ äëÿ òåêñòà è ôîíà.\n\
+COPY Êîïèðîâàíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ â äðóãîå ìåñòî.\n\
+DATE Âûâîä èëè èçìåíåíèå äàòû.\n\
+DELETE Óäàëåíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ.\n\
+DIR Âûâîä ñïèñêà ôàéëîâ è ïîäêàòàëîãîâ êàòàëîãà.\n\
+ECHO Âûâîä ñîîáùåíèé è ïåðåêëþ÷åíèå ðåæèìà îòîáðàæåíèÿ êîìàíä íà ýêðàíå.\n\
+ERASE Óäàëåíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ.\n\
+EXIT Çàâåðøàåò èíòåðïðåòàòîð êîìàíä.\n\
+FOR Çàïóñêàåò óêàçàííóþ êîìàíäó äëÿ êàæäîãî ôàéëà èç íàáîðà ôàéëîâ.\n\
+FREE (Ñâîáîäíîå) äèñêîâîå ïðîñòðàíñòâî.\n\
+GOTO Ïåðåäà÷à óïðàâëåíèÿ ñîäåðæàùåé ìåòêó ñòðîêå ïàêåòíîãî ôàéëà\n\
+HELP Ïðåäîñòàâëÿåò ñïðàâî÷íóþ èíôîðìàöèþ î êîìàíäàõ ReactOS.\n\
+HISTORY Ñïèñîê çàïóùåííûõ êîìàíä\n\
+IF Îïåðàòîð óñëîâíîãî âûïîëíåíèÿ êîìàíä â ïàêåòíîì ôàéëå.\n\
+LABEL Ñîçäàíèå, èçìåíåíèå è óäàëåíèå ìåòîê òîìà.\n\
+MD Ñîçäàíèå êàòàëîãà.\n\
+MKDIR Ñîçäàíèå êàòàëîãà.\n\
+MOVE Ïåðåìåùåíèå ôàéëîâ è ïåðåèìåíîâàíèå ôàéëîâ è êàòàëîãîâ\n\
+PATH Âûâîä èëè çàäàíèå ïóòè ïîèñêà èñïîëíÿåìûõ ôàéëîâ.\n\
+PAUSE Ïðèîñòàíîâêà âûïîëíåíèÿ ïàêåòíîãî ôàéëà.\n\
+POPD Âîñòòàíàâëèâàåò ïðåäûäóùåå çíà÷åíèå òåêóùåé äèðåêòîðèè ñîõðàíåííîå êîìàíäîé\n\
+ PUSHD.\n\
+PROMPT Èçìåíåíèå ïðèãëàøåíèÿ êîìàíäíîé ñòðîêè.\n\
+PUSHD Ñîõðàíÿåò òåêóùóþ äèðåêòîðèþ, à ïîòîì ìåíÿåò å¸.\n\
+RD Óäàëåíèå êàòàëîãà.\n\
+REM Çàïèñûâàåò êîììåíòàðèè (çàìå÷åíèÿ) â ïàêåòíûõ ôàéëàõ.\n\
+REN Ïåðåèìåíîâàíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ èëè êàòàëîãîâ.\n\
+RENAME Ïåðåèìåíîâàíèå îäíîãî èëè íåñêîëüêèõ ôàéëîâ èëè êàòàëîãîâ.\n\
+RMDIR Óäàëåíèå êàòàëîãà.\n\
+SCREEN Ïåðåìåùåíèå êóðñîðà è âûâîä òåêñòà.\n\
+SET Âûâîä, çàäàíèå è óäàëåíèå ïåðåìåííûõ ñðåäû.\n\
+SHIFT Èçìåíåíèå ñîäåðæèìîãî (ñäâèã) ïîäñòàâëÿåìûõ ïàðàìåòðîâ äëÿ ïàêåòíîãî ôàéëà\n"
+STRING_HELP2, "START Îòêðûâàåò îòäåëüíîå îêíî äëÿ çàïóñêà óêàçàííûõ êîìàíä èëè ïðîãðàìì.\n\
+ Âûïîëíÿåò êîìàíäó.\n\
+TIME Âûâîä èëè èçìåíåíèå âðåìåíè.\n\
+TIMER Ñåêóíäîìåð.\n\
+TITLE Èçìåíåíèå çàãîëîâêà îêíà êîìàíäíîé ñòðîêè.\n\
+TYPE Âûâîä ñîäåðæèìîãî îäíîãî èëè íåñêîëüêèõ òåêñòîâûõ ôàéëîâ.\n\
+VER Âûâîä âåðñèè ÎÑ.\n\
+VERIFY Âêëþ÷åíèå èëè îòêëþ÷åíèå ðåæèìà ïðîâåðêè ïðàâèëüíîñòè çàïèñè ôàéëîâ\n\
+ íà äèñê.\n\
+VOL Âûâîäèò ìåòêó òîìà è ñåðèéíûé íîìåð.\n"
+
+
+STRING_CHOICE_OPTION, "YN"
+STRING_COPY_OPTION, "YNA"
+
+
+STRING_ALIAS_ERROR, "Êîìàíäíàÿ ñòðîêà ñëèøêîì äëèííàÿ ïîñëå ðàçâ¸ðòûâàíèÿ ïñåâäîíèìîâ!\n"
+STRING_BATCH_ERROR, "Îøèáêà îòêðûòèÿ êîìàíäíîãî ôàéëà\n"
+STRING_CHCP_ERROR1, "Òåêóùàÿ êîäîâàÿ ñòðàíèöà: %u\n"
+STRING_CHCP_ERROR4, "Îøèáî÷íàÿ êîäîâàÿ ñòðàíèöà\n"
+STRING_CHOICE_ERROR, "Îøèáî÷íûé ïàðàìåòð. Îæèäàåòñÿ ôîðìàò: /C[:]ïàðàìåòðû"
+STRING_CHOICE_ERROR_TXT, "Îøèáî÷íûé ïàðàìåòð. Îæèäàåòñÿ ôîðìàò: /T[:]c,nn"
+STRING_CHOICE_ERROR_OPTION, "Îøèáî÷íûé ïàðàìåòð: %s"
+STRING_MD_ERROR, "Ïîäêàòàëîã èëè ôàéë óæå ñóùåñòâóåò.\n"
+STRING_MD_ERROR2, "Ïóòü ê íîâîìó êàòàëîãó íå ñóùåñòâóåò.\n"
+STRING_CMD_ERROR1, "Íå ìîãó ïåðåíàïðàâèòü ââîä èç ôàéëà %s\n"
+STRING_CMD_ERROR2, "Îøèáêà ñîçäàíèÿ âðåìåííîãî ôàéëà äëÿ pipe-äàííûõ\n"
+STRING_CMD_ERROR3, "Íå ìîãó ïåðåíàïðàâèòü â ôàéë %s\n"
+STRING_CMD_ERROR4, "Çàïóñê %s...\n"
+STRING_CMD_ERROR5, "Çàïóñê cmdexit.bat...\n"
+STRING_COLOR_ERROR1, "Îäèíàêîâûå öâåòà! (Öâåòà ôîíà è òåêñòà íå ìîãóò áûòü îäèíàêîâûìè)"
+STRING_COLOR_ERROR2, "îøèáêà â óêàçàíèè öâåòà"
+STRING_COLOR_ERROR3, "Öâåò %x\n"
+STRING_COLOR_ERROR4, "Îäèíàêîâûå öâåòà!"
+STRING_CONSOLE_ERROR, "Íåèçâåñòíàÿ îøèáêà: %d\n"
+STRING_COPY_ERROR1, "Îøèáêà: Íå ìîãó îòêðûòü èñòî÷íèê - %s!\n"
+STRING_COPY_ERROR2, "Îøèáêà: Íå ìîãó êîïèðîâàòü â ñåáÿ!\n"
+STRING_COPY_ERROR3, "Îøèáêà çàïèñè!\n"
+STRING_COPY_ERROR4, "Îøèáêà: Not implemented yet!\n"
+STRING_DATE_ERROR, "Íåïðàâèëüíàÿ äàòà."
+STRING_DEL_ERROR5, "Ôàéë %s áóäåò óäàë¸í! "
+STRING_DEL_ERROR6, "Âû óâåðåíû (Y/N)?"
+STRING_DEL_ERROR7, "Óäàëåíèå: %s\n"
+STRING_ERROR_ERROR1, "Íåèçâåñòíàÿ îøèáêà! Êîä îøèáêè: 0x%lx\n"
+STRING_ERROR_ERROR2, "Ñèíòàêñè÷åñêàÿ îøèáêà"
+STRING_FOR_ERROR1, "'in' îòñóòñòâóåò â êîìàíäå for."
+STRING_FOR_ERROR2, "ñêîáîê íåîáíàðóæåíî."
+STRING_FOR_ERROR3, "'do' îòñóòñâóåò."
+STRING_FOR_ERROR4, "íåò êîìàíäû ïîñëå 'do'."
+STRING_FREE_ERROR1, "Íåïðàâèëüíîå èìÿ äèñêà"
+STRING_FREE_ERROR2, "unlabeled"
+STRING_GOTO_ERROR1, "Íå îïðåäåëåíà ìåòêà äëÿ GOTO"
+STRING_GOTO_ERROR2, "Ìåòêà '%s' íå íàéäåíà\n"
+
+STRING_MOVE_ERROR1, "[OK]\n"
+STRING_MOVE_ERROR2, "[Îøèáêà]\n"
+
+STRING_REN_ERROR1, "Âûïîëíåíèå MoveFile() áûëî íåóñïåøíûì. Îøèáêà: %lu\n"
+
+STRING_START_ERROR1, "Íà äàííûé ìîìåíò íåò ïîääåðæêè ïàêåòíûõ ôàéëîâ!"
+
+STRING_TIME_ERROR1, "Íåïðàâèëüíîå âðåìÿ."
+
+STRING_TYPE_ERROR1, "Íåïðàâèëüíûé ïàðàìåòð '/%s'\n"
+
+STRING_WINDOW_ERROR1, "îêíî íå íàéäåíî"
+
+
+STRING_ERROR_PARAMETERF_ERROR, "Íåêîððåêòíûé ôîðìàò ïàðàìåòðà - %c\n"
+STRING_ERROR_INVALID_SWITCH, "Íåâåðíûàÿ îïöèÿ - /%c\n"
+STRING_ERROR_TOO_MANY_PARAMETERS, "Ñëèøêîì ìíîãî ïàðàìåòðîâ - %s\n"
+STRING_ERROR_PATH_NOT_FOUND, "Ïóòü íå íàéäåí\n"
+STRING_ERROR_FILE_NOT_FOUND, "Ôàéë íå íàéäåí\n"
+STRING_ERROR_REQ_PARAM_MISSING, "Îòñóòñòâóåò íåîáõîäèìûé ïàðàìåòð\n"
+STRING_ERROR_INVALID_DRIVE, "Îøèáî÷íîå îïðåäåëåíèå äèñêà\n"
+STRING_ERROR_INVALID_PARAM_FORMAT, "Îøèáî÷íûé ôîðìàò ïàðàìåòðà - %s\n"
+STRING_ERROR_BADCOMMAND, "Íåïðàâèëüíàÿ êîìàíäà èëè èìÿ ôàéëà\n"
+STRING_ERROR_OUT_OF_MEMORY, "Íåõâàòêà ïàìÿòè.\n"
+STRING_ERROR_CANNOTPIPE, "Îøèáêà! Íåâîçìîæíî èñïîëüçîâàòü pipe! Íåâîçìîæíî ñîçäàòü âðåìåííûé ôàéë!\n"
+STRING_ERROR_D_PAUSEMSG, "Äëÿ ïðîäîëæåíèÿ íàæìèòå ëþáóþ êëàâèøó . . ."
+STRING_ERROR_DRIVER_NOT_READY, "Óñòðîéñòâî íå ãîòîâî"
+
+STRING_PATH_ERROR, "CMD: Íå â ñðåäå îêðóæåíèÿ '%s'\n"
+
+STRING_CMD_SHELLINFO, "\nReactOS Command Line Interpreter"
+STRING_VERSION_RUNVER, " çàïóùåí íà %s"
+STRING_COPY_FILE , " %d ôàéë(îâ) ñêîïèðîâàíî\n"
+STRING_DELETE_WIPE, "wiped"
+STRING_FOR_ERROR, "íåïðàâèëüíîå çàäàíèå ïåðåìåííîé."
+STRING_SCREEN_COL, "íåïðàâèëüíîå çíà÷åíèå äëÿ êîë"
+STRING_SCREEN_ROW, "íåïðàâèëüíîå çíà÷åíèå äëÿ ñòð"
+STRING_TIMER_TIME "Timer %d is %s: "
+
+STRING_INVALID_OPERAND, "Íåâåðíûé îïåðàíä."
+STRING_EXPECTED_CLOSE_PAREN, "Îæèäàåòñÿ ')'."
+STRING_EXPECTED_NUMBER_OR_VARIABLE,"Îæèäàåòñÿ ÷èñëî èëè íàçâàíèå ïåðåìåííîé."
+STRING_SYNTAX_COMMAND_INCORRECT, "Íåêîððåêòíûé ñèíòàêñèñ êîìàíäû."
+
+}
diff --git a/reactos/base/shell/cmd/alias.c b/reactos/base/shell/cmd/alias.c
new file mode 100644
index 00000000000..a3aebd2cd68
--- /dev/null
+++ b/reactos/base/shell/cmd/alias.c
@@ -0,0 +1,344 @@
+/*
+ * ALIAS.C - alias administration module.
+ *
+ *
+ * History:
+ *
+ * 02/02/1996 (Oliver Mueller)
+ * started.
+ *
+ * 02/03/1996 (Oliver Mueller)
+ * Added sorting algorithm and case sensitive substitution by using
+ * partstrupr().
+ *
+ * 27 Jul 1998 John P. Price
+ * added config.h include
+ * added ifdef's to disable aliases
+ *
+ * 09-Dec-1998 (Eric Kohl )
+ * Fixed crash when removing an alias in DeleteAlias().
+ * Added help text ("/?").
+ *
+ * 14-Jan-1998 (Eric Kohl )
+ * Clean up and Unicode safe!
+ *
+ * 24-Jan-1998 (Eric Kohl )
+ * Redirection safe!
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+
+#include
+#include "resource.h"
+
+#ifdef FEATURE_ALIASES
+
+typedef struct tagALIAS
+{
+ struct tagALIAS *next;
+ LPTSTR lpName;
+ LPTSTR lpSubst;
+ DWORD dwUsed;
+} ALIAS, *LPALIAS;
+
+
+static LPALIAS lpFirst = NULL;
+static LPALIAS lpLast = NULL;
+static DWORD dwUsed = 0;
+
+
+/* module internal functions */
+/* strlwr only for first word in string */
+static VOID
+partstrlwr (LPTSTR str)
+{
+ LPTSTR c = str;
+ while (*c && !_istspace (*c) && *c != _T('='))
+ {
+ *c = _totlower (*c);
+ c++;
+ }
+}
+
+
+static VOID
+PrintAlias (VOID)
+{
+ LPALIAS ptr = lpFirst;
+ while (ptr)
+ {
+ ConOutPrintf (_T("%s=%s\n"), ptr->lpName, ptr->lpSubst);
+ ptr = ptr->next;
+ }
+}
+
+
+static VOID
+DeleteAlias (LPTSTR pszName)
+{
+ LPALIAS ptr = lpFirst;
+ LPALIAS prev = NULL;
+
+ while (ptr)
+ {
+ if (!_tcsicmp (ptr->lpName, pszName))
+ {
+ if (prev)
+ prev->next = ptr->next;
+ else
+ lpFirst = ptr->next;
+ free (ptr->lpName);
+ free (ptr->lpSubst);
+ free (ptr);
+ return;
+ }
+ prev = ptr;
+ ptr = ptr->next;
+ }
+}
+
+
+static VOID
+AddAlias (LPTSTR name, LPTSTR subst)
+{
+ LPALIAS ptr = lpFirst;
+ LPALIAS prev, entry;
+ LPTSTR s;
+
+ while (ptr)
+ {
+ if (!_tcsicmp (ptr->lpName, name))
+ {
+ s = (LPTSTR)malloc ((_tcslen (subst) + 1)*sizeof(TCHAR));
+ if (!s)
+ {
+ error_out_of_memory ();
+ return;
+ }
+
+ free (ptr->lpSubst);
+ ptr->lpSubst = s;
+ _tcscpy (ptr->lpSubst, subst);
+ return;
+ }
+ ptr = ptr->next;
+ }
+
+ ptr = (LPALIAS)malloc (sizeof (ALIAS));
+ if (!ptr)
+ return;
+
+ ptr->next = 0;
+
+ ptr->lpName = (LPTSTR)malloc ((_tcslen (name) + 1)*sizeof(TCHAR));
+ if (!ptr->lpName)
+ {
+ error_out_of_memory ();
+ free (ptr);
+ return;
+ }
+ _tcscpy (ptr->lpName, name);
+
+ ptr->lpSubst = (LPTSTR)malloc ((_tcslen (subst) + 1)*sizeof(TCHAR));
+ if (!ptr->lpSubst)
+ {
+ error_out_of_memory ();
+ free (ptr->lpName);
+ free (ptr);
+ return;
+ }
+ _tcscpy (ptr->lpSubst, subst);
+
+ /* it's necessary for recursive substitution */
+ partstrlwr (ptr->lpSubst);
+
+ ptr->dwUsed = 0;
+
+ /* Alias table must be sorted!
+ * Here a little example:
+ * command line = "ls -c"
+ * If the entries are
+ * ls=dir
+ * ls -c=ls /w
+ * command line will be expanded to "dir -c" which is not correct.
+ * If the entries are sortet as
+ * ls -c=ls /w
+ * ls=dir
+ * it will be expanded to "dir /w" which is a valid DOS command.
+ */
+ entry = lpFirst;
+ prev = 0;
+ while (entry)
+ {
+ if (_tcsicmp (ptr->lpName, entry->lpName) > 0)
+ {
+ if (prev)
+ {
+ prev->next = ptr;
+ ptr->next = entry;
+ }
+ else
+ {
+ ptr->next = entry;
+ lpFirst = ptr;
+ }
+ return;
+ }
+ prev = entry;
+ entry = entry->next;
+ }
+
+ /* The new entry is the smallest (or the first) and must be
+ * added to the end of the list.
+ */
+ if (!lpFirst)
+ lpFirst = ptr;
+ else
+ lpLast->next = ptr;
+ lpLast = ptr;
+
+ return;
+}
+
+
+VOID InitializeAlias (VOID)
+{
+ lpFirst = NULL;
+ lpLast = NULL;
+ dwUsed = 0;
+}
+
+VOID DestroyAlias (VOID)
+{
+ if (lpFirst == NULL)
+ return;
+
+ while (lpFirst->next != NULL)
+ {
+ lpLast = lpFirst;
+ lpFirst = lpLast->next;
+
+ free (lpLast->lpName);
+ free (lpLast->lpSubst);
+ free (lpLast);
+ }
+
+ free (lpFirst->lpName);
+ free (lpFirst->lpSubst);
+ free (lpFirst);
+
+ lpFirst = NULL;
+ lpLast = NULL;
+ dwUsed = 0;
+}
+
+/* specified routines */
+VOID ExpandAlias (LPTSTR cmd, INT maxlen)
+{
+ unsigned n = 0,
+ m,
+ i,
+ len;
+ short d = 1;
+ LPALIAS ptr = lpFirst;
+
+ dwUsed++;
+ if (dwUsed == 0)
+ {
+ while (ptr)
+ ptr->dwUsed = 0;
+ ptr = lpFirst;
+ dwUsed = 1;
+ }
+
+ /* skipping white spaces */
+ while (_istspace (cmd[n]))
+ n++;
+
+ partstrlwr (&cmd[n]);
+
+ if (!_tcsncmp (&cmd[n], _T("NOALIAS"), 7) &&
+ (_istspace (cmd[n + 7]) || cmd[n + 7] == _T('\0')))
+ {
+ memmove (cmd, &cmd[n + 7], (_tcslen (&cmd[n + 7]) + 1) * sizeof (TCHAR));
+ return;
+ }
+
+ /* substitution loop */
+ while (d)
+ {
+ d = 0;
+ while (ptr)
+ {
+ len = _tcslen (ptr->lpName);
+ if (!_tcsncmp (&cmd[n], ptr->lpName, len) &&
+ (_istspace (cmd[n + len]) || cmd[n + len] == _T('\0')) &&
+ ptr->dwUsed != dwUsed)
+ {
+ m = _tcslen (ptr->lpSubst);
+ if ((int)(_tcslen (cmd) - len + m - n) > maxlen)
+ {
+ ConErrResPuts(STRING_ALIAS_ERROR);
+
+ /* the parser won't cause any problems with an empty line */
+ cmd[0] = _T('\0');
+ }
+ else
+ {
+ memmove (&cmd[m], &cmd[n + len], (_tcslen(&cmd[n + len]) + 1) * sizeof (TCHAR));
+ for (i = 0; i < m; i++)
+ cmd[i] = ptr->lpSubst[i];
+ ptr->dwUsed = dwUsed;
+ /* whitespaces are removed! */
+ n = 0;
+ d = 1;
+ }
+ }
+ ptr = ptr->next;
+ }
+ }
+}
+
+
+INT CommandAlias (LPTSTR cmd, LPTSTR param)
+{
+ LPTSTR ptr;
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_ALIAS_HELP);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ if (param[0] == _T('\0'))
+ {
+ PrintAlias ();
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ /* error if no '=' found */
+ if ((ptr = _tcschr (param, _T('='))) == 0)
+ {
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /* Split rest into name and substitute */
+ *ptr++ = _T('\0');
+
+ partstrlwr (param);
+
+ if (ptr[0] == _T('\0'))
+ DeleteAlias (param);
+ else
+ AddAlias (param, ptr);
+
+ return 0;
+}
+#endif
diff --git a/reactos/base/shell/cmd/attrib.c b/reactos/base/shell/cmd/attrib.c
new file mode 100644
index 00000000000..d5deefee8c8
--- /dev/null
+++ b/reactos/base/shell/cmd/attrib.c
@@ -0,0 +1,346 @@
+/*
+ * ATTRIB.C - attrib internal command.
+ *
+ *
+ * History:
+ *
+ * 04-Dec-1998 (Eric Kohl )
+ * started
+ *
+ * 09-Dec-1998 (Eric Kohl )
+ * implementation works, except recursion ("attrib /s").
+ *
+ * 05-Jan-1999 (Eric Kohl )
+ * major rewrite.
+ * fixed recursion ("attrib /s").
+ * started directory support ("attrib /s /d").
+ * updated help text.
+ *
+ * 14-Jan-1999 (Eric Kohl )
+ * Unicode ready!
+ *
+ * 19-Jan-1999 (Eric Kohl )
+ * Redirection ready!
+ *
+ * 21-Jan-1999 (Eric Kohl )
+ * Added check for invalid filenames.
+ *
+ * 23-Jan-1999 (Eric Kohl )
+ * Added handling of multiple filenames.
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_ATTRIB
+
+
+static VOID
+PrintAttribute (LPTSTR pszPath, LPTSTR pszFile, BOOL bRecurse)
+{
+ WIN32_FIND_DATA findData;
+ HANDLE hFind;
+ TCHAR szFullName[MAX_PATH];
+ LPTSTR pszFileName;
+
+ /* prepare full file name buffer */
+ _tcscpy (szFullName, pszPath);
+ pszFileName = szFullName + _tcslen (szFullName);
+
+ /* display all subdirectories */
+ if (bRecurse)
+ {
+ /* append file name */
+ _tcscpy (pszFileName, pszFile);
+
+ hFind = FindFirstFile (szFullName, &findData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ {
+ ErrorMessage (GetLastError (), pszFile);
+ return;
+ }
+
+ do
+ {
+ if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ continue;
+
+ if (!_tcscmp (findData.cFileName, _T(".")) ||
+ !_tcscmp (findData.cFileName, _T("..")))
+ continue;
+
+ _tcscpy (pszFileName, findData.cFileName);
+ _tcscat (pszFileName, _T("\\"));
+ PrintAttribute (szFullName, pszFile, bRecurse);
+ }
+ while (FindNextFile (hFind, &findData));
+ FindClose (hFind);
+ }
+
+ /* append file name */
+ _tcscpy (pszFileName, pszFile);
+
+ /* display current directory */
+ hFind = FindFirstFile (szFullName, &findData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ {
+ ErrorMessage (GetLastError (), pszFile);
+ return;
+ }
+
+ do
+ {
+ if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ _tcscpy (pszFileName, findData.cFileName);
+
+ ConOutPrintf (_T("%c %c%c%c %s\n"),
+ (findData.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) ? _T('A') : _T(' '),
+ (findData.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM) ? _T('S') : _T(' '),
+ (findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) ? _T('H') : _T(' '),
+ (findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? _T('R') : _T(' '),
+ szFullName);
+ }
+ while (FindNextFile (hFind, &findData));
+ FindClose (hFind);
+}
+
+
+static VOID
+ChangeAttribute (LPTSTR pszPath, LPTSTR pszFile, DWORD dwMask,
+ DWORD dwAttrib, BOOL bRecurse, BOOL bDirectories)
+{
+ WIN32_FIND_DATA findData;
+ HANDLE hFind;
+ DWORD dwAttribute;
+ TCHAR szFullName[MAX_PATH];
+ LPTSTR pszFileName;
+
+
+ /* prepare full file name buffer */
+ _tcscpy (szFullName, pszPath);
+ pszFileName = szFullName + _tcslen (szFullName);
+
+ /* change all subdirectories */
+ if (bRecurse)
+ {
+ /* append file name */
+ _tcscpy (pszFileName, _T("*.*"));
+
+ hFind = FindFirstFile (szFullName, &findData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ {
+ ErrorMessage (GetLastError (), pszFile);
+ nErrorLevel = 1;
+ return;
+ }
+
+ do
+ {
+ if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ if (!_tcscmp (findData.cFileName, _T(".")) ||
+ !_tcscmp (findData.cFileName, _T("..")))
+ continue;
+
+ _tcscpy (pszFileName, findData.cFileName);
+ _tcscat (pszFileName, _T("\\"));
+
+ ChangeAttribute (szFullName, pszFile, dwMask,
+ dwAttrib, bRecurse, bDirectories);
+ }
+ }
+ while (FindNextFile (hFind, &findData));
+ FindClose (hFind);
+ }
+
+ /* append file name */
+ _tcscpy (pszFileName, pszFile);
+
+ hFind = FindFirstFile (szFullName, &findData);
+ if (hFind == INVALID_HANDLE_VALUE)
+ {
+ ErrorMessage (GetLastError (), pszFile);
+ nErrorLevel = 1;
+ return;
+ }
+
+ do
+ {
+ if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ _tcscpy (pszFileName, findData.cFileName);
+
+ dwAttribute = GetFileAttributes (szFullName);
+
+ if (dwAttribute != 0xFFFFFFFF)
+ {
+ dwAttribute = (dwAttribute & ~dwMask) | dwAttrib;
+ SetFileAttributes (szFullName, dwAttribute);
+ }
+ }
+ while (FindNextFile (hFind, &findData));
+ FindClose (hFind);
+}
+
+
+INT CommandAttrib (LPTSTR cmd, LPTSTR param)
+{
+ LPTSTR *arg;
+ INT argc, i;
+ TCHAR szPath[MAX_PATH];
+ TCHAR szFileName [MAX_PATH];
+ BOOL bRecurse = FALSE;
+ BOOL bDirectories = FALSE;
+ DWORD dwAttrib = 0;
+ DWORD dwMask = 0;
+
+ /* initialize strings */
+ szPath[0] = _T('\0');
+ szFileName[0] = _T('\0');
+
+ /* print help */
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_ATTRIB_HELP);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ /* build parameter array */
+ arg = split (param, &argc, FALSE);
+
+ /* check for options */
+ for (i = 0; i < argc; i++)
+ {
+ if (_tcsicmp (arg[i], _T("/s")) == 0)
+ bRecurse = TRUE;
+ else if (_tcsicmp (arg[i], _T("/d")) == 0)
+ bDirectories = TRUE;
+ }
+
+ /* create attributes and mask */
+ for (i = 0; i < argc; i++)
+ {
+ if (*arg[i] == _T('+'))
+ {
+ if (_tcslen (arg[i]) != 2)
+ {
+ error_invalid_parameter_format (arg[i]);
+ freep (arg);
+ return -1;
+ }
+
+ switch ((TCHAR)_totupper (arg[i][1]))
+ {
+ case _T('A'):
+ dwMask |= FILE_ATTRIBUTE_ARCHIVE;
+ dwAttrib |= FILE_ATTRIBUTE_ARCHIVE;
+ break;
+
+ case _T('H'):
+ dwMask |= FILE_ATTRIBUTE_HIDDEN;
+ dwAttrib |= FILE_ATTRIBUTE_HIDDEN;
+ break;
+
+ case _T('R'):
+ dwMask |= FILE_ATTRIBUTE_READONLY;
+ dwAttrib |= FILE_ATTRIBUTE_READONLY;
+ break;
+
+ case _T('S'):
+ dwMask |= FILE_ATTRIBUTE_SYSTEM;
+ dwAttrib |= FILE_ATTRIBUTE_SYSTEM;
+ break;
+
+ default:
+ error_invalid_parameter_format (arg[i]);
+ freep (arg);
+ return -1;
+ }
+ }
+ else if (*arg[i] == _T('-'))
+ {
+ if (_tcslen (arg[i]) != 2)
+ {
+ error_invalid_parameter_format (arg[i]);
+ freep (arg);
+ return -1;
+ }
+
+ switch ((TCHAR)_totupper (arg[i][1]))
+ {
+ case _T('A'):
+ dwMask |= FILE_ATTRIBUTE_ARCHIVE;
+ dwAttrib &= ~FILE_ATTRIBUTE_ARCHIVE;
+ break;
+
+ case _T('H'):
+ dwMask |= FILE_ATTRIBUTE_HIDDEN;
+ dwAttrib &= ~FILE_ATTRIBUTE_HIDDEN;
+ break;
+
+ case _T('R'):
+ dwMask |= FILE_ATTRIBUTE_READONLY;
+ dwAttrib &= ~FILE_ATTRIBUTE_READONLY;
+ break;
+
+ case _T('S'):
+ dwMask |= FILE_ATTRIBUTE_SYSTEM;
+ dwAttrib &= ~FILE_ATTRIBUTE_SYSTEM;
+ break;
+
+ default:
+ error_invalid_parameter_format (arg[i]);
+ freep (arg);
+ return -1;
+ }
+ }
+ }
+
+ if (argc == 0)
+ {
+ DWORD len;
+
+ len = GetCurrentDirectory (MAX_PATH, szPath);
+ if (szPath[len-1] != _T('\\'))
+ {
+ szPath[len] = _T('\\');
+ szPath[len + 1] = 0;
+ }
+ _tcscpy (szFileName, _T("*.*"));
+ PrintAttribute (szPath, szFileName, bRecurse);
+ freep (arg);
+ return 0;
+ }
+
+ /* get full file name */
+ for (i = 0; i < argc; i++)
+ {
+ if ((*arg[i] != _T('+')) && (*arg[i] != _T('-')) && (*arg[i] != _T('/')))
+ {
+ LPTSTR p;
+ GetFullPathName (arg[i], MAX_PATH, szPath, NULL);
+ p = _tcsrchr (szPath, _T('\\')) + 1;
+ _tcscpy (szFileName, p);
+ *p = _T('\0');
+
+ if (dwMask == 0)
+ PrintAttribute (szPath, szFileName, bRecurse);
+ else
+ ChangeAttribute (szPath, szFileName, dwMask,
+ dwAttrib, bRecurse, bDirectories);
+ }
+ }
+
+ freep (arg);
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_ATTRIB */
diff --git a/reactos/base/shell/cmd/batch.c b/reactos/base/shell/cmd/batch.c
new file mode 100644
index 00000000000..f15547ccc32
--- /dev/null
+++ b/reactos/base/shell/cmd/batch.c
@@ -0,0 +1,459 @@
+/*
+ * BATCH.C - batch file processor for CMD.EXE.
+ *
+ *
+ * History:
+ *
+ * ??/??/?? (Evan Jeffrey)
+ * started.
+ *
+ * 15 Jul 1995 (Tim Norman)
+ * modes and bugfixes.
+ *
+ * 08 Aug 1995 (Matt Rains)
+ * i have cleaned up the source code. changes now bring this
+ * source into guidelines for recommended programming practice.
+ *
+ * i have added some constants to help making changes easier.
+ *
+ * 29 Jan 1996 (Steffan Kaiser)
+ * made a few cosmetic changes
+ *
+ * 05 Feb 1996 (Tim Norman)
+ * changed to comply with new first/rest calling scheme
+ *
+ * 14 Jun 1997 (Steffen Kaiser)
+ * bug fixes. added error level expansion %?. ctrl-break handling
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * Totally reorganised in conjunction with COMMAND.C (cf) to
+ * implement proper BATCH file nesting and other improvements.
+ *
+ * 16 Jul 1998 (John P Price )
+ * Seperated commands into individual files.
+ *
+ * 19 Jul 1998 (Hans B Pufal) [HBP_001]
+ * Preserve state of echo flag across batch calls.
+ *
+ * 19 Jul 1998 (Hans B Pufal) [HBP_002]
+ * Implementation of FOR command
+ *
+ * 20-Jul-1998 (John P Price )
+ * added error checking after malloc calls
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 02-Aug-1998 (Hans B Pufal) [HBP_003]
+ * Fixed bug in ECHO flag restoration at exit from batch file
+ *
+ * 26-Jan-1999 (Eric Kohl )
+ * Replaced CRT io functions by Win32 io functions.
+ * Unicode safe!
+ *
+ * 23-Feb-2001 (Carl Nettelblad )
+ * Fixes made to get "for" working.
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+/* The stack of current batch contexts.
+ * NULL when no batch is active
+ */
+LPBATCH_CONTEXT bc = NULL;
+
+BOOL bEcho = TRUE; /* The echo flag */
+
+
+
+/* Buffer for reading Batch file lines */
+TCHAR textline[BATCH_BUFFSIZE];
+
+
+/*
+ * Returns a pointer to the n'th parameter of the current batch file.
+ * If no such parameter exists returns pointer to empty string.
+ * If no batch file is current, returns NULL
+ *
+ */
+
+LPTSTR FindArg (INT n)
+{
+ LPTSTR pp;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("FindArg: (%d)\n"), n);
+#endif
+
+ if (bc == NULL)
+ return NULL;
+
+ n += bc->shiftlevel;
+ pp = bc->params;
+
+ /* Step up the strings till we reach the end */
+ /* or the one we want */
+ while (*pp && n--)
+ pp += _tcslen (pp) + 1;
+
+ return pp;
+}
+
+
+/*
+ * Batch_params builds a parameter list in newlay allocated memory.
+ * The parameters consist of null terminated strings with a final
+ * NULL character signalling the end of the parameters.
+ *
+*/
+
+LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
+{
+ LPTSTR dp = (LPTSTR)malloc ((_tcslen(s1) + _tcslen(s2) + 3) * sizeof (TCHAR));
+
+ /* JPP 20-Jul-1998 added error checking */
+ if (dp == NULL)
+ {
+ error_out_of_memory();
+ return NULL;
+ }
+
+ if (s1 && *s1)
+ {
+ s1 = _stpcpy (dp, s1);
+ *s1++ = _T('\0');
+ }
+ else
+ s1 = dp;
+
+ while (*s2)
+ {
+ if (_istspace (*s2) || _tcschr (_T(",;"), *s2))
+ {
+ *s1++ = _T('\0');
+ s2++;
+ while (*s2 && _tcschr (_T(" ,;"), *s2))
+ s2++;
+ continue;
+ }
+
+ if ((*s2 == _T('"')) || (*s2 == _T('\'')))
+ {
+ TCHAR st = *s2;
+
+ do
+ *s1++ = *s2++;
+ while (*s2 && (*s2 != st));
+ }
+
+ *s1++ = *s2++;
+ }
+
+ *s1++ = _T('\0');
+ *s1 = _T('\0');
+
+ return dp;
+}
+
+
+/*
+ * If a batch file is current, exits it, freeing the context block and
+ * chaining back to the previous one.
+ *
+ * If no new batch context is found, sets ECHO back ON.
+ *
+ * If the parameter is non-null or not empty, it is printed as an exit
+ * message
+ */
+
+VOID ExitBatch (LPTSTR msg)
+{
+#ifdef _DEBUG
+ DebugPrintf (_T("ExitBatch: (\'%s\')\n"), msg);
+#endif
+
+ if (bc != NULL)
+ {
+ LPBATCH_CONTEXT t = bc;
+
+ if (bc->hBatchFile)
+ {
+ CloseHandle (bc->hBatchFile);
+ bc->hBatchFile = INVALID_HANDLE_VALUE;
+ }
+
+ if (bc->params)
+ free(bc->params);
+
+ if (bc->forproto)
+ free(bc->forproto);
+
+ if (bc->ffind)
+ free(bc->ffind);
+
+ /* Preserve echo state across batch calls */
+ bEcho = bc->bEcho;
+
+ bc = bc->prev;
+ free(t);
+ }
+
+ if (msg && *msg)
+ ConOutPrintf (_T("%s\n"), msg);
+}
+
+
+/*
+ * Start batch file execution
+ *
+ * The firstword parameter is the full filename of the batch file.
+ *
+ */
+
+BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
+{
+ HANDLE hFile;
+ SetLastError(0);
+ hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL |
+ FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
+ fullname, firstword, param, hFile);
+#endif
+
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ ConErrResPuts(STRING_BATCH_ERROR);
+ return FALSE;
+ }
+
+ /* Kill any and all FOR contexts */
+ while (bc && bc->forvar)
+ ExitBatch (NULL);
+
+ if (bc == NULL)
+ {
+ /* No curent batch file, create a new context */
+ LPBATCH_CONTEXT n = (LPBATCH_CONTEXT)malloc (sizeof(BATCH_CONTEXT));
+
+ if (n == NULL)
+ {
+ error_out_of_memory ();
+ return FALSE;
+ }
+
+ n->prev = bc;
+ bc = n;
+ bc->In[0] = _T('\0');
+ bc->Out[0] = _T('\0');
+ bc->Err[0] = _T('\0');
+ }
+ else if (bc->hBatchFile != INVALID_HANDLE_VALUE)
+ {
+ /* Then we are transferring to another batch */
+ CloseHandle (bc->hBatchFile);
+ bc->hBatchFile = INVALID_HANDLE_VALUE;
+ free (bc->params);
+ }
+
+ bc->hBatchFile = hFile;
+ SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN);
+ bc->bEcho = bEcho; /* Preserve echo across batch calls */
+ bc->shiftlevel = 0;
+
+ bc->ffind = NULL;
+ bc->forvar = _T('\0');
+ bc->forproto = NULL;
+ bc->params = BatchParams (firstword, param);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("Batch: returns TRUE\n"));
+#endif
+
+ return TRUE;
+}
+
+VOID AddBatchRedirection(TCHAR * ifn, TCHAR * ofn, TCHAR * efn)
+{
+ if(!bc)
+ return;
+ if(_tcslen(ifn))
+ _tcscpy(bc->In,ifn);
+ if(_tcslen(ofn))
+ _tcscpy(bc->Out,ofn);
+ if(_tcslen(efn))
+ _tcscpy(bc->Err,efn);
+
+}
+
+/*
+ * Read and return the next executable line form the current batch file
+ *
+ * If no batch file is current or no further executable lines are found
+ * return NULL.
+ *
+ * Here we also look out for FOR bcontext structures which trigger the
+ * FOR expansion code.
+ *
+ * Set eflag to 0 if line is not to be echoed else 1
+ */
+
+LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
+{
+ LPTSTR first;
+ LPTSTR ip;
+
+ /* No batch */
+ if (bc == NULL)
+ return NULL;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("ReadBatchLine ()\n"));
+#endif
+
+ while (1)
+ {
+ /* User halt */
+ if (CheckCtrlBreak (BREAK_BATCHFILE))
+ {
+ while (bc)
+ ExitBatch (NULL);
+ return NULL;
+ }
+
+ /* No batch */
+ if (bc == NULL)
+ return NULL;
+
+ /* If its a FOR context... */
+ if (bc->forvar)
+ {
+ LPTSTR sp = bc->forproto; /* pointer to prototype command */
+ LPTSTR dp = textline; /* Place to expand protoype */
+ LPTSTR fv = FindArg (0); /* Next list element */
+
+ /* End of list so... */
+ if ((fv == NULL) || (*fv == _T('\0')))
+ {
+ /* just exit this context */
+ ExitBatch (NULL);
+ continue;
+ }
+
+ if (_tcscspn (fv, _T("?*")) == _tcslen (fv))
+ {
+ /* element is wild file */
+ bc->shiftlevel++; /* No use it and shift list */
+ }
+ else
+ {
+ /* Wild file spec, find first (or next) file name */
+ if (bc->ffind)
+ {
+ /* First already done so do next */
+
+ fv = FindNextFile (bc->hFind, bc->ffind) ? bc->ffind->cFileName : NULL;
+ }
+ else
+ {
+ /* For first find, allocate a find first block */
+ if ((bc->ffind = (LPWIN32_FIND_DATA)malloc (sizeof (WIN32_FIND_DATA))) == NULL)
+ {
+ error_out_of_memory();
+ return NULL;
+ }
+
+ bc->hFind = FindFirstFile (fv, bc->ffind);
+
+ fv = !(bc->hFind==INVALID_HANDLE_VALUE) ? bc->ffind->cFileName : NULL;
+ }
+
+ if (fv == NULL)
+ {
+ /* Null indicates no more files.. */
+ free (bc->ffind); /* free the buffer */
+ bc->ffind = NULL;
+ bc->shiftlevel++; /* On to next list element */
+ continue;
+ }
+ }
+
+ /* At this point, fv points to parameter string */
+ while (*sp)
+ {
+ if ((*sp == _T('%')) && (*(sp + 1) == bc->forvar))
+ {
+ /* replace % var */
+ dp = _stpcpy (dp, fv);
+ sp += 2;
+ }
+ else
+ {
+ /* Else just copy */
+ *dp++ = *sp++;
+ }
+ }
+
+ *dp = _T('\0');
+
+ *bLocalEcho = bEcho;
+
+ return textline;
+ }
+
+ if (!FileGetString (bc->hBatchFile, textline, sizeof (textline) / sizeof (textline[0])))
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("ReadBatchLine(): Reached EOF!\n"));
+#endif
+ /* End of file.... */
+ ExitBatch (NULL);
+
+ if (bc == NULL)
+ return NULL;
+
+ continue;
+ }
+#ifdef _DEBUG
+ DebugPrintf (_T("ReadBatchLine(): textline: \'%s\'\n"), textline);
+#endif
+
+ /* Strip leading spaces and trailing space/control chars */
+ for (first = textline; _istspace (*first); first++)
+ ;
+
+ for (ip = first + _tcslen (first) - 1; _istspace (*ip) || _istcntrl (*ip); ip--)
+ ;
+
+ *++ip = _T('\0');
+
+ /* ignore labels and empty lines */
+ if (*first == _T(':') || *first == 0)
+ continue;
+
+ if (*first == _T('@'))
+ {
+ /* don't echo this line */
+ do
+ first++;
+ while (_istspace (*first));
+
+ *bLocalEcho = 0;
+ }
+ else
+ *bLocalEcho = bEcho;
+
+ break;
+ }
+
+ return first;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/batch.h b/reactos/base/shell/cmd/batch.h
new file mode 100644
index 00000000000..9e68abb6d83
--- /dev/null
+++ b/reactos/base/shell/cmd/batch.h
@@ -0,0 +1,47 @@
+/*
+ * BATCH.H - A structure to preserve the context of a batch file
+ *
+ *
+ */
+
+#ifndef _BATCH_H_INCLUDED_
+#define _BATCH_H_INCLUDED_
+
+
+typedef struct tagBATCHCONTEXT
+{
+ struct tagBATCHCONTEXT *prev;
+ LPWIN32_FIND_DATA ffind;
+ HANDLE hBatchFile;
+ LPTSTR forproto;
+ LPTSTR params;
+ INT shiftlevel;
+ BOOL bEcho; /* Preserve echo flag across batch calls */
+ HANDLE hFind; /* Preserve find handle when doing a for */
+ TCHAR In[MAX_PATH];
+ TCHAR Out[MAX_PATH];
+ TCHAR Err[MAX_PATH];
+ TCHAR forvar;
+} BATCH_CONTEXT, *LPBATCH_CONTEXT;
+
+
+/* The stack of current batch contexts.
+ * NULL when no batch is active
+ */
+extern LPBATCH_CONTEXT bc;
+
+extern BOOL bEcho; /* The echo flag */
+
+#define BATCH_BUFFSIZE 2048
+
+extern TCHAR textline[BATCH_BUFFSIZE]; /* Buffer for reading Batch file lines */
+
+
+LPTSTR FindArg (INT);
+LPTSTR BatchParams (LPTSTR, LPTSTR);
+VOID ExitBatch (LPTSTR);
+BOOL Batch (LPTSTR, LPTSTR, LPTSTR);
+LPTSTR ReadBatchLine (LPBOOL);
+VOID AddBatchRedirection(TCHAR *, TCHAR *, TCHAR *);
+
+#endif /* _BATCH_H_INCLUDED_ */
diff --git a/reactos/base/shell/cmd/beep.c b/reactos/base/shell/cmd/beep.c
new file mode 100644
index 00000000000..61537ed5cc4
--- /dev/null
+++ b/reactos/base/shell/cmd/beep.c
@@ -0,0 +1,50 @@
+/*
+ * BEEP.C - beep internal command.
+ *
+ *
+ * History:
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * started.
+ *
+ * 16 Jul 1998 (John P Price)
+ * Separated commands into individual files.
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 14-Jan-1999 (Eric Kohl )
+ * Added help text ("beep /?").
+ * Unicode ready!
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Redirection ready!
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_BEEP
+
+
+INT cmd_beep (LPTSTR cmd, LPTSTR param)
+{
+ if (_tcsncmp (param, _T("/?"), 2) == 0)
+ {
+ ConOutResPaging(TRUE,STRING_BEEP_HELP);
+ return 0;
+ }
+
+#if 0
+ /* check if run in batch mode */
+ if (bc == NULL)
+ return 1;
+#endif
+ MessageBeep (-1);
+
+ return 0;
+}
+#endif
diff --git a/reactos/base/shell/cmd/call.c b/reactos/base/shell/cmd/call.c
new file mode 100644
index 00000000000..08c10d129d0
--- /dev/null
+++ b/reactos/base/shell/cmd/call.c
@@ -0,0 +1,100 @@
+/*
+ * CALL.C - call internal batch command.
+ *
+ *
+ * History:
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * started.
+ *
+ * 16 Jul 1998 (John P Price)
+ * Seperated commands into individual files.
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 04-Aug-1998 (Hans B Pufal)
+ * added lines to initialize for pointers (HBP004) This fixed the
+ * lock-up that happened sometimes when calling a batch file from
+ * another batch file.
+ *
+ * 07-Jan-1999 (Eric Kohl )
+ * Added help text ("call /?") and cleaned up.
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Unicode and redirection safe!
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+/*
+ * Perform CALL command.
+ *
+ * Allocate a new batch context and add it to the current chain.
+ * Call parsecommandline passing in our param string
+ * If No batch file was opened then remove our newly allocted
+ * context block.
+ */
+
+INT cmd_call (LPTSTR cmd, LPTSTR param)
+{
+ LPBATCH_CONTEXT n = NULL;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
+#endif
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_CALL_HELP);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ n = (LPBATCH_CONTEXT)malloc (sizeof (BATCH_CONTEXT));
+
+ if (n == NULL)
+ {
+ error_out_of_memory ();
+ return 1;
+ }
+
+ n->prev = bc;
+ bc = n;
+
+ bc->hBatchFile = INVALID_HANDLE_VALUE;
+ bc->params = NULL;
+ bc->shiftlevel = 0;
+ bc->forvar = 0; /* HBP004 */
+ bc->forproto = NULL; /* HBP004 */
+ ParseCommandLine (param);
+ if (bc->prev)
+ {
+ _tcscpy(bc->In, bc->prev->In);
+ _tcscpy(bc->Out, bc->prev->Out);
+ _tcscpy(bc->Err, bc->prev->Err);
+ }
+ else
+ {
+ bc->In[0] = _T('\0');
+ bc->Out[0] = _T('\0');
+ bc->Err[0] = _T('\0');
+ }
+
+
+ /* Wasn't a batch file so remove conext */
+ if (bc->hBatchFile == INVALID_HANDLE_VALUE)
+ {
+ bc = bc->prev;
+ free (n);
+ }
+
+ return 0;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/chcp.c b/reactos/base/shell/cmd/chcp.c
new file mode 100644
index 00000000000..bf34ded3533
--- /dev/null
+++ b/reactos/base/shell/cmd/chcp.c
@@ -0,0 +1,85 @@
+/*
+ * CHCP.C - chcp internal command.
+ *
+ *
+ * History:
+ *
+ * 23-Dec-1998 (Eric Kohl )
+ * Started.
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+
+#ifdef INCLUDE_CMD_CHCP
+
+INT CommandChcp (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LPTSTR *arg;
+ INT args;
+ UINT uNewCodePage;
+
+ /* print help */
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_CHCP_HELP);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ /* get parameters */
+ arg = split (param, &args, FALSE);
+
+ if (args == 0)
+ {
+ /* display active code page number */
+ LoadString(CMD_ModuleHandle, STRING_CHCP_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, InputCodePage);
+ return 0;
+ }
+
+ if (args >= 2)
+ {
+ /* too many parameters */
+ LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, param);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ uNewCodePage = (UINT)_ttoi(arg[0]);
+
+ if (uNewCodePage == 0)
+ {
+ LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, arg[0]);
+ freep (arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ if (!SetConsoleCP(uNewCodePage))
+ {
+ ConErrResPuts(STRING_CHCP_ERROR4);
+ }
+ else
+ {
+
+ SetConsoleOutputCP (uNewCodePage);
+ InitLocale ();
+ InputCodePage= GetConsoleCP();
+ }
+
+ freep (arg);
+
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_CHCP */
diff --git a/reactos/base/shell/cmd/choice.c b/reactos/base/shell/cmd/choice.c
new file mode 100644
index 00000000000..095a6b5e83d
--- /dev/null
+++ b/reactos/base/shell/cmd/choice.c
@@ -0,0 +1,327 @@
+/*
+ * CHOICE.C - internal command.
+ *
+ *
+ * History:
+ *
+ * 12 Aug 1999 (Eric Kohl)
+ * started.
+ *
+ * 01 Sep 1999 (Eric Kohl)
+ * Fixed help text.
+ *
+ * 26 Sep 1999 (Paolo Pantaleo)
+ * Fixed timeout.
+ *
+ * 02 Apr 2005 (Magnus Olsen
+ * Remove Hardcode string so
+ * they can be translate
+ *
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_CHOICE
+
+
+#define GC_TIMEOUT -1
+#define GC_NOKEY 0 //an event occurred but it wasn't a key pressed
+#define GC_KEYREAD 1 //a key has been read
+
+
+static INT
+GetCharacterTimeout (LPTCH ch, DWORD dwMilliseconds)
+{
+//--------------------------------------------
+// Get a character from standard input but with a timeout.
+// The function will wait a limited amount
+// of time, then the function returns GC_TIMEOUT.
+//
+// dwMilliseconds is the timeout value, that can
+// be set to INFINITE, so the function works like
+// stdio.h's getchar()
+
+ HANDLE hInput;
+ DWORD dwRead;
+
+ INPUT_RECORD lpBuffer;
+
+ hInput = GetStdHandle (STD_INPUT_HANDLE);
+
+ //if the timeout experied return GC_TIMEOUT
+ if (WaitForSingleObject (hInput, dwMilliseconds) == WAIT_TIMEOUT)
+ return GC_TIMEOUT;
+
+ //otherwise get the event
+ ReadConsoleInput (hInput, &lpBuffer, 1, &dwRead);
+
+ //if the event is a key pressed
+ if ((lpBuffer.EventType == KEY_EVENT) &&
+ (lpBuffer.Event.KeyEvent.bKeyDown == TRUE))
+ {
+ //read the key
+#ifdef _UNICODE
+ *ch = lpBuffer.Event.KeyEvent.uChar.UnicodeChar;
+#else
+ *ch = lpBuffer.Event.KeyEvent.uChar.AsciiChar;
+#endif
+ return GC_KEYREAD;
+ }
+
+ //else return no key
+ return GC_NOKEY;
+}
+
+static INT
+IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive)
+{
+ LPTCH p = lpString;
+ INT val = 0;
+
+ while (*p)
+ {
+ if (bCaseSensitive)
+ {
+ if (*p == cKey)
+ return val;
+ }
+ else
+ {
+ if (_totlower (*p) == _totlower (cKey))
+ return val;
+ }
+
+ val++;
+ p++;
+ }
+
+ return -1;
+}
+
+
+INT
+CommandChoice (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LPTSTR lpOptions;
+ TCHAR Options[6];
+ LPTSTR lpText = NULL;
+ BOOL bNoPrompt = FALSE;
+ BOOL bCaseSensitive = FALSE;
+ BOOL bTimeout = FALSE;
+ INT nTimeout = 0;
+ TCHAR cDefault = _T('\0');
+ INPUT_RECORD ir;
+ LPTSTR p, np;
+ LPTSTR *arg;
+ INT argc;
+ INT i;
+ INT val;
+
+ INT GCret;
+ TCHAR Ch;
+ DWORD amount,clk;
+
+ LoadString(CMD_ModuleHandle, STRING_CHOICE_OPTION, Options, 4);
+ lpOptions = Options;
+
+ if (_tcsncmp (param, _T("/?"), 2) == 0)
+ {
+ ConOutResPaging(TRUE,STRING_CHOICE_HELP);
+ return 0;
+ }
+
+ /* retrieve text */
+ p = param;
+
+ while (TRUE)
+ {
+ if (*p == _T('\0'))
+ break;
+
+ if (*p != _T('/'))
+ {
+ lpText = p;
+ break;
+ }
+ np = _tcschr (p, _T(' '));
+ if (!np)
+ break;
+ p = np + 1;
+ }
+
+ /* build parameter array */
+ arg = split (param, &argc, FALSE);
+
+ /* evaluate arguments */
+ if (argc > 0)
+ {
+ for (i = 0; i < argc; i++)
+ {
+ if (_tcsnicmp (arg[i], _T("/c"), 2) == 0)
+ {
+ if (arg[i][2] == _T(':'))
+ lpOptions = &arg[i][3];
+ else
+ lpOptions = &arg[i][2];
+
+ if (_tcslen (lpOptions) == 0)
+ {
+ ConErrResPuts(STRING_CHOICE_ERROR);
+ freep (arg);
+ return 1;
+ }
+ }
+ else if (_tcsnicmp (arg[i], _T("/n"), 2) == 0)
+ {
+ bNoPrompt = TRUE;
+ }
+ else if (_tcsnicmp (arg[i], _T("/s"), 2) == 0)
+ {
+ bCaseSensitive = TRUE;
+ }
+ else if (_tcsnicmp (arg[i], _T("/t"), 2) == 0)
+ {
+ LPTSTR s;
+
+ if (arg[i][2] == _T(':'))
+ {
+ cDefault = arg[i][3];
+ s = &arg[i][4];
+ }
+ else
+ {
+ cDefault = arg[i][2];
+ s = &arg[i][3];
+ }
+
+ if (*s != _T(','))
+ {
+ ConErrResPuts(STRING_CHOICE_ERROR_TXT);
+ freep (arg);
+ return 1;
+ }
+
+ s++;
+ nTimeout = _ttoi(s);
+ bTimeout = TRUE;
+ }
+ else if (arg[i][0] == _T('/'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_CHOICE_ERROR_OPTION, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, arg[i]);
+ freep (arg);
+ return 1;
+ }
+ }
+ }
+
+ /* print text */
+ if (lpText)
+ ConOutPrintf (_T("%s"), lpText);
+
+ /* print options */
+ if (bNoPrompt == FALSE)
+ {
+ ConOutPrintf (_T("[%c"), lpOptions[0]);
+
+ for (i = 1; (unsigned)i < _tcslen (lpOptions); i++)
+ ConOutPrintf (_T(",%c"), lpOptions[i]);
+
+ ConOutPrintf (_T("]?"));
+ }
+
+ ConInFlush ();
+
+ if(!bTimeout)
+ {
+ while (TRUE)
+ {
+ ConInKey (&ir);
+
+ val = IsKeyInString (lpOptions,
+#ifdef _UNICODE
+ ir.Event.KeyEvent.uChar.UnicodeChar,
+#else
+ ir.Event.KeyEvent.uChar.AsciiChar,
+#endif
+ bCaseSensitive);
+
+ if (val >= 0)
+ {
+ ConOutPrintf (_T("%c\n"), lpOptions[val]);
+
+ nErrorLevel = val + 1;
+
+ break;
+ }
+
+ Beep (440, 50);
+ }
+
+ freep (arg);
+#ifdef _DEBUG
+ DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
+#endif /* _DEBUG */
+ return 0;
+ }
+
+ clk = GetTickCount ();
+ amount = nTimeout*1000;
+
+loop:
+ GCret = GetCharacterTimeout (&Ch, amount - (GetTickCount () - clk));
+
+ switch (GCret)
+ {
+ case GC_TIMEOUT:
+#ifdef _DEBUG
+ DebugPrintf (_T("GC_TIMEOUT\n"));
+ DebugPrintf (_T("elapsed %d msecs\n"), GetTickCount () - clk);
+#endif /* _DEBUG */
+ break;
+
+ case GC_NOKEY:
+#ifdef _DEBUG
+ DebugPrintf(_T("GC_NOKEY\n"));
+ DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
+#endif /* _DEBUG */
+ goto loop;
+
+ case GC_KEYREAD:
+#ifdef _DEBUG
+ DebugPrintf(_T("GC_KEYREAD\n"));
+ DebugPrintf(_T("elapsed %d msecs\n"), GetTickCount () - clk);
+ DebugPrintf(_T("read %c"), Ch);
+#endif /* _DEBUG */
+ if ((val=IsKeyInString(lpOptions,Ch,bCaseSensitive))==-1)
+ {
+ Beep (440, 50);
+ goto loop;
+ }
+ cDefault=Ch;
+ break;
+ }
+
+#ifdef _DEBUG
+ DebugPrintf(_T("exiting wait loop after %d msecs\n"),
+ GetTickCount () - clk);
+#endif /* _DEBUG */
+
+ val = IsKeyInString (lpOptions, cDefault, bCaseSensitive);
+ ConOutPrintf (_T("%c\n"), lpOptions[val]);
+
+ nErrorLevel = val + 1;
+
+ freep (arg);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("ErrorLevel: %d\n"), nErrorLevel);
+#endif /* _DEBUG */
+
+ return 0;
+}
+#endif /* INCLUDE_CMD_CHOICE */
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/cls.c b/reactos/base/shell/cmd/cls.c
new file mode 100644
index 00000000000..b2e98d761b6
--- /dev/null
+++ b/reactos/base/shell/cmd/cls.c
@@ -0,0 +1,62 @@
+/*
+ * CLS.C - clear screen internal command.
+ *
+ *
+ * History:
+ *
+ * 07/27/1998 (John P. Price)
+ * started.
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 04-Dec-1998 (Eric Kohl )
+ * Changed to Win32 console app.
+ *
+ * 08-Dec-1998 (Eric Kohl )
+ * Added help text ("/?").
+ *
+ * 14-Jan-1998 (Eric Kohl )
+ * Unicode ready!
+ *
+ * 20-Jan-1998 (Eric Kohl )
+ * Redirection ready!
+ *
+ * 02-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_CLS
+
+INT cmd_cls (LPTSTR cmd, LPTSTR param)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ COORD coPos;
+ DWORD dwWritten;
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_CLS_HELP);
+ return 0;
+ }
+
+ GetConsoleScreenBufferInfo(hConsole, &csbi);
+
+ coPos.X = 0;
+ coPos.Y = 0;
+ FillConsoleOutputAttribute(hConsole, wColor,
+ csbi.dwSize.X * csbi.dwSize.Y,
+ coPos, &dwWritten);
+ FillConsoleOutputCharacter(hConsole, _T(' '),
+ csbi.dwSize.X * csbi.dwSize.Y,
+ coPos, &dwWritten);
+ SetConsoleCursorPosition(hConsole, coPos);
+
+ bIgnoreEcho = TRUE;
+
+ return 0;
+}
+#endif
diff --git a/reactos/base/shell/cmd/cmd.c b/reactos/base/shell/cmd/cmd.c
new file mode 100644
index 00000000000..2652447a681
--- /dev/null
+++ b/reactos/base/shell/cmd/cmd.c
@@ -0,0 +1,1865 @@
+/*
+ * CMD.C - command-line interface.
+ *
+ *
+ * History:
+ *
+ * 17 Jun 1994 (Tim Norman)
+ * started.
+ *
+ * 08 Aug 1995 (Matt Rains)
+ * I have cleaned up the source code. changes now bring this source
+ * into guidelines for recommended programming practice.
+ *
+ * A added the the standard FreeDOS GNU licence test to the
+ * initialize() function.
+ *
+ * Started to replace puts() with printf(). this will help
+ * standardize output. please follow my lead.
+ *
+ * I have added some constants to help making changes easier.
+ *
+ * 15 Dec 1995 (Tim Norman)
+ * major rewrite of the code to make it more efficient and add
+ * redirection support (finally!)
+ *
+ * 06 Jan 1996 (Tim Norman)
+ * finished adding redirection support! Changed to use our own
+ * exec code (MUCH thanks to Svante Frey!!)
+ *
+ * 29 Jan 1996 (Tim Norman)
+ * added support for CHDIR, RMDIR, MKDIR, and ERASE, as per
+ * suggestion of Steffan Kaiser
+ *
+ * changed "file not found" error message to "bad command or
+ * filename" thanks to Dustin Norman for noticing that confusing
+ * message!
+ *
+ * changed the format to call internal commands (again) so that if
+ * they want to split their commands, they can do it themselves
+ * (none of the internal functions so far need that much power, anyway)
+ *
+ * 27 Aug 1996 (Tim Norman)
+ * added in support for Oliver Mueller's ALIAS command
+ *
+ * 14 Jun 1997 (Steffan Kaiser)
+ * added ctrl-break handling and error level
+ *
+ * 16 Jun 1998 (Rob Lake)
+ * Runs command.com if /P is specified in command line. Command.com
+ * also stays permanent. If /C is in the command line, starts the
+ * program next in the line.
+ *
+ * 21 Jun 1998 (Rob Lake)
+ * Fixed up /C so that arguments for the program
+ *
+ * 08-Jul-1998 (John P. Price)
+ * Now sets COMSPEC environment variable
+ * misc clean up and optimization
+ * added date and time commands
+ * changed to using spawnl instead of exec. exec does not copy the
+ * environment to the child process!
+ *
+ * 14 Jul 1998 (Hans B Pufal)
+ * Reorganised source to be more efficient and to more closely
+ * follow MS-DOS conventions. (eg %..% environment variable
+ * replacement works form command line as well as batch file.
+ *
+ * New organisation also properly support nested batch files.
+ *
+ * New command table structure is half way towards providing a
+ * system in which COMMAND will find out what internal commands
+ * are loaded
+ *
+ * 24 Jul 1998 (Hans B Pufal) [HBP_003]
+ * Fixed return value when called with /C option
+ *
+ * 27 Jul 1998 John P. Price
+ * added config.h include
+ *
+ * 28 Jul 1998 John P. Price
+ * added showcmds function to show commands and options available
+ *
+ * 07-Aug-1998 (John P Price )
+ * Fixed carrage return output to better match MSDOS with echo
+ * on or off. (marked with "JPP 19980708")
+ *
+ * 07-Dec-1998 (Eric Kohl )
+ * First ReactOS release.
+ * Extended length of commandline buffers to 512.
+ *
+ * 13-Dec-1998 (Eric Kohl )
+ * Added COMSPEC environment variable.
+ * Added "/t" support (color) on cmd command line.
+ *
+ * 07-Jan-1999 (Eric Kohl )
+ * Added help text ("cmd /?").
+ *
+ * 25-Jan-1999 (Eric Kohl )
+ * Unicode and redirection safe!
+ * Fixed redirections and piping.
+ * Piping is based on temporary files, but basic support
+ * for anonymous pipes already exists.
+ *
+ * 27-Jan-1999 (Eric Kohl )
+ * Replaced spawnl() by CreateProcess().
+ *
+ * 22-Oct-1999 (Eric Kohl )
+ * Added break handler.
+ *
+ * 15-Dec-1999 (Eric Kohl )
+ * Fixed current directory
+ *
+ * 28-Dec-1999 (Eric Kohl )
+ * Restore window title after program/batch execution
+ *
+ * 03-Feb-2001 (Eric Kohl )
+ * Workaround because argc[0] is NULL under ReactOS
+ *
+ * 23-Feb-2001 (Carl Nettelblad )
+ * %envvar% replacement conflicted with for.
+ *
+ * 30-Apr-2004 (Filip Navara )
+ * Make MakeSureDirectoryPathExistsEx unicode safe.
+ *
+ * 28-Mai-2004
+ * Removed MakeSureDirectoryPathExistsEx.
+ * Use the current directory if GetTempPath fails.
+ *
+ * 12-Jul-2004 (Jens Collin )
+ * Added ShellExecute call when all else fails to be able to "launch" any file.
+ *
+ * 02-Apr-2005 (Magnus Olsen )
+ * Remove all hardcode string to En.rc
+ *
+ * 06-May-2005 (Klemens Friedl )
+ * Add 'help' command (list all commands plus description)
+ *
+ * 06-jul-2005 (Magnus Olsen )
+ * translate '%errorlevel%' to the internal value.
+ * Add proper memmory alloc ProcessInput, the error
+ * handling for memmory handling need to be improve
+ */
+
+#include
+#include
+#include "resource.h"
+
+#ifndef NT_SUCCESS
+#define NT_SUCCESS(StatCode) ((NTSTATUS)(StatCode) >= 0)
+#endif
+
+typedef NTSTATUS (WINAPI *NtQueryInformationProcessProc)(HANDLE, PROCESSINFOCLASS,
+ PVOID, ULONG, PULONG);
+typedef NTSTATUS (WINAPI *NtReadVirtualMemoryProc)(HANDLE, PVOID, PVOID, ULONG, PULONG);
+
+BOOL bExit = FALSE; /* indicates EXIT was typed */
+BOOL bCanExit = TRUE; /* indicates if this shell is exitable */
+BOOL bCtrlBreak = FALSE; /* Ctrl-Break or Ctrl-C hit */
+BOOL bIgnoreEcho = FALSE; /* Ignore 'newline' before 'cls' */
+INT nErrorLevel = 0; /* Errorlevel of last launched external program */
+BOOL bChildProcessRunning = FALSE;
+DWORD dwChildProcessId = 0;
+OSVERSIONINFO osvi;
+HANDLE hIn;
+HANDLE hOut;
+HANDLE hConsole;
+HANDLE CMD_ModuleHandle;
+HMODULE NtDllModule;
+
+static NtQueryInformationProcessProc NtQueryInformationProcessPtr = NULL;
+static NtReadVirtualMemoryProc NtReadVirtualMemoryPtr = NULL;
+
+#ifdef INCLUDE_CMD_COLOR
+WORD wColor; /* current color */
+WORD wDefColor; /* default color */
+#endif
+
+/*
+ * convert
+ *
+ * insert commas into a number
+ */
+INT
+ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperator)
+{
+ TCHAR temp[32];
+ INT c = 0;
+ INT n = 0;
+
+ if (num.QuadPart == 0)
+ {
+ des[0] = _T('0');
+ des[1] = _T('\0');
+ n = 1;
+ }
+ else
+ {
+ temp[31] = 0;
+ while (num.QuadPart > 0)
+ {
+ if ((((c + 1) % (nNumberGroups + 1)) == 0) && (bPutSeperator))
+ temp[30 - c++] = cThousandSeparator;
+ temp[30 - c++] = (TCHAR)(num.QuadPart % 10) + _T('0');
+ num.QuadPart /= 10;
+ }
+
+ for (n = 0; n <= c; n++)
+ des[n] = temp[31 - c + n];
+ }
+
+ return n;
+}
+
+/*
+ * is character a delimeter when used on first word?
+ *
+ */
+static BOOL IsDelimiter (TCHAR c)
+{
+ return (c == _T('/') || c == _T('=') || c == _T('\0') || _istspace (c));
+}
+
+/*
+ * Is a process a console process?
+ */
+static BOOL IsConsoleProcess(HANDLE Process)
+{
+ NTSTATUS Status;
+ PROCESS_BASIC_INFORMATION Info;
+ PEB ProcessPeb;
+ ULONG BytesRead;
+
+ if (NULL == NtQueryInformationProcessPtr || NULL == NtReadVirtualMemoryPtr)
+ {
+ return TRUE;
+ }
+
+ Status = NtQueryInformationProcessPtr (
+ Process, ProcessBasicInformation,
+ &Info, sizeof(PROCESS_BASIC_INFORMATION), NULL);
+ if (! NT_SUCCESS(Status))
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("NtQueryInformationProcess failed with status %08x\n"), Status);
+#endif
+ return TRUE;
+ }
+ Status = NtReadVirtualMemoryPtr (
+ Process, Info.PebBaseAddress, &ProcessPeb,
+ sizeof(PEB), &BytesRead);
+ if (! NT_SUCCESS(Status) || sizeof(PEB) != BytesRead)
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("Couldn't read virt mem status %08x bytes read %lu\n"), Status, BytesRead);
+#endif
+ return TRUE;
+ }
+
+ return IMAGE_SUBSYSTEM_WINDOWS_CUI == ProcessPeb.ImageSubSystem;
+}
+
+
+
+#ifdef _UNICODE
+#define SHELLEXECUTETEXT "ShellExecuteW"
+#else
+#define SHELLEXECUTETEXT "ShellExecuteA"
+#endif
+
+typedef HINSTANCE (WINAPI *MYEX)(
+ HWND hwnd,
+ LPCTSTR lpOperation,
+ LPCTSTR lpFile,
+ LPCTSTR lpParameters,
+ LPCTSTR lpDirectory,
+ INT nShowCmd
+);
+
+
+
+static BOOL RunFile(LPTSTR filename)
+{
+ HMODULE hShell32;
+ MYEX hShExt;
+ HINSTANCE ret;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("RunFile(%s)\n"), filename);
+#endif
+ hShell32 = LoadLibrary(_T("SHELL32.DLL"));
+ if (!hShell32)
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("RunFile: couldn't load SHELL32.DLL!\n"));
+#endif
+ return FALSE;
+ }
+
+ hShExt = (MYEX)(FARPROC)GetProcAddress(hShell32, SHELLEXECUTETEXT);
+ if (!hShExt)
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("RunFile: couldn't find ShellExecuteA/W in SHELL32.DLL!\n"));
+#endif
+ FreeLibrary(hShell32);
+ return FALSE;
+ }
+
+#ifdef _DEBUG
+ DebugPrintf (_T("RunFile: ShellExecuteA/W is at %x\n"), hShExt);
+#endif
+
+ ret = (hShExt)(NULL, _T("open"), filename, NULL, NULL, SW_SHOWNORMAL);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("RunFile: ShellExecuteA/W returned %d\n"), (DWORD)ret);
+#endif
+
+ FreeLibrary(hShell32);
+ return (((DWORD)ret) > 32);
+}
+
+
+
+/*
+ * This command (in first) was not found in the command table
+ *
+ * Full - whole command line
+ * First - first word on command line
+ * Rest - rest of command line
+ */
+
+static VOID
+Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
+{
+ TCHAR *szFullName=NULL;
+ TCHAR *first = NULL;
+ TCHAR *rest = NULL;
+ TCHAR *full = NULL;
+ TCHAR *dot = NULL;
+ TCHAR szWindowTitle[MAX_PATH];
+ DWORD dwExitCode = 0;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("Execute: \'%s\' \'%s\'\n"), first, rest);
+#endif
+
+ /* we need biger buffer that First, Rest, Full are already
+ need rewrite some code to use realloc when it need instead
+ of add 512bytes extra */
+
+ first = malloc ( (_tcslen(First) + 512) * sizeof(TCHAR));
+ if (first == NULL)
+ {
+ error_out_of_memory();
+ nErrorLevel = 1;
+ return ;
+ }
+
+ rest = malloc ( (_tcslen(Rest) + 512) * sizeof(TCHAR));
+ if (rest == NULL)
+ {
+ free (first);
+ error_out_of_memory();
+ nErrorLevel = 1;
+ return ;
+ }
+
+ full = malloc ( (_tcslen(Full) + 512) * sizeof(TCHAR));
+ if (full == NULL)
+ {
+ free (first);
+ free (rest);
+ error_out_of_memory();
+ nErrorLevel = 1;
+ return ;
+ }
+
+ szFullName = malloc ( (_tcslen(Full) + 512) * sizeof(TCHAR));
+ if (full == NULL)
+ {
+ free (first);
+ free (rest);
+ free (full);
+ error_out_of_memory();
+ nErrorLevel = 1;
+ return ;
+ }
+
+
+ /* Though it was already parsed once, we have a different set of rules
+ for parsing before we pass to CreateProccess */
+ if(!_tcschr(Full,_T('\"')))
+ {
+ _tcscpy(first,First);
+ _tcscpy(rest,Rest);
+ _tcscpy(full,Full);
+ }
+ else
+ {
+ UINT i = 0;
+ BOOL bInside = FALSE;
+ rest[0] = _T('\0');
+ full[0] = _T('\0');
+ first[0] = _T('\0');
+ _tcscpy(first,Full);
+ /* find the end of the command and start of the args */
+ for(i = 0; i < _tcslen(first); i++)
+ {
+ if(!_tcsncmp(&first[i], _T("\""), 1))
+ bInside = !bInside;
+ if(!_tcsncmp(&first[i], _T(" "), 1) && !bInside)
+ {
+ _tcscpy(rest,&first[i]);
+ first[i] = _T('\0');
+ break;
+ }
+
+ }
+ i = 0;
+ /* remove any slashes */
+ while(i < _tcslen(first))
+ {
+ if(first[i] == _T('\"'))
+ memmove(&first[i],&first[i + 1], _tcslen(&first[i]) * sizeof(TCHAR));
+ else
+ i++;
+ }
+ /* Drop quotes around it just in case there is a space */
+ _tcscpy(full,_T("\""));
+ _tcscat(full,first);
+ _tcscat(full,_T("\" "));
+ _tcscat(full,rest);
+ }
+
+ /* check for a drive change */
+ if ((_istalpha (first[0])) && (!_tcscmp (first + 1, _T(":"))))
+ {
+ BOOL working = TRUE;
+ if (!SetCurrentDirectory(first))
+ /* Guess they changed disc or something, handle that gracefully and get to root */
+ {
+ TCHAR str[4];
+ str[0]=first[0];
+ str[1]=_T(':');
+ str[2]=_T('\\');
+ str[3]=0;
+ working = SetCurrentDirectory(str);
+ }
+
+ if (!working) ConErrResPuts (STRING_FREE_ERROR1);
+
+ free (first);
+ free (rest);
+ free (full);
+ free (szFullName);
+ nErrorLevel = 1;
+ return;
+ }
+
+ /* get the PATH environment variable and parse it */
+ /* search the PATH environment variable for the binary */
+ if (!SearchForExecutable (first, szFullName))
+ {
+ error_bad_command ();
+ free (first);
+ free (rest);
+ free (full);
+ free (szFullName);
+ nErrorLevel = 1;
+ return;
+
+ }
+
+ GetConsoleTitle (szWindowTitle, MAX_PATH);
+
+ /* check if this is a .BAT or .CMD file */
+ dot = _tcsrchr (szFullName, _T('.'));
+ if (dot && (!_tcsicmp (dot, _T(".bat")) || !_tcsicmp (dot, _T(".cmd"))))
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
+#endif
+ Batch (szFullName, first, rest);
+ }
+ else
+ {
+ /* exec the program */
+ PROCESS_INFORMATION prci;
+ STARTUPINFO stui;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("[EXEC: %s %s]\n"), full, rest);
+#endif
+ /* build command line for CreateProcess() */
+
+ /* fill startup info */
+ memset (&stui, 0, sizeof (STARTUPINFO));
+ stui.cb = sizeof (STARTUPINFO);
+ stui.dwFlags = STARTF_USESHOWWINDOW;
+ stui.wShowWindow = SW_SHOWDEFAULT;
+
+ // return console to standard mode
+ SetConsoleMode (GetStdHandle(STD_INPUT_HANDLE),
+ ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT );
+
+ if (CreateProcess (szFullName,
+ full,
+ NULL,
+ NULL,
+ TRUE,
+ 0, /* CREATE_NEW_PROCESS_GROUP */
+ NULL,
+ NULL,
+ &stui,
+ &prci))
+
+ {
+ if (IsConsoleProcess(prci.hProcess))
+ {
+ /* FIXME: Protect this with critical section */
+ bChildProcessRunning = TRUE;
+ dwChildProcessId = prci.dwProcessId;
+
+ WaitForSingleObject (prci.hProcess, INFINITE);
+
+ /* FIXME: Protect this with critical section */
+ bChildProcessRunning = FALSE;
+
+ GetExitCodeProcess (prci.hProcess, &dwExitCode);
+ nErrorLevel = (INT)dwExitCode;
+ }
+ else
+ {
+ nErrorLevel = 0;
+ }
+ CloseHandle (prci.hThread);
+ CloseHandle (prci.hProcess);
+ }
+ else
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("[ShellExecute: %s]\n"), full);
+#endif
+ // See if we can run this with ShellExecute() ie myfile.xls
+ if (!RunFile(full))
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("[ShellExecute failed!: %s]\n"), full);
+#endif
+ error_bad_command ();
+ nErrorLevel = 1;
+ }
+ else
+ {
+ nErrorLevel = 0;
+ }
+ }
+ // restore console mode
+ SetConsoleMode (
+ GetStdHandle( STD_INPUT_HANDLE ),
+ ENABLE_PROCESSED_INPUT );
+ }
+
+ /* Get code page if it has been change */
+ InputCodePage= GetConsoleCP();
+ OutputCodePage = GetConsoleOutputCP();
+ SetConsoleTitle (szWindowTitle);
+
+ free(first);
+ free(rest);
+ free(full);
+ free (szFullName);
+}
+
+
+/*
+ * look through the internal commands and determine whether or not this
+ * command is one of them. If it is, call the command. If not, call
+ * execute to run it as an external program.
+ *
+ * line - the command line of the program to run
+ *
+ */
+
+static VOID
+DoCommand (LPTSTR line)
+{
+ TCHAR *com = NULL; /* the first word in the command */
+ TCHAR *cp = NULL;
+ LPTSTR cstart;
+ LPTSTR rest; /* pointer to the rest of the command line */
+ INT cl;
+ LPCOMMAND cmdptr;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("DoCommand: (\'%s\')\n"), line);
+#endif /* DEBUG */
+
+ com = malloc( (_tcslen(line) +512)*sizeof(TCHAR) );
+ if (com == NULL)
+ {
+ error_out_of_memory();
+ return;
+ }
+
+ cp = com;
+ /* Skip over initial white space */
+ while (_istspace (*line))
+ line++;
+ rest = line;
+
+ cstart = rest;
+
+ /* Anything to do ? */
+ if (*rest)
+ {
+ if (*rest == _T('"'))
+ {
+ /* treat quoted words specially */
+
+ rest++;
+
+ while(*rest != _T('\0') && *rest != _T('"'))
+ *cp++ = _totlower (*rest++);
+ if (*rest == _T('"'))
+ rest++;
+ }
+ else
+ {
+ while (!IsDelimiter (*rest))
+ *cp++ = _totlower (*rest++);
+ }
+
+
+ /* Terminate first word */
+ *cp = _T('\0');
+
+ /* Do not limit commands to MAX_PATH */
+ /*
+ if(_tcslen(com) > MAX_PATH)
+ {
+ error_bad_command();
+ free(com);
+ return;
+ }
+ */
+
+ /* Skip over whitespace to rest of line, exclude 'echo' command */
+ if (_tcsicmp (com, _T("echo")))
+ {
+ while (_istspace (*rest))
+ rest++;
+ }
+
+ /* Scan internal command table */
+ for (cmdptr = cmds;; cmdptr++)
+ {
+ /* If end of table execute ext cmd */
+ if (cmdptr->name == NULL)
+ {
+ Execute (line, com, rest);
+ break;
+ }
+
+ if (!_tcscmp (com, cmdptr->name))
+ {
+ cmdptr->func (com, rest);
+ break;
+ }
+
+ /* The following code handles the case of commands like CD which
+ * are recognised even when the command name and parameter are
+ * not space separated.
+ *
+ * e.g dir..
+ * cd\freda
+ */
+
+ /* Get length of command name */
+ cl = _tcslen (cmdptr->name);
+
+ if ((cmdptr->flags & CMD_SPECIAL) &&
+ (!_tcsncmp (cmdptr->name, com, cl)) &&
+ (_tcschr (_T("\\.-"), *(com + cl))))
+ {
+ /* OK its one of the specials...*/
+
+ /* Terminate first word properly */
+ com[cl] = _T('\0');
+
+ /* Call with new rest */
+ cmdptr->func (com, cstart + cl);
+ break;
+ }
+ }
+ }
+ free(com);
+}
+
+
+/*
+ * process the command line and execute the appropriate functions
+ * full input/output redirection and piping are supported
+ */
+
+VOID ParseCommandLine (LPTSTR cmd)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR cmdline[CMDLINE_LENGTH];
+ LPTSTR s;
+#ifdef FEATURE_REDIRECTION
+ TCHAR in[CMDLINE_LENGTH] = _T("");
+ TCHAR out[CMDLINE_LENGTH] = _T("");
+ TCHAR err[CMDLINE_LENGTH] = _T("");
+ TCHAR szTempPath[MAX_PATH] = _T(".\\");
+ TCHAR szFileName[2][MAX_PATH] = {_T(""), _T("")};
+ HANDLE hFile[2] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
+ LPTSTR t = NULL;
+ INT num = 0;
+ INT nRedirFlags = 0;
+ INT Length;
+ UINT Attributes;
+ BOOL bNewBatch = TRUE;
+ HANDLE hOldConIn;
+ HANDLE hOldConOut;
+ HANDLE hOldConErr;
+#endif /* FEATURE_REDIRECTION */
+
+ _tcscpy (cmdline, cmd);
+ s = &cmdline[0];
+
+#ifdef _DEBUG
+ DebugPrintf (_T("ParseCommandLine: (\'%s\')\n"), s);
+#endif /* DEBUG */
+
+#ifdef FEATURE_ALIASES
+ /* expand all aliases */
+ ExpandAlias (s, CMDLINE_LENGTH);
+#endif /* FEATURE_ALIAS */
+
+#ifdef FEATURE_REDIRECTION
+ /* find the temp path to store temporary files */
+ Length = GetTempPath (MAX_PATH, szTempPath);
+ if (Length > 0 && Length < MAX_PATH)
+ {
+ Attributes = GetFileAttributes(szTempPath);
+ if (Attributes == 0xffffffff ||
+ !(Attributes & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ Length = 0;
+ }
+ }
+ if (Length == 0 || Length >= MAX_PATH)
+ {
+ _tcscpy(szTempPath, _T(".\\"));
+ }
+ if (szTempPath[_tcslen (szTempPath) - 1] != _T('\\'))
+ _tcscat (szTempPath, _T("\\"));
+
+ /* get the redirections from the command line */
+ num = GetRedirection (s, in, out, err, &nRedirFlags);
+
+ /* more efficient, but do we really need to do this? */
+ for (t = in; _istspace (*t); t++)
+ ;
+ _tcscpy (in, t);
+
+ for (t = out; _istspace (*t); t++)
+ ;
+ _tcscpy (out, t);
+
+ for (t = err; _istspace (*t); t++)
+ ;
+ _tcscpy (err, t);
+
+ if(bc && !_tcslen (in) && _tcslen (bc->In))
+ _tcscpy(in, bc->In);
+ if(bc && !out[0] && _tcslen(bc->Out))
+ {
+ nRedirFlags |= OUTPUT_APPEND;
+ _tcscpy(out, bc->Out);
+ }
+ if(bc && !_tcslen (err) && _tcslen (bc->Err))
+ {
+ nRedirFlags |= ERROR_APPEND;
+ _tcscpy(err, bc->Err);
+ }
+
+
+ /* Set up the initial conditions ... */
+ /* preserve STDIN, STDOUT and STDERR handles */
+ hOldConIn = GetStdHandle (STD_INPUT_HANDLE);
+ hOldConOut = GetStdHandle (STD_OUTPUT_HANDLE);
+ hOldConErr = GetStdHandle (STD_ERROR_HANDLE);
+
+ /* redirect STDIN */
+ if (in[0])
+ {
+ HANDLE hFile;
+ SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
+
+ /* we need make sure the LastError msg is zero before calling CreateFile */
+ SetLastError(0);
+
+ /* Set up pipe for the standard input handler */
+ hFile = CreateFile (in, GENERIC_READ, FILE_SHARE_READ, &sa, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, in);
+ return;
+ }
+
+ if (!SetStdHandle (STD_INPUT_HANDLE, hFile))
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, in);
+ return;
+ }
+#ifdef _DEBUG
+ DebugPrintf (_T("Input redirected from: %s\n"), in);
+#endif
+ }
+
+ /* Now do all but the last pipe command */
+ *szFileName[0] = _T('\0');
+ hFile[0] = INVALID_HANDLE_VALUE;
+
+ while (num-- > 1)
+ {
+ SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
+
+ /* Create unique temporary file name */
+ GetTempFileName (szTempPath, _T("CMD"), 0, szFileName[1]);
+
+ /* we need make sure the LastError msg is zero before calling CreateFile */
+ SetLastError(0);
+
+ /* Set current stdout to temporary file */
+ hFile[1] = CreateFile (szFileName[1], GENERIC_WRITE, 0, &sa,
+ TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
+
+ if (hFile[1] == INVALID_HANDLE_VALUE)
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ return;
+ }
+
+ SetStdHandle (STD_OUTPUT_HANDLE, hFile[1]);
+
+ DoCommand (s);
+
+ /* close stdout file */
+ SetStdHandle (STD_OUTPUT_HANDLE, hOldConOut);
+ if ((hFile[1] != INVALID_HANDLE_VALUE) && (hFile[1] != hOldConOut))
+ {
+ CloseHandle (hFile[1]);
+ hFile[1] = INVALID_HANDLE_VALUE;
+ }
+
+ /* close old stdin file */
+ SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
+ if ((hFile[0] != INVALID_HANDLE_VALUE) && (hFile[0] != hOldConIn))
+ {
+ /* delete old stdin file, if it is a real file */
+ CloseHandle (hFile[0]);
+ hFile[0] = INVALID_HANDLE_VALUE;
+ DeleteFile (szFileName[0]);
+ *szFileName[0] = _T('\0');
+ }
+
+ /* copy stdout file name to stdin file name */
+ _tcscpy (szFileName[0], szFileName[1]);
+ *szFileName[1] = _T('\0');
+
+ /* we need make sure the LastError msg is zero before calling CreateFile */
+ SetLastError(0);
+
+ /* open new stdin file */
+ hFile[0] = CreateFile (szFileName[0], GENERIC_READ, 0, &sa,
+ OPEN_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
+ SetStdHandle (STD_INPUT_HANDLE, hFile[0]);
+
+ s = s + _tcslen (s) + 1;
+ }
+
+ /* Now set up the end conditions... */
+ /* redirect STDOUT */
+ if (out[0])
+ {
+ /* Final output to here */
+ HANDLE hFile;
+ SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
+
+ /* we need make sure the LastError msg is zero before calling CreateFile */
+ SetLastError(0);
+
+ hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, &sa,
+ (nRedirFlags & OUTPUT_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
+
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ INT size = _tcslen(out)-1;
+
+ if (out[size] != _T(':'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, out);
+ return;
+ }
+
+ out[size]=_T('\0');
+ hFile = CreateFile (out, GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, &sa,
+ (nRedirFlags & OUTPUT_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, NULL);
+
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, out);
+ return;
+ }
+
+ }
+
+ if (!SetStdHandle (STD_OUTPUT_HANDLE, hFile))
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, out);
+ return;
+ }
+
+ if (nRedirFlags & OUTPUT_APPEND)
+ {
+ LONG lHighPos = 0;
+
+ if (GetFileType (hFile) == FILE_TYPE_DISK)
+ SetFilePointer (hFile, 0, &lHighPos, FILE_END);
+ }
+#ifdef _DEBUG
+ DebugPrintf (_T("Output redirected to: %s\n"), out);
+#endif
+ }
+ else if (hOldConOut != INVALID_HANDLE_VALUE)
+ {
+ /* Restore original stdout */
+ HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE);
+ SetStdHandle (STD_OUTPUT_HANDLE, hOldConOut);
+ if (hOldConOut != hOut)
+ CloseHandle (hOut);
+ hOldConOut = INVALID_HANDLE_VALUE;
+ }
+
+ /* redirect STDERR */
+ if (err[0])
+ {
+ /* Final output to here */
+ HANDLE hFile;
+ SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
+
+ if (!_tcscmp (err, out))
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("Stdout and stderr will use the same file!!\n"));
+#endif
+ DuplicateHandle (GetCurrentProcess (),
+ GetStdHandle (STD_OUTPUT_HANDLE),
+ GetCurrentProcess (),
+ &hFile, 0, TRUE, DUPLICATE_SAME_ACCESS);
+ }
+ else
+ {
+ hFile = CreateFile (err,
+ GENERIC_WRITE,
+ FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
+ &sa,
+ (nRedirFlags & ERROR_APPEND) ? OPEN_ALWAYS : CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH,
+ NULL);
+ if (hFile == INVALID_HANDLE_VALUE)
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, err);
+ return;
+ }
+ }
+
+ if (!SetStdHandle (STD_ERROR_HANDLE, hFile))
+ {
+ LoadString(CMD_ModuleHandle, STRING_CMD_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, err);
+ return;
+ }
+
+ if (nRedirFlags & ERROR_APPEND)
+ {
+ LONG lHighPos = 0;
+
+ if (GetFileType (hFile) == FILE_TYPE_DISK)
+ SetFilePointer (hFile, 0, &lHighPos, FILE_END);
+ }
+#ifdef _DEBUG
+ DebugPrintf (_T("Error redirected to: %s\n"), err);
+#endif
+ }
+ else if (hOldConErr != INVALID_HANDLE_VALUE)
+ {
+ /* Restore original stderr */
+ HANDLE hErr = GetStdHandle (STD_ERROR_HANDLE);
+ SetStdHandle (STD_ERROR_HANDLE, hOldConErr);
+ if (hOldConErr != hErr)
+ CloseHandle (hErr);
+ hOldConErr = INVALID_HANDLE_VALUE;
+ }
+
+ if(bc)
+ bNewBatch = FALSE;
+#endif
+
+ /* process final command */
+ DoCommand (s);
+
+#ifdef FEATURE_REDIRECTION
+ if(bNewBatch && bc)
+ AddBatchRedirection(in, out, err);
+ /* close old stdin file */
+#if 0 /* buggy implementation */
+ SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
+ if ((hFile[0] != INVALID_HANDLE_VALUE) &&
+ (hFile[0] != hOldConIn))
+ {
+ /* delete old stdin file, if it is a real file */
+ CloseHandle (hFile[0]);
+ hFile[0] = INVALID_HANDLE_VALUE;
+ DeleteFile (szFileName[0]);
+ *szFileName[0] = _T('\0');
+ }
+
+ /* Restore original STDIN */
+ if (hOldConIn != INVALID_HANDLE_VALUE)
+ {
+ HANDLE hIn = GetStdHandle (STD_INPUT_HANDLE);
+ SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
+ if (hOldConIn != hIn)
+ CloseHandle (hIn);
+ hOldConIn = INVALID_HANDLE_VALUE;
+ }
+ else
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("Can't restore STDIN! Is invalid!!\n"), out);
+#endif
+ }
+#endif /* buggy implementation */
+
+
+ if (hOldConIn != INVALID_HANDLE_VALUE)
+ {
+ HANDLE hIn = GetStdHandle (STD_INPUT_HANDLE);
+ SetStdHandle (STD_INPUT_HANDLE, hOldConIn);
+ if (hIn == INVALID_HANDLE_VALUE)
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("Previous STDIN is invalid!!\n"));
+#endif
+ }
+ else
+ {
+ if (GetFileType (hIn) == FILE_TYPE_DISK)
+ {
+ if (hFile[0] == hIn)
+ {
+ CloseHandle (hFile[0]);
+ hFile[0] = INVALID_HANDLE_VALUE;
+ DeleteFile (szFileName[0]);
+ *szFileName[0] = _T('\0');
+ }
+ else
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
+#endif
+ }
+ }
+ }
+ }
+
+
+ /* Restore original STDOUT */
+ if (hOldConOut != INVALID_HANDLE_VALUE)
+ {
+ HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE);
+ SetStdHandle (STD_OUTPUT_HANDLE, hOldConOut);
+ if (hOldConOut != hOut)
+ CloseHandle (hOut);
+ hOldConOut = INVALID_HANDLE_VALUE;
+ }
+
+ /* Restore original STDERR */
+ if (hOldConErr != INVALID_HANDLE_VALUE)
+ {
+ HANDLE hErr = GetStdHandle (STD_ERROR_HANDLE);
+ SetStdHandle (STD_ERROR_HANDLE, hOldConErr);
+ if (hOldConErr != hErr)
+ CloseHandle (hErr);
+ hOldConErr = INVALID_HANDLE_VALUE;
+ }
+#endif /* FEATURE_REDIRECTION */
+}
+
+BOOL
+GrowIfNecessary ( UINT needed, LPTSTR* ret, UINT* retlen )
+{
+ if ( *ret && needed < *retlen )
+ return TRUE;
+ *retlen = needed;
+ if ( *ret )
+ free ( *ret );
+ *ret = (LPTSTR)malloc ( *retlen * sizeof(TCHAR) );
+ if ( !*ret )
+ SetLastError ( ERROR_OUTOFMEMORY );
+ return *ret != NULL;
+}
+
+LPCTSTR
+GetEnvVarOrSpecial ( LPCTSTR varName )
+{
+ static LPTSTR ret = NULL;
+ static UINT retlen = 0;
+ UINT size;
+
+ size = GetEnvironmentVariable ( varName, ret, retlen );
+ if ( size > retlen )
+ {
+ if ( !GrowIfNecessary ( size, &ret, &retlen ) )
+ return NULL;
+ size = GetEnvironmentVariable ( varName, ret, retlen );
+ }
+ if ( size )
+ return ret;
+
+ /* env var doesn't exist, look for a "special" one */
+ /* %CD% */
+ if (_tcsicmp(varName,_T("cd")) ==0)
+ {
+ size = GetCurrentDirectory ( retlen, ret );
+ if ( size > retlen )
+ {
+ if ( !GrowIfNecessary ( size, &ret, &retlen ) )
+ return NULL;
+ size = GetCurrentDirectory ( retlen, ret );
+ }
+ if ( !size )
+ return NULL;
+ return ret;
+ }
+ /* %TIME% */
+ else if (_tcsicmp(varName,_T("time")) ==0)
+ {
+ SYSTEMTIME t;
+ if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
+ return NULL;
+ GetSystemTime(&t);
+ _sntprintf ( ret, retlen, _T("%02d%c%02d%c%02d%c%02d"),
+ t.wHour, cTimeSeparator, t.wMinute, cTimeSeparator,
+ t.wSecond, cDecimalSeparator, t.wMilliseconds );
+ return ret;
+ }
+ /* %DATE% */
+ else if (_tcsicmp(varName,_T("date")) ==0)
+ {
+ LPTSTR tmp;
+
+ if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
+ return NULL;
+ size = GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), ret, retlen );
+ /* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */
+ if ( !size )
+ return NULL;
+ tmp = ret + _tcslen(ret);
+ *tmp++ = _T(' ');
+ size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, tmp, retlen-(tmp-ret));
+ /* TODO FIXME - test whether GetDateFormat() can return a value indicating the buffer wasn't big enough */
+ if ( !size )
+ return NULL;
+ return ret;
+ }
+
+ /* %RANDOM% */
+ else if (_tcsicmp(varName,_T("random")) ==0)
+ {
+ if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
+ return NULL;
+ /* Get random number */
+ _itot(rand(),ret,10);
+ return ret;
+ }
+
+ /* %CMDCMDLINE% */
+ else if (_tcsicmp(varName,_T("cmdcmdline")) ==0)
+ {
+ return GetCommandLine();
+ }
+
+ /* %CMDEXTVERSION% */
+ else if (_tcsicmp(varName,_T("cmdextversion")) ==0)
+ {
+ if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
+ return NULL;
+ /* Set version number to 2 */
+ _itot(2,ret,10);
+ return ret;
+ }
+
+ /* %ERRORLEVEL% */
+ else if (_tcsicmp(varName,_T("errorlevel")) ==0)
+ {
+ if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) )
+ return NULL;
+ _itot(nErrorLevel,ret,10);
+ return ret;
+ }
+
+ GrowIfNecessary(_tcslen(varName) + 2, &ret, &retlen);
+ _stprintf(ret,_T("%%%s%%"),varName);
+ return ret; /* not found - return orginal string */
+}
+
+LPCTSTR
+GetParsedEnvVar ( LPCTSTR varName, UINT* varNameLen, BOOL ModeSetA )
+{
+ static LPTSTR ret = NULL;
+ static UINT retlen = 0;
+ LPTSTR p, tmp;
+ UINT size;
+
+ if ( varNameLen )
+ *varNameLen = 0;
+ SetLastError(0);
+ if ( *varName++ != '%' )
+ return NULL;
+ switch ( *varName )
+ {
+ case _T('0'):
+ case _T('1'):
+ case _T('2'):
+ case _T('3'):
+ case _T('4'):
+ case _T('5'):
+ case _T('6'):
+ case _T('7'):
+ case _T('8'):
+ case _T('9'):
+ if ((tmp = FindArg (*varName - _T('0'))))
+ {
+ if ( varNameLen )
+ *varNameLen = 2;
+ if ( !*tmp )
+ return _T("");
+ if ( !GrowIfNecessary ( _tcslen(tmp)+1, &ret, &retlen ) )
+ return NULL;
+ _tcscpy ( ret, tmp );
+ return ret;
+ }
+ if ( !GrowIfNecessary ( 3, &ret, &retlen ) )
+ return NULL;
+ ret[0] = _T('%');
+ ret[1] = *varName;
+ ret[2] = 0;
+ if ( varNameLen )
+ *varNameLen = 2;
+ return ret;
+
+ case _T('%'):
+ if ( !GrowIfNecessary ( 2, &ret, &retlen ) )
+ return NULL;
+ ret[0] = _T('%');
+ ret[1] = 0;
+ if ( varNameLen )
+ *varNameLen = 2;
+ return ret;
+
+ case _T('?'):
+ /* TODO FIXME 10 is only max size for 32-bit */
+ if ( !GrowIfNecessary ( 11, &ret, &retlen ) )
+ return NULL;
+ _sntprintf ( ret, retlen, _T("%u"), nErrorLevel);
+ ret[retlen-1] = 0;
+ if ( varNameLen )
+ *varNameLen = 2;
+ return ret;
+ }
+ if ( ModeSetA )
+ {
+ /* HACK for set/a */
+ if ( !GrowIfNecessary ( 2, &ret, &retlen ) )
+ return NULL;
+ ret[0] = _T('%');
+ ret[1] = 0;
+ if ( varNameLen )
+ *varNameLen = 1;
+ return ret;
+ }
+ p = _tcschr ( varName, _T('%') );
+ if ( !p )
+ {
+ SetLastError ( ERROR_INVALID_PARAMETER );
+ return NULL;
+ }
+ size = p-varName;
+ if ( varNameLen )
+ *varNameLen = size + 2;
+ p = alloca ( (size+1) * sizeof(TCHAR) );
+ memmove ( p, varName, size * sizeof(TCHAR) );
+ p[size] = 0;
+ varName = p;
+ return GetEnvVarOrSpecial ( varName );
+}
+
+
+/*
+ * do the prompt/input/process loop
+ *
+ */
+
+static INT
+ProcessInput (BOOL bFlag)
+{
+ TCHAR commandline[CMDLINE_LENGTH];
+ TCHAR readline[CMDLINE_LENGTH];
+ LPTSTR ip;
+ LPTSTR cp;
+ LPCTSTR tmp;
+ BOOL bEchoThisLine;
+ BOOL bModeSetA;
+ BOOL bIsBatch;
+
+ do
+ {
+ /* if no batch input then... */
+ if (!(ip = ReadBatchLine (&bEchoThisLine)))
+ {
+ if (bFlag)
+ return nErrorLevel;
+
+ ReadCommand (readline, CMDLINE_LENGTH);
+ ip = readline;
+ bEchoThisLine = FALSE;
+ bIsBatch = FALSE;
+ }
+ else
+ {
+ bIsBatch = TRUE;
+ }
+
+ /* skip leading blanks */
+ while ( _istspace(*ip) )
+ ++ip;
+
+ cp = commandline;
+ bModeSetA = FALSE;
+ while (*ip)
+ {
+ if ( *ip == _T('%') )
+ {
+ UINT envNameLen;
+ LPCTSTR envVal = GetParsedEnvVar ( ip, &envNameLen, bModeSetA );
+ if ( envVal )
+ {
+ ip += envNameLen;
+ cp = _stpcpy ( cp, envVal );
+ }
+ }
+
+ if (_istcntrl (*ip))
+ *ip = _T(' ');
+ *cp++ = *ip++;
+
+ /* HACK HACK HACK check whether bModeSetA needs to be toggled */
+ *cp = 0;
+ tmp = commandline;
+ tmp += _tcsspn(tmp,_T(" \t"));
+ /* first we find and skip and pre-redirections... */
+ while (( tmp ) &&
+ ( _tcschr(_T("<>"),*tmp)
+ || !_tcsncmp(tmp,_T("1>"),2)
+ || !_tcsncmp(tmp,_T("2>"),2) ))
+ {
+ if ( _istdigit(*tmp) )
+ tmp += 2;
+ else
+ tmp++;
+ tmp += _tcsspn(tmp,_T(" \t"));
+ if ( *tmp == _T('\"') )
+ {
+ tmp = _tcschr(tmp+1,_T('\"'));
+ if ( tmp )
+ ++tmp;
+ }
+ else
+ tmp = _tcspbrk(tmp,_T(" \t"));
+ if ( tmp )
+ tmp += _tcsspn(tmp,_T(" \t"));
+ }
+ /* we should now be pointing to the actual command
+ * (if there is one yet)*/
+ if ( tmp )
+ {
+ /* if we're currently substituting ( which is default )
+ * check to see if we've parsed out a set/a. if so, we
+ * need to disable substitution until we come across a
+ * redirection */
+ if ( !bModeSetA )
+ {
+ /* look for set /a */
+ if ( !_tcsnicmp(tmp,_T("set"),3) )
+ {
+ tmp += 3;
+ tmp += _tcsspn(tmp,_T(" \t"));
+ if ( !_tcsnicmp(tmp,_T("/a"),2) )
+ bModeSetA = TRUE;
+ }
+ }
+ /* if we're not currently substituting, it means we're
+ * already inside a set /a. now we need to look for
+ * a redirection in order to turn redirection back on */
+ else
+ {
+ /* look for redirector of some kind after the command */
+ while ( (tmp = _tcspbrk ( tmp, _T("^<>|") )) )
+ {
+ if ( *tmp == _T('^') )
+ {
+ if ( _tcschr(_T("<>|&"), *++tmp ) && *tmp )
+ ++tmp;
+ }
+ else
+ {
+ bModeSetA = FALSE;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ *cp = _T('\0');
+
+ /* strip trailing spaces */
+ while ((--cp >= commandline) && _istspace (*cp));
+
+ *(cp + 1) = _T('\0');
+
+ /* JPP 19980807 */
+ /* Echo batch file line */
+ if (bEchoThisLine)
+ {
+ PrintPrompt ();
+ ConOutPuts (commandline);
+ }
+
+ if (!CheckCtrlBreak(BREAK_INPUT) && *commandline)
+ {
+ ParseCommandLine (commandline);
+ if (bEcho && !bIgnoreEcho && (!bIsBatch || bEchoThisLine))
+ ConOutChar ('\n');
+ bIgnoreEcho = FALSE;
+ }
+ }
+ while (!bCanExit || !bExit);
+
+ return nErrorLevel;
+}
+
+
+/*
+ * control-break handler.
+ */
+BOOL WINAPI BreakHandler (DWORD dwCtrlType)
+{
+
+ DWORD dwWritten;
+ INPUT_RECORD rec;
+ static BOOL SelfGenerated = FALSE;
+
+ if ((dwCtrlType != CTRL_C_EVENT) &&
+ (dwCtrlType != CTRL_BREAK_EVENT))
+ {
+ return FALSE;
+ }
+ else
+ {
+ if(SelfGenerated)
+ {
+ SelfGenerated = FALSE;
+ return TRUE;
+ }
+ }
+
+ if (bChildProcessRunning == TRUE)
+ {
+ SelfGenerated = TRUE;
+ GenerateConsoleCtrlEvent (dwCtrlType, 0);
+ return TRUE;
+ }
+
+
+ rec.EventType = KEY_EVENT;
+ rec.Event.KeyEvent.bKeyDown = TRUE;
+ rec.Event.KeyEvent.wRepeatCount = 1;
+ rec.Event.KeyEvent.wVirtualKeyCode = _T('C');
+ rec.Event.KeyEvent.wVirtualScanCode = _T('C') - 35;
+ rec.Event.KeyEvent.uChar.AsciiChar = _T('C');
+ rec.Event.KeyEvent.uChar.UnicodeChar = _T('C');
+ rec.Event.KeyEvent.dwControlKeyState = RIGHT_CTRL_PRESSED;
+
+ WriteConsoleInput(
+ hIn,
+ &rec,
+ 1,
+ &dwWritten);
+
+ bCtrlBreak = TRUE;
+ /* FIXME: Handle batch files */
+
+ //ConOutPrintf(_T("^C"));
+
+
+ return TRUE;
+}
+
+
+VOID AddBreakHandler (VOID)
+{
+ SetConsoleCtrlHandler ((PHANDLER_ROUTINE)BreakHandler, TRUE);
+}
+
+
+VOID RemoveBreakHandler (VOID)
+{
+ SetConsoleCtrlHandler ((PHANDLER_ROUTINE)BreakHandler, FALSE);
+}
+
+
+/*
+ * show commands and options that are available.
+ *
+ */
+#if 0
+static VOID
+ShowCommands (VOID)
+{
+ /* print command list */
+ ConOutResPuts(STRING_CMD_HELP1);
+ PrintCommandList();
+
+ /* print feature list */
+ ConOutResPuts(STRING_CMD_HELP2);
+
+#ifdef FEATURE_ALIASES
+ ConOutResPuts(STRING_CMD_HELP3);
+#endif
+#ifdef FEATURE_HISTORY
+ ConOutResPuts(STRING_CMD_HELP4);
+#endif
+#ifdef FEATURE_UNIX_FILENAME_COMPLETION
+ ConOutResPuts(STRING_CMD_HELP5);
+#endif
+#ifdef FEATURE_DIRECTORY_STACK
+ ConOutResPuts(STRING_CMD_HELP6);
+#endif
+#ifdef FEATURE_REDIRECTION
+ ConOutResPuts(STRING_CMD_HELP7);
+#endif
+ ConOutChar(_T('\n'));
+}
+#endif
+
+/*
+ * set up global initializations and process parameters
+ *
+ * argc - number of parameters to command.com
+ * argv - command-line parameters
+ *
+ */
+static VOID
+Initialize (int argc, TCHAR* argv[])
+{
+ TCHAR commandline[CMDLINE_LENGTH];
+ TCHAR ModuleName[_MAX_PATH + 1];
+ INT i;
+ TCHAR lpBuffer[2];
+
+ //INT len;
+ //TCHAR *ptr, *cmdLine;
+
+ /* get version information */
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx (&osvi);
+
+ /* Some people like to run ReactOS cmd.exe on Win98, it helps in the
+ * build process. So don't link implicitly against ntdll.dll, load it
+ * dynamically instead */
+
+ if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
+ {
+ /* ntdll is always present on NT */
+ NtDllModule = GetModuleHandle(TEXT("ntdll.dll"));
+ }
+ else
+ {
+ /* not all 9x versions have a ntdll.dll, try to load it */
+ NtDllModule = LoadLibrary(TEXT("ntdll.dll"));
+ }
+
+ if (NtDllModule != NULL)
+ {
+ NtQueryInformationProcessPtr = (NtQueryInformationProcessProc)GetProcAddress(NtDllModule, "NtQueryInformationProcess");
+ NtReadVirtualMemoryPtr = (NtReadVirtualMemoryProc)GetProcAddress(NtDllModule, "NtReadVirtualMemory");
+ }
+
+
+#ifdef _DEBUG
+ DebugPrintf (_T("[command args:\n"));
+ for (i = 0; i < argc; i++)
+ {
+ DebugPrintf (_T("%d. %s\n"), i, argv[i]);
+ }
+ DebugPrintf (_T("]\n"));
+#endif
+
+ InitLocale ();
+
+ /* get default input and output console handles */
+ hOut = GetStdHandle (STD_OUTPUT_HANDLE);
+ hIn = GetStdHandle (STD_INPUT_HANDLE);
+
+ /* Set EnvironmentVariable PROMPT if it does not exists any env value.
+ for you can change the EnvirommentVariable for prompt before cmd start
+ this patch are not 100% right, if it does not exists a PROMPT value cmd should use
+ $P$G as defualt not set EnvirommentVariable PROMPT to $P$G if it does not exists */
+ if (GetEnvironmentVariable(_T("PROMPT"),lpBuffer, sizeof(lpBuffer) / sizeof(lpBuffer[0])) == 0)
+ SetEnvironmentVariable (_T("PROMPT"), _T("$P$G"));
+
+
+ if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_CMD_HELP8);
+ ExitProcess(0);
+ }
+ SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT);
+
+#ifdef INCLUDE_CMD_CHDIR
+ InitLastPath ();
+#endif
+
+#ifdef FATURE_ALIASES
+ InitializeAlias ();
+#endif
+
+ if (argc >= 2)
+ {
+ for (i = 1; i < argc; i++)
+ {
+ if (!_tcsicmp (argv[i], _T("/p")))
+ {
+ if (!IsExistingFile (_T("\\autoexec.bat")))
+ {
+#ifdef INCLUDE_CMD_DATE
+ cmd_date (_T(""), _T(""));
+#endif
+#ifdef INCLUDE_CMD_TIME
+ cmd_time (_T(""), _T(""));
+#endif
+ }
+ else
+ {
+ ParseCommandLine (_T("\\autoexec.bat"));
+ }
+ bCanExit = FALSE;
+ }
+ else if (!_tcsicmp (argv[i], _T("/c")))
+ {
+ /* This just runs a program and exits */
+ ++i;
+ if (i < argc)
+ {
+ _tcscpy (commandline, argv[i]);
+ while (++i < argc)
+ {
+ _tcscat (commandline, _T(" "));
+ _tcscat (commandline, argv[i]);
+ }
+
+ ParseCommandLine(commandline);
+ ExitProcess (ProcessInput (TRUE));
+ }
+ else
+ {
+ ExitProcess (0);
+ }
+ }
+ else if (!_tcsicmp (argv[i], _T("/k")))
+ {
+ /* This just runs a program and remains */
+ ++i;
+ if (i < argc)
+ {
+ _tcscpy (commandline, _T("\""));
+ _tcscat (commandline, argv[i]);
+ _tcscat (commandline, _T("\""));
+ while (++i < argc)
+ {
+ _tcscat (commandline, _T(" "));
+ _tcscat (commandline, argv[i]);
+ }
+ ParseCommandLine(commandline);
+ }
+ }
+#ifdef INCLUDE_CMD_COLOR
+ else if (!_tcsnicmp (argv[i], _T("/t:"), 3))
+ {
+ /* process /t (color) argument */
+ wDefColor = (WORD)_tcstoul (&argv[i][3], NULL, 16);
+ wColor = wDefColor;
+ SetScreenColor (wColor, TRUE);
+ }
+#endif
+ }
+ }
+
+ /* run cmdstart.bat */
+ if (IsExistingFile (_T("cmdstart.bat")))
+ {
+ ParseCommandLine (_T("cmdstart.bat"));
+ }
+ else if (IsExistingFile (_T("\\cmdstart.bat")))
+ {
+ ParseCommandLine (_T("\\cmdstart.bat"));
+ }
+
+#ifdef FEATURE_DIR_STACK
+ /* initialize directory stack */
+ InitDirectoryStack ();
+#endif
+
+
+#ifdef FEATURE_HISTORY
+ /*initialize history*/
+ InitHistory();
+#endif
+
+ /* Set COMSPEC environment variable */
+ if (0 != GetModuleFileName (NULL, ModuleName, _MAX_PATH + 1))
+ {
+ ModuleName[_MAX_PATH] = _T('\0');
+ SetEnvironmentVariable (_T("COMSPEC"), ModuleName);
+ }
+
+ /* add ctrl break handler */
+ AddBreakHandler ();
+}
+
+
+static VOID Cleanup (int argc, TCHAR *argv[])
+{
+ /* run cmdexit.bat */
+ if (IsExistingFile (_T("cmdexit.bat")))
+ {
+ ConErrResPuts(STRING_CMD_ERROR5);
+
+ ParseCommandLine (_T("cmdexit.bat"));
+ }
+ else if (IsExistingFile (_T("\\cmdexit.bat")))
+ {
+ ConErrResPuts (STRING_CMD_ERROR5);
+ ParseCommandLine (_T("\\cmdexit.bat"));
+ }
+
+#ifdef FEATURE_ALIASES
+ DestroyAlias ();
+#endif
+
+#ifdef FEATURE_DIECTORY_STACK
+ /* destroy directory stack */
+ DestroyDirectoryStack ();
+#endif
+
+#ifdef INCLUDE_CMD_CHDIR
+ FreeLastPath ();
+#endif
+
+#ifdef FEATURE_HISTORY
+ CleanHistory();
+#endif
+
+
+ /* remove ctrl break handler */
+ RemoveBreakHandler ();
+ SetConsoleMode( GetStdHandle( STD_INPUT_HANDLE ),
+ ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT );
+
+ if (NtDllModule != NULL)
+ {
+ FreeLibrary(NtDllModule);
+ }
+}
+
+/*
+ * main function
+ */
+#ifdef _UNICODE
+int _main(void)
+#else
+int _main (int argc, char *argv[])
+#endif
+{
+ TCHAR startPath[MAX_PATH];
+ CONSOLE_SCREEN_BUFFER_INFO Info;
+ INT nExitCode;
+#ifdef _UNICODE
+ PWCHAR * argv;
+ int argc=0;
+ argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+#endif
+
+ GetCurrentDirectory(MAX_PATH,startPath);
+ _tchdir(startPath);
+
+ SetFileApisToOEM();
+ InputCodePage= 0;
+ OutputCodePage = 0;
+
+ hConsole = CreateFile(_T("CONOUT$"), GENERIC_READ|GENERIC_WRITE,
+ FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, 0, NULL);
+ if (GetConsoleScreenBufferInfo(hConsole, &Info) == FALSE)
+ {
+ ConErrFormatMessage(GetLastError());
+ return(1);
+ }
+ wColor = Info.wAttributes;
+ wDefColor = wColor;
+
+ InputCodePage= GetConsoleCP();
+ OutputCodePage = GetConsoleOutputCP();
+ CMD_ModuleHandle = GetModuleHandle(NULL);
+
+ /* check switches on command-line */
+ Initialize(argc, argv);
+
+ /* call prompt routine */
+ nExitCode = ProcessInput(FALSE);
+
+ /* do the cleanup */
+ Cleanup(argc, argv);
+
+ return(nExitCode);
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/cmd.h b/reactos/base/shell/cmd/cmd.h
new file mode 100644
index 00000000000..5134f80eb01
--- /dev/null
+++ b/reactos/base/shell/cmd/cmd.h
@@ -0,0 +1,405 @@
+/*
+ * CMD.H - header file for the modules in CMD.EXE
+ *
+ *
+ * History:
+ *
+ * 7-15-95 Tim Norman
+ * started
+ *
+ * 06/29/98 (Rob Lake)
+ * Moved error messages in here
+ *
+ * 07/12/98 (Rob Lake)
+ * Moved more error messages here.
+ *
+ * 30-Jul-1998 (John P Price )
+ * Added compile date to version.
+ *
+ * 26-Feb-1999 (Eric Kohl )
+ * Introduced a new version string.
+ * Thanks to Emanuele Aliberti!
+ */
+
+#ifndef _CMD_H_INCLUDED_
+#define _CMD_H_INCLUDED_
+
+#include "config.h"
+
+#include
+#include
+
+#include "cmdver.h"
+
+#define BREAK_BATCHFILE 1
+#define BREAK_OUTOFBATCH 2
+#define BREAK_INPUT 3
+#define BREAK_IGNORE 4
+
+/* define some error messages */
+
+#define D_ON _T("on")
+#define D_OFF _T("off")
+
+
+/* command line buffer length */
+#define CMDLINE_LENGTH 8192
+
+/* global variables */
+extern HANDLE hOut;
+extern HANDLE hIn;
+extern HANDLE hConsole;
+extern WORD wColor;
+extern WORD wDefColor;
+extern BOOL bCtrlBreak;
+extern BOOL bIgnoreEcho;
+extern BOOL bExit;
+extern INT nErrorLevel;
+extern SHORT maxx;
+extern SHORT maxy;
+extern OSVERSIONINFO osvi;
+
+
+
+/* Prototypes for ALIAS.C */
+VOID InitializeAlias (VOID);
+VOID DestroyAlias (VOID);
+VOID ExpandAlias (LPTSTR, INT);
+INT CommandAlias (LPTSTR, LPTSTR);
+
+
+/* Prototypes for ATTRIB.C */
+INT CommandAttrib (LPTSTR, LPTSTR);
+
+
+/* Prototypes for BEEP.C */
+INT cmd_beep (LPTSTR, LPTSTR);
+
+
+/* Prototypes for CALL.C */
+INT cmd_call (LPTSTR, LPTSTR);
+
+
+/* Prototypes for CHCP.C */
+INT CommandChcp (LPTSTR, LPTSTR);
+
+
+/* Prototypes for CHOICE.C */
+INT CommandChoice (LPTSTR, LPTSTR);
+
+
+/* Prototypes for CLS.C */
+INT cmd_cls (LPTSTR, LPTSTR);
+
+
+/* Prototypes for CMD.C */
+INT ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len, BOOL bPutSeperator);
+VOID ParseCommandLine (LPTSTR);
+LPCTSTR GetEnvVarOrSpecial ( LPCTSTR varName );
+VOID AddBreakHandler (VOID);
+VOID RemoveBreakHandler (VOID);
+
+extern HANDLE CMD_ModuleHandle;
+
+
+/* Prototypes for CMDINPUT.C */
+VOID ReadCommand (LPTSTR, INT);
+
+
+/* Prototypes for CMDTABLE.C */
+#define CMD_SPECIAL 1
+#define CMD_BATCHONLY 2
+#define CMD_HIDE 4
+
+typedef struct tagCOMMAND
+{
+ LPTSTR name;
+ INT flags;
+ INT (*func) (LPTSTR, LPTSTR);
+} COMMAND, *LPCOMMAND;
+
+extern COMMAND cmds[]; /* The internal command table */
+
+VOID PrintCommandList (VOID);
+VOID PrintCommandListDetail (VOID);
+
+
+/* Prototypes for COLOR.C */
+VOID SetScreenColor(WORD wArgColor, BOOL bFill);
+INT CommandColor (LPTSTR, LPTSTR);
+
+
+/* Prototypes for CONSOLE.C */
+#ifdef _DEBUG
+VOID DebugPrintf (LPTSTR, ...);
+#endif /* _DEBUG */
+
+VOID ConInDummy (VOID);
+VOID ConInDisable (VOID);
+VOID ConInEnable (VOID);
+VOID ConInFlush (VOID);
+VOID ConInKey (PINPUT_RECORD);
+VOID ConInString (LPTSTR, DWORD);
+
+VOID ConOutChar (TCHAR);
+VOID ConOutPuts (LPTSTR);
+VOID ConOutPrintf (LPTSTR, ...);
+INT ConOutPrintfPaging (BOOL NewPage, LPTSTR, ...);
+VOID ConErrChar (TCHAR);
+VOID ConErrPuts (LPTSTR);
+VOID ConErrPrintf (LPTSTR, ...);
+VOID ConOutFormatMessage (DWORD MessageId, ...);
+VOID ConErrFormatMessage (DWORD MessageId, ...);
+
+SHORT GetCursorX (VOID);
+SHORT GetCursorY (VOID);
+VOID GetCursorXY (PSHORT, PSHORT);
+VOID SetCursorXY (SHORT, SHORT);
+
+VOID GetScreenSize (PSHORT, PSHORT);
+VOID SetCursorType (BOOL, BOOL);
+
+VOID ConOutResPuts (UINT resID);
+VOID ConErrResPuts (UINT resID);
+VOID ConOutResPaging(BOOL NewPage, UINT resID);
+
+/* Prototypes for COPY.C */
+INT cmd_copy (LPTSTR, LPTSTR);
+
+
+/* Prototypes for DATE.C */
+INT cmd_date (LPTSTR, LPTSTR);
+
+
+/* Prototypes for DEL.C */
+INT CommandDelete (LPTSTR, LPTSTR);
+
+
+/* Prototypes for DELAY.C */
+INT CommandDelay (LPTSTR, LPTSTR);
+
+
+/* Prototypes for DIR.C */
+INT CommandDir (LPTSTR, LPTSTR);
+
+
+/* Prototypes for DIRSTACK.C */
+VOID InitDirectoryStack (VOID);
+VOID DestroyDirectoryStack (VOID);
+INT GetDirectoryStackDepth (VOID);
+INT CommandPushd (LPTSTR, LPTSTR);
+INT CommandPopd (LPTSTR, LPTSTR);
+INT CommandDirs (LPTSTR, LPTSTR);
+
+
+/* Prototypes for ECHO.C */
+INT CommandEcho (LPTSTR, LPTSTR);
+INT CommandEchos (LPTSTR, LPTSTR);
+INT CommandEchoerr (LPTSTR, LPTSTR);
+INT CommandEchoserr (LPTSTR, LPTSTR);
+
+
+/* Prototypes for ERROR.C */
+VOID ErrorMessage (DWORD, LPTSTR, ...);
+
+VOID error_no_pipe (VOID);
+VOID error_bad_command (VOID);
+VOID error_invalid_drive (VOID);
+VOID error_req_param_missing (VOID);
+VOID error_sfile_not_found (LPTSTR);
+VOID error_file_not_found (VOID);
+VOID error_path_not_found (VOID);
+VOID error_too_many_parameters (LPTSTR);
+VOID error_parameter_format(TCHAR);
+VOID error_invalid_switch (TCHAR);
+VOID error_invalid_parameter_format (LPTSTR);
+VOID error_out_of_memory (VOID);
+VOID error_syntax (LPTSTR);
+
+VOID msg_pause (VOID);
+
+
+/* Prototypes for FILECOMP.C */
+#ifdef FEATURE_UNIX_FILENAME_COMPLETION
+VOID CompleteFilename (LPTSTR, UINT);
+INT ShowCompletionMatches (LPTSTR, INT);
+#endif
+#ifdef FEATURE_4NT_FILENAME_COMPLETION
+VOID CompleteFilename (LPTSTR, BOOL, LPTSTR, UINT);
+#endif
+
+
+/* Prototypes for FOR.C */
+INT cmd_for (LPTSTR, LPTSTR);
+
+
+/* Prototypes for FREE.C */
+INT CommandFree (LPTSTR, LPTSTR);
+
+
+/* Prototypes for GOTO.C */
+INT cmd_goto (LPTSTR, LPTSTR);
+
+
+/* Prototypes for HISTORY.C */
+#ifdef FEATURE_HISTORY
+VOID History (INT, LPTSTR);/*add entries browse history*/
+VOID History_move_to_bottom(VOID);/*F3*/
+VOID InitHistory(VOID);
+VOID CleanHistory(VOID);
+VOID History_del_current_entry(LPTSTR str);/*CTRL-D*/
+INT CommandHistory (LPTSTR cmd, LPTSTR param);
+#endif
+
+
+/* Prototypes for INTERNAL.C */
+VOID InitLastPath (VOID);
+VOID FreeLastPath (VOID);
+INT cmd_chdir (LPTSTR, LPTSTR);
+INT cmd_mkdir (LPTSTR, LPTSTR);
+INT cmd_rmdir (LPTSTR, LPTSTR);
+INT CommandExit (LPTSTR, LPTSTR);
+INT CommandRem (LPTSTR, LPTSTR);
+INT CommandShowCommands (LPTSTR, LPTSTR);
+INT CommandShowCommandsDetail (LPTSTR, LPTSTR);
+
+/* Prototypes for LABEL.C */
+INT cmd_label (LPTSTR, LPTSTR);
+
+
+/* Prototypes for LOCALE.C */
+extern TCHAR cDateSeparator;
+extern INT nDateFormat;
+extern TCHAR cTimeSeparator;
+extern INT nTimeFormat;
+extern TCHAR cThousandSeparator;
+extern TCHAR cDecimalSeparator;
+extern INT nNumberGroups;
+
+
+VOID InitLocale (VOID);
+VOID PrintDate (VOID);
+VOID PrintTime (VOID);
+
+/* cache codepage */
+extern UINT InputCodePage;
+extern UINT OutputCodePage;
+
+/* Prototypes for MEMORY.C */
+INT CommandMemory (LPTSTR, LPTSTR);
+
+
+/* Prototypes for MISC.C */
+INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size);
+BOOL SetRootPath(TCHAR *InPath);
+TCHAR cgetchar (VOID);
+BOOL CheckCtrlBreak (INT);
+BOOL add_entry (LPINT ac, LPTSTR **arg, LPCTSTR entry);
+LPTSTR *split (LPTSTR, LPINT, BOOL);
+VOID freep (LPTSTR *);
+LPTSTR _stpcpy (LPTSTR, LPCTSTR);
+BOOL IsValidPathName (LPCTSTR);
+BOOL IsExistingFile (LPCTSTR);
+BOOL IsExistingDirectory (LPCTSTR);
+BOOL FileGetString (HANDLE, LPTSTR, INT);
+VOID GetPathCase(TCHAR *, TCHAR *);
+
+#define PROMPT_NO 0
+#define PROMPT_YES 1
+#define PROMPT_ALL 2
+#define PROMPT_BREAK 3
+
+INT PagePrompt (VOID);
+INT FilePromptYN (LPTSTR, ...);
+INT FilePromptYNA (LPTSTR, ...);
+
+
+/* Prototypes for MOVE.C */
+INT cmd_move (LPTSTR, LPTSTR);
+
+
+/* Prototypes for MSGBOX.C */
+INT CommandMsgbox (LPTSTR, LPTSTR);
+
+
+/* Prototypes from PATH.C */
+INT cmd_path (LPTSTR, LPTSTR);
+
+
+/* Prototypes from PROMPT.C */
+VOID PrintPrompt (VOID);
+INT cmd_prompt (LPTSTR, LPTSTR);
+
+
+/* Prototypes for REDIR.C */
+#define INPUT_REDIRECTION 1
+#define OUTPUT_REDIRECTION 2
+#define OUTPUT_APPEND 4
+#define ERROR_REDIRECTION 8
+#define ERROR_APPEND 16
+INT GetRedirection (LPTSTR, LPTSTR, LPTSTR, LPTSTR, LPINT);
+
+
+/* Prototypes for REN.C */
+INT cmd_rename (LPTSTR, LPTSTR);
+
+
+/* Prototypes for SCREEN.C */
+INT CommandScreen (LPTSTR, LPTSTR);
+
+
+/* Prototypes for SET.C */
+INT cmd_set (LPTSTR, LPTSTR);
+
+
+/* Prototypes for START.C */
+INT cmd_start (LPTSTR, LPTSTR);
+
+
+/* Prototypes for STRTOCLR.C */
+BOOL StringToColor (LPWORD, LPTSTR *);
+
+
+/* Prototypes for TIME.C */
+INT cmd_time (LPTSTR, LPTSTR);
+
+
+/* Prototypes for TIMER.C */
+INT CommandTimer (LPTSTR cmd, LPTSTR param);
+
+
+/* Prototypes for TITLE.C */
+INT cmd_title (LPTSTR, LPTSTR);
+
+
+/* Prototypes for TYPE.C */
+INT cmd_type (LPTSTR, LPTSTR);
+
+
+/* Prototypes for VER.C */
+VOID ShortVersion (VOID);
+INT cmd_ver (LPTSTR, LPTSTR);
+
+
+/* Prototypes for VERIFY.C */
+INT cmd_verify (LPTSTR, LPTSTR);
+
+
+/* Prototypes for VOL.C */
+INT cmd_vol (LPTSTR, LPTSTR);
+
+
+/* Prototypes for WHERE.C */
+BOOL SearchForExecutable (LPCTSTR, LPTSTR);
+
+/* Prototypes for WINDOW.C */
+INT CommandActivate (LPTSTR, LPTSTR);
+INT CommandWindow (LPTSTR, LPTSTR);
+
+
+/* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
+int cmd_if(TCHAR *, TCHAR *);
+int cmd_pause(TCHAR *, TCHAR *);
+int cmd_shift(TCHAR *, TCHAR *);
+
+#endif /* _CMD_H_INCLUDED_ */
diff --git a/reactos/base/shell/cmd/cmd.rc b/reactos/base/shell/cmd/cmd.rc
new file mode 100644
index 00000000000..9c6a262db2a
--- /dev/null
+++ b/reactos/base/shell/cmd/cmd.rc
@@ -0,0 +1,39 @@
+#include
+#include "cmdver.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Command Processor\0"
+#define REACTOS_STR_INTERNAL_NAME "cmd\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "cmd.exe\0"
+#define REACTOS_STR_ORIGINAL_COPYRIGHT "Copyright (C) 1994-1998 Tim Norman and others\0"
+#define REACTOS_STR_LEGAL_COPYRIGHT "Copyright (C) 1998-2006 Eric Kohl and others\0"
+
+#include
+#include "En.rc"
+#include "Fr.rc"
+#include "De.rc"
+#include "Es.rc"
+#include "Ru.rc"
+#include "Ja.rc"
+#include "Hu.rc"
+
+
+STRINGTABLE DISCARDABLE
+{
+ STRING_FREEDOS_DEV, " Tim Norman Matt Rains\n\
+ Evan Jeffrey Steffen Kaiser\n\
+ Svante Frey Oliver Mueller\n\
+ Aaron Kaufman Marc Desrochers\n\
+ Rob Lake John P Price\n\
+ Hans B Pufal\n"
+
+ STRING_REACTOS_DEV, " Eric Kohl Emanuele Aliberti\n\
+ Paolo Pantaleo Phillip Susi\n\
+ Sylvain Petreolle\n"
+}
+
+1 ICON DISCARDABLE res/terminal.ico
+
+
+
+
+
diff --git a/reactos/base/shell/cmd/cmd.xml b/reactos/base/shell/cmd/cmd.xml
new file mode 100644
index 00000000000..a36da9fa6a1
--- /dev/null
+++ b/reactos/base/shell/cmd/cmd.xml
@@ -0,0 +1,77 @@
+
+ include/wine
+ .
+
+
+ 0x0501
+ precomp.h
+
+ alias.c
+ attrib.c
+ batch.c
+ beep.c
+ call.c
+ chcp.c
+ choice.c
+ cls.c
+ cmd.c
+ cmdinput.c
+ cmdtable.c
+ color.c
+ console.c
+ copy.c
+ date.c
+ del.c
+ delay.c
+ dir.c
+ dirstack.c
+ echo.c
+ error.c
+ filecomp.c
+ for.c
+ free.c
+ goto.c
+ history.c
+ if.c
+ internal.c
+ label.c
+ locale.c
+ memory.c
+ misc.c
+ move.c
+ msgbox.c
+ path.c
+ pause.c
+ prompt.c
+ redir.c
+ ren.c
+ screen.c
+ set.c
+ shift.c
+ start.c
+ strtoclr.c
+ time.c
+ timer.c
+ title.c
+ type.c
+ ver.c
+ verify.c
+ vol.c
+ where.c
+ window.c
+
+
+
+ include/wine
+ .
+
+
+ 0x0501
+ kernel32
+ cmd_base
+ main.c
+ cmd.rc
+
+
+
+
diff --git a/reactos/base/shell/cmd/cmdinput.c b/reactos/base/shell/cmd/cmdinput.c
new file mode 100644
index 00000000000..2bb36e3c350
--- /dev/null
+++ b/reactos/base/shell/cmd/cmdinput.c
@@ -0,0 +1,574 @@
+/*
+ * CMDINPUT.C - handles command input (tab completion, history, etc.).
+ *
+ *
+ * History:
+ *
+ * 01/14/95 (Tim Norman)
+ * started.
+ *
+ * 08/08/95 (Matt Rains)
+ * i have cleaned up the source code. changes now bring this source
+ * into guidelines for recommended programming practice.
+ * i have added some constants to help making changes easier.
+ *
+ * 12/12/95 (Tim Norman)
+ * added findxy() function to get max x/y coordinates to display
+ * correctly on larger screens
+ *
+ * 12/14/95 (Tim Norman)
+ * fixed the Tab completion code that Matt Rains broke by moving local
+ * variables to a more global scope and forgetting to initialize them
+ * when needed
+ *
+ * 8/1/96 (Tim Norman)
+ * fixed a bug in tab completion that caused filenames at the beginning
+ * of the command-line to have their first letter truncated
+ *
+ * 9/1/96 (Tim Norman)
+ * fixed a silly bug using printf instead of fputs, where typing "%i"
+ * confused printf :)
+ *
+ * 6/14/97 (Steffan Kaiser)
+ * ctrl-break checking
+ *
+ * 6/7/97 (Marc Desrochers)
+ * recoded everything! now properly adjusts when text font is changed.
+ * removed findxy(), reposition(), and reprint(), as these functions
+ * were inefficient. added goxy() function as gotoxy() was buggy when
+ * the screen font was changed. the printf() problem with %i on the
+ * command line was fixed by doing printf("%s",str) instead of
+ * printf(str). Don't ask how I find em just be glad I do :)
+ *
+ * 7/12/97 (Tim Norman)
+ * Note: above changes pre-empted Steffan's ctrl-break checking.
+ *
+ * 7/7/97 (Marc Desrochers)
+ * rewrote a new findxy() because the new dir() used it. This
+ * findxy() simply returns the values of *maxx *maxy. In the
+ * future, please use the pointers, they will always be correct
+ * since they point to BIOS values.
+ *
+ * 7/8/97 (Marc Desrochers)
+ * once again removed findxy(), moved the *maxx, *maxy pointers
+ * global and included them as externs in command.h. Also added
+ * insert/overstrike capability
+ *
+ * 7/13/97 (Tim Norman)
+ * added different cursor appearance for insert/overstrike mode
+ *
+ * 7/13/97 (Tim Norman)
+ * changed my code to use _setcursortype until I can figure out why
+ * my code is crashing on some machines. It doesn't crash on mine :)
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 28-Jul-1998 (John P Price )
+ * put ifdef's around filename completion code.
+ *
+ * 30-Jul-1998 (John P Price )
+ * moved filename completion code to filecomp.c
+ * made second TAB display list of filename matches
+ *
+ * 31-Jul-1998 (John P Price )
+ * Fixed bug where if you typed something, then hit HOME, then tried
+ * to type something else in insert mode, it crashed.
+ *
+ * 07-Aug-1998 (John P Price )
+ * Fixed carrage return output to better match MSDOS with echo
+ * on or off.(marked with "JPP 19980708")
+ *
+ * 13-Dec-1998 (Eric Kohl )
+ * Added insert/overwrite cursor.
+ *
+ * 25-Jan-1998 (Eric Kohl )
+ * Replaced CRT io functions by Win32 console io functions.
+ * This can handle - for 4NT filename completion.
+ * Unicode and redirection safe!
+ *
+ * 04-Feb-1999 (Eric Kohl )
+ * Fixed input bug. A "line feed" character remained in the keyboard
+ * input queue when you pressed . This sometimes caused
+ * some very strange effects.
+ * Fixed some command line editing annoyances.
+ *
+ * 30-Apr-2004 (Filip Navara )
+ * Fixed problems when the screen was scrolled away.
+ */
+
+#include
+#include "resource.h"
+
+
+SHORT maxx;
+SHORT maxy;
+
+/*
+ * global command line insert/overwrite flag
+ */
+static BOOL bInsert = TRUE;
+
+
+static VOID
+ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy)
+{
+ INT count;
+
+ SetCursorXY (orgx, orgy);
+ for (count = 0; count < (INT)_tcslen (str); count++)
+ ConOutChar (_T(' '));
+ _tcsnset (str, _T('\0'), maxlen);
+ SetCursorXY (orgx, orgy);
+}
+
+
+/* read in a command line */
+VOID ReadCommand (LPTSTR str, INT maxlen)
+{
+ SHORT orgx; /* origin x/y */
+ SHORT orgy;
+ SHORT curx; /*current x/y cursor position*/
+ SHORT cury;
+ SHORT tempscreen;
+ INT count; /*used in some for loops*/
+ INT current = 0; /*the position of the cursor in the string (str)*/
+ INT charcount = 0;/*chars in the string (str)*/
+ INPUT_RECORD ir;
+ WORD wLastKey = 0;
+ TCHAR ch;
+ BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/
+ BOOL bReturn = FALSE;
+ TCHAR szPath[MAX_PATH];
+ BOOL bCharInput;
+
+ /* get screen size */
+ GetScreenSize (&maxx, &maxy);
+
+ /* JPP 19980807 - if echo off, don't print prompt */
+ if (bEcho)
+ PrintPrompt();
+
+ GetCursorXY (&orgx, &orgy);
+ GetCursorXY (&curx, &cury);
+
+ memset (str, 0, maxlen * sizeof (TCHAR));
+
+ SetCursorType (bInsert, TRUE);
+
+ do
+ {
+
+ bReturn = FALSE;
+
+ ConInKey (&ir);
+
+ if (ir.Event.KeyEvent.dwControlKeyState &
+ (RIGHT_ALT_PRESSED|RIGHT_ALT_PRESSED|
+ RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED) )
+ {
+
+ switch (ir.Event.KeyEvent.wVirtualKeyCode)
+ {
+
+#ifdef FEATURE_HISTORY
+
+ case 'K':
+ /*add the current command line to the history*/
+ if (ir.Event.KeyEvent.dwControlKeyState &
+ (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
+ {
+
+ if (str[0])
+ History(0,str);
+
+ ClearCommandLine (str, maxlen, orgx, orgy);
+ current = charcount = 0;
+ curx = orgx;
+ cury = orgy;
+ bContinue=TRUE;
+ break;
+ }
+
+ case 'D':
+ /*delete current history entry*/
+ if (ir.Event.KeyEvent.dwControlKeyState &
+ (LEFT_CTRL_PRESSED|RIGHT_CTRL_PRESSED))
+ {
+ ClearCommandLine (str, maxlen, orgx, orgy);
+ History_del_current_entry(str);
+ current = charcount = _tcslen (str);
+ ConOutPrintf (_T("%s"), str);
+ GetCursorXY (&curx, &cury);
+ bContinue=TRUE;
+ break;
+ }
+
+#endif/*FEATURE_HISTORY*/
+ }
+
+
+
+
+ }
+
+ //if (bContinue)
+ // continue;
+
+
+ bCharInput = FALSE;
+
+ switch (ir.Event.KeyEvent.wVirtualKeyCode)
+ {
+ case VK_BACK:
+ /* - delete character to left of cursor */
+ if (current > 0 && charcount > 0)
+ {
+ if (current == charcount)
+ {
+ /* if at end of line */
+ str[current - 1] = _T('\0');
+ if (GetCursorX () != 0)
+ {
+ ConOutPrintf (_T("\b \b"));
+ curx--;
+ }
+ else
+ {
+ SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
+ ConOutChar (_T(' '));
+ SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
+ cury--;
+ curx = maxx - 1;
+ }
+ }
+ else
+ {
+ for (count = current - 1; count < charcount; count++)
+ str[count] = str[count + 1];
+ if (GetCursorX () != 0)
+ {
+ SetCursorXY ((SHORT)(GetCursorX () - 1), GetCursorY ());
+ curx--;
+ }
+ else
+ {
+ SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
+ cury--;
+ curx = maxx - 1;
+ }
+ GetCursorXY (&curx, &cury);
+ ConOutPrintf (_T("%s "), &str[current - 1]);
+ SetCursorXY (curx, cury);
+ }
+ charcount--;
+ current--;
+ }
+ break;
+
+ case VK_INSERT:
+ /* toggle insert/overstrike mode */
+ bInsert ^= TRUE;
+ SetCursorType (bInsert, TRUE);
+ break;
+
+ case VK_DELETE:
+ /* delete character under cursor */
+ if (current != charcount && charcount > 0)
+ {
+ for (count = current; count < charcount; count++)
+ str[count] = str[count + 1];
+ charcount--;
+ GetCursorXY (&curx, &cury);
+ ConOutPrintf (_T("%s "), &str[current]);
+ SetCursorXY (curx, cury);
+ }
+ break;
+
+ case VK_HOME:
+ /* goto beginning of string */
+ if (current != 0)
+ {
+ SetCursorXY (orgx, orgy);
+ curx = orgx;
+ cury = orgy;
+ current = 0;
+ }
+ break;
+
+ case VK_END:
+ /* goto end of string */
+ if (current != charcount)
+ {
+ SetCursorXY (orgx, orgy);
+ ConOutPrintf (_T("%s"), str);
+ GetCursorXY (&curx, &cury);
+ current = charcount;
+ }
+ break;
+
+ case VK_TAB:
+#ifdef FEATURE_UNIX_FILENAME_COMPLETION
+ /* expand current file name */
+ if ((current == charcount) ||
+ (current == charcount - 1 &&
+ str[current] == _T('"'))) /* only works at end of line*/
+ {
+ if (wLastKey != VK_TAB)
+ {
+ /* if first TAB, complete filename*/
+ tempscreen = charcount;
+ CompleteFilename (str, charcount);
+ charcount = _tcslen (str);
+ current = charcount;
+
+ SetCursorXY (orgx, orgy);
+ ConOutPrintf (_T("%s"), str);
+
+ if (tempscreen > charcount)
+ {
+ GetCursorXY (&curx, &cury);
+ for (count = tempscreen - charcount; count--; )
+ ConOutChar (_T(' '));
+ SetCursorXY (curx, cury);
+ }
+ else
+ {
+ if (((charcount + orgx) / maxx) + orgy > maxy - 1)
+ orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
+ }
+
+ /* set cursor position */
+ SetCursorXY ((orgx + current) % maxx,
+ orgy + (orgx + current) / maxx);
+ GetCursorXY (&curx, &cury);
+ }
+ else
+ {
+ /*if second TAB, list matches*/
+ if (ShowCompletionMatches (str, charcount))
+ {
+ PrintPrompt ();
+ GetCursorXY (&orgx, &orgy);
+ ConOutPrintf (_T("%s"), str);
+
+ /* set cursor position */
+ SetCursorXY ((orgx + current) % maxx,
+ orgy + (orgx + current) / maxx);
+ GetCursorXY (&curx, &cury);
+ }
+
+ }
+ }
+ else
+ {
+ MessageBeep (-1);
+ }
+#endif
+#ifdef FEATURE_4NT_FILENAME_COMPLETION
+
+ /* used to later see if we went down to the next line */
+ tempscreen = charcount;
+ szPath[0]=_T('\0');
+
+ /* str is the whole things that is on the current line
+ that is and and out. arg 2 is weather it goes back
+ one file or forward one file */
+ CompleteFilename(str, !(ir.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED), szPath, current);
+ /* Attempt to clear the line */
+ ClearCommandLine (str, maxlen, orgx, orgy);
+ curx = orgx;
+ cury = orgy;
+ current = charcount = 0;
+ //str[0]=_T('\0');
+
+ /* Everything is deleted, lets add it back in */
+ _tcscpy(str,szPath);
+
+ /* Figure out where cusor is going to be after we print it */
+ charcount = _tcslen (str);
+ current = charcount;
+
+ SetCursorXY (orgx, orgy);
+ /* Print out what we have now */
+ ConOutPrintf (_T("%s"), str);
+
+ /* Move cursor accordingly */
+ if(tempscreen > charcount)
+ {
+ GetCursorXY (&curx, &cury);
+ for(count = tempscreen - charcount; count--; )
+ ConOutChar (_T(' '));
+ SetCursorXY (curx, cury);
+ }
+ else
+ {
+ if(((charcount + orgx) / maxx) + orgy > maxy - 1)
+ orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
+ }
+ SetCursorXY((short)(((int)orgx + current) % maxx), (short)((int)orgy + ((int)orgx + current) / maxx));
+ GetCursorXY(&curx, &cury);
+
+#endif
+ break;
+
+ case _T('M'):
+ case _T('C'):
+ /* ^M does the same as return */
+ bCharInput = TRUE;
+ if(!(ir.Event.KeyEvent.dwControlKeyState &
+ (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
+ {
+ break;
+ }
+
+ case VK_RETURN:
+ /* end input, return to main */
+#ifdef FEATURE_HISTORY
+ /* add to the history */
+ if (str[0])
+ History (0, str);
+#endif
+ ConInDummy ();
+ ConOutChar (_T('\n'));
+ bReturn = TRUE;
+ break;
+
+ case VK_ESCAPE:
+ /* clear str Make this callable! */
+ ClearCommandLine (str, maxlen, orgx, orgy);
+ curx = orgx;
+ cury = orgy;
+ current = charcount = 0;
+ break;
+
+#ifdef FEATURE_HISTORY
+ case VK_F3:
+ History_move_to_bottom();
+#endif
+ case VK_UP:
+#ifdef FEATURE_HISTORY
+ /* get previous command from buffer */
+ ClearCommandLine (str, maxlen, orgx, orgy);
+ History (-1, str);
+ current = charcount = _tcslen (str);
+ if (((charcount + orgx) / maxx) + orgy > maxy - 1)
+ orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
+ ConOutPrintf (_T("%s"), str);
+ GetCursorXY (&curx, &cury);
+#endif
+ break;
+
+ case VK_DOWN:
+#ifdef FEATURE_HISTORY
+ /* get next command from buffer */
+ ClearCommandLine (str, maxlen, orgx, orgy);
+ History (1, str);
+ current = charcount = _tcslen (str);
+ if (((charcount + orgx) / maxx) + orgy > maxy - 1)
+ orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
+ ConOutPrintf (_T("%s"), str);
+ GetCursorXY (&curx, &cury);
+#endif
+ break;
+
+ case VK_LEFT:
+ /* move cursor left */
+ if (current > 0)
+ {
+ current--;
+ if (GetCursorX () == 0)
+ {
+ SetCursorXY ((SHORT)(maxx - 1), (SHORT)(GetCursorY () - 1));
+ curx = maxx - 1;
+ cury--;
+ }
+ else
+ {
+ SetCursorXY ((SHORT)(GetCursorX () - 1), GetCursorY ());
+ curx--;
+ }
+ }
+ else
+ {
+ MessageBeep (-1);
+ }
+ break;
+
+ case VK_RIGHT:
+ /* move cursor right */
+ if (current != charcount)
+ {
+ current++;
+ if (GetCursorX () == maxx - 1)
+ {
+ SetCursorXY (0, (SHORT)(GetCursorY () + 1));
+ curx = 0;
+ cury++;
+ }
+ else
+ {
+ SetCursorXY ((SHORT)(GetCursorX () + 1), GetCursorY ());
+ curx++;
+ }
+ }
+ break;
+
+ default:
+ /* This input is just a normal char */
+ bCharInput = TRUE;
+
+ }
+#ifdef _UNICODE
+ ch = ir.Event.KeyEvent.uChar.UnicodeChar;
+ if ((ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
+#else
+ ch = ir.Event.KeyEvent.uChar.AsciiChar;
+ if ((UCHAR)ch >= 32 && (charcount != (maxlen - 2)) && bCharInput)
+#endif /* _UNICODE */
+ {
+ /* insert character into string... */
+ if (bInsert && current != charcount)
+ {
+ /* If this character insertion will cause screen scrolling,
+ * adjust the saved origin of the command prompt. */
+ tempscreen = _tcslen(str + current) + curx;
+ if ((tempscreen % maxx) == (maxx - 1) &&
+ (tempscreen / maxx) + cury == (maxy - 1))
+ {
+ orgy--;
+ cury--;
+ }
+
+ for (count = charcount; count > current; count--)
+ str[count] = str[count - 1];
+ str[current++] = ch;
+ if (curx == maxx - 1)
+ curx = 0, cury++;
+ else
+ curx++;
+ ConOutPrintf (_T("%s"), &str[current - 1]);
+ SetCursorXY (curx, cury);
+ charcount++;
+ }
+ else
+ {
+ if (current == charcount)
+ charcount++;
+ str[current++] = ch;
+ if (GetCursorX () == maxx - 1 && GetCursorY () == maxy - 1)
+ orgy--, cury--;
+ if (GetCursorX () == maxx - 1)
+ curx = 0, cury++;
+ else
+ curx++;
+ ConOutChar (ch);
+ }
+ }
+
+ wLastKey = ir.Event.KeyEvent.wVirtualKeyCode;
+ }
+ while (!bReturn);
+
+ SetCursorType (bInsert, TRUE);
+}
diff --git a/reactos/base/shell/cmd/cmdtable.c b/reactos/base/shell/cmd/cmdtable.c
new file mode 100644
index 00000000000..3af74432d5e
--- /dev/null
+++ b/reactos/base/shell/cmd/cmdtable.c
@@ -0,0 +1,269 @@
+/*
+ * CMDTABLE.C - table of internal commands.
+ *
+ *
+ * History:
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * started.
+ * New file to keep the internal command table. I plan on
+ * getting rid of the table real soon now and replacing it
+ * with a dynamic mechnism.
+ *
+ * 27 Jul 1998 John P. Price
+ * added config.h include
+ *
+ * 21-Jan-1999 (Eric Kohl )
+ * Unicode ready!
+ */
+
+#include
+#include "resource.h"
+
+
+/* a list of all the internal commands, associating their command names */
+/* to the functions to process them */
+
+
+COMMAND cmds[] =
+{
+ {_T("?"), 0, CommandShowCommands},
+
+
+#ifdef INCLUDE_CMD_ACTIVATE
+ {_T("activate"), 0, CommandActivate},
+#endif
+
+#ifdef FEATURE_ALIASES
+ {_T("alias"), 0, CommandAlias},
+#endif
+
+#ifdef INCLUDE_CMD_ATTRIB
+ {_T("attrib"), 0, CommandAttrib},
+#endif
+
+#ifdef INCLUDE_CMD_BEEP
+ {_T("beep"), 0, cmd_beep},
+#endif
+
+ {_T("call"), CMD_BATCHONLY, cmd_call},
+
+#ifdef INCLUDE_CMD_CHDIR
+ {_T("cd"), CMD_SPECIAL, cmd_chdir},
+ {_T("chdir"), CMD_SPECIAL, cmd_chdir},
+#endif
+
+#ifdef INCLUDE_CMD_CHCP
+ {_T("chcp"), 0, CommandChcp},
+#endif
+
+#ifdef INCLUDE_CMD_CHOICE
+ {_T("choice"), 0, CommandChoice},
+#endif
+
+#ifdef INCLUDE_CMD_CLS
+ {_T("cls"), 0, cmd_cls},
+#endif
+
+#ifdef INCLUDE_CMD_COLOR
+ {_T("color"), 0, CommandColor},
+#endif
+
+#ifdef INCLUDE_CMD_COPY
+ {_T("copy"), 0, cmd_copy},
+#endif
+
+#ifdef INCLUDE_CMD_DATE
+ {_T("date"), 0, cmd_date},
+#endif
+
+#ifdef INCLUDE_CMD_DEL
+ {_T("del"), 0, CommandDelete},
+ {_T("delete"), 0, CommandDelete},
+#endif
+
+#ifdef INCLUDE_CMD_DELAY
+ {_T("delay"), 0, CommandDelay},
+#endif
+
+#ifdef INCLUDE_CMD_DIR
+ {_T("dir"), CMD_SPECIAL, CommandDir},
+#endif
+
+#ifdef FEATURE_DIRECTORY_STACK
+ {_T("dirs"), 0, CommandDirs},
+#endif
+
+ {_T("echo"), 0, CommandEcho},
+ {_T("echo."), CMD_HIDE, CommandEcho},
+ {_T("echos"), 0, CommandEchos},
+ {_T("echoerr"), 0, CommandEchoerr},
+ {_T("echoerr."), CMD_HIDE, CommandEchoerr},
+ {_T("echoserr"), 0, CommandEchoserr},
+
+#ifdef INCLUDE_CMD_DEL
+ {_T("erase"), 0, CommandDelete},
+#endif
+
+ {_T("exit"), 0, CommandExit},
+
+ {_T("for"), 0, cmd_for},
+
+#ifdef INCLUDE_CMD_FREE
+ {_T("free"), 0, CommandFree},
+#endif
+
+ {_T("goto"), CMD_BATCHONLY, cmd_goto},
+
+ {_T("help"), 0, CommandShowCommandsDetail},
+
+#ifdef FEATURE_HISTORY
+ {_T("history"), 0, CommandHistory},
+#endif
+
+ {_T("if"), 0, cmd_if},
+
+#ifdef INCLUDE_CMD_LABEL
+ {_T("label"), 0, cmd_label},
+#endif
+
+#ifdef INCLUDE_CMD_MEMORY
+ {_T("memory"), 0, CommandMemory},
+#endif
+
+#ifdef INCLUDE_CMD_MKDIR
+ {_T("md"), CMD_SPECIAL, cmd_mkdir},
+ {_T("mkdir"), CMD_SPECIAL, cmd_mkdir},
+#endif
+
+#ifdef INCLUDE_CMD_MOVE
+ {_T("move"), 0, cmd_move},
+#endif
+
+#ifdef INCLUDE_CMD_MSGBOX
+ {_T("msgbox"), 0, CommandMsgbox},
+#endif
+
+#ifdef INCLUDE_CMD_PATH
+ {_T("path"), 0, cmd_path},
+#endif
+
+#ifdef INCLUDE_CMD_PAUSE
+ {_T("pause"), 0, cmd_pause},
+#endif
+
+#ifdef FEATURE_DIRECTORY_STACK
+ {_T("popd"), 0, CommandPopd},
+#endif
+
+#ifdef INCLUDE_CMD_PROMPT
+ {_T("prompt"), 0, cmd_prompt},
+#endif
+
+#ifdef FEATURE_DIRECTORY_STACK
+ {_T("pushd"), 0, CommandPushd},
+#endif
+
+#ifdef INCLUDE_CMD_RMDIR
+ {_T("rd"), CMD_SPECIAL, cmd_rmdir},
+#endif
+
+#ifdef INCLUDE_CMD_REM
+ {_T("rem"), 0, CommandRem},
+#endif
+
+#ifdef INCLUDE_CMD_RENAME
+ {_T("ren"), 0, cmd_rename},
+ {_T("rename"), 0, cmd_rename},
+#endif
+
+#ifdef INCLUDE_CMD_RMDIR
+ {_T("rmdir"), CMD_SPECIAL, cmd_rmdir},
+#endif
+
+#ifdef INCLUDE_CMD_SCREEN
+ {_T("screen"), 0, CommandScreen},
+#endif
+
+#ifdef INCLUDE_CMD_SET
+ {_T("set"), 0, cmd_set},
+#endif
+
+ {_T("shift"), CMD_BATCHONLY, cmd_shift},
+
+#ifdef INCLUDE_CMD_START
+ {_T("start"), 0, cmd_start},
+#endif
+
+#ifdef INCLUDE_CMD_TIME
+ {_T("time"), 0, cmd_time},
+#endif
+
+#ifdef INCLUDE_CMD_TIMER
+ {_T("timer"), 0, CommandTimer},
+#endif
+
+#ifdef INCLUDE_CMD_TITLE
+ {_T("title"), 0, cmd_title},
+#endif
+
+#ifdef INCLUDE_CMD_TYPE
+ {_T("type"), 0, cmd_type},
+#endif
+
+#ifdef INCLUDE_CMD_VER
+ {_T("ver"), 0, cmd_ver},
+#endif
+
+#ifdef INCLUDE_CMD_VERIFY
+ {_T("verify"), 0, cmd_verify},
+#endif
+
+#ifdef INCLUDE_CMD_VOL
+ {_T("vol"), 0, cmd_vol},
+#endif
+
+#ifdef INCLUDE_CMD_WINDOW
+ {_T("window"), 0, CommandWindow},
+#endif
+
+ {NULL, 0, NULL}
+};
+
+
+VOID PrintCommandList (VOID)
+{
+ LPCOMMAND cmdptr;
+ INT y;
+
+ y = 0;
+ cmdptr = cmds;
+ while (cmdptr->name)
+ {
+ if (!(cmdptr->flags & CMD_HIDE))
+ {
+ if (++y == 8)
+ {
+ ConOutPuts (cmdptr->name);
+ y = 0;
+ }
+ else
+ {
+ ConOutPrintf (_T("%-10s"), cmdptr->name);
+ }
+ }
+
+ cmdptr++;
+ }
+
+ if (y != 0)
+ ConOutChar ('\n');
+}
+
+VOID PrintCommandListDetail (VOID)
+{
+ ConOutResPaging(TRUE,STRING_HELP1);
+ ConOutResPaging(FALSE,STRING_HELP2);
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/cmdver.h b/reactos/base/shell/cmd/cmdver.h
new file mode 100644
index 00000000000..93ed1b8f446
--- /dev/null
+++ b/reactos/base/shell/cmd/cmdver.h
@@ -0,0 +1,2 @@
+#define CMD_VER "0.1.2"
+#define CMD_VER_RC CMD_VER"\0"
diff --git a/reactos/base/shell/cmd/color.c b/reactos/base/shell/cmd/color.c
new file mode 100644
index 00000000000..8db6dc767d1
--- /dev/null
+++ b/reactos/base/shell/cmd/color.c
@@ -0,0 +1,137 @@
+/*
+ * COLOR.C - color internal command.
+ *
+ *
+ * History:
+ *
+ * 13-Dec-1998 (Eric Kohl )
+ * Started.
+ *
+ * 19-Jan-1999 (Eric Kohl )
+ * Unicode ready!
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Redirection ready!
+ *
+ * 14-Oct-1999 (Paolo Pantaleo )
+ * 4nt's syntax implemented.
+ *
+ * 03-Apr-2005 (Magnus Olsen) )
+ * Move all hardcoded strings to En.rc.
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_COLOR
+
+
+
+
+
+VOID SetScreenColor (WORD wColor, BOOL bNoFill)
+{
+ DWORD dwWritten;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ COORD coPos;
+
+
+ if ((wColor & 0xF) == (wColor &0xF0) >> 4)
+ {
+ ConErrResPuts(STRING_COLOR_ERROR1);
+ }
+ else
+ {
+ if (bNoFill != TRUE)
+ {
+ GetConsoleScreenBufferInfo (hConsole, &csbi);
+
+ coPos.X = 0;
+ coPos.Y = 0;
+ FillConsoleOutputAttribute (hConsole,
+ (WORD)(wColor & 0x00FF),
+ (csbi.dwSize.X)*(csbi.dwSize.Y),
+ coPos,
+ &dwWritten);
+ }
+ SetConsoleTextAttribute (hConsole, (WORD)(wColor & 0x00FF));
+ }
+}
+
+
+/*
+ * color
+ *
+ * internal dir command
+ */
+INT CommandColor (LPTSTR first, LPTSTR rest)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ if (_tcsncmp (rest, _T("/?"), 2) == 0)
+ {
+ ConOutResPaging(TRUE,STRING_COLOR_HELP1);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ if (rest[0] == _T('\0'))
+ {
+ /* set default color */
+ wColor = wDefColor;
+ SetScreenColor (wColor, FALSE);
+ return 0;
+ }
+
+
+ if ( _tcslen(&rest[0])==1)
+ {
+ if ( (_tcscmp(&rest[0], _T("0")) >=0 ) && (_tcscmp(&rest[0], _T("9")) <=0 ) )
+ {
+ SetConsoleTextAttribute (hConsole, (WORD)_ttoi(rest));
+ return 0;
+ }
+ else if ( (_tcscmp(&rest[0], _T("a")) >=0 ) && (_tcscmp(&rest[0], _T("f")) <=0 ) )
+ {
+ SetConsoleTextAttribute (hConsole, (WORD) (rest[0] + 10 - _T('a')) );
+ return 0;
+ }
+ else if ( (_tcscmp(&rest[0], _T("A")) >=0 ) && (_tcscmp(&rest[0], _T("F")) <=0 ) )
+ {
+ SetConsoleTextAttribute (hConsole, (WORD) (rest[0] + 10 - _T('A')) );
+ return 0;
+ }
+ ConErrResPuts(STRING_COLOR_ERROR2);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ if (StringToColor(&wColor, &rest) == FALSE)
+ {
+ ConErrResPuts(STRING_COLOR_ERROR2);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ LoadString(CMD_ModuleHandle, STRING_COLOR_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, wColor);
+
+ if ((wColor & 0xF) == (wColor &0xF0) >> 4)
+ {
+ LoadString(CMD_ModuleHandle, STRING_COLOR_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, wColor);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /* set color */
+ SetScreenColor(wColor,
+ (_tcsstr (rest,_T("/-F")) || _tcsstr (rest,_T("/-f"))));
+
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_COLOR */
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/config.h b/reactos/base/shell/cmd/config.h
new file mode 100644
index 00000000000..356af141446
--- /dev/null
+++ b/reactos/base/shell/cmd/config.h
@@ -0,0 +1,99 @@
+/*
+ * CONFIG.H - Used to configure what will be compiled into the shell.
+ *
+ *
+ * History:
+ *
+ * 27 Jul 1998 - John P. Price
+ * started.
+ *
+ */
+
+/* Define only if used under ReactOS */
+#define __REACTOS__
+
+#ifndef _CONFIG_H_INCLUDED_
+#define _CONFIG_H_INCLUDED_
+
+/* Define to enable debugging code */
+//#define _DEBUG
+
+#define WIN32_LEAN_AND_MEAN
+
+//#define NT4_INTERNAL_COMMANDS
+
+/* Define to enable the alias command, and aliases.*/
+#define FEATURE_ALIASES
+
+
+/* Define to enable history */
+#define FEATURE_HISTORY
+
+/*Define to enable history wrap (4nt's style)*/
+#define WRAP_HISTORY
+
+
+/* Define one of these to enable filename completion */
+//#define FEATURE_UNIX_FILENAME_COMPLETION
+#define FEATURE_4NT_FILENAME_COMPLETION
+
+
+/* Define to enable the directory stack */
+#define FEATURE_DIRECTORY_STACK
+
+
+/* Define to activate redirections and piping */
+#define FEATURE_REDIRECTION
+
+
+/* Define one of these to select the used locale. */
+/* (date and time formats etc.) used in DATE, TIME, */
+/* DIR, PROMPT etc. */
+#define LOCALE_WINDOWS /* System locale */
+/* #define LOCALE_GERMAN */ /* German locale */
+/* #define LOCALE_DEFAULT */ /* United States locale */
+
+#ifdef NT4_INTERNAL_COMMANDS
+#define INCLUDE_CMD_ACTIVATE
+#endif
+#define INCLUDE_CMD_ATTRIB
+#define INCLUDE_CMD_CHCP
+#define INCLUDE_CMD_CHDIR
+#define INCLUDE_CMD_CHOICE
+#define INCLUDE_CMD_CLS
+#define INCLUDE_CMD_COLOR
+#define INCLUDE_CMD_COPY
+#define INCLUDE_CMD_DATE
+#define INCLUDE_CMD_DEL
+#define INCLUDE_CMD_DELAY
+#define INCLUDE_CMD_DIR
+#define INCLUDE_CMD_FREE
+#define INCLUDE_CMD_LABEL
+#define INCLUDE_CMD_MEMORY
+#define INCLUDE_CMD_MKDIR
+#define INCLUDE_CMD_MOVE
+#ifdef NT4_INTERNAL_COMMANDS
+#define INCLUDE_CMD_MSGBOX
+#endif
+#define INCLUDE_CMD_PATH
+#define INCLUDE_CMD_PROMPT
+#define INCLUDE_CMD_RMDIR
+#define INCLUDE_CMD_RENAME
+#define INCLUDE_CMD_SCREEN
+#define INCLUDE_CMD_SET
+#define INCLUDE_CMD_START
+#define INCLUDE_CMD_TIME
+#define INCLUDE_CMD_TIMER
+#define INCLUDE_CMD_TITLE
+#define INCLUDE_CMD_TYPE
+#define INCLUDE_CMD_VER
+#define INCLUDE_CMD_REM
+#define INCLUDE_CMD_PAUSE
+#define INCLUDE_CMD_BEEP
+#define INCLUDE_CMD_VERIFY
+#define INCLUDE_CMD_VOL
+#ifdef NT4_INTERNAL_COMMANDS
+#define INCLUDE_CMD_WINDOW
+#endif
+
+#endif /* _CONFIG_H_INCLUDED_ */
diff --git a/reactos/base/shell/cmd/console.c b/reactos/base/shell/cmd/console.c
new file mode 100644
index 00000000000..352a64e2f9a
--- /dev/null
+++ b/reactos/base/shell/cmd/console.c
@@ -0,0 +1,527 @@
+/*
+ * CONSOLE.C - console input/output functions.
+ *
+ *
+ * History:
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * started
+ *
+ * 03-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ *
+ * 01-Jul-2005 (Brandon Turner) )
+ * Added ConPrintfPaging and ConOutPrintfPaging
+ */
+
+
+
+#include
+#include "resource.h"
+
+
+#define OUTPUT_BUFFER_SIZE 4096
+
+
+UINT InputCodePage;
+UINT OutputCodePage;
+
+
+VOID ConInDisable (VOID)
+{
+ HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
+ DWORD dwMode;
+
+ GetConsoleMode (hInput, &dwMode);
+ dwMode &= ~ENABLE_PROCESSED_INPUT;
+ SetConsoleMode (hInput, dwMode);
+}
+
+
+VOID ConInEnable (VOID)
+{
+ HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
+ DWORD dwMode;
+
+ GetConsoleMode (hInput, &dwMode);
+ dwMode |= ENABLE_PROCESSED_INPUT;
+ SetConsoleMode (hInput, dwMode);
+}
+
+
+VOID ConInDummy (VOID)
+{
+ HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
+ INPUT_RECORD dummy;
+ DWORD dwRead;
+
+#ifdef _DEBUG
+ if (hInput == INVALID_HANDLE_VALUE)
+ DebugPrintf (_T("Invalid input handle!!!\n"));
+#endif /* _DEBUG */
+ ReadConsoleInput (hInput, &dummy, 1, &dwRead);
+}
+
+VOID ConInFlush (VOID)
+{
+ FlushConsoleInputBuffer (GetStdHandle (STD_INPUT_HANDLE));
+}
+
+
+VOID ConInKey (PINPUT_RECORD lpBuffer)
+{
+ HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
+ DWORD dwRead;
+
+#ifdef _DEBUG
+ if (hInput == INVALID_HANDLE_VALUE)
+ DebugPrintf (_T("Invalid input handle!!!\n"));
+#endif /* _DEBUG */
+
+ do
+ {
+ ReadConsoleInput (hInput, lpBuffer, 1, &dwRead);
+ if ((lpBuffer->EventType == KEY_EVENT) &&
+ (lpBuffer->Event.KeyEvent.bKeyDown == TRUE))
+ break;
+ }
+ while (TRUE);
+}
+
+
+
+VOID ConInString (LPTSTR lpInput, DWORD dwLength)
+{
+ DWORD dwOldMode;
+ DWORD dwRead;
+ HANDLE hFile;
+
+ LPTSTR p;
+ DWORD i;
+ PCHAR pBuf;
+
+#ifdef _UNICODE
+ pBuf = (PCHAR)malloc(dwLength);
+#else
+ pBuf = lpInput;
+#endif
+ ZeroMemory (lpInput, dwLength * sizeof(TCHAR));
+ hFile = GetStdHandle (STD_INPUT_HANDLE);
+ GetConsoleMode (hFile, &dwOldMode);
+
+ SetConsoleMode (hFile, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
+
+ ReadFile (hFile, (PVOID)pBuf, dwLength, &dwRead, NULL);
+
+#ifdef _UNICODE
+ MultiByteToWideChar( InputCodePage, 0, pBuf, dwLength + 1, lpInput, dwLength + 1);
+#endif
+ p = lpInput;
+ for (i = 0; i < dwRead; i++, p++)
+ {
+ if (*p == _T('\x0d'))
+ {
+ *p = _T('\0');
+ break;
+ }
+ }
+
+#ifdef _UNICODE
+ free(pBuf);
+#endif
+
+ SetConsoleMode (hFile, dwOldMode);
+}
+
+static VOID ConChar(TCHAR c, DWORD nStdHandle)
+{
+ DWORD dwWritten;
+ CHAR cc;
+#ifdef _UNICODE
+ CHAR as[2];
+ WCHAR ws[2];
+ ws[0] = c;
+ ws[1] = 0;
+ WideCharToMultiByte( OutputCodePage, 0, ws, 2, as, 2, NULL, NULL);
+ cc = as[0];
+#else
+ cc = c;
+#endif
+ WriteFile (GetStdHandle (nStdHandle),
+ &cc,
+ 1,
+ &dwWritten,
+ NULL);
+}
+
+VOID ConOutChar (TCHAR c)
+{
+ ConChar(c, STD_OUTPUT_HANDLE);
+}
+
+VOID ConPuts(LPTSTR szText, DWORD nStdHandle)
+{
+ DWORD dwWritten;
+ PCHAR pBuf;
+ INT len;
+
+ len = _tcslen(szText);
+#ifdef _UNICODE
+ pBuf = malloc(len + 1);
+ len = WideCharToMultiByte( OutputCodePage, 0, szText, len + 1, pBuf, len + 1, NULL, NULL) - 1;
+#else
+ pBuf = szText;
+#endif
+ WriteFile (GetStdHandle (nStdHandle),
+ pBuf,
+ len,
+ &dwWritten,
+ NULL);
+ WriteFile (GetStdHandle (nStdHandle),
+ _T("\n"),
+ 1,
+ &dwWritten,
+ NULL);
+#ifdef UNICODE
+ free(pBuf);
+#endif
+}
+
+VOID ConOutResPaging(BOOL NewPage, UINT resID)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintfPaging(NewPage, szMsg);
+}
+
+VOID ConOutResPuts (UINT resID)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
+
+ ConPuts(szMsg, STD_OUTPUT_HANDLE);
+}
+
+VOID ConOutPuts (LPTSTR szText)
+{
+ ConPuts(szText, STD_OUTPUT_HANDLE);
+}
+
+
+VOID ConPrintf(LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle)
+{
+ INT len;
+ PCHAR pBuf;
+ TCHAR szOut[OUTPUT_BUFFER_SIZE];
+ DWORD dwWritten;
+
+ len = _vstprintf (szOut, szFormat, arg_ptr);
+#ifdef _UNICODE
+ pBuf = malloc(len + 1);
+ len = WideCharToMultiByte( OutputCodePage, 0, szOut, len + 1, pBuf, len + 1, NULL, NULL) - 1;
+#else
+ pBuf = szOut;
+#endif
+
+ WriteFile (GetStdHandle (nStdHandle),
+ pBuf,
+ len,
+ &dwWritten,
+ NULL);
+
+
+#ifdef UNICODE
+ free(pBuf);
+#endif
+}
+
+INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHandle)
+{
+ INT len;
+ PCHAR pBuf;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ TCHAR szOut[OUTPUT_BUFFER_SIZE];
+ DWORD dwWritten;
+
+ /* used to count number of lines since last pause */
+ static int LineCount = 0;
+
+ /* used to see how big the screen is */
+ int ScreenLines = 0;
+
+ /* the number of chars in a roow */
+ int ScreenCol = 0;
+
+ /* chars since end of line */
+ int CharEL = 0;
+
+ int i = 0;
+
+ if(NewPage == TRUE)
+ LineCount = 0;
+
+ /* rest LineCount and return if no string have been given */
+ if (szFormat == NULL)
+ return 0;
+
+
+ //get the size of the visual screen that can be printed too
+ if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
+ {
+ // we assuming its a file handle
+ ConPrintf(szFormat, arg_ptr, nStdHandle);
+ return 0;
+ }
+ //subtract 2 to account for "press any key..." and for the blank line at the end of PagePrompt()
+ ScreenLines = (csbi.srWindow.Bottom - csbi.srWindow.Top) - 4;
+ ScreenCol = (csbi.srWindow.Right - csbi.srWindow.Left) + 1;
+
+ //make sure they didnt make the screen to small
+ if(ScreenLines<4)
+ {
+ ConPrintf(szFormat, arg_ptr, nStdHandle);
+ return 0;
+ }
+
+ len = _vstprintf (szOut, szFormat, arg_ptr);
+#ifdef _UNICODE
+ pBuf = malloc(len + 1);
+ len = WideCharToMultiByte( OutputCodePage, 0, szOut, len + 1, pBuf, len + 1, NULL, NULL) - 1;
+#else
+ pBuf = szOut;
+#endif
+
+ for(i = 0; i < len; i++)
+ {
+
+ if(pBuf[i] == _T('\n'))
+ {
+ LineCount++;
+ CharEL=0;
+ }
+ else
+ {
+ CharEL++;
+ if (CharEL>=ScreenCol)
+ {
+ if (i+1= ScreenLines)
+ {
+ if(_tcsnicmp(&pBuf[i], _T("\n"), 2)!=0)
+ WriteFile (GetStdHandle (nStdHandle),_T("\n"),sizeof(CHAR),&dwWritten,NULL);
+
+ if(PagePrompt() != PROMPT_YES)
+ {
+ return 1;
+ }
+ //reset the number of lines being printed
+ LineCount = 0;
+ CharEL=0;
+ }
+
+ }
+
+#ifdef UNICODE
+ free(pBuf);
+#endif
+ return 0;
+}
+
+VOID ConErrFormatMessage (DWORD MessageId, ...)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ DWORD ret;
+ LPTSTR text;
+ va_list arg_ptr;
+
+ va_start (arg_ptr, MessageId);
+ ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ MessageId,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &text,
+ 0,
+ &arg_ptr);
+
+ va_end (arg_ptr);
+ if(ret > 0)
+ {
+ ConErrPuts (text);
+ LocalFree(text);
+ }
+ else
+ {
+ LoadString(CMD_ModuleHandle, STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ }
+}
+
+VOID ConOutFormatMessage (DWORD MessageId, ...)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ DWORD ret;
+ LPTSTR text;
+ va_list arg_ptr;
+
+ va_start (arg_ptr, MessageId);
+ ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ MessageId,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &text,
+ 0,
+ &arg_ptr);
+
+ va_end (arg_ptr);
+ if(ret > 0)
+ {
+ ConErrPuts (text);
+ LocalFree(text);
+ }
+ else
+ {
+ LoadString(CMD_ModuleHandle, STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ }
+}
+
+VOID ConOutPrintf (LPTSTR szFormat, ...)
+{
+ va_list arg_ptr;
+
+ va_start (arg_ptr, szFormat);
+ ConPrintf(szFormat, arg_ptr, STD_OUTPUT_HANDLE);
+ va_end (arg_ptr);
+}
+
+INT ConOutPrintfPaging (BOOL NewPage, LPTSTR szFormat, ...)
+{
+ INT iReturn;
+ va_list arg_ptr;
+
+ va_start (arg_ptr, szFormat);
+ iReturn = ConPrintfPaging(NewPage, szFormat, arg_ptr, STD_OUTPUT_HANDLE);
+ va_end (arg_ptr);
+ return iReturn;
+}
+
+VOID ConErrChar (TCHAR c)
+{
+ ConChar(c, STD_ERROR_HANDLE);
+}
+
+
+VOID ConErrResPuts (UINT resID)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
+ ConPuts(szMsg, STD_ERROR_HANDLE);
+}
+
+VOID ConErrPuts (LPTSTR szText)
+{
+ ConPuts(szText, STD_ERROR_HANDLE);
+}
+
+
+VOID ConErrPrintf (LPTSTR szFormat, ...)
+{
+ va_list arg_ptr;
+
+ va_start (arg_ptr, szFormat);
+ ConPrintf(szFormat, arg_ptr, STD_ERROR_HANDLE);
+ va_end (arg_ptr);
+}
+
+#ifdef _DEBUG
+VOID DebugPrintf (LPTSTR szFormat, ...)
+{
+ va_list arg_ptr;
+
+ va_start (arg_ptr, szFormat);
+ ConPrintf(szFormat, arg_ptr, STD_ERROR_HANDLE);
+ va_end (arg_ptr);
+#if 0
+ TCHAR szOut[OUTPUT_BUFFER_SIZE];
+ va_start (arg_ptr, szFormat);
+ _vstprintf (szOut, szFormat, arg_ptr);
+ OutputDebugString (szOut);
+ va_end (arg_ptr);
+#endif
+}
+#endif /* _DEBUG */
+
+VOID SetCursorXY (SHORT x, SHORT y)
+{
+ COORD coPos;
+
+ coPos.X = x;
+ coPos.Y = y;
+ SetConsoleCursorPosition (GetStdHandle (STD_OUTPUT_HANDLE), coPos);
+}
+
+
+VOID GetCursorXY (PSHORT x, PSHORT y)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hConsole, &csbi);
+
+ *x = csbi.dwCursorPosition.X;
+ *y = csbi.dwCursorPosition.Y;
+}
+
+
+SHORT GetCursorX (VOID)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hConsole, &csbi);
+
+ return csbi.dwCursorPosition.X;
+}
+
+
+SHORT GetCursorY (VOID)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hConsole, &csbi);
+
+ return csbi.dwCursorPosition.Y;
+}
+
+
+VOID GetScreenSize (PSHORT maxx, PSHORT maxy)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hConsole, &csbi);
+
+ if (maxx)
+ *maxx = csbi.dwSize.X;
+ if (maxy)
+ *maxy = csbi.dwSize.Y;
+}
+
+
+VOID SetCursorType (BOOL bInsert, BOOL bVisible)
+{
+ CONSOLE_CURSOR_INFO cci;
+
+ cci.dwSize = bInsert ? 10 : 99;
+ cci.bVisible = bVisible;
+
+ SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/copy.c b/reactos/base/shell/cmd/copy.c
new file mode 100644
index 00000000000..a54b8751d84
--- /dev/null
+++ b/reactos/base/shell/cmd/copy.c
@@ -0,0 +1,888 @@
+/*
+ * COPY.C -- copy internal command.
+ *
+ *
+ * History:
+ *
+ * 01-Aug-98 (Rob Lake z63rrl@morgan.ucs.mun.ca)
+ * started
+ *
+ * 13-Aug-1998 (John P. Price)
+ * fixed memory leak problem in copy function.
+ * fixed copy function so it would work with wildcards in the source
+ *
+ * 13-Dec-1998 (Eric Kohl )
+ * Added COPY command to CMD.
+ *
+ * 26-Jan-1998 (Eric Kohl )
+ * Replaced CRT io functions by Win32 io functions.
+ *
+ * 27-Oct-1998 (Eric Kohl )
+ * Disabled prompting when used in batch mode.
+ *
+ * 03-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ *
+ * 13-Jul-2005 (Brandon Turner) )
+ * Rewrite to clean up copy and support wildcard.
+ *
+ * 20-Jul-2005 (Brandon Turner) )
+ * Add touch syntax. "copy arp.exe+,,"
+ * Copy command is now completed.
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_COPY
+
+enum
+{
+ COPY_ASCII = 0x001, /* /A */
+ COPY_DECRYPT = 0x004, /* /D */
+ COPY_VERIFY = 0x008, /* /V : Dummy, Never will be Impleneted */
+ COPY_SHORTNAME = 0x010, /* /N : Dummy, Never will be Impleneted */
+ COPY_NO_PROMPT = 0x020, /* /Y */
+ COPY_PROMPT = 0x040, /* /-Y */
+ COPY_RESTART = 0x080, /* /Z */
+ COPY_BINARY = 0x100, /* /B */
+};
+
+#define BUFF_SIZE 16384 /* 16k = max buffer size */
+
+
+INT
+copy (TCHAR source[MAX_PATH],
+ TCHAR dest[MAX_PATH],
+ INT append,
+ DWORD lpdwFlags,
+ BOOL bTouch)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ FILETIME srctime,NewFileTime;
+ HANDLE hFileSrc;
+ HANDLE hFileDest;
+ LPBYTE buffer;
+ DWORD dwAttrib;
+ DWORD dwRead;
+ DWORD dwWritten;
+ DWORD i;
+ BOOL bEof = FALSE;
+ TCHAR TrueDest[MAX_PATH];
+ TCHAR TempSrc[MAX_PATH];
+ TCHAR * FileName;
+ SYSTEMTIME CurrentTime;
+
+ /* Check Breaker */
+ if(CheckCtrlBreak(BREAK_INPUT))
+ return 0;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("checking mode\n"));
+#endif
+
+ if(bTouch)
+ {
+ hFileSrc = CreateFile (source, GENERIC_WRITE, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (hFileSrc == INVALID_HANDLE_VALUE)
+ {
+ LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, source);
+ nErrorLevel = 1;
+ return 0;
+ }
+
+ GetSystemTime(&CurrentTime);
+ SystemTimeToFileTime(&CurrentTime, &NewFileTime);
+ if(SetFileTime(hFileSrc,(LPFILETIME) NULL, (LPFILETIME) NULL, &NewFileTime))
+ {
+ CloseHandle(hFileSrc);
+ nErrorLevel = 1;
+ return 1;
+
+ }
+ else
+ {
+ CloseHandle(hFileSrc);
+ return 0;
+ }
+ }
+
+ dwAttrib = GetFileAttributes (source);
+
+ hFileSrc = CreateFile (source, GENERIC_READ, FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, 0, NULL);
+ if (hFileSrc == INVALID_HANDLE_VALUE)
+ {
+ LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, source);
+ nErrorLevel = 1;
+ return 0;
+ }
+
+#ifdef _DEBUG
+ DebugPrintf (_T("getting time\n"));
+#endif
+
+ GetFileTime (hFileSrc, &srctime, NULL, NULL);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("copy: flags has %s\n"),
+ lpdwFlags & COPY_ASCII ? "ASCII" : "BINARY");
+#endif
+
+ /* Check to see if /D or /Z are true, if so we need a middle
+ man to copy the file too to allow us to use CopyFileEx later */
+ if(lpdwFlags & COPY_DECRYPT)
+ {
+ GetEnvironmentVariable(_T("TEMP"),TempSrc,MAX_PATH);
+ _tcscat(TempSrc,_T("\\"));
+ FileName = _tcsrchr(source,_T('\\'));
+ FileName++;
+ _tcscat(TempSrc,FileName);
+ /* This is needed to be on the end to prevent an error
+ if the user did "copy /D /Z foo bar then it would be copied
+ too %TEMP%\foo here and when %TEMP%\foo when it sets it up
+ for COPY_RESTART, this would mean it is copying to itself
+ which would error when it tried to open the handles for ReadFile
+ and WriteFile */
+ _tcscat(TempSrc,_T(".decrypt"));
+ if(!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
+ {
+ nErrorLevel = 1;
+ return 0;
+ }
+ _tcscpy(source, TempSrc);
+ }
+
+
+ if(lpdwFlags & COPY_RESTART)
+ {
+ _tcscpy(TrueDest, dest);
+ GetEnvironmentVariable(_T("TEMP"),dest,MAX_PATH);
+ _tcscat(dest,_T("\\"));
+ FileName = _tcsrchr(TrueDest,_T('\\'));
+ FileName++;
+ _tcscat(dest,FileName);
+ }
+
+
+
+ if (!IsExistingFile (dest))
+ {
+#ifdef _DEBUG
+ DebugPrintf (_T("opening/creating\n"));
+#endif
+ hFileDest =
+ CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ }
+ else if (!append)
+ {
+ if (!_tcscmp (dest, source))
+ {
+ LoadString(CMD_ModuleHandle, STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, source);
+
+ CloseHandle (hFileSrc);
+ nErrorLevel = 1;
+ return 0;
+ }
+
+#ifdef _DEBUG
+ DebugPrintf (_T("SetFileAttributes (%s, FILE_ATTRIBUTE_NORMAL);\n"), dest);
+#endif
+ SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("DeleteFile (%s);\n"), dest);
+#endif
+ DeleteFile (dest);
+
+ hFileDest = CreateFile (dest, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ }
+ else
+ {
+ LONG lFilePosHigh = 0;
+
+ if (!_tcscmp (dest, source))
+ {
+ CloseHandle (hFileSrc);
+ return 0;
+ }
+
+#ifdef _DEBUG
+ DebugPrintf (_T("opening/appending\n"));
+#endif
+ SetFileAttributes (dest, FILE_ATTRIBUTE_NORMAL);
+
+ hFileDest =
+ CreateFile (dest, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
+
+ /* Move to end of file to start writing */
+ SetFilePointer (hFileDest, 0, &lFilePosHigh,FILE_END);
+ }
+
+
+ if (hFileDest == INVALID_HANDLE_VALUE)
+ {
+ CloseHandle (hFileSrc);
+ ConOutResPuts(STRING_ERROR_PATH_NOT_FOUND);
+ nErrorLevel = 1;
+ return 0;
+ }
+ buffer = (LPBYTE)malloc (BUFF_SIZE);
+ if (buffer == NULL)
+ {
+ CloseHandle (hFileDest);
+ CloseHandle (hFileSrc);
+ ConOutResPuts(STRING_ERROR_OUT_OF_MEMORY);
+ nErrorLevel = 1;
+ return 0;
+ }
+
+ do
+ {
+
+ ReadFile (hFileSrc, buffer, BUFF_SIZE, &dwRead, NULL);
+ if (lpdwFlags & COPY_ASCII)
+ {
+ for (i = 0; i < dwRead; i++)
+ {
+ /* we're dealing with ASCII files! */
+ if (((LPSTR)buffer)[i] == 0x1A)
+ {
+ bEof = TRUE;
+ break;
+ }
+ }
+ dwRead = i;
+ }
+
+ if (dwRead == 0)
+ break;
+
+ WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL);
+ if (dwWritten != dwRead || CheckCtrlBreak(BREAK_INPUT))
+ {
+ ConOutResPuts(STRING_COPY_ERROR3);
+
+ free (buffer);
+ CloseHandle (hFileDest);
+ CloseHandle (hFileSrc);
+ nErrorLevel = 1;
+ return 0;
+ }
+ }
+ while (dwRead && !bEof);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("setting time\n"));
+#endif
+ SetFileTime (hFileDest, &srctime, NULL, NULL);
+
+ if (lpdwFlags & COPY_ASCII)
+ {
+ /* we're dealing with ASCII files! */
+ ((LPSTR)buffer)[0] = 0x1A;
+ ((LPSTR)buffer)[1] = '\0';
+#ifdef _DEBUG
+ DebugPrintf (_T("appending ^Z\n"));
+#endif
+ WriteFile (hFileDest, buffer, sizeof(CHAR), &dwWritten, NULL);
+ }
+
+ free (buffer);
+ CloseHandle (hFileDest);
+ CloseHandle (hFileSrc);
+
+#ifdef _DEBUG
+ DebugPrintf (_T("setting mode\n"));
+#endif
+ SetFileAttributes (dest, dwAttrib);
+
+ /* Now finish off the copy if needed with CopyFileEx */
+ if(lpdwFlags & COPY_RESTART)
+ {
+ if(!CopyFileEx(dest, TrueDest, NULL, NULL, FALSE, COPY_FILE_RESTARTABLE))
+ {
+ nErrorLevel = 1;
+ DeleteFile(dest);
+ return 0;
+ }
+ /* Take care of file in the temp folder */
+ DeleteFile(dest);
+
+ }
+
+ if(lpdwFlags & COPY_DECRYPT)
+ DeleteFile(TempSrc);
+
+
+
+ return 1;
+}
+
+
+static INT CopyOverwrite (LPTSTR fn)
+{
+ /*ask the user if they want to override*/
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ INT res;
+ LoadString(CMD_ModuleHandle, STRING_COPY_HELP1, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg,fn);
+ res = FilePromptYNA (_T(""));
+ return res;
+}
+
+
+INT cmd_copy (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LPTSTR *arg;
+ INT argc, i, nFiles, nOverwrite = 0, nSrc = -1, nDes = -1;
+ /* this is the path up to the folder of the src and dest ie C:\windows\ */
+ TCHAR szDestPath[MAX_PATH];
+ TCHAR szSrcPath[MAX_PATH];
+ DWORD dwFlags = 0;
+ /* If this is the type of copy where we are adding files */
+ BOOL bAppend = FALSE;
+ WIN32_FIND_DATA findBuffer;
+ HANDLE hFile;
+ BOOL bTouch = FALSE;
+ /* Used when something like "copy c*.exe d*.exe" during the process of
+ figuring out the new name */
+ TCHAR tmpName[MAX_PATH] = _T("");
+ /* Pointer to keep track of how far through the append input(file1+file2+file3) we are */
+ TCHAR * appendPointer = _T("\0");
+ /* The full path to src and dest. This has drive letter, folders, and filename */
+ TCHAR tmpDestPath[MAX_PATH];
+ TCHAR tmpSrcPath[MAX_PATH];
+ /* A bool on weather or not the destination name will be taking from the input */
+ BOOL bSrcName = FALSE;
+ /* Seems like a waste but it is a pointer used to copy from input to PreserveName */
+ TCHAR * UseThisName;
+ /* Stores the name( i.e. blah.txt or blah*.txt) which later we might need */
+ TCHAR PreserveName[MAX_PATH];
+ /* for CMDCOPY env */
+ TCHAR *evar;
+ int size;
+ TCHAR * szTouch;
+ BOOL bDone = FALSE;
+
+
+ /*Show help/usage info*/
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE, STRING_COPY_HELP2);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ /* Get the envor value if it exists */
+ evar = malloc(512 * sizeof(TCHAR));
+ if (evar==NULL) size = 0;
+ else
+ {
+ size = GetEnvironmentVariable (_T("COPYCMD"), evar, 512);
+ }
+ if (size > 512)
+ {
+ evar = realloc(evar,size * sizeof(TCHAR) );
+ if (evar!=NULL)
+ {
+ size = GetEnvironmentVariable (_T("COPYCMD"), evar, size);
+ }
+ else
+ {
+ size=0;
+ }
+ }
+
+ /* check see if we did get any env variable */
+ if (size !=0)
+ {
+ int t=0;
+ /* scan and set the flags */
+ for (t=0;t= 2)
+ {
+ switch (_totupper(arg[i][1]))
+ {
+
+ case _T('A'):
+ dwFlags |= COPY_ASCII;
+ break;
+
+ case _T('B'):
+ dwFlags |= COPY_BINARY;
+ break;
+
+ case _T('D'):
+ dwFlags |= COPY_DECRYPT;
+ break;
+
+ case _T('V'):
+ dwFlags |= COPY_VERIFY;
+ break;
+
+ case _T('N'):
+ dwFlags |= COPY_SHORTNAME;
+ break;
+
+ case _T('Y'):
+ dwFlags |= COPY_NO_PROMPT;
+ dwFlags &= ~COPY_PROMPT;
+ break;
+
+ case _T('-'):
+ if(_tcslen(arg[i]) >= 3)
+ if(_totupper(arg[i][2]) == _T('Y'))
+ {
+ dwFlags &= ~COPY_NO_PROMPT;
+ dwFlags |= COPY_PROMPT;
+ }
+
+ break;
+
+ case _T('Z'):
+ dwFlags |= COPY_RESTART;
+ break;
+
+ default:
+ /* invaild switch */
+ LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, _totupper(arg[i][1]));
+ nErrorLevel = 1;
+ return 1;
+ break;
+ }
+ }
+ /*If it was a switch, subtract from total arguments*/
+ nFiles--;
+ }
+ else
+ {
+ /*if it isnt a switch then it is the source or destination*/
+ if(nSrc == -1)
+ {
+ nSrc = i;
+ }
+ else if(*arg[i] == _T('+') || *arg[i] == _T(','))
+ {
+ /* Add these onto the source string
+ this way we can do all checks
+ directly on source string later on */
+ _tcscat(arg[nSrc],arg[i]);
+ nFiles--;
+ }
+ else if(nDes == -1)
+ {
+ nDes = i;
+ }
+
+ }
+ }
+
+ /* keep quiet within batch files */
+ if (bc != NULL)
+ {
+ dwFlags |= COPY_NO_PROMPT;
+ dwFlags &= ~COPY_PROMPT;
+ }
+
+ if(nFiles < 1)
+ {
+ /* There is not enough files, there has to be at least 1 */
+ ConOutResPuts(STRING_ERROR_REQ_PARAM_MISSING);
+ freep (arg);
+ return 1;
+ }
+
+ if(nFiles > 2)
+ {
+ /* there is too many file names in command */
+ LoadString(CMD_ModuleHandle, STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg,_T(""));
+ nErrorLevel = 1;
+ freep (arg);
+ return 1;
+ }
+
+ if(((_tcschr (arg[nSrc], _T('+')) != NULL) ||
+ (_tcschr (arg[nSrc], _T('*')) != NULL && _tcschr (arg[nDes], _T('*')) == NULL) ||
+ (IsExistingDirectory (arg[nSrc]) && (_tcschr (arg[nDes], _T('*')) == NULL && !IsExistingDirectory (arg[nDes])))
+ ))
+ {
+ /* There is a + in the source filename, this means
+ that there is more then one file being put into
+ one file. */
+ bAppend = TRUE;
+ if(_tcschr (arg[nSrc], _T('+')) != NULL)
+ appendPointer = arg[nSrc];
+ }
+
+ /* Reusing the number of files variable */
+ nFiles = 0;
+
+ do
+ {
+ /* Set up the string that is the path to the destination */
+ if(nDes != -1)
+ {
+ if(_tcslen(arg[nDes]) == 2 && arg[nDes][1] == _T(':'))
+ {
+ GetRootPath(arg[nDes],szDestPath,MAX_PATH);
+ }
+ else
+ /* If the user entered two file names then form the full string path*/
+ GetFullPathName (arg[nDes], MAX_PATH, szDestPath, NULL);
+
+ }
+ else
+ {
+ /* If no destination was entered then just use
+ the current directory as the destination */
+ GetCurrentDirectory (MAX_PATH, szDestPath);
+ }
+
+
+ /* Get the full string of the path to the source file*/
+ if(_tcschr (arg[nSrc], _T('+')) != NULL)
+ {
+ _tcscpy(tmpName,_T("\0"));
+ /* Loop through the source file name and copy all
+ the chars one at a time until it gets too + */
+ while(TRUE)
+ {
+ if(!_tcsncmp (appendPointer,_T("+"),1) || !_tcsncmp (appendPointer,_T("\0"),1))
+ {
+ /* Now that the pointer is on the + we
+ need to go to the start of the next filename */
+ if(!_tcsncmp (appendPointer,_T("+"),1))
+ appendPointer++;
+ else
+ bDone = TRUE;
+ break;
+
+ }
+
+ _tcsncat(tmpName,appendPointer,1);
+ appendPointer++;
+
+ }
+ /* Finish the string off with a null char */
+ _tcsncat(tmpName,_T("\0"),1);
+
+ if(_tcschr (arg[nSrc], _T(',')) != NULL)
+ {
+ /* Only time there is a , in the source is when they are using touch
+ Cant have a destination and can only have on ,, at the end of the string
+ Cant have more then one file name */
+ szTouch = _tcsstr (arg[nSrc], _T("+"));
+ if(_tcsncmp (szTouch,_T("+,,\0"),4) || nDes != -1)
+ {
+ LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_PARAM_FORMAT, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg,arg[nSrc]);
+ nErrorLevel = 1;
+ freep (arg);
+ return 1;
+ }
+ bTouch = TRUE;
+ bDone = TRUE;
+ }
+
+ if(_tcslen(tmpName) == 2)
+ {
+ if(tmpName[1] == _T(':'))
+ {
+
+ GetRootPath(tmpName,szSrcPath,MAX_PATH);
+ }
+ }
+ else
+ /* Get the full path to first file in the string of file names */
+ GetFullPathName (tmpName, MAX_PATH, szSrcPath, NULL);
+ }
+ else
+ {
+ bDone = TRUE;
+ if(_tcslen(arg[nSrc]) == 2 && arg[nSrc][1] == _T(':'))
+ {
+ GetRootPath(arg[nSrc],szSrcPath,MAX_PATH);
+ }
+ else
+ /* Get the full path of the source file */
+ GetFullPathName (arg[nSrc], MAX_PATH, szSrcPath, NULL);
+
+ }
+
+ /* From this point on, we can assume that the shortest path is 3 letters long
+ and that would be [DriveLetter]:\ */
+
+ /* If there is no * in the path name and it is a folder
+ then we will need to add a wildcard to the pathname
+ so FindFirstFile comes up with all the files in that
+ folder */
+ if(_tcschr (szSrcPath, _T('*')) == NULL &&
+ IsExistingDirectory (szSrcPath))
+ {
+ /* If it doesnt have a \ at the end already then on needs to be added */
+ if(szSrcPath[_tcslen(szSrcPath) - 1] != _T('\\'))
+ _tcscat (szSrcPath, _T("\\"));
+ /* Add a wildcard after the \ */
+ _tcscat (szSrcPath, _T("*"));
+ }
+ /* Make sure there is an ending slash to the path if the dest is a folder */
+ if(_tcschr (szDestPath, _T('*')) == NULL &&
+ IsExistingDirectory(szDestPath))
+ {
+ if(szDestPath[_tcslen(szDestPath) - 1] != _T('\\'))
+ _tcscat (szDestPath, _T("\\"));
+ }
+
+
+ /* Get a list of all the files */
+ hFile = FindFirstFile (szSrcPath, &findBuffer);
+
+
+ /* We need to figure out what the name of the file in the is going to be */
+ if((szDestPath[_tcslen(szDestPath) - 1] == _T('*') && szDestPath[_tcslen(szDestPath) - 2] == _T('\\')) ||
+ szDestPath[_tcslen(szDestPath) - 1] == _T('\\'))
+ {
+ /* In this case we will be using the same name as the source file
+ for the destination file because destination is a folder */
+ bSrcName = TRUE;
+ }
+ else
+ {
+ /* Save the name the user entered */
+ UseThisName = _tcsrchr(szDestPath,_T('\\'));
+ UseThisName++;
+ _tcscpy(PreserveName,UseThisName);
+ }
+
+ /* Strip the paths back to the folder they are in */
+ for(i = (_tcslen(szSrcPath) - 1); i > -1; i--)
+ if(szSrcPath[i] != _T('\\'))
+ szSrcPath[i] = _T('\0');
+ else
+ break;
+
+ for(i = (_tcslen(szDestPath) - 1); i > -1; i--)
+ if(szDestPath[i] != _T('\\'))
+ szDestPath[i] = _T('\0');
+ else
+ break;
+
+ do
+ {
+ /* Check Breaker */
+ if(CheckCtrlBreak(BREAK_INPUT))
+ {
+ freep(arg);
+ return 1;
+ }
+ /* Set the override to yes each new file */
+ nOverwrite = 1;
+
+ /* If it couldnt open the file handle, print out the error */
+ if(hFile == INVALID_HANDLE_VALUE)
+ {
+ ConOutFormatMessage (GetLastError(), szSrcPath);
+ freep (arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /* Ignore the . and .. files */
+ if(!_tcscmp (findBuffer.cFileName, _T(".")) ||
+ !_tcscmp (findBuffer.cFileName, _T(".."))||
+ findBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+ /* Copy the base folder over to a tmp string */
+ _tcscpy(tmpDestPath,szDestPath);
+
+ /* Can't put a file into a folder that isnt there */
+ if(!IsExistingDirectory(szDestPath))
+ {
+ ConOutFormatMessage (GetLastError (), szSrcPath);
+ freep (arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+ /* Copy over the destination path name */
+ if(bSrcName)
+ _tcscat (tmpDestPath, findBuffer.cFileName);
+ else
+ {
+ /* If there is no wildcard you can use the name the user entered */
+ if(_tcschr (PreserveName, _T('*')) == NULL)
+ {
+ _tcscat (tmpDestPath, PreserveName);
+ }
+ else
+ {
+ /* The following lines of copy were written by someone else
+ (most likely Eric Khoul) and it was taken from ren.c */
+ LPTSTR p,q,r;
+ TCHAR DoneFile[MAX_PATH];
+ /* build destination file name */
+ p = findBuffer.cFileName;
+ q = PreserveName;
+ r = DoneFile;
+ while(*q != 0)
+ {
+ if (*q == '*')
+ {
+ q++;
+ while (*p != 0 && *p != *q)
+ {
+ *r = *p;
+ p++;
+ r++;
+ }
+ }
+ else if (*q == '?')
+ {
+ q++;
+ if (*p != 0)
+ {
+ *r = *p;
+ p++;
+ r++;
+ }
+ }
+ else
+ {
+ *r = *q;
+ if (*p != 0)
+ p++;
+ q++;
+ r++;
+ }
+ }
+ *r = 0;
+ /* Add the filename to the tmp string path */
+ _tcscat (tmpDestPath, DoneFile);
+
+ }
+ }
+
+
+ /* Build the string path to the source file */
+ _tcscpy(tmpSrcPath,szSrcPath);
+ _tcscat (tmpSrcPath, findBuffer.cFileName);
+
+ /* Check to see if the file is the same file */
+ if(!bTouch && !_tcscmp (tmpSrcPath, tmpDestPath))
+ continue;
+
+ /* Handle any overriding / prompting that needs to be done */
+ if(((!(dwFlags & COPY_NO_PROMPT) && IsExistingFile (tmpDestPath)) || dwFlags & COPY_PROMPT) && !bTouch)
+ nOverwrite = CopyOverwrite(tmpDestPath);
+ if(nOverwrite == PROMPT_NO || nOverwrite == PROMPT_BREAK)
+ continue;
+ if(nOverwrite == PROMPT_ALL || (nOverwrite == PROMPT_YES && bAppend))
+ dwFlags |= COPY_NO_PROMPT;
+
+ /* Tell weather the copy was successful or not */
+ if(copy(tmpSrcPath,tmpDestPath, bAppend, dwFlags, bTouch))
+ {
+ nFiles++;
+ /* only print source name when more then one file */
+ if(_tcschr (arg[nSrc], _T('+')) != NULL || _tcschr (arg[nSrc], _T('*')) != NULL)
+ ConOutPrintf(_T("%s\n"),findBuffer.cFileName);
+ //LoadString(CMD_ModuleHandle, STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ }
+ else
+ {
+ /* print out the error message */
+ LoadString(CMD_ModuleHandle, STRING_COPY_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg);
+ ConOutFormatMessage (GetLastError(), szSrcPath);
+ nErrorLevel = 1;
+ }
+
+ /* Loop through all wildcard files */
+ }while(FindNextFile (hFile, &findBuffer));
+ /* Loop through all files in src string with a + */
+ }while(!bDone);
+
+ /* print out the number of files copied */
+ LoadString(CMD_ModuleHandle, STRING_COPY_FILE, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, nFiles);
+
+ CloseHandle(hFile);
+ if (arg!=NULL)
+ free(arg);
+
+ return 0;
+}
+
+
+#endif /* INCLUDE_CMD_COPY */
diff --git a/reactos/base/shell/cmd/date.c b/reactos/base/shell/cmd/date.c
new file mode 100644
index 00000000000..3c71a4b6329
--- /dev/null
+++ b/reactos/base/shell/cmd/date.c
@@ -0,0 +1,273 @@
+/*
+ * DATE.C - date internal command.
+ *
+ *
+ * History:
+ *
+ * 08 Jul 1998 (John P. Price)
+ * started.
+ *
+ * 20 Jul 1998 (John P. Price)
+ * corrected number of days for December from 30 to 31.
+ * (Thanx to Steffen Kaiser for bug report)
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 29-Jul-1998 (Rob Lake)
+ * fixed stand-alone mode.
+ * Added Pacific C compatible dos_getdate functions
+ *
+ * 09-Jan-1999 (Eric Kohl )
+ * Added locale support
+ *
+ * 23-Jan-1999 (Eric Kohl )
+ * Unicode and redirection safe!
+ *
+ * 04-Feb-1999 (Eric Kohl )
+ * Fixed date input bug.
+ *
+ * 03-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_DATE
+
+
+static WORD awMonths[2][13] =
+{
+ {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+ {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
+};
+
+
+static VOID
+PrintDateString (VOID)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ switch (nDateFormat)
+ {
+ case 0: /* mmddyy */
+ default:
+ LoadString(CMD_ModuleHandle, STRING_DATE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
+ break;
+
+ case 1: /* ddmmyy */
+ LoadString(CMD_ModuleHandle, STRING_DATE_HELP2, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
+ break;
+
+ case 2: /* yymmdd */
+ LoadString(CMD_ModuleHandle, STRING_DATE_HELP3, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, cDateSeparator, cDateSeparator);
+ break;
+ }
+}
+
+
+static BOOL
+ReadNumber (LPTSTR *s, LPWORD lpwValue)
+{
+ if (_istdigit (**s))
+ {
+ while (_istdigit (**s))
+ {
+ *lpwValue = *lpwValue * 10 + **s - _T('0');
+ (*s)++;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static BOOL
+ReadSeparator (LPTSTR *s)
+{
+ if (**s == _T('/') || **s == _T('-') || **s == cDateSeparator)
+ {
+ (*s)++;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+static BOOL
+ParseDate (LPTSTR s)
+{
+ SYSTEMTIME d;
+ unsigned char leap;
+ LPTSTR p = s;
+
+ if (!*s)
+ return TRUE;
+
+ GetLocalTime (&d);
+
+ d.wYear = 0;
+ d.wDay = 0;
+ d.wMonth = 0;
+
+ switch (nDateFormat)
+ {
+ case 0: /* mmddyy */
+ default:
+ if (!ReadNumber (&p, &d.wMonth))
+ return FALSE;
+ if (!ReadSeparator (&p))
+ return FALSE;
+ if (!ReadNumber (&p, &d.wDay))
+ return FALSE;
+ if (!ReadSeparator (&p))
+ return FALSE;
+ if (!ReadNumber (&p, &d.wYear))
+ return FALSE;
+ break;
+
+ case 1: /* ddmmyy */
+ if (!ReadNumber (&p, &d.wDay))
+ return FALSE;
+ if (!ReadSeparator (&p))
+ return FALSE;
+ if (!ReadNumber (&p, &d.wMonth))
+ return FALSE;
+ if (!ReadSeparator (&p))
+ return FALSE;
+ if (!ReadNumber (&p, &d.wYear))
+ return FALSE;
+ break;
+
+ case 2: /* yymmdd */
+ if (!ReadNumber (&p, &d.wYear))
+ return FALSE;
+ if (!ReadSeparator (&p))
+ return FALSE;
+ if (!ReadNumber (&p, &d.wMonth))
+ return FALSE;
+ if (!ReadSeparator (&p))
+ return FALSE;
+ if (!ReadNumber (&p, &d.wDay))
+ return FALSE;
+ break;
+ }
+
+ /* if only entered two digits: */
+ /* assume 2000's if value less than 80 */
+ /* assume 1900's if value greater or equal 80 */
+ if (d.wYear <= 99)
+ {
+ if (d.wYear >= 80)
+ d.wYear = 1900 + d.wYear;
+ else
+ d.wYear = 2000 + d.wYear;
+ }
+
+ leap = (!(d.wYear % 4) && (d.wYear % 100)) || !(d.wYear % 400);
+
+ if ((d.wMonth >= 1 && d.wMonth <= 12) &&
+ (d.wDay >= 1 && d.wDay <= awMonths[leap][d.wMonth]) &&
+ (d.wYear >= 1980 && d.wYear <= 2099))
+ {
+ SetLocalTime (&d);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+INT cmd_date (LPTSTR cmd, LPTSTR param)
+{
+ LPTSTR *arg;
+ INT argc;
+ INT i;
+ BOOL bPrompt = TRUE;
+ INT nDateString = -1;
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_DATE_HELP4);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ /* build parameter array */
+ arg = split (param, &argc, FALSE);
+
+ /* check for options */
+ for (i = 0; i < argc; i++)
+ {
+ if (_tcsicmp (arg[i], _T("/t")) == 0)
+ bPrompt = FALSE;
+ if ((*arg[i] != _T('/')) && (nDateString == -1))
+ nDateString = i;
+ }
+
+ if (nDateString == -1)
+ PrintDate ();
+
+ if (!bPrompt)
+ {
+ freep (arg);
+ return 0;
+ }
+
+ if (nDateString == -1)
+ {
+ while (TRUE) /* forever loop */
+ {
+ TCHAR s[40];
+
+ PrintDateString ();
+ ConInString (s, 40);
+#ifdef _DEBUG
+ DebugPrintf (_T("\'%s\'\n"), s);
+#endif
+ while (*s && s[_tcslen (s) - 1] < _T(' '))
+ s[_tcslen (s) - 1] = _T('\0');
+ if (ParseDate (s))
+ {
+ freep (arg);
+ return 0;
+ }
+ ConErrResPuts(STRING_DATE_ERROR);
+
+ }
+ }
+ else
+ {
+ if (!ParseDate (arg[nDateString]))
+ {
+ while (TRUE) /* forever loop */
+ {
+ TCHAR s[40];
+ ConErrResPuts(STRING_DATE_ERROR);
+
+ PrintDateString ();
+ ConInString (s, 40);
+
+ while (*s && s[_tcslen (s) - 1] < _T(' '))
+ s[_tcslen (s) - 1] = _T('\0');
+ if (ParseDate (s))
+ {
+ freep (arg);
+ return 0;
+ }
+ }
+ }
+ }
+
+ freep (arg);
+
+ return 0;
+}
+#endif /* INCLUDE_CMD_DATE */
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/del.c b/reactos/base/shell/cmd/del.c
new file mode 100644
index 00000000000..b059e551463
--- /dev/null
+++ b/reactos/base/shell/cmd/del.c
@@ -0,0 +1,570 @@
+/*
+* DEL.C - del internal command.
+*
+*
+* History:
+*
+* 06/29/98 (Rob Lake rlake@cs.mun.ca)
+* rewrote del to support wildcards
+* added my name to the contributors
+*
+* 07/13/98 (Rob Lake)
+* fixed bug that caused del not to delete file with out
+* attribute. moved set, del, ren, and ver to there own files
+*
+* 27-Jul-1998 (John P Price )
+* added config.h include
+*
+* 09-Dec-1998 (Eric Kohl )
+* Fixed command line parsing bugs.
+*
+* 21-Jan-1999 (Eric Kohl )
+* Started major rewrite using a new structure.
+*
+* 03-Feb-1999 (Eric Kohl )
+* First working version.
+*
+* 30-Mar-1999 (Eric Kohl )
+* Added quiet ("/Q"), wipe ("/W") and zap ("/Z") option.
+*
+* 06-Nov-1999 (Eric Kohl )
+* Little fix to keep DEL quiet inside batch files.
+*
+* 28-Jan-2004 (Michael Fritscher )
+* Added prompt ("/P"), yes ("/Y") and wipe("/W") option.
+*
+* 22-Jun-2005 (Brandon Turner )
+* Added exclusive deletion "del * -abc.txt -text*.txt"
+*
+* 22-Jun-2005 (Brandon Turner )
+* Implemented /A example "del /A:H /A:-R *.exe -ping.exe"
+*
+* 07-Aug-2005
+* Removed the exclusive deletion (see two comments above) because '-' is a valid file name character.
+* Optimized the recursive deletion in directories.
+* Preload some nice strings.
+*/
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_DEL
+
+
+enum
+{
+ DEL_ATTRIBUTES = 0x001, /* /A */
+ DEL_NOTHING = 0x004, /* /N */
+ DEL_PROMPT = 0x008, /* /P */
+ DEL_QUIET = 0x010, /* /Q */
+ DEL_SUBDIR = 0x020, /* /S */
+ DEL_TOTAL = 0x040, /* /T */
+ DEL_WIPE = 0x080, /* /W */
+ DEL_EMPTYDIR = 0x100, /* /X : not implemented */
+ DEL_YES = 0x200, /* /Y */
+ DEL_FORCE = 0x800 /* /F */
+};
+
+enum
+{
+ ATTR_ARCHIVE = 0x001, /* /A:A */
+ ATTR_HIDDEN = 0x002, /* /A:H */
+ ATTR_SYSTEM = 0x004, /* /A:S */
+ ATTR_READ_ONLY = 0x008, /* /A:R */
+ ATTR_N_ARCHIVE = 0x010, /* /A:-A */
+ ATTR_N_HIDDEN = 0x020, /* /A:-H */
+ ATTR_N_SYSTEM = 0x040, /* /A:-S */
+ ATTR_N_READ_ONLY = 0x080 /* /A:-R */
+};
+
+static TCHAR szDeleteWipe[RC_STRING_MAX_SIZE];
+static TCHAR szDelHelp2[RC_STRING_MAX_SIZE];
+static TCHAR szDelHelp3[RC_STRING_MAX_SIZE];
+static TCHAR szDelHelp4[RC_STRING_MAX_SIZE];
+static TCHAR szDelError5[RC_STRING_MAX_SIZE];
+static TCHAR szDelError6[RC_STRING_MAX_SIZE];
+static TCHAR szDelError7[RC_STRING_MAX_SIZE];
+static TCHAR CMDPath[MAX_PATH];
+
+static BOOLEAN StringsLoaded = FALSE;
+
+static VOID LoadStrings(VOID)
+{
+ LoadString( CMD_ModuleHandle, STRING_DELETE_WIPE, szDeleteWipe, RC_STRING_MAX_SIZE);
+ LoadString( CMD_ModuleHandle, STRING_DEL_HELP2, szDelHelp2, RC_STRING_MAX_SIZE);
+ LoadString( CMD_ModuleHandle, STRING_DEL_HELP3, szDelHelp3, RC_STRING_MAX_SIZE);
+ LoadString( CMD_ModuleHandle, STRING_DEL_HELP4, szDelHelp4, RC_STRING_MAX_SIZE);
+ LoadString( CMD_ModuleHandle, STRING_DEL_ERROR5, szDelError5, RC_STRING_MAX_SIZE);
+ LoadString( CMD_ModuleHandle, STRING_DEL_ERROR6, szDelError6, RC_STRING_MAX_SIZE);
+ LoadString( CMD_ModuleHandle, STRING_DEL_ERROR7, szDelError7, RC_STRING_MAX_SIZE);
+ GetModuleFileName(NULL, CMDPath, MAX_PATH);
+ StringsLoaded = TRUE;
+}
+
+static BOOL
+RemoveFile (LPTSTR lpFileName, DWORD dwFlags, WIN32_FIND_DATA* f)
+{
+ /*This function is called by CommandDelete and
+ does the actual process of deleting the single
+ file*/
+ if(CheckCtrlBreak(BREAK_INPUT))
+ return 1;
+
+ /*check to see if it is read only and if this is done based on /A
+ if it is done by file name, access is denied. However, if it is done
+ using the /A switch you must un-read only the file and allow it to be
+ deleted*/
+ if((dwFlags & DEL_ATTRIBUTES) || (dwFlags & DEL_FORCE))
+ {
+ if(f->dwFileAttributes & FILE_ATTRIBUTE_READONLY)
+ {
+ /*setting file to normal, not saving old attrs first
+ because the file is going to be deleted anyways
+ so the only thing that matters is that it isnt
+ read only.*/
+ SetFileAttributes(lpFileName,FILE_ATTRIBUTE_NORMAL);
+ }
+ }
+
+ if (dwFlags & DEL_WIPE)
+ {
+
+ HANDLE file;
+ DWORD temp;
+#define BufferSize 65536
+ BYTE buffer[BufferSize];
+ LONGLONG i;
+ LARGE_INTEGER FileSize;
+
+ FileSize.u.HighPart = f->nFileSizeHigh;
+ FileSize.u.LowPart = f->nFileSizeLow;
+
+ for(i = 0; i < BufferSize; i++)
+ {
+ buffer[i]=rand() % 256;
+ }
+ file = CreateFile (lpFileName, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL);
+ if (file != INVALID_HANDLE_VALUE)
+ {
+ for(i = 0; i < (FileSize.QuadPart - BufferSize); i += BufferSize)
+ {
+ WriteFile (file, buffer, BufferSize, &temp, NULL);
+ ConOutPrintf (_T("%I64d%% %s\r"),(i * (LONGLONG)100)/FileSize.QuadPart,szDeleteWipe);
+ }
+ WriteFile (file, buffer, (DWORD)(FileSize.QuadPart - i), &temp, NULL);
+ ConOutPrintf (_T("100%% %s\n"),szDeleteWipe);
+ CloseHandle (file);
+ }
+ }
+
+ return DeleteFile (lpFileName);
+}
+
+
+static DWORD
+DeleteFiles(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
+{
+ TCHAR szFullPath[MAX_PATH];
+ TCHAR szFileName[MAX_PATH];
+ LPTSTR pFilePart;
+ HANDLE hFile;
+ WIN32_FIND_DATA f;
+ BOOL bExclusion;
+ INT res;
+ DWORD dwFiles = 0;
+
+ _tcscpy(szFileName, FileName);
+
+ if(_tcschr (szFileName, _T('*')) == NULL &&
+ IsExistingDirectory (szFileName))
+ {
+ /* If it doesnt have a \ at the end already then on needs to be added */
+ if(szFileName[_tcslen(szFileName) - 1] != _T('\\'))
+ _tcscat (szFileName, _T("\\"));
+ /* Add a wildcard after the \ */
+ _tcscat (szFileName, _T("*"));
+ }
+
+ if(!_tcscmp (szFileName, _T("*")) ||
+ !_tcscmp (szFileName, _T("*.*")) ||
+ (szFileName[_tcslen(szFileName) - 2] == _T('\\') && szFileName[_tcslen(szFileName) - 1] == _T('*')))
+ {
+ /* well, the user wants to delete everything but if they didnt yes DEL_YES, DEL_QUIET, or DEL_PROMPT
+ then we are going to want to make sure that in fact they want to do that. */
+
+ if (!((*dwFlags & DEL_YES) || (*dwFlags & DEL_QUIET) || (*dwFlags & DEL_PROMPT)))
+ {
+ res = FilePromptYNA (szDelHelp2);
+ if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
+ return 0x80000000;
+ if(res == PROMPT_ALL)
+ *dwFlags |= DEL_YES;
+ }
+ }
+
+ GetFullPathName (szFileName,
+ MAX_PATH,
+ szFullPath,
+ &pFilePart);
+
+ hFile = FindFirstFile(szFullPath, &f);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ bExclusion = FALSE;
+
+ /*if it is going to be excluded by - no need to check attrs*/
+ if(*dwFlags & DEL_ATTRIBUTES && !bExclusion)
+ {
+
+ /*save if file attr check if user doesnt care about that attr anyways*/
+ if(dwAttrFlags & ATTR_ARCHIVE && !(f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_HIDDEN && !(f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_SYSTEM && !(f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_READ_ONLY && !(f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_N_ARCHIVE && (f.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_N_HIDDEN && (f.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_N_SYSTEM && (f.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM))
+ bExclusion = TRUE;
+ if(dwAttrFlags & ATTR_N_READ_ONLY && (f.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
+ bExclusion = TRUE;
+ }
+
+ if(bExclusion)
+ continue;
+
+ /* ignore directories */
+ if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ continue;
+
+
+ _tcscpy (pFilePart, f.cFileName);
+
+ /* We cant delete ourselves */
+ if(!_tcscmp (CMDPath,szFullPath))
+ continue;
+
+
+#ifdef _DEBUG
+ ConErrPrintf(_T("Full filename: %s\n"), szFullPath);
+#endif
+
+ /* ask for deleting */
+ if (*dwFlags & DEL_PROMPT)
+ {
+ ConErrPrintf(szDelError5, szFullPath);
+
+ res = FilePromptYN (szDelError6);
+
+ if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
+ {
+ nErrorLevel = 0;
+ continue;
+ }
+ }
+
+ /*user cant ask it to be quiet and tell you what it did*/
+ if (!(*dwFlags & DEL_QUIET) && !(*dwFlags & DEL_TOTAL))
+ {
+ ConErrPrintf(szDelError7, szFullPath);
+ }
+
+ /* delete the file */
+ if(*dwFlags & DEL_NOTHING)
+ continue;
+
+ if(RemoveFile (szFullPath, *dwFlags, &f))
+ dwFiles++;
+ else
+ {
+ ErrorMessage (GetLastError(), _T(""));
+// FindClose(hFile);
+// return -1;
+ }
+ }
+ while (FindNextFile (hFile, &f));
+ FindClose (hFile);
+ }
+ return dwFiles;
+}
+
+
+static DWORD
+ProcessDirectory(LPTSTR FileName, DWORD* dwFlags, DWORD dwAttrFlags)
+{
+ TCHAR szFullPath[MAX_PATH];
+ LPTSTR pFilePart;
+ LPTSTR pSearchPart;
+ HANDLE hFile;
+ WIN32_FIND_DATA f;
+ DWORD dwFiles = 0;
+
+ GetFullPathName (FileName,
+ MAX_PATH,
+ szFullPath,
+ &pFilePart);
+
+ dwFiles = DeleteFiles(szFullPath, dwFlags, dwAttrFlags);
+ if (dwFiles & 0x80000000)
+ return dwFiles;
+
+ if (*dwFlags & DEL_SUBDIR)
+ {
+ /* Get just the file name */
+ pSearchPart = _tcsrchr(FileName,_T('\\'));
+ if(pSearchPart != NULL)
+ pSearchPart++;
+ else
+ pSearchPart = FileName;
+
+ /* Get the full path to the file */
+ GetFullPathName (FileName,MAX_PATH,szFullPath,NULL);
+
+ /* strip the filename off of it */
+ pFilePart = _tcsrchr(szFullPath, _T('\\'));
+ if (pFilePart == NULL)
+ {
+ pFilePart = szFullPath;
+ }
+ else
+ {
+ pFilePart++;
+ }
+
+ _tcscpy(pFilePart, _T("*"));
+
+ hFile = FindFirstFile(szFullPath, &f);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if (!(f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ||
+ !_tcscmp(f.cFileName, _T(".")) ||
+ !_tcscmp(f.cFileName, _T("..")))
+ continue;
+
+ _tcscpy(pFilePart, f.cFileName);
+ _tcscat(pFilePart, _T("\\"));
+ _tcscat(pFilePart, pSearchPart);
+
+ dwFiles +=ProcessDirectory(szFullPath, dwFlags, dwAttrFlags);
+ if (dwFiles & 0x80000000)
+ {
+ break;
+ }
+ }
+ while (FindNextFile (hFile, &f));
+ FindClose (hFile);
+ }
+ }
+ return dwFiles;
+}
+
+
+
+INT CommandDelete (LPTSTR cmd, LPTSTR param)
+{
+ /*cmd is the command that was given, in this case it will always be "del" or "delete"
+ param is whatever is given after the command*/
+
+ LPTSTR *arg = NULL;
+ INT args;
+ INT i;
+ INT nEvalArgs = 0; /* nunber of evaluated arguments */
+ DWORD dwFlags = 0;
+ DWORD dwAttrFlags = 0;
+ DWORD dwFiles = 0;
+ LONG ch;
+ TCHAR szOrginalArg[MAX_PATH];
+
+ /*checks the first two chars of param to see if it is /?
+ this however allows the following command to not show help
+ "del frog.txt /?" */
+
+ if (!StringsLoaded)
+ {
+ LoadStrings();
+ }
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_DEL_HELP1);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ arg = split (param, &args, FALSE);
+
+ if (args == 0)
+ {
+ /* only command given */
+ error_req_param_missing ();
+ freep (arg);
+ return 1;
+ }
+ /* check for options anywhere in command line */
+ for (i = 0; i < args; i++)
+ {
+ if (*arg[i] == _T('/'))
+ {
+ /*found a command, but check to make sure it has something after it*/
+ if (_tcslen (arg[i]) >= 2)
+ {
+ ch = _totupper (arg[i][1]);
+ if (ch == _T('N'))
+ {
+ dwFlags |= DEL_NOTHING;
+ }
+ else if (ch == _T('P'))
+ {
+ dwFlags |= DEL_PROMPT;
+ }
+ else if (ch == _T('Q'))
+ {
+ dwFlags |= DEL_QUIET;
+ }
+ else if (ch == _T('F'))
+ {
+ dwFlags |= DEL_FORCE;
+ }
+ else if (ch == _T('S'))
+ {
+ dwFlags |= DEL_SUBDIR;
+ }
+ else if (ch == _T('T'))
+ {
+ dwFlags |= DEL_TOTAL;
+ }
+ else if (ch == _T('W'))
+ {
+ dwFlags |= DEL_WIPE;
+ }
+ else if (ch == _T('Y'))
+ {
+ dwFlags |= DEL_YES;
+ }
+ else if (ch == _T('A'))
+ {
+
+ dwFlags |= DEL_ATTRIBUTES;
+ /*the proper syntax for /A has a min of 4 chars
+ i.e. /A:R or /A:-H */
+ if (_tcslen (arg[i]) < 4)
+ {
+ error_invalid_parameter_format(arg[i]);
+ return 0;
+ }
+ ch = _totupper (arg[i][3]);
+ if (_tcslen (arg[i]) == 4)
+ {
+ if(ch == _T('A'))
+ {
+ dwAttrFlags |= ATTR_ARCHIVE;
+ }
+ if(ch == _T('H'))
+ {
+ dwAttrFlags |= ATTR_HIDDEN;
+ }
+ if(ch == _T('S'))
+ {
+ dwAttrFlags |= ATTR_SYSTEM;
+ }
+ if(ch == _T('R'))
+ {
+ dwAttrFlags |= ATTR_READ_ONLY;
+ }
+ }
+ if (_tcslen (arg[i]) == 5)
+ {
+ if(ch == _T('-'))
+ {
+ ch = _totupper (arg[i][4]);
+ if(ch == _T('A'))
+ {
+ dwAttrFlags |= ATTR_N_ARCHIVE;
+ }
+ if(ch == _T('H'))
+ {
+ dwAttrFlags |= ATTR_N_HIDDEN;
+ }
+ if(ch == _T('S'))
+ {
+ dwAttrFlags |= ATTR_N_SYSTEM;
+ }
+ if(ch == _T('R'))
+ {
+ dwAttrFlags |= ATTR_N_READ_ONLY;
+ }
+ }
+ }
+ }
+ }
+
+ nEvalArgs++;
+ }
+ }
+
+ /* there are only options on the command line --> error!!!
+ there is the same number of args as there is flags, so none of the args were filenames*/
+ if (args == nEvalArgs)
+ {
+ error_req_param_missing ();
+ freep (arg);
+ return 1;
+ }
+
+ /* keep quiet within batch files */
+ if (bc != NULL)
+ dwFlags |= DEL_QUIET;
+
+ /* check for filenames anywhere in command line */
+ for (i = 0; i < args && !(dwFiles & 0x80000000); i++)
+ {
+
+ /*this checks to see if it isnt a flag, if it isnt, we assume it is a file name*/
+ if((*arg[i] == _T('/')) || (*arg[i] == _T('-')))
+ continue;
+
+ /* We want to make a copies of the argument */
+ if(_tcslen(arg[i]) == 2 && arg[i][1] == _T(':'))
+ {
+ /* Check for C: D: ... */
+ GetRootPath(arg[i],szOrginalArg,MAX_PATH);
+ }
+ else
+ {
+ _tcscpy(szOrginalArg,arg[i]);
+ }
+ dwFiles += ProcessDirectory(szOrginalArg, &dwFlags, dwAttrFlags);
+
+ }
+
+ freep (arg);
+
+ /*Based on MS cmd, we only tell what files are being deleted when /S is used */
+ if (dwFlags & DEL_TOTAL)
+ {
+ dwFiles &= 0x7fffffff;
+ if (dwFiles < 2)
+ {
+ ConOutPrintf(szDelHelp3, dwFiles);
+ }
+ else
+ {
+ ConOutPrintf(szDelHelp4, dwFiles);
+ }
+ }
+
+ return 0;
+}
+
+
+#endif
diff --git a/reactos/base/shell/cmd/delay.c b/reactos/base/shell/cmd/delay.c
new file mode 100644
index 00000000000..4b383102e33
--- /dev/null
+++ b/reactos/base/shell/cmd/delay.c
@@ -0,0 +1,49 @@
+/*
+ * DELAY.C - internal command.
+ *
+ * clone from 4nt delay command
+ *
+ * 30 Aug 1999
+ * started - Paolo Pantaleo
+ *
+ *
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_DELAY
+
+
+INT CommandDelay (LPTSTR cmd, LPTSTR param)
+{
+ DWORD val;
+ DWORD mul=1000;
+
+ if (_tcsncmp (param, _T("/?"), 2) == 0)
+ {
+ ConOutResPaging(TRUE,STRING_DELAY_HELP);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ if (*param==0)
+ {
+ error_req_param_missing ();
+ return 1;
+ }
+
+ if (_tcsnicmp(param,_T("/m"),2) == 0)
+ {
+ mul = 1;
+ param += 2;
+ }
+
+ val = _ttoi(param);
+ Sleep(val * mul);
+
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_DELAY */
diff --git a/reactos/base/shell/cmd/dir.c b/reactos/base/shell/cmd/dir.c
new file mode 100644
index 00000000000..e70e1bcf300
--- /dev/null
+++ b/reactos/base/shell/cmd/dir.c
@@ -0,0 +1,2111 @@
+/*
+ * DIR.C - dir internal command.
+ *
+ *
+ * History:
+ *
+ * 01/29/97 (Tim Norman)
+ * started.
+ *
+ * 06/13/97 (Tim Norman)
+ * Fixed code.
+ *
+ * 07/12/97 (Tim Norman)
+ * Fixed bug that caused the root directory to be unlistable
+ *
+ * 07/12/97 (Marc Desrochers)
+ * Changed to use maxx, maxy instead of findxy()
+ *
+ * 06/08/98 (Rob Lake)
+ * Added compatibility for /w in dir
+ *
+ * 06/09/98 (Rob Lake)
+ * Compatibility for dir/s started
+ * Tested that program finds directories off root fine
+ *
+ * 06/10/98 (Rob Lake)
+ * do_recurse saves the cwd and also stores it in Root
+ * build_tree adds the cwd to the beginning of its' entries
+ * Program runs fine, added print_tree -- works fine.. as EXE,
+ * program won't work properly as COM.
+ *
+ * 06/11/98 (Rob Lake)
+ * Found problem that caused COM not to work
+ *
+ * 06/12/98 (Rob Lake)
+ * debugged...
+ * added free mem routine
+ *
+ * 06/13/98 (Rob Lake)
+ * debugged the free mem routine
+ * debugged whole thing some more
+ * Notes:
+ * ReadDir stores Root name and _Read_Dir does the hard work
+ * PrintDir prints Root and _Print_Dir does the hard work
+ * KillDir kills Root _after_ _Kill_Dir does the hard work
+ * Integrated program into DIR.C(this file) and made some same
+ * changes throughout
+ *
+ * 06/14/98 (Rob Lake)
+ * Cleaned up code a bit, added comments
+ *
+ * 06/16/98 (Rob Lake)
+ * Added error checking to my previously added routines
+ *
+ * 06/17/98 (Rob Lake)
+ * Rewrote recursive functions, again! Most other recursive
+ * functions are now obsolete -- ReadDir, PrintDir, _Print_Dir,
+ * KillDir and _Kill_Dir. do_recurse does what PrintDir did
+ * and _Read_Dir did what it did before along with what _Print_Dir
+ * did. Makes /s a lot faster!
+ * Reports 2 more files/dirs that MS-DOS actually reports
+ * when used in root directory(is this because dir defaults
+ * to look for read only files?)
+ * Added support for /b, /a and /l
+ * Made error message similar to DOS error messages
+ * Added help screen
+ *
+ * 06/20/98 (Rob Lake)
+ * Added check for /-(switch) to turn off previously defined
+ * switches.
+ * Added ability to check for DIRCMD in environment and
+ * process it
+ *
+ * 06/21/98 (Rob Lake)
+ * Fixed up /B
+ * Now can dir *.ext/X, no spaces!
+ *
+ * 06/29/98 (Rob Lake)
+ * error message now found in command.h
+ *
+ * 07/08/1998 (John P. Price)
+ * removed extra returns; closer to MSDOS
+ * fixed wide display so that an extra return is not displayed
+ * when there is five filenames in the last line.
+ *
+ * 07/12/98 (Rob Lake)
+ * Changed error messages
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ *
+ * 04-Dec-1998 (Eric Kohl )
+ * Converted source code to Win32, except recursive dir ("dir /s").
+ *
+ * 10-Dec-1998 (Eric Kohl )
+ * Fixed recursive dir ("dir /s").
+ *
+ * 14-Dec-1998 (Eric Kohl )
+ * Converted to Win32 directory functions and
+ * fixed some output bugs. There are still some more ;)
+ *
+ * 10-Jan-1999 (Eric Kohl )
+ * Added "/N" and "/4" options, "/O" is a dummy.
+ * Added locale support.
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Redirection safe!
+ *
+ * 01-Mar-1999 (Eric Kohl )
+ * Replaced all runtime io functions by their Win32 counterparts.
+ *
+ * 23-Feb-2001 (Carl Nettelblad )
+ * dir /s now works in deeper trees
+ *
+ * 28-Jan-2004 (Michael Fritscher )
+ * Fix for /p, so it is working under Windows in GUI-mode, too.
+ *
+ * 30-Apr-2004 (Filip Navara )
+ * Fix /w to print long names.
+ *
+ * 27-Feb-2005 (Konstantinos Paliouras )
+ * Implemented all the switches that were missing, and made
+ * the ros dir very similar to windows dir. Major part of
+ * the code is rewritten. /p is removed, to be rewriten in
+ * the main cmd code.
+ *
+ * 1-Jul-2004 (Brandon Turner )
+ * Added /p back in using ConOutPrintfPaging
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_DIR
+
+
+
+/* Time Field enumeration */
+enum ETimeField
+{
+ TF_CREATIONDATE = 0,
+ TF_MODIFIEDDATE = 1,
+ TF_LASTACCESSEDDATE = 2
+};
+
+/* Ordered by enumeration */
+enum EOrderBy
+{
+ ORDER_NAME = 0,
+ ORDER_SIZE = 1,
+ ORDER_DIRECTORY = 2,
+ ORDER_EXTENSION = 3,
+ ORDER_TIME = 4
+};
+
+/* The struct for holding the switches */
+typedef struct _DirSwitchesFlags
+{
+ BOOL bBareFormat; /* Bare Format */
+ BOOL bTSeperator; /* Thousands seperator */
+ BOOL bWideList; /* Wide list format */
+ BOOL bWideListColSort; /* Wide list format but sorted by column */
+ BOOL bLowerCase; /* Uses lower case */
+ BOOL bNewLongList; /* New long list */
+ BOOL bPause; /* Pause per page */
+ BOOL bUser; /* Displays the owner of file */
+ BOOL bRecursive; /* Displays files in specified directory and all sub */
+ BOOL bShortName; /* Displays the sort name of files if exist */
+ BOOL b4Digit; /* Four digit year */
+ struct
+ {
+ DWORD dwAttribVal; /* The desired state of attribute */
+ DWORD dwAttribMask; /* Which attributes to check */
+ BOOL bUnSet; /* A helper flag if "-" was given with the switch */
+ BOOL bParSetted; /* A helper flag if parameters of switch were given */
+ } stAttribs; /* Displays files with this attributes only */
+ struct
+ {
+ enum EOrderBy eCriteria[3]; /* Criterias used to order by */
+ BOOL bCriteriaRev[3]; /* If the criteria is in reversed order */
+ short sCriteriaCount; /* The quantity of criterias */
+ BOOL bUnSet; /* A helper flag if "-" was given with the switch */
+ BOOL bParSetted; /* A helper flag if parameters of switch were given */
+ } stOrderBy; /* Ordered by criterias */
+ struct
+ {
+ enum ETimeField eTimeField; /* The time field that will be used for */
+ BOOL bUnSet; /* A helper flag if "-" was given with the switch */
+ BOOL bParSetted; /* A helper flag if parameters of switch were given */
+ } stTimeField; /* The time field to display or use for sorting */
+} DIRSWITCHFLAGS, *LPDIRSWITCHFLAGS;
+
+
+typedef struct _DIRFINDLISTNODE
+{
+ WIN32_FIND_DATA stFindInfo;
+ struct _DIRFINDLISTNODE *ptrNext;
+} DIRFINDLISTNODE, *PDIRFINDLISTNODE;
+
+
+typedef BOOL
+(WINAPI *PGETFREEDISKSPACEEX)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
+
+
+/* Globally save the # of dirs, files and bytes,
+ * probabaly later pass them to functions. Rob Lake */
+static ULONG recurse_dir_cnt;
+static ULONG recurse_file_cnt;
+static ULARGE_INTEGER recurse_bytes;
+
+
+/*
+ * help
+ *
+ * displays help screen for dir
+ * Rob Lake
+ */
+static VOID
+DirHelp(VOID)
+{
+ ConOutResPaging(TRUE, STRING_DIR_HELP1);
+}
+
+
+
+/*
+ * DirReadParameters
+ *
+ * Parse the parameters and switches of the command line and exports them
+ */
+static BOOL
+DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & switches */
+ LPTSTR** params, /* [OUT] The parameters after parsing */
+ LPINT entries, /* [OUT] The number of parameters after parsing */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN/OUT] The flags after calculating switches */
+{
+ TCHAR cCurSwitch; /* The current switch */
+ TCHAR cCurChar; /* Current examing character */
+ TCHAR cCurUChar; /* Current upper examing character */
+ BOOL bNegative; /* Negative switch */
+ BOOL bPNegative; /* Negative switch parameter */
+ BOOL bIntoQuotes; /* A flag showing if we are in quotes (") */
+ LPTSTR ptrStart; /* A pointer to the first character of a parameter */
+ LPTSTR ptrEnd; /* A pointer to the last character of a parameter */
+ LPTSTR temp;
+
+ /* Initialize parameter array */
+ *params = malloc(sizeof(LPTSTR));
+ if(!params)
+ return FALSE;
+ *params = NULL;
+ *entries = 0;
+ ptrStart = NULL;
+ ptrEnd = NULL;
+
+ /* Initialize variables; */
+ cCurSwitch = _T(' ');
+ bNegative = FALSE;
+ bPNegative = FALSE;
+ bIntoQuotes = FALSE;
+
+ /* We suppose that switch parameters
+ were given to avoid setting them to default
+ if the switch was not given */
+ lpFlags->stAttribs.bParSetted = TRUE;
+ lpFlags->stOrderBy.bParSetted = TRUE;
+ lpFlags->stTimeField.bParSetted = TRUE;
+
+
+ /* Main Loop (see README_DIR.txt) */
+ /* scan the command line char per char, and we process its char */
+ while (*Line)
+ {
+ /* we save current character as it is and its upper case */
+ cCurChar = *Line;
+ cCurUChar = _totupper(*Line);
+
+ /* 1st section (see README_DIR.txt) */
+ /* When a switch is expecting */
+ if (cCurSwitch == _T('/'))
+ {
+ if ((cCurUChar == _T('A')) ||(cCurUChar == _T('T')) || (cCurUChar == _T('O')))
+ {
+ cCurSwitch = cCurUChar;
+ switch (cCurUChar)
+ {
+ case _T('A'):
+ lpFlags->stAttribs.bUnSet = bNegative;
+ lpFlags->stAttribs.bParSetted = FALSE;
+ break;
+ case _T('T'):
+ lpFlags->stTimeField.bUnSet = bNegative;
+ lpFlags->stTimeField.bParSetted = FALSE;
+ break;
+ case _T('O'):
+ lpFlags->stOrderBy.bUnSet = bNegative;
+ lpFlags->stOrderBy.bParSetted = FALSE;
+ break;
+ }
+ }
+ else if (cCurUChar == _T('L'))
+ lpFlags->bLowerCase = ! bNegative;
+ else if (cCurUChar == _T('B'))
+ lpFlags->bBareFormat = ! bNegative;
+ else if (cCurUChar == _T('C'))
+ lpFlags->bTSeperator = ! bNegative;
+ else if (cCurUChar == _T('W'))
+ lpFlags->bWideList = ! bNegative;
+ else if (cCurUChar == _T('D'))
+ lpFlags->bWideListColSort = ! bNegative;
+ else if (cCurUChar == _T('N'))
+ lpFlags->bNewLongList = ! bNegative;
+ else if (cCurUChar == _T('P'))
+ lpFlags->bPause = ! bNegative;
+ else if (cCurUChar == _T('Q'))
+ lpFlags->bUser = ! bNegative;
+ else if (cCurUChar == _T('S'))
+ lpFlags->bRecursive = ! bNegative;
+ else if (cCurUChar == _T('X'))
+ lpFlags->bShortName = ! bNegative;
+ else if (cCurChar == _T('4'))
+ lpFlags->b4Digit = ! bNegative;
+ else if (cCurChar == _T('?'))
+ {
+ DirHelp();
+ return FALSE;
+ }
+ else if (cCurChar == _T('-'))
+ {
+ bNegative = TRUE;
+ }
+ else
+ {
+ error_invalid_switch ((TCHAR)_totupper (*Line));
+ return FALSE;
+ }
+
+ /* We check if we calculated the negative value and realese the flag */
+ if ((cCurChar != _T('-')) && bNegative)
+ bNegative = FALSE;
+
+ /* if not a,o,t or - option then next parameter is not a switch */
+ if ((cCurSwitch == _T('/')) && (!bNegative))
+ cCurSwitch = _T(' ');
+
+ }
+ else if ((cCurSwitch == _T(' ')) || (cCurSwitch == _T('P')))
+ {
+ /* 2nd section (see README_DIR.txt) */
+ /* We are expecting parameter or the unknown */
+
+ if (cCurChar == _T('/'))
+ cCurSwitch = _T('/');
+
+ /* Process a spacer */
+ else if (cCurChar == _T(' '))
+ {
+ if (!bIntoQuotes)
+ {
+ cCurSwitch = _T(' ');
+ if(ptrStart && ptrEnd)
+ {
+ temp = malloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ if(!temp)
+ return FALSE;
+ memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ temp[(ptrEnd - ptrStart + 1)] = _T('\0');
+ if(!add_entry(entries, params, temp))
+ {
+ free(temp);
+ freep(*params);
+ return FALSE;
+ }
+
+ free(temp);
+
+ ptrStart = NULL;
+ ptrEnd = NULL;
+ }
+ }
+
+ }
+ else if (cCurChar == _T('\"'))
+ {
+ /* Process a quote */
+ bIntoQuotes = !bIntoQuotes;
+ if(!bIntoQuotes)
+ ptrEnd = Line;
+ }
+ else
+ {
+ /* Process a character for parameter */
+ if ((cCurSwitch == _T(' ')) && ptrStart && ptrEnd)
+ {
+ temp = malloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ if(!temp)
+ return FALSE;
+ memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ temp[(ptrEnd - ptrStart + 1)] = _T('\0');
+ if(!add_entry(entries, params, temp))
+ {
+ free(temp);
+ freep(*params);
+ return FALSE;
+ }
+
+ free(temp);
+
+ ptrStart = NULL;
+ ptrEnd = NULL;
+ }
+ cCurSwitch = _T('P');
+ if(!ptrStart)
+ ptrStart = ptrEnd = Line;
+ ptrEnd = Line;
+ }
+ }
+ else
+ {
+ /* 3rd section (see README_DIR.txt) */
+ /* We are waiting for switch parameters */
+
+ /* Check if there are no more switch parameters */
+ if ((cCurChar == _T('/')) || ( cCurChar == _T(' ')))
+ {
+ /* Wrong desicion path, reprocess current character */
+ cCurSwitch = cCurChar;
+ continue;
+ }
+ /* Process parameter switch */
+ switch(cCurSwitch)
+ {
+ case _T('A'): /* Switch parameters for /A (attributes filter) */
+ /* Ok a switch parameter was given */
+ lpFlags->stAttribs.bParSetted = TRUE;
+
+ if (cCurChar == _T(':'))
+ /* =V= dead command, used to make the "if" work */
+ cCurChar = cCurChar;
+ else if(cCurChar == _T('-'))
+ bPNegative = TRUE;
+ else if(cCurUChar == _T('D'))
+ {
+ lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_DIRECTORY;
+ if (bPNegative)
+ lpFlags->stAttribs.dwAttribVal &= ~FILE_ATTRIBUTE_DIRECTORY;
+ else
+ lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_DIRECTORY;
+ }
+ else if(cCurUChar == _T('R'))
+ {
+ lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_READONLY;
+ if (bPNegative)
+ lpFlags->stAttribs.dwAttribVal &= ~FILE_ATTRIBUTE_READONLY;
+ else
+ lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_READONLY;
+ }
+ else if(cCurUChar == _T('H'))
+ {
+ lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_HIDDEN;
+ if (bPNegative)
+ lpFlags->stAttribs.dwAttribVal &= ~FILE_ATTRIBUTE_HIDDEN;
+ else
+ lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_HIDDEN;
+ }
+ else if(cCurUChar == _T('A'))
+ {
+ lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_ARCHIVE;
+ if (bPNegative)
+ lpFlags->stAttribs.dwAttribVal &= ~FILE_ATTRIBUTE_ARCHIVE;
+ else
+ lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_ARCHIVE;
+ }
+ else if(cCurUChar == _T('S'))
+ {
+ lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_SYSTEM;
+ if (bPNegative)
+ lpFlags->stAttribs.dwAttribVal &= ~FILE_ATTRIBUTE_SYSTEM;
+ else
+ lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_SYSTEM;
+ }
+ else
+ {
+ error_parameter_format((TCHAR)_totupper (*Line));
+ return FALSE;
+ }
+ break;
+ case _T('T'): /* Switch parameters for /T (time field) */
+
+ /* Ok a switch parameter was given */
+ lpFlags->stTimeField.bParSetted = TRUE;
+
+ if (cCurChar == _T(':'))
+ /* =V= dead command, used to make the "if" work */
+ cCurChar = cCurChar;
+ else if(cCurUChar == _T('C'))
+ lpFlags->stTimeField.eTimeField= TF_CREATIONDATE ;
+ else if(cCurUChar == _T('A'))
+ lpFlags->stTimeField.eTimeField= TF_LASTACCESSEDDATE ;
+ else if(cCurUChar == _T('W'))
+ lpFlags->stTimeField.eTimeField= TF_MODIFIEDDATE ;
+ else
+ {
+ error_parameter_format((TCHAR)_totupper (*Line));
+ return FALSE;
+ }
+ break;
+ case _T('O'): /* Switch parameters for /O (order) */
+ /* Ok a switch parameter was given */
+ lpFlags->stOrderBy.bParSetted = TRUE;
+
+ if (cCurChar == _T(':'))
+ /* <== dead command, used to make the "if" work */
+ cCurChar = cCurChar;
+ else if(cCurChar == _T('-'))
+ bPNegative = TRUE;
+ else if(cCurUChar == _T('N'))
+ {
+ if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
+ lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
+ lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_NAME;
+ }
+ else if(cCurUChar == _T('S'))
+ {
+ if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
+ lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
+ lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_SIZE;
+ }
+ else if(cCurUChar == _T('G'))
+ {
+ if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
+ lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
+ lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_DIRECTORY;
+ }
+ else if(cCurUChar == _T('E'))
+ {
+ if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
+ lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
+ lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_EXTENSION;
+ }
+ else if(cCurUChar == _T('D'))
+ {
+ if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
+ lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
+ lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_TIME;
+ }
+
+ else
+ {
+ error_parameter_format((TCHAR)_totupper (*Line));
+ return FALSE;
+ }
+
+
+ }
+ /* We check if we calculated the negative value and realese the flag */
+ if ((cCurChar != _T('-')) && bPNegative)
+ bPNegative = FALSE;
+ }
+
+ Line++;
+ }
+ /* Terminate the parameters */
+ if(ptrStart && ptrEnd)
+ {
+ temp = malloc((ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ if(!temp)
+ return FALSE;
+ memcpy(temp, ptrStart, (ptrEnd - ptrStart) + 2 * sizeof (TCHAR));
+ temp[(ptrEnd - ptrStart + 1)] = _T('\0');
+ if(!add_entry(entries, params, temp))
+ {
+ free(temp);
+ freep(*params);
+ return FALSE;
+ }
+
+ free(temp);
+
+ ptrStart = NULL;
+ ptrEnd = NULL;
+ }
+
+ /* Calculate the switches with no switch paramater */
+ if (!(lpFlags->stAttribs.bParSetted))
+ {
+ lpFlags->stAttribs.dwAttribVal = 0L;
+ lpFlags->stAttribs.dwAttribMask = lpFlags->stAttribs.dwAttribVal;
+ }
+ if (!(lpFlags->stOrderBy.bParSetted))
+ {
+ lpFlags->stOrderBy.sCriteriaCount = 1;
+ lpFlags->stOrderBy.eCriteria[0] = ORDER_NAME;
+ lpFlags->stOrderBy.bCriteriaRev[0] = FALSE;
+ }
+ if (!(lpFlags->stOrderBy.bParSetted))
+ lpFlags->stTimeField.eTimeField = TF_MODIFIEDDATE ;
+
+ /* Calculate the unsetted switches (the "-" prefixed)*/
+ if (lpFlags->stAttribs.bUnSet)
+ {
+ lpFlags->stAttribs.bUnSet = FALSE;
+ lpFlags->stAttribs.dwAttribVal = 0L;
+ lpFlags->stAttribs.dwAttribMask = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
+ }
+ if (lpFlags->stOrderBy.bUnSet)
+ {
+ lpFlags->stOrderBy.bUnSet = FALSE;
+ lpFlags->stOrderBy.sCriteriaCount = 0;
+ }
+ if (lpFlags->stTimeField.bUnSet )
+ {
+ lpFlags->stTimeField.bUnSet = FALSE;
+ lpFlags->stTimeField.eTimeField = TF_MODIFIEDDATE;
+ }
+ return TRUE;
+}
+
+
+/*
+ * ExtendFilespec
+ *
+ * extend the filespec, possibly adding wildcards
+ */
+static VOID
+ExtendFilespec (LPTSTR file)
+{
+ INT len = 0;
+
+ if (!file)
+ return;
+
+
+ /* if no file spec, change to "*.*" */
+ if (*file == _T('\0'))
+ {
+ _tcscpy (file, _T("*.*"));
+ return;
+ }
+
+ // add support for *.
+ if ((file[0] == _T('*')) && (file[1] == _T('.') ))
+ {
+ return;
+ }
+
+ /* if starts with . add * in front */
+ if (*file == _T('.'))
+ {
+ memmove (&file[1], &file[0], (_tcslen (file) + 1) * sizeof(TCHAR));
+ file[0] = _T('*');
+ }
+
+ /* if no . add .* */
+ if (!_tcschr (file, _T('.')))
+ {
+ _tcscat (file, _T(".*"));
+ return;
+ }
+
+
+
+ /* if last character is '.' add '*' */
+ len = _tcslen (file);
+ if (file[len - 1] == _T('.'))
+ {
+ _tcscat (file, _T("*"));
+ return;
+ }
+}
+
+
+/*
+ * dir_parse_pathspec
+ *
+ * split the pathspec into drive, directory, and filespec
+ */
+static INT
+DirParsePathspec (LPTSTR szPathspec, LPTSTR szPath, LPTSTR szFilespec)
+{
+ TCHAR szOrigPath[MAX_PATH];
+ LPTSTR start;
+ LPTSTR tmp;
+ INT i;
+ BOOL bWildcards = FALSE;
+
+ GetCurrentDirectory (MAX_PATH, szOrigPath);
+
+ /* get the drive and change to it */
+ if (szPathspec[1] == _T(':'))
+ {
+ TCHAR szRootPath[] = _T("A:");
+
+ szRootPath[0] = szPathspec[0];
+ start = szPathspec + 2;
+ if (!SetCurrentDirectory (szRootPath))
+ {
+ ErrorMessage (GetLastError(), NULL);
+ return 1;
+ }
+ }
+ else
+ {
+ start = szPathspec;
+ }
+
+
+ /* check for wildcards */
+ for (i = 0; szPathspec[i]; i++)
+ {
+ if (szPathspec[i] == _T('*') || szPathspec[i] == _T('?'))
+ bWildcards = TRUE;
+ }
+
+ /* check if this spec is a directory */
+ if (!bWildcards)
+ {
+ if (SetCurrentDirectory (szPathspec))
+ {
+ _tcscpy (szFilespec, _T("*.*"));
+
+ if (!GetCurrentDirectory (MAX_PATH, szPath))
+ {
+ szFilespec[0] = _T('\0');
+ SetCurrentDirectory (szOrigPath);
+ error_out_of_memory();
+ return 1;
+ }
+
+ SetCurrentDirectory (szOrigPath);
+ return 0;
+ }
+ }
+
+ /* find the file spec */
+ tmp = _tcsrchr (start, _T('\\'));
+
+ /* if no path is specified */
+ if (!tmp)
+ {
+ _tcscpy (szFilespec, start);
+ ExtendFilespec (szFilespec);
+ if (!GetCurrentDirectory (MAX_PATH, szPath))
+ {
+ szFilespec[0] = _T('\0');
+ SetCurrentDirectory (szOrigPath);
+ error_out_of_memory();
+ return 1;
+ }
+
+ SetCurrentDirectory (szOrigPath);
+ return 0;
+ }
+
+ /* get the filename */
+ _tcscpy (szFilespec, tmp+1);
+ ExtendFilespec (szFilespec);
+
+ if (tmp == start)
+ {
+ /* change to the root directory */
+ if (!SetCurrentDirectory (_T("\\")))
+ {
+ szFilespec[0] = _T('\0');
+ SetCurrentDirectory (szOrigPath);
+ error_path_not_found ();
+ return 1;
+ }
+ }
+ else
+ {
+ *tmp = _T('\0');
+
+ /* change to this directory */
+ if (!SetCurrentDirectory (start))
+ {
+ *tmp = _T('\\');
+ szFilespec[0] = _T('\0');
+ SetCurrentDirectory (szOrigPath);
+ error_path_not_found ();
+ return 1;
+ }
+ }
+
+ /* get the full name of the directory */
+ if (!GetCurrentDirectory (MAX_PATH, szPath))
+ {
+ *tmp = _T('\\');
+ szFilespec[0] = _T('\0');
+ SetCurrentDirectory (szOrigPath);
+ error_out_of_memory ();
+ return 1;
+ }
+
+ *tmp = _T('\\');
+
+ SetCurrentDirectory (szOrigPath);
+
+ return 0;
+}
+
+
+/*
+ * incline
+ *
+ * increment our line if paginating, display message at end of screen
+ */
+#if 0
+static BOOL
+IncLine (LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
+{
+ BOOL bError;
+ CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo;
+ LONG WindowHeight;
+
+ bError = GetConsoleScreenBufferInfo(hConsole, &lpConsoleScreenBufferInfo);
+
+ WindowHeight = lpConsoleScreenBufferInfo.srWindow.Bottom - lpConsoleScreenBufferInfo.srWindow.Top;
+
+ /* That prevents bad behiour if WindowHeight could not be calculated */
+ if (!WindowHeight)
+ {
+ WindowHeight= 1000000;
+ }
+
+ if (!(lpFlags->bPause))
+ return FALSE;
+
+ (*pLine)++;
+
+ /*
+ * Because I don't know if WindowsHeight work in all cases,
+ * perhaps then maxy is the right value
+ */
+ if (*pLine >= (int)maxy - 2 || *pLine >= WindowHeight)
+ {
+ *pLine = 0;
+ return (PagePrompt () == PROMPT_BREAK);
+ }
+
+ return FALSE;
+}
+#endif
+
+/*
+ * PrintDirectoryHeader
+ *
+ * print the header for the dir command
+ */
+static BOOL
+PrintDirectoryHeader(LPTSTR szPath, LPINT pLine, LPDIRSWITCHFLAGS lpFlags)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szRootName[MAX_PATH];
+ TCHAR szVolName[80];
+ DWORD dwSerialNr;
+ LPTSTR p;
+
+ if (lpFlags->bBareFormat)
+ return TRUE;
+
+ /* build usable root path */
+ if (szPath[1] == _T(':') && szPath[2] == _T('\\'))
+ {
+ /* normal path */
+ szRootName[0] = szPath[0];
+ szRootName[1] = _T(':');
+ szRootName[2] = _T('\\');
+ szRootName[3] = 0;
+ }
+ else if (szPath[0] == _T('\\') && szPath[1] == _T('\\'))
+ {
+ /* UNC path */
+ p = _tcschr(&szPath[2], _T('\\'));
+ if (p == NULL)
+ {
+ error_invalid_drive();
+ return(FALSE);
+ }
+ p = _tcschr(p+1, _T('\\'));
+ if (p == NULL)
+ {
+ _tcscpy(szRootName, szPath);
+ _tcscat(szRootName, _T("\\"));
+ }
+ else
+ {
+ *p = 0;
+ _tcscpy(szRootName, szPath);
+ _tcscat(szRootName, _T("\\"));
+ *p = _T('\\');
+ }
+ }
+ else
+ {
+ error_invalid_drive();
+ return(FALSE);
+ }
+
+ /* get the media ID of the drive */
+ if (!GetVolumeInformation(szRootName, szVolName, 80, &dwSerialNr,
+ NULL, NULL, NULL, 0))
+ {
+ error_invalid_drive();
+ return(FALSE);
+ }
+
+ /* print drive info */
+ if (szVolName[0] != _T('\0'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP2, szMsg, RC_STRING_MAX_SIZE);
+ //needs to have first paramter as TRUE because
+ //this is the first output and need to clear the static
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(TRUE,szMsg, szRootName[0], szVolName);
+ else
+ ConOutPrintf(szMsg, szRootName[0], szVolName);
+
+ }
+ else
+ {
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP3, szMsg, RC_STRING_MAX_SIZE);
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(TRUE,szMsg, szRootName[0]);
+ else
+ ConOutPrintf(szMsg, szRootName[0]);
+ }
+
+ /* print the volume serial number if the return was successful */
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP4, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,szMsg,
+ HIWORD(dwSerialNr),
+ LOWORD(dwSerialNr));
+ else
+ ConOutPrintf(szMsg,
+ HIWORD(dwSerialNr),
+ LOWORD(dwSerialNr));
+
+
+ return TRUE;
+}
+
+
+/*
+ * convert
+ *
+ * insert commas into a number
+ *
+ */
+#if 0
+static INT
+ConvertULong (ULONG num, LPTSTR des, INT len)
+{
+ TCHAR temp[32];
+ INT c = 0;
+ INT n = 0;
+
+ if (num == 0)
+ {
+ des[0] = _T('0');
+ des[1] = _T('\0');
+ n = 1;
+ }
+ else
+ {
+ temp[31] = 0;
+ while (num > 0)
+ {
+ if (((c + 1) % (nNumberGroups + 1)) == 0)
+ temp[30 - c++] = cThousandSeparator;
+ temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
+ num /= 10;
+ }
+
+ for (n = 0; n <= c; n++)
+ des[n] = temp[31 - c + n];
+ }
+
+ return n;
+}
+#endif
+
+static VOID
+DirPrintFileDateTime(TCHAR *lpDate,
+ TCHAR *lpTime,
+ LPWIN32_FIND_DATA lpFile,
+ LPDIRSWITCHFLAGS lpFlags)
+{
+ FILETIME ft;
+ SYSTEMTIME dt;
+ TCHAR szDate[30];
+ TCHAR szTime[30];
+ WORD wYear;
+
+ /* Select the right time field */
+ switch (lpFlags->stTimeField.eTimeField)
+ {
+ case TF_CREATIONDATE:
+ if (!FileTimeToLocalFileTime(&lpFile->ftCreationTime, &ft))
+ return;
+ FileTimeToSystemTime(&ft, &dt);
+ break;
+
+ case TF_LASTACCESSEDDATE :
+ if (!FileTimeToLocalFileTime(&lpFile->ftLastAccessTime, &ft))
+ return;
+ FileTimeToSystemTime(&ft, &dt);
+ break;
+
+ case TF_MODIFIEDDATE:
+ if (!FileTimeToLocalFileTime(&lpFile->ftLastWriteTime, &ft))
+ return;
+ FileTimeToSystemTime(&ft, &dt);
+ break;
+ }
+
+ /* Format date */
+ wYear = (lpFlags->b4Digit) ? dt.wYear : dt.wYear%100;
+ switch (nDateFormat)
+ {
+ case 0: /* mmddyy */
+ default:
+ _stprintf (szDate, _T("%02d%c%02d%c%0*d"),
+ dt.wMonth, cDateSeparator,
+ dt.wDay, cDateSeparator,
+ lpFlags->b4Digit?4:2, wYear);
+ break;
+
+ case 1: /* ddmmyy */
+ _stprintf (szDate, _T("%02d%c%02d%c%0*d"),
+ dt.wDay, cDateSeparator, dt.wMonth,
+ cDateSeparator,lpFlags->b4Digit?4:2, wYear);
+ break;
+
+ case 2: /* yymmdd */
+ _stprintf (szDate, _T("%0*d%c%02d%c%02d"),
+ lpFlags->b4Digit?4:2, wYear, cDateSeparator,
+ dt.wMonth, cDateSeparator, dt.wDay);
+ break;
+ }
+ /* Format Time */
+ switch (nTimeFormat)
+ {
+ case 0: /* 12 hour format */
+ default:
+ _stprintf (szTime,_T(" %02d%c%02u%c"),
+ (dt.wHour == 0 ? 12 : (dt.wHour <= 12 ? dt.wHour : dt.wHour - 12)),
+ cTimeSeparator,
+ dt.wMinute, (dt.wHour <= 11 ? _T('a') : _T('p')));
+ break;
+
+ case 1: /* 24 hour format */
+ _stprintf (szTime, _T(" %02d%c%02u"),
+ dt.wHour, cTimeSeparator, dt.wMinute);
+ break;
+ }
+ /* Copy results */
+ _tcscpy(lpDate, szDate);
+ _tcscpy(lpTime, szTime);
+}
+
+
+static VOID
+GetUserDiskFreeSpace(LPCTSTR lpRoot,
+ PULARGE_INTEGER lpFreeSpace)
+{
+ PGETFREEDISKSPACEEX pGetFreeDiskSpaceEx;
+ HINSTANCE hInstance;
+ DWORD dwSecPerCl;
+ DWORD dwBytPerSec;
+ DWORD dwFreeCl;
+ DWORD dwTotCl;
+ ULARGE_INTEGER TotalNumberOfBytes, TotalNumberOfFreeBytes;
+
+ lpFreeSpace->QuadPart = 0;
+
+ hInstance = LoadLibrary(_T("KERNEL32"));
+ if (hInstance != NULL)
+ {
+ pGetFreeDiskSpaceEx = (PGETFREEDISKSPACEEX)GetProcAddress(hInstance,
+#ifdef _UNICODE
+ "GetDiskFreeSpaceExW");
+#else
+ "GetDiskFreeSpaceExA");
+#endif
+ if (pGetFreeDiskSpaceEx != NULL)
+ {
+ if (pGetFreeDiskSpaceEx(lpRoot, lpFreeSpace, &TotalNumberOfBytes, &TotalNumberOfFreeBytes) == TRUE)
+ return;
+ }
+ FreeLibrary(hInstance);
+ }
+
+ GetDiskFreeSpace(lpRoot,
+ &dwSecPerCl,
+ &dwBytPerSec,
+ &dwFreeCl,
+ &dwTotCl);
+
+ lpFreeSpace->QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
+}
+
+
+/*
+ * print_summary: prints dir summary
+ * Added by Rob Lake 06/17/98 to compact code
+ * Just copied Tim's Code and patched it a bit
+ *
+ */
+static INT
+PrintSummary(LPTSTR szPath,
+ ULONG ulFiles,
+ ULONG ulDirs,
+ ULARGE_INTEGER u64Bytes,
+ LPINT pLine,
+ LPDIRSWITCHFLAGS lpFlags)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szBuffer[64];
+ ULARGE_INTEGER uliFree;
+ TCHAR szRoot[] = _T("A:\\");
+
+
+ /* Here we check if we didn't find anything */
+ if (!(ulFiles + ulDirs))
+ {
+ error_file_not_found();
+ return 1;
+ }
+
+
+ /* In bare format we don't print results */
+ if (lpFlags->bBareFormat)
+ return 0;
+
+ /* Print recursive specific results */
+
+ /* Take this code offline to fix /S does not print duoble info */
+ if (lpFlags->bRecursive)
+ {
+ ConvertULargeInteger(u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP5, szMsg, RC_STRING_MAX_SIZE);
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,szMsg,ulFiles, szBuffer);
+ else
+ ConOutPrintf(szMsg,ulFiles, szBuffer);
+ }
+ else
+ {
+
+ /* Print File Summary */
+ /* Condition to print summary is:
+ If we are not in bare format and if we have results! */
+ if (ulFiles > 0)
+ {
+ ConvertULargeInteger(u64Bytes, szBuffer, 20, lpFlags->bTSeperator);
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP8, szMsg, RC_STRING_MAX_SIZE);
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,szMsg,ulFiles, szBuffer);
+ else
+ ConOutPrintf(szMsg,ulFiles, szBuffer);
+
+ }
+
+ }
+ /* Print total directories and freespace */
+ szRoot[0] = szPath[0];
+ GetUserDiskFreeSpace(szRoot, &uliFree);
+ ConvertULargeInteger(uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP6, (LPTSTR) szMsg, RC_STRING_MAX_SIZE);
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,szMsg,ulDirs, szBuffer);
+ else
+ ConOutPrintf(szMsg,ulDirs, szBuffer);
+
+ return 0;
+}
+
+/*
+ * getExt
+ *
+ * Get the extension of a filename
+ */
+TCHAR* getExt(const TCHAR* file)
+{
+ static TCHAR *NoExt = _T("");
+ TCHAR* lastdot = _tcsrchr(file, _T('.'));
+ return (lastdot != NULL ? lastdot + 1 : NoExt);
+}
+
+/*
+ * getName
+ *
+ * Get the name of the file without extension
+ */
+static LPTSTR
+getName(const TCHAR* file, TCHAR * dest)
+{
+ int iLen;
+ LPTSTR end;
+
+ /* Check for "." and ".." folders */
+ if ((_tcscmp(file, _T(".")) == 0) ||
+ (_tcscmp(file, _T("..")) == 0))
+ {
+ _tcscpy(dest,file);
+ return dest;
+ }
+
+ end = _tcsrchr(file, _T('.'));
+ if (!end)
+ iLen = _tcslen(file);
+ else
+ iLen = (end - file);
+
+
+ _tcsncpy(dest, file, iLen);
+ *(dest + iLen) = _T('\0');
+
+ return dest;
+}
+
+
+/*
+ * DirPrintNewList
+ *
+ * The function that prints in new style
+ */
+static VOID
+DirPrintNewList(LPWIN32_FIND_DATA ptrFiles[], /* [IN]Files' Info */
+ DWORD dwCount, /* [IN] The quantity of files */
+ TCHAR *szCurPath, /* [IN] Full path of current directory */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */
+{
+ DWORD i;
+ TCHAR szSize[30];
+ TCHAR szShortName[15];
+ TCHAR szDate[20];
+ TCHAR szTime[20];
+ INT iSizeFormat;
+ ULARGE_INTEGER u64FileSize;
+
+ for (i = 0;i < dwCount;i++)
+ {
+ /* Calculate size */
+ if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ /* Directory */
+ iSizeFormat = -14;
+ _tcscpy(szSize, _T(""));
+ }
+ else
+ {
+ /* File */
+ iSizeFormat = 14;
+ u64FileSize.HighPart = ptrFiles[i]->nFileSizeHigh;
+ u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow;
+ ConvertULargeInteger(u64FileSize, szSize, 20, lpFlags->bTSeperator);
+ }
+
+ /* Calculate short name */
+ szShortName[0] = _T('\0');
+ if (lpFlags->bShortName)
+ _stprintf(szShortName, _T(" %-12s"), ptrFiles[i]->cAlternateFileName);
+
+ /* Format date and time */
+ DirPrintFileDateTime(szDate, szTime, ptrFiles[i], lpFlags);
+
+ /* Print the line */
+ if(lpFlags->bPause)
+ {
+ if (ConOutPrintfPaging(FALSE,_T("%10s %-8s %*s%s %s\n"),
+ szDate,
+ szTime,
+ iSizeFormat,
+ szSize,
+ szShortName,
+ ptrFiles[i]->cFileName) == 1)
+ return ;
+ }
+ else
+ ConOutPrintf(_T("%10s %-8s %*s%s %s\n"),
+ szDate,
+ szTime,
+ iSizeFormat,
+ szSize,
+ szShortName,
+ ptrFiles[i]->cFileName);
+ }
+}
+
+
+/*
+ * DirPrintWideList
+ *
+ * The function that prints in wide list
+ */
+static VOID
+DirPrintWideList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
+ DWORD dwCount, /* [IN] The quantity of files */
+ TCHAR *szCurPath, /* [IN] Full path of current directory */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */
+{
+ SHORT iScreenWidth;
+ USHORT iColumns;
+ USHORT iLines;
+ UINT iLongestName;
+ TCHAR szTempFname[MAX_PATH];
+ DWORD i;
+ DWORD j;
+ DWORD temp;
+
+ /* Calculate longest name */
+ iLongestName = 1;
+ for (i = 0; i < dwCount; i++)
+ {
+ if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ /* Directories need 2 additinal characters for brackets */
+ if ((_tcslen(ptrFiles[i]->cFileName) + 2) > iLongestName)
+ iLongestName = _tcslen(ptrFiles[i]->cFileName) + 2;
+ }
+ else
+ {
+ if (_tcslen(ptrFiles[i]->cFileName) > iLongestName)
+ iLongestName = _tcslen(ptrFiles[i]->cFileName);
+ }
+ }
+
+ /* Count the highest number of columns */
+ GetScreenSize(&iScreenWidth, 0);
+ iColumns = iScreenWidth / iLongestName;
+
+ /* Check if there is enough space for spaces between names */
+ if (((iLongestName * iColumns) + iColumns) >= (UINT)iScreenWidth)
+ iColumns --;
+
+ /* A last check at iColumns to avoid division by zero */
+ if (!(iColumns))
+ iColumns = 1;
+
+ /* Print Column sorted */
+ if (lpFlags->bWideListColSort)
+ {
+ /* Calculate the lines that will be printed */
+// iLines = ceil((float)dwCount/(float)iColumns);
+ iLines = (USHORT)(dwCount / iColumns);
+
+ for (i = 0;i < iLines;i++)
+ {
+ for (j = 0; j < iColumns; j++)
+ {
+ temp = (j * iLines) + i;
+ if (temp >= dwCount)
+ break;
+
+ if (ptrFiles[temp]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ _stprintf(szTempFname, _T("[%s]"), ptrFiles[temp]->cFileName);
+ else
+ _stprintf(szTempFname, _T("%s"), ptrFiles[temp]->cFileName);
+
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,_T("%-*s"), iLongestName + 1 , szTempFname);
+ else
+ ConOutPrintf(_T("%-*s"), iLongestName + 1 , szTempFname);
+ }
+
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,_T("\n"));
+ else
+ ConOutPrintf(_T("\n"));
+ }
+ }
+ else
+ {
+ /* Print Line sorted */
+ for (i = 0; i < dwCount; i++)
+ {
+ if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ _stprintf(szTempFname, _T("[%s]"), ptrFiles[i]->cFileName);
+ else
+ _stprintf(szTempFname, _T("%s"), ptrFiles[i]->cFileName);
+
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,_T("%-*s"), iLongestName + 1, szTempFname );
+ else
+ ConOutPrintf(_T("%-*s"), iLongestName + 1, szTempFname );
+
+ /*
+ * We print a new line at the end of each column
+ * except for the case that it is the last item.
+ */
+ if (!((i + 1) % iColumns) && (i < (dwCount - 1)))
+ {
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,_T("\n"));
+ else
+ ConOutPrintf(_T("\n"));
+ }
+ }
+
+ /* Add a new line after the last item */
+ if(lpFlags->bPause)
+ ConOutPrintfPaging(FALSE,_T("\n"));
+ else
+ ConOutPrintf(_T("\n"));
+ }
+}
+
+
+/*
+ * DirPrintOldList
+ *
+ * The function that prints in old style
+ */
+static VOID
+DirPrintOldList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
+ DWORD dwCount, /* [IN] The quantity of files */
+ TCHAR * szCurPath, /* [IN] Full path of current directory */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */
+{
+DWORD i; /* An indexer for "for"s */
+TCHAR szName[10]; /* The name of file */
+TCHAR szExt[5]; /* The extension of file */
+TCHAR szDate[30],szTime[30]; /* Used to format time and date */
+TCHAR szSize[30]; /* The size of file */
+int iSizeFormat; /* The format of size field */
+ULARGE_INTEGER u64FileSize; /* The file size */
+
+ for(i = 0;i < dwCount;i++)
+ {
+ /* Broke 8.3 format */
+ if (*ptrFiles[i]->cAlternateFileName )
+ {
+ /* If the file is long named then we read the alter name */
+ getName( ptrFiles[i]->cAlternateFileName, szName);
+ _tcscpy(szExt, getExt( ptrFiles[i]->cAlternateFileName));
+ }
+ else
+ {
+ /* If the file is not long name we read its original name */
+ getName( ptrFiles[i]->cFileName, szName);
+ _tcscpy(szExt, getExt( ptrFiles[i]->cFileName));
+ }
+
+ /* Calculate size */
+ if (ptrFiles[i]->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ /* Directory, no size it's a directory*/
+ iSizeFormat = -17;
+ _tcscpy(szSize, _T(""));
+ }
+ else
+ {
+ /* File */
+ iSizeFormat = 17;
+ u64FileSize.HighPart = ptrFiles[i]->nFileSizeHigh;
+ u64FileSize.LowPart = ptrFiles[i]->nFileSizeLow;
+ ConvertULargeInteger(u64FileSize, szSize, 20, lpFlags->bTSeperator);
+ }
+
+ /* Format date and time */
+ DirPrintFileDateTime(szDate,szTime,ptrFiles[i],lpFlags);
+
+ /* Print the line */
+ if(lpFlags->bPause)
+ {
+ if (ConOutPrintfPaging(FALSE,_T("%-8s %-3s %*s %s %s\n"),
+ szName, /* The file's 8.3 name */
+ szExt, /* The file's 8.3 extension */
+ iSizeFormat, /* print format for size column */
+ szSize, /* The size of file or "" for dirs */
+ szDate, /* The date of file/dir */
+ szTime) == 1) /* The time of file/dir */
+ {
+ return ;
+ }
+ }
+ else
+ ConOutPrintf(_T("%-8s %-3s %*s %s %s\n"),
+ szName, /* The file's 8.3 name */
+ szExt, /* The file's 8.3 extension */
+ iSizeFormat, /* print format for size column */
+ szSize, /* The size of file or "" for dirs */
+ szDate, /* The date of file/dir */
+ szTime); /* The time of file/dir */
+ }
+}
+
+/*
+ * DirPrintBareList
+ *
+ * The function that prints in bare format
+ */
+static VOID
+DirPrintBareList(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
+ DWORD dwCount, /* [IN] The number of files */
+ LPTSTR lpCurPath, /* [IN] Full path of current directory */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */
+{
+ TCHAR szFullName[MAX_PATH];
+ DWORD i;
+
+ for (i = 0; i < dwCount; i++)
+ {
+ if ((_tcscmp(ptrFiles[i]->cFileName, _T(".")) == 0) ||
+ (_tcscmp(ptrFiles[i]->cFileName, _T("..")) == 0))
+ {
+ /* at bare format we don't print "." and ".." folder */
+ continue;
+ }
+ if (lpFlags->bRecursive)
+ {
+ /* at recursive mode we print full path of file */
+ _tcscpy(szFullName, lpCurPath);
+ _tcscat(szFullName, ptrFiles[i]->cFileName);
+ if(lpFlags->bPause)
+ {
+ if (ConOutPrintfPaging(FALSE,_T("%s\n"), szFullName) == 1)
+ {
+ return ;
+ }
+ }
+ else
+ ConOutPrintf(_T("%s\n"), szFullName);
+ }
+ else
+ {
+ /* if we are not in recursive mode we print the file names */
+ if(lpFlags->bPause)
+ {
+ if (ConOutPrintfPaging(FALSE,_T("%s\n"),ptrFiles[i]->cFileName) == 1)
+ {
+ return ;
+ }
+ }
+ else
+ ConOutPrintf(_T("%s\n"),ptrFiles[i]->cFileName);
+ }
+ }
+}
+
+
+/*
+ * DirPrintFiles
+ *
+ * The functions that prints the files list
+ */
+static VOID
+DirPrintFiles(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
+ DWORD dwCount, /* [IN] The quantity of files */
+ TCHAR *szCurPath, /* [IN] Full path of current directory */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags used */
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szTemp[MAX_PATH]; /* A buffer to format the directory header */
+
+ /* Print directory header */
+ _tcscpy(szTemp, szCurPath);
+
+ /* We cut the trailing \ of the full path */
+ szTemp[_tcslen(szTemp)-1] = _T('\0');
+
+ /* Condition to print header:
+ We are not printing in bare format
+ and if we are in recursive mode... we must have results */
+ if (!(lpFlags->bBareFormat ) && !((lpFlags->bRecursive) && (dwCount <= 0)))
+ {
+ LoadString(CMD_ModuleHandle, STRING_DIR_HELP7, szMsg, RC_STRING_MAX_SIZE);
+ if(lpFlags->bPause)
+ {
+ if (ConOutPrintfPaging(FALSE,szMsg, szTemp) == 1)
+ {
+ return ;
+ }
+ }
+ else
+ ConOutPrintf(szMsg, szTemp);
+ }
+
+ if (lpFlags->bBareFormat)
+ {
+ /* Bare format */
+ DirPrintBareList(ptrFiles, dwCount, szCurPath, lpFlags);
+ }
+ else if(lpFlags->bShortName)
+ {
+ /* New list style / Short names */
+ DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags);
+ }
+ else if(lpFlags->bWideListColSort || lpFlags->bWideList)
+ {
+ /* Wide list */
+ DirPrintWideList(ptrFiles, dwCount, szCurPath, lpFlags);
+ }
+ else if (lpFlags->bNewLongList )
+ {
+ /* New list style*/
+ DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags);
+ }
+ else
+ {
+ /* If nothing is selected old list is the default */
+ DirPrintOldList(ptrFiles, dwCount, szCurPath, lpFlags);
+ }
+}
+
+
+
+/*
+ * CompareFiles
+ *
+ * Compares 2 files based on the order criteria
+ */
+static BOOL
+CompareFiles(LPWIN32_FIND_DATA lpFile1, /* [IN] A pointer to WIN32_FIND_DATA of file 1 */
+ LPWIN32_FIND_DATA lpFile2, /* [IN] A pointer to WIN32_FIND_DATA of file 2 */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags that we use to list */
+{
+ ULARGE_INTEGER u64File1;
+ ULARGE_INTEGER u64File2;
+ int i;
+ long iComp = 0; /* The comparison result */
+
+ /* Calculate critiries by order given from user */
+ for (i = 0;i < lpFlags->stOrderBy.sCriteriaCount;i++)
+ {
+
+ /* Calculate criteria */
+ switch(lpFlags->stOrderBy.eCriteria[i])
+ {
+ case ORDER_SIZE: /* Order by size /o:s */
+ /* concat the 32bit integers to a 64bit */
+ u64File1.LowPart = lpFile1->nFileSizeLow;
+ u64File1.HighPart = lpFile1->nFileSizeHigh;
+ u64File2.LowPart = lpFile2->nFileSizeLow;
+ u64File2.HighPart = lpFile2->nFileSizeHigh;
+
+ /* In case that differnce is too big for a long */
+ if (u64File1.QuadPart < u64File2.QuadPart)
+ iComp = -1;
+ else if (u64File1.QuadPart > u64File2.QuadPart)
+ iComp = 1;
+ else
+ iComp = 0;
+ break;
+
+ case ORDER_DIRECTORY: /* Order by directory attribute /o:g */
+ iComp = ((lpFile2->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)-
+ (lpFile1->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
+ break;
+
+ case ORDER_EXTENSION: /* Order by extension name /o:e */
+ iComp = _tcsicmp(getExt(lpFile1->cFileName),getExt(lpFile2->cFileName));
+ break;
+
+ case ORDER_NAME: /* Order by filename /o:n */
+ iComp = _tcsicmp(lpFile1->cFileName, lpFile2->cFileName);
+ break;
+
+ case ORDER_TIME: /* Order by file's time /o:t */
+ /* We compare files based on the time field selected by /t */
+ switch(lpFlags->stTimeField.eTimeField)
+ {
+ case TF_CREATIONDATE:
+ /* concat the 32bit integers to a 64bit */
+ u64File1.LowPart = lpFile1->ftCreationTime.dwLowDateTime;
+ u64File1.HighPart = lpFile1->ftCreationTime.dwHighDateTime ;
+ u64File2.LowPart = lpFile2->ftCreationTime.dwLowDateTime;
+ u64File2.HighPart = lpFile2->ftCreationTime.dwHighDateTime ;
+ break;
+ case TF_LASTACCESSEDDATE :
+ /* concat the 32bit integers to a 64bit */
+ u64File1.LowPart = lpFile1->ftLastAccessTime.dwLowDateTime;
+ u64File1.HighPart = lpFile1->ftLastAccessTime.dwHighDateTime ;
+ u64File2.LowPart = lpFile2->ftLastAccessTime.dwLowDateTime;
+ u64File2.HighPart = lpFile2->ftLastAccessTime.dwHighDateTime ;
+ break;
+ case TF_MODIFIEDDATE:
+ /* concat the 32bit integers to a 64bit */
+ u64File1.LowPart = lpFile1->ftLastWriteTime.dwLowDateTime;
+ u64File1.HighPart = lpFile1->ftLastWriteTime.dwHighDateTime ;
+ u64File2.LowPart = lpFile2->ftLastWriteTime.dwLowDateTime;
+ u64File2.HighPart = lpFile2->ftLastWriteTime.dwHighDateTime ;
+ break;
+ }
+
+ /* In case that differnce is too big for a long */
+ if (u64File1.QuadPart < u64File2.QuadPart)
+ iComp = -1;
+ else if (u64File1.QuadPart > u64File2.QuadPart)
+ iComp = 1;
+ else
+ iComp = 0;
+ break;
+ }
+
+ /* Reverse if desired */
+ if (lpFlags->stOrderBy.bCriteriaRev[i])
+ iComp *= -1;
+
+ /* If that criteria was enough for distinguishing
+ the files/dirs,there is no need to calculate the others*/
+ if (iComp != 0) break;
+ }
+
+ /* Translate the value of iComp to boolean */
+ if (iComp > 0)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+/*
+ * QsortFiles
+ *
+ * Sort files by the order criterias using quicksort method
+ */
+static VOID
+QsortFiles(LPWIN32_FIND_DATA ptrArray[], /* [IN/OUT] The array with file info pointers */
+ int i, /* [IN] The index of first item in array */
+ int j, /* [IN] The index to last item in array */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags that we will use to sort */
+{
+ LPWIN32_FIND_DATA lpTemp; /* A temporary pointer */
+ int First, Last, Temp;
+ BOOL Way;
+
+ if (i < j)
+ {
+ First = i;
+ Last = j;
+ Way = TRUE;
+ while (i != j)
+ {
+ if (Way == CompareFiles(ptrArray[i], ptrArray[j], lpFlags))
+ {
+ /* Swap the pointers of the array */
+ lpTemp = ptrArray[i];
+ ptrArray[i]= ptrArray[j];
+ ptrArray[j] = lpTemp;
+
+ /* Swap the indexes for inverting sorting */
+ Temp = i;
+ i = j;
+ j =Temp;
+
+ Way = !Way;
+ }
+
+ j += (!Way - Way);
+ }
+
+ QsortFiles(ptrArray,First, i-1, lpFlags);
+ QsortFiles(ptrArray,i+1,Last, lpFlags);
+ }
+}
+
+
+
+/*
+ * DirList
+ *
+ * The functions that does everything except for printing results
+ */
+static INT
+DirList(LPTSTR szPath, /* [IN] The path that dir starts */
+ LPTSTR szFilespec, /* [IN] The type of file that we are looking for */
+ LPINT pLine, /* FIXME: Maybe used for paginating */
+ LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */
+{
+ HANDLE hSearch; /* The handle of the search */
+ HANDLE hRecSearch; /* The handle for searching recursivly */
+ WIN32_FIND_DATA wfdFileInfo; /* The info of file that found */
+ LPWIN32_FIND_DATA * ptrFileArray; /* An array of pointers with all the files */
+ PDIRFINDLISTNODE ptrStartNode; /* The pointer to the first node */
+ PDIRFINDLISTNODE ptrNextNode; /* A pointer used for relatives refernces */
+TCHAR szFullPath[MAX_PATH]; /* The full path that we are listing with trailing \ */
+TCHAR szFullFileSpec[MAX_PATH]; /* The full path with file specs that we ll request\ */
+DWORD dwCount; /* A counter of files found in directory */
+DWORD dwCountFiles; /* Counter for files */
+DWORD dwCountDirs; /* Counter for directories */
+ULARGE_INTEGER u64CountBytes; /* Counter for bytes */
+ULARGE_INTEGER u64Temp; /* A temporary counter */
+
+ /* Initialize Variables */
+ ptrStartNode = NULL;
+ ptrNextNode = NULL;
+ dwCount = 0;
+ dwCountFiles = 0;
+ dwCountDirs = 0;
+ u64CountBytes.QuadPart = 0;
+
+ /* Create szFullPath and szFullFileSpec */
+ _tcscpy (szFullPath, szPath);
+ if (szFullPath[_tcslen(szFullPath) - 1] != _T('\\'))
+ _tcscat (szFullPath, _T("\\"));
+ _tcscpy (szFullFileSpec, szFullPath);
+ _tcscat (szFullFileSpec, szFilespec);
+
+ /* Prepare the linked list, first node is allocated */
+ ptrStartNode = malloc(sizeof(DIRFINDLISTNODE));
+ if (ptrStartNode == NULL)
+ {
+#ifdef _DEBUG
+ ConErrPrintf(_T("DEBUG: Cannot allocate memory for ptrStartNode!\n"));
+#endif
+ return 1; /* Error cannot allocate memory for 1st object */
+ }
+ ptrNextNode = ptrStartNode;
+
+ /* Collect the results for the current folder */
+ hSearch = FindFirstFile(szFullFileSpec, &wfdFileInfo);
+ do
+ {
+ if (hSearch != INVALID_HANDLE_VALUE)
+ {
+ /* Here we filter all the specified attributes */
+ if ((wfdFileInfo.dwFileAttributes & lpFlags->stAttribs.dwAttribMask )
+ == (lpFlags->stAttribs.dwAttribMask & lpFlags->stAttribs.dwAttribVal ))
+ {
+ ptrNextNode->ptrNext = malloc(sizeof(DIRFINDLISTNODE));
+ if (ptrNextNode->ptrNext == NULL)
+ {
+#ifdef _DEBUG
+ ConErrPrintf(_T("DEBUG: Cannot allocate memory for ptrNextNode->ptrNext!\n"));
+#endif
+ while (ptrStartNode)
+ {
+ ptrNextNode = ptrStartNode->ptrNext;
+ free(ptrStartNode);
+ ptrStartNode = ptrNextNode;
+ dwCount --;
+ }
+ return 1;
+ }
+
+ /* If malloc fails we go to next file in hope it works,
+ without braking the linked list! */
+ if (ptrNextNode->ptrNext)
+ {
+ /* Copy the info of search at linked list */
+ memcpy(&ptrNextNode->ptrNext->stFindInfo,
+ &wfdFileInfo,
+ sizeof(WIN32_FIND_DATA));
+
+ /* If lower case is selected do it here */
+ if (lpFlags->bLowerCase)
+ {
+ _tcslwr(ptrNextNode->ptrNext->stFindInfo.cAlternateFileName);
+ _tcslwr(ptrNextNode->ptrNext->stFindInfo.cFileName);
+ }
+
+ /* Continue at next node at linked list */
+ ptrNextNode = ptrNextNode->ptrNext;
+ dwCount ++;
+
+ /* Grab statistics */
+ if (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ /* Directory */
+ dwCountDirs++;
+ }
+ else
+ {
+ /* File */
+ dwCountFiles++;
+ u64Temp.HighPart = wfdFileInfo.nFileSizeHigh;
+ u64Temp.LowPart = wfdFileInfo.nFileSizeLow;
+ u64CountBytes.QuadPart += u64Temp.QuadPart;
+ }
+ }
+ }
+ }
+ }while(FindNextFile(hSearch, &wfdFileInfo));
+ FindClose(hSearch);
+
+ /* Terminate list */
+ ptrNextNode->ptrNext = NULL;
+
+ /* Calculate and allocate space need for making an array of pointers */
+ ptrFileArray = malloc(sizeof(LPWIN32_FIND_DATA) * dwCount);
+ if (ptrFileArray == NULL)
+ {
+#ifdef _DEBUG
+ ConErrPrintf(_T("DEBUG: Cannot allocate memory for ptrFileArray!\n"));
+#endif
+ while (ptrStartNode)
+ {
+ ptrNextNode = ptrStartNode->ptrNext;
+ free(ptrStartNode);
+ ptrStartNode = ptrNextNode;
+ dwCount --;
+ }
+ return 1;
+ }
+
+ /*
+ * Create an array of pointers from the linked list
+ * this will be used to sort and print data, rather than the list
+ */
+ ptrNextNode = ptrStartNode;
+ dwCount = 0;
+ while (ptrNextNode->ptrNext)
+ {
+ *(ptrFileArray + dwCount) = &ptrNextNode->ptrNext->stFindInfo;
+ ptrNextNode = ptrNextNode->ptrNext;
+ dwCount++;
+ }
+
+ /* Sort Data if requested*/
+ if (lpFlags->stOrderBy.sCriteriaCount > 0)
+ QsortFiles(ptrFileArray, 0, dwCount-1,lpFlags);
+
+ /* Print Data */
+ DirPrintFiles(ptrFileArray, dwCount, szFullPath, lpFlags);
+
+ /* Free array */
+ free(ptrFileArray);
+ if (CheckCtrlBreak(BREAK_INPUT))
+ return 1;
+
+
+ /* Add statistics to recursive statistics*/
+ recurse_dir_cnt += dwCountDirs;
+ recurse_file_cnt += dwCountFiles;
+ recurse_bytes.QuadPart += u64CountBytes.QuadPart;
+
+ /* Do the recursive job if requested
+ the recursive is be done on ALL(indepent of their attribs)
+ directoried of the current one.*/
+ if (lpFlags->bRecursive)
+ {
+ /* The new search is involving any *.* file */
+ _tcscpy(szFullFileSpec, szFullPath);
+ _tcscat(szFullFileSpec, _T("*.*"));
+ hRecSearch = FindFirstFile (szFullFileSpec, &wfdFileInfo);
+ do
+ {
+ if (hRecSearch != INVALID_HANDLE_VALUE)
+ {
+ /* We search for directories other than "." and ".." */
+ if ((_tcsicmp(wfdFileInfo.cFileName, _T(".")) != 0) &&
+ (_tcsicmp(wfdFileInfo.cFileName, _T("..")) != 0 ) &&
+ (wfdFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ /* Concat the path and the directory to do recursive */
+ _tcscpy(szFullFileSpec, szFullPath);
+ _tcscat(szFullFileSpec, wfdFileInfo.cFileName);
+ /* We do the same for tha folder */
+ if (DirList(szFullFileSpec, szFilespec, pLine,lpFlags) != 0)
+ {
+ return 1;
+ }
+ }
+ }
+ }while(FindNextFile(hRecSearch,&wfdFileInfo));
+ FindClose(hRecSearch);
+ }
+
+ /* Free linked list */
+ while (ptrStartNode)
+ {
+ ptrNextNode = ptrStartNode->ptrNext;
+ free(ptrStartNode);
+ ptrStartNode = ptrNextNode;
+ dwCount --;
+ }
+
+ return 0;
+}
+
+
+
+/*
+ * dir
+ *
+ * internal dir command
+ */
+INT
+CommandDir(LPTSTR first, LPTSTR rest)
+{
+ TCHAR dircmd[256]; /* A variable to store the DIRCMD enviroment variable */
+ TCHAR cDrive;
+ TCHAR szPath[MAX_PATH];
+ TCHAR szFilespec[MAX_PATH];
+ LPTSTR* params;
+ INT entries = 0;
+ INT nLine = 0;
+ UINT loop = 0;
+ DIRSWITCHFLAGS stFlags;
+
+ /* Initialize variables */
+ cDrive = 0;
+ recurse_dir_cnt = 0L;
+ recurse_file_cnt = 0L;
+ recurse_bytes.QuadPart = 0;
+
+ /* Initialize Switch Flags < Default switches are setted here!> */
+ stFlags.b4Digit = TRUE;
+ stFlags.bBareFormat = FALSE;
+ stFlags.bLowerCase = FALSE;
+ stFlags.bNewLongList = TRUE;
+ stFlags.bPause = FALSE;
+ stFlags.bRecursive = FALSE;
+ stFlags.bShortName = FALSE;
+ stFlags.bTSeperator = TRUE;
+ stFlags.bUser = FALSE;
+ stFlags.bWideList = FALSE;
+ stFlags.bWideListColSort = FALSE;
+ stFlags.stTimeField.eTimeField = TF_MODIFIEDDATE;
+ stFlags.stTimeField.bUnSet = FALSE;
+ stFlags.stAttribs.dwAttribMask = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM;
+ stFlags.stAttribs.dwAttribVal = 0L;
+ stFlags.stAttribs.bUnSet = FALSE;
+ stFlags.stOrderBy.sCriteriaCount = 0;
+ stFlags.stOrderBy.bUnSet = FALSE;
+
+ nErrorLevel = 0;
+
+ /* read the parameters from the DIRCMD environment variable */
+ if (GetEnvironmentVariable (_T("DIRCMD"), dircmd, 256))
+ if (!DirReadParam(dircmd, ¶ms, &entries, &stFlags))
+ {
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /* read the parameters */
+ if (!DirReadParam(rest, ¶ms, &entries, &stFlags) || CheckCtrlBreak(BREAK_INPUT))
+ {
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /* default to current directory */
+ if(entries == 0) {
+ if(!add_entry(&entries, ¶ms, _T("."))) {
+ nErrorLevel = 1;
+ return 1;
+ }
+ }
+
+ for(loop = 0; loop < entries; loop++)
+ {
+ /* parse the directory info */
+ if (DirParsePathspec (params[loop], szPath, szFilespec) || CheckCtrlBreak(BREAK_INPUT))
+ {
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /*
+ Uncomment this to show the final state of switch flags*/
+ #ifdef _DEBUG
+ {
+ int i;
+ ConOutPrintf(_T("Attributes mask/value %x/%x\n"),stFlags.stAttribs.dwAttribMask,stFlags.stAttribs.dwAttribVal );
+ ConOutPrintf(_T("(B) Bare format : %i\n"), stFlags.bBareFormat );
+ ConOutPrintf(_T("(C) Thousand : %i\n"), stFlags.bTSeperator );
+ ConOutPrintf(_T("(W) Wide list : %i\n"), stFlags.bWideList );
+ ConOutPrintf(_T("(D) Wide list sort by column : %i\n"), stFlags.bWideListColSort );
+ ConOutPrintf(_T("(L) Lowercase : %i\n"), stFlags.bLowerCase );
+ ConOutPrintf(_T("(N) New : %i\n"), stFlags.bNewLongList );
+ ConOutPrintf(_T("(O) Order : %i\n"), stFlags.stOrderBy.sCriteriaCount );
+ for (i =0;i)
+ * Implemented PUSHD and POPD command.
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Unicode and redirection safe!
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Added DIRS command.
+ */
+
+#include
+#include "resource.h"
+
+#ifdef FEATURE_DIRECTORY_STACK
+
+typedef struct tagDIRENTRY
+{
+ struct tagDIRENTRY *prev;
+ struct tagDIRENTRY *next;
+ LPTSTR pszPath;
+} DIRENTRY, *LPDIRENTRY;
+
+
+static INT nStackDepth;
+static LPDIRENTRY lpStackTop;
+static LPDIRENTRY lpStackBottom;
+
+
+static INT
+PushDirectory (LPTSTR pszPath)
+{
+ LPDIRENTRY lpDir;
+
+ nErrorLevel = 0;
+
+ lpDir = (LPDIRENTRY)malloc (sizeof (DIRENTRY));
+ if (!lpDir)
+ {
+ error_out_of_memory ();
+ return -1;
+ }
+
+ lpDir->prev = NULL;
+ if (lpStackTop == NULL)
+ {
+ lpDir->next = NULL;
+ lpStackBottom = lpDir;
+ }
+ else
+ {
+ lpDir->next = lpStackTop;
+ lpStackTop->prev = lpDir;
+ }
+ lpStackTop = lpDir;
+
+ lpDir->pszPath = (LPTSTR)malloc ((_tcslen(pszPath)+1)*sizeof(TCHAR));
+ if (!lpDir->pszPath)
+ {
+ free (lpDir);
+ error_out_of_memory ();
+ return -1;
+ }
+
+ _tcscpy (lpDir->pszPath, pszPath);
+
+ nStackDepth++;
+
+ return 0;
+}
+
+
+static VOID
+PopDirectory (VOID)
+{
+ LPDIRENTRY lpDir;
+
+ nErrorLevel = 0;
+
+ if (nStackDepth == 0)
+ return;
+
+ lpDir = lpStackTop;
+ lpStackTop = lpDir->next;
+ if (lpStackTop != NULL)
+ lpStackTop->prev = NULL;
+ else
+ lpStackBottom = NULL;
+
+ free (lpDir->pszPath);
+ free (lpDir);
+
+ nStackDepth--;
+}
+
+
+static VOID
+GetDirectoryStackTop (LPTSTR pszPath)
+{
+ nErrorLevel = 0;
+
+ if (lpStackTop)
+ _tcsncpy (pszPath, lpStackTop->pszPath, MAX_PATH);
+ else
+ *pszPath = _T('\0');
+}
+
+
+/*
+ * initialize directory stack
+ */
+VOID InitDirectoryStack (VOID)
+{
+ nStackDepth = 0;
+ lpStackTop = NULL;
+ lpStackBottom = NULL;
+}
+
+
+/*
+ * destroy directory stack
+ */
+VOID DestroyDirectoryStack (VOID)
+{
+ while (nStackDepth)
+ PopDirectory ();
+}
+
+
+INT GetDirectoryStackDepth (VOID)
+{
+ return nStackDepth;
+}
+
+
+/*
+ * pushd command
+ */
+INT CommandPushd (LPTSTR first, LPTSTR rest)
+{
+ TCHAR curPath[MAX_PATH];
+ TCHAR newPath[MAX_PATH];
+ BOOL bChangePath = FALSE;
+
+ if (!_tcsncmp (rest, _T("/?"), 2))
+ {
+ ConOutResPuts(STRING_DIRSTACK_HELP1);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ if (rest[0] != _T('\0'))
+ {
+ GetFullPathName (rest, MAX_PATH, newPath, NULL);
+ bChangePath = IsValidPathName (newPath);
+ }
+
+ GetCurrentDirectory (MAX_PATH, curPath);
+ if (PushDirectory (curPath))
+ return 0;
+
+ if (bChangePath)
+ SetCurrentDirectory (newPath);
+
+ return 0;
+}
+
+
+/*
+ * popd command
+ */
+INT CommandPopd (LPTSTR first, LPTSTR rest)
+{
+ TCHAR szPath[MAX_PATH];
+
+ if (!_tcsncmp(rest, _T("/?"), 2))
+ {
+ ConOutResPuts(STRING_DIRSTACK_HELP2);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ if (GetDirectoryStackDepth () == 0)
+ return 0;
+
+ GetDirectoryStackTop (szPath);
+ PopDirectory ();
+
+ SetCurrentDirectory (szPath);
+
+ return 0;
+}
+
+
+/*
+ * dirs command
+ */
+INT CommandDirs (LPTSTR first, LPTSTR rest)
+{
+ LPDIRENTRY lpDir;
+
+ if (!_tcsncmp(rest, _T("/?"), 2))
+ {
+ ConOutResPuts(STRING_DIRSTACK_HELP3);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ lpDir = lpStackBottom;
+
+ if (lpDir == NULL)
+ {
+ ConOutResPuts(STRING_DIRSTACK_HELP4);
+ return 0;
+ }
+
+ while (lpDir != NULL)
+ {
+ ConOutPuts (lpDir->pszPath);
+
+ lpDir = lpDir->prev;
+ }
+
+ return 0;
+}
+
+#endif /* FEATURE_DIRECTORY_STACK */
diff --git a/reactos/base/shell/cmd/echo.c b/reactos/base/shell/cmd/echo.c
new file mode 100644
index 00000000000..0019c15f502
--- /dev/null
+++ b/reactos/base/shell/cmd/echo.c
@@ -0,0 +1,181 @@
+/*
+ * ECHO.C - internal echo commands.
+ *
+ *
+ * History:
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * Started.
+ *
+ * 16 Jul 1998 (John P Price)
+ * Separated commands into individual files.
+ *
+ * 27-Jul-1998 (John P Price )
+ * Added config.h include
+ *
+ * 08-Dec-1998 (Eric Kohl )
+ * Added help text ("/?").
+ *
+ * 19-Jan-1999 (Eric Kohl )
+ * Unicode and redirection ready!
+ *
+ * 13-Jul-2000 (Eric Kohl )
+ * Implemented 'echo.' and 'echoerr.'.
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+INT CommandEcho (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LPTSTR p1, p2;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
+#endif
+
+ if (_tcsicmp (cmd, _T("echo.")) == 0)
+ {
+ if (param[0] == 0)
+ ConOutChar (_T('\n'));
+ else
+ ConOutPuts (param);
+ }
+ else
+ {
+ /* skip the first delimiter */
+ if (_istspace(*param))
+ param++;
+
+ /* skip all spaces for the check of '/?', 'ON' and 'OFF' */
+ p1 = param;
+ while(_istspace(*p1))
+ p1++;
+
+ if (!_tcsncmp (p1, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_ECHO_HELP4);
+ return 0;
+ }
+
+ if (_tcsnicmp (p1, D_OFF, sizeof(D_OFF)/sizeof(TCHAR) - 1) == 0)
+ {
+ p2 = p1 + sizeof(D_OFF)/sizeof(TCHAR) - 1;
+ while (_istspace(*p2))
+ p2++;
+ if (*p2 == _T('\0'))
+ {
+ bEcho = FALSE;
+ return 0;
+ }
+ }
+ else if (_tcsnicmp (p1, D_ON, sizeof(D_ON)/sizeof(TCHAR) - 1) == 0)
+ {
+ p2 = p1 + sizeof(D_ON)/sizeof(TCHAR) - 1;
+ while (_istspace(*p2))
+ p2++;
+ if (*p2 == _T('\0'))
+ {
+ bEcho = TRUE;
+ return 0;
+ }
+ }
+ if (*p1 != _T('\0'))
+ {
+ p1 = param;
+ while (NULL != (p1 = _tcschr(p1, _T('^'))))
+ {
+ memmove(p1, p1 + 1, (_tcslen(p1 + 1) + 1) * sizeof(TCHAR));
+ if (*p1)
+ {
+ //skip past the char being escaped
+ p1++;
+ }
+ }
+ ConOutPuts (param);
+ }
+ else
+ {
+ LoadString(CMD_ModuleHandle, STRING_ECHO_HELP5, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, bEcho ? D_ON : D_OFF);
+ }
+ }
+
+ return 0;
+}
+
+
+INT CommandEchos (LPTSTR cmd, LPTSTR param)
+{
+
+#ifdef _DEBUG
+ DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
+#endif
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPuts(STRING_ECHO_HELP1);
+ return 0;
+ }
+
+ if (*param)
+ ConOutPrintf (_T("%s"), param);
+
+ return 0;
+}
+
+
+INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
+{
+
+#ifdef _DEBUG
+ DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
+#endif
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPuts(STRING_ECHO_HELP2);
+ return 0;
+ }
+
+ if (_tcsicmp (cmd, _T("echoerr.")) == 0)
+ {
+ if (param[0] == 0)
+ ConErrChar (_T('\n'));
+ else
+ ConErrPuts (param);
+ }
+ else if (*param)
+ {
+ ConErrPuts (param);
+ }
+
+ return 0;
+}
+
+
+INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
+{
+
+#ifdef _DEBUG
+ DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
+#endif
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPuts(STRING_ECHO_HELP3);
+ return 0;
+ }
+
+ if (*param)
+ ConOutPrintf (_T("%s"), param);
+
+ return 0;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/error.c b/reactos/base/shell/cmd/error.c
new file mode 100644
index 00000000000..9bbc13b3fb1
--- /dev/null
+++ b/reactos/base/shell/cmd/error.c
@@ -0,0 +1,179 @@
+/*
+ * ERROR.C - error reporting functions.
+ *
+ *
+ * History:
+ *
+ * 07/12/98 (Rob Lake)
+ * started
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 24-Jan-1999 (Eric Kohl )
+ * Redirection safe!
+ *
+ * 02-Feb-1999 (Eric Kohl )
+ * Use FormatMessage() for error reports.
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szMessage[1024];
+ LPTSTR szError;
+ va_list arg_ptr;
+
+ if (dwErrorCode == ERROR_SUCCESS)
+ return;
+
+ nErrorLevel = 1;
+
+ if (szFormat)
+ {
+ va_start (arg_ptr, szFormat);
+ _vstprintf (szMessage, szFormat, arg_ptr);
+ va_end (arg_ptr);
+ }
+
+ if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR)&szError, 0, NULL))
+ {
+ ConErrPrintf (_T("%s %s\n"), szError, szMessage);
+ if(szError)
+ LocalFree (szError);
+ return;
+ }
+
+ /* Fall back just in case the error is not defined */
+ if (szFormat)
+ ConErrPrintf (_T("%s -- %s\n"), szMsg, szMessage);
+ else
+ ConErrPrintf (_T("%s\n"), szMsg);
+}
+
+VOID error_parameter_format(TCHAR ch)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ LoadString(CMD_ModuleHandle, STRING_ERROR_PARAMETERF_ERROR, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, ch);
+ nErrorLevel = 1;
+}
+
+
+VOID error_invalid_switch (TCHAR ch)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ LoadString(CMD_ModuleHandle, STRING_ERROR_INVALID_SWITCH, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, ch);
+ nErrorLevel = 1;
+}
+
+
+VOID error_too_many_parameters (LPTSTR s)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ LoadString(CMD_ModuleHandle, STRING_ERROR_TOO_MANY_PARAMETERS, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, s);
+ nErrorLevel = 1;
+}
+
+
+VOID error_path_not_found (VOID)
+{
+ ConErrResPuts(STRING_ERROR_PATH_NOT_FOUND);
+ nErrorLevel = 1;
+}
+
+
+VOID error_file_not_found (VOID)
+{
+ ConErrResPuts(STRING_ERROR_FILE_NOT_FOUND);
+ nErrorLevel = 1;
+}
+
+
+VOID error_sfile_not_found (LPTSTR f)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ LoadString(CMD_ModuleHandle, STRING_ERROR_FILE_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(_T("%s - %s\n"), szMsg, f);
+ nErrorLevel = 1;
+}
+
+
+VOID error_req_param_missing (VOID)
+{
+ ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
+ nErrorLevel = 1;
+}
+
+
+VOID error_invalid_drive (VOID)
+{
+ ConErrResPuts(STRING_ERROR_INVALID_DRIVE);
+ nErrorLevel = 1;
+}
+
+
+VOID error_bad_command (VOID)
+{
+ ConErrResPuts(STRING_ERROR_BADCOMMAND);
+ nErrorLevel = 9009;
+}
+
+
+VOID error_no_pipe (VOID)
+{
+ ConErrResPuts(STRING_ERROR_CANNOTPIPE);
+ nErrorLevel = 1;
+}
+
+
+VOID error_out_of_memory (VOID)
+{
+ ConErrResPuts(STRING_ERROR_OUT_OF_MEMORY);
+ nErrorLevel = 1;
+}
+
+
+VOID error_invalid_parameter_format (LPTSTR s)
+{
+ ConErrResPuts(STRING_ERROR_INVALID_PARAM_FORMAT);
+ nErrorLevel = 1;
+}
+
+
+VOID error_syntax (LPTSTR s)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+ LoadString(CMD_ModuleHandle, STRING_ERROR_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+
+ if (s)
+ ConErrPrintf(_T("%s - %s\n"), szMsg, s);
+ else
+ ConErrPrintf(_T("%s.\n"), szMsg);
+
+ nErrorLevel = 1;
+}
+
+
+VOID msg_pause (VOID)
+{
+ ConOutResPuts(STRING_ERROR_D_PAUSEMSG);
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/filecomp.c b/reactos/base/shell/cmd/filecomp.c
new file mode 100644
index 00000000000..5ef710147f5
--- /dev/null
+++ b/reactos/base/shell/cmd/filecomp.c
@@ -0,0 +1,751 @@
+/*
+ * FILECOMP.C - handles filename completion.
+ *
+ *
+ * Comments:
+ *
+ * 30-Jul-1998 (John P Price )
+ * moved from command.c file
+ * made second TAB display list of filename matches
+ * made filename be lower case if last character typed is lower case
+ *
+ * 25-Jan-1999 (Eric Kohl )
+ * Cleanup. Unicode safe!
+ *
+ * 30-Apr-2004 (Filip Navara )
+ * Make the file listing readable when there is a lot of long names.
+ *
+
+ * 05-Jul-2004 (Jens Collin )
+ * Now expands lfn even when trailing " is omitted.
+ */
+
+#include
+#include "cmd.h"
+
+#ifdef FEATURE_UNIX_FILENAME_COMPLETION
+
+VOID CompleteFilename (LPTSTR str, UINT charcount)
+{
+ WIN32_FIND_DATA file;
+ HANDLE hFile;
+ INT curplace = 0;
+ INT start;
+ INT count;
+ INT step;
+ INT c = 0;
+ BOOL found_dot = FALSE;
+ BOOL perfectmatch = TRUE;
+ TCHAR path[MAX_PATH];
+ TCHAR fname[MAX_PATH];
+ TCHAR maxmatch[MAX_PATH] = _T("");
+ TCHAR directory[MAX_PATH];
+ LPCOMMAND cmds_ptr;
+
+ /* expand current file name */
+ count = charcount - 1;
+ if (count < 0)
+ count = 0;
+
+ /* find how many '"'s there is typed already.*/
+ step = count;
+ while (step > 0)
+ {
+ if (str[step] == _T('"'))
+ c++;
+ step--;
+ }
+ /* if c is odd, then user typed " before name, else not.*/
+
+ /* find front of word */
+ if (str[count] == _T('"') || (c % 2))
+ {
+ count--;
+ while (count > 0 && str[count] != _T('"'))
+ count--;
+ }
+ else
+ {
+ while (count > 0 && str[count] != _T(' '))
+ count--;
+ }
+
+ /* if not at beginning, go forward 1 */
+ if (str[count] == _T(' '))
+ count++;
+
+ start = count;
+
+ if (str[count] == _T('"'))
+ count++; /* don't increment start */
+
+ /* extract directory from word */
+ _tcscpy (directory, &str[count]);
+ curplace = _tcslen (directory) - 1;
+
+ if (curplace >= 0 && directory[curplace] == _T('"'))
+ directory[curplace--] = _T('\0');
+
+ _tcscpy (path, directory);
+
+ while (curplace >= 0 && directory[curplace] != _T('\\') &&
+ directory[curplace] != _T(':'))
+ {
+ directory[curplace] = 0;
+ curplace--;
+ }
+
+ /* look for a '.' in the filename */
+ for (count = _tcslen (directory); path[count] != _T('\0'); count++)
+ {
+ if (path[count] == _T('.'))
+ {
+ found_dot = TRUE;
+ break;
+ }
+ }
+
+ if (found_dot)
+ _tcscat (path, _T("*"));
+ else
+ _tcscat (path, _T("*.*"));
+
+ /* current fname */
+ curplace = 0;
+
+ hFile = FindFirstFile (path, &file);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ /* find anything */
+ do
+ {
+ /* ignore "." and ".." */
+ if (!_tcscmp (file.cFileName, _T(".")) ||
+ !_tcscmp (file.cFileName, _T("..")))
+ continue;
+
+ _tcscpy (fname, file.cFileName);
+
+ if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ _tcscat (fname, _T("\\"));
+
+ if (!maxmatch[0] && perfectmatch)
+ {
+ _tcscpy(maxmatch, fname);
+ }
+ else
+ {
+ for (count = 0; maxmatch[count] && fname[count]; count++)
+ {
+ if (tolower(maxmatch[count]) != tolower(fname[count]))
+ {
+ perfectmatch = FALSE;
+ maxmatch[count] = 0;
+ break;
+ }
+ }
+
+ if (maxmatch[count] == _T('\0') &&
+ fname[count] != _T('\0'))
+ perfectmatch = FALSE;
+ }
+ }
+ while (FindNextFile (hFile, &file));
+
+ FindClose (hFile);
+
+ /* only quote if the filename contains spaces */
+ if (_tcschr(directory, _T(' ')) ||
+ _tcschr(maxmatch, _T(' ')))
+ {
+ str[start] = _T('\"');
+ _tcscpy (&str[start+1], directory);
+ _tcscat (&str[start], maxmatch);
+ _tcscat (&str[start], _T("\"") );
+ }
+ else
+ {
+ _tcscpy (&str[start], directory);
+ _tcscat (&str[start], maxmatch);
+ }
+
+ if(!perfectmatch)
+ {
+ MessageBeep (-1);
+ }
+ }
+ else
+ {
+ /* no match found - search for internal command */
+ for (cmds_ptr = cmds; cmds_ptr->name; cmds_ptr++)
+ {
+ if (!_tcsnicmp (&str[start], cmds_ptr->name,
+ _tcslen (&str[start])))
+ {
+ /* return the mach only if it is unique */
+ if (_tcsnicmp (&str[start], (cmds_ptr+1)->name, _tcslen (&str[start])))
+ _tcscpy (&str[start], cmds_ptr->name);
+ break;
+ }
+ }
+
+ MessageBeep (-1);
+ }
+}
+
+
+/*
+ * returns 1 if at least one match, else returns 0
+ */
+
+BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
+{
+ WIN32_FIND_DATA file;
+ HANDLE hFile;
+ BOOL found_dot = FALSE;
+ INT curplace = 0;
+ INT start;
+ UINT count;
+ TCHAR path[MAX_PATH];
+ TCHAR fname[MAX_PATH];
+ TCHAR directory[MAX_PATH];
+ UINT longestfname = 0;
+ SHORT screenwidth;
+
+ /* expand current file name */
+ count = charcount - 1;
+ if (count < 0)
+ count = 0;
+
+ /* find front of word */
+ if (str[count] == _T('"'))
+ {
+ count--;
+ while (count > 0 && str[count] != _T('"'))
+ count--;
+ }
+ else
+ {
+ while (count > 0 && str[count] != _T(' '))
+ count--;
+ }
+
+ /* if not at beginning, go forward 1 */
+ if (str[count] == _T(' '))
+ count++;
+
+ start = count;
+
+ if (str[count] == _T('"'))
+ count++; /* don't increment start */
+
+ /* extract directory from word */
+ _tcscpy (directory, &str[count]);
+ curplace = _tcslen (directory) - 1;
+
+ if (curplace >= 0 && directory[curplace] == _T('"'))
+ directory[curplace--] = _T('\0');
+
+ _tcscpy (path, directory);
+
+ while (curplace >= 0 &&
+ directory[curplace] != _T('\\') &&
+ directory[curplace] != _T(':'))
+ {
+ directory[curplace] = 0;
+ curplace--;
+ }
+
+ /* look for a . in the filename */
+ for (count = _tcslen (directory); path[count] != _T('\0'); count++)
+ {
+ if (path[count] == _T('.'))
+ {
+ found_dot = TRUE;
+ break;
+ }
+ }
+
+ if (found_dot)
+ _tcscat (path, _T("*"));
+ else
+ _tcscat (path, _T("*.*"));
+
+ /* current fname */
+ curplace = 0;
+
+ hFile = FindFirstFile (path, &file);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ /* Get the size of longest filename first. */
+ do
+ {
+ if (_tcslen(file.cFileName) > longestfname)
+ {
+ longestfname = _tcslen(file.cFileName);
+ /* Directories get extra brackets around them. */
+ if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ longestfname += 2;
+ }
+ }
+ while (FindNextFile (hFile, &file));
+ FindClose (hFile);
+
+ hFile = FindFirstFile (path, &file);
+
+ /* Count the highest number of columns */
+ GetScreenSize(&screenwidth, 0);
+
+ /* For counting columns of output */
+ count = 0;
+
+ /* Increase by the number of spaces behind file name */
+ longestfname += 3;
+
+ /* find anything */
+ ConOutChar (_T('\n'));
+ do
+ {
+ /* ignore . and .. */
+ if (!_tcscmp (file.cFileName, _T(".")) ||
+ !_tcscmp (file.cFileName, _T("..")))
+ continue;
+
+ if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ _stprintf (fname, _T("[%s]"), file.cFileName);
+ else
+ _tcscpy (fname, file.cFileName);
+
+ ConOutPrintf (_T("%*s"), - longestfname, fname);
+ count++;
+ /* output as much columns as fits on the screen */
+ if (count >= (screenwidth / longestfname))
+ {
+ /* print the new line only if we aren't on the
+ * last column, in this case it wraps anyway */
+ if (count * longestfname != (UINT)screenwidth)
+ ConOutPrintf (_T("\n"));
+ count = 0;
+ }
+ }
+ while (FindNextFile (hFile, &file));
+
+ FindClose (hFile);
+
+ if (count)
+ ConOutChar (_T('\n'));
+ }
+ else
+ {
+ /* no match found */
+ MessageBeep (-1);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+#endif
+
+#ifdef FEATURE_4NT_FILENAME_COMPLETION
+
+typedef struct _FileName
+{
+ TCHAR Name[MAX_PATH];
+} FileName;
+
+VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
+{
+ /* String that is to be examined */
+ TCHAR str[MAX_PATH];
+ /* temp pointers to used to find needed parts */
+ TCHAR * szSearch;
+ TCHAR * szSearch1;
+ TCHAR * szSearch2;
+ /* number of quotes in the string */
+ INT nQuotes = 0;
+ /* used in for loops */
+ UINT i;
+ /* Char number to break the string at */
+ INT PBreak = 0;
+ INT SBreak = 0;
+ /* when phrasing a string, this tells weather
+ you are inside quotes ot not. */
+ BOOL bInside = FALSE;
+
+ szPrefix[0] = _T('\0');
+ szSuffix[0] = _T('\0');
+
+ /* Copy over the string to later be edited */
+ _tcscpy(str,strIN);
+
+ /* Count number of " */
+ for(i = 0; i < _tcslen(str); i++)
+ if(str[i] == _T('\"'))
+ nQuotes++;
+
+ /* Find the prefix and suffix */
+ if(nQuotes % 2 && nQuotes >= 1)
+ {
+ /* Odd number of quotes. Just start from the last " */
+ /* THis is the way MS does it, and is an easy way out */
+ szSearch = _tcsrchr(str, _T('\"'));
+ /* Move to the next char past the " */
+ szSearch++;
+ _tcscpy(szSuffix,szSearch);
+ /* Find the one closest to end */
+ szSearch1 = _tcsrchr(str, _T('\"'));
+ szSearch2 = _tcsrchr(str, _T('\\'));
+ if(szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2))
+ szSearch = szSearch2;
+ else
+ szSearch = szSearch1;
+ /* Move one char past */
+ szSearch++;
+ szSearch[0] = _T('\0');
+ _tcscpy(szPrefix,str);
+ return;
+
+ }
+
+ if(!_tcschr(str, _T(' ')))
+ {
+ /* No spaces, everything goes to Suffix */
+ _tcscpy(szSuffix,str);
+ /* look for a slash just in case */
+ szSearch = _tcsrchr(str, _T('\\'));
+ if(szSearch)
+ {
+ szSearch++;
+ szSearch[0] = _T('\0');
+ _tcscpy(szPrefix,str);
+ }
+ else
+ {
+ szPrefix[0] = _T('\0');
+ }
+ return;
+ }
+
+ if(!nQuotes)
+ {
+ /* No quotes, and there is a space*/
+ /* Take it after the last space */
+ szSearch = _tcsrchr(str, _T(' '));
+ szSearch++;
+ _tcscpy(szSuffix,szSearch);
+ /* Find the closest to the end space or \ */
+ _tcscpy(str,strIN);
+ szSearch1 = _tcsrchr(str, _T(' '));
+ szSearch2 = _tcsrchr(str, _T('\\'));
+ if(szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2))
+ szSearch = szSearch2;
+ else
+ szSearch = szSearch1;
+ szSearch++;
+ szSearch[0] = _T('\0');
+ _tcscpy(szPrefix,str);
+ return;
+ }
+
+ /* All else fails and there is a lot of quotes, spaces and |
+ Then we search through and find the last space or \ that is
+ not inside a quotes */
+ for(i = 0; i < _tcslen(str); i++)
+ {
+ if(str[i] == _T('\"'))
+ bInside = !bInside;
+ if(str[i] == _T(' ') && !bInside)
+ SBreak = i;
+ if((str[i] == _T(' ') || str[i] == _T('\\')) && !bInside)
+ PBreak = i;
+
+ }
+ SBreak++;
+ PBreak++;
+ _tcscpy(szSuffix,&strIN[SBreak]);
+ strIN[PBreak] = _T('\0');
+ _tcscpy(szPrefix,strIN);
+ if(szPrefix[_tcslen(szPrefix) - 2] == _T('\"'))
+ {
+ /* need to remove the " right before a \ at the end to
+ allow the next stuff to stay inside one set of quotes
+ otherwise you would have multiple sets of quotes*/
+ _tcscpy(&szPrefix[_tcslen(szPrefix) - 2],_T("\\"));
+
+ }
+
+}
+ int __cdecl compare(const void *arg1,const void *arg2)
+ {
+ FileName * File1;
+ FileName * File2;
+ INT ret;
+
+ File1 = malloc(sizeof(FileName));
+ File2 = malloc(sizeof(FileName));
+ if(!File1 || !File2)
+ return 0;
+
+ memcpy(File1,arg1,sizeof(FileName));
+ memcpy(File2,arg2,sizeof(FileName));
+
+ /* ret = _tcsicmp(File1->Name, File2->Name); */
+ ret = lstrcmpi(File1->Name, File2->Name);
+
+ free(File1);
+ free(File2);
+ return ret;
+ }
+
+VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
+{
+ /* Length of string before we complete it */
+ INT StartLength;
+ /* Length of string after completed */
+ INT EndLength;
+ /* The number of chars added too it */
+ static INT DiffLength = 0;
+ /* Used to find and assemble the string that is returned */
+ TCHAR szBaseWord[MAX_PATH];
+ TCHAR szPrefix[MAX_PATH];
+ TCHAR szOrginal[MAX_PATH];
+ TCHAR szSearchPath[MAX_PATH];
+ /* Save the strings used last time, so if they hit tab again */
+ static TCHAR LastReturned[MAX_PATH];
+ static TCHAR LastSearch[MAX_PATH];
+ static TCHAR LastPrefix[MAX_PATH];
+ /* Used to search for files */
+ HANDLE hFile;
+ WIN32_FIND_DATA file;
+ /* List of all the files */
+ FileName * FileList = NULL;
+ /* Number of files */
+ INT FileListSize = 0;
+ /* Used for loops */
+ UINT i;
+ /* Editable string of what was passed in */
+ TCHAR str[MAX_PATH];
+ /* Keeps track of what element was last selected */
+ static INT Sel;
+ BOOL NeededQuote = FALSE;
+ BOOL ShowAll = TRUE;
+ TCHAR * line = strIN;
+
+ strOut[0] = _T('\0');
+
+ while (_istspace (*line))
+ line++;
+ if(!_tcsnicmp (line, _T("rd "), 3) || !_tcsnicmp (line, _T("cd "), 3))
+ ShowAll = FALSE;
+
+ /* Copy the string, str can be edited and orginal should not be */
+ _tcscpy(str,strIN);
+ _tcscpy(szOrginal,strIN);
+
+ /* Look to see if the cusor is not at the end of the string */
+ if((cusor + 1) < _tcslen(str))
+ str[cusor] = _T('\0');
+
+ /* Look to see if they hit tab again, if so cut off the diff length */
+ if(_tcscmp(str,LastReturned) || !_tcslen(str))
+ {
+ /* We need to know how many chars we added from the start */
+ StartLength = _tcslen(str);
+
+ /* no string, we need all files in that directory */
+ if(!StartLength)
+ {
+ _tcscat(str,_T("*"));
+ }
+
+ /* Zero it out first */
+ szBaseWord[0] = _T('\0');
+ szPrefix[0] = _T('\0');
+
+ /*What comes out of this needs to be:
+ szBaseWord = path no quotes to the object
+ szPrefix = what leads up to the filename
+ no quote at the END of the full name */
+ FindPrefixAndSuffix(str,szPrefix,szBaseWord);
+ /* Strip quotes */
+ for(i = 0; i < _tcslen(szBaseWord); )
+ {
+ if(szBaseWord[i] == _T('\"'))
+ memmove(&szBaseWord[i],&szBaseWord[i + 1], _tcslen(&szBaseWord[i]) * sizeof(TCHAR));
+ else
+ i++;
+ }
+
+ /* clear it out */
+ memset(szSearchPath, 0, sizeof(szSearchPath));
+
+ /* Start the search for all the files */
+ GetFullPathName(szBaseWord, MAX_PATH, szSearchPath, NULL);
+ if(StartLength > 0)
+ {
+ _tcscat(szSearchPath,_T("*"));
+ }
+ _tcscpy(LastSearch,szSearchPath);
+ _tcscpy(LastPrefix,szPrefix);
+ }
+ else
+ {
+ _tcscpy(szSearchPath, LastSearch);
+ _tcscpy(szPrefix, LastPrefix);
+ StartLength = 0;
+ }
+ /* search for the files it might be */
+ hFile = FindFirstFile (szSearchPath, &file);
+
+ /* aseemble a list of all files names */
+ do
+ {
+ if(hFile == INVALID_HANDLE_VALUE)
+ {
+ /* Assemble the orginal string and return */
+ _tcscpy(strOut,szOrginal);
+ CloseHandle(hFile);
+ if(FileList != NULL)
+ free(FileList);
+ return;
+ }
+
+ if(!_tcscmp (file.cFileName, _T(".")) ||
+ !_tcscmp (file.cFileName, _T("..")))
+ continue;
+
+ /* Don't show files when they are doing 'cd' or 'rd' */
+ if(!ShowAll &&
+ file.dwFileAttributes != 0xFFFFFFFF &&
+ !(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ continue;
+ }
+
+ /* Add the file to the list of files */
+ if(FileList == NULL)
+ {
+ FileListSize = 1;
+ FileList = malloc(FileListSize * sizeof(FileName));
+ }
+ else
+ {
+ FileListSize++;
+ FileList = realloc(FileList, FileListSize * sizeof(FileName));
+ }
+
+ if(FileList == NULL)
+ {
+ /* Assemble the orginal string and return */
+ _tcscpy(strOut,szOrginal);
+ CloseHandle(hFile);
+ ConOutFormatMessage (GetLastError());
+ return;
+ }
+ /* Copies the file name into the struct */
+ _tcscpy(FileList[FileListSize-1].Name,file.cFileName);
+
+ }while(FindNextFile(hFile,&file));
+
+ /* Check the size of the list to see if we
+ found any matches */
+ if(FileListSize == 0)
+ {
+ _tcscpy(strOut,szOrginal);
+ CloseHandle(hFile);
+ if(FileList != NULL)
+ free(FileList);
+ return;
+
+ }
+ /* Sort the files */
+ qsort(FileList,FileListSize,sizeof(FileName), compare);
+
+ /* Find the next/previous */
+ if(!_tcscmp(szOrginal,LastReturned))
+ {
+ if(bNext)
+ {
+ if(FileListSize - 1 == Sel)
+ Sel = 0;
+ else
+ Sel++;
+ }
+ else
+ {
+ if(!Sel)
+ Sel = FileListSize - 1;
+ else
+ Sel--;
+ }
+ }
+ else
+ {
+ Sel = 0;
+ }
+
+ /* nothing found that matched last time
+ so return the first thing in the list */
+ strOut[0] = _T('\0');
+
+ /* space in the name */
+ if(_tcschr(FileList[Sel].Name, _T(' ')))
+ {
+ INT LastSpace;
+ BOOL bInside;
+ /* It needs a " at the end */
+ NeededQuote = TRUE;
+ LastSpace = -1;
+ bInside = FALSE;
+ /* Find the place to put the " at the start */
+ for(i = 0; i < _tcslen(szPrefix); i++)
+ {
+ if(szPrefix[i] == _T('\"'))
+ bInside = !bInside;
+ if(szPrefix[i] == _T(' ') && !bInside)
+ LastSpace = i;
+
+ }
+ /* insert the quoation and move things around */
+ if(szPrefix[LastSpace + 1] != _T('\"') && LastSpace != -1)
+ {
+ memmove ( &szPrefix[LastSpace+1], &szPrefix[LastSpace], (_tcslen(szPrefix)-LastSpace+1) * sizeof(TCHAR) );
+
+ if((UINT)(LastSpace + 1) == _tcslen(szPrefix))
+ {
+ _tcscat(szPrefix,_T("\""));
+ }
+ szPrefix[LastSpace + 1] = _T('\"');
+ }
+ else if(LastSpace == -1)
+ {
+ _tcscpy(szBaseWord,_T("\""));
+ _tcscat(szBaseWord,szPrefix);
+ _tcscpy(szPrefix,szBaseWord);
+
+ }
+ }
+
+ _tcscpy(strOut,szPrefix);
+ _tcscat(strOut,FileList[Sel].Name);
+
+ /* check for odd number of quotes means we need to close them */
+ if(!NeededQuote)
+ {
+ for(i = 0; i < _tcslen(strOut); i++)
+ if(strOut[i] == _T('\"'))
+ NeededQuote = !NeededQuote;
+ }
+
+ if(szPrefix[_tcslen(szPrefix) - 1] == _T('\"') || NeededQuote)
+ _tcscat(strOut,_T("\""));
+
+ _tcscpy(LastReturned,strOut);
+ EndLength = _tcslen(strOut);
+ DiffLength = EndLength - StartLength;
+ CloseHandle(hFile);
+ if(FileList != NULL)
+ free(FileList);
+
+}
+#endif
diff --git a/reactos/base/shell/cmd/files.txt b/reactos/base/shell/cmd/files.txt
new file mode 100644
index 00000000000..0004b4f0b1c
--- /dev/null
+++ b/reactos/base/shell/cmd/files.txt
@@ -0,0 +1,57 @@
+Archive Contents
+~~~~~~~~~~~~~~~~
+files.txt This file list
+history.txt History of revsions. Not to date. see svn.reactos.com for more info.
+license.txt GNU license - applies to all files named here
+readme.txt General shell info
+readme2.txt Techincal shell info
+todo.txt Things that need to be implmented or fixed(including bugs)
+
+alias.c Alias code
+alias.h Alias header file
+attrib.c Implements attrib command
+batch.c Batch file interpreter
+beep.c Implements beep command
+call.c Implements call command
+chcp.c Implements chcp command
+choice.c Implements choice command
+cls.c Implements cls command
+cmdinput.c Command-line input functions
+cmdtable.c Table of available internal commands
+cmd.c Main code for command-line interpreter
+cmd.h Command header file
+color.c Implements color command
+console.c Windows console handling code
+copy.c Implements copy command
+date.c Implements date command
+del.c Implements del command
+dir.c Directory listing code
+dirstack.c Directory stack code (PUSHD and POPD)
+echo.c Implements echo command
+error.c Error Message Routines
+filecomp.c Filename completion functions
+for.c Implements for command
+free.c Implements free command
+goto.c Implements goto command
+history.c Command-line history handling
+if.c Implements if command
+internal.c Internal commands (DIR, RD, CD, etc)
+label.c Implements label command
+locale.c Locale handling code
+memory.c Implements memory command
+misc.c Misc. Functions
+msgbox.c Implements msgbox command
+move.c Implements move command
+path.c Implements path command
+pause.c Implements pause command
+prompt.c Prompt handling functions
+redir.c Redirection and piping parsing functions
+ren.c Implements rename command
+set.c Implements set command
+shift.c Implements shift command
+time.c Implements time command
+timer.c Implements timer command
+type.c Implements type command
+ver.c Implements ver command
+where.c Code to search path for executables
+verify.c Implements verify command
diff --git a/reactos/base/shell/cmd/for.c b/reactos/base/shell/cmd/for.c
new file mode 100644
index 00000000000..b503a57b141
--- /dev/null
+++ b/reactos/base/shell/cmd/for.c
@@ -0,0 +1,152 @@
+/*
+ * FOR.C - for internal batch command.
+ *
+ *
+ * History:
+ *
+ * 16-Jul-1998 (Hans B Pufal)
+ * Started.
+ *
+ * 16-Jul-1998 (John P Price)
+ * Seperated commands into individual files.
+ *
+ * 19-Jul-1998 (Hans B Pufal)
+ * Implementation of FOR.
+ *
+ * 27-Jul-1998 (John P Price )
+ * Added config.h include.
+ *
+ * 20-Jan-1999 (Eric Kohl)
+ * Unicode and redirection safe!
+ *
+ * 01-Sep-1999 (Eric Kohl)
+ * Added help text.
+ *
+ * 23-Feb-2001 (Carl Nettelblad )
+ * Implemented preservation of echo flag. Some other for related
+ * code in other files fixed, too.
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+/*
+ * Perform FOR command.
+ *
+ * First check syntax is correct : FOR %v IN ( ) DO
+ * v must be alphabetic, must not be empty.
+ *
+ * If all is correct build a new bcontext structure which preserves
+ * the necessary information so that readbatchline can expand
+ * each the command prototype for each list element.
+ *
+ * You might look on a FOR as being a called batch file with one line
+ * per list element.
+ */
+
+INT cmd_for (LPTSTR cmd, LPTSTR param)
+{
+ LPBATCH_CONTEXT lpNew;
+ LPTSTR pp;
+ TCHAR var;
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+
+#ifdef _DEBUG
+ DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
+#endif
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_FOR_HELP1);
+ return 0;
+ }
+
+ /* Check that first element is % then an alpha char followed by space */
+ if ((*param != _T('%')) || !_istalpha (*(param + 1)) || !_istspace (*(param + 2)))
+ {
+ LoadString( CMD_ModuleHandle, STRING_FOR_ERROR, szMsg, RC_STRING_MAX_SIZE);
+ error_syntax (szMsg);
+ return 1;
+ }
+
+ param++;
+ var = *param++; /* Save FOR var name */
+
+ while (_istspace (*param))
+ param++;
+
+ /* Check next element is 'IN' */
+ if ((_tcsnicmp (param, _T("in"), 2) != 0) || !_istspace (*(param + 2)))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FOR_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ error_syntax(szMsg);
+ return 1;
+ }
+
+ param += 2;
+ while (_istspace (*param))
+ param++;
+
+ /* Folowed by a '(', find also matching ')' */
+ if ((*param != _T('(')) || (NULL == (pp = _tcsrchr (param, _T(')')))))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FOR_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+ error_syntax(szMsg);
+ return 1;
+ }
+
+ *pp++ = _T('\0');
+ param++; /* param now points at null terminated list */
+
+ while (_istspace (*pp))
+ pp++;
+
+ /* Check DO follows */
+ if ((_tcsnicmp (pp, _T("do"), 2) != 0) || !_istspace (*(pp + 2)))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FOR_ERROR3, szMsg, RC_STRING_MAX_SIZE);
+ error_syntax(szMsg);
+ return 1;
+ }
+
+ pp += 2;
+ while (_istspace (*pp))
+ pp++;
+
+ /* Check that command tail is not empty */
+ if (*pp == _T('\0'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FOR_ERROR4, szMsg, RC_STRING_MAX_SIZE);
+ error_syntax(szMsg);
+ return 1;
+ }
+
+ /* OK all is correct, build a bcontext.... */
+ lpNew = (LPBATCH_CONTEXT)malloc (sizeof (BATCH_CONTEXT));
+
+ lpNew->prev = bc;
+ bc = lpNew;
+
+ bc->hBatchFile = INVALID_HANDLE_VALUE;
+ bc->ffind = NULL;
+ bc->params = BatchParams (_T(""), param); /* Split out list */
+ bc->shiftlevel = 0;
+ bc->forvar = var;
+ bc->forproto = _tcsdup (pp);
+ if (bc->prev)
+ bc->bEcho = bc->prev->bEcho;
+ else
+ bc->bEcho = bEcho;
+ bc->In[0] = _T('\0');
+ bc->Out[0] = _T('\0');
+ bc->Err[0] = _T('\0');
+
+
+ return 0;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/free.c b/reactos/base/shell/cmd/free.c
new file mode 100644
index 00000000000..f739cd3522f
--- /dev/null
+++ b/reactos/base/shell/cmd/free.c
@@ -0,0 +1,124 @@
+/*
+ * FREE.C - internal command.
+ *
+ *
+ * History:
+ *
+ * 01-Sep-1999 (Eric Kohl)
+ * Started.
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_FREE
+
+static VOID
+PrintDiskInfo (LPTSTR szDisk)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szRootPath[4] = _T("A:\\");
+ TCHAR szDrive[2] = _T("A");
+ TCHAR szVolume[64];
+ TCHAR szSerial[10];
+ TCHAR szTotal[40];
+ TCHAR szUsed[40];
+ TCHAR szFree[40];
+ DWORD dwSerial;
+ ULARGE_INTEGER uliSize;
+ DWORD dwSecPerCl;
+ DWORD dwBytPerSec;
+ DWORD dwFreeCl;
+ DWORD dwTotCl;
+
+ if (_tcslen (szDisk) < 2 || szDisk[1] != _T(':'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ return;
+ }
+
+ szRootPath[0] = szDisk[0];
+ szDrive[0] = _totupper (szRootPath[0]);
+
+ if (!GetVolumeInformation (szRootPath, szVolume, 64, &dwSerial,
+ NULL, NULL, NULL, 0))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(_T("%s %s:\n"), szMsg, szDrive);
+ return;
+ }
+
+ if (szVolume[0] == _T('\0'))
+ {
+
+ LoadString(CMD_ModuleHandle, STRING_FREE_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+ _tcscpy (szVolume, szMsg);
+ }
+
+ _stprintf (szSerial,
+ _T("%04X-%04X"),
+ HIWORD(dwSerial),
+ LOWORD(dwSerial));
+
+ if (!GetDiskFreeSpace (szRootPath, &dwSecPerCl,
+ &dwBytPerSec, &dwFreeCl, &dwTotCl))
+ {
+ LoadString(CMD_ModuleHandle, STRING_FREE_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf (_T("%s %s:\n"), szMsg, szDrive);
+ return;
+ }
+
+ uliSize.QuadPart = dwSecPerCl * dwBytPerSec * dwTotCl;
+ ConvertULargeInteger (uliSize, szTotal, 40, TRUE);
+
+ uliSize.QuadPart = dwSecPerCl * dwBytPerSec * (dwTotCl - dwFreeCl);
+ ConvertULargeInteger (uliSize, szUsed, 40, TRUE);
+
+ uliSize.QuadPart = dwSecPerCl * dwBytPerSec * dwFreeCl;
+ ConvertULargeInteger (uliSize, szFree, 40, TRUE);
+
+
+ LoadString(CMD_ModuleHandle, STRING_FREE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, szDrive, szVolume, szSerial, szTotal, szUsed, szFree);
+}
+
+
+INT CommandFree (LPTSTR cmd, LPTSTR param)
+{
+ LPTSTR szParam;
+ TCHAR szDefPath[MAX_PATH];
+ INT argc, i;
+ LPTSTR *arg;
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_FREE_HELP2);
+ return 0;
+ }
+
+ if (!param || *param == _T('\0'))
+ {
+ GetCurrentDirectory (MAX_PATH, szDefPath);
+ szDefPath[2] = _T('\0');
+ szParam = szDefPath;
+ }
+ else
+ szParam = param;
+
+ arg = split (szParam, &argc, FALSE);
+
+ for (i = 0; i < argc; i++)
+ PrintDiskInfo (arg[i]);
+
+ freep (arg);
+
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_FREE */
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/goto.c b/reactos/base/shell/cmd/goto.c
new file mode 100644
index 00000000000..4f2cf77d553
--- /dev/null
+++ b/reactos/base/shell/cmd/goto.c
@@ -0,0 +1,127 @@
+/*
+ * GOTO.C - goto internal batch command.
+ *
+ * History:
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * started.
+ *
+ * 16 Jul 1998 (John P Price)
+ * Seperated commands into individual files.
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 28 Jul 1998 (Hans B Pufal) [HBP_003]
+ * Terminate label on first space character, use only first 8 chars of
+ * label string
+ *
+ * 24-Jan-1999 (Eric Kohl )
+ * Unicode and redirection safe!
+ *
+ * 27-Jan-1999 (Eric Kohl )
+ * Added help text ("/?").
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+/*
+ * Perform GOTO command.
+ *
+ * Only valid if batch file current.
+ *
+ */
+
+INT cmd_goto (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ LPTSTR tmp;
+ LONG lNewPosHigh;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
+#endif
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_GOTO_HELP1);
+ return 0;
+ }
+
+ /* if not in batch -- error!! */
+ if (bc == NULL)
+ {
+ return 1;
+ }
+
+ if (*param == _T('\0'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_GOTO_ERROR1, szMsg, RC_STRING_MAX_SIZE);
+ ExitBatch(szMsg);
+ return 1;
+ }
+
+ /* terminate label at first space char */
+ tmp = param+1;
+ while (!_istcntrl (*tmp) && !_istspace (*tmp) && (*tmp != _T(':')))
+ tmp++;
+ *(tmp) = _T('\0');
+
+ /* set file pointer to the beginning of the batch file */
+ lNewPosHigh = 0;
+
+ /* jump to end of the file */
+ if ( _tcsicmp( param, _T(":eof"))==0)
+ {
+ SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_END);
+ return 0;
+ }
+
+ /* jump to begin of the file */
+ SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_BEGIN);
+
+ while (FileGetString (bc->hBatchFile, textline, sizeof(textline) / sizeof(textline[0])))
+ {
+ int pos;
+ int size;
+
+ /* Strip out any trailing spaces or control chars */
+ tmp = textline + _tcslen (textline) - 1;
+
+
+ while (_istcntrl (*tmp) || _istspace (*tmp) || (*tmp == _T(':')))
+ tmp--;
+ *(tmp + 1) = _T('\0');
+
+ /* Then leading spaces... */
+ tmp = textline;
+ while (_istspace (*tmp))
+ tmp++;
+
+ /* All space after leading space terminate the string */
+ size = _tcslen(tmp) -1;
+ pos=0;
+ while (tmp+pos < tmp+size)
+ {
+ if (_istspace(tmp[pos]))
+ tmp[pos]=_T('\0');
+ pos++;
+ }
+
+ /* use whole label name */
+ if ((*tmp == _T(':')) && (_tcsicmp (++tmp, param) == 0))
+ return 0;
+ }
+
+ LoadString(CMD_ModuleHandle, STRING_GOTO_ERROR2, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg, param);
+ ExitBatch(NULL);
+ return 1;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/history.c b/reactos/base/shell/cmd/history.c
new file mode 100644
index 00000000000..aae395d0d8a
--- /dev/null
+++ b/reactos/base/shell/cmd/history.c
@@ -0,0 +1,486 @@
+/*
+ * HISTORY.C - command line history.
+ *
+ *
+ * History:
+ *
+ * 14/01/95 (Tim Norman)
+ * started.
+ *
+ * 08/08/95 (Matt Rains)
+ * i have cleaned up the source code. changes now bring this source
+ * into guidelines for recommended programming practice.
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 25-Jan-1999 (Eric Kohl )
+ * Cleanup!
+ * Unicode and redirection safe!
+ *
+ * 25-Jan-1999 (Paolo Pantaleo )
+ * Added lots of comments (beginning studying the source)
+ * Added command.com's F3 support (see cmdinput.c)
+ *
+ */
+
+
+
+/*
+ * HISTORY.C - command line history. Second version
+ *
+ *
+ * History:
+ *
+ * 06/12/99 (Paolo Pantaleo )
+ * started.
+ *
+ */
+
+#include
+
+#ifdef FEATURE_HISTORY
+
+typedef struct tagHISTORY
+{
+ struct tagHISTORY *prev;
+ struct tagHISTORY *next;
+ LPTSTR string;
+} HIST_ENTRY, * LPHIST_ENTRY;
+
+static INT size,
+ max_size=100;
+
+
+
+static LPHIST_ENTRY Top;
+static LPHIST_ENTRY Bottom;
+
+
+static LPHIST_ENTRY curr_ptr=0;
+
+
+VOID InitHistory(VOID);
+VOID History_move_to_bottom(VOID);
+VOID History (INT dir, LPTSTR commandline);
+VOID CleanHistory(VOID);
+VOID History_del_current_entry(LPTSTR str);
+
+/*service functions*/
+static VOID del(LPHIST_ENTRY item);
+static VOID add_at_bottom(LPTSTR string);
+/*VOID add_before_last(LPTSTR string);*/
+VOID set_size(INT new_size);
+
+
+
+INT CommandHistory (LPTSTR cmd, LPTSTR param)
+{
+ LPTSTR tmp;
+ INT tmp_int;
+ LPHIST_ENTRY h_tmp;
+ TCHAR szBuffer[2048];
+
+ tmp=_tcschr(param,_T('/'));
+
+ if (tmp)
+ {
+ param=tmp;
+ switch (_totupper(param[1]))
+ {
+ case _T('F'):/*delete history*/
+ CleanHistory();InitHistory();
+ break;
+
+ case _T('R'):/*read history from standard in*/
+ //hIn=GetStdHandle (STD_INPUT_HANDLE);
+
+ for(;;)
+ {
+ ConInString(szBuffer,sizeof(szBuffer)/sizeof(TCHAR));
+ if (*szBuffer!=_T('\0'))
+ History(0,szBuffer);
+ else
+ break;
+ }
+ break;
+
+ case _T('A'):/*add an antry*/
+ History(0,param+2);
+ break;
+
+ case _T('S'):/*set history size*/
+ if ((tmp_int=_ttoi(param+2)))
+ set_size(tmp_int);
+ break;
+
+ default:
+ return 1;
+ }
+ }
+ else
+ {
+ for (h_tmp = Top->prev; h_tmp != Bottom; h_tmp = h_tmp->prev)
+ ConErrPuts(h_tmp->string);
+ }
+ return 0;
+}
+
+VOID set_size(INT new_size)
+{
+ while (new_sizeprev);
+
+ max_size=new_size;
+}
+
+
+VOID InitHistory(VOID)
+{
+ size=0;
+
+ Top = malloc(sizeof(HIST_ENTRY));
+ Bottom = malloc(sizeof(HIST_ENTRY));
+
+ Top->prev = Bottom;
+ Top->next = NULL;
+ Top->string = NULL;
+
+ Bottom->prev = NULL;
+ Bottom->next = Top;
+ Bottom->string = NULL;
+
+ curr_ptr=Bottom;
+}
+
+
+
+
+VOID CleanHistory(VOID)
+{
+ while (Bottom->next!=Top)
+ del(Bottom->next);
+
+ free(Top);
+ free(Bottom);
+}
+
+
+VOID History_del_current_entry(LPTSTR str)
+{
+ LPHIST_ENTRY tmp;
+
+ if (size == 0)
+ return;
+
+ if (curr_ptr == Bottom)
+ curr_ptr=Bottom->next;
+
+ if (curr_ptr == Top)
+ curr_ptr=Top->prev;
+
+
+ tmp = curr_ptr;
+ curr_ptr = curr_ptr->prev;
+ del(tmp);
+ History(-1, str);
+}
+
+
+static
+VOID del(LPHIST_ENTRY item)
+{
+ if (item==NULL || item==Top || item==Bottom)
+ {
+#ifdef _DEBUG
+ DebugPrintf(_T("del in ") _T(__FILE__) _T(": retrning\n")
+ _T("item is 0x%08x (Bottom is0x%08x)\n"),
+ item, Bottom);
+#endif
+ return;
+ }
+
+
+
+ /*free string's mem*/
+ if (item->string)
+ free(item->string);
+
+ /*set links in prev and next item*/
+ item->next->prev=item->prev;
+ item->prev->next=item->next;
+
+ free(item);
+
+ size--;
+}
+
+
+#if 0
+static
+VOID add_before_last(LPTSTR string)
+{
+ LPHIST_ENTRY tmp,before,after;
+
+ /*delete first entry if maximum number of entries is reached*/
+ while(size>=max_size)
+ del(Top->prev);
+
+ while (_istspace(*string))
+ string++;
+
+ if (*string==_T('\0'))
+ return;
+
+ /*allocte entry and string*/
+ tmp=malloc(sizeof(HIST_ENTRY));
+ tmp->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
+ _tcscpy(tmp->string,string);
+
+ /*set links*/
+ before=Bottom->next;
+ after=before->next;
+
+ tmp->prev=before;
+ tmp->next=after;
+
+ after->prev=tmp;
+ before->next=tmp;
+
+ /*set new size*/
+ size++;
+
+
+}
+#endif/*0*/
+
+static
+VOID add_at_bottom(LPTSTR string)
+{
+
+
+ LPHIST_ENTRY tmp;
+
+
+ /*delete first entry if maximum number of entries is reached*/
+ while(size>=max_size)
+ del(Top->prev);
+
+ while (_istspace(*string))
+ string++;
+
+ if (*string==_T('\0'))
+ return;
+
+
+ /*if new entry is the same than the last do not add it*/
+ if(size)
+ if(_tcscmp(string,Bottom->next->string)==0)
+ return;
+
+
+ /*fill bottom with string, it will become Bottom->next*/
+ Bottom->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
+ _tcscpy(Bottom->string,string);
+
+ /*save Bottom value*/
+ tmp=Bottom;
+
+
+ /*create new void Bottom*/
+ Bottom=malloc(sizeof(HIST_ENTRY));
+ Bottom->next=tmp;
+ Bottom->prev=NULL;
+ Bottom->string=NULL;
+
+ tmp->prev=Bottom;
+
+ /*set new size*/
+ size++;
+
+}
+
+
+
+VOID History_move_to_bottom(VOID)
+{
+ curr_ptr=Bottom;
+
+}
+
+
+VOID History (INT dir, LPTSTR commandline)
+{
+
+ if(dir==0)
+ {
+ add_at_bottom(commandline);
+ curr_ptr=Bottom;
+ return;
+ }
+
+ if (size==0)
+ {
+ commandline[0]=_T('\0');
+ return;
+ }
+
+
+ if(dir<0)/*key up*/
+ {
+ if (curr_ptr->next==Top || curr_ptr==Top)
+ {
+#ifdef WRAP_HISTORY
+ curr_ptr=Bottom;
+#else
+ curr_ptr=Top;
+ commandline[0]=_T('\0');
+ return;
+#endif
+ }
+
+
+ curr_ptr = curr_ptr->next;
+ if(curr_ptr->string)
+ _tcscpy(commandline,curr_ptr->string);
+
+ }
+
+
+
+
+
+ if(dir>0)
+ {
+
+ if (curr_ptr->prev==Bottom || curr_ptr==Bottom)
+ {
+#ifdef WRAP_HISTORY
+ curr_ptr=Top;
+#else
+ curr_ptr=Bottom;
+ commandline[0]=_T('\0');
+ return;
+#endif
+ }
+
+ curr_ptr=curr_ptr->prev;
+ if(curr_ptr->string)
+ _tcscpy(commandline,curr_ptr->string);
+
+ }
+}
+
+
+
+
+
+
+#if 0
+
+LPTSTR history = NULL; /*buffer to sotre all the lines*/
+LPTSTR lines[MAXLINES]; /*array of pointers to each line(entry)*/
+ /*located in history buffer*/
+
+INT curline = 0; /*the last line recalled by user*/
+INT numlines = 0; /*number of entries, included the last*/
+ /*empty one*/
+
+INT maxpos = 0; /*index of last byte of last entry*/
+
+
+
+VOID History (INT dir, LPTSTR commandline)
+{
+
+ INT count; /*used in for loops*/
+ INT length; /*used in the same loops of count*/
+ /*both to make room when is full
+ either history or lines*/
+
+ /*first time History is called allocate mem*/
+ if (!history)
+ {
+ history = malloc (history_size * sizeof (TCHAR));
+ lines[0] = history;
+ history[0] = 0;
+ }
+
+ if (dir > 0)
+ {
+ /* next command */
+ if (curline < numlines)
+ {
+ curline++;
+ }
+
+ if (curline == numlines)
+ {
+ commandline[0] = 0;
+ }
+ else
+ {
+ _tcscpy (commandline, lines[curline]);
+ }
+ }
+ else if (dir < 0)
+ {
+ /* prev command */
+ if (curline > 0)
+ {
+ curline--;
+ }
+
+ _tcscpy (commandline, lines[curline]);
+ }
+ else
+ {
+ /* add to history */
+ /* remove oldest string until there's enough room for next one */
+ /* strlen (commandline) must be less than history_size! */
+ while ((maxpos + (INT)_tcslen (commandline) + 1 > history_size) || (numlines >= MAXLINES))
+ {
+ length = _tcslen (lines[0]) + 1;
+
+ for (count = 0; count < maxpos && count + (lines[1] - lines[0]) < history_size; count++)
+ {
+ history[count] = history[count + length];
+ }
+
+ maxpos -= length;
+
+ for (count = 0; count <= numlines && count < MAXLINES; count++)
+ {
+ lines[count] = lines[count + 1] - length;
+ }
+
+ numlines--;
+#ifdef DEBUG
+ ConOutPrintf (_T("Reduced size: %ld lines\n"), numlines);
+
+ for (count = 0; count < numlines; count++)
+ {
+ ConOutPrintf (_T("%d: %s\n"), count, lines[count]);
+ }
+#endif
+ }
+
+ /*copy entry in the history bufer*/
+ _tcscpy (lines[numlines], commandline);
+ numlines++;
+
+ /*set last lines[numlines] pointer next the end of last, valid,
+ just setted entry (the two lines above)*/
+ lines[numlines] = lines[numlines - 1] + _tcslen (commandline) + 1;
+ maxpos += _tcslen (commandline) + 1;
+ /* last line, empty */
+
+ curline = numlines;
+ }
+
+ return;
+}
+
+#endif
+
+#endif //#if 0
diff --git a/reactos/base/shell/cmd/history.txt b/reactos/base/shell/cmd/history.txt
new file mode 100644
index 00000000000..a0cac6f59d1
--- /dev/null
+++ b/reactos/base/shell/cmd/history.txt
@@ -0,0 +1,367 @@
+FreeDOS Command Line Interface Development History
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+11/11/94 version 0.01
+~~~~~~~~~~~~~~~~~~~~~
+o initial release.
+
+01/01/95 version 0.10
+~~~~~~~~~~~~~~~~~~~~~
+o removed some scaffolding.
+o modified CD.
+o added tab file completion.
+o added command line history.
+
+01/15/95 version 0.20
+~~~~~~~~~~~~~~~~~~~~~
+o formatted all existing source modules.
+o added prompt support.
+o added drive selection.
+o added dir command.
+o started this development log.
+
+08/06/95 prerelease of version 0.30
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o reorganized code into separate source modules.
+o added batch processing support (thanks to Evan Jeffrey).
+o added exec code (thanks to Steffan Kaiser).
+o removed environment handling (thanks again to Steffan Kaiser)
+
+ [ 08/08/95 -- Matt Rains ]
+o formatted this development log.
+o formatted all existing source modules so that they comply with recommended
+ programming practice.
+o added MD command.
+o added RD command.
+o added VER command.
+o replaced CD command.
+o modified DIR command.
+o DIR now called regardless of other DIR.??? files. this is done because of
+ exec() problems.
+
+12/10/95 version 0.30
+~~~~~~~~~~~~~~~~~~~~~
+o used Borland's spawnve to fix exec problem
+o fixed CD again so you don't need a space after it
+o couple of spelling fixes
+
+12/14/95 version 0.31
+~~~~~~~~~~~~~~~~~~~~~
+o modified cmdinput.c to work with non-standard screen sizes (see 28.com)
+o fixed a bug in history.c that made it not work when you hit the up arrow
+ on the first line
+o fixed DIR to work a little more like MS-DOS's DIR (see internal.c)
+o fixed some code in where.c to make things a bit more efficient and nicer
+
+01/06/96 version 0.40 (never released)
+~~~~~~~~~~~~~~~~~~~~~
+o added redirection and piping support!!! (see redir.c and command.c)
+o fixed a stupid pointer problem in where.c that was causing LOTS of
+ problems in the strangest places...
+o added day of the week support to prompt.c (oops, that was already supposed
+ to be there! :)
+o fixed and reorganized the EXEC code!!! Thanks to Svante Frey!
+o reorganized command.c and internal.c to handle parsing internal commands
+ more efficiently and consistently.
+o changed the behavior of MD, CD, RD to work without spaces (e.g. CD\DOS)
+o small changes here and there to make it work with redirection/piping
+ (e.g. DIR only pauses if you're not doing redirection)
+
+01/17/96 version 0.50
+~~~~~~~~~~~~~~~~~~~~~
+Version 0.40 was never released because I was home on Christmas vacation,
+and I couldn't upload it. By the time I got back to school, I had the
+LOADHIGH patch from Svante Frey, so I decided to jump up to 0.50 without any
+release of 0.40... - Tim Norman
+
+o LOADHIGH/LOADFIX/LH support added!!!! Many thanks go to Svante Frey!
+o bug fixed in command parsing that didn't handle / switches correctly...
+o removed debugging output from history.c
+
+07/26/96 version 0.60
+~~~~~~~~~~~~~~~~~~~~~
+Lots of internal changes here... Not much added to the interface.
+
+o Changed internals to use first,rest parameters instead of arrays of params
+o Fixed some bugs
+o Some other things I don't remember :)
+
+07/26/96 version 0.61
+~~~~~~~~~~~~~~~~~~~~~
+Bugfixes
+
+o Added hook to the PATH command
+o Fixed CD.. bug
+
+08/27/96 version 0.70
+~~~~~~~~~~~~~~~~~~~~~
+Finally added Oliver Mueller's ALIAS command! Also numerous bug fixes.
+
+o Added ALIAS command
+o Removed support for - as a switch in LOADHIGH.C
+o Bugfixes in BATCH.C. %0 was returning garbage
+o Removed lots of unused variables, reducing # of warnings when compiling
+o Other miscellaneous code clean-ups
+o Changed WHERE.C to use a little less memory
+
+06/14/97 version 0.71
+~~~~~~~~~~~~~~~~~~~~~
+Lots of bug fixes, plus some additional features.
+
+o New DIR command. Now more like MS-DOS's DIR. /p supported, /s coming soon
+o bug fix in internal.c - parse_firstarg
+o Rewrote parser in batch.c (Steffan Kaiser)
+o Ctrl-Break checking in various places (Steffan Kaiser)
+o Error level setting/checking (%? in batch files) (Steffan Kaiser)
+o bug fix in cmdinput.c ("%i" on command-line caused weird behavior)
+o bug fix in where.c (first item in path wasn't searched)
+
+07/12/97 version 0.72
+~~~~~~~~~~~~~~~~~~~~~
+More bug fixes and code cleanup
+
+o Rewrote cmdinput.c to be more efficient (Marc Desrochers)
+o Added insert/overstrike modes (Marc Desrochers)
+o Replaced findxy() with pointers into BIOS (maxx, maxy) (Marc Desrochers)
+o Fixed bug that disallowed listing of root directories
+o Fixed bug that didn't search the first path (again!)
+
+07/13/97 version 0.72b
+~~~~~~~~~~~~~~~~~~~~~~
+Disabled a feature that caused a crash on some machines.
+
+o Replaced setcursor calls in cmdinput.c with _setcursortype
+o Added dir.c to the distribution (was left out in 0.72)
+
+07/01/98 version 0.73 (Rob Lake)
+~~~~~~~~~~~~~~~~~~~~~~
+o New DIR commands supported: /S, /B, /L, /A and /W.
+ (/R changed to /S). Also /? added.
+o Supports DIRCMD in environment.
+o Supports turning off commands with hyphen (ex. /-S
+ turns off recursive listing)
+o Changed error messages for DIR and DEL to more MS-DOS'ish
+o Moved error messages from DIR.C and DEL.C to COMMAND.H
+ (more may go there soon)
+o Fixed bug that caused dir *.ext/X not to work (no spaces
+ between filespec and slash)
+o Added wildcard support for DEL command
+o Added prompt and help switch for DEL command, /P and /?
+ respectively.
+o Added support for /C when envoking the shell
+o Added /P support when Kernel loads shell. This means
+ the shell now is permanent and runs the autoexec.bat
+ (/E is not implemented)
+o Added my name (Rob Lake) to the developer listing
+o Changed version routine to print out copyright notice
+ with no args, and with appropriate switches, warranty
+ and redistribution notices and developer listing
+
+07/08/1998 version 0.74 (John P. Price (linux-guru@gcfl.net))
+~~~~~~~~~~~~~~~~~~~~~~~~
+COMMAND.C/COMMAND.H:
+o Now sets COMSPEC environment variable
+o misc clean up and optimization
+o added date, time and type commands
+o changed to using spawnl instead of exec. exec does not copy the
+ environment to the child process!
+DIR.C
+o removed extra returns; closer to MSDOS
+o fixed wide display so that an extra return is not displayed when
+ there is five filenames in the last line.
+ENVIRON.C
+o commented out show_environment function. Not used anymore.
+INTERAL.C
+o removed call to show_environment in set command.
+o moved test for syntax before allocating memory in set command.
+o misc clean up and optimization.
+
+o created DATE.C
+o created TIME.C
+o created TYPE.C
+
+07/08/1998 version 0.74b (John P. Price (linux-guru@gcfl.net))
+~~~~~~~~~~~~~~~~~~~~~~~~
+COMMAND.C
+o fixed call to spawnl so that it would pass command line arguments
+ correctly.
+
+07/12/98 version 0.74c (Rob Lake rlake@cs.mun.ca)
+~~~~~~~~~~~~~~~~~~~~~~
+Various Files:
+o removed redundant use of error message defines and moved
+ error printing calls to ERROR.C to reduced program size.
+
+o created MISC.C
+o created ERR_HAND.C/H
+o created ERROR.C
+
+07/13/98 version 0.74d (Rob Lake rlake@cs.mun.ca)
+~~~~~~~~~~~~~~~~~~~~~~
+INTERNAL.C
+o removed most of the commands and placed them in there own file
+ -- del, ren, set and ver
+o created DEL.C, REN.C SET.C and VER.C
+o fixed bug that caused del not to delete files with no attributes
+o the critical error handler count number of times called, autofails
+ at 5 calls
+
+
+16 Jul 1998 (Hans B Pufal )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+batch.c
+ A new version, implements CALL, ECHO, GOT, IF, PAUSE, SHIFT and
+ BEEP. There is a stub for FOR but that's all.
+
+cmdtable.c
+ New file to keep the internal command table. I plan on getting rid
+ of the table real soon now and replacing it with a dynamic
+ mechanism.
+
+command.c
+ A new (improved ;) version. Conforms closely to MS-DOS specs.
+ Cleaned up (and fixed) the redirection handler.
+
+command.h
+ Version D with changes. Look for the HBP tag.
+
+redir.c
+ Modified file, now supports append redirects.
+
+
+16 Jul 1998 (Rob Lake rlake@cs.mun.ca)
+~~~~~~~~~~~~~~~~~~~~~~
+Added TRUENAME command.
+
+
+19 Jul 1998 (Hans B Pufal) )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Preserve state of echo flag across batch calls.
+o Implementation of FOR command
+
+
+20 Jul 1998 (John P Price )
+~~~~~~~~~~~~~~~~~~~~~~
+o Fixed bug in DATE.C.
+o Fixed bug in LH.ASM.
+o Separated commands into individual files.
+
+
+28 Jul 1998 (John P Price )
+~~~~~~~~~~~~~~~~~~~~~~
+o Added CLS command.
+o Put ifdef's around all commands and added include file config.h
+ Now you can define exact what commands you want to include in
+ command.com.
+o Also added ifdefs for optional features: aliases, command history
+ and filename completion.
+o Added display of available internal commands and options at startup.
+
+
+29 Jul 1998 (Rob Lake rlake@cs.mun.ca)
+~~~~~~~~~~~~~~~~~~~~~~
+o changed date.c and time.c, and wrote datefunc.c and timefunc.c to
+ impliment _dos_getdate, _dos_setdate, _dos_gettime and _dos_settime.
+ This is the first of many steps to make the shell compatible under
+ Pacific C.
+
+30-Jul-1998 (John P Price )
+~~~~~~~~~~~~~~~~~~~~~~
+o Changed filename completion so that a second TAB displays a list of
+ matching filenames!
+o made filename be lower case if last character typed is lower case.
+o Moved filename completion code to filecomp.c.
+o Change ver command to display email address to report bugs, and the
+ web page address for updates.
+o fixed so that it find_which returns NULL if filename is not
+ executable (does not have .bat, .com, or .exe extension). Before
+ command would to execute any file with any extension. (opps!)
+
+30-Jul-1998 (John P Price )
+~~~~~~~~~~~~~~~~~~~~~~
+o Fixed bug where if you typed something, then hit HOME, then tried to
+ type something else in insert mode, it locked up.
+o Changed default insert mode to on. There should be a way to change
+ this. Maybe options to doskey command.
+o Added VERIFY command
+
+02-Aug-1998 (Hans B Pufal) )
+~~~~~~~~~~~~~~~~~~~~~~
+o batch.c: Fixed bug in ECHO flag restoration at exit from batch file
+o command.c: Fixed return value when called with /C option
+o Terminate label on first space character, use only first 8 chars of
+ label string
+
+04-Aug-1998 (Hans B Pufal) )
+~~~~~~~~~~~~~~~~~~~~~~
+o call.c: added lines to initialize for pointers. This fixed the
+ lock-up that happened sometimes when calling a batch file from
+ another batch file.
+
+07-Aug-1998 (John P Price )
+~~~~~~~~~~~~~~~~~~~~~~
+o Fixed carrage return output to better match MSDOS with echo on or off.
+
+
+07-Dec-1998 ReactOS CMD version 0.0.1 (Eric Kohl )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o First test release.
+o Added internal ATTRIB command.
+
+11-Dec-1998 ReactOS CMD version 0.0.2 (Eric Kohl )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Fixed bug in ALIAS. CMD crashed when you tried to remove an alias.
+o Fixed bug in split(). Added freep(). This fixed the DEL command.
+o Improved ATTRIB command.
+o Added most help texts.
+o Fixed recursive DIR ("dir /s").
+o Fixed DATE and TIME command. Now they accept values when used
+ without parameter.
+o Implemented LABEL command.
+
+05-Jan-1999 ReactOS CMD version 0.0.3 (Eric Kohl )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Added COLOR command and "/t" option.
+o Cursor shows insert/overwrite mode.
+o COMSPEC environment variable is set upon startup.
+o Started COPY command.
+o Started MOVE command.
+o Added directory stack (PUSHD and POPD commands).
+o Added support for file names or paths that contain spaces
+ (quoted paths / file names).
+o Added recursion to ATTRIB command.
+o Added locale support for DIR, DATE, TIME and PROMPT.
+o Fixed VERIFY.
+
+10-Feb-1999 ReactOS CMD version 0.0.4 (Eric Kohl )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o "?" lists all available commands.
+o Most commands are unicode and redirection aware now.
+o Input-, Output- and Error-Redirections works with most commands.
+o ATTRIB and DEL can handle multiple filenames now.
+o Fixed handling of environment variables.
+o Added CHCP command.
+o Fixed keyboard input bug.
+o Rewrote DEL and MOVE commands.
+
+28-Dec-1999 ReactOS CMD version 0.1 (Eric Kohl )
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Cleaned up DIR command.
+o Searching for executables in the right order.
+o Fixed some little but nasty bugs.
+o Added TITLE command. Thanks to Emanuele Aliberti!
+o Added "/Q", "/W" and "/Z" options to DEL command.
+o Added CHOICE, TIMER, FREE and MEMORY commands.
+o Added MSGBOX command (not available under ReactOS).
+o Added and fixed missing help texts.
+o Fixed bugs in MD and RD that crashed cmd when no directory was specified.
+o Improved history support.
+o Improved COLOR command.
+
+09-Apr-2000 ReactOS CMD version 0.1 (EricKohl
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Fixed bug in COPY command. CMD crashed if source file didn't exist.
+
+13-Jul-2000 ReactOS CMD version 0.1.1 (EricKohl
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+o Implemented 'ECHO.' and 'ECHOERR.' commands.
diff --git a/reactos/base/shell/cmd/if.c b/reactos/base/shell/cmd/if.c
new file mode 100644
index 00000000000..b040d1c098d
--- /dev/null
+++ b/reactos/base/shell/cmd/if.c
@@ -0,0 +1,213 @@
+/*
+ * IF.C - if internal batch command.
+ *
+ *
+ * History:
+ *
+ * 16 Jul 1998 (Hans B Pufal)
+ * started.
+ *
+ * 16 Jul 1998 (John P Price)
+ * Seperated commands into individual files.
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 07-Jan-1999 (Eric Kohl )
+ * Added help text ("if /?") and cleaned up.
+ *
+ * 21-Jan-1999 (Eric Kohl )
+ * Unicode and redirection ready!
+ *
+ * 01-Sep-1999 (Eric Kohl )
+ * Fixed help text.
+ *
+ * 17-Feb-2001 (ea)
+ * IF DEFINED variable command
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ *
+ */
+
+#include
+#include "resource.h"
+
+
+#define X_EXEC 1
+#define X_EMPTY 0x80
+
+INT cmd_if (LPTSTR cmd, LPTSTR param)
+{
+ INT x_flag = 0; /* when set cause 'then' clause to be executed */
+ LPTSTR pp;
+
+#ifdef _DEBUG
+ DebugPrintf (_T("cmd_if: (\'%s\', \'%s\')\n"), cmd, param);
+#endif
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_IF_HELP1);
+ return 0;
+ }
+
+ /* First check if param string begins with 'not' */
+ if (!_tcsnicmp (param, _T("not"), 3) && _istspace (*(param + 3)))
+ {
+ x_flag = X_EXEC; /* Remember 'NOT' */
+ param += 3; /* Step over 'NOT' */
+ while (_istspace (*param)) /* And subsequent spaces */
+ param++;
+ }
+
+ /* Check for 'exist' form */
+ if (!_tcsnicmp (param, _T("exist"), 5) && _istspace (*(param + 5)))
+ {
+ UINT i;
+ BOOL bInside = FALSE;
+
+ param += 5;
+ while (_istspace (*param))
+ param++;
+
+ pp = param;
+
+ /* find the whole path to the file */
+ for(i = 0; i < _tcslen(param); i++)
+ {
+ if(param[i] == _T('\"'))
+ bInside = !bInside;
+ if((param[i] == _T(' ')) && !bInside)
+ {
+ break;
+ }
+ pp++;
+ }
+ *pp++ = _T('\0');
+ i = 0;
+ /* remove quotes */
+ while(i < _tcslen(param))
+ {
+ if(param[i] == _T('\"'))
+ memmove(¶m[i],¶m[i + 1], _tcslen(¶m[i]) * sizeof(TCHAR));
+ else
+ i++;
+ }
+
+ if (*pp)
+ {
+ WIN32_FIND_DATA f;
+ HANDLE hFind;
+
+ hFind = FindFirstFile (param, &f);
+ x_flag ^= (hFind == INVALID_HANDLE_VALUE) ? 0 : X_EXEC;
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ FindClose (hFind);
+ }
+ }
+ else
+ return 0;
+ }
+ else if (!_tcsnicmp (param, _T("defined"), 7) && _istspace (*(param + 7)))
+ {
+ /* Check for 'defined' form */
+ TCHAR Value [1];
+ INT ValueSize = 0;
+
+ param += 7;
+ /* IF [NOT] DEFINED var COMMAND */
+ /* ^ */
+ while (_istspace (*param))
+ param++;
+ /* IF [NOT] DEFINED var COMMAND */
+ /* ^ */
+ pp = param;
+ while (*pp && !_istspace (*pp))
+ pp++;
+ /* IF [NOT] DEFINED var COMMAND */
+ /* ^ */
+ if (*pp)
+ {
+ *pp++ = _T('\0');
+ ValueSize = GetEnvironmentVariable(param, Value, sizeof(Value) / sizeof(Value[0]));
+ x_flag ^= (0 == ValueSize)
+ ? 0
+ : X_EXEC;
+ x_flag |= X_EMPTY;
+ }
+ else
+ return 0;
+ }
+ else if (!_tcsnicmp (param, _T("errorlevel"), 10) && _istspace (*(param + 10)))
+ {
+ /* Check for 'errorlevel' form */
+ INT n = 0;
+
+ pp = param + 10;
+ while (_istspace (*pp))
+ pp++;
+
+ while (_istdigit (*pp))
+ n = n * 10 + (*pp++ - _T('0'));
+
+ x_flag ^= (nErrorLevel != n) ? 0 : X_EXEC;
+
+ x_flag |= X_EMPTY; /* Syntax error if comd empty */
+ }
+ else
+ {
+ BOOL bInQuote = FALSE;
+ INT p1len;
+ pp = param;
+ while ( *pp && ( bInQuote || *pp != _T('=') ) )
+ {
+ if ( *pp == _T('\"') )
+ bInQuote = !bInQuote;
+ ++pp;
+ }
+ p1len = pp-param;
+ /* check for "==" */
+ if ( *pp++ != _T('=') || *pp++ != _T('=') )
+ {
+ error_syntax ( NULL );
+ return 1;
+ }
+ while (_istspace (*pp)) /* Skip subsequent spaces */
+ pp++;
+
+ /* are the two sides equal, and does the second end in the same place? */
+ if ( !_tcsncmp(param,pp,p1len) && _tcschr(_T(" ("),pp[p1len]) )
+ x_flag ^= X_EXEC;
+ pp += p1len;
+
+ if ( x_flag )
+ {
+ while (*pp && !_istspace (*pp)) /* Find first space, */
+ pp++;
+ x_flag |= X_EMPTY;
+ }
+ }
+
+ if (x_flag & X_EMPTY)
+ {
+ while (_istspace (*pp)) /* Then skip spaces */
+ pp++;
+
+ if (*pp == _T('\0')) /* If nothing left then syntax err */
+ {
+ error_syntax (NULL);
+ return 1;
+ }
+ }
+
+ if (x_flag & X_EXEC)
+ {
+ ParseCommandLine (pp);
+ }
+
+ return 0;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/internal.c b/reactos/base/shell/cmd/internal.c
new file mode 100644
index 00000000000..5c62a9bbd2b
--- /dev/null
+++ b/reactos/base/shell/cmd/internal.c
@@ -0,0 +1,767 @@
+/*
+ * INTERNAL.C - command.com internal commands.
+ *
+ *
+ * History:
+ *
+ * 17/08/94 (Tim Norman)
+ * started.
+ *
+ * 08/08/95 (Matt Rains)
+ * i have cleaned up the source code. changes now bring this source into
+ * guidelines for recommended programming practice.
+ *
+ * cd()
+ * started.
+ *
+ * dir()
+ * i have added support for file attributes to the DIR() function. the
+ * routine adds "d" (directory) and "r" (read only) output. files with the
+ * system attribute have the filename converted to lowercase. files with
+ * the hidden attribute are not displayed.
+ *
+ * i have added support for directorys. now if the directory attribute is
+ * detected the file size if replaced with the string "".
+ *
+ * ver()
+ * started.
+ *
+ * md()
+ * started.
+ *
+ * rd()
+ * started.
+ *
+ * del()
+ * started.
+ *
+ * does not support wildcard selection.
+ *
+ * todo: add delete directory support.
+ * add recursive directory delete support.
+ *
+ * ren()
+ * started.
+ *
+ * does not support wildcard selection.
+ *
+ * todo: add rename directory support.
+ *
+ * a general structure has been used for the cd, rd and md commands. this
+ * will be better in the long run. it is too hard to maintain such diverse
+ * functions when you are involved in a group project like this.
+ *
+ * 12/14/95 (Tim Norman)
+ * fixed DIR so that it will stick \*.* if a directory is specified and
+ * that it will stick on .* if a file with no extension is specified or
+ * *.* if it ends in a \
+ *
+ * 1/6/96 (Tim Norman)
+ * added an isatty call to DIR so it won't prompt for keypresses unless
+ * stdin and stdout are the console.
+ *
+ * changed parameters to be mutually consistent to make calling the
+ * functions easier
+ *
+ * rem()
+ * started.
+ *
+ * doskey()
+ * started.
+ *
+ * 01/22/96 (Oliver Mueller)
+ * error messages are now handled by perror.
+ *
+ * 02/05/96 (Tim Norman)
+ * converted all functions to accept first/rest parameters
+ *
+ * 07/26/96 (Tim Norman)
+ * changed return values to int instead of void
+ *
+ * path() started.
+ *
+ * 12/23/96 (Aaron Kaufman)
+ * rewrote dir() to mimic MS-DOS's dir
+ *
+ * 01/28/97 (Tim Norman)
+ * cleaned up Aaron's DIR code
+ *
+ * 06/13/97 (Tim Norman)
+ * moved DIR code to dir.c
+ * re-implemented Aaron's DIR code
+ *
+ * 06/14/97 (Steffan Kaiser)
+ * ctrl-break handling
+ * bug fixes
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 03-Dec-1998 (Eric Kohl )
+ * Replaced DOS calls by Win32 calls.
+ *
+ * 08-Dec-1998 (Eric Kohl )
+ * Added help texts ("/?").
+ *
+ * 18-Dec-1998 (Eric Kohl )
+ * Added support for quoted arguments (cd "program files").
+ *
+ * 07-Jan-1999 (Eric Kohl )
+ * Clean up.
+ *
+ * 26-Jan-1999 (Eric Kohl )
+ * Replaced remaining CRT io functions by Win32 io functions.
+ * Unicode safe!
+ *
+ * 30-Jan-1999 (Eric Kohl )
+ * Added "cd -" feature. Changes to the previous directory.
+ *
+ * 15-Mar-1999 (Eric Kohl )
+ * Fixed bug in "cd -" feature. If the previous directory was a root
+ * directory, it was ignored.
+ *
+ * 23-Feb-2001 (Carl Nettelblad )
+ * Improved chdir/cd command.
+ *
+ * 02-Apr-2004 (Magnus Olsen )
+ * Remove all hard code string so they can be
+ * translate to other langues.
+ *
+ * 19-jul-2005 (Brandon Turner
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_CHDIR
+
+static LPTSTR lpLastPath;
+
+
+VOID InitLastPath (VOID)
+{
+ lpLastPath = NULL;
+}
+
+
+VOID FreeLastPath (VOID)
+{
+ if (lpLastPath)
+ free (lpLastPath);
+}
+
+/* help functions for getting current path from drive
+ without changing drive. Return code 0 = ok, 1 = fail.
+ INT GetRootPath("C:",outbuffer,chater size of outbuffer);
+ the first param can have any size, if the the two frist
+ letter are not a drive with : it will get Currentpath on
+ current drive exacly as GetCurrentDirectory does.
+ */
+
+INT GetRootPath(TCHAR *InPath,TCHAR *OutPath,INT size)
+{
+ INT retcode = 1;
+
+ if (_tcslen(InPath)>1)
+ {
+ if (InPath[1]==_T(':'))
+ {
+ INT t=0;
+
+ if ((InPath[0] >= _T('0')) && (InPath[0] <= _T('9')))
+ {
+ t = (InPath[0] - _T('0')) +28;
+ }
+
+ if ((InPath[0] >= _T('a')) && (InPath[0] <= _T('z')))
+ {
+ t = (InPath[0] - _T('a')) +1;
+ InPath[0] = t + _T('A') - 1;
+ }
+
+ if ((InPath[0] >= _T('A')) && (InPath[0] <= _T('Z')))
+ {
+ t = (InPath[0] - _T('A')) +1;
+ }
+
+ if (_tgetdcwd(t,OutPath,size) != NULL)
+ {
+ return 0;
+ }
+ }
+ }
+
+ /* fail */
+ if (_tcslen(InPath)>1)
+ {
+ if (InPath[1]==_T(':'))
+ return 1;
+ }
+
+ /* Get current directory */
+ retcode = GetCurrentDirectory(size,OutPath);
+ if (retcode==0)
+ return 1;
+
+ return 0;
+}
+
+
+BOOL SetRootPath(TCHAR *InPath)
+{
+ TCHAR oldpath[MAX_PATH];
+ TCHAR OutPath[MAX_PATH];
+ TCHAR OutPathTemp[MAX_PATH];
+ TCHAR OutPathTemp2[MAX_PATH];
+ BOOL fail;
+
+
+ /* Get The current directory path and save it */
+ fail = GetCurrentDirectory(MAX_PATH,oldpath);
+ if (!fail)
+ return 1;
+
+ /* Get current drive directory path if C: was only pass down*/
+
+ if (_tcsncicmp(&InPath[1],_T(":\\"),2)!=0)
+ {
+ if (!GetRootPath(InPath,OutPathTemp,MAX_PATH))
+ _tcscpy(OutPathTemp,InPath);
+ }
+ else
+ {
+ _tcscpy(OutPathTemp,InPath);
+ }
+
+ _tcsupr(OutPathTemp);
+ /* The use of both of these together will correct the case of a path
+ where as one alone or GetFullPath will not. Exameple:
+ c:\windows\SYSTEM32 => C:\WINDOWS\system32 */
+ GetFullPathName(OutPathTemp, MAX_PATH, OutPathTemp2, NULL);
+ GetPathCase(OutPathTemp2, OutPath);
+
+ fail = SetCurrentDirectory(OutPath);
+ if (!fail)
+ return 1;
+
+
+
+ SetCurrentDirectory(OutPath);
+ GetCurrentDirectory(MAX_PATH,OutPath);
+ _tchdir(OutPath);
+
+ if (_tcsncicmp(OutPath,oldpath,2)!=0)
+ SetCurrentDirectory(oldpath);
+
+ return 0;
+}
+
+
+/*
+ * CD / CHDIR
+ *
+ */
+INT cmd_chdir (LPTSTR cmd, LPTSTR param)
+{
+
+ WIN32_FIND_DATA f;
+ HANDLE hFile;
+ BOOL bChangeDrive = FALSE;
+ TCHAR szPath[MAX_PATH];
+ TCHAR szFinalPath[MAX_PATH];
+ TCHAR * tmpPath;
+ TCHAR szCurrent[MAX_PATH];
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ INT i;
+
+
+ /* Filter out special cases first */
+
+ /* Print Help */
+ if (!_tcsncmp(param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_CD_HELP);
+ return 0;
+ }
+
+ /* Set Error Level to Success */
+ nErrorLevel = 0;
+
+ /* Input String Contains /D Switch */
+ if (!_tcsncicmp(param, _T("/D"), 2))
+ {
+ bChangeDrive = TRUE;
+ tmpPath = _tcsstr(param,_T(" "));
+ if(!tmpPath)
+ {
+ /* Didnt find an directories */
+ LoadString(CMD_ModuleHandle, STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ nErrorLevel = 1;
+ return 1;
+ }
+ tmpPath++;
+ _tcscpy(szPath,tmpPath);
+ }
+ else
+ {
+ _tcscpy(szPath,param);
+ }
+
+ /* Print Current Directory on a disk */
+ if (_tcslen(szPath) == 2 && szPath[1] == _T(':'))
+ {
+ if(GetRootPath(szPath,szCurrent,MAX_PATH))
+ {
+ nErrorLevel = 1;
+ return 1;
+ }
+ ConOutPuts(szCurrent);
+ return 0;
+ }
+
+ /* Get Current Directory */
+ GetRootPath(_T("."),szCurrent,MAX_PATH);
+
+ /* Remove " */
+ i = 0;
+ while(i < (INT)_tcslen(szPath))
+ {
+ if(szPath[i] == _T('\"'))
+ memmove(&szPath[i],&szPath[i + 1], _tcslen(&szPath[i]) * sizeof(TCHAR));
+ else
+ i++;
+ }
+
+ tmpPath = szPath;
+ while (_istspace (*tmpPath))
+ tmpPath++;
+ _tcscpy(szPath,tmpPath);
+
+ if (szPath[0] == _T('\0'))
+ {
+ ConOutPuts(szCurrent);
+ return 0;
+ }
+
+
+ /* change to full path if relative path was given */
+ GetFullPathName(szPath,MAX_PATH,szFinalPath,NULL);
+
+ if(szFinalPath[_tcslen(szFinalPath) - 1] == _T('\\') && _tcslen(szFinalPath) > 3)
+ szFinalPath[_tcslen(szFinalPath) - 1] = _T('\0');
+
+ /* Handle Root Directory Alone*/
+ if (_tcslen(szFinalPath) == 3 && szFinalPath[1] == _T(':'))
+ {
+ if(!SetRootPath(szFinalPath))
+ {
+ /* Change prompt if it is one the same drive or /D */
+ if(bChangeDrive || !_tcsncicmp(szFinalPath,szCurrent,1))
+ SetCurrentDirectory(szFinalPath);
+ return 0;
+ }
+ /* Didnt find an directories */
+ LoadString(CMD_ModuleHandle, STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ nErrorLevel = 1;
+ return 1;
+
+ }
+
+ /* Get a list of all the files */
+ hFile = FindFirstFile (szFinalPath, &f);
+
+ do
+ {
+ if(hFile == INVALID_HANDLE_VALUE)
+ {
+ ConErrFormatMessage (GetLastError(), szFinalPath);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ /* Strip the paths back to the folder they are in */
+ for(i = (_tcslen(szFinalPath) - 1); i > -1; i--)
+ if(szFinalPath[i] != _T('\\'))
+ szFinalPath[i] = _T('\0');
+ else
+ break;
+
+ _tcscat(szFinalPath,f.cFileName);
+
+ if ((f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)
+ {
+ if(!SetRootPath(szFinalPath))
+ {
+ /* Change for /D */
+ if(bChangeDrive)
+ {
+ _tcsupr(szFinalPath);
+ GetPathCase(szFinalPath, szPath);
+ SetCurrentDirectory(szPath);
+ }
+ return 0;
+ }
+
+ }
+ }while(FindNextFile (hFile, &f));
+
+ /* Didnt find an directories */
+ LoadString(CMD_ModuleHandle, STRING_ERROR_PATH_NOT_FOUND, szMsg, RC_STRING_MAX_SIZE);
+ ConErrPrintf(szMsg);
+ nErrorLevel = 1;
+ return 1;
+}
+
+#endif
+
+
+
+#ifdef INCLUDE_CMD_MKDIR
+
+/* Helper funtion for mkdir to make directories in a path.
+Dont use the api to decrease depence on libs */
+BOOL
+MakeFullPath(TCHAR * DirPath)
+{
+ TCHAR path[MAX_PATH];
+ TCHAR *p = DirPath;
+ INT n;
+
+ if (p[0] && p[1] == _T(':'))
+ p += 2;
+ while (*p == _T('\\'))
+ p++; /* skip drive root */
+ while ((p = _tcschr(p, _T('\\'))) != NULL)
+ {
+ n = p - DirPath + 1;
+ memcpy(path, DirPath, n);
+ path[n] = _T('\0');
+ if( !CreateDirectory(path, NULL) &&
+ (GetLastError() != ERROR_ALREADY_EXISTS))
+ return FALSE;
+ p++;
+ }
+ if (GetLastError() == ERROR_ALREADY_EXISTS)
+ SetLastError(ERROR_SUCCESS);
+
+ return TRUE;
+}
+
+/*
+ * MD / MKDIR
+ *
+ */
+INT cmd_mkdir (LPTSTR cmd, LPTSTR param)
+{
+ LPTSTR dir; /* pointer to the directory to change to */
+ LPTSTR place; /* used to search for the \ when no space is used */
+ LPTSTR *p = NULL;
+ INT argc;
+ nErrorLevel = 0;
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_MKDIR_HELP);
+ return 0;
+ }
+
+
+ /* check if there is no space between the command and the path */
+ if (param[0] == _T('\0'))
+ {
+ /* search for the \ or . so that both short & long names will work */
+ for (place = cmd; *place; place++)
+ if (*place == _T('.') || *place == _T('\\'))
+ break;
+
+ if (*place)
+ dir = place;
+ else
+ /* signal that there are no parameters */
+ dir = NULL;
+ }
+ else
+ {
+ p = split (param, &argc, FALSE);
+ if (argc > 1)
+ {
+ /*JPP 20-Jul-1998 use standard error message */
+ error_too_many_parameters (param);
+ freep (p);
+ return 1;
+ }
+ else
+ dir = p[0];
+ }
+
+ if (!dir)
+ {
+ ConErrResPuts (STRING_ERROR_REQ_PARAM_MISSING);
+ nErrorLevel = 1;
+ if(p != NULL)
+ freep (p);
+ return 1;
+ }
+
+ /* Add a \ at the end of the path is there isnt on already */
+ if (dir[_tcslen (dir) - 1] != _T('\\'))
+ _tcscat(dir,_T("\\"));
+
+ if (!MakeFullPath(dir))
+ {
+ if(GetLastError() == ERROR_PATH_NOT_FOUND)
+ {
+ ConErrResPuts(STRING_MD_ERROR2);
+ }
+ else
+ {
+ ErrorMessage (GetLastError(), _T("MD"));
+ }
+ nErrorLevel = 1;
+ freep (p);
+ return 1;
+ }
+
+ freep (p);
+
+ return 0;
+}
+#endif
+
+
+#ifdef INCLUDE_CMD_RMDIR
+/*
+ * RD / RMDIR
+ *
+ */
+BOOL DeleteFolder(LPTSTR FileName)
+{
+ TCHAR Base[MAX_PATH];
+ TCHAR TempFileName[MAX_PATH];
+ HANDLE hFile;
+ WIN32_FIND_DATA f;
+ _tcscpy(Base,FileName);
+ _tcscat(Base,_T("\\*"));
+ hFile = FindFirstFile(Base, &f);
+ Base[_tcslen(Base) - 1] = _T('\0');
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if (!_tcscmp(f.cFileName, _T(".")) ||
+ !_tcscmp(f.cFileName, _T("..")))
+ continue;
+ _tcscpy(TempFileName,Base);
+ _tcscat(TempFileName,f.cFileName);
+
+ if(f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ DeleteFolder(TempFileName);
+ else
+ {
+ SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL);
+ if(!DeleteFile(TempFileName))
+ return 0;
+ }
+
+ }while (FindNextFile (hFile, &f));
+ FindClose (hFile);
+ }
+ return RemoveDirectory(FileName);
+}
+INT cmd_rmdir (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR dir[MAX_PATH]; /* pointer to the directory to change to */
+ char ch;
+ INT args;
+ LPTSTR *arg = NULL;
+ INT i;
+ BOOL RD_SUB = FALSE;
+ BOOL RD_QUIET = FALSE;
+ HANDLE hFile;
+ WIN32_FIND_DATA f;
+ INT res;
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szFullPath[MAX_PATH];
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_RMDIR_HELP);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ arg = split (param, &args, FALSE);
+
+ if (args == 0)
+ {
+ /* only command given */
+ error_req_param_missing ();
+ freep (arg);
+ return 1;
+ }
+
+ dir[0] = 0;
+ /* check for options anywhere in command line */
+ for (i = 0; i < args; i++)
+ {
+ if (*arg[i] == _T('/'))
+ {
+ /*found a command, but check to make sure it has something after it*/
+ if (_tcslen (arg[i]) == 2)
+ {
+ ch = _totupper (arg[i][1]);
+ if (ch == _T('S'))
+ {
+ RD_SUB = TRUE;
+ }
+ else if (ch == _T('Q'))
+ {
+ RD_QUIET = TRUE;
+ }
+ }
+ }
+ else
+ {
+ /* get the folder name */
+ _tcscpy(dir,arg[i]);
+ }
+ }
+
+ if (dir[0] == _T('\0'))
+ {
+ /* No folder to remove */
+ ConErrResPuts(STRING_ERROR_REQ_PARAM_MISSING);
+ freep(arg);
+ return 1;
+ }
+
+ GetFullPathName(dir,MAX_PATH,szFullPath,NULL);
+ /* remove trailing \ if any, but ONLY if dir is not the root dir */
+ if (_tcslen (szFullPath) >= 2 && szFullPath[_tcslen (szFullPath) - 1] == _T('\\'))
+ szFullPath[_tcslen(szFullPath) - 1] = _T('\0');
+
+ if(RD_SUB)
+ {
+ /* ask if they want to delete evrything in the folder */
+ if (!RD_QUIET)
+ {
+ LoadString( CMD_ModuleHandle, STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
+ res = FilePromptYNA (szMsg);
+ if ((res == PROMPT_NO) || (res == PROMPT_BREAK))
+ {
+ freep(arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+ }
+
+ }
+ else
+ {
+ /* check for files in the folder */
+ _tcscat(szFullPath,_T("\\*"));
+
+ hFile = FindFirstFile(szFullPath, &f);
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if (!_tcscmp(f.cFileName,_T(".")) ||
+ !_tcscmp(f.cFileName,_T("..")))
+ continue;
+ ConOutResPuts(STRING_RMDIR_HELP2);
+ freep(arg);
+ FindClose (hFile);
+ nErrorLevel = 1;
+ return 1;
+ }while (FindNextFile (hFile, &f));
+ FindClose (hFile);
+ }
+ /* reovme the \\* */
+ szFullPath[_tcslen(szFullPath) - 2] = _T('\0');
+ }
+
+ if (!DeleteFolder(szFullPath))
+ {
+ /* Couldnt delete the folder, clean up and print out the error */
+ ErrorMessage (GetLastError(), _T("RD"));
+ freep (arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ freep (arg);
+ return 0;
+}
+#endif
+
+
+/*
+ * set the exitflag to true
+ *
+ */
+INT CommandExit (LPTSTR cmd, LPTSTR param)
+{
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_EXIT_HELP);
+ /* Just make sure */
+ bExit = FALSE;
+ /* Dont exit */
+ return 0;
+ }
+
+ if (bc != NULL && _tcsnicmp(param,_T("/b"),2) == 0)
+ {
+ param += 2;
+ while (_istspace (*param))
+ param++;
+ if (_istdigit(*param))
+ nErrorLevel = _ttoi(param);
+ ExitBatch (NULL);
+ }
+
+ else
+ bExit = TRUE;
+
+
+ return 0;
+
+}
+
+#ifdef INCLUDE_CMD_REM
+/*
+ * does nothing
+ *
+ */
+INT CommandRem (LPTSTR cmd, LPTSTR param)
+{
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_REM_HELP);
+ }
+
+ return 0;
+}
+#endif /* INCLUDE_CMD_REM */
+
+
+INT CommandShowCommands (LPTSTR cmd, LPTSTR param)
+{
+ PrintCommandList ();
+ return 0;
+}
+
+INT CommandShowCommandsDetail (LPTSTR cmd, LPTSTR param)
+{
+ PrintCommandListDetail ();
+ return 0;
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/label.c b/reactos/base/shell/cmd/label.c
new file mode 100644
index 00000000000..670e0b3deb9
--- /dev/null
+++ b/reactos/base/shell/cmd/label.c
@@ -0,0 +1,129 @@
+/*
+ * LABEL.C - label internal command.
+ *
+ *
+ * History:
+ *
+ * 10-Dec-1998 (Eric Kohl )
+ * Started.
+ *
+ * 11-Dec-1998 (Eric Kohl )
+ * Finished.
+ *
+ * 19-Jan-1998 (Eric Kohl )
+ * Unicode ready!
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_LABEL
+
+
+INT cmd_label (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szRootPath[] = _T("A:\\");
+ TCHAR szLabel[80];
+ TCHAR szOldLabel[80];
+ DWORD dwSerialNr;
+ LPTSTR *arg;
+ INT args;
+
+ /* set empty label string */
+ szLabel[0] = _T('\0');
+
+ /* print help */
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_LABEL_HELP1);
+ return 0;
+ }
+
+ nErrorLevel = 0;
+
+ /* get parameters */
+ arg = split (param, &args, FALSE);
+
+ if (args > 2)
+ {
+ /* too many parameters */
+ error_too_many_parameters (arg[args - 1]);
+ freep (arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ if (args == 0)
+ {
+ /* get label of current drive */
+ TCHAR szCurPath[MAX_PATH];
+ GetCurrentDirectory (MAX_PATH, szCurPath);
+ szRootPath[0] = szCurPath[0];
+ }
+ else
+ {
+ if ((_tcslen (arg[0]) >= 2) && (arg[0][1] == _T(':')))
+ {
+ szRootPath[0] = toupper (*arg[0]);
+ if (args == 2)
+ _tcsncpy (szLabel, arg[1], 12);
+ }
+ else
+ {
+ TCHAR szCurPath[MAX_PATH];
+ GetCurrentDirectory (MAX_PATH, szCurPath);
+ szRootPath[0] = szCurPath[0];
+ _tcsncpy (szLabel, arg[0], 12);
+ }
+ }
+
+ /* check root path */
+ if (!IsValidPathName (szRootPath))
+ {
+ error_invalid_drive ();
+ freep (arg);
+ nErrorLevel = 1;
+ return 1;
+ }
+
+ GetVolumeInformation(szRootPath, szOldLabel, 80, &dwSerialNr,
+ NULL, NULL, NULL, 0);
+
+ /* print drive info */
+ if (szOldLabel[0] != _T('\0'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_LABEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, _totupper(szRootPath[0]), szOldLabel);
+ }
+ else
+ {
+ LoadString(CMD_ModuleHandle, STRING_LABEL_HELP3, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, _totupper(szRootPath[0]));
+ }
+
+ /* print the volume serial number */
+ LoadString(CMD_ModuleHandle, STRING_LABEL_HELP4, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr));
+
+ if (szLabel[0] == _T('\0'))
+ {
+ LoadString(CMD_ModuleHandle, STRING_LABEL_HELP5, szMsg, RC_STRING_MAX_SIZE);
+ ConOutResPuts(STRING_LABEL_HELP5);
+
+ ConInString(szLabel, 80);
+ }
+
+ SetVolumeLabel(szRootPath, szLabel);
+
+ freep(arg);
+
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_LABEL */
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/license.txt b/reactos/base/shell/cmd/license.txt
new file mode 100644
index 00000000000..c4fb365c774
--- /dev/null
+++ b/reactos/base/shell/cmd/license.txt
@@ -0,0 +1,342 @@
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C) 19yy
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
diff --git a/reactos/base/shell/cmd/locale.c b/reactos/base/shell/cmd/locale.c
new file mode 100644
index 00000000000..fe77f67699e
--- /dev/null
+++ b/reactos/base/shell/cmd/locale.c
@@ -0,0 +1,81 @@
+/*
+ * LOCALE.C - locale handling.
+ *
+ *
+ * History:
+ *
+ * 09-Jan-1999 (Eric Kohl )
+ * Started.
+ *
+ * 20-Jan-1999 (Eric Kohl )
+ * Unicode safe!
+ */
+
+#include
+#include "resource.h"
+
+
+TCHAR cDateSeparator;
+TCHAR cTimeSeparator;
+TCHAR cThousandSeparator;
+TCHAR cDecimalSeparator;
+INT nDateFormat;
+INT nTimeFormat;
+INT nNumberGroups;
+
+
+VOID InitLocale (VOID)
+{
+ TCHAR szBuffer[256];
+
+ /* date settings */
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDATE, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+ cDateSeparator = szBuffer[0];
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDATE | LOCALE_RETURN_NUMBER, (LPTSTR)&nDateFormat, sizeof(nDateFormat) / sizeof(TCHAR));
+
+ /* time settings */
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STIME, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+ cTimeSeparator = szBuffer[0];
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_ITIME | LOCALE_RETURN_NUMBER, (LPTSTR)&nTimeFormat, sizeof(nTimeFormat) / sizeof(TCHAR));
+
+ /* number settings */
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+ cThousandSeparator = szBuffer[0];
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+ cDecimalSeparator = szBuffer[0];
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SGROUPING, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+ nNumberGroups = _ttoi(szBuffer);
+#if 0
+ /* days of week */
+ for (i = 0; i < 7; i++)
+ {
+ GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1 + i, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]));
+ _tcscpy (aszDayNames[(i+1)%7], szBuffer); /* little hack */
+ }
+#endif
+}
+
+
+VOID PrintDate (VOID)
+{
+ TCHAR szDateDay[32];
+ TCHAR szDate[32];
+
+ GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("ddd"), szDateDay, sizeof (szDateDay));
+
+ GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,szDate, sizeof (szDate));
+ ConOutPrintf(_T("%s %s"),szDateDay, szDate);
+}
+
+
+VOID PrintTime (VOID)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ SYSTEMTIME t;
+ GetLocalTime(&t);
+
+ LoadString(CMD_ModuleHandle, STRING_LOCALE_HELP1, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(_T("%s: %02d%c%02d%c%02d%c%02d\n"), szMsg, t.wHour, cTimeSeparator,
+ t.wMinute , cTimeSeparator,
+ t.wSecond , cDecimalSeparator, t.wMilliseconds );
+}
diff --git a/reactos/base/shell/cmd/main.c b/reactos/base/shell/cmd/main.c
new file mode 100644
index 00000000000..85bb80b7542
--- /dev/null
+++ b/reactos/base/shell/cmd/main.c
@@ -0,0 +1,26 @@
+#include
+#include "resource.h"
+
+#ifdef _UNICODE
+extern int _main (void);
+#else
+extern int _main (int argc, char *argv[]);
+#endif
+
+/*
+ * main function
+ */
+#ifdef _UNICODE
+int main(void)
+#else
+int main (int argc, char *argv[])
+#endif
+{
+#ifdef _UNICODE
+ return _main();
+#else
+ return _main(argc, argv);
+#endif
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/memory.c b/reactos/base/shell/cmd/memory.c
new file mode 100644
index 00000000000..2a917ffd8d1
--- /dev/null
+++ b/reactos/base/shell/cmd/memory.c
@@ -0,0 +1,97 @@
+/*
+ * MEMORY.C - internal command.
+ *
+ *
+ * History:
+ *
+ * 01-Sep-1999 (Eric Kohl)
+ * Started.
+ *
+ * 28-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+#ifdef INCLUDE_CMD_MEMORY
+
+
+/*
+ * convert
+ *
+ * insert commas into a number
+ */
+static INT
+ConvertDWord (DWORD num, LPTSTR des, INT len, BOOL bSeparator)
+{
+ TCHAR temp[32];
+ INT c = 0;
+ INT n = 0;
+
+ if (num == 0)
+ {
+ des[0] = _T('0');
+ des[1] = _T('\0');
+ n = 1;
+ }
+ else
+ {
+ temp[31] = 0;
+ while (num > 0)
+ {
+ if (bSeparator && (((c + 1) % (nNumberGroups + 1)) == 0))
+ temp[30 - c++] = cThousandSeparator;
+ temp[30 - c++] = (TCHAR)(num % 10) + _T('0');
+ num /= 10;
+ }
+
+ for (n = 0; n <= c; n++)
+ des[n] = temp[31 - c + n];
+ }
+
+ return n;
+}
+
+
+INT CommandMemory (LPTSTR cmd, LPTSTR param)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ MEMORYSTATUS ms;
+ TCHAR szMemoryLoad[20];
+ TCHAR szTotalPhys[20];
+ TCHAR szAvailPhys[20];
+ TCHAR szTotalPageFile[20];
+ TCHAR szAvailPageFile[20];
+ TCHAR szTotalVirtual[20];
+ TCHAR szAvailVirtual[20];
+
+ if (!_tcsncmp (param, _T("/?"), 2))
+ {
+ ConOutResPaging(TRUE,STRING_MEMMORY_HELP1);
+ return 0;
+ }
+
+ ms.dwLength = sizeof(MEMORYSTATUS);
+
+ GlobalMemoryStatus (&ms);
+
+ ConvertDWord (ms.dwMemoryLoad, szMemoryLoad, 20, FALSE);
+ ConvertDWord (ms.dwTotalPhys, szTotalPhys, 20, TRUE);
+ ConvertDWord (ms.dwAvailPhys, szAvailPhys, 20, TRUE);
+ ConvertDWord (ms.dwTotalPageFile, szTotalPageFile, 20, TRUE);
+ ConvertDWord (ms.dwAvailPageFile, szAvailPageFile, 20, TRUE);
+ ConvertDWord (ms.dwTotalVirtual, szTotalVirtual, 20, TRUE);
+ ConvertDWord (ms.dwAvailVirtual, szAvailVirtual, 20, TRUE);
+
+ LoadString(CMD_ModuleHandle, STRING_MEMMORY_HELP2, szMsg, RC_STRING_MAX_SIZE);
+ ConOutPrintf(szMsg,
+ szMemoryLoad, szTotalPhys, szAvailPhys, szTotalPageFile,
+ szAvailPageFile, szTotalVirtual, szAvailVirtual);
+
+ return 0;
+}
+
+#endif /* INCLUDE_CMD_MEMORY */
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/misc.c b/reactos/base/shell/cmd/misc.c
new file mode 100644
index 00000000000..38843619a1e
--- /dev/null
+++ b/reactos/base/shell/cmd/misc.c
@@ -0,0 +1,659 @@
+/*
+ * MISC.C - misc. functions.
+ *
+ *
+ * History:
+ *
+ * 07/12/98 (Rob Lake)
+ * started
+ *
+ * 07/13/98 (Rob Lake)
+ * moved functions in here
+ *
+ * 27-Jul-1998 (John P Price )
+ * added config.h include
+ *
+ * 18-Dec-1998 (Eric Kohl )
+ * Changed split() to accept quoted arguments.
+ * Removed parse_firstarg().
+ *
+ * 23-Jan-1999 (Eric Kohl )
+ * Fixed an ugly bug in split(). In rare cases (last character
+ * of the string is a space) it ignored the NULL character and
+ * tried to add the following to the argument list.
+ *
+ * 28-Jan-1999 (Eric Kohl )
+ * FileGetString() seems to be working now.
+ *
+ * 06-Nov-1999 (Eric Kohl )
+ * Added PagePrompt() and FilePrompt().
+ *
+ * 30-Apr-2005 (Magnus Olsen) )
+ * Remove all hardcode string to En.rc
+ */
+
+#include
+#include "resource.h"
+
+
+/*
+ * get a character out-of-band and honor Ctrl-Break characters
+ */
+TCHAR cgetchar (VOID)
+{
+ HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE);
+ INPUT_RECORD irBuffer;
+ DWORD dwRead;
+/*
+ do
+ {
+ ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
+ if ((irBuffer.EventType == KEY_EVENT) &&
+ (irBuffer.Event.KeyEvent.bKeyDown == TRUE))
+ {
+ if ((irBuffer.Event.KeyEvent.dwControlKeyState &
+ (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) &
+ (irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C'))
+ bCtrlBreak = TRUE;
+
+ break;
+ }
+ }
+ while (TRUE);
+*/
+ do
+ {
+ ReadConsoleInput (hInput, &irBuffer, 1, &dwRead);
+
+ if (irBuffer.EventType == KEY_EVENT)
+ {
+ if (irBuffer.Event.KeyEvent.dwControlKeyState &
+ (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))
+ {
+ if (irBuffer.Event.KeyEvent.wVirtualKeyCode == 'C')
+ {
+// if (irBuffer.Event.KeyEvent.bKeyDown == TRUE)
+// {
+ bCtrlBreak = TRUE;
+ break;
+// }
+ }
+ }
+ else if ((irBuffer.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
+ (irBuffer.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
+ (irBuffer.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL))
+ {
+ ;
+ }
+
+ else
+ {
+ break;
+ }
+ }
+ }
+ while (TRUE);
+
+#ifndef _UNICODE
+ return irBuffer.Event.KeyEvent.uChar.AsciiChar;
+#else
+ return irBuffer.Event.KeyEvent.uChar.UnicodeChar;
+#endif /* _UNICODE */
+}
+
+/*
+ * Takes a path in and returns it with the correct case of the letters
+ */
+VOID GetPathCase( TCHAR * Path, TCHAR * OutPath)
+{
+ INT i = 0;
+ TCHAR TempPath[MAX_PATH];
+ WIN32_FIND_DATA FindFileData;
+ HANDLE hFind;
+ _tcscpy(TempPath, _T(""));
+ _tcscpy(OutPath, _T(""));
+
+
+ for(i = 0; i < _tcslen(Path); i++)
+ {
+ if(Path[i] != _T('\\'))
+ {
+ _tcsncat(TempPath, &Path[i], 1);
+ if(i != _tcslen(Path) - 1)
+ continue;
+ }
+ /* Handle the base part of the path different.
+ Because if you put it into findfirstfile, it will
+ return your current folder */
+ if(_tcslen(TempPath) == 2 && TempPath[1] == _T(':'))
+ {
+ _tcscat(OutPath, TempPath);
+ _tcscat(OutPath, _T("\\"));
+ _tcscat(TempPath, _T("\\"));
+ }
+ else
+ {
+ hFind = FindFirstFile(TempPath,&FindFileData);
+ if(hFind == INVALID_HANDLE_VALUE)
+ {
+ _tcscpy(OutPath, Path);
+ return;
+ }
+ _tcscat(TempPath, _T("\\"));
+ _tcscat(OutPath, FindFileData.cFileName);
+ _tcscat(OutPath, _T("\\"));
+ CloseHandle(hFind);
+ }
+ }
+}
+
+/*
+ * Check if Ctrl-Break was pressed during the last calls
+ */
+
+BOOL CheckCtrlBreak (INT mode)
+{
+ static BOOL bLeaveAll = FALSE; /* leave all batch files */
+ TCHAR c;
+
+ switch (mode)
+ {
+ case BREAK_OUTOFBATCH:
+ bLeaveAll = 0;
+ return FALSE;
+
+ case BREAK_BATCHFILE:
+ if (bLeaveAll)
+ return TRUE;
+
+ if (!bCtrlBreak)
+ return FALSE;
+
+ /* we need to be sure the string arrives on the screen! */
+ do
+ ConOutPuts (_T("\r\nCtrl-Break pressed. Cancel batch file? (Yes/No/All) "));
+ while (!_tcschr (_T("YNA\3"), c = _totupper (cgetchar())) || !c);
+
+ ConOutPuts (_T("\r\n"));
+
+ if (c == _T('N'))
+ return bCtrlBreak = FALSE; /* ignore */
+
+ /* leave all batch files */
+ bLeaveAll = ((c == _T('A')) || (c == _T('\3')));
+ break;
+
+ case BREAK_INPUT:
+ if (!bCtrlBreak)
+ return FALSE;
+ break;
+ }
+
+ /* state processed */
+ bCtrlBreak = FALSE;
+ return TRUE;
+}
+
+/* add new entry for new argument */
+BOOL add_entry (LPINT ac, LPTSTR **arg, LPCTSTR entry)
+{
+ LPTSTR q;
+ LPTSTR *oldarg;
+
+ q = malloc ((_tcslen(entry) + 1) * sizeof (TCHAR));
+ if (NULL == q)
+ {
+ return FALSE;
+ }
+ _tcscpy (q, entry);
+
+ oldarg = *arg;
+ *arg = realloc (oldarg, (*ac + 2) * sizeof (LPTSTR));
+ if (NULL == *arg)
+ {
+ *arg = oldarg;
+ return FALSE;
+ }
+
+ /* save new entry */
+ (*arg)[*ac] = q;
+ (*arg)[++(*ac)] = NULL;
+
+ return TRUE;
+}
+
+static BOOL expand (LPINT ac, LPTSTR **arg, LPCTSTR pattern)
+{
+ HANDLE hFind;
+ WIN32_FIND_DATA FindData;
+ BOOL ok;
+ LPCTSTR pathend;
+ LPTSTR dirpart, fullname;
+
+ pathend = _tcsrchr (pattern, _T('\\'));
+ if (NULL != pathend)
+ {
+ dirpart = malloc((pathend - pattern + 2) * sizeof(TCHAR));
+ if (NULL == dirpart)
+ {
+ return FALSE;
+ }
+ memcpy(dirpart, pattern, pathend - pattern + 1);
+ dirpart[pathend - pattern + 1] = _T('\0');
+ }
+ else
+ {
+ dirpart = NULL;
+ }
+ hFind = FindFirstFile (pattern, &FindData);
+ if (INVALID_HANDLE_VALUE != hFind)
+ {
+ do
+ {
+ if (NULL != dirpart)
+ {
+ fullname = malloc((_tcslen(dirpart) + _tcslen(FindData.cFileName) + 1) * sizeof(TCHAR));
+ if (NULL == fullname)
+ {
+ ok = FALSE;
+ }
+ else
+ {
+ _tcscat (_tcscpy (fullname, dirpart), FindData.cFileName);
+ ok = add_entry(ac, arg, fullname);
+ free (fullname);
+ }
+ }
+ else
+ {
+ ok = add_entry(ac, arg, FindData.cFileName);
+ }
+ } while (FindNextFile (hFind, &FindData) && ok);
+ FindClose (hFind);
+ }
+ else
+ {
+ ok = add_entry(ac, arg, pattern);
+ }
+
+ if (NULL != dirpart)
+ {
+ free (dirpart);
+ }
+
+ return ok;
+}
+
+/*
+ * split - splits a line up into separate arguments, deliminators
+ * are spaces and slashes ('/').
+ */
+
+LPTSTR *split (LPTSTR s, LPINT args, BOOL expand_wildcards)
+{
+ LPTSTR *arg;
+ LPTSTR start;
+ LPTSTR q;
+ INT ac;
+ INT len;
+ BOOL bQuoted = FALSE;
+
+ arg = malloc (sizeof (LPTSTR));
+ if (!arg)
+ return NULL;
+ *arg = NULL;
+
+ ac = 0;
+ while (*s)
+ {
+ /* skip leading spaces */
+ while (*s && (_istspace (*s) || _istcntrl (*s)))
+ ++s;
+
+ /* if quote (") then set bQuoted */
+ if (*s == _T('\"'))
+ {
+ ++s;
+ bQuoted = TRUE;
+ }
+
+ start = s;
+
+ /* the first character can be '/' */
+ if (*s == _T('/'))
+ ++s;
+
+ /* skip to next word delimiter or start of next option */
+ if (bQuoted)
+ {
+ while (_istprint (*s) && (*s != _T('\"')) && (*s != _T('/')))
+ ++s;
+ }
+ else
+ {
+ while (_istprint (*s) && !_istspace (*s) && (*s != _T('/')))
+ ++s;
+ }
+
+ /* a word was found */
+ if (s != start)
+ {
+ q = malloc (((len = s - start) + 1) * sizeof (TCHAR));
+ if (!q)
+ {
+ return NULL;
+ }
+ memcpy (q, start, len * sizeof (TCHAR));
+ q[len] = _T('\0');
+ if (expand_wildcards && _T('/') != *start &&
+ (NULL != _tcschr(q, _T('*')) || NULL != _tcschr(q, _T('?'))))
+ {
+ if (! expand(&ac, &arg, q))
+ {
+ free (q);
+ freep (arg);
+ return NULL;
+ }
+ }
+ else
+ {
+ if (! add_entry(&ac, &arg, q))
+ {
+ free (q);
+ freep (arg);
+ return NULL;
+ }
+ }
+ free (q);
+ }
+
+ /* adjust string pointer if quoted (") */
+ if (bQuoted)
+ {
+ /* Check to make sure if there is no ending "
+ * we dont run over the null char */
+ if(*s == _T('\0'))
+ {
+ break;
+ }
+ ++s;
+ bQuoted = FALSE;
+ }
+ }
+
+ *args = ac;
+
+ return arg;
+}
+
+
+/*
+ * freep -- frees memory used for a call to split
+ *
+ */
+VOID freep (LPTSTR *p)
+{
+ LPTSTR *q;
+
+ if (!p)
+ return;
+
+ q = p;
+ while (*q)
+ free(*q++);
+
+ free(p);
+}
+
+
+LPTSTR _stpcpy (LPTSTR dest, LPCTSTR src)
+{
+ _tcscpy (dest, src);
+ return (dest + _tcslen (src));
+}
+
+
+
+/*
+ * Checks if a path is valid (accessible)
+ */
+
+BOOL IsValidPathName (LPCTSTR pszPath)
+{
+ TCHAR szOldPath[MAX_PATH];
+ BOOL bResult;
+
+ GetCurrentDirectory (MAX_PATH, szOldPath);
+ bResult = SetCurrentDirectory (pszPath);
+
+ SetCurrentDirectory (szOldPath);
+
+ return bResult;
+}
+
+
+/*
+ * Checks if a file exists (accessible)
+ */
+
+BOOL IsExistingFile (LPCTSTR pszPath)
+{
+ DWORD attr = GetFileAttributes (pszPath);
+ return (attr != 0xFFFFFFFF && (! (attr & FILE_ATTRIBUTE_DIRECTORY)) );
+}
+
+
+BOOL IsExistingDirectory (LPCTSTR pszPath)
+{
+ DWORD attr = GetFileAttributes (pszPath);
+ return (attr != 0xFFFFFFFF && (attr & FILE_ATTRIBUTE_DIRECTORY) );
+}
+
+
+BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
+{
+ LPSTR lpString;
+ CHAR ch;
+ DWORD dwRead;
+ INT len;
+#ifdef _UNICODE
+ lpString = malloc(nBufferLength);
+#else
+ lpString = lpBuffer;
+#endif
+ len = 0;
+ while ((--nBufferLength > 0) &&
+ ReadFile(hFile, &ch, 1, &dwRead, NULL) && dwRead)
+ {
+ lpString[len++] = ch;
+ if ((ch == _T('\n')) || (ch == _T('\r')))
+ {
+ /* break at new line*/
+ break;
+ }
+ }
+
+ if (!dwRead && !len)
+ return FALSE;
+
+ lpString[len++] = _T('\0');
+#ifdef _UNICODE
+ MultiByteToWideChar(CP_ACP, 0, lpString, len, lpBuffer, len);
+ free(lpString);
+#endif
+ return TRUE;
+}
+
+INT PagePrompt (VOID)
+{
+ INPUT_RECORD ir;
+
+ ConOutResPuts(STRING_MISC_HELP1);
+
+ RemoveBreakHandler ();
+ ConInDisable ();
+
+ do
+ {
+ ConInKey (&ir);
+ }
+ while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
+ (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
+ (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
+
+ AddBreakHandler ();
+ ConInEnable ();
+
+ if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
+ ((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) &&
+ (ir.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))))
+ {
+ bCtrlBreak = TRUE;
+ return PROMPT_BREAK;
+ }
+
+ return PROMPT_YES;
+}
+
+
+INT FilePromptYN (LPTSTR szFormat, ...)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szOut[512];
+ va_list arg_ptr;
+// TCHAR cKey = 0;
+// LPTSTR szKeys = _T("yna");
+
+ TCHAR szIn[10];
+ LPTSTR p;
+
+ va_start (arg_ptr, szFormat);
+ _vstprintf (szOut, szFormat, arg_ptr);
+ va_end (arg_ptr);
+
+ ConOutPrintf (szFormat);
+
+ /* preliminary fix */
+ ConInString (szIn, 10);
+ ConOutPrintf (_T("\n"));
+
+ _tcsupr (szIn);
+ for (p = szIn; _istspace (*p); p++)
+ ;
+
+ LoadString(CMD_ModuleHandle, STRING_CHOICE_OPTION, szMsg, RC_STRING_MAX_SIZE);
+
+ if (_tcsncmp(p, &szMsg[0], 1) == 0)
+ return PROMPT_YES;
+ else if (_tcsncmp(p, &szMsg[1], 1) == 0)
+ return PROMPT_NO;
+#if 0
+ else if (*p == _T('\03'))
+ return PROMPT_BREAK;
+#endif
+
+ return PROMPT_NO;
+
+
+ /* unfinished sollution */
+#if 0
+ RemoveBreakHandler ();
+ ConInDisable ();
+
+ do
+ {
+ ConInKey (&ir);
+ cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar);
+ if (_tcschr (szKeys, cKey[0]) == NULL)
+ cKey = 0;
+
+
+ }
+ while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
+ (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
+ (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
+
+ AddBreakHandler ();
+ ConInEnable ();
+
+ if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
+ ((ir.Event.KeyEvent.wVirtualKeyCode == 'C') &&
+ (ir.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))))
+ return PROMPT_BREAK;
+
+ return PROMPT_YES;
+#endif
+}
+
+
+INT FilePromptYNA (LPTSTR szFormat, ...)
+{
+ TCHAR szMsg[RC_STRING_MAX_SIZE];
+ TCHAR szOut[512];
+ va_list arg_ptr;
+// TCHAR cKey = 0;
+// LPTSTR szKeys = _T("yna");
+
+ TCHAR szIn[10];
+ LPTSTR p;
+
+ va_start (arg_ptr, szFormat);
+ _vstprintf (szOut, szFormat, arg_ptr);
+ va_end (arg_ptr);
+
+ ConOutPrintf (szFormat);
+
+ /* preliminary fix */
+ ConInString (szIn, 10);
+ ConOutPrintf (_T("\n"));
+
+ _tcsupr (szIn);
+ for (p = szIn; _istspace (*p); p++)
+ ;
+
+ LoadString( CMD_ModuleHandle, STRING_COPY_OPTION, szMsg, RC_STRING_MAX_SIZE);
+
+ if (_tcsncmp(p, &szMsg[0], 1) == 0)
+ return PROMPT_YES;
+ else if (_tcsncmp(p, &szMsg[1], 1) == 0)
+ return PROMPT_NO;
+ else if (_tcsncmp(p, &szMsg[2], 1) == 0)
+ return PROMPT_ALL;
+
+#if 0
+ else if (*p == _T('\03'))
+ return PROMPT_BREAK;
+#endif
+
+ return PROMPT_NO;
+
+
+/* unfinished sollution */
+#if 0
+ RemoveBreakHandler ();
+ ConInDisable ();
+
+ do
+ {
+ ConInKey (&ir);
+ cKey = _totlower (ir.Event.KeyEvent.uChar.AsciiChar);
+ if (_tcschr (szKeys, cKey[0]) == NULL)
+ cKey = 0;
+ }
+ while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
+ (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
+ (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
+
+ AddBreakHandler ();
+ ConInEnable ();
+
+ if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
+ ((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) &&
+ (ir.Event.KeyEvent.dwControlKeyState & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED))))
+ return PROMPT_BREAK;
+
+ return PROMPT_YES;
+#endif
+}
+
+/* EOF */
diff --git a/reactos/base/shell/cmd/move.c b/reactos/base/shell/cmd/move.c
new file mode 100644
index 00000000000..fe3e942f81a
--- /dev/null
+++ b/reactos/base/shell/cmd/move.c
@@ -0,0 +1,556 @@
+/*
+* MOVE.C - move internal command.
+*
+*
+* History:
+*
+* 14-Dec-1998 (Eric Kohl