[ros-diffs] [hpoussin] 26990: Use a tag when allocating/freeing some memory

hpoussin at svn.reactos.org hpoussin at svn.reactos.org
Fri Jun 8 17:35:28 CEST 2007


Author: hpoussin
Date: Mon Jun  4 13:25:04 2007
New Revision: 26990

URL: http://svn.reactos.org/svn/reactos?rev=26990&view=rev
Log:
Use a tag when allocating/freeing some memory

Modified:
    trunk/reactos/drivers/input/kbdclass/kbdclass.c
    trunk/reactos/drivers/input/kbdclass/kbdclass.h
    trunk/reactos/drivers/input/kbdclass/misc.c
    trunk/reactos/drivers/input/mouclass/misc.c
    trunk/reactos/drivers/input/mouclass/mouclass.c
    trunk/reactos/drivers/input/mouclass/mouclass.h
    trunk/reactos/drivers/input/sermouse/fdo.c
    trunk/reactos/drivers/input/sermouse/sermouse.c
    trunk/reactos/drivers/input/sermouse/sermouse.h

Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbdclass.c?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.c (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c Mon Jun  4 13:25:04 2007
@@ -9,6 +9,16 @@
 
 #define INITGUID
 #include "kbdclass.h"
+
+static DRIVER_UNLOAD DriverUnload;
+static DRIVER_DISPATCH ClassCreate;
+static DRIVER_DISPATCH ClassClose;
+static DRIVER_DISPATCH ClassCleanup;
+static DRIVER_DISPATCH ClassRead;
+static DRIVER_DISPATCH ClassDeviceControl;
+static DRIVER_DISPATCH IrpStub;
+static DRIVER_ADD_DEVICE ClassAddDevice;
+static DRIVER_STARTIO ClassStartIo;
 
 static VOID NTAPI
 DriverUnload(IN PDRIVER_OBJECT DriverObject)
@@ -212,11 +222,11 @@
 
 	ParametersRegistryKey.Length = 0;
 	ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
-	ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
+	ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, CLASS_TAG);
 	if (!ParametersRegistryKey.Buffer)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		return STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		return STATUS_NO_MEMORY;
 	}
 	RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
 	RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
@@ -276,6 +286,7 @@
 			Status = STATUS_NO_MEMORY;
 	}
 
+	ExFreePoolWithTag(ParametersRegistryKey.Buffer, CLASS_TAG);
 	return Status;
 }
 
@@ -303,11 +314,11 @@
 		+ DriverExtension->DeviceBaseName.Length /* "KeyboardClass" */
 		+ 4 * sizeof(WCHAR)                      /* Id between 0 and 9999 */
 		+ sizeof(UNICODE_NULL);                  /* Final NULL char */
-	DeviceNameU.Buffer = ExAllocatePool(PagedPool, DeviceNameU.MaximumLength);
+	DeviceNameU.Buffer = ExAllocatePoolWithTag(PagedPool, DeviceNameU.MaximumLength, CLASS_TAG);
 	if (!DeviceNameU.Buffer)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		return STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		return STATUS_NO_MEMORY;
 	}
 	Status = RtlAppendUnicodeToString(&DeviceNameU, L"\\Device\\");
 	if (!NT_SUCCESS(Status))
@@ -348,7 +359,7 @@
 cleanup:
 	if (!NT_SUCCESS(Status))
 	{
-		ExFreePool(DeviceNameU.Buffer);
+		ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
 		return Status;
 	}
 
@@ -361,11 +372,11 @@
 	KeInitializeSpinLock(&DeviceExtension->SpinLock);
 	DeviceExtension->ReadIsPending = FALSE;
 	DeviceExtension->InputCount = 0;
-	DeviceExtension->PortData = ExAllocatePool(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA));
+	DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA), CLASS_TAG);
 	if (!DeviceExtension->PortData)
 	{
-		ExFreePool(DeviceNameU.Buffer);
-		return STATUS_INSUFFICIENT_RESOURCES;
+		ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
+		return STATUS_NO_MEMORY;
 	}
 	DeviceExtension->DeviceName = DeviceNameU.Buffer;
 	Fdo->Flags |= DO_POWER_PAGABLE;
@@ -548,8 +559,7 @@
 	CONNECT_DATA ConnectData;
 	NTSTATUS Status;
 
-	DPRINT("Connecting PortDO %p [%wZ] to ClassDO %p\n",
-		PortDO, &PortDO->DriverObject->DriverName, ClassDO);
+	DPRINT("Connecting PortDO %p to ClassDO %p\n", PortDO, ClassDO);
 
 	KeInitializeEvent(&Event, NotificationEvent, FALSE);
 
