Re: WOW64 bug: GetThreadContext() may return stale contents
Johannes Totz <
jtotz@...>
2010-12-28 19:19:38 GMT
Maybe a warning for the developer is appropriate?
# HG changeset patch
# User jtotz <at> ic.ac.uk
# Date 1292903539 0
# Node ID 51f8c8179ecfb377f9f4612523964e075fecf88b
# Parent eeae26f5449fed2805489da4c08e26ff412121cc
warning message when running under wow64
wow64 has a design flaw that make thread contexts invalid thus breaking the gc
diff -r eeae26f5449f -r 51f8c8179ecf win32_threads.c
--- a/win32_threads.c Fri Oct 22 14:58:44 2010 +0100
+++ b/win32_threads.c Tue Dec 21 03:52:19 2010 +0000
<at> <at> -2571,6 +2571,33 <at> <at>
# endif
static int entry_count = 0;
+#ifdef GC_DEBUG
+#ifndef _WIN64
+ if (reason == DLL_PROCESS_ATTACH)
+ {
+ // wow64: running 32-bit-gc on 64-bit-sys is broken!
+ // code copied from msdn docs example
+ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
+ LPFN_ISWOW64PROCESS fnIsWow64Process = 0;
+ fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandleA("kernel32"), "IsWow64Process");
+ if (NULL != fnIsWow64Process)
+ {
+ BOOL bIsWow64 = FALSE;
(Continue reading)