SEBWIN-717, #637: Fixed loading of MAC address for system info.
This commit is contained in:
parent
b36df9ad5a
commit
d76dbf6b40
1 changed files with 7 additions and 16 deletions
|
@ -219,11 +219,8 @@ namespace SafeExamBrowser.SystemComponents
|
|||
|
||||
try
|
||||
{
|
||||
using (var searcher = new ManagementObjectSearcher("SELECT MACAddress FROM Win32_NetworkAdapterConfiguration WHERE DNSDomain IS NOT NULL"))
|
||||
using (var searcher = new ManagementObjectSearcher("SELECT MACAddress FROM Win32_NetworkAdapterConfiguration WHERE DNSHostName IS NOT NULL"))
|
||||
using (var results = searcher.Get())
|
||||
{
|
||||
if (results != default && results.Count > 0)
|
||||
{
|
||||
using (var networkAdapter = results.Cast<ManagementObject>().First())
|
||||
{
|
||||
foreach (var property in networkAdapter.Properties)
|
||||
|
@ -235,15 +232,9 @@ namespace SafeExamBrowser.SystemComponents
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
finally
|
||||
{
|
||||
MacAddress = UNDEFINED;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
MacAddress = UNDEFINED;
|
||||
MacAddress = MacAddress ?? UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue