I am new to Experts-Exchange. I have been "lurking" for a few years and realized the value of the site, so I signed up as a subscriber.
With that said, I am having difficulty with an old DLL (about 8 years old!). The developer/provider of the dll has not made any changes, and there are no new versions.
This is the documented use of the library to log on to the Common Access Card provided by the library creator:
Long logonToCard (IN BSTR * pin, IN long pinLen)
I have been working with this library for years. The VB6 code below works fine in VB6 and MS Access 2003:
Call oCac.logonToCard(StrConv(strPin, vbFromUnicode), Len(strPin))
However, I am moving on to VB.NET. The same VB6 code does not work in VB.NET. I suspect it is that the strPIN is being provided incorrectly to the LogonToCard call. Here's what I tried...
Dim strPIN As String = "12345678"
Dim intPinLen As Integer = Len(strPIN)
Call obCac.logonToCard(strPIN, intPinLen)
I get this error:
Description: "Exception from HRESULT: 0xFFFF8ACC"
The error -30004 is defined in the documentation as "Authenticator value or type is not correct"
With the VB6 code (that works fine), I had to "StrConv" the strPIN from vbFromUnicode. When I look at the value returned in the debug window for VB6, I see "????", so I know that it is changing the human readible string to something the library understands.
Since VB.NET provides for Unicode by default, I guess I need to convert it to a bstr. But no StrConv function exists in VB.NET.
I am stuck. Any ideas?