Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application unable to access hardware when run as service

Status
Not open for further replies.

mzielinski1234

IS-IT--Management
Apr 26, 2012
2
0
0
Hello everyone,

I have an application which depends on EZ 100 PU smart card reader. The application may be installed as a service or run from command line. I created a service user for the application, installed it and configured logon account to this user. Application was unable to enumerate readers when I started it as a service.
Then I tried to start it in interactive mode. I used exactly the same user, same binary and it worked perfectly.

So, the question is - is anyone aware of any possible limitations, security settings or policies that may cause service not to be able to access hardware (or maybe drivers?). I'm pretty sure it has nothing to do with user permissions or hardware drivers, as that problem happens only when application is run as service.

Cheers,
Mike
 
You need to grant that account "Log on as a Service" rights through the Administrative Tools, Local Security Policy. It's found in the Local Policies/User Rights Assignments screen.

John
 
John,

you are right, that is required, and thank you for the answer. However the reason was completely different - I found it myself, but probably others might use the solution as well, so here it is:

"SCardEstablishContext API is returning that error because it gets an Access Denied error when trying to open an event called "Global\Microsoft Smart Card Resource Manager Started" with OpenEvent API. The default security for that event on Vista and Windows 7 specifies that only SYSTEM, LOCAL SERVICE and INTERACTIVE users have access to it. NETWORK SERVICE or non-interactive users won’t be able to access the event."

It's just a part of larger article which can be found here:
SCardEstablishContext fails with SCARD_E_NO_SERVICE error

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top