Rebased and stress-tested this with a few injection and hooking frameworks inter- and intra-process and this behaves always correctly together with https://gitlab.winehq.org/wine/wine/-/merge_requests/5222 and is much faster (around 2x) than the current implementation.