Release 970329

Fri Mar 28 14:18:32 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [misc/main.c] [ANNOUNCE]
	Update the list of contributors. Please let me know if I forgot
	someone.

	* [controls/combo.c]
	Fixed bug in CB_DIR16 handling.
	Use correct text color in CBPaintText.

	* [controls/listbox.c]
	Fixed WM_CTLCOLOR handling.

	* [windows/winproc.c]
	Added translation for EM_*32 messages.

Mon Mar 24 01:31:52 1997  Steffen Moeller <moeller@mpimg-berlin-dahlem.mpg.de>

	* [files/drive.c]
	Added information on device and inode numbers to the DOSDRIVE
	struct, using it to find DOS drives in a path even if it contains
	symbolic links, eliminating annoying messages at startup.  
	Edited functions DRIVE_Init and rewrote DRIVE_FindDriveRoot.

Wed Mar 19 16:31:18 1997  John Harvey <john@division.co.uk>

	* [graphics/win16drv/font.c] [graphics/win16drv/init.c]
	  [graphics/x11drv/font.c] [objects/font.c] [include/gdi.h]
	  [include/win16drv.h] [include/x11drv.h]
	Implemented GetCharWidth via graphics drivers.

	* [graphics/win16drv/Makefile.in] [graphics/win16drv/prtdrv.c]
	Moved printer driver interfaces into a separate file.

	* [graphics/win16drv/text.c]
	Fixed bugs that seg-faulted write.

Wed Mar 19 13:52:41 1997  Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [BUGS]
	Update.

	* [controls/edit.c]
	Removed useless parameters from a lot of functions.

	* [controls/menu.c]
	Improved keyboard shortcuts. Added check for entries with popup 
	menu in EnableMenuItem().

	* [windows/winproc.c] [windows/win.c] [memory/selector.c]
	Do not allocate separate thunks for new windows.

	* [misc/clipboard.c] [windows/painting.c]
	Fixed problems with ClipBook.

        * [controls/combo.c] [controls/edit.c] [controls/listbox.c]
	  [controls/widgets.c] [windows/graphics.c] [windows/defdlg.c]
        Combo rewrite.

	* [objects/dib.c]
	Slight improvements.

Wed Mar 19 11:21:17 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [misc/crtdll.c]
	Added chdir/mkdir.

	* [misc/ntdll.c]
	Fixed some bugs, added RtlUnicodeStringToAnsiString.

	* [win32/process.c]
	Added initialisation of events/semaphores/mutices.

Wed Mar 19 01:55:40 1997  Ricardo R. Massaro <massaro@ime.usp.br>

	* [resources/sysres_Po.rc]
	Added support for Portuguese language.

Sat Mar 18 18:00:14 1997  Uwe Bonnes  <bon@elektron.ikp.physik.th-darmstadt.de>

	* [windows/winpos.c] [if1632/user.spec] [if1632/user32.spec]
	Implemented SwitchToThisWindow().
	
	* [misc/ver.c]
	Corrected a flaw in VerInstallFile32A.
	
	* [msdos/int21.c]
	Corrected wrong number in Int21 3305
	Corrected Int21 714e, implemented Int21 7160,CL=2, 7143 and 7147
	
Sun Mar 16 09:53:04 1997  Andreas Mohr <100.30936@germany.net>

	* [loader/ne_module.c]
	Fixed NE_LoadSegments() to set size to pSeg->minsize rather than
	setting it to 0x10000 if pSeg->size is 0.

Thu Mar 13 12:15:00 1997  Anand Kumria <akumria@ozemail.com.au>

	* [ANNOUNCE]
	Added ftp.progsoc.uts.edu.au as a mirror of Wine.

	* [memory/global.c]
	Removed MemManInfo sizeof check.

Mon Mar 10 10:35:44 MET 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>

	* [files/dos_fs.c]
	Pick up kernel dirent on glibc systems.

	* [loader/signal.c]
	Pick up kernel sigaction on glibc systems.

Sat Mar  8 21:05:37 1997  Jimen Ching  <jching@aloha.com>

	* [debugger/stabs.c] [debugger/msc.c]
	Check return value of mmap.

Fri Mar  7 05:42:03 1997  Lee Jaekil <juria@seodu.co.kr>

	* [win32/code_page.c]
	Added IsValidCodePage.
This commit is contained in:
Alexandre Julliard 1997-03-29 17:20:20 +00:00
parent 2197901989
commit df2673b7e0
89 changed files with 5082 additions and 3528 deletions

View File

@ -1,13 +1,14 @@
This is release 970305 of Wine, the MS Windows emulator. This is still a
This is release 970329 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-970305: (see ChangeLog for details)
- Completed transition to new Win32 types.
- Polish language support.
WHAT'S NEW with Wine-970329: (see ChangeLog for details)
- Win32 event/mutex/semaphore functions.
- Rewritten combobox.
- Portuguese language support.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -16,10 +17,11 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970305.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970305.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970305.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970305.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970329.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970329.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970329.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970329.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970329.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
@ -31,25 +33,29 @@ wine-patches mailing list by sending a mail containing 'subscribe
wine-patches your_address' to majordomo@tiger.informatik.hu-berlin.de.
Wine is available thanks to the work of Bob Amstadt, Dag Asheim,
Martin Ayotte, Ross Biro, Uwe Bonnes, Erik Bos, Fons Botman, John Brezak,
Andrew Bulhak, John Burton, Niels de Carpentier, Roman Dolejsi,
Frans van Dorsselaer, Paul Falstad, Olaf Flebbe, Peter Galbavy,
Ramon Garcia, Hans de Graaff, Charles M. Hannum, John Harvey,
Cameron Heide, Jochen Hoenicke, Onno Hovers, Jeffrey Hsu,
Miguel de Icaza, Jukka Iivonen, Alexandre Julliard, Jochen Karrer,
Andreas Kirschbaum, Albrecht Kleine, Jon Konrath, Alex Korobka,
Greg Kreider, Anand Kumria, Scott A. Laird, Martin von Loewis,
Kenneth MacDonald, Peter MacDonald, William Magro, Juergen Marquardt,
Marcus Meissner, Graham Menhennitt, David Metcalfe, Steffen Moeller,
Martin Ayotte, Peter Bajusz, Ross Biro, Uwe Bonnes, Erik Bos, Fons Botman,
John Brezak, Andrew Bulhak, John Burton, Niels de Carpentier, Jimen Ching,
Huw D. M. Davies, Roman Dolejsi, Frans van Dorsselaer, Paul Falstad,
David Faure, Olaf Flebbe, Peter Galbavy, Ramon Garcia, Matthew Ghio,
Hans de Graaff, Charles M. Hannum, John Harvey, Cameron Heide,
Jochen Hoenicke, Onno Hovers, Jeffrey Hsu, Miguel de Icaza, Jukka Iivonen,
Lee Jaekil, Alexandre Julliard, Bang Jun-Young, Pavel Kankovsky,
Jochen Karrer, Andreas Kirschbaum, Albrecht Kleine, Jon Konrath,
Alex Korobka, Greg Kreider, Anand Kumria, Scott A. Laird, Andrew Lewycky,
Martin von Loewis, Kenneth MacDonald, Peter MacDonald, William Magro,
Juergen Marquardt, Ricardo Massaro, Marcus Meissner, Graham Menhennitt,
David Metcalfe, Bruce Milner, Steffen Moeller, Andreas Mohr,
Philippe De Muyter, Itai Nahshon, Michael Patra, Jim Peterson,
Robert Pouliot, Keith Reynolds, John Richardson, Johannes Ruscheinski,
Thomas Sandford, Constantine Sapuntzakis, Daniel Schepler, Ulrich Schmid,
Bernd Schmidt, Yngvi Sigurjonsson, Rick Sladkey, William Smith,
Erik Svendsen, Tristan Tarrant, Andrew Taylor, Duncan C Thomson,
Goran Thyni, Jimmy Tirtawangsa, Jon Tombs, Linus Torvalds,
Gregory Trubetskoy, Michael Veksler, Sven Verdoolaege, Eric Warnke,
Manfred Weichel, Morten Welinder, Jan Willamowius, Carl Williams,
Karl Guenter Wuensch, Eric Youngdale, and James Youngman.
Robert Pouliot, Keith Reynolds, Slaven Rezic, John Richardson,
Johannes Ruscheinski, Thomas Sandford, Constantine Sapuntzakis,
Pablo Saratxaga, Daniel Schepler, Ulrich Schmid, Bernd Schmidt,
Yngvi Sigurjonsson, Stephen Simmons, Rick Sladkey, William Smith,
Dominik Strasser, Vadim Strizhevsky, Erik Svendsen, Tristan Tarrant,
Andrew Taylor, Duncan C Thomson, Goran Thyni, Jimmy Tirtawangsa, Jon Tombs,
Linus Torvalds, Gregory Trubetskoy, Petri Tuomola, Michael Veksler,
Sven Verdoolaege, Ronan Waide, Eric Warnke, Manfred Weichel,
Morten Welinder, Jan Willamowius, Carl Williams, Karl Guenter Wuensch,
Eric Youngdale, James Youngman, Mikolaj Zalewski, and John Zero.
--
Alexandre Julliard

32
BUGS
View File

@ -5,23 +5,21 @@ done something for one of the problems. You are encouraged to
add new entries and, more importantly, remove those for the
bugs you fixed ;-)
------------------------------------------------------------
As of Dec 22 1996 -
As of March 10 1997 -
General:
* Combobox code is very inadequate (no notification messages,
dropdown listboxes often stay visible, etc... ).
* Font mapping is too generic. No soft font loading, no rotated
text support. [alex@amadeus.pharm.sunysb.edu]
text support, incorrect metrics. [alex@amadeus.pharm.sunysb.edu]
* No thread/process/kernel-object support in Win32 code.
* Very alpha printing code. [john@division.co.uk]
* No OLE and OLE32 support (including OLE interfaces etc.).
* No OLE2 and OLE32 support (including OLE2 interfaces etc.).
* No MS Video support (perhaps interface with xanim).
* No MS Video support (perhaps interface with xanim, don't hold
your breath for this one).
* No COMDLG32 support. (Needed badly, the Windows95 comdlg32.dll
doesn't work with WINE.)
@ -33,14 +31,26 @@ General:
Handles to these title windows are stored in the icon window
properties.
* No manual pages describing the various Windows calls.
Miscellaneous:
* Simple OLE actions were working in October release, got
broken in November (in Winword "Insert Object" now results in
segfault right after the call to LoadModule()).
* "Cursor XXXX has more than 1 bpp!"
* 32-bit Freecell segfaults when started from the Progman (looks like
a problem with cards.dll).
* Word 6.0 often segfaults when system menu is double-clicked.
* Edit controls are prone to show blank space when, in fact, there is a
text there.
* SGI window manager treats Wine windows as topmost.
* Write shows blank space instead of Paintbrush OLE1 object.
* AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple
times.
* ScrollWindowEx() is outdated.
Where to look in source files:

123
ChangeLog
View File

@ -1,3 +1,126 @@
----------------------------------------------------------------------
Fri Mar 28 14:18:32 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [misc/main.c] [ANNOUNCE]
Update the list of contributors. Please let me know if I forgot
someone.
* [controls/combo.c]
Fixed bug in CB_DIR16 handling.
Use correct text color in CBPaintText.
* [controls/listbox.c]
Fixed WM_CTLCOLOR handling.
* [windows/winproc.c]
Added translation for EM_*32 messages.
Mon Mar 24 01:31:52 1997 Steffen Moeller <moeller@mpimg-berlin-dahlem.mpg.de>
* [files/drive.c]
Added information on device and inode numbers to the DOSDRIVE
struct, using it to find DOS drives in a path even if it contains
symbolic links, eliminating annoying messages at startup.
Edited functions DRIVE_Init and rewrote DRIVE_FindDriveRoot.
Wed Mar 19 16:31:18 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/font.c] [graphics/win16drv/init.c]
[graphics/x11drv/font.c] [objects/font.c] [include/gdi.h]
[include/win16drv.h] [include/x11drv.h]
Implemented GetCharWidth via graphics drivers.
* [graphics/win16drv/Makefile.in] [graphics/win16drv/prtdrv.c]
Moved printer driver interfaces into a separate file.
* [graphics/win16drv/text.c]
Fixed bugs that seg-faulted write.
Wed Mar 19 13:52:41 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [BUGS]
Update.
* [controls/edit.c]
Removed useless parameters from a lot of functions.
* [controls/menu.c]
Improved keyboard shortcuts. Added check for entries with popup
menu in EnableMenuItem().
* [windows/winproc.c] [windows/win.c] [memory/selector.c]
Do not allocate separate thunks for new windows.
* [misc/clipboard.c] [windows/painting.c]
Fixed problems with ClipBook.
* [controls/combo.c] [controls/edit.c] [controls/listbox.c]
[controls/widgets.c] [windows/graphics.c] [windows/defdlg.c]
Combo rewrite.
* [objects/dib.c]
Slight improvements.
Wed Mar 19 11:21:17 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [misc/crtdll.c]
Added chdir/mkdir.
* [misc/ntdll.c]
Fixed some bugs, added RtlUnicodeStringToAnsiString.
* [win32/process.c]
Added initialisation of events/semaphores/mutices.
Wed Mar 19 01:55:40 1997 Ricardo R. Massaro <massaro@ime.usp.br>
* [resources/sysres_Po.rc]
Added support for Portuguese language.
Sat Mar 18 18:00:14 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [windows/winpos.c] [if1632/user.spec] [if1632/user32.spec]
Implemented SwitchToThisWindow().
* [misc/ver.c]
Corrected a flaw in VerInstallFile32A.
* [msdos/int21.c]
Corrected wrong number in Int21 3305
Corrected Int21 714e, implemented Int21 7160,CL=2, 7143 and 7147
Sun Mar 16 09:53:04 1997 Andreas Mohr <100.30936@germany.net>
* [loader/ne_module.c]
Fixed NE_LoadSegments() to set size to pSeg->minsize rather than
setting it to 0x10000 if pSeg->size is 0.
Thu Mar 13 12:15:00 1997 Anand Kumria <akumria@ozemail.com.au>
* [ANNOUNCE]
Added ftp.progsoc.uts.edu.au as a mirror of Wine.
* [memory/global.c]
Removed MemManInfo sizeof check.
Mon Mar 10 10:35:44 MET 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [files/dos_fs.c]
Pick up kernel dirent on glibc systems.
* [loader/signal.c]
Pick up kernel sigaction on glibc systems.
Sat Mar 8 21:05:37 1997 Jimen Ching <jching@aloha.com>
* [debugger/stabs.c] [debugger/msc.c]
Check return value of mmap.
Fri Mar 7 05:42:03 1997 Lee Jaekil <juria@seodu.co.kr>
* [win32/code_page.c]
Added IsValidCodePage.
----------------------------------------------------------------------
Sun Mar 2 14:57:37 1997 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -12,7 +12,6 @@ C_SRCS = \
edit.c \
listbox.c \
menu.c \
oldlbox.c \
scroll.c \
static.c \
status.c \

View File

