diff --git a/ANNOUNCE b/ANNOUNCE index 3a4afcceea0..bcff67442e3 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,13 +1,13 @@ -This is release 970629 of Wine, the MS Windows emulator. This is still a +This is release 970720 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-970629: (see ChangeLog for details) - - Start of COMDLG32 implementation. - - Relay debugging knows about strings. +WHAT'S NEW with Wine-970720: (see ChangeLog for details) + - Preliminary Win95 look&feel implementation. + - Start of texinfo documentation. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -16,10 +16,10 @@ 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-970629.tar.gz - ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970629.tar.gz - ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970629.tar.gz - ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970629.tar.gz + ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970720.tar.gz + ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970720.tar.gz + ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970720.tar.gz + ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970720.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. @@ -30,30 +30,8 @@ If you want to get the new releases faster, you can subscribe to the 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, 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, 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. +Wine is available thanks to the work of many people. See the file +AUTHORS in the distribution for the complete list. -- Alexandre Julliard diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000000..16236869bb0 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,31 @@ +@c This file is processed by GNU's TeXinfo +@c If you modify it or move it to another location, make sure that +@c TeXinfo works (type `make' in directory documentation). + +@c This is a list of the Wine authors and copyright holders. + +Wine is available thanks to the work of 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, Claus Fischer, 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, +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. diff --git a/BUGS b/BUGS index 473e87eb980..0d57d6899ed 100644 --- a/BUGS +++ b/BUGS @@ -15,6 +15,8 @@ General: * Very alpha printing code. [john@division.co.uk] + * Extremely alpha Win95 interface code. + * No OLE2 and OLE32 support (including OLE2 interfaces etc.). * No MS Video support (perhaps interface with xanim, don't hold diff --git a/ChangeLog b/ChangeLog index 50fa2fe7fe2..74a428185f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,129 @@ +---------------------------------------------------------------------- +Sat Jul 19 13:03:01 1997 Alexandre Julliard + + * [tools/build.c] [include/stackframe.h] + Save the complete %ebp register in CallFrom16; fixes a crash with + LabView reported by Andreas Mohr. + + * [loader/main.c] + Avoid executing a built-in DLL. + + * [controls/static.c] + Converted static window procedure to Win32. + + * [windows/message.c] [windows/queue.c] [include/queue.h] + Hacked SendMessage functions to support inter-task messages with + SendMessage32A/W. + +Sun Jul 13 16:55:35 1997 Bernhard Rosenkraenzer + + * [ipc/bit_array.c] + Don't use bitops.h in Linux 2.1.x (these versions do not return + the previous state for clear_bit and set_bit) + + * [ipc/shm_main_blk.c] + Adapt to GLIBC's ipc_perm structure. + + * [memory/ldt.c] + Include on Linux/GLIBC systems (required for + _syscall3). + +Wed Jul 9 23:53:19 1997 David A. Cuthbert + + * [include/options.h] [files/profile.c] + Added PROFILE_GetWineIniBool and PROFILE_EnumerateWineIniSection. + + * [include/sysmetrics.h] [include/windows.h] [windows/sysmetrics.c] + All sysmetrics moved to array (no more constant macros). Added + MOUSEWHEELPRESENT metric. + + * [include/bitmap.h] [objects/oembitmap.c] + Added OBM_Init() (see also loader/main.c) and more support for Win95 + bitmaps; added size info to OEM bitmaps. + + * [include/graphics.h] [windows/graphics.h] + Added GRAPH_DrawGenericReliefRect. + + * [loader/main.c] + Added TWEAK_Init() and TWEAK_CheckConfiguration() calls (the + latter checks for invalid entries in wine.conf). + + * [include/debug.h] [include/stddebug.h] [include/nonclient.h] + [include/tweak.h] [controls/menu.c] [misc/tweak.c] + [objects/gdiobj.c] [windows/syscolor.c] [windows/nonclient.c] + [BUGS] [documentation/win95look] + Added tweaks for Windows 95 interface support. See + documentation/win95look for more information. + + * [controls/edit.c] + Fixed EDIT_MoveHome bug. + + * [misc/ver.c] + Changed name of dprintf_ver_string to ver_dstring to fix + problem with tools/make_debug utility. + +Wed Jul 9 21:31:54 1997 Marcus Meissner + + * [objects/dib.c] + Don't use palettes with dibs with biBitCount > 8. + + * [misc/ole2nls.c][misc/ver.c] + IsValidLocale, EnumSystemLocales fixed (winhlp32.exe works) + Some VerLanguage coded moved to ole2nls.c, some cleanups. + + * [multimedia/mcistring.c] + Fixed "capabilities device type" crash (cool.exe). + + * [misc/main.c] + SystemParametersInfo*: added stub option 41 + (GETNONCLIENTMETRICS), duplicated some stuff away from SPI16 + that writes 32bit vars.(one COMCTL32.DLL crash, freecell.exe) + +Tue Jul 8 22:40:53 1997 Morten Welinder + + * [if1632/shell32.spec] + Use Windows 95's ordinals. Help wanted, inquire within. + +Mon Jul 7 11:20:36 1997 Philippe De Muyter + + * [if1632/relay.c] [if1632/user.spec] [if1632/kernel.spec] + [tools/build-spec.txt] [tools/build.c] + Added type 'segstr' (segmented pointer to null-terminated string) + to .spec files. + + * [windows/user.c] [if1632/user.spec] + ExitWindowsExec stub function added. + +Mon Jul 7 01:18:25 1997 U. Bonnes + + * [files/file.c] [include/winbase.h] [if1632/kernel32.spec] + Implement MoveFileEx32, some enhancement for Movefile32. + +Sat Jul 5 18:13:48 1997 Bruce Milner + + * [misc/ole2nls.c] [programs/progman/Da.rc] [programs/winhelp/Da.rc] + [resources/sysres_Da.rc] + Added/updated Danish language support. + +Thu Jul 3 13:04:20 1997 Claus Fischer + + * [files/dos_fs.c] + Properly implemented DOSFS_UnixTimeToFileTime and + DOSFS_FileTimeToUnixTime. + + * [documentation/wine.texinfo] + First version of texinfo documentation. + ---------------------------------------------------------------------- Thu Jun 26 02:14:03 1997 Slaven Rezic diff --git a/LICENSE b/LICENSE index 9e0358b08af..29438243ddb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,11 @@ +@c This file is processed by GNU's TeXinfo +@c If you modify it or move it to another location, make sure that +@c TeXinfo works (type `make' in directory documentation). + +@c This is the Wine copyright. +@c The Wine warranty is part of the license agreement. +@c READ THE FILE `WARRANTY' CAREFULLY FOR A STATEMENT ON THE WINE WARRANTY. + You may without charge, royalty or other payment, copy and distribute copies of this work and derivative works of this work in source or binary form provided that: (1) @@ -14,16 +22,9 @@ have been modified, (b) all source files of the derivative work that contain any party of the original work, and (c) all source files of the derivative work that are necessary to compile, link and run the derivative work without unresolved external calls and -with the same functionality of the original work ("Necessary -Sources") carry a prominent notice explaining the nature and date +with the same functionality of the original work (``Necessary +Sources'') carry a prominent notice explaining the nature and date of the modification and/or creation. You are encouraged to make the Necessary Sources available under this license in order to further the development and acceptance of the work. - -EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED -WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING -BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A -PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS -OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR -LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + diff --git a/Make.rules.in b/Make.rules.in index dc95c85f83c..fd758a1b5dd 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -5,7 +5,7 @@ # TOPOBJDIR : top-level object directory # SRCDIR : source directory for this module # MODULE : name of the module being built -# C_SRCS : C sources for the module +# C_SRCS : C sources for the module (optional) # GEN_C_SRCS : generated C sources (optional) # ASM_SRCS : assembly sources (optional) # GEN_ASM_SRCS : generated assembly sources (optional) diff --git a/Makefile.in b/Makefile.in index c62eb54c888..61649fe925d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -74,7 +74,14 @@ LIBSUBDIRS = library PROGSUBDIRS = libtest programs -ALLSUBDIRS = $(COMMONSUBDIRS) $(EMUSUBDIRS) $(LIBSUBDIRS) $(PROGSUBDIRS) +DOCSUBDIRS = documentation + +ALLSUBDIRS = \ + $(COMMONSUBDIRS) \ + $(EMUSUBDIRS) \ + $(LIBSUBDIRS) \ + $(PROGSUBDIRS) \ + $(DOCSUBDIRS) COMMONOBJS = \ controls/controls.o \ @@ -140,7 +147,7 @@ install_programs: dummy @cd programs; $(SUBMAKE) install depend: dummy - for i in $(COMMONSUBDIRS) $(LIBSUBDIRS) $(EMUSUBDIRS); do \ + for i in $(COMMONSUBDIRS) $(LIBSUBDIRS) $(EMUSUBDIRS) $(DOCSUBDIRS); do \ (cd $$i; $(MAKE) depend) || exit 1; \ done @@ -149,7 +156,7 @@ etags: clean: for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done - for i in . include documentation; do (cd $$i; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc); done + for i in . include; do (cd $$i; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc); done $(RM) wine wine.sym libwine.a libwine.so.1.0 TAGS distclean: clean diff --git a/README b/README index 17bb9ec7af4..25a81f63cad 100644 --- a/README +++ b/README @@ -16,6 +16,7 @@ You must have one of: Linux version 0.99.13 or above NetBSD-current FreeBSD-current or FreeBSD 1.1 + OpenBSD/i386 2.1 or later You also need to have libXpm installed on your system. The sources for it are probably available on the ftp site where you got Wine. They can diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a9acbd23611..7959da387d1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -9,4 +9,3 @@ the source, of course). Look at the ChangeLog to see what files have been changed. Try to undo the particular patch and go partially back to the previous version. If you have any suspicions, report them to the author or to the newsgroup. - diff --git a/WARRANTY b/WARRANTY index 492af846b2e..7def35f8396 100644 --- a/WARRANTY +++ b/WARRANTY @@ -1,3 +1,10 @@ +@c This file is processed by GNU's TeXinfo +@c If you modify it or move it to another location, make sure that +@c TeXinfo works (type `make' in directory documentation). + +@c This warranty is part of the license agreement. +@c See the file LICENSE for the copying conditions. + EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A diff --git a/configure b/configure index 9ff371b38ba..bce2a755f66 100755 --- a/configure +++ b/configure @@ -2477,6 +2477,7 @@ Make.rules Makefile controls/Makefile debugger/Makefile +documentation/Makefile files/Makefile graphics/Makefile graphics/metafiledrv/Makefile @@ -2595,6 +2596,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Make.rules Makefile controls/Makefile debugger/Makefile +documentation/Makefile files/Makefile graphics/Makefile graphics/metafiledrv/Makefile diff --git a/configure.in b/configure.in index 185a4641d46..530f1917e6f 100644 --- a/configure.in +++ b/configure.in @@ -38,7 +38,7 @@ AC_PROG_YACC AC_PROG_LEX AC_PROG_RANLIB AC_PROG_INSTALL -dnl Check for -li386 for NetBSD +dnl Check for -li386 for NetBSD and OpenBSD AC_CHECK_LIB(i386,i386_set_ldt,LDLIBS="$LDLIBS -li386") dnl **** Check for gcc strength-reduce bug **** @@ -119,6 +119,7 @@ Make.rules Makefile controls/Makefile debugger/Makefile +documentation/Makefile files/Makefile graphics/Makefile graphics/metafiledrv/Makefile diff --git a/controls/edit.c b/controls/edit.c index 707bc691bce..469de645a17 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -1462,8 +1462,8 @@ static void EDIT_MoveHome(WND *wnd, EDITSTATE *es, BOOL32 extend) e = EDIT_CharFromPos(wnd, es, 0x80000000, HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL); else - e = lstrlen32A(es->text); - EDIT_EM_SetSel(wnd, es, extend ? es->selection_start : e, e, FALSE); + e = 0; + EDIT_EM_SetSel(wnd, es, e, extend ? es->selection_start : e, FALSE); EDIT_EM_ScrollCaret(wnd, es); } diff --git a/controls/menu.c b/controls/menu.c index 4c7c82f7b50..d99b6cc392e 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -33,8 +33,19 @@ #include "graphics.h" #include "resource.h" #include "stddebug.h" +#include "tweak.h" #include "debug.h" + +UINT32 MENU_BarItemTopNudge; +UINT32 MENU_BarItemLeftNudge; +UINT32 MENU_ItemTopNudge; +UINT32 MENU_ItemLeftNudge; +UINT32 MENU_HighlightTopNudge; +UINT32 MENU_HighlightLeftNudge; +UINT32 MENU_HighlightBottomNudge; +UINT32 MENU_HighlightRightNudge; + /* internal popup menu window messages */ #define MM_SETMENUHANDLE (WM_USER + 0) @@ -101,13 +112,13 @@ typedef struct #define POPUP_YSHADE 4 /* Space between 2 menu bar items */ -#define MENU_BAR_ITEMS_SPACE 16 +int MENU_BAR_ITEMS_SPACE = 12; /* Minimum width of a tab character */ -#define MENU_TAB_SPACE 8 +int MENU_TAB_SPACE = 8; /* Height of a separator item */ -#define SEPARATOR_HEIGHT 5 +int SEPARATOR_HEIGHT = 5; /* (other menu->FocusedItem values give the position of the focused item) */ #define NO_SELECTED_ITEM 0xffff @@ -147,14 +158,18 @@ static HMENU32 MENU_CopySysPopup(void) { HMENU32 hMenu = LoadMenuIndirect32A(SYSRES_GetResPtr(SYSRES_MENU_SYSMENU)); - if( hMenu ) - { + if( hMenu ) { POPUPMENU* menu = (POPUPMENU *) USER_HEAP_LIN_ADDR(hMenu); menu->wFlags |= MF_SYSMENU | MF_POPUP; - return hMenu; } - else fprintf( stderr, "Unable to load default system menu\n" ); - return FALSE; + else { + hMenu = 0; + fprintf( stderr, "Unable to load default system menu\n" ); + } + + dprintf_menu( stddeb, "MENU_CopySysPopup: returning %ld.\n", hMenu ); + + return hMenu; } @@ -409,6 +424,10 @@ static void MENU_CalcItemSize( HDC32 hdc, MENUITEM *lpitem, HWND32 hwndOwner, DWORD dwSize; char *p; + dprintf_menu( stddeb, "MENU_CalcItemSize: HDC 0x%lx, item '%s', at " + "(%d, %d) %s\n", hdc, lpitem->text, orgX, orgY, + menuBar ? "(MenuBar)" : "" ); + SetRect32( &lpitem->rect, orgX, orgY, orgX, orgY ); if (lpitem->item_flags & MF_OWNERDRAW) @@ -509,6 +528,13 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND32 hwndOwner ) { if ((i != start) && (lpitem->item_flags & (MF_MENUBREAK | MF_MENUBARBREAK))) break; + + dprintf_menu( stddeb, "MENU_PopupMenuCalcSize: calling " + "MENU_CalcItemSize on '%s', org=(%d, %d)\n", + lpitem->text, orgX, orgY ); + if(TWEAK_Win95Look) + ++orgY; + MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, FALSE ); if (lpitem->item_flags & MF_MENUBARBREAK) orgX++; maxX = MAX( maxX, lpitem->rect.right ); @@ -572,6 +598,11 @@ static void MENU_MenuBarCalcSize( HDC32 hdc, LPRECT32 lprect, if ((helpPos == -1) && (lpitem->item_flags & MF_HELP)) helpPos = i; if ((i != start) && (lpitem->item_flags & (MF_MENUBREAK | MF_MENUBARBREAK))) break; + + + dprintf_menu( stddeb, "MENU_MenuBarCalcSize: calling " + "MENU_CalcItemSize on item '%s', org=(%d, %d)\n", + lpitem->text, orgX, orgY ); MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE ); if (lpitem->rect.right > lprect->right) { @@ -619,8 +650,17 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem, if (lpitem->item_flags & MF_SYSMENU) { - if( !IsIconic32(hwnd) ) NC_DrawSysButton( hwnd, hdc, - lpitem->item_flags & (MF_HILITE | MF_MOUSESELECT)); + if( !IsIconic32(hwnd) ) { + if(TWEAK_Win95Look) + NC_DrawSysButton95( hwnd, hdc, + lpitem->item_flags & + (MF_HILITE | MF_MOUSESELECT) ); + else + NC_DrawSysButton( hwnd, hdc, + lpitem->item_flags & + (MF_HILITE | MF_MOUSESELECT) ); + } + return; } @@ -647,11 +687,33 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem, if (menuBar && (lpitem->item_flags & MF_SEPARATOR)) return; rect = lpitem->rect; - /* Draw the background */ + /* Draw the background */ + if(TWEAK_Win95Look) { + if(menuBar) { + --rect.left; + ++rect.bottom; + --rect.top; + } + InflateRect32( &rect, -1, -1 ); + } + + if (lpitem->item_flags & MF_HILITE) { + RECT32 r = rect; + r.top += MENU_HighlightTopNudge; + r.bottom += MENU_HighlightBottomNudge; + r.left += MENU_HighlightLeftNudge; + r.right += MENU_HighlightRightNudge; + FillRect32( hdc, &r, sysColorObjects.hbrushHighlight ); + } + else { + RECT32 r = rect; + r.top += MENU_HighlightTopNudge; + r.bottom += MENU_HighlightBottomNudge; + r.left += MENU_HighlightLeftNudge; + r.right += MENU_HighlightRightNudge; + FillRect32( hdc, &r, sysColorObjects.hbrushMenu ); + } - if (lpitem->item_flags & MF_HILITE) - FillRect32( hdc, &rect, sysColorObjects.hbrushHighlight ); - else FillRect32( hdc, &rect, sysColorObjects.hbrushMenu ); SetBkMode32( hdc, TRANSPARENT ); /* Draw the separator bar (if any) */ @@ -664,9 +726,16 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem, } if (lpitem->item_flags & MF_SEPARATOR) { - SelectObject32( hdc, sysColorObjects.hpenWindowFrame ); - MoveTo( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2 ); - LineTo32( hdc, rect.right, rect.top + SEPARATOR_HEIGHT/2 ); + if(TWEAK_Win95Look) + TWEAK_DrawMenuSeparator95(hdc, rect.left + 1, + rect.top + SEPARATOR_HEIGHT / 2 + 1, + rect.right - 1); + else { + SelectObject32( hdc, sysColorObjects.hpenWindowFrame ); + MoveTo( hdc, rect.left, rect.top + SEPARATOR_HEIGHT/2 ); + LineTo32( hdc, rect.right, rect.top + SEPARATOR_HEIGHT/2 ); + } + return; } @@ -742,16 +811,40 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem, rect.left += MENU_BAR_ITEMS_SPACE / 2; rect.right -= MENU_BAR_ITEMS_SPACE / 2; i = strlen( lpitem->text ); + + rect.top += MENU_BarItemTopNudge; + rect.left += MENU_BarItemLeftNudge; } else { for (i = 0; lpitem->text[i]; i++) if ((lpitem->text[i] == '\t') || (lpitem->text[i] == '\b')) break; + + rect.top += MENU_ItemTopNudge; + rect.left += MENU_ItemLeftNudge; + } + + if(!TWEAK_Win95Look || !(lpitem->item_flags & MF_GRAYED)) { + DrawText32A( hdc, lpitem->text, i, &rect, + DT_LEFT | DT_VCENTER | DT_SINGLELINE ); + } + else { + ++rect.left; + ++rect.top; + ++rect.right; + ++rect.bottom; + SetTextColor32(hdc, RGB(0xff, 0xff, 0xff)); + DrawText32A( hdc, lpitem->text, i, &rect, + DT_LEFT | DT_VCENTER | DT_SINGLELINE ); + --rect.left; + --rect.top; + --rect.right; + --rect.bottom; + SetTextColor32(hdc, RGB(0x80, 0x80, 0x80)); + DrawText32A( hdc, lpitem->text, i, &rect, + DT_LEFT | DT_VCENTER | DT_SINGLELINE ); } - - DrawText32A( hdc, lpitem->text, i, &rect, - DT_LEFT | DT_VCENTER | DT_SINGLELINE ); if (lpitem->text[i]) /* There's a tab or flush-right char */ { @@ -787,6 +880,7 @@ static void MENU_DrawPopupMenu( HWND32 hwnd, HDC32 hdc, HMENU32 hmenu ) HPEN32 hPrevPen; Rectangle32( hdc, rect.left, rect.top, rect.right, rect.bottom ); + hPrevPen = SelectObject32( hdc, GetStockObject32( NULL_PEN ) ); if( hPrevPen ) { @@ -794,20 +888,26 @@ static void MENU_DrawPopupMenu( HWND32 hwnd, HDC32 hdc, HMENU32 hmenu ) POPUPMENU *menu; /* draw 3-d shade */ + if(!TWEAK_Win95Look) { + SelectObject32( hdc, hShadeBrush ); + SetBkMode32( hdc, TRANSPARENT ); + ropPrev = SetROP232( hdc, R2_MASKPEN ); - SelectObject32( hdc, hShadeBrush ); - SetBkMode32( hdc, TRANSPARENT ); - ropPrev = SetROP232( hdc, R2_MASKPEN ); - - i = rect.right; /* why SetBrushOrg() doesn't? */ - PatBlt32( hdc, i & 0xfffffffe, rect.top + POPUP_YSHADE*SYSMETRICS_CYBORDER, - i%2 + POPUP_XSHADE*SYSMETRICS_CXBORDER, rect.bottom - rect.top, 0x00a000c9 ); - i = rect.bottom; - PatBlt32( hdc, rect.left + POPUP_XSHADE*SYSMETRICS_CXBORDER, i & 0xfffffffe, - rect.right - rect.left, i%2 + POPUP_YSHADE*SYSMETRICS_CYBORDER, 0x00a000c9 ); - SelectObject32( hdc, hPrevPen ); - SelectObject32( hdc, hPrevBrush ); - SetROP232( hdc, ropPrev ); + i = rect.right; /* why SetBrushOrg() doesn't? */ + PatBlt32( hdc, i & 0xfffffffe, + rect.top + POPUP_YSHADE*SYSMETRICS_CYBORDER, + i%2 + POPUP_XSHADE*SYSMETRICS_CXBORDER, + rect.bottom - rect.top, 0x00a000c9 ); + i = rect.bottom; + PatBlt32( hdc, rect.left + POPUP_XSHADE*SYSMETRICS_CXBORDER, + i & 0xfffffffe,rect.right - rect.left, + i%2 + POPUP_YSHADE*SYSMETRICS_CYBORDER, 0x00a000c9 ); + SelectObject32( hdc, hPrevPen ); + SelectObject32( hdc, hPrevBrush ); + SetROP232( hdc, ropPrev ); + } + else + TWEAK_DrawReliefRect95(hdc, &rect); /* draw menu items */ @@ -846,10 +946,16 @@ UINT32 MENU_DrawMenuBar( HDC32 hDC, LPRECT32 lprect, HWND32 hwnd, lprect->bottom = lprect->top + lppop->Height; if (suppress_draw) return lppop->Height; + if(TWEAK_Win95Look) + ++lprect->bottom; + FillRect32(hDC, lprect, sysColorObjects.hbrushMenu ); - SelectObject32( hDC, sysColorObjects.hpenWindowFrame ); - MoveTo( hDC, lprect->left, lprect->bottom ); - LineTo32( hDC, lprect->right, lprect->bottom ); + + if(!TWEAK_Win95Look) { + SelectObject32( hDC, sysColorObjects.hpenWindowFrame ); + MoveTo( hDC, lprect->left, lprect->bottom ); + LineTo32( hDC, lprect->right, lprect->bottom ); + } if (lppop->nItems == 0) return SYSMETRICS_CYMENU; for (i = 0; i < lppop->nItems; i++) @@ -1116,8 +1222,8 @@ static BOOL32 MENU_SetItemData( MENUITEM *item, UINT32 flags, UINT32 id, LPSTR prevText = IS_STRING_ITEM(item->item_flags) ? item->text : NULL; dprintf_menu(stddeb,"SetItemData: %04x [%08x] '%s' -> %04x [%08x] '%s'\n", - item->item_flags, item->item_id, item->text ? item->text : "", - flags, id, str ? str : "" ); + item->item_flags, item->item_id, prevText ? prevText : "", + flags, id, (IS_STRING_ITEM(flags) && str) ? str : "" ); if (IS_STRING_ITEM(flags)) { @@ -2241,6 +2347,9 @@ UINT32 MENU_GetMenuBarHeight( HWND32 hwnd, UINT32 menubarWidth, WND *wndPtr; LPPOPUPMENU lppop; + dprintf_menu( stddeb, "MENU_GetMenuBarHeight: HWND 0x%lx, width %d, " + "at (%d, %d).\n", hwnd, menubarWidth, orgX, orgY ); + if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU16)wndPtr->wIDmenu))) return 0; @@ -2578,9 +2687,11 @@ BOOL32 InsertMenu32A( HMENU32 hMenu, UINT32 pos, UINT32 flags, MENUITEM *item; if (IS_STRING_ITEM(flags) && str) - dprintf_menu( stddeb, "InsertMenu: %04x %d %04x %04x '%s'\n", + dprintf_menu( stddeb, "InsertMenu: hMenu %04x, pos %d, flags %04x, " + "id %04x, str '%s'\n", hMenu, pos, flags, id, str ); - else dprintf_menu( stddeb, "InsertMenu: %04x %d %04x %04x %08lx\n", + else dprintf_menu( stddeb, "InsertMenu: hMenu %04x, pos %d, flags %04x, " + "id %04x, str %08lx (not a string)\n", hMenu, pos, flags, id, (DWORD)str ); if (!(item = MENU_InsertItem( hMenu, pos, flags ))) return FALSE; diff --git a/controls/static.c b/controls/static.c index 77e6c55b07f..6a547e2da35 100644 --- a/controls/static.c +++ b/controls/static.c @@ -9,6 +9,7 @@ #include "windows.h" #include "win.h" #include "static.h" +#include "heap.h" static void STATIC_PaintTextfn( WND *wndPtr, HDC32 hdc ); static void STATIC_PaintRectfn( WND *wndPtr, HDC32 hdc ); @@ -64,10 +65,37 @@ static HICON16 STATIC_SetIcon( WND *wndPtr, HICON16 hicon ) } +/*********************************************************************** + * STATIC_LoadIcon + * + * Load the icon for an SS_ICON control. + */ +static HICON16 STATIC_LoadIcon( WND *wndPtr, LPCSTR name ) +{ + HICON16 hicon; + + if (wndPtr->flags & WIN_ISWIN32) + { + hicon = LoadIcon32A( wndPtr->hInstance, name ); + if (!hicon) /* Try OEM icon (FIXME: is this right?) */ + hicon = LoadIcon32A( 0, name ); + } + else + { + LPSTR segname = SEGPTR_STRDUP(name); + hicon = LoadIcon16( wndPtr->hInstance, SEGPTR_GET(segname) ); + if (!hicon) /* Try OEM icon (FIXME: is this right?) */ + hicon = LoadIcon32A( 0, segname ); + SEGPTR_FREE(segname); + } + return hicon; +} + + /*********************************************************************** * StaticWndProc */ -LRESULT StaticWndProc( HWND16 hWnd, UINT16 uMsg, WPARAM16 wParam, +LRESULT StaticWndProc( HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam ) { LRESULT lResult = 0; @@ -77,120 +105,115 @@ LRESULT StaticWndProc( HWND16 hWnd, UINT16 uMsg, WPARAM16 wParam, switch (uMsg) { - case WM_ENABLE: - InvalidateRect32( hWnd, NULL, FALSE ); - break; + case WM_NCCREATE: + if (style == SS_ICON) + { + CREATESTRUCT32A *cs = (CREATESTRUCT32A *)lParam; + if (cs->lpszName) + STATIC_SetIcon( wndPtr, + STATIC_LoadIcon( wndPtr, cs->lpszName )); + return 1; + } + return DefWindowProc32A( hWnd, uMsg, wParam, lParam ); - case WM_NCCREATE: - if (style == SS_ICON) - { - CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); - if (cs->lpszName) - { - HICON16 hicon = LoadIcon16( cs->hInstance, cs->lpszName ); - if (!hicon) /* Try OEM icon (FIXME: is this right?) */ - hicon = LoadIcon16( 0, cs->lpszName ); - STATIC_SetIcon( wndPtr, hicon ); - } - return 1; - } - return DefWindowProc16(hWnd, uMsg, wParam, lParam); - - case WM_CREATE: - if (style < 0L || style > LAST_STATIC_TYPE) - { - fprintf( stderr, "STATIC: Unknown style 0x%02lx\n", style ); - lResult = -1L; - break; - } - /* initialise colours */ - color_windowframe = GetSysColor32(COLOR_WINDOWFRAME); - color_background = GetSysColor32(COLOR_BACKGROUND); - color_window = GetSysColor32(COLOR_WINDOW); - break; - - case WM_NCDESTROY: - if (style == SS_ICON) - DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) ); - else - lResult = DefWindowProc16(hWnd, uMsg, wParam, lParam); + case WM_CREATE: + if (style < 0L || style > LAST_STATIC_TYPE) + { + fprintf( stderr, "STATIC: Unknown style 0x%02lx\n", style ); + lResult = -1L; break; + } + /* initialise colours */ + color_windowframe = GetSysColor32(COLOR_WINDOWFRAME); + color_background = GetSysColor32(COLOR_BACKGROUND); + color_window = GetSysColor32(COLOR_WINDOW); + break; - case WM_PAINT: - { - PAINTSTRUCT16 ps; - BeginPaint16( hWnd, &ps ); - if (staticPaintFunc[style]) - (staticPaintFunc[style])( wndPtr, ps.hdc ); - EndPaint16( hWnd, &ps ); - } - break; + case WM_NCDESTROY: + if (style == SS_ICON) + DestroyIcon32( STATIC_SetIcon( wndPtr, 0 ) ); + else + lResult = DefWindowProc32A( hWnd, uMsg, wParam, lParam ); + break; - case WM_SYSCOLORCHANGE: - color_windowframe = GetSysColor32(COLOR_WINDOWFRAME); - color_background = GetSysColor32(COLOR_BACKGROUND); - color_window = GetSysColor32(COLOR_WINDOW); - InvalidateRect32( hWnd, NULL, TRUE ); - break; + case WM_PAINT: + { + PAINTSTRUCT32 ps; + BeginPaint32( hWnd, &ps ); + if (staticPaintFunc[style]) + (staticPaintFunc[style])( wndPtr, ps.hdc ); + EndPaint32( hWnd, &ps ); + } + break; - case WM_SETTEXT: - if (style == SS_ICON) - /* FIXME : should we also return the previous hIcon here ??? */ - STATIC_SetIcon( wndPtr, LoadIcon16( wndPtr->hInstance, - (SEGPTR)lParam )); - else - DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) ); - InvalidateRect32( hWnd, NULL, FALSE ); - UpdateWindow32( hWnd ); - break; + case WM_ENABLE: + InvalidateRect32( hWnd, NULL, FALSE ); + break; - case WM_SETFONT: - if (style == SS_ICON) return 0; - infoPtr->hFont = (HFONT16)wParam; - if (LOWORD(lParam)) - { - InvalidateRect32( hWnd, NULL, FALSE ); - UpdateWindow32( hWnd ); - } - break; + case WM_SYSCOLORCHANGE: + color_windowframe = GetSysColor32(COLOR_WINDOWFRAME); + color_background = GetSysColor32(COLOR_BACKGROUND); + color_window = GetSysColor32(COLOR_WINDOW); + InvalidateRect32( hWnd, NULL, TRUE ); + break; - case WM_GETFONT: - return infoPtr->hFont; + case WM_SETTEXT: + if (style == SS_ICON) + /* FIXME : should we also return the previous hIcon here ??? */ + STATIC_SetIcon( wndPtr, STATIC_LoadIcon( wndPtr, (LPCSTR)lParam )); + else + DEFWND_SetText( wndPtr, (LPCSTR)lParam ); + InvalidateRect32( hWnd, NULL, FALSE ); + UpdateWindow32( hWnd ); + break; - case WM_NCHITTEST: - return HTTRANSPARENT; - - case WM_GETDLGCODE: - return DLGC_STATIC; - - case STM_GETICON: - return infoPtr->hIcon; - - case STM_SETICON: - lResult = STATIC_SetIcon( wndPtr, (HICON16)wParam ); + case WM_SETFONT: + if (style == SS_ICON) return 0; + infoPtr->hFont = (HFONT16)wParam; + if (LOWORD(lParam)) + { InvalidateRect32( hWnd, NULL, FALSE ); UpdateWindow32( hWnd ); - break; + } + break; - default: - lResult = DefWindowProc16(hWnd, uMsg, wParam, lParam); - break; - } + case WM_GETFONT: + return infoPtr->hFont; - return lResult; + case WM_NCHITTEST: + return HTTRANSPARENT; + + case WM_GETDLGCODE: + return DLGC_STATIC; + + case STM_GETICON: + return infoPtr->hIcon; + + case STM_SETICON: + lResult = STATIC_SetIcon( wndPtr, (HICON16)wParam ); + InvalidateRect32( hWnd, NULL, FALSE ); + UpdateWindow32( hWnd ); + break; + + default: + lResult = DefWindowProc32A(hWnd, uMsg, wParam, lParam); + break; + } + + return lResult; } static void STATIC_PaintTextfn( WND *wndPtr, HDC32 hdc ) { - RECT16 rc; - HBRUSH16 hBrush; + RECT32 rc; + HBRUSH32 hBrush; WORD wFormat; LONG style = wndPtr->dwStyle; STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra; - GetClientRect16( wndPtr->hwndSelf, &rc); + GetClientRect32( wndPtr->hwndSelf, &rc); switch (style & 0x0000000F) { @@ -225,42 +248,42 @@ static void STATIC_PaintTextfn( WND *wndPtr, HDC32 hdc ) hBrush = SendMessage32A( GetParent32(wndPtr->hwndSelf), WM_CTLCOLORSTATIC, hdc, wndPtr->hwndSelf ); if (!hBrush) hBrush = GetStockObject32(WHITE_BRUSH); - FillRect16(hdc, &rc, hBrush); - if (wndPtr->text) DrawText16( hdc, wndPtr->text, -1, &rc, wFormat ); + FillRect32( hdc, &rc, hBrush ); + if (wndPtr->text) DrawText32A( hdc, wndPtr->text, -1, &rc, wFormat ); } static void STATIC_PaintRectfn( WND *wndPtr, HDC32 hdc ) { - RECT16 rc; + RECT32 rc; HBRUSH32 hBrush; - GetClientRect16( wndPtr->hwndSelf, &rc); + GetClientRect32( wndPtr->hwndSelf, &rc); switch (wndPtr->dwStyle & 0x0f) { case SS_BLACKRECT: hBrush = CreateSolidBrush32(color_windowframe); - FillRect16( hdc, &rc, hBrush ); + FillRect32( hdc, &rc, hBrush ); break; case SS_GRAYRECT: hBrush = CreateSolidBrush32(color_background); - FillRect16( hdc, &rc, hBrush ); + FillRect32( hdc, &rc, hBrush ); break; case SS_WHITERECT: hBrush = CreateSolidBrush32(color_window); - FillRect16( hdc, &rc, hBrush ); + FillRect32( hdc, &rc, hBrush ); break; case SS_BLACKFRAME: hBrush = CreateSolidBrush32(color_windowframe); - FrameRect16( hdc, &rc, hBrush ); + FrameRect32( hdc, &rc, hBrush ); break; case SS_GRAYFRAME: hBrush = CreateSolidBrush32(color_background); - FrameRect16( hdc, &rc, hBrush ); + FrameRect32( hdc, &rc, hBrush ); break; case SS_WHITEFRAME: hBrush = CreateSolidBrush32(color_window); - FrameRect16( hdc, &rc, hBrush ); + FrameRect32( hdc, &rc, hBrush ); break; default: return; diff --git a/controls/widgets.c b/controls/widgets.c index 7efc7650302..20fe5a5ecd8 100644 --- a/controls/widgets.c +++ b/controls/widgets.c @@ -48,8 +48,6 @@ typedef struct static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] = { - { CS_GLOBALCLASS | CS_PARENTDC, - sizeof(STATICINFO), 0, "StaticWndProc", "Static" }, { CS_GLOBALCLASS, sizeof(MDICLIENTINFO), STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDIClient" } }; @@ -77,8 +75,11 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[BIC32_NB_CLASSES] = { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc, 0, sizeof(void *), 0, 0, IDC_ARROW, 0, 0, "ComboLBox" }, /* BIC32_POPUPMENU */ - { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, - 0, sizeof(HMENU32), 0, 0, IDC_ARROW, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME }, + { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, + sizeof(HMENU32), 0, 0, IDC_ARROW, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME }, + /* BIC32_STATIC */ + { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc, + 0, sizeof(STATICINFO), 0, 0, IDC_ARROW, 0, 0, "Static" }, /* BIC32_SCROLL */ { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, IDC_ARROW, 0, 0, "ScrollBar"}, diff --git a/documentation/Makefile.in b/documentation/Makefile.in new file mode 100644 index 00000000000..2e6c4a7dca1 --- /dev/null +++ b/documentation/Makefile.in @@ -0,0 +1,27 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = .. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = none + +SOURCES = \ + wine.texinfo \ + $(TOPSRCDIR)/AUTHORS \ + $(TOPSRCDIR)/LICENSE \ + $(TOPSRCDIR)/WARRANTY + +all: wine.info + +@MAKE_RULES@ + +wine.info: $(SOURCES) + makeinfo -I$(TOPSRCDIR) $(SRCDIR)/wine.texinfo + +wine.dvi: $(SOURCES) + texi2dvi $(SRCDIR)/wine.texinfo + +clean:: + $(RM) wine.aux wine.cp wine.cps wine.dvi wine.fn wine.fns wine.info \ + wine.ky wine.log wine.pg wine.toc wine.tp wine.tps wine.vr + +### Dependencies: diff --git a/documentation/win95look b/documentation/win95look new file mode 100644 index 00000000000..c57e7aeb57c --- /dev/null +++ b/documentation/win95look @@ -0,0 +1,50 @@ +Win95 interface code is being introduced. + +Instead of compiling Wine for Win3.1 vs. Win95 using #define switches, +the code now looks in a special [Tweaks.Layout] section of wine.conf +for a "Win95Look=true" entry. + +A few new sections and a number of entries have been added to the +wine.conf file -- these are for debugging the Win95 tweaks only and may +be removed in a future release! These entries/sections are: + +[Tweak.Fonts] +System.Height= # Sets the height of the system typeface +System.Bold=[true|false] # Whether the system font should be boldfaced +System.Italic=[true|false] # Whether the system font should be italicized +System.Underline=[true|false] # Whether the system font should be underlined +System.StrikeOut=[true|false] # Whether the system font should be struck out +OEMFixed.xxx # Same parameters for the OEM fixed typeface +AnsiFixed.xxx # Same parameters for the Ansi fixed typeface +AnsiVar.xxx # Same parameters for the Ansi variable typeface +SystemFixed.xxx # Same parameters for the System fixed typeface + +[Tweak.Layout] +Win95Look=[true|false] # Enables/disables the Win95 look and feel +MenuHeight= # Sets the height of the menu bar +MenuBarItemTopNudge= # Nudges the menu bar items down/up +MenuBarItemLeftNudge= # Nudges the menu bar items left/right +MenuItemTopNudge= # Nudges the menu items down/up +MenuItemLeftNudge= # Nudges the menu items left/right +MenuHighlightTopNudge= # Nudges the top of the highlight bar +MenuHighlightLeftNudge= # Nudges the left side of the highlight bar +MenuHighlightRightNudge= # Nudges the right side of the highlight bar +MenuHighlightBottomNudge= # Nudges the bottom of the highlight bar +CaptionHeight= # Sets the height of window captions +CaptionLeftNudge= # Nudges the caption text of windows down/up +CaptionTopNudge= # Nudges the caption text of windows left/right +CaptionAlignment=[left|right|center] # Sets the alignment of caption text +SysControlNudge= # Nudges the system menu left/right +MaxControlNudge= # Nudges the maximize control left/right +MinControlNudge= # Nudges the minimize control left/right +ScrollBarWidth= # Sets scroll bar sizes +DialogFrameWidth= # Sets the frame width of dialog boxes + +[Tweak.Colors] +PenFF95.Red=<0-255> # Sets the red value of the Win95 white pen +PenFF95.Grn=<0-255> # Sets the green value of the Win95 white pen +PenFF95.Blu=<0-255> # Sets the blue value of the Win95 white pen +PenE095.xxx # Sets the RGB values of the Win95 grey-88 pen +PenC095.xxx # Sets the RGB values of the Win95 grey-75 pen +Pen8095.xxx # Sets the RGB values of the Win95 grey-50 pen +Pen0095.xxx # Sets the RGB values of the Win95 black pen diff --git a/documentation/wine.texinfo b/documentation/wine.texinfo new file mode 100644 index 00000000000..1099cf3c086 --- /dev/null +++ b/documentation/wine.texinfo @@ -0,0 +1,780 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename wine.info +@settitle Wine Reference Manual +@iftex +@afourpaper +@end iftex +@c %**end of header + +@ifinfo +@format +START-INFO-DIR-ENTRY +* wine: (wine.info). The Windows Emulator. +END-INFO-DIR-ENTRY +@end format +@end ifinfo + +@iftex +@c @finalout +@end iftex + +@ifinfo +This file documents Wine, the Windows Emulator. + +@c +Copyright @copyright{} 1997 The Wine authors. @* +@xref{Authors}, for a list of the copyright holders. + +Permission is granted to make and distribute verbatim +copies of this manual provided the copyright notice and +this permission notice are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX +and print the results, provided the printed document +carries a copying permission notice identical to this +one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified +versions of this manual under the conditions stated in +the section entitled ``License, Warranty, and Authors of Wine''. + +@sp 4 +FIXME: UNIX and POSIX trademarks. @* +MS-Windows, Windows-NT, Windows 95 are registered trademarks of +Microsoft Corp. Postscript is a registered trademark of Adobe Systems +Inc. All other product names mentioned herein are the trademarks of +their respective owners. +@end ifinfo + +@c begin chapters on right pages +@setchapternewpage odd + +@titlepage +@sp 10 + +@center @titlefont{The Wine Reference Manual} +@center Edition 0.0.1, 6 July 1997 + + +@c The following two commands start the copyright page. +@page +@vskip 0pt plus 1filll + +Copyright @copyright{} 1997 The Wine authors. @* +@xref{Authors}, for a list of the copyright holders. + +Permission is granted to make and distribute verbatim +copies of this manual provided the copyright notice and +this permission notice are preserved on all copies. + +Permission is granted to copy and distribute modified +versions of this manual under the conditions stated in +the section entitled ``License, Warranty, and Authors of Wine''. + +@sp 4 +FIXME: UNIX and POSIX trademarks. @* +MS-Windows, Windows-NT, Windows 95 are registered trademarks of +Microsoft Corp. Postscript is a registered trademark of Adobe Systems +Inc. All other product names mentioned herein are the trademarks of +their respective owners. +@end titlepage + + + +@c +@c SETTINGS, DEFINES, MACROS +@c + +@c Edit this macro manually in the above parts of the document +@macro winemanualversion +0.0.1 +@end macro + +@c Edit this macro manually in the above parts of the document +@macro winemanualdate +6 July 1997 +@end macro + +@c Edit this macro manually into the TeX titlepage +@macro winemanualtitle {} +The Wine Reference Manual +@end macro + +@c +@c MICROSOFT +@c + +@c FIXME: automatical trademark reference +@macro mswindows +MS-Windows +@end macro + +@c FIXME: automatical trademark reference +@c spell it always the same +@macro WIN32 +WIN32 +@end macro + +@c FIXME: automatical trademark reference +@macro WINNT +Windows NT +@end macro + +@c FIXME: automatical trademark reference +@macro WIN95 +Windows 95 +@end macro + + +@c +@c THE OTHERS +@c +@c FIXME: automatical trademark reference +@macro unix +UNIX +@end macro + +@c FIXME: automatical trademark reference +@macro posix +POSIX +@end macro +@c +@c THIS MANUAL +@c + +@c flag out differences to MS-Windows +@macro windiff +@emph{Differences to @mswindows{}:} @* +@end macro + +@macro windiffnone +@windiff{} +No differences known. +@end macro + +@c tell whether function is present in Windows 95 and/or NT +@macro winconf +@emph{Conformance to @mswindows{}:} @* +@end macro + +@macro winconfall +@winconf{} +Present in @WIN95{} and @WINNT{}. +@end macro + +@c give information about completion +@macro completion +@emph{Completion status:} @* +@end macro + +@macro completionnone +@completion{} +Not yet implemented. +@end macro + + + + + + + +@c +@c TOP NODE +@c +@ifinfo +@node Top, Copying, (dir), (dir) +@top Wine + +This is edition @winemanualversion{}, last updated @winemanualdate{}, +of @winemanualtitle{}. + +Wine (Wine Is Not an Emulator, or the WINdows Emulator) +is both an emulator that runs @mswindows{} executables and a library +that can be used to compile @mswindows{} source code. + +Wine is free software. Wine is still in development-only state. +@end ifinfo + +@menu +* Copying:: License, Warranty, and Authors of Wine. +* Introduction:: A short overview. +* Reference Manual:: The Wine reference manual. +* Installation:: Installing Wine. +* The Wine Project:: How to contribute to Wine. +* Concept Index:: Index of concepts and names. +* Type Index:: Index of types and type qualifiers. +* Function Index:: Index of functions and function-like + macros. +* Variable Index:: Index of variables and variable-like + macros. +* File Index:: Index of programs and files. +@end menu + +@node Copying, Introduction, Top, Top + +@unnumbered License, Warranty, and Authors of Wine. +@cindex copying conditions for Wine +@cindex conditions for copying Wine +@cindex Wine copying conditions + +The Wine license, warranty, and list of authors together form the +copyright for Wine. Read these sections carefully. + +@menu +* License:: The Wine license. +* Warranty:: Wine comes with no warranty. +* Authors:: The persons that contributed to Wine. +@end menu + +@node License, Warranty, , Copying +@cindex Wine license +@cindex license of Wine + +@unnumberedsec The Wine License +Wine is distributed under the following copyright. + +@quotation +@include LICENSE +@end quotation + +@node Warranty, Authors, License, Copying +@cindex Wine warranty +@cindex warranty of Wine + +@unnumberedsec The Wine Warranty + +@quotation +@include WARRANTY +@end quotation + +@node Authors, , Warranty, Copying +@cindex Wine authors +@cindex authors of Wine +@cindex copyright holders of Wine +@cindex Wine copyright holders + +@unnumberedsec The Wine Authors + +@quotation +@include AUTHORS +@end quotation + +These persons also hold the copyright on Wine. + +The overall coordination is done by @* +Alexandre Julliard @* +@email{julliard@@lrc.epfl.ch} + + + +@node Introduction, Reference Manual, Copying, Top +@chapter Introduction + +FIXME: Somebody should say some solemn words. + +@xref{The Wine Project}, if you consider contributing some work. + + +@node Reference Manual, Installation, Introduction, Top + +@menu +* @WIN32{} Reference Manual:: The @WIN32{} function calls and data types. +* Resources and INI files:: How to determine the appearance and + behaviour of Wine programs. +* Metafiles--Icons--Bitmaps:: FIXME missing. +* Debugging:: Debugging Wine. +* Programs:: Programs written to run in/with Wine. +* Tools:: Programs to support Wine. +@end menu + +@node @WIN32{} Reference Manual, Resources and INI files, , Reference Manual +@chapter The @WIN32{} Reference Manual + +@menu +* Kernel Objects:: How the Wine kernel keeps information. +* Processes and Threads:: Job control and management in Wine. +* Users and Groups:: Security in Wine. +* Date and Time:: Functions for getting the date and time + and for conversion between formats. +* System Information:: Getting information about the hardware + and software the system runs on. +* Memory Management:: How your programs get memory from + Wine. +* I/O Facilities:: Input/Output in Wine. + .everything except communication and windows +* Communication:: How processes can communicate. +* Windows and Graphics:: GUI functions of @WIN32{}. +* Errors and Exceptions:: How your program can report errors. + . messaging +* Resources:: Functions for dealing with resources. +* The Registry:: FIXME missing. +* Dynamic Link Libraries:: Functions for dealing with DLL's. +@end menu + +@node Kernel Objects, Processes and Threads, , @WIN32{} Reference Manual +@section Kernel Objects + + +@node Processes and Threads, Users and Groups, Kernel Objects, @WIN32{} Reference Manual +@section Processes and Threads + +@node Users and Groups, Date and Time, Processes and Threads, @WIN32{} Reference Manual +@section Users and Groups + +@node Date and Time, System Information, Users and Groups, @WIN32{} Reference Manual +@section Date and Time + +This section describes functions for manipulating dates and times. This +includes the current time, the creation or manipulation times of files +and other objects, and conversion between different time +representations. + +@menu +* File Times:: Creation and manipulation times of files. +@end menu + +@node File Times, , , Date and Time +@subsection File Times + +@menu +* Type FILETIME:: The data structure used for specifying + file times. +* Compare File Times:: Compare two file times. +* Get File Times:: Get the time attributes of a file. +@end menu + +@c +@c *** struct FILETIME *** +@c +@node Type FILETIME, Compare File Times, , File Times + +@noindent +File times in Wine are specified by the data type @code{FILETIME}, +defined in @file{windows.h}. + +@deftp {Data type} FILETIME +This is the data type for specifying file times. The file times are +stored with 64 bit precision. The actual data type is a structure with +two 32 bit values which are interpreted as the low and high parts of a +64-bit value. This value gives a time measured in a granularity of 100 +nanoseconds, so 1.5 seconds are specified by a value of 15,000,000. In +Wine, this 64-bit value is signed, with the sign taken from the high +part. The lower part is used as unsigned. + +The definition of @code{FILETIME} reads: +@example +typedef struct _FILETIME +@{ + INT32 dwLowDateTime; + INT32 dwHighDateTime; +@} FILETIME; +@end example + +@cindex epoch in file time +The @code{FILETIME} structure may be used to hold absolute or relative +times. Absolute times are given as the number of 100 nanoseconds +intervals elapsed since 1 January 1601, 00:00:00 UTC (Coordinated +Universal Time, which is GMT, Greenwich Mean Time). This might be +called the @dfn{epoch} for file times. With a signed 64-bit value, this +representation covers absolute times of 29247 years around the epoch. + +@windiff{} +In @mswindows{}, the elements of the structure are apparently of type +@code{DWORD}. Whether the full 64 bit value is interpreted as signed or +unsigned I do not know. +@end deftp + +@c +@c *** CompareFileTime *** +@c +@node Compare File Times, Get File Times, Type FILETIME, File Times + +@noindent +The Wine function @code{CompareFileTime} compares two file times, and +returns whether the first time is less than, equal to, or greater than +the second file time. It is defined in @file{windows.h}. + +@deftypefn {WIN32 function} LONG CompareFileTime (@w{CONST FILETIME* @var{time_1},} @w{CONST FILETIME* @var{time_2})} +This function returns @code{1}, if @var{time_1} is greater than +@var{time_2}, @code{-1} if it is less, and @code{0} if both times are +equal. + +@winconfall{} + +@windiffnone{} + +@completionnone{} +@end deftypefn + +@c +@c ***GetFileTime *** +@c +@node Get File Times, , Compare File Times, File Times +@noindent +FIXME: move this function to the file IO section. @* +The Wine function @code{GetFileTime} returns the creation time and +the times of last the read and modification access to a file. It is +defined in @file{windows.h}. + +@deftypefn {WIN32 function} BOOL GetFileTime (@w{HANDLE @var{file},} @w{LPFILETIME @var{ctime},} @w{LPFILETIME @var{atime},} @w{LPFILETIME @var{mtime})} +This function obtains for the specified @var{file} the creation time +@var{ctime}, the time of the last access to the file @var{atime}, and +the time of the last modification (write) to the file, @var{mtime}. +The @var{file} handle must have been obtained by opening the file with +@code{GENERIC_READ} access. The file time arguments of this function are +pointers to @code{FILETIME} variables, which are filled with a value that +indicates an absolute time in UTC. To convert these values to local +times, use the function @code{FileTimeToLocalFileTime}. If you do not +need some of the times, you can pass a @code{NULL} pointer. +The function returns @code{TRUE} on success, @code{FALSE} on failure. + +@winconfall{} + +@windiffnone{} +@end deftypefn + + +@node System Information, Memory Management, Date and Time, @WIN32{} Reference Manual +@section System Information + +@node Memory Management, I/O Facilities, System Information, @WIN32{} Reference Manual +@section Memory Management + +@node I/O Facilities, Communication, Memory Management, @WIN32{} Reference Manual +@section I/O Facilities + +@node Communication, Windows and Graphics, I/O Facilities, @WIN32{} Reference Manual +@section Communication + +@node Windows and Graphics, Errors and Exceptions, Communication, @WIN32{} Reference Manual +@section Windows and Graphics + +@node Errors and Exceptions, Resources, Windows and Graphics, @WIN32{} Reference Manual +@section Errors and Exceptions + +@node Resources, The Registry, Errors and Exceptions, @WIN32{} Reference Manual +@section Resources + +@node The Registry, Dynamic Link Libraries, Resources, @WIN32{} Reference Manual +@section The Registry + +@node Dynamic Link Libraries, , The Registry, @WIN32{} Reference Manual +@section Dynamic Link Libraries (DLL's) + + + + +@node Resources and INI files, Metafiles--Icons--Bitmaps, @WIN32{} Reference Manual, Reference Manual +@chapter Resources and @file{INI} Files + +@node Metafiles--Icons--Bitmaps, Debugging, Resources and INI files, Reference Manual +@chapter Metafiles --- Icons --- Bitmaps + +@node Debugging, Programs, Metafiles--Icons--Bitmaps, Reference Manual +@chapter Debugging + +@node Programs, Tools, Debugging, Reference Manual +@chapter Programs + +@node Tools, , Programs, Reference Manual +@chapter Tools + +@node Installation, The Wine Project, Reference Manual, Top +@chapter Wine Installation +FIXME: write installation guide + +@menu +* Applying patches:: How to update Wine to a newer version. +@end menu + +@node Applying patches, , , Installation +@section Applying patches +@xref{Creating patches}, for instructions on creating patches. + +FIXME: write patch instructions + + +@node The Wine Project, , Installation, Top +@chapter The Wine project +@cindex Wine project contributions +@cindex project contributions to Wine + +If you are new to Wine and want to support this project, here are +some suggestions. + +@menu +* Creating patches:: How to create patches for Wine. +* Adding Documentation:: Templates for the documentation. +@end menu + +@xref{Debugging}, for advice on how to debug Wine. +@xref{Applying patches}, for instructions on applying patches. + +FIXME: what is most urgently needed + +@node Creating patches, Adding Documentation, , The Wine Project +@section Creating patches +@xref{Applying patches}, for instructions on applying patches. + +FIXME: how to create patches + +@node Adding Documentation, , Creating patches, The Wine Project +@section Adding Documentation + +@ifinfo +Here are some templates which should help you collaborate on this +documentation. Read the text below before examining them. +@end ifinfo + +FIXME they are not here in dvi + +@menu +* Type Template:: How to document data types in Wine's + include files. +* Function Template:: How to document an (API) function of + Wine. +@end menu + + +These are my tips for adding documentation. + +Do not simply copy documentation from @mswindows{} related +material. Except from risking copyright violations, which you would not +want to do, there is another aspect to that: +As Wine is a product to run on @unix{} and @unix{}-like workstations, +it seems a good idea to me to organize this documentation primarily for +the well-trained @unix{} reader. Please keep that in mind when you add +some documentation. + +Finally, read the info pages for @code{texinfo}. + +@subsection Template introduction +@iftex +On the following pages you will find some @code{texinfo} templates, which +should help you collaborate on this documentation. +@end iftex + +These templates give hints on how to document data types, functions, +variables, constants etc. in Wine. +As documentation evolves, you will find common features of data types +that should be described in a unified fashion. In such a case, please +add a corresponding style guide-line here, in this very place, to help +keeping documentation of data types unified. + + +Start out the type or function with a new node. Write a comment before +the node, listing all data types (and functions) described in the node, +like this: +@example +@@c +@@c *** struct FILETIME *** +@@c +@@node Type FILETIME, NextNodeName, PreviousNodeName, ParentNodeName +@end example + +The node command describes the node name and the names of the next node, +the previous node, and the parent node. The parent node should contain +a menu entry for this node. The previous node is the node that appears +before this node in the parent node menu. The next node is the node +succeeding this one in the parent node menu. If there is no previous or +next node, omit the name (putting just a single space between the two +commata). + +The node name must be a unique sequence of words. Case is important, so +@emph{Type} and @emph{type} are distinct. The node name must not contain +special characters like @samp{@@, @{, @}} or the comma. If you need to +give a node the same name as a function, data type, etc., use the words +@samp{Type}, @samp{Function}, etc. before the identifier. + +Always put the names of the node and its links on the same line, even if +it gets rather long. + +If there are two or more data types or functions described in the node, +adapt the comment like this: +@example +@@c +@@c *** int X *** +@@c *** long Y() *** +@@c +@@node Ints and Longs, NextNodeName, PreviousNodeName, ParentNodeName +@end example + +Start the description of the type(s) or function(s) with a single +non-indented paragraph that gives a one-line description of the type(s) +or function(s) and states the include files that are required. +@example +@@noindent +File times in Wine are specified by the data type @@code@{FILETIME@}, +defined in @@file@{windows.h@}. +@end example +If several types or functions are closely connected, use one paragraph +as a common description. If more paragraphs are required for a proper +description, indent all but the first of them. + +Then start the definition of the data type or function. Use the proper +macro and specify a category and the formal definition on the same +line. For proper categories, take a look at the specialized templates. +Again, put everything that belongs to the header into a single line. +@example +@@deftp @{Data type@} FILETIME +@end example + +In the definition, give a verbal explanation of the data type or +function. The explanation should be rather complete, exact, and +comprehensible, than well-structured. This is the point where you can +tell everything you want. Do not be afraid of wasting space. +Do not describe the @mswindows{} situation but only say what Wine +does. That is important. (Sometimes they might even do the same.) +@example +This is the data type for specifying file times. The file times are +stored with 64 bit precision. The actual data type is a structure with +two 32 bit values which are interpreted as the low and high parts of a +64-bit value. This value gives a time measured in a granularity of 100 +nanoseconds, so 1.5 seconds are specified by a value of 15,000,000. In +Wine, this 64-bit value is signed, with the sign taken from the high +part. The lower part is used as unsigned. +@end example + +For data types, it is recommended to quote the definition from the +header file. For a function, you might give a short example of its +usage. You may also put one example in the end of a node that explains +several of the functions in the node. Remember that cut-and-paste from a +well prepared example will help the readers write their code. +@example +The definition of @@code@{FILETIME@} reads: +@@example +typedef struct _FILETIME +@@@{ + INT32 dwLowDateTime; + INT32 dwHighDateTime; +@@@} FILETIME; +@@end example +@end example + +You could also use the @code{cindex} command which creates an entry in +the concept index. The @code{texinfo} manual recommends to keep concept +entries distinct, so that a single concept index entry puts to one +well-defined place in the document. Use lower case letters for index +entries, unless they are proper names or quotes from actual code. +@example +@@cindex epoch in file time +The @@code@{FILETIME@} structure may be used to hold absolute or relative +times. Absolute times are given as the number of 100 nanoseconds +intervals elapsed since 1 January 1601, 00:00:00 UTC (Coordinated +Universal Time, which is GMT, Greenwich Mean Time). This might be +called the @@dfn@{epoch@} for file times. With a signed 64-bit value, this +representation covers absolute times of 29247 years around the epoch. +@end example + +After the verbal documentation, you can add some special fields +describing bugs, implementation dependencies etc. Two of these are +recommended to attach to all descriptions. One describes the +conformance of the data type or function to @mswindows{} products, +i.e. whether the item is also present in @WINNT{} and @WIN95{}. The +other one describes known differences of the Wine item to its +@mswindows{} counterpart. Both will greatly help in porting software +from @mswindows{} to Wine and vice versa. +@example +@@winconfall@{@} + +@@windiff@{@} +In @@mswindows@{@}, the elements of the structure are apparently of type +@@code@{DWORD@}. Whether the full 64 bit value is interpreted as signed or +unsigned I do not know. +@end example + +If you find that more of these property attributes are necessary, feel +free to create your own ones. But keep in mind that they should be +applicable more or less to all described items. Very special properties +will better be put into the verbal text. + +Finally end the definition of the data type or function: +@example +@@end deftp +@end example + +Do not forget to enter the node in the menu of its top node, and do +properly link the node to its successor and predecessor. + + + + + + +@node Type Template, Function Template, , Adding Documentation +@subsection Data type template + +Category: Data type + +@node Function Template, , Type Template, Adding Documentation +@subsection API function template + +Functions should be given category names, to indicate which API they +belong to. Please add items to the list of categories possible. + +Category: WIN32 function + +@example +@@c +@@c ***GetFileTime() *** +@@c +@@node Get File Times, , Compare File Times, File Times +@@noindent +The Wine function @@code@{GetFileTime@} returns the creation time and +the times of last the read and modification access to a file. It is +defined in @@file@{windows.h@}. + +@@deftypefn @{WIN32 function@} BOOL GetFileTime (@@w@{HANDLE @@var@{file@},@} @@w@{LPFILETIME @@var@{ctime@},@} @@w@{LPFILETIME @@var@{atime@},@} @@w@{LPFILETIME @@var@{mtime@})@} +This function obtains for the specified @@var@{file@} the creation time +@@var@{ctime@}, the time of the last access to the file @@var@{atime@}, and +the time of the last modification (write) to the file, @@var@{mtime@}. +The @@var@{file@} handle must have been obtained by opening the file with +@@code@{GENERIC_READ@} access. The file time arguments of this function are +pointers to @@code@{FILETIME@} variables, which are filled with a value that +indicates an absolute time in UTC. To convert these values to local +times, use the function @@code@{FileTimeToLocalFileTime@}. If you do not +need some of the times, you can pass a @@code@{NULL@} pointer. +The function returns @@code@{TRUE@} on success, @@code@{FALSE@} on failure. + +@@winconfall@{@} + +@@windiffnone@{@} +@@end deftypefn +@end example + + + + + +@node Concept Index, , , Top +@comment node-name, next, previous, up +@unnumbered Concept Index +@printindex cp + +@node Type Index, , , Top +@comment node-name, next, previous, up +@unnumbered Type Index +@printindex tp + +@node Function Index, , , Top +@comment node-name, next, previous, up +@unnumbered Function Index +@printindex fn + +@node Variable Index, , , Top +@comment node-name, next, previous, up +@unnumbered Variable Index +@printindex vr + +@node File Index, , , Top +@comment node-name, next, previous, up +@unnumbered File and Program Index +@printindex pg + + +@contents +@bye diff --git a/files/dos_fs.c b/files/dos_fs.c index 5bb8b3547e4..014b41e7c77 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -1202,16 +1202,121 @@ BOOL32 FindClose32( HANDLE32 handle ) * * Convert a Unix time to FILETIME format. * The FILETIME structure is a 64-bit value representing the number of - * 100-nanosecond intervals since January 1, 1601. - * 'remainder' is the fraction of 100-ns intervals smaller than 1 second - * that couldn't be stored in the time_t value. + * 100-nanosecond intervals since January 1, 1601, 0:00. + * 'remainder' is the nonnegative number of 100-ns intervals + * corresponding to the time fraction smaller than 1 second that + * couldn't be stored in the time_t value. */ void DOSFS_UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder ) { - /* FIXME :-) */ - filetime->dwLowDateTime = unix_time; - filetime->dwHighDateTime = 0; + /* NOTES: + + CONSTANTS: + The time difference between 1 January 1601, 00:00:00 and + 1 January 1970, 00:00:00 is 369 years, plus the leap years + from 1604 to 1968, excluding 1700, 1800, 1900. + This makes (1968 - 1600) / 4 - 3 = 89 leap days, and a total + of 134774 days. + + Any day in that period had 24 * 60 * 60 = 86400 seconds. + + The time difference is 134774 * 86400 * 10000000, which can be written + 116444736000000000 + 27111902 * 2^32 + 3577643008 + 413 * 2^48 + 45534 * 2^32 + 54590 * 2^16 + 32768 + + If you find that these constants are buggy, please change them in all + instances in both conversion functions. + + VERSIONS: + There are two versions, one of them uses long long variables and + is presumably faster but not ISO C. The other one uses standard C + data types and operations but relies on the assumption that negative + numbers are stored as 2's complement (-1 is 0xffff....). If this + assumption is violated, dates before 1970 will not convert correctly. + This should however work on any reasonable architecture where WINE + will run. + + DETAILS: + + Take care not to remove the casts. I have tested these functions + (in both versions) for a lot of numbers. I would be interested in + results on other compilers than GCC. + + The operations have been designed to account for the possibility + of 64-bit time_t in future UNICES. Even the versions without + internal long long numbers will work if time_t only is 64 bit. + A 32-bit shift, which was necessary for that operation, turned out + not to work correctly in GCC, besides giving the warning. So I + used a double 16-bit shift instead. Numbers are in the ISO version + represented by three limbs, the most significant with 32 bit, the + other two with 16 bit each. + + As the modulo-operator % is not well-defined for negative numbers, + negative divisors have been avoided in DOSFS_FileTimeToUnixTime. + + There might be quicker ways to do this in C. Certainly so in + assembler. + + Claus Fischer, fischer@iue.tuwien.ac.at + */ + +#if __GNUC__ +# define USE_LONG_LONG 1 +#else +# define USE_LONG_LONG 0 +#endif + +#if USE_LONG_LONG /* gcc supports long long type */ + + long long int t = unix_time; + t *= 10000000; + t += 116444736000000000LL; + t += remainder; + filetime->dwLowDateTime = (UINT32)t; + filetime->dwHighDateTime = (UINT32)(t >> 32); + +#else /* ISO version */ + + UINT32 a0; /* 16 bit, low bits */ + UINT32 a1; /* 16 bit, medium bits */ + UINT32 a2; /* 32 bit, high bits */ + + /* Copy the unix time to a2/a1/a0 */ + a0 = unix_time & 0xffff; + a1 = (unix_time >> 16) & 0xffff; + /* This is obsolete if unix_time is only 32 bits, but it does not hurt. + Do not replace this by >> 32, it gives a compiler warning and it does + not work. */ + a2 = (unix_time >= 0 ? (unix_time >> 16) >> 16 : + ~((~unix_time >> 16) >> 16)); + + /* Multiply a by 10000000 (a = a2/a1/a0) + Split the factor into 10000 * 1000 which are both less than 0xffff. */ + a0 *= 10000; + a1 = a1 * 10000 + (a0 >> 16); + a2 = a2 * 10000 + (a1 >> 16); + a0 &= 0xffff; + a1 &= 0xffff; + + a0 *= 1000; + a1 = a1 * 1000 + (a0 >> 16); + a2 = a2 * 1000 + (a1 >> 16); + a0 &= 0xffff; + a1 &= 0xffff; + + /* Add the time difference and the remainder */ + a0 += 32768 + (remainder & 0xffff); + a1 += 54590 + (remainder >> 16 ) + (a0 >> 16); + a2 += 27111902 + (a1 >> 16); + a0 &= 0xffff; + a1 &= 0xffff; + + /* Set filetime */ + filetime->dwLowDateTime = (a1 << 16) + a0; + filetime->dwHighDateTime = a2; +#endif } @@ -1219,13 +1324,95 @@ void DOSFS_UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, * DOSFS_FileTimeToUnixTime * * Convert a FILETIME format to Unix time. - * If not NULL, 'remainder' contains the fractional part of the filetime. + * If not NULL, 'remainder' contains the fractional part of the filetime, + * in the range of [0..9999999] (even if time_t is negative). */ time_t DOSFS_FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ) { - /* FIXME :-) */ - if (remainder) *remainder = 0; - return filetime->dwLowDateTime; + /* Read the comment in the function DOSFS_UnixTimeToFileTime. */ +#if USE_LONG_LONG + + long long int t = filetime->dwHighDateTime; + t <<= 32; + t += (UINT32)filetime->dwLowDateTime; + t -= 116444736000000000LL; + if (t < 0) + { + if (remainder) *remainder = 9999999 - (-t - 1) % 10000000; + return -1 - ((-t - 1) / 10000000); + } + else + { + if (remainder) *remainder = t % 10000000; + return t / 10000000; + } + +#else /* ISO version */ + + UINT32 a0; /* 16 bit, low bits */ + UINT32 a1; /* 16 bit, medium bits */ + UINT32 a2; /* 32 bit, high bits */ + UINT32 r; /* remainder of division */ + unsigned int carry; /* carry bit for subtraction */ + int negative; /* whether a represents a negative value */ + + /* Copy the time values to a2/a1/a0 */ + a2 = (UINT32)filetime->dwHighDateTime; + a1 = ((UINT32)filetime->dwLowDateTime ) >> 16; + a0 = ((UINT32)filetime->dwLowDateTime ) & 0xffff; + + /* Subtract the time difference */ + if (a0 >= 32768 ) a0 -= 32768 , carry = 0; + else a0 += (1 << 16) - 32768 , carry = 1; + + if (a1 >= 54590 + carry) a1 -= 54590 + carry, carry = 0; + else a1 += (1 << 16) - 54590 - carry, carry = 1; + + a2 -= 27111902 + carry; + + /* If a is negative, replace a by (-1-a) */ + negative = (a2 >= ((UINT32)1) << 31); + if (negative) + { + /* Set a to -a - 1 (a is a2/a1/a0) */ + a0 = 0xffff - a0; + a1 = 0xffff - a1; + a2 = ~a2; + } + + /* Divide a by 10000000 (a = a2/a1/a0), put the rest into r. + Split the divisor into 10000 * 1000 which are both less than 0xffff. */ + a1 += (a2 % 10000) << 16; + a2 /= 10000; + a0 += (a1 % 10000) << 16; + a1 /= 10000; + r = a0 % 10000; + a0 /= 10000; + + a1 += (a2 % 1000) << 16; + a2 /= 1000; + a0 += (a1 % 1000) << 16; + a1 /= 1000; + r += (a0 % 1000) * 10000; + a0 /= 1000; + + /* If a was negative, replace a by (-1-a) and r by (9999999 - r) */ + if (negative) + { + /* Set a to -a - 1 (a is a2/a1/a0) */ + a0 = 0xffff - a0; + a1 = 0xffff - a1; + a2 = ~a2; + + r = 9999999 - r; + } + + if (remainder) *remainder = r; + + /* Do not replace this by << 32, it gives a compiler warning and it does + not work. */ + return ((((time_t)a2) << 16) << 16) + (a1 << 16) + a0; +#endif } diff --git a/files/drive.c b/files/drive.c index 3fb43c1e935..c4a88ded90e 100644 --- a/files/drive.c +++ b/files/drive.c @@ -14,7 +14,7 @@ #if defined(__linux__) || defined(sun) || defined(hpux) #include #endif -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #include #include diff --git a/files/file.c b/files/file.c index 1625f399ff0..8b1c31eb8d9 100644 --- a/files/file.c +++ b/files/file.c @@ -38,6 +38,19 @@ #define MAP_ANON MAP_ANONYMOUS #endif +struct DOS_FILE_LOCK { + struct DOS_FILE_LOCK * next; + DWORD base; + DWORD len; + DWORD processId; + FILE_OBJECT * dos_file; + char * unix_name; +}; + +typedef struct DOS_FILE_LOCK DOS_FILE_LOCK; + +static DOS_FILE_LOCK *locks = NULL; +static void DOS_RemoveFileLocks(FILE_OBJECT *file); /*********************************************************************** * FILE_Alloc @@ -75,6 +88,8 @@ void FILE_Destroy( K32OBJ *ptr ) FILE_OBJECT *file = (FILE_OBJECT *)ptr; assert( ptr->type == K32OBJ_FILE ); + DOS_RemoveFileLocks(file); + if (file->unix_handle != -1) close( file->unix_handle ); if (file->unix_name) HeapFree( SystemHeap, 0, file->unix_name ); ptr->type = K32OBJ_UNKNOWN; @@ -621,16 +636,19 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode, char *p; int unixMode; - if (!name || !ofs) return HFILE_ERROR32; + if (!ofs) return HFILE_ERROR32; + + + ofs->cBytes = sizeof(OFSTRUCT); + ofs->nErrCode = 0; + if (mode & OF_REOPEN) name = ofs->szPathName; if (!name) { fprintf(stderr, "ERROR: FILE_DoOpenFile() called with `name' set to NULL ! Please debug.\n"); return HFILE_ERROR32; } - ofs->cBytes = sizeof(OFSTRUCT); - ofs->nErrCode = 0; - if (mode & OF_REOPEN) name = ofs->szPathName; + dprintf_file( stddeb, "OpenFile: %s %04x\n", name, mode ); /* the watcom 10.6 IDE relies on a valid path returned in ofs->szPathName @@ -1201,8 +1219,12 @@ LPVOID FILE_mmap( FILE_OBJECT *file, LPVOID start, if (!file) { /* Linux EINVAL's on us if we don't pass MAP_PRIVATE to an anon mmap */ +#ifdef MAP_SHARED flags &= ~MAP_SHARED; +#endif +#ifdef MAP_PRIVATE flags |= MAP_PRIVATE; +#endif #ifdef MAP_ANON flags |= MAP_ANON; #else @@ -1237,25 +1259,149 @@ DWORD GetFileType( HFILE32 hFile ) } +/************************************************************************** + * MoveFileEx32A (KERNEL32.???) + * + * + */ +BOOL32 MoveFileEx32A( LPCSTR fn1, LPCSTR fn2, DWORD flag ) +{ + DOS_FULL_NAME full_name1, full_name2; + int mode=0; /* mode == 1: use copy */ + + dprintf_file( stddeb, "MoveFileEx32A(%s,%s,%04lx)\n", fn1, fn2, flag); + + if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE; + if (fn2) { /* !fn2 means delete fn1 */ + if (!DOSFS_GetFullName( fn2, FALSE, &full_name2 )) return FALSE; + /* Source name and target path are valid */ + if ( full_name1.drive != full_name2.drive) + /* use copy, if allowed */ + if (!(flag & MOVEFILE_COPY_ALLOWED)) { + /* FIXME: Use right error code */ + DOS_ERROR( ER_FileExists, EC_Exists, SA_Abort, EL_Disk ); + return FALSE; + } + else mode =1; + if (DOSFS_GetFullName( fn2, TRUE, &full_name2 )) + /* target exists, check if we may overwrite */ + if (!(flag & MOVEFILE_REPLACE_EXISTING)) { + /* FIXME: Use right error code */ + DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk ); + return FALSE; + } + } + else /* fn2 == NULL means delete source */ + if (flag & MOVEFILE_DELAY_UNTIL_REBOOT) { + if (flag & MOVEFILE_COPY_ALLOWED) { + fprintf( stderr, + "MoveFileEx32A: Illegal flag\n"); + DOS_ERROR( ER_GeneralFailure, EC_SystemFailure, SA_Abort, + EL_Unknown ); + return FALSE; + } + /* FIXME: (bon@elektron.ikp.physik.th-darmstadt.de 970706) + Perhaps we should queue these command and execute it + when exiting... What about using on_exit(2) + */ + fprintf( stderr,"MoveFileEx32A: Please delete file %s\n", + full_name1.long_name); + fprintf( stderr," when Wine has finished\n"); + fprintf( stderr," like \"rm %s\"\n", + full_name1.long_name); + return TRUE; + } + else if (unlink( full_name1.long_name ) == -1) + { + FILE_SetDosError(); + return FALSE; + } + else return TRUE; /* successfully deleted */ + + if (flag & MOVEFILE_DELAY_UNTIL_REBOOT) { + /* FIXME: (bon@elektron.ikp.physik.th-darmstadt.de 970706) + Perhaps we should queue these command and execute it + when exiting... What about using on_exit(2) + */ + fprintf( stderr,"MoveFileEx32A: Please move existing file %s\n" + ,full_name1.long_name); + fprintf( stderr," to file %s\n" + ,full_name2.long_name); + fprintf( stderr," when Wine has finished\n"); + fprintf( stderr," like \" mv %s %s\"\n", + full_name1.long_name,full_name2.long_name); + return TRUE; + } + + if (!mode) /* move the file */ + if (rename( full_name1.long_name, full_name2.long_name ) == -1) + { + FILE_SetDosError(); + return FALSE; + } + else return TRUE; + else /* copy File */ + return CopyFile32A(fn1, fn2, (!(flag & MOVEFILE_REPLACE_EXISTING))); + +} + +/************************************************************************** + * MoveFileEx32W (KERNEL32.???) + */ +BOOL32 MoveFileEx32W( LPCWSTR fn1, LPCWSTR fn2, DWORD flag ) +{ + LPSTR afn1 = HEAP_strdupWtoA( GetProcessHeap(), 0, fn1 ); + LPSTR afn2 = HEAP_strdupWtoA( GetProcessHeap(), 0, fn2 ); + BOOL32 res = MoveFileEx32A( afn1, afn2, flag ); + HeapFree( GetProcessHeap(), 0, afn1 ); + HeapFree( GetProcessHeap(), 0, afn2 ); + return res; +} + + /************************************************************************** * MoveFile32A (KERNEL32.387) + * + * Move file or directory */ BOOL32 MoveFile32A( LPCSTR fn1, LPCSTR fn2 ) { DOS_FULL_NAME full_name1, full_name2; + struct stat fstat; dprintf_file( stddeb, "MoveFile32A(%s,%s)\n", fn1, fn2 ); if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE; + if (DOSFS_GetFullName( fn2, TRUE, &full_name2 )) + /* The new name must not already exist */ + return FALSE; if (!DOSFS_GetFullName( fn2, FALSE, &full_name2 )) return FALSE; - /* FIXME: should not replace an existing file */ - /* FIXME: should handle renaming across devices */ + + if (full_name1.drive == full_name2.drive) /* move */ if (rename( full_name1.long_name, full_name2.long_name ) == -1) { FILE_SetDosError(); return FALSE; } - return TRUE; + else return TRUE; + else /*copy */ { + if (stat( full_name1.long_name, &fstat )) + { + dprintf_file( stddeb, "Invalid source file %s\n", + full_name1.long_name); + FILE_SetDosError(); + return FALSE; + } + if (S_ISDIR(fstat.st_mode)) { + /* No Move for directories across file systems */ + /* FIXME: Use right error code */ + DOS_ERROR( ER_GeneralFailure, EC_SystemFailure, SA_Abort, + EL_Unknown ); + return FALSE; + } + else + return CopyFile32A(fn1, fn2, TRUE); /*fail, if exist */ + } } @@ -1365,3 +1511,175 @@ BOOL32 SetFileTime( HFILE32 hFile, FILE_ReleaseFile( file ); return TRUE; } + +/* Locks need to be mirrored because unix file locking is based + * on the pid. Inside of wine there can be multiple WINE processes + * that share the same unix pid. + * Read's and writes should check these locks also - not sure + * how critical that is at this point (FIXME). + */ + +static BOOL32 DOS_AddLock(FILE_OBJECT *file, struct flock *f) +{ + DOS_FILE_LOCK *curr; + DWORD processId; + + processId = GetCurrentProcessId(); + + /* check if lock overlaps a current lock for the same file */ + for (curr = locks; curr; curr = curr->next) { + if (strcmp(curr->unix_name, file->unix_name) == 0) { + if ((f->l_start < (curr->base + curr->len)) && + ((f->l_start + f->l_len) > curr->base)) { + /* region overlaps */ + return FALSE; + } + } + } + + curr = HeapAlloc( SystemHeap, 0, sizeof(DOS_FILE_LOCK) ); + curr->processId = GetCurrentProcessId(); + curr->base = f->l_start; + curr->len = f->l_len; + curr->unix_name = HEAP_strdupA( SystemHeap, 0, file->unix_name); + curr->next = locks; + curr->dos_file = file; + locks = curr; + return TRUE; +} + +static void DOS_RemoveFileLocks(FILE_OBJECT *file) +{ + DWORD processId; + DOS_FILE_LOCK **curr; + DOS_FILE_LOCK *rem; + + processId = GetCurrentProcessId(); + curr = &locks; + while (*curr) { + if ((*curr)->dos_file == file) { + rem = *curr; + *curr = (*curr)->next; + HeapFree( SystemHeap, 0, rem->unix_name ); + HeapFree( SystemHeap, 0, rem ); + } + else + curr = &(*curr)->next; + } +} + +static BOOL32 DOS_RemoveLock(FILE_OBJECT *file, struct flock *f) +{ + DWORD processId; + DOS_FILE_LOCK **curr; + DOS_FILE_LOCK *rem; + + processId = GetCurrentProcessId(); + for (curr = &locks; *curr; curr = &(*curr)->next) { + if ((*curr)->processId == processId && + (*curr)->dos_file == file && + (*curr)->base == f->l_start && + (*curr)->len == f->l_len) { + /* this is the same lock */ + rem = *curr; + *curr = (*curr)->next; + HeapFree( SystemHeap, 0, rem->unix_name ); + HeapFree( SystemHeap, 0, rem ); + return TRUE; + } + } + /* no matching lock found */ + return FALSE; +} + + +/************************************************************************** + * LockFile (KERNEL32.511) + */ +BOOL32 LockFile( + HFILE32 hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh, + DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh ) +{ + struct flock f; + FILE_OBJECT *file; + + dprintf_file(stddeb, "LockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n", + hFile, dwFileOffsetLow, dwFileOffsetHigh, + nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh); + + if (dwFileOffsetHigh || nNumberOfBytesToLockHigh) { + dprintf_file(stddeb, "LockFile32: Unimplemented bytes > 32bits\n"); + return FALSE; + } + + f.l_start = dwFileOffsetLow; + f.l_len = nNumberOfBytesToLockLow; + f.l_whence = SEEK_SET; + f.l_pid = 0; + f.l_type = F_WRLCK; + + if (!(file = FILE_GetFile(hFile))) return FALSE; + + /* shadow locks internally */ + if (!DOS_AddLock(file, &f)) { + DOS_ERROR( ER_LockViolation, EC_AccessDenied, SA_Ignore, EL_Disk ); + return FALSE; + } + + /* FIXME: Unix locking commented out for now, doesn't work with Excel */ +#ifdef USE_UNIX_LOCKS + if (fcntl(file->unix_handle, F_SETLK, &f) == -1) { + if (errno == EACCES || errno == EAGAIN) { + DOS_ERROR( ER_LockViolation, EC_AccessDenied, SA_Ignore, EL_Disk ); + } + else { + FILE_SetDosError(); + } + /* remove our internal copy of the lock */ + DOS_RemoveLock(file, &f); + return FALSE; + } +#endif + return TRUE; +} + + +/************************************************************************** + * UnlockFile (KERNEL32.703) + */ +BOOL32 UnlockFile( + HFILE32 hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh, + DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh ) +{ + FILE_OBJECT *file; + struct flock f; + + dprintf_file(stddeb, "UnlockFile32: handle %d offsetlow=%ld offsethigh=%ld nbyteslow=%ld nbyteshigh=%ld\n", + hFile, dwFileOffsetLow, dwFileOffsetHigh, + nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh); + + if (dwFileOffsetHigh || nNumberOfBytesToUnlockHigh) { + dprintf_file(stddeb, "UnlockFile32: Unimplemented bytes > 32bits\n"); + return FALSE; + } + + f.l_start = dwFileOffsetLow; + f.l_len = nNumberOfBytesToUnlockLow; + f.l_whence = SEEK_SET; + f.l_pid = 0; + f.l_type = F_UNLCK; + + if (!(file = FILE_GetFile(hFile))) return FALSE; + + DOS_RemoveLock(file, &f); /* ok if fails - may be another wine */ + + /* FIXME: Unix locking commented out for now, doesn't work with Excel */ +#ifdef USE_UNIX_LOCKS + if (fcntl(file->unix_handle, F_SETLK, &f) == -1) { + FILE_SetDosError(); + return FALSE; + } +#endif + return TRUE; +} + diff --git a/files/profile.c b/files/profile.c index d537a8ebb8e..6fac8ebd360 100644 --- a/files/profile.c +++ b/files/profile.c @@ -604,6 +604,118 @@ int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def ) } +/****************************************************************************** + * + * int PROFILE_EnumerateWineIniSection( + * char const *section, // Name of the section to enumerate + * void (*cbfn)(char const *key, char const *value, void *user), + // Address of the callback function + * void *user ) // User-specified pointer. + * + * For each entry in a section in the wine.conf file, this function will + * call the specified callback function, informing it of each key and + * value. An optional user pointer may be passed to it (if this is not + * needed, pass NULL through it and ignore the value in the callback + * function). + * + * The callback function must accept three parameters: + * The name of the key (char const *) + * The value of the key (char const *) + * A user-specified parameter (void *) + * Note that the first two are char CONST *'s, not char *'s! The callback + * MUST not modify these strings! + * + * The return value indicates the number of times the callback function + * was called. + */ +int PROFILE_EnumerateWineIniSection( + char const *section, + void (*cbfn)(char const *, char const *, void *), + void *userptr ) +{ + PROFILESECTION *scansect; + PROFILEKEY *scankey; + int calls = 0; + + /* Search for the correct section */ + for(scansect = WineProfile; scansect; scansect = scansect->next) { + if(scansect->name && !lstrcmpi32A(scansect->name, section)) { + + /* Enumerate each key with the callback */ + for(scankey = scansect->key; scankey; scankey = scankey->next) { + + /* Ignore blank entries -- these shouldn't exist, but let's + be extra careful */ + if(scankey->name[0]) { + cbfn(scankey->name, scankey->value, userptr); + ++calls; + } + } + + break; + } + } + + return calls; +} + + +/****************************************************************************** + * + * int PROFILE_GetWineIniBool( + * char const *section, + * char const *key_name, + * int def ) + * + * Reads a boolean value from the wine.ini file. This function attempts to + * be user-friendly by accepting 'n', 'N' (no), 'f', 'F' (false), or '0' + * (zero) for false, 'y', 'Y' (yes), 't', 'T' (true), or '1' (one) for + * true. Anything else results in the return of the default value. + * + * This function uses 1 to indicate true, and 0 for false. You can check + * for existence by setting def to something other than 0 or 1 and + * examining the return value. + */ +int PROFILE_GetWineIniBool( + char const *section, + char const *key_name, + int def ) +{ + char key_value[2]; + int retval; + + PROFILE_GetWineIniString(section, key_name, "~", key_value, 2); + + switch(key_value[0]) { + case 'n': + case 'N': + case 'f': + case 'F': + case '0': + retval = 0; + break; + + case 'y': + case 'Y': + case 't': + case 'T': + case '1': + retval = 1; + break; + + default: + retval = def; + } + + dprintf_profile(stddeb, "PROFILE_GetWineIniBool(\"%s\", \"%s\", %s), " + "[%c], ret %s.\n", section, key_name, + def ? "TRUE" : "FALSE", key_value[0], + retval ? "TRUE" : "FALSE"); + + return retval; +} + + /*********************************************************************** * PROFILE_LoadWineIni * diff --git a/if1632/kernel.spec b/if1632/kernel.spec index 6c4c9a9ed8e..7153880e4a0 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -43,10 +43,10 @@ type win16 42 return DisableDos 0 0 45 pascal16 LoadModule(str ptr) LoadModule16 46 pascal16 FreeModule(word) FreeModule16 -47 pascal16 GetModuleHandle(segptr) WIN16_GetModuleHandle +47 pascal16 GetModuleHandle(segstr) WIN16_GetModuleHandle 48 pascal16 GetModuleUsage(word) GetModuleUsage 49 pascal16 GetModuleFileName(word ptr s_word) GetModuleFileName16 -50 pascal GetProcAddress(word segptr) GetProcAddress16 +50 pascal GetProcAddress(word segstr) GetProcAddress16 51 pascal MakeProcInstance(segptr word) MakeProcInstance16 52 pascal16 FreeProcInstance(segptr) FreeProcInstance16 53 stub CallProcInstance @@ -56,17 +56,17 @@ type win16 57 pascal16 GetProfileInt(str str s_word) GetProfileInt16 58 pascal16 GetProfileString(str str str ptr word) GetProfileString16 59 pascal16 WriteProfileString(str str str) WriteProfileString16 -60 pascal16 FindResource(word segptr segptr) FindResource16 +60 pascal16 FindResource(word segstr segstr) FindResource16 61 pascal16 LoadResource(word word) LoadResource16 62 pascal LockResource(word) WIN16_LockResource16 63 pascal16 FreeResource(word) FreeResource16 64 pascal16 AccessResource(word word) AccessResource16 65 pascal SizeofResource(word word) SizeofResource16 66 pascal16 AllocResource(word word long) AllocResource16 -67 pascal SetResourceHandler(word segptr ptr) SetResourceHandler +67 pascal SetResourceHandler(word segstr ptr) SetResourceHandler 68 pascal16 InitAtomTable(word) InitAtomTable16 -69 pascal16 FindAtom(segptr) FindAtom16 -70 pascal16 AddAtom(segptr) AddAtom16 +69 pascal16 FindAtom(segstr) FindAtom16 +70 pascal16 AddAtom(segstr) AddAtom16 71 pascal16 DeleteAtom(word) DeleteAtom16 72 pascal16 GetAtomName(word ptr word) GetAtomName16 73 pascal16 GetAtomHandle(word) GetAtomHandle @@ -85,7 +85,7 @@ type win16 86 pascal16 _lwrite(word ptr word) _lwrite16 87 pascal16 RESERVED5(str str) lstrcmp16 88 pascal lstrcpy(segptr str) lstrcpy16 -89 pascal lstrcat(segptr str) lstrcat16 +89 pascal lstrcat(segstr str) lstrcat16 90 pascal16 lstrlen(str) lstrlen16 91 register InitTask() InitTask 92 pascal GetTempDrive(byte) WIN16_GetTempDrive @@ -268,7 +268,7 @@ type win16 349 pascal _hread(word segptr long) WIN16_hread 350 pascal _hwrite(word ptr long) _hwrite16 #351 BUNNY_351 -352 pascal lstrcatn(segptr str word) lstrcatn16 +352 pascal lstrcatn(segstr str word) lstrcatn16 353 pascal lstrcpyn(segptr str word) lstrcpyn16 354 pascal GetAppCompatFlags(word) GetAppCompatFlags16 355 pascal16 GetWinDebugInfo(ptr word) GetWinDebugInfo diff --git a/if1632/kernel32.spec b/if1632/kernel32.spec index a08067005ef..f824dc1a0ab 100644 --- a/if1632/kernel32.spec +++ b/if1632/kernel32.spec @@ -325,7 +325,7 @@ base 1 338 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize 339 stdcall GetLastError() GetLastError 340 stdcall GetLocalTime(ptr) GetLocalTime -341 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfoA +341 stdcall GetLocaleInfoA(long long ptr long) GetLocaleInfo32A 342 stdcall GetLocaleInfoW(long long ptr long) GetLocaleInfo32W 343 stdcall GetLogicalDriveStringsA(long ptr) GetLogicalDriveStrings32A 344 stdcall GetLogicalDriveStringsW(long ptr) GetLogicalDriveStrings32W @@ -513,8 +513,8 @@ base 1 526 stub Module32First 527 stub Module32Next 528 stdcall MoveFileA(ptr ptr) MoveFile32A -529 stub MoveFileExA -530 stub MoveFileExW +529 stdcall MoveFileExA(ptr ptr long) MoveFileEx32A +530 stdcall MoveFileExW(ptr ptr long) MoveFileEx32W 531 stdcall MoveFileW(ptr ptr) MoveFile32W 532 stdcall MulDiv(long long long) MulDiv32 533 stdcall MultiByteToWideChar(long long ptr long ptr long) MultiByteToWideChar diff --git a/if1632/keyboard.spec b/if1632/keyboard.spec index 5d0cb91d70e..b4b2c561094 100644 --- a/if1632/keyboard.spec +++ b/if1632/keyboard.spec @@ -5,8 +5,8 @@ type win16 #2 pascal Enable #3 pascal Disable 4 pascal16 ToAscii(word word ptr ptr word) ToAscii16 -5 pascal16 AnsiToOem(ptr ptr) AnsiToOem16 -6 pascal16 OemToAnsi(ptr ptr) OemToAnsi16 +5 pascal16 AnsiToOem(str ptr) AnsiToOem16 +6 pascal16 OemToAnsi(str ptr) OemToAnsi16 7 return SetSpeed 2 65535 #100 pascal ScreenSwitchEnable #126 pascal GetTableSeg diff --git a/if1632/mmsystem.spec b/if1632/mmsystem.spec index c0f75d171b7..910f246a4e3 100644 --- a/if1632/mmsystem.spec +++ b/if1632/mmsystem.spec @@ -95,7 +95,7 @@ type win16 606 pascal timeEndPeriod(word) timeEndPeriod 607 pascal timeGetTime() timeGetTime 701 pascal MCISENDCOMMAND(word word long long) mciSendCommand -702 pascal MCISENDSTRING(ptr ptr word word) mciSendString +702 pascal MCISENDSTRING(str ptr word word) mciSendString 703 pascal MCIGETDEVICEID(ptr) mciGetDeviceID 706 pascal MCIGETERRORSTRING(long ptr word) mciGetErrorString #900 pascal MMTASKCREATE @@ -103,7 +103,7 @@ type win16 #903 pascal MMTASKSIGNAL #904 pascal MMGETCURRENTTASK #905 pascal MMTASKYIELD -1100 pascal DRVOPEN(ptr ptr long) DrvOpen +1100 pascal DRVOPEN(str str long) DrvOpen 1101 pascal DRVCLOSE(word long long) DrvClose 1102 pascal DRVSENDMESSAGE(word word long long) DrvSendMessage 1103 pascal DRVGETMODULEHANDLE(word) DrvGetModuleHandle diff --git a/if1632/ole2nls.spec b/if1632/ole2nls.spec index 1fb5bc3f1e2..ca0febc8529 100644 --- a/if1632/ole2nls.spec +++ b/if1632/ole2nls.spec @@ -5,7 +5,7 @@ type win16 2 pascal GetSystemDefaultLCID() GetSystemDefaultLCID 3 pascal GetUserDefaultLangID() GetUserDefaultLangID 4 pascal GetSystemDefaultLangID() GetSystemDefaultLangID -5 pascal GetLocaleInfoA(long long ptr word) GetLocaleInfoA +5 pascal GetLocaleInfoA(long long ptr word) GetLocaleInfo16 6 stub LCMAPSTRINGA 7 pascal16 GetStringTypeA(long long ptr word ptr) GetStringType16 8 pascal16 CompareStringA(long long ptr word ptr word) CompareString16 diff --git a/if1632/relay.c b/if1632/relay.c index 642f0e7b910..06bf0369e5d 100644 --- a/if1632/relay.c +++ b/if1632/relay.c @@ -4,6 +4,7 @@ */ #include +#include #include "windows.h" #include "winnt.h" #include "global.h" @@ -83,6 +84,7 @@ void RELAY_DebugCallFrom16( int func_type, char *args, case 'l': case 'p': case 't': + case 'T': args16 += 4; break; } @@ -103,16 +105,20 @@ void RELAY_DebugCallFrom16( int func_type, char *args, break; case 't': args16 -= 4; + printf( "0x%08x", *(int *)args16 ); if (HIWORD(*(int *)args16)) - printf( "0x%08x \"%s\"", *(int *)args16, - (char *)PTR_SEG_TO_LIN(*(int *)args16) ); - else - printf( "0x%08x", *(int *)args16 ); + printf( " \"%s\"", (char *)PTR_SEG_TO_LIN(*(int *)args16) ); break; case 'p': args16 -= 4; printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 ); break; + case 'T': + args16 -= 4; + printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 ); + if (HIWORD(*(int *)args16)) + printf( " \"%s\"", (char *)PTR_SEG_TO_LIN(*(int *)args16) ); + break; } args++; if (*args) printf( "," ); @@ -341,11 +347,11 @@ INT16 Catch( LPCATCHBUF lpbuf ) */ /* FIXME: we need to save %si and %di */ - lpbuf[0] = IF1632_Saved16_sp; + lpbuf[0] = OFFSETOF(IF1632_Saved16_ss_sp); lpbuf[1] = LOWORD(IF1632_Saved32_esp); lpbuf[2] = HIWORD(IF1632_Saved32_esp); - lpbuf[3] = pFrame->saved_ss; - lpbuf[4] = pFrame->saved_sp; + lpbuf[3] = LOWORD(pFrame->saved_ss_sp); + lpbuf[4] = HIWORD(pFrame->saved_ss_sp); lpbuf[5] = pFrame->ds; lpbuf[6] = pFrame->bp; lpbuf[7] = pFrame->ip; @@ -362,16 +368,16 @@ INT16 Throw( LPCATCHBUF lpbuf, INT16 retval ) STACK16FRAME *pFrame; WORD es = CURRENT_STACK16->es; - IF1632_Saved16_sp = lpbuf[0] - sizeof(WORD); + IF1632_Saved16_ss_sp = MAKELONG( lpbuf[0] - sizeof(WORD), + HIWORD(IF1632_Saved16_ss_sp) ); IF1632_Saved32_esp = MAKELONG( lpbuf[1], lpbuf[2] ); pFrame = CURRENT_STACK16; - pFrame->saved_ss = lpbuf[3]; - pFrame->saved_sp = lpbuf[4]; - pFrame->ds = lpbuf[5]; - pFrame->bp = lpbuf[6]; - pFrame->ip = lpbuf[7]; - pFrame->cs = lpbuf[8]; - pFrame->es = es; + pFrame->saved_ss_sp = MAKELONG( lpbuf[3], lpbuf[4] ); + pFrame->ds = lpbuf[5]; + pFrame->bp = lpbuf[6]; + pFrame->ip = lpbuf[7]; + pFrame->cs = lpbuf[8]; + pFrame->es = es; if (debugging_relay) /* Make sure we have a valid entry point address */ { static FARPROC16 entryPoint = NULL; @@ -402,10 +408,10 @@ WIN16_CallProc32W() { args = (DWORD*)xmalloc(sizeof(DWORD)*nrofargs); for (i=nrofargs;i--;) { if (argconvmask & (1<y, cs->x ), MAKELONG( cs->cy, cs->cx ), MAKELONG( cs->hMenu, cs->hwndParent ), cs->hInstance, (LONG)cs->lpCreateParams, hwnd, msg, wParam, - MAKELONG( IF1632_Saved16_sp-sizeof(CREATESTRUCT16), - IF1632_Saved16_ss ) ); + IF1632_Saved16_ss_sp - sizeof(CREATESTRUCT16) ); } return CallTo16_long_wwwl( (FARPROC16)proc, hwnd, msg, wParam, lParam ); } diff --git a/if1632/user.spec b/if1632/user.spec index 2977f4a052f..aef0e5b4198 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -36,7 +36,7 @@ heap 65520 34 pascal16 EnableWindow(word word) EnableWindow16 35 pascal16 IsWindowEnabled(word) IsWindowEnabled16 36 pascal16 GetWindowText(word segptr word) GetWindowText16 -37 pascal16 SetWindowText(word segptr) SetWindowText16 +37 pascal16 SetWindowText(word segstr) SetWindowText16 38 pascal16 GetWindowTextLength(word) GetWindowTextLength16 39 pascal16 BeginPaint(word ptr) BeginPaint16 40 pascal16 EndPaint(word ptr) EndPaint16 @@ -50,7 +50,7 @@ heap 65520 47 pascal16 IsWindow(word) IsWindow16 48 pascal16 IsChild(word word) IsChild16 49 pascal16 IsWindowVisible(word) IsWindowVisible16 -50 pascal16 FindWindow(segptr str) FindWindow16 +50 pascal16 FindWindow(segstr str) FindWindow16 #51 BEAR51 52 pascal16 AnyPopup() AnyPopup16 53 pascal16 DestroyWindow(word) DestroyWindow16 @@ -86,12 +86,12 @@ heap 65520 83 pascal16 FrameRect(word ptr word) FrameRect16 84 pascal16 DrawIcon(word s_word s_word word) DrawIcon16 85 pascal16 DrawText(word ptr s_word ptr word) DrawText16 -87 pascal16 DialogBox(word segptr word segptr) DialogBox16 +87 pascal16 DialogBox(word segstr word segptr) DialogBox16 88 pascal16 EndDialog(word s_word) EndDialog16 -89 pascal16 CreateDialog(word segptr word segptr) CreateDialog16 +89 pascal16 CreateDialog(word segstr word segptr) CreateDialog16 90 pascal16 IsDialogMessage(word ptr) IsDialogMessage16 91 pascal16 GetDlgItem(word word) GetDlgItem16 -92 pascal16 SetDlgItemText(word word segptr) SetDlgItemText16 +92 pascal16 SetDlgItemText(word word segstr) SetDlgItemText16 93 pascal16 GetDlgItemText(word word segptr word) GetDlgItemText16 94 pascal16 SetDlgItemInt(word word word word) SetDlgItemInt16 95 pascal16 GetDlgItemInt(word s_word ptr word) GetDlgItemInt16 @@ -116,7 +116,7 @@ heap 65520 114 pascal DispatchMessage(ptr) DispatchMessage16 115 pascal16 ReplyMessage(long) ReplyMessage16 116 pascal16 PostAppMessage(word word word long) PostAppMessage16 -118 pascal16 RegisterWindowMessage(segptr) RegisterWindowMessage16 +118 pascal16 RegisterWindowMessage(segstr) RegisterWindowMessage16 117 pascal16 WindowFromDC(word) WindowFromDC16 119 pascal GetMessagePos() GetMessagePos 120 pascal GetMessageTime() GetMessageTime @@ -149,10 +149,10 @@ heap 65520 147 pascal16 SetClipboardViewer(word) SetClipboardViewer16 148 pascal16 GetClipboardViewer() GetClipboardViewer16 149 pascal16 ChangeClipboardChain(word ptr) ChangeClipboardChain16 -150 pascal16 LoadMenu(word segptr) LoadMenu16 +150 pascal16 LoadMenu(word segstr) LoadMenu16 151 pascal16 CreateMenu() CreateMenu16 152 pascal16 DestroyMenu(word) DestroyMenu16 -153 pascal16 ChangeMenu(word word segptr word word) ChangeMenu16 +153 pascal16 ChangeMenu(word word segstr word word) ChangeMenu16 154 pascal16 CheckMenuItem(word word word) CheckMenuItem16 155 pascal16 EnableMenuItem(word word word) EnableMenuItem16 156 pascal16 GetSystemMenu(word word) GetSystemMenu16 @@ -172,11 +172,11 @@ heap 65520 170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows16 171 pascal16 WinHelp(word str word long) WinHelp16 172 pascal16 SwitchToThisWindow(word word) SwitchToThisWindow16 -173 pascal16 LoadCursor(word segptr) LoadCursor16 -174 pascal16 LoadIcon(word segptr) LoadIcon16 -175 pascal16 LoadBitmap(word segptr) LoadBitmap16 +173 pascal16 LoadCursor(word segstr) LoadCursor16 +174 pascal16 LoadIcon(word segstr) LoadIcon16 +175 pascal16 LoadBitmap(word segstr) LoadBitmap16 176 pascal16 LoadString(word word ptr s_word) LoadString16 -177 pascal16 LoadAccelerators(word segptr) LoadAccelerators16 +177 pascal16 LoadAccelerators(word segstr) LoadAccelerators16 178 pascal16 TranslateAccelerator(word word ptr) TranslateAccelerator16 179 pascal16 GetSystemMetrics(s_word) GetSystemMetrics16 180 pascal GetSysColor(word) GetSysColor16 @@ -239,16 +239,16 @@ heap 65520 236 pascal16 GetCapture() GetCapture16 237 pascal16 GetUpdateRgn(word word word) GetUpdateRgn16 238 pascal16 ExcludeUpdateRgn(word word) ExcludeUpdateRgn16 -239 pascal16 DialogBoxParam(word segptr word segptr long) DialogBoxParam16 +239 pascal16 DialogBoxParam(word segstr word segptr long) DialogBoxParam16 240 pascal16 DialogBoxIndirectParam(word word word segptr long) DialogBoxIndirectParam16 -241 pascal16 CreateDialogParam(word segptr word segptr long) CreateDialogParam16 +241 pascal16 CreateDialogParam(word segstr word segptr long) CreateDialogParam16 242 pascal16 CreateDialogIndirectParam(word ptr word segptr long) CreateDialogIndirectParam16 243 pascal GetDialogBaseUnits() GetDialogBaseUnits 244 pascal16 EqualRect(ptr ptr) EqualRect16 245 stub EnableCommNotification -246 stub ExitWindowsExec +246 pascal16 ExitWindowsExec(str str) ExitWindowsExec16 247 pascal16 GetCursor() GetCursor16 248 pascal16 GetOpenClipboardWindow() GetOpenClipboardWindow16 249 pascal16 GetAsyncKeyState(word) GetAsyncKeyState16 @@ -271,9 +271,9 @@ heap 65520 265 pascal16 ShowOwnedPopups(word word) ShowOwnedPopups16 266 pascal16 SetMessageQueue(word) SetMessageQueue16 267 pascal16 ShowScrollBar(word word word) ShowScrollBar16 -268 pascal16 GlobalAddAtom(segptr) GlobalAddAtom16 +268 pascal16 GlobalAddAtom(segstr) GlobalAddAtom16 269 pascal16 GlobalDeleteAtom(word) GlobalDeleteAtom -270 pascal16 GlobalFindAtom(segptr) GlobalFindAtom16 +270 pascal16 GlobalFindAtom(segstr) GlobalFindAtom16 271 pascal16 GlobalGetAtomName(word ptr s_word) GlobalGetAtomName16 272 pascal16 IsZoomed(word) IsZoomed16 273 stub ControlPanelInfo @@ -350,12 +350,12 @@ heap 65520 394 stub DrawIconEx 395 stub GetIconInfo 397 pascal16 RegisterClassEx(ptr) RegisterClassEx16 -398 pascal16 GetClassInfoEx(word segptr ptr) GetClassInfoEx16 +398 pascal16 GetClassInfoEx(word segstr ptr) GetClassInfoEx16 399 stub ChildWindowFromPointEx 400 stub FinalUserInit 402 pascal16 GetPriorityClipboardFormat(word ptr s_word) GetPriorityClipboardFormat16 -403 pascal16 UnregisterClass(segptr word) UnregisterClass16 -404 pascal16 GetClassInfo(word segptr ptr) GetClassInfo16 +403 pascal16 UnregisterClass(segstr word) UnregisterClass16 +404 pascal16 GetClassInfo(word segstr ptr) GetClassInfo16 406 pascal16 CreateCursor(word word word word word ptr ptr) CreateCursor16 407 pascal16 CreateIcon(word word word word word ptr ptr) CreateIcon16 408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr) @@ -374,18 +374,18 @@ heap 65520 421 pascal16 wvsprintf(ptr ptr ptr) wvsprintf16 422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16 423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16 -427 pascal16 FindWindowEx(word word segptr ptr) FindWindowEx16 +427 pascal16 FindWindowEx(word word segstr str) FindWindowEx16 428 stub TileWindows 429 stub CascadeWindows 430 pascal16 lstrcmp(str str) lstrcmp16 -431 pascal AnsiUpper(segptr) AnsiUpper16 -432 pascal AnsiLower(segptr) AnsiLower16 +431 pascal AnsiUpper(segstr) AnsiUpper16 +432 pascal AnsiLower(segstr) AnsiLower16 433 pascal16 IsCharAlpha(byte) IsCharAlpha16 434 pascal16 IsCharAlphanumeric(byte) IsCharAlphanumeric16 435 pascal16 IsCharUpper(byte) IsCharUpper16 436 pascal16 IsCharLower(byte) IsCharLower16 -437 pascal16 AnsiUpperBuff(str word) AnsiUpperBuff16 -438 pascal16 AnsiLowerBuff(str word) AnsiLowerBuff16 +437 pascal16 AnsiUpperBuff(ptr word) AnsiUpperBuff16 +438 pascal16 AnsiLowerBuff(ptr word) AnsiLowerBuff16 441 stub InsertMenuItem 443 stub GetMenuItemInfo 445 pascal DefFrameProc(word word word word long) DefFrameProc16 diff --git a/if1632/user32.spec b/if1632/user32.spec index 0256cb05b50..99bcd8ee492 100644 --- a/if1632/user32.spec +++ b/if1632/user32.spec @@ -103,7 +103,7 @@ base 1 0096 return DdeDisconnect 4 0 0097 stub DdeDisconnectList 0098 stub DdeEnableCallback -0099 stub DdeFreeDataHandle +0099 return DdeFreeDataHandle 4 1 0100 return DdeFreeStringHandle 8 0 0101 stub DdeGetData 0102 return DdeGetLastError 4 0 diff --git a/if1632/wprocs.spec b/if1632/wprocs.spec index bc676ac1ea6..2172fe724db 100644 --- a/if1632/wprocs.spec +++ b/if1632/wprocs.spec @@ -2,8 +2,6 @@ name wprocs 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 10 pascal MDIClientWndProc(word word word long) MDIClientWndProc 14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc 15 pascal FileSaveDlgProc(word word word long) FileSaveDlgProc diff --git a/if1632/wsock32.spec b/if1632/wsock32.spec index 798e01c787b..36893c26961 100644 --- a/if1632/wsock32.spec +++ b/if1632/wsock32.spec @@ -2,12 +2,12 @@ name wsock32 type win32 base 0 -001 stub accept -002 stub bind -003 stub closesocket -004 stub connect +001 stdcall accept(long ptr ptr) WINSOCK_accept +002 stdcall bind(long ptr long) WINSOCK_bind +003 stdcall closesocket(long) WINSOCK_closesocket +004 stdcall connect(long ptr long) WINSOCK_connect 005 stub getpeername -006 stub getsockname +006 stdcall getsockname(long ptr ptr) WINSOCK_getsockname 007 stub getsockopt 008 stdcall htonl(long) WINSOCK_htonl 009 stdcall htons(long) WINSOCK_htons @@ -25,7 +25,7 @@ base 0 021 stub setsockopt 022 stub shutdown 023 stdcall socket(long long long) WINSOCK_socket -051 stdcall gethostbyaddr(ptr long long) gethostbyaddr +051 stdcall gethostbyaddr(ptr long long) WINSOCK_gethostbyaddr 052 stdcall gethostbyname(ptr) gethostbyname 053 stub getprotobyname 054 stub getprotobynumber diff --git a/include/bitmap.h b/include/bitmap.h index 3b8bfe2097e..b6c6545ab23 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -60,6 +60,7 @@ extern int DIB_GetXImageWidthBytes( int width, int depth ); extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse ); /* objects/oembitmap.c */ +extern BOOL32 OBM_Init(void); extern HBITMAP16 OBM_LoadBitmap( WORD id ); extern HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor ); diff --git a/include/dce.h b/include/dce.h index 368174c6931..4fd109af554 100644 --- a/include/dce.h +++ b/include/dce.h @@ -49,5 +49,7 @@ extern void DCE_Init(void); extern DCE* DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type ); extern void DCE_FreeDCE( DCE *dce ); extern INT16 DCE_ExcludeRgn( HDC32, WND*, HRGN32 ); +extern HRGN32 DCE_GetVisRgn( HWND32, WORD ); +extern BOOL32 DCE_InvalidateDCE( WND*, RECT32* ); #endif /* __WINE_DCE_H */ diff --git a/include/debug.h b/include/debug.h index 55a01eab6f9..3308a57d455 100644 --- a/include/debug.h +++ b/include/debug.h @@ -79,6 +79,7 @@ #undef DEBUG_TEXT #undef DEBUG_TIMER #undef DEBUG_TOOLHELP +#undef DEBUG_TWEAK #undef DEBUG_VER #undef DEBUG_VIRTUAL #undef DEBUG_VXD @@ -162,6 +163,7 @@ #define DEBUG_TEXT #define DEBUG_TIMER #define DEBUG_TOOLHELP +#define DEBUG_TWEAK #define DEBUG_VER #define DEBUG_VIRTUAL #define DEBUG_VXD @@ -539,6 +541,11 @@ short debug_msg_enabled[]={ #else 0, #endif +#ifdef DEBUG_TWEAK + 1, +#else + 0, +#endif #ifdef DEBUG_VER 1, #else @@ -1531,8 +1538,21 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_ver if(!debug_msg_enabled[73]) ; else fprintf -#define debugging_ver debug_msg_enabled[73] +#define dprintf_tweak if(!debug_msg_enabled[73]) ; else fprintf +#define debugging_tweak debug_msg_enabled[73] +#else +#ifdef DEBUG_TWEAK +#define dprintf_tweak fprintf +#define debugging_tweak 1 +#else +#define dprintf_tweak while(0) fprintf +#define debugging_tweak 0 +#endif +#endif + +#ifdef DEBUG_RUNTIME +#define dprintf_ver if(!debug_msg_enabled[74]) ; else fprintf +#define debugging_ver debug_msg_enabled[74] #else #ifdef DEBUG_VER #define dprintf_ver fprintf @@ -1544,8 +1564,8 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_virtual if(!debug_msg_enabled[74]) ; else fprintf -#define debugging_virtual debug_msg_enabled[74] +#define dprintf_virtual if(!debug_msg_enabled[75]) ; else fprintf +#define debugging_virtual debug_msg_enabled[75] #else #ifdef DEBUG_VIRTUAL #define dprintf_virtual fprintf @@ -1557,8 +1577,8 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_vxd if(!debug_msg_enabled[75]) ; else fprintf -#define debugging_vxd debug_msg_enabled[75] +#define dprintf_vxd if(!debug_msg_enabled[76]) ; else fprintf +#define debugging_vxd debug_msg_enabled[76] #else #ifdef DEBUG_VXD #define dprintf_vxd fprintf @@ -1570,8 +1590,8 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_win if(!debug_msg_enabled[76]) ; else fprintf -#define debugging_win debug_msg_enabled[76] +#define dprintf_win if(!debug_msg_enabled[77]) ; else fprintf +#define debugging_win debug_msg_enabled[77] #else #ifdef DEBUG_WIN #define dprintf_win fprintf @@ -1583,8 +1603,8 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_win16drv if(!debug_msg_enabled[77]) ; else fprintf -#define debugging_win16drv debug_msg_enabled[77] +#define dprintf_win16drv if(!debug_msg_enabled[78]) ; else fprintf +#define debugging_win16drv debug_msg_enabled[78] #else #ifdef DEBUG_WIN16DRV #define dprintf_win16drv fprintf @@ -1596,8 +1616,8 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_win32 if(!debug_msg_enabled[78]) ; else fprintf -#define debugging_win32 debug_msg_enabled[78] +#define dprintf_win32 if(!debug_msg_enabled[79]) ; else fprintf +#define debugging_win32 debug_msg_enabled[79] #else #ifdef DEBUG_WIN32 #define dprintf_win32 fprintf @@ -1609,8 +1629,8 @@ extern short debug_msg_enabled[]; #endif #ifdef DEBUG_RUNTIME -#define dprintf_winsock if(!debug_msg_enabled[79]) ; else fprintf -#define debugging_winsock debug_msg_enabled[79] +#define dprintf_winsock if(!debug_msg_enabled[80]) ; else fprintf +#define debugging_winsock debug_msg_enabled[80] #else #ifdef DEBUG_WINSOCK #define dprintf_winsock fprintf @@ -1698,6 +1718,7 @@ static char *debug_msg_name[] = { "text", "timer", "toolhelp", + "tweak", "ver", "virtual", "vxd", diff --git a/include/graphics.h b/include/graphics.h index 00d963a156b..72c1da2a679 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -13,6 +13,10 @@ extern void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, INT32 shadow_size, BOOL32 pressed ); +extern void GRAPH_DrawGenericReliefRect( HDC32 hdc, const RECT32 *rect, + INT32 highlight_size, + INT32 shadow_size, HBRUSH32 highlight, + HBRUSH32 shadow ); 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); diff --git a/include/instance.h b/include/instance.h index 95dde0e5e7b..8eda721f3b3 100644 --- a/include/instance.h +++ b/include/instance.h @@ -14,8 +14,7 @@ typedef struct { WORD null; /* Always 0 */ - WORD old_sp; /* Stack pointer; used by SwitchTaskTo() */ - WORD old_ss; /* Stack segment; used by SwitchTaskTo() */ + DWORD old_ss_sp WINE_PACKED; /* Stack pointer; used by SwitchTaskTo() */ WORD heap; /* Pointer to the local heap information (if any) */ WORD atomtable; /* Pointer to the local atom table (if any) */ WORD stacktop; /* Top of the stack */ diff --git a/include/nonclient.h b/include/nonclient.h index 63fe119e314..8b5b60027fd 100644 --- a/include/nonclient.h +++ b/include/nonclient.h @@ -11,7 +11,7 @@ extern LONG NC_HandleNCPaint( HWND32 hwnd , HRGN32 clip); extern LONG NC_HandleNCActivate( WND *pwnd, WPARAM16 wParam ); -extern LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect ); +extern LONG NC_HandleNCCalcSize( WND *pWnd, RECT32 *winRect ); extern LONG NC_HandleNCHitTest( HWND32 hwnd, POINT16 pt ); extern LONG NC_HandleNCLButtonDown( HWND32 hwnd, WPARAM16 wParam, LPARAM lParam ); @@ -19,6 +19,7 @@ extern LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM16 wParam, LPARAM lParam) extern LONG NC_HandleSysCommand( HWND32 hwnd, WPARAM16 wParam, POINT16 pt ); extern LONG NC_HandleSetCursor( HWND32 hwnd, WPARAM16 wParam, LPARAM lParam ); extern void NC_DrawSysButton( HWND32 hwnd, HDC32 hdc, BOOL32 down ); +extern void NC_DrawSysButton95( HWND32 hwnd, HDC32 hdc, BOOL32 down ); extern BOOL32 NC_GetSysPopupPos( WND* wndPtr, RECT32* rect ); #endif /* __WINE_NONCLIENT_H */ diff --git a/include/options.h b/include/options.h index 21f9d7a82db..542613ce63c 100644 --- a/include/options.h +++ b/include/options.h @@ -72,6 +72,12 @@ extern int PROFILE_GetWineIniString( const char *section, const char *key_name, const char *def, char *buffer, int len ); extern int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def ); +extern int PROFILE_EnumerateWineIniSection( + char const *section, + void (*callback)(char const *key, char const *name, void *user), + void *userptr ); +extern int PROFILE_GetWineIniBool( char const *section, char const *key_name, + int def ); extern char* PROFILE_GetStringItem( char* ); #endif /* __WINE_OPTIONS_H */ diff --git a/include/queue.h b/include/queue.h index de88be1794f..14354ecd5cf 100644 --- a/include/queue.h +++ b/include/queue.h @@ -37,7 +37,7 @@ typedef struct tagMESSAGEQUEUE DWORD GetMessagePosVal WINE_PACKED; /* 12 Value for GetMessagePos */ HQUEUE16 self; /* 16 Handle to self (was: reserved) */ DWORD GetMessageExtraInfoVal; /* 18 Value for GetMessageExtraInfo */ - WORD reserved2; /* 1c Unknown */ + WORD wParamHigh; /* 1c High word of wParam (was: reserved)*/ LPARAM lParam WINE_PACKED; /* 1e Next 4 values set by SendMessage */ WPARAM16 wParam; /* 22 */ UINT16 msg; /* 24 */ @@ -72,6 +72,8 @@ typedef struct tagMESSAGEQUEUE /* Queue flags */ #define QUEUE_FLAG_XEVENT 0x0001 +#define QUEUE_SM_WIN32 0x0002 /* Currently sent message is Win32 */ +#define QUEUE_SM_UNICODE 0x0004 /* Currently sent message is Unicode */ extern void QUEUE_DumpQueue( HQUEUE16 hQueue ); extern void QUEUE_WalkQueues(void); diff --git a/include/selectors.h b/include/selectors.h index cbb00ee04f8..7fcde5ec98c 100644 --- a/include/selectors.h +++ b/include/selectors.h @@ -21,7 +21,7 @@ extern void SELECTOR_FreeBlock( WORD sel, WORD count ); #if defined(linux) # define WINE_DATA_SELECTOR 0x2b # define WINE_CODE_SELECTOR 0x23 -#elif defined(__NetBSD__) +#elif defined(__NetBSD__) || defined(__OpenBSD__) # define WINE_DATA_SELECTOR 0x1f # define WINE_CODE_SELECTOR 0x17 #elif defined(__FreeBSD__) diff --git a/include/sigcontext.h b/include/sigcontext.h index 2b4c33efdab..d47b836ec33 100644 --- a/include/sigcontext.h +++ b/include/sigcontext.h @@ -91,7 +91,8 @@ typedef struct _CONTEXT /* Note 1 */ #endif /* __EMX__ */ -#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(linux) || defined(__NetBSD__) || defined(__FreeBSD__) \ + || defined(__OpenBSD__) #define EAX_sig(context) ((context)->sc_eax) #define EBX_sig(context) ((context)->sc_ebx) @@ -121,7 +122,7 @@ typedef struct _CONTEXT /* Note 1 */ #define EIP_sig(context) (*((unsigned long*)&(context)->sc_eip)) #define ESP_sig(context) (*((unsigned long*)&(context)->sc_esp)) -#endif /* linux || __NetBSD__ || __FreeBSD__ */ +#endif /* linux || __NetBSD__ || __FreeBSD__ || __OpenBSD__ */ #if defined(__svr4__) || defined(_SCO_DS) diff --git a/include/stackframe.h b/include/stackframe.h index 736e104b0f8..1e3711e33d3 100644 --- a/include/stackframe.h +++ b/include/stackframe.h @@ -15,8 +15,8 @@ /* 16-bit stack layout after CallFrom16() */ typedef struct { - WORD saved_ss; /* saved previous 16-bit stack */ - WORD saved_sp; + DWORD saved_ss_sp; /* saved previous 16-bit stack */ + DWORD ebp; /* full 32-bit content of ebp */ WORD entry_ip; /* ip of entry point */ WORD ds; /* ds */ WORD entry_cs; /* cs of entry point */ @@ -46,8 +46,7 @@ typedef struct #pragma pack(4) /* Saved 16-bit stack for current process (Win16 only) */ -extern WORD IF1632_Saved16_ss; -extern WORD IF1632_Saved16_sp; +extern DWORD IF1632_Saved16_ss_sp; /* Saved 32-bit stack for current process (Win16 only) */ extern DWORD IF1632_Saved32_esp; @@ -55,8 +54,7 @@ extern DWORD IF1632_Saved32_esp; /* Original Unix stack */ extern DWORD IF1632_Original32_esp; -#define CURRENT_STACK16 \ - ((STACK16FRAME *)PTR_SEG_OFF_TO_LIN(IF1632_Saved16_ss,IF1632_Saved16_sp)) +#define CURRENT_STACK16 ((STACK16FRAME *)PTR_SEG_TO_LIN(IF1632_Saved16_ss_sp)) #define CURRENT_DS (CURRENT_STACK16->ds) diff --git a/include/static.h b/include/static.h index 45a8fff02ff..355359a90ed 100644 --- a/include/static.h +++ b/include/static.h @@ -17,7 +17,7 @@ typedef struct HICON16 hIcon; /* Icon handle for SS_ICON controls */ } STATICINFO; -extern LRESULT StaticWndProc( HWND16 hWnd, UINT16 uMsg, WPARAM16 wParam, +extern LRESULT StaticWndProc( HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam ); #endif /* __WINE_STATIC_H */ diff --git a/include/stddebug.h b/include/stddebug.h index e05112d17f2..71b01510cd0 100644 --- a/include/stddebug.h +++ b/include/stddebug.h @@ -149,6 +149,7 @@ #undef DEBUG_TEXT #undef DEBUG_TIMER #undef DEBUG_TOOLHELP +#undef DEBUG_TWEAK #undef DEBUG_VER #undef DEBUG_VIRTUAL #undef DEBUG_VXD @@ -232,6 +233,7 @@ #define DEBUG_TEXT #define DEBUG_TIMER #define DEBUG_TOOLHELP +#define DEBUG_TWEAK #define DEBUG_VER #define DEBUG_VIRTUAL #define DEBUG_VXD diff --git a/include/sysmetrics.h b/include/sysmetrics.h index 371d05fbcc8..b2f7e356091 100644 --- a/include/sysmetrics.h +++ b/include/sysmetrics.h @@ -11,16 +11,7 @@ /* Constant system metrics */ -#ifdef WIN_95_LOOK -#define SYSMETRICS_CXVSCROLL 14 -#define SYSMETRICS_CYHSCROLL 14 -#else -#define SYSMETRICS_CXVSCROLL 16 -#define SYSMETRICS_CYHSCROLL 16 -#endif -#define SYSMETRICS_CYCAPTION 20 -#define SYSMETRICS_CXBORDER 1 -#define SYSMETRICS_CYBORDER 1 +#if 0 #ifdef WIN_95_LOOK #define SYSMETRICS_CXDLGFRAME 2 #define SYSMETRICS_CYDLGFRAME 2 @@ -36,7 +27,6 @@ #define SYSMETRICS_CYICON 32 #define SYSMETRICS_CXCURSOR 32 #define SYSMETRICS_CYCURSOR 32 -#define SYSMETRICS_CYMENU 18 #ifdef WIN_95_LOOK #define SYSMETRICS_CYVSCROLL 14 #define SYSMETRICS_CXHSCROLL 14 @@ -48,8 +38,6 @@ #define SYSMETRICS_CXMIN 100 #define SYSMETRICS_CYMIN 28 #endif -#define SYSMETRICS_CXSIZE 18 -#define SYSMETRICS_CYSIZE 18 #ifdef WIN_95_LOOK #define SYSMETRICS_CXMINTRACK 112 #define SYSMETRICS_CYMINTRACK 27 @@ -57,20 +45,89 @@ #define SYSMETRICS_CXMINTRACK 100 #define SYSMETRICS_CYMINTRACK 28 #endif +#endif 0 - /* Some non-constant system metrics */ -#define SYSMETRICS_CXSCREEN sysMetrics[SM_CXSCREEN] -#define SYSMETRICS_CYSCREEN sysMetrics[SM_CYSCREEN] -#define SYSMETRICS_CXFULLSCREEN sysMetrics[SM_CXFULLSCREEN] -#define SYSMETRICS_CYFULLSCREEN sysMetrics[SM_CYFULLSCREEN] -#define SYSMETRICS_SWAPBUTTON sysMetrics[SM_SWAPBUTTON] -#define SYSMETRICS_CXFRAME sysMetrics[SM_CXFRAME] -#define SYSMETRICS_CYFRAME sysMetrics[SM_CYFRAME] -#define SYSMETRICS_CXDOUBLECLK sysMetrics[SM_CXDOUBLECLK] -#define SYSMETRICS_CYDOUBLECLK sysMetrics[SM_CYDOUBLECLK] -#define SYSMETRICS_MENUDROPALIGNMENT sysMetrics[SM_MENUDROPALIGNMENT] -#define SYSMETRICS_CXICONSPACING sysMetrics[SM_CXICONSPACING] -#define SYSMETRICS_CYICONSPACING sysMetrics[SM_CYICONSPACING] +/* Some non-constant system metrics */ +#define SYSMETRICS_CXSCREEN sysMetrics[SM_CXSCREEN] /* 0 */ +#define SYSMETRICS_CYSCREEN sysMetrics[SM_CYSCREEN] /* 1 */ +#define SYSMETRICS_CXVSCROLL sysMetrics[SM_CXVSCROLL] /* 2 */ +#define SYSMETRICS_CYHSCROLL sysMetrics[SM_CYHSCROLL] /* 3 */ +#define SYSMETRICS_CYCAPTION sysMetrics[SM_CYCAPTION] /* 4 */ +#define SYSMETRICS_CXBORDER sysMetrics[SM_CXBORDER] /* 5 */ +#define SYSMETRICS_CYBORDER sysMetrics[SM_CYBORDER] /* 6 */ +#define SYSMETRICS_CXDLGFRAME sysMetrics[SM_CXDLGFRAME] /* 7 */ +#define SYSMETRICS_CYDLGFRAME sysMetrics[SM_CYDLGFRAME] /* 8 */ +#define SYSMETRICS_CYVTHUMB sysMetrics[SM_CYVTHUMB] /* 9 */ +#define SYSMETRICS_CXHTHUMB sysMetrics[SM_CXHTHUMB] /* 10 */ +#define SYSMETRICS_CXICON sysMetrics[SM_CXICON] /* 11 */ +#define SYSMETRICS_CYICON sysMetrics[SM_CYICON] /* 12 */ +#define SYSMETRICS_CXCURSOR sysMetrics[SM_CXCURSOR] /* 13 */ +#define SYSMETRICS_CYCURSOR sysMetrics[SM_CYCURSOR] /* 14 */ +#define SYSMETRICS_CYMENU sysMetrics[SM_CYMENU] /* 15 */ +#define SYSMETRICS_CXFULLSCREEN sysMetrics[SM_CXFULLSCREEN] /* 16 */ +#define SYSMETRICS_CYFULLSCREEN sysMetrics[SM_CYFULLSCREEN] /* 17 */ +#define SYSMETRICS_CYKANJIWINDOW sysMetrics[SM_CYKANJIWINDOW] /* 18 */ +#define SYSMETRICS_MOUSEPRESENT sysMetrics[SM_MOUSEPRESENT] /* 19 */ +#define SYSMETRICS_CYVSCROLL sysMetrics[SM_CYVSCROLL] /* 20 */ +#define SYSMETRICS_CXHSCROLL sysMetrics[SM_CXHSCROLL] /* 21 */ +#define SYSMETRICS_DEBUG sysMetrics[SM_DEBUG] /* 22 */ +#define SYSMETRICS_SWAPBUTTON sysMetrics[SM_SWAPBUTTON] /* 23 */ +#define SYSMETRICS_RESERVED1 sysMetrics[SM_RESERVED1] /* 24 */ +#define SYSMETRICS_RESERVED2 sysMetrics[SM_RESERVED2] /* 25 */ +#define SYSMETRICS_RESERVED3 sysMetrics[SM_RESERVED3] /* 26 */ +#define SYSMETRICS_RESERVED4 sysMetrics[SM_RESERVED4] /* 27 */ +#define SYSMETRICS_CXMIN sysMetrics[SM_CXMIN] /* 28 */ +#define SYSMETRICS_CYMIN sysMetrics[SM_CYMIN] /* 29 */ +#define SYSMETRICS_CXSIZE sysMetrics[SM_CXSIZE] /* 30 */ +#define SYSMETRICS_CYSIZE sysMetrics[SM_CYSIZE] /* 31 */ +#define SYSMETRICS_CXFRAME sysMetrics[SM_CXFRAME] /* 32 */ +#define SYSMETRICS_CYFRAME sysMetrics[SM_CYFRAME] /* 33 */ +#define SYSMETRICS_CXMINTRACK sysMetrics[SM_CXMINTRACK] /* 34 */ +#define SYSMETRICS_CYMINTRACK sysMetrics[SM_CYMINTRACK] /* 35 */ +#define SYSMETRICS_CXDOUBLECLK sysMetrics[SM_CXDOUBLECLK] /* 36 */ +#define SYSMETRICS_CYDOUBLECLK sysMetrics[SM_CYDOUBLECLK] /* 37 */ +#define SYSMETRICS_CXICONSPACING sysMetrics[SM_CXICONSPACING] /* 38 */ +#define SYSMETRICS_CYICONSPACING sysMetrics[SM_CYICONSPACING] /* 39 */ +#define SYSMETRICS_MENUDROPALIGNMENT sysMetrics[SM_MENUDROPALIGNMENT] /* 40 */ +#define SYSMETRICS_PENWINDOWS sysMetrics[SM_PENWINDOWS] /* 41 */ +#define SYSMETRICS_DBCSENABLED sysMetrics[SM_DBCSENABLED] /* 42 */ +#define SYSMETRICS_CMOUSEBUTTONS sysMetrics[SM_CMOUSEBUTTONS] /* 43 */ +#define SYSMETRICS_CXFIXEDFRAME sysMetrics[SM_CXDLGFRAME] /* win40 name change */ +#define SYSMETRICS_CYFIXEDFRAME sysMetrics[SM_CYDLGFRAME] /* win40 name change */ +#define SYSMETRICS_CXSIZEFRAME sysMetrics[SM_CXFRAME] /* win40 name change */ +#define SYSMETRICS_CYSIZEFRAME sysMetrics[SM_CYFRAME] /* win40 name change */ +#define SYSMETRICS_SECURE sysMetrics[SM_SECURE] /* 44 */ +#define SYSMETRICS_CXEDGE sysMetrics[SM_CXEDGE] /* 45 */ +#define SYSMETRICS_CYEDGE sysMetrics[SM_CYEDGE] /* 46 */ +#define SYSMETRICS_CXMINSPACING sysMetrics[SM_CXMINSPACING] /* 47 */ +#define SYSMETRICS_CYMINSPACING sysMetrics[SM_CYMINSPACING] /* 48 */ +#define SYSMETRICS_CXSMICON sysMetrics[SM_CXSMICON] /* 49 */ +#define SYSMETRICS_CYSMICON sysMetrics[SM_CYSMICON] /* 50 */ +#define SYSMETRICS_CYSMCAPTION sysMetrics[SM_CYSMCAPTION] /* 51 */ +#define SYSMETRICS_CXSMSIZE sysMetrics[SM_CXSMSIZE] /* 52 */ +#define SYSMETRICS_CYSMSIZE sysMetrics[SM_CYSMSIZE] /* 53 */ +#define SYSMETRICS_CXMENUSIZE sysMetrics[SM_CXMENUSIZE] /* 54 */ +#define SYSMETRICS_CYMENUSIZE sysMetrics[SM_CYMENUSIZE] /* 55 */ +#define SYSMETRICS_ARRANGE sysMetrics[SM_ARRANGE] /* 56 */ +#define SYSMETRICS_CXMINIMIZED sysMetrics[SM_CXMINIMIZED] /* 57 */ +#define SYSMETRICS_CYMINIMIZED sysMetrics[SM_CYMINIMIZED] /* 58 */ +#define SYSMETRICS_CXMAXTRACK sysMetrics[SM_CXMAXTRACK] /* 59 */ +#define SYSMETRICS_CYMAXTRACK sysMetrics[SM_CYMAXTRACK] /* 60 */ +#define SYSMETRICS_CXMAXIMIZED sysMetrics[SM_CXMAXIMIZED] /* 61 */ +#define SYSMETRICS_CYMAXIMIZED sysMetrics[SM_CYMAXIMIZED] /* 62 */ +#define SYSMETRICS_NETWORK sysMetrics[SM_NETWORK] /* 63 */ +#define SYSMETRICS_CLEANBOOT sysMetrics[SM_CLEANBOOT] /* 67 */ +#define SYSMETRICS_CXDRAG sysMetrics[SM_CXDRAG] /* 68 */ +#define SYSMETRICS_CYDRAG sysMetrics[SM_CYDRAG] /* 69 */ +#define SYSMETRICS_SHOWSOUNDS sysMetrics[SM_SHOWSOUNDS] /* 70 */ + +/* Use the following instead of sysMetrics[SM_CXMENUCHECK] GetMenuCheckMarkDimensions()! */ +#define SYSMETRICS_CXMENUCHECK sysMetrics[SM_CXMENUCHECK] /* 71 */ + +#define SYSMETRICS_CYMENUCHECK sysMetrics[SM_CYMENUCHECK] /* 72 */ +#define SYSMETRICS_SLOWMACHINE sysMetrics[SM_SLOWMACHINE] /* 73 */ +#define SYSMETRICS_MIDEASTENABLED sysMetrics[SM_MIDEASTENABLED] /* 74 */ +#define SYSMETRICS_MOUSEWHEELPRESENT sysMetrics[SM_MOUSEWHEELPRESENT] /* 75 */ extern void SYSMETRICS_Init(void); extern short sysMetrics[SM_CMETRICS+1]; diff --git a/include/task.h b/include/task.h index 70f79bc1f73..62fc59e25b2 100644 --- a/include/task.h +++ b/include/task.h @@ -54,8 +54,7 @@ struct _THDB; typedef struct { HTASK16 hNext; /* 00 Selector of next TDB */ - WORD sp; /* 02 Stack pointer of task */ - WORD ss; /* 04 Stack segment of task */ + DWORD ss_sp WINE_PACKED; /* 02 Stack pointer of task */ WORD nEvents; /* 06 Events for this task */ INT16 priority; /* 08 Task priority, -32..15 */ WORD unused1; /* 0a */ diff --git a/include/tweak.h b/include/tweak.h new file mode 100644 index 00000000000..d2dcbf683cb --- /dev/null +++ b/include/tweak.h @@ -0,0 +1,27 @@ +/****************************************************************************** + * + * Wine Windows 95 interface tweaks + * + * Copyright (c) 1997 Dave Cuthbert (dacut@ece.cmu.edu) + * + *****************************************************************************/ + +#if !defined(__WINE_TWEAK_H) +#define __WINE_TWEAK_H + +#include "wintypes.h" + +int TWEAK_Init(); +int TWEAK_CheckConfiguration(); +INT32 TWEAK_PartyMessageBox(LPCSTR, LPCSTR, DWORD); +void TWEAK_DrawReliefRect95(HDC32, RECT32 const *); +void TWEAK_DrawMenuSeparator95(HDC32, UINT32, UINT32, UINT32); +extern int TWEAK_Win95Look; +extern int TWEAK_WineInitialized; +extern HPEN32 TWEAK_PenFF95; +extern HPEN32 TWEAK_PenE095; +extern HPEN32 TWEAK_PenC095; +extern HPEN32 TWEAK_Pen8095; +extern HPEN32 TWEAK_Pen0095; + +#endif /* __WINE_TWEAK_H */ diff --git a/include/win.h b/include/win.h index ed9e1bc2bf3..139e919b4b7 100644 --- a/include/win.h +++ b/include/win.h @@ -37,6 +37,7 @@ typedef enum BIC32_COMBO, BIC32_COMBOLB, BIC32_POPUPMENU, + BIC32_STATIC, BIC32_SCROLL, BIC32_DESKTOP, BIC32_DIALOG, @@ -61,8 +62,8 @@ typedef struct tagWND DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ HWND32 hwndSelf; /* Handle of this window */ HINSTANCE16 hInstance; /* Window hInstance (from CreateWindow) */ - RECT16 rectClient; /* Client area rel. to parent client area */ - RECT16 rectWindow; /* Whole window rel. to parent client area */ + RECT32 rectClient; /* Client area rel. to parent client area */ + RECT32 rectWindow; /* Whole window rel. to parent client area */ LPSTR text; /* Window text */ void *pVScroll; /* Vertical scroll-bar info */ void *pHScroll; /* Horizontal scroll-bar info */ diff --git a/include/winbase.h b/include/winbase.h index 8134a168a2e..e8604187ea2 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -49,6 +49,10 @@ #define FILE_MAP_READ 0x00000004 #define FILE_MAP_ALL_ACCESS 0x000f001f +#define MOVEFILE_REPLACE_EXISTING 0x00000001 +#define MOVEFILE_COPY_ALLOWED 0x00000002 +#define MOVEFILE_DELAY_UNTIL_REBOOT 0x00000004 + #define FS_CASE_SENSITIVE FILE_CASE_SENSITIVE_SEARCH #define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES #define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK diff --git a/include/windows.h b/include/windows.h index fe00984f6e1..28dd31de9dc 100644 --- a/include/windows.h +++ b/include/windows.h @@ -1802,8 +1802,9 @@ DECL_WINELIB_TYPE(LPLOGPEN); #define SM_CYMENUCHECK 72 #define SM_SLOWMACHINE 73 #define SM_MIDEASTENABLED 74 +#define SM_MOUSEWHEELPRESENT 75 -#define SM_CMETRICS 75 +#define SM_CMETRICS 76 /* Device-independent bitmaps */ @@ -1959,9 +1960,6 @@ typedef struct } SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; /* 64 bit number of 100 nanoseconds intervals since January 1, 1601 */ -/* FIXME: currently dwLowDateTime is equivalent to the UNIX time(), - * and dwHighDateTime 0 - */ typedef struct { INT32 dwLowDateTime; @@ -5002,6 +5000,63 @@ typedef struct { DWORD dwOptDataSize; } NETCONNECTINFOSTRUCT,*LPNETCONNECTINFOSTRUCT; +typedef struct { + UINT16 cbSize; + INT16 iBorderWidth; + INT16 iScrollWidth; + INT16 iScrollHeight; + INT16 iCaptionWidth; + INT16 iCaptionHeight; + LOGFONT16 lfCaptionFont; + INT16 iSmCaptionWidth; + INT16 iSmCaptionHeight; + LOGFONT16 lfSmCaptionFont; + INT16 iMenuWidth; + INT16 iMenuHeight; + LOGFONT16 lfMenuFont; + LOGFONT16 lfStatusFont; + LOGFONT16 lfMessageFont; +} NONCLIENTMETRICS16,*LPNONCLIENTMETRICS16; + +typedef struct { + UINT32 cbSize; + INT32 iBorderWidth; + INT32 iScrollWidth; + INT32 iScrollHeight; + INT32 iCaptionWidth; + INT32 iCaptionHeight; + LOGFONT32A lfCaptionFont; + INT32 iSmCaptionWidth; + INT32 iSmCaptionHeight; + LOGFONT32A lfSmCaptionFont; + INT32 iMenuWidth; + INT32 iMenuHeight; + LOGFONT32A lfMenuFont; + LOGFONT32A lfStatusFont; + LOGFONT32A lfMessageFont; +} NONCLIENTMETRICS32A,*LPNONCLIENTMETRICS32A; + +typedef struct { + UINT32 cbSize; + INT32 iBorderWidth; + INT32 iScrollWidth; + INT32 iScrollHeight; + INT32 iCaptionWidth; + INT32 iCaptionHeight; + LOGFONT32W lfCaptionFont; + INT32 iSmCaptionWidth; + INT32 iSmCaptionHeight; + LOGFONT32W lfSmCaptionFont; + INT32 iMenuWidth; + INT32 iMenuHeight; + LOGFONT32W lfMenuFont; + LOGFONT32W lfStatusFont; + LOGFONT32W lfMessageFont; +} NONCLIENTMETRICS32W,*LPNONCLIENTMETRICS32W; + +DECL_WINELIB_TYPE_AW(NONCLIENTMETRICS); +DECL_WINELIB_TYPE_AW(LPNONCLIENTMETRICS); + #pragma pack(4) /* Declarations for functions that exist only in Win16 */ @@ -5259,6 +5314,7 @@ BOOL32 IsDBCSLeadByteEx(UINT32,BYTE); BOOL32 IsWindowUnicode(HWND32); BOOL32 IsValidLocale(DWORD,DWORD); BOOL32 LocalFileTimeToFileTime(const FILETIME*,LPFILETIME); +BOOL32 LockFile(HFILE32,DWORD,DWORD,DWORD,DWORD); SEGPTR MapLS(LPVOID); LPVOID MapSL(SEGPTR); LPVOID MapViewOfFile(HANDLE32,DWORD,DWORD,DWORD,DWORD); @@ -5339,6 +5395,7 @@ BOOL32 TlsFree(DWORD); LPVOID TlsGetValue(DWORD); BOOL32 TlsSetValue(DWORD,LPVOID); VOID UnMapLS(SEGPTR); +BOOL32 UnlockFile(HFILE32,DWORD,DWORD,DWORD,DWORD); BOOL32 UnmapViewOfFile(LPVOID); LPVOID VirtualAlloc(LPVOID,DWORD,DWORD,DWORD); BOOL32 VirtualFree(LPVOID,DWORD,DWORD); @@ -6206,6 +6263,10 @@ HWND32 GetLastActivePopup32(HWND32); UINT32 GetLogicalDriveStrings32A(UINT32,LPSTR); UINT32 GetLogicalDriveStrings32W(UINT32,LPWSTR); #define GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings) +INT16 GetLocaleInfo16(LCID,LCTYPE,LPSTR,INT16); +INT32 GetLocaleInfo32A(LCID,LCTYPE,LPSTR,INT32); +INT32 GetLocaleInfo32W(LCID,LCTYPE,LPWSTR,INT32); +#define GetLocaleInfo WINELIB_NAME_AW(GetLocaleInfo) INT16 GetMapMode16(HDC16); INT32 GetMapMode32(HDC32); #define GetMapMode WINELIB_NAME(GetMapMode) diff --git a/include/winerror.h b/include/winerror.h index 75716bf7525..f8d77388121 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -21,6 +21,7 @@ extern int WIN32_LastError; #define ERROR_OUTOFMEMORY 14 #define ERROR_NO_MORE_FILES 18 #define ERROR_SHARING_VIOLATION 32 +#define ERROR_LOCK_VIOLATION 33 #define ERROR_DUP_NAME 52 #define ERROR_FILE_EXISTS 80 #define ERROR_INVALID_PARAMETER 87 diff --git a/include/winpos.h b/include/winpos.h index 44f9e887904..f07431e4383 100644 --- a/include/winpos.h +++ b/include/winpos.h @@ -27,16 +27,17 @@ typedef struct extern BOOL32 WINPOS_RedrawIconTitle( HWND32 hWnd ); extern BOOL32 WINPOS_ShowIconTitle( WND* pWnd, BOOL32 bShow ); -extern void WINPOS_GetMinMaxInfo( WND* pWnd, POINT16 *maxSize, POINT16 *maxPos, - POINT16 *minTrack, POINT16 *maxTrack ); +extern void WINPOS_GetMinMaxInfo( WND* pWnd, POINT32 *maxSize, + POINT32 *maxPos, POINT32 *minTrack, + POINT32 *maxTrack ); extern UINT16 WINPOS_MinMaximize( WND* pWnd, UINT16 cmd, LPRECT16 lpPos); extern BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse, BOOL32 fChangeFocus ); extern BOOL32 WINPOS_ChangeActiveWindow( HWND32 hwnd, BOOL32 mouseMsg ); -extern LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect, - RECT16 *newWindowRect, RECT16 *oldWindowRect, - RECT16 *oldClientRect, SEGPTR winpos, - RECT16 *newClientRect ); +extern LONG WINPOS_SendNCCalcSize(HWND32 hwnd, BOOL32 calcValidRect, + RECT32 *newWindowRect, RECT32 *oldWindowRect, + RECT32 *oldClientRect, WINDOWPOS32 *winpos, + RECT32 *newClientRect ); extern LONG WINPOS_HandleWindowPosChanging16(WND *wndPtr, WINDOWPOS16 *winpos); extern LONG WINPOS_HandleWindowPosChanging32(WND *wndPtr, WINDOWPOS32 *winpos); extern INT16 WINPOS_WindowFromPoint( WND* scopeWnd, POINT16 pt, WND **ppWnd ); diff --git a/ipc/bit_array.c b/ipc/bit_array.c index 6873c82509a..57c93e5d7be 100644 --- a/ipc/bit_array.c +++ b/ipc/bit_array.c @@ -23,8 +23,11 @@ /* #define NDEBUG */ #if defined(linux) && !defined(NO_ASM) +#include +#if LINUX_VERSION_CODE <= 131328 /* Linux 2.1.x doesn't return values with clear_bit and set_bit */ #define HAS_BITOPS #endif +#endif #include diff --git a/ipc/dde_proc.c b/ipc/dde_proc.c index 167dde2fd12..d9fc256bf95 100644 --- a/ipc/dde_proc.c +++ b/ipc/dde_proc.c @@ -9,7 +9,7 @@ */ #ifdef CONFIG_IPC -#if defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #define msgbuf mymsg #endif diff --git a/ipc/dde_proc_test.c b/ipc/dde_proc_test.c index 1291fd849b2..541172ac06f 100644 --- a/ipc/dde_proc_test.c +++ b/ipc/dde_proc_test.c @@ -9,7 +9,7 @@ * without (with the argument is the server). *************************************************************************** */ -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #include #else @@ -59,7 +59,7 @@ void init_signals() (void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3); wine_sigaction(SIGUSR2,&usr2_act,NULL); #endif -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) usr2_act.sa_hadnler = (void (*)) stop_wait; usr2_act.sa_flags = SA_ONSTACK; usr2_act.sa_mask = sig_mask; diff --git a/ipc/shm_main_blk.c b/ipc/shm_main_blk.c index fdc230718b4..09a91b20b22 100644 --- a/ipc/shm_main_blk.c +++ b/ipc/shm_main_blk.c @@ -39,8 +39,10 @@ static void shm_main_refresh(); static void print_perm(struct ipc_perm *perm) { printf("Permission:\n"); +/* FIXME: not portable printf("\tKey=%d, mode=%03o, sequence #=%d\n", (int)perm->key,perm->mode, perm->seq); +*/ printf("\towner: uid=%d, gid=%d ;" ,perm->uid, perm->gid); printf(" creator: uid=%d, gid=%d\n",perm->cuid,perm->cgid); } diff --git a/library/miscstubs.c b/library/miscstubs.c index 38094c14fa0..809e3da0150 100644 --- a/library/miscstubs.c +++ b/library/miscstubs.c @@ -57,8 +57,6 @@ extern LRESULT MDIClientWndProc(HWND16,UINT16,WPARAM16,LPARAM); extern LRESULT PrintDlgProc(HWND16,UINT16,WPARAM16,LPARAM); extern LRESULT PrintSetupDlgProc(HWND16,UINT16,WPARAM16,LPARAM); extern LRESULT ReplaceTextDlgProc(HWND16,UINT16,WPARAM16,LPARAM); -extern LRESULT ScrollBarWndProc(HWND16,UINT16,WPARAM16,LPARAM); -extern LRESULT StaticWndProc(HWND16,UINT16,WPARAM16,LPARAM); extern LRESULT TASK_Reschedule(void); /*********************************************************************** @@ -77,8 +75,6 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name ) MAP_STR_TO_PROC("PrintDlgProc",PrintDlgProc); MAP_STR_TO_PROC("PrintSetupDlgProc",PrintSetupDlgProc); MAP_STR_TO_PROC("ReplaceTextDlgProc",ReplaceTextDlgProc); - MAP_STR_TO_PROC("ScrollBarWndProc",ScrollBarWndProc); - MAP_STR_TO_PROC("StaticWndProc",StaticWndProc); MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule); fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name); return NULL; diff --git a/loader/main.c b/loader/main.c index 24b98a39c5d..4fb3aa3d249 100644 --- a/loader/main.c +++ b/loader/main.c @@ -13,6 +13,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; #include "windows.h" #include "module.h" #include "selectors.h" +#include "bitmap.h" #include "comm.h" #include "win.h" #include "menu.h" @@ -31,6 +32,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; #include "options.h" #include "spy.h" #include "task.h" +#include "tweak.h" #include "user.h" #include "dce.h" #include "shell.h" @@ -98,35 +100,41 @@ int MAIN_Init(void) if (!WIN16DRV_Init()) return 0; #endif /* WINELIB */ + /* Initialize Wine tweaks */ + if (!TWEAK_Init()) return 0; + + /* Initialize OEM Bitmaps */ + if (!OBM_Init()) return 0; + /* Initialise DOS drives */ if (!DRIVE_Init()) return 0; /* Initialise DOS directories */ if (!DIR_Init()) return 0; - /* Initialize tasks */ + /* Initialize tasks */ if (!TASK_Init()) return 0; - /* Initialize communications */ + /* Initialize communications */ COMM_Init(); - /* Initialize IO-port permissions */ + /* Initialize IO-port permissions */ IO_port_init(); - /* registry initialisation */ + /* registry initialisation */ SHELL_LoadRegistry(); - /* Global atom table initialisation */ + /* Global atom table initialisation */ if (!ATOM_Init()) return 0; - /* GDI initialisation */ + /* GDI initialisation */ if (!GDI_Init()) return 0; - /* Initialize system colors and metrics*/ + /* Initialize system colors and metrics*/ SYSMETRICS_Init(); SYSCOLOR_Init(); - /* Create the DCEs */ + /* Create the DCEs */ DCE_Init(); /* Initialize keyboard */ @@ -138,10 +146,10 @@ int MAIN_Init(void) /* Initialize built-in window classes */ if (!WIDGETS_Init()) return 0; - /* Initialize dialog manager */ + /* Initialize dialog manager */ if (!DIALOG_Init()) return 0; - /* Initialize menus */ + /* Initialize menus */ if (!MENU_Init()) return 0; /* Create desktop window */ @@ -150,7 +158,10 @@ int MAIN_Init(void) /* Initialize message spying */ if (!SPY_Init()) return 0; - /* Create system message queue */ + /* Check wine.conf for old/bad entries */ + if (!TWEAK_CheckConfiguration()) return 0; + + /* Create system message queue */ queueSize = GetProfileInt32A( "windows", "TypeAhead", 120 ); if (!QUEUE_CreateSysMsgQueue( queueSize )) return 0; @@ -206,6 +217,12 @@ int main(int argc, char *argv[] ) return 1; } + if (!GetNumTasks()) + { + fprintf( stderr, "wine: no executable file found.\n" ); + return 0; + } + if (Options.debug) DEBUG_SetBreakpoints( TRUE ); /* Setup breakpoints */ Yield(); /* Start the first task */ diff --git a/loader/module.c b/loader/module.c index 8a54aa2be23..a3522c61db8 100644 --- a/loader/module.c +++ b/loader/module.c @@ -1143,7 +1143,8 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) SELFLOADHEADER *selfloadheader; STACK16FRAME *stack16Top; HMODULE16 hselfload = GetModuleHandle16("WPROCS"); - WORD oldss, oldsp, saved_dgroup = pSegTable[pModule->dgroup - 1].selector; + DWORD oldstack; + WORD saved_dgroup = pSegTable[pModule->dgroup - 1].selector; fprintf (stderr, "Warning: %*.*s is a self-loading module\n" "Support for self-loading modules is very experimental\n", *((BYTE*)pModule + pModule->name_table), @@ -1160,13 +1161,12 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) GLOBAL_Alloc (GMEM_ZEROINIT, 0xFF00, hModule, FALSE, FALSE, FALSE) ); - oldss = IF1632_Saved16_ss; - oldsp = IF1632_Saved16_sp; - IF1632_Saved16_ss = pModule->self_loading_sel; - IF1632_Saved16_sp = 0xFF00 - sizeof(*stack16Top); + oldstack = IF1632_Saved16_ss_sp; + IF1632_Saved16_ss_sp = MAKELONG( 0xFF00 - sizeof(*stack16Top), + pModule->self_loading_sel ); stack16Top = CURRENT_STACK16; - stack16Top->saved_ss = 0; - stack16Top->saved_sp = 0; + stack16Top->saved_ss_sp = 0; + stack16Top->ebp = 0; stack16Top->ds = stack16Top->es = pModule->self_loading_sel; stack16Top->entry_point = 0; stack16Top->entry_ip = 0; @@ -1205,8 +1205,7 @@ HINSTANCE16 MODULE_Load( LPCSTR name, LPVOID paramBlock, BOOL32 first ) _lclose32(hf); /* some BootApp procs overwrite the selector of dgroup */ pSegTable[pModule->dgroup - 1].selector = saved_dgroup; - IF1632_Saved16_ss = oldss; - IF1632_Saved16_sp = oldsp; + IF1632_Saved16_ss_sp = oldstack; for (i = 2; i <= pModule->seg_count; i++) NE_LoadSegment( hModule, i ); if (hInitialStack32) { diff --git a/loader/ne_image.c b/loader/ne_image.c index 1937fdde214..ca2819b4a4a 100644 --- a/loader/ne_image.c +++ b/loader/ne_image.c @@ -69,19 +69,18 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum ) /* Implement self loading segments */ SELFLOADHEADER *selfloadheader; STACK16FRAME *stack16Top; - WORD oldss, oldsp, oldselector, newselector; + DWORD oldstack; + WORD oldselector, newselector; HFILE32 hf = FILE_DupUnixHandle( fd ); selfloadheader = (SELFLOADHEADER *) PTR_SEG_OFF_TO_LIN(pSegTable->selector,0); - oldss = IF1632_Saved16_ss; - oldsp = IF1632_Saved16_sp; + oldstack = IF1632_Saved16_ss_sp; oldselector = pSeg->selector; - IF1632_Saved16_ss = pModule->self_loading_sel; - IF1632_Saved16_sp = 0xFF00 - sizeof(*stack16Top); + IF1632_Saved16_ss_sp = MAKELONG( 0xFF00 - sizeof(*stack16Top), + pModule->self_loading_sel ); stack16Top = CURRENT_STACK16; - stack16Top->saved_ss = 0; - stack16Top->saved_sp = 0; + stack16Top->saved_ss_sp = 0; stack16Top->ds = stack16Top->es = pModule->self_loading_sel; stack16Top->entry_point = 0; stack16Top->entry_ip = 0; @@ -110,8 +109,7 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum ) } } - IF1632_Saved16_ss = oldss; - IF1632_Saved16_sp = oldsp; + IF1632_Saved16_ss_sp = oldstack; } else if (!(pSeg->flags & NE_SEGFLAGS_ITERATED)) read(fd, mem, size); @@ -501,7 +499,8 @@ static BOOL32 NE_InitDLL( HMODULE16 hModule ) CS_reg(&context) = pSegTable[pModule->cs-1].selector; EIP_reg(&context) = pModule->ip; - EBP_reg(&context) = IF1632_Saved16_sp + (WORD)&((STACK16FRAME*)0)->bp; + EBP_reg(&context) = OFFSETOF(IF1632_Saved16_ss_sp) + + (WORD)&((STACK16FRAME*)0)->bp; EDI_reg(&context) = DS_reg(&context) ? DS_reg(&context) : hModule; diff --git a/loader/pe_image.c b/loader/pe_image.c index 0616e6f28bb..5f7660b806b 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -359,7 +359,7 @@ static void do_relocations(struct pe_data *pe) * PE_LoadImage * Load one PE format executable into memory */ -static void PE_LoadImage( struct pr_data **ret_pe, int fd, HMODULE16 hModule, WORD offset, OFSTRUCT *ofs ) +static void PE_LoadImage( struct pe_data **ret_pe, int fd, HMODULE16 hModule, WORD offset, OFSTRUCT *ofs ) { struct pe_data *pe; int i, result; @@ -577,7 +577,7 @@ problem needs to be fixed properly at some stage */ else { char *s; modname = s = ofs->szPathName; - while (s=strchr(modname,'\\')) + while ((s=strchr(modname,'\\'))) modname = s+1; if ((s=strchr(modname,'.'))) *s='\0'; diff --git a/loader/signal.c b/loader/signal.c index 5290f7c7d24..43aae82086a 100644 --- a/loader/signal.c +++ b/loader/signal.c @@ -12,7 +12,7 @@ #include #include -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__svr4__) || defined(_SCO_DS) || defined(__EMX__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__svr4__) || defined(_SCO_DS) || defined(__EMX__) #if !defined(_SCO_DS) && !defined(__EMX__) #include #endif @@ -184,7 +184,7 @@ static void SIGNAL_SetHandler( int sig, void (*func)(), int flags ) ret = wine_sigaction( sig, &sig_act, NULL ); #endif /* linux */ -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) struct sigaction sig_act; sigset_t sig_mask; sigemptyset(&sig_mask); @@ -192,7 +192,7 @@ static void SIGNAL_SetHandler( int sig, void (*func)(), int flags ) sig_act.sa_flags = SA_ONSTACK; sig_act.sa_mask = sig_mask; ret = sigaction( sig, &sig_act, NULL ); -#endif /* __FreeBSD__ || __NetBSD__ */ +#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */ #if defined (__svr4__) || defined(_SCO_DS) struct sigaction sig_act; @@ -230,7 +230,7 @@ extern void WINSOCK_sigio(int a); */ BOOL32 SIGNAL_Init(void) { -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) struct sigaltstack ss; if ((ss.ss_sp = malloc(MINSIGSTKSZ)) == NULL) { @@ -244,7 +244,7 @@ BOOL32 SIGNAL_Init(void) perror("sigstack"); return FALSE; } -#endif /* __FreeBSD__ || __NetBSD__ */ +#endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ */ #if defined (__svr4__) || defined(_SCO_DS) struct sigaltstack ss; diff --git a/loader/task.c b/loader/task.c index 899e5775490..93756c8c150 100644 --- a/loader/task.c +++ b/loader/task.c @@ -44,8 +44,7 @@ extern void USER_AppExit( HTASK16, HINSTANCE16, HQUEUE16 ); extern void PE_InitTls( PE_MODULE *module ); /* Saved 16-bit stack for current process (Win16 only) */ -WORD IF1632_Saved16_ss = 0; -WORD IF1632_Saved16_sp = 0; +DWORD IF1632_Saved16_ss_sp = 0; /* Saved 32-bit stack for current process (Win16 only) */ DWORD IF1632_Saved32_esp = 0; @@ -360,9 +359,7 @@ static void TASK_CallToStart(void) NE_MODULE *pModule = MODULE_GetPtr( pTask->hModule ); SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule ); - IF1632_Saved16_ss = pTask->ss; - IF1632_Saved16_sp = pTask->sp; - + IF1632_Saved16_ss_sp = pTask->ss_sp; if (pModule->flags & NE_FFLAGS_WIN32) { /* FIXME: all this is an ugly hack */ @@ -404,7 +401,8 @@ static void TASK_CallToStart(void) dprintf_task( stddeb, "Starting main program: cs:ip=%04lx:%04x ds=%04lx ss:sp=%04x:%04x\n", CS_reg(&context), IP_reg(&context), DS_reg(&context), - IF1632_Saved16_ss, IF1632_Saved16_sp ); + SELECTOROF(IF1632_Saved16_ss_sp), + OFFSETOF(IF1632_Saved16_ss_sp) ); CallTo16_regs_( &context ); /* This should never return */ @@ -580,13 +578,13 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, /* Create the 16-bit stack frame */ - pTask->ss = hInstance; - pTask->sp = ((pModule->sp != 0) ? pModule->sp : - pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1; - stack16Top = (char *)PTR_SEG_OFF_TO_LIN( pTask->ss, pTask->sp ); + pTask->ss_sp = MAKELONG( ((pModule->sp != 0) ? pModule->sp : + pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1, + hInstance ); + stack16Top = (char *)PTR_SEG_TO_LIN( pTask->ss_sp ); frame16 = (STACK16FRAME *)stack16Top - 1; - frame16->saved_ss = 0; - frame16->saved_sp = 0; + frame16->saved_ss_sp = 0; + frame16->ebp = 0; frame16->ds = frame16->es = pTask->hInstance; frame16->entry_point = 0; frame16->entry_ip = OFFSETOF(TASK_RescheduleProc) + 14; @@ -596,17 +594,13 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance, frame16->ip = LOWORD( CALLTO16_RetAddr_word ); frame16->cs = HIWORD( CALLTO16_RetAddr_word ); #endif /* WINELIB */ - pTask->sp -= sizeof(STACK16FRAME); + pTask->ss_sp -= sizeof(STACK16FRAME); /* If there's no 16-bit stack yet, use a part of the new task stack */ /* This is only needed to have a stack to switch from on the first */ /* call to DirectedYield(). */ - if (!IF1632_Saved16_ss) - { - IF1632_Saved16_ss = pTask->ss; - IF1632_Saved16_sp = pTask->sp; - } + if (!IF1632_Saved16_ss_sp) IF1632_Saved16_ss_sp = pTask->ss_sp; /* Add a breakpoint at the start of the task */ @@ -810,9 +804,8 @@ void TASK_Reschedule(void) if (pOldTask) { - pOldTask->ss = IF1632_Saved16_ss; - pOldTask->sp = IF1632_Saved16_sp; - pOldTask->esp = IF1632_Saved32_esp; + pOldTask->ss_sp = IF1632_Saved16_ss_sp; + pOldTask->esp = IF1632_Saved32_esp; } else IF1632_Original32_esp = IF1632_Saved32_esp; @@ -828,9 +821,8 @@ void TASK_Reschedule(void) hCurrentTask = hTask; pCurrentThread = pNewTask->thdb; pCurrentProcess = pCurrentThread->process; - IF1632_Saved16_ss = pNewTask->ss; - IF1632_Saved16_sp = pNewTask->sp; - IF1632_Saved32_esp = pNewTask->esp; + IF1632_Saved16_ss_sp = pNewTask->ss_sp; + IF1632_Saved32_esp = pNewTask->esp; } @@ -912,7 +904,7 @@ void InitTask( CONTEXT *context ) pinstance->stackbottom = stackhi; /* yup, that's right. Confused me too. */ pinstance->stacktop = stacklow; #ifndef WINELIB - pinstance->stackmin = IF1632_Saved16_sp; + pinstance->stackmin = OFFSETOF(IF1632_Saved16_ss_sp); #endif } @@ -1154,26 +1146,26 @@ void SwitchStackTo( WORD seg, WORD ptr, WORD top ) if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return; if (!(pData = (INSTANCEDATA *)GlobalLock16( seg ))) return; dprintf_task( stddeb, "SwitchStackTo: old=%04x:%04x new=%04x:%04x\n", - IF1632_Saved16_ss, IF1632_Saved16_sp, seg, ptr ); + SELECTOROF(IF1632_Saved16_ss_sp), + OFFSETOF(IF1632_Saved16_ss_sp), seg, ptr ); /* Save the old stack */ oldFrame = CURRENT_STACK16; - pData->old_sp = IF1632_Saved16_sp; - pData->old_ss = IF1632_Saved16_ss; + pData->old_ss_sp = IF1632_Saved16_ss_sp; pData->stacktop = top; pData->stackmin = ptr; pData->stackbottom = ptr; /* Switch to the new stack */ - IF1632_Saved16_ss = pTask->ss = seg; - IF1632_Saved16_sp = pTask->sp = ptr - sizeof(STACK16FRAME); + IF1632_Saved16_ss_sp = pTask->ss_sp = MAKELONG( ptr - sizeof(STACK16FRAME), + seg ); newFrame = CURRENT_STACK16; /* Copy the stack frame and the local variables to the new stack */ - copySize = oldFrame->bp - pData->old_sp; + copySize = oldFrame->bp - OFFSETOF(pData->old_ss_sp); memcpy( newFrame, oldFrame, MAX( copySize, sizeof(STACK16FRAME) )); } @@ -1192,33 +1184,32 @@ void SwitchStackBack(void) INSTANCEDATA *pData; if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return; - if (!(pData = (INSTANCEDATA *)GlobalLock16( IF1632_Saved16_ss ))) return; - if (!pData->old_ss) + if (!(pData = (INSTANCEDATA *)GlobalLock16(SELECTOROF(IF1632_Saved16_ss_sp)))) + return; + if (!pData->old_ss_sp) { fprintf( stderr, "SwitchStackBack: no previous SwitchStackTo\n" ); return; } dprintf_task( stddeb, "SwitchStackBack: restoring stack %04x:%04x\n", - pData->old_ss, pData->old_sp ); + SELECTOROF(pData->old_ss_sp), OFFSETOF(pData->old_ss_sp) ); oldFrame = CURRENT_STACK16; /* Switch back to the old stack */ - IF1632_Saved16_ss = pTask->ss = pData->old_ss; - IF1632_Saved16_sp = pTask->sp = pData->old_sp; - pData->old_ss = pData->old_sp = 0; + IF1632_Saved16_ss_sp = pTask->ss_sp = pData->old_ss_sp; + pData->old_ss_sp = 0; /* Build a stack frame for the return */ newFrame = CURRENT_STACK16; - newFrame->saved_ss = oldFrame->saved_ss; - newFrame->saved_sp = oldFrame->saved_sp; - newFrame->entry_ip = oldFrame->entry_ip; - newFrame->entry_cs = oldFrame->entry_cs; - newFrame->bp = oldFrame->bp; - newFrame->ip = oldFrame->ip; - newFrame->cs = oldFrame->cs; + newFrame->saved_ss_sp = oldFrame->saved_ss_sp; + newFrame->entry_ip = oldFrame->entry_ip; + newFrame->entry_cs = oldFrame->entry_cs; + newFrame->bp = oldFrame->bp; + newFrame->ip = oldFrame->ip; + newFrame->cs = oldFrame->cs; } @@ -1491,8 +1482,8 @@ BOOL16 TaskNext( TASKENTRY *lpte ) lpte->hTaskParent = pTask->hParent; lpte->hInst = pTask->hInstance; lpte->hModule = pTask->hModule; - lpte->wSS = pTask->ss; - lpte->wSP = pTask->sp; + lpte->wSS = SELECTOROF( pTask->ss_sp ); + lpte->wSP = OFFSETOF( pTask->ss_sp ); lpte->wStackTop = pInstData->stacktop; lpte->wStackMinimum = pInstData->stackmin; lpte->wStackBottom = pInstData->stackbottom; diff --git a/memory/ldt.c b/memory/ldt.c index 0d9200cb756..fce33af8dd3 100644 --- a/memory/ldt.c +++ b/memory/ldt.c @@ -14,7 +14,7 @@ #include "debug.h" #ifdef linux -#include +#include struct modify_ldt_s { @@ -37,12 +37,12 @@ static __inline__ _syscall3(int, modify_ldt, int, func, void *, ptr, #include #endif -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include extern int i386_get_ldt(int, union descriptor *, int); extern int i386_set_ldt(int, union descriptor *, int); -#endif /* __NetBSD__ || __FreeBSD__ */ +#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */ ldt_copy_entry ldt_copy[LDT_SIZE]; @@ -173,7 +173,7 @@ int LDT_SetEntry( int entry, const ldt_entry *content ) } #endif /* linux */ -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) if (!__winelib) { long d[2]; @@ -188,7 +188,7 @@ int LDT_SetEntry( int entry, const ldt_entry *content ) exit(1); } } -#endif /* __NetBSD__ || __FreeBSD__ */ +#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */ #if defined(__svr4__) || defined(_SCO_DS) if (!__winelib) { diff --git a/memory/selector.c b/memory/selector.c index b3f24543e21..06ed3ef876a 100644 --- a/memory/selector.c +++ b/memory/selector.c @@ -151,7 +151,7 @@ void SELECTOR_FreeBlock( WORD sel, WORD count ) { if ((frame->ds >= sel) && (frame->ds < nextsel)) frame->ds = 0; if ((frame->es >= sel) && (frame->es < nextsel)) frame->es = 0; - frame = PTR_SEG_OFF_TO_LIN(frame->saved_ss, frame->saved_sp); + frame = PTR_SEG_TO_LIN( frame->saved_ss_sp ); } } diff --git a/misc/Makefile.in b/misc/Makefile.in index 08b87e120ee..86770446adb 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -32,6 +32,7 @@ C_SRCS = \ stress.c \ system.c \ toolhelp.c \ + tweak.c \ ver.c \ w32sys.c \ winsock.c \ @@ -44,3 +45,4 @@ all: $(MODULE).o @MAKE_RULES@ ### Dependencies: + diff --git a/misc/comm.c b/misc/comm.c index df5b7c483c9..36d3f7e1628 100644 --- a/misc/comm.c +++ b/misc/comm.c @@ -21,7 +21,7 @@ #include #include #include -#if defined(__NetBSD__) || defined(__FreeBSD__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include #endif #include diff --git a/misc/main.c b/misc/main.c index 84ab9cfec8f..01cc321de3a 100644 --- a/misc/main.c +++ b/misc/main.c @@ -932,7 +932,117 @@ LONG GetTimerResolution(void) BOOL32 SystemParametersInfo32A( UINT32 uAction, UINT32 uParam, LPVOID lpvParam, UINT32 fuWinIni ) { - return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni); + int timeout, temp; + XKeyboardState keyboard_state; + + switch (uAction) { + case SPI_GETBEEP: + XGetKeyboardControl(display, &keyboard_state); + if (keyboard_state.bell_percent == 0) + *(BOOL32 *) lpvParam = FALSE; + else + *(BOOL32 *) lpvParam = TRUE; + break; + + case SPI_GETBORDER: + *(INT32 *)lpvParam = GetSystemMetrics32( SM_CXFRAME ); + break; + + case SPI_GETFASTTASKSWITCH: + if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 ) + *(BOOL32 *) lpvParam = TRUE; + else + *(BOOL32 *) lpvParam = FALSE; + break; + + case SPI_GETGRIDGRANULARITY: + *(INT32*)lpvParam=GetProfileInt32A("desktop","GridGranularity",1); + break; + + case SPI_GETICONTITLEWRAP: + *(BOOL32*)lpvParam=GetProfileInt32A("desktop","IconTitleWrap",TRUE); + break; + + case SPI_GETKEYBOARDDELAY: + *(INT32*)lpvParam=GetProfileInt32A("keyboard","KeyboardDelay",1); + break; + + case SPI_GETKEYBOARDSPEED: + *(DWORD*)lpvParam=GetProfileInt32A("keyboard","KeyboardSpeed",30); + break; + + case SPI_GETMENUDROPALIGNMENT: + *(BOOL32*)lpvParam=GetSystemMetrics32(SM_MENUDROPALIGNMENT); /* XXX check this */ + break; + + case SPI_GETSCREENSAVEACTIVE: + if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 ) + *(BOOL32*)lpvParam = TRUE; + else + *(BOOL32*)lpvParam = FALSE; + break; + + case SPI_GETSCREENSAVETIMEOUT: + /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */ + XGetScreenSaver(display, &timeout, &temp,&temp,&temp); + *(INT32 *) lpvParam = timeout * 1000; + break; + + case SPI_ICONHORIZONTALSPACING: + /* FIXME Get/SetProfileInt */ + if (lpvParam == NULL) + /*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ; + else + *(INT32*)lpvParam=GetSystemMetrics32(SM_CXICONSPACING); + break; + + case SPI_ICONVERTICALSPACING: + /* FIXME Get/SetProfileInt */ + if (lpvParam == NULL) + /*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ; + else + *(INT32*)lpvParam=GetSystemMetrics32(SM_CYICONSPACING); + break; + + case SPI_GETICONTITLELOGFONT: { + LPLOGFONT32A lpLogFont = (LPLOGFONT32A)lpvParam; + + GetProfileString32A("Desktop", "IconTitleFaceName", "Helvetica", + lpLogFont->lfFaceName, LF_FACESIZE ); + lpLogFont->lfHeight = -GetProfileInt32A("Desktop","IconTitleSize", 8); + + lpLogFont->lfWidth = 0; + lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0; + lpLogFont->lfWeight = FW_NORMAL; + lpLogFont->lfItalic = FALSE; + lpLogFont->lfStrikeOut = FALSE; + lpLogFont->lfUnderline = FALSE; + lpLogFont->lfCharSet = ANSI_CHARSET; + lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS; + lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS; + lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS; + break; + } + case SPI_GETWORKAREA: + SetRect32( (RECT32 *)lpvParam, 0, 0, + GetSystemMetrics32( SM_CXSCREEN ), + GetSystemMetrics32( SM_CYSCREEN ) + ); + break; + case SPI_GETNONCLIENTMETRICS: { + /* FIXME: implement correctly */ + LPNONCLIENTMETRICS32A lpnm=(LPNONCLIENTMETRICS32A)lpvParam; + + SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0); + SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0); + SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0); + SystemParametersInfo32A(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0); + break; + } + default: + return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni); + } + return TRUE; } @@ -1080,6 +1190,16 @@ BOOL16 SystemParametersInfo16( UINT16 uAction, UINT16 uParam, lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS; break; } + case SPI_GETNONCLIENTMETRICS: { + /* FIXME: implement correctly */ + LPNONCLIENTMETRICS16 lpnm=(LPNONCLIENTMETRICS16)lpvParam; + + SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0); + SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0); + SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0); + SystemParametersInfo16(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0); + break; + } case SPI_LANGDRIVER: case SPI_SETBORDER: @@ -1153,6 +1273,16 @@ BOOL32 SystemParametersInfo32W( UINT32 uAction, UINT32 uParam, lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS; } break; + case SPI_GETNONCLIENTMETRICS: { + /* FIXME: implement correctly */ + LPNONCLIENTMETRICS32W lpnm=(LPNONCLIENTMETRICS32W)lpvParam; + + SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfCaptionFont),0); + SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMenuFont),0); + SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfStatusFont),0); + SystemParametersInfo32W(SPI_GETICONTITLELOGFONT,0,(LPVOID)&(lpnm->lfMessageFont),0); + break; + } default: return SystemParametersInfo32A(uAction,uParam,lpvParam,fuWinIni); diff --git a/misc/ole2nls.c b/misc/ole2nls.c index ea6975da0e7..53ad95ee645 100644 --- a/misc/ole2nls.c +++ b/misc/ole2nls.c @@ -12,6 +12,8 @@ #include "ole.h" #include "options.h" #include "winnls.h" +#include "winreg.h" +#include "winerror.h" #include "stddebug.h" #include "debug.h" @@ -126,6 +128,58 @@ static struct tagLOCALE_NAME2ID { {NULL,0}, }; +const struct map_lcid2str { + LCID langid; + const char *langname; +} languages[]={ + {0x0401,"Arabisch"}, + {0x0402,"Bulgarisch"}, + {0x0403,"Katalanisch"}, + {0x0404,"Traditionales Chinesisch"}, + {0x0405,"Tschecisch"}, + {0x0406,"Ddnisch"}, + {0x0407,"Deutsch"}, + {0x0408,"Griechisch"}, + {0x0409,"Amerikanisches Englisch"}, + {0x040A,"Kastilisches Spanisch"}, + {0x040B,"Finnisch"}, + {0x040C,"Franzvsisch"}, + {0x040D,"Hebrdisch"}, + {0x040E,"Ungarisch"}, + {0x040F,"Isldndisch"}, + {0x0410,"Italienisch"}, + {0x0411,"Japanisch"}, + {0x0412,"Koreanisch"}, + {0x0413,"Niederldndisch"}, + {0x0414,"Norwegisch-Bokmal"}, + {0x0415,"Polnisch"}, + {0x0416,"Brasilianisches Portugiesisch"}, + {0x0417,"Rdtoromanisch"}, + {0x0418,"Rumdnisch"}, + {0x0419,"Russisch"}, + {0x041A,"Kroatoserbisch (lateinisch)"}, + {0x041B,"Slowenisch"}, + {0x041C,"Albanisch"}, + {0x041D,"Schwedisch"}, + {0x041E,"Thai"}, + {0x041F,"T|rkisch"}, + {0x0420,"Urdu"}, + {0x0421,"Bahasa"}, + {0x0804,"Vereinfachtes Chinesisch"}, + {0x0807,"Schweizerdeutsch"}, + {0x0809,"Britisches Englisch"}, + {0x080A,"Mexikanisches Spanisch"}, + {0x080C,"Belgisches Franzvsisch"}, + {0x0810,"Schweizerisches Italienisch"}, + {0x0813,"Belgisches Niederldndisch"}, + {0x0814,"Norgwegisch-Nynorsk"}, + {0x0816,"Portugiesisch"}, + {0x081A,"Serbokratisch (kyrillisch)"}, + {0x0C1C,"Kanadisches Franzvsisch"}, + {0x100C,"Schweizerisches Franzvsisch"}, + {0x0000,"Unbekannt"}, +}; + /*********************************************************************** * GetUserDefaultLCID (OLE2NLS.1) */ @@ -195,12 +249,17 @@ WORD GetSystemDefaultLangID() * GetLocaleInfoA (OLE2NLS.5) * Is the last parameter really WORD for Win16? */ -int GetLocaleInfoA(DWORD lcid,DWORD LCType,LPSTR buf,WORD len) +INT16 GetLocaleInfo16(LCID lcid,LCTYPE LCType,LPSTR buf,INT16 len) +{ + return GetLocaleInfo32A(lcid,LCType,buf,len); +} + +INT32 GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len) { char *retString; int found,i; - dprintf_ole(stddeb,"GetLocaleInfoA(%8lX,%8lX,%p,%4X)\n", + dprintf_ole(stddeb,"GetLocaleInfo32A(%8lX,%8lX,%p,%4X)\n", lcid,LCType,buf,len); /* As an option, we could obtain the value from win.ini. This would not match the Wine compile-time option. @@ -358,7 +417,7 @@ LOCVAL(LOCALE_INEGSEPBYSPACE) case LANG_Da: switch (LCType) { -/* LOCVAL(LOCALE_ILANGUAGE,"9") */ +LOCVAL(LOCALE_ILANGUAGE,"6") LOCVAL(LOCALE_SLANGUAGE,"Dansk") LOCVAL(LOCALE_SENGLANGUAGE,"Danish") LOCVAL(LOCALE_SABBREVLANGNAME,"dan") @@ -366,9 +425,9 @@ LOCVAL(LOCALE_SNATIVELANGNAME,"Dansk") LOCVAL(LOCALE_ICOUNTRY,"45") LOCVAL(LOCALE_SCOUNTRY,"Danmark") LOCVAL(LOCALE_SENGCOUNTRY,"Denmark") -LOCVAL(LOCALE_SABBREVCTRYNAME,"Da") +LOCVAL(LOCALE_SABBREVCTRYNAME,"DK") LOCVAL(LOCALE_SNATIVECTRYNAME,"Danmark") -/* LOCVAL(LOCALE_IDEFAULTLANGUAGE,"9") */ +LOCVAL(LOCALE_IDEFAULTLANGUAGE,"6") LOCVAL(LOCALE_IDEFAULTCOUNTRY,"45") /* LOCVAL(LOCALE_IDEFAULTCODEPAGE) */ /* LOCVAL(LOCALE_IDEFAULTANSICODEPAGE) */ @@ -403,8 +462,8 @@ LOCVAL(LOCALE_ITIME,"1") LOCVAL(LOCALE_ITLZERO,"1") /* LOCVAL(LOCALE_IDAYLZERO) */ /* LOCVAL(LOCALE_IMONLZERO) */ -/* LOCVAL(LOCALE_S1159) */ -/* LOCVAL(LOCALE_S2359) */ +LOCVAL(LOCALE_S1159, "") +LOCVAL(LOCALE_S2359, "") /* LOCVAL(LOCALE_ICALENDARTYPE) */ /* LOCVAL(LOCALE_IOPTIONALCALENDAR) */ /* LOCVAL(LOCALE_IFIRSTDAYOFWEEK) */ @@ -449,14 +508,14 @@ LOCVAL(LOCALE_SABBREVMONTHNAME10,"Okt") LOCVAL(LOCALE_SABBREVMONTHNAME11,"Nov") LOCVAL(LOCALE_SABBREVMONTHNAME12,"Dec") LOCVAL(LOCALE_SABBREVMONTHNAME13,"") -/* LOCVAL(LOCALE_SPOSITIVESIGN) */ -/* LOCVAL(LOCALE_SNEGATIVESIGN) */ -/* LOCVAL(LOCALE_IPOSSIGNPOSN) */ -/* LOCVAL(LOCALE_INEGSIGNPOSN) */ -/* LOCVAL(LOCALE_IPOSSYMPRECEDES) */ -/* LOCVAL(LOCALE_IPOSSEPBYSPACE) */ -/* LOCVAL(LOCALE_INEGSYMPRECEDES) */ -/* LOCVAL(LOCALE_INEGSEPBYSPACE) */ +LOCVAL(LOCALE_SPOSITIVESIGN, "") +LOCVAL(LOCALE_SNEGATIVESIGN, "-") +LOCVAL(LOCALE_IPOSSIGNPOSN, "3") +LOCVAL(LOCALE_INEGSIGNPOSN, "3") +LOCVAL(LOCALE_IPOSSYMPRECEDES, "1") +LOCVAL(LOCALE_IPOSSEPBYSPACE, "0") +LOCVAL(LOCALE_INEGSYMPRECEDES, "1") +LOCVAL(LOCALE_INEGSEPBYSPACE, "0") default: found=0;break; } break; /* LANG(Da) */ @@ -1639,12 +1698,12 @@ LOCVAL(LOCALE_INEGSEPBYSPACE, "0") */ INT32 GetLocaleInfo32W(LCID lcid,LCTYPE LCType,LPWSTR wbuf,INT32 len) { - int i; - LPSTR abuf = (LPSTR) wbuf; - INT32 n = GetLocaleInfoA(lcid, LCType, abuf, len); + LPSTR abuf = (LPSTR)HeapAlloc(GetProcessHeap(),0,len); + + INT32 n = GetLocaleInfo32A(lcid, LCType, abuf, len); if (wbuf) - for (i = n; i > 0; --i) - wbuf[i] = abuf[i]; + lstrcpynAtoW(wbuf,abuf,len); + HeapFree(GetProcessHeap(),0,abuf); return n; } @@ -1728,14 +1787,9 @@ BOOL16 SetLocaleInfoA(DWORD lcid, DWORD lctype, LPCSTR data) /*********************************************************************** * IsValidLocale (KERNEL32.361) */ -BOOL32 IsValidLocale(DWORD lcid,DWORD flags) { - int i; - - i=0; - while (locale_name2id[i].name!=NULL) - if (locale_name2id[i].id == lcid) - return TRUE; - return FALSE; +BOOL32 IsValidLocale(LCID lcid,DWORD flags) { + /* we support ANY language. Well, at least say that...*/ + return TRUE; } /*********************************************************************** @@ -1745,14 +1799,34 @@ BOOL32 EnumSystemLocales32W( LOCALE_ENUMPROC32W lpfnLocaleEnum, DWORD flags ) { int i; BOOL32 ret; + WCHAR buffer[200]; + HKEY xhkey; dprintf_win32(stddeb,"EnumSystemLocales32W(%p,%08lx)\n", lpfnLocaleEnum,flags ); + /* see if we can reuse the Win95 registry entries.... */ + if (ERROR_SUCCESS==RegOpenKey32A(HKEY_LOCAL_MACHINE,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\",&xhkey)) { + i=0; + while (1) { + if (ERROR_SUCCESS!=RegEnumKey32W(xhkey,i,buffer,sizeof(buffer))) + break; + if (!lpfnLocaleEnum(buffer)) + break; + i++; + } + RegCloseKey(xhkey); + return TRUE; + } + i=0; - while (locale_name2id[i].name!=NULL) + while (languages[i].langname!=NULL) { - LPWSTR cp = HEAP_strdupAtoW( GetProcessHeap(), 0, - locale_name2id[i].name ); + LPWSTR cp; + char xbuffer[10]; + + sprintf(xbuffer,"%08lx",(DWORD)languages[i].langid); + + cp = HEAP_strdupAtoW( GetProcessHeap(), 0, xbuffer ); ret = lpfnLocaleEnum(cp); HeapFree( GetProcessHeap(), 0, cp ); if (!ret) break; @@ -1767,13 +1841,28 @@ BOOL32 EnumSystemLocales32W( LOCALE_ENUMPROC32W lpfnLocaleEnum, DWORD flags ) BOOL32 EnumSystemLocales32A(LOCALE_ENUMPROC32A lpfnLocaleEnum,DWORD flags) { int i; + CHAR buffer[200]; + HKEY xhkey; dprintf_win32(stddeb,"EnumSystemLocales32A(%p,%08lx)\n", lpfnLocaleEnum,flags ); + if (ERROR_SUCCESS==RegOpenKey32A(HKEY_LOCAL_MACHINE,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\",&xhkey)) { + i=0; + while (1) { + if (ERROR_SUCCESS!=RegEnumKey32A(xhkey,i,buffer,sizeof(buffer))) + break; + if (!lpfnLocaleEnum(buffer)) + break; + i++; + } + RegCloseKey(xhkey); + return TRUE; + } i=0; - while (locale_name2id[i].name!=NULL) { - if (!lpfnLocaleEnum(locale_name2id[i].name)) + while (languages[i].langname!=NULL) { + sprintf(buffer,"%08lx",(DWORD)languages[i].langid); + if (!lpfnLocaleEnum(buffer)) break; i++; } @@ -1821,7 +1910,9 @@ GetStringTypeEx32A(LCID locale,DWORD dwInfoType,LPCSTR src,INT32 cchSrc,LPWORD c if (isspace(src[i])) chartype[i]|=C1_SPACE; if (ispunct(src[i])) chartype[i]|=C1_PUNCT; if (iscntrl(src[i])) chartype[i]|=C1_CNTRL; - if (isblank(src[i])) chartype[i]|=C1_BLANK; +/* FIXME: isblank() is a GNU extension */ +/* if (isblank(src[i])) chartype[i]|=C1_BLANK; */ + if ((src[i] == ' ') || (src[i] == '\t')) chartype[i]|=C1_BLANK; /* C1_XDIGIT */ } return TRUE; @@ -1869,3 +1960,60 @@ GetStringTypeEx32W(LCID locale,DWORD dwInfoType,LPCWSTR src,INT32 cchSrc,LPWORD } return TRUE; } + +/* VerLanguageName [VER.10] */ +DWORD +VerLanguageName16(UINT16 langid,LPSTR langname,UINT16 langnamelen) { + int i; + char *buf; + + dprintf_ver(stddeb,"VerLanguageName(%d,%p,%d)\n",langid,langname,langnamelen); + /* First, check \System\CurrentControlSet\control\Nls\Locale\ + * from the registry. + */ + buf=(char*)malloc(strlen("\\System\\CurrentControlSet\\control\\Nls\\Locale\\")+9); + sprintf(buf,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\%08x",langid); + if (ERROR_SUCCESS==RegQueryValue16(HKEY_LOCAL_MACHINE,buf,langname,(LPDWORD)&langnamelen)) { + langname[langnamelen-1]='\0'; + return langnamelen; + } + /* if that fails, use the interal table */ + for (i=0;languages[i].langid!=0;i++) + if (langid==languages[i].langid) + break; + strncpy(langname,languages[i].langname,langnamelen); + langname[langnamelen-1]='\0'; + return strlen(languages[i].langname); +} + +/* VerLanguageNameA [VERSION.9] */ +DWORD +VerLanguageName32A(UINT32 langid,LPSTR langname,UINT32 langnamelen) { + return VerLanguageName16(langid,langname,langnamelen); +} + +/* VerLanguageNameW [VERSION.10] */ +DWORD +VerLanguageName32W(UINT32 langid,LPWSTR langname,UINT32 langnamelen) { + int i; + char buffer[80]; + LPWSTR keyname; + + /* First, check \System\CurrentControlSet\control\Nls\Locale\ + * from the registry. + */ + sprintf(buffer,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\%08x",langid); + keyname = HEAP_strdupAtoW( GetProcessHeap(), 0, buffer ); + if (ERROR_SUCCESS==RegQueryValue32W(HKEY_LOCAL_MACHINE,keyname,langname,(LPDWORD)&langnamelen)) { + HeapFree( GetProcessHeap(), 0, keyname ); + return langnamelen; + } + HeapFree( GetProcessHeap(), 0, keyname ); + /* if that fails, use the interal table */ + for (i=0;languages[i].langid!=0;i++) + if (langid==languages[i].langid) + break; + lstrcpyAtoW( langname, languages[i].langname ); + return strlen(languages[i].langname); /* same as strlenW(langname); */ +} + diff --git a/misc/tweak.c b/misc/tweak.c new file mode 100644 index 00000000000..a9118d5c39c --- /dev/null +++ b/misc/tweak.c @@ -0,0 +1,456 @@ +/****************************************************************************** + * + * tweak.c + * + * Windows 95 style interface tweaks. + * Copyright (c) 1997 Dave Cuthbert. + * + * FIXME: This file is, unfortunately, aptly named: the method of + * displaying Win95 style windows is a tweak. Lots of stuff does not yet + * work -- and probably never will unless some of this code is + * incorporated into the mainstream Wine code. + * + * DEVELOPERS, PLEASE NOTE: Before delving into the mainstream code and + * altering it, consider how your changes will affect the Win3.1 interface + * (which has taken a major effort to create!). After you make any sort of + * non-trivial change, *test* the Wine code running in Win3.1 mode! The + * object here is to make it so that the person who tests the latest version + * of Wine without adding the tweaks into wine.conf notices nothing out of + * the ordinary. + * + * Revision history + * 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +#include +#include +#include +#include +#include "dc.h" +#include "debug.h" +#include "graphics.h" +#include "options.h" +#include "stackframe.h" +#include "syscolor.h" +#include "tweak.h" +#include "windows.h" + +/* Parameters for windows/nonclient.c */ +extern int NC_CaptionLeftNudge; +extern int NC_CaptionTopNudge; +extern int NC_SysControlNudge; +extern int NC_MaxControlNudge; +extern int NC_MinControlNudge; +extern UINT32 NC_CaptionTextFlags; +extern HBRUSH32 NC_WinHighlight95; +extern HBRUSH32 NC_WinShadow95; + +/* Parameters for controls/menu.c */ +extern UINT32 MENU_BarItemTopNudge; +extern UINT32 MENU_BarItemLeftNudge; +extern UINT32 MENU_ItemTopNudge; +extern UINT32 MENU_ItemLeftNudge; +extern UINT32 MENU_HighlightTopNudge; +extern UINT32 MENU_HighlightLeftNudge; +extern UINT32 MENU_HighlightBottomNudge; +extern UINT32 MENU_HighlightRightNudge; + +/* General options */ +HPEN32 TWEAK_PenFF95; +HPEN32 TWEAK_PenE095; +HPEN32 TWEAK_PenC095; +HPEN32 TWEAK_Pen8095; +HPEN32 TWEAK_Pen0095; + +#if defined(WIN_95_LOOK) +int TWEAK_Win95Look = 1; +#else +int TWEAK_Win95Look = 0; +#endif + +int TWEAK_WineInitialized = 0; + + +/****************************************************************************** + * + * int TWEAK_MenuInit() + * + * Initializes the Win95 tweaks to the menu code. See controls/menu.c. + * Return value indicates success (non-zero) or failure. + * + * Revision history + * 06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static int TWEAK_MenuInit() +{ + MENU_BarItemTopNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuBarItemTopNudge", 0); + MENU_BarItemLeftNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuBarItemLeftNudge", 0); + MENU_ItemTopNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuItemTopNudge", 0); + MENU_ItemLeftNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuItemLeftNudge", 0); + MENU_HighlightTopNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightTopNudge", 0); + MENU_HighlightLeftNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightLeftNudge", 0); + MENU_HighlightBottomNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightBottomNudge", 0); + MENU_HighlightRightNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightRightNudge", 0); + + return 1; +} + + +/****************************************************************************** + * + * int TWEAK_NonClientInit() + * + * Initializes the Win95 tweaks to the non-client drawing functions. See + * windows/nonclient.c. Return value indicates success (non-zero) or + * failure. + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static int TWEAK_NonClientInit() +{ + char key_value[2]; + + NC_CaptionLeftNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "CaptionLeftNudge", 0); + NC_CaptionTopNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "CaptionTopNudge", 0); + NC_SysControlNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "SysControlNudge", 0); + NC_MaxControlNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MaxControlNudge", 0); + NC_MinControlNudge = + PROFILE_GetWineIniInt("Tweak.Layout", "MinControlNudge", 0); + + NC_WinHighlight95 = CreateSolidBrush32(RGB(0xc0, 0xc0, 0xc0)); + NC_WinShadow95 = CreateSolidBrush32(RGB(0x00, 0x00, 0x00)); + + NC_CaptionTextFlags = DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX; + + PROFILE_GetWineIniString("Tweak.Layout", "CaptionAlignment", + TWEAK_Win95Look ? "l" : "c", key_value, 2); + + switch(key_value[0]) { + case 'l': + case 'L': + NC_CaptionTextFlags |= DT_LEFT; + break; + + case 'r': + case 'R': + NC_CaptionTextFlags |= DT_RIGHT; + break; + + default: + NC_CaptionTextFlags |= DT_CENTER; + } + + return 1; +} + + +/****************************************************************************** + * + * int TWEAK_VarInit() + * + * Initializes the miscellaneous variables which are used in the tweak + * routines. Return value is non-zero on success. + * + * Revision history + * 07-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static int TWEAK_VarInit() +{ + TWEAK_Win95Look = PROFILE_GetWineIniBool("Tweak.Layout", "Win95Look", 0); + + /* FIXME: Each color should really occupy a single entry in the wine.conf + file, but I couldn't settle on a good (intuitive!) format. */ + + TWEAK_PenFF95 = CreatePen32( + PS_SOLID, 1, + RGB(PROFILE_GetWineIniInt("Tweak.Colors", "PenFF95.Red", 0xff), + PROFILE_GetWineIniInt("Tweak.Colors", "PenFF95.Grn", 0xff), + PROFILE_GetWineIniInt("Tweak.Colors", "PenFF95.Blu", 0xff))); + TWEAK_PenE095 = CreatePen32( + PS_SOLID, 1, + RGB(PROFILE_GetWineIniInt("Tweak.Colors", "PenE095.Red", 0xe0), + PROFILE_GetWineIniInt("Tweak.Colors", "PenE095.Grn", 0xe0), + PROFILE_GetWineIniInt("Tweak.Colors", "PenE095.Blu", 0xe0))); + TWEAK_PenC095 = CreatePen32( + PS_SOLID, 1, + RGB(PROFILE_GetWineIniInt("Tweak.Colors", "PenC095.Red", 0xc0), + PROFILE_GetWineIniInt("Tweak.Colors", "PenC095.Grn", 0xc0), + PROFILE_GetWineIniInt("Tweak.Colors", "PenC095.Blu", 0xc0))); + TWEAK_Pen8095 = CreatePen32( + PS_SOLID, 1, + RGB(PROFILE_GetWineIniInt("Tweak.Colors", "Pen8095.Red", 0x80), + PROFILE_GetWineIniInt("Tweak.Colors", "Pen8095.Grn", 0x80), + PROFILE_GetWineIniInt("Tweak.Colors", "Pen8095.Blu", 0x80))); + TWEAK_Pen0095 = CreatePen32( + PS_SOLID, 1, + RGB(PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Red", 0x00), + PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Grn", 0x00), + PROFILE_GetWineIniInt("Tweak.Colors", "Pen0095.Blu", 0x00))); + + dprintf_tweak(stddeb, "TWEAK_VarInit: Using %s look and feel.\n", + TWEAK_Win95Look ? "Win95" : "Win3.1"); + return 1; +} + + +/****************************************************************************** + * + * int TWEAK_Init() + * + * Does the full initialization of the Win95 tweak subsystem. Return value + * indicates success. Called by loader/main.c's MAIN_Init(). + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +int TWEAK_Init() +{ + TWEAK_VarInit(); + TWEAK_NonClientInit(); + TWEAK_MenuInit(); + return 1; +} + + +/****************************************************************************** + * + * int TWEAK_CheckOldFonts() + * + * Examines wine.conf for old/invalid font entries and recommend changes to + * the user. + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static void TWEAK_CheckOldFontsCallback(char const *, char const *, void *); + +static char const *fontmsgprologue = +"Wine warning:\n" +" The following entries in the [fonts] section of the wine.conf file are\n" +" obsolete or invalid:\n"; + +static char const *fontmsgepilogue = +" These entries should be eliminated or updated.\n" +" See the documentation/fonts file for more information.\n"; + +static int TWEAK_CheckOldFonts() +{ + int found = 0; + + PROFILE_EnumerateWineIniSection("Fonts", &TWEAK_CheckOldFontsCallback, + (void *)&found); + if(found) + fprintf(stderr, fontmsgepilogue); + + return 1; +} + +static void TWEAK_CheckOldFontsCallback( + char const *key, + char const *value, + void *found) +{ + /* Ignore any keys that start with potential comment characters "'", '#', + or ';'. */ + if(key[0] == '\'' || key[0] == '#' || key[0] == ';' || key[0] == '\0') + return; + + /* Make sure this is a valid key */ + if(strncasecmp(key, "Alias", 5) == 0 || + strcasecmp(key, "Default") == 0) { + + /* Valid key; make sure the value doesn't contain a wildcard */ + if(strchr(value, '*')) { + if(*(int *)found == 0) { + fprintf(stderr, fontmsgprologue); + ++*(int *)found; + } + + fprintf(stderr, " %s=%s [no wildcards allowed]\n", key, value); + } + } + else { + /* Not a valid key */ + if(*(int *)found == 0) { + fprintf(stderr, fontmsgprologue); + ++*(int *)found; + } + + fprintf(stderr, " %s=%s [obsolete]\n", key, value); + } + + return; +} + + +/****************************************************************************** + * + * int TWEAK_CheckConfiguration() + * + * Examines wine.conf for old/bad entries and recommends changes to the user. + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +int TWEAK_CheckConfiguration() +{ + TWEAK_CheckOldFonts(); + return 1; +} + + + +/****************************************************************************** + * + * Tweak graphic subsystem. + * + *****************************************************************************/ + +/****************************************************************************** + * + * void TWEAK_DrawReliefRect95( + * HDC32 hdc, // Device context on which to draw + * RECT32 const *rect ) // Rectangle to use + * + * Draws the double-bordered Win95-style relief rectangle. + * + * Bugs + * There are some checks missing from this function. Perhaps the + * SelectObject32 calls should be examined? Hasn't failed on me (yet). + * + * Should I really be calling X functions directly from here? It is + * an optimization, but should I be optimizing alpha code? Probably + * not. + * + * Revision history + * 08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +void TWEAK_DrawReliefRect95( + HDC32 hdc, + RECT32 const *rect ) +{ + DC *dc; + HPEN32 prevpen; + + if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) { + + /* Draw the top/left lines first */ + prevpen = SelectObject32(hdc, TWEAK_PenE095); + DC_SetupGCForPen(dc); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top, + rect->right - 1, rect->top); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top, + rect->left, rect->bottom - 1); + + SelectObject32(hdc, TWEAK_PenFF95); + DC_SetupGCForPen(dc); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1, + rect->top + 1, rect->right - 2, rect->top + 1); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1, + rect->top + 1, rect->left + 1, rect->bottom - 2); + + + /* Now the bottom/right lines */ + SelectObject32(hdc, TWEAK_Pen0095); + DC_SetupGCForPen(dc); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, + rect->bottom - 1, rect->right - 1, rect->bottom - 1); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 1, + rect->top, rect->right - 1, rect->bottom - 1); + + SelectObject32(hdc, TWEAK_Pen8095); + DC_SetupGCForPen(dc); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1, + rect->bottom - 2, rect->right - 2, rect->bottom - 2); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 2, + rect->top + 1, rect->right - 2, rect->bottom - 2); + + SelectObject32(hdc, prevpen); + } + + return; +} + + +/****************************************************************************** + * + * void TWEAK_DrawMenuSeparator95( + * HDC32 hdc, // Device context on which to draw + * UINT32 xc1, // Left x-coordinate + * UINT32 yc, // Y-coordinate of the LOWER line + * UINT32 xc2 ) // Right x-coordinate + * + * Draws the menu separator bar Win 95 style. + * + * Bugs + * Same as those for DrawReliefRect95. + * + * Revision history + * 08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +void TWEAK_DrawMenuSeparator95( + HDC32 hdc, + UINT32 xc1, + UINT32 yc, + UINT32 xc2 ) +{ + DC *dc; + HPEN32 prevpen; + + if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) { + + /* Draw the top line */ + prevpen = SelectObject32(hdc, TWEAK_Pen8095); + DC_SetupGCForPen(dc); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc1, yc - 1, xc2, + yc - 1); + + /* And the bottom line */ + SelectObject32(hdc, TWEAK_PenFF95); + DC_SetupGCForPen(dc); + XDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc1, yc, xc2, yc); + + SelectObject32(hdc, prevpen); + } + + return; +} diff --git a/misc/ver.c b/misc/ver.c index 70690b8125a..51b9089f641 100644 --- a/misc/ver.c +++ b/misc/ver.c @@ -27,7 +27,7 @@ /****************************************************************************** * - * void dprintf_ver_string( + * void ver_dstring( * char const * prologue, * char const * teststring, * char const * epilogue ) @@ -39,11 +39,14 @@ * * Revision history * 30-May-1997 Dave Cuthbert (dacut@ece.cmu.edu) - * Original implementation + * Original implementation as dprintf[_]ver_string + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Fixed problem that caused bug with tools/make_debug -- renaming + * this function should fix the problem. * *****************************************************************************/ -static void dprintf_ver_string( +static void ver_dstring( char const * prologue, char const * teststring, char const * epilogue ) @@ -557,9 +560,9 @@ DWORD VerFindFile16( else dprintf_ver(stddeb, "\n"); - dprintf_ver_string("\tlpszFilename = ", lpszFilename, "\n"); - dprintf_ver_string("\tlpszWinDir = ", lpszWinDir, "\n"); - dprintf_ver_string("\tlpszAppDir = ", lpszAppDir, "\n"); + ver_dstring("\tlpszFilename = ", lpszFilename, "\n"); + ver_dstring("\tlpszWinDir = ", lpszWinDir, "\n"); + ver_dstring("\tlpszAppDir = ", lpszAppDir, "\n"); dprintf_ver(stddeb, "\tlpszCurDir = %p\n", lpszCurDir); if(lpuCurDirLen) @@ -674,14 +677,14 @@ DWORD VerFindFile16( dprintf_ver(stddeb, ")"); } - dprintf_ver_string("\n\t(Exit) lpszCurDir = ", lpszCurDir, "\n"); + ver_dstring("\n\t(Exit) lpszCurDir = ", lpszCurDir, "\n"); if(lpuCurDirLen) dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = %p (%u)\n", lpuCurDirLen, *lpuCurDirLen); else dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = (null)\n"); - dprintf_ver_string("\t(Exit) lpszDestDir = ", lpszDestDir, "\n"); + ver_dstring("\t(Exit) lpszDestDir = ", lpszDestDir, "\n"); if(lpuDestDirLen) dprintf_ver(stddeb, "\t(Exit) lpuDestDirLen = %p (%u)\n", lpuDestDirLen, *lpuDestDirLen); @@ -972,114 +975,6 @@ VerInstallFile32W( return ret; } -/* FIXME: This table should, of course, be language dependend */ -static const struct map_id2str { - UINT16 langid; - const char *langname; -} languages[]={ - {0x0401,"Arabisch"}, - {0x0402,"Bulgarisch"}, - {0x0403,"Katalanisch"}, - {0x0404,"Traditionales Chinesisch"}, - {0x0405,"Tschecisch"}, - {0x0406,"Dänisch"}, - {0x0407,"Deutsch"}, - {0x0408,"Griechisch"}, - {0x0409,"Amerikanisches Englisch"}, - {0x040A,"Kastilisches Spanisch"}, - {0x040B,"Finnisch"}, - {0x040C,"Französisch"}, - {0x040D,"Hebräisch"}, - {0x040E,"Ungarisch"}, - {0x040F,"Isländisch"}, - {0x0410,"Italienisch"}, - {0x0411,"Japanisch"}, - {0x0412,"Koreanisch"}, - {0x0413,"Niederländisch"}, - {0x0414,"Norwegisch-Bokmal"}, - {0x0415,"Polnisch"}, - {0x0416,"Brasilianisches Portugiesisch"}, - {0x0417,"Rätoromanisch"}, - {0x0418,"Rumänisch"}, - {0x0419,"Russisch"}, - {0x041A,"Kroatoserbisch (lateinisch)"}, - {0x041B,"Slowenisch"}, - {0x041C,"Albanisch"}, - {0x041D,"Schwedisch"}, - {0x041E,"Thai"}, - {0x041F,"Türkisch"}, - {0x0420,"Urdu"}, - {0x0421,"Bahasa"}, - {0x0804,"Vereinfachtes Chinesisch"}, - {0x0807,"Schweizerdeutsch"}, - {0x0809,"Britisches Englisch"}, - {0x080A,"Mexikanisches Spanisch"}, - {0x080C,"Belgisches Französisch"}, - {0x0810,"Schweizerisches Italienisch"}, - {0x0813,"Belgisches Niederländisch"}, - {0x0814,"Norgwegisch-Nynorsk"}, - {0x0816,"Portugiesisch"}, - {0x081A,"Serbokratisch (kyrillisch)"}, - {0x0C1C,"Kanadisches Französisch"}, - {0x100C,"Schweizerisches Französisch"}, - {0x0000,"Unbekannt"}, -}; - -/* VerLanguageName [VER.10] */ -DWORD -VerLanguageName16(UINT16 langid,LPSTR langname,UINT16 langnamelen) { - int i; - char *buf; - - dprintf_ver(stddeb,"VerLanguageName(%d,%p,%d)\n",langid,langname,langnamelen); - /* First, check \System\CurrentControlSet\control\Nls\Locale\ - * from the registry. - */ - buf=(char*)malloc(strlen("\\System\\CurrentControlSet\\control\\Nls\\Locale\\")+9); - sprintf(buf,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\%08x",langid); - if (ERROR_SUCCESS==RegQueryValue16(HKEY_LOCAL_MACHINE,buf,langname,(LPDWORD)&langnamelen)) { - langname[langnamelen-1]='\0'; - return langnamelen; - } - /* if that fails, use the interal table */ - for (i=0;languages[i].langid!=0;i++) - if (langid==languages[i].langid) - break; - strncpy(langname,languages[i].langname,langnamelen); - langname[langnamelen-1]='\0'; - return strlen(languages[i].langname); -} - -/* VerLanguageNameA [VERSION.9] */ -DWORD -VerLanguageName32A(UINT32 langid,LPSTR langname,UINT32 langnamelen) { - return VerLanguageName16(langid,langname,langnamelen); -} - -/* VerLanguageNameW [VERSION.10] */ -DWORD -VerLanguageName32W(UINT32 langid,LPWSTR langname,UINT32 langnamelen) { - int i; - char buffer[80]; - LPWSTR keyname; - - /* First, check \System\CurrentControlSet\control\Nls\Locale\ - * from the registry. - */ - sprintf(buffer,"\\System\\CurrentControlSet\\control\\Nls\\Locale\\%08x",langid); - keyname = HEAP_strdupAtoW( GetProcessHeap(), 0, buffer ); - if (ERROR_SUCCESS==RegQueryValue32W(HKEY_LOCAL_MACHINE,keyname,langname,(LPDWORD)&langnamelen)) { - HeapFree( GetProcessHeap(), 0, keyname ); - return langnamelen; - } - HeapFree( GetProcessHeap(), 0, keyname ); - /* if that fails, use the interal table */ - for (i=0;languages[i].langid!=0;i++) - if (langid==languages[i].langid) - break; - lstrcpyAtoW( langname, languages[i].langname ); - return strlen(languages[i].langname); /* same as strlenW(langname); */ -} /* FIXME: UNICODE? */ struct db { diff --git a/misc/winsock.c b/misc/winsock.c index 7f4c314f39f..e4ecd51b503 100644 --- a/misc/winsock.c +++ b/misc/winsock.c @@ -267,6 +267,8 @@ INT16 WSAStartup(UINT16 wVersionRequested, LPWSADATA lpWSAData) "SunOS", #elif defined(__FreeBSD__) "FreeBSD", + #elif defined(__OpenBSD__) + "OpenBSD/i386", #else "Unknown", #endif diff --git a/msdos/int21.c b/msdos/int21.c index 4af3a539597..d81368275bc 100644 --- a/msdos/int21.c +++ b/msdos/int21.c @@ -843,52 +843,31 @@ static void RenameFileFCB( CONTEXT *context ) static void fLock( CONTEXT * context ) { -#if 0 - struct flock f; - int result,retries=sharing_retries; - - f.l_start = MAKELONG(DX_reg(context),CX_reg(context)); - f.l_len = MAKELONG(DI_reg(context),SI_reg(context)); - f.l_whence = 0; - f.l_pid = 0; switch ( AX_reg(context) & 0xff ) { case 0x00: /* LOCK */ - f.l_type = F_WRLCK; + if (!LockFile(BX_reg(context), + MAKELONG(DX_reg(context),CX_reg(context)), 0, + MAKELONG(DI_reg(context),SI_reg(context)), 0)) { + AX_reg(context) = DOS_ExtendedError; + SET_CFLAG(context); + } break; case 0x01: /* UNLOCK */ - f.l_type = F_UNLCK; - break; - + if (!UnlockFile(BX_reg(context), + MAKELONG(DX_reg(context),CX_reg(context)), 0, + MAKELONG(DI_reg(context),SI_reg(context)), 0)) { + AX_reg(context) = DOS_ExtendedError; + SET_CFLAG(context); + } + return; default: AX_reg(context) = 0x0001; SET_CFLAG(context); return; } - - { - result = fcntl(BX_reg(context),F_SETLK,&f); - if ( retries && (!result) ) - { - int i; - for(i=0;i<32768*((int)sharing_pause);i++) - result++; /* stop the optimizer */ - for(i=0;i<32768*((int)sharing_pause);i++) - result--; - } - } - while( (!result) && (!(retries--)) ); - - if(result) - { - FILE_SetDosError(); - AX_reg(context) = DOS_ExtendedError; - SET_CFLAG(context); - return; - } -#endif } diff --git a/msdos/ioports.c b/msdos/ioports.c index e33487af702..4c9ebf942cd 100644 --- a/msdos/ioports.c +++ b/msdos/ioports.c @@ -197,7 +197,7 @@ DWORD IO_inport( int port, int count ) #ifdef linux if (do_direct_port_access) iopl(0); #endif - dprintf_int(stddeb, "( 0x%x )\n", res ); + dprintf_int(stddeb, "( 0x%lx )\n", res ); return res; } diff --git a/multimedia/mcistring.c b/multimedia/mcistring.c index 36d33896c52..1624ee383df 100644 --- a/multimedia/mcistring.c +++ b/multimedia/mcistring.c @@ -2149,7 +2149,8 @@ DWORD mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString, } dwFlags = 0; /* default flags */ for (i=0;ilogpalette.palPalEntry; - for (i = 0; i < info->bmiHeader.biClrUsed; i++, palEntry++) - { - if (coloruse == DIB_RGB_COLORS) + if (info->bmiHeader.biBitCount<=8) { + palEntry = palette->logpalette.palPalEntry; + for (i = 0; i < info->bmiHeader.biClrUsed; i++, palEntry++) { - info->bmiColors[i].rgbRed = palEntry->peRed; - info->bmiColors[i].rgbGreen = palEntry->peGreen; - info->bmiColors[i].rgbBlue = palEntry->peBlue; - info->bmiColors[i].rgbReserved = 0; + if (coloruse == DIB_RGB_COLORS) + { + info->bmiColors[i].rgbRed = palEntry->peRed; + info->bmiColors[i].rgbGreen = palEntry->peGreen; + info->bmiColors[i].rgbBlue = palEntry->peBlue; + info->bmiColors[i].rgbReserved = 0; + } + else ((WORD *)info->bmiColors)[i] = (WORD)i; } - else ((WORD *)info->bmiColors)[i] = (WORD)i; } if (bits) diff --git a/objects/gdiobj.c b/objects/gdiobj.c index 813fa6f1540..3d594353d40 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -12,6 +12,7 @@ #include "dc.h" #include "font.h" #include "heap.h" +#include "options.h" #include "palette.h" #include "pen.h" #include "region.h" @@ -150,6 +151,60 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] = (GDIOBJHDR *) &SystemFixedFont }; +/****************************************************************************** + * + * void ReadFontInformation( + * char const *fontName, + * FONTOBJ *font, + * int defHeight, + * int defBold, + * int defItalic, + * int defUnderline, + * int defStrikeOut ) + * + * ReadFontInformation() checks the Wine configuration file's Tweak.Fonts + * section for entries containing fontName.Height, fontName.Bold, etc., + * where fontName is the name specified in the call (e.g., "System"). It + * attempts to be user friendly by accepting 'n', 'N', 'f', 'F', or '0' as + * the first character in the boolean attributes (bold, italic, and + * underline). + *****************************************************************************/ + +static void ReadFontInformation( + char const *fontName, + FONTOBJ *font, + int defHeight, + int defBold, + int defItalic, + int defUnderline, + int defStrikeOut ) +{ + char key[256]; + + sprintf(key, "%s.Height", fontName); + font->logfont.lfHeight = + PROFILE_GetWineIniInt("Tweak.Fonts", key, defHeight); + + sprintf(key, "%s.Bold", fontName); + font->logfont.lfWeight = + (PROFILE_GetWineIniBool("Tweak.Fonts", key, defBold)) ? + FW_BOLD : FW_NORMAL; + + sprintf(key, "%s.Italic", fontName); + font->logfont.lfItalic = + PROFILE_GetWineIniBool("Tweak.Fonts", key, defItalic); + + sprintf(key, "%s.Underline", fontName); + font->logfont.lfUnderline = + PROFILE_GetWineIniBool("Tweak.Fonts", key, defUnderline); + + sprintf(key, "%s.StrikeOut", fontName); + font->logfont.lfStrikeOut = + PROFILE_GetWineIniBool("Tweak.Fonts", key, defStrikeOut); + + return; +} + /*********************************************************************** * GDI_Init @@ -161,6 +216,13 @@ BOOL32 GDI_Init(void) extern BOOL32 X11DRV_Init(void); extern BOOL32 DIB_Init(void); + /* TWEAK: Initialize font hints */ + ReadFontInformation("OEMFixed", &OEMFixedFont, 12, 0, 0, 0, 0); + ReadFontInformation("AnsiFixed", &AnsiFixedFont, 12, 0, 0, 0, 0); + ReadFontInformation("AnsiVar", &AnsiVarFont, 12, 0, 0, 0, 0); + ReadFontInformation("System", &SystemFont, 16, 1, 0, 0, 0); + ReadFontInformation("SystemFixed", &SystemFixedFont, 12, 1, 0, 0, 0); + /* Initialize drivers */ DIB_Init(); /* always before X11DRV_Init() */ diff --git a/objects/oembitmap.c b/objects/oembitmap.c index 6fb8aabaa95..514cb78dace 100644 --- a/objects/oembitmap.c +++ b/objects/oembitmap.c @@ -16,6 +16,7 @@ #include "color.h" #include "cursoricon.h" #include "stddebug.h" +#include "tweak.h" #include "debug.h" #include "xmalloc.h" @@ -56,25 +57,23 @@ #include "bitmaps/obm_old_close" #include "bitmaps/obm_trtype" -#ifndef WIN_95_LOOK #include "bitmaps/obm_zoomd" #include "bitmaps/obm_reduced" #include "bitmaps/obm_zoom" #include "bitmaps/obm_reduce" #include "bitmaps/obm_close" -#else #include "bitmaps/obm_zoomd_95" #include "bitmaps/obm_reduced_95" #include "bitmaps/obm_zoom_95" #include "bitmaps/obm_reduce_95" #include "bitmaps/obm_close_95" #include "bitmaps/obm_closed_95" -#endif /* WIN_95_LOOK */ + #define OBM_FIRST OBM_TRTYPE /* First OEM bitmap */ #define OBM_LAST OBM_OLD_CLOSE /* Last OEM bitmap */ -static const struct +static struct { char** data; /* Pointer to bitmap data */ BOOL32 color; /* Is it a color bitmap? */ @@ -96,30 +95,16 @@ static const struct { obm_dnarrowd, TRUE }, /* OBM_DNARROWD */ { obm_uparrowd, TRUE }, /* OBM_UPARROWD */ { obm_restored, TRUE }, /* OBM_RESTORED */ -#ifdef WIN_95_LOOK - { obm_zoomd_95, TRUE }, /* OBM_ZOOMD */ - { obm_reduced_95, TRUE }, /* OBM_REDUCED */ -#else { obm_zoomd, TRUE }, /* OBM_ZOOMD */ { obm_reduced, TRUE }, /* OBM_REDUCED */ -#endif { obm_restore, TRUE }, /* OBM_RESTORE */ -#ifdef WIN_95_LOOK - { obm_zoom_95, TRUE }, /* OBM_ZOOM */ - { obm_reduce_95, TRUE }, /* OBM_REDUCE */ -#else { obm_zoom, TRUE }, /* OBM_ZOOM */ { obm_reduce, TRUE }, /* OBM_REDUCE */ -#endif { obm_lfarrow, TRUE }, /* OBM_LFARROW */ { obm_rgarrow, TRUE }, /* OBM_RGARROW */ { obm_dnarrow, TRUE }, /* OBM_DNARROW */ { obm_uparrow, TRUE }, /* OBM_UPARROW */ -#ifdef WIN_95_LOOK - { obm_close_95, TRUE }, /* OBM_CLOSE */ -#else { obm_close, TRUE }, /* OBM_CLOSE */ -#endif { obm_old_restore, FALSE }, /* OBM_OLD_RESTORE */ { obm_old_zoom, FALSE }, /* OBM_OLD_ZOOM */ { obm_old_reduce, FALSE }, /* OBM_OLD_REDUCE */ @@ -309,8 +294,8 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height, if (!hbitmap) return 0; bmpObjPtr = (BITMAPOBJ *) GDI_HEAP_LIN_ADDR( hbitmap ); - bmpObjPtr->size.cx = 0; - bmpObjPtr->size.cy = 0; + bmpObjPtr->size.cx = width; + bmpObjPtr->size.cy = height; bmpObjPtr->pixmap = pixmap; bmpObjPtr->bitmap.bmType = 0; bmpObjPtr->bitmap.bmWidth = width; @@ -491,3 +476,29 @@ HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor ) if (fCursor) OBM_Cursors[id] = handle; return handle; } + + +/*********************************************************************** + * OBM_Init + * + * Initializes the OBM_Pixmaps_Data struct + */ +BOOL32 OBM_Init() +{ + if(TWEAK_Win95Look) { + OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd_95; + OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced_95; + OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom_95; + OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce_95; + OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close_95; + } + else { + OBM_Pixmaps_Data[OBM_ZOOMD - OBM_FIRST].data = obm_zoomd; + OBM_Pixmaps_Data[OBM_REDUCED - OBM_FIRST].data = obm_reduced; + OBM_Pixmaps_Data[OBM_ZOOM - OBM_FIRST].data = obm_zoom; + OBM_Pixmaps_Data[OBM_REDUCE - OBM_FIRST].data = obm_reduce; + OBM_Pixmaps_Data[OBM_CLOSE - OBM_FIRST].data = obm_close; + } + + return 1; +} diff --git a/programs/progman/ChangeLog b/programs/progman/ChangeLog index 4a78235a5ab..1a7c0726b1d 100644 --- a/programs/progman/ChangeLog +++ b/programs/progman/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 4 12:00:00 1997 Henrik Olsen + + * [Da.rc] (new) + Added Danish language support. + Tue Jun 3 07:34:26 1997 Marcel Baur * [Va.rc] (new) diff --git a/programs/progman/Da.rc b/programs/progman/Da.rc new file mode 100644 index 00000000000..8ddb8525f04 --- /dev/null +++ b/programs/progman/Da.rc @@ -0,0 +1,128 @@ +/* + * Program Manager + * + * Copyright 1997 Henrik Olsen + */ + +#define LANGUAGE_ID Da +#define LANGUAGE_NUMBER 6 +#define LANGUAGE_MENU_ITEM "&Dansk" + +/* Menu */ + +#define MENU_FILE "&Filer" +#define MENU_FILE_NEW "&Nyt programobjekt..." +#define MENU_FILE_OPEN "Å&bn\tEnter" +#define MENU_FILE_MOVE "&Flyt...\tF7" +#define MENU_FILE_COPY "K&opier...\tF8" +#define MENU_FILE_DELETE "&Slet\tDel" +#define MENU_FILE_ATTRIBUTES "&Programparametre...^IAlt+Enter" +#define MENU_FILE_EXECUTE "&Kør..." +#define MENU_FILE_EXIT "&Afslut Windows..." + +#define MENU_OPTIONS "&Indstillinger" +#define MENU_OPTIONS_AUTO_ARRANGE "&Arranger automatisk" +#define MENU_OPTIONS_MIN_ON_RUN "&Minimer ved brug" +#define MENU_OPTIONS_SAVE_SETTINGS "&Gem indstillinger ved afslutning" + +#define MENU_WINDOWS "&Vindue" +#define MENU_WINDOWS_OVERLAP "&Overlappet\tSkift+F5" +#define MENU_WINDOWS_SIDE_BY_SIDE "&Side om side\tSkift+F4" +#define MENU_WINDOWS_ARRANGE "&Arranger ikoner" + +#define MENU_LANGUAGE "&Sprog" + +#define MENU_HELP "&Hjælp" +#define MENU_HELP_CONTENTS "&Indhold" +#define MENU_HELP_SEARCH "&Søg efter hjælp om..." +#define MENU_HELP_HELP_ON_HELP "&Brug af Hjælp" +#define MENU_HELP_TUTORIAL "&Windows Selvstudium" + +#define MENU_INFO "&Om Programstyring..." +#define MENU_INFO_LICENSE "&Licens" +#define MENU_INFO_NO_WARRANTY "&NO WARRANTY" +#define MENU_INFO_ABOUT_WINE "&Om WINE" + +/* Dialogs */ + +#define DIALOG_OK "OK" +#define DIALOG_CANCEL "Annuller" +#define DIALOG_BROWSE "&Gennemse..." +#define DIALOG_HELP "&Help" + +#define DIALOG_NEW_CAPTION "Nyt programobject" +#define DIALOG_NEW_NEW "Nyt" +#define DIALOG_NEW_GROUP "Program &gruppe" +#define DIALOG_NEW_PROGRAM "&Program" + +#define DIALOG_MOVE_CAPTION "Flyt programelement" +#define DIALOG_MOVE_PROGRAM "Flyt elementet:" +#define DIALOG_MOVE_FROM_GROUP "Fra gruppen:" +#define DIALOG_MOVE_TO_GROUP "&Til gruppen:" + +#define DIALOG_COPY_CAPTION "Kopier programelement" +#define DIALOG_COPY_PROGRAM "Kopier elementet:" +#define DIALOG_COPY_FROM_GROUP DIALOG_MOVE_FROM_GROUP +#define DIALOG_COPY_TO_GROUP DIALOG_MOVE_TO_GROUP + +#define DIALOG_GROUP_CAPTION "Gruppeparametre" +#define DIALOG_GROUP_DESCRIPTION "&Beskrivelse:" +#define DIALOG_GROUP_FILE "&Gruppefil:" + +#define DIALOG_PROGRAM_CAPTION "Programparametre" +#define DIALOG_PROGRAM_DESCRIPTION DIALOG_GROUP_DESCRIPTION +#define DIALOG_PROGRAM_COMMAND_LINE "&Kommandolinje:" +#define DIALOG_PROGRAM_DIRECTORY "&Arbejdsbibliotek:" +#define DIALOG_PROGRAM_HOT_KEY "Genvejs&tast:" +#define DIALOG_PROGRAM_SYMBOL "Kør &minimeret" +#define DIALOG_PROGRAM_OTHER_SYMBOL "Skift &ikon..." + +#define DIALOG_SYMBOL_CAPTION "Skift ikon" +#define DIALOG_SYMBOL_FILE "&Filnavn:" +#define DIALOG_SYMBOL_CURRENT "&Nuværende ikon:" + +#define DIALOG_EXECUTE_CAPTION "Kør" +#define DIALOG_EXECUTE_COMMAND_LINE DIALOG_PROGRAM_COMMAND_LINE +#define DIALOG_EXECUTE_SYMBOL DIALOG_PROGRAM_SYMBOL + +/* Strings */ + +#define STRING_PROGRAM_MANAGER "Programstyring" +#define STRING_ERROR "FEJL" +#define STRING_WARNING "ADVARSEL" +#define STRING_INFO "Information" +#define STRING_DELETE "Slet" +#define STRING_DELETE_GROUP_s "Slet gruppe `%s' ?" +#define STRING_DELETE_PROGRAM_s "Slet program `%s' ?" +#define STRING_NOT_IMPLEMENTED "Ikke implementeret." +#define STRING_FILE_READ_ERROR_s "Kan ikke læse filen `%s'" +#define STRING_FILE_WRITE_ERROR_s "Kan ikke skrive filen `%s'" + +#define STRING_GRPFILE_READ_ERROR_s "\ +Kan ikke åbne gruppefilen '%s'.\n\ +Ønsker du, at Programstyring i fremtiden stadig skal prøve at indlæse den?" + +#define STRING_OUT_OF_MEMORY "\ +Der er ikke nok hukommelse til at udføre denne operation.\n\ +Afslut et eller flere aktive programmer for at frigøre hukommelse, \ +og prøv så igen." + +#define STRING_WINHELP_ERROR "\ +Kan ikke vise information fra Hjælp." + +#define STRING_UNKNOWN_FEATURE_s "Ukendt indhold i %s" +#define STRING_FILE_NOT_OVERWRITTEN_s "\ +Filen `%s' findes. Ikke overskrevet." + +#define STRING_SAVE_GROUP_AS_s "\ +Gem gruppen som `%s' for at undgå at overskrive originale filer" + +#define STRING_NO_HOT_KEY "Ingen" + +#define STRING_ALL_FILES "Alle filer (*.*)" +#define STRING_PROGRAMS "Programmer" +#define STRING_LIBRARIES_DLL "Biblioteksfiler (*.dll)" +#define STRING_SYMBOL_FILES "Ikonfiler" +#define STRING_SYMBOLS_ICO "Ikoner (*.ico)" + +#include "Xx.rc" diff --git a/programs/progman/Makefile.in b/programs/progman/Makefile.in index f7ecaebb092..a5d86f6d353 100644 --- a/programs/progman/Makefile.in +++ b/programs/progman/Makefile.in @@ -8,7 +8,7 @@ ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS) DEFS = -I$(SRCDIR) RCFLAGS = -w32 -LANGUAGES = En De Fr Fi Ko Hu It Va +LANGUAGES = En Da De Fr Fi Ko Hu It Va LICENSELANG = En # Installation infos diff --git a/programs/winhelp/ChangeLog b/programs/winhelp/ChangeLog index 63484af8e04..1780acb7726 100644 --- a/programs/winhelp/ChangeLog +++ b/programs/winhelp/ChangeLog @@ -1,3 +1,8 @@ +Fri Jul 4 12:00:00 1997 Henrik Olsen + + * [Da.rc] (new) + Added Danish language support. + Tue Jun 3 07:47:42 1997 Marcel Baur >", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&i",713,300,200,4,14 /* just a dummy: 'i' is like &i in "sol&id" */ } diff --git a/tools/build-spec.txt b/tools/build-spec.txt index 4c980a5a07e..64917f2eeb9 100644 --- a/tools/build-spec.txt +++ b/tools/build-spec.txt @@ -62,11 +62,12 @@ by the ordinal number corresponding to the function. - "word" - "long" - "ptr" (linear pointer) -- "str" (linear pointer to a string) +- "str" (linear pointer to a null-terminated string) - "s_byte" (signed byte) - "s_word" (signed word) - "s_long" (signed long) - "segptr" (segmented pointer). +- "segstr" (segmented pointer to a null-terminated string) Only "ptr", "str" and "long" are valid for Win32 functions. diff --git a/tools/build.c b/tools/build.c index c38785fc70c..6d028952c3e 100644 --- a/tools/build.c +++ b/tools/build.c @@ -372,6 +372,8 @@ static int ParseExportFunction( ORDDEF *odp ) odp->u.func.arg_types[i] = 'p'; else if (!strcmp(token, "str")) odp->u.func.arg_types[i] = 't'; + else if (!strcmp(token, "segstr")) + odp->u.func.arg_types[i] = 'T'; else { fprintf(stderr, "%d: Unknown variable type '%s'\n", Line, token); @@ -1437,14 +1439,15 @@ static int TransferArgs16To32( FILE *outfile, char *args ) pos16 += 2; break; - case 'l': /* long */ + case 'l': /* long or segmented pointer */ + case 'T': /* segmented pointer to null-terminated string */ fprintf( outfile, "\tmovl %d(%%ebp),%%eax\n", pos16 ); fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n", pos32 ); pos16 += 4; break; - case 'p': /* ptr */ - case 't': /* string */ + case 'p': /* linear pointer */ + case 't': /* linear pointer to null-terminated string */ /* Get the selector */ fprintf( outfile, "\tmovw %d(%%ebp),%%ax\n", pos16 + 2 ); /* Get the selector base */ @@ -1509,7 +1512,7 @@ static void BuildContext16( FILE *outfile ) fprintf( outfile, "\tpushfl\n" ); fprintf( outfile, "\tpopl %d(%%ebx)\n", CONTEXTOFFSET(EFlags) - sizeof(CONTEXT) ); - fprintf( outfile, "\tmovzwl 0(%%ebp),%%eax\n" ); /* Get %bp from stack */ + fprintf( outfile, "\tmovl -16(%%ebp),%%eax\n" ); /* Get %ebp from stack */ fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n", CONTEXTOFFSET(Ebp) - sizeof(CONTEXT) ); fprintf( outfile, "\tmovzwl 2(%%ebp),%%eax\n" ); /* Get %ip from stack */ @@ -1545,6 +1548,10 @@ static void RestoreContext16( FILE *outfile ) fprintf( outfile, "\tmovl " PREFIX "IF1632_Saved32_esp,%%ebx\n" ); + /* Remove everything up to the return address from the 16-bit stack */ + + fprintf( outfile, "\taddl $18,%%esp\n" ); + /* Restore the registers */ fprintf( outfile, "\tmovl %d(%%ebx),%%ecx\n", @@ -1555,8 +1562,8 @@ static void RestoreContext16( FILE *outfile ) CONTEXTOFFSET(Esi) - sizeof(CONTEXT) ); fprintf( outfile, "\tmovl %d(%%ebx),%%edi\n", CONTEXTOFFSET(Edi) - sizeof(CONTEXT) ); - fprintf( outfile, "\tpopl %%eax\n" ); /* Remove old ds and ip from stack */ - fprintf( outfile, "\tpopl %%eax\n" ); /* Remove old cs and es from stack */ + fprintf( outfile, "\tmovl %d(%%ebx),%%ebp\n", + CONTEXTOFFSET(Ebp) - sizeof(CONTEXT) ); fprintf( outfile, "\tpushw %d(%%ebx)\n", /* Push new ds */ CONTEXTOFFSET(SegDs) - sizeof(CONTEXT) ); fprintf( outfile, "\tpushw %d(%%ebx)\n", /* Push new es */ @@ -1568,6 +1575,8 @@ static void RestoreContext16( FILE *outfile ) CONTEXTOFFSET(Eax) - sizeof(CONTEXT) ); fprintf( outfile, "\tmovl %d(%%ebx),%%ebx\n", CONTEXTOFFSET(Ebx) - sizeof(CONTEXT) ); + fprintf( outfile, "\tpopw %%es\n" ); /* Set es */ + fprintf( outfile, "\tpopw %%ds\n" ); /* Set ds */ } @@ -1577,7 +1586,8 @@ static void RestoreContext16( FILE *outfile ) * Build a 16-bit-to-Wine callback function. The syntax of the function * profile is: type_xxxxx, where 'type' is one of 'regs', 'word' or * 'long' and each 'x' is an argument ('w'=word, 's'=signed word, - * 'l'=long, 'p'=pointer, 't'=string). + * 'l'=long, 'p'=linear pointer, 't'=linear pointer to null-terminated string, + * 'T'=segmented pointer to null-terminated string). * For register functions, the arguments are ignored, but they are still * removed from the stack upon return. * @@ -1587,12 +1597,16 @@ static void RestoreContext16( FILE *outfile ) * (sp+16) word cs * (sp+14) word ip * (sp+12) word bp - * (sp+8) long 32-bit entry point + * (sp+8) long 32-bit entry point (used to store edx) * (sp+6) word high word of cs (always 0, used to store es) * (sp+4) word low word of cs of 16-bit entry point * (sp+2) word high word of ip (always 0, used to store ds) * (sp) word low word of ip of 16-bit entry point * + * Added on the stack: + * (sp-4) long ebp + * (sp-6) word saved previous sp + * (sp-8) word saved previous ss */ static void BuildCallFrom16Func( FILE *outfile, char *profile ) { @@ -1623,8 +1637,9 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) /* Setup bp to point to its copy on the stack */ + fprintf( outfile, "\tpushl %%ebp\n" ); /* Save the full 32-bit ebp */ fprintf( outfile, "\tmovzwl %%sp,%%ebp\n" ); - fprintf( outfile, "\taddw $12,%%bp\n" ); + fprintf( outfile, "\taddw $16,%%bp\n" ); /* Save 16-bit ds and es */ @@ -1644,13 +1659,12 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) /* Save the 16-bit stack */ - fprintf( outfile, "\tpushw " PREFIX "IF1632_Saved16_sp\n" ); - fprintf( outfile, "\tpushw " PREFIX "IF1632_Saved16_ss\n" ); + fprintf( outfile, "\tpushl " PREFIX "IF1632_Saved16_ss_sp\n" ); #ifdef __svr4__ fprintf( outfile,"\tdata16\n"); #endif - fprintf( outfile, "\tmovw %%ss," PREFIX "IF1632_Saved16_ss\n" ); - fprintf( outfile, "\tmovw %%sp," PREFIX "IF1632_Saved16_sp\n" ); + fprintf( outfile, "\tmovw %%ss," PREFIX "IF1632_Saved16_ss_sp+2\n" ); + fprintf( outfile, "\tmovw %%sp," PREFIX "IF1632_Saved16_ss_sp\n" ); /* Transfer the arguments */ @@ -1713,22 +1727,12 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) #ifdef __svr4__ fprintf( outfile, "\tdata16\n"); #endif - fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_ss,%%ss\n" ); - fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_sp,%%sp\n" ); -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tpopw " PREFIX "IF1632_Saved16_ss\n" ); -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tpopw " PREFIX "IF1632_Saved16_sp\n" ); + fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_ss_sp+2,%%ss\n" ); + fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_ss_sp,%%sp\n" ); + fprintf( outfile, "\tpopl " PREFIX "IF1632_Saved16_ss_sp\n" ); if (reg_func) { - /* Restore registers from the context structure */ - RestoreContext16( outfile ); - /* Calc the arguments size */ while (*args) { @@ -1741,6 +1745,7 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) case 'p': case 't': case 'l': + case 'T': argsize += 4; break; default: @@ -1749,38 +1754,35 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) args++; } - /* Restore ds and es */ - fprintf( outfile, "\tpopw %%es\n" ); - fprintf( outfile, "\tpopw %%ds\n" ); - - /* Remove the entry point from the stack */ - /* (we don't use add to avoid modifying the carry flag) */ - fprintf( outfile, "\tpopl %%ebp\n" ); + /* Restore registers from the context structure */ + RestoreContext16( outfile ); } else { + /* Restore high 16 bits of ebp */ + fprintf( outfile, "\tpopl %%ebp\n" ); + /* Restore ds and es */ - fprintf( outfile, "\tpopw %%bp\n" ); /* Remove ip */ - fprintf( outfile, "\tpopl %%ebp\n" ); /* Remove ds and cs */ - fprintf( outfile, "\tmovw %%bp,%%ds\n" ); /* Restore ds */ + fprintf( outfile, "\tincl %%esp\n" ); /* Remove ip */ + fprintf( outfile, "\tincl %%esp\n" ); + fprintf( outfile, "\tpopl %%edx\n" ); /* Remove cs and ds */ + fprintf( outfile, "\tmovw %%dx,%%ds\n" ); /* and restore ds */ fprintf( outfile, "\tpopw %%es\n" ); /* Restore es */ if (short_ret) fprintf( outfile, "\tpopl %%edx\n" ); /* Restore edx */ else { /* Get the return value into dx:ax */ - fprintf( outfile, "\tpushl %%eax\n" ); - fprintf( outfile, "\tpopw %%ax\n" ); - fprintf( outfile, "\tpopw %%dx\n" ); + fprintf( outfile, "\tmovl %%eax,%%edx\n" ); + fprintf( outfile, "\tshrl $16,%%edx\n" ); /* Remove API entry point */ fprintf( outfile, "\taddl $4,%%esp\n" ); } + + /* Restore low 16 bits of ebp */ + fprintf( outfile, "\tpopw %%bp\n" ); } - /* Restore bp */ - - fprintf( outfile, "\tpopw %%bp\n" ); - /* Remove the arguments and return */ if (argsize) @@ -1882,8 +1884,8 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) #ifdef __svr4__ fprintf( outfile,"\tdata16\n"); #endif - fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_ss,%%ss\n" ); - fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_sp,%%sp\n" ); + fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_ss_sp+2,%%ss\n" ); + fprintf( outfile, "\tmovw " PREFIX "IF1632_Saved16_ss_sp,%%sp\n" ); /* Transfer the arguments */ @@ -1906,7 +1908,7 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) /* Make %bp point to the previous stackframe (built by CallFrom16) */ fprintf( outfile, "\tmovzwl %%sp,%%ebp\n" ); - fprintf( outfile, "\taddw $16,%%bp\n" ); + fprintf( outfile, "\taddw $20,%%bp\n" ); while (*args) { @@ -1918,6 +1920,9 @@ static void BuildCallTo16Func( FILE *outfile, char *profile ) case 'l': /* long */ fprintf( outfile, "\tpushl %d(%%ebx)\n", pos ); break; + default: + fprintf( stderr, "Unexpected case '%c' in BuildCallTo16Func\n", + args[-1] ); } pos += 4; } diff --git a/win32/file.c b/win32/file.c index 3bb4fed5e18..170c91a39ea 100644 --- a/win32/file.c +++ b/win32/file.c @@ -249,26 +249,3 @@ BOOL32 AreFileApisANSI() } -BOOL32 -LockFile( - HFILE32 hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh, - DWORD nNumberOfBytesToLockLow,DWORD nNumberOfBytesToLockHigh ) -{ - fprintf(stdnimp,"LockFile(%d,0x%08lx%08lx,0x%08lx%08lx),stub!\n", - hFile,dwFileOffsetHigh,dwFileOffsetLow, - nNumberOfBytesToLockHigh,nNumberOfBytesToLockLow - ); - return TRUE; -} - -BOOL32 -UnlockFile( - HFILE32 hFile,DWORD dwFileOffsetLow,DWORD dwFileOffsetHigh, - DWORD nNumberOfBytesToUnlockLow,DWORD nNumberOfBytesToUnlockHigh ) -{ - fprintf(stdnimp,"UnlockFile(%d,0x%08lx%08lx,0x%08lx%08lx),stub!\n", - hFile,dwFileOffsetHigh,dwFileOffsetLow, - nNumberOfBytesToUnlockHigh,nNumberOfBytesToUnlockLow - ); - return TRUE; -} diff --git a/windows/dce.c b/windows/dce.c index 92622b1b581..5e925f6b7ec 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -118,7 +118,7 @@ HWND32 WindowFromDC32( HDC32 hDC ) * It is called from SetWindowPos - we have to invalidate all busy * DCE's for windows whose client rect intersects with update rectangle */ -BOOL32 DCE_InvalidateDCE(WND* wndScope, RECT16* pRectUpdate) +BOOL32 DCE_InvalidateDCE(WND* wndScope, RECT32* pRectUpdate) { BOOL32 bRet = FALSE; DCE *dce; @@ -147,13 +147,14 @@ BOOL32 DCE_InvalidateDCE(WND* wndScope, RECT16* pRectUpdate) for( ; wnd ; wnd = wnd->parent ) if( wnd == wndScope ) { - RECT16 wndRect = wndCurrent->rectWindow; + RECT32 wndRect = wndCurrent->rectWindow; dprintf_dc(stddeb,"\tgot hwnd %04x\n", wndCurrent->hwndSelf); - MapWindowPoints16(wndCurrent->parent->hwndSelf, wndScope->hwndSelf, - (LPPOINT16)&wndRect, 2); - if( IntersectRect16(&wndRect,&wndRect,pRectUpdate) ) + MapWindowPoints32( wndCurrent->parent->hwndSelf, + wndScope->hwndSelf, + (LPPOINT32)&wndRect, 2 ); + if (IntersectRect32( &wndRect, &wndRect, pRectUpdate )) { SetHookFlags(dce->hDC, DCHF_INVALIDATEVISRGN); bRet = TRUE; @@ -188,7 +189,7 @@ void DCE_Init() * window area clipped by the client area of all ancestors. * Return FALSE if the visible region is empty. */ -static BOOL32 DCE_GetVisRect( WND *wndPtr, BOOL32 clientArea, RECT16 *lprect ) +static BOOL32 DCE_GetVisRect( WND *wndPtr, BOOL32 clientArea, RECT32 *lprect ) { int xoffset, yoffset; @@ -198,7 +199,7 @@ static BOOL32 DCE_GetVisRect( WND *wndPtr, BOOL32 clientArea, RECT16 *lprect ) if (!(wndPtr->dwStyle & WS_VISIBLE) || (wndPtr->flags & WIN_NO_REDRAW)) { - SetRectEmpty16( lprect ); /* Clip everything */ + SetRectEmpty32( lprect ); /* Clip everything */ return FALSE; } @@ -209,20 +210,20 @@ static BOOL32 DCE_GetVisRect( WND *wndPtr, BOOL32 clientArea, RECT16 *lprect ) (wndPtr->flags & WIN_NO_REDRAW) || (wndPtr->dwStyle & WS_ICONIC)) { - SetRectEmpty16( lprect ); /* Clip everything */ + SetRectEmpty32( lprect ); /* Clip everything */ return FALSE; } xoffset += wndPtr->rectClient.left; yoffset += wndPtr->rectClient.top; - OffsetRect16( lprect, wndPtr->rectClient.left, + OffsetRect32( lprect, wndPtr->rectClient.left, wndPtr->rectClient.top ); /* Warning!! we assume that IntersectRect() handles the case */ /* where the destination is the same as one of the sources. */ - if (!IntersectRect16( lprect, lprect, &wndPtr->rectClient )) + if (!IntersectRect32( lprect, lprect, &wndPtr->rectClient )) return FALSE; /* Visible rectangle is empty */ } - OffsetRect16( lprect, -xoffset, -yoffset ); + OffsetRect32( lprect, -xoffset, -yoffset ); return TRUE; } @@ -277,7 +278,7 @@ static HRGN32 DCE_ClipWindows( WND *pWndStart, WND *pWndEnd, */ HRGN32 DCE_GetVisRgn( HWND32 hwnd, WORD flags ) { - RECT16 rect; + RECT32 rect; HRGN32 hrgn; int xoffset, yoffset; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -289,7 +290,7 @@ HRGN32 DCE_GetVisRgn( HWND32 hwnd, WORD flags ) { return CreateRectRgn32( 0, 0, 0, 0 ); /* Visible region is empty */ } - if (!(hrgn = CreateRectRgnIndirect16( &rect ))) return 0; + if (!(hrgn = CreateRectRgnIndirect32( &rect ))) return 0; /* Clip all children from the visible region */ @@ -545,12 +546,12 @@ HDC32 GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags ) if( wndPtr->parent && wndPtr->window ) { WND* wnd = wndPtr->parent->child; - RECT16 rect; + RECT32 rect; for( ; wnd != wndPtr; wnd = wnd->next ) if( wnd->class->style & CS_SAVEBITS && wnd->dwStyle & WS_VISIBLE && - IntersectRect16(&rect, &wndPtr->rectClient, &wnd->rectClient) ) + IntersectRect32(&rect, &wndPtr->rectClient, &wnd->rectClient) ) wnd->flags |= WIN_SAVEUNDER_OVERRIDE; } diff --git a/windows/defwnd.c b/windows/defwnd.c index 850359ad72e..7b59447d1eb 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -380,7 +380,12 @@ LRESULT DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, break; case WM_NCCALCSIZE: - result = NC_HandleNCCalcSize(wndPtr, (RECT16 *)PTR_SEG_TO_LIN(lParam)); + { + RECT32 rect32; + CONV_RECT16TO32( (RECT16 *)PTR_SEG_TO_LIN(lParam), &rect32 ); + result = NC_HandleNCCalcSize( wndPtr, &rect32 ); + CONV_RECT32TO16( &rect32, (RECT16 *)PTR_SEG_TO_LIN(lParam) ); + } break; case WM_WINDOWPOSCHANGING: @@ -441,12 +446,7 @@ LRESULT DefWindowProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam, break; case WM_NCCALCSIZE: - { - RECT16 rect16; - CONV_RECT32TO16( (RECT32 *)lParam, &rect16 ); - result = NC_HandleNCCalcSize( wndPtr, &rect16 ); - CONV_RECT16TO32( &rect16, (RECT32 *)lParam ); - } + result = NC_HandleNCCalcSize( wndPtr, (RECT32 *)lParam ); break; case WM_WINDOWPOSCHANGING: diff --git a/windows/event.c b/windows/event.c index 42c8f34e318..dc5c2385390 100644 --- a/windows/event.c +++ b/windows/event.c @@ -697,32 +697,31 @@ static void EVENT_ConfigureNotify( HWND32 hwnd, XConfigureEvent *event ) else { WND *wndPtr = WIN_FindWndPtr( hwnd ); - WINDOWPOS16 *winpos; - RECT16 newWindowRect, newClientRect; + WINDOWPOS32 winpos; + RECT32 newWindowRect, newClientRect; HRGN32 hrgnOldPos, hrgnNewPos; Window above = event->above; - if (!wndPtr || !(wndPtr->flags & WIN_MANAGED) || - !(winpos = SEGPTR_NEW(WINDOWPOS16))) return; + if (!wndPtr || !(wndPtr->flags & WIN_MANAGED)) return; /* Fill WINDOWPOS struct */ - winpos->flags = SWP_NOACTIVATE | SWP_NOZORDER; - winpos->hwnd = hwnd; - winpos->x = event->x; - winpos->y = event->y; - winpos->cx = event->width; - winpos->cy = event->height; + winpos.flags = SWP_NOACTIVATE | SWP_NOZORDER; + winpos.hwnd = hwnd; + winpos.x = event->x; + winpos.y = event->y; + winpos.cx = event->width; + winpos.cy = event->height; /* Check for unchanged attributes */ - if(winpos->x == wndPtr->rectWindow.left && - winpos->y == wndPtr->rectWindow.top) - winpos->flags |= SWP_NOMOVE; - if(winpos->cx == wndPtr->rectWindow.right - wndPtr->rectWindow.left && - winpos->cy == wndPtr->rectWindow.bottom - wndPtr->rectWindow.top) - winpos->flags |= SWP_NOSIZE; + if(winpos.x == wndPtr->rectWindow.left && + winpos.y == wndPtr->rectWindow.top) + winpos.flags |= SWP_NOMOVE; + if(winpos.cx == wndPtr->rectWindow.right - wndPtr->rectWindow.left && + winpos.cy == wndPtr->rectWindow.bottom - wndPtr->rectWindow.top) + winpos.flags |= SWP_NOSIZE; /* Send WM_WINDOWPOSCHANGING */ - SendMessage16(hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)SEGPTR_GET(winpos)); + SendMessage32A( hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)&winpos ); /* Calculate new position and size */ newWindowRect.left = event->x; @@ -730,20 +729,18 @@ static void EVENT_ConfigureNotify( HWND32 hwnd, XConfigureEvent *event ) newWindowRect.top = event->y; newWindowRect.bottom = event->y + event->height; - WINPOS_SendNCCalcSize( winpos->hwnd, TRUE, &newWindowRect, - &wndPtr->rectWindow, &wndPtr->rectClient, - SEGPTR_GET(winpos), &newClientRect ); + WINPOS_SendNCCalcSize( winpos.hwnd, TRUE, &newWindowRect, + &wndPtr->rectWindow, &wndPtr->rectClient, + &winpos, &newClientRect ); - hrgnOldPos = CreateRectRgnIndirect16( &wndPtr->rectWindow ); - hrgnNewPos = CreateRectRgnIndirect16( &newWindowRect ); + hrgnOldPos = CreateRectRgnIndirect32( &wndPtr->rectWindow ); + hrgnNewPos = CreateRectRgnIndirect32( &newWindowRect ); CombineRgn32( hrgnOldPos, hrgnOldPos, hrgnNewPos, RGN_DIFF ); /* Set new size and position */ wndPtr->rectWindow = newWindowRect; wndPtr->rectClient = newClientRect; - SendMessage16( hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)SEGPTR_GET(winpos)); - - SEGPTR_FREE(winpos); + SendMessage32A( hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&winpos ); if( IsWindow32( hwnd ) ) if( above == None ) /* absolute bottom */ diff --git a/windows/graphics.c b/windows/graphics.c index 44aa69fc7e6..a11404b1101 100644 --- a/windows/graphics.c +++ b/windows/graphics.c @@ -121,6 +121,33 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, */ void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, INT32 shadow_size, BOOL32 pressed ) +{ + if(pressed) + GRAPH_DrawGenericReliefRect(hdc, rect, highlight_size, shadow_size, + sysColorObjects.hbrushBtnShadow, + sysColorObjects.hbrushBtnHighlight); + else + GRAPH_DrawGenericReliefRect(hdc, rect, highlight_size, shadow_size, + sysColorObjects.hbrushBtnHighlight, + sysColorObjects.hbrushBtnShadow); + + return; +} + + +/****************************************************************************** + * GRAPH_DrawGenericReliefRect + * + * Creates a rectangle with the specified highlight and shadow colors. + * Adapted from DrawReliefRect (which is somewhat misnamed). + */ +void GRAPH_DrawGenericReliefRect( + HDC32 hdc, + const RECT32 *rect, + INT32 highlight_size, + INT32 shadow_size, + HBRUSH32 highlight, + HBRUSH32 shadow ) { DC* dc; HBRUSH32 hPrevBrush; @@ -132,8 +159,8 @@ void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, 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 ); + hPrevBrush = SelectObject32(hdc, highlight); + if ( DC_SetupGCForBrush( dc ) ) { INT32 i; @@ -148,8 +175,7 @@ void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, } } - SelectObject32( hdc, pressed ? sysColorObjects.hbrushBtnHighlight : - sysColorObjects.hbrushBtnShadow ); + SelectObject32( hdc, shadow ); if ( DC_SetupGCForBrush( dc ) ) { INT32 i; @@ -167,6 +193,8 @@ void GRAPH_DrawReliefRect( HDC32 hdc, const RECT32 *rect, INT32 highlight_size, SelectObject32( hdc, hPrevBrush ); } + + /********************************************************************** * GRAPH_DrawRectangle */ diff --git a/windows/hook.c b/windows/hook.c index 848d9a64d3c..2b1333d989e 100644 --- a/windows/hook.c +++ b/windows/hook.c @@ -979,7 +979,7 @@ static LRESULT HOOK_CallHook( HANDLE16 hook, INT32 fromtype, INT32 code, /* Set DS = SS to call hook procedure */ old_ds = CURRENT_DS; - CURRENT_DS = IF1632_Saved16_ss; + CURRENT_DS = SELECTOROF(IF1632_Saved16_ss_sp); ret = data->proc(code, wParam, lParam); CURRENT_DS = old_ds; diff --git a/windows/mdi.c b/windows/mdi.c index 581d091170e..39c673ed2ce 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -197,7 +197,7 @@ static HWND16 MDI_GetWindow(WND *clientWnd, HWND16 hWnd, WORD wTo ) static void MDI_CalcDefaultChildPos( WND* w, WORD n, LPPOINT16 lpPos, INT32 delta) { - RECT16 rect = w->rectClient; + RECT32 rect = w->rectClient; INT32 spacing = GetSystemMetrics32(SM_CYCAPTION) + GetSystemMetrics32(SM_CYFRAME) - 1; INT32 nstagger; @@ -398,11 +398,12 @@ static void MDI_ChildGetMinMaxInfo( WND* clientWnd, HWND16 hwnd, MINMAXINFO16* lpMinMax ) { WND* childWnd = WIN_FindWndPtr(hwnd); - RECT16 rect = clientWnd->rectClient; + RECT32 rect = clientWnd->rectClient; - MapWindowPoints16(clientWnd->parent->hwndSelf, - ((MDICLIENTINFO*)clientWnd->wExtra)->self, (LPPOINT16)&rect, 2); - AdjustWindowRectEx16( &rect, childWnd->dwStyle, 0, childWnd->dwExStyle ); + MapWindowPoints32(clientWnd->parent->hwndSelf, + ((MDICLIENTINFO*)clientWnd->wExtra)->self, + (LPPOINT32)&rect, 2); + AdjustWindowRectEx32( &rect, childWnd->dwStyle, 0, childWnd->dwExStyle ); lpMinMax->ptMaxSize.x = rect.right -= rect.left; lpMinMax->ptMaxSize.y = rect.bottom -= rect.top; @@ -701,7 +702,7 @@ static LONG MDITile(WND* wndClient, MDICLIENTINFO *ci,WORD wParam) if( total ) { - RECT16 rect; + RECT32 rect; int x, y, xsize, ysize; int rows, columns, r, c, i; @@ -900,7 +901,7 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP { LPCREATESTRUCT16 cs; MDICLIENTINFO *ci; - RECT16 rect; + RECT32 rect; WND *w = WIN_FindWndPtr(hwnd); WND *frameWnd = w->parent; INT32 nItems; @@ -948,7 +949,7 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP AppendMenu32A( ci->hWindowMenu, MF_SEPARATOR, 0, NULL ); - GetClientRect16(frameWnd->hwndSelf, &rect); + GetClientRect32(frameWnd->hwndSelf, &rect); NC_HandleNCCalcSize( w, &rect ); w->rectClient = rect; @@ -1571,22 +1572,22 @@ BOOL16 TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg ) */ void CalcChildScroll( HWND16 hwnd, WORD scroll ) { - RECT16 childRect, clientRect; + RECT32 childRect, clientRect; INT32 vmin, vmax, hmin, hmax, vpos, hpos; BOOL32 noscroll = FALSE; WND *pWnd, *Wnd; if (!(Wnd = pWnd = WIN_FindWndPtr( hwnd ))) return; - GetClientRect16( hwnd, &clientRect ); - SetRectEmpty16( &childRect ); + GetClientRect32( hwnd, &clientRect ); + SetRectEmpty32( &childRect ); for ( pWnd = pWnd->child; pWnd; pWnd = pWnd->next ) { - UnionRect16( &childRect, &pWnd->rectWindow, &childRect ); + UnionRect32( &childRect, &pWnd->rectWindow, &childRect ); if( pWnd->dwStyle & WS_MAXIMIZE ) noscroll = TRUE; } - UnionRect16( &childRect, &clientRect, &childRect ); + UnionRect32( &childRect, &clientRect, &childRect ); /* jump through the hoops to prevent excessive flashing */ diff --git a/windows/message.c b/windows/message.c index 0c22b8aff80..a124fcdb48b 100644 --- a/windows/message.c +++ b/windows/message.c @@ -550,7 +550,7 @@ UINT32 GetDoubleClickTime32(void) * Implementation of an inter-task SendMessage. */ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, - WPARAM16 wParam, LPARAM lParam ) + WPARAM32 wParam, LPARAM lParam, WORD flags ) { INT32 prevSMRL = debugSMRL; QSMCTRL qCtrl = { 0, 1}; @@ -574,14 +574,16 @@ static LRESULT MSG_SendMessage( HQUEUE16 hDestQueue, HWND16 hwnd, UINT16 msg, /* resume sending */ - queue->hWnd = hwnd; - queue->msg = msg; - queue->wParam = wParam; - queue->lParam = lParam; + queue->hWnd = hwnd; + queue->msg = msg; + queue->wParam = LOWORD(wParam); + queue->wParamHigh = HIWORD(wParam); + queue->lParam = lParam; queue->hPrevSendingTask = destQ->hSendingTask; destQ->hSendingTask = GetTaskQueue(0); queue->wakeBits &= ~QS_SMPARAMSFREE; + queue->flags = (queue->flags & ~(QUEUE_SM_WIN32|QUEUE_SM_UNICODE)) | flags; dprintf_sendmsg(stddeb,"%*ssm: smResultInit = %08x\n", prevSMRL, "", (unsigned)&qCtrl); @@ -1058,12 +1060,16 @@ LRESULT SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam) } if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ)) return 0; /* Don't send anything if the task is dying */ - if (wndPtr->hmemTaskQ != GetTaskQueue(0)) - return MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam ); SPY_EnterMessage( SPY_SENDMESSAGE16, hwnd, msg, wParam, lParam ); - ret = CallWindowProc16( (WNDPROC16)wndPtr->winproc, - hwnd, msg, wParam, lParam ); + + if (wndPtr->hmemTaskQ != GetTaskQueue(0)) + ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, + wParam, lParam, 0 ); + else + ret = CallWindowProc16( (WNDPROC16)wndPtr->winproc, + hwnd, msg, wParam, lParam ); + SPY_ExitMessage( SPY_RESULT_OK16, hwnd, msg, ret ); return ret; } @@ -1125,15 +1131,15 @@ LRESULT SendMessage32A(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam) if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ)) return 0; /* Don't send anything if the task is dying */ - if (wndPtr->hmemTaskQ != GetTaskQueue(0)) - { - fprintf( stderr, "SendMessage32A: intertask message [%04x] not supported\n", msg ); - return 0; - } - SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); - ret = CallWindowProc32A( (WNDPROC32)wndPtr->winproc, - hwnd, msg, wParam, lParam ); + + if (wndPtr->hmemTaskQ != GetTaskQueue(0)) + ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam, + QUEUE_SM_WIN32 ); + else + ret = CallWindowProc32A( (WNDPROC32)wndPtr->winproc, + hwnd, msg, wParam, lParam ); + SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret ); return ret; } @@ -1173,15 +1179,16 @@ LRESULT SendMessage32W(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam) } if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ)) return 0; /* Don't send anything if the task is dying */ - if (wndPtr->hmemTaskQ != GetTaskQueue(0)) - { - fprintf( stderr, "SendMessage32W: intertask message not supported\n" ); - return 0; - } SPY_EnterMessage( SPY_SENDMESSAGE32, hwnd, msg, wParam, lParam ); - ret = CallWindowProc32W( (WNDPROC32)wndPtr->winproc, - hwnd, msg, wParam, lParam ); + + if (wndPtr->hmemTaskQ != GetTaskQueue(0)) + ret = MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam, + QUEUE_SM_WIN32 | QUEUE_SM_UNICODE ); + else + ret = CallWindowProc32W( (WNDPROC32)wndPtr->winproc, + hwnd, msg, wParam, lParam ); + SPY_ExitMessage( SPY_RESULT_OK32, hwnd, msg, ret ); return ret; } diff --git a/windows/nonclient.c b/windows/nonclient.c index 5237a529a2a..b1ef586f2a9 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -22,10 +22,20 @@ #include "queue.h" #include "selectors.h" #include "stddebug.h" +#include "tweak.h" #include "debug.h" #include "options.h" +int NC_CaptionLeftNudge; +int NC_CaptionTopNudge; +int NC_SysControlNudge; +int NC_MaxControlNudge; +int NC_MinControlNudge; +UINT32 NC_CaptionTextFlags; +HBRUSH32 NC_WinHighlight95; +HBRUSH32 NC_WinShadow95; + static HBITMAP16 hbitmapClose = 0; static HBITMAP16 hbitmapMinimize = 0; static HBITMAP16 hbitmapMinimizeD = 0; @@ -67,6 +77,10 @@ extern HCURSOR16 CURSORICON_IconToCursor( HICON16, BOOL32 ); static void NC_AdjustRect( LPRECT16 rect, DWORD style, BOOL32 menu, DWORD exStyle ) { + if(TWEAK_Win95Look) + fprintf( stddeb, "NC_AdjustRect was called in Win95 mode. Aiee! " + "Please report this.\n" ); + if(style & WS_ICONIC) return; /* Decide if the window will be managed (see CreateWindowEx) */ if (!(Options.managed && !(style & WS_CHILD) && @@ -93,6 +107,60 @@ static void NC_AdjustRect( LPRECT16 rect, DWORD style, BOOL32 menu, } +/****************************************************************************** + * + * NC_AdjustRect95( + * LPRECT16 rect, + * DWORD style, + * BOOL32 menu, + * DWORD exStyle ) + * + * Computes the size of the window based on the parameters of the client + * area. + * + * Bugs + * Most of this code is copied from NC_AdjustRect. It shouldn't be. + * There are some unique things about Win 95 that are being horribly + * neglected here. I don't know what they are, either. :-\ + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original cut & paste from NC_AdjustRect + * + *****************************************************************************/ + +static void NC_AdjustRect95( LPRECT16 rect, DWORD style, BOOL32 menu, + DWORD exStyle ) +{ + if(style & WS_ICONIC) return; + + /* Decide if the window will be managed (see CreateWindowEx) */ + if (!(Options.managed && !(style & WS_CHILD) && + ((style & (WS_DLGFRAME | WS_THICKFRAME)) || + (exStyle & WS_EX_DLGMODALFRAME)))) + { + if (HAS_DLGFRAME( style, exStyle )) + InflateRect16(rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME ); + else + { + if (HAS_THICKFRAME(style)) + InflateRect16( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME ); + if (style & WS_BORDER) + InflateRect16( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER); + } + + if ((style & WS_CAPTION) == WS_CAPTION) + rect->top -= SYSMETRICS_CYCAPTION - SYSMETRICS_CYBORDER; + } + if (menu) rect->top -= SYSMETRICS_CYMENU + SYSMETRICS_CYBORDER + 2; + else rect->top += SYSMETRICS_CYBORDER; + + if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL; + if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL; +} + + + /*********************************************************************** * AdjustWindowRect16 (USER.102) */ @@ -129,7 +197,11 @@ BOOL16 AdjustWindowRectEx16( LPRECT16 rect, DWORD style, rect->left, rect->top, rect->right, rect->bottom, style, menu, exStyle ); - NC_AdjustRect( rect, style, menu, exStyle ); + if(TWEAK_Win95Look) + NC_AdjustRect95( rect, style, menu, exStyle ); + else + NC_AdjustRect( rect, style, menu, exStyle ); + return TRUE; } @@ -155,7 +227,7 @@ BOOL32 AdjustWindowRectEx32( LPRECT32 rect, DWORD style, * * Handle a WM_NCCALCSIZE message. Called from DefWindowProc(). */ -LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect ) +LONG NC_HandleNCCalcSize( WND *pWnd, RECT32 *winRect ) { RECT16 tmpRect = { 0, 0, 0, 0 }; LONG result = 0; @@ -163,20 +235,29 @@ LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect ) if (pWnd->class->style & CS_VREDRAW) result |= WVR_VREDRAW; if (pWnd->class->style & CS_HREDRAW) result |= WVR_HREDRAW; - if( !( pWnd->dwStyle & WS_MINIMIZE ) ) - { - NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle ); - winRect->left -= tmpRect.left; - winRect->top -= tmpRect.top; - winRect->right -= tmpRect.right; - winRect->bottom -= tmpRect.bottom; + if( !( pWnd->dwStyle & WS_MINIMIZE ) ) { + if(TWEAK_Win95Look) + NC_AdjustRect95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle ); + else + NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle ); - if (HAS_MENU(pWnd)) - { - winRect->top += MENU_GetMenuBarHeight( pWnd->hwndSelf, - winRect->right - winRect->left, - -tmpRect.left, -tmpRect.top ) + 1; - } + winRect->left -= tmpRect.left; + winRect->top -= tmpRect.top; + winRect->right -= tmpRect.right; + winRect->bottom -= tmpRect.bottom; + + if (HAS_MENU(pWnd)) { + dprintf_nonclient( stddeb, "NC_HandleNCCalcSize: Calling " + "GetMenuBarHeight with HWND 0x%x, width %d, " + "at (%d, %d).\n", pWnd->hwndSelf, + winRect->right - winRect->left, + -tmpRect.left, -tmpRect.top ); + + winRect->top += + MENU_GetMenuBarHeight( pWnd->hwndSelf, + winRect->right - winRect->left, + -tmpRect.left, -tmpRect.top ) + 1; + } } return result; } @@ -188,6 +269,8 @@ LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect ) * Get the 'inside' rectangle of a window, i.e. the whole window rectangle * but without the borders (if any). * The rectangle is in window coordinates (for drawing with GetWindowDC()). + * + * FIXME: A Win95 version of this function is needed. */ static void NC_GetInsideRect( HWND32 hwnd, RECT32 *rect ) { @@ -213,6 +296,8 @@ static void NC_GetInsideRect( HWND32 hwnd, RECT32 *rect ) if (wndPtr->dwStyle & WS_BORDER) InflateRect32( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER ); } + + return; } @@ -220,6 +305,8 @@ static void NC_GetInsideRect( HWND32 hwnd, RECT32 *rect ) * NC_HandleNCHitTest * * Handle a WM_NCHITTEST message. Called from DefWindowProc(). + * + * FIXME: A Win95 version of this function is needed. */ LONG NC_HandleNCHitTest( HWND32 hwnd, POINT16 pt ) { @@ -413,6 +500,155 @@ static void NC_DrawMinButton( HWND32 hwnd, HDC16 hdc, BOOL32 down ) } +/****************************************************************************** + * + * void NC_DrawSysButton95( + * HWND32 hwnd, + * HDC32 hdc, + * BOOL32 down ) + * + * Draws a fake Win95 system button. Horribly broken. We should be drawing + * an icon, not the X. (This will require some thought) + * + * Bugs + * Plain and simply doesn't work. Fails miserably for child windows. + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation from NC_DrawSysButton source. + * + *****************************************************************************/ + +void NC_DrawSysButton95( + HWND32 hwnd, + HDC32 hdc, + BOOL32 down ) +{ + RECT32 rect; + HDC32 hdcMem; + HBITMAP32 hbitmap; + WND *wndPtr = WIN_FindWndPtr( hwnd ); + SIZE32 bmsz; + + if( !(wndPtr->flags & WIN_MANAGED) ) + { + NC_GetInsideRect( hwnd, &rect ); + hdcMem = CreateCompatibleDC32( hdc ); + hbitmap = SelectObject32( hdcMem, hbitmapClose ); + if(GetBitmapDimensionEx32( hbitmapClose, &bmsz )) { + BitBlt32(hdc, rect.left + (sysMetrics[SM_CXSIZE] - bmsz.cx) / 2 + + NC_SysControlNudge, + rect.top + (sysMetrics[SM_CYSIZE] - bmsz.cy - 1) / 2, + bmsz.cx, bmsz.cy, + hdcMem, 0, 0, down ? NOTSRCCOPY : SRCCOPY ); + } + SelectObject32( hdcMem, hbitmap ); + DeleteDC32( hdcMem ); + + } + return; +} + + +/****************************************************************************** + * + * NC_DrawMaxButton95( + * HWND32 hwnd, + * HDC16 hdc, + * BOOL32 down ) + * + * Draws the maximize button for Win95 style windows. + * + * Bugs + * Many. Spacing might still be incorrect. Need to fit a close + * button between the max button and the edge. Draws the wrong thing + * (a Win31 up-down) when maximized. Should scale the image with the + * title bar. And more... + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static void NC_DrawMaxButton95( + HWND32 hwnd, + HDC16 hdc, + BOOL32 down ) +{ + RECT32 rect; + WND *wndPtr = WIN_FindWndPtr( hwnd ); + SIZE32 bmsz; + HBITMAP32 bm; + + if( !(wndPtr->flags & WIN_MANAGED) && + GetBitmapDimensionEx32((bm = IsZoomed32(hwnd) ? + (down ? hbitmapRestoreD : hbitmapRestore ) : + (down ? hbitmapMaximizeD : hbitmapMaximize)), + &bmsz)) { + + NC_GetInsideRect( hwnd, &rect ); + + GRAPH_DrawBitmap( hdc, bm, + rect.right + NC_MaxControlNudge - + (sysMetrics[SM_CXSIZE] + bmsz.cx) / 2, + rect.top + (sysMetrics[SM_CYSIZE] - bmsz.cy - 1) / 2, + 0, 0, bmsz.cx, bmsz.cy, FALSE ); + } + + return; +} + + +/****************************************************************************** + * + * NC_DrawMinButton95( + * HWND32 hwnd, + * HDC16 hdc, + * BOOL32 down ) + * + * Draws the minimize button for Win95 style windows. + * + * Bugs + * Many. Spacing is still incorrect. Should scale the image with the + * title bar. And more... + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static void NC_DrawMinButton95( + HWND32 hwnd, + HDC16 hdc, + BOOL32 down ) +{ + RECT32 rect; + WND *wndPtr = WIN_FindWndPtr( hwnd ); + SIZE32 bmsz; + HBITMAP32 bm; + + if( !(wndPtr->flags & WIN_MANAGED) && + GetBitmapDimensionEx32((bm = down ? hbitmapMinimizeD : + hbitmapMinimize), &bmsz)) { + + NC_GetInsideRect( hwnd, &rect ); + + if (wndPtr->dwStyle & WS_MAXIMIZEBOX) + rect.right += -1 + NC_MaxControlNudge - + (sysMetrics[SM_CXSIZE] + bmsz.cx) / 2; + + GRAPH_DrawBitmap( hdc, bm, rect.right + NC_MinControlNudge - + (sysMetrics[SM_CXSIZE] + bmsz.cx) / 2, + rect.top + (sysMetrics[SM_CYSIZE] - bmsz.cy - 1) / 2, + 0, 0, bmsz.cx, bmsz.cy, FALSE ); + } + + return; +} + + /*********************************************************************** * NC_DrawFrame * @@ -424,6 +660,10 @@ static void NC_DrawFrame( HDC32 hdc, RECT32 *rect, BOOL32 dlgFrame, { INT32 width, height; + if(TWEAK_Win95Look) + fprintf( stddeb, "NC_DrawFrame was called in Win95 mode. Aiee! " + "Please report this.\n" ); + if (dlgFrame) { width = SYSMETRICS_CXDLGFRAME - 1; @@ -493,16 +733,99 @@ static void NC_DrawFrame( HDC32 hdc, RECT32 *rect, BOOL32 dlgFrame, } +/****************************************************************************** + * + * void NC_DrawFrame95( + * HDC32 hdc, + * RECT32 *rect, + * BOOL32 dlgFrame, + * BOOL32 active ) + * + * Draw a window frame inside the given rectangle, and update the rectangle. + * The correct pen for the frame must be selected in the DC. + * + * Bugs + * Many. First, just what IS a frame in Win95? Note that the 3D look + * on the outer edge is handled by NC_DoNCPaint95. As is the inner + * edge. The inner rectangle just inside the frame is handled by the + * Caption code. + * + * In short, for most people, this function should be a nop (unless + * you LIKE thick borders in Win95/NT4.0 -- I've been working with + * them lately, but just to get this code right). Even so, it doesn't + * appear to be so. It's being worked on... + * + * Revision history + * 06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation (based on NC_DrawFrame) + * + *****************************************************************************/ + +static void NC_DrawFrame95( + HDC32 hdc, + RECT32 *rect, + BOOL32 dlgFrame, + BOOL32 active ) +{ + INT32 width, height; + + if (dlgFrame) + { + width = SYSMETRICS_CXDLGFRAME - 1; + height = SYSMETRICS_CYDLGFRAME - 1; + SelectObject32( hdc, active ? sysColorObjects.hbrushActiveCaption : + sysColorObjects.hbrushInactiveCaption ); + } + else + { + width = sysMetrics[SM_CXFRAME] - sysMetrics[SM_CXEDGE] - 1; + height = sysMetrics[SM_CYFRAME] - sysMetrics[SM_CYEDGE] - 1; + SelectObject32( hdc, active ? sysColorObjects.hbrushActiveBorder : + sysColorObjects.hbrushInactiveBorder ); + } + + /* Draw frame */ + PatBlt32( hdc, rect->left, rect->top, + rect->right - rect->left, height, PATCOPY ); + PatBlt32( hdc, rect->left, rect->top, + width, rect->bottom - rect->top, PATCOPY ); + PatBlt32( hdc, rect->left, rect->bottom, + rect->right - rect->left, -height, PATCOPY ); + PatBlt32( hdc, rect->right, rect->top, + -width, rect->bottom - rect->top, PATCOPY ); + + InflateRect32( rect, -width, -height ); + + if(!dlgFrame) { + /* Draw inner rectangle */ + GRAPH_DrawRectangle( hdc, rect->left, rect->top, + rect->right - rect->left, + rect->bottom - rect->top, + TWEAK_PenC095 ); + + InflateRect32( rect, -1, -1 ); + } +} + + + /*********************************************************************** * NC_DrawMovingFrame * * Draw the frame used when moving or resizing window. + * + * FIXME: This causes problems in Win95 mode. (why?) */ -static void NC_DrawMovingFrame( HDC16 hdc, RECT16 *rect, BOOL32 thickframe ) +static void NC_DrawMovingFrame( HDC32 hdc, RECT32 *rect, BOOL32 thickframe ) { - if (thickframe) FastWindowFrame( hdc, rect, SYSMETRICS_CXFRAME, - SYSMETRICS_CYFRAME, PATINVERT ); - else DrawFocusRect16( hdc, rect ); + if (thickframe) + { + RECT16 r16; + CONV_RECT32TO16( rect, &r16 ); + FastWindowFrame( hdc, &r16, SYSMETRICS_CXFRAME, + SYSMETRICS_CYFRAME, PATINVERT ); + } + else DrawFocusRect32( hdc, rect ); } @@ -579,6 +902,91 @@ static void NC_DrawCaption( HDC32 hdc, RECT32 *rect, HWND32 hwnd, } +/****************************************************************************** + * + * NC_DrawCaption95( + * HDC32 hdc, + * RECT32 *rect, + * HWND32 hwnd, + * DWORD style, + * BOOL32 active ) + * + * Draw the window caption for Win95 style windows. + * The correct pen for the window frame must be selected in the DC. + * + * Bugs + * Hey, a function that finally works! Well, almost. In Win95, the + * title has its own font -- not the system font. It's being worked + * on. + * + * Revision history + * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation. + * + *****************************************************************************/ + +static void NC_DrawCaption95( + HDC32 hdc, + RECT32 *rect, + HWND32 hwnd, + DWORD style, + BOOL32 active ) +{ + RECT32 r = *rect; + WND *wndPtr = WIN_FindWndPtr( hwnd ); + char buffer[256]; + + if (wndPtr->flags & WIN_MANAGED) return; + + FillRect32( hdc, &r, active ? sysColorObjects.hbrushActiveCaption : + sysColorObjects.hbrushInactiveCaption ); + + if (!hbitmapClose) { + if (!(hbitmapClose = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_CLOSE) ))) + return; + hbitmapMinimize = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_REDUCE) ); + hbitmapMinimizeD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_REDUCED) ); + hbitmapMaximize = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_ZOOM) ); + hbitmapMaximizeD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_ZOOMD) ); + hbitmapRestore = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORE) ); + hbitmapRestoreD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORED) ); + } + + if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) { + HBRUSH32 hbrushOld = SelectObject32(hdc, sysColorObjects.hbrushWindow); + PatBlt32( hdc, r.left, r.top, 1, r.bottom-r.top+1,PATCOPY ); + PatBlt32( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY ); + PatBlt32( hdc, r.left, r.top-1, r.right-r.left, 1, PATCOPY ); + r.left++; + r.right--; + SelectObject32( hdc, hbrushOld ); + } + + if (style & WS_SYSMENU) { + NC_DrawSysButton95( hwnd, hdc, FALSE ); + r.left += SYSMETRICS_CXSIZE + 1; + } + if (style & WS_MAXIMIZEBOX) { + NC_DrawMaxButton95( hwnd, hdc, FALSE ); + r.right -= SYSMETRICS_CXSIZE + 1; + } + if (style & WS_MINIMIZEBOX) { + NC_DrawMinButton95( hwnd, hdc, FALSE ); + r.right -= SYSMETRICS_CXSIZE + 1; + } + + if (GetWindowText32A( hwnd, buffer, sizeof(buffer) )) { + if (active) SetTextColor32( hdc, GetSysColor32( COLOR_CAPTIONTEXT ) ); + else SetTextColor32( hdc, GetSysColor32( COLOR_INACTIVECAPTIONTEXT ) ); + SetBkMode32( hdc, TRANSPARENT ); + r.top += NC_CaptionTopNudge - 2; + r.left += NC_CaptionLeftNudge; + DrawText32A( hdc, buffer, -1, &r, NC_CaptionTextFlags ); + } +} + + + /*********************************************************************** * NC_DoNCPaint * @@ -668,6 +1076,134 @@ void NC_DoNCPaint( WND* wndPtr, HRGN32 clip, BOOL32 suppress_menupaint ) } +/****************************************************************************** + * + * void NC_DoNCPaint95( + * WND *wndPtr, + * HRGN32 clip, + * BOOL32 suppress_menupaint ) + * + * Paint the non-client area for Win95 windows. The clip region is + * currently ignored. + * + * Bugs + * grep -E -A10 -B5 \(95\)\|\(Bugs\)\|\(FIXME\) windows/nonclient.c \ + * misc/tweak.c controls/menu.c # :-) + * + * Revision history + * 03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu) + * Original implementation + * + *****************************************************************************/ + +void NC_DoNCPaint95( + WND *wndPtr, + HRGN32 clip, + BOOL32 suppress_menupaint ) +{ + HDC32 hdc; + RECT32 rect; + BOOL32 active; + HWND32 hwnd = wndPtr->hwndSelf; + + if ( wndPtr->dwStyle & WS_MINIMIZE || + !WIN_IsWindowDrawable( wndPtr, 0 )) return; /* Nothing to do */ + + active = wndPtr->flags & WIN_NCACTIVATED; + + dprintf_nonclient(stddeb, "NC_DoNCPaint95: %04x %d\n", hwnd, active ); + + if (!(hdc = GetDCEx32( hwnd, 0, DCX_USESTYLE | DCX_WINDOW ))) return; + + if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left, + wndPtr->rectClient.top-wndPtr->rectWindow.top, + wndPtr->rectClient.right-wndPtr->rectWindow.left, + wndPtr->rectClient.bottom-wndPtr->rectWindow.top ) + == NULLREGION) + { + ReleaseDC32( hwnd, hdc ); + return; + } + + rect.top = rect.left = 0; + rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left; + rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top; + + SelectObject32( hdc, sysColorObjects.hpenWindowFrame ); + + if(!(wndPtr->flags & WIN_MANAGED)) { + if((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) || + (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)) { + TWEAK_DrawReliefRect95(hdc, &rect); + InflateRect32(&rect, -2, -2); + } + + if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) + NC_DrawFrame95( hdc, &rect, TRUE, active ); + else if (wndPtr->dwStyle & WS_THICKFRAME) + NC_DrawFrame95(hdc, &rect, FALSE, active ); + + if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) + { + RECT32 r = rect; + POINT32 sep[2] = { { rect.left, + rect.top + sysMetrics[SM_CYCAPTION] - 2 }, + { rect.right, + rect.top + sysMetrics[SM_CYCAPTION] - 2 } }; + + r.bottom = rect.top + sysMetrics[SM_CYCAPTION] - 2; + rect.top += sysMetrics[SM_CYCAPTION] - 2 + sysMetrics[SM_CYBORDER]; + NC_DrawCaption95( hdc, &r, hwnd, wndPtr->dwStyle, active ); + GRAPH_DrawLines( hdc, sep, 1, TWEAK_PenC095 ); + } + } + + if (HAS_MENU(wndPtr)) + { + RECT32 r = rect; + r.bottom = rect.top + sysMetrics[SM_CYMENU] - sysMetrics[SM_CYBORDER]; + r.top -= sysMetrics[SM_CYBORDER]; + + dprintf_nonclient(stddeb, "DoNCPaint95: Calling DrawMenuBar with " + "rect (%d, %d)-(%d, %d)\n", r.left, r.top, + r.right, r.bottom); + + rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ); + } + + dprintf_nonclient( stddeb, "After MenuBar, rect is (%d, %d)-(%d, %d).\n", + rect.left, rect.top, rect.right, rect.bottom ); + + /* Draw the inner frames */ + GRAPH_DrawRectangle( hdc, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TWEAK_PenC095 ); + InflateRect32(&rect, -1, -1); + GRAPH_DrawGenericReliefRect( hdc, &rect, 1, 1, NC_WinShadow95, + NC_WinHighlight95 ); + + InflateRect32(&rect, -1, -1); + + /* Draw the scroll-bars */ + + if (wndPtr->dwStyle & WS_VSCROLL) + SCROLL_DrawScrollBar( hwnd, hdc, SB_VERT, TRUE ); + if (wndPtr->dwStyle & WS_HSCROLL) + SCROLL_DrawScrollBar( hwnd, hdc, SB_HORZ, TRUE ); + + /* Draw the "size-box" */ + if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL)) + { + RECT32 r = rect; + r.left = r.right - SYSMETRICS_CXVSCROLL + 1; + r.top = r.bottom - SYSMETRICS_CYHSCROLL + 1; + FillRect32( hdc, &r, sysColorObjects.hbrushScrollbar ); + } + + ReleaseDC32( hwnd, hdc ); +} + + + /*********************************************************************** * NC_HandleNCPaint @@ -682,7 +1218,9 @@ LONG NC_HandleNCPaint( HWND32 hwnd , HRGN32 clip) { if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_RedrawIconTitle( hwnd ); - else + else if(TWEAK_Win95Look) + NC_DoNCPaint95( wndPtr, clip, FALSE ); + else NC_DoNCPaint( wndPtr, clip, FALSE ); } return 0; @@ -708,6 +1246,8 @@ LONG NC_HandleNCActivate( WND *wndPtr, WPARAM16 wParam ) if( wndPtr->dwStyle & WS_MINIMIZE ) WINPOS_RedrawIconTitle( wndPtr->hwndSelf ); + else if( TWEAK_Win95Look ) + NC_DoNCPaint95( wndPtr, (HRGN32)1, FALSE ); else NC_DoNCPaint( wndPtr, (HRGN32)1, FALSE ); } @@ -820,8 +1360,10 @@ static void NC_TrackSysMenu( HWND32 hwnd, POINT16 pt ) MapWindowPoints16( 0, hwnd, (LPPOINT16)&rTrack, 2 ); /* track mouse while waiting for WM_LBUTTONUP */ - - NC_DrawSysButton( hwnd, hdc, bTrack ); + if(TWEAK_Win95Look) + NC_DrawSysButton95( hwnd, hdc, bTrack ); + else + NC_DrawSysButton( hwnd, hdc, bTrack ); SetCapture32(hwnd); do { @@ -833,7 +1375,11 @@ static void NC_TrackSysMenu( HWND32 hwnd, POINT16 pt ) { if( bTrack ) continue; } else { if(!bTrack ) continue; } - NC_DrawSysButton( hwnd, hdc, bTrack = bNew); + + if(TWEAK_Win95Look) + NC_DrawSysButton95( hwnd, hdc, bTrack = bNew); + else + NC_DrawSysButton( hwnd, hdc, bTrack = bNew); } } while( msg.message != WM_LBUTTONUP ); @@ -943,11 +1489,12 @@ static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam, static void NC_DoSizeMove( HWND32 hwnd, WORD wParam, POINT16 pt ) { MSG16 msg; - RECT16 sizingRect, mouseRect; + RECT32 sizingRect, mouseRect; HDC32 hdc; LONG hittest = (LONG)(wParam & 0x0f); HCURSOR16 hDragCursor = 0, hOldCursor = 0; - POINT16 minTrack, maxTrack, capturePoint = pt; + POINT32 minTrack, maxTrack; + POINT16 capturePoint = pt; WND * wndPtr = WIN_FindWndPtr( hwnd ); BOOL32 thickframe = HAS_THICKFRAME( wndPtr->dwStyle ); BOOL32 iconic = wndPtr->dwStyle & WS_MINIMIZE; @@ -984,9 +1531,9 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam, POINT16 pt ) WINPOS_GetMinMaxInfo( wndPtr, NULL, NULL, &minTrack, &maxTrack ); sizingRect = wndPtr->rectWindow; if (wndPtr->dwStyle & WS_CHILD) - GetClientRect16( wndPtr->parent->hwndSelf, &mouseRect ); + GetClientRect32( wndPtr->parent->hwndSelf, &mouseRect ); else - SetRect16(&mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN); + SetRect32(&mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN); if (ON_LEFT_BORDER(hittest)) { mouseRect.left = MAX( mouseRect.left, sizingRect.right-maxTrack.x ); @@ -1079,9 +1626,9 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam, POINT16 pt ) if (msg.message == WM_KEYDOWN) SetCursorPos32( pt.x, pt.y ); else { - RECT16 newRect = sizingRect; + RECT32 newRect = sizingRect; - if (hittest == HTCAPTION) OffsetRect16( &newRect, dx, dy ); + if (hittest == HTCAPTION) OffsetRect32( &newRect, dx, dy ); if (ON_LEFT_BORDER(hittest)) newRect.left += dx; else if (ON_RIGHT_BORDER(hittest)) newRect.right += dx; if (ON_TOP_BORDER(hittest)) newRect.top += dy; @@ -1120,12 +1667,12 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam, POINT16 pt ) RECT16* pr = SEGPTR_NEW(RECT16); if( pr ) { - *pr = sizingRect; + CONV_RECT32TO16( &sizingRect, pr ); if( HOOK_CallHooks16( WH_CBT, HCBT_MOVESIZE, hwnd, (LPARAM)SEGPTR_GET(pr)) ) sizingRect = wndPtr->rectWindow; else - sizingRect = *pr; + CONV_RECT16TO32( pr, &sizingRect ); SEGPTR_FREE(pr); } } @@ -1164,8 +1711,16 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam ) BOOL32 pressed = TRUE; SetCapture32( hwnd ); - if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, TRUE ); - else NC_DrawMaxButton( hwnd, hdc, TRUE ); + if (wParam == HTMINBUTTON) + if(TWEAK_Win95Look) + NC_DrawMinButton95( hwnd, hdc, TRUE ); + else + NC_DrawMinButton( hwnd, hdc, TRUE ); + else + if(TWEAK_Win95Look) + NC_DrawMaxButton95( hwnd, hdc, TRUE ); + else + NC_DrawMaxButton( hwnd, hdc, TRUE ); do { @@ -1175,13 +1730,29 @@ static void NC_TrackMinMaxBox( HWND32 hwnd, WORD wParam ) pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam); if (pressed != oldstate) { - if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, pressed ); - else NC_DrawMaxButton( hwnd, hdc, pressed ); + if (wParam == HTMINBUTTON) + if(TWEAK_Win95Look) + NC_DrawMinButton95( hwnd, hdc, pressed ); + else + NC_DrawMinButton( hwnd, hdc, pressed ); + else + if(TWEAK_Win95Look) + NC_DrawMaxButton95( hwnd, hdc, pressed ); + else + NC_DrawMaxButton( hwnd, hdc, pressed ); } } while (msg.message != WM_LBUTTONUP); - if (wParam == HTMINBUTTON) NC_DrawMinButton( hwnd, hdc, FALSE ); - else NC_DrawMaxButton( hwnd, hdc, FALSE ); + if (wParam == HTMINBUTTON) + if(TWEAK_Win95Look) + NC_DrawMinButton95( hwnd, hdc, FALSE ); + else + NC_DrawMinButton( hwnd, hdc, FALSE ); + else + if(TWEAK_Win95Look) + NC_DrawMaxButton95( hwnd, hdc, FALSE ); + else + NC_DrawMaxButton( hwnd, hdc, FALSE ); ReleaseCapture(); ReleaseDC32( hwnd, hdc ); diff --git a/windows/queue.c b/windows/queue.c index 9845c1a8398..666f87b0698 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -325,16 +325,33 @@ void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue ) (unsigned)queue->smResultCurrent, (unsigned)prevCtrlPtr ); QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE ); - dprintf_msg(stddeb, "\trcm: calling wndproc - %04x %04x %04x %08x\n", - senderQ->hWnd, senderQ->msg, senderQ->wParam, (unsigned)senderQ->lParam ); + dprintf_msg(stddeb, "\trcm: calling wndproc - %04x %04x %04x%04x %08x\n", + senderQ->hWnd, senderQ->msg, senderQ->wParamHigh, + senderQ->wParam, (unsigned)senderQ->lParam ); if (IsWindow32( senderQ->hWnd )) { + WND *wndPtr = WIN_FindWndPtr( senderQ->hWnd ); DWORD extraInfo = queue->GetMessageExtraInfoVal; queue->GetMessageExtraInfoVal = senderQ->GetMessageExtraInfoVal; - result = CallWindowProc16( (WNDPROC16)GetWindowLong16(senderQ->hWnd, GWL_WNDPROC), - senderQ->hWnd, senderQ->msg, senderQ->wParam, senderQ->lParam ); + if (senderQ->flags & QUEUE_SM_WIN32) + { + WPARAM32 wParam = MAKELONG( senderQ->wParam, senderQ->wParamHigh ); + dprintf_msg(stddeb, "\trcm: msg is Win32\n" ); + if (senderQ->flags & QUEUE_SM_UNICODE) + result = CallWindowProc32W( wndPtr->winproc, + senderQ->hWnd, senderQ->msg, + wParam, senderQ->lParam ); + else + result = CallWindowProc32A( wndPtr->winproc, + senderQ->hWnd, senderQ->msg, + wParam, senderQ->lParam ); + } + else /* Win16 message */ + result = CallWindowProc16( (WNDPROC16)wndPtr->winproc, + senderQ->hWnd, senderQ->msg, + senderQ->wParam, senderQ->lParam ); queue->GetMessageExtraInfoVal = extraInfo; /* Restore extra info */ dprintf_msg(stddeb,"\trcm: result = %08x\n", (unsigned)result ); @@ -740,8 +757,8 @@ BOOL32 SetMessageQueue32( INT32 size ) if ((hQueue = GetTaskQueue(0)) != 0) { MESSAGEQUEUE *oldQ = (MESSAGEQUEUE *)GlobalLock16( hQueue ); - memcpy( &queuePtr->reserved2, &oldQ->reserved2, - (int)oldQ->messages - (int)(&oldQ->reserved2) ); + memcpy( &queuePtr->wParamHigh, &oldQ->wParamHigh, + (int)oldQ->messages - (int)(&oldQ->wParamHigh) ); HOOK_ResetQueueHooks( hNewQueue ); if( WIN_GetDesktop()->hmemTaskQ == hQueue ) WIN_GetDesktop()->hmemTaskQ = hNewQueue; diff --git a/windows/syscolor.c b/windows/syscolor.c index 7bc455b190e..14d06ea6feb 100644 --- a/windows/syscolor.c +++ b/windows/syscolor.c @@ -11,6 +11,7 @@ #include "gdi.h" #include "syscolor.h" #include "stddebug.h" +#include "tweak.h" /* #define DEBUG_SYSCOLOR */ #include "debug.h" @@ -22,7 +23,7 @@ static const char * const DefSysColors[] = "Background", "192 192 192", /* COLOR_BACKGROUND */ "ActiveTitle", "0 64 128", /* COLOR_ACTIVECAPTION */ "InactiveTitle", "255 255 255", /* COLOR_INACTIVECAPTION */ - "Menu", "0 255 255", /* COLOR_MENU */ + "Menu", "255 255 255", /* COLOR_MENU */ "Window", "255 255 255", /* COLOR_WINDOW */ "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */ "MenuText", "0 0 0", /* COLOR_MENUTEXT */ @@ -41,6 +42,32 @@ static const char * const DefSysColors[] = "ButtonHilight", "255 255 255" /* COLOR_BTNHIGHLIGHT */ }; +static const char * const DefSysColors95[] = +{ + "Scrollbar", "224 224 224", /* COLOR_SCROLLBAR */ + "Background", "192 192 192", /* COLOR_BACKGROUND */ + "ActiveTitle", "0 64 128", /* COLOR_ACTIVECAPTION */ + "InactiveTitle", "255 255 255", /* COLOR_INACTIVECAPTION */ + "Menu", "192 192 192", /* COLOR_MENU */ + "Window", "255 255 255", /* COLOR_WINDOW */ + "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */ + "MenuText", "0 0 0", /* COLOR_MENUTEXT */ + "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */ + "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */ + "ActiveBorder", "128 128 128", /* COLOR_ACTIVEBORDER */ + "InactiveBorder", "255 255 255", /* COLOR_INACTIVEBORDER */ + "AppWorkspace", "255 255 232", /* COLOR_APPWORKSPACE */ + "Hilight", "166 202 240", /* COLOR_HIGHLIGHT */ + "HilightText", "0 0 0", /* COLOR_HIGHLIGHTTEXT */ + "ButtonFace", "192 192 192", /* COLOR_BTNFACE */ + "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */ + "GrayText", "192 192 192", /* COLOR_GRAYTEXT */ + "ButtonText", "0 0 0", /* COLOR_BTNTEXT */ + "InactiveTitleText", "0 0 0", /* COLOR_INACTIVECAPTIONTEXT */ + "ButtonHilight", "255 255 255" /* COLOR_BTNHIGHLIGHT */ +}; + + #define NUM_SYS_COLORS (COLOR_BTNHIGHLIGHT+1) static COLORREF SysColors[NUM_SYS_COLORS]; @@ -135,7 +162,8 @@ void SYSCOLOR_Init(void) const char * const *p; char buffer[100]; - for (i = 0, p = DefSysColors; i < NUM_SYS_COLORS; i++, p += 2) + for (i = 0, p = TWEAK_Win95Look ? DefSysColors95 : DefSysColors; + i < NUM_SYS_COLORS; i++, p += 2) { GetProfileString32A( "colors", p[0], p[1], buffer, 100 ); if (!sscanf( buffer, " %d %d %d", &r, &g, &b )) r = g = b = 0; diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c index d63753d38db..525088e03ec 100644 --- a/windows/sysmetrics.c +++ b/windows/sysmetrics.c @@ -7,6 +7,8 @@ #include #include "gdi.h" +#include "options.h" +#include "tweak.h" #include "sysmetrics.h" short sysMetrics[SM_CMETRICS+1]; @@ -20,89 +22,114 @@ void SYSMETRICS_Init(void) { sysMetrics[SM_CXSCREEN] = screenWidth; sysMetrics[SM_CYSCREEN] = screenHeight; - sysMetrics[SM_CXVSCROLL] = SYSMETRICS_CXVSCROLL; - sysMetrics[SM_CYHSCROLL] = SYSMETRICS_CYHSCROLL; - sysMetrics[SM_CYCAPTION] = SYSMETRICS_CYCAPTION; - sysMetrics[SM_CXBORDER] = SYSMETRICS_CXBORDER; - sysMetrics[SM_CYBORDER] = SYSMETRICS_CYBORDER; - sysMetrics[SM_CXDLGFRAME] = SYSMETRICS_CXDLGFRAME; - sysMetrics[SM_CYDLGFRAME] = SYSMETRICS_CYDLGFRAME; - sysMetrics[SM_CYVTHUMB] = SYSMETRICS_CYVTHUMB; - sysMetrics[SM_CXHTHUMB] = SYSMETRICS_CXHTHUMB; - sysMetrics[SM_CXICON] = SYSMETRICS_CXICON; - sysMetrics[SM_CYICON] = SYSMETRICS_CYICON; - sysMetrics[SM_CXCURSOR] = SYSMETRICS_CXCURSOR; - sysMetrics[SM_CYCURSOR] = SYSMETRICS_CYCURSOR; - sysMetrics[SM_CYMENU] = SYSMETRICS_CYMENU; + sysMetrics[SM_CXVSCROLL] = + PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16) + 1; + sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL]; + sysMetrics[SM_CYCAPTION] = 2 + + PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 18); + sysMetrics[SM_CXBORDER] = 1; + sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER]; + sysMetrics[SM_CXDLGFRAME] = + PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth", + TWEAK_Win95Look ? 2 : 4); + sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME]; + sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1; + sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB]; + sysMetrics[SM_CXICON] = 32; + sysMetrics[SM_CYICON] = 32; + sysMetrics[SM_CYMENU] = + PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18); sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN]; - sysMetrics[SM_CYFULLSCREEN] = sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION]; + sysMetrics[SM_CYFULLSCREEN] = + sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION]; sysMetrics[SM_CYKANJIWINDOW] = 0; sysMetrics[SM_MOUSEPRESENT] = 1; - sysMetrics[SM_CYVSCROLL] = SYSMETRICS_CYVSCROLL; - sysMetrics[SM_CXHSCROLL] = SYSMETRICS_CXHSCROLL; + sysMetrics[SM_CYVSCROLL] = sysMetrics[SM_CYVTHUMB]; + sysMetrics[SM_CXHSCROLL] = sysMetrics[SM_CXHTHUMB]; sysMetrics[SM_DEBUG] = 0; + + /* FIXME: The following should look for the registry key to see if the + buttons should be swapped. */ sysMetrics[SM_SWAPBUTTON] = 0; + sysMetrics[SM_RESERVED1] = 0; sysMetrics[SM_RESERVED2] = 0; sysMetrics[SM_RESERVED3] = 0; sysMetrics[SM_RESERVED4] = 0; - sysMetrics[SM_CXMIN] = SYSMETRICS_CXMIN; - sysMetrics[SM_CYMIN] = SYSMETRICS_CYMIN; - sysMetrics[SM_CXSIZE] = SYSMETRICS_CXSIZE; - sysMetrics[SM_CYSIZE] = SYSMETRICS_CYSIZE; - sysMetrics[SM_CXFRAME] = GetProfileInt32A( "windows", "BorderWidth", 4 ); + + /* FIXME: The following two are calculated, but how? */ + sysMetrics[SM_CXMIN] = TWEAK_Win95Look ? 112 : 100; + sysMetrics[SM_CYMIN] = TWEAK_Win95Look ? 27 : 28; + + sysMetrics[SM_CXSIZE] = sysMetrics[SM_CYCAPTION] - 2; + sysMetrics[SM_CYSIZE] = sysMetrics[SM_CXSIZE]; + sysMetrics[SM_CXFRAME] = GetProfileInt32A("Windows", "BorderWidth", 4); sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME]; - sysMetrics[SM_CXMINTRACK] = SYSMETRICS_CXMINTRACK; - sysMetrics[SM_CYMINTRACK] = SYSMETRICS_CYMINTRACK; - sysMetrics[SM_CXDOUBLECLK] = (GetProfileInt32A( "windows","DoubleClickWidth", 4) + 1) & ~1; - sysMetrics[SM_CYDOUBLECLK] = (GetProfileInt32A( "windows","DoubleClickHeight", 4) + 1) & ~1; - sysMetrics[SM_CXICONSPACING] = GetProfileInt32A( "desktop","IconSpacing", 75); - sysMetrics[SM_CYICONSPACING] = GetProfileInt32A( "desktop","IconVerticalSpacing", 72); - sysMetrics[SM_MENUDROPALIGNMENT] = GetProfileInt32A( "windows","MenuDropAlignment", 0 ); + sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN]; + sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN]; + sysMetrics[SM_CXDOUBLECLK] = + (GetProfileInt32A("Windows", "DoubleClickWidth", 4) + 1) & ~1; + sysMetrics[SM_CYDOUBLECLK] = + (GetProfileInt32A("Windows","DoubleClickHeight", 4) + 1) & ~1; + sysMetrics[SM_CXICONSPACING] = + GetProfileInt32A("Desktop","IconSpacing", 75); + sysMetrics[SM_CYICONSPACING] = + GetProfileInt32A("Desktop", "IconVerticalSpacing", 75); + sysMetrics[SM_MENUDROPALIGNMENT] = + GetProfileInt32A("Windows", "MenuDropAlignment", 0); sysMetrics[SM_PENWINDOWS] = 0; sysMetrics[SM_DBCSENABLED] = 0; - /* Win32 additions */ - sysMetrics[SM_CMOUSEBUTTONS] = 3; /* FIXME: query X on that one */ + + /* FIXME: Need to query X for the following */ + sysMetrics[SM_CMOUSEBUTTONS] = 3; + sysMetrics[SM_SECURE] = 0; - sysMetrics[SM_CXEDGE] = SYSMETRICS_CXBORDER; - sysMetrics[SM_CYEDGE] = SYSMETRICS_CYBORDER; - sysMetrics[SM_CXMINSPACING] = SYSMETRICS_CYBORDER; + sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1; + sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE]; + sysMetrics[SM_CXMINSPACING] = 160; + sysMetrics[SM_CYMINSPACING] = 24; + sysMetrics[SM_CXSMICON] = + sysMetrics[SM_CYSIZE] - (sysMetrics[SM_CYSIZE] % 2) - 2; + sysMetrics[SM_CYSMICON] = sysMetrics[SM_CXSMICON]; + sysMetrics[SM_CYSMCAPTION] = 16; + sysMetrics[SM_CXSMSIZE] = 15; + sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CXSMSIZE]; + sysMetrics[SM_CXMENUSIZE] = sysMetrics[SM_CYMENU]; + sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CXMENUSIZE]; -/* -SM_CXEDGE 45 -SM_CYEDGE 46 -SM_CXMINSPACING 47 -SM_CYMINSPACING 48 -SM_CXSMICON 49 -SM_CYSMICON 50 -SM_CYSMCAPTION 51 -SM_CXSMSIZE 52 -SM_CYSMSIZE 53 -SM_CXMENUSIZE 54 -SM_CYMENUSIZE 55 -SM_ARRANGE 56 -SM_CXMINIMIZED 57 -SM_CYMINIMIZED 58 -SM_CXMAXTRACK 59 -SM_CYMAXTRACK 60 -SM_CXMAXIMIZED 61 -SM_CYMAXIMIZED 62 - */ - sysMetrics[SM_NETWORK] = 1; - sysMetrics[SM_CLEANBOOT] = 0; /* 0 - ok, 1 - failsafe, 2 - failsafe & net */ - /* -SM_CXDRAG 68 -SM_CYDRAG 69 - */ - sysMetrics[SM_SHOWSOUNDS] = 1; - /* -SM_CXMENUCHECK 71 -SM_CYMENUCHECK 72 - */ - sysMetrics[SM_SLOWMACHINE] = 0; /* FIXME: perhaps decide on type of proc */ - sysMetrics[SM_MIDEASTENABLED] = 0; /* FIXME: 1 if enabled */ + /* FIXME: What do these mean? */ + sysMetrics[SM_ARRANGE] = 8; + sysMetrics[SM_CXMINIMIZED] = 160; + sysMetrics[SM_CYMINIMIZED] = 24; + + /* FIXME: How do I calculate these? */ + sysMetrics[SM_CXMAXTRACK] = + sysMetrics[SM_CXSCREEN] + 4 + 2 * sysMetrics[SM_CXFRAME]; + sysMetrics[SM_CYMAXTRACK] = + sysMetrics[SM_CYSCREEN] + 4 + 2 * sysMetrics[SM_CYFRAME]; + sysMetrics[SM_CXMAXIMIZED] = + sysMetrics[SM_CXSCREEN] + 2 * sysMetrics[SM_CXFRAME]; + sysMetrics[SM_CYMAXIMIZED] = + sysMetrics[SM_CYSCREEN] - 45; + sysMetrics[SM_NETWORK] = 3; + + /* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */ + sysMetrics[SM_CLEANBOOT] = 0; + + sysMetrics[SM_CXDRAG] = 0; + sysMetrics[SM_CYDRAG] = 0; + sysMetrics[SM_SHOWSOUNDS] = 0; + sysMetrics[SM_CXMENUCHECK] = 2; + sysMetrics[SM_CYMENUCHECK] = 2; + + /* FIXME: Should check the type of processor for the following */ + sysMetrics[SM_SLOWMACHINE] = 0; + + /* FIXME: Should perform a check */ + sysMetrics[SM_MIDEASTENABLED] = 0; + + sysMetrics[SM_MOUSEWHEELPRESENT] = 0; sysMetrics[SM_CMETRICS] = SM_CMETRICS; - } diff --git a/windows/user.c b/windows/user.c index 72cd9b0d839..44edddf94ab 100644 --- a/windows/user.c +++ b/windows/user.c @@ -168,6 +168,17 @@ BOOL16 ExitWindows16( DWORD dwReturnCode, UINT16 wReserved ) } +/*********************************************************************** + * ExitWindowsExec16 (USER.246) + */ +BOOL16 ExitWindowsExec16( LPCSTR lpszExe, LPCSTR lpszParams ) +{ +fprintf(stdnimp, "ExitWindowsExec() : Should run the following in DOS-mode :\n\t\"%s %s\"\n", + lpszExe, lpszParams); + return ExitWindowsEx( EWX_LOGOFF, 0xffffffff ); +} + + /*********************************************************************** * ExitWindowsEx (USER32.195) */ diff --git a/windows/win.c b/windows/win.c index 087f942e5e7..371a47b7bf1 100644 --- a/windows/win.c +++ b/windows/win.c @@ -464,7 +464,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, CLASS *classPtr; WND *wndPtr; HWND16 hwnd, hwndLinkAfter; - POINT16 maxSize, maxPos, minTrack, maxTrack; + POINT32 maxSize, maxPos, minTrack, maxTrack; LRESULT (*localSend32)(HWND32, UINT32, WPARAM32, LPARAM); dprintf_win( stddeb, "CreateWindowEx: " ); @@ -615,7 +615,7 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD))) { - WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack ); + WINPOS_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack); if (maxSize.x < cs->cx) cs->cx = maxSize.x; if (maxSize.y < cs->cy) cs->cy = maxSize.y; if (cs->cx < minTrack.x ) cs->cx = minTrack.x; @@ -723,8 +723,8 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, { WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow, NULL, NULL, 0, &wndPtr->rectClient ); - OffsetRect16(&wndPtr->rectWindow, maxPos.x - wndPtr->rectWindow.left, - maxPos.y - wndPtr->rectWindow.top); + OffsetRect32(&wndPtr->rectWindow, maxPos.x - wndPtr->rectWindow.left, + maxPos.y - wndPtr->rectWindow.top); if( ((*localSend32)( hwnd, WM_CREATE, 0, (LPARAM)cs )) != -1 ) { /* Send the size messages */ @@ -732,11 +732,12 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom, if (!(wndPtr->flags & WIN_NEED_SIZE)) { /* send it anyway */ - SendMessage16( hwnd, WM_SIZE, SIZE_RESTORED, - MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, - wndPtr->rectClient.bottom-wndPtr->rectClient.top)); - SendMessage16( hwnd, WM_MOVE, 0, MAKELONG( wndPtr->rectClient.left, - wndPtr->rectClient.top )); + SendMessage32A( hwnd, WM_SIZE, SIZE_RESTORED, + MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, + wndPtr->rectClient.bottom-wndPtr->rectClient.top)); + SendMessage32A( hwnd, WM_MOVE, 0, + MAKELONG( wndPtr->rectClient.left, + wndPtr->rectClient.top ) ); } WIN_SendParentNotify( hwnd, WM_CREATE, wndPtr->wIDmenu, (LPARAM)hwnd ); @@ -2236,18 +2237,18 @@ HWND16 GetSysModalWindow16(void) BOOL16 DRAG_QueryUpdate( HWND32 hQueryWnd, SEGPTR spDragInfo, BOOL32 bNoSend ) { BOOL16 wParam,bResult = 0; - POINT16 pt; + POINT32 pt; LPDRAGINFO ptrDragInfo = (LPDRAGINFO) PTR_SEG_TO_LIN(spDragInfo); WND *ptrQueryWnd = WIN_FindWndPtr(hQueryWnd),*ptrWnd; - RECT16 tempRect; + RECT32 tempRect; if( !ptrQueryWnd || !ptrDragInfo ) return 0; - pt = ptrDragInfo->pt; + CONV_POINT16TO32( &ptrDragInfo->pt, &pt ); - GetWindowRect16(hQueryWnd,&tempRect); + GetWindowRect32(hQueryWnd,&tempRect); - if( !PtInRect16(&tempRect,pt) || + if( !PtInRect32(&tempRect,pt) || (ptrQueryWnd->dwStyle & WS_DISABLED) ) return 0; @@ -2255,19 +2256,18 @@ BOOL16 DRAG_QueryUpdate( HWND32 hQueryWnd, SEGPTR spDragInfo, BOOL32 bNoSend ) { tempRect = ptrQueryWnd->rectClient; if(ptrQueryWnd->dwStyle & WS_CHILD) - MapWindowPoints16(ptrQueryWnd->parent->hwndSelf,0,(LPPOINT16)&tempRect,2); + MapWindowPoints32( ptrQueryWnd->parent->hwndSelf, 0, + (LPPOINT32)&tempRect, 2 ); - if( PtInRect16(&tempRect,pt) ) + if (PtInRect32( &tempRect, pt)) { wParam = 0; for (ptrWnd = ptrQueryWnd->child; ptrWnd ;ptrWnd = ptrWnd->next) if( ptrWnd->dwStyle & WS_VISIBLE ) { - GetWindowRect16(ptrWnd->hwndSelf,&tempRect); - - if( PtInRect16(&tempRect,pt) ) - break; + GetWindowRect32( ptrWnd->hwndSelf, &tempRect ); + if (PtInRect32( &tempRect, pt )) break; } if(ptrWnd) @@ -2294,7 +2294,7 @@ BOOL16 DRAG_QueryUpdate( HWND32 hQueryWnd, SEGPTR spDragInfo, BOOL32 bNoSend ) : SendMessage16( hQueryWnd ,WM_QUERYDROPOBJECT , (WPARAM16)wParam ,(LPARAM) spDragInfo ); if( !bResult ) - ptrDragInfo->pt = pt; + CONV_POINT32TO16( &pt, &ptrDragInfo->pt ); return bResult; } diff --git a/windows/winpos.c b/windows/winpos.c index 3c4a46958e3..472b01138a1 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -53,9 +53,7 @@ /* ----- external functions ----- */ extern void FOCUS_SwitchFocus( HWND32 , HWND32 ); -extern HRGN32 DCE_GetVisRgn( HWND32, WORD ); extern HWND32 CARET_GetHwnd(); -extern BOOL32 DCE_InvalidateDCE(WND*, RECT16* ); /* ----- internal variables ----- */ @@ -221,7 +219,7 @@ void GetWindowRect16( HWND16 hwnd, LPRECT16 rect ) WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return; - *rect = wndPtr->rectWindow; + CONV_RECT32TO16( &wndPtr->rectWindow, rect ); if (wndPtr->dwStyle & WS_CHILD) MapWindowPoints16( wndPtr->parent->hwndSelf, 0, (POINT16 *)rect, 2 ); } @@ -235,7 +233,7 @@ void GetWindowRect32( HWND32 hwnd, LPRECT32 rect ) WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return; - CONV_RECT16TO32( &wndPtr->rectWindow, rect ); + *rect = wndPtr->rectWindow; if (wndPtr->dwStyle & WS_CHILD) MapWindowPoints32( wndPtr->parent->hwndSelf, 0, (POINT32 *)rect, 2 ); } @@ -415,11 +413,22 @@ HWND32 WindowFromPoint32( POINT32 pt ) * ChildWindowFromPoint16 (USER.191) */ HWND16 ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt ) +{ + POINT32 pt32; + CONV_POINT16TO32( &pt, &pt32 ); + return (HWND16)ChildWindowFromPoint32( hwndParent, pt32 ); +} + + +/******************************************************************* + * ChildWindowFromPoint32 (USER32.48) + */ +HWND32 ChildWindowFromPoint32( HWND32 hwndParent, POINT32 pt ) { /* pt is in the client coordinates */ WND* wnd = WIN_FindWndPtr(hwndParent); - RECT16 rect; + RECT32 rect; if( !wnd ) return 0; @@ -428,29 +437,18 @@ HWND16 ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt ) rect.right = wnd->rectClient.right - wnd->rectClient.left; rect.bottom = wnd->rectClient.bottom - wnd->rectClient.top; - if (!PtInRect16( &rect, pt )) return 0; + if (!PtInRect32( &rect, pt )) return 0; wnd = wnd->child; while ( wnd ) { - if (PtInRect16( &wnd->rectWindow, pt )) return wnd->hwndSelf; + if (PtInRect32( &wnd->rectWindow, pt )) return wnd->hwndSelf; wnd = wnd->next; } return hwndParent; } -/******************************************************************* - * ChildWindowFromPoint32 (USER32.) - */ -HWND32 ChildWindowFromPoint32( HWND32 hwndParent, POINT32 pt ) -{ - POINT16 pt16; - CONV_POINT32TO16( &pt, &pt16 ); - return (HWND32)ChildWindowFromPoint16( hwndParent, pt16 ); -} - - /******************************************************************* * WINPOS_GetWinOffset * @@ -660,10 +658,11 @@ BOOL32 MoveWindow32( /*********************************************************************** * WINPOS_InitInternalPos */ -static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT16 pt, - LPRECT16 restoreRect ) +static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT32 pt, + LPRECT32 restoreRect ) { - LPINTERNALPOS lpPos = (LPINTERNALPOS) GetProp32A( wnd->hwndSelf, atomInternalPos ); + LPINTERNALPOS lpPos = (LPINTERNALPOS) GetProp32A( wnd->hwndSelf, + atomInternalPos ); if( !lpPos ) { /* this happens when the window is minimized/maximized @@ -674,16 +673,16 @@ static LPINTERNALPOS WINPOS_InitInternalPos( WND* wnd, POINT16 pt, SetProp32A( wnd->hwndSelf, atomInternalPos, (HANDLE32)lpPos ); lpPos->hwndIconTitle = 0; /* defer until needs to be shown */ - lpPos->rectNormal = wnd->rectWindow; + CONV_RECT32TO16( &wnd->rectWindow, &lpPos->rectNormal ); *(UINT32*)&lpPos->ptIconPos = *(UINT32*)&lpPos->ptMaxPos = 0xFFFFFFFF; } if( wnd->dwStyle & WS_MINIMIZE ) - lpPos->ptIconPos = pt; + CONV_POINT32TO16( &pt, &lpPos->ptIconPos ); else if( wnd->dwStyle & WS_MAXIMIZE ) - lpPos->ptMaxPos = pt; + CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); else if( restoreRect ) - lpPos->rectNormal = *restoreRect; + CONV_RECT32TO16( restoreRect, &lpPos->rectNormal ); return lpPos; } @@ -727,7 +726,7 @@ BOOL32 WINPOS_ShowIconTitle( WND* pWnd, BOOL32 bShow ) if( !(pWnd->dwStyle & WS_VISIBLE) ) { - SendMessage16( hWnd, WM_SHOWWINDOW, TRUE, 0 ); + SendMessage32A( hWnd, WM_SHOWWINDOW, TRUE, 0 ); SetWindowPos32( hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW ); } @@ -742,23 +741,21 @@ BOOL32 WINPOS_ShowIconTitle( WND* pWnd, BOOL32 bShow ) * * Get the minimized and maximized information for a window. */ -void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT16 *maxSize, POINT16 *maxPos, - POINT16 *minTrack, POINT16 *maxTrack ) +void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT32 *maxSize, POINT32 *maxPos, + POINT32 *minTrack, POINT32 *maxTrack ) { LPINTERNALPOS lpPos; - MINMAXINFO16 *MinMax; - short xinc, yinc; + MINMAXINFO32 MinMax; + INT32 xinc, yinc; - if (!(MinMax = SEGPTR_NEW(MINMAXINFO16))) return; + /* Compute default values */ - /* Compute default values */ - - MinMax->ptMaxSize.x = SYSMETRICS_CXSCREEN; - MinMax->ptMaxSize.y = SYSMETRICS_CYSCREEN; - MinMax->ptMinTrackSize.x = SYSMETRICS_CXMINTRACK; - MinMax->ptMinTrackSize.y = SYSMETRICS_CYMINTRACK; - MinMax->ptMaxTrackSize.x = SYSMETRICS_CXSCREEN; - MinMax->ptMaxTrackSize.y = SYSMETRICS_CYSCREEN; + MinMax.ptMaxSize.x = SYSMETRICS_CXSCREEN; + MinMax.ptMaxSize.y = SYSMETRICS_CYSCREEN; + MinMax.ptMinTrackSize.x = SYSMETRICS_CXMINTRACK; + MinMax.ptMinTrackSize.y = SYSMETRICS_CYMINTRACK; + MinMax.ptMaxTrackSize.x = SYSMETRICS_CXSCREEN; + MinMax.ptMaxTrackSize.y = SYSMETRICS_CYSCREEN; if (wndPtr->flags & WIN_MANAGED) xinc = yinc = 0; else if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) @@ -780,38 +777,36 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT16 *maxSize, POINT16 *maxPos, yinc += SYSMETRICS_CYBORDER; } } - MinMax->ptMaxSize.x += 2 * xinc; - MinMax->ptMaxSize.y += 2 * yinc; + MinMax.ptMaxSize.x += 2 * xinc; + MinMax.ptMaxSize.y += 2 * yinc; lpPos = (LPINTERNALPOS)GetProp32A( wndPtr->hwndSelf, atomInternalPos ); if( lpPos && !EMPTYPOINT(lpPos->ptMaxPos) ) - MinMax->ptMaxPosition = lpPos->ptMaxPos; + CONV_POINT16TO32( &lpPos->ptMaxPos, &MinMax.ptMaxPosition ); else { - MinMax->ptMaxPosition.x = -xinc; - MinMax->ptMaxPosition.y = -yinc; + MinMax.ptMaxPosition.x = -xinc; + MinMax.ptMaxPosition.y = -yinc; } - SendMessage16( wndPtr->hwndSelf, WM_GETMINMAXINFO, 0, - (LPARAM)SEGPTR_GET(MinMax) ); + SendMessage32A( wndPtr->hwndSelf, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax ); /* Some sanity checks */ dprintf_win(stddeb,"GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n", - MinMax->ptMaxSize.x, MinMax->ptMaxSize.y, - MinMax->ptMaxPosition.x, MinMax->ptMaxPosition.y, - MinMax->ptMaxTrackSize.x, MinMax->ptMaxTrackSize.y, - MinMax->ptMinTrackSize.x, MinMax->ptMinTrackSize.y); - MinMax->ptMaxTrackSize.x = MAX( MinMax->ptMaxTrackSize.x, - MinMax->ptMinTrackSize.x ); - MinMax->ptMaxTrackSize.y = MAX( MinMax->ptMaxTrackSize.y, - MinMax->ptMinTrackSize.y ); + MinMax.ptMaxSize.x, MinMax.ptMaxSize.y, + MinMax.ptMaxPosition.x, MinMax.ptMaxPosition.y, + MinMax.ptMaxTrackSize.x, MinMax.ptMaxTrackSize.y, + MinMax.ptMinTrackSize.x, MinMax.ptMinTrackSize.y); + MinMax.ptMaxTrackSize.x = MAX( MinMax.ptMaxTrackSize.x, + MinMax.ptMinTrackSize.x ); + MinMax.ptMaxTrackSize.y = MAX( MinMax.ptMaxTrackSize.y, + MinMax.ptMinTrackSize.y ); - if (maxSize) *maxSize = MinMax->ptMaxSize; - if (maxPos) *maxPos = MinMax->ptMaxPosition; - if (minTrack) *minTrack = MinMax->ptMinTrackSize; - if (maxTrack) *maxTrack = MinMax->ptMaxTrackSize; - SEGPTR_FREE(MinMax); + if (maxSize) *maxSize = MinMax.ptMaxSize; + if (maxPos) *maxPos = MinMax.ptMaxPosition; + if (minTrack) *minTrack = MinMax.ptMinTrackSize; + if (maxTrack) *maxTrack = MinMax.ptMaxTrackSize; } /*********************************************************************** @@ -823,13 +818,15 @@ void WINPOS_GetMinMaxInfo( WND *wndPtr, POINT16 *maxSize, POINT16 *maxPos, */ UINT16 WINPOS_MinMaximize( WND* wndPtr, UINT16 cmd, LPRECT16 lpRect ) { - UINT16 swpFlags = 0; - POINT16 size = { wndPtr->rectWindow.left, wndPtr->rectWindow.top }; - LPINTERNALPOS lpPos = WINPOS_InitInternalPos( wndPtr, size, &wndPtr->rectWindow ); + UINT16 swpFlags = 0; + POINT32 pt; + POINT32 size = { wndPtr->rectWindow.left, wndPtr->rectWindow.top }; + LPINTERNALPOS lpPos = WINPOS_InitInternalPos( wndPtr, size, + &wndPtr->rectWindow ); dprintf_win(stddeb,"MinMaximize: 0x%04x %u\n", wndPtr->hwndSelf, cmd ); - if( lpPos && !HOOK_CallHooks16( WH_CBT, HCBT_MINMAX, wndPtr->hwndSelf, cmd) ) + if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, wndPtr->hwndSelf, cmd)) { if( wndPtr->dwStyle & WS_MINIMIZE ) { @@ -857,7 +854,9 @@ UINT16 WINPOS_MinMaximize( WND* wndPtr, UINT16 cmd, LPRECT16 lpRect ) break; case SW_MAXIMIZE: - WINPOS_GetMinMaxInfo( wndPtr, &size, &lpPos->ptMaxPos, NULL, NULL ); + CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); + WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL ); + CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); if( wndPtr->dwStyle & WS_MINIMIZE ) { @@ -878,7 +877,9 @@ UINT16 WINPOS_MinMaximize( WND* wndPtr, UINT16 cmd, LPRECT16 lpRect ) if( wndPtr->flags & WIN_RESTORE_MAX) { /* Restore to maximized position */ - WINPOS_GetMinMaxInfo( wndPtr, &size, &lpPos->ptMaxPos, NULL, NULL ); + CONV_POINT16TO32( &lpPos->ptMaxPos, &pt ); + WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL); + CONV_POINT32TO16( &pt, &lpPos->ptMaxPos ); wndPtr->dwStyle |= WS_MAXIMIZE; } } @@ -974,7 +975,7 @@ BOOL32 ShowWindow32( HWND32 hwnd, INT32 cmd ) showFlag = (cmd != SW_HIDE); if (showFlag != wasVisible) { - SendMessage16( hwnd, WM_SHOWWINDOW, showFlag, 0 ); + SendMessage32A( hwnd, WM_SHOWWINDOW, showFlag, 0 ); if (!IsWindow32( hwnd )) return wasVisible; } @@ -1004,10 +1005,10 @@ BOOL32 ShowWindow32( HWND32 hwnd, INT32 cmd ) wndPtr->flags &= ~WIN_NEED_SIZE; if (wndPtr->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED; else if (wndPtr->dwStyle & WS_MINIMIZE) wParam = SIZE_MINIMIZED; - SendMessage16( hwnd, WM_SIZE, wParam, + SendMessage32A( hwnd, WM_SIZE, wParam, MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, wndPtr->rectClient.bottom-wndPtr->rectClient.top)); - SendMessage16( hwnd, WM_MOVE, 0, + SendMessage32A( hwnd, WM_MOVE, 0, MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) ); } @@ -1055,7 +1056,7 @@ BOOL16 GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wndpl ) if( pWnd ) { LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd, - *(LPPOINT16)&pWnd->rectWindow.left, &pWnd->rectWindow ); + *(LPPOINT32)&pWnd->rectWindow.left, &pWnd->rectWindow ); wndpl->length = sizeof(*wndpl); if( pWnd->dwStyle & WS_MINIMIZE ) wndpl->showCmd = SW_SHOWMAXIMIZED; @@ -1109,7 +1110,7 @@ static BOOL32 WINPOS_SetPlacement( HWND32 hwnd, const WINDOWPLACEMENT16 *wndpl, if( pWnd ) { LPINTERNALPOS lpPos = (LPINTERNALPOS)WINPOS_InitInternalPos( pWnd, - *(LPPOINT16)&pWnd->rectWindow.left, &pWnd->rectWindow ); + *(LPPOINT32)&pWnd->rectWindow.left, &pWnd->rectWindow ); if( flags & PLACE_MIN ) lpPos->ptIconPos = wndpl->ptMinPosition; if( flags & PLACE_MAX ) lpPos->ptMaxPos = wndpl->ptMaxPosition; @@ -1308,13 +1309,13 @@ BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse, BOOL32 fChangeFocus) /* set prev active wnd to current active wnd and send notification */ if ((hwndPrevActive = hwndActive) && IsWindow32(hwndPrevActive)) { - if (!SendMessage16( hwndPrevActive, WM_NCACTIVATE, FALSE, 0 )) + if (!SendMessage32A( hwndPrevActive, WM_NCACTIVATE, FALSE, 0 )) { if (GetSysModalWindow16() != hWnd) return 0; /* disregard refusal if hWnd is sysmodal */ } -#if 0 +#if 1 SendMessage32A( hwndPrevActive, WM_ACTIVATE, MAKEWPARAM( WA_INACTIVE, wIconized ), (LPARAM)hWnd ); @@ -1399,8 +1400,8 @@ BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse, BOOL32 fChangeFocus) wndTemp->hwndLastActive = hWnd; wIconized = HIWORD(wndTemp->dwStyle & WS_MINIMIZE); - SendMessage16( hWnd, WM_NCACTIVATE, TRUE, 0 ); -#if 0 + SendMessage32A( hWnd, WM_NCACTIVATE, TRUE, 0 ); +#if 1 SendMessage32A( hWnd, WM_ACTIVATE, MAKEWPARAM( (fMouse) ? WA_CLICKACTIVE : WA_ACTIVE, wIconized), (LPARAM)hwndPrevActive ); @@ -1487,7 +1488,7 @@ BOOL32 WINPOS_ChangeActiveWindow( HWND32 hWnd, BOOL32 mouseMsg ) /* child windows get WM_CHILDACTIVATE message */ if( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD ) - return SendMessage16(hWnd, WM_CHILDACTIVATE, 0, 0L); + return SendMessage32A(hWnd, WM_CHILDACTIVATE, 0, 0L); /* owned popups imply owner activation - not sure */ if ((wndPtr->dwStyle & WS_POPUP) && wndPtr->owner && @@ -1519,28 +1520,26 @@ BOOL32 WINPOS_ChangeActiveWindow( HWND32 hWnd, BOOL32 mouseMsg ) * when calcValidRect is TRUE. */ LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect, - RECT16 *newWindowRect, RECT16 *oldWindowRect, - RECT16 *oldClientRect, SEGPTR winpos, - RECT16 *newClientRect ) + RECT32 *newWindowRect, RECT32 *oldWindowRect, + RECT32 *oldClientRect, WINDOWPOS32 *winpos, + RECT32 *newClientRect ) { - NCCALCSIZE_PARAMS16 *params; + NCCALCSIZE_PARAMS32 params; LONG result; - if (!(params = SEGPTR_NEW(NCCALCSIZE_PARAMS16))) return 0; - params->rgrc[0] = *newWindowRect; + params.rgrc[0] = *newWindowRect; if (calcValidRect) { - params->rgrc[1] = *oldWindowRect; - params->rgrc[2] = *oldClientRect; - params->lppos = winpos; + params.rgrc[1] = *oldWindowRect; + params.rgrc[2] = *oldClientRect; + params.lppos = winpos; } - result = SendMessage16( hwnd, WM_NCCALCSIZE, calcValidRect, - (LPARAM)SEGPTR_GET( params ) ); + result = SendMessage32A( hwnd, WM_NCCALCSIZE, calcValidRect, + (LPARAM)¶ms ); dprintf_win( stddeb, "WINPOS_SendNCCalcSize: %d,%d-%d,%d\n", - params->rgrc[0].left, params->rgrc[0].top, - params->rgrc[0].right, params->rgrc[0].bottom ); - *newClientRect = params->rgrc[0]; - SEGPTR_FREE(params); + params.rgrc[0].left, params.rgrc[0].top, + params.rgrc[0].right, params.rgrc[0].bottom ); + *newClientRect = params.rgrc[0]; return result; } @@ -1552,7 +1551,7 @@ LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect, */ LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos ) { - POINT16 maxSize; + POINT32 maxSize; if (winpos->flags & SWP_NOSIZE) return 0; if ((wndPtr->dwStyle & WS_THICKFRAME) || ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0)) @@ -1572,7 +1571,7 @@ LONG WINPOS_HandleWindowPosChanging16( WND *wndPtr, WINDOWPOS16 *winpos ) */ LONG WINPOS_HandleWindowPosChanging32( WND *wndPtr, WINDOWPOS32 *winpos ) { - POINT16 maxSize; + POINT32 maxSize; if (winpos->flags & SWP_NOSIZE) return 0; if ((wndPtr->dwStyle & WS_THICKFRAME) || ((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0)) @@ -1724,7 +1723,9 @@ HWND32 WINPOS_ReorderOwnedPopups(HWND32 hwndInsertAfter,WND* wndPtr,WORD flags) * FIXME: Move visible and update regions to the same coordinate system * (either parent client or window). This is a lot of work though. */ -static UINT32 WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWndRect, LPRECT16 lpOldClientRect, UINT32 uFlags ) +static UINT32 WINPOS_SizeMoveClean( WND* Wnd, HRGN32 oldVisRgn, + LPRECT32 lpOldWndRect, + LPRECT32 lpOldClientRect, UINT32 uFlags ) { HRGN32 newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf,DCX_WINDOW | DCX_CLIPSIBLINGS); HRGN32 dirtyRgn = CreateRectRgn32(0,0,0,0); @@ -1732,10 +1733,14 @@ static UINT32 WINPOS_SizeMoveClean(WND* Wnd, HRGN32 oldVisRgn, LPRECT16 lpOldWnd dprintf_win(stddeb,"cleaning up...new wnd=(%i %i-%i %i) old wnd=(%i %i-%i %i)\n\ \t\tnew client=(%i %i-%i %i) old client=(%i %i-%i %i)\n", - Wnd->rectWindow.left, Wnd->rectWindow.top, Wnd->rectWindow.right, Wnd->rectWindow.bottom, - lpOldWndRect->left, lpOldWndRect->top, lpOldWndRect->right, lpOldWndRect->bottom, - Wnd->rectClient.left,Wnd->rectClient.top,Wnd->rectClient.right,Wnd->rectClient.bottom, - lpOldClientRect->left,lpOldClientRect->top,lpOldClientRect->right,lpOldClientRect->bottom); + Wnd->rectWindow.left, Wnd->rectWindow.top, + Wnd->rectWindow.right, Wnd->rectWindow.bottom, + lpOldWndRect->left, lpOldWndRect->top, + lpOldWndRect->right, lpOldWndRect->bottom, + Wnd->rectClient.left, Wnd->rectClient.top, + Wnd->rectClient.right, Wnd->rectClient.bottom, + lpOldClientRect->left, lpOldClientRect->top, + lpOldClientRect->right,lpOldClientRect->bottom ); if( (lpOldWndRect->right - lpOldWndRect->left) != (Wnd->rectWindow.right - Wnd->rectWindow.left) || (lpOldWndRect->bottom - lpOldWndRect->top) != (Wnd->rectWindow.bottom - Wnd->rectWindow.top) ) @@ -1878,7 +1883,7 @@ static Window WINPOS_FindDeskTopXWindow( WND *wndPtr ) * * SetWindowPos() for an X window. Used by the real SetWindowPos(). */ -static void WINPOS_SetXWindowPos( WINDOWPOS16 *winpos ) +static void WINPOS_SetXWindowPos( const WINDOWPOS32 *winpos ) { XWindowChanges winChanges; int changeMask = 0; @@ -1958,9 +1963,9 @@ BOOL16 SetWindowPos16( HWND16 hwnd, HWND16 hwndInsertAfter, INT16 x, INT16 y, BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, INT32 cx, INT32 cy, WORD flags ) { - WINDOWPOS16 *winpos; + WINDOWPOS32 winpos; WND * wndPtr; - RECT16 newWindowRect, newClientRect, oldWindowRect; + RECT32 newWindowRect, newClientRect, oldWindowRect; HRGN32 visRgn = 0; HWND32 tempInsertAfter= 0; int result = 0; @@ -2030,20 +2035,18 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, /* Fill the WINDOWPOS structure */ - if (!(winpos = SEGPTR_NEW(WINDOWPOS16))) return FALSE; - winpos->hwnd = hwnd; - winpos->hwndInsertAfter = hwndInsertAfter; - winpos->x = x; - winpos->y = y; - winpos->cx = cx; - winpos->cy = cy; - winpos->flags = flags; + winpos.hwnd = hwnd; + winpos.hwndInsertAfter = hwndInsertAfter; + winpos.x = x; + winpos.y = y; + winpos.cx = cx; + winpos.cy = cy; + winpos.flags = flags; /* Send WM_WINDOWPOSCHANGING message */ if (!(flags & SWP_NOSENDCHANGING)) - SendMessage16( hwnd, WM_WINDOWPOSCHANGING, 0, - (LPARAM)SEGPTR_GET(winpos) ); + SendMessage32A( hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)&winpos ); /* Calculate new position and size */ @@ -2051,27 +2054,27 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, newClientRect = (wndPtr->dwStyle & WS_MINIMIZE) ? wndPtr->rectWindow : wndPtr->rectClient; - if (!(winpos->flags & SWP_NOSIZE)) + if (!(winpos.flags & SWP_NOSIZE)) { - newWindowRect.right = newWindowRect.left + winpos->cx; - newWindowRect.bottom = newWindowRect.top + winpos->cy; + newWindowRect.right = newWindowRect.left + winpos.cx; + newWindowRect.bottom = newWindowRect.top + winpos.cy; } - if (!(winpos->flags & SWP_NOMOVE)) + if (!(winpos.flags & SWP_NOMOVE)) { - newWindowRect.left = winpos->x; - newWindowRect.top = winpos->y; - newWindowRect.right += winpos->x - wndPtr->rectWindow.left; - newWindowRect.bottom += winpos->y - wndPtr->rectWindow.top; + newWindowRect.left = winpos.x; + newWindowRect.top = winpos.y; + newWindowRect.right += winpos.x - wndPtr->rectWindow.left; + newWindowRect.bottom += winpos.y - wndPtr->rectWindow.top; - OffsetRect16( &newClientRect, winpos->x - wndPtr->rectWindow.left, - winpos->y - wndPtr->rectWindow.top ); + OffsetRect32( &newClientRect, winpos.x - wndPtr->rectWindow.left, + winpos.y - wndPtr->rectWindow.top ); } - winpos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; + winpos.flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; /* Reposition window in Z order */ - if (!(winpos->flags & SWP_NOZORDER)) + if (!(winpos.flags & SWP_NOZORDER)) { /* reorder owned popups if hwnd is top-level window */ @@ -2081,10 +2084,10 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, if (wndPtr->window) { - WIN_UnlinkWindow( winpos->hwnd ); - WIN_LinkWindow( winpos->hwnd, hwndInsertAfter ); + WIN_UnlinkWindow( winpos.hwnd ); + WIN_LinkWindow( winpos.hwnd, hwndInsertAfter ); } - else WINPOS_MoveWindowZOrder( winpos->hwnd, hwndInsertAfter ); + else WINPOS_MoveWindowZOrder( winpos.hwnd, hwndInsertAfter ); } if ( !wndPtr->window && !(flags & SWP_NOREDRAW) && @@ -2095,36 +2098,36 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, /* Send WM_NCCALCSIZE message to get new client area */ if( (flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE ) { - result = WINPOS_SendNCCalcSize( winpos->hwnd, TRUE, &newWindowRect, + result = WINPOS_SendNCCalcSize( winpos.hwnd, TRUE, &newWindowRect, &wndPtr->rectWindow, &wndPtr->rectClient, - SEGPTR_GET(winpos), &newClientRect ); + &winpos, &newClientRect ); /* FIXME: WVR_ALIGNxxx */ if( newClientRect.left != wndPtr->rectClient.left || newClientRect.top != wndPtr->rectClient.top ) - winpos->flags &= ~SWP_NOCLIENTMOVE; + winpos.flags &= ~SWP_NOCLIENTMOVE; if( (newClientRect.right - newClientRect.left != wndPtr->rectClient.right - wndPtr->rectClient.left) || (newClientRect.bottom - newClientRect.top != wndPtr->rectClient.bottom - wndPtr->rectClient.top) ) - winpos->flags &= ~SWP_NOCLIENTSIZE; + winpos.flags &= ~SWP_NOCLIENTSIZE; } else if( !(flags & SWP_NOMOVE) && (newClientRect.left != wndPtr->rectClient.left || newClientRect.top != wndPtr->rectClient.top) ) - winpos->flags &= ~SWP_NOCLIENTMOVE; + winpos.flags &= ~SWP_NOCLIENTMOVE; /* Update active DCEs */ if( !(flags & SWP_NOZORDER) || (flags & SWP_HIDEWINDOW) || (flags & SWP_SHOWWINDOW) - || (memcmp(&newWindowRect,&wndPtr->rectWindow,sizeof(RECT16)) + || (memcmp(&newWindowRect,&wndPtr->rectWindow,sizeof(newWindowRect)) && wndPtr->dwStyle & WS_VISIBLE ) ) { - RECT16 rect; + RECT32 rect; - UnionRect16(&rect,&newWindowRect,&wndPtr->rectWindow); + UnionRect32(&rect,&newWindowRect,&wndPtr->rectWindow); DCE_InvalidateDCE(wndPtr->parent, &rect); } @@ -2134,18 +2137,18 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, if (wndPtr->window) { - RECT16 oldClientRect = wndPtr->rectClient; + RECT32 oldClientRect = wndPtr->rectClient; - tempInsertAfter = winpos->hwndInsertAfter; + tempInsertAfter = winpos.hwndInsertAfter; - winpos->hwndInsertAfter = hwndInsertAfter; + winpos.hwndInsertAfter = hwndInsertAfter; /* postpone geometry change */ if( !(flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW)) ) { - WINPOS_SetXWindowPos( winpos ); - winpos->hwndInsertAfter = tempInsertAfter; + WINPOS_SetXWindowPos( &winpos ); + winpos.hwndInsertAfter = tempInsertAfter; } else uFlags |= SMC_SETXPOS; @@ -2156,12 +2159,13 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, if( (oldClientRect.left - oldWindowRect.left != newClientRect.left - newWindowRect.left) || (oldClientRect.top - oldWindowRect.top != - newClientRect.top - newWindowRect.top) || winpos->flags & SWP_NOCOPYBITS ) + newClientRect.top - newWindowRect.top) || + winpos.flags & SWP_NOCOPYBITS ) PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE, 0 ); else - if( winpos->flags & SWP_FRAMECHANGED ) + if( winpos.flags & SWP_FRAMECHANGED ) { WORD wErase = 0; RECT32 rect; @@ -2188,7 +2192,7 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, } else { - RECT16 oldClientRect = wndPtr->rectClient; + RECT32 oldClientRect = wndPtr->rectClient; wndPtr->rectWindow = newWindowRect; wndPtr->rectClient = newClientRect; @@ -2201,19 +2205,19 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, if( !(flags & (SWP_NOREDRAW | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) ) { - uFlags |= ((winpos->flags & SWP_NOCOPYBITS) || + uFlags |= ((winpos.flags & SWP_NOCOPYBITS) || (result >= WVR_HREDRAW && result < WVR_VALIDRECTS)) ? SMC_NOCOPY : 0; - uFlags |= (winpos->flags & SWP_FRAMECHANGED) ? SMC_DRAWFRAME : 0; + uFlags |= (winpos.flags & SWP_FRAMECHANGED) ? SMC_DRAWFRAME : 0; - if( (winpos->flags & SWP_AGG_NOGEOMETRYCHANGE) != SWP_AGG_NOGEOMETRYCHANGE ) + if( (winpos.flags & SWP_AGG_NOGEOMETRYCHANGE) != SWP_AGG_NOGEOMETRYCHANGE ) uFlags = WINPOS_SizeMoveClean(wndPtr, visRgn, &oldWindowRect, &oldClientRect, uFlags); else { /* adjust frame and do not erase parent */ - if( winpos->flags & SWP_FRAMECHANGED ) wndPtr->flags |= WIN_NEEDS_NCPAINT; - if( winpos->flags & SWP_NOZORDER ) uFlags |= SMC_NOPARENTERASE; + if( winpos.flags & SWP_FRAMECHANGED ) wndPtr->flags |= WIN_NEEDS_NCPAINT; + if( winpos.flags & SWP_NOZORDER ) uFlags |= SMC_NOPARENTERASE; } } DeleteObject32(visRgn); @@ -2226,15 +2230,15 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, { if( uFlags & SMC_SETXPOS ) { - WINPOS_SetXWindowPos( winpos ); - winpos->hwndInsertAfter = tempInsertAfter; + WINPOS_SetXWindowPos( &winpos ); + winpos.hwndInsertAfter = tempInsertAfter; } XMapWindow( display, wndPtr->window ); } else { if (!(flags & SWP_NOREDRAW)) - PAINT_RedrawWindow( winpos->hwnd, NULL, 0, + PAINT_RedrawWindow( winpos.hwnd, NULL, 0, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASENOW | RDW_ERASE, 0 ); } @@ -2247,38 +2251,35 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, XUnmapWindow( display, wndPtr->window ); if( uFlags & SMC_SETXPOS ) { - WINPOS_SetXWindowPos( winpos ); - winpos->hwndInsertAfter = tempInsertAfter; + WINPOS_SetXWindowPos( &winpos ); + winpos.hwndInsertAfter = tempInsertAfter; } } else { if (!(flags & SWP_NOREDRAW)) - { - RECT32 rect = { oldWindowRect.left, oldWindowRect.top, - oldWindowRect.right, oldWindowRect.bottom }; - PAINT_RedrawWindow( wndPtr->parent->hwndSelf, &rect, 0, - RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | RDW_ERASENOW, 0); - } + PAINT_RedrawWindow( wndPtr->parent->hwndSelf, &oldWindowRect, + 0, RDW_INVALIDATE | RDW_ALLCHILDREN | + RDW_ERASE | RDW_ERASENOW, 0 ); uFlags |= SMC_NOPARENTERASE; } - if ((winpos->hwnd == GetFocus32()) || - IsChild32( winpos->hwnd, GetFocus32())) + if ((winpos.hwnd == GetFocus32()) || + IsChild32( winpos.hwnd, GetFocus32())) { /* Revert focus to parent */ - SetFocus32( GetParent32(winpos->hwnd) ); + SetFocus32( GetParent32(winpos.hwnd) ); } if (hwnd == CARET_GetHwnd()) DestroyCaret32(); - if (winpos->hwnd == hwndActive) + if (winpos.hwnd == hwndActive) { /* Activate previously active window if possible */ HWND32 newActive = hwndPrevActive; - if (!IsWindow32(newActive) || (newActive == winpos->hwnd)) + if (!IsWindow32(newActive) || (newActive == winpos.hwnd)) { newActive = GetTopWindow32( GetDesktopWindow32() ); - if (newActive == winpos->hwnd) + if (newActive == winpos.hwnd) newActive = wndPtr->next ? wndPtr->next->hwndSelf : 0; } WINPOS_ChangeActiveWindow( newActive, FALSE ); @@ -2288,7 +2289,7 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, /* Activate the window */ if (!(flags & SWP_NOACTIVATE)) - WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE ); + WINPOS_ChangeActiveWindow( winpos.hwnd, FALSE ); /* Repaint the window */ @@ -2299,11 +2300,10 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, if (!(flags & SWP_DEFERERASE) && !(uFlags & SMC_NOPARENTERASE) ) { - RECT32 rect; - CONV_RECT16TO32( &oldWindowRect, &rect ); - PAINT_RedrawWindow( wndPtr->parent->hwndSelf, (wndPtr->flags & WIN_SAVEUNDER_OVERRIDE) - ? &rect : NULL, 0, RDW_ALLCHILDREN | RDW_ERASENOW | - ((wndPtr->flags & WIN_SAVEUNDER_OVERRIDE) ? RDW_INVALIDATE : 0), 0 ); + PAINT_RedrawWindow( wndPtr->parent->hwndSelf, + (wndPtr->flags & WIN_SAVEUNDER_OVERRIDE) ? &oldWindowRect : NULL, + 0, RDW_ALLCHILDREN | RDW_ERASENOW | + ((wndPtr->flags & WIN_SAVEUNDER_OVERRIDE) ? RDW_INVALIDATE : 0), 0 ); wndPtr->flags &= ~WIN_SAVEUNDER_OVERRIDE; } else if( wndPtr->parent == WIN_GetDesktop() && wndPtr->parent->flags & WIN_NEEDS_ERASEBKGND ) @@ -2311,14 +2311,13 @@ BOOL32 SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, INT32 x, INT32 y, /* And last, send the WM_WINDOWPOSCHANGED message */ - dprintf_win(stddeb,"\tstatus flags = %04x\n", winpos->flags & SWP_AGG_STATUSFLAGS); + dprintf_win(stddeb,"\tstatus flags = %04x\n", winpos.flags & SWP_AGG_STATUSFLAGS); - if ( ((winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) && - !(winpos->flags & SWP_NOSENDCHANGING)) - SendMessage16( winpos->hwnd, WM_WINDOWPOSCHANGED, - 0, (LPARAM)SEGPTR_GET(winpos) ); + if ( ((winpos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) && + !(winpos.flags & SWP_NOSENDCHANGING)) + SendMessage32A( winpos.hwnd, WM_WINDOWPOSCHANGED, + 0, (LPARAM)&winpos ); - SEGPTR_FREE(winpos); return TRUE; } diff --git a/windows/winproc.c b/windows/winproc.c index 9e7e3b3a89d..10139e6d4ea 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -1848,11 +1848,12 @@ LRESULT CallWindowProc16( WNDPROC16 func, HWND16 hwnd, UINT16 msg, { LRESULT result; WND *wndPtr; + WORD ds; WINDOWPROC *proc = WINPROC_GetPtr( func ); - WORD ds = CURRENT_DS; if (!proc) { + ds = CURRENT_DS; wndPtr = WIN_FindWndPtr( hwnd ); if (wndPtr) CURRENT_DS = wndPtr->hInstance; result = WINPROC_CallWndProc16Ptr( func, hwnd, msg, wParam, lParam ); @@ -1872,6 +1873,7 @@ LRESULT CallWindowProc16( WNDPROC16 func, HWND16 hwnd, UINT16 msg, { case WIN_PROC_16: if (!proc->thunk.t_from32.proc) return 0; + ds = CURRENT_DS; wndPtr = WIN_FindWndPtr( hwnd ); if (wndPtr) CURRENT_DS = wndPtr->hInstance; result = WINPROC_CallWndProc16Ptr( proc->thunk.t_from32.proc, diff --git a/wine.man b/wine.man index 0f36fdbf76e..c4d24ebae81 100644 --- a/wine.man +++ b/wine.man @@ -33,7 +33,7 @@ to compile At present, .B wine will run under any Linux kernel more recent than 0.99.13, or -under recent releases of NetBSD and FreeBSD. +under recent releases of NetBSD/i386, FreeBSD and OpenBSD/i386. .PP .B X must be installed.