HMODULE NtDllModule;
TCHAR commandline[CMDLINE_LENGTH];
TCHAR ModuleName[_MAX_PATH + 1];
- TCHAR lpBuffer[2];
INT nExitCode;
//INT len;
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"));
+ /* Initialize prompt support */
+ InitPrompt();
#ifdef FEATURE_DIR_STACK
/* initialize directory stack */
- InitDirectoryStack ();
+ InitDirectoryStack();
#endif
#ifdef FEATURE_HISTORY
if (!*ptr)
{
/* If neither /C or /K was given, display a simple version string */
+ ConOutChar(_T('\n'));
ConOutResPrintf(STRING_REACTOS_VERSION,
_T(KERNEL_RELEASE_STR),
_T(KERNEL_VERSION_BUILD_STR));
/* Prototypes from PROMPT.C */
+VOID InitPrompt (VOID);
VOID PrintPrompt (VOID);
INT cmd_prompt (LPTSTR);
$F ) (Klammer zu)\n\
$G > (Größer-als-Zeichen)\n\
$H Rückschritt (löscht vorangehendes Zeichen)\n\
+ $I Information line\n\
$L < (Kleiner-als-Zeichen)\n\
$N Aktuelles Laufwerk\n\
$P Aktuelles Laufwerk und Pfad\n\
$Q = (Gleichheitszeichen)\n\
+ $S (space)\n\
$T Aktuelle Zeit\n\
$V Betriebssystem-Versionsnummer\n\
$_ Wagenrücklauf und Zeilenvorschub\n\
$F ) (Right parenthesis)\n\
$G > (greater-than sign)\n\
$H Backspace (erases previous character)\n\
+ $I Information line\n\
$L < (less-than sign)\n\
$N Current drive\n\
$P Current drive and path\n\
$Q = (equal sign)\n\
+ $S (space)\n\
$T Current time\n\
$V OS version number\n\
$_ Carriage return and linefeed\n\
$F ) (Right parenthesis)\n\
$G > (greater-than sign)\n\
$H Backspace (erases previous character)\n\
+ $I Information line\n\
$L < (less-than sign)\n\
$N Current drive\n\
$P Current drive and path\n\
$Q = (equal sign)\n\
+ $S (space)\n\
$T Current time\n\
$V OS version number\n\
$_ Carriage return and linefeed\n\
$F ) (Paréntesis derecho)\n\
$G > (Signo mayor que)\n\
$H Borra el caracter anterior\n\
+ $I Information line\n\
$L < (Signo menor que)\n\
$N Unidad actual\n\
$P Unidad y ruta actuales\n\
$Q = (signo igual)\n\
+ $S (space)\n\
$T Hora actual\n\
$V Número de versión del SO\n\
$_ Salto de linea\n\
$F ) (parenthèse fermante)\n\
$G > (signe supérieur à)\n\
$H Backspace (efface le caractère précédent)\n\
+ $I Ligne d'information\n\
$L < (signe inférieur à)\n\
$N Lecteur courant\n\
$P Lecteur et chemin courants\n\
$Q = (signe égale)\n\
+ $S (espace)\n\
$T Heure courante\n\
$V Numéro de version de ReactOS\n\
$_ Retour chariot/saut de ligne\n\
STRING_REPLACE_ERROR7, "Erreur étendue 32\n"
STRING_REACTOS_VERSION, "ReactOS Operating System [Version %s-%s]\n"
-STRING_CMD_SHELLINFO, "\n Interpréteur de ligne de commandes ReactOS\nVersion %s %s"
+STRING_CMD_SHELLINFO, "\nInterpréteur de ligne de commandes ReactOS\nVersion %s %s"
STRING_VERSION_RUNVER, " tournant sur %s"
STRING_COPY_FILE, " %d fichier(s) copié(s)\n"
STRING_DELETE_WIPE, "effacé(s)"
$F ) (záró zárójel)\n\
$G > ('nagyobb' jel)\n\
$H Törlés (elötte lévõ karaktert törli)\n\
+ $I Information line\n\
$L < ('kissebb' jel)\n\
$N Aktuális meghajtó\n\
$P Aktuális meghajtó és mappa\n\
$Q = (egyenlõség jel)\n\
+ $S (space)\n\
$T Aktuális idõ\n\
$V OS verziószám\n\
$_ Újsor\n\
$F ) (Tanda kurung Kanan)\n\
$G > (Tanda lebih-dari)\n\
$H Backspace (menghapus karakter sebelumnya)\n\
+ $I Information line\n\
$L < (tanda kurang-dari)\n\
$N Drive saat ini\n\
$P Drive dan path saat ini\n\
$Q = (tanda sama dengan)\n\
+ $S (space)\n\
$T Jam saat ini\n\
$V Nomor versi OS\n\
$_ Carriage return dan linefeed\n\
$F ) (parentesi destra)\n\
$G > (simbolo di maggiore di)\n\
$H Backspace (cancella il carattere precedente)\n\
+ $I Information line\n\
$L < (simbolo di minore di)\n\
$N Disco corrente\n\
$P Disco e percorso corrente\n\
$Q = (simbolo di uguale)\n\
+ $S (space)\n\
$T Ora attuale\n\
$V Versione del sistema operativo\n\
$_ CR LF (a capo)\n\
$F ) (右かっこ)\n\
$G > (不等号 (大なり))\n\
$H バックスペース (直前の文字を削除します)\n\
+ $I Information line\n\
$L < (不等号 (小なり))\n\
$N 現在のドライブ\n\
$P 現在のドライブとパス\n\
$Q = (等号)\n\
+ $S (space)\n\
$T 現在の時刻\n\
$V OS のバージョン番号\n\
$_ キャリッジ リターンとラインフィード\n\
$F ) (Høyreparentes)\n\
$G > (større-enn symbol)\n\
$H Tilbake (sletter forrige tegn)\n\
+ $I Information line\n\
$L < (mindre-enn symbol)\n\
$N Gjeldende stasjon\n\
$P Gjeldende stasjon og mappe\n\
$Q = (likhetstegn)\n\
+ $S (space)\n\
$T Gjeldende klokkeslett\n\
$V Versjonsnummer for ReactOS\n\
$_ Retur og linjeskift\n\
$F ) (prawy nawias)\n\
$G > (znak większości)\n\
$H (usuwa ostatni znak)\n\
+ $I Information line\n\
$L < (znak mniejszości)\n\
$N Bieżący napęd\n\
$P Bieżący napęd i ścieżka\n\
$Q = (znak równości)\n\
+ $S (space)\n\
$T Bieżący czas\n\
$V Wersja systemu\n\
$_ Znak CR/LF\n\
$F ) (paranteză dreapta)\n\
$G > (semnul mai mare decât)\n\
$H Backspace (ștergerea caracterului precedent)\n\
+ $I Information line\n\
$L < (semnul mai mic decât)\n\
$N Unitatea de stocare curentă\n\
$P Unitatea de stocare și calea curentă\n\
$Q = (semnul egal)\n\
+ $S (space)\n\
$T Ora curentă\n\
$V Numărul versiunii SO\n\
$_ Sfârșit de linie și rând nou\n\
$F ) (правая круглая скобка)\n\
$G > (знак ""больше"")\n\
$H BACKSPACE (удаление предыдущего символа)\n\
+ $I Information line\n\
$L < (знак ""меньше"")\n\
$N Текущий диск\n\
$P Текущие диск и каталог\n\
$Q = (знак равенства)\n\
+ $S (space)\n\
$T Текущее время\n\
$V Номер версии операционной системы\n\
$_ Перевод строки\n\
$F ) (Pravá okrúhla zátvorka)\n\
$G > (greater-than sign)\n\
$H Backspace (erases previous character)\n\
+ $I Information line\n\
$L < (less-than sign)\n\
$N Current drive\n\
$P Current drive and path\n\
$Q = (equal sign)\n\
+ $S (space)\n\
$T Aktuálny čas\n\
$V Číslo verzie OS\n\
$_ Carriage return and linefeed\n\
$F ) (Høyreparentes)\n\
$G > (større-enn symbol)\n\
$H Tilbake (sletter forrige tegn)\n\
+ $I Information line\n\
$L < (mindre-enn symbol)\n\
$N aktuell enhet\n\
$P aktuell enhet och mapp\n\
$Q = (likhetstegn)\n\
+ $S (space)\n\
$T aktuell klokkeslett\n\
$V Versjonsnummer for ReactOS\n\
$_ Retur och linjeskift\n\
$F ) (Права кругла дужка)\n\
$G > (знак більше)\n\
$H Backspace (видалення попередьного символу)\n\
+ $I Information line\n\
$L < (знак меньше)\n\
$N Поточний диск\n\
$P Поточний диск та каталог\n\
$Q = (знак рiвностi)\n\
+ $S (space)\n\
$T Поточний час\n\
$V Номер версiї операцiйної системи\n\
$_ Повернення каретки та переведення рядка\n\
$F ) (右括号)\n\
$G > (大于号)\n\
$H 退格 (擦除前一个字符)\n\
+ $I Information line\n\
$L < (小于号)\n\
$N 当前驱动器\n\
$P 当前驱动器和路径\n\
$Q = (等于号)\n\
+ $S (space)\n\
$T 当前时间\n\
$V 操作系统版本号\n\
$_ 回车和换行符\n\
*/
#include "precomp.h"
+// FIXME: Localize the information line.
+static TCHAR InfoLine[] = _T(" ReactOS Command Prompt Type HELP = Help ");
+
+/* The default prompt */
+static TCHAR DefaultPrompt[] = _T("$I$P$G");
+
+
+/*
+ * Initialize prompt support
+ */
+VOID InitPrompt(VOID)
+{
+ TCHAR Buffer[2];
+
+ /*
+ * Set the PROMPT environment variable if it doesn't exist already.
+ * You can change the PROMPT environment variable before cmd start.
+ */
+ if (GetEnvironmentVariable(_T("PROMPT"), Buffer, sizeof(Buffer) / sizeof(Buffer[0])) == 0)
+ SetEnvironmentVariable(_T("PROMPT"), DefaultPrompt);
+}
+
+/*
+ * Print an information line on top of the screen
+ */
+VOID PrintInfoLine(VOID)
+{
+#define FOREGROUND_WHITE (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
+
+ HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ COORD coPos;
+ DWORD dwWritten;
+
+ if (!GetConsoleScreenBufferInfo(hOutput, &csbi))
+ {
+ /* No console */
+ return;
+ }
+
+ coPos.X = 0;
+ coPos.Y = 0;
+ FillConsoleOutputAttribute(hOutput, BACKGROUND_BLUE | FOREGROUND_WHITE,
+ csbi.dwSize.X,
+ coPos, &dwWritten);
+ FillConsoleOutputCharacter(hOutput, _T(' '),
+ csbi.dwSize.X,
+ coPos, &dwWritten);
+
+ WriteConsoleOutputCharacter(hOutput, InfoLine,
+ sizeof(InfoLine)/sizeof(TCHAR) - 1,
+ coPos, &dwWritten);
+}
+
/*
- * print the command-line prompt
+ * Print the command-line prompt
*/
VOID PrintPrompt(VOID)
{
- static TCHAR default_pr[] = _T("$P$G");
TCHAR szPrompt[256];
LPTSTR pr;
if (GetEnvironmentVariable(_T("PROMPT"), szPrompt, 256))
pr = szPrompt;
else
- pr = default_pr;
+ pr = DefaultPrompt;
while (*pr)
{
ConOutChar(_T('\x08'));
break;
+ case _T('I'):
+ PrintInfoLine();
+ break;
+
case _T('L'):
ConOutChar(_T('<'));
break;
#ifdef INCLUDE_CMD_PROMPT
-INT cmd_prompt (LPTSTR param)
+INT cmd_prompt(LPTSTR param)
{
- if (!_tcsncmp (param, _T("/?"), 2))
+ if (!_tcsncmp(param, _T("/?"), 2))
{
- ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
+ ConOutResPaging(TRUE, STRING_PROMPT_HELP1);
#ifdef FEATURE_DIRECTORY_STACK
- ConOutResPaging(FALSE,STRING_PROMPT_HELP2);
+ ConOutResPaging(FALSE, STRING_PROMPT_HELP2);
#endif
- ConOutResPaging(FALSE,STRING_PROMPT_HELP3);
+ ConOutResPaging(FALSE, STRING_PROMPT_HELP3);
return 0;
}
/*
- * if it is null, then it needs to set to default,
+ * If 'param' is NULL, then we need to set it to default,
* because that means the user entered "prompt" only.
- * so even if param is null you _must_ still set prompt
- * to the default. There seems to be some kinda difference
+ * So even if 'param' is null you _must_ still set prompt
+ * to the default. There seems to be some kind of difference
* between winxp and 2k in this matter and this way will
* cover both. Do not use fixed size of szParam for param the buffer
- * are 8192 bytes and will later change to dymatic buffer.
+ * are 8192 bytes and will later change to dynamic buffer.
*/
- /* set PROMPT environment variable */
- if (param[0] != _T('\0'))
- {
- if (!SetEnvironmentVariable (_T("PROMPT"), param))
- return 1;
- }
- else
+ /* Set the PROMPT environment variable */
+ if (!SetEnvironmentVariable(_T("PROMPT"),
+ (param[0] != _T('\0') ? param : DefaultPrompt)))
{
- TCHAR szParam[5];
- _tcscpy(szParam,_T("$P$G"));
- if (!SetEnvironmentVariable (_T("PROMPT"),szParam))
return 1;
}
/* Basic copyright notice */
if (param[0] != _T('\0'))
{
- ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others."));
- ConOutPuts (_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team"));
+ ConOutPuts(_T("Copyright (C) 1994-1998 Tim Norman and others.\n"));
+ ConOutPuts(_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team\n"));
for (i = 0; param[i]; i++)
{