VB6: Capicom Crashes on WinXP [duplicate]

和自甴很熟 提交于 2019-12-14 04:04:52

问题


Any suggestions on figuring out this crash?

The below code intermittently crashes between logging <part>14 and logging <part>15. Plaintext is a path string (in this case it is "C:\Documents and Settings\Brian\Desktop\Joy\", despite a clear lack of such joy. I have a sinking feeling this is a symptom of some sort of evil memory issue. I tried with both Capicom 2.1.0.1 and 2.1.0.2, both of which crash. The latter gives a standard error-reporting message, the former dies silently (i.e. the program closes itself). I tested it on someone else's XP machine with the same issue, though it worked fine on Vista.

Const curMthd = "EncryptStringWrap"
Dim Message As CAPICOM.EncryptedData
Set Message = New CAPICOM.EncryptedData
Dim oUtil As CAPICOM.Utilities
Set oUtil = New CAPICOM.Utilities
E.ErrorLog "<PART>14"
Message.Content = plaintext
E.ErrorLog "<PART>15"

Edit: It's not the data that is causing the problem. I have been manually passing the data in to test for this; it works fine normally. Annoyingly, the bug went away when I put the test code in the initialization. Evil heisenbug :( . Probably a memory issue :(

Edit 2: Rewritten and whatnot here, and closed. Not really the same question as this per se, but this question was based on a serious misunderstanding of the problem.


回答1:


The slashes could cause CAPICOM not to handle strings properly. By putting the code into a loop where you feed different strings you could find out what is the problem sequence.

Given that CAPICOM is a wrapper around the cryptoAPI this could give you another path where you run a test project accessing the Crypto API directly using the same sequence and same type of calls. From reading up on the internet is a thin wrapper.

MSDN has some sample code here There more available as well.

I dealt with many problems with various "wrapper" Com DLL in this way. Find the data that causing the problem. Write a test project using the Win API directly using the same data. Then evaluate.

The results are usually either I implement my own wrapper. Or find that I am missing a step or have the wrong configuration.

Note that this works with wrapper assemblies in .NET as well with the added benefit of being able to use reflector to see what the wrapper is doing.



来源:https://stackoverflow.com/questions/331901/vb6-capicom-crashes-on-winxp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!