Added help command to shell.exe.

Minor changes.

svn path=/trunk/; revision=1021
This commit is contained in:
Emanuele Aliberti 2000-02-29 23:57:47 +00:00
parent c37b4fd7f1
commit d53eeb0cee
11 changed files with 198 additions and 63 deletions

View file

@ -1,4 +1,12 @@
#include <ddk/ntddk.h>
/* $Id: shell.c,v 1.32 2000/02/29 23:57:44 ea Exp $
*
* PROJECT : ReactOS Operating System
* DESCRIPTION: ReactOS' Native Shell
* LICENSE : See top level directory
*
*/
#define NTOS_MODE_USER
#include <ntos.h>
#include <windows.h>
#include <stdarg.h>
#include <string.h>
@ -233,6 +241,25 @@ ExecuteKill(char * lpPid)
return;
}
void ExecuteHelp (void * dummy)
{
debug_printf (
"A:\t\t\tCurrent drive is A:\n"
"C:\t\t\tCurrent drive is C:\n"
"cd [directory]\t\tChange current directory\n"
"dir [directory]\t\tList directory\n"
"exit\t\t\tTerminate the shell\n"
"help\t\t\tPrint this help message\n"
"kill [pid]\t\tKill process which PID is pid\n"
"reboot\t\t\tRestart the system\n"
"start [program.exe]\tDetach program.exe\n"
"type [file]\t\tPrint the file on console\n"
"validate\t\tValidate the process' heap\n"
"ver\t\t\tPrint version information\n"
"[program.exe]\t\tStart synchronously program.exe\n\n"
);
}
void ExecuteCommand(char* line)
{
char* cmd;
@ -343,6 +370,11 @@ void ExecuteCommand(char* line)
ExecuteStart(tail);
return;
}
if ((strcmp(cmd,"help") * strcmp(cmd,"?")) == 0)
{
ExecuteHelp(tail);
return;
}
if (strcmp(cmd,"exit")==0)
{
if (bCanExit == TRUE)
@ -436,3 +468,4 @@ int main(void)
return 0;
}
/* EOF */

View file

@ -1,10 +1,15 @@
#ifndef __INCLUDE_DDK_KDFUNCS_H
#define __INCLUDE_DDK_KDFUNCS_H
/* $Id: kdfuncs.h,v 1.1 2000/02/26 22:41:34 ea Exp $ */
/* $Id: kdfuncs.h,v 1.2 2000/02/29 23:57:44 ea Exp $ */
/* --- NTOSKRNL.EXE --- */
extern BOOLEAN KdDebuggerEnabled;
extern BOOLEAN KdDebuggerNotPresent;
#if defined(__NTOSKRNL__)
extern BOOLEAN KdDebuggerEnabled __declspec(dllexport);
extern BOOLEAN KdDebuggerNotPresent __declspec(dllexport);
#else
extern BOOLEAN KdDebuggerEnabled __declspec(dllimport);
extern BOOLEAN KdDebuggerNotPresent __declspec(dllimport);
#endif
BYTE
STDCALL
@ -13,7 +18,11 @@ KdPollBreakIn (
);
/* --- HAL.DLL --- */
extern ULONG KdComPortInUse;
#if defined(__NTOSKRNL__)
extern ULONG KdComPortInUse __declspec(dllexport);
#else
extern ULONG KdComPortInUse __declspec(dllimport);
#endif
BOOLEAN
STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: kdbg.c,v 1.6 2000/02/27 02:08:53 ekohl Exp $
/* $Id: kdbg.c,v 1.7 2000/02/29 23:57:45 ea Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -57,7 +57,9 @@
/* GLOBAL VARIABLES *********************************************************/
ULONG KdComPortInUse = 0; /* EXPORTED */
ULONG
__declspec(dllexport)
KdComPortInUse = 0; /* EXPORTED */
/* STATIC VARIABLES *********************************************************/

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.37 2000/02/27 02:10:09 ekohl Exp $
/* $Id: main.c,v 1.38 2000/02/29 23:57:45 ea Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -30,9 +30,13 @@
/* DATA *********************************************************************/
USHORT NtBuildNumber = KERNEL_VERSION_BUILD; /* EXPORTED */
USHORT
__declspec(dllexport)
NtBuildNumber = KERNEL_VERSION_BUILD; /* EXPORTED */
ULONG NtGlobalFlag = 0; /* FIXME: EXPORTED */
ULONG
__declspec(dllexport)
NtGlobalFlag = 0; /* FIXME: EXPORTED */
/* FUNCTIONS ****************************************************************/

View file

