2011-08-26 113 views
1
  • 我使用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”出现:“当使用智能卡”

(150c.17fc): C++ EH exception - code e06d7363 (first chance) 
(150c.17fc): C++ EH exception - code e06d7363 (first chance) 

当没有使用智能卡这样做不会发生。

我认为他试图获得关键的上下文,但不能和“腐败的记忆”。在“第一次机会”之后提示PIN的窗口。

这是问题吗? 如何在使用CryptSignMessage之前取得关键上下文的证书?

我该如何解决?

没有智能卡我可以正常登录。 使用智能卡我可以正常签名,但程序完成后会出现错误。

智能卡上的标志应该注意些什么?

在此先感谢

回答

1

这似乎是堆腐败,就像消息说的那样。他们不太容易追查。您最好的选择是使用内存分析工具来帮助查找原因。

+0

感谢您的回复。我将读者的软件更改为更旧,并且工作正常。我讨厌错误。 – Cobaia

+0

对不起,我的回答没有帮助。 –