如果不想写汇编的可以用这个
PPEB NTAPI RtlGetCurrentPeb();
PPEB Peb=RtlGetCurrentPeb();
其汇编就是:
ntdll!RtlGetCurrentPeb:
7c97efa9 64a118000000 mov eax,dword ptr fs:[00000018h]
7c97efaf 8b4030 mov eax,dword ptr [eax+30h]
7c97efb2 c3 ret
FS:[0x18]指向TEB本身
来来,万能的windbg:
0:000> dd fs:[0x18] L1
0053:00000018 7efdd000
0:000> r $teb
$teb=7efdd000
0:000> dt _TEB -y ProcessEnvironmentBlock @$teb
test1!_TEB
+0x030 ProcessEnvironmentBlock : 0x7efde000 _PEB