@@ -605,8 +615,7 @@
 	KIRQL OldIrql;
 	NTSTATUS Status;
 
-	DPRINT("Destroying PortDO %p [%wZ]\n",
-		PortDO, &PortDO->DriverObject->DriverName);
+	DPRINT("Destroying PortDO %p\n", PortDO);
 
 	DeviceExtension = (PPORT_DEVICE_EXTENSION)PortDO->DeviceExtension;
 	ClassDeviceExtension = DeviceExtension->ClassDO->DeviceExtension;
@@ -644,8 +653,8 @@
 
 	if (!DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
 	{
-		ExFreePool(ClassDeviceExtension->PortData);
-		ExFreePool((PVOID)ClassDeviceExtension->DeviceName);
+		ExFreePoolWithTag(ClassDeviceExtension->PortData, CLASS_TAG);
+		ExFreePoolWithTag((PVOID)ClassDeviceExtension->DeviceName, CLASS_TAG);
 		IoDeleteDevice(DeviceExtension->ClassDO);
 	}
 
@@ -838,11 +847,11 @@
 
 	/* Allocate memory */
 	Size = sizeof(KEY_VALUE_BASIC_INFORMATION) + MAX_PATH;
-	KeyValueInformation = ExAllocatePool(PagedPool, Size);
+	KeyValueInformation = ExAllocatePoolWithTag(PagedPool, Size, CLASS_TAG);
 	if (!KeyValueInformation)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		Status = STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		Status = STATUS_NO_MEMORY;
 		goto cleanup;
 	}
 
@@ -893,7 +902,7 @@
 			DPRINT("IoGetDeviceObjectPointer(%wZ) failed with status 0x%08lx\n", &PortName, Status);
 			continue;
 		}
-		DPRINT("Legacy driver found: %wZ\n", &PortDeviceObject->DriverObject->DriverName);
+		DPRINT("Legacy driver found\n");
 
 		Status = ClassAddDevice(DriverObject, PortDeviceObject);
 		if (!NT_SUCCESS(Status))
@@ -905,7 +914,7 @@
 
 cleanup:
 	if (KeyValueInformation != NULL)
-		ExFreePool(KeyValueInformation);
+		ExFreePoolWithTag(KeyValueInformation, CLASS_TAG);
 	if (hDeviceMapKey != (HANDLE)-1)
 		ZwClose(hDeviceMapKey);
 	if (hPortKey != (HANDLE)-1)

Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/kbdclass.h?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/kbdclass.h (original)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.h Mon Jun  4 13:25:04 2007
@@ -2,26 +2,15 @@
 #include <kbdmou.h>
 #include <ntddkbd.h>
 #include <stdio.h>
-
-#if defined(__GNUC__)
-  #include <pseh/pseh.h>
-  #include <debug.h>
-#elif defined(_MSC_VER)
-  #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
-  #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
-  #define DPRINT
-  #define CHECKPOINT
-  #define _SEH_TRY __try
-  #define _SEH_HANDLE __except(1)
-  #define _SEH_END
-  #define _SEH_GetExceptionCode() GetExceptionCode()
-#else
-  #error Unknown compiler!
-#endif
+#include <pseh/pseh.h>
+#include <debug.h>
 
 #define MAX_PATH 260
 
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+#define CLASS_TAG TAG('K', 'b', 'd', 'C')
 
 typedef enum
 {
@@ -83,10 +72,7 @@
 	IN PDEVICE_OBJECT DeviceObject,
 	IN PIRP Irp);
 
