wine-wine/dlls/kernel32/comm.c

756 lines
21 KiB
C
Raw Permalink Normal View History

2001-01-25 22:22:21 +00:00
/*
Release 941122 Sun Nov 20 18:30:06 1994 Alexandre Julliard (julliard@lamisun.epfl.ch) * [controls/scroll.c] [include/scroll.h] Rewritten most of scroll-bar code for better Windows look & feel. Implemented EnableScrollBar(). Preliminary keyboard support. * [objects/bitblt.c] Fixed BadMatch error for BitBlt() and StretchBlt() when reading bits from outside the visible region. * [objects/oembitmap.c] [include/bitmaps/obm_*] Use XPM symbolic colors to load bitmaps. This allows the colors of the bitmaps to depend on the system colors. * [tools/make_debug] Made the make_debug script more robust. * [windows/dialog.c] Fixed CheckRadioButton(). * [windows/nonclient.c] A few changes to scroll-bar drawing and tracking. * [windows/winpos.c] Renamed NextWindowFromPoint() to WINPOS_NextWindowFromPoint() to avoid confusion, and optimized it somewhat. Nov 19, 94 Martin Ayotte (wine@trgcorp.mksinfo.qc.ca) * [misc/audio.c] * [misc/mcianim.c] more coding but nothing spectacular. * [misc/mmaux.c] some coding to access '/dev/mixer'. * [misc/midi.c] some coding to read .MID files, but it's not playing yet. Sun Nov 13 19:31:03 1994 James Youngman (mbcstjy@afs.man.ac.uk) * [objects/dib.c] Reimplemented DIB_SetImageBits_RLE8() so that it would cope with bitmaps which don't end 0x00, 0x02 (previously it blew up). This includes some bitmaps output by Paint Shop Pro. Implementation is possibly now too lax. Please see the notes on the function about why. * [controls/desktop.c] The desktop pattern should be painted if the wallpaper doesn't cover the whole screen width OR the whole screen height. Sun Nov 13 00:07:11 MET 1994 Erik Bos <erik@xs4all.nl> * [objects/dib.c] Small bug in DIB_SetImageBits() fixed, bitmaps in 16,24 bpp now work. * [loader/ne_resource.c] [include/resource.h] Some cleanup. Thu Nov 10 20:44:58 1994 Martin von Loewis (martin@cs.csufresno.edu) * [Configure] [rc/sysres.rc] Primitive compile-time support for multiple languages * [rc/sysres_De.rc] New file * [loader/resource.c] LoadBitmap: Recognize end of sysresbm properly * [rc/Imakefile] Rules to compile resources simplified, dependencies changed * [rc/sysresbm.rc] Don't use sysresbm if using XPM * [windows/dialog.c] CreateDialogIndirectParam: Reverse Z-order of controls * [windows/message.c] MSG_TranslateMouseMsg: Fix HTTRANSPARENT handling * [windows/winpos.c] NextWindowFromPoint: New function * [controls/button.c] WM_NCHITTEST: Group Box is HTTRANSPARENT BUTTON_CheckAutoRadioButton: New function BM_SETCHECK: Added call to BUTTON_CheckAutoRadioButton Mon Nov 7 11:20:26 1994 Paul Falstad (pf@zoof.cts.com) * [objects/text.c] Fix hang when using DrawText(..., DT_WORDBREAK) with a word that is too long to break. * [objects/font.c] Don't assume helvetica if there is no font family; let the other font attributes decide what font to use. * [controls/widgets.c] Listboxes and combo boxes need to be notified of double-clicks. * [controls/listbox.c] [include/listbox.h] scrolling to bottom of list box should display last item at the bottom, not at the top. list boxes need to allocate a separate heap for their item data, rather than using the user heap. Otherwise, it's very easy to run out of memory for list box items. removed redundant code in ListBoxAddString(). Implemented simple version of LBS_SORT. Don't put [.] in the list box when using DDL_DIRECTORY. * [controls/combo.c] Combos should pass CBS_SORT onto their list box. * [windows/win.c] If window creation is aborted, remove the window from the linked lists. * [controls/static.c] static controls with SS_ICON were always returning 0 from WM_NCCREATE. Make sure static controls have text to draw before drawing it.
1994-11-22 16:31:29 +00:00
* DEC 93 Erik Bos <erik@xs4all.nl>
Release 960728 Sun Jul 28 17:57:19 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [loader/task.c] [include/task.h] Implemented SwitchStackTo()/SwitchStackBack(). * [include/wintypes.h] [loader/main.c] Added __winelib variable to distinguish between emulator and library at run-time. Later on, this should avoid some recompilations when building Winelib. * [windows/property.c] Implemented Win32 functions for window properties. Fri Jul 26 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [controls/listbox.c] Implemented LBS_SORT style, WM_COMPAREITEM, and WM_DELETEITEM messages. * [controls/menu.c] Call TranslateMessage() to enable shortcuts (on WM_CHAR). * [include/cursoricon.h] Moved #pragma pack(1) back to where it belongs. * [objects/palette.c] RealizeDefaultPalette() maps to system colors only. Do not broadcast palette notifications when in TrueColor. * [objects/color.c] [include/palette.h] Miscellaneous optimizations. Had to fix several "improvements" made to my patch for previous release. * [objects/dib.c] Reverse dib bits order for 24-bit SetDIBits(). * [objects/dc.c] GetDeviceCaps() does not return RC_PALETTE when in TrueColor. * [windows/scroll.c] Scroll update region too. * [windows/message.c] Include QS_MOUSE into the event mask for nonclient mouse message filter. Fixes problems with Word 6 freezing when mouse hits nonclient area. * [windows/win.c] Allow top-level windows to be linked as HWND_TOP in CreateWindow(). * [windows/winpos.c] [windows/mdi.c] Attempt to fix control menu duplication. Fri Jul 26 09:49:35 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/drive.c] GetDriveType32A(): return value for CDROM fixed. * [files/file.c] SearchPath* added. * [if1632/gdi32.spec] [objects/brush.c] SetBrushOrgEx() added. * [loader/pe_resource.c] If even loading the default entry fails, we just use the first entry from the resource directory. [loader/task.c] SetSigHandler() stub added, Paradox 4.5 now starts up. * [misc/comm.c] [include/windows.h] [if1632/kernel32.spec] COMM functions updated to win32, not complete. * [misc/lstr.c] FormatMessageA partially implemented. * [include/miscemu.h] [memory/selector.c] [memory/global.c] [miscemu/dosmem.c] DOS memory handling changed: 1MB preallocated block, real-mode segment handling possible, SetSelectorBase into lower physical 1MB possible. * [miscemu/dpmi.c] Real-mode segments changed, real-mode int 21,ax=6506 added. AX=0x0303 added. * [multimedia/time.c] Fixed bug in killTimer. * [objects/bitmap.c] LoadImageA partially implemented. Wed Jul 24 18:20:24 1996 Albrecht Kleine <kleine@ak.sax.de> * [include/dde_mem.h][include/dde_proc.h] [ipc/dde_atom.c][ipc/dde_proc.c][windows/message.c] [ipc/generic_hash.h][library/miscstubs.c] Changes for error free compilation using "--with-ipc": replaced some names with *16-equivalent (e.g. MSG to MSG16), modified prototype of function DDE_GlobalFree() . * [objects/palette.c] Added check for metafile-DC in GDISelectPalette(), GDIRealizePalette(),RealizeDefaultPalette() and IsDCCurrentPalette(). Tue Jul 23 22:46:53 1996 Andrew Lewycky <plewycky@oise.utoronto.ca> * [controls/edit.c] EDIT_WM_Create: Don't EDIT_EM_ReplaceSel if created with lParam = "", fixes Winhelp. * [windows/dialog.c] DIALOG_CreateIndirect: Initialise dlgProc before creating children.
1996-07-28 18:50:11 +00:00
*
* Copyright 1996 Marcus Meissner
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Release 0.5 Sun Jan 2 12:38:53 1994 David Metcalfe <david@prism.demon.co.uk> * [windows/class.c] Implemented GetClassName and GetClassInfo. * [windows/caret.c] Various improvements to text caret code. Fri Dec 31 15:22:22 1993 John Brezak <brezak@apollo.hp.com> * [misc/comm.c] Patches to work with NetBSD. Thu Dec 30 12:11:55 1993 John Richardson <jrichard@cs.uml.edu> * [objects/bitblt.c] Added StretchBlt(). Tue Jan 4 05:22:07 1994 julliard@di.epfl.ch (Alexandre Julliard) * [misc/user.c] Added creation of system message queue. * [objects/bitmap.c] [objects/dcvalues.c] [windows/dc.c] Added DC size fields into DC structure. * [objects/clipping.c] Bug fix in CLIPPING_IntersectRect(). * [windows/class.c] Allocate a DCE instead of a DC for CS_CLASSDC classes. * [windows/clipping.c] Fixed GetUpdateRect() and GetUpdateRgn() to clip to the client area. * [windows/dce.c] Implemented GetDCEx() and GetWindowDC(). * [windows/defwnd.c] Implemented WM_WINDOWPOSCHANGED handling. * [windows/event.c] Preliminary support for Xlib event handling instead of Xt callbacks. Changed MSG_AddMsg() calls to hardware_event() or PostMessage(). * [windows/message.c] Preliminary support for multiple message queues. Implemented hardware_event() to store messages into the system queue. Implemented Get/SetTaskQueue(). Better WM_PAINT and WM_TIMER handling. Changes to use Xlib instead of Xt for events. * [windows/painting.c] Use GetDCEx() to retrieve the DC, to get a correct visible region. * [windows/timer.c] Moved the timer procedure callback into DispatchMessage(). Changed implementation to get rid of Xt timeouts. Timer checking is now done inside GetMessage(). * [windows/win.c] Allocate a DCE instead of a DC for CS_OWNDC windows. Replaced Xt calls with Xlib calls. Moved window positioning functions into windows/winpos.c * [windows/winpos.c] (New file) Rewritten most of the window positioning functions. Implemented SetWindowPos() and MapWindowPoints(). Jan 3, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [if1632/user.spec] Bad arguments description for function SetDlgItemText. * [objects/text.c] Function DrawText now handle DT_CALCRECT request. * [misc/message.c] Message boxes now use DrawText with DT_CALCRECT. * [windows/graphics.c] Bug fix in function FrameRect, (it was using PEN instead of BRUSH). * [windows/win.c] Bug fix for flags in function ShowWindow. More accurate WM_SIZE generated by function ShowWindow. * [controls/listbox.c] More code for LBS_MULTIPLESEL. More code for LBS_MULTICOLUMN. * [include/windows.h] Bad define for MF_SEPARATOR. * [controls/menu.c] New functions: PopMenuWndProc() with 'glues', CreatePopupMenu(), AppendMenu(), InsertMenu(), RemoveMenu(), DeleteMenu(), ModifyMenu(), TrackPopupMenu(). Code in stubs: CreateMenu(), DestroyMenu(). Sat Jan 1 10:22:43 1994 Bob Amstadt (bob@pooh) * loader/wine.c: Added support for relocation types 5 and 6. Mon Dec 27 11:06:03 1993 Erik Bos (erik@trashcan.hacktic.nl) * [misc/comm.c] new functions: BuildCommDCB(), OpenComm(), CloseComm(), SetCommBreak(), ClearCommBreak(), EscapeCommFunction(), FlushComm(), GetCommError(), SetCommEventMask(), GetCommEventMask(), SetCommState(), GetCommState(), TransmitCommChar(), ReadComm(), WriteComm(). Wed Dec 22 13:00:15 1993 David Metcalfe <david@prism.demon.co.uk> * [windows/caret.c] Implemented text caret functions. Tue Dec 21 06:13:58 1993 julliard@di.epfl.ch (Alexandre Julliard) * [loader/wine.c] Bug fix in LoadImage(). * [objects/bitblt.c] [objects/clipping.c] [objects/text.c] [windows/dc.c] [windows/dce.c] [windows/graphics.c] Modified graphics calls to take into account the DC origin. * [windows/defwnd.c] Added preliminary WM_NCCALCSIZE handling. * [windows/event.c] Send WM_NCCALCSIZE message on resize event. * [windows/win.c] Send WM_NCCALCSIZE message in CreateWindow(). Realize widgets at creation time (should prevent problems with unrealized widgets). Dec 19, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/static.c] Send mouse & keyboard message received to its parent. * [controls/scroll.c] Send keyboard message received to its parent. * [controls/listbox.c] Add Navigation keys . ListBox now use VSCROLL & HSCROLL instead of children. Alpha version of LBS_MULTIPLESEL. Alpha version of LBS_MULTICOLUMN. * [controls/combo.c] Add Navigation keys on closed ComboBox. Remove useless 'COMBOBOX_CreateComboBox' function. Mon Dec 19 20:39:34 1993 Erik Bos (erik@trashcan.hacktic.nl) * [loader/wine. LoadImage() modified to use FindFile(). * [misc/file.c] SetErrorMode added * [misc/dos_fs.c] bug fixes. Dec 13, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [memory/global.c] bug fix in GlobalGetFreeSegment : good ptr in 'g_prev'. * [sysres.dll] preliminary version of a 'glass of wine' bitmap * [windows/event.c] New function 'GetCapture'. * [controls/scroll.c] Remove useless 'SCROLLBAR_CreateScrollBar' function. * [controls/listbox.c] Remove useless 'LISTBOX_CreateListBox' function. Mon Dec 13 13:51:00 1993 David Metcalfe <david@prism.demon.co.uk> * [objects/font.c] Corrected bugs in GetCharWidth(). * [windows/event.c] Modified EVENT_key to send Windows virtual key codes for WM_KEYDOWN and WM_KEYUP messages, and a WM_CHAR message for printable characters. Wed Dec 08 19:20:00 1993 Karl Guenter Wuensch (hn324wu@unidui.uni-duisburg.de) * [windows/graphics.c] Added Polyline and Polygon Mon Dec 13 14:51:54 1993 Erik Bos (erik@trashcan.hacktic.nl) * [controls/listbox.c] ListBoxDirectory() modified to use dos_fs.c's functions to access files&|drives. Sat Dec 04 17:04:23 1993 Erik Bos (erik@trashcan.hacktic.nl) * [misc/dos_fs.c] Added FindFile() to search a file in a dos/unix style path. * [misc/file.c] New Win31 functions: OpenFile, _lcreate, _llseek, GetTempDrive, GetTempFileName, GetWindowsDirectory, GetSystemDirectory, GetDriveType. * [misc/int21.c] Modified. Wed Dec 1 16:20:45 1993 Miguel de Icaza (miguel@roxanne.nuclecu.unam.mx) * [misc/profile.c] The Profile functions now return the correct values. They now implement all the features described in the SDK. Tue Nov 30 13:55:27 1993 Bob Amstadt (bob at amscons) * [loader/selector.c] Rewrote selector aliasing routines to use System V IPC routine to alias memory segments. Nov 28, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] More consistency in functions using wIndexes * [controls/scroll.c] New function : ShowScrollBar(). * [loader/cursor.c] ... New file Move cursor functions from [loader/resource.c]. New function : ClipCursor(). New function : GetClipCursor(). New function : CreateCursor(). SetCursor() now working using gloabal variable 'winHasCursor'. *[object/palette.c] New stub only : SelectPalette(). New stub only : RealizePalette(). *[win/event.c] New function : EVENT_enter_notify(), update 'winHasCursor' and send WM_SETCURSOR. *[win/defwnd.c] Add processing of WM_SETCURSOR message. *[win/win.c] New members in WND structure : hCursor, hWndVScroll & hWndHScroll. CreateWindowEx() now create children for WM_HSCROLL & WM_VSCROLL. New function ClientToScreen(). New function ScreenToClient(). Mon Nov 25 18:25:40 1993 Erik Bos (erik@trashcan.hacktic.nl) * [files.h / regfunc.h / misc/dos.c] Removed. * [misc/dos_fs.c] Added support for loading dosdrive cfg from wine.ini. * [misc/int21.c] Modified. Wed Nov 24 11:37:33 1993 julliard@disuns2.epfl.ch (Alexandre Julliard) * [include/atom.h] [memory/atom.c] Implemented atoms. * [windows/class.c] Modified RegisterClass() to use atoms. Implemented CS_GLOBALCLASS style. * [windows/message.c] Implemented RegisterWindowMessage(). * [loader/resource.c] Bug fix in LoadResource(). * [windows/dialog.c] Modified CreateDialogParam() to use Find/LoadResource().
1994-01-04 20:14:34 +00:00
*/
#include "config.h"
#include "wine/port.h"
Release 980413 Sun Apr 12 12:22:23 1997 Andreas Mohr <100.30936@germany.net> * [files/drive.c] Fixed "no free space" problem with partition sizes between 1 and 2 GB (cluster_sectors may not exceed 0x40). * [windows/msgbox.c] [if1632/user.spec] [include/windows.h] Implemented MessageBoxIndirect16, corrected MSGBOXPARAMS16. * [loader/task.c] DOS environment strings may never exceed 127 chars -> truncate Unix environment strings if necessary. Sun Apr 12 02:51:44 1998 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [files/*.c] All fprintf statements were converted to appropriate debug messages. * [tools/find_debug_channels] Updated comments at the beginning of the file. Sat Apr 11 15:27:21 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [loader/module.c] [loader/task.c] [scheduler/process.c] Moved some code around to prepare the ground for CreateProcess(). * [memory/environ.c] [loader/task.c] Moved Win32 environment strings functions to environ.c. Unified Win16 and Win32 environment management. * [scheduler/handle.c] [scheduler/k32obj.c] [scheduler/*.c] Implemented handle inheritance and DuplicateHandle(). * [scheduler/thread.c] Create a 16-bit stack for all threads. * [windows/dialog.c] Implemented DIALOGEX resource format. Fri Apr 10 20:21:51 1998 Marcus Meissner <marcus@mud.de> * [configure.in][include/acconfig.h][*/*][multimedia/*] Cleaned up the OSS detection stuff, added some more checks for headerfiles/functions. Removed a lot of OS specific #ifdefs. Lots of dependend multimedia cleanups. * [loader/pe_image.c] Enhanced comment, added missing reference count increase. * [ole/compobj.c] Replaced broken StringFromGUID2 by working one. * [misc/winsock.c] SO_LINGER uses unsigned 16 bit in Win16 and Win32, but unsigned int (32bit) for UNIX. * [memory/global.c] Allow realloc for lockcount 1 too. Fri Apr 10 15:27:34 1998 Morten Welinder <terra@diku.dk> * [graphics/x11drv/text.c] Handle control characters in trace. Ignore terminating newline. * [multimedia/init.c] (MULTIMEDIA_Init): Correct allocations. * [tools/examine-relay] Tidy up. * [windows/syscolor.c] Change highlight colour from lightblue to lightgray. This looks correct for menus. Fri Apr 10 01:49:58 1998 Douglas Ridgway <ridgway@winehq.com> * [configure.in] [Make.rules.in] Add check for c2man before using it. Fri Apr 10 02:59:21 1998 Douglas Ridgway <ridgway@winehq.com> * [DEVELOPERS-HINTS] Simple description of adding API calls. * [include/wintypes.h] [include/windows.h] Get rid of Winelib16, avoid declaring some illegal functions in Winelib, add prototypes for some enhanced metafile functions, fix GetTextExtentPoint32 declarations. * [relay32/gdi32.spec] [objects/enhmetafile.c] Cosmetic and functional improvements. * [include/wincon.h] [programs/view/*] Fixes, improved compatibility with native compilers. Thu Apr 9 15:48:49 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [win32/kernel32.c] Implemented FT_Thunk / FT_Prolog / FT_Exit / FT_PrologPrime. Fixed Common32ThkLS thunk function. * [tools/build.c] [relay32/relay386.c] [if1632/relay.c] Changed relay code to allow register functions to modify stack layout. * [memory/selector.c] Implemented AllocMappedBuffer / FreeMappedBuffer. * [relay32/kernel32.spec] [if1632/kernel.spec] [win32/ordinals.c] Added names for undocumented functions. * [loader/module.c] Bugfix: LoadLibrary16 should *not* silently load 32-bit DLL. Thu Apr 9 03:54:58 1998 Jim Peterson <jspeter@birch.ee.vt.edu> * [windows/keyboard.c] Fix an erroneous test in TranslateAccelerator{16,32} for the end of the accelerator table. Thu Apr 8 20:36:28 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [misc/crtdll.c] Implement getenv. * [misc/commdlg.c] Make Get[Save/Open]FileName work in most situations. * [misc/lstr.c] Use wvsprintf32A instead of vsprintf in FormatMessage32X * [misc/version] Make NT3.50 a recognised version * [graphics/x11drv/graphics.c] Change the algorithme to draw arcs * [loader/resource.c] Return an empty buffer in LoadString32A if no resource found. * [win32/code_page.c] Try harder to get the right size in MultiByteToWideChar. * [win32/process.c] Call WinExec32 for CreateProcess32A. * [windows/user.c] Install default Int0 Handler in InitApp(). Thu Apr 8 19:29:48 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [misc/imagelist.c] Preliminary fix for drawing selected images. Various improvements. * [controls/progress.c][include/progress.c][include/commctrl.h] Added progress bar messages and styles for IE4.01 (dll version 4.72) compatibility. Fixed led size problem. * [controls/updown.c][include/commctrl.h] Added UDM_GETRANGE32 and UDM_SETRANGE32. * [objects/oembitmaps.c][include/windows.h][include/bitmaps/*] Added Win95 icons and fixed Win95 cursor and restore button bug. Now they should be visible. Sorry!!! * [relay32/comctl32.spec] Added most missing function names. Tue Apr 6 18:48:36 1998 Matthew Becker <mbecker@glasscity.net> * [objects/font.c] [if1632/gdi.spec] GetOutlineTextMetrics: stub * [objects/text.c] GetTextCharset should just call GetTextCharsetInfo. * [misc/mpr.c] [relay32/mpr.spec] WNetCachePassword: stub * [scheduler/thread.c] [relay32/user32.spec] AttachThreadInput: stub Updated documentation. * [objects/palette.c] Updated documentation. Tue Mar 31 17:06:30 1998 James Juran <jrj120@psu.edu> * [*/*.c] Finished fixing USER32 ordinal numbers in function documentation. Mon Mar 30 20:27:38 1998 Morten Welinder <terra@diku.dk> * [misc/debugstr.c] [include/debugstr.h] Moved _dumpstr from relay32/relay386.c. Improved control character handling. * [msdos/int21.c] Implement 215E00 -- get machine name. * [windows/winpos.c] SetWindowPos32: Make an extra sync when mapping managed windows. This makes sure the reconfigure event has been handled. See Mshearts' what's-your-name window. Mon Mar 30 01:13:50 1998 Alexander V. Lukyanov <lav@long.yar.ru> * [Makefile.in] Install includes from TOPSRCDIR.
1998-04-13 12:21:30 +00:00
Release 0.5 Sun Jan 2 12:38:53 1994 David Metcalfe <david@prism.demon.co.uk> * [windows/class.c] Implemented GetClassName and GetClassInfo. * [windows/caret.c] Various improvements to text caret code. Fri Dec 31 15:22:22 1993 John Brezak <brezak@apollo.hp.com> * [misc/comm.c] Patches to work with NetBSD. Thu Dec 30 12:11:55 1993 John Richardson <jrichard@cs.uml.edu> * [objects/bitblt.c] Added StretchBlt(). Tue Jan 4 05:22:07 1994 julliard@di.epfl.ch (Alexandre Julliard) * [misc/user.c] Added creation of system message queue. * [objects/bitmap.c] [objects/dcvalues.c] [windows/dc.c] Added DC size fields into DC structure. * [objects/clipping.c] Bug fix in CLIPPING_IntersectRect(). * [windows/class.c] Allocate a DCE instead of a DC for CS_CLASSDC classes. * [windows/clipping.c] Fixed GetUpdateRect() and GetUpdateRgn() to clip to the client area. * [windows/dce.c] Implemented GetDCEx() and GetWindowDC(). * [windows/defwnd.c] Implemented WM_WINDOWPOSCHANGED handling. * [windows/event.c] Preliminary support for Xlib event handling instead of Xt callbacks. Changed MSG_AddMsg() calls to hardware_event() or PostMessage(). * [windows/message.c] Preliminary support for multiple message queues. Implemented hardware_event() to store messages into the system queue. Implemented Get/SetTaskQueue(). Better WM_PAINT and WM_TIMER handling. Changes to use Xlib instead of Xt for events. * [windows/painting.c] Use GetDCEx() to retrieve the DC, to get a correct visible region. * [windows/timer.c] Moved the timer procedure callback into DispatchMessage(). Changed implementation to get rid of Xt timeouts. Timer checking is now done inside GetMessage(). * [windows/win.c] Allocate a DCE instead of a DC for CS_OWNDC windows. Replaced Xt calls with Xlib calls. Moved window positioning functions into windows/winpos.c * [windows/winpos.c] (New file) Rewritten most of the window positioning functions. Implemented SetWindowPos() and MapWindowPoints(). Jan 3, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [if1632/user.spec] Bad arguments description for function SetDlgItemText. * [objects/text.c] Function DrawText now handle DT_CALCRECT request. * [misc/message.c] Message boxes now use DrawText with DT_CALCRECT. * [windows/graphics.c] Bug fix in function FrameRect, (it was using PEN instead of BRUSH). * [windows/win.c] Bug fix for flags in function ShowWindow. More accurate WM_SIZE generated by function ShowWindow. * [controls/listbox.c] More code for LBS_MULTIPLESEL. More code for LBS_MULTICOLUMN. * [include/windows.h] Bad define for MF_SEPARATOR. * [controls/menu.c] New functions: PopMenuWndProc() with 'glues', CreatePopupMenu(), AppendMenu(), InsertMenu(), RemoveMenu(), DeleteMenu(), ModifyMenu(), TrackPopupMenu(). Code in stubs: CreateMenu(), DestroyMenu(). Sat Jan 1 10:22:43 1994 Bob Amstadt (bob@pooh) * loader/wine.c: Added support for relocation types 5 and 6. Mon Dec 27 11:06:03 1993 Erik Bos (erik@trashcan.hacktic.nl) * [misc/comm.c] new functions: BuildCommDCB(), OpenComm(), CloseComm(), SetCommBreak(), ClearCommBreak(), EscapeCommFunction(), FlushComm(), GetCommError(), SetCommEventMask(), GetCommEventMask(), SetCommState(), GetCommState(), TransmitCommChar(), ReadComm(), WriteComm(). Wed Dec 22 13:00:15 1993 David Metcalfe <david@prism.demon.co.uk> * [windows/caret.c] Implemented text caret functions. Tue Dec 21 06:13:58 1993 julliard@di.epfl.ch (Alexandre Julliard) * [loader/wine.c] Bug fix in LoadImage(). * [objects/bitblt.c] [objects/clipping.c] [objects/text.c] [windows/dc.c] [windows/dce.c] [windows/graphics.c] Modified graphics calls to take into account the DC origin. * [windows/defwnd.c] Added preliminary WM_NCCALCSIZE handling. * [windows/event.c] Send WM_NCCALCSIZE message on resize event. * [windows/win.c] Send WM_NCCALCSIZE message in CreateWindow(). Realize widgets at creation time (should prevent problems with unrealized widgets). Dec 19, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/static.c] Send mouse & keyboard message received to its parent. * [controls/scroll.c] Send keyboard message received to its parent. * [controls/listbox.c] Add Navigation keys . ListBox now use VSCROLL & HSCROLL instead of children. Alpha version of LBS_MULTIPLESEL. Alpha version of LBS_MULTICOLUMN. * [controls/combo.c] Add Navigation keys on closed ComboBox. Remove useless 'COMBOBOX_CreateComboBox' function. Mon Dec 19 20:39:34 1993 Erik Bos (erik@trashcan.hacktic.nl) * [loader/wine. LoadImage() modified to use FindFile(). * [misc/file.c] SetErrorMode added * [misc/dos_fs.c] bug fixes. Dec 13, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [memory/global.c] bug fix in GlobalGetFreeSegment : good ptr in 'g_prev'. * [sysres.dll] preliminary version of a 'glass of wine' bitmap * [windows/event.c] New function 'GetCapture'. * [controls/scroll.c] Remove useless 'SCROLLBAR_CreateScrollBar' function. * [controls/listbox.c] Remove useless 'LISTBOX_CreateListBox' function. Mon Dec 13 13:51:00 1993 David Metcalfe <david@prism.demon.co.uk> * [objects/font.c] Corrected bugs in GetCharWidth(). * [windows/event.c] Modified EVENT_key to send Windows virtual key codes for WM_KEYDOWN and WM_KEYUP messages, and a WM_CHAR message for printable characters. Wed Dec 08 19:20:00 1993 Karl Guenter Wuensch (hn324wu@unidui.uni-duisburg.de) * [windows/graphics.c] Added Polyline and Polygon Mon Dec 13 14:51:54 1993 Erik Bos (erik@trashcan.hacktic.nl) * [controls/listbox.c] ListBoxDirectory() modified to use dos_fs.c's functions to access files&|drives. Sat Dec 04 17:04:23 1993 Erik Bos (erik@trashcan.hacktic.nl) * [misc/dos_fs.c] Added FindFile() to search a file in a dos/unix style path. * [misc/file.c] New Win31 functions: OpenFile, _lcreate, _llseek, GetTempDrive, GetTempFileName, GetWindowsDirectory, GetSystemDirectory, GetDriveType. * [misc/int21.c] Modified. Wed Dec 1 16:20:45 1993 Miguel de Icaza (miguel@roxanne.nuclecu.unam.mx) * [misc/profile.c] The Profile functions now return the correct values. They now implement all the features described in the SDK. Tue Nov 30 13:55:27 1993 Bob Amstadt (bob at amscons) * [loader/selector.c] Rewrote selector aliasing routines to use System V IPC routine to alias memory segments. Nov 28, 93 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [controls/listbox.c] More consistency in functions using wIndexes * [controls/scroll.c] New function : ShowScrollBar(). * [loader/cursor.c] ... New file Move cursor functions from [loader/resource.c]. New function : ClipCursor(). New function : GetClipCursor(). New function : CreateCursor(). SetCursor() now working using gloabal variable 'winHasCursor'. *[object/palette.c] New stub only : SelectPalette(). New stub only : RealizePalette(). *[win/event.c] New function : EVENT_enter_notify(), update 'winHasCursor' and send WM_SETCURSOR. *[win/defwnd.c] Add processing of WM_SETCURSOR message. *[win/win.c] New members in WND structure : hCursor, hWndVScroll & hWndHScroll. CreateWindowEx() now create children for WM_HSCROLL & WM_VSCROLL. New function ClientToScreen(). New function ScreenToClient(). Mon Nov 25 18:25:40 1993 Erik Bos (erik@trashcan.hacktic.nl) * [files.h / regfunc.h / misc/dos.c] Removed. * [misc/dos_fs.c] Added support for loading dosdrive cfg from wine.ini. * [misc/int21.c] Modified. Wed Nov 24 11:37:33 1993 julliard@disuns2.epfl.ch (Alexandre Julliard) * [include/atom.h] [memory/atom.c] Implemented atoms. * [windows/class.c] Modified RegisterClass() to use atoms. Implemented CS_GLOBALCLASS style. * [windows/message.c] Implemented RegisterWindowMessage(). * [loader/resource.c] Bug fix in LoadResource(). * [windows/dialog.c] Modified CreateDialogParam() to use Find/LoadResource().
1994-01-04 20:14:34 +00:00
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winioctl.h"
#include "ddk/ntddser.h"
#include "wine/server.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(comm);
/***********************************************************************
* COMM_Parse* (Internal)
*
* The following COMM_Parse* functions are used by the BuildCommDCB
* functions to help parse the various parts of the device control string.
*/
static LPCWSTR COMM_ParseStart(LPCWSTR ptr)
{
static const WCHAR comW[] = {'C','O','M',0};
/* The device control string may optionally start with "COMx" followed
by an optional ':' and spaces. */
if(!strncmpiW(ptr, comW, 3))
{
ptr += 3;
/* Allow any com port above 0 as Win 9x does (NT only allows
values for com ports which are actually present) */
if(*ptr < '1' || *ptr > '9')
return NULL;
/* Advance pointer past port number */
while(*ptr >= '0' && *ptr <= '9') ptr++;
/* The com port number must be followed by a ':' or ' ' */
if(*ptr != ':' && *ptr != ' ')
return NULL;
/* Advance pointer to beginning of next parameter */
while(*ptr == ' ') ptr++;
if(*ptr == ':')
{
ptr++;
while(*ptr == ' ') ptr++;
}
}
/* The device control string must not start with a space. */
else if(*ptr == ' ')
return NULL;
return ptr;
}
static LPCWSTR COMM_ParseNumber(LPCWSTR ptr, LPDWORD lpnumber)
{
if(*ptr < '0' || *ptr > '9') return NULL;
*lpnumber = strtoulW(ptr, NULL, 10);
while(*ptr >= '0' && *ptr <= '9') ptr++;
return ptr;
}
static LPCWSTR COMM_ParseParity(LPCWSTR ptr, LPBYTE lpparity)
{
/* Contrary to what you might expect, Windows only sets the Parity
member of DCB and not fParity even when parity is specified in the
device control string */
switch(*ptr++)
{
case 'e':
case 'E':
*lpparity = EVENPARITY;
break;
case 'm':
case 'M':
*lpparity = MARKPARITY;
break;
case 'n':
case 'N':
*lpparity = NOPARITY;
break;
case 'o':
case 'O':
*lpparity = ODDPARITY;
break;
case 's':
case 'S':
*lpparity = SPACEPARITY;
break;
default:
return NULL;
}
return ptr;
}
static LPCWSTR COMM_ParseByteSize(LPCWSTR ptr, LPBYTE lpbytesize)
{
DWORD temp;
if(!(ptr = COMM_ParseNumber(ptr, &temp)))
return NULL;
if(temp >= 5 && temp <= 8)
{
*lpbytesize = temp;
return ptr;
}
else
return NULL;
}
static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits)
{
DWORD temp;
static const WCHAR stopbits15W[] = {'1','.','5',0};
if(!strncmpW(stopbits15W, ptr, 3))
{
ptr += 3;
*lpstopbits = ONE5STOPBITS;
}
else
{
if(!(ptr = COMM_ParseNumber(ptr, &temp)))
return NULL;
if(temp == 1)
*lpstopbits = ONESTOPBIT;
else if(temp == 2)
*lpstopbits = TWOSTOPBITS;
else
return NULL;
}
return ptr;
}
static LPCWSTR COMM_ParseOnOff(LPCWSTR ptr, LPDWORD lponoff)
{
static const WCHAR onW[] = {'o','n',0};
static const WCHAR offW[] = {'o','f','f',0};
if(!strncmpiW(onW, ptr, 2))
{
ptr += 2;
*lponoff = 1;
}
else if(!strncmpiW(offW, ptr, 3))
{
ptr += 3;
*lponoff = 0;
}
else
return NULL;
return ptr;
}
/***********************************************************************
* COMM_BuildOldCommDCB (Internal)
*
* Build a DCB using the old style settings string eg: "96,n,8,1"
*/
static BOOL COMM_BuildOldCommDCB(LPCWSTR device, LPDCB lpdcb)
{
WCHAR last = 0;
if(!(device = COMM_ParseNumber(device, &lpdcb->BaudRate)))
return FALSE;
switch(lpdcb->BaudRate)
{
case 11:
case 30:
case 60:
lpdcb->BaudRate *= 10;
break;
case 12:
case 24:
case 48:
case 96:
lpdcb->BaudRate *= 100;
break;
case 19:
lpdcb->BaudRate = 19200;
break;
}
2002-05-31 23:06:46 +00:00
while(*device == ' ') device++;
if(*device++ != ',') return FALSE;
while(*device == ' ') device++;
if(!(device = COMM_ParseParity(device, &lpdcb->Parity)))
return FALSE;
while(*device == ' ') device++;
if(*device++ != ',') return FALSE;
while(*device == ' ') device++;
if(!(device = COMM_ParseByteSize(device, &lpdcb->ByteSize)))
return FALSE;
while(*device == ' ') device++;
if(*device++ != ',') return FALSE;
while(*device == ' ') device++;
if(!(device = COMM_ParseStopBits(device, &lpdcb->StopBits)))
return FALSE;
/* The last parameter for flow control is optional. */
while(*device == ' ') device++;
if(*device == ',')
{
device++;
while(*device == ' ') device++;
if(*device) last = *device++;
while(*device == ' ') device++;
}
/* Win NT sets the flow control members based on (or lack of) the last
parameter. Win 9x does not set these members. */
switch(last)
{
case 0:
lpdcb->fInX = FALSE;
lpdcb->fOutX = FALSE;
lpdcb->fOutxCtsFlow = FALSE;
lpdcb->fOutxDsrFlow = FALSE;
lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
2002-05-31 23:06:46 +00:00
break;
case 'x':
case 'X':
lpdcb->fInX = TRUE;
lpdcb->fOutX = TRUE;
lpdcb->fOutxCtsFlow = FALSE;
lpdcb->fOutxDsrFlow = FALSE;
lpdcb->fDtrControl = DTR_CONTROL_ENABLE;
lpdcb->fRtsControl = RTS_CONTROL_ENABLE;
2002-05-31 23:06:46 +00:00
break;
case 'p':
case 'P':
lpdcb->fInX = FALSE;
lpdcb->fOutX = FALSE;
lpdcb->fOutxCtsFlow = TRUE;
lpdcb->fOutxDsrFlow = TRUE;
lpdcb->fDtrControl = DTR_CONTROL_HANDSHAKE;
lpdcb->fRtsControl = RTS_CONTROL_HANDSHAKE;
2002-05-31 23:06:46 +00:00
break;
default:
return FALSE;
}
/* This should be the end of the string. */
if(*device) return FALSE;
return TRUE;
}
/***********************************************************************
* COMM_BuildNewCommDCB (Internal)
*
* Build a DCB using the new style settings string.
* eg: "baud=9600 parity=n data=8 stop=1 xon=on to=on"
*/
static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lptimeouts)
{
DWORD temp;
BOOL baud = FALSE, stop = FALSE;
static const WCHAR baudW[] = {'b','a','u','d','=',0};
static const WCHAR parityW[] = {'p','a','r','i','t','y','=',0};
static const WCHAR dataW[] = {'d','a','t','a','=',0};
static const WCHAR stopW[] = {'s','t','o','p','=',0};
static const WCHAR toW[] = {'t','o','=',0};
static const WCHAR xonW[] = {'x','o','n','=',0};
static const WCHAR odsrW[] = {'o','d','s','r','=',0};
static const WCHAR octsW[] = {'o','c','t','s','=',0};
static const WCHAR dtrW[] = {'d','t','r','=',0};
static const WCHAR rtsW[] = {'r','t','s','=',0};
static const WCHAR idsrW[] = {'i','d','s','r','=',0};
while(*device)
{
while(*device == ' ') device++;
if(!strncmpiW(baudW, device, 5))
{
baud = TRUE;
if(!(device = COMM_ParseNumber(device + 5, &lpdcb->BaudRate)))
return FALSE;
}
else if(!strncmpiW(parityW, device, 7))
{
if(!(device = COMM_ParseParity(device + 7, &lpdcb->Parity)))
return FALSE;
}
else if(!strncmpiW(dataW, device, 5))
{
if(!(device = COMM_ParseByteSize(device + 5, &lpdcb->ByteSize)))
return FALSE;
}
else if(!strncmpiW(stopW, device, 5))
{
stop = TRUE;
if(!(device = COMM_ParseStopBits(device + 5, &lpdcb->StopBits)))
return FALSE;
}
else if(!strncmpiW(toW, device, 3))
{
if(!(device = COMM_ParseOnOff(device + 3, &temp)))
return FALSE;
lptimeouts->ReadIntervalTimeout = 0;
lptimeouts->ReadTotalTimeoutMultiplier = 0;
lptimeouts->ReadTotalTimeoutConstant = 0;
lptimeouts->WriteTotalTimeoutMultiplier = 0;
lptimeouts->WriteTotalTimeoutConstant = temp ? 60000 : 0;
}
else if(!strncmpiW(xonW, device, 4))
{
if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE;
lpdcb->fOutX = temp;
lpdcb->fInX = temp;
}
else if(!strncmpiW(odsrW, device, 5))
{
if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE;
lpdcb->fOutxDsrFlow = temp;
}
else if(!strncmpiW(octsW, device, 5))
{
if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE;
lpdcb->fOutxCtsFlow = temp;
}
else if(!strncmpiW(dtrW, device, 4))
{
if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE;
lpdcb->fDtrControl = temp;
}
else if(!strncmpiW(rtsW, device, 4))
{
if(!(device = COMM_ParseOnOff(device + 4, &temp)))
return FALSE;
lpdcb->fRtsControl = temp;
}
else if(!strncmpiW(idsrW, device, 5))
{
if(!(device = COMM_ParseOnOff(device + 5, &temp)))
return FALSE;
/* Win NT sets the fDsrSensitivity member based on the
idsr parameter. Win 9x sets fOutxDsrFlow instead. */
lpdcb->fDsrSensitivity = temp;
}
else
return FALSE;
/* After the above parsing, the next character (if not the end of
the string) should be a space */
if(*device && *device != ' ')
return FALSE;
2002-05-31 23:06:46 +00:00
}
/* If stop bits were not specified, a default is always supplied. */
if(!stop)
{
if(baud && lpdcb->BaudRate == 110)
lpdcb->StopBits = TWOSTOPBITS;
else
lpdcb->StopBits = ONESTOPBIT;
}
return TRUE;
}
/**************************************************************************
* BuildCommDCBA (KERNEL32.@)
2000-12-19 23:33:03 +00:00
*
* Updates a device control block data structure with values from an
* ascii device control string. The device control string has two forms
* normal and extended, it must be exclusively in one or the other form.
*
* RETURNS
*
2002-02-27 21:34:54 +00:00
* True on success, false on a malformed control string.
*/
2000-12-19 23:33:03 +00:00
BOOL WINAPI BuildCommDCBA(
2001-02-12 03:49:57 +00:00
LPCSTR device, /* [in] The ascii device control string used to update the DCB. */
LPDCB lpdcb) /* [out] The device control block to be updated. */
{
return BuildCommDCBAndTimeoutsA(device,lpdcb,NULL);
}
/**************************************************************************
* BuildCommDCBAndTimeoutsA (KERNEL32.@)
2000-12-19 23:33:03 +00:00
*
* Updates a device control block data structure with values from an
2002-02-27 21:34:54 +00:00
* ascii device control string. Taking timeout values from a timeouts
2000-12-19 23:33:03 +00:00
* struct if desired by the control string.
*
* RETURNS
*
* True on success, false bad handles etc.
*/
2000-12-19 23:33:03 +00:00
BOOL WINAPI BuildCommDCBAndTimeoutsA(
2001-02-12 03:49:57 +00:00
LPCSTR device, /* [in] The ascii device control string. */
LPDCB lpdcb, /* [out] The device control block to be updated. */
LPCOMMTIMEOUTS lptimeouts) /* [in] The COMMTIMEOUTS structure to be updated. */
{
BOOL ret = FALSE;
UNICODE_STRING deviceW;
TRACE("(%s,%p,%p)\n",device,lpdcb,lptimeouts);
if(device) RtlCreateUnicodeStringFromAsciiz(&deviceW,device);
else deviceW.Buffer = NULL;
if(deviceW.Buffer) ret = BuildCommDCBAndTimeoutsW(deviceW.Buffer,lpdcb,lptimeouts);
RtlFreeUnicodeString(&deviceW);
return ret;
}
/**************************************************************************
* BuildCommDCBAndTimeoutsW (KERNEL32.@)
*
* Updates a device control block data structure with values from a
* unicode device control string. Taking timeout values from a timeouts
* struct if desired by the control string.
*
* RETURNS
*
* True on success, false bad handles etc
*/
BOOL WINAPI BuildCommDCBAndTimeoutsW(
LPCWSTR devid, /* [in] The unicode device control string. */
LPDCB lpdcb, /* [out] The device control block to be updated. */
LPCOMMTIMEOUTS lptimeouts) /* [in] The COMMTIMEOUTS structure to be updated. */
{
DCB dcb;
COMMTIMEOUTS timeouts;
BOOL result;
LPCWSTR ptr = devid;
TRACE("(%s,%p,%p)\n",debugstr_w(devid),lpdcb,lptimeouts);
memset(&timeouts, 0, sizeof timeouts);
/* Set DCBlength. (Windows NT does not do this, but 9x does) */
lpdcb->DCBlength = sizeof(DCB);
/* Make a copy of the original data structures to work with since if
if there is an error in the device control string the originals
should not be modified (except possibly DCBlength) */
dcb = *lpdcb;
if(lptimeouts) timeouts = *lptimeouts;
ptr = COMM_ParseStart(ptr);
if(ptr == NULL)
result = FALSE;
else if(strchrW(ptr, ','))
result = COMM_BuildOldCommDCB(ptr, &dcb);
else
result = COMM_BuildNewCommDCB(ptr, &dcb, &timeouts);
if(result)
{
*lpdcb = dcb;
if(lptimeouts) *lptimeouts = timeouts;
return TRUE;
}
else
{
WARN("Invalid device control string: %s\n", debugstr_w(devid));
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
}
/**************************************************************************
* BuildCommDCBW (KERNEL32.@)
2000-12-19 23:33:03 +00:00
*
* Updates a device control block structure with values from an
* unicode device control string. The device control string has two forms
* normal and extended, it must be exclusively in one or the other form.
*
* RETURNS
*
2005-03-30 17:08:31 +00:00
* True on success, false on a malformed control string.
*/
2000-12-19 23:33:03 +00:00
BOOL WINAPI BuildCommDCBW(
2001-02-12 03:49:57 +00:00
LPCWSTR devid, /* [in] The unicode device control string. */
LPDCB lpdcb) /* [out] The device control block to be updated. */
{
return BuildCommDCBAndTimeoutsW(devid,lpdcb,NULL);
}
/***********************************************************************
* FIXME:
* The functionality of CommConfigDialogA, GetDefaultCommConfig and
* SetDefaultCommConfig is implemented in a DLL (usually SERIALUI.DLL).
* This is dependent on the type of COMM port, but since it is doubtful
* anybody will get around to implementing support for fancy serial
2002-05-31 23:06:46 +00:00
* ports in WINE, this is hardcoded for the time being. The name of
* this DLL should be stored in and read from the system registry in
* the hive HKEY_LOCAL_MACHINE, key
* System\\CurrentControlSet\\Services\\Class\\Ports\\????
* where ???? is the port number... that is determined by PNP
2002-05-31 23:06:46 +00:00
* The DLL should be loaded when the COMM port is opened, and closed
* when the COMM port is closed. - MJM 20 June 2000
***********************************************************************/
2006-01-24 13:00:32 +00:00
static const WCHAR lpszSerialUI[] = {
2004-10-26 00:16:39 +00:00
's','e','r','i','a','l','u','i','.','d','l','l',0 };
/***********************************************************************
* CommConfigDialogA (KERNEL32.@)
*
* Raises a dialog that allows the user to configure a comm port.
* Fills the COMMCONFIG struct with information specified by the user.
* This function should call a similar routine in the COMM driver...
*
* RETURNS
*
* TRUE on success, FALSE on failure
* If successful, the lpCommConfig structure will contain a new
* configuration for the comm port, as specified by the user.
*
* BUGS
* The library with the CommConfigDialog code is never unloaded.
* Perhaps this should be done when the comm port is closed?
*/
BOOL WINAPI CommConfigDialogA(
2001-02-12 03:49:57 +00:00
LPCSTR lpszDevice, /* [in] name of communications device */
HWND hWnd, /* [in] parent window for the dialog */
2001-02-12 03:49:57 +00:00
LPCOMMCONFIG lpCommConfig) /* [out] pointer to struct to fill */
{
LPWSTR lpDeviceW = NULL;
DWORD len;
BOOL r;
TRACE("(%s, %p, %p)\n", debugstr_a(lpszDevice), hWnd, lpCommConfig);
if (lpszDevice)
{
len = MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, NULL, 0 );
lpDeviceW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, lpDeviceW, len );
}
r = CommConfigDialogW(lpDeviceW, hWnd, lpCommConfig);
HeapFree( GetProcessHeap(), 0, lpDeviceW );
return r;
}
/***********************************************************************
* CommConfigDialogW (KERNEL32.@)
*
* See CommConfigDialogA.
*/
BOOL WINAPI CommConfigDialogW(
2001-02-12 03:49:57 +00:00
LPCWSTR lpszDevice, /* [in] name of communications device */
HWND hWnd, /* [in] parent window for the dialog */
2001-02-12 03:49:57 +00:00
LPCOMMCONFIG lpCommConfig) /* [out] pointer to struct to fill */
{
DWORD (WINAPI *pCommConfigDialog)(LPCWSTR, HWND, LPCOMMCONFIG);
2004-10-26 00:25:58 +00:00
HMODULE hConfigModule;
DWORD res = ERROR_INVALID_PARAMETER;
2004-10-26 00:25:58 +00:00
TRACE("(%s, %p, %p)\n", debugstr_w(lpszDevice), hWnd, lpCommConfig);
2004-10-26 00:25:58 +00:00
hConfigModule = LoadLibraryW(lpszSerialUI);
if (hConfigModule) {
pCommConfigDialog = (void *)GetProcAddress(hConfigModule, "drvCommConfigDialogW");
if (pCommConfigDialog) {
res = pCommConfigDialog(lpszDevice, hWnd, lpCommConfig);
}
FreeLibrary(hConfigModule);
}
2004-10-26 00:25:58 +00:00
if (res) SetLastError(res);
return (res == ERROR_SUCCESS);
}
/***********************************************************************
* SetDefaultCommConfigW (KERNEL32.@)
2000-12-19 23:33:03 +00:00
*
* Initializes the default configuration for a communication device.
*
* PARAMS
* lpszDevice [I] Name of the device targeted for configuration
* lpCommConfig [I] PTR to a buffer with the configuration for the device
* dwSize [I] Number of bytes in the buffer
2000-12-19 23:33:03 +00:00
*
* RETURNS
* Failure: FALSE
* Success: TRUE, and default configuration saved
2000-12-19 23:33:03 +00:00
*
*/
BOOL WINAPI SetDefaultCommConfigW(LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
2001-02-12 03:49:57 +00:00
{
BOOL (WINAPI *lpfnSetDefaultCommConfig)(LPCWSTR, LPCOMMCONFIG, DWORD);
HMODULE hConfigModule;
2004-10-26 00:16:39 +00:00
BOOL r = FALSE;
TRACE("(%s, %p, %u)\n", debugstr_w(lpszDevice), lpCommConfig, dwSize);
2004-10-26 00:16:39 +00:00
hConfigModule = LoadLibraryW(lpszSerialUI);
if(!hConfigModule)
2004-10-26 00:16:39 +00:00
return r;
lpfnSetDefaultCommConfig = (void *)GetProcAddress(hConfigModule, "drvSetDefaultCommConfigW");
2004-10-26 00:16:39 +00:00
if (lpfnSetDefaultCommConfig)
r = lpfnSetDefaultCommConfig(lpszDevice, lpCommConfig, dwSize);
2004-10-26 00:16:39 +00:00
FreeLibrary(hConfigModule);
return r;
}
/***********************************************************************
* SetDefaultCommConfigA (KERNEL32.@)
*
* Initializes the default configuration for a communication device.
2000-12-19 23:33:03 +00:00
*
* See SetDefaultCommConfigW.
2000-12-19 23:33:03 +00:00
*
*/
BOOL WINAPI SetDefaultCommConfigA(LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize)
2001-02-12 03:49:57 +00:00
{
BOOL r;
2004-10-26 00:16:39 +00:00
LPWSTR lpDeviceW = NULL;
DWORD len;
TRACE("(%s, %p, %u)\n", debugstr_a(lpszDevice), lpCommConfig, dwSize);
2004-10-26 00:16:39 +00:00
if (lpszDevice)
{
len = MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, NULL, 0 );
lpDeviceW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, lpDeviceW, len );
}
r = SetDefaultCommConfigW(lpDeviceW,lpCommConfig,dwSize);
HeapFree( GetProcessHeap(), 0, lpDeviceW );
return r;
}
/***********************************************************************
* GetDefaultCommConfigW (KERNEL32.@)
2000-12-19 23:33:03 +00:00
*
* Acquires the default configuration of the specified communication device. (unicode)
*
* RETURNS
*
* True on successful reading of the default configuration,
* if the device is not found or the buffer is too small.
*/
BOOL WINAPI GetDefaultCommConfigW(
LPCWSTR lpszName, /* [in] The unicode name of the device targeted for configuration. */
2001-02-12 03:49:57 +00:00
LPCOMMCONFIG lpCC, /* [out] The default configuration for the device. */
LPDWORD lpdwSize) /* [in/out] Initially the size of the default configuration buffer,
afterwards the number of bytes copied to the buffer or
the needed size of the buffer. */
2000-12-19 23:33:03 +00:00
{
DWORD (WINAPI *pGetDefaultCommConfig)(LPCWSTR, LPCOMMCONFIG, LPDWORD);
HMODULE hConfigModule;
DWORD res = ERROR_INVALID_PARAMETER;
TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_w(lpszName), lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 );
hConfigModule = LoadLibraryW(lpszSerialUI);
if (hConfigModule) {
pGetDefaultCommConfig = (void *)GetProcAddress(hConfigModule, "drvGetDefaultCommConfigW");
if (pGetDefaultCommConfig) {
res = pGetDefaultCommConfig(lpszName, lpCC, lpdwSize);
}
FreeLibrary(hConfigModule);
}
if (res) SetLastError(res);
return (res == ERROR_SUCCESS);
}
/**************************************************************************
* GetDefaultCommConfigA (KERNEL32.@)
2000-12-19 23:33:03 +00:00
*
* Acquires the default configuration of the specified communication device. (ascii)
2000-12-19 23:33:03 +00:00
*
* RETURNS
*
* True on successful reading of the default configuration,
* if the device is not found or the buffer is too small.
*/
BOOL WINAPI GetDefaultCommConfigA(
LPCSTR lpszName, /* [in] The ascii name of the device targeted for configuration. */
2001-02-12 03:49:57 +00:00
LPCOMMCONFIG lpCC, /* [out] The default configuration for the device. */
LPDWORD lpdwSize) /* [in/out] Initially the size of the default configuration buffer,
afterwards the number of bytes copied to the buffer or
the needed size of the buffer. */
{
2000-12-19 23:33:03 +00:00
BOOL ret = FALSE;
UNICODE_STRING lpszNameW;
TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_a(lpszName), lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 );
if(lpszName) RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName);
else lpszNameW.Buffer = NULL;
ret = GetDefaultCommConfigW(lpszNameW.Buffer,lpCC,lpdwSize);
RtlFreeUnicodeString(&lpszNameW);
return ret;
}