c - What is the size of HANDLE? -
for exercise, @ startupinfo
structure. can see last 3 elements has type handle
.
so want know size handle
has. know size of handle
?
the windows handle
type isn't opaque type. windows defines couple of properties can depend on. main 1 answer your question: of type void *
. windows data types entry on msdn:
handle
a handle object.
this type declared in winnt.h follows:
typedef pvoid handle;
later on in table can see pvoid
defined void *
.
so handle
has same size void *
. or in other words, it's 32 bits when using 32-bit compiler , 64 bits when using 64-bit compiler. shouldn't need hard code either of these values in code, instead use sizeof(handle)
.
the other property of windows handle
type obscure, , barely documented: kernel handles the bottom 2 bits zero. shouldn't need depend on in code, , can see never want to. mention completeness , emphasize how microsoft has defined handle
more internal implementation detail.
Comments
Post a Comment