mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 04:35:07 +00:00
- Fix a bug in CmpCreateLinkNode when the link node alredy exists.
- Add some checks in CmpDoOpen to protect against illegal opens. - Handle symlinks instead of ignoring them (fixes CurrentControlSet problem). - Set disposition if this is an open due to a create. svn path=/trunk/; revision=31150
This commit is contained in:
parent
23979cefb4
commit
337eef1b8c
|
@ -584,13 +584,56 @@ CmpDoOpen(IN PHHIVE Hive,
|
||||||
/* It is, don't touch it */
|
/* It is, don't touch it */
|
||||||
return STATUS_OBJECT_NAME_NOT_FOUND;
|
return STATUS_OBJECT_NAME_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we have a context */
|
||||||
|
if (Context)
|
||||||
|
{
|
||||||
|
/* Check if this is a link create (which shouldn't be an open) */
|
||||||
|
if (Context->CreateLink)
|
||||||
|
{
|
||||||
|
return STATUS_ACCESS_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if this is symlink create attempt */
|
||||||
|
if (Context->CreateOptions & REG_OPTION_CREATE_LINK)
|
||||||
|
{
|
||||||
|
/* Key already exists */
|
||||||
|
return STATUS_OBJECT_NAME_COLLISION;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the disposition */
|
||||||
|
Context->Disposition = REG_OPENED_EXISTING_KEY;
|
||||||
|
}
|
||||||
|
|
||||||
/* Do this in the registry lock */
|
/* Do this in the registry lock */
|
||||||
CmpLockRegistry();
|
CmpLockRegistry();
|
||||||
|
|
||||||
/* If we have a KCB, make sure it's locked */
|
/* If we have a KCB, make sure it's locked */
|
||||||
//ASSERT(CmpIsKcbLockedExclusive(*CachedKcb));
|
//ASSERT(CmpIsKcbLockedExclusive(*CachedKcb));
|
||||||
|
|
||||||
|
/* Check if this is a symlink */
|
||||||
|
if ((Node->Flags & KEY_SYM_LINK) && !(Attributes & OBJ_OPENLINK))
|
||||||
|
{
|
||||||
|
/* Create the KCB for the symlink */
|
||||||
|
Kcb = CmpCreateKeyControlBlock(Hive,
|
||||||
|
Cell,
|
||||||
|
Node,
|
||||||
|
*CachedKcb,
|
||||||
|
0,
|
||||||
|
KeyName);
|
||||||
|
if (!Kcb) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
|
/* Make sure it's also locked, and set the pointer */
|
||||||
|
//ASSERT(CmpIsKcbLockedExclusive(Kcb));
|
||||||
|
*CachedKcb = Kcb;
|
||||||
|
|
||||||
|
/* Release the registry lock */
|
||||||
|
CmpUnlockRegistry();
|
||||||
|
|
||||||
|
/* Return reparse required */
|
||||||
|
return STATUS_REPARSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the KCB. FIXME: Use lock flag */
|
/* Create the KCB. FIXME: Use lock flag */
|
||||||
Kcb = CmpCreateKeyControlBlock(Hive,
|
Kcb = CmpCreateKeyControlBlock(Hive,
|
||||||
Cell,
|
Cell,
|
||||||
|
@ -735,7 +778,7 @@ CmpCreateLinkNode(IN PHHIVE Hive,
|
||||||
AccessState,
|
AccessState,
|
||||||
AccessMode,
|
AccessMode,
|
||||||
CreateOptions,
|
CreateOptions,
|
||||||
Context,
|
NULL,
|
||||||
0,
|
0,
|
||||||
&Kcb,
|
&Kcb,
|
||||||
&Name,
|
&Name,
|
||||||
|
|
Loading…
Reference in a new issue