Search code examples
c++visual-studio-2010google-chrome-extensiongoogle-nativeclient

PNACL – using winscard lib


I’m developing Portable Native Client application which works with the smart card. For this purpose, I want to include winscard library to my project. Currently I failed at the stage of compilation.

I added a line in my source file

#include <winscard.h>

and the path in Additional Include Directories

C: \ Program Files (x86) \ Microsoft SDKs \ Windows \ v7.1A \

I received an error

C: \ Program Files (x86) \ Microsoft SDKs \ Windows \ v7.1A \ Include \ windows.h (151,10): fatal error: 'excpt.h' file not found

Then I added a path to excpt.h

C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ VC \ include

and I received the following error

1> chromesign.cc 1> C:\Dev\Lib\nacl_sdk\vs_addin\examples\chromesign\In file included from chromesign.cc(27): 1> C:\Dev\Lib\nacl_sdk\pepper_43\include\ppapi\cpp\instance.h(11):'In file included from C' 1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\map(6):'In file included from C' 1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(6):'In file included from C' 1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xfunctional(6):'In file included from C' 1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\cstdlib(5):'In file included from C' 1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\yvals.h(6):'In file included from C' 1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(44,2): error : ERROR: Only Win32 target supported! 1>NACLCOMPILE : #error error : Only Win32 target supported!

Does anyone know how to fix this error or another way to use winscard lib in PNACL application?


Solution

  • windows.h is a Windows-specific header. PNaCl doesn't support such headers because it has to be portable and work across operating systems while securing users from malicious / buggy .pexe files.

    winscard itself is Windows specific, and will not work either. There are proposals to make smart card access from the browser possible. I recommend looking there first. The answer to your question: this cannot work as-is in PNaCl.

    You can, however, look into using native messaging if its restrictions suit your needs.