Skip to content

Commit

Permalink
phodevi: Fill in some Windows gaps
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellarabel committed May 15, 2021
1 parent 6d8b781 commit e112a12
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
16 changes: 15 additions & 1 deletion pts-core/objects/phodevi/components/phodevi_audio.php
Expand Up @@ -51,7 +51,21 @@ public static function audio_processor_string()
}
else if(phodevi::is_windows())
{
// TODO: implement
$win_sound = array();
$win32_sounddevice = shell_exec('powershell "(Get-WMIObject -Class win32_sounddevice | Select Name)"');
if(($x = strpos($win32_sounddevice, '----')) !== false)
{
$win32_sounddevice = trim(substr($win32_sounddevice, $x + 4));
foreach(explode("\n", $win32_sounddevice) as $sd)
{
if(!empty($sd))
{
$win_sound[] = $sd;
}
}
}
$win_sound = array_unique($win_sound);
$audio = implode(' + ', $win_sound);
}
else if(phodevi::is_linux())
{
Expand Down
14 changes: 14 additions & 0 deletions pts-core/objects/phodevi/components/phodevi_cpu.php
Expand Up @@ -383,6 +383,20 @@ public static function cpu_microcode_version()
{
$ucode_version = self::read_cpuinfo_line('microcode');
}
else if(phodevi::is_windows())
{
$reg = shell_exec('reg query HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0');
if(($x = strpos($reg, 'Update Revision')) !== false)
{
$reg = substr($reg, $x);
$reg = substr($reg, 0, strpos($reg, "\n"));
$ucode = substr($reg, strrpos($reg, ' '));
if(is_numeric($ucode))
{
$ucode_version = $ucode;
}
}
}

if(empty($ucode_version) && phodevi::is_macos())
{
Expand Down
15 changes: 14 additions & 1 deletion pts-core/objects/phodevi/components/phodevi_disk.php
Expand Up @@ -96,7 +96,7 @@ public static function block_size()
{
$path = PTS_IS_CLIENT ? pts_client::test_install_root_path() : '.';
$block_size = -1;
if(PTS_IS_CLIENT && pts_client::executable_in_path('stat'))
if(PTS_IS_CLIENT && pts_client::executable_in_path('stat') && !phodevi::is_windows())
{
$stat = trim(shell_exec('stat -f -c %S ' . $path));

Expand All @@ -105,6 +105,19 @@ public static function block_size()
$block_size = $stat;
}
}
else if(phodevi::is_windows())
{
$wmi = shell_exec('powershell "Get-WmiObject -Class Win32_Volume | Select-Object DriveLetter, BlockSize"');
if(($x = strpos($wmi, 'C:')) !== false)
{
$wmi = substr($wmi, ($x + 3));
$wmi = trim(substr($wmi, 0, strpos($wmi, "\n")));
if(is_numeric($wmi))
{
$block_size = $wmi;
}
}
}

return $block_size;
}
Expand Down
4 changes: 4 additions & 0 deletions pts-core/objects/phodevi/components/phodevi_monitor.php
Expand Up @@ -52,6 +52,10 @@ public static function monitor_string()
$monitor = array($monitor);
}
}
else if(phodevi::is_windows())
{
$monitor[] = trim(shell_exec('powershell "$((Get-WmiObject WmiMonitorID -Namespace root\wmi) | %{ $Name = $($_.UserFriendlyName -notmatch 0 | ForEach{[char]$_}) -join \"\"; Write-Output $Name }) -join \";\""'));
}
else if(phodevi::is_nvidia_graphics() && isset(phodevi::$vfs->xorg_log))
{
$log_parse = phodevi::$vfs->xorg_log;
Expand Down
24 changes: 24 additions & 0 deletions pts-core/objects/phodevi/components/phodevi_motherboard.php
Expand Up @@ -53,6 +53,18 @@ public static function secure_boot()
$status = 'Disabled';
}
}
else if(phodevi::is_windows())
{
$confirm = shell_exec('powershell "Confirm-SecureBootUEFI"');
if(strpos($confirm, 'True') !== false)
{
$status = 'Enabled';
}
else if(strpos($confirm, 'False') !== false)
{
$status = 'Disabled';
}
}

return $status;
}
Expand All @@ -71,6 +83,18 @@ public static function boot_mode()
$boot_mode = 'EFI';
}
}
else if(phodevi::is_windows())
{
$bcdedit = shell_exec('bcdedit');
if(strpos($bcdedit, '.efi') !== false)
{
$boot_mode = 'EFI';
}
else if(strpos($bcdedit, 'path') !== false)
{
$boot_mode = 'Legacy BIOS';
}
}

return $boot_mode;
}
Expand Down

0 comments on commit e112a12

Please sign in to comment.