mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 07:39:00 +01:00
fix: Hide long mode from 32-bit Windows guests (#2178)
This commit is contained in:
+54
-14
@@ -573,6 +573,8 @@ patchWin9xSetupFiles() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
patchWin9xLooseSetupFiles "$id" "$target" "$desc" "$patcher" || return 1
|
||||||
|
|
||||||
if [[ "${id,,}" == "win9x"* ]]; then
|
if [[ "${id,,}" == "win9x"* ]]; then
|
||||||
patchWinMeBaseComponents "$target" "$desc" || return 1
|
patchWinMeBaseComponents "$target" "$desc" || return 1
|
||||||
fi
|
fi
|
||||||
@@ -600,6 +602,51 @@ patchWin9xSetupFiles() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patchWin9xLooseSetupFiles() {
|
||||||
|
|
||||||
|
local id="$1"
|
||||||
|
local target="$2"
|
||||||
|
local desc="$3"
|
||||||
|
local patcher="$4"
|
||||||
|
local patches="tlb,speed,mem,g4resfix"
|
||||||
|
local name file patch_output
|
||||||
|
local -a list=()
|
||||||
|
|
||||||
|
[[ "${id,,}" == "win9x"* ]] && patches="default"
|
||||||
|
|
||||||
|
# Patcher9x scans the setup CABs in installation-media mode, while Windows
|
||||||
|
# Setup gives loose files in the setup directory precedence over CAB copies.
|
||||||
|
# Patch every loose file Patcher9x documents as a possible replacement so a
|
||||||
|
# media-specific override cannot bypass the already-patched cabinet version.
|
||||||
|
for name in \
|
||||||
|
VMM32.VXD \
|
||||||
|
VMM.VXD \
|
||||||
|
NTKERN.VXD \
|
||||||
|
IOS.VXD \
|
||||||
|
ESDI_506.PDR \
|
||||||
|
SCSIPORT.PDR \
|
||||||
|
NDIS.VXD \
|
||||||
|
NDIS.386 \
|
||||||
|
VCACHE.VXD \
|
||||||
|
WIN.COM \
|
||||||
|
WIN.CNF; do
|
||||||
|
|
||||||
|
file=$(find "$target" -maxdepth 1 -type f -iname "$name" -print -quit) || return 1
|
||||||
|
[ -n "$file" ] && list+=("$file")
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
(( ${#list[@]} == 0 )) && return 0
|
||||||
|
|
||||||
|
if ! patch_output=$("$patcher" --patch "$patches" "${list[@]}" 2>&1); then
|
||||||
|
[ -z "$patch_output" ] || printf '%s\n' "$patch_output" >&2
|
||||||
|
error "Failed to patch loose $desc setup files!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
stageWin95AC97Driver() {
|
stageWin95AC97Driver() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
@@ -1976,6 +2023,7 @@ writeWin9xAnswerFile() {
|
|||||||
local firstLogonUpdateInis="Win9x.OnlineServicesFolder"
|
local firstLogonUpdateInis="Win9x.OnlineServicesFolder"
|
||||||
local copyFiles="" post="" hide="" installDelReg=""
|
local copyFiles="" post="" hide="" installDelReg=""
|
||||||
local culture region keyboard localeID keyboardID
|
local culture region keyboard localeID keyboardID
|
||||||
|
local phys="10000" # 256 MB
|
||||||
|
|
||||||
if [[ "${id,,}" == "win9x"* ]]; then
|
if [[ "${id,,}" == "win9x"* ]]; then
|
||||||
addReg="${addReg%,Win9x.ActiveSetup},WinMe.ActiveSetup"
|
addReg="${addReg%,Win9x.ActiveSetup},WinMe.ActiveSetup"
|
||||||
@@ -2100,8 +2148,7 @@ writeWin9xAnswerFile() {
|
|||||||
'[Install]' \
|
'[Install]' \
|
||||||
"CopyFiles=$copyFiles" \
|
"CopyFiles=$copyFiles" \
|
||||||
"UpdateInis=$updateInis" \
|
"UpdateInis=$updateInis" \
|
||||||
"AddReg=$addReg" \
|
"AddReg=$addReg"
|
||||||
'BitReg=Win9x.DisableAnimationsDefault'
|
|
||||||
|
|
||||||
if [ -n "$installDelReg" ]; then
|
if [ -n "$installDelReg" ]; then
|
||||||
printf '%s\n' "DelReg=$installDelReg"
|
printf '%s\n' "DelReg=$installDelReg"
|
||||||
@@ -2190,8 +2237,7 @@ writeWin9xAnswerFile() {
|
|||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
'' \
|
'' \
|
||||||
'[Win9x.FirstLogon]' \
|
'[Win9x.FirstLogon]' \
|
||||||
"AddReg=$firstLogonAddReg" \
|
"AddReg=$firstLogonAddReg"
|
||||||
'BitReg=Win9x.DisableAnimations'
|
|
||||||
|
|
||||||
if [ -n "$firstLogonDelReg" ]; then
|
if [ -n "$firstLogonDelReg" ]; then
|
||||||
printf '%s\n' "DelReg=$firstLogonDelReg"
|
printf '%s\n' "DelReg=$firstLogonDelReg"
|
||||||
@@ -2374,8 +2420,7 @@ writeWin9xAnswerFile() {
|
|||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
'' \
|
'' \
|
||||||
'[Win9x.SystemIni]' \
|
'[Win9x.SystemIni]' \
|
||||||
'%10%\system.ini,386Enh,,"MaxPhysPage=100000"' \
|
"%10%\system.ini,386Enh,,\"MaxPhysPage=$phys\""
|
||||||
'%10%\system.ini,vcache,,"MaxFileCache=65536"'
|
|
||||||
|
|
||||||
if ! disabled "$AUTOLOGIN"; then
|
if ! disabled "$AUTOLOGIN"; then
|
||||||
printf '%s\n' '%10%\system.ini,"Password Lists",,"DOCKER=C:\WINDOWS\DOCKER.PWL"'
|
printf '%s\n' '%10%\system.ini,"Password Lists",,"DOCKER=C:\WINDOWS\DOCKER.PWL"'
|
||||||
@@ -2384,7 +2429,7 @@ writeWin9xAnswerFile() {
|
|||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
'' \
|
'' \
|
||||||
'[Win9x.SystemCb]' \
|
'[Win9x.SystemCb]' \
|
||||||
'%10%\system.cb,386Enh,,"MaxPhysPage=100000"' \
|
"%10%\system.cb,386Enh,,\"MaxPhysPage=$phys\"" \
|
||||||
'' \
|
'' \
|
||||||
'[Setup]' \
|
'[Setup]' \
|
||||||
'Express=1' \
|
'Express=1' \
|
||||||
@@ -2483,6 +2528,7 @@ writeWin9xUserRegistry() {
|
|||||||
'HKU,".DEFAULT\Control Panel\Desktop","ScreenSaveActive",,"0"' \
|
'HKU,".DEFAULT\Control Panel\Desktop","ScreenSaveActive",,"0"' \
|
||||||
'HKU,".DEFAULT\Control Panel\Desktop","DragFullWindows",,"1"' \
|
'HKU,".DEFAULT\Control Panel\Desktop","DragFullWindows",,"1"' \
|
||||||
'HKU,".DEFAULT\Control Panel\Desktop","MenuShowDelay",,"0"' \
|
'HKU,".DEFAULT\Control Panel\Desktop","MenuShowDelay",,"0"' \
|
||||||
|
'HKU,".DEFAULT\Control Panel\Desktop","UserPreferenceMask",1,9c,32,07,80' \
|
||||||
'HKU,".DEFAULT\Control Panel\Desktop","FontSmoothing",,"1"' \
|
'HKU,".DEFAULT\Control Panel\Desktop","FontSmoothing",,"1"' \
|
||||||
'HKU,".DEFAULT\Control Panel\Desktop","SmoothScroll",0x00010001,0' \
|
'HKU,".DEFAULT\Control Panel\Desktop","SmoothScroll",0x00010001,0' \
|
||||||
'HKU,".DEFAULT\Control Panel\Desktop\WindowMetrics","MinAnimate",,"0"' \
|
'HKU,".DEFAULT\Control Panel\Desktop\WindowMetrics","MinAnimate",,"0"' \
|
||||||
@@ -2509,6 +2555,7 @@ writeWin9xUserRegistry() {
|
|||||||
'HKCU,"Control Panel\Desktop","ScreenSaveActive",,"0"' \
|
'HKCU,"Control Panel\Desktop","ScreenSaveActive",,"0"' \
|
||||||
'HKCU,"Control Panel\Desktop","DragFullWindows",,"1"' \
|
'HKCU,"Control Panel\Desktop","DragFullWindows",,"1"' \
|
||||||
'HKCU,"Control Panel\Desktop","MenuShowDelay",,"0"' \
|
'HKCU,"Control Panel\Desktop","MenuShowDelay",,"0"' \
|
||||||
|
'HKCU,"Control Panel\Desktop","UserPreferenceMask",1,9c,32,07,80' \
|
||||||
'HKCU,"Control Panel\Desktop","FontSmoothing",,"1"' \
|
'HKCU,"Control Panel\Desktop","FontSmoothing",,"1"' \
|
||||||
'HKCU,"Control Panel\Desktop","SmoothScroll",0x00010001,0' \
|
'HKCU,"Control Panel\Desktop","SmoothScroll",0x00010001,0' \
|
||||||
'HKCU,"Control Panel\Desktop\WindowMetrics","MinAnimate",,"0"' \
|
'HKCU,"Control Panel\Desktop\WindowMetrics","MinAnimate",,"0"' \
|
||||||
@@ -2528,13 +2575,6 @@ writeWin9xUserRegistry() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf '%s\n' \
|
|
||||||
'' \
|
|
||||||
'[Win9x.DisableAnimationsDefault]' \
|
|
||||||
'HKU,".DEFAULT\Control Panel\Desktop","UserPreferencesMask",0,0x02,0' \
|
|
||||||
'' \
|
|
||||||
'[Win9x.DisableAnimations]' \
|
|
||||||
'HKCU,"Control Panel\Desktop","UserPreferencesMask",0,0x02,0'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeWin9xMachineRegistry() {
|
writeWin9xMachineRegistry() {
|
||||||
|
|||||||
+5
-7
@@ -356,12 +356,9 @@ getImageSize() {
|
|||||||
getArchiveSize() {
|
getArchiveSize() {
|
||||||
|
|
||||||
local file="$1"
|
local file="$1"
|
||||||
local result_name="$2"
|
|
||||||
local -n result="$result_name"
|
|
||||||
|
|
||||||
local found=0 listing line value rc
|
local found=0 result=0
|
||||||
|
local listing line value rc
|
||||||
result=0
|
|
||||||
|
|
||||||
listing=$(7z l -slt "$file" 2>/dev/null) || {
|
listing=$(7z l -slt "$file" 2>/dev/null) || {
|
||||||
rc=$?
|
rc=$?
|
||||||
@@ -386,6 +383,7 @@ getArchiveSize() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' "$result"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +435,7 @@ extractImage() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
getArchiveSize "$iso" archiveSize || return
|
archiveSize=$(getArchiveSize "$iso") || return
|
||||||
required=$((archiveSize + (archiveSize + 99) / 100))
|
required=$((archiveSize + (archiveSize + 99) / 100))
|
||||||
|
|
||||||
checkFreeSpace "$target" "$required" || return 1
|
checkFreeSpace "$target" "$required" || return 1
|
||||||
@@ -554,7 +552,7 @@ getPlatform() {
|
|||||||
|
|
||||||
local xml="$1"
|
local xml="$1"
|
||||||
|
|
||||||
local arch current platform=""
|
local arch count current platform=""
|
||||||
local image_count output records
|
local image_count output records
|
||||||
local separator=$'\x1f'
|
local separator=$'\x1f'
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -87,12 +87,15 @@ setMachine() {
|
|||||||
|
|
||||||
case "${id,,}" in
|
case "${id,,}" in
|
||||||
|
|
||||||
"win9"* | "winnt4" | "win2k"* | *"x86"* | "reactos" )
|
"win9"* | "winnt4" | "win2k"* | *"x86"* )
|
||||||
|
|
||||||
# Legacy 32-bit Windows may enter an incompatible PAE/DEP path when the
|
# Legacy 32-bit Windows may enter an incompatible PAE/DEP path when the
|
||||||
# NX flag is exposed, causing installation failures or repeated resets.
|
# NX flag is exposed, causing installation failures or repeated resets.
|
||||||
|
#
|
||||||
|
# Long mode is unusable by 32-bit guests and may cause the firmware to
|
||||||
|
# allocate PCI resources above 4 GB, which older systems may not handle.
|
||||||
|
|
||||||
writeState "flag" "nx=off" || return 1 ;;
|
writeState "flag" "nx=off,lm=off" || return 1 ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
+9
-31
@@ -163,7 +163,6 @@ SIFInstall() {
|
|||||||
writeRegistry "$dir" "$shortcut" "$oem" "$regUsername" "$regPassword" "$driver" || return 1
|
writeRegistry "$dir" "$shortcut" "$oem" "$regUsername" "$regPassword" "$driver" || return 1
|
||||||
|
|
||||||
appendRegistry "$dir" "$driver" || return 1
|
appendRegistry "$dir" "$driver" || return 1
|
||||||
writeNT5Effects "$dir" || return 1
|
|
||||||
writeVBS "$dir" "$username" "$shortcut" "$driver" || return 1
|
writeVBS "$dir" "$username" "$shortcut" "$driver" || return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -941,7 +940,15 @@ appendRegistry() {
|
|||||||
'"SCRNSAVE.EXE"="off"' \
|
'"SCRNSAVE.EXE"="off"' \
|
||||||
'"ScreenSaveActive"="0"' \
|
'"ScreenSaveActive"="0"' \
|
||||||
'"DragFullWindows"="1"' \
|
'"DragFullWindows"="1"' \
|
||||||
'"MenuShowDelay"="0"' \
|
'"MenuShowDelay"="0"'
|
||||||
|
|
||||||
|
if [[ "$driver" == "2k" ]]; then
|
||||||
|
printf '%s\n' '"UserPreferencesMask"=hex:9c,32,00,80'
|
||||||
|
else
|
||||||
|
printf '%s\n' '"UserPreferencesMask"=hex:9c,32,07,80'
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' \
|
||||||
'' \
|
'' \
|
||||||
'[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]' \
|
'[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics]' \
|
||||||
'"MinAnimate"="0"' \
|
'"MinAnimate"="0"' \
|
||||||
@@ -1001,34 +1008,6 @@ appendRegistry() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
writeNT5Effects() {
|
|
||||||
|
|
||||||
local dir="$1"
|
|
||||||
local target="$dir/\$OEM\$/effects.inf"
|
|
||||||
|
|
||||||
{
|
|
||||||
printf '%s\n' \
|
|
||||||
'[Version]' \
|
|
||||||
"Signature=\"\$CHICAGO\$\"" \
|
|
||||||
'' \
|
|
||||||
'[DefaultInstall]' \
|
|
||||||
'BitReg=DisableAnimations' \
|
|
||||||
'' \
|
|
||||||
'[DisableAnimations]' \
|
|
||||||
'; Fade or slide menus into view' \
|
|
||||||
'HKCU,"Control Panel\Desktop","UserPreferencesMask",0,0x02,0' \
|
|
||||||
'' \
|
|
||||||
'; Fade out menu items after clicking' \
|
|
||||||
'HKCU,"Control Panel\Desktop","UserPreferencesMask",0,0x04,1' \
|
|
||||||
'' \
|
|
||||||
'; Fade or slide ToolTips into view' \
|
|
||||||
'HKCU,"Control Panel\Desktop","UserPreferencesMask",0,0x08,1' \
|
|
||||||
''
|
|
||||||
} | unix2dos > "$target" || return 1
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
writeVBS() {
|
writeVBS() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
@@ -1128,7 +1107,6 @@ writeVBS() {
|
|||||||
printf '%s\n' \
|
printf '%s\n' \
|
||||||
'[COMMANDS]' \
|
'[COMMANDS]' \
|
||||||
'"REGEDIT /s install.reg"' \
|
'"REGEDIT /s install.reg"' \
|
||||||
'"RUNDLL32.EXE setupapi.dll,InstallHinfSection DefaultInstall 128 effects.inf"' \
|
|
||||||
'"Wscript install.vbs"' \
|
'"Wscript install.vbs"' \
|
||||||
''
|
''
|
||||||
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt" || return 1
|
} | unix2dos > "$dir/\$OEM\$/cmdlines.txt" || return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user