Commit in reactos/ntoskrnl on MAIN
io/driver.c+77-11.34 -> 1.35
  /pnpmgr.c+43-311.22 -> 1.23
ntoskrnl.def+3-11.178 -> 1.179
ntoskrnl.edf+3-11.164 -> 1.165
+126-34
4 modified files
- Implemented IoGetDriverObjectExtension and IoAllocateDriverObjectExtension.
- Fixed the parts of IoGetDeviceProperty that were incorrectly sending IRP_MN_QUERY_BUS_INFORMATION.

reactos/ntoskrnl/io
driver.c 1.34 -> 1.35
diff -u -r1.34 -r1.35
--- driver.c	10 Jan 2004 14:24:30 -0000	1.34
+++ driver.c	12 Mar 2004 19:40:29 -0000	1.35
@@ -1,4 +1,4 @@
-/* $Id: driver.c,v 1.34 2004/01/10 14:24:30 hbirr Exp $
+/* $Id: driver.c,v 1.35 2004/03/12 19:40:29 navaraf Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -1237,4 +1237,80 @@
   }
 }
 
+typedef struct _PRIVATE_DRIVER_EXTENSIONS {
+   struct _PRIVATE_DRIVER_EXTENSIONS *Link;
+   PVOID ClientIdentificationAddress;
+   CHAR Extension[1];
+} PRIVATE_DRIVER_EXTENSIONS, *PPRIVATE_DRIVER_EXTENSIONS;
+
+NTSTATUS STDCALL
+IoAllocateDriverObjectExtension(
+   PDRIVER_OBJECT DriverObject,
+   PVOID ClientIdentificationAddress,
+   ULONG DriverObjectExtensionSize,
+   PVOID *DriverObjectExtension)
+{
+   KIRQL OldIrql;
+   PPRIVATE_DRIVER_EXTENSIONS DriverExtensions;
+   PPRIVATE_DRIVER_EXTENSIONS NewDriverExtension;
+
+   NewDriverExtension = ExAllocatePoolWithTag(
+      NonPagedPool,
+      sizeof(PRIVATE_DRIVER_EXTENSIONS) - sizeof(CHAR) +
+      DriverObjectExtensionSize,
+      TAG_DRIVER_EXTENSION);
+
+   if (NewDriverExtension == NULL)
+   {
+      return STATUS_INSUFFICIENT_RESOURCES;             
+   }
+   
+   OldIrql = KeRaiseIrqlToDpcLevel();
+
+   NewDriverExtension->Link = DriverObject->DriverSection;
+   NewDriverExtension->ClientIdentificationAddress = ClientIdentificationAddress;
+
+   for (DriverExtensions = DriverObject->DriverSection;
+        DriverExtensions != NULL;
+        DriverExtensions = DriverExtensions->Link)
+   {
+      if (DriverExtensions->ClientIdentificationAddress ==
+          ClientIdentificationAddress)
+         return STATUS_OBJECT_NAME_COLLISION;
+   }
+
+   DriverObject->DriverSection = NewDriverExtension;
+
+   KfLowerIrql(OldIrql);
+
+   *DriverObjectExtension = &NewDriverExtension->Extension;
+
+   return STATUS_SUCCESS;      
+}
+
+PVOID STDCALL
+IoGetDriverObjectExtension(
+   PDRIVER_OBJECT DriverObject,
+   PVOID ClientIdentificationAddress)
+{
+   KIRQL OldIrql;
+   PPRIVATE_DRIVER_EXTENSIONS DriverExtensions;
+
+   OldIrql = KeRaiseIrqlToDpcLevel();
+
+   for (DriverExtensions = DriverObject->DriverSection;
+        DriverExtensions != NULL &&
+        DriverExtensions->ClientIdentificationAddress !=
+          ClientIdentificationAddress;
+        DriverExtensions = DriverExtensions->Link)
+      ;
+
+   KfLowerIrql(OldIrql);
+
+   if (DriverExtensions == NULL)
+      return NULL;
+
+   return &DriverExtensions->Extension;
+}
+
 /* EOF */

