Commit in reactos on MAIN
ntoskrnl/io/buildirp.c+10-21.38 -> 1.39
           /irp.c+2-11.57 -> 1.58
ntoskrnl/mm/aspace.c+2-11.15 -> 1.16
           /npool.c+2-21.81 -> 1.82
           /pagefile.c+25-51.41 -> 1.42
           /ppool.c+2-31.25 -> 1.26
           /section.c+10-21.144 -> 1.145
           /slab.c+2-11.10 -> 1.11
ntoskrnl/ob/object.c+2-11.74 -> 1.75
subsys/win32k/objects/text.c+38-201.78 -> 1.79
+95-38
10 modified files
- Don't zero memory allocated by ExAllocatePool.
- Fix font enumeration algorithm to not depend on zeroed memory. (Harmut Birr)

reactos/ntoskrnl/io
buildirp.c 1.38 -> 1.39
diff -u -r1.38 -r1.39
--- buildirp.c	30 Dec 2003 18:52:04 -0000	1.38
+++ buildirp.c	4 Mar 2004 00:07:00 -0000	1.39
@@ -1,4 +1,4 @@
-/* $Id: buildirp.c,v 1.38 2003/12/30 18:52:04 fireball Exp $
+/* $Id: buildirp.c,v 1.39 2004/03/04 00:07:00 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -259,6 +259,13 @@
 	     RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer,
 			   InputBuffer,
 			   InputBufferLength);
+	     RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer + InputBufferLength,
+			   BufferLength - InputBufferLength);
+	  }
+	else
+	  {
+	     RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer,
+			   BufferLength);
 	  }
 	Irp->UserBuffer = OutputBuffer;
 	break;
@@ -273,12 +280,13 @@
                ExAllocatePoolWithTag(NonPagedPool,OutputBufferLength, 
 				     TAG_SYS_BUF);
 
-	     
 	     if (Irp->AssociatedIrp.SystemBuffer == NULL)
 	       {
 		  IoFreeIrp(Irp);
 		  return(NULL);
 	       }
+
+	     RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, OutputBufferLength);
 	     Irp->UserBuffer = OutputBuffer;
 	  }
 	

reactos/ntoskrnl/io
irp.c 1.57 -> 1.58
diff -u -r1.57 -r1.58
--- irp.c	31 Dec 2003 14:16:18 -0000	1.57
+++ irp.c	4 Mar 2004 00:07:00 -0000	1.58
@@ -1,4 +1,4 @@
-/* $Id: irp.c,v 1.57 2003/12/31 14:16:18 hbirr Exp $
+/* $Id: irp.c,v 1.58 2004/03/04 00:07:00 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -200,6 +200,7 @@
       return(NULL);
     }
 
+  RtlZeroMemory(Irp, IoSizeOfIrp(StackSize));
   IoInitializeIrp(Irp,
 		  IoSizeOfIrp(StackSize),
 		  StackSize);

reactos/ntoskrnl/mm
aspace.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- aspace.c	12 Oct 2003 17:05:48 -0000	1.15
+++ aspace.c	4 Mar 2004 00:07:01 -0000	1.16
@@ -1,4 +1,4 @@
-/* $Id: aspace.c,v 1.15 2003/10/12 17:05:48 hbirr Exp $
+/* $Id: aspace.c,v 1.16 2004/03/04 00:07:01 navaraf Exp $
  * 
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -88,6 +88,7 @@
 	AddressSpace->PageTableRefCountTable = 
 	  ExAllocatePoolWithTag(NonPagedPool, 768 * sizeof(USHORT),
 				TAG_PTRC);
+	RtlZeroMemory(AddressSpace->PageTableRefCountTable, 768 * sizeof(USHORT));
 	AddressSpace->PageTableRefCountTableSize = 768;
      }
    else

reactos/ntoskrnl/mm
npool.c 1.81 -> 1.82
diff -u -r1.81 -r1.82
--- npool.c	7 Feb 2004 16:37:23 -0000	1.81
+++ npool.c	4 Mar 2004 00:07:01 -0000	1.82
@@ -1,4 +1,4 @@
-/* $Id: npool.c,v 1.81 2004/02/07 16:37:23 hbirr Exp $
+/* $Id: npool.c,v 1.82 2004/03/04 00:07:01 navaraf Exp $
  *
  * COPYRIGHT:    See COPYING in the top level directory
  * PROJECT:      ReactOS kernel
@@ -1633,7 +1633,7 @@
 #endif
    KeReleaseSpinLock(&MmNpoolLock, oldIrql);
    block = block_to_address(best);
-   memset(block,0,Size);
+/*   RtlZeroMemory(block, Size);*/
    return(block);
 #endif /* WHOLE_PAGE_ALLOCATIONS */
 }