@ -472,23 +472,19 @@ static void GB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
if (action != ODA_DRAWENTIRE) return;
if (infoPtr->hFont) SelectObject32( hDC, infoPtr->hFont );
BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
SelectObject32( hDC, sysColorObjects.hpenWindowFrame );
GetClientRect16( wndPtr->hwndSelf, &rc);
MoveTo( hDC, rc.left, rc.top+2 );
LineTo32( hDC, rc.right-1, rc.top+2 );
LineTo32( hDC, rc.right-1, rc.bottom-1 );
LineTo32( hDC, rc.left, rc.bottom-1 );
LineTo32( hDC, rc.left, rc.top+2 );
if (!wndPtr->text) return;
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor32( hDC, GetSysColor32(COLOR_GRAYTEXT) );
rc.left += 10;
DrawText16( hDC, wndPtr->text, -1, &rc, DT_SINGLELINE | DT_NOCLIP );
GRAPH_DrawRectangle( hDC, rc.left, rc.top + 2, rc.right - 1, rc.bottom - 1,
sysColorObjects.hpenWindowFrame );
if (wndPtr->text)
{
if (infoPtr->hFont) SelectObject32( hDC, infoPtr->hFont );
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor32( hDC, GetSysColor32(COLOR_GRAYTEXT) );
rc.left += 10;
DrawText16( hDC, wndPtr->text, -1, &rc, DT_SINGLELINE | DT_NOCLIP );
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
#include "heap.h"
#include "spy.h"
#include "win.h"
#include "combo.h"
#include "stddebug.h"
#include "debug.h"
@ -20,7 +21,6 @@
* - LBS_USETABSTOPS
* - Unicode
* - Locale handling
* - COMBOLBOX
*/
/* Items array granularity */
@ -45,7 +45,7 @@ typedef struct
typedef struct
{
HANDLE32 heap; /* Heap for this listbox */
HWND32 owner; /* Owner window */
HWND32 owner; /* Owner window to send notifications to */
UINT32 style; /* Window style */
INT32 width; /* Window width */
INT32 height; /* Window height */
@ -65,6 +65,7 @@ typedef struct
BOOL32 caret_on; /* Is caret on? */
HFONT32 font; /* Current font */
LCID locale; /* Current locale for string comparisons */
LPHEADCOMBO lphc; /* ComboLBox */
} LB_DESCR;
@ -76,7 +77,7 @@ typedef struct
#define SEND_NOTIFICATION(wnd,descr,code) \
(SendMessage32A( (descr)->owner, WM_COMMAND, \
MAKEWPARAM( (wnd)->wIDmenu, (code) ), (wnd)->hwndSelf ))
MAKEWPARAM((((descr)->lphc)?ID_CB_LISTBOX:(wnd)->wIDmenu), (code) ), (wnd)->hwndSelf ))
/* Current timer status */
typedef enum
@ -439,8 +440,10 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc,
if (IS_OWNERDRAW(descr))
{
DRAWITEMSTRUCT32 dis;
UINT32 id = (descr->lphc) ? ID_CB_LISTBOX : wnd->wIDmenu;
dis.CtlType = ODT_LISTBOX;
dis.CtlID = wnd->wIDmenu;
dis.CtlID = id;
dis.hwndItem = wnd->hwndSelf;
dis.itemAction = action;
dis.hDC = hdc;
@ -458,10 +461,12 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc,
wnd->hwndSelf, index, item ? item->str : "", action,
dis.itemState, rect->left, rect->top,
rect->right, rect->bottom );
SendMessage32A(descr->owner, WM_DRAWITEM, wnd->wIDmenu, (LPARAM)&dis);
SendMessage32A(descr->owner, WM_DRAWITEM, id, (LPARAM)&dis);
}
else
{
COLORREF oldText = 0, oldBk = 0;
if (action == ODA_FOCUS)
{
DrawFocusRect32( hdc, rect );
@ -469,17 +474,10 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc,
}
if (item && item->selected)
{
SetBkColor32( hdc, GetSysColor32( COLOR_HIGHLIGHT ) );
SetTextColor32( hdc, GetSysColor32( COLOR_HIGHLIGHTTEXT ) );
}
else
{
SetBkColor32( hdc, GetSysColor32( COLOR_WINDOW ) );
if (wnd->dwStyle & WS_DISABLED)
SetTextColor32( hdc, GetSysColor32( COLOR_GRAYTEXT ) );
else
SetTextColor32( hdc, GetSysColor32( COLOR_WINDOWTEXT ) );
oldBk = SetBkColor32( hdc, GetSysColor32( COLOR_HIGHLIGHT ) );
oldText = SetTextColor32( hdc, GetSysColor32(COLOR_HIGHLIGHTTEXT));
}
dprintf_listbox( stddeb, "Listbox %04x: painting %d (%s) action=%02x "
"rect=%d,%d-%d,%d\n",
wnd->hwndSelf, index, item ? item->str : "", action,
@ -492,6 +490,11 @@ static void LISTBOX_PaintItem( WND *wnd, LB_DESCR *descr, HDC32 hdc,
else
ExtTextOut32A( hdc, rect->left + 1, rect->top + 1,
ETO_OPAQUE | ETO_CLIPPED, rect, NULL, 0, NULL );
if (item && item->selected)
{
SetBkColor32( hdc, oldBk );
SetTextColor32( hdc, oldText );
}
if ((descr->focus_item == index) &&
(descr->caret_on) &&
(GetFocus32() == wnd->hwndSelf)) DrawFocusRect32( hdc, rect );
@ -526,18 +529,23 @@ static void LISTBOX_RepaintItem( WND *wnd, LB_DESCR *descr, INT32 index,
{
HDC32 hdc;
RECT32 rect;
HFONT32 oldFont = 0;
HBRUSH32 hbrush, oldBrush = 0;
if (descr->style & LBS_NOREDRAW) return;
if (LISTBOX_GetItemRect( wnd, descr, index, &rect ) != 1) return;
if ((hdc = GetDCEx32( wnd->hwndSelf, 0, DCX_CACHE )))
{
HFONT32 oldFont = 0;
if (descr->font) oldFont = SelectObject32( hdc, descr->font );
SetWindowOrgEx32( hdc, descr->horz_pos, 0, NULL );
LISTBOX_PaintItem( wnd, descr, hdc, &rect, index, action );
if (oldFont) SelectObject32( hdc, oldFont );
ReleaseDC32( wnd->hwndSelf, hdc );
}
if (!(hdc = GetDCEx32( wnd->hwndSelf, 0, DCX_CACHE ))) return;
if (descr->font) oldFont = SelectObject32( hdc, descr->font );
hbrush = SendMessage32A( descr->owner, WM_CTLCOLORLISTBOX,
hdc, (LPARAM)wnd->hwndSelf );
if (hbrush) oldBrush = SelectObject32( hdc, hbrush );
if (wnd->dwStyle & WS_DISABLED)
SetTextColor32( hdc, GetSysColor32( COLOR_GRAYTEXT ) );
SetWindowOrgEx32( hdc, descr->horz_pos, 0, NULL );
LISTBOX_PaintItem( wnd, descr, hdc, &rect, index, action );
if (oldFont) SelectObject32( hdc, oldFont );
if (oldBrush) SelectObject32( hdc, oldBrush );
ReleaseDC32( wnd->hwndSelf, hdc );
}
@ -635,8 +643,10 @@ static INT32 LISTBOX_FindStringPos( WND *wnd, LB_DESCR *descr, LPCSTR str,
else
{
COMPAREITEMSTRUCT32 cis;
UINT32 id = (descr->lphc) ? ID_CB_LISTBOX : wnd->wIDmenu;
cis.CtlType = ODT_LISTBOX;
cis.CtlID = wnd->wIDmenu;
cis.CtlID = id;
cis.hwndItem = wnd->hwndSelf;
cis.itemID1 = index;
cis.itemData1 = descr->items[index].data;
@ -644,7 +654,7 @@ static INT32 LISTBOX_FindStringPos( WND *wnd, LB_DESCR *descr, LPCSTR str,
cis.itemData2 = (DWORD)str;
cis.dwLocaleId = descr->locale;
res = SendMessage32A( descr->owner, WM_COMPAREITEM,
wnd->wIDmenu, (LPARAM)&cis );
id, (LPARAM)&cis );
}
if (!res) return index;
if (res > 0) max = index;
@ -817,6 +827,7 @@ static LRESULT LISTBOX_Paint( WND *wnd, LB_DESCR *descr, HDC32 hdc )
INT32 i, col_pos = descr->page_size - 1;
RECT32 rect;
HFONT32 oldFont = 0;
HBRUSH32 hbrush, oldBrush = 0;
SetRect32( &rect, 0, 0, descr->width, descr->height );
if (descr->style & LBS_NOREDRAW) return 0;
@ -829,6 +840,11 @@ static LRESULT LISTBOX_Paint( WND *wnd, LB_DESCR *descr, HDC32 hdc )
}
if (descr->font) oldFont = SelectObject32( hdc, descr->font );
hbrush = SendMessage32A( descr->owner, WM_CTLCOLORLISTBOX,
hdc, (LPARAM)wnd->hwndSelf );
if (hbrush) oldBrush = SelectObject32( hdc, hbrush );
if (wnd->dwStyle & WS_DISABLED)
SetTextColor32( hdc, GetSysColor32( COLOR_GRAYTEXT ) );
if (!descr->nb_items && (descr->focus_item != -1) && descr->caret_on &&
(GetFocus32() == wnd->hwndSelf))
@ -898,6 +914,7 @@ static LRESULT LISTBOX_Paint( WND *wnd, LB_DESCR *descr, HDC32 hdc )
}
}
if (oldFont) SelectObject32( hdc, oldFont );
if (oldBrush) SelectObject32( hdc, oldBrush );
return 0;
}
@ -1261,13 +1278,14 @@ static LRESULT LISTBOX_InsertItem( WND *wnd, LB_DESCR *descr, INT32 index,
if (descr->style & LBS_OWNERDRAWVARIABLE)
{
MEASUREITEMSTRUCT32 mis;
UINT32 id = (descr->lphc) ? ID_CB_LISTBOX : wnd->wIDmenu;
mis.CtlType = ODT_LISTBOX;
mis.CtlID = wnd->wIDmenu;
mis.CtlID = id;
mis.itemID = index;
mis.itemData = descr->items[index].data;
mis.itemHeight = descr->item_height;
SendMessage32A( descr->owner, WM_MEASUREITEM, wnd->wIDmenu,
(LPARAM)&mis );
SendMessage32A( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis );
item->height = mis.itemHeight ? mis.itemHeight : 1;
dprintf_listbox( stddeb, "Listbox %04x: measure item %d (%s) = %d\n",
wnd->hwndSelf, index, str ? str : "", item->height );
@ -1342,13 +1360,14 @@ static void LISTBOX_DeleteItem( WND *wnd, LB_DESCR *descr, INT32 index )
if (IS_OWNERDRAW(descr) || descr->items[index].data)
{
DELETEITEMSTRUCT32 dis;
UINT32 id = (descr->lphc) ? ID_CB_LISTBOX : wnd->wIDmenu;
dis.CtlType = ODT_LISTBOX;
dis.CtlID = wnd->wIDmenu;
dis.CtlID = id;
dis.itemID = index;
dis.hwndItem = wnd->hwndSelf;
dis.itemData = descr->items[index].data;
SendMessage32A( wnd->hwndSelf, WM_DELETEITEM, wnd->wIDmenu,
(LPARAM)&dis );
SendMessage32A( descr->owner, WM_DELETEITEM, id, (LPARAM)&dis );
}
if (HAS_STRINGS(descr) && descr->items[index].str)
HeapFree( descr->heap, 0, descr->items[index].str );
@ -1454,8 +1473,8 @@ static LRESULT LISTBOX_SetCount( WND *wnd, LB_DESCR *descr, INT32 count )
/***********************************************************************
* LISTBOX_Directory
*/
LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib,
LPCSTR filespec, BOOL32 long_names )
static LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib,
LPCSTR filespec, BOOL32 long_names )
{
HANDLE32 handle;
LRESULT ret = LB_OKAY;
@ -1681,11 +1700,15 @@ static LRESULT LISTBOX_HandleLButtonDown( WND *wnd, LB_DESCR *descr,
!descr->items[index].selected), FALSE );
}
}
SetFocus32( wnd->hwndSelf );
if( !descr->lphc ) SetFocus32( wnd->hwndSelf );
else SetFocus32( (descr->lphc->hWndEdit) ? descr->lphc->hWndEdit
: descr->lphc->self->hwndSelf ) ;
SetCapture32( wnd->hwndSelf );
if (index != -1)
if (index != -1 && !descr->lphc)
{
if (descr->style & LBS_NOTIFY)
if (descr->style & LBS_NOTIFY )
SendMessage32A( descr->owner, WM_LBTRACKPOINT, index,
MAKELPARAM( x, y ) );
if (wnd->dwExStyle & WS_EX_DRAGDETECT)
@ -1707,9 +1730,12 @@ static LRESULT LISTBOX_HandleLButtonUp( WND *wnd, LB_DESCR *descr )
if (LISTBOX_Timer != LB_TIMER_NONE)
KillSystemTimer32( wnd->hwndSelf, LB_TIMER_ID );
LISTBOX_Timer = LB_TIMER_NONE;
if (GetCapture32() == wnd->hwndSelf) ReleaseCapture();
if (descr->style & LBS_NOTIFY)
SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE );
if (GetCapture32() == wnd->hwndSelf)
{
ReleaseCapture();
if (descr->style & LBS_NOTIFY)
SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE );
}
return 0;
}
@ -1819,8 +1845,7 @@ static void LISTBOX_HandleMouseMove( WND *wnd, LB_DESCR *descr,
/***********************************************************************
* LISTBOX_HandleKeyDown
*/
static LRESULT LISTBOX_HandleKeyDown( WND *wnd, LB_DESCR *descr,
WPARAM32 wParam )
static LRESULT LISTBOX_HandleKeyDown( WND *wnd, LB_DESCR *descr, WPARAM32 wParam )
{
INT32 caret = -1;
if (descr->style & LBS_WANTKEYBOARDINPUT)
@ -1899,7 +1924,14 @@ static LRESULT LISTBOX_HandleKeyDown( WND *wnd, LB_DESCR *descr,
descr->anchor_item = caret;
LISTBOX_MoveCaret( wnd, descr, caret, TRUE );
if (descr->style & LBS_NOTIFY)
{
if( descr->lphc && CB_GETTYPE(descr->lphc) != CBS_SIMPLE )
{
/* make sure that combo parent doesn't hide us */
descr->lphc->wState |= CBF_NOROLLUP;
}
SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE );
}
}
return 0;
}
@ -1936,7 +1968,7 @@ static LRESULT LISTBOX_HandleChar( WND *wnd, LB_DESCR *descr,
/***********************************************************************
* LISTBOX_Create
*/
static BOOL32 LISTBOX_Create( WND *wnd )
static BOOL32 LISTBOX_Create( WND *wnd, LPHEADCOMBO lphc )
{
LB_DESCR *descr;
MEASUREITEMSTRUCT32 mis;
@ -1970,6 +2002,14 @@ static BOOL32 LISTBOX_Create( WND *wnd )
descr->caret_on = TRUE;
descr->font = 0;
descr->locale = 0; /* FIXME */
descr->lphc = lphc;
if( lphc )
{
dprintf_combo(stddeb,"ComboLBox [%04x]: resetting owner %04x -> %04x\n",
wnd->hwndSelf, descr->owner, lphc->self->hwndSelf );
descr->owner = lphc->self->hwndSelf;
}
*(LB_DESCR **)wnd->wExtra = descr;
@ -1980,15 +2020,24 @@ static BOOL32 LISTBOX_Create( WND *wnd )
if (descr->style & LBS_OWNERDRAWFIXED)
{
mis.CtlType = ODT_LISTBOX;
mis.CtlID = wnd->wIDmenu;
mis.itemID = 0;
mis.itemWidth = 0;
mis.itemData = 0;
mis.itemHeight = descr->item_height;
SendMessage32A( descr->owner, WM_MEASUREITEM, wnd->wIDmenu,
(LPARAM)&mis );
descr->item_height = mis.itemHeight ? mis.itemHeight : 1;
if( descr->lphc && (descr->lphc->dwStyle & CBS_DROPDOWN))
{
/* WinWord gets VERY unhappy if we send WM_MEASUREITEM from here */
descr->item_height = lphc->RectButton.bottom - lphc->RectButton.top - 6;
}
else
{
UINT32 id = (descr->lphc ) ? ID_CB_LISTBOX : wnd->wIDmenu;
mis.CtlType = ODT_LISTBOX;
mis.CtlID = id;
mis.itemID = -1;
mis.itemWidth = 0;
mis.itemData = 0;
mis.itemHeight = descr->item_height;
SendMessage32A( descr->owner, WM_MEASUREITEM, id, (LPARAM)&mis );
descr->item_height = mis.itemHeight ? mis.itemHeight : 1;
}
}
return TRUE;
@ -2003,7 +2052,7 @@ static BOOL32 LISTBOX_Destroy( WND *wnd, LB_DESCR *descr )
LISTBOX_ResetContent( wnd, descr );
HeapDestroy( descr->heap );
HeapFree( GetProcessHeap(), 0, descr );
*(LB_DESCR **)wnd->wExtra = NULL;
wnd->wExtra[0] = 0;
return TRUE;
}
@ -2022,7 +2071,7 @@ LRESULT ListBoxWndProc(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
{
if (msg == WM_CREATE)
{
if (!LISTBOX_Create( wnd )) return -1;
if (!LISTBOX_Create( wnd, NULL )) return -1;
dprintf_listbox( stddeb, "Listbox: creating wnd=%04x descr=%p\n",
hwnd, *(LB_DESCR **)wnd->wExtra );
return 0;
@ -2305,9 +2354,10 @@ LRESULT ListBoxWndProc(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case WM_PAINT:
{
PAINTSTRUCT32 ps;
HDC32 hdc = BeginPaint32( hwnd, &ps );
HDC32 hdc = ( wParam ) ? ((HDC32)wParam)
: BeginPaint32( hwnd, &ps );
ret = LISTBOX_Paint( wnd, descr, hdc );
EndPaint32( hwnd, &ps );
if( !wParam ) EndPaint32( hwnd, &ps );
}
return ret;
@ -2381,18 +2431,22 @@ LRESULT ListBoxWndProc(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
return 1;
case WM_DROPFILES:
return SendMessage32A( descr->owner, msg, wParam, lParam );
if( !descr->lphc )
return SendMessage32A( descr->owner, msg, wParam, lParam );
break;
case WM_DROPOBJECT:
case WM_QUERYDROPOBJECT:
case WM_DRAGSELECT:
case WM_DRAGMOVE:
{
LPDRAGINFO dragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN( (SEGPTR)lParam );
dragInfo->l = LISTBOX_GetItemFromPoint( wnd, descr, dragInfo->pt.x,
if( !descr->lphc )
{
LPDRAGINFO dragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN( (SEGPTR)lParam );
dragInfo->l = LISTBOX_GetItemFromPoint( wnd, descr, dragInfo->pt.x,
dragInfo->pt.y );
return SendMessage32A( descr->owner, msg, wParam, lParam );
}
return SendMessage32A( descr->owner, msg, wParam, lParam );
}
break;
default:
if ((msg >= WM_USER) && (msg < 0xc000))
@ -2402,3 +2456,99 @@ LRESULT ListBoxWndProc(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
}
return 0;
}
/***********************************************************************
* COMBO_Directory
*/
LRESULT COMBO_Directory( LPHEADCOMBO lphc, UINT32 attrib, LPSTR dir, BOOL32 bLong)
{
WND *wnd = WIN_FindWndPtr( lphc->hWndLBox );
if( wnd )
{
LB_DESCR *descr = *(LB_DESCR **)wnd->wExtra;
if( descr )
{
LRESULT lRet = LISTBOX_Directory( wnd, descr, attrib, dir, bLong );
RedrawWindow32( lphc->self->hwndSelf, NULL, 0,
RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW );
return lRet;
}
}
return CB_ERR;
}
/***********************************************************************
* ComboLBWndProc
*
* NOTE: in Windows, winproc address of the ComboLBox is the same
* as that of the Listbox.
*/
LRESULT ComboLBWndProc(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
{
LRESULT lRet = 0;
WND *wnd = WIN_FindWndPtr( hwnd );
if (wnd)
{
LB_DESCR *descr = *(LB_DESCR **)wnd->wExtra;
dprintf_combo( stddeb, "ComboLBox [%04x]: msg %s wp %08x lp %08lx\n",
wnd->hwndSelf, SPY_GetMsgName(msg), wParam, lParam );
if( descr || msg == WM_CREATE )
{
LPHEADCOMBO lphc = (descr) ? descr->lphc : NULL;
switch( msg )
{
case WM_CREATE:
#define lpcs ((LPCREATESTRUCT32A)lParam)
dprintf_combo(stddeb, "\tpassed parent handle = 0x%08x\n",
(UINT32)lpcs->lpCreateParams);
lphc = (LPHEADCOMBO)(lpcs->lpCreateParams);
#undef lpcs
return LISTBOX_Create( wnd, lphc );
case WM_LBUTTONDOWN:
return LISTBOX_HandleLButtonDown( wnd, descr, wParam,
(INT16)LOWORD(lParam), (INT16)HIWORD(lParam));
/* avoid activation at all costs */
case WM_MOUSEACTIVATE:
return MA_NOACTIVATE;
case WM_NCACTIVATE:
return FALSE;
case WM_KEYDOWN:
if( CB_GETTYPE(lphc) != CBS_SIMPLE )
{
/* for some reason(?) Windows makes it possible to
* show/hide ComboLBox by sending it WM_KEYDOWNs */
if( (!(lphc->wState & CBF_EUI) && wParam == VK_F4) ||
( (lphc->wState & CBF_EUI) && !(lphc->wState & CBF_DROPPED)
&& (wParam == VK_DOWN || wParam == VK_UP)) )
{
COMBO_FlipListbox( lphc, FALSE );
return 0;
}
}
return LISTBOX_HandleKeyDown( wnd, descr, wParam );
default:
return ListBoxWndProc( hwnd, msg, wParam, lParam );
}
}
lRet = DefWindowProc32A( hwnd, msg, wParam, lParam );
dprintf_combo(stddeb,"\tComboLBox: default on msg [%04x]\n", (UINT16)msg );
}
return lRet;
}

View File

@ -304,32 +304,39 @@ static MENUITEM *MENU_FindItemByCoords( POPUPMENU *menu, INT32 x, INT32 y,
* Find the menu item selected by a key press.
* Return item id, -1 if none, -2 if we should close the menu.
*/
static UINT32 MENU_FindItemByKey( HWND32 hwndOwner, HMENU32 hmenu, UINT32 key )
static UINT32 MENU_FindItemByKey( HWND32 hwndOwner, HMENU32 hmenu,
UINT32 key, BOOL32 forceMenuChar )
{
POPUPMENU *menu;
MENUITEM *item;
UINT32 i;
LONG menuchar;
dprintf_menu(stddeb,"\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
if (!IsMenu32( hmenu )) hmenu = WIN_FindWndPtr(hwndOwner)->hSysMenu;
if (!hmenu) return -1;
menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
item = menu->items;
key = toupper(key);
for (i = 0; i < menu->nItems; i++, item++)
if (hmenu)
{
if (IS_STRING_ITEM(item->item_flags))
POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu );
MENUITEM *item = menu->items;
LONG menuchar;
if( !forceMenuChar )
{
char *p = strchr( item->text, '&' );
if (p && (p[1] != '&') && (toupper(p[1]) == key)) return i;
UINT32 i;
key = toupper(key);
for (i = 0; i < menu->nItems; i++, item++)
{
if (IS_STRING_ITEM(item->item_flags))
{
char *p = strchr( item->text, '&' );
if (p && (p[1] != '&') && (toupper(p[1]) == key)) return i;
}
}
}
menuchar = SendMessage32A( hwndOwner, WM_MENUCHAR,
MAKEWPARAM( key, menu->wFlags ), hmenu );
if (HIWORD(menuchar) == 2) return LOWORD(menuchar);
if (HIWORD(menuchar) == 1) return (UINT32)(-2);
}
menuchar = SendMessage32A( hwndOwner, WM_MENUCHAR,
MAKEWPARAM( key, menu->wFlags ), hmenu );
if (HIWORD(menuchar) == 2) return LOWORD(menuchar);
if (HIWORD(menuchar) == 1) return -2;
return -1;
return (UINT32)(-1);
}
@ -868,7 +875,7 @@ static BOOL32 MENU_ShowPopup( HWND32 hwndOwner, HMENU32 hmenu, UINT32 id,
/* Display the window */
SetWindowPos32( menu->hWnd, HWND_TOP, 0, 0, 0, 0,
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
UpdateWindow32( menu->hWnd );
return TRUE;
}
@ -1310,7 +1317,7 @@ static BOOL32 MENU_ExecFocusedItem( HWND32 hwndOwner, HMENU32 hmenu,
if (!(item->item_flags & (MF_GRAYED | MF_DISABLED)))
{
PostMessage16( hwndOwner, (menu->wFlags & MF_SYSMENU) ?
WM_SYSCOMMAND : WM_COMMAND, item->item_id, 0 );
WM_SYSCOMMAND : WM_COMMAND, item->item_id, 0 );
return FALSE;
}
else return TRUE;
@ -1787,7 +1794,7 @@ static BOOL32 MENU_TrackMenu( HMENU32 hmenu, UINT32 wFlags, INT32 x, INT32 y,
/* Hack to avoid control chars. */
/* We will find a better way real soon... */
if ((msg.wParam <= 32) || (msg.wParam >= 127)) break;
pos = MENU_FindItemByKey( hwnd, hmenuCurrent, msg.wParam );
pos = MENU_FindItemByKey( hwnd, hmenuCurrent, msg.wParam, FALSE );
if (pos == (UINT32)-2) fClosed = TRUE;
else if (pos == (UINT32)-1) MessageBeep32(0);
else
@ -1858,6 +1865,18 @@ static void MENU_TrackSysPopup( WND* pWnd )
}
}
/***********************************************************************
* MENU_InitTracking
*/
static BOOL32 MENU_InitTracking(HWND32 hWnd, HMENU32 hMenu)
{
HideCaret32(0);
SendMessage16( hWnd, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( hWnd, WM_SETCURSOR, hWnd, HTCAPTION );
SendMessage16( hWnd, WM_INITMENU, hMenu, 0 );
return TRUE;
}
/***********************************************************************
* MENU_TrackMouseMenuBar
*
@ -1872,9 +1891,7 @@ void MENU_TrackMouseMenuBar( WND* wndPtr, INT32 ht, POINT32 pt )
if (IsMenu32(hMenu))
{
HideCaret32(0);
SendMessage16( hWnd, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( hWnd, WM_INITMENU, hMenu, 0 );
MENU_InitTracking( hWnd, hMenu );
if( bTrackSys )
MENU_TrackSysPopup( wndPtr );
else
@ -1904,28 +1921,30 @@ void MENU_TrackKbdMenuBar( WND* wndPtr, UINT32 wParam, INT32 vkey)
if( !wndPtr->wIDmenu && !(wndPtr->dwStyle & WS_SYSMENU) ) return;
htMenu = ((wndPtr->dwStyle & (WS_CHILD | WS_MINIMIZE)) ||
!wndPtr->wIDmenu) ? HTSYSMENU : HTMENU;
hTrackMenu = ( htMenu == HTSYSMENU ) ? wndPtr->hSysMenu : wndPtr->wIDmenu;
if((wndPtr->dwStyle & (WS_CHILD | WS_MINIMIZE)) || !wndPtr->wIDmenu)
{
hTrackMenu = wndPtr->hSysMenu;
htMenu = HTSYSMENU;
}
else
{
hTrackMenu = wndPtr->wIDmenu;
htMenu = HTMENU;
}
if (IsMenu32( hTrackMenu ))
{
HideCaret32(0);
SendMessage16( wndPtr->hwndSelf, WM_ENTERMENULOOP, 0, 0 );
SendMessage16( wndPtr->hwndSelf, WM_INITMENU, hTrackMenu, 0 );
/* find suitable menu entry */
MENU_InitTracking( wndPtr->hwndSelf, hTrackMenu );
if( vkey == VK_SPACE )
uItem = SYSMENU_SELECTED;
else if( vkey )
{
uItem = ( htMenu == HTSYSMENU )
? 0xFFFE /* only VK_SPACE in this case */
: MENU_FindItemByKey( wndPtr->hwndSelf, wndPtr->wIDmenu, vkey );
if( uItem >= 0xFFFE )
uItem = MENU_FindItemByKey( wndPtr->hwndSelf, hTrackMenu,
vkey, (htMenu == HTSYSMENU) );
if( uItem >= (UINT32)(-2) )
{
if( uItem == 0xFFFF ) MessageBeep32(0);
if( uItem == (UINT32)(-1) ) MessageBeep32(0);
htMenu = 0;
}
}
@ -2172,25 +2191,36 @@ BOOL16 EnableMenuItem16( HMENU16 hMenu, UINT16 wItemID, UINT16 wFlags )
*/
BOOL32 EnableMenuItem32( HMENU32 hMenu, UINT32 wItemID, UINT32 wFlags )
{
MENUITEM *item;
dprintf_menu(stddeb,"EnableMenuItem (%04x, %04X, %04X) !\n",
hMenu, wItemID, wFlags);
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return FALSE;
BOOL32 bRet = FALSE;
MENUITEM *item, *first = NULL;
/* We can't have MF_GRAYED and MF_DISABLED together */
if (wFlags & MF_GRAYED)
dprintf_menu(stddeb,"EnableMenuItem (%04x, %04X, %04X) !\n",
hMenu, wItemID, wFlags);
while( (item = MENU_FindItem( &hMenu, &wItemID, wFlags )) )
{
item->item_flags = (item->item_flags & ~MF_DISABLED) | MF_GRAYED;
if( !(item->item_flags & MF_POPUP) )
{
/* We can't have MF_GRAYED and MF_DISABLED together */
if (wFlags & MF_GRAYED)
{
item->item_flags = (item->item_flags & ~MF_DISABLED) | MF_GRAYED;
}
else if (wFlags & MF_DISABLED)
{
item->item_flags = (item->item_flags & ~MF_GRAYED) | MF_DISABLED;
}
else /* MF_ENABLED */
{
item->item_flags &= ~(MF_GRAYED | MF_DISABLED);
}
bRet = TRUE;
break;
}
if( !first ) first = item;
else if( first == item ) break;
}
else if (wFlags & MF_DISABLED)
{
item->item_flags = (item->item_flags & ~MF_GRAYED) | MF_DISABLED;
}
else /* MF_ENABLED */
{
item->item_flags &= ~(MF_GRAYED | MF_DISABLED);
}
return TRUE;
return bRet;
}

View File

@ -1,767 +0,0 @@
/*
* Listbox controls
*
* Copyright Martin Ayotte, 1993
* Constantine Sapuntzakis, 1995
* Alex Korobka, 1995, 1996
*
*/
/*
* FIXME:
* - proper scrolling for multicolumn style
* - anchor and caret for LBS_EXTENDEDSEL
* - proper selection with keyboard
* - how to handle (LBS_EXTENDEDSEL | LBS_MULTIPLESEL) style
* - support for LBS_NOINTEGRALHEIGHT and LBS_OWNERDRAWVARIABLE styles
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "windows.h"
#include "win.h"
#include "gdi.h"
#include "listbox.h"
#include "heap.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#define LIST_HEAP_ALLOC(lphl,f,size) \
LOCAL_Alloc( lphl->HeapSel, LMEM_FIXED, (size) )
#define LIST_HEAP_FREE(lphl,handle) \
LOCAL_Free( lphl->HeapSel, (handle) )
#define LIST_HEAP_ADDR(lphl,handle) \
((handle) ? PTR_SEG_OFF_TO_LIN(lphl->HeapSel, (handle)) : NULL)
#define LIST_HEAP_SIZE 0x10000
#define LBMM_EDGE 4 /* distance inside box which is same as moving mouse
outside box, to trigger scrolling of LB */
#define MATCH_SUBSTR 2
#define MATCH_EXACT 1
#define MATCH_NEAREST 0
static void ListBoxInitialize(LPHEADLIST lphl)
{
lphl->lpFirst = NULL;
lphl->ItemsCount = 0;
lphl->ItemsVisible = 0;
lphl->FirstVisible = 0;
lphl->ColumnsVisible = 1;
lphl->ItemsPerColumn = 0;
lphl->ItemFocused = -1;
lphl->PrevFocused = -1;
}
void CreateListBoxStruct(HWND16 hwnd, WORD CtlType, LONG styles, HWND16 parent)
{
LPHEADLIST lphl;
HDC32 hdc;
lphl = (LPHEADLIST)xmalloc(sizeof(HEADLIST));
SetWindowLong32A(hwnd, 0, (LONG)lphl);
ListBoxInitialize(lphl);
lphl->DrawCtlType = CtlType;
lphl->CtlID = GetWindowWord16(hwnd,GWW_ID);
lphl->bRedrawFlag = TRUE;
lphl->iNumStops = 0;
lphl->TabStops = NULL;
lphl->hFont = GetStockObject32(SYSTEM_FONT);
lphl->hSelf = hwnd;
if (CtlType==ODT_COMBOBOX) /* use the "faked" style for COMBOLBOX */
/* LBS_SORT instead CBS_SORT e.g. */
lphl->dwStyle = MAKELONG(LOWORD(styles),HIWORD(GetWindowLong32A(hwnd,GWL_STYLE)));
else
lphl->dwStyle = GetWindowLong32A(hwnd,GWL_STYLE); /* use original style dword */
lphl->hParent = parent;
lphl->StdItemHeight = 15; /* FIXME: should get the font height */
lphl->OwnerDrawn = styles & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE);
lphl->HasStrings = (styles & LBS_HASSTRINGS) || !lphl->OwnerDrawn;
/* create dummy hdc to set text height */
if ((hdc = GetDC32(0)))
{
TEXTMETRIC16 tm;
GetTextMetrics16( hdc, &tm );
lphl->StdItemHeight = tm.tmHeight;
dprintf_listbox(stddeb,"CreateListBoxStruct: font height %d\n",
lphl->StdItemHeight);
ReleaseDC32( 0, hdc );
}
if (lphl->OwnerDrawn)
{
LISTSTRUCT dummyls;
lphl->needMeasure = TRUE;
dummyls.mis.CtlType = lphl->DrawCtlType;
dummyls.mis.CtlID = lphl->CtlID;
dummyls.mis.itemID = -1;
dummyls.mis.itemWidth = 0; /* ignored */
dummyls.mis.itemData = 0;
ListBoxAskMeasure(lphl,&dummyls);
}
lphl->HeapSel = GlobalAlloc16(GMEM_FIXED,LIST_HEAP_SIZE);
LocalInit( lphl->HeapSel, 0, LIST_HEAP_SIZE-1);
}
/* Send notification "code" as part of a WM_COMMAND-message if hwnd
has the LBS_NOTIFY style */
void ListBoxSendNotification(LPHEADLIST lphl, WORD code)
{
if (lphl->dwStyle & LBS_NOTIFY)
SendMessage32A( lphl->hParent, WM_COMMAND,
MAKEWPARAM( lphl->CtlID, code), (LPARAM)lphl->hSelf );
}
/* get the maximum value of lphl->FirstVisible */
int ListMaxFirstVisible(LPHEADLIST lphl)
{
int m = lphl->ItemsCount-lphl->ItemsVisible;
return (m < 0) ? 0 : m;
}
/* Returns: 0 if nothing needs to be changed */
/* 1 if FirstVisible changed */
int ListBoxScrollToFocus(LPHEADLIST lphl)
{
short end;
if (lphl->ItemsCount == 0) return 0;
if (lphl->ItemFocused == -1) return 0;
end = lphl->FirstVisible + lphl->ItemsVisible - 1;
if (lphl->ItemFocused < lphl->FirstVisible ) {
lphl->FirstVisible = lphl->ItemFocused;
return 1;
} else {
if (lphl->ItemFocused > end) {
WORD maxFirstVisible = ListMaxFirstVisible(lphl);
lphl->FirstVisible = lphl->ItemFocused;
if (lphl->FirstVisible > maxFirstVisible) {
lphl->FirstVisible = maxFirstVisible;
}
return 1;
}
}
return 0;
}
LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT16 uIndex)
{
LPLISTSTRUCT lpls;
UINT16 Count = 0;
if (uIndex >= lphl->ItemsCount) return NULL;
lpls = lphl->lpFirst;
while (Count++ < uIndex) lpls = lpls->lpNext;
return lpls;
}
void ListBoxDrawItem(HWND16 hwnd, LPHEADLIST lphl, HDC16 hdc, LPLISTSTRUCT lpls,
RECT16 *rect, WORD itemAction, WORD itemState)
{
if (lphl->OwnerDrawn)
{
DRAWITEMSTRUCT32 dis;
dis.CtlID = lpls->mis.CtlID;
dis.CtlType = lpls->mis.CtlType;
dis.itemID = lpls->mis.itemID;
dis.hDC = hdc;
dis.hwndItem = hwnd;
dis.itemData = lpls->mis.itemData;
dis.itemAction = itemAction;
dis.itemState = itemState;
CONV_RECT16TO32( rect, &dis.rcItem );
SendMessage32A( lphl->hParent, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis );
return;
}
if (itemAction == ODA_DRAWENTIRE || itemAction == ODA_SELECT) {
int OldBkMode;
DWORD dwOldTextColor = 0;
OldBkMode = SetBkMode32(hdc, TRANSPARENT);
if (itemState != 0) {
dwOldTextColor = SetTextColor32(hdc, 0x00FFFFFFL);
FillRect16(hdc, rect, GetStockObject32(BLACK_BRUSH));
}
if (lphl->dwStyle & LBS_USETABSTOPS) {
TabbedTextOut16(hdc, rect->left + 5, rect->top + 2,
(char *)lpls->itemText, strlen((char *)lpls->itemText),
lphl->iNumStops, lphl->TabStops, 0);
} else {
TextOut16(hdc, rect->left + 5, rect->top + 2,
(char *)lpls->itemText, strlen((char *)lpls->itemText));
}
if (itemState != 0) {
SetTextColor32(hdc, dwOldTextColor);
}
SetBkMode32(hdc, OldBkMode);
}
else DrawFocusRect16(hdc, rect);
}
int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y)
{
LPLISTSTRUCT lpls = lphl->lpFirst;
int i, j;
POINT16 point;
point.x = X; point.y = Y;
if (lphl->ItemsCount == 0) return LB_ERR;
for(i = 0; i < lphl->FirstVisible; i++) {
if (lpls == NULL) return LB_ERR;
lpls = lpls->lpNext;
}
for(j = 0; j < lphl->ItemsVisible; i++, j++) {
if (lpls == NULL) return LB_ERR;
if (PtInRect16(&lpls->itemRect,point)) {
return i;
}
lpls = lpls->lpNext;
}
dprintf_listbox(stddeb,"ListBoxFindMouse: not found\n");
return LB_ERR;
}
BOOL32 lbDeleteItemNotify(LPHEADLIST lphl, LPLISTSTRUCT lpls)
{
/* called only for owner drawn listboxes */
BOOL32 ret;
DELETEITEMSTRUCT16 *delItem = SEGPTR_NEW(DELETEITEMSTRUCT16);
if (!delItem) return FALSE;
delItem->CtlType = lphl->DrawCtlType;
delItem->CtlID = lphl->CtlID;
delItem->itemID = lpls->mis.itemID;
delItem->hwndItem = lphl->hSelf;
delItem->itemData = lpls->mis.itemData;
ret = SendMessage16( lphl->hParent, WM_DELETEITEM, (WPARAM16)lphl->CtlID,
(LPARAM)SEGPTR_GET(delItem) );
SEGPTR_FREE(delItem);
return ret;
}
/* -------------------- strings and item data ---------------------- */
void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
{
MEASUREITEMSTRUCT16 *lpmeasure = SEGPTR_NEW(MEASUREITEMSTRUCT16);
if (!lpmeasure) return;
*lpmeasure = lpls->mis;
lpmeasure->itemHeight = lphl->StdItemHeight;
SendMessage16( lphl->hParent, WM_MEASUREITEM, lphl->CtlID,
(LPARAM)SEGPTR_GET(lpmeasure) );
if (lphl->dwStyle & LBS_OWNERDRAWFIXED)
{
if (lpmeasure->itemHeight > lphl->StdItemHeight)
lphl->StdItemHeight = lpmeasure->itemHeight;
lpls->mis.itemHeight = lpmeasure->itemHeight;
}
SEGPTR_FREE(lpmeasure);
}
static LPLISTSTRUCT ListBoxCreateItem(LPHEADLIST lphl, int id)
{
LPLISTSTRUCT lplsnew = (LPLISTSTRUCT)malloc(sizeof(LISTSTRUCT));
if (lplsnew == NULL) return NULL;
lplsnew->itemState = 0;
lplsnew->mis.CtlType = lphl->DrawCtlType;
lplsnew->mis.CtlID = lphl->CtlID;
lplsnew->mis.itemID = id;
lplsnew->mis.itemHeight = lphl->StdItemHeight;
lplsnew->mis.itemWidth = 0; /* ignored */
lplsnew->mis.itemData = 0;
SetRectEmpty16( &lplsnew->itemRect );
return lplsnew;
}
static int ListBoxAskCompare(LPHEADLIST lphl, int startItem, SEGPTR matchData, BOOL32 exactMatch )
{
/* Do binary search for sorted listboxes. Linked list item storage sort of
* defeats the purpose ( forces to traverse item list all the time ) but M$ does it this way...
*
* MATCH_NEAREST (0) - return position for insertion - for all styles
* MATCH_EXACT (1) - search for an item, return index or LB_ERR
* MATCH_SUBSTR (2) - same as exact match but with strncmp for string comparision
*/
COMPAREITEMSTRUCT16 *itemCmp;
LPLISTSTRUCT currentItem = NULL;
LPCSTR matchStr = (lphl->HasStrings)?(LPCSTR)PTR_SEG_TO_LIN(matchData):NULL;
int head, pos = -1, tail, loop = 1;
short b = 0, s_length = 0;
/* check if empty */
if( !lphl->ItemsCount )
return (exactMatch)? LB_ERR: 0;
/* set up variables */
if( exactMatch == MATCH_NEAREST )
startItem = 0;
else if( ++startItem )
{
loop = 2;
if( startItem >= lphl->ItemsCount ) startItem = lphl->ItemsCount - 1;
}
if( exactMatch == MATCH_SUBSTR && lphl->HasStrings )
{
s_length = strlen( matchStr );
if( !s_length ) return 0; /* head of the list - empty string */
}
head = startItem; tail = lphl->ItemsCount - 1;
dprintf_listbox(stddeb,"AskCompare: head = %i, tail = %i, data = %08x\n", head, tail, (unsigned)matchData );
if (!(itemCmp = SEGPTR_NEW(COMPAREITEMSTRUCT16))) return 0;
itemCmp->CtlType = lphl->DrawCtlType;
itemCmp->CtlID = lphl->CtlID;
itemCmp->hwndItem = lphl->hSelf;
/* search from startItem */
while ( loop-- )
{
while( head <= tail )
{
pos = (tail + head)/2;
currentItem = ListBoxGetItem( lphl, pos );
if( lphl->HasStrings )
{
b = ( s_length )? lstrncmpi32A( currentItem->itemText, matchStr, s_length)
: lstrcmpi32A( currentItem->itemText, matchStr);
}
else
{
itemCmp->itemID1 = pos;
itemCmp->itemData1 = currentItem->mis.itemData;
itemCmp->itemID2 = -1;
itemCmp->itemData2 = matchData;
b = SendMessage16( lphl->hParent, WM_COMPAREITEM,
(WPARAM16)lphl->CtlID,
(LPARAM)SEGPTR_GET(itemCmp) );
}
if( b == 0 )
{
SEGPTR_FREE(itemCmp);
return pos; /* found exact match */
}
else
if( b < 0 ) head = ++pos;
else
if( b > 0 ) tail = pos - 1;
}
/* reset to search from the first item */
head = 0; tail = startItem - 1;
}
dprintf_listbox(stddeb,"\t-> pos = %i\n", pos );
SEGPTR_FREE(itemCmp);
/* if we got here match is not exact */
if( pos < 0 ) pos = 0;
else if( pos > lphl->ItemsCount ) pos = lphl->ItemsCount;
return (exactMatch)? LB_ERR: pos;
}
int ListBoxInsertString(LPHEADLIST lphl, UINT16 uIndex, LPCSTR newstr)
{
LPLISTSTRUCT *lppls, lplsnew, lpls;
HANDLE16 hStr;
LPSTR str;
UINT16 Count;
dprintf_listbox(stddeb,"ListBoxInsertString(%d, %p);\n", uIndex, newstr);
if (!newstr) return -1;
if (uIndex == (UINT16)-1)
uIndex = lphl->ItemsCount;
lppls = &lphl->lpFirst;
for(Count = 0; Count < uIndex; Count++) {
if (*lppls == NULL) return LB_ERR;
lppls = (LPLISTSTRUCT *) &(*lppls)->lpNext;
}
lplsnew = ListBoxCreateItem(lphl, Count);
if (lplsnew == NULL) {
fprintf(stdnimp,"ListBoxInsertString() out of memory !\n");
return LB_ERRSPACE;
}
lplsnew->lpNext = *lppls;
*lppls = lplsnew;
lphl->ItemsCount++;
hStr = 0;
if (lphl->HasStrings) {
dprintf_listbox(stddeb," string: %s\n", newstr);
hStr = LIST_HEAP_ALLOC(lphl, LMEM_MOVEABLE, strlen(newstr) + 1);
str = (LPSTR)LIST_HEAP_ADDR(lphl, hStr);
if (str == NULL) return LB_ERRSPACE;
strcpy(str, newstr);
lplsnew->itemText = str;
/* I'm not so sure about the next one */
lplsnew->mis.itemData = 0;
} else {
lplsnew->itemText = NULL;
lplsnew->mis.itemData = (DWORD)newstr;
}
lplsnew->mis.itemID = uIndex;
lplsnew->hData = hStr;
/* adjust the itemID field of the following entries */
for(lpls = lplsnew->lpNext; lpls != NULL; lpls = lpls->lpNext) {
lpls->mis.itemID++;
}
if (lphl->needMeasure) {
ListBoxAskMeasure(lphl, lplsnew);
}
dprintf_listbox(stddeb,"ListBoxInsertString // count=%d\n", lphl->ItemsCount);
return uIndex;
}
int ListBoxAddString(LPHEADLIST lphl, SEGPTR itemData)
{
UINT16 pos = (UINT16) -1;
LPCSTR newstr = (lphl->HasStrings)?(LPCSTR)PTR_SEG_TO_LIN(itemData):(LPCSTR)itemData;
if ( lphl->dwStyle & LBS_SORT )
pos = ListBoxAskCompare( lphl, -1, itemData, MATCH_NEAREST );
return ListBoxInsertString(lphl, pos, newstr);
}
int ListBoxGetText(LPHEADLIST lphl, UINT16 uIndex, LPSTR OutStr)
{
LPLISTSTRUCT lpls;
if (!OutStr) {
dprintf_listbox(stddeb, "ListBoxGetText // OutStr==NULL\n");
return 0;
}
*OutStr = '\0';
lpls = ListBoxGetItem (lphl, uIndex);
if (lpls == NULL) return LB_ERR;
if (!lphl->HasStrings) {
*((long *)OutStr) = lpls->mis.itemData;
return 4;
}
strcpy(OutStr, lpls->itemText);
return strlen(OutStr);
}
DWORD ListBoxGetItemData(LPHEADLIST lphl, UINT16 uIndex)
{
LPLISTSTRUCT lpls;
lpls = ListBoxGetItem (lphl, uIndex);
if (lpls == NULL) return LB_ERR;
return lpls->mis.itemData;
}
int ListBoxSetItemData(LPHEADLIST lphl, UINT16 uIndex, DWORD ItemData)
{
LPLISTSTRUCT lpls = ListBoxGetItem(lphl, uIndex);
if (lpls == NULL) return LB_ERR;
lpls->mis.itemData = ItemData;
return 1;
}
int ListBoxDeleteString(LPHEADLIST lphl, UINT16 uIndex)
{
LPLISTSTRUCT lpls, lpls2;
UINT16 Count;
if (uIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
if (uIndex == 0)
{
if( lphl->OwnerDrawn )
lbDeleteItemNotify( lphl, lpls);
lphl->lpFirst = lpls->lpNext;
}
else
{
LPLISTSTRUCT lpls2 = NULL;
for(Count = 0; Count < uIndex; Count++) {
if (lpls->lpNext == NULL) return LB_ERR;
lpls2 = lpls;
lpls = (LPLISTSTRUCT)lpls->lpNext;
}
if( lphl->OwnerDrawn )
lbDeleteItemNotify( lphl, lpls);
lpls2->lpNext = lpls->lpNext;
}
/* adjust the itemID field of the following entries */
for(lpls2 = lpls->lpNext; lpls2 != NULL; lpls2 = lpls2->lpNext) {
lpls2->mis.itemID--;
}
lphl->ItemsCount--;
if (lpls->hData != 0) LIST_HEAP_FREE(lphl, lpls->hData);
free(lpls);
return lphl->ItemsCount;
}
static int lbFindString(LPHEADLIST lphl, UINT16 nFirst, SEGPTR MatchStr, BOOL32 match)
{
/* match is either MATCH_SUBSTR or MATCH_EXACT */
LPLISTSTRUCT lpls;
UINT16 Count;
UINT16 First = nFirst + 1;
int s_length = 0;
LPSTR lpMatchStr = (LPSTR)MatchStr;
if (First > lphl->ItemsCount) return LB_ERR;
if (lphl->dwStyle & LBS_SORT )
return ListBoxAskCompare( lphl, nFirst, MatchStr, match );
if (lphl->HasStrings )
{
lpMatchStr = PTR_SEG_TO_LIN(MatchStr);
if( match == MATCH_SUBSTR )
{
s_length = strlen(lpMatchStr);
if( !s_length ) return (lphl->ItemsCount)?0:LB_ERR;
}
}
lpls = ListBoxGetItem(lphl, First);
Count = 0;
while(lpls != NULL)
{
if (lphl->HasStrings)
{
if ( ( s_length )? !lstrncmpi32A(lpls->itemText, lpMatchStr, s_length)
: !lstrcmpi32A(lpls->itemText, lpMatchStr) ) return Count;
}
else
if ( lpls->mis.itemData == (DWORD)lpMatchStr ) return Count;
lpls = lpls->lpNext;
Count++;
}
/* Start over at top */
Count = 0;
lpls = lphl->lpFirst;
while (Count < First)
{
if (lphl->HasStrings)
{
if ( ( s_length )? !lstrncmpi32A(lpls->itemText, lpMatchStr, s_length)
: !lstrcmpi32A(lpls->itemText, lpMatchStr) ) return Count;
}
else
if ( lpls->mis.itemData == (DWORD)lpMatchStr ) return Count;
lpls = lpls->lpNext;
Count++;
}
return LB_ERR;
}
int ListBoxFindString(LPHEADLIST lphl, UINT16 nFirst, SEGPTR MatchStr)
{
return lbFindString(lphl, nFirst, MatchStr, MATCH_SUBSTR );
}
int ListBoxFindStringExact(LPHEADLIST lphl, UINT16 nFirst, SEGPTR MatchStr)
{
return lbFindString(lphl, nFirst, MatchStr, MATCH_EXACT );
}
int ListBoxResetContent(LPHEADLIST lphl)
{
LPLISTSTRUCT lpls;
int i;
if (lphl->ItemsCount == 0) return 0;
dprintf_listbox(stddeb, "ListBoxResetContent // ItemCount = %d\n",
lphl->ItemsCount);
for(i = 0; i < lphl->ItemsCount; i++) {
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
if (lphl->OwnerDrawn) lbDeleteItemNotify(lphl, lpls);
lphl->lpFirst = lpls->lpNext;
if (lpls->hData != 0) LIST_HEAP_FREE(lphl, lpls->hData);
free(lpls);
}
ListBoxInitialize(lphl);
return TRUE;
}
/* --------------------- selection ------------------------- */
int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex)
{
LPLISTSTRUCT lpls;
/* use ListBoxSetSel instead */
if (lphl->dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL) ) return 0;
/* unselect previous item */
if (lphl->ItemFocused != -1) {
lphl->PrevFocused = lphl->ItemFocused;
lpls = ListBoxGetItem(lphl, lphl->ItemFocused);
if (lpls == 0) return LB_ERR;
lpls->itemState = 0;
}
if ((wIndex != (UINT16)-1) && (wIndex < lphl->ItemsCount))
{
lphl->ItemFocused = wIndex;
lpls = ListBoxGetItem(lphl, wIndex);
if (lpls == 0) return LB_ERR;
lpls->itemState = ODS_SELECTED | ODS_FOCUS;
return 0;
}
return LB_ERR;
}
/* ------------------------- dir listing ------------------------ */
LONG ListBoxDirectory(LPHEADLIST lphl, UINT16 attrib, LPCSTR filespec)
{
return 0;
}
/* ------------------------- dimensions ------------------------- */
int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT16 lprect)
{
LPLISTSTRUCT lpls = ListBoxGetItem(lphl,wIndex);
dprintf_listbox(stddeb,"ListBox LB_GETITEMRECT %i %p", wIndex,lpls);
if (lpls == NULL)
{
if (lphl->dwStyle & LBS_OWNERDRAWVARIABLE)
return LB_ERR;
else
{
GetClientRect16(lphl->hSelf,lprect);
lprect->bottom=lphl->StdItemHeight;
if (lprect->right<0) lprect->right=0;
}
}
else
*lprect = lpls->itemRect;
dprintf_listbox(stddeb," = %d,%d %d,%d\n", lprect->left,lprect->top,
lprect->right,lprect->bottom);
return 0;
}
int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height)
{
LPLISTSTRUCT lpls;
if (!(lphl->dwStyle & LBS_OWNERDRAWVARIABLE)) {
lphl->StdItemHeight = (short)height;
return 0;
}
lpls = ListBoxGetItem(lphl, wIndex);
if (lpls == NULL) return LB_ERR;
lpls->mis.itemHeight = height;
return 0;
}
/* -------------------------- string search ------------------------ */
int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar)
{
LPLISTSTRUCT lpls;
UINT16 count,first;
if ((char)wChar < ' ') return LB_ERR;
if (!lphl->HasStrings) return LB_ERR;
lpls = lphl->lpFirst;
for (count = 0; lpls != NULL; lpls = lpls->lpNext, count++) {
if (tolower(*lpls->itemText) == tolower((char)wChar)) break;
}
if (lpls == NULL) return LB_ERR;
first = count;
for(; lpls != NULL; lpls = lpls->lpNext, count++) {
if (*lpls->itemText != (char)wChar)
break;
if ((short) count > lphl->ItemFocused)
return count;
}
return first;
}

View File

@ -421,11 +421,7 @@ static void SCROLL_DrawInterior( HWND32 hwnd, HDC32 hdc, INT32 nBar,
/* Draw the scroll bar frame */
MoveTo( hdc, r.left, r.top );
LineTo32( hdc, r.right-1, r.top );
LineTo32( hdc, r.right-1, r.bottom-1 );
LineTo32( hdc, r.left, r.bottom-1 );
LineTo32( hdc, r.left, r.top );
GRAPH_DrawRectangle( hdc, r.left, r.top, r.right - 1, r.bottom - 1, 0);
/* Draw the scroll rectangles and thumb */

View File

@ -4,6 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#include <assert.h>
#include "win.h"
#include "commctrl.h"
#include "button.h"
@ -20,6 +22,10 @@
extern LRESULT EditWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT ComboWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT ComboLBWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT ListBoxWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT PopupMenuWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
@ -42,10 +48,6 @@ static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
{
{ CS_GLOBALCLASS | CS_PARENTDC,
sizeof(STATICINFO), 0, "StaticWndProc", "Static" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
8, 0, "ComboBoxWndProc", "ComboBox" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
8, 0, "ComboLBoxWndProc", "ComboLBox" },
{ CS_GLOBALCLASS, sizeof(MDICLIENTINFO),
STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDIClient" }
};
@ -55,27 +57,38 @@ static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
/* Win32 built-in classes */
static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
static WNDCLASS32A WIDGETS_BuiltinClasses32[BIC32_NB_CLASSES] =
{
/* BIC32_BUTTON */
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "Button" },
/* BIC32_EDIT */
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
EditWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "Edit" },
/* BIC32_LISTBOX */
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
ListBoxWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "ListBox" },
/* BIC32_COMBO */
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
ComboWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "ComboBox" },
/* BIC32_COMBOLB */
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
ComboLBWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "ComboLBox" },
/* BIC32_POPUPMENU */
{ CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc,
0, sizeof(HMENU32), 0, 0, 0, 0, 0, POPUPMENU_CLASS_NAME },
/* BIC32_SCROLL */
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, 0, 0, 0, "ScrollBar"},
/* BIC32_DESKTOP */
{ CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, 0, DESKTOP_CLASS_NAME },
/* BIC32_DIALOG */
{ CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc32A, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, 0, DIALOG_CLASS_NAME }
};
#define NB_BUILTIN_CLASSES32 \
(sizeof(WIDGETS_BuiltinClasses32)/sizeof(WIDGETS_BuiltinClasses32[0]))
static ATOM bicAtomTable[BIC32_NB_CLASSES];
/* Win32 common controls */
@ -124,13 +137,13 @@ BOOL32 WIDGETS_Init(void)
/* Create 32-bit classes */
for (i = 0; i < NB_BUILTIN_CLASSES32; i++, class32++)
for (i = 0; i < BIC32_NB_CLASSES; i++, class32++)
{
/* Just to make sure the string is > 0x10000 */
strcpy( name, (char *)class32->lpszClassName );
class32->lpszClassName = name;
class32->hCursor = LoadCursor16( 0, IDC_ARROW );
if (!RegisterClass32A( class32 )) return FALSE;
if (!(bicAtomTable[i] = RegisterClass32A( class32 ))) return FALSE;
}
SEGPTR_FREE(name);
@ -156,3 +169,15 @@ void InitCommonControls(void)
RegisterClass32A( class32 );
}
}
/***********************************************************************
* WIDGETS_IsControl32
*
* Check whether pWnd is a built-in control or not.
*/
BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls )
{
assert( cls < BIC32_NB_CLASSES );
return (pWnd->class->atomName == bicAtomTable[cls]);
}

