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"





















  • 相关阅读:
    How much training data do you need?
    什么样的论文容易接收发表?​
    How to Write and Publish a Scientific Paper: 7th Edition(科技论文写作与发表教程)(11.04更新)
    如何起草你的第一篇科研论文——应该做&避免做
    Writing the first draft of your science paper — some dos and don’ts
    matlab学习笔记 bsxfun函数
    乘法器的Verilog HDL实现
    重构:改善既有代码的设计
    【Leetcode】Length of Last Word
    Saving HDU hdu
  • 原文地址:https://www.cnblogs.com/hgy413/p/3693404.html
Copyright © 2011-2022 走看看