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

Shaitan00

Well-known member
Joined
Aug 11, 2003
Messages
343
Location
Hell
I have a little situation that I cant 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). Ive already tried creating a service to mirror HKCU->HKLM but the LocalSystem doesnt seem to have an HKCU at all - so that doesnt 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,
 
There is an absolute path to any users root registry key (they are all located in HKEY_USERS), but you would need to figure out which one belongs to the current user and have admin access to use the keys this way.
 
Back
Top