The answer above is incorrect. This is because here we are not talking about the ISO 7816 team, but about the internal PC / SC API team.
The APDU "0xFF 0xCA 0x00 0x00 0x00" is actually correct, and I have cards for which I get a 7-byte response. Please note that this will only work with contactless (RFID) cards, because this UID is part of the radio protocol. Note that some chips return a new random UID after each power-up. This, for example, is true for my passport chip, as well as my German national ID and countermeasures, to prevent tracking of cardholders. Theoretically, such random UIDs start with 0x08, but this is not always the case.
Since the UID is the "internal" value of the protocol, the APDU in question is NOT sent to the card, but is only an internal command (PC / SC interface) to get the UID from the card reader driver. CLA 0xFF is usually not used in normal mode, since it is only used for reserved for "Protocol Parameter Selection" (PPS). PC / SC violates this CLA for internal commands.
This command is an internal PC / SC Get Data command specified in Part 3 of Section 3.2.2.1.3 of the PC / SC Specification. Here P1 and P2 have special predefined values, so it makes no sense to try to use different values. The standard defines only P1 = 0, P2 = 0 to get the UID and P1 = 1, P2 = 0 for "all historical bytes from the ATS card ISO 14443 A without CRC". Other values are not supported.
Interestingly, the answer 0x6A 0x88 is not defined in the standard. 0x6a 0x81 means "Function is not supported", which would be the case for cards that do not have a UID (the standard mentions contact card 7816-10). Two other specific answers (0x62 0x82 and 0x6C 0xXX) determine the discrepancy between the requested response length and the actual amount of data and will not arise here, because we simply request the length data, indicating 0 in the last byte of the request.
So why doesn’t it work for a submitter whom I don’t know. This works for me, some cards return 4 bytes, others return 7 bytes.
See PC / SC standard, part 3, in particular: http://www.pcscworkgroup.com/specifications/specdownload.php