Skip to content

Commit

Permalink
Expose ChipsetInformation instead. (Not finished yet.)
Browse files Browse the repository at this point in the history
  • Loading branch information
MouriNaruto committed Jun 12, 2024
1 parent 8d69612 commit cf4c50e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 31 deletions.
78 changes: 52 additions & 26 deletions NanaBox/ConfigurationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,39 +129,65 @@ std::string NanaBox::MakeHcsConfiguration(

Result["ShouldTerminateOnLastHandleClosed"] = true;

nlohmann::json Uefi;
nlohmann::json Chipset;
{
switch (Configuration.ComPorts.UefiConsole)
nlohmann::json Uefi;
{
case NanaBox::UefiConsoleMode::Default:
Uefi["Console"] = "Default";
break;
case NanaBox::UefiConsoleMode::ComPort1:
Uefi["Console"] = "ComPort1";
break;
case NanaBox::UefiConsoleMode::ComPort2:
Uefi["Console"] = "ComPort2";
break;
default:
Uefi["Console"] = "Disabled";
break;
switch (Configuration.ComPorts.UefiConsole)
{
case NanaBox::UefiConsoleMode::Default:
Uefi["Console"] = "Default";
break;
case NanaBox::UefiConsoleMode::ComPort1:
Uefi["Console"] = "ComPort1";
break;
case NanaBox::UefiConsoleMode::ComPort2:
Uefi["Console"] = "ComPort2";
break;
default:
Uefi["Console"] = "Disabled";
break;
}

if (Configuration.SecureBoot)
{
Uefi["ApplySecureBootTemplate"] = "Apply";
Uefi["SecureBootTemplateId"] =
"1734c6e8-3154-4dda-ba5f-a874cc483422";
}
}
Chipset["Uefi"] = Uefi;

if (Configuration.SecureBoot)
Chipset["BaseBoardSerialNumber"] =
Configuration.ChipsetInformation.BaseBoardSerialNumber;
Chipset["ChassisSerialNumber"] =
Configuration.ChipsetInformation.ChassisSerialNumber;
Chipset["ChassisAssetTag"] =
Configuration.ChipsetInformation.ChassisAssetTag;

if (::MileIsWindowsVersionAtLeast(10, 0, 20348))
{
Uefi["ApplySecureBootTemplate"] = "Apply";
Uefi["SecureBootTemplateId"] =
"1734c6e8-3154-4dda-ba5f-a874cc483422";
nlohmann::json SystemInformation;
{
SystemInformation["Manufacturer"] =
Configuration.ChipsetInformation.Manufacturer;
SystemInformation["ProductName"] =
Configuration.ChipsetInformation.ProductName;
SystemInformation["Version"] =
Configuration.ChipsetInformation.Version;
SystemInformation["SerialNumber"] =
Configuration.ChipsetInformation.SerialNumber;
SystemInformation["UUID"] =
Configuration.ChipsetInformation.UUID;
SystemInformation["SKUNumber"] =
Configuration.ChipsetInformation.SKUNumber;
SystemInformation["Family"] =
Configuration.ChipsetInformation.Family;
}
Chipset["SystemInformation"] = SystemInformation;
}
}
Result["VirtualMachine"]["Chipset"]["Uefi"] = Uefi;

Result["VirtualMachine"]["Chipset"]["SystemInformation"]["Manufacturer"] = Configuration.Manufacturer;
Result["VirtualMachine"]["Chipset"]["SystemInformation"]["ProductName"] = Configuration.ProductName;
Result["VirtualMachine"]["Chipset"]["SystemInformation"]["Version"] = Configuration.SystemVersion;
Result["VirtualMachine"]["Chipset"]["SystemInformation"]["SerialNumber"] = Configuration.SerialNumber;
Result["VirtualMachine"]["Chipset"]["SystemInformation"]["Family"] = Configuration.Family;
Result["VirtualMachine"]["Chipset"]["BaseBoardSerialNumber"] = Configuration.SerialNumber;
Result["VirtualMachine"]["Chipset"] = Chipset;

nlohmann::json Memory;
Memory["SizeInMB"] = Configuration.MemorySize;
Expand Down
25 changes: 20 additions & 5 deletions NanaBox/ConfigurationSpecification.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,30 @@ namespace NanaBox
std::vector<std::string> Devices;
};

struct ChipsetInformationConfiguration
{
// at least 19041

std::string BaseBoardSerialNumber;
std::string ChassisSerialNumber;
std::string ChassisAssetTag;

// at least 20348

std::string Manufacturer;
std::string ProductName;
std::string Version;
std::string SerialNumber;
std::string UUID;
std::string SKUNumber;
std::string Family;
};

struct VirtualMachineConfiguration
{
std::uint32_t Version = 1;
GuestType GuestType = GuestType::Unknown;
std::string Name;
std::string Manufacturer;
std::string ProductName;
std::string SystemVersion;
std::string SerialNumber;
std::string Family;
std::uint32_t ProcessorCount = 0;
std::uint64_t MemorySize = 0;
ComPortsConfiguration ComPorts;
Expand All @@ -148,6 +162,7 @@ namespace NanaBox
bool ExposeVirtualizationExtensions = false;
KeyboardConfiguration Keyboard;
EnhancedSessionConfiguration EnhancedSession;
ChipsetInformationConfiguration ChipsetInformation;
VideoMonitorConfiguration VideoMonitor; // Not Implemented
};
}
Expand Down

0 comments on commit cf4c50e

Please sign in to comment.