Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Vista Newsgroups > Vista security

Vista: OpenService() returns Access Denied

Closed Thread
 
Thread Tools Display Modes
Old 09-25-2006   #1 (permalink)
Mark Findlay
Guest


 

Vista: OpenService() returns Access Denied

Our win32 app opens the Task Scheduler to enumerate tasks as follows:

SC_HANDLE hSC = NULL;
SC_HANDLE hSchSvc = NULL;

hSC = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if (hSC == NULL) return GetLastError();
hSchSvc = OpenService(hSC, "Schedule", SERVICE_START |
SERVICE_QUERY_STATUS);

This works fine on current Windows platforms, but on Microsoft Vista the
OpenService fails and GetLastError() returns 5 ("Access Denied").

We get this even when the app is running under Admin context, and have also
tried setting the app's security privilege to SE_DEBUG_NAME.

Is this just a Vista BETA issue at this point, or is there a new security
mechanism in place that we need to program for (and if so, what changes do
we need to make)?

Thanks!

Old 09-25-2006   #2 (permalink)
Jane C
Guest


 

Re: Vista: OpenService() returns Access Denied

http://msdn.microsoft.com/windowsvis...e/default.aspx

Sections on Application Compatibility and Security, which explains the new
User Access Control.

--
Jane, not plain 64 bit enabled :-)
Batteries not included. Braincell on vacation ;-)
"Mark Findlay" <mfindlay@speakeasy.org> wrote in message
news:uF5JpRN4GHA.508@TK2MSFTNGP06.phx.gbl...
> Our win32 app opens the Task Scheduler to enumerate tasks as follows:
>
> SC_HANDLE hSC = NULL;
> SC_HANDLE hSchSvc = NULL;
>
> hSC = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
> if (hSC == NULL) return GetLastError();
> hSchSvc = OpenService(hSC, "Schedule", SERVICE_START |
> SERVICE_QUERY_STATUS);
>
> This works fine on current Windows platforms, but on Microsoft Vista the
> OpenService fails and GetLastError() returns 5 ("Access Denied").
>
> We get this even when the app is running under Admin context, and have
> also tried setting the app's security privilege to SE_DEBUG_NAME.
>
> Is this just a Vista BETA issue at this point, or is there a new security
> mechanism in place that we need to program for (and if so, what changes do
> we need to make)?
>
> Thanks!
>


Old 09-26-2006   #3 (permalink)
Mark Findlay
Guest


 

Re: Vista: OpenService() returns Access Denied

Thanks Jane,

I've been through a good chunk of the site you referenced and it appears
that we're not in Kansas anymore It looks like I need to create an
Application Manifest and rebuild the app with this in order to enable the
admin privileges necessary to execute the OpenService() call. Also, it
appears that I need to rebuild with Visual Studio 7 (I am currently using
Visual Studio 6) in order to include the Application Manifest. Finally, I
will also need to digitally sign the application.

I am going to proceed along these lines. Meanwhile, am I on the right track
with this? Any other advice you would offer to a Vista novice at this point?

Thanks!
Mark

"Jane C" <jellybean@nospam.xjgarage.org> wrote in message
news:62484171-68FC-40A5-88B9-5C840FE8E6E2@microsoft.com...
> http://msdn.microsoft.com/windowsvis...e/default.aspx
>
> Sections on Application Compatibility and Security, which explains the new
> User Access Control.
>
> --
> Jane, not plain 64 bit enabled :-)
> Batteries not included. Braincell on vacation ;-)
> "Mark Findlay" <mfindlay@speakeasy.org> wrote in message
> news:uF5JpRN4GHA.508@TK2MSFTNGP06.phx.gbl...
>> Our win32 app opens the Task Scheduler to enumerate tasks as follows:
>>
>> SC_HANDLE hSC = NULL;
>> SC_HANDLE hSchSvc = NULL;
>>
>> hSC = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
>> if (hSC == NULL) return GetLastError();
>> hSchSvc = OpenService(hSC, "Schedule", SERVICE_START |
>> SERVICE_QUERY_STATUS);
>>
>> This works fine on current Windows platforms, but on Microsoft Vista the
>> OpenService fails and GetLastError() returns 5 ("Access Denied").
>>
>> We get this even when the app is running under Admin context, and have
>> also tried setting the app's security privilege to SE_DEBUG_NAME.
>>
>> Is this just a Vista BETA issue at this point, or is there a new security
>> mechanism in place that we need to program for (and if so, what changes
>> do we need to make)?
>>
>> Thanks!
>>

>


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attaching to Vista shared folder from MSDOS returns Error 5: Access has been denied S. Johnson Vista networking & sharing 2 3 Weeks Ago 12:16 PM
Access Denied, Access Denied- like a broken record! Sam Vista General 7 04-25-2008 11:54 PM
When standard users access Vista registry remotely, Access Denied Gayle Vista account administration 1 10-10-2007 11:48 AM
Access Denied trying to access Vista PC Ron Vista networking & sharing 7 09-30-2007 09:45 AM
Access denied to Vista from XP Llew Ralph Vista networking & sharing 4 04-08-2007 05:48 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50