Skip to content

Commit

Permalink
MicroWin: fixing German and Spanish bugs (#1194)
Browse files Browse the repository at this point in the history
* Fixing German and other languages local issue, also doing some house keeping

* Fixed several Microwin bugs

* Fixing local bug and adding copy to USB feature

* Adding driver injection capabilities and fixing bugs in Microwin

---------

Co-authored-by: KonTy <KonTy@github.com>
  • Loading branch information
KonTy and KonTy authored Nov 25, 2023
1 parent 8dbd76f commit 7b9e104
Show file tree
Hide file tree
Showing 9 changed files with 1,016 additions and 802 deletions.
42 changes: 42 additions & 0 deletions functions/private/Get-LocalizedYesNo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function Get-LocalizedYesNo {
<#
.SYNOPSIS
This function runs takeown.exe and captures its output to extract yes no in a localized Windows
.DESCRIPTION
The function retrieves lines from the output of takeown.exe until there are at least 2 characters
captured in a specific format, such as "Yes=<first character>, No=<second character>".
.EXAMPLE
$yesNoArray = Get-LocalizedYesNo
Write-Host "Yes=$($yesNoArray[0]), No=$($yesNoArray[1])"
#>

# Run takeown.exe and capture its output
$takeownOutput = & takeown.exe /? | Out-String

# Parse the output and retrieve lines until there are at least 2 characters in the array
$found = $false
$charactersArray = @()
foreach ($line in $takeownOutput -split "`r`n")
{
if ($found)
{
$characters = $line -split '(")([A-Za-z])(")' | Where-Object { $_ -match '^[A-Za-z]$' }
$charactersArray += $characters

if ($charactersArray.Count -ge 2)
{
break
}
}
elseif ($line -match "/D ")
{
$found = $true
}
}

Write-Debug "According to takeown.exe local Yes is $charactersArray[0]"
# Return the array of characters
return $charactersArray
}
Loading

0 comments on commit 7b9e104

Please sign in to comment.