[Gc] GC + Windows Mobile + Threads + Patch for WINCE

Henning Makholm makholm at octoshape.com
Fri Aug 21 10:55:53 PDT 2009

> Hmm, MSDN says: This identifier is also the handle of the thread.
> If I understood this correctly, handle = (HANDLE)GetCurrentThreadId()
> on WinCE (I guess it won't work  for 64-bit embedded devices ;) ).

Why not / who knows?

HANDLE is typedeffed to void* for reasons of backwards source
compatibility, but handle values are not actually pointeres in
modern versions of Windows -- they are essentially indices into
indirection tables in the kernel.

It would be perfectly possible for 64-bit Windows CE to arrange
for its thread handles (or, for that matter, all kernel handles)
to have the high 32 bits be all zeros.

(If they were actual pointers to kernel-space structures,
you still wouldn't want the kernel to just access memory through
a pointer passed from untrusted user-mode code vithout validating
it, and validation would be much more complex than just a table
lookup anyway).

Henning Makholm
Octoshape ApS

More information about the Gc mailing list