Pin the whole SharedBlock layout with static_asserts (ABI tripwire)
The cross-process block's layout is a wire protocol shared by the x64 host and the x86 hook, but only three front offsets were asserted, and hook_selftest's dump_layout merely printed the rest. A field reordered/resized inside HookStatus (which precedes control/video/mkb) would silently shift everything with no compile-time tripwire and, if the developer forgot to bump kProtocolVersion, ship a silent host<->DLL mismatch. - protocol.hpp now static_asserts sizeof(SharedBlock) and every sub-channel offset (status/control/video/mkb) plus each sub-struct size (HookStatus/HookControl/ VideoShare/AudioStreamInfo/HookEntry/MkbRing). protocol.hpp is compiled for both arches, so a cross-bitness divergence fails to compile on the one that disagrees. - hook_selftest's dump_layout now ASSERTS the same numbers instead of only printing, so hook_selftest_x86 confirms the x86 layout at runtime too. Verified: x64 and x86 builds both compile (identical layout) and both selftests pass; sizeof(SharedBlock)=3936 on both. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -114,8 +114,6 @@ From an in-depth review pass. Each item is fixed test-first (a failing test, the
|
||||
as its own commit; "verify" items are confirmed real before any change, and dropped if not.
|
||||
|
||||
Cross-process / ABI:
|
||||
- **Tie `kProtocolVersion` to the layout** — `static_assert` `sizeof(SharedBlock)` + the full offset
|
||||
set, and make `hook_selftest`'s `dump_layout` assert instead of only printing.
|
||||
- **`log_ring` torn-text window** — verify the MPSC overwrite race; fix or bound it.
|
||||
- **`narrow`/`widen` not inverse** — make the audio-override name round-trip lossless (or document).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user