FindPrivateKey 在 Windows 7 64 位下不起作用

发布于 2024-10-19 05:45:10 字数 313 浏览 6 评论 0原文

我已经下载了 .net 示例 FindPrivateKey,为框架 4.0 编译,尝试了不同的平台(32 位、64 位、任何 CPU),但它不起作用。总是同样的错误:无法在动态链接库comctl32.dll中找到序号345。我使用 Windows 7 企业版,64 位版本。 此方法调用失败: matches = X509Certificate2UI.SelectFromCollection(store.Certificates, "选择证书", "选择证书以查找关联私钥文件的位置:", X509SelectionFlag.SingleSelection); 这里可能有什么问题?

亚历山大

I've downloaded .net sample FindPrivateKey, compiled for framework 4.0, tried for different platforms (32bit, 64bit, Any CPU) but it didn't work. Always the same error: the ordinal 345 could not be located in the dynamic link library comctl32.dll. I use Windows 7 Enterprise, 64 bit version.
This method call fails: matches = X509Certificate2UI.SelectFromCollection(store.Certificates, "Select certificate", "Select the certificate to find the location of the associated private key file:", X509SelectionFlag.SingleSelection);
What could be problem here?

Aleksandar

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抹茶夏天i‖ 2024-10-26 05:45:10

今天早上我遇到了同样的问题(无法找到序号 345...)...
我已经在 3 台不同的 Win7 64 位 PC 上尝试过该应用程序;但只有其中之一会抛出异常。我发现问题出在 comctl32.dll 库的使用上(与我的不同)。

您可以执行这段代码来检查您正在使用哪个版本的库:

foreach (ProcessModule module in System.Diagnostics.Process.GetCurrentProcess().Modules)
            if (module.ModuleName.ToLower() == "comctl32.dll")
                MessageBox.Show(module.FileVersionInfo.ToString());

然后添加清单并强制应用程序使用特定的库版本:
[项目]->添加新项目->应用清单
并编辑它添加以下依赖部分。

我希望这对你有用......

    <?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>

… 
… 
…

  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>
</asmv1:assembly>

This morning I’ve encountered the same problem (ordinal 345 could not be located ...)…
I’ve tried the application in 3 different PC with Win7 64bit; but only in one of these the exception throws. I found that the problem was in the use of the comctl32.dll library (which was different from mine).

You can execute this piece of code in order to check which version of the library you are using:

foreach (ProcessModule module in System.Diagnostics.Process.GetCurrentProcess().Modules)
            if (module.ModuleName.ToLower() == "comctl32.dll")
                MessageBox.Show(module.FileVersionInfo.ToString());

Then add a manifest and force the application to use a specific library version:
[Project] -> Add new item -> Application manifest
And edit it adding the following dependency part.

I hope this works for you...

    <?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>

… 
… 
…

  <dependency>
    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>
</asmv1:assembly>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文