-NTSTATUS NTAPI
-ForwardIrpAndForget(
-	IN PDEVICE_OBJECT DeviceObject,
-	IN PIRP Irp);
+DRIVER_DISPATCH ForwardIrpAndForget;
 
 NTSTATUS
 DuplicateUnicodeString(

Modified: trunk/reactos/drivers/input/kbdclass/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/kbdclass/misc.c?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/kbdclass/misc.c (original)
+++ trunk/reactos/drivers/input/kbdclass/misc.c Mon Jun  4 13:25:04 2007
@@ -8,6 +8,8 @@
  */
 
 #include "kbdclass.h"
+
+static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
 
 static NTSTATUS NTAPI
 ForwardIrpAndWaitCompletion(
@@ -35,7 +37,7 @@
 	KeInitializeEvent(&Event, NotificationEvent, FALSE);
 	IoCopyCurrentIrpStackLocationToNext(Irp);
 	
-	DPRINT("Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
+	DPRINT("Calling lower device %p\n", LowerDevice);
 	IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
 	
 	Status = IoCallDriver(LowerDevice, Irp);
@@ -93,7 +95,7 @@
 		if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
 			DestMaxLength += sizeof(UNICODE_NULL);
 
-		DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
+		DestinationString->Buffer = ExAllocatePoolWithTag(PagedPool, DestMaxLength, CLASS_TAG);
 		if (DestinationString->Buffer == NULL)
 			return STATUS_NO_MEMORY;
 

Modified: trunk/reactos/drivers/input/mouclass/misc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/misc.c?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/mouclass/misc.c (original)
+++ trunk/reactos/drivers/input/mouclass/misc.c Mon Jun  4 13:25:04 2007
@@ -8,6 +8,8 @@
  */
 
 #include "mouclass.h"
+
+static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion;
 
 static NTSTATUS NTAPI
 ForwardIrpAndWaitCompletion(
@@ -35,7 +37,7 @@
 	KeInitializeEvent(&Event, NotificationEvent, FALSE);
 	IoCopyCurrentIrpStackLocationToNext(Irp);
 	
-	DPRINT("Calling lower device %p [%wZ]\n", LowerDevice, &LowerDevice->DriverObject->DriverName);
+	DPRINT("Calling lower device %p\n", LowerDevice);
 	IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);
 	
 	Status = IoCallDriver(LowerDevice, Irp);
@@ -93,7 +95,7 @@
 		if (Flags & RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE)
 			DestMaxLength += sizeof(UNICODE_NULL);
 
-		DestinationString->Buffer = ExAllocatePool(PagedPool, DestMaxLength);
+		DestinationString->Buffer = ExAllocatePoolWithTag(PagedPool, DestMaxLength, CLASS_TAG);
 		if (DestinationString->Buffer == NULL)
 			return STATUS_NO_MEMORY;
 

Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mouclass.c?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.c (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c Mon Jun  4 13:25:04 2007
@@ -9,6 +9,16 @@
 
 #define INITGUID
 #include "mouclass.h"
+
+static DRIVER_UNLOAD DriverUnload;
+static DRIVER_DISPATCH ClassCreate;
+static DRIVER_DISPATCH ClassClose;
+static DRIVER_DISPATCH ClassCleanup;
+static DRIVER_DISPATCH ClassRead;
+static DRIVER_DISPATCH ClassDeviceControl;
+static DRIVER_DISPATCH IrpStub;
+static DRIVER_ADD_DEVICE ClassAddDevice;
+static DRIVER_STARTIO ClassStartIo;
 
 static VOID NTAPI
 DriverUnload(IN PDRIVER_OBJECT DriverObject)
@@ -189,11 +199,11 @@
 
 	ParametersRegistryKey.Length = 0;
 	ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
-	ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
+	ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, CLASS_TAG);
 	if (!ParametersRegistryKey.Buffer)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		return STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		return STATUS_NO_MEMORY;
 	}
 	RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
 	RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
@@ -253,6 +263,7 @@
 			Status = STATUS_NO_MEMORY;
 	}
 
+	ExFreePoolWithTag(ParametersRegistryKey.Buffer, CLASS_TAG);
 	return Status;
 }
 
@@ -280,11 +291,11 @@
 		+ DriverExtension->DeviceBaseName.Length /* "PointerClass" */
 		+ 4 * sizeof(WCHAR)                      /* Id between 0 and 9999 */
 		+ sizeof(UNICODE_NULL);                  /* Final NULL char */
-	DeviceNameU.Buffer = ExAllocatePool(PagedPool, DeviceNameU.MaximumLength);
+	DeviceNameU.Buffer = ExAllocatePoolWithTag(PagedPool, DeviceNameU.MaximumLength, CLASS_TAG);
 	if (!DeviceNameU.Buffer)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		return STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		return STATUS_NO_MEMORY;
 	}
 	Status = RtlAppendUnicodeToString(&DeviceNameU, L"\\Device\\");
 	if (!NT_SUCCESS(Status))
@@ -325,7 +336,7 @@
 cleanup:
 	if (!NT_SUCCESS(Status))
 	{
-		ExFreePool(DeviceNameU.Buffer);
+		ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
 		return Status;
 	}
 
@@ -338,11 +349,11 @@
 	KeInitializeSpinLock(&DeviceExtension->SpinLock);
 	DeviceExtension->ReadIsPending = FALSE;
 	DeviceExtension->InputCount = 0;
