| |
| Console - First Pass |
| -------------------- |
| |
| Consoles are just xterms created with the -Sxxn switch. |
| A pty is opened and the master goes to the xterm side |
| and the slave is held by the wine side. The slave fd |
| is changed into a HANDLE32 and this HANDLE32 is set |
| to the STD_*_HANDLES. |
| |
| For now writing/reading to a console just calls FileWrite/FileRead. |
| |
| If the command line console is to be inheirited or |
| a process inherits it's parents console (-- can that happen???), |
| the console is created at process init time via PROCESS_InheritConsole. |
| The 0, 1, and 2 file descriptors are duped to be the |
| STD_*_HANDLES in this case. Also in this case a flag is set |
| to indicate that the console comes from the parent process or |
| command line. |
| |
| If a process doesn't have a console at all, it's |
| pdb->console is set to NULL. This helps indicate when |
| it is possible to create a new console (via AllocConsole). |
| |
| |
| Like most k32 objects, when the FreeConsole is called, the |
| ref count is decremented and the console is freed when |
| it reaches zero. The free kills the xterm and closes |
| the master/slave fds. |
| |
| Also like most k32 objects, we assume that (K32OBJ) header is the |
| first field so the casting (from K32OBJ *to CONSOLE *) |
| works correctly. |
| |
| BUGS |
| ---- |
| |
| A exit handler needs to be added. If the process exits |
| without calling FreeConsole, the xterm continues on... |
| But... there should probably be a generic exit handler in |
| wine for this kind of stuff (K32OBJs). |
| |