diff options
| author | andretuta <andreviniciusmerlia@gmail.com> | 2026-11-24 00:53:14 -0300 |
|---|---|---|
| committer | andretuta <andreviniciusmerlia@gmail.com> | 2026-11-24 00:53:14 -0300 |
| commit | 9b59db02f974edc453bab4c2bf69e52f87447ebf (patch) | |
| tree | 20d377a3937b26b3a8a3d4a2c27dd4effc369c3b /docs | |
| parent | f9e7e3e1bfa718eb4d8ca84fd1dbe617038d48d7 (diff) | |
ws2_offline: add offline loopback-only Winsock2 (ws2_32.dll) shim (RT-WS2-OFFLINE)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/boot.md | 5 | ||||
| -rw-r--r-- | docs/runtime_imports.md | 21 |
2 files changed, 24 insertions, 2 deletions
diff --git a/docs/boot.md b/docs/boot.md index 7ec69f031..398caf731 100644 --- a/docs/boot.md +++ b/docs/boot.md | |||
| @@ -5,8 +5,9 @@ repository's test corpus does not contain `game_scarlett_master.exe` (RT-5); the | |||
| 5 | separately maps it and leaves 30 imports unimplemented, and `--init` runs its TLS callbacks and the package DLLs' | 5 | separately maps it and leaves 30 imports unimplemented, and `--init` runs its TLS callbacks and the package DLLs' |
| 6 | `DllMain`s without an exception | 6 | `DllMain`s without an exception |
| 7 | ([`runtime_imports.md`](runtime_imports.md#the-retail-executable-rt-5)), so this page is still the procedure and the | 7 | ([`runtime_imports.md`](runtime_imports.md#the-retail-executable-rt-5)), so this page is still the procedure and the |
| 8 | trace tool for the first boot. The executable's `ws2_32.dll` imports bind to the host's, so run `--run` with the | 8 | trace tool for the first boot. Outbound `ws2_32.dll` and `winhttp.dll` calls are restricted offline by the shims |
| 9 | network off. Nothing here quotes game data; a real trace stays on the player's machine. | 9 | (`ws2_offline.cpp` permits loopback only; `winhttp_offline.cpp` refuses all requests), though running with the network |
| 10 | off remains good defence in depth. Nothing here quotes game data; a real trace stays on the player's machine. | ||
| 10 | 11 | ||
| 11 | ## 1. What the first boot produces | 12 | ## 1. What the first boot produces |
| 12 | 13 | ||
diff --git a/docs/runtime_imports.md b/docs/runtime_imports.md index 7b9f62d5a..fb266b719 100644 --- a/docs/runtime_imports.md +++ b/docs/runtime_imports.md | |||
| @@ -628,6 +628,27 @@ Each refused server is logged once (`[rt] winhttp: offline, refused <host>:<port | |||
| 628 | tried to reach. `runtime/test/winhttp_offline_test.cpp` (ctest `winhttp_offline`) covers the synchronous and | 628 | tried to reach. `runtime/test/winhttp_offline_test.cpp` (ctest `winhttp_offline`) covers the synchronous and |
| 629 | asynchronous paths with `.invalid` names; it opens no connection. | 629 | asynchronous paths with `.invalid` names; it opens no connection. |
| 630 | 630 | ||
| 631 | ## Winsock2 (`ws2_32.dll`) offline | ||
| 632 | |||
| 633 | `runtime/shims/ws2_offline.cpp` intercepts outbound Winsock2 entry points — both by name and by standard Windows | ||
| 634 | `ws2_32.dll` ordinal (`bind`/`#2`, `connect`/`#4`, `sendto`/`#20`, `gethostbyaddr`/`#51`, `gethostbyname`/`#52`, | ||
| 635 | `WSAAsyncGetHostByAddr`/`#102`, `WSAAsyncGetHostByName`/`#103`, `getaddrinfo`, `GetAddrInfoW`, `GetAddrInfoExA/W`, | ||
| 636 | `getnameinfo`, `GetNameInfoW`, `WSAConnect`, `WSAConnectByNameA/W`, `WSAConnectByList`, `WSASendTo`, `WSASendMsg`, and | ||
| 637 | `WSAIoctl` for `WSAID_CONNECTEX` and `WSAID_WSASENDMSG`) — while keeping `ws2_32.dll` partially overridden so local | ||
| 638 | socket bookkeeping (`WSAStartup`, `socket`, `closesocket`, `select`, `recv`, `send`, byte-order helpers) still works | ||
| 639 | for loopback traffic: | ||
| 640 | |||
| 641 | - `connect`, `WSAConnect`, `ConnectEx`, `sendto`, `WSASendTo`, `WSASendMsg`, `WSAConnectByNameA/W` and | ||
| 642 | `WSAConnectByList` allow only IPv4 loopback (`127.0.0.0/8`), IPv6 loopback (`::1`) and IPv4-mapped loopback | ||
| 643 | (`::ffff:127.0.0.0/104`); everything else fails with `WSAENETUNREACH`. | ||
| 644 | - `bind` narrows wildcard binds (`0.0.0.0`, `::`) to loopback (`127.0.0.1`, `::1`) and refuses other non-loopback | ||
| 645 | addresses with `WSAEADDRNOTAVAIL`. | ||
| 646 | - Forward lookups refuse external names with `WSAHOST_NOT_FOUND` without sending DNS traffic; `getnameinfo` / | ||
| 647 | `GetNameInfoW` force `NI_NUMERICHOST` (or return `WSAHOST_NOT_FOUND` under `NI_NAMEREQD`) for non-loopback addresses. | ||
| 648 | |||
| 649 | `runtime/test/ws2_offline_test.cpp` (ctest `ws2_offline`) verifies name and ordinal bindings, external refusals using | ||
| 650 | RFC 5737 / RFC 3849 / `.invalid` targets, wildcard-bind narrowing, and a local loopback UDP round-trip. | ||
| 651 | |||
| 631 | ## What this proves and what it does not | 652 | ## What this proves and what it does not |
| 632 | 653 | ||
| 633 | - It proves the loader parses real Xbox Series PE files, maps their sections, applies no unnecessary relocation, | 654 | - It proves the loader parses real Xbox Series PE files, maps their sections, applies no unnecessary relocation, |