2011-08-26 114 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

對不起,我的回答沒有幫助。 –