[Bug 37635] New: Explicit environment variables passed to spawn/exec are corrupted

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Nov 26 07:57:11 CST 2014


https://bugs.winehq.org/show_bug.cgi?id=37635

            Bug ID: 37635
           Summary: Explicit environment variables passed to spawn/exec
                    are corrupted
           Product: Wine
           Version: 1.7.30
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: msvcrt
          Assignee: wine-bugs at winehq.org
          Reporter: rmy at pobox.com
      Distribution: ---

Created attachment 50088
  --> https://bugs.winehq.org/attachment.cgi?id=50088
msvcrt: Fix passing of explicit environment to spawn/exec calls

Consider the following:

   char *arg[2] = { "./printenv.exe", NULL };
   char *env[2] = { "HELLO=world", NULL };
   spawnve(P_WAIT, arg[0], arg, env);

Where printenv.exe just prints the environment:

   char **e;
   for (e=environ; *e; ++e) printf("%s\n", *e);

On Windows this results in:

   HELLO=world
   SystemRoot=C:\Windows

Wine gives:

   H
   E
   L
   L
   O
   =
   w
   o
   r
   l
   d
   ProgramFiles=C:\Program Files
   CommonProgramFiles=C:\Program Files\Common Files

This happens because the spawn/exec routines convert the supplied environment
variables into a wide-character environment block.  This is passed to
CreateProcessW but without adding CREATE_UNICODE_ENVIRONMENT to the creation
flags.  In create_process_impl in kernel32 the lack of
CREATE_UNICODE_ENVIRONMENT causes the environment block to be run through a
second conversion to wide characters.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list