From 83ff161361cbf1c85df19ec16ae37758921c1f32 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Tue, 14 Jun 2005 18:33:02 +0000 Subject: [PATCH] It was a bad idea to manipulate the length of the given unicode string if we don't like the the starting back slash. svn path=/trunk/; revision=15912 --- reactos/ntoskrnl/ob/handle.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/ob/handle.c b/reactos/ntoskrnl/ob/handle.c index 9e98e56d7a5..bed19803bf9 100644 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@ -1015,22 +1015,21 @@ ObInsertObject(IN PVOID Object, /* FIXME: TEMPORARY HACK This will go in ObFindObject in the next commit */ PVOID NewName; PWSTR BufferPos = RemainingPath.Buffer; + ULONG Delta = 0; - NewName = ExAllocatePool(NonPagedPool, RemainingPath.MaximumLength); ObjectNameInfo = HEADER_TO_OBJECT_NAME(Header); if (BufferPos[0] == L'\\') { BufferPos++; - RemainingPath.Length -= 2; - RemainingPath.MaximumLength -= 2; + Delta = sizeof(WCHAR); } - - RtlMoveMemory(NewName, BufferPos, RemainingPath.MaximumLength); + NewName = ExAllocatePool(NonPagedPool, RemainingPath.MaximumLength - Delta); + RtlMoveMemory(NewName, BufferPos, RemainingPath.MaximumLength - Delta); if (ObjectNameInfo->Name.Buffer) ExFreePool(ObjectNameInfo->Name.Buffer); ObjectNameInfo->Name.Buffer = NewName; - ObjectNameInfo->Name.Length = RemainingPath.Length; - ObjectNameInfo->Name.MaximumLength = RemainingPath.MaximumLength; + ObjectNameInfo->Name.Length = RemainingPath.Length - Delta; + ObjectNameInfo->Name.MaximumLength = RemainingPath.MaximumLength - Delta; DPRINT("Name: %S\n", ObjectNameInfo->Name.Buffer); }