我正在制作一个脚本来测试一些始终运行的软件,并且我想测试它从 BSOD 的恢复情况。有没有一种方法可以从 python 抛出蓝屏而不调用外部脚本或可执行文件,如 OSR 的 BANG!
有趣的事情。 Windows 内核函数可以做到这一点。
我假设这是预期的行为,因为该功能已经存在
以下 python 代码将使任何 Windows 计算机在用户模式下崩溃,无需任何额外的设置。
from ctypes import windll
from ctypes import c_int
from ctypes import c_uint
from ctypes import c_ulong
from ctypes import POINTER
from ctypes import byref
nullptr = POINTER(c_int)()
windll.ntdll.RtlAdjustPrivilege(
c_uint(19),
c_uint(1),
c_uint(0),
byref(c_int())
)
windll.ntdll.NtRaiseHardError(
c_ulong(0xC000007B),
c_ulong(0),
nullptr,
nullptr,
c_uint(6),
byref(c_uint())
)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)