我有一个修改过的驱动程序,必须在禁用驱动程序签名时安装,因此我希望检测到此状态,以提醒用户重新启动到SafeMode。我尝试了以下命令:Bcdedit.exe -set TESTSIGNING OFF,但失败并提示
设置元素数据时发生错误。该值受安全引导策略保护,不能修改或删除。
Umm..is有什么办法可以做到吗?
PS:事实上,我的笔记本电脑型号是MSI GS70 2PE。我不认为它是廉价的,即使是最新发布的GS73也不能支持完整的win10 gestures.And,它支持Windows10,但MSI确实没有发布我自己修改和使用的最新的driver.If,没有价值的mentioning.However,我想在论坛上分享它,以帮助其他普通用户使用。
我做错了什么吗?无法理解为什么有人在谈论其他事情。
发布于 2018-06-20 09:29:11
使用以下代码检测是否启用了TESTSIGNING:
#include <Winternl.h>
#pragma comment(lib, "ntdll.lib")
//Check if testsigning is enabled
SYSTEM_CODEINTEGRITY_INFORMATION sci = {0};
ULONG dwcbSz = 0;
sci.Length = sizeof(sci);
if(NtQuerySystemInformation(
/*SystemCodeIntegrityInformation*/ (SYSTEM_INFORMATION_CLASS)0x67,
&sci,
sizeof(sci),
&dwcbSz) >= 0 &&
dwcbSz == sizeof(sci))
{
BOOL bTestsigningEnabled = !!(sci.CodeIntegrityOptions & /*CODEINTEGRITY_OPTION_TESTSIGN*/ 0x2);
//Note that testsigning will play no role if bit CODEINTEGRITY_OPTION_ENABLED (or 0x1) is not set in sci.CodeIntegrityOptions
}发布于 2018-07-08 08:28:34
我宁愿把它包装成一个更好的函数,如下所示:
bool IsSystemCodeIntegrityEnabled() {
typedef NTSTATUS(__stdcall* td_NtQuerySystemInformation)(
ULONG SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);
struct SYSTEM_CODEINTEGRITY_INFORMATION {
ULONG Length;
ULONG CodeIntegrityOptions;
};
static td_NtQuerySystemInformation NtQuerySystemInformation = (td_NtQuerySystemInformation)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQuerySystemInformation");
SYSTEM_CODEINTEGRITY_INFORMATION Integrity ={ sizeof(SYSTEM_CODEINTEGRITY_INFORMATION), 0 };
NTSTATUS status = NtQuerySystemInformation(103, &Integrity, sizeof(Integrity), NULL);
return (NT_SUCCESS(status) && (Integrity.CodeIntegrityOptions & 1));
}https://stackoverflow.com/questions/40084077
复制相似问题