reactos/ntoskrnl/include/internal
diff -u -r1.38 -r1.39
--- io.h 15 Dec 2003 17:49:41 -0000 1.38
+++ io.h 14 Mar 2004 17:10:48 -0000 1.39
@@ -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: io.h,v 1.38 2003/12/15 17:49:41 ekohl Exp $
+/* $Id: io.h,v 1.39 2004/03/14 17:10:48 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -48,6 +48,13 @@
LIST_ENTRY ListEntry;
} IO_COMPLETION_PACKET, *PIO_COMPLETION_PACKET;
+typedef struct _DEVOBJ_EXTENSION {
+ CSHORT Type;
+ USHORT Size;
+ PDEVICE_OBJECT DeviceObject;
+ ULONG Unknown[3];
+ struct _DEVICE_NODE *DeviceNode;
+} DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
typedef struct _DEVICE_NODE
{
reactos/ntoskrnl/io
diff -u -r1.66 -r1.67
--- device.c 7 Mar 2004 11:59:10 -0000 1.66
+++ device.c 14 Mar 2004 17:10:48 -0000 1.67
@@ -1,4 +1,4 @@
-/* $Id: device.c,v 1.66 2004/03/07 11:59:10 navaraf Exp $
+/* $Id: device.c,v 1.67 2004/03/14 17:10:48 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -636,6 +636,7 @@
*/
{
PDEVICE_OBJECT CreatedDeviceObject;
+ PDEVOBJ_EXTENSION DeviceObjectExtension;
OBJECT_ATTRIBUTES ObjectAttributes;
NTSTATUS Status;
@@ -740,6 +741,17 @@
IoAttachVpb(CreatedDeviceObject);
}
+ DeviceObjectExtension =
+ ExAllocatePoolWithTag(NonPagedPool, sizeof(DEVOBJ_EXTENSION),
+ TAG_DEVICE_EXTENSION);
+
+ DeviceObjectExtension->Type = 0 /* ?? */;
+ DeviceObjectExtension->Size = sizeof(DEVOBJ_EXTENSION);
+ DeviceObjectExtension->DeviceObject = CreatedDeviceObject;
+ DeviceObjectExtension->DeviceNode = NULL;
+
+ CreatedDeviceObject->DeviceObjectExtension = DeviceObjectExtension;
+
*DeviceObject = CreatedDeviceObject;
return(STATUS_SUCCESS);
reactos/ntoskrnl/io
diff -u -r1.35 -r1.36
--- driver.c 12 Mar 2004 19:40:29 -0000 1.35
+++ driver.c 14 Mar 2004 17:10:48 -0000 1.36
@@ -1,4 +1,4 @@
-/* $Id: driver.c,v 1.35 2004/03/12 19:40:29 navaraf Exp $
+/* $Id: driver.c,v 1.36 2004/03/14 17:10:48 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -802,34 +802,35 @@
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode, BOOLEAN BootDriverOnly)
{
NTSTATUS Status;
+ ULONG ServiceStart;
+ RTL_QUERY_REGISTRY_TABLE QueryTable[2];
if (DeviceNode->ServiceName.Buffer == NULL)
{
return STATUS_UNSUCCESSFUL;
}
+ /*
+ * Get service start value
+ */
+
+ RtlZeroMemory(QueryTable, sizeof(QueryTable));
+ QueryTable[0].Name = L"Start";
+ QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
+ QueryTable[0].EntryContext = &ServiceStart;
+ Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES,
+ DeviceNode->ServiceName.Buffer, QueryTable, NULL, NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("RtlQueryRegistryValues() failed (Status %x)\n", Status);
+ return Status;
+ }
+
if (BootDriverOnly)
{
- ULONG ServiceStart;
- RTL_QUERY_REGISTRY_TABLE QueryTable[2];
PLOADER_MODULE KeLoaderModules = (PLOADER_MODULE)KeLoaderBlock.ModsAddr;
/*
- * Get service start value
- */
- RtlZeroMemory(QueryTable, sizeof(QueryTable));
- QueryTable[0].Name = L"Start";
- QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
- QueryTable[0].EntryContext = &ServiceStart;
- Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES,
- DeviceNode->ServiceName.Buffer, QueryTable, NULL, NULL);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("RtlQueryRegistryValues() failed (Status %x)\n", Status);
- return Status;
- }
-
- /*
* Find and initialize boot driver
*/
if (ServiceStart == 0 /*SERVICE_BOOT_START*/)
@@ -860,6 +861,7 @@
return STATUS_UNSUCCESSFUL;
}
} else
+ if (ServiceStart < 4)
{
UNICODE_STRING ImagePath;
@@ -889,6 +891,8 @@
*/
RtlFreeUnicodeString(&ImagePath);
}
+ else
+ Status = STATUS_UNSUCCESSFUL;
return Status;
}
reactos/ntoskrnl/io
diff -u -r1.23 -r1.24
--- pnpmgr.c 12 Mar 2004 19:40:29 -0000 1.23
+++ pnpmgr.c 14 Mar 2004 17:10:48 -0000 1.24
@@ -1,4 +1,4 @@
-/* $Id: pnpmgr.c,v 1.23 2004/03/12 19:40:29 navaraf Exp $
+/* $Id: pnpmgr.c,v 1.24 2004/03/14 17:10:48 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -62,16 +62,11 @@
{
}
-PPNP_BUS_INFORMATION FASTCALL
-IopQueryBusInformation(
+PDEVICE_NODE FASTCALL
+IopGetDeviceNode(
PDEVICE_OBJECT DeviceObject)
{
- IO_STATUS_BLOCK IoStatusBlock;
- IO_STACK_LOCATION Stack;
-
- return NT_SUCCESS(IopInitiatePnpIrp(DeviceObject, &IoStatusBlock,
- IRP_MN_QUERY_BUS_INFORMATION, &Stack)) ?
- (PPNP_BUS_INFORMATION)IoStatusBlock.Information : NULL;
+ return DeviceObject->DeviceObjectExtension->DeviceNode;
}
/*
@@ -86,9 +81,18 @@
OUT PVOID PropertyBuffer,
OUT PULONG ResultLength)
{
- PPNP_BUS_INFORMATION BusInformation;
+ PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject);
+ ULONG Length;
+ PVOID Data;
+
+ DPRINT("IoGetDeviceProperty called\n");
- DPRINT("IoGetDeviceProperty called");
+ if (DeviceNode == NULL ||
+ DeviceNode->BusInformation == NULL ||
+ DeviceNode->CapabilityFlags == NULL)
+ {
+ return STATUS_INVALID_DEVICE_REQUEST;
+ }
/*
* Used IRPs:
@@ -97,64 +101,46 @@
*/
switch (DeviceProperty)
{
- /* Complete, untested */
case DevicePropertyBusNumber:
- *ResultLength = sizeof(ULONG);
- if (BufferLength < sizeof(ULONG))
- return STATUS_BUFFER_TOO_SMALL;
- BusInformation = IopQueryBusInformation(DeviceObject);
- if (BusInformation != NULL)
- {
- *((ULONG *)PropertyBuffer) = BusInformation->BusNumber;
- ExFreePool(BusInformation);
- return STATUS_UNSUCCESSFUL;
- }
- return STATUS_SUCCESS;
+ Length = sizeof(ULONG);
+ Data = &DeviceNode->BusInformation->BusNumber;
+ break;
/* Complete, untested */
case DevicePropertyBusTypeGuid:
*ResultLength = 39 * sizeof(WCHAR);
if (BufferLength < (39 * sizeof(WCHAR)))
return STATUS_BUFFER_TOO_SMALL;
- 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]);
- ExFreePool(BusInformation);
- return STATUS_UNSUCCESSFUL;
- }
+ swprintf((PWSTR)PropertyBuffer,
+ L"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ DeviceNode->BusInformation->BusTypeGuid.Data1,
+ DeviceNode->BusInformation->BusTypeGuid.Data2,
+ DeviceNode->BusInformation->BusTypeGuid.Data3,
+ DeviceNode->BusInformation->BusTypeGuid.Data4[0],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[1],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[2],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[3],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[4],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[5],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[6],
+ DeviceNode->BusInformation->BusTypeGuid.Data4[7]);
return STATUS_SUCCESS;
- /* Complete, untested */
case DevicePropertyLegacyBusType:
- *ResultLength = sizeof(INTERFACE_TYPE);
- if (BufferLength < sizeof(INTERFACE_TYPE))
- return STATUS_BUFFER_TOO_SMALL;
- BusInformation = IopQueryBusInformation(DeviceObject);
- if (BusInformation != NULL)
- {
- RtlCopyMemory(
- PropertyBuffer,
- &BusInformation->LegacyBusType,
- sizeof(INTERFACE_TYPE));
- ExFreePool(BusInformation);
- return STATUS_UNSUCCESSFUL;
- }
- return STATUS_SUCCESS;
+ Length = sizeof(INTERFACE_TYPE);
+ Data = &DeviceNode->BusInformation->LegacyBusType;
+ break;
case DevicePropertyAddress:
+ Length = sizeof(ULONG);
+ Data = &DeviceNode->CapabilityFlags->Address;
+ break;
+
+ case DevicePropertyUINumber:
+ Length = sizeof(ULONG);
+ Data = &DeviceNode->CapabilityFlags->UINumber;
+ break;
+
case DevicePropertyBootConfiguration:
case DevicePropertyBootConfigurationTranslated:
case DevicePropertyClassGuid:
@@ -168,13 +154,17 @@
case DevicePropertyLocationInformation:
case DevicePropertyManufacturer:
case DevicePropertyPhysicalDeviceObjectName:
- case DevicePropertyUINumber:
- break;
+ return STATUS_NOT_IMPLEMENTED;
default:
- return STATUS_INVALID_PARAMETER_2;
+ return STATUS_INVALID_PARAMETER_2;
}
+ *ResultLength = Length;
+ if (BufferLength < Length)
+ return STATUS_BUFFER_TOO_SMALL;
+ RtlCopyMemory(PropertyBuffer, Data, Length);
+
return STATUS_NOT_IMPLEMENTED;
}
@@ -309,6 +299,8 @@
Node->Pdo = PhysicalDeviceObject;
+ PhysicalDeviceObject->DeviceObjectExtension->DeviceNode = Node;
+
if (ParentNode)
{
KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql);