From 773e91c9101fb0b9b956a6b54b0dbff5ceedca38 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 10 Mar 2015 19:12:06 +0600 Subject: Add support for SMBIOS vendor string based detection. --- src/hvinfo.adb | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'src/hvinfo.adb') diff --git a/src/hvinfo.adb b/src/hvinfo.adb index cfde51b..aa456a4 100644 --- a/src/hvinfo.adb +++ b/src/hvinfo.adb @@ -1,16 +1,35 @@ +with Ada.Strings.Unbounded; with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO; with Ada.Command_Line; use Ada.Command_Line; with Hypervisor_Check; use Hypervisor_Check; + procedure HVInfo is + package US renames Ada.Strings.Unbounded; + CPUID_HV_Name, SMBIOS_HV_Name, Hypervisor_Name : US.Unbounded_String; begin + CPUID_HV_Name := US.To_Unbounded_String (""); + SMBIOS_HV_Name := US.To_Unbounded_String (""); - -- Try CPUID checks first if Hypervisor_Present then - Put_Line (Get_Vendor_Name); - Set_Exit_Status (0); - else - Set_Exit_Status (1); + CPUID_HV_Name := Get_Vendor_Name; end if; + + SMBIOS_HV_Name := Get_DMI_Vendor_Name; + + declare + use US; + begin + if (CPUID_HV_Name = "") and (SMBIOS_HV_Name = "") then + Set_Exit_Status (1); + elsif (CPUID_HV_Name /= "") then + Set_Exit_Status (0); + UIO.Put_Line (CPUID_HV_Name); + else + Set_Exit_Status (0); + UIO.Put_Line (SMBIOS_HV_Name); + end if; + end; + end HVInfo; -- cgit v1.2.3