@ -1,6 +1,6 @@
/* $Id: wapi.c,v 1.3 2000/02/27 02:12:07 ekohl Exp $
/* $Id: wapi.c,v 1.4 2000/02/29 23:57:46 ea Exp $
*
* reactos/subsys/csrss/init.c
* reactos/subsys/csrss/api/wapi.c
*
* Initialize the CSRSS subsystem server process.
*
@ -41,14 +41,14 @@ static void Thread_Api2(HANDLE ServerPort)
&LpcRequest);
if (!NT_SUCCESS(Status))
{
DisplayString(L"NtReplyWaitReceivePort failed\n");
DisplayString(L"CSR: NtReplyWaitReceivePort failed\n");
}
Request = (PCSRSS_API_REQUEST)LpcRequest.MessageData;
ProcessData = CsrGetProcessData(LpcRequest.ClientProcessId);
DisplayString(L"Received request\n");
DisplayString(L"CSR: Received request\n");
switch (Request->Type)
{
@ -120,7 +120,7 @@ void Thread_Api(PVOID PortHandle)
NULL);
if (CsrssApiHeap == NULL)
{
PrintString("Failed to create private heap, aborting\n");
PrintString("CSR: Failed to create private heap, aborting\n");
return;
}
@ -131,7 +131,7 @@ void Thread_Api(PVOID PortHandle)
Status = NtListenPort(PortHandle, &Request);
if (!NT_SUCCESS(Status))
{
DisplayString(L"NtListenPort() failed\n");
DisplayString(L"CSR: NtListenPort() failed\n");
NtTerminateThread(NtCurrentThread(), Status);
}
@ -143,14 +143,14 @@ void Thread_Api(PVOID PortHandle)
NULL);
if (!NT_SUCCESS(Status))
{
DisplayString(L"NtAcceptConnectPort() failed\n");
DisplayString(L"CSR: NtAcceptConnectPort() failed\n");
NtTerminateThread(NtCurrentThread(), Status);
}
Status = NtCompleteConnectPort(ServerPort);
if (!NT_SUCCESS(Status))
{
DisplayString(L"NtCompleteConnectPort() failed\n");
DisplayString(L"CSR: NtCompleteConnectPort() failed\n");
NtTerminateThread(NtCurrentThread(), Status);
}
@ -166,7 +166,7 @@ void Thread_Api(PVOID PortHandle)
NULL);
if (!NT_SUCCESS(Status))
{
DisplayString(L"Unable to create server thread\n");
DisplayString(L"CSR: Unable to create server thread\n");
NtClose(ServerPort);
NtTerminateThread(NtCurrentThread(), Status);
}

View file

@ -1,4 +1,4 @@
/* $Id: init.c,v 1.5 2000/02/27 02:11:54 ekohl Exp $
/* $Id: init.c,v 1.6 2000/02/29 23:57:45 ea Exp $
*
* reactos/subsys/csrss/init.c
*
@ -98,7 +98,7 @@ CsrServerInitialization (
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
if (!NT_SUCCESS(Status))
{
PrintString("Unable to parse the command line (Status: %x)\n", Status);
PrintString("CSR: Unable to parse the command line (Status: %x)\n", Status);
return(FALSE);
}
@ -117,7 +117,7 @@ CsrServerInitialization (
0);
if (!NT_SUCCESS(Status))
{
PrintString("Unable to create \\ApiPort (Status %x)\n", Status);
PrintString("CSR: Unable to create \\ApiPort (Status %x)\n", Status);
return(FALSE);
}
@ -133,7 +133,7 @@ CsrServerInitialization (
NULL);
if (!NT_SUCCESS(Status))
{
PrintString("Unable to create server thread\n");
PrintString("CSR: Unable to create server thread\n");
NtClose(ApiPortHandle);
return FALSE;
}

View file

@ -27,6 +27,7 @@ FLOPPY_DIR = A/
DIST_DIR = dist
endif
ifeq ($(HOST),mingw32-windows)
PREFIX =
EXE_POSTFIX = .exe
@ -62,9 +63,16 @@ endif
CC = $(PREFIX)gcc
NATIVE_CC = gcc
CFLAGS = -O2 -Wall -Wstrict-prototypes -fno-builtin \
$(LEAN_AND_MEAN_DEFINE) $(DEFINES) $(DEBUGGING_CFLAGS) \
$(EXTRA_CFLAGS)
CFLAGS = \
-pipe \
-O2 \
-Wall \
-Wstrict-prototypes \
-fno-builtin \
$(LEAN_AND_MEAN_DEFINE) \
$(DEFINES) \
$(DEBUGGING_CFLAGS) \
$(EXTRA_CFLAGS)
CXXFLAGS = $(CFLAGS)
LD = $(PREFIX)ld
NM = $(PREFIX)nm
@ -74,11 +82,17 @@ AS = $(PREFIX)gcc -c -x assembler-with-cpp
CPP = $(PREFIX)cpp
AR = $(PREFIX)ar
RC = $(PREFIX)windres
RCINC = --include-dir ../reactos/include --include-dir ../../reactos/include --include-dir ../../../reactos/include
%.o: %.cc
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.asm
$(NASM_CMD) $(NFLAGS) $< -o $@
%.coff: %.rc
$(RC) $< $@
$(RC) $(RCINC) $< $@
RULES_MAK_INCLUDED = 1

View file

@ -1,6 +1,6 @@
//======================================================================
//
// $Id: chkdsk.c,v 1.1 1999/05/16 07:27:35 ea Exp $
// $Id: chkdsk.c,v 1.2 2000/02/29 23:57:46 ea Exp $
//
// Chkdskx
//
@ -40,7 +40,7 @@
#define UNICODE
#include <windows.h>
#include <stdio.h>
#include "fmifs.h"
#include <fmifs.h>
#define _UNICODE 1
#include <tchar.h>
#include "config.h"
@ -63,7 +63,7 @@ WCHAR CurrentDirectory[1024];
//
// FMIFS function
//
PCHKDSK Chkdsk;
//PCHKDSK ChkDsk;
#endif /* ndef FMIFS_IMPORT_DLL */
@ -127,7 +127,7 @@ ParseCommandLine(
BOOLEAN gotFix = FALSE;
BOOLEAN gotVerbose = FALSE;
BOOLEAN gotClean = FALSE;
BOOLEAN gotScan = FALSE;
/*BOOLEAN gotScan = FALSE;*/
for ( i = 1;
@ -200,7 +200,7 @@ ParseCommandLine(
//
//----------------------------------------------------------------------
BOOLEAN
__stdcall
STDCALL
ChkdskCallback(
CALLBACKCOMMAND Command,
DWORD Modifier,
@ -217,21 +217,73 @@ ChkdskCallback(
//
switch( Command )
{
case UNKNOWN2:
wprintf(L"UNKNOWN2\r");
break;
case UNKNOWN3:
wprintf(L"UNKNOWN3\r");
break;
case UNKNOWN4:
wprintf(L"UNKNOWN4\r");
break;
case UNKNOWN5:
wprintf(L"UNKNOWN5\r");
break;
case UNKNOWN7:
wprintf(L"UNKNOWN7\r");
break;
case UNKNOWN8:
wprintf(L"UNKNOWN8\r");
break;
case UNKNOWN9:
wprintf(L"UNKNOWN9\r");
break;
case UNKNOWNA:
wprintf(L"UNKNOWNA\r");
break;
case UNKNOWNC:
wprintf(L"UNKNOWNC\r");
break;
case UNKNOWND:
wprintf(L"UNKNOWND\r");
break;
case INSUFFICIENTRIGHTS:
wprintf(L"INSUFFICIENTRIGHTS\r");
break;
case STRUCTUREPROGRESS:
wprintf(L"STRUCTUREPROGRESS\r");
break;
case DONEWITHSTRUCTURE:
wprintf(L"DONEWITHSTRUCTURE\r");
break;
case PROGRESS:
percent = (PDWORD) Argument;
_tprintf(L"%d percent completed.\r", *percent);
wprintf(L"%d percent completed.\r", *percent);
break;
case OUTPUT:
output = (PTEXTOUTPUT) Argument;
fprintf(stdout, "%s", output->Output);
fwprintf(stdout, L"%s", output->Output);
break;
case DONE:
status = (PBOOLEAN) Argument;
if( *status == TRUE ) {
_tprintf(L"Chkdsk was unable to complete successfully.\n\n");
if ( *status == TRUE )
{
wprintf(L"Chkdsk was unable to complete successfully.\n\n");
Error = TRUE;
}
break;
@ -246,7 +298,7 @@ ChkdskCallback(
//
// Loads FMIFS.DLL and locates the entry point(s) we are going to use
//
// 19990216 EA User wide functions
// 19990216 EA Used wide functions
//
//----------------------------------------------------------------------
BOOLEAN
@ -254,7 +306,7 @@ LoadFMIFSEntryPoints(VOID)
{
LoadLibraryW( L"fmifs.dll" );
if( !(Chkdsk =
if( !(ChkDsk =
(void *) GetProcAddress(
GetModuleHandleW(L"fmifs.dll"),
"Chkdsk" ))
@ -292,7 +344,7 @@ wmain( int argc, WCHAR *argv[] )
wprintf(
L"\n\
Chkdskx v1.0 by Mark Russinovich\n\
Chkdskx v1.0.1 by Mark Russinovich\n\
Systems Internals - http://www.sysinternals.com/\n\
ReactOS adaptation 1999 by Emanuele Aliberti\n\n"
);
@ -311,7 +363,10 @@ ReactOS adaptation 1999 by Emanuele Aliberti\n\n"
//
if( (badArg = ParseCommandLine( argc, argv )))
{
wprintf(L"Unknown argument: %s\n", argv[badArg] );
wprintf(
L"Unknown argument: %s\n",
argv[badArg]
);
Usage(argv[0]);
return -1;
@ -386,7 +441,7 @@ ReactOS adaptation 1999 by Emanuele Aliberti\n\n"
);
if( volumeHandle == INVALID_HANDLE_VALUE )
{
wprintf("Chdskx cannot run because the volume is in use by another process.\n\n");
wprintf(L"Chdskx cannot run because the volume is in use by another process.\n\n");
return -1;
}
CloseHandle( volumeHandle );
@ -401,10 +456,10 @@ ReactOS adaptation 1999 by Emanuele Aliberti\n\n"
// Just do it
//
wprintf(
"The type of file system is %s.\n",
L"The type of file system is %s.\n",
fileSystem
);
Chkdsk(
ChkDsk(
Drive,
fileSystem,
FixErrors,

View file

@ -1,4 +1,4 @@
/* $Id: chklib.c,v 1.1 1999/05/16 07:27:35 ea Exp $
/* $Id: chklib.c,v 1.2 2000/02/29 23:57:46 ea Exp $
*
* chklib.c
*
@ -7,17 +7,17 @@
* --------------------------------------------------------------------
*
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
* General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this software; see the file COPYING.LIB. If
* You should have received a copy of the GNU General Public
* License along with this software; see the file COPYING. If
* not, write to the Free Software Foundation, Inc., 675 Mass Ave,
* Cambridge, MA 02139, USA.
*
@ -132,7 +132,7 @@ main(
HINSTANCE dll;
TCHAR ModuleName [_MAX_PATH];
if (argc != 2 && argc != 3)
if (argc < 2)
{
fprintf(
stderr,
@ -140,7 +140,7 @@ main(
ReactOS System Tools\n\
Check a Dynamic Link Library (DLL) for loading\n\
Copyright (c) 1998, 1999 Emanuele Aliberti\n\n\
usage: %s module [symbol]\n",
usage: %s module [symbol [, ...]]\n",
argv[0]
);
exit(EXIT_FAILURE);
@ -173,7 +173,18 @@ usage: %s module [symbol]\n",
#ifdef DISPLAY_VERSION
DisplayVersion(dll,ModuleName);
#endif
if (argc == 3) DisplayEntryPoint( dll, argv[2] );
if (argc > 2)
{
int CurrentSymbol;
for ( CurrentSymbol = 2;
(CurrentSymbol < argc);
++CurrentSymbol
)
{
DisplayEntryPoint( dll, argv[CurrentSymbol] );
}
}
FreeLibrary(dll);
printf(
"%s unloaded.\n",

View file

@ -1,6 +1,6 @@
//======================================================================
//
// $Id: format.c,v 1.1 1999/05/16 07:27:35 ea Exp $
// $Id: format.c,v 1.2 2000/02/29 23:57:46 ea Exp $
//
// Formatx
//
@ -38,7 +38,7 @@
#define _UNICODE 1
#include <windows.h>
#include <stdio.h>
#include "fmifs.h"
#include "../../reactos/include/fmifs.h"
//#include <tchar.h>
#include "win32err.h"
#include "config.h"

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.2 1999/10/03 22:12:07 ekohl Exp $
# $Id: makefile,v 1.3 2000/02/29 23:57:47 ea Exp $
#
# ReactOS System Utilities
#
@ -12,10 +12,13 @@
# 1999-03-16 (Emanuele Aliberti)
# Added regnav.c
#
# 1999-12-19 (ea)
# Added qsi.c
#
ROSINC=../../reactos/include
TARGET=regnav.exe
TARGET=regnav.exe chklib.exe
# chkdsk.exe format.exe \
# chklib.exe shutdown.exe regnav.exe
# login.exe chklib.exe shutdown.exe regnav.exe
@ -39,14 +42,8 @@ format.exe: format.o win32err.o wmain.o
-lcrtdll \
-lfmifs
$(NM) --numeric-sort format.exe > format.sym
#---
#login.exe: login.o
# $(CC) login.o \
# -o login.exe \
# -lntdll \
# -Wl,--subsystem native:4.0
# $(NM) --numeric-sort login.exe > login.sym
#---
chklib.exe: chklib.o win32err.o
$(CC) chklib.o win32err.o \
@ -72,6 +69,16 @@ shutdown.exe: shutdown.o win32err.o
-lcrtdll
$(NM) --numeric-sort shutdown.exe > shutdown.sym
qsi.exe: qsi.o
$(CC) qsi.o \
../../reactos/lib/ntdll/ntdll.a
-o qsi.exe \
-lkernel32 \
-lcrtdll
$(NM) --numeric-sort qsi.exe > qsi.sym
qsi.o: qsi.c
#---
CLEAN_FILES = *.o *.exe *.sym