[ros-diffs] [cwittich] 27434: -some minor changes to be able to build the driver with PREfast -use ExAllocatePoolWithTag instead of ExAllocatePool

cwittich at svn.reactos.org cwittich at svn.reactos.org
Fri Jul 6 22:25:41 CEST 2007


Author: cwittich
Date: Sat Jul  7 00:25:40 2007
New Revision: 27434

URL: http://svn.reactos.org/svn/reactos?rev=27434&view=rev
Log:
-some minor changes to be able to build the driver with PREfast
-use ExAllocatePoolWithTag instead of ExAllocatePool

Modified:
    trunk/reactos/drivers/bus/pci/fdo.c
    trunk/reactos/drivers/bus/pci/pci.c
    trunk/reactos/drivers/bus/pci/pci.h
    trunk/reactos/drivers/bus/pci/pdo.c

Modified: trunk/reactos/drivers/bus/pci/fdo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/fdo.c?rev=27434&r1=27433&r2=27434&view=diff
==============================================================================
--- trunk/reactos/drivers/bus/pci/fdo.c (original)
+++ trunk/reactos/drivers/bus/pci/fdo.c Sat Jul  7 00:25:40 2007
@@ -9,7 +9,9 @@
 
 #include "pci.h"
 
+#ifndef NDEBUG
 #define NDEBUG
+#endif
 #include <debug.h>
 
 /*** PRIVATE *****************************************************************/
@@ -122,7 +124,7 @@
       Status = FdoLocateChildDevice(&Device, DeviceExtension, SlotNumber, &PciConfig);
       if (!NT_SUCCESS(Status))
       {
-        Device = (PPCI_DEVICE)ExAllocatePool(NonPagedPool, sizeof(PCI_DEVICE));
+        Device = (PPCI_DEVICE)ExAllocatePoolWithTag(NonPagedPool, sizeof(PCI_DEVICE),TAG_PCI);
         if (!Device)
         {
           /* FIXME: Cleanup resources for already discovered devices */
@@ -204,7 +206,7 @@
 
   Size = sizeof(DEVICE_RELATIONS) + sizeof(Relations->Objects) *
     (DeviceExtension->DeviceListCount - 1);
-  Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, Size);
+  Relations = (PDEVICE_RELATIONS)ExAllocatePoolWithTag(PagedPool, Size, TAG_PCI);
   if (!Relations)
     return STATUS_INSUFFICIENT_RESOURCES;
 

Modified: trunk/reactos/drivers/bus/pci/pci.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pci.c?rev=27434&r1=27433&r2=27434&view=diff
==============================================================================
--- trunk/reactos/drivers/bus/pci/pci.c (original)
+++ trunk/reactos/drivers/bus/pci/pci.c Sat Jul  7 00:25:40 2007
@@ -10,7 +10,9 @@
 #define INITGUID
 #include "pci.h"
 
+#ifndef NDEBUG
 #define NDEBUG
+#endif
 #include <debug.h>
 
 
@@ -280,7 +282,7 @@
 
   Buffer[Index] = UNICODE_NULL;
   
-  BufferU.Length = BufferU.MaximumLength = Index * sizeof(WCHAR);
+  BufferU.Length = BufferU.MaximumLength = (USHORT) Index * sizeof(WCHAR);
   BufferU.Buffer = Buffer;
 
   return RtlDuplicateUnicodeString(0, &BufferU, HardwareIDs);
@@ -344,7 +346,7 @@
 
   Buffer[Index] = UNICODE_NULL;
 
-  BufferU.Length = BufferU.MaximumLength = Index * sizeof(WCHAR);
+  BufferU.Length = BufferU.MaximumLength = (USHORT)Index * sizeof(WCHAR);
   BufferU.Buffer = Buffer;
 
   return RtlDuplicateUnicodeString(0, &BufferU, CompatibleIDs);

Modified: trunk/reactos/drivers/bus/pci/pci.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pci.h?rev=27434&r1=27433&r2=27434&view=diff
==============================================================================
--- trunk/reactos/drivers/bus/pci/pci.h (original)
+++ trunk/reactos/drivers/bus/pci/pci.h Sat Jul  7 00:25:40 2007
@@ -4,6 +4,15 @@
 #include <ntifs.h>
 #include <wdmguid.h>
 #include <stdio.h>
+#include <ntddk.h>
+
+#ifdef _MSC_VER
+  #define STDCALL
+  #define DDKAPI
+#endif
+
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+#define TAG_PCI TAG('P', 'C', 'I', '0')
 
 typedef struct _PCI_DEVICE
 {

Modified: trunk/reactos/drivers/bus/pci/pdo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/pci/pdo.c?rev=27434&r1=27433&r2=27434&view=diff
==============================================================================
--- trunk/reactos/drivers/bus/pci/pdo.c (original)
+++ trunk/reactos/drivers/bus/pci/pdo.c Sat Jul  7 00:25:40 2007
@@ -9,7 +9,9 @@
 
 #include "pci.h"
 
+#ifndef NDEBUG
 #define NDEBUG
+#endif
 #include <debug.h>
 
 /*** PRIVATE *****************************************************************/
@@ -134,7 +136,7 @@
 
   DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
   FdoDeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceExtension->Fdo->DeviceExtension;
-  BusInformation = ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION));
+  BusInformation = ExAllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION), TAG_PCI);
   Irp->IoStatus.Information = (ULONG_PTR)BusInformation;
   if (BusInformation != NULL)
   {
@@ -397,8 +399,8 @@
   DPRINT("ListSize %lu (0x%lx)\n", ListSize, ListSize);
 
   /* Allocate the resource requirements list */
-  ResourceList = ExAllocatePool(PagedPool,
-                                ListSize);
+  ResourceList = ExAllocatePoolWithTag(PagedPool,
+                                ListSize, TAG_PCI);
   if (ResourceList == NULL)
   {
     Irp->IoStatus.Information = 0;
@@ -702,8 +704,8 @@
     + ResCount * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
 
   /* Allocate the resource list */
-  ResourceList = ExAllocatePool(PagedPool,
-                                ListSize);
+  ResourceList = ExAllocatePoolWithTag(PagedPool,
+                                ListSize, TAG_PCI);
   if (ResourceList == NULL)
     return STATUS_INSUFFICIENT_RESOURCES;
 




More information about the Ros-diffs mailing list