The RDF_TRANSMIT callback function performs data transmissions.
NTSTATUS
(*ReaderFunction[RDF_TRANSMIT])(
PSMARTCARD_EXTENSION SmartcardExtension
);
When this function is called, SmartcardExtension->IoRequest.RequestBuffer points to a SCARD_IO_REQUEST structure followed by data to be transmitted:
typedef struct _SCARD_IO_REQUEST{
DWORD dwProtocol; // Protocol identifier
DWORD cbPciLength; // Protocol Control Information Length
} SCARD_IO_REQUEST, *PSCARD_IO_REQUEST, *LPSCARD_IO_REQUEST;
The dwProtocol member must contain the protocol identifier that was returned by a call to IOCTL_SMARTCARD_SET_PROTOCOL.
The cbPciLength member contains the size of this structure, which is usually eight. This structure will be used mainly for future implementations.
The structure is followed by (protocol) data to be transmitted to the card. Depending on the protocol to be used for this transmission, the library offers several support functions. See SmartcardT0Request (WDM), SmartcardT0Request (VxD), and SmartcardT1Request (WDM), SmartcardT1Request (VxD).
Note RequestBuffer and ReplyBuffer point to the same system buffer. If you use the library function SmartcardxxRequest and SmartcardxxReply, you do not have to worry that you might overwrite the input buffer. If you do not use these functions, make a copy of the RequestBuffer before you start transmissions.
The implementation requires you to copy the SCARD_IO_REQUEST structure to the ReplyBuffer, followed by the data received from the card. Again, if you use the SmartcardxxRequest and SmartcardxxReply functions, you do not need to copy the structure because the library does this.
This function returns an NTSTATUS value. Possible values are the following.
Value | Meaning |
---|---|
STATUS_SUCCESS | Transmission successful. |
STATUS_NO_MEDIA | No card is in the reader. |
STATUS_IO_TIMEOUT | The request has timed out. |
STATUS_INVALID_DEVICE_REQUEST | The protocol defined by dwProtocol is invalid. |