Fix in the gathering of video adapter information

Some video adapters do not have registry key "Device Description", instead most
of them have the key "DriveDesc" set. Added test for both keys before failing.
This commit is contained in:
Dionisio E Alonso 2015-04-09 03:45:06 -03:00
parent 5d220ef36b
commit 81b05434f7
1 changed files with 15 additions and 5 deletions

View File

@ -63,11 +63,21 @@ class SystemInformation:
video_cards = []
for video_card in reg_keys:
device_descrption = get_registry_value(
'HKEY_LOCAL_MACHINE',
'SYSTEM\\CurrentControlSet\\Control\\Video\\'
'{}\\0000'.format(video_card),
'Device Description')
try:
device_descrption = get_registry_value(
'HKEY_LOCAL_MACHINE',
'SYSTEM\\CurrentControlSet\\Control\\Video\\'
'{}\\0000'.format(video_card),
'Device Description')
except:
try:
device_descrption = get_registry_value(
'HKEY_LOCAL_MACHINE',
'SYSTEM\\CurrentControlSet\\Control\\Video\\'
'{}\\0000'.format(video_card),
'DriverDesc')
except:
device_descrption = 'Failed to obtain video adapter.'
video_cards.append(device_descrption)
return '\n\t'.join(video_cards)