Services and the Registry

A service should not access HKEY_CURRENT_USER or HKEY_CLASSES_ROOT, especially when impersonating a user. Instead, use the RegOpenCurrentUser or RegOpenUserClassesRoot function.

If you attempt to access HKEY_CURRENT_USER or HKEY_CLASSES_ROOT from a service it may fail, or it may appear to work but there is an underlying leak that can lead to problems loading or unloading the user profile.

 

 

Show: