-
-
[求助]内嵌汇编问题
-
发表于:
2009-2-18 01:47
4642
-
hi,大家好,我遇到一个问题,希望得到你们的帮助。
根据MSDN的描述:FS:[0x2C] Win9x and NT Linear address of the thread local storage array
我通过这段代码获得主线程的FS
HANDLE mainThreadHandel = GetThreadHandleFromPID(pid,windowHwnd);
GetThreadContext(mainThreadHandel,&Context);
GetThreadSelectorEntry(mainThreadHandel, Context.SegFs, &SelEntry);
DWORD dwFSBase = ( SelEntry.HighWord.Bits.BaseHi << 24) |
(SelEntry.HighWord.Bits.BaseMid << 16) |
SelEntry.BaseLow;
通过某种途径,将dwFSBase传入到子线程中:
__asm
{
mov eax, dwFSBase ;
mov edx, [eax+0x2C];
为何执行这一步后,edx 为0 ?
mov dword ptr [_dwMainData], edx
}
然后执行
__asm
{
mov eax, fs:[0x2C];
为何这一步eax 也为0?
mov edx, dword ptr [_dwMainData];
mov fs:[0x2C], edx
mov dword ptr [_dwMainData], eax
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课