Windows Vista and Services

Discussion in 'Windows 64bit' started by sncameron@gmail.com, Jan 25, 2007.

  1. Guest

    All the software that I work on that can be installed as a service (and
    any other software that will run as a service for that matter) doesn't
    appear to work under Vista if UAC is enabled. The problem is that the
    user is not prompted for elevated privileges, despite the correct call
    to OpenSCManager with the SC_MANAGER_CREATE_SERVICE access right. This
    call fails without ever prompting the user for elevated privileges.
    Turning UAC off means that the service is installed and started
    perfectly (as long as the user is logged in as the administrator, if
    they are not the call fails, but returns the expected error code and
    the user can be informed).

    I have read through every document that I can find regarding services
    and Vista on MSDN, and while they list the changes in Vista, such as
    the impact of services running in Session 0, none of them mention any
    API calls that are necessary in order to get the system to prompt the
    user for elevated privileges rather than simply having the API call
    fail.

    The irony is that Microsoft's own software behaves in the same manner,
    as do all their examples for services. Five years later and Vista still
    feels very half baked indeed.

    Any suggestions, or suggestion as to where I can look to get it to work
    would be appreciated!

    Regards,

    Sean Cameron
    , Jan 25, 2007
    #1
    1. Advertising

  2. Sean Cameron Guest

    On Jan 25, 3:12 pm, wrote:
    > All the software that I work on that can be installed as a service (and
    > any other software that will run as a service for that matter) doesn't
    > appear to work under Vista if UAC is enabled. The problem is that the
    > user is not prompted for elevated privileges, despite the correct call
    > to OpenSCManager with the SC_MANAGER_CREATE_SERVICE access right. This
    > call fails without ever prompting the user for elevated privileges.
    > Turning UAC off means that the service is installed and started
    > perfectly (as long as the user is logged in as the administrator, if
    > they are not the call fails, but returns the expected error code and
    > the user can be informed).
    >
    > I have read through every document that I can find regarding services
    > and Vista on MSDN, and while they list the changes in Vista, such as
    > the impact of services running in Session 0, none of them mention any
    > API calls that are necessary in order to get the system to prompt the
    > user for elevated privileges rather than simply having the API call
    > fail.
    >
    > The irony is that Microsoft's own software behaves in the same manner,
    > as do all their examples for services. Five years later and Vista still
    > feels very half baked indeed.
    >
    > Any suggestions, or suggestion as to where I can look to get it to work
    > would be appreciated!
    >
    > Regards,
    >
    > Sean Cameron


    The problem is that this happens when my application tries to install
    itself as a service, the call to OpenSCManager fails, because you
    cannot call OpenSCManager with the SC_MANAGER_CREATE_SERVICE access
    right without adminstrative privileges.

    Considering that logging in to Vista when using UAC creates two token,
    and tasks are performed with user privileges unless elevated, I though
    the the user would be prompted when OpenSCManager was called, and
    privilege elevation would occur. This seemed like the logical
    behaviour, however unfortunately you are completely correct and it is
    not the case.

    The solution that I have found so far it to either run the program as
    an administrator in the first place (right click, Run As
    Administrator), or to create a separate process to install and manage
    the service and call CreateProcessAsUser to start the process with
    administrative privileges. You should be able to do the same with with
    CreateProcessWithLogonW and CreateProcessWithTokenW. I will have to
    spend a bit of time playing with it and see what I come up with.
    Sean Cameron, Jan 25, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Szymi
    Replies:
    0
    Views:
    584
    Szymi
    Nov 3, 2003
  2. Matty

    TPM and Windows Vista TPM Services

    Matty, Dec 29, 2006, in forum: Computer Security
    Replies:
    0
    Views:
    471
    Matty
    Dec 29, 2006
  3. Windows Vista and Services

    , Jan 25, 2007, in forum: Computer Support
    Replies:
    0
    Views:
    2,655
  4. Clogwog
    Replies:
    0
    Views:
    492
    Clogwog
    Jul 7, 2007
  5. Nikki Bergeron
    Replies:
    0
    Views:
    1,304
    Nikki Bergeron
    Mar 20, 2010
Loading...

Share This Page