Better error debug messages for Minidriver
Add MD_FUNC_CALLED(pCardData, level) and MD_FUNC_RETURN(pCardData, level, ...) macros. Handles are type __int3264 in VS2015 are casted as size_t when printing so all bytes are printed. size_t on Windows are also treated as 32 or 64 bits. SC_FORMAT_LEN_SIZE is used in the format. (Works with VS2105 needs to be tested on other platforms.) On branch minidriver-4 Changes to be committed: modified: minidriver.c Minidriver.c and reader-pcsc.c - reuse OpenSC reader structure Windows CNG is managing the insertion and removal of the reader and the card and will call CardAcquireContext and CardDeleteContext as needed if the card or reader change. But different processes or threads may establish different PCSC connects to the same reader and card but with different handles. Reuse the OpenSC reader when windows uses the same reader but with different handles. Tests show the certutil -v -scinfo works the same. Associate_card is only need when called from CardAcquireContext and disassociate_card is only need when called from CardDeleteContext. No need to call reinit_card_for(pCardData, name) just because the handles changed. This may be the fix for #1763 because calls like CardCreateContainerEx remain in card state rather then being lost when the handles changed. Changes to be committed: modified: src/libopensc/reader-pcsc.c modified: src/minidriver/minidriver.c
This commit is contained in:
parent
348551c920
commit
111246f1d2
@ -2411,11 +2411,22 @@ int pcsc_use_reader(sc_context_t *ctx, void * pcsc_context_handle, void * pcsc_c
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* if we already had a reader, delete it */
|
||||
/* Only minidriver calls this and only uses one reader */
|
||||
/* if we already have a reader, use it*/
|
||||
if (sc_ctx_get_reader_count(ctx) > 0) {
|
||||
sc_reader_t *oldrdr = list_extract_at(&ctx->readers, 0);
|
||||
if (oldrdr)
|
||||
_sc_delete_reader(ctx, oldrdr);
|
||||
sc_log(ctx, "Reusing the reader");
|
||||
sc_reader_t *reader = list_get_at(&ctx->readers, 0);
|
||||
|
||||
if (reader) {
|
||||
struct pcsc_private_data *priv = reader->drv_data;
|
||||
priv->pcsc_card =*(SCARDHANDLE *)pcsc_card_handle;
|
||||
gpriv->pcsc_ctx = *(SCARDCONTEXT *)pcsc_context_handle;
|
||||
ret = SC_SUCCESS;
|
||||
goto out;
|
||||
} else {
|
||||
ret = SC_ERROR_INTERNAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
sc_log(ctx, "Probing PC/SC reader");
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user