View File

@ -1843,6 +1843,11 @@ DEBUG_ProcessPDBFile(struct deferred_debug_info * deefer, char * full_filename)
*/
addr = mmap(0, statbuf.st_size, PROT_READ,
MAP_PRIVATE, fd, 0);
if( addr == (char *) 0xffffffff )
{
fprintf(stderr, "Unable to mmap .DBG file %s\n", filename);
goto leave;
}
/*
* Now that we have the formalities over and done with, we need
@ -2166,6 +2171,11 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
*/
addr = mmap(0, statbuf.st_size, PROT_READ,
MAP_PRIVATE, fd, 0);
if( addr == (char *) 0xffffffff )
{
fprintf(stderr, "Unable to mmap .DBG file %s\n", filename);
goto leave;
}
pdbg = (LPIMAGE_SEPARATE_DEBUG_HEADER) addr;

View File

@ -1103,6 +1103,10 @@ DEBUG_ProcessElfObject(char * filename, unsigned int load_offset)
*/
addr = mmap(0, statbuf.st_size, PROT_READ,
MAP_PRIVATE, fd, 0);
if( addr == (char *) 0xffffffff )
{
goto leave;
}
/*
* Give a nice status message here...
@ -1337,6 +1341,10 @@ DEBUG_ReadExecutableDbgInfo(void)
*/
addr = mmap(0, statbuf.st_size, PROT_READ,
MAP_PRIVATE, fd, 0);
if( addr == (char *) 0xffffffff )
{
goto leave;
}
ahdr = (struct exec *) addr;

View File

@ -33,6 +33,15 @@
/* FIXME: is it possible to get this to work on other systems? */
#ifdef linux
#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, long)
/* We want the real kernel dirent structure, not the libc one */
typedef struct
{
long d_ino;
long d_off;
unsigned short d_reclen;
char d_name[256];
} KERNEL_DIRENT;
#else /* linux */
#undef VFAT_IOCTL_READDIR_BOTH /* just in case... */
#endif /* linux */
@ -83,7 +92,7 @@ typedef struct
#ifdef VFAT_IOCTL_READDIR_BOTH
int fd;
char short_name[12];
struct dirent dirent[2];
KERNEL_DIRENT dirent[2];
#endif
} DOS_DIR;
@ -948,16 +957,11 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
if (dir) DOSFS_CloseDir(dir);
if (!*path) path = "/";
if (!(dir = DOSFS_OpenDir(path))) return 0;
drive_path = path;
drive_root = 0;
if (DRIVE_FindDriveRoot( &drive_path ) != -1)
{
while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
if (!*drive_path) drive_root = 1;
}
drive_path = path + strlen(DRIVE_GetRoot(drive));
while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
drive_root = !*drive_path;
dprintf_dosfs(stddeb, "DOSFS_FindNext: drive_root = %d\n", drive_root);
lstrcpyn32A( buffer, path, sizeof(buffer) - 1 );
}
strcat( buffer, "/" );
p = buffer + strlen(buffer);

View File

@ -43,6 +43,8 @@ typedef struct
DWORD serial; /* drive serial number */
DRIVETYPE type; /* drive type */
UINT32 flags; /* drive flags */
dev_t dev; /* unix device number */
ino_t ino; /* unix inode number */
} DOSDRIVE;
@ -124,6 +126,7 @@ int DRIVE_Init(void)
char name[] = "Drive A";
char path[MAX_PATHNAME_LEN];
char buffer[20];
struct stat drive_stat_buffer;
char *p;
DOSDRIVE *drive;
@ -134,14 +137,28 @@ int DRIVE_Init(void)
{
p = path + strlen(path) - 1;
while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0';
if (strlen(path))
drive->root = HEAP_strdupA( SystemHeap, 0, path );
else
drive->root = HEAP_strdupA( SystemHeap, 0, "/" );
if (!path[0]) strcpy( path, "/" );
if (stat( path, &drive_stat_buffer ))
{
fprintf( stderr, "Could not stat %s, ignoring drive %c:\n",
path, 'A' + i );
continue;
}
if (!S_ISDIR(drive_stat_buffer.st_mode))
{
fprintf( stderr, "%s is not a directory, ignoring drive %c:\n",
path, 'A' + i );
continue;
}
drive->root = HEAP_strdupA( SystemHeap, 0, path );
drive->dos_cwd = HEAP_strdupA( SystemHeap, 0, "" );
drive->unix_cwd = HEAP_strdupA( SystemHeap, 0, "" );
drive->type = DRIVE_GetDriveType( name );
drive->flags = 0;
drive->dev = drive_stat_buffer.st_dev;
drive->ino = drive_stat_buffer.st_ino;
/* Get the drive label */
PROFILE_GetWineIniString( name, "Label", name, drive->label, 12 );
@ -167,9 +184,10 @@ int DRIVE_Init(void)
DRIVE_CurDrive = i;
count++;
dprintf_dosfs( stddeb, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x\n",
dprintf_dosfs( stddeb, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x dev=%x ino=%x\n",
name, path, DRIVE_Types[drive->type],
drive->label, drive->serial, drive->flags );
drive->label, drive->serial, drive->flags,
(int)drive->dev, (int)drive->ino );
}
else dprintf_dosfs( stddeb, "%s: not defined\n", name );
}
@ -252,51 +270,54 @@ int DRIVE_SetCurrentDrive( int drive )
* This can be used to translate a Unix path into a drive + DOS path.
* Return value is the drive, or -1 on error. On success, path is modified
* to point to the beginning of the DOS path.
* FIXME: this only does a textual comparison of the path names, and won't
* work well in the presence of symbolic links.
*/
int DRIVE_FindDriveRoot( const char **path )
{
/* idea: check at all '/' positions.
* If the device and inode of that path is identical with the
* device and inode of the current drive then we found a solution.
* If there is another drive pointing to a deeper position in
* the file tree, we want to find that one, not the earlier solution.
*/
int drive, rootdrive = -1;
const char *p1, *p2;
char buffer[MAX_PATHNAME_LEN];
char *next = buffer;
const char *p = *path;
struct stat st;
dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: searching '%s'\n", *path );
for (drive = 0; drive < MAX_DOS_DRIVES; drive++)
strcpy( buffer, "/" );
for (;;)
{
if (!DOSDrives[drive].root ||
(DOSDrives[drive].flags & DRIVE_DISABLED)) continue;
p1 = *path;
p2 = DOSDrives[drive].root;
dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: checking %c: '%s'\n",
'A' + drive, p2 );
while (*p2 == '/') p2++;
if (!*p2)
if (stat( buffer, &st ) || !S_ISDIR( st.st_mode )) break;
/* Find the drive */
for (drive = 0; drive < MAX_DOS_DRIVES; drive++)
{
rootdrive = drive;
continue; /* Look if there's a better match */
}
for (;;)
{
while ((*p1 == '\\') || (*p1 == '/')) p1++;
while (*p2 == '/') p2++;
while ((*p1 == *p2) && (*p2) && (*p2 != '/')) p1++, p2++;
if (!*p2)
{
if (IS_END_OF_NAME(*p1)) /* OK, found it */
{
*path = p1;
return drive;
}
}
else if (*p2 == '/')
{
if (IS_END_OF_NAME(*p1))
continue; /* Go to next path element */
}
break; /* No match, go to next drive */
if (!DOSDrives[drive].root ||
(DOSDrives[drive].flags & DRIVE_DISABLED)) continue;
if ((DOSDrives[drive].dev == st.st_dev) &&
(DOSDrives[drive].ino == st.st_ino))
{
rootdrive = drive;
*path = p;
}
}
/* Get the next path component */
*next++ = '/';
while ((*p == '/') || (*p == '\\')) p++;
if (!*p) break;
while (!IS_END_OF_NAME(*p)) *next++ = *p++;
*next = 0;
}
if (rootdrive != -1)
dprintf_dosfs( stddeb, "DRIVE_FindDriveRoot: %s -> drive %c:, root='%s', name='%s'\n",
buffer, 'A' + rootdrive,
DOSDrives[rootdrive].root, *path );
return rootdrive;
}

View File

@ -28,6 +28,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pExcludeVisRect */
MFDRV_ExtFloodFill, /* pExtFloodFill */
MFDRV_ExtTextOut, /* pExtTextOut */
NULL, /* pGetCharWidth */
NULL /* no implementation */, /* pGetPixel */
NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */

View File

@ -9,6 +9,7 @@ C_SRCS = \
font.c \
init.c \
objects.c \
prtdrv.c \
text.c
all: $(MODULE).o

View File

@ -18,6 +18,12 @@ BOOL32 WIN16DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
LPSIZE32 size )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
DWORD dwRet;
extern DRAWMODE DrawMode;
LPDRAWMODE lpDrawMode = &DrawMode;
TEXTXFORM16 TextXForm;
LPTEXTXFORM16 lpTextXForm = &TextXForm;
InitTextXForm(lpTextXForm);
printf("LPGDI_GetTextExtPoint: %04x %s %d %p\n", dc->hSelf, str, count, size);
@ -25,7 +31,16 @@ BOOL32 WIN16DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
/* Assume fixed font */
size->cx = count * physDev->tm.tmAveCharWidth;
size->cy = physDev->tm.tmHeight;
printf("LPGDI_GetTextExtPoint: cx=%d, cy=%d\n", size->cx,size->cy);
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
NULL, str,
-count, physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, 0);
printf("LPGDI_GetTextExtPoint: cx=0x%x, cy=0x%x Ret 0x%x\n", size->cx,size->cy,dwRet);
return TRUE;
}
@ -79,3 +94,20 @@ HFONT32 WIN16DRV_FONT_SelectObject( DC * dc, HFONT32 hfont, FONTOBJ * font)
printf("In WIN16DRV_FONT_SelectObject\n");
return GetStockObject32(SYSTEM_FIXED_FONT);
}
/***********************************************************************
* GetCharWidth32A (GDI32.155)
*/
BOOL32 WIN16DRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar,
LPINT32 buffer )
{
int i;
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
/* TTD Need to cope with PS fonts */
for (i = firstChar; i <= lastChar; i++)
*buffer++ = physDev->tm.tmAveCharWidth;
return TRUE;
}

View File

@ -22,8 +22,7 @@
#include "stddebug.h"
#include "debug.h"
#define SUPPORT_REALIZED_FONTS 1
typedef SEGPTR LPPDEVICE;
#define SUPPORT_REALIZED_FONTS 1
#if 0
@ -51,6 +50,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pExcludeVisRect */
NULL, /* pExtFloodFill */
WIN16DRV_ExtTextOut, /* pExtTextOut */
WIN16DRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetPixel */
WIN16DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
WIN16DRV_GetTextMetrics, /* pGetTextMetrics */
@ -101,9 +101,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
};
#define MAX_PRINTER_DRIVERS 16
static LOADED_PRINTER_DRIVER *gapLoadedPrinterDrivers[MAX_PRINTER_DRIVERS];
/**********************************************************************
@ -149,295 +147,6 @@ void InitDrawMode(LPDRAWMODE lpDrawMode)
lpDrawMode->LbkColor = 0x00ffffff;
lpDrawMode->LTextColor = 0x00000000;
}
/*
* Thunking utility functions
*/
static BOOL32 AddData(SEGPTR *pSegPtr, const void *pData, int nSize, SEGPTR Limit)
{
BOOL32 bRet = FALSE;
char *pBuffer = PTR_SEG_TO_LIN((*pSegPtr));
char *pLimit = PTR_SEG_TO_LIN(Limit);
if ((pBuffer + nSize) < pLimit)
{
DWORD *pdw = (DWORD *)pSegPtr;
SEGPTR SegPtrOld = *pSegPtr;
SEGPTR SegPtrNew;
dprintf_win16drv(stddeb, "AddData: Copying %d from %p to %p(0x%x)\n", nSize, pData, pBuffer, (UINT32)*pSegPtr);
memcpy(pBuffer, pData, nSize);
SegPtrNew = (SegPtrOld + nSize + 1);
*pdw = (DWORD)SegPtrNew;
}
return bRet;
}
static BOOL32 GetParamData(SEGPTR SegPtrSrc,void *pDataDest, int nSize)
{
char *pSrc = PTR_SEG_TO_LIN(SegPtrSrc);
char *pDest = pDataDest;
dprintf_win16drv(stddeb, "GetParamData: Copying %d from %lx(%lx) to %lx\n", nSize, (DWORD)pSrc, (DWORD)SegPtrSrc, (DWORD)pDataDest);
memcpy(pDest, pSrc, nSize);
return TRUE;
}
static void GetPrinterDriverFunctions(HINSTANCE16 hInst, LOADED_PRINTER_DRIVER *pLPD)
{
#define LoadPrinterDrvFunc(A,B) pLPD->fn[A] = \
GetProcAddress16(hInst, MAKEINTRESOURCE(B))
LoadPrinterDrvFunc(FUNC_CONTROL, ORD_CONTROL); /* 3 */
LoadPrinterDrvFunc(FUNC_ENABLE, ORD_ENABLE); /* 5 */
LoadPrinterDrvFunc(FUNC_ENUMDFONTS, ORD_ENUMDFONTS); /* 6 */
LoadPrinterDrvFunc(FUNC_REALIZEOBJECT, ORD_REALIZEOBJECT);/* 10 */
LoadPrinterDrvFunc(FUNC_EXTTEXTOUT, ORD_EXTTEXTOUT); /* 14 */
dprintf_win16drv (stddeb,"got func CONTROL 0x%p enable 0x%p enumDfonts 0x%p realizeobject 0x%p extextout 0x%p\n",
pLPD->fn[FUNC_CONTROL],
pLPD->fn[FUNC_ENABLE],
pLPD->fn[FUNC_ENUMDFONTS],
pLPD->fn[FUNC_REALIZEOBJECT],
pLPD->fn[FUNC_EXTTEXTOUT]);
}
static LOADED_PRINTER_DRIVER *FindPrinterDriverFromPDEVICE(SEGPTR segptrPDEVICE)
{
LOADED_PRINTER_DRIVER *pLPD = NULL;
/* Find the printer driver associated with this PDEVICE */
/* Each of the PDEVICE structures has a PDEVICE_HEADER structure */
/* just before it */
if (segptrPDEVICE != (SEGPTR)NULL)
{
PDEVICE_HEADER *pPDH = (PDEVICE_HEADER *)
(PTR_SEG_TO_LIN(segptrPDEVICE) - sizeof(PDEVICE_HEADER));
pLPD = pPDH->pLPD;
}
return pLPD;
}
static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(const char *pszDriver)
{
LOADED_PRINTER_DRIVER *pLPD = NULL;
int nDriverSlot = 0;
/* Look to see if the printer driver is already loaded */
while (pLPD == NULL && nDriverSlot < MAX_PRINTER_DRIVERS)
{
LOADED_PRINTER_DRIVER *ptmpLPD;
ptmpLPD = gapLoadedPrinterDrivers[nDriverSlot++];
if (ptmpLPD != NULL)
{
dprintf_win16drv(stddeb, "Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
/* Found driver store info, exit loop */
if (lstrcmpi32A(ptmpLPD->szDriver, pszDriver) == 0)
pLPD = ptmpLPD;
}
}
if (pLPD == NULL) printf("Couldn't find driver %s\n", pszDriver);
return pLPD;
}
/*
* Load a printer driver, adding it self to the list of loaded drivers.
*/
static LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
{
HINSTANCE16 hInst;
LOADED_PRINTER_DRIVER *pLPD = NULL;
int nDriverSlot = 0;
BOOL32 bSlotFound = FALSE;
/* First look to see if driver is loaded */
pLPD = FindPrinterDriverFromName(pszDriver);
if (pLPD != NULL)
{
/* Already loaded so increase usage count */
pLPD->nUsageCount++;
return pLPD;
}
/* Not loaded so try and find an empty slot */
while (!bSlotFound && nDriverSlot < MAX_PRINTER_DRIVERS)
{
if (gapLoadedPrinterDrivers[nDriverSlot] == NULL)
bSlotFound = TRUE;
else
nDriverSlot++;
}
if (!bSlotFound)
{
printf("Too many printers drivers loaded\n");
return NULL;
}
{
char *drvName = malloc(strlen(pszDriver)+5);
strcpy(drvName, pszDriver);
strcat(drvName, ".DRV");
hInst = LoadLibrary16(drvName);
}
dprintf_win16drv(stddeb, "Loaded the library\n");
if (hInst <= 32)
{
/* Failed to load driver */
fprintf(stderr, "Failed to load printer driver %s\n", pszDriver);
}
else
{
HANDLE16 hHandle;
/* Allocate some memory for printer driver info */
pLPD = malloc(sizeof(LOADED_PRINTER_DRIVER));
memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
pLPD->hInst = hInst;
strcpy(pLPD->szDriver,pszDriver);
/* Get DS for the printer module */
pLPD->ds_reg = hInst;
dprintf_win16drv(stddeb, "DS for %s is %x\n", pszDriver, pLPD->ds_reg);
/* Get address of printer driver functions */
GetPrinterDriverFunctions(hInst, pLPD);
/* Set initial usage count */
pLPD->nUsageCount = 1;
/* Create a thunking buffer */
hHandle = GlobalAlloc16(GHND, (1024 * 8));
pLPD->hThunk = hHandle;
pLPD->ThunkBufSegPtr = WIN16_GlobalLock16(hHandle);
pLPD->ThunkBufLimit = pLPD->ThunkBufSegPtr + (1024*8);
/* Update table of loaded printer drivers */
pLPD->nIndex = nDriverSlot;
gapLoadedPrinterDrivers[nDriverSlot] = pLPD;
}
return pLPD;
}
/*
* Control (ordinal 3)
*/
INT16 PRTDRV_Control(LPPDEVICE lpDestDev, WORD wfunction, SEGPTR lpInData, SEGPTR lpOutData)
{
/* wfunction == Escape code */
/* lpInData, lpOutData depend on code */
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_Control: %08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP3, lP4;
WORD wP2;
if (pLPD->fn[FUNC_CONTROL] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_Control: Not supported by driver\n");
return 0;
}
lP1 = (SEGPTR)lpDestDev;
wP2 = wfunction;
lP3 = (SEGPTR)lpInData;
lP4 = (SEGPTR)lpOutData;
wRet = CallTo16_word_lwll(pLPD->fn[FUNC_CONTROL],
lP1, wP2, lP3, lP4);
}
dprintf_win16drv(stddeb, "PRTDRV_Control: return %x\n", wRet);
return wRet;
return 0;
}
/*
* Enable (ordinal 5)
*/
static WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
LPCSTR lpDeviceName, LPCSTR lpOutputFile, LPVOID lpData)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_Enable: %s %s\n",lpDestDevType, lpOutputFile);
/* Get the printer driver info */
if (wStyle == INITPDEVICE)
{
pLPD = FindPrinterDriverFromPDEVICE((SEGPTR)lpDevInfo);
}
else
{
pLPD = FindPrinterDriverFromName((char *)lpDeviceName);
}
if (pLPD != NULL)
{
LONG lP1, lP3, lP4, lP5;
WORD wP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_ENABLE] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_Enable: Not supported by driver\n");
return 0;
}
if (wStyle == INITPDEVICE)
{
/* All ready a 16 address */
lP1 = (SEGPTR)lpDevInfo;
}
else
{
/* 32 bit data */
lP1 = SegPtr;
nSize = sizeof(DeviceCaps);
AddData(&SegPtr, lpDevInfo, nSize, Limit);
}
wP2 = wStyle;
lP3 = SegPtr;
nSize = strlen(lpDestDevType) + 1;
AddData(&SegPtr, lpDestDevType, nSize, Limit);
lP4 = SegPtr;
nSize = strlen(lpOutputFile) + 1;
AddData(&SegPtr, lpOutputFile, nSize, Limit);
lP5 = (LONG)lpData;
wRet = CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE],
lP1, wP2, lP3, lP4, lP5);
/* Get the data back */
if (lP1 != 0 && wStyle != INITPDEVICE)
{
nSize = sizeof(DeviceCaps);
GetParamData(lP1, lpDevInfo, nSize);
}
}
dprintf_win16drv(stddeb, "PRTDRV_Enable: return %x\n", wRet);
return wRet;
}
/*
* EnumCallback (GDI.158)
@ -493,120 +202,6 @@ WORD WineEnumDFontCallback(LPLOGFONT16 lpLogFont, LPTEXTMETRIC16 lpTextMetrics,
return wRet;
}
/*
* EnumDFonts (ordinal 6)
*/
WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
FARPROC16 lpCallbackFunc, LPVOID lpClientData)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP2, lP3, lP4;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_ENUMDFONTS] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n");
return 0;
}
lP1 = (SEGPTR)lpDestDev;
if (lpFaceName == NULL)
{
lP2 = 0;
}
else
{
lP2 = SegPtr;
nSize = strlen(lpFaceName) + 1;
AddData(&SegPtr, lpFaceName, nSize, Limit);
}
lP3 = (LONG)lpCallbackFunc;
lP4 = (LONG)lpClientData;
wRet = CallTo16_word_llll(pLPD->fn[FUNC_ENUMDFONTS],
lP1, lP2, lP3, lP4);
}
else
printf("Failed to find device\n");
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet);
return wRet;
}
/*
* RealizeObject (ordinal 10)
*/
DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
LPVOID lpInObj, LPVOID lpOutObj,
LPTEXTXFORM16 lpTextXForm)
{
WORD dwRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP3, lP4, lP5;
WORD wP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: Not supported by driver\n");
return 0;
}
lP1 = lpDestDev;
wP2 = wStyle;
lP3 = SegPtr;
switch (wStyle)
{
case 3:
nSize = sizeof(LOGFONT16);
break;
default:
printf("PRTDRV_RealizeObject: Object type %d not supported\n", wStyle);
nSize = 0;
}
AddData(&SegPtr, lpInObj, nSize, Limit);
lP4 = (LONG)lpOutObj;
if (lpTextXForm != NULL)
{
lP5 = SegPtr;
nSize = sizeof(TEXTXFORM16);
AddData(&SegPtr, lpTextXForm, nSize, Limit);
}
else
lP5 = 0L;
dwRet = CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT],
lP1, wP2, lP3, lP4, lP5);
}
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: return %x\n", dwRet);
return dwRet;
}
BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
const DEVMODE16* initData )
{
@ -798,116 +393,6 @@ static INT32 WIN16DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
return nRet;
}
DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
SEGPTR lpFontInfo, LPDRAWMODE lpDrawMode,
LPTEXTXFORM16 lpTextXForm, SHORT *lpCharWidths,
RECT16 * lpOpaqueRect, WORD wOptions)
{
DWORD dwRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP4, lP5, lP7, lP8, lP9, lP10, lP11;
WORD wP2, wP3, wP6, wP12;
INT16 iP6;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Not supported by driver\n");
return 0;
}
lP1 = lpDestDev;
wP2 = wDestXOrg;
wP3 = wDestYOrg;
if (lpClipRect != NULL)
{
lP4 = SegPtr;
nSize = sizeof(RECT16);
dprintf_win16drv(stddeb, "Adding lpClipRect\n");
AddData(&SegPtr, lpClipRect, nSize, Limit);
}
else
lP4 = 0L;
if (lpString != NULL)
{
/* TTD WARNING THIS STRING ISNT NULL TERMINATED */
lP5 = SegPtr;
nSize = strlen(lpString);
nSize = abs(wCount);
dprintf_win16drv(stddeb, "Adding string size %d\n",nSize);
AddData(&SegPtr, lpString, nSize, Limit);
}
else
lP5 = 0L;
iP6 = wCount;
/* This should be realized by the driver, so in 16bit data area */
lP7 = lpFontInfo;
if (lpDrawMode != NULL)
{
lP8 = SegPtr;
nSize = sizeof(DRAWMODE);
dprintf_win16drv(stddeb, "adding lpDrawMode\n");
AddData(&SegPtr, lpDrawMode, nSize, Limit);
}
else
lP8 = 0L;
if (lpTextXForm != NULL)
{
lP9 = SegPtr;
nSize = sizeof(TEXTXFORM16);
dprintf_win16drv(stddeb, "Adding TextXForm\n");
AddData(&SegPtr, lpTextXForm, nSize, Limit);
}
else
lP9 = 0L;
if (lpCharWidths != NULL)
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n");
lP10 = 0;
if (lpOpaqueRect != NULL)
{
lP11 = SegPtr;
nSize = sizeof(RECT16);
dprintf_win16drv(stddeb, "Adding opaqueRect\n");
AddData(&SegPtr, lpOpaqueRect, nSize, Limit);
}
else
lP11 = 0L;
wP12 = wOptions;
dprintf_win16drv(stddeb, "Calling exttextout 0x%lx 0x%x 0x%x 0x%lx\n0x%lx 0x%x 0x%lx 0x%lx\n"
"0x%lx 0x%lx 0x%lx 0x%x\n",lP1, wP2, wP3, lP4,
lP5, iP6, lP7, lP8, lP9, lP10,
lP11, wP12);
dwRet = CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT],
lP1, wP2, wP3, lP4,
lP5, iP6, lP7, lP8, lP9, lP10,
lP11, wP12);
if (lpDrawMode)
GetParamData(lP8, lpDrawMode, sizeof(DRAWMODE));
}
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
return dwRet;
}

603
graphics/win16drv/prtdrv.c Normal file
View File

