diff --git a/reactos/lib/kernel32/misc/atom.c b/reactos/lib/kernel32/misc/atom.c index e4e61d664b9..75ddb2696ee 100644 --- a/reactos/lib/kernel32/misc/atom.c +++ b/reactos/lib/kernel32/misc/atom.c @@ -1,4 +1,4 @@ -/* $Id: atom.c,v 1.17 2003/07/10 18:50:51 chorns Exp $ +/* $Id: atom.c,v 1.18 2003/10/28 09:49:04 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -201,7 +201,7 @@ GlobalGetAtomNameA(ATOM nAtom, Status = NtQueryInformationAtom(nAtom, AtomBasicInformation, - (PVOID)&Buffer, + Buffer, BufferSize, &ReturnLength); if (!NT_SUCCESS(Status)) @@ -250,7 +250,7 @@ GlobalGetAtomNameW(ATOM nAtom, Status = NtQueryInformationAtom(nAtom, AtomBasicInformation, - (PVOID)&Buffer, + Buffer, BufferSize, &ReturnLength); if (!NT_SUCCESS(Status)) @@ -261,8 +261,9 @@ GlobalGetAtomNameW(ATOM nAtom, return 0; } - wcscpy(lpBuffer, Buffer->Name); + memcpy(lpBuffer, Buffer->Name, Buffer->NameLength); ReturnLength = Buffer->NameLength / sizeof(WCHAR); + *(lpBuffer + ReturnLength) = 0; RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); diff --git a/reactos/ntoskrnl/rtl/atom.c b/reactos/ntoskrnl/rtl/atom.c index 613226a10c1..15af473170f 100644 --- a/reactos/ntoskrnl/rtl/atom.c +++ b/reactos/ntoskrnl/rtl/atom.c @@ -1,4 +1,4 @@ -/* $Id: atom.c,v 1.5 2003/07/11 01:23:15 royce Exp $ +/* $Id: atom.c,v 1.6 2003/10/28 09:49:04 navaraf Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -18,8 +18,6 @@ #define NDEBUG #include - - typedef struct _RTL_ATOM_ENTRY { LIST_ENTRY List; @@ -635,8 +633,8 @@ RtlQueryAtomInAtomTable(IN PRTL_ATOM_TABLE AtomTable, return STATUS_BUFFER_TOO_SMALL; } - Length = swprintf(AtomName, L"%s", AtomEntry->Name.Buffer); - *NameLength = Length * sizeof(WCHAR); + memcpy(AtomName, AtomEntry->Name.Buffer, AtomEntry->Name.Length); + *NameLength = AtomEntry->Name.Length; } RtlpUnlockAtomTable(AtomTable); @@ -874,6 +872,7 @@ RtlpQueryAtomInformation(PRTL_ATOM_TABLE AtomTable, &Flags, AtomInformation->Name, &NameLength); + if (!NT_SUCCESS(Status)) { return Status;