--- trunk/reactos/ntoskrnl/ob/dirobj.c 2005-09-10 20:19:23 UTC (rev 17788)
+++ trunk/reactos/ntoskrnl/ob/dirobj.c 2005-09-10 22:35:08 UTC (rev 17789)
@@ -219,14 +219,14 @@
NULL);
if(NT_SUCCESS(Status))
{
- PVOID TemporaryBuffer = ExAllocatePool(PagedPool,
+ PVOID TemporaryBuffer = ExAllocatePool(NonPagedPool,
BufferLength);
if(TemporaryBuffer != NULL)
{
POBJECT_HEADER EntryHeader;
PLIST_ENTRY ListEntry;
KIRQL OldLevel;
- ULONG RequiredSize = 0;
+ ULONG RequiredSize = sizeof(OBJECT_DIRECTORY_INFORMATION);
ULONG nDirectories = 0;
POBJECT_DIRECTORY_INFORMATION DirInfo = (POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer;
@@ -315,10 +315,11 @@
if(NT_SUCCESS(Status) && nDirectories > 0)
{
- PWSTR strbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer + nDirectories);
- PWSTR deststrbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)Buffer + nDirectories);
+ PWSTR strbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer + nDirectories + 1);
+ PWSTR deststrbuf = (PWSTR)((POBJECT_DIRECTORY_INFORMATION)Buffer + nDirectories + 1);
+ memset((POBJECT_DIRECTORY_INFORMATION)TemporaryBuffer + nDirectories, 0, sizeof(OBJECT_DIRECTORY_INFORMATION));
- CopyBytes = nDirectories * sizeof(OBJECT_DIRECTORY_INFORMATION);
+ CopyBytes = (nDirectories + 1) * sizeof(OBJECT_DIRECTORY_INFORMATION);
/* copy the names from the objects and append them to the list of the
objects. copy to the temporary buffer only because the directory