reactos/ntoskrnl/mm
pagefile.c 1.41 -> 1.42
diff -u -r1.41 -r1.42
--- pagefile.c	30 Dec 2003 18:52:05 -0000	1.41
+++ pagefile.c	4 Mar 2004 00:07:01 -0000	1.42
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: pagefile.c,v 1.41 2003/12/30 18:52:05 fireball Exp $
+/* $Id: pagefile.c,v 1.42 2004/03/04 00:07:01 navaraf Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/mm/pagefile.c
@@ -453,6 +453,22 @@
    return(0);
 }
 
+STATIC PRETRIEVEL_DESCRIPTOR_LIST FASTCALL
+MmAllocRetrievelDescriptorList(ULONG Pairs)
+{
+   ULONG Size;
+   PRETRIEVEL_DESCRIPTOR_LIST RetDescList;
+
+   Size = sizeof(RETRIEVEL_DESCRIPTOR_LIST) + Pairs * sizeof(MAPPING_PAIR);
+   RetDescList = ExAllocatePool(NonPagedPool, Size);
+   if (RetDescList)
+     {
+       RtlZeroMemory(RetDescList, Size);
+     }
+
+   return RetDescList;
+}
+
 NTSTATUS STDCALL 
 MmDumpToPagingFile(ULONG BugCode,
 		   ULONG BugCodeParameter1,
@@ -716,7 +732,6 @@
    PPAGINGFILE PagingFile;
    KIRQL oldIrql;
    ULONG AllocMapSize;
-   ULONG Size;
    FILE_FS_SIZE_INFORMATION FsSizeInformation;
    PRETRIEVEL_DESCRIPTOR_LIST RetDescList;
    PRETRIEVEL_DESCRIPTOR_LIST CurrentRetDescList;
@@ -726,6 +741,7 @@
    ULONG ExtentCount;
    ULONG MaxVcn;
    ULONG Count;
+   ULONG Size;
 
    DPRINT("NtCreatePagingFile(FileName %wZ, InitialSize %I64d)\n",
 	  FileName, InitialSize->QuadPart);
@@ -801,8 +817,7 @@
 	return(Status);
      }
 
-   Size = sizeof(RETRIEVEL_DESCRIPTOR_LIST) + PAIRS_PER_RUN * sizeof(MAPPING_PAIR);
-   CurrentRetDescList = RetDescList = ExAllocatePool(NonPagedPool, Size);
+   CurrentRetDescList = RetDescList = MmAllocRetrievelDescriptorList(PAIRS_PER_RUN);
 
    if (CurrentRetDescList == NULL)
      {
@@ -845,7 +860,7 @@
        ExtentCount += CurrentRetDescList->RetrievalPointers.NumberOfPairs;
        if ((ULONG)CurrentRetDescList->RetrievalPointers.Pair[CurrentRetDescList->RetrievalPointers.NumberOfPairs-1].Vcn < MaxVcn)
          {
-           CurrentRetDescList->Next = ExAllocatePool(NonPagedPool, Size);
+           CurrentRetDescList->Next = MmAllocRetrievelDescriptorList(PAIRS_PER_RUN);
 	   if (CurrentRetDescList->Next == NULL)
 	     {
 	       while (RetDescList)
@@ -881,6 +896,8 @@
        return(STATUS_NO_MEMORY);
      }
    
+   RtlZeroMemory(PagingFile, sizeof(*PagingFile));
+
    PagingFile->FileObject = FileObject;
    PagingFile->MaximumSize.QuadPart = MaximumSize->QuadPart;
    PagingFile->CurrentSize.QuadPart = InitialSize->QuadPart;
@@ -924,6 +941,9 @@
       return(STATUS_NO_MEMORY);
    }
 
+   RtlZeroMemory(PagingFile->AllocMap, AllocMapSize * sizeof(ULONG));
+   RtlZeroMemory(PagingFile->RetrievalPointers, Size);
+
    Count = 0;
    PagingFile->RetrievalPointers->NumberOfPairs = ExtentCount;
    PagingFile->RetrievalPointers->StartVcn = RetDescList->RetrievalPointers.StartVcn;

reactos/ntoskrnl/mm
ppool.c 1.25 -> 1.26
diff -u -r1.25 -r1.26
--- ppool.c	15 Feb 2004 19:03:29 -0000	1.25
+++ ppool.c	4 Mar 2004 00:07:02 -0000	1.26
@@ -1,4 +1,4 @@
-/* $Id: ppool.c,v 1.25 2004/02/15 19:03:29 hbirr Exp $
+/* $Id: ppool.c,v 1.26 2004/03/04 00:07:02 navaraf Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -406,8 +406,7 @@
   ExReleaseFastMutex(&MmPagedPoolLock);
 
   BlockAddress = block_to_address ( NewBlock );
-
-  memset(BlockAddress, 0, NumberOfBytes);
+/*  RtlZeroMemory(BlockAddress, NumberOfBytes);*/
 
 #if MM_PPOOL_REDZONE_BYTES
   NewBlock->UserSize = NumberOfBytes;

