I'm developing a c++
application, using Visual Studio 2017.
I'm using the windows library winscard.
I'm starting with a simple project where i'm calling the function SCardEstablishContext
as the first step needed to read a smart card.
The snippet of code i'm using is the following:
LONG resContext = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hSC);
if (resContext != SCARD_S_SUCCESS) {
printf("Failed\n");
printf("Error %X\n", resContext);
}
What i know is that this function use the windows service called "Smart Card" to get the scope within which database operations are performed (read/write cards).
Unfortunately this simple application works (i.e. return the SCARD_S_SUCCESS
code) only in windows 7 environment. In all the windows 10 systems that i tested the return code is always 0x8010001DL
that is associated to the define SCARD_E_NO_SERVICE
that assert:
The Smart Card Resource Manager is not running.
On windows 7 systems the program works without admin privileges, on windows 10 systems i've tried with admin privileges too but the error is the same.
In every windows 10 system that i tested i manually started the service "Smart Card" before testing my program and checked that it still running while testing.
In both windows 7 and windows 10 systems i don't have a smart card reader connected.
The winscard.lib
file i use come with Microsoft Windows SDK
version 10.0.17763.0
There's something extra to do to get it works with windows 10?
Smart Card Subsystem (and Resource Manger) must work "out of the box".
Try to install some smart card drivers that present virtual slots to the system.
For example this one.
Are you working via RDP?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With