(makes third-party drivers compatibility better)
svn path=/trunk/; revision=19963
{
/* Add information from parent bus device to InstancePath */
wcscat(InstancePath, ParentIdPrefix.Buffer);
{
/* Add information from parent bus device to InstancePath */
wcscat(InstancePath, ParentIdPrefix.Buffer);
- if (*(PWSTR)IoStatusBlock.Information)
+ if (IoStatusBlock.Information && *(PWSTR)IoStatusBlock.Information)
wcscat(InstancePath, L"&");
}
wcscat(InstancePath, L"&");
}
- wcscat(InstancePath, (PWSTR)IoStatusBlock.Information);
+ if (IoStatusBlock.Information)
+ wcscat(InstancePath, (PWSTR)IoStatusBlock.Information);
/*
* FIXME: Check for valid characters, if there is invalid characters
/*
* FIXME: Check for valid characters, if there is invalid characters
&IoStatusBlock,
IRP_MN_QUERY_ID,
&Stack);
&IoStatusBlock,
IRP_MN_QUERY_ID,
&Stack);
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status) && IoStatusBlock.Information)
{
/*
* FIXME: Check for valid characters, if there is invalid characters
{
/*
* FIXME: Check for valid characters, if there is invalid characters
(TotalLength + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status))
{
(TotalLength + 1) * sizeof(WCHAR));
if (!NT_SUCCESS(Status))
{
- DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status);
+ DPRINT1("ZwSetValueKey() failed (Status %lx) or no Compatible ID returned\n", Status);
&IoStatusBlock,
IRP_MN_QUERY_DEVICE_TEXT,
&Stack);
&IoStatusBlock,
IRP_MN_QUERY_DEVICE_TEXT,
&Stack);
- if (NT_SUCCESS(Status))
+ /* This key is mandatory, so even if the Irp fails, we still write it */
+ RtlInitUnicodeString(&ValueName, L"DeviceDesc");
+ if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND)
- RtlInitUnicodeString(&ValueName, L"DeviceDesc");
- if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND)
+ if (NT_SUCCESS(IoStatusBlock.Status) &&
+ IoStatusBlock.Information &&
+ (*(PWSTR)IoStatusBlock.Information != 0))
{
/* This key is overriden when a driver is installed. Don't write the
* new description if another one already exists */
{
/* This key is overriden when a driver is installed. Don't write the
* new description if another one already exists */
(PVOID)IoStatusBlock.Information,
(wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR));
}
(PVOID)IoStatusBlock.Information,
(wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR));
}
- if (!NT_SUCCESS(Status))
- DPRINT1("ZwSetValueKey() failed (Status 0x%lx)\n", Status);
+ UNICODE_STRING DeviceDesc;
+ RtlInitUnicodeString(&DeviceDesc, L"Unknown Device");
+ DPRINT("Driver didn't return DeviceDesc (Status %x), so place unknown device there\n", Status);
+
+ Status = ZwSetValueKey(InstanceKey,
+ &ValueName,
+ 0,
+ REG_SZ,
+ &DeviceDesc,
+ (wcslen((PWSTR)&DeviceDesc) + 1) * sizeof(WCHAR));
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("ZwSetValueKey() failed (Status 0x%lx)\n", Status);
+ }
+
- else
- {
- DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
- }
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocation to device stack\n");
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocation to device stack\n");
&IoStatusBlock,
IRP_MN_QUERY_DEVICE_TEXT,
&Stack);
&IoStatusBlock,
IRP_MN_QUERY_DEVICE_TEXT,
&Stack);
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status) && IoStatusBlock.Information)
{
DPRINT("LocationInformation: %S\n", (PWSTR)IoStatusBlock.Information);
RtlInitUnicodeString(&ValueName, L"LocationInformation");
{
DPRINT("LocationInformation: %S\n", (PWSTR)IoStatusBlock.Information);
RtlInitUnicodeString(&ValueName, L"LocationInformation");
- DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
+ DPRINT("IopInitiatePnpIrp() failed (Status %x) or IoStatusBlock.Information=NULL\n", Status);
}
DPRINT("Sending IRP_MN_QUERY_BUS_INFORMATION to device stack\n");
}
DPRINT("Sending IRP_MN_QUERY_BUS_INFORMATION to device stack\n");
&IoStatusBlock,
IRP_MN_QUERY_BUS_INFORMATION,
NULL);
&IoStatusBlock,
IRP_MN_QUERY_BUS_INFORMATION,
NULL);
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status) && IoStatusBlock.Information)
{
PPNP_BUS_INFORMATION BusInformation =
(PPNP_BUS_INFORMATION)IoStatusBlock.Information;
{
PPNP_BUS_INFORMATION BusInformation =
(PPNP_BUS_INFORMATION)IoStatusBlock.Information;
- DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status);
+ DPRINT("IopInitiatePnpIrp() failed (Status %x) or IoStatusBlock.Information=NULL\n", Status);
DeviceNode->ChildBusNumber = 0xFFFFFFF0;
DeviceNode->ChildInterfaceType = InterfaceTypeUndefined;
DeviceNode->ChildBusNumber = 0xFFFFFFF0;
DeviceNode->ChildInterfaceType = InterfaceTypeUndefined;
&IoStatusBlock,
IRP_MN_QUERY_RESOURCES,
NULL);
&IoStatusBlock,
IRP_MN_QUERY_RESOURCES,
NULL);
- if (NT_SUCCESS(Status))
+ if (NT_SUCCESS(Status) && IoStatusBlock.Information)
{
DeviceNode->BootResources =
(PCM_RESOURCE_LIST)IoStatusBlock.Information;
{
DeviceNode->BootResources =
(PCM_RESOURCE_LIST)IoStatusBlock.Information;