IOCTL_SMARTCARD_TRANSMIT

WDM driver version:

The IOCTL_SMARTCARD_TRANSMIT DeviceIoControl operation transmits data to and receives data from the currently inserted smart card.

Input

Irp->AssociatedIrp.SystemBuffer
Points to an SCARD_IO_REQUEST structure followed by the data to be transmitted. An SCARD_IO_REQUEST structure has the following definition:
typedef struct _SCARD_IO_REQUEST{
    DWORD dwProtocol;   // Protocol identifier
    DWORD cbPciLength;  // Protocol Control Information Length
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
 
Irp->AssociatedIrp.SystemBuffer
Contains the data to be transmitted to the currently inserted smart card.
Parameters.DeviceIoControl.InputBufferLength
Contains the size of the structure plus the length of trailing data bytes (if any). The member dwProtocol must be set to the previously selected protocol, and cbPciLength must be set to the size of the SCARD_IO_REQUEST structure itself (usually eight). The structure will be used for future protocols. Any data that is to be transmitted to the card must immediately follow this structure.
Parameters.DeviceIoControl.OutputBufferLength
Contains the length of the output buffer.

Output

Irp->AssociatedIrp.SystemBuffer
Receives the result of the transmission. This buffer must also begin with an SCARD_IO_REQUEST structure. Any data that was received from the card must be stored immediately after the structure.

Since the input buffer and the output buffer are pointing to the same memory area, it is the driver's responsibility to avoid overwriting the input data. Use the Smart Card Driver Library to ensure that the input data is not overwritten.

I/O Status

Information receives the size of the SCARD_IO_REQUEST structure plus the number of bytes received from the card. Status can be:

Status Meaning
STATUS_SUCCESS The transmission was successful.
STATUS_NO_MEDIA No card in reader.
STATUS_IO_TIMEOUT The operation has timed out.
STATUS_INVALID_DEVICE_STATE The protocol in the header does not match the previously selected card protocol.

VxD driver version:

The IOCTL_SMARTCARD_TRANSMIT DeviceIoControl operation transmits data to and receives data from the currently inserted smart card.

Input

DiocParams->lpvInBuffer
Points to an SCARD_IO_REQUEST structure, which has the following definition:
typedef struct _SCARD_IO_REQUEST{
    DWORD dwProtocol;   // Protocol identifier
    DWORD cbPciLength;  // Protocol Control Information Length
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
 
DiocParams->cbInBuffer
Contains the size of the structure plus the length of trailing data bytes (if any). The member dwProtocol must be set to the previously selected protocol, and cbPciLength must be set to the size of the SCARD_IO_REQUEST structure itself (usually eight). The structure will be used for future protocols. Any data that is to be transmitted to the card must immediately follow this structure.
DiocParams->cbOutBuffer
Contains the length of the output buffer.

Output

DiocParams->lpvOutBuffer
Receives the result of the transmission. This buffer must also begin with an SCARD_IO_REQUEST structure. Any data that was received from the card must be stored immediately after the structure.
DiocParams->lpcbBytesReturned
Receives the size of the SCARD_IO_REQUEST structure plus the number of bytes received from the card.

Return Values

Following are possible return values.

Value Meaning
STATUS_SUCCESS The transmission was successful.
STATUS_NO_MEDIA No card in reader.
STATUS_IO_TIMEOUT The operation has timed out.
STATUS_INVALID_DEVICE_STATE The protocol in the header does not match the previously selected card protocol.