GetEnvironmentString returns strings that start with =
Original Reporter info from Mantis: Vincent
-
Reporter name: Vincent Snijders
Original Reporter info from Mantis: Vincent
- Reporter name: Vincent Snijders
Description:
The GetEnvironmentString function may return strings that start with a '=' on windows.
As said in http://lists.freepascal.org/lists/fpc-pascal/2006-December/012834.html this may break code that expect the environment strings in the format VAR=VALUE.
Steps to reproduce:
Run the attached program in a command prompt window.
Additional information:
The reason for these kind of 'hidden' variables is mentioned on this page:
http://msdn2.microsoft.com/en-us/library/ms682425.aspx
If an application provides an environment block, the current directory information of the system drives is not automatically propagated to the new process. For example, there is an environment variable named =C: whose value is the current directory on drive C. An application must manually pass the current directory information to the new process. To do so, the application must explicitly create these environment variable strings, sort them alphabetically (because the system uses a sorted environment), and put them into the environment block. Typically, they will go at the front of the environment block, due to the environment block sort order.
Mantis conversion info:
- Mantis ID: 7967
- OS: Windows
- OS Build: XP Home SP2
- Build: 2.1.1-r5588M
- Platform: i386
- Version: 2.2.0
- Fixed in revision: 219 (#77ba5224)