小技巧汇总

本文介绍如何使用CMD命令结束指定目录下运行的所有进程,如何在DLL中进行控件美化,以及如何利用WinDbg调试不同位数的dump文件,并提供了一些WinDbg的常用命令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、cmd命令

wmic process where "ExecutablePath like 'C:\\Wind\\Dragon\\bin\\%%'" delete

可以杀死指定目录下的所有运行的进程

在VS中可以将它放在生成事件中,方便调试


2、DLL中控件美化

在DLL工程的stdafx.h头文件最后加上如下代码即可,注意字符集类型:

#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

注意如下这一行

#endif // !defined(AFX_STDAFX_H__3A0AFA76_2723_4578_866B_0A1980C22EA7__INCLUDED_)



3、WinDbg调试不同位数的dump文件(如何用windbg分析64位机上32位程序的dump文件)

将dump拖入到windbg中后,在command输入栏输入 .load wow64exts 回车 !sw 回车,就将windbg的dump,从64位模式切换到了32位模式,否则看到的call stack 对我们分析dump是没有帮助的。然后就可以使用其它的命令来分析了。比如:使用kb命令,查看所有线程的调用堆栈,找出出错的线程,~*kb,就是查看所有线程的调用堆栈。



4、WinDbg常用命令

~*kv  :显示所有线程堆栈,也可以选择call stack和Threads,然后可以选中线程看具体线程堆栈

!locks [Options] [Address]


Options
Specifies the amount of information to be displayed. Any combination of the following options can be used:
-v
Displays detailed information about each lock.
-p
Display all available information about the locks, including performance statistics.
-d
Display information about all locks. Otherwise, only locks with contention are displayed.)
dt (Display Type)

The dt command displays information about a local variable, global variable or data type. This can display information about simple data types, as well as structures and unions.


!cs 扩展显示一个或多个临界区(critical section)或者整个临界区树

!cs Address 指定要显示的临界区地址。如果省略该参数,调试器显示当前进程中所有临界区。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值