You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After looking at the code and trying to understand it for monkey patching it into the C MemoryModule code I got to thinking about this:
Using __declspec(naked) for the 32-Bit version of the code for when _WIN32 is defined AND_WIN64 is not defined (probably could also trap ARM64 version of Windows perhaps as well if it is not similar to _WIN64's asm code).
Using __declspec(naked) for the 64-Bit version of the code for when _WIN64 is defined.
Why is this better?
Unlike patterns which could break code because they are fragile and require the debugging symbols for windows to find the updated version of this function's asm code, why not just embed the asm code for a known working version that is windows version gated, Also bonus if this same code could be invoked from C and with that able to be copy-pasted into the C MemoryModule for use in py2exe to add back in support for loading the Python Core dll in Python 3.12+ (3.12, 3.13, 3.14, ...).
Why do I need this?
Because the Python Core Developers decided it was a good idea to migrate a few things to __declspec(thread) with no other workaround but have proper TLS support and this means implementing a version of LdrpHandleTlsData safely without relying on possibly calling into arbitrary code in ntdll.dll that might not be the actual function anymore on each Windows update since the found signature from here. One can only get lucky a certain amount of times.
After looking at the code and trying to understand it for monkey patching it into the C MemoryModule code I got to thinking about this:
__declspec(naked)
for the 32-Bit version of the code for when_WIN32
is defined AND_WIN64
is not defined (probably could also trap ARM64 version of Windows perhaps as well if it is not similar to_WIN64
's asm code).__declspec(naked)
for the 64-Bit version of the code for when_WIN64
is defined.Why is this better?
Unlike patterns which could break code because they are fragile and require the debugging symbols for windows to find the updated version of this function's asm code, why not just embed the asm code for a known working version that is windows version gated, Also bonus if this same code could be invoked from C and with that able to be copy-pasted into the C MemoryModule for use in py2exe to add back in support for loading the Python Core dll in Python 3.12+ (3.12, 3.13, 3.14, ...).
Why do I need this?
Because the Python Core Developers decided it was a good idea to migrate a few things to
__declspec(thread)
with no other workaround but have proper TLS support and this means implementing a version ofLdrpHandleTlsData
safely without relying on possibly calling into arbitrary code in ntdll.dll that might not be the actual function anymore on each Windows update since the found signature from here. One can only get lucky a certain amount of times.Links:
py2exe/py2exe#191
bb107/MemoryModulePP#51
The text was updated successfully, but these errors were encountered: