I am resolving this ticket. The problem with the environment variable is due to the use of getenv() vs GetEnvironmentVariable(). We need to move to using the non-C RTL version which can only see the contents of the RTL state and not that of the process as a whole.