Microsoft KB Archive/105303: Difference between revisions
(importing KB archive) |
m (X010 moved page Microsoft KB Archive/Q105303 to Microsoft KB Archive/105303 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/") |
(No difference)
|
Latest revision as of 19:13, 12 August 2020
FIX: Redirecting Output to an MS-DOS Application PSS ID Number: Q105303 Article last modified on 07-27-1994
3.10
WINDOWS NT
The information in this article applies to: |
- Microsoft Win32 Software Development Kit (SDK) for Windows NT version 3.1 |
SYMPTOMS
The following method is used to redirect output to a child process when it is started from a GUI application:
Declare STARTUPINFO si.
- Set the hStdIn, hStdOut, and/or hStdErr field as desired.
- Set the dwFlags field to STARTF_USESTDHANDLES.
In CreateProcess(), set inherit handles to TRUE.
NOTE: This method does not work when starting MS-DOS applications.
RESOLUTION
As a workaround, use AllocConsole(), then the following method:
Use SetStdHandle() to set the desired handles to be inherited.
-or-
Use DuplicateHandle() to change the inheritance property of handles that should not be inherited.
In CreateProcess(), set inherit handles to TRUE.
This method creates a blank console window; however, this is necessary because the method doesn’t work otherwise.
STATUS
Microsoft has confirmed this to be a bug in Windows NT 3.1. This problem was corrected in Windows NT 3.5.
MORE INFORMATION
Note that if you are opening a handle that will be inherited by the child, set SECURITY_ATTRIBUTES.bInheritHandle = TRUE in the call to CreateFile(), CreatePipe(), and so forth.
For an example of both methods of redirection, see the INHERIT SDK sample.
Additional reference words: 3.10 KBCategory: Prg KBSubcategory: BseProcThrd
=================================================================
Copyright Microsoft Corporation 1994.