开发者

Invalid Address specified to RtlFreeHeap When use Smart Card to Sign (C++)

开发者 https://www.devze.com 2023-03-30 21:00 出处:网络
I am using C++ and Visual Studio 2010. When I use a smart card to perform signature appears: \"When program finished.\"
  • I am using C++ and Visual Studio 2010.

When I use a smart card to perform signature appears: "When program finished."

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

On Output

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 i开发者_运维知识库ndicates 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 program uses the dll "signer.dll."

I try to sign with "no smart card.". Only with Windows Certificate. OK terminates normally.

I try to sign using the smart card, a window appears asking for the PIN. When the program ends. ERROR - Invalid Address specified to RtlFreeHeap.

I use the smart card, when it asks for the PIN I mark "NOT".When the program ends. ERROR - Invalid Address specified to RtlFreeHeap.

I noticed the error only occurs when the window appears that asks for the PIN.

So, I tried to use WinDbg, following this article: http://www.codeproject.com/KB/debug/windbg_quick_start.aspx

I put breakpoint at "CryptSignMessage" appears: "When Use Smart Card"

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

When no Use Smart Card this does not occur.

I think he tries to get the context for the key but can not and "corrupts memory". After "first chance" prompt the PIN's Window.

Is this the problem? How to take certificate with key context before to use CryptSignMessage?

How can I fix?

With no Smart Card I can sign normally. With Smart Card I can sign normally, but when program finished the error appears.

What care should be taken to the sign from the smart card?

Thanks in Advance


This appears to be a heap corruption, just as the message says. They aren't too easy to track down. Your best bet is to use a memory profiling tool to help find the cause.

0

精彩评论

暂无评论...
验证码 换一张
取 消