I am working now with Marks contextKeyword solution. Thank you all for your help.
I can tell that I can not GetRegistry for anything in HKEY_CURRENT_USER\Environment.
Can you tell me where it is documented that in Windows 7 no one can read this entry?
( I can set the value with SetRegistry.)
It would be good to know which items in Windows 7 registry can and can not be read.