Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    74
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question Finding a way to access CURRENT_USER registry as a LocalSystem Service [C#]

    I have a little situation that I can't seem to resolve and was hoping someone might have some suggestions ...

    I have a Windows Service (Serv.exe) which runs under LocalSystem when a user is logged-on (it is only running when users are logged-on), this service is responsible for performing various administrative tasks, one of which is applying registry (.reg) files when needed.

    The Services uses REGEDIT (/s /i) to merge in the registry files (.reg) - and this is where things get rough - these registry files related to HKEY_CURRENT_USER (for the user currently logged on) - obviously this causes issues because regedit is being run as a LocalSystem (which is not currently in the HKCU of the user itself) ...

    Is there anything I can do?
    Can I somehow LINK to the users HKCU so that when I apply the .REG file it updates the users registry?
    Can I mirror or reflex the changes somehow?

    From where I stand my only solution would be to create my own REG EDIT that would redirect to the logged-on users HKCU (which would be a pain). I've already tried creating a service to mirror HKCU->HKLM but the LocalSystem doesn't seem to have an HKCU at all - so that doesn't help ...

    Key point - I do NOT have the username & password of the User account so I cannot use Impersonation... And even there I need admin access to perform my changes.

    Any help would be greatly appreciated...
    Thanks,

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Well keep in mind that this problem is even more complex because there could be more than one user logged into the system at the same time.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •