You can find the answer in Chapter 6.8, "Application Programming for Microsoft Windows."
Getting a sense of self
Sometimes you may need to get a real handle for the flow instead of a pseudo descriptor. By "real" is meant a descriptor that uniquely identifies a unique stream. Examine the following code:
DWORD WINAPI ParentThread(PVOID pvParam) {
HANDLE hThreadParent = GetCurrentThread();
CreateThread(NULL, 0, ChildThread, (PVOID) hThreadParent, 0, NULL);
}
DWORD WINAPI ChildThread(PVOID pvParam) {
HANDLE hThreadParent = (HANDLE) pvParam;
FILETIME ftCreationTime, ftExitTime, ftKernelTime, ftUserTime;
GetThreadTimes(hThreadParent,
&ftCreationTime, &ftExitTime, &ftKernelTime, &ftUserTime);
}
? , , . , -, . , - GetThreadTimes, - , . , - , , .
, - . DuplicateHandle ( 3)