在Windows 7上通过DpInst安装已签名的驱动程序(即使用正确签名的.CAB)时,除非它是WHQL签名的驱动程序,否则无法以静默方式安装它。如果您以非静默模式运行DpInst,它将提示您信任“发布者”。如果您以静默模式运行DpInst,它将失败并显示与签名相关的错误代码(类似于0x800b0109 - 请检查您的setupapi.app.log)。
答案 0 :(得分:5)
虽然ilya的答案很好,但Windows 7上的解决方案更加容易。以下命令将证书部署到当前用户和系统受信任的发布者证书存储区。它需要管理权限,由Microsoft提供。
certutil.exe -addstore TrustedPublisher cert.cer
我确认这适用于Windows 7 64位,可以在不提示用户的情况下部署已签名但未经WHQL认证的驱动程序。
似乎在XP上你仍然需要经过WHQL认证的驱动程序才能避免安装提示。
对于Windows XP,您需要从Microsoft下载Windows Server 2003管理工具包并解压缩certutil.exe和certadm.dll。然后上面的命令也适用于XP。
管理工具包:http://www.microsoft.com/download/en/details.aspx?DisplayLang=en&id=16770
请注意,提取的msi文件可以通过7-zip进行检查,因此您无需安装它即可获得所需的exe和dll。
答案 1 :(得分:3)
直接的方法是将签名证书添加到TrustedPublishers。你可以以编程方式完成(win32exception的实现留给读者练习):
#include <windows.h>
#include <wincrypt.h>
#include "win32exception.h"
void InstallTrustedPublisherCertificate(LPCTSTR CertificateFilePath)
{
DWORD dwContentType;
PCCERT_CONTEXT pCertContext = NULL;
if (!CryptQueryObject(
CERT_QUERY_OBJECT_FILE,
CertificateFilePath,
CERT_QUERY_CONTENT_FLAG_ALL,
CERT_QUERY_FORMAT_FLAG_ALL,
0,
NULL,
&dwContentType,
NULL,
NULL,
NULL,
(const void **)&pCertContext))
throw win32exception("CryptQueryObject");
if (dwContentType != CERT_QUERY_CONTENT_CERT)
throw exception("Incorrect content type of crypto object.");
__try
{
HCERTSTORE hCertStore = CertOpenStore(
CERT_STORE_PROV_SYSTEM,
0,
0,
CERT_STORE_OPEN_EXISTING_FLAG |
CERT_SYSTEM_STORE_CURRENT_USER,
_T("TrustedPublisher"));
if (hCertStore == NULL)
throw win32exception("CertOpenStore");
__try
{
if (CertAddCertificateContextToStore(hCertStore, pCertContext, CERT_STORE_ADD_NEWER, NULL))
{
// Added certificate to TrustedPublisher store.
}
else
{
DWORD err = GetLastError();
if (err == CRYPT_E_EXISTS)
{
// Certificate already exists in TrustedPublisher store.
}
else
throw win32exception("CertAddCertificateContextToStore", err);
}
}
__finally
{
CertCloseStore (hCertStore, 0);
}
}
__finally
{
CertFreeCertificateContext(pCertContext);
}
}
答案 2 :(得分:2)
问题是什么?如果驱动程序未通过WHQL认证,则无法以静默方式安装。这是Windows的安全措施。
答案 3 :(得分:0)
驱动程序必须通过WHQL认证才能避免任何类型的未签名弹出窗口。
如果您正在寻找任何第三方WHQLTesting服务提供商,请告诉我们,我们很乐意为您提供帮助。