Implemented some more registry functions.

svn path=/trunk/; revision=1989
This commit is contained in:
Eric Kohl 2001-06-19 15:09:16 +00:00
parent 76f1b8fa3c
commit c79b121347
4 changed files with 172 additions and 18 deletions

View file

@ -1,4 +1,4 @@
/* $Id: rtl.h,v 1.28 2001/06/17 22:52:37 ekohl Exp $
/* $Id: rtl.h,v 1.29 2001/06/19 15:08:12 ekohl Exp $
*
*/
@ -471,6 +471,15 @@ RtlpNtCreateKey (
IN ULONG Unused2
);
NTSTATUS
STDCALL
RtlpNtEnumerateSubKey (
IN HANDLE KeyHandle,
OUT PUNICODE_STRING SubKeyName,
IN ULONG Index,
IN ULONG Unused
);
NTSTATUS
STDCALL
RtlpNtMakeTemporaryKey (
@ -486,6 +495,25 @@ RtlpNtOpenKey (
IN ULONG Unused
);
NTSTATUS
STDCALL
RtlpNtQueryValueKey (
IN HANDLE KeyHandle,
OUT PULONG Type OPTIONAL,
OUT PVOID Data OPTIONAL,
IN OUT PULONG DataLength OPTIONAL,
IN ULONG Unused
);
NTSTATUS
STDCALL
RtlpNtSetValueKey (
IN HANDLE KeyHandle,
IN ULONG Type,
IN PVOID Data,
IN ULONG DataLength
);
#endif /* __INCLUDE_NTDLL_RTL_H */
/* EOF */

View file

@ -1,4 +1,4 @@
; $Id: ntdll.def,v 1.77 2001/06/18 18:37:12 ekohl Exp $
; $Id: ntdll.def,v 1.78 2001/06/19 15:09:16 ekohl Exp $
;
; ReactOS Operating System
;
@ -594,11 +594,11 @@ RtlWriteRegistryValue@24
;RtlZeroHeap
RtlZeroMemory@8
RtlpNtCreateKey@24
;RtlpNtEnumerateSubKey
RtlpNtEnumerateSubKey@16
RtlpNtMakeTemporaryKey@4
RtlpNtOpenKey@16
;RtlpNtQueryValueKey
;RtlpNtSetValueKey
RtlpNtQueryValueKey@20
RtlpNtSetValueKey@16
;RtlpUnWaitCriticalSection
;RtlpWaitForCriticalSection
RtlxAnsiStringToUnicodeSize@4

View file

@ -1,4 +1,4 @@
; $Id: ntdll.edf,v 1.66 2001/06/18 18:37:12 ekohl Exp $
; $Id: ntdll.edf,v 1.67 2001/06/19 15:09:16 ekohl Exp $
;
; ReactOS Operating System
;
@ -593,11 +593,11 @@ RtlWriteRegistryValue=RtlWriteRegistryValue@24
;RtlZeroHeap
RtlZeroMemory=RtlZeroMemory@8
RtlpNtCreateKey=RtlpNtCreateKey@24
;RtlpNtEnumerateSubKey
RtlpNtEnumerateSubKey=RtlpNtEnumerateSubKey@16
RtlpNtMakeTemporaryKey=RtlpNtMakeTemporaryKey@4
RtlpNtOpenKey=RtlpNtOpenKey@16
;RtlpNtQueryValueKey
;RtlpNtSetValueKey
RtlpNtQueryValueKey=RtlpNtQueryValueKey@20
RtlpNtSetValueKey=RtlpNtSetValueKey@16
;RtlpUnWaitCriticalSection
;RtlpWaitForCriticalSection
RtlxAnsiStringToUnicodeSize=RtlxAnsiStringToUnicodeSize@4

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.5 2001/06/18 18:36:32 ekohl Exp $
/* $Id: registry.c,v 1.6 2001/06/19 15:08:46 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -13,8 +13,6 @@
* TODO:
* - finish RtlQueryRegistryValues()
* - finish RtlFormatCurrentUserKeyPath()
* - implement RtlOpenCurrentUser()
* - implement RtlNtXxxx() functions
*/
/* INCLUDES *****************************************************************/
@ -163,7 +161,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
ULONG BufferSize;
ULONG ResultSize;
DPRINT1("RtlQueryRegistryValues()\n");
DPRINT("RtlQueryRegistryValues() called\n");
Status = RtlpGetRegistryHandle(RelativeTo,
Path,
@ -184,7 +182,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
break;
}
DPRINT1("Name: %S\n", QueryEntry->Name);
DPRINT("Name: %S\n", QueryEntry->Name);
if (((QueryEntry->Flags & (RTL_QUERY_REGISTRY_SUBKEY | RTL_QUERY_REGISTRY_TOPKEY)) != 0) &&
(BaseKeyHandle != CurrentKeyHandle))
@ -195,7 +193,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
if (QueryEntry->Flags & RTL_QUERY_REGISTRY_SUBKEY)
{
DPRINT1("Open new subkey: %S\n", QueryEntry->Name);
DPRINT("Open new subkey: %S\n", QueryEntry->Name);
RtlInitUnicodeString(&KeyName,
QueryEntry->Name);
@ -212,7 +210,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
}
else if (QueryEntry->Flags & RTL_QUERY_REGISTRY_DIRECT)
{
DPRINT1("Query value directly: %S\n", QueryEntry->Name);
DPRINT("Query value directly: %S\n", QueryEntry->Name);
RtlInitUnicodeString(&KeyName,
QueryEntry->Name);
@ -269,13 +267,13 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
}
else
{
DPRINT1("Query value via query routine: %S\n", QueryEntry->Name);
DPRINT("Query value via query routine: %S\n", QueryEntry->Name);
}
if (QueryEntry->Flags & RTL_QUERY_REGISTRY_DELETE)
{
DPRINT1("Delete value: %S\n", QueryEntry->Name);
DPRINT("Delete value: %S\n", QueryEntry->Name);
}
@ -348,6 +346,60 @@ RtlpNtCreateKey(OUT HANDLE KeyHandle,
}
NTSTATUS STDCALL
RtlpNtEnumerateSubKey(IN HANDLE KeyHandle,
OUT PUNICODE_STRING SubKeyName,
IN ULONG Index,
IN ULONG Unused)
{
PKEY_BASIC_INFORMATION KeyInfo = NULL;
ULONG BufferLength = 0;
ULONG ReturnedLength;
NTSTATUS Status;
if (SubKeyName->MaximumLength != 0)
{
BufferLength = SubKeyName->MaximumLength +
sizeof(KEY_BASIC_INFORMATION);
KeyInfo = RtlAllocateHeap(RtlGetProcessHeap(),
0,
BufferLength);
if (KeyInfo == NULL)
return(STATUS_NO_MEMORY);
}
Status = NtEnumerateKey(KeyHandle,
Index,
KeyBasicInformation,
KeyInfo,
BufferLength,
&ReturnedLength);
if (NT_SUCCESS(Status))
{
if (KeyInfo->NameLength <= SubKeyName->MaximumLength)
{
memmove(SubKeyName->Buffer,
KeyInfo->Name,
KeyInfo->NameLength);
SubKeyName->Length = KeyInfo->NameLength;
}
else
{
Status = STATUS_BUFFER_OVERFLOW;
}
}
if (KeyInfo != NULL)
{
RtlFreeHeap(RtlGetProcessHeap(),
0,
KeyInfo);
}
return(Status);
}
NTSTATUS STDCALL
RtlpNtMakeTemporaryKey(IN HANDLE KeyHandle)
{
@ -371,6 +423,80 @@ RtlpNtOpenKey(OUT HANDLE KeyHandle,
}
NTSTATUS STDCALL
RtlpNtQueryValueKey(IN HANDLE KeyHandle,
OUT PULONG Type OPTIONAL,
OUT PVOID Data OPTIONAL,
IN OUT PULONG DataLength OPTIONAL,
IN ULONG Unused)
{
PKEY_VALUE_PARTIAL_INFORMATION ValueInfo;
UNICODE_STRING ValueName;
ULONG BufferLength;
ULONG ReturnedLength;
NTSTATUS Status;
RtlInitUnicodeString(&ValueName,
NULL);
BufferLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION);
if (DataLength != NULL)
BufferLength = *DataLength;
ValueInfo = RtlAllocateHeap(RtlGetProcessHeap(),
0,
BufferLength);
if (ValueInfo == NULL)
return(STATUS_NO_MEMORY);
Status = NtQueryValueKey(KeyHandle,
&ValueName,
KeyValuePartialInformation,
ValueInfo,
BufferLength,
&ReturnedLength);
if (NT_SUCCESS(Status))
{
if (DataLength != NULL)
*DataLength = ValueInfo->DataLength;
if (Type != NULL)
*Type = ValueInfo->Type;
if (Data != NULL)
{
memmove(Data,
ValueInfo->Data,
ValueInfo->DataLength);
}
}
RtlFreeHeap(RtlGetProcessHeap(),
0,
ValueInfo);
return(Status);
}
NTSTATUS STDCALL
RtlpNtSetValueKey(IN HANDLE KeyHandle,
IN ULONG Type,
IN PVOID Data,
IN ULONG DataLength)
{
UNICODE_STRING ValueName;
RtlInitUnicodeString(&ValueName,
NULL);
return(NtSetValueKey(KeyHandle,
&ValueName,
0,
Type,
Data,
DataLength));
}
/* INTERNAL FUNCTIONS ******************************************************/
NTSTATUS