Auto detection of VM when installing

This commit is contained in:
Void NV 2020-04-04 22:01:35 -05:00
parent 0ce5c06733
commit 089dff77b9
3 changed files with 37 additions and 24 deletions

View File

@ -76,9 +76,6 @@ U0 RegularInstallWiz()
I64 ch,num_hints,res_num;
CTask *task;
"\nIt's normal for this to freeze for a moment or two.\n";
PressAKey;
task=User;
TaskWait(task);
task->border_src=BDS_CONST;
@ -176,27 +173,36 @@ U0 DoInstructions()
Bool DoInstall(Bool prompt_reboot)
{
I64 res=FALSE,vm_install;
"\n\n\n\n\nAre you installing inside VMware, QEMU, VirtualBox "
"or a similar virtual machine? ";
vm_install=YorN;
DocBottom;
if (vm_install) {
VMInstallWiz();
res=TRUE;
} else {
"\n\nThis wizard works if you have a partition ready. "
"You can partition the drive or BootHDIns() "
"with more options if you do it by hand, not using this wizard.\n\n"
"Continue Install Wizard ";
if (YorN) {
RegularInstallWiz();
res=TRUE;
} else
prompt_reboot=FALSE;
I64 res = FALSE, vm_install = TRUE;
CSMBIOSSystemInfo *sys_info = SMBIOSStructGet(SMBIOSt_SYSTEM);
U8 *company = SMBIOSStr(sys_info, sys_info->manufacturer);
if (StrCompare(company, "VMware, Inc.") && StrCompare(company, "innotek GmbH") && StrCompare(company, "QEMU"))
{
"\n\n\n\n\nAre you installing inside VMware, QEMU, VirtualBox or a similar virtual machine? ";
vm_install = YorN;
}
if (prompt_reboot) {
DocBottom;
if (vm_install)
{
VMInstallWiz();
res = TRUE;
}
else
{
"\n\nThis wizard works if you have a partition ready. You can partition the drive or BootHDIns() "
"with more options if you do it by hand, not using this wizard.\n\n"
"Continue Install Wizard ";
if (YorN)
{
RegularInstallWiz();
res = TRUE;
}
else
prompt_reboot = FALSE;
}
if (prompt_reboot)
{
"Reboot Now ";
if (YorN)
Reboot;

View File

@ -145,9 +145,16 @@ U8 *SMBIOSStr(CSMBIOSHeader *header, I64 str_num, U8 *default="None")
return ptr;
}
CSMBIOSHeader *SMBIOSStructGet(CSMBIOSHeader *head, I64 type=0xFFFFF, I64 handle=0xFFFFF)
CSMBIOSHeader *SMBIOSStructGet(I64 type=0xFFFFF, I64 handle=0xFFFFF, CSMBIOSHeader *head=NULL)
{//Search for struct with type or handle. Return NULL if not found.
I64 i;
CSMBIOSEntryPoint *entry;
if (!head)
{
if (!SMBIOSEntryScan(&entry))
return NULL;
head = entry->table_address;
}
while (head->type != 127)
{
if (head->handle == handle)