Skip to content

TLS无法正确处理 #8

Description

@pig4210

VS2015 及以上版本编译的 DLL ,使用你的工具注入,可能会发生崩溃。
虽然你处理了 TLS ,但仍然是无用的。
经调试发现,正常 LoadLibrary 注入的 DLL ,TlsIndex 值不为 0 。 而工具注入的 TlsIndex 值为 0 ,这其实是错误的。这导致所有的 static 变量无法被初始化。
注意: TlsIndex 只有在主模块中才可以为 0 ,其他所有 DLL 有各自不同的,非零值的 TlsIndex 。
这个问题目前看来,只能在 DLL 编译时,加入 /Zc:threadSafeInit- 解决。但这样,static 变量将非线程安全。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions