Improved csrss (doesn't crash any more)

Improved kernel debugger code
Various minor improvements

svn path=/trunk/; revision=1015
This commit is contained in:
Eric Kohl 2000-02-27 02:12:07 +00:00
parent 012968e3dc
commit fa81b6d260
24 changed files with 455 additions and 136 deletions

View file

@ -33,9 +33,11 @@ typedef struct
ULONG Flags;
} CSRSS_CREATE_PROCESS_REQUEST, *PCSRSS_CREATE_PROCESS_REQUEST;
/*
* lib/ntdll/csr/api.c
*/
NTSTATUS CsrConnectToServer(VOID);
BOOL
STDCALL
CsrServerInitialization (
ULONG ArgumentCount,
PWSTR *ArgumentArray
);
#endif
#endif /* __INCLUDE_CSRSS_CSRSS_H */

View file

@ -0,0 +1,33 @@
/* $Id: csr.h,v 1.1 2000/02/27 02:01:24 ekohl Exp $
*
*/
#ifndef __INCLUDE_NTDLL_CSR_H
#define __INCLUDE_NTDLL_CSR_H
/*
NTSTATUS
STDCALL
CsrClientCallServer (
ULONG Unknown1,
ULONG Unknown2,
ULONG Unknown3,
ULONG Unknown4
);
*/
NTSTATUS
STDCALL
CsrClientConnectToServer (
ULONG Unknown1,
ULONG Unknown2,
ULONG Unknown3,
ULONG Unknown4,
ULONG Unknown5,
ULONG Unknown6
);
#endif /* __INCLUDE_NTDLL_CSR_H */
/* EOF */

View file

@ -1,7 +1,9 @@
/* $Id: rtl.h,v 1.11 2000/02/25 23:57:21 ekohl Exp $
/* $Id: rtl.h,v 1.12 2000/02/27 02:01:24 ekohl Exp $
*
*/
#ifndef __INCLUDE_NTDLL_RTL_H
#define __INCLUDE_NTDLL_RTL_H
/*
* Preliminary data type!!
@ -23,9 +25,6 @@ typedef struct _RTL_USER_PROCESS_INFO
} RTL_USER_PROCESS_INFO, *PRTL_USER_PROCESS_INFO;
//VOID WINAPI __RtlInitHeap(PVOID base,
// ULONG minsize,
// ULONG maxsize);
#define HEAP_BASE (0xa0000000)
@ -242,4 +241,6 @@ RtlNormalizeProcessParams (
IN OUT PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
#endif /* __INCLUDE_NTDLL_RTL_H */
/* EOF */

View file

@ -3,14 +3,14 @@
#include <stdarg.h>
#include <stdio.h>
ULONG DbgService( ULONG Service, PVOID Context1, PVOID Context2 );
/*
* NOTE: Don't call DbgService()!
* It's a ntdll internal function and is NOT exported!
*/
VOID STDCALL OutputDebugStringA(LPCSTR lpOutputString)
{
ANSI_STRING AnsiString;
AnsiString.Buffer = lpOutputString;
AnsiString.Length = AnsiString.MaximumLength = lstrlenA( lpOutputString );
DbgService( 1, &AnsiString, NULL );
DbgPrint( (PSTR)lpOutputString );
}
VOID STDCALL OutputDebugStringW(LPCWSTR lpOutputString)
@ -28,7 +28,7 @@ VOID STDCALL OutputDebugStringW(LPCWSTR lpOutputString)
if( UnicodeOutput.Length > 512 )
UnicodeOutput.Length = 512;
if( NT_SUCCESS( RtlUnicodeStringToAnsiString( &AnsiString, &UnicodeOutput, FALSE ) ) )
DbgService( 1, &AnsiString, NULL );
DbgPrint( AnsiString.Buffer );
}

View file

@ -1,12 +0,0 @@
#include <ddk/ntddk.h>
#include <windows.h>
#include <stdarg.h>
#include <kernel32/kernel32.h>
VOID KERNEL32_Init()
{
DPRINT("KERNEL32_Init()\n");
__HeapInit(0, 4*1024*1024, 4*1024*1024);
}

View file

