VB6 Program Crash: Part 2: Troubleshooting Guidelines for Access Violation (0xC00000005)

Related to this question . Any tips for troubleshooting below?

After a lot of experimenting with the program, I discovered a few things.

  • It fires relatively consistently (90% of the time or so) when running a line of code Set Message = New CAPICOM.EncryptedData

    . Note that the line above this is simple Dim Message As CAPICOM.EncryptedData

    .

  • The function that makes this call does not fail when called earlier during program execution. Binary error search does not work to find the problem, as the function call in some places mysteriously, improperly prevents the error from occurring. Sometimes rebuilding the program seems to have an effect if an error appears. Yes, it's a Heisenbug. The same problems apply to temporary binary error search. Spending 5 hours comparing two versions of the program, only to find that both versions have a bug, although only one of them is currently showing symptoms, is not very productive.

  • The crash is due to access violation 0xC00000005

  • Running WinDbg (the windows debugger) shows that there is only one line of code that reads this memory location LoadPicture(szTmpBMP)

    . It is called at the end of a dreaded function that grabs an image from a resource and inserts it into a temporary file. I was scared enough by this function that, for testing purposes, I replaced it with a call to LoadPicture("testcra.bmp")

    , and then didn't call the dreaded resource function on that bitmap. It did not help. Removing this call to loadpicture entirely did not help either, although the debugger could no longer find the points at which the affected memory was read, and the corrupted memory was no longer in the same location. This testing was done in a virtual machine, so some memory reads will not necessarily be visible to the debugger.

  • Everything works fine on Vista (both my local machine and the Vista VM). Access violation only happens on XP.

  • I am using VB6 Version 8176, 6.0.8169

0


source to share


1 answer


My current solution that works is to create all of my capicom objects before and never create new instances of capicom.encrypteddata outside of the first one. This works, but it is unlikely that the underlying issue has actually been fixed.



0


source







All Articles