This commit is contained in:
KingKDot
2026-04-15 20:20:14 -05:00
parent 20b0bbc7d6
commit 3761579d93
3 changed files with 12 additions and 7 deletions
@@ -0,0 +1,6 @@
//go:build windows && amd64
package teb
// CurrentTEB returns the address of the current thread's Thread Environment Block.
func CurrentTEB() uintptr
@@ -0,0 +1,9 @@
#include "textflag.h"
// func CurrentTEB() uintptr
TEXT ·CurrentTEB(SB),NOSPLIT,$0-8
// mov rax, gs:[0x30] — read the TEB self-pointer
BYTE $0x65; BYTE $0x48; BYTE $0x8B; BYTE $0x04; BYTE $0x25
LONG $0x00000030
MOVQ AX, ret+0(FP)
RET