VMWare Virtual CCID reader optimization problem

The problem: a smart card is working with the smart card reader attached directly to a virtual machine, but not using the shared smart card reader (VMWare Virtaul USB CCID).

vmware1

The problem is caused by APDU not returning the same result. We are using SCardDemo.exe for our tests.

On the host computer:

vmware2

On the virtual machine:

vmware3

If we examine closely the command send to the card using rohitab API Monitor, we find that the APDU send is not exactly the same.

On the host computer:

vmware4

When run on the virtual machine (captured from vmware-vmx.exe)

vmware5

The last byte is stripped !

Indeed, when we run the APDU without the last byte to the card from the host computer, we get exactly the same result.

If we look at the buffer allocated by VMWare (258 bytes) it is 256 bytes, the maximum length encoded in one byte + 2 bytes for the SW1/SW2.