Ohad Horesh
Ohad Horesh

Reputation: 4390

Thread information block under x64

I need to get the max and min stack from the the TIB on x64 platform (I know that I need to replace the FS register with the GS register.) On x86 platform I can use this table and find the correct offset
Do you know where I can find the table for x64 platform?

Upvotes: 2

Views: 1314

Answers (1)

Igor Skochinsky
Igor Skochinsky

Reputation: 25318

Here's a program that works on x86 and x64.

#include <windows.h>
#include <stdio.h>

void main()
{
  PNT_TIB ptib = (PNT_TIB)NtCurrentTeb();
#ifdef _AMD64_
  printf("Stack base: %08I64X, limit: %08I64X\n",
    ptib->StackBase, ptib->StackLimit);
#else
  printf("Stack base: %08X, limit: %08X\n",
    ptib->StackBase, ptib->StackLimit);
#endif
}

Upvotes: 4

Related Questions