Remove "Unknown device" wizards

svn path=/trunk/; revision=30977
This commit is contained in:
Hervé Poussineau 2007-12-03 08:04:26 +00:00
parent 4aee5c9e17
commit 8459487b4b
3 changed files with 17 additions and 8 deletions

View file

@ -36,9 +36,6 @@ HKLM,"SYSTEM\CurrentControlSet\Control\DeviceClasses",,0x00000012
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB",,0x00000012
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB","CurrentConfig",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB\Hardware Profiles\0000","FriendlyName",0x00000000,"New Hardware Profile"
; The following line is only here to prevent the "New hardware wizard" to display a window for "Unknown device".
; This device comes from Root plug and play bus (ntoskrnl/io/pnproot.c) and this one should never appear
HKLM,"SYSTEM\CurrentControlSet\Enum\Root\LEGACY_UNKNOWN\0000","ConfigFlags",0x00010001,0x00000040
; Keyboard Layouts
HKLM,"SYSTEM\CurrentControlSet\Control\KeyboardLayouts\00000406","Layout File",0x00000000,"kbdda.dll"

View file

@ -2147,11 +2147,14 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode,
ZwClose(InstanceKey);
DeviceNode->Flags |= DNF_PROCESSED;
IopDeviceNodeSetFlag(DeviceNode, DNF_PROCESSED);
/* Report the device to the user-mode pnp manager */
IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
&DeviceNode->InstancePath);
if (!IopDeviceNodeHasFlag(DeviceNode, DNF_LEGACY_DRIVER))
{
/* Report the device to the user-mode pnp manager */
IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL,
&DeviceNode->InstancePath);
}
return STATUS_SUCCESS;
}

View file

@ -328,6 +328,7 @@ EnumerateDevices(
PPNPROOT_FDO_DEVICE_EXTENSION DeviceExtension;
OBJECT_ATTRIBUTES ObjectAttributes;
PKEY_BASIC_INFORMATION KeyInfo = NULL, SubKeyInfo = NULL;
UNICODE_STRING LegacyU = RTL_CONSTANT_STRING(L"LEGACY_");
UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\" REGSTR_PATH_SYSTEMENUM L"\\" REGSTR_KEY_ROOTENUM);
UNICODE_STRING SubKeyName;
WCHAR DevicePath[MAX_PATH + 1];
@ -405,8 +406,16 @@ EnumerateDevices(
/* Terminate the string */
KeyInfo->Name[KeyInfo->NameLength / sizeof(WCHAR)] = 0;
/* Open the key */
/* Check if it is a legacy driver */
RtlInitUnicodeString(&SubKeyName, KeyInfo->Name);
if (RtlPrefixUnicodeString(&LegacyU, &SubKeyName, FALSE))
{
DPRINT("Ignoring legacy driver '%wZ'\n", &SubKeyName);
Index1++;
continue;
}
/* Open the key */
InitializeObjectAttributes(
&ObjectAttributes,
&SubKeyName,