UnofficialCrusaderPatch / UnofficialCrusaderPatch3

Development for the dll Injection approach
GNU General Public License v3.0
12 stars 2 forks source link

Crash in module zips with dlls when static local variables are used. #57

Closed gynt closed 1 year ago

gynt commented 1 year ago

Not exactly sure why it crashes, might have to do with this: Issue 31 of fancycode/MemoryModule

This might solve it bb107/MemoryModulePP

If we run into this issue in the future again, it might be useful to consider an alternative for module zips with dlls. I think the best solution is to make one dll instead of a zip containing a dll. That lua-supported dll will then have a luaopen_. Then AV's are happy because they can scan the dll whenever they want to. The dll will have the .lua files packed inside it (like I programmed before and how it is currently written too). The major disadvantage is that we need a different setup for Devs... which is what I really want to avoid to be honest.

gynt commented 1 year ago

Can be resolved by removing thread safe local static variable initialisation.

Basically, MemoryModule does not support the Thread Local Storage (TLS).

Note that this means the programmer is responsible for writing thread safe initialisation code, but since we are doing a single threaded model (lua is single threaded too), this shouldn't be a big deal.

gynt commented 1 year ago

Solved by 25d0e5c