@ -0,0 +1,603 @@
/*
* Windows Device Context initialisation functions
*
* Copyright 1996 John Harvey
*/
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include "windows.h"
#include "win16drv.h"
#include "callback.h"
#include "stddebug.h"
#include "debug.h"
#define MAX_PRINTER_DRIVERS 16
static LOADED_PRINTER_DRIVER *gapLoadedPrinterDrivers[MAX_PRINTER_DRIVERS];
static void GetPrinterDriverFunctions(HINSTANCE16 hInst, LOADED_PRINTER_DRIVER *pLPD)
{
#define LoadPrinterDrvFunc(A) pLPD->fn[FUNC_##A] = \
GetProcAddress16(hInst, MAKEINTRESOURCE(ORD_##A))
LoadPrinterDrvFunc(BITBLT);
LoadPrinterDrvFunc(COLORINFO);
LoadPrinterDrvFunc(CONTROL);
LoadPrinterDrvFunc(DISABLE);
LoadPrinterDrvFunc(ENABLE);
LoadPrinterDrvFunc(ENUMDFONTS);
LoadPrinterDrvFunc(ENUMOBJ);
LoadPrinterDrvFunc(OUTPUT);
LoadPrinterDrvFunc(PIXEL);
LoadPrinterDrvFunc(REALIZEOBJECT);
LoadPrinterDrvFunc(STRBLT);
LoadPrinterDrvFunc(SCANLR);
LoadPrinterDrvFunc(DEVICEMODE);
LoadPrinterDrvFunc(EXTTEXTOUT);
LoadPrinterDrvFunc(GETCHARWIDTH);
LoadPrinterDrvFunc(DEVICEBITMAP);
LoadPrinterDrvFunc(FASTBORDER);
LoadPrinterDrvFunc(SETATTRIBUTE);
LoadPrinterDrvFunc(STRETCHBLT);
LoadPrinterDrvFunc(STRETCHDIBITS);
LoadPrinterDrvFunc(SELECTBITMAP);
LoadPrinterDrvFunc(BITMAPBITS);
LoadPrinterDrvFunc(EXTDEVICEMODE);
LoadPrinterDrvFunc(DEVICECAPABILITIES);
LoadPrinterDrvFunc(ADVANCEDSETUPDIALOG);
LoadPrinterDrvFunc(DIALOGFN);
LoadPrinterDrvFunc(PSEUDOEDIT);
dprintf_win16drv (stddeb,"got func CONTROL 0x%p enable 0x%p enumDfonts 0x%p realizeobject 0x%p extextout 0x%p\n",
pLPD->fn[FUNC_CONTROL],
pLPD->fn[FUNC_ENABLE],
pLPD->fn[FUNC_ENUMDFONTS],
pLPD->fn[FUNC_REALIZEOBJECT],
pLPD->fn[FUNC_EXTTEXTOUT]);
}
static LOADED_PRINTER_DRIVER *FindPrinterDriverFromName(const char *pszDriver)
{
LOADED_PRINTER_DRIVER *pLPD = NULL;
int nDriverSlot = 0;
/* Look to see if the printer driver is already loaded */
while (pLPD == NULL && nDriverSlot < MAX_PRINTER_DRIVERS)
{
LOADED_PRINTER_DRIVER *ptmpLPD;
ptmpLPD = gapLoadedPrinterDrivers[nDriverSlot++];
if (ptmpLPD != NULL)
{
dprintf_win16drv(stddeb, "Comparing %s,%s\n",ptmpLPD->szDriver,pszDriver);
/* Found driver store info, exit loop */
if (lstrcmpi32A(ptmpLPD->szDriver, pszDriver) == 0)
pLPD = ptmpLPD;
}
}
if (pLPD == NULL) printf("Couldn't find driver %s\n", pszDriver);
return pLPD;
}
static LOADED_PRINTER_DRIVER *FindPrinterDriverFromPDEVICE(SEGPTR segptrPDEVICE)
{
LOADED_PRINTER_DRIVER *pLPD = NULL;
/* Find the printer driver associated with this PDEVICE */
/* Each of the PDEVICE structures has a PDEVICE_HEADER structure */
/* just before it */
if (segptrPDEVICE != (SEGPTR)NULL)
{
PDEVICE_HEADER *pPDH = (PDEVICE_HEADER *)
(PTR_SEG_TO_LIN(segptrPDEVICE) - sizeof(PDEVICE_HEADER));
pLPD = pPDH->pLPD;
}
return pLPD;
}
/*
* Load a printer driver, adding it self to the list of loaded drivers.
*/
LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
{
HINSTANCE16 hInst;
LOADED_PRINTER_DRIVER *pLPD = NULL;
int nDriverSlot = 0;
BOOL32 bSlotFound = FALSE;
/* First look to see if driver is loaded */
pLPD = FindPrinterDriverFromName(pszDriver);
if (pLPD != NULL)
{
/* Already loaded so increase usage count */
pLPD->nUsageCount++;
return pLPD;
}
/* Not loaded so try and find an empty slot */
while (!bSlotFound && nDriverSlot < MAX_PRINTER_DRIVERS)
{
if (gapLoadedPrinterDrivers[nDriverSlot] == NULL)
bSlotFound = TRUE;
else
nDriverSlot++;
}
if (!bSlotFound)
{
printf("Too many printers drivers loaded\n");
return NULL;
}
{
char *drvName = malloc(strlen(pszDriver)+5);
strcpy(drvName, pszDriver);
strcat(drvName, ".DRV");
hInst = LoadLibrary16(drvName);
}
dprintf_win16drv(stddeb, "Loaded the library\n");
if (hInst <= 32)
{
/* Failed to load driver */
fprintf(stderr, "Failed to load printer driver %s\n", pszDriver);
}
else
{
HANDLE16 hHandle;
/* Allocate some memory for printer driver info */
pLPD = malloc(sizeof(LOADED_PRINTER_DRIVER));
memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
pLPD->hInst = hInst;
strcpy(pLPD->szDriver,pszDriver);
/* Get DS for the printer module */
pLPD->ds_reg = hInst;
dprintf_win16drv(stddeb, "DS for %s is %x\n", pszDriver, pLPD->ds_reg);
/* Get address of printer driver functions */
GetPrinterDriverFunctions(hInst, pLPD);
/* Set initial usage count */
pLPD->nUsageCount = 1;
/* Create a thunking buffer */
hHandle = GlobalAlloc16(GHND, (1024 * 8));
pLPD->hThunk = hHandle;
pLPD->ThunkBufSegPtr = WIN16_GlobalLock16(hHandle);
pLPD->ThunkBufLimit = pLPD->ThunkBufSegPtr + (1024*8);
/* Update table of loaded printer drivers */
pLPD->nIndex = nDriverSlot;
gapLoadedPrinterDrivers[nDriverSlot] = pLPD;
}
return pLPD;
}
/*
* Thunking utility functions
*/
static BOOL32 AddData(SEGPTR *pSegPtr, const void *pData, int nSize, SEGPTR Limit)
{
BOOL32 bRet = FALSE;
char *pBuffer = PTR_SEG_TO_LIN((*pSegPtr));
char *pLimit = PTR_SEG_TO_LIN(Limit);
if ((pBuffer + nSize) < pLimit)
{
DWORD *pdw = (DWORD *)pSegPtr;
SEGPTR SegPtrOld = *pSegPtr;
SEGPTR SegPtrNew;
dprintf_win16drv(stddeb, "AddData: Copying %d from %p to %p(0x%x)\n", nSize, pData, pBuffer, (UINT32)*pSegPtr);
memcpy(pBuffer, pData, nSize);
SegPtrNew = (SegPtrOld + nSize + 1);
*pdw = (DWORD)SegPtrNew;
}
return bRet;
}
static BOOL32 GetParamData(SEGPTR SegPtrSrc,void *pDataDest, int nSize)
{
char *pSrc = PTR_SEG_TO_LIN(SegPtrSrc);
char *pDest = pDataDest;
dprintf_win16drv(stddeb, "GetParamData: Copying %d from %lx(%lx) to %lx\n", nSize, (DWORD)pSrc, (DWORD)SegPtrSrc, (DWORD)pDataDest);
memcpy(pDest, pSrc, nSize);
return TRUE;
}
/*
* Control (ordinal 3)
*/
INT16 PRTDRV_Control(LPPDEVICE lpDestDev, WORD wfunction, SEGPTR lpInData, SEGPTR lpOutData)
{
/* wfunction == Escape code */
/* lpInData, lpOutData depend on code */
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_Control: %08x 0x%x %08lx %08lx\n", (unsigned int)lpDestDev, wfunction, lpInData, lpOutData);
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP3, lP4;
WORD wP2;
if (pLPD->fn[FUNC_CONTROL] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_Control: Not supported by driver\n");
return 0;
}
lP1 = (SEGPTR)lpDestDev;
wP2 = wfunction;
lP3 = (SEGPTR)lpInData;
lP4 = (SEGPTR)lpOutData;
wRet = CallTo16_word_lwll(pLPD->fn[FUNC_CONTROL],
lP1, wP2, lP3, lP4);
}
dprintf_win16drv(stddeb, "PRTDRV_Control: return %x\n", wRet);
return wRet;
return 0;
}
/*
* Enable (ordinal 5)
*/
WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
LPCSTR lpDeviceName, LPCSTR lpOutputFile, LPVOID lpData)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_Enable: %s %s\n",lpDestDevType, lpOutputFile);
/* Get the printer driver info */
if (wStyle == INITPDEVICE)
{
pLPD = FindPrinterDriverFromPDEVICE((SEGPTR)lpDevInfo);
}
else
{
pLPD = FindPrinterDriverFromName((char *)lpDeviceName);
}
if (pLPD != NULL)
{
LONG lP1, lP3, lP4, lP5;
WORD wP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_ENABLE] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_Enable: Not supported by driver\n");
return 0;
}
if (wStyle == INITPDEVICE)
{
/* All ready a 16 address */
lP1 = (SEGPTR)lpDevInfo;
}
else
{
/* 32 bit data */
lP1 = SegPtr;
nSize = sizeof(DeviceCaps);
AddData(&SegPtr, lpDevInfo, nSize, Limit);
}
wP2 = wStyle;
lP3 = SegPtr;
nSize = strlen(lpDestDevType) + 1;
AddData(&SegPtr, lpDestDevType, nSize, Limit);
lP4 = SegPtr;
nSize = strlen(lpOutputFile) + 1;
AddData(&SegPtr, lpOutputFile, nSize, Limit);
lP5 = (LONG)lpData;
wRet = CallTo16_word_lwlll(pLPD->fn[FUNC_ENABLE],
lP1, wP2, lP3, lP4, lP5);
/* Get the data back */
if (lP1 != 0 && wStyle != INITPDEVICE)
{
nSize = sizeof(DeviceCaps);
GetParamData(lP1, lpDevInfo, nSize);
}
}
dprintf_win16drv(stddeb, "PRTDRV_Enable: return %x\n", wRet);
return wRet;
}
/*
* EnumDFonts (ordinal 6)
*/
WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
FARPROC16 lpCallbackFunc, LPVOID lpClientData)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP2, lP3, lP4;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_ENUMDFONTS] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n");
return 0;
}
lP1 = (SEGPTR)lpDestDev;
if (lpFaceName == NULL)
{
lP2 = 0;
}
else
{
lP2 = SegPtr;
nSize = strlen(lpFaceName) + 1;
AddData(&SegPtr, lpFaceName, nSize, Limit);
}
lP3 = (LONG)lpCallbackFunc;
lP4 = (LONG)lpClientData;
wRet = CallTo16_word_llll(pLPD->fn[FUNC_ENUMDFONTS],
lP1, lP2, lP3, lP4);
}
else
printf("Failed to find device\n");
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet);
return wRet;
}
/*
* EnumObj (ordinal 7)
*/
BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle,
FARPROC16 lpCallbackFunc, LPVOID lpClientData)
{
WORD wRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP3, lP4;
WORD wP2;
if (pLPD->fn[FUNC_ENUMDFONTS] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: Not supported by driver\n");
return 0;
}
lP1 = (SEGPTR)lpDestDev;
wP2 = iStyle;
/*
* Need to pass addres of function conversion function that will switch back to 32 bit code if necessary
*/
lP3 = (LONG)lpCallbackFunc;
lP4 = (LONG)lpClientData;
wRet = CallTo16_word_lwll(pLPD->fn[FUNC_ENUMOBJ],
lP1, wP2, lP3, lP4);
}
else
printf("Failed to find device\n");
dprintf_win16drv(stddeb, "PRTDRV_EnumDFonts: return %x\n", wRet);
return wRet;
}
/*
* RealizeObject (ordinal 10)
*/
DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
LPVOID lpInObj, LPVOID lpOutObj,
LPTEXTXFORM16 lpTextXForm)
{
WORD dwRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP3, lP4, lP5;
WORD wP2;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_REALIZEOBJECT] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: Not supported by driver\n");
return 0;
}
lP1 = lpDestDev;
wP2 = wStyle;
lP3 = SegPtr;
switch (wStyle)
{
case 3:
nSize = sizeof(LOGFONT16);
break;
default:
printf("PRTDRV_RealizeObject: Object type %d not supported\n", wStyle);
nSize = 0;
}
AddData(&SegPtr, lpInObj, nSize, Limit);
lP4 = (LONG)lpOutObj;
if (lpTextXForm != NULL)
{
lP5 = SegPtr;
nSize = sizeof(TEXTXFORM16);
AddData(&SegPtr, lpTextXForm, nSize, Limit);
}
else
lP5 = 0L;
dwRet = CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT],
lP1, wP2, lP3, lP4, lP5);
}
dprintf_win16drv(stddeb, "PRTDRV_RealizeObject: return %x\n", dwRet);
return dwRet;
}
DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
SEGPTR lpFontInfo, LPDRAWMODE lpDrawMode,
LPTEXTXFORM16 lpTextXForm, SHORT *lpCharWidths,
RECT16 * lpOpaqueRect, WORD wOptions)
{
DWORD dwRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut:\n");
if ((pLPD = FindPrinterDriverFromPDEVICE(lpDestDev)) != NULL)
{
LONG lP1, lP4, lP5, lP7, lP8, lP9, lP10, lP11;
WORD wP2, wP3, wP12;
INT16 iP6;
SEGPTR SegPtr = pLPD->ThunkBufSegPtr;
SEGPTR Limit = pLPD->ThunkBufLimit;
int nSize;
if (pLPD->fn[FUNC_EXTTEXTOUT] == NULL)
{
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Not supported by driver\n");
return 0;
}
lP1 = lpDestDev;
wP2 = wDestXOrg;
wP3 = wDestYOrg;
if (lpClipRect != NULL)
{
lP4 = SegPtr;
nSize = sizeof(RECT16);
dprintf_win16drv(stddeb, "Adding lpClipRect\n");
AddData(&SegPtr, lpClipRect, nSize, Limit);
}
else
lP4 = 0L;
if (lpString != NULL)
{
/* TTD WARNING THIS STRING ISNT NULL TERMINATED */
lP5 = SegPtr;
nSize = strlen(lpString);
nSize = abs(wCount);
dprintf_win16drv(stddeb, "Adding string size %d\n",nSize);
AddData(&SegPtr, lpString, nSize, Limit);
}
else
lP5 = 0L;
iP6 = wCount;
/* This should be realized by the driver, so in 16bit data area */
lP7 = lpFontInfo;
if (lpDrawMode != NULL)
{
lP8 = SegPtr;
nSize = sizeof(DRAWMODE);
dprintf_win16drv(stddeb, "adding lpDrawMode\n");
AddData(&SegPtr, lpDrawMode, nSize, Limit);
}
else
lP8 = 0L;
if (lpTextXForm != NULL)
{
lP9 = SegPtr;
nSize = sizeof(TEXTXFORM16);
dprintf_win16drv(stddeb, "Adding TextXForm\n");
AddData(&SegPtr, lpTextXForm, nSize, Limit);
}
else
lP9 = 0L;
if (lpCharWidths != NULL)
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n");
lP10 = 0;
if (lpOpaqueRect != NULL)
{
lP11 = SegPtr;
nSize = sizeof(RECT16);
dprintf_win16drv(stddeb, "Adding opaqueRect\n");
AddData(&SegPtr, lpOpaqueRect, nSize, Limit);
}
else
lP11 = 0L;
wP12 = wOptions;
dprintf_win16drv(stddeb, "Calling exttextout 0x%lx 0x%x 0x%x 0x%lx\n0x%lx 0x%x 0x%lx 0x%lx\n"
"0x%lx 0x%lx 0x%lx 0x%x\n",lP1, wP2, wP3, lP4,
lP5, iP6, lP7, lP8, lP9, lP10,
lP11, wP12);
dwRet = CallTo16_long_lwwllwlllllw(pLPD->fn[FUNC_EXTTEXTOUT],
lP1, wP2, wP3, lP4,
lP5, iP6, lP7, lP8, lP9, lP10,
lP11, wP12);
if (lpDrawMode)
GetParamData(lP8, lpDrawMode, sizeof(DRAWMODE));
}
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
return dwRet;
}

View File

@ -70,13 +70,14 @@ BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, 0);
*/
#ifdef NOTDEF
lpClipRect->left = lprect->left ;
lpClipRect->top = lprect->top;
lpClipRect->right = lprect->right;
lpClipRect->bottom = lprect->bottom;
dprintf_win16drv(stddeb, "WIN16DRV_ExtTextOut Clip rect left %d top %d rigt %d bottom %d\n",
lpClipRect->left,lpClipRect->top,lpClipRect->right,lpClipRect->bottom);
#endif
lpClipRect->left = 0;
lpClipRect->top = 0;
lpClipRect->right = 0x3fc;

View File

@ -1207,12 +1207,24 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
case PATINVERT: /* 0x5a */
if (Options.perfectGraphics) break;
if (!DC_SetupGCForBrush( dcDst )) return TRUE;
XSetFunction( display, dcDst->u.x.gc, GXxor );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
if (DC_SetupGCForBrush( dcDst ))
{
XSetFunction( display, dcDst->u.x.gc, GXxor );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
}
return TRUE;
case 0xa50065:
if (Options.perfectGraphics) break;
if (DC_SetupGCForBrush( dcDst ))
{
XSetFunction( display, dcDst->u.x.gc, GXequiv );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
}
return TRUE;
case SRCCOPY: /* 0xcc */
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{

View File

@ -23,6 +23,33 @@ struct FontStructure {
} FontNames[32];
int FontSize;
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
(((cs)->rbearing|(cs)->lbearing| \
(cs)->ascent|(cs)->descent) == 0))
/*
* CI_GET_CHAR_INFO - return the charinfo struct for the indicated 8bit
* character. If the character is in the column and exists, then return the
* appropriate metrics (note that fonts with common per-character metrics will
* return min_bounds). If none of these hold true, try again with the default
* char.
*/
#define CI_GET_CHAR_INFO(fs,col,def,cs) \
{ \
cs = def; \
if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
if (fs->per_char == NULL) { \
cs = &fs->min_bounds; \
} else { \
cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
if (CI_NONEXISTCHAR(cs)) cs = def; \
} \
} \
}
#define CI_GET_DEFAULT_INFO(fs,cs) \
CI_GET_CHAR_INFO(fs, fs->default_char, NULL, cs)
/***********************************************************************
* X11DRV_FONT_Init
@ -456,3 +483,37 @@ HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont, FONTOBJ * font )
}
return prevHandle;
}
/***********************************************************************
* GetCharWidth32A (GDI32.155)
*/
BOOL32 X11DRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar,
LPINT32 buffer )
{
int i, width;
XFontStruct *xfont;
XCharStruct *cs, *def;
xfont = dc->u.x.font.fstruct;
/* fixed font? */
if (xfont->per_char == NULL)
{
for (i = firstChar; i <= lastChar; i++)
*buffer++ = xfont->max_bounds.width;
return TRUE;
}
CI_GET_DEFAULT_INFO(xfont, def);
for (i = firstChar; i <= lastChar; i++)
{
CI_GET_CHAR_INFO( xfont, i, def, cs );
width = cs ? cs->width : xfont->max_bounds.width;
*buffer++ = MAX( width, 0 );
}
return TRUE;
}

View File

@ -28,6 +28,7 @@ static const DC_FUNCTIONS X11DRV_Funcs =
NULL, /* pExcludeVisRect */
X11DRV_ExtFloodFill, /* pExtFloodFill */
X11DRV_ExtTextOut, /* pExtTextOut */
NULL, /* pGetCharWidth */
X11DRV_GetPixel, /* pGetPixel */
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
X11DRV_GetTextMetrics, /* pGetTextMetrics */

View File

@ -53,7 +53,7 @@ base 1
048 stub _cabs
049 stub _cexit
050 stub _cgets
051 stub _chdir
051 cdecl _chdir(ptr) CRTDLL__chdir
052 cdecl _chdrive(long) CRTDLL__chdrive
053 stub _chgsign
054 stub _chmod
@ -236,7 +236,7 @@ base 1
231 stub _mbsupr
232 stub _memccpy
233 stub _memicmp
234 stub _mkdir
234 cdecl _mkdir(ptr) CRTDLL__mkdir
235 stub _mktemp
236 stub _msize
237 stub _nextafter

View File

@ -162,7 +162,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
193 stub SetBoundsRect
194 stub GetBoundsRect
195 stub SelectBitmap
196 stub SetMetaFileBitsBetter
196 pascal16 SetMetaFileBitsBetter(word) SetMetaFileBitsBetter
201 stub DMBITBLT
202 stub DMCOLORINFO
206 stub DMENUMDFONTS

View File

@ -45,8 +45,8 @@ base 1
0040 stdcall CreateDirectoryExA(ptr ptr ptr) CreateDirectoryEx32A
0041 stdcall CreateDirectoryExW(ptr ptr ptr) CreateDirectoryEx32W
0042 stdcall CreateDirectoryW(ptr ptr) CreateDirectory32W
0043 stdcall CreateEventA(ptr long long ptr) CreateEventA
0044 stub CreateEventW
0043 stdcall CreateEventA(ptr long long ptr) CreateEvent32A
0044 stdcall CreateEventW(ptr long long ptr) CreateEvent32W
0045 stdcall CreateFileA(ptr long long ptr long long long) CreateFile32A
0046 stdcall CreateFileMappingA(long ptr long long long ptr) CreateFileMapping32A
0047 stdcall CreateFileMappingW(long ptr long long long ptr) CreateFileMapping32W
@ -54,16 +54,16 @@ base 1
0049 stub CreateIoCompletionPort
0050 stub CreateMailslotA
0051 stub CreateMailslotW
0052 stdcall CreateMutexA(ptr long ptr) CreateMutexA
0053 stub CreateMutexW
0052 stdcall CreateMutexA(ptr long ptr) CreateMutex32A
0053 stdcall CreateMutexW(ptr long ptr) CreateMutex32W
0054 stub CreateNamedPipeA
0055 stub CreateNamedPipeW
0056 stub CreatePipe
0057 stub CreateProcessA
0057 stdcall CreateProcessA(ptr ptr ptr ptr long long ptr ptr ptr ptr) CreateProcess32A
0058 stub CreateProcessW
0059 stub CreateRemoteThread
0060 stub CreateSemaphoreA
0061 stub CreateSemaphoreW
0060 stdcall CreateSemaphoreA(ptr long long ptr) CreateSemaphore32A
0061 stdcall CreateSemaphoreW(ptr long long ptr) CreateSemaphore32W
0062 stub CreateTapePartition
0063 stdcall CreateThread(ptr long ptr long long ptr) CreateThread
0064 stub CreateVirtualBuffer
@ -134,7 +134,7 @@ base 1
0129 stdcall FindResourceExA(long ptr ptr long) FindResourceEx32A
0130 stdcall FindResourceExW(long ptr ptr long) FindResourceEx32W
0131 stdcall FindResourceW(long ptr ptr) FindResource32W
0132 stub FlushConsoleInputBuffer
0132 stdcall FlushConsoleInputBuffer(long) FlushConsoleInputBuffer
0133 stdcall FlushFileBuffers(long) FlushFileBuffers
0134 stub FlushInstructionCache
0135 stub FlushViewOfFile
@ -362,7 +362,7 @@ base 1
0357 stdcall IsBadWritePtr(ptr long) IsBadWritePtr32
0358 stdcall IsDBCSLeadByte(long) IsDBCSLeadByte32
0359 stdcall IsDBCSLeadByteEx(long long) IsDBCSLeadByteEx
0360 stub IsValidCodePage
0360 stdcall IsValidCodePage(long) IsValidCodePage
0361 stdcall IsValidLocale(long long) IsValidLocale
0362 stub LCMapStringA
0363 stub LCMapStringW
@ -396,17 +396,17 @@ base 1
0391 stdcall MulDiv(long long long) MulDiv32
0392 stdcall MultiByteToWideChar(long long ptr long ptr long) MultiByteToWideChar
0393 stub OpenConsoleW
0394 stub OpenEventA
0395 stub OpenEventW
0394 stdcall OpenEventA(long long ptr) OpenEvent32A
0395 stdcall OpenEventW(long long ptr) OpenEvent32W
0396 stdcall OpenFile(ptr ptr long) OpenFile32
0397 stdcall OpenFileMappingA(long long ptr) OpenFileMapping32A
0398 stdcall OpenFileMappingW(long long ptr) OpenFileMapping32W
0399 stub OpenMutexA
0400 stub OpenMutexW
0399 stdcall OpenMutexA(long long ptr) OpenMutex32A
0400 stdcall OpenMutexW(long long ptr) OpenMutex32W
0401 stub OpenProcess
0402 stub OpenProfileUserMapping
0403 stub OpenSemaphoreA
0404 stub OpenSemaphoreW
0403 stdcall OpenSemaphoreA(long long ptr) OpenSemaphore32A
0404 stdcall OpenSemaphoreW(long long ptr) OpenSemaphore32W
0405 stdcall OutputDebugStringA(ptr) OutputDebugString32A
0406 stub OutputDebugStringW
0407 stub PeekConsoleInputA
@ -438,7 +438,7 @@ base 1
0433 stub RegisterWowBaseHandlers
0434 stub RegisterWowExec
0435 stdcall ReleaseMutex(long) ReleaseMutex
0436 stub ReleaseSemaphore
0436 stdcall ReleaseSemaphore(long long ptr) ReleaseSemaphore
0437 stdcall RemoveDirectoryA(ptr) RemoveDirectory32A
0438 stdcall RemoveDirectoryW(ptr) RemoveDirectory32W
0439 stdcall ResetEvent(long) ResetEvent
@ -665,7 +665,7 @@ base 1
0659 stub SUnMapLS_IP_EBP_8
0660 stub SUnMapLS_IP_EBP_16
0661 stub SUnMapLS_IP_EBP_20
0662 stub MapSL
0662 stdcall MapSL(long) MapSL
0663 stub K32Thk1632Epilog
0664 stub K32Thk1632Prolog
0665 stub GetProcessFlags
@ -680,3 +680,8 @@ base 1
0674 stub FreeSLCallback
0675 stub AllocSLCallback
0676 stub Callback28
0677 stub UninitializeCriticalSection
0678 stub FT_Exit4
0679 stdcall MapLS(ptr) MapLS
0680 stdcall UnMapLS(long) UnMapLS
0681 stub OpenVxDHandle

View File

@ -378,7 +378,7 @@ base 0
374 stdcall RtlFreeHeap(long long long) HeapFree
375 stub RtlFreeOemString
376 stub RtlFreeSid
377 stub RtlFreeUnicodeString
377 stdcall RtlFreeUnicodeString(ptr) RtlFreeUnicodeString
378 stub RtlGenerate8dot3Name
379 stub RtlGetAce
380 stub RtlGetCallersAddress
@ -508,7 +508,7 @@ base 0
504 stub RtlTimeToSecondsSince1980
505 stub RtlTimeToTimeFields
506 stub RtlUnicodeStringToAnsiSize
507 stub RtlUnicodeStringToAnsiString
507 stdcall RtlUnicodeStringToAnsiString(ptr ptr long) RtlUnicodeStringToAnsiString
508 stub RtlUnicodeStringToCountedOemString
509 stub RtlUnicodeStringToInteger
510 stub RtlUnicodeStringToOemSize

View File

@ -41,7 +41,7 @@ type win16
# 264 SH16TO32INT2526
# 300 SHGETFILEINFO
# 400 SHFORMATDRIVE
# 401 SHCHECKDRIVE
401 stub SHCHECKDRIVE
# 402 _RUNDLLCHECKDRIVE
# 8 WEP

View File

@ -171,7 +171,7 @@ heap 65520
169 pascal16 GetCaretBlinkTime() GetCaretBlinkTime16
170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows16
171 pascal16 WinHelp(word ptr word long) WinHelp16
172 stub SwitchToThisWindow
172 pascal16 SwitchToThisWindow(word word) SwitchToThisWindow16
173 pascal16 LoadCursor(word segptr) LoadCursor16
174 pascal16 LoadIcon(word segptr) LoadIcon16
175 pascal16 LoadBitmap(word segptr) LoadBitmap16
@ -297,7 +297,7 @@ heap 65520
291 pascal SetWindowsHookEx(s_word segptr word word) THUNK_SetWindowsHookEx16
292 pascal16 UnhookWindowsHookEx(segptr) THUNK_UnhookWindowsHookEx16
293 pascal CallNextHookEx(segptr s_word word long) CallNextHookEx16
294 stub LockWindowUpdate
294 pascal16 LockWindowUpdate(word) LockWindowUpdate16
299 register Mouse_Event() Mouse_Event
300 stub UnloadInstalledDrivers
#301 BOZOSLIVEHERE :-)) <- this is actually EditWndProc

View File

@ -381,7 +381,7 @@ base 1
0374 stdcall LoadStringA(long long ptr long) LoadString32A
0375 stdcall LoadStringW(long long ptr long) LoadString32W
0376 stub LockWindowStation
0377 stub LockWindowUpdate
0377 stdcall LockWindowUpdate(long) LockWindowUpdate32
0378 stub LookupIconIdFromDirectory
0379 stub LookupIconIdFromDirectoryEx
0380 stub MBToWCSEx
@ -542,7 +542,7 @@ base 1
0535 stdcall SubtractRect(ptr ptr ptr) SubtractRect32
0536 stdcall SwapMouseButton(long) SwapMouseButton32
0537 stub SwitchDesktop
0538 stub SwitchToThisWindow
0538 stdcall SwitchToThisWindow(long long) SwitchToThisWindow32
0539 stdcall SystemParametersInfoA(long long ptr long) SystemParametersInfo32A
0540 stdcall SystemParametersInfoW(long long ptr long) SystemParametersInfo32W
0541 stdcall TabbedTextOutA(long long long ptr long long ptr long) TabbedTextOut32A
@ -605,3 +605,4 @@ base 1
0597 stub ToUnicodeEx
0598 stub DrawCaptionTempA
0599 stub RegisterNetworkCapabilities
0600 stub WNDPROC_CALLBACK

View File

@ -4,7 +4,6 @@ type win16
1 pascal WINPROC_CallProc16To32A(word word word long long) WINPROC_CallProc16To32A
2 pascal StaticWndProc(word word word long) StaticWndProc
3 pascal ScrollBarWndProc(word word word long) ScrollBarWndProc
5 pascal ComboBoxWndProc(word word word long) ComboBoxWndProc
10 pascal MDIClientWndProc(word word word long) MDIClientWndProc
14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc
15 pascal FileSaveDlgProc(word word word long) FileSaveDlgProc
@ -13,7 +12,6 @@ type win16
18 pascal ReplaceTextDlgProc(word word word long) ReplaceTextDlgProc
19 pascal PrintSetupDlgProc(word word word long) PrintSetupDlgProc
20 pascal PrintDlgProc(word word word long) PrintDlgProc
22 pascal ComboLBoxWndProc(word word word long) ComboLBoxWndProc
24 pascal16 TASK_Reschedule() TASK_Reschedule
27 pascal EntryAddrProc(word word) MODULE_GetEntryPoint
28 pascal MyAlloc(word word word) MODULE_AllocateSegment

View File

@ -2,20 +2,55 @@
* Combo box definitions
*/
#ifndef __WINE_COMBO_H
#define __WINE_COMBO_H
typedef struct {
WND* wndSelf;
DWORD dwStyle;
DWORD dwState;
HWND16 hWndEdit;
HWND16 hWndLBox;
WORD LBoxTop;
BOOL16 DropDownVisible;
short LastSel;
RECT16 RectEdit;
RECT16 RectButton;
BOOL16 bRedrawFlag;
#define ID_CB_LISTBOX 1000
#define ID_CB_EDIT 1001
/* Internal flags */
#define CBF_DROPPED 0x0001
#define CBF_BUTTONDOWN 0x0002
#define CBF_NOROLLUP 0x0004
#define CBF_MEASUREITEM 0x0008
#define CBF_FOCUSED 0x0010
#define CBF_CAPTURE 0x0020
#define CBF_EDIT 0x0040
#define CBF_NORESIZE 0x0080
#define CBF_EUI 0x8000
/* Combo state struct */
typedef struct
{
WND* self;
HWND32 owner;
UINT32 dwStyle;
HWND32 hWndEdit;
HWND32 hWndLBox;
UINT16 wState;
HFONT16 hFont;
RECT16 RectCombo;
RECT16 RectEdit;
RECT16 RectButton;
INT32 droppedWidth; /* last two are not used unless set */
INT32 editHeight; /* explicitly */
} HEADCOMBO,*LPHEADCOMBO;
LRESULT ComboBoxWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lParam);
LRESULT ComboLBoxWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lParam);
/*
* Note, that CBS_DROPDOWNLIST style is actually (CBS_SIMPLE | CBS_DROPDOWN)!
*/
#define CB_GETTYPE( lphc ) ((lphc)->dwStyle & (CBS_DROPDOWNLIST))
#define CB_DISABLED( lphc ) ((lphc)->self->dwStyle & WS_DISABLED)
#define CB_OWNERDRAWN( lphc ) ((lphc)->dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE))
#define CB_HASSTRINGS( lphc ) ((lphc)->dwStyle & CBS_HASSTRINGS)
#define CB_HWND( lphc ) ((lphc)->self->hwndSelf)
BOOL32 COMBO_FlipListbox( LPHEADCOMBO, BOOL32 );
HWND32 COMBO_GetLBWindow( WND* );
LRESULT COMBO_Directory( LPHEADCOMBO, UINT32, LPSTR, BOOL32 );
#endif /* __WINE_COMBO_H */

View File

@ -28,15 +28,17 @@ typedef struct
HWND16 hwndFocus; /* Current control with focus */
HFONT16 hUserFont; /* Dialog font */
HMENU16 hMenu; /* Dialog menu */
WORD xBaseUnit; /* Dialog units (depends on the font) */
WORD yBaseUnit;
UINT16 xBaseUnit; /* Dialog units (depends on the font) */
UINT16 yBaseUnit;
INT32 idResult; /* EndDialog() result / default pushbutton ID */
WORD fEnd; /* EndDialog() called for this dialog */
UINT16 flags; /* EndDialog() called for this dialog */
HGLOBAL16 hDialogHeap;
} DIALOGINFO;
#pragma pack(4)
#define DF_END 0x0001
extern BOOL32 DIALOG_Init(void);
extern HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
BOOL32 win32Template, HWND32 owner,

View File

@ -158,6 +158,7 @@ typedef struct tagDC_FUNCS
INT32 (*pExcludeVisRect)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pExtFloodFill)(DC*,INT32,INT32,COLORREF,UINT32);
BOOL32 (*pExtTextOut)(DC*,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*);
BOOL32 (*pGetCharWidth)(DC*,UINT32,UINT32,LPINT32);
COLORREF (*pGetPixel)(DC*,INT32,INT32);
BOOL32 (*pGetTextExtentPoint)(DC*,LPCSTR,INT32,LPSIZE32);
BOOL32 (*pGetTextMetrics)(DC*,TEXTMETRIC32A*);

View File

@ -13,8 +13,13 @@
extern void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect,
INT32 highlight_size, INT32 shadow_size,
BOOL32 pressed );
extern BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen);
extern void GRAPH_DrawRectangle( HDC32 hdc, INT32 x, INT32 y,
INT32 width, INT32 height, HPEN32 hPen);
extern BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
int xdest, int ydest, int xsrc, int ysrc,
int width, int height );
INT32 xdest, INT32 ydest, INT32 xsrc,
INT32 ysrc, INT32 width, INT32 height );
extern BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMono,
INT32 x, INT32 y );
#endif /* __WINE_GRAPHICS_H */

View File

@ -24,7 +24,8 @@ typedef enum
LANG_It, /* Italian */
LANG_Ko, /* Korean */
LANG_Hu, /* Hungarian */
LANG_Pl /* Polish */
LANG_Pl, /* Polish */
LANG_Po /* Portuguese */
} WINE_LANGUAGE;
typedef struct

View File

@ -23,15 +23,15 @@ typedef struct pe_data PE_MODULE;
extern int PE_unloadImage(HMODULE32 hModule);
extern FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName);
extern void my_wcstombs(char * result, u_short * source, int len);
extern PE_EnumResourceTypes32A(HMODULE32,ENUMRESTYPEPROC32A,LONG);
extern PE_EnumResourceTypes32W(HMODULE32,ENUMRESTYPEPROC32W,LONG);
extern PE_EnumResourceNames32A(HMODULE32,LPCSTR,ENUMRESNAMEPROC32A,LONG);
extern PE_EnumResourceNames32W(HMODULE32,LPCWSTR,ENUMRESNAMEPROC32W,LONG);
extern PE_EnumResourceLanguages32A(HMODULE32,LPCSTR,LPCSTR,ENUMRESLANGPROC32A,LONG);
extern PE_EnumResourceLanguages32W(HMODULE32,LPCWSTR,LPCWSTR,ENUMRESLANGPROC32W,LONG);
extern BOOL32 PE_EnumResourceTypes32A(HMODULE32,ENUMRESTYPEPROC32A,LONG);
extern BOOL32 PE_EnumResourceTypes32W(HMODULE32,ENUMRESTYPEPROC32W,LONG);
extern BOOL32 PE_EnumResourceNames32A(HMODULE32,LPCSTR,ENUMRESNAMEPROC32A,LONG);
extern BOOL32 PE_EnumResourceNames32W(HMODULE32,LPCWSTR,ENUMRESNAMEPROC32W,LONG);
extern BOOL32 PE_EnumResourceLanguages32A(HMODULE32,LPCSTR,LPCSTR,ENUMRESLANGPROC32A,LONG);
extern BOOL32 PE_EnumResourceLanguages32W(HMODULE32,LPCWSTR,LPCWSTR,ENUMRESLANGPROC32W,LONG);
extern HRSRC32 PE_FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD);
extern DWORD PE_SizeofResource32(HINSTANCE32,HRSRC32);
extern HGLOBAL32 PE_LoadResource32(HINSTANCE32,HRSRC32);
extern void PE_InitializeDLLs(HMODULE16);
extern void PE_InitializeDLLs(HMODULE16,DWORD,LPVOID);
#endif /* __WINE_PE_IMAGE_H */

View File

