Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Newsgroups > Vista security

Vista - Vista: OpenService() returns Access Denied

Reply
 
Old 09-25-2006   #1 (permalink)
Mark Findlay


 
 

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!


My System SpecsSystem Spec
Old 09-25-2006   #2 (permalink)
Jane C


 
 

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!
>


My System SpecsSystem Spec
Old 09-26-2006   #3 (permalink)
Mark Findlay


 
 

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!
>>

>


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Access denied: Vista from XP Network & Sharing
Attaching to Vista shared folder from MSDOS returns Error 5: Access has been denied Vista networking & sharing
Access Denied, Access Denied- like a broken record! Vista General
When standard users access Vista registry remotely, Access Denied Vista account administration
Access Denied trying to access Vista PC Vista networking & sharing


Vista Forums 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 Ltd

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