Important!

Blog moved to https://blog.apdu.fr/

I moved my blog from https://ludovicrousseau.blogspot.com/ to https://blog.apdu.fr/ . Why? I wanted to move away from Blogger (owne...

Thursday, August 19, 2010

pcsc-lite 1.6.x breaks some programs at compilation

Minor API change


pcsc-lite 1.6.x makes the compilation of some badly written programs to fail. Badly written programs include my owns: pcsc-tools and pcsc-perl.

SCARD_READERSTATE_A


Windows uses two versions for the SCARD_READERSTATE structure:
  • SCARD_READERSTATE_W

    If UNICODE is defined and the szReader field is a LPCWSTR using wide characters
  • SCARD_READERSTATE_A

    If UNICODE is not define and the szReader field is a LPCSTR using normal characters

Since Unix uses UTF-8 instead of UTF-16 we do not need those stupid wide characters. Every string (ASCII or Unicode or what ever encoding) is a char [].

The problem is that the Windows winscard API only uses SCARD_READERSTATE externally and programs should never use SCARD_READERSTATE_W or SCARD_READERSTATE_A.

pcsc-lite 1.6.2 removed the definition of SCARD_READERSTATE_A PSCARD_READERSTATE_A and LPSCARD_READERSTATE_A types

LPSCARD_READERSTATE


This type was missing and has been added in pcsc-lite 1.6.3. pcsc-lite up to 1.6.1 defined LPSCARD_READERSTATE_A instead and we have seen why it was a bad idea.


SCARD_W_INSERTED_CARD


The SCARD_W_INSERTED_CARD error code was specific to pcsc-lite and was never used. I removed its declaration.

If your code uses it just remove the line.

No ABI change


Only the compilation of some programs will fail. The execution should not fail. The ABI (Application Binary Interface) has not changed.


Flattr this