- Moved and renamed RtlpCreateRegistryKeyPath() to IopCreateDeviceKeyPath()

- Removed ntoskrnl/include/internal/registry.h

svn path=/trunk/; revision=6337
This commit is contained in:
Eric Kohl 2003-10-16 14:50:11 +00:00
parent e4e84cbc31
commit 1e3b13361d
16 changed files with 203 additions and 238 deletions

View file

@ -1,4 +1,4 @@
/* $Id: import.c,v 1.23 2003/10/12 17:05:44 hbirr Exp $
/* $Id: import.c,v 1.24 2003/10/16 14:48:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -14,10 +14,6 @@
#include <string.h>
#include <ctype.h>
#include <roscfg.h>
#include <internal/ob.h>
#include <internal/pool.h>
#include <internal/registry.h>
#include <internal/ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -14,7 +14,6 @@
#include <roscfg.h>
#include <internal/ob.h>
#include <internal/se.h>
#include <internal/registry.h>
#define NDEBUG
#include <internal/debug.h>

View file

@ -10,7 +10,6 @@
#include <string.h>
#include <roscfg.h>
#include <internal/ob.h>
#include <internal/registry.h>
#include <ntos/minmax.h>
#include <reactos/bugcodes.h>

View file

@ -1,4 +1,4 @@
/* $Id: registry.c,v 1.112 2003/10/13 20:53:42 ekohl Exp $
/* $Id: registry.c,v 1.113 2003/10/16 14:48:22 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,7 +17,6 @@
#include <string.h>
#include <roscfg.h>
#include <internal/ob.h>
#include <internal/registry.h>
#include <reactos/bugcodes.h>
#define NDEBUG

View file

@ -11,7 +11,6 @@
#include <string.h>
#include <roscfg.h>
#include <internal/ob.h>
#include <internal/registry.h>
#include <ntos/minmax.h>
#include <reactos/bugcodes.h>

View file

@ -10,19 +10,122 @@
#include <ddk/ntddk.h>
#include <roscfg.h>
#include <internal/ob.h>
#include <limits.h>
#include <string.h>
#include <internal/registry.h>
#define NDEBUG
#include <internal/debug.h>
#include "cm.h"
/* 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)
{
Status = NtDuplicateObject(NtCurrentProcess(),
(HANDLE)Path,
NtCurrentProcess(),
KeyHandle,
0,
FALSE,
DUPLICATE_SAME_ACCESS);
return(Status);
}
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;
/* ReactOS specific */
case RTL_REGISTRY_ENUM:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
break;
}
if (Path[0] == L'\\' && RelativeTo != RTL_REGISTRY_ABSOLUTE)
{
Path++;
}
RtlAppendUnicodeToString(&KeyName,
Path);
DPRINT("KeyName '%wZ'\n", &KeyName);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
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);
}
/*
* @implemented
*/
@ -100,6 +203,20 @@ RtlDeleteRegistryValue(IN ULONG RelativeTo,
}
/*
* @unimplemented
*/
NTSTATUS STDCALL
RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath)
{
/* FIXME: !!! */
RtlCreateUnicodeString(KeyPath,
L"\\Registry\\User\\.Default");
return(STATUS_SUCCESS);
}
NTSTATUS STDCALL
RtlOpenCurrentUser(IN ACCESS_MASK DesiredAccess,
OUT PHANDLE KeyHandle)
@ -413,7 +530,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
Status = STATUS_NO_MEMORY;
break;
}
ValueNameSize = 256 * sizeof(WCHAR);
ValueNameSize = 256 * sizeof(WCHAR);
ValueName = ExAllocatePool(PagedPool,
ValueNameSize);
if (ValueName == NULL)
@ -445,7 +562,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
break;
}
if (FullValueInfo->NameLength > ValueNameSize - sizeof(WCHAR))
if (FullValueInfo->NameLength > ValueNameSize - sizeof(WCHAR))
{
/* Should not happen, because the name length is limited to 255 characters */
ExFreePool(ValueName);
@ -458,7 +575,7 @@ RtlQueryRegistryValues(IN ULONG RelativeTo,
}
}
RtlCopyMemory(ValueName,
RtlCopyMemory(ValueName,
FullValueInfo->Name,
FullValueInfo->NameLength);
ValueName[FullValueInfo->NameLength / sizeof(WCHAR)] = 0;
@ -560,197 +677,4 @@ RtlWriteRegistryValue(IN ULONG RelativeTo,
return(STATUS_SUCCESS);
}
/*
* @unimplemented
*/
NTSTATUS STDCALL
RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath)
{
/* FIXME: !!! */
RtlCreateUnicodeString(KeyPath,
L"\\Registry\\User\\.Default");
return(STATUS_SUCCESS);
}
/* ------------------------------------------ Private Implementation */
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)
{
Status = ZwDuplicateObject(NtCurrentProcess(),
(HANDLE)Path,
NtCurrentProcess(),
KeyHandle,
0,
FALSE,
DUPLICATE_SAME_ACCESS);
return(Status);
}
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;
/* ReactOS specific */
case RTL_REGISTRY_ENUM:
RtlAppendUnicodeToString(&KeyName,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
break;
}
if (Path[0] == L'\\' && RelativeTo != RTL_REGISTRY_ABSOLUTE)
{
Path++;
}
RtlAppendUnicodeToString(&KeyName,
Path);
DPRINT("KeyName '%wZ'\n", &KeyName);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
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);
}
NTSTATUS
RtlpCreateRegistryKeyPath(PWSTR Path)
{
OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR KeyBuffer[MAX_PATH];
UNICODE_STRING KeyName;
HANDLE KeyHandle;
NTSTATUS Status;
PWCHAR Current;
PWCHAR Next;
if (_wcsnicmp(Path, L"\\Registry\\", 10) != 0)
{
return STATUS_INVALID_PARAMETER;
}
wcsncpy (KeyBuffer, Path, MAX_PATH-1);
RtlInitUnicodeString (&KeyName, KeyBuffer);
/* Skip \\Registry\\ */
Current = KeyName.Buffer;
Current = wcschr (Current, '\\') + 1;
Current = wcschr (Current, '\\') + 1;
do
{
Next = wcschr (Current, '\\');
if (Next == NULL)
{
/* The end */
}
else
{
*Next = 0;
}
InitializeObjectAttributes (&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
DPRINT("Create '%S'\n", KeyName.Buffer);
Status = NtCreateKey (&KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes,
0,
NULL,
0,
NULL);
if (!NT_SUCCESS (Status))
{
DPRINT ("NtCreateKey() failed with status %x\n", Status);
return Status;
}
NtClose (KeyHandle);
if (Next != NULL)
{
*Next = L'\\';
}
Current = Next + 1;
}
while (Next != NULL);
return STATUS_SUCCESS;
}
/* EOF */

View file

@ -1,14 +0,0 @@
#ifndef __INCLUDE_INTERNAL_REGISTRY_H
#define __INCLUDE_INTERNAL_REGISTRY_H
NTSTATUS
RtlpGetRegistryHandle(ULONG RelativeTo,
PWSTR Path,
BOOLEAN Create,
PHANDLE KeyHandle);
NTSTATUS
RtlpCreateRegistryKeyPath(PWSTR Path);
#endif /* __INCLUDE_INTERNAL_REGISTRY_H */

View file

@ -1,4 +1,4 @@
/* $Id: device.c,v 1.63 2003/10/15 17:04:39 navaraf Exp $
/* $Id: device.c,v 1.64 2003/10/16 14:49:05 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -18,7 +18,6 @@
#include <internal/ldr.h>
#include <internal/id.h>
#include <internal/pool.h>
#include <internal/registry.h>
#include <roscfg.h>

View file

@ -15,7 +15,6 @@
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG

View file

@ -1,4 +1,4 @@
/* $Id: driver.c,v 1.25 2003/10/16 12:50:30 ekohl Exp $
/* $Id: driver.c,v 1.26 2003/10/16 14:49:05 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -18,7 +18,6 @@
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/id.h>
#include <internal/registry.h>
#include <internal/pool.h>
#include <internal/se.h>
#include <internal/mm.h>

View file

@ -1,4 +1,4 @@
/* $Id: pnpdma.c,v 1.2 2003/09/25 18:29:44 navaraf Exp $
/* $Id: pnpdma.c,v 1.3 2003/10/16 14:49:05 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -18,7 +18,6 @@
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG

View file

@ -1,4 +1,4 @@
/* $Id: pnpmgr.c,v 1.21 2003/10/15 17:04:39 navaraf Exp $
/* $Id: pnpmgr.c,v 1.22 2003/10/16 14:49:05 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -16,7 +16,6 @@
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
#include <ole32/guiddef.h>
@ -571,6 +570,78 @@ IopTraverseDeviceTree(
}
static NTSTATUS
IopCreateDeviceKeyPath(PWSTR Path)
{
OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR KeyBuffer[MAX_PATH];
UNICODE_STRING KeyName;
HANDLE KeyHandle;
NTSTATUS Status;
PWCHAR Current;
PWCHAR Next;
if (_wcsnicmp(Path, L"\\Registry\\", 10) != 0)
{
return STATUS_INVALID_PARAMETER;
}
wcsncpy (KeyBuffer, Path, MAX_PATH-1);
RtlInitUnicodeString (&KeyName, KeyBuffer);
/* Skip \\Registry\\ */
Current = KeyName.Buffer;
Current = wcschr (Current, '\\') + 1;
Current = wcschr (Current, '\\') + 1;
do
{
Next = wcschr (Current, '\\');
if (Next == NULL)
{
/* The end */
}
else
{
*Next = 0;
}
InitializeObjectAttributes (&ObjectAttributes,
&KeyName,
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
DPRINT("Create '%S'\n", KeyName.Buffer);
Status = NtCreateKey (&KeyHandle,
KEY_ALL_ACCESS,
&ObjectAttributes,
0,
NULL,
0,
NULL);
if (!NT_SUCCESS (Status))
{
DPRINT ("NtCreateKey() failed with status %x\n", Status);
return Status;
}
NtClose (KeyHandle);
if (Next != NULL)
{
*Next = L'\\';
}
Current = Next + 1;
}
while (Next != NULL);
return STATUS_SUCCESS;
}
/*
* IopActionInterrogateDeviceStack
*
@ -822,7 +893,7 @@ IopActionInterrogateDeviceStack(
KeyBuffer = ExAllocatePool(PagedPool, (49 + DeviceNode->InstancePath.Length) * sizeof(WCHAR));
wcscpy(KeyBuffer, L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\");
wcscat(KeyBuffer, DeviceNode->InstancePath.Buffer);
RtlpCreateRegistryKeyPath(KeyBuffer);
IopCreateDeviceKeyPath(KeyBuffer);
ExFreePool(KeyBuffer);
DeviceNode->Flags |= DNF_PROCESSED;

View file

@ -15,7 +15,6 @@
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG

View file

@ -15,7 +15,6 @@
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG

View file

@ -15,7 +15,6 @@
#include <internal/io.h>
#include <internal/po.h>
#include <internal/ldr.h>
#include <internal/registry.h>
#include <internal/module.h>
//#define NDEBUG

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: main.c,v 1.175 2003/10/15 17:04:39 navaraf Exp $
/* $Id: main.c,v 1.176 2003/10/16 14:47:30 ekohl Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/main.c
@ -47,7 +47,6 @@
#include <internal/kd.h>
#include <internal/trap.h>
#include "../dbg/kdb.h"
#include <internal/registry.h>
#include <internal/nls.h>
#include <reactos/bugcodes.h>
#include <ntos/bootvid.h>