Skip to content

Commit

Permalink
phfirmware virtual status cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy-s committed Jan 11, 2025
1 parent 5e60f09 commit 73221d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
14 changes: 7 additions & 7 deletions SystemInformer/syssccpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,21 +1148,21 @@ VOID PhSipUpdateCpuPanel(
switch (PhGetVirtualStatus())
{
case PhVirtualStatusVirtualMachine:
PhSetDialogItemText(CpuPanel, IDC_VIRTUALIZATION, L"Virtual machine");
PhSetWindowText(CpuVirtualizationLabel, L"Virtual machine");
break;
case PhVirtualStatusEnabledHyperV:
case PhVirtualStatusEnabledFirmware:
PhSetDialogItemText(CpuPanel, IDC_VIRTUALIZATION, L"Enabled");
PhSetWindowText(CpuVirtualizationLabel, L"Enabled");
break;
case PhVirtualStatusDiabledWithHyperVSupport:
PhSetDialogItemText(CpuPanel, IDC_VIRTUALIZATION, L"Disabled (Hyper-V support: Yes)");
case PhVirtualStatusDiabledWithHyperV:
PhSetWindowText(CpuVirtualizationLabel, L"Disabled / Hyper-V");
break;
case PhVirtualStatusDiabledWithoutHyperVSupport:
PhSetDialogItemText(CpuPanel, IDC_VIRTUALIZATION, L"Disabled (Hyper-V support: No)");
case PhVirtualStatusDiabled:
PhSetWindowText(CpuVirtualizationLabel, L"Disabled");
break;
case PhVirtualStatusNotCapable:
default:
PhSetDialogItemText(CpuPanel, IDC_VIRTUALIZATION, L"Not capable");
PhSetWindowText(CpuVirtualizationLabel, L"Not capable");
break;
}
}
Expand Down
24 changes: 8 additions & 16 deletions phlib/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ BOOLEAN PhHypervisorIsPresent(
return FALSE;
}

BOOLEAN PhCpuIsMicrosoftHyperV(
BOOLEAN PhVCpuIsMicrosoftHyperV(
VOID
)
{
Expand Down Expand Up @@ -206,10 +206,8 @@ PH_VIRTUAL_STATUS PhGetVirtualStatus(
{
return PhVirtualStatusEnabledFirmware;
}
else
{
return PhVirtualStatusNotCapable;
}

return PhVirtualStatusNotCapable;
}
else
{
Expand Down Expand Up @@ -241,7 +239,7 @@ PH_VIRTUAL_STATUS PhGetVirtualStatus(
#else
if (PhHypervisorIsPresent())
{
if (PhCpuIsMicrosoftHyperV())
if (PhVCpuIsMicrosoftHyperV())
{
HV_PARTITION_PRIVILEGE_MASK mask;

Expand All @@ -251,15 +249,9 @@ PH_VIRTUAL_STATUS PhGetVirtualStatus(
{
return PhVirtualStatusEnabledHyperV;
}
else
{
return PhVirtualStatusVirtualMachine;
}
}
else
{
return PhVirtualStatusVirtualMachine;
}

return PhVirtualStatusVirtualMachine;
}

if (PhCpuIsIntel())
Expand Down Expand Up @@ -295,10 +287,10 @@ PH_VIRTUAL_STATUS PhGetVirtualStatus(
if (USER_SHARED_DATA->ProcessorFeatures[PF_SECOND_LEVEL_ADDRESS_TRANSLATION] &&
USER_SHARED_DATA->ProcessorFeatures[PF_NX_ENABLED])
{
return PhVirtualStatusDiabledWithHyperVSupport;
return PhVirtualStatusDiabledWithHyperV;
}

return PhVirtualStatusDiabledWithoutHyperVSupport;
return PhVirtualStatusDiabled;
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions phlib/include/phfirmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ typedef enum _PH_VIRTUAL_STATUS
PhVirtualStatusEnabledHyperV = 2,
PhVirtualStatusEnabledFirmware = 3,
//PhVirtualStatusUnknown = 4,
PhVirtualStatusDiabledWithHyperVSupport = 5,
PhVirtualStatusDiabledWithoutHyperVSupport = 6,
PhVirtualStatusDiabledWithHyperV = 5,
PhVirtualStatusDiabled = 6,
} PH_VIRTUAL_STATUS, *PPH_VIRTUAL_STATUS;

PHLIBAPI
Expand Down

0 comments on commit 73221d7

Please sign in to comment.