mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
Use crtdll instead of ntdll.
svn path=/trunk/; revision=453
This commit is contained in:
parent
acd3d263c1
commit
5edb029d51
6 changed files with 37 additions and 43 deletions
|
@ -47,7 +47,7 @@ INT cmd_beep (LPTSTR cmd, LPTSTR param)
|
|||
return 1;
|
||||
#endif
|
||||
#ifdef __REACTOS__
|
||||
Beep (440, 50);
|
||||
Beep (440, 50);
|
||||
#else
|
||||
MessageBeep (-1);
|
||||
#endif
|
||||
|
|
|
@ -221,9 +221,9 @@ Execute (LPTSTR first, LPTSTR rest)
|
|||
|
||||
#ifndef __REACTOS__
|
||||
if (CreateProcess (NULL, szFullCmdLine, NULL, NULL, FALSE,
|
||||
0, NULL, NULL, &stui, &prci))
|
||||
0, NULL, NULL, &stui, &prci))
|
||||
#else
|
||||
if (CreateProcess (szFullName, rest, NULL, NULL, FALSE,
|
||||
if (CreateProcess (szFullName, rest, NULL, NULL, FALSE,
|
||||
0, NULL, NULL, &stui, &prci))
|
||||
#endif
|
||||
{
|
||||
|
@ -552,7 +552,7 @@ VOID ParseCommandLine (LPTSTR s)
|
|||
CloseHandle (hErr);
|
||||
hOldConErr = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
#endif
|
||||
#endif /* FEATURE_REDIRECTION */
|
||||
|
||||
/* process final command */
|
||||
DoCommand (s);
|
||||
|
@ -615,7 +615,6 @@ VOID ParseCommandLine (LPTSTR s)
|
|||
#ifdef _DEBUG
|
||||
DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -706,7 +705,7 @@ ProcessInput (BOOL bFlag)
|
|||
break;
|
||||
|
||||
case _T('?'):
|
||||
cp += _stprintf (cp, _T("%u"), nErrorLevel);
|
||||
cp += _stprintf (cp, _T("%u"), nErrorLevel);
|
||||
ip++;
|
||||
break;
|
||||
|
||||
|
@ -824,7 +823,7 @@ ShowCommands (VOID)
|
|||
#ifdef FEATURE_REDIRECTION
|
||||
ConOutPuts (" [redirections and piping]");
|
||||
#endif
|
||||
ConOutChar ('\n');
|
||||
ConOutChar ('\n');
|
||||
}
|
||||
|
||||
|
||||
|
@ -854,10 +853,10 @@ static VOID Initialize (int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
/* get version information */
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx (&osvi);
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx (&osvi);
|
||||
|
||||
InitLocale ();
|
||||
InitLocale ();
|
||||
|
||||
/* get default input and output console handles */
|
||||
hOut = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
|
@ -867,7 +866,7 @@ static VOID Initialize (int argc, char *argv[])
|
|||
InitLastPath ();
|
||||
#endif
|
||||
|
||||
if (argc >= 2)
|
||||
if (argc >= 2)
|
||||
{
|
||||
if (!_tcsncmp (argv[1], _T("/?"), 2))
|
||||
{
|
||||
|
@ -941,8 +940,8 @@ static VOID Initialize (int argc, char *argv[])
|
|||
|
||||
/* Set COMSPEC environment variable */
|
||||
#ifndef __REACTOS__
|
||||
if (argv)
|
||||
SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
|
||||
if (argv)
|
||||
SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
|
||||
#endif
|
||||
|
||||
/* add ctrl handler */
|
||||
|
@ -966,7 +965,7 @@ static VOID Cleanup (VOID)
|
|||
|
||||
/* remove ctrl handler */
|
||||
#if 0
|
||||
SetConsoleCtrlHandler ((PHANDLER_ROUTINE)&BreakHandler, FALSE);
|
||||
SetConsoleCtrlHandler ((PHANDLER_ROUTINE)&BreakHandler, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -980,23 +979,22 @@ int main (int argc, char *argv[])
|
|||
|
||||
AllocConsole ();
|
||||
#ifndef __REACTOS__
|
||||
SetFileApisToOEM ();
|
||||
SetFileApisToOEM ();
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
SetCurrentDirectory (_T("C:\\"));
|
||||
SetCurrentDirectory (_T("C:\\"));
|
||||
#endif
|
||||
|
||||
/* check switches on command-line */
|
||||
Initialize (argc, argv);
|
||||
|
||||
/* call prompt routine */
|
||||
nExitCode = ProcessInput (FALSE);
|
||||
nExitCode = ProcessInput (FALSE);
|
||||
|
||||
/* do the cleanup */
|
||||
Cleanup ();
|
||||
FreeConsole ();
|
||||
Cleanup ();
|
||||
FreeConsole ();
|
||||
|
||||
return nExitCode;
|
||||
// return 0;
|
||||
return nExitCode;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
return;
|
||||
|
||||
va_start (arg_ptr, szFormat);
|
||||
_vstprintf (szMessage, szFormat, arg_ptr);
|
||||
_vstprintf (szMessage, szFormat, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
|
@ -83,6 +83,10 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
|
|||
szError = _T("Path not found --");
|
||||
break;
|
||||
|
||||
case ERROR_BAD_PATHNAME: /* a1 */
|
||||
szError = _T("Invalid path");
|
||||
break;
|
||||
|
||||
default:
|
||||
ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode);
|
||||
return;
|
||||
|
|
|
@ -223,7 +223,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
|
|||
continue;
|
||||
|
||||
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
_stprintf (fname, _T("[%s]"), file.cFileName);
|
||||
_stprintf (fname, _T("[%s]"), file.cFileName);
|
||||
else
|
||||
_tcscpy (fname, file.cFileName);
|
||||
|
||||
|
|
|
@ -2,20 +2,16 @@
|
|||
# ReactOS makefile for CMD
|
||||
#
|
||||
|
||||
# target: raw binary (does not work right now)
|
||||
#all: cmd.bin
|
||||
|
||||
# target: executable (not tested/experimental)
|
||||
all: cmd.exe
|
||||
|
||||
OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
|
||||
chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
|
||||
del.o dir.o dirstack.o echo.o error.o filecomp.o for.o goto.o \
|
||||
history.o if.o internal.o label.o locale.o misc.o move.o path.o \
|
||||
pause.o prompt.o redir.o ren.o ros.o set.o shift.o time.o title.o type.o \
|
||||
pause.o prompt.o redir.o ren.o set.o shift.o time.o title.o type.o \
|
||||
ver.o verify.o vol.o where.o
|
||||
|
||||
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a
|
||||
LIBS= ../../lib/kernel32/kernel32.a ../../lib/crtdll/crtdll.a
|
||||
|
||||
CLEAN_FILES = *.o cmd.exe cmd.sym
|
||||
|
||||
|
@ -26,10 +22,6 @@ $(CLEAN_FILES:%=%_clean): %_clean:
|
|||
|
||||
.phony: clean $(CLEAN_FILES:%=%_clean)
|
||||
|
||||
cmd.bin: $(OBJECTS)
|
||||
$(LD) -Ttext 0x10000 $(OBJECTS) $(LIBS) -o cmd.exe
|
||||
$(OBJCOPY) -O binary cmd.exe cmd.bin
|
||||
|
||||
cmd.exe: $(OBJECTS) $(LIBS)
|
||||
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o cmd.exe
|
||||
$(NM) --numeric-sort cmd.exe > cmd.sym
|
||||
|
|
|
@ -65,17 +65,17 @@ static VOID PrintDate (VOID)
|
|||
{
|
||||
case 0: /* mmddyy */
|
||||
default:
|
||||
ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
|
||||
ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
|
||||
aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
|
||||
break;
|
||||
|
||||
case 1: /* ddmmyy */
|
||||
ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
|
||||
ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
|
||||
aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
|
||||
break;
|
||||
|
||||
case 2: /* yymmdd */
|
||||
ConOutPrintf (_T("%s %04d%c%02d%c%02d"),
|
||||
ConOutPrintf (_T("%s %04d%c%02d%c%02d"),
|
||||
aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
|
||||
break;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ static VOID PrintDate (VOID)
|
|||
|
||||
GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
|
||||
szDate, sizeof (szDate));
|
||||
ConOutPrintf (_T("%s"), szDate);
|
||||
ConOutPrintf (_T("%s"), szDate);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -101,24 +101,24 @@ PrintTime (VOID)
|
|||
{
|
||||
case 0: /* 12 hour format */
|
||||
default:
|
||||
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d%c"),
|
||||
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d%c"),
|
||||
(st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
|
||||
cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
|
||||
st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p'));
|
||||
break;
|
||||
|
||||
case 1: /* 24 hour format */
|
||||
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d"),
|
||||
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d"),
|
||||
st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
|
||||
st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TCHAR szTime[32];
|
||||
TCHAR szTime[32];
|
||||
|
||||
GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
|
||||
szTime, sizeof (szTime));
|
||||
ConOutPrintf (_T("%s"), szTime);
|
||||
ConOutPrintf (_T("%s"), szTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ VOID PrintPrompt(VOID)
|
|||
break;
|
||||
|
||||
case _T('D'):
|
||||
PrintDate ();
|
||||
PrintDate ();
|
||||
break;
|
||||
|
||||
case _T('E'):
|
||||
|
@ -207,7 +207,7 @@ VOID PrintPrompt(VOID)
|
|||
break;
|
||||
|
||||
case _T('T'):
|
||||
PrintTime ();
|
||||
PrintTime ();
|
||||
break;
|
||||
|
||||
case _T('V'):
|
||||
|
|
Loading…
Reference in a new issue