Commit Graph

2 Commits

Author SHA1 Message Date
5620a444ad Runtime: review fixes for DisableThreadLibraryCalls
- the DisableThreadLibraryCalls table entry gets its own continued line (it
  shared FreeLibrary's, 231 columns wide), and its comment is wrapped to 120;
- dll_thread_calls_test also calls the shim with a shim pseudo-handle (the
  handle GetModuleHandleA("xmem.dll") returns), which the Windows function
  would refuse: removing the pseudo(module) branch now fails the test.
  xmem.cpp is linked into the test only to give the shims a module to own.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 18:23:23 +01:00
4c9d995b26 Runtime: DisableThreadLibraryCalls from a mapped DllMain succeeds
The real DisableThreadLibraryCalls only accepts a module the Windows loader
mapped, so for a manually mapped image it returned FALSE. A DllMain that
returns its result (the MSVC runtime's msvcp140_1, msvcp140_2,
msvcp140_atomic_wait and msvcp140_codecvt_ids DLLs do) then made
Loader::initialise() throw "DllMain returned FALSE".

shims/library_loader.cpp serves the call next to FreeLibrary: TRUE for a
module the shims own or the loader mapped, the real function for any other
handle. New dll_thread_calls_test (CRT-free fixture DLL) fails on main and
passes with this change; docs/runtime_imports.md counts follow.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 17:52:04 +01:00