reactos/ntoskrnl/io
pnpmgr.c 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- pnpmgr.c	16 Oct 2003 14:49:05 -0000	1.22
+++ pnpmgr.c	12 Mar 2004 19:40:29 -0000	1.23
@@ -1,4 +1,4 @@
-/* $Id: pnpmgr.c,v 1.22 2003/10/16 14:49:05 ekohl Exp $
+/* $Id: pnpmgr.c,v 1.23 2004/03/12 19:40:29 navaraf Exp $
  *
  * COPYRIGHT:      See COPYING in the top level directory
  * PROJECT:        ReactOS kernel
@@ -62,17 +62,16 @@
 {
 }
 
-NTSTATUS
+PPNP_BUS_INFORMATION FASTCALL
 IopQueryBusInformation(
-  PDEVICE_OBJECT DeviceObject,
-  PPNP_BUS_INFORMATION BusInformation)
+  PDEVICE_OBJECT DeviceObject)
 {
   IO_STATUS_BLOCK IoStatusBlock;
   IO_STACK_LOCATION Stack;
   
-  IoStatusBlock.Information = (ULONG)BusInformation;
-  return IopInitiatePnpIrp(DeviceObject, &IoStatusBlock,
-    IRP_MN_QUERY_BUS_INFORMATION, &Stack);
+  return NT_SUCCESS(IopInitiatePnpIrp(DeviceObject, &IoStatusBlock,
+    IRP_MN_QUERY_BUS_INFORMATION, &Stack)) ?
+    (PPNP_BUS_INFORMATION)IoStatusBlock.Information : NULL;
 }
 
 /*
@@ -87,8 +86,7 @@
   OUT PVOID PropertyBuffer,
   OUT PULONG ResultLength)
 {
-  PNP_BUS_INFORMATION BusInformation;
-  NTSTATUS Status;
+  PPNP_BUS_INFORMATION BusInformation;
 
   DPRINT("IoGetDeviceProperty called");
 
@@ -104,43 +102,57 @@
       *ResultLength = sizeof(ULONG);
       if (BufferLength < sizeof(ULONG))
         return STATUS_BUFFER_TOO_SMALL;
-      Status = IopQueryBusInformation(DeviceObject, &BusInformation);
-      if (NT_SUCCESS(Status))
-        *((ULONG *)PropertyBuffer) = BusInformation.BusNumber;
-      return Status;
+      BusInformation = IopQueryBusInformation(DeviceObject);
+      if (BusInformation != NULL)
+      {
+        *((ULONG *)PropertyBuffer) = BusInformation->BusNumber;
+        ExFreePool(BusInformation);
+        return STATUS_UNSUCCESSFUL;
+      }
+      return STATUS_SUCCESS;
 
     /* Complete, untested */
     case DevicePropertyBusTypeGuid:
       *ResultLength = 39 * sizeof(WCHAR);
       if (BufferLength < (39 * sizeof(WCHAR)))
         return STATUS_BUFFER_TOO_SMALL;
-      Status = IopQueryBusInformation(DeviceObject, &BusInformation);
-      if (NT_SUCCESS(Status))
+      BusInformation = IopQueryBusInformation(DeviceObject);
+      if (BusInformation != NULL)
+      {
         swprintf((PWSTR)PropertyBuffer,
           L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
-          BusInformation.BusTypeGuid.Data1,
-          BusInformation.BusTypeGuid.Data2,
-          BusInformation.BusTypeGuid.Data3,
-          BusInformation.BusTypeGuid.Data4[0],
-          BusInformation.BusTypeGuid.Data4[1],
-          BusInformation.BusTypeGuid.Data4[2],
-          BusInformation.BusTypeGuid.Data4[3],
-          BusInformation.BusTypeGuid.Data4[4],
-          BusInformation.BusTypeGuid.Data4[5],
-          BusInformation.BusTypeGuid.Data4[6],
-          BusInformation.BusTypeGuid.Data4[7]);
-      return Status;
+          BusInformation->BusTypeGuid.Data1,
+          BusInformation->BusTypeGuid.Data2,
+          BusInformation->BusTypeGuid.Data3,
+          BusInformation->BusTypeGuid.Data4[0],
+          BusInformation->BusTypeGuid.Data4[1],
+          BusInformation->BusTypeGuid.Data4[2],
+          BusInformation->BusTypeGuid.Data4[3],
+          BusInformation->BusTypeGuid.Data4[4],
+          BusInformation->BusTypeGuid.Data4[5],
+          BusInformation->BusTypeGuid.Data4[6],
+          BusInformation->BusTypeGuid.Data4[7]);
+        ExFreePool(BusInformation);
+        return STATUS_UNSUCCESSFUL;
+      }
+      return STATUS_SUCCESS;
 
     /* Complete, untested */
     case DevicePropertyLegacyBusType:
       *ResultLength = sizeof(INTERFACE_TYPE);
       if (BufferLength < sizeof(INTERFACE_TYPE))
         return STATUS_BUFFER_TOO_SMALL;
