[Pcsclite-muscle] SCardBeginTransaction behavior under sharing violation

Maksim Ivanov emaxx at google.com
Fri Oct 6 12:09:44 PDT 2023


Hello,

SCardBeginTransaction() is documented as "there will be no action
taken" in case the reader is already locked. Also the
SCARD_E_SHARING_VIOLATION error code is documented to be returned in
case "someone else has exclusive rights".

However, judging from the implementation, it seems that the
SCardBeginTransaction enters a poll loop, waiting for particular
results from the daemon. If I'm reading it correctly, the loop doesn't
exit as long as SCARD_E_SHARING_VIOLATION is received from the daemon
(https://github.com/LudovicRousseau/PCSC/blob/52670e567267baf3579581f32ef3756a3644b9f2/src/winscard_clnt.c#L1193),
meaning that the function would never return this code to the caller.

If so, is this an oversight in the documentation, or rather in the
implementation?


Regards,
Maksim



More information about the pcsclite-muscle mailing list