From 39458d7a85eed221e2f46f7171c608f161e7cd10 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Sat, 30 Apr 2005 11:53:15 +0000 Subject: [PATCH] Remove all hardcode string to En.rc svn path=/trunk/; revision=14868 --- reactos/subsys/system/cmd/En.rc | 19 ++++++++++++++++++- reactos/subsys/system/cmd/msgbox.c | 23 +++++++---------------- reactos/subsys/system/cmd/path.c | 19 ++++++++++++------- reactos/subsys/system/cmd/resource.h | 18 ++++++++++++------ 4 files changed, 49 insertions(+), 30 deletions(-) diff --git a/reactos/subsys/system/cmd/En.rc b/reactos/subsys/system/cmd/En.rc index 4759d3d90ee..d94b67b3d74 100644 --- a/reactos/subsys/system/cmd/En.rc +++ b/reactos/subsys/system/cmd/En.rc @@ -303,8 +303,23 @@ MOVE [/N][drive:][path]dirname1 dirname2\n\n \ /N Nothing. Don everthing but move files or direcories.\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 \ @@ -400,6 +415,8 @@ STRING_MOVE_ERROR2, "[Error]\n" STRING_PARAM_ERROR, "Required parameter missing\n" +STRING_PATH_ERROR "CMD: Not in environment 'PATH'\n" + 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" diff --git a/reactos/subsys/system/cmd/msgbox.c b/reactos/subsys/system/cmd/msgbox.c index ccf4555ca22..c25672e1d96 100644 --- a/reactos/subsys/system/cmd/msgbox.c +++ b/reactos/subsys/system/cmd/msgbox.c @@ -5,9 +5,13 @@ * * 25 Aug 1999 * started - Paolo Pantaleo + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_MSGBOX @@ -28,6 +32,7 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) //and to find window handle to pass to MessageBox HWND hWnd; TCHAR buff[128]; + WCHAR szMsg[RC_STRING_MAX_SIZE]; //these are MessabeBox() parameters LPTSTR title, prompt=""; @@ -39,22 +44,8 @@ INT CommandMsgbox (LPTSTR cmd, LPTSTR param) if (_tcsncmp (param, _T("/?"), 2) == 0) { - ConOutPuts(_T( - "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")); + LoadString( GetModuleHandle(NULL), STRING_MSGBOX_HELP, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts((LPTSTR)szMsg); return 0; } diff --git a/reactos/subsys/system/cmd/path.c b/reactos/subsys/system/cmd/path.c index 4f11d522754..5ba746b5404 100644 --- a/reactos/subsys/system/cmd/path.c +++ b/reactos/subsys/system/cmd/path.c @@ -21,8 +21,12 @@ * * 24-Jan-1999 (Eric Kohl ) * Fixed Win32 environment handling. + * + * 30-Apr-2005 (Magnus Olsen) ) + * Remove all hardcode string to En.rc */ #include "precomp.h" +#include "resource.h" #ifdef INCLUDE_CMD_PATH @@ -32,13 +36,13 @@ INT cmd_path (LPTSTR cmd, LPTSTR param) { + WCHAR szMsg[RC_STRING_MAX_SIZE]; + if (!_tcsncmp (param, _T("/?"), 2)) - { - ConOutPuts (_T("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")); + { + LoadString( GetModuleHandle(NULL), STRING_PATH_HELP1, (LPTSTR) szMsg,sizeof(szMsg)); + ConOutPuts ((LPTSTR)szMsg); + return 0; } @@ -52,7 +56,8 @@ INT cmd_path (LPTSTR cmd, LPTSTR param) dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE); if (dwBuffer == 0) { - ConErrPrintf (_T("CMD: Not in environment \"PATH\"\n")); + LoadString( GetModuleHandle(NULL), STRING_PATH_ERROR, (LPTSTR) szMsg,sizeof(szMsg)); + ConErrPrintf ((LPTSTR)szMsg); return 0; } else if (dwBuffer > ENV_BUFFER_SIZE) diff --git a/reactos/subsys/system/cmd/resource.h b/reactos/subsys/system/cmd/resource.h index a5419748c0e..90e12f2aabe 100644 --- a/reactos/subsys/system/cmd/resource.h +++ b/reactos/subsys/system/cmd/resource.h @@ -64,6 +64,8 @@ #define STRING_MOVE_ERROR1 342 #define STRING_MOVE_ERROR2 343 #define STRING_PARAM_ERROR 344 +#define STRING_PATH_ERROR 345 + #define STRING_ATTRIB_HELP 600 @@ -144,15 +146,19 @@ #define STRING_MOVE_HELP1 662 #define STRING_MOVE_HELP2 663 -#define STRING_PAUSE_HELP1 664 +#define STRING_MSGBOX_HELP 664 -#define STRING_PROMPT_HELP1 665 -#define STRING_PROMPT_HELP2 666 -#define STRING_PROMPT_HELP3 667 +#define STRING_PATH_HELP1 665 -#define STRING_RMDIR_HELP 668 +#define STRING_PAUSE_HELP1 666 -#define STRING_REM_HELP 669 +#define STRING_PROMPT_HELP1 667 +#define STRING_PROMPT_HELP2 668 +#define STRING_PROMPT_HELP3 669 + +#define STRING_RMDIR_HELP 670 + +#define STRING_REM_HELP 671