implement VOID ConOutResPuts (UINT resID), VOID ConErrResPuts (UINT resID) to outpust msg from rc files it take less memmory now, and it is bit faster
CMD_ModuleHandle contain GetModuleHandle and it is only execute in main() in cmd it optimze for lite more speed in cmd
Langues changes in En.rc follow new strings have been add and can be translate STRING_ERROR_WRONG_DATE STRING_SET_ERROR Modified: trunk/reactos/subsys/system/cmd/En.rc Modified: trunk/reactos/subsys/system/cmd/alias.c Modified: trunk/reactos/subsys/system/cmd/attrib.c Modified: trunk/reactos/subsys/system/cmd/batch.c Modified: trunk/reactos/subsys/system/cmd/beep.c Modified: trunk/reactos/subsys/system/cmd/call.c Modified: trunk/reactos/subsys/system/cmd/chcp.c Modified: trunk/reactos/subsys/system/cmd/choice.c Modified: trunk/reactos/subsys/system/cmd/cls.c Modified: trunk/reactos/subsys/system/cmd/cmd.c Modified: trunk/reactos/subsys/system/cmd/cmd.h Modified: trunk/reactos/subsys/system/cmd/color.c Modified: trunk/reactos/subsys/system/cmd/console.c Modified: trunk/reactos/subsys/system/cmd/copy.c Modified: trunk/reactos/subsys/system/cmd/date.c Modified: trunk/reactos/subsys/system/cmd/del.c Modified: trunk/reactos/subsys/system/cmd/delay.c Modified: trunk/reactos/subsys/system/cmd/dir.c Modified: trunk/reactos/subsys/system/cmd/dirstack.c Modified: trunk/reactos/subsys/system/cmd/echo.c Modified: trunk/reactos/subsys/system/cmd/error.c Modified: trunk/reactos/subsys/system/cmd/for.c Modified: trunk/reactos/subsys/system/cmd/free.c Modified: trunk/reactos/subsys/system/cmd/goto.c Modified: trunk/reactos/subsys/system/cmd/if.c Modified: trunk/reactos/subsys/system/cmd/internal.c Modified: trunk/reactos/subsys/system/cmd/label.c Modified: trunk/reactos/subsys/system/cmd/locale.c Modified: trunk/reactos/subsys/system/cmd/memory.c Modified: trunk/reactos/subsys/system/cmd/misc.c Modified: trunk/reactos/subsys/system/cmd/move.c Modified: trunk/reactos/subsys/system/cmd/msgbox.c Modified: trunk/reactos/subsys/system/cmd/path.c Modified: trunk/reactos/subsys/system/cmd/pause.c Modified: trunk/reactos/subsys/system/cmd/prompt.c Modified: trunk/reactos/subsys/system/cmd/ren.c Modified: trunk/reactos/subsys/system/cmd/resource.h Modified: trunk/reactos/subsys/system/cmd/screen.c Modified: trunk/reactos/subsys/system/cmd/set.c Modified: trunk/reactos/subsys/system/cmd/shift.c Modified: trunk/reactos/subsys/system/cmd/start.c Modified: trunk/reactos/subsys/system/cmd/time.c Modified: trunk/reactos/subsys/system/cmd/timer.c Modified: trunk/reactos/subsys/system/cmd/title.c Modified: trunk/reactos/subsys/system/cmd/type.c Modified: trunk/reactos/subsys/system/cmd/ver.c Modified: trunk/reactos/subsys/system/cmd/verify.c Modified: trunk/reactos/subsys/system/cmd/vol.c Modified: trunk/reactos/subsys/system/cmd/window.c _____
Modified: trunk/reactos/subsys/system/cmd/En.rc --- trunk/reactos/subsys/system/cmd/En.rc 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/En.rc 2005-05-07 15:31:07 UTC (rev 15081) @@ -559,5 +559,8 @@
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_ERROR_DRIVER_NOT_READY, "Drive not ready" + +STRING_ERROR_WRONG_DATE, "Invalid date." +STRING_SET_ERROR "CMD: Not in environment '%s'\n" } _____
Modified: trunk/reactos/subsys/system/cmd/alias.c --- trunk/reactos/subsys/system/cmd/alias.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/alias.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -236,8 +236,7 @@
/* specified routines */ VOID ExpandAlias (LPTSTR cmd, INT maxlen) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ unsigned n = 0, m, i, @@ -280,9 +279,8 @@ { m = _tcslen (ptr->lpSubst); if ((int)(_tcslen (cmd) - len + m - n) > maxlen) - { - LoadString(GetModuleHandle(NULL), STRING_ALIAS_ERROR, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf(szMsg); + { + ConErrResPuts(STRING_ALIAS_ERROR);
/* the parser won't cause any problems with an empty line */ cmd[0] = _T('\0'); @@ -305,14 +303,12 @@
INT CommandAlias (LPTSTR cmd, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ LPTSTR ptr;
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_ALIAS_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_ALIAS_HELP); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/attrib.c --- trunk/reactos/subsys/system/cmd/attrib.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/attrib.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -188,8 +188,7 @@
INT CommandAttrib (LPTSTR cmd, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ LPTSTR *arg; INT argc, i; TCHAR szPath[MAX_PATH]; @@ -205,9 +204,8 @@
/* print help */ if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_ATTRIB_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_ATTRIB_HELP); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/batch.c --- trunk/reactos/subsys/system/cmd/batch.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/batch.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -216,8 +216,7 @@
*/
BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ HANDLE hFile;
hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_READ, NULL, @@ -230,9 +229,8 @@ #endif
if (hFile == INVALID_HANDLE_VALUE) - { - LoadString(GetModuleHandle(NULL), STRING_BATCH_ERROR, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf(szMsg); + { + ConErrResPuts(STRING_BATCH_ERROR); return FALSE; }
_____
Modified: trunk/reactos/subsys/system/cmd/beep.c --- trunk/reactos/subsys/system/cmd/beep.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/beep.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -32,12 +32,9 @@
INT cmd_beep (LPTSTR cmd, LPTSTR param) { - TCHAR szMsg[RC_STRING_MAX_SIZE]; - if (_tcsncmp (param, _T("/?"), 2) == 0) - { - LoadString(GetModuleHandle(NULL), STRING_BEEP_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_BEEP_HELP); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/call.c --- trunk/reactos/subsys/system/cmd/call.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/call.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -42,17 +42,15 @@
*/
INT cmd_call (LPTSTR cmd, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ LPBATCH_CONTEXT n = NULL;
#ifdef _DEBUG DebugPrintf (_T("cmd_call: ('%s','%s')\n"), cmd, param); #endif if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_CALL_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_CALL_HELP); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/chcp.c --- trunk/reactos/subsys/system/cmd/chcp.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/chcp.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -28,9 +28,8 @@
/* print help */ if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_CHCP_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_CHCP_HELP); return 0; }
@@ -40,7 +39,7 @@ if (args == 0) { /* display active code page number */ - LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR1, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_CHCP_ERROR1, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, InputCodePage); return 0; } @@ -48,7 +47,7 @@ if (args >= 2) { /* too many parameters */ - LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR2, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_CHCP_ERROR2, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, param); return 1; } @@ -61,16 +60,15 @@
if (uNewCodePage == 0) { - LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR3, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_CHCP_ERROR3, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, arg[0]); freep (arg); return 1; }
if (!SetConsoleCP(uNewCodePage)) - { - LoadString(GetModuleHandle(NULL), STRING_CHCP_ERROR4, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf(szMsg); + { + ConErrResPuts(STRING_CHCP_ERROR4); } else { _____
Modified: trunk/reactos/subsys/system/cmd/choice.c --- trunk/reactos/subsys/system/cmd/choice.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/choice.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -123,13 +123,12 @@
TCHAR Ch; DWORD amount,clk;
- LoadString(GetModuleHandle(NULL), STRING_CHOICE_OPTION, Options, 2); + LoadString(CMD_ModuleHandle, STRING_CHOICE_OPTION, Options, 2); lpOptions = Options;
if (_tcsncmp (param, _T("/?"), 2) == 0) - { - LoadString(GetModuleHandle(NULL), STRING_CHOICE_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_CHOICE_HELP); return 0; }
@@ -168,9 +167,8 @@ lpOptions = &arg[i][2];
if (_tcslen (lpOptions) == 0) - { - LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR, szMsg, RC_STRING_MAX_SIZE); - ConErrPuts(szMsg); + { + ConErrResPuts(STRING_CHOICE_ERROR); freep (arg); return 1; } @@ -199,9 +197,8 @@ }
if (*s != _T(',')) - { - LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR_TXT, szMsg, RC_STRING_MAX_SIZE); - ConErrPuts(szMsg); + { + ConErrResPuts(STRING_CHOICE_ERROR_TXT); freep (arg); return 1; } @@ -212,7 +209,7 @@ } else if (arg[i][0] == _T('/')) { - LoadString(GetModuleHandle(NULL), STRING_CHOICE_ERROR_OPTION, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_CHOICE_ERROR_OPTION, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, arg[i]); freep (arg); return 1; _____
Modified: trunk/reactos/subsys/system/cmd/cls.c --- trunk/reactos/subsys/system/cmd/cls.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/cls.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -32,16 +32,14 @@
#ifdef INCLUDE_CMD_CLS
INT cmd_cls (LPTSTR cmd, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ CONSOLE_SCREEN_BUFFER_INFO csbi; COORD coPos; DWORD dwWritten;
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_CLS_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_CLS_HELP); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/cmd.c --- trunk/reactos/subsys/system/cmd/cmd.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/cmd.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -155,6 +155,7 @@
HANDLE hIn; HANDLE hOut; HANDLE hConsole; +HANDLE CMD_ModuleHandle;
static NtQueryInformationProcessProc NtQueryInformationProcessPtr; static NtReadVirtualMemoryProc NtReadVirtualMemoryPtr; @@ -1074,37 +1075,28 @@ #if 0 static VOID ShowCommands (VOID) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; - - /* print command list */ - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPrintf(szMsg); +{ + /* print command list */ + ConOutResPuts(STRING_CMD_HELP1); PrintCommandList();
- /* print feature list */ - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP2, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + /* print feature list */ + ConOutResPuts(STRING_CMD_HELP2);
-#ifdef FEATURE_ALIASES - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP3, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); +#ifdef FEATURE_ALIASES + ConOutResPuts(STRING_CMD_HELP3); #endif -#ifdef FEATURE_HISTORY - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP4, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); +#ifdef FEATURE_HISTORY + ConOutResPuts(STRING_CMD_HELP4); #endif -#ifdef FEATURE_UNIX_FILENAME_COMPLETION - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP5, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); +#ifdef FEATURE_UNIX_FILENAME_COMPLETION + ConOutResPuts(STRING_CMD_HELP5); #endif -#ifdef FEATURE_DIRECTORY_STACK - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP6, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); +#ifdef FEATURE_DIRECTORY_STACK + ConOutResPuts(STRING_CMD_HELP6); #endif -#ifdef FEATURE_REDIRECTION - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP7, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); +#ifdef FEATURE_REDIRECTION + ConOutResPuts(STRING_CMD_HELP7); #endif ConOutChar(_T('\n')); } @@ -1119,8 +1111,7 @@ */ static VOID Initialize (int argc, TCHAR* argv[]) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ TCHAR commandline[CMDLINE_LENGTH]; TCHAR ModuleName[_MAX_PATH + 1]; INT i; @@ -1152,9 +1143,8 @@
if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_CMD_HELP8, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_CMD_HELP8); ExitProcess(0); } SetConsoleMode (hIn, ENABLE_PROCESSED_INPUT); @@ -1290,20 +1280,20 @@
static VOID Cleanup (int argc, TCHAR *argv[]) { +#ifndef __REACTOS__ TCHAR szMsg[RC_STRING_MAX_SIZE]; +#endif
/* run cmdexit.bat */ if (IsExistingFile (_T("cmdexit.bat"))) - { - LoadString(GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf(szMsg); + { + ConErrResPuts(STRING_CMD_ERROR5);
ParseCommandLine (_T("cmdexit.bat")); } else if (IsExistingFile (_T("\cmdexit.bat"))) - { - LoadString( GetModuleHandle(NULL), STRING_CMD_ERROR5, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf ((LPTSTR)szMsg); + { + ConErrResPuts (STRING_CMD_ERROR5); ParseCommandLine (_T("\cmdexit.bat")); } #ifndef __REACTOS__ @@ -1435,6 +1425,7 @@
InputCodePage= GetConsoleCP(); OutputCodePage = GetConsoleOutputCP(); + CMD_ModuleHandle = GetModuleHandle(NULL);
/* check switches on command-line */ Initialize(argc, argv); _____
Modified: trunk/reactos/subsys/system/cmd/cmd.h --- trunk/reactos/subsys/system/cmd/cmd.h 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/cmd.h 2005-05-07 15:31:07 UTC (rev 15081) @@ -124,7 +124,9 @@
VOID AddBreakHandler (VOID); VOID RemoveBreakHandler (VOID);
+extern HANDLE CMD_ModuleHandle;
+ /* Prototypes for CMDINPUT.C */ VOID ReadCommand (LPTSTR, INT);
@@ -179,6 +181,8 @@ VOID GetScreenSize (PSHORT, PSHORT); VOID SetCursorType (BOOL, BOOL);
+VOID ConOutResPuts (UINT resID); +VOID ConErrResPuts (UINT resID);
/* Prototypes for COPY.C */ INT cmd_copy (LPTSTR, LPTSTR); _____
Modified: trunk/reactos/subsys/system/cmd/color.c --- trunk/reactos/subsys/system/cmd/color.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/color.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -28,10 +28,7 @@
static VOID ColorHelp (VOID) { - TCHAR szMsg[RC_STRING_MAX_SIZE]; - - LoadString(GetModuleHandle(NULL), STRING_COLOR_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + ConOutResPuts(STRING_COLOR_HELP1); }
@@ -40,12 +37,11 @@ DWORD dwWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; COORD coPos; - TCHAR szMsg[RC_STRING_MAX_SIZE]; +
if ((wColor & 0xF) == (wColor &0xF0) >> 4) - { - LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR1, szMsg, RC_STRING_MAX_SIZE); - ConErrPuts(szMsg); + { + ConErrResPuts(STRING_COLOR_ERROR1); } else { @@ -90,18 +86,17 @@ }
if (StringToColor(&wColor, &rest) == FALSE) - { - LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR2, szMsg, RC_STRING_MAX_SIZE); - ConErrPuts(szMsg); + { + ConErrResPuts(STRING_COLOR_ERROR2); return 1; }
- LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR3, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_COLOR_ERROR3, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, wColor);
if ((wColor & 0xF) == (wColor &0xF0) >> 4) { - LoadString(GetModuleHandle(NULL), STRING_COLOR_ERROR4, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_COLOR_ERROR4, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, wColor); return 1; } _____
Modified: trunk/reactos/subsys/system/cmd/console.c --- trunk/reactos/subsys/system/cmd/console.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/console.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -184,6 +184,14 @@
#endif }
+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); @@ -238,7 +246,7 @@ } else { - LoadString(GetModuleHandle(NULL), STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_CONSOLE_ERROR, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg); } } @@ -258,6 +266,13 @@ }
+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); _____
Modified: trunk/reactos/subsys/system/cmd/copy.c --- trunk/reactos/subsys/system/cmd/copy.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/copy.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -295,16 +295,14 @@
static INT Overwrite (LPTSTR fn) { - TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR inp[10]; LPTSTR p; TCHAR szOptions[4];
- LoadString( GetModuleHandle(NULL), STRING_COPY_OPTION, szOptions, 4); - - LoadString(GetModuleHandle(NULL), STRING_COPY_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPrintf(szMsg); + LoadString( CMD_ModuleHandle, STRING_COPY_OPTION, szOptions, 4); + ConOutResPuts(STRING_COPY_HELP1); + ConInString(inp, 10); ConOutPuts(_T(""));
@@ -347,7 +345,7 @@ NULL, OPEN_EXISTING, 0, NULL); if (hFileSrc == INVALID_HANDLE_VALUE) { - LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_COPY_ERROR1, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, source); return 0; } @@ -375,7 +373,7 @@ { if (!_tcscmp (dest, source)) { - LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_COPY_ERROR2, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, source); CloseHandle (hFileSrc); @@ -450,10 +448,8 @@
WriteFile (hFileDest, buffer, dwRead, &dwWritten, NULL); if (dwWritten != dwRead) - { - - LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR3, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf(szMsg); + { + ConErrResPuts(STRING_COPY_ERROR3);
free (buffer); CloseHandle (hFileDest); @@ -628,8 +624,7 @@
INT cmd_copy (LPTSTR first, LPTSTR rest) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ TCHAR **p; TCHAR drive_d[_MAX_DRIVE]; TCHAR dir_d[_MAX_DIR]; @@ -650,9 +645,8 @@ DWORD dwFlags = 0;
if (!_tcsncmp (rest, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_COPY_HELP2, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_COPY_HELP2); return 1; }
@@ -723,9 +717,8 @@ copied = SetupCopy (sources, p, bMultiple, drive_d, dir_d, file_d, ext_d, &append, &dwFlags); } else if (bDestFound && bWildcards) - { - LoadString(GetModuleHandle(NULL), STRING_COPY_ERROR4, szMsg, RC_STRING_MAX_SIZE); - ConErrPrintf(szMsg); + { + ConErrResPuts(STRING_COPY_ERROR4);
DeleteFileList (sources); freep (p); _____
Modified: trunk/reactos/subsys/system/cmd/date.c --- trunk/reactos/subsys/system/cmd/date.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/date.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -53,17 +53,17 @@
{ case 0: /* mmddyy */ default: - LoadString(GetModuleHandle(NULL), STRING_DATE_HELP1, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DATE_HELP1, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg, cDateSeparator, cDateSeparator); break;
case 1: /* ddmmyy */ - LoadString(GetModuleHandle(NULL), STRING_DATE_HELP2, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DATE_HELP2, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg, cDateSeparator, cDateSeparator); break;
case 2: /* yymmdd */ - LoadString(GetModuleHandle(NULL), STRING_DATE_HELP3, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DATE_HELP3, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg, cDateSeparator, cDateSeparator); break; } @@ -183,8 +183,7 @@
INT cmd_date (LPTSTR cmd, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ LPTSTR *arg; INT argc; INT i; @@ -192,9 +191,8 @@ INT nDateString = -1;
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_DATE_HELP4, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_DATE_HELP4); return 0; }
@@ -237,7 +235,8 @@ freep (arg); return 0; } - ConErrPuts (_T("Invalid date.")); + ConErrResPuts(STRING_ERROR_WRONG_DATE); + } } else @@ -247,9 +246,8 @@ freep (arg); return 0; } - - LoadString(GetModuleHandle(NULL), STRING_DATE_ERROR, szMsg, RC_STRING_MAX_SIZE); - ConErrPuts(szMsg); + + ConErrResPuts(STRING_DATE_ERROR); }
freep (arg); _____
Modified: trunk/reactos/subsys/system/cmd/del.c --- trunk/reactos/subsys/system/cmd/del.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/del.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -111,9 +111,8 @@
LONG ch;
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_DEL_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPrintf(szMsg); + { + ConOutResPuts(STRING_DEL_HELP1); return 0; }
@@ -187,7 +186,7 @@ { if (!((dwFlags & DEL_YES) || (dwFlags & DEL_QUIET) || (dwFlags & DEL_PROMPT))) { - LoadString( GetModuleHandle(NULL), STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE); + LoadString( CMD_ModuleHandle, STRING_DEL_HELP2, szMsg, RC_STRING_MAX_SIZE);
res = FilePromptYN (szMsg); if ((res == PROMPT_NO) || (res == PROMPT_BREAK)) @@ -243,10 +242,10 @@ /* ask for deleting */ if (dwFlags & DEL_PROMPT) { - LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE);
ConErrPrintf(szMsg, szFullPath); - LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE); res = FilePromptYN ((LPTSTR)szMsg);
if ((res == PROMPT_NO) || (res == PROMPT_BREAK)) @@ -257,7 +256,7 @@
if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL)) { - LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE);
ConErrPrintf(szMsg, szFullPath); }
@@ -313,10 +312,10 @@ // Don't ask if the file doesn't exist, the following code will make the error-msg if((dwFlags & DEL_PROMPT) && (FindFirstFile(szFullPath, &f) != INVALID_HANDLE_VALUE)) { - LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_ERROR5, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, szFullPath);
- LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_ERROR6, szMsg, RC_STRING_MAX_SIZE); res = FilePromptYN ((LPTSTR)szMsg);
if ((res == PROMPT_NO) || (res == PROMPT_BREAK)) @@ -330,7 +329,7 @@ #endif if (!(dwFlags & DEL_QUIET) && !(dwFlags & DEL_TOTAL)) { - LoadString(GetModuleHandle(NULL), STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_ERROR7, szMsg, RC_STRING_MAX_SIZE); ConErrPrintf(szMsg, szFullPath); }
@@ -384,11 +383,11 @@ { if (dwFiles < 2) { - LoadString(GetModuleHandle(NULL), STRING_DEL_HELP3, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_HELP3, szMsg, RC_STRING_MAX_SIZE); } else { - LoadString(GetModuleHandle(NULL), STRING_DEL_HELP4, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DEL_HELP4, szMsg, RC_STRING_MAX_SIZE); }
ConOutPrintf(szMsg, dwFiles); _____
Modified: trunk/reactos/subsys/system/cmd/delay.c --- trunk/reactos/subsys/system/cmd/delay.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/delay.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -16,15 +16,13 @@
INT CommandDelay (LPTSTR cmd, LPTSTR param) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ DWORD val; DWORD mul=1000;
if (_tcsncmp (param, _T("/?"), 2) == 0) - { - LoadString(GetModuleHandle(NULL), STRING_DELAY_HELP, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_DELAY_HELP); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/dir.c --- trunk/reactos/subsys/system/cmd/dir.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/dir.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -216,9 +216,7 @@
*/ static VOID DirHelp(VOID) { - TCHAR szMsg[RC_STRING_MAX_SIZE]; - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + ConOutResPuts(STRING_DIR_HELP1); }
@@ -839,17 +837,17 @@ /* print drive info */ if (szVolName[0] != _T('\0')) { - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP2, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP2, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf((LPTSTR)szMsg, szRootName[0], szVolName); } else { - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP3, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP3, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg, szRootName[0]); }
/* print the volume serial number if the return was successful */ - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP4, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP4, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); ConOutPrintf((LPTSTR)szMsg, HIWORD(dwSerialNr), LOWORD(dwSerialNr)); @@ -1086,7 +1084,7 @@ { ConvertULargeInteger(u64Bytes, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator);
- LoadString(GetModuleHandle(NULL), STRING_DIR_HELP5, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP5, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg,ulFiles, szBuffer); }
@@ -1094,7 +1092,7 @@ szRoot[0] = szPath[0]; GetUserDiskFreeSpace(szRoot, &uliFree); ConvertULargeInteger(uliFree, szBuffer, sizeof(szBuffer), lpFlags->bTSeperator); - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP6, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP6, (LPTSTR) szMsg, RC_STRING_MAX_SIZE); ConOutPrintf((LPTSTR)szMsg,ulDirs, szBuffer);
return 0; @@ -1430,7 +1428,7 @@ and if we are in recursive mode... we must have results */ if (!(lpFlags->bBareFormat ) && !((lpFlags->bRecursive) && (dwCount <= 0))) { - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP7, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP7, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg, szTemp); }
@@ -1782,7 +1780,7 @@ if (!(lpFlags->bBareFormat) && (dwCount > 0)) { ConvertULargeInteger(u64CountBytes, szBytes, 20, lpFlags->bTSeperator); - LoadString(GetModuleHandle(NULL), STRING_DIR_HELP8, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_DIR_HELP8, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg,dwCountFiles, szBytes); }
_____
Modified: trunk/reactos/subsys/system/cmd/dirstack.c --- trunk/reactos/subsys/system/cmd/dirstack.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/dirstack.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -136,16 +136,14 @@
* pushd command */ INT CommandPushd (LPTSTR first, LPTSTR rest) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ TCHAR curPath[MAX_PATH]; TCHAR newPath[MAX_PATH]; BOOL bChangePath = FALSE;
if (!_tcsncmp (rest, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_DIRSTACK_HELP1); return 0; }
@@ -171,13 +169,11 @@ */ INT CommandPopd (LPTSTR first, LPTSTR rest) { - TCHAR szMsg[RC_STRING_MAX_SIZE]; TCHAR szPath[MAX_PATH];
if (!_tcsncmp(rest, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP2, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_DIRSTACK_HELP2); return 0; }
@@ -197,14 +193,12 @@ * dirs command */ INT CommandDirs (LPTSTR first, LPTSTR rest) -{ - TCHAR szMsg[RC_STRING_MAX_SIZE]; +{ LPDIRENTRY lpDir;
if (!_tcsncmp(rest, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP3, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_DIRSTACK_HELP3); return 0; }
@@ -212,9 +206,8 @@ lpDir = lpStackBottom;
if (lpDir == NULL) - { - LoadString(GetModuleHandle(NULL), STRING_DIRSTACK_HELP4, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_DIRSTACK_HELP4); return 0; }
_____
Modified: trunk/reactos/subsys/system/cmd/echo.c --- trunk/reactos/subsys/system/cmd/echo.c 2005-05-07 15:22:32 UTC (rev 15080) +++ trunk/reactos/subsys/system/cmd/echo.c 2005-05-07 15:31:07 UTC (rev 15081) @@ -39,9 +39,8 @@
#endif
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_ECHO_HELP4); return 0; }
@@ -62,7 +61,7 @@ ConOutPuts (param); else { - LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE); + LoadString(CMD_ModuleHandle, STRING_ECHO_HELP4, szMsg, RC_STRING_MAX_SIZE); ConOutPrintf(szMsg, bEcho ? D_ON : D_OFF); } } @@ -73,16 +72,14 @@
INT CommandEchos (LPTSTR cmd, LPTSTR param) { - TCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef _DEBUG DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param); #endif
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP1, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_ECHO_HELP1); return 0; }
@@ -95,16 +92,14 @@
INT CommandEchoerr (LPTSTR cmd, LPTSTR param) { - TCHAR szMsg[RC_STRING_MAX_SIZE];
#ifdef _DEBUG DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param); #endif
if (!_tcsncmp (param, _T("/?"), 2)) - { - LoadString(GetModuleHandle(NULL), STRING_ECHO_HELP2, szMsg, RC_STRING_MAX_SIZE); - ConOutPuts(szMsg); + { + ConOutResPuts(STRING_ECHO_HELP2); return 0; }
@@ -126,16 +121,14 @@
INT CommandEchoserr (LPTSTR cmd, LPTSTR param) [truncated at 1000 lines; 1326 more skipped]