-
-
[求助]内嵌汇编问题
-
发表于:
2009-2-18 01:47
4670
-
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
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!