The Smartcard::PCSC::Exception
error code you get (0x100000006) translates to the Windows API error code INVALID_HANDLE_EXCEPTION
(0x00000006). This typically indicates that the context handle used in the API call is invalid. With the smartcard gem, the PS/SC context (SCardEstablishContext
) is established through the initializer of Smartcard::PCSC::Context
. This operation seems to be successful, otherwise you would get an exception on line 13. The source of the INVALID_HANDLE_EXCEPTION
seems to be SCardGetStatusChange
(invoked by context.wait_for_status_change
).
A possible reason for that call to fail with an INVALID_HANDLE_EXCEPTION
could be a mismatch in the handle format, for instance caused by a 32-bit/64-bit mismatch. Thus, I would assume that the smartcard gem is designed for 32-bit only (while your path indicates that you are using a 64-bit version of Ruby).