winscard - Getting the "name" of the smartcard for SCardGetCardTypeProviderName() -
in order crypto context cryptacquirecontext()
, need know provider name smartcard in slot.
according documentation, scardgetcardtypeprovidername()
this, param 2 card name, , can't see how determine non-interactively. documentation/examples i've seen either harcode name or rely on scarduidlgselectcard()
, displays ui.
similarly reading around scardlocatecards()
, although takes list of smartcard names (for i'm populating scardlistcards()
, doesn't seem pass identifies name of smartcard inserted.
i suspect i'm missing obvious, can't see what.
i missing something. scardlocatecards
returns part of strucutre atr of smartcard, can used in scardlistcards
:
scard_readerstate smartcardstate[maximum_smartcard_readers]; result = scardlocatecards (context, cardslist, smartcardstate, readercount); if (result == scard_s_success) { int i; (i = 0; < readercount; i++) { if (scard_state_atrmatch & smartcardstate[i].dweventstate) { break; } } result = scardlistcards (null, smartcardstate[i].rgbatr, null, null, cardname, &count); if (result == scard_s_success) { // cardname cryptaquirecontext in cardname } }
if has better route forward let me know - think way though can see.
Comments
Post a Comment