Attempt to modify registry from within a service fails in some situations?
<p>Again I am working on my Windows service and tried to modify the shell registry entry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon:Shell).</p>

<p>Initially I tried to do that in the ServiceControlHandler routine when the SERVICE_CONTROL_STOP arrives. That worked during testing by starting/stopping the service as long was is was logged on (I could see that the value changed). But when I going to shutdown/reboot the system, the value didn't changed.</p>

<p>Next I tried to do the same when user logs on or off (triggered by SERVICE_CONTROL_SESSIONCHANGE in the ServiceControlHandler). To verify that may code should work in general I tried to modify the key in case of WTS_SESSTION_LOGOFF and WTS_SESSION_LOCK - I could see that the value changed after locking/unlocking the system. Once again, when I really logoff the value didn't change.</p>

<p>Do you have any ideas why this does not work?</p>