1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to get current thread ID in Native mode?

Discussion in 'Win32' started by unmeshjoshi, Apr 23, 2010.

  1. unmeshjoshi

    unmeshjoshi New Member

    Joined:
    Mar 17, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Hello all,

    Can anybody please tell me how to get current thread ID in Native application? (inside NtProcessStartup ?)
     
  2. davidk

    davidk New Member

    Joined:
    Mar 25, 2010
    Messages:
    16
    Likes Received:
    1
    Trophy Points:
    0
    Home Page:
    You need to get info from Thread Information Block (TIB).

    See 'struct NT_TIB' in winnt.h
    Current thread ID has 0x24 offset. Get it as FS:[0x24]
     
  3. unmeshjoshi

    unmeshjoshi New Member

    Joined:
    Mar 17, 2010
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Thanks a lot, it helped a lot.
    I was out of station so could not reply early.
     

Share This Page