Author: hbelusca
Date: Mon Jun 19 20:04:25 2017
New Revision: 75141
URL:
http://svn.reactos.org/svn/reactos?rev=75141&view=rev
Log:
[NTOS]: Improve parameter namings in CmpLinkKeyToHive() and some of its DPRINTs; use
UNICODE_NULL where needed.
Modified:
trunk/reactos/ntoskrnl/config/cmsysini.c
Modified: trunk/reactos/ntoskrnl/config/cmsysini.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmsysini.c…
==============================================================================
--- trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/config/cmsysini.c [iso-8859-1] Mon Jun 19 20:04:25 2017
@@ -40,26 +40,27 @@
BOOLEAN
NTAPI
CmpLinkKeyToHive(
- _In_z_ PWSTR LinkKeyName,
- _In_z_ PWSTR TargetKeyName)
-{
+ _In_z_ PCWSTR LinkKeyName,
+ _In_z_ PCWSTR TargetKeyName)
+{
+ NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
- UNICODE_STRING LinkKeyName_U;
- HANDLE TargetKeyHandle;
+ UNICODE_STRING KeyName;
+ HANDLE LinkKeyHandle;
ULONG Disposition;
- NTSTATUS Status;
+
PAGED_CODE();
/* Initialize the object attributes */
- RtlInitUnicodeString(&LinkKeyName_U, LinkKeyName);
+ RtlInitUnicodeString(&KeyName, LinkKeyName);
InitializeObjectAttributes(&ObjectAttributes,
- &LinkKeyName_U,
+ &KeyName,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);
/* Create the link key */
- Status = ZwCreateKey(&TargetKeyHandle,
+ Status = ZwCreateKey(&LinkKeyHandle,
KEY_CREATE_LINK,
&ObjectAttributes,
0,
@@ -68,7 +69,7 @@
&Disposition);
if (!NT_SUCCESS(Status))
{
- DPRINT1("CM: CmpLinkKeyToHive: couldn't create %S Status =
0x%lx\n",
+ DPRINT1("CM: CmpLinkKeyToHive: couldn't create %S, Status =
0x%lx\n",
LinkKeyName, Status);
return FALSE;
}
@@ -77,25 +78,26 @@
if (Disposition != REG_CREATED_NEW_KEY)
{
DPRINT1("CM: CmpLinkKeyToHive: %S already exists!\n", LinkKeyName);
- ZwClose(TargetKeyHandle);
+ ZwClose(LinkKeyHandle);
return FALSE;
}
/* Set the target key name as link target */
- Status = ZwSetValueKey(TargetKeyHandle,
+ RtlInitUnicodeString(&KeyName, TargetKeyName);
+ Status = ZwSetValueKey(LinkKeyHandle,
&CmSymbolicLinkValueName,
0,
REG_LINK,
- TargetKeyName,
- (ULONG)wcslen(TargetKeyName) * sizeof(WCHAR));
+ KeyName.Buffer,
+ KeyName.Length);
/* Close the link key handle */
- ObCloseHandle(TargetKeyHandle, KernelMode);
-
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("CM: CmpLinkKeyToHive: couldn't create symbolic link for
%S\n",
- TargetKeyName);
+ ObCloseHandle(LinkKeyHandle, KernelMode);
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("CM: CmpLinkKeyToHive: couldn't create symbolic link for %S,
Status = 0x%lx\n",
+ TargetKeyName, Status);
return FALSE;
}
@@ -263,7 +265,7 @@
BytesToCopy);
/* Null terminate it */
- ObjectNameInfo->Name.Buffer[BytesToCopy / sizeof(WCHAR)] = 0;
+ ObjectNameInfo->Name.Buffer[BytesToCopy / sizeof(WCHAR)] = UNICODE_NULL;
}
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
@@ -1640,7 +1642,7 @@
/* Create the default security descriptor */
SecurityDescriptor = CmpHiveRootSecurityDescriptor();
- /* Create '\Registry\Machine' key. */
+ /* Create '\Registry\Machine' key */
RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
@@ -1663,7 +1665,7 @@
/* Close the handle */
NtClose(KeyHandle);
- /* Create '\Registry\User' key. */
+ /* Create '\Registry\User' key */
RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\USER");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
@@ -1696,7 +1698,7 @@
KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 7, 0, 0);
}
- /* Create the 'CurrentControlSet' link. */
+ /* Create the 'CurrentControlSet' link */
Status = CmpCreateControlSet(KeLoaderBlock);
if (!NT_SUCCESS(Status))
{