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, PCSRSS_API_REPLY Reply,
ULONG Length, ULONG Length,
ULONG ReplyLength); ULONG ReplyLength);
NTSTATUS NTSTATUS STDCALL CsrNewThread(VOID);
STDCALL NTSTATUS STDCALL CsrSetPriorityClass(HANDLE Process,
CsrSetPriorityClass ( PULONG PriorityClass);
HANDLE hProcess,
DWORD * PriorityClass
);
#endif /* __INCLUDE_NTDLL_CSR_H */ #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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -23,10 +23,11 @@ static HANDLE WindowsApiPort;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
NTSTATUS STDCALL CsrClientCallServer(PCSRSS_API_REQUEST Request, NTSTATUS STDCALL
PCSRSS_API_REPLY Reply, CsrClientCallServer(PCSRSS_API_REQUEST Request,
ULONG Length, PCSRSS_API_REPLY Reply,
ULONG ReplyLength) ULONG Length,
ULONG ReplyLength)
{ {
NTSTATUS Status; NTSTATUS Status;
@ -45,7 +46,8 @@ NTSTATUS STDCALL CsrClientCallServer(PCSRSS_API_REQUEST Request,
return(Status); return(Status);
} }
NTSTATUS STDCALL CsrClientConnectToServer(VOID) NTSTATUS STDCALL
CsrClientConnectToServer(VOID)
{ {
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING PortName; UNICODE_STRING PortName;
@ -84,14 +86,20 @@ NTSTATUS STDCALL CsrClientConnectToServer(VOID)
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
NTSTATUS STDCALL
NTSTATUS STDCALL CsrSetPriorityClass (HANDLE hProcess, CsrNewThread(VOID)
DWORD * PriorityClass)
{ {
/* FIXME: call csrss to get hProcess' priority */ return (NtRegisterThreadTerminatePort(WindowsApiPort));
*PriorityClass = CSR_PRIORITY_CLASS_NORMAL; }
return (STATUS_NOT_IMPLEMENTED); NTSTATUS STDCALL
CsrSetPriorityClass(HANDLE Process,
PULONG PriorityClass)
{
/* FIXME: call csrss to get hProcess' priority */
*PriorityClass = CSR_PRIORITY_CLASS_NORMAL;
return (STATUS_NOT_IMPLEMENTED);
} }
/* EOF */ /* EOF */

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 ; ReactOS Operating System
; ;
@ -15,7 +15,7 @@ CsrClientCallServer@16
CsrClientConnectToServer@0 CsrClientConnectToServer@0
;CsrFreeCaptureBuffer ;CsrFreeCaptureBuffer
;CsrIdentifyAlertableThread ;CsrIdentifyAlertableThread
;CsrNewThread CsrNewThread@0
;CsrProbeForRead ;CsrProbeForRead
;CsrProbeForWrite ;CsrProbeForWrite
CsrSetPriorityClass@8 CsrSetPriorityClass@8
@ -400,7 +400,7 @@ RtlFindSetBits@12
RtlFindSetBitsAndClear@12 RtlFindSetBitsAndClear@12
RtlFirstFreeAce@8 RtlFirstFreeAce@8
;RtlFlushPropertySet ;RtlFlushPropertySet
;RtlFormatCurrentUserKeyPath RtlFormatCurrentUserKeyPath@4
;RtlFormatMessage@36 ;RtlFormatMessage@36
RtlFreeAnsiString@4 RtlFreeAnsiString@4
;RtlFreeHandle ;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 ; ReactOS Operating System
; ;
@ -15,7 +15,7 @@ CsrClientCallServer=CsrClientCallServer@16
CsrClientConnectToServer=CsrClientConnectToServer@0 CsrClientConnectToServer=CsrClientConnectToServer@0
;CsrFreeCaptureBuffer ;CsrFreeCaptureBuffer
;CsrIdentifyAlertableThread ;CsrIdentifyAlertableThread
;CsrNewThread CsrNewThread=CsrNewThread@0
;CsrProbeForRead ;CsrProbeForRead
;CsrProbeForWrite ;CsrProbeForWrite
CsrSetPriorityClass=CsrSetPriorityClass@8 CsrSetPriorityClass=CsrSetPriorityClass@8
@ -400,7 +400,7 @@ RtlFindLongestRunSet=RtlFindLongestRunSet@8
RtlFindSetBits=RtlFindSetBits@12 RtlFindSetBits=RtlFindSetBits@12
RtlFindSetBitsAndClear=RtlFindSetBitsAndClear@12 RtlFindSetBitsAndClear=RtlFindSetBitsAndClear@12
;RtlFlushPropertySet ;RtlFlushPropertySet
;RtlFormatCurrentUserKeyPath RtlFormatCurrentUserKeyPath=RtlFormatCurrentUserKeyPath@4
;RtlFormatMessage ;RtlFormatMessage
RtlFreeAnsiString=RtlFreeAnsiString@4 RtlFreeAnsiString=RtlFreeAnsiString@4
;RtlFreeHandle ;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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -17,47 +17,93 @@
#include <ntdll/ntdll.h> #include <ntdll/ntdll.h>
static NTSTATUS RtlpGetRegistryHandle(ULONG RelativeTo,
PWSTR Path,
BOOLEAN Create,
PHANDLE KeyHandle);
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
NTSTATUS NTSTATUS STDCALL
STDCALL RtlCheckRegistryKey(IN ULONG RelativeTo,
RtlCheckRegistryKey ( IN PWSTR Path)
IN ULONG RelativeTo,
IN PWSTR Path
)
{ {
UNIMPLEMENTED; HANDLE KeyHandle;
return STATUS_NOT_IMPLEMENTED; NTSTATUS Status;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
FALSE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
NtClose(KeyHandle);
return STATUS_SUCCESS;
} }
NTSTATUS NTSTATUS STDCALL
STDCALL RtlCreateRegistryKey(IN ULONG RelativeTo,
RtlCreateRegistryKey ( IN PWSTR Path)
IN ULONG RelativeTo,
IN PWSTR Path
)
{ {
UNIMPLEMENTED; HANDLE KeyHandle;
return STATUS_NOT_IMPLEMENTED; NTSTATUS Status;
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
TRUE,
&KeyHandle);
if (!NT_SUCCESS(Status))
return Status;
NtClose(KeyHandle);
return STATUS_SUCCESS;
} }
NTSTATUS NTSTATUS STDCALL
STDCALL RtlDeleteRegistryValue(IN ULONG RelativeTo,
RtlDeleteRegistryValue ( IN PWSTR Path,
IN ULONG RelativeTo, IN PWSTR ValueName)
IN PWSTR Path,
IN PWSTR ValueName
)
{ {
UNIMPLEMENTED; HANDLE KeyHandle;
return STATUS_NOT_IMPLEMENTED; 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 NTSTATUS STDCALL
STDCALL RtlFormatCurrentUserKeyPath(PUNICODE_STRING KeyPath)
{
return STATUS_UNSUCCESSFUL;
}
/*
NTSTATUS STDCALL
RtlOpenCurrentUser(...)
*/
NTSTATUS STDCALL
RtlQueryRegistryValues ( RtlQueryRegistryValues (
IN ULONG RelativeTo, IN ULONG RelativeTo,
IN PWSTR Path, IN PWSTR Path,
@ -71,25 +117,139 @@ RtlQueryRegistryValues (
} }
NTSTATUS NTSTATUS STDCALL
STDCALL RtlWriteRegistryValue(IN ULONG RelativeTo,
RtlWriteRegistryValue ( IN PWSTR Path,
IN ULONG RelativeTo, IN PWSTR ValueName,
IN PWSTR Path, IN ULONG ValueType,
IN PWSTR ValueName, IN PVOID ValueData,
IN ULONG ValueType, IN ULONG ValueLength)
IN PVOID ValueData,
IN ULONG ValueLength
)
{ {
UNIMPLEMENTED; HANDLE KeyHandle;
return STATUS_NOT_IMPLEMENTED; 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 NTSTATUS STDCALL
RtlpNtMakeTemporaryKey(HANDLE KeyHandle) RtlpNtMakeTemporaryKey(HANDLE KeyHandle)
{ {
return NtDeleteKey(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 */ /* EOF */

View file

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