我有什么方法可以检测驱动程序签名策略状态吗? [英] Can I have any way to detect the Driver Signing Policy status?

查看:40
本文介绍了我有什么方法可以检测驱动程序签名策略状态吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个修改过的驱动程序,必须在驱动程序签名被禁用时安装,所以我想检测这个状态来提醒用户重新启动到安全模式.我试过这个命令:Bcdedit.exe -set TESTSIGNING OFF,但失败并提示

I have a modified driver and must be installed when driver signing is disabled, so I want to detect this status to remind users to reboot to SafeMode. I had tried this command : Bcdedit.exe -set TESTSIGNING OFF, but failed and prompted

设置元素数据时发生错误.该值受安全启动策略保护,无法修改或删除.

An error has occurred setting the element data. The value is protected by Secure Boot policy and cannot be modified or deleted.

嗯..有什么办法可以做到吗?

Umm..is there any way can do it?

————————

附注:事实上,我的笔记本电脑型号是MSI GS70 2PE.我不认为它是便宜的,即使最新发布的GS73也不支持完整的win10手势.它支持Windows10但MSI确实没有发布最新的驱动程序.如果我自己修改和使用它,没有什么值得一提的.但是,我想分享到论坛,帮助其他普通用户使用.

PS: In fact, my laptop model is MSI GS70 2PE. I don't think it's a cheap one even the lastest published GS73 cannot supported full win10 gestures.And it supports Windows10 but MSI truly doesn't release the lastest driver.If I only modified and use it by myself, nothing worth mentioning.However, I want to share it in forum to help other general users to use.

我做错了吗?无法理解为什么有人谈论其他事情.

Am I doing something wrong? Cannot understanding why someone talks about other things.

推荐答案

我宁愿把它包装成一个更好的函数,如下所示:

I would rather wrap this into a nicer function like so:

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));
}

这篇关于我有什么方法可以检测驱动程序签名策略状态吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