mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
- Our NtCreateKey currently allows building trees (which is incorrect) if the parent key is a symbolic link (which does exist), but if the target doesn't exist (Since the check 'does parent exist' is done Before the symlink is converted to its target. One side-effect is that although we create the CurrentControlSet symlink to ControlSet001, we never create ControlSet001. We end up creating it later during the boot by creating a sub-key, by exposing the bug in NtCreateKey. Since the new NtCreateKey uses the new parse routine code and doesn't exhibit this bug, we have to create ControlSet001 manually to avoid a failure. Other bugs of this nature may exist. Bug found and fixed by Alex.
- Implement the last bit of the new parse routine (creating children) and write a new version of NtCreateKey which uses the parse routine. Disable it for now until other latent bugs are fixed. svn path=/trunk/; revision=31112
This commit is contained in:
parent
9f375e0914
commit
a0da7760d4
4 changed files with 66 additions and 14 deletions
|
@ -495,15 +495,6 @@ typedef struct _KEY_INFORMATION
|
|||
//
|
||||
// BUGBUG Old Hive Stuff for Temporary Support
|
||||
//
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
CmFindObject(POBJECT_CREATE_INFORMATION ObjectCreateInfo,
|
||||
PUNICODE_STRING ObjectName,
|
||||
PVOID* ReturnedObject,
|
||||
PUNICODE_STRING RemainingPath,
|
||||
POBJECT_TYPE ObjectType,
|
||||
IN PACCESS_STATE AccessState,
|
||||
IN PVOID ParseContext);
|
||||
NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -1077,7 +1077,7 @@ CmpParseKey2(IN PVOID ParseObject,
|
|||
while (TRUE)
|
||||
{
|
||||
/* Get the next component */
|
||||
Result = CmpGetNextName(&Current, &NextName, &Last);
|
||||
Result = CmpGetNextName(&Current, &NextName, &Last);
|
||||
if ((Result) && (NextName.Length))
|
||||
{
|
||||
/* See if this is a sym link */
|
||||
|
@ -1184,9 +1184,15 @@ CmpParseKey2(IN PVOID ParseObject,
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Create: should not see this (yet) */
|
||||
DPRINT1("Unexpected: Creating new child\n");
|
||||
while (TRUE);
|
||||
/* Do the create */
|
||||
Status = CmpDoCreate(Hive,
|
||||
Cell,
|
||||
AccessState,
|
||||
&NextName,
|
||||
AccessMode,
|
||||
ParseContext,
|
||||
ParentKcb,
|
||||
Object);
|
||||
}
|
||||
|
||||
/* Check for reparse (in this case, someone beat us) */
|
||||
|
|
|
@ -363,6 +363,26 @@ CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
/* ReactOS Hack: Hard-code current to 001 for SetupLdr */
|
||||
if (!LoaderBlock->RegistryBase)
|
||||
{
|
||||
/* Build the ControlSet001 key */
|
||||
RtlInitUnicodeString(&KeyName,
|
||||
L"\\Registry\\Machine\\System\\ControlSet001");
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&KeyName,
|
||||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
Status = NtCreateKey(&KeyHandle,
|
||||
KEY_ALL_ACCESS,
|
||||
&ObjectAttributes,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
&Disposition);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Don't need the handle */
|
||||
ZwClose(KeyHandle);
|
||||
|
||||
/* Use hard-coded setting */
|
||||
ControlSet = 1;
|
||||
goto UseSet;
|
||||
|
@ -396,7 +416,6 @@ UseSet:
|
|||
OBJ_CASE_INSENSITIVE,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
Status = NtCreateKey(&KeyHandle,
|
||||
KEY_CREATE_LINK,
|
||||
&ObjectAttributes,
|
||||
|
|
|
@ -18,6 +18,42 @@ BOOLEAN CmFirstTime = TRUE;
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
#if 0
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtCreateKey(OUT PHANDLE KeyHandle,
|
||||
IN ACCESS_MASK DesiredAccess,
|
||||
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
||||
IN ULONG TitleIndex,
|
||||
IN PUNICODE_STRING Class,
|
||||
IN ULONG CreateOptions,
|
||||
OUT PULONG Disposition)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||
CM_PARSE_CONTEXT ParseContext = {0};
|
||||
PAGED_CODE();
|
||||
|
||||
/* Setup the parse context */
|
||||
ParseContext.CreateOperation = TRUE;
|
||||
ParseContext.CreateOptions = CreateOptions;
|
||||
if (Class) ParseContext.Class = *Class;
|
||||
|
||||
/* Do the create */
|
||||
Status = ObOpenObjectByName(ObjectAttributes,
|
||||
CmpKeyObjectType,
|
||||
PreviousMode,
|
||||
NULL,
|
||||
DesiredAccess,
|
||||
&ParseContext,
|
||||
KeyHandle);
|
||||
|
||||
/* Return data to user */
|
||||
if (Disposition) *Disposition = ParseContext.Disposition;
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
NtOpenKey(OUT PHANDLE KeyHandle,
|
||||
|
|
Loading…
Reference in a new issue