@ -28,6 +28,21 @@
#define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */
#define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */
/* Built-in 32-bit classes */
typedef enum
{
BIC32_BUTTON,
BIC32_EDIT,
BIC32_LISTBOX,
BIC32_COMBO,
BIC32_COMBOLB,
BIC32_POPUPMENU,
BIC32_SCROLL,
BIC32_DESKTOP,
BIC32_DIALOG,
BIC32_NB_CLASSES
} BUILTIN_CLASS32;
/* PAINT_RedrawWindow() control flags */
#define RDW_C_USEHRGN 0x0001
#define RDW_C_DELETEHRGN 0x0002
@ -108,6 +123,8 @@ extern BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate,
HRGN32 hrgnUpdate, UINT32 flags,
UINT32 control ); /* windows/painting.c */
extern BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls ); /* controls/widgets.c */
extern Display * display;
extern Screen * screen;
extern Window rootWindow;

View File

@ -152,8 +152,34 @@ typedef struct
SEGPTR segptrFontInfo; /* Current font realized by printer driver */
} WIN16DRV_PDEVICE;
/*
* Printer driver functions
*/
typedef SEGPTR LPPDEVICE;
LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver);
extern INT16 PRTDRV_Control(LPPDEVICE lpDestDev, WORD wfunction, SEGPTR lpInData, SEGPTR lpOutData);
extern WORD PRTDRV_Enable(LPVOID lpDevInfo, WORD wStyle, LPCSTR lpDestDevType,
LPCSTR lpDeviceName, LPCSTR lpOutputFile, LPVOID lpData);
extern WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
FARPROC16 lpCallbackFunc, LPVOID lpClientData);
extern DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
LPVOID lpInObj, LPVOID lpOutObj,
LPTEXTXFORM16 lpTextXForm);
extern BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle, FARPROC16 lpfn, LPVOID lpb);
extern DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
SEGPTR lpFontInfo, LPDRAWMODE lpDrawMode,
LPTEXTXFORM16 lpTextXForm, SHORT *lpCharWidths,
RECT16 * lpOpaqueRect, WORD wOptions);
/* Wine driver functions */
extern BOOL32 WIN16DRV_GetCharWidth( struct tagDC *dc, UINT32 firstChar, UINT32 lastChar,
LPINT32 buffer );
extern BOOL32 WIN16DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
LPSIZE32 size );
extern BOOL32 WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRIC32A *metrics );
@ -164,4 +190,5 @@ extern BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
extern HGDIOBJ32 WIN16DRV_SelectObject( DC *dc, HGDIOBJ32 handle );
#endif /* __WINE_WIN16DRV_H */

View File

@ -3300,6 +3300,10 @@ typedef struct
#define CBS_NOINTEGRALHEIGHT 0x0400L
#define CBS_DISABLENOSCROLL 0x0800L
#define CBS_UPPERCASE 0x2000L
#define CBS_LOWERCASE 0x4000L
/* Combo box messages */
#define CB_GETEDITSEL16 (WM_USER+0)
#define CB_GETEDITSEL32 0x0140
@ -4777,6 +4781,10 @@ DECL_WINELIB_TYPE_AW(ENUMRESLANGPROC);
#define C3_ALPHA 0x8000
#define C3_NOTAPPLICABLE 0x0000
/* flags that can be passed to LoadLibraryEx */
#define DONT_RESOLVE_DLL_REFERENCES 0x00000001
#define LOAD_LIBRARY_AS_DATAFILE 0x00000002
#define LOAD_WITH_ALTERED_SEARCH_PATH 0x00000008
#pragma pack(4)
@ -4918,7 +4926,6 @@ VOID hmemcpy(LPVOID,LPCVOID,LONG);
VOID Yield(void);
/* Declarations for functions that exist only in Win32 */
BOOL32 Beep(DWORD,DWORD);
BOOL32 ClearCommError(INT32,LPDWORD,LPCOMSTAT);
BOOL32 CloseHandle(HANDLE32);
@ -4926,12 +4933,21 @@ BOOL32 CopyFile32A(LPCSTR,LPCSTR,BOOL32);
BOOL32 CopyFile32W(LPCWSTR,LPCWSTR,BOOL32);
#define CopyFile WINELIB_NAME_AW(CopyFile)
INT32 CompareFileTime(LPFILETIME,LPFILETIME);
HANDLE32 CreateEvent32A(LPSECURITY_ATTRIBUTES,BOOL32,BOOL32,LPCSTR);
HANDLE32 CreateEvent32W(LPSECURITY_ATTRIBUTES,BOOL32,BOOL32,LPCWSTR);
#define CreateEvent WINELIB_NAME_AW(CreateEvent)
HFILE32 CreateFile32A(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
HFILE32 CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
#define CreateFile WINELIB_NAME_AW(CreateFile)
HANDLE32 CreateFileMapping32A(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
HANDLE32 CreateFileMapping32W(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCWSTR);
#define CreateFileMapping WINELIB_NAME_AW(CreateFileMapping)
HANDLE32 CreateMutex32A(LPSECURITY_ATTRIBUTES,BOOL32,LPCSTR);
HANDLE32 CreateMutex32W(LPSECURITY_ATTRIBUTES,BOOL32,LPCWSTR);
#define CreateMutex WINELIB_NAME_AW(CreateMutex)
HANDLE32 CreateSemaphore32A(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCSTR);
HANDLE32 CreateSemaphore32W(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR);
#define CreateSemaphore WINELIB_NAME_AW(CreateSemaphore)
BOOL32 DosDateTimeToFileTime(WORD,WORD,LPFILETIME);
INT32 EnumPropsEx32A(HWND32,PROPENUMPROCEX32A,LPARAM);
INT32 EnumPropsEx32W(HWND32,PROPENUMPROCEX32W,LPARAM);
@ -5024,6 +5040,8 @@ BOOL32 IsDBCSLeadByteEx(UINT32,BYTE);
BOOL32 IsWindowUnicode(HWND32);
BOOL32 IsValidLocale(DWORD,DWORD);
BOOL32 LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
SEGPTR MapLS(LPVOID);
LPVOID MapSL(SEGPTR);
LPVOID MapViewOfFile(HANDLE32,DWORD,DWORD,DWORD,DWORD);
LPVOID MapViewOfFileEx(HANDLE32,DWORD,DWORD,DWORD,DWORD,LPVOID);
INT32 MessageBoxEx32A(HWND32,LPCSTR,LPCSTR,UINT32,WORD);
@ -5032,9 +5050,18 @@ INT32 MessageBoxEx32W(HWND32,LPCWSTR,LPCWSTR,UINT32,WORD);
BOOL32 MoveFile32A(LPCSTR,LPCSTR);
BOOL32 MoveFile32W(LPCWSTR,LPCWSTR);
#define MoveFile WINELIB_NAME_AW(MoveFile)
HANDLE32 OpenEvent32A(DWORD,BOOL32,LPCSTR);
HANDLE32 OpenEvent32W(DWORD,BOOL32,LPCWSTR);
#define OpenEvent WINELIB_NAME_AW(OpenEvent)
HANDLE32 OpenFileMapping32A(DWORD,BOOL32,LPCSTR);
HANDLE32 OpenFileMapping32W(DWORD,BOOL32,LPCWSTR);
#define OpenFileMapping WINELIB_NAME_AW(OpenFileMapping)
HANDLE32 OpenMutex32A(DWORD,BOOL32,LPCSTR);
HANDLE32 OpenMutex32W(DWORD,BOOL32,LPCWSTR);
#define OpenMutex WINELIB_NAME_AW(OpenMutex)
HANDLE32 OpenSemaphore32A(DWORD,BOOL32,LPCSTR);
HANDLE32 OpenSemaphore32W(DWORD,BOOL32,LPCWSTR);
#define OpenSemaphore WINELIB_NAME_AW(OpenSemaphore)
DWORD QueryDosDevice32A(LPCSTR,LPSTR,DWORD);
DWORD QueryDosDevice32W(LPCWSTR,LPWSTR,DWORD);
#define QueryDosDevice WINELIB_NAME_AW(QueryDosDevice)
@ -5059,6 +5086,7 @@ DWORD RegQueryInfoKey32W(HKEY,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD,
DWORD RegQueryInfoKey32A(HKEY,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD,
LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPFILETIME);
#define RegQueryInfoKey WINELIB_NAME_AW(RegQueryInfoKey)
BOOL32 ReleaseSemaphore(HANDLE32,LONG,LPLONG);
VOID RtlFillMemory(LPVOID,UINT32,UINT32);
VOID RtlMoveMemory(LPVOID,LPCVOID,UINT32);
VOID RtlZeroMemory(LPVOID,UINT32);
@ -5091,6 +5119,7 @@ DWORD TlsAlloc(void);
BOOL32 TlsFree(DWORD);
LPVOID TlsGetValue(DWORD);
BOOL32 TlsSetValue(DWORD,LPVOID);
VOID UnMapLS(SEGPTR);
BOOL32 UnmapViewOfFile(LPVOID);
LPVOID VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
BOOL32 VirtualFree(LPVOID,DWORD,DWORD);
@ -6474,6 +6503,9 @@ LPVOID LockResource32(HGLOBAL32);
HGLOBAL16 LockSegment16(HGLOBAL16);
#define LockSegment32(handle) GlobalFix32((HANDLE32)(handle))
#define LockSegment WINELIB_NAME(LockSegment)
BOOL16 LockWindowUpdate16(HWND16);
BOOL32 LockWindowUpdate32(HWND32);
#define LockWindowUpdate WINELIB_NAME(LockWindowUpdate)
BOOL16 LPtoDP16(HDC16,LPPOINT16,INT16);
BOOL32 LPtoDP32(HDC32,LPPOINT32,INT32);
#define LPtoDP WINELIB_NAME(LPtoDP)
@ -7051,6 +7083,9 @@ BOOL32 SubtractRect32(LPRECT32,const RECT32*,const RECT32*);
BOOL16 SwapMouseButton16(BOOL16);
BOOL32 SwapMouseButton32(BOOL32);
#define SwapMouseButton WINELIB_NAME(SwapMouseButton)
VOID SwitchToThisWindow16(HWND16,BOOL16);
VOID SwitchToThisWindow32(HWND32,BOOL32);
#define SwitchToThisWindow WINELIB_NAME(SwitchToThisWindow)
INT16 SyncAllVoices16(void);
DWORD SyncAllVoices32(void);
#define SyncAllVoices WINELIB_NAME(SyncAllVoices)

View File

@ -17,13 +17,20 @@ typedef enum
WIN_PROC_32W
} WINDOWPROCTYPE;
typedef enum
{
WIN_PROC_CLASS,
WIN_PROC_WINDOW,
WIN_PROC_TIMER
} WINDOWPROCUSER;
typedef void *HWINDOWPROC; /* Really a pointer to a WINDOWPROC */
extern BOOL32 WINPROC_Init(void);
extern WNDPROC16 WINPROC_GetProc( HWINDOWPROC proc, WINDOWPROCTYPE type );
extern BOOL32 WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
WINDOWPROCTYPE type );
extern void WINPROC_FreeProc( HWINDOWPROC proc );
WINDOWPROCTYPE type, WINDOWPROCUSER user );
extern void WINPROC_FreeProc( HWINDOWPROC proc, WINDOWPROCUSER user );
extern WINDOWPROCTYPE WINPROC_GetProcType( HWINDOWPROC proc );
extern INT32 WINPROC_MapMsg32ATo32W( UINT32 msg, WPARAM32 wParam,
@ -51,8 +58,8 @@ extern void WINPROC_UnmapMsg16To32A( UINT32 msg, WPARAM32 wParam,
extern void WINPROC_UnmapMsg16To32W( UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam,
LPARAM lParam );
LPARAM lParam, LRESULT lResult );
extern void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM16 wParam,
LPARAM lParam );
LPARAM lParam, LRESULT lResult );
#endif /* __WINE_WINPROC_H */

View File

@ -53,6 +53,8 @@ struct tagDC;
extern BOOL32 X11DRV_BitBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst,
INT32 width, INT32 height, struct tagDC *dcSrc,
INT32 xSrc, INT32 ySrc, DWORD rop );
extern BOOL32 X11DRV_GetCharWidth( struct tagDC *dc, UINT32 firstChar,
UINT32 lastChar, LPINT32 buffer );
extern BOOL32 X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
INT32 count, LPSIZE32 size );
extern BOOL32 X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRIC32A *metrics);

View File

@ -46,8 +46,6 @@ int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
}
extern LRESULT ColorDlgProc(HWND16,UINT16,WPARAM16,LPARAM);
extern LRESULT ComboBoxWndProc(HWND16,UINT16,WPARAM16,LPARAM);
extern LRESULT ComboLBoxWndProc(HWND16,UINT16,WPARAM16,LPARAM);
extern LRESULT FileOpenDlgProc(HWND16,UINT16,WPARAM16,LPARAM);
extern LRESULT FileSaveDlgProc(HWND16,UINT16,WPARAM16,LPARAM);
extern LRESULT FindTextDlgProc(HWND16,UINT16,WPARAM16,LPARAM);
@ -68,8 +66,6 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name )
{
#define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return (FARPROC16)proc
MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc);
MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc);
MAP_STR_TO_PROC("ComboLBoxWndProc",ComboLBoxWndProc);
MAP_STR_TO_PROC("FileOpenDlgProc",FileOpenDlgProc);
MAP_STR_TO_PROC("FileSaveDlgProc",FileSaveDlgProc);
MAP_STR_TO_PROC("FindTextDlgProc",FindTextDlgProc);

View File

@ -60,7 +60,9 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum )
dprintf_module( stddeb, "Loading segment %d, selector=%04x\n",
segnum, pSeg->selector );
lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
size = pSeg->size ? pSeg->size : 0x10000;
if (pSeg->size) size = pSeg->size;
else if (pSeg->minsize) size = pSeg->minsize;
else size = 0x10000;
mem = GlobalLock16(pSeg->selector);
if (pModule->flags & NE_FFLAGS_SELFLOAD && segnum > 1)
{
@ -236,7 +238,7 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum )
break;
case NE_RELTYPE_INTERNAL:
if (rep->target1 == 0x00ff)
if ((rep->target1 & 0xff) == 0xff)
{
address = MODULE_GetEntryPoint( hModule, rep->target2 );
}

View File

@ -32,6 +32,9 @@
#include "debugger.h"
#include "xmalloc.h"
static void PE_InitDLL(HMODULE16 hModule, DWORD type, LPVOID lpReserved);
/* convert PE image VirtualAddress to Real Address */
#define RVA(x) ((unsigned int)load_addr+(unsigned int)(x))
@ -406,8 +409,7 @@ problem needs to be fixed properly at some stage */
load_addr = pe->load_addr = (int)xmalloc(pe->vma_size);
memset( load_addr, 0, pe->vma_size);
#else
load_addr = (int) VirtualAlloc( NULL, pe->vma_size, MEM_COMMIT,
PAGE_EXECUTE_READWRITE );
load_addr = (int) VirtualAlloc( (void*)pe->base_addr, pe->vma_size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE );
pe->load_addr = load_addr;
#endif
@ -601,7 +603,12 @@ int PE_UnloadImage( HMODULE16 hModule )
return 1;
}
static void PE_InitDLL(HMODULE16 hModule)
/* Called if the library is loaded or freed.
* NOTE: if a thread attaches a DLL, the current thread will only do
* DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH
* (SDK)
*/
static void PE_InitDLL(HMODULE16 hModule, DWORD type,LPVOID lpReserved)
{
NE_MODULE *pModule;
PE_MODULE *pe;
@ -612,8 +619,11 @@ static void PE_InitDLL(HMODULE16 hModule)
if (!(pModule->flags & NE_FFLAGS_WIN32) || !(pe = pModule->pe_module))
return;
/* FIXME: What is the correct value for parameter 3?
* (the MSDN library JAN96 says 'reserved for future use')
/* DLL_ATTACH_PROCESS:
* lpreserved is NULL for dynamic loads, not-NULL for static loads
* DLL_DETACH_PROCESS:
* lpreserved is NULL if called by FreeLibrary, not-NULL otherwise
* the SDK doesn't mention anything for DLL_THREAD_*
*/
/* Is this a library? And has it got an entrypoint? */
@ -625,13 +635,13 @@ static void PE_InitDLL(HMODULE16 hModule)
CallDLLEntryProc32(
(FARPROC32)RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint),
hModule,
DLL_PROCESS_ATTACH,
-1
type,
(DWORD)lpReserved
);
}
}
void PE_InitializeDLLs(HMODULE16 hModule)
void PE_InitializeDLLs(HMODULE16 hModule,DWORD type,LPVOID lpReserved)
{
NE_MODULE *pModule;
HMODULE16 *pDLL;
@ -640,14 +650,15 @@ void PE_InitializeDLLs(HMODULE16 hModule)
{
HGLOBAL16 to_init = pModule->dlls_to_init;
pModule->dlls_to_init = 0;
for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++)
{
PE_InitializeDLLs( *pDLL );
PE_InitDLL( *pDLL );
PE_InitializeDLLs( *pDLL, type, lpReserved);
PE_InitDLL( *pDLL, type, lpReserved );
}
GlobalFree16( to_init );
}
PE_InitDLL( hModule );
PE_InitDLL( hModule, type, lpReserved );
}
void PE_InitTls( PE_MODULE *module )

View File

@ -1,7 +1,11 @@
#ifndef WINELIB
#include <stdio.h>
#include <stdlib.h>
#ifdef __GLIBC__
#include <linux/signal.h>
#else
#include <signal.h>
#endif
#include <string.h>
#include <errno.h>
#include <time.h>

View File

@ -365,7 +365,7 @@ static void TASK_CallToStart(void)
InitTask( NULL );
InitApp( pTask->hModule );
__asm__ __volatile__("movw %w0,%%fs"::"r" (pCurrentThread->teb_sel));
PE_InitializeDLLs( pTask->hModule );
PE_InitializeDLLs( pTask->hModule, DLL_PROCESS_ATTACH, (LPVOID)-1 );
exit_code = CallTaskStart32((FARPROC32)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint) );
TASK_KillCurrentTask( exit_code );

View File

@ -794,7 +794,11 @@ BOOL16 MemManInfo( MEMMANINFO *info )
{
MEMORYSTATUS status;
if (info->dwSize < sizeof(MEMMANINFO)) return FALSE;
/*
* Not unsurprisingly although the documention says you
* _must_ provide the size in the dwSize field, this function
* (under Windows) always fills the structure and returns true.
*/
GlobalMemoryStatus( &status );
#ifdef __svr4__
info->wPageSize = sysconf(_SC_PAGESIZE);

View File

@ -462,3 +462,43 @@ DWORD MemoryWrite( WORD sel, DWORD offset, void *buffer, DWORD count )
memcpy( ((char *)GET_SEL_BASE(sel)) + offset, buffer, count );
return count;
}
/************************************* Win95 pointer mapping functions *
*
* NOTE: MapSLFix and UnMapSLFixArray are probably needed to prevent
* unexpected linear address change when GlobalCompact() shuffles
* moveable blocks.
*/
/***********************************************************************
* MapSL (KERNEL32.662)
*
* Maps fixed segmented pointer to linear.
*/
LPVOID MapSL( SEGPTR sptr )
{
return (LPVOID)PTR_SEG_TO_LIN(sptr);
}
/***********************************************************************
* MapLS (KERNEL32.679)
*
* Maps linear pointer to segmented.
*/
SEGPTR MapLS( LPVOID ptr )
{
WORD sel = SELECTOR_AllocBlock( ptr, 0x10000, SEGMENT_DATA, FALSE, FALSE );
return PTR_SEG_OFF_TO_SEGPTR( sel, 0 );
}
/***********************************************************************
* UnMapLS (KERNEL32.680)
*
* Free mapped selector.
*/
void UnMapLS( SEGPTR sptr )
{
if (!__winelib) SELECTOR_FreeBlock( SELECTOROF(sptr), 1 );
}

View File

@ -874,6 +874,8 @@ HANDLE32 CreateFileMapping32A( HFILE32 hFile, LPSECURITY_ATTRIBUTES attr,
}
if (!(mapping = HeapAlloc( SystemHeap, 0, sizeof(*mapping) ))) goto error;
mapping->header.type = K32OBJ_MEM_MAPPED_FILE;
mapping->header.refcount = 1;
mapping->protect = VIRTUAL_GetProt( protect ) | VPROT_COMMITTED;
mapping->size_high = size_high;
mapping->size_low = size_low;

View File

