Context hook with includeLength < 0
help wanted
https://github.com/alandtse/CommonLibVR/blob/ng/include/SKSE/ContextHook.h may have a bug per meh (the author of the original code)
```
basically if you have a_includeSize < 0 then the code is included after the stub (to use your terminology), but if you modify RIP in the function delegate then it will not work properly with restore context
what i did in .net to fix this is to keep a stack of executing hooks in TLS and i could store some extra data there so basically the RIP (or return address) was instead stored there and then fixup the context with fake return to includeLength < 0 and then after that the jump back i take the actual return address from TLS
i don't know how to fix this here now without using TLS and a major rewrite, just letting you know
yeah it will be quite difficult to fix because the RIP must show to user as correct return address while internally it's instead the address to included code or jump back, and then the jump back uses the RIP, but we can't use stack because the includeLength or function delegate may modify stack, so i did this using TLS in .net, but here i dno unless you also want to use TLS and store all executing hooks (can be recursive or nested)
```
0 条评论