请问:
可以调用SetThreadContext来改变寄存器值。
那么该如何HOOK 这个函数 然后知道他改变了哪个地址的寄存器值?

解决方案 »

  1.   

    刚试了下 自己定义的SetThreadContext函数写入如下代码:
    BOOL WINAPI MySetThreadContext(HANDLE hThread, CONST CONTEXT *lpContext)
    {
    CString s;
    BOOL nResult=CopySetThreadContext(hThread,lpContext);
    s.Format("%x",lpConText->Dr0);
    MessageBox(NULL,s,s,MB_OK);
    return nResult;
    }
    这样是可以拦截到你设置了Dr0的地址 那要怎么样拦截你改变了Dr0地址的寄存器值呢?
    例如我Dr0的地址改变其eax为00123456  那么该怎么拦截得到这个00123456
      

  2.   

    HINSTANCE hInst = LoadLibrary("库文件.lib");
    HANDLE hFunc = GetProcAddress(...);
      

  3.   

    调用GetThreadContext,与要设置的数据对比。
      

  4.   

    BOOL WINAPI MySetThreadContext(HANDLE hThread, CONST CONTEXT *lpContext)
    {
    CONTEXT orgContext={0};
    GetThreadContext(hThread,&orgContext);
    compare(orgContext, *lpContext); // 比较之
    BOOL nResult=CopySetThreadContext(hThread,lpContext);
    return nResult;
    }
      

  5.   


    请问 compare 这个函数在哪个头文件里?
      

  6.   

    现在windows下商业软件hook都用detours
      

  7.   

    网上有关于detour方式hookapi,如果想看相关例子,有份叫FileMon的源码
      

  8.   

    请问 compare 这个函数在哪个头文件里?
      

  9.   

    请问 compare 这个函数在哪个头文件里?