INFO: 16-bit App Does Not Get Parent's Modified Environment

ID: Q162960


The information in this article applies to:
  • Microsoft Win32s versions 1.25, 1.3, 1.30a, 1.3c


SUMMARY

Win32-based applications running under Win32s can spawn both Windows-based and Win32-based applications by using either WinExec() or CreateProcess(). However, the Windows-based application will not get the modified environment of the parent application.


MORE INFORMATION

In Win32s version 1.2 and later, WinExec() does not pass the environment to the spawned Windows-based application (the 16-bit child). Instead, the child receives the standard global environment strings. This allows the Windows-based application to run, but the child does not receive the modified environment from the parent. This seemed to be a reasonable compromise for a bug that caused a GP Fault in the C start-up code that comes with Microsoft C version 6.0 because most applications do not change the environment for the child. Many application that come with Windows, such as Write and Notepad, were compiled with C version 6.0.

If an application must modify the child's environment, it can spawn the application using CreateProcess() and specify an explicit environment. However, be aware that if the parent exits, the child's environment becomes invalid. This behavior is due to the underlying Windows 3.x operating system.

NOTE: Win32s uses a different mechanism to spawn Win32-based applications, so the problems discussed in this article do not occur when spawning Win32-based applications with WinExec() or CreateProcess(). For more information, please refer to the following article in the Microsoft Knowledge Base:

Q102958 PRB: Passing Modified Environments to Child Processes

Additional query words: gpf gpfault crash

Keywords : kbWin32s
Version : WINDOWS:1.25,1.3,1.30a,1.3c
Platform : WINDOWS
Issue type :


Last Reviewed: January 14, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.