I’m trying to port some code to 64-bit, but it seems that the thread address identifier in _beginthreadex is unsigned int which is 32-bits and I can’t pass/receive a 64-bit address identifier from the function:
uintptr_t _beginthreadex( // NATIVE CODE
void *security,
unsigned stack_size,
unsigned ( __stdcall *start_address )( void * ),
void *arglist,
unsigned initflag,
unsigned *thrdaddr // <-- 32-bit address
);
I checked the MSDN documentation, but I didn’t see a 64-bit version of the function. Am I including the wrong header, per-processor flag or is there some other way to create a thread with a 64-bit address identifier?
Update
The documentation states that the thrdaddr parameter is 32-bit:
Thrdaddr
Points to a 32-bit variable that receives the thread identifier. Might be NULL, in which case it is not used.
The
thrdaddrparameter receives the thread ID. It is not the address of the thread function. It appears to be an exceedingly badly named parameter.The
start_addressparameter is the thread function pointer and you can pass your 64 bit function pointer in that parameter.Your update to the question suggests that you believe that the thread ID is a 64 bit value on 64 bit Windows. That is a mis-think. Thread IDs are 32 bit values on all flavours of Windows.