[NTOS:IO] Avoid an unnecessary stack buffer in OpenRegistryHandlesFromSymbolicLink...
authorThomas Faber <thomas.faber@reactos.org>
Sun, 24 Mar 2019 09:55:04 +0000 (10:55 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Mon, 25 Mar 2019 07:43:47 +0000 (08:43 +0100)
ntoskrnl/io/iomgr/deviface.c

index 0e1f32f..3424502 100644 (file)
@@ -37,7 +37,6 @@ OpenRegistryHandlesFromSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
                                     IN OPTIONAL PHANDLE InstanceKey)
 {
     OBJECT_ATTRIBUTES ObjectAttributes;
-    WCHAR PathBuffer[MAX_PATH];
     UNICODE_STRING BaseKeyU;
     UNICODE_STRING GuidString, SubKeyName, ReferenceString;
     PWCHAR StartPosition, EndPosition;
@@ -67,11 +66,7 @@ OpenRegistryHandlesFromSymbolicLink(IN PUNICODE_STRING SymbolicLinkName,
     *DeviceKeyRealP = NULL;
     *InstanceKeyRealP = NULL;
 
-    BaseKeyU.Buffer = PathBuffer;
-    BaseKeyU.Length = 0;
-    BaseKeyU.MaximumLength = MAX_PATH * sizeof(WCHAR);
-
-    RtlAppendUnicodeToString(&BaseKeyU, BaseKeyString);
+    RtlInitUnicodeString(&BaseKeyU, BaseKeyString);
 
     /* Open the DeviceClasses key */
     InitializeObjectAttributes(&ObjectAttributes,