Author: tretiakov Date: Wed Feb 28 16:17:34 2007 New Revision: 25919
URL: http://svn.reactos.org/svn/reactos?rev=25919&view=rev Log: Andrey Janzen (virus126): echo %date% on windows >=XP return '24.02.2007', not 'Sut 24.02.2007' fix & implement dynamic buffer
Modified: trunk/reactos/base/shell/cmd/cmd.c
Modified: trunk/reactos/base/shell/cmd/cmd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=25... ============================================================================== --- trunk/reactos/base/shell/cmd/cmd.c (original) +++ trunk/reactos/base/shell/cmd/cmd.c Wed Feb 28 16:17:34 2007 @@ -1178,18 +1178,12 @@ /* %DATE% */ else if (_tcsicmp(varName,_T("date")) ==0) { - LPTSTR tmp; - - if ( !GrowIfNecessary ( MAX_PATH, &ret, &retlen ) ) + + if ( !GrowIfNecessary ( GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, NULL, 0), &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 */ + + size = GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, ret, retlen); + if ( !size ) return NULL; return ret;