The information in this article applies to:
SYMPTOMS
Under Win32s version 1.15, when a Win32-based application spawns a 16-bit
application several times using WinExec(), after a few successful spawns,
WinExec() fails.
CAUSE
This is actually a bug in Windows version 3.1. The 32-bit WinExec() calls
the 16-bit LoadModule(). Win32s passes the environment of the calling
process to LoadModule(). Then the Windows 3.1 LoadModule() allocates a
buffer for the environment, copies this environment to the buffer, and
passes this buffer to the child process. The problem is that the owner of
the new allocated buffer is the parent, so the memory is freed when the
parent exits. There is no code for otherwise freeing the memory. This bug
also affects 16-bit Windows-based applications if LoadModule() is called
with an environment selector that is not NULL.
RESOLUTION
To work around the problem, you can call the Windows version 3.1 WinExec()
through the Universal Thunk. However, the parent will not be able to modify
the child's environment.
MORE INFORMATION
With the changes in Win32s version 1.2x, if the calling application
modifies the environment, the child process will not get the modified
environment of the parent. It will get the global MS-DOS environment. This
is also true for WinExec().
Additional query words: 1.20 GPF bugfix buglist
Keywords : kbWin32s |
Last Reviewed: January 14, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |