IOCTL_SMARTCARD_TRANSMIT transfer size.

Hi all,
I have an upper filter driver for Smart card devices. The documentation for IOCTL_SMARTCARD_TRANSMIT seem to indicate that both the in and out data would be of variable size.
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/winsmcrd/ni-winsmcrd-ioctl_smartcard_transmit

However, IOCTL_SMARTCARD_TRANSMIT request from host (presumably from the smart card service) has a variable size input buffer but the out buffer size is always set to 272 bytes. Since the transfer would be of APDU format, I would expect the max size to be 258 bytes (short APDU: 256 data + 2 bytes of status). Wondering why is this always set to 272? Why not 512? What am I missing? To be clear, I have a completion routine installed which shows varying output data sizes as expected. Thanks.

Right, short APDU command is limited to 260 bytes while short APDU response is limited to 258 bytes. However, both input and output buffers include the SCARD_IO_REQUEST header, that is, extra 8 bytes. I don’t know why SCardSvr service output buffer is exactly 272 bytes but 258 would have been clearly insufficient.

Regards,

Ilya Faenson
Rockville, MD USA