|
Vmware+Windbg调试环境配置,请参考VMware+Windgb+Win7内核驱动调试。测试程序来自《内核安全编程》第一个例子。
///
/// @file first.c
/// @author crazy_chu
/// @date2008-11-1
///
#include <ntddk.h>
// Unload function
VOID DriverUnload(PDRIVER_OBJECT driver)
{
// Do nothing just print one sentence
DbgPrint("Our driver is unloading¡\r\n");
}
// DriverEntry¡£
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING reg_path)
{
#if DBG
_asm int 3//break point
#endif
DbgPrint("Hello, Welcome to Yexin218.iyunv.com");
// set unload function
driver->DriverUnload = DriverUnload;
return STATUS_SUCCESS;
}
首先编译后,把sys文件拷贝到GuestOs 中,并且使用srvinstw安装(详细请参考)。安装好之后先不要执行,net start first (first是你安装时自定义的服务名字)。
然后在你的主机上,配置调试信息:
- 配置sympath,C:\Users\Admin\Desktop\first\objchk_win7_x86\i386是你编译好的sys目录: SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols;C:\Users\Admin\Desktop\first\objchk_win7_x86\i386
- 配置Source search path[假设文件放在C:\Users\Admin\Desktop\first]: C:\Users\Admin\Desktop\first
- 然后在命令行中输入:.reload
- 打开源文件:Ctrl+O
- 开始在GuestOS 中执行:net start first, 会发现整个GuestOS不动了,因为windbg在你设置的断点处开始调试。
- 然后你可以F10一步一步调试,另外F9还可以设置断点,还没有弄明白~ 先到这里。
|
|
|