projects
/
reactos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[NTOS] Drastically reduce the hackish function CmpGetRegistryPath() for the text...
[reactos.git]
/
ntoskrnl
/
config
/
cmparse.c
diff --git
a/ntoskrnl/config/cmparse.c
b/ntoskrnl/config/cmparse.c
index
acf5e24
..
fe25e25
100644
(file)
--- a/
ntoskrnl/config/cmparse.c
+++ b/
ntoskrnl/config/cmparse.c
@@
-24,6
+24,8
@@
CmpGetNextName(IN OUT PUNICODE_STRING RemainingName,
{
BOOLEAN NameValid = TRUE;
{
BOOLEAN NameValid = TRUE;
+ ASSERT(RemainingName->Length % sizeof(WCHAR) == 0);
+
/* Check if there's nothing left in the name */
if (!(RemainingName->Buffer) ||
(!RemainingName->Length) ||
/* Check if there's nothing left in the name */
if (!(RemainingName->Buffer) ||
(!RemainingName->Length) ||
@@
-37,7
+39,8
@@
CmpGetNextName(IN OUT PUNICODE_STRING RemainingName,
}
/* Check if we have a path separator */
}
/* Check if we have a path separator */
- if (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR)
+ while ((RemainingName->Length) &&
+ (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR))
{
/* Skip it */
RemainingName->Buffer++;
{
/* Skip it */
RemainingName->Buffer++;
@@
-47,15
+50,9
@@
CmpGetNextName(IN OUT PUNICODE_STRING RemainingName,
/* Start loop at where the current buffer is */
NextName->Buffer = RemainingName->Buffer;
/* Start loop at where the current buffer is */
NextName->Buffer = RemainingName->Buffer;
- while (TRUE)
+ while ((RemainingName->Length) &&
+ (*RemainingName->Buffer != OBJ_NAME_PATH_SEPARATOR))
{
{
- /* Break out if we ran out or hit a path separator */
- if (!(RemainingName->Length) ||
- (*RemainingName->Buffer == OBJ_NAME_PATH_SEPARATOR))
- {
- break;
- }
-
/* Move to the next character */
RemainingName->Buffer++;
RemainingName->Length -= sizeof(WCHAR);
/* Move to the next character */
RemainingName->Buffer++;
RemainingName->Length -= sizeof(WCHAR);
@@
-115,7
+112,7
@@
CmpGetSymbolicLink(IN PHHIVE Hive,
if (!CmpGetValueData(Hive,
LinkValue,
&ValueLength,
if (!CmpGetValueData(Hive,
LinkValue,
&ValueLength,
- (PVOID)&LinkName,
+ (PVOID
*
)&LinkName,
&LinkNameAllocated,
&CellToRelease))
{
&LinkNameAllocated,
&CellToRelease))
{
@@
-222,13
+219,12
@@
CmpDoCreateChild(IN PHHIVE Hive,
PCM_KEY_NODE KeyNode;
PCELL_DATA CellData;
ULONG StorageType;
PCM_KEY_NODE KeyNode;
PCELL_DATA CellData;
ULONG StorageType;
- LARGE_INTEGER SystemTime;
PCM_KEY_CONTROL_BLOCK Kcb;
PSECURITY_DESCRIPTOR NewDescriptor;
/* Get the storage type */
StorageType = Stable;
PCM_KEY_CONTROL_BLOCK Kcb;
PSECURITY_DESCRIPTOR NewDescriptor;
/* Get the storage type */
StorageType = Stable;
- if (
Flag
s & REG_OPTION_VOLATILE) StorageType = Volatile;
+ if (
ParseContext->CreateOption
s & REG_OPTION_VOLATILE) StorageType = Volatile;
/* Allocate the child */
*KeyCell = HvAllocateCell(Hive,
/* Allocate the child */
*KeyCell = HvAllocateCell(Hive,
@@
-286,7
+282,7
@@
CmpDoCreateChild(IN PHHIVE Hive,
/* Setup the key body */
KeyBody = (PCM_KEY_BODY)(*Object);
/* Setup the key body */
KeyBody = (PCM_KEY_BODY)(*Object);
- KeyBody->Type =
'20yk'
;
+ KeyBody->Type =
CM_KEY_BODY_TYPE
;
KeyBody->KeyControlBlock = NULL;
/* Check if we had a class */
KeyBody->KeyControlBlock = NULL;
/* Check if we had a class */
@@
-314,9
+310,8
@@
CmpDoCreateChild(IN PHHIVE Hive,
/* Fill out the key node */
KeyNode->Signature = CM_KEY_NODE_SIGNATURE;
/* Fill out the key node */
KeyNode->Signature = CM_KEY_NODE_SIGNATURE;
- KeyNode->Flags = Flags &~ REG_OPTION_CREATE_LINK;
- KeQuerySystemTime(&SystemTime);
- KeyNode->LastWriteTime = SystemTime;
+ KeyNode->Flags = Flags;
+ KeQuerySystemTime(&KeyNode->LastWriteTime);
KeyNode->Spare = 0;
KeyNode->Parent = ParentCell;
KeyNode->SubKeyCounts[Stable] = 0;
KeyNode->Spare = 0;
KeyNode->Parent = ParentCell;
KeyNode->SubKeyCounts[Stable] = 0;
@@
-381,6
+376,9
@@
CmpDoCreateChild(IN PHHIVE Hive,
&CmpKeyObjectType->TypeInfo.GenericMapping);
}
&CmpKeyObjectType->TypeInfo.GenericMapping);
}
+ /* Now that the security descriptor is copied in the hive, we can free the original */
+ SeDeassignSecurity(&NewDescriptor);
+
Quickie:
/* Check if we got here because of failure */
if (!NT_SUCCESS(Status))
Quickie:
/* Check if we got here because of failure */
if (!NT_SUCCESS(Status))
@@
-477,7
+475,7
@@
CmpDoCreate(IN PHHIVE Hive,
AccessMode,
ParseContext,
ParentKcb,
AccessMode,
ParseContext,
ParentKcb,
- ParseContext->CreateOptions, // WRONG!
+ 0,
&KeyCell,
Object);
if (NT_SUCCESS(Status))
&KeyCell,
Object);
if (NT_SUCCESS(Status))
@@
-519,7
+517,7
@@
CmpDoCreate(IN PHHIVE Hive,
KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen = Name->Length;
}
KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen = Name->Length;
}
- /* Check if we need toupdate class length maximum */
+ /* Check if we need to
update class length maximum */
if (KeyNode->MaxClassLen < ParseContext->Class.Length)
{
/* Update it */
if (KeyNode->MaxClassLen < ParseContext->Class.Length)
{
/* Update it */
@@
-691,7
+689,7
@@
CmpDoOpen(IN PHHIVE Hive,
/* Get the key body and fill it out */
KeyBody = (PCM_KEY_BODY)(*Object);
KeyBody->KeyControlBlock = Kcb;
/* Get the key body and fill it out */
KeyBody = (PCM_KEY_BODY)(*Object);
KeyBody->KeyControlBlock = Kcb;
- KeyBody->Type =
'20yk'
;
+ KeyBody->Type =
CM_KEY_BODY_TYPE
;
KeyBody->ProcessID = PsGetCurrentProcessId();
KeyBody->NotifyBlock = NULL;
KeyBody->ProcessID = PsGetCurrentProcessId();
KeyBody->NotifyBlock = NULL;
@@
-718,7
+716,6
@@
CmpDoOpen(IN PHHIVE Hive,
return Status;
}
return Status;
}
-/* Remove calls to CmCreateRootNode once this is used! */
NTSTATUS
NTAPI
CmpCreateLinkNode(IN PHHIVE Hive,
NTSTATUS
NTAPI
CmpCreateLinkNode(IN PHHIVE Hive,
@@
-929,7
+926,7
@@
CmpCreateLinkNode(IN PHHIVE Hive,
KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen = Name.Length;
}
KeyBody->KeyControlBlock->ParentKcb->KcbMaxNameLen = Name.Length;
}
- /* Check if we need toupdate class length maximum */
+ /* Check if we need to
update class length maximum */
if (KeyNode->MaxClassLen < Context->Class.Length)
{
/* Update it */
if (KeyNode->MaxClassLen < Context->Class.Length)
{
/* Update it */
@@
-1100,7
+1097,8
@@
CmpParseKey(IN PVOID ParseObject,
ASSERT(ParentKcb != NULL);
/* Check if everything was found cached */
ASSERT(ParentKcb != NULL);
/* Check if everything was found cached */
- if (!TotalRemainingSubkeys) ASSERTMSG("Caching not implemented", FALSE);
+ if (!TotalRemainingSubkeys)
+ ASSERTMSG("Caching not implemented\n", FALSE);
/* Don't do anything if we're being deleted */
if (Kcb->Delete)
/* Don't do anything if we're being deleted */
if (Kcb->Delete)
@@
-1269,6
+1267,11
@@
CmpParseKey(IN PVOID ParseObject,
ParentKcb,
Object);
}
ParentKcb,
Object);
}
+ else if (Hive == &CmiVolatileHive->Hive && CmpNoVolatileCreates)
+ {
+ /* Creating keys in the master hive is not allowed */
+ Status = STATUS_INVALID_PARAMETER;
+ }
else
{
/* Do the create */
else
{
/* Do the create */