zoukankan      html  css  js  c++  java
  • windbg学习-----------------Call Function

    .call 命令使得目标进程执行一个函数。

    语法

    .call [/vFunction( Arguments 
    .call /c 
    .call /C 
    .call /s
     Prototype Function( Arguments )


    指定函数是被当前进程的当前线程调用的。

    只支持 cdeclstdcallfastcallthiscall 调用约定。不能使用该方法调用托管代码


    Arguments不能使用字符串作为参数,但是可以使用字符串指针,或目标进程可以访问的其它任何内存

    我们可以看下以下的示例:

    0:000> ln 011334e0 
    e:verifytxsigndemoverifytxsigndemoantihook.cpp(215)
    (011334e0)   VerifyTxSignDemo!ComputeModulePath   |  (01133740)   VerifyTxSignDemo!StringVPrintfWorkerA
    Exact matches:
        VerifyTxSignDemo!ComputeModulePath (char *)
    0:000> .call VerifyTxSignDemo!ComputeModulePath("hook.dll")
    String literals not allowed in '"hook.dll")'
    提示不允许使用字符串"hook.dll",那么我们去堆栈中找一块,考虑到是栈是从上到下分配的,而字符串是从小到大读的,那么就取esp-100做为首地址吧:

    0:000> r $t0 = esp-100
    0:000> r $t0
    $t0=0022ebc8
    0:000> dd $t0
    0022ebc8  00000000 00000000 00000000 00000000
    0022ebd8  00000000 00000000 00000000 00000000
    0022ebe8  00000000 00000000 00000000 00000000
    0022ebf8  00000000 00000000 00000000 00000000
    0022ec08  00000000 00000000 00000000 00000000
    0022ec18  00000000 00000000 00000000 00000000
    0022ec28  00000000 00000000 00000000 00000000
    0022ec38  00000000 00000000 00000000 00000000
    
    0:000> eza $t0 "hook.dll"
    0:000> da $t0
    0022ebc8  "hook.dll"
    0:000> .call VerifyTxSignDemo!ComputeModulePath($t0)
    Unexpected character in '$t0)'
    0:000> .call VerifyTxSignDemo!ComputeModulePath(@$t0)
    Thread is set up for call, 'g' will execute.
    WARNING: This can have serious side-effects,
    including deadlocks and corruption of the debuggee.
    注意到必须使用@$t0,使用$t0不行!

    第一行提示windbg已经为函数调用做好准备,输入g命令将执行这个函数

    后两行表示这样调用目标程序的函数可能有严重的后果,包括死锁和崩溃

    输入g来执行函数:

    0:000> g
    .call returns:
    char * 0x00270000
     "E:VerifyTxSignDemoDebug"





















  • 相关阅读:
    Windows下给你mac下的开发体验 windows+wsl+zsh+vscode
    Puppeteer在docker下踩坑记录
    egret EUI加载 JSZip打包DragonBones二进制文件
    nodeJS rsasha加密
    Elasticsearch 聚合字段后 获取聚合字段的单条详细信息
    【转发自用】Apache2.4服务器权限设置问题
    C#重写VIVO支付SDK VivoSignUtils
    VS2017 空白 node.js web应用程序
    less开发
    获取样式getComputedStyle
  • 原文地址:https://www.cnblogs.com/hgy413/p/3693404.html
Copyright © 2011-2022 走看看