.call 命令使得目标进程执行一个函数。
语法
.call /c
.call /C
.call /s Prototype Function( Arguments )
指定函数是被当前进程的当前线程调用的。
只支持 cdecl、 stdcall、 fastcall和thiscall 调用约定。不能使用该方法调用托管代码
我们可以看下以下的示例:
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"