Author: hpoussin Date: Thu Mar 22 20:13:14 2007 New Revision: 26153
URL: http://svn.reactos.org/svn/reactos?rev=26153&view=rev Log: Send service name to pnproot driver (not used yet)
Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/driver.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i... ============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h Thu Mar 22 20:13:14 2007 @@ -480,6 +480,7 @@ IopCreateDeviceNode( IN PDEVICE_NODE ParentNode, IN PDEVICE_OBJECT PhysicalDeviceObject, + IN PUNICODE_STRING ServiceName, OUT PDEVICE_NODE *DeviceNode );
@@ -781,6 +782,7 @@
NTSTATUS PnpRootCreateDevice( + IN PUNICODE_STRING ServiceName, IN OUT PDEVICE_OBJECT *PhysicalDeviceObject );
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c?... ============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c Thu Mar 22 20:13:14 2007 @@ -726,7 +726,9 @@ PWCHAR FileNameWithoutPath; LPWSTR FileExtension; PUNICODE_STRING ModuleName = &LdrEntry->BaseDllName; + UNICODE_STRING ServiceName; #if 1 // Disable for FreeLDR 2.5 + UNICODE_STRING ServiceNameWithExtension; PLDR_DATA_TABLE_ENTRY ModuleObject; #endif
@@ -736,18 +738,6 @@ IopDisplayLoadingMessage(ModuleName->Buffer, TRUE);
/* - * Determine the right device object - */ - /* Use IopRootDeviceNode for now */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode); - if (!NT_SUCCESS(Status)) - { - CPRINT("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); - return(Status); - } - - - /* * Generate filename without path (not needed by freeldr) */ FileNameWithoutPath = wcsrchr(ModuleName->Buffer, L'\'); @@ -763,13 +753,11 @@ /* * Load the module. */ - RtlCreateUnicodeString(&DeviceNode->ServiceName, FileNameWithoutPath); - #if 1 // Remove for FreeLDR 2.5. - Status = LdrProcessDriverModule(LdrEntry, &DeviceNode->ServiceName, &ModuleObject); - if (!NT_SUCCESS(Status)) - { - IopFreeDeviceNode(DeviceNode); + RtlCreateUnicodeString(&ServiceNameWithExtension, FileNameWithoutPath); + Status = LdrProcessDriverModule(LdrEntry, &ServiceNameWithExtension, &ModuleObject); + if (!NT_SUCCESS(Status)) + { CPRINT("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); return Status; } @@ -778,12 +766,25 @@ /* * Strip the file extension from ServiceName */ - FileExtension = wcsrchr(DeviceNode->ServiceName.Buffer, '.'); + RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath); + FileExtension = wcsrchr(ServiceName.Buffer, '.'); if (FileExtension != NULL) { - DeviceNode->ServiceName.Length -= wcslen(FileExtension) * sizeof(WCHAR); + ServiceName.Length -= wcslen(FileExtension) * sizeof(WCHAR); FileExtension[0] = 0; } + + /* + * Determine the right device object + */ + /* Use IopRootDeviceNode for now */ + Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode); + if (!NT_SUCCESS(Status)) + { + CPRINT("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); + return(Status); + } + DeviceNode->ServiceName = ServiceName;
/* * Initialize the driver @@ -793,7 +794,7 @@
if (!NT_SUCCESS(Status)) { - IopFreeDeviceNode(DeviceNode); + IopFreeDeviceNode(DeviceNode); CPRINT("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); return Status; } @@ -830,7 +831,7 @@ NTSTATUS Status;
/* Use IopRootDeviceNode for now */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode); + Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, NULL, &DeviceNode); if (!NT_SUCCESS(Status)) return;
/* Setup the module object for the RAW FS Driver */ @@ -1577,7 +1578,7 @@ */
/* Use IopRootDeviceNode for now */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode); + Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode);
if (!NT_SUCCESS(Status)) {
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c Thu Mar 22 20:13:14 2007 @@ -789,14 +789,15 @@ NTSTATUS IopCreateDeviceNode(PDEVICE_NODE ParentNode, PDEVICE_OBJECT PhysicalDeviceObject, + PUNICODE_STRING ServiceName, PDEVICE_NODE *DeviceNode) { PDEVICE_NODE Node; NTSTATUS Status; KIRQL OldIrql;
- DPRINT("ParentNode 0x%p PhysicalDeviceObject 0x%p\n", - ParentNode, PhysicalDeviceObject); + DPRINT("ParentNode 0x%p PhysicalDeviceObject 0x%p ServiceName %wZ\n", + ParentNode, PhysicalDeviceObject, ServiceName);
Node = (PDEVICE_NODE)ExAllocatePool(NonPagedPool, sizeof(DEVICE_NODE)); if (!Node) @@ -808,7 +809,7 @@
if (!PhysicalDeviceObject) { - Status = PnpRootCreateDevice(&PhysicalDeviceObject); + Status = PnpRootCreateDevice(ServiceName, &PhysicalDeviceObject); if (!NT_SUCCESS(Status)) { ExFreePool(Node); @@ -2386,7 +2387,8 @@ DeviceNode->ServiceName.Buffer, Status); } } - } else + } + else { DPRINT("Service %S is disabled or already initialized\n", DeviceNode->ServiceName.Buffer); @@ -2531,6 +2533,7 @@ Status = IopCreateDeviceNode( DeviceNode, DeviceRelations->Objects[i], + NULL, &ChildDeviceNode); DeviceNode->Flags |= DNF_ENUMERATED; if (!NT_SUCCESS(Status)) @@ -3297,7 +3300,7 @@ KEBUGCHECKEX(PHASE1_INITIALIZATION_FAILED, Status, 0, 0, 0); }
- Status = IopCreateDeviceNode(NULL, Pdo, &IopRootDeviceNode); + Status = IopCreateDeviceNode(NULL, Pdo, NULL, &IopRootDeviceNode); if (!NT_SUCCESS(Status)) { CPRINT("Insufficient resources\n");
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnprepor... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpreport.c Thu Mar 22 20:13:14 2007 @@ -45,8 +45,12 @@ Pdo = *DeviceObject; else { + UNICODE_STRING ServiceName; + ServiceName.Buffer = DriverObject->DriverName.Buffer + sizeof(DRIVER_ROOT_NAME) / sizeof(WCHAR) - 1; + ServiceName.Length = ServiceName.MaximumLength = DriverObject->DriverName.Length - sizeof(DRIVER_ROOT_NAME) + sizeof(WCHAR); + /* create a new PDO and return it in *DeviceObject */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &DeviceNode); + Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode); if (!NT_SUCCESS(Status)) { DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.... ============================================================================== --- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c (original) +++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c Thu Mar 22 20:13:14 2007 @@ -108,6 +108,7 @@
NTSTATUS PnpRootCreateDevice( + PUNICODE_STRING ServiceName, PDEVICE_OBJECT *PhysicalDeviceObject) { PPNPROOT_PDO_DEVICE_EXTENSION PdoDeviceExtension;