@ -1,4 +1,5 @@
/*
/* $Id: dllmain.c,v 1.10 2000/02/27 02:04:06 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/kernel32/misc/dllmain.c
@ -9,15 +10,14 @@
*/
#include <ddk/ntddk.h>
#include <ntdll/csr.h>
#include <windows.h>
#include <wchar.h>
#include <kernel32/proc.h>
#include <internal/teb.h>
#define NDEBUG
#include <kernel32/kernel32.h>
WINBOOL STDCALL DllMain (HANDLE hInst,
WINBOOL STDCALL DllMain (HANDLE hInst,
ULONG ul_reason_for_call,
LPVOID lpReserved);
@ -28,44 +28,43 @@ BOOL WINAPI DllMainCRTStartup(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
return(DllMain(hDll,dwReason,lpReserved));
}
VOID WINAPI __HeapInit(LPVOID base, ULONG minsize, ULONG maxsize);
WINBOOL STDCALL DllMain(HANDLE hInst,
WINBOOL STDCALL DllMain(HANDLE hInst,
ULONG ul_reason_for_call,
LPVOID lpReserved)
{
DPRINT("DllMain(hInst %x, ul_reason_for_call %d)\n",
hInst, ul_reason_for_call);
switch (ul_reason_for_call)
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
DPRINT("DLL_PROCESS_ATTACH\n");
AllocConsole();
break;
}
case DLL_THREAD_ATTACH:
{
// Teb = HeapAlloc(GetProcessHeap(),0,sizeof(NT_TEB));
// Teb->Peb = GetCurrentPeb();
// Teb->HardErrorMode = SEM_NOGPFAULTERRORBOX;
// Teb->dwTlsIndex=0;
NTSTATUS Status;
DPRINT("DLL_PROCESS_ATTACH\n");
/*
*
*/
Status = CsrClientConnectToServer(0,0,0,0,0,0);
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to connect to csrss.exe: expect trouble\n");
/* return FALSE; */
}
AllocConsole();
break;
}
case DLL_PROCESS_DETACH:
{
// HeapFree(GetProcessHeap(),0,Teb);
DPRINT("DLL_PROCESS_DETACH\n");
HeapDestroy(NtCurrentPeb()->ProcessHeap);
break;
}
case DLL_THREAD_DETACH:
{
// HeapFree(GetProcessHeap(),0,Teb);
break;
}
default:
break;
}
return TRUE;
return TRUE;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: api.c,v 1.2 1999/12/30 01:51:38 dwelch Exp $
/* $Id: api.c,v 1.3 2000/02/27 02:05:06 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -9,6 +9,7 @@
/* INCLUDES *****************************************************************/
#include <ddk/ntddk.h>
#include <ntdll/csr.h>
#include <string.h>
#include <csrss/csrss.h>
@ -22,8 +23,12 @@ static HANDLE WindowsApiPort;
/* FUNCTIONS *****************************************************************/
NTSTATUS CsrClientCallServer(PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply)
NTSTATUS
STDCALL
CsrClientCallServer(PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply,
ULONG Unknown3,
ULONG Unknown4)
{
LPCMESSAGE LpcRequest;
LPCMESSAGE LpcReply;
@ -39,7 +44,14 @@ NTSTATUS CsrClientCallServer(PCSRSS_API_REQUEST Request,
return(Status);
}
NTSTATUS CsrConnectToServer(VOID)
NTSTATUS
STDCALL
CsrClientConnectToServer(ULONG Unknown1,
ULONG Unknown2,
ULONG Unknown3,
ULONG Unknown4,
ULONG Unknown5,
ULONG Unknown6)
{
NTSTATUS Status;
UNICODE_STRING PortName;
@ -64,7 +76,8 @@ NTSTATUS CsrConnectToServer(VOID)
Request.Type = CSRSS_CONNECT_PROCESS;
Status = CsrClientCallServer(&Request,
&Reply);
&Reply,
0, 0);
if (!NT_SUCCESS(Status))
{
return(Status);

View file

@ -1,13 +1,14 @@
; $Id: ntdll.def,v 1.41 2000/02/21 22:37:24 ekohl Exp $
; $Id: ntdll.def,v 1.42 2000/02/27 02:05:40 ekohl Exp $
;
; ReactOS Operating System
;
LIBRARY ntdll.dll
EXPORTS
CsrClientCallServer@16
CsrClientConnectToServer@24
DbgBreakPoint
DbgPrint
DbgService
DbgUserBreakPoint
NlsAnsiCodePage
NlsMbCodePageTag

View file

@ -1,10 +1,12 @@
; $Id: ntdll.edf,v 1.30 2000/02/18 00:48:50 ekohl Exp $
; $Id: ntdll.edf,v 1.31 2000/02/27 02:05:40 ekohl Exp $
;
; ReactOS Operating System
;
LIBRARY ntdll.dll
EXPORTS
CsrClientCallServer=CsrClientCallServer@16
CsrClientConnectToServer=CsrClientConnectToServer@24
DbgBreakPoint
DbgPrint
DbgUserBreakPoint
@ -658,5 +660,3 @@ LdrLoadDll
LdrUnloadDll
LdrAccessResource
LdrFindResource_U
;RtlCopyMemory=RtlCopyMemory@12
DbgService

View file

@ -1,4 +1,4 @@
/* $Id: startup.c,v 1.19 2000/02/25 00:35:06 ekohl Exp $
/* $Id: startup.c,v 1.20 2000/02/27 02:05:53 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -29,7 +29,6 @@
DLL LdrDllListHead;
extern unsigned int _image_base__;
extern HANDLE __ProcessHeap;
/* FUNCTIONS *****************************************************************/
@ -53,7 +52,6 @@ VOID LdrStartup(VOID)
LdrDllListHead.Headers = (PIMAGE_NT_HEADERS)(LdrDllListHead.BaseAddress +
PEDosHeader->e_lfanew);
Peb = (PPEB)(PEB_BASE);
DPRINT("Peb %x\n", Peb);
ImageBase = Peb->ImageBaseAddress;
@ -79,30 +77,27 @@ VOID LdrStartup(VOID)
RtlNormalizeProcessParams (Peb->ProcessParameters);
NTHeaders = (PIMAGE_NT_HEADERS)(ImageBase + PEDosHeader->e_lfanew);
__ProcessHeap = RtlCreateHeap(0,
(PVOID)HEAP_BASE,
NTHeaders->OptionalHeader.SizeOfHeapCommit,
NTHeaders->OptionalHeader.SizeOfHeapReserve,
NULL,
NULL);
Peb->ProcessHeap = __ProcessHeap;
EntryPoint = LdrPEStartup((PVOID)ImageBase, NULL);
/* create process heap */
Peb->ProcessHeap = RtlCreateHeap(0,
(PVOID)HEAP_BASE,
NTHeaders->OptionalHeader.SizeOfHeapCommit,
NTHeaders->OptionalHeader.SizeOfHeapReserve,
NULL,
NULL);
if (Peb->ProcessHeap == 0)
{
DbgPrint("Failed to create process heap\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
}
EntryPoint = LdrPEStartup((PVOID)ImageBase, NULL);
if (EntryPoint == NULL)
{
DbgPrint("Failed to initialize image\n");
ZwTerminateProcess(NtCurrentProcess(),STATUS_UNSUCCESSFUL);
}
/*
*
*/
Status = CsrConnectToServer();
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to connect to csrss.exe: expect trouble\n");
}
DbgPrint("Transferring control to image at %x\n",EntryPoint);
Status = EntryPoint(Peb);
ZwTerminateProcess(NtCurrentProcess(),Status);

View file

@ -88,7 +88,6 @@ typedef struct tagHEAP
#define HEAP_DEF_SIZE 0x110000 /* Default heap size = 1Mb + 64Kb */
#define HEAP_MIN_BLOCK_SIZE (8+sizeof(ARENA_FREE)) /* Min. heap block size */
HANDLE __ProcessHeap = 0;
/***********************************************************************
* HEAP_Dump
@ -1268,6 +1267,6 @@ BOOL WINAPI RtlValidateHeap(
HANDLE WINAPI RtlGetProcessHeap(VOID)
{
DPRINT("RtlGetProcessHeap()\n");
return (HANDLE) __ProcessHeap;
return (HANDLE)NtCurrentPeb()->ProcessHeap;
}

View file

@ -1,4 +1,4 @@
/* $Id: print.c,v 1.7 2000/02/13 16:05:17 dwelch Exp $
/* $Id: print.c,v 1.8 2000/02/27 02:08:33 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,10 +13,12 @@
#include <ddk/ntddk.h>
#include <string.h>
#include <internal/kd.h>
/* FUNCTIONS ****************************************************************/
#if 0
ULONG DbgService (ULONG Service, PVOID Context1, PVOID Context2);
__asm__ ("\n\t.global _DbgService\n\t"
"_DbgService:\n\t"
@ -25,6 +27,13 @@ __asm__ ("\n\t.global _DbgService\n\t"
"mov 12(%esp), %edx\n\t"
"int $0x2D\n\t"
"ret\n\t");
#endif
/*
* Note: DON'T CHANGE THIS FUNCTION!!!
* DON'T CALL HalDisplayString OR SOMETING ELSE!!!
* You'll only break the serial/bochs debugging feature!!!
*/
ULONG DbgPrint(PCH Format, ...)
{
@ -40,8 +49,8 @@ ULONG DbgPrint(PCH Format, ...)
DebugString.Length = vsprintf (Buffer, Format, ap);
va_end (ap);
HalDisplayString(Buffer);
KdpPrintString (&DebugString);
return (ULONG)DebugString.Length;
}

View file

@ -1,4 +1,4 @@
/* $Id: kdbg.c,v 1.5 2000/02/26 22:41:35 ea Exp $
/* $Id: kdbg.c,v 1.6 2000/02/27 02:08:53 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -47,6 +47,7 @@
#define SR_MCR_DTR 0x01
#define SR_MCR_RTS 0x02
#define SER_LSR(x) ((x)+5)
#define SR_LSR_DR 0x01
#define SR_LSR_TBE 0x20
#define SER_MSR(x) ((x)+6)
#define SR_MSR_CTS 0x10
@ -264,7 +265,10 @@ KdPortGetByte (
if (PortInitialized == FALSE)
return 0;
return (BYTE) 0;
if ((READ_PORT_UCHAR (SER_LSR(PortBase)) & SR_LSR_DR))
return (BYTE)READ_PORT_UCHAR (SER_RBR(PortBase));
return 0;
}
@ -275,7 +279,13 @@ KdPortPollByte (
VOID
)
{
return (BYTE) 0;
if (PortInitialized == FALSE)
return 0;
while ((READ_PORT_UCHAR (SER_LSR(PortBase)) & SR_LSR_DR) == 0)
;
return (BYTE)READ_PORT_UCHAR (SER_RBR(PortBase));
}

View file

@ -1,4 +1,4 @@
/* $Id: kdebug.c,v 1.5 2000/02/26 22:41:35 ea Exp $
/* $Id: kdebug.c,v 1.6 2000/02/27 02:09:40 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -48,15 +48,8 @@
/* VARIABLES ***************************************************************/
//BYTE STDCALL KdPortPollByte(VOID);
/* DATA */
BOOLEAN
KdDebuggerEnabled = FALSE;
BOOLEAN
KdDebuggerNotPresent = TRUE;
BOOLEAN KdDebuggerEnabled = FALSE; /* EXPORTED */
BOOLEAN KdDebuggerNotPresent = TRUE; /* EXPORTED */
/* PRIVATE FUNCTIONS ********************************************************/

View file

@ -1,4 +1,4 @@
/* $Id: service.c,v 1.1 2000/01/17 21:02:06 ekohl Exp $
/* $Id: service.c,v 1.2 2000/02/27 02:09:40 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -15,6 +15,12 @@
/* FUNCTIONS ***************************************************************/
/*
* Note: DON'T CHANGE THIS FUNCTION!!!
* DON'T CALL HalDisplayString OR SOMETING ELSE!!!
* You'll only break the serial/bochs debugging feature!!!
*/
ULONG
KdpServiceDispatcher (
ULONG Service,
@ -27,7 +33,6 @@ KdpServiceDispatcher (
{
case 1: /* DbgPrint */
Result = KdpPrintString ((PANSI_STRING)Context1);
// HalDisplayString (((PANSI_STRING)Context1)->Buffer);
break;
default:

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.36 2000/02/26 22:41:35 ea Exp $
/* $Id: main.c,v 1.37 2000/02/27 02:10:09 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,7 +17,6 @@
#include <internal/mm.h>
#include <string.h>
#include <internal/string.h>
#include <internal/symbol.h>
#include <internal/module.h>
#include <internal/ldr.h>
#include <internal/ex.h>

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.46 2000/02/26 22:41:34 ea Exp $
; $Id: ntoskrnl.def,v 1.47 2000/02/27 02:08:12 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -155,6 +155,9 @@ IoStartNextPacket
IoStartNextPacketByKey
IoStartTimer
IoStopTimer
KdDebuggerEnabled DATA
KdDebuggerNotPresent DATA
KdPollBreakIn@0
KeAddSystemServiceTable
KeBugCheck
KeBugCheckEx
@ -236,6 +239,12 @@ READ_REGISTER_USHORT
READ_REGISTER_BUFFER_UCHAR
READ_REGISTER_BUFFER_ULONG
READ_REGISTER_BUFFER_USHORT
;RtlAbsoluteToSelfRelativeSD
;RtlAddAccessAllowedAce
;RtlAddAce
;RtlAddAtomToAtomTable
;RtlAllocateAndInitializeSid
;RtlAllocateHeap
RtlAnsiCharToUnicodeChar@4
RtlAnsiStringToUnicodeSize@4
RtlAnsiStringToUnicodeString@12
@ -243,21 +252,56 @@ RtlAppendAsciizToString@8
RtlAppendStringToString@8
RtlAppendUnicodeStringToString@8
RtlAppendUnicodeToString@8
;RtlAreAllAccessesGranted
;RtlAreAnyAccessesGranted
;RtlAreBitsClear
;RtlAreBitsSet
;RtlAssert
;RtlCaptureStackBackTrace
RtlCharToInteger@12
;RtlCheckRegistryKey
;RtlClearAllBits
;RtlClearBits
RtlCompareMemory@12
RtlCompareMemoryUlong@12
RtlCompareString@12
RtlCompareUnicodeString@12
;RtlCompressBuffer
;RtlCompressChunks
RtlConvertLongToLargeInteger@4
;RtlConvertSidToUnicodeString
RtlConvertUlongToLargeInteger@4
RtlCopyLuid@8
RtlCopySid@12
RtlCopyString@8
RtlCopyUnicodeString@8
;RtlCreateAcl
;RtlCreateAtomTable
;RtlCreateHeap
;RtlCreateRegistryKey
;RtlCreateSecurityDescriptor
RtlCreateUnicodeString@8
;RtlCustomCPToUnicodeN
;RtlDecompressBuffer
;RtlDecompressChunks
;RtlDecompressFragment
;RtlDelete
;RtlDeleteAtomFromAtomTable
;RtlDeleteElementGenericTable
;RtlDeleteNoSplay
;RtlDeleteRegisterValue
;RtlDescribeChunk
;RtlDestroyAtomTable
;RtlDestroyHeap
RtlDowncaseUnicodeString@12
;RtlEmptyAtomTable
RtlEnlargedIntegerMultiply@8
RtlEnlargedUnsignedDivide@16
RtlEnlargedUnsignedMultiply@8
;RtlEnumerateGenericTable
;RtlEnumerateGenericTableWithoutSplaying
RtlEqualLuid@8
RtlEqualSid@8
RtlEqualString@12
RtlEqualUnicodeString@12
RtlExtendedIntegerMultiply@12
@ -265,15 +309,43 @@ RtlExtendedLargeIntegerDivide@16
RtlExtendedMagicDivide@20
RtlFillMemory@12
RtlFillMemoryUlong@12
;RtlFindClearBits
;RtlFindClearBitsAndSet
;RtlFindFirstRunClear
;RtlFindFirstRunSet
;RtlFindLongestRunClear
;RtlFindLongestRunSet
;RtlFindMessage
;RtlFindSetBits
;RtlFindSetBitsAndClear
;RtlFindUnicodePrefix
;RtlFormatCurrentUserKeyPath
RtlFreeAnsiString@4
;RtlFreeHeap
RtlFreeOemString@4
RtlFreeUnicodeString@4
;RtlGenerate8dot3Name
;RtlGetCallersAddress
;RtlGetCompressionWorkSpaceSize
;RtlGetDaclSecurityDescriptor
RtlGetDefaultCodePage@8
;RtlGetElementGenericTable
;RtlGetGroupSecurityDescriptor
;RtlGetOwnerSecurityDescriptor
;RtlImageNtHeader@4
RtlInitAnsiString@8
;RtlInitCodePageTable
RtlInitString@8
RtlInitUnicodeString@8
;RtlInitializeBitmap
;RtlInitializeGenericTable
RtlInitializeSid@12
;RtlInitializeUnicodePrefix
;RtlInsertElementGenericTable
;RtlInsertUnicodePrefix
RtlIntegerToChar@16
RtlIntegerToUnicodeString@12
;RtlIsNamelegalDOS8Dot3
RtlLargeIntegerAdd@16
RtlLargeIntegerArithmeticShift@12
RtlLargeIntegerDivide@20
@ -281,34 +353,76 @@ RtlLargeIntegerNegate@8
RtlLargeIntegerShiftLeft@12
RtlLargeIntegerShiftRight@12
RtlLargeIntegerSubtract@16
RtlLengthRequiredSid@4
;RtlLengthRequiredSecurityDescriptor
RtlLengthSid@4
;RtlLookupAtomInAtomTable
;RtlLookupElementGenericTable
;RtlMapGenericMask
RtlMoveMemory@12
RtlMultiByteToUnicodeN@20
RtlMultiByteToUnicodeSize@12
;RtlNextUnicodePrefix
;RtlNtStatusToDosError
;RtlNtStatusToDosErrorNoTeb
;RtlNumberGenericTableElements
;RtlNumberOfClearBits
;RtlNumberOfSetBits
;RtlOemStringToCountedUnicodeString
RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString@12
RtlOemToUnicodeN@20
;RtlPinAtomInAtomTable
;RtlPrefixString
;RtlPrefixUnicodeString
;RtlQueryAtominAtomTable
;RtlQueryRegistryValues
;RtlQueryTimeZoneInformation
;RtlRaiseException
;RtlRandom
;RtlRemoveUnicodePrefix
;RtlReserveChunk
RtlSecondsSince1970ToTime@8
RtlSecondsSince1980ToTime@8
;RtlSetAllBits
;RtlSetBits
;RtlSetDaclSecurityDescriptor
;RtlSetGroupSecurityDescriptor
;RtlSetOwnerSecurityDescriptor
;RtlSetSaclSecurityDescriptor
;RtlSetTimeZoneInformation
;RtlSplay
RtlSubAuthorityCountSid@4
RtlSubAuthoritySid@8
RtlTimeFieldsToTime@8
RtlTimeToSecondsSince1970@8
RtlTimeToSecondsSince1980@8
RtlTimeToTimeFields@8
RtlUnicodeStringToAnsiSize@4
RtlUnicodeStringToAnsiString@12
;RtlUnicodeStringToCountedOemString
RtlUnicodeStringToInteger@12
RtlUnicodeStringToOemSize@4
RtlUnicodeStringToOemString@12
;RtlUnicodeToCustomCPN
RtlUnicodeToMultiByteN@20
RtlUnicodeToMultiByteSize@12
RtlUnicodeToOemN@20
;RtlUnwind
RtlUpcaseUnicodeChar@4
RtlUpcaseUnicodeString@12
RtlUpcaseUnicodeStringToAnsiString@12
;RtlUpcaseUnicodeStringToCountedOemString
RtlUpcaseUnicodeStringToOemString@12
;RtlUpcaseUnicodeToCustomCPN
RtlUpcaseUnicodeToMultiByteN@20
RtlUpcaseUnicodeToOemN@20
RtlUpperChar@4
RtlUpperString@8
;RtlValidSecurityDescriptor
RtlValidSid@4
;RtlWriteRegistryValue
;RtlZeroHeap
RtlZeroMemory@8
RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize@4
@ -539,7 +653,6 @@ HalSetRealTimeClock
;IoSetPartitionInformation
;IoWritePartitionTable
KdComPortInUse DATA
KdPollBreakIn@0
KdPortGetByte@0
KdPortInitialize@12
KdPortPollByte@0

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.33 2000/02/26 22:41:34 ea Exp $
; $Id: ntoskrnl.edf,v 1.34 2000/02/27 02:08:12 ekohl Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -155,6 +155,9 @@ IoStartNextPacket
IoStartNextPacketByKey
IoStartTimer
IoStopTimer
KdDebuggerEnabled DATA
KdDebuggerNotPresent DATA
KdPollBreakIn=KdPollBreakIn@0
KeAddSystemServiceTable
KeBugCheck
KeBugCheckEx
@ -245,11 +248,13 @@ RtlAppendUnicodeStringToString=RtlAppendUnicodeStringToString@8
RtlAppendUnicodeToString=RtlAppendUnicodeToString@8
RtlCharToInteger=RtlCharToInteger@12
RtlCompareMemory=RtlCompareMemory@12
RtlCompareMemoryUlong=RtlCompareMemoryUlong@12
RtlCompareString=RtlCompareString@12
RtlCompareUnicodeString=RtlCompareUnicodeString@12
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
RtlCopyLuid=RtlCopyLuid@8
RtlCopySid=RtlCopySid@12
RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlCreateUnicodeString=RtlCreateUnicodeString@8
@ -258,6 +263,7 @@ RtlEnlargedIntegerMultiply=RtlEnlargedIntegerMultiply@8
RtlEnlargedUnsignedDivide=RtlEnlargedUnsignedDivide@16
RtlEnlargedUnsignedMultiply=RtlEnlargedUnsignedMultiply@8
RtlEqualLuid=RtlEqualLuid@8
RtlEqualSid=RtlEqualSid@8
RtlEqualString=RtlEqualString@12
RtlEqualUnicodeString=RtlEqualUnicodeString@12
RtlExtendedIntegerMultiply=RtlExtendedIntegerMultiply@12
@ -269,9 +275,11 @@ RtlFreeAnsiString=RtlFreeAnsiString@4
RtlFreeOemString=RtlFreeOemString@4
RtlFreeUnicodeString=RtlFreeUnicodeString@4
RtlGetDefaultCodePage=RtlGetDefaultCodePage@8
;RtlImageNtHeader=RtlImageNtHeader@4
RtlInitAnsiString=RtlInitAnsiString@8
RtlInitString=RtlInitString@8
RtlInitUnicodeString=RtlInitUnicodeString@8
RtlInitializeSid=RtlInitializeSid@12
RtlIntegerToChar=RtlIntegerToChar@16
RtlIntegerToUnicodeString=RtlIntegerToUnicodeString@12
RtlLargeIntegerAdd=RtlLargeIntegerAdd@16
@ -281,6 +289,8 @@ RtlLargeIntegerNegate=RtlLargeIntegerNegate@8
RtlLargeIntegerShiftLeft=RtlLargeIntegerShiftLeft@12
RtlLargeIntegerShiftRight=RtlLargeIntegerShiftRight@12
RtlLargeIntegerSubtract=RtlLargeIntegerSubtract@16
RtlLengthRequiredSid=RtlLengthRequiredSid@4
RtlLengthSid=RtlLengthSid@4
RtlMoveMemory=RtlMoveMemory@12
RtlMultiByteToUnicodeN=RtlMultiByteToUnicodeN@20
RtlMultiByteToUnicodeSize=RtlMultiByteToUnicodeSize@12
@ -288,6 +298,8 @@ RtlOemStringToUnicodeSize=RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString=RtlOemStringToUnicodeString@12
RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8
RtlSecondsSince1980ToTime=RtlSecondsSince1980ToTime@8
RtlSubAuthorityCountSid=RtlSubAuthorityCountSid@4
RtlSubAuthoritySid=RtlSubAuthoritySid@8
RtlTimeFieldsToTime=RtlTimeFieldsToTime@8
RtlTimeToSecondsSince1970=RtlTimeToSecondsSince1970@8
RtlTimeToSecondsSince1980=RtlTimeToSecondsSince1980@8
@ -307,6 +319,7 @@ RtlUpcaseUnicodeToMultiByteN=RtlUpcaseUnicodeToMultiByteN@20
RtlUpcaseUnicodeToOemN=RtlUpcaseUnicodeToOemN@20
RtlUpperChar=RtlUpperChar@4
RtlUpperString=RtlUpperString@8
RtlValidSid=RtlValidSid@4
RtlZeroMemory=RtlZeroMemory@8
RtlxAnsiStringToUnicodeSize=RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize=RtlxOemStringToUnicodeSize@4
@ -537,7 +550,6 @@ HalSetRealTimeClock
;IoSetPartitionInformation
;IoWritePartitionTable
KdComPortInUse DATA
KdPollBreakIn=KdPollBreakIn@0
KdPortGetByte=KdPortGetByte@0
KdPortInitialize=KdPortInitialize@12
KdPortPollByte=KdPortPollByte@0

View file

@ -21,6 +21,8 @@ typedef struct
ULONG ProcessId;
} CSRSS_PROCESS_DATA, *PCSRSS_PROCESS_DATA;
VOID CsrInitProcessData(VOID);
NTSTATUS CsrCreateProcess (PCSRSS_PROCESS_DATA ProcessData,
PCSRSS_API_REQUEST LpcMessage);

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.4 1999/12/30 01:51:42 dwelch Exp $
/* $Id: process.c,v 1.5 2000/02/27 02:12:07 ekohl Exp $
*
* reactos/subsys/csrss/api/process.c
*
@ -22,13 +22,24 @@ static PCSRSS_PROCESS_DATA ProcessData[256];
/* FUNCTIONS *****************************************************************/
VOID CsrInitProcessData(VOID)
{
ULONG i;
for (i=0; i<256; i++)
{
ProcessData[i] = NULL;
}
}
PCSRSS_PROCESS_DATA CsrGetProcessData(ULONG ProcessId)
{
ULONG i;
for (i=0; i<NrProcess; i++)
for (i=0; i<256/*NrProcess*/; i++)
{
if (ProcessData[i]->ProcessId == ProcessId)
if (ProcessData[i] &&
ProcessData[i]->ProcessId == ProcessId)
{
return(ProcessData[i]);
}
@ -62,7 +73,7 @@ NTSTATUS CsrCreateProcess (PCSRSS_PROCESS_DATA ProcessData,
if (Request->Flags & DETACHED_PROCESS)
{
NewProcessData->Console = NULL;
NewProcessData->Console = NULL;
}
else if (Request->Flags & CREATE_NEW_CONSOLE)
{

View file

@ -1,4 +1,4 @@
/* $Id: wapi.c,v 1.2 1999/12/30 01:51:42 dwelch Exp $
/* $Id: wapi.c,v 1.3 2000/02/27 02:12:07 ekohl Exp $
*
* reactos/subsys/csrss/init.c
*
@ -123,7 +123,9 @@ void Thread_Api(PVOID PortHandle)
PrintString("Failed to create private heap, aborting\n");
return;
}
CsrInitProcessData();
for (;;)
{
Status = NtListenPort(PortHandle, &Request);
@ -170,4 +172,4 @@ void Thread_Api(PVOID PortHandle)
}
}
}

View file

@ -1,4 +1,4 @@
/* $Id: csrss.c,v 1.4 1999/12/30 01:51:41 dwelch Exp $
/* $Id: csrss.c,v 1.5 2000/02/27 02:11:54 ekohl Exp $
*
* csrss.c - Client/Server Runtime subsystem
*
@ -32,37 +32,88 @@
* actually does nothing but running).
*/
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <csrss/csrss.h>
BOOL TerminationRequestPending = FALSE;
BOOL InitializeServer(void);
VOID PrintString (char* fmt, ...);
/* Native process' entry point */
VOID NtProcessStartup(PPEB Peb)
{
PRTL_USER_PROCESS_PARAMETERS ProcParams;
PWSTR ArgBuffer;
PWSTR *argv;
ULONG argc = 0;
int i = 0;
int afterlastspace = 0;
DisplayString(L"Client/Server Runtime Subsystem\n");
if (InitializeServer() == TRUE)
ProcParams = RtlNormalizeProcessParams (Peb->ProcessParameters);
argv = (PWSTR *)RtlAllocateHeap (Peb->ProcessHeap,
0, 512 * sizeof(PWSTR));
ArgBuffer = (PWSTR)RtlAllocateHeap (Peb->ProcessHeap,
0,
ProcParams->CommandLine.Length + sizeof(WCHAR));
memcpy (ArgBuffer,
ProcParams->CommandLine.Buffer,
ProcParams->CommandLine.Length + sizeof(WCHAR));
while (ArgBuffer[i])
{
while (FALSE == TerminationRequestPending)
if (ArgBuffer[i] == L' ')
{
/* Do nothing! Should it
* be the SbApi port's
* thread instead?
*/
NtYieldExecution();
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
i++;
while (ArgBuffer[i] == L' ')
i++;
afterlastspace = i;
}
else
{
i++;
}
}
if (ArgBuffer[afterlastspace] != L'\0')
{
argc++;
ArgBuffer[i] = L'\0';
argv[argc-1] = &(ArgBuffer[afterlastspace]);
}
if (CsrServerInitialization (argc, argv) == TRUE)
{
DisplayString( L"CSR: Subsystem initialized.\n" );
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/* terminate the current thread only */
NtTerminateThread( NtCurrentThread(), 0 );
}
else
{
DisplayString( L"CSR: Subsystem initialization failed.\n" );
RtlFreeHeap (Peb->ProcessHeap,
0, argv);
RtlFreeHeap (Peb->ProcessHeap,
0,
ArgBuffer);
/*
* Tell SM we failed.
*/
NtTerminateProcess( NtCurrentProcess(), 0 );
}
NtTerminateProcess( NtCurrentProcess(), 0 );
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: init.c,v 1.4 1999/12/30 01:51:41 dwelch Exp $
/* $Id: init.c,v 1.5 2000/02/27 02:11:54 ekohl Exp $
*
* reactos/subsys/csrss/init.c
*
@ -23,9 +23,57 @@
*/
static HANDLE ApiPortHandle;
HANDLE CsrInitEvent = INVALID_HANDLE_VALUE;
HANDLE CsrHeap = INVALID_HANDLE_VALUE;
HANDLE CsrObjectDirectory = INVALID_HANDLE_VALUE;
HANDLE CsrApiPort = INVALID_HANDLE_VALUE;
HANDLE CsrSbApiPort = INVALID_HANDLE_VALUE;
UNICODE_STRING CsrDirectoryName;
static NTSTATUS
CsrParseCommandLine (
ULONG ArgumentCount,
PWSTR *ArgumentArray
)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES Attributes;
ANSI_STRING AnsiString;
ULONG i;
DbgPrint ("Arguments: %ld\n", ArgumentCount);
for (i = 0; i < ArgumentCount; i++)
{
DbgPrint ("Argument %ld: %S\n", i, ArgumentArray[i]);
}
/* create object directory ('\Windows') */
RtlCreateUnicodeString (&CsrDirectoryName,
L"\\Windows");
InitializeObjectAttributes (&Attributes,
&CsrDirectoryName,
0,
NULL,
NULL);
Status = NtCreateDirectoryObject(&CsrObjectDirectory,
0xF000F,
&Attributes);
return Status;
}
/**********************************************************************
* NAME
* InitializeServer
* CsrServerInitialization
*
* DESCRIPTION
* Create a directory object (\windows) and two named LPC ports:
@ -36,12 +84,24 @@ static HANDLE ApiPortHandle;
* RETURN VALUE
* TRUE: Initialization OK; otherwise FALSE.
*/
BOOL InitializeServer(void)
BOOL
STDCALL
CsrServerInitialization (
ULONG ArgumentCount,
PWSTR *ArgumentArray
)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObAttributes;
UNICODE_STRING PortName;
Status = CsrParseCommandLine (ArgumentCount, ArgumentArray);
if (!NT_SUCCESS(Status))
{
PrintString("Unable to parse the command line (Status: %x)\n", Status);
return(FALSE);
}
/* NEW NAMED PORT: \ApiPort */
RtlInitUnicodeString(&PortName, L"\\Windows\\ApiPort");
InitializeObjectAttributes(&ObAttributes,
@ -49,6 +109,7 @@ BOOL InitializeServer(void)
0,
NULL,
NULL);
Status = NtCreatePort(&ApiPortHandle,
&ObAttributes,
260,
@ -80,5 +141,4 @@ BOOL InitializeServer(void)
return TRUE;
}
/* EOF */

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.4 1999/12/30 01:51:41 dwelch Exp $
# $Id: makefile,v 1.5 2000/02/27 02:11:54 ekohl Exp $
#
# CSRSS: Client/server runtime subsystem
#
@ -43,6 +43,27 @@ $(TARGET).exe: $(OBJECTS) $(LIBS)
--subsystem native
$(NM) --numeric-sort $(TARGET).exe > $(TARGET).sym
floppy: $(FLOPPY_DIR)/subsys/$(TARGET).exe
$(FLOPPY_DIR)/subsys/$(TARGET).exe: $(TARGET).exe
ifeq ($(DOSCLI),yes)
$(CP) $(TARGET).exe $(FLOPPY_DIR)\subsys\$(TARGET).exe
else
$(CP) $(TARGET).exe $(FLOPPY_DIR)/subsys/$(TARGET).exe
endif
dist: $(DIST_DIR)/subsys/$(TARGET).exe
$(DIST_DIR)/subsys/$(TARGET).exe: $(TARGET).exe
ifeq ($(DOSCLI),yes)
$(CP) $(TARGET).exe ..\..\$(DIST_DIR)\subsys\$(TARGET).exe
else
$(CP) $(TARGET).exe ../../$(DIST_DIR)/subsys/$(TARGET).exe
endif
include ../../rules.mak
# EOF