mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +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
|
// 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);
|
NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -1184,9 +1184,15 @@ CmpParseKey2(IN PVOID ParseObject,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Create: should not see this (yet) */
|
/* Do the create */
|
||||||
DPRINT1("Unexpected: Creating new child\n");
|
Status = CmpDoCreate(Hive,
|
||||||
while (TRUE);
|
Cell,
|
||||||
|
AccessState,
|
||||||
|
&NextName,
|
||||||
|
AccessMode,
|
||||||
|
ParseContext,
|
||||||
|
ParentKcb,
|
||||||
|
Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for reparse (in this case, someone beat us) */
|
/* 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 */
|
/* ReactOS Hack: Hard-code current to 001 for SetupLdr */
|
||||||
if (!LoaderBlock->RegistryBase)
|
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 */
|
/* Use hard-coded setting */
|
||||||
ControlSet = 1;
|
ControlSet = 1;
|
||||||
goto UseSet;
|
goto UseSet;
|
||||||
|
@ -396,7 +416,6 @@ UseSet:
|
||||||
OBJ_CASE_INSENSITIVE,
|
OBJ_CASE_INSENSITIVE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
Status = NtCreateKey(&KeyHandle,
|
Status = NtCreateKey(&KeyHandle,
|
||||||
KEY_CREATE_LINK,
|
KEY_CREATE_LINK,
|
||||||
&ObjectAttributes,
|
&ObjectAttributes,
|
||||||
|
|
|
@ -18,6 +18,42 @@ BOOLEAN CmFirstTime = TRUE;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* 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
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
NtOpenKey(OUT PHANDLE KeyHandle,
|
NtOpenKey(OUT PHANDLE KeyHandle,
|
||||||
|
|
Loading…
Reference in a new issue