reactos/ntoskrnl/mm
section.c 1.144 -> 1.145
diff -u -r1.144 -r1.145
--- section.c	31 Jan 2004 00:16:55 -0000	1.144
+++ section.c	4 Mar 2004 00:07:02 -0000	1.145
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: section.c,v 1.144 2004/01/31 00:16:55 hbirr Exp $
+/* $Id: section.c,v 1.145 2004/03/04 00:07:02 navaraf Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/mm/section.c
@@ -2328,9 +2328,13 @@
   Segment->FileOffset = 0;
   Segment->Protection = SectionPageProtection;
   Segment->Attributes = AllocationAttributes;
-  Segment->Length = MaximumSize.u.LowPart;
+  Segment->RawLength = MaximumSize.u.LowPart;
+  Segment->Length = PAGE_ROUND_UP(MaximumSize.u.LowPart);
   Segment->Flags = MM_PAGEFILE_SEGMENT;
   Segment->WriteCopy = FALSE;
+  RtlZeroMemory(&Segment->PageDirectory, sizeof(SECTION_PAGE_DIRECTORY));
+  Segment->VirtualAddress = 0;
+  Segment->Characteristics = 0;
   ObDereferenceObject(Section);
   return(STATUS_SUCCESS);
 }
@@ -2564,6 +2568,7 @@
 	  Segment->Length = PAGE_ROUND_UP(Segment->RawLength);
 	}
       Segment->VirtualAddress = NULL;
+      RtlZeroMemory(&Segment->PageDirectory, sizeof(SECTION_PAGE_DIRECTORY));
     }
   else
     {
@@ -2888,7 +2893,9 @@
         SectionSegments[0].ReferenceCount = 1;
         SectionSegments[0].VirtualAddress = 0;
         SectionSegments[0].WriteCopy = TRUE;
+        SectionSegments[0].Attributes = 0;
 	ExInitializeFastMutex(&SectionSegments[0].Lock);
+	RtlZeroMemory(&SectionSegments[0].PageDirectory, sizeof(SECTION_PAGE_DIRECTORY));
         for (i = 1; i < NrSegments; i++)
 	  {
 	    SectionSegments[i].FileOffset = ImageSections[i-1].PointerToRawData;
@@ -2950,6 +2957,7 @@
 	    SectionSegments[i].ReferenceCount = 1;
 	    SectionSegments[i].VirtualAddress = (PVOID)ImageSections[i-1].VirtualAddress;
 	    ExInitializeFastMutex(&SectionSegments[i].Lock);
+	    RtlZeroMemory(&SectionSegments[i].PageDirectory, sizeof(SECTION_PAGE_DIRECTORY));
 	  }
         if (0 != InterlockedCompareExchange((PLONG)&FileObject->SectionObjectPointer->ImageSectionObject,
 	                                    (LONG)ImageSectionObject, 0))

reactos/ntoskrnl/mm
slab.c 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- slab.c	30 Dec 2003 18:52:05 -0000	1.10
+++ slab.c	4 Mar 2004 00:07:02 -0000	1.11
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: slab.c,v 1.10 2003/12/30 18:52:05 fireball Exp $
+/* $Id: slab.c,v 1.11 2004/03/04 00:07:02 navaraf Exp $
  *
  * COPYRIGHT:   See COPYING in the top directory
  * PROJECT:     ReactOS kernel 
@@ -93,6 +93,7 @@
   Slab->ObjectSize = ObjectSize + AlignSize;
   Slab->ObjectsPerPage = 
     (PAGE_SIZE - sizeof(SLAB_CACHE_PAGE)) / Slab->ObjectSize;
+  Slab->FirstFreePage = NULL;
   InitializeListHead(&Slab->PageListHead);
   KeInitializeSpinLock(&Slab->SlabLock);
   

reactos/ntoskrnl/ob
object.c 1.74 -> 1.75
diff -u -r1.74 -r1.75
--- object.c	31 Jan 2004 16:52:47 -0000	1.74
+++ object.c	4 Mar 2004 00:07:02 -0000	1.75
@@ -1,4 +1,4 @@
-/* $Id: object.c,v 1.74 2004/01/31 16:52:47 ekohl Exp $
+/* $Id: object.c,v 1.75 2004/03/04 00:07:02 navaraf Exp $
  * 
  * COPYRIGHT:     See COPYING in the top level directory
  * PROJECT:       ReactOS kernel
@@ -377,6 +377,7 @@
 						 Type->Tag);
   if (Header == NULL)
     return STATUS_INSUFFICIENT_RESOURCES;
+  RtlZeroMemory(Header, OBJECT_ALLOC_SIZE(ObjectSize));
 
   /* Initialize the object header */
   Header->HandleCount = 0;

