Scott Moynes wrote:
> Karsten Ohme wrote:
> 
>>
>>
>> I believe the problem is the following:
>>
>> Usually the context should only released, if the library is unloaded.
>> But SCardReleaseContext is called in the Release function, that means
>> not only the connection to the card is closed, but also the connection
>> to the resource manager of the system. So, the value of the handle
>> localHContext is also invalid, because it is a value, which context was
>> destroyed. So an error occurs.
>> Set localHContext to 0 is not necessary, because the context should be
>> cached, so the solution, which would fit better the idea of caching, is
>> to remove the whole SCardReleaseContext branch, the disconnection is
>> enough.
>>
>> I think, I have not such problem.
>>
>>   
> 
> I agree that if the SCardReleaseContext is not called, then
> localHContext does not need to be cleared and remains valid. Indeed,
> this is what previous beta releases did and our software works fine with
> those releases, but the context release was added so I could only assume
> that there is some reason for this.

I'm not sure, the fini function with the destructor is rather new and
maybe it is a relic from former times. (?)

> 
> Unfortunately, due to the way the openssl engine code is implemented, it
> is not possible to open a context when the library is loaded and release
> it when it is unloaded because one does not have the reader and key
> identifiers at those points. Moreover, I think it would be impossible to
> use more than one reader because the connection to the first card would
> cache the context and all other operations would attempt to use the
> cached copy.

No, I don't think so. There is a difference between the localHContext,
i.e. the context to the smart card resource manager and the card handle.
One context to the resource manager is enough and from there many
connections to cards can be made.
E.g. muscleTool works for me with this, I have two card readers
connected and can change form one reader to the next one.

Karsten
> 
> Cheers,
> scott.
> 
> _______________________________________________
> Muscle mailing list
> [email protected]
> http://lists.drizzle.com/mailman/listinfo/muscle

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to