From 11d33efd04bdf6837277e43f85f8062cef7e02ab Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 23 Jun 2026 23:07:55 +0000 Subject: [PATCH] =?UTF-8?q?fix(kyber-linux):=20fix=20cmd=20shim=20compile?= =?UTF-8?q?=20=E2=80=94=20replace=20=5Fwcsicmp=20with=20CompareStringOrdin?= =?UTF-8?q?al?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _wcsicmp is a CRT function unavailable with -nostdlib/-ffreestanding. Replace with CompareStringOrdinal from kernel32 (always available). Also fix step numbering (1-2 were still labeled /5 instead of /7), and remove 2>/dev/null from compile so errors are visible if it fails. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01D8ckUJQtj1pH8jtAddBDZs --- scripts/setup-kyber-linux.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/setup-kyber-linux.sh b/scripts/setup-kyber-linux.sh index ea90389..10b3ccf 100755 --- a/scripts/setup-kyber-linux.sh +++ b/scripts/setup-kyber-linux.sh @@ -154,7 +154,7 @@ fi # ── Build Kyber Wine prefix and run the installer ────────────────────────── echo "" -echo "[1/5] Installing Kyber into Wine prefix..." +echo "[1/7] Installing Kyber into Wine prefix..." KYBER_PFX="$STEAM_HOME/steamapps/compatdata/$KYBER_COMPAT_ID" @@ -201,7 +201,7 @@ echo " Windows path: $KYBER_EXE_WIN" # ── Ensure WebView2 Evergreen runtime is installed ───────────────────────── echo "" -echo "[2/5] Verifying WebView2 runtime in the Kyber prefix..." +echo "[2/7] Verifying WebView2 runtime in the Kyber prefix..." # The Evergreen runtime lives here once installed. WV2_FOUND=$(find "$KYBER_PFX/pfx/drive_c" -iname "msedgewebview2.exe" 2>/dev/null | head -1) @@ -280,6 +280,10 @@ else SHIM_EXE="/tmp/kyber_cmd_shim_$$.exe" cat > "$SHIM_C" << 'CEOF' #include +/* ieq: case-insensitive wide string compare using only kernel32 */ +static int ieq(LPCWSTR a, LPCWSTR b) { + return CompareStringOrdinal(a, -1, b, -1, TRUE) == 2; /* CSTR_EQUAL==2 */ +} static void write_url(LPCWSTR url) { HANDLE h = CreateFileW(L"C:\\kyber_oauth_url.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); @@ -295,8 +299,7 @@ int WINAPI mainCRTStartup(void) { int argc; LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc); for (int i = 1; i < argc - 1; i++) { - if (_wcsicmp(argv[i], L"/c") == 0 && - _wcsicmp(argv[i+1], L"start") == 0) { + if (ieq(argv[i], L"/c") && ieq(argv[i+1], L"start")) { for (int j = i+2; j < argc; j++) { if (argv[j][0] == L'h' || argv[j][0] == L'H') { write_url(argv[j]); @@ -324,7 +327,7 @@ int WINAPI mainCRTStartup(void) { CEOF x86_64-w64-mingw32-gcc -O2 -ffreestanding -nostdlib \ -e mainCRTStartup -o "$SHIM_EXE" "$SHIM_C" \ - -lkernel32 -lshell32 2>/dev/null \ + -lkernel32 -lshell32 \ && cp "$CMD_SHIM" "$CMD_REAL" \ && cp "$SHIM_EXE" "$CMD_SHIM" \ && echo " cmd shim installed." \