5 Consoles are just xterms created with the -Sxxn switch.
6 A pty is opened and the master goes to the xterm side
7 and the slave is held by the wine side. The console
8 itself it turned into a few HANDLE32s and is set
11 It is possible to use the WriteFile and ReadFile commands
12 to write to a win32 console. To accomplish this, all K32OBJs
13 that support I/O have a read and write function pointer.
14 So, WriteFile calls K32OBJ_WriteFile which calls the K32OBJ's
15 write function pointer, which then finally calls write.
17 [this paragraph is now out of date]
18 If the command line console is to be inheirited or
19 a process inherits it's parents console (-- can that happen???),
20 the console is created at process init time via PROCESS_InheritConsole.
21 The 0, 1, and 2 file descriptors are duped to be the
22 STD_*_HANDLES in this case. Also in this case a flag is set
23 to indicate that the console comes from the parent process or
26 If a process doesn't have a console at all, it's
27 pdb->console is set to NULL. This helps indicate when
28 it is possible to create a new console (via AllocConsole).
31 When FreeConsole is called, all handles that the process has
32 open to the console are closed. Like most k32objs, if the
33 console's refcount reaches zero, its k32obj destroy function
34 is called. The destroy kills the xterm if one was open.
36 Also like most k32 objects, we assume that (K32OBJ) header is the
37 first field so the casting (from K32OBJ *to CONSOLE *)
40 FreeConsole is called on process exit (in ExitProcess) if
41 pdb->console is not NULL.
46 Console processes do not inherit their parent's handles. I think
47 there needs to be two cases, one where they have to inherit
48 the stdin/stdout/stderr from unix, and one where they have to
49 inherit from another windows app.
51 SetConsoleMode -- UNIX only has ICANON and various ECHOs
52 to play around with for processing input. Win32 has
53 line-at-a-time processing, character processing, and
54 echo. I'm putting together an intermediate driver
55 that will handle this (and hopefully won't be any more
56 buggy then the NT4 console implementation).
59 ================================================================
61 experimentation with NT4 yields that:
65 o does not truncate file on 0 length write
66 o 0 length write or error on write changes numcharswritten to 0
67 o 0 length write returns TRUE
68 o works with console handles
72 o does truncate/expand file at current position on 0 length write
73 o returns 0 on a zero length write
74 o works with console handles (typecasted)
78 o expects only console handles
83 o returns -1 (err 6) when used with a console handle
88 o even when all the handles to it are freed, the win32 console
89 stays visible, the only way I could find to free it
90 was via the FreeConsole
93 Is it possible to interrupt win32's FileWrite? I'm not sure.
94 It may not be possible to interrupt any system calls.