DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Service not running for Impersonated user with CreateProcessAsUser [C#]

  1. #1
    Join Date
    Feb 2005

    Question Service not running for Impersonated user with CreateProcessAsUser [C#]

    There is a LocalSystem Service (Job.exe) which performs a certain absolutly required task (for example: file system watching), this service is run for all users (at least when they logon).
    There is another LocalSystem Service (Serv.exe) which uses CreateProcessAsUser(...) to launch a process as a different (admin) user.
    There are 2 accounts, USER (which is the one logged-on) and ADMIN.

    So this is the scenario ...
    User logs in to USER account (non-admin) and both LocalSystem Services (Job.exe & Serv.exe) start and work without any problems... Then at a certain point Serv.exe calls CreateProcessAsUser() using the ADMIN account in order to launch an administrative task (note that USER is currently logged in).

    So far everything is fine - but now a problem happens - the process run by CreateProcessAsUser(...) under the ADMIN is not subject to the LocalSystem service JOB.exe - for example if JOB.exe monitors file-system changes and logs them if I launch a task with CreateProcessAsUser(...) under ADMIN that changes files I would assume JOB.exe would log these - but it does NOT ...

    So it looks like JOB.exe is NOT running in the context of the ADMIN account when launched using CreateProcessAsUser(...), this is a big deal for me - I need to ensure JOB.exe LocalSystem service is absolutly always running - even when CreateProcessAsUser(...) is used...

    Is there anything I can do to solve this problem? any help would be much appreciated.
    Can I load the environment? profile? something to kick-in JOB.exe so that it actually works?


  2. #2
    Join Date
    Feb 2005
    JOB.exe is legacy software that monitors registry and file system changes - sadly I don't have the source code available to show exactly how it works but ... it works fine for the logged-in user.

    Do I maybe have to do something special to my CreateProcessAsUser() to load the environment? Profile? etc... I also noticed that accessing HKEY_CURRENT_USER doesn't seem to work ...

Similar Threads

  1. Replies: 2
    Last Post: 04-18-2007, 02:34 AM
  2. Web User Control and javascript
    By s in forum ASP.NET
    Replies: 0
    Last Post: 03-26-2003, 03:17 PM
  3. question on web service accessing middle-tier
    By in forum .NET
    Replies: 0
    Last Post: 12-03-2002, 11:54 AM
  4. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  5. Replies: 0
    Last Post: 07-20-2001, 06:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center