-	DeviceExtension->PortData = ExAllocatePool(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(MOUSE_INPUT_DATA));
+	DeviceExtension->PortData = ExAllocatePoolWithTag(NonPagedPool, DeviceExtension->DriverExtension->DataQueueSize * sizeof(KEYBOARD_INPUT_DATA), CLASS_TAG);
 	if (!DeviceExtension->PortData)
 	{
-		ExFreePool(DeviceNameU.Buffer);
-		return STATUS_INSUFFICIENT_RESOURCES;
+		ExFreePoolWithTag(DeviceNameU.Buffer, CLASS_TAG);
+		return STATUS_NO_MEMORY;
 	}
 	DeviceExtension->DeviceName = DeviceNameU.Buffer;
 	Fdo->Flags |= DO_POWER_PAGABLE;
@@ -524,8 +535,7 @@
 	CONNECT_DATA ConnectData;
 	NTSTATUS Status;
 
-	DPRINT("Connecting PortDO %p [%wZ] to ClassDO %p\n",
-		PortDO, &PortDO->DriverObject->DriverName, ClassDO);
+	DPRINT("Connecting PortDO %p to ClassDO %p\n", PortDO, ClassDO);
 
 	KeInitializeEvent(&Event, NotificationEvent, FALSE);
 
@@ -581,8 +591,7 @@
 	KIRQL OldIrql;
 	NTSTATUS Status;
 
-	DPRINT("Destroying PortDO %p [%wZ]\n",
-		PortDO, &PortDO->DriverObject->DriverName);
+	DPRINT("Destroying PortDO %p\n", PortDO);
 
 	DeviceExtension = (PPORT_DEVICE_EXTENSION)PortDO->DeviceExtension;
 	ClassDeviceExtension = DeviceExtension->ClassDO->DeviceExtension;
@@ -620,8 +629,8 @@
 
 	if (!DriverExtension->ConnectMultiplePorts && DeviceExtension->ClassDO)
 	{
-		ExFreePool(ClassDeviceExtension->PortData);
-		ExFreePool((PVOID)ClassDeviceExtension->DeviceName);
+		ExFreePoolWithTag(ClassDeviceExtension->PortData, CLASS_TAG);
+		ExFreePoolWithTag((PVOID)ClassDeviceExtension->DeviceName, CLASS_TAG);
 		IoDeleteDevice(DeviceExtension->ClassDO);
 	}
 
@@ -814,11 +823,11 @@
 
 	/* Allocate memory */
 	Size = sizeof(KEY_VALUE_BASIC_INFORMATION) + MAX_PATH;
-	KeyValueInformation = ExAllocatePool(PagedPool, Size);
+	KeyValueInformation = ExAllocatePoolWithTag(PagedPool, Size, CLASS_TAG);
 	if (!KeyValueInformation)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		Status = STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		Status = STATUS_NO_MEMORY;
 		goto cleanup;
 	}
 
@@ -869,7 +878,7 @@
 			DPRINT("IoGetDeviceObjectPointer(%wZ) failed with status 0x%08lx\n", &PortName, Status);
 			continue;
 		}
-		DPRINT("Legacy driver found: %wZ\n", &PortDeviceObject->DriverObject->DriverName);
+		DPRINT("Legacy driver found\n");
 
 		Status = ClassAddDevice(DriverObject, PortDeviceObject);
 		if (!NT_SUCCESS(Status))
@@ -881,7 +890,7 @@
 
 cleanup:
 	if (KeyValueInformation != NULL)
-		ExFreePool(KeyValueInformation);
+		ExFreePoolWithTag(KeyValueInformation, CLASS_TAG);
 	if (hDeviceMapKey != (HANDLE)-1)
 		ZwClose(hDeviceMapKey);
 	if (hPortKey != (HANDLE)-1)

Modified: trunk/reactos/drivers/input/mouclass/mouclass.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/mouclass/mouclass.h?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/mouclass/mouclass.h (original)
+++ trunk/reactos/drivers/input/mouclass/mouclass.h Mon Jun  4 13:25:04 2007
@@ -2,26 +2,15 @@
 #include <kbdmou.h>
 #include <ntddkbd.h>
 #include <stdio.h>