@ -75,7 +75,7 @@ static CLIPFORMAT ClipFormats[16] = {
/**************************************************************************
* CLIPBOARD_CheckSelection
*/
void CLIPBOARD_CheckSelection(WND* pWnd)
static void CLIPBOARD_CheckSelection(WND* pWnd)
{
dprintf_clipboard(stddeb,"\tchecking %08x\n", (unsigned)pWnd->window);
@ -141,7 +141,7 @@ void CLIPBOARD_DisOwn(WND* pWnd)
/**************************************************************************
* CLIPBOARD_DeleteRecord
*/
void CLIPBOARD_DeleteRecord(LPCLIPFORMAT lpFormat)
static void CLIPBOARD_DeleteRecord(LPCLIPFORMAT lpFormat, BOOL32 bChange)
{
if( lpFormat->wFormatID >= CF_GDIOBJFIRST &&
lpFormat->wFormatID <= CF_GDIOBJLAST )
@ -152,13 +152,13 @@ void CLIPBOARD_DeleteRecord(LPCLIPFORMAT lpFormat)
lpFormat->wDataPresent = 0;
lpFormat->hData = 0;
bClipChanged = TRUE;
if( bChange ) bClipChanged = TRUE;
}
/**************************************************************************
* CLIPBOARD_RequestXSelection
*/
BOOL32 CLIPBOARD_RequestXSelection()
static BOOL32 CLIPBOARD_RequestXSelection()
{
HWND32 hWnd = (hWndClipWindow) ? hWndClipWindow : GetActiveWindow32();
@ -291,7 +291,7 @@ BOOL32 EmptyClipboard32(void)
while(lpFormat)
{
if ( lpFormat->wDataPresent || lpFormat->hData )
CLIPBOARD_DeleteRecord( lpFormat );
CLIPBOARD_DeleteRecord( lpFormat, TRUE );
lpFormat = lpFormat->NextFormat;
}
@ -368,16 +368,16 @@ HANDLE16 SetClipboardData16( UINT16 wFormat, HANDLE16 hData )
if ( lpFormat->wDataPresent || lpFormat->hData )
{
CLIPBOARD_DeleteRecord(lpFormat);
CLIPBOARD_DeleteRecord(lpFormat, TRUE);
/* delete existing CF_TEXT/CF_OEMTEXT aliases */
if( wFormat == CF_TEXT && ClipFormats[CF_OEMTEXT-1].hData
&& !ClipFormats[CF_OEMTEXT-1].wDataPresent )
CLIPBOARD_DeleteRecord(&ClipFormats[CF_OEMTEXT-1]);
CLIPBOARD_DeleteRecord(&ClipFormats[CF_OEMTEXT-1], TRUE);
if( wFormat == CF_OEMTEXT && ClipFormats[CF_TEXT-1].hData
&& !ClipFormats[CF_TEXT-1].wDataPresent )
CLIPBOARD_DeleteRecord(&ClipFormats[CF_TEXT-1]);
CLIPBOARD_DeleteRecord(&ClipFormats[CF_TEXT-1], TRUE);
}
bClipChanged = TRUE;
@ -401,7 +401,7 @@ HANDLE32 SetClipboardData32( UINT32 wFormat, HANDLE32 hData )
/**************************************************************************
* CLIPBOARD_RenderFormat
*/
BOOL32 CLIPBOARD_RenderFormat(LPCLIPFORMAT lpFormat)
static BOOL32 CLIPBOARD_RenderFormat(LPCLIPFORMAT lpFormat)
{
if( lpFormat->wDataPresent && !lpFormat->hData )
if( IsWindow32(hWndClipOwner) )
@ -420,7 +420,7 @@ BOOL32 CLIPBOARD_RenderFormat(LPCLIPFORMAT lpFormat)
/**************************************************************************
* CLIPBOARD_RenderText
*/
BOOL32 CLIPBOARD_RenderText(LPCLIPFORMAT lpTarget, LPCLIPFORMAT lpSource)
static BOOL32 CLIPBOARD_RenderText(LPCLIPFORMAT lpTarget, LPCLIPFORMAT lpSource)
{
UINT16 size = GlobalSize16( lpSource->hData );
LPCSTR lpstrS = (LPSTR)GlobalLock16(lpSource->hData);
@ -909,10 +909,10 @@ void CLIPBOARD_ReadSelection(Window w,Atom prop)
{
lpFormat = &ClipFormats[CF_TEXT-1];
if (lpFormat->wDataPresent || lpFormat->hData)
CLIPBOARD_DeleteRecord(lpFormat);
CLIPBOARD_DeleteRecord(lpFormat, !(hWndClipWindow));
lpFormat = &ClipFormats[CF_OEMTEXT-1];
if (lpFormat->wDataPresent || lpFormat->hData)
CLIPBOARD_DeleteRecord(lpFormat);
CLIPBOARD_DeleteRecord(lpFormat, !(hWndClipWindow));
lpFormat->wDataPresent = 1;
lpFormat->hData = hText;

View File

@ -945,6 +945,26 @@ CRTDLL__chdrive(INT32 newdrive) {
return DRIVE_SetCurrentDrive(newdrive);
}
/*********************************************************************
* _chdir (CRTDLL.51)
*/
INT32
CRTDLL__chdir(LPCSTR newdir) {
if (!SetCurrentDirectory32A(newdir))
return -1;
return 0;
}
/*********************************************************************
* _mkdir (CRTDLL.234)
*/
INT32
CRTDLL__mkdir(LPCSTR newdir) {
if (!CreateDirectory32A(newdir,NULL))
return -1;
return 0;
}
/*********************************************************************
* _errno (CRTDLL.52)
* Yes, this is a function.

View File

@ -35,26 +35,31 @@
#include "xmalloc.h"
const char people[] = "Wine is available thanks to the work of "
"Bob Amstadt, Dag Asheim, Martin Ayotte, Ross Biro, Uwe Bonnes, Erik Bos, "
"Fons Botman, John Brezak, Andrew Bulhak, John Burton, "
"Niels de Carpentier, Roman Dolejsi, Frans van Dorsselaer, Paul Falstad, "
"Olaf Flebbe, Peter Galbavy, Ramon Garcia, Hans de Graaff, "
"Charles M. Hannum, John Harvey, Cameron Heide, Jochen Hoenicke, "
"Onno Hovers, Jeffrey Hsu, Miguel de Icaza, Jukka Iivonen, "
"Alexandre Julliard, Jochen Karrer, Andreas Kirschbaum, Albrecht Kleine, "
"Bob Amstadt, Dag Asheim, Martin Ayotte, Peter Bajusz, Ross Biro, "
"Uwe Bonnes, Erik Bos, Fons Botman, John Brezak, Andrew Bulhak, "
"John Burton, Niels de Carpentier, Jimen Ching, Huw D. M. Davies, "
"Roman Dolejsi, Frans van Dorsselaer, Paul Falstad, David Faure, "
"Olaf Flebbe, Peter Galbavy, Ramon Garcia, Matthew Ghio, "
"Hans de Graaff, Charles M. Hannum, John Harvey, Cameron Heide, "
"Jochen Hoenicke, Onno Hovers, Jeffrey Hsu, Miguel de Icaza, "
"Jukka Iivonen, Lee Jaekil, Alexandre Julliard, Bang Jun-Young, "
"Pavel Kankovsky, Jochen Karrer, Andreas Kirschbaum, Albrecht Kleine, "
"Jon Konrath, Alex Korobka, Greg Kreider, Anand Kumria, Scott A. Laird, "
"Martin von Loewis, Kenneth MacDonald, Peter MacDonald, William Magro, "
"Juergen Marquardt, Marcus Meissner, Graham Menhennitt, David Metcalfe, "
"Steffen Moeller, Philippe De Muyter, Itai Nahshon, Michael Patra, "
"Jim Peterson, Robert Pouliot, Keith Reynolds, John Richardson, "
"Johannes Ruscheinski, Thomas Sandford, Constantine Sapuntzakis, "
"Daniel Schepler, Ulrich Schmid, Bernd Schmidt, Yngvi Sigurjonsson, "
"Rick Sladkey, William Smith, Erik Svendsen, Tristan Tarrant, "
"Andrew Taylor, Duncan C Thomson, Goran Thyni, Jimmy Tirtawangsa, "
"Jon Tombs, Linus Torvalds, Gregory Trubetskoy, Michael Veksler, "
"Sven Verdoolaege, Eric Warnke, Manfred Weichel, Morten Welinder, "
"Andrew Lewycky, Martin von Loewis, Kenneth MacDonald, Peter MacDonald, "
"William Magro, Juergen Marquardt, Ricardo Massaro, Marcus Meissner, "
"Graham Menhennitt, David Metcalfe, Bruce Milner, Steffen Moeller, "
"Andreas Mohr, Philippe De Muyter, Itai Nahshon, Michael Patra, "
"Jim Peterson, Robert Pouliot, Keith Reynolds, Slaven Rezic, "
"John Richardson, Johannes Ruscheinski, Thomas Sandford, "
"Constantine Sapuntzakis, Pablo Saratxaga, Daniel Schepler, "
"Ulrich Schmid, Bernd Schmidt, Yngvi Sigurjonsson, Stephen Simmons, "
"Rick Sladkey, William Smith, Dominik Strasser, Vadim Strizhevsky, "
"Erik Svendsen, Tristan Tarrant, Andrew Taylor, Duncan C Thomson, "
"Goran Thyni, Jimmy Tirtawangsa, Jon Tombs, Linus Torvalds, "
"Gregory Trubetskoy, Petri Tuomola, Michael Veksler, Sven Verdoolaege, "
"Ronan Waide, Eric Warnke, Manfred Weichel, Morten Welinder, "
"Jan Willamowius, Carl Williams, Karl Guenter Wuensch, Eric Youngdale, "
"and James Youngman. ";
"James Youngman, Mikolaj Zalewski, and John Zero.";
const WINE_LANGUAGE_DEF Languages[] =
{
@ -71,6 +76,7 @@ const WINE_LANGUAGE_DEF Languages[] =
{"Ko",0x0412}, /* LANG_Ko */
{"Hu",0x0436}, /* LANG_Hu */
{"Pl",0x0415}, /* LANG_Pl */
{"Po",0x0416}, /* LANG_Po */
{NULL,0}
};
@ -163,7 +169,7 @@ static XrmOptionDescRec optionsTable[] =
" -fixedmap Use a \"standard\" color map\n" \
" -iconic Start as an icon\n" \
" -ipc Enable IPC facilities\n" \
" -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da,Cz,Eo,It,Ko,\n Hu,Pl)\n" \
" -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da,Cz,Eo,It,Ko,\n Hu,Pl,Po)\n" \
" -managed Allow the window manager to manage created windows\n" \
" -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
" -name name Set the application name\n" \

View File

@ -369,12 +369,12 @@ RtlInitUnicodeString(LPUNICODE_STRING target,LPCWSTR source) {
}
/**************************************************************************
* RtlInitUnicodeString [NTDLL]
* RtlFreeUnicodeString [NTDLL]
*/
VOID
RtlFreeUnicodeString(LPUNICODE_STRING str) {
if (str->Buffer)
HeapFree(GetProcessHeap(),0,str);
HeapFree(GetProcessHeap(),0,str->Buffer);
}
/**************************************************************************
@ -399,7 +399,22 @@ RtlUnicodeToOemN(LPSTR oemstr,DWORD oemlen,LPDWORD reslen,LPWSTR unistr,DWORD un
* RtlUnicodeStringToOemString [NTDLL]
*/
DWORD /* NTSTATUS */
RtlUnicodeStringToOemString(LPUNICODE_STRING uni,LPANSI_STRING oem,BOOL32 alloc)
RtlUnicodeStringToOemString(LPANSI_STRING oem,LPUNICODE_STRING uni,BOOL32 alloc)
{
if (alloc) {
oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
oem->MaximumLength = uni->Length/2+1;
}
oem->Length = uni->Length/2;
lstrcpynWtoA(oem->Buffer,uni->Buffer,uni->Length/2+1);
return 0;
}
/**************************************************************************
* RtlUnicodeStringToAnsiString [NTDLL]
*/
DWORD /* NTSTATUS */
RtlUnicodeStringToAnsiString(LPUNICODE_STRING uni,LPANSI_STRING oem,BOOL32 alloc)
{
if (alloc) {
oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
@ -447,11 +462,9 @@ RtlUpcaseUnicodeString(LPUNICODE_STRING dest,LPUNICODE_STRING src,BOOL32 doalloc
if (dest->MaximumLength < len)
return STATUS_BUFFER_OVERFLOW;
s=dest->Buffer;t=src->Buffer;
for (i=0;i<len;i++) {
/* len is in bytes */
for (i=0;i<len/2;i++)
s[i]=toupper(t[i]);
s++;
t++;
}
return STATUS_SUCCESS;
}

View File

@ -152,7 +152,7 @@ DWORD GetUserDefaultLCID()
/* case LANG_Du: return 0x13; */ /* Dutch */
case LANG_No: return 0x14; /* Norwegian */
case LANG_Pl: return 0x15; /* Polish */
/* case LANG_Po: return 0x16; */ /* Portuguese */
case LANG_Po: return 0x16; /* Portuguese */
/* case LANG_Ro: return 0x18; */ /* Romanian */
/* case LANG_Ru: return 0x19; */ /* Russian */
/* case LANG_Cr: return 0x1a; */ /* Croatian */
@ -1510,6 +1510,112 @@ LOCVAL(LOCALE_INEGSEPBYSPACE)
}
break; /* LANG(Pl) */
case LANG_Po:
switch (LCType) {
LOCVAL(LOCALE_ILANGUAGE, "0416")
LOCVAL(LOCALE_SLANGUAGE, "Portugu\352s (Brasil)")
LOCVAL(LOCALE_SENGLANGUAGE, "Protuguese")
LOCVAL(LOCALE_SABBREVLANGNAME, "POR")
LOCVAL(LOCALE_SNATIVELANGNAME, "Portugu\352s")
LOCVAL(LOCALE_ICOUNTRY, "1")
LOCVAL(LOCALE_SCOUNTRY, "Brasil")
LOCVAL(LOCALE_SENGCOUNTRY, "Brazil")
LOCVAL(LOCALE_SABBREVCTRYNAME, "BRA")
LOCVAL(LOCALE_SNATIVECTRYNAME, "Brasil")
LOCVAL(LOCALE_IDEFAULTLANGUAGE, "0409")
LOCVAL(LOCALE_IDEFAULTCOUNTRY, "1")
LOCVAL(LOCALE_IDEFAULTCODEPAGE, "437")
LOCVAL(LOCALE_IDEFAULTANSICODEPAGE, "1252")
LOCVAL(LOCALE_SLIST, ";")
LOCVAL(LOCALE_IMEASURE, "1")
LOCVAL(LOCALE_SDECIMAL, ",")
LOCVAL(LOCALE_STHOUSAND, ".")
LOCVAL(LOCALE_SGROUPING, "3;0")
LOCVAL(LOCALE_IDIGITS, "2")
LOCVAL(LOCALE_ILZERO, "1")
LOCVAL(LOCALE_INEGNUMBER, "1")
LOCVAL(LOCALE_SNATIVEDIGITS, "0123456789")
LOCVAL(LOCALE_SCURRENCY, "$")
LOCVAL(LOCALE_SINTLSYMBOL, "USD")
LOCVAL(LOCALE_SMONDECIMALSEP, ",")
LOCVAL(LOCALE_SMONTHOUSANDSEP, ".")
LOCVAL(LOCALE_SMONGROUPING, "3;0")
LOCVAL(LOCALE_ICURRDIGITS, "2")
LOCVAL(LOCALE_IINTLCURRDIGITS, "2")
LOCVAL(LOCALE_ICURRENCY, "0")
LOCVAL(LOCALE_INEGCURR, "0")
LOCVAL(LOCALE_SDATE, "/")
LOCVAL(LOCALE_STIME, ":")
LOCVAL(LOCALE_SSHORTDATE, "dd/MM/yy")
LOCVAL(LOCALE_SLONGDATE, "dddd, MMMM dd, yyyy")
LOCVAL(LOCALE_STIMEFORMAT, "h:mm:ss tt")
LOCVAL(LOCALE_IDATE, "0")
LOCVAL(LOCALE_ILDATE, "0")
LOCVAL(LOCALE_ITIME, "0")
LOCVAL(LOCALE_ITIMEMARKPOSN, "0")
LOCVAL(LOCALE_ICENTURY, "0")
LOCVAL(LOCALE_ITLZERO, "0")
LOCVAL(LOCALE_IDAYLZERO, "0")
LOCVAL(LOCALE_IMONLZERO, "0")
LOCVAL(LOCALE_S1159, "AM")
LOCVAL(LOCALE_S2359, "PM")
LOCVAL(LOCALE_ICALENDARTYPE, "1")
LOCVAL(LOCALE_IOPTIONALCALENDAR, "0")
LOCVAL(LOCALE_IFIRSTDAYOFWEEK, "6")
LOCVAL(LOCALE_IFIRSTWEEKOFYEAR, "0")
LOCVAL(LOCALE_SDAYNAME1, "Segunda")
LOCVAL(LOCALE_SDAYNAME2, "Ter\347a")
LOCVAL(LOCALE_SDAYNAME3, "Quarta")
LOCVAL(LOCALE_SDAYNAME4, "Quinta")
LOCVAL(LOCALE_SDAYNAME5, "Sexta")
LOCVAL(LOCALE_SDAYNAME6, "S\341bado")
LOCVAL(LOCALE_SDAYNAME7, "Domingo")
LOCVAL(LOCALE_SABBREVDAYNAME1, "Seg")
LOCVAL(LOCALE_SABBREVDAYNAME2, "Ter")
LOCVAL(LOCALE_SABBREVDAYNAME3, "Qua")
LOCVAL(LOCALE_SABBREVDAYNAME4, "Qui")
LOCVAL(LOCALE_SABBREVDAYNAME5, "Sex")
LOCVAL(LOCALE_SABBREVDAYNAME6, "S\341b")
LOCVAL(LOCALE_SABBREVDAYNAME7, "Dom")
LOCVAL(LOCALE_SMONTHNAME1, "Janeiro")
LOCVAL(LOCALE_SMONTHNAME2, "Fevereiro")
LOCVAL(LOCALE_SMONTHNAME3, "Mar\347o")
LOCVAL(LOCALE_SMONTHNAME4, "Abril")
LOCVAL(LOCALE_SMONTHNAME5, "Maio")
LOCVAL(LOCALE_SMONTHNAME6, "Junho")
LOCVAL(LOCALE_SMONTHNAME7, "Julho")
LOCVAL(LOCALE_SMONTHNAME8, "Agosto")
LOCVAL(LOCALE_SMONTHNAME9, "Setembro")
LOCVAL(LOCALE_SMONTHNAME10, "Outubro")
LOCVAL(LOCALE_SMONTHNAME11, "Novembro")
LOCVAL(LOCALE_SMONTHNAME12, "Dezembro")
LOCVAL(LOCALE_SMONTHNAME13, "")
LOCVAL(LOCALE_SABBREVMONTHNAME1, "Jan")
LOCVAL(LOCALE_SABBREVMONTHNAME2, "Fev")
LOCVAL(LOCALE_SABBREVMONTHNAME3, "Mar")
LOCVAL(LOCALE_SABBREVMONTHNAME4, "Abr")
LOCVAL(LOCALE_SABBREVMONTHNAME5, "Mai")
LOCVAL(LOCALE_SABBREVMONTHNAME6, "Jun")
LOCVAL(LOCALE_SABBREVMONTHNAME7, "Jul")
LOCVAL(LOCALE_SABBREVMONTHNAME8, "Ago")
LOCVAL(LOCALE_SABBREVMONTHNAME9, "Set")
LOCVAL(LOCALE_SABBREVMONTHNAME10, "Out")
LOCVAL(LOCALE_SABBREVMONTHNAME11, "Nov")
LOCVAL(LOCALE_SABBREVMONTHNAME12, "Dez")
LOCVAL(LOCALE_SABBREVMONTHNAME13, "")
LOCVAL(LOCALE_SPOSITIVESIGN, "")
LOCVAL(LOCALE_SNEGATIVESIGN, "-")
LOCVAL(LOCALE_IPOSSIGNPOSN, "3")
LOCVAL(LOCALE_INEGSIGNPOSN, "0")
LOCVAL(LOCALE_IPOSSYMPRECEDES, "1")
LOCVAL(LOCALE_IPOSSEPBYSPACE, "0")
LOCVAL(LOCALE_INEGSYMPRECEDES, "1")
LOCVAL(LOCALE_INEGSEPBYSPACE, "0")
default: found=0;break;
}
break; /* LANG(Po) */
/*Insert other languages here*/
default:

View File

@ -577,7 +577,7 @@ VerInstallFile32A(
buf1 = _fetch_versioninfo(destfn);
if (buf1) {
buf2 = _fetch_versioninfo(tmpfn);
if (!buf2) {
if (buf2) {
char *tbuf1,*tbuf2;
VS_FIXEDFILEINFO *destvffi,*tmpvffi;
UINT32 len1,len2;

View File

@ -1073,8 +1073,8 @@ void DOS3Call( CONTEXT *context )
break;
case 0x05: /* GET BOOT DRIVE */
DL_reg(context) = 2;
/* c: is Wine's bootdrive */
DL_reg(context) = 3;
/* c: is Wine's bootdrive (a: is 1)*/
break;
case 0x06: /* GET TRUE VERSION NUMBER */
@ -1354,8 +1354,6 @@ void DOS3Call( CONTEXT *context )
AX_reg(context) = DOS_ExtendedError;
SET_CFLAG(context);
}
else AX_reg(context) = 0x0100;
/* intlist: many Microsoft products for Windows rely on this */
break;
case 0x48: /* ALLOCATE MEMORY */
@ -1634,12 +1632,53 @@ void DOS3Call( CONTEXT *context )
SET_CFLAG(context);
}
break;
case 0x43: /* Get/Set file attributes */
switch (BL_reg(context))
{
case 0x00: /* Get file attributes */
CX_reg(context) = (WORD)GetFileAttributes32A(
PTR_SEG_OFF_TO_LIN(DS_reg(context),
DX_reg(context)));
if (CX_reg(context) == 0xffff)
{
AX_reg(context) = DOS_ExtendedError;
SET_CFLAG(context);
}
break;
case 0x01:
if (!SetFileAttributes32A( PTR_SEG_OFF_TO_LIN(DS_reg(context),
DX_reg(context)),
CX_reg(context) ))
{
AX_reg(context) = DOS_ExtendedError;
SET_CFLAG(context);
}
break;
default:
fprintf( stderr,
"Unimplemented int21 long file name function:\n");
INT_BARF( context, 0x21 );
SET_CFLAG(context);
AL_reg(context) = 0;
break;
}
break;
case 0x47: /* Get current directory */
if (!INT21_GetCurrentDirectory(context))
{
AX_reg(context) = DOS_ExtendedError;
SET_CFLAG(context);
}
else AX_reg(context) = 0x0100;
/* intlist: many Microsoft products for Windows rely on this */
break;
case 0x4e: /* Find first file */
/* FIXME: use attributes in CX */
if (!(AX_reg(context) = FindFirstFile16(
if ((AX_reg(context) = FindFirstFile16(
PTR_SEG_OFF_TO_LIN(DS_reg(context),DX_reg(context)),
(WIN32_FIND_DATA32A *)PTR_SEG_OFF_TO_LIN(ES_reg(context),
DI_reg(context)))))
DI_reg(context))))
== INVALID_HANDLE_VALUE16)
{
AX_reg(context) = DOS_ExtendedError;
SET_CFLAG(context);
@ -1663,12 +1702,37 @@ void DOS3Call( CONTEXT *context )
break;
case 0xa0:
break;
case 0x60:
switch(CL_reg(context))
{
case 0x02: /*Get canonical long filename or path */
if (!GetFullPathName32A
( PTR_SEG_OFF_TO_LIN(DS_reg(context),
SI_reg(context)), 128,
PTR_SEG_OFF_TO_LIN(ES_reg(context),
DI_reg(context)),NULL))
{
AX_reg(context) = DOS_ExtendedError;
SET_CFLAG(context);
}
else AX_reg(context) = 0;
break;
default:
fprintf( stderr,
"Unimplemented int21 long file name function:\n");
INT_BARF( context, 0x21 );
SET_CFLAG(context);
AL_reg(context) = 0;
break;
}
break;
case 0x6c: /* Create or open file */
/* translate Dos 7 action to Dos 6 action */
ExtendedOpenCreateFile(context);
break;
case 0x3b: /* Change directory */
case 0x41: /* Delete file */
case 0x43: /* Get/Set file attributes */
case 0x47: /* Get current directory */
case 0x56: /* Move (rename) file */
case 0x6c: /* Create/Open file */
default:
fprintf( stderr, "Unimplemented int21 long file name function:\n");
INT_BARF( context, 0x21 );

View File

@ -861,7 +861,7 @@ int COLOR_ToPhysical( DC *dc, COLORREF color )
if( spec_type > 2 )
{
fprintf(stderr, "COLOR_ToPhysical : invalid RGB specifier for: %08lx\n", color);
dprintf_palette(stddeb, "COLOR_ToPhysical : invalid RGB specifier for: %08lx\n", color);
spec_type = 0;
}

View File

@ -29,15 +29,18 @@ int DIB_GetImageWidthBytes( int width, int depth )
switch(depth)
{
case 1: words = (width + 31) / 32; break;
case 4: words = (width + 7) / 8; break;
case 8: words = (width + 3) / 4; break;
case 15:
case 16: words = (width + 1) / 2; break;
case 24: words = width; break;
default:
fprintf(stderr, "DIB: unsupported depth %d.\n", depth );
exit(1);
case 1: words = (width + 31) / 32; break;
case 4: words = (width + 7) / 8; break;
case 8: words = (width + 3) / 4; break;
case 15:
case 16: words = (width + 1) / 2; break;
case 24: words = (width * 3 + 3)/4; break;
default:
fprintf(stderr, "DIB: unsupported depth %d.\n", depth );
/* fall through */
case 32:
words = width;
}
return 4 * words;
}
@ -70,29 +73,6 @@ int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse )
}
/***********************************************************************
* DIB_DIBmpToImage
*
* Create an XImage pointing to the bitmap data.
*/
static XImage *DIB_DIBmpToImage( BITMAPINFOHEADER * bmp, void * bmpData )
{
extern void _XInitImageFuncPtrs( XImage* );
XImage * image;
image = XCreateImage(display, DefaultVisualOfScreen( screen ),
bmp->biBitCount, ZPixmap, 0, bmpData,
bmp->biWidth, bmp->biHeight, 32,
DIB_GetImageWidthBytes(bmp->biWidth,bmp->biBitCount));
if (!image) return 0;
image->byte_order = MSBFirst;
image->bitmap_bit_order = MSBFirst;
image->bitmap_unit = 16;
_XInitImageFuncPtrs(image);
return image;
}
/***********************************************************************
* DIB_GetBitmapInfo
*
@ -809,30 +789,95 @@ INT32 GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
else ((WORD *)info->bmiColors)[i] = (WORD)i;
}
/* Transfer the pixels (very slow...) */
if (bits)
{
BYTE* bbits = bits;
int pad, yend, xend = bmp->bitmap.bmWidth;
dprintf_bitmap(stddeb, "GetDIBits: %u scanlines of (%i,%i) -> (%i,%i) starting from %u\n",
lines, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
(int)info->bmiHeader.biWidth, (int)info->bmiHeader.biHeight, startscan );
/* adjust number of scanlines to copy */
if( lines > info->bmiHeader.biHeight ) lines = info->bmiHeader.biHeight;
yend = startscan + lines;
if( startscan >= bmp->bitmap.bmHeight )
return FALSE;
if( yend > bmp->bitmap.bmHeight ) yend = bmp->bitmap.bmHeight;
/* adjust scanline width */
pad = info->bmiHeader.biWidth - bmp->bitmap.bmWidth;
if( pad < 0 )
{
/* bitmap is wider than DIB, copy only a part */
pad = 0; xend = info->bmiHeader.biWidth;
}
bmpImage = (XImage *)CallTo32_LargeStack( (int (*)())XGetImage, 8,
display, bmp->pixmap, 0, 0, bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight, AllPlanes, ZPixmap );
dibImage = DIB_DIBmpToImage( &info->bmiHeader, bits );
for (y = 0; y < lines; y++)
switch( info->bmiHeader.biBitCount )
{
for (x = 0; x < info->bmiHeader.biWidth; x++)
{
XPutPixel( dibImage, x, y,
XGetPixel(bmpImage, x, bmp->bitmap.bmHeight-startscan-y-1) );
}
case 8:
pad += (4 - (info->bmiHeader.biWidth & 3)) & 3;
for( y = yend - 1; (int)y >= (int)startscan; y-- )
{
for( x = 0; x < xend; x++ )
*bbits++ = XGetPixel( bmpImage, x, y );
bbits += pad;
}
break;
/* add more bpp-specific shortcuts here */
default:
dibImage = XCreateImage(display, DefaultVisualOfScreen( screen ),
info->bmiHeader.biBitCount, ZPixmap, 0, bits,
info->bmiHeader.biWidth, info->bmiHeader.biHeight,
32, DIB_GetImageWidthBytes( info->bmiHeader.biWidth,
info->bmiHeader.biBitCount ) );
if( dibImage )
{
extern void _XInitImageFuncPtrs( XImage* );
dibImage->byte_order = MSBFirst;
dibImage->bitmap_bit_order = MSBFirst;
dibImage->bitmap_unit = 16;
_XInitImageFuncPtrs( dibImage );
for (y = yend - 1; (int)y >= (int)startscan; y--)
for (x = 0; x < xend; x++)
XPutPixel( dibImage, x, yend - y + 1,
XGetPixel( bmpImage, x, y ));
dibImage->data = NULL;
XDestroyImage( dibImage );
}
}
dibImage->data = NULL;
XDestroyImage( dibImage );
XDestroyImage( bmpImage );
info->bmiHeader.biCompression = 0;
}
info->bmiHeader.biCompression = 0;
else if( info->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER) )
{
/* fill in struct members */
info->bmiHeader.biWidth = bmp->bitmap.bmWidth;
info->bmiHeader.biHeight = bmp->bitmap.bmHeight;
info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
info->bmiHeader.biSizeImage = bmp->bitmap.bmHeight *
DIB_GetImageWidthBytes( bmp->bitmap.bmWidth,
bmp->bitmap.bmBitsPixel );
info->bmiHeader.biCompression = 0;
}
return lines;
}

View File

@ -868,31 +868,23 @@ BOOL32 GetCharABCWidths32W( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
BOOL16 GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
LPINT16 buffer )
{
int i, width;
XFontStruct *xfont;
XCharStruct *cs, *def;
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
if (!dc) return FALSE;
xfont = dc->u.x.font.fstruct;
/* fixed font? */
if (xfont->per_char == NULL)
LPINT32 buf32 = (LPINT32)xmalloc(sizeof(INT32)*(1 + (lastChar-firstChar)));
LPINT32 obuf32;
BOOL32 retVal;
int i;
if (!buf32)
return FALSE;
obuf32 = buf32;
retVal = GetCharWidth32A(hdc, firstChar, lastChar, buf32);
if (retVal)
{
for (i = firstChar; i <= lastChar; i++)
*buffer++ = xfont->max_bounds.width;
return TRUE;
{
*buffer++ = *buf32++;
}
}
CI_GET_DEFAULT_INFO(xfont, def);
for (i = firstChar; i <= lastChar; i++)
{
CI_GET_CHAR_INFO( xfont, i, def, cs );
width = cs ? cs->width : xfont->max_bounds.width;
*buffer++ = MAX( width, 0 );
}
return TRUE;
free (obuf32);
return retVal;
}
@ -902,30 +894,17 @@ BOOL16 GetCharWidth16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
BOOL32 GetCharWidth32A( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
LPINT32 buffer )
{
int i, width;
XFontStruct *xfont;
XCharStruct *cs, *def;
DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC);
if (!dc) return FALSE;
xfont = dc->u.x.font.fstruct;
/* fixed font? */
if (xfont->per_char == NULL)
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
for (i = firstChar; i <= lastChar; i++)
*buffer++ = xfont->max_bounds.width;
return TRUE;
if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC )))
return FALSE;
}
CI_GET_DEFAULT_INFO(xfont, def);
for (i = firstChar; i <= lastChar; i++)
{
CI_GET_CHAR_INFO( xfont, i, def, cs );
width = cs ? cs->width : xfont->max_bounds.width;
*buffer++ = MAX( width, 0 );
}
if (!dc->funcs->pGetCharWidth ||
!dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer))
return FALSE;
return TRUE;
}

View File

@ -749,6 +749,17 @@ HMETAFILE16 SetMetaFileBits( HGLOBAL16 hMem )
return hMem;
}
/******************************************************************
* SetMetaFileBitsBetter (GDI.196)
*/
HMETAFILE16 SetMetaFileBitsBetter( HMETAFILE16 hMeta )
{
if( IsValidMetaFile( hMeta ) )
return (HMETAFILE16)GlobalReAlloc16( hMeta, 0,
GMEM_SHARE | GMEM_NODISCARD | GMEM_MODIFY);
return (HMETAFILE16)0;
}
/******************************************************************
* MF_WriteRecord
*

View File

@ -19,7 +19,8 @@ SYSRES_SRCS = \
sysres_It.c \
sysres_Ko.c \
sysres_No.c \
sysres_Pl.c
sysres_Pl.c \
sysres_Po.c
C_SRCS = sysres.c
GEN_C_SRCS = $(SYSRES_SRCS)

View File

@ -22,6 +22,7 @@
#include "sysres_Ko.h"
#include "sysres_Hu.h"
#include "sysres_Pl.h"
#include "sysres_Po.h"
static const struct resource * const * SYSRES_Resources[] =
{
@ -37,7 +38,8 @@ static const struct resource * const * SYSRES_Resources[] =
sysres_It_Table, /* LANG_It */
sysres_Ko_Table, /* LANG_Ko */
sysres_Hu_Table, /* LANG_Hu */
sysres_Pl_Table /* LANG_Pl */
sysres_Pl_Table, /* LANG_Pl */
sysres_Po_Table /* LANG_Po */
};

View File

@ -51,7 +51,7 @@ FONT 10, "System"
CONTROL "Text", 100, "STATIC", SS_NOPREFIX | WS_GROUP, 11, 40, 200, 200
ICON "", 1088, 195, 10, 18, 20
}
//LTEXT "Wyswietl pliki &typu:", 1089, 6, 104, 90, 9
/* LTEXT "Wyswietl pliki &typu:", 1089, 6, 104, 90, 9 */
OPEN_FILE DIALOG 36, 24, 279, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Otwórz"
@ -72,7 +72,7 @@ BEGIN
CONTROL "&Pomoc", 1038, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 212, 46, 56, 14
CONTROL "Tylko do odczytu", 1040, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 208, 68, 69, 12
END
//PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
/* PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134 */
SAVE_FILE DIALOG 36, 24, 278, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Zapisz jako"
@ -93,7 +93,7 @@ BEGIN
CONTROL "&Pomoc", 1038, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 213, 45, 56, 14
CONTROL "&Tylko do odczytu", 1040, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 208, 68, 68, 12
END
// DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
/* DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP */
PRINT DIALOG 36, 24, 264, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Drukuj"
@ -115,7 +115,7 @@ BEGIN
CONTROL "Drukuj do Pli&ku", 1040, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 14, 115, 95, 12
CONTROL "Sortuj kopie", 1041, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 182, 102, 59, 12
END
// PUSHBUTTON "Anuluj",IDCANCEL,218,23,40,14,WS_GROUP
/* PUSHBUTTON "Anuluj",IDCANCEL,218,23,40,14,WS_GROUP */
PRINT_SETUP DIALOG 36, 24, 264, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Print Setup"
@ -140,7 +140,7 @@ BEGIN
CONTROL "", 1137, "COMBOBOX", CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 155, 95, 92, 68
CONTROL "", 1138, "COMBOBOX", CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 155, 110, 92, 68
END
// CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
/* CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 */
CHOOSE_FONT DIALOG 13, 54, 264, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Font"
@ -168,11 +168,12 @@ CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP, 6,120,84,100
CONTROL "Przyk³ad", 1073, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 98,72,160,49
CONTROL "AaBbYyZz\xB3", 1093, "STATIC", SS_NOPREFIX | WS_VISIBLE, 104,81,149,37
END
// PUSHBUTTON "&Replace", 1024, 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
// PUSHBUTTON "Replace &All", 1025, 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
// PUSHBUTTON "Cancel", 2, 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
// PUSHBUTTON "&Help", 1038, 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
//}
/* PUSHBUTTON "&Replace", 1024, 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
* PUSHBUTTON "Replace &All", 1025, 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
* PUSHBUTTON "Cancel", 2, 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
* PUSHBUTTON "&Help", 1038, 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
*}
*/
FIND_TEXT DIALOG 34, 24, 251, 62
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "ZnajdŸ"

247
resources/sysres_Po.rc Normal file
View File

@ -0,0 +1,247 @@
SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
MENUITEM "&Restaurar", 61728
MENUITEM "&Mover", 61456
MENUITEM "&Tamanho", 61440
MENUITEM "Mi&nimizar", 61472
MENUITEM "Ma&ximizar", 61488
MENUITEM SEPARATOR
MENUITEM "&Fechar\tAlt-F4", 61536
MENUITEM SEPARATOR
MENUITEM "&Alternar Para ...\tCtrl-Esc", 61744
MENUITEM SEPARATOR
MENUITEM "&Sobre o WINE ...", 61761
}
EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
POPUP ""
BEGIN
MENUITEM "&Voltar", EM_UNDO32
MENUITEM SEPARATOR
MENUITEM "&Recortar", WM_CUT
MENUITEM "&Copiar", WM_COPY
MENUITEM "Co&lar", WM_PASTE
MENUITEM "&Apagar", WM_CLEAR
MENUITEM SEPARATOR
MENUITEM "Selecionar &Tudo", EM_SETSEL32
END
}
MSGBOX DIALOG 100, 80, 216, 168
STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
BEGIN
ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "&Ok", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Cancelar", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Abortar", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Repetir", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Ignorar", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Sim", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&Não", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 223, 270
STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Sobre %s"
FONT 10, "Sistema"
{
DEFPUSHBUTTON "OK", 1, 91, 250, 40, 14
CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 210
LTEXT "Text", 100, 11, 40, 200, 200, SS_NOPREFIX | WS_GROUP
ICON "", 1088, 195, 10, 18, 20
}
OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Abrir"
FONT 8, "Helv"
{
LTEXT "Nome do &Arquivo:", 1090, 6, 6, 76, 9
EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "&Diretórios:", -1, 110, 6, 92, 9
LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "Listar Arquivos do &Tipo:", 1089, 6, 104, 90, 9
COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
LTEXT "Dri&ves:", 1091, 110, 104, 92, 9
COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Abrir", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "A&juda", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
CHECKBOX "&Somente Leitura", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
}
SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Salvar Como ..."
FONT 8, "Helv"
{
LTEXT "Nome do &Arquivo:", 1090, 6, 6, 76, 9
EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "&Diretórios:", -1, 110, 6, 92, 9
LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "Listar Arquivos do &Tipo:", 1089, 6, 104, 90, 9
COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
LTEXT "Dri&ves:", 1091, 110, 104, 92, 9
COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Salvar &Como", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Ajuda", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
CHECKBOX "&Somente Leitura", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
}
PRINT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Imprimir"
FONT 8, "Helv"
{
LTEXT "Impressora:", 1088, 6, 6, 40, 9
LTEXT "", 1089, 60, 6, 150, 9
GROUPBOX "Faixa de Impressão", 1072, 6, 30, 160, 65, BS_GROUPBOX
RADIOBUTTON "&Tudo", 1056, 16, 45, 60, 12
RADIOBUTTON "S&eleção", 1057, 16, 60, 60, 12
RADIOBUTTON "&Páginas", 1058, 16, 75, 60, 12
DEFPUSHBUTTON "Imprimir", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Configurar", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
LTEXT "&De:", 1090, 60, 80, 30, 9
LTEXT "&Ate:", 1091, 120, 80, 30, 9
LTEXT "&Qualidade de Impressão:", 1092, 6, 100, 76, 9
COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
CHECKBOX "Imprimir para Arquivo", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "C&ondensado", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
}
PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Configurações de Impressão"
FONT 8, "Helv"
{
GROUPBOX "Impressora", 1072, 6, 10, 180, 65, BS_GROUPBOX
RADIOBUTTON "&Impressora Padrão", 1056, 16, 20, 80, 12
LTEXT "[none]", 1088, 35, 35, 120, 9
RADIOBUTTON "Impressora &Específica", 1057, 16, 50, 80, 12
COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Configurar", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
GROUPBOX "Orientação", 1073, 6, 85, 100, 50, BS_GROUPBOX
RADIOBUTTON "&Retrato", 1058, 50, 100, 40, 12
RADIOBUTTON "&Paisagem", 1059, 50, 115, 40, 12
ICON "LANDSCAP", 1097, 10, 95, 32, 32
ICON "PORTRAIT", 1098, 10, 95, 32, 32
GROUPBOX "Papel", 1074, 120, 85, 180, 50, BS_GROUPBOX
LTEXT "&Tamanho", 1089, 130, 95, 30, 9
LTEXT "&Fonte de Alimentação", 1090, 130, 110, 30, 9
COMBOBOX 1137, 155, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
}
CHOOSE_FONT DIALOG DISCARDABLE 13, 54, 264, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Fonte"
FONT 8, "Helv"
{
LTEXT "&Fonte:",1088 ,6,3,40,9
COMBOBOX 1136 ,6,13,94,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
LTEXT "&Estilo da Fonte:",1089 ,108,3,44,9
COMBOBOX 1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
LTEXT "&Tamanho:",1090,179,3,30,9
COMBOBOX 1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
DEFPUSHBUTTON "OK",IDOK,218,6,40,14,WS_GROUP
PUSHBUTTON "Cancelar",IDCANCEL,218,23,40,14,WS_GROUP
PUSHBUTTON "&Aplicar", 1026,218,40,40,14,WS_GROUP
PUSHBUTTON "A&juda" , 1038,218,57,40,14,WS_GROUP
GROUPBOX "Efeitos",1072,6,72,84,34,WS_GROUP
CHECKBOX "&Riscado", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "&Sublinhado", 1041, 10,94,50,10, BS_AUTOCHECKBOX
LTEXT "&Cor:", 1091 ,6,110,30,9
COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Amostra",1073,98,72,160,49,WS_GROUP
CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
}
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cor"
FONT 8, "Helv"
{
LTEXT "Cores &Básicas:", 1088, 4, 4, 140, 10
LTEXT "&Cores do Usuário:", 1089, 4, 106, 140, 10
LTEXT "Colorido|Sólid&o", 1090, 150, 151, 48, 10
LTEXT "Ver&melho:", 726 /*1094*/,249,126,24,10
EDITTEXT 706, 275,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Verde:",727/*1095*/,249,140,24,10
EDITTEXT 707, 275,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "A&zul:",728 /*1096*/,249,154,24,10
EDITTEXT 708, 275,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "Mat&iz:" ,723 /*1091*/,202,126,22,10
EDITTEXT 703, 226,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "Sa&t:" ,724 /*1092*/,202,140,22,10
EDITTEXT 704, 226,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Lum:" ,725 /*1093*/,202,154,22,10
EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
DEFPUSHBUTTON "Ok", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Aj&uda", 1038,100,166, 44, 14
PUSHBUTTON "&Adicionar Cor", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Definir Cores Personalizadas >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&o",713,300,200,4,14 /* just a dummy: 'o' is like &o in "solid&o" */
}
FIND_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 236, 62
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Procurar"
FONT 8, "Helv"
{
LTEXT "&Procurar:", -1, 4, 8, 42, 8
EDITTEXT 1152, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
CHECKBOX "Palavra &Inteira", 1040, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Maiúsculas/minusculas", 1041, 4, 42, 64, 12, BS_AUTOCHECKBOX | WS_TABSTOP
GROUPBOX "Direção", 1072, 107, 26, 68, 28
CONTROL "A&cima", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 20, 12
CONTROL "A&baixo", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12
DEFPUSHBUTTON "Procurar a Pró&xima", 1, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "A&juda", 1038, 182, 45, 50, 14, WS_GROUP | WS_TABSTOP
}
REPLACE_TEXT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 230, 94
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Alterar"
FONT 8, "Helv"
{
LTEXT "&Procurar:", -1, 4, 9, 48, 8
EDITTEXT 1152, 54, 7, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "Alterar Pa&ra:", -1, 4, 26, 48, 8
EDITTEXT 1153, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
CHECKBOX "Palavra &inteira", 1040, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Maiúsculas/minúsculas", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP
DEFPUSHBUTTON "Procurar a Pró&xima", 1, 174, 4, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Alterar", 1024, 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Alterar &Todas", 1025, 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 174, 55, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "A&juda", 1038, 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
}

View File

@ -66,6 +66,22 @@ UINT32 GetOEMCP(void)
return 437; /* MS-DOS United States */
}
/***********************************************************************
* IsValidCodePage (KERNEL32.360)
*/
BOOL32 IsValidCodePage(UINT32 CodePage)
{
switch ( CodePage )
{
case 1252 :
case 437 :
return TRUE;
default :
return FALSE;
}
}
/***********************************************************************
* MultiByteToWideChar (KERNEL32.392)
*/

View File

@ -207,3 +207,11 @@ BOOL32 SetConsoleTitle32W( LPCWSTR title )
HeapFree( GetProcessHeap(), 0, titleA );
return TRUE;
}
/***********************************************************************
* FlushConsoleInputBuffer (KERNEL32.132)
*/
BOOL32 FlushConsoleInputBuffer(HANDLE32 hConsoleInput){
fprintf(stderr,"FlushConsoleInputBuffer(%d)\n",hConsoleInput);
return TRUE;
}

View File

