You've exposed some softness in my thinking in this patch. Like I mentioned in the comments for it, _SHExpandEnvironmentVariables exists because the environment isn't actually set up during wine install time. I didn't think to look up the values in the registry.
I also didn't register some of the "environment" variables that I use, and probably should have.
You might rewrite it just to look at the registry. You probably want to look in HKLM\System\Current Control Set\Session Manager\Environment if the value you're looking for isn't in HKCU, and some variables should probably not be overridable in HKCU either (SystemRoot, for example).
--Juan
__________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com