I know this is an old topic, but I have the same problem on Windows 10 (x64), except I'm using VB6.
I have a lot working through using SCardTransmit
etc, I can controle/read/write if there's a card on it. But I want to control the reader (ACR112U) without a card (turn off autodetection/beep) and that's only possible using SCardControl
(as far as I know), cause when I connect with Directmode and then call our SetBuzzerCardDetection to turn it off, I get a ERROR_BAD_COMMAND
, but when shared and a card it works.
Even the example from ACS themselves with IOCTL_GET_VERSIONS
gives me return value ERROR_INVALID_FUNCTION
Dim vcVersion As VERSION_CONTROL
Dim lReturnedLength As Long
m_lResult = SCardControl(m_hCard, _
IOCTL_GET_VERSIONS, _
0, 0, _
vcVersion, 20, _
lReturnedLength)
If m_lResult <> SCARD_S_SUCCESS Then
I'm using the following
Declare Function SCardControl Lib "WinScard.dll" ( ByVal hCard As Long, ByVal dwControlCode As Long, ByRef lpInBuffer As Any, ByVal lSizeofBuffer As Long, ByRef lpReceiveBuffer As Any, ByVal lpReceiveBufferSize As Long, ByRef lpBytesReturned As Long) As Long
Const IOCTL_CCID_ESCAPE As Long = (&H42000000 + 3500)
'hCard is a valid handle returned by SCardConnect
'lReturn = SCardConnect(hContext, sReader, eShareMode, ePreferredProtocol, hCard, eActiveProtocol)
'With card on reader: eShareMode = SCARD_SHARE_SHARED, ePrefferedProtocol = SCARD_PROTOCOL_Tx
'Without card on reader: eShareMode = SCARD_SHARE_DIRECT, ePrefferedProtocol = SCARD_PROTOCOL_UNDEFINED
Dim abIn() As Byte
Dim abOut() As Byte
Dim lInLength As Long
Dim lOutLength As Long
Dim lReturn As Long
Dim lReturnedLength As Long
'Command for turning off Buzzer output during card detection
lInLength = 5
ReDim abIn(lInLength - 1)
abIn(0) = &HFF
abIn(1) = &H0
abIn(2) = &H52
abIn(3) = &H0
abIn(4) = &H0
lOutLength = 256
ReDim abOut(lOutLength - 1)
lReturn = SCardControlAny(hCard, _
IOCTL_CCID_ESCAPE, _
abIn(0), lInLength, _
abOut(0), lOutLength, _
lReturnedLength)
'with card on reader: lReturn = ERROR_BAD_COMMAND
'without card on reader: lReturn = ERROR_INVALID_FUNCTION
Mind you for using Escape I also added the ControlEscapeEnable
to the registry (just for the sake of it I added it in several places)
First I did everything without loading a special driver (other than what Windows 10 itself already got), but due to Samuel Adam's remark I loaded the latest from ACS website but it didn't make a difference.
It's really driving me crazy, just like it's also driving me crazy that WebUSB doesn't allow it anymore so I would have been able to use a webbased version.