mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
d30dfd24d6
Sun Sep 27 14:25:38 1998 Petter Reinholdtsen <pere@td.org.uit.no> * [files/drive.c] Make sure GetDriveType32A() handles param NULL. Added some doc on function. Sun Sep 27 14:07:26 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk> * [controls/edit.c] [windows/win.c] Don't call SetWindowLong() in EDIT_WM_NCREATE. Fix SetWindowLong(GWL_[EX]STYLE) to work for 16bit windows. Remove UpdateWindow() call. Sun Sep 27 13:41:22 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [scheduler/*.c] [server/event.c] [server/mutex.c] [server/semaphore.c] Implemented server-side synchronisation objects. Sun Sep 27 01:13:35 1998 Alex Priem <alexp@sci.kun.nl> * [dlls/comctl32/treeview.c] [include/treeview.h] [include/comctl.h] Treeview implementation. * [dlls/comctl32/trackbar.c] [include/trackbar.h] Trackbar implementation. Sat Sep 26 20:49:13 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [if1632/thunk.c] [tools/build.c] [win32/kernel32.c] Bugfix: several problems with flat thunks fixed. * [memory/selector.c] Bugfix: IsBad...Ptr16 didn't work for limit_in_pages segments. * [scheduler/thread.c] Bugfix: CreateThread: Allow id parameter == NULL. * [objects/gdiobj.c] Bugfix: IsGDIObject: Return correct object type for stock objects. * [msdos/dpmi.c] Bugfix: fixed typo in INT_DoRealModeInt. * [msdos/int21.c] Bugfix: int21 READ *must* use WIN16_hread, not _hread16. * [if1632/kernel.spec] [if1632/dummy.c] [if1632/thunk.c] [loader/ne/module.c] [scheduler/event.c] [scheduler/synchro.c] [scheduler/thread.c] [win32/kernel32.c] [win32/ordinals.c] Added names/stubs for all undocumented KERNEL routines (Win95). Added the following undoc. 16-bit equivalents to Win32 routines: KERNEL.441-443,449-453,456-462,471-476,479-486,488. Added stubs for some other KERNEL routines. * [memory/heap.c] [memory/global.c] [include/global.h] Implemented Local32... 32-bit local heap routines (KERNEL.208-215, 229). * [miscemu/instr.c] [loader/module.c] [include/module.h] Implemented __GP fault handling and HasGPHandler (KERNEL.338). * [misc/error.c] Implemented LogParamErrorRegs (KERNEL.327). * [loader/task.c] [include/windows.h] Implemented GetCodeInfo (KERNEL.104). * [loader/task.c] [scheduler/thread.c] [include/thread.h] Implemented [GS]etThreadQueue and [GS]etFastQueue (KERNEL.463/4, 624/5). * [if1632/gdi.spec] [objects/dc.c] [objects/dib.c] [objects/bitmap.c] [include/windows.h] Bugfix: fixed wrong parameter for CreateDIBSection16. Added [GS]etDIBColorTable16, stub for GetBoundsRect16. Partially implemented BITMAP_GetObject16 for DIBs. * [if1632/gdi.spec] [relay32/gdi32.spec] [objects/palette.c] Added some GDI stubs. * [if1632/Makefile.in] [if1632/display.spec] [if1632/mouse.spec] [if1632/keyboard.spec] [if1632/builtin.c] [windows/keyboard.c] Added some stubs for Win16 drivers: KEYBOARD, MOUSE, DISPLAY. * [if1632/wprocs.spec] [msdos/vxd.c] Added some stubs for VxDs: VMM, ConfigMG, TimerAPI. * [msdos/int2f.c] Added some stubs for real-mode network drivers. Sat Sep 26 18:18:18 1998 Marcus Meissner <marcus@jet.franken.de> * [configure.in] Merged in some more of the FreeBSD ports/emulators/wine patches. (Maintainer(s) of this port: You can just submit these patches to Alexandre directly.) * [loader/pe_image.c] Check filesize of image against size derived from header to spot truncated executeables without crashing. * [files/directory.c] Set envvar "COMSPEC". One win32(!!) program crashes without it. * [multimedia/mmio.c] Added mmioSetInfo32. * [include/file.h] Return STD_ERROR_HANDLE for AUX and PRT dos handles. * [loader/module.c] Handle executeables with spaces in their names a bit better in CreateProcess. * [relay32/msvfw32.spec][if1632/msvideo.spec][multimedia/msvideo.c][include/vfw.h] Started on MS Video support (can load Win32 ICMs). * [tools/testrun] A bit smarter use of ps. * [memory/virtual.c] Report PAGE_GUARDed pages as PAGE_PROTECTED (AutoCAD LT R17 fails without that check (since Win95 doesn't know about PAGE_GUARD)). Sat Sep 26 15:04:05 1998 Ove Kaaven <ovek@arcticnet.no> * [include/miscemu.h] [if1632/builtin.c] [loader/task.c] [miscemu/instr.c] [msdos/dpmi.c] [msdos/int21.c] [msdos/interrupts.c] [windows/user.c] INT_[S|G]etHandler was renamed to INT_[S|G]etPMHandler. Added handlers to deal with real-mode interrupts; DOS programs are now able to hook real-mode interrupts. * [loader/dos/module.c] [msdos/dosmem.c] [msdos/int21.c] Moved real-mode interrupt table initialization to msdos/dosmem.c, and made new V86 tasks get a full copy of the existing "system memory" instead of almost empty space. Misc fixes. * [include/dosexe.h] [loader/dos/module.c] [msdos/dpmi.c] [msdos/int2f.c] First shot at letting DOS programs start up DPMI (but DPMI is still disabled for DOS programs, for pkunzip's sake). * [include/debugger.h] [debugger/break.c] [debugger/dbg.y] [debugger/registers.c] [debugger/memory.c] [debugger/info.c] [loader/dos/dosvm.c] First shot at making Wine's debugger work for DOS programs. The -debug flag works, as do "nexti" and "stepi". Sat Sep 26 13:13:13 1998 Juergen Schmied <juergen.schmied@metronet.de> * [dlls/shell32/dataobject.c] New classes IEnumFORMATETC implemented, IDataObject stubs. * [dlls/shell32/*.*][relay32/shell32.spec] Bugfixes. New: ICM_InsertItem(), ILCreateFromPath(). Implemented: ILCloneFirst(). Stubs: ILIsEqual(), ILFindChild(), SHLogILFromFSIL(), PathMatchSpec(), PathIsExe(). Changed: ILGetSize(), _ILIsDesktop(), PathCombine(). * [include/shlobj.h] New SHLGUID's New structures: DVTARGETDEVICE32, STGMEDIUM32, FORMATETC32, CLIPFORMAT32. New interfaces: IEnumFORMATETC, IDataObject, ICommDlgBrowser IDockingWindowFrame, IServiceProvider. * [dlls/shell32/folders.c] Stubs for IShellLink. * [loader/resource.c] Small fixes. * [misc/crtdll.c][relay32/crtdll.spec] New __dllonexit(). * [windows/message.c] SendNotifyMessageA, SendMessageCallBack32A half implemented. * [controls/edit.c] EDIT_WM_SetText set EF_UPDATE flag not for ES_MULTILINE. * [files/file.c] Handling of fileposition fixed. Fri Sep 25 18:13:30 1998 Patrik Stridvall <ps@leissner.se> * [include/windows.h] [include/wintypes.h] [ole/ole2nls.h] [relay32/kernel32.spec] Implemented EnumDateFormats and EnumTimeFormats. Only adds US English support. * [Makefile.in] [configure.in] [dlls/Makefile.in] [dlls/psapi/Makefile.in] [dlls/psapi/psapi_main.c] New files to implement stubs for PSAPI.DLL (NT only). * [relay32/Makefile.in] [relay32/builtin32.c] [relay32/psapi.spec] New spec file for PSAPI.DLL (NT only). * [scheduler/handle.c] HANDLE_GetObjPtr should only interpret the pseudo handles as the current thread or the current process if a thread or a process is requested. * [include/winversion.h] [misc/version.c] Adds the global function VERSION_GetVersion() so functions can have different behavior depending on the -winver flag. * [include/oledlg.h] [ole/oledlg.c] Minor fixes. * [windows/winproc.c] Minor changes. * [include/imm.h] [misc/imm.c] Now returns correct values under both Windows 95 and NT 4.0. Thu Sep 24 22:11:44 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [configure.in] [include/acconfig.h] [include/thread.h] [scheduler/sysdeps.c] Autoconfig test for non-reentrant libc. Wed Sep 23 19:52:12 1998 Matthew Becker <mbecker@glasscity.net> * [*/*.c] Miscellaneous documentation updates and debugging output standardizations. * [objects/clipping.c] Added ExtSelectClipRgn. Wed Sep 23 00:03:28 EDT 1998 Pete Ratzlaff <pratzlaff@cfa.harvard.edu> * [include/windows.h] [if1632/user.spec] [relay32/user32.spec] [windows/keyboard.c] Added, marginally implemented, GetKeyboardLayoutName(). Only returns US English keyboard name. Tue Sep 22 16:32:41 1998 Marcel Baur <mbaur@iiic.ethz.ch> * [programs/control/*] New Winelib application. Mon Sep 21 00:29:18 1998 Peter Hunnisett <hunnise@nortel.ca> * [include/dplay.h][multimedia/dplay.c][ole/compobj.c] Added all DirectPlayLobby interfaces and enhanced DirectPlay and DirectPlayLobby support. Still not all that much. Useful enough if you just need to start a program, don't try any real dplay/lobby stuff. * [documentation/status/directplay] Added a very little bit. * [graphics/ddraw.c] - Call to SetWindowLong32A wasn't working because there was no memory set aside when the window class was registered. - Fixed some xlib reference counting and change the behaviour of DirectDrawSurface3_SetPalette to mimic observed behaviour (palette is associated will all backbuffers) - Also stored all palette colour fields and spit back our saved colour fields rather than query X for them. - Added plenty of AddRef and Release traces. - Added Xlib support for using -desktop option. - Fixed Xlib message handling. Messages weren't being passed to the application. Fixes mouse movements in some xlib DDraw games. - Added a few stubs. * [windows/win.c][include/winerror.h] Fixed up some error handling in WIN_SetWindowLong. SetLastError wasn't being used. Could cause problems with 0 return codes. Added new error in winerror (1400). * [AUTHORS] [include/authors.h] Added myself as a Wine author. Sun Sep 20 21:22:44 1998 Alexander Larsson <alla@lysator.liu.se> * [loader/module.c] Changed GetModuleFileName32A so that is returns the long version of the filename. Note that just the name is long, not the directories. Sat Sep 19 20:05:30 1998 Per Ångström <pang@mind.nu> * [controls/menu.c] Made a couple of fixes to make life easier for applications that alter their menus at runtime. * [windows/defdlg.c] Removed the cast of the return value from dialog procedures to a 16-bit bool. The return value needs to retain all its 32 bits, since it is not always a bool, such as when responding to the WM_NCHITTEST message. Fri Sep 18 11:30:38 1998 Sergey Turchanov <turchanov@usa.net> * [loader/resource.c] Fixed very funny bug (though gravely affecting further excecution) with FindResource[Ex]32 functions. * [include/multimon.h] [windows/multimon.c] [relay32/user32.spec] [include/windows.h] [windows/sysmetrics.c] Default implementation for Multimonitor API. * [include/windows.h] [windows/winpos.c] Fixed incorrect declaration (and behaviour) of GetWindowRect32. Wed Sep 16 10:21:15 1998 Gerard Patel <G.Patel@Wanadoo.fr> * [controls/edit.c] Fixed EDIT_EM_GetLine to use correctly length of lines. Tue Sep 15 20:40:16 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [misc/tweak.c][include/tweak.h][controls/menu.c] Replaced the tweak graphic routines by calls to DrawEdge32(). * [misc/tweak.c][include/tweak.h][documentation/win95look] [wine.ini][*/*] Changed "look and feel" selection. Allows Win3.1, Win95 and Win98 (no GUI code implemented) look and feel. * [dlls/comctl32/header.c][include/header.h][include/commctrl.h] Started callback item support and did some minor improvements. * [dlls/comctl32/imagelist.c] Fixed bug in transparent image display. ImageList_GetIcon is still buggy :-( * [dlls/comctl32/toolbar.c] Fixed button drawing (partial hack). * [dlls/comctl32/commctrl.c] Fixed MenuHelp(). * [controls/button.c] Added 3d effect for groupbox. * [windows/msgbox.c] Added font support for message boxes. * [windows/nonclient.c] Fixed window moving bug. * [dlls/comctl32/*.c] Various improvements. * [dlls/comctl32/listview.c][dlls/comctl32/rebar.c] [include/commctrl.h] More messages. * [windows/syscolor.c][include/windows.h] Introduced new Win98 system colors. Tue Sep 15 18:29:45 1998 Wesley Filardo <eightknots@aol.com> * [files/profile.c] Added support in PROFILE_LoadWineIni for -config option * [misc/main.c] [include/options.h] Added -config option. Tue Sep 15 18:22:26 1998 Petter Reinholdtsen <pere@td.org.uit.no> * [documentation/Makefile.in] Make sure directory exists before installing into it. Tue Sep 15 01:47:33 1998 Pablo Saratxaga <pablo.sarachaga@ping.be> * [ole/nls/*] [ole/ole2nls.c] [include/winnls.h] Fixed a few errors and completed some NLS files. Mon Sep 14 01:23:45 1998 Joseph Pranevich <knight@baltimore.wwaves.com> * [include/miscemu.h] [msdos/interrupts.c] Removed a compilation warning, added INT 25 to the list of interrupts callable from DOS applications, added a debug message when unsupported interrupts are used. Sun Sep 13 19:55:22 1998 Lawson Whitney <lawson_whitney@juno.com> * [if1632/relay.c] CallProcEx32W should not reverse arguments. Sun Aug 17 21:18:12 1998 Eric Pouech <eric.pouech@lemel.fr> * [multimedia/midi.c] [multimedia/init.c] [multimedia/mmsys.c] [include/multimedia.h] [include/mmsystem.h] [multimedia/Makefile.in] [multimedia/midipatch.c] [if1632/multimedia.spec] Made MIDI input and output functional on OSS capable systems. * [multimedia/timer.c] Changes to trigger callbacks at the accurate pace even when fake timers are used.
1160 lines
32 KiB
C
1160 lines
32 KiB
C
/*
|
|
* Win32 kernel functions
|
|
*
|
|
* Copyright 1995 Martin von Loewis and Cameron Heide
|
|
* Copyright 1997 Karl Garrison
|
|
* Copyright 1998 John Richardson
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <termios.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
#include <sys/errno.h>
|
|
#include <signal.h>
|
|
#include <assert.h>
|
|
#include "windows.h"
|
|
#include "k32obj.h"
|
|
#include "file.h"
|
|
#include "process.h"
|
|
#include "winerror.h"
|
|
#include "wincon.h"
|
|
#include "heap.h"
|
|
#include "debug.h"
|
|
|
|
static CONSOLE_SCREEN_BUFFER_INFO dummyinfo =
|
|
{
|
|
{80, 24},
|
|
{0, 0},
|
|
0,
|
|
{0, 0, 79, 23},
|
|
{80, 24}
|
|
};
|
|
|
|
/* The console -- I chose to keep the master and slave
|
|
* (UNIX) file descriptors around in case they are needed for
|
|
* ioctls later. The pid is needed to destroy the xterm on close
|
|
*/
|
|
typedef struct _CONSOLE {
|
|
K32OBJ header;
|
|
int master; /* xterm side of pty */
|
|
int slave; /* wine side of pty */
|
|
int pid; /* xterm's pid, -1 if no xterm */
|
|
LPSTR title; /* title of console */
|
|
} CONSOLE;
|
|
|
|
|
|
/* This probably belongs somewhere else */
|
|
typedef struct _CONSOLE_CURSOR_INFO {
|
|
DWORD dwSize; /* Between 1 & 100 for percentage of cell filled */
|
|
BOOL32 bVisible; /* Visibility of cursor */
|
|
} CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
|
|
|
|
|
|
|
|
static void CONSOLE_Destroy( K32OBJ *obj );
|
|
static BOOL32 CONSOLE_Write(K32OBJ *ptr, LPCVOID lpBuffer,
|
|
DWORD nNumberOfChars, LPDWORD lpNumberOfChars,
|
|
LPOVERLAPPED lpOverlapped);
|
|
static BOOL32 CONSOLE_Read(K32OBJ *ptr, LPVOID lpBuffer,
|
|
DWORD nNumberOfChars, LPDWORD lpNumberOfChars,
|
|
LPOVERLAPPED lpOverlapped);
|
|
static int wine_openpty(int *master, int *slave, char *name,
|
|
struct termios *term, struct winsize *winsize);
|
|
static BOOL32 wine_createConsole(int *master, int *slave, int *pid);
|
|
|
|
const K32OBJ_OPS CONSOLE_Ops =
|
|
{
|
|
NULL, /* signaled */
|
|
NULL, /* satisfied */
|
|
NULL, /* add_wait */
|
|
NULL, /* remove_wait */
|
|
CONSOLE_Read, /* read */
|
|
CONSOLE_Write, /* write */
|
|
CONSOLE_Destroy /* destroy */
|
|
};
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
* CONSOLE_Destroy
|
|
*/
|
|
static void CONSOLE_Destroy(K32OBJ *obj)
|
|
{
|
|
CONSOLE *console = (CONSOLE *)obj;
|
|
assert(obj->type == K32OBJ_CONSOLE);
|
|
|
|
obj->type = K32OBJ_UNKNOWN;
|
|
|
|
if (console->title)
|
|
HeapFree( SystemHeap, 0, console->title );
|
|
console->title = NULL;
|
|
/* make sure a xterm exists to kill */
|
|
if (console->pid != -1) {
|
|
kill(console->pid, SIGTERM);
|
|
}
|
|
HeapFree(SystemHeap, 0, console);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CONSOLE_Read
|
|
*
|
|
* NOTES
|
|
* lpOverlapped is ignored
|
|
*/
|
|
static BOOL32 CONSOLE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars,
|
|
LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
|
|
{
|
|
CONSOLE *console = (CONSOLE *)ptr;
|
|
int result;
|
|
|
|
TRACE(console, "%p %p %ld\n", ptr, lpBuffer,
|
|
nNumberOfChars);
|
|
|
|
*lpNumberOfChars = 0;
|
|
|
|
if ((result = read(console->slave, lpBuffer, nNumberOfChars)) == -1) {
|
|
FILE_SetDosError();
|
|
return FALSE;
|
|
}
|
|
*lpNumberOfChars = result;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CONSOLE_Write
|
|
*
|
|
* NOTES
|
|
* lpOverlapped is ignored
|
|
*/
|
|
static BOOL32 CONSOLE_Write(K32OBJ *ptr, LPCVOID lpBuffer,
|
|
DWORD nNumberOfChars,
|
|
LPDWORD lpNumberOfChars, LPOVERLAPPED lpOverlapped)
|
|
{
|
|
CONSOLE *console = (CONSOLE *)ptr;
|
|
int result;
|
|
|
|
TRACE(console, "%p %p %ld\n", ptr, lpBuffer,
|
|
nNumberOfChars);
|
|
|
|
*lpNumberOfChars = 0;
|
|
|
|
/*
|
|
* I assume this loop around EAGAIN is here because
|
|
* win32 doesn't have interrupted system calls
|
|
*/
|
|
|
|
for (;;)
|
|
{
|
|
result = write(console->slave, lpBuffer, nNumberOfChars);
|
|
if (result != -1) {
|
|
*lpNumberOfChars = result;
|
|
return TRUE;
|
|
}
|
|
if (errno != EINTR) {
|
|
FILE_SetDosError();
|
|
return FALSE;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleCtrlHandler [KERNEL32.459] Adds function to calling process list
|
|
*
|
|
* PARAMS
|
|
* func [I] Address of handler function
|
|
* add [I] Handler to add or remove
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleCtrlHandler( HANDLER_ROUTINE *func, BOOL32 add )
|
|
{
|
|
FIXME(console, "(%p,%i): stub\n",func,add);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* CreateConsoleScreenBuffer [KERNEL32.151] Creates a console screen buffer
|
|
*
|
|
* PARAMS
|
|
* dwDesiredAccess [I] Access flag
|
|
* dwShareMode [I] Buffer share mode
|
|
* sa [I] Security attributes
|
|
* dwFlags [I] Type of buffer to create
|
|
* lpScreenBufferData [I] Reserved
|
|
*
|
|
* NOTES
|
|
* Should call SetLastError
|
|
*
|
|
* RETURNS
|
|
* Success: Handle to new console screen buffer
|
|
* Failure: INVALID_HANDLE_VALUE
|
|
*/
|
|
HANDLE32 WINAPI CreateConsoleScreenBuffer( DWORD dwDesiredAccess,
|
|
DWORD dwShareMode, LPSECURITY_ATTRIBUTES sa,
|
|
DWORD dwFlags, LPVOID lpScreenBufferData )
|
|
{
|
|
FIXME(console, "(%ld,%ld,%p,%ld,%p): stub\n",dwDesiredAccess,
|
|
dwShareMode, sa, dwFlags, lpScreenBufferData);
|
|
return 1;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetConsoleScreenBufferInfo (KERNEL32.190)
|
|
*/
|
|
BOOL32 WINAPI GetConsoleScreenBufferInfo( HANDLE32 hConsoleOutput,
|
|
LPCONSOLE_SCREEN_BUFFER_INFO csbi )
|
|
{
|
|
csbi->dwSize.x = 80;
|
|
csbi->dwSize.y = 24;
|
|
csbi->dwCursorPosition.x = 0;
|
|
csbi->dwCursorPosition.y = 0;
|
|
csbi->wAttributes = 0;
|
|
csbi->srWindow.Left = 0;
|
|
csbi->srWindow.Right = 79;
|
|
csbi->srWindow.Top = 0;
|
|
csbi->srWindow.Bottom = 23;
|
|
csbi->dwMaximumWindowSize.x = 80;
|
|
csbi->dwMaximumWindowSize.y = 24;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleActiveScreenBuffer [KERNEL32.623] Sets buffer to current console
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleActiveScreenBuffer(
|
|
HANDLE32 hConsoleOutput) /* [in] Handle to console screen buffer */
|
|
{
|
|
FIXME(console, "(%x): stub\n", hConsoleOutput);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetLargestConsoleWindowSize (KERNEL32.226)
|
|
*/
|
|
DWORD WINAPI GetLargestConsoleWindowSize( HANDLE32 hConsoleOutput )
|
|
{
|
|
return (DWORD)MAKELONG(dummyinfo.dwMaximumWindowSize.x,dummyinfo.dwMaximumWindowSize.y);
|
|
}
|
|
|
|
/***********************************************************************
|
|
* FreeConsole (KERNEL32.267)
|
|
*/
|
|
BOOL32 WINAPI FreeConsole(VOID)
|
|
{
|
|
|
|
PDB32 *pdb = PROCESS_Current();
|
|
CONSOLE *console;
|
|
|
|
SYSTEM_LOCK();
|
|
|
|
console = (CONSOLE *)pdb->console;
|
|
|
|
if (console == NULL) {
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
return FALSE;
|
|
}
|
|
|
|
HANDLE_CloseAll( pdb, &console->header );
|
|
|
|
K32OBJ_DecCount( &console->header );
|
|
pdb->console = NULL;
|
|
SYSTEM_UNLOCK();
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/**
|
|
* It looks like the openpty that comes with glibc in RedHat 5.0
|
|
* is buggy (second call returns what looks like a dup of 0 and 1
|
|
* instead of a new pty), this is a generic replacement.
|
|
*/
|
|
static int wine_openpty(int *master, int *slave, char *name,
|
|
struct termios *term, struct winsize *winsize)
|
|
{
|
|
int fdm, fds;
|
|
char *ptr1, *ptr2;
|
|
char pts_name[512];
|
|
|
|
strcpy (pts_name, "/dev/ptyXY");
|
|
|
|
for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++) {
|
|
pts_name[8] = *ptr1;
|
|
for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++) {
|
|
pts_name[9] = *ptr2;
|
|
|
|
if ((fdm = open(pts_name, O_RDWR)) < 0) {
|
|
if (errno == ENOENT)
|
|
return -1;
|
|
else
|
|
continue;
|
|
}
|
|
pts_name[5] = 't';
|
|
if ((fds = open(pts_name, O_RDWR)) < 0) {
|
|
pts_name[5] = 'p';
|
|
continue;
|
|
}
|
|
*master = fdm;
|
|
*slave = fds;
|
|
|
|
if (term != NULL)
|
|
tcsetattr(*slave, TCSANOW, term);
|
|
if (winsize != NULL)
|
|
ioctl(*slave, TIOCSWINSZ, winsize);
|
|
if (name != NULL)
|
|
strcpy(name, pts_name);
|
|
return fds;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
static BOOL32 wine_createConsole(int *master, int *slave, int *pid)
|
|
{
|
|
struct termios term;
|
|
char buf[1024];
|
|
char c = '\0';
|
|
int status = 0;
|
|
int i;
|
|
|
|
if (tcgetattr(0, &term) < 0) return FALSE;
|
|
term.c_lflag |= ICANON;
|
|
term.c_lflag &= ~ECHO;
|
|
if (wine_openpty(master, slave, NULL, &term, NULL) < 0) return FALSE;
|
|
|
|
if ((*pid=fork()) == 0) {
|
|
tcsetattr(*slave, TCSADRAIN, &term);
|
|
sprintf(buf, "-Sxx%d", *master);
|
|
execlp("xterm", "xterm", buf, NULL);
|
|
ERR(console, "error creating AllocConsole xterm\n");
|
|
exit(1);
|
|
}
|
|
|
|
/* most xterms like to print their window ID when used with -S;
|
|
* read it and continue before the user has a chance...
|
|
* NOTE: this is the reason we started xterm with ECHO off,
|
|
* we'll turn it back on below
|
|
*/
|
|
|
|
for (i=0; c!='\n'; (status=read(*slave, &c, 1)), i++) {
|
|
if (status == -1 && c == '\0') {
|
|
/* wait for xterm to be created */
|
|
usleep(100);
|
|
}
|
|
if (i > 10000) {
|
|
WARN(console, "can't read xterm WID\n");
|
|
kill(*pid, SIGKILL);
|
|
return FALSE;
|
|
}
|
|
}
|
|
term.c_lflag |= ECHO;
|
|
tcsetattr(*master, TCSADRAIN, &term);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
/***********************************************************************
|
|
* CONSOLE_GetConsoleHandle
|
|
* returns a 16-bit style console handle
|
|
* note: only called from _lopen
|
|
*/
|
|
HFILE32 CONSOLE_GetConsoleHandle(VOID)
|
|
{
|
|
PDB32 *pdb = PROCESS_Current();
|
|
HFILE32 handle = HFILE_ERROR32;
|
|
|
|
SYSTEM_LOCK();
|
|
if (pdb->console != NULL) {
|
|
CONSOLE *console = (CONSOLE *)pdb->console;
|
|
handle = (HFILE32)HANDLE_Alloc(pdb, &console->header, 0, TRUE, -1);
|
|
}
|
|
SYSTEM_UNLOCK();
|
|
return handle;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* AllocConsole (KERNEL32.103)
|
|
*
|
|
* creates an xterm with a pty to our program
|
|
*/
|
|
BOOL32 WINAPI AllocConsole(VOID)
|
|
{
|
|
|
|
int master;
|
|
int slave;
|
|
int pid;
|
|
PDB32 *pdb = PROCESS_Current();
|
|
CONSOLE *console;
|
|
HANDLE32 hIn, hOut, hErr;
|
|
|
|
SYSTEM_LOCK(); /* FIXME: really only need to lock the process */
|
|
|
|
SetLastError(ERROR_CANNOT_MAKE); /* this might not be the right
|
|
error, but it's a good guess :) */
|
|
|
|
console = (CONSOLE *)pdb->console;
|
|
|
|
/* don't create a console if we already have one */
|
|
if (console != NULL) {
|
|
SetLastError(ERROR_ACCESS_DENIED);
|
|
SYSTEM_UNLOCK();
|
|
return FALSE;
|
|
}
|
|
|
|
if (!(console = (CONSOLE*)HeapAlloc( SystemHeap, 0, sizeof(*console))))
|
|
{
|
|
SYSTEM_UNLOCK();
|
|
return FALSE;
|
|
}
|
|
|
|
console->header.type = K32OBJ_CONSOLE;
|
|
console->header.refcount = 1;
|
|
console->pid = -1;
|
|
console->title = NULL;
|
|
|
|
if (wine_createConsole(&master, &slave, &pid) == FALSE) {
|
|
K32OBJ_DecCount(&console->header);
|
|
SYSTEM_UNLOCK();
|
|
return FALSE;
|
|
}
|
|
|
|
/* save the pid and other info for future use */
|
|
console->master = master;
|
|
console->slave = slave;
|
|
console->pid = pid;
|
|
|
|
if ((hIn = HANDLE_Alloc(pdb,&console->header, 0, TRUE,-1)) == INVALID_HANDLE_VALUE32)
|
|
{
|
|
K32OBJ_DecCount(&console->header);
|
|
SYSTEM_UNLOCK();
|
|
return FALSE;
|
|
}
|
|
|
|
if ((hOut = HANDLE_Alloc(pdb,&console->header, 0, TRUE,-1)) == INVALID_HANDLE_VALUE32)
|
|
{
|
|
CloseHandle(hIn);
|
|
K32OBJ_DecCount(&console->header);
|
|
SYSTEM_UNLOCK();
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
if ((hErr = HANDLE_Alloc(pdb,&console->header, 0, TRUE,-1)) == INVALID_HANDLE_VALUE32)
|
|
{
|
|
CloseHandle(hIn);
|
|
CloseHandle(hOut);
|
|
K32OBJ_DecCount(&console->header);
|
|
SYSTEM_UNLOCK();
|
|
return FALSE;
|
|
}
|
|
|
|
/* associate this console with the process */
|
|
if (pdb->console) K32OBJ_DecCount( pdb->console );
|
|
pdb->console = (K32OBJ *)console;
|
|
|
|
/* NT resets the STD_*_HANDLEs on console alloc */
|
|
SetStdHandle(STD_INPUT_HANDLE, hIn);
|
|
SetStdHandle(STD_OUTPUT_HANDLE, hOut);
|
|
SetStdHandle(STD_ERROR_HANDLE, hErr);
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
SYSTEM_UNLOCK();
|
|
SetConsoleTitle32A("Wine Console");
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* GetConsoleCP [KERNEL32.295] Returns the OEM code page for the console
|
|
*
|
|
* RETURNS
|
|
* Code page code
|
|
*/
|
|
UINT32 WINAPI GetConsoleCP(VOID)
|
|
{
|
|
return GetACP();
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetConsoleOutputCP (KERNEL32.189)
|
|
*/
|
|
UINT32 WINAPI GetConsoleOutputCP(VOID)
|
|
{
|
|
return GetConsoleCP();
|
|
}
|
|
|
|
/***********************************************************************
|
|
* GetConsoleMode (KERNEL32.188)
|
|
*/
|
|
BOOL32 WINAPI GetConsoleMode(HANDLE32 hcon,LPDWORD mode)
|
|
{
|
|
*mode = ENABLE_PROCESSED_INPUT |
|
|
ENABLE_LINE_INPUT |
|
|
ENABLE_ECHO_INPUT;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleMode [KERNEL32.628] Sets input mode of console's input buffer
|
|
*
|
|
* PARAMS
|
|
* hcon [I] Handle to console input or screen buffer
|
|
* mode [I] Input or output mode to set
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleMode( HANDLE32 hcon, DWORD mode )
|
|
{
|
|
FIXME(console,"(0x%08x,0x%08lx): stub\n",hcon,mode);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetConsoleTitleA (KERNEL32.191)
|
|
*/
|
|
DWORD WINAPI GetConsoleTitle32A(LPSTR title,DWORD size)
|
|
{
|
|
PDB32 *pdb = PROCESS_Current();
|
|
CONSOLE *console= (CONSOLE *)pdb->console;
|
|
|
|
if(console && console->title)
|
|
{
|
|
lstrcpyn32A(title,console->title,size);
|
|
return strlen(title);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* GetConsoleTitle32W [KERNEL32.192] Retrieves title string for console
|
|
*
|
|
* PARAMS
|
|
* title [O] Address of buffer for title
|
|
* size [I] Size of buffer
|
|
*
|
|
* RETURNS
|
|
* Success: Length of string copied
|
|
* Failure: 0
|
|
*/
|
|
DWORD WINAPI GetConsoleTitle32W( LPWSTR title, DWORD size )
|
|
{
|
|
PDB32 *pdb = PROCESS_Current();
|
|
CONSOLE *console= (CONSOLE *)pdb->console;
|
|
if(console && console->title)
|
|
{
|
|
lstrcpynAtoW(title,console->title,size);
|
|
return (lstrlen32W(title));
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* WriteConsoleA (KERNEL32.729)
|
|
*/
|
|
BOOL32 WINAPI WriteConsole32A( HANDLE32 hConsoleOutput,
|
|
LPCVOID lpBuffer,
|
|
DWORD nNumberOfCharsToWrite,
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
LPVOID lpReserved )
|
|
{
|
|
/* FIXME: should I check if this is a console handle? */
|
|
return WriteFile(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
|
|
lpNumberOfCharsWritten, NULL);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* WriteConsoleOutputA (KERNEL32.732)
|
|
*/
|
|
BOOL32 WINAPI WriteConsoleOutput32A( HANDLE32 hConsoleOutput,
|
|
LPCHAR_INFO lpBuffer,
|
|
COORD dwBufferSize,
|
|
COORD dwBufferCoord,
|
|
LPSMALL_RECT lpWriteRegion)
|
|
{
|
|
FIXME(console, "(...):stub\n");
|
|
return FALSE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* WriteConsoleW (KERNEL32.577)
|
|
*/
|
|
BOOL32 WINAPI WriteConsole32W( HANDLE32 hConsoleOutput,
|
|
LPCVOID lpBuffer,
|
|
DWORD nNumberOfCharsToWrite,
|
|
LPDWORD lpNumberOfCharsWritten,
|
|
LPVOID lpReserved )
|
|
{
|
|
BOOL32 ret;
|
|
LPSTR xstring=HeapAlloc( GetProcessHeap(), 0, nNumberOfCharsToWrite );
|
|
|
|
lstrcpynWtoA( xstring, lpBuffer,nNumberOfCharsToWrite);
|
|
|
|
/* FIXME: should I check if this is a console handle? */
|
|
ret= WriteFile(hConsoleOutput, xstring, nNumberOfCharsToWrite,
|
|
lpNumberOfCharsWritten, NULL);
|
|
HeapFree( GetProcessHeap(), 0, xstring );
|
|
return ret;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* ReadConsoleA (KERNEL32.419)
|
|
*/
|
|
BOOL32 WINAPI ReadConsole32A( HANDLE32 hConsoleInput,
|
|
LPVOID lpBuffer,
|
|
DWORD nNumberOfCharsToRead,
|
|
LPDWORD lpNumberOfCharsRead,
|
|
LPVOID lpReserved )
|
|
{
|
|
return ReadFile(hConsoleInput, lpBuffer, nNumberOfCharsToRead,
|
|
lpNumberOfCharsRead, NULL);
|
|
|
|
#ifdef OLD
|
|
fgets(lpBuffer,nNumberOfCharsToRead, CONSOLE_console.conIO);
|
|
if (ferror(CONSOLE_console.conIO) {
|
|
clearerr();
|
|
return FALSE;
|
|
}
|
|
*lpNumberOfCharsRead = strlen(lpBuffer);
|
|
return TRUE;
|
|
#endif
|
|
|
|
}
|
|
|
|
/***********************************************************************
|
|
* ReadConsoleW (KERNEL32.427)
|
|
*/
|
|
BOOL32 WINAPI ReadConsole32W( HANDLE32 hConsoleInput,
|
|
LPVOID lpBuffer,
|
|
DWORD nNumberOfCharsToRead,
|
|
LPDWORD lpNumberOfCharsRead,
|
|
LPVOID lpReserved )
|
|
{
|
|
BOOL32 ret;
|
|
LPSTR buf = (LPSTR)HeapAlloc(GetProcessHeap(), 0,
|
|
nNumberOfCharsToRead);
|
|
ret = ReadFile(hConsoleInput, buf, nNumberOfCharsToRead,
|
|
lpNumberOfCharsRead, NULL);
|
|
lstrcpynAtoW(lpBuffer,buf,nNumberOfCharsToRead);
|
|
*lpNumberOfCharsRead = strlen(buf);
|
|
HeapFree( GetProcessHeap(), 0, buf );
|
|
return ret;
|
|
|
|
#ifdef OLD
|
|
LPSTR buf = (LPSTR)HEAP_xalloc(GetProcessHeap(), 0,
|
|
nNumberOfCharsToRead);
|
|
fgets(buf, nNumberOfCharsToRead, CONSOLE_console.conIO);
|
|
|
|
if (ferror(CONSOLE_console.conIO) {
|
|
HeapFree( GetProcessHeap(), 0, buf );
|
|
clearerr();
|
|
return FALSE;
|
|
}
|
|
|
|
lstrcpynAtoW(lpBuffer,buf,nNumberOfCharsToRead);
|
|
*lpNumberOfCharsRead = strlen(buf);
|
|
HeapFree( GetProcessHeap(), 0, buf );
|
|
return TRUE;
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* ReadConsoleInputA [KERNEL32.569] Reads data from a console
|
|
*
|
|
* PARAMS
|
|
* hConsoleInput [I] Handle to console input buffer
|
|
* lpBuffer [O] Address of buffer for read data
|
|
* nLength [I] Number of records to read
|
|
* lpNumberOfEventsRead [O] Address of number of records read
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI ReadConsoleInputA( HANDLE32 hConsoleInput,
|
|
LPINPUT_RECORD lpBuffer,
|
|
DWORD nLength, LPDWORD lpNumberOfEventsRead)
|
|
{
|
|
FIXME(console, "(%d,%p,%ld,%p): stub\n",hConsoleInput, lpBuffer, nLength,
|
|
lpNumberOfEventsRead);
|
|
return ReadConsole32A(hConsoleInput, lpBuffer, nLength,
|
|
lpNumberOfEventsRead, 0);
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetConsoleTitle32A (KERNEL32.476)
|
|
*/
|
|
BOOL32 WINAPI SetConsoleTitle32A(LPCSTR title)
|
|
{
|
|
PDB32 *pdb = PROCESS_Current();
|
|
CONSOLE *console;
|
|
DWORD written;
|
|
char titleformat[]="\033]2;%s\a"; /*this should work for xterms*/
|
|
LPSTR titlestring;
|
|
BOOL32 ret=FALSE;
|
|
|
|
TRACE(console,"(%s)\n",title);
|
|
|
|
console = (CONSOLE *)pdb->console;
|
|
if (!console)
|
|
return FALSE;
|
|
if(console->title) /* Free old title, if there is one */
|
|
HeapFree( SystemHeap, 0, console->title );
|
|
console->title = (LPSTR)HeapAlloc(SystemHeap, 0,strlen(title)+1);
|
|
if(console->title) strcpy(console->title,title);
|
|
|
|
titlestring = HeapAlloc(GetProcessHeap(), 0,strlen(title)+strlen(titleformat)+1);
|
|
if (!titlestring)
|
|
return FALSE;
|
|
|
|
sprintf(titlestring,titleformat,title);
|
|
/* Ugly casting */
|
|
CONSOLE_Write((K32OBJ *)console,titlestring,strlen(titlestring),&written,NULL);
|
|
if (written == strlen(titlestring))
|
|
ret =TRUE;
|
|
HeapFree( GetProcessHeap(), 0, titlestring );
|
|
return ret;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleTitle32W [KERNEL32.477] Sets title bar string for console
|
|
*
|
|
* PARAMS
|
|
* title [I] Address of new title
|
|
*
|
|
* NOTES
|
|
* This should not be calling the A version
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleTitle32W( LPCWSTR title )
|
|
{
|
|
BOOL32 ret;
|
|
|
|
LPSTR titleA = HEAP_strdupWtoA( GetProcessHeap(), 0, title );
|
|
ret = SetConsoleTitle32A(titleA);
|
|
HeapFree( GetProcessHeap(), 0, titleA );
|
|
return ret;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* FlushConsoleInputBuffer (KERNEL32.132)
|
|
*/
|
|
BOOL32 WINAPI FlushConsoleInputBuffer(HANDLE32 hConsoleInput)
|
|
{
|
|
FIXME(console,"(%d): stub\n",hConsoleInput);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleCursorPosition [KERNEL32.627]
|
|
* Sets the cursor position in console
|
|
*
|
|
* PARAMS
|
|
* hConsoleOutput [I] Handle of console screen buffer
|
|
* dwCursorPosition [I] New cursor position coordinates
|
|
*
|
|
* RETURNS STD
|
|
*/
|
|
BOOL32 WINAPI SetConsoleCursorPosition( HANDLE32 hConsoleOutput,
|
|
COORD dwCursorPosition )
|
|
{
|
|
TRACE(console, "%d (%d x %d)\n", hConsoleOutput, dwCursorPosition.x,
|
|
dwCursorPosition.y);
|
|
/* x are columns, y rows */
|
|
fprintf(stderr,"\r");
|
|
/* note: 0x1B == ESC */
|
|
fprintf(stdout,"%c[%d;%dH", 0x1B, dwCursorPosition.y, dwCursorPosition.x);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetNumberOfConsoleInputEvents (KERNEL32.246)
|
|
*/
|
|
BOOL32 WINAPI GetNumberOfConsoleInputEvents(HANDLE32 hcon,LPDWORD nrofevents)
|
|
{
|
|
*nrofevents = 0;
|
|
FIXME(console,"(%x): stub\n", hcon);
|
|
return TRUE;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* GetNumberOfConsoleMouseButtons (KERNEL32.358)
|
|
*/
|
|
BOOL32 WINAPI GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons)
|
|
{
|
|
FIXME(console,"(%p): stub\n", nrofbuttons);
|
|
*nrofbuttons = 2;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* PeekConsoleInputA (KERNEL32.550)
|
|
*/
|
|
BOOL32 WINAPI PeekConsoleInput32A(HANDLE32 hConsoleInput,
|
|
LPINPUT_RECORD pirBuffer,
|
|
DWORD cInRecords,
|
|
LPDWORD lpcRead)
|
|
{
|
|
pirBuffer = NULL;
|
|
cInRecords = 0;
|
|
*lpcRead = 0;
|
|
FIXME(console,"(%d,%p,%ld,%p): stub\n",hConsoleInput, pirBuffer,
|
|
cInRecords, lpcRead);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* PeekConsoleInputW (KERNEL32.551)
|
|
*/
|
|
BOOL32 WINAPI PeekConsoleInput32W(HANDLE32 hConsoleInput,
|
|
LPINPUT_RECORD pirBuffer,
|
|
DWORD cInRecords,
|
|
LPDWORD lpcRead)
|
|
{
|
|
pirBuffer = NULL;
|
|
cInRecords = 0;
|
|
*lpcRead = 0;
|
|
FIXME(console,"(%d,%p,%ld,%p): stub\n", hConsoleInput, pirBuffer,
|
|
cInRecords, lpcRead);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* GetConsoleCursorInfo32 [KERNEL32.296] Gets size and visibility of console
|
|
*
|
|
* PARAMS
|
|
* hcon [I] Handle to console screen buffer
|
|
* cinfo [O] Address of cursor information
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI GetConsoleCursorInfo32( HANDLE32 hcon,
|
|
LPCONSOLE_CURSOR_INFO cinfo )
|
|
{
|
|
FIXME(console, "(%x,%p): stub\n", hcon, cinfo);
|
|
if (!cinfo) return FALSE;
|
|
cinfo->dwSize = 10; /* 10% of character box is cursor. */
|
|
cinfo->bVisible = TRUE; /* Cursor is visible. */
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleCursorInfo32 [KERNEL32.626] Sets size and visibility of cursor
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleCursorInfo32(
|
|
HANDLE32 hcon, /* [in] Handle to console screen buffer */
|
|
LPCONSOLE_CURSOR_INFO cinfo) /* [in] Address of cursor information */
|
|
{
|
|
FIXME(console, "(%x,%ld,%i): stub\n", hcon,cinfo->dwSize,cinfo->bVisible);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleWindowInfo [KERNEL32.634] Sets size and position of console
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleWindowInfo(
|
|
HANDLE32 hcon, /* [in] Handle to console screen buffer */
|
|
BOOL32 bAbsolute, /* [in] Coordinate type flag */
|
|
LPSMALL_RECT window) /* [in] Address of new window rectangle */
|
|
{
|
|
FIXME(console, "(%x,%d,%p): stub\n", hcon, bAbsolute, window);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleTextAttribute32 [KERNEL32.631] Sets colors for text
|
|
*
|
|
* Sets the foreground and background color attributes of characters
|
|
* written to the screen buffer.
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleTextAttribute32(HANDLE32 hConsoleOutput,WORD wAttr)
|
|
{
|
|
int forecolor = 0;
|
|
int backcolor = 0;
|
|
int boldtext = 0;
|
|
unsigned int attrib;
|
|
|
|
attrib = wAttr;
|
|
if( attrib >= BACKGROUND_INTENSITY )
|
|
attrib -= BACKGROUND_INTENSITY; /* Background intensity is ignored */
|
|
if( attrib >= BACKGROUND_RED )
|
|
{
|
|
attrib -= BACKGROUND_RED;
|
|
if( attrib >= BACKGROUND_GREEN )
|
|
{
|
|
attrib -= BACKGROUND_GREEN;
|
|
if( attrib >= BACKGROUND_BLUE )
|
|
{
|
|
attrib -= BACKGROUND_BLUE;
|
|
backcolor = 47; /* White background */
|
|
}
|
|
else
|
|
backcolor = 43; /* Yellow background */
|
|
}
|
|
else if( attrib >= BACKGROUND_BLUE )
|
|
{
|
|
attrib -= BACKGROUND_BLUE;
|
|
backcolor = 45; /* Magenta background */
|
|
}
|
|
else
|
|
backcolor = 41; /* Red Background */
|
|
}
|
|
else if( attrib >= BACKGROUND_GREEN )
|
|
{
|
|
attrib -= BACKGROUND_GREEN;
|
|
if( attrib >= BACKGROUND_BLUE )
|
|
{
|
|
attrib -= BACKGROUND_BLUE;
|
|
backcolor = 46; /* Cyan background */
|
|
}
|
|
else
|
|
backcolor = 42; /* Green background */
|
|
}
|
|
else if( attrib >= BACKGROUND_BLUE )
|
|
{
|
|
attrib -= BACKGROUND_BLUE;
|
|
backcolor = 44; /* Blue background */
|
|
}
|
|
else
|
|
backcolor = 40; /* Black background */
|
|
if( attrib >= FOREGROUND_INTENSITY )
|
|
{
|
|
attrib -= FOREGROUND_INTENSITY;
|
|
boldtext = 1; /* Bold attribute is on */
|
|
}
|
|
if( attrib >= FOREGROUND_RED )
|
|
{
|
|
attrib -= FOREGROUND_RED;
|
|
if( attrib >= FOREGROUND_GREEN )
|
|
{
|
|
attrib -= FOREGROUND_GREEN;
|
|
if( attrib >= FOREGROUND_BLUE )
|
|
{
|
|
attrib -= FOREGROUND_BLUE;
|
|
forecolor = 37; /* White foreground */
|
|
}
|
|
else
|
|
forecolor = 33; /* Yellow foreground */
|
|
}
|
|
else if( attrib >= FOREGROUND_BLUE )
|
|
{
|
|
attrib -= FOREGROUND_BLUE;
|
|
forecolor = 35; /* Magenta foreground */
|
|
}
|
|
else
|
|
forecolor = 31; /* Red foreground */
|
|
}
|
|
else if( attrib >= FOREGROUND_GREEN )
|
|
{
|
|
attrib -= FOREGROUND_GREEN;
|
|
if( attrib >= FOREGROUND_BLUE )
|
|
{
|
|
attrib -= FOREGROUND_BLUE;
|
|
forecolor = 36; /* Cyan foreground */
|
|
}
|
|
else
|
|
forecolor = 32; /* Green foreground */
|
|
}
|
|
else if( attrib >= FOREGROUND_BLUE )
|
|
{
|
|
attrib -= FOREGROUND_BLUE;
|
|
forecolor = 34; /* Blue foreground */
|
|
}
|
|
else
|
|
forecolor = 30; /* Black foreground */
|
|
|
|
fprintf(stdout,"%c[%d;%d;%dm",0x1B,boldtext,forecolor,backcolor);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* SetConsoleScreenBufferSize [KERNEL32.630] Changes size of console
|
|
*
|
|
* PARAMS
|
|
* hConsoleOutput [I] Handle to console screen buffer
|
|
* dwSize [I] New size in character rows and cols
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI SetConsoleScreenBufferSize( HANDLE32 hConsoleOutput,
|
|
COORD dwSize )
|
|
{
|
|
FIXME(console, "(%d,%dx%d): stub\n",hConsoleOutput,dwSize.x,dwSize.y);
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* FillConsoleOutputCharacterA [KERNEL32.242]
|
|
*
|
|
* PARAMS
|
|
* hConsoleOutput [I] Handle to screen buffer
|
|
* cCharacter [I] Character to write
|
|
* nLength [I] Number of cells to write to
|
|
* dwCoord [I] Coords of first cell
|
|
* lpNumCharsWritten [O] Pointer to number of cells written
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI FillConsoleOutputCharacterA(
|
|
HANDLE32 hConsoleOutput,
|
|
BYTE cCharacter,
|
|
DWORD nLength,
|
|
COORD dwCoord,
|
|
LPDWORD lpNumCharsWritten)
|
|
{
|
|
long count;
|
|
SetConsoleCursorPosition(hConsoleOutput,dwCoord);
|
|
for(count=0;count<nLength;count++)
|
|
putc(cCharacter,stdout);
|
|
*lpNumCharsWritten = nLength;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* FillConsoleOutputCharacterW [KERNEL32.243] Writes characters to console
|
|
*
|
|
* PARAMS
|
|
* hConsoleOutput [I] Handle to screen buffer
|
|
* cCharacter [I] Character to write
|
|
* nLength [I] Number of cells to write to
|
|
* dwCoord [I] Coords of first cell
|
|
* lpNumCharsWritten [O] Pointer to number of cells written
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI FillConsoleOutputCharacterW(HANDLE32 hConsoleOutput,
|
|
WCHAR cCharacter,
|
|
DWORD nLength,
|
|
COORD dwCoord,
|
|
LPDWORD lpNumCharsWritten)
|
|
{
|
|
long count;
|
|
SetConsoleCursorPosition(hConsoleOutput,dwCoord);
|
|
for(count=0;count<nLength;count++)
|
|
putc(cCharacter,stdout);
|
|
*lpNumCharsWritten = nLength;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* FillConsoleOutputAttribute [KERNEL32.241] Sets attributes for console
|
|
*
|
|
* PARAMS
|
|
* hConsoleOutput [I] Handle to screen buffer
|
|
* wAttribute [I] Color attribute to write
|
|
* nLength [I] Number of cells to write to
|
|
* dwCoord [I] Coords of first cell
|
|
* lpNumAttrsWritten [O] Pointer to number of cells written
|
|
*
|
|
* RETURNS
|
|
* Success: TRUE
|
|
* Failure: FALSE
|
|
*/
|
|
BOOL32 WINAPI FillConsoleOutputAttribute( HANDLE32 hConsoleOutput,
|
|
WORD wAttribute, DWORD nLength, COORD dwCoord,
|
|
LPDWORD lpNumAttrsWritten)
|
|
{
|
|
FIXME(console, "(%d,%d,%ld,%dx%d,%p): stub\n", hConsoleOutput,
|
|
wAttribute,nLength,dwCoord.x,dwCoord.y,lpNumAttrsWritten);
|
|
*lpNumAttrsWritten = nLength;
|
|
return TRUE;
|
|
}
|
|
|
|
/******************************************************************************
|
|
* ReadConsoleOutputCharacter32A [KERNEL32.573]
|
|
*
|
|
* BUGS
|
|
* Unimplemented
|
|
*/
|
|
BOOL32 WINAPI ReadConsoleOutputCharacter32A(HANDLE32 hConsoleOutput,
|
|
LPSTR lpstr, DWORD dword, COORD coord, LPDWORD lpdword)
|
|
{
|
|
FIXME(console, "(%d,%p,%ld,%dx%d,%p): stub\n", hConsoleOutput,lpstr,
|
|
dword,coord.x,coord.y,lpdword);
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* ScrollConsoleScreenBuffer [KERNEL32.612]
|
|
*
|
|
* BUGS
|
|
* Unimplemented
|
|
*/
|
|
BOOL32 WINAPI ScrollConsoleScreenBuffer( HANDLE32 hConsoleOutput,
|
|
LPSMALL_RECT lpScrollRect, LPSMALL_RECT lpClipRect,
|
|
COORD dwDestOrigin, LPCHAR_INFO lpFill)
|
|
{
|
|
FIXME(console, "(%d,%p,%p,%dx%d,%p): stub\n", hConsoleOutput,lpScrollRect,
|
|
lpClipRect,dwDestOrigin.x,dwDestOrigin.y,lpFill);
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
return FALSE;
|
|
}
|