Implemented CsrNewThread()

Added some registry functions

svn path=/trunk/; revision=1872
This commit is contained in:
Eric Kohl 2001-05-02 22:25:58 +00:00
parent ff2adbb728
commit 9f1e5ac42c
6 changed files with 230 additions and 67 deletions

View file

@ -1,4 +1,4 @@
/* $Id: csr.h,v 1.3 2000/04/25 23:22:52 ea Exp $
/* $Id: csr.h,v 1.4 2001/05/02 22:22:23 ekohl Exp $
*
*/
@ -12,12 +12,9 @@ NTSTATUS STDCALL CsrClientCallServer(PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply,
ULONG Length,
ULONG ReplyLength);
NTSTATUS
STDCALL
CsrSetPriorityClass (
HANDLE hProcess,
DWORD * PriorityClass
);
NTSTATUS STDCALL CsrNewThread(VOID);
NTSTATUS STDCALL CsrSetPriorityClass(HANDLE Process,
PULONG PriorityClass);
#endif /* __INCLUDE_NTDLL_CSR_H */

View file

@ -1,4 +1,4 @@
/* $Id: api.c,v 1.8 2000/06/29 23:35:27 dwelch Exp $
/* $Id: api.c,v 1.9 2001/05/02 22:23:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -23,7 +23,8 @@ static HANDLE WindowsApiPort;
/* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL CsrClientCallServer(PCSRSS_API_REQUEST Request,
NTSTATUS STDCALL
CsrClientCallServer(PCSRSS_API_REQUEST Request,
PCSRSS_API_REPLY Reply,
ULONG Length,
ULONG ReplyLength)
@ -45,7 +46,8 @@ NTSTATUS STDCALL CsrClientCallServer(PCSRSS_API_REQUEST Request,
return(Status);
}
NTSTATUS STDCALL CsrClientConnectToServer(VOID)
NTSTATUS STDCALL
CsrClientConnectToServer(VOID)
{
NTSTATUS Status;
UNICODE_STRING PortName;
@ -84,9 +86,15 @@ NTSTATUS STDCALL CsrClientConnectToServer(VOID)
return(STATUS_SUCCESS);
}
NTSTATUS STDCALL
CsrNewThread(VOID)
{
return (NtRegisterThreadTerminatePort(WindowsApiPort));
}
NTSTATUS STDCALL CsrSetPriorityClass (HANDLE hProcess,
DWORD * PriorityClass)
NTSTATUS STDCALL
CsrSetPriorityClass(HANDLE Process,
PULONG PriorityClass)
{
/* FIXME: call csrss to get hProcess' priority */
*PriorityClass = CSR_PRIORITY_CLASS_NORMAL;

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.69 2001/02/10 22:23:07 ekohl Exp $
; $Id: ntdll.def,v 1.70 2001/05/02 22:23:47 ekohl Exp $
;
; ReactOS Operating System
;
@ -15,7 +15,7 @@ CsrClientCallServer@16
CsrClientConnectToServer@0
;CsrFreeCaptureBuffer
;CsrIdentifyAlertableThread
;CsrNewThread
CsrNewThread@0
;CsrProbeForRead
;CsrProbeForWrite
CsrSetPriorityClass@8
@ -400,7 +400,7 @@ RtlFindSetBits@12
RtlFindSetBitsAndClear@12
RtlFirstFreeAce@8
;RtlFlushPropertySet
;RtlFormatCurrentUserKeyPath
RtlFormatCurrentUserKeyPath@4
;RtlFormatMessage@36
RtlFreeAnsiString@4
;RtlFreeHandle

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.58 2001/02/10 22:23:07 ekohl Exp $
; $Id: ntdll.edf,v 1.59 2001/05/02 22:23:47 ekohl Exp $
;
; ReactOS Operating System
;
@ -15,7 +15,7 @@ CsrClientCallServer=CsrClientCallServer@16
CsrClientConnectToServer=CsrClientConnectToServer@0
;CsrFreeCaptureBuffer
;CsrIdentifyAlertableThread
;CsrNewThread
CsrNewThread=CsrNewThread@0
;CsrProbeForRead
;CsrProbeForWrite
CsrSetPriorityClass=CsrSetPriorityClass@8
@ -400,7 +400,7 @@ RtlFindLongestRunSet=RtlFindLongestRunSet@8
RtlFindSetBits=RtlFindSetBits@12
RtlFindSetBitsAndClear=RtlFindSetBitsAndClear@12
;RtlFlushPropertySet
;RtlFormatCurrentUserKeyPath
RtlFormatCurrentUserKeyPath=RtlFormatCurrentUserKeyPath@4
;RtlFormatMessage
RtlFreeAnsiString=RtlFreeAnsiString@4
;RtlFreeHandle

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.1 2000/08/11 12:35:47 ekohl Exp $
/* $Id: registry.c,v 1.2 2001/05/02 22:23:21 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,47 +17,93 @@
#include <ntdll/ntdll.h>
static NTSTATUS RtlpGetRegistryHandle(ULONG RelativeTo,
PWSTR Path,
BOOLEAN Create,
PHANDLE KeyHandle);
/* FUNCTIONS ***************************************************************/
NTSTATUS
STDCALL
RtlCheckRegistryKey (
IN ULONG RelativeTo,
IN PWSTR Path
)
NTSTATUS STDCALL
RtlCheckRegistryKey(IN ULONG RelativeTo,
IN PWSTR Path)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
FALSE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlCreateRegistryKey (
IN ULONG RelativeTo,
IN PWSTR Path
)
NTSTATUS STDCALL
RtlCreateRegistryKey(IN ULONG RelativeTo,
IN PWSTR Path)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
RtlDeleteRegistryValue (
IN ULONG RelativeTo,
NTSTATUS STDCALL
RtlDeleteRegistryValue(IN ULONG RelativeTo,
IN PWSTR Path,
IN PWSTR ValueName
)
IN PWSTR ValueName)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
UNICODE_STRING Name;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
RtlInitUnicodeString(&Name,
ValueName);
NtDeleteValueKey(KeyHandle,
&Name);
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
NTSTATUS
STDCALL
NTSTATUS STDCALL
RtlFormatCurrentUserKeyPath(PUNICODE_STRING KeyPath)
{
return STATUS_UNSUCCESSFUL;
}
/*
NTSTATUS STDCALL
RtlOpenCurrentUser(...)
*/
NTSTATUS STDCALL
RtlQueryRegistryValues (
IN ULONG RelativeTo,
IN PWSTR Path,
@ -71,25 +117,139 @@ RtlQueryRegistryValues (
}
NTSTATUS
STDCALL
RtlWriteRegistryValue (
IN ULONG RelativeTo,
NTSTATUS STDCALL
RtlWriteRegistryValue(IN ULONG RelativeTo,
IN PWSTR Path,
IN PWSTR ValueName,
IN ULONG ValueType,
IN PVOID ValueData,
IN ULONG ValueLength
)
IN ULONG ValueLength)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
HANDLE KeyHandle;
NTSTATUS Status;
UNICODE_STRING Name;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
RtlInitUnicodeString(&Name,
ValueName);
NtSetValueKey(KeyHandle,
&Name,
0,
ValueType,
ValueData,
ValueLength);
NtClose(KeyHandle);
return STATUS_SUCCESS;
}
NTSTATUS STDCALL
RtlpNtMakeTemporaryKey(HANDLE KeyHandle)
{
return NtDeleteKey(KeyHandle);
}
/* INTERNAL FUNCTIONS ******************************************************/
static NTSTATUS
RtlpGetRegistryHandle(ULONG RelativeTo,
PWSTR Path,
BOOLEAN Create,
PHANDLE KeyHandle)
{
UNICODE_STRING KeyName;
WCHAR KeyBuffer[MAX_PATH];
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
if (RelativeTo & RTL_REGISTRY_HANDLE)
{
*KeyHandle = (HANDLE)Path;
return STATUS_SUCCESS;
}
if (RelativeTo & RTL_REGISTRY_OPTIONAL)
RelativeTo &= ~RTL_REGISTRY_OPTIONAL;
if (RelativeTo >= RTL_REGISTRY_MAXIMUM)
return STATUS_INVALID_PARAMETER;
KeyName.Length = 0;
KeyName.MaximumLength = MAX_PATH;
KeyName.Buffer = KeyBuffer;
KeyBuffer[0] = 0;
switch (RelativeTo)
{
case RTL_REGISTRY_SERVICES:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\");
break;
case RTL_REGISTRY_CONTROL:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\");
break;
case RTL_REGISTRY_WINDOWS_NT:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\");
break;
case RTL_REGISTRY_DEVICEMAP:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\Hardware\\DeviceMap\\");
break;
case RTL_REGISTRY_USER:
Status = RtlFormatCurrentUserKeyPath(&KeyName);
if (!NT_SUCCESS(Status))
return Status;
break;
}
if (Path[0] != L'\\')
RtlAppendUnicodeToString(&KeyName,
L"\\");
RtlAppendUnicodeToString(&KeyName,
Path);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
if (Create == TRUE)
{
Status = NtCreateKey(KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes,
0,
NULL,
0,
NULL);
}
else
{
Status = NtOpenKey(KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes);
}
return Status;
}
/* EOF */

View file

@ -20,10 +20,8 @@ STUB(CsrCaptureMessageString)
STUB(CsrCaptureTimeout)
STUB(CsrFreeCaptureBuffer)
STUB(CsrIdentifyAlertableThread)
STUB(CsrNewThread)
STUB(CsrProbeForRead)
STUB(CsrProbeForWrite)
STUB(CsrSetPriorityClass)
STUB(KiRaiseUserExceptionDispatcher)