Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. Thread.c
  5. Abstract:
  6. This module defines private types and macros for use in implementing
  7. a portable thread ID interface.
  8. Author:
  9. John Rogers (JohnRo) 14-Jan-1992
  10. Environment:
  11. User Mode - Win32
  12. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  13. Requires ANSI C extensions: slash-slash comments, long external names.
  14. Revision History:
  15. 14-Jan-1992 JohnRo
  16. Created.
  17. --*/
  18. // These must be included first:
  19. #include <nt.h> // IN, VOID, NtCurrentTeb(), etc.
  20. #include <windef.h> // DWORD.
  21. // These may be included in any order:
  22. #include <netdebug.h> // NetpAssert(), NetpKdPrint(()), etc.
  23. #include <thread.h> // NET_THREAD_ID, NetpCurrentThread().
  24. NET_THREAD_ID
  25. NetpCurrentThread(
  26. VOID
  27. )
  28. {
  29. PTEB currentTeb;
  30. NET_THREAD_ID currentThread;
  31. currentTeb = NtCurrentTeb( );
  32. NetpAssert( currentTeb != NULL );
  33. currentThread = (NET_THREAD_ID) currentTeb->ClientId.UniqueThread;
  34. NetpAssert( currentThread != (NET_THREAD_ID) 0 );
  35. return (currentThread);
  36. } // NetpCurrentThread