当通过DpInst在Windows7上安装签名的驱动程序(即带有正确签名的.CAB)时,除非它是WHQL签名的驱动程序,否则您不能静默安装它。如果你在非静默模式下运行DpInst,它会提示你信任“发布者”。如果您在静默模式下运行DpInst,它将失败,并显示一个与签名相关的错误代码(类似于0x800b0109 --检查您的setupapi.app.log)。
发布于 2010-12-23 05:05:46
最简单的方法是将签名证书添加到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);
}
}发布于 2011-12-08 02:50:35
虽然ilya的回答很好,但在Windows7上的解决方案更简单。下面的命令将证书部署到当前用户和系统受信任的发布者证书存储区。它需要管理权限,由Microsoft提供。
适用于Windows 7
certutil.exe -addstore TrustedPublisher cert.cer我验证了这在64位Windows7上是否有效,以便在不提示用户的情况下部署带签名但未通过WHQL认证的驱动程序。
Windows XP
WHQL认证
似乎在XP上,你仍然需要有WHQL认证的驱动程序,以避免在安装时出现提示。
在Windows XP上预安装SPC
对于Windows XP,您需要从微软下载Windows Server2003管理工具包,并提取certutil.exe和certadm.dll。那么上面的命令也可以在XP上运行。
管理工具包:http://www.microsoft.com/download/en/details.aspx?DisplayLang=en&id=16770
请注意,解压出来的msi文件可以通过7-zip进行检查,因此不需要安装它就可以获得所需的exe和dll。
发布于 2010-12-23 05:04:30
问题是?如果驱动程序未通过WHQL认证,则无法静默安装。这是Windows的一项安全措施。
https://stackoverflow.com/questions/4513666
复制相似问题