-
-#if defined(__GNUC__)
-  #include <pseh/pseh.h>
-  #include <debug.h>
-#elif defined(_MSC_VER)
-  #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
-  #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
-  #define DPRINT
-  #define CHECKPOINT
-  #define _SEH_TRY __try
-  #define _SEH_HANDLE __except(1)
-  #define _SEH_END
-  #define _SEH_GetExceptionCode() GetExceptionCode()
-#else
-  #error Unknown compiler!
-#endif
+#include <pseh/pseh.h>
+#include <debug.h>
 
 #define MAX_PATH 260
 
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+#define CLASS_TAG TAG('M', 'o', 'u', 'C')
 
 typedef enum
 {
@@ -83,10 +72,7 @@
 	IN PDEVICE_OBJECT DeviceObject,
 	IN PIRP Irp);
 
-NTSTATUS NTAPI
-ForwardIrpAndForget(
-	IN PDEVICE_OBJECT DeviceObject,
-	IN PIRP Irp);
+DRIVER_DISPATCH ForwardIrpAndForget;
 
 NTSTATUS
 DuplicateUnicodeString(

Modified: trunk/reactos/drivers/input/sermouse/fdo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/fdo.c?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/sermouse/fdo.c (original)
+++ trunk/reactos/drivers/input/sermouse/fdo.c Mon Jun  4 13:25:04 2007
@@ -186,9 +186,12 @@
 					PDEVICE_RELATIONS DeviceRelations = NULL;
 					DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
 
-					DeviceRelations = ExAllocatePool(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS, Objects));
+					DeviceRelations = ExAllocatePoolWithTag(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS, Objects), SERMOUSE_TAG);
 					if (!DeviceRelations)
-						Status = STATUS_INSUFFICIENT_RESOURCES;
+					{
+						DPRINT("ExAllocatePoolWithTag() failed\n");
+						Status = STATUS_NO_MEMORY;
+					}
 					else
 					{
 						DeviceRelations->Count = 0;

Modified: trunk/reactos/drivers/input/sermouse/sermouse.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/sermouse.c?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/sermouse/sermouse.c (original)
+++ trunk/reactos/drivers/input/sermouse/sermouse.c Mon Jun  4 13:25:04 2007
@@ -43,11 +43,11 @@
 
 	ParametersRegistryKey.Length = 0;
 	ParametersRegistryKey.MaximumLength = RegistryPath->Length + sizeof(L"\\Parameters") + sizeof(UNICODE_NULL);
-	ParametersRegistryKey.Buffer = ExAllocatePool(PagedPool, ParametersRegistryKey.MaximumLength);
+	ParametersRegistryKey.Buffer = ExAllocatePoolWithTag(PagedPool, ParametersRegistryKey.MaximumLength, SERMOUSE_TAG);
 	if (!ParametersRegistryKey.Buffer)
 	{
-		DPRINT("ExAllocatePool() failed\n");
-		return STATUS_INSUFFICIENT_RESOURCES;
+		DPRINT("ExAllocatePoolWithTag() failed\n");
+		return STATUS_NO_MEMORY;
 	}
 	RtlCopyUnicodeString(&ParametersRegistryKey, RegistryPath);
 	RtlAppendUnicodeToString(&ParametersRegistryKey, L"\\Parameters");
@@ -80,7 +80,7 @@
 		Status = STATUS_SUCCESS;
 	}
 
-	ExFreePool(ParametersRegistryKey.Buffer);
+	ExFreePoolWithTag(ParametersRegistryKey.Buffer, SERMOUSE_TAG);
 	return Status;
 }
 

Modified: trunk/reactos/drivers/input/sermouse/sermouse.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/sermouse/sermouse.h?rev=26990&r1=26989&r2=26990&view=diff
==============================================================================
--- trunk/reactos/drivers/input/sermouse/sermouse.h (original)
+++ trunk/reactos/drivers/input/sermouse/sermouse.h Mon Jun  4 13:25:04 2007
@@ -2,17 +2,10 @@
 #include <kbdmou.h>
 #include <ntddser.h>
 #include <ntddmou.h>
+#include <debug.h>
 
-#if defined(__GNUC__)
-  #include <debug.h>
-#elif defined(_MSC_VER)
-  #define DPRINT1 DbgPrint("(%s:%d) ", __FILE__, __LINE__), DbgPrint
-  #define CHECKPOINT1 DbgPrint("(%s:%d)\n", __FILE__, __LINE__)
-  #define DPRINT
-  #define CHECKPOINT
-#else
-  #error Unknown compiler!
-#endif
+#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
+#define SERMOUSE_TAG TAG('S', 'M', 'o', 'u')
 
 typedef enum
 {




More information about the Ros-diffs mailing list