OpenSCManager fails access denied

D

Dave G

I have an application on Vista that calls OpenSCManager():

hSCManager = ::OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
and is returning access denied.

This happens even if I am logged in as a user in the Administrators group
and run the program set to "Run as Administrator" to elevate privileges.

This code runs without a problem on Windows XP.

Is there some extra privilege I need? What am I missing?
 
D

Dave G

I was mistaken in where the error is occurring.

It is not in the OpenSCManager() call, it is actually occuirring in my next
call:
DWORD dwDesiredAccess = SERVICE_CHANGE_CONFIG | SERVICE_START |
SERVICE_QUERY_STATUS | SERVICE_PAUSE_CONTINUE;

hService = ::OpenService(hSCManager, _T("Schedule"), dwDesiredAccess);

The code is trying to open the Task Scheduler service. This was possible on
XP, but is no longer working on vista.

I noticed that the Task Scheduler service appears to be special when looking
at it in the Services applet - all fields are disabled. Perhaps even the
administrator user has limited access to it? Perhaps the
SERVICE_CHANGE_CONFIG access is just invalid now for this service?

Does anyone have any more info on this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top