Ok after many hours I think that I found an issue in SCARD_CTL_CODE 
definition on file "internal-winscard.h"

see definition of SCARD_CTL_CODE:

#ifndef SCARD_CTL_CODE
#define SCARD_CTL_CODE(code) (0x42000000 + (code))
#endif

It's ok for linux platform but for WIN32 platform it should be something 
like this:

#define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
#define SCARD_CTL_CODE(x) CTL_CODE(0x31,x,0,0)

I have a look on all the file and I see an #include <winscard.h> witch 
contains the good definition

I suppose the issue come with new system for windows based on a 
cross-compilation .

If a define for cross compilation WIN target exist I propose to change 
the code:


#ifndef SCARD_CTL_CODE
#define SCARD_CTL_CODE(code) (0x42000000 + (code))
#endif

by something like this:

#ifndef SCARD_CTL_CODE
    #ifdef DEFINE_FOR_WINDOWS
        #define CTL_CODE(t,f,m,a) (((t)<<16)|((a)<<14)|((f)<<2)|(m))
        #define SCARD_CTL_CODE(x) CTL_CODE(0x31,x,0,0)
    #else
        #define SCARD_CTL_CODE(code) (0x42000000 + (code))
    #endif
#endif

for DEFINE_FOR_WINDOWS I don't know what it could be.... I suppose 
_WIN32 is defined by VisualC ?

If someone can help.

Regards

François Leblanc.



Fleblanc a écrit :
> Opensc release 0.11.6
>  
> Platform Windows XP
>
> Reader XIRING CCID with pinpad
>
>
> Two things:
>
> First when I connect this reader and other  PCSC readers when I use 
> pkcs15-tool  I have the message "Card not present"
>
> In other word, the XIRING reader with pinpad must be alone to work...
>
> Second, I have absolutly no idea why but SCardControl fail with code 1 ...
>
> I have a look to the code all seems good but...
>
> I've tryed sample program and it's working fine but in opensc not, it's 
> amazing:
>
> [westcos-tool.exe] reader-pcsc.c:565:pcsc_connect: Requesting reader 
> features ...
> [westcos-tool.exe] reader-pcsc.c:618:pcsc_connect: SCardControl failed 1
>
> Does anyone have some problem too with pcsc on windows?
>
> Regards.
>
> _______________________________________________
> opensc-devel mailing list
> opensc-devel@lists.opensc-project.org
> http://www.opensc-project.org/mailman/listinfo/opensc-devel
>
>   
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to