Name = PdoGetName(Pdo);
Missing = TRUE;
- // If the PDO already exists and its name is in the device list
- // then we don't want to remove it.
- for (Index = 0; Devices[Index].Buffer != NULL; Index++) {
- PANSI_STRING Device = &Devices[Index];
-
- if (Device->Length == 0)
- continue;
-
- if (strcmp(Name, Device->Buffer) == 0) {
- Missing = FALSE;
- Device->Length = 0; // avoid duplication
- break;
+ if (Devices != NULL) {
+ // If the PDO already exists and its name is in the device list
+ // then we don't want to remove it.
+ for (Index = 0; Devices[Index].Buffer != NULL; Index++) {
+ PANSI_STRING Device = &Devices[Index];
+
+ if (Device->Length == 0)
+ continue;
+
+ if (strcmp(Name, Device->Buffer) == 0) {
+ Missing = FALSE;
+ Device->Length = 0; // avoid duplication
+ break;
+ }
}
}
}
// Walk the class list and create PDOs for any new device
- for (Index = 0; Devices[Index].Buffer != NULL; Index++) {
- PANSI_STRING Device = &Devices[Index];
+ if (Devices != NULL) {
+ for (Index = 0; Devices[Index].Buffer != NULL; Index++) {
+ PANSI_STRING Device = &Devices[Index];
- if (Device->Length != 0) {
- ULONG Number;
- CHAR Prefix[sizeof ("device/vif/XXXXXXXXXX")];
- PCHAR Address;
+ if (Device->Length != 0) {
+ ULONG Number;
+ CHAR Prefix[sizeof ("device/vif/XXXXXXXXXX")];
+ PCHAR Address;
- Number = strtol(Device->Buffer, NULL, 10);
+ Number = strtol(Device->Buffer, NULL, 10);
- status = RtlStringCbPrintfA(Prefix,
- sizeof (Prefix),
- "device/vif/%u",
- Number);
- ASSERT(NT_SUCCESS(status));
- if (!NT_SUCCESS(status))
- continue;
-
- status = XENBUS_STORE(Read,
- &Fdo->StoreInterface,
- NULL,
- Prefix,
- "mac",
- &Address);
- if (!NT_SUCCESS(status))
- continue;
+ status = RtlStringCbPrintfA(Prefix,
+ sizeof (Prefix),
+ "device/vif/%u",
+ Number);
+ ASSERT(NT_SUCCESS(status));
+ if (!NT_SUCCESS(status))
+ continue;
- status = PdoCreate(Fdo, Number, Address);
- if (NT_SUCCESS(status))
- NeedInvalidate = TRUE;
+ status = XENBUS_STORE(Read,
+ &Fdo->StoreInterface,
+ NULL,
+ Prefix,
+ "mac",
+ &Address);
+ if (!NT_SUCCESS(status))
+ continue;
- XENBUS_STORE(Free,
- &Fdo->StoreInterface,
- Address);
+ status = PdoCreate(Fdo, Number, Address);
+ if (NT_SUCCESS(status))
+ NeedInvalidate = TRUE;
+
+ XENBUS_STORE(Free,
+ &Fdo->StoreInterface,
+ Address);
+ }
}
}
Devices = NULL;
}
- if (Devices == NULL)
- goto loop;
+ if (Devices == NULL) {
+ if (status == STATUS_OBJECT_PATH_NOT_FOUND)
+ goto invalidate;
+ else
+ goto loop;
+ }
if (ParametersKey != NULL) {
status = RegistryQuerySzValue(ParametersKey,
if (UnsupportedDevices != NULL)
RegistryFreeSzValue(UnsupportedDevices);
+invalidate:
NeedInvalidate = __FdoEnumerate(Fdo, Devices);
- __FdoFreeAnsi(Devices);
+ if (Devices != NULL)
+ __FdoFreeAnsi(Devices);
if (NeedInvalidate) {
NeedInvalidate = FALSE;