]> xenbits.xensource.com Git - people/pauldu/xenvif.git/commitdiff
Step through hardware revision list in reverse order
authorOwen Smith <owen.smith@citrix.com>
Tue, 20 Sep 2016 17:06:14 +0000 (18:06 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 20 Sep 2016 17:19:38 +0000 (18:19 +0100)
Windows treats the HardwareID list as a decending order of specialization
where the first entry is the most specific, and last entry is least
specific. This can lead to install issues when the newer driver has a
less-specific HardwareID, as the older ("more-specific") HardwareID is
used for the match. Reordering the HardwareID list, so that the newest
revision is first, will stop Windows selecting the wrong driver package
to install.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Re-factored slightly for code consistency.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenvif/pdo.c

index 0294b069af40a1f91bb32836c4036c5b7c563433..428ce0d9182ad2a6006f0558345b328f9869378d 100644 (file)
@@ -2045,13 +2045,15 @@ PdoQueryId(
     }
     case BusQueryHardwareIDs:
     case BusQueryCompatibleIDs: {
-        ULONG   Index;
+        LONG    Index;
         ULONG   Length;
 
         Type = REG_MULTI_SZ;
+        Index = ARRAYSIZE(PdoRevision) - 1;
+
         Length = Id.MaximumLength;
 
-        for (Index = 0; Index < ARRAYSIZE(PdoRevision); Index++) {
+        while (Index >= 0) {
             PXENVIF_PDO_REVISION    Revision = &PdoRevision[Index];
 
             status = RtlStringCbPrintfW(Buffer,
@@ -2066,6 +2068,8 @@ PdoQueryId(
 
             Buffer++;
             Length -= sizeof (WCHAR);
+
+            --Index;
         }
 
         status = RtlStringCbPrintfW(Buffer,