-      Status = IopQueryBusInformation(DeviceObject, &BusInformation);
-      if (NT_SUCCESS(Status))
-        memcpy(PropertyBuffer, &BusInformation.LegacyBusType,
+      BusInformation = IopQueryBusInformation(DeviceObject);
+      if (BusInformation != NULL)
+      {
+        RtlCopyMemory(
+          PropertyBuffer,
+          &BusInformation->LegacyBusType,
           sizeof(INTERFACE_TYPE));
-      return Status;
+        ExFreePool(BusInformation);
+        return STATUS_UNSUCCESSFUL;
+      }
+      return STATUS_SUCCESS;
 
     case DevicePropertyAddress:
     case DevicePropertyBootConfiguration:

reactos/ntoskrnl
ntoskrnl.def 1.178 -> 1.179
diff -u -r1.178 -r1.179
--- ntoskrnl.def	8 Mar 2004 08:05:27 -0000	1.178
+++ ntoskrnl.def	12 Mar 2004 19:40:29 -0000	1.179
@@ -1,4 +1,4 @@
-; $Id: ntoskrnl.def,v 1.178 2004/03/08 08:05:27 navaraf Exp $
+; $Id: ntoskrnl.def,v 1.179 2004/03/12 19:40:29 navaraf Exp $
 ;
 ; reactos/ntoskrnl/ntoskrnl.def
 ;
@@ -238,6 +238,7 @@
 IoAdapterObjectType DATA
 IoAllocateAdapterChannel@20
 IoAllocateController@16
+IoAllocateDriverObjectExtension@16
 IoAllocateErrorLogEntry@8
 IoAllocateIrp@8
 IoAllocateMdl@20
@@ -287,6 +288,7 @@
 IoGetBaseFileSystemDeviceObject@4
 IoGetConfigurationInformation@0
 IoGetCurrentProcess@0
+IoGetDriverObjectExtension@8
 IoGetDeviceObjectPointer@16
 IoGetDeviceProperty@20
 IoGetDeviceToVerify@4

reactos/ntoskrnl
ntoskrnl.edf 1.164 -> 1.165
diff -u -r1.164 -r1.165
--- ntoskrnl.edf	8 Mar 2004 08:05:27 -0000	1.164
+++ ntoskrnl.edf	12 Mar 2004 19:40:29 -0000	1.165
@@ -1,4 +1,4 @@
-; $Id: ntoskrnl.edf,v 1.164 2004/03/08 08:05:27 navaraf Exp $
+; $Id: ntoskrnl.edf,v 1.165 2004/03/12 19:40:29 navaraf Exp $
 ;
 ; reactos/ntoskrnl/ntoskrnl.def
 ;
@@ -239,6 +239,7 @@
 IoAllocateIrp=IoAllocateIrp@8
 IoAllocateMdl=IoAllocateMdl@20
 IoAllocateController=IoAllocateController@16
+IoAllocateDriverObjectExtension=IoAllocateDriverObjectExtension@16
 IoAllocateErrorLogEntry=IoAllocateErrorLogEntry@8
 IoAllocateWorkItem=IoAllocateWorkItem@4
 IoAssignResources=IoAssignResources@24
@@ -287,6 +288,7 @@
 IoGetConfigurationInformation=IoGetConfigurationInformation@0
 IoGetCurrentProcess=IoGetCurrentProcess@0
 IoGetDeviceObjectPointer=IoGetDeviceObjectPointer@16
+IoGetDriverObjectExtension=IoGetDriverObjectExtension@8
 IoGetDeviceProperty=IoGetDeviceProperty@20
 IoGetDeviceToVerify=IoGetDeviceToVerify@4
 IoGetDmaAdapter=IoGetDmaAdapter@12
CVSspam 0.2.8