@ -97,10 +97,10 @@ void K32OBJ_DecCount( K32OBJ *ptr )
*/
BOOL32 K32OBJ_AddName( K32OBJ *obj, LPCSTR name )
{
NAME_ENTRY *entry = K32OBJ_FirstEntry;
NAME_ENTRY *entry;
UINT32 len = strlen( name );
if (!(entry = HeapAlloc( SystemHeap, 0, sizeof(entry) + len )))
if (!(entry = HeapAlloc( SystemHeap, 0, sizeof(NAME_ENTRY) + len )))
{
SetLastError( ERROR_OUTOFMEMORY );
return FALSE;

View File

@ -10,40 +10,298 @@
#include "windows.h"
#include "winerror.h"
#include "heap.h"
#include "thread.h"
#include "handle32.h"
#include "pe_image.h"
#include "stddebug.h"
#include "debug.h"
typedef struct {
K32OBJ header;
DWORD maxcount;
DWORD count;
DWORD initial;
} K32SEMAPHORE;
typedef struct {
K32OBJ header;
THDB *owning_thread; /* we are locked by this thread */
} K32MUTEX;
typedef struct {
K32OBJ header;
} K32EVENT;
/***********************************************************************
* CreateMutexA (KERNEL32.52)
*/
HANDLE32 CreateMutexA (SECURITY_ATTRIBUTES *sa, BOOL32 on, const char *a)
HANDLE32 CreateMutex32A(SECURITY_ATTRIBUTES *sa,BOOL32 on,LPCSTR name)
{
K32MUTEX *mut;
HANDLE32 handle;
K32OBJ *obj = K32OBJ_FindName( name );
if (obj) {
if (obj->type == K32OBJ_MUTEX) {
SetLastError( ERROR_ALREADY_EXISTS );
return PROCESS_AllocHandle( obj,0 );
}
SetLastError( ERROR_DUP_NAME );
return 0;
}
mut = (K32MUTEX*)HeapAlloc(GetProcessHeap(),0,sizeof(K32MUTEX));
mut->header.type = K32OBJ_MUTEX;
mut->header.refcount = 1;
mut->owning_thread = NULL;
if (name)
K32OBJ_AddName(&(mut->header),name);
handle = PROCESS_AllocHandle(&(mut->header),0);
if (handle != INVALID_HANDLE_VALUE32) {
if (on)
mut->owning_thread = (THDB *)GetCurrentThreadId();
return handle;
}
K32OBJ_DecCount(&(mut->header)); /* also frees name */
HeapFree(GetProcessHeap(),0,mut);
return 0;
}
/***********************************************************************
* CreateMutexW (KERNEL32.53)
*/
HANDLE32 CreateMutex32W(SECURITY_ATTRIBUTES *sa, BOOL32 on, LPCWSTR a)
{
LPSTR name = a?HEAP_strdupWtoA(GetProcessHeap(),0,a):NULL;
HANDLE32 ret;
ret = CreateMutex32A(sa,on,name);
if (name) HeapFree(GetProcessHeap(),0,name);
return ret;
}
/***********************************************************************
* CreateSemaphoreA (KERNEL32.60)
*/
HANDLE32 CreateSemaphore32A(
LPSECURITY_ATTRIBUTES sa,LONG initial,LONG max,LPCSTR name
) {
K32SEMAPHORE *sem;
HANDLE32 handle;
K32OBJ *obj = K32OBJ_FindName( name );
if (obj) {
if (obj->type == K32OBJ_SEMAPHORE) {
SetLastError( ERROR_ALREADY_EXISTS );
return PROCESS_AllocHandle( obj,0 );
}
SetLastError( ERROR_DUP_NAME );
return 0;
}
sem = (K32SEMAPHORE*)HeapAlloc(GetProcessHeap(),0,sizeof(K32SEMAPHORE));
sem->header.type = K32OBJ_SEMAPHORE;
sem->header.refcount = 1;
sem->maxcount = max;
sem->count = initial;
sem->initial = initial;
if (name)
K32OBJ_AddName(&(sem->header),name);
handle = PROCESS_AllocHandle(&(sem->header),0);
if (handle != INVALID_HANDLE_VALUE32)
return handle;
K32OBJ_DecCount(&(sem->header)); /* also frees name */
HeapFree(GetProcessHeap(),0,sem);
return 0;
}
/***********************************************************************
* CreateSemaphoreW (KERNEL32.61)
*/
HANDLE32 CreateSemaphore32W(SECURITY_ATTRIBUTES *sa,LONG initial,LONG max,LPCWSTR a)
{
LPSTR name =a?HEAP_strdupWtoA(GetProcessHeap(),0,a):NULL;
HANDLE32 ret;
ret = CreateSemaphore32A(sa,initial,max,name);
if (a) HeapFree(GetProcessHeap(),0,name);
return ret;
}
/***********************************************************************
* OpenSemaphoreA (KERNEL32.403)
*/
HANDLE32 OpenSemaphore32A(DWORD desired,BOOL32 inherit,LPCSTR name)
{
K32OBJ *obj = K32OBJ_FindName( name );
if (obj) {
if (obj->type == K32OBJ_SEMAPHORE)
return PROCESS_AllocHandle( obj,0 );
SetLastError( ERROR_DUP_NAME );
return 0;
}
return 0;
}
/***********************************************************************
* OpenSemaphoreA (KERNEL32.404)
*/
HANDLE32 OpenSemaphore32W(DWORD desired,BOOL32 inherit,LPCWSTR name)
{
LPSTR nameA = name?HEAP_strdupWtoA(GetProcessHeap(),0,name):NULL;
HANDLE32 ret = OpenSemaphore32A(desired,inherit,nameA);
if (name) HeapFree(GetProcessHeap(),0,nameA);
return ret;
}
/***********************************************************************
* ReleaseSemaphore (KERNEL32.403)
*/
BOOL32 ReleaseSemaphore(HANDLE32 hSemaphore,LONG lReleaseCount,LPLONG lpPreviousCount) {
K32SEMAPHORE *sem;
sem = (K32SEMAPHORE*)PROCESS_GetObjPtr(hSemaphore,K32OBJ_SEMAPHORE);
if (!sem)
return FALSE;
if (lpPreviousCount) *lpPreviousCount = sem->count;
sem->count += lReleaseCount;
if (sem->count>sem->maxcount) {
fprintf(stderr,"ReleaseSemaphore(%d,%ld,.), released more then possible??\n",hSemaphore,lReleaseCount);
sem->count = sem->maxcount;
}
/* FIXME: wake up all threads blocked on that semaphore */
K32OBJ_DecCount(&(sem->header));
return TRUE;
}
/***********************************************************************
* OpenMutexA (KERNEL32.399)
*/
HANDLE32 OpenMutex32A(DWORD desiredaccess, BOOL32 inherithandle, LPCSTR name)
{
K32OBJ *obj = K32OBJ_FindName( name );
if (obj) {
if (obj->type == K32OBJ_MUTEX)
return PROCESS_AllocHandle( obj,0 );
SetLastError( ERROR_DUP_NAME );
return 0;
}
return 0;
}
/***********************************************************************
* OpenMutexW (KERNEL32.400)
*/
HANDLE32 OpenMutex32W(DWORD desiredaccess, BOOL32 inherithandle, LPCWSTR name)
{
LPSTR nameA=name?HEAP_strdupWtoA(GetProcessHeap(),0,name):NULL;
HANDLE32 ret = OpenMutex32A(desiredaccess,inherithandle,nameA);
if (name) HeapFree(GetProcessHeap(),0,nameA);
return ret;
}
/***********************************************************************
* ReleaseMutex (KERNEL32.435)
*/
BOOL32 ReleaseMutex (HANDLE32 h)
{
return 0;
K32MUTEX *mut = (K32MUTEX*)PROCESS_GetObjPtr(h,K32OBJ_MUTEX);
if (!mut)
return 0;
if (mut->owning_thread != (THDB *)GetCurrentThreadId()) {
/* set error ... */
K32OBJ_DecCount(&(mut->header));
return 0;
}
mut->owning_thread = NULL;
/* FIXME: wake up all threads blocked on this mutex */
K32OBJ_DecCount(&(mut->header));
return TRUE;
}
/***********************************************************************
* CreateEventA (KERNEL32.43)
*/
HANDLE32 CreateEventA (SECURITY_ATTRIBUTES *sa, BOOL32 au, BOOL32 on, const char
*name)
HANDLE32 CreateEvent32A(SECURITY_ATTRIBUTES *sa,BOOL32 au,BOOL32 on,LPCSTR name)
{
K32EVENT *evt;
HANDLE32 handle;
K32OBJ *obj = K32OBJ_FindName( name );
if (obj) {
if (obj->type == K32OBJ_EVENT) {
SetLastError( ERROR_ALREADY_EXISTS );
return PROCESS_AllocHandle( obj,0 );
}
SetLastError( ERROR_DUP_NAME );
return 0;
}
evt = (K32EVENT*)HeapAlloc(GetProcessHeap(),0,sizeof(K32EVENT));
evt->header.type = K32OBJ_EVENT;
evt->header.refcount = 1;
if (name)
K32OBJ_AddName(&(evt->header),name);
handle = PROCESS_AllocHandle(&(evt->header),0);
if (handle != INVALID_HANDLE_VALUE32)
return handle;
K32OBJ_DecCount(&(evt->header)); /* also frees name */
HeapFree(GetProcessHeap(),0,evt);
return 0;
}
/***********************************************************************
* CreateEventW (KERNEL32.43)
*/
HANDLE32 CreateEvent32W(SECURITY_ATTRIBUTES *sa, BOOL32 au, BOOL32 on,LPCWSTR name)
{
LPSTR nameA=name?HEAP_strdupWtoA(GetProcessHeap(),0,name):NULL;
HANDLE32 ret = CreateEvent32A(sa,au,on,nameA);
if (name) HeapFree(GetProcessHeap(),0,nameA);
return ret;
}
/***********************************************************************
* OpenEventA (KERNEL32.394)
*/
HANDLE32 OpenEvent32A(DWORD desiredaccess,BOOL32 inherithandle,LPCSTR name) {
K32OBJ *obj = K32OBJ_FindName( name );
if (obj) {
if (obj->type == K32OBJ_EVENT)
return PROCESS_AllocHandle( obj,0 );
SetLastError( ERROR_DUP_NAME );
return 0;
}
return 0;
}
/***********************************************************************
* OpenEventW (KERNEL32.395)
*/
HANDLE32 OpenEvent32W(DWORD desiredaccess,BOOL32 inherithandle,LPCWSTR name) {
LPSTR nameA = name?HEAP_strdupWtoA(GetProcessHeap(),0,name):NULL;
HANDLE32 ret = OpenEvent32A(desiredaccess,inherithandle,nameA);
if (name) HeapFree(GetProcessHeap(),0,nameA);
return ret;
}
/***********************************************************************
* SetEvent (KERNEL32.487)
*/
BOOL32 SetEvent (HANDLE32 h)
{
fprintf(stderr,"SetEvent(%d) stub\n",h);
return 0;
}
/***********************************************************************
@ -51,13 +309,15 @@ BOOL32 SetEvent (HANDLE32 h)
*/
BOOL32 ResetEvent (HANDLE32 h)
{
fprintf(stderr,"ResetEvent(%d) stub\n",h);
return 0;
}
/***********************************************************************
* WaitForSingleObject (KERNEL32.561)
*/
DWORD WaitForSingleObject(HANDLE32 h, DWORD a)
DWORD WaitForSingleObject(HANDLE32 h, DWORD timeout)
{
fprintf(stderr,"WaitForSingleObject(%d,%ld) stub\n",h,timeout);
return 0;
}
/***********************************************************************
@ -65,8 +325,9 @@ DWORD WaitForSingleObject(HANDLE32 h, DWORD a)
*/
BOOL32 DuplicateHandle(HANDLE32 a, HANDLE32 b, HANDLE32 c, HANDLE32 * d, DWORD e, BOOL32 f, DWORD g)
{
fprintf(stderr,"DuplicateHandle(%d,%d,%d,%p,%ld,%d,%ld) stub\n",a,b,c,d,e,f,g);
*d = b;
return 1;
return TRUE;
}
@ -89,7 +350,7 @@ HINSTANCE32 LoadLibrary32A(LPCSTR libname)
}
/* Obtain module handle and call initialization function */
#ifndef WINELIB
if (handle >= (HINSTANCE32)32) PE_InitializeDLLs( GetExePtr(handle));
if (handle >= (HINSTANCE32)32) PE_InitializeDLLs( GetExePtr(handle), DLL_PROCESS_ATTACH, NULL);
#endif
return handle;
}
@ -134,11 +395,33 @@ BOOL32 GetProcessAffinityMask(HANDLE32 hProcess, LPDWORD lpProcessAffinityMask,
/**********************************************************************
* SetThreadAffinityMask
* Works now like the Windows95 (no MP support) version
*/
BOOL32 SetThreadAffinityMask(HANDLE32 hThread, DWORD dwThreadAffinityMask)
{
dprintf_task(stddeb,"SetThreadAffinityMask(%x,%lx)\n",hThread,
dwThreadAffinityMask);
/* FIXME: We let it fail */
return 1;
THDB *thdb = (THDB*)PROCESS_GetObjPtr(hThread,K32OBJ_THREAD);
if (!thdb)
return FALSE;
if (dwThreadAffinityMask!=1) {
fprintf(stderr,"SetThreadAffinityMask(%d,%ld), only 1 processor supported.\n",(int)hThread,dwThreadAffinityMask);
K32OBJ_DecCount((K32OBJ*)thdb);
return FALSE;
}
K32OBJ_DecCount((K32OBJ*)thdb);
return TRUE;
}
BOOL32
CreateProcess32A(
LPCSTR appname,LPSTR cmdline,LPSECURITY_ATTRIBUTES processattributes,
LPSECURITY_ATTRIBUTES threadattributes,BOOL32 inherithandles,
DWORD creationflags,LPVOID env,LPCSTR curdir,
LPSTARTUPINFO32A startupinfo,LPPROCESS_INFORMATION processinfo
) {
fprintf(stderr,"CreateProcess(%s,%s,%p,%p,%d,%08lx,%p,%s,%p,%p)\n",
appname,cmdline,processattributes,threadattributes,
inherithandles,creationflags,env,curdir,startupinfo,processinfo
);
return TRUE;
}

View File

@ -160,7 +160,7 @@ void InitializeCriticalSection(CRITICAL_SECTION *pcritical)
void DeleteCriticalSection(CRITICAL_SECTION *pcritical)
{
semctl((int) pcritical->LockSemaphore,0,IPC_RMID,NULL);
semctl((int) pcritical->LockSemaphore,0,IPC_RMID,(union semun)NULL);
pcritical->Reserved=-1;
}

View File

@ -123,10 +123,10 @@ BOOL32 SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION tzinfo)
struct timezone tz;
tz.tz_minuteswest = tzinfo->Bias;
#ifdef __EMX__ /* FIXME */
tz.tz_dsttime = 0;
#else
#ifdef DST_NONE
tz.tz_dsttime = DST_NONE;
#else
tz.tz_dsttime = 0;
#endif
return !settimeofday(NULL, &tz);
}

View File

@ -185,7 +185,7 @@ static BOOL32 CLASS_FreeClass( CLASS *classPtr )
if (classPtr->hbrBackground) DeleteObject32( classPtr->hbrBackground );
GlobalDeleteAtom( classPtr->atomName );
CLASS_SetMenuNameA( classPtr, NULL );
WINPROC_FreeProc( classPtr->winproc );
WINPROC_FreeProc( classPtr->winproc, WIN_PROC_CLASS );
HeapFree( SystemHeap, 0, classPtr );
return TRUE;
}
@ -291,7 +291,7 @@ static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance,
classPtr->dce = (style & CS_CLASSDC) ?
DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL;
WINPROC_SetProc( &classPtr->winproc, wndProc, wndProcType );
WINPROC_SetProc( &classPtr->winproc, wndProc, wndProcType, WIN_PROC_CLASS);
/* Other values must be set by caller */
@ -743,7 +743,7 @@ LONG SetClassLong16( HWND16 hwnd, INT16 offset, LONG newval )
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 );
WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval,
WIN_PROC_16 );
WIN_PROC_16, WIN_PROC_CLASS );
return retval;
case GCL_MENUNAME:
return SetClassLong32A( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) );
@ -783,7 +783,7 @@ LONG SetClassLong32A( HWND32 hwnd, INT32 offset, LONG newval )
retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc,
WIN_PROC_32A );
WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval,
WIN_PROC_32A );
WIN_PROC_32A, WIN_PROC_CLASS );
return retval;
case GCL_HBRBACKGROUND:
case GCL_HCURSOR:
@ -819,7 +819,7 @@ LONG SetClassLong32W( HWND32 hwnd, INT32 offset, LONG newval )
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W );
WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval,
WIN_PROC_32W );
WIN_PROC_32W, WIN_PROC_CLASS );
return retval;
case GCL_MENUNAME:
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;

View File

@ -727,3 +727,21 @@ BOOL16 DCHook( HDC16 hDC, WORD code, DWORD data, LPARAM lParam )
return 0;
}
/***********************************************************************
* LockWindowUpdate16 (USER.294)
*/
BOOL16 LockWindowUpdate16( HWND16 hwnd )
{
return LockWindowUpdate32( hwnd );
}
/***********************************************************************
* LockWindowUpdate32 (USER32.377)
*/
BOOL32 LockWindowUpdate32( HWND32 hwnd )
{
/* FIXME? DCX_LOCKWINDOWUPDATE is unimplemented */
return TRUE;
}

View File

@ -114,8 +114,6 @@ static BOOL32 DEFDLG_SetDefButton( HWND32 hwndDlg, DIALOGINFO *dlgInfo,
static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam, DIALOGINFO *dlgInfo )
{
HWND32 hwndDefId;
switch(msg)
{
case WM_ERASEBKGND:
@ -147,9 +145,9 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
}
/* Delete window procedure */
WINPROC_FreeProc( dlgInfo->dlgProc );
WINPROC_FreeProc( dlgInfo->dlgProc, WIN_PROC_WINDOW );
dlgInfo->dlgProc = (HWINDOWPROC)0;
dlgInfo->fEnd = TRUE; /* just in case */
dlgInfo->flags |= DF_END; /* just in case */
/* Window clean-up */
return DefWindowProc32A( hwnd, msg, wParam, lParam );
@ -168,18 +166,20 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
return 0;
case DM_SETDEFID:
if (dlgInfo->fEnd) return 1;
if (dlgInfo->flags & DF_END) return 1;
DEFDLG_SetDefButton( hwnd, dlgInfo,
wParam ? GetDlgItem32( hwnd, wParam ) : 0 );
return 1;
case DM_GETDEFID:
if (dlgInfo->fEnd) return 0;
if (dlgInfo->idResult)
return MAKELONG( dlgInfo->idResult, DC_HASDEFID );
hwndDefId = DEFDLG_FindDefButton( hwnd );
if (hwndDefId)
return MAKELONG( GetDlgCtrlID32( hwndDefId ), DC_HASDEFID);
{
HWND32 hwndDefId;
if (dlgInfo->flags & DF_END) return 0;
if (dlgInfo->idResult)
return MAKELONG( dlgInfo->idResult, DC_HASDEFID );
if ((hwndDefId = DEFDLG_FindDefButton( hwnd )))
return MAKELONG( GetDlgCtrlID32( hwndDefId ), DC_HASDEFID);
}
return 0;
case WM_NEXTDLGCTL:
@ -192,6 +192,32 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
}
return 0;
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
{
HWND32 hwndFocus = GetFocus32();
if (hwndFocus)
{
WND *wnd = WIN_FindWndPtr( hwndFocus );
if( wnd )
{
/* always make combo box hide its listbox control */
if( WIDGETS_IsControl32( wnd, BIC32_COMBO ) )
SendMessage32A( hwndFocus, CB_SHOWDROPDOWN32,
FALSE, 0 );
else if( WIDGETS_IsControl32( wnd, BIC32_EDIT ) &&
WIDGETS_IsControl32( wnd->parent,
BIC32_COMBO ))
SendMessage32A( wnd->parent->hwndSelf,
CB_SHOWDROPDOWN32, FALSE, 0 );
}
}
}
return DefWindowProc32A( hwnd, msg, wParam, lParam );
case WM_GETFONT:
return dlgInfo->hUserFont;
@ -204,9 +230,9 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
}
/***********************************************************************
* DEFDLG_Signoff
* DEFDLG_Epilog
*/
static LRESULT DEFDLG_Signoff(DIALOGINFO* dlgInfo, UINT32 msg, BOOL16 fResult)
static LRESULT DEFDLG_Epilog(DIALOGINFO* dlgInfo, UINT32 msg, BOOL16 fResult)
{
/* see SDK 3.1 */
@ -254,6 +280,9 @@ LRESULT DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam )
case WM_GETFONT:
case WM_CLOSE:
case WM_NCDESTROY:
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
return DEFDLG_Proc( (HWND32)hwnd, msg,
(WPARAM32)wParam, lParam, dlgInfo );
case WM_INITDIALOG:
@ -266,7 +295,7 @@ LRESULT DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam )
return DefWindowProc16( hwnd, msg, wParam, lParam );
}
}
return DEFDLG_Signoff(dlgInfo, msg, result);
return DEFDLG_Epilog(dlgInfo, msg, result);
}
@ -305,6 +334,9 @@ LRESULT DefDlgProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case WM_GETFONT:
case WM_CLOSE:
case WM_NCDESTROY:
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
return DEFDLG_Proc( (HWND32)hwnd, msg,
(WPARAM32)wParam, lParam, dlgInfo );
case WM_INITDIALOG:
@ -317,7 +349,7 @@ LRESULT DefDlgProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
return DefWindowProc32A( hwnd, msg, wParam, lParam );
}
}
return DEFDLG_Signoff(dlgInfo, msg, result);
return DEFDLG_Epilog(dlgInfo, msg, result);
}
@ -356,6 +388,9 @@ LRESULT DefDlgProc32W( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case WM_GETFONT:
case WM_CLOSE:
case WM_NCDESTROY:
case WM_ENTERMENULOOP:
case WM_LBUTTONDOWN:
case WM_NCLBUTTONDOWN:
return DEFDLG_Proc( (HWND32)hwnd, msg,
(WPARAM32)wParam, lParam, dlgInfo );
case WM_INITDIALOG:
@ -368,5 +403,5 @@ LRESULT DefDlgProc32W( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
return DefWindowProc32W( hwnd, msg, wParam, lParam );
}
}
return DEFDLG_Signoff(dlgInfo, msg, result);
return DEFDLG_Epilog(dlgInfo, msg, result);
}

View File

@ -263,7 +263,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam,
case WM_SYSKEYDOWN:
if( HIWORD(lParam) & KEYDATA_ALT )
{
{
/* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
if( wParam == VK_MENU && !iMenuSysKey )
iMenuSysKey = 1;
@ -272,13 +272,20 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam,
iF10Key = 0;
}
if( wParam == VK_F4 ) /* try to close the window */
{
HWND32 hWnd = WIN_GetTopParent( wndPtr->hwndSelf );
wndPtr = WIN_FindWndPtr( hWnd );
if( wndPtr && !(wndPtr->class->style & CS_NOCLOSE) )
PostMessage16( hWnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
}
}
else if( wParam == VK_F10 )
iF10Key = 1;
iF10Key = 1;
else
if( wParam == VK_ESCAPE && (GetKeyState32(VK_SHIFT) & 0x8000))
SendMessage16( wndPtr->hwndSelf, WM_SYSCOMMAND,
(WPARAM16)SC_KEYMENU, (LPARAM)VK_SPACE);
if( wParam == VK_ESCAPE && (GetKeyState32(VK_SHIFT) & 0x8000))
SendMessage16( wndPtr->hwndSelf, WM_SYSCOMMAND,
(WPARAM16)SC_KEYMENU, (LPARAM)VK_SPACE);
break;
case WM_KEYUP:

View File

@ -582,13 +582,14 @@ HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
/* Initialise dialog extra data */
dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
WINPROC_SetProc( &dlgInfo->dlgProc, dlgProc, procType );
WINPROC_SetProc( &dlgInfo->dlgProc, dlgProc, procType, WIN_PROC_WINDOW );
dlgInfo->hUserFont = hFont;
dlgInfo->hMenu = hMenu;
dlgInfo->xBaseUnit = xUnit;
dlgInfo->yBaseUnit = yUnit;
dlgInfo->msgResult = 0;
dlgInfo->msgResult = 0;
dlgInfo->idResult = 0;
dlgInfo->flags = 0;
dlgInfo->hDialogHeap = 0;
if (dlgInfo->hUserFont)
@ -596,21 +597,21 @@ HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
/* Create controls */
if (!DIALOG_CreateControls( wndPtr, dlgTemplate, template.nbItems,
if (DIALOG_CreateControls( wndPtr, dlgTemplate, template.nbItems,
hInst, win32Template ))
{
DestroyWindow32( hwnd );
return 0;
/* Send initialisation messages and set focus */
dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE );
if (SendMessage32A( hwnd, WM_INITDIALOG,
(WPARAM32)dlgInfo->hwndFocus, param ))
SetFocus32( dlgInfo->hwndFocus );
if (template.style & WS_VISIBLE) ShowWindow32( hwnd, SW_SHOW );
return hwnd;
}
/* Send initialisation messages and set focus */
dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE );
if (SendMessage32A( hwnd, WM_INITDIALOG,
(WPARAM32)dlgInfo->hwndFocus, param ))
SetFocus32( dlgInfo->hwndFocus );
if (template.style & WS_VISIBLE) ShowWindow32( hwnd, SW_SHOW );
return hwnd;
if( IsWindow32(hwnd) ) DestroyWindow32( hwnd );
return 0;
}
@ -750,7 +751,7 @@ INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner )
TranslateMessage16( &msg );
DispatchMessage16( &msg );
}
if (dlgInfo->fEnd) break;
if (dlgInfo->flags & DF_END) break;
}
retval = dlgInfo->idResult;
EnableWindow32( owner, TRUE );
@ -874,9 +875,14 @@ BOOL32 EndDialog32( HWND32 hwnd, INT32 retval )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
DIALOGINFO * dlgInfo = (DIALOGINFO *)wndPtr->wExtra;
dlgInfo->idResult = retval;
dlgInfo->fEnd = TRUE;
dprintf_dialog(stddeb, "EndDialog: %04x %d\n", hwnd, retval );
if( dlgInfo )
{
dlgInfo->idResult = retval;
dlgInfo->flags |= DF_END;
}
return TRUE;
}

View File

@ -4,6 +4,7 @@
* Copyright 1993, 1994 Alexandre Julliard
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <X11/Xlib.h>
@ -26,6 +27,8 @@
#include "debug.h"
#include "xmalloc.h"
#define MAX_DRAWLINES 8
/***********************************************************************
* LineTo16 (GDI.19)
*/
@ -231,8 +234,8 @@ INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
{
HBRUSH16 prevBrush;
/* coordinates are logical so we cannot fast-check rectangle
* - do it in PatBlt() after LPtoDP().
/* coordinates are logical so we cannot fast-check 'rect',
* it will be done later in the PatBlt().
*/
if (!(prevBrush = SelectObject16( hdc, hbrush ))) return 0;
@ -512,75 +515,6 @@ void DrawFocusRect32( HDC32 hdc, const RECT32* rc )
}
/**********************************************************************
* GRAPH_DrawBitmap
*
* Short-cut function to blit a bitmap into a device.
* Faster than CreateCompatibleDC() + SelectBitmap() + BitBlt() + DeleteDC().
*/
BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, int xdest, int ydest,
int xsrc, int ysrc, int width, int height )
{
BITMAPOBJ *bmp;
DC *dc;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return FALSE;
XSetFunction( display, dc->u.x.gc, GXcopy );
if (bmp->bitmap.bmBitsPixel == 1)
{
XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
XSetBackground( display, dc->u.x.gc, dc->w.textPixel );
XCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height,
dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest, 1 );
return TRUE;
}
else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
{
XCopyArea( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height,
dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest );
return TRUE;
}
else return FALSE;
}
/**********************************************************************
* GRAPH_DrawReliefRect (Not a MSWin Call)
*/
void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size,
INT32 shadow_size, BOOL32 pressed )
{
HBRUSH32 hbrushOld;
INT32 i;
hbrushOld = SelectObject32(hdc, pressed ? sysColorObjects.hbrushBtnShadow :
sysColorObjects.hbrushBtnHighlight );
for (i = 0; i < highlight_size; i++)
{
PatBlt32( hdc, rect->left + i, rect->top,
1, rect->bottom - rect->top - i, PATCOPY );
PatBlt32( hdc, rect->left, rect->top + i,
rect->right - rect->left - i, 1, PATCOPY );
}
SelectObject32( hdc, pressed ? sysColorObjects.hbrushBtnHighlight :
sysColorObjects.hbrushBtnShadow );
for (i = 0; i < shadow_size; i++)
{
PatBlt32( hdc, rect->right - i - 1, rect->top + i,
1, rect->bottom - rect->top - i, PATCOPY );
PatBlt32( hdc, rect->left + i, rect->bottom - i - 1,
rect->right - rect->left - i, 1, PATCOPY );
}
SelectObject32( hdc, hbrushOld );
}
/**********************************************************************
* Polyline16 (GDI.37)
*/
@ -833,3 +767,181 @@ BOOL32 DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
hdc,rc,edge,flags );
return TRUE;
}
/******************************* X-specific shortcuts to speed up WM code.
* `----------------------------------------
*
* Caveat: no coordinate transformations except origin translation.
*/
/**********************************************************************
*
* GRAPH_DrawLines
*
* Draw multiple unconnected lines (limited by MAX_DRAWLINES).
*/
BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen )
{
BOOL32 bRet = FALSE;
DC* dc;
assert( N <= MAX_DRAWLINES );
if( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPEN32 hPrevPen = 0;
if( hPen ) hPrevPen = SelectObject32( hdc, hPen );
if( DC_SetupGCForPen( dc ) )
{
XSegment l[MAX_DRAWLINES];
INT32 i, j;
for( i = 0; i < N; i++ )
{
j = 2 * i;
l[i].x1 = pXY[j].x + dc->w.DCOrgX;
l[i].x2 = pXY[j + 1].x + dc->w.DCOrgX;
l[i].y1 = pXY[j].y + dc->w.DCOrgY;
l[i].y2 = pXY[j + 1].y + dc->w.DCOrgY;
}
XDrawSegments( display, dc->u.x.drawable, dc->u.x.gc, l, N );
bRet = TRUE;
}
if( hPrevPen ) SelectObject32( hdc, hPrevPen );
}
return bRet;
}
/**********************************************************************
*
* GRAPH_DrawBitmap
*
* Short-cut function to blit a bitmap into a device.
* Faster than CreateCompatibleDC() + SelectBitmap() + BitBlt() + DeleteDC().
*/
BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
INT32 xdest, INT32 ydest, INT32 xsrc, INT32 ysrc,
INT32 width, INT32 height )
{
BITMAPOBJ *bmp;
DC *dc;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return FALSE;
XSetFunction( display, dc->u.x.gc, GXcopy );
if (bmp->bitmap.bmBitsPixel == 1)
{
XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
XSetBackground( display, dc->u.x.gc, dc->w.textPixel );
XCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height,
dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest, 1 );
return TRUE;
}
else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
{
XCopyArea( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height,
dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest );
return TRUE;
}
else return FALSE;
}
/**********************************************************************
* GRAPH_DrawReliefRect
*
* Used in the standard control code for button edge drawing.
*/
void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size,
INT32 shadow_size, BOOL32 pressed )
{
DC* dc;
HBRUSH32 hPrevBrush;
INT32 w, h;
RECT32 r = *rect;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return;
OffsetRect32( &r, dc->w.DCOrgX, dc->w.DCOrgY);
h = rect->bottom - rect->top; w = rect->right - rect->left;
hPrevBrush = SelectObject32(hdc, pressed ? sysColorObjects.hbrushBtnShadow :
sysColorObjects.hbrushBtnHighlight );
if ( DC_SetupGCForBrush( dc ) )
{
INT32 i;
XSetFunction( display, dc->u.x.gc, GXcopy );
for (i = 0; i < highlight_size; i++)
{
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
r.left + i, r.top, 1, h - i );
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
r.left, r.top + i, w - i, 1 );
}
}
SelectObject32( hdc, pressed ? sysColorObjects.hbrushBtnHighlight :
sysColorObjects.hbrushBtnShadow );
if ( DC_SetupGCForBrush( dc ) )
{
INT32 i;
XSetFunction( display, dc->u.x.gc, GXcopy );
for (i = 0; i < shadow_size; i++)
{
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
r.right - i - 1, r.top + i, 1, h - i );
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
r.left + i, r.bottom - i - 1, w - i, 1 );
}
}
SelectObject32( hdc, hPrevBrush );
}
/**********************************************************************
* GRAPH_DrawRectangle
*/
void GRAPH_DrawRectangle( HDC32 hdc, INT32 x, INT32 y,
INT32 w, INT32 h, HPEN32 hPen )
{
DC* dc;
if( (dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC )) )
{
HPEN32 hPrevPen = 0;
if( hPen ) hPrevPen = SelectObject32( hdc, hPen );
if( DC_SetupGCForPen( dc ) )
XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
x + dc->w.DCOrgX, y + dc->w.DCOrgY, w - 1, h - 1);
if( hPrevPen ) SelectObject32( hdc, hPrevPen );
}
}
/**********************************************************************
* GRAPH_SelectClipMask
*/
BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMonoBitmap, INT32 x, INT32 y)
{
BITMAPOBJ *bmp = NULL;
DC *dc;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if ( hMonoBitmap )
{
if ( !(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hMonoBitmap, BITMAP_MAGIC))
|| bmp->bitmap.bmBitsPixel != 1 ) return FALSE;
XSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX + x, dc->w.DCOrgY + y);
}
XSetClipMask( display, dc->u.x.gc, (bmp) ? bmp->pixmap : None );
return TRUE;
}

View File

@ -575,12 +575,12 @@ static void HOOK_UnMap32To16Common(INT32 id, INT32 code, WPARAM32 wParamOrig,
case WH_CALLWNDPROC:
{
void (*localUnMap)(UINT32, WPARAM16, LPARAM)
void (*localUnMap)(UINT32, WPARAM16, LPARAM, LRESULT)
= (bA) ? WINPROC_UnmapMsg32ATo16 : WINPROC_UnmapMsg32WTo16;
LPCWPSTRUCT16 lpcwp16 = (LPCWPSTRUCT16)PTR_SEG_TO_LIN(lParam);
LPCWPSTRUCT32 lpcwp32 = (LPCWPSTRUCT32)lParamOrig;
(*localUnMap)(lpcwp32->message, lpcwp16->wParam, lpcwp16->lParam );
(*localUnMap)(lpcwp32->message, lpcwp16->wParam, lpcwp16->lParam, 0 );
SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) );
break;
}

View File

@ -543,7 +543,7 @@ WORD GetAsyncKeyState32(INT32 nKey)
break;
default:
retval = AsyncKeyStateTable[nKey] |
(InputKeyStateTable[nKey] ? 0x8000 : 0);
((InputKeyStateTable[nKey] & 0x80) ? 0x8000 : 0);
break;
}

View File

