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


On Feb 14 16:22, Stephan Mueller wrote:
> 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. 

Cygwin is using fooW functions, so we should be on the safe side.
Except that a big Windows environment tends to move the usual
start addresses of the stack from the usual 0x30000 to something
else.  This can unfortunately break fork if the Windows environment
is >64K and the Windows environment changed in the forking process.


Corinna


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgp33Aw_gnZoQ.pgp
Description: PGP signature


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