- added environment functions

- moved ntdll-only prototypes into ntdll header file

svn path=/trunk/; revision=809
This commit is contained in:
Eric Kohl 1999-12-01 15:18:54 +00:00
parent 3bee100dae
commit 13436cd7f7
13 changed files with 892 additions and 350 deletions

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.19 1999/11/27 03:29:20 ekohl Exp $
/* $Id: rtl.h,v 1.20 1999/12/01 15:17:12 ekohl Exp $
*
*/
@ -60,6 +60,12 @@ typedef struct _RTL_BITMAP
PULONG Buffer;
} RTL_BITMAP, *PRTL_BITMAP;
typedef struct {
ULONG Length;
ULONG Unknown[11];
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
/*
* PURPOSE: Flags for RtlQueryRegistryValues
*/
@ -124,12 +130,12 @@ extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG;
/*
* VOID
* InitializeObjectAttributes (
* POBJECT_ATTRIBUTES InitializedAttributes,
* PUNICODE_STRING ObjectName,
* ULONG Attributes,
* HANDLE RootDirectory,
* PSECURITY_DESCRIPTOR SecurityDescriptor
* );
* POBJECT_ATTRIBUTES InitializedAttributes,
* PUNICODE_STRING ObjectName,
* ULONG Attributes,
* HANDLE RootDirectory,
* PSECURITY_DESCRIPTOR SecurityDescriptor
* );
*
* FUNCTION: Sets up a parameter of type OBJECT_ATTRIBUTES for a
* subsequent call to ZwCreateXXX or ZwOpenXXX
@ -152,7 +158,6 @@ extern BOOLEAN NLS_MB_OEM_CODE_PAGE_TAG;
(p)->SecurityQualityOfService = NULL; \
}
VOID
InitializeListHead (
PLIST_ENTRY ListHead
@ -272,6 +277,13 @@ RtlCheckRegistryKey (
PWSTR Path
);
UINT
STDCALL
RtlCompactHeap (
HANDLE hheap,
DWORD flags
);
ULONG
STDCALL
RtlCompareMemory (
@ -336,6 +348,17 @@ RtlCopyUnicodeString (
PUNICODE_STRING SourceString
);
HANDLE
STDCALL
RtlCreateHeap (
ULONG Flags,
PVOID BaseAddress,
ULONG SizeToReserve,
ULONG SizeToCommit,
PVOID Unknown,
PRTL_HEAP_DEFINITION Definition
);
NTSTATUS
STDCALL
RtlCreateRegistryKey (
@ -371,6 +394,12 @@ RtlDeleteRegistryValue (
PWSTR ValueName
);
BOOL
STDCALL
RtlDestroyHeap (
HANDLE hheap
);
NTSTATUS
STDCALL
RtlDowncaseUnicodeString (
@ -417,13 +446,6 @@ RtlEqualUnicodeString (
BOOLEAN CaseInSensitive
);
/* RtlEraseUnicodeString is exported by ntdll.dll only! */
VOID
STDCALL
RtlEraseUnicodeString (
IN PUNICODE_STRING String
);
LARGE_INTEGER
STDCALL
RtlExtendedIntegerMultiply (
@ -469,6 +491,14 @@ RtlFreeAnsiString (
PANSI_STRING AnsiString
);
BOOLEAN
STDCALL
RtlFreeHeap (
HANDLE Heap,
ULONG Flags,
PVOID Address
);
VOID
STDCALL
RtlFreeOemString (
@ -481,6 +511,11 @@ RtlFreeUnicodeString (
PUNICODE_STRING UnicodeString
);
VOID
RtlGetCallersAddress (
PVOID * CallersAddress
);
VOID
STDCALL
RtlGetDefaultCodePage (
@ -488,6 +523,12 @@ RtlGetDefaultCodePage (
PUSHORT OemCodePage
);
HANDLE
STDCALL
RtlGetProcessHeap (
VOID
);
VOID
STDCALL
RtlInitAnsiString (
@ -543,19 +584,19 @@ RtlLargeIntegerAdd (
LARGE_INTEGER Addend2
);
/*
* VOID
* RtlLargeIntegerAnd (
* PLARGE_INTEGER Result,
* LARGE_INTEGER Source,
* LARGE_INTEGER Mask
* );
*/
#define RtlLargeIntegerAnd(Result, Source, Mask) \
{ \
Result.HighPart = Source.HighPart & Mask.HighPart; \
Result.LowPart = Source.LowPart & Mask.LowPart; \
}
/*
VOID
RtlLargeIntegerAnd (
PLARGE_INTEGER Result,
LARGE_INTEGER Source,
LARGE_INTEGER Mask
);
*/
LARGE_INTEGER
STDCALL
@ -572,105 +613,105 @@ RtlLargeIntegerDivide (
PLARGE_INTEGER Remainder
);
/*
* BOOLEAN
* RtlLargeIntegerEqualTo (
* LARGE_INTEGER Operand1,
* LARGE_INTEGER Operand2
* );
*/
#define RtlLargeIntegerEqualTo(X,Y) \
(!(((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)))
/*
BOOLEAN
RtlLargeIntegerEqualTo (
LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2
);
*/
/*
* BOOLEAN
* RtlLargeIntegerEqualToZero (
* LARGE_INTEGER Operand
* );
*/
#define RtlLargeIntegerEqualToZero(X) \
(!((X).LowPart | (X).HighPart))
/*
BOOLEAN
RtlLargeIntegerEqualToZero (
LARGE_INTEGER Operand
);
*/
/*
* BOOLEAN
* RtlLargeIntegerGreaterThan (
* LARGE_INTEGER Operand1,
* LARGE_INTEGER Operand2
* );
*/
#define RtlLargeIntegerGreaterThan(X,Y) \
((((X).HighPart == (Y).HighPart) && ((X).LowPart > (Y).LowPart)) || \
((X).HighPart > (Y).HighPart))
/*
BOOLEAN
RtlLargeIntegerGreaterThan (
LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2
);
*/
/*
* BOOLEAN
* RtlLargeIntegerGreaterThanOrEqualTo (
* LARGE_INTEGER Operand1,
* LARGE_INTEGER Operand2
* );
*/
#define RtlLargeIntegerGreaterThanOrEqualTo(X,Y) \
((((X).HighPart == (Y).HighPart) && ((X).LowPart >= (Y).LowPart)) || \
((X).HighPart > (Y).HighPart))
/*
BOOLEAN
RtlLargeIntegerGreaterThanOrEqualTo (
LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2
);
*/
/*
* BOOLEAN
* RtlLargeIntegerGreaterThanOrEqualToZero (
* LARGE_INTEGER Operand1
* );
*/
#define RtlLargeIntegerGreaterOrEqualToZero(X) \
((X).HighPart >= 0)
/*
BOOLEAN
RtlLargeIntegerGreaterThanOrEqualToZero (
LARGE_INTEGER Operand1
);
*/
/*
* BOOLEAN
* RtlLargeIntegerGreaterThanZero (
* LARGE_INTEGER Operand1
* );
*/
#define RtlLargeIntegerGreaterThanZero(X) \
((((X).HighPart == 0) && ((X).LowPart > 0)) || \
((X).HighPart > 0 ))
/*
BOOLEAN
RtlLargeIntegerGreaterThanZero (
LARGE_INTEGER Operand1
);
*/
/*
* BOOLEAN
* RtlLargeIntegerLessThan (
* LARGE_INTEGER Operand1,
* LARGE_INTEGER Operand2
* );
*/
#define RtlLargeIntegerLessThan(X,Y) \
((((X).HighPart == (Y).HighPart) && ((X).LowPart < (Y).LowPart)) || \
((X).HighPart < (Y).HighPart))
/*
BOOLEAN
RtlLargeIntegerLessThan (
LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2
);
*/
/*
* BOOLEAN
* RtlLargeIntegerLessThanOrEqualTo (
* LARGE_INTEGER Operand1,
* LARGE_INTEGER Operand2
* );
*/
#define RtlLargeIntegerLessThanOrEqualTo(X,Y) \
((((X).HighPart == (Y).HighPart) && ((X).LowPart <= (Y).LowPart)) || \
((X).HighPart < (Y).HighPart))
/*
BOOLEAN
RtlLargeIntegerLessThanOrEqualTo (
LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2
);
*/
/*
* BOOLEAN
* RtlLargeIntegerLessThanOrEqualToZero (
* LARGE_INTEGER Operand
* );
*/
#define RtlLargeIntegerLessOrEqualToZero(X) \
(((X).HighPart < 0) || !((X).LowPart | (X).HighPart))
/*
BOOLEAN
RtlLargeIntegerLessThanOrEqualToZero (
LARGE_INTEGER Operand
);
*/
/*
* BOOLEAN
* RtlLargeIntegerLessThanZero (
* LARGE_INTEGER Operand
* );
*/
#define RtlLargeIntegerLessThanZero(X) \
(((X).HighPart < 0))
/*
BOOLEAN
RtlLargeIntegerLessThanZero (
LARGE_INTEGER Operand
);
*/
LARGE_INTEGER
STDCALL
@ -678,24 +719,24 @@ RtlLargeIntegerNegate (
LARGE_INTEGER Subtrahend
);
/*
* BOOLEAN
* RtlLargeIntegerNotEqualTo (
* LARGE_INTEGER Operand1,
* LARGE_INTEGER Operand2
* );
*/
#define RtlLargeIntegerNotEqualTo(X,Y) \
((((X).LowPart ^ (Y).LowPart) | ((X).HighPart ^ (Y).HighPart)))
/*
BOOLEAN
RtlLargeIntegerNotEqualTo (
LARGE_INTEGER Operand1,
LARGE_INTEGER Operand2
);
*/
/*
* BOOLEAN
* RtlLargeIntegerNotEqualToZero (
* LARGE_INTEGER Operand
* );
*/
#define RtlLargeIntegerNotEqualToZero(X) \
(((X).LowPart | (X).HighPart))
/*
BOOLEAN
RtlLargeIntegerNotEqualToZero (
LARGE_INTEGER Operand
);
*/
LARGE_INTEGER
STDCALL
@ -723,6 +764,12 @@ RtlLengthSecurityDescriptor (
PSECURITY_DESCRIPTOR SecurityDescriptor
);
BOOL
STDCALL
RtlLockHeap (
HANDLE hheap
);
VOID
STDCALL
RtlMoveMemory (
@ -749,6 +796,11 @@ RtlMultiByteToUnicodeSize (
ULONG MbSize
);
DWORD
RtlNtStatusToDosError (
NTSTATUS StatusCode
);
ULONG
STDCALL
RtlOemStringToUnicodeSize (
@ -766,11 +818,11 @@ RtlOemStringToUnicodeString (
NTSTATUS
STDCALL
RtlOemToUnicodeN (
PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR OemString,
ULONG OemSize
PWCHAR UnicodeString,
ULONG UnicodeSize,
PULONG ResultSize,
PCHAR OemString,
ULONG OemSize
);
NTSTATUS
@ -783,6 +835,15 @@ RtlQueryRegistryValues (
PVOID Environment
);
LPVOID
STDCALL
RtlReAllocateHeap (
HANDLE hheap,
DWORD flags,
LPVOID ptr,
DWORD size
);
VOID
RtlRetrieveUlong (
PULONG DestinationAddress,
@ -803,12 +864,33 @@ RtlSetDaclSecurityDescriptor (
BOOLEAN DaclDefaulted
);
DWORD
STDCALL
RtlSizeHeap (
HANDLE hheap,
DWORD flags,
PVOID pmem
);
PWSTR
RtlStrtok (
PUNICODE_STRING _string,
PWSTR _sep,
PWSTR * temp
);
VOID
RtlStoreLong (
PULONG Address,
ULONG Value
);
VOID
RtlStoreUlong (
PULONG Address,
ULONG Value
);
VOID
RtlStoreUshort (
PUSHORT Address,
@ -827,52 +909,6 @@ RtlTimeToTimeFields (
PTIME_FIELDS TimeFields
);
PWSTR
RtlStrtok (
PUNICODE_STRING _string,
PWSTR _sep,
PWSTR * temp
);
VOID
RtlGetCallersAddress (
PVOID * CallersAddress
);
VOID
STDCALL
RtlZeroMemory (
PVOID Destination,
ULONG Length
);
typedef struct {
ULONG Length;
ULONG Unknown[11];
} RTL_HEAP_DEFINITION, *PRTL_HEAP_DEFINITION;
// Heap creation routine
HANDLE
STDCALL
RtlCreateHeap (
ULONG Flags,
PVOID BaseAddress,
ULONG SizeToReserve,
ULONG SizeToCommit,
PVOID Unknown,
PRTL_HEAP_DEFINITION Definition
);
BOOLEAN
STDCALL
RtlFreeHeap (
HANDLE Heap,
ULONG Flags,
PVOID Address
);
ULONG
STDCALL
RtlUnicodeStringToAnsiSize (
@ -912,29 +948,35 @@ RtlUnicodeStringToOemString (
NTSTATUS
STDCALL
RtlUnicodeToMultiByteN (
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
PCHAR MbString,
ULONG MbSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
);
NTSTATUS
STDCALL
RtlUnicodeToMultiByteSize (
PULONG MbSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
PULONG MbSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
);
NTSTATUS
STDCALL
RtlUnicodeToOemN (
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
PCHAR OemString,
ULONG OemSize,
PULONG ResultSize,
PWCHAR UnicodeString,
ULONG UnicodeSize
);
BOOL
STDCALL
RtlUnlockHeap (
HANDLE hheap
);
WCHAR
@ -1000,6 +1042,14 @@ RtlUpperString (
PSTRING SourceString
);
BOOL
STDCALL
RtlValidateHeap (
HANDLE hheap,
DWORD flags,
PVOID pmem
);
BOOLEAN
RtlValidSecurityDescriptor (
PSECURITY_DESCRIPTOR SecurityDescriptor
@ -1017,71 +1067,10 @@ RtlWriteRegistryValue (
);
VOID
RtlStoreUlong (
PULONG Address,
ULONG Value
);
DWORD
RtlNtStatusToDosError (
NTSTATUS StatusCode
);
BOOL
STDCALL
RtlDestroyHeap (
HANDLE hheap
);
LPVOID
STDCALL
RtlReAllocateHeap (
HANDLE hheap,
DWORD flags,
LPVOID ptr,
DWORD size
);
HANDLE
STDCALL
RtlGetProcessHeap (VOID);
BOOL
STDCALL
RtlLockHeap (
HANDLE hheap
);
BOOL
WINAPI
RtlUnlockHeap (
HANDLE hheap
);
UINT
STDCALL
RtlCompactHeap (
HANDLE hheap,
DWORD flags
);
DWORD
WINAPI
RtlSizeHeap (
HANDLE hheap,
DWORD flags,
PVOID pmem
);
BOOL
WINAPI
RtlValidateHeap (
HANDLE hheap,
DWORD flags,
PVOID pmem
RtlZeroMemory (
PVOID Destination,
ULONG Length
);
ULONG
@ -1109,48 +1098,6 @@ RtlxUnicodeStringToOemSize (
);
/* NtProcessStartup */
VOID
WINAPI
RtlDestroyProcessParameters(
IN OUT PSTARTUP_ARGUMENT pArgument
);
VOID
WINAPI
RtlDenormalizeProcessParams (
IN OUT PSTARTUP_ARGUMENT pArgument
);
NTSTATUS STDCALL
RtlCreateUserThread(
IN HANDLE ProcessHandle,
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN BOOLEAN CreateSuspended,
IN LONG StackZeroBits,
IN OUT PULONG StackReserved,
IN OUT PULONG StackCommit,
IN PTHREAD_START_ROUTINE StartAddress,
IN PVOID Parameter,
IN OUT PHANDLE ThreadHandle,
IN OUT PCLIENT_ID ClientId
);
NTSTATUS
STDCALL
RtlCreateUserProcess(PUNICODE_STRING ApplicationName,
PSECURITY_DESCRIPTOR ProcessSd,
PSECURITY_DESCRIPTOR ThreadSd,
WINBOOL bInheritHandles,
DWORD dwCreationFlags,
PCLIENT_ID ClientId,
PHANDLE ProcessHandle,
PHANDLE ThreadHandle);
/* functions exported from NTOSKRNL.EXE which are considered RTL */
#if 0
_stricmp
@ -1171,8 +1118,8 @@ wchar_t * _wcsrev(wchar_t *s);
wchar_t *_wcsupr(wchar_t *x);
#if 0
;atoi
;atol
atoi
atol
isdigit
islower
isprint

View file

@ -1,3 +1,7 @@
/* $Id: rtl.h,v 1.4 1999/12/01 15:16:56 ekohl Exp $
*
*/
VOID
WINAPI
__RtlInitHeap (
@ -34,3 +38,111 @@ RtlCompactHeap (
HANDLE heap,
DWORD flags
);
VOID
STDCALL
RtlEraseUnicodeString (
IN PUNICODE_STRING String
);
VOID
STDCALL
RtlAcquirePebLock (
VOID
);
VOID
STDCALL
RtlReleasePebLock (
VOID
);
NTSTATUS
STDCALL
RtlCreateEnvironment (
BOOLEAN Inherit,
PVOID *Environment
);
VOID
STDCALL
RtlDestroyEnvironment (
PVOID Environment
);
VOID
STDCALL
RtlSetCurrentEnvironment (
PVOID NewEnvironment,
PVOID *OldEnvironment
);
NTSTATUS
STDCALL
RtlSetEnvironmentVariable (
PVOID *Environment,
PUNICODE_STRING Name,
PUNICODE_STRING Value
);
NTSTATUS
STDCALL
RtlQueryEnvironmentVariable_U (
PVOID Environment,
PUNICODE_STRING Name,
PUNICODE_STRING Value
);
NTSTATUS
STDCALL
RtlCreateUserThread (
IN HANDLE ProcessHandle,
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN BOOLEAN CreateSuspended,
IN LONG StackZeroBits,
IN OUT PULONG StackReserved,
IN OUT PULONG StackCommit,
IN PTHREAD_START_ROUTINE StartAddress,
IN PVOID Parameter,
IN OUT PHANDLE ThreadHandle,
IN OUT PCLIENT_ID ClientId
);
VOID
STDCALL
RtlDeNormalizeProcessParams (
IN OUT PSTARTUP_ARGUMENT pArgument
);
VOID
STDCALL
RtlDestroyProcessParameters (
IN OUT PSTARTUP_ARGUMENT pArgument
);
VOID
STDCALL
RtlNormalizeProcessParams (
IN OUT PSTARTUP_ARGUMENT pArgument
);
/* Preliminary prototype!! */
NTSTATUS
STDCALL
RtlCreateUserProcess (
PUNICODE_STRING ApplicationName,
PSECURITY_DESCRIPTOR ProcessSd,
PSECURITY_DESCRIPTOR ThreadSd,
WINBOOL bInheritHandles,
DWORD dwCreationFlags,
PCLIENT_ID ClientId,
PHANDLE ProcessHandle,
PHANDLE ThreadHandle
);
/* EOF */

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.25 1999/11/27 03:32:17 ekohl Exp $
; $Id: ntdll.def,v 1.26 1999/12/01 15:16:04 ekohl Exp $
;
; ReactOS Operating System
;
@ -428,6 +428,7 @@ ZwWriteRequestData@24
ZwWriteVirtualMemory@20
ZwW32Call@20
ZwYieldExecution@0
RtlAcquirePebLock@0
RtlAllocateHeap@12
RtlAnsiCharToUnicodeChar@4
RtlAnsiStringToUnicodeSize@4
@ -437,6 +438,7 @@ RtlAppendStringToString@12
RtlAppendUnicodeStringToString@12
RtlAppendUnicodeToString@12
RtlCharToInteger@12
RtlCreateEnvironment@8
RtlCreateHeap@24
RtlCreateUnicodeString@8
RtlCreateUnicodeStringFromAsciiz@8
@ -449,6 +451,7 @@ RtlConvertLongToLargeInteger@4
RtlConvertUlongToLargeInteger@4
RtlCopyString@8
RtlCopyUnicodeString@8
RtlDestroyEnvironment@4
RtlDestroyHeap@4
RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply@8
@ -487,7 +490,10 @@ RtlNtStatusToDosError
RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString@12
RtlOemToUnicodeN@20
RtlQueryEnvironmentVariable_U@12
RtlReAllocateHeap@16
RtlReleasePebLock@0
RtlSetEnvironmentVariable@12
RtlSizeHeap@12
RtlUnlockHeap@4
RtlUnicodeStringToAnsiSize@4
@ -513,8 +519,33 @@ RtlxAnsiStringToUnicodeSize@4
RtlxOemStringToUnicodeSize@4
RtlxUnicodeStringToAnsiSize@4
RtlxUnicodeStringToOemSize@4
;__isascii
;__iscsym
;__iscsymf
;__toascii
;_alldiv
;_allmul
;_alloca_probe
;_allrem
;_allshl
;_allshr
;_atoi64
;_aulldiv
;_aullrem
;_aullshr
;_chkstk
;_fltused
;_ftol
;_i64toa
;_i64tow
;_itoa
;_itow
;_ltoa
;_ltow
_memccpy
_memicmp
;_snprintf
;_snwprintf
_splitpath
_strcmpi
_stricmp
@ -523,14 +554,26 @@ _strnicmp
_strupr
_tolower
_toupper
;_ultoa
;_ultow
;_vsnprintf
_wcsicmp
_wcslwr
_wcsnicmp
_wcsupr
;_wtoi
;_wtoi64
;_wtol
;abs
;atan
atoi
atol
isalpha
;ceil
;cos
;fabs
;floor
isalnum
isalpha
iscntrl
isdigit
isgraph
@ -539,13 +582,23 @@ isprint
ispunct
isspace
isupper
;iswalpha
;iswctype
isxdigit
;labs
;log
;mbstowcs
memchr
memcmp
memcpy
memmove
memset
;pow
;qsort
;sin
sprintf
;sqrt
;sscanf
strcat
strchr
strcmp
@ -561,6 +614,8 @@ strspn
strstr
strtol
strtoul
;swprintf
;tan
tolower
toupper
towlower
@ -579,6 +634,9 @@ wcspbrk
wcsrchr
wcsspn
wcsstr
;wcstol
;wcstombs
;wcstoul
LdrGetExportByName
LdrGetExportByOrdinal
LdrLoadDll

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.15 1999/11/27 03:32:17 ekohl Exp $
; $Id: ntdll.edf,v 1.16 1999/12/01 15:16:05 ekohl Exp $
;
; ReactOS Operating System
;
@ -428,6 +428,7 @@ ZwWriteRequestData=ZwWriteRequestData@24
ZwWriteVirtualMemory=ZwWriteVirtualMemory@20
ZwW32Call=ZwW32Call@20
ZwYieldExecution=ZwYieldExecution@0
RtlAcquirePebLock=RtlAcquirePebLock@0
RtlAllocateHeap=RtlAllocateHeap@12
RtlAnsiCharToUnicodeChar=RtlAnsiCharToUnicodeChar@4
RtlAnsiStringToUnicodeSize=RtlAnsiStringToUnicodeSize@4
@ -435,6 +436,7 @@ RtlAnsiStringToUnicodeString=RtlAnsiStringToUnicodeString@12
RtlAppendUnicodeStringToString=RtlAppendUnicodeStringToString@8
RtlAppendUnicodeToString=RtlAppendUnicodeToString@8
RtlCharToInteger=RtlCharToInteger@12
RtlCreateEnvironment=RtlCreateEnvironment@8
RtlCreateHeap=RtlCreateHeap@24
RtlCreateUnicodeString=RtlCreateUnicodeString@8
RtlCreateUnicodeStringFromAsciiz=RtlCreateUnicodeStringFromAsciiz@8
@ -447,6 +449,7 @@ RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
RtlCopyString=RtlCopyString@8
RtlCopyUnicodeString=RtlCopyUnicodeString@8
RtlDestroyEnvironment=RtlDestroyEnvironment@4
RtlDestroyHeap=RtlDestroyHeap@4
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
RtlEnlargedIntegerMultiply=RtlEnlargedIntegerMultiply@8
@ -481,7 +484,13 @@ RtlLockHeap=RtlLockHeap@4
RtlMoveMemory=RtlMoveMemory@12
RtlMultiByteToUnicodeN=RtlMultiByteToUnicodeN@20
RtlNtStatusToDosError
RtlOemStringToUnicodeSize=RtlOemStringToUnicodeSize@4
RtlOemStringToUnicodeString=RtlOemStringToUnicodeString@12
RtlOemToUnicodeN=RtlOemToUnicodeN@20
RtlQueryEnvironmentVariable_U=RtlQueryEnvironmentVariable_U@12
RtlReAllocateHeap=RtlReAllocateHeap@16
RtlReleasePebLock=RtlReleasePebLock@0
RtlSetEnvironmentVariable=RtlSetEnvironmentVariable@12
RtlSizeHeap=RtlSizeHeap@12
RtlUnlockHeap=RtlUnlockHeap@4
RtlUnicodeStringToAnsiSize=RtlUnicodeStringToAnsiSize@4

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.27 1999/11/27 03:31:43 ekohl Exp $
# $Id: makefile,v 1.28 1999/12/01 15:15:27 ekohl Exp $
#
# ReactOS Operating System
#
@ -25,7 +25,7 @@ all: $(DLLTARGET)
RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \
rtl/mem.o rtl/nls.o rtl/process.o rtl/security.o \
rtl/thread.o rtl/unicode.o
rtl/thread.o rtl/unicode.o rtl/env.o
STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \
stdlib/strtol.o stdlib/strtoul.o

166
reactos/lib/ntdll/rtl/env.c Normal file
View file

@ -0,0 +1,166 @@
/* $Id: env.c,v 1.1 1999/12/01 15:14:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/ntdll/rtl/env.c
* PURPOSE: Environment functions
* PROGRAMMER: Eric Kohl
* UPDATE HISTORY:
* Created 30/09/98
*/
/* INCLUDES ******************************************************************/
#include <ddk/ntddk.h>
#include <ntdll/rtl.h>
#include <internal/teb.h>
#include <string.h>
/* FUNCTIONS *****************************************************************/
NTSTATUS
STDCALL
RtlCreateEnvironment (
BOOLEAN Inherit,
PVOID *Environment
)
{
MEMORY_BASIC_INFORMATION MemInfo;
PVOID EnvPtr = NULL;
NTSTATUS Status = STATUS_SUCCESS;
ULONG RegionSize = 1;
if (Inherit == TRUE)
{
RtlAcquirePebLock ();
if (NtCurrentPeb()->ProcessInfo->Environment != NULL)
{
Status = NtQueryVirtualMemory (NtCurrentProcess (),
NtCurrentPeb ()->ProcessInfo->Environment,
MemoryBasicInformation,
&MemInfo,
sizeof(MEMORY_BASIC_INFORMATION),
NULL);
if (!NT_SUCCESS(Status))
{
RtlReleasePebLock ();
*Environment = NULL;
return Status;
}
RegionSize = MemInfo.RegionSize;
Status = NtAllocateVirtualMemory (NtCurrentProcess (),
&EnvPtr,
0,
&RegionSize,
MEM_COMMIT,
PAGE_READWRITE);
if (!NT_SUCCESS(Status))
{
RtlReleasePebLock ();
*Environment = NULL;
return Status;
}
memmove (EnvPtr,
NtCurrentPeb ()->ProcessInfo->Environment,
MemInfo.RegionSize);
*Environment = EnvPtr;
}
RtlReleasePebLock ();
}
else
{
RegionSize = 1;
Status = NtAllocateVirtualMemory (NtCurrentProcess (),
&EnvPtr,
0,
&RegionSize,
MEM_COMMIT,
PAGE_READWRITE);
if (NT_SUCCESS(Status))
*Environment = EnvPtr;
}
return Status;
}
VOID
STDCALL
RtlDestroyEnvironment (
PVOID Environment
)
{
ULONG Size = 0;
NtFreeVirtualMemory (NtCurrentProcess (),
&Environment,
&Size,
MEM_RELEASE);
}
VOID
STDCALL
RtlSetCurrentEnvironment (
PVOID NewEnvironment,
PVOID *OldEnvironment
)
{
PVOID EnvPtr;
RtlAcquirePebLock ();
EnvPtr = NtCurrentPeb()->ProcessInfo->Environment;
NtCurrentPeb()->ProcessInfo->Environment = NewEnvironment;
if (OldEnvironment != NULL)
*OldEnvironment = EnvPtr;
RtlReleasePebLock ();
}
NTSTATUS
STDCALL
RtlSetEnvironmentVariable (
PVOID *Environment,
PUNICODE_STRING Name,
PUNICODE_STRING Value
)
{
NTSTATUS Status;
Status = STATUS_VARIABLE_NOT_FOUND;
/* FIXME: add missing stuff */
return Status;
}
NTSTATUS
STDCALL
RtlQueryEnvironmentVariable_U (
PVOID Environment,
PUNICODE_STRING Name,
PUNICODE_STRING Value
)
{
NTSTATUS Status;
Status = STATUS_VARIABLE_NOT_FOUND;
/* FIXME: add missing stuff */
return Status;
}
/* EOF */

View file

@ -1,4 +1,5 @@
/*
/* $Id: process.c,v 1.4 1999/12/01 15:14:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/ntdll/rtl/process.c
@ -19,6 +20,7 @@
#include <ntdll/ldr.h>
#include <internal/teb.h>
#include <ntdll/base.h>
#include <ntdll/rtl.h>
#define NDEBUG
#include <ntdll/ntdll.h>
@ -392,4 +394,20 @@ RtlCreateUserProcess(PUNICODE_STRING ApplicationName,
return STATUS_SUCCESS;
}
VOID
STDCALL
RtlAcquirePebLock (VOID)
{
}
VOID
STDCALL
RtlReleasePebLock (VOID)
{
}
/* EOF */

View file

@ -14,6 +14,7 @@
#include <ddk/ntddk.h>
#include <internal/i386/segment.h>
#include <string.h>
#include <ntdll/rtl.h>
#define NDEBUG
#include <ntdll/ntdll.h>

View file

@ -1,4 +1,4 @@
/* $Id: init.c,v 1.3 1999/11/25 10:47:58 dwelch Exp $
/* $Id: init.c,v 1.4 1999/12/01 15:18:54 ekohl Exp $
*
* init.c - Session Manager initialization
*
@ -27,77 +27,235 @@
* Compiled successfully with egcs 1.1.2
*/
#include <ddk/ntddk.h>
//#include <internal/lpc.h>
#include <ntdll/rtl.h>
#include "smss.h"
#define NDEBUG
/* GLOBAL VARIABLES *********************************************************/
HANDLE SmApiPort = INVALID_HANDLE_VALUE;
HANDLE DbgSsApiPort = INVALID_HANDLE_VALUE;
HANDLE DbgUiApiPort = INVALID_HANDLE_VALUE;
PVOID SmSystemEnvironment = NULL;
/* FUNCTIONS ****************************************************************/
#if 0
static VOID
SmCreatePagingFiles (VOID)
{
UNICODE_STRING FileName;
ULONG ulCurrentSize;
/* FIXME: Read file names from registry */
RtlInitUnicodeString (&FileName,
L"\\??\\C:\\reactos\\pagefile.sys");
NtCreatePagingFile (&FileName,
50,
80,
&ulCurrentSize);
}
#endif
BOOL
InitSessionManager(
InitSessionManager (
HANDLE Children[]
)
{
NTSTATUS Status;
UNICODE_STRING CmdLineW;
NTSTATUS Status;
UNICODE_STRING UnicodeString;
OBJECT_ATTRIBUTES ObjectAttributes;
UNICODE_STRING CmdLineW;
/* Create the "\SmApiPort" object (LPC) */
RtlInitUnicodeString (&UnicodeString,
L"\\SmApiPort");
InitializeObjectAttributes (&ObjectAttributes,
&UnicodeString,
0xff,
NULL,
NULL);
Status = NtCreatePort (&SmApiPort,
0,
&ObjectAttributes,
0,
0);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
#ifndef NDEBUG
DisplayString (L"SmApiPort created...\n");
#endif
/* Create two threads for "\SmApiPort" */
RtlCreateUserThread (NtCurrentProcess (),
NULL,
FALSE,
0,
NULL,
NULL,
(PTHREAD_START_ROUTINE)SmApiThread,
(PVOID)SmApiPort,
NULL,
NULL);
RtlCreateUserThread (NtCurrentProcess (),
NULL,
FALSE,
0,
NULL,
NULL,
(PTHREAD_START_ROUTINE)SmApiThread,
(PVOID)SmApiPort,
NULL,
NULL);
/* Create the system environment */
Status = RtlCreateEnvironment (TRUE,
&SmSystemEnvironment);
if (!NT_SUCCESS(Status))
return FALSE;
#ifndef NDEBUG
DisplayString (L"System Environment created\n");
#endif
/* FIXME: Create the \SmApiPort object (LPC) */
/* FIXME: Create two thread for \SmApiPort */
/* FIXME: Create the system environment variables */
/* FIXME: Define symbolic links to kernel devices (MS-DOS names) */
/* FIXME: Create paging files (if any) other than the first one */
/* FIXME: Run all programs in the boot execution list */
/* FIXME: Process the file rename list */
/* Create paging files */
#if 0
SmCreatePagingFiles ();
#endif
/* FIXME: Load the well known DLLs */
/* FIXME: Load the kernel mode driver win32k.sys */
RtlInitUnicodeString(&CmdLineW,
L"\\??\\C:\\reactos\\system32\\drivers\\win32k.sys");
Status = NtLoadDriver(&CmdLineW);
/* FIXME: Load missing registry hives */
/* FIXME: Set environment variables from registry */
/* Load the kernel mode driver win32k.sys */
RtlInitUnicodeString (&CmdLineW,
L"\\??\\C:\\reactos\\system32\\drivers\\win32k.sys");
Status = NtLoadDriver (&CmdLineW);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
#if 0
/* Start the Win32 subsystem (csrss.exe) */
Status = NtCreateProcess(
L"\\??\\C:\\reactos\\system32\\csrss.exe",
& Children[CHILD_CSRSS]
);
#endif
/* Start the simple shell (shell.exe) */
DisplayString(L"Executing shell\n");
RtlInitUnicodeString(&CmdLineW,
L"\\??\\C:\\reactos\\system32\\shell.exe");
Status = RtlCreateUserProcess(&CmdLineW,
NULL,
NULL,
FALSE,
0,
NULL,
&Children[0],
NULL);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
#if 0
/* Start winlogon.exe */
Status = NtCreateProcess(
L"\\??\\C:\\reactos\\system32\\winlogon.exe",
& Children[CHILD_WINLOGON]
);
DisplayString (L"Executing csrss.exe\n");
RtlInitUnicodeString (&UnicodeString,
L"\\??\\C:\\reactos\\system32\\csrss.exe");
Status = RtlCreateUserProcess (&UnicodeString,
NULL,
NULL,
FALSE,
0,
NULL,
&Children[CHILD_CSRSS],
NULL);
if (!NT_SUCCESS(Status))
{
Status = NtTerminateProcess(
Children[CHILD_CSRSS]
);
DisplayString (L"Loading csrss.exe failed!\n");
return FALSE;
}
#endif
/* FIXME: Create the \DbgSsApiPort object (LPC) */
/* FIXME: Create the \DbgUiApiPort object (LPC) */
/* Start the simple shell (shell.exe) */
DisplayString (L"Executing shell\n");
RtlInitUnicodeString (&UnicodeString,
L"\\??\\C:\\reactos\\system32\\shell.exe");
#if 0
/* Start the logon process (winlogon.exe) */
RtlInitUnicodeString (&CmdLineW,
L"\\??\\C:\\reactos\\system32\\winlogon.exe");
#endif
Status = RtlCreateUserProcess (&UnicodeString,
NULL,
NULL,
FALSE,
0,
NULL,
&Children[CHILD_WINLOGON],
NULL);
if (!NT_SUCCESS(Status))
{
DisplayString (L"Loading shell.exe failed!\n");
#if 0
NtTerminateProcess (Children[CHILD_CSRSS],
0);
#endif
return FALSE;
}
/* Create the \DbgSsApiPort object (LPC) */
RtlInitUnicodeString (&UnicodeString,
L"\\DbgSsApiPort");
InitializeObjectAttributes (&ObjectAttributes,
&UnicodeString,
0xff,
NULL,
NULL);
Status = NtCreatePort (&DbgSsApiPort,
0,
&ObjectAttributes,
0,
0);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
#ifndef NDEBUG
DisplayString (L"DbgSsApiPort created...\n");
#endif
/* Create the \DbgUiApiPort object (LPC) */
RtlInitUnicodeString (&UnicodeString,
L"\\DbgUiApiPort");
InitializeObjectAttributes (&ObjectAttributes,
&UnicodeString,
0xff,
NULL,
NULL);
Status = NtCreatePort (&DbgUiApiPort,
0,
&ObjectAttributes,
0,
0);
if (!NT_SUCCESS(Status))
{
return FALSE;
}
#ifndef NDEBUG
DisplayString (L"DbgUiApiPort created...\n");
#endif
return TRUE;
}
/* EOF */

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.2 1999/11/07 08:03:28 ea Exp $
# $Id: makefile,v 1.3 1999/12/01 15:18:54 ekohl Exp $
#
# Session Manager
#
@ -8,7 +8,7 @@ TARGET=smss
BASE_CFLAGS = -I../../include
OBJECTS = $(TARGET).o init.o $(TARGET).coff
OBJECTS = $(TARGET).o init.o smapi.o $(TARGET).coff
LIBS = ../../lib/ntdll/ntdll.a

View file

@ -0,0 +1,36 @@
/*
* Reactos Session Manager
*
*
*/
#include <ddk/ntddk.h>
#include "smss.h"
VOID STDCALL
SmApiThread(HANDLE Port)
{
ULONG count;
DisplayString (L"SmApiThread running...\n");
#if 0
NtSuspendThread (NtCurrentThread(), &count);
while (TRUE)
{
}
#endif
DisplayString (L"SmApiThread terminating...\n");
NtTerminateThread(NtCurrentThread(), 0);
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: smss.c,v 1.1 1999/09/05 12:29:50 ekohl Exp $
/* $Id: smss.c,v 1.2 1999/12/01 15:18:54 ekohl Exp $
*
* smss.c - Session Manager
*
@ -27,9 +27,8 @@
* Compiled successfully with egcs 1.1.2
*/
#include <ddk/ntddk.h>
#include <wchar.h>
BOOL InitSessionManager(HANDLE Children[]); /* ./init.c */
#include "smss.h"
void
@ -37,10 +36,8 @@ DisplayString( LPCWSTR lpwString )
{
UNICODE_STRING us;
us.Buffer = (LPWSTR) lpwString;
us.Length = wcslen(lpwString) * sizeof (WCHAR);
us.MaximumLength = us.Length + sizeof (WCHAR);
NtDisplayString( & us );
RtlInitUnicodeString (&us, lpwString);
NtDisplayString (&us);
}
@ -59,13 +56,7 @@ NtProcessStartup( PSTARTUP_ARGUMENT StartupArgument )
LARGE_INTEGER Time = {{(DWORD)-1,(DWORD)-1}}; /* infinite? */
NTSTATUS wws;
DisplayString( L"SM: Waiting for process termination...\n" );
wws = NtWaitForSingleObject (
Children[0],
TRUE, /* alertable */
& Time
);
DisplayString( L"SM: Waiting for process termination...\n" );
#if 0
wws = NtWaitForMultipleObjects (
@ -76,16 +67,24 @@ NtProcessStartup( PSTARTUP_ARGUMENT StartupArgument )
& Time
);
#endif
if (!NT_SUCCESS(wws))
wws = NtWaitForSingleObject (
Children[CHILD_WINLOGON],
TRUE, /* alertable */
& Time
);
// if (!NT_SUCCESS(wws))
if (wws > 1)
{
DisplayString( L"SM: NtWaitForMultipleObjects failed!\n" );
/* FIXME: CRASH THE SYSTEM (BSOD) */
}
else
{
DisplayString( L"SM: Process terminated!\n" );
else
{
DisplayString( L"SM: Process terminated!\n" );
/* FIXME: CRASH THE SYSTEM (BSOD) */
}
}
}
else
{
@ -98,8 +97,13 @@ NtProcessStartup( PSTARTUP_ARGUMENT StartupArgument )
* OK: CSRSS asked to shutdown the system;
* We die.
*/
#if 0
NtRaiseHardError (
STATUS_SYSTEM_PROCESS_TERMINATED,
...);
#endif
NtTerminateProcess( NtCurrentProcess(), 0 );
}
/* EOF */

View file

@ -0,0 +1,33 @@
#ifndef _SMSS_H_INCLUDED_
#define _SMSS_H_INCLUDED_
#define CHILD_CSRSS 0
#define CHILD_WINLOGON 1
/* GLOBAL VARIABLES ****/
extern HANDLE SmApiPort;
/* FUNCTIONS ***********/
/* init.c */
BOOL InitSessionManager (HANDLE Children[]);
/* smss.c */
void DisplayString (LPCWSTR lpwString);
/* smapi.c */
VOID STDCALL SmApiThread(HANDLE Port);
#endif /* _SMSS_H_INCLUDED_ */
/* EOF */