Optimized include/*.h: (recursively) include all headers needed by
[wine/testsucceed.git] / documentation / console
blob14dbcc28f026df9d308ef260808f90a9be3655bf
2 Console - First Pass
3 --------------------
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 
9 to the STD_*_HANDLES.
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 its parent's 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
24 command line.
26 If a process doesn't have a console at all, its 
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 *)
38 works correctly.
40 FreeConsole is called on process exit (in ExitProcess) if 
41 pdb->console is not NULL.
44 BUGS
45 ----
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:
63 WriteFile
64 ---------
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
70 _lwrite
71 -------
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)
76 WriteConsole
77 ------------
78         o expects only console handles
81 SetFilePointer
82 --------------
83         o returns -1 (err 6) when used with a console handle
86 FreeConsole
87 -----------
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.
97 DOS (Generic) Console Support
98 -----------------------------
100 I. Command Line Configuration
102    DOS consoles must be configured either on the command line or in a dot
103    resource file (.console). A typical configuration consists of a string
104    of driver keywords separated by plus ('+') signs. To change the 
105    configuration on the command-line, use the -console switch.
107    For example:
109       wine -console ncurses+xterm <apllication>
110    
111    Possible drivers:
113       tty       - Generic text-only support. Supports redirection.
114       ncurses   - Full-screen graphical support with color.
115       xterm     - Load a new window to display the console in. Also
116                   supports resizing windows.
119 II. Wine.conf Configuration
121    In the wine.conf file, you can create a section called [console] that
122    contains configuration options that are respected by the assorted
123    console drivers.
125    Current Options:
127       XtermProg=<program>
129          Use this program instead of xterm. This eliminates the need for a
130          recompile.
132       XtermResolution=<cols>x<rows>
134          (Example: XtermResolution=80x25)
135          Start your xterm program with this text resolution. 80x25 is
136          recommended, a NULL value will mean to use the terminal's default
137          resolution, determined however your specific terminal figures
138          that out. Most console-based programs expect eother 80x25 or
139          80x40 displays.
141          Note: The default for many terminals is 80x24. One row smaller
142          than what the console subsystem generally expects.
144          Note 2: This information is passed on the command-line with the
145          -g switch.
147 III. Terminal Types
149    There are a large number of potential terminals that can be used with
150    Wine, depending on what you are trying to do. Unfortunately, I am still
151    looking for the "best" driver combination.
153    Note that 'slave' is required for use in Wine, currently.
155    Program     | Color? | Resizing? | Slave?
156    -----------------------------------------
157    xterm           N          Y         Y
158    nxterm          Y          N         Y
159    rxvt            Y          ?         N
160    
161    (linux console) Y          N         ?
163    As X terminals typically use a 24x80 screen resolution rather than the
164    typical 25x80 one, it is necessary to resize the screen to allow a DOS
165    program to work full-screen. Soon, I will add an option to the
166    configuration to set this up at run time. On the fly resizing will
167    still be disabled however.