From 12bcf0ad11d9963b47402e422a51dc90bbf087ef Mon Sep 17 00:00:00 2001 From: robjustice Date: Sun, 10 Apr 2016 10:24:13 +1000 Subject: [PATCH] Update Driv3rs.py Update the loop to count the number of devices in a driver. Now counts the numbers correctly. --- Driv3rs.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Driv3rs.py b/Driv3rs.py index 591a2c8..fed9a65 100644 --- a/Driv3rs.py +++ b/Driv3rs.py @@ -257,7 +257,7 @@ for i in range(0,len(drivers_list)): # here we run a new loop to determine how many other DIBs exist # under a major driver. This is primarily for drivers that are designed # to support more than one device. for instance, the CFFA3000 is -# written to support seven drives (.D1 - .D7). otherwise, nothing +# written to support eight drives (.D1 - .D8). otherwise, nothing # else changes save the unit number, which is incremented by 1 for # each device supported. # generally we enter each major drive DIB and look at the link field. @@ -265,19 +265,16 @@ for i in range(0,len(drivers_list)): # we can open up a new loop to run through the interior DIBs until # we encount a 0000 in a link field, then we stop. for i in range(0,len(drivers_list)): - link_ptr = drivers_list[i]['link_ptr'] - total_devs = 1 - if link_ptr != 0x0000: - SOSfile.seek(drivers_list[i]['dib_start'],0) - SOSfile.seek(drivers_list[i]['link_ptr'],1) - sub_loop = True - while sub_loop: - sub_link = readUnpack(2, type = 'b') - if sub_link != 0x0000: - total_devs = total_devs + 1 - SOSfile.seek(32,1) - else: - sub_loop = False + total_devs = 0 + SOSfile.seek(drivers_list[i]['dib_start'],0) + sub_loop = True + while sub_loop: + total_devs = total_devs + 1 + sub_link = readUnpack(2, type = 'b') #link to next DIB + if sub_link != 0x0000: + SOSfile.seek(drivers_list[i]['dib_start'] + sub_link,0) #link is from DIB start + else: + sub_loop = False drivers_list[i]['num_devices'] = total_devs # closing the SOS.DRIVER file