After calling RegConnectRegistry(...) to open the registry on a remote machine, is it not possible to expand environment variables? I have looked at ExpandEnvironmentStrings and ExpandEnvironmentStringsForUser, but that only appears to be useful on the local machine. I think it must be possible considering that RegistryKey.GetValue() in .Net does expand the variables after calling RegistryKey.OpenRemoteBaseKey(), but I need to do this outside of .Net.
Any ideas?