Initial source release

This commit is contained in:
Paravis committed 2026-11-13 07:52:38 +03:00
commit 11301fae04
55 files changed
+2652

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
# Восстановление центровки в BCD: неразрывные пробелы (U+00A0) перед описаниями.
$store = 'F:\efi\Paravis\Boot\bcd\bcd'
$log = 'C:\PF\bcd-center.log'
$gfm = '{212da646-f065-474f-a688-d0ebfefd1573}'
$krd = '{de2ba8ef-1a63-40cd-aeec-56a8efcb0886}'
$nbsp = [string][char]0x00A0
$out = @()
function Run([string[]]$argv) {
$r = & bcdedit @argv 2>&1
$script:out += ('> bcdedit ' + ($argv -join ' '))
$script:out += (' exit=' + $LASTEXITCODE)
if ($r) { $script:out += ($r | ForEach-Object { ' ' + $_ }) }
}
# Kaspersky: 4 NBSP (как было у "...Disk 18"), Ventoy: 7 NBSP
$krdText = ($nbsp * 4) + 'Kaspersky Rescue Disk 24'
$vtText = ($nbsp * 7) + 'Ventoy (ISO образы)'
Run @('/store', $store, '/set', $krd, 'description', $krdText)
Run @('/store', $store, '/set', $gfm, 'description', $vtText)
$out += '=== контроль по байтам BCD:'
$b = [IO.File]::ReadAllBytes($store)
foreach ($pat in 'Kaspersky Rescue Disk 24', 'Ventoy (ISO') {
$needle = [Text.Encoding]::Unicode.GetBytes($pat)
$pos = -1
for ($i = 0; $i -le $b.Length - $needle.Length; $i++) {
$ok = $true
for ($j = 0; $j -lt $needle.Length; $j++) { if ($b[$i+$j] -ne $needle[$j]) { $ok = $false; break } }
if ($ok) { $pos = $i; break }
}
# считаем U+00A0 (A0 00) непосредственно перед текстом
$n = 0
while ($pos - 2 - $n*2 -ge 0 -and $b[$pos-2-$n*2] -eq 0xA0 -and $b[$pos-1-$n*2] -eq 0x00) { $n++ }
$out += (' {0}: найдено @0x{1:X}, NBSP перед текстом = {2}' -f $pat, $pos, $n)
}
$out | Out-File -FilePath $log -Encoding utf8