On 1/20/2011 3:43 AM, Martin Paljak wrote: > Hello, > > On Jan 20, 2011, at 1:46 AM, Douglas E. Engert wrote: > >> Attached is a patch to the cardmod code to do the following: >> >> (1) Fix an uninitialized stricture by by using calloc >> in stead of malloc. With out this it was having problems >> with checking the status on the reader. > malloc->calloc is always good. > > >> (2) Implement a change that this should work for Brian Thomas >> that allows one to not detect the reader when creating >> the sc_context. This uses the >> SC_CONTEXT_PARAM_DONT_DETECT_READERS flag in the ctx_params >> >> (The more I think about this, this should be the default >> to not detect the readers during the sc_create_ctx, as >> a flag on opensc.conf could control this instead.) > > I think the approach of not auto-detecting readers on context creation is > better approach than the flag. At the same time I don't see any other reasons > NOT to detect readers, only when initializing the pcsc driver (and I mean > pcsc-driver, not the copy in reader-pcsc.c) with the pre-existing handles. > > Also, reducing one to a single context creation function > (sc_establish_context wrapper vs sc_context_create) would do good. >
The problem was how to pass in the pcsc_context and pcsc_card_handle provided by the BaseCSP to the cardmod code in reader_pcsc without using the Registry. The ctx_params is only used by the sc_context_create. Yes some better way to do this would be good. Brian Thomas has not yet responded. I would like to here if any of the above approachs would work for him. All he has said was to bypass the call at L622, but never said how he gets the BaseCSP provided handles into OpenSC. Also he was targeting XP. This needs to work on Vista and W7 too. > >> (2) Eliminate the storing of the SCARDCONTEXT and SCARDHANDLE >> in the registry. Instead, cardmod.c will store them >> in its VENDOR_SCPECIFIC structure, call sc_context_create >> with the SC_CONTEXT_PARAM_DONT_DETECT_READERS flag set >> in the ctx_params. It will then modify the ctx, >> and then call sc_ctx_detect_readers that will call the >> cardmod code in reader-pcsc.c that will use the SCARDCONTEXT >> and SCARDHANDLE. > > Using non-windows names (pcsc_context, pcsc_card_handle) would be better than > phchmTypeName. No problem, I just used the same names provided by Microsoft. > > Other than that, it looks good, I'll do the mentioned changes in a sec. Good. > -- Douglas E. Engert <deeng...@anl.gov> Argonne National Laboratory 9700 South Cass Avenue Argonne, Illinois 60439 (630) 252-5444 _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel