ChainConfig.cbSize = sizeof(CERT_CHAIN_ENGINE_CONFIG); ChainConfig.hRestrictedRoot = NULL; ChainConfig.hRestrictedTrust = NULL; ChainConfig.hRestrictedOther = NULL; ChainConfig.cAdditionalStore = 0; ChainConfig.rghAdditionalStore = NULL; ChainConfig.dwFlags = CERT_CHAIN_CACHE_END_CERT; ChainConfig.dwUrlRetrievalTimeout = 0; ChainConfig.MaximumCachedCertificates = 0; ChainConfig.CycleDetectionModulus = 0; //--------------------------------------------------------- // Create the nondefault certificate chain engine. if (CertCreateCertificateChainEngine( &ChainConfig, &hChainEngine)){ printf("A chain engine has been created.\n");}
获取错误0x80070057(-2147024809)参数不正确,有人可以帮忙吗?
我希望你已经设法解决这个问题了。 如果没有,这是我有点迟了的答案:
看起来您正在使用Microsoft的示例代码来创建证书链。 不幸的是,它似乎已经过时了, 如果您查看CERT_CHAIN_ENGINE_CONFIG
的文档,您将看到在Windows 7中还有两个需要初始化的成员变量hExclusiveRoot
和hExclusiveTrustedPeople
。
你可以将它们设置为NULL(如果你不需要它们)来处理错误:
ChainConfig.hExclusiveRoot = NULL; ChainConfig.hExclusiveTrustedPeople = NULL;