diff --git a/reactos/lib/rtl/atom.c b/reactos/lib/rtl/atom.c index 1720e64666e..b2f43c9a627 100644 --- a/reactos/lib/rtl/atom.c +++ b/reactos/lib/rtl/atom.c @@ -610,6 +610,10 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable, *NameLength = Length; } } + else if (NameLength != NULL) + { + *NameLength = (Entry->NameLength + 1) * sizeof(WCHAR); + } return Status; } @@ -651,6 +655,10 @@ RtlQueryAtomInAtomTable(PRTL_ATOM_TABLE AtomTable, *NameLength = Length; } } + else if (NameLength != NULL) + { + *NameLength = (Entry->NameLength + 1) * sizeof(WCHAR); + } } else { diff --git a/reactos/subsys/win32k/ntuser/class.c b/reactos/subsys/win32k/ntuser/class.c index 8082196c97a..915b9662b6f 100644 --- a/reactos/subsys/win32k/ntuser/class.c +++ b/reactos/subsys/win32k/ntuser/class.c @@ -208,7 +208,7 @@ IntGetClassName(struct _WINDOW_OBJECT *WindowObject, LPWSTR lpClassName, Length = 0; Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable, WindowObject->Class->Atom, NULL, NULL, NULL, &Length); - Name = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL), TAG_STRING); + Name = ExAllocatePoolWithTag(PagedPool, Length, TAG_STRING); Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable, WindowObject->Class->Atom, NULL, NULL, Name, &Length); if (!NT_SUCCESS(Status))