【发布时间】:2011-08-26 17:50:10
【问题描述】:
- 我正在使用 C++ 和 Visual Studio 2010。
当我使用智能卡进行签名时出现:“当程序完成时。”
Windows has triggered a breakpoint in MyProgram.exe.
This may be due to a corruption of the heap, and indicates a bug in MyProgram.exe or any of the DLLs it has loaded.
The output window may have more diagnostic information
关于输出
HEAP[MyProgram.exe]: Invalid Address specified to RtlFreeHeap( 003C0000, 01BBFEA0 )
Windows has triggered a breakpoint in MyProgram.exe.
This may be due to a corruption of the heap, which indicates a bug in MyProgram.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while MyProgram.exe has focus.
The output window may have more diagnostic information.
MyProgram.exe 程序使用 dll “signer.dll”。
我尝试使用“无智能卡”进行签名。仅使用 Windows 证书。 OK 正常终止。
我尝试使用智能卡签名,出现一个要求输入 PIN 码的窗口。当程序结束时。错误 - 指定给 RtlFreeHeap 的地址无效。
我使用智能卡,当它要求输入 PIN 时,我标记为“NOT”。程序结束时。错误 - 指定给 RtlFreeHeap 的地址无效。
我注意到该错误仅在出现要求输入 PIN 的窗口出现时发生。
所以,我尝试使用 WinDbg,按照这篇文章:http://www.codeproject.com/KB/debug/windbg_quick_start.aspx
我在“CryptSignMessage”处设置断点出现:“When Use Smart Card”
(150c.17fc): C++ EH exception - code e06d7363 (first chance)
(150c.17fc): C++ EH exception - code e06d7363 (first chance)
不使用智能卡时不会发生这种情况。
我认为他试图获取密钥的上下文但不能并且“破坏记忆”。在“第一次机会”提示 PIN 的窗口之后。
这是问题吗? 在使用 CryptSignMessage 之前如何获取带有密钥上下文的证书?
我该如何解决?
没有智能卡我可以正常签名。 使用智能卡我可以正常签名,但程序完成后出现错误。
智能卡上的标志应该注意什么?
提前致谢
【问题讨论】:
标签: c++ exception cryptography heap-corruption