Issues with using ControlService(hService, CustomCommand) and VISTA/Windows7?

This is a discussion on Issues with using ControlService(hService, CustomCommand) and VISTA/Windows7? within the Windows Programming forums, part of the Platform Specific Boards category; I currently have a Windows Service written in C# .NET 2.0 which is automatically started and runs under the LocalSystem ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    5

    Question Issues with using ControlService(hService, CustomCommand) and VISTA/Windows7?

    I currently have a Windows Service written in C# .NET 2.0 which is automatically started and runs under the LocalSystem account - lets call it Serv.exe - this service is responsible for performing administrative tasks (a bunch of them).

    There is another application (lets call it A.exe written in C++) which is run under the USER account (non-administrator), this application communicates with the Service (Serv.exe), using custom commands (ControlService(hService, CustomCommand) to tell it what task to perform.

    Now - this all works perfectly fine right now, using Windows 2000 and XP - but will this cause problem when migrating to VISTA and Windows7? I know people mentioned that in Vista services run in a different session (not exactly sure what that entails) - will there be any issues using ControlService(...) under OS's past XP?

    Key point to recall is that A.exe (non-admin user account) is communicating with Serv.exe (Local System service) to perform tasks like:
    - copy files, delete files, move files
    - extract files, zip files
    - run setup.exe's, apply .MSI files
    - register COM objects
    - affecting the registry
    - etc...
    (pretty much anything you could image)

    I need to know if there will be porting problems, if so I'll completly change my approach now (while I have the time).
    (and use Named Pipes instead)

    The reason I was using ControlService(...) instead of Pipes or Sockets is due to the fact that I only communicate with the service once every 20-30mins and only to request a specific operation be performed (simply send a single integer one-way), I thought pipes/sockets might be overkill for my needs ... I could be wrong ...

    Looking for some advice, any help would be much appreciated...
    Thanks,

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    612
    The default permissions allowed on a user installed service are as follows:

    C:\Users\Adrian\Desktop>qd svc testservice
    Security Info for testservice

    Owned by: NT AUTHORITY\SYSTEM

    ACCESS RIGHTS
    -----------------

    NT AUTHORITY\SYSTEM has access 0x201fd and can:
    Read the Security Descriptor

    Query Config
    Query Status
    Enumerate Dependents
    Start Service
    Stop Service
    Pause and Continue
    Interrogate
    User-defined Control

    BUILTIN\Administrators has access 0xf01ff and can:
    Delete the Object
    Read the Security Descriptor
    Write/Amend the Object DACL
    Write/Amend the Object Owner

    Access All Object Specific Permissions

    NT AUTHORITY\INTERACTIVE has access 0x2018d and can:
    Read the Security Descriptor

    Query Config
    Query Status
    Enumerate Dependents
    Interrogate
    User-defined Control

    NT AUTHORITY\SERVICE has access 0x2018d and can:
    Read the Security Descriptor

    Query Config
    Query Status
    Enumerate Dependents
    Interrogate
    User-defined Control
    As long as your non-admin account is logged on interactively, and the handle is opened with any of SERVICE_QUERY_CONFIG, SERVICE_QUERY_STATUS, SERVICE_INTERROGATE, SERVICE_ENUMERATE_DEPENDENTS, GENERIC_READ, or a combination thereof, everything will be fine and dandy. Anything else will get you an access denied error unless you modify the DACL to allow the non-admin account explicit access (achieved by SetServiceObjectSecurity() on the handle returned by CreateService()).

    You'll have to do some testing on your service's actions as in Vista and 7 the LocalSystem account is not quite the godfather it once was, but from the actions you mentioned it should be OK.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging Issues
    By jl864405 in forum C Programming
    Replies: 6
    Last Post: 06-05-2009, 06:40 PM
  2. Speed issues
    By Govtcheez in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-22-2005, 04:06 AM
  3. Directx issues
    By dpro in forum Game Programming
    Replies: 7
    Last Post: 03-30-2005, 01:58 PM
  4. Memmory Issues and Threads
    By ddod in forum Windows Programming
    Replies: 2
    Last Post: 08-13-2004, 11:30 AM
  5. hexdump issues
    By daluu in forum C Programming
    Replies: 2
    Last Post: 03-04-2003, 09:01 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21