Search code examples
windows64-bit32-bit32bit-64bithandle

Can Windows handle inheritance cross the 32-bit/64-bit boundary?


Is it possible for a child process to inherit a handle from its parent process if one process is 32-bit and the other is 64-bit?

HANDLE is a 64 bit type on Win64 and a 32 bit type on Win32, which suggests that even it were supposed to be possible in all cases, there would be some cases where it would fail: a 64-bit parent process, a 32-bit child process, and a handle that can't be represented in 32 bits.

Or is naming the object the only way for a 32-bit process and a 64-bit process to get a handle for the same object?


Solution

  • If it is a file handle or other kernel handle, then yes.

    It just happens that although HANDLE is a 64 bit type, it can always be converted to 32 bit and back for any valid handle value.

    GDI handles cannot be inherited.