From e2bfa4c722de7af8ca3ce9fe397e110ce5e53277 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 16 May 1996 18:21:06 +0000 Subject: [PATCH] Release 960516 Thu May 16 13:35:31 1996 Alexandre Julliard * [*/*.c] Renamed RECT, POINT and SIZE structures to RECT16, POINT16 and SIZE16. Implemented Win32 version of most functions that take these types as parameters. * [configure] Patched autoconf to attempt to correctly detect -lnsl and -lsocket. Please check this out. * [controls/button.c] Added support for Win32 BM_* messages. * [controls/menu.c] Avoid sending extra WM_MENUSELECT messages. This avoids crashes with Excel. * [memory.heap.c] [include/heap.h] Added support for SEGPTRs in Win32 heaps. Added a few macros to make using SEGPTRs easier. They are a bit slower than MAKE_SEGPTR, but they work with Win32. * [memory/atom.c] Implemented Win32 atom functions. * [memory/local.c] Fixed LocalReAlloc() changes to avoid copying the whole block twice. * [win32/memory.c] Use /dev/zero instead of MAP_ANON for VirtualAlloc(). * [windows/class.c] Properly implemented the Win32 class functions. * [windows/winproc.c] (New file) New file handling the message translation between Win16 and Win32. Mon May 13 18:00:00 1996 Alex Korobka * [windows/mdi.c] [windows/menu.c] Improved WM_MDICREATE and WM_MDICASCADE handling. * [windows/event.c] [objects/bitblt.c] Handle GraphicsExpose event for BitBlt from screen to screen. * [windows/event.c] [windows/win.c] [windows/nonclient.c] Bunch of fixes for problems with -managed. * [windows/win.c] [windows/winpos.c] Changed conditions for WM_SIZE, WM_MOVE, and WM_GETMINMAXINFO in CreateWindow. * [windows/win.c] [windows/queue.c] [misc/user.c] Do not send WM_PARENTNOTIFY when in AppExit and call WH_SHELL on window creation/destruction. * [objects/palette.c] Crude RealizePalette(). At least something is visible in LviewPro. Sun May 12 02:05:00 1996 Thomas Sandford * [if1632/gdi32.spec] Added Rectangle (use win16 version). * [if1632/kernel32.spec] Added GetWindowsDirectoryA (use win16 GetWindowsDirectory). * [if1632/user32.spec] Added GetSubMenu, MoveWindow, SetScrollPos, SetScrollRange (use win16 versions). Added SetWindowsHookExA (empty stub for now). * [include/handle32.h] Changed #include to #include to prevent hate message from FreeBSD compiler. * [win32/newfns.c] Added new function SetWindowsHookEx32A (empty stub for now). * [win32/user32.c] Removed redundant debugging printf statement. Sun May 12 01:24:57 1996 Huw D. M. Davies * [memory/local.c] Avoid creating adjacent free blocks. Free the block in LocalReAlloc() before allocating a new one. Fixed LocalReAlloc() for discarded blocks. Fri May 10 23:05:12 1996 Jukka Iivonen * [resources/sysres_Fi.rc] ChooseFont and ChooseColor dialogs updated. Fri May 10 17:19:33 1996 Marcus Meissner * [files/drive.c,if1632/kernel.spec] GetCurrentDirectory(),SetCurrentDirectory() implemented. * [if1632/advapi32.spec] [if1632/kernel.spec] [if1632/shell.spec] [include/windows.h] [include/winreg.h] [loader/main.c] [misc/main.c] [misc/shell.c] [misc/registry.c] Registry fixes: - loads win95 registry databases, - save only updated keys on default, - now adhers to the new function naming standard, - minor cleanups. Tue May 7 22:36:13 1996 Albrecht Kleine * [combo.c] Added WM_COMMAND-handling for interaction between EDIT and COMBOLBOX and synchronized mine with Greg Kreider's works. * [commdlg.c] Bugfix in ChooseFont: font size handling. --- ANNOUNCE | 18 +- ChangeLog | 119 +++++ README | 5 + configure | 142 ++++-- controls/button.c | 131 ++--- controls/combo.c | 311 +++++++----- controls/desktop.c | 6 +- controls/edit.c | 81 +-- controls/listbox.c | 144 +++--- controls/menu.c | 268 +++++----- controls/scroll.c | 54 +- controls/static.c | 55 +- controls/widgets.c | 30 +- files/drive.c | 25 + if1632/Makefile.in | 3 +- if1632/advapi32.spec | 61 ++- if1632/callback.c | 29 -- if1632/gdi.spec | 76 +-- if1632/gdi32.spec | 64 +-- if1632/kernel.spec | 24 +- if1632/kernel32.spec | 16 +- if1632/mmsystem.spec | 2 +- if1632/relay32.c | 87 ---- if1632/shell.spec | 12 +- if1632/user.spec | 108 ++-- if1632/user32.spec | 159 +++--- include/bitmap.h | 2 +- include/callback.h | 13 +- include/class.h | 13 +- include/color.h | 2 +- include/combo.h | 20 +- include/desktop.h | 2 +- include/font.h | 2 +- include/gdi.h | 12 +- include/graphics.h | 2 +- include/handle32.h | 2 +- include/heap.h | 18 + include/listbox.h | 6 +- include/mdi.h | 23 +- include/menu.h | 6 +- include/metafile.h | 6 +- include/mmsystem.h | 18 +- include/module.h | 4 +- include/nonclient.h | 11 +- include/ole.h | 10 +- include/pen.h | 2 +- include/regfunc.h | 22 - include/region.h | 2 +- include/relay32.h | 31 -- include/scroll.h | 2 +- include/shell.h | 2 +- include/string32.h | 1 + include/struct32.h | 107 +--- include/syscolor.h | 4 +- include/win.h | 21 +- include/winbase.h | 2 +- include/windows.h | 955 +++++++++++++++++++++++++---------- include/winnt.h | 3 +- include/winpos.h | 12 +- include/winreg.h | 1 + include/wintypes.h | 33 +- include/winuser.h | 36 +- library/Makefile.in | 2 - library/atom.c | 341 ------------- library/heap.c | 340 ------------- library/miscstubs.c | 88 ---- library/sup.c | 6 - loader/main.c | 8 +- loader/module.c | 4 +- loader/pe_image.c | 1 - loader/signal.c | 4 - memory/atom.c | 141 ++++-- memory/global.c | 4 +- memory/heap.c | 123 ++++- memory/local.c | 157 ++++-- misc/commdlg.c | 252 +++++----- misc/exec.c | 7 +- misc/main.c | 19 +- misc/rect.c | 237 +++++++-- misc/registry.c | 1075 ++++++++++++++++++++++++++++++---------- misc/shell.c | 142 +++++- misc/spy.c | 9 +- misc/user.c | 7 +- misc/ver.c | 4 +- misc/winsocket.c | 2 +- multimedia/mmsystem.c | 8 - objects/bitblt.c | 54 +- objects/bitmap.c | 57 ++- objects/clipping.c | 44 +- objects/color.c | 6 +- objects/cursoricon.c | 55 +- objects/dcvalues.c | 11 +- objects/font.c | 80 ++- objects/gdiobj.c | 34 +- objects/metafile.c | 32 +- objects/oembitmap.c | 4 +- objects/palette.c | 60 ++- objects/pen.c | 10 +- objects/region.c | 118 +++-- objects/text.c | 155 ++++-- resources/sysres_Fi.rc | 70 ++- tools/build.c | 3 +- win32/Makefile.in | 1 - win32/cursoricon32.c | 4 +- win32/memory.c | 18 +- win32/newfns.c | 10 + win32/param32.c | 48 -- win32/string32.c | 8 + win32/struct32.c | 134 ++--- win32/user32.c | 92 +--- win32/winprocs.c | 24 +- windows/Makefile.in | 3 +- windows/caret.c | 16 +- windows/class.c | 892 +++++++++++++++++++++++++-------- windows/dce.c | 18 +- windows/defdlg.c | 8 +- windows/defwnd.c | 34 +- windows/dialog.c | 49 +- windows/event.c | 106 ++-- windows/graphics.c | 115 ++++- windows/mapping.c | 243 +++++++-- windows/mdi.c | 280 ++++++----- windows/message.c | 61 ++- windows/msgbox.c | 30 +- windows/nonclient.c | 261 +++++----- windows/painting.c | 190 +++++-- windows/queue.c | 14 +- windows/scroll.c | 87 ++-- windows/win.c | 657 +++++++++++++++++------- windows/winpos.c | 471 +++++++++++++----- windows/winproc.c | 405 +++++++++++++++ 131 files changed, 7215 insertions(+), 4276 deletions(-) delete mode 100644 if1632/relay32.c delete mode 100644 include/regfunc.h delete mode 100644 include/relay32.h delete mode 100644 library/atom.c delete mode 100644 library/heap.c delete mode 100644 win32/param32.c create mode 100644 windows/winproc.c diff --git a/ANNOUNCE b/ANNOUNCE index a90e0dbf4b0..b9a02221a19 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,14 +1,14 @@ -This is release 960506 of Wine the MS Windows emulator. This is still a +This is release 960516 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. Patches should be submitted to "julliard@lrc.epfl.ch". Please don't forget to include a ChangeLog entry. -WHAT'S NEW with Wine-960506: (see ChangeLog for details) - - Moveable and discardable blocks in local heap. - - Comboboxes improvements. - - Winhelp clone using Winelib. +WHAT'S NEW with Wine-960516: (see ChangeLog for details) + - Tons of Win32 support. + - Several local heap fixes. + - Window management improvements. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -17,10 +17,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: - sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960506.tar.gz - tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960506.tar.gz - ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960506.tar.gz - aris.com:/pub/linux/ALPHA/Wine/development/Wine-960506.tar.gz + sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960516.tar.gz + tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960516.tar.gz + ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960516.tar.gz + aris.com:/pub/linux/ALPHA/Wine/development/Wine-960516.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. diff --git a/ChangeLog b/ChangeLog index e8b06ea8d93..237d319a637 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,122 @@ +---------------------------------------------------------------------- +Thu May 16 13:35:31 1996 Alexandre Julliard + + * [*/*.c] + Renamed RECT, POINT and SIZE structures to RECT16, POINT16 and + SIZE16. Implemented Win32 version of most functions that take + these types as parameters. + + * [configure] + Patched autoconf to attempt to correctly detect -lnsl and + -lsocket. Please check this out. + + * [controls/button.c] + Added support for Win32 BM_* messages. + + * [controls/menu.c] + Avoid sending extra WM_MENUSELECT messages. This avoids crashes + with Excel. + + * [memory.heap.c] [include/heap.h] + Added support for SEGPTRs in Win32 heaps. Added a few macros to + make using SEGPTRs easier. They are a bit slower than MAKE_SEGPTR, + but they work with Win32. + + * [memory/atom.c] + Implemented Win32 atom functions. + + * [memory/local.c] + Fixed LocalReAlloc() changes to avoid copying the whole block twice. + + * [win32/memory.c] + Use /dev/zero instead of MAP_ANON for VirtualAlloc(). + + * [windows/class.c] + Properly implemented the Win32 class functions. + + * [windows/winproc.c] (New file) + New file handling the message translation between Win16 and Win32. + +Mon May 13 18:00:00 1996 Alex Korobka + + * [windows/mdi.c] [windows/menu.c] + Improved WM_MDICREATE and WM_MDICASCADE handling. + + * [windows/event.c] [objects/bitblt.c] + Handle GraphicsExpose event for BitBlt from screen to screen. + + * [windows/event.c] [windows/win.c] [windows/nonclient.c] + Bunch of fixes for problems with -managed. + + * [windows/win.c] [windows/winpos.c] + Changed conditions for WM_SIZE, WM_MOVE, and WM_GETMINMAXINFO + in CreateWindow. + + * [windows/win.c] [windows/queue.c] [misc/user.c] + Do not send WM_PARENTNOTIFY when in AppExit and call WH_SHELL + on window creation/destruction. + + * [objects/palette.c] + Crude RealizePalette(). At least something is visible in LviewPro. + +Sun May 12 02:05:00 1996 Thomas Sandford + + * [if1632/gdi32.spec] + Added Rectangle (use win16 version). + + * [if1632/kernel32.spec] + Added GetWindowsDirectoryA (use win16 GetWindowsDirectory). + + * [if1632/user32.spec] + Added GetSubMenu, MoveWindow, SetScrollPos, SetScrollRange (use win16 + versions). + Added SetWindowsHookExA (empty stub for now). + + * [include/handle32.h] + Changed #include to #include to prevent + hate message from FreeBSD compiler. + + * [win32/newfns.c] + Added new function SetWindowsHookEx32A (empty stub for now). + + * [win32/user32.c] + Removed redundant debugging printf statement. + +Sun May 12 01:24:57 1996 Huw D. M. Davies + + * [memory/local.c] + Avoid creating adjacent free blocks. + Free the block in LocalReAlloc() before allocating a new one. + Fixed LocalReAlloc() for discarded blocks. + +Fri May 10 23:05:12 1996 Jukka Iivonen + + * [resources/sysres_Fi.rc] + ChooseFont and ChooseColor dialogs updated. + +Fri May 10 17:19:33 1996 Marcus Meissner + + * [files/drive.c,if1632/kernel.spec] + GetCurrentDirectory(),SetCurrentDirectory() implemented. + + * [if1632/advapi32.spec] [if1632/kernel.spec] [if1632/shell.spec] + [include/windows.h] [include/winreg.h] [loader/main.c] + [misc/main.c] [misc/shell.c] [misc/registry.c] + Registry fixes: + - loads win95 registry databases, + - save only updated keys on default, + - now adhers to the new function naming standard, + - minor cleanups. + +Tue May 7 22:36:13 1996 Albrecht Kleine + + * [combo.c] + Added WM_COMMAND-handling for interaction between EDIT and COMBOLBOX + and synchronized mine with Greg Kreider's works. + + * [commdlg.c] + Bugfix in ChooseFont: font size handling. + ---------------------------------------------------------------------- Mon May 6 12:56:26 1996 Alexandre Julliard diff --git a/README b/README index 135cf3c404b..5dd7ba7a892 100644 --- a/README +++ b/README @@ -25,6 +25,11 @@ To build Wine, first do a "./configure" and then a "make depend; make". The executable "wine" will be built. "wine" will load and run 16-bit Windows executables. +To build Winelib, do a "./configure --with-library", and then a "make +depend; make". The library "winelib.a" will be built, allowing to +compile Windows source code under Unix. If you have an ELF compiler, +you can use "./configure --with-dll" instead to build a shared library. + To upgrade to a new release by using a patch file, first cd to the top-level directory of the release (the one containing this README file). Then do a "make clean", and patch the release with: diff --git a/configure b/configure index 69670930565..72b314342e4 100755 --- a/configure +++ b/configure @@ -2,7 +2,7 @@ # From configure.in configure.in 1.00 # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.9 +# Generated automatically using autoconf version 2.10-patched # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -341,7 +341,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.9" + echo "configure generated by autoconf version 2.10-patched" exit 0 ;; -with-* | --with-*) @@ -1080,7 +1080,7 @@ else # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for -lICE""... $ac_c" 1>&6 -ac_lib_var=`echo ICE_IceConnectionNumber | tr '.-/+' '___p'` +ac_lib_var=`echo ICE'_'IceConnectionNumber | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1090,6 +1090,8 @@ cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1126,16 +1128,18 @@ fi # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for -ldnet""... $ac_c" 1>&6 -ac_lib_var=`echo dnet_dnet_ntoa | tr '.-/+' '___p'` +ac_lib_var=`echo dnet'_'dnet_ntoa | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1163,16 +1167,18 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for -ldnet_stub""... $ac_c" 1>&6 -ac_lib_var=`echo dnet_stub_dnet_ntoa | tr '.-/+' '___p'` +ac_lib_var=`echo dnet_stub'_'dnet_ntoa | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1205,16 +1211,18 @@ fi # Not sure which flavor of 386 UNIX this is, but it seems harmless to # check for it. echo $ac_n "checking for -lnsl""... $ac_c" 1>&6 -ac_lib_var=`echo nsl_t_accept | tr '.-/+' '___p'` +ac_lib_var=`echo nsl'_'t_accept | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1245,17 +1253,20 @@ fi # socket/setsockopt and other routines are undefined under SCO ODT 2.0. # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch. if test "`(uname) 2>/dev/null`" != IRIX; then - echo $ac_n "checking for -lsocket""... $ac_c" 1>&6 -ac_lib_var=`echo socket_socket | tr '.-/+' '___p'` + if test $ac_cv_lib_nsl_t_accept = no; then + echo $ac_n "checking for -lsocket""... $ac_c" 1>&6 +ac_lib_var=`echo socket'_'socket | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1281,6 +1292,47 @@ else echo "$ac_t""no" 1>&6 fi + else + # If we found -lnsl, use it to check for -lsocket. -- AJ + echo $ac_n "checking for -lsocket""... $ac_c" 1>&6 +ac_lib_var=`echo socket'_'socket | tr './+\055' '__p_'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket -lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket" +else + echo "$ac_t""no" 1>&6 +fi + + fi fi fi fi @@ -1353,16 +1405,18 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for -l$ac_lib""... $ac_c" 1>&6 -ac_lib_var=`echo $ac_lib_yywrap | tr '.-/+' '___p'` +ac_lib_var=`echo $ac_lib'_'yywrap | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1478,16 +1532,18 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking for -li386""... $ac_c" 1>&6 -ac_lib_var=`echo i386_i386_set_ldt | tr '.-/+' '___p'` +ac_lib_var=`echo i386'_'i386_set_ldt | tr './+\055' '__p_'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-li386 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1527,11 +1583,11 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_cross=no else @@ -1552,7 +1608,7 @@ else ac_cv_c_gcc_strength_bug="yes" else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_gcc_strength_bug="no" else @@ -1588,12 +1644,14 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { return 0; } @@ -1610,7 +1668,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1640,12 +1698,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1649: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1674,7 +1732,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1729,7 +1787,7 @@ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1803,7 +1861,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1811,7 +1869,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1826,7 +1884,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1844,7 +1902,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1865,7 +1923,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1876,7 +1934,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -{ (eval echo configure:1880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then : else @@ -1900,7 +1958,7 @@ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2019,7 +2077,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.9" + echo "$CONFIG_STATUS generated by autoconf version 2.10-patched" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; diff --git a/controls/button.c b/controls/button.c index f5e7eff06cb..60558ec5465 100644 --- a/controls/button.c +++ b/controls/button.c @@ -10,7 +10,7 @@ #include "syscolor.h" #include "graphics.h" #include "button.h" -#include "stackframe.h" +#include "heap.h" extern void DEFWND_SetText( WND *wndPtr, LPSTR text ); /* windows/defwnd.c */ @@ -80,8 +80,7 @@ static WORD checkBoxWidth = 0, checkBoxHeight = 0; LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - RECT rect; - POINT pt; + RECT16 rect; LONG lResult = 0; WND *wndPtr = WIN_FindWndPtr(hWnd); LONG style = wndPtr->dwStyle & 0x0000000F; @@ -132,15 +131,15 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_PAINT: if (btnPaintFunc[style]) { - PAINTSTRUCT ps; - HDC hdc = BeginPaint( hWnd, &ps ); + PAINTSTRUCT16 ps; + HDC hdc = BeginPaint16( hWnd, &ps ); (btnPaintFunc[style])( wndPtr, hdc, ODA_DRAWENTIRE ); - ReleaseDC( hWnd, hdc ); + EndPaint16( hWnd, &ps ); } break; case WM_LBUTTONDOWN: - SendMessage( hWnd, BM_SETSTATE, TRUE, 0 ); + SendMessage( hWnd, BM_SETSTATE16, TRUE, 0 ); SetFocus( hWnd ); SetCapture( hWnd ); break; @@ -148,23 +147,21 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_LBUTTONUP: ReleaseCapture(); if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break; - SendMessage( hWnd, BM_SETSTATE, FALSE, 0 ); - GetClientRect( hWnd, &rect ); - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - if (PtInRect( &rect, pt )) + SendMessage( hWnd, BM_SETSTATE16, FALSE, 0 ); + GetClientRect16( hWnd, &rect ); + if (PtInRect16( &rect, MAKEPOINT16(lParam) )) { switch(style) { case BS_AUTOCHECKBOX: - SendMessage( hWnd, BM_SETCHECK, + SendMessage( hWnd, BM_SETCHECK16, !(infoPtr->state & BUTTON_CHECKED), 0 ); break; case BS_AUTORADIOBUTTON: - SendMessage( hWnd, BM_SETCHECK, TRUE, 0 ); + SendMessage( hWnd, BM_SETCHECK16, TRUE, 0 ); break; case BS_AUTO3STATE: - SendMessage( hWnd, BM_SETCHECK, + SendMessage( hWnd, BM_SETCHECK16, (infoPtr->state & BUTTON_3STATE) ? 0 : ((infoPtr->state & 3) + 1), 0 ); break; @@ -182,12 +179,9 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: if (GetCapture() == hWnd) { - GetClientRect( hWnd, &rect ); - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - if (PtInRect( &rect, pt) ) - SendMessage( hWnd, BM_SETSTATE, TRUE, 0 ); - else SendMessage( hWnd, BM_SETSTATE, FALSE, 0 ); + GetClientRect16( hWnd, &rect ); + SendMessage(hWnd, BM_SETSTATE16, + PtInRect16( &rect,MAKEPOINT16(lParam) ), 0 ); } break; @@ -221,10 +215,11 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case WM_SYSCOLORCHANGE: - InvalidateRect(hWnd, NULL, FALSE); + InvalidateRect32( hWnd, NULL, FALSE ); break; - case BM_SETSTYLE: + case BM_SETSTYLE16: + case BM_SETSTYLE32: if ((wParam & 0x0f) >= MAX_BTN_TYPE) break; wndPtr->dwStyle = (wndPtr->dwStyle & 0xfffffff0) | (wParam & 0x0000000f); @@ -232,11 +227,13 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) PAINT_BUTTON( wndPtr, style, ODA_DRAWENTIRE ); break; - case BM_GETCHECK: + case BM_GETCHECK16: + case BM_GETCHECK32: lResult = infoPtr->state & 3; break; - case BM_SETCHECK: + case BM_SETCHECK16: + case BM_SETCHECK32: if (wParam > maxCheckState[style]) wParam = maxCheckState[style]; if ((infoPtr->state & 3) != wParam) @@ -248,11 +245,13 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) BUTTON_CheckAutoRadioButton( wndPtr ); break; - case BM_GETSTATE: + case BM_GETSTATE16: + case BM_GETSTATE32: lResult = infoPtr->state; break; - case BM_SETSTATE: + case BM_SETSTATE16: + case BM_SETSTATE32: if (wParam) { if (infoPtr->state & BUTTON_HIGHLIGHTED) break; @@ -281,20 +280,20 @@ LRESULT ButtonWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ) { - RECT rc; - HPEN hOldPen; + RECT16 rc; + HPEN16 hOldPen; HBRUSH hOldBrush; char *text; DWORD dwTextSize; TEXTMETRIC tm; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; - GetClientRect(wndPtr->hwndSelf, &rc); + GetClientRect16(wndPtr->hwndSelf, &rc); /* Send WM_CTLCOLOR to allow changing the font (the colors are fixed) */ if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); BUTTON_SEND_CTLCOLOR( wndPtr, hDC ); - hOldPen = (HPEN)SelectObject(hDC, sysColorObjects.hpenWindowFrame); + hOldPen = (HPEN16)SelectObject(hDC, sysColorObjects.hpenWindowFrame); hOldBrush = (HBRUSH)SelectObject(hDC, sysColorObjects.hbrushBtnFace); SetBkMode(hDC, TRANSPARENT); Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); @@ -305,12 +304,12 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ) SetPixel( hDC, rc.right-1, rc.top, GetSysColor(COLOR_WINDOW) ); SetPixel( hDC, rc.right-1, rc.bottom-1, GetSysColor(COLOR_WINDOW) ); } - InflateRect( &rc, -1, -1 ); + InflateRect16( &rc, -1, -1 ); if ((wndPtr->dwStyle & 0x000f) == BS_DEFPUSHBUTTON) { Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); - InflateRect( &rc, -1, -1 ); + InflateRect16( &rc, -1, -1 ); } if (infoPtr->state & BUTTON_HIGHLIGHTED) @@ -330,8 +329,8 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ) { SetTextColor( hDC, (wndPtr->dwStyle & WS_DISABLED) ? GetSysColor(COLOR_GRAYTEXT) : GetSysColor(COLOR_BTNTEXT)); - DrawText(hDC, text, -1, &rc, - DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawText16( hDC, text, -1, &rc, + DT_SINGLELINE | DT_CENTER | DT_VCENTER ); /* do we have the focus? */ if (infoPtr->state & BUTTON_HASFOCUS) { @@ -342,8 +341,8 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ) ydelta = ((rc.bottom - rc.top) - tm.tmHeight - 1) / 2; if (xdelta < 0) xdelta = 0; if (ydelta < 0) ydelta = 0; - InflateRect( &rc, -xdelta, -ydelta ); - DrawFocusRect( hDC, &rc ); + InflateRect16( &rc, -xdelta, -ydelta ); + DrawFocusRect16( hDC, &rc ); } } @@ -358,19 +357,19 @@ static void PB_Paint( WND *wndPtr, HDC hDC, WORD action ) static void CB_Paint( WND *wndPtr, HDC hDC, WORD action ) { - RECT rc; + RECT16 rc; HBRUSH hBrush; int textlen, delta, x, y; char *text; TEXTMETRIC tm; - SIZE size; + SIZE16 size; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; - GetClientRect(wndPtr->hwndSelf, &rc); + GetClientRect16(wndPtr->hwndSelf, &rc); if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); hBrush = BUTTON_SEND_CTLCOLOR( wndPtr, hDC ); - if (action == ODA_DRAWENTIRE) FillRect(hDC, &rc, hBrush); + if (action == ODA_DRAWENTIRE) FillRect16( hDC, &rc, hBrush ); GetTextMetrics(hDC, &tm); delta = (rc.bottom - rc.top - tm.tmHeight) >> 1; @@ -393,13 +392,13 @@ static void CB_Paint( WND *wndPtr, HDC hDC, WORD action ) { if (wndPtr->dwStyle & WS_DISABLED) SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) ); - DrawText(hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER); + DrawText16( hDC, text, textlen, &rc, DT_SINGLELINE | DT_VCENTER ); } if ((action == ODA_FOCUS) || ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS))) { - GetTextExtentPoint(hDC, text, textlen, &size); + GetTextExtentPoint16( hDC, text, textlen, &size ); if (delta > 1) { rc.top += delta - 1; @@ -407,7 +406,7 @@ static void CB_Paint( WND *wndPtr, HDC hDC, WORD action ) } rc.left--; rc.right = MIN( rc.left + size.cx + 2, rc.right ); - DrawFocusRect(hDC, &rc); + DrawFocusRect16( hDC, &rc ); } } @@ -425,7 +424,7 @@ static void BUTTON_CheckAutoRadioButton( WND *wndPtr ) for(sibling = GetNextDlgGroupItem(parent,wndPtr->hwndSelf,FALSE); sibling != wndPtr->hwndSelf; sibling = GetNextDlgGroupItem(parent,sibling,FALSE)) - SendMessage(sibling,BM_SETCHECK,BUTTON_UNCHECKED,0); + SendMessage( sibling, BM_SETCHECK16, BUTTON_UNCHECKED, 0 ); } @@ -435,9 +434,9 @@ static void BUTTON_CheckAutoRadioButton( WND *wndPtr ) static void GB_Paint( WND *wndPtr, HDC hDC, WORD action ) { - RECT rc; + RECT16 rc; char *text; - SIZE size; + SIZE16 size; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; if (action != ODA_DRAWENTIRE) return; @@ -446,7 +445,7 @@ static void GB_Paint( WND *wndPtr, HDC hDC, WORD action ) BUTTON_SEND_CTLCOLOR( wndPtr, hDC ); SelectObject( hDC, sysColorObjects.hpenWindowFrame ); - GetClientRect( wndPtr->hwndSelf, &rc); + GetClientRect16( wndPtr->hwndSelf, &rc); MoveTo( hDC, rc.left, rc.top+2 ); LineTo( hDC, rc.right-1, rc.top+2 ); @@ -455,13 +454,13 @@ static void GB_Paint( WND *wndPtr, HDC hDC, WORD action ) LineTo( hDC, rc.left, rc.top+2 ); if (!(text = (char*) USER_HEAP_LIN_ADDR( wndPtr->hText ))) return; - GetTextExtentPoint(hDC, text, strlen(text), &size); + GetTextExtentPoint16( hDC, text, strlen(text), &size ); rc.left += 10; rc.right = rc.left + size.cx + 1; rc.bottom = size.cy; if (wndPtr->dwStyle & WS_DISABLED) SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) ); - DrawText(hDC, text, -1, &rc, DT_SINGLELINE ); + DrawText16( hDC, text, -1, &rc, DT_SINGLELINE ); } @@ -471,21 +470,21 @@ static void GB_Paint( WND *wndPtr, HDC hDC, WORD action ) static void UB_Paint( WND *wndPtr, HDC hDC, WORD action ) { - RECT rc; + RECT16 rc; HBRUSH hBrush; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; if (action == ODA_SELECT) return; - GetClientRect( wndPtr->hwndSelf, &rc); + GetClientRect16( wndPtr->hwndSelf, &rc); if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); hBrush = BUTTON_SEND_CTLCOLOR( wndPtr, hDC ); - FillRect(hDC, &rc, hBrush); + FillRect16( hDC, &rc, hBrush ); if ((action == ODA_FOCUS) || ((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS))) - DrawFocusRect(hDC, &rc); + DrawFocusRect16( hDC, &rc ); } @@ -495,20 +494,22 @@ static void UB_Paint( WND *wndPtr, HDC hDC, WORD action ) static void OB_Paint( WND *wndPtr, HDC hDC, WORD action ) { - DRAWITEMSTRUCT dis; + DRAWITEMSTRUCT16 *dis; BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra; - dis.CtlType = ODT_BUTTON; - dis.CtlID = wndPtr->wIDmenu; - dis.itemID = 0; - dis.itemAction = action; - dis.itemState = (infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0 | + if (!(dis = SEGPTR_NEW(DRAWITEMSTRUCT16))) return; + dis->CtlType = ODT_BUTTON; + dis->CtlID = wndPtr->wIDmenu; + dis->itemID = 0; + dis->itemAction = action; + dis->itemState = (infoPtr->state & BUTTON_HASFOCUS) ? ODS_FOCUS : 0 | (infoPtr->state & BUTTON_HIGHLIGHTED) ? ODS_SELECTED : 0 | (wndPtr->dwStyle & WS_DISABLED) ? ODS_DISABLED : 0; - dis.hwndItem = wndPtr->hwndSelf; - dis.hDC = hDC; - GetClientRect( wndPtr->hwndSelf, &dis.rcItem ); - dis.itemData = 0; + dis->hwndItem = wndPtr->hwndSelf; + dis->hDC = hDC; + GetClientRect16( wndPtr->hwndSelf, &dis->rcItem ); + dis->itemData = 0; SendMessage( GetParent(wndPtr->hwndSelf), WM_DRAWITEM, 1, - (LPARAM)MAKE_SEGPTR(&dis) ); + (LPARAM)SEGPTR_GET(dis) ); + SEGPTR_FREE(dis); } diff --git a/controls/combo.c b/controls/combo.c index d2dc819559f..46b4b9f4efd 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -3,6 +3,7 @@ * * Copyright 1993 Martin Ayotte * Copyright 1995 Bernd Schmidt + * Copyright 1996 Albrecht Kleine [some fixes] * */ @@ -19,6 +20,7 @@ #include "user.h" #include "win.h" #include "graphics.h" +#include "heap.h" #include "listbox.h" #include "dos_fs.h" #include "drive.h" @@ -33,18 +35,8 @@ * I hope no programs rely on the implementation of combos. */ - /* - * May 2nd: I added 3 "work arounds" (#1,#2,#3) to make combos - * with EDIT work. (We need that for ChooseFont dialog.) - * Perhaps we have to rewrite something more. - * I have prepared some more stuff, but it doesn't - * contain here, because it's not ready ;-) - * - * If you're writing on combo.c, please mail to me. - * - * Albrecht Kleine - */ - +#define ID_EDIT 1 +#define ID_CLB 2 #define CBLMM_EDGE 4 /* distance inside box which is same as moving mouse outside box, to trigger scrolling of CBL */ @@ -97,9 +89,7 @@ void ComboUpdateWindow(HWND hwnd, LPHEADLIST lphl, LPHEADCOMBO lphc, BOOL repain if (wndPtr->dwStyle & WS_VSCROLL) SetScrollRange(lphc->hWndLBox,SB_VERT,0,ListMaxFirstVisible(lphl),TRUE); - if (repaint && lphl->bRedrawFlag) { - InvalidateRect(hwnd, NULL, TRUE); - } + if (repaint && lphl->bRedrawFlag) InvalidateRect32( hwnd, NULL, TRUE ); } /*********************************************************************** @@ -107,11 +97,11 @@ void ComboUpdateWindow(HWND hwnd, LPHEADLIST lphl, LPHEADCOMBO lphc, BOOL repain */ static LRESULT CBNCCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) { - CREATESTRUCT *createStruct; + CREATESTRUCT16 *createStruct; if (!hComboBit) COMBO_Init(); - createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam); + createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); createStruct->style |= WS_BORDER; SetWindowLong(hwnd, GWL_STYLE, createStruct->style); @@ -129,10 +119,11 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) LPHEADCOMBO lphc; LONG style = 0; LONG cstyle = GetWindowLong(hwnd,GWL_STYLE); - RECT rect,lboxrect; + RECT16 rect,lboxrect; WND* wndPtr = WIN_FindWndPtr(hwnd); char className[] = "COMBOLBOX"; /* Hack so that class names are > 0x10000 */ char editName[] = "EDIT"; + HWND hwndp=0; /* translate combo into listbox styles */ cstyle |= WS_BORDER; @@ -147,80 +138,61 @@ static LRESULT CBCreate(HWND hwnd, WPARAM wParam, LPARAM lParam) lphl = ComboGetListHeader(hwnd); lphc = ComboGetStorageHeader(hwnd); - GetClientRect(hwnd,&rect); - GetWindowRect(hwnd,&lboxrect); + GetClientRect16(hwnd,&rect); + lphc->LBoxTop = lphl->StdItemHeight; - /* FIXME: combos with edit controls are broken. */ - switch(cstyle & 3) { + switch(cstyle & 3) + { case CBS_SIMPLE: /* edit control, list always visible */ - dprintf_combo(stddeb,"CBS_SIMPLE\n"); - SetRectEmpty(&lphc->RectButton); - lboxrect=rect; /* work around #1 */ - lphc->LBoxTop = lphl->StdItemHeight; - lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0, - WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT | WS_BORDER, - 0, 0, rect.right, lphl->StdItemHeight, - hwnd, (HMENU)1, WIN_GetWindowInstance(hwnd), 0L); - break; + lboxrect=rect; + lboxrect.left +=8; + dprintf_combo(stddeb,"CBS_SIMPLE\n"); + style= WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL; + SetRectEmpty16(&lphc->RectButton); + hwndp=hwnd; + break; + + case CBS_DROPDOWNLIST: /* static control, dropdown listbox */ case CBS_DROPDOWN: /* edit control, dropdown listbox */ - dprintf_combo(stddeb,"CBS_DROPDOWN\n"); - lphc->RectButton = rect; - lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth; - lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight; - lphc->LBoxTop = lphl->StdItemHeight; - SetWindowPos(hwnd, 0, 0, 0, rect.right - rect.left + 2*SYSMETRICS_CXBORDER, + GetWindowRect16(hwnd,&lboxrect); + style = WS_POPUP | WS_BORDER | WS_VSCROLL; + /* FIXME: WinSight says these should be CHILD windows with the TOPMOST flag + * set. Wine doesn't support TOPMOST, and simply setting the WS_CHILD + * flag doesn't work. */ + lphc->RectButton = rect; + lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth; + lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight; + SetWindowPos(hwnd, 0, 0, 0, rect.right - rect.left + 2*SYSMETRICS_CXBORDER, lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER, SWP_NOMOVE | SWP_NOZORDER); - lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0, - WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT, - 0, 0, lphc->RectButton.left, lphl->StdItemHeight, - hwnd, (HMENU)1, WIN_GetWindowInstance(hwnd), 0L); - break; - case CBS_DROPDOWNLIST: /* static control, dropdown listbox */ - dprintf_combo(stddeb,"CBS_DROPDOWNLIST\n"); - lphc->RectButton = rect; - lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth; - lphc->RectButton.bottom = lphc->RectButton.top + lphl->StdItemHeight; - lphc->LBoxTop = lphl->StdItemHeight; - - SetWindowPos(hwnd, 0, 0, 0, rect.right, - lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER, - SWP_NOMOVE | SWP_NOZORDER); - break; + rect.right=lphc->RectButton.left - 8; + dprintf_combo(stddeb,(cstyle & 3)==CBS_DROPDOWN ? "CBS_DROPDOWN\n": "CBS_DROPDOWNLIST\n"); + break; + + default: fprintf(stderr,"COMBOBOX error: bad class style!\n"); + return 0; } - lboxrect.top += lphc->LBoxTop; - /* FIXME: WinSight says these should be CHILD windows with the TOPMOST flag - * set. Wine doesn't support TOPMOST, and simply setting the WS_CHILD - * flag doesn't work. */ - if ((cstyle & 3)==CBS_SIMPLE) /* work around #2 */ - { - lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0, - WS_BORDER | WS_CHILD | WS_VISIBLE | - ((cstyle & WS_HSCROLL)? WS_HSCROLL : 0) | - ((cstyle & WS_VSCROLL)? WS_VSCROLL : 0), - lboxrect.left +8 , lboxrect.top, - lboxrect.right - lboxrect.left - 8, - lboxrect.bottom - lboxrect.top, - hwnd,0, WIN_GetWindowInstance(hwnd), - (SEGPTR)hwnd ); - } - else - { - lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0, - WS_POPUP | WS_BORDER | + + if ((cstyle & 3) != CBS_DROPDOWNLIST) + lphc->hWndEdit = CreateWindow16(MAKE_SEGPTR(editName), (SEGPTR)0, + WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | ES_LEFT | WS_BORDER, + 0, 0, rect.right, lphl->StdItemHeight, + hwnd, (HMENU)ID_EDIT, WIN_GetWindowInstance(hwnd), 0L); + + lboxrect.top+=lphc->LBoxTop; + lphc->hWndLBox = CreateWindow16(MAKE_SEGPTR(className), (SEGPTR)0, style | ((cstyle & WS_HSCROLL)? WS_HSCROLL : 0) | ((cstyle & WS_VSCROLL)? WS_VSCROLL : 0), lboxrect.left, lboxrect.top, lboxrect.right - lboxrect.left, lboxrect.bottom - lboxrect.top, - 0, 0, WIN_GetWindowInstance(hwnd), + hwndp,(HMENU)ID_CLB, WIN_GetWindowInstance(hwnd), (SEGPTR)hwnd ); - ShowWindow(lphc->hWndLBox, SW_HIDE); - } + wndPtr->dwStyle &= ~(WS_VSCROLL | WS_HSCROLL); - - dprintf_combo( stddeb, "Combo Creation hwnd=%04x LBox=%04x\n", - hwnd, lphc->hWndLBox); + + dprintf_combo( stddeb, "Combo Creation hwnd=%04x LBox=%04x Edit=%04x\n", + hwnd, lphc->hWndLBox, lphc->hWndEdit); dprintf_combo( stddeb, " lbox %d,%d-%d,%d button %d,%d-%d,%d\n", lboxrect.left, lboxrect.top, lboxrect.right, lboxrect.bottom, lphc->RectButton.left, lphc->RectButton.top, @@ -254,14 +226,15 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam) LPHEADLIST lphl = ComboGetListHeader(hwnd); LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); LPLISTSTRUCT lpls; - PAINTSTRUCT ps; + PAINTSTRUCT16 ps; HBRUSH hBrush; HFONT hOldFont; - HDC hdc; - RECT rect; + HDC16 hdc; + RECT16 rect; - hdc = BeginPaint(hwnd, &ps); - if (hComboBit != 0 && !IsRectEmpty(&lphc->RectButton)) { /* work around #3 */ + hdc = BeginPaint16(hwnd, &ps); + if (hComboBit != 0 && !IsRectEmpty16(&lphc->RectButton)) + { GRAPH_DrawReliefRect(hdc, &lphc->RectButton, 2, 2, FALSE); GRAPH_DrawBitmap(hdc, hComboBit, lphc->RectButton.left + 2,lphc->RectButton.top + 2, @@ -271,7 +244,7 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam) || (lphc->dwStyle & 3) != CBS_DROPDOWNLIST) { /* we don't want to draw an entry when there is an edit control */ - EndPaint(hwnd, &ps); + EndPaint16(hwnd, &ps); return 0; } @@ -285,21 +258,21 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam) #endif if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH); - GetClientRect(hwnd, &rect); + GetClientRect16(hwnd, &rect); CBCheckSize(hwnd); rect.right -= (lphc->RectButton.right - lphc->RectButton.left); lpls = ListBoxGetItem(lphl,lphl->ItemFocused); if (lpls != NULL) { - FillRect(hdc, &rect, hBrush); + FillRect16(hdc, &rect, hBrush); ListBoxDrawItem (hwnd, lphl, hdc, lpls, &rect, ODA_DRAWENTIRE, 0); if (GetFocus() == hwnd) ListBoxDrawItem (hwnd,lphl, hdc, lpls, &rect, ODA_FOCUS, ODS_FOCUS); } - else FillRect(hdc, &rect, hBrush); + else FillRect16(hdc, &rect, hBrush); SelectObject(hdc,hOldFont); - EndPaint(hwnd, &ps); + EndPaint16(hwnd, &ps); return 0; } @@ -350,12 +323,13 @@ static LRESULT CBKeyDown(HWND hwnd, WPARAM wParam, LPARAM lParam) newFocused = lphl->ItemsCount - 1; ListBoxSetCurSel(lphl, newFocused); + SendMessage(hwnd, WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE)); ListBoxSendNotification(lphl, CBN_SELCHANGE); lphl->ItemFocused = newFocused; ListBoxScrollToFocus(lphl); /* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/ - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -375,12 +349,13 @@ static LRESULT CBChar(HWND hwnd, WPARAM wParam, LPARAM lParam) newFocused = lphl->ItemsCount - 1; ListBoxSetCurSel(lphl, newFocused); + SendMessage(hwnd, WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE)); ListBoxSendNotification(lphl, CBN_SELCHANGE); lphl->ItemFocused = newFocused; ListBoxScrollToFocus(lphl); /* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/ - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -522,7 +497,7 @@ static LRESULT CBSetCurSel(HWND hwnd, WPARAM wParam, LPARAM lParam) dprintf_combo(stddeb,"CBSetCurSel: hwnd %04x wp %x lp %lx wRet %d\n", hwnd,wParam,lParam,wRet); /* SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);*/ - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return wRet; } @@ -573,12 +548,14 @@ static LRESULT CBSetRedraw(HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT CBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam) { LPHEADLIST lphl = ComboGetListHeader(hwnd); - + LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); + if (wParam == 0) lphl->hFont = GetStockObject(SYSTEM_FONT); else lphl->hFont = (HFONT)wParam; - + if (lphc->hWndEdit) + SendMessage(lphc->hWndEdit,WM_SETFONT,lphl->hFont,0); return 0; } @@ -627,14 +604,14 @@ static LRESULT CBSetItemData(HWND hwnd, WPARAM wParam, LPARAM lParam) static LRESULT CBShowDropDown(HWND hwnd, WPARAM wParam, LPARAM lParam) { LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); - RECT rect; + RECT32 rect; if ((lphc->dwStyle & 3) == CBS_SIMPLE) return LB_ERR; wParam = !!wParam; if (wParam != lphc->DropDownVisible) { lphc->DropDownVisible = wParam; - GetWindowRect(hwnd,&rect); + GetWindowRect32(hwnd,&rect); SetWindowPos(lphc->hWndLBox, 0, rect.left, rect.top+lphc->LBoxTop, 0, 0, SWP_NOSIZE | (wParam ? SWP_SHOWWINDOW : SWP_HIDEWINDOW)); if (!wParam) SetFocus(hwnd); @@ -651,27 +628,27 @@ static BOOL CBCheckSize(HWND hwnd) LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); LPHEADLIST lphl = ComboGetListHeader(hwnd); LONG cstyle = GetWindowLong(hwnd,GWL_STYLE); - RECT cRect,wRect; + RECT16 cRect,wRect; /* TODO - The size of combo's and their listboxes is still broken */ if (lphc->hWndLBox == 0) return FALSE; - GetClientRect(hwnd,&cRect); - GetWindowRect(hwnd,&wRect); + GetClientRect16(hwnd,&cRect); + GetWindowRect16(hwnd,&wRect); - dprintf_vxd(stddeb,"CBCheckSize: cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n", + dprintf_combo(stddeb,"CBCheckSize: cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n", cRect.left,cRect.top,cRect.right,cRect.bottom, wRect.left,wRect.top,wRect.right,wRect.bottom); - + if ((cstyle & 3) == CBS_SIMPLE ) return TRUE ; if ((cRect.bottom - cRect.top) > (lphl->StdItemHeight + 2*SYSMETRICS_CYBORDER)) { SetWindowPos(hwnd, 0, 0, 0, cRect.right-cRect.left, lphl->StdItemHeight+2*SYSMETRICS_CYBORDER, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE ); - GetClientRect(hwnd,&cRect); - GetWindowRect(hwnd,&wRect); + GetClientRect16(hwnd,&cRect); + GetWindowRect16(hwnd,&wRect); } switch (cstyle & 3) { @@ -691,10 +668,65 @@ static BOOL CBCheckSize(HWND hwnd) } CBLCheckSize(hwnd); - return TRUE; } +/*********************************************************************** + * CBCommand + */ +static LRESULT CBCommand(HWND hwnd, WPARAM wParam, LPARAM lParam) +{ + LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd); + LPHEADLIST lphl = ComboGetListHeader(hwnd); + char buffer[256]; + WORD newFocused; + WORD id; + if (lphc->hWndEdit) /* interdependence only used for CBS_SIMPLE and CBS_DROPDOWN styles */ + { + switch (wParam) + { + case ID_CLB: /* update EDIT window */ + if (HIWORD(lParam)==CBN_SELCHANGE) + if (lphl->HasStrings) + { + ListBoxGetText(lphl,lphl->ItemFocused, buffer); + dprintf_combo(stddeb,"CBCommand: update Edit: %s\n",buffer); + SendMessage( lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(buffer)); + } + break; + case ID_EDIT: /* update LISTBOX window */ + id=GetWindowWord(hwnd,GWW_ID); + switch (HIWORD(lParam)) + { + case EN_UPDATE:GetWindowText(lphc->hWndEdit,buffer,255); + if (*buffer) + { + newFocused=ListBoxFindString(lphl, -1, MAKE_SEGPTR(buffer)); + dprintf_combo(stddeb,"CBCommand: new selection #%d is= %s\n", + newFocused,buffer); + if (newFocused != (WORD)LB_ERR) + { /* if found something */ + ListBoxSetCurSel(lphl, newFocused); + ListBoxSendNotification(lphl, CBN_SELCHANGE); + InvalidateRect32(hwnd, NULL, TRUE); + } + } + SendMessage(GetParent(hwnd),WM_COMMAND,id, + MAKELONG(hwnd, CBN_EDITUPDATE)); + break; + case EN_CHANGE:SendMessage(GetParent(hwnd),WM_COMMAND,id, + MAKELONG(hwnd, CBN_EDITCHANGE)); + break; + case EN_ERRSPACE:SendMessage(GetParent(hwnd),WM_COMMAND,id, + MAKELONG(hwnd, CBN_ERRSPACE)); + break; + } + break; + } + } + return 0; +} + /*********************************************************************** * ComboWndProc @@ -715,6 +747,7 @@ LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SETFOCUS: return CBSetFocus(hwnd, wParam, lParam); case WM_KILLFOCUS: return CBKillFocus(hwnd, wParam, lParam); case WM_SIZE: return CBCheckSize(hwnd); + case WM_COMMAND: return CBCommand(hwnd, wParam, lParam); case CB_RESETCONTENT: return CBResetContent(hwnd, wParam, lParam); case CB_DIR: return CBDir(hwnd, wParam, lParam); case CB_ADDSTRING: return CBAddString(hwnd, wParam, lParam); @@ -758,7 +791,7 @@ LPHEADLIST CLBoxGetListHeader(HWND hwnd) */ static LRESULT CBLCreate( HWND hwnd, WPARAM wParam, LPARAM lParam ) { - CREATESTRUCT *createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam); + CREATESTRUCT16 *createStruct = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); #ifdef WINELIB32 SetWindowLong(hwnd,0,(LONG)createStruct->lpCreateParams); #else @@ -815,11 +848,11 @@ static LRESULT CBLKeyDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) ListBoxSetCurSel(lphl, newFocused); ListBoxSendNotification(lphl, CBN_SELCHANGE); - + SendMessage(GetParent(hwnd), WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE)); lphl->ItemFocused = newFocused; ListBoxScrollToFocus(lphl); SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -838,20 +871,20 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam ) { LPHEADLIST lphl = CLBoxGetListHeader(hwnd); LPLISTSTRUCT lpls; - PAINTSTRUCT ps; + PAINTSTRUCT16 ps; HBRUSH hBrush; HFONT hOldFont; WND * wndPtr = WIN_FindWndPtr(hwnd); HWND combohwnd = CLBoxGetCombo(hwnd); - HDC hdc; - RECT rect; + HDC16 hdc; + RECT16 rect; int i, top, height; top = 0; - hdc = BeginPaint( hwnd, &ps ); + hdc = BeginPaint16( hwnd, &ps ); if (!IsWindowVisible(hwnd) || !lphl->bRedrawFlag) { - EndPaint(hwnd, &ps); + EndPaint16(hwnd, &ps); return 0; } @@ -859,8 +892,8 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam ) /* listboxes should be white */ hBrush = GetStockObject(WHITE_BRUSH); - GetClientRect(hwnd, &rect); - FillRect(hdc, &rect, hBrush); + GetClientRect16(hwnd, &rect); + FillRect16(hdc, &rect, hBrush); CBLCheckSize(hwnd); lpls = lphl->lpFirst; @@ -903,7 +936,7 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam ) SetScrollRange(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE); SelectObject(hdc,hOldFont); - EndPaint( hwnd, &ps ); + EndPaint16( hwnd, &ps ); return 0; } @@ -934,7 +967,7 @@ static LRESULT CBLLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) { LPHEADLIST lphl = CLBoxGetListHeader(hwnd); int y; - RECT rectsel; + RECT16 rectsel; SetFocus(hwnd); SetCapture(hwnd); @@ -948,7 +981,7 @@ static LRESULT CBLLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) ListBoxSetCurSel(lphl, y); ListBoxGetItemRect(lphl, y, &rectsel); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -968,6 +1001,7 @@ static LRESULT CBLLButtonUp( HWND hwnd, WPARAM wParam, LPARAM lParam ) else if (lphl->PrevFocused != lphl->ItemFocused) { SendMessage(CLBoxGetCombo(hwnd),CB_SETCURSEL,lphl->ItemFocused,0); + SendMessage(GetParent(hwnd), WM_COMMAND,ID_CLB,MAKELONG(0,CBN_SELCHANGE)); ListBoxSendNotification(lphl, CBN_SELCHANGE); } @@ -984,12 +1018,12 @@ static LRESULT CBLMouseMove( HWND hwnd, WPARAM wParam, LPARAM lParam ) LPHEADLIST lphl = CLBoxGetListHeader(hwnd); short y; WORD wRet; - RECT rect, rectsel; + RECT16 rect, rectsel; y = SHIWORD(lParam); wRet = ListBoxFindMouse(lphl, LOWORD(lParam), HIWORD(lParam)); ListBoxGetItemRect(lphl, wRet, &rectsel); - GetClientRect(hwnd, &rect); + GetClientRect16(hwnd, &rect); dprintf_combo(stddeb,"CBLMouseMove: hwnd %04x wp %x lp %lx y %d if %d wret %d %d,%d-%d,%d\n", hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.right,rectsel.bottom); @@ -1000,7 +1034,7 @@ hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.rig lphl->FirstVisible--; SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); ListBoxSetCurSel(lphl, wRet); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } } @@ -1009,14 +1043,14 @@ hwnd,wParam,lParam,y,lphl->ItemFocused,wRet,rectsel.left,rectsel.top,rectsel.rig lphl->FirstVisible++; SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); ListBoxSetCurSel(lphl, wRet); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } } else { if ((short) wRet == lphl->ItemFocused) return 0; ListBoxSetCurSel(lphl, wRet); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); } } @@ -1065,7 +1099,7 @@ static LRESULT CBLVScroll( HWND hwnd, WPARAM wParam, LPARAM lParam ) if (y != lphl->FirstVisible) { SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); } return 0; @@ -1081,26 +1115,26 @@ static BOOL CBLCheckSize(HWND hwnd) LPHEADLIST lphl = ComboGetListHeader(hwnd); LPLISTSTRUCT lpls; HWND hWndLBox; - RECT cRect,wRect,lRect,lwRect; + RECT16 cRect,wRect,lRect,lwRect; int totheight; char className[80]; - GetClassName(hwnd,className,80); + GetClassName32A(hwnd,className,80); fflush(stddeb); if (strncmp(className,"COMBOBOX",8)) return FALSE; if ((hWndLBox = lphc->hWndLBox) == 0) return FALSE; - dprintf_vxd(stddeb,"CBLCheckSize headers hw %04x lb %04x name %s\n", + dprintf_combo(stddeb,"CBLCheckSize headers hw %04x lb %04x name %s\n", hwnd,hWndLBox,className); - GetClientRect(hwnd,&cRect); - GetWindowRect(hwnd,&wRect); - GetClientRect(hWndLBox,&lRect); - GetWindowRect(hWndLBox,&lwRect); + GetClientRect16(hwnd,&cRect); + GetWindowRect16(hwnd,&wRect); + GetClientRect16(hWndLBox,&lRect); + GetWindowRect16(hWndLBox,&lwRect); - dprintf_vxd(stddeb,"CBLCheckSize: init cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n", + dprintf_combo(stddeb,"CBLCheckSize: init cRect %d,%d-%d,%d wRect %d,%d-%d,%d\n", cRect.left,cRect.top,cRect.right,cRect.bottom, wRect.left,wRect.top,wRect.right,wRect.bottom); - dprintf_vxd(stddeb," lRect %d,%d-%d,%d lwRect %d,%d-%d,%d\n", + dprintf_combo(stddeb," lRect %d,%d-%d,%d lwRect %d,%d-%d,%d\n", lRect.left,lRect.top,lRect.right,lRect.bottom, lwRect.left,lwRect.top,lwRect.right,lwRect.bottom); fflush(stddeb); @@ -1111,13 +1145,12 @@ static BOOL CBLCheckSize(HWND hwnd) /* TODO: This isn't really what windows does */ if (lRect.bottom-lRect.top < 3*lphl->StdItemHeight) { - dprintf_vxd(stddeb," Changing; totHeight %d StdItemHght %d\n", + dprintf_combo(stddeb," Changing; totHeight %d StdItemHght %d\n", totheight,lphl->StdItemHeight); SetWindowPos(hWndLBox, 0, lRect.left, lRect.top, lwRect.right-lwRect.left, totheight+2*SYSMETRICS_CYBORDER, SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE ); } - return TRUE; } @@ -1174,13 +1207,17 @@ INT DlgDirListComboBox( HWND hDlg, SEGPTR path, INT idCBox, } if (idStatic) { - char temp[256]; int drive = DRIVE_GetCurrentDrive(); + const char *cwd = DRIVE_GetDosCwd(drive); + char *temp = SEGPTR_ALLOC( strlen(cwd) + 4 ); + if (!temp) return FALSE; strcpy( temp, "A:\\" ); temp[0] += drive; - lstrcpyn( temp+3, DRIVE_GetDosCwd(drive), 253 ); + strcpy( temp + 3, cwd ); + AnsiLower( temp ); SendDlgItemMessage( hDlg, idStatic, WM_SETTEXT, - 0, (LPARAM)MAKE_SEGPTR(temp) ); + 0, (LPARAM)SEGPTR_GET(temp) ); + SEGPTR_FREE(temp); } return ret; } diff --git a/controls/desktop.c b/controls/desktop.c index c0d48fb5b86..1e0c106fb7e 100644 --- a/controls/desktop.c +++ b/controls/desktop.c @@ -78,8 +78,8 @@ static HBITMAP DESKTOP_LoadBitmap( HDC hdc, const char *filename ) */ static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr ) { - RECT rect; - GetClientRect( hwnd, &rect ); + RECT16 rect; + GetClientRect16( hwnd, &rect ); /* Paint desktop pattern (only if wall paper does not cover everything) */ @@ -90,7 +90,7 @@ static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr ) /* Set colors in case pattern is a monochrome bitmap */ SetBkColor( hdc, RGB(0,0,0) ); SetTextColor( hdc, GetSysColor(COLOR_BACKGROUND) ); - FillRect( hdc, &rect, infoPtr->hbrushPattern ); + FillRect16( hdc, &rect, infoPtr->hbrushPattern ); } /* Paint wall paper */ diff --git a/controls/edit.c b/controls/edit.c index d55c9548200..6bba8a3d6d6 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -125,7 +125,7 @@ static void EDIT_DelLeft(WND *wndPtr); static void EDIT_DelRight(WND *wndPtr); static UINT EDIT_GetAveCharWidth(WND *wndPtr); static UINT EDIT_GetLineHeight(WND *wndPtr); -static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT rc); +static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT16 rc); static char * EDIT_GetPointer(WND *wndPtr); static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam); static BOOL EDIT_GetRedraw(WND *wndPtr); @@ -725,7 +725,7 @@ static UINT EDIT_GetLineHeight(WND *wndPtr) * column to an ending column. * */ -static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT rc) +static void EDIT_GetLineRect(WND *wndPtr, UINT line, UINT scol, UINT ecol, LPRECT16 rc) { rc->top = EDIT_WndYFromLine(wndPtr, line); rc->bottom = rc->top + EDIT_GetLineHeight(wndPtr); @@ -764,7 +764,7 @@ static char *EDIT_GetPointer(WND *wndPtr) */ static LRESULT EDIT_GetRect(WND *wndPtr, WPARAM wParam, LPARAM lParam) { - GetClientRect(wndPtr->hwndSelf, (LPRECT)lParam); + GetClientRect16( wndPtr->hwndSelf, (LPRECT16)lParam ); return 0L; } @@ -802,7 +802,7 @@ static UINT EDIT_GetTextWidth(WND *wndPtr) */ static UINT EDIT_GetVisibleLineCount(WND *wndPtr) { - RECT rc; + RECT16 rc; EDIT_GetRect(wndPtr, 0, (LPARAM)&rc); return MAX(1, MAX(rc.bottom - rc.top, 0) / EDIT_GetLineHeight(wndPtr)); @@ -816,7 +816,7 @@ static UINT EDIT_GetVisibleLineCount(WND *wndPtr) */ static UINT EDIT_GetWndWidth(WND *wndPtr) { - RECT rc; + RECT16 rc; EDIT_GetRect(wndPtr, 0, (LPARAM)&rc); return rc.right - rc.left; @@ -855,9 +855,9 @@ static void EDIT_InvalidateText(WND *wndPtr, UINT start, UINT end) UINT el; UINT sc; UINT ec; - RECT rcWnd; - RECT rcLine; - RECT rcUpdate; + RECT16 rcWnd; + RECT16 rcLine; + RECT16 rcUpdate; UINT l; if (end == start ) @@ -885,26 +885,26 @@ static void EDIT_InvalidateText(WND *wndPtr, UINT start, UINT end) EDIT_GetRect(wndPtr, 0, (LPARAM)&rcWnd); if (sl == el) { EDIT_GetLineRect(wndPtr, sl, sc, ec, &rcLine); - if (IntersectRect(&rcUpdate, &rcWnd, &rcLine)) - InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE); + if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine)) + InvalidateRect16( wndPtr->hwndSelf, &rcUpdate, FALSE ); } else { EDIT_GetLineRect(wndPtr, sl, sc, (UINT)EDIT_EM_LineLength(wndPtr, (UINT)EDIT_EM_LineIndex(wndPtr, sl, 0L), 0L), &rcLine); - if (IntersectRect(&rcUpdate, &rcWnd, &rcLine)) - InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE); + if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine)) + InvalidateRect16( wndPtr->hwndSelf, &rcUpdate, FALSE ); for (l = sl + 1 ; l < el ; l++) { EDIT_GetLineRect(wndPtr, l, 0, (UINT)EDIT_EM_LineLength(wndPtr, (UINT)EDIT_EM_LineIndex(wndPtr, l, 0L), 0L), &rcLine); - if (IntersectRect(&rcUpdate, &rcWnd, &rcLine)) - InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE); + if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine)) + InvalidateRect16(wndPtr->hwndSelf, &rcUpdate, FALSE); } EDIT_GetLineRect(wndPtr, el, 0, ec, &rcLine); - if (IntersectRect(&rcUpdate, &rcWnd, &rcLine)) - InvalidateRect(wndPtr->hwndSelf, &rcUpdate, FALSE); + if (IntersectRect16(&rcUpdate, &rcWnd, &rcLine)) + InvalidateRect16( wndPtr->hwndSelf, &rcUpdate, FALSE ); } } @@ -1348,7 +1348,7 @@ static LRESULT EDIT_ReplaceSel(WND *wndPtr, WPARAM wParam, LPARAM lParam) EDIT_NOTIFY_PARENT(wndPtr, EN_UPDATE); EDIT_WM_SetRedraw(wndPtr, redraw, 0L); if (redraw) { - InvalidateRect(wndPtr->hwndSelf, NULL, TRUE); + InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE ); EDIT_NOTIFY_PARENT(wndPtr, EN_CHANGE); } return 0L; @@ -1805,7 +1805,7 @@ static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam) UINT tw = EDIT_GetTextWidth(wndPtr); INT dx; INT dy; - POINT pos; + POINT16 pos; HRGN hRgn; if (nfv >= lc) @@ -1823,7 +1823,7 @@ static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam) GetUpdateRgn(wndPtr->hwndSelf, hRgn, FALSE); ValidateRgn(wndPtr->hwndSelf, 0); OffsetRgn(hRgn, dx, dy); - InvalidateRgn(wndPtr->hwndSelf, hRgn, TRUE); + InvalidateRgn( wndPtr->hwndSelf, hRgn, TRUE ); DeleteObject(hRgn); ScrollWindow(wndPtr->hwndSelf, dx, dy, NULL, NULL); } @@ -1836,7 +1836,7 @@ static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam) SetScrollPos(wndPtr->hwndSelf, SB_HORZ, EDIT_WM_HScroll(wndPtr, EM_GETTHUMB, 0L), TRUE); if (wndPtr->hwndSelf == GetFocus()) { - GetCaretPos(&pos); + GetCaretPos16(&pos); SetCaretPos(pos.x + dx, pos.y + dy); ShowCaret(wndPtr->hwndSelf); } @@ -1894,7 +1894,7 @@ static LRESULT EDIT_EM_SetHandle(WND *wndPtr, WPARAM wParam, LPARAM lParam) EDIT_EM_SetModify(wndPtr, FALSE, 0L); EDIT_BuildLineDefs(wndPtr); if (EDIT_GetRedraw(wndPtr)) - InvalidateRect(wndPtr->hwndSelf, NULL, TRUE); + InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE ); EDIT_ScrollIntoView(wndPtr); } return 0L; @@ -2130,7 +2130,7 @@ static LRESULT EDIT_WM_Clear(WND *wndPtr, WPARAM wParam, LPARAM lParam) EDIT_NOTIFY_PARENT(wndPtr, EN_UPDATE); EDIT_WM_SetRedraw(wndPtr, redraw, 0L); if (redraw) { - InvalidateRect(wndPtr->hwndSelf, NULL, TRUE); + InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE ); EDIT_NOTIFY_PARENT(wndPtr, EN_CHANGE); } } @@ -2179,7 +2179,7 @@ static LRESULT EDIT_WM_Copy(WND *wndPtr, WPARAM wParam, LPARAM lParam) */ static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM wParam, LPARAM lParam) { - CREATESTRUCT *cs = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam); + CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); EDITSTATE *es; char *text; @@ -2207,7 +2207,8 @@ static LRESULT EDIT_WM_Create(WND *wndPtr, WPARAM wParam, LPARAM lParam) es->PasswordChar = (cs->style & ES_PASSWORD) ? '*' : '\0'; } if (!LOCAL_HeapSize(wndPtr->hInstance)) { - if (!LocalInit(wndPtr->hInstance, 0, GlobalSize(wndPtr->hInstance))) { + if (!LocalInit(wndPtr->hInstance, 0, + GlobalSize16(wndPtr->hInstance))) { fprintf(stderr, "edit: WM_CREATE: could not initialize local heap\n"); return -1L; } @@ -2282,22 +2283,22 @@ static LRESULT EDIT_WM_Enable(WND *wndPtr, WPARAM wParam, LPARAM lParam) static LRESULT EDIT_WM_EraseBkGnd(WND *wndPtr, WPARAM wParam, LPARAM lParam) { HBRUSH hBrush; - RECT rc; + RECT16 rc; hBrush = (HBRUSH)EDIT_SEND_CTLCOLOR(wndPtr, wParam); if (!hBrush) hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); - GetClientRect(wndPtr->hwndSelf, &rc); + GetClientRect16(wndPtr->hwndSelf, &rc); IntersectClipRect((HDC)wParam, rc.left, rc.top, rc.right, rc.bottom); - GetClipBox((HDC)wParam, &rc); + GetClipBox16((HDC)wParam, &rc); /* * FIXME: specs say that we should UnrealizeObject() the brush, * but the specs of UnrealizeObject() say that we shouldn't * unrealize a stock object. The default brush that * DefWndProc() returns is ... a stock object. */ - FillRect((HDC)wParam, &rc, hBrush); + FillRect16((HDC)wParam, &rc, hBrush); return -1L; } @@ -2642,23 +2643,23 @@ static LRESULT EDIT_WM_MouseMove(WND *wndPtr, WPARAM wParam, LPARAM lParam) */ static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam) { - PAINTSTRUCT ps; + PAINTSTRUCT16 ps; UINT i; UINT fv = (UINT)EDIT_EM_GetFirstVisibleLine(wndPtr, 0, 0L); UINT vlc = EDIT_GetVisibleLineCount(wndPtr); UINT lc = (UINT)EDIT_EM_GetLineCount(wndPtr, 0, 0L); - HDC hdc; + HDC16 hdc; HFONT hFont; HFONT oldFont = 0; - RECT rc; - RECT rcLine; - RECT rcRgn; + RECT16 rc; + RECT16 rcLine; + RECT16 rcRgn; BOOL rev = IsWindowEnabled(wndPtr->hwndSelf) && ((GetFocus() == wndPtr->hwndSelf) || (wndPtr->dwStyle & ES_NOHIDESEL)); - hdc = BeginPaint(wndPtr->hwndSelf, &ps); - GetClientRect(wndPtr->hwndSelf, &rc); + hdc = BeginPaint16(wndPtr->hwndSelf, &ps); + GetClientRect16(wndPtr->hwndSelf, &rc); IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); hFont = EDIT_WM_GetFont(wndPtr, 0, 0L); if (hFont) @@ -2666,15 +2667,15 @@ static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam) EDIT_SEND_CTLCOLOR(wndPtr, hdc); if (!IsWindowEnabled(wndPtr->hwndSelf)) SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT)); - GetClipBox(hdc, &rcRgn); + GetClipBox16(hdc, &rcRgn); for (i = fv ; i <= MIN(fv + vlc, fv + lc - 1) ; i++ ) { EDIT_GetLineRect(wndPtr, i, 0, -1, &rcLine); - if (IntersectRect(&rc, &rcRgn, &rcLine)) + if (IntersectRect16(&rc, &rcRgn, &rcLine)) EDIT_PaintLine(wndPtr, hdc, i, rev); } if (hFont) SelectObject(hdc, oldFont); - EndPaint(wndPtr->hwndSelf, &ps); + EndPaint16(wndPtr->hwndSelf, &ps); return 0L; } @@ -2760,7 +2761,7 @@ static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam) ReleaseDC(wndPtr->hwndSelf, hdc); EDIT_BuildLineDefs(wndPtr); if ((BOOL)lParam && EDIT_GetRedraw(wndPtr)) - InvalidateRect(wndPtr->hwndSelf, NULL, TRUE); + InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE ); if (wndPtr->hwndSelf == GetFocus()) { DestroyCaret(); CreateCaret(wndPtr->hwndSelf, 0, 2, EDIT_GetLineHeight(wndPtr)); @@ -2815,7 +2816,7 @@ static LRESULT EDIT_WM_Size(WND *wndPtr, WPARAM wParam, LPARAM lParam) (wParam == SIZE_RESTORED))) { if (IsMultiLine(wndPtr) && IsWordWrap(wndPtr)) EDIT_BuildLineDefs(wndPtr); - InvalidateRect(wndPtr->hwndSelf, NULL, TRUE); + InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE ); } return 0L; } diff --git a/controls/listbox.c b/controls/listbox.c index b6d31c05f02..9e40cba579c 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -27,7 +27,7 @@ #include "dos_fs.h" #include "drive.h" #include "file.h" -#include "stackframe.h" +#include "heap.h" #include "stddebug.h" #include "debug.h" #include "xmalloc.h" @@ -117,7 +117,7 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent) if (lphl->OwnerDrawn) { LISTSTRUCT dummyls; - lphl->hDrawItemStruct = USER_HEAP_ALLOC(sizeof(DRAWITEMSTRUCT)); + lphl->hDrawItemStruct = USER_HEAP_ALLOC(sizeof(DRAWITEMSTRUCT16)); lphl->needMeasure = TRUE; dummyls.mis.CtlType = lphl->DrawCtlType; dummyls.mis.CtlID = lphl->CtlID; @@ -187,9 +187,7 @@ void ListBoxUpdateWindow(HWND hwnd, LPHEADLIST lphl, BOOL repaint) SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible / lphl->ItemsPerColumn + 1, TRUE); - if (repaint && lphl->bRedrawFlag) { - InvalidateRect(hwnd, NULL, TRUE); - } + if (repaint && lphl->bRedrawFlag) InvalidateRect32( hwnd, NULL, TRUE ); } /* Returns: 0 if nothing needs to be changed */ @@ -237,10 +235,10 @@ LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT uIndex) void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls, - RECT *rect, WORD itemAction, WORD itemState) + RECT16 *rect, WORD itemAction, WORD itemState) { if (lphl->OwnerDrawn) { - DRAWITEMSTRUCT *dis = USER_HEAP_LIN_ADDR(lphl->hDrawItemStruct); + DRAWITEMSTRUCT16 *dis = USER_HEAP_LIN_ADDR(lphl->hDrawItemStruct); dis->CtlID = lpls->mis.CtlID; dis->CtlType = lpls->mis.CtlType; @@ -262,7 +260,7 @@ void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls, if (itemState != 0) { dwOldTextColor = SetTextColor(hdc, 0x00FFFFFFL); - FillRect(hdc, rect, GetStockObject(BLACK_BRUSH)); + FillRect16(hdc, rect, GetStockObject(BLACK_BRUSH)); } if (lphl->dwStyle & LBS_USETABSTOPS) { @@ -270,8 +268,8 @@ void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls, (char *)lpls->itemText, strlen((char *)lpls->itemText), lphl->iNumStops, lphl->TabStops, 0); } else { - TextOut(hdc, rect->left + 5, rect->top + 2, - (char *)lpls->itemText, strlen((char *)lpls->itemText)); + TextOut16(hdc, rect->left + 5, rect->top + 2, + (char *)lpls->itemText, strlen((char *)lpls->itemText)); } if (itemState != 0) { @@ -279,7 +277,7 @@ void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls, } SetBkMode(hdc, OldBkMode); - } else DrawFocusRect(hdc, rect); + } else DrawFocusRect16(hdc, rect); } return; @@ -290,7 +288,7 @@ int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y) { LPLISTSTRUCT lpls = lphl->lpFirst; int i, j; - POINT point; + POINT16 point; point.x = X; point.y = Y; if (lphl->ItemsCount == 0) return LB_ERR; @@ -301,7 +299,7 @@ int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y) } for(j = 0; j < lphl->ItemsVisible; i++, j++) { if (lpls == NULL) return LB_ERR; - if (PtInRect(&lpls->itemRect,point)) { + if (PtInRect16(&lpls->itemRect,point)) { return i; } lpls = lpls->lpNext; @@ -349,7 +347,7 @@ LPLISTSTRUCT ListBoxCreateItem(LPHEADLIST lphl, int id) lplsnew->mis.itemHeight = lphl->StdItemHeight; lplsnew->mis.itemWidth = 0; /* ignored */ lplsnew->mis.itemData = 0; - SetRect(&lplsnew->itemRect, 0, 0, 0, 0); + SetRectEmpty16( &lplsnew->itemRect ); return lplsnew; } @@ -598,7 +596,8 @@ int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex) lpls->itemState = 0; } - if (wIndex != (UINT)-1) { + if ((wIndex != (UINT)-1) && (wIndex < lphl->ItemsCount)) + { lphl->ItemFocused = wIndex; lpls = ListBoxGetItem(lphl, wIndex); if (lpls == 0) return LB_ERR; @@ -714,7 +713,7 @@ LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec) /* ------------------------- dimensions ------------------------- */ -int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT lprect) +int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT16 lprect) { LPLISTSTRUCT lpls = ListBoxGetItem(lphl,wIndex); @@ -773,14 +772,14 @@ static LONG LBCreate(HWND hwnd, WORD wParam, LONG lParam) { LPHEADLIST lphl; LONG dwStyle = GetWindowLong(hwnd,GWL_STYLE); - RECT rect; + RECT16 rect; CreateListBoxStruct(hwnd, ODT_LISTBOX, dwStyle, GetParent(hwnd)); lphl = ListBoxGetStorageHeader(hwnd); dprintf_listbox(stddeb,"ListBox created: lphl = %p dwStyle = %04x:%04x\n", lphl, HIWORD(dwStyle), LOWORD(dwStyle)); - GetClientRect(hwnd,&rect); + GetClientRect16(hwnd,&rect); lphl->ColumnsWidth = rect.right - rect.left; if (dwStyle & WS_VSCROLL) @@ -850,7 +849,7 @@ static LONG LBVScroll(HWND hwnd, WORD wParam, LONG lParam) if (y != lphl->FirstVisible) { SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); } return 0; } @@ -906,7 +905,7 @@ static LONG LBHScroll(HWND hwnd, WORD wParam, LONG lParam) if (y != lphl->FirstVisible) { SetScrollPos(hwnd, SB_HORZ, lphl->FirstVisible / lphl->ItemsPerColumn + 1, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); } } return 0; @@ -920,9 +919,7 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam) LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); WORD wRet; int y,n; - RECT rectsel; - POINT tmpPOINT; - tmpPOINT.x = LOWORD(lParam); tmpPOINT.y = HIWORD(lParam); + RECT16 rectsel; SetFocus(hwnd); SetCapture(hwnd); @@ -957,7 +954,7 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam) lpls->itemState = ODS_FOCUS | ODS_SELECTED; if( n > 1 && n != LB_ERR ) - InvalidateRect(hwnd,NULL,TRUE); + InvalidateRect32( hwnd,NULL,TRUE ); } else return 0; @@ -978,17 +975,17 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam) if( lphl->dwStyle & LBS_MULTIPLESEL || y!=lphl->PrevFocused ) { ListBoxGetItemRect(lphl, y, &rectsel); - InvalidateRect(hwnd, &rectsel, TRUE); + InvalidateRect16( hwnd, &rectsel, TRUE ); } if( lphl->PrevFocused!=-1 && y!=lphl->PrevFocused ) { ListBoxGetItemRect(lphl, lphl->PrevFocused, &rectsel); - InvalidateRect(hwnd, &rectsel, TRUE); + InvalidateRect16( hwnd, &rectsel, TRUE ); } #ifndef WINELIB if (GetWindowLong(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT) - if( DragDetect(lphl->hSelf,tmpPOINT) ) + if( DragDetect(lphl->hSelf,MAKEPOINT16(lParam)) ) SendMessage(lphl->hParent, WM_BEGINDRAG,0,0L); #endif return 0; @@ -1036,7 +1033,7 @@ static LONG LBMouseMove(HWND hwnd, WORD wParam, LONG lParam) LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); int y,redraw_prev = 0; int iRet; - RECT rect, rectsel; /* XXX Broken */ + RECT16 rect, rectsel; /* XXX Broken */ dprintf_listbox(stddeb,"LBMouseMove %d %d\n",SLOWORD(lParam),SHIWORD(lParam)); if ((wParam & MK_LBUTTON) != 0) { @@ -1045,16 +1042,16 @@ static LONG LBMouseMove(HWND hwnd, WORD wParam, LONG lParam) if (lphl->FirstVisible > 0) { lphl->FirstVisible--; SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } } - GetClientRect(hwnd, &rect); + GetClientRect16(hwnd, &rect); if (y >= (rect.bottom-LBMM_EDGE)) { if (lphl->FirstVisible < ListMaxFirstVisible(lphl)) { lphl->FirstVisible++; SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } } @@ -1084,10 +1081,10 @@ static LONG LBMouseMove(HWND hwnd, WORD wParam, LONG lParam) if( lphl->PrevFocused!=-1 && redraw_prev ) { ListBoxGetItemRect(lphl, lphl->PrevFocused, &rectsel); - InvalidateRect(hwnd, &rectsel, TRUE); + InvalidateRect16( hwnd, &rectsel, TRUE ); } ListBoxGetItemRect(lphl, iRet, &rectsel); - InvalidateRect(hwnd, &rectsel, TRUE); + InvalidateRect16( hwnd, &rectsel, TRUE ); } } } @@ -1104,7 +1101,7 @@ static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam) { LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); WORD newFocused = 0xFFFF; - RECT rect; + RECT16 rect; ListBoxGetItemRect(lphl,lphl->ItemFocused,&rect); switch(wParam) @@ -1197,14 +1194,14 @@ static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam) if( ListBoxScrollToFocus(lphl) || (lphl->dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) ) - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); else { - InvalidateRect(hwnd, &rect, TRUE); + InvalidateRect16( hwnd, &rect, TRUE ); if( newFocused < 0x8000 ) { ListBoxGetItemRect(lphl, newFocused, &rect); - InvalidateRect(hwnd, &rect, TRUE); + InvalidateRect16( hwnd, &rect, TRUE ); } } @@ -1246,7 +1243,7 @@ static LONG LBChar(HWND hwnd, WORD wParam, LONG lParam) ListBoxScrollToFocus(lphl); SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -1301,24 +1298,24 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) { LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); LPLISTSTRUCT lpls; - PAINTSTRUCT ps; + PAINTSTRUCT16 ps; HBRUSH hBrush; HFONT hOldFont; - HDC hdc = BeginPaint( hwnd, &ps ); + HDC16 hdc = BeginPaint16( hwnd, &ps ); DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC); - RECT rect, paintRect, scratchRect; + RECT16 rect, paintRect, scratchRect; int i, top, height, maxwidth, ipc; top = 0; if (!IsWindowVisible(hwnd) || !lphl->bRedrawFlag) { - EndPaint(hwnd, &ps); + EndPaint16(hwnd, &ps); return 0; } - GetRgnBox(dc->w.hGCClipRgn,&paintRect); - GetClientRect(hwnd, &rect); - IntersectRect(&paintRect,&rect,&paintRect); + GetRgnBox16(dc->w.hGCClipRgn,&paintRect); + GetClientRect16(hwnd, &rect); + IntersectRect16(&paintRect,&rect,&paintRect); hOldFont = SelectObject(hdc, lphl->hFont); @@ -1332,7 +1329,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) if (hBrush == 0) hBrush = GetStockObject(WHITE_BRUSH); - FillRect(hdc, &rect, hBrush); + FillRect16(hdc, &rect, hBrush); maxwidth = rect.right; if (lphl->dwStyle & LBS_MULTICOLUMN) { @@ -1367,7 +1364,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) lpls->itemRect.left = rect.left; lpls->itemRect.right = rect.right; - if( IntersectRect(&scratchRect,&paintRect,&lpls->itemRect) ) + if( IntersectRect16(&scratchRect,&paintRect,&lpls->itemRect) ) { dprintf_listbox(stddeb,"LBPaint: drawing item: %d %d %d %d %d\n", rect.left,top,rect.right,top+height,lpls->itemState); @@ -1394,7 +1391,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam) } ListBoxUpdateWindow(hwnd,lphl,FALSE); SelectObject(hdc,hOldFont); - EndPaint( hwnd, &ps ); + EndPaint16( hwnd, &ps ); return 0; } @@ -1454,7 +1451,7 @@ static LONG LBKillFocus(HWND hwnd, WORD wParam, LONG lParam) dprintf_listbox(stddeb,"LBKillFocus: no focused item!\n"); } else - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); ListBoxSendNotification(lphl, LBN_KILLFOCUS); @@ -1735,7 +1732,7 @@ static LONG LBSelectString(HWND hwnd, WORD wParam, LONG lParam) ListBoxSetCurSel(lphl,iRet); lphl->ItemFocused = iRet; - InvalidateRect(hwnd,0,TRUE); + InvalidateRect32( hwnd, 0, TRUE ); } return iRet; } @@ -1793,7 +1790,7 @@ static LONG LBSetCaretIndex(HWND hwnd, WORD wParam, LONG lParam) SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); if(i) - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 1; } @@ -1805,7 +1802,7 @@ static LONG LBSetColumnWidth(HWND hwnd, WORD wParam, LONG lParam) { LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); lphl->ColumnsWidth = wParam; - InvalidateRect(hwnd,NULL,TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -1875,7 +1872,7 @@ static LONG LBSetCurSel(HWND hwnd, WORD wParam, LONG lParam) wRet = ListBoxSetCurSel(lphl, wParam); SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return wRet; } @@ -1886,26 +1883,25 @@ static LONG LBSetCurSel(HWND hwnd, WORD wParam, LONG lParam) static LONG LBSetSel(HWND hwnd, WORD wParam, LONG lParam) { LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd); - RECT rect; + RECT16 rect; int iRet; dprintf_listbox(stddeb,"ListBox LB_SETSEL wParam=%x lParam=%lX !\n", wParam, lParam); iRet = ListBoxSetSel(lphl, LOWORD(lParam), wParam); - if( iRet > 1 ) - InvalidateRect(hwnd, NULL, TRUE); + if( iRet > 1 ) InvalidateRect32( hwnd, NULL, TRUE ); else if( iRet != LB_ERR ) { if( lphl->dwStyle & LBS_EXTENDEDSEL && lphl->ItemFocused != LOWORD(lParam) ) { ListBoxGetItemRect(lphl, lphl->ItemFocused , &rect); - InvalidateRect(hwnd,&rect,TRUE); + InvalidateRect16( hwnd, &rect, TRUE ); lphl->ItemFocused = LOWORD(lParam); } ListBoxGetItemRect(lphl,LOWORD(lParam),&rect); - InvalidateRect(hwnd,&rect,TRUE); + InvalidateRect16( hwnd, &rect, TRUE ); } return (iRet == (WORD)LB_ERR)? LB_ERR: 0; @@ -1923,7 +1919,7 @@ static LONG LBSetTopIndex(HWND hwnd, WORD wParam, LONG lParam) lphl->FirstVisible = wParam; SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE); - InvalidateRect(hwnd, NULL, TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return 0; } @@ -1938,7 +1934,7 @@ static LONG LBSetItemHeight(HWND hwnd, WORD wParam, LONG lParam) dprintf_listbox(stddeb,"ListBox LB_SETITEMHEIGHT wParam=%x lParam=%lX !\n", wParam, lParam); wRet = ListBoxSetItemHeight(lphl, wParam, lParam); - InvalidateRect(hwnd,NULL,TRUE); + InvalidateRect32( hwnd, NULL, TRUE ); return wRet; } @@ -2045,13 +2041,14 @@ LRESULT ListBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) */ BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id ) { - char buffer[20]; + char *buffer; INT i; dprintf_listbox( stddeb, "DlgDirSelect: %04x '%s' %d\n", hDlg, lpStr, id ); if ((i = SendDlgItemMessage( hDlg, id, LB_GETCURSEL, 0, 0 )) == LB_ERR) return FALSE; - SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, (LPARAM)MAKE_SEGPTR(buffer) ); + if (!(buffer = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE; + SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, (LPARAM)SEGPTR_GET(buffer) ); if (buffer[0] == '[') /* drive or directory */ { if (buffer[1] == '-') /* drive */ @@ -2060,15 +2057,18 @@ BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id ) lpStr[1] = ':'; lpStr[2] = '\0'; dprintf_listbox( stddeb, "Returning drive '%s'\n", lpStr ); + SEGPTR_FREE(buffer); return TRUE; } strcpy( lpStr, buffer + 1 ); lpStr[strlen(lpStr)-1] = '\\'; dprintf_listbox( stddeb, "Returning directory '%s'\n", lpStr ); + SEGPTR_FREE(buffer); return TRUE; } strcpy( lpStr, buffer ); dprintf_listbox( stddeb, "Returning file '%s'\n", lpStr ); + SEGPTR_FREE(buffer); return FALSE; } @@ -2101,7 +2101,6 @@ INT DlgDirList( HWND hDlg, SEGPTR spec, INT idLBox, INT idStatic, UINT attrib ) if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0)) { char mask[20]; - char temp[] = "*.*"; if (!filespec[0]) strcpy( mask, "*.*" ); else @@ -2131,10 +2130,18 @@ INT DlgDirList( HWND hDlg, SEGPTR spec, INT idLBox, INT idStatic, UINT attrib ) SENDMSG( LB_RESETCONTENT, 0, 0 ); if ((attrib & DDL_DIRECTORY) && !(attrib & DDL_EXCLUSIVE)) { + char *temp; if (SENDMSG( LB_DIR, attrib & ~(DDL_DIRECTORY | DDL_DRIVES), (LPARAM)spec ) == LB_ERR) return FALSE; + if (!(temp = SEGPTR_ALLOC( 4*sizeof(char) ))) return FALSE; + strcpy( temp, "*.*" ); if (SENDMSG( LB_DIR, (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE, - (LPARAM)MAKE_SEGPTR(temp) ) == LB_ERR) return FALSE; + (LPARAM)SEGPTR_GET(temp) ) == LB_ERR) + { + SEGPTR_FREE(temp); + return FALSE; + } + SEGPTR_FREE(temp); } else { @@ -2144,12 +2151,15 @@ INT DlgDirList( HWND hDlg, SEGPTR spec, INT idLBox, INT idStatic, UINT attrib ) if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0)) { - char temp[256]; + const char *cwd = DRIVE_GetDosCwd(drive); + char *temp = SEGPTR_ALLOC( strlen(cwd) + 4 ); + if (!temp) return FALSE; strcpy( temp, "A:\\" ); temp[0] += drive; - lstrcpyn( temp+3, DRIVE_GetDosCwd(drive), 253 ); + strcpy( temp + 3, cwd ); AnsiLower( temp ); - SENDMSG( WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(temp) ); + SENDMSG( WM_SETTEXT, 0, (LPARAM)SEGPTR_GET(temp) ); + SEGPTR_FREE(temp); } return TRUE; #undef SENDMSG diff --git a/controls/menu.c b/controls/menu.c index 20f4e06d85c..e36dea03f51 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -20,6 +20,7 @@ #include "sysmetrics.h" #include "task.h" #include "win.h" +#include "heap.h" #include "menu.h" #include "module.h" #include "neexe.h" @@ -27,7 +28,6 @@ #include "message.h" #include "graphics.h" #include "resource.h" -#include "stackframe.h" #include "stddebug.h" #include "debug.h" @@ -62,7 +62,8 @@ static BOOL fEndMenuCalled = FALSE; ((DWORD)MAKELONG( (WORD)(item)->hText, (item)->xTab )) extern void NC_DrawSysButton(HWND hwnd, HDC hdc, BOOL down); /* nonclient.c */ -static HMENU MENU_CopySysMenu(void); + +HMENU MENU_CopySysMenu(void); static HBITMAP hStdCheck = 0; static HBITMAP hStdMnArrow = 0; @@ -136,7 +137,7 @@ static BOOL MENU_HasSysMenu( POPUPMENU *menu ) /********************************************************************** * MENU_CopySysMenu */ -static HMENU MENU_CopySysMenu(void) +HMENU MENU_CopySysMenu(void) { HMENU hMenu; HGLOBAL handle; @@ -163,7 +164,7 @@ static HMENU MENU_CopySysMenu(void) * Check whether the point (in screen coords) is in the system menu * of the window owning the given menu. */ -static BOOL MENU_IsInSysMenu( POPUPMENU *menu, POINT pt ) +static BOOL MENU_IsInSysMenu( POPUPMENU *menu, POINT16 pt ) { WND *wndPtr; @@ -303,21 +304,23 @@ static void MENU_CalcItemSize( HDC hdc, LPMENUITEM lpitem, HWND hwndOwner, DWORD dwSize; char *p; - SetRect( &lpitem->rect, orgX, orgY, orgX, orgY ); + SetRect16( &lpitem->rect, orgX, orgY, orgX, orgY ); if (lpitem->item_flags & MF_OWNERDRAW) { - MEASUREITEMSTRUCT mis; - mis.CtlType = ODT_MENU; - mis.itemID = lpitem->item_id; - mis.itemData = GET_OWNERDRAW_DATA(lpitem); - mis.itemHeight = 16; - mis.itemWidth = 30; - SendMessage( hwndOwner, WM_MEASUREITEM, 0, (LPARAM)MAKE_SEGPTR(&mis) ); - lpitem->rect.bottom += mis.itemHeight; - lpitem->rect.right += mis.itemWidth; + MEASUREITEMSTRUCT *mis; + if (!(mis = SEGPTR_NEW(MEASUREITEMSTRUCT))) return; + mis->CtlType = ODT_MENU; + mis->itemID = lpitem->item_id; + mis->itemData = GET_OWNERDRAW_DATA(lpitem); + mis->itemHeight = 16; + mis->itemWidth = 30; + SendMessage( hwndOwner, WM_MEASUREITEM, 0, (LPARAM)SEGPTR_GET(mis) ); + lpitem->rect.bottom += mis->itemHeight; + lpitem->rect.right += mis->itemWidth; dprintf_menu( stddeb, "DrawMenuItem: MeasureItem %04x %dx%d!\n", - lpitem->item_id, mis.itemWidth, mis.itemHeight ); + lpitem->item_id, mis->itemWidth, mis->itemHeight ); + SEGPTR_FREE(mis); return; } @@ -434,7 +437,7 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop, HWND hwndOwner ) * * Calculate the size of the menu bar. */ -static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, LPPOPUPMENU lppop, +static void MENU_MenuBarCalcSize( HDC hdc, LPRECT16 lprect, LPPOPUPMENU lppop, HWND hwndOwner ) { LPMENUITEM lpitem, items; @@ -506,25 +509,27 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, LPPOPUPMENU lppop, static void MENU_DrawMenuItem( HWND hwnd, HDC hdc, LPMENUITEM lpitem, UINT height, BOOL menuBar ) { - RECT rect; + RECT16 rect; if (lpitem->item_flags & MF_OWNERDRAW) { - DRAWITEMSTRUCT dis; + DRAWITEMSTRUCT16 *dis; + if (!(dis = SEGPTR_NEW(DRAWITEMSTRUCT16))) return; dprintf_menu( stddeb, "DrawMenuItem: Ownerdraw!\n" ); - dis.CtlType = ODT_MENU; - dis.itemID = lpitem->item_id; - dis.itemData = GET_OWNERDRAW_DATA(lpitem); - dis.itemState = 0; - if (lpitem->item_flags & MF_CHECKED) dis.itemState |= ODS_CHECKED; - if (lpitem->item_flags & MF_GRAYED) dis.itemState |= ODS_GRAYED; - if (lpitem->item_flags & MF_HILITE) dis.itemState |= ODS_SELECTED; - dis.itemAction = ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS; - dis.hwndItem = hwnd; - dis.hDC = hdc; - dis.rcItem = lpitem->rect; - SendMessage( hwnd, WM_DRAWITEM, 0, (LPARAM)MAKE_SEGPTR(&dis) ); + dis->CtlType = ODT_MENU; + dis->itemID = lpitem->item_id; + dis->itemData = GET_OWNERDRAW_DATA(lpitem); + dis->itemState = 0; + if (lpitem->item_flags & MF_CHECKED) dis->itemState |= ODS_CHECKED; + if (lpitem->item_flags & MF_GRAYED) dis->itemState |= ODS_GRAYED; + if (lpitem->item_flags & MF_HILITE) dis->itemState |= ODS_SELECTED; + dis->itemAction = ODA_DRAWENTIRE | ODA_SELECT | ODA_FOCUS; + dis->hwndItem = hwnd; + dis->hDC = hdc; + dis->rcItem = lpitem->rect; + SendMessage( hwnd, WM_DRAWITEM, 0, (LPARAM)SEGPTR_GET(dis) ); + SEGPTR_FREE(dis); return; } @@ -534,8 +539,8 @@ static void MENU_DrawMenuItem( HWND hwnd, HDC hdc, LPMENUITEM lpitem, /* Draw the background */ if (lpitem->item_flags & MF_HILITE) - FillRect( hdc, &rect, sysColorObjects.hbrushHighlight ); - else FillRect( hdc, &rect, sysColorObjects.hbrushMenu ); + FillRect16( hdc, &rect, sysColorObjects.hbrushHighlight ); + else FillRect16( hdc, &rect, sysColorObjects.hbrushMenu ); SetBkMode( hdc, TRANSPARENT ); /* Draw the separator bar (if any) */ @@ -631,18 +636,18 @@ static void MENU_DrawMenuItem( HWND hwnd, HDC hdc, LPMENUITEM lpitem, if ((text[i] == '\t') || (text[i] == '\b')) break; } - DrawText( hdc, text, i, &rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE ); + DrawText16( hdc, text, i, &rect, DT_LEFT | DT_VCENTER | DT_SINGLELINE); if (text[i]) /* There's a tab or flush-right char */ { if (text[i] == '\t') { rect.left = lpitem->xTab; - DrawText( hdc, text + i + 1, -1, &rect, - DT_LEFT | DT_VCENTER | DT_SINGLELINE ); + DrawText16( hdc, text + i + 1, -1, &rect, + DT_LEFT | DT_VCENTER | DT_SINGLELINE ); } - else DrawText( hdc, text + i + 1, -1, &rect, - DT_RIGHT | DT_VCENTER | DT_SINGLELINE ); + else DrawText16( hdc, text + i + 1, -1, &rect, + DT_RIGHT | DT_VCENTER | DT_SINGLELINE ); } } } @@ -657,11 +662,11 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu ) { POPUPMENU *menu; MENUITEM *item; - RECT rect; + RECT16 rect; int i; - GetClientRect( hwnd, &rect ); - FillRect( hdc, &rect, sysColorObjects.hbrushMenu ); + GetClientRect16( hwnd, &rect ); + FillRect16( hdc, &rect, sysColorObjects.hbrushMenu ); menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ); if (!menu || !menu->nItems) return; item = (MENUITEM *) USER_HEAP_LIN_ADDR( menu->hItems ); @@ -675,7 +680,7 @@ static void MENU_DrawPopupMenu( HWND hwnd, HDC hdc, HMENU hmenu ) * * Paint a menu bar. Returns the height of the menu bar. */ -UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, HWND hwnd, BOOL suppress_draw) +UINT MENU_DrawMenuBar(HDC hDC, LPRECT16 lprect, HWND hwnd, BOOL suppress_draw) { LPPOPUPMENU lppop; LPMENUITEM lpitem; @@ -690,7 +695,7 @@ UINT MENU_DrawMenuBar(HDC hDC, LPRECT lprect, HWND hwnd, BOOL suppress_draw) lprect->bottom = lprect->top + lppop->Height; if (suppress_draw) return lppop->Height; - FillRect(hDC, lprect, sysColorObjects.hbrushMenu ); + FillRect16(hDC, lprect, sysColorObjects.hbrushMenu ); SelectObject( hDC, sysColorObjects.hpenWindowFrame ); MoveTo( hDC, lprect->left, lprect->bottom ); LineTo( hDC, lprect->right, lprect->bottom ); @@ -797,7 +802,8 @@ static BOOL MENU_ShowPopup(HWND hwndOwner, HMENU hmenu, UINT id, int x, int y) /*********************************************************************** * MENU_SelectItem */ -static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex ) +static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex, + BOOL sendMenuSelect ) { MENUITEM *items; LPPOPUPMENU lppop; @@ -834,16 +840,17 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex ) if (lppop->FocusedItem == SYSMENU_SELECTED) { NC_DrawSysButton( lppop->hWnd, hdc, TRUE ); + if (sendMenuSelect) #ifdef WINELIB32 /* FIX: LostInfo */ - SendMessage( hwndOwner, WM_MENUSELECT, - MAKEWPARAM( WIN_FindWndPtr(lppop->hWnd)->hSysMenu, - lppop->wFlags | MF_MOUSESELECT ), - (LPARAM)hmenu ); + SendMessage( hwndOwner, WM_MENUSELECT, + MAKEWPARAM( WIN_FindWndPtr(lppop->hWnd)->hSysMenu, + lppop->wFlags | MF_MOUSESELECT ), + (LPARAM)hmenu ); #else - SendMessage( hwndOwner, WM_MENUSELECT, - WIN_FindWndPtr(lppop->hWnd)->hSysMenu, - MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) ); + SendMessage( hwndOwner, WM_MENUSELECT, + WIN_FindWndPtr(lppop->hWnd)->hSysMenu, + MAKELONG(lppop->wFlags | MF_MOUSESELECT, hmenu)); #endif } else @@ -851,27 +858,30 @@ static void MENU_SelectItem( HWND hwndOwner, HMENU hmenu, UINT wIndex ) items[lppop->FocusedItem].item_flags |= MF_HILITE; MENU_DrawMenuItem( lppop->hWnd, hdc, &items[lppop->FocusedItem], lppop->Height, !(lppop->wFlags & MF_POPUP) ); + if (sendMenuSelect) #ifdef WINELIB32 - SendMessage( hwndOwner, WM_MENUSELECT, - MAKEWPARAM( items[lppop->FocusedItem].item_id, - items[lppop->FocusedItem].item_flags | - MF_MOUSESELECT ), - (LPARAM) hmenu ); + SendMessage( hwndOwner, WM_MENUSELECT, + MAKEWPARAM( items[lppop->FocusedItem].item_id, + items[lppop->FocusedItem].item_flags| + MF_MOUSESELECT ), + (LPARAM) hmenu ); #else - SendMessage( hwndOwner, WM_MENUSELECT, - items[lppop->FocusedItem].item_id, - MAKELONG( items[lppop->FocusedItem].item_flags | MF_MOUSESELECT, hmenu)); + SendMessage( hwndOwner, WM_MENUSELECT, + items[lppop->FocusedItem].item_id, + MAKELONG( items[lppop->FocusedItem].item_flags | MF_MOUSESELECT, hmenu)); #endif } } #ifdef WINELIB32 /* FIX: Lost Info */ - else SendMessage( hwndOwner, WM_MENUSELECT, - MAKEWPARAM( (DWORD)hmenu, lppop->wFlags | MF_MOUSESELECT), - hmenu ); + else if (sendMenuSelect) + SendMessage( hwndOwner, WM_MENUSELECT, + MAKEWPARAM( (DWORD)hmenu, lppop->wFlags | MF_MOUSESELECT), + hmenu ); #else - else SendMessage( hwndOwner, WM_MENUSELECT, hmenu, - MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) ); + else if (sendMenuSelect) + SendMessage( hwndOwner, WM_MENUSELECT, hmenu, + MAKELONG( lppop->wFlags | MF_MOUSESELECT, hmenu ) ); #endif ReleaseDC( lppop->hWnd, hdc ); @@ -897,13 +907,13 @@ static void MENU_SelectNextItem( HWND hwndOwner, HMENU hmenu ) { if (!(items[i].item_flags & MF_SEPARATOR)) { - MENU_SelectItem( hwndOwner, hmenu, i ); + MENU_SelectItem( hwndOwner, hmenu, i, TRUE ); return; } } if (MENU_HasSysMenu( menu )) { - MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED ); + MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE ); return; } } @@ -911,12 +921,12 @@ static void MENU_SelectNextItem( HWND hwndOwner, HMENU hmenu ) { if (!(items[i].item_flags & MF_SEPARATOR)) { - MENU_SelectItem( hwndOwner, hmenu, i ); + MENU_SelectItem( hwndOwner, hmenu, i, TRUE ); return; } } if (MENU_HasSysMenu( menu )) - MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED ); + MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE ); } @@ -939,13 +949,13 @@ static void MENU_SelectPrevItem( HWND hwndOwner, HMENU hmenu ) { if (!(items[i].item_flags & MF_SEPARATOR)) { - MENU_SelectItem( hwndOwner, hmenu, i ); + MENU_SelectItem( hwndOwner, hmenu, i, TRUE ); return; } } if (MENU_HasSysMenu( menu )) { - MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED ); + MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE ); return; } } @@ -953,12 +963,12 @@ static void MENU_SelectPrevItem( HWND hwndOwner, HMENU hmenu ) { if (!(items[i].item_flags & MF_SEPARATOR)) { - MENU_SelectItem( hwndOwner, hmenu, i ); + MENU_SelectItem( hwndOwner, hmenu, i, TRUE ); return; } } if (MENU_HasSysMenu( menu )) - MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED ); + MENU_SelectItem( hwndOwner, hmenu, SYSMENU_SELECTED, TRUE ); } @@ -1000,7 +1010,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT id, SEGPTR data) item->item_flags = flags & ~(MF_HILITE | MF_MOUSESELECT); item->item_id = id; - SetRectEmpty( &item->rect ); + SetRectEmpty16( &item->rect ); if (hPrevText) USER_HEAP_FREE( hPrevText ); return TRUE; } @@ -1144,7 +1154,8 @@ static HMENU MENU_GetSubPopup( HMENU hmenu ) * * Hide the sub-popup menus of this menu. */ -static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu ) +static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu, + BOOL sendMenuSelect ) { MENUITEM *item; POPUPMENU *menu, *submenu; @@ -1165,18 +1176,18 @@ static void MENU_HideSubPopups( HWND hwndOwner, HMENU hmenu ) hsubmenu = (HMENU)item->item_id; } submenu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hsubmenu ); - MENU_HideSubPopups( hwndOwner, hsubmenu ); + MENU_HideSubPopups( hwndOwner, hsubmenu, FALSE ); + MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, sendMenuSelect ); if (submenu->hWnd == pTopPWnd->hwndSelf ) - { + { ShowWindow( submenu->hWnd, SW_HIDE ); uSubPWndLevel = 0; - } + } else - { + { DestroyWindow( submenu->hWnd ); submenu->hWnd = 0; - } - MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM ); + } } @@ -1228,12 +1239,12 @@ static HMENU MENU_ShowSubPopup( HWND hwndOwner, HMENU hmenu, BOOL selectFirst ) * * Find the menu containing a given point (in screen coords). */ -static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT pt ) +static HMENU MENU_FindMenuByCoords( HMENU hmenu, POINT16 pt ) { POPUPMENU *menu; HWND hwnd; - if (!(hwnd = WindowFromPoint( pt ))) return 0; + if (!(hwnd = WindowFromPoint16( pt ))) return 0; while (hmenu) { menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ); @@ -1300,7 +1311,7 @@ static BOOL MENU_ExecFocusedItem( HWND hwndOwner, HMENU hmenu, * Return TRUE if we can go on with menu tracking. */ static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, - POINT pt ) + POINT16 pt ) { POPUPMENU *menu; MENUITEM *item; @@ -1324,7 +1335,7 @@ static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, { if (menu->wFlags & MF_POPUP) { - MENU_HideSubPopups( hwndOwner, hmenu ); + MENU_HideSubPopups( hwndOwner, hmenu, TRUE ); *hmenuCurrent = hmenu; } else return FALSE; @@ -1334,8 +1345,8 @@ static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, } else { - MENU_HideSubPopups( hwndOwner, hmenu ); - MENU_SelectItem( hwndOwner, hmenu, id ); + MENU_HideSubPopups( hwndOwner, hmenu, FALSE ); + MENU_SelectItem( hwndOwner, hmenu, id, TRUE ); *hmenuCurrent = MENU_ShowSubPopup( hwndOwner, hmenu, FALSE ); } return TRUE; @@ -1350,7 +1361,7 @@ static BOOL MENU_ButtonDown( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, * Return TRUE if we can go on with menu tracking. */ static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, - POINT pt ) + POINT16 pt ) { POPUPMENU *menu; MENUITEM *item; @@ -1378,7 +1389,7 @@ static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, hsubmenu = (HMENU)item->item_id; } /* Select first item of sub-popup */ - MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM ); + MENU_SelectItem( hwndOwner, hsubmenu, NO_SELECTED_ITEM, FALSE ); MENU_SelectNextItem( hwndOwner, hsubmenu ); return TRUE; } @@ -1392,7 +1403,7 @@ static BOOL MENU_ButtonUp( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, * Return TRUE if we can go on with menu tracking. */ static BOOL MENU_MouseMove( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, - POINT pt ) + POINT16 pt ) { MENUITEM *item; POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ); @@ -1410,12 +1421,12 @@ static BOOL MENU_MouseMove( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent, } if (id == NO_SELECTED_ITEM) { - MENU_SelectItem( hwndOwner, *hmenuCurrent, NO_SELECTED_ITEM ); + MENU_SelectItem( hwndOwner, *hmenuCurrent, NO_SELECTED_ITEM, TRUE ); } else if (menu->FocusedItem != id) { - MENU_HideSubPopups( hwndOwner, hmenu ); - MENU_SelectItem( hwndOwner, hmenu, id ); + MENU_HideSubPopups( hwndOwner, hmenu, FALSE ); + MENU_SelectItem( hwndOwner, hmenu, id, TRUE ); *hmenuCurrent = MENU_ShowSubPopup( hwndOwner, hmenu, FALSE ); } return TRUE; @@ -1440,7 +1451,7 @@ static void MENU_KeyLeft( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent ) hmenutmp = MENU_GetSubPopup( hmenuprev ); if (hmenutmp != *hmenuCurrent) hmenuprev = hmenutmp; } - MENU_HideSubPopups( hwndOwner, hmenuprev ); + MENU_HideSubPopups( hwndOwner, hmenuprev, TRUE ); if ((hmenuprev == hmenu) && !(menu->wFlags & MF_POPUP)) { @@ -1483,7 +1494,7 @@ static void MENU_KeyRight( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent ) /* If on menu-bar, go to next item */ if (!(menu->wFlags & MF_POPUP)) { - MENU_HideSubPopups( hwndOwner, hmenu ); + MENU_HideSubPopups( hwndOwner, hmenu, FALSE ); MENU_SelectNextItem( hwndOwner, hmenu ); if (*hmenuCurrent != hmenu) { @@ -1500,7 +1511,7 @@ static void MENU_KeyRight( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent ) hmenutmp = MENU_GetSubPopup( hmenuprev ); if (hmenutmp != *hmenuCurrent) hmenuprev = hmenutmp; } - MENU_HideSubPopups( hwndOwner, hmenuprev ); + MENU_HideSubPopups( hwndOwner, hmenuprev, TRUE ); *hmenuCurrent = hmenuprev; } } @@ -1514,7 +1525,7 @@ static void MENU_KeyRight( HWND hwndOwner, HMENU hmenu, HMENU *hmenuCurrent ) * before beginning tracking. This is to help menu-bar tracking. */ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, - HWND hwnd, LPRECT lprect ) + HWND hwnd, const RECT16 *lprect ) { MSG *msg; HLOCAL16 hMsg; @@ -1527,7 +1538,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, if (!(menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( hmenu ))) return FALSE; if (x && y) { - POINT pt = { x, y }; + POINT16 pt = { x, y }; MENU_ButtonDown( hwnd, hmenu, &hmenuCurrent, pt ); } SetCapture( hwnd ); @@ -1564,7 +1575,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, case WM_LBUTTONUP: case WM_NCLBUTTONUP: /* If outside all menus but inside lprect, ignore it */ - if (!hsubmenu && lprect && PtInRect( lprect, msg->pt )) break; + if (!hsubmenu && lprect && PtInRect16(lprect, msg->pt)) break; fClosed = !MENU_ButtonUp( hwnd, hsubmenu, &hmenuCurrent, msg->pt ); fRemove = TRUE; /* Remove event even if outside menu */ @@ -1590,12 +1601,12 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, switch(msg->wParam) { case VK_HOME: - MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM ); + MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM, FALSE ); MENU_SelectNextItem( hwnd, hmenuCurrent ); break; case VK_END: - MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM ); + MENU_SelectItem( hwnd, hmenuCurrent, NO_SELECTED_ITEM, FALSE ); MENU_SelectPrevItem( hwnd, hmenuCurrent ); break; @@ -1654,7 +1665,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, else if (pos == (UINT)-1) MessageBeep(0); else { - MENU_SelectItem( hwnd, hmenuCurrent, pos ); + MENU_SelectItem( hwnd, hmenuCurrent, pos, TRUE ); fClosed = !MENU_ExecFocusedItem( hwnd, hmenuCurrent, &hmenuCurrent ); @@ -1675,13 +1686,13 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, } USER_HEAP_FREE( hMsg ); ReleaseCapture(); - MENU_HideSubPopups( hwnd, hmenu ); + MENU_HideSubPopups( hwnd, hmenu, FALSE ); if (menu->wFlags & MF_POPUP) - { + { ShowWindow( menu->hWnd, SW_HIDE ); uSubPWndLevel = 0; - } - MENU_SelectItem( hwnd, hmenu, NO_SELECTED_ITEM ); + } + MENU_SelectItem( hwnd, hmenu, NO_SELECTED_ITEM, FALSE ); SendMessage( hwnd, WM_MENUSELECT, 0, MAKELONG( 0xffff, 0 ) ); fEndMenuCalled = FALSE; return TRUE; @@ -1693,7 +1704,7 @@ static BOOL MENU_TrackMenu( HMENU hmenu, UINT wFlags, int x, int y, * * Menu-bar tracking upon a mouse event. Called from NC_HandleSysCommand(). */ -void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt ) +void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt ) { WND *wndPtr = WIN_FindWndPtr( hwnd ); HideCaret(0); @@ -1758,7 +1769,7 @@ void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey) } } - MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem ); + MENU_SelectItem( wndPtr->hwndSelf, hTrackMenu, uItem, TRUE ); if( uItem == NO_SELECTED_ITEM ) MENU_SelectNextItem( wndPtr->hwndSelf, hTrackMenu ); else @@ -1773,22 +1784,33 @@ void MENU_TrackKbdMenuBar( WND* wndPtr, UINT wParam, INT vkey) /********************************************************************** - * TrackPopupMenu (USER.416) + * TrackPopupMenu16 (USER.416) */ -BOOL TrackPopupMenu( HMENU hMenu, UINT wFlags, short x, short y, - short nReserved, HWND hWnd, LPRECT lpRect ) +BOOL16 TrackPopupMenu16( HMENU16 hMenu, UINT16 wFlags, INT16 x, INT16 y, + INT16 nReserved, HWND16 hWnd, const RECT16 *lpRect ) { - BOOL ret; + BOOL ret = FALSE; + HideCaret(0); - if (!MENU_ShowPopup( hWnd, hMenu, 0, x, y )) - ret = FALSE; - else + if (MENU_ShowPopup( hWnd, hMenu, 0, x, y )) ret = MENU_TrackMenu( hMenu, wFlags, 0, 0, hWnd, lpRect ); ShowCaret(0); return ret; } +/********************************************************************** + * TrackPopupMenu32 (USER32.548) + */ +BOOL32 TrackPopupMenu32( HMENU32 hMenu, UINT32 wFlags, INT32 x, INT32 y, + INT32 nReserved, HWND32 hWnd, const RECT32 *lpRect ) +{ + RECT16 r; + CONV_RECT32TO16( lpRect, &r ); + return TrackPopupMenu16( hMenu, wFlags, x, y, nReserved, hWnd, &r ); +} + + /*********************************************************************** * PopupMenuWndProc */ @@ -1798,12 +1820,12 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { case WM_CREATE: { - CREATESTRUCT *createStruct = (CREATESTRUCT*)PTR_SEG_TO_LIN(lParam); + CREATESTRUCT16 *cs = (CREATESTRUCT16*)PTR_SEG_TO_LIN(lParam); #ifdef WINELIB32 - HMENU hmenu = (HMENU) (createStruct->lpCreateParams); + HMENU hmenu = (HMENU) (cs->lpCreateParams); SetWindowLong( hwnd, 0, hmenu ); #else - HMENU hmenu = (HMENU) ((int)createStruct->lpCreateParams & 0xffff); + HMENU hmenu = (HMENU) ((int)cs->lpCreateParams & 0xffff); SetWindowWord( hwnd, 0, hmenu ); #endif return 0; @@ -1814,8 +1836,8 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) case WM_PAINT: { - PAINTSTRUCT ps; - BeginPaint( hwnd, &ps ); + PAINTSTRUCT16 ps; + BeginPaint16( hwnd, &ps ); MENU_DrawPopupMenu( hwnd, ps.hdc, #ifdef WINELIB32 (HMENU)GetWindowLong( hwnd, 0 ) @@ -1823,7 +1845,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) (HMENU)GetWindowWord( hwnd, 0 ) #endif ); - EndPaint( hwnd, &ps ); + EndPaint16( hwnd, &ps ); return 0; } @@ -1861,7 +1883,7 @@ LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY ) { HDC hdc; - RECT rectBar; + RECT16 rectBar; WND *wndPtr; LPPOPUPMENU lppop; @@ -1869,7 +1891,7 @@ UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY ) if (!(lppop = (LPPOPUPMENU)USER_HEAP_LIN_ADDR((HMENU)wndPtr->wIDmenu))) return 0; hdc = GetDC( hwnd ); - SetRect( &rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU ); + SetRect16(&rectBar, orgX, orgY, orgX+menubarWidth, orgY+SYSMETRICS_CYMENU); MENU_MenuBarCalcSize( hdc, &rectBar, lppop, hwnd ); ReleaseDC( hwnd, hdc ); return lppop->Height; @@ -1984,8 +2006,8 @@ BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, UINT wItemID, UINT wHilite) if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wHilite ))) return FALSE; if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return FALSE; if (menu->FocusedItem == wItemID) return TRUE; - MENU_HideSubPopups( hWnd, hMenu ); - MENU_SelectItem( hWnd, hMenu, wItemID ); + MENU_HideSubPopups( hWnd, hMenu, FALSE ); + MENU_SelectItem( hWnd, hMenu, wItemID, TRUE ); return TRUE; } diff --git a/controls/scroll.c b/controls/scroll.c index e0e7617efa4..932f5849e43 100644 --- a/controls/scroll.c +++ b/controls/scroll.c @@ -146,7 +146,7 @@ static SCROLLINFO *SCROLL_GetScrollInfo( HWND hwnd, int nBar ) * the thumb relative to the left or to the top. * Return TRUE if the scrollbar is vertical, FALSE if horizontal. */ -static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT *lprect, +static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT16 *lprect, WORD *arrowSize, WORD *thumbPos ) { int pixels; @@ -172,7 +172,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT *lprect, break; case SB_CTL: - GetClientRect( hwnd, lprect ); + GetClientRect16( hwnd, lprect ); vertical = ((wndPtr->dwStyle & SBS_VERT) != 0); break; @@ -215,7 +215,7 @@ static BOOL SCROLL_GetScrollBarRect( HWND hwnd, int nBar, RECT *lprect, * Compute the current scroll position based on the thumb position in pixels * from the top of the scroll-bar. */ -static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT *rect, +static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT16 *rect, BOOL vertical, WORD pos ) { int pixels = vertical ? rect->bottom-rect->top : rect->right-rect->left; @@ -237,14 +237,14 @@ static UINT SCROLL_GetThumbVal( SCROLLINFO *infoPtr, RECT *rect, * * Scroll-bar hit testing (don't confuse this with WM_NCHITTEST!). */ -static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, int nBar, POINT pt ) +static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, int nBar, POINT16 pt ) { WORD arrowSize, thumbPos; - RECT rect; + RECT16 rect; BOOL vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect, &arrowSize, &thumbPos ); - if (!PtInRect( &rect, pt )) return SCROLL_NOWHERE; + if (!PtInRect16( &rect, pt )) return SCROLL_NOWHERE; if (vertical) { @@ -274,7 +274,7 @@ static enum SCROLL_HITTEST SCROLL_HitTest( HWND hwnd, int nBar, POINT pt ) * * Draw the scroll bar arrows. */ -static void SCROLL_DrawArrows( HDC hdc, SCROLLINFO *infoPtr, RECT *rect, +static void SCROLL_DrawArrows( HDC hdc, SCROLLINFO *infoPtr, RECT16 *rect, WORD arrowSize, BOOL vertical, BOOL top_pressed, BOOL bottom_pressed ) { @@ -315,10 +315,10 @@ static void SCROLL_DrawArrows( HDC hdc, SCROLLINFO *infoPtr, RECT *rect, * * Draw the moving thumb rectangle. */ -static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical, +static void SCROLL_DrawMovingThumb( HDC hdc, RECT16 *rect, BOOL vertical, WORD arrowSize, WORD thumbPos ) { - RECT r = *rect; + RECT16 r = *rect; if (vertical) { r.top += thumbPos; @@ -335,8 +335,8 @@ static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical, r.left = rect->right - arrowSize - SYSMETRICS_CXVSCROLL - 1; r.right = r.left + SYSMETRICS_CXVSCROLL + 1; } - InflateRect( &r, -1, -1 ); - DrawFocusRect( hdc, &r ); + InflateRect16( &r, -1, -1 ); + DrawFocusRect16( hdc, &r ); } @@ -345,12 +345,12 @@ static void SCROLL_DrawMovingThumb( HDC hdc, RECT *rect, BOOL vertical, * * Draw the scroll bar interior (everything except the arrows). */ -static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect, +static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT16 *rect, WORD arrowSize, WORD thumbPos, WORD flags, BOOL vertical, BOOL top_selected, BOOL bottom_selected ) { - RECT r; + RECT16 r; /* Select the correct brush and pen */ @@ -438,7 +438,7 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect, SelectObject( hdc, sysColorObjects.hbrushBtnFace ); Rectangle( hdc, r.left, r.top, r.right, r.bottom ); - InflateRect( &r, -1, -1 ); + InflateRect16( &r, -1, -1 ); GRAPH_DrawReliefRect( hdc, &r, 1, 2, FALSE ); if ((hwndTracking == hwnd) && (nBarTracking == nBar)) SCROLL_DrawMovingThumb( hdc, rect, vertical, arrowSize, uTrackingPos); @@ -453,7 +453,7 @@ static void SCROLL_DrawInterior( HWND hwnd, HDC hdc, int nBar, RECT *rect, void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar ) { WORD arrowSize, thumbPos; - RECT rect; + RECT16 rect; BOOL vertical; WND *wndPtr = WIN_FindWndPtr( hwnd ); SCROLLINFO *infoPtr = SCROLL_GetPtrScrollInfo( wndPtr, nBar ); @@ -483,7 +483,7 @@ void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar ) static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar ) { WORD arrowSize, thumbPos; - RECT rect; + RECT16 rect; BOOL vertical; HDC hdc; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -543,10 +543,10 @@ static void SCROLL_HandleKbdEvent( HWND hwnd, WORD wParam ) * 'pt' is the location of the mouse event in client (for SB_CTL) or * windows coordinates. */ -void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) +void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT16 pt ) { /* Previous mouse position for timer events */ - static POINT prevPt; + static POINT16 prevPt; /* Hit test code of the last button-down event */ static enum SCROLL_HITTEST trackHitTest; /* Thumb position when tracking started. */ @@ -560,7 +560,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) HWND hwndOwner, hwndCtl; BOOL vertical; WORD arrowSize, thumbPos; - RECT rect; + RECT16 rect; HDC hdc; SCROLLINFO *infoPtr = SCROLL_GetScrollInfo( hwnd, nBar ); @@ -675,7 +675,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) { UINT pos, val; - if (!PtInRect( &rect, pt )) pos = lastClickPos; + if (!PtInRect16( &rect, pt )) pos = lastClickPos; else pos = vertical ? (pt.y - rect.top) : (pt.x - rect.left); if (pos != lastMousePos) { @@ -779,15 +779,11 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT pt ) */ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) { - POINT Pt; - Pt.x = LOWORD(lParam); Pt.y = HIWORD(lParam); - /* ^ Can't use MAKEPOINT macro in WINELIB32 */ - switch(message) { case WM_CREATE: { - CREATESTRUCT *lpCreat = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam); + CREATESTRUCT16 *lpCreat = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); if (lpCreat->style & SBS_SIZEBOX) { fprintf( stdnimp, "Unimplemented style SBS_SIZEBOX.\n" ); @@ -825,7 +821,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) case WM_LBUTTONUP: case WM_MOUSEMOVE: case WM_SYSTIMER: - SCROLL_HandleScrollEvent( hwnd, SB_CTL, message, Pt ); + SCROLL_HandleScrollEvent( hwnd, SB_CTL, message, MAKEPOINT16(lParam) ); break; case WM_KEYDOWN: @@ -840,10 +836,10 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) case WM_PAINT: { - PAINTSTRUCT ps; - HDC hdc = BeginPaint( hwnd, &ps ); + PAINTSTRUCT16 ps; + HDC16 hdc = BeginPaint16( hwnd, &ps ); SCROLL_DrawScrollBar( hwnd, hdc, SB_CTL ); - EndPaint( hwnd, &ps ); + EndPaint16( hwnd, &ps ); } break; diff --git a/controls/static.c b/controls/static.c index 9b88116db89..7af526f8b8c 100644 --- a/controls/static.c +++ b/controls/static.c @@ -79,19 +79,18 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) switch (uMsg) { case WM_ENABLE: - InvalidateRect(hWnd, NULL, FALSE); + InvalidateRect32( hWnd, NULL, FALSE ); break; case WM_NCCREATE: if (style == SS_ICON) { - CREATESTRUCT * createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam); - if (createStruct->lpszName) + CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); + if (cs->lpszName) { - HICON hicon = LoadIcon( createStruct->hInstance, - createStruct->lpszName ); + HICON hicon = LoadIcon( cs->hInstance, cs->lpszName ); if (!hicon) /* Try OEM icon (FIXME: is this right?) */ - hicon = LoadIcon( 0, createStruct->lpszName ); + hicon = LoadIcon( 0, cs->lpszName ); STATIC_SetIcon( wndPtr, hicon ); } return 1; @@ -120,11 +119,11 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_PAINT: { - PAINTSTRUCT ps; - BeginPaint( hWnd, &ps ); + PAINTSTRUCT16 ps; + BeginPaint16( hWnd, &ps ); if (staticPaintFunc[style]) (staticPaintFunc[style])( wndPtr, ps.hdc ); - EndPaint( hWnd, &ps ); + EndPaint16( hWnd, &ps ); } break; @@ -132,7 +131,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) color_windowframe = GetSysColor(COLOR_WINDOWFRAME); color_background = GetSysColor(COLOR_BACKGROUND); color_window = GetSysColor(COLOR_WINDOW); - InvalidateRect(hWnd, NULL, TRUE); + InvalidateRect32( hWnd, NULL, TRUE ); break; case WM_SETTEXT: @@ -142,7 +141,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) (SEGPTR)lParam )); else DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) ); - InvalidateRect( hWnd, NULL, FALSE ); + InvalidateRect32( hWnd, NULL, FALSE ); UpdateWindow( hWnd ); break; @@ -151,7 +150,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) infoPtr->hFont = (HFONT)wParam; if (LOWORD(lParam)) { - InvalidateRect( hWnd, NULL, FALSE ); + InvalidateRect32( hWnd, NULL, FALSE ); UpdateWindow( hWnd ); } break; @@ -170,7 +169,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case STM_SETICON: lResult = STATIC_SetIcon( wndPtr, (HICON)wParam ); - InvalidateRect( hWnd, NULL, FALSE ); + InvalidateRect32( hWnd, NULL, FALSE ); UpdateWindow( hWnd ); break; @@ -185,7 +184,7 @@ LONG StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc ) { - RECT rc; + RECT16 rc; HBRUSH hBrush; char *text; WORD wFormat; @@ -193,7 +192,7 @@ static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc ) LONG style = wndPtr->dwStyle; STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra; - GetClientRect( wndPtr->hwndSelf, &rc); + GetClientRect16( wndPtr->hwndSelf, &rc); text = USER_HEAP_LIN_ADDR( wndPtr->hText ); switch (style & 0x0000000F) @@ -234,42 +233,42 @@ static void STATIC_PaintTextfn( WND *wndPtr, HDC hdc ) MAKELONG(wndPtr->hwndSelf, CTLCOLOR_STATIC)); #endif if (!hBrush) hBrush = GetStockObject(WHITE_BRUSH); - FillRect(hdc, &rc, hBrush); - if (text) DrawText( hdc, text, -1, &rc, wFormat ); + FillRect16(hdc, &rc, hBrush); + if (text) DrawText16( hdc, text, -1, &rc, wFormat ); } static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc ) { - RECT rc; + RECT16 rc; HBRUSH hBrush; - GetClientRect( wndPtr->hwndSelf, &rc); + GetClientRect16( wndPtr->hwndSelf, &rc); switch (wndPtr->dwStyle & 0x0f) { case SS_BLACKRECT: hBrush = CreateSolidBrush(color_windowframe); - FillRect( hdc, &rc, hBrush ); + FillRect16( hdc, &rc, hBrush ); break; case SS_GRAYRECT: hBrush = CreateSolidBrush(color_background); - FillRect( hdc, &rc, hBrush ); + FillRect16( hdc, &rc, hBrush ); break; case SS_WHITERECT: hBrush = CreateSolidBrush(color_window); - FillRect( hdc, &rc, hBrush ); + FillRect16( hdc, &rc, hBrush ); break; case SS_BLACKFRAME: hBrush = CreateSolidBrush(color_windowframe); - FrameRect( hdc, &rc, hBrush ); + FrameRect16( hdc, &rc, hBrush ); break; case SS_GRAYFRAME: hBrush = CreateSolidBrush(color_background); - FrameRect( hdc, &rc, hBrush ); + FrameRect16( hdc, &rc, hBrush ); break; case SS_WHITEFRAME: hBrush = CreateSolidBrush(color_window); - FrameRect( hdc, &rc, hBrush ); + FrameRect16( hdc, &rc, hBrush ); break; default: return; @@ -280,11 +279,11 @@ static void STATIC_PaintRectfn( WND *wndPtr, HDC hdc ) static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc ) { - RECT rc; + RECT16 rc; HBRUSH hbrush; STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra; - GetClientRect( wndPtr->hwndSelf, &rc); + GetClientRect16( wndPtr->hwndSelf, &rc); #ifdef WINELIB32 hbrush = SendMessage( GetParent(wndPtr->hwndSelf), WM_CTLCOLORSTATIC, hdc, wndPtr->hwndSelf ); @@ -292,6 +291,6 @@ static void STATIC_PaintIconfn( WND *wndPtr, HDC hdc ) hbrush = SendMessage( GetParent(wndPtr->hwndSelf), WM_CTLCOLOR, hdc, MAKELONG(wndPtr->hwndSelf, CTLCOLOR_STATIC)); #endif - FillRect( hdc, &rc, hbrush ); + FillRect16( hdc, &rc, hbrush ); if (infoPtr->hIcon) DrawIcon( hdc, rc.left, rc.top, infoPtr->hIcon ); } diff --git a/controls/widgets.c b/controls/widgets.c index 1f737bc7c59..dc5a4414265 100644 --- a/controls/widgets.c +++ b/controls/widgets.c @@ -13,38 +13,38 @@ #include "gdi.h" #include "user.h" #include "module.h" -#include "stackframe.h" +#include "heap.h" static WNDCLASS16 WIDGETS_BuiltinClasses[] = { { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, - (WNDPROC)"ButtonWndProc", 0, sizeof(BUTTONINFO), + (WNDPROC16)"ButtonWndProc", 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, (SEGPTR)"BUTTON" }, { CS_GLOBALCLASS | CS_PARENTDC, - (WNDPROC)"StaticWndProc", 0, sizeof(STATICINFO), + (WNDPROC16)"StaticWndProc", 0, sizeof(STATICINFO), 0, 0, 0, 0, 0, (SEGPTR)"STATIC" }, { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, - (WNDPROC)"ScrollBarWndProc", 0, sizeof(SCROLLINFO), + (WNDPROC16)"ScrollBarWndProc", 0, sizeof(SCROLLINFO), 0, 0, 0, 0, 0, (SEGPTR)"SCROLLBAR" }, { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, - (WNDPROC)"ListBoxWndProc", 0, 8, + (WNDPROC16)"ListBoxWndProc", 0, 8, 0, 0, 0, 0, 0, (SEGPTR)"LISTBOX" }, { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, - (WNDPROC)"ComboBoxWndProc", 0, 8, + (WNDPROC16)"ComboBoxWndProc", 0, 8, 0, 0, 0, 0, 0, (SEGPTR)"COMBOBOX" }, { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, - (WNDPROC)"ComboLBoxWndProc", 0, 8, + (WNDPROC16)"ComboLBoxWndProc", 0, 8, 0, 0, 0, 0, 0, (SEGPTR)"COMBOLBOX" }, { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, - (WNDPROC)"EditWndProc", 0, sizeof(DWORD), + (WNDPROC16)"EditWndProc", 0, sizeof(DWORD), 0, 0, 0, 0, 0, (SEGPTR)"EDIT" }, - { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC)"PopupMenuWndProc", 0, 8, + { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"PopupMenuWndProc", 0, 8, 0, 0, 0, 0, 0, (SEGPTR)POPUPMENU_CLASS_NAME }, - { CS_GLOBALCLASS, (WNDPROC)"DesktopWndProc", 0, sizeof(DESKTOPINFO), + { CS_GLOBALCLASS, (WNDPROC16)"DesktopWndProc", 0, sizeof(DESKTOPINFO), 0, 0, 0, 0, 0, (SEGPTR)DESKTOP_CLASS_NAME }, - { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC)"DefDlgProc", 0, DLGWINDOWEXTRA, + { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"DefDlgProc", 0, DLGWINDOWEXTRA, 0, 0, 0, 0, 0, (SEGPTR)DIALOG_CLASS_NAME }, - { CS_GLOBALCLASS, (WNDPROC)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO), + { CS_GLOBALCLASS, (WNDPROC16)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO), 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, (SEGPTR)"MDICLIENT" } }; @@ -60,16 +60,18 @@ static WNDCLASS16 WIDGETS_BuiltinClasses[] = BOOL WIDGETS_Init(void) { int i; - char name[20]; + char *name; WNDCLASS16 *class = WIDGETS_BuiltinClasses; + if (!(name = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE; for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++) { strcpy( name, (char *)class->lpszClassName ); - class->lpszClassName = MAKE_SEGPTR(name); + class->lpszClassName = SEGPTR_GET(name); class->hCursor = LoadCursor( 0, IDC_ARROW ); class->lpfnWndProc = MODULE_GetWndProcEntry16( (char *)class->lpfnWndProc ); if (!RegisterClass16( class )) return FALSE; } + SEGPTR_FREE(name); return TRUE; } diff --git a/files/drive.c b/files/drive.c index 92c2c260b1d..c1b3e68ccb5 100644 --- a/files/drive.c +++ b/files/drive.c @@ -474,3 +474,28 @@ WORD GetDriveType( INT drive ) default: return DRIVE_CANNOTDETERMINE; } } + + +/*********************************************************************** + * GetCurrentDirectory (KERNEL.411) + */ +UINT32 GetCurrentDirectory( UINT32 buflen, LPSTR buf ) +{ + const char *s = DRIVE_GetDosCwd( DRIVE_GetCurrentDrive() ); + if (!s) + { + *buf = '\0'; + return 0; + } + lstrcpyn( buf, s, buflen ); + return strlen(s); /* yes */ +} + + +/*********************************************************************** + * SetCurrentDirectory (KERNEL.412) + */ +BOOL32 SetCurrentDirectory( LPCSTR dir ) +{ + return DRIVE_Chdir( DRIVE_GetCurrentDrive(), dir ); +} diff --git a/if1632/Makefile.in b/if1632/Makefile.in index c33bf52f7c6..ae1834de9d4 100644 --- a/if1632/Makefile.in +++ b/if1632/Makefile.in @@ -50,8 +50,7 @@ SPEC_FILES = $(DLLS:.spec=.S) C_SRCS = \ callback.c \ dummy.c \ - relay.c \ - relay32.c + relay.c ASM_SRCS = \ $(SPEC_FILES) \ diff --git a/if1632/advapi32.spec b/if1632/advapi32.spec index 28916c429a1..5647acbb2f9 100644 --- a/if1632/advapi32.spec +++ b/if1632/advapi32.spec @@ -128,40 +128,40 @@ base 1 0123 stub QueryServiceStatus 0124 stub ReadEventLogA 0125 stub ReadEventLogW -0126 stdcall RegCloseKey(long) RegCloseKey +0126 stdcall RegCloseKey(long) RegCloseKey 0127 stub RegConnectRegistryA 0128 stub RegConnectRegistryW -0129 stdcall RegCreateKeyA(long ptr ptr) RegCreateKeyA -0130 stdcall RegCreateKeyExA(long ptr long ptr long long ptr ptr ptr) RegCreateKeyExA -0131 stdcall RegCreateKeyExW(long ptr long ptr long long ptr ptr ptr) RegCreateKeyExW -0132 stdcall RegCreateKeyW(long ptr ptr) RegCreateKeyW -0133 stdcall RegDeleteKeyA(long ptr) RegDeleteKeyA -0134 stdcall RegDeleteKeyW(long ptr) RegDeleteKeyW -0135 stdcall RegDeleteValueA(long ptr) RegDeleteValueA -0136 stdcall RegDeleteValueW(long ptr) RegDeleteValueW -0137 stdcall RegEnumKeyA(long long ptr long) RegEnumKeyA -0138 stdcall RegEnumKeyExA(long long ptr ptr ptr ptr ptr ptr) RegEnumKeyExA -0139 stdcall RegEnumKeyExW(long long ptr ptr ptr ptr ptr ptr) RegEnumKeyExW -0140 stdcall RegEnumKeyW(long long ptr long) RegEnumKeyW -0141 stdcall RegEnumValueA(long long ptr ptr ptr ptr ptr ptr) RegEnumValueA -0142 stdcall RegEnumValueW(long long ptr ptr ptr ptr ptr ptr) RegEnumValueW -0143 stdcall RegFlushKey(long) RegFlushKey +0129 stdcall RegCreateKeyA(long ptr ptr) RegCreateKey32A +0130 stdcall RegCreateKeyExA(long ptr long ptr long long ptr ptr ptr) RegCreateKeyEx32A +0131 stdcall RegCreateKeyExW(long ptr long ptr long long ptr ptr ptr) RegCreateKeyEx32W +0132 stdcall RegCreateKeyW(long ptr ptr) RegCreateKey32W +0133 stdcall RegDeleteKeyA(long ptr) RegDeleteKey32A +0134 stdcall RegDeleteKeyW(long ptr) RegDeleteKey32W +0135 stdcall RegDeleteValueA(long ptr) RegDeleteValue32A +0136 stdcall RegDeleteValueW(long ptr) RegDeleteValue32W +0137 stdcall RegEnumKeyA(long long ptr long) RegEnumKey32A +0138 stdcall RegEnumKeyExA(long long ptr ptr ptr ptr ptr ptr) RegEnumKeyEx32A +0139 stdcall RegEnumKeyExW(long long ptr ptr ptr ptr ptr ptr) RegEnumKeyEx32W +0140 stdcall RegEnumKeyW(long long ptr long) RegEnumKey32W +0141 stdcall RegEnumValueA(long long ptr ptr ptr ptr ptr ptr) RegEnumValue32A +0142 stdcall RegEnumValueW(long long ptr ptr ptr ptr ptr ptr) RegEnumValue32W +0143 stdcall RegFlushKey(long) RegFlushKey 0144 stub RegGetKeySecurity 0145 stub RegLoadKeyA 0146 stub RegLoadKeyW 0147 stub RegNotifyChangeKeyValue -0148 stdcall RegOpenKeyA(long ptr ptr) RegOpenKeyA -0149 stdcall RegOpenKeyExA(long ptr long long ptr) RegOpenKeyExA -0150 stdcall RegOpenKeyExW(long ptr long long ptr) RegOpenKeyExW -0151 stdcall RegOpenKeyW(long ptr ptr) RegOpenKeyW -0152 stdcall RegQueryInfoKeyA(long ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) RegQueryInfoKeyA -0153 stdcall RegQueryInfoKeyW(long ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) RegQueryInfoKeyW +0148 stdcall RegOpenKeyA(long ptr ptr) RegOpenKey32A +0149 stdcall RegOpenKeyExA(long ptr long long ptr) RegOpenKeyEx32A +0150 stdcall RegOpenKeyExW(long ptr long long ptr) RegOpenKeyEx32W +0151 stdcall RegOpenKeyW(long ptr ptr) RegOpenKey32W +0152 stdcall RegQueryInfoKeyA(long ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) RegQueryInfoKey32A +0153 stdcall RegQueryInfoKeyW(long ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) RegQueryInfoKey32W 0154 stub RegQueryMultipleValuesA 0155 stub RegQueryMultipleValuesW -0156 stdcall RegQueryValueA(long ptr ptr ptr) RegQueryValueA -0157 stdcall RegQueryValueExA(long ptr ptr ptr ptr ptr) RegQueryValueExA -0158 stdcall RegQueryValueExW(long ptr ptr ptr ptr ptr) RegQueryValueExW -0159 stdcall RegQueryValueW(long ptr ptr ptr) RegQueryValueW +0156 stdcall RegQueryValueA(long ptr ptr ptr) RegQueryValue32A +0157 stdcall RegQueryValueExA(long ptr ptr ptr ptr ptr) RegQueryValueEx32A +0158 stdcall RegQueryValueExW(long ptr ptr ptr ptr ptr) RegQueryValueEx32W +0159 stdcall RegQueryValueW(long ptr ptr ptr) RegQueryValue32W 0160 stub RegRemapPreDefKey 0161 stub RegReplaceKeyA 0162 stub RegReplaceKeyW @@ -170,10 +170,10 @@ base 1 0165 stub RegSaveKeyA 0166 stub RegSaveKeyW 0167 stub RegSetKeySecurity -0168 stdcall RegSetValueA(long ptr long ptr long) RegSetValueA -0169 stdcall RegSetValueExA(long ptr long long ptr long) RegSetValueExA -0170 stdcall RegSetValueExW(long ptr long long ptr long) RegSetValueExW -0171 stdcall RegSetValueW(long ptr long ptr long) RegSetValueW +0168 stdcall RegSetValueA(long ptr long ptr long) RegSetValue32A +0169 stdcall RegSetValueExA(long ptr long long ptr long) RegSetValueEx32A +0170 stdcall RegSetValueExW(long ptr long long ptr long) RegSetValueEx32W +0171 stdcall RegSetValueW(long ptr long ptr long) RegSetValue32W 0172 stub RegUnLoadKeyA 0173 stub RegUnLoadKeyW 0174 stub RegisterEventSourceA @@ -202,4 +202,3 @@ base 1 0197 stub StartServiceCtrlDispatcherW 0198 stub StartServiceW 0199 stub UnlockServiceDatabase - diff --git a/if1632/callback.c b/if1632/callback.c index 91e91e2fdc8..313251ccba5 100644 --- a/if1632/callback.c +++ b/if1632/callback.c @@ -9,39 +9,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; #include "windows.h" #include "callback.h" #include "stackframe.h" -#include "win.h" -#include "alias.h" -#include "relay32.h" #include "stddebug.h" #include "debug.h" -/********************************************************************** - * CallWindowProc (USER.122) - */ -LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message, - WORD wParam, LONG lParam ) -{ - FUNCTIONALIAS *a; - WND *wndPtr = WIN_FindWndPtr( hwnd ); - - if (!wndPtr) return 0; - - /* check if we have something better than 16 bit relays */ - if(!ALIAS_UseAliases || !(a=ALIAS_LookupAlias((DWORD)func)) || - (!a->wine && !a->win32)) - return CallWndProc( (FARPROC)func, wndPtr->hInstance, - hwnd, message, wParam, lParam ); - if(a->wine) - return ((LONG(*)(WORD,WORD,WORD,LONG))(a->wine)) - (hwnd,message,wParam,lParam); - if(!a->win32) - fprintf(stderr,"Where is the Win32 callback?\n"); - if (UsesLParamPtr(message)) - return RELAY32_CallWindowProcConvStruct(a->win32,hwnd,message,wParam,lParam); - return CallWndProc32( (FARPROC)a->win32, hwnd, message, wParam, lParam ); -} - /********************************************************************** * Catch (KERNEL.55) */ diff --git a/if1632/gdi.spec b/if1632/gdi.spec index 9b1956405d4..3d9119a3e6f 100644 --- a/if1632/gdi.spec +++ b/if1632/gdi.spec @@ -38,13 +38,13 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 30 pascal16 SaveDC(word) SaveDC 31 pascal SetPixel(word s_word s_word long) SetPixel 32 pascal16 OffsetClipRgn(word s_word s_word) OffsetClipRgn -33 pascal16 TextOut(word s_word s_word ptr word) TextOut +33 pascal16 TextOut(word s_word s_word ptr word) TextOut16 34 pascal16 BitBlt( word s_word s_word s_word s_word word s_word s_word long) BitBlt 35 pascal16 StretchBlt(word s_word s_word s_word s_word word s_word s_word s_word s_word long) StretchBlt -36 pascal16 Polygon (word ptr word) Polygon -37 pascal16 Polyline (word ptr word) Polyline +36 pascal16 Polygon (word ptr word) Polygon16 +37 pascal16 Polyline (word ptr word) Polyline16 38 pascal Escape(word word word ptr ptr) Escape 39 pascal16 RestoreDC(word s_word) RestoreDC 40 pascal16 FillRgn(word word word) FillRgn @@ -54,7 +54,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 44 pascal16 SelectClipRgn(word word) SelectClipRgn 45 pascal16 SelectObject(word word) SelectObject #46 pascal __GP? -47 pascal16 CombineRgn(word word word word) CombineRgn +47 pascal16 CombineRgn(word word word s_word) CombineRgn 48 pascal16 CreateBitmap(word word word word ptr) CreateBitmap 49 pascal16 CreateBitmapIndirect(ptr) CreateBitmapIndirect 50 pascal16 CreateBrushIndirect(ptr) CreateBrushIndirect @@ -62,7 +62,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 52 pascal16 CreateCompatibleDC(word) CreateCompatibleDC 53 pascal16 CreateDC(ptr ptr ptr ptr) CreateDC 54 pascal16 CreateEllipticRgn(s_word s_word s_word s_word) CreateEllipticRgn -55 pascal16 CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect +55 pascal16 CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect16 56 pascal16 CreateFont(s_word s_word s_word s_word s_word word word word word word word word word ptr) CreateFont 57 pascal16 CreateFontIndirect(ptr) CreateFontIndirect @@ -70,11 +70,11 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 60 pascal16 CreatePatternBrush(word) CreatePatternBrush 61 pascal16 CreatePen(s_word s_word long) CreatePen 62 pascal16 CreatePenIndirect(ptr) CreatePenIndirect -63 pascal16 CreatePolygonRgn(ptr word word) CreatePolygonRgn +63 pascal16 CreatePolygonRgn(ptr word word) CreatePolygonRgn16 64 pascal16 CreateRectRgn(s_word s_word s_word s_word) CreateRectRgn -65 pascal16 CreateRectRgnIndirect(ptr) CreateRectRgnIndirect +65 pascal16 CreateRectRgnIndirect(ptr) CreateRectRgnIndirect16 66 pascal16 CreateSolidBrush(long) CreateSolidBrush -67 pascal16 DPtoLP(word ptr s_word) DPtoLP +67 pascal16 DPtoLP(word ptr s_word) DPtoLP16 68 pascal16 DeleteDC(word) DeleteDC 69 pascal16 DeleteObject(word) DeleteObject 70 pascal16 EnumFonts(word ptr segptr long) EnumFonts @@ -84,7 +84,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 74 pascal GetBitmapBits(word long ptr) GetBitmapBits 75 pascal GetBkColor(word) GetBkColor 76 pascal16 GetBkMode(word) GetBkMode -77 pascal16 GetClipBox(word ptr) GetClipBox +77 pascal16 GetClipBox(word ptr) GetClipBox16 78 pascal GetCurrentPosition(word) GetCurrentPosition 79 pascal GetDCOrg(word) GetDCOrg 80 pascal16 GetDeviceCaps(word s_word) GetDeviceCaps @@ -107,12 +107,12 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 97 pascal GetWindowOrg(word) GetWindowOrg 98 pascal16 IntersectVisRect(word s_word s_word s_word s_word) IntersectVisRect -99 pascal16 LPtoDP(word ptr s_word) LPtoDP +99 pascal16 LPtoDP(word ptr s_word) LPtoDP16 100 pascal16 LineDDA(s_word s_word s_word s_word segptr long) LineDDA 101 pascal16 OffsetRgn(word s_word s_word) OffsetRgn 102 pascal16 OffsetVisRgn(word s_word s_word) OffsetVisRgn 103 pascal16 PtVisible(word s_word s_word) PtVisible -104 pascal16 RectVisibleOld(word ptr) RectVisible +104 pascal16 RectVisibleOld(word ptr) RectVisible16 105 pascal16 SelectVisRgn(word word) SelectVisRgn 106 pascal SetBitmapBits(word long ptr) SetBitmapBits 117 pascal SetDCOrg(word s_word s_word) SetDCOrg @@ -130,7 +130,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 131 pascal16 InquireVisRgn(word) InquireVisRgn 132 pascal16 SetEnvironment(ptr ptr word) SetEnvironment 133 pascal16 GetEnvironment(ptr ptr word) GetEnvironment -134 pascal16 GetRgnBox(word ptr) GetRgnBox +134 pascal16 GetRgnBox(word ptr) GetRgnBox16 #135 pascal ScanLr 136 pascal16 RemoveFontResource(ptr) RemoveFontResource 148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg @@ -144,8 +144,8 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 159 pascal16 GetMetaFileBits(word) GetMetaFileBits 160 pascal16 SetMetaFileBits(word) SetMetaFileBits 161 pascal16 PtInRegion(word s_word s_word) PtInRegion -162 pascal GetBitmapDimension(word) GetBitmapDimension -163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension +162 pascal GetBitmapDimension(word) GetBitmapDimension +163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension 169 stub IsDCDirty 170 stub SetDCStatus 172 pascal16 SetRectRgn(word s_word s_word s_word s_word) SetRectRgn @@ -154,7 +154,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) 176 pascal16 PlayMetaFileRecord(word ptr ptr word) PlayMetaFileRecord 179 pascal16 GetDCState(word) GetDCState 180 pascal16 SetDCState(word word) SetDCState -181 pascal16 RectInRegionOld(word ptr) RectInRegion +181 pascal16 RectInRegionOld(word ptr) RectInRegion16 188 stub GetTextExtentEx 190 stub SetDCHook 191 stub GetDCHook @@ -235,7 +235,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) s_word s_word) Chord 349 pascal SetMapperFlags(word long) SetMapperFlags 350 pascal16 GetCharWidth(word word word ptr) GetCharWidth -351 pascal16 ExtTextOut(word s_word s_word word ptr ptr s_word ptr) ExtTextOut +351 pascal16 ExtTextOut(word s_word s_word word ptr ptr s_word ptr) ExtTextOut16 352 stub GetPhysicalFontHandle 353 stub GetAspectRatioFilter 354 stub ShrinkGDIHeap @@ -283,37 +283,37 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects) CreateRoundRectRgn 445 pascal16 CreateDIBPatternBrush(word word) CreateDIBPatternBrush 449 stub DEVICECOLORMATCH -450 pascal16 PolyPolygon(word ptr ptr word) PolyPolygon -451 pascal16 CreatePolyPolygonRgn(ptr ptr word word) CreatePolyPolygonRgn +450 pascal16 PolyPolygon(word ptr ptr word) PolyPolygon16 +451 pascal16 CreatePolyPolygonRgn(ptr ptr word word) CreatePolyPolygonRgn16 452 stub GDISEEGDIDO 460 stub GDITASKTERMINATION 461 return SetObjectOwner 4 0 462 pascal16 IsGDIObject(word) IsGDIObject 463 stub MAKEOBJECTPRIVATE 464 stub FIXUPBOGUSPUBLISHERMETAFILE -465 pascal16 RectVisible(word ptr) RectVisible -466 pascal16 RectInRegion(word ptr) RectInRegion +465 pascal16 RectVisible(word ptr) RectVisible16 +466 pascal16 RectInRegion(word ptr) RectInRegion16 467 stub UNICODETOANSI -468 pascal16 GetBitmapDimensionEx(word ptr) GetBitmapDimensionEx -469 pascal16 GetBrushOrgEx(word ptr) GetBrushOrgEx -470 pascal16 GetCurrentPositionEx(word ptr) GetCurrentPositionEx -471 pascal16 GetTextExtentPoint(word ptr s_word ptr) GetTextExtentPoint -472 pascal16 GetViewportExtEx(word ptr) GetViewportExtEx -473 pascal16 GetViewportOrgEx(word ptr) GetViewportOrgEx -474 pascal16 GetWindowExtEx(word ptr) GetWindowExtEx -475 pascal16 GetWindowOrgEx(word ptr) GetWindowOrgEx -476 pascal16 OffsetViewportOrgEx(word s_word s_word ptr) OffsetViewportOrgEx -477 pascal16 OffsetWindowOrgEx(word s_word s_word ptr) OffsetWindowOrgEx -478 pascal16 SetBitmapDimensionEx(word s_word s_word ptr) SetBitmapDimensionEx -479 pascal16 SetViewportExtEx(word s_word s_word ptr) SetViewportExtEx -480 pascal16 SetViewportOrgEx(word s_word s_word ptr) SetViewportOrgEx -481 pascal16 SetWindowExtEx(word s_word s_word ptr) SetWindowExtEx -482 pascal16 SetWindowOrgEx(word s_word s_word ptr) SetWindowOrgEx -483 pascal16 MoveToEx(word s_word s_word ptr) MoveToEx +468 pascal16 GetBitmapDimensionEx(word ptr) GetBitmapDimensionEx16 +469 pascal16 GetBrushOrgEx(word ptr) GetBrushOrgEx16 +470 pascal16 GetCurrentPositionEx(word ptr) GetCurrentPositionEx16 +471 pascal16 GetTextExtentPoint(word ptr s_word ptr) GetTextExtentPoint16 +472 pascal16 GetViewportExtEx(word ptr) GetViewportExtEx16 +473 pascal16 GetViewportOrgEx(word ptr) GetViewportOrgEx16 +474 pascal16 GetWindowExtEx(word ptr) GetWindowExtEx16 +475 pascal16 GetWindowOrgEx(word ptr) GetWindowOrgEx16 +476 pascal16 OffsetViewportOrgEx(word s_word s_word ptr) OffsetViewportOrgEx16 +477 pascal16 OffsetWindowOrgEx(word s_word s_word ptr) OffsetWindowOrgEx16 +478 pascal16 SetBitmapDimensionEx(word s_word s_word ptr) SetBitmapDimensionEx16 +479 pascal16 SetViewportExtEx(word s_word s_word ptr) SetViewportExtEx16 +480 pascal16 SetViewportOrgEx(word s_word s_word ptr) SetViewportOrgEx16 +481 pascal16 SetWindowExtEx(word s_word s_word ptr) SetWindowExtEx16 +482 pascal16 SetWindowOrgEx(word s_word s_word ptr) SetWindowOrgEx16 +483 pascal16 MoveToEx(word s_word s_word ptr) MoveToEx16 484 pascal16 ScaleViewportExtEx(word s_word s_word s_word s_word ptr) - ScaleViewportExtEx + ScaleViewportExtEx16 485 pascal16 ScaleWindowExtEx(word s_word s_word s_word s_word ptr) - ScaleWindowExtEx + ScaleWindowExtEx16 486 stub GETASPECTRATIOFILTEREX 489 stub CreateDIBSection 490 stub CloseEnhMetafile diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec index dae9cc111ce..afa0d1c4095 100644 --- a/if1632/gdi32.spec +++ b/if1632/gdi32.spec @@ -41,8 +41,8 @@ base 1 0036 stub CreateDIBSection 0037 stub CreateDIBitmap 0038 stub CreateDiscardableBitmap -0039 stub CreateEllipticRgn -0040 stub CreateEllipticRgnIndirect +0039 stdcall CreateEllipticRgn(long long long long) CreateEllipticRgn +0040 stdcall CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect32 0041 stub CreateEnhMetaFileA 0042 stub CreateEnhMetaFileW 0043 stub CreateFontA @@ -62,12 +62,12 @@ base 1 0057 stub CreatePolyPolygonRgn 0058 stub CreatePolygonRgn 0059 stdcall CreateRectRgn(long long long long) CreateRectRgn -0060 stub CreateRectRgnIndirect -0061 stub CreateRoundRectRgn +0060 stdcall CreateRectRgnIndirect(ptr) CreateRectRgnIndirect32 +0061 stdcall CreateRoundRectRgn(long long long long long long) CreateRoundRectRgn 0062 stub CreateScalableFontResourceA 0063 stub CreateScalableFontResourceW 0064 stdcall CreateSolidBrush(long) CreateSolidBrush -0065 stub DPtoLP +0065 stdcall DPtoLP(long ptr long) DPtoLP32 0066 stub DeleteColorSpace 0067 stdcall DeleteDC(long) DeleteDC 0068 stub DeleteEnhMetaFile @@ -92,7 +92,7 @@ base 1 0087 stub EnumICMProfilesW 0088 stub EnumMetaFile 0089 stub EnumObjects -0090 stub EqualRgn +0090 stdcall EqualRgn(long long) EqualRgn 0091 stub Escape 0092 stub ExcludeClipRect 0093 stub ExtCreatePen @@ -100,8 +100,8 @@ base 1 0095 stub ExtEscape 0096 stub ExtFloodFill 0097 stub ExtSelectClipRgn -0098 stub ExtTextOutA -0099 stub ExtTextOutW +0098 stdcall ExtTextOutA(long long long long ptr ptr long ptr) ExtTextOut32A +0099 stdcall ExtTextOutW(long long long long ptr ptr long ptr) ExtTextOut32W 0100 stub FillPath 0101 stub FillRgn 0102 stub FixBrushOrgEx @@ -146,7 +146,7 @@ base 1 0141 stub GetArcDirection 0142 stub GetAspectRatioFilterEx 0143 stub GetBitmapBits -0144 stub GetBitmapDimensionEx +0144 stdcall GetBitmapDimensionEx(long ptr) GetBitmapDimensionEx32 0145 stub GetBkColor 0146 stub GetBkMode 0147 stub GetBoundsRect @@ -164,7 +164,7 @@ base 1 0159 stub GetCharWidthWOW 0160 stub GetCharacterPlacementA 0161 stub GetCharacterPlacementW -0162 stub GetClipBox +0162 stdcall GetClipBox(long ptr) GetClipBox32 0163 stub GetClipRgn 0164 stub GetColorAdjustment 0165 stub GetColorSpace @@ -221,8 +221,8 @@ base 1 0216 stub GetRasterizerCaps 0217 stub GetRegionData 0218 stub GetRelAbs -0219 stub GetRgnBox -0220 stdcall GetStockObject(long) GetStockObject +0219 stdcall GetRgnBox(long ptr) GetRgnBox32 +0220 stdcall GetStockObject(long) GetStockObject 0221 stub GetStretchBltMode 0222 stub GetSystemPaletteEntries 0223 stub GetSystemPaletteUse @@ -234,8 +234,8 @@ base 1 0229 stub GetTextExtentExPointW 0230 stub GetTextExtentPoint32A 0231 stub GetTextExtentPoint32W -0232 stdcall GetTextExtentPointA(long ptr long ptr) WIN32_GetTextExtentPointA -0233 stub GetTextExtentPointW +0232 stdcall GetTextExtentPointA(long ptr long ptr) GetTextExtentPoint32A +0233 stdcall GetTextExtentPointW(long ptr long ptr) GetTextExtentPoint32W 0234 stub GetTextFaceA 0235 stub GetTextFaceW 0236 stub GetTextMetricsA @@ -249,18 +249,18 @@ base 1 0244 stub GetWorldTransform 0245 stub IntersectClipRect 0246 stub InvertRgn -0247 stub LPtoDP +0247 stdcall LPtoDP(long ptr long) LPtoDP32 0248 stub LineDDA 0249 stdcall LineTo(long long long) LineTo 0250 stub LoadImageColorMatcherA 0251 stub LoadImageColorMatcherW 0252 stub MaskBlt 0253 stub ModifyWorldTransform -0254 stdcall MoveToEx(long long long ptr) WIN32_MoveToEx +0254 stdcall MoveToEx(long long long ptr) MoveToEx32 0255 stub OffsetClipRgn -0256 stub OffsetRgn -0257 stub OffsetViewportOrgEx -0258 stub OffsetWindowOrgEx +0256 stdcall OffsetRgn(long long long) OffsetRgn +0257 stdcall OffsetViewportOrgEx(long long long ptr) OffsetViewportOrgEx32 +0258 stdcall OffsetWindowOrgEx(long long long ptr) OffsetWindowOrgEx32 0259 stub PaintRgn 0260 stdcall PatBlt(long long long long long long) PatBlt 0261 stub PathToRegion @@ -280,12 +280,12 @@ base 1 0275 stub Polygon 0276 stub Polyline 0277 stub PolylineTo -0278 stub PtInRegion +0278 stdcall PtInRegion(long long long) PtInRegion 0279 stub PtVisible 0280 stub RealizePalette -0281 stub RectInRegion -0282 stub RectVisible -0283 stub Rectangle +0281 stdcall RectInRegion(long ptr) RectInRegion32 +0282 stdcall RectVisible(long ptr) RectVisible32 +0283 stdcall Rectangle(long long long long long) Rectangle 0284 stub RemoveFontResourceA 0285 stub RemoveFontResourceTracking 0286 stub RemoveFontResourceW @@ -295,8 +295,8 @@ base 1 0290 stub RestoreDC 0291 stub RoundRect 0292 stub SaveDC -0293 stub ScaleViewportExtEx -0294 stub ScaleWindowExtEx +0293 stdcall ScaleViewportExtEx(long long long long long ptr) ScaleViewportExtEx32 +0294 stdcall ScaleWindowExtEx(long long long long long ptr) ScaleWindowExtEx32 0295 stub SelectBrushLocal 0296 stub SelectClipPath 0297 stub SelectClipRgn @@ -306,7 +306,7 @@ base 1 0301 stub SetAbortProc 0302 stub SetArcDirection 0303 stub SetBitmapBits -0304 stub SetBitmapDimensionEx +0304 stdcall SetBitmapDimensionEx(long long long ptr) SetBitmapDimensionEx32 0305 stdcall SetBkColor(long long) SetBkColor 0306 stub SetBkMode 0307 stub SetBoundsRect @@ -342,12 +342,12 @@ base 1 0337 stub SetTextCharacterExtra 0338 stdcall SetTextColor(long long) SetTextColor 0339 stub SetTextJustification -0340 stub SetViewportExtEx -0341 stub SetViewportOrgEx +0340 stdcall SetViewportExtEx(long long long ptr) SetViewportExtEx32 +0341 stdcall SetViewportOrgEx(long long long ptr) SetViewportOrgEx32 0342 stub SetVirtualResolution 0343 stub SetWinMetaFileBits -0344 stub SetWindowExtEx -0345 stub SetWindowOrgEx +0344 stdcall SetWindowExtEx(long long long ptr) SetWindowExtEx32 +0345 stdcall SetWindowOrgEx(long long long ptr) SetWindowOrgEx32 0346 stub SetWorldTransform 0347 stub StartDocA 0348 stub StartDocW @@ -357,8 +357,8 @@ base 1 0352 stub StrokeAndFillPath 0353 stub StrokePath 0354 stub SwapBuffers -0355 stdcall TextOutA(long long long ptr long) TextOut -0356 stub TextOutW +0355 stdcall TextOutA(long long long ptr long) TextOut32A +0356 stdcall TextOutW(long long long ptr long) TextOut32W 0357 stub UnloadNetworkFonts 0358 stub UnrealizeObject 0359 stub UpdateColors diff --git a/if1632/kernel.spec b/if1632/kernel.spec index d8b4f31fec9..ac1e9824937 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -205,17 +205,17 @@ type win16 205 stub CVWBreak 206 pascal16 AllocSelectorArray(word) AllocSelectorArray 207 return IsDBCSLeadByte 2 0 -216 pascal RegEnumKey(long long ptr long) RegEnumKey -217 pascal RegOpenKey(long ptr ptr) RegOpenKey -218 pascal RegCreateKey(long ptr ptr) RegCreateKey -219 pascal RegDeleteKey(long ptr) RegDeleteKey +216 pascal RegEnumKey(long long ptr long) RegEnumKey16 +217 pascal RegOpenKey(long ptr ptr) RegOpenKey16 +218 pascal RegCreateKey(long ptr ptr) RegCreateKey16 +219 pascal RegDeleteKey(long ptr) RegDeleteKey16 220 pascal RegCloseKey(long) RegCloseKey -221 pascal RegSetValue(long ptr long ptr long) RegSetValue -222 pascal RegDeleteValue(long ptr) RegDeleteValue -223 pascal RegEnumValue(long long ptr ptr ptr ptr ptr ptr) RegEnumValue -224 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue -225 pascal RegQueryValueEx(long ptr ptr ptr ptr ptr) RegQueryValueEx -226 pascal RegSetValueEx(long ptr long long ptr long) RegSetValueEx +221 pascal RegSetValue(long ptr long ptr long) RegSetValue16 +222 pascal RegDeleteValue(long ptr) RegDeleteValue16 +223 pascal RegEnumValue(long long ptr ptr ptr ptr ptr ptr) RegEnumValue16 +224 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue16 +225 pascal RegQueryValueEx(long ptr ptr ptr ptr ptr) RegQueryValueEx16 +226 pascal RegSetValueEx(long ptr long long ptr long) RegSetValueEx16 227 pascal RegFlushKey(long) RegFlushKey #228 K228 #229 K229 @@ -270,8 +270,8 @@ type win16 404 pascal16 FarGetOwner(word) FarGetOwner 406 stub WritePrivateProfileStruct 407 stub GetPrivateProfileStruct -411 stub GetCurrentDirectory -412 stub SetCurrentDirectory +411 pascal GetCurrentDirectory(long ptr) GetCurrentDirectory +412 pascal16 SetCurrentDirectory(ptr) SetCurrentDirectory 413 stub FindFirstFile 414 stub FindNextFile 415 stub FindClose diff --git a/if1632/kernel32.spec b/if1632/kernel32.spec index fe9917002b6..2582fac5d85 100644 --- a/if1632/kernel32.spec +++ b/if1632/kernel32.spec @@ -314,20 +314,20 @@ base 1 0308 stub GetVersionExW 0309 stub GetVolumeInformationA 0310 stub GetVolumeInformationW -0311 stub GetWindowsDirectoryA +0311 stdcall GetWindowsDirectoryA(ptr long) GetWindowsDirectory 0312 stub GetWindowsDirectoryW -0313 stdcall GlobalAddAtomA(long) WIN32_GlobalAddAtomA -0314 stub GlobalAddAtomW +0313 stdcall GlobalAddAtomA(ptr) GlobalAddAtom32A +0314 stdcall GlobalAddAtomW(ptr) GlobalAddAtom32W 0315 stdcall GlobalAlloc(long long) GlobalAlloc32 0316 stdcall GlobalCompact(long) GlobalCompact32 -0317 stub GlobalDeleteAtom -0318 stub GlobalFindAtomA -0319 stub GlobalFindAtomW +0317 stdcall GlobalDeleteAtom(long) GlobalDeleteAtom +0318 stdcall GlobalFindAtomA(ptr) GlobalFindAtom32A +0319 stdcall GlobalFindAtomW(ptr) GlobalFindAtom32W 0320 stub GlobalFix 0321 stdcall GlobalFlags(long) GlobalFlags32 0322 stdcall GlobalFree(long) GlobalFree32 -0323 stub GlobalGetAtomNameA -0324 stub GlobalGetAtomNameW +0323 stdcall GlobalGetAtomNameA(long ptr long) GlobalGetAtomName32A +0324 stdcall GlobalGetAtomNameW(long ptr long) GlobalGetAtomName32W 0325 stdcall GlobalHandle(ptr) GlobalHandle32 0326 stdcall GlobalLock(long) GlobalLock32 0327 stub GlobalMemoryStatus diff --git a/if1632/mmsystem.spec b/if1632/mmsystem.spec index d2ebd00d7a8..6ec752ca120 100644 --- a/if1632/mmsystem.spec +++ b/if1632/mmsystem.spec @@ -5,7 +5,7 @@ type win16 2 pascal SNDPLAYSOUND(ptr word) sndPlaySound 5 pascal MMSYSTEMGETVERSION() mmsystemGetVersion 6 pascal DriverProc(long word word long long) DriverProc -30 pascal OUTPUTDEBUGSTR(ptr) OutputDebugStr +30 pascal16 OutputDebugStr(ptr) OutputDebugString 31 pascal DriverCallback(long word word word long long long) DriverCallback #32 pascal STACKENTER diff --git a/if1632/relay32.c b/if1632/relay32.c deleted file mode 100644 index 3f0a24e4d41..00000000000 --- a/if1632/relay32.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 1995 Martin von Loewis - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "windows.h" -#include "callback.h" -#include "module.h" -#include "neexe.h" -#include "peexe.h" -#include "relay32.h" -#include "struct32.h" -#include "stackframe.h" -#include "ldt.h" -#include "stddebug.h" -#include "debug.h" - - -LONG RELAY32_CallWindowProcConvStruct( WNDPROC func, int hwnd, int message, - int wParam, LPARAM lParam16) -{ - WINDOWPOS32 wp; - union { - MINMAXINFO32 mmi; - NCCALCSIZE_PARAMS32 nccs; - CREATESTRUCT32 cs; - } st; - CREATESTRUCT *lpcs; - LONG result; - void *lParam; - if(!lParam16) - return CallWndProc32(func,hwnd,message,wParam,(int)lParam16); - lParam = PTR_SEG_TO_LIN(lParam16); - switch(message) { - case WM_GETMINMAXINFO: - STRUCT32_MINMAXINFO16to32(lParam,&st.mmi); - result=CallWndProc32(func,hwnd,message,wParam,(int)&st.mmi); - STRUCT32_MINMAXINFO32to16(&st.mmi,lParam); - return result; - case WM_WINDOWPOSCHANGING: - case WM_WINDOWPOSCHANGED: - STRUCT32_WINDOWPOS16to32(lParam,&wp); - result=CallWndProc32(func,hwnd,message,wParam,(int)&wp); - STRUCT32_WINDOWPOS32to16(&wp,lParam); - return result; - case WM_NCCALCSIZE: - STRUCT32_NCCALCSIZE16to32Flat(lParam,&st.nccs); - if(wParam && ((NCCALCSIZE_PARAMS*)lParam)->lppos) - { - STRUCT32_WINDOWPOS16to32(PTR_SEG_TO_LIN(((NCCALCSIZE_PARAMS*)lParam)->lppos),&wp); - st.nccs.lppos=℘ - } - else st.nccs.lppos= 0; - result=CallWndProc32(func,hwnd,message,wParam,(int)&st.nccs); - STRUCT32_NCCALCSIZE32to16Flat(&st.nccs,lParam); - if(wParam && ((NCCALCSIZE_PARAMS*)lParam)->lppos) - STRUCT32_WINDOWPOS32to16(&wp,PTR_SEG_TO_LIN(((NCCALCSIZE_PARAMS*)lParam)->lppos)); - return result; - case WM_NCCREATE: - lpcs = (CREATESTRUCT*)lParam; - STRUCT32_CREATESTRUCT16to32(lParam,&st.cs); - st.cs.lpszName = HIWORD(lpcs->lpszName) ? - PTR_SEG_TO_LIN(lpcs->lpszName) : (char*)lpcs->lpszName; - st.cs.lpszClass = HIWORD(lpcs->lpszClass) ? - PTR_SEG_TO_LIN(lpcs->lpszClass) : (char*)lpcs->lpszClass; - result=CallWndProc32(func,hwnd,message,wParam,(int)&st.cs); - STRUCT32_CREATESTRUCT32to16(&st.cs,lParam); - lpcs->lpszName = HIWORD(st.cs.lpszName) ? - MAKE_SEGPTR(st.cs.lpszName) : (SEGPTR)st.cs.lpszName; - lpcs->lpszClass = HIWORD(st.cs.lpszClass) ? - MAKE_SEGPTR(st.cs.lpszClass) : (SEGPTR)st.cs.lpszClass; - return result; - case WM_GETTEXT: - case WM_SETTEXT: - return CallWndProc32(func,hwnd,message,wParam,(int)lParam); - default: - fprintf(stderr,"No conversion function for message %d\n",message); - } - return CallWndProc32(func,hwnd,message,wParam,(int)lParam); -} diff --git a/if1632/shell.spec b/if1632/shell.spec index 7623fac2a77..a6d722d0367 100644 --- a/if1632/shell.spec +++ b/if1632/shell.spec @@ -1,13 +1,13 @@ name shell type win16 - 1 pascal RegOpenKey(long ptr ptr) RegOpenKey - 2 pascal RegCreateKey(long ptr ptr) RegCreateKey + 1 pascal RegOpenKey(long ptr ptr) RegOpenKey16 + 2 pascal RegCreateKey(long ptr ptr) RegCreateKey16 3 pascal RegCloseKey(long) RegCloseKey - 4 pascal RegDeleteKey(long ptr) RegDeleteKey - 5 pascal RegSetValue(long ptr long ptr long) RegSetValue - 6 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue - 7 pascal RegEnumKey(long long ptr long) RegEnumKey + 4 pascal RegDeleteKey(long ptr) RegDeleteKey16 + 5 pascal RegSetValue(long ptr long ptr long) RegSetValue16 + 6 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue16 + 7 pascal RegEnumKey(long long ptr long) RegEnumKey16 9 pascal16 DragAcceptFiles(word word) DragAcceptFiles 11 pascal16 DragQueryFile(word s_word ptr s_word) DragQueryFile 12 pascal16 DragFinish(word) DragFinish diff --git a/if1632/user.spec b/if1632/user.spec index 731c0c08668..9610bbe7c85 100644 --- a/if1632/user.spec +++ b/if1632/user.spec @@ -15,8 +15,8 @@ heap 65520 13 pascal GetTickCount() GetTickCount 14 pascal GetTimerResolution() GetTimerResolution 15 pascal GetCurrentTime() GetCurrentTime -16 pascal16 ClipCursor(ptr) ClipCursor -17 pascal16 GetCursorPos(ptr) GetCursorPos +16 pascal16 ClipCursor(ptr) ClipCursor16 +17 pascal16 GetCursorPos(ptr) GetCursorPos16 18 pascal16 SetCapture(word) SetCapture 19 pascal16 ReleaseCapture() ReleaseCapture 20 pascal16 SetDoubleClickTime(word) SetDoubleClickTime @@ -27,19 +27,19 @@ heap 65520 25 pascal16 GetProp(word segptr) GetProp 26 pascal16 SetProp(word segptr word) SetProp 27 pascal16 EnumProps(word segptr) EnumProps -28 pascal16 ClientToScreen(word ptr) ClientToScreen -29 pascal16 ScreenToClient(word ptr) ScreenToClient -30 pascal16 WindowFromPoint(long) WindowFromPoint +28 pascal16 ClientToScreen(word ptr) ClientToScreen16 +29 pascal16 ScreenToClient(word ptr) ScreenToClient16 +30 pascal16 WindowFromPoint(long) WindowFromPoint16 31 pascal16 IsIconic(word) IsIconic -32 pascal16 GetWindowRect(word ptr) GetWindowRect -33 pascal16 GetClientRect(word ptr) GetClientRect +32 pascal16 GetWindowRect(word ptr) GetWindowRect16 +33 pascal16 GetClientRect(word ptr) GetClientRect16 34 pascal16 EnableWindow(word word) EnableWindow 35 pascal16 IsWindowEnabled(word) IsWindowEnabled 36 pascal16 GetWindowText(word segptr word) WIN16_GetWindowText 37 pascal16 SetWindowText(word segptr) WIN16_SetWindowText 38 pascal16 GetWindowTextLength(word) GetWindowTextLength -39 pascal16 BeginPaint(word ptr) BeginPaint -40 pascal16 EndPaint(word ptr) EndPaint +39 pascal16 BeginPaint(word ptr) BeginPaint16 +40 pascal16 EndPaint(word ptr) EndPaint16 41 pascal16 CreateWindow(segptr segptr long s_word s_word s_word s_word word word word segptr) CreateWindow16 42 pascal16 ShowWindow(word word) ShowWindow @@ -50,7 +50,7 @@ heap 65520 47 pascal16 IsWindow(word) IsWindow 48 pascal16 IsChild(word word) IsChild 49 pascal16 IsWindowVisible(word) IsWindowVisible -50 pascal16 FindWindow(segptr ptr) FindWindow +50 pascal16 FindWindow(segptr ptr) FindWindow16 #51 BEAR51 52 pascal16 AnyPopup() AnyPopup 53 pascal16 DestroyWindow(word) DestroyWindow @@ -58,7 +58,7 @@ heap 65520 55 pascal16 EnumChildWindows(word segptr long) EnumChildWindows 56 pascal16 MoveWindow(word word word word word word) MoveWindow 57 pascal16 RegisterClass(ptr) RegisterClass16 -58 pascal16 GetClassName(word ptr word) GetClassName +58 pascal16 GetClassName(word ptr word) GetClassName16 59 pascal16 SetActiveWindow(word) SetActiveWindow 60 pascal16 GetActiveWindow() GetActiveWindow 61 pascal16 ScrollWindow(word s_word s_word ptr ptr) ScrollWindow @@ -72,20 +72,20 @@ heap 65520 69 pascal16 SetCursor(word) SetCursor 70 pascal16 SetCursorPos(word word) SetCursorPos 71 pascal16 ShowCursor(word) ShowCursor -72 pascal16 SetRect(ptr s_word s_word s_word s_word) SetRect -73 pascal16 SetRectEmpty(ptr) SetRectEmpty -74 pascal16 CopyRect(ptr ptr) CopyRect -75 pascal16 IsRectEmpty(ptr) IsRectEmpty -76 pascal16 PtInRect(ptr long) PtInRect -77 pascal16 OffsetRect(ptr s_word s_word) OffsetRect -78 pascal16 InflateRect(ptr s_word s_word) InflateRect -79 pascal16 IntersectRect(ptr ptr ptr) IntersectRect -80 pascal16 UnionRect(ptr ptr ptr) UnionRect -81 pascal16 FillRect(word ptr word) FillRect -82 pascal16 InvertRect(word ptr) InvertRect -83 pascal16 FrameRect(word ptr word) FrameRect +72 pascal16 SetRect(ptr s_word s_word s_word s_word) SetRect16 +73 pascal16 SetRectEmpty(ptr) SetRectEmpty16 +74 pascal16 CopyRect(ptr ptr) CopyRect16 +75 pascal16 IsRectEmpty(ptr) IsRectEmpty16 +76 pascal16 PtInRect(ptr long) PtInRect16 +77 pascal16 OffsetRect(ptr s_word s_word) OffsetRect16 +78 pascal16 InflateRect(ptr s_word s_word) InflateRect16 +79 pascal16 IntersectRect(ptr ptr ptr) IntersectRect16 +80 pascal16 UnionRect(ptr ptr ptr) UnionRect16 +81 pascal16 FillRect(word ptr word) FillRect16 +82 pascal16 InvertRect(word ptr) InvertRect16 +83 pascal16 FrameRect(word ptr word) FrameRect16 84 pascal16 DrawIcon(word s_word s_word word) DrawIcon -85 pascal16 DrawText(word ptr s_word ptr word) DrawText +85 pascal16 DrawText(word ptr s_word ptr word) DrawText16 87 pascal16 DialogBox(word segptr word segptr) DialogBox 88 pascal16 EndDialog(word s_word) EndDialog 89 pascal16 CreateDialog(word segptr word segptr) CreateDialog @@ -101,8 +101,8 @@ heap 65520 99 pascal16 DlgDirSelect(word ptr word) DlgDirSelect 100 pascal16 DlgDirList(word segptr word word word) DlgDirList 101 pascal SendDlgItemMessage(word word word word long) SendDlgItemMessage -102 pascal16 AdjustWindowRect(ptr long word) AdjustWindowRect -103 pascal16 MapDialogRect(word ptr) MapDialogRect +102 pascal16 AdjustWindowRect(ptr long word) AdjustWindowRect16 +103 pascal16 MapDialogRect(word ptr) MapDialogRect16 104 pascal16 MessageBeep(word) MessageBeep 105 pascal16 FlashWindow(word word) FlashWindow 106 pascal16 GetKeyState(word) GetKeyState @@ -116,22 +116,22 @@ heap 65520 114 pascal DispatchMessage(ptr) DispatchMessage 115 stub ReplyMessage 116 pascal16 PostAppMessage(word word word long) PostAppMessage -118 pascal16 RegisterWindowMessage(long) RegisterWindowMessage +118 pascal16 RegisterWindowMessage(segptr) RegisterWindowMessage16 117 stub WindowFromDC 119 pascal GetMessagePos() GetMessagePos 120 pascal GetMessageTime() GetMessageTime 121 pascal SetWindowsHook(s_word segptr) SetWindowsHook -122 pascal CallWindowProc(segptr word word word long) CallWindowProc +122 pascal CallWindowProc(segptr word word word long) CallWindowProc16 123 pascal16 CallMsgFilter(segptr s_word) CallMsgFilter 124 pascal16 UpdateWindow(word) UpdateWindow -125 pascal16 InvalidateRect(word ptr word) InvalidateRect +125 pascal16 InvalidateRect(word ptr word) InvalidateRect16 126 pascal16 InvalidateRgn(word word word) InvalidateRgn -127 pascal16 ValidateRect(word ptr) ValidateRect +127 pascal16 ValidateRect(word ptr) ValidateRect16 128 pascal16 ValidateRgn(word word) ValidateRgn 129 pascal16 GetClassWord(word s_word) GetClassWord 130 pascal16 SetClassWord(word s_word word) SetClassWord -131 pascal GetClassLong(word s_word) GetClassLong -132 pascal SetClassLong(word s_word long) SetClassLong +131 pascal GetClassLong(word s_word) GetClassLong16 +132 pascal SetClassLong(word s_word long) SetClassLong16 133 pascal16 GetWindowWord(word s_word) GetWindowWord 134 pascal16 SetWindowWord(word s_word word) SetWindowWord 135 pascal GetWindowLong(word s_word) GetWindowLong @@ -182,15 +182,15 @@ heap 65520 180 pascal GetSysColor(word) GetSysColor 181 pascal16 SetSysColors(word ptr ptr) SetSysColors 182 pascal16 KillSystemTimer(word word) KillSystemTimer -183 pascal16 GetCaretPos(ptr) GetCaretPos +183 pascal16 GetCaretPos(ptr) GetCaretPos16 184 stub QuerySendMessage 185 pascal16 GrayString(word word ptr ptr word word word word word) GrayString 186 pascal16 SwapMouseButton(word) SwapMouseButton 187 pascal16 EndMenu() EndMenu 188 pascal16 SetSysModalWindow(word) SetSysModalWindow 189 pascal16 GetSysModalWindow() GetSysModalWindow -190 pascal16 GetUpdateRect(word ptr word) GetUpdateRect -191 pascal16 ChildWindowFromPoint(word long) ChildWindowFromPoint +190 pascal16 GetUpdateRect(word ptr word) GetUpdateRect16 +191 pascal16 ChildWindowFromPoint(word long) ChildWindowFromPoint16 192 pascal16 InSendMessage() InSendMessage 193 pascal16 IsClipboardFormatAvailable(word) IsClipboardFormatAvailable 194 pascal16 DlgDirSelectComboBox(word ptr word) DlgDirSelectComboBox @@ -246,7 +246,7 @@ heap 65520 242 pascal16 CreateDialogIndirectParam(word segptr word segptr long) CreateDialogIndirectParam 243 pascal GetDialogBaseUnits() GetDialogBaseUnits -244 pascal16 EqualRect(ptr ptr) EqualRect +244 pascal16 EqualRect(ptr ptr) EqualRect16 245 stub EnableCommNotification 246 stub ExitWindowsExec 247 pascal16 GetCursor() GetCursor @@ -260,7 +260,7 @@ heap 65520 255 pascal DefDriverProc(long word word long long) DefDriverProc 256 pascal16 GetDriverInfo(word ptr) GetDriverInfo 257 pascal16 GetNextDriver(word long) GetNextDriver -258 pascal16 MapWindowPoints(word word ptr word) MapWindowPoints +258 pascal16 MapWindowPoints(word word ptr word) MapWindowPoints16 259 pascal16 BeginDeferWindowPos(s_word) BeginDeferWindowPos 260 pascal16 DeferWindowPos(word word word s_word s_word s_word s_word word) DeferWindowPos @@ -271,10 +271,10 @@ heap 65520 265 pascal16 ShowOwnedPopups(word word) ShowOwnedPopups 266 pascal16 SetMessageQueue(word) SetMessageQueue 267 pascal16 ShowScrollBar(word word word) ShowScrollBar -268 pascal16 GlobalAddAtom(segptr) GlobalAddAtom +268 pascal16 GlobalAddAtom(segptr) GlobalAddAtom16 269 pascal16 GlobalDeleteAtom(word) GlobalDeleteAtom -270 pascal16 GlobalFindAtom(segptr) GlobalFindAtom -271 pascal16 GlobalGetAtomName(word ptr s_word) GlobalGetAtomName +270 pascal16 GlobalFindAtom(segptr) GlobalFindAtom16 +271 pascal16 GlobalGetAtomName(word ptr s_word) GlobalGetAtomName16 272 pascal16 IsZoomed(word) IsZoomed 273 stub ControlPanelInfo 274 stub GetNextQueueWindow @@ -293,7 +293,7 @@ heap 65520 287 pascal16 GetLastActivePopup(word) GetLastActivePopup 288 pascal GetMessageExtraInfo() GetMessageExtraInfo #289 KEYB_EVENT -290 pascal16 RedrawWindow(word ptr word word) RedrawWindow +290 pascal16 RedrawWindow(word ptr word word) RedrawWindow16 291 pascal SetWindowsHookEx(s_word segptr word word) SetWindowsHookEx 292 pascal16 UnhookWindowsHookEx(segptr) UnhookWindowsHookEx 293 pascal CallNextHookEx(segptr s_word word long) CallNextHookEx @@ -303,7 +303,7 @@ heap 65520 #301 BOZOSLIVEHERE :-)) <- this is actually EditWndProc #306 BEAR306 308 pascal DefDlgProc(word word word long) DefDlgProc -309 pascal16 GetClipCursor(ptr) GetClipCursor +309 pascal16 GetClipCursor(ptr) GetClipCursor16 314 stub SignalProc 319 pascal16 ScrollWindowEx(word s_word s_word ptr ptr word ptr word) ScrollWindowEx @@ -331,10 +331,10 @@ heap 65520 364 stub LookupIconIDFromDirectoryEx 368 pascal16 CopyIcon(word word) CopyIcon 369 pascal16 CopyCursor(word word) CopyCursor -370 pascal16 GetWindowPlacement(word ptr) GetWindowPlacement -371 pascal16 SetWindowPlacement(word ptr) SetWindowPlacement +370 pascal16 GetWindowPlacement(word ptr) GetWindowPlacement16 +371 pascal16 SetWindowPlacement(word ptr) SetWindowPlacement16 372 stub GetInternalIconHeader -373 pascal16 SubtractRect(ptr ptr ptr) SubtractRect +373 pascal16 SubtractRect(ptr ptr ptr) SubtractRect16 375 stub DrawTextEx 376 stub SetMessageExtraInfo 378 stub SetPropEx @@ -350,14 +350,14 @@ heap 65520 391 stub SignalProc32 394 stub DrawIconEx 395 stub GetIconInfo -397 stub RegisterClassEx -398 stub GetClassInfoEx +397 pascal16 RegisterClassEx(ptr) RegisterClassEx16 +398 pascal16 GetClassInfoEx(word segptr ptr) GetClassInfoEx16 399 stub ChildWindowFromPointEx 400 stub FinalUserInit 402 pascal16 GetPriorityClipboardFormat(word ptr s_word) GetPriorityClipboardFormat 403 pascal16 UnregisterClass(segptr word) UnregisterClass16 -404 pascal16 GetClassInfo(word segptr ptr) GetClassInfo +404 pascal16 GetClassInfo(word segptr ptr) GetClassInfo16 406 pascal16 CreateCursor(word word word word word ptr ptr) CreateCursor 407 pascal16 CreateIcon(word word word word word ptr ptr) CreateIcon 408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr) @@ -369,14 +369,14 @@ heap 65520 413 pascal16 DeleteMenu(word word word) DeleteMenu 414 pascal16 ModifyMenu(word word word word segptr) ModifyMenu 415 pascal16 CreatePopupMenu() CreatePopupMenu -416 pascal16 TrackPopupMenu(word word word word word word ptr) TrackPopupMenu +416 pascal16 TrackPopupMenu(word word s_word s_word s_word word ptr) TrackPopupMenu16 417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions 418 pascal16 SetMenuItemBitmaps(word word word word word) SetMenuItemBitmaps 420 pascal16 wsprintf() wsprintf 421 pascal16 wvsprintf(ptr ptr ptr) wvsprintf 422 stub DlgDirSelectEx 423 stub DlgDirSelectComboBoxEx -427 pascal16 FindWindowEx(word word segptr ptr) FindWindowEx +427 pascal16 FindWindowEx(word word segptr ptr) FindWindowEx16 428 stub TileWindows 429 stub CascadeWindows 430 pascal16 lstrcmp(ptr ptr) lstrcmp @@ -399,19 +399,19 @@ heap 65520 451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel 452 pascal16 CreateWindowEx(long segptr segptr long s_word s_word s_word s_word word word word segptr) CreateWindowEx16 -454 pascal16 AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx +454 pascal16 AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx16 455 pascal16 GetIconID(word long) GetIconID 456 pascal16 LoadIconHandler(word word) LoadIconHandler 457 pascal16 DestroyIcon(word) DestroyIcon 458 pascal16 DestroyCursor(word) DestroyCursor 459 pascal DumpIcon(segptr ptr ptr ptr) DumpIcon -460 pascal16 GetInternalWindowPos(word ptr ptr) GetInternalWindowPos -461 pascal16 SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos +460 pascal16 GetInternalWindowPos(word ptr ptr) GetInternalWindowPos16 +461 pascal16 SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos16 462 pascal16 CalcChildScroll(word word) CalcChildScroll 463 pascal16 ScrollChildren(word word word long) ScrollChildren 464 pascal DragObject(word word word word word word) DragObject 465 pascal16 DragDetect(word long) DragDetect -466 pascal16 DrawFocusRect(word ptr) DrawFocusRect +466 pascal16 DrawFocusRect(word ptr) DrawFocusRect16 470 stub StringFunc 471 pascal16 lstrcmpi(ptr ptr) lstrcmpi 472 pascal AnsiNext(segptr) AnsiNext diff --git a/if1632/user32.spec b/if1632/user32.spec index e38df88d7b8..4065b35c491 100644 --- a/if1632/user32.spec +++ b/if1632/user32.spec @@ -3,15 +3,15 @@ type win32 base 1 0000 stub ActivateKeyboardLayout -0001 stub AdjustWindowRect -0002 stub AdjustWindowRectEx +0001 stdcall AdjustWindowRect(ptr long long) AdjustWindowRect32 +0002 stdcall AdjustWindowRectEx(ptr long long long) AdjustWindowRectEx32 0003 stub AnyPopup 0004 stub AppendMenuA 0005 stub AppendMenuW 0006 stub ArrangeIconicWindows 0007 stub AttachThreadInput 0008 stub BeginDeferWindowPos -0009 stdcall BeginPaint(long ptr) USER32_BeginPaint +0009 stdcall BeginPaint(long ptr) BeginPaint32 0010 stub BringWindowToTop 0011 stub BroadcastSystemMessage 0012 stub CalcChildScroll @@ -19,8 +19,8 @@ base 1 0014 stub CallMsgFilterA 0015 stub CallMsgFilterW 0016 stub CallNextHookEx -0017 stub CallWindowProcA -0018 stub CallWindowProcW +0017 stdcall CallWindowProcA(ptr long long long long) CallWindowProc32A +0018 stdcall CallWindowProcW(ptr long long long long) CallWindowProc32W 0019 stub CascadeChildWindows 0020 stub CascadeWindows 0021 stub ChangeClipboardChain @@ -50,11 +50,11 @@ base 1 0045 stdcall CheckMenuItem(long long long) CheckMenuItem 0046 stub CheckMenuRadioItem 0047 stub CheckRadioButton -0048 stub ChildWindowFromPoint +0048 stdcall ChildWindowFromPoint(long long long) ChildWindowFromPoint32 0049 stub ChildWindowFromPointEx 0050 stub ClientThreadConnect -0051 stub ClientToScreen -0052 stub ClipCursor +0051 stdcall ClientToScreen(long ptr) ClientToScreen32 +0052 stdcall ClipCursor(ptr) ClipCursor32 0053 stub CloseClipboard 0054 stub CloseDesktop 0055 stub CloseWindow @@ -63,7 +63,7 @@ base 1 0058 stub CopyAcceleratorTableW 0059 stub CopyIcon 0060 stub CopyImage -0061 stub CopyRect +0061 stdcall CopyRect(ptr ptr) CopyRect32 0062 stub CountClipboardFormats 0063 stub CreateAcceleratorTableA 0064 stub CreateAcceleratorTableW @@ -164,7 +164,7 @@ base 1 0152 stub DrawAnimatedRects 0153 stub DrawCaption 0154 stub DrawEdge -0155 stub DrawFocusRect +0155 stdcall DrawFocusRect(long ptr) DrawFocusRect32 0156 stub DrawFrame 0157 stub DrawFrameControl 0158 stub DrawIcon @@ -172,10 +172,10 @@ base 1 0160 stdcall DrawMenuBar(long) DrawMenuBar 0161 stub DrawStateA 0162 stub DrawStateW -0163 stdcall DrawTextA(long ptr long ptr long) USER32_DrawTextA +0163 stdcall DrawTextA(long ptr long ptr long) DrawText32A 0164 stub DrawTextExA 0165 stub DrawTextExW -0166 stub DrawTextW +0166 stdcall DrawTextW(long ptr long ptr long) DrawText32W 0167 stub EditWndProc 0168 stdcall EmptyClipboard() EmptyClipboard 0169 stdcall EnableMenuItem(long long long) EnableMenuItem @@ -184,7 +184,7 @@ base 1 0172 stub EndDeferWindowPos 0173 stdcall EndDialog(long long) EndDialog 0174 stub EndMenu -0175 stdcall EndPaint(long ptr) USER32_EndPaint +0175 stdcall EndPaint(long ptr) EndPaint32 0176 stub EndTask 0177 stub EnumChildWindows 0178 stub EnumClipboardFormats @@ -202,34 +202,34 @@ base 1 0190 stub EnumWindowStationsA 0191 stub EnumWindowStationsW 0192 stub EnumWindows -0193 stub EqualRect -0194 stub ExcludeUpdateRgn +0193 stdcall EqualRect(ptr ptr) EqualRect32 +0194 stdcall ExcludeUpdateRgn(long long) ExcludeUpdateRgn 0195 stub ExitWindowsEx -0196 stub FillRect -0197 return FindWindowA 8 0 -0198 stub FindWindowExA -0199 stub FindWindowExW -0200 stub FindWindowW +0196 stdcall FillRect(long ptr long) FillRect32 +0197 stdcall FindWindowA(ptr ptr) FindWindow32A +0198 stdcall FindWindowExA(long long ptr ptr) FindWindowEx32A +0199 stdcall FindWindowExW(long long ptr ptr) FindWindowEx32W +0200 stdcall FindWindowW(ptr ptr) FindWindow32W 0201 stdcall FlashWindow(long long) FlashWindow -0202 stub FrameRect +0202 stdcall FrameRect(long ptr long) FrameRect32 0203 stub FreeDDElParam 0204 stub GetActiveWindow 0205 stub GetAppCompatFlags 0206 stub GetAsyncKeyState 0207 stub GetCapture 0208 stub GetCaretBlinkTime -0209 stub GetCaretPos -0210 stub GetClassInfoA -0211 stub GetClassInfoExA -0212 stub GetClassInfoExW -0213 stub GetClassInfoW -0214 stub GetClassLongA -0215 stub GetClassLongW -0216 stub GetClassNameA -0217 stub GetClassNameW -0218 stub GetClassWord -0219 stdcall GetClientRect(long long) USER32_GetClientRect -0220 stub GetClipCursor +0209 stdcall GetCaretPos(ptr) GetCaretPos32 +0210 stdcall GetClassInfoA(long ptr ptr) GetClassInfo32A +0211 stdcall GetClassInfoExA(long ptr ptr) GetClassInfoEx32A +0212 stdcall GetClassInfoExW(long ptr ptr) GetClassInfoEx32W +0213 stdcall GetClassInfoW(long ptr ptr) GetClassInfo32W +0214 stdcall GetClassLongA(long long) GetClassLong32A +0215 stdcall GetClassLongW(long long) GetClassLong32W +0216 stdcall GetClassNameA(long ptr long) GetClassName32A +0217 stdcall GetClassNameW(long ptr long) GetClassName32W +0218 stdcall GetClassWord(long long) GetClassWord +0219 stdcall GetClientRect(long long) GetClientRect32 +0220 stdcall GetClipCursor(ptr) GetClipCursor32 0221 stub GetClipboardData 0222 stub GetClipboardFormatNameA 0223 stub GetClipboardFormatNameW @@ -237,7 +237,7 @@ base 1 0225 stub GetClipboardViewer 0226 stub GetCursor 0227 stub GetCursorInfo -0228 stdcall GetCursorPos(ptr) GetCursorPos +0228 stdcall GetCursorPos(ptr) GetCursorPos32 0229 stdcall GetDC(long) GetDC 0230 stub GetDCEx 0231 stdcall GetDesktopWindow() GetDesktopWindow @@ -253,7 +253,7 @@ base 1 0241 stub GetIconInfo 0242 stub GetInputDesktop 0243 stub GetInputState -0244 stub GetInternalWindowPos +0244 stdcall GetInternalWindowPos(long ptr ptr) GetInternalWindowPos32 0245 stub GetKBCodePage 0246 stub GetKeyNameTextA 0247 stub GetKeyNameTextW @@ -296,7 +296,7 @@ base 1 0284 stub GetScrollPos 0285 stub GetScrollRange 0286 stub GetShellWindow -0287 stub GetSubMenu +0287 stdcall GetSubMenu(long long) GetSubMenu 0288 stdcall GetSysColor(long) GetSysColor 0289 stdcall GetSysColorBrush(long) GetSysColorBrush 0290 stdcall GetSystemMenu(long long) GetSystemMenu @@ -305,8 +305,8 @@ base 1 0293 stub GetTabbedTextExtentW 0294 stub GetThreadDesktop 0295 stub GetTopWindow -0296 stub GetUpdateRect -0297 stub GetUpdateRgn +0296 stdcall GetUpdateRect(long ptr long) GetUpdateRect32 +0297 stdcall GetUpdateRgn(long long long) GetUpdateRgn 0298 stub GetUserObjectInformationA 0299 stub GetUserObjectInformationW 0300 stub GetUserObjectSecurity @@ -315,8 +315,8 @@ base 1 0303 stdcall GetWindowDC(long) GetWindowDC 0304 stub GetWindowLongA 0305 stub GetWindowLongW -0306 stub GetWindowPlacement -0307 stub GetWindowRect +0306 stdcall GetWindowPlacement(long ptr) GetWindowPlacement32 +0307 stdcall GetWindowRect(long ptr) GetWindowRect32 0308 stdcall GetWindowTextA(long segptr long) WIN16_GetWindowText 0309 stub GetWindowTextLengthA 0310 stub GetWindowTextLengthW @@ -329,16 +329,16 @@ base 1 0317 stub HiliteMenuItem 0318 stub ImpersonateDdeClientWindow 0319 stub InSendMessage -0320 stub InflateRect +0320 stdcall InflateRect(ptr long long) InflateRect32 0321 stub InsertMenuA 0322 stub InsertMenuItemA 0323 stub InsertMenuItemW 0324 stub InsertMenuW 0325 stub InternalGetWindowText -0326 stub IntersectRect -0327 stdcall InvalidateRect(long ptr long) USER32_InvalidateRect -0328 stub InvalidateRgn -0329 stub InvertRect +0326 stdcall IntersectRect(ptr ptr ptr) IntersectRect32 +0327 stdcall InvalidateRect(long ptr long) InvalidateRect32 +0328 stdcall InvalidateRgn(long long long) InvalidateRgn +0329 stdcall InvertRect(long ptr) InvertRect32 0330 stub IsCharAlphaA 0331 stub IsCharAlphaNumericA 0332 stub IsCharAlphaNumericW @@ -355,11 +355,11 @@ base 1 0343 stub IsDlgButtonChecked 0344 stdcall IsIconic(long) IsIconic 0345 stub IsMenu -0346 stub IsRectEmpty +0346 stdcall IsRectEmpty(ptr) IsRectEmpty32 0347 stub IsWindow -0348 stub IsWindowEnabled -0349 stub IsWindowUnicode -0350 stub IsWindowVisible +0348 stdcall IsWindowEnabled(long) IsWindowEnabled +0349 stdcall IsWindowUnicode(long) IsWindowUnicode +0350 stdcall IsWindowVisible(long) IsWindowVisible 0351 stub IsZoomed 0352 stub KillSystemTimer 0353 stdcall KillTimer(long long) KillTimer @@ -390,11 +390,11 @@ base 1 0378 stub LookupIconIdFromDirectory 0379 stub LookupIconIdFromDirectoryEx 0380 stub MBToWCSEx -0381 stub MapDialogRect +0381 stdcall MapDialogRect(long ptr) MapDialogRect32 0382 stub MapVirtualKeyA 0383 stub MapVirtualKeyExA 0384 stub MapVirtualKeyW -0385 stub MapWindowPoints +0385 stdcall MapWindowPoints(long long ptr long) MapWindowPoints32 0386 stub MenuItemFromPoint 0387 stub MenuWindowProcA 0388 stub MenuWindowProcW @@ -407,14 +407,14 @@ base 1 0395 stub MessageBoxW 0396 stub ModifyMenuA 0397 stub ModifyMenuW -0398 stub MoveWindow +0398 stdcall MoveWindow(long long long long long long) MoveWindow 0399 stub MsgWaitForMultipleObjects 0400 stub OemKeyScan 0401 stub OemToCharA 0402 stub OemToCharBuffA 0403 stub OemToCharBuffW 0404 stub OemToCharW -0405 stub OffsetRect +0405 stdcall OffsetRect(ptr long long) OffsetRect32 0406 stub OpenClipboard 0407 stub OpenDesktopA 0408 stub OpenDesktopW @@ -432,21 +432,21 @@ base 1 0420 stdcall PostQuitMessage(long) PostQuitMessage 0421 stub PostThreadMessageA 0422 stub PostThreadMessageW -0423 stub PtInRect +0423 stdcall PtInRect(ptr long long) PtInRect32 0424 stub QuerySendMessage -0425 stub RedrawWindow +0425 stdcall RedrawWindow(long ptr long long) RedrawWindow32 0426 stdcall RegisterClassA(ptr) RegisterClass32A -0427 stub RegisterClassExA -0428 stub RegisterClassExW -0429 stub RegisterClassW +0427 stdcall RegisterClassExA(ptr) RegisterClassEx32A +0428 stdcall RegisterClassExW(ptr) RegisterClassEx32W +0429 stdcall RegisterClassW(ptr) RegisterClass32W 0430 stub RegisterClipboardFormatA 0431 stub RegisterClipboardFormatW 0432 stub RegisterHotKey 0433 stub RegisterLogonProcess 0434 stub RegisterSystemThread 0435 stub RegisterTasklist -0436 stub RegisterWindowMessageA -0437 stub RegisterWindowMessageW +0436 stdcall RegisterWindowMessageA(ptr) RegisterWindowMessage32A +0437 stdcall RegisterWindowMessageW(ptr) RegisterWindowMessage32W 0438 stdcall ReleaseCapture() ReleaseCapture 0439 stdcall ReleaseDC(long long) ReleaseDC 0440 stub RemoveMenu @@ -455,7 +455,7 @@ base 1 0443 stub ReplyMessage 0444 stub ResetDisplay 0445 stub ReuseDDElParam -0446 stub ScreenToClient +0446 stdcall ScreenToClient(long ptr) ScreenToClient32 0447 stub ScrollChildren 0448 stub ScrollDC 0449 stub ScrollWindow @@ -475,9 +475,9 @@ base 1 0463 stdcall SetCapture(long) SetCapture 0464 stub SetCaretBlinkTime 0465 stub SetCaretPos -0466 stub SetClassLongA -0467 stub SetClassLongW -0468 stub SetClassWord +0466 stdcall SetClassLongA(long long long) SetClassLong32A +0467 stdcall SetClassLongW(long long long) SetClassLong32W +0468 stdcall SetClassWord(long long long) SetClassWord 0469 stub SetClipboardData 0470 stub SetClipboardViewer 0471 stdcall SetCursor(long) SetCursor @@ -491,7 +491,7 @@ base 1 0479 stub SetDoubleClickTime 0480 stub SetFocus 0481 stub SetForegroundWindow -0482 stub SetInternalWindowPos +0482 stdcall SetInternalWindowPos(long long ptr ptr) SetInternalWindowPos32 0483 stub SetKeyboardState 0484 stub SetLastErrorEx 0485 stub SetLogonNotifyWindow @@ -507,11 +507,11 @@ base 1 0495 stub SetProcessWindowStation 0496 stub SetPropA 0497 stub SetPropW -0498 stub SetRect -0499 stub SetRectEmpty +0498 stdcall SetRect(ptr long long long long) SetRect32 +0499 stdcall SetRectEmpty(ptr) SetRectEmpty32 0500 stub SetScrollInfo -0501 stub SetScrollPos -0502 stub SetScrollRange +0501 stdcall SetScrollPos(long long long long) SetScrollPos +0502 stdcall SetScrollRange(long long long long long) SetScrollRange 0503 stub SetShellWindow 0504 stub SetSysColors 0505 stub SetSysColorsTemp @@ -527,14 +527,14 @@ base 1 0515 stub SetWindowFullScreenState 0516 stub SetWindowLongA 0517 stub SetWindowLongW -0518 stub SetWindowPlacement +0518 stdcall SetWindowPlacement(long ptr) SetWindowPlacement32 0519 stub SetWindowPos 0520 stub SetWindowStationUser 0521 stdcall SetWindowTextA(long ptr) SetWindowText 0522 stub SetWindowTextW 0523 stub SetWindowWord 0524 stub SetWindowsHookA -0525 stub SetWindowsHookExA +0525 stdcall SetWindowsHookExA(long long long long) SetWindowsHookEx32A 0526 stub SetWindowsHookExW 0527 stub SetWindowsHookW 0528 stub ShowCaret @@ -544,7 +544,7 @@ base 1 0532 stub ShowStartGlass 0533 stdcall ShowWindow(long long) ShowWindow 0534 stub ShowWindowAsync -0535 stub SubtractRect +0535 stdcall SubtractRect(ptr ptr ptr) SubtractRect32 0536 stub SwapMouseButton 0537 stub SwitchDesktop 0538 stub SwitchToThisWindow @@ -557,7 +557,7 @@ base 1 0545 stub ToAscii 0546 stub ToAsciiEx 0547 stub ToUnicode -0548 stub TrackPopupMenu +0548 stdcall TrackPopupMenu(long long long long long long ptr) TrackPopupMenu32 0549 stub TrackPopupMenuEx 0550 stub TranslateAccelerator 0551 stdcall TranslateAcceleratorA(long long ptr) TranslateAccelerator @@ -567,20 +567,20 @@ base 1 0555 stdcall TranslateMessage(ptr) USER32_TranslateMessage 0556 stub UnhookWindowsHook 0557 stub UnhookWindowsHookEx -0558 stub UnionRect +0558 stdcall UnionRect(ptr ptr ptr) UnionRect32 0559 stub UnloadKeyboardLayout 0560 stub UnlockWindowStation 0561 stub UnpackDDElParam -0562 stub UnregisterClassA -0563 stub UnregisterClassW +0562 stdcall UnregisterClassA(ptr long) UnregisterClass32A +0563 stdcall UnregisterClassW(ptr long) UnregisterClass32W 0564 stub UnregisterHotKey 0565 stub UpdatePerUserSystemParameters 0566 stdcall UpdateWindow(long) UpdateWindow 0567 stub UserClientDllInitialize 0568 stub UserRealizePalette 0569 stub UserRegisterWowHandlers -0570 stub ValidateRect -0571 stub ValidateRgn +0570 stdcall ValidateRect(long ptr) ValidateRect32 +0571 stdcall ValidateRgn(long long) ValidateRgn 0572 stub VkKeyScanA 0573 stub VkKeyScanExA 0574 stub VkKeyScanExW @@ -590,7 +590,7 @@ base 1 0578 stdcall WinHelpA(long ptr long long) WIN32_WinHelpA 0579 stub WinHelpW 0580 stub WindowFromDC -0581 stub WindowFromPoint +0581 stdcall WindowFromPoint(long long) WindowFromPoint32 0582 stub keybd_event 0583 stub mouse_event 0584 stdcall wsprintfA() USER32_wsprintfA @@ -608,4 +608,3 @@ base 1 0588 stub RegisterServicesProcess 0588 stub SetWindowRgn 0588 stub ToUnicodeEx - diff --git a/include/bitmap.h b/include/bitmap.h index fc07762c18e..5c3b763b530 100644 --- a/include/bitmap.h +++ b/include/bitmap.h @@ -15,7 +15,7 @@ typedef struct GDIOBJHDR header; BITMAP bitmap; Pixmap pixmap; - SIZE size; /* For SetBitmapDimension() */ + SIZE16 size; /* For SetBitmapDimension() */ } BITMAPOBJ; /* GCs used for B&W and color bitmap operations */ diff --git a/include/callback.h b/include/callback.h index 3eb529b2c24..f252007db42 100644 --- a/include/callback.h +++ b/include/callback.h @@ -64,7 +64,7 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax, CallTo16_long_wwl( func, CURRENT_DS, code, wParam, lParam ) #define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \ CallTo16_word_wwlll( func, CURRENT_DS, id, msg, dwUser, dw1, dw2 ) -#define CallWndProc( func, ds, hwnd, msg, wParam, lParam ) \ +#define CallWndProc16( func, ds, hwnd, msg, wParam, lParam ) \ CallTo16_long_wwwl( func, ds, hwnd, msg, wParam, lParam ) #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \ CallTo16_word_lwww( func, CURRENT_DS, lpch, ichCurrent, cch, code ) @@ -73,9 +73,9 @@ extern WORD CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp, WORD ax, /* List of the 32-bit callback functions. This list is used */ /* by the build program to generate the file if1632/callto32.S */ -extern LONG CallTo32_0( FARPROC ); -extern LONG CallTo32_3( FARPROC, DWORD, DWORD, DWORD ); -extern LONG CallTo32_4( FARPROC, DWORD, DWORD, DWORD, DWORD ); +extern LONG CallTo32_0( FARPROC32 ); +extern LONG CallTo32_3( FARPROC32, DWORD, DWORD, DWORD ); +extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD ); #define CallTaskStart32( func ) \ CallTo32_0( func ) @@ -111,11 +111,14 @@ extern LONG CallTo32_4( FARPROC, DWORD, DWORD, DWORD, DWORD ); (*func)( code, wParam, lParam ) #define CallTimeFuncProc( func, id, msg, dwUser, dw1, dw2 ) \ (*func)( id, msg, dwUser, dw1, dw2 ) -#define CallWndProc( func, ds, hwnd, msg, wParam, lParam ) \ +#define CallWndProc16( func, ds, hwnd, msg, wParam, lParam ) \ + (*func)( hwnd, msg, wParam, lParam ) +#define CallWndProc32( func, hwnd, msg, wParam, lParam ) \ (*func)( hwnd, msg, wParam, lParam ) #define CallWordBreakProc( func, lpch, ichCurrent, cch, code ) \ (*func)( lpch, ichCurrent, cch, code ) + #endif /* WINELIB */ diff --git a/include/class.h b/include/class.h index f110089818a..599fb23c9a1 100644 --- a/include/class.h +++ b/include/class.h @@ -17,22 +17,29 @@ typedef struct tagCLASS UINT32 magic; /* Magic number */ UINT32 cWindows; /* Count of existing windows */ UINT32 style; /* Class style */ + UINT32 flags; /* Class flags (see below) */ WNDPROC16 lpfnWndProc; /* 16-bit window procedure */ INT32 cbClsExtra; /* Class extra bytes */ INT32 cbWndExtra; /* Window extra bytes */ - SEGPTR lpszMenuName; /* Default menu name */ - HANDLE16 hInstance; /* Module that created the task */ + LPSTR menuNameA; /* Default menu name (ASCII string) */ + LPWSTR menuNameW; /* Default menu name (Unicode) */ + HINSTANCE32 hInstance; /* Module that created the task */ HICON16 hIcon; /* Default icon */ + HICON16 hIconSm; /* Default small icon */ HCURSOR16 hCursor; /* Default cursor */ HBRUSH16 hbrBackground; /* Default background */ ATOM atomName; /* Name of the class */ HANDLE16 hdce; /* Class DCE (if CS_CLASSDC) */ - WORD wExtra[1]; /* Class extra bytes */ + LONG wExtra[1]; /* Class extra bytes */ } CLASS; +/* Class flags */ +#define CLASS_FLAG_UNICODE 0x0001 /* Window procedure expects Unicode */ + extern void CLASS_DumpClass( CLASS *class ); extern void CLASS_WalkClasses(void); extern void CLASS_FreeModuleClasses( HMODULE hModule ); +extern CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE16 hinstance ); extern CLASS * CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance ); #endif /* CLASS_H */ diff --git a/include/color.h b/include/color.h index 543b4ff917c..61486d3adfc 100644 --- a/include/color.h +++ b/include/color.h @@ -3,7 +3,7 @@ #include "gdi.h" -extern HPALETTE COLOR_Init(void); +extern HPALETTE16 COLOR_Init(void); extern int COLOR_ToPhysical( DC *dc, COLORREF color ); extern void COLOR_SetMapping( DC *dc, HANDLE map, HANDLE revMap, WORD size ); extern BOOL COLOR_IsSolid( COLORREF color ); diff --git a/include/combo.h b/include/combo.h index d89bd6e01b9..0e177f63978 100644 --- a/include/combo.h +++ b/include/combo.h @@ -4,16 +4,16 @@ typedef struct { - DWORD dwStyle; - DWORD dwState; - HWND hWndEdit; - HWND hWndLBox; - WORD LBoxTop; - BOOL DropDownVisible; - short LastSel; - RECT RectEdit; - RECT RectButton; - BOOL bRedrawFlag; + DWORD dwStyle; + DWORD dwState; + HWND hWndEdit; + HWND hWndLBox; + WORD LBoxTop; + BOOL DropDownVisible; + short LastSel; + RECT16 RectEdit; + RECT16 RectButton; + BOOL bRedrawFlag; } HEADCOMBO,*LPHEADCOMBO; LRESULT ComboBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); diff --git a/include/desktop.h b/include/desktop.h index ba9876c2ad1..5c06635ab14 100644 --- a/include/desktop.h +++ b/include/desktop.h @@ -13,7 +13,7 @@ typedef struct { HBRUSH hbrushPattern; HBITMAP hbitmapWallPaper; - SIZE bitmapSize; + SIZE16 bitmapSize; BOOL fTileWallPaper; } DESKTOPINFO; diff --git a/include/font.h b/include/font.h index 6b2f8c8a98c..8a8dae74cc8 100644 --- a/include/font.h +++ b/include/font.h @@ -27,7 +27,7 @@ typedef struct { UINT gmBlackBoxX; UINT gmBlackBoxY; - POINT gmptGlyphOrigin; + POINT16 gmptGlyphOrigin; int gmCellIncX; int gmCellIncY; } GLYPHMETRICS,*LPGLYPHMETRICS; diff --git a/include/gdi.h b/include/gdi.h index 9581bb75564..96847b9fe93 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -90,13 +90,13 @@ typedef struct HRGN hClipRgn; /* Clip region (may be 0) */ HRGN hVisRgn; /* Visible region (must never be 0) */ HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */ - HPEN hPen; + HPEN16 hPen; HBRUSH hBrush; HFONT hFont; HBITMAP hBitmap; HBITMAP hFirstBitmap; /* Bitmap selected at creation of the DC */ HANDLE hDevice; - HPALETTE hPalette; + HPALETTE16 hPalette; WORD ROPmode; WORD polyFillMode; @@ -214,15 +214,15 @@ typedef struct tagDC #define STOCK_BLACK_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+BLACK_BRUSH)) #define STOCK_NULL_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+NULL_BRUSH)) #define STOCK_HOLLOW_BRUSH ((HBRUSH)(FIRST_STOCK_HANDLE+HOLLOW_BRUSH)) -#define STOCK_WHITE_PEN ((HPEN)(FIRST_STOCK_HANDLE+WHITE_PEN)) -#define STOCK_BLACK_PEN ((HPEN)(FIRST_STOCK_HANDLE+BLACK_PEN)) -#define STOCK_NULL_PEN ((HPEN)(FIRST_STOCK_HANDLE+NULL_PEN)) +#define STOCK_WHITE_PEN ((HPEN16)(FIRST_STOCK_HANDLE+WHITE_PEN)) +#define STOCK_BLACK_PEN ((HPEN16)(FIRST_STOCK_HANDLE+BLACK_PEN)) +#define STOCK_NULL_PEN ((HPEN16)(FIRST_STOCK_HANDLE+NULL_PEN)) #define STOCK_OEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+OEM_FIXED_FONT)) #define STOCK_ANSI_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_FIXED_FONT)) #define STOCK_ANSI_VAR_FONT ((HFONT)(FIRST_STOCK_HANDLE+ANSI_VAR_FONT)) #define STOCK_SYSTEM_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FONT)) #define STOCK_DEVICE_DEFAULT_FONT ((HFONT)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT)) -#define STOCK_DEFAULT_PALETTE ((HPALETTE)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE)) +#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE)) #define STOCK_SYSTEM_FIXED_FONT ((HFONT)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT)) #define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT diff --git a/include/graphics.h b/include/graphics.h index 2fba4222757..a9d4423a1f3 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -8,7 +8,7 @@ #ifndef __WINE_GRAPHICS_H #define __WINE_GRAPHICS_H -extern void GRAPH_DrawReliefRect( HDC hdc, RECT *rect, int highlight_size, +extern void GRAPH_DrawReliefRect( HDC hdc, RECT16 *rect, int highlight_size, int shadow_size, BOOL pressed ); extern BOOL GRAPH_DrawBitmap( HDC hdc, HBITMAP hbitmap, int xdest, int ydest, int xsrc, int ysrc, int width, int height ); diff --git a/include/handle32.h b/include/handle32.h index 6ebbaa2a36e..93162cd31cc 100644 --- a/include/handle32.h +++ b/include/handle32.h @@ -1,7 +1,7 @@ #ifndef __WINE_HANDLE32_H #define __WINE_HANDLE32_H -#include +#include #include "wintypes.h" /* The _*_OBJECT structures contain information needed about each diff --git a/include/heap.h b/include/heap.h index e54181554ea..ee55f9b883c 100644 --- a/include/heap.h +++ b/include/heap.h @@ -11,5 +11,23 @@ #include "winnt.h" extern HANDLE32 SystemHeap; +extern HANDLE32 SegptrHeap; + +extern int HEAP_IsInsideHeap( HANDLE32 heap, DWORD flags, LPCVOID ptr ); +extern SEGPTR HEAP_GetSegptr( HANDLE32 heap, DWORD flags, LPCVOID ptr ); +extern LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str ); + +/* SEGPTR helper macros */ + +#define SEGPTR_ALLOC(size) \ + (HeapAlloc( SegptrHeap, 0, (size) )) +#define SEGPTR_NEW(type) \ + ((type *)HeapAlloc( SegptrHeap, 0, sizeof(type) )) +#define SEGPTR_STRDUP(str) \ + (HIWORD(str) ? HEAP_strdupA( SegptrHeap, 0, (str) ) : (LPSTR)(str)) +#define SEGPTR_GET(ptr) \ + (HIWORD(ptr) ? HEAP_GetSegptr( SegptrHeap, 0, (ptr) ) : (SEGPTR)(ptr)) +#define SEGPTR_FREE(ptr) \ + (HIWORD(ptr) ? HeapFree( SegptrHeap, 0, (ptr) ) : 0) #endif /* __WINE_HEAP_H */ diff --git a/include/listbox.h b/include/listbox.h index ebd9c9e5aeb..179badd4a2e 100644 --- a/include/listbox.h +++ b/include/listbox.h @@ -5,7 +5,7 @@ typedef struct tagLISTSTRUCT { MEASUREITEMSTRUCT mis; UINT itemState; - RECT itemRect; + RECT16 itemRect; HANDLE hData; char *itemText; struct tagLISTSTRUCT *lpNext; @@ -60,12 +60,12 @@ extern int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex); extern int ListBoxSetSel(LPHEADLIST lphl, WORD wIndex, WORD state); extern int ListBoxGetSel(LPHEADLIST lphl, WORD wIndex); extern LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec); -extern int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT rect); +extern int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT16 rect); extern int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height); extern int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar); extern void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, - LPLISTSTRUCT lpls, RECT *rect, WORD itemAction, + LPLISTSTRUCT lpls, RECT16 *rect, WORD itemAction, WORD itemState); extern int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y); extern void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls); diff --git a/include/mdi.h b/include/mdi.h index adde0b0e585..2fac0d81bc3 100644 --- a/include/mdi.h +++ b/include/mdi.h @@ -31,17 +31,18 @@ typedef struct tagMDIWCL typedef struct { - WORD nActiveChildren; - HWND flagChildMaximized; - HWND hwndActiveChild; - HMENU hWindowMenu; - WORD idFirstChild; - HANDLE hFrameTitle; - WORD sbNeedUpdate; - WORD sbRecalc; - HBITMAP obmClose; - HBITMAP obmRestore; - HWND self; + WORD nActiveChildren; + HWND hwndChildMaximized; + HWND hwndActiveChild; + HMENU hWindowMenu; + WORD idFirstChild; + WORD nTotalCreated; + HANDLE hFrameTitle; + WORD sbNeedUpdate; + WORD sbRecalc; + HBITMAP obmClose; + HBITMAP obmRestore; + HWND self; } MDICLIENTINFO; #endif /* MDI_H */ diff --git a/include/menu.h b/include/menu.h index dabde45a22d..d2e90bf1586 100644 --- a/include/menu.h +++ b/include/menu.h @@ -12,9 +12,9 @@ extern BOOL MENU_Init(void); extern HMENU MENU_GetDefSysMenu(void); extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth, int orgX, int orgY ); -extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT pt ); +extern void MENU_TrackMouseMenuBar( HWND hwnd, POINT16 pt ); extern void MENU_TrackKbdMenuBar( WND*, UINT wParam, INT vkey); -extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT lprect, +extern UINT MENU_DrawMenuBar( HDC hDC, LPRECT16 lprect, HWND hwnd, BOOL suppress_draw ); extern LRESULT PopupMenuWndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam ); @@ -22,7 +22,7 @@ typedef struct tagMENUITEM { WORD item_flags; /* Item flags */ UINT item_id; /* Item or popup id */ - RECT rect; /* Item area (relative to menu window) */ + RECT16 rect; /* Item area (relative to menu window) */ WORD xTab; /* X position of text after Tab */ HBITMAP hCheckBit; /* Bitmap for checked item */ HBITMAP hUnCheckBit; /* Bitmap for unchecked item */ diff --git a/include/metafile.h b/include/metafile.h index c83afcbc508..7951832c460 100644 --- a/include/metafile.h +++ b/include/metafile.h @@ -28,10 +28,10 @@ BOOL MF_MetaParam8(DC *dc, short func, short param1, short param2, short param6, short param7, short param8); BOOL MF_CreateBrushIndirect(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush); BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush); -BOOL MF_CreatePenIndirect(DC *dc, HPEN hPen, LOGPEN *logpen); +BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN *logpen); BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT *logfont); -BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count); -BOOL MF_MetaPoly(DC *dc, short func, LPPOINT pt, short count); +BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count); +BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count); BOOL MF_BitBlt(DC *dcDest, short xDest, short yDest, short width, short height, HDC hdcSrc, short xSrc, short ySrc, DWORD rop); BOOL MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest, diff --git a/include/mmsystem.h b/include/mmsystem.h index a08d12bf436..45fb92c284f 100644 --- a/include/mmsystem.h +++ b/include/mmsystem.h @@ -1247,16 +1247,16 @@ typedef struct { typedef struct { DWORD dwCallback; #ifdef MCI_USE_OFFEXT - POINT ptOffset; - POINT ptExtent; + POINT16 ptOffset; + POINT16 ptExtent; #else /* ifdef MCI_USE_OFFEXT */ - RECT rc; + RECT16 rc; #endif /* ifdef MCI_USE_OFFEXT */ } MCI_ANIM_RECT_PARMS, *LPMCI_ANIM_RECT_PARMS; typedef struct { DWORD dwCallback; - RECT rc; + RECT16 rc; HDC hDC; } MCI_ANIM_UPDATE_PARMS, *LPMCI_ANIM_UPDATE_PARMS; @@ -1315,23 +1315,23 @@ typedef struct { typedef struct { DWORD dwCallback; #ifdef MCI_USE_OFFEXT - POINT ptOffset; - POINT ptExtent; + POINT16 ptOffset; + POINT16 ptExtent; #else /* ifdef MCI_USE_OFFEXT */ - RECT rc; + RECT16 rc; #endif /* ifdef MCI_USE_OFFEXT */ } MCI_OVLY_RECT_PARMS, *LPMCI_OVLY_RECT_PARMS; typedef struct { DWORD dwCallback; LPCSTR lpfilename; - RECT rc; + RECT16 rc; } MCI_OVLY_SAVE_PARMS, *LPMCI_OVLY_SAVE_PARMS; typedef struct { DWORD dwCallback; LPCSTR lpfilename; - RECT rc; + RECT16 rc; } MCI_OVLY_LOAD_PARMS, *LPMCI_OVLY_LOAD_PARMS; diff --git a/include/module.h b/include/module.h index e6ca76359b7..c867f4388a7 100644 --- a/include/module.h +++ b/include/module.h @@ -126,8 +126,8 @@ extern HINSTANCE MODULE_GetInstance( HMODULE hModule ); extern WORD MODULE_GetOrdinal( HMODULE hModule, const char *name ); extern SEGPTR MODULE_GetEntryPoint( HMODULE hModule, WORD ordinal ); extern BOOL MODULE_SetEntryPoint( HMODULE hModule, WORD ordinal, WORD offset ); -extern FARPROC MODULE_GetWndProcEntry16( const char *name ); -extern FARPROC MODULE_GetWndProcEntry32( const char *name ); +extern FARPROC16 MODULE_GetWndProcEntry16( const char *name ); +extern FARPROC32 MODULE_GetWndProcEntry32( const char *name ); /* builtin.c */ extern BOOL BUILTIN_Init(void); diff --git a/include/nonclient.h b/include/nonclient.h index 49fa2065985..6b4bff1ade1 100644 --- a/include/nonclient.h +++ b/include/nonclient.h @@ -9,17 +9,16 @@ #include "win.h" -extern void NC_GetInsideRect( HWND hwnd, RECT *rect ); -extern void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, - POINT *minTrack, POINT *maxTrack ); +extern void NC_GetMinMaxInfo( HWND hwnd, POINT16 *maxSize, POINT16 *maxPos, + POINT16 *minTrack, POINT16 *maxTrack ); extern void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ); extern LONG NC_HandleNCPaint( HWND hwnd , HRGN clip); extern LONG NC_HandleNCActivate( HWND hwnd, WPARAM wParam ); -extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params ); -extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ); +extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS16 *params ); +extern LONG NC_HandleNCHitTest( HWND hwnd, POINT16 pt ); extern LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ); extern LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam); -extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt ); +extern LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT16 pt ); extern LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ); #endif /* __WINE_NONCLIENT_H */ diff --git a/include/ole.h b/include/ole.h index b9206404b66..9cc310a2ae7 100644 --- a/include/ole.h +++ b/include/ole.h @@ -159,7 +159,7 @@ typedef struct _OLESERVERDOCVTBL { OLESTATUS (*Save)(LPOLESERVERDOC); OLESTATUS (*Close)(LPOLESERVERDOC); OLESTATUS (*SetHostNames)(LPOLESERVERDOC,OLE_LPCSTR,OLE_LPCSTR); - OLESTATUS (*SetDocDimensions)(LPOLESERVERDOC,LPRECT); + OLESTATUS (*SetDocDimensions)(LPOLESERVERDOC,LPRECT16); OLESTATUS (*GetObject)(LPOLESERVERDOC,OLE_LPCSTR,LPOLEOBJECT*,LPOLECLIENT); OLESTATUS (*Release)(LPOLESERVERDOC); OLESTATUS (*SetColorScheme)(LPOLESERVERDOC,LPLOGPALETTE); @@ -204,7 +204,7 @@ typedef struct _OLEOBJECTVTBL { OLESTATUS (*GetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE *); OLESTATUS (*SetData)(LPOLEOBJECT,OLECLIPFORMAT,HANDLE); OLESTATUS (*SetTargetDevice)(LPOLEOBJECT,HGLOBAL); - OLESTATUS (*SetBounds)(LPOLEOBJECT,LPRECT); + OLESTATUS (*SetBounds)(LPOLEOBJECT,LPRECT16); OLESTATUS (*EnumFormats)(LPOLEOBJECT,OLECLIPFORMAT); OLESTATUS (*SetColorScheme)(LPOLEOBJECT,LPLOGPALETTE); OLESTATUS (*Delete)(LPOLEOBJECT); @@ -214,8 +214,8 @@ typedef struct _OLEOBJECTVTBL { OLESTATUS (*CopyFromLink)(LPOLEOBJECT,LPOLECLIENT,LHCLIENTDOC,OLE_LPCSTR,LPOLEOBJECT *); OLESTATUS (*Equal)(LPOLEOBJECT,LPOLEOBJECT); OLESTATUS (*CopyToClipBoard)(LPOLEOBJECT); - OLESTATUS (*Draw)(LPOLEOBJECT,HDC,LPRECT,LPRECT,HDC); - OLESTATUS (*Activate)(LPOLEOBJECT,UINT,BOOL,BOOL,HWND,LPRECT); + OLESTATUS (*Draw)(LPOLEOBJECT,HDC,LPRECT16,LPRECT16,HDC); + OLESTATUS (*Activate)(LPOLEOBJECT,UINT,BOOL,BOOL,HWND,LPRECT16); OLESTATUS (*Execute)(LPOLEOBJECT,HGLOBAL,UINT); OLESTATUS (*Close)(LPOLEOBJECT); OLESTATUS (*Update)(LPOLEOBJECT); @@ -226,7 +226,7 @@ typedef struct _OLEOBJECTVTBL { OLESTATUS (*Rename)(LPOLEOBJECT,OLE_LPCSTR); OLESTATUS (*QueryName)(LPOLEOBJECT,LPSTR,LPUINT16); OLESTATUS (*QueryType)(LPOLEOBJECT,LPLONG); - OLESTATUS (*QueryBounds)(LPOLEOBJECT,LPRECT); + OLESTATUS (*QueryBounds)(LPOLEOBJECT,LPRECT16); OLESTATUS (*QuerySize)(LPOLEOBJECT,LPDWORD); OLESTATUS (*QueryOpen)(LPOLEOBJECT); OLESTATUS (*QueryOutOfDate)(LPOLEOBJECT); diff --git a/include/pen.h b/include/pen.h index 1fc160cb36f..7016d24e3d0 100644 --- a/include/pen.h +++ b/include/pen.h @@ -25,6 +25,6 @@ typedef struct #endif extern int PEN_GetObject( PENOBJ * pen, int count, LPSTR buffer ); -extern HPEN PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen ); +extern HPEN16 PEN_SelectObject( DC * dc, HPEN16 hpen, PENOBJ * pen ); #endif /* __WINE_PEN_H */ diff --git a/include/regfunc.h b/include/regfunc.h deleted file mode 100644 index fa917000cbf..00000000000 --- a/include/regfunc.h +++ /dev/null @@ -1,22 +0,0 @@ -/* $Id$ - */ - -#ifndef REGFUNC_H -#define REGFUNC_H - -#include "wine.h" -#include "stackframe.h" - -#define _CONTEXT ((struct sigcontext_struct *) CURRENT_STACK16->args) -#define _AX (_CONTEXT->sc_eax) -#define _BX (_CONTEXT->sc_ebx) -#define _CX (_CONTEXT->sc_ecx) -#define _DX (_CONTEXT->sc_edx) -#define _SI (_CONTEXT->sc_esi) -#define _DI (_CONTEXT->sc_edi) -#define _DS (_CONTEXT->sc_ds) -#define _ES (_CONTEXT->sc_es) - -extern void ReturnFromRegisterFunc(void); - -#endif /* REGFUNC_H */ diff --git a/include/region.h b/include/region.h index e8f62618fcd..552f5c52e6d 100644 --- a/include/region.h +++ b/include/region.h @@ -18,6 +18,6 @@ typedef struct extern BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj ); -extern BOOL REGION_FrameRgn(HRGN dest,HRGN src,int x,int y); +extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT32 x, INT32 y ); #endif /* __WINE_REGION_H */ diff --git a/include/relay32.h b/include/relay32.h deleted file mode 100644 index 1eb26929f1b..00000000000 --- a/include/relay32.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Relay32 definitions - * - * Copyright 1995 Martin von Loewis - */ - -#ifndef __WINE_RELAY32_H -#define __WINE_RELAY32_H - -#include "struct32.h" - -typedef struct tagWNDCLASSA{ - UINT style; - WNDPROC lpfnWndProc; - int cbClsExtra; - int cbWndExtra; - DWORD hInstance; - DWORD hIcon; - DWORD hCursor; - DWORD hbrBackground; - char* lpszMenuName; - char* lpszClassName; -}WNDCLASSA; - -ATOM USER32_RegisterClassA(WNDCLASSA *); -LRESULT USER32_DefWindowProcA(DWORD hwnd,DWORD msg,DWORD wParam,DWORD lParam); -BOOL USER32_GetMessageA(MSG32* lpmsg,DWORD hwnd,DWORD min,DWORD max); -HDC USER32_BeginPaint(DWORD hwnd,PAINTSTRUCT32 *lpps); -BOOL USER32_EndPaint(DWORD hwnd,PAINTSTRUCT32 *lpps); -#endif - diff --git a/include/scroll.h b/include/scroll.h index 681d4d1b5f7..8445a97905d 100644 --- a/include/scroll.h +++ b/include/scroll.h @@ -22,6 +22,6 @@ typedef struct extern LONG ScrollBarWndProc( HWND hwnd, WORD uMsg, WORD wParam, LONG lParam ); extern void SCROLL_DrawScrollBar( HWND hwnd, HDC hdc, int nBar ); extern void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, - WORD msg, POINT pt); /* scroll.c */ + WORD msg, POINT16 pt ); #endif /* SCROLL_H */ diff --git a/include/shell.h b/include/shell.h index d28caba3759..045d2a03632 100644 --- a/include/shell.h +++ b/include/shell.h @@ -26,7 +26,7 @@ extern void SHELL_Init(); typedef struct { /* structure for dropped files */ WORD wSize; - POINT ptMousePos; + POINT16 ptMousePos; BOOL fInNonClientArea; /* memory block with filenames follows */ } DROPFILESTRUCT, *LPDROPFILESTRUCT; diff --git a/include/string32.h b/include/string32.h index eaadefdf0b7..1431a59498d 100644 --- a/include/string32.h +++ b/include/string32.h @@ -15,6 +15,7 @@ void STRING32_UniToAnsi(LPSTR dest,LPCWSTR src); void STRING32_AnsiToUni(LPWSTR dest,LPCSTR src); LPSTR STRING32_DupUniToAnsi(LPCWSTR src); LPWSTR STRING32_DupAnsiToUni(LPCSTR src); +LPWSTR STRING32_lstrcpyW(LPWSTR dst, LPCWSTR src); int STRING32_lstrcmpnW(LPCWSTR a,LPCWSTR b,DWORD len); int STRING32_lstrcmpniW(LPCWSTR a,LPCWSTR b,DWORD len); DWORD STRING32_lstrlenW(LPCWSTR); diff --git a/include/struct32.h b/include/struct32.h index ea5b75b08e2..a1c1e369bf8 100644 --- a/include/struct32.h +++ b/include/struct32.h @@ -7,44 +7,23 @@ #pragma pack(1) #endif -typedef struct tagRECT32 -{ - LONG left; - LONG top; - LONG right; - LONG bottom; -} RECT32; +void STRUCT32_RECT32to16(const RECT32*,RECT16*); +void STRUCT32_RECT16to32(const RECT16*,RECT32*); +void STRUCT32_POINT32to16(const POINT32*,POINT16*); +void STRUCT32_POINT16to32(const POINT16*,POINT32*); +void STRUCT32_SIZE16to32(const SIZE16*, SIZE32*); -void STRUCT32_RECT32to16(const RECT32*,RECT*); -void STRUCT32_RECT16to32(const RECT*,RECT32*); +extern void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32*, MINMAXINFO16* ); +extern void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16*, MINMAXINFO32* ); +extern void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32*, WINDOWPOS16* ); +extern void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16*, WINDOWPOS32* ); +extern void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32 *from, + NCCALCSIZE_PARAMS16 *to, + int validRects ); +extern void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from, + NCCALCSIZE_PARAMS32* to, + int validRects ); -typedef struct tagPOINT32 -{ - LONG x; - LONG y; -} POINT32; - -typedef struct tagSIZE32 -{ - LONG cx; - LONG cy; -} SIZE32; - -void STRUCT32_POINT32to16(const POINT32*,POINT*); -void STRUCT32_POINT16to32(const POINT*,POINT32*); -void STRUCT32_SIZE16to32(const SIZE* p16, SIZE32* p32); - -typedef struct tagMINMAXINFO32 -{ - POINT32 ptReserved; - POINT32 ptMaxSize; - POINT32 ptMaxPosition; - POINT32 ptMinTrackSize; - POINT32 ptMaxTrackSize; -} MINMAXINFO32; - -void STRUCT32_MINMAXINFO32to16(const MINMAXINFO32*,MINMAXINFO*); -void STRUCT32_MINMAXINFO16to32(const MINMAXINFO*,MINMAXINFO32*); typedef struct { DWORD style; @@ -79,60 +58,8 @@ typedef struct tagMSG32 void STRUCT32_MSG16to32(MSG *msg16,MSG32 *msg32); void STRUCT32_MSG32to16(MSG32 *msg32,MSG *msg16); -typedef struct tagPAINTSTRUCT32 -{ - DWORD hdc; - DWORD fErase; - RECT32 rcPaint; - DWORD fRestore; - DWORD fIncUpdate; - BYTE rgbReserved[32]; -} PAINTSTRUCT32; - -typedef struct tagWINDOWPOS32 -{ - DWORD hwnd; - DWORD hwndInsertAfter; - LONG x; - LONG y; - LONG cx; - LONG cy; - DWORD flags; -} WINDOWPOS32; - -void STRUCT32_WINDOWPOS32to16(const WINDOWPOS32*,WINDOWPOS*); -void STRUCT32_WINDOWPOS16to32(const WINDOWPOS*,WINDOWPOS32*); - -typedef struct tagNCCALCSIZE_PARAMS32 -{ - RECT32 rgrc[3]; - WINDOWPOS32 *lppos; -} NCCALCSIZE_PARAMS32; - -void STRUCT32_NCCALCSIZE32to16Flat(const NCCALCSIZE_PARAMS32*, - NCCALCSIZE_PARAMS*); -void STRUCT32_NCCALCSIZE16to32Flat(const NCCALCSIZE_PARAMS* from, - NCCALCSIZE_PARAMS32* to); - -typedef struct tagCREATESTRUCT32 -{ - DWORD lpCreateParams; - DWORD hInstance; - DWORD hMenu; - DWORD hwndParent; - LONG cy; - LONG cx; - LONG y; - LONG x; - LONG style; - LPSTR lpszName; - LPSTR lpszClass; - DWORD dwExStyle; -} CREATESTRUCT32; -typedef CREATESTRUCT32 CREATESTRUCTA; - -void STRUCT32_CREATESTRUCT32to16(const CREATESTRUCT32*,CREATESTRUCT*); -void STRUCT32_CREATESTRUCT16to32(const CREATESTRUCT*,CREATESTRUCT32*); +void STRUCT32_CREATESTRUCT32Ato16(const CREATESTRUCT32A*,CREATESTRUCT16*); +void STRUCT32_CREATESTRUCT16to32A(const CREATESTRUCT16*,CREATESTRUCT32A*); typedef struct { BYTE bWidth; diff --git a/include/syscolor.h b/include/syscolor.h index e5441ce20e3..c1f75c74488 100644 --- a/include/syscolor.h +++ b/include/syscolor.h @@ -17,9 +17,9 @@ struct SysColorObjects HBRUSH hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */ HBRUSH hbrushMenu; /* COLOR_MENU */ HBRUSH hbrushWindow; /* COLOR_WINDOW */ - HPEN hpenWindowFrame; /* COLOR_WINDOWFRAME */ + HPEN16 hpenWindowFrame; /* COLOR_WINDOWFRAME */ /* COLOR_MENUTEXT */ - HPEN hpenWindowText; /* COLOR_WINDOWTEXT */ + HPEN16 hpenWindowText; /* COLOR_WINDOWTEXT */ /* COLOR_CAPTIONTEXT */ HBRUSH hbrushActiveBorder; /* COLOR_ACTIVEBORDER */ HBRUSH hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */ diff --git a/include/win.h b/include/win.h index 973888037e1..6e5ec449aa0 100644 --- a/include/win.h +++ b/include/win.h @@ -22,7 +22,7 @@ #define ICONTITLE_CLASS_NAME "#32772" /* IconTitle */ #define POPUPMENU_CLASS_ATOM MAKEINTATOM(32768) /* PopupMenu */ -#define DESKTOP_CLASS_ATOM MAKEINTATOM(32769) /* Desktop */ +#define DESKTOP_CLASS_ATOM ((ATOM)32769) /* Desktop */ #define DIALOG_CLASS_ATOM MAKEINTATOM(32770) /* Dialog */ #define WINSWITCH_CLASS_ATOM MAKEINTATOM(32771) /* WinSwitch */ #define ICONTITLE_CLASS_ATOM MAKEINTATOM(32772) /* IconTitle */ @@ -35,13 +35,13 @@ typedef struct tagWND struct tagWND *owner; /* Window owner */ CLASS *class; /* Window class */ DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ - HWND hwndSelf; /* Handle of this window */ - HANDLE hInstance; /* Window hInstance (from CreateWindow) */ - RECT rectClient; /* Client area rel. to parent client area */ - RECT rectWindow; /* Whole window rel. to parent client area */ - RECT rectNormal; /* Window rect. when in normal state */ - POINT ptIconPos; /* Icon position */ - POINT ptMaxPos; /* Maximized window position */ + HWND16 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 */ + RECT16 rectNormal; /* Window rect. when in normal state */ + POINT16 ptIconPos; /* Icon position */ + POINT16 ptMaxPos; /* Maximized window position */ HGLOBAL hmemTaskQ; /* Task queue global memory handle */ HRGN hrgnUpdate; /* Update region */ HWND hwndLastActive;/* Last active popup hwnd */ @@ -57,7 +57,7 @@ typedef struct tagWND Window window; /* X window (only for top-level windows) */ HMENU hSysMenu; /* window's copy of System Menu */ HANDLE hProp; /* Handle of Properties List */ - WORD wExtra[1]; /* Window extra bytes */ + DWORD wExtra[1]; /* Window extra bytes */ } WND; /* WND flags values */ @@ -67,9 +67,10 @@ typedef struct tagWND #define WIN_RESTORE_MAX 0x0008 /* Maximize when restoring */ #define WIN_INTERNAL_PAINT 0x0010 /* Internal WM_PAINT message pending */ #define WIN_NO_REDRAW 0x0020 /* WM_SETREDRAW called for this window */ -#define WIN_GOT_SIZEMSG 0x0040 /* WM_SIZE has been sent to the window */ +#define WIN_NEED_SIZE 0x0040 /* Internal WM_SIZE is needed */ #define WIN_NCACTIVATED 0x0080 /* last WM_NCACTIVATE was positive */ #define WIN_MANAGED 0x0100 /* Window managed by the X wm */ +#define WIN_UNICODE 0x0200 /* Window procedure expects Unicode */ /* Window functions */ extern WND *WIN_FindWndPtr( HWND hwnd ); diff --git a/include/winbase.h b/include/winbase.h index 0eb05f59f5d..487eeeecc4c 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -119,7 +119,7 @@ int WinMain(HINSTANCE, HINSTANCE prev, char *cmd, int show); #define GMEM_FIXED 0x0000 #define GMEM_MOVEABLE 0x0002 -HACCEL LoadAcceleratorsA( HINSTANCE, const char *); +HACCEL32 LoadAcceleratorsA( HINSTANCE, const char *); #define FreeModule(hLibModule) FreeLibrary((hLibModule)) #define MakeProcInstance(lpProc,hInstance) (lpProc) #define FreeProcInstance(lpProc) (lpProc) diff --git a/include/windows.h b/include/windows.h index d48cd6b40d4..a07871096e1 100644 --- a/include/windows.h +++ b/include/windows.h @@ -10,20 +10,83 @@ #pragma pack(1) #endif -#ifndef WINELIB32 -#define MAKEPOINT(l) (*((POINT *)&(l))) -#endif -typedef struct { INT cx,cy; } SIZE, *LPSIZE; -typedef struct { INT x,y; } POINT, *PPOINT, *NPPOINT, *LPPOINT; -typedef struct { INT left, top, right, bottom; } RECT, *LPRECT; +/* The SIZE structure */ -#ifdef WINELIB32 -#define MAKEWPARAM(low, high) ((LONG)(((WORD)(low)) | \ - (((DWORD)((WORD)(high))) << 16))) +typedef struct +{ + INT16 cx; + INT16 cy; +} SIZE16, *LPSIZE16; + +typedef struct +{ + INT32 cx; + INT32 cy; +} SIZE32, *LPSIZE32; + +DECL_WINELIB_TYPE(SIZE); +DECL_WINELIB_TYPE(LPSIZE); + +#define CONV_SIZE16TO32(s16,s32) \ + ((s32)->cx = (INT32)(s16)->cx, (s32)->cy = (INT32)(s16)->cy) +#define CONV_SIZE32TO16(s32,s16) \ + ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy) + +/* The POINT structure */ + +typedef struct +{ + INT16 x; + INT16 y; +} POINT16, *LPPOINT16; + +typedef struct +{ + INT32 x; + INT32 y; +} POINT32, *LPPOINT32; + +DECL_WINELIB_TYPE(POINT); +DECL_WINELIB_TYPE(LPPOINT); + +#define CONV_POINT16TO32(p16,p32) \ + ((p32)->x = (INT32)(p16)->x, (p32)->y = (INT32)(p16)->y) +#define CONV_POINT32TO16(p32,p16) \ + ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y) + +#define MAKEPOINT16(l) (*((POINT16 *)&(l))) +#ifdef WINELIB16 +#define MAKEPOINT(l) MAKEPOINT16(l) #endif -#define MAKELPARAM(low, high) ((LONG)(((WORD)(low)) | \ - (((DWORD)((WORD)(high))) << 16))) +/* The RECT structure */ + +typedef struct +{ + INT16 left; + INT16 top; + INT16 right; + INT16 bottom; +} RECT16, *LPRECT16; + +typedef struct +{ + INT32 left; + INT32 top; + INT32 right; + INT32 bottom; +} RECT32, *LPRECT32; + +DECL_WINELIB_TYPE(RECT); +DECL_WINELIB_TYPE(LPRECT); + +#define CONV_RECT16TO32(r16,r32) \ + ((r32)->left = (INT32)(r16)->left, (r32)->top = (INT32)(r16)->top, \ + (r32)->right = (INT32)(r16)->right, (r32)->bottom = (INT32)(r16)->bottom) +#define CONV_RECT32TO16(r32,r16) \ + ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \ + (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom) + typedef struct tagKERNINGPAIR { WORD wFirst; @@ -31,34 +94,82 @@ typedef struct tagKERNINGPAIR { INT iKernAmount; } KERNINGPAIR, *LPKERNINGPAIR; -typedef struct { - HDC hdc; - BOOL fErase; - RECT rcPaint; - BOOL fRestore, fIncUpdate; - BYTE rgbReserved[16]; -} PAINTSTRUCT; +typedef struct +{ + HDC16 hdc; + BOOL16 fErase; + RECT16 rcPaint; + BOOL16 fRestore; + BOOL16 fIncUpdate; + BYTE rgbReserved[16]; +} PAINTSTRUCT16, *LPPAINTSTRUCT16; + +typedef struct +{ + HDC32 hdc; + BOOL32 fErase; + RECT32 rcPaint; + BOOL32 fRestore; + BOOL32 fIncUpdate; + BYTE rgbReserved[32]; +} PAINTSTRUCT32, *LPPAINTSTRUCT32; + +DECL_WINELIB_TYPE(PAINTSTRUCT); +DECL_WINELIB_TYPE(LPPAINTSTRUCT); -typedef PAINTSTRUCT *PPAINTSTRUCT; -typedef PAINTSTRUCT *NPPAINTSTRUCT; -typedef PAINTSTRUCT *LPPAINTSTRUCT; /* Windows */ -typedef struct { - LPVOID lpCreateParams; - HINSTANCE hInstance; - HMENU hMenu; - HWND hwndParent; - INT cy; - INT cx; - INT y; - INT x; - LONG style WINE_PACKED; - SEGPTR lpszName WINE_PACKED; - SEGPTR lpszClass WINE_PACKED; - DWORD dwExStyle WINE_PACKED; -} CREATESTRUCT, *LPCREATESTRUCT; +typedef struct +{ + LPVOID lpCreateParams; + HINSTANCE16 hInstance; + HMENU16 hMenu; + HWND16 hwndParent; + INT16 cy; + INT16 cx; + INT16 y; + INT16 x; + LONG style WINE_PACKED; + SEGPTR lpszName WINE_PACKED; + SEGPTR lpszClass WINE_PACKED; + DWORD dwExStyle WINE_PACKED; +} CREATESTRUCT16, *LPCREATESTRUCT16; + +typedef struct +{ + LPVOID lpCreateParams; + HINSTANCE32 hInstance; + HMENU32 hMenu; + HWND32 hwndParent; + INT32 cy; + INT32 cx; + INT32 y; + INT32 x; + LONG style; + LPCSTR lpszName; + LPCSTR lpszClass; + DWORD dwExStyle; +} CREATESTRUCT32A, *LPCREATESTRUCT32A; + +typedef struct +{ + LPVOID lpCreateParams; + HINSTANCE32 hInstance; + HMENU32 hMenu; + HWND32 hwndParent; + INT32 cy; + INT32 cx; + INT32 y; + INT32 x; + LONG style; + LPCWSTR lpszName; + LPCWSTR lpszClass; + DWORD dwExStyle; +} CREATESTRUCT32W, *LPCREATESTRUCT32W; + +DECL_WINELIB_TYPE_AW(CREATESTRUCT); +DECL_WINELIB_TYPE_AW(LPCREATESTRUCT); typedef struct { @@ -104,12 +215,23 @@ typedef struct /* WM_GETMINMAXINFO struct */ typedef struct { - POINT ptReserved; - POINT ptMaxSize; - POINT ptMaxPosition; - POINT ptMinTrackSize; - POINT ptMaxTrackSize; -} MINMAXINFO; + POINT16 ptReserved; + POINT16 ptMaxSize; + POINT16 ptMaxPosition; + POINT16 ptMinTrackSize; + POINT16 ptMaxTrackSize; +} MINMAXINFO16; + +typedef struct +{ + POINT32 ptReserved; + POINT32 ptMaxSize; + POINT32 ptMaxPosition; + POINT32 ptMinTrackSize; + POINT32 ptMaxTrackSize; +} MINMAXINFO32; + +DECL_WINELIB_TYPE(MINMAXINFO); /* RedrawWindow() flags */ #define RDW_INVALIDATE 0x0001 @@ -128,25 +250,51 @@ typedef struct /* WM_WINDOWPOSCHANGING/CHANGED struct */ typedef struct { - HWND hwnd; - HWND hwndInsertAfter; - INT x; - INT y; - INT cx; - INT cy; - UINT flags; -} WINDOWPOS; + HWND16 hwnd; + HWND16 hwndInsertAfter; + INT16 x; + INT16 y; + INT16 cx; + INT16 cy; + UINT16 flags; +} WINDOWPOS16; + +typedef struct +{ + HWND32 hwnd; + HWND32 hwndInsertAfter; + INT32 x; + INT32 y; + INT32 cx; + INT32 cy; + UINT32 flags; +} WINDOWPOS32; + +DECL_WINELIB_TYPE(WINDOWPOS); /* SetWindowPlacement() struct */ typedef struct { - UINT length; - UINT flags; - UINT showCmd; - POINT ptMinPosition WINE_PACKED; - POINT ptMaxPosition WINE_PACKED; - RECT rcNormalPosition WINE_PACKED; -} WINDOWPLACEMENT, *LPWINDOWPLACEMENT; + UINT16 length; + UINT16 flags; + UINT16 showCmd; + POINT16 ptMinPosition WINE_PACKED; + POINT16 ptMaxPosition WINE_PACKED; + RECT16 rcNormalPosition WINE_PACKED; +} WINDOWPLACEMENT16, *LPWINDOWPLACEMENT16; + +typedef struct +{ + UINT32 length; + UINT32 flags; + UINT32 showCmd; + POINT32 ptMinPosition WINE_PACKED; + POINT32 ptMaxPosition WINE_PACKED; + RECT32 rcNormalPosition WINE_PACKED; +} WINDOWPLACEMENT32, *LPWINDOWPLACEMENT32; + +DECL_WINELIB_TYPE(WINDOWPLACEMENT); +DECL_WINELIB_TYPE(LPWINDOWPLACEMENT); /* WINDOWPLACEMENT flags */ #define WPF_SETMINPOSITION 0x0001 @@ -166,9 +314,18 @@ typedef struct /* WM_NCCALCSIZE parameter structure */ typedef struct { - RECT rgrc[3]; + RECT16 rgrc[3]; SEGPTR lppos; -} NCCALCSIZE_PARAMS; +} NCCALCSIZE_PARAMS16, *LPNCCALCSIZE_PARAMS16; + +typedef struct +{ + RECT32 rgrc[3]; + WINDOWPOS32 *lppos; +} NCCALCSIZE_PARAMS32, *LPNCCALCSIZE_PARAMS32; + +DECL_WINELIB_TYPE(NCCALCSIZE_PARAMS); +DECL_WINELIB_TYPE(LPNCCALCSIZE_PARAMS); /* WM_NCCALCSIZE return flags */ #define WVR_ALIGNTOP 0x0010 @@ -275,8 +432,8 @@ typedef struct tagEVENTMSG /* Mouse hook structure */ typedef struct tagMOUSEHOOKSTRUCT { - POINT pt; - HWND hwnd; + POINT16 pt; + HWND16 hwnd; WORD wHitTestCode; DWORD dwExtraInfo; } MOUSEHOOKSTRUCT, *LPMOUSEHOOKSTRUCT; @@ -305,8 +462,8 @@ typedef struct tagHARDWAREHOOKSTRUCT /* CBT hook structures */ typedef struct tagCBT_CREATEWND { - CREATESTRUCT *lpcs; - HWND hwndInsertAfter; + CREATESTRUCT16 *lpcs; + HWND hwndInsertAfter; } CBT_CREATEWND, *LPCBT_CREATEWND; typedef struct tagCBTACTIVATESTRUCT @@ -375,12 +532,12 @@ typedef struct tagDEBUGHOOKINFO typedef struct tagMSG { - HWND hwnd; - UINT message; - WPARAM wParam; - LPARAM lParam WINE_PACKED; - DWORD time WINE_PACKED; - POINT pt WINE_PACKED; + HWND16 hwnd; + UINT16 message; + WPARAM16 wParam; + LPARAM lParam WINE_PACKED; + DWORD time WINE_PACKED; + POINT16 pt WINE_PACKED; } MSG, *LPMSG; #define MAKEINTATOM(i) ((SEGPTR)MAKELONG((i),0)) @@ -681,7 +838,7 @@ typedef struct tagLOGPALETTE typedef struct tagLOGPEN { WORD lopnStyle; - POINT lopnWidth WINE_PACKED; + POINT16 lopnWidth WINE_PACKED; COLORREF lopnColor WINE_PACKED; } LOGPEN, *PLOGPEN, *NPLOGPEN, *LPLOGPEN; @@ -979,7 +1136,7 @@ typedef struct typedef struct { - POINT ptHotSpot; + POINT16 ptHotSpot; WORD nWidth; WORD nHeight; WORD nWidthBytes; @@ -1398,7 +1555,7 @@ typedef struct tagDRAGINFO { WORD wFlags; HANDLE hList; HANDLE hOfStruct; - POINT pt WINE_PACKED; + POINT16 pt WINE_PACKED; LONG l WINE_PACKED; } DRAGINFO, *LPDRAGINFO; @@ -1853,12 +2010,33 @@ typedef struct tagDRAGINFO { #define BS_OWNERDRAW 0x0000000BL #define BS_LEFTTEXT 0x00000020L -/* Button control messages */ -#define BM_GETCHECK (WM_USER+0) -#define BM_SETCHECK (WM_USER+1) -#define BM_GETSTATE (WM_USER+2) -#define BM_SETSTATE (WM_USER+3) -#define BM_SETSTYLE (WM_USER+4) +/* Win16 button control messages */ +#define BM_GETCHECK16 (WM_USER+0) +#define BM_SETCHECK16 (WM_USER+1) +#define BM_GETSTATE16 (WM_USER+2) +#define BM_SETSTATE16 (WM_USER+3) +#define BM_SETSTYLE16 (WM_USER+4) +#define BM_CLICK16 WM_NULL /* Does not exist in Win16 */ +#define BM_GETIMAGE16 WM_NULL /* Does not exist in Win16 */ +#define BM_SETIMAGE16 WM_NULL /* Does not exist in Win16 */ +/* Win32 button control messages */ +#define BM_GETCHECK32 0x00f0 +#define BM_SETCHECK32 0x00f1 +#define BM_GETSTATE32 0x00f2 +#define BM_SETSTATE32 0x00f3 +#define BM_SETSTYLE32 0x00f4 +#define BM_CLICK32 0x00f5 +#define BM_GETIMAGE32 0x00f6 +#define BM_SETIMAGE32 0x00f7 +/* Winelib button control messages */ +#define BM_GETCHECK WINELIB_NAME(BM_GETCHECK) +#define BM_SETCHECK WINELIB_NAME(BM_SETCHECK) +#define BM_GETSTATE WINELIB_NAME(BM_GETSTATE) +#define BM_SETSTATE WINELIB_NAME(BM_SETSTATE) +#define BM_SETSTYLE WINELIB_NAME(BM_SETSTYLE) +#define BM_CLICK WINELIB_NAME(BM_CLICK) +#define BM_GETIMAGE WINELIB_NAME(BM_GETIMAGE) +#define BM_SETIMAGE WINELIB_NAME(BM_SETIMAGE) /* Button notification codes */ #define BN_CLICKED 0 @@ -2143,16 +2321,33 @@ typedef struct tagDRAGINFO { typedef struct { - UINT CtlType; - UINT CtlID; - UINT itemID; - UINT itemAction; - UINT itemState; - HWND hwndItem; - HDC hDC; - RECT rcItem WINE_PACKED; + UINT16 CtlType; + UINT16 CtlID; + UINT16 itemID; + UINT16 itemAction; + UINT16 itemState; + HWND16 hwndItem; + HDC16 hDC; + RECT16 rcItem WINE_PACKED; DWORD itemData WINE_PACKED; -} DRAWITEMSTRUCT, *PDRAWITEMSTRUCT, *LPDRAWITEMSTRUCT; +} DRAWITEMSTRUCT16, *PDRAWITEMSTRUCT16, *LPDRAWITEMSTRUCT16; + +typedef struct +{ + UINT32 CtlType; + UINT32 CtlID; + UINT32 itemID; + UINT32 itemAction; + UINT32 itemState; + HWND32 hwndItem; + HDC32 hDC; + RECT32 rcItem WINE_PACKED; + DWORD itemData WINE_PACKED; +} DRAWITEMSTRUCT32, *PDRAWITEMSTRUCT32, *LPDRAWITEMSTRUCT32; + +DECL_WINELIB_TYPE(DRAWITEMSTRUCT); +DECL_WINELIB_TYPE(PDRAWITEMSTRUCT); +DECL_WINELIB_TYPE(LPDRAWITEMSTRUCT); typedef struct { @@ -2600,17 +2795,16 @@ typedef struct { #pragma pack(4) #endif + INT AccessResource(HINSTANCE,HRSRC); ATOM AddAtom(SEGPTR); INT AddFontResource(LPCSTR); -BOOL AdjustWindowRect(LPRECT,DWORD,BOOL); -BOOL AdjustWindowRectEx(LPRECT,DWORD,BOOL,DWORD); WORD AllocCStoDSAlias(WORD); WORD AllocDStoCSAlias(WORD); HGLOBAL AllocResource(HINSTANCE,HRSRC,DWORD); WORD AllocSelector(WORD); WORD AllocSelectorArray(WORD); -BOOL AnimatePalette(HPALETTE,UINT,UINT,LPPALETTEENTRY); +BOOL AnimatePalette(HPALETTE16,UINT,UINT,LPPALETTEENTRY); LPSTR AnsiLower(LPSTR); UINT AnsiLowerBuff(LPSTR,UINT); SEGPTR AnsiNext(SEGPTR); @@ -2623,15 +2817,13 @@ BOOL AnyPopup(void); BOOL AppendMenu(HMENU,UINT,UINT,SEGPTR); BOOL Arc(HDC,INT,INT,INT,INT,INT,INT,INT,INT); UINT ArrangeIconicWindows(HWND); -HDWP BeginDeferWindowPos(INT); -HDC BeginPaint(HWND,LPPAINTSTRUCT); +HDWP16 BeginDeferWindowPos(INT); BOOL BitBlt(HDC,INT,INT,INT,INT,HDC,INT,INT,DWORD); BOOL BringWindowToTop(HWND); BOOL BuildCommDCB(LPCSTR,DCB*); void CalcChildScroll(HWND,WORD); BOOL CallMsgFilter(SEGPTR,INT); LRESULT CallNextHookEx(HHOOK,INT,WPARAM,LPARAM); -LRESULT CallWindowProc(WNDPROC,HWND,UINT,WPARAM,LPARAM); INT Catch(LPCATCHBUF); BOOL ChangeClipboardChain(HWND,HWND); BOOL ChangeMenu(HMENU,UINT,SEGPTR,UINT,UINT); @@ -2639,17 +2831,14 @@ WORD ChangeSelector(WORD,WORD); BOOL CheckDlgButton(HWND,INT,UINT); INT CheckMenuItem(HMENU,UINT,UINT); BOOL CheckRadioButton(HWND,UINT,UINT,UINT); -HWND ChildWindowFromPoint(HWND,POINT); BOOL Chord(HDC,INT,INT,INT,INT,INT,INT,INT,INT); int ClearCommBreak(int); -BOOL ClientToScreen(HWND,LPPOINT); -BOOL ClipCursor(LPRECT); BOOL CloseClipboard(void); int CloseComm(int); HMETAFILE CloseMetaFile(HDC); void CloseSound(void); BOOL CloseWindow(HWND); -INT CombineRgn(HRGN,HRGN,HRGN,INT); +INT16 CombineRgn(HRGN32,HRGN32,HRGN32,INT32); int ConvertRequest(HWND,LPKANJISTRUCT); #ifdef WINELIB32 HCURSOR CopyCursor(HCURSOR); /* Win32 */ @@ -2659,7 +2848,6 @@ HCURSOR CopyCursor(HINSTANCE,HCURSOR); /* Win16 */ HICON CopyIcon(HINSTANCE,HICON); /* Win16 */ #endif HMETAFILE CopyMetaFile(HMETAFILE,LPCSTR); -BOOL CopyRect(LPRECT,LPRECT); INT CountClipboardFormats(void); INT CountVoiceNotes(INT); HBITMAP CreateBitmap(INT,INT,UINT,UINT,LPVOID); @@ -2678,8 +2866,7 @@ HWND CreateDialogIndirect(HINSTANCE,SEGPTR,HWND,DLGPROC); HWND CreateDialogIndirectParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LPARAM); HWND CreateDialogParam(HINSTANCE,SEGPTR,HWND,DLGPROC,LPARAM); HBITMAP CreateDiscardableBitmap(HDC,INT,INT); -HRGN CreateEllipticRgn(INT,INT,INT,INT); -HRGN CreateEllipticRgnIndirect(LPRECT); +HRGN CreateEllipticRgn(INT32,INT32,INT32,INT32); HFONT CreateFont(INT,INT,INT,INT,INT,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR); HFONT CreateFontIndirect(const LOGFONT*); HBRUSH CreateHatchBrush(INT,COLORREF); @@ -2687,30 +2874,26 @@ HDC CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*); HICON CreateIcon(HINSTANCE,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*); HMENU CreateMenu(void); HDC CreateMetaFile(LPCSTR); -HPALETTE CreatePalette(const LOGPALETTE*); +HPALETTE16 CreatePalette(const LOGPALETTE*); HBRUSH CreatePatternBrush(HBITMAP); -HPEN CreatePen(INT,INT,COLORREF); -HPEN CreatePenIndirect(const LOGPEN*); -HRGN CreatePolyPolygonRgn(const POINT*,const INT16*,INT,INT); -HRGN CreatePolygonRgn(const POINT*,INT,INT); +HPEN16 CreatePen(INT,INT,COLORREF); +HPEN16 CreatePenIndirect(const LOGPEN*); HMENU CreatePopupMenu(void); -HRGN CreateRectRgn(INT,INT,INT,INT); -HRGN CreateRectRgnIndirect(const RECT*); -HRGN CreateRoundRectRgn(INT,INT,INT,INT,INT,INT); +HRGN CreateRectRgn(INT32,INT32,INT32,INT32); +HRGN CreateRoundRectRgn(INT32,INT32,INT32,INT32,INT32,INT32); HBRUSH CreateSolidBrush(COLORREF); -BOOL DPtoLP(HDC,LPPOINT,INT); void DebugBreak(void); LRESULT DefDlgProc(HWND,UINT,WPARAM,LPARAM); LRESULT DefFrameProc(HWND,HWND,UINT,WPARAM,LPARAM); DWORD DefHookProc(short,WORD,DWORD,HHOOK*); LRESULT DefMDIChildProc(HWND,UINT,WPARAM,LPARAM); LRESULT DefWindowProc(HWND,UINT,WPARAM,LPARAM); -HDWP DeferWindowPos(HDWP,HWND,HWND,INT,INT,INT,INT,UINT); +HDWP16 DeferWindowPos(HDWP16,HWND,HWND,INT,INT,INT,INT,UINT); ATOM DeleteAtom(ATOM); BOOL DeleteDC(HDC); BOOL DeleteMenu(HMENU,UINT,UINT); BOOL DeleteMetaFile(HMETAFILE); -BOOL DeleteObject(HGDIOBJ); +BOOL DeleteObject(HGDIOBJ16); BOOL DestroyCaret(void); BOOL DestroyCursor(HCURSOR); BOOL DestroyIcon(HICON); @@ -2727,12 +2910,10 @@ INT DlgDirList(HWND,SEGPTR,INT,INT,UINT); INT DlgDirListComboBox(HWND,SEGPTR,INT,INT,UINT); BOOL DlgDirSelect(HWND,LPSTR,INT); BOOL DlgDirSelectComboBox(HWND,LPSTR,INT); -BOOL DragDetect(HWND,POINT); +BOOL16 DragDetect(HWND16,POINT16); DWORD DragObject(HWND, HWND, WORD, HANDLE, WORD, HCURSOR); -void DrawFocusRect(HDC,const RECT*); BOOL DrawIcon(HDC,INT,INT,HICON); void DrawMenuBar(HWND); -INT DrawText(HDC,LPCSTR,INT,LPRECT,UINT); DWORD DumpIcon(SEGPTR,WORD*,SEGPTR*,SEGPTR*); BOOL Ellipse(HDC,INT,INT,INT,INT); BOOL EmptyClipboard(void); @@ -2740,9 +2921,8 @@ BOOL EnableHardwareInput(BOOL); BOOL EnableMenuItem(HMENU,UINT,UINT); BOOL EnableScrollBar(HWND,UINT,UINT); BOOL EnableWindow(HWND,BOOL); -BOOL EndDeferWindowPos(HDWP); +BOOL EndDeferWindowPos(HDWP16); BOOL EndDialog(HWND,INT); -BOOL EndPaint(HWND,const PAINTSTRUCT*); BOOL EnumChildWindows(HWND,WNDENUMPROC,LPARAM); UINT EnumClipboardFormats(UINT); INT EnumFontFamilies(HDC,LPCSTR,FONTENUMPROC,LPARAM); @@ -2752,33 +2932,25 @@ INT EnumObjects(HDC,INT,GOBJENUMPROC,LPARAM); INT EnumProps(HWND,PROPENUMPROC); BOOL EnumTaskWindows(HTASK,WNDENUMPROC,LPARAM); BOOL EnumWindows(WNDENUMPROC,LPARAM); -BOOL EqualRect(const RECT*,const RECT*); -BOOL EqualRgn(HRGN,HRGN); +BOOL EqualRgn(HRGN32,HRGN32); INT Escape(HDC,INT,INT,LPCSTR,LPVOID); LONG EscapeCommFunction(int,int); int ExcludeClipRect(HDC,short,short,short,short); -int ExcludeUpdateRgn(HDC,HWND); int ExcludeVisRect(HDC,short,short,short,short); BOOL ExitWindows(DWORD,WORD); BOOL ExtFloodFill(HDC,INT,INT,COLORREF,WORD); -BOOL ExtTextOut(HDC,short,short,WORD,LPRECT,LPSTR,WORD,LPINT16); HICON ExtractIcon(HINSTANCE,LPCSTR,WORD); WORD FarGetOwner(HANDLE); void FarSetOwner(HANDLE,HANDLE); void FatalAppExit(UINT,LPCSTR); void FatalExit(int); -int FillRect(HDC,LPRECT,HBRUSH); BOOL FillRgn(HDC,HRGN,HBRUSH); -void FillWindow(HWND,HWND,HDC,HBRUSH); ATOM FindAtom(SEGPTR); HINSTANCE FindExecutable(LPCSTR,LPCSTR,LPSTR); HRSRC FindResource(HINSTANCE,SEGPTR,SEGPTR); -HWND FindWindow(SEGPTR,LPSTR); -HWND FindWindowEx(HWND,HWND,SEGPTR,LPSTR); BOOL FlashWindow(HWND,BOOL); BOOL FloodFill(HDC,INT,INT,COLORREF); int FlushComm(int,int); -int FrameRect(HDC,LPRECT,HBRUSH); BOOL FrameRgn(HDC,HRGN,HBRUSH,int,int); void FreeLibrary(HANDLE); BOOL FreeModule(HANDLE); @@ -2786,28 +2958,21 @@ void FreeProcInstance(FARPROC); BOOL FreeResource(HGLOBAL); WORD FreeSelector(WORD); UINT GDIRealizePalette(HDC); -HPALETTE GDISelectPalette(HDC,HPALETTE); +HPALETTE16 GDISelectPalette(HDC,HPALETTE16); HWND GetActiveWindow(void); DWORD GetAspectRatioFilter(HDC); int GetAsyncKeyState(int); HANDLE GetAtomHandle(ATOM); WORD GetAtomName(ATOM,LPSTR,short); LONG GetBitmapBits(HBITMAP,LONG,LPSTR); -DWORD GetBitmapDimension(HBITMAP); -BOOL GetBitmapDimensionEx(HBITMAP,LPSIZE); COLORREF GetBkColor(HDC); WORD GetBkMode(HDC); DWORD GetBrushOrg(HDC); -BOOL GetBrushOrgEx(HDC,LPPOINT); HWND GetCapture(void); WORD GetCaretBlinkTime(void); -void GetCaretPos(LPPOINT); BOOL GetCharABCWidths(HDC,UINT,UINT,LPABC); BOOL GetCharWidth(HDC,WORD,WORD,LPINT16); -WORD GetClassWord(HWND,short); -void GetClientRect(HWND,LPRECT); -int GetClipBox(HDC,LPRECT); -void GetClipCursor(LPRECT); +WORD GetClassWord(HWND,INT32); HRGN GetClipRgn(HDC); HANDLE GetClipboardData(WORD); int GetClipboardFormatName(WORD,LPSTR,short); @@ -2819,13 +2984,12 @@ int GetCommError(int,COMSTAT*); UINT GetCommEventMask(int,int); int GetCommState(int,DCB*); HBRUSH GetControlBrush(HWND,HDC,WORD); +UINT32 GetCurrentDirectory(UINT32,LPSTR); HANDLE GetCurrentPDB(void); DWORD GetCurrentPosition(HDC); -BOOL GetCurrentPositionEx(HDC,LPPOINT); HANDLE GetCurrentTask(void); DWORD GetCurrentTime(void); HCURSOR GetCursor(void); -void GetCursorPos(LPPOINT); HDC GetDC(HWND); HDC GetDCEx(HWND,HRGN,DWORD); DWORD GetDCOrg(HDC); @@ -2849,7 +3013,6 @@ DWORD GetFreeSpace(UINT16); DWORD GetHeapSpaces(HMODULE); BOOL GetInputState(void); int GetInstanceData(HANDLE,WORD,int); -WORD GetInternalWindowPos(HWND,LPRECT,LPPOINT); int GetKBCodePage(void); int GetKerningPairs(HDC,int,LPKERNINGPAIR); int GetKeyNameText(LONG,LPSTR,int); @@ -2876,14 +3039,14 @@ HANDLE GetModuleHandle(LPCSTR); int GetModuleUsage(HANDLE); FARPROC GetMouseEventProc(void); DWORD GetNearestColor(HDC,DWORD); -WORD GetNearestPaletteIndex(HPALETTE,DWORD); +WORD GetNearestPaletteIndex(HPALETTE16,DWORD); HWND GetNextDlgGroupItem(HWND,HWND,BOOL); HWND GetNextDlgTabItem(HWND,HWND,BOOL); HWND GetNextWindow(HWND,WORD); WORD GetNumTasks(void); int GetObject(HANDLE,int,LPSTR); HWND GetOpenClipboardWindow(void); -WORD GetPaletteEntries(HPALETTE,WORD,WORD,LPPALETTEENTRY); +WORD GetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY); HWND GetParent(HWND); DWORD GetPixel(HDC,short,short); WORD GetPolyFillMode(HDC); @@ -2898,7 +3061,6 @@ DWORD GetQueueStatus(UINT); BOOL GetRasterizerCaps(LPRASTERIZER_STATUS,UINT); WORD GetROP2(HDC); WORD GetRelAbs(HDC); -int GetRgnBox(HRGN,LPRECT); int GetScrollPos(HWND,int); void GetScrollRange(HWND,int,LPINT16,LPINT16); DWORD GetSelectorBase(WORD); @@ -2923,44 +3085,32 @@ WORD GetTextAlign(HDC); short GetTextCharacterExtra(HDC); COLORREF GetTextColor(HDC); DWORD GetTextExtent(HDC,LPCSTR,short); -BOOL GetTextExtentPoint(HDC,LPCSTR,short,LPSIZE); INT GetTextFace(HDC,INT,LPSTR); BOOL GetTextMetrics(HDC,LPTEXTMETRIC); LPINT16 GetThresholdEvent(void); int GetThresholdStatus(void); DWORD GetTickCount(void); HWND GetTopWindow(HWND); -BOOL GetUpdateRect(HWND,LPRECT,BOOL); -int GetUpdateRgn(HWND,HRGN,BOOL); LONG GetVersion(void); DWORD GetViewportExt(HDC); -BOOL GetViewportExtEx(HDC,LPPOINT); DWORD GetViewportOrg(HDC); -BOOL GetViewportOrgEx(HDC,LPPOINT); BOOL GetWinDebugInfo(LPWINDEBUGINFO,UINT); LONG GetWinFlags(void); HWND GetWindow(HWND,WORD); HDC GetWindowDC(HWND); DWORD GetWindowExt(HDC); -BOOL GetWindowExtEx(HDC,LPPOINT); LONG GetWindowLong(HWND,short); DWORD GetWindowOrg(HDC); -BOOL GetWindowOrgEx(HDC,LPPOINT); -BOOL GetWindowPlacement(HWND,LPWINDOWPLACEMENT); -void GetWindowRect(HWND,LPRECT); HANDLE GetWindowTask(HWND); int GetWindowText(HWND,LPSTR,int); int GetWindowTextLength(HWND); WORD GetWindowWord(HWND,short); UINT GetWindowsDirectory(LPSTR,UINT); -ATOM GlobalAddAtom(SEGPTR); DWORD GlobalDOSAlloc(DWORD); WORD GlobalDOSFree(WORD); ATOM GlobalDeleteAtom(ATOM); -ATOM GlobalFindAtom(SEGPTR); void GlobalFix(HGLOBAL16); void GlobalFreeAll(HGLOBAL16); -WORD GlobalGetAtomName(ATOM,LPSTR,short); HGLOBAL16 GlobalLRUNewest(HGLOBAL16); HGLOBAL16 GlobalLRUOldest(HGLOBAL16); void GlobalNotify(FARPROC); @@ -2973,16 +3123,12 @@ BOOL GrayString(HDC,HBRUSH,FARPROC,LPARAM,INT,INT,INT,INT,INT); void HideCaret(HWND); BOOL HiliteMenuItem(HWND,HMENU,UINT,UINT); BOOL InSendMessage(void); -void InflateRect(LPRECT,short,short); WORD InitAtomTable(WORD); HRGN InquireVisRgn(HDC); BOOL InsertMenu(HMENU,UINT,UINT,UINT,SEGPTR); int IntersectClipRect(HDC,short,short,short,short); -BOOL IntersectRect(LPRECT,LPRECT,LPRECT); int IntersectVisRect(HDC,short,short,short,short); -void InvalidateRect(HWND,LPRECT,BOOL); -void InvalidateRgn(HWND,HRGN,BOOL); -void InvertRect(HDC,LPRECT); +void InvalidateRgn(HWND32,HRGN32,BOOL32); BOOL InvertRgn(HDC,HRGN); BOOL IsBadCodePtr(SEGPTR); BOOL IsBadHugeReadPtr(SEGPTR,DWORD); @@ -3001,16 +3147,15 @@ WORD IsDlgButtonChecked(HWND,WORD); BOOL IsGDIObject(HANDLE); BOOL IsIconic(HWND); BOOL IsMenu(HMENU); -BOOL IsRectEmpty(LPRECT); BOOL IsTask(HTASK); HTASK IsTaskLocked(void); BOOL IsWindow(HWND); BOOL IsWindowEnabled(HWND); +BOOL IsWindowUnicode(HWND); BOOL IsWindowVisible(HWND); BOOL IsZoomed(HWND); BOOL KillSystemTimer(HWND,WORD); BOOL KillTimer(HWND,WORD); -BOOL LPtoDP(HDC,LPPOINT,int); void LimitEmsPages(DWORD); void LineDDA(short,short,short,short,FARPROC,long); BOOL LineTo(HDC,short,short); @@ -3030,41 +3175,28 @@ LPVOID LockResource(HGLOBAL); HGLOBAL LockSegment(HGLOBAL); HMENU LookupMenuHandle(HMENU,INT); FARPROC MakeProcInstance(FARPROC,HANDLE); -void MapDialogRect(HWND,LPRECT); WORD MapVirtualKey(WORD,WORD); -void MapWindowPoints(HWND,HWND,LPPOINT,WORD); void MessageBeep(WORD); int MessageBox(HWND,LPCSTR,LPCSTR,WORD); BOOL ModifyMenu(HMENU,UINT,UINT,UINT,SEGPTR); DWORD MoveTo(HDC,short,short); -BOOL MoveToEx(HDC,short,short,LPPOINT); BOOL MoveWindow(HWND,short,short,short,short,BOOL); DWORD OemKeyScan(WORD); BOOL OemToAnsi(LPSTR,LPSTR); void OemToAnsiBuff(LPSTR,LPSTR,INT); int OffsetClipRgn(HDC,short,short); -void OffsetRect(LPRECT,short,short); -int OffsetRgn(HRGN,short,short); -DWORD OffsetViewportOrg(HDC,short,short); -BOOL OffsetViewportOrgEx(HDC,short,short,LPPOINT); -DWORD OffsetWindowOrg(HDC,short,short); -BOOL OffsetWindowOrgEx(HDC,short,short,LPPOINT); BOOL OpenClipboard(HWND); int OpenComm(LPCSTR,UINT,UINT); HFILE OpenFile(LPCSTR,OFSTRUCT*,UINT); BOOL OpenIcon(HWND); int OpenSound(void); void OutputDebugString(LPCSTR); -void PaintRect(HWND,HWND,HDC,HBRUSH,LPRECT); BOOL PaintRgn(HDC,HRGN); BOOL PatBlt(HDC,short,short,short,short,DWORD); BOOL PeekMessage(LPMSG,HWND,WORD,WORD,WORD); BOOL Pie(HDC,INT,INT,INT,INT,INT,INT,INT,INT); BOOL PlayMetaFile(HDC,HANDLE); void PlayMetaFileRecord(HDC,LPHANDLETABLE,LPMETARECORD,WORD); -BOOL PolyPolygon(HDC,LPPOINT,LPINT16,WORD); -BOOL Polygon(HDC,LPPOINT,int); -BOOL Polyline(HDC,LPPOINT,int); BOOL PostAppMessage(HANDLE,WORD,WORD,LONG); BOOL PostMessage(HWND,WORD,WORD,LONG); void PostQuitMessage(INT); @@ -3077,67 +3209,13 @@ void ProfSampRate(int,int); void ProfSetup(int,int); void ProfStart(void); void ProfStop(void); -BOOL PtInRect(LPRECT,POINT); -BOOL PtInRegion(HRGN,short,short); +BOOL PtInRegion(HRGN32,INT32,INT32); BOOL PtVisible(HDC,short,short); int ReadComm(int,LPSTR,int); WORD RealizeDefaultPalette(HDC); UINT RealizePalette(HDC); -BOOL RectInRegion(HRGN,LPRECT); -BOOL RectVisible(HDC,LPRECT); BOOL Rectangle(HDC,INT,INT,INT,INT); -BOOL RedrawWindow(HWND,LPRECT,HRGN,UINT); -DWORD RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,LPHKEY); -DWORD RegOpenKeyW(HKEY,LPCWSTR,LPHKEY); -DWORD RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,LPHKEY); -DWORD RegOpenKeyA(HKEY,LPCSTR,LPHKEY); -DWORD RegOpenKey(HKEY,LPCSTR,LPHKEY); -DWORD RegCreateKeyExW(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM, - LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD); -DWORD RegCreateKeyW(HKEY,LPCWSTR,LPHKEY); -DWORD RegCreateKeyExA(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM, - LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD); -DWORD RegCreateKeyA(HKEY,LPCSTR,LPHKEY); -DWORD RegCreateKey(HKEY,LPCSTR,LPHKEY); -DWORD RegQueryValueExW(HKEY,LPWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); -DWORD RegQueryValueW(HKEY,LPWSTR,LPWSTR,LPDWORD); -DWORD RegQueryValueExA(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); -DWORD RegQueryValueEx(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); -DWORD RegQueryValueA(HKEY,LPSTR,LPSTR,LPDWORD); -DWORD RegQueryValue(HKEY,LPSTR,LPSTR,LPDWORD); -DWORD RegSetValueExW(HKEY,LPWSTR,DWORD,DWORD,LPBYTE,DWORD); -DWORD RegSetValueExA(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD); -DWORD RegSetValueEx(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD); -DWORD RegSetValueW(HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD); -DWORD RegSetValueA(HKEY,LPCSTR,DWORD,LPCSTR,DWORD); -DWORD RegSetValue(HKEY,LPCSTR,DWORD,LPCSTR,DWORD); -DWORD RegEnumKeyExW(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD, - FILETIME*); -DWORD RegEnumKeyW(HKEY,DWORD,LPWSTR,DWORD); -DWORD RegEnumKeyExA(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD, - FILETIME*); -DWORD RegEnumKeyA(HKEY,DWORD,LPSTR,DWORD); -DWORD RegEnumKey(HKEY,DWORD,LPSTR,DWORD); -DWORD RegEnumValueW(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE, - LPDWORD); -DWORD RegEnumValueA(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE, - LPDWORD); -DWORD RegEnumValue(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE, - LPDWORD); -DWORD RegCloseKey(HKEY); -DWORD RegDeleteKeyW(HKEY,LPWSTR); -DWORD RegDeleteKeyA(HKEY,LPCSTR); -DWORD RegDeleteKey(HKEY,LPCSTR); -DWORD RegDeleteValueW(HKEY,LPWSTR); -DWORD RegDeleteValueA(HKEY,LPSTR); -DWORD RegDeleteValue(HKEY,LPSTR); -DWORD RegFlushKey(HKEY); -DWORD RegQueryInfoKeyW(HKEY,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD, - LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*); -DWORD RegQueryInfoKeyA(HKEY,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD, - LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*); WORD RegisterClipboardFormat(LPCSTR); -WORD RegisterWindowMessage(SEGPTR); void ReleaseCapture(void); int ReleaseDC(HWND,HDC); BOOL RemoveFontResource(LPSTR); @@ -3145,39 +3223,32 @@ BOOL RemoveMenu(HMENU,UINT,UINT); HANDLE RemoveProp(HWND,SEGPTR); void ReplyMessage(LONG); HDC ResetDC(HDC,LPVOID); -BOOL ResizePalette(HPALETTE,UINT); +BOOL ResizePalette(HPALETTE16,UINT); BOOL RestoreDC(HDC,short); int RestoreVisRgn(HDC); BOOL RoundRect(HDC,INT,INT,INT,INT,INT,INT); int SaveDC(HDC); HRGN SaveVisRgn(HDC); -DWORD ScaleViewportExt(HDC,short,short,short,short); -BOOL ScaleViewportExtEx(HDC,short,short,short,short,LPSIZE); -DWORD ScaleWindowExt(HDC,short,short,short,short); -BOOL ScaleWindowExtEx(HDC,short,short,short,short,LPSIZE); -void ScreenToClient(HWND,LPPOINT); void ScrollChildren(HWND,UINT,WPARAM,LPARAM); -BOOL ScrollDC(HDC,short,short,LPRECT,LPRECT,HRGN,LPRECT); -void ScrollWindow(HWND,short,short,LPRECT,LPRECT); -int ScrollWindowEx(HWND,short,short,LPRECT,LPRECT,HRGN,LPRECT,WORD); +BOOL ScrollDC(HDC,short,short,LPRECT16,LPRECT16,HRGN,LPRECT16); +void ScrollWindow(HWND,short,short,LPRECT16,LPRECT16); +int ScrollWindowEx(HWND,short,short,LPRECT16,LPRECT16,HRGN,LPRECT16,WORD); int SelectClipRgn(HDC,HRGN); HANDLE SelectObject(HDC,HANDLE); -HPALETTE SelectPalette(HDC,HPALETTE,BOOL); +HPALETTE16 SelectPalette(HDC,HPALETTE16,BOOL); int SelectVisRgn(HDC,HRGN); WORD SelectorAccessRights(WORD,WORD,WORD); LONG SendDlgItemMessage(HWND,INT,UINT,WPARAM,LPARAM); LRESULT SendMessage(HWND,UINT,WPARAM,LPARAM); HWND SetActiveWindow(HWND); LONG SetBitmapBits(HBITMAP,LONG,LPSTR); -DWORD SetBitmapDimension(HBITMAP,short,short); -BOOL SetBitmapDimensionEx(HBITMAP,short,short,LPSIZE); DWORD SetBkColor(HDC,COLORREF); WORD SetBkMode(HDC,WORD); DWORD SetBrushOrg(HDC,short,short); HWND SetCapture(HWND); void SetCaretBlinkTime(WORD); void SetCaretPos(short,short); -WORD SetClassWord(HWND,short,WORD); +WORD SetClassWord(HWND,INT32,WORD); HANDLE SetClipboardData(WORD,HANDLE); HWND SetClipboardViewer(HWND); int SetCommBreak(int); @@ -3185,6 +3256,7 @@ UINT* SetCommEventMask(int,UINT); int SetCommState(DCB*); void SetConvertHook(BOOL); BOOL SetConvertParams(int,int); +BOOL32 SetCurrentDirectory(LPCSTR); HCURSOR SetCursor(HCURSOR); void SetCursorPos(short,short); void SetDCState(HDC,HDC); @@ -3199,7 +3271,6 @@ int SetEnvironment(LPSTR,LPSTR,WORD); UINT SetErrorMode(UINT); HWND SetFocus(HWND); WORD SetHandleCount(WORD); -void SetInternalWindowPos(HWND,WORD,LPRECT,LPPOINT); void SetKeyboardState(BYTE*); WORD SetMapMode(HDC,WORD); DWORD SetMapperFlags(HDC,DWORD); @@ -3207,15 +3278,13 @@ BOOL SetMenu(HWND,HMENU); BOOL SetMenuItemBitmaps(HMENU,UINT,UINT,HBITMAP,HBITMAP); BOOL SetMessageQueue(int); HANDLE SetMetaFileBits(HANDLE); -WORD SetPaletteEntries(HPALETTE,WORD,WORD,LPPALETTEENTRY); +WORD SetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY); HWND SetParent(HWND,HWND); COLORREF SetPixel(HDC,short,short,COLORREF); WORD SetPolyFillMode(HDC,WORD); BOOL SetProp(HWND,SEGPTR,HANDLE); WORD SetROP2(HDC,WORD); -void SetRect(LPRECT,short,short,short,short); -void SetRectEmpty(LPRECT); -void SetRectRgn(HRGN,short,short,short,short); +void SetRectRgn(HRGN32,INT32,INT32,INT32,INT32); WORD SetRelAbs(HDC,WORD); FARPROC SetResourceHandler(HANDLE,LPSTR,FARPROC); int SetScrollPos(HWND,int,int,BOOL); @@ -3235,10 +3304,6 @@ short SetTextCharacterExtra(HDC,short); DWORD SetTextColor(HDC,DWORD); short SetTextJustification(HDC,short,short); WORD SetTimer(HWND,WORD,WORD,FARPROC); -DWORD SetViewportExt(HDC,short,short); -BOOL SetViewportExtEx(HDC,short,short,LPSIZE); -DWORD SetViewportOrg(HDC,short,short); -BOOL SetViewportOrgEx(HDC,short,short,LPPOINT); int SetVoiceAccent(int,int,int,int,int); int SetVoiceEnvelope(int,int,int); int SetVoiceNote(int,int,int,int); @@ -3246,12 +3311,7 @@ int SetVoiceQueueSize(int,int); int SetVoiceSound(int,LONG,int); int SetVoiceThreshold(int,int); BOOL SetWinDebugInfo(LPWINDEBUGINFO); -DWORD SetWindowExt(HDC,short,short); -BOOL SetWindowExtEx(HDC,short,short,LPSIZE); LONG SetWindowLong(HWND,short,LONG); -DWORD SetWindowOrg(HDC,short,short); -BOOL SetWindowOrgEx(HDC,short,short,LPPOINT); -BOOL SetWindowPlacement(HWND,LPWINDOWPLACEMENT); BOOL SetWindowPos(HWND,HWND,INT,INT,INT,INT,WORD); void SetWindowText(HWND,LPCSTR); WORD SetWindowWord(HWND,short,WORD); @@ -3269,7 +3329,6 @@ int StartSound(void); int StopSound(void); BOOL StretchBlt(HDC,short,short,short,short,HDC,short,short,short,short,DWORD); int StretchDIBits(HDC,WORD,WORD,WORD,WORD,WORD,WORD,WORD,WORD,LPSTR,LPBITMAPINFO,WORD,DWORD); -BOOL SubtractRect(LPRECT,LPRECT,LPRECT); BOOL SwapMouseButton(BOOL); void SwapRecording(WORD); void SwitchStackBack(void); @@ -3277,10 +3336,8 @@ void SwitchStackTo(WORD,WORD,WORD); int SyncAllVoices(void); BOOL SystemParametersInfo(UINT,UINT,LPVOID,UINT); LONG TabbedTextOut(HDC,short,short,LPSTR,short,short,LPINT16,short); -BOOL TextOut(HDC,short,short,LPSTR,short); int Throw(LPCATCHBUF,int); int ToAscii(WORD,WORD,LPSTR,LPVOID,WORD); -BOOL TrackPopupMenu(HMENU,UINT,short,short,short,HWND,LPRECT); int TranslateAccelerator(HWND,HANDLE,LPMSG); BOOL TranslateMDISysAccel(HWND,LPMSG); BOOL TranslateMessage(LPMSG); @@ -3288,15 +3345,13 @@ int TransmitCommChar(int,char); int UngetCommChar(int,char); BOOL UnhookWindowsHook(short,FARPROC); BOOL UnhookWindowsHookEx(HHOOK); -BOOL UnionRect(LPRECT,LPRECT,LPRECT); void UnlockSegment(HGLOBAL); BOOL UnrealizeObject(HBRUSH); int UpdateColors(HDC); -void UpdateWindow(HWND); +void UpdateWindow(HWND32); void ValidateCodeSegments(void); LPSTR ValidateFreeSpaces(void); -void ValidateRect(HWND,LPRECT); -void ValidateRgn(HWND,HRGN); +void ValidateRgn(HWND32,HRGN32); WORD VkKeyScan(WORD); SEGPTR WIN16_GlobalLock16(HGLOBAL16); SEGPTR WIN16_LockResource(HANDLE); @@ -3305,7 +3360,6 @@ void WaitMessage(void); int WaitSoundState(int); HANDLE WinExec(LPSTR,WORD); BOOL WinHelp(HWND,LPSTR,WORD,DWORD); -HWND WindowFromPoint(POINT); int WriteComm(int,LPSTR,int); void WriteOutProfiles(void); BOOL WritePrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPCSTR); @@ -3330,10 +3384,66 @@ INT lstrlen(LPCSTR); int wsprintf(LPSTR,LPSTR,...); int wvsprintf(LPSTR,LPCSTR,LPCSTR); +/* Declarations for functions that are the same in Win16 and Win32 */ -/* Declarations for functions that exist both in Win16 and Win32 */ +INT16 ExcludeUpdateRgn(HDC32,HWND32); +void FillWindow(HWND16,HWND16,HDC16,HBRUSH16); +DWORD GetBitmapDimension(HBITMAP16); +INT16 GetUpdateRgn(HWND32,HRGN32,BOOL32); +INT16 OffsetRgn(HRGN32,INT32,INT32); +DWORD OffsetViewportOrg(HDC16,INT16,INT16); +DWORD OffsetWindowOrg(HDC16,INT16,INT16); +void PaintRect(HWND16,HWND16,HDC16,HBRUSH16,const RECT16*); +DWORD RegCloseKey(HKEY); +DWORD RegFlushKey(HKEY); +DWORD ScaleViewportExt(HDC16,INT16,INT16,INT16,INT16); +DWORD ScaleWindowExt(HDC16,INT16,INT16,INT16,INT16); +DWORD SetBitmapDimension(HBITMAP16,INT16,INT16); +DWORD SetViewportExt(HDC16,INT16,INT16); +DWORD SetViewportOrg(HDC16,INT16,INT16); +DWORD SetWindowExt(HDC16,INT16,INT16); +DWORD SetWindowOrg(HDC16,INT16,INT16); -HWND CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND,HMENU,HINSTANCE,SEGPTR); +/* Declarations for functions that change between Win16 and Win32 */ + +BOOL16 AdjustWindowRect16(LPRECT16,DWORD,BOOL16); +BOOL32 AdjustWindowRect32(LPRECT32,DWORD,BOOL32); +#define AdjustWindowRect WINELIB_NAME(AdjustWindowRect) +BOOL16 AdjustWindowRectEx16(LPRECT16,DWORD,BOOL16,DWORD); +BOOL32 AdjustWindowRectEx32(LPRECT32,DWORD,BOOL32,DWORD); +#define AdjustWindowRectEx WINELIB_NAME(AdjustWindowRectEx) +HDC16 BeginPaint16(HWND16,LPPAINTSTRUCT16); +HDC32 BeginPaint32(HWND32,LPPAINTSTRUCT32); +#define BeginPaint WINELIB_NAME(BeginPaint) +LRESULT CallWindowProc16(WNDPROC16,HWND16,UINT16,WPARAM16,LPARAM); +LRESULT CallWindowProc32A(WNDPROC32,HWND32,UINT32,WPARAM32,LPARAM); +LRESULT CallWindowProc32W(WNDPROC32,HWND32,UINT32,WPARAM32,LPARAM); +#define CallWindowProc WINELIB_NAME_AW(CallWindowProc) +HWND16 ChildWindowFromPoint16(HWND16,POINT16); +HWND32 ChildWindowFromPoint32(HWND32,POINT32); +#define ChildWindowFromPoint WINELIB_NAME(ChildWindowFromPoint) +BOOL16 ClientToScreen16(HWND16,LPPOINT16); +BOOL32 ClientToScreen32(HWND32,LPPOINT32); +#define ClientToScreen WINELIB_NAME(ClientToScreen) +BOOL16 ClipCursor16(const RECT16*); +BOOL32 ClipCursor32(const RECT32*); +#define ClipCursor WINELIB_NAME(ClipCursor) +BOOL16 CopyRect16(RECT16*,const RECT16*); +BOOL32 CopyRect32(RECT32*,const RECT32*); +#define CopyRect WINELIB_NAME(CopyRect) +HRGN16 CreateEllipticRgnIndirect16(const RECT16 *); +HRGN32 CreateEllipticRgnIndirect32(const RECT32 *); +#define CreateEllipticRgnIndirect WINELIB_NAME(CreateEllipticRgnIndirect) +HRGN16 CreatePolyPolygonRgn16(const POINT16*,const INT16*,INT16,INT16); +HRGN32 CreatePolyPolygonRgn32(const POINT32*,const INT32*,INT32,INT32); +#define CreatePolyPolygonRgn WINELIB_NAME(CreatePolyPolygonRgn) +HRGN16 CreatePolygonRgn16(const POINT16*,INT16,INT16); +HRGN32 CreatePolygonRgn32(const POINT32*,INT32,INT32); +#define CreatePolygonRgn WINELIB_NAME(CreatePolygonRgn) +HRGN16 CreateRectRgnIndirect16(const RECT16*); +HRGN32 CreateRectRgnIndirect32(const RECT32*); +#define CreateRectRgnIndirect WINELIB_NAME(CreateRectRgnIndirect) +HWND16 CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,SEGPTR); #define CreateWindow32A(className,titleName,style,x,y,width,height,\ parent,menu,instance,param) \ CreateWindowEx32A(0,className,titleName,style,x,y,width,height,\ @@ -3343,10 +3453,119 @@ HWND CreateWindow16(SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND,HMENU CreateWindowEx32W(0,className,titleName,style,x,y,width,height,\ parent,menu,instance,param) #define CreateWindow WINELIB_NAME_AW(CreateWindow) -HWND CreateWindowEx16(DWORD,SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND,HMENU,HINSTANCE,SEGPTR); +HWND16 CreateWindowEx16(DWORD,SEGPTR,SEGPTR,DWORD,INT16,INT16,INT16,INT16,HWND16,HMENU16,HINSTANCE16,SEGPTR); HWND32 CreateWindowEx32A(DWORD,LPCSTR,LPCSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID); HWND32 CreateWindowEx32W(DWORD,LPCWSTR,LPCWSTR,DWORD,INT32,INT32,INT32,INT32,HWND32,HMENU32,HINSTANCE32,LPVOID); #define CreateWindowEx WINELIB_NAME_AW(CreateWindowEx) +BOOL16 DPtoLP16(HDC16,LPPOINT16,INT16); +BOOL32 DPtoLP32(HDC32,LPPOINT32,INT32); +#define DPtoLP WINELIB_NAME(DPtoLP) +void DrawFocusRect16(HDC16,const RECT16*); +void DrawFocusRect32(HDC32,const RECT32*); +#define DrawFocusRect WINELIB_NAME(DrawFocusRect) +INT16 DrawText16(HDC16,LPCSTR,INT16,LPRECT16,UINT16); +INT32 DrawText32A(HDC32,LPCSTR,INT32,LPRECT32,UINT32); +INT32 DrawText32W(HDC32,LPCWSTR,INT32,LPRECT32,UINT32); +#define DrawText WINELIB_NAME_AW(DrawText) +BOOL16 EndPaint16(HWND16,const PAINTSTRUCT16*); +BOOL32 EndPaint32(HWND32,const PAINTSTRUCT32*); +#define EndPaint WINELIB_NAME(EndPaint) +BOOL16 EqualRect16(const RECT16*,const RECT16*); +BOOL32 EqualRect32(const RECT32*,const RECT32*); +#define EqualRect WINELIB_NAME(EqualRect) +BOOL16 ExtTextOut16(HDC16,INT16,INT16,UINT16,const RECT16*,LPCSTR,UINT16,const INT16*); +BOOL32 ExtTextOut32A(HDC32,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*); +BOOL32 ExtTextOut32W(HDC32,INT32,INT32,UINT32,const RECT32*,LPCWSTR,UINT32,const INT32*); +#define ExtTextOut WINELIB_NAME_AW(ExtTextOut) +INT16 FillRect16(HDC16,const RECT16*,HBRUSH16); +INT32 FillRect32(HDC32,const RECT32*,HBRUSH32); +#define FillRect WINELIB_NAME(FillRect) +HWND FindWindow16(SEGPTR,LPCSTR); +HWND FindWindow32A(LPCSTR,LPCSTR); +HWND FindWindow32W(LPCWSTR,LPCWSTR); +#define FindWindow WINELIB_NAME_AW(FindWindow) +HWND FindWindowEx16(HWND,HWND,SEGPTR,LPCSTR); +HWND FindWindowEx32A(HWND,HWND,LPCSTR,LPCSTR); +HWND FindWindowEx32W(HWND,HWND,LPCWSTR,LPCWSTR); +#define FindWindowEx WINELIB_NAME_AW(FindWindowEx) +INT16 FrameRect16(HDC16,const RECT16*,HBRUSH16); +INT32 FrameRect32(HDC32,const RECT32*,HBRUSH32); +#define FrameRect WINELIB_NAME(FrameRect) +BOOL16 GetBitmapDimensionEx16(HBITMAP16,LPSIZE16); +BOOL32 GetBitmapDimensionEx32(HBITMAP32,LPSIZE32); +#define GetBitmapDimensionEx WINELIB_NAME(GetBitmapDimensionEx) +BOOL16 GetBrushOrgEx16(HDC16,LPPOINT16); +BOOL32 GetBrushOrgEx32(HDC32,LPPOINT32); +#define GetBrushOrgEx WINELIB_NAME(GetBrushOrgEx) +void GetCaretPos16(LPPOINT16); +void GetCaretPos32(LPPOINT32); +#define GetCaretPos WINELIB_NAME(GetCaretPos) +BOOL GetClassInfo16(HINSTANCE16,SEGPTR,WNDCLASS16 *); +BOOL GetClassInfo32A(HINSTANCE32,LPCSTR,WNDCLASS32A *); +BOOL GetClassInfo32W(HINSTANCE32,LPCWSTR,WNDCLASS32W *); +#define GetClassInfo WINELIB_NAME_AW(GetClassInfo) +BOOL GetClassInfoEx16(HINSTANCE16,SEGPTR,WNDCLASSEX16 *); +BOOL GetClassInfoEx32A(HINSTANCE32,LPCSTR,WNDCLASSEX32A *); +BOOL GetClassInfoEx32W(HINSTANCE32,LPCWSTR,WNDCLASSEX32W *); +#define GetClassInfoEx WINELIB_NAME_AW(GetClassInfoEx) +LONG GetClassLong16(HWND,INT16); +LONG GetClassLong32A(HWND,INT32); +LONG GetClassLong32W(HWND,INT32); +#define GetClassLong WINELIB_NAME_AW(GetClassLong) +INT16 GetClassName16(HWND,LPSTR,INT16); +INT32 GetClassName32A(HWND,LPSTR,INT32); +INT32 GetClassName32W(HWND,LPWSTR,INT32); +#define GetClassName WINELIB_NAME_AW(GetClassName) +void GetClientRect16(HWND16,LPRECT16); +void GetClientRect32(HWND32,LPRECT32); +#define GetClientRect WINELIB_NAME(GetClientRect) +INT16 GetClipBox16(HDC16,LPRECT16); +INT32 GetClipBox32(HDC32,LPRECT32); +#define GetClipBox WINELIB_NAME(GetClipBox) +void GetClipCursor16(LPRECT16); +void GetClipCursor32(LPRECT32); +#define GetClipCursor WINELIB_NAME(GetClipCursor) +BOOL16 GetCurrentPositionEx16(HDC16,LPPOINT16); +BOOL32 GetCurrentPositionEx32(HDC32,LPPOINT32); +#define GetCurrentPositionEx WINELIB_NAME(GetCurrentPositionEx) +void GetCursorPos16(LPPOINT16); +void GetCursorPos32(LPPOINT32); +#define GetCursorPos WINELIB_NAME(GetCursorPos) +UINT16 GetInternalWindowPos16(HWND16,LPRECT16,LPPOINT16); +UINT32 GetInternalWindowPos32(HWND32,LPRECT32,LPPOINT32); +#define GetInternalWindowPos WINELIB_NAME(GetInternalWindowPos) +INT16 GetRgnBox16(HRGN16,LPRECT16); +INT32 GetRgnBox32(HRGN32,LPRECT32); +#define GetRgnBox WINELIB_NAME(GetRgnBox) +BOOL16 GetTextExtentPoint16(HDC16,LPCSTR,INT16,LPSIZE16); +BOOL32 GetTextExtentPoint32A(HDC32,LPCSTR,INT32,LPSIZE32); +BOOL32 GetTextExtentPoint32W(HDC32,LPCWSTR,INT32,LPSIZE32); +#define GetTextExtentPoint WINELIB_NAME_AW(GetTextExtentPoint) +BOOL16 GetUpdateRect16(HWND16,LPRECT16,BOOL16); +BOOL32 GetUpdateRect32(HWND32,LPRECT32,BOOL32); +#define GetUpdateRect WINELIB_NAME(GetUpdateRect) +BOOL16 GetViewportExtEx16(HDC16,LPPOINT16); +BOOL32 GetViewportExtEx32(HDC32,LPPOINT32); +#define GetViewportExtEx WINELIB_NAME(GetViewportExtEx) +BOOL16 GetViewportOrgEx16(HDC16,LPPOINT16); +BOOL32 GetViewportOrgEx32(HDC32,LPPOINT32); +#define GetViewportOrgEx WINELIB_NAME(GetViewportOrgEx) +BOOL16 GetWindowExtEx16(HDC16,LPPOINT16); +BOOL32 GetWindowExtEx32(HDC32,LPPOINT32); +#define GetWindowExtEx WINELIB_NAME(GetWindowExtEx) +BOOL16 GetWindowOrgEx16(HDC16,LPPOINT16); +BOOL32 GetWindowOrgEx32(HDC32,LPPOINT32); +#define GetWindowOrgEx WINELIB_NAME(GetWindowOrgEx) +BOOL16 GetWindowPlacement16(HWND16,LPWINDOWPLACEMENT16); +BOOL32 GetWindowPlacement32(HWND32,LPWINDOWPLACEMENT32); +#define GetWindowPlacement WINELIB_NAME(GetWindowPlacement) +void GetWindowRect16(HWND16,LPRECT16); +void GetWindowRect32(HWND32,LPRECT32); +#define GetWindowRect WINELIB_NAME(GetWindowRect) +ATOM GlobalAddAtom16(SEGPTR); +ATOM GlobalAddAtom32A(LPCSTR); +ATOM GlobalAddAtom32W(LPCWSTR); +#define GlobalAddAtom WINELIB_NAME_AW(GlobalAddAtom) HGLOBAL16 GlobalAlloc16(UINT16,DWORD); HGLOBAL32 GlobalAlloc32(UINT32,DWORD); #define GlobalAlloc WINELIB_NAME(GlobalAlloc) @@ -3356,9 +3575,17 @@ DWORD GlobalCompact32(DWORD); UINT16 GlobalFlags16(HGLOBAL16); UINT32 GlobalFlags32(HGLOBAL32); #define GlobalFlags WINELIB_NAME(GlobalFlags) +ATOM GlobalFindAtom16(SEGPTR); +ATOM GlobalFindAtom32A(LPCSTR); +ATOM GlobalFindAtom32W(LPCWSTR); +#define GlobalFindAtom WINELIB_NAME_AW(GlobalFindAtom) HGLOBAL16 GlobalFree16(HGLOBAL16); HGLOBAL32 GlobalFree32(HGLOBAL32); #define GlobalFree WINELIB_NAME(GlobalFree) +UINT16 GlobalGetAtomName16(ATOM,LPSTR,INT16); +UINT32 GlobalGetAtomName32A(ATOM,LPSTR,INT32); +UINT32 GlobalGetAtomName32W(ATOM,LPWSTR,INT32); +#define GlobalGetAtomName WINELIB_NAME_AW(GlobalGetAtomName) DWORD GlobalHandle16(WORD); HGLOBAL32 GlobalHandle32(LPCVOID); #define GlobalHandle WINELIB_NAME(GlobalHandle) @@ -3371,9 +3598,24 @@ HGLOBAL32 GlobalReAlloc32(HGLOBAL32,DWORD,UINT32); DWORD GlobalSize16(HGLOBAL16); DWORD GlobalSize32(HGLOBAL32); #define GlobalSize WINELIB_NAME(GlobalSize) -BOOL GlobalUnlock16(HGLOBAL16); -BOOL GlobalUnlock32(HGLOBAL32); +BOOL16 GlobalUnlock16(HGLOBAL16); +BOOL32 GlobalUnlock32(HGLOBAL32); #define GlobalUnlock WINELIB_NAME(GlobalUnlock) +void InflateRect16(LPRECT16,INT16,INT16); +void InflateRect32(LPRECT32,INT32,INT32); +#define InflateRect WINELIB_NAME(InflateRect) +BOOL16 IntersectRect16(LPRECT16,const RECT16*,const RECT16*); +BOOL32 IntersectRect32(LPRECT32,const RECT32*,const RECT32*); +#define IntersectRect WINELIB_NAME(IntersectRect) +void InvalidateRect16(HWND16,const RECT16*,BOOL16); +void InvalidateRect32(HWND32,const RECT32*,BOOL32); +#define InvalidateRect WINELIB_NAME(InvalidateRect) +void InvertRect16(HDC16,const RECT16*); +void InvertRect32(HDC32,const RECT32*); +#define InvertRect WINELIB_NAME(InvertRect) +BOOL16 IsRectEmpty16(const RECT16*); +BOOL32 IsRectEmpty32(const RECT32*); +#define IsRectEmpty WINELIB_NAME(IsRectEmpty) HLOCAL16 LocalAlloc16(UINT16,WORD); HLOCAL32 LocalAlloc32(UINT32,DWORD); #define LocalAlloc WINELIB_NAME(LocalAlloc) @@ -3401,12 +3643,189 @@ UINT32 LocalShrink32(HGLOBAL32,UINT32); UINT16 LocalSize16(HLOCAL16); UINT32 LocalSize32(HLOCAL32); #define LocalSize WINELIB_NAME(LocalSize) -BOOL LocalUnlock16(HLOCAL16); -BOOL LocalUnlock32(HLOCAL32); +BOOL16 LocalUnlock16(HLOCAL16); +BOOL32 LocalUnlock32(HLOCAL32); #define LocalUnlock WINELIB_NAME(LocalUnlock) +BOOL16 LPtoDP16(HDC16,LPPOINT16,INT16); +BOOL32 LPtoDP32(HDC32,LPPOINT32,INT32); +#define LPtoDP WINELIB_NAME(LPtoDP) +void MapDialogRect16(HWND16,LPRECT16); +void MapDialogRect32(HWND32,LPRECT32); +#define MapDialogRect WINELIB_NAME(MapDialogRect) +void MapWindowPoints16(HWND16,HWND16,LPPOINT16,UINT16); +void MapWindowPoints32(HWND32,HWND32,LPPOINT32,UINT32); +#define MapWindowPoints WINELIB_NAME(MapWindowPoints) +BOOL16 MoveToEx16(HDC16,INT16,INT16,LPPOINT16); +BOOL32 MoveToEx32(HDC32,INT32,INT32,LPPOINT32); +#define MoveToEx WINELIB_NAME(MoveToEx) INT16 MulDiv16(INT16,INT16,INT16); INT32 MulDiv32(INT32,INT32,INT32); #define MulDiv WINELIB_NAME(MulDiv) +void OffsetRect16(LPRECT16,INT16,INT16); +void OffsetRect32(LPRECT32,INT32,INT32); +#define OffsetRect WINELIB_NAME(OffsetRect) +BOOL16 OffsetViewportOrgEx16(HDC16,INT16,INT16,LPPOINT16); +BOOL32 OffsetViewportOrgEx32(HDC32,INT32,INT32,LPPOINT32); +#define OffsetViewportOrgEx WINELIB_NAME(OffsetViewportOrgEx) +BOOL16 OffsetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16); +BOOL32 OffsetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32); +#define OffsetWindowOrgEx WINELIB_NAME(OffsetWindowOrgEx) +BOOL16 PolyPolygon16(HDC16,LPPOINT16,LPINT16,UINT16); +BOOL32 PolyPolygon32(HDC32,LPPOINT32,LPINT32,UINT32); +#define PolyPolygon WINELIB_NAME(PolyPolygon) +BOOL16 Polygon16(HDC16,LPPOINT16,INT16); +BOOL32 Polygon32(HDC32,LPPOINT32,INT32); +#define Polygon WINELIB_NAME(Polygon) +BOOL16 Polyline16(HDC16,LPPOINT16,INT16); +BOOL32 Polyline32(HDC32,LPPOINT32,INT32); +#define Polyline WINELIB_NAME(Polyline) +BOOL16 PtInRect16(const RECT16*,POINT16); +BOOL32 PtInRect32(const RECT32*,POINT32); +#define PtInRect WINELIB_NAME(PtInRect) +BOOL16 RectInRegion16(HRGN16,const RECT16 *); +BOOL32 RectInRegion32(HRGN32,const RECT32 *); +#define RectInRegion WINELIB_NAME(RectInRegion) +BOOL16 RectVisible16(HDC16,LPRECT16); +BOOL32 RectVisible32(HDC32,LPRECT32); +#define RectVisible WINELIB_NAME(RectVisible) +BOOL16 RedrawWindow16(HWND16,const RECT16*,HRGN16,UINT16); +BOOL32 RedrawWindow32(HWND32,const RECT32*,HRGN32,UINT32); +#define RedrawWindow WINELIB_NAME(RedrawWindow) +DWORD RegCreateKey16(HKEY,LPCSTR,LPHKEY); +DWORD RegCreateKey32A(HKEY,LPCSTR,LPHKEY); +DWORD RegCreateKey32W(HKEY,LPCWSTR,LPHKEY); +#define RegCreateKey WINELIB_NAME_AW(RegCreateKey) +DWORD RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM, + LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD); +DWORD RegCreateKeyEx32W(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM, + LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD); +/* there is no RegCreateKeyEx16 */ +#define RegCreateKeyEx WINELIB_NAME_AW(RegCreateKeyEx) +DWORD RegDeleteKey16(HKEY,LPCSTR); +DWORD RegDeleteKey32A(HKEY,LPCSTR); +DWORD RegDeleteKey32W(HKEY,LPWSTR); +#define RegDeleteKey WINELIB_NAME_AW(RegDeleteKey) +DWORD RegDeleteValue16(HKEY,LPSTR); +DWORD RegDeleteValue32A(HKEY,LPSTR); +DWORD RegDeleteValue32W(HKEY,LPWSTR); +#define RegDeleteValue WINELIB_NAME_AW(RegDeleteValue) +DWORD RegEnumKey16(HKEY,DWORD,LPSTR,DWORD); +DWORD RegEnumKey32A(HKEY,DWORD,LPSTR,DWORD); +DWORD RegEnumKey32W(HKEY,DWORD,LPWSTR,DWORD); +#define RegEnumKey WINELIB_NAME_AW(RegEnumKey) +DWORD RegEnumKeyEx32A(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPSTR,LPDWORD,FILETIME*); +DWORD RegEnumKeyEx32W(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPWSTR,LPDWORD,FILETIME*); +/* there is no RegEnumKeyEx16 */ +#define RegEnumKeyEx WINELIB_NAME_AW(RegEnumKeyEx) +DWORD RegEnumValue16(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD); +DWORD RegEnumValue32A(HKEY,DWORD,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD); +DWORD RegEnumValue32W(HKEY,DWORD,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPBYTE,LPDWORD); +#define RegEnumValue WINELIB_NAME_AW(RegEnumValue) +ATOM RegisterClass16(const WNDCLASS16*); +ATOM RegisterClass32A(const WNDCLASS32A *); +ATOM RegisterClass32W(const WNDCLASS32W *); +#define RegisterClass WINELIB_NAME_AW(RegisterClass) +ATOM RegisterClassEx16(const WNDCLASSEX16*); +ATOM RegisterClassEx32A(const WNDCLASSEX32A *); +ATOM RegisterClassEx32W(const WNDCLASSEX32W *); +#define RegisterClassEx WINELIB_NAME_AW(RegisterClassEx) +WORD RegisterWindowMessage16(SEGPTR); +WORD RegisterWindowMessage32A(LPCSTR); +WORD RegisterWindowMessage32W(LPCWSTR); +#define RegisterWindowMessage WINELIB_NAME_AW(RegisterWindowMessage) +DWORD RegOpenKey16(HKEY,LPCSTR,LPHKEY); +DWORD RegOpenKey32A(HKEY,LPCSTR,LPHKEY); +DWORD RegOpenKey32W(HKEY,LPCWSTR,LPHKEY); +#define RegOpenKey WINELIB_NAME_AW(RegOpenKey) +DWORD RegOpenKeyEx32W(HKEY,LPCWSTR,DWORD,REGSAM,LPHKEY); +DWORD RegOpenKeyEx32A(HKEY,LPCSTR,DWORD,REGSAM,LPHKEY); +/* there is no RegOpenKeyEx16 */ +#define RegOpenKeyEx WINELIB_NAME_AW(RegOpenKeyEx) +DWORD RegQueryInfoKey32W(HKEY,LPWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD, + LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*); +DWORD RegQueryInfoKey32A(HKEY,LPSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD, + LPDWORD,LPDWORD,LPDWORD,LPDWORD,LPDWORD,FILETIME*); +/* there is no RegQueryInfoKey16 */ +#define RegQueryInfoKey WINELIB_NAME_AW(RegQueryInfoKey) +DWORD RegQueryValue16(HKEY,LPSTR,LPSTR,LPDWORD); +DWORD RegQueryValue32A(HKEY,LPSTR,LPSTR,LPDWORD); +DWORD RegQueryValue32W(HKEY,LPWSTR,LPWSTR,LPDWORD); +#define RegQueryValue WINELIB_NAME_AW(RegQueryValue) +DWORD RegQueryValueEx16(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); +DWORD RegQueryValueEx32A(HKEY,LPSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); +DWORD RegQueryValueEx32W(HKEY,LPWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD); +#define RegQueryValueEx WINELIB_NAME_AW(RegQueryValueEx) +DWORD RegSetValue16(HKEY,LPCSTR,DWORD,LPCSTR,DWORD); +DWORD RegSetValue32A(HKEY,LPCSTR,DWORD,LPCSTR,DWORD); +DWORD RegSetValue32W(HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD); +#define RegSetValue WINELIB_NAME_AW(RegSetValue) +DWORD RegSetValueEx16(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD); +DWORD RegSetValueEx32A(HKEY,LPSTR,DWORD,DWORD,LPBYTE,DWORD); +DWORD RegSetValueEx32W(HKEY,LPWSTR,DWORD,DWORD,LPBYTE,DWORD); +#define RegSetValueEx WINELIB_NAME_AW(RegSetValueEx) +BOOL16 ScaleViewportExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16); +BOOL32 ScaleViewportExtEx32(HDC32,INT32,INT32,INT32,INT32,LPSIZE32); +#define ScaleViewportExtEx WINELIB_NAME(ScaleViewportExtEx) +BOOL16 ScaleWindowExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16); +BOOL32 ScaleWindowExtEx32(HDC32,INT32,INT32,INT32,INT32,LPSIZE32); +#define ScaleWindowExtEx WINELIB_NAME(ScaleWindowExtEx) +void ScreenToClient16(HWND16,LPPOINT16); +void ScreenToClient32(HWND32,LPPOINT32); +#define ScreenToClient WINELIB_NAME(ScreenToClient) +BOOL16 SetBitmapDimensionEx16(HBITMAP16,INT16,INT16,LPSIZE16); +BOOL32 SetBitmapDimensionEx32(HBITMAP32,INT32,INT32,LPSIZE32); +#define SetBitmapDimensionEx WINELIB_NAME(SetBitmapDimensionEx) +LONG SetClassLong16(HWND,INT16,LONG); +LONG SetClassLong32A(HWND,INT32,LONG); +LONG SetClassLong32W(HWND,INT32,LONG); +#define SetClassLong WINELIB_NAME_AW(SetClassLong) +void SetInternalWindowPos16(HWND16,UINT16,LPRECT16,LPPOINT16); +void SetInternalWindowPos32(HWND32,UINT32,LPRECT32,LPPOINT32); +#define SetInternalWindowPos WINELIB_NAME(SetInternalWindowPos) +void SetRect16(LPRECT16,INT16,INT16,INT16,INT16); +void SetRect32(LPRECT32,INT32,INT32,INT32,INT32); +#define SetRect WINELIB_NAME(SetRect) +void SetRectEmpty16(LPRECT16); +void SetRectEmpty32(LPRECT32); +#define SetRectEmpty WINELIB_NAME(SetRectEmpty) +BOOL16 SetViewportExtEx16(HDC16,INT16,INT16,LPSIZE16); +BOOL32 SetViewportExtEx32(HDC32,INT32,INT32,LPSIZE32); +#define SetViewportExtEx WINELIB_NAME(SetViewportExtEx) +BOOL16 SetViewportOrgEx16(HDC16,INT16,INT16,LPPOINT16); +BOOL32 SetViewportOrgEx32(HDC32,INT32,INT32,LPPOINT32); +#define SetViewportOrgEx WINELIB_NAME(SetViewportOrgEx) +BOOL16 SetWindowExtEx16(HDC16,INT16,INT16,LPSIZE16); +BOOL32 SetWindowExtEx32(HDC32,INT32,INT32,LPSIZE32); +#define SetWindowExtEx WINELIB_NAME(SetWindowExtEx) +BOOL16 SetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16); +BOOL32 SetWindowOrgEx32(HDC32,INT32,INT32,LPPOINT32); +#define SetWindowOrgEx WINELIB_NAME(SetWindowOrgEx) +BOOL16 SetWindowPlacement16(HWND16,const WINDOWPLACEMENT16*); +BOOL32 SetWindowPlacement32(HWND32,const WINDOWPLACEMENT32*); +#define SetWindowPlacement WINELIB_NAME(SetWindowPlacement) +BOOL16 SubtractRect16(LPRECT16,const RECT16*,const RECT16*); +BOOL32 SubtractRect32(LPRECT32,const RECT32*,const RECT32*); +#define SubtractRect WINELIB_NAME(SubtractRect) +BOOL16 TextOut16(HDC16,INT16,INT16,LPCSTR,INT16); +BOOL32 TextOut32A(HDC32,INT32,INT32,LPCSTR,INT32); +BOOL32 TextOut32W(HDC32,INT32,INT32,LPCWSTR,INT32); +#define TextOut WINELIB_NAME_AW(TextOut) +BOOL16 TrackPopupMenu16(HMENU16,UINT16,INT16,INT16,INT16,HWND16,const RECT16*); +BOOL32 TrackPopupMenu32(HMENU32,UINT32,INT32,INT32,INT32,HWND32,const RECT32*); +#define TrackPopupMenu WINELIB_NAME(TrackPopupMenu) +BOOL16 UnionRect16(LPRECT16,const RECT16*,const RECT16*); +BOOL32 UnionRect32(LPRECT32,const RECT32*,const RECT32*); +#define UnionRect WINELIB_NAME(UnionRect) +BOOL16 UnregisterClass16(SEGPTR,HINSTANCE16); +BOOL32 UnregisterClass32A(LPCSTR,HINSTANCE32); +BOOL32 UnregisterClass32W(LPCWSTR,HINSTANCE32); +#define UnregisterClass WINELIB_NAME_AW(UnregisterClass) +void ValidateRect16(HWND16,const RECT16*); +void ValidateRect32(HWND32,const RECT32*); +#define ValidateRect WINELIB_NAME(ValidateRect) +HWND16 WindowFromPoint16(POINT16); +HWND32 WindowFromPoint32(POINT32); +#define WindowFromPoint WINELIB_NAME(WindowFromPoint) #ifdef WINELIB #define WINELIB_UNIMP(x) fprintf (stderr, "WineLib: Unimplemented %s\n", x) diff --git a/include/winnt.h b/include/winnt.h index b72a44d8c38..4a5d3bf05bf 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -18,6 +18,7 @@ #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 #define HEAP_CREATE_ALIGN_16 0x00010000 #define HEAP_CREATE_ENABLE_TRACING 0x00020000 - +#define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */ +#define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */ #endif /* __WINE_WINNT_H */ diff --git a/include/winpos.h b/include/winpos.h index 94d2dc53a39..654bf1226ff 100644 --- a/include/winpos.h +++ b/include/winpos.h @@ -22,7 +22,7 @@ typedef struct WORD valid; WORD wMagic; HWND hwndParent; - WINDOWPOS winPos[1]; + WINDOWPOS16 winPos[1]; } DWP; typedef struct @@ -36,10 +36,10 @@ extern void WINPOS_FindIconPos( HWND hwnd ); extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus); extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg ); extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, - RECT *newWindowRect, RECT *oldWindowRect, - RECT *oldClientRect, SEGPTR winpos, - RECT *newClientRect ); -extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos ); -extern INT WINPOS_WindowFromPoint( POINT pt, WND **ppWnd ); + RECT16 *newWindowRect, RECT16 *oldWindowRect, + RECT16 *oldClientRect, SEGPTR winpos, + RECT16 *newClientRect ); +extern LONG WINPOS_HandleWindowPosChanging( WINDOWPOS16 *winpos ); +extern INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ); #endif /* __WINE_WINPOS_H */ diff --git a/include/winreg.h b/include/winreg.h index d8e23b0ec92..62c45292069 100644 --- a/include/winreg.h +++ b/include/winreg.h @@ -59,6 +59,7 @@ #define REG_OPTION_NON_VOLATILE 0x00000000 #define REG_OPTION_VOLATILE 0x00000001 #define REG_OPTION_CREATE_LINK 0x00000002 +#define REG_OPTION_TAINTED 0x80000000 #define REG_CREATED_NEW_KEY 0x00000001 #define REG_OPENED_EXISTING_KEY 0x00000002 diff --git a/include/wintypes.h b/include/wintypes.h index a9bbe794c06..0ed35af9ea2 100644 --- a/include/wintypes.h +++ b/include/wintypes.h @@ -41,8 +41,8 @@ # define WINELIB_NAME_AW(func) func##16 # endif /* WINELIB32 */ #else /* WINELIB */ -# define WINELIB_NAME(func) /* nothing */ -# define WINELIB_NAME_AW(func) /* nothing */ +# define WINELIB_NAME(func) this is a syntax error +# define WINELIB_NAME_AW(func) this is a syntax error #endif /* WINELIB */ #ifdef WINELIB @@ -62,12 +62,13 @@ typedef int INT32; typedef unsigned int UINT32; typedef unsigned short WORD; typedef unsigned long DWORD; -typedef unsigned short BOOL; typedef unsigned char BYTE; typedef long LONG; typedef char CHAR; /* Some systems might have wchar_t, but we really need 16 bit characters */ typedef unsigned short WCHAR; +typedef unsigned short BOOL16; +typedef int BOOL32; /* Handles types. These are the same for emulator and library. */ @@ -186,6 +187,7 @@ DECL_WINELIB_TYPE(INT); DECL_WINELIB_TYPE(LPINT); DECL_WINELIB_TYPE(LPUINT); DECL_WINELIB_TYPE(UINT); +DECL_WINELIB_TYPE(BOOL); DECL_WINELIB_TYPE(WPARAM); DECL_WINELIB_TYPE(HACCEL); @@ -232,18 +234,15 @@ DECL_WINELIB_TYPE(WNDPROC); #ifndef WINELIB typedef INT16 INT; typedef UINT16 UINT; +typedef BOOL16 BOOL; typedef WPARAM16 WPARAM; -typedef HANDLE16 HACCEL; typedef HANDLE16 HANDLE; typedef HANDLE16 HBITMAP; typedef HANDLE16 HBRUSH; typedef HANDLE16 HCURSOR; typedef HANDLE16 HDC; -typedef HANDLE16 HDROP; typedef HANDLE16 HDRVR; -typedef HANDLE16 HDWP; typedef HANDLE16 HFONT; -typedef HANDLE16 HGDIOBJ; typedef HANDLE16 HGLOBAL; typedef HANDLE16 HICON; typedef HANDLE16 HINSTANCE; @@ -254,8 +253,6 @@ typedef HANDLE16 HMIDIIN; typedef HANDLE16 HMIDIOUT; typedef HANDLE16 HMMIO; typedef HANDLE16 HMODULE; -typedef HANDLE16 HPALETTE; -typedef HANDLE16 HPEN; typedef HANDLE16 HQUEUE; typedef HANDLE16 HRGN; typedef HANDLE16 HRSRC; @@ -335,17 +332,19 @@ typedef FARPROC HOOKPROC; /* Macros to split words and longs. */ -#define LOBYTE(w) ((BYTE)(WORD)(w)) -#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8)) +#define LOBYTE(w) ((BYTE)(WORD)(w)) +#define HIBYTE(w) ((BYTE)((WORD)(w) >> 8)) -#define LOWORD(l) ((WORD)(DWORD)(l)) -#define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) +#define LOWORD(l) ((WORD)(DWORD)(l)) +#define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) -#define SLOWORD(l) ((INT16)(LONG)(l)) -#define SHIWORD(l) ((INT16)((LONG)(l) >> 16)) +#define SLOWORD(l) ((INT16)(LONG)(l)) +#define SHIWORD(l) ((INT16)((LONG)(l) >> 16)) -#define MAKELONG(low, high) ((LONG)(((WORD)(low)) | \ - (((DWORD)((WORD)(high))) << 16))) +#define MAKELONG(low,high) ((LONG)(((WORD)(low)) | \ + (((DWORD)((WORD)(high))) << 16))) +#define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high)) +#define MAKEWPARAM(low,high) ((WPARAM32)MAKELONG(low,high)) #define SELECTOROF(ptr) (HIWORD(ptr)) #define OFFSETOF(ptr) (LOWORD(ptr)) diff --git a/include/winuser.h b/include/winuser.h index b8dcdb9da95..4cba8751b0d 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -86,7 +86,21 @@ typedef struct HICON32 hIconSm; } WNDCLASSEX32W, *LPWNDCLASSEX32W; -typedef void WNDCLASSEX16; /* There's no WNDCLASSEX in Win16 */ +typedef struct +{ + UINT32 cbSize; + UINT32 style; + WNDPROC16 lpfnWndProc; + INT16 cbClsExtra; + INT16 cbWndExtra; + HANDLE16 hInstance; + HICON16 hIcon; + HCURSOR16 hCursor; + HBRUSH16 hbrBackground; + SEGPTR lpszMenuName; + SEGPTR lpszClassName; + HICON16 hIconSm; +} WNDCLASSEX16, *LPWNDCLASSEX16; DECL_WINELIB_TYPE_AW(WNDCLASS); DECL_WINELIB_TYPE_AW(LPWNDCLASS); @@ -125,23 +139,7 @@ DECL_WINELIB_TYPE_AW(LPWNDCLASSEX); #define GCW_STYLE (-26) #define GCL_STYLE GCW_STYLE #define GCW_ATOM (-32) -#define GCL_HICONSM (-34) - -ATOM RegisterClass16(const WNDCLASS16*); -ATOM RegisterClass32A(const WNDCLASS32A *); -ATOM RegisterClass32W(const WNDCLASS32W *); -#define RegisterClass WINELIB_NAME_AW(RegisterClass) -ATOM RegisterClassEx32A(const WNDCLASSEX32A *); -ATOM RegisterClassEx32W(const WNDCLASSEX32W *); -#define RegisterClassEx WINELIB_NAME_AW(RegisterClassEx) -BOOL UnregisterClass16(SEGPTR,HINSTANCE16); -BOOL UnregisterClass32A(LPCSTR,HINSTANCE32); -BOOL UnregisterClass32W(LPCWSTR,HINSTANCE32); -#define UnregisterClass WINELIB_NAME_AW(UnregisterClass) - -BOOL GetClassInfo(HANDLE,SEGPTR,WNDCLASS16 *); -LONG GetClassLong(HWND,short); -int GetClassName(HWND,LPSTR,short); -LONG SetClassLong(HWND,short,LONG); +#define GCW_HICONSM (-34) +#define GCL_HICONSM GCW_HICONSM #endif /* __WINE_WINUSER_H */ diff --git a/library/Makefile.in b/library/Makefile.in index 9e27caabe51..22e8a1eef8e 100644 --- a/library/Makefile.in +++ b/library/Makefile.in @@ -2,9 +2,7 @@ TOPSRC = @top_srcdir@ MODULE = library C_SRCS = \ - atom.c \ arch.c \ - heap.c \ libres.c \ miscstubs.c \ sup.c \ diff --git a/library/atom.c b/library/atom.c deleted file mode 100644 index a87f938f0a8..00000000000 --- a/library/atom.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Atom table functions - * - * Copyright 1993, 1994, 1995 Alexandre Julliard - */ - -#include -#include -#include -#include - -#include "windows.h" -#include "xmalloc.h" - -#ifdef CONFIG_IPC -#include "dde_atom.h" -#include "options.h" -#endif - -#define MIN_STR_ATOM 0xc000 - -typedef struct -{ - WORD refCount; - BYTE length; - char* str; -} ATOMDATA; - -typedef struct -{ - void* next; - ATOMDATA a2h[16]; -} ATOMtoHANDLEtable; - -static ATOMtoHANDLEtable* GlobalAtomTable = NULL; -static ATOMtoHANDLEtable* LocalAtomTable = NULL; - - -/*********************************************************************** - * ATOM_Init - * - * Global table initialisation. - */ -BOOL ATOM_Init(void) -{ - return TRUE; -} - - -/*********************************************************************** - * ATOM_AddAtom - */ -static ATOM ATOM_AddAtom( ATOMtoHANDLEtable** tableptr, SEGPTR name ) -{ - ATOMDATA* FirstUnused; - ATOM FirstUnusedIndex; - ATOM Index; - ATOMtoHANDLEtable* table; - int i,len; - char *str; - - /* Check for integer atom */ - - if (!HIWORD(name)) return (ATOM)LOWORD(name); - str = (char*)name; - if (str[0] == '#') return atoi( &str[1] ); - - if ((len = strlen( str )) > 255) len = 255; - table = *tableptr; - FirstUnused = NULL; - FirstUnusedIndex = 0; - Index = MIN_STR_ATOM; - while (table) - { - for(i=0; i<16; i++, Index++) - { - if (!table->a2h[i].refCount) - { - FirstUnused=&table->a2h[i]; - FirstUnusedIndex=Index; - } - else if ((table->a2h[i].length == len) && - (!lstrncmpi( table->a2h[i].str, str, len ))) - { - table->a2h[i].refCount++; - return Index; - } - } - tableptr = (ATOMtoHANDLEtable**)&table->next; - table = table->next; - } - if(!FirstUnused) - { - *tableptr = xmalloc(sizeof(ATOMtoHANDLEtable)); - (*tableptr)->next = NULL; - for(i=0; i<16; i++) - { - (*tableptr)->a2h[i].str = NULL; - (*tableptr)->a2h[i].refCount = 0; - } - FirstUnused = (*tableptr)->a2h; - FirstUnusedIndex = Index; - } - if((FirstUnused->str = malloc(len+1))) - { - memcpy( FirstUnused->str, str, len ); - FirstUnused->str[len] = 0; - } - else - return 0; - FirstUnused->refCount = 1; - FirstUnused->length = len; - return FirstUnusedIndex; -} - - -/*********************************************************************** - * ATOM_DeleteAtom - */ -static ATOM ATOM_DeleteAtom( ATOMtoHANDLEtable** tableptr, ATOM atom ) -{ - ATOMtoHANDLEtable* table; - int i; - ATOM Index; - - if (atom < MIN_STR_ATOM) return 0; /* Integer atom */ - - Index = MIN_STR_ATOM; - table = *tableptr; - while (table) - { - if(atom-Index < 16) - { - i=atom-Index; - - /* Delete atom */ - if (--table->a2h[i].refCount == 0) - { - free(table->a2h[i].str); - table->a2h[i].str=NULL; - } - return 0; - } - else - { - Index+=16; - table = table->next; - } - } - return atom; -} - - -/*********************************************************************** - * ATOM_FindAtom - */ -static ATOM ATOM_FindAtom( ATOMtoHANDLEtable** tableptr, SEGPTR name ) -{ - ATOM Index; - ATOMtoHANDLEtable* table; - int i,len; - char *str; - - /* Check for integer atom */ - - if (!HIWORD(name)) return (ATOM)LOWORD(name); - str = (char*)name; - if (str[0] == '#') return atoi( &str[1] ); - - if ((len = strlen( str )) > 255) len = 255; - table=*tableptr; - Index=MIN_STR_ATOM; - while (table) - { - for(i=0; i<16; i++, Index++) - { - if ((table->a2h[i].refCount != 0) && - (table->a2h[i].length == len) && - (!lstrncmpi( table->a2h[i].str, str, len ))) - return Index; - } - table=table->next; - } - return 0; -} - - -/*********************************************************************** - * ATOM_GetAtomName - */ -static WORD ATOM_GetAtomName( ATOMtoHANDLEtable** tableptr, ATOM atom, - LPSTR buffer, short count ) -{ - ATOMtoHANDLEtable* table; - ATOM Index; - char * strPtr=NULL; - int i,len=0; - char text[8]; - - if (!count) return 0; - if (atom < MIN_STR_ATOM) - { - sprintf( text, "#%d", atom ); - len = strlen(text); - strPtr = text; - } - else - { - Index = MIN_STR_ATOM; - table = *tableptr; - while (table) - { - if(atom-Index < 16) - { - i=atom-Index; - - if (table->a2h[i].refCount == 0) - table=NULL; - else - { - len = table->a2h[i].length; - strPtr = table->a2h[i].str; - } - break; - } - else - { - Index+=16; - table = table->next; - } - } - if(!table)return 0; - } - if (len >= count) len = count-1; - memcpy( buffer, strPtr, len ); - buffer[len] = '\0'; - return len; -} - - -/*********************************************************************** - * InitAtomTable (KERNEL.68) - */ -WORD InitAtomTable( WORD entries ) -{ - return entries; -} - - -/*********************************************************************** - * GetAtomHandle (KERNEL.73) - */ -HANDLE GetAtomHandle( ATOM atom ) -{ - fprintf(stderr,"JBP: GetAtomHandle() called (obsolete).\n"); - return 0; -} - - -/*********************************************************************** - * AddAtom (KERNEL.70) - */ -ATOM AddAtom( SEGPTR str ) -{ - return ATOM_AddAtom( &LocalAtomTable, (SEGPTR)str ); -} - - -/*********************************************************************** - * DeleteAtom (KERNEL.71) - */ -ATOM DeleteAtom( ATOM atom ) -{ - return ATOM_DeleteAtom( &LocalAtomTable, atom ); -} - - -/*********************************************************************** - * FindAtom (KERNEL.69) - */ -ATOM FindAtom( SEGPTR str ) -{ - return ATOM_FindAtom( &LocalAtomTable, str ); -} - - -/*********************************************************************** - * GetAtomName (KERNEL.72) - */ -WORD GetAtomName( ATOM atom, LPSTR buffer, short count ) -{ - return ATOM_GetAtomName( &LocalAtomTable, atom, buffer, count ); -} - - -/*********************************************************************** - * GlobalAddAtom (USER.268) - */ -ATOM GlobalAddAtom( SEGPTR str ) -{ -#ifdef CONFIG_IPC - if (Options.ipc) return DDE_GlobalAddAtom( str ); -#endif - return ATOM_AddAtom( &GlobalAtomTable, str ); -} - - -/*********************************************************************** - * GlobalDeleteAtom (USER.269) - */ -ATOM GlobalDeleteAtom( ATOM atom ) -{ -#ifdef CONFIG_IPC - if (Options.ipc) return DDE_GlobalDeleteAtom( atom ); -#endif - return ATOM_DeleteAtom( &GlobalAtomTable, atom ); -} - - -/*********************************************************************** - * GlobalFindAtom (USER.270) - */ -ATOM GlobalFindAtom( SEGPTR str ) -{ -#ifdef CONFIG_IPC - if (Options.ipc) return DDE_GlobalFindAtom( str ); -#endif - return ATOM_FindAtom( &GlobalAtomTable, str ); -} - - -/*********************************************************************** - * GlobalGetAtomName (USER.271) - */ -WORD GlobalGetAtomName( ATOM atom, LPSTR buffer, short count ) -{ -#ifdef CONFIG_IPC - if (Options.ipc) return DDE_GlobalGetAtomName( atom, buffer, count ); -#endif - return ATOM_GetAtomName( &GlobalAtomTable, atom, buffer, count ); -} diff --git a/library/heap.c b/library/heap.c deleted file mode 100644 index a3ac881c198..00000000000 --- a/library/heap.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Memory alllocation for the Wine Library toolkit - * - * Copyright (C) 1994 Miguel de Icaza - * - * All the memory management is being done by the libc malloc and friends. - */ - -/* #ifndef __STDC__ */ -#include -#include -#include -/* #endif */ -#include "windows.h" -#include "xmalloc.h" - -#ifdef WINELIB16 - -/* Controls the blocks per handle table */ -#define MAXBLOCKS 1024 - -typedef struct handle_table { - struct handle_table *next; - void *blocks [MAXBLOCKS]; -} handle_table_t; - -static handle_table_t handle_table; - -static void **HEAP_GetFreeSlot (HANDLE *hNum) -{ - handle_table_t *table, *last; - int i, j; - - for (table = &handle_table, j = 0; table; table = table->next, j++){ - for (i = 0; i < MAXBLOCKS; i++) - if (!table->blocks [i]) - goto AssignBlock; - last = table; - } - - /* No free slots */ - last->next = xmalloc (sizeof (handle_table_t)); - table = last->next; - memset (table, 0, sizeof (handle_table_t)); - i = 0; - - AssignBlock: - *hNum = j*MAXBLOCKS+i; - return &table->blocks [i]; -} - -static void HEAP_Handle_is_Zero () -{ - printf ("Warning: Handle is Zero, segmentation fault comming\n"); -} - -static void **HEAP_FindSlot (HANDLE hNum) -{ - handle_table_t *table = &handle_table; - int i, j; - - if (!hNum) - HEAP_Handle_is_Zero (); - - hNum--; - for (j = hNum; j > MAXBLOCKS; j -= MAXBLOCKS){ - table = table->next; - if (!table) return 0; - } - return &table->blocks [hNum%MAXBLOCKS]; -} - -HANDLE LocalAlloc (WORD flags, WORD bytes) -{ - void *m; - void **slot; - HANDLE hMem; - - slot = HEAP_GetFreeSlot (&hMem); - if ((m = malloc (bytes))) - { - *slot = m; - if (flags & LMEM_ZEROINIT) memset( m, 0, bytes ); - -#ifdef DEBUG_HEAP - printf ("Handle %d [%d] = %p\n", hMem+1, bytes, m); -#endif - return hMem+1; - } - return 0; -} - -WORD LocalCompact (WORD min_free) -{ - return min_free; -} - -WORD LocalFlags (HANDLE hMem) -{ - return 0; -} - -HANDLE LocalFree (HANDLE hMem) -{ - void **m; - if(!hMem) - return 0; - m = HEAP_FindSlot (hMem); - - free (*m); - *m = 0; - return 0; -} - -BOOL LocalInit (WORD segment, WORD start, WORD end) -{ - return 1; -} - -WORD LocalLock (HANDLE hMem) -{ - void **m = HEAP_FindSlot (hMem); -#ifdef DEBUG_HEAP - printf (">%d->%p\n", hMem, *m); -#endif - return m ? *m : 0; -} - -HANDLE LocalReAlloc (HANDLE hMem, WORD flags, WORD bytes) -{ - void **m = HEAP_FindSlot (hMem); - - xrealloc (*m, bytes); -} - -WORD LocalSize (HANDLE hMem) -{ - /* Not implemented yet */ -} - - -BOOL LocalUnlock (HANDLE hMem) -{ - return 0; -} - -HANDLE GlobalAlloc (WORD flags, DWORD size) -{ - return LocalAlloc (flags, size); -} - -HANDLE GlobalFree (HANDLE hMem) -{ - return LocalFree (hMem); -} - -char *GlobalLock (HANDLE hMem) -{ - return LocalLock (hMem); -} - -BOOL GlobalUnlock (HANDLE hMem) -{ - return LocalUnlock (hMem); -} - -WORD GlobalFlags16(HANDLE hMem) -{ - return LocalFlags (hMem); -} - -DWORD GlobalSize16(HANDLE hMem) -{ - return LocalSize (hMem); -} - -DWORD GlobalCompact(DWORD desired) -{ - if (desired) - return desired; - else - return 0x01000000; /* Should check the available core. */ -} - -HANDLE GlobalReAlloc16(HANDLE hMem, DWORD new_size, WORD flags) -{ - if (!(flags & GMEM_MODIFY)) - return LocalReAlloc (hMem, new_size, flags); -} - -int HEAP_LocalSize () -{ - return 0; -} - -int HEAP_LocalFindHeap () -{ - return 0; -} - -#ifdef UNIMPLEMENTED - -DWORD int GlobalHandle(WORD selector) -{ -} - -#endif - -#endif /* WINELIB16 */ - -#if 0 - -typedef struct { DWORD Size; DWORD Padding[3]; } HeapData; - -HANDLE HEAP_Alloc (WORD flags, DWORD bytes) -{ - HeapData* m; - - bytes+=sizeof(HeapData); - if ((m = malloc (bytes))) - { - if (flags & LMEM_ZEROINIT) memset( m, 0, bytes ); - } - m->Size=bytes-sizeof(HeapData); - return (HANDLE)(m+1); -} - -HANDLE HEAP_Free (HANDLE hMem) -{ - HeapData* m; - if(!hMem) - return 0; - m=(HeapData*)hMem; - free(m-1); - return 0; -} - -DWORD HEAP_Size (HANDLE hMem) -{ - HeapData* m=(HeapData*)hMem; - return (m-1)->Size; -} - -HANDLE HEAP_ReAlloc(HANDLE hMem,DWORD bytes,UINT flags) -{ - HeapData* m=(HeapData*)hMem; - if(!bytes) - { - free(m-1); - return 0; /* Inaccurate behavior, but should suffice */ - } - m=realloc (m-1, bytes+sizeof(HeapData)); - if(flags & LMEM_ZEROINIT && bytes > m->Size) - memset( (char*)m+sizeof(HeapData)+m->Size, 0, bytes-m->Size ); - m->Size=bytes; - return (HANDLE)(m+1); -} - -HANDLE LocalAlloc (WORD flags, WORD bytes) -{ - return HEAP_Alloc(flags,bytes); -} - -UINT LocalFlags (HANDLE hMem) -{ - return 0; -} - -HANDLE LocalFree (HANDLE hMem) -{ - return HEAP_Free(hMem); -} - -BOOL LocalInit (HANDLE segment, WORD start, WORD end) -{ - return TRUE; -} - -LPVOID LocalLock (HANDLE hMem) -{ - return (LPVOID)hMem; -} - -HANDLE LocalReAlloc (HANDLE hMem, WORD new_size, WORD flags) -{ - if (!(flags & LMEM_MODIFY)) - return HEAP_ReAlloc (hMem, new_size, flags); - else - return hMem; -} - -UINT LocalSize (HANDLE hMem) -{ - return HEAP_Size(hMem); -} - -BOOL LocalUnlock (HANDLE hMem) -{ - return 0; -} - -HANDLE GlobalAlloc (WORD flags, DWORD size) -{ - return HEAP_Alloc (flags,size); -} - -HANDLE GlobalFree (HANDLE hMem) -{ - return HEAP_Free (hMem); -} - -LPVOID GlobalLock (HGLOBAL hMem) -{ - return (LPVOID)hMem; -} - -BOOL GlobalUnlock (HANDLE hMem) -{ - return 0; -} - -WORD GlobalFlags32(HANDLE hMem) -{ - return LocalFlags (hMem); -} - -DWORD GlobalSize32(HANDLE hMem) -{ - return HEAP_Size (hMem); -} - -HANDLE GlobalReAlloc32(HANDLE hMem, DWORD new_size, WORD flags) -{ - if (!(flags & GMEM_MODIFY)) - return HEAP_ReAlloc (hMem, new_size, flags); - else - return hMem; -} - -#endif diff --git a/library/miscstubs.c b/library/miscstubs.c index 1cee6cf41a5..5382c5a28d4 100644 --- a/library/miscstubs.c +++ b/library/miscstubs.c @@ -10,7 +10,6 @@ #include "dde_mem.h" #include "windows.h" #include "global.h" -#include "relay32.h" #include "debug.h" #include "xmalloc.h" @@ -44,93 +43,6 @@ int CallTo32_LargeStack( int (*func)(), int nbargs, ...) WORD CallTo16_word_ ( FARPROC func, WORD arg ) { return func(arg); } -#if 0 -void GlobalFreeAll(HGLOBAL16 owner) -{ - WINELIB_UNIMP("GlobalFreeAll()"); -} - -SEGPTR WIN16_GlobalLock16(HGLOBAL16 h) - { return (SEGPTR)h; } -HLOCAL LOCAL_Free(WORD ds, HLOCAL handle) - { return LocalFree(handle); } -HLOCAL LOCAL_Alloc(WORD ds, WORD flags, WORD size) - { return LocalAlloc(flags,size); } -HLOCAL LOCAL_ReAlloc(WORD ds, HLOCAL handle, WORD size, WORD flags) - { return LocalReAlloc(handle,size,flags); } -LPSTR LOCAL_Lock( WORD ds, HLOCAL handle ) - { return LocalLock(handle); } -BOOL LOCAL_Unlock( WORD ds, HLOCAL handle ) - { return LocalUnlock(handle); } -WORD LOCAL_Size( WORD ds, HLOCAL handle ) - { return LocalSize(handle); } - -void FarSetOwner(HANDLE a, HANDLE b) -{ - WINELIB_UNIMP("FarSetOwner()"); -} - -#define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */ - -HGLOBAL GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL hOwner, - BOOL isCode, BOOL is32Bit, BOOL isReadOnly ) -{ - void *ptr; - HGLOBAL handle; - SHMDATA shmdata; - - dprintf_global( stddeb, "GLOBAL_Alloc: %ld flags=%04x\n", size, flags ); - - /* Fixup the size */ - - if (size >= GLOBAL_MAX_ALLOC_SIZE - 0x1f) return 0; - if (size == 0) size = 0x20; - else size = (size + 0x1f) & ~0x1f; - - /* Allocate the linear memory */ - -#ifdef CONFIG_IPC - if ((flags & GMEM_DDESHARE) && Options.ipc) - ptr = DDE_malloc(flags, size, &shmdata); - else -#endif /* CONFIG_IPC */ - ptr = malloc( size ); - if (!ptr) return 0; - - /* Allocate the selector(s) */ - - handle = GLOBAL_CreateBlock( flags, ptr, size, hOwner, - isCode, is32Bit, isReadOnly, &shmdata); - if (!handle) - { - free( ptr ); - return 0; - } - - if (flags & GMEM_ZEROINIT) memset( ptr, 0, size ); - return handle; -} - -HGLOBAL GLOBAL_CreateBlock( WORD flags, const void *ptr, DWORD size, - HGLOBAL hOwner, BOOL isCode, - BOOL is32Bit, BOOL isReadOnly, - SHMDATA *shmdata) -{ - return (HGLOBAL)ptr; -} - -BOOL GLOBAL_FreeBlock( HGLOBAL handle ) -{ - return 1; -} - -HGLOBAL GlobalHandle(LPCVOID a) -{ - fprintf(stderr,"JBP: GlobalHandle() ignored.\n"); - return 0; -} -#endif - extern LRESULT ACTIVATEAPP_callback(HWND,UINT,WPARAM,LPARAM); extern LRESULT AboutDlgProc(HWND,UINT,WPARAM,LPARAM); extern LRESULT ButtonWndProc(HWND,UINT,WPARAM,LPARAM); diff --git a/library/sup.c b/library/sup.c index 421a0974098..797b96cd5f6 100644 --- a/library/sup.c +++ b/library/sup.c @@ -6,12 +6,6 @@ #include "arch.h" #include "neexe.h" -LRESULT CallWindowProc (WNDPROC func, HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam) -{ - return (*func)(hwnd, message, wParam, lParam); -} - /* * Header loading routines for WineLib. */ diff --git a/loader/main.c b/loader/main.c index 0a2d76464d8..18ecdfec7af 100644 --- a/loader/main.c +++ b/loader/main.c @@ -13,7 +13,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; #include "windows.h" #include "alias.h" #include "module.h" -#include "task.h" #include "selectors.h" #include "comm.h" #include "win.h" @@ -37,12 +36,14 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; #include "user.h" #include "dce.h" #include "pe_image.h" +#include "shell.h" #include "stddebug.h" #include "debug.h" void init_wine_signals(void); HANDLE32 SystemHeap = 0; +HANDLE32 SegptrHeap = 0; /*********************************************************************** * Main initialisation routine @@ -53,8 +54,9 @@ int MAIN_Init(void) int queueSize; - /* Create the system heap */ + /* Create the system and SEGPTR heaps */ if (!(SystemHeap = HeapCreate( HEAP_GROWABLE, 0x10000, 0 ))) return 0; + if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return 0; /* Load the configuration file */ if (!PROFILE_LoadWineIni()) return 0; @@ -101,6 +103,8 @@ int MAIN_Init(void) /* Initialize the DOS memory */ if (!INT21_Init()) return 0; #endif + /* registry initialisation */ + SHELL_LoadRegistry(); /* Global atom table initialisation */ if (!ATOM_Init()) return 0; diff --git a/loader/module.c b/loader/module.c index 920313f852e..e0474155f40 100644 --- a/loader/module.c +++ b/loader/module.c @@ -759,7 +759,7 @@ BOOL MODULE_SetEntryPoint( HMODULE hModule, WORD ordinal, WORD offset ) * Return an entry point from the WPROCS dll. */ #ifndef WINELIB -WNDPROC MODULE_GetWndProcEntry16( const char *name ) +FARPROC16 MODULE_GetWndProcEntry16( const char *name ) { WORD ordinal; static HMODULE hModule = 0; @@ -777,7 +777,7 @@ WNDPROC MODULE_GetWndProcEntry16( const char *name ) * Return an entry point from the WPROCS32 dll. */ #ifndef WINELIB -WNDPROC MODULE_GetWndProcEntry32( const char *name ) +FARPROC32 MODULE_GetWndProcEntry32( const char *name ) { static HMODULE hModule = 0; diff --git a/loader/pe_image.c b/loader/pe_image.c index 461a0743bdb..04d57bb84aa 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -23,7 +23,6 @@ #include "neexe.h" #include "peexe.h" #include "pe_image.h" -#include "relay32.h" #include "module.h" #include "alias.h" #include "global.h" diff --git a/loader/signal.c b/loader/signal.c index e7f9ea24bbf..c0f422f6fca 100644 --- a/loader/signal.c +++ b/loader/signal.c @@ -171,11 +171,7 @@ void init_wine_signals(void) #if defined(__NetBSD__) || defined(__FreeBSD__) struct sigaltstack ss; -#if !defined (__FreeBSD__) - if ((ss.ss_base = malloc(MINSIGSTKSZ)) == NULL) { -#else if ((ss.ss_sp = malloc(MINSIGSTKSZ)) == NULL) { -#endif fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n", MINSIGSTKSZ); exit(1); diff --git a/memory/atom.c b/memory/atom.c index c871a8ff1b6..bde08be6623 100644 --- a/memory/atom.c +++ b/memory/atom.c @@ -11,8 +11,6 @@ * have to be changed. */ -#ifndef WINELIB - #include #include #include @@ -22,6 +20,7 @@ #include "instance.h" #include "ldt.h" #include "stackframe.h" +#include "string32.h" #include "user.h" #ifdef CONFIG_IPC @@ -31,6 +30,7 @@ #define DEFAULT_ATOMTABLE_SIZE 37 #define MIN_STR_ATOM 0xc000 +#define MAX_ATOM_LEN 255 #define ATOMTOHANDLE(atom) ((HANDLE)(atom) << 2) #define HANDLETOATOM(handle) ((ATOM)(0xc000 | ((handle) >> 2))) @@ -45,10 +45,10 @@ /*********************************************************************** * ATOM_InitTable */ -static WORD ATOM_InitTable( WORD selector, WORD entries ) +static HANDLE16 ATOM_InitTable( WORD selector, WORD entries ) { int i; - HANDLE handle; + HANDLE16 handle; ATOMTABLE *table; /* Allocate the table */ @@ -72,9 +72,9 @@ static WORD ATOM_InitTable( WORD selector, WORD entries ) * * Global table initialisation. */ -WORD ATOM_Init() +BOOL ATOM_Init(void) { - return ATOM_InitTable( USER_HeapSel, DEFAULT_ATOMTABLE_SIZE ); + return ATOM_InitTable( USER_HeapSel, DEFAULT_ATOMTABLE_SIZE ) != 0; } @@ -124,21 +124,15 @@ static WORD ATOM_Hash( WORD entries, LPCSTR str, WORD len ) /*********************************************************************** * ATOM_AddAtom */ -static ATOM ATOM_AddAtom( WORD selector, SEGPTR name ) +static ATOM ATOM_AddAtom( WORD selector, LPCSTR str ) { WORD hash; HANDLE entry; ATOMENTRY * entryPtr; ATOMTABLE * table; int len; - char *str; - - /* Check for integer atom */ - - if (!HIWORD(name)) return (ATOM)LOWORD(name); - str = PTR_SEG_TO_LIN( name ); - if (str[0] == '#') return atoi( &str[1] ); + if (str[0] == '#') return atoi( &str[1] ); /* Check for integer atom */ if ((len = strlen( str )) > 255) len = 255; if (!(table = ATOM_GetTable( selector, TRUE ))) return 0; hash = ATOM_Hash( table->size, str, len ); @@ -159,7 +153,6 @@ static ATOM ATOM_AddAtom( WORD selector, SEGPTR name ) if (!entry) return 0; /* Reload the table ptr in case it moved in linear memory */ table = ATOM_GetTable( selector, FALSE ); - str = PTR_SEG_TO_LIN( name ); entryPtr = ATOM_MakePtr( selector, entry ); entryPtr->next = table->entries[hash]; entryPtr->refCount = 1; @@ -209,20 +202,14 @@ static ATOM ATOM_DeleteAtom( WORD selector, ATOM atom ) /*********************************************************************** * ATOM_FindAtom */ -static ATOM ATOM_FindAtom( WORD selector, SEGPTR name ) +static ATOM ATOM_FindAtom( WORD selector, LPCSTR str ) { ATOMTABLE * table; WORD hash; HANDLE entry; int len; - char *str; - - /* Check for integer atom */ - - if (!HIWORD(name)) return (ATOM)LOWORD(name); - str = PTR_SEG_TO_LIN( name ); - if (str[0] == '#') return atoi( &str[1] ); + if (str[0] == '#') return atoi( &str[1] ); /* Check for integer atom */ if ((len = strlen( str )) > 255) len = 255; if (!(table = ATOM_GetTable( selector, FALSE ))) return 0; hash = ATOM_Hash( table->size, str, len ); @@ -242,14 +229,14 @@ static ATOM ATOM_FindAtom( WORD selector, SEGPTR name ) /*********************************************************************** * ATOM_GetAtomName */ -static WORD ATOM_GetAtomName( WORD selector, ATOM atom, - LPSTR buffer, short count ) +static UINT32 ATOM_GetAtomName( WORD selector, ATOM atom, + LPSTR buffer, INT32 count ) { ATOMTABLE * table; ATOMENTRY * entryPtr; HANDLE entry; char * strPtr; - int len; + UINT32 len; char text[8]; if (!count) return 0; @@ -298,7 +285,20 @@ HANDLE GetAtomHandle( ATOM atom ) */ ATOM AddAtom( SEGPTR str ) { - return ATOM_AddAtom( CURRENT_DS, str ); + ATOM atom; + HANDLE16 ds = CURRENT_DS; + + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ + if (SELECTOR_TO_ENTRY(LOWORD(str)) == SELECTOR_TO_ENTRY(ds)) + { + /* If the string is in the same data segment as the atom table, make */ + /* a copy of the string to be sure it doesn't move in linear memory. */ + char buffer[256]; + lstrcpyn( buffer, (char *)PTR_SEG_TO_LIN(str), sizeof(buffer) ); + atom = ATOM_AddAtom( ds, buffer ); + } + else atom = ATOM_AddAtom( ds, (LPCSTR)PTR_SEG_TO_LIN(str) ); + return atom; } @@ -316,7 +316,8 @@ ATOM DeleteAtom( ATOM atom ) */ ATOM FindAtom( SEGPTR str ) { - return ATOM_FindAtom( CURRENT_DS, str ); + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ + return ATOM_FindAtom( CURRENT_DS, (LPCSTR)PTR_SEG_TO_LIN(str) ); } @@ -325,24 +326,47 @@ ATOM FindAtom( SEGPTR str ) */ WORD GetAtomName( ATOM atom, LPSTR buffer, short count ) { - return ATOM_GetAtomName( CURRENT_DS, atom, buffer, count ); + return (WORD)ATOM_GetAtomName( CURRENT_DS, atom, buffer, count ); } /*********************************************************************** - * GlobalAddAtom (USER.268) + * GlobalAddAtom16 (USER.268) */ -ATOM GlobalAddAtom( SEGPTR str ) +ATOM GlobalAddAtom16( SEGPTR str ) { + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ #ifdef CONFIG_IPC if (Options.ipc) return DDE_GlobalAddAtom( str ); #endif + return ATOM_AddAtom( USER_HeapSel, (LPCSTR)PTR_SEG_TO_LIN(str) ); +} + + +/*********************************************************************** + * GlobalAddAtom32A (KERNEL32.313) + */ +ATOM GlobalAddAtom32A( LPCSTR str ) +{ + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ return ATOM_AddAtom( USER_HeapSel, str ); } /*********************************************************************** - * GlobalDeleteAtom (USER.269) + * GlobalAddAtom32W (KERNEL32.314) + */ +ATOM GlobalAddAtom32W( LPCWSTR str ) +{ + char buffer[MAX_ATOM_LEN+1]; + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ + STRING32_UniToAnsi( buffer, str ); /* FIXME: 'str' length? */ + return ATOM_AddAtom( USER_HeapSel, buffer ); +} + + +/*********************************************************************** + * GlobalDeleteAtom (USER.269) (KERNEL32.317) */ ATOM GlobalDeleteAtom( ATOM atom ) { @@ -354,26 +378,69 @@ ATOM GlobalDeleteAtom( ATOM atom ) /*********************************************************************** - * GlobalFindAtom (USER.270) + * GlobalFindAtom16 (USER.270) */ -ATOM GlobalFindAtom( SEGPTR str ) +ATOM GlobalFindAtom16( SEGPTR str ) { + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ #ifdef CONFIG_IPC if (Options.ipc) return DDE_GlobalFindAtom( str ); #endif + return ATOM_FindAtom( USER_HeapSel, (LPCSTR)PTR_SEG_TO_LIN(str) ); +} + + +/*********************************************************************** + * GlobalFindAtom32A (KERNEL32.318) + */ +ATOM GlobalFindAtom32A( LPCSTR str ) +{ + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ return ATOM_FindAtom( USER_HeapSel, str ); } /*********************************************************************** - * GlobalGetAtomName (USER.271) + * GlobalFindAtom32W (KERNEL32.319) */ -WORD GlobalGetAtomName( ATOM atom, LPSTR buffer, short count ) +ATOM GlobalFindAtom32W( LPCWSTR str ) +{ + char buffer[MAX_ATOM_LEN+1]; + if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */ + STRING32_UniToAnsi( buffer, str ); /* FIXME: 'str' length? */ + return ATOM_FindAtom( USER_HeapSel, buffer ); +} + + +/*********************************************************************** + * GlobalGetAtomName16 (USER.271) + */ +UINT16 GlobalGetAtomName16( ATOM atom, LPSTR buffer, INT16 count ) { #ifdef CONFIG_IPC if (Options.ipc) return DDE_GlobalGetAtomName( atom, buffer, count ); #endif + return (UINT16)ATOM_GetAtomName( USER_HeapSel, atom, buffer, count ); +} + + +/*********************************************************************** + * GlobalGetAtomName32A (KERNEL32.323) + */ +UINT32 GlobalGetAtomName32A( ATOM atom, LPSTR buffer, INT32 count ) +{ return ATOM_GetAtomName( USER_HeapSel, atom, buffer, count ); } -#endif /* WINELIB */ +/*********************************************************************** + * GlobalGetAtomName32W (KERNEL32.324) + */ +UINT32 GlobalGetAtomName32W( ATOM atom, LPWSTR buffer, INT32 count ) +{ + UINT32 len; + char tmp[MAX_ATOM_LEN+1]; + if (count > sizeof(tmp)) count = sizeof(tmp); + len = ATOM_GetAtomName( USER_HeapSel, atom, tmp, count ); + STRING32_AnsiToUni( buffer, tmp ); /* FIXME: len? */ + return len; +} diff --git a/memory/global.c b/memory/global.c index 78038519d99..022ad4e0e63 100644 --- a/memory/global.c +++ b/memory/global.c @@ -441,7 +441,7 @@ LPVOID GlobalLock16( HGLOBAL16 handle ) /*********************************************************************** * GlobalUnlock16 (KERNEL.19) */ -BOOL GlobalUnlock16( HGLOBAL16 handle ) +BOOL16 GlobalUnlock16( HGLOBAL16 handle ) { dprintf_global( stddeb, "GlobalUnlock16: %04x\n", handle ); return 0; @@ -911,7 +911,7 @@ DWORD GlobalSize32( HGLOBAL32 handle ) /*********************************************************************** * GlobalUnlock32 (KERNEL32.332) */ -BOOL GlobalUnlock32( HGLOBAL32 handle ) +BOOL32 GlobalUnlock32( HGLOBAL32 handle ) { return TRUE; } diff --git a/memory/heap.c b/memory/heap.c index 77fded0d9f8..8ba60e8ab2e 100644 --- a/memory/heap.c +++ b/memory/heap.c @@ -10,6 +10,7 @@ #include "windows.h" #include "debugger.h" #include "kernel32.h" /* for CRITICAL_SECTION */ +#include "selectors.h" #include "winbase.h" #include "winerror.h" #include "winnt.h" @@ -72,6 +73,7 @@ typedef struct tagSUBHEAP struct tagSUBHEAP *next; /* Next sub-heap */ struct tagHEAP *heap; /* Main heap structure */ DWORD magic; /* Magic number */ + WORD selector; /* Selector for HEAP_WINE_SEGPTR heaps */ } SUBHEAP; #define SUBHEAP_MAGIC ((DWORD)('S' | ('U'<<8) | ('B'<<16) | ('H'<<24))) @@ -216,7 +218,7 @@ static void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena ) * * Find the sub-heap containing a given address. */ -static SUBHEAP *HEAP_FindSubHeap( HEAP *heap, void *ptr ) +static SUBHEAP *HEAP_FindSubHeap( HEAP *heap, LPCVOID ptr ) { SUBHEAP *sub = &heap->subheap; while (sub) @@ -409,16 +411,25 @@ static void HEAP_ShrinkBlock(SUBHEAP *subheap, ARENA_INUSE *pArena, DWORD size) * * Create a sub-heap of the given size. */ -static SUBHEAP *HEAP_CreateSubHeap( DWORD commitSize, DWORD totalSize ) +static SUBHEAP *HEAP_CreateSubHeap( DWORD flags, DWORD commitSize, + DWORD totalSize ) { SUBHEAP *subheap; + WORD selector = 0; /* Round-up sizes on a 64K boundary */ - totalSize = (totalSize + 0xffff) & 0xffff0000; - commitSize = (commitSize + 0xffff) & 0xffff0000; - if (!commitSize) commitSize = 0x10000; - if (totalSize < commitSize) totalSize = commitSize; + if (flags & HEAP_WINE_SEGPTR) + { + totalSize = commitSize = 0x10000; /* Only 64K at a time for SEGPTRs */ + } + else + { + totalSize = (totalSize + 0xffff) & 0xffff0000; + commitSize = (commitSize + 0xffff) & 0xffff0000; + if (!commitSize) commitSize = 0x10000; + if (totalSize < commitSize) totalSize = commitSize; + } /* Allocate the memory block */ @@ -437,6 +448,21 @@ static SUBHEAP *HEAP_CreateSubHeap( DWORD commitSize, DWORD totalSize ) return NULL; } + /* Allocate a selector if needed */ + + if (flags & HEAP_WINE_SEGPTR) + { + selector = SELECTOR_AllocBlock( subheap, totalSize, + (flags & HEAP_WINE_CODESEG) ? SEGMENT_CODE : SEGMENT_DATA, + (flags & HEAP_WINE_CODESEG) != 0, FALSE ); + if (!selector) + { + fprintf( stderr, "HEAP_CreateSubHeap: could not allocate selector\n" ); + VirtualFree( subheap, 0, MEM_RELEASE ); + return NULL; + } + } + /* Fill the sub-heap structure */ subheap->size = totalSize; @@ -445,6 +471,7 @@ static SUBHEAP *HEAP_CreateSubHeap( DWORD commitSize, DWORD totalSize ) subheap->next = NULL; subheap->heap = NULL; subheap->magic = SUBHEAP_MAGIC; + subheap->selector = selector; return subheap; } @@ -490,7 +517,8 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, DWORD size, return NULL; } size += sizeof(SUBHEAP) + sizeof(ARENA_FREE); - if (!(subheap = HEAP_CreateSubHeap( size, MAX( HEAP_DEF_SIZE, size ) ))) + if (!(subheap = HEAP_CreateSubHeap( heap->flags, size, + MAX( HEAP_DEF_SIZE, size ) ))) return NULL; /* Insert the new sub-heap in the list */ @@ -674,6 +702,72 @@ static BOOL HEAP_ValidateInUseArena( SUBHEAP *subheap, ARENA_INUSE *pArena ) } +/*********************************************************************** + * HEAP_IsInsideHeap + * + * Check whether the pointer is to a block inside a given heap. + */ +int HEAP_IsInsideHeap( HANDLE32 heap, DWORD flags, LPCVOID ptr ) +{ + HEAP *heapPtr = HEAP_GetPtr( heap ); + SUBHEAP *subheap; + int ret; + + /* Validate the parameters */ + + if (!heapPtr) return 0; + flags |= heapPtr->flags; + if (!(flags & HEAP_NO_SERIALIZE)) HeapLock( heap ); + ret = (((subheap = HEAP_FindSubHeap( heapPtr, ptr )) != NULL) && + (((char *)ptr >= (char *)subheap + subheap->headerSize + + sizeof(ARENA_INUSE)))); + if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap ); + return ret; +} + + +/*********************************************************************** + * HEAP_GetSegptr + * + * Transform a linear pointer into a SEGPTR. The pointer must have been + * allocated from a HEAP_WINE_SEGPTR heap. + */ +SEGPTR HEAP_GetSegptr( HANDLE32 heap, DWORD flags, LPCVOID ptr ) +{ + HEAP *heapPtr = HEAP_GetPtr( heap ); + SUBHEAP *subheap; + SEGPTR ret; + + /* Validate the parameters */ + + if (!heapPtr) return 0; + flags |= heapPtr->flags; + if (!(flags & HEAP_WINE_SEGPTR)) + { + fprintf( stderr, "HEAP_GetSegptr: heap %08x is not a SEGPTR heap\n", + heap ); + return 0; + } + if (!(flags & HEAP_NO_SERIALIZE)) HeapLock( heap ); + + /* Get the subheap */ + + if (!(subheap = HEAP_FindSubHeap( heapPtr, ptr ))) + { + fprintf( stderr, "HEAP_GetSegptr: %p is not inside heap %08x\n", + ptr, heap ); + if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap ); + return 0; + } + + /* Build the SEGPTR */ + + ret = PTR_SEG_OFF_TO_SEGPTR(subheap->selector, (DWORD)ptr-(DWORD)subheap); + if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap ); + return ret; +} + + /*********************************************************************** * HeapCreate (KERNEL32.336) */ @@ -691,7 +785,7 @@ HANDLE32 HeapCreate( DWORD flags, DWORD initialSize, DWORD maxSize ) maxSize = HEAP_DEF_SIZE; flags |= HEAP_GROWABLE; } - if (!(subheap = HEAP_CreateSubHeap( initialSize, maxSize ))) + if (!(subheap = HEAP_CreateSubHeap( flags, initialSize, maxSize ))) { SetLastError( ERROR_OUTOFMEMORY ); return 0; @@ -1095,5 +1189,18 @@ BOOL HeapValidate( HANDLE32 heap, DWORD flags, LPVOID block ) */ BOOL HeapWalk( HANDLE32 heap, void *entry ) { + fprintf( stderr, "HeapWalk(%08x): not implemented\n", heap ); return FALSE; } + + +/*********************************************************************** + * HEAP_strdupA + */ +LPSTR HEAP_strdupA( HANDLE32 heap, DWORD flags, LPCSTR str ) +{ + INT32 len = lstrlen(str) + 1; + LPSTR p = HeapAlloc( heap, flags, len ); + if (p) strcpy( p, str ); + return p; +} diff --git a/memory/local.c b/memory/local.c index 38cb3ea273f..d3aecfa1ca9 100644 --- a/memory/local.c +++ b/memory/local.c @@ -505,6 +505,62 @@ static HLOCAL16 LOCAL_FreeArena( WORD ds, WORD arena ) return 0; } + +/*********************************************************************** + * LOCAL_ShrinkArena + * + * Shrink an arena by creating a free block at its end if possible. + * 'size' includes the arena header, and must be aligned. + */ +static void LOCAL_ShrinkArena( WORD ds, WORD arena, WORD size ) +{ + char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + LOCALARENA *pArena = ARENA_PTR( ptr, arena ); + + if (arena + size + LALIGN(sizeof(LOCALARENA)) < pArena->next) + { + LOCALHEAPINFO *pInfo = LOCAL_GetHeap( ds ); + if (!pInfo) return; + LOCAL_AddBlock( ptr, arena, arena + size ); + pInfo->items++; + LOCAL_FreeArena( ds, arena + size ); + } +} + + +/*********************************************************************** + * LOCAL_GrowArenaDownward + * + * Grow an arena downward by using the previous arena (must be free). + */ +static void LOCAL_GrowArenaDownward( WORD ds, WORD arena, WORD newsize ) +{ + char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); + LOCALHEAPINFO *pInfo; + LOCALARENA *pArena = ARENA_PTR( ptr, arena ); + WORD prevArena = pArena->prev & ~3; + LOCALARENA *pPrevArena = ARENA_PTR( ptr, prevArena ); + WORD offset, size; + char *p; + + if (!(pInfo = LOCAL_GetHeap( ds ))) return; + offset = pPrevArena->size; + size = pArena->next - arena - ARENA_HEADER_SIZE; + LOCAL_RemoveFreeBlock( ptr, prevArena ); + LOCAL_RemoveBlock( ptr, arena ); + pInfo->items--; + p = (char *)pPrevArena + ARENA_HEADER_SIZE; + while (offset < size) + { + memcpy( p, p + offset, offset ); + p += offset; + size -= offset; + } + if (size) memcpy( p, p + offset, size ); + LOCAL_ShrinkArena( ds, prevArena, newsize ); +} + + /*********************************************************************** * LOCAL_GetFreeSpace */ @@ -543,11 +599,11 @@ static WORD LOCAL_GetFreeSpace(WORD ds, WORD countdiscard) */ static WORD LOCAL_Compact( HANDLE16 ds, WORD minfree, WORD flags ) { - char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ), *fcp, *mcp; + char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); LOCALHEAPINFO *pInfo; LOCALARENA *pArena, *pMoveArena, *pFinalArena; WORD arena, movearena, finalarena, table; - WORD count, movesize, size, i; + WORD count, movesize, size; WORD freespace; LOCALHANDLEENTRY *pEntry; @@ -607,16 +663,10 @@ static WORD LOCAL_Compact( HANDLE16 ds, WORD minfree, WORD flags ) { dprintf_local(stddeb, "Moving it to %04x.\n", finalarena); pFinalArena = ARENA_PTR(ptr, finalarena); - - /* Check to see if it's worth creating a free arena at the end */ - if(pFinalArena->size > movesize+LALIGN(sizeof(LOCALARENA))) - { - LOCAL_AddBlock(ptr, finalarena, finalarena + movesize); - LOCAL_MakeBlockFree(ptr, finalarena + movesize); - pInfo->items++; - } - /* Copy the arena to it's new location */ + size = pFinalArena->size; LOCAL_RemoveFreeBlock(ptr, finalarena); + LOCAL_ShrinkArena( ds, finalarena, movesize ); + /* Copy the arena to it's new location */ memcpy((char *)pFinalArena + ARENA_HEADER_SIZE, (char *)pMoveArena + ARENA_HEADER_SIZE, movesize - ARENA_HEADER_SIZE ); @@ -631,17 +681,7 @@ static WORD LOCAL_Compact( HANDLE16 ds, WORD minfree, WORD flags ) /* Previous arena is free (but < movesize) */ /* so we can 'slide' movearena down into it */ finalarena = pMoveArena->prev & ~3; - pFinalArena = ARENA_PTR(ptr, finalarena); - dprintf_local(stddeb, "Sliding arena %04x to %04x.\n", - movearena, finalarena); - LOCAL_RemoveFreeBlock(ptr, finalarena); - LOCAL_RemoveBlock(ptr, movearena); - mcp = (char *)pMoveArena + ARENA_HEADER_SIZE; - fcp = (char *)pFinalArena + ARENA_HEADER_SIZE; - for(i = 0; i < movesize - ARENA_HEADER_SIZE; i++) - *(fcp++) = *(mcp++); - LOCAL_AddBlock(ptr, finalarena, finalarena + movesize); - LOCAL_MakeBlockFree(ptr, finalarena + movesize); + LOCAL_GrowArenaDownward( ds, movearena, movesize ); /* Update handle table entry */ pEntry->addr = finalarena + ARENA_HEADER_SIZE; } @@ -753,21 +793,13 @@ static HLOCAL16 LOCAL_GetBlock( HANDLE16 ds, WORD size, WORD flags ) /* Make a block out of the free arena */ pArena = ARENA_PTR( ptr, arena ); - dprintf_local( stddeb, "LOCAL_GetBlock size = %04x, arena at %04x size %04x\n", size, - arena, pArena->size ); - if (pArena->size > size + LALIGN(sizeof(LOCALARENA))) - { - LOCAL_AddBlock( ptr, arena, arena+size ); - LOCAL_MakeBlockFree( ptr, arena+size ); - pInfo->items++; - } + dprintf_local(stddeb, "LOCAL_GetBlock size = %04x, arena %04x size %04x\n", + size, arena, pArena->size ); LOCAL_RemoveFreeBlock( ptr, arena ); + LOCAL_ShrinkArena( ds, arena, size ); - if (flags & LMEM_ZEROINIT) { - memset( (char *)pArena + ARENA_HEADER_SIZE, 0, size - ARENA_HEADER_SIZE ); - } - - dprintf_local( stddeb, "Local_GetBlock: arena at %04x\n", arena ); + if (flags & LMEM_ZEROINIT) memset( (char *)pArena + ARENA_HEADER_SIZE, 0, + size - ARENA_HEADER_SIZE ); return arena + ARENA_HEADER_SIZE; } @@ -1000,7 +1032,26 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) if (!(pInfo = LOCAL_GetHeap( ds ))) return 0; if (HANDLE_FIXED( handle )) blockhandle = handle; - else blockhandle = *(WORD *)(ptr + handle); + else + { + pEntry = (LOCALHANDLEENTRY *) (ptr + handle); + if(pEntry->flags & (LMEM_DISCARDED >> 8)) + { + dprintf_local(stddeb, "ReAllocating discarded block\n"); + if (!(pEntry->addr = LOCAL_GetBlock( ds, size, flags))) return 0; + ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); /* Reload ptr */ + pEntry = (LOCALHANDLEENTRY *) (ptr + handle); + pEntry->flags = (BYTE) (flags >> 8); + pEntry->lock = 0; + return handle; + } + if (!(blockhandle = pEntry->addr)) + { + fprintf( stderr, "Local_ReAlloc(%04x,%04x): invalid handle\n", + ds, handle ); + return 0; + } + } arena = ARENA_HEADER( blockhandle ); dprintf_local( stddeb, "LocalReAlloc: arena is %04x\n", arena ); @@ -1057,15 +1108,15 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) /* Check for size reduction */ - if (nextarena < pArena->next) + if (nextarena <= pArena->next) { if (nextarena < pArena->next - LALIGN(sizeof(LOCALARENA))) { dprintf_local( stddeb, "size reduction, making new free block\n"); /* It is worth making a new free block */ LOCAL_AddBlock( ptr, arena, nextarena ); - LOCAL_MakeBlockFree( ptr, nextarena ); pInfo->items++; + LOCAL_FreeArena( ds, nextarena ); } dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", handle ); return handle; @@ -1083,8 +1134,8 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) dprintf_local( stddeb, "size increase, making new free block\n"); /* It is worth making a new free block */ LOCAL_AddBlock( ptr, arena, nextarena ); - LOCAL_MakeBlockFree( ptr, nextarena ); pInfo->items++; + LOCAL_FreeArena( ds, nextarena ); } dprintf_local( stddeb, "LocalReAlloc: returning %04x\n", handle ); return handle; @@ -1099,16 +1150,30 @@ HLOCAL16 LOCAL_ReAlloc( HANDLE16 ds, HLOCAL16 handle, WORD size, WORD flags ) return 0; /* FIXME: should we free it here? */ } - if (!(newhandle = LOCAL_GetBlock( ds, size, flags ))) return 0; - ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); - memcpy( ptr + newhandle, ptr + (arena + ARENA_HEADER_SIZE), size ); - LOCAL_FreeArena( ds, arena ); + newhandle = LOCAL_GetBlock( ds, size, flags ); + ptr = PTR_SEG_OFF_TO_LIN( ds, 0 ); /* Reload ptr */ + if (!newhandle) + { + /* Check if previous block is free and large enough */ + LOCALARENA *pPrev = ARENA_PTR( ptr, pArena->prev & 3 ); + if (((pPrev->prev & 3) == LOCAL_ARENA_FREE) && + (pPrev->size + pArena->next >= nextarena)) + { + newhandle = (pArena->prev & ~3) + ARENA_HEADER_SIZE; + LOCAL_GrowArenaDownward( ds, arena, size + ARENA_HEADER_SIZE ); + } + else return 0; /* Nothing to do, no space left for the block */ + } + else + { + memcpy( ptr + newhandle, ptr + (arena + ARENA_HEADER_SIZE), size ); + LOCAL_FreeArena( ds, arena ); + } if (HANDLE_MOVEABLE( handle )) { dprintf_local( stddeb, "LocalReAlloc: fixing handle\n"); pEntry = (LOCALHANDLEENTRY *)(ptr + handle); pEntry->addr = newhandle; - pEntry->flags |= ~(LMEM_DISCARDED >> 8); /* clear discarded flag */ pEntry->lock = 0; newhandle = handle; } @@ -1331,7 +1396,7 @@ SEGPTR LocalLock16( HLOCAL16 handle ) /*********************************************************************** * LocalUnlock16 (KERNEL.9) */ -BOOL LocalUnlock16( HLOCAL16 handle ) +BOOL16 LocalUnlock16( HLOCAL16 handle ) { return LOCAL_Unlock( CURRENT_DS, handle ); } @@ -1608,7 +1673,7 @@ UINT32 LocalSize32( HLOCAL32 handle ) /*********************************************************************** * LocalUnlock32 (KERNEL32.381) */ -BOOL LocalUnlock32( HLOCAL32 handle ) +BOOL32 LocalUnlock32( HLOCAL32 handle ) { return GlobalUnlock32( (HGLOBAL32)handle ); } diff --git a/misc/commdlg.c b/misc/commdlg.c index 0789843bcc3..84143c5a143 100644 --- a/misc/commdlg.c +++ b/misc/commdlg.c @@ -207,7 +207,7 @@ static LPSTR FILEDLG_GetFileType(LPSTR cfptr, LPSTR fptr, WORD index) */ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) { - LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT)PTR_SEG_TO_LIN(lParam); + LPDRAWITEMSTRUCT16 lpdis = (LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam); char str[512]; HBRUSH hBrush; HBITMAP hBitmap, hPrevBitmap; @@ -218,13 +218,13 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst1) { hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH)); SelectObject(lpdis->hDC, hBrush); - FillRect(lpdis->hDC, &lpdis->rcItem, hBrush); + FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush); SendMessage(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, (LPARAM)MAKE_SEGPTR(str)); - TextOut(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, - str, strlen(str)); + TextOut16(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, + str, strlen(str)); if (lpdis->itemState != 0) { - InvertRect(lpdis->hDC, &lpdis->rcItem); + InvertRect16(lpdis->hDC, &lpdis->rcItem); } return TRUE; } @@ -232,14 +232,14 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) if (lpdis->CtlType == ODT_LISTBOX && lpdis->CtlID == lst2) { hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH)); SelectObject(lpdis->hDC, hBrush); - FillRect(lpdis->hDC, &lpdis->rcItem, hBrush); + FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush); SendMessage(lpdis->hwndItem, LB_GETTEXT, lpdis->itemID, (LPARAM)MAKE_SEGPTR(str)); hBitmap = hFolder; GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); - TextOut(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth, - lpdis->rcItem.top, str, strlen(str)); + TextOut16(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth, + lpdis->rcItem.top, str, strlen(str)); hMemDC = CreateCompatibleDC(lpdis->hDC); hPrevBitmap = SelectObject(hMemDC, hBitmap); BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, @@ -247,14 +247,14 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) SelectObject(hMemDC, hPrevBitmap); DeleteDC(hMemDC); if (lpdis->itemState != 0) { - InvertRect(lpdis->hDC, &lpdis->rcItem); + InvertRect16(lpdis->hDC, &lpdis->rcItem); } return TRUE; } if (lpdis->CtlType == ODT_COMBOBOX && lpdis->CtlID == cmb2) { hBrush = SelectObject(lpdis->hDC, GetStockObject(LTGRAY_BRUSH)); SelectObject(lpdis->hDC, hBrush); - FillRect(lpdis->hDC, &lpdis->rcItem, hBrush); + FillRect16(lpdis->hDC, &lpdis->rcItem, hBrush); SendMessage(lpdis->hwndItem, CB_GETLBTEXT, lpdis->itemID, (LPARAM)MAKE_SEGPTR(str)); switch(DRIVE_GetType( str[2] - 'a' )) @@ -266,8 +266,8 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) default: hBitmap = hHDisk; break; } GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); - TextOut(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth, - lpdis->rcItem.top, str, strlen(str)); + TextOut16(lpdis->hDC, lpdis->rcItem.left + bm.bmWidth, + lpdis->rcItem.top, str, strlen(str)); hMemDC = CreateCompatibleDC(lpdis->hDC); hPrevBitmap = SelectObject(hMemDC, hBitmap); BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, @@ -275,7 +275,7 @@ static LONG FILEDLG_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam) SelectObject(hMemDC, hPrevBitmap); DeleteDC(hMemDC); if (lpdis->itemState != 0) { - InvertRect(lpdis->hDC, &lpdis->rcItem); + InvertRect16(lpdis->hDC, &lpdis->rcItem); } return TRUE; } @@ -389,7 +389,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) if (lpofn->Flags & OFN_HIDEREADONLY) ShowWindow(GetDlgItem(hWnd, chx1), SW_HIDE); if (FILEDLG_HookCallChk(lpofn)) - return (BOOL)CallWindowProc(lpofn->lpfnHook, + return (BOOL)CallWindowProc16(lpofn->lpfnHook, hWnd, WM_INITDIALOG, wParam,(LPARAM)MAKE_SEGPTR(lpofn)); else return TRUE; @@ -430,8 +430,8 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) SendDlgItemMessage(hWnd, edt1, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(tmpstr)); if (FILEDLG_HookCallChk(lpofn)) - CallWindowProc (lpofn->lpfnHook, hWnd, - RegisterWindowMessage(MAKE_SEGPTR(LBSELCHSTRING)), + CallWindowProc16(lpofn->lpfnHook, hWnd, + RegisterWindowMessage32A( LBSELCHSTRING ), control, MAKELONG(lRet,CD_LBSELCHANGE)); /* FIXME: for OFN_ALLOWMULTISELECT we need CD_LBSELSUB, CD_SELADD, CD_LBSELNOITEMS */ return TRUE; @@ -567,8 +567,8 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) } if (FILEDLG_HookCallChk(lpofn)) { - lRet= (BOOL)CallWindowProc (lpofn->lpfnHook, - hWnd, RegisterWindowMessage(MAKE_SEGPTR(FILEOKSTRING)), + lRet= (BOOL)CallWindowProc16(lpofn->lpfnHook, + hWnd, RegisterWindowMessage32A( FILEOKSTRING ), 0, (LPARAM)MAKE_SEGPTR(lpofn)); if (lRet) { @@ -599,7 +599,7 @@ LRESULT FileOpenDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) if (wMsg!=WM_INITDIALOG) if (FILEDLG_HookCallChk(lpofn)) { - LRESULT lRet=(BOOL)CallWindowProc(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam); + LRESULT lRet=(BOOL)CallWindowProc16(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam); if (lRet) return lRet; /* else continue message processing */ } @@ -642,7 +642,7 @@ LRESULT FileSaveDlgProc(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) if (wMsg!=WM_INITDIALOG) if (FILEDLG_HookCallChk(lpofn)) { - LRESULT lRet=(BOOL)CallWindowProc(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam); + LRESULT lRet=(BOOL)CallWindowProc16(lpofn->lpfnHook, hWnd, wMsg, wParam, lParam); if (lRet) return lRet; /* else continue message processing */ } @@ -806,8 +806,8 @@ static LRESULT FINDDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) static LRESULT FINDDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { LPFINDREPLACE lpfr; - int uFindReplaceMessage = RegisterWindowMessage(MAKE_SEGPTR(FINDMSGSTRING)); - int uHelpMessage = RegisterWindowMessage(MAKE_SEGPTR(HELPMSGSTRING)); + int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING ); + int uHelpMessage = RegisterWindowMessage32A( HELPMSGSTRING ); lpfr = (LPFINDREPLACE)GetWindowLong(hWnd, DWL_USER); switch (wParam) { @@ -898,8 +898,8 @@ static LRESULT REPLACEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam) static LRESULT REPLACEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) { LPFINDREPLACE lpfr; - int uFindReplaceMessage = RegisterWindowMessage(MAKE_SEGPTR(FINDMSGSTRING)); - int uHelpMessage = RegisterWindowMessage(MAKE_SEGPTR(HELPMSGSTRING)); + int uFindReplaceMessage = RegisterWindowMessage32A( FINDMSGSTRING ); + int uHelpMessage = RegisterWindowMessage32A( HELPMSGSTRING ); lpfr = (LPFINDREPLACE)GetWindowLong(hWnd, DWL_USER); switch (wParam) { @@ -1124,10 +1124,10 @@ struct CCPRIVATE int nextuserdef; /* next free place in user defined color array */ HDC hdcMem; /* color graph used for BitBlt() */ HBITMAP hbmMem; /* color graph bitmap */ - RECT fullsize; /* original dialog window size */ + RECT16 fullsize; /* original dialog window size */ UINT msetrgb; /* # of SETRGBSTRING message (today not used) */ - RECT old3angle; /* last position of l-marker */ - RECT oldcross; /* last position of color/satuation marker */ + RECT16 old3angle; /* last position of l-marker */ + RECT16 oldcross; /* last position of color/satuation marker */ BOOL updating; /* to prevent recursive WM_COMMAND/EN_UPDATE procesing */ int h; int s; @@ -1255,21 +1255,18 @@ static int CC_MouseCheckPredefColorArray(HWND hDlg,int dlgitem,int rows,int cols LPARAM lParam,COLORREF *cr) { HWND hwnd; - POINT point; - RECT rect; + POINT16 point = MAKEPOINT16(lParam); + RECT16 rect; int dx,dy,x,y; - point.x=LOWORD(lParam); - point.y=HIWORD(lParam); - ClientToScreen(hDlg,&point); - + ClientToScreen16(hDlg,&point); hwnd=GetDlgItem(hDlg,dlgitem); - GetWindowRect(hwnd,&rect); - if (PtInRect(&rect,point)) + GetWindowRect16(hwnd,&rect); + if (PtInRect16(&rect,point)) { dx=(rect.right-rect.left)/cols; dy=(rect.bottom-rect.top)/rows; - ScreenToClient(hwnd,&point); + ScreenToClient16(hwnd,&point); if (point.x % dx < (dx-DISTANCE) && point.y % dy < (dy-DISTANCE)) { @@ -1290,21 +1287,18 @@ static int CC_MouseCheckUserColorArray(HWND hDlg,int dlgitem,int rows,int cols, LPARAM lParam,COLORREF *cr,COLORREF*crarr) { HWND hwnd; - POINT point; - RECT rect; + POINT16 point = MAKEPOINT16(lParam); + RECT16 rect; int dx,dy,x,y; - point.x=LOWORD(lParam); - point.y=HIWORD(lParam); - ClientToScreen(hDlg,&point); - + ClientToScreen16(hDlg,&point); hwnd=GetDlgItem(hDlg,dlgitem); - GetWindowRect(hwnd,&rect); - if (PtInRect(&rect,point)) + GetWindowRect16(hwnd,&rect); + if (PtInRect16(&rect,point)) { dx=(rect.right-rect.left)/cols; dy=(rect.bottom-rect.top)/rows; - ScreenToClient(hwnd,&point); + ScreenToClient16(hwnd,&point); if (point.x % dx < (dx-DISTANCE) && point.y % dy < (dy-DISTANCE)) { @@ -1334,19 +1328,17 @@ static int CC_MouseCheckUserColorArray(HWND hDlg,int dlgitem,int rows,int cols, static int CC_MouseCheckColorGraph(HWND hDlg,int dlgitem,int *hori,int *vert,LPARAM lParam) { HWND hwnd; - POINT point; - RECT rect; + POINT16 point = MAKEPOINT16(lParam); + RECT16 rect; long x,y; - point.x=LOWORD(lParam); - point.y=HIWORD(lParam); - ClientToScreen(hDlg,&point); + ClientToScreen16(hDlg,&point); hwnd=GetDlgItem(hDlg,dlgitem); - GetWindowRect(hwnd,&rect); - if (PtInRect(&rect,point)) + GetWindowRect16(hwnd,&rect); + if (PtInRect16(&rect,point)) { - GetClientRect(hwnd,&rect); - ScreenToClient(hwnd,&point); + GetClientRect16(hwnd,&rect); + ScreenToClient16(hwnd,&point); x=(long)point.x*MAXHORI; x/=rect.right; @@ -1368,14 +1360,13 @@ static int CC_MouseCheckColorGraph(HWND hDlg,int dlgitem,int *hori,int *vert,LPA static int CC_MouseCheckResultWindow(HWND hDlg,LPARAM lParam) { HWND hwnd; - POINT point; - RECT rect; - point.x=LOWORD(lParam); - point.y=HIWORD(lParam); - ClientToScreen(hDlg,&point); + POINT16 point = MAKEPOINT16(lParam); + RECT16 rect; + + ClientToScreen16(hDlg,&point); hwnd=GetDlgItem(hDlg,0x2c5); - GetWindowRect(hwnd,&rect); - if (PtInRect(&rect,point)) + GetWindowRect16(hwnd,&rect); + if (PtInRect16(&rect,point)) { PostMessage(hDlg,WM_COMMAND,0x2c9,0); return 1; @@ -1429,14 +1420,14 @@ static int CC_CheckDigitsInEdit(HWND hwnd,int maxval) */ static void CC_PaintSelectedColor(HWND hDlg,COLORREF cr) { - RECT rect; + RECT16 rect; HDC hdc; HBRUSH hBrush; HWND hwnd=GetDlgItem(hDlg,0x2c5); if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */ { hdc=GetDC(hwnd); - GetClientRect (hwnd, &rect) ; + GetClientRect16 (hwnd, &rect) ; hBrush = CreateSolidBrush(cr); if (hBrush) { @@ -1463,25 +1454,25 @@ static void CC_PaintTriangle(HWND hDlg,int y) HDC hDC; long temp; int w=GetDialogBaseUnits(); - POINT points[3]; + POINT16 points[3]; int height; int oben; - RECT rect; + RECT16 rect; HWND hwnd=GetDlgItem(hDlg,0x2be); struct CCPRIVATE *lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */ { - GetClientRect(hwnd,&rect); + GetClientRect16(hwnd,&rect); height=rect.bottom; hDC=GetDC(hDlg); points[0].y=rect.top; - points[0].x=rect.right; /* | /| */ - ClientToScreen(hwnd,points); /* | / | */ - ScreenToClient(hDlg,points); /* |< | */ - oben=points[0].y; /* | \ | */ - /* | \| */ + points[0].x=rect.right; /* | /| */ + ClientToScreen16(hwnd,points); /* | / | */ + ScreenToClient16(hDlg,points); /* |< | */ + oben=points[0].y; /* | \ | */ + /* | \| */ temp=(long)height*(long)y; points[0].y=oben+height -temp/(long)MAXVERT; points[1].y=points[0].y+w; @@ -1489,12 +1480,12 @@ static void CC_PaintTriangle(HWND hDlg,int y) points[2].x=points[1].x=points[0].x + w; if (lpp->old3angle.left) - FillRect(hDC,&lpp->old3angle,GetStockObject(WHITE_BRUSH)); + FillRect16(hDC,&lpp->old3angle,GetStockObject(WHITE_BRUSH)); lpp->old3angle.left =points[0].x; lpp->old3angle.right =points[1].x+1; lpp->old3angle.top =points[2].y-1; lpp->old3angle.bottom=points[1].y+1; - Polygon(hDC,points,3); + Polygon16(hDC,points,3); ReleaseDC(hDlg,hDC); } } @@ -1509,15 +1500,15 @@ static void CC_PaintCross(HWND hDlg,int x,int y) int w=GetDialogBaseUnits(); HWND hwnd=GetDlgItem(hDlg,0x2c6); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); - RECT rect; - POINT point; - HPEN hPen; + RECT16 rect; + POINT16 point; + HPEN16 hPen; if (IsWindowVisible(GetDlgItem(hDlg,0x2c6))) /* if full size */ { - GetClientRect(hwnd,&rect); + GetClientRect16(hwnd,&rect); hDC=GetDC(hwnd); - SelectClipRgn(hDC,CreateRectRgnIndirect(&rect)); + SelectClipRgn(hDC,CreateRectRgnIndirect16(&rect)); hPen=CreatePen(PS_SOLID,2,0); hPen=SelectObject(hDC,hPen); point.x=((long)rect.right*(long)x)/(long)MAXHORI; @@ -1556,10 +1547,10 @@ static void CC_PrepareColorGraph(HWND hDlg) struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); HBRUSH hbrush; HDC hdc ; - RECT rect,client; + RECT16 rect,client; HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT)); - GetClientRect(hwnd,&client); + GetClientRect16(hwnd,&client); hdc=GetDC(hwnd); lpp->hdcMem = CreateCompatibleDC(hdc); lpp->hbmMem = CreateCompatibleBitmap(hdc,client.right,client.bottom); @@ -1580,7 +1571,7 @@ static void CC_PrepareColorGraph(HWND hDlg) g=CC_HSLtoRGB('G',hue,sat,120); b=CC_HSLtoRGB('B',hue,sat,120); hbrush=CreateSolidBrush(RGB(r,g,b)); - FillRect(lpp->hdcMem,&rect,hbrush); + FillRect16(lpp->hdcMem,&rect,hbrush); DeleteObject(hbrush); rect.bottom=rect.top; } @@ -1598,14 +1589,14 @@ static void CC_PaintColorGraph(HWND hDlg) HWND hwnd=GetDlgItem(hDlg,0x2c6); struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); HDC hDC; - RECT rect; + RECT16 rect; if (IsWindowVisible(hwnd)) /* if full size */ { if (!lpp->hdcMem) CC_PrepareColorGraph(hDlg); /* should not be necessary */ hDC=GetDC(hwnd); - GetClientRect(hwnd,&rect); + GetClientRect16(hwnd,&rect); if (lpp->hdcMem) BitBlt(hDC,0,0,rect.right,rect.bottom,lpp->hdcMem,0,0,SRCCOPY); else @@ -1619,7 +1610,7 @@ static void CC_PaintColorGraph(HWND hDlg) static void CC_PaintLumBar(HWND hDlg,int hue,int sat) { HWND hwnd=GetDlgItem(hDlg,0x2be); - RECT rect,client; + RECT16 rect,client; int lum,ldif,ydif,r,g,b; HBRUSH hbrush; HDC hDC; @@ -1627,7 +1618,7 @@ static void CC_PaintLumBar(HWND hDlg,int hue,int sat) if (IsWindowVisible(hwnd)) { hDC=GetDC(hwnd); - GetClientRect(hwnd,&client); + GetClientRect16(hwnd,&client); rect=client; ldif=240/YSTEPS; @@ -1639,12 +1630,12 @@ static void CC_PaintLumBar(HWND hDlg,int hue,int sat) g=CC_HSLtoRGB('G',hue,sat,lum); b=CC_HSLtoRGB('B',hue,sat,lum); hbrush=CreateSolidBrush(RGB(r,g,b)); - FillRect(hDC,&rect,hbrush); + FillRect16(hDC,&rect,hbrush); DeleteObject(hbrush); rect.bottom=rect.top; } - GetClientRect(hwnd,&rect); - FrameRect(hDC,&rect,GetStockObject(BLACK_BRUSH)); + GetClientRect16(hwnd,&rect); + FrameRect16(hDC,&rect,GetStockObject(BLACK_BRUSH)); ReleaseDC(hwnd,hDC); } } @@ -1697,7 +1688,7 @@ static void CC_EditSetHSL(HWND hDlg,int h,int s,int l) /*********************************************************************** * CC_SwitchToFullSize [internal] */ -static void CC_SwitchToFullSize(HWND hDlg,COLORREF result,LPRECT lprect) +static void CC_SwitchToFullSize(HWND hDlg,COLORREF result,LPRECT16 lprect) { int i; struct CCPRIVATE * lpp=(struct CCPRIVATE *)GetWindowLong(hDlg, DWL_USER); @@ -1729,18 +1720,18 @@ static void CC_SwitchToFullSize(HWND hDlg,COLORREF result,LPRECT lprect) static void CC_PaintPredefColorArray(HWND hDlg,int rows,int cols) { HWND hwnd=GetDlgItem(hDlg,0x2d0); - RECT rect; + RECT16 rect; HDC hdc; HBRUSH hBrush; int dx,dy,i,j,k; - GetClientRect(hwnd,&rect); + GetClientRect16(hwnd,&rect); dx=rect.right/cols; dy=rect.bottom/rows; k=rect.left; hdc=GetDC(hwnd); - GetClientRect (hwnd, &rect) ; + GetClientRect16 (hwnd, &rect) ; for (j=0;jlpcc->Flags & CC_SHOWHELP)) ShowWindow(GetDlgItem(hDlg,0x40e),SW_HIDE); - lpp->msetrgb=RegisterWindowMessage(MAKE_SEGPTR(SETRGBSTRING)); + lpp->msetrgb=RegisterWindowMessage32A( SETRGBSTRING ); #if 0 cpos=MAKELONG(5,7); /* init */ if (lpp->lpcc->Flags & CC_RGBINIT) @@ -1857,7 +1848,7 @@ static LONG CC_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) found: /* FIXME: Draw_a_focus_rect & set_init_values */ #endif - GetWindowRect(hDlg,&lpp->fullsize); + GetWindowRect16(hDlg,&lpp->fullsize); if (lpp->lpcc->Flags & CC_FULLOPEN || lpp->lpcc->Flags & CC_PREVENTFULLOPEN) { hwnd=GetDlgItem(hDlg,0x2cf); @@ -1869,9 +1860,9 @@ static LONG CC_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) res=rect.bottom-rect.top; hwnd=GetDlgItem(hDlg,0x2c6); /* cut at left border */ point.x=point.y=0; - ClientToScreen(hwnd,&point); - ScreenToClient(hDlg,&point); - GetClientRect(hDlg,&rect); + ClientToScreen16(hwnd,&point); + ScreenToClient16(hDlg,&point); + GetClientRect16(hDlg,&rect); point.x+=GetSystemMetrics(SM_CXDLGFRAME); SetWindowPos(hDlg,NULL,0,0,point.x,res,SWP_NOMOVE|SWP_NOZORDER); @@ -1884,7 +1875,7 @@ static LONG CC_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) for (i=0x2bf;i<0x2c5;i++) SendMessage(GetDlgItem(hDlg,i),EM_LIMITTEXT,3,0); /* max 3 digits: xyz */ if (CC_HookCallChk(lpp->lpcc)) - res=CallWindowProc((FARPROC)lpp->lpcc->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); + res=CallWindowProc16((FARPROC)lpp->lpcc->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); return res; } @@ -1960,7 +1951,7 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) case 0x2cf: CC_SwitchToFullSize(hDlg,lpp->lpcc->rgbResult,&lpp->fullsize); - InvalidateRect(hDlg,NULL,NULL); + InvalidateRect32( hDlg, NULL, TRUE ); SetFocus(GetDlgItem(hDlg,0x2bf)); break; @@ -1990,16 +1981,16 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) break; case 0x40e: /* Help! */ /* The Beatles, 1965 ;-) */ - i=RegisterWindowMessage(MAKE_SEGPTR(HELPMSGSTRING)); + i=RegisterWindowMessage32A( HELPMSGSTRING ); if (lpp->lpcc->hwndOwner) SendMessage(lpp->lpcc->hwndOwner,i,0,(LPARAM)lpp->lpcc); if (CC_HookCallChk(lpp->lpcc)) - CallWindowProc((FARPROC)lpp->lpcc->lpfnHook,hDlg, + CallWindowProc16((FARPROC)lpp->lpcc->lpfnHook,hDlg, WM_COMMAND,psh15,(LPARAM)lpp->lpcc); break; case IDOK : - cokmsg=RegisterWindowMessage(MAKE_SEGPTR(COLOROKSTRING)); + cokmsg=RegisterWindowMessage32A( COLOROKSTRING ); if (lpp->lpcc->hwndOwner) if (SendMessage(lpp->lpcc->hwndOwner,cokmsg,0,(LPARAM)lpp->lpcc)) break; /* do NOT close */ @@ -2032,11 +2023,11 @@ static LRESULT CC_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam) CC_PaintSelectedColor(hDlg,lpp->lpcc->rgbResult); /* special necessary for Wine */ - ValidateRect(GetDlgItem(hDlg,0x2d0),NULL); - ValidateRect(GetDlgItem(hDlg,0x2d1),NULL); - ValidateRect(GetDlgItem(hDlg,0x2c6),NULL); - ValidateRect(GetDlgItem(hDlg,0x2be),NULL); - ValidateRect(GetDlgItem(hDlg,0x2c5),NULL); + ValidateRect32(GetDlgItem(hDlg,0x2d0),NULL); + ValidateRect32(GetDlgItem(hDlg,0x2d1),NULL); + ValidateRect32(GetDlgItem(hDlg,0x2c6),NULL); + ValidateRect32(GetDlgItem(hDlg,0x2be),NULL); + ValidateRect32(GetDlgItem(hDlg,0x2c5),NULL); /* hope we can remove it later -->FIXME */ return 0; } @@ -2104,7 +2095,7 @@ LRESULT ColorDlgProc(HWND hDlg, UINT message, return FALSE; res=0; if (CC_HookCallChk(lpp->lpcc)) - res=CallWindowProc((FARPROC)lpp->lpcc->lpfnHook,hDlg,message,wParam,lParam); + res=CallWindowProc16((FARPROC)lpp->lpcc->lpfnHook,hDlg,message,wParam,lParam); if (res) return res; } @@ -2239,9 +2230,10 @@ int FontStyleEnumProc(LPLOGFONT lplf ,LPTEXTMETRIC lptm, int nFontType, LPARAM l i=0; while (sizes[i]) { - sprintf(buffer,"%3d",sizes[i++]); - j=SendMessage(hcmb3,CB_ADDSTRING,0,(LPARAM)MAKE_SEGPTR(buffer)); + sprintf(buffer,"%d",sizes[i]); + j=SendMessage(hcmb3,CB_INSERTSTRING,-1,(LPARAM)MAKE_SEGPTR(buffer)); SendMessage(hcmb3, CB_SETITEMDATA, j, MAKELONG(sizes[i],0)); + i++; } } } @@ -2391,7 +2383,7 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam) ReleaseDC(hDlg,hdc); res=TRUE; if (CFn_HookCallChk(lpcf)) - res=CallWindowProc(lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); + res=CallWindowProc16(lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); SetCursor(hcursor); return res; } @@ -2422,23 +2414,23 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) char buffer[40]; BITMAP bm; COLORREF cr; - RECT rect; + RECT16 rect; #if 0 HDC hMemDC; int nFontType; HBITMAP hBitmap; /* for later TT usage */ #endif - LPDRAWITEMSTRUCT lpdi = (LPDRAWITEMSTRUCT)PTR_SEG_TO_LIN(lParam); + LPDRAWITEMSTRUCT16 lpdi = (LPDRAWITEMSTRUCT16)PTR_SEG_TO_LIN(lParam); if (lpdi->itemID == 0xFFFF) /* got no items */ - DrawFocusRect(lpdi->hDC, &lpdi->rcItem); + DrawFocusRect16(lpdi->hDC, &lpdi->rcItem); else { if (lpdi->CtlType == ODT_COMBOBOX) { hBrush = SelectObject(lpdi->hDC, GetStockObject(LTGRAY_BRUSH)); SelectObject(lpdi->hDC, hBrush); - FillRect(lpdi->hDC, &lpdi->rcItem, hBrush); + FillRect16(lpdi->hDC, &lpdi->rcItem, hBrush); } else return TRUE; /* this should never happen */ @@ -2450,8 +2442,8 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) SendMessage(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)MAKE_SEGPTR(buffer)); GetObject(hBitmapTT, sizeof(BITMAP), (LPSTR)&bm); - TextOut(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10, - lpdi->rcItem.top, buffer, lstrlen(buffer)); + TextOut16(lpdi->hDC, lpdi->rcItem.left + bm.bmWidth + 10, + lpdi->rcItem.top, buffer, lstrlen(buffer)); #if 0 nFontType = SendMessage(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); /* FIXME: draw bitmap if truetype usage */ @@ -2470,15 +2462,15 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) case cmb3: /* dprintf_commdlg(stddeb,"WM_DRAWITEN cmb2,cmb3\n"); */ SendMessage(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)MAKE_SEGPTR(buffer)); - TextOut(lpdi->hDC, lpdi->rcItem.left, - lpdi->rcItem.top, buffer, lstrlen(buffer)); + TextOut16(lpdi->hDC, lpdi->rcItem.left, + lpdi->rcItem.top, buffer, lstrlen(buffer)); break; case cmb4: /* dprintf_commdlg(stddeb,"WM_DRAWITEM cmb4 (=COLOR)\n"); */ SendMessage(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)MAKE_SEGPTR(buffer)); - TextOut(lpdi->hDC, lpdi->rcItem.left + 25+5, - lpdi->rcItem.top, buffer, lstrlen(buffer)); + TextOut16(lpdi->hDC, lpdi->rcItem.left + 25+5, + lpdi->rcItem.top, buffer, lstrlen(buffer)); cr = SendMessage(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); hBrush = CreateSolidBrush(cr); if (hBrush) @@ -2498,7 +2490,7 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) default: return TRUE; /* this should never happen */ } if (lpdi->itemState ==ODS_SELECTED) - InvertRect(lpdi->hDC, &rect); + InvertRect16(lpdi->hDC, &rect); } return TRUE; } @@ -2622,15 +2614,15 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) if (i!=CB_ERR) { lpcf->rgbColors=textcolors[i]; - InvalidateRect(GetDlgItem(hDlg,stc6),NULL,0); + InvalidateRect32( GetDlgItem(hDlg,stc6), NULL, 0 ); } break; - case psh15:i=RegisterWindowMessage(MAKE_SEGPTR(HELPMSGSTRING)); + case psh15:i=RegisterWindowMessage32A( HELPMSGSTRING ); if (lpcf->hwndOwner) SendMessage(lpcf->hwndOwner,i,0,(LPARAM)lpcf); if (CFn_HookCallChk(lpcf)) - CallWindowProc(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf); + CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf); break; case IDOK:EndDialog(hDlg, TRUE); @@ -2657,7 +2649,7 @@ LRESULT FormatCharDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) if (!lpcf) return FALSE; if (CFn_HookCallChk(lpcf)) - res=CallWindowProc(lpcf->lpfnHook,hDlg,message,wParam,lParam); + res=CallWindowProc16(lpcf->lpfnHook,hDlg,message,wParam,lParam); if (res) return res; } diff --git a/misc/exec.c b/misc/exec.c index ad53f6b7621..a1982ce8ac9 100644 --- a/misc/exec.c +++ b/misc/exec.c @@ -111,7 +111,6 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) { static WORD WM_WINHELP=0; HWND hDest; - char szBuf[20]; LPWINHELP lpwh; HANDLE hwh; void *data=0; @@ -122,13 +121,11 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) /* FIXME: Should be directed yield, to let winhelp open the window */ Yield(); if(!WM_WINHELP) { - strcpy(szBuf,"WM_WINHELP"); - WM_WINHELP=RegisterWindowMessage(MAKE_SEGPTR(szBuf)); + WM_WINHELP=RegisterWindowMessage32A("WM_WINHELP"); if(!WM_WINHELP) return FALSE; } - strcpy(szBuf,"MS_WINHELP"); - hDest = FindWindow(MAKE_SEGPTR(szBuf),0); + hDest = FindWindow32A( "MS_WINHELP", NULL ); if(!hDest) return FALSE; switch(wCommand) diff --git a/misc/main.c b/misc/main.c index 233e7ed0143..d1e23adf421 100644 --- a/misc/main.c +++ b/misc/main.c @@ -564,9 +564,6 @@ int main( int argc, char *argv[] ) MAIN_ParseOptions( &argc, argv ); - SHELL_Init(); - SHELL_LoadRegistry(); - screen = DefaultScreenOfDisplay( display ); screenWidth = WidthOfScreen( screen ); screenHeight = HeightOfScreen( screen ); @@ -892,38 +889,45 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi break; case SPI_GETBORDER: - *(INT *) lpvParam = 1; + *(INT *)lpvParam = GetSystemMetrics( SM_CXFRAME ); break; case SPI_GETFASTTASKSWITCH: *(BOOL *) lpvParam = FALSE; + /* FIXME GetProfileInt( "windows", "CoolSwitch", 1 ) */ break; case SPI_GETGRIDGRANULARITY: *(INT *) lpvParam = 1; + /* FIXME GetProfileInt( "desktop", "GridGranularity", 1 ) */ break; case SPI_GETICONTITLEWRAP: *(BOOL *) lpvParam = FALSE; + /* FIXME GetProfileInt( "desktop", "?", True ) */ break; case SPI_GETKEYBOARDDELAY: *(INT *) lpvParam = 1; + /* FIXME */ break; case SPI_GETKEYBOARDSPEED: *(WORD *) lpvParam = 30; + /* FIXME */ break; case SPI_GETMENUDROPALIGNMENT: - *(BOOL *) lpvParam = FALSE; + *(BOOL *) lpvParam = GetSystemMetrics( SM_MENUDROPALIGNMENT ); /* XXX check this */ break; case SPI_GETSCREENSAVEACTIVE: + /* FIXME GetProfileInt( "windows", "ScreenSaveActive", 1 ); */ *(BOOL *) lpvParam = FALSE; break; case SPI_GETSCREENSAVETIMEOUT: + /* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */ XGetScreenSaver(display, &timeout, &temp,&temp,&temp); *(INT *) lpvParam = timeout * 1000; break; @@ -932,14 +936,14 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi if (lpvParam == NULL) fprintf(stderr, "SystemParametersInfo: Horizontal icon spacing set to %d\n.", uParam); else - *(INT *) lpvParam = 50; + *(INT *) lpvParam = GetSystemMetrics( SM_CXICONSPACING ); break; case SPI_ICONVERTICALSPACING: if (lpvParam == NULL) fprintf(stderr, "SystemParametersInfo: Vertical icon spacing set to %d\n.", uParam); else - *(INT *) lpvParam = 50; + *(INT *) lpvParam = GetSystemMetrics( SM_CYICONSPACING ); break; case SPI_SETBEEP: @@ -979,6 +983,7 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi case SPI_GETICONTITLELOGFONT: { + /* FIXME GetProfileString( "?", "?", "?" ) */ LPLOGFONT lpLogFont = (LPLOGFONT)lpvParam; lpLogFont->lfHeight = 10; lpLogFont->lfWidth = 0; diff --git a/misc/rect.c b/misc/rect.c index 68eb4625ad4..61d76c2cc3a 100644 --- a/misc/rect.c +++ b/misc/rect.c @@ -1,7 +1,7 @@ /* * Rectangle-related functions * - * Copyright 1993 Alexandre Julliard + * Copyright 1993, 1996 Alexandre Julliard * */ @@ -9,9 +9,9 @@ /*********************************************************************** - * SetRect (USER.72) + * SetRect16 (USER.72) */ -void SetRect( LPRECT rect, short left, short top, short right, short bottom ) +void SetRect16(LPRECT16 rect, INT16 left, INT16 top, INT16 right, INT16 bottom) { rect->left = left; rect->right = right; @@ -21,18 +21,39 @@ void SetRect( LPRECT rect, short left, short top, short right, short bottom ) /*********************************************************************** - * SetRectEmpty (USER.73) + * SetRect32 (USER32.498) */ -void SetRectEmpty( LPRECT rect ) +void SetRect32(LPRECT32 rect, INT32 left, INT32 top, INT32 right, INT32 bottom) +{ + rect->left = left; + rect->right = right; + rect->top = top; + rect->bottom = bottom; +} + + +/*********************************************************************** + * SetRectEmpty16 (USER.73) + */ +void SetRectEmpty16( LPRECT16 rect ) { rect->left = rect->right = rect->top = rect->bottom = 0; } /*********************************************************************** - * CopyRect (USER.74) + * SetRectEmpty32 (USER32.499) */ -BOOL CopyRect( LPRECT dest, LPRECT src ) +void SetRectEmpty32( LPRECT32 rect ) +{ + rect->left = rect->right = rect->top = rect->bottom = 0; +} + + +/*********************************************************************** + * CopyRect16 (USER.74) + */ +BOOL16 CopyRect16( RECT16 *dest, const RECT16 *src ) { *dest = *src; return TRUE; @@ -40,18 +61,37 @@ BOOL CopyRect( LPRECT dest, LPRECT src ) /*********************************************************************** - * IsRectEmpty (USER.75) + * CopyRect32 (USER32.61) */ -BOOL IsRectEmpty( LPRECT rect ) +BOOL32 CopyRect32( RECT32 *dest, const RECT32 *src ) +{ + *dest = *src; + return TRUE; +} + + +/*********************************************************************** + * IsRectEmpty16 (USER.75) + */ +BOOL16 IsRectEmpty16( const RECT16 *rect ) { return ((rect->left == rect->right) || (rect->top == rect->bottom)); } /*********************************************************************** - * PtInRect (USER.76) + * IsRectEmpty32 (USER32.346) */ -BOOL PtInRect( LPRECT rect, POINT pt ) +BOOL32 IsRectEmpty32( const RECT32 *rect ) +{ + return ((rect->left == rect->right) || (rect->top == rect->bottom)); +} + + +/*********************************************************************** + * PtInRect16 (USER.76) + */ +BOOL16 PtInRect16( const RECT16 *rect, POINT16 pt ) { return ((pt.x >= rect->left) && (pt.x < rect->right) && (pt.y >= rect->top) && (pt.y < rect->bottom)); @@ -59,9 +99,19 @@ BOOL PtInRect( LPRECT rect, POINT pt ) /*********************************************************************** - * OffsetRect (USER.77) + * PtInRect32 (USER32.423) */ -void OffsetRect( LPRECT rect, short x, short y ) +BOOL32 PtInRect32( const RECT32 *rect, POINT32 pt ) +{ + return ((pt.x >= rect->left) && (pt.x < rect->right) && + (pt.y >= rect->top) && (pt.y < rect->bottom)); +} + + +/*********************************************************************** + * OffsetRect16 (USER.77) + */ +void OffsetRect16( LPRECT16 rect, INT16 x, INT16 y ) { rect->left += x; rect->right += x; @@ -71,9 +121,21 @@ void OffsetRect( LPRECT rect, short x, short y ) /*********************************************************************** - * InflateRect (USER.78) + * OffsetRect32 (USER32.405) */ -void InflateRect( LPRECT rect, short x, short y ) +void OffsetRect32( LPRECT32 rect, INT32 x, INT32 y ) +{ + rect->left += x; + rect->right += x; + rect->top += y; + rect->bottom += y; +} + + +/*********************************************************************** + * InflateRect16 (USER.78) + */ +void InflateRect16( LPRECT16 rect, INT16 x, INT16 y ) { rect->left -= x; rect->top -= y; @@ -83,15 +145,27 @@ void InflateRect( LPRECT rect, short x, short y ) /*********************************************************************** - * IntersectRect (USER.79) + * InflateRect32 (USER32.320) */ -BOOL IntersectRect( LPRECT dest, LPRECT src1, LPRECT src2 ) +void InflateRect32( LPRECT32 rect, INT32 x, INT32 y ) { - if (IsRectEmpty(src1) || IsRectEmpty(src2) || + rect->left -= x; + rect->top -= y; + rect->right += x; + rect->bottom += y; +} + + +/*********************************************************************** + * IntersectRect16 (USER.79) + */ +BOOL16 IntersectRect16( LPRECT16 dest, const RECT16 *src1, const RECT16 *src2 ) +{ + if (IsRectEmpty16(src1) || IsRectEmpty16(src2) || (src1->left >= src2->right) || (src2->left >= src1->right) || (src1->top >= src2->bottom) || (src2->top >= src1->bottom)) { - SetRectEmpty( dest ); + SetRectEmpty16( dest ); return FALSE; } dest->left = MAX( src1->left, src2->left ); @@ -103,22 +177,42 @@ BOOL IntersectRect( LPRECT dest, LPRECT src1, LPRECT src2 ) /*********************************************************************** - * UnionRect (USER.80) + * IntersectRect32 (USER32.326) */ -BOOL UnionRect( LPRECT dest, LPRECT src1, LPRECT src2 ) +BOOL32 IntersectRect32( LPRECT32 dest, const RECT32 *src1, const RECT32 *src2 ) { - if (IsRectEmpty(src1)) + if (IsRectEmpty32(src1) || IsRectEmpty32(src2) || + (src1->left >= src2->right) || (src2->left >= src1->right) || + (src1->top >= src2->bottom) || (src2->top >= src1->bottom)) { - if (IsRectEmpty(src2)) + SetRectEmpty32( dest ); + return FALSE; + } + dest->left = MAX( src1->left, src2->left ); + dest->right = MIN( src1->right, src2->right ); + dest->top = MAX( src1->top, src2->top ); + dest->bottom = MIN( src1->bottom, src2->bottom ); + return TRUE; +} + + +/*********************************************************************** + * UnionRect16 (USER.80) + */ +BOOL16 UnionRect16( LPRECT16 dest, const RECT16 *src1, const RECT16 *src2 ) +{ + if (IsRectEmpty16(src1)) + { + if (IsRectEmpty16(src2)) { - SetRectEmpty( dest ); + SetRectEmpty16( dest ); return FALSE; } else *dest = *src2; } else { - if (IsRectEmpty(src2)) *dest = *src1; + if (IsRectEmpty16(src2)) *dest = *src1; else { dest->left = MIN( src1->left, src2->left ); @@ -132,9 +226,38 @@ BOOL UnionRect( LPRECT dest, LPRECT src1, LPRECT src2 ) /*********************************************************************** - * EqualRect (USER.244) + * UnionRect32 (USER32.558) */ -BOOL EqualRect( const RECT* rect1, const RECT* rect2 ) +BOOL32 UnionRect32( LPRECT32 dest, const RECT32 *src1, const RECT32 *src2 ) +{ + if (IsRectEmpty32(src1)) + { + if (IsRectEmpty32(src2)) + { + SetRectEmpty32( dest ); + return FALSE; + } + else *dest = *src2; + } + else + { + if (IsRectEmpty32(src2)) *dest = *src1; + else + { + dest->left = MIN( src1->left, src2->left ); + dest->right = MAX( src1->right, src2->right ); + dest->top = MIN( src1->top, src2->top ); + dest->bottom = MAX( src1->bottom, src2->bottom ); + } + } + return TRUE; +} + + +/*********************************************************************** + * EqualRect16 (USER.244) + */ +BOOL16 EqualRect16( const RECT16* rect1, const RECT16* rect2 ) { return ((rect1->left == rect2->left) && (rect1->right == rect2->right) && (rect1->top == rect2->top) && (rect1->bottom == rect2->bottom)); @@ -142,23 +265,33 @@ BOOL EqualRect( const RECT* rect1, const RECT* rect2 ) /*********************************************************************** - * SubtractRect (USER.373) + * EqualRect32 (USER32.193) */ -BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 ) +BOOL32 EqualRect32( const RECT32* rect1, const RECT32* rect2 ) { - RECT tmp; + return ((rect1->left == rect2->left) && (rect1->right == rect2->right) && + (rect1->top == rect2->top) && (rect1->bottom == rect2->bottom)); +} - if (IsRectEmpty( src1 )) + +/*********************************************************************** + * SubtractRect16 (USER.373) + */ +BOOL16 SubtractRect16( LPRECT16 dest, const RECT16 *src1, const RECT16 *src2 ) +{ + RECT16 tmp; + + if (IsRectEmpty16( src1 )) { - SetRectEmpty( dest ); + SetRectEmpty16( dest ); return FALSE; } *dest = *src1; - if (IntersectRect( &tmp, src1, src2 )) + if (IntersectRect16( &tmp, src1, src2 )) { - if (EqualRect( &tmp, dest )) + if (EqualRect16( &tmp, dest )) { - SetRectEmpty( dest ); + SetRectEmpty16( dest ); return FALSE; } if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom)) @@ -175,3 +308,37 @@ BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 ) return TRUE; } + +/*********************************************************************** + * SubtractRect32 (USER32.535) + */ +BOOL32 SubtractRect32( LPRECT32 dest, const RECT32 *src1, const RECT32 *src2 ) +{ + RECT32 tmp; + + if (IsRectEmpty32( src1 )) + { + SetRectEmpty32( dest ); + return FALSE; + } + *dest = *src1; + if (IntersectRect32( &tmp, src1, src2 )) + { + if (EqualRect32( &tmp, dest )) + { + SetRectEmpty32( dest ); + return FALSE; + } + if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom)) + { + if (tmp.left == dest->left) dest->left = tmp.right; + else if (tmp.right == dest->right) dest->right = tmp.left; + } + else if ((tmp.left == dest->left) && (tmp.right == dest->right)) + { + if (tmp.top == dest->top) dest->top = tmp.bottom; + else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top; + } + } + return TRUE; +} diff --git a/misc/registry.c b/misc/registry.c index 7dee810cd50..b9c781b4662 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -24,17 +25,22 @@ #include "xmalloc.h" #include "winreg.h" +#define MAKE_DWORD(x,y) ((DWORD)MAKELONG(x,y)) + /* FIXME: following defines should be configured global ... */ /* NOTE: do not append a /. linux' mkdir() WILL FAIL if you do that */ #define WINE_PREFIX "/.wine" -#define SAVE_CURRENT_USER_DEFAULT "/usr/local/etc/wine.userreg" - /* relative in ~user/.wine/ */ -#define SAVE_CURRENT_USER "user.reg" +#define SAVE_USERS_DEFAULT "/usr/local/etc/wine.userreg" #define SAVE_LOCAL_MACHINE_DEFAULT "/usr/local/etc/wine.systemreg" - /* relative in ~user/.wine/ */ + +/* relative in ~user/.wine/ : */ +#define SAVE_CURRENT_USER "user.reg" #define SAVE_LOCAL_MACHINE "system.reg" +#define KEY_REGISTRY "Software\\The WINE team\\WINE\\Registry" +#define VAL_SAVEUPDATED "SaveOnlyUpdatedKeys" + static KEYSTRUCT *key_classes_root=NULL; /* windows 3.1 global values */ static KEYSTRUCT *key_current_user=NULL; /* user specific values */ static KEYSTRUCT *key_local_machine=NULL;/* machine specific values */ @@ -205,7 +211,7 @@ SHELL_Init() { xx->keyname= strdupA2W(""); ADD_ROOT_KEY(key_local_machine); - if (RegCreateKey(HKEY_LOCAL_MACHINE,"\\SOFTWARE\\Classes",&cl_r_hkey)!=ERROR_SUCCESS) { + if (RegCreateKey16(HKEY_LOCAL_MACHINE,"\\SOFTWARE\\Classes",&cl_r_hkey)!=ERROR_SUCCESS) { fprintf(stderr,"couldn't create HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes. This is impossible.\n"); exit(1); } @@ -220,13 +226,13 @@ SHELL_Init() { while (pwd=getpwent()) { if (pwd->pw_name == NULL) continue; - RegCreateKey(HKEY_USERS,pwd->pw_name,&c_u_hkey); + RegCreateKey16(HKEY_USERS,pwd->pw_name,&c_u_hkey); RegCloseKey(c_u_hkey); } #endif pwd=getpwuid(getuid()); if (pwd && pwd->pw_name) { - RegCreateKey(HKEY_USERS,pwd->pw_name,&c_u_hkey); + RegCreateKey16(HKEY_USERS,pwd->pw_name,&c_u_hkey); key_current_user = lookup_hkey(c_u_hkey); } else { ADD_ROOT_KEY(key_current_user); @@ -262,19 +268,37 @@ SHELL_Init() { * int * * FIXME: doesn't save 'class' (what does it mean anyway?), nor flags. + * + * [HKEY_CURRENT_USER\\Software\\The WINE team\\WINE\\Registry] + * SaveOnlyUpdatedKeys=yes */ +static int +_save_check_tainted(LPKEYSTRUCT lpkey) { + int tainted; + + if (!lpkey) + return 0; + if (lpkey->flags & REG_OPTION_TAINTED) + tainted = 1; + else + tainted = 0; + while (lpkey) { + if (_save_check_tainted(lpkey->nextsub)) { + lpkey->flags |= REG_OPTION_TAINTED; + tainted = 1; + } + lpkey = lpkey->next; + } + return tainted; +} static void -_write_USTRING(FILE *F,LPWSTR wstr,int escapeeq) { +_save_USTRING(FILE *F,LPWSTR wstr,int escapeeq) { LPWSTR s; int doescape; - if (wstr==NULL) { - /* FIXME: NULL equals empty string... I hope - * the empty string isn't a valid valuename - */ + if (wstr==NULL) return; - } s=wstr; while (*s) { doescape=0; @@ -295,34 +319,36 @@ _write_USTRING(FILE *F,LPWSTR wstr,int escapeeq) { } static int -_do_save_subkey(FILE *F,LPKEYSTRUCT lpkey,int level) { +_savesubkey(FILE *F,LPKEYSTRUCT lpkey,int level,int all) { LPKEYSTRUCT lpxkey; int i,tabs,j; lpxkey = lpkey; while (lpxkey) { - if (!(lpxkey->flags & REG_OPTION_VOLATILE)) { + if ( !(lpxkey->flags & REG_OPTION_VOLATILE) && + (all || (lpxkey->flags & REG_OPTION_TAINTED)) + ) { for (tabs=level;tabs--;) fputc('\t',F); - _write_USTRING(F,lpxkey->keyname,1); + _save_USTRING(F,lpxkey->keyname,1); fputs("\n",F); for (i=0;inrofvalues;i++) { LPKEYVALUE val=lpxkey->values+i; for (tabs=level+1;tabs--;) fputc('\t',F); - _write_USTRING(F,val->name,0); + _save_USTRING(F,val->name,0); fputc('=',F); fprintf(F,"%ld,%ld,",val->type,val->lastmodified); if ((1<type) & UNICONVMASK) - _write_USTRING(F,(LPWSTR)val->data,0); + _save_USTRING(F,(LPWSTR)val->data,0); else for (j=0;jlen;j++) fprintf(F,"%02x",*((unsigned char*)val->data+j)); fputs("\n",F); } /* descend recursively */ - if (!_do_save_subkey(F,lpxkey->nextsub,level+1)) + if (!_savesubkey(F,lpxkey->nextsub,level+1,all)) return 0; } lpxkey=lpxkey->next; @@ -331,26 +357,27 @@ _do_save_subkey(FILE *F,LPKEYSTRUCT lpkey,int level) { } static int -_do_savesubreg(FILE *F,LPKEYSTRUCT lpkey) { +_savesubreg(FILE *F,LPKEYSTRUCT lpkey,int all) { fprintf(F,"WINE REGISTRY Version %d\n",REGISTRY_SAVE_VERSION); - return _do_save_subkey(F,lpkey->nextsub,0); + _save_check_tainted(lpkey->nextsub); + return _savesubkey(F,lpkey->nextsub,0,all); } static void -_SaveSubReg(LPKEYSTRUCT lpkey,char *fn) { +_savereg(LPKEYSTRUCT lpkey,char *fn,int all) { FILE *F; F=fopen(fn,"w"); if (F==NULL) { - fprintf(stddeb,__FILE__":_SaveSubReg:Couldn't open %s for writing: %s\n", + fprintf(stddeb,__FILE__":_savereg:Couldn't open %s for writing: %s\n", fn,strerror(errno) ); return; } - if (!_do_savesubreg(F,lpkey)) { + if (!_savesubreg(F,lpkey,all)) { fclose(F); unlink(fn); - fprintf(stddeb,__FILE__":_SaveSubReg:Failed to save keys, perhaps no more diskspace for %s?\n",fn); + fprintf(stddeb,__FILE__":_savereg:Failed to save keys, perhaps no more diskspace for %s?\n",fn); return; } fclose(F); @@ -360,34 +387,123 @@ void SHELL_SaveRegistry() { char *fn; struct passwd *pwd; + char buf[4]; + HKEY hkey; + int all; + all=0; + if (RegOpenKey16(HKEY_CURRENT_USER,KEY_REGISTRY,&hkey)!=ERROR_SUCCESS) { + strcpy(buf,"yes"); + } else { + DWORD len,junk,type; + + len=4; + if ( (ERROR_SUCCESS!=RegQueryValueEx32A( + hkey, + VAL_SAVEUPDATED, + &junk, + &type, + buf, + &len + ))|| (type!=REG_SZ) + ) + strcpy(buf,"yes"); + RegCloseKey(hkey); + } + if (strcasecmp(buf,"yes")) + all=1; pwd=getpwuid(getuid()); if (pwd!=NULL && pwd->pw_dir!=NULL) { - fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_CURRENT_USER)+2); + fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_USERS_DEFAULT)+2); strcpy(fn,pwd->pw_dir); strcat(fn,WINE_PREFIX); /* create the directory. don't care about errorcodes. */ mkdir(fn,0755); /* drwxr-xr-x */ strcat(fn,"/"SAVE_CURRENT_USER); - _SaveSubReg(key_current_user,fn); + _savereg(key_current_user,fn,all); free(fn); fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_LOCAL_MACHINE)+2); strcpy(fn,pwd->pw_dir); strcat(fn,WINE_PREFIX"/"SAVE_LOCAL_MACHINE); - _SaveSubReg(key_local_machine,fn); + _savereg(key_local_machine,fn,all); free(fn); - } else { + } else fprintf(stderr,"SHELL_SaveRegistry:failed to get homedirectory of UID %d.\n",getuid()); - } } /************************ LOAD Registry Function ****************************/ +static LPKEYSTRUCT +_find_or_add_key(LPKEYSTRUCT lpkey,LPWSTR keyname) { + LPKEYSTRUCT lpxkey,*lplpkey; + + lplpkey= &(lpkey->nextsub); + lpxkey = *lplpkey; + while (lpxkey) { + if (!strcmpW(lpxkey->keyname,keyname)) + break; + lplpkey = &(lpxkey->next); + lpxkey = *lplpkey; + } + if (lpxkey==NULL) { + *lplpkey = (LPKEYSTRUCT)xmalloc(sizeof(KEYSTRUCT)); + lpxkey = *lplpkey; + memset(lpxkey,'\0',sizeof(KEYSTRUCT)); + lpxkey->keyname = keyname; + } else + free(keyname); + return lpxkey; +} + +static void +_find_or_add_value( + LPKEYSTRUCT lpkey,LPWSTR name,DWORD type,LPBYTE data,DWORD len, + DWORD lastmodified +) { + LPKEYVALUE val=NULL; + int i; + + for (i=0;inrofvalues;i++) { + val=lpkey->values+i; + if (name==NULL) { + if (val->name==NULL) + break; + } else { + if ( val->name!=NULL && + !strcmpW(val->name,name) + ) + break; + } + } + if (i==lpkey->nrofvalues) { + lpkey->values = xrealloc( + lpkey->values, + (++lpkey->nrofvalues)*sizeof(KEYVALUE) + ); + val=lpkey->values+i; + memset(val,'\0',sizeof(KEYVALUE)); + val->name = name; + } else { + if (name) + free(name); + } + if (val->lastmodifiedlastmodified=lastmodified; + val->type = type; + val->len = len; + if (val->data) + free(val->data); + val->data = data; + } else + free(data); +} + + /* reads a line including dynamically enlarging the readbuffer and throwing * away comments */ static int -_read_line(FILE *F,char **buf,int *len) { +_wine_read_line(FILE *F,char **buf,int *len) { char *s,*curread; int mylen,curoff; @@ -429,7 +545,7 @@ _read_line(FILE *F,char **buf,int *len) { * and returns the position exactly after that string */ static char* -_read_USTRING(char *buf,LPWSTR *str) { +_wine_read_USTRING(char *buf,LPWSTR *str) { char *s; LPWSTR ws; @@ -453,7 +569,7 @@ _read_USTRING(char *buf,LPWSTR *str) { continue; } if (*s!='u') { - fprintf(stderr,"_read_USTRING:Non unicode escape sequence \\%c found in |%s|\n",*s,buf); + fprintf(stderr,"_wine_read_USTRING:Non unicode escape sequence \\%c found in |%s|\n",*s,buf); *ws++='\\'; *ws++=*s++; } else { @@ -463,7 +579,7 @@ _read_USTRING(char *buf,LPWSTR *str) { s++; memcpy(xbuf,s,4);xbuf[4]='\0'; if (!sscanf(xbuf,"%x",&wc)) - fprintf(stderr,"_read_USTRING:strange escape sequence %s found in |%s|\n",xbuf,buf); + fprintf(stderr,"_wine_read_USTRING:strange escape sequence %s found in |%s|\n",xbuf,buf); s+=4; *ws++ =(unsigned short)wc; } @@ -477,12 +593,16 @@ _read_USTRING(char *buf,LPWSTR *str) { } static int -_do_load_subkey(FILE *F,LPKEYSTRUCT lpkey,int level,char **buf,int *buflen) { - LPKEYSTRUCT lpxkey,*lplpkey; +_wine_loadsubkey( + FILE *F,LPKEYSTRUCT lpkey,int level,char **buf,int *buflen,int optflag +) { + LPKEYSTRUCT lpxkey; int i; char *s; LPWSTR name; + lpkey->flags |= optflag; + /* good. we already got a line here ... so parse it */ lpxkey = NULL; while (1) { @@ -493,94 +613,42 @@ _do_load_subkey(FILE *F,LPKEYSTRUCT lpkey,int level,char **buf,int *buflen) { } if (i>level) { if (lpxkey==NULL) { - fprintf(stderr,"_do_load_subkey:Got a subhierarchy without resp. key?\n"); + fprintf(stderr,"_load_subkey:Got a subhierarchy without resp. key?\n"); return 0; } - _do_load_subkey(F,lpxkey,level+1,buf,buflen); + _wine_loadsubkey(F,lpxkey,level+1,buf,buflen,optflag); continue; } /* let the caller handle this line */ if (inextsub); - lpxkey = *lplpkey; - while (lpxkey) { - if (!strcmpW(lpxkey->keyname,name)) - break; - lplpkey = &(lpxkey->next); - lpxkey = *lplpkey; - } - if (lpxkey==NULL) { - /* we have no key with that name yet. allocate - * it. - */ - *lplpkey = (LPKEYSTRUCT)xmalloc(sizeof(KEYSTRUCT)); - lpxkey = *lplpkey; - memset(lpxkey,'\0',sizeof(KEYSTRUCT)); - lpxkey->keyname = name; - } else { - /* already got it. we just remember it in - * 'lpxkey' - */ - free(name); - } + lpxkey=_find_or_add_key(lpkey,name); } else { - LPKEYVALUE val=NULL; LPBYTE data; int len,lastmodified,type; if (*s!='=') { - fprintf(stderr,"_do_load_subkey:unexpected character: %c\n",*s); + fprintf(stderr,"_wine_load_subkey:unexpected character: %c\n",*s); break; } - /* good. this looks like a value to me */ s++; - for (i=0;inrofvalues;i++) { - val=lpkey->values+i; - if (name==NULL) { - if (val->name==NULL) - break; - } else { - if ( val->name!=NULL && - !strcmpW(val->name,name) - ) - break; - } - } - if (i==lpkey->nrofvalues) { - lpkey->values = xrealloc( - lpkey->values, - (++lpkey->nrofvalues)*sizeof(KEYVALUE) - ); - val=lpkey->values+i; - memset(val,'\0',sizeof(KEYVALUE)); - val->name = name; - } else { - /* value already exists, free name */ - free(name); - } if (2!=sscanf(s,"%d,%d,",&type,&lastmodified)) { - fprintf(stderr,"_do_load_subkey: haven't understood possible value in |%s|, skipping.\n",*buf); + fprintf(stderr,"_wine_load_subkey: haven't understood possible value in |%s|, skipping.\n",*buf); break; } /* skip the 2 , */ s=strchr(s,',');s++; s=strchr(s,',');s++; if ((1<lastmodifiedlastmodified=lastmodified; - val->type = type; - val->len = len; - if (val->data) - free(val->data); - val->data = data; - } else { - free(data); - } + _find_or_add_value(lpkey,name,type,data,len,lastmodified); } } /* read the next line */ - if (!_read_line(F,buf,buflen)) + if (!_wine_read_line(F,buf,buflen)) return 1; } return 1; } static int -_do_loadsubreg(FILE *F,LPKEYSTRUCT lpkey) { +_wine_loadsubreg(FILE *F,LPKEYSTRUCT lpkey,int optflag) { int ver; char *buf; int buflen; buf=xmalloc(10);buflen=10; - if (!_read_line(F,&buf,&buflen)) { + if (!_wine_read_line(F,&buf,&buflen)) { free(buf); return 0; } @@ -641,20 +700,16 @@ _do_loadsubreg(FILE *F,LPKEYSTRUCT lpkey) { return 0; } if (ver!=REGISTRY_SAVE_VERSION) { - dprintf_reg(stddeb,__FILE__":_do_loadsubreg:Old format (%d) registry found, ignoring it. (buf was %s).\n",ver,buf); + dprintf_reg(stddeb,__FILE__":_wine_loadsubreg:Old format (%d) registry found, ignoring it. (buf was %s).\n",ver,buf); free(buf); return 0; } - if (!_read_line(F,&buf,&buflen)) { + if (!_wine_read_line(F,&buf,&buflen)) { free(buf); return 0; } - if (!_do_load_subkey(F,lpkey,0,&buf,&buflen)) { + if (!_wine_loadsubkey(F,lpkey,0,&buf,&buflen,optflag)) { free(buf); - /* FIXME: memory leak on failure to read registry ... - * But this won't happen very often. - */ - lpkey->nextsub=NULL; return 0; } free(buf); @@ -662,7 +717,7 @@ _do_loadsubreg(FILE *F,LPKEYSTRUCT lpkey) { } static void -_LoadSubReg(LPKEYSTRUCT lpkey,char *fn) { +_wine_loadreg(LPKEYSTRUCT lpkey,char *fn,int optflag) { FILE *F; F=fopen(fn,"rb"); @@ -672,7 +727,7 @@ _LoadSubReg(LPKEYSTRUCT lpkey,char *fn) { ); return; } - if (!_do_loadsubreg(F,lpkey)) { + if (!_wine_loadsubreg(F,lpkey,optflag)) { fclose(F); unlink(fn); return; @@ -680,55 +735,565 @@ _LoadSubReg(LPKEYSTRUCT lpkey,char *fn) { fclose(F); } +static void +_copy_registry(LPKEYSTRUCT from,LPKEYSTRUCT to) { + LPKEYSTRUCT lpxkey; + int j; + LPKEYVALUE valfrom; + + from=from->nextsub; + while (from) { + lpxkey = _find_or_add_key(to,strdupW(from->keyname)); + + for (j=0;jnrofvalues;j++) { + LPWSTR name; + LPBYTE data; + + valfrom = from->values+j; + name=valfrom->name; + if (name) name=strdupW(name); + data=(LPBYTE)malloc(valfrom->len); + memcpy(data,valfrom->data,valfrom->len); + + _find_or_add_value( + lpxkey, + name, + valfrom->type, + data, + valfrom->len, + valfrom->lastmodified + ); + } + _copy_registry(from,lpxkey); + from = from->next; + } +} + +/* WINDOWS 95 REGISTRY LOADER */ +/* + * Structure of a win95 registry database. + * main header: + * 0 : "CREG" - magic + * 4 : DWORD version + * 8 : DWORD offset_of_RGDB_part + * 0C..1F: ? (someone fill in please) + * + * 20: RGKN_section: + * header: + * 0 : "RGKN" - magic + * 4..0x1B: ? (fill in) + * 0x20 ... offset_of_RGDB_part: Disk Key Entry structures + * + * Disk Key Entry Structure: + * 00: DWORD - unknown + * 04: DWORD - unknown + * 08: DWORD - unknown, but usually 0xFFFFFFFF on win95 systems + * 0C: DWORD - disk address of PreviousLevel Key. + * 10: DWORD - disk address of Next Sublevel Key. + * 14: DWORD - disk address of Next Key (on same level). + * DKEP>18: WORD - Nr, Low Significant part. + * 1A: WORD - Nr, High Significant part. + * + * The disk address always points to the nr part of the previous key entry + * of the referenced key. Don't ask me why, or even if I got this correct + * from staring at 1kg of hexdumps. (DKEP) + * + * The number of the entry is the low byte of the Low Significant Part ored + * with 0x100 * (low byte of the High Significant part) + * (C expression : nr = (nrLS & 0xFF) | ((nrHS &0xFF)<<8)) + * + * There are two minor corrections to the position of that structure. + * 1. If the address is xxx014 or xxx018 it will be aligned to xxx01c AND + * the DKE reread from there. + * 2. If the address is xxxFFx it will be aligned to (xxx+1)000. + * (FIXME: slightly better explanation needed here) + * + * RGDB_section: + * 00: "RGDB" - magic + * 04...1F: ? + * 20.....: disk keys + * + * disk key: + * 00: DWORD nextkeyoffset - offset to the next disk key structure + * 08: WORD nrLS - low significant part of NR + * 0A: WORD nrHS - high significant part of NR + * 0C: DWORD bytesused - bytes used in this structure. + * 10: WORD name_len - length of name in bytes. without \0 + * 12: WORD nr_of_values - number of values. + * 14: char name[name_len] - name string. No \0. + * 14+name_len: disk values + * nextkeyoffset: ... next disk key + * + * disk value: + * 00: DWORD type - value type (hmm, could be WORD too) + * 04: DWORD - unknown, usually 0 + * 08: WORD namelen - length of Name. 0 means name=NULL + * 0C: WORD datalen - length of Data. + * 10: char name[namelen] - name, no \0 + * 10+namelen: BYTE data[datalen] - data, without \0 if string + * 10+namelen+datalen: next values or disk key + * + * Disk keys are layed out flat ... But, sometimes, nrLS and nrHS are both + * 0xFFFF, which means skipping over nextkeyoffset bytes (including this + * structure) and reading another RGDB_section. + * repeat until end of file. + * + * FIXME: this description needs some serious help, yes. + */ + +struct _w95keyvalue { + unsigned long type; + unsigned short datalen; + char *name; + unsigned char *data; + unsigned long x1; + int lastmodified; +}; + +struct _w95key { + char *name; + int nrofvals; + struct _w95keyvalue *values; + unsigned long dkeaddr; + unsigned long x1; + unsigned long x2; + unsigned long x3; + unsigned long xx1; + struct _w95key *prevlvl; + struct _w95key *nextsub; + struct _w95key *next; +}; + +/* fast lookup table dkeaddr->nr */ +struct _w95nr2da { + unsigned long dkeaddr; + unsigned long nr; +}; + + +static void +_w95_walk_tree(LPKEYSTRUCT lpkey,struct _w95key *key) { + int i; + LPKEYSTRUCT lpxkey; + LPWSTR name; + + while (key) { + if (key->name == NULL) { + fprintf(stderr,"key with dkeaddr %lx not loaded, skipping hierarchy\n", + key->dkeaddr + ); + key = key->next; + continue; + } + lpxkey=_find_or_add_key(lpkey,strdupA2W(key->name)); + + if (key->nrofvals<0) { + /* shouldn't happen */ + fprintf(stderr,"key %s already processed!\n",key->name); + key = key->next; + continue; + } + for (i=0;inrofvals;i++) { + LPBYTE data; + int len; + + name = strdupA2W(key->values[i].name); + if (!*name) name = NULL; + free(key->values[i].name); + + len = key->values[i].datalen; + data = key->values[i].data; + if ((1<values[i].type) & UNICONVMASK) { + data = (BYTE*)strdupA2W(data); + len = strlenW((LPWSTR)data)*2+2; + free(key->values[i].data); + } + _find_or_add_value( + lpxkey, + name, + key->values[i].type, + data, + len, + key->values[i].lastmodified + ); + } + if (key->values) { + free(key->values); + key->values = NULL; + } + key->nrofvals=-key->nrofvals-1; + _w95_walk_tree(lpxkey,key->nextsub); + key=key->next; + } +} + +/* small helper function to adjust address offset (dkeaddrs) */ +static unsigned long +_w95_adj_da(unsigned long dkeaddr) { + if ((dkeaddr&0xFFF)<0x018) { + int diff; + + diff=0x1C-(dkeaddr&0xFFF); + return dkeaddr+diff; + } + if (((dkeaddr+0x1C)&0xFFF)<0x1C) { + /* readjust to 0x000, + * but ONLY if we are >0x1000 already + */ + if (dkeaddr & ~0xFFF) + return dkeaddr & ~0xFFF; + } + return dkeaddr; +} + +static int +_w95dkecomp(struct _w95nr2da *a,struct _w95nr2da *b){return a->dkeaddr-b->dkeaddr;} + +static struct _w95key* +_w95dkelookup(unsigned long dkeaddr,int n,struct _w95nr2da *nr2da,struct _w95key *keys) { + int i,off; + + if (dkeaddr == 0xFFFFFFFF) + return NULL; + if (dkeaddr<0x20) + return NULL; + dkeaddr=_w95_adj_da(dkeaddr+0x1c); + off = (dkeaddr-0x3c)/0x1c; + for (i=0;i0x1000 already + */ + if (dkeaddr & ~0xFFF) + dkeaddr = dkeaddr & ~0xFFF; + } + if (nr>nrofdkes) { + dprintf_reg(stddeb,"nr %ld exceeds nrofdkes %d, skipping.\n",nr,nrofdkes); + continue; + } + if (keys[nr].dkeaddr) { + if (nr) + dprintf_reg(stddeb,"key doubled? nr=%ld,key->dkeaddr=%lx,dkeaddr=%lx\n",nr,keys[i].dkeaddr,dkeaddr); + continue; + } + nr2da[i].nr = nr; + nr2da[i].dkeaddr = dkeaddr; + + keys[nr].dkeaddr = dkeaddr; + keys[nr].x1 = dke.x1; + keys[nr].x2 = dke.x2; + keys[nr].x3 = dke.x3; + keys[nr].prevlvl= (struct _w95key*)dke.prevlvl; + keys[nr].nextsub= (struct _w95key*)dke.nextsub; + keys[nr].next = (struct _w95key*)dke.next; + } + free(data); + + qsort(nr2da,nrofdkes,sizeof(nr2da[0]),_w95dkecomp); + + /* STEP 2: keydata & values */ + if (-1==fstat(fd,&stbuf)) + return; + end = stbuf.st_size; + lastmodified = stbuf.st_mtime; + + if (-1==lseek(fd,rgdbsection,SEEK_SET)) + return; + data = (char*)xmalloc(end-rgdbsection); + if ((end-rgdbsection)!=read(fd,data,end-rgdbsection)) + return; + _lclose(hfd); + curdata = data; + memcpy(magic,curdata,4); + curdata+=4; + if (strcmp(magic,"RGDB")) { + dprintf_reg(stddeb,"third IFF header not RGDB, but %s\n",magic); + return; + } + curdata=data+0x20; + while (1) { + struct dkh dkh; + int bytesread; + struct _w95key *key,xkey; + + bytesread = 0; +#define XREAD(whereto,len) \ + if ((curdata-data+len)nrofdkes) { + if (dkh.nrLS == 0xFFFF) { + curdata+= dkh.nextkeyoff - bytesread; + XREAD(magic,4); + if (strcmp(magic,"RGDB")) { + if ((curdata-data)dkeaddr) + dprintf_reg(stddeb,"key with nr=%ld has no dkeaddr?\n",nr); + } + key->nrofvals = dkh.values; + key->name = (char*)xmalloc(dkh.keynamelen+1); + key->xx1 = dkh.xx1; + XREAD(key->name,dkh.keynamelen); + key->name[dkh.keynamelen]=0; + if (key->nrofvals) { + key->values = (struct _w95keyvalue*)xmalloc( + sizeof(struct _w95keyvalue)*key->nrofvals + ); + for (i=0;inrofvals;i++) { + struct dkv dkv; + + XREAD(&dkv,sizeof(dkv)); + key->values[i].type = dkv.type; + key->values[i].name = (char*)xmalloc( + dkv.valnamelen+1 + ); + key->values[i].datalen = dkv.valdatalen; + key->values[i].data = (unsigned char*)xmalloc( + dkv.valdatalen+1 + ); + key->values[i].x1 = dkv.x1; + XREAD(key->values[i].name,dkv.valnamelen); + XREAD(key->values[i].data,dkv.valdatalen); + key->values[i].data[dkv.valdatalen]=0; + key->values[i].name[dkv.valnamelen]=0; + key->values[i].lastmodified=lastmodified; + } + } + if (bytesread != dkh.nextkeyoff) { + if (dkh.bytesused != bytesread) + dprintf_reg(stddeb, + "read has difference in read bytes (%d) and nextoffset (%ld) (bytesused=%ld)\n",bytesread,dkh.nextkeyoff, + dkh.bytesused + ); + curdata += dkh.nextkeyoff-bytesread; + } + key->prevlvl = _w95dkelookup((long)key->prevlvl,nrofdkes,nr2da,keys); + key->nextsub = _w95dkelookup((long)key->nextsub,nrofdkes,nr2da,keys); + key->next = _w95dkelookup((long)key->next,nrofdkes,nr2da,keys); + if (!bytesread) + break; + } + free(data); + _w95_walk_tree(lpkey,keys); + free(keys); +} + void SHELL_LoadRegistry() { char *fn; struct passwd *pwd; + LPKEYSTRUCT lpkey; + HKEY hkey; + if (key_classes_root==NULL) SHELL_Init(); - /* load the machine-wide defaults first */ - _LoadSubReg(key_current_user,SAVE_CURRENT_USER_DEFAULT); - _LoadSubReg(key_local_machine,SAVE_LOCAL_MACHINE_DEFAULT); - /* load the user saved registry. overwriting only newer entries */ + /* Load windows 95 entries */ + _w95_loadreg("C:\\system.1st", key_local_machine); + _w95_loadreg("system.dat", key_local_machine); + _w95_loadreg("user.dat", key_users); + + /* FIXME: win3.1 reg.dat loader still missing */ + + /* the global user default is loaded under HKEY_USERS\\.Default */ + RegCreateKey16(HKEY_USERS,".Default",&hkey); + lpkey = lookup_hkey(hkey); + _wine_loadreg(lpkey,SAVE_USERS_DEFAULT,0); + + /* HKEY_USERS\\.Default is copied to HKEY_CURRENT_USER */ + _copy_registry(lpkey,key_current_user); + RegCloseKey(hkey); + + /* the global machine defaults */ + _wine_loadreg(key_local_machine,SAVE_LOCAL_MACHINE_DEFAULT,0); + + /* load the user saved registries */ + + /* FIXME: use getenv("HOME") or getpwuid(getuid())->pw_dir ?? */ + pwd=getpwuid(getuid()); if (pwd!=NULL && pwd->pw_dir!=NULL) { fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_CURRENT_USER)+2); strcpy(fn,pwd->pw_dir); strcat(fn,WINE_PREFIX"/"SAVE_CURRENT_USER); - _LoadSubReg(key_current_user,fn); + _wine_loadreg(key_current_user,fn,REG_OPTION_TAINTED); free(fn); fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_LOCAL_MACHINE)+2); strcpy(fn,pwd->pw_dir); strcat(fn,WINE_PREFIX"/"SAVE_LOCAL_MACHINE); - _LoadSubReg(key_local_machine,fn); + _wine_loadreg(key_local_machine,fn,REG_OPTION_TAINTED); free(fn); - } else { + } else fprintf(stderr,"SHELL_LoadRegistry:failed to get homedirectory of UID %d.\n",getuid()); + if (ERROR_SUCCESS==RegCreateKey16(HKEY_CURRENT_USER,KEY_REGISTRY,&hkey)) { + DWORD junk,type,len; + char data[5]; + + len=4; + if (( RegQueryValueEx32A( + hkey, + VAL_SAVEUPDATED, + &junk, + &type, + data, + &len + )!=ERROR_SUCCESS) || + type != REG_SZ + ) + RegSetValueEx32A(hkey,VAL_SAVEUPDATED,0,REG_SZ,"yes",4); + RegCloseKey(hkey); } - /* FIXME: load all users and their resp. pwd->pw_dir/.wine/user.reg - * (later, when a win32 registry editing tool becomes avail.) - */ } -/********************* API FUNCTIONS ***************************************/ +/********************* API FUNCTIONS ***************************************/ /* * Open Keys. * - * All functions are stubs to RegOpenKeyExW where all the + * All functions are stubs to RegOpenKeyEx32W where all the * magic happens. * * FIXME: security,options,desiredaccess,... * * Callpath: - * RegOpenKey -> RegOpenKeyA -> RegOpenKeyExA \ - * RegOpenKeyW -> RegOpenKeyExW + * RegOpenKey16 -> RegOpenKey32A -> RegOpenKeyEx32A \ + * RegOpenKey32W -> RegOpenKeyEx32W */ /* RegOpenKeyExW [ADVAPI32.150] */ -DWORD RegOpenKeyExW( +DWORD RegOpenKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey, DWORD dwReserved, @@ -738,7 +1303,7 @@ DWORD RegOpenKeyExW( LPKEYSTRUCT lpNextKey,lpxkey; LPWSTR *wps; int wpc,i; - dprintf_reg(stddeb,"RegOpenKeyExW(%lx,%s,%ld,%lx,%p)\n", + dprintf_reg(stddeb,"RegOpenKeyEx32W(%lx,%s,%ld,%lx,%p)\n", (LONG)hkey,W2C(lpszSubKey,0),dwReserved,samDesired,retkey ); @@ -775,20 +1340,20 @@ DWORD RegOpenKeyExW( } /* RegOpenKeyW [ADVAPI32.151] */ -DWORD RegOpenKeyW( +DWORD RegOpenKey32W( HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey ) { - dprintf_reg(stddeb,"RegOpenKeyW(%lx,%s,%p)\n", + dprintf_reg(stddeb,"RegOpenKey32W(%lx,%s,%p)\n", (LONG)hkey,W2C(lpszSubKey,0),retkey ); - return RegOpenKeyExW(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey); + return RegOpenKeyEx32W(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey); } /* RegOpenKeyExA [ADVAPI32.149] */ -DWORD RegOpenKeyExA( +DWORD RegOpenKeyEx32A( HKEY hkey, LPCSTR lpszSubKey, DWORD dwReserved, @@ -798,41 +1363,41 @@ DWORD RegOpenKeyExA( LPWSTR lpszSubKeyW; DWORD ret; - dprintf_reg(stddeb,"RegOpenKeyExA(%lx,%s,%ld,%lx,%p)\n", + dprintf_reg(stddeb,"RegOpenKeyEx32A(%lx,%s,%ld,%lx,%p)\n", (LONG)hkey,lpszSubKey,dwReserved,samDesired,retkey ); if (lpszSubKey) lpszSubKeyW=strdupA2W(lpszSubKey); else lpszSubKeyW=NULL; - ret=RegOpenKeyExW(hkey,lpszSubKeyW,dwReserved,samDesired,retkey); + ret=RegOpenKeyEx32W(hkey,lpszSubKeyW,dwReserved,samDesired,retkey); if (lpszSubKeyW) free(lpszSubKeyW); return ret; } /* RegOpenKeyA [ADVAPI32.148] */ -DWORD RegOpenKeyA( +DWORD RegOpenKey32A( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey ) { - dprintf_reg(stddeb,"RegOpenKeyA(%lx,%s,%p)\n", + dprintf_reg(stddeb,"RegOpenKey32A(%lx,%s,%p)\n", (LONG)hkey,lpszSubKey,retkey ); - return RegOpenKeyExA(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey); + return RegOpenKeyEx32A(hkey,lpszSubKey,0,KEY_ALL_ACCESS,retkey); } /* RegOpenKey [SHELL.1] [KERNEL.217] */ -DWORD RegOpenKey( +DWORD RegOpenKey16( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey ) { - dprintf_reg(stddeb,"RegOpenKey(%lx,%s,%p)\n", + dprintf_reg(stddeb,"RegOpenKey16(%lx,%s,%p)\n", (LONG)hkey,lpszSubKey,retkey ); - return RegOpenKeyA(hkey,lpszSubKey,retkey); + return RegOpenKey32A(hkey,lpszSubKey,retkey); } /* @@ -844,12 +1409,12 @@ DWORD RegOpenKey( * FIXME: no security,no access attrib,no optionhandling yet. * * Callpath: - * RegCreateKey -> RegCreateKeyA -> RegCreateKeyExA \ - * RegCreateKeyW -> RegCreateKeyExW + * RegCreateKey16 -> RegCreateKey32A -> RegCreateKeyEx32A \ + * RegCreateKey32W -> RegCreateKeyEx32W */ /* RegCreateKeyExW [ADVAPI32.131] */ -DWORD RegCreateKeyExW( +DWORD RegCreateKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey, DWORD dwReserved, @@ -865,7 +1430,7 @@ DWORD RegCreateKeyExW( int wpc,i; /*FIXME: handle security/access/whatever */ - dprintf_reg(stddeb,"RegCreateKeyExW(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegCreateKeyEx32W(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n", (LONG)hkey, W2C(lpszSubKey,0), dwReserved, @@ -942,6 +1507,7 @@ DWORD RegCreateKeyExW( lpNextKey->class = strdupW(lpszClass); else lpNextKey->class = NULL; + lpNextKey->flags|=REG_OPTION_TAINTED; *retkey = currenthandle; *lpDispos = REG_CREATED_NEW_KEY; FREE_KEY_PATH; @@ -949,17 +1515,17 @@ DWORD RegCreateKeyExW( } /* RegCreateKeyW [ADVAPI32.132] */ -DWORD RegCreateKeyW( +DWORD RegCreateKey32W( HKEY hkey, LPCWSTR lpszSubKey, LPHKEY retkey ) { DWORD junk,ret; - dprintf_reg(stddeb,"RegCreateKeyW(%lx,%s,%p)\n", + dprintf_reg(stddeb,"RegCreateKey32W(%lx,%s,%p)\n", (LONG)hkey,W2C(lpszSubKey,0),retkey ); - ret=RegCreateKeyExW( + ret=RegCreateKeyEx32W( hkey, /* key handle */ lpszSubKey, /* subkey name */ 0, /* reserved = 0 */ @@ -974,7 +1540,7 @@ DWORD RegCreateKeyW( } /* RegCreateKeyExA [ADVAPI32.130] */ -DWORD RegCreateKeyExA( +DWORD RegCreateKeyEx32A( HKEY hkey, LPCSTR lpszSubKey, DWORD dwReserved, @@ -988,7 +1554,7 @@ DWORD RegCreateKeyExA( LPWSTR lpszSubKeyW,lpszClassW; DWORD ret; - dprintf_reg(stddeb,"RegCreateKeyExA(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegCreateKeyEx32A(%lx,%s,%ld,%s,%lx,%lx,%p,%p,%p)\n", (LONG)hkey, lpszSubKey, dwReserved, @@ -1007,7 +1573,7 @@ DWORD RegCreateKeyExA( lpszClassW=strdupA2W(lpszClass); else lpszClassW=NULL; - ret=RegCreateKeyExW( + ret=RegCreateKeyEx32W( hkey, lpszSubKeyW, dwReserved, @@ -1026,17 +1592,17 @@ DWORD RegCreateKeyExA( } /* RegCreateKeyA [ADVAPI32.129] */ -DWORD RegCreateKeyA( +DWORD RegCreateKey32A( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey ) { DWORD junk; - dprintf_reg(stddeb,"RegCreateKeyA(%lx,%s,%p)\n", + dprintf_reg(stddeb,"RegCreateKey32A(%lx,%s,%p)\n", (LONG)hkey,lpszSubKey,retkey ); - return RegCreateKeyExA( + return RegCreateKeyEx32A( hkey, /* key handle */ lpszSubKey, /* subkey name */ 0, /* reserved = 0 */ @@ -1050,15 +1616,15 @@ DWORD RegCreateKeyA( } /* RegCreateKey [SHELL.2] [KERNEL.218] */ -DWORD RegCreateKey( +DWORD RegCreateKey16( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey ) { - dprintf_reg(stddeb,"RegCreateKey(%lx,%s,%p)\n", + dprintf_reg(stddeb,"RegCreateKey16(%lx,%s,%p)\n", (LONG)hkey,lpszSubKey,retkey ); - return RegCreateKeyA(hkey,lpszSubKey,retkey); + return RegCreateKey32A(hkey,lpszSubKey,retkey); } /* @@ -1069,12 +1635,12 @@ DWORD RegCreateKey( * compat functions. * * Callpath: - * RegQueryValue -> RegQueryValueA -> RegQueryValueExA \ - * RegQueryValueW -> RegQueryValueExW + * RegQueryValue16 -> RegQueryValue32A -> RegQueryValueEx32A \ + * RegQueryValue32W -> RegQueryValueEx32W */ /* RegQueryValueExW [ADVAPI32.158] */ -DWORD RegQueryValueExW( +DWORD RegQueryValueEx32W( HKEY hkey, LPWSTR lpszValueName, LPDWORD lpdwReserved, @@ -1085,7 +1651,7 @@ DWORD RegQueryValueExW( LPKEYSTRUCT lpkey; int i; - dprintf_reg(stddeb,"RegQueryValueExW(%x,%s,%p,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegQueryValueEx32W(%x,%s,%p,%p,%p,%p)\n", hkey,W2C(lpszValueName,0),lpdwReserved,lpdwType,lpbData,lpcbData ); @@ -1130,7 +1696,7 @@ DWORD RegQueryValueExW( } /* RegQueryValueW [ADVAPI32.159] */ -DWORD RegQueryValueW( +DWORD RegQueryValue32W( HKEY hkey, LPWSTR lpszSubKey, LPWSTR lpszData, @@ -1139,20 +1705,20 @@ DWORD RegQueryValueW( HKEY xhkey; DWORD ret,lpdwType; - dprintf_reg(stddeb,"RegQueryValueW(%x,%s,%p,%p)\n->", + dprintf_reg(stddeb,"RegQueryValue32W(%x,%s,%p,%p)\n->", hkey,W2C(lpszSubKey,0),lpszData,lpcbData ); /* only open subkey, if we really do descend */ if (lpszSubKey && *lpszSubKey) { - ret = RegOpenKeyW(hkey,lpszSubKey,&xhkey); + ret = RegOpenKey32W(hkey,lpszSubKey,&xhkey); if (ret!=ERROR_SUCCESS) return ret; } else xhkey = hkey; lpdwType = REG_SZ; - ret = RegQueryValueExW( + ret = RegQueryValueEx32W( xhkey, NULL, /* varname NULL -> compat */ NULL, /* lpdwReserved, must be NULL */ @@ -1166,7 +1732,7 @@ DWORD RegQueryValueW( } /* RegQueryValueExA [ADVAPI32.157] */ -DWORD RegQueryValueExA( +DWORD RegQueryValueEx32A( HKEY hkey, LPSTR lpszValueName, LPDWORD lpdwReserved, @@ -1179,7 +1745,7 @@ DWORD RegQueryValueExA( DWORD ret,myxlen; DWORD *mylen; - dprintf_reg(stddeb,"RegQueryValueExA(%x,%s,%p,%p,%p,%p)\n->", + dprintf_reg(stddeb,"RegQueryValueEx32A(%x,%s,%p,%p,%p,%p)\n->", hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,lpcbData ); if (lpbData) { @@ -1200,7 +1766,7 @@ DWORD RegQueryValueExA( else lpszValueNameW=NULL; - ret=RegQueryValueExW( + ret=RegQueryValueEx32W( hkey, lpszValueNameW, lpdwReserved, @@ -1237,7 +1803,7 @@ DWORD RegQueryValueExA( } /* RegQueryValueEx [KERNEL.225] */ -DWORD RegQueryValueEx( +DWORD RegQueryValueEx16( HKEY hkey, LPSTR lpszValueName, LPDWORD lpdwReserved, @@ -1245,10 +1811,10 @@ DWORD RegQueryValueEx( LPBYTE lpbData, LPDWORD lpcbData ) { - dprintf_reg(stddeb,"RegQueryValueEx(%x,%s,%p,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegQueryValueEx16(%x,%s,%p,%p,%p,%p)\n", hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,lpcbData ); - return RegQueryValueExA( + return RegQueryValueEx32A( hkey, lpszValueName, lpdwReserved, @@ -1259,7 +1825,7 @@ DWORD RegQueryValueEx( } /* RegQueryValueA [ADVAPI32.156] */ -DWORD RegQueryValueA( +DWORD RegQueryValue32A( HKEY hkey, LPSTR lpszSubKey, LPSTR lpszData, @@ -1268,20 +1834,20 @@ DWORD RegQueryValueA( HKEY xhkey; DWORD ret,lpdwType; - dprintf_reg(stddeb,"RegQueryValueA(%x,%s,%p,%p)\n", + dprintf_reg(stddeb,"RegQueryValue32A(%x,%s,%p,%p)\n", hkey,lpszSubKey,lpszData,lpcbData ); /* only open subkey, if we really do descend */ if (lpszSubKey && *lpszSubKey) { - ret = RegOpenKey(hkey,lpszSubKey,&xhkey); + ret = RegOpenKey16(hkey,lpszSubKey,&xhkey); if (ret!=ERROR_SUCCESS) return ret; } else xhkey = hkey; lpdwType = REG_SZ; - ret = RegQueryValueExA( + ret = RegQueryValueEx32A( xhkey, NULL, /* lpszValueName NULL -> compat */ NULL, /* lpdwReserved, must be NULL */ @@ -1295,28 +1861,28 @@ DWORD RegQueryValueA( } /* RegQueryValue [SHELL.6] [KERNEL.224] */ -DWORD RegQueryValue( +DWORD RegQueryValue16( HKEY hkey, LPSTR lpszSubKey, LPSTR lpszData, LPDWORD lpcbData ) { - dprintf_reg(stddeb,"RegQueryValueA(%x,%s,%p,%p)\n", + dprintf_reg(stddeb,"RegQueryValue16(%x,%s,%p,%p)\n", hkey,lpszSubKey,lpszData,lpcbData ); - return RegQueryValueA(hkey,lpszSubKey,lpszData,lpcbData); + return RegQueryValue32A(hkey,lpszSubKey,lpszData,lpcbData); } /* * Setting values of Registry keys * * Callpath: - * RegSetValue -> RegSetValueA -> RegSetValueExA \ - * RegSetValueW -> RegSetValueExW + * RegSetValue16 -> RegSetValue32A -> RegSetValueEx32A \ + * RegSetValue32W -> RegSetValueEx32W */ /* RegSetValueExW [ADVAPI32.170] */ -DWORD RegSetValueExW( +DWORD RegSetValueEx32W( HKEY hkey, LPWSTR lpszValueName, DWORD dwReserved, @@ -1327,13 +1893,16 @@ DWORD RegSetValueExW( LPKEYSTRUCT lpkey; int i; - dprintf_reg(stddeb,"RegSetValueExW(%x,%s,%ld,%ld,%p,%ld)\n", + dprintf_reg(stddeb,"RegSetValueEx32W(%x,%s,%ld,%ld,%p,%ld)\n", hkey,W2C(lpszValueName,0),dwReserved,dwType,lpbData,cbData ); - /* we no longer care about the lpbData dwType here... */ + /* we no longer care about the lpbData type here... */ lpkey = lookup_hkey(hkey); if (!lpkey) return SHELL_ERROR_BADKEY; + + lpkey->flags |= REG_OPTION_TAINTED; + if (lpszValueName==NULL) { for (i=0;inrofvalues;i++) if (lpkey->values[i].name==NULL) @@ -1367,7 +1936,7 @@ DWORD RegSetValueExW( } /* RegSetValueExA [ADVAPI32.169] */ -DWORD RegSetValueExA( +DWORD RegSetValueEx32A( HKEY hkey, LPSTR lpszValueName, DWORD dwReserved, @@ -1379,7 +1948,7 @@ DWORD RegSetValueExA( LPWSTR lpszValueNameW; DWORD ret; - dprintf_reg(stddeb,"RegSetValueExA(%x,%s,%ld,%ld,%p,%ld)\n->", + dprintf_reg(stddeb,"RegSetValueEx32A(%x,%s,%ld,%ld,%p,%ld)\n->", hkey,lpszValueName,dwReserved,dwType,lpbData,cbData ); if ((1<", + dprintf_reg(stddeb,"RegSetValueEx16(%x,%s,%ld,%ld,%p,%ld)\n->", hkey,lpszValueName,dwReserved,dwType,lpbData,cbData ); - return RegSetValueExA(hkey,lpszValueName,dwReserved,dwType,lpbData,cbData); + return RegSetValueEx32A(hkey,lpszValueName,dwReserved,dwType,lpbData,cbData); } /* RegSetValueW [ADVAPI32.171] */ -DWORD RegSetValueW( +DWORD RegSetValue32W( HKEY hkey, LPCWSTR lpszSubKey, DWORD dwType, @@ -1425,11 +1994,11 @@ DWORD RegSetValueW( HKEY xhkey; DWORD ret; - dprintf_reg(stddeb,"RegSetValueW(%x,%s,%ld,%s,%ld)\n->", + dprintf_reg(stddeb,"RegSetValue32W(%x,%s,%ld,%s,%ld)\n->", hkey,W2C(lpszSubKey,0),dwType,W2C(lpszData,0),cbData ); if (lpszSubKey && *lpszSubKey) { - ret=RegCreateKeyW(hkey,lpszSubKey,&xhkey); + ret=RegCreateKey32W(hkey,lpszSubKey,&xhkey); if (ret!=ERROR_SUCCESS) return ret; } else @@ -1444,14 +2013,14 @@ DWORD RegSetValueW( ); cbData=2*strlenW(lpszData)+2; } - ret=RegSetValueExW(xhkey,NULL,0,dwType,(LPBYTE)lpszData,cbData); + ret=RegSetValueEx32W(xhkey,NULL,0,dwType,(LPBYTE)lpszData,cbData); if (hkey!=xhkey) RegCloseKey(xhkey); return ret; } /* RegSetValueA [ADVAPI32.168] */ -DWORD RegSetValueA( +DWORD RegSetValue32A( HKEY hkey, LPCSTR lpszSubKey, DWORD dwType, @@ -1461,11 +2030,11 @@ DWORD RegSetValueA( DWORD ret; HKEY xhkey; - dprintf_reg(stddeb,"RegSetValueA(%x,%s,%ld,%s,%ld)\n->", + dprintf_reg(stddeb,"RegSetValue32A(%x,%s,%ld,%s,%ld)\n->", hkey,lpszSubKey,dwType,lpszData,cbData ); if (lpszSubKey && *lpszSubKey) { - ret=RegCreateKey(hkey,lpszSubKey,&xhkey); + ret=RegCreateKey16(hkey,lpszSubKey,&xhkey); if (ret!=ERROR_SUCCESS) return ret; } else @@ -1477,14 +2046,14 @@ DWORD RegSetValueA( } if (cbData!=strlen(lpszData)+1) cbData=strlen(lpszData)+1; - ret=RegSetValueExA(xhkey,NULL,0,dwType,(LPBYTE)lpszData,cbData); + ret=RegSetValueEx32A(xhkey,NULL,0,dwType,(LPBYTE)lpszData,cbData); if (xhkey!=hkey) RegCloseKey(xhkey); return ret; } /* RegSetValue [KERNEL.221] [SHELL.5] */ -DWORD RegSetValue( +DWORD RegSetValue16( HKEY hkey, LPCSTR lpszSubKey, DWORD dwType, @@ -1492,10 +2061,10 @@ DWORD RegSetValue( DWORD cbData ) { DWORD ret; - dprintf_reg(stddeb,"RegSetValue(%x,%s,%ld,%s,%ld)\n->", + dprintf_reg(stddeb,"RegSetValue16(%x,%s,%ld,%s,%ld)\n->", hkey,lpszSubKey,dwType,lpszData,cbData ); - ret=RegSetValueA(hkey,lpszSubKey,dwType,lpszData,cbData); + ret=RegSetValue32A(hkey,lpszSubKey,dwType,lpszData,cbData); return ret; } @@ -1503,12 +2072,12 @@ DWORD RegSetValue( * Key Enumeration * * Callpath: - * RegEnumKey -> RegEnumKeyA -> RegEnumKeyExA \ - * RegEnumKeyW -> RegEnumKeyExW + * RegEnumKey16 -> RegEnumKey32A -> RegEnumKeyEx32A \ + * RegEnumKey32W -> RegEnumKeyEx32W */ /* RegEnumKeyExW [ADVAPI32.139] */ -DWORD RegEnumKeyExW( +DWORD RegEnumKeyEx32W( HKEY hkey, DWORD iSubkey, LPWSTR lpszName, @@ -1520,7 +2089,7 @@ DWORD RegEnumKeyExW( ) { LPKEYSTRUCT lpkey,lpxkey; - dprintf_reg(stddeb,"RegEnumKeyExW(%x,%ld,%p,%ld,%p,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegEnumKeyEx32W(%x,%ld,%p,%ld,%p,%p,%p,%p)\n", hkey,iSubkey,lpszName,*lpcchName,lpdwReserved,lpszClass,lpcchClass,ft ); lpkey=lookup_hkey(hkey); @@ -1548,7 +2117,7 @@ DWORD RegEnumKeyExW( } /* RegEnumKeyW [ADVAPI32.140] */ -DWORD RegEnumKeyW( +DWORD RegEnumKey32W( HKEY hkey, DWORD iSubkey, LPWSTR lpszName, @@ -1556,13 +2125,13 @@ DWORD RegEnumKeyW( ) { FILETIME ft; - dprintf_reg(stddeb,"RegEnumKeyW(%x,%ld,%p,%ld)\n->", + dprintf_reg(stddeb,"RegEnumKey32W(%x,%ld,%p,%ld)\n->", hkey,iSubkey,lpszName,lpcchName ); - return RegEnumKeyExW(hkey,iSubkey,lpszName,&lpcchName,NULL,NULL,NULL,&ft); + return RegEnumKeyEx32W(hkey,iSubkey,lpszName,&lpcchName,NULL,NULL,NULL,&ft); } /* RegEnumKeyExA [ADVAPI32.138] */ -DWORD RegEnumKeyExA( +DWORD RegEnumKeyEx32A( HKEY hkey, DWORD iSubkey, LPSTR lpszName, @@ -1576,7 +2145,7 @@ DWORD RegEnumKeyExA( LPWSTR lpszNameW,lpszClassW; - dprintf_reg(stddeb,"RegEnumKeyExA(%x,%ld,%p,%ld,%p,%p,%p,%p)\n->", + dprintf_reg(stddeb,"RegEnumKeyEx32A(%x,%ld,%p,%ld,%p,%p,%p,%p)\n->", hkey,iSubkey,lpszName,*lpcchName,lpdwReserved,lpszClass,lpcchClass,ft ); if (lpszName) { @@ -1593,7 +2162,7 @@ DWORD RegEnumKeyExA( lpszClassW =0; lpcchClassW=0; } - ret=RegEnumKeyExW( + ret=RegEnumKeyEx32W( hkey, iSubkey, lpszNameW, @@ -1619,7 +2188,7 @@ DWORD RegEnumKeyExA( } /* RegEnumKeyA [ADVAPI32.137] */ -DWORD RegEnumKeyA( +DWORD RegEnumKey32A( HKEY hkey, DWORD iSubkey, LPSTR lpszName, @@ -1627,10 +2196,10 @@ DWORD RegEnumKeyA( ) { FILETIME ft; - dprintf_reg(stddeb,"RegEnumKeyA(%x,%ld,%p,%ld)\n->", + dprintf_reg(stddeb,"RegEnumKey32A(%x,%ld,%p,%ld)\n->", hkey,iSubkey,lpszName,lpcchName ); - return RegEnumKeyExA( + return RegEnumKeyEx32A( hkey, iSubkey, lpszName, @@ -1643,27 +2212,27 @@ DWORD RegEnumKeyA( } /* RegEnumKey [SHELL.7] [KERNEL.216] */ -DWORD RegEnumKey( +DWORD RegEnumKey16( HKEY hkey, DWORD iSubkey, LPSTR lpszName, DWORD lpcchName ) { - dprintf_reg(stddeb,"RegEnumKey(%x,%ld,%p,%ld)\n->", + dprintf_reg(stddeb,"RegEnumKey16(%x,%ld,%p,%ld)\n->", hkey,iSubkey,lpszName,lpcchName ); - return RegEnumKeyA(hkey,iSubkey,lpszName,lpcchName); + return RegEnumKey32A(hkey,iSubkey,lpszName,lpcchName); } /* * Enumerate Registry Values * * Callpath: - * RegEnumValue -> RegEnumValueA -> RegEnumValueW + * RegEnumValue16 -> RegEnumValue32A -> RegEnumValue32W */ /* RegEnumValueW [ADVAPI32.142] */ -DWORD RegEnumValueW( +DWORD RegEnumValue32W( HKEY hkey, DWORD iValue, LPWSTR lpszValue, @@ -1676,7 +2245,7 @@ DWORD RegEnumValueW( LPKEYSTRUCT lpkey; LPKEYVALUE val; - dprintf_reg(stddeb,"RegEnumValueW(%x,%ld,%p,%p,%p,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegEnumValue32W(%x,%ld,%p,%p,%p,%p,%p,%p)\n", hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData ); lpkey = lookup_hkey(hkey); @@ -1709,7 +2278,7 @@ DWORD RegEnumValueW( } /* RegEnumValueA [ADVAPI32.141] */ -DWORD RegEnumValueA( +DWORD RegEnumValue32A( HKEY hkey, DWORD iValue, LPSTR lpszValue, @@ -1723,7 +2292,7 @@ DWORD RegEnumValueA( LPBYTE lpbDataW; DWORD ret,lpcbDataW; - dprintf_reg(stddeb,"RegEnumValueA(%x,%ld,%p,%p,%p,%p,%p,%p)\n", + dprintf_reg(stddeb,"RegEnumValue32A(%x,%ld,%p,%p,%p,%p,%p,%p)\n", hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData ); @@ -1733,7 +2302,7 @@ DWORD RegEnumValueA( lpcbDataW = *lpcbData*2; } else lpbDataW = NULL; - ret=RegEnumValueW( + ret=RegEnumValue32W( hkey, iValue, lpszValueW, @@ -1766,7 +2335,7 @@ DWORD RegEnumValueA( } /* RegEnumValue [KERNEL.223] */ -DWORD RegEnumValue( +DWORD RegEnumValue16( HKEY hkey, DWORD iValue, LPSTR lpszValue, @@ -1779,7 +2348,7 @@ DWORD RegEnumValue( dprintf_reg(stddeb,"RegEnumValue(%x,%ld,%p,%p,%p,%p,%p,%p)\n", hkey,iValue,lpszValue,lpcchValue,lpdReserved,lpdwType,lpbData,lpcbData ); - return RegEnumValueA( + return RegEnumValue32A( hkey, iValue, lpszValue, @@ -1804,15 +2373,15 @@ DWORD RegCloseKey(HKEY hkey) { * Delete registry key * * Callpath: - * RegDeleteKey -> RegDeleteKeyA -> RegDeleteKeyW + * RegDeleteKey16 -> RegDeleteKey32A -> RegDeleteKey32W */ /* RegDeleteKeyW [ADVAPI32.134] */ -DWORD RegDeleteKeyW(HKEY hkey,LPWSTR lpszSubKey) { +DWORD RegDeleteKey32W(HKEY hkey,LPWSTR lpszSubKey) { LPKEYSTRUCT *lplpPrevKey,lpNextKey,lpxkey; LPWSTR *wps; int wpc,i; - dprintf_reg(stddeb,"RegDeleteKeyW(%x,%s)\n", + dprintf_reg(stddeb,"RegDeleteKey32W(%x,%s)\n", hkey,W2C(lpszSubKey,0) ); lpNextKey = lookup_hkey(hkey); @@ -1863,40 +2432,40 @@ DWORD RegDeleteKeyW(HKEY hkey,LPWSTR lpszSubKey) { } /* RegDeleteKeyA [ADVAPI32.133] */ -DWORD RegDeleteKeyA(HKEY hkey,LPCSTR lpszSubKey) { +DWORD RegDeleteKey32A(HKEY hkey,LPCSTR lpszSubKey) { LPWSTR lpszSubKeyW; DWORD ret; - dprintf_reg(stddeb,"RegDeleteKeyA(%x,%s)\n", + dprintf_reg(stddeb,"RegDeleteKey32A(%x,%s)\n", hkey,lpszSubKey ); lpszSubKeyW=strdupA2W(lpszSubKey); - ret=RegDeleteKeyW(hkey,lpszSubKeyW); + ret=RegDeleteKey32W(hkey,lpszSubKeyW); free(lpszSubKeyW); return ret; } /* RegDeleteKey [SHELL.4] [KERNEL.219] */ -DWORD RegDeleteKey(HKEY hkey,LPCSTR lpszSubKey) { - dprintf_reg(stddeb,"RegDeleteKey(%x,%s)\n", +DWORD RegDeleteKey16(HKEY hkey,LPCSTR lpszSubKey) { + dprintf_reg(stddeb,"RegDeleteKey16(%x,%s)\n", hkey,lpszSubKey ); - return RegDeleteKeyA(hkey,lpszSubKey); + return RegDeleteKey32A(hkey,lpszSubKey); } /* * Delete registry value * * Callpath: - * RegDeleteValue -> RegDeleteValueA -> RegDeleteValueW + * RegDeleteValue16 -> RegDeleteValue32A -> RegDeleteValue32W */ /* RegDeleteValueW [ADVAPI32.136] */ -DWORD RegDeleteValueW(HKEY hkey,LPWSTR lpszValue) { +DWORD RegDeleteValue32W(HKEY hkey,LPWSTR lpszValue) { DWORD i; LPKEYSTRUCT lpkey; LPKEYVALUE val; - dprintf_reg(stddeb,"RegDeleteValueW(%x,%s)\n", + dprintf_reg(stddeb,"RegDeleteValue32W(%x,%s)\n", hkey,W2C(lpszValue,0) ); lpkey=lookup_hkey(hkey); @@ -1930,25 +2499,25 @@ DWORD RegDeleteValueW(HKEY hkey,LPWSTR lpszValue) { } /* RegDeleteValueA [ADVAPI32.135] */ -DWORD RegDeleteValueA(HKEY hkey,LPSTR lpszValue) { +DWORD RegDeleteValue32A(HKEY hkey,LPSTR lpszValue) { LPWSTR lpszValueW; DWORD ret; - dprintf_reg( stddeb, "RegDeleteValueA(%x,%s)\n", hkey,lpszValue ); + dprintf_reg( stddeb, "RegDeleteValue32A(%x,%s)\n", hkey,lpszValue ); if (lpszValue) lpszValueW=strdupA2W(lpszValue); else lpszValueW=NULL; - ret=RegDeleteValueW(hkey,lpszValueW); + ret=RegDeleteValue32W(hkey,lpszValueW); if (lpszValueW) free(lpszValueW); return ret; } /* RegDeleteValue [KERNEL.222] */ -DWORD RegDeleteValue(HKEY hkey,LPSTR lpszValue) { - dprintf_reg( stddeb,"RegDeleteValue(%x,%s)\n", hkey,lpszValue ); - return RegDeleteValueA(hkey,lpszValue); +DWORD RegDeleteValue16(HKEY hkey,LPSTR lpszValue) { + dprintf_reg( stddeb,"RegDeleteValue16(%x,%s)\n", hkey,lpszValue ); + return RegDeleteValue32A(hkey,lpszValue); } /* RegFlushKey [ADVAPI32.143] [KERNEL.227] */ @@ -1960,7 +2529,7 @@ DWORD RegFlushKey(HKEY hkey) { /* FIXME: lpcchXXXX ... is this counting in WCHARS or in BYTEs ?? */ /* RegQueryInfoKeyW [ADVAPI32.153] */ -DWORD RegQueryInfoKeyW( +DWORD RegQueryInfoKey32W( HKEY hkey, LPWSTR lpszClass, LPDWORD lpcchClass, @@ -1978,7 +2547,7 @@ DWORD RegQueryInfoKeyW( int nrofkeys,maxsubkey,maxclass,maxvalues,maxvname,maxvdata; int i; - dprintf_reg(stddeb,"RegQueryInfoKeyW(%x,......)\n",hkey); + dprintf_reg(stddeb,"RegQueryInfoKey32W(%x,......)\n",hkey); lpkey=lookup_hkey(hkey); if (!lpkey) return SHELL_ERROR_BADKEY; @@ -2036,7 +2605,7 @@ DWORD RegQueryInfoKeyW( } /* RegQueryInfoKeyA [ADVAPI32.152] */ -DWORD RegQueryInfoKeyA( +DWORD RegQueryInfoKey32A( HKEY hkey, LPSTR lpszClass, LPDWORD lpcchClass, @@ -2053,14 +2622,14 @@ DWORD RegQueryInfoKeyA( LPWSTR lpszClassW; DWORD ret; - dprintf_reg(stddeb,"RegQueryInfoKeyA(%x,......)\n",hkey); + dprintf_reg(stddeb,"RegQueryInfoKey32A(%x,......)\n",hkey); if (lpszClass) { *lpcchClass*= 2; lpszClassW = (LPWSTR)xmalloc(*lpcchClass); } else lpszClassW = NULL; - ret=RegQueryInfoKeyW( + ret=RegQueryInfoKey32W( hkey, lpszClassW, lpcchClass, diff --git a/misc/shell.c b/misc/shell.c index dd2d591eeba..ff63653759e 100644 --- a/misc/shell.c +++ b/misc/shell.c @@ -17,6 +17,7 @@ #include "stddebug.h" #include "debug.h" #include "xmalloc.h" +#include "winreg.h" extern HANDLE CURSORICON_LoadHandler( HANDLE, HINSTANCE, BOOL); extern WORD GetIconID( HANDLE hResource, DWORD resType ); @@ -37,7 +38,7 @@ void DragAcceptFiles(HWND hWnd, BOOL b) /************************************************************************* * DragQueryFile [SHELL.11] */ -UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) +UINT DragQueryFile(HDROP16 hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) { /* hDrop is a global memory block allocated with GMEM_SHARE * with DROPFILESTRUCT as a header and filenames following @@ -81,7 +82,7 @@ UINT DragQueryFile(HDROP hDrop, WORD wFile, LPSTR lpszFile, WORD wLength) /************************************************************************* * DragFinish [SHELL.12] */ -void DragFinish(HDROP h) +void DragFinish(HDROP16 h) { GlobalFree16((HGLOBAL16)h); } @@ -90,14 +91,14 @@ void DragFinish(HDROP h) /************************************************************************* * DragQueryPoint [SHELL.13] */ -BOOL DragQueryPoint(HDROP hDrop, POINT *p) +BOOL DragQueryPoint(HDROP16 hDrop, POINT16 *p) { LPDROPFILESTRUCT lpDropFileStruct; BOOL bRet; lpDropFileStruct = (LPDROPFILESTRUCT) GlobalLock16(hDrop); - memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT)); + memcpy(p,&lpDropFileStruct->ptMousePos,sizeof(POINT16)); bRet = lpDropFileStruct->fInNonClientArea; GlobalUnlock16(hDrop); @@ -145,7 +146,7 @@ HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPSTR lpPar } } else { len=200; - if (RegQueryValue((HKEY)HKEY_CLASSES_ROOT,p,subclass,&len)==SHELL_ERROR_SUCCESS) { + if (RegQueryValue16((HKEY)HKEY_CLASSES_ROOT,p,subclass,&len)==SHELL_ERROR_SUCCESS) { if (len>20) fprintf(stddeb,"ShellExecute:subclass with len %ld? (%s), please report.\n",len,subclass); subclass[len]='\0'; @@ -154,7 +155,7 @@ HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPSTR lpPar strcat(subclass,"\\command"); dprintf_exec(stddeb,"ShellExecute:looking for %s.\n",subclass); len=400; - if (RegQueryValue((HKEY)HKEY_CLASSES_ROOT,subclass,cmd,&len)==SHELL_ERROR_SUCCESS) { + if (RegQueryValue16((HKEY)HKEY_CLASSES_ROOT,subclass,cmd,&len)==SHELL_ERROR_SUCCESS) { char *t; dprintf_exec(stddeb,"ShellExecute:...got %s\n",cmd); cmd[len]='\0'; @@ -196,10 +197,131 @@ HINSTANCE ShellExecute(HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPSTR lpPar */ HINSTANCE FindExecutable(LPCSTR lpFile, LPCSTR lpDirectory, LPSTR lpResult) { - fprintf(stdnimp, "FindExecutable: someone has to fix me and this is YOUR turn! :-)\n"); + char *extension = NULL; /* pointer to file extension */ + char tmpext[5]; /* local copy to mung as we please */ + char filetype[256]; /* registry name for this filetype */ + LONG filetypelen=256; /* length of above */ + char command[256]; /* command from registry */ + LONG commandlen=256; /* This is the most DOS can handle :) */ + char buffer[256]; /* Used to GetProfileString */ + HINSTANCE retval=31; /* default - 'No association was found' */ + char *tok; /* token pointer */ + int i; /* random counter */ - lpResult[0]='\0'; - return 31; /* no association */ + dprintf_exec(stddeb, "FindExecutable: File %s, Dir %s\n", + (lpFile != NULL?lpFile:"-"), + (lpDirectory != NULL?lpDirectory:"-")); + + lpResult[0]='\0'; /* Start off with an empty return string */ + + /* trap NULL parameters on entry */ + if (( lpFile == NULL ) || ( lpDirectory == NULL ) || + ( lpResult == NULL )) + { + /* FIXME - should throw a warning, perhaps! */ + return 2; /* File not found. Close enough, I guess. */ + } + + /* First thing we need is the file's extension */ + extension = strchr( lpFile, '.' ); /* Assumes first "." is the one... */ + if ((extension == NULL) || (extension == &lpFile[strlen(lpFile)])) + { + return 31; /* no association */ + } + + /* Make local copy & lowercase it for reg & 'programs=' lookup */ + strncpy( tmpext, extension, 5 ); + if (strlen(extension)<=4) + tmpext[strlen(extension)]='\0'; + else + tmpext[4]='\0'; + for (i=0;i\shell\open\command */ + /* 3. win.ini, [extensions], extension (NB no leading '.' */ + /* All I know of the order is that registry is checked before */ + /* extensions; however, it'd make sense to check the programs */ + /* section first, so that's what happens here. */ + + /* See if it's a program */ + GetProfileString("windows", "programs", "exe pif bat com", + buffer, sizeof(buffer)); /* FIXME check return code! */ + + for (i=0;i2)) + { + strcat( lpResult, &tok[2] ); + } + } + retval=33; + } + } + else /* Check win.ini */ + { + /* Toss the leading dot */ + extension++; + GetProfileString( "extensions", extension, "", command, + sizeof(command)); + if (strlen(command)!=0) + { + strcpy( lpResult, command ); + tok=strstr( lpResult, "^" ); /* should be ^.extension? */ + if (tok != NULL) + { + tok[0]='\0'; + strcat( lpResult, lpFile ); /* what if no dir in lpFile? */ + tok=strstr( command, "^" ); /* see above */ + if ((tok != NULL) && (strlen(tok)>5)) + { + strcat( lpResult, &tok[5]); + } + } + retval=33; + } + } + + dprintf_exec(stddeb, "FindExecutable: returning %s\n", lpResult); + return retval; } static char AppName[128], AppMisc[1536]; @@ -466,7 +588,7 @@ LPSTR SHELL_FindString(LPSTR lpEnv, LPCSTR entry) UINT l = strlen(entry); for( ; *lpEnv ; lpEnv+=strlen(lpEnv)+1 ) { - if( strncasecmp(lpEnv, entry, l) ) continue; + if( lstrncmpi(lpEnv, entry, l) ) continue; if( !*(lpEnv+l) ) return (lpEnv + l); /* empty entry */ diff --git a/misc/spy.c b/misc/spy.c index f42791d1fa7..791326b565b 100644 --- a/misc/spy.c +++ b/misc/spy.c @@ -149,7 +149,14 @@ static const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] = NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* 0x00F0 - Win32 Buttons */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + "BM_GETCHECK32", /* 0x00f0 */ + "BM_SETCHECK32", /* 0x00f1 */ + "BM_GETSTATE32", /* 0x00f2 */ + "BM_SETSTATE32", /* 0x00f3 */ + "BM_SETSTYLE32", /* 0x00f4 */ + "BM_CLICK32", /* 0x00f5 */ + "BM_GETIMAGE32", /* 0x00f6 */ + "BM_SETIMAGE32", /* 0x00f7 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "WM_KEYDOWN", /* 0x0100 */ diff --git a/misc/user.c b/misc/user.c index fbaa8979b77..448d5369550 100644 --- a/misc/user.c +++ b/misc/user.c @@ -21,8 +21,9 @@ WORD USER_HeapSel = 0; #ifndef WINELIB -extern void TIMER_NukeTimers(HWND, HQUEUE ); +extern void TIMER_NukeTimers(HWND, HQUEUE); extern HTASK TASK_GetNextTask(HTASK); +extern void QUEUE_SetDoomedQueue(HQUEUE); /*********************************************************************** * GetFreeSystemResources (USER.284) @@ -130,10 +131,14 @@ void USER_AppExit(HTASK hTask, HINSTANCE hInstance, HQUEUE hQueue) HOOK_FreeQueueHooks( hQueue ); + QUEUE_SetDoomedQueue( hQueue ); + /* Nuke orphaned windows */ WIN_DestroyQueueWindows( desktop->child, hQueue ); + QUEUE_SetDoomedQueue( 0 ); + /* Free the message queue */ QUEUE_DeleteMsgQueue( hQueue ); diff --git a/misc/ver.c b/misc/ver.c index b390fd9b87d..40308c12485 100644 --- a/misc/ver.c +++ b/misc/ver.c @@ -59,8 +59,8 @@ find_ne_resource( dprintf_resource(stderr,"shiftcount is %d\n",shiftcount); dprintf_resource(stderr,"reading resource typeinfo dir.\n"); - if (!HIWORD(typeid)) typeid = (SEGPTR)((WORD)typeid | 0x8000); - if (!HIWORD(resid)) resid = (SEGPTR)((WORD)resid | 0x8000); + if (!HIWORD(typeid)) typeid = (SEGPTR)(LOWORD(typeid) | 0x8000); + if (!HIWORD(resid)) resid = (SEGPTR)(LOWORD(resid) | 0x8000); while (1) { int skipflag; diff --git a/misc/winsocket.c b/misc/winsocket.c index 0ebfaca5d99..dfa5fe0e1dc 100644 --- a/misc/winsocket.c +++ b/misc/winsocket.c @@ -25,7 +25,7 @@ #include #include "winsock.h" -#include "toolhelp.h" +#include "global.h" #include "stddebug.h" #include "debug.h" diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c index a449909f1c8..465f8c1e9f3 100644 --- a/multimedia/mmsystem.c +++ b/multimedia/mmsystem.c @@ -195,14 +195,6 @@ LRESULT DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, return DrvDefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } -/************************************************************************** -* OutputDebugStr [MMSYSTEM.30] -*/ -void OutputDebugStr(LPCSTR str) -{ - fprintf(stdnimp, "EMPTY STUB !!! OutputDebugStr('%s');\n", str); -} - /************************************************************************** * DriverCallback [MMSYSTEM.31] */ diff --git a/objects/bitblt.c b/objects/bitblt.c index b9b2b786019..2805a10a6fd 100644 --- a/objects/bitblt.c +++ b/objects/bitblt.c @@ -629,7 +629,7 @@ static void BITBLT_GetRow( XImage *image, int *pdata, short row, static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage, short widthSrc, short heightSrc, short widthDst, short heightDst, - RECT *visRectSrc, RECT *visRectDst, + RECT16 *visRectSrc, RECT16 *visRectDst, int foreground, int background, WORD mode ) { int *rowSrc, *rowDst, *pixel; @@ -775,14 +775,14 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, short widthSrc, short heightSrc, short xDst, short yDst, short widthDst, short heightDst, - RECT *visRectSrc, RECT *visRectDst ) + RECT16 *visRectSrc, RECT16 *visRectDst ) { XImage *imageSrc, *imageDst; - RECT rectSrc = *visRectSrc; - RECT rectDst = *visRectDst; - OffsetRect( &rectSrc, -xSrc, -ySrc ); - OffsetRect( &rectDst, -xDst, -yDst ); + RECT16 rectSrc = *visRectSrc; + RECT16 rectDst = *visRectDst; + OffsetRect16( &rectSrc, -xSrc, -ySrc ); + OffsetRect16( &rectDst, -xDst, -yDst ); imageSrc = XGetImage( display, dcSrc->u.x.drawable, visRectSrc->left, visRectSrc->top, visRectSrc->right - visRectSrc->left, @@ -810,7 +810,7 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, */ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, short xSrc, short ySrc, - RECT *visRectSrc ) + RECT16 *visRectSrc ) { XImage *imageSrc, *imageDst; register short x, y; @@ -884,7 +884,7 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, * Retrieve an area from the destination DC, mapping all the * pixels to Windows colors. */ -static void BITBLT_GetDstArea( DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst ) +static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) { short width = visRectDst->right - visRectDst->left; short height = visRectDst->bottom - visRectDst->top; @@ -915,7 +915,7 @@ static void BITBLT_GetDstArea( DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst ) * Put an area back into the destination DC, mapping the pixel * colors to X pixels. */ -static void BITBLT_PutDstArea( DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst ) +static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT16 *visRectDst) { short width = visRectDst->right - visRectDst->left; short height = visRectDst->bottom - visRectDst->top; @@ -953,9 +953,9 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, short widthDst, short heightDst, DC *dcSrc, short xSrc, short ySrc, short widthSrc, short heightSrc, - RECT *visRectSrc, RECT *visRectDst ) + RECT16 *visRectSrc, RECT16 *visRectDst ) { - RECT tmpRect, clipRect; + RECT16 tmpRect, clipRect; if (widthSrc < 0) { widthSrc = -widthSrc; xSrc -= widthSrc; } if (widthDst < 0) { widthDst = -widthDst; xDst -= widthDst; } @@ -964,28 +964,28 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, /* Get the destination visible rectangle */ - SetRect( &tmpRect, xDst, yDst, xDst + widthDst, yDst + heightDst ); - GetRgnBox( dcDst->w.hGCClipRgn, &clipRect ); - OffsetRect( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY ); - if (!IntersectRect( visRectDst, &tmpRect, &clipRect )) return FALSE; + SetRect16( &tmpRect, xDst, yDst, xDst + widthDst, yDst + heightDst ); + GetRgnBox16( dcDst->w.hGCClipRgn, &clipRect ); + OffsetRect16( &clipRect, dcDst->w.DCOrgX, dcDst->w.DCOrgY ); + if (!IntersectRect16( visRectDst, &tmpRect, &clipRect )) return FALSE; /* Get the source visible rectangle */ if (!dcSrc) return TRUE; - SetRect( &tmpRect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc ); + SetRect16( &tmpRect, xSrc, ySrc, xSrc + widthSrc, ySrc + heightSrc ); /* Apparently the clip region is only for output, so use hVisRgn here */ - GetRgnBox( dcSrc->w.hVisRgn, &clipRect ); - OffsetRect( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY ); - if (!IntersectRect( visRectSrc, &tmpRect, &clipRect )) return FALSE; + GetRgnBox16( dcSrc->w.hVisRgn, &clipRect ); + OffsetRect16( &clipRect, dcSrc->w.DCOrgX, dcSrc->w.DCOrgY ); + if (!IntersectRect16( visRectSrc, &tmpRect, &clipRect )) return FALSE; /* Intersect the rectangles */ if ((widthSrc == widthDst) && (heightSrc == heightDst)) /* no stretching */ { - OffsetRect( visRectSrc, xDst - xSrc, yDst - ySrc ); - if (!IntersectRect( &tmpRect, visRectSrc, visRectDst )) return FALSE; + OffsetRect16( visRectSrc, xDst - xSrc, yDst - ySrc ); + if (!IntersectRect16( &tmpRect, visRectSrc, visRectDst )) return FALSE; *visRectSrc = *visRectDst = tmpRect; - OffsetRect( visRectSrc, xSrc - xDst, ySrc - yDst ); + OffsetRect16( visRectSrc, xSrc - xDst, ySrc - yDst ); } else /* stretching */ { @@ -995,7 +995,7 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, ((visRectSrc->right-xSrc) * widthDst) / widthSrc; visRectSrc->bottom = yDst + ((visRectSrc->bottom-ySrc) * heightDst) / heightSrc; - if (!IntersectRect( &tmpRect, visRectSrc, visRectDst )) return FALSE; + if (!IntersectRect16( &tmpRect, visRectSrc, visRectDst )) return FALSE; *visRectSrc = *visRectDst = tmpRect; visRectSrc->left = xSrc + (visRectSrc->left-xDst)*widthSrc/widthDst; visRectSrc->top = ySrc + (visRectSrc->top-yDst)*heightSrc/heightDst; @@ -1003,7 +1003,7 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, short xDst, short yDst, ((visRectSrc->right-xDst) * widthSrc) / widthDst; visRectSrc->bottom = ySrc + ((visRectSrc->bottom-yDst) * heightSrc) / heightDst; - if (IsRectEmpty( visRectSrc )) return FALSE; + if (IsRectEmpty16( visRectSrc )) return FALSE; } return TRUE; } @@ -1020,7 +1020,7 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, short widthSrc, short heightSrc, DWORD rop ) { BOOL usePat, useSrc, useDst, destUsed, fStretch, fNullBrush; - RECT visRectDst, visRectSrc; + RECT16 visRectDst, visRectSrc; short width, height; const BYTE *opcode; Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */ @@ -1113,11 +1113,13 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, case SRCCOPY: /* 0xcc */ if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel) { + XSetGraphicsExposures( display, dcDst->u.x.gc, True ); XSetFunction( display, dcDst->u.x.gc, GXcopy ); XCopyArea( display, dcSrc->u.x.drawable, dcDst->u.x.drawable, dcDst->u.x.gc, visRectSrc.left, visRectSrc.top, width, height, visRectDst.left, visRectDst.top ); + XSetGraphicsExposures( display, dcDst->u.x.gc, False ); return TRUE; } if (dcSrc->w.bitsPerPixel == 1) @@ -1125,10 +1127,12 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst, XSetBackground( display, dcDst->u.x.gc, dcDst->w.textPixel ); XSetForeground( display, dcDst->u.x.gc, dcDst->w.backgroundPixel ); XSetFunction( display, dcDst->u.x.gc, GXcopy ); + XSetGraphicsExposures( display, dcDst->u.x.gc, True ); XCopyPlane( display, dcSrc->u.x.drawable, dcDst->u.x.drawable, dcDst->u.x.gc, visRectSrc.left, visRectSrc.top, width, height, visRectDst.left, visRectDst.top, 1 ); + XSetGraphicsExposures( display, dcDst->u.x.gc, False ); return TRUE; } break; diff --git a/objects/bitmap.c b/objects/bitmap.c index b9921241eb7..9efed1286e3 100644 --- a/objects/bitmap.c +++ b/objects/bitmap.c @@ -317,10 +317,11 @@ HBITMAP CreateDiscardableBitmap(HDC hdc, INT width, INT height) return CreateCompatibleBitmap(hdc, width, height); } + /*********************************************************************** - * GetBitmapDimensionEx (GDI.468) + * GetBitmapDimensionEx16 (GDI.468) */ -BOOL GetBitmapDimensionEx( HBITMAP hbitmap, LPSIZE size ) +BOOL16 GetBitmapDimensionEx16( HBITMAP16 hbitmap, LPSIZE16 size ) { BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); if (!bmp) return FALSE; @@ -330,19 +331,34 @@ BOOL GetBitmapDimensionEx( HBITMAP hbitmap, LPSIZE size ) /*********************************************************************** - * GetBitmapDimension (GDI.162) + * GetBitmapDimensionEx32 (GDI.468) */ -DWORD GetBitmapDimension( HBITMAP hbitmap ) +BOOL32 GetBitmapDimensionEx32( HBITMAP32 hbitmap, LPSIZE32 size ) { - SIZE size; - if (!GetBitmapDimensionEx( hbitmap, &size )) return 0; - return size.cx | (size.cy << 16); + BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); + if (!bmp) return FALSE; + size->cx = (INT32)bmp->size.cx; + size->cy = (INT32)bmp->size.cy; + return TRUE; } + /*********************************************************************** - * SetBitmapDimensionEx (GDI.478) + * GetBitmapDimension (GDI.162) */ -BOOL SetBitmapDimensionEx( HBITMAP hbitmap, short x, short y, LPSIZE prevSize ) +DWORD GetBitmapDimension( HBITMAP16 hbitmap ) +{ + SIZE16 size; + if (!GetBitmapDimensionEx16( hbitmap, &size )) return 0; + return MAKELONG( size.cx, size.cy ); +} + + +/*********************************************************************** + * SetBitmapDimensionEx16 (GDI.478) + */ +BOOL16 SetBitmapDimensionEx16( HBITMAP16 hbitmap, INT16 x, INT16 y, + LPSIZE16 prevSize ) { BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); if (!bmp) return FALSE; @@ -353,12 +369,27 @@ BOOL SetBitmapDimensionEx( HBITMAP hbitmap, short x, short y, LPSIZE prevSize ) } +/*********************************************************************** + * SetBitmapDimensionEx32 (GDI.478) + */ +BOOL32 SetBitmapDimensionEx32( HBITMAP32 hbitmap, INT32 x, INT32 y, + LPSIZE32 prevSize ) +{ + BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); + if (!bmp) return FALSE; + if (prevSize) CONV_SIZE16TO32( &bmp->size, prevSize ); + bmp->size.cx = (INT16)x; + bmp->size.cy = (INT16)y; + return TRUE; +} + + /*********************************************************************** * SetBitmapDimension (GDI.163) */ -DWORD SetBitmapDimension( HBITMAP hbitmap, short x, short y ) +DWORD SetBitmapDimension( HBITMAP16 hbitmap, INT16 x, INT16 y ) { - SIZE size; - if (!SetBitmapDimensionEx( hbitmap, x, y, &size )) return 0; - return size.cx | (size.cy << 16); + SIZE16 size; + if (!SetBitmapDimensionEx16( hbitmap, x, y, &size )) return 0; + return MAKELONG( size.cx, size.cy ); } diff --git a/objects/clipping.c b/objects/clipping.c index fc96017042d..7064d038a1a 100644 --- a/objects/clipping.c +++ b/objects/clipping.c @@ -304,11 +304,11 @@ BOOL PtVisible( HDC hdc, short x, short y ) /*********************************************************************** - * RectVisible (GDI.104) + * RectVisible16 (GDI.104) */ -BOOL RectVisible( HDC hdc, LPRECT rect ) +BOOL16 RectVisible16( HDC16 hdc, LPRECT16 rect ) { - RECT tmpRect; + RECT16 tmpRect; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; dprintf_clipping(stddeb,"RectVisible: %04x %d,%dx%d,%d\n", @@ -316,22 +316,46 @@ BOOL RectVisible( HDC hdc, LPRECT rect ) if (!dc->w.hGCClipRgn) return FALSE; /* copy rectangle to avoid overwriting by LPtoDP */ tmpRect = *rect; - LPtoDP( hdc, (LPPOINT)&tmpRect, 2 ); - return RectInRegion( dc->w.hGCClipRgn, &tmpRect ); + LPtoDP16( hdc, (LPPOINT16)&tmpRect, 2 ); + return RectInRegion16( dc->w.hGCClipRgn, &tmpRect ); } /*********************************************************************** - * GetClipBox (GDI.77) + * RectVisible32 (GDI32.282) */ -int GetClipBox( HDC hdc, LPRECT rect ) +BOOL32 RectVisible32( HDC32 hdc, LPRECT32 rect ) +{ + RECT16 rect16; + CONV_RECT32TO16( rect, &rect16 ); + return RectVisible16( (HDC16)hdc, &rect16 ); +} + + +/*********************************************************************** + * GetClipBox16 (GDI.77) + */ +INT16 GetClipBox16( HDC16 hdc, LPRECT16 rect ) { int ret; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return ERROR; - dprintf_clipping(stddeb, "GetClipBox: %04x %p\n", hdc, rect ); - ret = GetRgnBox( dc->w.hGCClipRgn, rect ); - DPtoLP( hdc, (LPPOINT)rect, 2 ); + ret = GetRgnBox16( dc->w.hGCClipRgn, rect ); + DPtoLP16( hdc, (LPPOINT16)rect, 2 ); + return ret; +} + + +/*********************************************************************** + * GetClipBox32 (GDI32.162) + */ +INT32 GetClipBox32( HDC32 hdc, LPRECT32 rect ) +{ + INT32 ret; + DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); + if (!dc) return ERROR; + ret = GetRgnBox32( dc->w.hGCClipRgn, rect ); + DPtoLP32( hdc, (LPPOINT32)rect, 2 ); return ret; } diff --git a/objects/color.c b/objects/color.c index 9d78e5498f8..41e612afde9 100644 --- a/objects/color.c +++ b/objects/color.c @@ -106,11 +106,11 @@ static BOOL COLOR_BuildMap( Colormap map, int depth, int size ) * * Create the system palette. */ -static HPALETTE COLOR_InitPalette(void) +static HPALETTE16 COLOR_InitPalette(void) { int i, size, pixel; XColor color; - HPALETTE hpalette; + HPALETTE16 hpalette; LOGPALETTE * palPtr; WORD *colorTranslation, *revTranslation; @@ -215,7 +215,7 @@ COLOR_Computeshifts(unsigned long maskbits, int *shift, int *max) * * Initialize color map and system palette. */ -HPALETTE COLOR_Init(void) +HPALETTE16 COLOR_Init(void) { Visual * visual = DefaultVisual( display, DefaultScreen(display) ); diff --git a/objects/cursoricon.c b/objects/cursoricon.c index 7668967c85a..700b53b0f83 100644 --- a/objects/cursoricon.c +++ b/objects/cursoricon.c @@ -39,7 +39,7 @@ Cursor CURSORICON_XCursor = None; /* Current X cursor */ static HCURSOR hActiveCursor = 0; /* Active cursor */ static int CURSOR_ShowCount = 0; /* Cursor display count */ -static RECT CURSOR_ClipRect; /* Cursor clipping rect */ +static RECT32 CURSOR_ClipRect; /* Cursor clipping rect */ /********************************************************************** * CURSORICON_FindBestIcon @@ -237,7 +237,7 @@ HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance, HANDLE hAndBits, hXorBits; HDC hdc; int size, sizeAnd, sizeXor; - POINT hotspot = { 0 ,0 }; + POINT16 hotspot = { 0 ,0 }; BITMAPOBJ *bmpXor, *bmpAnd; BITMAPINFO *bmi, *pInfo; CURSORICONINFO *info; @@ -245,7 +245,7 @@ HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance, if (fCursor) /* If cursor, get the hotspot */ { - POINT *pt = (POINT *)LockResource( handle ); + POINT16 *pt = (POINT16 *)LockResource( handle ); hotspot = *pt; bmi = (BITMAPINFO *)(pt + 1); } @@ -864,20 +864,31 @@ HCURSOR GetCursor(void) /*********************************************************************** - * ClipCursor (USER.16) + * ClipCursor16 (USER.16) */ -BOOL ClipCursor( RECT *rect ) +BOOL16 ClipCursor16( const RECT16 *rect ) { - if (!rect) SetRectEmpty( &CURSOR_ClipRect ); - else CopyRect( &CURSOR_ClipRect, rect ); + if (!rect) SetRectEmpty32( &CURSOR_ClipRect ); + else CONV_RECT16TO32( rect, &CURSOR_ClipRect ); return TRUE; } /*********************************************************************** - * GetCursorPos (USER.17) + * ClipCursor32 (USER32.52) */ -void GetCursorPos( POINT *pt ) +BOOL32 ClipCursor32( const RECT32 *rect ) +{ + if (!rect) SetRectEmpty32( &CURSOR_ClipRect ); + else CopyRect32( &CURSOR_ClipRect, rect ); + return TRUE; +} + + +/*********************************************************************** + * GetCursorPos16 (USER.17) + */ +void GetCursorPos16( POINT16 *pt ) { Window root, child; int rootX, rootY, childX, childY; @@ -897,11 +908,31 @@ void GetCursorPos( POINT *pt ) /*********************************************************************** - * GetClipCursor (USER.309) + * GetCursorPos32 (USER32.228) */ -void GetClipCursor( RECT *rect ) +void GetCursorPos32( POINT32 *pt ) { - if (rect) CopyRect( rect, &CURSOR_ClipRect ); + POINT16 pt16; + GetCursorPos16( &pt16 ); + if (pt) CONV_POINT16TO32( &pt16, pt ); +} + + +/*********************************************************************** + * GetClipCursor16 (USER.309) + */ +void GetClipCursor16( RECT16 *rect ) +{ + if (rect) CONV_RECT32TO16( &CURSOR_ClipRect, rect ); +} + + +/*********************************************************************** + * GetClipCursor32 (USER32.220) + */ +void GetClipCursor32( RECT32 *rect ) +{ + if (rect) CopyRect32( rect, &CURSOR_ClipRect ); } diff --git a/objects/dcvalues.c b/objects/dcvalues.c index cf67de748bf..b1b959b814d 100644 --- a/objects/dcvalues.c +++ b/objects/dcvalues.c @@ -26,13 +26,22 @@ func_type func_name( HDC hdc ) \ } #define DC_GET_VAL_EX( func_name, ret_x, ret_y ) \ -BOOL func_name( HDC hdc, LPPOINT pt ) \ +BOOL16 func_name##16( HDC16 hdc, LPPOINT16 pt ) \ { \ DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \ if (!dc) return FALSE; \ pt->x = dc->w.ret_x; \ pt->y = dc->w.ret_y; \ return TRUE; \ +} \ + \ +BOOL32 func_name##32( HDC32 hdc, LPPOINT32 pt ) \ +{ \ + DC * dc = (DC *) GDI_GetObjPtr( (HDC16)hdc, DC_MAGIC ); \ + if (!dc) return FALSE; \ + pt->x = dc->w.ret_x; \ + pt->y = dc->w.ret_y; \ + return TRUE; \ } #define DC_SET_MODE( func_name, dc_field, min_val, max_val, meta_func ) \ diff --git a/objects/font.c b/objects/font.c index 7917a53db3f..ab57ab2ef26 100644 --- a/objects/font.c +++ b/objects/font.c @@ -17,6 +17,7 @@ #include "metafile.h" #include "callback.h" #include "options.h" +#include "string32.h" #include "xmalloc.h" #include "stddebug.h" #include "debug.h" @@ -616,16 +617,29 @@ INT GetTextFace( HDC hdc, INT count, LPSTR name ) */ DWORD GetTextExtent( HDC hdc, LPCSTR str, short count ) { - SIZE size; - if (!GetTextExtentPoint( hdc, str, count, &size )) return 0; + SIZE16 size; + if (!GetTextExtentPoint16( hdc, str, count, &size )) return 0; return MAKELONG( size.cx, size.cy ); } /*********************************************************************** - * GetTextExtentPoint (GDI.471) + * GetTextExtentPoint16 (GDI.471) */ -BOOL GetTextExtentPoint( HDC hdc, LPCSTR str, short count, LPSIZE size ) +BOOL16 GetTextExtentPoint16( HDC16 hdc, LPCSTR str, INT16 count, LPSIZE16 size) +{ + SIZE32 size32; + BOOL32 ret = GetTextExtentPoint32A( hdc, str, count, &size32 ); + CONV_SIZE32TO16( &size32, size ); + return (BOOL16)ret; +} + + +/*********************************************************************** + * GetTextExtentPoint32A (GDI32.232) + */ +BOOL32 GetTextExtentPoint32A( HDC32 hdc, LPCSTR str, INT32 count, + LPSIZE32 size ) { int dir, ascent, descent; XCharStruct info; @@ -639,12 +653,25 @@ BOOL GetTextExtentPoint( HDC hdc, LPCSTR str, short count, LPSIZE size ) size->cy = abs((dc->u.x.font.fstruct->ascent+dc->u.x.font.fstruct->descent) * dc->w.WndExtY / dc->w.VportExtY); - dprintf_font(stddeb,"GetTextExtentPoint(%04x '%*.*s' %d %p): returning %d,%d\n", + dprintf_font(stddeb,"GetTextExtentPoint(%08x '%*.*s' %d %p): returning %d,%d\n", hdc, count, count, str, count, size, size->cx, size->cy ); return TRUE; } +/*********************************************************************** + * GetTextExtentPoint32W (GDI32.233) + */ +BOOL32 GetTextExtentPoint32W( HDC32 hdc, LPCWSTR str, INT32 count, + LPSIZE32 size ) +{ + char *p = STRING32_DupUniToAnsi( str ); + BOOL32 ret = GetTextExtentPoint32A( hdc, p, count, size ); + free( p ); + return ret; +} + + /*********************************************************************** * GetTextMetrics (GDI.93) */ @@ -667,6 +694,49 @@ BOOL GetTextMetrics( HDC hdc, LPTEXTMETRIC metrics ) * dc->w.WndExtX / dc->w.VportExtX ); metrics->tmAveCharWidth = abs( metrics->tmAveCharWidth * dc->w.WndExtX / dc->w.VportExtX ); + + dprintf_font(stdnimp,"text metrics:\n + InternalLeading = %i + ExternalLeading = %i + MaxCharWidth = %i + Weight = %i + Italic = %i + Underlined = %i + StruckOut = %i + FirstChar = %i + LastChar = %i + DefaultChar = %i + BreakChar = %i + CharSet = %i + Overhang = %i + DigitizedAspectX = %i + DigitizedAspectY = %i + AveCharWidth = %i + MaxCharWidth = %i + Ascent = %i + Descent = %i + Height = %i\n", + metrics->tmInternalLeading, + metrics->tmExternalLeading, + metrics->tmMaxCharWidth, + metrics->tmWeight, + metrics->tmItalic, + metrics->tmUnderlined, + metrics->tmStruckOut, + metrics->tmFirstChar, + metrics->tmLastChar, + metrics->tmDefaultChar, + metrics->tmBreakChar, + metrics->tmCharSet, + metrics->tmOverhang, + metrics->tmDigitizedAspectX, + metrics->tmDigitizedAspectY, + metrics->tmAveCharWidth, + metrics->tmMaxCharWidth, + metrics->tmAscent, + metrics->tmDescent, + metrics->tmHeight); + return TRUE; } diff --git a/objects/gdiobj.c b/objects/gdiobj.c index e957f7e4094..6af4d94aa17 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -11,12 +11,12 @@ #include "bitmap.h" #include "brush.h" #include "font.h" +#include "heap.h" #include "palette.h" #include "pen.h" #include "region.h" #include "callback.h" #include "stddebug.h" -/* #define DEBUG_GDI */ #include "debug.h" #include "xmalloc.h" @@ -160,7 +160,7 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] = */ BOOL GDI_Init(void) { - HPALETTE hpalette; + HPALETTE16 hpalette; /* Create default palette */ @@ -244,7 +244,7 @@ GDIOBJHDR * GDI_GetObjPtr( HANDLE handle, WORD magic ) /*********************************************************************** * DeleteObject (GDI.69) */ -BOOL DeleteObject( HGDIOBJ obj ) +BOOL DeleteObject( HGDIOBJ16 obj ) { /* Check if object is valid */ @@ -380,6 +380,8 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam ) }; int i, retval = 0; + LOGPEN *pen; + LOGBRUSH *brush = NULL; dprintf_gdi( stddeb, "EnumObjects: %04x %d %08lx %08lx\n", hdc, nObjType, (DWORD)lpEnumFunc, lParam ); @@ -387,40 +389,50 @@ INT EnumObjects( HDC hdc, INT nObjType, GOBJENUMPROC lpEnumFunc, LPARAM lParam ) { case OBJ_PEN: /* Enumerate solid pens */ + if (!(pen = SEGPTR_NEW(LOGPEN))) break; for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) { - LOGPEN pen = { PS_SOLID, { 1, 0 }, solid_colors[i] }; - retval = CallEnumObjectsProc( lpEnumFunc, MAKE_SEGPTR(&pen), + pen->lopnStyle = PS_SOLID; + pen->lopnWidth.x = 1; + pen->lopnWidth.y = 0; + pen->lopnColor = solid_colors[i]; + retval = CallEnumObjectsProc( lpEnumFunc, SEGPTR_GET(pen), lParam ); dprintf_gdi( stddeb, "EnumObject: solid pen %08lx, ret=%d\n", solid_colors[i], retval); if (!retval) break; } + SEGPTR_FREE(pen); break; case OBJ_BRUSH: /* Enumerate solid brushes */ + if (!(brush = SEGPTR_NEW(LOGBRUSH))) break; for (i = 0; i < sizeof(solid_colors)/sizeof(solid_colors[0]); i++) { - LOGBRUSH brush = { BS_SOLID, solid_colors[i], 0 }; - retval = CallEnumObjectsProc( lpEnumFunc, MAKE_SEGPTR(&brush), + brush->lbStyle = BS_SOLID; + brush->lbColor = solid_colors[i]; + brush->lbHatch = 0; + retval = CallEnumObjectsProc( lpEnumFunc, SEGPTR_GET(brush), lParam ); dprintf_gdi( stddeb, "EnumObject: solid brush %08lx, ret=%d\n", solid_colors[i], retval); if (!retval) break; } - if (!retval) break; /* Now enumerate hatched brushes */ - for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) + if (retval) for (i = HS_HORIZONTAL; i <= HS_DIAGCROSS; i++) { - LOGBRUSH brush = { BS_HATCHED, RGB(0,0,0), i }; - retval = CallEnumObjectsProc( lpEnumFunc, MAKE_SEGPTR(&brush), + brush->lbStyle = BS_HATCHED; + brush->lbColor = RGB(0,0,0); + brush->lbHatch = i; + retval = CallEnumObjectsProc( lpEnumFunc, SEGPTR_GET(brush), lParam ); dprintf_gdi( stddeb, "EnumObject: hatched brush %d, ret=%d\n", i, retval); if (!retval) break; } + SEGPTR_FREE(brush); break; default: diff --git a/objects/metafile.c b/objects/metafile.c index 6ca814ab4e2..983b4195510 100644 --- a/objects/metafile.c +++ b/objects/metafile.c @@ -307,7 +307,7 @@ BOOL EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC lpEnumFunc,LPARAM lpData) { METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf); METARECORD *mr; - HANDLETABLE *ht; + SEGPTR ht; int offset = 0; dprintf_metafile(stddeb,"EnumMetaFile(%04x, %04x, %08lx, %08lx)\n", @@ -317,7 +317,7 @@ BOOL EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC lpEnumFunc,LPARAM lpData) hHT = GlobalAlloc16(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(HANDLETABLE) * mh->mtNoObjects); - ht = (HANDLETABLE *)GlobalLock16(hHT); + ht = WIN16_GlobalLock16(hHT); offset = mh->mtHeaderSize * 2; @@ -326,9 +326,8 @@ BOOL EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC lpEnumFunc,LPARAM lpData) while (offset < (mh->mtSize * 2)) { mr = (METARECORD *)((char *)mh + offset); - if (!CallEnumMetafileProc(lpEnumFunc, hdc, MAKE_SEGPTR(ht), - MAKE_SEGPTR(mr), mh->mtNoObjects, - (LONG)lpData)) + if (!CallEnumMetafileProc(lpEnumFunc, hdc, ht, MAKE_SEGPTR(mr), /* FIXME!! */ + mh->mtNoObjects, (LONG)lpData)) break; offset += (mr->rdSize * 2); @@ -504,22 +503,22 @@ void PlayMetaFileRecord(HDC hdc, HANDLETABLE *ht, METARECORD *mr, case META_TEXTOUT: s1 = *(mr->rdParam); - TextOut(hdc, *(mr->rdParam + ((s1 + 1) >> 1) + 2), - *(mr->rdParam + ((s1 + 1) >> 1) + 1), - (char *)(mr->rdParam + 1), s1); + TextOut16(hdc, *(mr->rdParam + ((s1 + 1) >> 1) + 2), + *(mr->rdParam + ((s1 + 1) >> 1) + 1), + (char *)(mr->rdParam + 1), s1); break; case META_POLYGON: - Polygon(hdc, (LPPOINT)(mr->rdParam + 1), *(mr->rdParam)); + Polygon16(hdc, (LPPOINT16)(mr->rdParam + 1), *(mr->rdParam)); break; case META_POLYPOLYGON: - PolyPolygon(hdc, (LPPOINT)(mr->rdParam + *(mr->rdParam) + 1), - (LPINT16)(mr->rdParam + 1), *(mr->rdParam)); + PolyPolygon16(hdc, (LPPOINT16)(mr->rdParam + *(mr->rdParam) + 1), + (LPINT16)(mr->rdParam + 1), *(mr->rdParam)); break; case META_POLYLINE: - Polyline(hdc, (LPPOINT)(mr->rdParam + 1), *(mr->rdParam)); + Polyline16(hdc, (LPPOINT16)(mr->rdParam + 1), *(mr->rdParam)); break; case META_RESTOREDC: @@ -614,7 +613,8 @@ void PlayMetaFileRecord(HDC hdc, HANDLETABLE *ht, METARECORD *mr, x6=mr->rdParam[(s1+1)/2+5]; /* unknown meaning */ x7=mr->rdParam[(s1+1)/2+6]; /* unknown meaning */ x8=mr->rdParam[(s1+1)/2+7]; /* unknown meaning */ - ExtTextOut(hdc, x, y, options, (LPRECT) &mr->rdParam[(s1+1)/2+4], (char *)(mr->rdParam + 4), s1, NULL); + ExtTextOut16( hdc, x, y, options, (LPRECT16) &mr->rdParam[(s1+1)/2+4], + (char *)(mr->rdParam + 4), s1, NULL ); /* fprintf(stderr,"EXTTEXTOUT (len: %d) %hd : %hd %hd %hd %hd [%s].\n", (mr->rdSize-s1),options,x5,x6,x7,x8,(char*) &(mr->rdParam[4]) );*/ } @@ -1058,7 +1058,7 @@ BOOL MF_CreatePatternBrush(DC *dc, HBRUSH hBrush, LOGBRUSH *logbrush) * MF_CreatePenIndirect */ -BOOL MF_CreatePenIndirect(DC *dc, HPEN hPen, LOGPEN *logpen) +BOOL MF_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN *logpen) { int index; HMETAFILE handle; @@ -1131,7 +1131,7 @@ BOOL MF_CreateFontIndirect(DC *dc, HFONT hFont, LOGFONT *logfont) /****************************************************************** * MF_TextOut */ -BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count) +BOOL MF_TextOut(DC *dc, short x, short y, LPCSTR str, short count) { HMETAFILE handle; DWORD len; @@ -1160,7 +1160,7 @@ BOOL MF_TextOut(DC *dc, short x, short y, LPSTR str, short count) /****************************************************************** * MF_MetaPoly - implements Polygon and Polyline */ -BOOL MF_MetaPoly(DC *dc, short func, LPPOINT pt, short count) +BOOL MF_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count) { HMETAFILE handle; DWORD len; diff --git a/objects/oembitmap.c b/objects/oembitmap.c index ca330ce9f77..bdb6de90caf 100644 --- a/objects/oembitmap.c +++ b/objects/oembitmap.c @@ -331,7 +331,7 @@ static HBITMAP OBM_MakeBitmap( WORD width, WORD height, * Create the 2 bitmaps from XPM data. */ static BOOL OBM_CreateBitmaps( char **data, BOOL color, HBITMAP *hBitmap, - HBITMAP *hBitmapMask, POINT *hotspot ) + HBITMAP *hBitmapMask, POINT16 *hotspot ) { Pixmap pixmap, pixmask; XpmAttributes *attrs; @@ -407,7 +407,7 @@ HANDLE OBM_LoadCursorIcon( WORD id, BOOL fCursor ) CURSORICONINFO *pInfo; BITMAPOBJ *bmpXor, *bmpAnd; HBITMAP hXorBits, hAndBits; - POINT hotspot; + POINT16 hotspot; int sizeXor, sizeAnd; if (fCursor) diff --git a/objects/palette.c b/objects/palette.c index 25001e16962..1e76dce8049 100644 --- a/objects/palette.c +++ b/objects/palette.c @@ -20,7 +20,7 @@ static WORD SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */ /*********************************************************************** * PALETTE_GetNearestIndexAndColor */ -static WORD PALETTE_GetNearestIndexAndColor(HPALETTE hpalette, COLORREF *color) +static WORD PALETTE_GetNearestIndexAndColor(HPALETTE16 hpalette, COLORREF *color) { int i, minDist, dist; WORD index = 0; @@ -69,10 +69,10 @@ static WORD PALETTE_GetNearestIndexAndColor(HPALETTE hpalette, COLORREF *color) /*********************************************************************** * CreatePalette (GDI.360) */ -HPALETTE CreatePalette( const LOGPALETTE* palette ) +HPALETTE16 CreatePalette( const LOGPALETTE* palette ) { PALETTEOBJ * palettePtr; - HPALETTE hpalette; + HPALETTE16 hpalette; int size; size = sizeof(LOGPALETTE) + (palette->palNumEntries - 1) * sizeof(PALETTEENTRY); @@ -87,7 +87,7 @@ HPALETTE CreatePalette( const LOGPALETTE* palette ) /*********************************************************************** * GetPaletteEntries (GDI.363) */ -WORD GetPaletteEntries( HPALETTE hpalette, WORD start, WORD count, +WORD GetPaletteEntries( HPALETTE16 hpalette, WORD start, WORD count, LPPALETTEENTRY entries ) { PALETTEOBJ * palPtr; @@ -107,7 +107,7 @@ WORD GetPaletteEntries( HPALETTE hpalette, WORD start, WORD count, /*********************************************************************** * SetPaletteEntries (GDI.364) */ -WORD SetPaletteEntries( HPALETTE hpalette, WORD start, WORD count, +WORD SetPaletteEntries( HPALETTE16 hpalette, WORD start, WORD count, LPPALETTEENTRY entries ) { PALETTEOBJ * palPtr; @@ -126,7 +126,7 @@ WORD SetPaletteEntries( HPALETTE hpalette, WORD start, WORD count, /*********************************************************************** * ResizePalette (GDI.368) */ -BOOL ResizePalette(HPALETTE hPal, UINT cEntries) +BOOL ResizePalette(HPALETTE16 hPal, UINT cEntries) { fprintf(stdnimp,"ResizePalette: empty stub! \n"); return FALSE; @@ -135,7 +135,7 @@ BOOL ResizePalette(HPALETTE hPal, UINT cEntries) /*********************************************************************** * AnimatePalette (GDI.367) */ -BOOL AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries, +BOOL AnimatePalette(HPALETTE16 hPal, UINT StartIndex, UINT NumEntries, LPPALETTEENTRY PaletteColors) { fprintf(stdnimp,"AnimatePalette: empty stub! \n"); @@ -196,7 +196,7 @@ WORD GetSystemPaletteEntries( HDC hdc, WORD start, WORD count, /*********************************************************************** * GetNearestPaletteIndex (GDI.370) */ -WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color ) +WORD GetNearestPaletteIndex( HPALETTE16 hpalette, COLORREF color ) { WORD index = PALETTE_GetNearestIndexAndColor( hpalette, &color ); dprintf_palette(stddeb,"GetNearestPaletteIndex(%04x,%06lx): returning %d\n", @@ -235,9 +235,9 @@ int PALETTE_GetObject( PALETTEOBJ * palette, int count, LPSTR buffer ) /*********************************************************************** * GDISelectPalette (GDI.361) */ -HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal ) +HPALETTE16 GDISelectPalette( HDC hdc, HPALETTE16 hpal ) { - HPALETTE prev; + HPALETTE16 prev; DC *dc; dprintf_palette(stddeb, "GDISelectPalette: %04x %04x\n", hdc, hpal ); @@ -255,15 +255,49 @@ HPALETTE GDISelectPalette( HDC hdc, HPALETTE hpal ) */ UINT GDIRealizePalette( HDC hdc ) { - dprintf_palette(stdnimp, "GDIRealizePalette: %04x\n", hdc ); - return 0; + UINT realized = 0; + COLORREF color; + DC* dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ) ; + PALETTEOBJ* palPtr; + + dprintf_palette(stdnimp, "GDIRealizePalette: %04x...", hdc ); + + if( dc ) + { + palPtr = (PALETTEOBJ *) GDI_GetObjPtr( dc->w.hPalette, PALETTE_MAGIC ); + + if( palPtr ) + { + WORD index, i; + HANDLE hMap; + WORD* pMap; + + hMap = GDI_HEAP_ALLOC(sizeof(WORD)*palPtr->logpalette.palNumEntries); + pMap = (WORD*)GDI_HEAP_LIN_ADDR( hMap ); + + if( pMap ) + { + for (i = 0; i < palPtr->logpalette.palNumEntries ; i++) + { + color = *(COLORREF*)(palPtr->logpalette.palPalEntry + i); + index = PALETTE_GetNearestIndexAndColor( STOCK_DEFAULT_PALETTE, &color); + if( index != i ) realized++; + pMap[i] = index; + } + COLOR_SetMapping(dc, hMap, 0, i); + GDI_HEAP_FREE(hMap); + } + } + } + dprintf_palette(stdnimp, " realized %i colors\n", realized ); + return realized; } /*********************************************************************** * SelectPalette (USER.282) */ -HPALETTE SelectPalette(HDC hDC, HPALETTE hPal, BOOL bForceBackground) +HPALETTE16 SelectPalette(HDC hDC, HPALETTE16 hPal, BOOL bForceBackground) { return GDISelectPalette( hDC, hPal ); } diff --git a/objects/pen.c b/objects/pen.c index bc5a986ce77..f28ce045cb0 100644 --- a/objects/pen.c +++ b/objects/pen.c @@ -13,7 +13,7 @@ /*********************************************************************** * CreatePen (GDI.61) */ -HPEN CreatePen( INT style, INT width, COLORREF color ) +HPEN16 CreatePen( INT style, INT width, COLORREF color ) { LOGPEN logpen = { style, { width, 0 }, color }; dprintf_gdi(stddeb, "CreatePen: %d %d %06lx\n", style, width, color ); @@ -24,10 +24,10 @@ HPEN CreatePen( INT style, INT width, COLORREF color ) /*********************************************************************** * CreatePenIndirect (GDI.62) */ -HPEN CreatePenIndirect( const LOGPEN * pen ) +HPEN16 CreatePenIndirect( const LOGPEN * pen ) { PENOBJ * penPtr; - HPEN hpen; + HPEN16 hpen; if (pen->lopnStyle > PS_INSIDEFRAME) return 0; hpen = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC ); @@ -52,13 +52,13 @@ int PEN_GetObject( PENOBJ * pen, int count, LPSTR buffer ) /*********************************************************************** * PEN_SelectObject */ -HPEN PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen ) +HPEN16 PEN_SelectObject( DC * dc, HPEN16 hpen, PENOBJ * pen ) { static char dash_dash[] = { 5, 3 }; /* ----- ----- ----- */ static char dash_dot[] = { 2, 2 }; /* -- -- -- -- -- -- */ static char dash_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */ static char dash_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */ - HPEN prevHandle = dc->w.hPen; + HPEN16 prevHandle = dc->w.hPen; if (dc->header.wMagic == METAFILE_DC_MAGIC) if (MF_CreatePenIndirect(dc, hpen, &(pen->logpen))) diff --git a/objects/region.c b/objects/region.c index 935b99665c6..29bcbc19f14 100644 --- a/objects/region.c +++ b/objects/region.c @@ -7,10 +7,8 @@ #include #include - #include "region.h" #include "stddebug.h" -/* #define DEBUG_REGION */ #include "debug.h" @@ -26,9 +24,9 @@ BOOL REGION_DeleteObject( HRGN hrgn, RGNOBJ * obj ) /*********************************************************************** - * OffsetRgn (GDI.101) + * OffsetRgn (GDI.101) (GDI32.256) */ -int OffsetRgn( HRGN hrgn, short x, short y ) +INT16 OffsetRgn( HRGN32 hrgn, INT32 x, INT32 y ) { RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ); if (!obj) return ERROR; @@ -40,33 +38,45 @@ int OffsetRgn( HRGN hrgn, short x, short y ) /*********************************************************************** - * GetRgnBox (GDI.134) + * GetRgnBox16 (GDI.134) */ -int GetRgnBox( HRGN hrgn, LPRECT rect ) +INT16 GetRgnBox16( HRGN16 hrgn, LPRECT16 rect ) { RGNOBJ * obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ); if (!obj) return ERROR; dprintf_region(stddeb, "GetRgnBox: %04x\n", hrgn ); if (!obj->xrgn) { - SetRectEmpty( rect ); + SetRectEmpty16( rect ); return NULLREGION; } else { XRectangle xrect; XClipBox( obj->xrgn, &xrect ); - SetRect( rect, xrect.x, xrect.y, - xrect.x + xrect.width, xrect.y + xrect.height); + SetRect16( rect, xrect.x, xrect.y, + xrect.x + xrect.width, xrect.y + xrect.height); return COMPLEXREGION; } } /*********************************************************************** - * CreateRectRgn (GDI.64) + * GetRgnBox32 (GDI32.219) */ -HRGN CreateRectRgn( INT left, INT top, INT right, INT bottom ) +INT32 GetRgnBox32( HRGN32 hrgn, LPRECT32 rect ) +{ + RECT16 r; + INT16 ret = GetRgnBox16( hrgn, &r ); + CONV_RECT16TO32( &r, rect ); + return ret; +} + + +/*********************************************************************** + * CreateRectRgn (GDI.64) (GDI32.59) + */ +HRGN CreateRectRgn( INT32 left, INT32 top, INT32 right, INT32 bottom ) { HRGN hrgn; RGNOBJ *obj; @@ -91,18 +101,27 @@ HRGN CreateRectRgn( INT left, INT top, INT right, INT bottom ) /*********************************************************************** - * CreateRectRgnIndirect (GDI.65) + * CreateRectRgnIndirect16 (GDI.65) */ -HRGN CreateRectRgnIndirect( const RECT* rect ) +HRGN16 CreateRectRgnIndirect16( const RECT16* rect ) { return CreateRectRgn( rect->left, rect->top, rect->right, rect->bottom ); } /*********************************************************************** - * SetRectRgn (GDI.172) + * CreateRectRgnIndirect32 (GDI32.60) */ -void SetRectRgn( HRGN hrgn, short left, short top, short right, short bottom ) +HRGN32 CreateRectRgnIndirect32( const RECT32* rect ) +{ + return CreateRectRgn( rect->left, rect->top, rect->right, rect->bottom ); +} + + +/*********************************************************************** + * SetRectRgn (GDI.172) (GDI32.332) + */ +void SetRectRgn( HRGN32 hrgn, INT32 left, INT32 top, INT32 right, INT32 bottom) { RGNOBJ * obj; @@ -122,10 +141,10 @@ void SetRectRgn( HRGN hrgn, short left, short top, short right, short bottom ) /*********************************************************************** - * CreateRoundRectRgn (GDI.444) + * CreateRoundRectRgn (GDI.444) (GDI32.61) */ -HRGN CreateRoundRectRgn( INT left, INT top, INT right, INT bottom, - INT ellipse_width, INT ellipse_height ) +HRGN CreateRoundRectRgn( INT32 left, INT32 top, INT32 right, INT32 bottom, + INT32 ellipse_width, INT32 ellipse_height ) { RGNOBJ * obj; HRGN hrgn; @@ -218,9 +237,9 @@ HRGN CreateRoundRectRgn( INT left, INT top, INT right, INT bottom, /*********************************************************************** - * CreateEllipticRgn (GDI.54) + * CreateEllipticRgn (GDI.54) (GDI32.39) */ -HRGN CreateEllipticRgn( INT left, INT top, INT right, INT bottom ) +HRGN CreateEllipticRgn( INT32 left, INT32 top, INT32 right, INT32 bottom ) { return CreateRoundRectRgn( left, top, right, bottom, right-left, bottom-top ); @@ -228,9 +247,9 @@ HRGN CreateEllipticRgn( INT left, INT top, INT right, INT bottom ) /*********************************************************************** - * CreateEllipticRgnIndirect (GDI.55) + * CreateEllipticRgnIndirect16 (GDI.55) */ -HRGN CreateEllipticRgnIndirect( LPRECT rect ) +HRGN16 CreateEllipticRgnIndirect16( const RECT16 *rect ) { return CreateRoundRectRgn(rect->left, rect->top, rect->right, rect->bottom, rect->right-rect->left, rect->bottom-rect->top ); @@ -238,19 +257,29 @@ HRGN CreateEllipticRgnIndirect( LPRECT rect ) /*********************************************************************** - * CreatePolygonRgn (GDI.63) + * CreateEllipticRgnIndirect32 (GDI32.40) */ -HRGN CreatePolygonRgn( const POINT * points, INT count, INT mode ) +HRGN32 CreateEllipticRgnIndirect32( const RECT32 *rect ) { - return CreatePolyPolygonRgn( points, &count, 1, mode ); + return CreateRoundRectRgn(rect->left, rect->top, rect->right, rect->bottom, + rect->right-rect->left, rect->bottom-rect->top ); } /*********************************************************************** - * CreatePolyPolygonRgn (GDI.451) + * CreatePolygonRgn16 (GDI.63) */ -HRGN CreatePolyPolygonRgn( const POINT * points, const INT16 * count, - INT nbpolygons, INT mode ) +HRGN16 CreatePolygonRgn16( const POINT16 * points, INT16 count, INT16 mode ) +{ + return CreatePolyPolygonRgn16( points, &count, 1, mode ); +} + + +/*********************************************************************** + * CreatePolyPolygonRgn16 (GDI.451) + */ +HRGN16 CreatePolyPolygonRgn16( const POINT16 * points, const INT16 * count, + INT16 nbpolygons, INT16 mode ) { RGNOBJ * obj; HRGN hrgn; @@ -314,9 +343,9 @@ HRGN CreatePolyPolygonRgn( const POINT * points, const INT16 * count, /*********************************************************************** - * PtInRegion (GDI.161) + * PtInRegion (GDI.161) (GDI32.278) */ -BOOL PtInRegion( HRGN hrgn, short x, short y ) +BOOL PtInRegion( HRGN32 hrgn, INT32 x, INT32 y ) { RGNOBJ * obj; @@ -327,9 +356,9 @@ BOOL PtInRegion( HRGN hrgn, short x, short y ) /*********************************************************************** - * RectInRegion (GDI.181) + * RectInRegion16 (GDI.181) */ -BOOL RectInRegion( HRGN hrgn, LPRECT rect ) +BOOL16 RectInRegion16( HRGN16 hrgn, const RECT16 *rect ) { RGNOBJ * obj; @@ -342,9 +371,24 @@ BOOL RectInRegion( HRGN hrgn, LPRECT rect ) /*********************************************************************** - * EqualRgn (GDI.72) + * RectInRegion32 (GDI32.281) */ -BOOL EqualRgn( HRGN rgn1, HRGN rgn2 ) +BOOL32 RectInRegion32( HRGN32 hrgn, const RECT32 *rect ) +{ + RGNOBJ * obj; + + if (!(obj = (RGNOBJ *) GDI_GetObjPtr( hrgn, REGION_MAGIC ))) return FALSE; + if (!obj->xrgn) return FALSE; + return (XRectInRegion( obj->xrgn, rect->left, rect->top, + rect->right-rect->left, + rect->bottom-rect->top ) != RectangleOut); +} + + +/*********************************************************************** + * EqualRgn (GDI.72) (GDI32.90) + */ +BOOL EqualRgn( HRGN32 rgn1, HRGN32 rgn2 ) { RGNOBJ *obj1, *obj2; if (!(obj1 = (RGNOBJ *) GDI_GetObjPtr( rgn1, REGION_MAGIC ))) return FALSE; @@ -384,7 +428,7 @@ static int REGION_CopyRegion( RGNOBJ *src, RGNOBJ *dest ) * * Create a region that is a frame around another region */ -BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, int x, int y ) +BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, INT32 x, INT32 y ) { RGNOBJ *destObj,*srcObj; Region result; @@ -402,11 +446,11 @@ BOOL REGION_FrameRgn( HRGN hDest, HRGN hSrc, int x, int y ) } /*********************************************************************** - * CombineRgn (GDI.451) + * CombineRgn (GDI.451) (GDI32.19) * * The behavior is correct even if src and dest regions are the same. */ -INT CombineRgn( HRGN hDest, HRGN hSrc1, HRGN hSrc2, INT mode ) +INT16 CombineRgn( HRGN32 hDest, HRGN32 hSrc1, HRGN32 hSrc2, INT32 mode ) { RGNOBJ *destObj, *src1Obj, *src2Obj; Region destrgn; diff --git a/objects/text.c b/objects/text.c index 3e62c84e91d..cd3676e93db 100644 --- a/objects/text.c +++ b/objects/text.c @@ -12,6 +12,7 @@ #include "gdi.h" #include "callback.h" #include "metafile.h" +#include "string32.h" #include "stddebug.h" /* #define DEBUG_TEXT */ #include "debug.h" @@ -51,7 +52,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, int i = 0, j = 0, k; int plen = 0; int numspaces; - SIZE size; + SIZE16 size; int lasttab = 0; int wb_i = 0, wb_j = 0, wb_count = 0; @@ -74,7 +75,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) || (format & DT_WORDBREAK)) { - if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size)) + if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size)) return NULL; plen += size.cx; } @@ -91,7 +92,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, dest[j++] = str[i++]; if (!(format & DT_NOCLIP) || (format & DT_WORDBREAK)) { - if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size)) + if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size)) return NULL; plen += size.cx; } @@ -105,7 +106,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, wb_j = j; wb_count = *count; - if (!GetTextExtentPoint(hdc, &dest[lasttab], j - lasttab, + if (!GetTextExtentPoint16(hdc, &dest[lasttab], j - lasttab, &size)) return NULL; @@ -121,7 +122,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) || (format & DT_WORDBREAK)) { - if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size)) + if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size)) return NULL; plen += size.cx; } @@ -136,7 +137,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, wb_i = i; wb_j = j - 1; wb_count = *count; - if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size)) + if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size)) return NULL; plen += size.cx; } @@ -147,7 +148,7 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, if (!(format & DT_NOCLIP) || !(format & DT_NOPREFIX) || (format & DT_WORDBREAK)) { - if (!GetTextExtentPoint(hdc, &dest[j-1], 1, &size)) + if (!GetTextExtentPoint16(hdc, &dest[j-1], 1, &size)) return NULL; plen += size.cx; } @@ -182,11 +183,12 @@ static const char *TEXT_NextLine( HDC hdc, const char *str, int *count, /*********************************************************************** - * DrawText (USER.85) + * DrawText16 (USER.85) */ -INT DrawText( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags ) +INT16 DrawText16( HDC16 hdc, LPCSTR str, INT16 i_count, + LPRECT16 rect, UINT16 flags ) { - SIZE size; + SIZE16 size; const char *strPtr; static char line[1024]; int len, lh, count=i_count; @@ -214,9 +216,9 @@ INT DrawText( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags ) if (flags & DT_EXPANDTABS) { - GetTextExtentPoint(hdc, " ", 1, &size); + GetTextExtentPoint16(hdc, " ", 1, &size); spacewidth = size.cx; - GetTextExtentPoint(hdc, "o", 1, &size); + GetTextExtentPoint16(hdc, "o", 1, &size); tabwidth = size.cx * tabstop; } @@ -227,13 +229,13 @@ INT DrawText( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags ) if (prefix_offset != -1) { - GetTextExtentPoint(hdc, line, prefix_offset, &size); + GetTextExtentPoint16(hdc, line, prefix_offset, &size); prefix_x = size.cx; - GetTextExtentPoint(hdc, line, prefix_offset + 1, &size); + GetTextExtentPoint16(hdc, line, prefix_offset + 1, &size); prefix_end = size.cx - 1; } - if (!GetTextExtentPoint(hdc, line, len, &size)) return 0; + if (!GetTextExtentPoint16(hdc, line, len, &size)) return 0; if (flags & DT_CENTER) x = (rect->left + rect->right - size.cx) / 2; else if (flags & DT_RIGHT) x = rect->right - size.cx; @@ -246,16 +248,16 @@ INT DrawText( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags ) } if (!(flags & DT_CALCRECT)) { - if (!ExtTextOut( hdc, x, y, (flags & DT_NOCLIP) ? 0 : ETO_CLIPPED, - rect, line, len, NULL )) return 0; + if (!ExtTextOut16(hdc, x, y, (flags & DT_NOCLIP) ? 0 : ETO_CLIPPED, + rect, line, len, NULL )) return 0; } else if (size.cx > max_width) max_width = size.cx; if (prefix_offset != -1) { - HPEN hpen = CreatePen( PS_SOLID, 1, GetTextColor(hdc) ); - HPEN oldPen = SelectObject( hdc, hpen ); + HPEN16 hpen = CreatePen( PS_SOLID, 1, GetTextColor(hdc) ); + HPEN16 oldPen = SelectObject( hdc, hpen ); MoveTo(hdc, x + prefix_x, y + tm.tmAscent + 1 ); LineTo(hdc, x + prefix_end, y + tm.tmAscent + 1 ); SelectObject( hdc, oldPen ); @@ -283,15 +285,47 @@ INT DrawText( HDC hdc, LPCSTR str, INT i_count, LPRECT rect, UINT flags ) /*********************************************************************** - * ExtTextOut (GDI.351) + * DrawText32A (USER32.163) */ -BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect, - LPSTR str, WORD count, LPINT16 lpDx ) +INT32 DrawText32A( HDC32 hdc, LPCSTR str, INT32 count, + LPRECT32 rect, UINT32 flags ) +{ + RECT16 rect16; + INT16 ret; + + if (!rect) + return DrawText16( (HDC16)hdc, str, (INT16)count, NULL, (UINT16)flags); + CONV_RECT32TO16( rect, &rect16 ); + ret = DrawText16( (HDC16)hdc, str, (INT16)count, &rect16, (UINT16)flags ); + CONV_RECT16TO32( &rect16, rect ); + return ret; +} + + +/*********************************************************************** + * DrawText32W (USER32.166) + */ +INT32 DrawText32W( HDC32 hdc, LPCWSTR str, INT32 count, + LPRECT32 rect, UINT32 flags ) +{ + char *p = STRING32_DupUniToAnsi( str ); + INT32 ret = DrawText32A( hdc, p, count, rect, flags ); + free(p); + return ret; +} + + +/*********************************************************************** + * ExtTextOut16 (GDI.351) + */ +BOOL16 ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags, + const RECT16 *lprect, LPCSTR str, UINT16 count, + const INT16 *lpDx ) { int dir, ascent, descent, i; XCharStruct info; XFontStruct *font; - RECT rect; + RECT16 rect; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) @@ -421,7 +455,7 @@ BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect, items = xmalloc( count * sizeof(XTextItem) ); for (i = 0, pitem = items; i < count; i++, pitem++) { - pitem->chars = str + i; + pitem->chars = (char *)str + i; pitem->nchars = 1; pitem->font = None; if (i == 0) @@ -434,7 +468,7 @@ BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect, pitem->delta += dc->w.breakExtra; if (lpDx) { - INT width; + INT16 width; GetCharWidth( hdc, str[i], str[i], &width ); pitem->delta += lpDx[i-1] - width; } @@ -479,11 +513,62 @@ BOOL ExtTextOut( HDC hdc, short x, short y, WORD flags, LPRECT lprect, /*********************************************************************** - * TextOut (GDI.33) + * ExtTextOut32A (GDI32.98) */ -BOOL TextOut( HDC hdc, short x, short y, LPSTR str, short count ) +BOOL32 ExtTextOut32A( HDC32 hdc, INT32 x, INT32 y, UINT32 flags, + const RECT32 *lprect, LPCSTR str, UINT32 count, + const INT32 *lpDx ) { - return ExtTextOut( hdc, x, y, 0, NULL, str, count, NULL ); + RECT16 rect16; + + if (lpDx) fprintf( stderr, "ExtTextOut32A: lpDx not implemented\n" ); + if (!lprect) + return ExtTextOut16( (HDC16)hdc, (INT16)x, (INT16)y, (UINT16)flags, + NULL, str, (UINT16)count, NULL ); + CONV_RECT32TO16( lprect, &rect16 ); + return ExtTextOut16( (HDC16)hdc, (INT16)x, (INT16)y, (UINT16)flags, + &rect16, str, (UINT16)count, NULL ); +} + + +/*********************************************************************** + * ExtTextOut32W (GDI32.99) + */ +BOOL32 ExtTextOut32W( HDC32 hdc, INT32 x, INT32 y, UINT32 flags, + const RECT32 *lprect, LPCWSTR str, UINT32 count, + const INT32 *lpDx ) +{ + char *p = STRING32_DupUniToAnsi( str ); + INT32 ret = ExtTextOut32A( hdc, x, y, flags, lprect, p, count, lpDx ); + free(p); + return ret; +} + + +/*********************************************************************** + * TextOut16 (GDI.33) + */ +BOOL16 TextOut16( HDC16 hdc, INT16 x, INT16 y, LPCSTR str, INT16 count ) +{ + return ExtTextOut16( hdc, x, y, 0, NULL, str, count, NULL ); +} + + +/*********************************************************************** + * TextOut32A (GDI32.355) + */ +BOOL32 TextOut32A( HDC32 hdc, INT32 x, INT32 y, LPCSTR str, INT32 count ) +{ + return ExtTextOut32A( hdc, x, y, 0, NULL, str, count, NULL ); +} + + +/*********************************************************************** + * TextOut32W (GDI32.356) + */ +BOOL32 TextOut32W( HDC32 hdc, INT32 x, INT32 y, LPCWSTR str, INT32 count ) +{ + return ExtTextOut32W( hdc, x, y, 0, NULL, str, count, NULL ); } @@ -501,8 +586,8 @@ BOOL GrayString(HDC hdc, HBRUSH hbr, FARPROC gsprc, LPARAM lParam, } else { current_color = GetTextColor(hdc); SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT) ); - s = TextOut(hdc, x, y, (LPSTR) lParam, - cch ? cch : lstrlen((LPCSTR) lParam) ); + s = TextOut16(hdc, x, y, (LPSTR) lParam, + cch ? cch : lstrlen((LPCSTR) lParam) ); SetTextColor(hdc, current_color); return s; @@ -556,11 +641,11 @@ LONG TEXT_TabbedTextOut( HDC hdc, int x, int y, LPSTR lpstr, int count, tabPos = nTabOrg + ((x + LOWORD(extent) - nTabOrg) / defWidth + 1) * defWidth; if (fDisplayText) { - RECT r; - SetRect( &r, x, y, tabPos, y+HIWORD(extent) ); - ExtTextOut( hdc, x, y, - GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0, - &r, lpstr, i, NULL ); + RECT16 r; + SetRect16( &r, x, y, tabPos, y+HIWORD(extent) ); + ExtTextOut16( hdc, x, y, + GetBkMode(hdc) == OPAQUE ? ETO_OPAQUE : 0, + &r, lpstr, i, NULL ); } x = tabPos; count -= i+1; diff --git a/resources/sysres_Fi.rc b/resources/sysres_Fi.rc index 8b5ddc0c47e..2dc3affa5d5 100644 --- a/resources/sysres_Fi.rc +++ b/resources/sysres_Fi.rc @@ -21,7 +21,7 @@ BEGIN PUSHBUTTON "&OK", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "&Peruuta", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "&Keskeytä", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&Yritä uudelleen", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Uudelleen", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "&Hylkää", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "&Kyllä", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "&Ei", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -132,36 +132,66 @@ FONT 8, "Helv" } -CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134 +CHOOSE_FONT DIALOG DISCARDABLE 13, 54, 264, 147 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Fontit" FONT 8, "Helv" { - LTEXT "Fontti:", 1088, 6, 6, 40, 9 - LTEXT "", 1089, 60, 6, 150, 9 - DEFPUSHBUTTON "OK", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "Peruuta", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP + LTEXT "&Fontti:",1088 ,6,3,40,9 + COMBOBOX 1136 ,6,13,94,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | + CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE + LTEXT "Fonttit&yyli:",1089 ,108,3,44,9 + COMBOBOX 1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | + WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE + LTEXT "&Koko:",1090,179,3,30,9 + COMBOBOX 1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | + WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT + DEFPUSHBUTTON "OK",IDOK,218,6,40,14,WS_GROUP + PUSHBUTTON "Peruuta",IDCANCEL,218,23,40,14,WS_GROUP + PUSHBUTTON "&Sovella", 1026,218,40,40,14,WS_GROUP + PUSHBUTTON "&Ohje" , 1038,218,57,40,14,WS_GROUP + GROUPBOX "Efektit",1072,6,72,84,34,WS_GROUP + CHECKBOX "Yli&viivattu", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "A&lleviivattu", 1041, 10,94,50,10, BS_AUTOCHECKBOX + LTEXT "V&äri:", 1091 ,6,110,30,9 + COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | + CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP + GROUPBOX "Näyte",1073,98,72,160,49,WS_GROUP + CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE } -CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200 +CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Väri" FONT 8, "Helv" { - LTEXT "Pe&rusvärit:", 1088, 6, 6, 40, 9 - LTEXT "&Muokatut värit:", 1089, 6, 126, 40, 9 - LTEXT "Väri|&Tasainen", 1090, 100, 146, 40, 9 - LTEXT "&Sävy:", 1091, 150, 126, 40, 9 - LTEXT "&Kyll:", 1092, 150, 146, 40, 9 - LTEXT "K&irkk:", 1093, 150, 166, 40, 9 - LTEXT "&Pun:", 1094, 150, 126, 40, 9 - LTEXT "&Vihr:", 1095, 150, 146, 40, 9 - LTEXT "Si&n:", 1096, 150, 166, 40, 9 - DEFPUSHBUTTON "OK", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "&Lisää väri", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "Pois&ta väri", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "S&ulje", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP + LTEXT "Pe&rusvärit:", 1088, 4, 4, 140, 10 + LTEXT "&Muokatut värit:", 1089, 4, 106, 140, 10 + LTEXT "Väri|&Tasainen", 1090, 150, 151, 48, 10 + LTEXT "&Pun:", 726 /*1094*/,249,126,24,10 + EDITTEXT 706, 275,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP + LTEXT "&Vihr:",727/*1095*/,249,140,24,10 + EDITTEXT 707, 275,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP + LTEXT "Si&n:",728 /*1096*/,249,154,24,10 + EDITTEXT 708, 275,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP + LTEXT "&Sävy:" ,723 /*1091*/,202,126,22,10 + EDITTEXT 703, 226,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP + LTEXT "&Kyll:" ,724 /*1092*/,202,140,22,10 + EDITTEXT 704, 226,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP + LTEXT "K&irkk:" ,725 /*1093*/,202,154,22,10 + EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP + CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86 + CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28 + CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 + CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116 + CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26 + DEFPUSHBUTTON "Ok", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP + PUSHBUTTON "S&ulje", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "O&hje", 1038,100,166, 44, 14 + PUSHBUTTON "&Lisää väri", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "M&äärittele väri >>", 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.c b/tools/build.c index 8de854517b7..62944d5561c 100644 --- a/tools/build.c +++ b/tools/build.c @@ -1063,7 +1063,8 @@ static void BuildSpec16Files(void) (odp->type == TYPE_REGISTER) ? "regs" : (odp->type == TYPE_PASCAL) ? "long" : "word", fdp->arg_types ); - printf( "\t.word 0x%04x\n", WINE_CODE_SELECTOR ); + printf( "\t.byte 0x%02x,0x%02x\n", /* Some asms don't have .word */ + LOBYTE(WINE_CODE_SELECTOR), HIBYTE(WINE_CODE_SELECTOR) ); printf( "\tnop\n" ); printf( "\tnop\n\n" ); odp->offset = code_offset; diff --git a/win32/Makefile.in b/win32/Makefile.in index b563e7e5489..72d1277507f 100644 --- a/win32/Makefile.in +++ b/win32/Makefile.in @@ -15,7 +15,6 @@ C_SRCS = \ memory.c \ newfns.c \ object_mgt.c \ - param32.c \ process.c \ resource.c \ string32.c \ diff --git a/win32/cursoricon32.c b/win32/cursoricon32.c index f5d8262c6c4..709f8e7d2b6 100644 --- a/win32/cursoricon32.c +++ b/win32/cursoricon32.c @@ -273,7 +273,7 @@ static HANDLE CURSORICON32_LoadHandler( HANDLE32 handle, HINSTANCE hInstance, HANDLE hAndBits, hXorBits, hRes; HDC hdc; int size, sizeAnd, sizeXor; - POINT hotspot = { 0 ,0 }; + POINT16 hotspot = { 0 ,0 }; BITMAPOBJ *bmpXor, *bmpAnd; BITMAPINFO *bmi, *pInfo; CURSORICONINFO *info; @@ -282,7 +282,7 @@ static HANDLE CURSORICON32_LoadHandler( HANDLE32 handle, HINSTANCE hInstance, hRes=0; if (fCursor) /* If cursor, get the hotspot */ { - POINT *pt = (POINT *)LockResource32( handle ); + POINT16 *pt = (POINT16 *)LockResource32( handle ); hotspot = *pt; bmi = (BITMAPINFO *)(pt + 1); } diff --git a/win32/memory.c b/win32/memory.c index 349a3682e4b..c50a45c76d4 100644 --- a/win32/memory.c +++ b/win32/memory.c @@ -4,6 +4,7 @@ * Copyright 1995 Martin von Loewis and Cameron Heide */ +#include #include #include #include @@ -23,9 +24,6 @@ #ifndef PROT_NONE /* FreeBSD doesn't define PROT_NONE */ #define PROT_NONE 0 #endif -#ifndef MAP_ANON -#define MAP_ANON 0 -#endif typedef struct { caddr_t ptr; @@ -172,12 +170,22 @@ LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize, int i; virtual_mem_t *tmp_mem; int prot; + static int fdzero = -1; + + if (fdzero == -1) + { + if ((fdzero = open( "/dev/zero", O_RDONLY )) == -1) + { + perror( "/dev/zero: open" ); + return (LPVOID)NULL; + } + } dprintf_win32(stddeb, "VirtualAlloc: size = %ld, address=%p\n", cbSize, lpvAddress); if (fdwAllocationType & MEM_RESERVE || !lpvAddress) { ptr = mmap((void *)((((unsigned long)lpvAddress-1) & 0xFFFF0000L) + 0x00010000L), - cbSize, PROT_NONE, MAP_ANON|MAP_PRIVATE,-1,0); + cbSize, PROT_NONE, MAP_PRIVATE, fdzero, 0 ); if (ptr == (caddr_t) -1) { dprintf_win32(stddeb, "VirtualAlloc: returning NULL"); return (LPVOID) NULL; @@ -186,7 +194,7 @@ LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize, munmap(ptr, cbSize); cbSize += 65535; ptr = mmap(lpvAddress, cbSize, - PROT_NONE, MAP_ANON|MAP_PRIVATE,-1,0); + PROT_NONE, MAP_PRIVATE, fdzero, 0 ); if (ptr == (caddr_t) -1) { dprintf_win32(stddeb, "VirtualAlloc: returning NULL"); return (LPVOID) NULL; diff --git a/win32/newfns.c b/win32/newfns.c index 31bb179ca96..a226e1611e7 100644 --- a/win32/newfns.c +++ b/win32/newfns.c @@ -23,3 +23,13 @@ BOOL WIN32_WinHelpA(HWND hWnd,LPCSTR lpszHelp,UINT uCommand, DWORD dwData) anyways */ return WinHelp(hWnd,lpszHelp,uCommand,dwData); } + +HHOOK SetWindowsHookEx32A(int HookId, HOOKPROC hookfn, HINSTANCE hModule, + DWORD ThreadId) + +{ + /* Stub for now */ + fprintf(stdnimp, "WIN32_SetWindowsHookEx Stub called!\n"); + + return (HHOOK) NULL; +} diff --git a/win32/param32.c b/win32/param32.c deleted file mode 100644 index b9696487032..00000000000 --- a/win32/param32.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Win32 relay functions - * The implementations here perform only parameter conversions, and - * call the Win16 counterparts - * - * Copyright 1996 Martin von Loewis - */ - -#include -#include "windows.h" -#include "winerror.h" -#include "struct32.h" -#include "stackframe.h" -#include "stddebug.h" -#include "debug.h" - -/**************************************************************** - * MoveToEx (GDI32.254) - */ -BOOL WIN32_MoveToEx(HDC hdc,int x,int y,POINT32* p32) -{ - POINT p; - if (p32 == NULL) - return MoveToEx(hdc,x,y,(POINT *)NULL); - else { - STRUCT32_POINT32to16(p32,&p); - return MoveToEx(hdc,x,y,&p); - } -} - -BOOL WIN32_GetTextExtentPointA(HDC hdc, LPCSTR str, int length, SIZE32* lpsize) - -{ - SIZE s; - BOOL retval; - - retval = GetTextExtentPoint(hdc, str, length, &s); - STRUCT32_SIZE16to32(&s, lpsize); - - return retval; -} - -ATOM WIN32_GlobalAddAtomA(LPCSTR str) -{ - char buffer[256]; /* 16-bit atoms are limited to 255 anyway */ - lstrcpyn( buffer, str, sizeof(buffer) ); - return GlobalAddAtom(MAKE_SEGPTR(buffer)); -} diff --git a/win32/string32.c b/win32/string32.c index 66e243e2ec4..c888d110500 100644 --- a/win32/string32.c +++ b/win32/string32.c @@ -67,6 +67,14 @@ LPWSTR STRING32_DupAnsiToUni(LPCSTR src) return dest; } +LPWSTR STRING32_lstrcpyW(LPWSTR dst, LPCWSTR src) +{ + register LPWSTR p = dst; + while ((*p++ = *src++)); + return dst; +} + + DWORD STRING32_lstrlenW(LPCWSTR str) { int len; diff --git a/win32/struct32.c b/win32/struct32.c index 4a70c17096a..2d76d8f2150 100644 --- a/win32/struct32.c +++ b/win32/struct32.c @@ -11,19 +11,19 @@ #include "stddebug.h" #include "debug.h" -void STRUCT32_POINT32to16(const POINT32* p32,POINT* p16) +void STRUCT32_POINT32to16(const POINT32* p32, POINT16* p16) { p16->x = p32->x; p16->y = p32->y; } -void STRUCT32_POINT16to32(const POINT* p16,POINT32* p32) +void STRUCT32_POINT16to32(const POINT16* p16, POINT32* p32) { p32->x = p16->x; p32->y = p16->y; } -void STRUCT32_SIZE16to32(const SIZE* p16, SIZE32* p32) +void STRUCT32_SIZE16to32(const SIZE16* p16, SIZE32* p32) { p32->cx = p16->cx; @@ -52,7 +52,7 @@ void STRUCT32_MSG32to16(MSG32 *msg32,MSG *msg16) msg16->pt.y=msg32->pt.y; } -void STRUCT32_RECT32to16(const RECT32* r32,RECT *r16) +void STRUCT32_RECT32to16(const RECT32* r32, RECT16 *r16) { r16->left = r32->left; r16->right = r32->right; @@ -60,7 +60,7 @@ void STRUCT32_RECT32to16(const RECT32* r32,RECT *r16) r16->bottom = r32->bottom; } -void STRUCT32_RECT16to32(const RECT* r16,RECT32 *r32) +void STRUCT32_RECT16to32(const RECT16* r16, RECT32 *r32) { r32->left = r16->left; r32->right = r16->right; @@ -68,83 +68,95 @@ void STRUCT32_RECT16to32(const RECT* r16,RECT32 *r32) r32->bottom = r16->bottom; } -void STRUCT32_MINMAXINFO32to16(const MINMAXINFO32 *from,MINMAXINFO *to) +void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32 *from, MINMAXINFO16 *to ) { - STRUCT32_POINT32to16(&from->ptReserved,&to->ptReserved); - STRUCT32_POINT32to16(&from->ptMaxSize,&to->ptMaxSize); - STRUCT32_POINT32to16(&from->ptMaxPosition,&to->ptMaxPosition); - STRUCT32_POINT32to16(&from->ptMinTrackSize,&to->ptMinTrackSize); - STRUCT32_POINT32to16(&from->ptMaxTrackSize,&to->ptMaxTrackSize); + CONV_POINT32TO16( &from->ptReserved, &to->ptReserved ); + CONV_POINT32TO16( &from->ptMaxSize, &to->ptMaxSize ); + CONV_POINT32TO16( &from->ptMaxPosition, &to->ptMaxPosition ); + CONV_POINT32TO16( &from->ptMinTrackSize, &to->ptMinTrackSize ); + CONV_POINT32TO16( &from->ptMaxTrackSize, &to->ptMaxTrackSize ); } -void STRUCT32_MINMAXINFO16to32(const MINMAXINFO *from,MINMAXINFO32 *to) +void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16 *from, MINMAXINFO32 *to ) { - STRUCT32_POINT16to32(&from->ptReserved,&to->ptReserved); - STRUCT32_POINT16to32(&from->ptMaxSize,&to->ptMaxSize); - STRUCT32_POINT16to32(&from->ptMaxPosition,&to->ptMaxPosition); - STRUCT32_POINT16to32(&from->ptMinTrackSize,&to->ptMinTrackSize); - STRUCT32_POINT16to32(&from->ptMaxTrackSize,&to->ptMaxTrackSize); + CONV_POINT16TO32( &from->ptReserved, &to->ptReserved ); + CONV_POINT16TO32( &from->ptMaxSize, &to->ptMaxSize ); + CONV_POINT16TO32( &from->ptMaxPosition, &to->ptMaxPosition ); + CONV_POINT16TO32( &from->ptMinTrackSize, &to->ptMinTrackSize ); + CONV_POINT16TO32( &from->ptMaxTrackSize, &to->ptMaxTrackSize ); } -void STRUCT32_WINDOWPOS32to16(const WINDOWPOS32* from,WINDOWPOS* to) +void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32* from, WINDOWPOS16* to ) { - to->hwnd=from->hwnd; - to->hwndInsertAfter=from->hwndInsertAfter; - to->x=from->x; - to->y=from->y; - to->cx=from->cx; - to->flags=from->flags; + to->hwnd = (HWND16)from->hwnd; + to->hwndInsertAfter = (HWND16)from->hwndInsertAfter; + to->x = (INT16)from->x; + to->y = (INT16)from->y; + to->cx = (INT16)from->cx; + to->cy = (INT16)from->cy; + to->flags = (UINT16)from->flags; } -void STRUCT32_WINDOWPOS16to32(const WINDOWPOS* from,WINDOWPOS32* to) +void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS32* to ) { - to->hwnd=from->hwnd; - to->hwndInsertAfter=from->hwndInsertAfter; - to->x=from->x; - to->y=from->y; - to->cx=from->cx; - to->flags=from->flags; + to->hwnd = (HWND32)from->hwnd; + to->hwndInsertAfter = (HWND32)from->hwndInsertAfter; + to->x = (INT32)from->x; + to->y = (INT32)from->y; + to->cx = (INT32)from->cx; + to->cy = (INT32)from->cy; + to->flags = (UINT32)from->flags; } -void STRUCT32_NCCALCSIZE32to16Flat(const NCCALCSIZE_PARAMS32* from, - NCCALCSIZE_PARAMS* to) +void STRUCT32_NCCALCSIZE32to16Flat( const NCCALCSIZE_PARAMS32* from, + NCCALCSIZE_PARAMS16* to, int validRects ) { - STRUCT32_RECT32to16(from->rgrc,to->rgrc); - STRUCT32_RECT32to16(from->rgrc+1,to->rgrc+1); - STRUCT32_RECT32to16(from->rgrc+2,to->rgrc+2); + CONV_RECT32TO16( &from->rgrc[0], &to->rgrc[0] ); + if (validRects) + { + CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] ); + CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] ); + } } -void STRUCT32_NCCALCSIZE16to32Flat(const NCCALCSIZE_PARAMS* from, - NCCALCSIZE_PARAMS32* to) +void STRUCT32_NCCALCSIZE16to32Flat( const NCCALCSIZE_PARAMS16* from, + NCCALCSIZE_PARAMS32* to, int validRects ) { - STRUCT32_RECT16to32(from->rgrc,to->rgrc); - STRUCT32_RECT16to32(from->rgrc+1,to->rgrc+1); - STRUCT32_RECT16to32(from->rgrc+2,to->rgrc+2); + CONV_RECT16TO32( &from->rgrc[0], &to->rgrc[0] ); + if (validRects) + { + CONV_RECT32TO16( &from->rgrc[1], &to->rgrc[1] ); + CONV_RECT32TO16( &from->rgrc[2], &to->rgrc[2] ); + } } /* The strings are not copied */ -void STRUCT32_CREATESTRUCT32to16(const CREATESTRUCT32* from,CREATESTRUCT* to) +void STRUCT32_CREATESTRUCT32Ato16( const CREATESTRUCT32A* from, + CREATESTRUCT16* to ) { - to->lpCreateParams = (LPVOID)from->lpCreateParams; - to->hInstance = from->hInstance; - to->hMenu = from->hMenu; - to->hwndParent = from->hwndParent; - to->cy = from->cy; - to->cx = from->cx; - to->y = from->y; - to->style = from->style; - to->dwExStyle = from->dwExStyle; + to->lpCreateParams = from->lpCreateParams; + to->hInstance = (HINSTANCE16)from->hInstance; + to->hMenu = (HMENU16)from->hMenu; + to->hwndParent = (HWND16)from->hwndParent; + to->cy = (INT16)from->cy; + to->cx = (INT16)from->cx; + to->y = (INT16)from->y; + to->x = (INT16)from->x; + to->style = from->style; + to->dwExStyle = from->dwExStyle; } -void STRUCT32_CREATESTRUCT16to32(const CREATESTRUCT* from,CREATESTRUCT32 *to) +void STRUCT32_CREATESTRUCT16to32A( const CREATESTRUCT16* from, + CREATESTRUCT32A *to ) { - to->lpCreateParams = (DWORD)from->lpCreateParams; - to->hInstance = from->hInstance; - to->hMenu = from->hMenu; - to->hwndParent = from->hwndParent; - to->cy = from->cy; - to->cx = from->cx; - to->y = from->y; - to->style = from->style; - to->dwExStyle = from->dwExStyle; + to->lpCreateParams = from->lpCreateParams; + to->hInstance = (HINSTANCE32)from->hInstance; + to->hMenu = (HMENU32)from->hMenu; + to->hwndParent = (HWND32)from->hwndParent; + to->cy = (INT32)from->cy; + to->cx = (INT32)from->cx; + to->y = (INT32)from->y; + to->x = (INT32)from->x; + to->style = from->style; + to->dwExStyle = from->dwExStyle; } diff --git a/win32/user32.c b/win32/user32.c index 1a6fa92415d..01680404abd 100644 --- a/win32/user32.c +++ b/win32/user32.c @@ -12,7 +12,6 @@ #include #include "windows.h" #include "winerror.h" -#include "relay32.h" #include "alias.h" #include "stackframe.h" #include "xmalloc.h" @@ -37,43 +36,6 @@ BOOL USER32_GetMessageA(MSG32* lpmsg,DWORD hwnd,DWORD min,DWORD max) return ret; } -/*********************************************************************** - * BeginPaint (USER32.9) - */ -HDC USER32_BeginPaint(DWORD hwnd,PAINTSTRUCT32 *lpps) -{ - PAINTSTRUCT ps; - HDC ret; - ret=BeginPaint((HWND)hwnd,&ps); - lpps->hdc=(DWORD)ps.hdc; - lpps->fErase=ps.fErase; - lpps->rcPaint.top=ps.rcPaint.top; - lpps->rcPaint.left=ps.rcPaint.left; - lpps->rcPaint.right=ps.rcPaint.right; - lpps->rcPaint.bottom=ps.rcPaint.bottom; - lpps->fRestore=ps.fRestore; - lpps->fIncUpdate=ps.fIncUpdate; - return ret; -} - -/*********************************************************************** - * EndPaint (USER32.175) - */ -BOOL USER32_EndPaint(DWORD hwnd,PAINTSTRUCT32 *lpps) -{ - PAINTSTRUCT ps; - ps.hdc=(HDC)lpps->hdc; - ps.fErase=lpps->fErase; - ps.rcPaint.top=lpps->rcPaint.top; - ps.rcPaint.left=lpps->rcPaint.left; - ps.rcPaint.right=lpps->rcPaint.right; - ps.rcPaint.bottom=lpps->rcPaint.bottom; - ps.fRestore=lpps->fRestore; - ps.fIncUpdate=lpps->fIncUpdate; - EndPaint((HWND)hwnd,&ps); - return TRUE; -} - /*********************************************************************** * DispatchMessageA (USER32.140) */ @@ -97,6 +59,7 @@ BOOL USER32_TranslateMessage(MSG32* lpmsg) return TranslateMessage(&msg); } +#if 0 /*********************************************************************** * CreateWindowEx32A (USER32.82) */ @@ -144,6 +107,7 @@ HWND32 CreateWindowEx32A( DWORD flags, LPCSTR class, LPCSTR title, return retval; } +#endif HWND32 CreateWindowEx32W( DWORD flags, LPCWSTR class, LPCWSTR title, DWORD style, INT32 x, INT32 y, INT32 width, INT32 height, HWND32 parent, HMENU32 menu, @@ -163,45 +127,6 @@ HWND32 CreateWindowEx32W( DWORD flags, LPCWSTR class, LPCWSTR title, return hwnd; } -/*********************************************************************** - * InvalidateRect (USER32.327) - */ -BOOL USER32_InvalidateRect(HWND hWnd,const RECT32 *lpRect,BOOL bErase) -{ - RECT r; - - if (lpRect == NULL) - InvalidateRect(hWnd, (RECT *)NULL, bErase); - else { - STRUCT32_RECT32to16(lpRect,&r); - InvalidateRect(hWnd,&r,bErase); - } - /* FIXME: Return meaningful value */ - return TRUE; -} - -/*********************************************************************** - * DrawTextA (USER32.163) - */ -int USER32_DrawTextA(HDC hdc,LPCSTR lpStr,int count,RECT32* r32,UINT uFormat) -{ - RECT r; - STRUCT32_RECT32to16(r32,&r); - return DrawText(hdc,lpStr,count,&r,uFormat); -} - -/*********************************************************************** - * GetClientRect (USER32.219) - */ -BOOL USER32_GetClientRect(HWND hwnd,RECT32 *r32) -{ - RECT r; - GetClientRect(hwnd,&r); - STRUCT32_RECT16to32(&r,r32); - /* FIXME: return value */ - return 0; -} - UINT USER32_SetTimer(HWND hwnd, UINT id, UINT timeout, void *proc) { @@ -227,7 +152,7 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ, HMENU hMenu=0; DWORD exStyle; DWORD szCaption; - RECT rect; + RECT16 rect; DIALOGINFO *dlgInfo; WND *wndPtr; WORD xUnit = xBaseUnit; @@ -278,8 +203,8 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ, /* FIXME: proper modalframe handling ??*/ if (dlgTempl->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME; - AdjustWindowRectEx( &rect, dlgTempl->style, - hMenu ? TRUE : FALSE , exStyle ); + AdjustWindowRectEx16( &rect, dlgTempl->style, + hMenu ? TRUE : FALSE , exStyle ); rect.right -= rect.left; rect.bottom -= rect.top; @@ -289,7 +214,7 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ, rect.left += dlgTempl->x * xUnit / 4; rect.top += dlgTempl->y * yUnit / 8; if (!(dlgTempl->style & DS_ABSALIGN)) - ClientToScreen(hWndParent, (POINT *)&rect ); + ClientToScreen16(hWndParent, (POINT16 *)&rect ); } /* FIXME: Here is the place to consider A */ @@ -319,10 +244,7 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ, for (i = 0; i < dlgTempl->noOfItems; i++) { if((int)ptr&3) - { - fprintf(stddeb,"DWORD aligning\n"); ptr++; - } dlgitem = (DLGITEMTEMPLATE32*)ptr; ptr = (WORD*)(dlgitem+1); if(*ptr == 0xFFFF) { @@ -380,7 +302,7 @@ HWND USER32_CreateDialogIndirectParamAorW(HINSTANCE hInst,LPVOID templ, /* If there's already a default push-button, set it back */ /* to normal and use this one instead. */ if (hwndDefButton) - SendMessage( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE); + SendMessage( hwndDefButton, BM_SETSTYLE32, BS_PUSHBUTTON, FALSE); hwndDefButton = hwndCtrl; dlgInfo->msgResult = GetWindowWord( hwndCtrl, GWW_ID ); } diff --git a/win32/winprocs.c b/win32/winprocs.c index 963451c13d2..4d6105f5890 100644 --- a/win32/winprocs.c +++ b/win32/winprocs.c @@ -40,14 +40,14 @@ BOOL UsesLParamPtr(DWORD message) BOOL WIN32_CallWindowProcTo16(LRESULT(*func)(HWND,UINT,WPARAM,LPARAM), HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { - WINDOWPOS wp; + WINDOWPOS16 wp; union{ - MINMAXINFO mmi; - NCCALCSIZE_PARAMS nccs; - CREATESTRUCT cs; + MINMAXINFO16 mmi; + NCCALCSIZE_PARAMS16 nccs; + CREATESTRUCT16 cs; } st; WINDOWPOS32 *pwp; - CREATESTRUCT32 *pcs; + CREATESTRUCT32A *pcs; LONG result; if(!lParam || !UsesLParamPtr(msg)) return func(hwnd,msg,wParam,lParam); @@ -66,26 +66,26 @@ BOOL WIN32_CallWindowProcTo16(LRESULT(*func)(HWND,UINT,WPARAM,LPARAM), return result; case WM_NCCALCSIZE: pwp=((NCCALCSIZE_PARAMS32*)lParam)->lppos; - STRUCT32_NCCALCSIZE32to16Flat((void*)lParam,&st.nccs); - if(pwp) { + STRUCT32_NCCALCSIZE32to16Flat((void*)lParam,&st.nccs,wParam); + if (wParam && pwp) { STRUCT32_WINDOWPOS32to16(pwp,&wp); st.nccs.lppos = ℘ }else st.nccs.lppos = 0; result=func(hwnd,msg,wParam,MAKE_SEGPTR(&st.nccs)); - STRUCT32_NCCALCSIZE16to32Flat(&st.nccs,(void*)lParam); - if(pwp) + STRUCT32_NCCALCSIZE16to32Flat(&st.nccs,(void*)lParam,wParam); + if (wParam && pwp) STRUCT32_WINDOWPOS16to32(&wp,pwp); return result; case WM_NCCREATE: - pcs = (CREATESTRUCT32*)lParam; - STRUCT32_CREATESTRUCT32to16((void*)lParam,&st.cs); + pcs = (CREATESTRUCT32A*)lParam; + STRUCT32_CREATESTRUCT32Ato16((void*)lParam,&st.cs); st.cs.lpszName = HIWORD(pcs->lpszName) ? MAKE_SEGPTR(pcs->lpszName) : pcs->lpszName; st.cs.lpszClass = HIWORD(pcs->lpszClass) ? MAKE_SEGPTR(pcs->lpszClass) : pcs->lpszClass; result=func(hwnd,msg,wParam,MAKE_SEGPTR(&st.cs)); - STRUCT32_CREATESTRUCT16to32(&st.cs,(void*)lParam); + STRUCT32_CREATESTRUCT16to32A(&st.cs,(void*)lParam); pcs->lpszName = HIWORD(pcs->lpszName) ? PTR_SEG_TO_LIN(st.cs.lpszName) : pcs->lpszName; pcs->lpszClass = HIWORD(pcs-> lpszClass) ? diff --git a/windows/Makefile.in b/windows/Makefile.in index 10d6206ae7e..4284cdfdf98 100644 --- a/windows/Makefile.in +++ b/windows/Makefile.in @@ -27,7 +27,8 @@ C_SRCS = \ sysmetrics.c \ timer.c \ win.c \ - winpos.c + winpos.c \ + winproc.c all: $(MODULE).o diff --git a/windows/caret.c b/windows/caret.c index 294fac5c1e5..526ac9b3374 100644 --- a/windows/caret.c +++ b/windows/caret.c @@ -273,10 +273,9 @@ WORD GetCaretBlinkTime() /***************************************************************** - * GetCaretPos (USER.183) + * GetCaretPos16 (USER.183) */ - -void GetCaretPos(LPPOINT pt) +void GetCaretPos16( LPPOINT16 pt ) { if (!Caret.hwnd || !pt) return; @@ -286,3 +285,14 @@ void GetCaretPos(LPPOINT pt) pt->x = Caret.x; pt->y = Caret.y; } + + +/***************************************************************** + * GetCaretPos32 (USER32.209) + */ +void GetCaretPos32( LPPOINT32 pt ) +{ + if (!Caret.hwnd || !pt) return; + pt->x = Caret.x; + pt->y = Caret.y; +} diff --git a/windows/class.c b/windows/class.c index c05eb390f1e..4db77975ab5 100644 --- a/windows/class.c +++ b/windows/class.c @@ -1,7 +1,7 @@ /* * Window classes functions * - * Copyright 1993 Alexandre Julliard + * Copyright 1993, 1996 Alexandre Julliard */ #include @@ -9,11 +9,11 @@ #include #include "class.h" #include "heap.h" -#include "user.h" #include "win.h" #include "dce.h" #include "atom.h" #include "ldt.h" +#include "string32.h" #include "toolhelp.h" #include "stddebug.h" #include "debug.h" @@ -38,7 +38,7 @@ void CLASS_DumpClass( CLASS *ptr ) return; } - GlobalGetAtomName( ptr->atomName, className, sizeof(className) ); + GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) ); fprintf( stderr, "Class %p:\n", ptr ); fprintf( stderr, @@ -70,26 +70,103 @@ void CLASS_WalkClasses(void) CLASS *ptr; char className[80]; - fprintf( stderr, " Class Name Style WndProc\n" ); + fprintf( stderr, " Class Name Style WndProc\n" ); for (ptr = firstClass; ptr; ptr = ptr->next) { - GlobalGetAtomName( ptr->atomName, className, sizeof(className) ); - fprintf( stderr, "%08lx %-20.20s %08x %08lx\n", (DWORD)ptr, className, - ptr->style, (DWORD)ptr->lpfnWndProc ); + GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) ); + fprintf( stderr, "%08x %-20.20s %08x %08x\n", (UINT32)ptr, className, + ptr->style, (UINT32)ptr->lpfnWndProc ); } fprintf( stderr, "\n" ); } +/*********************************************************************** + * CLASS_GetMenuNameA + * + * Get the menu name as a ASCII string. + */ +static LPSTR CLASS_GetMenuNameA( CLASS *classPtr ) +{ + if (!classPtr->menuNameA && classPtr->menuNameW) + { + /* We need to copy the Unicode string */ + if ((classPtr->menuNameA = SEGPTR_ALLOC( + STRING32_lstrlenW(classPtr->menuNameW) + 1 ))) + STRING32_UniToAnsi( classPtr->menuNameA, classPtr->menuNameW ); + } + return classPtr->menuNameA; +} + + +/*********************************************************************** + * CLASS_GetMenuNameW + * + * Get the menu name as a Unicode string. + */ +static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr ) +{ + if (!classPtr->menuNameW && classPtr->menuNameA) + { + if (!HIWORD(classPtr->menuNameA)) + return (LPWSTR)classPtr->menuNameA; + /* Now we need to copy the ASCII string */ + if ((classPtr->menuNameW = HeapAlloc( SystemHeap, 0, + (strlen(classPtr->menuNameA)+1)*sizeof(WCHAR) ))) + STRING32_AnsiToUni( classPtr->menuNameW, classPtr->menuNameA ); + } + return classPtr->menuNameW; +} + + +/*********************************************************************** + * CLASS_SetMenuNameA + * + * Set the menu name in a class structure by copying the string. + */ +static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name ) +{ + if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA ); + if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW ); + classPtr->menuNameA = SEGPTR_STRDUP( name ); + classPtr->menuNameW = 0; +} + + +/*********************************************************************** + * CLASS_SetMenuNameW + * + * Set the menu name in a class structure by copying the string. + */ +static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name ) +{ + if (!HIWORD(name)) + { + CLASS_SetMenuNameA( classPtr, (LPCSTR)name ); + return; + } + if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA ); + if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW ); + if ((classPtr->menuNameW = HeapAlloc( SystemHeap, 0, + (STRING32_lstrlenW(name)+1)*sizeof(WCHAR) ))) + STRING32_lstrcpyW( classPtr->menuNameW, name ); + classPtr->menuNameA = 0; +} + + /*********************************************************************** * CLASS_FreeClass * * Free a class structure. */ -static void CLASS_FreeClass( CLASS *classPtr ) +static BOOL CLASS_FreeClass( CLASS *classPtr ) { CLASS **ppClass; + /* Check if we can remove this class */ + + if (classPtr->cWindows > 0) return FALSE; + /* Remove the class from the linked list */ for (ppClass = &firstClass; *ppClass; ppClass = &(*ppClass)->next) @@ -97,7 +174,7 @@ static void CLASS_FreeClass( CLASS *classPtr ) if (!*ppClass) { fprintf(stderr, "ERROR: Class list corrupted\n" ); - return; + return FALSE; } *ppClass = classPtr->next; @@ -106,9 +183,9 @@ static void CLASS_FreeClass( CLASS *classPtr ) if (classPtr->hdce) DCE_FreeDCE( classPtr->hdce ); if (classPtr->hbrBackground) DeleteObject( classPtr->hbrBackground ); GlobalDeleteAtom( classPtr->atomName ); - if (HIWORD(classPtr->lpszMenuName)) - USER_HEAP_FREE( (HANDLE)classPtr->lpszMenuName ); + CLASS_SetMenuNameA( classPtr, NULL ); HeapFree( SystemHeap, 0, classPtr ); + return TRUE; } @@ -167,82 +244,100 @@ CLASS *CLASS_FindClassByName( SEGPTR name, HINSTANCE hinstance ) { ATOM atom; - if (!(atom = GlobalFindAtom( name ))) return 0; + if (!(atom = GlobalFindAtom16( name ))) return 0; return CLASS_FindClassByAtom( atom, hinstance ); } +/*********************************************************************** + * CLASS_RegisterClass + * + * The real RegisterClass() functionality. + */ +static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance, + DWORD style, INT32 classExtra, + INT32 winExtra ) +{ + CLASS *classPtr; + + /* Check if a class with this name already exists */ + + classPtr = CLASS_FindClassByAtom( atom, hInstance ); + if (classPtr) + { + /* Class can be created only if it is local and */ + /* if the class with the same name is global. */ + + if (style & CS_GLOBALCLASS) return NULL; + if (!(classPtr->style & CS_GLOBALCLASS)) return NULL; + } + + /* Fix the extra bytes value */ + + if (classExtra < 0) classExtra = 0; + else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */ + fprintf(stderr, "Warning: class extra bytes %d is > 40\n", classExtra); + if (winExtra < 0) winExtra = 0; + else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */ + fprintf( stderr, "Warning: win extra bytes %d is > 40\n", winExtra ); + + /* Create the class */ + + classPtr = (CLASS *)HeapAlloc( SystemHeap, 0, sizeof(CLASS) + + classExtra - sizeof(classPtr->wExtra) ); + if (!classPtr) return NULL; + classPtr->next = firstClass; + classPtr->magic = CLASS_MAGIC; + classPtr->cWindows = 0; + classPtr->style = style; + classPtr->cbWndExtra = winExtra; + classPtr->cbClsExtra = classExtra; + classPtr->hInstance = hInstance; + classPtr->atomName = atom; + classPtr->menuNameA = 0; + classPtr->menuNameW = 0; + classPtr->hdce = (style&CS_CLASSDC) ? DCE_AllocDCE(DCE_CLASS_DC) : 0; + /* Other values must be set by caller */ + + if (classExtra) memset( classPtr->wExtra, 0, classExtra ); + firstClass = classPtr; + return classPtr; +} + + /*********************************************************************** * RegisterClass16 (USER.57) */ ATOM RegisterClass16( const WNDCLASS16 *wc ) { - CLASS * newClass, * prevClass; - HANDLE16 hInstance; - int classExtra; + ATOM atom; + CLASS *classPtr; - dprintf_class( stddeb, "RegisterClass: wndproc=%08lx hinst=%04x name='%s' background %04x\n", - (DWORD)wc->lpfnWndProc, wc->hInstance, - HIWORD(wc->lpszClassName) ? - (char *)PTR_SEG_TO_LIN(wc->lpszClassName) : "(int)", - wc->hbrBackground ); - dprintf_class(stddeb," style=%04x clsExtra=%d winExtra=%d\n", - wc->style, wc->cbClsExtra, wc->cbWndExtra ); - - /* Window classes are owned by modules, not instances */ - hInstance = GetExePtr( wc->hInstance ); - - /* Check if a class with this name already exists */ - prevClass = CLASS_FindClassByName( wc->lpszClassName, hInstance ); - if (prevClass) + HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + + if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; + if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + wc->cbClsExtra, wc->cbWndExtra ))) { - /* Class can be created only if it is local and */ - /* if the class with the same name is global. */ - - if (wc->style & CS_GLOBALCLASS) return 0; - if (!(prevClass->style & CS_GLOBALCLASS)) return 0; + GlobalDeleteAtom( atom ); + return 0; } - /* Create class */ + dprintf_class( stddeb, "RegisterClass16: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", + atom, (DWORD)wc->lpfnWndProc, hInstance, + wc->hbrBackground, wc->style, wc->cbClsExtra, + wc->cbWndExtra, classPtr ); - classExtra = (wc->cbClsExtra < 0) ? 0 : wc->cbClsExtra; - newClass = (CLASS *)HeapAlloc( SystemHeap, 0, sizeof(CLASS) + classExtra ); - if (!newClass) return 0; - newClass->next = firstClass; - newClass->magic = CLASS_MAGIC; - newClass->cWindows = 0; - newClass->style = wc->style; - newClass->lpfnWndProc = wc->lpfnWndProc; - newClass->cbWndExtra = (wc->cbWndExtra < 0) ? 0 : wc->cbWndExtra; - newClass->cbClsExtra = classExtra; - newClass->lpszMenuName = wc->lpszMenuName; - newClass->hInstance = hInstance; - newClass->hIcon = wc->hIcon; - newClass->hCursor = wc->hCursor; - newClass->hbrBackground = wc->hbrBackground; + classPtr->flags = 0; + classPtr->lpfnWndProc = wc->lpfnWndProc; + classPtr->hIcon = wc->hIcon; + classPtr->hIconSm = 0; + classPtr->hCursor = wc->hCursor; + classPtr->hbrBackground = wc->hbrBackground; - newClass->atomName = GlobalAddAtom( wc->lpszClassName ); - - if (newClass->style & CS_CLASSDC) - newClass->hdce = DCE_AllocDCE( DCE_CLASS_DC ); - else newClass->hdce = 0; - - /* Make a copy of the menu name (only if it is a string) */ - - if (HIWORD(wc->lpszMenuName)) - { - char *menuname = PTR_SEG_TO_LIN( wc->lpszMenuName ); - HANDLE hname = USER_HEAP_ALLOC( strlen(menuname)+1 ); - if (hname) - { - newClass->lpszMenuName = (SEGPTR)USER_HEAP_SEG_ADDR( hname ); - strcpy( USER_HEAP_LIN_ADDR( hname ), menuname ); - } - } - - if (classExtra) memset( newClass->wExtra, 0, classExtra ); - firstClass = newClass; - return newClass->atomName; + CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ? + PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName ); + return atom; } @@ -251,89 +346,254 @@ ATOM RegisterClass16( const WNDCLASS16 *wc ) */ ATOM RegisterClass32A( const WNDCLASS32A* wc ) { - WNDCLASS16 copy; - HANDLE classh = 0, menuh = 0; - SEGPTR classsegp, menusegp; - char *classbuf, *menubuf; + ATOM atom; + CLASS *classPtr; - ATOM retval; - copy.style=wc->style; - ALIAS_RegisterAlias(0,0,(DWORD)wc->lpfnWndProc); - copy.lpfnWndProc=wc->lpfnWndProc; - copy.cbClsExtra=wc->cbClsExtra; - copy.cbWndExtra=wc->cbWndExtra; - copy.hInstance=(HINSTANCE)wc->hInstance; - copy.hIcon=(HICON)wc->hIcon; - copy.hCursor=(HCURSOR)wc->hCursor; - copy.hbrBackground=(HBRUSH)wc->hbrBackground; - - /* FIXME: There has to be a better way of doing this - but neither - malloc nor alloca will work */ + /* FIXME: this should not be necessary for Win32 */ + HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); - if(wc->lpszMenuName) + if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; + if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + wc->cbClsExtra, wc->cbWndExtra ))) { - menuh = GlobalAlloc16(0, strlen(wc->lpszMenuName)+1); - menusegp = WIN16_GlobalLock16(menuh); - menubuf = PTR_SEG_TO_LIN(menusegp); - strcpy( menubuf, wc->lpszMenuName); - copy.lpszMenuName=menusegp; - }else - copy.lpszMenuName=0; - if(wc->lpszClassName) - { - classh = GlobalAlloc16(0, strlen(wc->lpszClassName)+1); - classsegp = WIN16_GlobalLock16(classh); - classbuf = PTR_SEG_TO_LIN(classsegp); - strcpy( classbuf, wc->lpszClassName); - copy.lpszClassName=classsegp; + GlobalDeleteAtom( atom ); + return 0; } - retval = RegisterClass16(©); - GlobalFree16(menuh); - GlobalFree16(classh); - return retval; + + dprintf_class( stddeb, "RegisterClass32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", + atom, (DWORD)wc->lpfnWndProc, hInstance, + wc->hbrBackground, wc->style, wc->cbClsExtra, + wc->cbWndExtra, classPtr ); + + classPtr->flags = 0; + classPtr->lpfnWndProc = (WNDPROC16)wc->lpfnWndProc; + classPtr->hIcon = (HICON16)wc->hIcon; + classPtr->hIconSm = 0; + classPtr->hCursor = (HCURSOR16)wc->hCursor; + classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; + ALIAS_RegisterAlias( 0, 0, (DWORD)wc->lpfnWndProc ); + CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); + return atom; +} + + +/*********************************************************************** + * RegisterClass32W (USER32.429) + */ +ATOM RegisterClass32W( const WNDCLASS32W* wc ) +{ + ATOM atom; + CLASS *classPtr; + + /* FIXME: this should not be necessary for Win32 */ + HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + + if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; + if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + wc->cbClsExtra, wc->cbWndExtra ))) + { + GlobalDeleteAtom( atom ); + return 0; + } + + dprintf_class( stddeb, "RegisterClass32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", + atom, (DWORD)wc->lpfnWndProc, hInstance, + wc->hbrBackground, wc->style, wc->cbClsExtra, + wc->cbWndExtra, classPtr ); + + classPtr->flags = CLASS_FLAG_UNICODE; + classPtr->lpfnWndProc = (WNDPROC16)wc->lpfnWndProc; + classPtr->hIcon = (HICON16)wc->hIcon; + classPtr->hIconSm = 0; + classPtr->hCursor = (HCURSOR16)wc->hCursor; + classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; + + ALIAS_RegisterAlias( 0, 0, (DWORD)wc->lpfnWndProc ); + CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); + return atom; +} + + +/*********************************************************************** + * RegisterClassEx16 (USER.397) + */ +ATOM RegisterClassEx16( const WNDCLASSEX16 *wc ) +{ + ATOM atom; + CLASS *classPtr; + + HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + + if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0; + if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + wc->cbClsExtra, wc->cbWndExtra ))) + { + GlobalDeleteAtom( atom ); + return 0; + } + + dprintf_class( stddeb, "RegisterClassEx16: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", + atom, (DWORD)wc->lpfnWndProc, hInstance, + wc->hbrBackground, wc->style, wc->cbClsExtra, + wc->cbWndExtra, classPtr ); + + classPtr->lpfnWndProc = wc->lpfnWndProc; + classPtr->hIcon = wc->hIcon; + classPtr->hIconSm = wc->hIconSm; + classPtr->hCursor = wc->hCursor; + classPtr->hbrBackground = wc->hbrBackground; + + CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ? + PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName ); + return atom; +} + + +/*********************************************************************** + * RegisterClassEx32A (USER32.427) + */ +ATOM RegisterClassEx32A( const WNDCLASSEX32A* wc ) +{ + ATOM atom; + CLASS *classPtr; + + /* FIXME: this should not be necessary for Win32 */ + HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + + if (!(atom = GlobalAddAtom32A( wc->lpszClassName ))) return 0; + if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + wc->cbClsExtra, wc->cbWndExtra ))) + { + GlobalDeleteAtom( atom ); + return 0; + } + + dprintf_class( stddeb, "RegisterClassEx32A: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", + atom, (DWORD)wc->lpfnWndProc, hInstance, + wc->hbrBackground, wc->style, wc->cbClsExtra, + wc->cbWndExtra, classPtr ); + + classPtr->lpfnWndProc = (WNDPROC16)wc->lpfnWndProc; + classPtr->hIcon = (HICON16)wc->hIcon; + classPtr->hIconSm = (HICON16)wc->hIconSm; + classPtr->hCursor = (HCURSOR16)wc->hCursor; + classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; + + ALIAS_RegisterAlias( 0, 0, (DWORD)wc->lpfnWndProc ); + CLASS_SetMenuNameA( classPtr, wc->lpszMenuName ); + return atom; +} + + +/*********************************************************************** + * RegisterClassEx32W (USER32.428) + */ +ATOM RegisterClassEx32W( const WNDCLASSEX32W* wc ) +{ + ATOM atom; + CLASS *classPtr; + + /* FIXME: this should not be necessary for Win32 */ + HINSTANCE32 hInstance = (HINSTANCE32)GetExePtr( wc->hInstance ); + + if (!(atom = GlobalAddAtom32W( wc->lpszClassName ))) return 0; + if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style, + wc->cbClsExtra, wc->cbWndExtra ))) + { + GlobalDeleteAtom( atom ); + return 0; + } + + dprintf_class( stddeb, "RegisterClassEx32W: atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n", + atom, (DWORD)wc->lpfnWndProc, hInstance, + wc->hbrBackground, wc->style, wc->cbClsExtra, + wc->cbWndExtra, classPtr ); + + classPtr->lpfnWndProc = (WNDPROC16)wc->lpfnWndProc; + classPtr->hIcon = (HICON16)wc->hIcon; + classPtr->hIconSm = (HICON16)wc->hIconSm; + classPtr->hCursor = (HCURSOR16)wc->hCursor; + classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground; + + ALIAS_RegisterAlias( 0, 0, (DWORD)wc->lpfnWndProc ); + CLASS_SetMenuNameW( classPtr, wc->lpszMenuName ); + return atom; } /*********************************************************************** * UnregisterClass16 (USER.403) */ -BOOL UnregisterClass16( SEGPTR className, HINSTANCE16 hinstance ) +BOOL16 UnregisterClass16( SEGPTR className, HINSTANCE16 hInstance ) { CLASS *classPtr; + ATOM atom; - hinstance = GetExePtr( hinstance ); - - /* Check if we can remove this class */ - if (!(classPtr = CLASS_FindClassByName( className, hinstance ))) - return FALSE; - if ((classPtr->hInstance != hinstance) || (classPtr->cWindows > 0)) - return FALSE; - CLASS_FreeClass( classPtr ); - return TRUE; + hInstance = GetExePtr( hInstance ); + if (!(atom = GlobalFindAtom16( className ))) return FALSE; + if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (classPtr->hInstance != hInstance)) return FALSE; + return CLASS_FreeClass( classPtr ); } /*********************************************************************** - * GetClassWord (USER.129) + * UnregisterClass32A (USER32.562) */ -WORD GetClassWord( HWND hwnd, short offset ) +BOOL32 UnregisterClass32A( LPCSTR className, HINSTANCE32 hInstance ) +{ + CLASS *classPtr; + ATOM atom; + + hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ + if (!(atom = GlobalFindAtom32A( className ))) return FALSE; + if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (classPtr->hInstance != hInstance)) return FALSE; + return CLASS_FreeClass( classPtr ); +} + + +/*********************************************************************** + * UnregisterClass32W (USER32.563) + */ +BOOL32 UnregisterClass32W( LPCWSTR className, HINSTANCE32 hInstance ) +{ + CLASS *classPtr; + ATOM atom; + + hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ + if (!(atom = GlobalFindAtom32W( className ))) return FALSE; + if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (classPtr->hInstance != hInstance)) return FALSE; + return CLASS_FreeClass( classPtr ); +} + + +/*********************************************************************** + * GetClassWord (USER.129) (USER32.218) + */ +WORD GetClassWord( HWND hwnd, INT32 offset ) { WND * wndPtr; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; if (offset >= 0) - return *(WORD *)(((char *)wndPtr->class->wExtra) + offset); - switch(offset) + { + if (offset <= wndPtr->class->cbClsExtra - sizeof(WORD)) + return GET_WORD(((char *)wndPtr->class->wExtra) + offset); + } + else switch(offset) { case GCW_HBRBACKGROUND: return wndPtr->class->hbrBackground; case GCW_HCURSOR: return wndPtr->class->hCursor; case GCW_HICON: return wndPtr->class->hIcon; - case GCW_HMODULE: return wndPtr->class->hInstance; + case GCW_HICONSM: return wndPtr->class->hIconSm; case GCW_ATOM: return wndPtr->class->atomName; case GCW_STYLE: case GCW_CBWNDEXTRA: case GCW_CBCLSEXTRA: - return (WORD)GetClassLong( hwnd, offset ); + case GCW_HMODULE: + return (WORD)GetClassLong32A( hwnd, offset ); } fprintf(stderr, "Warning: invalid offset %d for GetClassWord()\n", offset); return 0; @@ -341,54 +601,44 @@ WORD GetClassWord( HWND hwnd, short offset ) /*********************************************************************** - * SetClassWord (USER.130) + * GetClassLong16 (USER.131) */ -WORD SetClassWord( HWND hwnd, short offset, WORD newval ) +LONG GetClassLong16( HWND hwnd, INT16 offset ) { - WND * wndPtr; - WORD *ptr, retval = 0; - - if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; - if (offset >= 0) ptr = (WORD *)(((char *)wndPtr->class->wExtra) + offset); - else switch(offset) - { - case GCW_HBRBACKGROUND: ptr = &wndPtr->class->hbrBackground; break; - case GCW_HCURSOR: ptr = &wndPtr->class->hCursor; break; - case GCW_HICON: ptr = &wndPtr->class->hIcon; break; - case GCW_HMODULE: ptr = &wndPtr->class->hInstance; break; - case GCW_ATOM: ptr = &wndPtr->class->atomName; break; - case GCW_STYLE: - case GCW_CBWNDEXTRA: - case GCW_CBCLSEXTRA: - return (WORD)SetClassLong( hwnd, offset, (LONG)newval ); - default: - fprintf( stderr, "Warning: invalid offset %d for SetClassWord()\n", - offset); - return 0; - } - retval = *ptr; - *ptr = newval; - return retval; + DWORD ret = GetClassLong32A( hwnd, offset ); + if ((offset == GCL_MENUNAME) && HIWORD(ret)) + return (LONG)SEGPTR_GET((void *)ret); /* Name needs to be a SEGPTR */ + return (LONG)ret; } /*********************************************************************** - * GetClassLong (USER.131) + * GetClassLong32A (USER32.214) */ -LONG GetClassLong( HWND hwnd, short offset ) +LONG GetClassLong32A( HWND hwnd, INT32 offset ) { WND * wndPtr; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; if (offset >= 0) - return *(WORD *)(((char *)wndPtr->class->wExtra) + offset); + { + if (offset <= wndPtr->class->cbClsExtra - sizeof(LONG)) + return GET_DWORD(((char *)wndPtr->class->wExtra) + offset); + } switch(offset) { case GCL_STYLE: return (LONG)wndPtr->class->style; case GCL_CBWNDEXTRA: return (LONG)wndPtr->class->cbWndExtra; case GCL_CBCLSEXTRA: return (LONG)wndPtr->class->cbClsExtra; - case GCL_MENUNAME: return (LONG)wndPtr->class->lpszMenuName; case GCL_WNDPROC: return (LONG)wndPtr->class->lpfnWndProc; + case GCL_HMODULE: return (LONG)wndPtr->class->hInstance; + case GCL_MENUNAME: + return (LONG)CLASS_GetMenuNameA( wndPtr->class ); + case GCL_HBRBACKGROUND: + case GCL_HCURSOR: + case GCL_HICON: + case GCL_HICONSM: + return GetClassWord( hwnd, offset ); } fprintf(stderr, "Warning: invalid offset %d for GetClassLong()\n", offset); return 0; @@ -396,75 +646,327 @@ LONG GetClassLong( HWND hwnd, short offset ) /*********************************************************************** - * SetClassLong (USER.132) + * GetClassLong32W (USER32.215) */ -LONG SetClassLong( HWND hwnd, short offset, LONG newval ) +LONG GetClassLong32W( HWND hwnd, INT32 offset ) { WND * wndPtr; - LONG *ptr, retval = 0; + + if (offset != GCL_MENUNAME) return GetClassLong32A( hwnd, offset ); + if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; + return (LONG)CLASS_GetMenuNameW( wndPtr->class ); +} + + +/*********************************************************************** + * SetClassWord (USER.130) (USER32.468) + */ +WORD SetClassWord( HWND hwnd, INT32 offset, WORD newval ) +{ + WND * wndPtr; + WORD retval = 0; + void *ptr; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; - if (offset >= 0) ptr = (LONG *)(((char *)wndPtr->class->wExtra) + offset); + if (offset >= 0) + { + if (offset <= wndPtr->class->cbClsExtra - sizeof(WORD)) + ptr = ((char *)wndPtr->class->wExtra) + offset; + { + fprintf( stderr, "Warning: invalid offset %d for SetClassWord()\n", + offset ); + return 0; + } + } else switch(offset) { - case GCL_STYLE: ptr = (LONG*)&wndPtr->class->style; break; - case GCL_CBWNDEXTRA: ptr = (LONG*)&wndPtr->class->cbWndExtra; break; - case GCL_CBCLSEXTRA: ptr = (LONG*)&wndPtr->class->cbClsExtra; break; - case GCL_MENUNAME: ptr = (LONG*)&wndPtr->class->lpszMenuName; break; - case GCL_WNDPROC: ptr = (LONG*)&wndPtr->class->lpfnWndProc; break; + case GCW_STYLE: + case GCW_CBWNDEXTRA: + case GCW_CBCLSEXTRA: + case GCW_HMODULE: + return (WORD)SetClassLong32A( hwnd, offset, (LONG)newval ); + case GCW_HBRBACKGROUND: ptr = &wndPtr->class->hbrBackground; break; + case GCW_HCURSOR: ptr = &wndPtr->class->hCursor; break; + case GCW_HICON: ptr = &wndPtr->class->hIcon; break; + case GCW_HICONSM: ptr = &wndPtr->class->hIconSm; break; + case GCW_ATOM: ptr = &wndPtr->class->atomName; break; default: - fprintf( stderr, "Warning: invalid offset %d for SetClassLong()\n", + fprintf( stderr, "Warning: invalid offset %d for SetClassWord()\n", offset); return 0; } - retval = *ptr; - *ptr = newval; + retval = GET_WORD(ptr); + PUT_WORD( ptr, newval ); return retval; } /*********************************************************************** - * GetClassName (USER.58) + * SetClassLong16 (USER.132) */ -int GetClassName(HWND hwnd, LPSTR lpClassName, short maxCount) +LONG SetClassLong16( HWND hwnd, INT16 offset, LONG newval ) { - WND *wndPtr; - - /* FIXME: We have the find the correct hInstance */ - dprintf_class(stddeb,"GetClassName(%04x,%p,%d)\n",hwnd,lpClassName,maxCount); - if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; - - return GlobalGetAtomName( wndPtr->class->atomName, lpClassName, maxCount ); + if ((offset == GCL_MENUNAME) && HIWORD(newval)) + newval = (LONG)PTR_SEG_TO_LIN(newval); + return SetClassLong32A( hwnd, offset, newval ); } /*********************************************************************** - * GetClassInfo (USER.404) + * SetClassLong32A (USER32.466) */ -BOOL GetClassInfo( HANDLE hInstance, SEGPTR name, WNDCLASS16 *lpWndClass ) +LONG SetClassLong32A( HWND hwnd, INT32 offset, LONG newval ) { + WND * wndPtr; + LONG retval = 0; + void *ptr; + + if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0; + if (offset >= 0) + { + if (offset <= wndPtr->class->cbClsExtra - sizeof(LONG)) + ptr = ((char *)wndPtr->class->wExtra) + offset; + else + { + fprintf( stderr, "Warning: invalid offset %d for SetClassLong()\n", + offset ); + return 0; + } + } + else switch(offset) + { + case GCL_MENUNAME: + CLASS_SetMenuNameA( wndPtr->class, (LPCSTR)newval ); + return 0; /* Old value is now meaningless anyway */ + case GCL_HBRBACKGROUND: + case GCL_HCURSOR: + case GCL_HICON: + case GCL_HICONSM: + return SetClassWord( hwnd, offset, (WORD)newval ); + case GCL_STYLE: ptr = &wndPtr->class->style; break; + case GCL_CBWNDEXTRA: ptr = &wndPtr->class->cbWndExtra; break; + case GCL_CBCLSEXTRA: ptr = &wndPtr->class->cbClsExtra; break; + case GCL_WNDPROC: ptr = &wndPtr->class->lpfnWndProc; break; + case GCL_HMODULE: ptr = &wndPtr->class->hInstance; break; + default: + fprintf( stderr, "Warning: invalid offset %d for SetClassLong()\n", + offset); + return 0; + } + retval = GET_DWORD(ptr); + PUT_DWORD( ptr, newval ); + return retval; +} + + +/*********************************************************************** + * SetClassLong32W (USER32.467) + */ +LONG SetClassLong32W( HWND hwnd, INT32 offset, LONG newval ) +{ + WND *wndPtr; + if (offset != GCL_MENUNAME) return SetClassLong32A( hwnd, offset, newval ); + if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; + CLASS_SetMenuNameW( wndPtr->class, (LPCWSTR)newval ); + return 0; /* Old value is now meaningless anyway */ +} + + +/*********************************************************************** + * GetClassName16 (USER.58) + */ +INT16 GetClassName16( HWND hwnd, LPSTR buffer, INT16 count ) +{ + WND *wndPtr; + if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; + return GlobalGetAtomName16( wndPtr->class->atomName, buffer, count ); +} + + +/*********************************************************************** + * GetClassName32A (USER32.216) + */ +INT32 GetClassName32A( HWND hwnd, LPSTR buffer, INT32 count ) +{ + WND *wndPtr; + if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; + return GlobalGetAtomName32A( wndPtr->class->atomName, buffer, count ); +} + + +/*********************************************************************** + * GetClassName32W (USER32.217) + */ +INT32 GetClassName32W( HWND hwnd, LPWSTR buffer, INT32 count ) +{ + WND *wndPtr; + if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0; + return GlobalGetAtomName32W( wndPtr->class->atomName, buffer, count ); +} + + +/*********************************************************************** + * GetClassInfo16 (USER.404) + */ +BOOL GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASS16 *wc ) +{ + ATOM atom; CLASS *classPtr; - dprintf_class( stddeb, "GetClassInfo: hInstance=%04x className=%s\n", - hInstance, - HIWORD(name) ? (char *)PTR_SEG_TO_LIN(name) : "(int)" ); + hInstance = GetExePtr( hInstance ); + if (!(atom = GlobalFindAtom16( name )) || + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (hInstance != classPtr->hInstance)) return FALSE; + wc->style = (UINT16)classPtr->style; + wc->lpfnWndProc = classPtr->lpfnWndProc; + wc->cbClsExtra = (INT16)classPtr->cbClsExtra; + wc->cbWndExtra = (INT16)classPtr->cbWndExtra; + wc->hInstance = (HINSTANCE16)classPtr->hInstance; + wc->hIcon = classPtr->hIcon; + wc->hCursor = classPtr->hCursor; + wc->hbrBackground = classPtr->hbrBackground; + wc->lpszClassName = (SEGPTR)0; + wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); + if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ + wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); + return TRUE; +} + + +/*********************************************************************** + * GetClassInfo32A (USER32.210) + */ +BOOL GetClassInfo32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASS32A *wc ) +{ + ATOM atom; + CLASS *classPtr; + + hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ + if (!(atom = GlobalFindAtom32A( name )) || + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (hInstance != classPtr->hInstance)) return FALSE; + wc->style = classPtr->style; + wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; + wc->cbClsExtra = classPtr->cbClsExtra; + wc->cbWndExtra = classPtr->cbWndExtra; + wc->hInstance = classPtr->hInstance; + wc->hIcon = (HICON32)classPtr->hIcon; + wc->hCursor = (HCURSOR32)classPtr->hCursor; + wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; + wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); + wc->lpszClassName = NULL; + return TRUE; +} + + +/*********************************************************************** + * GetClassInfo32W (USER32.213) + */ +BOOL GetClassInfo32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASS32W *wc ) +{ + ATOM atom; + CLASS *classPtr; + + hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ + if (!(atom = GlobalFindAtom32W( name )) || + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (hInstance != classPtr->hInstance)) return FALSE; + wc->style = classPtr->style; + wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; + wc->cbClsExtra = classPtr->cbClsExtra; + wc->cbWndExtra = classPtr->cbWndExtra; + wc->hInstance = classPtr->hInstance; + wc->hIcon = (HICON32)classPtr->hIcon; + wc->hCursor = (HCURSOR32)classPtr->hCursor; + wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; + wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); + wc->lpszClassName = NULL; + return TRUE; +} + + +/*********************************************************************** + * GetClassInfoEx16 (USER.398) + * + * FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the + * same in Win16 as in Win32. --AJ + */ +BOOL GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name, WNDCLASSEX16 *wc ) +{ + ATOM atom; + CLASS *classPtr; hInstance = GetExePtr( hInstance ); - - if (!(classPtr = CLASS_FindClassByName( name, hInstance ))) return FALSE; - if (hInstance && (hInstance != classPtr->hInstance)) return FALSE; + if (!(atom = GlobalFindAtom16( name )) || + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (hInstance != classPtr->hInstance)) return FALSE; + wc->style = classPtr->style; + wc->lpfnWndProc = classPtr->lpfnWndProc; + wc->cbClsExtra = (INT16)classPtr->cbClsExtra; + wc->cbWndExtra = (INT16)classPtr->cbWndExtra; + wc->hInstance = (HINSTANCE16)classPtr->hInstance; + wc->hIcon = classPtr->hIcon; + wc->hIconSm = classPtr->hIconSm; + wc->hCursor = classPtr->hCursor; + wc->hbrBackground = classPtr->hbrBackground; + wc->lpszClassName = (SEGPTR)0; + wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr ); + if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */ + wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName ); + return TRUE; +} - lpWndClass->style = (UINT16)classPtr->style; - lpWndClass->lpfnWndProc = classPtr->lpfnWndProc; - lpWndClass->cbClsExtra = (INT16)classPtr->cbClsExtra; - lpWndClass->cbWndExtra = (INT16)classPtr->cbWndExtra; - lpWndClass->hInstance = classPtr->hInstance; - lpWndClass->hIcon = classPtr->hIcon; - lpWndClass->hCursor = classPtr->hCursor; - lpWndClass->hbrBackground = classPtr->hbrBackground; - lpWndClass->lpszMenuName = classPtr->lpszMenuName; - lpWndClass->lpszClassName = 0; +/*********************************************************************** + * GetClassInfoEx32A (USER32.211) + */ +BOOL GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name, WNDCLASSEX32A *wc ) +{ + ATOM atom; + CLASS *classPtr; + + hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ + if (!(atom = GlobalFindAtom32A( name )) || + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (hInstance != classPtr->hInstance)) return FALSE; + wc->style = classPtr->style; + wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; + wc->cbClsExtra = classPtr->cbClsExtra; + wc->cbWndExtra = classPtr->cbWndExtra; + wc->hInstance = classPtr->hInstance; + wc->hIcon = (HICON32)classPtr->hIcon; + wc->hIconSm = (HICON32)classPtr->hIconSm; + wc->hCursor = (HCURSOR32)classPtr->hCursor; + wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; + wc->lpszMenuName = CLASS_GetMenuNameA( classPtr ); + wc->lpszClassName = NULL; + return TRUE; +} + + +/*********************************************************************** + * GetClassInfoEx32W (USER32.212) + */ +BOOL GetClassInfoEx32W( HINSTANCE32 hInstance, LPCWSTR name, WNDCLASSEX32W *wc) +{ + ATOM atom; + CLASS *classPtr; + + hInstance = GetExePtr( hInstance ); /* FIXME: not needed in Win32 */ + if (!(atom = GlobalFindAtom32W( name )) || + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || + (hInstance != classPtr->hInstance)) return FALSE; + wc->style = classPtr->style; + wc->lpfnWndProc = (WNDPROC32)classPtr->lpfnWndProc; + wc->cbClsExtra = classPtr->cbClsExtra; + wc->cbWndExtra = classPtr->cbWndExtra; + wc->hInstance = classPtr->hInstance; + wc->hIcon = (HICON32)classPtr->hIcon; + wc->hIconSm = (HICON32)classPtr->hIconSm; + wc->hCursor = (HCURSOR32)classPtr->hCursor; + wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground; + wc->lpszMenuName = CLASS_GetMenuNameW( classPtr ); + wc->lpszClassName = NULL; return TRUE; } @@ -496,7 +998,7 @@ BOOL ClassNext( CLASSENTRY *pClassEntry ) } pClassEntry->hInst = class->hInstance; pClassEntry->wNext++; - GlobalGetAtomName( class->atomName, pClassEntry->szClassName, - sizeof(pClassEntry->szClassName) ); + GlobalGetAtomName32A( class->atomName, pClassEntry->szClassName, + sizeof(pClassEntry->szClassName) ); return TRUE; } diff --git a/windows/dce.c b/windows/dce.c index 359ce9b5f01..57284342553 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -94,7 +94,7 @@ void DCE_Init() * window area clipped by the client area of all ancestors. * Return FALSE if the visible region is empty. */ -static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect ) +static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT16 *lprect ) { int xoffset, yoffset; @@ -104,7 +104,7 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect ) if (!(wndPtr->dwStyle & WS_VISIBLE) || (wndPtr->flags & WIN_NO_REDRAW)) { - SetRectEmpty( lprect ); /* Clip everything */ + SetRectEmpty16( lprect ); /* Clip everything */ return FALSE; } @@ -115,20 +115,20 @@ static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect ) (wndPtr->flags & WIN_NO_REDRAW) || (wndPtr->dwStyle & WS_ICONIC)) { - SetRectEmpty( lprect ); /* Clip everything */ + SetRectEmpty16( lprect ); /* Clip everything */ return FALSE; } xoffset += wndPtr->rectClient.left; yoffset += wndPtr->rectClient.top; - OffsetRect( lprect, wndPtr->rectClient.left, - wndPtr->rectClient.top ); + OffsetRect16( 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 (!IntersectRect( lprect, lprect, &wndPtr->rectClient )) + if (!IntersectRect16( lprect, lprect, &wndPtr->rectClient )) return FALSE; /* Visible rectangle is empty */ } - OffsetRect( lprect, -xoffset, -yoffset ); + OffsetRect16( lprect, -xoffset, -yoffset ); return TRUE; } @@ -181,7 +181,7 @@ static HRGN DCE_ClipWindows( WND *pWndStart, WND *pWndEnd, */ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) { - RECT rect; + RECT16 rect; HRGN hrgn; int xoffset, yoffset; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -192,7 +192,7 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags ) { return CreateRectRgn( 0, 0, 0, 0 ); /* Visible region is empty */ } - if (!(hrgn = CreateRectRgnIndirect( &rect ))) return 0; + if (!(hrgn = CreateRectRgnIndirect16( &rect ))) return 0; /* Clip all children from the visible region */ diff --git a/windows/defdlg.c b/windows/defdlg.c index fa6f2755028..6fcfe399d67 100644 --- a/windows/defdlg.c +++ b/windows/defdlg.c @@ -97,11 +97,11 @@ static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo, { HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->msgResult ); if (SendMessage( hwndOld, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON) - SendMessage( hwndOld, BM_SETSTYLE, BS_PUSHBUTTON, TRUE ); + SendMessage( hwndOld, BM_SETSTYLE16, BS_PUSHBUTTON, TRUE ); } if (hwndNew) { - SendMessage( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE ); + SendMessage( hwndNew, BM_SETSTYLE16, BS_DEFPUSHBUTTON, TRUE ); dlgInfo->msgResult = GetDlgCtrlID( hwndNew ); } else dlgInfo->msgResult = 0; @@ -125,8 +125,8 @@ LRESULT DefDlgProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) if (dlgInfo->dlgProc) { /* Call dialog procedure */ - result = (BOOL)CallWindowProc( dlgInfo->dlgProc, hwnd, - msg, wParam, lParam ); + result = (BOOL)CallWindowProc16( dlgInfo->dlgProc, hwnd, + msg, wParam, lParam ); /* Check if window destroyed by dialog procedure */ wndPtr = WIN_FindWndPtr( hwnd ); diff --git a/windows/defwnd.c b/windows/defwnd.c index dfa64785010..9ec8104029c 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -85,26 +85,22 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { case WM_NCCREATE: { - CREATESTRUCT *createStruct = (CREATESTRUCT*)PTR_SEG_TO_LIN(lParam); - if (createStruct->lpszName) - DEFWND_SetText( wndPtr, - (LPSTR)PTR_SEG_TO_LIN(createStruct->lpszName) ); + CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); + if (cs->lpszName) + DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(cs->lpszName) ); return 1; } case WM_NCCALCSIZE: return NC_HandleNCCalcSize( hwnd, - (NCCALCSIZE_PARAMS *)PTR_SEG_TO_LIN(lParam) ); + (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(lParam) ); case WM_PAINTICON: case WM_NCPAINT: return NC_HandleNCPaint( hwnd, (HRGN)wParam ); case WM_NCHITTEST: - { - POINT pt = { LOWORD(lParam), HIWORD(lParam) }; - return NC_HandleNCHitTest( hwnd, pt ); - } + return NC_HandleNCHitTest( hwnd, MAKEPOINT16(lParam) ); case WM_NCLBUTTONDOWN: return NC_HandleNCLButtonDown( hwnd, wParam, lParam ); @@ -125,16 +121,16 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) case WM_PAINT: { - PAINTSTRUCT paintstruct; - BeginPaint( hwnd, &paintstruct ); - EndPaint( hwnd, &paintstruct ); + PAINTSTRUCT16 paintstruct; + BeginPaint16( hwnd, &paintstruct ); + EndPaint16( hwnd, &paintstruct ); return 0; } case WM_SETREDRAW: if (!wParam) { - ValidateRect( hwnd, NULL ); + ValidateRect32( hwnd, NULL ); wndPtr->flags |= WIN_NO_REDRAW; } else wndPtr->flags &= ~WIN_NO_REDRAW; @@ -159,12 +155,12 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) break; case WM_WINDOWPOSCHANGING: - return WINPOS_HandleWindowPosChanging( (WINDOWPOS *)PTR_SEG_TO_LIN(lParam) ); + return WINPOS_HandleWindowPosChanging( (WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam) ); case WM_WINDOWPOSCHANGED: { - WINDOWPOS * winPos = (WINDOWPOS *)PTR_SEG_TO_LIN(lParam); - WPARAM wp = SIZE_RESTORED; + WINDOWPOS16 * winPos = (WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam); + WPARAM16 wp = SIZE_RESTORED; if (!(winPos->flags & SWP_NOCLIENTMOVE)) SendMessage( hwnd, WM_MOVE, 0, @@ -277,10 +273,8 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) return NC_HandleSetCursor( hwnd, wParam, lParam ); case WM_SYSCOMMAND: - { - POINT pt = { LOWORD(lParam), HIWORD(lParam) }; - return NC_HandleSysCommand( hwnd, wParam, pt ); - } + return NC_HandleSysCommand( hwnd, wParam, MAKEPOINT16(lParam) ); + case WM_KEYDOWN: if(wParam == VK_F10) iF10Key = VK_F10; diff --git a/windows/dialog.c b/windows/dialog.c index 33a93b47a89..f8913b0bd86 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -10,6 +10,7 @@ #include #include "windows.h" #include "dialog.h" +#include "heap.h" #include "win.h" #include "ldt.h" #include "stackframe.h" @@ -252,7 +253,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, HMENU hMenu = 0; HFONT hFont = 0; HWND hwnd, hwndCtrl; - RECT rect; + RECT16 rect; WND * wndPtr; int i; DLGTEMPLATE template; @@ -306,8 +307,8 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, rect.right = template.cx * xUnit / 4; rect.bottom = template.cy * yUnit / 8; if (template.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME; - AdjustWindowRectEx( &rect, template.style, - hMenu ? TRUE : FALSE , exStyle ); + AdjustWindowRectEx16( &rect, template.style, + hMenu ? TRUE : FALSE , exStyle ); rect.right -= rect.left; rect.bottom -= rect.top; @@ -318,7 +319,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, rect.left += template.x * xUnit / 4; rect.top += template.y * yUnit / 8; if (!(template.style & DS_ABSALIGN)) - ClientToScreen( owner, (POINT *)&rect ); + ClientToScreen16( owner, (POINT16 *)&rect ); } hwnd = CreateWindowEx16( exStyle, template.className, template.caption, @@ -425,7 +426,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate, /* If there's already a default push-button, set it back */ /* to normal and use this one instead. */ if (hwndDefButton) - SendMessage( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE); + SendMessage(hwndDefButton, BM_SETSTYLE16, BS_PUSHBUTTON,FALSE); hwndDefButton = hwndCtrl; dlgInfo->msgResult = GetWindowWord( hwndCtrl, GWW_ID ); } @@ -731,11 +732,13 @@ int GetDlgItemText( HWND hwnd, WORD id, SEGPTR str, WORD max ) */ void SetDlgItemInt( HWND hwnd, WORD id, WORD value, BOOL fSigned ) { - char str[20]; + char *str = (char *)SEGPTR_ALLOC( 20 * sizeof(char) ); + if (!str) return; if (fSigned) sprintf( str, "%d", (int)value ); else sprintf( str, "%u", value ); - SendDlgItemMessage( hwnd, id, WM_SETTEXT, 0, (LPARAM)MAKE_SEGPTR(str) ); + SendDlgItemMessage( hwnd, id, WM_SETTEXT, 0, (LPARAM)SEGPTR_GET(str) ); + SEGPTR_FREE(str); } @@ -744,11 +747,12 @@ void SetDlgItemInt( HWND hwnd, WORD id, WORD value, BOOL fSigned ) */ WORD GetDlgItemInt( HWND hwnd, WORD id, BOOL * translated, BOOL fSigned ) { - char str[30]; + char *str; long result = 0; if (translated) *translated = FALSE; - if (SendDlgItemMessage( hwnd, id, WM_GETTEXT, 30, (LPARAM)MAKE_SEGPTR(str) )) + if (!(str = (char *)SEGPTR_ALLOC( 30 * sizeof(char) ))) return 0; + if (SendDlgItemMessage( hwnd, id, WM_GETTEXT, 30, (LPARAM)SEGPTR_GET(str))) { char * endptr; result = strtol( str, &endptr, 10 ); @@ -766,6 +770,7 @@ WORD GetDlgItemInt( HWND hwnd, WORD id, BOOL * translated, BOOL fSigned ) } } } + SEGPTR_FREE(str); return (WORD)result; } @@ -775,7 +780,7 @@ WORD GetDlgItemInt( HWND hwnd, WORD id, BOOL * translated, BOOL fSigned ) */ BOOL CheckDlgButton( HWND hwnd, INT id, UINT check ) { - SendDlgItemMessage( hwnd, id, BM_SETCHECK, check, 0 ); + SendDlgItemMessage( hwnd, id, BM_SETCHECK16, check, 0 ); return TRUE; } @@ -785,7 +790,7 @@ BOOL CheckDlgButton( HWND hwnd, INT id, UINT check ) */ WORD IsDlgButtonChecked( HWND hwnd, WORD id ) { - return (WORD)SendDlgItemMessage( hwnd, id, BM_GETCHECK, 0, 0 ); + return (WORD)SendDlgItemMessage( hwnd, id, BM_GETCHECK16, 0, 0 ); } @@ -805,7 +810,7 @@ BOOL CheckRadioButton( HWND hwndDlg, UINT firstID, UINT lastID, UINT checkID ) lastID = firstID; /* Buttons are in reverse order */ while (pWnd) { - SendMessage(pWnd->hwndSelf, BM_SETCHECK, (pWnd->wIDmenu == checkID),0); + SendMessage(pWnd->hwndSelf,BM_SETCHECK16,(pWnd->wIDmenu == checkID),0); if (pWnd->wIDmenu == lastID) break; pWnd = pWnd->next; } @@ -823,9 +828,25 @@ DWORD GetDialogBaseUnits() /*********************************************************************** - * MapDialogRect (USER.103) + * MapDialogRect16 (USER.103) */ -void MapDialogRect( HWND hwnd, LPRECT rect ) +void MapDialogRect16( HWND16 hwnd, LPRECT16 rect ) +{ + DIALOGINFO * dlgInfo; + WND * wndPtr = WIN_FindWndPtr( hwnd ); + if (!wndPtr) return; + dlgInfo = (DIALOGINFO *)wndPtr->wExtra; + rect->left = (rect->left * dlgInfo->xBaseUnit) / 4; + rect->right = (rect->right * dlgInfo->xBaseUnit) / 4; + rect->top = (rect->top * dlgInfo->yBaseUnit) / 8; + rect->bottom = (rect->bottom * dlgInfo->yBaseUnit) / 8; +} + + +/*********************************************************************** + * MapDialogRect32 (USER32.381) + */ +void MapDialogRect32( HWND32 hwnd, LPRECT32 rect ) { DIALOGINFO * dlgInfo; WND * wndPtr = WIN_FindWndPtr( hwnd ); diff --git a/windows/event.c b/windows/event.c index 2924ffcaf18..ce5d41e94eb 100644 --- a/windows/event.c +++ b/windows/event.c @@ -14,20 +14,19 @@ #include #include #include -#include "gdi.h" #include "windows.h" +#include "gdi.h" +#include "heap.h" #include "win.h" #include "class.h" #include "clipboard.h" #include "debugger.h" +#include "module.h" #include "options.h" #include "queue.h" #include "winpos.h" #include "registers.h" -#include "stackframe.h" #include "stddebug.h" -/* #define DEBUG_EVENT */ -/* #define DEBUG_KEY */ #include "debug.h" @@ -149,6 +148,7 @@ static void EVENT_MotionNotify( XMotionEvent *event ); static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event ); static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event ); static void EVENT_Expose( HWND hwnd, XExposeEvent *event ); +static void EVENT_GraphicsExpose( HWND hwnd, XGraphicsExposeEvent *event ); static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ); static void EVENT_SelectionRequest( HWND hwnd, XSelectionRequestEvent *event); static void EVENT_SelectionNotify( HWND hwnd, XSelectionEvent *event); @@ -233,6 +233,12 @@ void EVENT_ProcessEvent( XEvent *event ) EVENT_ClientMessage( hwnd, (XClientMessageEvent *) event ); break; + case GraphicsExpose: + EVENT_GraphicsExpose( hwnd, (XGraphicsExposeEvent *) event ); + + case NoExpose: + break; + default: dprintf_event(stddeb, "Unprocessed event %s for hwnd %04x\n", event_names[event->type], hwnd ); @@ -277,7 +283,7 @@ static WORD EVENT_XStateToKeyState( int state ) */ static void EVENT_Expose( HWND hwnd, XExposeEvent *event ) { - RECT rect; + RECT32 rect; WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return; @@ -287,9 +293,32 @@ static void EVENT_Expose( HWND hwnd, XExposeEvent *event ) rect.right = rect.left + event->width; rect.bottom = rect.top + event->height; - RedrawWindow( hwnd, &rect, 0, - RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE | - (event->count ? 0 : RDW_ERASENOW) ); + RedrawWindow32( hwnd, &rect, 0, + RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE | + (event->count ? 0 : RDW_ERASENOW) ); +} + + +/*********************************************************************** + * EVENT_GraphicsExpose + * This is needed when scrolling area is partially obscured + * by non-Wine X window. + */ +static void EVENT_GraphicsExpose( HWND hwnd, XGraphicsExposeEvent *event ) +{ + RECT16 rect; + WND * wndPtr = WIN_FindWndPtr( hwnd ); + if (!wndPtr) return; + + /* Make position relative to client area instead of window */ + rect.left = event->x - (wndPtr->rectClient.left - wndPtr->rectWindow.left); + rect.top = event->y - (wndPtr->rectClient.top - wndPtr->rectWindow.top); + rect.right = rect.left + event->width; + rect.bottom = rect.top + event->height; + + RedrawWindow16( hwnd, &rect, 0, + RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | + (event->count ? 0 : RDW_ERASENOW) ); } @@ -485,7 +514,7 @@ static void EVENT_FocusIn (HWND hwnd, XFocusChangeEvent *event ) { if (event->detail == NotifyPointer) return; if (hwnd != GetActiveWindow()) WINPOS_ChangeActiveWindow( hwnd, FALSE ); - if ((hwnd != GetFocus()) && ! IsChild( hwnd, GetFocus())) SetFocus( hwnd ); + if ((hwnd != GetFocus()) && !IsChild( hwnd, GetFocus())) SetFocus( hwnd ); } @@ -518,12 +547,13 @@ static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) else { /* A managed window; most of this code is shamelessly - * stolen from SetWindowPos + * stolen from SetWindowPos - FIXME: outdated */ WND *wndPtr; - WINDOWPOS winpos; - RECT newWindowRect, newClientRect; + WINDOWPOS16 *winpos; + RECT16 newWindowRect, newClientRect; + HRGN hrgnOldPos, hrgnNewPos; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) { @@ -531,28 +561,30 @@ static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) return; } - /* Artificial messages */ + if (!(winpos = SEGPTR_NEW(WINDOWPOS16))) return; + + /* Artificial messages - what is this for? */ SendMessage(hwnd, WM_ENTERSIZEMOVE, 0, 0); SendMessage(hwnd, WM_EXITSIZEMOVE, 0, 0); /* 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 */ - SendMessage(hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)MAKE_SEGPTR(&winpos)); + SendMessage(hwnd, WM_WINDOWPOSCHANGING, 0, (LPARAM)SEGPTR_GET(winpos)); /* Calculate new position and size */ newWindowRect.left = event->x; @@ -560,14 +592,25 @@ static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event ) newWindowRect.top = event->y; newWindowRect.bottom = event->y + event->height; - WINPOS_SendNCCalcSize( winpos.hwnd, TRUE, &newWindowRect, + WINPOS_SendNCCalcSize( winpos->hwnd, TRUE, &newWindowRect, &wndPtr->rectWindow, &wndPtr->rectClient, - MAKE_SEGPTR(&winpos), &newClientRect ); + SEGPTR_GET(winpos), &newClientRect ); + hrgnOldPos = CreateRectRgnIndirect16( &wndPtr->rectWindow ); + hrgnNewPos = CreateRectRgnIndirect16( &newWindowRect ); + CombineRgn( hrgnOldPos, hrgnOldPos, hrgnNewPos, RGN_DIFF ); + /* Set new size and position */ wndPtr->rectWindow = newWindowRect; wndPtr->rectClient = newClientRect; - SendMessage(hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)MAKE_SEGPTR(&winpos)); + SendMessage( hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)SEGPTR_GET(winpos)); + SEGPTR_FREE(winpos); + + /* full window drag leaves unrepainted garbage without this */ + RedrawWindow32( 0, NULL, hrgnOldPos, RDW_INVALIDATE | + RDW_ALLCHILDREN | RDW_ERASE | RDW_ERASENOW ); + DeleteObject(hrgnOldPos); + DeleteObject(hrgnNewPos); } } @@ -710,8 +753,9 @@ HWND GetCapture() */ FARPROC GetMouseEventProc(void) { - char name[] = "Mouse_Event"; - return GetProcAddress( GetModuleHandle("USER"), MAKE_SEGPTR(name) ); + HMODULE hmodule = GetModuleHandle("USER"); + return MODULE_GetEntryPoint( hmodule, + MODULE_GetOrdinal( hmodule, "Mouse_Event" ) ); } diff --git a/windows/graphics.c b/windows/graphics.c index bb2919af3cc..00770c71e79 100644 --- a/windows/graphics.c +++ b/windows/graphics.c @@ -73,9 +73,9 @@ DWORD MoveTo( HDC hdc, short x, short y ) /*********************************************************************** - * MoveToEx (GDI.483) + * MoveToEx16 (GDI.483) */ -BOOL MoveToEx( HDC hdc, short x, short y, LPPOINT pt ) +BOOL16 MoveToEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -90,6 +90,18 @@ BOOL MoveToEx( HDC hdc, short x, short y, LPPOINT pt ) } +/*********************************************************************** + * MoveToEx32 (GDI32.254) + */ +BOOL32 MoveToEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt ) +{ + POINT16 pt16; + if (!MoveToEx16( (HDC16)hdc, (INT16)x, (INT16)y, &pt16 )) return FALSE; + if (pt) CONV_POINT16TO32( &pt16, pt ); + return TRUE; +} + + /*********************************************************************** * GRAPH_DrawArc * @@ -434,9 +446,9 @@ BOOL RoundRect( HDC hDC, INT left, INT top, INT right, INT bottom, /*********************************************************************** - * FillRect (USER.81) + * FillRect16 (USER.81) */ -int FillRect( HDC hdc, LPRECT rect, HBRUSH hbrush ) +INT16 FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) { HBRUSH prevBrush; @@ -450,9 +462,25 @@ int FillRect( HDC hdc, LPRECT rect, HBRUSH hbrush ) /*********************************************************************** - * InvertRect (USER.82) + * FillRect32 (USER32.196) */ -void InvertRect( HDC hdc, LPRECT rect ) +INT32 FillRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush ) +{ + HBRUSH prevBrush; + + if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return 0; + if (!(prevBrush = SelectObject( hdc, (HBRUSH16)hbrush ))) return 0; + PatBlt( hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, PATCOPY ); + SelectObject( hdc, prevBrush ); + return 1; +} + + +/*********************************************************************** + * InvertRect16 (USER.82) + */ +void InvertRect16( HDC16 hdc, const RECT16 *rect ) { if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return; PatBlt( hdc, rect->left, rect->top, @@ -461,9 +489,20 @@ void InvertRect( HDC hdc, LPRECT rect ) /*********************************************************************** - * FrameRect (USER.83) + * InvertRect32 (USER32.329) */ -int FrameRect( HDC hdc, LPRECT rect, HBRUSH hbrush ) +void InvertRect32( HDC32 hdc, const RECT32 *rect ) +{ + if ((rect->right <= rect->left) || (rect->bottom <= rect->top)) return; + PatBlt( hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, DSTINVERT ); +} + + +/*********************************************************************** + * FrameRect16 (USER.83) + */ +INT16 FrameRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush ) { HBRUSH prevBrush; int left, top, right, bottom; @@ -495,6 +534,17 @@ int FrameRect( HDC hdc, LPRECT rect, HBRUSH hbrush ) } +/*********************************************************************** + * FrameRect32 (USER32.202) + */ +INT32 FrameRect32( HDC32 hdc, const RECT32 *rect, HBRUSH32 hbrush ) +{ + RECT16 rect16; + CONV_RECT32TO16( rect, &rect16 ); + return FrameRect16( (HDC16)hdc, &rect16, (HBRUSH16)hbrush ); +} + + /*********************************************************************** * SetPixel (GDI.31) */ @@ -568,7 +618,7 @@ COLORREF GetPixel( HDC hdc, short x, short y ) */ BOOL PaintRgn( HDC hdc, HRGN hrgn ) { - RECT box; + RECT16 box; HRGN tmpVisRgn, prevVisRgn; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -587,7 +637,7 @@ BOOL PaintRgn( HDC hdc, HRGN hrgn ) /* Fill the region */ - GetRgnBox( dc->w.hGCClipRgn, &box ); + GetRgnBox16( dc->w.hGCClipRgn, &box ); if (DC_SetupGCForBrush( dc )) XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc, dc->w.DCOrgX + box.left, dc->w.DCOrgY + box.top, @@ -640,11 +690,11 @@ BOOL InvertRgn( HDC hdc, HRGN hrgn ) /*********************************************************************** - * DrawFocusRect (USER.466) + * DrawFocusRect16 (USER.466) */ -void DrawFocusRect( HDC hdc, const RECT* rc ) +void DrawFocusRect16( HDC16 hdc, const RECT16* rc ) { - HPEN hOldPen; + HPEN16 hOldPen; int oldDrawMode, oldBkMode; int left, top, right, bottom; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -655,7 +705,7 @@ void DrawFocusRect( HDC hdc, const RECT* rc ) right = XLPTODP( dc, rc->right ); bottom = YLPTODP( dc, rc->bottom ); - hOldPen = (HPEN)SelectObject(hdc, sysColorObjects.hpenWindowText ); + hOldPen = (HPEN16)SelectObject(hdc, sysColorObjects.hpenWindowText ); oldDrawMode = SetROP2(hdc, R2_XORPEN); oldBkMode = SetBkMode(hdc, TRANSPARENT); @@ -673,6 +723,17 @@ void DrawFocusRect( HDC hdc, const RECT* rc ) } +/*********************************************************************** + * DrawFocusRect32 (USER32.155) + */ +void DrawFocusRect32( HDC32 hdc, const RECT32* rect ) +{ + RECT16 rect16; + CONV_RECT32TO16( rect, &rect16 ); + return DrawFocusRect16( (HDC16)hdc, &rect16 ); +} + + /********************************************************************** * GRAPH_DrawBitmap * @@ -712,7 +773,7 @@ BOOL GRAPH_DrawBitmap( HDC hdc, HBITMAP hbitmap, int xdest, int ydest, /********************************************************************** * GRAPH_DrawReliefRect (Not a MSWin Call) */ -void GRAPH_DrawReliefRect( HDC hdc, RECT *rect, int highlight_size, +void GRAPH_DrawReliefRect( HDC hdc, RECT16 *rect, int highlight_size, int shadow_size, BOOL pressed ) { HBRUSH hbrushOld; @@ -743,9 +804,9 @@ void GRAPH_DrawReliefRect( HDC hdc, RECT *rect, int highlight_size, /********************************************************************** - * Polyline (GDI.37) + * Polyline16 (GDI.37) */ -BOOL Polyline (HDC hdc, LPPOINT pt, int count) +BOOL16 Polyline16( HDC16 hdc, LPPOINT16 pt, INT16 count ) { register int i; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -769,9 +830,9 @@ BOOL Polyline (HDC hdc, LPPOINT pt, int count) /********************************************************************** - * Polygon (GDI.36) + * Polygon16 (GDI.36) */ -BOOL Polygon (HDC hdc, LPPOINT pt, int count) +BOOL16 Polygon16( HDC16 hdc, LPPOINT16 pt, INT16 count ) { register int i; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -806,9 +867,9 @@ BOOL Polygon (HDC hdc, LPPOINT pt, int count) /********************************************************************** - * PolyPolygon (GDI.450) + * PolyPolygon16 (GDI.450) */ -BOOL PolyPolygon( HDC hdc, LPPOINT pt, LPINT16 counts, WORD polygons ) +BOOL16 PolyPolygon16( HDC16 hdc, LPPOINT16 pt, LPINT16 counts, UINT16 polygons) { HRGN hrgn; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); @@ -824,7 +885,7 @@ BOOL PolyPolygon( HDC hdc, LPPOINT pt, LPINT16 counts, WORD polygons ) /* creating the region. But as CreatePolyPolygonRgn is not */ /* really correct either, it doesn't matter much... */ /* At least the outline will be correct :-) */ - hrgn = CreatePolyPolygonRgn( pt, counts, polygons, dc->w.polyFillMode ); + hrgn = CreatePolyPolygonRgn16( pt, counts, polygons, dc->w.polyFillMode ); PaintRgn( hdc, hrgn ); DeleteObject( hrgn ); @@ -930,7 +991,7 @@ static void GRAPH_InternalFloodFill( XImage *image, DC *dc, * * Main flood-fill routine. */ -static BOOL GRAPH_DoFloodFill( DC *dc, RECT *rect, INT x, INT y, +static BOOL GRAPH_DoFloodFill( DC *dc, RECT16 *rect, INT16 x, INT16 y, COLORREF color, WORD fillType ) { XImage *image; @@ -964,7 +1025,7 @@ static BOOL GRAPH_DoFloodFill( DC *dc, RECT *rect, INT x, INT y, */ BOOL ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, WORD fillType ) { - RECT rect; + RECT16 rect; DC *dc; dprintf_graphics( stddeb, "ExtFloodFill %04x %d,%d %06lx %d\n", @@ -980,7 +1041,7 @@ BOOL ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, WORD fillType ) } if (!PtVisible( hdc, x, y )) return FALSE; - if (GetRgnBox( dc->w.hGCClipRgn, &rect ) == ERROR) return FALSE; + if (GetRgnBox16( dc->w.hGCClipRgn, &rect ) == ERROR) return FALSE; return CallTo32_LargeStack( (int(*)())GRAPH_DoFloodFill, 6, dc, &rect, x, y, color, fillType ); @@ -999,7 +1060,7 @@ BOOL FloodFill( HDC hdc, INT x, INT y, COLORREF color ) /********************************************************************** * DrawEdge (USER.659) */ -BOOL DrawEdge(HDC hdc, LPRECT qrc, UINT edge, UINT flags) +BOOL DrawEdge(HDC hdc, LPRECT16 qrc, UINT edge, UINT flags) { fprintf(stdnimp,"DrawEdge(%x,%p,%d,%x), empty stub!\n", hdc,qrc,edge,flags @@ -1010,7 +1071,7 @@ BOOL DrawEdge(HDC hdc, LPRECT qrc, UINT edge, UINT flags) /********************************************************************** * DrawFrameControl (USER.656) */ -BOOL DrawFrameControl(HDC hdc, LPRECT qrc, UINT edge, UINT flags) +BOOL DrawFrameControl(HDC hdc, LPRECT16 qrc, UINT edge, UINT flags) { fprintf(stdnimp,"DrawFrameControl(%x,%p,%d,%x), empty stub!\n", hdc,qrc,edge,flags diff --git a/windows/mapping.c b/windows/mapping.c index 8fb9563d8f5..9ae2b69175c 100644 --- a/windows/mapping.c +++ b/windows/mapping.c @@ -35,37 +35,70 @@ void MAPPING_FixIsotropic( DC * dc ) } } + /*********************************************************************** - * DPtoLP (GDI.67) + * DPtoLP16 (GDI.67) */ -BOOL DPtoLP( HDC hdc, LPPOINT points, INT count ) +BOOL16 DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count ) { - POINT * pt; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; - - for (pt = points; count > 0; pt++, count--) + + while (count--) { - pt->x = XDPTOLP( dc, pt->x ); - pt->y = YDPTOLP( dc, pt->y ); + points->x = XDPTOLP( dc, points->x ); + points->y = YDPTOLP( dc, points->y ); } return TRUE; } /*********************************************************************** - * LPtoDP (GDI.99) + * DPtoLP32 (GDI32.65) */ -BOOL LPtoDP( HDC hdc, LPPOINT points, int count ) +BOOL32 DPtoLP32( HDC32 hdc, LPPOINT32 points, INT32 count ) { - POINT * pt; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; - - for (pt = points; count > 0; pt++, count--) + + while (count--) { - pt->x = XLPTODP( dc, pt->x ); - pt->y = YLPTODP( dc, pt->y ); + points->x = XDPTOLP( dc, points->x ); + points->y = YDPTOLP( dc, points->y ); + } + return TRUE; +} + + +/*********************************************************************** + * LPtoDP16 (GDI.99) + */ +BOOL16 LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count ) +{ + DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); + if (!dc) return FALSE; + + while (count--) + { + points->x = XLPTODP( dc, points->x ); + points->y = YLPTODP( dc, points->y ); + } + return TRUE; +} + + +/*********************************************************************** + * LPtoDP32 (GDI32.247) + */ +BOOL32 LPtoDP32( HDC32 hdc, LPPOINT32 points, INT32 count ) +{ + DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); + if (!dc) return FALSE; + + while (count--) + { + points->x = XLPTODP( dc, points->x ); + points->y = YLPTODP( dc, points->y ); } return TRUE; } @@ -160,9 +193,9 @@ WORD SetMapMode( HDC hdc, WORD mode ) /*********************************************************************** * SetViewportExt (GDI.14) */ -DWORD SetViewportExt( HDC hdc, short x, short y ) +DWORD SetViewportExt( HDC16 hdc, INT16 x, INT16 y ) { - SIZE size; + SIZE16 size; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -175,19 +208,19 @@ DWORD SetViewportExt( HDC hdc, short x, short y ) size.cx = dc->w.VportExtX; size.cy = dc->w.VportExtY; if ((dc->w.MapMode != MM_ISOTROPIC) && (dc->w.MapMode != MM_ANISOTROPIC)) - return size.cx | (size.cy << 16); + return MAKELONG( size.cx, size.cy ); if (!x || !y) return 0; dc->w.VportExtX = x; dc->w.VportExtY = y; if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - return size.cx | (size.cy << 16); + return MAKELONG( size.cx, size.cy ); } /*********************************************************************** - * SetViewportExtEx (GDI.479) + * SetViewportExtEx16 (GDI.479) */ -BOOL SetViewportExtEx( HDC hdc, short x, short y, LPSIZE size ) +BOOL16 SetViewportExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -206,12 +239,24 @@ BOOL SetViewportExtEx( HDC hdc, short x, short y, LPSIZE size ) } +/*********************************************************************** + * SetViewportExtEx32 (GDI32.340) + */ +BOOL32 SetViewportExtEx32( HDC32 hdc, INT32 x, INT32 y, LPSIZE32 size ) +{ + SIZE16 size16; + BOOL16 ret = SetViewportExtEx16( (HDC16)hdc, (INT16)x, (INT16)y, &size16 ); + if (size) CONV_SIZE16TO32( &size16, size ); + return ret; +} + + /*********************************************************************** * SetViewportOrg (GDI.13) */ -DWORD SetViewportOrg( HDC hdc, short x, short y ) +DWORD SetViewportOrg( HDC16 hdc, INT16 x, INT16 y ) { - POINT pt; + POINT16 pt; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -230,9 +275,9 @@ DWORD SetViewportOrg( HDC hdc, short x, short y ) /*********************************************************************** - * SetViewportOrgEx (GDI.480) + * SetViewportOrgEx16 (GDI.480) */ -BOOL SetViewportOrgEx( HDC hdc, short x, short y, LPPOINT pt ) +BOOL16 SetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -247,12 +292,24 @@ BOOL SetViewportOrgEx( HDC hdc, short x, short y, LPPOINT pt ) } +/*********************************************************************** + * SetViewportOrgEx32 (GDI32.341) + */ +BOOL32 SetViewportOrgEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt ) +{ + POINT16 pt16; + BOOL16 ret = SetViewportOrgEx16( (HDC16)hdc, (INT16)x, (INT16)y, &pt16 ); + if (pt) CONV_POINT16TO32( &pt16, pt ); + return ret; +} + + /*********************************************************************** * SetWindowExt (GDI.12) */ -DWORD SetWindowExt( HDC hdc, short x, short y ) +DWORD SetWindowExt( HDC16 hdc, INT16 x, INT16 y ) { - SIZE size; + SIZE16 size; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -265,19 +322,19 @@ DWORD SetWindowExt( HDC hdc, short x, short y ) size.cx = dc->w.WndExtX; size.cy = dc->w.WndExtY; if ((dc->w.MapMode != MM_ISOTROPIC) && (dc->w.MapMode != MM_ANISOTROPIC)) - return size.cx | (size.cy << 16); + return MAKELONG( size.cx, size.cy ); if (!x || !y) return 0; dc->w.WndExtX = x; dc->w.WndExtY = y; if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); - return size.cx | (size.cy << 16); + return MAKELONG( size.cx, size.cy ); } /*********************************************************************** - * SetWindowExtEx (GDI.481) + * SetWindowExtEx16 (GDI.481) */ -BOOL SetWindowExtEx( HDC hdc, short x, short y, LPSIZE size ) +BOOL16 SetWindowExtEx16( HDC16 hdc, INT16 x, INT16 y, LPSIZE16 size ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -296,12 +353,24 @@ BOOL SetWindowExtEx( HDC hdc, short x, short y, LPSIZE size ) } +/*********************************************************************** + * SetWindowExtEx32 (GDI32.344) + */ +BOOL32 SetWindowExtEx32( HDC32 hdc, INT32 x, INT32 y, LPSIZE32 size ) +{ + SIZE16 size16; + BOOL16 ret = SetWindowExtEx16( (HDC16)hdc, (INT16)x, (INT16)y, &size16 ); + if (size) CONV_SIZE16TO32( &size16, size ); + return ret; +} + + /*********************************************************************** * SetWindowOrg (GDI.11) */ -DWORD SetWindowOrg( HDC hdc, short x, short y ) +DWORD SetWindowOrg( HDC16 hdc, INT16 x, INT16 y ) { - POINT pt; + POINT16 pt; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -315,14 +384,14 @@ DWORD SetWindowOrg( HDC hdc, short x, short y ) pt.y = dc->w.WndOrgY; dc->w.WndOrgX = x; dc->w.WndOrgY = y; - return pt.x | (pt.y << 16); + return MAKELONG( pt.x, pt.y ); } /*********************************************************************** - * SetWindowOrgEx (GDI.482) + * SetWindowOrgEx16 (GDI.482) */ -BOOL SetWindowOrgEx( HDC hdc, short x, short y, LPPOINT pt ) +BOOL16 SetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -337,12 +406,24 @@ BOOL SetWindowOrgEx( HDC hdc, short x, short y, LPPOINT pt ) } +/*********************************************************************** + * SetWindowOrgEx32 (GDI32.345) + */ +BOOL32 SetWindowOrgEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt ) +{ + POINT16 pt16; + BOOL16 ret = SetWindowOrgEx16( (HDC16)hdc, (INT16)x, (INT16)y, &pt16 ); + if (pt) CONV_POINT16TO32( &pt16, pt ); + return ret; +} + + /*********************************************************************** * OffsetViewportOrg (GDI.17) */ -DWORD OffsetViewportOrg( HDC hdc, short x, short y ) +DWORD OffsetViewportOrg( HDC16 hdc, INT16 x, INT16 y ) { - POINT pt; + POINT16 pt; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -361,9 +442,9 @@ DWORD OffsetViewportOrg( HDC hdc, short x, short y ) /*********************************************************************** - * OffsetViewportOrgEx (GDI.476) + * OffsetViewportOrgEx16 (GDI.476) */ -BOOL OffsetViewportOrgEx( HDC hdc, short x, short y, LPPOINT pt ) +BOOL16 OffsetViewportOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -378,12 +459,24 @@ BOOL OffsetViewportOrgEx( HDC hdc, short x, short y, LPPOINT pt ) } +/*********************************************************************** + * OffsetViewportOrgEx32 (GDI32.257) + */ +BOOL32 OffsetViewportOrgEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt ) +{ + POINT16 pt16; + BOOL16 ret = OffsetViewportOrgEx16( (HDC16)hdc, (INT16)x, (INT16)y, &pt16); + if (pt) CONV_POINT16TO32( &pt16, pt ); + return ret; +} + + /*********************************************************************** * OffsetWindowOrg (GDI.15) */ -DWORD OffsetWindowOrg( HDC hdc, short x, short y ) +DWORD OffsetWindowOrg( HDC16 hdc, INT16 x, INT16 y ) { - POINT pt; + POINT16 pt; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -402,9 +495,9 @@ DWORD OffsetWindowOrg( HDC hdc, short x, short y ) /*********************************************************************** - * OffsetWindowOrgEx (GDI.477) + * OffsetWindowOrgEx16 (GDI.477) */ -BOOL OffsetWindowOrgEx( HDC hdc, short x, short y, LPPOINT pt ) +BOOL16 OffsetWindowOrgEx16( HDC16 hdc, INT16 x, INT16 y, LPPOINT16 pt ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -419,13 +512,25 @@ BOOL OffsetWindowOrgEx( HDC hdc, short x, short y, LPPOINT pt ) } +/*********************************************************************** + * OffsetWindowOrgEx32 (GDI32.258) + */ +BOOL32 OffsetWindowOrgEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt ) +{ + POINT16 pt16; + BOOL16 ret = OffsetWindowOrgEx16( (HDC16)hdc, (INT16)x, (INT16)y, &pt16 ); + if (pt) CONV_POINT16TO32( &pt16, pt ); + return ret; +} + + /*********************************************************************** * ScaleViewportExt (GDI.18) */ -DWORD ScaleViewportExt( HDC hdc, short xNum, short xDenom, - short yNum, short yDenom ) +DWORD ScaleViewportExt( HDC16 hdc, INT16 xNum, INT16 xDenom, + INT16 yNum, INT16 yDenom ) { - SIZE size; + SIZE16 size; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -450,10 +555,10 @@ DWORD ScaleViewportExt( HDC hdc, short xNum, short xDenom, /*********************************************************************** - * ScaleViewportExtEx (GDI.484) + * ScaleViewportExtEx16 (GDI.484) */ -BOOL ScaleViewportExtEx( HDC hdc, short xNum, short xDenom, - short yNum, short yDenom, LPSIZE size ) +BOOL16 ScaleViewportExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom, + INT16 yNum, INT16 yDenom, LPSIZE16 size ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -474,13 +579,27 @@ BOOL ScaleViewportExtEx( HDC hdc, short xNum, short xDenom, } +/*********************************************************************** + * ScaleViewportExtEx32 (GDI32.293) + */ +BOOL32 ScaleViewportExtEx32( HDC32 hdc, INT32 xNum, INT32 xDenom, + INT32 yNum, INT32 yDenom, LPSIZE32 size ) +{ + SIZE16 size16; + BOOL16 ret = ScaleViewportExtEx16( (HDC16)hdc, (INT16)xNum, (INT16)xDenom, + (INT16)yNum, (INT16)yDenom, &size16 ); + if (size) CONV_SIZE16TO32( &size16, size ); + return ret; +} + + /*********************************************************************** * ScaleWindowExt (GDI.16) */ -DWORD ScaleWindowExt( HDC hdc, short xNum, short xDenom, - short yNum, short yDenom ) +DWORD ScaleWindowExt( HDC16 hdc, INT16 xNum, INT16 xDenom, + INT16 yNum, INT16 yDenom ) { - SIZE size; + SIZE16 size; DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) { @@ -505,10 +624,10 @@ DWORD ScaleWindowExt( HDC hdc, short xNum, short xDenom, /*********************************************************************** - * ScaleWindowExtEx (GDI.485) + * ScaleWindowExtEx16 (GDI.485) */ -BOOL ScaleWindowExtEx( HDC hdc, short xNum, short xDenom, - short yNum, short yDenom, LPSIZE size ) +BOOL16 ScaleWindowExtEx16( HDC16 hdc, INT16 xNum, INT16 xDenom, + INT16 yNum, INT16 yDenom, LPSIZE16 size ) { DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); if (!dc) return FALSE; @@ -527,3 +646,17 @@ BOOL ScaleWindowExtEx( HDC hdc, short xNum, short xDenom, if (dc->w.MapMode == MM_ISOTROPIC) MAPPING_FixIsotropic( dc ); return TRUE; } + + +/*********************************************************************** + * ScaleWindowExtEx32 (GDI32.294) + */ +BOOL32 ScaleWindowExtEx32( HDC32 hdc, INT32 xNum, INT32 xDenom, + INT32 yNum, INT32 yDenom, LPSIZE32 size ) +{ + SIZE16 size16; + BOOL16 ret = ScaleWindowExtEx16( (HDC16)hdc, (INT16)xNum, (INT16)xDenom, + (INT16)yNum, (INT16)yDenom, &size16 ); + if (size) CONV_SIZE16TO32( &size16, size ); + return ret; +} diff --git a/windows/mdi.c b/windows/mdi.c index a97cfcf3e23..d6488eb70fd 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -5,12 +5,8 @@ * * This file contains routines to support MDI features. * - * Notes: Windows keeps ID of MDI menu item in the wIDenu field - * of corresponding MDI child. - * - * Basic child activation routine is MDI_ChildActivate and - * SetWindowPos(childHwnd,...) implicitly calls it if SWP_NOACTIVATE - * is not used. + * Notes: Fairly complete implementation. Any volunteers for + * "More windows..." stuff? * * Also, Excel and WinWord do _not_ use MDI so if you're trying * to fix them look elsewhere. @@ -32,7 +28,9 @@ #include "stddebug.h" #include "debug.h" +#define MDIS_ALLCHILDSTYLES 0x1 +HMENU MENU_CopySysMenu(); DWORD SCROLL_SetNCSbState(WND*,int,int,int,int,int,int); /* ----------------- declarations ----------------- */ @@ -199,6 +197,25 @@ HWND MDI_GetWindow(WND *clientWnd, HWND hWnd, WORD wTo ) return pWndLast ? pWndLast->hwndSelf : 0; } +/********************************************************************** + * MDI_CalcDefaultChildPos + * + * It seems that default height is 2/3 of client rect + */ +void MDI_CalcDefaultChildPos(WND* w, WORD n, LPPOINT16 lpPos, INT delta) +{ + RECT16 rect = w->rectClient; + INT spacing = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME) - 1; + INT nstagger; + + if( rect.bottom - rect.top - delta >= spacing ) + rect.bottom -= delta; + + nstagger = (rect.bottom - rect.top)/(3*spacing); + lpPos[1].x = (rect.right - rect.left - nstagger*spacing); + lpPos[1].y = (rect.bottom - rect.top - nstagger*spacing); + lpPos[0].x = lpPos[0].y = spacing*(n%(nstagger+1)); +} /********************************************************************** * MDISetMenu @@ -218,8 +235,8 @@ HMENU MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) HWND hwndFrame = GetParent(hwnd); HMENU oldFrameMenu = GetMenu(hwndFrame); - if( ci->flagChildMaximized && hmenuFrame && hmenuFrame!=oldFrameMenu ) - MDI_RestoreFrameMenu(w->parent, ci->flagChildMaximized ); + if( ci->hwndChildMaximized && hmenuFrame && hmenuFrame!=oldFrameMenu ) + MDI_RestoreFrameMenu(w->parent, ci->hwndChildMaximized ); if( hmenuWindow && hmenuWindow!=ci->hWindowMenu ) { @@ -260,8 +277,8 @@ HMENU MDISetMenu(HWND hwnd, BOOL fRefresh, HMENU hmenuFrame, HMENU hmenuWindow) if( hmenuFrame && hmenuFrame!=oldFrameMenu) { SetMenu(hwndFrame, hmenuFrame); - if( ci->flagChildMaximized ) - MDI_AugmentFrameMenu(ci, w->parent, ci->flagChildMaximized ); + if( ci->hwndChildMaximized ) + MDI_AugmentFrameMenu(ci, w->parent, ci->hwndChildMaximized ); return oldFrameMenu; } @@ -289,33 +306,59 @@ WORD MDIIconArrange(HWND parent) */ HWND MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPARAM lParam ) { + POINT16 pos[2]; MDICREATESTRUCT *cs = (MDICREATESTRUCT *)PTR_SEG_TO_LIN(lParam); - HWND hwnd; + DWORD style = cs->style | (WS_CHILD | WS_CLIPSIBLINGS); + HWND hwnd, hwndMax = 0; WORD wIDmenu = ci->idFirstChild + ci->nActiveChildren; - int spacing; char* lpstrDef="junk!"; /* * Create child window + * */ - cs->style &= (WS_MINIMIZE | WS_MAXIMIZE | WS_HSCROLL | WS_VSCROLL); + dprintf_mdi(stdnimp,"MDICreateChild: origin %i,%i - dim %i,%i, style %08x\n", + cs->x, cs->y, cs->cx, cs->cy, (unsigned)cs->style); + /* calculate placement */ + MDI_CalcDefaultChildPos(w, ci->nTotalCreated++, pos, 0); - /* The child windows should probably */ - /* stagger, shouldn't they? -DRP */ - spacing = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME); - cs->x = ci->nActiveChildren * spacing; - cs->y = ci->nActiveChildren * spacing; + if( cs->cx == CW_USEDEFAULT16 || !cs->cx ) + cs->cx = pos[1].x; + if( cs->cy == CW_USEDEFAULT16 || !cs->cy ) + cs->cy = pos[1].y; + + if( cs->x == CW_USEDEFAULT16 ) + { + cs->x = pos[0].x; + cs->y = pos[0].y; + } + + /* restore current maximized child */ + if( style & WS_VISIBLE && ci->hwndChildMaximized ) + { + if( style & WS_MAXIMIZE ) + SendMessage(w->hwndSelf, WM_SETREDRAW, FALSE, 0L ); + hwndMax = ci->hwndChildMaximized; + ShowWindow( hwndMax, SW_SHOWNOACTIVATE ); + if( style & WS_MAXIMIZE ) + SendMessage(w->hwndSelf, WM_SETREDRAW, TRUE, 0L ); + } /* this menu is needed to set a check mark in MDI_ChildActivate */ AppendMenu(ci->hWindowMenu ,MF_STRING ,wIDmenu, MAKE_SEGPTR(lpstrDef) ); ci->nActiveChildren++; + + /* fix window style */ + if( !(w->dwStyle & MDIS_ALLCHILDSTYLES) ) + { + style &= (WS_CHILD | WS_CLIPSIBLINGS | WS_MINIMIZE | WS_MAXIMIZE | + WS_CLIPCHILDREN | WS_DISABLED | WS_VSCROLL | WS_HSCROLL ); + style |= (WS_VISIBLE | WS_OVERLAPPEDWINDOW); + } - hwnd = CreateWindow16( cs->szClass, cs->szTitle, - WS_CHILD | WS_BORDER | WS_CAPTION | WS_CLIPSIBLINGS | - WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | - WS_THICKFRAME | WS_VISIBLE | cs->style, + hwnd = CreateWindow16( cs->szClass, cs->szTitle, style, cs->x, cs->y, cs->cx, cs->cy, parent, (HMENU)(DWORD)(WORD)wIDmenu, w->hInstance, (SEGPTR)lParam); @@ -327,8 +370,10 @@ HWND MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPARAM lParam ) } else { - ci->nActiveChildren--; + ci->nActiveChildren--; DeleteMenu(ci->hWindowMenu,wIDmenu,MF_BYCOMMAND); + if( IsWindow(hwndMax) ) + ShowWindow(hwndMax, SW_SHOWMAXIMIZED); } return hwnd; @@ -336,16 +381,15 @@ HWND MDICreateChild(WND *w, MDICLIENTINFO *ci, HWND parent, LPARAM lParam ) /********************************************************************** * MDI_ChildGetMinMaxInfo - * */ -void MDI_ChildGetMinMaxInfo(WND* clientWnd, HWND hwnd, MINMAXINFO* lpMinMax ) +void MDI_ChildGetMinMaxInfo(WND* clientWnd, HWND hwnd, MINMAXINFO16* lpMinMax ) { WND* childWnd = WIN_FindWndPtr(hwnd); - RECT rect = clientWnd->rectClient; + RECT16 rect = clientWnd->rectClient; - MapWindowPoints(clientWnd->parent->hwndSelf, - ((MDICLIENTINFO*)clientWnd->wExtra)->self, (LPPOINT)&rect, 2); - AdjustWindowRectEx(&rect, childWnd->dwStyle, 0, childWnd->dwExStyle); + MapWindowPoints16(clientWnd->parent->hwndSelf, + ((MDICLIENTINFO*)clientWnd->wExtra)->self, (LPPOINT16)&rect, 2); + AdjustWindowRectEx16( &rect, childWnd->dwStyle, 0, childWnd->dwExStyle ); lpMinMax->ptMaxSize.x = rect.right -= rect.left; lpMinMax->ptMaxSize.y = rect.bottom -= rect.top; @@ -382,11 +426,11 @@ void MDI_SwitchActiveChild(HWND clientHwnd, HWND childHwnd, BOOL wTo ) if ( hwndTo != hwndPrev ) { - BOOL bSA = 0; + BOOL bOptimize = 0; - if( ci->flagChildMaximized ) + if( ci->hwndChildMaximized ) { - bSA = 1; + bOptimize = 1; w->dwStyle &= ~WS_VISIBLE; } @@ -398,7 +442,7 @@ void MDI_SwitchActiveChild(HWND clientHwnd, HWND childHwnd, BOOL wTo ) SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } - if( bSA ) + if( bOptimize ) ShowWindow( clientHwnd, SW_SHOW ); } } @@ -421,10 +465,10 @@ HWND MDIDestroyChild(WND *w_parent, MDICLIENTINFO *ci, HWND parent, if( child == ci->hwndActiveChild ) { ShowWindow( child, SW_HIDE); - if( child == ci->flagChildMaximized ) + if( child == ci->hwndChildMaximized ) { MDI_RestoreFrameMenu(w_parent->parent, child); - ci->flagChildMaximized = 0; + ci->hwndChildMaximized = 0; MDI_UpdateFrameText(w_parent->parent,parent,TRUE,NULL); } @@ -489,8 +533,8 @@ LONG MDI_ChildActivate(WND *clientPtr, HWND hWndChild) } /* set appearance */ - if( clientInfo->flagChildMaximized ) - if( clientInfo->flagChildMaximized != hWndChild ) + if( clientInfo->hwndChildMaximized ) + if( clientInfo->hwndChildMaximized != hWndChild ) if( hWndChild ) { clientInfo->hwndActiveChild = hWndChild; @@ -544,7 +588,7 @@ LONG MDI_ChildActivate(WND *clientPtr, HWND hWndChild) * * iTotal returns number of children available for tiling or cascading */ -MDIWCL* MDI_BuildWCL(WND* clientWnd, int* iTotal) +MDIWCL* MDI_BuildWCL(WND* clientWnd, INT* iTotal) { MDIWCL *listTop,*listNext; WND *childWnd; @@ -623,59 +667,42 @@ HBITMAP CreateMDIMenuBitmap(void) /********************************************************************** * MDICascade */ -LONG MDICascade(HWND parent, MDICLIENTINFO *ci) +LONG MDICascade(WND* clientWnd, MDICLIENTINFO *ci) { - WND *clientWnd; MDIWCL *listTop,*listPrev; - RECT rect; - int spacing, xsize, ysize; - int x, y; - int iToPosition = 0; - - if (ci->flagChildMaximized) - ShowWindow( ci->flagChildMaximized, SW_NORMAL); + INT16 delta = 0,iToPosition = 0, n = 0; + POINT16 pos[2]; + + if (ci->hwndChildMaximized) + ShowWindow( ci->hwndChildMaximized, SW_NORMAL); if (ci->nActiveChildren == 0) return 0; - GetClientRect(parent, &rect); - spacing = GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYFRAME); - ysize = rect.bottom - 8 * spacing; - xsize = rect.right - 8 * spacing; - - dprintf_mdi(stddeb, "MDICascade: Client wnd at (%d,%d) - (%d,%d), spacing %d\n", - rect.left, rect.top, rect.right, rect.bottom, spacing); - - clientWnd = WIN_FindWndPtr( parent ); + if (!(listTop = MDI_BuildWCL(clientWnd,&iToPosition))) return 0; - listTop = MDI_BuildWCL(clientWnd,&iToPosition); - - if( !listTop ) return 0; - - x = 0; - y = 0; + if( iToPosition < ci->nActiveChildren ) + delta = 2 * SYSMETRICS_CYICONSPACING + SYSMETRICS_CYICON; /* walk list and move windows */ while ( listTop ) { dprintf_mdi(stddeb, "MDICascade: move %04x to (%d,%d) size [%d,%d]\n", - listTop->hChild, x, y, xsize, ysize); + listTop->hChild, pos[0].x, pos[0].y, pos[1].x, pos[1].y); if( listTop->hChild ) - { - SetWindowPos(listTop->hChild, 0, x, y, xsize, ysize, - SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER); + { + MDI_CalcDefaultChildPos(clientWnd, n++, pos, delta); + SetWindowPos(listTop->hChild, 0, pos[0].x, pos[0].y, pos[1].x, pos[1].y, + SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER); + } - x += spacing; - y += spacing; - } - listPrev = listTop->prev; free(listTop); listTop = listPrev; } if( iToPosition < ci->nActiveChildren ) - ArrangeIconicWindows( parent ); + ArrangeIconicWindows( clientWnd->hwndSelf ); return 0; } @@ -684,20 +711,19 @@ LONG MDICascade(HWND parent, MDICLIENTINFO *ci) * MDITile * */ -LONG MDITile(HWND parent, MDICLIENTINFO *ci,WORD wParam) +LONG MDITile(WND* wndClient, MDICLIENTINFO *ci,WORD wParam) { - WND *wndClient = WIN_FindWndPtr(parent); MDIWCL *listTop,*listPrev; - RECT rect; + RECT16 rect; int xsize, ysize; int x, y; int rows, columns; int r, c; int i; - int iToPosition = 0; + INT iToPosition = 0; - if (ci->flagChildMaximized) - ShowWindow(ci->flagChildMaximized, SW_NORMAL); + if (ci->hwndChildMaximized) + ShowWindow(ci->hwndChildMaximized, SW_NORMAL); if (ci->nActiveChildren == 0) return 0; @@ -710,9 +736,7 @@ LONG MDITile(HWND parent, MDICLIENTINFO *ci,WORD wParam) /* tile children */ if ( iToPosition ) { - - GetClientRect(parent, &rect); - + rect = wndClient->rectClient; rows = (int) sqrt((double) iToPosition); columns = iToPosition / rows; @@ -774,7 +798,7 @@ LONG MDITile(HWND parent, MDICLIENTINFO *ci,WORD wParam) } if (iToPosition < ci->nActiveChildren ) - ArrangeIconicWindows( parent ); + ArrangeIconicWindows( wndClient->hwndSelf ); return 0; } @@ -787,20 +811,25 @@ LONG MDITile(HWND parent, MDICLIENTINFO *ci,WORD wParam) */ BOOL MDI_AugmentFrameMenu(MDICLIENTINFO* ci, WND *frame, HWND hChild) { - WND* child = WIN_FindWndPtr(hChild); - HMENU hSysPopup = 0; + WND* child = WIN_FindWndPtr(hChild); + POPUPMENU* pmenu = NULL; + HMENU hSysPopup = 0; dprintf_mdi(stddeb,"MDI_AugmentFrameMenu: frame %p,child %04x\n",frame,hChild); if( !frame->wIDmenu || !child->hSysMenu ) return 0; + + /* create a copy of sysmenu popup and insert it into frame menu bar */ - hSysPopup = GetSystemMenu(hChild,FALSE); + hSysPopup = MENU_CopySysMenu(); + pmenu = (POPUPMENU*) USER_HEAP_LIN_ADDR(hSysPopup); + pmenu->wFlags &= ~MF_SYSMENU; dprintf_mdi(stddeb,"\t\tgot popup %04x\n in sysmenu %04x",hSysPopup,child->hSysMenu); if( !InsertMenu(frame->wIDmenu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, hSysPopup, (SEGPTR)(DWORD)ci->obmClose) ) - return 0; + { DestroyMenu(hSysPopup); return 0; } if( !AppendMenu(frame->wIDmenu,MF_HELP | MF_BITMAP, SC_RESTORE, (SEGPTR)(DWORD)ci->obmRestore) ) @@ -809,10 +838,6 @@ BOOL MDI_AugmentFrameMenu(MDICLIENTINFO* ci, WND *frame, HWND hChild) return 0; } - /* FIXME: add a call to function that sets sysmenu items according - * to the window state. WS_MAXIMIZE -> no SC_SIZE, etc... - */ - EnableMenuItem(hSysPopup, SC_SIZE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(hSysPopup, SC_MOVE, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(hSysPopup, SC_MAXIMIZE, MF_BYCOMMAND | MF_GRAYED); @@ -840,10 +865,6 @@ BOOL MDI_RestoreFrameMenu( WND *frameWnd, HWND hChild) child->dwStyle |= WS_SYSMENU; - /* FIXME: add a call to function that sets sysmenu items according - * to the window state. WS_MAXIMIZE -> no SC_SIZE, etc... - */ - RemoveMenu(frameWnd->wIDmenu,0,MF_BYPOSITION); DeleteMenu(frameWnd->wIDmenu,nItems-1,MF_BYPOSITION); @@ -883,7 +904,7 @@ void MDI_UpdateFrameText(WND *frameWnd, HWND hClient, BOOL repaint, LPCSTR lpTit if( ci->hFrameTitle ) { - WND* childWnd = WIN_FindWndPtr( ci->flagChildMaximized ); + WND* childWnd = WIN_FindWndPtr( ci->hwndChildMaximized ); if( childWnd && childWnd->hText ) { @@ -951,10 +972,10 @@ void MDI_UpdateFrameText(WND *frameWnd, HWND hClient, BOOL repaint, LPCSTR lpTit */ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - LPCREATESTRUCT cs; + LPCREATESTRUCT16 cs; LPCLIENTCREATESTRUCT ccs; MDICLIENTINFO *ci; - RECT rect; + RECT16 rect; WND *w = WIN_FindWndPtr(hwnd); WND *frameWnd = w->parent; @@ -963,13 +984,14 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_CREATE: - cs = (LPCREATESTRUCT) PTR_SEG_TO_LIN(lParam); + cs = (LPCREATESTRUCT16) PTR_SEG_TO_LIN(lParam); ccs = (LPCLIENTCREATESTRUCT) PTR_SEG_TO_LIN(cs->lpCreateParams); ci->hWindowMenu = ccs->hWindowMenu; ci->idFirstChild = ccs->idFirstChild; - ci->flagChildMaximized = 0; + ci->hwndChildMaximized = 0; ci->nActiveChildren = 0; + ci->nTotalCreated = 0; ci->hFrameTitle = frameWnd->hText; ci->sbNeedUpdate = 0; ci->self = hwnd; @@ -982,8 +1004,8 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) AppendMenu(ccs->hWindowMenu,MF_SEPARATOR,0,(SEGPTR)0); - GetClientRect(frameWnd->hwndSelf, &rect); - NC_HandleNCCalcSize(hwnd, (NCCALCSIZE_PARAMS*) &rect); + GetClientRect16(frameWnd->hwndSelf, &rect); + NC_HandleNCCalcSize(hwnd, (NCCALCSIZE_PARAMS16*) &rect); w->rectClient = rect; dprintf_mdi(stddeb,"MDI: Client created - hwnd = %04x, idFirst = %u\n",hwnd,ci->idFirstChild); @@ -991,7 +1013,7 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; case WM_DESTROY: - if( ci->flagChildMaximized ) MDI_RestoreFrameMenu(w, frameWnd->hwndSelf); + if( ci->hwndChildMaximized ) MDI_RestoreFrameMenu(w, frameWnd->hwndSelf); if(ci->obmClose) DeleteObject(ci->obmClose); if(ci->obmRestore) DeleteObject(ci->obmRestore); @@ -1010,7 +1032,7 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; case WM_MDICASCADE: - return MDICascade(hwnd, ci); + return MDICascade(w, ci); case WM_MDICREATE: return (LONG)MDICreateChild(w, ci, hwnd, lParam ); @@ -1020,7 +1042,7 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MDIGETACTIVE: return ((LONG) ci->hwndActiveChild | - ((LONG) (ci->flagChildMaximized>0) << 16)); + ((LONG) (ci->hwndChildMaximized>0) << 16)); case WM_MDIICONARRANGE: ci->sbNeedUpdate = TRUE; @@ -1051,7 +1073,7 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MDITILE: ci->sbNeedUpdate = TRUE; ShowScrollBar(hwnd,SB_BOTH,FALSE); - MDITile(hwnd, ci,wParam); + MDITile(w, ci,wParam); ci->sbNeedUpdate = FALSE; return 0; @@ -1078,11 +1100,11 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_PARENTNOTIFY: if( wParam == WM_LBUTTONDOWN ) - { - LPPOINT lppt = (LPPOINT)(void*)(&lParam); - HWND child = ChildWindowFromPoint(hwnd, *lppt); + { + POINT16 pt = MAKEPOINT16(lParam); + HWND child = ChildWindowFromPoint16(hwnd, pt); - dprintf_mdi(stddeb,"MDIClient: notification from %04x (%i,%i)\n",child,lppt->x,lppt->y); + dprintf_mdi(stddeb,"MDIClient: notification from %04x (%i,%i)\n",child,pt.x,pt.y); if( child && child != hwnd ) { @@ -1098,13 +1120,13 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) return 0; case WM_SIZE: - if( ci->flagChildMaximized ) + if( ci->hwndChildMaximized ) { - WND* child = WIN_FindWndPtr(ci->flagChildMaximized); - RECT rect = { 0, 0, LOWORD(lParam), HIWORD(lParam) }; + WND* child = WIN_FindWndPtr(ci->hwndChildMaximized); + RECT16 rect = { 0, 0, LOWORD(lParam), HIWORD(lParam) }; - AdjustWindowRectEx(&rect, child->dwStyle, 0, child->dwExStyle); - MoveWindow(ci->flagChildMaximized, rect.left, rect.top, + AdjustWindowRectEx16(&rect, child->dwStyle, 0, child->dwExStyle); + MoveWindow(ci->hwndChildMaximized, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, 1); } else @@ -1144,7 +1166,7 @@ LRESULT DefFrameProc(HWND hwnd, HWND hwndMDIClient, UINT message, wndPtr = WIN_FindWndPtr(hwndMDIClient); ci = (MDICLIENTINFO*)wndPtr->wExtra; - /* check for possible system command codes */ + /* check for possible syscommands for maximized MDI child */ if( wParam < ci->idFirstChild || wParam >= ci->idFirstChild + ci->nActiveChildren ) @@ -1160,8 +1182,8 @@ LRESULT DefFrameProc(HWND hwnd, HWND hwndMDIClient, UINT message, case SC_PREVWINDOW: case SC_CLOSE: case SC_RESTORE: - if( ci->flagChildMaximized ) - return SendMessage( ci->flagChildMaximized, WM_SYSCOMMAND, + if( ci->hwndChildMaximized ) + return SendMessage( ci->hwndChildMaximized, WM_SYSCOMMAND, wParam, lParam); } } @@ -1215,7 +1237,7 @@ LRESULT DefMDIChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SETTEXT: DefWindowProc(hwnd, message, wParam, lParam); MDI_MenuModifyItem(clientWnd,hwnd); - if( ci->flagChildMaximized == hwnd ) + if( ci->hwndChildMaximized == hwnd ) MDI_UpdateFrameText( clientWnd->parent, ci->self, MDI_REPAINTFRAME, NULL ); return 0; @@ -1242,10 +1264,10 @@ LRESULT DefMDIChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) switch( wParam ) { case SC_MOVE: - if( ci->flagChildMaximized == hwnd) return 0; + if( ci->hwndChildMaximized == hwnd) return 0; break; case SC_MAXIMIZE: - if( ci->flagChildMaximized == hwnd) + if( ci->hwndChildMaximized == hwnd) return SendMessage( clientWnd->parent->hwndSelf, message, wParam, lParam); break; @@ -1259,11 +1281,11 @@ LRESULT DefMDIChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_GETMINMAXINFO: - MDI_ChildGetMinMaxInfo(clientWnd, hwnd, (MINMAXINFO*) PTR_SEG_TO_LIN(lParam)); + MDI_ChildGetMinMaxInfo(clientWnd, hwnd, (MINMAXINFO16*) PTR_SEG_TO_LIN(lParam)); return 0; case WM_SETVISIBLE: - if( ci->flagChildMaximized) + if( ci->hwndChildMaximized) ci->sbNeedUpdate = 0; else MDI_PostUpdate(clientWnd->hwndSelf, ci, SB_BOTH+1); @@ -1274,7 +1296,7 @@ LRESULT DefMDIChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if( ci->hwndActiveChild == hwnd && wParam != SIZE_MAXIMIZED ) { - ci->flagChildMaximized = 0; + ci->hwndChildMaximized = 0; MDI_RestoreFrameMenu( clientWnd->parent, hwnd); MDI_UpdateFrameText( clientWnd->parent, ci->self, @@ -1283,7 +1305,7 @@ LRESULT DefMDIChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if( wParam == SIZE_MAXIMIZED ) { - HWND hMaxChild = ci->flagChildMaximized; + HWND hMaxChild = ci->hwndChildMaximized; if( hMaxChild == hwnd ) break; @@ -1297,7 +1319,7 @@ LRESULT DefMDIChildProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) SendMessage( hMaxChild, WM_SETREDRAW, TRUE, 0L ); } - ci->flagChildMaximized = hwnd; /* !!! */ + ci->hwndChildMaximized = hwnd; /* !!! */ MDI_AugmentFrameMenu( ci, clientWnd->parent, hwnd); MDI_UpdateFrameText( clientWnd->parent, ci->self, @@ -1380,22 +1402,22 @@ BOOL TranslateMDISysAccel(HWND hwndClient, LPMSG msg) */ void CalcChildScroll( HWND hwnd, WORD scroll ) { - RECT childRect, clientRect; + RECT16 childRect, clientRect; INT vmin, vmax, hmin, hmax, vpos, hpos; BOOL noscroll = FALSE; WND *pWnd, *Wnd; if (!(Wnd = pWnd = WIN_FindWndPtr( hwnd ))) return; - GetClientRect( hwnd, &clientRect ); - SetRectEmpty( &childRect ); + GetClientRect16( hwnd, &clientRect ); + SetRectEmpty16( &childRect ); for ( pWnd = pWnd->child; pWnd; pWnd = pWnd->next ) { - UnionRect( &childRect, &pWnd->rectWindow, &childRect ); + UnionRect16( &childRect, &pWnd->rectWindow, &childRect ); if( pWnd->dwStyle & WS_MAXIMIZE ) noscroll = TRUE; } - UnionRect( &childRect, &clientRect, &childRect ); + UnionRect16( &childRect, &clientRect, &childRect ); /* jump through the hoops to prevent excessive flashing */ diff --git a/windows/message.c b/windows/message.c index c33ad1fd7be..f86d585890c 100644 --- a/windows/message.c +++ b/windows/message.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -55,11 +56,11 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove ) { WND *pWnd; BOOL eatMsg = FALSE; - INT hittest; + INT16 hittest; static DWORD lastClickTime = 0; static WORD lastClickMsg = 0; - static POINT lastClickPos = { 0, 0 }; - POINT pt = msg->pt; + static POINT16 lastClickPos = { 0, 0 }; + POINT16 pt = msg->pt; MOUSEHOOKSTRUCT hook = { msg->pt, 0, HTCLIENT, 0 }; BOOL mouseClick = ((msg->message == WM_LBUTTONDOWN) || @@ -71,7 +72,7 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove ) if (GetCapture()) { msg->hwnd = GetCapture(); - ScreenToClient( msg->hwnd, &pt ); + ScreenToClient16( msg->hwnd, &pt ); msg->lParam = MAKELONG( pt.x, pt.y ); /* No need to further process the message */ hook.hwnd = msg->hwnd; @@ -102,7 +103,7 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove ) if (((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT)) && hwndTop != GetActiveWindow() ) - WINPOS_ChangeActiveWindow( hwndTop, TRUE ); + WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ); } } @@ -148,7 +149,7 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove ) /* Build the translated message */ if (hittest == HTCLIENT) - ScreenToClient( msg->hwnd, &pt ); + ScreenToClient16( msg->hwnd, &pt ); else { msg->wParam = hittest; @@ -686,8 +687,8 @@ LRESULT SendMessage( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) SPY_ExitMessage( SPY_RESULT_INVALIDHWND, hwnd, msg, 0 ); return 0; } - ret = CallWindowProc( wndPtr->lpfnWndProc, msgstruct.hWnd, msgstruct.wMsg, - msgstruct.wParam, msgstruct.lParam ); + ret = CallWindowProc16(wndPtr->lpfnWndProc, msgstruct.hWnd, msgstruct.wMsg, + msgstruct.wParam, msgstruct.lParam ); SPY_ExitMessage( SPY_RESULT_OK, hwnd, msg, ret ); return ret; } @@ -772,13 +773,9 @@ LONG DispatchMessage( const MSG* msg ) { if (msg->lParam) { -#ifndef WINELIB - HINSTANCE ds = msg->hwnd ? WIN_GetWindowInstance( msg->hwnd ) - : (HINSTANCE)CURRENT_DS; -#endif /* HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ - return CallWndProc( (WNDPROC)msg->lParam, ds, msg->hwnd, - msg->message, msg->wParam, GetTickCount() ); + return CallWindowProc16( (WNDPROC)msg->lParam, msg->hwnd, + msg->message, msg->wParam, GetTickCount() ); } } @@ -788,8 +785,8 @@ LONG DispatchMessage( const MSG* msg ) painting = (msg->message == WM_PAINT); if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT; /* HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ - retval = CallWindowProc( wndPtr->lpfnWndProc, msg->hwnd, msg->message, - msg->wParam, msg->lParam ); + retval = CallWindowProc16( wndPtr->lpfnWndProc, msg->hwnd, msg->message, + msg->wParam, msg->lParam ); if (painting && (wndPtr = WIN_FindWndPtr( msg->hwnd )) && (wndPtr->flags & WIN_NEEDS_BEGINPAINT) && wndPtr->hrgnUpdate) { @@ -797,28 +794,42 @@ LONG DispatchMessage( const MSG* msg ) msg->hwnd); wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT; /* Validate the update region to avoid infinite WM_PAINT loop */ - ValidateRect( msg->hwnd, NULL ); + ValidateRect32( msg->hwnd, NULL ); } return retval; } /*********************************************************************** - * RegisterWindowMessage (USER.118) + * RegisterWindowMessage16 (USER.118) */ -WORD RegisterWindowMessage( SEGPTR str ) +WORD RegisterWindowMessage16( SEGPTR str ) { - dprintf_msg(stddeb, "RegisterWindowMessage: %08lx\n", (DWORD)str ); - return GlobalAddAtom( str ); + dprintf_msg(stddeb, "RegisterWindowMessage16: %08lx\n", (DWORD)str ); + return GlobalAddAtom16( str ); } -WORD RegisterWindowMessageA( LPSTR str ) + +/*********************************************************************** + * RegisterWindowMessage32A (USER32.436) + */ +WORD RegisterWindowMessage32A( LPCSTR str ) { - char buffer[256]; - lstrcpyn( buffer, str, sizeof(buffer) ); - return RegisterWindowMessage(MAKE_SEGPTR(buffer)); + dprintf_msg(stddeb, "RegisterWindowMessage32A: %s\n", str ); + return GlobalAddAtom32A( str ); } + +/*********************************************************************** + * RegisterWindowMessage32W (USER32.437) + */ +WORD RegisterWindowMessage32W( LPCWSTR str ) +{ + dprintf_msg(stddeb, "RegisterWindowMessage32W: %p\n", str ); + return GlobalAddAtom32W( str ); +} + + /*********************************************************************** * GetTickCount (USER.13) (KERNEL32.299) */ diff --git a/windows/msgbox.c b/windows/msgbox.c index ebacf129a97..d1bbae42d79 100644 --- a/windows/msgbox.c +++ b/windows/msgbox.c @@ -21,7 +21,7 @@ typedef struct { LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { LPMSGBOX lpmb; - RECT rect, textrect; + RECT16 rect, textrect; HWND hItem; HDC hdc; LONG lRet; @@ -85,21 +85,21 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) } /* Position everything */ - GetWindowRect(hwnd, &rect); + GetWindowRect16(hwnd, &rect); borheight = rect.bottom - rect.top; wwidth = rect.right - rect.left; - GetClientRect(hwnd, &rect); + GetClientRect16(hwnd, &rect); borheight -= rect.bottom - rect.top; /* Get the icon height */ - GetWindowRect(GetDlgItem(hwnd, 1088), &rect); + GetWindowRect16(GetDlgItem(hwnd, 1088), &rect); iheight = rect.bottom - rect.top; /* Get the number of visible buttons and their width */ - GetWindowRect(GetDlgItem(hwnd, 2), &rect); + GetWindowRect16(GetDlgItem(hwnd, 2), &rect); bheight = rect.bottom - rect.top; bwidth = rect.left; - GetWindowRect(GetDlgItem(hwnd, 1), &rect); + GetWindowRect16(GetDlgItem(hwnd, 1), &rect); bwidth -= rect.left; for (buttons = 0, i = 1; i < 8; i++) { hItem = GetDlgItem(hwnd, i); @@ -110,13 +110,13 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) /* Get the text size */ hItem = GetDlgItem(hwnd, 100); - GetWindowRect(hItem, &textrect); - MapWindowPoints(0, hwnd, (LPPOINT)&textrect, 2); + GetWindowRect16(hItem, &textrect); + MapWindowPoints16(0, hwnd, (LPPOINT16)&textrect, 2); - GetClientRect(hItem, &rect); + GetClientRect16(hItem, &rect); hdc = GetDC(hItem); - lRet = DrawText(hdc, lpmb->text, -1, &rect, - DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT); + lRet = DrawText16( hdc, lpmb->text, -1, &rect, + DT_LEFT | DT_EXPANDTABS | DT_WORDBREAK | DT_CALCRECT); theight = rect.bottom - rect.top; tiheight = 16 + MAX(iheight, theight); ReleaseDC(hItem, hdc); @@ -128,8 +128,8 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) /* Position the icon */ hItem = GetDlgItem(hwnd, 1088); - GetWindowRect(hItem, &rect); - MapWindowPoints(0, hwnd, (LPPOINT)&rect, 2); + GetWindowRect16(hItem, &rect); + MapWindowPoints16(0, hwnd, (LPPOINT16)&rect, 2); SetWindowPos(hItem, 0, rect.left, (tiheight - iheight) / 2, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW); @@ -139,14 +139,14 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) /* Position the buttons */ bpos = (wwidth - bwidth * buttons) / 2; - GetWindowRect(GetDlgItem(hwnd, 1), &rect); + GetWindowRect16(GetDlgItem(hwnd, 1), &rect); for (buttons = i = 0; i < 7; i++) { /* some arithmetic to get the right order for YesNoCancel windows */ hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1); if (GetWindowLong(hItem, GWL_STYLE) & WS_VISIBLE) { if (buttons++ == ((lpmb->type & MB_DEFMASK) >> 8)) { SetFocus(hItem); - SendMessage(hItem, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE); + SendMessage(hItem, BM_SETSTYLE16, BS_DEFPUSHBUTTON, TRUE); } SetWindowPos(hItem, 0, bpos, tiheight, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW); diff --git a/windows/nonclient.c b/windows/nonclient.c index 2538eb18f7e..0be13a89811 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -9,6 +9,7 @@ #include "message.h" #include "sysmetrics.h" #include "user.h" +#include "heap.h" #include "shell.h" #include "dialog.h" #include "syscolor.h" @@ -19,9 +20,7 @@ #include "graphics.h" #include "queue.h" #include "selectors.h" -#include "stackframe.h" #include "stddebug.h" -/* #define DEBUG_NONCLIENT */ #include "debug.h" #include "options.h" @@ -62,22 +61,23 @@ static HBITMAP hbitmapRestoreD = 0; * Compute the size of the window rectangle from the size of the * client rectangle. */ -static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) +static void NC_AdjustRect(LPRECT16 rect, DWORD style, BOOL menu, DWORD exStyle) { if (style & WS_ICONIC) return; /* Nothing to change for an icon */ /* Decide if the window will be managed (see CreateWindowEx) */ - if (!(Options.managed && ((style & (WS_DLGFRAME | WS_THICKFRAME)) || - (exStyle & WS_EX_DLGMODALFRAME)))) + if (!(Options.managed && !(style & WS_CHILD) && + ((style & (WS_DLGFRAME | WS_THICKFRAME)) || + (exStyle & WS_EX_DLGMODALFRAME)))) { if (HAS_DLGFRAME( style, exStyle )) - InflateRect( rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME ); + InflateRect16(rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME ); else { if (HAS_THICKFRAME(style)) - InflateRect( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME ); + InflateRect16( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME ); if (style & WS_BORDER) - InflateRect( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER ); + InflateRect16( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER); } if ((style & WS_CAPTION) == WS_CAPTION) @@ -91,18 +91,28 @@ static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) /*********************************************************************** - * AdjustWindowRect (USER.102) + * AdjustWindowRect16 (USER.102) */ -BOOL AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu ) +BOOL16 AdjustWindowRect16( LPRECT16 rect, DWORD style, BOOL16 menu ) { - return AdjustWindowRectEx( rect, style, menu, 0 ); + return AdjustWindowRectEx16( rect, style, menu, 0 ); } /*********************************************************************** - * AdjustWindowRectEx (USER.454) + * AdjustWindowRect32 (USER32.) */ -BOOL AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) +BOOL32 AdjustWindowRect32( LPRECT32 rect, DWORD style, BOOL32 menu ) +{ + return AdjustWindowRectEx32( rect, style, menu, 0 ); +} + + +/*********************************************************************** + * AdjustWindowRectEx16 (USER.454) + */ +BOOL16 AdjustWindowRectEx16( LPRECT16 rect, DWORD style, + BOOL16 menu, DWORD exStyle ) { /* Correct the window style */ @@ -119,26 +129,44 @@ BOOL AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle ) } +/*********************************************************************** + * AdjustWindowRectEx32 (USER32.) + */ +BOOL32 AdjustWindowRectEx32( LPRECT32 rect, DWORD style, + BOOL32 menu, DWORD exStyle ) +{ + RECT16 rect16; + BOOL32 ret; + + CONV_RECT32TO16( rect, &rect16 ); + ret = AdjustWindowRectEx16( &rect16, style, (BOOL16)menu, exStyle ); + CONV_RECT16TO32( &rect16, rect ); + return ret; +} + + /******************************************************************* * NC_GetMinMaxInfo * * Get the minimized and maximized information for a window. */ -void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, - POINT *minTrack, POINT *maxTrack ) +void NC_GetMinMaxInfo( HWND hwnd, POINT16 *maxSize, POINT16 *maxPos, + POINT16 *minTrack, POINT16 *maxTrack ) { - MINMAXINFO MinMax; + MINMAXINFO16 *MinMax; short xinc, yinc; WND *wndPtr = WIN_FindWndPtr( hwnd ); + if (!(MinMax = SEGPTR_NEW(MINMAXINFO16))) return; + /* 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 )) @@ -160,39 +188,40 @@ void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, yinc += SYSMETRICS_CYBORDER; } } - MinMax.ptMaxSize.x += 2 * xinc; - MinMax.ptMaxSize.y += 2 * yinc; + MinMax->ptMaxSize.x += 2 * xinc; + MinMax->ptMaxSize.y += 2 * yinc; /* Note: The '+' in the following test should really be a ||, but * that would cause gcc-2.7.0 to generate incorrect code. */ if ((wndPtr->ptMaxPos.x != -1) + (wndPtr->ptMaxPos.y != -1)) - MinMax.ptMaxPosition = wndPtr->ptMaxPos; + MinMax->ptMaxPosition = wndPtr->ptMaxPos; else { - MinMax.ptMaxPosition.x = -xinc; - MinMax.ptMaxPosition.y = -yinc; + MinMax->ptMaxPosition.x = -xinc; + MinMax->ptMaxPosition.y = -yinc; } - SendMessage( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)MAKE_SEGPTR(&MinMax) ); + SendMessage( hwnd, WM_GETMINMAXINFO, 0, (LPARAM)SEGPTR_GET(MinMax) ); /* Some sanity checks */ dprintf_nonclient(stddeb, "NC_GetMinMaxInfo: %d %d / %d %d / %d %d / %d %d\n", - (int)MinMax.ptMaxSize.x,(int)MinMax.ptMaxSize.y, - (int)MinMax.ptMaxPosition.x,(int)MinMax.ptMaxPosition.y, - (int)MinMax.ptMaxTrackSize.x,(int)MinMax.ptMaxTrackSize.y, - (int)MinMax.ptMinTrackSize.x,(int)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; + if (maxSize) *maxSize = MinMax->ptMaxSize; + if (maxPos) *maxPos = MinMax->ptMaxPosition; + if (minTrack) *minTrack = MinMax->ptMinTrackSize; + if (maxTrack) *maxTrack = MinMax->ptMaxTrackSize; + SEGPTR_FREE(MinMax); } @@ -201,9 +230,9 @@ void NC_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, * * Handle a WM_NCCALCSIZE message. Called from DefWindowProc(). */ -LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params ) +LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS16 *params ) { - RECT tmpRect = { 0, 0, 0, 0 }; + RECT16 tmpRect = { 0, 0, 0, 0 }; WND *wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return 0; @@ -230,7 +259,7 @@ LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params ) * but without the borders (if any). * The rectangle is in window coordinates (for drawing with GetWindowDC()). */ -void NC_GetInsideRect( HWND hwnd, RECT *rect ) +static void NC_GetInsideRect( HWND hwnd, RECT16 *rect ) { WND * wndPtr = WIN_FindWndPtr( hwnd ); @@ -244,15 +273,16 @@ void NC_GetInsideRect( HWND hwnd, RECT *rect ) /* Remove frame from rectangle */ if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) { - InflateRect( rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME); - if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) InflateRect( rect, -1, 0); + InflateRect16( rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME); + if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) + InflateRect16( rect, -1, 0 ); } else { if (HAS_THICKFRAME( wndPtr->dwStyle )) - InflateRect( rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME ); + InflateRect16( rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME ); if (wndPtr->dwStyle & WS_BORDER) - InflateRect( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER ); + InflateRect16( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER ); } } @@ -262,17 +292,17 @@ void NC_GetInsideRect( HWND hwnd, RECT *rect ) * * Handle a WM_NCHITTEST message. Called from DefWindowProc(). */ -LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) +LONG NC_HandleNCHitTest( HWND hwnd, POINT16 pt ) { - RECT rect; + RECT16 rect; WND *wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return HTERROR; dprintf_nonclient(stddeb, "NC_HandleNCHitTest: hwnd=%04x pt=%d,%d\n", hwnd, pt.x, pt.y ); - GetWindowRect( hwnd, &rect ); - if (!PtInRect( &rect, pt )) return HTNOWHERE; + GetWindowRect16( hwnd, &rect ); + if (!PtInRect16( &rect, pt )) return HTNOWHERE; if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION; @@ -281,10 +311,10 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) /* Check borders */ if (HAS_THICKFRAME( wndPtr->dwStyle )) { - InflateRect( &rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME ); + InflateRect16( &rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME ); if (wndPtr->dwStyle & WS_BORDER) - InflateRect(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER); - if (!PtInRect( &rect, pt )) + InflateRect16(&rect,-SYSMETRICS_CXBORDER,-SYSMETRICS_CYBORDER); + if (!PtInRect16( &rect, pt )) { /* Check top sizing border */ if (pt.y < rect.top) @@ -319,10 +349,10 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) else /* No thick frame */ { if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) - InflateRect(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME); + InflateRect16(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME); else if (wndPtr->dwStyle & WS_BORDER) - InflateRect(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER); - if (!PtInRect( &rect, pt )) return HTBORDER; + InflateRect16(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER); + if (!PtInRect16( &rect, pt )) return HTBORDER; } /* Check caption */ @@ -330,7 +360,7 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) { rect.top += SYSMETRICS_CYCAPTION - 1; - if (!PtInRect( &rect, pt )) + if (!PtInRect16( &rect, pt )) { /* Check system menu */ if (wndPtr->dwStyle & WS_SYSMENU) @@ -351,16 +381,16 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) /* Check client area */ - ScreenToClient( hwnd, &pt ); - GetClientRect( hwnd, &rect ); - if (PtInRect( &rect, pt )) return HTCLIENT; + ScreenToClient16( hwnd, &pt ); + GetClientRect16( hwnd, &rect ); + if (PtInRect16( &rect, pt )) return HTCLIENT; /* Check vertical scroll bar */ if (wndPtr->dwStyle & WS_VSCROLL) { rect.right += SYSMETRICS_CXVSCROLL; - if (PtInRect( &rect, pt )) return HTVSCROLL; + if (PtInRect16( &rect, pt )) return HTVSCROLL; } /* Check horizontal scroll bar */ @@ -368,7 +398,7 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) if (wndPtr->dwStyle & WS_HSCROLL) { rect.bottom += SYSMETRICS_CYHSCROLL; - if (PtInRect( &rect, pt )) + if (PtInRect16( &rect, pt )) { /* Check size box */ if ((wndPtr->dwStyle & WS_VSCROLL) && @@ -396,7 +426,7 @@ LONG NC_HandleNCHitTest( HWND hwnd, POINT pt ) */ void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) { - RECT rect; + RECT16 rect; HDC hdcMem; HBITMAP hbitmap; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -417,7 +447,7 @@ void NC_DrawSysButton( HWND hwnd, HDC hdc, BOOL down ) */ static void NC_DrawMaxButton( HWND hwnd, HDC hdc, BOOL down ) { - RECT rect; + RECT16 rect; NC_GetInsideRect( hwnd, &rect ); GRAPH_DrawBitmap( hdc, (IsZoomed(hwnd) ? (down ? hbitmapRestoreD : hbitmapRestore) : @@ -432,7 +462,7 @@ static void NC_DrawMaxButton( HWND hwnd, HDC hdc, BOOL down ) */ static void NC_DrawMinButton( HWND hwnd, HDC hdc, BOOL down ) { - RECT rect; + RECT16 rect; WND *wndPtr = WIN_FindWndPtr( hwnd ); NC_GetInsideRect( hwnd, &rect ); if (wndPtr->dwStyle & WS_MAXIMIZEBOX) rect.right -= SYSMETRICS_CXSIZE + 1; @@ -448,7 +478,7 @@ static void NC_DrawMinButton( HWND hwnd, HDC hdc, BOOL down ) * Draw a window frame inside the given rectangle, and update the rectangle. * The correct pen for the frame must be selected in the DC. */ -static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, BOOL active ) +static void NC_DrawFrame( HDC hdc, RECT16 *rect, BOOL dlgFrame, BOOL active ) { short width, height, tmp; @@ -479,7 +509,7 @@ static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, BOOL active ) if (dlgFrame) { - InflateRect( rect, -width, -height ); + InflateRect16( rect, -width, -height ); return; } @@ -515,7 +545,7 @@ static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, BOOL active ) MoveTo( hdc, tmp, rect->bottom-height-1 ); LineTo( hdc, tmp, rect->bottom-1 ); - InflateRect( rect, -width-1, -height-1 ); + InflateRect16( rect, -width-1, -height-1 ); } @@ -524,7 +554,7 @@ static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame, BOOL active ) * * Draw the frame used when moving or resizing window. */ -static void NC_DrawMovingFrame( HDC hdc, RECT *rect, BOOL thickframe ) +static void NC_DrawMovingFrame( HDC hdc, RECT16 *rect, BOOL thickframe ) { if (thickframe) { @@ -541,7 +571,7 @@ static void NC_DrawMovingFrame( HDC hdc, RECT *rect, BOOL thickframe ) PatBlt( hdc, rect->right, rect->top, -SYSMETRICS_CXFRAME, rect->bottom - rect->top - SYSMETRICS_CYFRAME, PATINVERT ); } - else DrawFocusRect( hdc, rect ); + else DrawFocusRect16( hdc, rect ); } @@ -551,10 +581,10 @@ static void NC_DrawMovingFrame( HDC hdc, RECT *rect, BOOL thickframe ) * Draw the window caption. * The correct pen for the window frame must be selected in the DC. */ -static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, +static void NC_DrawCaption( HDC hdc, RECT16 *rect, HWND hwnd, DWORD style, BOOL active ) { - RECT r = *rect; + RECT16 r = *rect; WND * wndPtr = WIN_FindWndPtr( hwnd ); char buffer[256]; @@ -602,15 +632,16 @@ static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, r.right -= SYSMETRICS_CXSIZE + 1; } - FillRect( hdc, &r, active ? sysColorObjects.hbrushActiveCaption : - sysColorObjects.hbrushInactiveCaption ); + FillRect16( hdc, &r, active ? sysColorObjects.hbrushActiveCaption : + sysColorObjects.hbrushInactiveCaption ); if (GetWindowText( hwnd, buffer, 256 )) { if (active) SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) ); else SetTextColor( hdc, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) ); SetBkMode( hdc, TRANSPARENT ); - DrawText( hdc, buffer, -1, &r, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + DrawText16( hdc, buffer, -1, &r, + DT_SINGLELINE | DT_CENTER | DT_VCENTER ); } } @@ -623,7 +654,7 @@ static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) { HDC hdc; - RECT rect; + RECT16 rect; BOOL active; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -685,7 +716,7 @@ void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) LineTo( hdc, rect.right-1, rect.bottom-1 ); LineTo( hdc, 0, rect.bottom-1 ); LineTo( hdc, 0, 0 ); - InflateRect( &rect, -1, -1 ); + InflateRect16( &rect, -1, -1 ); } if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle )) @@ -695,7 +726,7 @@ void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) { - RECT r = rect; + RECT16 r = rect; r.bottom = rect.top + SYSMETRICS_CYSIZE; rect.top += SYSMETRICS_CYSIZE + SYSMETRICS_CYBORDER; NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active ); @@ -704,7 +735,7 @@ void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) if (HAS_MENU(wndPtr)) { - RECT r = rect; + RECT16 r = rect; r.bottom = rect.top + SYSMETRICS_CYMENU; /* default height */ rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ); } @@ -718,10 +749,10 @@ void NC_DoNCPaint( HWND hwnd, HRGN clip, BOOL suppress_menupaint ) if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->dwStyle & WS_HSCROLL)) { - RECT r = rect; + RECT16 r = rect; r.left = r.right - SYSMETRICS_CXVSCROLL + 1; r.top = r.bottom - SYSMETRICS_CYHSCROLL + 1; - FillRect( hdc, &r, sysColorObjects.hbrushScrollbar ); + FillRect16( hdc, &r, sysColorObjects.hbrushScrollbar ); } ReleaseDC( hwnd, hdc ); @@ -817,9 +848,9 @@ LONG NC_HandleSetCursor( HWND hwnd, WPARAM wParam, LPARAM lParam ) * * Track a mouse button press on the system menu. */ -static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt ) +static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT16 pt ) { - RECT rect; + RECT16 rect; WND *wndPtr = WIN_FindWndPtr( hwnd ); int iconic = wndPtr->dwStyle & WS_MINIMIZE; @@ -830,14 +861,14 @@ static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt ) { /* Otherwise track the system menu like a normal popup menu */ NC_GetInsideRect( hwnd, &rect ); - OffsetRect( &rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top ); + OffsetRect16( &rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top ); if (wndPtr->dwStyle & WS_CHILD) - ClientToScreen( wndPtr->parent->hwndSelf, (POINT *)&rect ); + ClientToScreen16( wndPtr->parent->hwndSelf, (POINT16 *)&rect ); rect.right = rect.left + SYSMETRICS_CXSIZE; rect.bottom = rect.top + SYSMETRICS_CYSIZE; if (!iconic) NC_DrawSysButton( hwnd, hdc, TRUE ); - TrackPopupMenu( wndPtr->hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, - rect.left, rect.bottom, 0, hwnd, &rect ); + TrackPopupMenu16( wndPtr->hSysMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, + rect.left, rect.bottom, 0, hwnd, &rect ); if (!iconic) NC_DrawSysButton( hwnd, hdc, FALSE ); } } @@ -849,17 +880,17 @@ static void NC_TrackSysMenu( HWND hwnd, HDC hdc, POINT pt ) * Initialisation of a move or resize, when initiatied from a menu choice. * Return hit test code for caption or sizing border. */ -static LONG NC_StartSizeMove( HWND hwnd, WPARAM wParam, POINT *capturePoint ) +static LONG NC_StartSizeMove( HWND hwnd, WPARAM wParam, POINT16 *capturePoint ) { LONG hittest = 0; - POINT pt; + POINT16 pt; MSG msg; WND * wndPtr = WIN_FindWndPtr( hwnd ); if ((wParam & 0xfff0) == SC_MOVE) { /* Move pointer at the center of the caption */ - RECT rect; + RECT16 rect; NC_GetInsideRect( hwnd, &rect ); if (wndPtr->dwStyle & WS_SYSMENU) rect.left += SYSMETRICS_CXSIZE + 1; @@ -870,7 +901,7 @@ static LONG NC_StartSizeMove( HWND hwnd, WPARAM wParam, POINT *capturePoint ) pt.x = wndPtr->rectWindow.left + (rect.right - rect.left) / 2; pt.y = wndPtr->rectWindow.top + rect.top + SYSMETRICS_CYSIZE/2; if (wndPtr->dwStyle & WS_CHILD) - ClientToScreen( wndPtr->parent->hwndSelf, &pt ); + ClientToScreen16( wndPtr->parent->hwndSelf, &pt ); hittest = HTCAPTION; } else /* SC_SIZE */ @@ -932,14 +963,14 @@ static LONG NC_StartSizeMove( HWND hwnd, WPARAM wParam, POINT *capturePoint ) * * Perform SC_MOVE and SC_SIZE commands. */ -static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt ) +static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT16 pt ) { MSG msg; LONG hittest; - RECT sizingRect, mouseRect; + RECT16 sizingRect, mouseRect; HDC hdc; BOOL thickframe; - POINT minTrack, maxTrack, capturePoint = pt; + POINT16 minTrack, maxTrack, capturePoint = pt; WND * wndPtr = WIN_FindWndPtr( hwnd ); int moved = 0; @@ -975,8 +1006,8 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt ) NC_GetMinMaxInfo( hwnd, NULL, NULL, &minTrack, &maxTrack ); sizingRect = wndPtr->rectWindow; if (wndPtr->dwStyle & WS_CHILD) - GetClientRect( wndPtr->parent->hwndSelf, &mouseRect ); - else SetRect( &mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN ); + GetClientRect16( wndPtr->parent->hwndSelf, &mouseRect ); + else SetRect16(&mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN); if (ON_LEFT_BORDER(hittest)) { mouseRect.left = MAX( mouseRect.left, sizingRect.right-maxTrack.x ); @@ -1029,8 +1060,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt ) pt = msg.pt; if (wndPtr->dwStyle & WS_CHILD) - ScreenToClient( wndPtr->parent->hwndSelf, &pt ); - + ScreenToClient16( wndPtr->parent->hwndSelf, &pt ); if (msg.message == WM_KEYDOWN) switch(msg.wParam) { @@ -1054,9 +1084,9 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam, POINT pt ) if (msg.message == WM_KEYDOWN) SetCursorPos( pt.x, pt.y ); else { - RECT newRect = sizingRect; + RECT16 newRect = sizingRect; - if (hittest == HTCAPTION) OffsetRect( &newRect, dx, dy ); + if (hittest == HTCAPTION) OffsetRect16( &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; @@ -1150,9 +1180,9 @@ static void NC_TrackMinMaxBox( HWND hwnd, WORD wParam ) * * Track a mouse button press on the horizontal or vertical scroll-bar. */ -static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) +static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT16 pt ) { - MSG msg; + MSG *msg; WORD scrollbar; WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -1167,6 +1197,7 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) scrollbar = SB_VERT; } + if (!(msg = SEGPTR_NEW(MSG))) return; pt.x -= wndPtr->rectWindow.left; pt.y -= wndPtr->rectWindow.top; SetCapture( hwnd ); @@ -1174,21 +1205,21 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) do { - GetMessage( MAKE_SEGPTR(&msg), 0, 0, 0 ); - switch(msg.message) + GetMessage( SEGPTR_GET(msg), 0, 0, 0 ); + switch(msg->message) { case WM_LBUTTONUP: case WM_MOUSEMOVE: case WM_SYSTIMER: - pt.x = LOWORD(msg.lParam) + wndPtr->rectClient.left - + pt.x = LOWORD(msg->lParam) + wndPtr->rectClient.left - wndPtr->rectWindow.left; - pt.y = HIWORD(msg.lParam) + wndPtr->rectClient.top - + pt.y = HIWORD(msg->lParam) + wndPtr->rectClient.top - wndPtr->rectWindow.top; - SCROLL_HandleScrollEvent( hwnd, scrollbar, msg.message, pt ); + SCROLL_HandleScrollEvent( hwnd, scrollbar, msg->message, pt ); break; default: - TranslateMessage( &msg ); - DispatchMessage( &msg ); + TranslateMessage( msg ); + DispatchMessage( msg ); break; } if (!IsWindow( hwnd )) @@ -1196,7 +1227,8 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) ReleaseCapture(); break; } - } while (msg.message != WM_LBUTTONUP); + } while (msg->message != WM_LBUTTONUP); + SEGPTR_FREE(msg); } /*********************************************************************** @@ -1207,7 +1239,6 @@ static void NC_TrackScrollBar( HWND hwnd, WORD wParam, POINT pt ) LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) { HDC hdc = GetWindowDC( hwnd ); - POINT pt = { LOWORD(lParam), HIWORD(lParam) }; switch(wParam) /* Hit test */ { @@ -1216,7 +1247,7 @@ LONG NC_HandleNCLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam ) break; case HTSYSMENU: - NC_TrackSysMenu( hwnd, hdc, pt ); + NC_TrackSysMenu( hwnd, hdc, MAKEPOINT16(lParam) ); break; case HTMENU: @@ -1297,7 +1328,7 @@ LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM wParam, LPARAM lParam ) * * Handle a WM_SYSCOMMAND message. Called from DefWindowProc(). */ -LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt ) +LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT16 pt ) { WND *wndPtr = WIN_FindWndPtr( hwnd ); @@ -1305,7 +1336,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt ) wParam, pt.x, pt.y ); if (wndPtr->dwStyle & WS_CHILD && wParam != SC_KEYMENU ) - ScreenToClient( wndPtr->parent->hwndSelf, &pt ); + ScreenToClient16( wndPtr->parent->hwndSelf, &pt ); switch (wParam & 0xfff0) { diff --git a/windows/painting.c b/windows/painting.c index 93565235898..15eb8ad3301 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -23,7 +23,7 @@ */ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate) { - POINT pt = {0, 0}; + POINT16 pt = {0, 0}; HRGN hClip = 1; dprintf_nonclient(stddeb,"NCUpdate: hwnd %04x, hrgnUpdate %04x\n", @@ -38,7 +38,7 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate) if( wnd->hrgnUpdate > 1 ) { - ClientToScreen(wnd->hwndSelf, &pt); + ClientToScreen16(wnd->hwndSelf, &pt); hClip = CreateRectRgn( 0, 0, 0, 0 ); if (!CombineRgn(hClip, wnd->hrgnUpdate, 0, RGN_COPY) ) @@ -83,9 +83,9 @@ void WIN_UpdateNCArea(WND* wnd, BOOL bUpdate) /*********************************************************************** - * BeginPaint (USER.39) + * BeginPaint16 (USER.39) */ -HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps ) +HDC16 BeginPaint16( HWND16 hwnd, LPPAINTSTRUCT16 lps ) { HRGN hrgnUpdate; WND * wndPtr = WIN_FindWndPtr( hwnd ); @@ -113,8 +113,8 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps ) return 0; } - GetRgnBox( InquireVisRgn(lps->hdc), &lps->rcPaint ); - DPtoLP( lps->hdc, (LPPOINT)&lps->rcPaint, 2 ); + GetRgnBox16( InquireVisRgn(lps->hdc), &lps->rcPaint ); + DPtoLP16( lps->hdc, (LPPOINT16)&lps->rcPaint, 2 ); if (wndPtr->flags & WIN_NEEDS_ERASEBKGND) { @@ -128,9 +128,29 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps ) /*********************************************************************** - * EndPaint (USER.40) + * BeginPaint32 (USER32.9) */ -BOOL EndPaint( HWND hwnd, const PAINTSTRUCT* lps ) +HDC32 BeginPaint32( HWND32 hwnd, PAINTSTRUCT32 *lps ) +{ + PAINTSTRUCT16 ps; + + BeginPaint16( hwnd, &ps ); + lps->hdc = (HDC32)ps.hdc; + lps->fErase = ps.fErase; + lps->rcPaint.top = ps.rcPaint.top; + lps->rcPaint.left = ps.rcPaint.left; + lps->rcPaint.right = ps.rcPaint.right; + lps->rcPaint.bottom = ps.rcPaint.bottom; + lps->fRestore = ps.fRestore; + lps->fIncUpdate = ps.fIncUpdate; + return lps->hdc; +} + + +/*********************************************************************** + * EndPaint16 (USER.40) + */ +BOOL16 EndPaint16( HWND16 hwnd, const PAINTSTRUCT16* lps ) { ReleaseDC( hwnd, lps->hdc ); ShowCaret( hwnd ); @@ -138,14 +158,25 @@ BOOL EndPaint( HWND hwnd, const PAINTSTRUCT* lps ) } +/*********************************************************************** + * EndPaint32 (USER32.175) + */ +BOOL32 EndPaint32( HWND32 hwnd, const PAINTSTRUCT32 *lps ) +{ + ReleaseDC( hwnd, (HDC16)lps->hdc ); + ShowCaret( hwnd ); + return TRUE; +} + + /*********************************************************************** * FillWindow (USER.324) */ -void FillWindow( HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush ) +void FillWindow( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, HBRUSH16 hbrush ) { - RECT rect; - GetClientRect( hwnd, &rect ); - DPtoLP( hdc, (LPPOINT)&rect, 2 ); + RECT16 rect; + GetClientRect16( hwnd, &rect ); + DPtoLP16( hdc, (LPPOINT16)&rect, 2 ); PaintRect( hwndParent, hwnd, hdc, hbrush, &rect ); } @@ -153,7 +184,8 @@ void FillWindow( HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush ) /*********************************************************************** * PaintRect (USER.325) */ -void PaintRect(HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush, LPRECT rect) +void PaintRect( HWND16 hwndParent, HWND16 hwnd, HDC16 hdc, + HBRUSH16 hbrush, const RECT16 *rect) { /* Send WM_CTLCOLOR message if needed */ @@ -169,7 +201,7 @@ void PaintRect(HWND hwndParent, HWND hwnd, HDC hdc, HBRUSH hbrush, LPRECT rect) hdc, MAKELONG( hwnd, hbrush ) ); #endif } - if (hbrush) FillRect( hdc, rect, hbrush ); + if (hbrush) FillRect16( hdc, rect, hbrush ); } @@ -189,12 +221,13 @@ HBRUSH GetControlBrush( HWND hwnd, HDC hdc, WORD control ) /*********************************************************************** - * RedrawWindow (USER.290) + * RedrawWindow32 (USER32.425) */ -BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) +BOOL32 RedrawWindow32( HWND32 hwnd, const RECT32 *rectUpdate, + HRGN32 hrgnUpdate, UINT32 flags ) { HRGN hrgn; - RECT rectClient; + RECT32 rectClient; WND * wndPtr; if (!hwnd) hwnd = GetDesktopWindow(); @@ -213,7 +246,7 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) dprintf_win(stddeb, "RedrawWindow: %04x NULL %04x flags=%04x\n", hwnd, hrgnUpdate, flags); } - GetClientRect( hwnd, &rectClient ); + GetClientRect32( hwnd, &rectClient ); if (flags & RDW_INVALIDATE) /* Invalidate */ { @@ -222,8 +255,8 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) if (wndPtr->hrgnUpdate > 1) /* Is there already an update region? */ { if ((hrgn = hrgnUpdate) == 0) - hrgn = CreateRectRgnIndirect( rectUpdate ? rectUpdate : - &rectClient ); + hrgn = CreateRectRgnIndirect32( rectUpdate ? rectUpdate : + &rectClient ); rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate, hrgn, RGN_OR ); if (!hrgnUpdate) DeleteObject( hrgn ); } @@ -236,7 +269,7 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) wndPtr->hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 ); rgnNotEmpty = CombineRgn( wndPtr->hrgnUpdate, hrgnUpdate, 0, RGN_COPY ); } - else wndPtr->hrgnUpdate = CreateRectRgnIndirect( rectUpdate ? + else wndPtr->hrgnUpdate = CreateRectRgnIndirect32( rectUpdate ? rectUpdate : &rectClient ); } @@ -269,7 +302,7 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) else { if ((hrgn = hrgnUpdate) == 0) - hrgn = CreateRectRgnIndirect( rectUpdate ); + hrgn = CreateRectRgnIndirect32( rectUpdate ); if (CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate, hrgn, RGN_DIFF ) == NULLREGION) { @@ -345,23 +378,23 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) CombineRgn( hrgn, hrgnUpdate, 0, RGN_COPY ); OffsetRgn( hrgn, -wndPtr->rectClient.left, -wndPtr->rectClient.top ); - RedrawWindow( wndPtr->hwndSelf, NULL, hrgn, flags ); + RedrawWindow32( wndPtr->hwndSelf, NULL, hrgn, flags ); } DeleteObject( hrgn ); } else { - RECT rect; + RECT32 rect; for (wndPtr = wndPtr->child; wndPtr; wndPtr = wndPtr->next) { if (rectUpdate) { rect = *rectUpdate; - OffsetRect( &rect, -wndPtr->rectClient.left, - -wndPtr->rectClient.top ); - RedrawWindow( wndPtr->hwndSelf, &rect, 0, flags ); + OffsetRect32( &rect, -wndPtr->rectClient.left, + -wndPtr->rectClient.top ); + RedrawWindow32( wndPtr->hwndSelf, &rect, 0, flags ); } - else RedrawWindow( wndPtr->hwndSelf, NULL, 0, flags ); + else RedrawWindow32( wndPtr->hwndSelf, NULL, 0, flags ); } } } @@ -370,54 +403,103 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags ) /*********************************************************************** - * UpdateWindow (USER.124) + * RedrawWindow16 (USER.290) */ -void UpdateWindow( HWND hwnd ) +BOOL16 RedrawWindow16( HWND16 hwnd, const RECT16 *rectUpdate, + HRGN16 hrgnUpdate, UINT16 flags ) { - RedrawWindow( hwnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN ); + if (rectUpdate) + { + RECT32 r; + CONV_RECT16TO32( rectUpdate, &r ); + return (BOOL16)RedrawWindow32( (HWND32)hwnd, &r, hrgnUpdate, flags ); + } + return (BOOL16)RedrawWindow32( (HWND32)hwnd, NULL, hrgnUpdate, flags ); } /*********************************************************************** - * InvalidateRgn (USER.126) + * UpdateWindow (USER.124) (USER32.566) */ -void InvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase ) +void UpdateWindow( HWND32 hwnd ) { - RedrawWindow( hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) ); + RedrawWindow32( hwnd, NULL, 0, RDW_UPDATENOW | RDW_NOCHILDREN ); } /*********************************************************************** - * InvalidateRect (USER.125) + * InvalidateRgn (USER.126) (USER32.328) */ -void InvalidateRect( HWND hwnd, LPRECT rect, BOOL erase ) +void InvalidateRgn( HWND32 hwnd, HRGN32 hrgn, BOOL32 erase ) { - RedrawWindow( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) ); + RedrawWindow32(hwnd, NULL, hrgn, RDW_INVALIDATE | (erase ? RDW_ERASE : 0)); } /*********************************************************************** - * ValidateRgn (USER.128) + * InvalidateRect16 (USER.125) */ -void ValidateRgn( HWND hwnd, HRGN hrgn ) +void InvalidateRect16( HWND16 hwnd, const RECT16 *rect, BOOL16 erase ) { - RedrawWindow( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN ); + RedrawWindow16( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) ); } /*********************************************************************** - * ValidateRect (USER.127) + * InvalidateRect32 (USER32.327) */ -void ValidateRect( HWND hwnd, LPRECT rect ) +void InvalidateRect32( HWND32 hwnd, const RECT32 *rect, BOOL32 erase ) { - RedrawWindow( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN ); + RedrawWindow32( hwnd, rect, 0, RDW_INVALIDATE | (erase ? RDW_ERASE : 0) ); } /*********************************************************************** - * GetUpdateRect (USER.190) + * ValidateRgn (USER.128) (USER32.571) */ -BOOL GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase ) +void ValidateRgn( HWND32 hwnd, HRGN32 hrgn ) +{ + RedrawWindow32( hwnd, NULL, hrgn, RDW_VALIDATE | RDW_NOCHILDREN ); +} + + +/*********************************************************************** + * ValidateRect16 (USER.127) + */ +void ValidateRect16( HWND16 hwnd, const RECT16 *rect ) +{ + RedrawWindow16( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN ); +} + + +/*********************************************************************** + * ValidateRect32 (USER32.570) + */ +void ValidateRect32( HWND32 hwnd, const RECT32 *rect ) +{ + RedrawWindow32( hwnd, rect, 0, RDW_VALIDATE | RDW_NOCHILDREN ); +} + + +/*********************************************************************** + * GetUpdateRect16 (USER.190) + */ +BOOL16 GetUpdateRect16( HWND16 hwnd, LPRECT16 rect, BOOL16 erase ) +{ + RECT32 r; + BOOL16 ret; + + if (!rect) return GetUpdateRect32( hwnd, NULL, erase ); + ret = GetUpdateRect32( hwnd, &r, erase ); + CONV_RECT32TO16( &r, rect ); + return ret; +} + + +/*********************************************************************** + * GetUpdateRect32 (USER32.296) + */ +BOOL32 GetUpdateRect32( HWND32 hwnd, LPRECT32 rect, BOOL32 erase ) { WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return FALSE; @@ -428,21 +510,21 @@ BOOL GetUpdateRect( HWND hwnd, LPRECT rect, BOOL erase ) { HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 ); if (GetUpdateRgn( hwnd, hrgn, erase ) == ERROR) return FALSE; - GetRgnBox( hrgn, rect ); + GetRgnBox32( hrgn, rect ); DeleteObject( hrgn ); } - else SetRectEmpty( rect ); + else SetRectEmpty32( rect ); } return (wndPtr->hrgnUpdate > 1); } /*********************************************************************** - * GetUpdateRgn (USER.237) + * GetUpdateRgn (USER.237) (USER32.297) */ -int GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ) +INT16 GetUpdateRgn( HWND32 hwnd, HRGN32 hrgn, BOOL32 erase ) { - int retval; + INT16 retval; WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return ERROR; @@ -452,17 +534,17 @@ int GetUpdateRgn( HWND hwnd, HRGN hrgn, BOOL erase ) return NULLREGION; } retval = CombineRgn( hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY ); - if (erase) RedrawWindow( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN ); + if (erase) RedrawWindow32( hwnd, NULL, 0, RDW_ERASENOW | RDW_NOCHILDREN ); return retval; } /*********************************************************************** - * ExcludeUpdateRgn (USER.238) + * ExcludeUpdateRgn (USER.238) (USER32.194) */ -int ExcludeUpdateRgn( HDC hdc, HWND hwnd ) +INT16 ExcludeUpdateRgn( HDC32 hdc, HWND32 hwnd ) { - int retval = ERROR; + INT16 retval = ERROR; HRGN hrgn; WND * wndPtr; diff --git a/windows/queue.c b/windows/queue.c index c874f39e2d1..5935bac6efa 100644 --- a/windows/queue.c +++ b/windows/queue.c @@ -15,8 +15,20 @@ static HQUEUE hFirstQueue = 0; static HQUEUE hmemSysMsgQueue = 0; +static HQUEUE hDoomedQueue = 0; static MESSAGEQUEUE *sysMsgQueue = NULL; +/*********************************************************************** + * QUEUE_GetDoomedQueue/QUEUE_SetDoomedQueue + */ +HQUEUE QUEUE_GetDoomedQueue() +{ + return hDoomedQueue; +} +void QUEUE_SetDoomedQueue(HQUEUE hQueue) +{ + hDoomedQueue = hQueue; +} /*********************************************************************** * QUEUE_DumpQueue @@ -202,7 +214,7 @@ int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND hwnd, int first, int last ) { int i, pos = msgQueue->nextMessage; - dprintf_msg(stddeb,"MSG_FindMsg: hwnd=%04x\n\n", hwnd ); + dprintf_msg(stddeb,"QUEUE_FindMsg: hwnd=%04x pos=%d\n", hwnd, pos ); if (!msgQueue->msgCount) return -1; if (!hwnd && !first && !last) return pos; diff --git a/windows/scroll.c b/windows/scroll.c index 4259dbf76c6..55690939d9e 100644 --- a/windows/scroll.c +++ b/windows/scroll.c @@ -43,13 +43,13 @@ HRGN SCROLL_TraceChildren( HWND hScroll, short dx, short dy, WORD dcx) if( !wndScroll || ( !dx && !dy) ) return 0; if( dcx & DCX_WINDOW ) - hRgnWnd = CreateRectRgnIndirect(&wndScroll->rectWindow); + hRgnWnd = CreateRectRgnIndirect16(&wndScroll->rectWindow); else { - RECT rect; + RECT32 rect; - GetClientRect(hScroll,&rect); - hRgnWnd = CreateRectRgnIndirect(&rect); + GetClientRect32(hScroll,&rect); + hRgnWnd = CreateRectRgnIndirect32(&rect); } hUpdateRgn = DCE_GetVisRgn( hScroll, dcx ); @@ -101,7 +101,7 @@ BOOL SCROLL_ScrollChildren( HWND hScroll, short dx, short dy) } /* invalidate uncovered region and paint frames */ - b = RedrawWindow( hScroll, NULL, hUpdateRgn, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | + b = RedrawWindow32( hScroll, NULL, hUpdateRgn, RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW | RDW_ALLCHILDREN ); DeleteObject( hUpdateRgn); @@ -115,11 +115,11 @@ BOOL SCROLL_ScrollChildren( HWND hScroll, short dx, short dy) * FIXME: a bit broken */ -void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) +void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect) { HDC hdc; HRGN hrgnUpdate,hrgnClip; - RECT rc, cliprc; + RECT16 rc, cliprc; HWND hCaretWnd = CARET_GetHwnd(); dprintf_scroll(stddeb,"ScrollWindow: dx=%d, dy=%d, lpRect =%08lx clipRect=%i,%i,%i,%i\n", @@ -131,8 +131,8 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) /* if rect is NULL children have to be moved */ if ( !rect ) { - GetClientRect(hwnd, &rc); - hrgnClip = CreateRectRgnIndirect( &rc ); + GetClientRect16(hwnd, &rc); + hrgnClip = CreateRectRgnIndirect16( &rc ); if ((hCaretWnd == hwnd) || IsChild(hwnd,hCaretWnd)) HideCaret(hCaretWnd); @@ -144,7 +144,7 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) } else { - GetClientRect(hwnd,&rc); + GetClientRect16(hwnd,&rc); dprintf_scroll(stddeb,"\trect=%i %i %i %i client=%i %i %i %i\n", (int)rect->left,(int)rect->top,(int)rect->right, (int)rect->bottom,(int)rc.left,(int)rc.top, @@ -152,14 +152,14 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) if (hCaretWnd == hwnd) HideCaret(hCaretWnd); else hCaretWnd = 0; - CopyRect(&rc, rect); + CopyRect16(&rc, rect); hdc = GetDC(hwnd); } if (clipRect == NULL) - GetClientRect(hwnd, &cliprc); + GetClientRect16(hwnd, &cliprc); else - CopyRect(&cliprc, clipRect); + CopyRect16(&cliprc, clipRect); hrgnUpdate = CreateRectRgn(0, 0, 0, 0); ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, NULL); @@ -181,7 +181,7 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) DeleteObject(hrgnInv); } - RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW); + RedrawWindow32( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW); } DeleteObject(hrgnUpdate); @@ -195,24 +195,30 @@ void ScrollWindow(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect) * FIXME: half-broken */ -BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, - HRGN hrgnUpdate, LPRECT rcUpdate) +BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT16 rc, LPRECT16 cliprc, + HRGN hrgnUpdate, LPRECT16 rcUpdate) { - HRGN hrgnClip, hrgn1, hrgn2; - POINT src, dest; + HRGN hrgnClip; + POINT16 src, dest; short width, height; DC *dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC); - dprintf_scroll(stddeb,"ScrollDC: dx=%d dy=%d, hrgnUpdate=%04x rc=%d %d %d %d\n", - dx,dy,hrgnUpdate,((rc)?rc->left:0), ((rc)?rc->top:0), - ((rc)?rc->right:0), ((rc)?rc->bottom:0)); + dprintf_scroll(stddeb,"ScrollDC: dx=%d dy=%d, hrgnUpdate=%04x rcUpdate = %p cliprc = %p, rc=%d %d %d %d\n", + dx, dy, hrgnUpdate, rcUpdate, cliprc, rc ? rc->left : 0, + rc ? rc->top : 0, rc ? rc->right : 0, rc ? rc->bottom : 0 ); if (rc == NULL) return FALSE; + if (!dc) + { + fprintf(stdnimp,"ScrollDC: Invalid HDC\n"); + return FALSE; + } + if (cliprc) { - hrgnClip = CreateRectRgnIndirect(cliprc); + hrgnClip = CreateRectRgnIndirect16(cliprc); SelectClipRgn(hdc, hrgnClip); } @@ -246,6 +252,8 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, if (hrgnUpdate) { + HRGN hrgn1,hrgn2; + if (dx > 0) hrgn1 = CreateRectRgn(rc->left, rc->top, rc->left+dx, rc->bottom); else if (dx < 0) @@ -265,9 +273,24 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, RgnType = CombineRgn(hrgnUpdate, hrgn1, hrgn2, RGN_OR); DeleteObject(hrgn1); DeleteObject(hrgn2); + if (rcUpdate) GetRgnBox16( hrgnUpdate, rcUpdate ); + } + else if (rcUpdate) + { + RECT16 rx,ry; + + rx = ry = *rc; + if( dx > 0 ) rx.right = rc->left+dx; + else if (dx < 0) rx.left = rc->right+dx; + else SetRectEmpty16( &rx ); + + if( dy > 0 ) ry.bottom = rc->top+dy; + else if (dy < 0) ry.top = rc->bottom+dy; + else SetRectEmpty16( &ry ); + + UnionRect16( rcUpdate, &rx, &ry ); } - if (rcUpdate) GetRgnBox( hrgnUpdate, rcUpdate ); return TRUE; } @@ -280,31 +303,31 @@ BOOL ScrollDC(HDC hdc, short dx, short dy, LPRECT rc, LPRECT cliprc, * SCROLL_TraceChildren can help */ -int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT rect, LPRECT clipRect, - HRGN hrgnUpdate, LPRECT rcUpdate, WORD flags) +int ScrollWindowEx(HWND hwnd, short dx, short dy, LPRECT16 rect, LPRECT16 clipRect, + HRGN hrgnUpdate, LPRECT16 rcUpdate, WORD flags) { HDC hdc; - RECT rc, cliprc; + RECT16 rc, cliprc; dprintf_scroll(stddeb,"ScrollWindowEx: dx=%d, dy=%d, wFlags=%04x\n",dx, dy, flags); hdc = GetDC(hwnd); if (rect == NULL) - GetClientRect(hwnd, &rc); + GetClientRect16(hwnd, &rc); else - CopyRect(&rc, rect); + CopyRect16(&rc, rect); if (clipRect == NULL) - GetClientRect(hwnd, &cliprc); + GetClientRect16(hwnd, &cliprc); else - CopyRect(&cliprc, clipRect); + CopyRect16(&cliprc, clipRect); ScrollDC(hdc, dx, dy, &rc, &cliprc, hrgnUpdate, rcUpdate); if (flags | SW_INVALIDATE) { - RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | - ((flags & SW_ERASE) ? RDW_ERASENOW : 0)); + RedrawWindow32( hwnd, NULL, hrgnUpdate, RDW_INVALIDATE | RDW_ERASE | + ((flags & SW_ERASE) ? RDW_ERASENOW : 0)); } ReleaseDC(hwnd, hdc); diff --git a/windows/win.c b/windows/win.c index e9fbaa03edd..5dfb1056c3e 100644 --- a/windows/win.c +++ b/windows/win.c @@ -10,13 +10,17 @@ #include "options.h" #include "class.h" #include "win.h" +#include "heap.h" #include "user.h" #include "dce.h" #include "sysmetrics.h" #include "cursoricon.h" #include "event.h" +#include "heap.h" +#include "hook.h" #include "menu.h" #include "nonclient.h" +#include "string32.h" #include "queue.h" #include "winpos.h" #include "color.h" @@ -37,6 +41,7 @@ static WORD wDragWidth = 4; static WORD wDragHeight= 3; extern HCURSOR CURSORICON_IconToCursor(HICON); +extern HQUEUE QUEUE_GetDoomedQueue(); /*********************************************************************** * WIN_FindWndPtr @@ -77,7 +82,7 @@ void WIN_DumpWindow( HWND hwnd ) return; } - if (!GetClassName( hwnd, className, sizeof(className ) )) + if (!GetClassName32A( hwnd, className, sizeof(className ) )) strcpy( className, "#NULL#" ); fprintf( stderr, "Window %04x (%p):\n", hwnd, ptr ); @@ -134,7 +139,7 @@ void WIN_WalkWindows( HWND hwnd, int indent ) { fprintf(stderr, "%*s%04x%*s", indent, "", ptr->hwndSelf, 13-indent,""); - GlobalGetAtomName( ptr->class->atomName, className, sizeof(className)); + GlobalGetAtomName16(ptr->class->atomName,className,sizeof(className)); fprintf( stderr, "%08lx %-6.4x %-17.17s %08x %04x:%04x\n", (DWORD)ptr, ptr->hmemTaskQ, className, @@ -262,14 +267,14 @@ HWND WIN_FindWinToRepaint( HWND hwnd, HQUEUE hQueue ) */ void WIN_SendParentNotify( HWND hwnd, WORD event, WORD idChild, LONG lValue ) { - LPPOINT lppt = (LPPOINT)(void*)(&lValue); + LPPOINT16 lppt = (LPPOINT16)&lValue; WND *wndPtr = WIN_FindWndPtr( hwnd ); BOOL bMouse = ((event <= WM_MOUSELAST) && (event >= WM_MOUSEFIRST)); /* if lValue contains cursor coordinates they have to be * mapped to the client area of parent window */ - if (bMouse) MapWindowPoints(0, hwnd, lppt, 1); + if (bMouse) MapWindowPoints16(0, hwnd, lppt, 1); #ifndef WINELIB32 else lValue = MAKELONG( LOWORD(lValue), idChild ); #endif @@ -359,7 +364,7 @@ BOOL WIN_CreateDesktopWindow(void) HDC hdc; HWND hwndDesktop; - if (!(class = CLASS_FindClassByName( DESKTOP_CLASS_ATOM, 0 ))) + if (!(class = CLASS_FindClassByAtom( DESKTOP_CLASS_ATOM, 0 ))) return FALSE; hwndDesktop = USER_HEAP_ALLOC( sizeof(WND)+class->cbWndExtra ); @@ -412,96 +417,71 @@ BOOL WIN_CreateDesktopWindow(void) /*********************************************************************** - * CreateWindow16 (USER.41) + * WIN_CreateWindowEx + * + * Implementation of CreateWindowEx(). */ -HWND CreateWindow16( SEGPTR className, SEGPTR windowName, - DWORD style, INT16 x, INT16 y, INT16 width, INT16 height, - HWND parent, HMENU menu, HANDLE instance, SEGPTR data ) +static HWND WIN_CreateWindowEx( DWORD exStyle, ATOM classAtom, + SEGPTR windowName, DWORD style, INT16 x, + INT16 y, INT16 width, INT16 height, + HWND parent, HMENU menu, HINSTANCE16 instance, + SEGPTR data ) { - return CreateWindowEx16( 0, className, windowName, style, - x, y, width, height, parent, menu, instance, data ); -} - - -/*********************************************************************** - * CreateWindowEx16 (USER.452) - */ -HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, - DWORD style, INT16 x, INT16 y, INT16 width, INT16 height, - HWND parent, HMENU menu, HANDLE instance, SEGPTR data ) -{ - HANDLE hwnd; CLASS *classPtr; WND *wndPtr; - POINT maxSize, maxPos, minTrack, maxTrack; - CREATESTRUCT createStruct; - int wmcreate; - XSetWindowAttributes win_attr; - Atom XA_WM_DELETE_WINDOW; + HWND16 hwnd; + POINT16 maxSize, maxPos, minTrack, maxTrack; - dprintf_win( stddeb, "CreateWindowEx: " ); - if (HIWORD(windowName)) - dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(windowName) ); - else - dprintf_win( stddeb, "%04x ", LOWORD(windowName) ); - if (HIWORD(className)) - dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(className) ); - else - dprintf_win( stddeb, "%04x ", LOWORD(className) ); - - dprintf_win(stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %04x %08lx\n", - exStyle, style, x, y, width, height, - parent, menu, instance, (DWORD)data); - - if (x == CW_USEDEFAULT16) x = y = 0; - if (width == CW_USEDEFAULT16) - { - width = 600; - height = 400; - } - - /* Find the parent and class */ + /* Find the parent window */ if (parent) { /* Make sure parent is valid */ - if (!IsWindow( parent )) { - dprintf_win(stddeb,"CreateWindowEx: Parent %04x is not a window\n", parent); + if (!IsWindow( parent )) + { + fprintf( stderr, "CreateWindowEx: bad parent %04x\n", parent ); return 0; } } - else + else if (style & WS_CHILD) { - if (style & WS_CHILD) { - dprintf_win(stddeb,"CreateWindowEx: no parent\n"); - return 0; /* WS_CHILD needs a parent */ - } + fprintf( stderr, "CreateWindowEx: no parent for child window\n" ); + return 0; /* WS_CHILD needs a parent */ } - if (!(classPtr = CLASS_FindClassByName( className, GetExePtr(instance) ))) + /* Find the window class */ + + if (!(classPtr = CLASS_FindClassByAtom( classAtom, GetExePtr(instance) ))) { - fprintf(stderr,"CreateWindow BAD CLASSNAME " ); - if (HIWORD(className)) fprintf( stderr, "'%s'\n", - (char *)PTR_SEG_TO_LIN(className) ); - else fprintf( stderr, "%04x\n", LOWORD(className) ); + char buffer[256]; + GlobalGetAtomName32A( classAtom, buffer, sizeof(buffer) ); + fprintf( stderr, "CreateWindowEx: bad class '%s'\n", buffer ); return 0; } - /* Correct the window style */ + /* Fix the coordinates */ - if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */ - style |= WS_CAPTION | WS_CLIPSIBLINGS; - if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME; + if (x == CW_USEDEFAULT16) x = y = 0; + if (width == CW_USEDEFAULT16) + { +/* if (!(style & (WS_CHILD | WS_POPUP))) width = height = 0; + else */ + { + width = 600; + height = 400; + } + } - /* Create the window structure */ + /* Create the window structure */ - hwnd = USER_HEAP_ALLOC( sizeof(WND)+classPtr->cbWndExtra ); - if (!hwnd) { - dprintf_win(stddeb,"CreateWindowEx: Out of memory\n"); + if (!(hwnd = USER_HEAP_ALLOC( sizeof(*wndPtr) + classPtr->cbWndExtra + - sizeof(wndPtr->wExtra) ))) + { + dprintf_win( stddeb, "CreateWindowEx: out of memory\n" ); return 0; } - /* Fill the structure */ + /* Fill the window structure */ wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd ); wndPtr->next = NULL; @@ -531,26 +511,37 @@ HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, wndPtr->hSysMenu = MENU_GetDefSysMenu(); wndPtr->hProp = 0; - if (classPtr->cbWndExtra) - memset( wndPtr->wExtra, 0, classPtr->cbWndExtra ); + if (classPtr->cbWndExtra) memset( wndPtr->wExtra, 0, classPtr->cbWndExtra); + if (classPtr->flags & CLASS_FLAG_UNICODE) wndPtr->flags |= WIN_UNICODE; classPtr->cWindows++; - /* Get class or window DC if needed */ + /* Correct the window style */ + + if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */ + { + wndPtr->dwStyle |= WS_CAPTION | WS_CLIPSIBLINGS; + wndPtr->flags |= WIN_NEED_SIZE; + } + if (exStyle & WS_EX_DLGMODALFRAME) wndPtr->dwStyle &= ~WS_THICKFRAME; + + /* Get class or window DC if needed */ if (classPtr->style & CS_OWNDC) wndPtr->hdce = DCE_AllocDCE(DCE_WINDOW_DC); else if (classPtr->style & CS_CLASSDC) wndPtr->hdce = classPtr->hdce; else wndPtr->hdce = 0; - /* Insert the window in the linked list */ + /* Insert the window in the linked list */ WIN_LinkWindow( hwnd, HWND_TOP ); - /* Send the WM_GETMINMAXINFO message and fix the size if needed */ + /* Send the WM_GETMINMAXINFO message and fix the size if needed */ - NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack ); - - if (maxSize.x < width) width = maxSize.x; - if (maxSize.y < height) height = maxSize.y; + if ((style & WS_THICKFRAME) || !(style & (WS_POPUP | WS_CHILD))) + { + NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack ); + if (maxSize.x < width) width = maxSize.x; + if (maxSize.y < height) height = maxSize.y; + } if (width <= 0) width = 1; if (height <= 0) height = 1; @@ -561,11 +552,14 @@ HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, wndPtr->rectClient = wndPtr->rectWindow; wndPtr->rectNormal = wndPtr->rectWindow; - /* Create the X window (only for top-level windows, and then only */ - /* when there's no desktop window) */ + /* Create the X window (only for top-level windows, and then only */ + /* when there's no desktop window) */ if (!(style & WS_CHILD) && (rootWindow == DefaultRootWindow(display))) { + XSetWindowAttributes win_attr; + Atom XA_WM_DELETE_WINDOW; + if (Options.managed && ((style & (WS_DLGFRAME | WS_THICKFRAME)) || (exStyle & WS_EX_DLGMODALFRAME))) { @@ -594,7 +588,6 @@ HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, CWEventMask | CWOverrideRedirect | CWColormap | CWCursor | CWSaveUnder | CWBackingStore, &win_attr ); - XStoreName( display, wndPtr->window, PTR_SEG_TO_LIN(windowName) ); XA_WM_DELETE_WINDOW = XInternAtom( display, "WM_DELETE_WINDOW", False ); XSetWMProtocols( display, wndPtr->window, &XA_WM_DELETE_WINDOW, 1 ); @@ -603,45 +596,132 @@ HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, Window win = WIN_GetXWindow( parent ); if (win) XSetTransientForHint( display, wndPtr->window, win ); } - EVENT_RegisterWindow( wndPtr->window, hwnd ); } - + + /* Set the window menu */ + if ((style & WS_CAPTION) && !(style & WS_CHILD)) { if (menu) SetMenu(hwnd, menu); - else if (classPtr->lpszMenuName) - SetMenu( hwnd, LoadMenu( instance, classPtr->lpszMenuName ) ); + else + { +#if 0 /* FIXME: should check if classPtr->menuNameW can be used as is */ + if (classPtr->menuNameA) + menu = HIWORD(classPtr->menuNameA) ? + LoadMenu( instance, SEGPTR_GET(classPtr->menuNameA) ) : + LoadMenu( instance, (SEGPTR)classPtr->menuNameA ); +#else + SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME ); + if (menuName) menu = LoadMenu( instance, menuName ); +#endif + } + if (menu) SetMenu( hwnd, menu ); } else wndPtr->wIDmenu = (UINT)menu; + return hwnd; +} + + +/*********************************************************************** + * CreateWindow16 (USER.41) + */ +HWND16 CreateWindow16( SEGPTR className, SEGPTR windowName, + DWORD style, INT16 x, INT16 y, INT16 width, + INT16 height, HWND16 parent, HMENU16 menu, + HINSTANCE16 instance, SEGPTR data ) +{ + return CreateWindowEx16( 0, className, windowName, style, + x, y, width, height, parent, menu, instance, data ); +} + + +/*********************************************************************** + * CreateWindowEx16 (USER.452) + */ +HWND16 CreateWindowEx16( DWORD exStyle, SEGPTR className, SEGPTR windowName, + DWORD style, INT16 x, INT16 y, INT16 width, + INT16 height, HWND16 parent, HMENU16 menu, + HINSTANCE16 instance, SEGPTR data ) +{ + ATOM classAtom; + HWND16 hwnd; + WND *wndPtr; + LRESULT wmcreate; + CREATESTRUCT16 *cs; + + dprintf_win( stddeb, "CreateWindowEx: " ); + if (HIWORD(windowName)) + dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(windowName) ); + else + dprintf_win( stddeb, "%04x ", LOWORD(windowName) ); + if (HIWORD(className)) + dprintf_win( stddeb, "'%s' ", (char *)PTR_SEG_TO_LIN(className) ); + else + dprintf_win( stddeb, "%04x ", LOWORD(className) ); + + dprintf_win(stddeb, "%08lx %08lx %d,%d %dx%d %04x %04x %04x %08lx\n", + exStyle, style, x, y, width, height, + parent, menu, instance, (DWORD)data); + + /* Find the class atom */ + + if (!(classAtom = GlobalFindAtom16( className ))) + { + fprintf( stderr, "CreateWindowEx16: bad class name " ); + if (!HIWORD(className)) fprintf( stderr, "%04x\n", LOWORD(className) ); + else fprintf( stderr, "'%s'\n", (char *)PTR_SEG_TO_LIN(className) ); + return 0; + } + + hwnd = WIN_CreateWindowEx( exStyle, classAtom, windowName, style, x, y, + width, height, parent, menu, instance, data ); + if (!hwnd) return 0; + wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd ); + /* Send the WM_CREATE message */ - createStruct.lpCreateParams = (LPSTR)data; - createStruct.hInstance = instance; - createStruct.hMenu = menu; - createStruct.hwndParent = parent; - createStruct.cx = width; - createStruct.cy = height; - createStruct.x = x; - createStruct.y = y; - createStruct.style = style; - createStruct.lpszName = windowName; - createStruct.lpszClass = className; - createStruct.dwExStyle = 0; - - wmcreate = SendMessage( hwnd, WM_NCCREATE, 0, (LPARAM)MAKE_SEGPTR(&createStruct) ); - if (!wmcreate) - { - dprintf_win(stddeb,"CreateWindowEx: WM_NCCREATE return 0\n"); - wmcreate = -1; - } + if (!(cs = SEGPTR_NEW(CREATESTRUCT16))) wmcreate = -1; /* abort */ else { - WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow, - NULL, NULL, 0, &wndPtr->rectClient ); - wmcreate = SendMessage(hwnd, WM_CREATE, 0, (LPARAM)MAKE_SEGPTR(&createStruct)); + cs->lpCreateParams = (LPSTR)data; + cs->hInstance = wndPtr->hInstance; + cs->hMenu = wndPtr->wIDmenu; + cs->hwndParent = parent; + cs->cx = wndPtr->rectWindow.right-wndPtr->rectWindow.left; + cs->cy = wndPtr->rectWindow.bottom-wndPtr->rectWindow.top; + cs->x = wndPtr->rectWindow.left; + cs->y = wndPtr->rectWindow.top; + cs->style = wndPtr->dwStyle | (style & WS_VISIBLE); + cs->lpszName = windowName; + cs->lpszClass = className; + cs->dwExStyle = wndPtr->dwExStyle; + + wmcreate = SendMessage( hwnd, WM_NCCREATE, 0, (LPARAM)SEGPTR_GET(cs) ); + if (!wmcreate) + { + dprintf_win(stddeb,"CreateWindowEx: WM_NCCREATE return 0\n"); + wmcreate = -1; + } + else + { + WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow, + NULL, NULL, 0, &wndPtr->rectClient ); + wmcreate = SendMessage(hwnd, WM_CREATE, 0, (LPARAM)SEGPTR_GET(cs)); + } + SEGPTR_FREE(cs); } + + if (!(wndPtr->flags & WIN_NEED_SIZE)) + { + /* send it anyway */ + SendMessage( hwnd, WM_SIZE, SIZE_RESTORED, + MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, + wndPtr->rectClient.bottom-wndPtr->rectClient.top)); + SendMessage( hwnd, WM_MOVE, 0, + MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) ); + } if (wmcreate == -1) { @@ -652,6 +732,7 @@ HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, } WIN_SendParentNotify( hwnd, WM_CREATE, wndPtr->wIDmenu, (LONG)hwnd ); + if (!IsWindow(hwnd)) return 0; /* Show the window, maximizing or minimizing if needed */ @@ -666,12 +747,146 @@ HWND CreateWindowEx16(DWORD exStyle, SEGPTR className, SEGPTR windowName, } else if (wndPtr->dwStyle & WS_MAXIMIZE) { + POINT16 maxSize, maxPos, minTrack, maxTrack; + NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack ); SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y, SWP_FRAMECHANGED | (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 ); } else if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW ); + /* Call WH_SHELL hook */ + + if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner) + HOOK_CallHooks( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); + + dprintf_win(stddeb, "CreateWindowEx: return %04x\n", hwnd); + return hwnd; +} + + +/*********************************************************************** + * CreateWindowEx32A (USER.452) + */ +HWND32 CreateWindowEx32A( DWORD exStyle, LPCSTR className, LPCSTR windowName, + DWORD style, INT32 x, INT32 y, INT32 width, + INT32 height, HWND32 parent, HMENU32 menu, + HINSTANCE32 instance, LPVOID data ) +{ + ATOM classAtom; + HWND16 hwnd; + WND *wndPtr; + LRESULT wmcreate; + CREATESTRUCT16 *cs; + char *clsName, *winName; + + /* Find the class atom */ + + if (!(classAtom = GlobalFindAtom32A( className ))) + { + fprintf( stderr, "CreateWindowEx32A: bad class name " ); + if (!HIWORD(className)) fprintf( stderr, "%04x\n", LOWORD(className) ); + else fprintf( stderr, "'%s'\n", (char *)PTR_SEG_TO_LIN(className) ); + return 0; + } + + /* Fix the coordinates */ + + if (x == CW_USEDEFAULT32) x = y = (UINT32)CW_USEDEFAULT16; + if (width == CW_USEDEFAULT32) width = height = (UINT32)CW_USEDEFAULT16; + + clsName = SEGPTR_STRDUP( className ); + winName = SEGPTR_STRDUP( windowName ); + + /* Create the window structure */ + + hwnd = WIN_CreateWindowEx( exStyle, classAtom, SEGPTR_GET(winName), style, + x, y, width, height, parent, menu, instance, data ); + if (!hwnd) return 0; + wndPtr = (WND *) USER_HEAP_LIN_ADDR( hwnd ); + + /* Send the WM_CREATE message */ + + if (!(cs = SEGPTR_NEW(CREATESTRUCT16))) wmcreate = -1; /* abort */ + else + { + cs->lpCreateParams = (LPSTR)data; + cs->hInstance = wndPtr->hInstance; + cs->hMenu = wndPtr->wIDmenu; + cs->hwndParent = parent; + cs->cx = wndPtr->rectWindow.right-wndPtr->rectWindow.left; + cs->cy = wndPtr->rectWindow.bottom-wndPtr->rectWindow.top; + cs->x = wndPtr->rectWindow.left; + cs->y = wndPtr->rectWindow.top; + cs->style = wndPtr->dwStyle | (style & WS_VISIBLE); + cs->lpszName = SEGPTR_GET(winName); + cs->lpszClass = SEGPTR_GET(clsName); + cs->dwExStyle = wndPtr->dwExStyle; + + wmcreate = SendMessage( hwnd, WM_NCCREATE, 0, (LPARAM)SEGPTR_GET(cs) ); + if (!wmcreate) + { + dprintf_win(stddeb,"CreateWindowEx: WM_NCCREATE return 0\n"); + wmcreate = -1; + } + else + { + WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow, + NULL, NULL, 0, &wndPtr->rectClient ); + wmcreate = SendMessage(hwnd, WM_CREATE, 0, (LPARAM)SEGPTR_GET(cs)); + } + SEGPTR_FREE(cs); + SEGPTR_FREE(clsName); + SEGPTR_FREE(winName); + } + + if (!(wndPtr->flags & WIN_NEED_SIZE)) + { + /* send it anyway */ + SendMessage( hwnd, WM_SIZE, SIZE_RESTORED, + MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, + wndPtr->rectClient.bottom-wndPtr->rectClient.top)); + SendMessage( hwnd, WM_MOVE, 0, + MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) ); + } + + if (wmcreate == -1) + { + /* Abort window creation */ + dprintf_win(stddeb,"CreateWindowEx: wmcreate==-1, aborting\n"); + WIN_DestroyWindow( hwnd ); + return 0; + } + + WIN_SendParentNotify( hwnd, WM_CREATE, wndPtr->wIDmenu, (LONG)hwnd ); + if (!IsWindow(hwnd)) return 0; + + /* Show the window, maximizing or minimizing if needed */ + + if (wndPtr->dwStyle & WS_MINIMIZE) + { + wndPtr->dwStyle &= ~WS_MAXIMIZE; + WINPOS_FindIconPos( hwnd ); + SetWindowPos( hwnd, 0, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y, + SYSMETRICS_CXICON, SYSMETRICS_CYICON, + SWP_FRAMECHANGED | + (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 ); + } + else if (wndPtr->dwStyle & WS_MAXIMIZE) + { + POINT16 maxSize, maxPos, minTrack, maxTrack; + NC_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack ); + SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y, + SWP_FRAMECHANGED | + (style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0 ); + } + else if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW ); + + /* Call WH_SHELL hook */ + + if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner) + HOOK_CallHooks( WH_SHELL, HSHELL_WINDOWCREATED, hwnd, 0 ); + dprintf_win(stddeb, "CreateWindowEx: return %04x\n", hwnd); return hwnd; } @@ -686,11 +901,19 @@ BOOL DestroyWindow( HWND hwnd ) dprintf_win(stddeb, "DestroyWindow(%04x)\n", hwnd); - /* Initialisation */ + /* Initialization */ if (hwnd == pWndDesktop->hwndSelf) return FALSE; /* Can't destroy desktop*/ if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE; + /* Top-level window */ + + if (!(wndPtr->dwStyle & WS_CHILD) && !wndPtr->owner) + { + HOOK_CallHooks( WH_SHELL, HSHELL_WINDOWDESTROYED, hwnd, 0L ); + /* FIXME: clean up palette - see "Internals" p.352 */ + } + /* Hide the window */ if (wndPtr->dwStyle & WS_VISIBLE) @@ -698,7 +921,8 @@ BOOL DestroyWindow( HWND hwnd ) SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE ); if ((hwnd == GetCapture()) || IsChild( hwnd, GetCapture() )) ReleaseCapture(); - WIN_SendParentNotify( hwnd, WM_DESTROY, wndPtr->wIDmenu, (LONG)hwnd ); + if (!QUEUE_GetDoomedQueue()) + WIN_SendParentNotify( hwnd, WM_DESTROY, wndPtr->wIDmenu, (LONG)hwnd ); /* Recursively destroy owned windows */ @@ -750,63 +974,135 @@ BOOL OpenIcon(HWND hWnd) return(TRUE); } - -/*********************************************************************** - * FindWindow (USER.50) - */ -HWND FindWindow( SEGPTR ClassMatch, LPSTR TitleMatch ) { - return FindWindowEx((HWND)0,(HWND)0,ClassMatch,TitleMatch); -} -/*********************************************************************** - * FindWindowEx (USER.427) - */ -HWND -FindWindowEx(HWND parent,HWND childafter,SEGPTR ClassMatch,LPSTR TitleMatch ) -{ - WND *wndPtr; - CLASS *class = NULL; - if (ClassMatch) +/*********************************************************************** + * WIN_FindWindow + * + * Implementation of FindWindow() and FindWindowEx(). + */ +static HWND WIN_FindWindow( HWND parent, HWND child, ATOM className, + LPCSTR title ) +{ + WND *pWnd; + CLASS *pClass = NULL; + + if (child) { - if (!(class = CLASS_FindClassByName( ClassMatch, (HINSTANCE)0xffff ))) + if (!(pWnd = WIN_FindWndPtr( child ))) return 0; + if (parent) + { + if (!pWnd->parent || (pWnd->parent->hwndSelf != parent)) return 0; + } + else if (pWnd->parent != pWndDesktop) return 0; + pWnd = pWnd->next; + } + else + { + if (!(pWnd = parent ? WIN_FindWndPtr(parent) : pWndDesktop)) return 0; + pWnd = pWnd->child; + } + + /* For a child window, all siblings will have the same hInstance, */ + /* so we can look for the class once and for all. */ + + if (className && (pWnd->dwStyle & WS_CHILD)) + { + if (!(pClass = CLASS_FindClassByAtom( className, pWnd->hInstance ))) return 0; } - if (parent) { - wndPtr = WIN_FindWndPtr(parent); - if (wndPtr == NULL) - wndPtr = pWndDesktop; - wndPtr = wndPtr->child; - } else - wndPtr = pWndDesktop->child; - if (childafter) { - while (wndPtr) - { - if (childafter == wndPtr->hwndSelf) { - wndPtr = wndPtr->next; - break; - } - wndPtr = wndPtr->next; - } - } - while (wndPtr) + for ( ; pWnd; pWnd = pWnd->next) { - if (!class || (wndPtr->class == class)) - { - /* Found matching class */ - if (!TitleMatch) return wndPtr->hwndSelf; - if (wndPtr->hText) - { - char *textPtr = (char *) USER_HEAP_LIN_ADDR( wndPtr->hText ); - if (!strcmp( textPtr, TitleMatch )) return wndPtr->hwndSelf; - } - } - wndPtr = wndPtr->next; + if (className && !(pWnd->dwStyle & WS_CHILD)) + { + if (!(pClass = CLASS_FindClassByAtom( className, pWnd->hInstance))) + continue; /* Skip this window */ + } + if (pClass && (pWnd->class != pClass)) + continue; /* Not the right class */ + + /* Now check the title */ + + if (!title) return pWnd->hwndSelf; + if (pWnd->hText) + { + char *textPtr = (char *) USER_HEAP_LIN_ADDR( pWnd->hText ); + if (!strcmp( textPtr, title )) return pWnd->hwndSelf; + } } return 0; } - - + + + +/*********************************************************************** + * FindWindow16 (USER.50) + */ +HWND FindWindow16( SEGPTR className, LPCSTR title ) +{ + return FindWindowEx16( 0, 0, className, title ); +} + + +/*********************************************************************** + * FindWindowEx16 (USER.427) + */ +HWND FindWindowEx16( HWND parent, HWND child, SEGPTR className, LPCSTR title ) +{ + ATOM atom; + + atom = className ? GlobalFindAtom16( className ) : 0; + return WIN_FindWindow( parent, child, atom, title ); +} + + +/*********************************************************************** + * FindWindow32A (USER32.197) + */ +HWND FindWindow32A( LPCSTR className, LPCSTR title ) +{ + return FindWindowEx32A( 0, 0, className, title ); +} + + +/*********************************************************************** + * FindWindowEx32A (USER32.198) + */ +HWND FindWindowEx32A( HWND parent, HWND child, LPCSTR className, LPCSTR title ) +{ + ATOM atom; + + atom = className ? GlobalFindAtom32A( className ) : 0; + return WIN_FindWindow( 0, 0, atom, title ); +} + + +/*********************************************************************** + * FindWindowEx32W (USER32.199) + */ +HWND FindWindowEx32W(HWND parent, HWND child, LPCWSTR className, LPCWSTR title) +{ + ATOM atom; + char *buffer; + HWND hwnd; + + atom = className ? GlobalFindAtom32W( className ) : 0; + buffer = STRING32_DupUniToAnsi( title ); + hwnd = WIN_FindWindow( 0, 0, atom, buffer ); + free( buffer ); + return hwnd; +} + + +/*********************************************************************** + * FindWindow32W (USER32.200) + */ +HWND FindWindow32W( LPCWSTR className, LPCWSTR title ) +{ + return FindWindowEx32W( 0, 0, className, title ); +} + + /********************************************************************** * WIN_GetDesktop */ @@ -868,7 +1164,7 @@ BOOL EnableWindow( HWND hwnd, BOOL enable ) /*********************************************************************** - * IsWindowEnabled (USER.35) + * IsWindowEnabled (USER.35) (USER32.348) */ BOOL IsWindowEnabled(HWND hWnd) { @@ -879,6 +1175,18 @@ BOOL IsWindowEnabled(HWND hWnd) } +/*********************************************************************** + * IsWindowUnicode (USER32.349) + */ +BOOL IsWindowUnicode( HWND hwnd ) +{ + WND * wndPtr; + + if (!(wndPtr = WIN_FindWndPtr(hwnd))) return FALSE; + return (wndPtr->flags & WIN_UNICODE) != 0; +} + + /********************************************************************** * GetWindowWord (USER.133) */ @@ -1116,7 +1424,7 @@ BOOL IsChild( HWND parent, HWND child ) /*********************************************************************** - * IsWindowVisible (USER.49) + * IsWindowVisible (USER.49) (USER32.350) */ BOOL IsWindowVisible( HWND hwnd ) { @@ -1382,8 +1690,8 @@ BOOL FlashWindow(HWND hWnd, BOOL bInvert) } else { - RedrawWindow( hWnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | - RDW_UPDATENOW | RDW_FRAME ); + RedrawWindow32( hWnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | + RDW_UPDATENOW | RDW_FRAME ); wndPtr->flags &= ~WIN_NCACTIVATED; } return TRUE; @@ -1429,18 +1737,18 @@ HWND GetSysModalWindow(void) BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) { BOOL wParam,bResult = 0; - POINT pt; + POINT16 pt; LPDRAGINFO ptrDragInfo = (LPDRAGINFO) PTR_SEG_TO_LIN(spDragInfo); WND *ptrQueryWnd = WIN_FindWndPtr(hQueryWnd),*ptrWnd; - RECT tempRect; /* this sucks */ + RECT16 tempRect; /* this sucks */ if( !ptrQueryWnd || !ptrDragInfo ) return 0; pt = ptrDragInfo->pt; - GetWindowRect(hQueryWnd,&tempRect); + GetWindowRect16(hQueryWnd,&tempRect); - if( !PtInRect(&tempRect,pt) || + if( !PtInRect16(&tempRect,pt) || (ptrQueryWnd->dwStyle & WS_DISABLED) ) return 0; @@ -1448,18 +1756,18 @@ BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) { tempRect = ptrQueryWnd->rectClient; if(ptrQueryWnd->dwStyle & WS_CHILD) - MapWindowPoints(ptrQueryWnd->parent->hwndSelf,0,(LPPOINT)&tempRect,2); + MapWindowPoints16(ptrQueryWnd->parent->hwndSelf,0,(LPPOINT16)&tempRect,2); - if( PtInRect(&tempRect,pt) ) + if( PtInRect16(&tempRect,pt) ) { wParam = 0; for (ptrWnd = ptrQueryWnd->child; ptrWnd ;ptrWnd = ptrWnd->next) if( ptrWnd->dwStyle & WS_VISIBLE ) { - GetWindowRect(ptrWnd->hwndSelf,&tempRect); + GetWindowRect16(ptrWnd->hwndSelf,&tempRect); - if( PtInRect(&tempRect,pt) ) + if( PtInRect16(&tempRect,pt) ) break; } @@ -1478,7 +1786,7 @@ BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) } else wParam = 1; - ScreenToClient(hQueryWnd,&ptrDragInfo->pt); + ScreenToClient16(hQueryWnd,&ptrDragInfo->pt); ptrDragInfo->hScope = hQueryWnd; @@ -1494,10 +1802,10 @@ BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo ) * DragDetect ( USER.465 ) * */ -BOOL DragDetect(HWND hWnd, POINT pt) +BOOL16 DragDetect(HWND16 hWnd, POINT16 pt) { MSG msg; - RECT rect; + RECT16 rect; rect.left = pt.x - wDragWidth; rect.right = pt.x + wDragWidth; @@ -1518,8 +1826,7 @@ BOOL DragDetect(HWND hWnd, POINT pt) } if( msg.message == WM_MOUSEMOVE ) { - POINT pt = { LOWORD(msg.lParam), HIWORD(msg.lParam) }; - if( !PtInRect( &rect, pt ) ) + if( !PtInRect16( &rect, MAKEPOINT16(msg.lParam) ) ) { ReleaseCapture(); return 1; diff --git a/windows/winpos.c b/windows/winpos.c index e059ef073e9..39a18d67e22 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -6,6 +6,7 @@ */ #include "sysmetrics.h" +#include "heap.h" #include "module.h" #include "user.h" #include "win.h" @@ -24,8 +25,9 @@ /* ----- external functions ----- */ -void FOCUS_SwitchFocus( HWND , HWND ); -HRGN DCE_GetVisRgn( HWND, WORD ); +extern void FOCUS_SwitchFocus( HWND , HWND ); +extern HRGN DCE_GetVisRgn( HWND, WORD ); +extern HWND CARET_GetHwnd(); /* ----- internal variables ----- */ @@ -40,12 +42,12 @@ static HWND hwndPrevActive = 0; /* Previously active window */ */ void WINPOS_FindIconPos( HWND hwnd ) { - RECT rectParent; + RECT16 rectParent; short x, y, xspacing, yspacing; WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr || !wndPtr->parent) return; - GetClientRect( wndPtr->parent->hwndSelf, &rectParent ); + GetClientRect16( wndPtr->parent->hwndSelf, &rectParent ); if ((wndPtr->ptIconPos.x >= rectParent.left) && (wndPtr->ptIconPos.x + SYSMETRICS_CXICON < rectParent.right) && (wndPtr->ptIconPos.y >= rectParent.top) && @@ -90,11 +92,11 @@ void WINPOS_FindIconPos( HWND hwnd ) */ UINT ArrangeIconicWindows( HWND parent ) { - RECT rectParent; + RECT16 rectParent; HWND hwndChild; INT x, y, xspacing, yspacing; - GetClientRect( parent, &rectParent ); + GetClientRect16( parent, &rectParent ); x = rectParent.left; y = rectParent.bottom; xspacing = yspacing = 70; /* FIXME: This should come from WIN.INI */ @@ -120,23 +122,53 @@ UINT ArrangeIconicWindows( HWND parent ) /*********************************************************************** - * GetWindowRect (USER.32) + * GetWindowRect16 (USER.32) */ -void GetWindowRect( HWND hwnd, LPRECT rect ) +void GetWindowRect16( HWND16 hwnd, LPRECT16 rect ) { WND * wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return; *rect = wndPtr->rectWindow; if (wndPtr->dwStyle & WS_CHILD) - MapWindowPoints( wndPtr->parent->hwndSelf, 0, (POINT *)rect, 2 ); + MapWindowPoints16( wndPtr->parent->hwndSelf, 0, (POINT16 *)rect, 2 ); } /*********************************************************************** - * GetClientRect (USER.33) + * GetWindowRect32 (USER.32) */ -void GetClientRect( HWND hwnd, LPRECT rect ) +void GetWindowRect32( HWND32 hwnd, LPRECT32 rect ) +{ + WND * wndPtr = WIN_FindWndPtr( hwnd ); + if (!wndPtr) return; + + CONV_RECT16TO32( &wndPtr->rectWindow, rect ); + if (wndPtr->dwStyle & WS_CHILD) + MapWindowPoints32( wndPtr->parent->hwndSelf, 0, (POINT32 *)rect, 2 ); +} + + +/*********************************************************************** + * GetClientRect16 (USER.33) + */ +void GetClientRect16( HWND16 hwnd, LPRECT16 rect ) +{ + WND * wndPtr = WIN_FindWndPtr( hwnd ); + + rect->left = rect->top = rect->right = rect->bottom = 0; + if (wndPtr) + { + rect->right = wndPtr->rectClient.right - wndPtr->rectClient.left; + rect->bottom = wndPtr->rectClient.bottom - wndPtr->rectClient.top; + } +} + + +/*********************************************************************** + * GetClientRect32 (USER32.219) + */ +void GetClientRect32( HWND32 hwnd, LPRECT32 rect ) { WND * wndPtr = WIN_FindWndPtr( hwnd ); @@ -150,21 +182,40 @@ void GetClientRect( HWND hwnd, LPRECT rect ) /******************************************************************* - * ClientToScreen (USER.28) + * ClientToScreen16 (USER.28) */ -BOOL ClientToScreen( HWND hwnd, LPPOINT lppnt ) +BOOL16 ClientToScreen16( HWND16 hwnd, LPPOINT16 lppnt ) { - MapWindowPoints( hwnd, 0, lppnt, 1 ); + MapWindowPoints16( hwnd, 0, lppnt, 1 ); return TRUE; } /******************************************************************* - * ScreenToClient (USER.29) + * ClientToScreen32 (USER32.51) */ -void ScreenToClient( HWND hwnd, LPPOINT lppnt ) +BOOL32 ClientToScreen32( HWND32 hwnd, LPPOINT32 lppnt ) { - MapWindowPoints( 0, hwnd, lppnt, 1 ); + MapWindowPoints32( hwnd, 0, lppnt, 1 ); + return TRUE; +} + + +/******************************************************************* + * ScreenToClient16 (USER.29) + */ +void ScreenToClient16( HWND16 hwnd, LPPOINT16 lppnt ) +{ + MapWindowPoints16( 0, hwnd, lppnt, 1 ); +} + + +/******************************************************************* + * ScreenToClient32 (USER32.446) + */ +void ScreenToClient32( HWND32 hwnd, LPPOINT32 lppnt ) +{ + MapWindowPoints32( 0, hwnd, lppnt, 1 ); } @@ -173,11 +224,11 @@ void ScreenToClient( HWND hwnd, LPPOINT lppnt ) * * Find the window and hittest for a given point. */ -INT WINPOS_WindowFromPoint( POINT pt, WND **ppWnd ) +INT16 WINPOS_WindowFromPoint( POINT16 pt, WND **ppWnd ) { WND *wndPtr; - INT hittest = HTERROR; - INT x, y; + INT16 hittest = HTERROR; + INT16 x, y; *ppWnd = NULL; x = pt.x; @@ -246,9 +297,9 @@ INT WINPOS_WindowFromPoint( POINT pt, WND **ppWnd ) /******************************************************************* - * WindowFromPoint (USER.30) + * WindowFromPoint16 (USER.30) */ -HWND WindowFromPoint( POINT pt ) +HWND16 WindowFromPoint16( POINT16 pt ) { WND *pWnd; WINPOS_WindowFromPoint( pt, &pWnd ); @@ -257,14 +308,27 @@ HWND WindowFromPoint( POINT pt ) /******************************************************************* - * ChildWindowFromPoint (USER.191) + * WindowFromPoint32 (USER32.581) */ -HWND ChildWindowFromPoint( HWND hwndParent, POINT pt ) +HWND32 WindowFromPoint32( POINT32 pt ) +{ + WND *pWnd; + POINT16 pt16; + CONV_POINT32TO16( &pt, &pt16 ); + WINPOS_WindowFromPoint( pt16, &pWnd ); + return (HWND32)pWnd->hwndSelf; +} + + +/******************************************************************* + * ChildWindowFromPoint16 (USER.191) + */ +HWND16 ChildWindowFromPoint16( HWND16 hwndParent, POINT16 pt ) { /* pt is in the client coordinates */ WND* wnd = WIN_FindWndPtr(hwndParent); - RECT rect; + RECT16 rect; if( !wnd ) return 0; @@ -273,28 +337,42 @@ HWND ChildWindowFromPoint( HWND hwndParent, POINT pt ) rect.right = wnd->rectClient.right - wnd->rectClient.left; rect.bottom = wnd->rectClient.bottom - wnd->rectClient.top; - if (!PtInRect( &rect, pt )) return 0; + if (!PtInRect16( &rect, pt )) return 0; wnd = wnd->child; while ( wnd ) { - if (PtInRect( &wnd->rectWindow, pt )) return wnd->hwndSelf; + if (PtInRect16( &wnd->rectWindow, pt )) return wnd->hwndSelf; wnd = wnd->next; } return hwndParent; } + /******************************************************************* - * MapWindowPoints (USER.258) + * ChildWindowFromPoint32 (USER32.) */ -void MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, WORD count ) +HWND32 ChildWindowFromPoint32( HWND32 hwndParent, POINT32 pt ) +{ + POINT16 pt16; + CONV_POINT32TO16( &pt, &pt16 ); + return (HWND32)ChildWindowFromPoint16( hwndParent, pt16 ); +} + + +/******************************************************************* + * WINPOS_GetWinOffset + * + * Calculate the offset between the origin of the two windows. Used + * to implement MapWindowPoints. + */ +static void WINPOS_GetWinOffset( HWND32 hwndFrom, HWND32 hwndTo, + POINT32 *offset ) { WND * wndPtr; - POINT * curpt; - POINT origin = { 0, 0 }; - WORD i; - if( hwndFrom == hwndTo ) return; + offset->x = offset->y = 0; + if (hwndFrom == hwndTo ) return; /* Translate source window origin to screen coords */ if (hwndFrom) @@ -306,8 +384,8 @@ void MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, WORD count ) } while (wndPtr->parent) { - origin.x += wndPtr->rectClient.left; - origin.y += wndPtr->rectClient.top; + offset->x += wndPtr->rectClient.left; + offset->y += wndPtr->rectClient.top; wndPtr = wndPtr->parent; } } @@ -322,17 +400,46 @@ void MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, WORD count ) } while (wndPtr->parent) { - origin.x -= wndPtr->rectClient.left; - origin.y -= wndPtr->rectClient.top; + offset->x -= wndPtr->rectClient.left; + offset->y -= wndPtr->rectClient.top; wndPtr = wndPtr->parent; } } +} - /* Translate points */ - for (i = 0, curpt = lppt; i < count; i++, curpt++) + +/******************************************************************* + * MapWindowPoints16 (USER.258) + */ +void MapWindowPoints16( HWND16 hwndFrom, HWND16 hwndTo, + LPPOINT16 lppt, UINT16 count ) +{ + POINT32 offset; + + WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset ); + while (count--) { - curpt->x += origin.x; - curpt->y += origin.y; + lppt->x += offset.x; + lppt->y += offset.y; + lppt++; + } +} + + +/******************************************************************* + * MapWindowPoints32 (USER32.385) + */ +void MapWindowPoints32( HWND32 hwndFrom, HWND32 hwndTo, + LPPOINT32 lppt, UINT32 count ) +{ + POINT32 offset; + + WINPOS_GetWinOffset( hwndFrom, hwndTo, &offset ); + while (count--) + { + lppt->x += offset.x; + lppt->y += offset.y; + lppt++; } } @@ -413,7 +520,7 @@ BOOL ShowWindow( HWND hwnd, int cmd ) { WND * wndPtr = WIN_FindWndPtr( hwnd ); BOOL wasVisible; - POINT maxSize; + POINT16 maxSize; int swpflags = 0; short x = 0, y = 0, cx = 0, cy = 0; @@ -551,13 +658,13 @@ BOOL ShowWindow( HWND hwnd, int cmd ) SendMessage( hwnd, WM_SHOWWINDOW, (cmd != SW_HIDE), 0 ); SetWindowPos( hwnd, HWND_TOP, x, y, cx, cy, swpflags ); - /* Send WM_SIZE and WM_MOVE messages if not already done */ - if (!(wndPtr->flags & WIN_GOT_SIZEMSG)) + if (wndPtr->flags & WIN_NEED_SIZE) { int wParam = SIZE_RESTORED; + + wndPtr->flags &= ~WIN_NEED_SIZE; if (wndPtr->dwStyle & WS_MAXIMIZE) wParam = SIZE_MAXIMIZED; else if (wndPtr->dwStyle & WS_MINIMIZE) wParam = SIZE_MINIMIZED; - wndPtr->flags |= WIN_GOT_SIZEMSG; SendMessage( hwnd, WM_SIZE, wParam, MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left, wndPtr->rectClient.bottom-wndPtr->rectClient.top)); @@ -565,17 +672,23 @@ BOOL ShowWindow( HWND hwnd, int cmd ) MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) ); } + if (hwnd == GetFocus()) + { + SetFocus( (wndPtr->dwStyle & WS_CHILD)? wndPtr->parent->hwndSelf: 0 ); + if (hwnd == CARET_GetHwnd()) DestroyCaret(); + } + return wasVisible; } /*********************************************************************** - * GetInternalWindowPos (USER.460) + * GetInternalWindowPos16 (USER.460) */ -WORD GetInternalWindowPos( HWND hwnd, LPRECT rectWnd, LPPOINT ptIcon ) +UINT16 GetInternalWindowPos16( HWND16 hwnd, LPRECT16 rectWnd, LPPOINT16 ptIcon) { - WINDOWPLACEMENT wndpl; - if (!GetWindowPlacement( hwnd, &wndpl )) return 0; + WINDOWPLACEMENT16 wndpl; + if (!GetWindowPlacement16( hwnd, &wndpl )) return 0; if (rectWnd) *rectWnd = wndpl.rcNormalPosition; if (ptIcon) *ptIcon = wndpl.ptMinPosition; return wndpl.showCmd; @@ -583,11 +696,25 @@ WORD GetInternalWindowPos( HWND hwnd, LPRECT rectWnd, LPPOINT ptIcon ) /*********************************************************************** - * SetInternalWindowPos (USER.461) + * GetInternalWindowPos32 (USER32.244) */ -void SetInternalWindowPos( HWND hwnd, WORD showCmd, LPRECT rect, LPPOINT pt ) +UINT32 GetInternalWindowPos32( HWND32 hwnd, LPRECT32 rectWnd, LPPOINT32 ptIcon) { - WINDOWPLACEMENT wndpl; + WINDOWPLACEMENT32 wndpl; + if (!GetWindowPlacement32( hwnd, &wndpl )) return 0; + if (rectWnd) *rectWnd = wndpl.rcNormalPosition; + if (ptIcon) *ptIcon = wndpl.ptMinPosition; + return wndpl.showCmd; +} + + +/*********************************************************************** + * SetInternalWindowPos16 (USER.461) + */ +void SetInternalWindowPos16( HWND16 hwnd, UINT16 showCmd, + LPRECT16 rect, LPPOINT16 pt ) +{ + WINDOWPLACEMENT16 wndpl; WND *wndPtr = WIN_FindWndPtr( hwnd ); wndpl.length = sizeof(wndpl); @@ -596,14 +723,34 @@ void SetInternalWindowPos( HWND hwnd, WORD showCmd, LPRECT rect, LPPOINT pt ) if (pt) wndpl.ptMinPosition = *pt; wndpl.rcNormalPosition = (rect != NULL) ? *rect : wndPtr->rectNormal; wndpl.ptMaxPosition = wndPtr->ptMaxPos; - SetWindowPlacement( hwnd, &wndpl ); + SetWindowPlacement16( hwnd, &wndpl ); } /*********************************************************************** - * GetWindowPlacement (USER.370) + * SetInternalWindowPos32 (USER32.482) */ -BOOL GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl ) +void SetInternalWindowPos32( HWND32 hwnd, UINT32 showCmd, + LPRECT32 rect, LPPOINT32 pt ) +{ + WINDOWPLACEMENT32 wndpl; + WND *wndPtr = WIN_FindWndPtr( hwnd ); + + wndpl.length = sizeof(wndpl); + wndpl.flags = (pt != NULL) ? WPF_SETMINPOSITION : 0; + wndpl.showCmd = showCmd; + if (pt) wndpl.ptMinPosition = *pt; + if (rect) wndpl.rcNormalPosition = *rect; + else CONV_RECT16TO32( &wndPtr->rectNormal, &wndpl.rcNormalPosition ); + CONV_POINT16TO32( &wndPtr->ptMaxPos, &wndpl.ptMaxPosition ); + SetWindowPlacement32( hwnd, &wndpl ); +} + + +/*********************************************************************** + * GetWindowPlacement16 (USER.370) + */ +BOOL16 GetWindowPlacement16( HWND16 hwnd, WINDOWPLACEMENT16 *wndpl ) { WND *wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return FALSE; @@ -620,9 +767,28 @@ BOOL GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl ) /*********************************************************************** - * SetWindowPlacement (USER.371) + * GetWindowPlacement32 (USER32.306) */ -BOOL SetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl ) +BOOL32 GetWindowPlacement32( HWND32 hwnd, WINDOWPLACEMENT32 *wndpl ) +{ + WND *wndPtr = WIN_FindWndPtr( hwnd ); + if (!wndPtr) return FALSE; + + wndpl->length = sizeof(*wndpl); + wndpl->flags = 0; + wndpl->showCmd = IsZoomed(hwnd) ? SW_SHOWMAXIMIZED : + (IsIconic(hwnd) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL); + CONV_POINT16TO32( &wndPtr->ptIconPos, &wndpl->ptMinPosition ); + CONV_POINT16TO32( &wndPtr->ptMaxPos, &wndpl->ptMaxPosition ); + CONV_RECT16TO32( &wndPtr->rectNormal, &wndpl->rcNormalPosition ); + return TRUE; +} + + +/*********************************************************************** + * SetWindowPlacement16 (USER.371) + */ +BOOL16 SetWindowPlacement16( HWND16 hwnd, const WINDOWPLACEMENT16 *wndpl ) { WND *wndPtr = WIN_FindWndPtr( hwnd ); if (!wndPtr) return FALSE; @@ -637,6 +803,26 @@ BOOL SetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl ) return TRUE; } + +/*********************************************************************** + * SetWindowPlacement32 (USER32.518) + */ +BOOL32 SetWindowPlacement32( HWND32 hwnd, const WINDOWPLACEMENT32 *wndpl ) +{ + WND *wndPtr = WIN_FindWndPtr( hwnd ); + if (!wndPtr) return FALSE; + + if (wndpl->flags & WPF_SETMINPOSITION) + CONV_POINT32TO16( &wndpl->ptMinPosition, &wndPtr->ptIconPos ); + if ((wndpl->flags & WPF_RESTORETOMAXIMIZED) && + (wndpl->showCmd == SW_SHOWMINIMIZED)) wndPtr->flags |= WIN_RESTORE_MAX; + CONV_POINT32TO16( &wndpl->ptMaxPosition, &wndPtr->ptMaxPos ); + CONV_RECT32TO16( &wndpl->rcNormalPosition, &wndPtr->rectNormal ); + ShowWindow( hwnd, wndpl->showCmd ); + return TRUE; +} + + /******************************************************************* * ACTIVATEAPP_callback */ @@ -661,10 +847,10 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus ) { WND *wndPtr = WIN_FindWndPtr(hWnd); WND *wndTemp = WIN_FindWndPtr(hwndActive); - CBTACTIVATESTRUCT cbtStruct = { fMouse , hwndActive }; + CBTACTIVATESTRUCT *cbtStruct; FARPROC enumCallback = MODULE_GetWndProcEntry16("ActivateAppProc"); ACTIVATESTRUCT actStruct; - WORD wIconized=0,wRet= 0; + WORD wIconized=0; /* FIXME: When proper support for cooperative multitasking is in place * hActiveQ will be global @@ -685,10 +871,16 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus ) dprintf_win(stddeb,"WINPOS_ActivateWindow: no current active window.\n"); /* call CBT hook chain */ - wRet = HOOK_CallHooks(WH_CBT, HCBT_ACTIVATE, (WPARAM)hWnd, - (LPARAM)MAKE_SEGPTR(&cbtStruct)); - - if( wRet ) return wRet; + if ((cbtStruct = SEGPTR_NEW(CBTACTIVATESTRUCT))) + { + LRESULT wRet; + cbtStruct->fMouse = fMouse; + cbtStruct->hWndActive = hwndActive; + wRet = HOOK_CallHooks( WH_CBT, HCBT_ACTIVATE, (WPARAM)hWnd, + (LPARAM)SEGPTR_GET(cbtStruct) ); + SEGPTR_FREE(cbtStruct); + if (wRet) return wRet; + } /* set prev active wnd to current active wnd and send notification */ if( (hwndPrevActive = hwndActive) ) @@ -729,7 +921,9 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus ) RedrawIconTitle(hwndPrevActive); } */ - if (!(wndPtr->dwStyle & WS_CHILD)) + + /* managed windows will get ConfigureNotify event */ + if (!(wndPtr->dwStyle & WS_CHILD) && !(wndPtr->flags & WIN_MANAGED)) { /* check Z-order and bring hWnd to the top */ for (wndTemp = WIN_GetDesktop()->child; wndTemp; wndTemp = wndTemp->next) @@ -821,16 +1015,16 @@ BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg ) if( !wndPtr ) return FALSE; /* child windows get WM_CHILDACTIVATE message */ - if( (wndPtr->dwStyle & WS_CHILD) && !( wndPtr->dwStyle & WS_POPUP)) + if( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD ) return SendMessage(hWnd, WM_CHILDACTIVATE, 0, 0L); - /* owned popups imply owner activation */ - if( wndPtr->dwStyle & WS_POPUP && wndPtr->owner ) - { - wndPtr = wndPtr->owner; - if( !wndPtr ) return FALSE; + /* owned popups imply owner activation - not sure */ + if ((wndPtr->dwStyle & WS_POPUP) && wndPtr->owner && + !(wndPtr->owner->dwStyle & WS_DISABLED )) + { + if (!(wndPtr = wndPtr->owner)) return FALSE; hWnd = wndPtr->hwndSelf; - } + } if( hWnd == hwndActive ) return FALSE; @@ -853,26 +1047,29 @@ BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg ) * oldWindowRect, oldClientRect and winpos must be non-NULL only * when calcValidRect is TRUE. */ -LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, RECT *newWindowRect, - RECT *oldWindowRect, RECT *oldClientRect, - SEGPTR winpos, RECT *newClientRect ) +LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, + RECT16 *newWindowRect, RECT16 *oldWindowRect, + RECT16 *oldClientRect, SEGPTR winpos, + RECT16 *newClientRect ) { - NCCALCSIZE_PARAMS params; + NCCALCSIZE_PARAMS16 *params; LONG result; - params.rgrc[0] = *newWindowRect; + if (!(params = SEGPTR_NEW(NCCALCSIZE_PARAMS16))) return 0; + 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 = SendMessage( hwnd, WM_NCCALCSIZE, calcValidRect, - (LPARAM)MAKE_SEGPTR( ¶ms ) ); + (LPARAM)SEGPTR_GET( params ) ); dprintf_win(stddeb, "WINPOS_SendNCCalcSize: %d %d %d %d\n", - (int)params.rgrc[0].top, (int)params.rgrc[0].left, - (int)params.rgrc[0].bottom, (int)params.rgrc[0].right); - *newClientRect = params.rgrc[0]; + (int)params->rgrc[0].top, (int)params->rgrc[0].left, + (int)params->rgrc[0].bottom, (int)params->rgrc[0].right); + *newClientRect = params->rgrc[0]; + SEGPTR_FREE(params); return result; } @@ -882,9 +1079,9 @@ LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect, RECT *newWindowRect, * * Default handling for a WM_WINDOWPOSCHANGING. Called from DefWindowProc(). */ -LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos ) +LONG WINPOS_HandleWindowPosChanging( WINDOWPOS16 *winpos ) { - POINT maxSize; + POINT16 maxSize; WND *wndPtr = WIN_FindWndPtr( winpos->hwnd ); if (!wndPtr || (winpos->flags & SWP_NOSIZE)) return 0; if ((wndPtr->dwStyle & WS_THICKFRAME) || @@ -945,11 +1142,11 @@ static void WINPOS_MoveWindowZOrder( HWND hwnd, HWND hwndAfter ) pWndCur = wndPtr->next; while (pWndCur != pWndPrevAfter) { - RECT rect = pWndCur->rectWindow; - OffsetRect( &rect, -wndPtr->rectClient.left, - -wndPtr->rectClient.top ); - RedrawWindow( hwnd, &rect, 0, RDW_INVALIDATE | RDW_ALLCHILDREN | - RDW_FRAME | RDW_ERASE ); + RECT16 rect = pWndCur->rectWindow; + OffsetRect16( &rect, -wndPtr->rectClient.left, + -wndPtr->rectClient.top ); + RedrawWindow16( hwnd, &rect, 0, RDW_INVALIDATE | RDW_ALLCHILDREN | + RDW_FRAME | RDW_ERASE ); pWndCur = pWndCur->next; } } @@ -960,11 +1157,11 @@ static void WINPOS_MoveWindowZOrder( HWND hwnd, HWND hwndAfter ) WIN_LinkWindow( hwnd, hwndAfter ); while (pWndCur != wndPtr) { - RECT rect = wndPtr->rectWindow; - OffsetRect( &rect, -pWndCur->rectClient.left, - -pWndCur->rectClient.top ); - RedrawWindow( pWndCur->hwndSelf, &rect, 0, RDW_INVALIDATE | - RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE ); + RECT16 rect = wndPtr->rectWindow; + OffsetRect16( &rect, -pWndCur->rectClient.left, + -pWndCur->rectClient.top ); + RedrawWindow16( pWndCur->hwndSelf, &rect, 0, RDW_INVALIDATE | + RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE ); pWndCur = pWndCur->next; } } @@ -1054,7 +1251,7 @@ HWND WINPOS_ReorderOwnedPopups(HWND hwndInsertAfter, WND* wndPtr, WORD flags) * update regions are in window client coordinates * client and window rectangles are in parent client coordinates */ -static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT lpOldWndRect, LPRECT lpOldClientRect, BOOL bNoCopy ) +static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT16 lpOldWndRect, LPRECT16 lpOldClientRect, BOOL bNoCopy ) { HRGN newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf, DCX_WINDOW | DCX_CLIPSIBLINGS ); HRGN dirtyRgn = CreateRectRgn(0,0,0,0); @@ -1099,7 +1296,7 @@ static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT lpOldWndRect, if( bNoCopy ) /* invalidate Wnd visible region */ { - if (my != NULLREGION) RedrawWindow( Wnd->hwndSelf, NULL, newVisRgn, RDW_INVALIDATE | + if (my != NULLREGION) RedrawWindow32( Wnd->hwndSelf, NULL, newVisRgn, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE ); } else /* bitblt old client area */ @@ -1150,16 +1347,16 @@ static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT lpOldWndRect, } if( update != NULLREGION ) - RedrawWindow( Wnd->hwndSelf, NULL, updateRgn, RDW_INVALIDATE | - RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE ); + RedrawWindow32( Wnd->hwndSelf, NULL, updateRgn, RDW_INVALIDATE | + RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE ); DeleteObject( updateRgn ); } /* erase uncovered areas */ if( other != NULLREGION ) - RedrawWindow( Wnd->parent->hwndSelf, NULL, dirtyRgn, - RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE ); + RedrawWindow32( Wnd->parent->hwndSelf, NULL, dirtyRgn, + RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE ); DeleteObject(dirtyRgn); DeleteObject(newVisRgn); @@ -1170,7 +1367,7 @@ static void WINPOS_SizeMoveClean(WND* Wnd, HRGN oldVisRgn, LPRECT lpOldWndRect, * * SetWindowPos() for an X window. Used by the real SetWindowPos(). */ -static void WINPOS_SetXWindowPos( WINDOWPOS *winpos ) +static void WINPOS_SetXWindowPos( WINDOWPOS16 *winpos ) { XWindowChanges winChanges; int changeMask = 0; @@ -1212,9 +1409,9 @@ static void WINPOS_SetXWindowPos( WINDOWPOS *winpos ) BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, INT cx, INT cy, WORD flags ) { - WINDOWPOS winpos; + WINDOWPOS16 winpos; WND * wndPtr; - RECT newWindowRect, newClientRect; + RECT16 newWindowRect, newClientRect; HRGN visRgn = 0; int result = 0; @@ -1303,8 +1500,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, newWindowRect.right += winpos.x - wndPtr->rectWindow.left; newWindowRect.bottom += winpos.y - wndPtr->rectWindow.top; - OffsetRect(&newClientRect, winpos.x - wndPtr->rectWindow.left, - winpos.y - wndPtr->rectWindow.top ); + OffsetRect16( &newClientRect, winpos.x - wndPtr->rectWindow.left, + winpos.y - wndPtr->rectWindow.top ); } winpos.flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; @@ -1360,8 +1557,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, if (wndPtr->window) { - RECT oldWindowRect = wndPtr->rectWindow; - RECT oldClientRect = wndPtr->rectClient; + RECT16 oldWindowRect = wndPtr->rectWindow; + RECT16 oldClientRect = wndPtr->rectClient; HWND bogusInsertAfter = winpos.hwndInsertAfter; @@ -1379,36 +1576,38 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, (oldClientRect.top - oldWindowRect.top != newClientRect.top - newWindowRect.top) ) - RedrawWindow(wndPtr->hwndSelf, NULL, 0, RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE); + RedrawWindow32( wndPtr->hwndSelf, NULL, 0, + RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE ); else if( winpos.flags & SWP_FRAMECHANGED ) { WORD wErase = 0; - RECT rect; + RECT32 rect; if( oldClientRect.right > newClientRect.right ) - { + { rect.left = newClientRect.right; rect.top = newClientRect.top; rect.right = oldClientRect.right; rect.bottom = newClientRect.bottom; wErase = 1; - RedrawWindow(wndPtr->hwndSelf, &rect, 0, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); - } + RedrawWindow32( wndPtr->hwndSelf, &rect, 0, + RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN ); + } if( oldClientRect.bottom > newClientRect.bottom ) - { + { rect.left = newClientRect.left; rect.top = newClientRect.bottom; rect.right = (wErase)?oldClientRect.right:newClientRect.right; rect.bottom = oldClientRect.bottom; wErase = 1; - RedrawWindow(wndPtr->hwndSelf, &rect, 0, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); - } - + RedrawWindow32( wndPtr->hwndSelf, &rect, 0, + RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN ); + } if( !wErase ) wndPtr->flags |= WIN_NEEDS_NCPAINT; } } else { - RECT oldWindowRect = wndPtr->rectWindow; - RECT oldClientRect = wndPtr->rectClient; + RECT16 oldWindowRect = wndPtr->rectWindow; + RECT16 oldClientRect = wndPtr->rectClient; wndPtr->rectWindow = newWindowRect; wndPtr->rectClient = newClientRect; @@ -1427,7 +1626,7 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, } else if( winpos.flags & SWP_FRAMECHANGED ) - RedrawWindow( winpos.hwnd, NULL, 0, RDW_NOCHILDREN | RDW_FRAME ); + RedrawWindow32( winpos.hwnd, NULL, 0, RDW_NOCHILDREN | RDW_FRAME ); } DeleteObject(visRgn); @@ -1443,9 +1642,9 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, else { if (!(flags & SWP_NOREDRAW)) - RedrawWindow( winpos.hwnd, NULL, 0, - RDW_INVALIDATE | RDW_ALLCHILDREN | - RDW_FRAME | RDW_ERASE ); + RedrawWindow32( winpos.hwnd, NULL, 0, + RDW_INVALIDATE | RDW_ALLCHILDREN | + RDW_FRAME | RDW_ERASE ); } } else if (flags & SWP_HIDEWINDOW) @@ -1458,8 +1657,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, else { if (!(flags & SWP_NOREDRAW)) - RedrawWindow( wndPtr->parent->hwndSelf, &wndPtr->rectWindow, 0, - RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE ); + RedrawWindow16( wndPtr->parent->hwndSelf, &wndPtr->rectWindow, 0, + RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE ); } if ((winpos.hwnd == GetFocus()) || IsChild(winpos.hwnd, GetFocus())) @@ -1491,8 +1690,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, EVENT_DummyMotionNotify(); /* Simulate a mouse event to set the cursor */ if (!(flags & SWP_DEFERERASE)) - RedrawWindow( wndPtr->parent->hwndSelf, NULL, 0, - RDW_ALLCHILDREN | RDW_ERASENOW ); + RedrawWindow32( wndPtr->parent->hwndSelf, NULL, 0, + RDW_ALLCHILDREN | RDW_ERASENOW ); /* And last, send the WM_WINDOWPOSCHANGED message */ @@ -1507,13 +1706,13 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y, /*********************************************************************** * BeginDeferWindowPos (USER.259) */ -HDWP BeginDeferWindowPos( INT count ) +HDWP16 BeginDeferWindowPos( INT count ) { - HDWP handle; + HDWP16 handle; DWP *pDWP; if (count <= 0) return 0; - handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) ); + handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS16) ); if (!handle) return 0; pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle ); pDWP->actualCount = 0; @@ -1528,12 +1727,12 @@ HDWP BeginDeferWindowPos( INT count ) /*********************************************************************** * DeferWindowPos (USER.260) */ -HDWP DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y, - INT cx, INT cy, UINT flags ) +HDWP16 DeferWindowPos( HDWP16 hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y, + INT cx, INT cy, UINT flags ) { DWP *pDWP; int i; - HDWP newhdwp = hdwp; + HDWP16 newhdwp = hdwp; HWND parent; pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp ); @@ -1581,7 +1780,7 @@ HDWP DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y, if (pDWP->actualCount >= pDWP->suggestedCount) { newhdwp = USER_HEAP_REALLOC( hdwp, - sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) ); + sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS16) ); if (!newhdwp) return 0; pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp ); pDWP->suggestedCount++; @@ -1601,10 +1800,10 @@ HDWP DeferWindowPos( HDWP hdwp, HWND hwnd, HWND hwndAfter, INT x, INT y, /*********************************************************************** * EndDeferWindowPos (USER.261) */ -BOOL EndDeferWindowPos( HDWP hdwp ) +BOOL EndDeferWindowPos( HDWP16 hdwp ) { DWP *pDWP; - WINDOWPOS *winpos; + WINDOWPOS16 *winpos; BOOL res = TRUE; int i; diff --git a/windows/winproc.c b/windows/winproc.c new file mode 100644 index 00000000000..6e25b201136 --- /dev/null +++ b/windows/winproc.c @@ -0,0 +1,405 @@ +/* + * Window procedure callbacks + * + * Copyright 1995 Martin von Loewis + * Copyright 1996 Alexandre Julliard + */ + +#include +#include "windows.h" +#include "alias.h" +#include "callback.h" +#include "heap.h" +#include "ldt.h" +#include "stackframe.h" +#include "struct32.h" +#include "win.h" + + +/********************************************************************** + * WINPROC_CallProc16To32 + * + * Call a 32-bit window procedure, translating the 16-bit args. + */ +static LRESULT WINPROC_CallProc16To32( WNDPROC32 func, HWND16 hwnd, UINT16 msg, + WPARAM16 wParam, LPARAM lParam ) +{ + LRESULT result; + + switch(msg) + { + case WM_ACTIVATE: + case WM_CHARTOITEM: + case WM_COMMAND: + case WM_HSCROLL: + case WM_VKEYTOITEM: + case WM_VSCROLL: + return CallWndProc32( func, hwnd, msg, + MAKEWPARAM( wParam, HIWORD(lParam) ), + (LPARAM)(HWND32)LOWORD(lParam) ); + case WM_CTLCOLOR: + return CallWndProc32( func, hwnd, WM_CTLCOLORMSGBOX + HIWORD(lParam), + (WPARAM32)(HDC32)wParam, + (LPARAM)(HWND32)LOWORD(lParam) ); + case WM_GETMINMAXINFO: + { + MINMAXINFO32 mmi; + STRUCT32_MINMAXINFO16to32( (MINMAXINFO16 *)PTR_SEG_TO_LIN(lParam), + &mmi ); + result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)&mmi); + STRUCT32_MINMAXINFO32to16( &mmi, + (MINMAXINFO16 *)PTR_SEG_TO_LIN(lParam)); + } + return result; + + case WM_GETTEXT: + /* FIXME: Unicode */ + return CallWndProc32( func, hwnd, msg, wParam, + (LPARAM)PTR_SEG_TO_LIN(lParam) ); + case WM_MDISETMENU: + return CallWndProc32( func, hwnd, msg, + (WPARAM32)(HMENU32)LOWORD(lParam), + (LPARAM)(HMENU32)HIWORD(lParam) ); + case WM_MENUCHAR: + case WM_MENUSELECT: + return CallWndProc32( func, hwnd, msg, + MAKEWPARAM( wParam, LOWORD(lParam) ), + (LPARAM)(HMENU32)HIWORD(lParam) ); + case WM_NCCALCSIZE: + { + NCCALCSIZE_PARAMS16 *pnc16; + NCCALCSIZE_PARAMS32 nc; + WINDOWPOS32 wp; + + pnc16 = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(lParam); + CONV_RECT16TO32( &pnc16->rgrc[0], &nc.rgrc[0] ); + if (wParam) + { + CONV_RECT16TO32( &pnc16->rgrc[1], &nc.rgrc[1] ); + CONV_RECT16TO32( &pnc16->rgrc[2], &nc.rgrc[2] ); + STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(pnc16->lppos), + &wp ); + nc.lppos = ℘ + } + + result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)&nc ); + + pnc16 = (NCCALCSIZE_PARAMS16 *)PTR_SEG_TO_LIN(lParam); + CONV_RECT32TO16( &nc.rgrc[0], &pnc16->rgrc[0] ); + if (wParam) + { + CONV_RECT32TO16( &nc.rgrc[1], &pnc16->rgrc[1] ); + CONV_RECT32TO16( &nc.rgrc[2], &pnc16->rgrc[2] ); + STRUCT32_WINDOWPOS32to16( nc.lppos, + (WINDOWPOS16 *)PTR_SEG_TO_LIN(pnc16->lppos)); + } + } + return result; + + case WM_NCCREATE: + case WM_CREATE: + { + CREATESTRUCT16 *pcs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); + CREATESTRUCT32A cs; + + STRUCT32_CREATESTRUCT16to32A( pcs16, &cs ); + /* FIXME: Unicode */ + cs.lpszName = (LPCSTR)PTR_SEG_TO_LIN(pcs16->lpszName); + cs.lpszClass = (LPCSTR)PTR_SEG_TO_LIN(pcs16->lpszClass); + result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)&cs ); + pcs16 = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam); + STRUCT32_CREATESTRUCT32Ato16( &cs, pcs16 ); + + if (cs.lpszName != (LPCSTR)PTR_SEG_TO_LIN(pcs16->lpszName)) + fprintf( stderr, "CallWindowProc16: WM_NCCREATE(%04x) changed lpszName (%p->%p), please report.\n", + msg, (LPCSTR)PTR_SEG_TO_LIN(pcs16->lpszName), cs.lpszName); + if (cs.lpszClass != (LPCSTR)PTR_SEG_TO_LIN(pcs16->lpszClass)) + fprintf( stderr, "CallWindowProc16: WM_NCCREATE(%04x) changed lpszClass (%p->%p), please report.\n", + msg, (LPCSTR)PTR_SEG_TO_LIN(pcs16->lpszClass), cs.lpszClass); + } + return result; + + case WM_PARENTNOTIFY: + if ((wParam == WM_CREATE) || (wParam == WM_DESTROY)) + return CallWndProc32( func, hwnd, msg, + MAKEWPARAM( wParam, HIWORD(lParam) ), + (LPARAM)(HWND32)LOWORD(lParam) ); + else return CallWndProc32( func, hwnd, msg, + MAKEWPARAM( wParam, 0 /* FIXME? */ ), + lParam ); + case WM_SETTEXT: + /* FIXME: Unicode */ + return CallWndProc32( func, hwnd, msg, wParam, + (LPARAM)PTR_SEG_TO_LIN(lParam) ); + + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + { + WINDOWPOS32 wp; + STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam), + &wp ); + result = CallWndProc32( func, hwnd, msg, wParam, (LPARAM)&wp ); + STRUCT32_WINDOWPOS32to16( &wp, + (WINDOWPOS16 *)PTR_SEG_TO_LIN(lParam) ); + } + return result; + + case WM_ASKCBFORMATNAME: + case WM_COMPAREITEM: + case WM_DELETEITEM: + case WM_DEVMODECHANGE: + case WM_DRAWITEM: + case WM_MDIACTIVATE: + case WM_MDICREATE: + case WM_MEASUREITEM: + case WM_PAINTCLIPBOARD: + case WM_SIZECLIPBOARD: + case WM_WININICHANGE: + fprintf( stderr, "CallWindowProc16To32: message %04x needs translation\n", msg ); + + default: /* No translation needed */ + return CallWndProc32( func, hwnd, msg, (WPARAM32)wParam, lParam ); + } +} + + +/********************************************************************** + * WINPROC_CallProc32To16 + * + * Call a 16-bit window procedure, translating the 32-bit args. + */ +static LRESULT WINPROC_CallProc32To16( WNDPROC16 func, WORD ds, HWND32 hwnd, + UINT32 msg, WPARAM32 wParam, + LPARAM lParam ) +{ + LRESULT result; + + switch(msg) + { + case WM_ACTIVATE: + case WM_CHARTOITEM: + case WM_COMMAND: + case WM_HSCROLL: + case WM_VKEYTOITEM: + case WM_VSCROLL: + return CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + MAKELPARAM( (HWND16)lParam, HIWORD(wParam) ) ); + + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + return CallWndProc16( func, ds, hwnd, WM_CTLCOLOR, (WPARAM16)wParam, + MAKELPARAM( (HWND16)lParam, + (WORD)msg - WM_CTLCOLORMSGBOX ) ); + case WM_GETMINMAXINFO: + { + MINMAXINFO16 *mmi = SEGPTR_NEW(MINMAXINFO16); + if (!mmi) return 0; + STRUCT32_MINMAXINFO32to16( (MINMAXINFO32 *)lParam, mmi ); + result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + (LPARAM)SEGPTR_GET(mmi) ); + STRUCT32_MINMAXINFO16to32( mmi, (MINMAXINFO32 *)lParam ); + SEGPTR_FREE(mmi); + } + return result; + + case WM_GETTEXT: + { + LPSTR str; + wParam = MIN( wParam, 0xff80 ); /* Size must be < 64K */ + if (!(str = SEGPTR_ALLOC( wParam ))) return 0; + result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + (LPARAM)SEGPTR_GET(str) ); + if (result > 0) memcpy( (LPSTR)lParam, str, result ); + SEGPTR_FREE(str); + } + return result; + + case WM_MDISETMENU: + return CallWndProc16( func, ds, hwnd, msg, TRUE /* FIXME? */, + MAKELPARAM( (HMENU16)LOWORD(lParam), + (HMENU16)HIWORD(lParam) ) ); + case WM_MENUCHAR: + case WM_MENUSELECT: + return CallWndProc16( func, ds, hwnd, msg, (WPARAM16)LOWORD(wParam), + MAKELPARAM( HIWORD(wParam), (HMENU16)lParam ) ); + case WM_NCCALCSIZE: + { + NCCALCSIZE_PARAMS32 *nc32 = (NCCALCSIZE_PARAMS32 *)lParam; + NCCALCSIZE_PARAMS16 *nc; + WINDOWPOS16 *wp = NULL; + + if (!(nc = SEGPTR_NEW(NCCALCSIZE_PARAMS16))) return 0; + CONV_RECT32TO16( &nc32->rgrc[0], &nc->rgrc[0] ); + if (wParam) + { + CONV_RECT32TO16( &nc32->rgrc[1], &nc->rgrc[1] ); + CONV_RECT32TO16( &nc32->rgrc[2], &nc->rgrc[2] ); + if (!(wp = SEGPTR_NEW(WINDOWPOS16))) + { + SEGPTR_FREE(nc); + return 0; + } + STRUCT32_WINDOWPOS32to16( nc32->lppos, wp ); + nc->lppos = SEGPTR_GET(wp); + } + result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + (LPARAM)SEGPTR_GET(nc) ); + CONV_RECT16TO32( &nc->rgrc[0], &nc32->rgrc[0] ); + if (wParam) + { + CONV_RECT16TO32( &nc->rgrc[1], &nc32->rgrc[1] ); + CONV_RECT16TO32( &nc->rgrc[2], &nc32->rgrc[2] ); + STRUCT32_WINDOWPOS16to32( (WINDOWPOS16 *)PTR_SEG_TO_LIN(nc->lppos), + nc32->lppos ); + SEGPTR_FREE(wp); + } + SEGPTR_FREE(nc); + } + return result; + + case WM_NCCREATE: + case WM_CREATE: + { + CREATESTRUCT16 *cs; + CREATESTRUCT32A *cs32 = (CREATESTRUCT32A *)lParam; + LPSTR name, cls; + + if (!(cs = SEGPTR_NEW(CREATESTRUCT16))) return 0; + STRUCT32_CREATESTRUCT32Ato16( cs32, cs ); + name = SEGPTR_STRDUP( cs32->lpszName ); + cls = SEGPTR_STRDUP( cs32->lpszClass ); + cs->lpszName = SEGPTR_GET(name); + cs->lpszClass = SEGPTR_GET(cls); + result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + (LPARAM)SEGPTR_GET(cs) ); + STRUCT32_CREATESTRUCT16to32A( cs, cs32 ); + if (PTR_SEG_TO_LIN(cs->lpszName) != name) + cs32->lpszName = (LPCSTR)PTR_SEG_TO_LIN( cs->lpszName ); + if (PTR_SEG_TO_LIN(cs->lpszClass) != cls) + cs32->lpszClass = (LPCSTR)PTR_SEG_TO_LIN( cs->lpszClass ); + SEGPTR_FREE(name); + SEGPTR_FREE(cls); + SEGPTR_FREE(cs); + } + return result; + + case WM_PARENTNOTIFY: + if ((wParam == WM_CREATE) || (wParam == WM_DESTROY)) + return CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + MAKELPARAM( (HWND16)lParam, LOWORD(wParam))); + case WM_SETTEXT: + { + LPSTR str = SEGPTR_STRDUP( (LPSTR)lParam ); + if (!str) return 0; + result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + (LPARAM)SEGPTR_GET(str) ); + SEGPTR_FREE(str); + } + return result; + + case WM_WINDOWPOSCHANGING: + case WM_WINDOWPOSCHANGED: + { + WINDOWPOS16 *wp; + if (!(wp = SEGPTR_NEW(WINDOWPOS16))) return 0; + STRUCT32_WINDOWPOS32to16( (WINDOWPOS32 *)lParam, wp ); + result = CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, + (LPARAM)SEGPTR_GET(wp) ); + STRUCT32_WINDOWPOS16to32( wp, (WINDOWPOS32 *)lParam ); + SEGPTR_FREE(wp); + } + return result; + + case WM_ASKCBFORMATNAME: + case WM_COMPAREITEM: + case WM_DELETEITEM: + case WM_DEVMODECHANGE: + case WM_DRAWITEM: + case WM_MDIACTIVATE: + case WM_MDICREATE: + case WM_MEASUREITEM: + case WM_PAINTCLIPBOARD: + case WM_SIZECLIPBOARD: + case WM_WININICHANGE: + fprintf( stderr, "CallWindowProc32To16: message %04x needs translation\n", msg ); + + default: /* No translation needed */ + return CallWndProc16( func, ds, hwnd, msg, (WPARAM16)wParam, lParam ); + } +} + + +/********************************************************************** + * CallWindowProc16 (USER.122) + */ +LRESULT CallWindowProc16( WNDPROC16 func, HWND16 hwnd, UINT16 msg, + WPARAM16 wParam, LPARAM lParam ) +{ + FUNCTIONALIAS *a; + + /* check if we have something better than 16 bit relays */ + if (!ALIAS_UseAliases || !(a=ALIAS_LookupAlias((DWORD)func)) || + (!a->wine && !a->win32)) + { + WND *wndPtr = WIN_FindWndPtr( hwnd ); + return CallWndProc16( (FARPROC)func, + wndPtr ? wndPtr->hInstance : CURRENT_DS, + hwnd, msg, wParam, lParam ); + } + + if(a->wine) + return ((LONG(*)(WORD,WORD,WORD,LONG))(a->wine)) + (hwnd,msg,wParam,lParam); + + return WINPROC_CallProc16To32( (WNDPROC32)a->win32, hwnd, msg, + wParam, lParam ); +} + + +/********************************************************************** + * CallWindowProc32A (USER32.17) + */ +LRESULT CallWindowProc32A( WNDPROC32 func, HWND32 hwnd, UINT32 msg, + WPARAM32 wParam, LPARAM lParam ) +{ + FUNCTIONALIAS *a = NULL; + WND *wndPtr; + WORD ds; + + /* check if we have something better than 16 bit relays */ + if (ALIAS_UseAliases && (a=ALIAS_LookupAlias((DWORD)func)) && + (a->wine || a->win32)) + { + /* FIXME: Unicode */ + if (a->wine) + return ((WNDPROC32)a->wine)(hwnd,msg,wParam,lParam); + else return CallWndProc32( func, hwnd, msg, wParam, lParam ); + } + wndPtr = WIN_FindWndPtr( hwnd ); + ds = wndPtr ? wndPtr->hInstance : CURRENT_DS; + + if (!a) + { + fprintf( stderr, "CallWindowProc32A: no alias for %p\n", func ); + return 0; + } + + return WINPROC_CallProc32To16( (WNDPROC16)a->win16, ds, hwnd, msg, + wParam, lParam ); +} + + +/********************************************************************** + * CallWindowProc32W (USER32.18) + */ +LRESULT CallWindowProc32W( WNDPROC32 func, HWND32 hwnd, UINT32 msg, + WPARAM32 wParam, LPARAM lParam ) +{ + /* FIXME: Unicode translation */ + return CallWindowProc32A( func, hwnd, msg, wParam, lParam ); +}