Merge pull request 'Compatibilidad con Windows 11' (#17) from 456-windows11 into main

Reviewed-on: #17
ticket-612
Natalia Serrano 2024-07-04 10:42:27 +02:00
commit 98c33dd5c2
2 changed files with 18 additions and 3 deletions

View File

@ -442,6 +442,7 @@ fi
# Para Windows: leer la version del registro.
if [ -z "$VERSION" ]; then
TYPE="Windows"
# jcgarcia by carmelo 12-03-2024
FILE="$(ogGetHivePath $MNTDIR SOFTWARE)"
if [ -n "$FILE" ]; then
# Nuevo método más rápido para acceder al registro de Windows..
@ -449,17 +450,29 @@ if [ -z "$VERSION" ]; then
load $FILE
cd \Microsoft\Windows NT\CurrentVersion
lsval ProductName
lsval ReleaseId
lsval DisplayVersion
EOT
))
# Recoge el valor del número de compilación para ver si es Windows 10/11
BUILD=$(echo $(hivexsh << EOT 2>/dev/null
load $FILE
cd \Microsoft\Windows NT\CurrentVersion
lsval CurrentBuildNumber
EOT
))
[ -n "$(reglookup -H -p "Microsoft/Windows/CurrentVersion/ProgramW6432Dir" "$FILE" 2>/dev/null)" ] && IS64BIT="$MSG_64BIT"
if [ -z "$VERSION" ]; then
# Compatibilidad con métrodo antiguo y más lento de acceder al registro.
VERSION=$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows NT\CurrentVersion\ProductName' 2>/dev/null)
[ -n "$(ogGetRegistryValue $MNTDIR software '\Microsoft\Windows\CurrentVersion\ProgramW6432Dir' 2>/dev/null)" ] && IS64BIT="$MSG_64BIT"
fi
# Si la compilación es mayor o igual a 22000 es Windows 11
if [ $BUILD -ge 22000 ]; then
VERSION="${VERSION/10/11}"
fi
fi
fi
# jcgarcia fin
# Para cargador Windows: buscar versión en fichero BCD (basado en os-prober).
if [ -z "$VERSION" ]; then
TYPE="WinLoader"

View File

@ -128,7 +128,8 @@ EFIDIR=$(ogMount $(ogGetEsp)) || ogRaiseError $OG_ERR_PARTITION "ESP" || return
BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
OSVERSION=$(ogGetOsVersion $1 $2)
case $OSVERSION in
*Windows\ 10*)
# jcgarcia by carmelo 12-04-2024
*Windows\ 1*)
for f in $EFIDIR/EFI/{Microsoft,$BOOTLABEL}/Boot/bootmgfw.efi; do
[ -r $f ] && LOADER=$f
done
@ -442,7 +443,8 @@ fi
#BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
OSVERSION=$(ogGetOsVersion $1 $2)
case $OSVERSION in
*Windows\ 10*)
# jcgarcia by carmelo 12-04-2024
*Windows\ 1*)
BOOTLABEL=$(printf "Part-%02d-%02d" $1 $2)
LOADER=$(ogGetPath $MNTDIR/ogBoot/bootmgfw.efi)
[ -n "$LOADER" ] || ogRaiseError $OG_ERR_NOTOS "$1 $2 ($OSVERSION, EFI)" || return $?