@ -606,7 +606,7 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg,
queue->wakeBits &= ~QS_SMRESULT;
if( queue->smResult != &qCtrl )
dprintf_msg(stddeb,"%*ssm: weird scenes inside the goldmine!\n", prevSMRL, "");
dprintf_sendmsg(stddeb,"%*ssm: weird scenes inside the goldmine!\n", prevSMRL, "");
}
queue->smResultInit = NULL;
@ -675,8 +675,6 @@ static BOOL32 MSG_PeekMessage( LPMSG16 msg, HWND16 hwnd, WORD first, WORD last,
mask = QS_POSTMESSAGE | QS_SENDMESSAGE; /* Always selected */
if (first || last)
{
/* MSWord gets stuck if we do not check for nonclient mouse messages */
if ((first <= WM_KEYLAST) && (last >= WM_KEYFIRST)) mask |= QS_KEY;
if ( ((first <= WM_MOUSELAST) && (last >= WM_MOUSEFIRST)) ||
((first <= WM_NCMOUSELAST) && (last >= WM_NCMOUSEFIRST)) ) mask |= QS_MOUSE;
@ -700,11 +698,7 @@ static BOOL32 MSG_PeekMessage( LPMSG16 msg, HWND16 hwnd, WORD first, WORD last,
while (msgQueue->wakeBits & QS_SENDMESSAGE)
QUEUE_ReceiveMessage( msgQueue );
/* Now handle a WM_QUIT message
*
* FIXME: PostQuitMessage() should post WM_QUIT and
* set QS_POSTMESSAGE wakebit instead of this.
*/
/* Now handle a WM_QUIT message */
if (msgQueue->wPostQMsg &&
(!first || WM_QUIT >= first) &&
@ -1419,7 +1413,6 @@ LONG DispatchMessage16( const MSG16* msg )
{
if (msg->lParam)
{
/* HOOK_CallHooks16( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
return CallWindowProc16( (WNDPROC16)msg->lParam, msg->hwnd,
msg->message, msg->wParam, GetTickCount() );
}
@ -1430,7 +1423,6 @@ LONG DispatchMessage16( const MSG16* msg )
if (!wndPtr->winproc) return 0;
painting = (msg->message == WM_PAINT);
if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT;
/* HOOK_CallHooks16( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
SPY_EnterMessage( SPY_DISPATCHMESSAGE16, msg->hwnd, msg->message,
msg->wParam, msg->lParam );

View File

@ -500,10 +500,10 @@ static void NC_DrawMinButton( HWND32 hwnd, HDC16 hdc, BOOL32 down )
* Draw a window frame inside the given rectangle, and update the rectangle.
* The correct pen for the frame must be selected in the DC.
*/
static void NC_DrawFrame( HDC16 hdc, RECT16 *rect, BOOL32 dlgFrame,
static void NC_DrawFrame( HDC32 hdc, RECT32 *rect, BOOL32 dlgFrame,
BOOL32 active )
{
short width, height, tmp;
INT32 width, height;
if (dlgFrame)
{
@ -532,43 +532,45 @@ static void NC_DrawFrame( HDC16 hdc, RECT16 *rect, BOOL32 dlgFrame,
if (dlgFrame)
{
InflateRect16( rect, -width, -height );
return;
}
InflateRect32( rect, -width, -height );
}
else
{
POINT32 lpt[16];
/* Draw inner rectangle */
MoveTo( hdc, rect->left+width, rect->top+height );
LineTo32( hdc, rect->right-width-1, rect->top+height );
LineTo32( hdc, rect->right-width-1, rect->bottom-height-1 );
LineTo32( hdc, rect->left+width, rect->bottom-height-1 );
LineTo32( hdc, rect->left+width, rect->top+height );
GRAPH_DrawRectangle( hdc, rect->left + width,
rect->top + height,
rect->right - rect->left - 2*width ,
rect->bottom - rect->top - 2*height,
(HPEN32)0 );
/* Draw the decorations */
tmp = rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
MoveTo( hdc, rect->left, tmp);
LineTo32( hdc, rect->left+width, tmp );
MoveTo( hdc, rect->right-width-1, tmp );
LineTo32( hdc, rect->right-1, tmp );
tmp = rect->bottom - 1 - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE;
MoveTo( hdc, rect->left, tmp );
LineTo32( hdc, rect->left+width, tmp );
MoveTo( hdc, rect->right-width-1, tmp );
LineTo32( hdc, rect->right-1, tmp );
lpt[4].x = lpt[0].x = rect->left;
lpt[5].x = lpt[1].x = rect->left + width;
lpt[6].x = lpt[2].x = rect->right - width - 1;
lpt[7].x = lpt[3].x = rect->right - 1;
tmp = rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
MoveTo( hdc, tmp, rect->top );
LineTo32( hdc, tmp, rect->top+height );
MoveTo( hdc, tmp, rect->bottom-height-1 );
LineTo32( hdc, tmp, rect->bottom-1 );
lpt[0].y = lpt[1].y = lpt[2].y = lpt[3].y =
rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
lpt[4].y = lpt[5].y = lpt[6].y = lpt[7].y =
rect->bottom - 1 - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE;
tmp = rect->right - 1 - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE;
MoveTo( hdc, tmp, rect->top );
LineTo32( hdc, tmp, rect->top+height );
MoveTo( hdc, tmp, rect->bottom-height-1 );
LineTo32( hdc, tmp, rect->bottom-1 );
lpt[8].x = lpt[9].x = lpt[10].x = lpt[11].x =
rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
lpt[12].x = lpt[13].x = lpt[14].x = lpt[15].x =
rect->right - 1 - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE;
InflateRect16( rect, -width-1, -height-1 );
lpt[12].y = lpt[8].y = rect->top;
lpt[13].y = lpt[9].y = rect->top + height;
lpt[14].y = lpt[10].y = rect->bottom - height - 1;
lpt[15].y = lpt[11].y = rect->bottom - 1;
GRAPH_DrawLines( hdc, lpt, 8, (HPEN32)0 ); /* 8 is the maximum */
InflateRect32( rect, -width - 1, -height - 1 );
}
}
@ -591,10 +593,10 @@ static void NC_DrawMovingFrame( HDC16 hdc, RECT16 *rect, BOOL32 thickframe )
* Draw the window caption.
* The correct pen for the window frame must be selected in the DC.
*/
static void NC_DrawCaption( HDC16 hdc, RECT16 *rect, HWND32 hwnd,
static void NC_DrawCaption( HDC32 hdc, RECT32 *rect, HWND32 hwnd,
DWORD style, BOOL32 active )
{
RECT16 r = *rect;
RECT32 r = *rect;
WND * wndPtr = WIN_FindWndPtr( hwnd );
char buffer[256];
@ -644,7 +646,7 @@ static void NC_DrawCaption( HDC16 hdc, RECT16 *rect, HWND32 hwnd,
r.right -= SYSMETRICS_CXSIZE + 1;
}
FillRect16( hdc, &r, active ? sysColorObjects.hbrushActiveCaption :
FillRect32( hdc, &r, active ? sysColorObjects.hbrushActiveCaption :
sysColorObjects.hbrushInactiveCaption );
if (GetWindowText32A( hwnd, buffer, sizeof(buffer) ))
@ -652,8 +654,8 @@ static void NC_DrawCaption( HDC16 hdc, RECT16 *rect, HWND32 hwnd,
if (active) SetTextColor32( hdc, GetSysColor32( COLOR_CAPTIONTEXT ) );
else SetTextColor32( hdc, GetSysColor32( COLOR_INACTIVECAPTIONTEXT ) );
SetBkMode32( hdc, TRANSPARENT );
DrawText16( hdc, buffer, -1, &r,
DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );
DrawText32A( hdc, buffer, -1, &r,
DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_NOPREFIX );
}
}
@ -666,7 +668,7 @@ static void NC_DrawCaption( HDC16 hdc, RECT16 *rect, HWND32 hwnd,
void NC_DoNCPaint( HWND32 hwnd, HRGN32 clip, BOOL32 suppress_menupaint )
{
HDC32 hdc;
RECT16 rect;
RECT32 rect;
BOOL32 active;
WND *wndPtr = WIN_FindWndPtr( hwnd );
@ -701,12 +703,9 @@ void NC_DoNCPaint( HWND32 hwnd, HRGN32 clip, BOOL32 suppress_menupaint )
if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) ||
(wndPtr->dwExStyle & WS_EX_DLGMODALFRAME))
{
MoveTo( hdc, 0, 0 );
LineTo32( hdc, rect.right-1, 0 );
LineTo32( hdc, rect.right-1, rect.bottom-1 );
LineTo32( hdc, 0, rect.bottom-1 );
LineTo32( hdc, 0, 0 );
InflateRect16( &rect, -1, -1 );
GRAPH_DrawRectangle( hdc, 0, 0,
rect.right, rect.bottom, (HPEN32)0 );
InflateRect32( &rect, -1, -1 );
}
if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
@ -716,7 +715,7 @@ void NC_DoNCPaint( HWND32 hwnd, HRGN32 clip, BOOL32 suppress_menupaint )
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
{
RECT16 r = rect;
RECT32 r = rect;
r.bottom = rect.top + SYSMETRICS_CYSIZE;
rect.top += SYSMETRICS_CYSIZE + SYSMETRICS_CYBORDER;
NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active );
@ -725,8 +724,7 @@ void NC_DoNCPaint( HWND32 hwnd, HRGN32 clip, BOOL32 suppress_menupaint )
if (HAS_MENU(wndPtr))
{
RECT32 r;
CONV_RECT16TO32( &rect, &r );
RECT32 r = rect;
r.bottom = rect.top + SYSMETRICS_CYMENU; /* default height */
rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
}
@ -742,10 +740,10 @@ void NC_DoNCPaint( HWND32 hwnd, HRGN32 clip, BOOL32 suppress_menupaint )
if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL))
{
RECT16 r = rect;
RECT32 r = rect;
r.left = r.right - SYSMETRICS_CXVSCROLL + 1;
r.top = r.bottom - SYSMETRICS_CYHSCROLL + 1;
FillRect16( hdc, &r, sysColorObjects.hbrushScrollbar );
FillRect32( hdc, &r, sysColorObjects.hbrushScrollbar );
}
ReleaseDC32( hwnd, hdc );

View File

@ -235,7 +235,7 @@ HBRUSH16 GetControlBrush( HWND16 hwnd, HDC16 hdc, UINT16 control )
/***********************************************************************
* PAINT_RedrawWindow
*
* Note: Windows uses WM_SYNCPAINT to cut down the number of intertask
* FIXME: Windows uses WM_SYNCPAINT to cut down the number of intertask
* SendMessage() calls. From SDK:
* This message avoids lots of inter-app message traffic
* by switching to the other task and continuing the
@ -256,8 +256,8 @@ BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate,
if (!hwnd) hwnd = GetDesktopWindow32();
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
if (!IsWindowVisible32(hwnd) || (wndPtr->flags & WIN_NO_REDRAW))
return TRUE; /* No redraw needed */
if (!WIN_IsWindowDrawable( wndPtr, !(flags & RDW_FRAME) )
|| (wndPtr->flags & WIN_NO_REDRAW)) return TRUE; /* No redraw needed */
bIcon = (wndPtr->dwStyle & WS_MINIMIZE && wndPtr->class->hIcon);
if (rectUpdate)
@ -455,13 +455,7 @@ BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate,
BOOL32 RedrawWindow32( HWND32 hwnd, const RECT32 *rectUpdate,
HRGN32 hrgnUpdate, UINT32 flags )
{
WND* wnd = WIN_FindWndPtr( hwnd );
/* check if there is something to redraw */
return ( wnd && WIN_IsWindowDrawable( wnd, !(flags & RDW_FRAME) ) )
? PAINT_RedrawWindow( hwnd, rectUpdate, hrgnUpdate, flags, 0 )
: 1;
return PAINT_RedrawWindow( hwnd, rectUpdate, hrgnUpdate, flags, 0 );
}
@ -477,7 +471,8 @@ BOOL16 RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
CONV_RECT16TO32( rectUpdate, &r );
return (BOOL16)RedrawWindow32( (HWND32)hwnd, &r, hrgnUpdate, flags );
}
return (BOOL16)RedrawWindow32( (HWND32)hwnd, NULL, hrgnUpdate, flags );
return (BOOL16)PAINT_RedrawWindow( (HWND32)hwnd, NULL,
(HRGN32)hrgnUpdate, flags, 0 );
}
@ -486,25 +481,24 @@ BOOL16 RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate,
*/
void UpdateWindow16( HWND16 hwnd )
{
RedrawWindow32( hwnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN );
PAINT_RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN, 0 );
}
/***********************************************************************
* UpdateWindow32 (USER32.566)
*/
void UpdateWindow32( HWND32 hwnd )
{
RedrawWindow32( hwnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN );
PAINT_RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN, 0 );
}
/***********************************************************************
* InvalidateRgn16 (USER.126)
*/
void InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
{
RedrawWindow32(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
PAINT_RedrawWindow((HWND32)hwnd, NULL, (HRGN32)hrgn,
RDW_INVALIDATE | (erase ? RDW_ERASE : 0), 0 );
}
@ -513,7 +507,7 @@ void InvalidateRgn16( HWND16 hwnd, HRGN16 hrgn, BOOL16 erase )
*/
void InvalidateRgn32( HWND32 hwnd, HRGN32 hrgn, BOOL32 erase )
{
RedrawWindow32(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
PAINT_RedrawWindow(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0), 0 );
}
@ -531,7 +525,8 @@ void InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase )
*/
void InvalidateRect32( HWND32 hwnd, const RECT32 *rect, BOOL32 erase )
{
RedrawWindow32( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) );
PAINT_RedrawWindow( hwnd, rect, 0,
RDW_INVALIDATE | (erase ? RDW_ERASE : 0), 0 );
}
@ -540,7 +535,8 @@ void InvalidateRect32( HWND32 hwnd, const RECT32 *rect, BOOL32 erase )
*/
void ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
{
RedrawWindow32( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
PAINT_RedrawWindow( (HWND32)hwnd, NULL, (HRGN32)hrgn,
RDW_VALIDATE | RDW_NOCHILDREN, 0 );
}
@ -549,7 +545,7 @@ void ValidateRgn16( HWND16 hwnd, HRGN16 hrgn )
*/
void ValidateRgn32( HWND32 hwnd, HRGN32 hrgn )
{
RedrawWindow32( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN );
PAINT_RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
}
@ -567,7 +563,7 @@ void ValidateRect16( HWND16 hwnd, const RECT16 *rect )
*/
void ValidateRect32( HWND32 hwnd, const RECT32 *rect )
{
RedrawWindow32( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN );
PAINT_RedrawWindow( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN, 0 );
}

View File

@ -87,7 +87,7 @@ static void TIMER_ClearTimer( TIMER * pTimer )
pTimer->msg = 0;
pTimer->id = 0;
pTimer->timeout = 0;
WINPROC_FreeProc( pTimer->proc );
WINPROC_FreeProc( pTimer->proc, WIN_PROC_TIMER );
}
@ -235,9 +235,10 @@ static UINT32 TIMER_SetTimer( HWND32 hwnd, UINT32 id, UINT32 timeout,
/* Got one: set new values and return */
TIMER_RemoveTimer( pTimer );
pTimer->timeout = timeout;
WINPROC_FreeProc( pTimer->proc );
WINPROC_FreeProc( pTimer->proc, WIN_PROC_TIMER );
pTimer->proc = (HWINDOWPROC)0;
if (proc) WINPROC_SetProc( &pTimer->proc, proc, type );
if (proc) WINPROC_SetProc( &pTimer->proc, proc,
type, WIN_PROC_TIMER );
pTimer->expires = GetTickCount() + timeout;
TIMER_InsertTimer( pTimer );
return id;
@ -262,7 +263,7 @@ static UINT32 TIMER_SetTimer( HWND32 hwnd, UINT32 id, UINT32 timeout,
pTimer->timeout = timeout;
pTimer->expires = GetTickCount() + timeout;
pTimer->proc = (HWINDOWPROC)0;
if (proc) WINPROC_SetProc( &pTimer->proc, proc, type );
if (proc) WINPROC_SetProc( &pTimer->proc, proc, type, WIN_PROC_TIMER );
dprintf_timer( stddeb, "Timer added: %p, %04x, %04x, %04x, %08lx\n",
pTimer, pTimer->hwnd, pTimer->msg, pTimer->id,
(DWORD)pTimer->proc );

View File

@ -363,7 +363,7 @@ static WND* WIN_DestroyWindow( WND* wndPtr )
if (wndPtr->window) EVENT_DestroyWindow( wndPtr );
if (wndPtr->class->style & CS_OWNDC) DCE_FreeDCE( wndPtr->dce );
WINPROC_FreeProc( wndPtr->winproc );
WINPROC_FreeProc( wndPtr->winproc, WIN_PROC_WINDOW );
wndPtr->class->cWindows--;
wndPtr->class = NULL;
@ -415,7 +415,6 @@ BOOL32 WIN_CreateDesktopWindow(void)
pWndDesktop->parent = NULL;
pWndDesktop->owner = NULL;
pWndDesktop->class = class;
pWndDesktop->winproc = NULL;
pWndDesktop->dwMagic = WND_MAGIC;
pWndDesktop->hwndSelf = hwndDesktop;
pWndDesktop->hInstance = 0;
@ -446,7 +445,8 @@ BOOL32 WIN_CreateDesktopWindow(void)
pWndDesktop->hSysMenu = 0;
pWndDesktop->userdata = 0;
WINPROC_SetProc( &pWndDesktop->winproc, (WNDPROC16)class->winproc, 0 );
pWndDesktop->winproc = (WNDPROC16)class->winproc;
EVENT_RegisterWindow( pWndDesktop );
SendMessage32A( hwndDesktop, WM_NCCREATE, 0, 0 );
pWndDesktop->flags |= WIN_NEEDS_ERASEBKGND;
@ -550,7 +550,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
wndPtr->window = 0;
wndPtr->class = classPtr;
wndPtr->winproc = NULL;
wndPtr->winproc = classPtr->winproc;
wndPtr->dwMagic = WND_MAGIC;
wndPtr->hwndSelf = hwnd;
wndPtr->hInstance = cs->hInstance;
@ -592,10 +592,9 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
}
}
/* Set the window procedure */
/* Increment class window counter */
classPtr->cWindows++;
WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)classPtr->winproc, 0 );
/* Correct the window style */
@ -1509,7 +1508,8 @@ static LONG WIN_SetWindowLong( HWND32 hwnd, INT32 offset, LONG newval,
if ((offset == DWL_DLGPROC) && (wndPtr->flags & WIN_ISDIALOG))
{
retval = (LONG)WINPROC_GetProc( (HWINDOWPROC)*ptr, type );
WINPROC_SetProc( (HWINDOWPROC *)ptr, (WNDPROC16)newval, type );
WINPROC_SetProc( (HWINDOWPROC *)ptr, (WNDPROC16)newval,
type, WIN_PROC_WINDOW );
return retval;
}
}
@ -1520,7 +1520,8 @@ static LONG WIN_SetWindowLong( HWND32 hwnd, INT32 offset, LONG newval,
return SetWindowWord32( hwnd, offset, (WORD)newval );
case GWL_WNDPROC:
retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type );
WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval, type );
WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval,
type, WIN_PROC_WINDOW );
return retval;
case GWL_STYLE:
@ -1814,27 +1815,23 @@ BOOL32 IsWindowVisible32( HWND32 hwnd )
/***********************************************************************
* WIN_IsWindowDrawable
*
* hwnd is drawable when it is visible, all parents are not
* minimized, and it is itself not minimized unless we are
*
* hwnd is drawable when it is visible, all parents are not
* minimized, and it is itself not minimized unless we are
* trying to draw icon and the default class icon is set.
*/
BOOL32 WIN_IsWindowDrawable( WND* wnd , BOOL32 icon )
{
HWND32 hwnd = wnd->hwndSelf;
BOOL32 yes = TRUE;
while(wnd && yes)
{
if( wnd->dwStyle & WS_MINIMIZE )
if( wnd->hwndSelf != hwnd ) break;
else if( icon && wnd->class->hIcon ) break;
yes = yes && (wnd->dwStyle & WS_VISIBLE);
wnd = wnd->parent; }
return (!wnd && yes);
if( (wnd->dwStyle & WS_MINIMIZE &&
icon && wnd->class->hIcon) ||
!(wnd->dwStyle & WS_VISIBLE) ) return FALSE;
for(wnd = wnd->parent; wnd; wnd = wnd->parent)
if( wnd->dwStyle & WS_MINIMIZE ||
!(wnd->dwStyle & WS_VISIBLE) ) break;
return (wnd == NULL);
}
/*******************************************************************
* GetTopWindow16 (USER.229)
*/

View File

@ -156,6 +156,24 @@ UINT32 ArrangeIconicWindows32( HWND32 parent )
}
/***********************************************************************
* SwitchToThisWindow16 (USER.172)
*/
void SwitchToThisWindow16( HWND16 hwnd, BOOL16 restore )
{
SwitchToThisWindow32( hwnd, restore );
}
/***********************************************************************
* SwitchToThisWindow32 (USER32.538)
*/
void SwitchToThisWindow32( HWND32 hwnd, BOOL32 restore )
{
ShowWindow32( hwnd, restore ? SW_RESTORE : SW_SHOWMINIMIZED );
}
/***********************************************************************
* GetWindowRect16 (USER.32)
*/

View File

@ -17,7 +17,9 @@
#include "stddebug.h"
#include "debug.h"
/* Window procedure 16-bit thunk; see BuildSpec16Files() in tools/build.c */
/* Window procedure 16--to-32-bit thunk,
* see BuildSpec16Files() in tools/build.c */
typedef struct
{
BYTE popl_eax; /* popl %eax (return address) */
@ -28,11 +30,13 @@ typedef struct
BYTE pushl_thunk; /* pushl $thunkfrom16 */
void (*thunk32)() WINE_PACKED;
BYTE lcall; /* lcall cs:relay */
void (*relay)() WINE_PACKED;
void (*relay)() WINE_PACKED; /* WINPROC_CallProc16To32A/W() */
WORD cs WINE_PACKED;
} WINPROC_THUNK_FROM16;
/* Window procedure 32-bit thunk; see BuildSpec32Files() in tools/build.c */
/* Window procedure 32-to-16-bit thunk,
* see BuildSpec32Files() in tools/build.c */
typedef struct
{
BYTE popl_eax; /* popl %eax (return address) */
@ -45,7 +49,7 @@ typedef struct
BYTE pushl_thunk; /* pushl $thunkfrom32 */
void (*thunk32)() WINE_PACKED;
BYTE jmp; /* jmp relay (relative jump)*/
void (*relay)() WINE_PACKED;
void (*relay)() WINE_PACKED; /* WINPROC_CallProc32ATo16() */
} WINPROC_THUNK_FROM32;
/* Simple jmp to call 32-bit procedure directly */
@ -68,6 +72,7 @@ typedef struct tagWINDOWPROC
struct tagWINDOWPROC *next; /* Next window proc */
UINT32 magic; /* Magic number */
WINDOWPROCTYPE type; /* Function type */
WINDOWPROCUSER user; /* Function user */
} WINDOWPROC;
#define WINPROC_MAGIC ('W' | ('P' << 8) | ('R' << 16) | ('C' << 24))
@ -162,7 +167,8 @@ static WINDOWPROC *WINPROC_GetPtr( WNDPROC16 handle )
*
* Allocate a new window procedure.
*/
static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC16 func, WINDOWPROCTYPE type )
static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC16 func, WINDOWPROCTYPE type,
WINDOWPROCUSER user )
{
WINDOWPROC *proc, *oldproc;
@ -220,6 +226,7 @@ static WINDOWPROC *WINPROC_AllocWinProc( WNDPROC16 func, WINDOWPROCTYPE type )
}
proc->magic = WINPROC_MAGIC;
proc->type = type;
proc->user = user;
}
proc->next = NULL;
dprintf_win( stddeb, "WINPROC_AllocWinProc(%08x,%d): returning %08x\n",
@ -257,11 +264,28 @@ WNDPROC16 WINPROC_GetProc( HWINDOWPROC proc, WINDOWPROCTYPE type )
/**********************************************************************
* WINPROC_SetProc
*
* Set the window procedure for a window or class.
* Set the window procedure for a window or class. There are
* three tree classes of winproc callbacks:
*
* 1) class -> wp - not subclassed
* class -> wp -> wp -> wp -> wp - SetClassLong()
* / /
* 2) window -' / - not subclassed
* window -> wp -> wp ' - SetWindowLong()
*
* 3) timer -> wp - SetTimer()
*
* Initially, winproc of the window points to the current winproc
* thunk of its class. Subclassing prepends a new thunk to the
* window winproc chain at the head of the list. Thus, window thunk
* list includes class thunks and the latter are preserved when the
* window is destroyed.
*
*/
BOOL32 WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
WINDOWPROCTYPE type )
WINDOWPROCTYPE type, WINDOWPROCUSER user )
{
BOOL32 bRecycle = FALSE;
WINDOWPROC *proc, **ppPrev;
/* Check if function is already in the list */
@ -272,18 +296,38 @@ BOOL32 WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
{
if (proc)
{
if (*ppPrev == proc) break;
if (*ppPrev == proc)
{
if ((*ppPrev)->user != user)
{
/* terminal thunk is being restored */
WINPROC_FreeProc( *pFirst, (*ppPrev)->user );
*(WINDOWPROC **)pFirst = *ppPrev;
return TRUE;
}
bRecycle = TRUE;
break;
}
}
else
{
if (((*ppPrev)->type == type) &&
(func == WINPROC_THUNKPROC(*ppPrev))) break;
(func == WINPROC_THUNKPROC(*ppPrev)))
{
bRecycle = TRUE;
break;
}
}
/* WPF_CLASS thunk terminates window thunk list */
if ((*ppPrev)->user != user) break;
ppPrev = &(*ppPrev)->next;
}
if (*ppPrev) /* Remove it from the list */
if (bRecycle)
{
/* Extract this thunk from the list */
proc = *ppPrev;
*ppPrev = proc->next;
}
@ -294,7 +338,7 @@ BOOL32 WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
type = proc->type;
func = WINPROC_THUNKPROC(proc);
}
proc = WINPROC_AllocWinProc( func, type );
proc = WINPROC_AllocWinProc( func, type, user );
if (!proc) return FALSE;
}
@ -313,11 +357,12 @@ BOOL32 WINPROC_SetProc( HWINDOWPROC *pFirst, WNDPROC16 func,
*
* Free a list of win procs.
*/
void WINPROC_FreeProc( HWINDOWPROC proc )
void WINPROC_FreeProc( HWINDOWPROC proc, WINDOWPROCUSER user )
{
while (proc)
{
WINDOWPROC *next = ((WINDOWPROC *)proc)->next;
if (((WINDOWPROC *)proc)->user != user) break;
dprintf_win( stddeb, "WINPROC_FreeProc: freeing %08x\n", (UINT32)proc);
HeapFree( WinProcHeap, 0, proc );
proc = next;
@ -987,6 +1032,40 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
case BM_SETSTYLE32:
*pmsg16 = (UINT16)msg32 + (BM_GETCHECK16 - BM_GETCHECK32);
return 0;
case EM_GETSEL32:
case EM_GETRECT32:
case EM_SETRECT32:
case EM_SETRECTNP32:
case EM_SCROLL32:
case EM_LINESCROLL32:
case EM_SCROLLCARET32:
case EM_GETMODIFY32:
case EM_SETMODIFY32:
case EM_GETLINECOUNT32:
case EM_LINEINDEX32:
case EM_SETHANDLE32:
case EM_GETHANDLE32:
case EM_GETTHUMB32:
case EM_LINELENGTH32:
case EM_REPLACESEL32:
case EM_GETLINE32:
case EM_LIMITTEXT32:
case EM_CANUNDO32:
case EM_UNDO32:
case EM_FMTLINES32:
case EM_LINEFROMCHAR32:
case EM_SETTABSTOPS32:
case EM_SETPASSWORDCHAR32:
case EM_EMPTYUNDOBUFFER32:
case EM_GETFIRSTVISIBLELINE32:
case EM_SETREADONLY32:
case EM_SETWORDBREAKPROC32:
case EM_GETWORDBREAKPROC32:
case EM_GETPASSWORDCHAR32:
*pmsg16 = (UINT16)msg32 + (EM_GETSEL16 - EM_GETSEL32);
return 0;
case LB_CARETOFF32:
case LB_CARETON32:
case LB_DELETESTRING32:
@ -1015,6 +1094,27 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
case LB_SETTOPINDEX32:
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
return 0;
case CB_DELETESTRING32:
case CB_GETCOUNT32:
case CB_GETLBTEXTLEN32:
case CB_LIMITTEXT32:
case CB_RESETCONTENT32:
case CB_SETEDITSEL32:
case CB_GETCURSEL32:
case CB_SETCURSEL32:
case CB_SHOWDROPDOWN32:
case CB_SETITEMDATA32:
case CB_SETITEMHEIGHT32:
case CB_GETITEMHEIGHT32:
case CB_SETEXTENDEDUI32:
case CB_GETEXTENDEDUI32:
case CB_GETDROPPEDSTATE32:
*pmsg16 = (UINT16)msg32 + (CB_GETEDITSEL16 - CB_GETEDITSEL32);
return 0;
case CB_GETEDITSEL32:
*pmsg16 = CB_GETEDITSEL16;
return 1;
case LB_ADDSTRING32:
case LB_FINDSTRING32:
case LB_FINDSTRINGEXACT32:
@ -1022,7 +1122,6 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
case LB_SELECTSTRING32:
case LB_DIR32:
case LB_ADDFILE32:
/* case LB_GETTEXT32: FIXME */
{
LPSTR str = SEGPTR_STRDUP( (LPSTR)*plparam );
if (!str) return -1;
@ -1030,6 +1129,21 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
}
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
return 1;
case CB_ADDSTRING32:
case CB_FINDSTRING32:
case CB_FINDSTRINGEXACT32:
case CB_INSERTSTRING32:
case CB_SELECTSTRING32:
case CB_DIR32:
{
LPSTR str = SEGPTR_STRDUP( (LPSTR)*plparam );
if (!str) return -1;
*plparam = (LPARAM)SEGPTR_GET(str);
}
*pmsg16 = (UINT16)msg32 + (CB_GETEDITSEL16 - CB_GETEDITSEL32);
return 1;
case LB_GETITEMRECT32:
{
RECT16 *rect;
@ -1038,6 +1152,7 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
*(LPARAM *)(rect + 1) = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)SEGPTR_GET(rect);
}
*pmsg16 = LB_GETITEMRECT16;
return 1;
case LB_GETSELITEMS32:
{
@ -1048,6 +1163,7 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
*((LPARAM *)items)++ = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)SEGPTR_GET(items);
}
*pmsg16 = LB_GETSELITEMS16;
return 1;
case LB_SETTABSTOPS32:
if (wParam32)
@ -1063,6 +1179,34 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
}
*pmsg16 = LB_SETTABSTOPS16;
return 0;
case CB_GETDROPPEDCONTROLRECT32:
{
RECT16 *rect;
rect = (RECT16 *)SEGPTR_ALLOC( sizeof(RECT16) + sizeof(LPARAM) );
if (!rect) return -1;
*(LPARAM *)(rect + 1) = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)SEGPTR_GET(rect);
}
*pmsg16 = CB_GETDROPPEDCONTROLRECT16;
return 1;
case LB_GETTEXT32:
*plparam = (LPARAM)MapLS( (LPVOID)(*plparam) );
*pmsg16 = LB_GETTEXT16;
return 1;
case CB_GETLBTEXT32:
*plparam = (LPARAM)MapLS( (LPVOID)(*plparam) );
*pmsg16 = CB_GETLBTEXT16;
return 1;
case EM_SETSEL32:
*pwparam16 = 0;
*plparam = MAKELONG( (INT16)(INT32)wParam32, (INT16)*plparam );
*pmsg16 = EM_SETSEL16;
return 0;
case WM_ACTIVATE:
case WM_CHARTOITEM:
case WM_COMMAND:
@ -1272,7 +1416,8 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
*
* Unmap a message that was mapped from 32-bit Ansi to 16-bit.
*/
void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam,
LPARAM lParam, LRESULT lResult )
{
switch(msg)
{
@ -1284,12 +1429,20 @@ void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
case LB_INSERTSTRING32:
case LB_SELECTSTRING32:
case LB_SETTABSTOPS32:
case CB_ADDSTRING32:
case CB_FINDSTRING32:
case CB_FINDSTRINGEXACT32:
case CB_INSERTSTRING32:
case CB_SELECTSTRING32:
case CB_DIR32:
case WM_COMPAREITEM:
case WM_DELETEITEM:
case WM_DRAWITEM:
case WM_SETTEXT:
SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) );
break;
case CB_GETDROPPEDCONTROLRECT32:
case LB_GETITEMRECT32:
{
RECT16 *rect = (RECT16 *)PTR_SEG_TO_LIN(lParam);
@ -1307,6 +1460,21 @@ void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
SEGPTR_FREE( (LPARAM *)items - 1 );
}
break;
case CB_GETEDITSEL32:
/*
if( wParam )
*((LPUINT32)wParam) = LOWORD(lResult);
if( lParam )
*((LPUINT32)lParam) = HIWORD(lResult);
*/
break;
case LB_GETTEXT32:
case CB_GETLBTEXT32:
UnMapLS( (SEGPTR)lParam );
break;
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT16 *mis = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam);
@ -1401,11 +1569,27 @@ INT32 WINPROC_MapMsg32WTo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
{
LPSTR str = SEGPTR_STRDUP_WtoA( (LPWSTR)*plparam );
if (!str) return -1;
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
*pwparam16 = (WPARAM16)LOWORD(wParam32);
*plparam = (LPARAM)SEGPTR_GET(str);
}
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
return 1;
case CB_ADDSTRING32:
case CB_FINDSTRING32:
case CB_FINDSTRINGEXACT32:
case CB_INSERTSTRING32:
case CB_SELECTSTRING32:
case CB_DIR32:
{
LPSTR str = SEGPTR_STRDUP_WtoA( (LPWSTR)*plparam );
if (!str) return -1;
*pwparam16 = (WPARAM16)LOWORD(wParam32);
*plparam = (LPARAM)SEGPTR_GET(str);
}
*pmsg16 = (UINT16)msg32 + (CB_ADDSTRING16 - CB_ADDSTRING32);
return 1;
case WM_NCCREATE:
case WM_CREATE:
{
@ -1462,7 +1646,8 @@ INT32 WINPROC_MapMsg32WTo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
*
* Unmap a message that was mapped from 32-bit Unicode to 16-bit.
*/
void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM16 wParam,
LPARAM lParam, LRESULT lResult )
{
switch(msg)
{
@ -1475,7 +1660,7 @@ void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
}
break;
default:
WINPROC_UnmapMsg32ATo16( msg, wParam, lParam );
WINPROC_UnmapMsg32ATo16( msg, wParam, lParam, lResult );
break;
}
}
@ -1579,7 +1764,7 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd,
if (wndPtr) CURRENT_DS = wndPtr->hInstance;
result = CallWndProc16( func, hwnd, msg16, wParam16, lParam );
CURRENT_DS = ds;
WINPROC_UnmapMsg32ATo16( msg, wParam16, lParam );
WINPROC_UnmapMsg32ATo16( msg, wParam16, lParam, result );
return result;
}
@ -1604,7 +1789,7 @@ static LRESULT WINPROC_CallProc32WTo16( WNDPROC16 func, HWND32 hwnd,
if (wndPtr) CURRENT_DS = wndPtr->hInstance;
result = CallWndProc16( func, hwnd, msg16, wParam16, lParam );
CURRENT_DS = ds;
WINPROC_UnmapMsg32WTo16( msg, wParam16, lParam );
WINPROC_UnmapMsg32WTo16( msg, wParam16, lParam, result );
return result;
}

View File

@ -109,7 +109,7 @@ Start as an icon
.I -language xx
Set the language to
.I xx
(one of En, Es, De, No, Fr, Fi, Da, Cz, Eo, It, Ko, Hu, Pl)
(one of En, Es, De, No, Fr, Fi, Da, Cz, Eo, It, Ko, Hu, Pl, Po)
.TP
.I -managed
Create each top-level window as a properly managed X window