From 07fe70f5ba623dc16773e6598afccc0015974204 Mon Sep 17 00:00:00 2001 From: Nguyen Ha Dong <7856975+dongnh@users.noreply.github.com> Date: Tue, 3 Nov 2026 16:21:59 +0700 Subject: [PATCH] Add VeriSign's G5 root to game prefixes Valve signed older steam_api64.dll builds with a VeriSign Class 3 Code Signing 2010 CA certificate that chains to VeriSign Class 3 Public Primary Certification Authority - G5. macOS 27 no longer ships that root, and Wine fills its root store from the host, so WinVerifyTrust on those DLLs fails with CERT_E_UNTRUSTEDROOT. Metal Gear Solid V: The Phantom Pain checks its steam_api64.dll this way and quits before loading steamclient64.dll. Write the root into the prefix's Root store in the settings import when it is missing. Wine only drops roots it imported from the host, so it stays. Co-Authored-By: Claude Opus 5.5 --- dylib/feats/compat_run.sh | 64 +++++++++++++++++++++++++++++++++++- dylib/tests/settingscheck.sh | 14 +++++++- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/dylib/feats/compat_run.sh b/dylib/feats/compat_run.sh index a5a76c5d..0d77cf02 100755 --- a/dylib/feats/compat_run.sh +++ b/dylib/feats/compat_run.sh @@ -1752,6 +1752,68 @@ winebus_lines() { printf '%s\r\n' '[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\WineBus]' "$hidraw_value" '' } +# Valve signed old steam_api64.dll builds under VeriSign's G5 root, which macOS no longer ships. +# Games that check that signature, like Metal Gear Solid V, quit at start without it. +verisign_g5_lines() { + ! grep -qF '[Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5]' \ + "$WINEPREFIX/system.reg" 2>/dev/null || return 0 + printf '%s\r\n' \ + '[HKEY_LOCAL_MACHINE\Software\Microsoft\SystemCertificates\Root\Certificates\4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5]' \ + '"Blob"=hex:03,00,00,00,01,00,00,00,14,00,00,00,4e,b6,d5,78,49,9b,1c,cf,5f,58,\' \ + ' 1e,ad,56,be,3d,9b,67,44,a5,e5,20,00,00,00,01,00,00,00,d7,04,00,00,30,82,04,\' \ + ' d3,30,82,03,bb,a0,03,02,01,02,02,10,18,da,d1,9e,26,7d,e8,bb,4a,21,58,cd,cc,\' \ + ' 6b,3b,4a,30,0d,06,09,2a,86,48,86,f7,0d,01,01,05,05,00,30,81,ca,31,0b,30,09,\' \ + ' 06,03,55,04,06,13,02,55,53,31,17,30,15,06,03,55,04,0a,13,0e,56,65,72,69,53,\' \ + ' 69,67,6e,2c,20,49,6e,63,2e,31,1f,30,1d,06,03,55,04,0b,13,16,56,65,72,69,53,\' \ + ' 69,67,6e,20,54,72,75,73,74,20,4e,65,74,77,6f,72,6b,31,3a,30,38,06,03,55,04,\' \ + ' 0b,13,31,28,63,29,20,32,30,30,36,20,56,65,72,69,53,69,67,6e,2c,20,49,6e,63,\' \ + ' 2e,20,2d,20,46,6f,72,20,61,75,74,68,6f,72,69,7a,65,64,20,75,73,65,20,6f,6e,\' \ + ' 6c,79,31,45,30,43,06,03,55,04,03,13,3c,56,65,72,69,53,69,67,6e,20,43,6c,61,\' \ + ' 73,73,20,33,20,50,75,62,6c,69,63,20,50,72,69,6d,61,72,79,20,43,65,72,74,69,\' \ + ' 66,69,63,61,74,69,6f,6e,20,41,75,74,68,6f,72,69,74,79,20,2d,20,47,35,30,1e,\' \ + ' 17,0d,30,36,31,31,30,38,30,30,30,30,30,30,5a,17,0d,33,36,30,37,31,36,32,33,\' \ + ' 35,39,35,39,5a,30,81,ca,31,0b,30,09,06,03,55,04,06,13,02,55,53,31,17,30,15,\' \ + ' 06,03,55,04,0a,13,0e,56,65,72,69,53,69,67,6e,2c,20,49,6e,63,2e,31,1f,30,1d,\' \ + ' 06,03,55,04,0b,13,16,56,65,72,69,53,69,67,6e,20,54,72,75,73,74,20,4e,65,74,\' \ + ' 77,6f,72,6b,31,3a,30,38,06,03,55,04,0b,13,31,28,63,29,20,32,30,30,36,20,56,\' \ + ' 65,72,69,53,69,67,6e,2c,20,49,6e,63,2e,20,2d,20,46,6f,72,20,61,75,74,68,6f,\' \ + ' 72,69,7a,65,64,20,75,73,65,20,6f,6e,6c,79,31,45,30,43,06,03,55,04,03,13,3c,\' \ + ' 56,65,72,69,53,69,67,6e,20,43,6c,61,73,73,20,33,20,50,75,62,6c,69,63,20,50,\' \ + ' 72,69,6d,61,72,79,20,43,65,72,74,69,66,69,63,61,74,69,6f,6e,20,41,75,74,68,\' \ + ' 6f,72,69,74,79,20,2d,20,47,35,30,82,01,22,30,0d,06,09,2a,86,48,86,f7,0d,01,\' \ + ' 01,01,05,00,03,82,01,0f,00,30,82,01,0a,02,82,01,01,00,af,24,08,08,29,7a,35,\' \ + ' 9e,60,0c,aa,e7,4b,3b,4e,dc,7c,bc,3c,45,1c,bb,2b,e0,fe,29,02,f9,57,08,a3,64,\' \ + ' 85,15,27,f5,f1,ad,c8,31,89,5d,22,e8,2a,aa,a6,42,b3,8f,f8,b9,55,b7,b1,b7,4b,\' \ + ' b3,fe,8f,7e,07,57,ec,ef,43,db,66,62,15,61,cf,60,0d,a4,d8,de,f8,e0,c3,62,08,\' \ + ' 3d,54,13,eb,49,ca,59,54,85,26,e5,2b,8f,1b,9f,eb,f5,a1,91,c2,33,49,d8,43,63,\' \ + ' 6a,52,4b,d2,8f,e8,70,51,4d,d1,89,69,7b,c7,70,f6,b3,dc,12,74,db,7b,5d,4b,56,\' \ + ' d3,96,bf,15,77,a1,b0,f4,a2,25,f2,af,1c,92,67,18,e5,f4,06,04,ef,90,b9,e4,00,\' \ + ' e4,dd,3a,b5,19,ff,02,ba,f4,3c,ee,e0,8b,eb,37,8b,ec,f4,d7,ac,f2,f6,f0,3d,af,\' \ + ' dd,75,91,33,19,1d,1c,40,cb,74,24,19,21,93,d9,14,fe,ac,2a,52,c7,8f,d5,04,49,\' \ + ' e4,8d,63,47,88,3c,69,83,cb,fe,47,bd,2b,7e,4f,c5,95,ae,0e,9d,d4,d1,43,c0,67,\' \ + ' 73,e3,14,08,7e,e5,3f,9f,73,b8,33,0a,cf,5d,3f,34,87,96,8a,ee,53,e8,25,15,02,\' \ + ' 03,01,00,01,a3,81,b2,30,81,af,30,0f,06,03,55,1d,13,01,01,ff,04,05,30,03,01,\' \ + ' 01,ff,30,0e,06,03,55,1d,0f,01,01,ff,04,04,03,02,01,06,30,6d,06,08,2b,06,01,\' \ + ' 05,05,07,01,0c,04,61,30,5f,a1,5d,a0,5b,30,59,30,57,30,55,16,09,69,6d,61,67,\' \ + ' 65,2f,67,69,66,30,21,30,1f,30,07,06,05,2b,0e,03,02,1a,04,14,8f,e5,d3,1a,86,\' \ + ' ac,8d,8e,6b,c3,cf,80,6a,d4,48,18,2c,7b,19,2e,30,25,16,23,68,74,74,70,3a,2f,\' \ + ' 2f,6c,6f,67,6f,2e,76,65,72,69,73,69,67,6e,2e,63,6f,6d,2f,76,73,6c,6f,67,6f,\' \ + ' 2e,67,69,66,30,1d,06,03,55,1d,0e,04,16,04,14,7f,d3,65,a7,c2,dd,ec,bb,f0,30,\' \ + ' 09,f3,43,39,fa,02,af,33,31,33,30,0d,06,09,2a,86,48,86,f7,0d,01,01,05,05,00,\' \ + ' 03,82,01,01,00,93,24,4a,30,5f,62,cf,d8,1a,98,2f,3d,ea,dc,99,2d,bd,77,f6,a5,\' \ + ' 79,22,38,ec,c4,a7,a0,78,12,ad,62,0e,45,70,64,c5,e7,97,66,2d,98,09,7e,5f,af,\' \ + ' d6,cc,28,65,f2,01,aa,08,1a,47,de,f9,f9,7c,92,5a,08,69,20,0d,d9,3e,6d,6e,3c,\' \ + ' 0d,6e,d8,e6,06,91,40,18,b9,f8,c1,ed,df,db,41,aa,e0,96,20,c9,cd,64,15,38,81,\' \ + ' c9,94,ee,a2,84,29,0b,13,6f,8e,db,0c,dd,25,02,db,a4,8b,19,44,d2,41,7a,05,69,\' \ + ' 4a,58,4f,60,ca,7e,82,6a,0b,02,aa,25,17,39,b5,db,7f,e7,84,65,2a,95,8a,bd,86,\' \ + ' de,5e,81,16,83,2d,10,cc,de,fd,a8,82,2a,6d,28,1f,0d,0b,c4,e5,e7,1a,26,19,e1,\' \ + ' f4,11,6f,10,b5,95,fc,e7,42,05,32,db,ce,9d,51,5e,28,b6,9e,85,d3,5b,ef,a5,7d,\' \ + ' 45,40,72,8e,b7,0e,6b,0e,06,fb,33,35,48,71,b8,9d,27,8b,c4,65,5f,0d,86,76,9c,\' \ + ' 44,7a,f6,95,5c,f6,5d,32,08,33,a4,54,b6,18,3f,68,5c,f2,42,4a,85,38,54,83,5f,\' \ + ' d1,e8,2c,f2,ac,11,d6,a8,ed,63,6a' \ + '' +} + # High Resolution doubles LogPixels and turning it off halves it plan_logpixels() { dpi_value="" @@ -1896,7 +1958,7 @@ import_prefix_settings() { '[HKEY_LOCAL_MACHINE\Software\Classes\steam\shell\open\command]' \ '@="\"C:\\Program Files (x86)\\Steam\\steam.exe\" \"%1\""' '' \ && hidraw_lines add "$controllers_add" && hidraw_lines remove "$controllers_remove" \ - && winebus_lines; } \ + && winebus_lines && verisign_g5_lines; } \ > "$settings_file" 2>/dev/null; then [ -z "$settings_file" ] || rm -f "$settings_file" echo "=== could not write the prefix settings, launching without them ===" >> "$log" 2>&1 || true diff --git a/dylib/tests/settingscheck.sh b/dylib/tests/settingscheck.sh index d2d50b88..d6b6f6b3 100644 --- a/dylib/tests/settingscheck.sh +++ b/dylib/tests/settingscheck.sh @@ -10,7 +10,7 @@ wrapper=$(sed -n '/^without_lock_fds() {$/,/^}$/p' "$SRC") [ -n "$wrapper" ] || { echo "FAIL: without_lock_fds not found in $SRC"; exit 1; } helpers="" for helper in controller_ids ids_without hidraw_lines write_owned_controllers plan_hidden_controllers \ - plan_disable_hidraw winebus_lines plan_logpixels video_lines prefix_up_to_date \ + plan_disable_hidraw winebus_lines verisign_g5_lines plan_logpixels video_lines prefix_up_to_date \ settings_already_applied; do part=$(sed -n "/^$helper() {\$/,/^}\$/p" "$SRC") [ -n "$part" ] || { echo "FAIL: $helper not found in $SRC"; exit 1; } @@ -57,10 +57,12 @@ bad() { printf ' FAIL %s\n want [%s]\n got [%s]\n' "$1" "$2" is() { if [ "$2" = "$3" ]; then ok "$1"; else bad "$1" "$2" "$3"; fi; } same_file() { if cmp -s "$2" "$3"; then ok "$1"; else bad "$1" "contents of ${2##*/}" "$(cat -v "$3" 2>/dev/null)"; fi; } +g5_key='[Software\\Microsoft\\SystemCertificates\\Root\\Certificates\\4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5]' case_dir="" new_case() { case_dir=$(mktemp -d "$work/case.XXXXXX") mkdir -p "$case_dir/pfx/drive_c" + printf '%s\n' "$g5_key 1791230000" '' > "$case_dir/pfx/system.reg" : > "$case_dir/calls" : > "$case_dir/log" } @@ -68,6 +70,7 @@ in_registry() { for id in "$@"; do printf '%s\n' "[System\\\\ControlSet001\\\\Services\\\\winebus\\\\Devices\\\\$id] 1791230000" '"Hidraw"=dword:00000000' '' done > "$case_dir/pfx/system.reg" + printf '%s\n' "$g5_key 1791230000" '' >> "$case_dir/pfx/system.reg" } launch() { new_case @@ -341,6 +344,15 @@ is "the same value under HKEY_LOCAL_MACHINE is not" import \ "$(check '[HKEY_LOCAL_MACHINE\Software\Wine\WineDbg]' '"ShowCrashDialog"=dword:00000000')" unset CX_ROOT +echo "== VeriSign G5 root" +launch "" 0 +is "a prefix that has the root does not get it again" 0 "$(grep -c 4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5 "$case_dir/imported")" +new_case +rm "$case_dir/pfx/system.reg" +run_in "" 0 +is "a prefix without the root gets it in the same import" 1 \ + "$(grep -cF '[HKEY_LOCAL_MACHINE\Software\Microsoft\SystemCertificates\Root\Certificates\4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5]' "$case_dir/imported")" + if [ "$fails" -eq 0 ]; then echo "==> settingscheck: all assertions hold" else