This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Interesting footnote about environment variables block


Andrey Repin wrote:

> http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?pf=true
> 
>> The maximum total environment variable size for all variables, which
>> includes variable names and the equal sign, is 65,536KB.

The actual limit, on old OSes (such as Windows XP) is 64KB or 65536 bytes.  This text appears to contain a typo; likely someone decided to change from one representation to the other, and forgot to change the units when they changed the number.  Newer OSes have lifted the 64KB limitation; I forget exactly when. 

> http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspx
> (And consequently,
> http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
> )

These docs are the documentation for the CreateProcess API.  I'm guessing the relevant text here is:

	The ANSI version of this function, CreateProcessA fails if the total size of the environment block for the process exceeds 32,767 characters.

The limit described here is independent of the one in the XP documentation.  The typical behaviour of a large number of Windows FooA APIs is to widen their argument strings from ANSI to UTF-16, and then call the FooW API to do the actual work.  The 32K limit here is likely related to the size of the buffer used for the temporary wide copy of the argument.

> I don't know, how it is applicable to Cygwin.

Likewise. 

stephan();


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]