reactos/subsys/win32k/objects
text.c 1.78 -> 1.79
diff -u -r1.78 -r1.79
--- text.c	24 Feb 2004 13:27:03 -0000	1.78
+++ text.c	4 Mar 2004 00:07:03 -0000	1.79
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: text.c,v 1.78 2004/02/24 13:27:03 weiden Exp $ */
+/* $Id: text.c,v 1.79 2004/03/04 00:07:03 navaraf Exp $ */
 
 
 #undef WIN32_LEAN_AND_MEAN
@@ -253,6 +253,7 @@
 	PFILE_DIRECTORY_INFORMATION iFileData;
 	PVOID   pBuff;
 	BOOLEAN bRestartScan = TRUE;
+    BOOLEAN Result = FALSE;
 	
 	InitializeListHead(&FontListHead);
     ExInitializeFastMutex(&FontListLock);
@@ -281,13 +282,22 @@
         {          
             while(1)
             {   
-                iFileData = NULL;
+		if (bRestartScan)
+		  {
                 pBuff = ExAllocatePool(NonPagedPool,0x4000);
+		    if (pBuff == NULL)
+		      {
+		        break;
+		      }
                 RtlInitUnicodeString(&cchFilename,0);
                 cchFilename.MaximumLength = 0x1000;
                 cchFilename.Buffer = ExAllocatePoolWithTag(PagedPool,cchFilename.MaximumLength, TAG_STRING);
- 
-                cchFilename.Length = 0;
+		    if (cchFilename.Buffer == NULL)
+		      {
+		        ExFreePool(pBuff);
+		        break;
+		      }
+		  }
 				    
 				Status = NtQueryDirectoryFile( hDirectory,
 				                               NULL,
@@ -297,33 +307,41 @@
 				                               pBuff,
 				                               0x4000,
 				                               FileDirectoryInformation,
-				                               TRUE,
+					       FALSE,
 				                               &cchSearchPattern,
 				                               bRestartScan );
 				   
-                iFileData = (PFILE_DIRECTORY_INFORMATION)pBuff;
-                 
-                RtlAppendUnicodeToString(&cchFilename, cchDir.Buffer);
-                RtlAppendUnicodeToString(&cchFilename, iFileData->FileName);
-				RtlAppendUnicodeToString(&cchFilename, L"\0");
-				    
 				if( !NT_SUCCESS(Status) || Status == STATUS_NO_MORE_FILES )
-				    break;
-
-				IntGdiAddFontResource(&cchFilename, 0);
+		  {
 				ExFreePool(pBuff);
 				ExFreePool(cchFilename.Buffer);
+		    break;
+		  }
 				bRestartScan = FALSE;
+                iFileData = (PFILE_DIRECTORY_INFORMATION)pBuff;
+		while(1)
+		  {
+		    UNICODE_STRING tmpString;
+		    tmpString.Buffer = iFileData->FileName;
+		    tmpString.Length = tmpString.MaximumLength = iFileData->FileNameLength;
+                    RtlCopyUnicodeString(&cchFilename, &cchDir);
+                    RtlAppendUnicodeStringToString(&cchFilename, &tmpString);
+		    cchFilename.Buffer[cchFilename.Length / sizeof(WCHAR)] = 0;
+		    if (0 != IntGdiAddFontResource(&cchFilename, 0))
+		      {
+		        Result = TRUE;
+		      }
+		    if (iFileData->NextEntryOffset == 0)
+		      {
+		        break;
+		      }
+		    iFileData = (PVOID)iFileData + iFileData->NextEntryOffset;
+		  }
 			}
-			ExFreePool(cchFilename.Buffer);
-			ExFreePool(pBuff);
-			ZwClose(hDirectory);
-			
-			return TRUE;
         }
     }
     ZwClose(hDirectory);
-	return FALSE;
+    return Result;
 }
 
 static NTSTATUS STDCALL
CVSspam 0.2.8