Truncated Environment Variables? - using Cygwin + GetEnvironmentStrings() WIN32 API

Kaveh Goudarzi kaveh@arkasoft.com
Sun Apr 30 04:41:00 GMT 2006


Hi,

	I'm working on an app which attempts to get
the environment of running cygwin apps.  It does this
by running the GetEnvironmentStrings() win32 api call
in the context of the running cygwin app (code injection).
However the result that comes back as a truncated version of
the environment - only 4 values PATH, SYSTEMDRIVE, SYSTEMROOT,
WINDIR.

	You can reproduce this by compiling envs.c attached.
(gcc -o envs-gcc.exe envs-gcc.c).  If you run the resulting exe
in cmd.exe (win xp) you get the full env in both cases but
if you run it under bash then the windows version is truncated.

	I saw the article below which seems relevant but I
was confused because my understanding of it would mean that
the call using win32 api should fail when run under both cmd.exe
and bash.exe which is not the case.

http://cygwin.com/ml/cygwin/2006-01/msg00938.html
	

	I would be most grateful if someone could tell me
why this might be happening and what possible alternative
paths I could follow.

thanks in advance + kind regards,

Kaveh.

PS. I've attached the output of "cygcheck -s -v -r > cygcheck.out"
and am running Windows XP Professional SP2
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060430/09102a95/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: envs-gcc.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060430/09102a95/attachment.c>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list