Send the right LocaleId to device stack when querying the device description.

Don't erase device description stored by setupapi during next reboot

svn path=/trunk/; revision=18407
This commit is contained in:
Hervé Poussineau 2005-10-11 13:35:07 +00:00
parent 75e85af499
commit cf9a86c858

View file

@ -1475,6 +1475,8 @@ IopActionInterrogateDeviceStack(
PWSTR Ptr; PWSTR Ptr;
USHORT Length; USHORT Length;
USHORT TotalLength; USHORT TotalLength;
ULONG RequiredLength;
LCID LocaleId;
HANDLE InstanceKey = NULL; HANDLE InstanceKey = NULL;
UNICODE_STRING ValueName; UNICODE_STRING ValueName;
UNICODE_STRING ParentIdPrefix = { 0 }; UNICODE_STRING ParentIdPrefix = { 0 };
@ -1508,6 +1510,14 @@ IopActionInterrogateDeviceStack(
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
/* Get Locale ID */
Status = ZwQueryDefaultLocale(FALSE, &LocaleId);
if (!NT_SUCCESS(Status))
{
DPRINT("ZwQueryDefaultLocale() failed with status 0x%lx\n", Status);
return Status;
}
/* /*
* FIXME: For critical errors, cleanup and disable device, but always * FIXME: For critical errors, cleanup and disable device, but always
* return STATUS_SUCCESS. * return STATUS_SUCCESS.
@ -1735,7 +1745,7 @@ IopActionInterrogateDeviceStack(
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextDescription to device stack\n"); DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextDescription to device stack\n");
Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextDescription; Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextDescription;
Stack.Parameters.QueryDeviceText.LocaleId = 0; /* FIXME */ Stack.Parameters.QueryDeviceText.LocaleId = LocaleId;
Status = IopInitiatePnpIrp( Status = IopInitiatePnpIrp(
DeviceNode->PhysicalDeviceObject, DeviceNode->PhysicalDeviceObject,
&IoStatusBlock, &IoStatusBlock,
@ -1743,17 +1753,21 @@ IopActionInterrogateDeviceStack(
&Stack); &Stack);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName, L"DeviceDesc");
L"DeviceDesc"); if (ZwQueryValueKey(InstanceKey, &ValueName, KeyValueBasicInformation, NULL, 0, &RequiredLength) == STATUS_OBJECT_NAME_NOT_FOUND)
{
/* This key is overriden when a driver is installed. Don't write the
* new description if another one already exists */
Status = ZwSetValueKey(InstanceKey, Status = ZwSetValueKey(InstanceKey,
&ValueName, &ValueName,
0, 0,
REG_SZ, REG_SZ,
(PVOID)IoStatusBlock.Information, (PVOID)IoStatusBlock.Information,
(wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR)); (wcslen((PWSTR)IoStatusBlock.Information) + 1) * sizeof(WCHAR));
}
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("ZwSetValueKey() failed (Status %lx)\n", Status); DPRINT1("ZwSetValueKey() failed (Status 0x%lx)\n", Status);
} }
} }
else else
@ -1764,7 +1778,7 @@ IopActionInterrogateDeviceStack(
DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocation to device stack\n"); DPRINT("Sending IRP_MN_QUERY_DEVICE_TEXT.DeviceTextLocation to device stack\n");
Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextLocationInformation; Stack.Parameters.QueryDeviceText.DeviceTextType = DeviceTextLocationInformation;
Stack.Parameters.QueryDeviceText.LocaleId = 0; // FIXME Stack.Parameters.QueryDeviceText.LocaleId = LocaleId;
Status = IopInitiatePnpIrp( Status = IopInitiatePnpIrp(
DeviceNode->PhysicalDeviceObject, DeviceNode->PhysicalDeviceObject,
&IoStatusBlock, &IoStatusBlock,