Author: hbelusca
Date: Wed Dec 31 21:22:49 2014
New Revision: 65924
URL:
http://svn.reactos.org/svn/reactos?rev=65924&view=rev
Log:
Maybe the last committed patch of year 2014!
[CMD]
Enhance the "ver" command, specifying the OS on which cmd.exe runs (that can be
different from ReactOS!) and the reported OS version when using the $V prompt format
specifier.
Patch by Lee Schroeder, with modifications by me, see the report for more details.
CORE-8970 #resolve #comment Committed in revision 65924, thanks!
Modified:
trunk/reactos/base/shell/cmd/cmd.c
trunk/reactos/base/shell/cmd/cmd.h
trunk/reactos/base/shell/cmd/lang/de-DE.rc
trunk/reactos/base/shell/cmd/lang/el-GR.rc
trunk/reactos/base/shell/cmd/lang/en-US.rc
trunk/reactos/base/shell/cmd/lang/es-ES.rc
trunk/reactos/base/shell/cmd/lang/fr-FR.rc
trunk/reactos/base/shell/cmd/lang/hu-HU.rc
trunk/reactos/base/shell/cmd/lang/id-ID.rc
trunk/reactos/base/shell/cmd/lang/it-IT.rc
trunk/reactos/base/shell/cmd/lang/ja-JP.rc
trunk/reactos/base/shell/cmd/lang/no-NO.rc
trunk/reactos/base/shell/cmd/lang/pl-PL.rc
trunk/reactos/base/shell/cmd/lang/ro-RO.rc
trunk/reactos/base/shell/cmd/lang/ru-RU.rc
trunk/reactos/base/shell/cmd/lang/sk-SK.rc
trunk/reactos/base/shell/cmd/lang/sq-AL.rc
trunk/reactos/base/shell/cmd/lang/sv-SE.rc
trunk/reactos/base/shell/cmd/lang/uk-UA.rc
trunk/reactos/base/shell/cmd/lang/zh-CN.rc
trunk/reactos/base/shell/cmd/prompt.c
trunk/reactos/base/shell/cmd/resource.h
trunk/reactos/base/shell/cmd/ver.c
Modified: trunk/reactos/base/shell/cmd/cmd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=6…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -163,7 +163,6 @@
BOOL bDisableBatchEcho = FALSE;
BOOL bDelayedExpansion = FALSE;
DWORD dwChildProcessId = 0;
-OSVERSIONINFO osvi;
HANDLE hIn;
HANDLE hOut;
LPTSTR lpOriginalEnvironment;
@@ -1622,9 +1621,8 @@
BOOL AlwaysStrip = FALSE;
BOOL AutoRun = TRUE;
- /* get version information */
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx (&osvi);
+ /* Get version information */
+ InitOSVersion();
/* 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
Modified: trunk/reactos/base/shell/cmd/cmd.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.h?rev=6…
==============================================================================
--- trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -65,7 +65,6 @@
extern INT nErrorLevel;
extern SHORT maxx;
extern SHORT maxy;
-extern OSVERSIONINFO osvi;
extern BOOL bUnicodeOutput;
@@ -472,7 +471,8 @@
/* Prototypes for VER.C */
-VOID ShortVersion (VOID);
+VOID InitOSVersion(VOID);
+VOID PrintOSVersion(VOID);
INT cmd_ver (LPTSTR);
Modified: trunk/reactos/base/shell/cmd/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/de-DE.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/de-DE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/de-DE.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -522,7 +522,8 @@
STRING_REPLACE_ERROR7 "Erweiterter Fehler 32\n"
STRING_REACTOS_VERSION "ReactOS Betriebssystem [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS-Befehlszeileninterpreter\nVersion %s %s"
- STRING_VERSION_RUNVER " läuft in %s"
+ STRING_VERSION_RUNNING_ON "Läuft in: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d Datei(en) kopiert\n"
STRING_DELETE_WIPE "sicher gelöscht"
STRING_FOR_ERROR "ungültige Variablenangabe."
Modified: trunk/reactos/base/shell/cmd/lang/el-GR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/el-GR.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/el-GR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/el-GR.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -527,7 +527,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Command Line Interpreter\nVersion %s %s"
- STRING_VERSION_RUNVER " running on %s"
+ STRING_VERSION_RUNNING_ON "Running on: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file(s) copied\n"
STRING_DELETE_WIPE "wiped"
STRING_FOR_ERROR "bad variable specification."
Modified: trunk/reactos/base/shell/cmd/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/en-US.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/en-US.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/en-US.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -523,7 +523,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Command Line Interpreter\nVersion %s %s"
- STRING_VERSION_RUNVER " running on %s"
+ STRING_VERSION_RUNNING_ON "Running on: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file(s) copied\n"
STRING_DELETE_WIPE "wiped"
STRING_FOR_ERROR "bad variable specification."
Modified: trunk/reactos/base/shell/cmd/lang/es-ES.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/es-ES.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/es-ES.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/es-ES.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -525,7 +525,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nIntérprete de comandos de ReactOS\nVersion %s %s"
- STRING_VERSION_RUNVER " corriendo en %s"
+ STRING_VERSION_RUNNING_ON "Corriendo en: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d archivo(s) copado(s)\n"
STRING_DELETE_WIPE "Limpiado"
STRING_FOR_ERROR "Especición de variable errónea."
Modified: trunk/reactos/base/shell/cmd/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/fr-FR.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/fr-FR.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/fr-FR.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -537,7 +537,8 @@
STRING_REPLACE_ERROR7 "Erreur étendue 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nInterpréteur de ligne de commandes ReactOS\nVersion %s
%s"
- STRING_VERSION_RUNVER " tournant sur %s"
+ STRING_VERSION_RUNNING_ON "Fonctionnant sous: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d fichier(s) copié(s)\n"
STRING_DELETE_WIPE "effacé(s)"
STRING_FOR_ERROR "mauvaise variable spécifiée."
Modified: trunk/reactos/base/shell/cmd/lang/hu-HU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/hu-HU.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/hu-HU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/hu-HU.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -507,7 +507,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Parancssor értelmezõ\nVersion %s %s"
- STRING_VERSION_RUNVER " running on %s"
+ STRING_VERSION_RUNNING_ON "Running on: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d állomány másolva\n"
STRING_DELETE_WIPE "wiped"
STRING_FOR_ERROR "Hibás változó."
Modified: trunk/reactos/base/shell/cmd/lang/id-ID.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/id-ID.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/id-ID.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/id-ID.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -522,7 +522,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nInterpreter Baris Perintah ReactOS\nVersion %s %s"
- STRING_VERSION_RUNVER " berjalan pada %s"
+ STRING_VERSION_RUNNING_ON "Berjalan pada: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file di-copy\n"
STRING_DELETE_WIPE "dihapus"
STRING_FOR_ERROR "spesifikasi variabel tidak baik."
Modified: trunk/reactos/base/shell/cmd/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/it-IT.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/it-IT.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -533,7 +533,8 @@
STRING_REPLACE_ERROR7 "Errore esteso 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nInterprete di linea di comando di ReactOS\nVersion %s
%s"
- STRING_VERSION_RUNVER " in esecuzione su %s"
+ STRING_VERSION_RUNNING_ON "In esecuzione su: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file copiati\n"
STRING_DELETE_WIPE "resi illeggibili"
STRING_FOR_ERROR "variabile non valida."
Modified: trunk/reactos/base/shell/cmd/lang/ja-JP.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/ja-JP.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/ja-JP.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/ja-JP.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -530,7 +530,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Command Line Interpreter\nVersion %s %s"
- STRING_VERSION_RUNVER " running on %s"
+ STRING_VERSION_RUNNING_ON "Running on: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d
åã®ãã¡ã¤ã«ãã³ãã¼ããã¾ãã\n"
STRING_DELETE_WIPE "å®å
¨ã«æ¶å»ããã¾ããã"
STRING_FOR_ERROR "ç¡å¹ãªå¤æ°ãæå®ããã¾ããã"
Modified: trunk/reactos/base/shell/cmd/lang/no-NO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/no-NO.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/no-NO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/no-NO.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -521,7 +521,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operativsystem [Versjon %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Kommandotolk\nVersjon %s %s"
- STRING_VERSION_RUNVER " kjører på %s"
+ STRING_VERSION_RUNNING_ON "Kjører på: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file(r) kopiert\n"
STRING_DELETE_WIPE "slettet"
STRING_FOR_ERROR "ugyldig variabel spesifikasjon."
Modified: trunk/reactos/base/shell/cmd/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/pl-PL.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/pl-PL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/pl-PL.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -527,7 +527,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32 - BÅÄ
d wspóÅdzielenia\n"
STRING_REACTOS_VERSION "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO "\nInterpreter linii poleceÅ ReactOS\nVersion %s %s"
- STRING_VERSION_RUNVER " dziaÅajÄ
cy na %s"
+ STRING_VERSION_RUNNING_ON "DziaÅajÄ
cy na: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d plik(ów) skopiowano\n"
STRING_DELETE_WIPE "skasowano"
STRING_FOR_ERROR "zÅe okreÅlenie zmiennej."
Modified: trunk/reactos/base/shell/cmd/lang/ro-RO.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/ro-RO.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/ro-RO.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/ro-RO.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -560,7 +560,8 @@
STRING_REPLACE_ERROR7 "Eroare ExtinsÄ 32\n"
STRING_REACTOS_VERSION "ReactOS [Versiunea %s-%s]\n"
STRING_CMD_SHELLINFO "\nInterpretorul de comenzi ReactOS\nVersiunea %s %s"
- STRING_VERSION_RUNVER " operând pe %s"
+ STRING_VERSION_RUNNING_ON "Operând pe: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d fiÈier(e) copiat(e)\n"
STRING_DELETE_WIPE "Èters"
STRING_FOR_ERROR "specificaÈie de variabilÄ eronatÄ."
Modified: trunk/reactos/base/shell/cmd/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/ru-RU.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/ru-RU.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/ru-RU.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -532,7 +532,8 @@
STRING_REPLACE_ERROR7 "РаÑÑиÑÐµÐ½Ð½Ð°Ñ Ð¾Ñибка 32\n"
STRING_REACTOS_VERSION "ÐпеÑаÑÐ¸Ð¾Ð½Ð½Ð°Ñ ÑиÑÑема ReactOS
[ÐеÑÑÐ¸Ñ %s-%s]\n"
STRING_CMD_SHELLINFO "\nÐнÑеÑпÑеÑаÑÐ¾Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð½Ð¾Ð¹
ÑÑÑоки ReactOS\nÐеÑÑÐ¸Ñ %s %s"
- STRING_VERSION_RUNVER " запÑÑен на %s"
+ STRING_VERSION_RUNNING_ON "ÐапÑÑен на: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d Ñайл(ов) ÑкопиÑовано\n"
STRING_DELETE_WIPE "оÑиÑено"
STRING_FOR_ERROR "непÑавилÑное задание
пеÑеменной."
Modified: trunk/reactos/base/shell/cmd/lang/sk-SK.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/sk-SK.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/sk-SK.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/sk-SK.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -529,7 +529,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "OperaÄný systém ReactOS [Verzia %s-%s]\n"
STRING_CMD_SHELLINFO "\nInterpréter prÃkazového riadku systému
ReactOS\nVerzia %s %s"
- STRING_VERSION_RUNVER " running on %s"
+ STRING_VERSION_RUNNING_ON "Running on: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d súbor(ov) skopÃrovaný(ch)\n"
STRING_DELETE_WIPE "wiped"
STRING_FOR_ERROR "bad variable specification."
Modified: trunk/reactos/base/shell/cmd/lang/sq-AL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/sq-AL.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/sq-AL.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/sq-AL.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -527,7 +527,8 @@
STRING_REPLACE_ERROR7 "Error i zgjatur 32\n"
STRING_REACTOS_VERSION "Sistemi Operativ ReactOS [Versioni %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Interpretuesi i komandave\nVersioni %s %s"
- STRING_VERSION_RUNVER " funksionon në %s"
+ STRING_VERSION_RUNNING_ON "Funksionon në: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file(s) copied\n"
STRING_DELETE_WIPE "spastruar"
STRING_FOR_ERROR "specifikimi i varibleve i keq."
Modified: trunk/reactos/base/shell/cmd/lang/sv-SE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/sv-SE.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/sv-SE.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/sv-SE.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -521,7 +521,8 @@
STRING_REPLACE_ERROR7 "Extended Error 32\n"
STRING_REACTOS_VERSION "ReactOS Operativsystem [Versjon %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS Kommandotolk\nVersjon %s %s"
- STRING_VERSION_RUNVER " körs på %s"
+ STRING_VERSION_RUNNING_ON "Körs på: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d file(r) kopiert\n"
STRING_DELETE_WIPE "slettet"
STRING_FOR_ERROR "ugyldig variabel spesifikasjon."
Modified: trunk/reactos/base/shell/cmd/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/uk-UA.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/uk-UA.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/uk-UA.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -533,7 +533,8 @@
STRING_REPLACE_ERROR7 "РозÑиÑена помилка 32\n"
STRING_REACTOS_VERSION "ÐпеÑаÑiйна СиÑÑема ReactOS [ÐеÑÑiÑ
%s-%s]\n"
STRING_CMD_SHELLINFO "\nIнÑеÑпÑеÑаÑÐ¾Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð½Ð¾Ð³Ð¾
ÑÑдка ReactOS\nVersion %s %s"
- STRING_VERSION_RUNVER " запÑÑений на %s"
+ STRING_VERSION_RUNNING_ON "ÐапÑÑений на: "
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d Ñайл(iв) Ñкопiйовано\n"
STRING_DELETE_WIPE "виÑеÑÑо"
STRING_FOR_ERROR "невiÑна ÑпеÑиÑiкаÑiÑ Ð·Ð¼iнноÑ."
Modified: trunk/reactos/base/shell/cmd/lang/zh-CN.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/lang/zh-CN.…
==============================================================================
--- trunk/reactos/base/shell/cmd/lang/zh-CN.rc [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/lang/zh-CN.rc [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -492,7 +492,8 @@
STRING_REPLACE_ERROR7 "æ©å±é误 32\n"
STRING_REACTOS_VERSION "ReactOS æä½ç³»ç» [çæ¬ %s-%s]\n"
STRING_CMD_SHELLINFO "\nReactOS å½ä»¤è¡è§£éå¨\nçæ¬ %s %s"
- STRING_VERSION_RUNVER " å¨ %s ä¸è¿è¡"
+ STRING_VERSION_RUNNING_ON "å¨ ä¸è¿è¡"
+ STRING_VERSION_RUNVER "%s [Version %d.%d.%d] %s"
STRING_COPY_FILE " %d 个æ件已å¤å¶\n"
STRING_DELETE_WIPE "å·²æ¦é¤"
STRING_FOR_ERROR "æ æçåéæå®ã"
Modified: trunk/reactos/base/shell/cmd/prompt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/prompt.c?re…
==============================================================================
--- trunk/reactos/base/shell/cmd/prompt.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/prompt.c [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -198,22 +198,7 @@
break;
case _T('V'):
- switch (osvi.dwPlatformId)
- {
- case VER_PLATFORM_WIN32_WINDOWS:
- if (osvi.dwMajorVersion == 4 &&
- osvi.dwMinorVersion == 1)
- ConOutPrintf(_T("Windows 98"));
- else
- ConOutPrintf(_T("Windows 95"));
- break;
-
-
- case VER_PLATFORM_WIN32_NT:
- ConOutPrintf(_T("Windows NT Version %lu.%lu"),
- osvi.dwMajorVersion, osvi.dwMinorVersion);
- break;
- }
+ PrintOSVersion();
break;
case _T('_'):
Modified: trunk/reactos/base/shell/cmd/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/resource.h?…
==============================================================================
--- trunk/reactos/base/shell/cmd/resource.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/resource.h [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -196,14 +196,15 @@
#define STRING_VERIFY_HELP2 696
#define STRING_VERIFY_HELP3 697
-#define STRING_VERSION_HELP1 698
-#define STRING_VERSION_HELP2 699
-#define STRING_VERSION_HELP3 700
-#define STRING_VERSION_HELP4 701
-#define STRING_VERSION_HELP5 702
-#define STRING_VERSION_HELP6 703
-#define STRING_VERSION_HELP7 704
-#define STRING_VERSION_RUNVER 705
+#define STRING_VERSION_HELP1 698
+#define STRING_VERSION_HELP2 699
+#define STRING_VERSION_HELP3 700
+#define STRING_VERSION_HELP4 701
+#define STRING_VERSION_HELP5 702
+#define STRING_VERSION_HELP6 703
+#define STRING_VERSION_HELP7 704
+#define STRING_VERSION_RUNNING_ON 705
+#define STRING_VERSION_RUNVER 706
#define STRING_VOL_HELP1 706
#define STRING_VOL_HELP2 707
Modified: trunk/reactos/base/shell/cmd/ver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/ver.c?rev=6…
==============================================================================
--- trunk/reactos/base/shell/cmd/ver.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/ver.c [iso-8859-1] Wed Dec 31 21:22:49 2014
@@ -25,30 +25,98 @@
#include <reactos/buildno.h>
#include <reactos/version.h>
-VOID ShortVersion (VOID)
+OSVERSIONINFO osvi;
+TCHAR szOSName[50] = _T("");
+
+
+VOID InitOSVersion(VOID)
{
- OSVERSIONINFO VersionInfo;
-
- ConOutResPrintf(STRING_CMD_SHELLINFO, _T(KERNEL_RELEASE_STR),
_T(KERNEL_VERSION_BUILD_STR));
- VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- memset(VersionInfo.szCSDVersion, 0, sizeof(VersionInfo.szCSDVersion));
- if (GetVersionEx(&VersionInfo))
- {
- LPTSTR RosVersion;
- SIZE_T RosVersionLen;
-
- RosVersion = VersionInfo.szCSDVersion + _tcslen(VersionInfo.szCSDVersion) + 1;
- RosVersionLen = sizeof(VersionInfo.szCSDVersion) /
sizeof(VersionInfo.szCSDVersion[0]) -
- (RosVersion - VersionInfo.szCSDVersion);
- if (7 <= RosVersionLen && 0 == _tcsnicmp(RosVersion,
_T("ReactOS"), 7))
+ LONG lResult;
+ HKEY hKey;
+
+ /* Get version information */
+ ZeroMemory(&osvi, sizeof(osvi));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+ GetVersionEx(&osvi);
+
+ /* Build OS version string */
+
+ /* Open registry key */
+ lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ _T("SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion"),
+ 0,
+ KEY_QUERY_VALUE,
+ &hKey);
+ if (lResult == ERROR_SUCCESS)
+ {
+ DWORD dwSize, dwType;
+
+ /* Retrieve the ProductName value */
+ dwSize = sizeof(szOSName);
+ lResult = RegQueryValueEx(hKey,
+ _T("ProductName"),
+ NULL,
+ &dwType,
+ (LPBYTE)szOSName,
+ &dwSize);
+
+ /* If we have failed or the data type is unsupported... */
+ if (lResult != ERROR_SUCCESS || dwType != REG_SZ)
{
- ConOutResPrintf(STRING_VERSION_RUNVER, RosVersion);
+ /* ... reserve size for one NULL character only! */
+ dwSize = sizeof(TCHAR);
+
+ /* Set an error code (anything != ERROR_SUCCESS) */
+ lResult = ERROR_INVALID_PARAMETER;
}
- }
- ConOutChar(_T('\n'));
+
+ /* NULL-terminate the string */
+ szOSName[(dwSize / sizeof(TCHAR)) - 1] = _T('\0');
+
+ /* Close the key */
+ RegCloseKey(hKey);
+ }
+
+ /*
+ * If the registry key somehow doesn't exist or cannot be loaded, then
+ * determine at least whether the version of Windows is either 9x or NT.
+ */
+ if (lResult != ERROR_SUCCESS)
+ {
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_WINDOWS:
+ {
+ if (osvi.dwMajorVersion == 4)
+ {
+ if (osvi.dwMinorVersion == 0)
+ _tcscpy(szOSName, _T("Windows 95"));
+ else if (osvi.dwMinorVersion == 1)
+ _tcscpy(szOSName, _T("Windows 98"));
+ else if (osvi.dwMinorVersion == 9)
+ _tcscpy(szOSName, _T("Windows ME"));
+ else
+ _tcscpy(szOSName, _T("Windows 9x"));
+ }
+ break;
+ }
+
+ case VER_PLATFORM_WIN32_NT:
+ {
+ _tcscpy(szOSName, _T("Windows NT"));
+ break;
+ }
+ }
+ }
}
+/* Print the current OS version, suitable for VER command and PROMPT $V format */
+VOID PrintOSVersion(VOID)
+{
+ ConOutResPrintf(STRING_VERSION_RUNVER, szOSName,
+ osvi.dwMajorVersion, osvi.dwMinorVersion,
+ osvi.dwBuildNumber, osvi.szCSDVersion);
+}
#ifdef INCLUDE_CMD_VER
@@ -61,48 +129,52 @@
nErrorLevel = 0;
- if (_tcsstr (param, _T("/?")) != NULL)
+ if (_tcsstr(param, _T("/?")) != NULL)
{
ConOutResPaging(TRUE,STRING_VERSION_HELP1);
return 0;
}
- ShortVersion();
+ ConOutResPrintf(STRING_CMD_SHELLINFO, _T(KERNEL_RELEASE_STR),
_T(KERNEL_VERSION_BUILD_STR));
+ ConOutChar(_T('\n'));
+ ConOutResPuts(STRING_VERSION_RUNNING_ON);
+ PrintOSVersion();
/* Basic copyright notice */
if (param[0] != _T('\0'))
{
+ ConOutPuts(_T("\n\n"));
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++)
{
- /* skip spaces */
+ /* Skip spaces */
if (param[i] == _T(' '))
continue;
if (param[i] == _T('/'))
{
- /* is this a lone '/' ? */
+ /* Is this a lone '/' ? */
if (param[i + 1] == 0)
{
- error_invalid_switch (_T(' '));
+ error_invalid_switch(_T(' '));
return 1;
}
continue;
}
- if (_totupper (param[i]) == _T('W'))
+ if (_totupper(param[i]) == _T('W'))
{
/* Warranty notice */
ConOutResPuts(STRING_VERSION_HELP3);
}
- else if (_totupper (param[i]) == _T('R'))
+ else if (_totupper(param[i]) == _T('R'))
{
/* Redistribution notice */
ConOutResPuts(STRING_VERSION_HELP4);
}
- else if (_totupper (param[i]) == _T('C'))
+ else if (_totupper(param[i]) == _T('C'))
{
/* Developer listing */
ConOutResPuts(STRING_VERSION_HELP6);
@@ -112,12 +184,17 @@
}
else
{
- error_invalid_switch ((TCHAR)_totupper (param[i]));
+ error_invalid_switch(_totupper(param[i]));
return 1;
}
}
+
+ /* Bug report notice */
ConOutResPuts(STRING_VERSION_HELP5);
}
+
+ ConOutChar(_T('\n'));
+
return 0;
}