Fix the case when IRP_MN_QUERY_DEVICE_TEXT returns nothing

Set DN_DRIVER_LOADED and DN_STARTED flags

svn path=/trunk/; revision=20103
This commit is contained in:
Hervé Poussineau 2005-12-12 16:44:09 +00:00
parent dae7608137
commit f4b9f76ed2
3 changed files with 16 additions and 10 deletions

View file

@ -163,7 +163,10 @@ IopStartDevice(
} }
ObDereferenceObject(Fdo); ObDereferenceObject(Fdo);
if (NT_SUCCESS(Status))
DeviceNode->Flags |= DN_STARTED;
return Status; return Status;
} }

View file

@ -1753,7 +1753,7 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
RtlInitUnicodeString(&ValueName, L"DeviceDesc"); RtlInitUnicodeString(&ValueName, L"DeviceDesc");
if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND) if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND)
{ {
if (NT_SUCCESS(IoStatusBlock.Status) && if (NT_SUCCESS(Status) &&
IoStatusBlock.Information && IoStatusBlock.Information &&
(*(PWSTR)IoStatusBlock.Information != 0)) (*(PWSTR)IoStatusBlock.Information != 0))
{ {
@ -1768,16 +1768,15 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
} }
else else
{ {
UNICODE_STRING DeviceDesc; UNICODE_STRING DeviceDesc = RTL_CONSTANT_STRING(L"Unknown device");
RtlInitUnicodeString(&DeviceDesc, L"Unknown Device"); DPRINT("Driver didn't return DeviceDesc (Status 0x%08lx), so place unknown device there\n", Status);
DPRINT("Driver didn't return DeviceDesc (Status %x), so place unknown device there\n", Status);
Status = ZwSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_SZ, REG_SZ,
&DeviceDesc, DeviceDesc.Buffer,
(wcslen((PWSTR)&DeviceDesc) + 1) * sizeof(WCHAR)); DeviceDesc.MaximumLength);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -2014,6 +2013,7 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode,
* device is started */ * device is started */
DPRINT("%wZ is using NULL driver\n", &DeviceNode->InstancePath); DPRINT("%wZ is using NULL driver\n", &DeviceNode->InstancePath);
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED); IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
DeviceNode->Flags |= DN_STARTED;
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
@ -2095,8 +2095,11 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode,
if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED) if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED)
{ {
if (Status != STATUS_IMAGE_ALREADY_LOADED) if (Status != STATUS_IMAGE_ALREADY_LOADED)
{
DeviceNode->Flags |= DN_DRIVER_LOADED;
Status = IopInitializeDriverModule(DeviceNode, ModuleObject, Status = IopInitializeDriverModule(DeviceNode, ModuleObject,
&DeviceNode->ServiceName, FALSE, &DriverObject); &DeviceNode->ServiceName, FALSE, &DriverObject);
}
else else
{ {
/* get existing DriverObject pointer */ /* get existing DriverObject pointer */

View file

@ -579,7 +579,7 @@ PnpRootFdoReadDeviceInfo(
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
/* FIXME: */ Device->DeviceDescription.Buffer = NULL;
} }
DPRINT("Got device description: %S\n", DeviceDesc->Buffer); DPRINT("Got device description: %S\n", DeviceDesc->Buffer);
@ -1184,8 +1184,8 @@ PnpRootDriverEntry(
{ {
DPRINT("Called\n"); DPRINT("Called\n");
DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH) PnpRootPnpControl; DriverObject->MajorFunction[IRP_MJ_PNP] = PnpRootPnpControl;
DriverObject->MajorFunction[IRP_MJ_POWER] = (PDRIVER_DISPATCH) PnpRootPowerControl; DriverObject->MajorFunction[IRP_MJ_POWER] = PnpRootPowerControl;
DriverObject->DriverExtension->AddDevice = PnpRootAddDevice; DriverObject->DriverExtension->AddDevice = PnpRootAddDevice;
return STATUS_SUCCESS; return STATUS_SUCCESS;