Release 970112

Sat Jan 11 18:17:59 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/menu.c]
	Updated to new Win32 types.

	* [controls/listbox.c]
	Fixed Winfile extended selection bug.

	* [files/directory.c]
	Changed DIR_SearchPath to return both long and short file names.

	* [files/dos_fs.c]
	Implemented VFAT ioctl to retrieve the original short filenames
	from a VFAT filesystem (Linux only for now).
	Replaced DOSFS_GetUnixFileName()/DOSFS_GetDosTrueName() by
	DOS_GetFullName().
	Properly implemented GetShortPathName() and GetFullPathName().
	Made all functions re-entrant.

	* [files/file.c] [misc/main.c]
	Replaced -allowreadonly option by -failreadonly. The default is
	now to report success when opening a read-only file for writing.

	* [objects/metafile.c]
	Fixed bug in DIB bitmaps pointer calculation.

	* [scheduler/process.c]
	Implemented environment strings and Get/SetStdHandle with process
 	environment block.

	* [tools/build.c]
	Rewrote BuildContext32() to avoid instructions that may not be
	supported by all assemblers.
	
Fri Jan 10 17:11:09 1997  David Faure  <david.faure@ifhamy.insa-lyon.fr>

	* [windows/event.c]
	Created table keyc2vkey, which associate a vkey(+extended bit) to
	any keycode. Changed EVENT_event_to_vkey to use this table to
	return the correct vkey. Changed EVENT_ToAscii to get the keycode
	from this table too.  Assigned OEM specific vkeys arbitrarily.

Fri Jan 10 09:26:17 1997  John Harvey <john@division.co.uk>

	* [misc/winsock.c] [misc/winsoc_async.c]
        Fixed svr4 header files.
        Changed bzero() to memset().

	* [tools/fnt2bdf.c]
        Removed bcopy() and used memcpy() instead.

	* [debugger/msc.c]
        Include string.h instead of strings.h

	* [debugger/stabs.c]
        Include string.h instead of strings.h.
        Define __ELF__ for svr4 systems.

	* [loader/signal.c]
        Use wait() instead of wait4() which doesnt exist on Unixware.

	* [memory/global.c]
        Use sysconf() instead of getpagesize() for svr4 systems.

Thu Jan  9 21:07:20 1997  Robert Pouliot <krynos@clic.net>

	* [Make.rules.in] [Makefile.in] [make_os2.sh] [rc/Makefile.in]
	  [tools/Makefile.in] [documentation/wine_os2.txt]
	Patches for OS/2 support. Note that it doesn't compile yet.

Tue Jan  7 20:03:53 1997  Eric Youngdale <eric@sub2304.jic.com>

	* [debugger/*]
	Many more debugger improvements (see debugger/README for details).

Tue Jan  7 15:12:21 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [windows/graphics.c] [objects/text.c] [graphics/x11drv/*]
	  [graphics/metafiledrv/*]
	Moved some device dependent code into the resp. subdirs.

	* [include/gdi.h] [include/metafiledrv.h] [include/x11drv.h]
	Prototypes added,
	DC_FUNCTIONS: GetPixel added, some unnecessary functions removed.

	* [objects/region.c]
	CreatePolyPolygonRgn32 added.

	* [files/dos_fs.c]
	QueryDosDevice added.

	* [misc/lstr.c]
	FormatMessage: broken heap management fixed.

	* [scheduler/process.c] [scheduler/thread.c]
	Get/SetThreadPriority/PriorityClass added.

Mon Jan  6 21:55:30 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [misc/keyboard.c]
	ToAscii : Use EVENT_ToAscii instead.

	* [windows/event.c]
	keypad_key : Do not convert XK_Mode_switch to VK_MENU; recognize
	keypad cursor keys.
	EVENT_event_to_vkey : New function, to transform a X keycode
	into a MSwin vkey + extended bit.
	EVENT_ToAscii : New function, to transform a vkey + extended bit
	(+ key state table) into ascii char(s), using XLookupString, and
	recognizing dead chars.
	EVENT_key : Transform AltGr into Ctrl+Alt sequence; call
	EVENT_event_to_vkey for keycode to vkey conversion; fixed
	previous, context and extended bits.

	* [windows/keyboard.c]
	Include stddebug.h, to get -debugmsg messages.
	GetKeyState : Handle VK_MBUTTON case.
	GetKeyboardState, SetKeyboardState : Debugging messages added.

	* [windows/message.c]
	TranslateMessage : Handle dead chars.

Mon Jan  6 20:10:11 1997  Dominik Strasser  <bm424953@muenchen.org>

	* [if1632/crtdll.spec] [misc/crtdll.c]
	C++ functions new/delete/set_new_handler implemented.

Mon Jan  6 15:48:15 1997 Frans van Dorsselaer <dorssel@rulhmpc49.LeidenUniv.nl>

	* [controls/edit.c] [include/windows.h]
	Moved the edit control to 32 bits.
	Included new (win95) message definitions in windows.h
	Implemented EM_SCROLLCARET, EM_SETMARGINS, EM_GETMARGINS,
	EM_GETLIMITTEXT, EM_POSFROMCHAR, EM_CHARFROMPOS.
	Broke EM_SETWORDBREAKPROC (internal wordwrap still works).
	Fixed some bugs, introduced a couple of others.
	Text buffer is now initially in 32-bit heap.

	* [controls/EDIT.TODO] [controls/combo.c] [controls/widgets.c]
	  [if1632/wprocs.spec] [library/miscstubs.c] [windows/defdlg.c]
	  [misc/commdlg.c]
	Updated to work with 32-bit edit control.

Sat Jan  4 22:07:27 1997  O.Flebbe  <O.Flebbe@science-computing.uni-tuebingen.de>

	* [loader/pe_image.c]
	Use mmap rather then malloc. Better workaround for clean
	segments.
This commit is contained in:
Alexandre Julliard 1997-01-12 18:32:19 +00:00
parent 9ea19e54cb
commit c6c09442c4
159 changed files with 14935 additions and 5191 deletions

View File

@ -1,13 +1,15 @@
This is release 970101 of Wine, the MS Windows emulator. This is still a
This is release 970112 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-970101: (see ChangeLog for details)
- Win32 handle management and related stuff.
- Several files moved around, new directories created.
WHAT'S NEW with Wine-970112: (see ChangeLog for details)
- Better support for non-US keyboards.
- Support for VFAT filesystem short names.
- Many improvements to the built-in debugger.
- More Win32 stuff.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -16,10 +18,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970101.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970101.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970101.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970101.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970112.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970112.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970112.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970112.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

150
ChangeLog
View File

@ -1,3 +1,153 @@
----------------------------------------------------------------------
Sat Jan 11 18:17:59 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/menu.c]
Updated to new Win32 types.
* [controls/listbox.c]
Fixed Winfile extended selection bug.
* [files/directory.c]
Changed DIR_SearchPath to return both long and short file names.
* [files/dos_fs.c]
Implemented VFAT ioctl to retrieve the original short filenames
from a VFAT filesystem (Linux only for now).
Replaced DOSFS_GetUnixFileName()/DOSFS_GetDosTrueName() by
DOS_GetFullName().
Properly implemented GetShortPathName() and GetFullPathName().
Made all functions re-entrant.
* [files/file.c] [misc/main.c]
Replaced -allowreadonly option by -failreadonly. The default is
now to report success when opening a read-only file for writing.
* [objects/metafile.c]
Fixed bug in DIB bitmaps pointer calculation.
* [scheduler/process.c]
Implemented environment strings and Get/SetStdHandle with process
environment block.
* [tools/build.c]
Rewrote BuildContext32() to avoid instructions that may not be
supported by all assemblers.
Fri Jan 10 17:11:09 1997 David Faure <david.faure@ifhamy.insa-lyon.fr>
* [windows/event.c]
Created table keyc2vkey, which associate a vkey(+extended bit) to
any keycode. Changed EVENT_event_to_vkey to use this table to
return the correct vkey. Changed EVENT_ToAscii to get the keycode
from this table too. Assigned OEM specific vkeys arbitrarily.
Fri Jan 10 09:26:17 1997 John Harvey <john@division.co.uk>
* [misc/winsock.c] [misc/winsoc_async.c]
Fixed svr4 header files.
Changed bzero() to memset().
* [tools/fnt2bdf.c]
Removed bcopy() and used memcpy() instead.
* [debugger/msc.c]
Include string.h instead of strings.h
* [debugger/stabs.c]
Include string.h instead of strings.h.
Define __ELF__ for svr4 systems.
* [loader/signal.c]
Use wait() instead of wait4() which doesnt exist on Unixware.
* [memory/global.c]
Use sysconf() instead of getpagesize() for svr4 systems.
Thu Jan 9 21:07:20 1997 Robert Pouliot <krynos@clic.net>
* [Make.rules.in] [Makefile.in] [make_os2.sh] [rc/Makefile.in]
[tools/Makefile.in] [documentation/wine_os2.txt]
Patches for OS/2 support. Note that it doesn't compile yet.
Tue Jan 7 20:03:53 1997 Eric Youngdale <eric@sub2304.jic.com>
* [debugger/*]
Many more debugger improvements (see debugger/README for details).
Tue Jan 7 15:12:21 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [windows/graphics.c] [objects/text.c] [graphics/x11drv/*]
[graphics/metafiledrv/*]
Moved some device dependent code into the resp. subdirs.
* [include/gdi.h] [include/metafiledrv.h] [include/x11drv.h]
Prototypes added,
DC_FUNCTIONS: GetPixel added, some unnecessary functions removed.
* [objects/region.c]
CreatePolyPolygonRgn32 added.
* [files/dos_fs.c]
QueryDosDevice added.
* [misc/lstr.c]
FormatMessage: broken heap management fixed.
* [scheduler/process.c] [scheduler/thread.c]
Get/SetThreadPriority/PriorityClass added.
Mon Jan 6 21:55:30 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* [misc/keyboard.c]
ToAscii : Use EVENT_ToAscii instead.
* [windows/event.c]
keypad_key : Do not convert XK_Mode_switch to VK_MENU; recognize
keypad cursor keys.
EVENT_event_to_vkey : New function, to transform a X keycode
into a MSwin vkey + extended bit.
EVENT_ToAscii : New function, to transform a vkey + extended bit
(+ key state table) into ascii char(s), using XLookupString, and
recognizing dead chars.
EVENT_key : Transform AltGr into Ctrl+Alt sequence; call
EVENT_event_to_vkey for keycode to vkey conversion; fixed
previous, context and extended bits.
* [windows/keyboard.c]
Include stddebug.h, to get -debugmsg messages.
GetKeyState : Handle VK_MBUTTON case.
GetKeyboardState, SetKeyboardState : Debugging messages added.
* [windows/message.c]
TranslateMessage : Handle dead chars.
Mon Jan 6 20:10:11 1997 Dominik Strasser <bm424953@muenchen.org>
* [if1632/crtdll.spec] [misc/crtdll.c]
C++ functions new/delete/set_new_handler implemented.
Mon Jan 6 15:48:15 1997 Frans van Dorsselaer <dorssel@rulhmpc49.LeidenUniv.nl>
* [controls/edit.c] [include/windows.h]
Moved the edit control to 32 bits.
Included new (win95) message definitions in windows.h
Implemented EM_SCROLLCARET, EM_SETMARGINS, EM_GETMARGINS,
EM_GETLIMITTEXT, EM_POSFROMCHAR, EM_CHARFROMPOS.
Broke EM_SETWORDBREAKPROC (internal wordwrap still works).
Fixed some bugs, introduced a couple of others.
Text buffer is now initially in 32-bit heap.
* [controls/EDIT.TODO] [controls/combo.c] [controls/widgets.c]
[if1632/wprocs.spec] [library/miscstubs.c] [windows/defdlg.c]
[misc/commdlg.c]
Updated to work with 32-bit edit control.
Sat Jan 4 22:07:27 1997 O.Flebbe <O.Flebbe@science-computing.uni-tuebingen.de>
* [loader/pe_image.c]
Use mmap rather then malloc. Better workaround for clean
segments.
----------------------------------------------------------------------
Wed Jan 1 15:36:17 1997 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -31,9 +31,9 @@ DIVINCL = -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include -I$(SRCDIR) -I.
ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
LDCOMBINE = ld -r
RM = rm -f
BUILD = $(TOPOBJDIR)/tools/build
MAKEDEP = $(TOPOBJDIR)/tools/makedep
WINERC = $(TOPOBJDIR)/rc/winerc
BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
WINESTUB = $(TOPOBJDIR)/library/winestub.o
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
@SET_MAKE@
@ -72,12 +72,17 @@ OBJS = $(GEN_C_SRCS:.c=.o) $(C_SRCS:.c=.o) \
# Rule to rebuild resource compiler
$(WINERC) check_winerc:
cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc
cd $(TOPOBJDIR)/rc; $(SUBMAKE) winerc@PROGEXT@
# Rule to rebuild the makedep program
# Rule to rebuild the 'makedep' program
$(MAKEDEP) check_makedep:
cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep
cd $(TOPOBJDIR)/tools; $(SUBMAKE) makedep@PROGEXT@
# Rule to rebuild the 'build' program
$(BUILD) checkbuild:
cd $(TOPOBJDIR)/tools; $(SUBMAKE) build@PROGEXT@
# Rule for main module

190
configure vendored
View File

@ -550,6 +550,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# We want these before the checks, so the checks can modify their values.
test -z "$LDLIBS" && LDLIBS=-lm
test -z "$PROGEXT" && PROGEXT=""
# Check whether --with-library or --without-library was given.
@ -580,7 +581,7 @@ fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:584: checking whether ${MAKE-make} sets \${MAKE}" >&5
echo "configure:585: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -609,7 +610,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:613: checking for $ac_word" >&5
echo "configure:614: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -638,7 +639,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:642: checking for $ac_word" >&5
echo "configure:643: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -686,7 +687,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:690: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:691: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -696,11 +697,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
#line 700 "configure"
#line 701 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -720,12 +721,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:724: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:725: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:729: checking whether we are using GNU C" >&5
echo "configure:730: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -734,7 +735,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -749,7 +750,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:753: checking whether ${CC-cc} accepts -g" >&5
echo "configure:754: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -777,7 +778,7 @@ else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:781: checking how to run the C preprocessor" >&5
echo "configure:782: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -792,13 +793,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 796 "configure"
#line 797 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -809,13 +810,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 813 "configure"
#line 814 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:820: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -842,7 +843,7 @@ echo "$ac_t""$CPP" 1>&6
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
echo "configure:846: checking for X" >&5
echo "configure:847: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@ -904,12 +905,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
#line 908 "configure"
#line 909 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -978,14 +979,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 982 "configure"
#line 983 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
if { (eval echo configure:989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@ -1091,17 +1092,17 @@ else
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
echo "configure:1095: checking whether -R must be followed by a space" >&5
echo "configure:1096: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
#line 1098 "configure"
#line 1099 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_R_nospace=yes
else
@ -1117,14 +1118,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
#line 1121 "configure"
#line 1122 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_R_space=yes
else
@ -1156,7 +1157,7 @@ rm -f conftest*
# 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 dnet_ntoa in -ldnet""... $ac_c" 1>&6
echo "configure:1160: checking for dnet_ntoa in -ldnet" >&5
echo "configure:1161: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1164,7 +1165,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1168 "configure"
#line 1169 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1175,7 +1176,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1197,7 +1198,7 @@ fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
echo "configure:1201: checking for dnet_ntoa in -ldnet_stub" >&5
echo "configure:1202: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1205,7 +1206,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1209 "configure"
#line 1210 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1216,7 +1217,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1245,12 +1246,12 @@ fi
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
echo "configure:1249: checking for gethostbyname" >&5
echo "configure:1250: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1254 "configure"
#line 1255 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@ -1273,7 +1274,7 @@ gethostbyname();
; return 0; }
EOF
if { (eval echo configure:1277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@ -1294,7 +1295,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
echo "configure:1298: checking for gethostbyname in -lnsl" >&5
echo "configure:1299: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1302,7 +1303,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1306 "configure"
#line 1307 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1313,7 +1314,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
if { (eval echo configure:1317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1343,12 +1344,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
echo "configure:1347: checking for connect" >&5
echo "configure:1348: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1352 "configure"
#line 1353 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@ -1371,7 +1372,7 @@ connect();
; return 0; }
EOF
if { (eval echo configure:1375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@ -1392,7 +1393,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
echo "configure:1396: checking for connect in -lsocket" >&5
echo "configure:1397: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1400,7 +1401,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1404 "configure"
#line 1405 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1411,7 +1412,7 @@ int main() {
connect()
; return 0; }
EOF
if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1435,12 +1436,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
echo "configure:1439: checking for remove" >&5
echo "configure:1440: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1444 "configure"
#line 1445 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@ -1463,7 +1464,7 @@ remove();
; return 0; }
EOF
if { (eval echo configure:1467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@ -1484,7 +1485,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
echo "configure:1488: checking for remove in -lposix" >&5
echo "configure:1489: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1492,7 +1493,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1496 "configure"
#line 1497 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1503,7 +1504,7 @@ int main() {
remove()
; return 0; }
EOF
if { (eval echo configure:1507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1527,12 +1528,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
echo "configure:1531: checking for shmat" >&5
echo "configure:1532: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1536 "configure"
#line 1537 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@ -1555,7 +1556,7 @@ shmat();
; return 0; }
EOF
if { (eval echo configure:1559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@ -1576,7 +1577,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
echo "configure:1580: checking for shmat in -lipc" >&5
echo "configure:1581: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1584,7 +1585,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1588 "configure"
#line 1589 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1595,7 +1596,7 @@ int main() {
shmat()
; return 0; }
EOF
if { (eval echo configure:1599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1628,7 +1629,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
echo "configure:1632: checking for IceConnectionNumber in -lICE" >&5
echo "configure:1633: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1636,7 +1637,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1640 "configure"
#line 1641 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1647,7 +1648,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
if { (eval echo configure:1651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1676,7 +1677,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1680: checking for $ac_word" >&5
echo "configure:1681: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1708,7 +1709,7 @@ test -n "$YACC" || YACC="yacc"
# Extract the first word of "flex", so it can be a program name with args.
set dummy flex; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1712: checking for $ac_word" >&5
echo "configure:1713: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1741,7 +1742,7 @@ then
*) ac_lib=l ;;
esac
echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
echo "configure:1745: checking for yywrap in -l$ac_lib" >&5
echo "configure:1746: checking for yywrap in -l$ac_lib" >&5
ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1749,7 +1750,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1753 "configure"
#line 1754 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1760,7 +1761,7 @@ int main() {
yywrap()
; return 0; }
EOF
if { (eval echo configure:1764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1785,7 +1786,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1789: checking for $ac_word" >&5
echo "configure:1790: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1822,7 +1823,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1826: checking for a BSD compatible install" >&5
echo "configure:1827: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1872,7 +1873,7 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking for i386_set_ldt in -li386""... $ac_c" 1>&6
echo "configure:1876: checking for i386_set_ldt in -li386" >&5
echo "configure:1877: checking for i386_set_ldt in -li386" >&5
ac_lib_var=`echo i386'_'i386_set_ldt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -1880,7 +1881,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-li386 $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1884 "configure"
#line 1885 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1891,7 +1892,7 @@ int main() {
i386_set_ldt()
; return 0; }
EOF
if { (eval echo configure:1895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1917,7 +1918,7 @@ if test "x${GCC}" = "xyes"
then
CFLAGS="$CFLAGS -Wall"
echo $ac_n "checking "for gcc strength-reduce bug"""... $ac_c" 1>&6
echo "configure:1921: checking "for gcc strength-reduce bug"" >&5
echo "configure:1922: checking "for gcc strength-reduce bug"" >&5
if eval "test \"`echo '$''{'ac_cv_c_gcc_strength_bug'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1925,7 +1926,7 @@ else
ac_cv_c_gcc_strength_bug="yes"
else
cat > conftest.$ac_ext <<EOF
#line 1929 "configure"
#line 1930 "configure"
#include "confdefs.h"
int main(void) {
@ -1936,7 +1937,7 @@ int main(void) {
exit( Array[1] != -2 );
}
EOF
if { (eval echo configure:1940: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
if { (eval echo configure:1941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_gcc_strength_bug="no"
else
@ -1959,7 +1960,7 @@ fi
echo $ac_n "checking "whether external symbols need an underscore prefix"""... $ac_c" 1>&6
echo "configure:1963: checking "whether external symbols need an underscore prefix"" >&5
echo "configure:1964: checking "whether external symbols need an underscore prefix"" >&5
if eval "test \"`echo '$''{'ac_cv_c_extern_prefix'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1971,14 +1972,14 @@ _ac_test:
.long 0
EOF
cat > conftest.$ac_ext <<EOF
#line 1975 "configure"
#line 1976 "configure"
#include "confdefs.h"
extern int ac_test;
int main() {
if (ac_test) return 1
; return 0; }
EOF
if { (eval echo configure:1982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:1983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_c_extern_prefix="yes"
else
@ -2004,21 +2005,21 @@ fi
if test "$MAIN_TARGET" = "libwine.so.1.0"
then
echo $ac_n "checking "whether we can build a dll"""... $ac_c" 1>&6
echo "configure:2008: checking "whether we can build a dll"" >&5
echo "configure:2009: checking "whether we can build a dll"" >&5
if eval "test \"`echo '$''{'ac_cv_c_dll'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
saved_cflags=$CFLAGS
CFLAGS="$CFLAGS -fPIC -shared -Wl,-soname,conftest.so.1.0"
cat > conftest.$ac_ext <<EOF
#line 2015 "configure"
#line 2016 "configure"
#include "confdefs.h"
int main() {
return 1
; return 0; }
EOF
if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_cv_c_dll="yes"
else
@ -2045,12 +2046,12 @@ fi
for ac_func in memmove tcgetattr usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2049: checking for $ac_func" >&5
echo "configure:2050: checking for $ac_func" >&5
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 <<EOF
#line 2054 "configure"
#line 2055 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -2073,7 +2074,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:2078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -2098,12 +2099,12 @@ fi
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
echo "configure:2102: checking whether stat file-mode macros are broken" >&5
echo "configure:2103: checking whether stat file-mode macros are broken" >&5
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 <<EOF
#line 2107 "configure"
#line 2108 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -2154,12 +2155,12 @@ EOF
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
echo "configure:2158: checking for working const" >&5
echo "configure:2159: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2163 "configure"
#line 2164 "configure"
#include "confdefs.h"
int main() {
@ -2208,7 +2209,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:2212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:2213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -2229,12 +2230,12 @@ EOF
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:2233: checking for ANSI C header files" >&5
echo "configure:2234: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2238 "configure"
#line 2239 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -2242,7 +2243,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2247: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -2259,7 +2260,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
#line 2263 "configure"
#line 2264 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -2277,7 +2278,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
#line 2281 "configure"
#line 2282 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -2298,7 +2299,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 2302 "configure"
#line 2303 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -2309,7 +2310,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:2313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@ -2333,12 +2334,12 @@ EOF
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:2337: checking for size_t" >&5
echo "configure:2338: checking for size_t" >&5
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 <<EOF
#line 2342 "configure"
#line 2343 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2531,6 +2532,7 @@ s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@LDLIBS@%$LDLIBS%g
s%@PROGEXT@%$PROGEXT%g
s%@MAIN_TARGET@%$MAIN_TARGET%g
s%@OPTIONS@%$OPTIONS%g
s%@SET_MAKE@%$SET_MAKE%g

View File

@ -8,6 +8,7 @@ AC_CONFIG_AUX_DIR(tools)
# We want these before the checks, so the checks can modify their values.
test -z "$LDLIBS" && LDLIBS=-lm AC_SUBST(LDLIBS)
test -z "$PROGEXT" && PROGEXT="" AC_SUBST(PROGEXT)
dnl **** Command-line arguments ****

View File

@ -4,25 +4,48 @@ in doing actual work on edit.c only C & D will be of interest to you.
A) basic policy
B) special functions
C) not implemented
D) known bugs
C) not implemented / implementation ideas / implementation problems
D) known bugs / features
A) Basic Policy
All messages are handled by EditWndProc(), which is the only external
function call. All other functions are static (local to edit.c).
All Windows Messages (WM_XXX) are 32-bit, since the edit control is now a
32-bit registered class. The message are dealt with through the helper
functions EDIT_WM_XXX().
The edit control messages can be either 16 or 32 bit, depending on the type
of application that sends the message. Wherever possible EditWndProc()
converts the 16-bit message parameters to parameters corresponding to their
32-bit counterparts. The message is then handled by the appropriate
EDIT_EM_XXX() helper function. Sometimes it is not possible to handle the
16-bit and 32-bit versions in the same way, in which case both helper
functions EDIT_EM_XXX16() and EDIT_EM_XXX() are defined.
All other functions are called EDIT_XXX().
Note: Sometimes a function is internally used a bit different than the specs
of a similar function. For instance EDIT_SetSel() is used internally and
should not be mixed up with EDIT_EM_SetSel(), a message handler that _does_
conform to the specs of EM_SETSEL.
The code has been made in such a way, that functions try to call other
(documented) functions if that is sufficient. This might sometimes not be
the most efficient way, but it keeps the code clear. This way I tried to keep
the number of functions that rely on the internal EDITSTATE structure as
low as possible. For instance EDIT_WM_Cut() simply calls EDIT_WM_Copy() and
EDIT_WM_Clear(). The latter two are well documented message handlers, so
as long as they are right EDIT_WM_Cut() will never have to change again.
the most efficient way, but it keeps the code clear. This way I tried to
keep the number of functions that rely on the internal EDITSTATE structure
as low as possible. For instance EDIT_WM_Cut() simply calls EDIT_WM_Copy()
and EDIT_WM_Clear(). The latter two are well documented message handlers,
so as long as they are right EDIT_WM_Cut() will never have to change again.
Example:
The best thing to do, when you want to know the offset of line 3, is calling
EDIT_EM_LineIndex(). Again this is a well documented message handler. Don't
look at es->LineDefs[2].offset. It would just be another reference to the
internal structure, and that would make it more difficult to change things.
Refer to EDIT_WM_???? and EDIT_EM_????? functions as much as possible.
EDIT_EM_LineIndex(). Again this is a well documented message handler.
Don't look at es->LineDefs[2].offset. It would just be another reference to
the internal structure, and that would make it more difficult to change
things. Refer to EDIT_WM_???? and EDIT_EM_????? functions as much as
possible.
The WND * pointer is used internally whenever possible. Although it is not
the real HWND, it improves performance enough to use it.
@ -33,20 +56,35 @@ faster. Although sometimes the response time might appear to be slow, it
would be much slower even, when everything would be painted instantly. This
is especially true for scrollbar tracking and selection changes..
The text buffer is a kind of tricky. Initially the edit control allocates a
HLOCAL32 buffer (32 bit linear memory handler). However, 16 bit application
might send a EM_GETHANDLE message and expect a HLOCAL16 (16 bit SEG:OFF
handler). From that moment on we have to keep using this 16 bit memory
handler, because it is supposed to be valid at all times after EM_GETHANDLE.
What we do is create a HLOCAL16 buffer, copy the text, and do pointer
conversion.
B) Special functions
The edit control needs to use local heap memory because applications may
rely on EM_GETHANDLE. This is bad, but it can't be helped, we have to live
with that. For this reason there is a nice EDIT_GetPointer() function,
which locks the heap buffer *only once*, no matter how often it is called.
Only at the end of the message handler EDIT_ReleasePointer() is called. You
don't have to worry about unlocking the heap. Calling EDIT_GetPointer() is
very fast if the buffer is already locked.
This way, the buffer gets locked / unlock only once every message, although
EDIT_GetPointer() may actually have been called a hundred times.
Only when the actual HLOCAL is needed (for example to ReAlloc), a call to
Several helper functions try to make your life easier when dealing with the
allocated buffer. In principle Windows can move memory blocks around unless
they are locked. Currently, WINE doesn't do this, but it might in the
future.
For this reason there is a nice EDIT_GetPointer() function, which locks the
heap buffer *only once*, no matter how often it is called. It then returns a
nice 32-bit pointer to linear memory. Calling EDIT_GetPointer() is very fast
if the buffer is already locked, so you can call it whenever you feel it
*might* be useful.
At the end of EditWndProc(), EDIT_ReleasePointer() is automatically called
which cleans up the initialized pointer. So you don't have to worry about
unlocking the memory block. This way, the buffer gets locked / unlock only
once every message, although EDIT_GetPointer() may actually have been called
a hundred times. Only when the actual HLOCAL is needed (for example to
ReAlloc), an extra call (besides the cleanup at the end of EditWndProc()) to
EDIT_ReleasePointer() is needed. Look for instance in EDIT_MakeFit().
This brings us to EDIT_MakeFit(). It automatically re-allocates the buffer
@ -55,6 +93,9 @@ returned, otherwise FALSE. Only when the buffer contents may grow you need
to call EDIT_MakeFit(). Currently this is only in EDIT_ReplaceSel() and
EDIT_WM_SetText().
EDIT_GetPointer(), EDIT_ReleasePointer and EDIT_MakeFit() are aware of the
HLOCAL32 / HLOCAL16 business.
EDIT_BuildLineDefs() is the most important function in edit.c. It builds
the internal EDITSTATE structure. As soon as text *might* have changed, or
when the appearance of the text on the screen *might* have changed, call
@ -64,47 +105,93 @@ rely on the stuff this function builds.
C) Not Implemented
C) Not Implemented / Implementation Ideas / Implementation Problems
Styles:
- ES_PASSWORD
- ES_CENTER
- ES_RIGHT
- EM_SETRECT
- EM_SETRECTNP
- EM_FMTLINES
- ES_AUTOVSCROLL (every multi line *is* auto vscroll)
- ES_AUTOHSCROLL (multi line can be yes or no, but single line only yes)
- WM_UNDO (=EM_UNDO)
- EM_CANUNDO
- EM_SCROLL (scrolling works, but this appears to be an undocumented message)
- ES_LOWERCASE
- ES_UPPERCASE
- ES_NUMBER (new since win95)
- ES_OEMCONVERT
- ES_WANTRETURN
- probably much, MUCH more
I encountered several undocumented messages, or message parameters.
EditWndProc() reports any unknown message with an id > WM_USER.
None of these should be difficult to include. I just didn't have the time
yet. Feel free ...
- ES_AUTOVSCROLL (every multi line control *is* auto vscroll)
- ES_AUTOHSCROLL (every single line control *is* auto hscroll)
(for multi line controls it works : wordwrap)
Much, much more difficult. It comes down to this: When there is no
autoscrolling, the edit control should first check whether the new text
(after a typed key for instance) would fit. If not, an EN_MAXTEXT should be
sent. However, currently this would require the actual change to be made,
then call EDIT_BuildLineDefs() and then find out that the new text doesn't
fit. After all this, things should be put back in the state before the
changes. Given the fact that even normal UNDO doesn't work ...
Messages:
- EM_SETRECT
- EM_SETRECTNP
- EM_SETMARGINS (new since win95)
- EM_FMTLINES
These shouldn't be really difficult either. They just confine the visual
output to something different than the client rectangle. Currently the
client area is used everywhere in the code. At some points this should
really be so (GetClientRect32()), whereas at other points it should be the
format rectangle (EDIT_EM_GetRect()). Both functions are now used, but
inconsistently and mixed up ! If you implement the formatting rectangle /
margins, be sure to check all references to RECT's, and how they are /
should be obtained.
- EM_FMTLINES
This means: insert or remove the soft linebreak character (\r\r\n). Probably
invented by MS to suit their implementation of the edit control. However,
with WINE's implementation I've never come up with occasions where it is
actually useful (we never insert \r\r\n, and applications always request
removal). If you are a purist ... implementation shouldn't be difficult.
Take care to check if the text still fits the buffer after insertion. If
not, notify with EN_ERRSPACE.
- WM_UNDO (=EM_UNDO)
I'm working on it. It is, however, not trivial. Luckily the only function
where actual text changes is EM_REPLACESEL, so this is the only spot where
we have to worry about UNDO capabilities. Before you try: contact me. I
already have ideas and might start implementing it myself really soon.
- EM_SETWORDBREAKPROC
Not really difficult. It used to work, but since we moved to 32 bits there
are now two kinds of callback functions. And I don't know the 32-bit specs
for the WordBreakProc() ... Look it up and uncomment the code that is still
there for 16 bit callback.
- EM_SCROLL
Supposed to be the same as WM_VSCROLL, but not quite. In other words:
poorly documented. Somebody that knows ?
D) Known bugs.
D) Known bugs / Features
- Scrolling is weird, sometimes. The current code makes the scrollbar
of Notepad work, but the scrollbar code itself is broken. Currently
the scroll code of edit.c is *not* according to specs. Instead, it
is according to the broken scrollbar code. If that gets fixed, this
should be fixed, too.
- The clipboard is broken. Whenever things go wrong with
cut/copy/paste, it is probably the clipboard that messes up things,
not edit.c.
- Turning on WordWrap with Notepad leaves part of the horizontal
- The control still calls GetTabbedTextExtent() and TabbedTextOut() in
their 16 bit version (since the 32 bit versions don't yet exist).
Therefore the tab list is 16 bits (should be 32).
- Scrollbar tracking is broken.
- Lots of API calls are to 16 bit functions, because their 32 bit
versions haven't been implemented yet (e.g. clipboard).
- Turning on WordWrap with 16-bit Notepad leaves part of the horizontal
scrollbar visible (problem with WM_ERASEBKGND ???).
- FIXME's (grep for them).
I am still very actively changing things. Especially I am working
on Undo capabilities. If you want to do things, other than bug fixes,
please mail me so we can synchronize.
I am working on Undo capabilities. If you want to do things, other than bug
fixes, please mail me so we can synchronize.
Frans van Dorsselaer
dorssel@rulhm1.LeidenUniv.nl

View File

@ -756,7 +756,7 @@ static LRESULT CBGetEditSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
if ((lphc->dwStyle & 3) == CBS_DROPDOWNLIST)
return CB_ERR; /* err, documented for CBSetEditSel */
return SendMessage16(lphc->hWndEdit, EM_GETSEL, 0, 0);
return SendMessage16(lphc->hWndEdit, EM_GETSEL16, 0, 0);
}
@ -770,7 +770,7 @@ static LRESULT CBSetEditSel(HWND hwnd, WPARAM16 wParam, LPARAM lParam)
if ((lphc->dwStyle & 3) == CBS_DROPDOWNLIST)
return CB_ERR;
return SendMessage16(lphc->hWndEdit, EM_SETSEL, 0, lParam);
return SendMessage16(lphc->hWndEdit, EM_SETSEL16, 0, lParam);
}
/***********************************************************************

File diff suppressed because it is too large Load Diff

View File

@ -1487,7 +1487,7 @@ LRESULT LISTBOX_Directory( WND *wnd, LB_DESCR *descr, UINT32 attrib,
if (long_names) strcpy( buffer, entry.cFileName );
else strcpy( buffer, entry.cAlternateFileName );
}
if (!long_names) AnsiLower( buffer );
if (!long_names) CharLower32A( buffer );
pos = LISTBOX_FindFileStrPos( wnd, descr, buffer );
if ((ret = LISTBOX_InsertString( wnd, descr, pos, buffer )) < 0)
break;
@ -2206,8 +2206,12 @@ LRESULT ListBoxWndProc(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case LB_SELITEMRANGE16:
case LB_SELITEMRANGE32:
return LISTBOX_SelectItemRange( wnd, descr, LOWORD(lParam),
HIWORD(lParam), wParam );
if (LOWORD(lParam) <= HIWORD(lParam))
return LISTBOX_SelectItemRange( wnd, descr, LOWORD(lParam),
HIWORD(lParam), wParam );
else
return LISTBOX_SelectItemRange( wnd, descr, HIWORD(lParam),
LOWORD(lParam), wParam );
case LB_SELITEMRANGEEX16:
case LB_SELITEMRANGEEX32:

File diff suppressed because it is too large Load Diff

View File

@ -23,10 +23,7 @@
#include "windows.h"
#include "win.h"
#include "gdi.h"
#include "msdos.h"
#include "listbox.h"
#include "dos_fs.h"
#include "drive.h"
#include "heap.h"
#include "stddebug.h"
#include "debug.h"
@ -698,81 +695,6 @@ int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex)
LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec)
{
#if 0
char mask[13];
char* temp = NULL;
const char* ptr;
int skip, count;
LONG ret;
DOS_DIRENT entry;
char *path, *p;
dprintf_listbox(stddeb, "ListBoxDirectory: '%s' %04x\n", filespec, attrib);
if (!filespec) return LB_ERR;
if (!(ptr = DOSFS_GetUnixFileName( filespec, FALSE ))) return LB_ERR;
path = xstrdup(ptr);
p = strrchr( path, '/' );
*p++ = '\0';
if (!(ptr = DOSFS_ToDosFCBFormat( p )) ||
!(temp = SEGPTR_ALLOC( sizeof(char) * 16 )) )
{
free( path );
return LB_ERR;
}
strcpy( mask, ptr );
dprintf_listbox(stddeb, "ListBoxDirectory: path=%s mask=%s\n", path, mask);
skip = ret = 0;
attrib &= ~FA_LABEL;
while ((count = DOSFS_FindNext( path, mask, NULL, 0,
attrib, skip, &entry )) > 0)
{
skip += count;
if (entry.attr & FA_DIRECTORY)
{
if ((attrib & DDL_DIRECTORY) && strcmp(entry.name, ". "))
{
sprintf(temp, "[%s]", DOSFS_ToDosDTAFormat( entry.name ) );
AnsiLower( temp );
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
}
else /* not a directory */
{
if (!(attrib & DDL_EXCLUSIVE) ||
((attrib & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE)) ==
(entry.attr & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE))))
{
strcpy( temp, DOSFS_ToDosDTAFormat( entry.name ) );
AnsiLower( temp );
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
}
dprintf_listbox(stddeb,"\tn - %i, file '%s'\n", count, temp);
}
if (attrib & DDL_DRIVES)
{
int x;
DWORD oldstyle = lphl->dwStyle;
lphl->dwStyle &= ~LBS_SORT;
strcpy( temp, "[-a-]" );
for (x = 0; x < MAX_DOS_DRIVES; x++, temp[2]++)
{
if (DRIVE_IsValid(x))
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
lphl->dwStyle = oldstyle;
}
free( path );
SEGPTR_FREE( temp );
return ret;
#endif
return 0;
}

View File

@ -18,8 +18,12 @@
/* Window procedures */
extern LRESULT EditWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT ListBoxWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT PopupMenuWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
/* Win16 class info */
@ -42,12 +46,6 @@ static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
8, 0, "ComboBoxWndProc", "ComboBox" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
8, 0, "ComboLBoxWndProc", "ComboLBox" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
sizeof(DWORD), 0, "EditWndProc", "Edit" },
{ CS_GLOBALCLASS | CS_SAVEBITS,
sizeof(HMENU32), 0, "PopupMenuWndProc", POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS,
DLGWINDOWEXTRA, 0, "DefDlgProc", DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, sizeof(MDICLIENTINFO),
STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDIClient" }
};
@ -61,12 +59,18 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
{
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "Button" },
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
EditWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "Edit" },
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
ListBoxWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "ListBox" },
{ CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc,
0, sizeof(HMENU32), 0, 0, 0, 0, 0, POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, 0, 0, 0, "ScrollBar"},
{ CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, 0, DESKTOP_CLASS_NAME }
0, 0, 0, 0, 0, DESKTOP_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc32A, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, 0, DIALOG_CLASS_NAME }
};
#define NB_BUILTIN_CLASSES32 \

View File

@ -8,14 +8,18 @@ MODULE = debugger
C_SRCS = \
break.c \
db_disasm.c \
display.c \
editline.c \
expr.c \
hash.c \
info.c \
memory.c \
msc.c \
registers.c \
source.c \
stabs.c \
stack.c
stack.c \
types.c
GEN_C_SRCS = \
y.tab.c \
@ -23,6 +27,12 @@ GEN_C_SRCS = \
all: $(MODULE).o
#
# This is a special test program that helps debug the internal debugger.
#
debug: $(MODULE).o dbgmain.o ../misc/xmalloc.o
$(CC) -o debug $(MODULE).o dbgmain.o ../misc/xmalloc.o
@MAKE_RULES@
y.tab.c y.tab.h: dbg.y

View File

@ -1,17 +1,423 @@
This is the core of the Wine debugger. Many pieces have been
shamelessly stolen - the reverse assember was stolen from gdb more or
shamelessly stolen - the reverse assember was stolen from Mach more or
less intact. It turns out that there are two variables that are set
differently if you are reverse assembling 16 bit code, and on the
whole it seems to work. There may be bugs for all I know.
whole it seems to work.
As far as non-linux systems are concerned, I simply ripped off
the linux configuration files from gdb. Other systems may be close
enough for these to work properly, but some tweaking may be required.
NEWS:
I apologize for the non-portability of this, but I wrote the
whole thing in about 4 hours, most of the time spent debugging a
stupid mistake in the parser.
The internal debugger has *tons* more capability than it did before.
I have enclosed some examples that show usage at the end of this file.
New features include:
-Eric
1) Ability of debugger to read debug information from wine executable
*and* from Win32 executables. Local variable and line number information is
also read and processed.
2) The internal debugger is capable of 'stepping' to the next
line number, just like gdb. Examples of the commands are:
step
stepi
si
step 3
si 5
next
nexti
cont 4
finish
All of these should be exactly like how gdb does things.
3) The internal debugger now has a sense of what source file and line
number a given PC is at. New commands to support this are just like gdb,
and include:
list
dir
show dir
there are a variety of formats of arguments for the list command. All
permutations supported by gdb should also be supported.
4) The internal debugger knows about datatypes of various objects,
for both Win32 *and* the debugging information in the wine executable itself.
I have enclosed an example of how this works at the end.
5) There are more ways the 'b' command can be used to set breakpoints.
Examples are:
b *0x8190000
b 1100
b Usage
b
I don't think this covers all of the permutations that gdb accepts (this should
be cleaned up someday so that all possibilities are acceptable).
6) The 'print' and 'x' commands should behave more or less exactly
as they do under gdb. The difference is that the way the data is presented
will be slightly different, but the content should be fundamentally the same.
7) The internal debugger now supports conditional breakpoints, and
automatic display expressions. An example is at the end of this file. The
syntax and usage should be identical to that of gdb.
NOTES:
If it weren't for the fact that gdb doesn't grok the Win32 debug
information, you could just use gdb. The internal debugger should be able
to read and use debugging information for both Win32 and also for the
Wine executable, making it possible to debug the combination of the two
together as if it were one large (very large) entity.
LIMITATIONS AND DIFFERENCES FROM GDB:
You cannot use type casts in expressions that you give to the
debugger. The hardest part about adding support for this is fixing
the parser/lexer to know when it is handling a type cast, and when it
is handling any other type of parenthesized expression. With lexer
states, it may be possible to keep track of what we would expect at
any given moment, but it would be tedious to go through and make sure
that the state is set up correctly for all of the different operators
and characters that we accept, and I am not yet convinced that this would
even work.
You cannot set a breakpoint by file and line number as you can
with gdb. Adding support for this wouldn't be all that tough, I guess, but
it would be a nuisance. You can set a breakpoint given a function and
line number, however. An example would be 'b main:2993'. It turns out
that the way the internal data structures are arranged it is a whole lot
easier to do things in this way than it would be to try and get the
source:line type of breakpoint working, but it would probably be worth it
to try.
Getting stack traces through Wine itself can be a bit tricky.
This is because by default the thing is built with optimization
enabled, and as a result sometimes functions don't get frames, and
lots of variables are optimized into registers. You can turn off
optimization for a few key source files if it will help you.
Memory consumption is getting to be a real problem. I think 32Mb is
no longer sufficient to debug wine - 48 or 64 is probably a whole lot better.
Unfortunately I cannot shut down X to save memory :-).
*************************************************************************
EXAMPLES:
Here is an example of how I tracked down a bug in Wine. The program
is something that just maps and dumps the contents of a Win32 executable.
It was dying for some reason.
Start the first time through.
bash$ ls -l dumpexe.exe
-rw-rw-r-- 1 eric devel 168448 Jan 4 13:51 dumpexe.exe
bash$ ./wine -debug './dumpexe.exe -symbol ./dumpexe.exe'
Warning: invalid dir 'e:\test' in path, deleting it.
Win32 task 'W32SXXXX': Breakpoint 1 at 0x081a3450
Loading symbols from ELF file ./wine...
Loading symbols from ELF file /usr/X11R6/lib/libXpm.so.4.6...
Loading symbols from ELF file /usr/X11R6/lib/libSM.so.6.0...
Loading symbols from ELF file /usr/X11R6/lib/libICE.so.6.0...
Loading symbols from ELF file /usr/X11R6/lib/libXext.so.6.0...
Loading symbols from ELF file /usr/X11R6/lib/libX11.so.6.0...
Loading symbols from ELF file /lib/libm.so.5.0.5...
Loading symbols from ELF file /lib/libc.so.5.2.18...
Loading symbols from ELF file /lib/ld-linux.so.1...
Loading symbols from Win32 file ./dumpexe.exe...
Stopped on breakpoint 1 at 0x081a3450 (_mainCRTStartup)
In 32 bit mode.
*** Invalid address 0x414c5ff8 (KERNEL32_NULL_THUNK_DATA+0x3930ee6c)
0x081a3450 (_mainCRTStartup): movl %fs:0,%eax
Wine-dbg>b DumpFile
Breakpoint 2 at 0x081a0078 (DumpFile+0x9 [dumpexe.c:2723])
Wine-dbg>c
Dump File: ./dumpexe.exe
Stopped on breakpoint 2 at 0x081a0078 (DumpFile+0x9 [dumpexe.c:2723])
Enter path to file dumpexe.c: ../de
2723 HANDLE hFile = NULL;
0x081a0078 (DumpFile+0x9 [dumpexe.c:2723]): movl $0x0,0xfffffff4(%ebp)
Wine-dbg>list
2723 HANDLE hFile = NULL;
2724 HANDLE hMap = NULL;
2725 PSTR lpMap = NULL;
2726 DWORD dwFileSize = 0;
2727 DWORD dwFileSizeHigh = 0;
2728
2729 PIMAGE_DOS_HEADER lpImageDOS = NULL;
2730 PIMAGE_FILE_HEADER lpImageFile = NULL;
2731 PIMAGE_NT_HEADERS lpImageNT = NULL;
2732
2733 /*
Wine-dbg>n 10
2747 dwFileSize = GetFileSize(hFile, &dwFileSizeHigh);
0x081a00ea (DumpFile+0x7b [dumpexe.c:2747]): leal 0xfffffff0(%ebp),%eax
Wine-dbg>n
2749 && (GetLastError() != NO_ERROR) )
0x081a00fb (DumpFile+0x8c [dumpexe.c:2749]): cmpl $-1,0xffffffe8(%ebp)
Wine-dbg>x/d dwFileSize
x/d dwFileSize
168448
Wine-dbg>n
2758 PAGE_READONLY, 0, 0, (LPSTR) NULL);
0x081a0124 (DumpFile+0xb5 [dumpexe.c:2758]): pushl $0x0
Wine-dbg>list 2750
list 2750
2750 {
2751 Fatal("Cannot get size of file %s", lpFileName);
2752 }
2753
2754 /*
2755 * map the file
2756 */
2757 hMap = CreateFileMapping(hFile, (LPSECURITY_ATTRIBUTES) NULL,
2758 PAGE_READONLY, 0, 0, (LPSTR) NULL);
2759 if( hMap == NULL )
2760 {
Wine-dbg>n
2759 if( hMap == NULL )
0x081a013b (DumpFile+0xcc [dumpexe.c:2759]): cmpl $0,0xfffffffc(%ebp)
Wine-dbg>x hMap
08e48c30
Wine-dbg>n
2767 lpMap = (LPSTR) MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
0x081a0156 (DumpFile+0xe7 [dumpexe.c:2767]): pushl $0x0
Wine-dbg>n
2768 if( lpMap == NULL )
0x081a016b (DumpFile+0xfc [dumpexe.c:2768]): cmpl $0,0xffffffe0(%ebp)
Wine-dbg>print lpMap
0x414c5f40
Wine-dbg>x lpMap
40007000
Wine-dbg> x/10x 0x40007000
x/10x 0x40007000
0x40007000 (KERNEL32_NULL_THUNK_DATA+0x37e4fe74): *** Invalid address 0x40007000 (KERNEL32_NULL_THUNK_DATA+0x37e4fe74)
Wine-dbg>quit
$
*******************************************************************
The first time through, we find that MapViewOfFile isn't mapping the file
correctly into the virtual address space. Try running again, and step into
MapViewOfFile to figure out what went wrong.
*******************************************************************
bash$ ./wine -debug './dumpexe.exe -symbol ./dumpexe.exe'
Warning: invalid dir 'e:\test' in path, deleting it.
Win32 task 'W32SXXXX': Breakpoint 1 at 0x081a3450
Loading symbols from ELF file ./wine...
Loading symbols from ELF file /usr/X11R6/lib/libXpm.so.4.6...
Loading symbols from ELF file /usr/X11R6/lib/libSM.so.6.0...
Loading symbols from ELF file /usr/X11R6/lib/libICE.so.6.0...
Loading symbols from ELF file /usr/X11R6/lib/libXext.so.6.0...
Loading symbols from ELF file /usr/X11R6/lib/libX11.so.6.0...
Loading symbols from ELF file /lib/libm.so.5.0.5...
Loading symbols from ELF file /lib/libc.so.5.2.18...
Loading symbols from ELF file /lib/ld-linux.so.1...
Loading symbols from Win32 file ./dumpexe.exe...
Stopped on breakpoint 1 at 0x081a3450 (_mainCRTStartup)
In 32 bit mode.
*** Invalid address 0x414c5ff8 (KERNEL32_NULL_THUNK_DATA+0x3930ee6c)
0x081a3450 (_mainCRTStartup): movl %fs:0,%eax
Wine-dbg>b DumpFile:2767
Breakpoint 2 at 0x081a0156 (DumpFile+0xe7 [dumpexe.c:2767])
Wine-dbg>c
Dump File: ./dumpexe.exe
Stopped on breakpoint 2 at 0x081a0156 (DumpFile+0xe7 [dumpexe.c:2767])
Enter path to file dumpexe.c: ../de
2767 lpMap = (LPSTR) MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0);
0x081a0156 (DumpFile+0xe7 [dumpexe.c:2767]): pushl $0x0
Wine-dbg>step
390 0385 stdcall MapViewOfFile(long long long long long) MapViewOfFile
0x080d793c (KERNEL32_385 [kernel32.spec:390]): pushl %ebp
Wine-dbg>step
223 if (!debugging_relay) return;
0x080c83dc (RELAY_DebugCallFrom32+0xc [relay.c:223]): cmpw $0,0x644a
Wine-dbg>
244 }
0x080c848e (RELAY_DebugCallFrom32+0xbe [relay.c:244]): leal 0xfffffff4(%ebp),%esp
Wine-dbg>
103 return MapViewOfFileEx(handle,access,offhi,offlo,size,0);
0x080911a4 (MapViewOfFile+0x14 [file.c:103]): pushl $0x0
Wine-dbg>
113 FILEMAP_OBJECT *fmap = (FILEMAP_OBJECT*)handle;
0x080911cf (MapViewOfFileEx+0xf [file.c:113]): movl 0x8(%ebp),%esi
Wine-dbg>n
115 if (!size) size = fmap->size;
0x080911d2 (MapViewOfFileEx+0x12 [file.c:115]): testl %ebx,%ebx
Wine-dbg>list
list
115 if (!size) size = fmap->size;
116 if (!size) size = 1;
117 return mmap ((caddr_t)st, size, fmap->prot,
118 MAP_ANON|MAP_PRIVATE,
119 FILE_GetUnixHandle(fmap->hfile),
120 offlo);
121 }
122
123 /***********************************************************************
124 * UnmapViewOfFile (KERNEL32.385)
125 */
Wine-dbg>x size
00000000
Wine-dbg>n
116 if (!size) size = 1;
0x080911d9 (MapViewOfFileEx+0x19 [file.c:116]): testl %ebx,%ebx
Wine-dbg>x size
00000000
Wine-dbg>n
117 return mmap ((caddr_t)st, size, fmap->prot,
0x080911e2 (MapViewOfFileEx+0x22 [file.c:117]): pushl %eax
Wine-dbg>x size
00000000
Wine-dbg>info local
MapViewOfFileEx:handle == 0x08e48c90
MapViewOfFileEx:access == 0x00000004
MapViewOfFileEx:offhi == 0x00000000
MapViewOfFileEx:offlo == 0x00000000
MapViewOfFileEx:size == 0x00000000
MapViewOfFileEx:st == 0x00000000
MapViewOfFileEx:offlo optimized into register $eax
MapViewOfFileEx:size optimized into register $ebx
MapViewOfFileEx:st optimized into register $edi
MapViewOfFileEx:fmap optimized into register $esi
Wine-dbg>print $ebx
0x0001
Wine-dbg>bt
bt
Backtrace:
=>0 0x080911e2 (MapViewOfFileEx+0x22 [file.c:117])
1 0x080911b0 (MapViewOfFile+0x20(handle=0x8e48c90, access=0x4, offhi=0x0, offlo=0x0, size=0x0) [file.c:104])
2 0x08104ab5 (CallFrom32_stdcall_5+0x25 [callfrom32.s])
3 0x081a0168 (DumpFile+0xf9(lpFileName=0x414c61ed) [dumpexe.c:2767])
4 0x081a0c35 (main+0x410(argc=0x3, argv=0x414c61cc) [dumpexe.c:3078])
5 0x081a3514 (_mainCRTStartup+0xc4)
6 0x0810549f (Code_Start+0x13 [callto32.s])
7 0x0802fdac (TASK_CallToStart+0x8c [task.c:373])
Wine-dbg>
*******************************************************************
Notice that you can step through the thunks into our own transfer
routines. You will notice that the source line displays as something
like:
390 0385 stdcall MapViewOfFile(long long long long long) MapViewOfFile
This is just the source line from the spec file that caused the transfer
routine to be generated. From this you can step again, and you step
into the relay logging code - keep stepping and you eventually step into
the actual function that does the dirty work.
At this point an examination of the source to the Win32 program
and an examination of the source to win32/file.s showed where the problem
was. When you specify 0 for the size of the object in CreateFileMapping,
it is supposed to use the entire size of the file as the size of the
object. Instead we were just blindly copying the number over.
*******************************************************************
Wine-dbg>b main
Breakpoint 1 at 0x080108c0 (main [dbgmain.c:213])
Wine-dbg>print breakpoints[1]
{addr={type=0x08043000, seg=0, off=134285504}, addrlen=' ', opcode='U', enabled=1, skipcount=0, in_use=1}
Wine-dbg> print breakpoints[1].enabled
1
Wine-dbg>set breakpoints[0].enabled = 0
Wine-dbg>print breakpoints[0].enabled
0
Wine-dbg>print type_hash_table[1]->type
STRUCT
Wine-dbg>print type_hash_table[1]
0x08072020
Wine-dbg>print *type_hash_table[1]
print *type_hash_table[1]
{type=STRUCT, next=0x00000000, name="LOGPALETTE", un={basic={basic_type=8, output_format=" V M", basic_size=-128, b_signed=0}, bitfield={bitoff=8, nbits=0, basetype=0x081d56c0}, pointer={pointsto=0x00000008}, funct={rettype=0x00000008}, array={start=8, end=136140480, basictype=0x08043e80}, structure={size=8, members=0x081d56c0}, enumeration={members=0x00000008}}}
Wine-dbg>
*******************************************************************
This example shows how you can print out various data structures.
Note that enumerated types are displayed in the symbolic form, and strings
are displayed in the expected manner.
You can use the set command to set more or less anything. Note
however that you cannot use enumerated types on the RHS of the expression.
Finally, type casts are not yet supported in the expression
handling. There is sufficient information stored internally to be
able to handle this - the main challenge is that the parser would
need to be fixed to correctly parse the type cast.
*******************************************************************
Wine-dbg>list
2986 if( argc <= 1 )
2987 {
2988 Usage(argv[0]);
2989 }
2990
2991 for( i = 1; i < argc; i++ )
2992 {
2993 if( strncmp(argv[i], "-dos", sizeof("-dos") - 1) == 0 )
2994 {
2995 DmpCtrl.bDumpDOSHeader = TRUE;
2996 }
Wine-dbg>b 2993
Breakpoint 3 at 0x081a8861 (main+0x3c [dumpexe.c:2993])
Wine-dbg>condition 3 i == 2
Wine-dbg>c
Stopped on breakpoint 3 at 0x081a8861 (main+0x3c [dumpexe.c:2993])
2993 if( strncmp(argv[i], "-dos", sizeof("-dos") - 1) == 0 )
0x081a8861 (main+0x3c [dumpexe.c:2993]): pushl $0x4
Wine-dbg>print i
2
Wine-dbg>print argv[i]
"./dumpexe.exe"
*******************************************************************
This example shows how to use conditional breakpoints.
Here is another one that demonstrates another cool feature
conditional breakpoints that involve a function call:
condition 3 strcmp(argv[i], "./dumpexe.exe") == 0
*******************************************************************
Wine-dbg>list
2986 if( argc <= 1 )
2987 {
2988 Usage(argv[0]);
2989 }
2990
2991 for( i = 1; i < argc; i++ )
2992 {
2993 if( strncmp(argv[i], "-dos", sizeof("-dos") - 1) == 0 )
2994 {
2995 DmpCtrl.bDumpDOSHeader = TRUE;
2996 }
Wine-dbg>b 2993
Breakpoint 3 at 0x081a8861 (main+0x3c [dumpexe.c:2993])
Wine-dbg>condition 3 strcmp(argv[i], "./dumpexe.exe") == 0
Wine-dbg>info break
Breakpoints:
1: y 0x081ab450 (_mainCRTStartup)
2: y 0x081a882e (main+0x9 [dumpexe.c:2986])
3: y 0x081a8861 (main+0x3c [dumpexe.c:2993])
stop when ( strcmp(( argv[i] ), "./dumpexe.exe") == 0 )
Wine-dbg>c
Stopped on breakpoint 3 at 0x081a8861 (main+0x3c [dumpexe.c:2993])
2993 if( strncmp(argv[i], "-dos", sizeof("-dos") - 1) == 0 )
0x081a8861 (main+0x3c [dumpexe.c:2993]): pushl $0x4
Wine-dbg>print i
2
Wine-dbg>print argv[i]
"./dumpexe.exe"
Wine-dbg>

View File

@ -3,28 +3,42 @@ way or another. No commitment to actually do these, but these sound
possible to me right now. In no particular order. If someone else
wants to dig in, feel free.
1) Some kind of crude display capability. Not too hard, I guess.
Just keep a list of addresses, counts and formats that we
want displayed each time we enter the debugger.
2) Some kind of single step capability.
I am not sure - I think you just set a flag
in AFLAGS, and you get an interrupt back again.
The signal type would proabably be different, however,
but Wine could easily be patched to accept this one as well.
The main problem with this is that gdb normally runs in a
separate process so it is easy to single step second process.
Here we are all part of the same process. Perhaps we could look
ahead to the end of the instruction and set another breakpoint?
3) Some kind of breakpoint capability.
Requires single step. When we restart, we
remove the breakpoint, single step one instruction
replace the breakpoint, and then continue.
4) Some kind of watchpoint capability. Pretty easy once we have a
1) Some kind of watchpoint capability. Pretty easy once we have a
single step capability, but we end up running the program
really slowly one instruction at a time.
really slowly one instruction at a time. Use hardware debug
registers for this???
5) Some kind of .wdbinit file.
2) Some kind of .wdbinit file.
3) Add 'info line' command. Not all *that* useful, but it would tell you
the range of PC for a given source line.
4) Add search directory list for PDB files. We have the path in the
DOS notation (i.e. C:\foo\bar\xxx.c), which may be a useful hint.
Maybe not.
5) Add support for emacs mode so that you can run under emacs and have
the source pop up automatically. Only useful once the list command
is implemented.
6 Add support for Borland. I have heard rumors that Borland is forthcoming
with info about how their stuff works, so this might not be that
bad.
7 Add support for Win16. Not sure if this is really worth the trouble. How
much are people really going to use this in the long run???
8) Some of the newer displays are still a little bit sparse on information.
Make these more like gdb.
9) Don't bother to disassemble an instruction when we stop at a breakpoint
and if we have a valid source line we are displaying.
10) Add support for '/i', etc in display command. Make sure 'display/i $eip'
does the correct thing, and then skip automatic disassembly completely.
11) Limit amount of information displayed with print command.
12) Make sure operator precedence works OK.
****************

View File

@ -14,15 +14,17 @@
#define INT3 0xcc /* int 3 opcode */
#define MAX_BREAKPOINTS 25
#define MAX_BREAKPOINTS 100
typedef struct
{
DBG_ADDR addr;
BYTE addrlen;
BYTE opcode;
BOOL16 enabled;
BOOL16 in_use;
DBG_ADDR addr;
BYTE addrlen;
BYTE opcode;
BOOL16 enabled;
WORD skipcount;
BOOL16 in_use;
struct expr * condition;
} BREAKPOINT;
static BREAKPOINT breakpoints[MAX_BREAKPOINTS];
@ -65,7 +67,7 @@ static void DEBUG_SetOpcode( const DBG_ADDR *addr, BYTE op )
* Determine if the instruction at CS:EIP is an instruction that
* we need to step over (like a call or a repetitive string move).
*/
static BOOL32 DEBUG_IsStepOverInstr(void)
static BOOL32 DEBUG_IsStepOverInstr()
{
BYTE *instr = (BYTE *)PTR_SEG_OFF_TO_LIN( CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) );
@ -125,6 +127,31 @@ static BOOL32 DEBUG_IsStepOverInstr(void)
}
/***********************************************************************
* DEBUG_IsFctReturn
*
* Determine if the instruction at CS:EIP is an instruction that
* is a function return.
*/
BOOL32 DEBUG_IsFctReturn(void)
{
BYTE *instr = (BYTE *)PTR_SEG_OFF_TO_LIN( CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) );
for (;;)
{
switch(*instr)
{
case 0xc2:
case 0xc3:
return TRUE;
default:
return FALSE;
}
}
}
/***********************************************************************
* DEBUG_SetBreakpoints
*
@ -205,6 +232,7 @@ void DEBUG_AddBreakpoint( const DBG_ADDR *address )
breakpoints[num].opcode = *p;
breakpoints[num].enabled = TRUE;
breakpoints[num].in_use = TRUE;
breakpoints[num].skipcount = 0;
fprintf( stderr, "Breakpoint %d at ", num );
DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].addrlen,
TRUE );
@ -226,6 +254,7 @@ void DEBUG_DelBreakpoint( int num )
}
breakpoints[num].enabled = FALSE;
breakpoints[num].in_use = FALSE;
breakpoints[num].skipcount = 0;
}
@ -242,6 +271,7 @@ void DEBUG_EnableBreakpoint( int num, BOOL32 enable )
return;
}
breakpoints[num].enabled = enable;
breakpoints[num].skipcount = 0;
}
@ -263,6 +293,12 @@ void DEBUG_InfoBreakpoints(void)
DEBUG_PrintAddress( &breakpoints[i].addr, breakpoints[i].addrlen,
TRUE);
fprintf( stderr, "\n" );
if( breakpoints[i].condition != NULL )
{
fprintf(stderr, "\t\tstop when ");
DEBUG_DisplayExpr(breakpoints[i].condition);
fprintf(stderr, "\n");
}
}
}
}
@ -274,10 +310,12 @@ void DEBUG_InfoBreakpoints(void)
* Determine if we should continue execution after a SIGTRAP signal when
* executing in the given mode.
*/
BOOL32 DEBUG_ShouldContinue( enum exec_mode mode )
BOOL32 DEBUG_ShouldContinue( enum exec_mode mode, int * count )
{
DBG_ADDR addr;
DBG_ADDR cond_addr;
int bpnum;
struct list_id list;
/* If not single-stepping, back up over the int3 instruction */
if (!(EFL_reg(&DEBUG_context) & STEP_FLAG)) EIP_reg(&DEBUG_context)--;
@ -291,20 +329,98 @@ BOOL32 DEBUG_ShouldContinue( enum exec_mode mode )
if ((bpnum != 0) && (bpnum != -1))
{
if( breakpoints[bpnum].condition != NULL )
{
cond_addr = DEBUG_EvalExpr(breakpoints[bpnum].condition);
if( cond_addr.type == NULL )
{
/*
* Something wrong - unable to evaluate this expression.
*/
fprintf(stderr, "Unable to evaluate expression ");
DEBUG_DisplayExpr(breakpoints[bpnum].condition);
fprintf(stderr, "\nTurning off condition\n");
DEBUG_AddBPCondition(bpnum, NULL);
}
else if( ! DEBUG_GetExprValue( &cond_addr, NULL) )
{
return TRUE;
}
}
if( breakpoints[bpnum].skipcount > 0 )
{
breakpoints[bpnum].skipcount--;
if( breakpoints[bpnum].skipcount > 0 )
{
return TRUE;
}
}
fprintf( stderr, "Stopped on breakpoint %d at ", bpnum );
DEBUG_PrintAddress( &breakpoints[bpnum].addr,
breakpoints[bpnum].addrlen, TRUE );
fprintf( stderr, "\n" );
/*
* See if there is a source file for this bp. If so,
* then dig it out and display one line.
*/
DEBUG_FindNearestSymbol( &addr, TRUE, NULL, 0, &list);
if( list.sourcefile != NULL )
{
DEBUG_List(&list, NULL, 0);
}
return FALSE;
}
/*
* If our mode indicates that we are stepping line numbers,
* get the current function, and figure out if we are exactly
* on a line number or not.
*/
if( mode == EXEC_STEP_OVER
|| mode == EXEC_STEP_INSTR )
{
if( DEBUG_CheckLinenoStatus(&addr) == AT_LINENUMBER )
{
(*count)--;
}
}
else if( mode == EXEC_STEPI_OVER
|| mode == EXEC_STEPI_INSTR )
{
(*count)--;
}
if( *count > 0 || mode == EXEC_FINISH )
{
/*
* We still need to execute more instructions.
*/
return TRUE;
}
/*
* If we are about to stop, then print out the source line if we
* have it.
*/
if( (mode != EXEC_CONT && mode != EXEC_FINISH) )
{
DEBUG_FindNearestSymbol( &addr, TRUE, NULL, 0, &list);
if( list.sourcefile != NULL )
{
DEBUG_List(&list, NULL, 0);
}
}
/* If there's no breakpoint and we are not single-stepping, then we */
/* must have encountered an int3 in the Windows program; let's skip it. */
if ((bpnum == -1) && !(EFL_reg(&DEBUG_context) & STEP_FLAG))
EIP_reg(&DEBUG_context)++;
/* no breakpoint, continue if in continuous mode */
return (mode == EXEC_CONT);
return (mode == EXEC_CONT || mode == EXEC_FINISH);
}
@ -314,16 +430,102 @@ BOOL32 DEBUG_ShouldContinue( enum exec_mode mode )
* Set the breakpoints to the correct state to restart execution
* in the given mode.
*/
void DEBUG_RestartExecution( enum exec_mode mode, int instr_len )
enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count )
{
DBG_ADDR addr;
DBG_ADDR addr2;
int bp;
int delta;
int status;
unsigned int * value;
enum exec_mode ret_mode;
BYTE *instr;
addr.seg = (CS_reg(&DEBUG_context) == WINE_CODE_SELECTOR) ?
0 : CS_reg(&DEBUG_context);
addr.off = EIP_reg(&DEBUG_context);
if (DEBUG_FindBreakpoint( &addr ) != -1)
mode = EXEC_STEP_INSTR; /* If there's a breakpoint, skip it */
/*
* This is the mode we will be running in after we finish. We would like
* to be able to modify this in certain cases.
*/
ret_mode = mode;
bp = DEBUG_FindBreakpoint( &addr );
if ( bp != -1 && bp != 0)
{
/*
* If we have set a new value, then save it in the BP number.
*/
if( count != 0 && mode == EXEC_CONT )
{
breakpoints[bp].skipcount = count;
}
mode = EXEC_STEPI_INSTR; /* If there's a breakpoint, skip it */
}
else
{
if( mode == EXEC_CONT && count > 1 )
{
fprintf(stderr,"Not stopped at any breakpoint; argument ignored.\n");
}
}
if( mode == EXEC_FINISH && DEBUG_IsFctReturn() )
{
mode = ret_mode = EXEC_STEPI_INSTR;
}
instr = (BYTE *)PTR_SEG_OFF_TO_LIN( CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) );
/*
* See if the function we are stepping into has debug info
* and line numbers. If not, then we step over it instead.
* FIXME - we need to check for things like thunks or trampolines,
* as the actual function may in fact have debug info.
*/
if( *instr == 0xe8 )
{
delta = *(unsigned int*) (instr + 1);
addr2 = addr;
DEBUG_Disasm(&addr2, FALSE);
addr2.off += delta;
status = DEBUG_CheckLinenoStatus(&addr2);
/*
* Anytime we have a trampoline, step over it.
*/
if( ((mode == EXEC_STEP_OVER) || (mode == EXEC_STEPI_OVER))
&& status == FUNC_IS_TRAMPOLINE )
{
#if 0
fprintf(stderr, "Not stepping into trampoline at %x (no lines)\n",
addr2.off);
#endif
mode = EXEC_STEP_OVER_TRAMPOLINE;
}
if( mode == EXEC_STEP_INSTR && status == FUNC_HAS_NO_LINES )
{
#if 0
fprintf(stderr, "Not stepping into function at %x (no lines)\n",
addr2.off);
#endif
mode = EXEC_STEP_OVER;
}
}
if( mode == EXEC_STEP_INSTR )
{
if( DEBUG_CheckLinenoStatus(&addr) == FUNC_HAS_NO_LINES )
{
fprintf(stderr, "Single stepping until exit from function, \n");
fprintf(stderr, "which has no line number information.\n");
ret_mode = mode = EXEC_FINISH;
}
}
switch(mode)
{
@ -332,14 +534,35 @@ void DEBUG_RestartExecution( enum exec_mode mode, int instr_len )
DEBUG_SetBreakpoints( TRUE );
break;
case EXEC_STEP_OVER_TRAMPOLINE:
/*
* This is the means by which we step over our conversion stubs
* in callfrom*.s and callto*.s. We dig the appropriate address
* off the stack, and we set the breakpoint there instead of the
* address just after the call.
*/
value = (unsigned int *) ESP_reg(&DEBUG_context) + 2;
addr.off = *value;
EFL_reg(&DEBUG_context) &= ~STEP_FLAG;
breakpoints[0].addr = addr;
breakpoints[0].enabled = TRUE;
breakpoints[0].in_use = TRUE;
breakpoints[0].skipcount = 0;
breakpoints[0].opcode = *(BYTE *)DBG_ADDR_TO_LIN( &addr );
DEBUG_SetBreakpoints( TRUE );
break;
case EXEC_FINISH:
case EXEC_STEPI_OVER: /* Stepping over a call */
case EXEC_STEP_OVER: /* Stepping over a call */
if (DEBUG_IsStepOverInstr())
{
EFL_reg(&DEBUG_context) &= ~STEP_FLAG;
addr.off += instr_len;
DEBUG_Disasm(&addr, FALSE);
breakpoints[0].addr = addr;
breakpoints[0].enabled = TRUE;
breakpoints[0].in_use = TRUE;
breakpoints[0].skipcount = 0;
breakpoints[0].opcode = *(BYTE *)DBG_ADDR_TO_LIN( &addr );
DEBUG_SetBreakpoints( TRUE );
break;
@ -347,7 +570,32 @@ void DEBUG_RestartExecution( enum exec_mode mode, int instr_len )
/* else fall through to single-stepping */
case EXEC_STEP_INSTR: /* Single-stepping an instruction */
case EXEC_STEPI_INSTR: /* Single-stepping an instruction */
EFL_reg(&DEBUG_context) |= STEP_FLAG;
break;
}
return ret_mode;
}
int
DEBUG_AddBPCondition(int num, struct expr * exp)
{
if ((num <= 0) || (num >= next_bp) || !breakpoints[num].in_use)
{
fprintf( stderr, "Invalid breakpoint number %d\n", num );
return FALSE;
}
if( breakpoints[num].condition != NULL )
{
DEBUG_FreeExpr(breakpoints[num].condition);
breakpoints[num].condition = NULL;
}
if( exp != NULL )
{
breakpoints[num].condition = DEBUG_CloneExpr(exp);
}
return TRUE;
}

View File

@ -71,6 +71,13 @@
*/
static BOOL32 db_disasm_16 = FALSE;
/*
* Flag to indicate whether we need to display instruction,
* or whether we just need to know the address of the next
* instruction.
*/
static BOOL32 db_display = FALSE;
/*
* Size attributes
*/
@ -1009,7 +1016,7 @@ static void db_task_printsym(unsigned int addr, int size)
break;
case LONG:
{
DBG_ADDR address = { 0, addr };
DBG_ADDR address = { NULL, 0, addr };
DEBUG_PrintAddress( &address, db_disasm_16 ? 16 : 32, TRUE );
}
break;
@ -1057,6 +1064,11 @@ void db_disasm_esc( DBG_ADDR *addr, int inst, int short_addr,
const char * name;
get_value_inc(regmodrm, addr, 1, FALSE);
if( !db_display )
{
return;
}
fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
mod = f_mod(regmodrm);
if (mod != 3) {
@ -1128,7 +1140,7 @@ void db_disasm_esc( DBG_ADDR *addr, int inst, int short_addr,
* Disassemble instruction at 'addr'. addr is changed to point to the
* start of the next instruction.
*/
void DEBUG_Disasm( DBG_ADDR *addr )
void DEBUG_Disasm( DBG_ADDR *addr, int display )
{
int inst;
int size;
@ -1146,6 +1158,11 @@ void DEBUG_Disasm( DBG_ADDR *addr )
int len;
struct i_addr address;
/*
* Set this so we get can supress the printout if we need to.
*/
db_display = display;
if (!addr->seg) db_disasm_16 = FALSE;
else db_disasm_16 = !(GET_SEL_FLAGS(addr->seg) & LDT_FLAGS_32BIT);
@ -1263,145 +1280,242 @@ void DEBUG_Disasm( DBG_ADDR *addr )
}
if (i_size == SDEP) {
if (size == WORD)
if( db_display )
{
if (size == WORD)
fprintf(stderr,i_name);
else
else
fprintf(stderr,ip->i_extra);
}
}
else {
fprintf(stderr,i_name);
if( db_display )
{
fprintf(stderr,i_name);
}
if (i_size != NONE) {
if (i_size == BYTE) {
fprintf(stderr,"b");
if( db_display )
{
fprintf(stderr,"b");
}
size = BYTE;
}
else if (i_size == WORD) {
fprintf(stderr,"w");
if( db_display )
{
fprintf(stderr,"w");
}
size = WORD;
}
else if (size == WORD)
fprintf(stderr,"w");
{
if( db_display )
{
fprintf(stderr,"w");
}
}
else
fprintf(stderr,"l");
{
if( db_display )
{
fprintf(stderr,"l");
}
}
}
}
fprintf(stderr,"\t");
if( db_display )
{
fprintf(stderr,"\t");
}
for (first = TRUE;
i_mode != 0;
i_mode >>= 8, first = FALSE)
{
if (!first)
if (!first && db_display)
fprintf(stderr,",");
switch (i_mode & 0xFF) {
case E:
db_print_address(seg, size, &address);
if( db_display )
{
db_print_address(seg, size, &address);
}
break;
case Eind:
fprintf(stderr,"*");
db_print_address(seg, size, &address);
if( db_display )
{
fprintf(stderr,"*");
db_print_address(seg, size, &address);
}
break;
case Ew:
db_print_address(seg, WORD, &address);
if( db_display )
{
db_print_address(seg, WORD, &address);
}
break;
case Eb:
db_print_address(seg, BYTE, &address);
if( db_display )
{
db_print_address(seg, BYTE, &address);
}
break;
case R:
fprintf(stderr,"%s", db_reg[size][f_reg(regmodrm)]);
if( db_display )
{
fprintf(stderr,"%s", db_reg[size][f_reg(regmodrm)]);
}
break;
case Rw:
fprintf(stderr,"%s", db_reg[WORD][f_reg(regmodrm)]);
if( db_display )
{
fprintf(stderr,"%s", db_reg[WORD][f_reg(regmodrm)]);
}
break;
case Ri:
fprintf(stderr,"%s", db_reg[size][f_rm(inst)]);
if( db_display )
{
fprintf(stderr,"%s", db_reg[size][f_rm(inst)]);
}
break;
case S:
fprintf(stderr,"%s", db_seg_reg[f_reg(regmodrm)]);
if( db_display )
{
fprintf(stderr,"%s", db_seg_reg[f_reg(regmodrm)]);
}
break;
case Si:
fprintf(stderr,"%s", db_seg_reg[f_reg(inst)]);
if( db_display )
{
fprintf(stderr,"%s", db_seg_reg[f_reg(inst)]);
}
break;
case A:
fprintf(stderr,"%s", db_reg[size][0]); /* acc */
if( db_display )
{
fprintf(stderr,"%s", db_reg[size][0]); /* acc */
}
break;
case BX:
if (seg)
if( db_display )
{
if (seg)
fprintf(stderr,"%s:", seg);
fprintf(stderr,"(%s)", short_addr ? "%bx" : "%ebx");
fprintf(stderr,"(%s)", short_addr ? "%bx" : "%ebx");
}
break;
case CL:
fprintf(stderr,"%%cl");
if( db_display )
{
fprintf(stderr,"%%cl");
}
break;
case DX:
fprintf(stderr,"%%dx");
if( db_display )
{
fprintf(stderr,"%%dx");
}
break;
case SI:
if (seg)
if( db_display )
{
if (seg)
fprintf(stderr,"%s:", seg);
fprintf(stderr,"(%s)", short_addr ? "%si" : "%esi");
fprintf(stderr,"(%s)", short_addr ? "%si" : "%esi");
}
break;
case DI:
fprintf(stderr,"%%es:(%s)", short_addr ? "%di" : "%edi");
if( db_display )
{
fprintf(stderr,"%%es:(%s)", short_addr ? "%di" : "%edi");
}
break;
case CR:
fprintf(stderr,"%%cr%d", f_reg(regmodrm));
if( db_display )
{
fprintf(stderr,"%%cr%d", f_reg(regmodrm));
}
break;
case DR:
fprintf(stderr,"%%dr%d", f_reg(regmodrm));
if( db_display )
{
fprintf(stderr,"%%dr%d", f_reg(regmodrm));
}
break;
case TR:
fprintf(stderr,"%%tr%d", f_reg(regmodrm));
if( db_display )
{
fprintf(stderr,"%%tr%d", f_reg(regmodrm));
}
break;
case I:
len = db_lengths[size];
get_value_inc(imm, addr, len, FALSE);/* unsigned */
fprintf(stderr,"$0x%x", imm);
if( db_display )
{
fprintf(stderr,"$0x%x", imm);
}
break;
case Is:
len = db_lengths[size];
get_value_inc(imm, addr, len, TRUE); /* signed */
fprintf(stderr,"$%d", imm);
if( db_display )
{
fprintf(stderr,"$%d", imm);
}
break;
case Ib:
get_value_inc(imm, addr, 1, FALSE); /* unsigned */
fprintf(stderr,"$0x%x", imm);
if( db_display )
{
fprintf(stderr,"$0x%x", imm);
}
break;
case Ibs:
get_value_inc(imm, addr, 1, TRUE); /* signed */
fprintf(stderr,"$%d", imm);
if( db_display )
{
fprintf(stderr,"$%d", imm);
}
break;
case Iw:
get_value_inc(imm, addr, 2, FALSE); /* unsigned */
fprintf(stderr,"$0x%x", imm);
if( db_display )
{
fprintf(stderr,"$0x%x", imm);
}
break;
case Il:
get_value_inc(imm, addr, 4, FALSE);
fprintf(stderr,"$0x%x", imm);
if( db_display )
{
fprintf(stderr,"$0x%x", imm);
}
break;
case O:
@ -1411,6 +1525,11 @@ void DEBUG_Disasm( DBG_ADDR *addr )
else {
get_value_inc(displ, addr, 4, TRUE);
}
if( !db_display )
{
break;
}
if (seg)
fprintf(stderr,"%s:%d",seg, displ);
else
@ -1419,6 +1538,11 @@ void DEBUG_Disasm( DBG_ADDR *addr )
case Db:
get_value_inc(displ, addr, 1, TRUE);
if( !db_display )
{
break;
}
if (short_addr) {
/* offset only affects low 16 bits */
displ = (addr->off & 0xffff0000)
@ -1439,15 +1563,25 @@ void DEBUG_Disasm( DBG_ADDR *addr )
get_value_inc(displ, addr, 4, TRUE);
displ += addr->off;
}
if( !db_display )
{
break;
}
db_task_printsym( displ, short_addr ? WORD : LONG);
break;
case o1:
fprintf(stderr,"$1");
if( db_display )
{
fprintf(stderr,"$1");
}
break;
case o3:
fprintf(stderr,"$3");
if( db_display )
{
fprintf(stderr,"$3");
}
break;
case OS:
@ -1457,8 +1591,12 @@ void DEBUG_Disasm( DBG_ADDR *addr )
short_addr ? 2 : 4, FALSE );
get_value_inc( address.seg, addr, /* segment */
2, FALSE );
DEBUG_PrintAddress( &address, short_addr ? 16 : 32,
TRUE );
if( db_display )
{
DEBUG_PrintAddress( &address, short_addr ? 16 : 32,
TRUE );
}
}
break;
}

View File

@ -16,11 +16,14 @@
#include "win.h"
#include "debugger.h"
#include "expr.h"
extern FILE * yyin;
unsigned int dbg_mode = 0;
int curr_frame = 0;
static enum exec_mode dbg_exec_mode = EXEC_CONT;
static int dbg_exec_count = 0;
void issue_prompt(void);
void mode_command(int);
@ -36,17 +39,18 @@ int yyerror(char *);
enum debug_regs reg;
char * string;
int integer;
struct list_id listing;
struct expr * expression;
}
%token tCONT tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tINFO tWALK tUP tDOWN
%token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tDEFINE tABORT
%token tENABLE tDISABLE tBREAK tDELETE tSET tMODE tPRINT tEXAM tABORT
%token tCLASS tMODULE tSTACK tSEGMENTS tREGS tWND tQUEUE tLOCAL
%token tNO_SYMBOL tEOL
%token tSYMBOLFILE
%token tFRAME
%token <string> tIDENTIFIER
%token tEOL tSTRING
%token tFRAME tSHARE tCOND tDISPLAY tUNDISPLAY
%token tSTEPI tNEXTI tFINISH tSHOW tDIR
%token <string> tPATH
%token <string> tIDENTIFIER tSTRING
%token <integer> tNUM tFORMAT
%token <reg> tREG
@ -62,14 +66,19 @@ int yyerror(char *);
%left '&'
%left OP_EQ OP_NE
%left '<' '>' OP_LE OP_GE
%left OP_SHL OP_SHR
%left OP_SHL OP_SHR OP_DRF
%left '+' '-'
%left '*' '/' '%'
%left OP_SIGN '!' '~' OP_DEREF /* OP_INC OP_DEC OP_ADDR */
%left '.' '['
%nonassoc ':'
%type <integer> expr
%type <address> addr segaddr symbol
%type <expression> expr lval lvalue
%type <address> expr_addr lval_addr
%type <integer> expr_value
%type <string> pathname
%type <listing> list_arg
%%
@ -83,14 +92,28 @@ line: command
command:
tQUIT tEOL { exit(0); }
| tHELP tEOL { DEBUG_Help(); }
| tCONT tEOL { dbg_exec_mode = EXEC_CONT; return 0; }
| tSTEP tEOL { dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
| tNEXT tEOL { dbg_exec_mode = EXEC_STEP_OVER; return 0; }
| tLIST tEOL { DEBUG_List( NULL, 15 ); }
| tLIST addr tEOL { DEBUG_List( &$2, 15 ); }
| tHELP tINFO tEOL { DEBUG_HelpInfo(); }
| tCONT tEOL { dbg_exec_count = 1;
dbg_exec_mode = EXEC_CONT; return 0; }
| tCONT tNUM tEOL { dbg_exec_count = $2;
dbg_exec_mode = EXEC_CONT; return 0; }
| tSTEP tEOL { dbg_exec_count = 1;
dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
| tNEXT tEOL { dbg_exec_count = 1;
dbg_exec_mode = EXEC_STEP_OVER; return 0; }
| tSTEP tNUM tEOL { dbg_exec_count = $2;
dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
| tNEXT tNUM tEOL { dbg_exec_count = $2;
dbg_exec_mode = EXEC_STEP_OVER; return 0; }
| tSTEPI tEOL { dbg_exec_count = 1;
dbg_exec_mode = EXEC_STEPI_INSTR; return 0; }
| tNEXTI tEOL { dbg_exec_count = 1;
dbg_exec_mode = EXEC_STEPI_OVER; return 0; }
| tSTEPI tNUM tEOL { dbg_exec_count = $2;
dbg_exec_mode = EXEC_STEPI_INSTR; return 0; }
| tNEXTI tNUM tEOL { dbg_exec_count = $2;
dbg_exec_mode = EXEC_STEPI_OVER; return 0; }
| tABORT tEOL { kill(getpid(), SIGABRT); }
| tSYMBOLFILE tIDENTIFIER tEOL { DEBUG_ReadSymbolTable( $2 ); }
| tDEFINE tIDENTIFIER addr tEOL { DEBUG_AddSymbol( $2, &$3, NULL ); }
| tMODE tNUM tEOL { mode_command($2); }
| tENABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, TRUE ); }
| tDISABLE tNUM tEOL { DEBUG_EnableBreakpoint( $2, FALSE ); }
@ -100,7 +123,20 @@ command:
| tUP tNUM tEOL { DEBUG_SetFrame( curr_frame + $2 ); }
| tDOWN tEOL { DEBUG_SetFrame( curr_frame - 1 ); }
| tDOWN tNUM tEOL { DEBUG_SetFrame( curr_frame - $2 ); }
| tFRAME expr tEOL { DEBUG_SetFrame( $2 ); }
| tFRAME tNUM tEOL { DEBUG_SetFrame( $2 ); }
| tFINISH tEOL { dbg_exec_count = 0;
dbg_exec_mode = EXEC_FINISH; return 0; }
| tSHOW tDIR tEOL { DEBUG_ShowDir(); }
| tDIR pathname tEOL { DEBUG_AddPath( $2 ); }
| tDIR tEOL { DEBUG_NukePath(); }
| tDISPLAY expr tEOL { DEBUG_AddDisplay($2); }
| tDELETE tDISPLAY tNUM tEOL { DEBUG_DelDisplay( $3 ); }
| tDELETE tDISPLAY tEOL { DEBUG_DelDisplay( -1 ); }
| tUNDISPLAY tNUM tEOL { DEBUG_DelDisplay( $2 ); }
| tUNDISPLAY tEOL { DEBUG_DelDisplay( -1 ); }
| tCOND tNUM tEOL { DEBUG_AddBPCondition($2, NULL); }
| tCOND tNUM expr tEOL { DEBUG_AddBPCondition($2, $3); }
| list_command
| set_command
| x_command
| print_command
@ -109,47 +145,110 @@ command:
| walk_command
set_command:
tSET tREG '=' expr tEOL { DEBUG_SetRegister( $2, $4 ); }
| tSET '*' addr '=' expr tEOL { DEBUG_WriteMemory( &$3, $5 ); }
| tSET tIDENTIFIER '=' addr tEOL { if (!DEBUG_SetSymbolValue( $2, &$4 ))
{
fprintf( stderr,
"Symbol %s not found\n", $2 );
YYERROR;
}
}
tSET tREG '=' expr_value tEOL { DEBUG_SetRegister( $2, $4 );
DEBUG_FreeExprMem(); }
| tSET lval_addr '=' expr_value tEOL { DEBUG_WriteMemory( &$2, $4 );
DEBUG_FreeExprMem(); }
pathname:
tIDENTIFIER { $$ = $1; }
| tPATH { $$ = $1; }
list_command:
tLIST tEOL { DEBUG_List( NULL, NULL, 10 ); }
| tLIST '-' tEOL { DEBUG_List( NULL, NULL, -10 ); }
| tLIST list_arg tEOL { DEBUG_List( & $2, NULL, 10 ); }
| tLIST ',' list_arg tEOL { DEBUG_List( NULL, & $3, -10 ); }
| tLIST list_arg ',' list_arg tEOL { DEBUG_List( & $2, & $4, 0 ); }
list_arg:
tNUM { $$.sourcefile = NULL; $$.line = $1; }
| pathname ':' tNUM { $$.sourcefile = $1; $$.line = $3; }
| tIDENTIFIER { DEBUG_GetFuncInfo( & $$, NULL, $1); }
| pathname ':' tIDENTIFIER { DEBUG_GetFuncInfo( & $$, $1, $3); }
| '*' expr_addr { DEBUG_FindNearestSymbol( & $2, FALSE, NULL,
0, & $$ );
DEBUG_FreeExprMem(); }
x_command:
tEXAM addr tEOL { DEBUG_ExamineMemory( &$2, 1, 'x'); }
| tEXAM tFORMAT addr tEOL { DEBUG_ExamineMemory( &$3, $2>>8, $2&0xff ); }
tEXAM expr_addr tEOL { DEBUG_ExamineMemory( &$2, 1, 'x');
DEBUG_FreeExprMem(); }
| tEXAM tFORMAT expr_addr tEOL { DEBUG_ExamineMemory( &$3, $2>>8, $2&0xff );
DEBUG_FreeExprMem(); }
print_command:
tPRINT addr tEOL { DEBUG_Print( &$2, 1, 'x' ); }
| tPRINT tFORMAT addr tEOL { DEBUG_Print( &$3, $2 >> 8, $2 & 0xff ); }
tPRINT expr_addr tEOL { DEBUG_Print( &$2, 1, 0, 0 );
DEBUG_FreeExprMem(); }
| tPRINT tFORMAT expr_addr tEOL { DEBUG_Print( &$3, $2 >> 8, $2 & 0xff, 0 );
DEBUG_FreeExprMem(); }
break_command:
tBREAK '*' addr tEOL { DEBUG_AddBreakpoint( &$3 ); }
| tBREAK symbol tEOL { DEBUG_AddBreakpoint( &$2 ); }
| tBREAK symbol '+' expr tEOL { DBG_ADDR addr = $2;
addr.off += $4;
DEBUG_AddBreakpoint( &addr );
}
| tBREAK tEOL { DBG_ADDR addr = { CS_reg(&DEBUG_context),
tBREAK '*' expr_addr tEOL { DEBUG_AddBreakpoint( &$3 );
DEBUG_FreeExprMem(); }
| tBREAK tIDENTIFIER tEOL { DBG_ADDR addr;
if( DEBUG_GetSymbolValue($2, -1, &addr, TRUE) )
{
DEBUG_AddBreakpoint( &addr );
}
else
{
fprintf(stderr,"Unable to add breakpoint\n");
}
}
| tBREAK tIDENTIFIER ':' tNUM tEOL { DBG_ADDR addr;
if( DEBUG_GetSymbolValue($2, $4, &addr, TRUE) )
{
DEBUG_AddBreakpoint( &addr );
}
else
{
fprintf(stderr,"Unable to add breakpoint\n");
}
}
| tBREAK tNUM tEOL { struct name_hash *nh;
DBG_ADDR addr = { NULL,
CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) };
DBG_FIX_ADDR_SEG( &addr, CS_reg(&DEBUG_context) );
DEBUG_FindNearestSymbol(&addr, TRUE,
&nh, 0, NULL);
if( nh != NULL )
{
DEBUG_GetLineNumberAddr(nh,
$2, &addr, TRUE);
DEBUG_AddBreakpoint( &addr );
}
else
{
fprintf(stderr,"Unable to add breakpoint\n");
}
}
| tBREAK tEOL { DBG_ADDR addr = { NULL,
CS_reg(&DEBUG_context),
EIP_reg(&DEBUG_context) };
DEBUG_AddBreakpoint( &addr );
}
info_command:
tINFO tBREAK tEOL { DEBUG_InfoBreakpoints(); }
| tINFO tCLASS expr tEOL { CLASS_DumpClass( (CLASS *)$3 ); }
| tINFO tMODULE expr tEOL { MODULE_DumpModule( $3 ); }
| tINFO tQUEUE expr tEOL { QUEUE_DumpQueue( $3 ); }
| tINFO tCLASS expr_value tEOL { CLASS_DumpClass( (CLASS *)$3 );
DEBUG_FreeExprMem(); }
| tINFO tSHARE tEOL { DEBUG_InfoShare(); }
| tINFO tMODULE expr_value tEOL { MODULE_DumpModule( $3 );
DEBUG_FreeExprMem(); }
| tINFO tQUEUE expr_value tEOL { QUEUE_DumpQueue( $3 );
DEBUG_FreeExprMem(); }
| tINFO tREGS tEOL { DEBUG_InfoRegisters(); }
| tINFO tSEGMENTS expr tEOL { LDT_Print( SELECTOR_TO_ENTRY($3), 1 ); }
| tINFO tSEGMENTS expr_value tEOL { LDT_Print( SELECTOR_TO_ENTRY($3), 1 );
DEBUG_FreeExprMem(); }
| tINFO tSEGMENTS tEOL { LDT_Print( 0, -1 ); }
| tINFO tSTACK tEOL { DEBUG_InfoStack(); }
| tINFO tWND expr tEOL { WIN_DumpWindow( $3 ); }
| tINFO tWND expr_value tEOL { WIN_DumpWindow( $3 );
DEBUG_FreeExprMem(); }
| tINFO tLOCAL tEOL { DEBUG_InfoLocals(); }
| tINFO tDISPLAY tEOL { DEBUG_InfoDisplay(); }
walk_command:
tWALK tCLASS tEOL { CLASS_WalkClasses(); }
@ -158,70 +257,78 @@ walk_command:
| tWALK tWND tEOL { WIN_WalkWindows( 0, 0 ); }
| tWALK tWND tNUM tEOL { WIN_WalkWindows( $3, 0 ); }
symbol:
tIDENTIFIER { if (!DEBUG_GetSymbolValue( $1, -1, &$$ ))
{
fprintf( stderr, "Symbol %s not found\n", $1 );
YYERROR;
}
}
| tIDENTIFIER ':' tNUM { if (!DEBUG_GetSymbolValue( $1, $3, &$$ ))
{
fprintf( stderr, "No code at %s:%d\n", $1, $3 );
YYERROR;
}
}
addr:
expr { $$.seg = 0xffffffff; $$.off = $1; }
| segaddr { $$ = $1; }
segaddr:
expr ':' expr { $$.seg = $1; $$.off = $3; }
| symbol { $$ = $1; }
| symbol '+' expr { $$ = $1; $$.off += $3; }
| symbol '-' expr { $$ = $1; $$.off -= $3; }
expr_addr:
expr { $$ = DEBUG_EvalExpr($1) }
expr_value:
expr { DBG_ADDR addr = DEBUG_EvalExpr($1);
$$ = *(unsigned int *) addr.off; }
/*
* The expr rule builds an expression tree. When we are done, we call
* EvalExpr to evaluate the value of the expression. The advantage of
* the two-step approach is that it is possible to save expressions for
* use in 'display' commands, and in conditional watchpoints.
*/
expr:
tNUM { $$ = $1; }
| tREG { $$ = DEBUG_GetRegister($1); }
| expr OP_LOR expr { $$ = $1 || $3; }
| expr OP_LAND expr { $$ = $1 && $3; }
| expr '|' expr { $$ = $1 | $3; }
| expr '&' expr { $$ = $1 & $3; }
| expr '^' expr { $$ = $1 ^ $3; }
| expr OP_EQ expr { $$ = $1 == $3; }
| expr '>' expr { $$ = $1 > $3; }
| expr '<' expr { $$ = $1 < $3; }
| expr OP_GE expr { $$ = $1 >= $3; }
| expr OP_LE expr { $$ = $1 <= $3; }
| expr OP_NE expr { $$ = $1 != $3; }
| expr OP_SHL expr { $$ = (unsigned)$1 << $3; }
| expr OP_SHR expr { $$ = (unsigned)$1 >> $3; }
| expr '+' expr { $$ = $1 + $3; }
| expr '-' expr { $$ = $1 - $3; }
| expr '*' expr { $$ = $1 * $3; }
| expr '/' expr { if ($3)
if ($3 == -1 && $1 == 0x80000000l)
yyerror ("Division overflow");
else $$ = $1 / $3;
else yyerror ("Division by zero");
}
| expr '%' expr { if ($3)
if ($3 == -1 && $1 == 0x80000000l)
$$ = 0; /* A sensible result in this case. */
else $$ = $1 % $3;
else yyerror ("Division by zero");
}
| '-' expr %prec OP_SIGN { $$ = -$2; }
tNUM { $$ = DEBUG_ConstExpr($1); }
| tSTRING { $$ = DEBUG_StringExpr($1); }
| tREG { $$ = DEBUG_RegisterExpr($1); }
| tIDENTIFIER { $$ = DEBUG_SymbolExpr($1); }
| expr OP_DRF tIDENTIFIER { $$ = DEBUG_StructPExpr($1, $3); }
| expr '.' tIDENTIFIER { $$ = DEBUG_StructExpr($1, $3); }
| tIDENTIFIER '(' ')' { $$ = DEBUG_CallExpr($1, 0); }
| tIDENTIFIER '(' expr ')' { $$ = DEBUG_CallExpr($1, 1, $3); }
| tIDENTIFIER '(' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 2, $3,
$5); }
| tIDENTIFIER '(' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7); }
| tIDENTIFIER '(' expr ',' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7, $9); }
| tIDENTIFIER '(' expr ',' expr ',' expr ',' expr ',' expr ')' { $$ = DEBUG_CallExpr($1, 3, $3, $5, $7, $9, $11); }
| expr '[' expr ']' { $$ = DEBUG_BinopExpr(EXP_OP_ARR, $1, $3); }
| expr ':' expr { $$ = DEBUG_BinopExpr(EXP_OP_SEG, $1, $3); }
| expr OP_LOR expr { $$ = DEBUG_BinopExpr(EXP_OP_LOR, $1, $3); }
| expr OP_LAND expr { $$ = DEBUG_BinopExpr(EXP_OP_LAND, $1, $3); }
| expr '|' expr { $$ = DEBUG_BinopExpr(EXP_OP_OR, $1, $3); }
| expr '&' expr { $$ = DEBUG_BinopExpr(EXP_OP_AND, $1, $3); }
| expr '^' expr { $$ = DEBUG_BinopExpr(EXP_OP_XOR, $1, $3); }
| expr OP_EQ expr { $$ = DEBUG_BinopExpr(EXP_OP_EQ, $1, $3); }
| expr '>' expr { $$ = DEBUG_BinopExpr(EXP_OP_GT, $1, $3); }
| expr '<' expr { $$ = DEBUG_BinopExpr(EXP_OP_LT, $1, $3); }
| expr OP_GE expr { $$ = DEBUG_BinopExpr(EXP_OP_GE, $1, $3); }
| expr OP_LE expr { $$ = DEBUG_BinopExpr(EXP_OP_LE, $1, $3); }
| expr OP_NE expr { $$ = DEBUG_BinopExpr(EXP_OP_NE, $1, $3); }
| expr OP_SHL expr { $$ = DEBUG_BinopExpr(EXP_OP_SHL, $1, $3); }
| expr OP_SHR expr { $$ = DEBUG_BinopExpr(EXP_OP_SHR, $1, $3); }
| expr '+' expr { $$ = DEBUG_BinopExpr(EXP_OP_ADD, $1, $3); }
| expr '-' expr { $$ = DEBUG_BinopExpr(EXP_OP_SUB, $1, $3); }
| expr '*' expr { $$ = DEBUG_BinopExpr(EXP_OP_MUL, $1, $3); }
| expr '/' expr { $$ = DEBUG_BinopExpr(EXP_OP_DIV, $1, $3); }
| expr '%' expr { $$ = DEBUG_BinopExpr(EXP_OP_REM, $1, $3); }
| '-' expr %prec OP_SIGN { $$ = DEBUG_UnopExpr(EXP_OP_NEG, $2); }
| '+' expr %prec OP_SIGN { $$ = $2; }
| '!' expr { $$ = !$2; }
| '~' expr { $$ = ~$2; }
| '!' expr { $$ = DEBUG_UnopExpr(EXP_OP_NOT, $2); }
| '~' expr { $$ = DEBUG_UnopExpr(EXP_OP_LNOT, $2); }
| '(' expr ')' { $$ = $2; }
/* For parser technical reasons we can't use "addr" here. */
| '*' expr %prec OP_DEREF { DBG_ADDR addr = { 0xffffffff, $2 };
$$ = DEBUG_ReadMemory( &addr ); }
| '*' segaddr %prec OP_DEREF { $$ = DEBUG_ReadMemory( &$2 ); }
| '*' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_DEREF, $2); }
| '&' expr %prec OP_DEREF { $$ = DEBUG_UnopExpr(EXP_OP_ADDR, $2); }
/*
* The lvalue rule builds an expression tree. This is a limited form
* of expression that is suitable to be used as an lvalue.
*/
lval_addr:
lval { $$ = DEBUG_EvalExpr($1) }
lval:
lvalue { $$ = $1; }
| '*' expr { $$ = DEBUG_UnopExpr(EXP_OP_FORCE_DEREF, $2); }
lvalue:
tNUM { $$ = DEBUG_ConstExpr($1); }
| tREG { $$ = DEBUG_RegisterExpr($1); }
| tIDENTIFIER { $$ = DEBUG_SymbolExpr($1); }
| lvalue OP_DRF tIDENTIFIER { $$ = DEBUG_StructPExpr($1, $3); }
| lvalue '.' tIDENTIFIER { $$ = DEBUG_StructExpr($1, $3); }
| lvalue '[' expr ']' { $$ = DEBUG_BinopExpr(EXP_OP_ARR, $1, $3); }
%%
@ -249,7 +356,7 @@ static void DEBUG_Main( int signal )
static int loaded_symbols = 0;
static BOOL32 in_debugger = FALSE;
char SymbolTableFile[256];
int instr_len = 0, newmode;
int newmode;
BOOL32 ret_ok;
#ifdef YYDEBUG
yydebug = 0;
@ -268,6 +375,12 @@ static void DEBUG_Main( int signal )
if (!loaded_symbols)
{
loaded_symbols++;
/*
* Initialize the type handling stuff.
*/
DEBUG_InitTypes();
/*
* In some cases we can read the stabs information directly
* from the executable. If this is the case, we don't need
@ -294,12 +407,22 @@ static void DEBUG_Main( int signal )
DEBUG_LoadEntryPoints();
}
if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( dbg_exec_mode ))
#if 0
fprintf(stderr, "Entering debugger PC=%x, mode=%d, count=%d\n",
EIP_reg(&DEBUG_context),
dbg_exec_mode, dbg_exec_count);
sleep(1);
#endif
if ((signal != SIGTRAP) || !DEBUG_ShouldContinue( dbg_exec_mode,
&dbg_exec_count ))
{
DBG_ADDR addr;
addr.seg = CS_reg(&DEBUG_context);
addr.off = EIP_reg(&DEBUG_context);
addr.type = NULL;
DBG_FIX_ADDR_SEG( &addr, 0 );
/* Put the display in a correct state */
@ -314,6 +437,8 @@ static void DEBUG_Main( int signal )
if (newmode != dbg_mode)
fprintf(stderr,"In %d bit mode.\n", dbg_mode = newmode);
DEBUG_DoDisplay();
if (signal != SIGTRAP) /* This is a real crash, dump some info */
{
DEBUG_InfoRegisters();
@ -326,6 +451,14 @@ static void DEBUG_Main( int signal )
}
DEBUG_BackTrace();
}
else
{
/*
* Do a quiet backtrace so that we have an idea of what the situation
* is WRT the source files.
*/
DEBUG_SilentBackTrace();
}
/* Show where we crashed */
curr_frame = 0;
@ -333,9 +466,8 @@ static void DEBUG_Main( int signal )
fprintf(stderr,": ");
if (DBG_CHECK_READ_PTR( &addr, 1 ))
{
DEBUG_Disasm( &addr );
DEBUG_Disasm( &addr, TRUE );
fprintf(stderr,"\n");
instr_len = addr.off - EIP_reg(&DEBUG_context);
}
ret_ok = 0;
@ -352,7 +484,17 @@ static void DEBUG_Main( int signal )
} while (!ret_ok);
}
DEBUG_RestartExecution( dbg_exec_mode, instr_len );
dbg_exec_mode = DEBUG_RestartExecution( dbg_exec_mode, dbg_exec_count );
/*
* This will have gotten absorbed into the breakpoint info
* if it was used. Otherwise it would have been ignored.
* In any case, we don't mess with it any more.
*/
if( dbg_exec_mode == EXEC_CONT )
{
dbg_exec_count = 0;
}
in_debugger = FALSE;
}
@ -375,6 +517,7 @@ void DebugBreak16( CONTEXT *regs )
{
const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" );
DEBUG_context = *regs;
DEBUG_Main( SIGTRAP );
}

232
debugger/dbgmain.c Normal file
View File

@ -0,0 +1,232 @@
/*
* File dbgmain.c - main wrapper for internal debugger test bed.
*
* Copyright (C) 1997, Eric Youngdale.
*/
#include <signal.h>
#include <ldt.h>
#include <windows.h>
#include <toolhelp.h>
#include <module.h>
#include <debugger.h>
#include <class.h>
#include <X11/Xlib.h>
#include "debugger.h"
#include "peexe.h"
ldt_copy_entry ldt_copy[LDT_SIZE];
unsigned char ldt_flags_copy[LDT_SIZE];
Display * display;
int
XUngrabPointer( Display * d, Time t)
{
return(0);
}
int
XUngrabServer( Display * d )
{
return(0);
}
int
XFlush(Display * d )
{
return(0);
}
HTASK16 GetCurrentTask()
{
exit(0);
}
HMODULE16 GetExePtr(HANDLE16 h)
{
exit(0);
}
LPSTR MODULE_GetModuleName( HMODULE16 hModule )
{
exit(0);
}
int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len )
{
exit(0);
}
void CLASS_DumpClass( CLASS *class )
{
exit(0);
}
void MODULE_DumpModule( HMODULE16 hmodule )
{
exit(0);
}
void QUEUE_DumpQueue( HQUEUE16 hQueue )
{
exit(0);
}
void WIN_DumpWindow( HWND32 hwnd )
{
exit(0);
}
void CLASS_WalkClasses()
{
exit(0);
}
void MODULE_WalkModules()
{
exit(0);
}
void QUEUE_WalkQueues()
{
exit(0);
}
void WIN_WalkWindows( HWND32 hwnd, int indent )
{
exit(0);
}
NE_MODULE *MODULE_GetPtr( HMODULE16 hModule )
{
exit(0);
}
FARPROC16 MODULE_GetEntryPoint( HMODULE16 hModule, WORD ordinal )
{
exit(0);
}
void LDT_Print( int start, int length )
{
exit(0);
}
LPVOID GlobalLock16(HGLOBAL16 h)
{
exit(0);
}
BOOL16 ModuleFirst(MODULEENTRY *lpModule)
{
return 0;
}
BOOL16 ModuleNext(MODULEENTRY *lpModule)
{
return 0;
}
BOOL16 IsBadReadPtr16(SEGPTR s,UINT16 o)
{
exit(0);
}
BOOL32 IsBadReadPtr32(LPCVOID s,UINT32 o)
{
exit(0);
}
struct qwert
{
unsigned flag1:1;
unsigned flag3:3;
signed remain:11;
unsigned whatsup:17;
} vvv;
int xyzzy(const char * qwe, int ijk)
{
return strlen(qwe) + ijk;
}
unsigned int * xxx;
unsigned int * yyy;
int xxx3[10];
char vdv[100];
struct deferred_debug_info
{
struct deferred_debug_info * next;
char * load_addr;
char * module_name;
char * dbg_info;
int dbg_size;
struct PE_Debug_dir * dbgdir;
struct pe_data * pe;
struct pe_segment_table * sectp;
int nsect;
short int dbg_index;
char loaded;
};
struct CodeViewDebug
{
char cv_nbtype[8];
unsigned int cv_timestamp;
char cv_unknown[4];
char cv_name[1];
};
test_pdbstuff()
{
struct deferred_debug_info deefer;
struct PE_Debug_dir dinfo;
struct CodeViewDebug cdebug;
struct pe_segment_table sects[10];
memset(&deefer, 0, sizeof(deefer));
memset(&dinfo, 0, sizeof(dinfo));
memset(&cdebug, 0, sizeof(cdebug));
memset(&sects, 0, sizeof(sects));
deefer.dbg_info = (char *) &cdebug;
dinfo.timestamp = 812932395;
cdebug.cv_timestamp = 833392137 /* 841951397 */;
deefer.dbgdir = &dinfo;
deefer.sectp = &sects;
deefer.nsect = 10;
DEBUG_InitTypes();
DEBUG_ProcessPDBFile(&deefer, "../dumpexe.pdb");
}
int
main(int argc, char * argv[])
{
extern char * DEBUG_argv0;
SIGCONTEXT reg;
strcpy(vdv, "This is a test");
memset(&vvv, 0xff, sizeof(vvv));
vvv.whatsup = 0;
vvv.flag3 = 0;
vvv.remain = 0x401;
DEBUG_argv0 = argv[0];
xxx = (unsigned int*) &vvv;
yyy = xxx + 5;
xxx3[5] = 7;
test_pdbstuff();
memset(&reg, 0, sizeof(reg));
wine_debug(SIGSEGV, &reg);
return 0;
}

View File

@ -34,11 +34,23 @@ static int syntax_error;
DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
FORMAT [bcdiswx]
IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~@]*
IDENTIFIER [_a-zA-Z~][_a-zA-Z0-9~@]*
PATHNAME [/_a-zA-Z\.~][/_a-zA-Z0-9\.~@]*
STRING \"[^\n"]+\"
%s FORMAT_EXPECTED
%s PATH_EXPECTED
%s INFO_CMD
%s HELP_CMD
%s DEL_CMD
%s WALK_CMD
%s SHOW_CMD
%s NOCMD
%%
\n { syntax_error = 0; return tEOL; } /*Indicates end of command*/
\n { BEGIN(0); syntax_error = 0;
return tEOL; } /*Indicates end of command. Reset state. */
"||" { return OP_LOR; }
"&&" { return OP_LAND; }
@ -48,16 +60,24 @@ IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~@]*
">=" { return OP_GE; }
"<<" { return OP_SHL; }
">>" { return OP_SHR; }
[-+<=>|&^()*/%:!~] { return *yytext; }
"->" { return OP_DRF; }
[-+<=>|&^()*/%:!~,\.] { return *yytext; }
"[" { return *yytext; }
"]" { return *yytext; }
"0x"{HEXDIGIT}+ { sscanf(yytext, "%x", &yylval.integer); return tNUM; }
{DIGIT}+ { sscanf(yytext, "%d", &yylval.integer); return tNUM; }
"/"{DIGIT}+{FORMAT} { char * last;
<FORMAT_EXPECTED>"/"{DIGIT}+{FORMAT} { char * last;
yylval.integer = strtol( yytext+1, &last, NULL );
yylval.integer = (yylval.integer << 8) | *last;
return tFORMAT; }
"/"{FORMAT} { yylval.integer = (1 << 8) | yytext[1]; return tFORMAT; }
<FORMAT_EXPECTED>"/"{FORMAT} { yylval.integer = (1 << 8) | yytext[1]; return tFORMAT; }
{STRING} { yylval.string = make_symbol(yytext); return tSTRING; }
$pc { yylval.reg = REG_EIP; return tREG; }
$flags { yylval.reg = REG_EFL; return tREG; }
@ -86,49 +106,60 @@ $ss { yylval.reg = REG_SS; return tREG; }
$fs { yylval.reg = REG_FS; return tREG; }
$gs { yylval.reg = REG_GS; return tREG; }
up { return tUP; }
down|dow|do { return tDOWN; }
frame|fram|fra|fr { return tFRAME; }
locals|local|loca|loc { return tLOCAL; }
info|inf|in { return tINFO; }
show|sho|sh { return tINFO; }
list|lis|li|l { return tLIST; }
break|brea|bre|br|b { return tBREAK; }
enable|enabl|enab|ena { return tENABLE;}
disable|disabl|disab|disa|dis { return tDISABLE; }
delete|delet|dele|del { return tDELETE; }
quit|qui|qu|q { return tQUIT; }
set|se { return tSET; }
walk|w { return tWALK; }
x { return tEXAM; }
<INITIAL>info|inf|in { BEGIN(INFO_CMD); return tINFO; }
<INITIAL>up { BEGIN(NOCMD); return tUP; }
<INITIAL>down|dow|do { BEGIN(NOCMD); return tDOWN; }
<INITIAL>frame|fram|fra|fr { BEGIN(NOCMD); return tFRAME; }
<INITIAL>list|lis|li|l { BEGIN(PATH_EXPECTED); return tLIST; }
<INITIAL>enable|enabl|enab|ena { BEGIN(NOCMD); return tENABLE;}
<INITIAL>disable|disabl|disab|disa|dis { BEGIN(NOCMD); return tDISABLE; }
<INITIAL,INFO_CMD,DEL_CMD>display|displa|displ|disp { BEGIN(NOCMD); return tDISPLAY; }
<INITIAL>undisplay|undispla|undispl|undisp|undis|undi|und { BEGIN(NOCMD); return tUNDISPLAY; }
<INITIAL>delete|delet|dele|del { BEGIN(DEL_CMD); return tDELETE; }
<INITIAL>quit|qui|qu|q { BEGIN(NOCMD); return tQUIT; }
<INITIAL>set|se { BEGIN(NOCMD); return tSET; }
<INITIAL>walk|w { BEGIN(WALK_CMD); return tWALK; }
<INITIAL>x { BEGIN(FORMAT_EXPECTED); return tEXAM; }
<INITIAL>help|hel|he|"?" { BEGIN(HELP_CMD); return tHELP; }
class|clas|cla { return tCLASS; }
module|modul|modu|mod { return tMODULE; }
queue|queu|que { return tQUEUE; }
registers|regs|reg|re { return tREGS; }
segments|segment|segm|seg|se { return tSEGMENTS; }
stack|stac|sta|st { return tSTACK; }
window|windo|wind|win|wnd { return tWND; }
<INITIAL>backtrace|backtrac|backtra|backt|back|bac|ba|bt { BEGIN(NOCMD); return tBACKTRACE; }
<INITIAL>where|wher|whe { BEGIN(NOCMD); return tBACKTRACE; }
help|hel|he|"?" { return tHELP; }
<INITIAL>cont|con|co|c { BEGIN(NOCMD); return tCONT; }
<INITIAL>condition|conditio|conditi|condit|condi|cond { BEGIN(NOCMD); return tCOND; }
<INITIAL>step|ste|st|s { BEGIN(NOCMD); return tSTEP; }
<INITIAL>next|nex|ne|n { BEGIN(NOCMD); return tNEXT; }
<INITIAL>stepi|si { BEGIN(NOCMD); return tSTEPI; }
<INITIAL>nexti|ni { BEGIN(NOCMD); return tNEXTI; }
<INITIAL>finish|finis|fini|fin|fi { BEGIN(NOCMD); return tFINISH; }
backtrace|backtrac|backtra|backt|back|bac|ba|bt { return tBACKTRACE; }
where|wher|whe { return tBACKTRACE; }
<INITIAL>abort|abor|abo { BEGIN(NOCMD); return tABORT; }
<INITIAL>print|prin|pri|pr|p { BEGIN(FORMAT_EXPECTED); return tPRINT; }
cont|con|co|c { return tCONT; }
step|ste|st|s { return tSTEP; }
next|nex|ne|n { return tNEXT; }
<INITIAL>mode { BEGIN(NOCMD); return tMODE; }
<INITIAL>show|sho|sh { BEGIN(SHOW_CMD); return tSHOW; }
symbolfile|symbolfil|symbolfi|symbolf|symbol|symbo|symb { return tSYMBOLFILE; }
<INFO_CMD,INITIAL>break|brea|bre|br|b { BEGIN(PATH_EXPECTED); return tBREAK; }
define|defin|defi|def|de { return tDEFINE; }
abort|abor|abo { return tABORT; }
print|prin|pri|pr|p { return tPRINT; }
<INFO_CMD>share|shar|sha { return tSHARE; }
<INFO_CMD>locals|local|loca|loc { return tLOCAL; }
<INFO_CMD,WALK_CMD>class|clas|cla { return tCLASS; }
<INFO_CMD,WALK_CMD>module|modul|modu|mod { return tMODULE; }
<INFO_CMD,WALK_CMD>queue|queu|que { return tQUEUE; }
<INFO_CMD>registers|regs|reg|re { return tREGS; }
<INFO_CMD>segments|segment|segm|seg|se { return tSEGMENTS; }
<INFO_CMD>stack|stac|sta|st { return tSTACK; }
<INFO_CMD,WALK_CMD>window|windo|wind|win|wnd { return tWND; }
<HELP_CMD>info|inf|in { return tINFO; }
mode { return tMODE; }
<INITIAL,SHOW_CMD>directories|directorie|directori|director|directo|direct|direc|direc|dir {
BEGIN(PATH_EXPECTED); return tDIR; }
{IDENTIFIER} { yylval.string = make_symbol(yytext); return tIDENTIFIER; }
<PATH_EXPECTED>{PATHNAME} { yylval.string = make_symbol(yytext); return tPATH; }
[ \t]+ /* Eat up whitespace */
. { if (syntax_error == 0)
@ -137,6 +168,7 @@ mode { return tMODE; }
}
}
%%
#ifndef yywrap
@ -217,7 +249,7 @@ static int dbg_read(char * buf, int size)
}
}
static char *local_symbols[10];
static char *local_symbols[30];
static int next_symbol;
char * make_symbol(char * symbol){

127
debugger/display.c Normal file
View File

@ -0,0 +1,127 @@
/*
* File display.c - display handling for Wine internal debugger.
*
* Copyright (C) 1997, Eric Youngdale.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <neexe.h>
#include "module.h"
#include "selectors.h"
#include "debugger.h"
#include "toolhelp.h"
#include "xmalloc.h"
#include <stdarg.h>
#define MAX_DISPLAY 25
static struct expr * displaypoints[MAX_DISPLAY];
int
DEBUG_AddDisplay(struct expr * exp)
{
int i;
/*
* First find a slot where we can store this display.
*/
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i] == NULL )
{
displaypoints[i] = DEBUG_CloneExpr(exp);
break;
}
}
return TRUE;
}
int
DEBUG_InfoDisplay()
{
int i;
/*
* First find a slot where we can store this display.
*/
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i] != NULL )
{
fprintf(stderr, "%d : ", i+1);
DEBUG_DisplayExpr(displaypoints[i]);
fprintf(stderr, "\n");
}
}
return TRUE;
}
int
DEBUG_DoDisplay()
{
DBG_ADDR addr;
int i;
/*
* First find a slot where we can store this display.
*/
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i] != NULL )
{
addr = DEBUG_EvalExpr(displaypoints[i]);
if( addr.type == NULL )
{
fprintf(stderr, "Unable to evaluate expression ");
DEBUG_DisplayExpr(displaypoints[i]);
fprintf(stderr, "\nDisabling...\n");
DEBUG_DelDisplay(i);
}
else
{
fprintf(stderr, "%d : ", i + 1);
DEBUG_DisplayExpr(displaypoints[i]);
fprintf(stderr, " = ");
DEBUG_Print( &addr, 1, 0, 0);
}
}
}
return TRUE;
}
int
DEBUG_DelDisplay(int displaynum)
{
int i;
if( displaynum >= MAX_DISPLAY || displaynum == 0 || displaynum < -1 )
{
fprintf(stderr, "Invalid display number\n");
return TRUE;
}
if( displaynum == -1 )
{
for(i=0; i < MAX_DISPLAY; i++ )
{
if( displaypoints[i] != NULL )
{
DEBUG_FreeExpr(displaypoints[i]);
displaypoints[i] = NULL;
}
}
}
else if( displaypoints[displaynum - 1] != NULL )
{
DEBUG_FreeExpr(displaypoints[displaynum - 1]);
displaypoints[displaynum - 1] = NULL;
}
return TRUE;
}

878
debugger/expr.c Normal file
View File

@ -0,0 +1,878 @@
/*
* File expr.c - expression handling for Wine internal debugger.
*
* Copyright (C) 1997, Eric Youngdale.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <neexe.h>
#include "module.h"
#include "selectors.h"
#include "debugger.h"
#include "toolhelp.h"
#include "xmalloc.h"
#include "expr.h"
#include <stdarg.h>
struct expr
{
unsigned int perm;
unsigned int type:31;
union
{
struct
{
int value;
} constant;
struct
{
const char * str;
} string;
struct
{
unsigned int value;
} u_const;
struct
{
const char * name;
} symbol;
struct
{
enum debug_regs reg;
int result;
} rgister;
struct
{
int unop_type;
struct expr * exp1;
int result;
} unop;
struct
{
int binop_type;
int result;
struct expr * exp1;
struct expr * exp2;
} binop;
struct
{
struct expr * exp1;
const char * element_name;
int result;
} structure;
struct
{
struct expr * base;
struct expr * index;
} array;
struct
{
const char * funcname;
int nargs;
int result;
struct expr * arg[5];
} call;
} un;
};
#define EXPR_TYPE_CONST 0
#define EXPR_TYPE_US_CONST 1
#define EXPR_TYPE_SYMBOL 2
#define EXPR_TYPE_REGISTER 3
#define EXPR_TYPE_BINOP 4
#define EXPR_TYPE_UNOP 5
#define EXPR_TYPE_STRUCT 6
#define EXPR_TYPE_PSTRUCT 7
#define EXPR_TYPE_ARRAY 8
#define EXPR_TYPE_CALL 9
#define EXPR_TYPE_STRING 10
static char expr_list[4096];
static int next_expr_free = 0;
/*
* This is how we turn an expression address into the actual value.
* This works well in the 32 bit domain - not sure at all about the
* 16 bit world.
*/
#define VAL(_exp) DEBUG_GetExprValue(&_exp, NULL)
static
struct expr *
DEBUG_GetFreeExpr()
{
struct expr * rtn;
rtn = (struct expr *) &expr_list[next_expr_free];
next_expr_free += sizeof(struct expr);
return rtn;
}
void
DEBUG_FreeExprMem()
{
next_expr_free = 0;
}
struct expr *
DEBUG_RegisterExpr(enum debug_regs regno)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_REGISTER;
ex->un.rgister.reg = regno;
return ex;
}
struct expr *
DEBUG_SymbolExpr(const char * name)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_SYMBOL;
ex->un.symbol.name = name;
return ex;
}
struct expr *
DEBUG_ConstExpr(int value)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_CONST;
ex->un.constant.value = value;
return ex;
}
struct expr *
DEBUG_StringExpr(const char * str)
{
struct expr * ex;
char * pnt;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_STRING;
ex->un.string.str = str+1;
pnt = strrchr(ex->un.string.str, '"');
if( pnt != NULL )
{
*pnt = '\0';
}
return ex;
}
struct expr *
DEBUG_USConstExpr(unsigned int value)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_CONST;
ex->un.u_const.value = value;
return ex;
}
struct expr *
DEBUG_BinopExpr(int operator_type, struct expr * exp1, struct expr * exp2)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_BINOP;
ex->un.binop.binop_type = operator_type;
ex->un.binop.exp1 = exp1;
ex->un.binop.exp2 = exp2;
return ex;
}
struct expr *
DEBUG_UnopExpr(int operator_type, struct expr * exp1)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_UNOP;
ex->un.unop.unop_type = operator_type;
ex->un.unop.exp1 = exp1;
return ex;
}
struct expr *
DEBUG_StructExpr(struct expr * exp, const char * element)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_STRUCT;
ex->un.structure.exp1 = exp;
ex->un.structure.element_name = element;
return ex;
}
struct expr *
DEBUG_StructPExpr(struct expr * exp, const char * element)
{
struct expr * ex;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_PSTRUCT;
ex->un.structure.exp1 = exp;
ex->un.structure.element_name = element;
return ex;
}
struct expr *
DEBUG_CallExpr(const char * funcname, int nargs, ...)
{
struct expr * ex;
va_list ap;
int i;
ex = DEBUG_GetFreeExpr();
ex->type = EXPR_TYPE_CALL;
ex->un.call.funcname = funcname;
ex->un.call.nargs = nargs;
va_start(ap, nargs);
for(i=0; i < nargs; i++)
{
ex->un.call.arg[i] = va_arg(ap, struct expr *);
}
va_end(ap);
return ex;
}
DBG_ADDR
DEBUG_EvalExpr(struct expr * exp)
{
DBG_ADDR rtn;
int i;
DBG_ADDR exp1;
DBG_ADDR exp2;
unsigned int cexp[5];
int (*fptr)();
int scale1;
int scale2;
int scale3;
struct datatype * type1;
struct datatype * type2;
rtn.type = NULL;
rtn.off = NULL;
rtn.seg = NULL;
switch(exp->type)
{
case EXPR_TYPE_STRING:
rtn.type = DEBUG_TypeString;
rtn.off = (unsigned int) &exp->un.string.str;
rtn.seg = 0;
break;
case EXPR_TYPE_CONST:
rtn.type = DEBUG_TypeIntConst;
rtn.off = (unsigned int) &exp->un.constant.value;
rtn.seg = 0;
break;
case EXPR_TYPE_US_CONST:
rtn.type = DEBUG_TypeUSInt;
rtn.off = (unsigned int) &exp->un.u_const.value;
rtn.seg = 0;
break;
case EXPR_TYPE_SYMBOL:
if( !DEBUG_GetSymbolValue(exp->un.symbol.name, -1, &rtn, FALSE ) )
{
rtn.type = NULL;
rtn.off = 0;
rtn.seg = 0;
};
break;
case EXPR_TYPE_PSTRUCT:
exp1 = DEBUG_EvalExpr(exp->un.structure.exp1);
if( exp1.type == NULL )
{
break;
}
rtn.off = DEBUG_TypeDerefPointer(&exp1, &type1);
if( type1 == NULL )
{
break;
}
rtn.type = type1;
DEBUG_FindStructElement(&rtn, exp->un.structure.element_name,
&exp->un.structure.result);
break;
case EXPR_TYPE_STRUCT:
exp1 = DEBUG_EvalExpr(exp->un.structure.exp1);
if( exp1.type == NULL )
{
break;
}
rtn = exp1;
DEBUG_FindStructElement(&rtn, exp->un.structure.element_name,
&exp->un.structure.result);
break;
case EXPR_TYPE_CALL:
/*
* First, evaluate all of the arguments. If any of them are not
* evaluable, then bail.
*/
for(i=0; i < exp->un.call.nargs; i++)
{
exp1 = DEBUG_EvalExpr(exp->un.call.arg[i]);
if( exp1.type == NULL )
{
return rtn;
}
cexp[i] = DEBUG_GetExprValue(&exp1, NULL);
}
/*
* Now look up the address of the function itself.
*/
if( !DEBUG_GetSymbolValue(exp->un.call.funcname, -1, &rtn, FALSE ) )
{
fprintf(stderr, "Failed to find symbol\n");
break;
};
fptr = (int (*)()) rtn.off;
switch(exp->un.call.nargs)
{
case 0:
exp->un.call.result = (*fptr)();
break;
case 1:
exp->un.call.result = (*fptr)(cexp[0]);
break;
case 2:
exp->un.call.result = (*fptr)(cexp[0], cexp[1]);
break;
case 3:
exp->un.call.result = (*fptr)(cexp[0], cexp[1], cexp[2]);
break;
case 4:
exp->un.call.result = (*fptr)(cexp[0], cexp[1], cexp[2], cexp[3]);
break;
case 5:
exp->un.call.result = (*fptr)(cexp[0], cexp[1], cexp[2], cexp[3], cexp[4]);
break;
}
rtn.type = DEBUG_TypeInt;
rtn.off = (unsigned int) &exp->un.call.result;
break;
case EXPR_TYPE_REGISTER:
rtn.type = DEBUG_TypeIntConst;
exp->un.rgister.result = DEBUG_GetRegister(exp->un.rgister.reg);
rtn.off = (unsigned int) &exp->un.rgister.result;
rtn.seg = 0;
break;
case EXPR_TYPE_BINOP:
exp1 = DEBUG_EvalExpr(exp->un.binop.exp1);
exp2 = DEBUG_EvalExpr(exp->un.binop.exp2);
if( exp1.type == NULL || exp2.type == NULL )
{
break;
}
if( exp1.type == DEBUG_TypeIntConst && exp2.type == DEBUG_TypeIntConst )
{
rtn.type = exp1.type;
}
else
{
rtn.type = DEBUG_TypeInt;
}
rtn.off = (unsigned int) &exp->un.binop.result;
switch(exp->un.binop.binop_type)
{
case EXP_OP_ADD:
type1 = DEBUG_GetPointerType(exp1.type);
type2 = DEBUG_GetPointerType(exp2.type);
scale1 = 1;
scale2 = 1;
if( type1 != NULL && type2 != NULL )
{
break;
}
else if( type1 != NULL )
{
scale2 = DEBUG_GetObjectSize(type1);
rtn.type = exp1.type;
}
else if( type2 != NULL )
{
scale1 = DEBUG_GetObjectSize(type2);
rtn.type = exp2.type;
}
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) * scale1 + scale2 * VAL(exp2));
break;
case EXP_OP_SUB:
type1 = DEBUG_GetPointerType(exp1.type);
type2 = DEBUG_GetPointerType(exp2.type);
scale1 = 1;
scale2 = 1;
scale3 = 1;
if( type1 != NULL && type2 != NULL )
{
if( type1 != type2 )
{
break;
}
scale3 = DEBUG_GetObjectSize(type1);
}
else if( type1 != NULL )
{
scale2 = DEBUG_GetObjectSize(type1);
rtn.type = exp1.type;
}
else if( type2 != NULL )
{
scale1 = DEBUG_GetObjectSize(type2);
rtn.type = exp2.type;
}
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) - VAL(exp2)) / scale3;
break;
case EXP_OP_SEG:
rtn.seg = VAL(exp1);
exp->un.binop.result = VAL(exp2);
break;
case EXP_OP_LOR:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) || VAL(exp2));
break;
case EXP_OP_LAND:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) && VAL(exp2));
break;
case EXP_OP_OR:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) | VAL(exp2));
break;
case EXP_OP_AND:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) & VAL(exp2));
break;
case EXP_OP_XOR:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) ^ VAL(exp2));
break;
case EXP_OP_EQ:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) == VAL(exp2));
break;
case EXP_OP_GT:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) > VAL(exp2));
break;
case EXP_OP_LT:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) < VAL(exp2));
break;
case EXP_OP_GE:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) >= VAL(exp2));
break;
case EXP_OP_LE:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) <= VAL(exp2));
break;
case EXP_OP_NE:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) != VAL(exp2));
break;
case EXP_OP_SHL:
rtn.seg = 0;
exp->un.binop.result = ((unsigned) VAL(exp1) << VAL(exp2));
break;
case EXP_OP_SHR:
rtn.seg = 0;
exp->un.binop.result = ((unsigned) VAL(exp1) << VAL(exp2));
break;
case EXP_OP_MUL:
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) * VAL(exp2));
break;
case EXP_OP_DIV:
if( VAL(exp2) != 0 )
{
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) / VAL(exp2));
}
else
{
rtn.seg = 0;
rtn.type = NULL;
rtn.off = 0;
}
break;
case EXP_OP_REM:
if( VAL(exp2) != 0 )
{
rtn.seg = 0;
exp->un.binop.result = (VAL(exp1) % VAL(exp2));
}
else
{
rtn.seg = 0;
rtn.type = NULL;
rtn.off = 0;
}
break;
case EXP_OP_ARR:
DEBUG_ArrayIndex(&exp1, &rtn, VAL(exp2));
break;
default:
break;
}
break;
case EXPR_TYPE_UNOP:
exp1 = DEBUG_EvalExpr(exp->un.unop.exp1);
if( exp1.type == NULL )
{
break;
}
rtn.off = (unsigned int) &exp->un.unop.result;
if( exp1.type == DEBUG_TypeIntConst )
{
rtn.type = exp1.type;
}
else
{
rtn.type = DEBUG_TypeInt;
}
switch(exp->un.binop.binop_type)
{
case EXP_OP_NEG:
rtn.seg = 0;
exp->un.unop.result = -VAL(exp1);
break;
case EXP_OP_NOT:
rtn.seg = 0;
exp->un.unop.result = !VAL(exp1);
break;
case EXP_OP_LNOT:
rtn.seg = 0;
exp->un.unop.result = ~VAL(exp1);
break;
case EXP_OP_DEREF:
rtn.seg = 0;
rtn.off = (unsigned int) DEBUG_TypeDerefPointer(&exp1, &rtn.type);
break;
case EXP_OP_FORCE_DEREF:
rtn.seg = 0;
rtn.off = *(unsigned int *) exp1.off;
break;
case EXP_OP_ADDR:
rtn.seg = 0;
rtn.type = DEBUG_FindOrMakePointerType(exp1.type);
exp->un.unop.result = exp1.off;
break;
}
break;
default:
fprintf(stderr,"Unexpected expression.\n");
exit(123);
break;
}
return rtn;
}
int
DEBUG_DisplayExpr(struct expr * exp)
{
int i;
switch(exp->type)
{
case EXPR_TYPE_REGISTER:
DEBUG_PrintRegister(exp->un.rgister.reg);
break;
case EXPR_TYPE_US_CONST:
fprintf(stderr, "%ud", exp->un.u_const.value);
break;
case EXPR_TYPE_CONST:
fprintf(stderr, "%d", exp->un.u_const.value);
break;
case EXPR_TYPE_STRING:
fprintf(stderr, "\"%s\"", exp->un.string.str);
break;
case EXPR_TYPE_SYMBOL:
fprintf(stderr, "%s" , exp->un.symbol.name);
break;
case EXPR_TYPE_PSTRUCT:
DEBUG_DisplayExpr(exp->un.structure.exp1);
fprintf(stderr, "->%s", exp->un.structure.element_name);
break;
case EXPR_TYPE_STRUCT:
DEBUG_DisplayExpr(exp->un.structure.exp1);
fprintf(stderr, ".%s", exp->un.structure.element_name);
break;
case EXPR_TYPE_CALL:
/*
* First, evaluate all of the arguments. If any of them are not
* evaluable, then bail.
*/
fprintf(stderr, "%s(",exp->un.call.funcname);
for(i=0; i < exp->un.call.nargs; i++)
{
DEBUG_DisplayExpr(exp->un.call.arg[i]);
if( i != exp->un.call.nargs - 1 )
{
fprintf(stderr, ", ");
}
}
fprintf(stderr, ")");
break;
case EXPR_TYPE_BINOP:
fprintf(stderr, "( ");
DEBUG_DisplayExpr(exp->un.binop.exp1);
switch(exp->un.binop.binop_type)
{
case EXP_OP_ADD:
fprintf(stderr, " + ");
break;
case EXP_OP_SUB:
fprintf(stderr, " - ");
break;
case EXP_OP_SEG:
fprintf(stderr, ":");
break;
case EXP_OP_LOR:
fprintf(stderr, " || ");
break;
case EXP_OP_LAND:
fprintf(stderr, " && ");
break;
case EXP_OP_OR:
fprintf(stderr, " | ");
break;
case EXP_OP_AND:
fprintf(stderr, " & ");
break;
case EXP_OP_XOR:
fprintf(stderr, " ^ ");
break;
case EXP_OP_EQ:
fprintf(stderr, " == ");
break;
case EXP_OP_GT:
fprintf(stderr, " > ");
break;
case EXP_OP_LT:
fprintf(stderr, " < ");
break;
case EXP_OP_GE:
fprintf(stderr, " >= ");
break;
case EXP_OP_LE:
fprintf(stderr, " <= ");
break;
case EXP_OP_NE:
fprintf(stderr, " != ");
break;
case EXP_OP_SHL:
fprintf(stderr, " << ");
break;
case EXP_OP_SHR:
fprintf(stderr, " >> ");
break;
case EXP_OP_MUL:
fprintf(stderr, " * ");
break;
case EXP_OP_DIV:
fprintf(stderr, " / ");
break;
case EXP_OP_REM:
fprintf(stderr, " %% ");
break;
case EXP_OP_ARR:
fprintf(stderr, "[");
break;
default:
break;
}
DEBUG_DisplayExpr(exp->un.binop.exp2);
if( exp->un.binop.binop_type == EXP_OP_ARR )
{
fprintf(stderr, "]");
}
fprintf(stderr, " )");
break;
case EXPR_TYPE_UNOP:
switch(exp->un.binop.binop_type)
{
case EXP_OP_NEG:
fprintf(stderr, "-");
break;
case EXP_OP_NOT:
fprintf(stderr, "!");
break;
case EXP_OP_LNOT:
fprintf(stderr, "~");
break;
case EXP_OP_DEREF:
fprintf(stderr, "*");
break;
case EXP_OP_ADDR:
fprintf(stderr, "&");
break;
}
DEBUG_DisplayExpr(exp->un.unop.exp1);
break;
default:
fprintf(stderr,"Unexpected expression.\n");
exit(123);
break;
}
return TRUE;
}
struct expr *
DEBUG_CloneExpr(struct expr * exp)
{
int i;
struct expr * rtn;
rtn = (struct expr *) xmalloc(sizeof(struct expr));
/*
* First copy the contents of the expression itself.
*/
*rtn = *exp;
switch(exp->type)
{
case EXPR_TYPE_REGISTER:
case EXPR_TYPE_US_CONST:
case EXPR_TYPE_CONST:
break;
case EXPR_TYPE_STRING:
rtn->un.string.str = xstrdup(exp->un.string.str);
break;
case EXPR_TYPE_SYMBOL:
rtn->un.symbol.name = xstrdup(exp->un.symbol.name);
break;
case EXPR_TYPE_PSTRUCT:
case EXPR_TYPE_STRUCT:
rtn->un.structure.exp1 = DEBUG_CloneExpr(exp->un.structure.exp1);
rtn->un.structure.element_name = xstrdup(exp->un.structure.element_name);
break;
case EXPR_TYPE_CALL:
/*
* First, evaluate all of the arguments. If any of them are not
* evaluable, then bail.
*/
for(i=0; i < exp->un.call.nargs; i++)
{
rtn->un.call.arg[i] = DEBUG_CloneExpr(exp->un.call.arg[i]);
}
rtn->un.call.funcname = xstrdup(exp->un.call.funcname);
break;
case EXPR_TYPE_BINOP:
rtn->un.binop.exp1 = DEBUG_CloneExpr(exp->un.binop.exp1);
rtn->un.binop.exp2 = DEBUG_CloneExpr(exp->un.binop.exp2);
break;
case EXPR_TYPE_UNOP:
rtn->un.unop.exp1 = DEBUG_CloneExpr(exp->un.unop.exp1);
break;
default:
fprintf(stderr,"Unexpected expression.\n");
exit(123);
break;
}
return rtn;
}
/*
* Recursively go through an expression tree and free all memory associated
* with it.
*/
int
DEBUG_FreeExpr(struct expr * exp)
{
int i;
switch(exp->type)
{
case EXPR_TYPE_REGISTER:
case EXPR_TYPE_US_CONST:
case EXPR_TYPE_CONST:
break;
case EXPR_TYPE_STRING:
free((char *) exp->un.string.str);
break;
case EXPR_TYPE_SYMBOL:
free((char *) exp->un.symbol.name);
break;
case EXPR_TYPE_PSTRUCT:
case EXPR_TYPE_STRUCT:
DEBUG_FreeExpr(exp->un.structure.exp1);
free((char *) exp->un.structure.element_name);
break;
case EXPR_TYPE_CALL:
/*
* First, evaluate all of the arguments. If any of them are not
* evaluable, then bail.
*/
for(i=0; i < exp->un.call.nargs; i++)
{
DEBUG_FreeExpr(exp->un.call.arg[i]);
}
free((char *) exp->un.call.funcname);
break;
case EXPR_TYPE_BINOP:
DEBUG_FreeExpr(exp->un.binop.exp1);
DEBUG_FreeExpr(exp->un.binop.exp2);
break;
case EXPR_TYPE_UNOP:
DEBUG_FreeExpr(exp->un.unop.exp1);
break;
default:
fprintf(stderr,"Unexpected expression.\n");
exit(123);
break;
}
free(exp);
return TRUE;
}

26
debugger/expr.h Normal file
View File

@ -0,0 +1,26 @@
#define EXP_OP_LOR 0x01
#define EXP_OP_LAND 0x02
#define EXP_OP_OR 0x03
#define EXP_OP_AND 0x04
#define EXP_OP_XOR 0x05
#define EXP_OP_EQ 0x06
#define EXP_OP_GT 0x07
#define EXP_OP_LT 0x08
#define EXP_OP_GE 0x09
#define EXP_OP_LE 0x0a
#define EXP_OP_NE 0x0b
#define EXP_OP_SHL 0x0c
#define EXP_OP_SHR 0x0d
#define EXP_OP_ADD 0x0e
#define EXP_OP_SUB 0x0f
#define EXP_OP_MUL 0x10
#define EXP_OP_DIV 0x11
#define EXP_OP_REM 0x12
#define EXP_OP_NEG 0x13
#define EXP_OP_NOT 0x24
#define EXP_OP_LNOT 0x25
#define EXP_OP_DEREF 0x26
#define EXP_OP_ADDR 0x27
#define EXP_OP_ARR 0x28
#define EXP_OP_SEG 0x29
#define EXP_OP_FORCE_DEREF 0x2a

File diff suppressed because it is too large Load Diff

View File

@ -8,66 +8,56 @@
#include <stdio.h>
#include <stdlib.h>
#include "debugger.h"
#include "expr.h"
/***********************************************************************
* DEBUG_Print
*
* Implementation of the 'print' command.
*/
void DEBUG_Print( const DBG_ADDR *addr, int count, char format )
void DEBUG_PrintBasic( const DBG_ADDR *addr, int count, char format )
{
if (count != 1)
char * default_format;
long long int value;
if( addr->type == NULL )
{
fprintf( stderr, "Count other than 1 is meaningless in 'print' command\n" );
return;
fprintf(stderr, "Unable to evaluate expression\n");
return;
}
default_format = NULL;
value = DEBUG_GetExprValue((DBG_ADDR *) addr, &default_format);
if (addr->seg && (addr->seg != 0xffffffff))
{
switch(format)
{
case 'x':
fprintf( stderr, "0x%04lx:", addr->seg );
break;
case 'd':
fprintf( stderr, "%ld:", addr->seg );
break;
case 'c':
break; /* No segment to print */
case 'i':
case 's':
case 'w':
case 'b':
break; /* Meaningless format */
}
}
switch(format)
switch(format)
{
case 'x':
if (addr->seg) fprintf( stderr, "0x%04lx\n", addr->off );
else fprintf( stderr, "0x%08lx\n", addr->off );
break;
if (addr->seg) fprintf( stderr, "0x%04lx", (long unsigned int) value );
else fprintf( stderr, "0x%08lx", (long unsigned int) value );
break;
case 'd':
fprintf( stderr, "%ld\n", addr->off );
break;
fprintf( stderr, "%ld\n", (long int) value );
break;
case 'c':
fprintf( stderr, "%d = '%c'\n",
(char)(addr->off & 0xff), (char)(addr->off & 0xff) );
break;
fprintf( stderr, "%d = '%c'",
(char)(value & 0xff), (char)(value & 0xff) );
break;
case 'i':
case 's':
case 'w':
case 'b':
fprintf( stderr, "Format specifier '%c' is meaningless in 'print' command\n", format );
break;
fprintf( stderr, "Format specifier '%c' is meaningless in 'print' command\n", format );
case 0:
if( default_format != NULL )
{
fprintf( stderr, default_format, value );
}
break;
}
}
@ -76,17 +66,19 @@ void DEBUG_Print( const DBG_ADDR *addr, int count, char format )
*
* Print an 16- or 32-bit address, with the nearest symbol if any.
*/
struct name_hash *
struct symbol_info
DEBUG_PrintAddress( const DBG_ADDR *addr, int addrlen, int flag )
{
struct name_hash * nh;
const char *name = DEBUG_FindNearestSymbol( addr, flag, &nh, 0 );
struct symbol_info rtn;
const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, 0,
&rtn.list );
if (addr->seg) fprintf( stderr, "0x%04lx:", addr->seg );
if (addrlen == 16) fprintf( stderr, "0x%04lx", addr->off );
else fprintf( stderr, "0x%08lx", addr->off );
if (name) fprintf( stderr, " (%s)", name );
return nh;
return rtn;
}
/***********************************************************************
* DEBUG_PrintAddressAndArgs
@ -95,19 +87,21 @@ DEBUG_PrintAddress( const DBG_ADDR *addr, int addrlen, int flag )
* Similar to DEBUG_PrintAddress, but we print the arguments to
* each function (if known). This is useful in a backtrace.
*/
struct name_hash *
struct symbol_info
DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr, int addrlen,
unsigned int ebp, int flag )
{
struct name_hash * nh;
const char *name = DEBUG_FindNearestSymbol( addr, flag, &nh, ebp );
struct symbol_info rtn;
const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, ebp,
&rtn.list );
if (addr->seg) fprintf( stderr, "0x%04lx:", addr->seg );
if (addrlen == 16) fprintf( stderr, "0x%04lx", addr->off );
else fprintf( stderr, "0x%08lx", addr->off );
if (name) fprintf( stderr, " (%s)", name );
return nh;
return rtn;
}
@ -121,23 +115,28 @@ void DEBUG_Help(void)
int i = 0;
static const char * const helptext[] =
{
"The commands accepted by the Wine debugger are a small subset",
"of the commands that gdb would accept.",
"The commands accepted by the Wine debugger are a reasonable",
"of the commands that gdb accepts.",
"The commands currently are:",
" break [*<addr>] delete break bpnum",
" disable bpnum enable bpnum",
" condition <bpnum> [<expr>]",
" help quit",
" bt cont",
" step next",
" bt cont [N]",
" step [N] next [N]",
" stepi [N] nexti [N]",
" x <addr> print <expr>",
" set <reg> = <expr> set *<addr> = <expr>",
" symbolfile <filename> define <identifier> <addr>",
" up down\n",
" list <addr> frame <n>\n",
" up down",
" list <lines> frame <n>",
" finish show dir",
" dir <path> display <expr>",
" delete display <disnum> undisplay <disnum>\n",
"Wine-specific commands:",
" mode [16,32] walk [wnd,class,queue] <handle>",
" info [reg,stack,break,segments,locals] info [wnd, queue] <handle>\n",
" info (see 'help info' for options)\n",
"The 'x' command accepts repeat counts and formats (including 'i') in the",
"same way that gdb does.\n",
@ -155,25 +154,31 @@ NULL
}
/***********************************************************************
* DEBUG_List
* DEBUG_HelpInfo
*
* Implementation of the 'list' command.
* Implementation of the 'help info' command.
*/
void DEBUG_List( DBG_ADDR *addr, int count )
void DEBUG_HelpInfo(void)
{
static DBG_ADDR lasttime = { 0xffffffff, 0 };
int i = 0;
static const char * const infotext[] =
{
"The info commands allow you to get assorted bits of interesting stuff",
"to be displayed. The options are:",
" info break Dumps information about breakpoints",
" info display Shows auto-display expressions in use",
" info locals Displays values of all local vars for current frame",
" info module Displays information about all modules",
" info queue <handle> Dumps queue information",
" info reg Displays values in all registers at top of stack",
" info segments Dumps information about all known segments",
" info share Dumps information about shared libraries",
" info stack Dumps information about top of stack",
" info wnd <handle> Dumps information about all windows",
"",
NULL
};
if (addr == NULL) addr = &lasttime;
DBG_FIX_ADDR_SEG( addr, CS_reg(&DEBUG_context) );
while (count-- > 0)
{
DEBUG_PrintAddress( addr, dbg_mode, FALSE );
fprintf( stderr, ": " );
if (!DBG_CHECK_READ_PTR( addr, 1 )) return;
DEBUG_Disasm( addr );
fprintf (stderr, "\n");
}
lasttime = *addr;
while(infotext[i]) fprintf(stderr,"%s\n", infotext[i++]);
}

View File

@ -142,15 +142,31 @@ void DEBUG_WriteMemory( const DBG_ADDR *address, int value )
*/
void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
{
DBG_ADDR addr = *address;
unsigned char * pnt;
unsigned int * dump;
unsigned short int * wdump;
int i;
DBG_ADDR addr = * address;
unsigned int * dump;
int i;
unsigned char * pnt;
struct datatype * testtype;
unsigned short int * wdump;
DBG_FIX_ADDR_SEG( &addr, (format == 'i') ?
CS_reg(&DEBUG_context) : DS_reg(&DEBUG_context) );
/*
* Dereference pointer to get actual memory address we need to be
* reading. We will use the same segment as what we have already,
* and hope that this is a sensible thing to do.
*/
if( addr.type != NULL )
{
if (!DBG_CHECK_READ_PTR( &addr, 1 )) return;
DEBUG_TypeDerefPointer(&addr, &testtype);
if( testtype != NULL || addr.type == DEBUG_TypeIntConst )
{
addr.off = DEBUG_GetExprValue(&addr, NULL);
}
}
if (format != 'i' && count > 1)
{
DEBUG_PrintAddress( &addr, dbg_mode, FALSE );
@ -179,7 +195,7 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
DEBUG_PrintAddress( &addr, dbg_mode, TRUE );
fprintf(stderr,": ");
if (!DBG_CHECK_READ_PTR( &addr, 1 )) return;
DEBUG_Disasm( &addr );
DEBUG_Disasm( &addr, TRUE );
fprintf(stderr,"\n");
}
return;

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,41 @@ void DEBUG_SetRegister( enum debug_regs reg, int val )
}
int
DEBUG_PrintRegister(enum debug_regs reg)
{
switch(reg)
{
case REG_EAX: fprintf(stderr, "%%eax"); break;
case REG_EBX: fprintf(stderr, "%%ebx"); break;
case REG_ECX: fprintf(stderr, "%%ecx"); break;
case REG_EDX: fprintf(stderr, "%%edx"); break;
case REG_ESI: fprintf(stderr, "%%esi"); break;
case REG_EDI: fprintf(stderr, "%%edi"); break;
case REG_EBP: fprintf(stderr, "%%ebp"); break;
case REG_EFL: fprintf(stderr, "%%efl"); break;
case REG_EIP: fprintf(stderr, "%%eip"); break;
case REG_ESP: fprintf(stderr, "%%esp"); break;
case REG_AX: fprintf(stderr, "%%ax"); break;
case REG_BX: fprintf(stderr, "%%bx"); break;
case REG_CX: fprintf(stderr, "%%cx"); break;
case REG_DX: fprintf(stderr, "%%dx"); break;
case REG_SI: fprintf(stderr, "%%si"); break;
case REG_DI: fprintf(stderr, "%%di"); break;
case REG_BP: fprintf(stderr, "%%bp"); break;
case REG_FL: fprintf(stderr, "%%fl"); break;
case REG_IP: fprintf(stderr, "%%ip"); break;
case REG_SP: fprintf(stderr, "%%sp"); break;
case REG_CS: fprintf(stderr, "%%cs"); break;
case REG_DS: fprintf(stderr, "%%ds"); break;
case REG_ES: fprintf(stderr, "%%es"); break;
case REG_SS: fprintf(stderr, "%%ss"); break;
case REG_FS: fprintf(stderr, "%%fs"); break;
case REG_GS: fprintf(stderr, "%%gs"); break;
}
return TRUE;
}
/***********************************************************************
* DEBUG_GetRegister
*

433
debugger/source.c Normal file
View File

@ -0,0 +1,433 @@
/*
* File source.c - source file handling for internal debugger.
*
* Copyright (C) 1997, Eric Youngdale.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <limits.h>
#include <strings.h>
#include <unistd.h>
#include <malloc.h>
#include "win.h"
#include "pe_image.h"
#include "peexe.h"
#include "debugger.h"
#include "peexe.h"
#include "xmalloc.h"
struct searchlist
{
char * path;
struct searchlist * next;
};
struct open_filelist
{
char * path;
char * real_path;
struct open_filelist * next;
unsigned int size;
signed int nlines;
unsigned int * linelist;
};
static struct open_filelist * ofiles;
static struct searchlist * listhead;
static char DEBUG_current_sourcefile[PATH_MAX];
static int DEBUG_start_sourceline = -1;
static int DEBUG_end_sourceline = -1;
void
DEBUG_ShowDir()
{
struct searchlist * sl;
fprintf(stderr,"Search list :\n");
for(sl = listhead; sl; sl = sl->next)
{
fprintf(stderr, "\t%s\n", sl->path);
}
fprintf(stderr, "\n");
}
void
DEBUG_AddPath(const char * path)
{
struct searchlist * sl;
sl = (struct searchlist *) xmalloc(sizeof(struct searchlist));
if( sl == NULL )
{
return;
}
sl->next = listhead;
sl->path = xstrdup(path);
listhead = sl;
}
void
DEBUG_NukePath()
{
struct searchlist * sl;
struct searchlist * nxt;
for(sl = listhead; sl; sl = nxt)
{
nxt = sl->next;
free(sl->path);
free(sl);
}
listhead = NULL;
}
static
void
DEBUG_DisplaySource(char * sourcefile, int start, int end)
{
char * addr;
char buffer[1024];
int fd;
int i;
struct open_filelist * ol;
int nlines;
char * pnt;
struct searchlist * sl;
struct stat statbuf;
int status;
char tmppath[PATH_MAX];
/*
* First see whether we have the file open already. If so, then
* use that, otherwise we have to try and open it.
*/
for(ol = ofiles; ol; ol = ol->next)
{
if( strcmp(ol->path, sourcefile) == 0 )
{
break;
}
}
if( ol == NULL )
{
/*
* Try again, stripping the path from the opened file.
*/
for(ol = ofiles; ol; ol = ol->next)
{
pnt = strrchr(ol->path, '/');
if( pnt != NULL && strcmp(pnt + 1, sourcefile) == 0 )
{
break;
}
}
}
if( ol == NULL )
{
/*
* See if this is a DOS style name or not.
*/
pnt = strchr(sourcefile, '\\' );
if( pnt == NULL )
{
pnt = strchr(sourcefile, '/' );
if( pnt == NULL )
{
pnt = sourcefile;
}
}
/*
* Crapola. We need to try and open the file.
*/
status = stat(sourcefile, &statbuf);
if( status != -1 )
{
strcpy(tmppath, sourcefile);
}
else
{
for(sl = listhead; sl; sl = sl->next)
{
strcpy(tmppath, sl->path);
if( tmppath[strlen(tmppath)-1] != '/' )
{
strcat(tmppath, "/");
}
/*
* Now append the base file name.
*/
strcat(tmppath, pnt);
status = stat(tmppath, &statbuf);
if( status != -1 )
{
break;
}
}
if( sl == NULL )
{
/*
* Still couldn't find it. Ask user for path to add.
*/
fprintf(stderr,"Enter path to file %s: ", sourcefile);
fgets(tmppath, sizeof(tmppath), stdin);
if( tmppath[strlen(tmppath)-1] == '\n' )
{
tmppath[strlen(tmppath)-1] = '\0';
}
if( tmppath[strlen(tmppath)-1] != '/' )
{
strcat(tmppath, "/");
}
/*
* Now append the base file name.
*/
strcat(tmppath, pnt);
status = stat(tmppath, &statbuf);
if( status == -1 )
{
/*
* OK, I guess the user doesn't really want to see it
* after all.
*/
ol = (struct open_filelist *) xmalloc(sizeof(*ol));
ol->path = xstrdup(sourcefile);
ol->real_path = NULL;
ol->next = ofiles;
ol->nlines = 0;
ol->linelist = NULL;
ofiles = ol;
fprintf(stderr,"Unable to open file %s\n", tmppath);
return;
}
}
}
/*
* Create header for file.
*/
ol = (struct open_filelist *) xmalloc(sizeof(*ol));
ol->path = xstrdup(sourcefile);
ol->real_path = xstrdup(tmppath);
ol->next = ofiles;
ol->nlines = 0;
ol->linelist = NULL;
ol->size = statbuf.st_size;
ofiles = ol;
/*
* Now open and map the file.
*/
fd = open(tmppath, O_RDONLY);
if( fd == -1 )
{
return;
}
addr = mmap(0, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if( addr == (char *) -1 )
{
return;
}
/*
* Now build up the line number mapping table.
*/
ol->nlines = 1;
pnt = addr;
while(pnt < addr + ol->size )
{
if( *pnt++ == '\n' )
{
ol->nlines++;
}
}
ol->nlines++;
ol->linelist = (unsigned int*) xmalloc(ol->nlines * sizeof(unsigned int) );
nlines = 0;
pnt = addr;
ol->linelist[nlines++] = 0;
while(pnt < addr + ol->size )
{
if( *pnt++ == '\n' )
{
ol->linelist[nlines++] = pnt - addr;
}
}
ol->linelist[nlines++] = pnt - addr;
}
else
{
/*
* We know what the file is, we just need to reopen it and remap it.
*/
fd = open(ol->real_path, O_RDONLY);
if( fd == -1 )
{
return;
}
addr = mmap(0, ol->size, PROT_READ, MAP_PRIVATE, fd, 0);
if( addr == (char *) -1 )
{
return;
}
}
/*
* All we need to do is to display the source lines here.
*/
for(i=start - 1; i <= end - 1; i++)
{
if( i < 0 || i >= ol->nlines - 1)
{
continue;
}
memset(&buffer, 0, sizeof(buffer));
if( ol->linelist[i+1] != ol->linelist[i] )
{
memcpy(&buffer, addr + ol->linelist[i],
(ol->linelist[i+1] - ol->linelist[i]) - 1);
}
fprintf(stderr,"%d\t%s\n", i + 1, buffer);
}
munmap(addr, ol->size);
close(fd);
}
void
DEBUG_List(struct list_id * source1, struct list_id * source2,
int delta)
{
int end;
int start;
char * sourcefile;
/*
* We need to see what source file we need. Hopefully we only have
* one specified, otherwise we might as well punt.
*/
if( source1 != NULL
&& source2 != NULL
&& source1->sourcefile != NULL
&& source2->sourcefile != NULL
&& strcmp(source1->sourcefile, source2->sourcefile) != 0 )
{
fprintf(stderr, "Ambiguous source file specification.\n");
return;
}
sourcefile = NULL;
if( source1 != NULL && source1->sourcefile != NULL )
{
sourcefile = source1->sourcefile;
}
if( sourcefile == NULL
&& source2 != NULL
&& source2->sourcefile != NULL )
{
sourcefile = source2->sourcefile;
}
if( sourcefile == NULL )
{
sourcefile = (char *) &DEBUG_current_sourcefile;
}
if( sourcefile == NULL )
{
fprintf(stderr, "No source file specified.\n");
return;
}
/*
* Now figure out the line number range to be listed.
*/
start = -1;
end = -1;
if( source1 != NULL )
{
start = source1->line;
}
if( source2 != NULL )
{
end = source2->line;
}
if( start == -1 && end == -1 )
{
if( delta < 0 )
{
end = DEBUG_start_sourceline;
start = end + delta;
}
else
{
start = DEBUG_end_sourceline;
end = start + delta;
}
}
else if( start == -1 )
{
start = end + delta;
}
else if (end == -1)
{
end = start + delta;
}
/*
* Now call this function to do the dirty work.
*/
DEBUG_DisplaySource(sourcefile, start, end);
if( sourcefile != (char *) &DEBUG_current_sourcefile )
{
strcpy(DEBUG_current_sourcefile, sourcefile);
}
DEBUG_start_sourceline = start;
DEBUG_end_sourceline = end;
}
#if 0
main()
{
int i, j;
DEBUG_AddPath("../../de");
while(1==1)
{
fscanf(stdin,"%d %d", &i, &j);
DEBUG_DisplaySource("dumpexe.c", i, j);
}
return 0;
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -19,17 +19,14 @@
struct bt_info
{
unsigned int eip;
unsigned int ess;
unsigned int ebp;
struct name_hash * frame;
struct symbol_info frame;
};
static int nframe;
static struct bt_info * frames = NULL;
int curr_frame;
static char * reg_name[] =
{
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
};
typedef struct
{
@ -62,12 +59,14 @@ void DEBUG_InfoStack(void)
{ /* 32-bit mode */
addr.seg = 0;
addr.off = ESP_reg(&DEBUG_context);
addr.type = NULL;
DEBUG_ExamineMemory( &addr, 24, 'x' );
}
else /* 16-bit mode */
{
addr.seg = SS_reg(&DEBUG_context);
addr.off = SP_reg(&DEBUG_context);
addr.type = NULL;
DEBUG_ExamineMemory( &addr, 24, 'w' );
}
fprintf(stderr,"\n");
@ -153,94 +152,76 @@ void DEBUG_BackTrace(void)
}
/***********************************************************************
* DEBUG_GetSymbolValue
* DEBUG_SilentBackTrace
*
* Get the address of a named symbol from the current stack frame.
* Display a stack back-trace.
*/
BOOL32 DEBUG_GetStackSymbolValue( const char * name, DBG_ADDR *addr )
void DEBUG_SilentBackTrace(void)
{
struct name_hash * curr_func;
int i;
DBG_ADDR addr;
int frameno = 0;
/*
* If we don't have a valid backtrace, then just return.
*/
if( frames == NULL )
nframe = 1;
if (frames) free( frames );
frames = (struct bt_info *) xmalloc( sizeof(struct bt_info) );
if (SS_reg(&DEBUG_context) == WINE_DATA_SELECTOR) /* 32-bit mode */
{
return FALSE;
addr.seg = 0;
addr.off = EIP_reg(&DEBUG_context);
frames[0].eip = addr.off;
DEBUG_FindNearestSymbol( &addr, TRUE, &frames[0].frame.sym, 0,
&frames[0].frame.list);
frames[0].ebp = addr.off = EBP_reg(&DEBUG_context);
frameno++;
while (addr.off)
{
FRAME32 *frame = (FRAME32 *)addr.off;
if (!DBG_CHECK_READ_PTR( &addr, sizeof(FRAME32) )) return;
if (!frame->ip) break;
nframe++;
frames = (struct bt_info *)xrealloc(frames,
nframe*sizeof(struct bt_info));
addr.off = frame->ip;
frames[frameno].eip = addr.off;
frames[frameno].ebp = frame->bp;
DEBUG_FindNearestSymbol( &addr, TRUE,
&frames[frameno].frame.sym, frame->bp,
&frames[frameno].frame.list);
frameno++;
addr.off = frame->bp;
}
}
curr_func = frames[curr_frame].frame;
/*
* If we don't know what the current function is, then we also have
* nothing to report here.
*/
if( curr_func == NULL )
{
return FALSE;
}
for(i=0; i < curr_func->n_locals; i++ )
else /* 16-bit mode */
{
/*
* Test the range of validity of the local variable. This
* comes up with RBRAC/LBRAC stabs in particular.
* Not implemented here. I am not entirely sure how best to handle
* this stuff.
*/
if( (curr_func->local_vars[i].pc_start != 0)
&& ((frames[curr_frame].eip - curr_func->addr.off)
< curr_func->local_vars[i].pc_start) )
{
continue;
}
if( (curr_func->local_vars[i].pc_end != 0)
&& ((frames[curr_frame].eip - curr_func->addr.off)
> curr_func->local_vars[i].pc_end) )
{
continue;
}
if( strcmp(name, curr_func->local_vars[i].name) == 0 )
{
/*
* OK, we found it. Now figure out what to do with this.
*/
if( curr_func->local_vars[i].regno != 0 )
{
/*
* Register variable. We don't know how to treat
* this yet.
*/
return FALSE;
}
addr->seg = 0;
addr->off = frames[curr_frame].ebp + curr_func->local_vars[i].offset;
return TRUE;
}
}
return FALSE;
}
int
DEBUG_SetFrame(int newframe)
{
int rtn = FALSE;
/*
* Nothing for now. Add support later.
*/
curr_frame = newframe;
if( curr_frame >= nframe )
{
curr_frame = nframe - 1;
}
if( curr_frame < 0 )
{
curr_frame = 0;
}
if( curr_frame >= nframe )
if( frames[curr_frame].frame.list.sourcefile != NULL )
{
curr_frame = nframe - 1;
DEBUG_List(&frames[curr_frame].frame.list, NULL, 0);
}
rtn = TRUE;
@ -248,13 +229,9 @@ DEBUG_SetFrame(int newframe)
}
int
DEBUG_InfoLocals()
DEBUG_GetCurrentFrame(struct name_hash ** name, unsigned int * eip,
unsigned int * ebp)
{
struct name_hash * curr_func;
int i;
int rtn = FALSE;
unsigned int * ptr;
/*
* If we don't have a valid backtrace, then just return.
*/
@ -263,54 +240,19 @@ DEBUG_InfoLocals()
return FALSE;
}
curr_func = frames[curr_frame].frame;
/*
* If we don't know what the current function is, then we also have
* nothing to report here.
*/
if( curr_func == NULL )
if( frames[curr_frame].frame.sym == NULL )
{
return FALSE;
}
for(i=0; i < curr_func->n_locals; i++ )
{
/*
* Test the range of validity of the local variable. This
* comes up with RBRAC/LBRAC stabs in particular.
*/
if( (curr_func->local_vars[i].pc_start != 0)
&& ((frames[curr_frame].eip - curr_func->addr.off)
< curr_func->local_vars[i].pc_start) )
{
continue;
}
*name = frames[curr_frame].frame.sym;
*eip = frames[curr_frame].eip;
*ebp = frames[curr_frame].ebp;
if( (curr_func->local_vars[i].pc_end != 0)
&& ((frames[curr_frame].eip - curr_func->addr.off)
> curr_func->local_vars[i].pc_end) )
{
continue;
}
if( curr_func->local_vars[i].offset == 0 )
{
fprintf(stderr, "%s:%s optimized into register $%s \n",
curr_func->name, curr_func->local_vars[i].name,
reg_name[curr_func->local_vars[i].regno]);
}
else
{
ptr = (unsigned int *) (frames[curr_frame].ebp
+ curr_func->local_vars[i].offset);
fprintf(stderr, "%s:%s == 0x%8.8x\n",
curr_func->name, curr_func->local_vars[i].name,
*ptr);
}
}
rtn = TRUE;
return (rtn);
return TRUE;
}

809
debugger/types.c Normal file
View File

@ -0,0 +1,809 @@
/*
* File types.c - datatype handling stuff for internal debugger.
*
* Copyright (C) 1997, Eric Youngdale.
*
* This really doesn't do much at the moment, but it forms the framework
* upon which full support for datatype handling will eventually be hung.
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <limits.h>
#include <strings.h>
#include <unistd.h>
#include <malloc.h>
#include "win.h"
#include "pe_image.h"
#include "peexe.h"
#include "debugger.h"
#include "peexe.h"
#include "xmalloc.h"
#define NR_TYPE_HASH 521
struct en_values
{
struct en_values* next;
char * name;
int value;
};
struct member
{
struct member * next;
char * name;
struct datatype * type;
int offset;
int size;
};
struct datatype
{
enum debug_type type;
struct datatype * next;
char * name;
union
{
struct
{
char basic_type;
char * output_format;
char basic_size;
unsigned b_signed:1;
} basic;
struct
{
unsigned short bitoff;
unsigned short nbits;
struct datatype * basetype;
} bitfield;
struct
{
struct datatype * pointsto;
} pointer;
struct
{
struct datatype * rettype;
} funct;
struct
{
int start;
int end;
struct datatype * basictype;
} array;
struct
{
int size;
struct member * members;
} structure;
struct
{
struct en_values * members;
} enumeration;
} un;
};
#define BASIC_INT 1
#define BASIC_CHAR 2
#define BASIC_LONG 3
#define BASIC_UINT 4
#define BASIC_LUI 5
#define BASIC_LONGLONG 6
#define BASIC_ULONGLONGI 7
#define BASIC_SHORT 8
#define BASIC_SHORTUI 9
#define BASIC_SCHAR 10
#define BASIC_UCHAR 11
#define BASIC_FLT 12
#define BASIC_LONG_DOUBLE 13
#define BASIC_DOUBLE 14
#define BASIC_CMPLX_INT 15
#define BASIC_CMPLX_FLT 16
#define BASIC_CMPLX_DBL 17
#define BASIC_CMPLX_LONG_DBL 18
#define BASIC_VOID 19
struct datatype * DEBUG_TypeInt = NULL;
struct datatype * DEBUG_TypeIntConst = NULL;
struct datatype * DEBUG_TypeUSInt = NULL;
struct datatype * DEBUG_TypeString = NULL;
/*
* All of the types that have been defined so far.
*/
static struct datatype * type_hash_table[NR_TYPE_HASH + 1];
static struct datatype * pointer_types = NULL;
static unsigned int type_hash( const char * name )
{
unsigned int hash = 0;
unsigned int tmp;
const char * p;
p = name;
while (*p)
{
hash = (hash << 4) + *p++;
if( (tmp = (hash & 0xf0000000)) )
{
hash ^= tmp >> 24;
}
hash &= ~tmp;
}
return hash % NR_TYPE_HASH;
}
static struct datatype *
DEBUG_InitBasic(int type, char * name, int size, int b_signed,
char * output_format)
{
int hash;
struct datatype * dt;
dt = (struct datatype *) xmalloc(sizeof(struct datatype));
if( dt != NULL )
{
if( name != NULL )
{
hash = type_hash(name);
}
else
{
hash = NR_TYPE_HASH;
}
dt->type = BASIC;
dt->name = name;
dt->next = type_hash_table[hash];
type_hash_table[hash] = dt;
dt->un.basic.basic_type = type;
dt->un.basic.basic_size = size;
dt->un.basic.b_signed = b_signed;
dt->un.basic.output_format = output_format;
}
return dt;
}
struct datatype *
DEBUG_NewDataType(enum debug_type xtype, const char * typename)
{
struct datatype * dt = NULL;
int hash;
/*
* The last bucket is special, and is used to hold typeless names.
*/
if( typename == NULL )
{
hash = NR_TYPE_HASH;
}
else
{
hash = type_hash(typename);
}
if( typename != NULL )
{
for( dt = type_hash_table[hash]; dt; dt = dt->next )
{
if( xtype != dt->type || dt->name == NULL
|| dt->name[0] != typename[0])
{
continue;
}
if( strcmp(dt->name, typename) == 0 )
{
return dt;
}
}
}
if( dt == NULL )
{
dt = (struct datatype *) xmalloc(sizeof(struct datatype));
if( dt != NULL )
{
memset(dt, 0, sizeof(*dt));
dt->type = xtype;
if( typename != NULL )
{
dt->name = xstrdup(typename);
}
else
{
dt->name = NULL;
}
if( xtype == POINTER )
{
dt->next = pointer_types;
pointer_types = dt;
}
else
{
dt->next = type_hash_table[hash];
type_hash_table[hash] = dt;
}
}
}
return dt;
}
struct datatype *
DEBUG_FindOrMakePointerType(struct datatype * reftype)
{
struct datatype * dt = NULL;
if( reftype != NULL )
{
for( dt = pointer_types; dt; dt = dt->next )
{
if( dt->type != POINTER )
{
continue;
}
if( dt->un.pointer.pointsto == reftype )
{
return dt;
}
}
}
if( dt == NULL )
{
dt = (struct datatype *) xmalloc(sizeof(struct datatype));
if( dt != NULL )
{
dt->type = POINTER;
dt->un.pointer.pointsto = reftype;
dt->next = pointer_types;
pointer_types = dt;
}
}
return dt;
}
void
DEBUG_InitTypes()
{
static int beenhere = 0;
struct datatype * chartype;
if( beenhere++ != 0 )
{
return;
}
/*
* Special version of int used with constants of various kinds.
*/
DEBUG_TypeIntConst = DEBUG_InitBasic(BASIC_INT,NULL,4,1,"%d");
/*
* Initialize a few builtin types.
*/
DEBUG_TypeInt = DEBUG_InitBasic(BASIC_INT,"int",4,1,"%d");
chartype = DEBUG_InitBasic(BASIC_CHAR,"char",1,1,"'%c'");
DEBUG_InitBasic(BASIC_LONG,"long int",4,1,"%d");
DEBUG_TypeUSInt = DEBUG_InitBasic(BASIC_UINT,"unsigned int",4,0,"%d");
DEBUG_InitBasic(BASIC_LUI,"long unsigned int",4,0,"%d");
DEBUG_InitBasic(BASIC_LONGLONG,"long long int",8,1,"%ld");
DEBUG_InitBasic(BASIC_ULONGLONGI,"long long unsigned int",8,0,"%ld");
DEBUG_InitBasic(BASIC_SHORT,"short int",2,1,"%d");
DEBUG_InitBasic(BASIC_SHORTUI,"short unsigned int",2,0,"%d");
DEBUG_InitBasic(BASIC_SCHAR,"signed char",1,1,"'%c'");
DEBUG_InitBasic(BASIC_UCHAR,"unsigned char",1,0,"'%c'");
DEBUG_InitBasic(BASIC_FLT,"float",4,0,"%f");
DEBUG_InitBasic(BASIC_LONG_DOUBLE,"double",8,0,"%lf");
DEBUG_InitBasic(BASIC_DOUBLE,"long double",12,0,NULL);
DEBUG_InitBasic(BASIC_CMPLX_INT,"complex int",8,1,NULL);
DEBUG_InitBasic(BASIC_CMPLX_FLT,"complex float",8,0,NULL);
DEBUG_InitBasic(BASIC_CMPLX_DBL,"complex double",16,0,NULL);
DEBUG_InitBasic(BASIC_CMPLX_LONG_DBL,"complex long double",24,0,NULL);
DEBUG_InitBasic(BASIC_VOID,"void",0,0,NULL);
DEBUG_TypeString = DEBUG_NewDataType(POINTER, NULL);
DEBUG_SetPointerType(DEBUG_TypeString, chartype);
/*
* Now initialize the builtins for codeview.
*/
DEBUG_InitCVDataTypes();
}
long long int
DEBUG_GetExprValue(DBG_ADDR * addr, char ** format)
{
unsigned int rtn;
struct datatype * type2 = NULL;
struct en_values * e;
char * def_format = "0x%x";
rtn = 0;
assert(addr->type != NULL);
switch(addr->type->type)
{
case BASIC:
memcpy(&rtn, (char *) addr->off, addr->type->un.basic.basic_size);
if( (addr->type->un.basic.b_signed)
&& ((addr->type->un.basic.basic_size & 3) != 0)
&& ((rtn >> (addr->type->un.basic.basic_size * 8 - 1)) != 0) )
{
rtn = rtn | ((-1) << (addr->type->un.basic.basic_size * 8));
}
if( addr->type->un.basic.output_format != NULL )
{
def_format = addr->type->un.basic.output_format;
}
/*
* Check for single character prints that are out of range.
*/
if( addr->type->un.basic.basic_size == 1
&& strcmp(def_format, "'%c'") == 0
&& ((rtn < 0x20) || (rtn > 0x80)) )
{
def_format = "%d";
}
break;
case POINTER:
if (!DBG_CHECK_READ_PTR( addr, 1 )) return 0;
rtn = (unsigned int) *((unsigned char **)addr->off);
type2 = addr->type->un.pointer.pointsto;
if( type2->type == BASIC && type2->un.basic.basic_size == 1 )
{
def_format = "\"%s\"";
break;
}
else
{
def_format = "0x%8.8x";
}
break;
case ARRAY:
case STRUCT:
if (!DBG_CHECK_READ_PTR( addr, 1 )) return 0;
rtn = (unsigned int) *((unsigned char **)addr->off);
def_format = "0x%8.8x";
break;
case ENUM:
rtn = (unsigned int) *((unsigned char **)addr->off);
for(e = addr->type->un.enumeration.members; e; e = e->next )
{
if( e->value == rtn )
{
break;
}
}
if( e != NULL )
{
rtn = (int) e->name;
def_format = "%s";
}
else
{
def_format = "%d";
}
break;
default:
rtn = 0;
break;
}
if( format != NULL )
{
*format = def_format;
}
return rtn;
}
unsigned int
DEBUG_TypeDerefPointer(DBG_ADDR * addr, struct datatype ** newtype)
{
/*
* Make sure that this really makes sense.
*/
if( addr->type->type != POINTER )
{
*newtype = NULL;
return 0;
}
*newtype = addr->type->un.pointer.pointsto;
return *(unsigned int*) (addr->off);
}
unsigned int
DEBUG_FindStructElement(DBG_ADDR * addr, const char * ele_name, int * tmpbuf)
{
struct member * m;
unsigned int mask;
/*
* Make sure that this really makes sense.
*/
if( addr->type->type != STRUCT )
{
addr->type = NULL;
return FALSE;
}
for(m = addr->type->un.structure.members; m; m = m->next)
{
if( strcmp(m->name, ele_name) == 0 )
{
addr->type = m->type;
if( (m->offset & 7) != 0 || (m->size & 7) != 0)
{
/*
* Bitfield operation. We have to extract the field and store
* it in a temporary buffer so that we get it all right.
*/
*tmpbuf = ((*(int* ) (addr->off + (m->offset >> 3))) >> (m->offset & 7));
addr->off = (int) tmpbuf;
mask = 0xffffffff << (m->size);
*tmpbuf &= ~mask;
/*
* OK, now we have the correct part of the number.
* Check to see whether the basic type is signed or not, and if so,
* we need to sign extend the number.
*/
if( m->type->type == BASIC && m->type->un.basic.b_signed != 0
&& (*tmpbuf & (1 << (m->size - 1))) != 0 )
{
*tmpbuf |= mask;
}
}
else
{
addr->off += (m->offset >> 3);
}
return TRUE;
}
}
addr->type = NULL;
return FALSE;
}
int
DEBUG_SetStructSize(struct datatype * dt, int size)
{
assert(dt->type == STRUCT);
dt->un.structure.size = size;
dt->un.structure.members = NULL;
return TRUE;
}
int
DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2)
{
assert( dt->type == dt2->type && ((dt->type == STRUCT) || (dt->type == ENUM)));
if( dt->type == STRUCT )
{
dt->un.structure.members = dt2->un.structure.members;
}
else
{
dt->un.enumeration.members = dt2->un.enumeration.members;
}
return TRUE;
}
int
DEBUG_AddStructElement(struct datatype * dt, char * name, struct datatype * type,
int offset, int size)
{
struct member * m;
struct member * last;
struct en_values * e;
if( dt->type == STRUCT )
{
for(last = dt->un.structure.members; last; last = last->next)
{
if( (last->name[0] == name[0])
&& (strcmp(last->name, name) == 0) )
{
return TRUE;
}
if( last->next == NULL )
{
break;
}
}
m = (struct member *) xmalloc(sizeof(struct member));
if( m == FALSE )
{
return FALSE;
}
m->name = xstrdup(name);
m->type = type;
m->offset = offset;
m->size = size;
if( last == NULL )
{
m->next = dt->un.structure.members;
dt->un.structure.members = m;
}
else
{
last->next = m;
m->next = NULL;
}
/*
* If the base type is bitfield, then adjust the offsets here so that we
* are able to look things up without lots of falter-all.
*/
if( type->type == BITFIELD )
{
m->offset += m->type->un.bitfield.bitoff;
m->size = m->type->un.bitfield.nbits;
m->type = m->type->un.bitfield.basetype;
}
}
else if( dt->type == ENUM )
{
e = (struct en_values *) xmalloc(sizeof(struct en_values));
if( e == FALSE )
{
return FALSE;
}
e->name = xstrdup(name);
e->value = offset;
e->next = dt->un.enumeration.members;
dt->un.enumeration.members = e;
}
else
{
assert(FALSE);
}
return TRUE;
}
struct datatype *
DEBUG_GetPointerType(struct datatype * dt)
{
if( dt->type == POINTER )
{
return dt->un.pointer.pointsto;
}
return NULL;
}
int
DEBUG_SetPointerType(struct datatype * dt, struct datatype * dt2)
{
switch(dt->type)
{
case POINTER:
dt->un.pointer.pointsto = dt2;
break;
case FUNC:
dt->un.funct.rettype = dt2;
break;
default:
assert(FALSE);
}
return TRUE;
}
int
DEBUG_SetArrayParams(struct datatype * dt, int min, int max, struct datatype * dt2)
{
assert(dt->type == ARRAY);
dt->un.array.start = min;
dt->un.array.end = max;
dt->un.array.basictype = dt2;
return TRUE;
}
int
DEBUG_SetBitfieldParams(struct datatype * dt, int offset, int nbits,
struct datatype * dt2)
{
assert(dt->type == BITFIELD);
dt->un.bitfield.bitoff = offset;
dt->un.bitfield.nbits = nbits;
dt->un.bitfield.basetype = dt2;
return TRUE;
}
int DEBUG_GetObjectSize(struct datatype * dt)
{
if( dt == NULL )
{
return 0;
}
switch(dt->type)
{
case BASIC:
return dt->un.basic.basic_size;
case POINTER:
return sizeof(int *);
case STRUCT:
return dt->un.structure.size;
case ENUM:
return sizeof(int);
case ARRAY:
return (dt->un.array.end - dt->un.array.start)
* DEBUG_GetObjectSize(dt->un.array.basictype);
case BITFIELD:
/*
* Bitfields have to be handled seperately later on
* when we insert the element into the structure.
*/
return 0;
case TYPEDEF:
case FUNC:
case CONST:
assert(FALSE);
}
return 0;
}
unsigned int
DEBUG_ArrayIndex(DBG_ADDR * addr, DBG_ADDR * result, int index)
{
int size;
/*
* Make sure that this really makes sense.
*/
if( addr->type->type == POINTER )
{
/*
* Get the base type, so we know how much to index by.
*/
size = DEBUG_GetObjectSize(addr->type->un.pointer.pointsto);
result->type = addr->type->un.pointer.pointsto;
result->off = (*(unsigned int*) (addr->off)) + size * index;
}
else if (addr->type->type == ARRAY)
{
size = DEBUG_GetObjectSize(addr->type->un.array.basictype);
result->type = addr->type->un.array.basictype;
result->off = addr->off + size * (index - addr->type->un.array.start);
}
return TRUE;
}
/***********************************************************************
* DEBUG_Print
*
* Implementation of the 'print' command.
*/
void DEBUG_Print( const DBG_ADDR *addr, int count, char format, int level )
{
DBG_ADDR addr1;
int i;
struct member * m;
char * pnt;
int size;
long long int value;
if (count != 1)
{
fprintf( stderr, "Count other than 1 is meaningless in 'print' command\n" );
return;
}
if( addr->type == NULL )
{
fprintf(stderr, "Unable to evaluate expression\n");
return;
}
if( format == 'i' || format == 's' || format == 'w' || format == 'b' )
{
fprintf( stderr, "Format specifier '%c' is meaningless in 'print' command\n", format );
format = '\0';
}
switch(addr->type->type)
{
case BASIC:
case ENUM:
case CONST:
case POINTER:
DEBUG_PrintBasic(addr, 1, format);
break;
case STRUCT:
fprintf(stderr, "{");
for(m = addr->type->un.structure.members; m; m = m->next)
{
addr1 = *addr;
DEBUG_FindStructElement(&addr1, m->name,
(int *) &value);
fprintf(stderr, "%s=", m->name);
DEBUG_Print(&addr1, 1, format, level + 1);
if( m->next != NULL )
{
fprintf(stderr, ", ");
}
}
fprintf(stderr, "}");
break;
case ARRAY:
/*
* Loop over all of the entries, printing stuff as we go.
*/
size = DEBUG_GetObjectSize(addr->type->un.array.basictype);
if( size == 1 )
{
/*
* Special handling for character arrays.
*/
pnt = (char *) addr->off;
fprintf(stderr, "\"");
for( i=addr->type->un.array.start; i < addr->type->un.array.end; i++ )
{
fputc(*pnt++, stderr);
}
fprintf(stderr, "\"");
break;
}
addr1 = *addr;
addr1.type = addr->type->un.array.basictype;
fprintf(stderr, "{");
for( i=addr->type->un.array.start; i <= addr->type->un.array.end; i++ )
{
DEBUG_Print(&addr1, 1, format, level + 1);
addr1.off += size;
if( i == addr->type->un.array.end )
{
fprintf(stderr, "}");
}
else
{
fprintf(stderr, ", ");
}
}
break;
default:
assert(FALSE);
break;
}
if( level == 0 )
{
fprintf(stderr, "\n");
}
}

View File

@ -0,0 +1,35 @@
Running & Compiling WINE in OS/2
Here is what you need to (try to) compile Wine for OS/2:
EMX 0.9c (fix 2)
XFree86 3.2 OS/2 (with development libraries)
bash, gnu make, grep, tar, bison, flex
sed (a working copy of)
diff and patch are recommended
To compile:
sh
tools/make_os2.sh
make depend
make (make doesn't work yet... I will need to do some others patch, or
you may do it...)
Currently:
- configure and make depend work...
- make doesn't work
- the selectors numbers (0) are wrong...
What needs to be redone:
File functions, I/O access (do it!), Interrupt (if int unknow, call
current RealMode one...), verify that everything is thread safe (how
does Win95/NT handle multi-thread?), move X functions in some files
(and make a wrapper, to use PM instead latter), etc...
The good things:
- OS/2 have DOS interrupts
- OS/2 have I/O port access
- OS/2 have multi-thread
- Merlin have Open32 (to be used later...)
Robert Pouliot <krynos@clic.net>
January 9, 1997

View File

@ -6,13 +6,13 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include "windows.h"
#include "winerror.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "heap.h"
@ -43,25 +43,20 @@ static int DIR_GetPath( const char *keyname, const char *defval,
char **dos_path, char **unix_path )
{
char path[MAX_PATHNAME_LEN];
const char *dos_name ,*unix_name;
DOS_FULL_NAME full_name;
BY_HANDLE_FILE_INFORMATION info;
PROFILE_GetWineIniString( "wine", keyname, defval, path, sizeof(path) );
if (!(unix_name = DOSFS_GetUnixFileName( path, TRUE )) ||
!FILE_Stat( unix_name, &info ) ||
if (!DOSFS_GetFullName( path, TRUE, &full_name ) ||
!FILE_Stat( full_name.long_name, &info ) ||
!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
fprintf(stderr, "Invalid path '%s' for %s directory\n", path, keyname);
return 0;
}
if (!(dos_name = DOSFS_GetDosTrueName( unix_name, TRUE )))
{
fprintf( stderr, "Could not get DOS name for %s directory '%s'\n",
keyname, unix_name );
return 0;
}
*unix_path = HEAP_strdupA( SystemHeap, 0, unix_name );
*dos_path = HEAP_strdupA( SystemHeap, 0, dos_name );
*unix_path = HEAP_strdupA( SystemHeap, 0, full_name.long_name );
*dos_path = HEAP_strdupA( SystemHeap, 0, full_name.short_name );
return 1;
}
@ -72,7 +67,7 @@ static int DIR_GetPath( const char *keyname, const char *defval,
void DIR_ParseWindowsPath( char *path )
{
char *p;
const char *dos_name ,*unix_name;
DOS_FULL_NAME full_name;
BY_HANDLE_FILE_INFORMATION info;
int i;
@ -87,22 +82,18 @@ void DIR_ParseWindowsPath( char *path )
MAX_PATH_ELEMENTS );
break;
}
if (!(unix_name = DOSFS_GetUnixFileName( path, TRUE )) ||
!FILE_Stat( unix_name, &info ) ||
if (!DOSFS_GetFullName( path, TRUE, &full_name ) ||
!FILE_Stat( full_name.long_name, &info ) ||
!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
fprintf(stderr,"Warning: invalid dir '%s' in path, deleting it.\n",
path );
continue;
}
if (!(dos_name = DOSFS_GetDosTrueName( unix_name, TRUE )))
{
fprintf( stderr, "Warning: could not get DOS name for '%s' in path, deleting it.\n",
unix_name );
continue;
}
DIR_UnixPath[DIR_PathElements] = HEAP_strdupA(SystemHeap,0,unix_name);
DIR_DosPath[DIR_PathElements] = HEAP_strdupA(SystemHeap,0,dos_name);
DIR_UnixPath[DIR_PathElements] = HEAP_strdupA( SystemHeap, 0,
full_name.long_name );
DIR_DosPath[DIR_PathElements] = HEAP_strdupA( SystemHeap, 0,
full_name.short_name );
DIR_PathElements++;
}
@ -137,9 +128,8 @@ int DIR_Init(void)
}
else
{
cwd = DOSFS_GetDosTrueName( path, TRUE );
DRIVE_SetCurrentDrive( drive );
DRIVE_Chdir( drive, cwd + 2 );
DRIVE_Chdir( drive, cwd );
}
if (!(DIR_GetPath( "windows", "c:\\windows",
@ -344,7 +334,8 @@ BOOL16 CreateDirectory16( LPCSTR path, LPVOID dummy )
*/
BOOL32 CreateDirectory32A( LPCSTR path, LPSECURITY_ATTRIBUTES lpsecattribs )
{
const char *unixName;
DOS_FULL_NAME full_name;
LPCSTR unixName;
dprintf_file( stddeb, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
if ((unixName = DOSFS_IsDevice( path )) != NULL)
@ -353,8 +344,8 @@ BOOL32 CreateDirectory32A( LPCSTR path, LPSECURITY_ATTRIBUTES lpsecattribs )
DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk );
return FALSE;
}
if (!(unixName = DOSFS_GetUnixFileName( path, FALSE ))) return 0;
if ((mkdir( unixName, 0777 ) == -1) && (errno != EEXIST))
if (!DOSFS_GetFullName( path, FALSE, &full_name )) return 0;
if ((mkdir( full_name.long_name, 0777 ) == -1) && (errno != EEXIST))
{
FILE_SetDosError();
return FALSE;
@ -409,7 +400,8 @@ BOOL16 RemoveDirectory16( LPCSTR path )
*/
BOOL32 RemoveDirectory32A( LPCSTR path )
{
const char *unixName;
DOS_FULL_NAME full_name;
LPCSTR unixName;
dprintf_file(stddeb, "RemoveDirectory: '%s'\n", path );
@ -419,8 +411,8 @@ BOOL32 RemoveDirectory32A( LPCSTR path )
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return FALSE;
}
if (!(unixName = DOSFS_GetUnixFileName( path, TRUE ))) return FALSE;
if (rmdir( unixName ) == -1)
if (!DOSFS_GetFullName( path, TRUE, &full_name )) return FALSE;
if (rmdir( full_name.long_name ) == -1)
{
FILE_SetDosError();
return FALSE;
@ -441,6 +433,56 @@ BOOL32 RemoveDirectory32W( LPCWSTR path )
}
/***********************************************************************
* DIR_TryPath
*
* Helper function for DIR_SearchPath.
*/
static BOOL32 DIR_TryPath( LPCSTR unix_dir, LPCSTR dos_dir, LPCSTR name,
DOS_FULL_NAME *full_name )
{
LPSTR p_l = full_name->long_name + strlen(unix_dir) + 1;
LPSTR p_s = full_name->short_name + strlen(dos_dir) + 1;
if ((p_s >= full_name->short_name + sizeof(full_name->short_name) - 14) ||
(p_l >= full_name->long_name + sizeof(full_name->long_name) - 1))
{
DOS_ERROR( ER_PathNotFound, EC_NotFound, SA_Abort, EL_Disk );
return FALSE;
}
if (!DOSFS_FindUnixName( unix_dir, name, p_l,
sizeof(full_name->long_name) - (p_l - full_name->long_name),
p_s, DRIVE_GetFlags( dos_dir[0] - 'A' ) ))
return FALSE;
strcpy( full_name->long_name, unix_dir );
p_l[-1] = '/';
strcpy( full_name->short_name, dos_dir );
p_s[-1] = '\\';
return TRUE;
}
/***********************************************************************
* DIR_TryModulePath
*
* Helper function for DIR_SearchPath.
*/
static BOOL32 DIR_TryModulePath( LPCSTR name, DOS_FULL_NAME *full_name )
{
/* FIXME: for now, GetModuleFileName32A can't return more */
/* than OFS_MAXPATHNAME. This may change with Win32. */
char buffer[OFS_MAXPATHNAME];
LPSTR p;
if (!GetCurrentTask()) return FALSE;
GetModuleFileName32A( GetCurrentTask(), buffer, sizeof(buffer) );
if (!(p = strrchr( buffer, '\\' ))) return FALSE;
if (sizeof(buffer) - (++p - buffer) <= strlen(name)) return FALSE;
strcpy( p, name );
return DOSFS_GetFullName( buffer, TRUE, full_name );
}
/***********************************************************************
* DIR_SearchPath
*
@ -450,17 +492,24 @@ BOOL32 RemoveDirectory32W( LPCWSTR path )
* FIXME: should return long path names.
*/
DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
DWORD buflen, LPSTR buffer, LPSTR *lastpart,
BOOL32 win32 )
DOS_FULL_NAME *full_name, BOOL32 win32 )
{
DWORD len;
LPSTR tmp;
LPCSTR p;
int i;
LPSTR tmp = NULL;
BOOL32 ret = TRUE;
/* First check the supplied parameters */
if (strchr( name, '.' )) ext = NULL; /* Ignore the specified extension */
if (!(p = strrchr( name, '\\' ))) p = name;
if (!(p = strrchr( p, '/' ))) p = name;
if (strchr( p, '.' )) ext = NULL; /* Ignore the specified extension */
if ((*name && (name[1] == ':')) ||
strchr( name, '/' ) || strchr( name, '\\' ))
path = NULL; /* Ignore path if name already contains a path */
if (path && !*path) path = NULL; /* Ignore empty path */
len = strlen(name);
if (ext) len += strlen(ext);
if (path) len += strlen(path) + 1;
@ -482,110 +531,52 @@ DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
}
else strcpy( tmp, name );
if (ext) strcat( tmp, ext );
name = tmp;
}
else tmp = (LPSTR)name;
/* If we have an explicit path, everything's easy */
if (path || (*tmp && (tmp[1] == ':')) ||
strchr( tmp, '/' ) || strchr( tmp, '\\' ))
if (path || (*name && (name[1] == ':')) ||
strchr( name, '/' ) || strchr( name, '\\' ))
{
if (!DOSFS_GetUnixFileName( tmp, TRUE )) goto not_found;
lstrcpyn32A( buffer, tmp, buflen );
if (tmp != name) HeapFree( GetProcessHeap(), 0, tmp );
return len;
ret = DOSFS_GetFullName( name, TRUE, full_name );
goto done;
}
/* Try the path of the current executable (for Win32 search order) */
if (win32 && GetCurrentTask())
{
LPSTR p;
GetModuleFileName32A( GetCurrentTask(), buffer, buflen );
if ((p = strrchr( buffer, '\\' )))
{
lstrcpyn32A( p + 1, tmp, (INT32)buflen - (p - buffer) );
if (DOSFS_GetUnixFileName( buffer, TRUE ))
{
*p = '\0';
goto found;
}
}
}
if (win32 && DIR_TryModulePath( name, full_name )) goto done;
/* Try the current directory */
if (DOSFS_GetUnixFileName( tmp, TRUE ))
{
GetCurrentDirectory32A( buflen, buffer );
goto found;
}
if (DOSFS_GetFullName( name, TRUE, full_name )) goto done;
/* Try the Windows directory */
if (DOSFS_FindUnixName( DIR_WindowsUnixDir, name, NULL, 0,
DRIVE_GetFlags( DIR_WindowsDosDir[0] - 'A' ) ))
{
lstrcpyn32A( buffer, DIR_WindowsDosDir, buflen );
goto found;
}
if (DIR_TryPath( DIR_WindowsUnixDir, DIR_WindowsDosDir, name, full_name ))
goto done;
/* Try the Windows system directory */
if (DOSFS_FindUnixName( DIR_SystemUnixDir, name, NULL, 0,
DRIVE_GetFlags( DIR_SystemDosDir[0] - 'A' ) ))
{
lstrcpyn32A( buffer, DIR_SystemDosDir, buflen );
goto found;
}
if (DIR_TryPath( DIR_SystemUnixDir, DIR_SystemDosDir, name, full_name ))
goto done;
/* Try the path of the current executable (for Win16 search order) */
if (!win32 && GetCurrentTask())
{
LPSTR p;
GetModuleFileName32A( GetCurrentTask(), buffer, buflen );
if ((p = strrchr( buffer, '\\' )))
{
lstrcpyn32A( p + 1, tmp, (INT32)buflen - (p - buffer) );
if (DOSFS_GetUnixFileName( buffer, TRUE ))
{
*p = '\0';
goto found;
}
}
}
if (!win32 && DIR_TryModulePath( name, full_name )) goto done;
/* Try all directories in path */
for (i = 0; i < DIR_PathElements; i++)
{
if (DOSFS_FindUnixName( DIR_UnixPath[i], name, NULL, 0,
DRIVE_GetFlags( DIR_DosPath[i][0] - 'A' ) ))
{
lstrcpyn32A( buffer, DIR_DosPath[i], buflen );
goto found;
}
if (DIR_TryPath( DIR_UnixPath[i], DIR_DosPath[i], name, full_name ))
goto done;
}
not_found:
if (tmp != name) HeapFree( GetProcessHeap(), 0, tmp );
SetLastError( ERROR_FILE_NOT_FOUND );
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return 0;
found:
len = strlen(buffer);
if (lastpart) *lastpart = buffer + len + 1;
if (len + 1 < buflen)
{
buffer += len;
*buffer++ = '\\';
buflen -= len + 1;
lstrcpyn32A( buffer, tmp, buflen );
}
len += strlen(tmp) + 1;
if (tmp != name) HeapFree( GetProcessHeap(), 0, tmp );
return len;
ret = FALSE;
done:
if (tmp) HeapFree( GetProcessHeap(), 0, tmp );
return ret;
}
@ -595,7 +586,17 @@ found:
DWORD SearchPath32A( LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen,
LPSTR buffer, LPSTR *lastpart )
{
return DIR_SearchPath( path, name, ext, buflen, buffer, lastpart, TRUE );
LPSTR p, res;
DOS_FULL_NAME full_name;
if (!DIR_SearchPath( path, name, ext, &full_name, TRUE )) return 0;
lstrcpyn32A( buffer, full_name.short_name, buflen );
res = full_name.long_name +
strlen(DRIVE_GetRoot( full_name.short_name[0] - 'A' ));
if (*res && (buflen > 3)) lstrcpyn32A( buffer + 3, res + 1, buflen - 3 );
for (p = buffer; *p; p++) if (*p == '/') *p = '\\';
if (lastpart) *lastpart = strrchr( buffer, '\\' ) + 1;
return *res ? strlen(res) + 2 : 3;
}
@ -605,25 +606,30 @@ DWORD SearchPath32A( LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen,
DWORD SearchPath32W( LPCWSTR path, LPCWSTR name, LPCWSTR ext, DWORD buflen,
LPWSTR buffer, LPWSTR *lastpart )
{
LPWSTR p;
LPSTR res;
DOS_FULL_NAME full_name;
LPSTR pathA = HEAP_strdupWtoA( GetProcessHeap(), 0, path );
LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, name );
LPSTR extA = HEAP_strdupWtoA( GetProcessHeap(), 0, ext );
LPSTR lastpartA;
LPSTR bufferA = HeapAlloc( GetProcessHeap(), 0, buflen + 1 );
DWORD ret = DIR_SearchPath( pathA, nameA, extA, buflen, bufferA,
&lastpartA, TRUE );
lstrcpyAtoW( buffer, bufferA );
if (lastpart)
{
if (lastpartA) *lastpart = buffer + (lastpartA - bufferA);
else *lastpart = NULL;
}
HeapFree( GetProcessHeap(), 0, bufferA );
DWORD ret = DIR_SearchPath( pathA, nameA, extA, &full_name, TRUE );
HeapFree( GetProcessHeap(), 0, extA );
HeapFree( GetProcessHeap(), 0, nameA );
HeapFree( GetProcessHeap(), 0, pathA );
return ret;
if (!ret) return 0;
lstrcpynAtoW( buffer, full_name.short_name, buflen );
res = full_name.long_name +
strlen(DRIVE_GetRoot( full_name.short_name[0] - 'A' ));
if (*res && (buflen > 3)) lstrcpynAtoW( buffer + 3, res + 1, buflen - 3 );
for (p = buffer; *p; p++) if (*p == '/') *p = '\\';
if (lastpart)
{
for (p = *lastpart = buffer; *p; p++)
if (*p == '\\') *lastpart = p + 1;
}
return *res ? strlen(res) + 2 : 3;
}

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,6 @@
#include "windows.h"
#include "winbase.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "heap.h"
@ -410,8 +409,9 @@ UINT32 DRIVE_GetFlags( int drive )
*/
int DRIVE_Chdir( int drive, const char *path )
{
DOS_FULL_NAME full_name;
char buffer[MAX_PATHNAME_LEN];
const char *unix_cwd, *dos_cwd;
LPSTR unix_cwd;
BY_HANDLE_FILE_INFORMATION info;
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
@ -420,31 +420,30 @@ int DRIVE_Chdir( int drive, const char *path )
buffer[0] += drive;
lstrcpyn32A( buffer + 2, path, sizeof(buffer) - 2 );
if (!(unix_cwd = DOSFS_GetUnixFileName( buffer, TRUE ))) return 0;
if (!FILE_Stat( unix_cwd, &info )) return 0;
if (!DOSFS_GetFullName( buffer, TRUE, &full_name )) return 0;
if (!FILE_Stat( full_name.long_name, &info )) return 0;
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return 0;
}
unix_cwd += strlen( DOSDrives[drive].root );
unix_cwd = full_name.long_name + strlen( DOSDrives[drive].root );
while (*unix_cwd == '/') unix_cwd++;
buffer[2] = '/';
lstrcpyn32A( buffer + 3, unix_cwd, sizeof(buffer) - 3 );
if (!(dos_cwd = DOSFS_GetDosTrueName( buffer, TRUE ))) return 0;
dprintf_dosfs( stddeb, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
'A' + drive, unix_cwd, dos_cwd + 3 );
'A' + drive, unix_cwd, full_name.short_name + 3 );
HeapFree( SystemHeap, 0, DOSDrives[drive].dos_cwd );
HeapFree( SystemHeap, 0, DOSDrives[drive].unix_cwd );
DOSDrives[drive].dos_cwd = HEAP_strdupA( SystemHeap, 0, dos_cwd + 3 );
DOSDrives[drive].dos_cwd = HEAP_strdupA( SystemHeap, 0,
full_name.short_name + 3 );
DOSDrives[drive].unix_cwd = HEAP_strdupA( SystemHeap, 0, unix_cwd );
if (pTask && (pTask->curdrive & 0x80) &&
((pTask->curdrive & ~0x80) == drive))
{
lstrcpyn32A( pTask->curdir, dos_cwd + 2, sizeof(pTask->curdir) );
lstrcpyn32A( pTask->curdir, full_name.short_name + 2,
sizeof(pTask->curdir) );
DRIVE_LastTask = GetCurrentTask();
}
return 1;

View File

@ -20,7 +20,6 @@
#include "windows.h"
#include "winerror.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "global.h"
@ -212,11 +211,8 @@ static HFILE32 FILE_OpenUnixFile( const char *name, int mode )
if ((file->unix_handle = open( name, mode, 0666 )) == -1)
{
if (Options.allowReadOnly && (mode == O_RDWR))
{
if ((file->unix_handle = open( name, O_RDONLY )) != -1)
fprintf( stderr, "Warning: could not open %s for writing, opening read-only.\n", name );
}
if (!Options.failReadOnly && (mode == O_RDWR))
file->unix_handle = open( name, O_RDONLY );
}
if ((file->unix_handle == -1) || (fstat( file->unix_handle, &st ) == -1))
{
@ -243,6 +239,7 @@ static HFILE32 FILE_OpenUnixFile( const char *name, int mode )
*/
HFILE32 FILE_Open( LPCSTR path, INT32 mode )
{
DOS_FULL_NAME full_name;
const char *unixName;
dprintf_file(stddeb, "FILE_Open: '%s' %04x\n", path, mode );
@ -257,9 +254,11 @@ HFILE32 FILE_Open( LPCSTR path, INT32 mode )
}
}
else /* check for filename, don't check for last entry if creating */
if (!(unixName = DOSFS_GetUnixFileName( path, !(mode & O_CREAT) )))
{
if (!DOSFS_GetFullName( path, !(mode & O_CREAT), &full_name ))
return HFILE_ERROR32;
unixName = full_name.long_name;
}
return FILE_OpenUnixFile( unixName, mode );
}
@ -272,6 +271,7 @@ static HFILE32 FILE_Create( LPCSTR path, int mode, int unique )
HFILE32 handle;
DOS_FILE *file;
const char *unixName;
DOS_FULL_NAME full_name;
dprintf_file(stddeb, "FILE_Create: '%s' %04x %d\n", path, mode, unique );
@ -285,12 +285,12 @@ static HFILE32 FILE_Create( LPCSTR path, int mode, int unique )
if ((handle = FILE_Alloc( &file )) == INVALID_HANDLE_VALUE32)
return INVALID_HANDLE_VALUE32;
if (!(unixName = DOSFS_GetUnixFileName( path, FALSE )))
if (!DOSFS_GetFullName( path, FALSE, &full_name ))
{
CloseHandle( handle );
return INVALID_HANDLE_VALUE32;
}
if ((file->unix_handle = open( unixName,
if ((file->unix_handle = open( full_name.long_name,
O_CREAT | O_TRUNC | O_RDWR | (unique ? O_EXCL : 0),
mode )) == -1)
{
@ -301,7 +301,7 @@ static HFILE32 FILE_Create( LPCSTR path, int mode, int unique )
/* File created OK, now fill the DOS_FILE */
file->unix_name = HEAP_strdupA( SystemHeap, 0, unixName );
file->unix_name = HEAP_strdupA( SystemHeap, 0, full_name.long_name );
return handle;
}
@ -317,9 +317,9 @@ static void FILE_FillInfo( struct stat *st, BY_HANDLE_FILE_INFORMATION *info )
if (S_ISDIR(st->st_mode))
info->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
DOSFS_UnixTimeToFileTime( st->st_mtime, &info->ftCreationTime );
DOSFS_UnixTimeToFileTime( st->st_mtime, &info->ftLastWriteTime );
DOSFS_UnixTimeToFileTime( st->st_atime, &info->ftLastAccessTime );
DOSFS_UnixTimeToFileTime( st->st_mtime, &info->ftCreationTime, 0 );
DOSFS_UnixTimeToFileTime( st->st_mtime, &info->ftLastWriteTime, 0 );
DOSFS_UnixTimeToFileTime( st->st_atime, &info->ftLastAccessTime, 0 );
info->dwVolumeSerialNumber = 0; /* FIXME */
info->nFileSizeHigh = 0;
@ -385,9 +385,11 @@ DWORD GetFileAttributes16( LPCSTR name )
*/
DWORD GetFileAttributes32A( LPCSTR name )
{
DOS_FULL_NAME full_name;
BY_HANDLE_FILE_INFORMATION info;
if (!FILE_Stat( name, &info )) return -1;
if (!DOSFS_GetFullName( name, TRUE, &full_name )) return -1;
if (!FILE_Stat( full_name.long_name, &info )) return -1;
return info.dwFileAttributes;
}
@ -500,8 +502,9 @@ UINT16 GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
UINT32 GetTempFileName32A( LPCSTR path, LPCSTR prefix, UINT32 unique,
LPSTR buffer)
{
LPSTR p;
DOS_FULL_NAME full_name;
int i;
LPSTR p;
UINT32 num = unique ? (unique & 0xffff) : time(NULL) & 0xffff;
if (!path) return 0;
@ -511,36 +514,38 @@ UINT32 GetTempFileName32A( LPCSTR path, LPCSTR prefix, UINT32 unique,
for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
sprintf( p, "%04x.tmp", num );
if (unique)
{
lstrcpyn32A( buffer, DOSFS_GetDosTrueName( buffer, FALSE ), 144 );
dprintf_file( stddeb, "GetTempFileName: returning %s\n", buffer );
if (-1==access(DOSFS_GetUnixFileName(buffer,TRUE),W_OK))
fprintf(stderr,"Warning: GetTempFileName returns '%s', which doesn't seem to be writeable. Please check your configuration file if this generates a failure.\n",buffer);
return unique;
}
/* Now try to create it */
do
if (!unique)
{
HFILE32 handle;
if ((handle = FILE_Create(buffer,0666,TRUE)) != INVALID_HANDLE_VALUE32)
{ /* We created it */
dprintf_file( stddeb, "GetTempFileName: created %s\n", buffer );
CloseHandle( handle );
break;
}
if (DOS_ExtendedError != ER_FileExists) break; /* No need to go on */
num++;
sprintf( p, "%04x.tmp", num );
} while (num != (unique & 0xffff));
do
{
HFILE32 handle = FILE_Create( buffer, 0666, TRUE );
if (handle != INVALID_HANDLE_VALUE32)
{ /* We created it */
dprintf_file( stddeb, "GetTempFileName: created %s\n", buffer);
CloseHandle( handle );
break;
}
if (DOS_ExtendedError != ER_FileExists)
break; /* No need to go on */
num++;
sprintf( p, "%04x.tmp", num );
} while (num != (unique & 0xffff));
}
lstrcpyn32A( buffer, DOSFS_GetDosTrueName( buffer, FALSE ), 144 );
/* Get the full path name */
if (DOSFS_GetFullName( buffer, FALSE, &full_name ))
{
if (access( full_name.long_name, W_OK ) == -1)
fprintf( stderr,
"Warning: GetTempFileName returns '%s', which doesn't seem to be writeable.\n"
"Please check your configuration file if this generates a failure.\n",
buffer);
}
dprintf_file( stddeb, "GetTempFileName: returning %s\n", buffer );
if (-1==access(DOSFS_GetUnixFileName(buffer,TRUE),W_OK))
fprintf(stderr,"Warning: GetTempFileName returns '%s', which doesn't seem to be writeable. Please check your configuration file if this generates a failure.\n",buffer);
return num;
return unique ? unique : num;
}
@ -576,7 +581,7 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode,
HFILE32 hFileRet;
FILETIME filetime;
WORD filedatetime[2];
const char *unixName, *dosName;
DOS_FULL_NAME full_name;
char *p;
int unixMode;
@ -589,9 +594,10 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode,
if (mode & OF_PARSE)
{
if (!(dosName = DOSFS_GetDosTrueName( name, FALSE ))) goto error;
lstrcpyn32A( ofs->szPathName, dosName, sizeof(ofs->szPathName) );
ofs->fFixedDisk = (GetDriveType16( dosName[0]-'A' ) != DRIVE_REMOVABLE);
if (!GetFullPathName32A( name, sizeof(ofs->szPathName),
ofs->szPathName, NULL )) goto error;
ofs->fFixedDisk = (GetDriveType16( ofs->szPathName[0]-'A' )
!= DRIVE_REMOVABLE);
dprintf_file( stddeb, "OpenFile(%s): OF_PARSE, res = '%s'\n",
name, ofs->szPathName );
return 0;
@ -604,8 +610,8 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode,
{
if ((hFileRet = FILE_Create(name,0666,FALSE))== INVALID_HANDLE_VALUE32)
goto error;
lstrcpyn32A( ofs->szPathName, DOSFS_GetDosTrueName( name, FALSE ),
sizeof(ofs->szPathName) );
GetFullPathName32A( name, sizeof(ofs->szPathName),
ofs->szPathName, NULL );
goto success;
}
@ -614,11 +620,7 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode,
if ((mode & OF_SEARCH) && !(mode & OF_REOPEN))
{
/* First try the file name as is */
if ((unixName = DOSFS_GetUnixFileName( name, TRUE )) != NULL)
{
lstrcpyn32A( ofs->szPathName, name, sizeof(ofs->szPathName) );
goto found;
}
if (DOSFS_GetFullName( name, TRUE, &full_name )) goto found;
/* Now remove the path */
if (name[0] && (name[1] == ':')) name += 2;
if ((p = strrchr( name, '\\' ))) name = p + 1;
@ -628,20 +630,17 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode,
/* Now look for the file */
if (!DIR_SearchPath( NULL, name, NULL, sizeof(ofs->szPathName),
ofs->szPathName, NULL, win32 ))
goto not_found;
if (!(unixName = DOSFS_GetUnixFileName( ofs->szPathName, TRUE )))
goto not_found;
if (!DIR_SearchPath( NULL, name, NULL, &full_name, win32 )) goto not_found;
found:
dprintf_file( stddeb, "OpenFile: found '%s'\n", unixName );
lstrcpyn32A(ofs->szPathName, DOSFS_GetDosTrueName( ofs->szPathName, FALSE),
sizeof(ofs->szPathName) );
dprintf_file( stddeb, "OpenFile: found %s = %s\n",
full_name.long_name, full_name.short_name );
lstrcpyn32A( ofs->szPathName, full_name.short_name,
sizeof(ofs->szPathName) );
if (mode & OF_DELETE)
{
if (unlink( unixName ) == -1) goto not_found;
if (unlink( full_name.long_name ) == -1) goto not_found;
dprintf_file( stddeb, "OpenFile(%s): OF_DELETE return = OK\n", name);
return 1;
}
@ -657,8 +656,8 @@ found:
unixMode = O_RDONLY; break;
}
if ((hFileRet = FILE_OpenUnixFile( unixName, unixMode )) == HFILE_ERROR32)
goto not_found;
hFileRet = FILE_OpenUnixFile( full_name.long_name, unixMode );
if (hFileRet == HFILE_ERROR32) goto not_found;
GetFileTime( hFileRet, NULL, NULL, &filetime );
FileTimeToDosDateTime( &filetime, &filedatetime[0], &filedatetime[1] );
if ((mode & OF_VERIFY) && (mode & OF_REOPEN))
@ -715,7 +714,7 @@ HFILE32 OpenFile32( LPCSTR name, OFSTRUCT *ofs, UINT32 mode )
*/
HFILE16 _lclose16( HFILE16 hFile )
{
dprintf_file( stddeb, "_lclose: handle %d\n", hFile );
dprintf_file( stddeb, "_lclose16: handle %d\n", hFile );
return CloseHandle( hFile ) ? 0 : HFILE_ERROR16;
}
@ -725,7 +724,7 @@ HFILE16 _lclose16( HFILE16 hFile )
*/
HFILE32 _lclose32( HFILE32 hFile )
{
dprintf_file( stddeb, "_lclose: handle %d\n", hFile );
dprintf_file( stddeb, "_lclose32: handle %d\n", hFile );
return CloseHandle( hFile ) ? 0 : HFILE_ERROR32;
}
@ -816,12 +815,45 @@ HFILE32 _lcreat_uniq( LPCSTR path, INT32 attr )
}
/***********************************************************************
* SetFilePointer (KERNEL32.492)
*/
DWORD SetFilePointer( HFILE32 hFile, LONG distance, LONG *highword,
DWORD method )
{
DOS_FILE *file;
int origin, result;
if (highword && *highword)
{
fprintf( stderr, "SetFilePointer: 64-bit offsets not supported yet\n");
SetLastError( ERROR_INVALID_PARAMETER );
return 0xffffffff;
}
dprintf_file( stddeb, "SetFilePointer: handle %d offset %ld origin %ld\n",
hFile, distance, method );
if (!(file = FILE_GetFile( hFile ))) return 0xffffffff;
switch(method)
{
case 1: origin = SEEK_CUR; break;
case 2: origin = SEEK_END; break;
default: origin = SEEK_SET; break;
}
if ((result = lseek( file->unix_handle, distance, origin )) == -1)
FILE_SetDosError();
FILE_ReleaseFile( file );
return (DWORD)result;
}
/***********************************************************************
* _llseek16 (KERNEL.84)
*/
LONG _llseek16( HFILE16 hFile, LONG lOffset, INT16 nOrigin )
{
return _llseek32( hFile, lOffset, nOrigin );
return SetFilePointer( hFile, lOffset, NULL, nOrigin );
}
@ -830,24 +862,7 @@ LONG _llseek16( HFILE16 hFile, LONG lOffset, INT16 nOrigin )
*/
LONG _llseek32( HFILE32 hFile, LONG lOffset, INT32 nOrigin )
{
DOS_FILE *file;
int origin, result;
dprintf_file( stddeb, "_llseek: handle %d, offset %ld, origin %d\n",
hFile, lOffset, nOrigin);
if (!(file = FILE_GetFile( hFile ))) return HFILE_ERROR32;
switch(nOrigin)
{
case 1: origin = SEEK_CUR; break;
case 2: origin = SEEK_END; break;
default: origin = SEEK_SET; break;
}
if ((result = lseek( file->unix_handle, lOffset, origin )) == -1)
FILE_SetDosError();
FILE_ReleaseFile( file );
return result;
return SetFilePointer( hFile, lOffset, NULL, nOrigin );
}
@ -961,47 +976,27 @@ UINT16 SetHandleCount16( UINT16 count )
HGLOBAL16 hPDB = GetCurrentPDB();
PDB *pdb = (PDB *)GlobalLock16( hPDB );
BYTE *files = PTR_SEG_TO_LIN( pdb->fileHandlesPtr );
WORD i;
dprintf_file( stddeb, "SetHandleCount(%d)\n", count );
if (count < 20) count = 20; /* No point in going below 20 */
else if (count > 254) count = 254;
/* If shrinking the table, make sure all extra file handles are closed */
if (count < pdb->nbFiles)
{
for (i = count; i < pdb->nbFiles; i++)
if (files[i] != 0xff) /* File open */
{
DOS_ERROR( ER_TooManyOpenFiles, EC_ProgramError,
SA_Abort, EL_Disk );
return pdb->nbFiles;
}
}
if (count == 20)
{
if (pdb->nbFiles > 20)
{
memcpy( pdb->fileHandles, files, 20 );
#ifdef WINELIB
GlobalFree32( (HGLOBAL32)pdb->fileHandlesPtr );
pdb->fileHandlesPtr = (SEGPTR)pdb->fileHandles;
#else
GlobalFree16( GlobalHandle16( SELECTOROF(pdb->fileHandlesPtr) ));
GlobalFree16( pdb->hFileHandles );
pdb->fileHandlesPtr = (SEGPTR)MAKELONG( 0x18,
GlobalHandleToSel( hPDB ) );
#endif
pdb->hFileHandles = 0;
pdb->nbFiles = 20;
}
}
else /* More than 20, need a new file handles table */
{
BYTE *newfiles;
#ifdef WINELIB
newfiles = (BYTE *)GlobalAlloc32( GMEM_FIXED, count );
#else
HGLOBAL16 newhandle = GlobalAlloc16( GMEM_MOVEABLE, count );
if (!newhandle)
{
@ -1009,21 +1004,16 @@ UINT16 SetHandleCount16( UINT16 count )
return pdb->nbFiles;
}
newfiles = (BYTE *)GlobalLock16( newhandle );
#endif /* WINELIB */
if (count > pdb->nbFiles)
{
memcpy( newfiles, files, pdb->nbFiles );
memset( newfiles + pdb->nbFiles, 0xff, count - pdb->nbFiles );
}
else memcpy( newfiles, files, count );
#ifdef WINELIB
if (pdb->nbFiles > 20) GlobalFree32( (HGLOBAL32)pdb->fileHandlesPtr );
pdb->fileHandlesPtr = (SEGPTR)newfiles;
#else
if (pdb->nbFiles > 20)
GlobalFree16( GlobalHandle16( SELECTOROF(pdb->fileHandlesPtr) ));
if (pdb->nbFiles > 20) GlobalFree16( pdb->hFileHandles );
pdb->fileHandlesPtr = WIN16_GlobalLock16( newhandle );
#endif /* WINELIB */
pdb->hFileHandles = newhandle;
pdb->nbFiles = count;
}
return pdb->nbFiles;
@ -1095,6 +1085,7 @@ BOOL16 DeleteFile16( LPCSTR path )
*/
BOOL32 DeleteFile32A( LPCSTR path )
{
DOS_FULL_NAME full_name;
const char *unixName;
dprintf_file(stddeb, "DeleteFile: '%s'\n", path );
@ -1106,8 +1097,8 @@ BOOL32 DeleteFile32A( LPCSTR path )
return FALSE;
}
if (!(unixName = DOSFS_GetUnixFileName( path, TRUE ))) return FALSE;
if (unlink( unixName ) == -1)
if (!DOSFS_GetFullName( path, TRUE, &full_name )) return FALSE;
if (unlink( full_name.long_name ) == -1)
{
FILE_SetDosError();
return FALSE;
@ -1153,6 +1144,99 @@ DWORD GetFileType( HFILE32 hFile )
}
/**************************************************************************
* MoveFile32A (KERNEL32.387)
*/
BOOL32 MoveFile32A( LPCSTR fn1, LPCSTR fn2 )
{
DOS_FULL_NAME full_name1, full_name2;
dprintf_file( stddeb, "MoveFile32A(%s,%s)\n", fn1, fn2 );
if (!DOSFS_GetFullName( fn1, TRUE, &full_name1 )) return FALSE;
if (!DOSFS_GetFullName( fn2, FALSE, &full_name2 )) return FALSE;
/* FIXME: should not replace an existing file */
/* FIXME: should handle renaming across devices */
if (rename( full_name1.long_name, full_name2.long_name ) == -1)
{
FILE_SetDosError();
return FALSE;
}
return TRUE;
}
/**************************************************************************
* MoveFile32W (KERNEL32.390)
*/
BOOL32 MoveFile32W( LPCWSTR fn1, LPCWSTR fn2 )
{
LPSTR afn1 = HEAP_strdupWtoA( GetProcessHeap(), 0, fn1 );
LPSTR afn2 = HEAP_strdupWtoA( GetProcessHeap(), 0, fn2 );
BOOL32 res = MoveFile32A( afn1, afn2 );
HeapFree( GetProcessHeap(), 0, afn1 );
HeapFree( GetProcessHeap(), 0, afn2 );
return res;
}
/**************************************************************************
* CopyFile32A (KERNEL32.36)
*/
BOOL32 CopyFile32A( LPCSTR source, LPCSTR dest, BOOL32 fail_if_exists )
{
HFILE32 h1, h2;
BY_HANDLE_FILE_INFORMATION info;
UINT32 count;
BOOL32 ret = FALSE;
int mode;
char buffer[2048];
if ((h1 = _lopen32( source, OF_READ )) == HFILE_ERROR32) return FALSE;
if (!GetFileInformationByHandle( h1, &info ))
{
CloseHandle( h1 );
return FALSE;
}
mode = (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666;
if ((h2 = FILE_Create( dest, mode, fail_if_exists )) == HFILE_ERROR32)
{
CloseHandle( h1 );
return FALSE;
}
while ((count = _lread32( h2, buffer, sizeof(buffer) )) > 0)
{
char *p = buffer;
while (count > 0)
{
INT32 res = _lwrite32( h2, p, count );
if (res <= 0) goto done;
p += res;
count -= res;
}
}
ret = TRUE;
done:
CloseHandle( h1 );
CloseHandle( h2 );
return ret;
}
/**************************************************************************
* CopyFile32W (KERNEL32.37)
*/
BOOL32 CopyFile32W( LPCWSTR source, LPCWSTR dest, BOOL32 fail_if_exists )
{
LPSTR sourceA = HEAP_strdupWtoA( GetProcessHeap(), 0, source );
LPSTR destA = HEAP_strdupWtoA( GetProcessHeap(), 0, dest );
BOOL32 ret = CopyFile32A( sourceA, destA, fail_if_exists );
HeapFree( GetProcessHeap(), 0, sourceA );
HeapFree( GetProcessHeap(), 0, destA );
return ret;
}
/***********************************************************************
* SetFileTime (KERNEL32.493)
*/
@ -1172,11 +1256,11 @@ BOOL32 SetFileTime( HFILE32 hFile,
lpLastWriteTime
);
if (lpLastAccessTime)
utimbuf.actime = DOSFS_FileTimeToUnixTime(lpLastAccessTime);
utimbuf.actime = DOSFS_FileTimeToUnixTime(lpLastAccessTime, NULL);
else
utimbuf.actime = 0; /* FIXME */
if (lpLastWriteTime)
utimbuf.modtime = DOSFS_FileTimeToUnixTime(lpLastWriteTime);
utimbuf.modtime = DOSFS_FileTimeToUnixTime(lpLastWriteTime, NULL);
else
utimbuf.modtime = 0; /* FIXME */
if (-1==utime(file->unix_name,&utimbuf))

View File

@ -11,7 +11,7 @@
#include <string.h>
#include "windows.h"
#include "dos_fs.h"
#include "file.h"
#include "heap.h"
#include "stddebug.h"
#include "debug.h"
@ -36,6 +36,8 @@ typedef struct
BOOL32 changed;
PROFILESECTION *section;
char *dos_name;
char *unix_name;
char *filename;
} PROFILE;
@ -332,8 +334,7 @@ static BOOL32 PROFILE_FlushFile(void)
FILE *file = NULL;
if (!CurProfile.changed || !CurProfile.dos_name) return TRUE;
if (!(unix_name = DOSFS_GetUnixFileName( CurProfile.dos_name, FALSE )) ||
!(file = fopen( unix_name, "w" )))
if (!(unix_name = CurProfile.unix_name) || !(file = fopen(unix_name, "w")))
{
/* Try to create it in $HOME/.wine */
/* FIXME: this will need a more general solution */
@ -343,7 +344,7 @@ static BOOL32 PROFILE_FlushFile(void)
strcat( buffer, "/.wine/" );
p = buffer + strlen(buffer);
strcpy( p, strrchr( CurProfile.dos_name, '\\' ) + 1 );
AnsiLower( p );
CharLower32A( p );
file = fopen( buffer, "w" );
unix_name = buffer;
}
@ -372,24 +373,32 @@ static BOOL32 PROFILE_FlushFile(void)
*/
static BOOL32 PROFILE_Open( LPCSTR filename )
{
DOS_FULL_NAME full_name;
char buffer[MAX_PATHNAME_LEN];
const char *dos_name, *unix_name;
char *newdos_name, *p;
FILE *file = NULL;
if (CurProfile.filename && !strcmp( filename, CurProfile.filename ))
{
dprintf_profile( stddeb, "PROFILE_Open(%s): already opened\n",
filename );
return TRUE;
}
if (strchr( filename, '/' ) || strchr( filename, '\\' ) ||
strchr( filename, ':' ))
{
if (!(dos_name = DOSFS_GetDosTrueName( filename, FALSE))) return FALSE;
if (!DOSFS_GetFullName( filename, FALSE, &full_name )) return FALSE;
}
else
{
GetWindowsDirectory32A( buffer, sizeof(buffer) );
strcat( buffer, "\\" );
strcat( buffer, filename );
if (!(dos_name = DOSFS_GetDosTrueName( buffer, FALSE ))) return FALSE;
if (!DOSFS_GetFullName( buffer, FALSE, &full_name )) return FALSE;
}
if (CurProfile.dos_name && !strcmp( dos_name, CurProfile.dos_name ))
if (CurProfile.dos_name &&
!strcmp( full_name.short_name, CurProfile.dos_name ))
{
dprintf_profile( stddeb, "PROFILE_Open(%s): already opened\n",
filename );
@ -398,12 +407,15 @@ static BOOL32 PROFILE_Open( LPCSTR filename )
/* Flush the previous profile */
newdos_name = HEAP_strdupA( SystemHeap, 0, dos_name );
newdos_name = HEAP_strdupA( SystemHeap, 0, full_name.short_name );
PROFILE_FlushFile();
PROFILE_Free( CurProfile.section );
if (CurProfile.dos_name) HeapFree( SystemHeap, 0, CurProfile.dos_name );
if (CurProfile.unix_name) HeapFree( SystemHeap, 0, CurProfile.unix_name );
if (CurProfile.filename) HeapFree( SystemHeap, 0, CurProfile.filename );
CurProfile.section = NULL;
CurProfile.dos_name = newdos_name;
CurProfile.filename = HEAP_strdupA( SystemHeap, 0, filename );
/* Try to open the profile file, first in $HOME/.wine */
@ -414,15 +426,22 @@ static BOOL32 PROFILE_Open( LPCSTR filename )
strcat( buffer, "/.wine/" );
p = buffer + strlen(buffer);
strcpy( p, strrchr( newdos_name, '\\' ) + 1 );
AnsiLower( p );
CharLower32A( p );
if ((file = fopen( buffer, "r" )))
dprintf_profile( stddeb, "Found it in %s\n", buffer );
{
dprintf_profile( stddeb, "PROFILE_Open(%s): found it in %s\n",
filename, buffer );
CurProfile.unix_name = HEAP_strdupA( SystemHeap, 0, buffer );
}
}
if (!file && ((unix_name = DOSFS_GetUnixFileName( dos_name, TRUE ))))
if (!file)
{
if ((file = fopen( unix_name, "r" )))
dprintf_profile( stddeb, "Found it in %s\n", unix_name );
CurProfile.unix_name = HEAP_strdupA( SystemHeap, 0,
full_name.long_name );
if ((file = fopen( full_name.long_name, "r" )))
dprintf_profile( stddeb, "PROFILE_Open(%s): found it in %s\n",
filename, full_name.long_name );
}
if (file)
@ -435,7 +454,6 @@ static BOOL32 PROFILE_Open( LPCSTR filename )
/* Does not exist yet, we will create it in PROFILE_FlushFile */
fprintf( stderr, "Warning: profile file %s not found\n", newdos_name );
}
dprintf_profile( stddeb, "PROFILE_Open(%s): successful\n", filename );
return TRUE;
}

View File

@ -7,8 +7,10 @@ MODULE = metafiledrv
C_SRCS = \
bitblt.c \
graphics.c \
init.c \
mapping.c
mapping.c \
text.c
all: $(MODULE).o

View File

@ -0,0 +1,190 @@
/*
* Metafile driver graphics functions
*
* Copyright 1993, 1994 Alexandre Julliard
*/
#include <stdlib.h>
#include "graphics.h"
#include "gdi.h"
#include "dc.h"
#include "metafile.h"
#include "region.h"
#include "xmalloc.h"
#include "metafiledrv.h"
#include "stddebug.h"
#include "debug.h"
/**********************************************************************
* MFDRV_MoveToEx
*/
BOOL32
MFDRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt)
{
if (!MF_MetaParam2(dc,META_MOVETO,x,y))
return FALSE;
if (pt)
{
pt->x = dc->w.CursPosX;
pt->y = dc->w.CursPosY;
}
dc->w.CursPosX = x;
dc->w.CursPosY = y;
return TRUE;
}
/***********************************************************************
* MFDRV_LineTo
*/
BOOL32
MFDRV_LineTo( DC *dc, INT32 x, INT32 y )
{
return MF_MetaParam2(dc, META_LINETO, x, y);
}
/***********************************************************************
* MFDRV_Arc
*/
BOOL32
MFDRV_Arc( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
{
return MF_MetaParam8(dc, META_ARC, left, top, right, bottom,
xstart, ystart, xend, yend);
}
/***********************************************************************
* MFDRV_Pie
*/
BOOL32
MFDRV_Pie( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
{
return MF_MetaParam8(dc, META_PIE, left, top, right, bottom,
xstart, ystart, xend, yend);
}
/***********************************************************************
* MFDRV_Chord
*/
BOOL32
MFDRV_Chord( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
{
return MF_MetaParam8(dc, META_CHORD, left, top, right, bottom,
xstart, ystart, xend, yend);
}
/***********************************************************************
* MFDRV_Ellipse
*/
BOOL32
MFDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
{
return MF_MetaParam4(dc, META_ELLIPSE, left, top, right, bottom);
}
/***********************************************************************
* MFDRV_Rectangle
*/
BOOL32
MFDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
{
return MF_MetaParam4(dc, META_RECTANGLE, left, top, right, bottom);
}
/***********************************************************************
* MFDRV_RoundRect
*/
BOOL32
MFDRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 ell_width, INT32 ell_height )
{
return MF_MetaParam6(dc, META_ROUNDRECT, left, top, right, bottom,
ell_width, ell_height);
}
/***********************************************************************
* MFDRV_SetPixel
*/
COLORREF
MFDRV_SetPixel( DC *dc, INT32 x, INT32 y, COLORREF color )
{
return MF_MetaParam4(dc, META_SETPIXEL, x, y,HIWORD(color),LOWORD(color));
}
/**********************************************************************
* MFDRV_Polyline
*/
BOOL32
MFDRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count )
{
register int i;
LPPOINT16 pt16;
BOOL16 ret;
pt16 = (LPPOINT16)xmalloc(sizeof(POINT16)*count);
for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i]));
ret = MF_MetaPoly(dc, META_POLYLINE, pt16, count);
free(pt16);
return ret;
}
/**********************************************************************
* MFDRV_Polygon
*/
BOOL32
MFDRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count )
{
register int i;
LPPOINT16 pt16;
BOOL16 ret;
pt16 = (LPPOINT16)xmalloc(sizeof(POINT16)*count);
for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i]));
ret = MF_MetaPoly(dc, META_POLYGON, pt16, count);
free(pt16);
return ret;
}
/**********************************************************************
* PolyPolygon
*/
BOOL32
MFDRV_PolyPolygon( DC *dc, LPPOINT32 pt, LPINT32 counts, UINT32 polygons)
{
int i,j;
LPPOINT16 pt16;
LPPOINT32 curpt=pt;
BOOL32 ret;
for (i=0;i<polygons;i++) {
pt16=(LPPOINT16)xmalloc(sizeof(POINT16)*counts[i]);
for (j=counts[i];j--;) CONV_POINT32TO16(&(curpt[j]),&(pt16[j]));
ret = MF_MetaPoly(dc, META_POLYGON, pt16, counts[i]);
free(pt16);
if (!ret)
return FALSE;
curpt+=counts[i];
}
return TRUE;
}
/**********************************************************************
* MFDRV_ExtFloodFill
*/
BOOL32
MFDRV_ExtFloodFill( DC *dc, INT32 x, INT32 y, COLORREF color, UINT32 fillType )
{
return MF_MetaParam4(dc,META_FLOODFILL,x,y,HIWORD(color),LOWORD(color));
}

View File

@ -16,41 +16,38 @@ static BOOL32 MFDRV_DeleteDC( DC *dc );
static const DC_FUNCTIONS MFDRV_Funcs =
{
NULL, /* pArc */
MFDRV_Arc, /* pArc */
MFDRV_BitBlt, /* pBitBlt */
NULL, /* pChord */
MFDRV_Chord, /* pChord */
NULL, /* pCreateDC */
MFDRV_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pEllipse */
MFDRV_Ellipse, /* pEllipse */
NULL, /* pEscape */
NULL, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
NULL, /* pExtFloodFill */
NULL, /* pExtTextOut */
NULL, /* pFillRgn */
NULL, /* pFloodFill */
NULL, /* pFrameRgn */
MFDRV_ExtFloodFill, /* pExtFloodFill */
MFDRV_ExtTextOut, /* pExtTextOut */
NULL /* no implementation */, /* pGetPixel */
NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
NULL, /* pInvertRgn */
NULL, /* pLineTo */
NULL, /* pMoveToEx */
MFDRV_LineTo, /* pLineTo */
MFDRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */
MFDRV_OffsetWindowOrg, /* pOffsetWindowOrg */
NULL, /* pPaintRgn */
MFDRV_PatBlt, /* pPatBlt */
NULL, /* pPie */
NULL, /* pPolyPolygon */
NULL, /* pPolygon */
NULL, /* pPolyline */
MFDRV_Pie, /* pPie */
MFDRV_PolyPolygon, /* pPolyPolygon */
MFDRV_Polygon, /* pPolygon */
MFDRV_Polyline, /* pPolyline */
NULL, /* pRealizePalette */
NULL, /* pRectangle */
MFDRV_Rectangle, /* pRectangle */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
MFDRV_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
MFDRV_ScaleViewportExt, /* pScaleViewportExt */
MFDRV_ScaleWindowExt, /* pScaleWindowExt */
@ -63,7 +60,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pSetDIBitsToDevice */
MFDRV_SetMapMode, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
MFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
@ -77,8 +74,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_SetWindowExt, /* pSetWindowExt */
MFDRV_SetWindowOrg, /* pSetWindowOrg */
MFDRV_StretchBlt, /* pStretchBlt */
NULL, /* pStretchDIBits */
NULL /* pTextOut */
NULL /* pStretchDIBits */
};
@ -237,4 +233,3 @@ BOOL16 DeleteMetaFile16( HMETAFILE16 hmf )
{
return !GlobalFree16( hmf );
}

View File

@ -0,0 +1,39 @@
/*
* metafile driver text functions
*
* Copyright 1993, 1994 Alexandre Julliard
*
*/
#include <stdlib.h>
#include "windows.h"
#include "dc.h"
#include "gdi.h"
#include "callback.h"
#include "heap.h"
#include "metafile.h"
#include "metafiledrv.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
/***********************************************************************
* MFDRV_ExtTextOut
*/
BOOL32
MFDRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
const RECT32 *lprect, LPCSTR str, UINT32 count,
const INT32 *lpDx )
{
RECT16 rect16;
LPINT16 lpdx16 = lpDx?(LPINT16)xmalloc(sizeof(INT16)*count):NULL;
BOOL32 ret;
int i;
if (lprect) CONV_RECT32TO16(lprect,&rect16);
if (lpdx16) for (i=count;i--;) lpdx16[i]=lpDx[i];
ret=MF_ExtTextOut(dc,x,y,flags,lprect?&rect16:NULL,str,count,lpdx16);
if (lpdx16) free(lpdx16);
return ret;
}

View File

@ -50,14 +50,11 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pExcludeVisRect */
NULL, /* pExtFloodFill */
NULL, /* pExtTextOut */
NULL, /* pFillRgn */
NULL, /* pFloodFill */
NULL, /* pFrameRgn */
NULL, /* pGetPixel */
WIN16DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
WIN16DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
NULL, /* pInvertRgn */
NULL, /* pLineTo */
NULL, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
@ -99,8 +96,7 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pSetWindowExt (optional) */
NULL, /* pSetWindowOrg (optional) */
NULL, /* pStretchBlt */
NULL, /* pStretchDIBits */
NULL /* pTextOut */
NULL /* pStretchDIBits */
};

View File

@ -9,7 +9,9 @@ C_SRCS = \
bitblt.c \
clipping.c \
font.c \
init.c
graphics.c \
init.c \
text.c
all: $(MODULE).o

678
graphics/x11drv/graphics.c Normal file
View File

@ -0,0 +1,678 @@
/*
* X11 graphics driver graphics functions
*
* Copyright 1993,1994 Alexandre Julliard
*/
#include <math.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
#ifndef PI
#define PI M_PI
#endif
#include <string.h>
#include "x11drv.h"
#include "bitmap.h"
#include "gdi.h"
#include "graphics.h"
#include "dc.h"
#include "bitmap.h"
#include "callback.h"
#include "metafile.h"
#include "syscolor.h"
#include "stddebug.h"
#include "palette.h"
#include "color.h"
#include "region.h"
#include "struct32.h"
#include "debug.h"
#include "xmalloc.h"
/**********************************************************************
* X11DRV_MoveToEx
*/
BOOL32
X11DRV_MoveToEx(DC *dc,INT32 x,INT32 y,LPPOINT32 pt) {
if (pt)
{
pt->x = dc->w.CursPosX;
pt->y = dc->w.CursPosY;
}
dc->w.CursPosX = x;
dc->w.CursPosY = y;
return TRUE;
}
/***********************************************************************
* X11DRV_LineTo
*/
BOOL32
X11DRV_LineTo( DC *dc, INT32 x, INT32 y )
{
if (DC_SetupGCForPen( dc ))
XDrawLine(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + XLPTODP( dc, dc->w.CursPosX ),
dc->w.DCOrgY + YLPTODP( dc, dc->w.CursPosY ),
dc->w.DCOrgX + XLPTODP( dc, x ),
dc->w.DCOrgY + YLPTODP( dc, y ) );
dc->w.CursPosX = x;
dc->w.CursPosY = y;
return TRUE;
}
/***********************************************************************
* GRAPH_DrawArc
*
* Helper functions for Arc(), Chord() and Pie().
* 'lines' is the number of lines to draw: 0 for Arc, 1 for Chord, 2 for Pie.
*/
static BOOL32
X11DRV_DrawArc( DC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 xstart, INT32 ystart,
INT32 xend, INT32 yend, INT32 lines )
{
INT32 xcenter, ycenter, istart_angle, idiff_angle, tmp;
double start_angle, end_angle;
XPoint points[3];
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
right = XLPTODP( dc, right );
bottom = YLPTODP( dc, bottom );
xstart = XLPTODP( dc, xstart );
ystart = YLPTODP( dc, ystart );
xend = XLPTODP( dc, xend );
yend = YLPTODP( dc, yend );
if ((left == right) || (top == bottom)) return FALSE;
xcenter = (right + left) / 2;
ycenter = (bottom + top) / 2;
start_angle = atan2( (double)(ycenter-ystart)*(right-left),
(double)(xstart-xcenter)*(bottom-top) );
end_angle = atan2( (double)(ycenter-yend)*(right-left),
(double)(xend-xcenter)*(bottom-top) );
istart_angle = (INT32)(start_angle * 180 * 64 / PI);
idiff_angle = (INT32)((end_angle - start_angle) * 180 * 64 / PI );
if (idiff_angle <= 0) idiff_angle += 360 * 64;
if (left > right) { tmp=left; left=right; right=tmp; }
if (top > bottom) { tmp=top; top=bottom; bottom=tmp; }
/* Fill arc with brush if Chord() or Pie() */
if ((lines > 0) && DC_SetupGCForBrush( dc ))
{
XSetArcMode( display, dc->u.x.gc, (lines==1) ? ArcChord : ArcPieSlice);
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, istart_angle, idiff_angle );
}
/* Draw arc and lines */
if (!DC_SetupGCForPen( dc )) return TRUE;
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, istart_angle, idiff_angle );
if (!lines) return TRUE;
points[0].x = dc->w.DCOrgX + xcenter + (int)(cos(start_angle) * (right-left) / 2);
points[0].y = dc->w.DCOrgY + ycenter - (int)(sin(start_angle) * (bottom-top) / 2);
points[1].x = dc->w.DCOrgX + xcenter + (int)(cos(end_angle) * (right-left) / 2);
points[1].y = dc->w.DCOrgY + ycenter - (int)(sin(end_angle) * (bottom-top) / 2);
if (lines == 2)
{
points[2] = points[1];
points[1].x = dc->w.DCOrgX + xcenter;
points[1].y = dc->w.DCOrgY + ycenter;
}
XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, lines+1, CoordModeOrigin );
return TRUE;
}
/***********************************************************************
* X11DRV_Arc
*/
BOOL32
X11DRV_Arc( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
{
return X11DRV_DrawArc( dc, left, top, right, bottom,
xstart, ystart, xend, yend, 0 );
}
/***********************************************************************
* X11DRV_Pie
*/
BOOL32
X11DRV_Pie( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
{
return X11DRV_DrawArc( dc, left, top, right, bottom,
xstart, ystart, xend, yend, 2 );
}
/***********************************************************************
* X11DRV_Chord
*/
BOOL32
X11DRV_Chord( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom,
INT32 xstart, INT32 ystart, INT32 xend, INT32 yend )
{
return X11DRV_DrawArc( dc, left, top, right, bottom,
xstart, ystart, xend, yend, 1 );
}
/***********************************************************************
* X11DRV_Ellipse
*/
BOOL32
X11DRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom )
{
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
right = XLPTODP( dc, right );
bottom = YLPTODP( dc, bottom );
if ((left == right) || (top == bottom)) return FALSE;
if (right < left) { INT32 tmp = right; right = left; left = tmp; }
if (bottom < top) { INT32 tmp = bottom; bottom = top; top = tmp; }
if ((dc->u.x.pen.style == PS_INSIDEFRAME) &&
(dc->u.x.pen.width < right-left-1) &&
(dc->u.x.pen.width < bottom-top-1))
{
left += dc->u.x.pen.width / 2;
right -= (dc->u.x.pen.width + 1) / 2;
top += dc->u.x.pen.width / 2;
bottom -= (dc->u.x.pen.width + 1) / 2;
}
if (DC_SetupGCForBrush( dc ))
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 );
if (DC_SetupGCForPen( dc ))
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 );
return TRUE;
}
/***********************************************************************
* X11DRV_Rectangle
*/
BOOL32
X11DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
{
INT32 width;
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
right = XLPTODP( dc, right );
bottom = YLPTODP( dc, bottom );
if (right < left) { INT32 tmp = right; right = left; left = tmp; }
if (bottom < top) { INT32 tmp = bottom; bottom = top; top = tmp; }
if ((left == right) || (top == bottom))
{
if (DC_SetupGCForPen( dc ))
XDrawLine(display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + top,
dc->w.DCOrgX + right,
dc->w.DCOrgY + bottom);
return TRUE;
}
width = dc->u.x.pen.width;
if (!width) width = 1;
if(dc->u.x.pen.style == PS_NULL) width = 0;
if ((dc->u.x.pen.style == PS_INSIDEFRAME) &&
(width < right-left) && (width < bottom-top))
{
left += width / 2;
right -= (width + 1) / 2;
top += width / 2;
bottom -= (width + 1) / 2;
}
if (DC_SetupGCForBrush( dc ))
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + (width + 1) / 2,
dc->w.DCOrgY + top + (width + 1) / 2,
right-left-width-1, bottom-top-width-1);
if (DC_SetupGCForPen( dc ))
XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
right-left-1, bottom-top-1 );
return TRUE;
}
/***********************************************************************
* X11DRV_RoundRect
*/
BOOL32
X11DRV_RoundRect( DC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 ell_width, INT32 ell_height )
{
dprintf_graphics(stddeb, "X11DRV_RoundRect(%d %d %d %d %d %d\n",
left, top, right, bottom, ell_width, ell_height);
left = XLPTODP( dc, left );
top = YLPTODP( dc, top );
right = XLPTODP( dc, right );
bottom = YLPTODP( dc, bottom );
ell_width = abs( ell_width * dc->vportExtX / dc->wndExtX );
ell_height = abs( ell_height * dc->vportExtY / dc->wndExtY );
/* Fix the coordinates */
if (right < left) { INT32 tmp = right; right = left; left = tmp; }
if (bottom < top) { INT32 tmp = bottom; bottom = top; top = tmp; }
if (ell_width > right - left) ell_width = right - left;
if (ell_height > bottom - top) ell_height = bottom - top;
if (DC_SetupGCForBrush( dc ))
{
if (ell_width && ell_height)
{
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width, ell_height, 90 * 64, 90 * 64 );
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 180 * 64, 90 * 64 );
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width,
dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 270 * 64, 90 * 64 );
XFillArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top,
ell_width, ell_height, 0, 90 * 64 );
}
if (ell_width < right - left)
{
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + top,
right - left - ell_width, ell_height / 2 );
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + bottom - (ell_height+1) / 2,
right - left - ell_width, (ell_height+1) / 2 );
}
if (ell_height < bottom - top)
{
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + top + ell_height / 2,
right - left, bottom - top - ell_height );
}
}
if (DC_SetupGCForPen(dc))
{
if (ell_width && ell_height)
{
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,
ell_width, ell_height, 90 * 64, 90 * 64 );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 180 * 64, 90 * 64 );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width,
dc->w.DCOrgY + bottom - ell_height,
ell_width, ell_height, 270 * 64, 90 * 64 );
XDrawArc( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right - ell_width, dc->w.DCOrgY + top,
ell_width, ell_height, 0, 90 * 64 );
}
if (ell_width < right - left)
{
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + top,
dc->w.DCOrgX + right - ell_width / 2,
dc->w.DCOrgY + top );
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + ell_width / 2,
dc->w.DCOrgY + bottom,
dc->w.DCOrgX + right - ell_width / 2,
dc->w.DCOrgY + bottom );
}
if (ell_height < bottom - top)
{
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + right,
dc->w.DCOrgY + top + ell_height / 2,
dc->w.DCOrgX + right,
dc->w.DCOrgY + bottom - ell_height / 2 );
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left,
dc->w.DCOrgY + top + ell_height / 2,
dc->w.DCOrgX + left,
dc->w.DCOrgY + bottom - ell_height / 2 );
}
}
return TRUE;
}
/***********************************************************************
* X11DRV_SetPixel
*/
COLORREF
X11DRV_SetPixel( DC *dc, INT32 x, INT32 y, COLORREF color )
{
Pixel pixel;
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
pixel = COLOR_ToPhysical( dc, color );
XSetForeground( display, dc->u.x.gc, pixel );
XSetFunction( display, dc->u.x.gc, GXcopy );
XDrawPoint( display, dc->u.x.drawable, dc->u.x.gc, x, y );
/* inefficient but simple... */
return COLOR_ToLogical(pixel);
}
/***********************************************************************
* X11DRV_GetPixel
*/
COLORREF
X11DRV_GetPixel( DC *dc, INT32 x, INT32 y )
{
static Pixmap pixmap = 0;
XImage * image;
int pixel;
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
if (dc->w.flags & DC_MEMORY)
{
image = XGetImage( display, dc->u.x.drawable, x, y, 1, 1,
AllPlanes, ZPixmap );
}
else
{
/* If we are reading from the screen, use a temporary copy */
/* to avoid a BadMatch error */
if (!pixmap) pixmap = XCreatePixmap( display, rootWindow,
1, 1, dc->w.bitsPerPixel );
XCopyArea( display, dc->u.x.drawable, pixmap, BITMAP_colorGC,
x, y, 1, 1, 0, 0 );
image = XGetImage( display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap );
}
pixel = XGetPixel( image, 0, 0 );
XDestroyImage( image );
return COLOR_ToLogical(pixel);
}
/***********************************************************************
* X11DRV_PaintRgn
*/
BOOL32
X11DRV_PaintRgn( DC *dc, HRGN32 hrgn )
{
RECT32 box;
HRGN32 tmpVisRgn, prevVisRgn;
HDC32 hdc = dc->hSelf; /* FIXME: should not mix dc/hdc this way */
/* Modify visible region */
if (!(prevVisRgn = SaveVisRgn( hdc ))) return FALSE;
if (!(tmpVisRgn = CreateRectRgn32( 0, 0, 0, 0 )))
{
RestoreVisRgn( hdc );
return FALSE;
}
CombineRgn32( tmpVisRgn, prevVisRgn, hrgn, RGN_AND );
SelectVisRgn( hdc, tmpVisRgn );
DeleteObject32( tmpVisRgn );
/* Fill the region */
GetRgnBox32( 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,
box.right-box.left, box.bottom-box.top );
/* Restore the visible region */
RestoreVisRgn( hdc );
return TRUE;
}
/**********************************************************************
* X11DRV_Polyline
*/
BOOL32
X11DRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count )
{
register int i;
if (DC_SetupGCForPen( dc ))
for (i = 0; i < count-1; i ++)
XDrawLine (display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + XLPTODP(dc, pt [i].x),
dc->w.DCOrgY + YLPTODP(dc, pt [i].y),
dc->w.DCOrgX + XLPTODP(dc, pt [i+1].x),
dc->w.DCOrgY + YLPTODP(dc, pt [i+1].y));
return TRUE;
}
/**********************************************************************
* X11DRV_Polygon
*/
BOOL32
X11DRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count )
{
register int i;
XPoint *points;
points = (XPoint *) xmalloc (sizeof (XPoint) * (count+1));
for (i = 0; i < count; i++)
{
points[i].x = dc->w.DCOrgX + XLPTODP( dc, pt[i].x );
points[i].y = dc->w.DCOrgY + YLPTODP( dc, pt[i].y );
}
points[count] = points[0];
if (DC_SetupGCForBrush( dc ))
XFillPolygon( display, dc->u.x.drawable, dc->u.x.gc,
points, count+1, Complex, CoordModeOrigin);
if (DC_SetupGCForPen ( dc ))
XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, count+1, CoordModeOrigin );
free( points );
return TRUE;
}
/**********************************************************************
* X11DRV_PolyPolygon
*/
BOOL32
X11DRV_PolyPolygon( DC *dc, LPPOINT32 pt, LPINT32 counts, UINT32 polygons)
{
HRGN32 hrgn;
/* FIXME: The points should be converted to device coords before */
/* creating the region. But as CreatePolyPolygonRgn is not */
/* really correct either, it doesn't matter much... */
/* At least the outline will be correct :-) */
hrgn = CreatePolyPolygonRgn32( pt, counts, polygons, dc->w.polyFillMode );
X11DRV_PaintRgn( dc, hrgn );
DeleteObject32( hrgn );
/* Draw the outline of the polygons */
if (DC_SetupGCForPen ( dc ))
{
int i, j, max = 0;
XPoint *points;
for (i = 0; i < polygons; i++) if (counts[i] > max) max = counts[i];
points = (XPoint *) xmalloc( sizeof(XPoint) * (max+1) );
for (i = 0; i < polygons; i++)
{
for (j = 0; j < counts[i]; j++)
{
points[j].x = dc->w.DCOrgX + XLPTODP( dc, pt->x );
points[j].y = dc->w.DCOrgY + YLPTODP( dc, pt->y );
pt++;
}
points[j] = points[0];
XDrawLines( display, dc->u.x.drawable, dc->u.x.gc,
points, j + 1, CoordModeOrigin );
}
free( points );
}
return TRUE;
}
/**********************************************************************
* X11DRV_InternalFloodFill
*
* Internal helper function for flood fill.
* (xorg,yorg) is the origin of the X image relative to the drawable.
* (x,y) is relative to the origin of the X image.
*/
static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
int x, int y,
int xOrg, int yOrg,
Pixel pixel, WORD fillType )
{
int left, right;
#define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \
(XGetPixel(image,x,y) != pixel) : \
(XGetPixel(image,x,y) == pixel))
if (!TO_FLOOD(x,y)) return;
/* Find left and right boundaries */
left = right = x;
while ((left > 0) && TO_FLOOD( left-1, y )) left--;
while ((right < image->width) && TO_FLOOD( right, y )) right++;
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
xOrg + left, yOrg + y, right-left, 1 );
/* Set the pixels of this line so we don't fill it again */
for (x = left; x < right; x++)
{
if (fillType == FLOODFILLBORDER) XPutPixel( image, x, y, pixel );
else XPutPixel( image, x, y, ~pixel );
}
/* Fill the line above */
if (--y >= 0)
{
x = left;
while (x < right)
{
while ((x < right) && !TO_FLOOD(x,y)) x++;
if (x >= right) break;
while ((x < right) && TO_FLOOD(x,y)) x++;
X11DRV_InternalFloodFill(image, dc, x-1, y,
xOrg, yOrg, pixel, fillType );
}
}
/* Fill the line below */
if ((y += 2) < image->height)
{
x = left;
while (x < right)
{
while ((x < right) && !TO_FLOOD(x,y)) x++;
if (x >= right) break;
while ((x < right) && TO_FLOOD(x,y)) x++;
X11DRV_InternalFloodFill(image, dc, x-1, y,
xOrg, yOrg, pixel, fillType );
}
}
#undef TO_FLOOD
}
/**********************************************************************
* X11DRV_DoFloodFill
*
* Main flood-fill routine.
*/
static BOOL32 X11DRV_DoFloodFill( DC *dc, RECT32 *rect, INT32 x, INT32 y,
COLORREF color, UINT32 fillType )
{
XImage *image;
if (!(image = XGetImage( display, dc->u.x.drawable,
dc->w.DCOrgX + rect->left,
dc->w.DCOrgY + rect->top,
rect->right - rect->left,
rect->bottom - rect->top,
AllPlanes, ZPixmap ))) return FALSE;
if (DC_SetupGCForBrush( dc ))
{
/* ROP mode is always GXcopy for flood-fill */
XSetFunction( display, dc->u.x.gc, GXcopy );
X11DRV_InternalFloodFill(image, dc,
XLPTODP(dc,x) - rect->left,
YLPTODP(dc,y) - rect->top,
dc->w.DCOrgX + rect->left,
dc->w.DCOrgY + rect->top,
COLOR_ToPhysical( dc, color ), fillType );
}
XDestroyImage( image );
return TRUE;
}
/**********************************************************************
* X11DRV_ExtFloodFill
*/
BOOL32
X11DRV_ExtFloodFill( DC *dc, INT32 x, INT32 y, COLORREF color,
UINT32 fillType )
{
RECT32 rect;
HDC32 hdc = dc->hSelf; /* FIXME */
dprintf_graphics( stddeb, "X11DRV_ExtFloodFill %d,%d %06lx %d\n",
x, y, color, fillType );
if (!PtVisible32( hdc, x, y )) return FALSE;
if (GetRgnBox32( dc->w.hGCClipRgn, &rect ) == ERROR) return FALSE;
return CallTo32_LargeStack( (int(*)())X11DRV_DoFloodFill, 6,
dc, &rect, x, y, color, fillType );
}

View File

@ -16,41 +16,38 @@ static BOOL32 X11DRV_DeleteDC( DC *dc );
static const DC_FUNCTIONS X11DRV_Funcs =
{
NULL, /* pArc */
X11DRV_Arc, /* pArc */
X11DRV_BitBlt, /* pBitBlt */
NULL, /* pChord */
X11DRV_Chord, /* pChord */
X11DRV_CreateDC, /* pCreateDC */
X11DRV_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pEllipse */
X11DRV_Ellipse, /* pEllipse */
NULL, /* pEscape */
NULL, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
NULL, /* pExtFloodFill */
NULL, /* pExtTextOut */
NULL, /* pFillRgn */
NULL, /* pFloodFill */
NULL, /* pFrameRgn */
X11DRV_ExtFloodFill, /* pExtFloodFill */
X11DRV_ExtTextOut, /* pExtTextOut */
X11DRV_GetPixel, /* pGetPixel */
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */
NULL, /* pInvertRgn */
NULL, /* pLineTo */
NULL, /* pMoveToEx */
X11DRV_LineTo, /* pLineTo */
X11DRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */
NULL, /* pOffsetViewportOrg (optional) */
NULL, /* pOffsetWindowOrg (optional) */
NULL, /* pPaintRgn */
X11DRV_PaintRgn, /* pPaintRgn */
X11DRV_PatBlt, /* pPatBlt */
NULL, /* pPie */
NULL, /* pPolyPolygon */
NULL, /* pPolygon */
NULL, /* pPolyline */
X11DRV_Pie, /* pPie */
X11DRV_PolyPolygon, /* pPolyPolygon */
X11DRV_Polygon, /* pPolygon */
X11DRV_Polyline, /* pPolyline */
NULL, /* pRealizePalette */
NULL, /* pRectangle */
X11DRV_Rectangle, /* pRectangle */
NULL, /* pRestoreDC */
NULL, /* pRoundRect */
X11DRV_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */
NULL, /* pScaleViewportExt (optional) */
NULL, /* pScaleWindowExt (optional) */
@ -63,7 +60,7 @@ static const DC_FUNCTIONS X11DRV_Funcs =
NULL, /* pSetDIBitsToDevice */
NULL, /* pSetMapMode (optional) */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
X11DRV_SetPixel, /* pSetPixel */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
@ -77,8 +74,7 @@ static const DC_FUNCTIONS X11DRV_Funcs =
NULL, /* pSetWindowExt (optional) */
NULL, /* pSetWindowOrg (optional) */
X11DRV_StretchBlt, /* pStretchBlt */
NULL, /* pStretchDIBits */
NULL /* pTextOut */
NULL /* pStretchDIBits */
};
static DeviceCaps X11DRV_DevCaps;

260
graphics/x11drv/text.c Normal file
View File

@ -0,0 +1,260 @@
/*
* X11 graphics driver text functions
*
* Copyright 1993,1994 Alexandre Julliard
*/
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include "windows.h"
#include "dc.h"
#include "gdi.h"
/*#include "callback.h"*/
#include "heap.h"
#include "x11drv.h"
#include "stddebug.h"
/* #define DEBUG_TEXT */
#include "debug.h"
#include "xmalloc.h"
#define SWAP_INT(a,b) { int t = a; a = b; b = t; }
extern int CLIPPING_IntersectClipRect( DC * dc, short left, short top,
short right, short bottom, UINT16 flags);
/***********************************************************************
* X11DRV_ExtTextOut
*/
BOOL32
X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
const RECT32 *lprect, LPCSTR str, UINT32 count,
const INT32 *lpDx )
{
HRGN32 hRgnClip = 0;
int dir, ascent, descent, i;
XCharStruct info;
XFontStruct *font;
RECT32 rect;
if (!DC_SetupGCForText( dc )) return TRUE;
font = dc->u.x.font.fstruct;
dprintf_text(stddeb,"ExtTextOut: hdc=%04x %d,%d '%*.*s', %d flags=%d\n",
dc->hSelf, x, y, count, count, str, count, flags);
if (lprect != NULL) dprintf_text(stddeb, "\trect=(%d,%d- %d,%d)\n",
lprect->left, lprect->top,
lprect->right, lprect->bottom );
/* Setup coordinates */
if (dc->w.textAlign & TA_UPDATECP)
{
x = dc->w.CursPosX;
y = dc->w.CursPosY;
}
if (flags & (ETO_OPAQUE | ETO_CLIPPED)) /* there's a rectangle */
{
if (!lprect) /* not always */
{
SIZE32 sz;
if (flags & ETO_CLIPPED) /* Can't clip with no rectangle */
return FALSE;
if (!X11DRV_GetTextExtentPoint( dc, str, count, &sz ))
return FALSE;
rect.left = XLPTODP( dc, x );
rect.right = XLPTODP( dc, x+sz.cx );
rect.top = YLPTODP( dc, y );
rect.bottom = YLPTODP( dc, y+sz.cy );
}
else
{
rect.left = XLPTODP( dc, lprect->left );
rect.right = XLPTODP( dc, lprect->right );
rect.top = YLPTODP( dc, lprect->top );
rect.bottom = YLPTODP( dc, lprect->bottom );
}
if (rect.right < rect.left) SWAP_INT( rect.left, rect.right );
if (rect.bottom < rect.top) SWAP_INT( rect.top, rect.bottom );
}
x = XLPTODP( dc, x );
y = YLPTODP( dc, y );
dprintf_text(stddeb,"\treal coord: x=%i, y=%i, rect=(%d,%d-%d,%d)\n",
x, y, rect.left, rect.top, rect.right, rect.bottom);
/* Draw the rectangle */
if (flags & ETO_OPAQUE)
{
XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + rect.left, dc->w.DCOrgY + rect.top,
rect.right-rect.left, rect.bottom-rect.top );
}
if (!count) return TRUE; /* Nothing more to do */
/* Compute text starting position */
XTextExtents( font, str, count, &dir, &ascent, &descent, &info );
if (lpDx) /* have explicit character cell x offsets */
{
/* sum lpDx array and add the width of last character */
info.width = XTextWidth( font, str + count - 1, 1) + dc->w.charExtra;
if (str[count-1] == (char)dc->u.x.font.metrics.tmBreakChar)
info.width += dc->w.breakExtra;
for (i = 0; i < count; i++) info.width += lpDx[i];
}
else
info.width += count*dc->w.charExtra + dc->w.breakExtra*dc->w.breakCount;
switch( dc->w.textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) )
{
case TA_LEFT:
if (dc->w.textAlign & TA_UPDATECP)
dc->w.CursPosX = XDPTOLP( dc, x + info.width );
break;
case TA_RIGHT:
x -= info.width;
if (dc->w.textAlign & TA_UPDATECP) dc->w.CursPosX = XDPTOLP( dc, x );
break;
case TA_CENTER:
x -= info.width / 2;
break;
}
switch( dc->w.textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE) )
{
case TA_TOP:
y += font->ascent;
break;
case TA_BOTTOM:
y -= font->descent;
break;
case TA_BASELINE:
break;
}
/* Set the clip region */
if (flags & ETO_CLIPPED)
{
hRgnClip = dc->w.hClipRgn;
CLIPPING_IntersectClipRect( dc, rect.left, rect.top, rect.right,
rect.bottom, CLIP_INTERSECT|CLIP_KEEPRGN );
}
/* Draw the text background if necessary */
if (dc->w.backgroundMode != TRANSPARENT)
{
/* If rectangle is opaque and clipped, do nothing */
if (!(flags & ETO_CLIPPED) || !(flags & ETO_OPAQUE))
{
/* Only draw if rectangle is not opaque or if some */
/* text is outside the rectangle */
if (!(flags & ETO_OPAQUE) ||
(x < rect.left) ||
(x + info.width >= rect.right) ||
(y-font->ascent < rect.top) ||
(y+font->descent >= rect.bottom))
{
XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x,
dc->w.DCOrgY + y - font->ascent,
info.width,
font->ascent + font->descent );
}
}
}
/* Draw the text (count > 0 verified) */
XSetForeground( display, dc->u.x.gc, dc->w.textPixel );
if (!dc->w.charExtra && !dc->w.breakExtra && !lpDx)
{
XDrawString( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y, str, count );
}
else /* Now the fun begins... */
{
XTextItem *items, *pitem;
int delta;
/* allocate max items */
pitem = items = xmalloc( count * sizeof(XTextItem) );
delta = i = 0;
while (i < count)
{
/* initialize text item with accumulated delta */
pitem->chars = (char *)str + i;
pitem->delta = delta;
pitem->nchars = 0;
pitem->font = None;
delta = 0;
/* stuff characters into the same XTextItem until new delta
* becomes non-zero */
do
{
if (lpDx) delta += lpDx[i] - XTextWidth( font, str + i, 1);
else
{
delta += dc->w.charExtra;
if (str[i] == (char)dc->u.x.font.metrics.tmBreakChar)
delta += dc->w.breakExtra;
}
pitem->nchars++;
}
while ((++i < count) && !delta);
pitem++;
}
XDrawText( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y, items, pitem - items );
free( items );
}
/* Draw underline and strike-out if needed */
if (dc->u.x.font.metrics.tmUnderlined)
{
long linePos, lineWidth;
if (!XGetFontProperty( font, XA_UNDERLINE_POSITION, &linePos ))
linePos = font->descent-1;
if (!XGetFontProperty( font, XA_UNDERLINE_THICKNESS, &lineWidth ))
lineWidth = 0;
else if (lineWidth == 1) lineWidth = 0;
XSetLineAttributes( display, dc->u.x.gc, lineWidth,
LineSolid, CapRound, JoinBevel );
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y + linePos,
dc->w.DCOrgX + x + info.width, dc->w.DCOrgY + y + linePos );
}
if (dc->u.x.font.metrics.tmStruckOut)
{
long lineAscent, lineDescent;
if (!XGetFontProperty( font, XA_STRIKEOUT_ASCENT, &lineAscent ))
lineAscent = font->ascent / 3;
if (!XGetFontProperty( font, XA_STRIKEOUT_DESCENT, &lineDescent ))
lineDescent = -lineAscent;
XSetLineAttributes( display, dc->u.x.gc, lineAscent + lineDescent,
LineSolid, CapRound, JoinBevel );
XDrawLine( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + x, dc->w.DCOrgY + y - lineAscent,
dc->w.DCOrgX + x + info.width, dc->w.DCOrgY + y - lineAscent );
}
if (flags & ETO_CLIPPED) SelectClipRgn32( dc->hSelf, hRgnClip );
return TRUE;
}

View File

@ -81,9 +81,6 @@ all: checkbuild $(MODULE).o
$(SPEC_FILES): $(BUILD)
$(BUILD) checkbuild:
cd $(TOPOBJDIR)/tools; $(SUBMAKE) build
callfrom16.s: $(SPEC_FILES)
$(BUILD) -o $@ -callfrom16 `cat $(SPEC_FILES) | grep CallFrom16_ | sed 's/.*CallFrom16_\(.*\)/\1/' | sort | uniq`

View File

@ -198,7 +198,7 @@ base 1
0193 stub SetThreadToken
0194 stub SetTokenInformation
0195 stub StartServiceA
0196 stub StartServiceCtrlDispatcherA
0197 stub StartServiceCtrlDispatcherW
0196 stdcall StartServiceCtrlDispatcherA(ptr) StartServiceCtrlDispatcher32A
0197 stdcall StartServiceCtrlDispatcherW(ptr) StartServiceCtrlDispatcher32W
0198 stub StartServiceW
0199 stub UnlockServiceDatabase

View File

@ -3,9 +3,9 @@ name crtdll
type win32
base 1
001 cdecl ??2@YAPAXI@Z(long) CRTDLL_malloc
002 cdecl ??3@YAXPAX@Z(long) CRTDLL_free
003 stub ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z
001 cdecl ??2@YAPAXI@Z(long) CRTDLL_new
002 cdecl ??3@YAXPAX@Z(long) CRTDLL_delete
003 cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) CRTDLL_set_new_handler
004 stub _CIacos
005 stub _CIasin
006 stub _CIatan

View File

@ -61,8 +61,8 @@ base 1
0054 stdcall CreatePatternBrush(long) CreatePatternBrush32
0055 stdcall CreatePen(long long long) CreatePen32
0056 stdcall CreatePenIndirect(ptr) CreatePenIndirect32
0057 stub CreatePolyPolygonRgn
0058 stub CreatePolygonRgn
0057 stdcall CreatePolyPolygonRgn(ptr ptr long long) CreatePolyPolygonRgn32
0058 stdcall CreatePolygonRgn(ptr long long) CreatePolygonRgn32
0059 stdcall CreateRectRgn(long long long long) CreateRectRgn32
0060 stdcall CreateRectRgnIndirect(ptr) CreateRectRgnIndirect32
0061 stdcall CreateRoundRectRgn(long long long long long long)
@ -276,7 +276,7 @@ base 1
0268 stub PolyBezier
0269 stub PolyBezierTo
0270 stub PolyDraw
0271 stub PolyPolygon
0271 stdcall PolyPolygon(long ptr ptr long) PolyPolygon32
0272 stub PolyPolyline
0273 stub PolyTextOutA
0274 stub PolyTextOutW

View File

@ -204,7 +204,7 @@ type win16
204 stub SwapRecording
205 stub CVWBreak
206 pascal16 AllocSelectorArray(word) AllocSelectorArray
207 return IsDBCSLeadByte 2 0
207 pascal16 IsDBCSLeadByte(word) IsDBCSLeadByte16
216 pascal RegEnumKey(long long ptr long) RegEnumKey16
217 pascal RegOpenKey(long ptr ptr) RegOpenKey16
218 pascal RegCreateKey(long ptr ptr) RegCreateKey16

View File

@ -39,7 +39,7 @@ base 1
0034 stub ContinueDebugEvent
0035 stub ConvertDefaultLocale
0036 stdcall CopyFileA(ptr ptr long) CopyFile32A
0037 stub CopyFileW
0037 stdcall CopyFileW(ptr ptr long) CopyFile32W
0038 stub CreateConsoleScreenBuffer
0039 stdcall CreateDirectoryA(ptr ptr) CreateDirectory32A
0040 stdcall CreateDirectoryExA(ptr ptr ptr) CreateDirectoryEx32A
@ -143,8 +143,8 @@ base 1
0138 stdcall FormatMessageA() WIN32_FormatMessage32A
0139 stdcall FormatMessageW() WIN32_FormatMessage32W
0140 stub FreeConsole
0141 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStringsA
0142 stdcall FreeEnvironmentStringsW(ptr) FreeEnvironmentStringsW
0141 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStrings32A
0142 stdcall FreeEnvironmentStringsW(ptr) FreeEnvironmentStrings32W
0143 stdcall FreeLibrary(long) FreeLibrary32
0144 stub FreeLibraryAndExitThread
0145 stdcall FreeResource(long) FreeResource32
@ -212,9 +212,9 @@ base 1
0207 stdcall GetDiskFreeSpaceW(ptr ptr ptr ptr ptr) GetDiskFreeSpace32W
0208 stdcall GetDriveTypeA(ptr) GetDriveType32A
0209 stdcall GetDriveTypeW(ptr) GetDriveType32W
0210 stdcall GetEnvironmentStrings() GetEnvironmentStrings
0211 stub GetEnvironmentStringsA
0212 stdcall GetEnvironmentStringsW() GetEnvironmentStringsW
0210 stdcall GetEnvironmentStrings() GetEnvironmentStrings32A
0211 stdcall GetEnvironmentStringsA() GetEnvironmentStrings32A
0212 stdcall GetEnvironmentStringsW() GetEnvironmentStrings32W
0213 stdcall GetEnvironmentVariableA(ptr ptr long) GetEnvironmentVariable32A
0214 stdcall GetEnvironmentVariableW(ptr ptr long) GetEnvironmentVariable32W
0215 stub GetExitCodeProcess
@ -252,7 +252,7 @@ base 1
0247 stub GetNumberOfConsoleMouseButtons
0248 stdcall GetOEMCP() GetOEMCP
0249 stub GetOverlappedResult
0250 stub GetPriorityClass
0250 stdcall GetPriorityClass(long) GetPriorityClass
0251 stdcall GetPrivateProfileIntA(ptr ptr long ptr) GetPrivateProfileInt32A
0252 stdcall GetPrivateProfileIntW(ptr ptr long ptr) GetPrivateProfileInt32W
0253 stub GetPrivateProfileSectionA
@ -296,9 +296,9 @@ base 1
0291 stdcall GetTempFileNameW(ptr ptr long ptr) GetTempFileName32W
0292 stdcall GetTempPathA(long ptr) GetTempPath32A
0293 stdcall GetTempPathW(long ptr) GetTempPath32W
0294 stdcall GetThreadContext(long ptr) GetThreadContext
0295 stub GetThreadLocale
0296 stub GetThreadPriority
0294 stdcall GetThreadContext(long ptr) GetThreadContext
0295 stdcall GetThreadLocale() GetThreadLocale
0296 stdcall GetThreadPriority(long) GetThreadPriority
0297 stub GetThreadSelectorEntry
0298 stub GetThreadTimes
0299 stdcall GetTickCount() GetTickCount
@ -360,8 +360,8 @@ base 1
0355 stub IsBadStringPtrA
0356 stub IsBadStringPtrW
0357 stdcall IsBadWritePtr(ptr long) WIN32_IsBadWritePtr
0358 return IsDBCSLeadByte 4 0
0359 stub IsDBCSLeadByteEx
0358 stdcall IsDBCSLeadByte(long) IsDBCSLeadByte32
0359 stdcall IsDBCSLeadByteEx(long long) IsDBCSLeadByteEx
0360 stub IsValidCodePage
0361 stdcall IsValidLocale(long long) IsValidLocale
0362 stub LCMapStringA
@ -415,8 +415,8 @@ base 1
0410 stub PrepareTape
0411 stub PulseEvent
0412 stub PurgeComm
0413 stub QueryDosDeviceA
0414 stub QueryDosDeviceW
0413 stdcall QueryDosDeviceA(ptr ptr long) QueryDosDevice32A
0414 stdcall QueryDosDeviceW(ptr ptr long) QueryDosDevice32W
0415 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter
0416 stub QueryPerformanceFrequency
0417 stub QueryWin31IniFilesMappedToRegistry
@ -505,20 +505,20 @@ base 1
0500 stub SetLocaleInfoW
0501 stub SetMailslotInfo
0502 stub SetNamedPipeHandleState
0503 stub SetPriorityClass
0503 stdcall SetPriorityClass(long long) SetPriorityClass
0504 stub SetProcessShutdownParameters
0505 stub SetProcessWorkingSetSize
0506 stub SetStdHandle
0507 stdcall SetSystemTime(ptr) SetSystemTime
0506 stdcall SetStdHandle(long long) SetStdHandle
0507 stdcall SetSystemTime(ptr) SetSystemTime
0508 stub SetSystemTimeAdjustment
0509 stub SetTapeParameters
0510 stub SetTapePosition
0511 stdcall SetThreadAffinityMask(long long) SetThreadAffinityMask
0512 stub SetThreadContext
0513 stub SetThreadLocale
0514 stub SetThreadPriority
0515 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation
0516 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter
0514 stdcall SetThreadPriority(long long) SetThreadPriority
0515 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation
0516 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter
0517 stub SetVDMCurrentDirectories
0518 stub SetVolumeLabelA
0519 stub SetVolumeLabelW

View File

@ -267,7 +267,7 @@ base 0
263 stub RtlAddAuditAccessAce
264 stub RtlAdjustPrivilege
265 stub RtlAllocateAndInitializeSid
266 stub RtlAllocateHeap
266 stdcall RtlAllocateHeap(long long long) HeapAlloc
267 stub RtlAnsiCharToUnicodeChar
268 stub RtlAnsiStringToUnicodeSize
269 stub RtlAnsiStringToUnicodeString
@ -310,7 +310,7 @@ base 0
306 stub RtlCreateAcl
307 stub RtlCreateAndSetSD
308 stub RtlCreateEnvironment
309 stub RtlCreateHeap
309 stdcall RtlCreateHeap(long long long) HeapCreate
310 stub RtlCreateProcessParameters
311 stub RtlCreateQueryDebugBuffer
312 stub RtlCreateRegistryKey
@ -375,7 +375,7 @@ base 0
371 stub RtlFormatCurrentUserKeyPath
372 stub RtlFormatMessage
373 stub RtlFreeAnsiString
374 stub RtlFreeHeap
374 stdcall RtlFreeHeap(long long long) HeapFree
375 stub RtlFreeOemString
376 stub RtlFreeSid
377 stub RtlFreeUnicodeString
@ -494,7 +494,7 @@ base 0
490 stub RtlSetTimeZoneInformation
491 stub RtlSetUserFlagsHeap
492 stub RtlSetUserValueHeap
493 stub RtlSizeHeap
493 stdcall RtlSizeHeap(long long long) HeapSize
494 stub RtlSplay
495 stub RtlStartRXact
496 stdcall RtlSubAuthorityCountSid(ptr) RtlSubAuthorityCountSid
@ -880,7 +880,7 @@ base 0
876 stub _strupr
877 stub _ultoa
878 stub _vsnprintf
879 stub _wcsicmp
879 stdcall _wcsicmp(ptr ptr) lstrcmpi32W
880 stub _wcslwr
881 stub _wcsnicmp
882 stub _wcsupr

View File

@ -186,9 +186,8 @@ void RELAY_Unimplemented32( int nb_args, void *relay_addr,
* 'stack' points to the called function address on the 32-bit stack.
* Stack layout:
* ... ...
* (stack+12) arg2
* (stack+8) arg1
* (stack+4) 16-bit ds
* (stack+8) arg2
* (stack+4) arg1
* (stack) func to call
*/
void RELAY_DebugCallTo16( int* stack, int nbargs )
@ -196,8 +195,8 @@ void RELAY_DebugCallTo16( int* stack, int nbargs )
if (!debugging_relay) return;
printf( "CallTo16(func=%04x:%04x,ds=%04x",
HIWORD(stack[0]), LOWORD(stack[0]), LOWORD(stack[1]) );
stack += 2;
HIWORD(stack[0]), LOWORD(stack[0]), CURRENT_DS );
stack++;
while (nbargs--) printf( ",0x%04x", *stack++ );
printf( ")\n" );
}

View File

@ -148,20 +148,20 @@ heap 65520
146 pascal16 GetClipboardFormatName(word ptr s_word) GetClipboardFormatName
147 pascal16 SetClipboardViewer(word) SetClipboardViewer
148 pascal16 GetClipboardViewer() GetClipboardViewer
149 pascal16 ChangeClipboardChain(word ptr) ChangeClipboardChain
149 pascal16 ChangeClipboardChain(word ptr) ChangeClipboardChain16
150 pascal16 LoadMenu(word segptr) LoadMenu16
151 pascal16 CreateMenu() CreateMenu
152 pascal16 DestroyMenu(word) DestroyMenu
151 pascal16 CreateMenu() CreateMenu16
152 pascal16 DestroyMenu(word) DestroyMenu16
153 pascal16 ChangeMenu(word word segptr word word) ChangeMenu16
154 pascal16 CheckMenuItem(word word word) CheckMenuItem
155 pascal16 EnableMenuItem(word word word) EnableMenuItem
156 pascal16 GetSystemMenu(word word) GetSystemMenu
157 pascal16 GetMenu(word) GetMenu
158 pascal16 SetMenu(word word) SetMenu
159 pascal16 GetSubMenu(word word) GetSubMenu
160 pascal16 DrawMenuBar(word) DrawMenuBar
161 pascal16 GetMenuString(word word ptr s_word word) GetMenuString
162 pascal16 HiliteMenuItem(word word word word) HiliteMenuItem
154 pascal16 CheckMenuItem(word word word) CheckMenuItem16
155 pascal16 EnableMenuItem(word word word) EnableMenuItem16
156 pascal16 GetSystemMenu(word word) GetSystemMenu16
157 pascal16 GetMenu(word) GetMenu16
158 pascal16 SetMenu(word word) SetMenu16
159 pascal16 GetSubMenu(word word) GetSubMenu16
160 pascal16 DrawMenuBar(word) DrawMenuBar16
161 pascal16 GetMenuString(word word ptr s_word word) GetMenuString16
162 pascal16 HiliteMenuItem(word word word word) HiliteMenuItem16
163 pascal16 CreateCaret(word word word word) CreateCaret
164 pascal16 DestroyCaret() DestroyCaret
165 pascal16 SetCaretPos(word word) SetCaretPos
@ -252,7 +252,7 @@ heap 65520
247 pascal16 GetCursor() GetCursor
248 pascal16 GetOpenClipboardWindow() GetOpenClipboardWindow
249 pascal16 GetAsyncKeyState(word) GetAsyncKeyState
250 pascal16 GetMenuState(word word word) GetMenuState
250 pascal16 GetMenuState(word word word) GetMenuState16
251 pascal SendDriverMessage(word word long long) SendDriverMessage
252 pascal16 OpenDriver(ptr ptr long) OpenDriver
253 pascal CloseDriver(word long long) CloseDriver
@ -266,8 +266,8 @@ heap 65520
DeferWindowPos
261 pascal16 EndDeferWindowPos(word) EndDeferWindowPos
262 pascal16 GetWindow(word word) GetWindow
263 pascal16 GetMenuItemCount(word) GetMenuItemCount
264 pascal16 GetMenuItemID(word word) GetMenuItemID
263 pascal16 GetMenuItemCount(word) GetMenuItemCount16
264 pascal16 GetMenuItemID(word word) GetMenuItemID16
265 pascal16 ShowOwnedPopups(word word) ShowOwnedPopups
266 pascal16 SetMessageQueue(word) SetMessageQueue
267 pascal16 ShowScrollBar(word word word) ShowScrollBar16
@ -283,7 +283,7 @@ heap 65520
277 pascal16 GetDlgCtrlID(word) GetDlgCtrlID
278 pascal16 GetDesktopHwnd() GetDesktopHwnd
279 stub OldSetDeskPattern
280 stub SetSystemMenu
280 pascal16 SetSystemMenu(word word) SetSystemMenu16
281 pascal16 GetSysColorBrush(word) GetSysColorBrush16
282 pascal16 SelectPalette(word word word) SelectPalette
283 pascal16 RealizePalette(word) RealizePalette
@ -324,7 +324,7 @@ heap 65520
343 stub GetFilePortName
356 stub LoadDIBCursorHandler
357 stub LoadDIBIconHandler
358 pascal16 IsMenu(word) IsMenu
358 pascal16 IsMenu(word) IsMenu16
359 pascal16 GetDCEx(word word long) GetDCEx16
362 pascal16 DCHook(word word long long) DCHook
364 stub LookupIconIDFromDirectoryEx
@ -364,13 +364,13 @@ heap 65520
409 stub InitThreadInput
410 pascal16 InsertMenu(word word word word segptr) InsertMenu16
411 pascal16 AppendMenu(word word word segptr) AppendMenu16
412 pascal16 RemoveMenu(word word word) RemoveMenu
413 pascal16 DeleteMenu(word word word) DeleteMenu
412 pascal16 RemoveMenu(word word word) RemoveMenu16
413 pascal16 DeleteMenu(word word word) DeleteMenu16
414 pascal16 ModifyMenu(word word word word segptr) ModifyMenu16
415 pascal16 CreatePopupMenu() CreatePopupMenu
415 pascal16 CreatePopupMenu() CreatePopupMenu16
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
418 pascal16 SetMenuItemBitmaps(word word word word word) SetMenuItemBitmaps16
420 pascal16 wsprintf() WIN16_wsprintf16
421 pascal16 wvsprintf(ptr ptr ptr) wvsprintf16
422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16
@ -379,14 +379,14 @@ heap 65520
428 stub TileWindows
429 stub CascadeWindows
430 pascal16 lstrcmp(ptr ptr) lstrcmp16
431 pascal AnsiUpper(segptr) WIN16_AnsiUpper
432 pascal AnsiLower(segptr) WIN16_AnsiLower
431 pascal AnsiUpper(segptr) AnsiUpper16
432 pascal AnsiLower(segptr) AnsiLower16
433 pascal16 IsCharAlpha(byte) IsCharAlpha16
434 pascal16 IsCharAlphanumeric(byte) IsCharAlphanumeric16
435 pascal16 IsCharUpper(byte) IsCharUpper16
436 pascal16 IsCharLower(byte) IsCharLower16
437 pascal16 AnsiUpperBuff(ptr word) AnsiUpperBuff
438 pascal16 AnsiLowerBuff(ptr word) AnsiLowerBuff
437 pascal16 AnsiUpperBuff(ptr word) AnsiUpperBuff16
438 pascal16 AnsiLowerBuff(ptr word) AnsiLowerBuff16
441 stub InsertMenuItem
443 stub GetMenuItemInfo
445 pascal DefFrameProc(word word word word long) DefFrameProc16
@ -413,8 +413,8 @@ heap 65520
466 pascal16 DrawFocusRect(word ptr) DrawFocusRect16
470 stub StringFunc
471 pascal16 lstrcmpi(ptr ptr) lstrcmpi16
472 pascal AnsiNext(segptr) AnsiNext
473 pascal AnsiPrev(segptr segptr) AnsiPrev
472 pascal AnsiNext(segptr) AnsiNext16
473 pascal AnsiPrev(segptr segptr) AnsiPrev16
475 pascal16 SetScrollInfo(word s_word ptr word) SetScrollInfo16
476 pascal16 GetScrollInfo(word s_word ptr) GetScrollInfo16
477 stub GetKeyboardLayoutName

View File

@ -23,7 +23,7 @@ base 1
0018 stdcall CallWindowProcW(ptr long long long long) CallWindowProc32W
0019 stub CascadeChildWindows
0020 stub CascadeWindows
0021 stub ChangeClipboardChain
0021 stdcall ChangeClipboardChain(long long) ChangeClipboardChain32
0022 stdcall ChangeMenuA(long long ptr long long) ChangeMenu32A
0023 stdcall ChangeMenuW(long long ptr long long) ChangeMenu32W
0024 stdcall CharLowerA(ptr) CharLower32A
@ -47,7 +47,7 @@ base 1
0042 stdcall CharUpperBuffW(ptr long) CharUpperBuff32W
0043 stdcall CharUpperW(ptr) CharUpper32W
0044 stdcall CheckDlgButton(long long long) CheckDlgButton
0045 stdcall CheckMenuItem(long long long) CheckMenuItem
0045 stdcall CheckMenuItem(long long long) CheckMenuItem32
0046 stub CheckMenuRadioItem
0047 stdcall CheckRadioButton(long long long long) CheckRadioButton
0048 stdcall ChildWindowFromPoint(long long long) ChildWindowFromPoint32
@ -82,8 +82,8 @@ base 1
0077 stub CreateIconIndirect
0078 stub CreateMDIWindowA
0079 stub CreateMDIWindowW
0080 stdcall CreateMenu() CreateMenu
0081 stdcall CreatePopupMenu() CreatePopupMenu
0080 stdcall CreateMenu() CreateMenu32
0081 stdcall CreatePopupMenu() CreatePopupMenu32
0082 stdcall CreateWindowExA(long ptr ptr long long long long long
long long long ptr) CreateWindowEx32A
0083 stdcall CreateWindowExW(long ptr ptr long long long long long
@ -132,12 +132,12 @@ base 1
0125 stdcall DefWindowProcA(long long long long) DefWindowProc32A
0126 stdcall DefWindowProcW(long long long long) DefWindowProc32W
0127 stdcall DeferWindowPos(long long long long long long long long) DeferWindowPos
0128 stdcall DeleteMenu(long long long) DeleteMenu
0128 stdcall DeleteMenu(long long long) DeleteMenu32
0129 stub DestroyAcceleratorTable
0130 stdcall DestroyCaret() DestroyCaret
0131 stub DestroyCursor
0132 stub DestroyIcon
0133 stdcall DestroyMenu(long) DestroyMenu
0133 stdcall DestroyMenu(long) DestroyMenu32
0134 stdcall DestroyWindow(long) DestroyWindow
0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) DialogBoxIndirectParam32A
0136 stub DialogBoxIndirectParamAorW
@ -164,7 +164,7 @@ base 1
0157 stdcall DrawFrameControl(long ptr long long) DrawFrameControl32
0158 stdcall DrawIcon(long long long long) DrawIcon
0159 stub DrawIconEx
0160 stdcall DrawMenuBar(long) DrawMenuBar
0160 stdcall DrawMenuBar(long) DrawMenuBar32
0161 stub DrawStateA
0162 stub DrawStateW
0163 stdcall DrawTextA(long ptr long ptr long) DrawText32A
@ -172,13 +172,13 @@ base 1
0165 stub DrawTextExW
0166 stdcall DrawTextW(long ptr long ptr long) DrawText32W
0167 stub EditWndProc
0168 stdcall EmptyClipboard() EmptyClipboard
0169 stdcall EnableMenuItem(long long long) EnableMenuItem
0168 stdcall EmptyClipboard() EmptyClipboard
0169 stdcall EnableMenuItem(long long long) EnableMenuItem32
0170 stdcall EnableScrollBar(long long long) EnableScrollBar32
0171 stdcall EnableWindow(long long) EnableWindow
0172 stdcall EndDeferWindowPos(long) EndDeferWindowPos
0173 stdcall EndDialog(long long) EndDialog
0174 stub EndMenu
0174 stdcall EndMenu() EndMenu
0175 stdcall EndPaint(long ptr) EndPaint32
0176 stub EndTask
0177 stdcall EnumChildWindows(long ptr long) THUNK_EnumChildWindows32
@ -260,19 +260,19 @@ base 1
0253 stub GetKeyboardState
0254 stub GetKeyboardType
0255 stub GetLastActivePopup
0256 stdcall GetMenu(long) GetMenu
0257 stub GetMenuCheckMarkDimensions
0256 stdcall GetMenu(long) GetMenu32
0257 stdcall GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions
0258 stub GetMenuContextHelpId
0259 stub GetMenuDefaultItem
0260 stub GetMenuIndex
0261 stdcall GetMenuItemCount(long) GetMenuItemCount
0262 stdcall GetMenuItemID(long long) GetMenuItemID
0261 stdcall GetMenuItemCount(long) GetMenuItemCount32
0262 stdcall GetMenuItemID(long long) GetMenuItemID32
0263 stub GetMenuItemInfoA
0264 stub GetMenuItemInfoW
0265 stub GetMenuItemRect
0266 stdcall GetMenuState(long long long) GetMenuState
0267 stdcall GetMenuStringA(long long ptr long long) GetMenuString
0268 stub GetMenuStringW
0266 stdcall GetMenuState(long long long) GetMenuState32
0267 stdcall GetMenuStringA(long long ptr long long) GetMenuString32A
0268 stdcall GetMenuStringW(long long ptr long long) GetMenuString32W
0269 stdcall GetMessageA(ptr long long long) USER32_GetMessageA
0270 stub GetMessageExtraInfo
0271 stub GetMessagePos
@ -291,10 +291,10 @@ base 1
0284 stdcall GetScrollPos(long long) GetScrollPos32
0285 stdcall GetScrollRange(long long ptr ptr) GetScrollRange32
0286 return GetShellWindow 0 0
0287 stdcall GetSubMenu(long long) GetSubMenu
0287 stdcall GetSubMenu(long long) GetSubMenu32
0288 stdcall GetSysColor(long) GetSysColor
0289 stdcall GetSysColorBrush(long) GetSysColorBrush32
0290 stdcall GetSystemMenu(long long) GetSystemMenu
0290 stdcall GetSystemMenu(long long) GetSystemMenu32
0291 stdcall GetSystemMetrics(long) GetSystemMetrics
0292 stdcall GetTabbedTextExtentA(long ptr long long ptr) GetTabbedTextExtent
0293 stub GetTabbedTextExtentW
@ -321,7 +321,7 @@ base 1
0314 stub GrayStringA
0315 stub GrayStringW
0316 stdcall HideCaret(long) HideCaret
0317 stub HiliteMenuItem
0317 stdcall HiliteMenuItem(long long long long) HiliteMenuItem32
0318 stub ImpersonateDdeClientWindow
0319 stub InSendMessage
0320 stdcall InflateRect(ptr long long) InflateRect32
@ -349,7 +349,7 @@ base 1
0342 stub IsDialogMessageW
0343 stdcall IsDlgButtonChecked(long long) IsDlgButtonChecked
0344 stdcall IsIconic(long) IsIconic
0345 stdcall IsMenu(long) IsMenu
0345 stdcall IsMenu(long) IsMenu32
0346 stdcall IsRectEmpty(ptr) IsRectEmpty32
0347 stdcall IsWindow(long) IsWindow
0348 stdcall IsWindowEnabled(long) IsWindowEnabled
@ -444,7 +444,7 @@ base 1
0437 stdcall RegisterWindowMessageW(ptr) RegisterWindowMessage32W
0438 stdcall ReleaseCapture() ReleaseCapture
0439 stdcall ReleaseDC(long long) ReleaseDC32
0440 stdcall RemoveMenu(long long long) RemoveMenu
0440 stdcall RemoveMenu(long long long) RemoveMenu32
0441 stdcall RemovePropA(long ptr) RemoveProp32A
0442 stdcall RemovePropW(long ptr) RemoveProp32W
0443 stub ReplyMessage
@ -490,10 +490,10 @@ base 1
0483 stub SetKeyboardState
0484 stdcall SetLastErrorEx(long long) SetLastErrorEx
0485 stub SetLogonNotifyWindow
0486 stdcall SetMenu(long long) SetMenu
0486 stdcall SetMenu(long long) SetMenu32
0487 stub SetMenuContextHelpId
0488 stub SetMenuDefaultItem
0489 stub SetMenuItemBitmaps
0489 stdcall SetMenuItemBitmaps(long long long long long) SetMenuItemBitmaps32
0490 stub SetMenuItemInfoA
0491 stub SetMenuItemInfoW
0492 stub SetMessageExtraInfo
@ -511,7 +511,7 @@ base 1
0504 stub SetSysColors
0505 stub SetSysColorsTemp
0506 stub SetSystemCursor
0507 stub SetSystemMenu
0507 stdcall SetSystemMenu(long long) SetSystemMenu32
0508 stdcall SetSystemTimer(long long long ptr) SetSystemTimer32
0509 stub SetThreadDesktop
0510 stdcall SetTimer(long long long ptr) SetTimer32

View File

@ -5,9 +5,6 @@ type win16
2 pascal StaticWndProc(word word word long) StaticWndProc
3 pascal ScrollBarWndProc(word word word long) ScrollBarWndProc
5 pascal ComboBoxWndProc(word word word long) ComboBoxWndProc
6 pascal EditWndProc(word word word long) EditWndProc
7 pascal PopupMenuWndProc(word word word long) PopupMenuWndProc
9 pascal DefDlgProc(word word word long) DefDlgProc16
10 pascal MDIClientWndProc(word word word long) MDIClientWndProc
14 pascal FileOpenDlgProc(word word word long) FileOpenDlgProc
15 pascal FileSaveDlgProc(word word word long) FileSaveDlgProc

View File

@ -5,6 +5,9 @@
*
*/
#ifndef __WINE_ACCEL_H
#define __WINE_ACCEL_H
#include "windows.h"
typedef struct {
@ -23,3 +26,5 @@ typedef struct {
#define CONTROL_ACCEL 0x08
#define ALT_ACCEL 0x10
#define SYSTEM_ACCEL 0x80
#endif /* __WINE_ACCEL_H */

View File

@ -4,8 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#ifndef ATOM_H
#define ATOM_H
#ifndef __WINE_ATOM_H
#define __WINE_ATOM_H
#include "windows.h"
@ -25,4 +25,4 @@ typedef struct
HANDLE16 entries[1];
} ATOMTABLE;
#endif /* ATOM_H */
#endif /* __WINE_ATOM_H */

View File

@ -4,8 +4,8 @@
* Copyright 1994 Alexandre Julliard
*/
#ifndef BUTTON_H
#define BUTTON_H
#ifndef __WINE_BUTTON_H
#define __WINE_BUTTON_H
#include "windows.h"
@ -31,4 +31,4 @@ typedef struct
extern LRESULT ButtonWndProc( HWND32 hWnd, UINT32 uMsg,
WPARAM32 wParam, LPARAM lParam );
#endif /* BUTTON_H */
#endif /* __WINE_BUTTON_H */

View File

@ -4,8 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#ifndef CLASS_H
#define CLASS_H
#ifndef __WINE_CLASS_H
#define __WINE_CLASS_H
#include "windows.h"
#include "winproc.h"
@ -40,4 +40,4 @@ extern void CLASS_WalkClasses(void);
extern void CLASS_FreeModuleClasses( HMODULE16 hModule );
extern CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE16 hinstance );
#endif /* CLASS_H */
#endif /* __WINE_CLASS_H */

View File

@ -1,5 +1,5 @@
#ifndef COMM_H
#define COMM_H
#ifndef __WINE_COMM_H
#define __WINE_COMM_H
#define MAX_PORTS 16
@ -14,4 +14,4 @@ struct DosDeviceStruct {
extern void COMM_Init(void);
#endif /* COMM_H */
#endif /* __WINE_COMM_H */

View File

@ -1,5 +1,5 @@
#ifndef _WINE_CRTDLL_H
#define _WINE_CRTDLL_H
#ifndef __WINE_CRTDLL_H
#define __WINE_CRTDLL_H
#define CRTDLL_LC_ALL 0
#define CRTDLL_LC_COLLATE 1

View File

@ -4,8 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#ifndef DCE_H
#define DCE_H
#ifndef __WINE_DCE_H
#define __WINE_DCE_H
#include "windows.h"
#include "win.h"
@ -50,4 +50,4 @@ extern DCE* DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type );
extern void DCE_FreeDCE( DCE *dce );
extern INT16 DCE_ExcludeRgn( HDC32, WND*, HRGN32 );
#endif /* DCE_H */
#endif /* __WINE_DCE_H */

View File

@ -14,17 +14,58 @@
#define STEP_FLAG 0x100 /* single step flag */
#define SYM_FUNC 0x0
#define SYM_DATA 0x1
#define SYM_WIN32 0x2
#define SYM_WINE 0x4
#define SYM_INVALID 0x8
#define SYM_TRAMPOLINE 0x10
#define SYM_STEP_THROUGH 0x20
enum debug_type {BASIC, CONST, POINTER, ARRAY, STRUCT, ENUM, TYPEDEF, FUNC, BITFIELD};
/*
* Return values for DEBUG_CheckLinenoStatus. Used to determine
* what to do when the 'step' command is given.
*/
#define FUNC_HAS_NO_LINES (0)
#define NOT_ON_LINENUMBER (1)
#define AT_LINENUMBER (2)
#define FUNC_IS_TRAMPOLINE (3)
/*
* For constants generated by the parser, we use this datatype
*/
extern struct datatype * DEBUG_TypeInt;
extern struct datatype * DEBUG_TypeIntConst;
extern struct datatype * DEBUG_TypeUSInt;
extern struct datatype * DEBUG_TypeString;
typedef struct
{
struct datatype * type;
DWORD seg; /* 0xffffffff means current default segment (cs or ds) */
DWORD off;
} DBG_ADDR;
struct list_id
{
char * sourcefile;
int line;
};
struct wine_lines {
unsigned long line_number;
DBG_ADDR pc_offset;
};
struct symbol_info
{
struct name_hash * sym;
struct list_id list;
};
typedef struct wine_lines WineLineNo;
/*
@ -34,30 +75,15 @@ typedef struct wine_lines WineLineNo;
*/
struct wine_locals {
unsigned int regno:8; /* For register symbols */
unsigned int offset:24; /* offset from esp/ebp to symbol */
signed int offset:24; /* offset from esp/ebp to symbol */
unsigned int pc_start; /* For RBRAC/LBRAC */
unsigned int pc_end; /* For RBRAC/LBRAC */
char * name; /* Name of symbol */
struct datatype * type; /* Datatype of symbol */
};
typedef struct wine_locals WineLocals;
struct name_hash
{
struct name_hash * next;
char * name;
char * sourcefile;
int n_locals;
int locals_alloc;
WineLocals * local_vars;
int n_lines;
int lines_alloc;
WineLineNo * linetab;
DBG_ADDR addr;
};
#define DBG_FIX_ADDR_SEG(addr,default) \
{ if ((addr)->seg == 0xffffffff) (addr)->seg = (default); \
@ -97,8 +123,16 @@ enum debug_regs
enum exec_mode
{
EXEC_CONT, /* Continuous execution */
EXEC_STEP_OVER, /* Stepping over a call */
EXEC_STEP_INSTR /* Single-stepping an instruction */
EXEC_STEP_OVER, /* Stepping over a call to next source line */
EXEC_STEP_INSTR, /* Step to next source line, stepping in if needed */
EXEC_STEPI_OVER, /* Stepping over a call */
EXEC_STEPI_INSTR, /* Single-stepping an instruction */
EXEC_FINISH, /* Step until we exit current frame */
EXEC_STEP_OVER_TRAMPOLINE /* Step over trampoline. Requires that
* we dig the real return value off the stack
* and set breakpoint there - not at the
* instr just after the call.
*/
};
extern CONTEXT DEBUG_context; /* debugger/registers.c */
@ -112,40 +146,91 @@ extern void DEBUG_DelBreakpoint( int num );
extern void DEBUG_EnableBreakpoint( int num, BOOL32 enable );
extern void DEBUG_InfoBreakpoints(void);
extern BOOL32 DEBUG_HandleTrap(void);
extern BOOL32 DEBUG_ShouldContinue( enum exec_mode mode );
extern void DEBUG_RestartExecution( enum exec_mode mode, int instr_len );
extern BOOL32 DEBUG_ShouldContinue( enum exec_mode mode, int * count );
extern enum exec_mode DEBUG_RestartExecution( enum exec_mode mode, int count );
extern BOOL32 DEBUG_IsFctReturn(void);
/* debugger/db_disasm.c */
extern void DEBUG_Disasm( DBG_ADDR *addr );
extern void DEBUG_Disasm( DBG_ADDR *addr, int display );
/* debugger/expr.c */
extern void DEBUG_FreeExprMem(void);
struct expr * DEBUG_RegisterExpr(enum debug_regs);
struct expr * DEBUG_SymbolExpr(const char * name);
struct expr * DEBUG_ConstExpr(int val);
struct expr * DEBUG_StringExpr(const char * str);
struct expr * DEBUG_SegAddr(struct expr *, struct expr *);
struct expr * DEBUG_USConstExpr(unsigned int val);
struct expr * DEBUG_BinopExpr(int oper, struct expr *, struct expr *);
struct expr * DEBUG_UnopExpr(int oper, struct expr *);
struct expr * DEBUG_StructPExpr(struct expr *, const char * element);
struct expr * DEBUG_StructExpr(struct expr *, const char * element);
struct expr * DEBUG_ArrayExpr(struct expr *, struct expr * index);
struct expr * DEBUG_CallExpr(const char *, int nargs, ...);
extern int DEBUG_ExprValue(DBG_ADDR *, unsigned int *);
DBG_ADDR DEBUG_EvalExpr(struct expr *);
extern int DEBUG_AddDisplay(struct expr * exp);
extern int DEBUG_DelDisplay(int displaynum);
extern struct expr * DEBUG_CloneExpr(struct expr * exp);
extern int DEBUG_FreeExpr(struct expr * exp);
extern int DEBUG_DisplayExpr(struct expr * exp);
/* more debugger/break.c */
extern int DEBUG_AddBPCondition(int bpnum, struct expr * exp);
/* debugger/display.c */
extern int DEBUG_DoDisplay(void);
extern int DEBUG_AddDisplay(struct expr * exp);
extern int DEBUG_DoDisplay(void);
extern int DEBUG_DelDisplay(int displaynum);
extern int DEBUG_InfoDisplay(void);
/* debugger/hash.c */
extern struct name_hash * DEBUG_AddSymbol( const char *name,
const DBG_ADDR *addr,
const char * sourcefile,
int flags);
extern struct name_hash * DEBUG_AddInvSymbol( const char *name,
const DBG_ADDR *addr,
const char * sourcefile);
extern BOOL32 DEBUG_GetSymbolValue( const char * name, const int lineno,
DBG_ADDR *addr );
DBG_ADDR *addr, int );
extern BOOL32 DEBUG_SetSymbolValue( const char * name, const DBG_ADDR *addr );
extern const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
struct name_hash ** rtn,
unsigned int ebp);
unsigned int ebp,
struct list_id * source);
extern void DEBUG_ReadSymbolTable( const char * filename );
extern void DEBUG_LoadEntryPoints(void);
extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num,
unsigned long offset );
extern void DEBUG_AddLocal( struct name_hash * func, int regno,
extern struct wine_locals *
DEBUG_AddLocal( struct name_hash * func, int regno,
int offset,
int pc_start,
int pc_end,
char * name);
extern int DEBUG_CheckLinenoStatus(const DBG_ADDR *addr);
extern void DEBUG_GetFuncInfo(struct list_id * ret, const char * file,
const char * func);
extern int DEBUG_SetSymbolSize(struct name_hash * sym, unsigned int len);
extern int DEBUG_SetSymbolBPOff(struct name_hash * sym, unsigned int len);
extern int DEBUG_GetSymbolAddr(struct name_hash * sym, DBG_ADDR * addr);
extern int DEBUG_cmp_sym(const void * p1, const void * p2);
extern BOOL32 DEBUG_GetLineNumberAddr( struct name_hash *, const int lineno,
DBG_ADDR *addr, int bp_flag );
extern int DEBUG_SetLocalSymbolType(struct wine_locals * sym,
struct datatype * type);
BOOL32 DEBUG_Normalize(struct name_hash * nh );
/* debugger/info.c */
extern void DEBUG_Print( const DBG_ADDR *addr, int count, char format );
extern struct name_hash * DEBUG_PrintAddress( const DBG_ADDR *addr,
extern void DEBUG_PrintBasic( const DBG_ADDR *addr, int count, char format );
extern struct symbol_info DEBUG_PrintAddress( const DBG_ADDR *addr,
int addrlen, int flag );
extern void DEBUG_Help(void);
extern void DEBUG_List( DBG_ADDR *addr, int count );
extern struct name_hash * DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr,
extern void DEBUG_HelpInfo(void);
extern struct symbol_info DEBUG_PrintAddressAndArgs( const DBG_ADDR *addr,
int addrlen,
unsigned int ebp,
int flag );
@ -164,13 +249,17 @@ extern void DEBUG_InfoRegisters(void);
extern BOOL32 DEBUG_ValidateRegisters(void);
extern void DEBUG_SetSigContext( const SIGCONTEXT *sigcontext );
extern void DEBUG_GetSigContext( SIGCONTEXT *sigcontext );
extern int DEBUG_PrintRegister(enum debug_regs reg);
/* debugger/stack.c */
extern void DEBUG_InfoStack(void);
extern void DEBUG_BackTrace(void);
extern BOOL32 DEBUG_GetStackSymbolValue( const char * name, DBG_ADDR *addr );
extern void DEBUG_SilentBackTrace(void);
extern int DEBUG_InfoLocals(void);
extern int DEBUG_SetFrame(int newframe);
extern int DEBUG_GetCurrentFrame(struct name_hash ** name,
unsigned int * eip,
unsigned int * ebp);
/* debugger/stabs.c */
extern int DEBUG_ReadExecutableDbgInfo(void);
@ -179,6 +268,42 @@ extern int DEBUG_ReadExecutableDbgInfo(void);
extern int DEBUG_RegisterDebugInfo(int, struct pe_data *pe,
int, unsigned long, unsigned long);
extern int DEBUG_ProcessDeferredDebug(void);
extern int DEBUG_RegisterELFDebugInfo(int load_addr, u_long size, char * name);
extern void DEBUG_InfoShare(void);
extern void DEBUG_InitCVDataTypes(void);
/* debugger/types.c */
extern void DEBUG_InitTypes(void);
extern struct datatype * DEBUG_NewDataType(enum debug_type xtype,
const char * typename);
extern unsigned int
DEBUG_TypeDerefPointer(DBG_ADDR * addr, struct datatype ** newtype);
extern int DEBUG_AddStructElement(struct datatype * dt,
char * name, struct datatype * type,
int offset, int size);
extern int DEBUG_SetStructSize(struct datatype * dt, int size);
extern int DEBUG_SetPointerType(struct datatype * dt, struct datatype * dt2);
extern int DEBUG_SetArrayParams(struct datatype * dt, int min, int max,
struct datatype * dt2);
extern void DEBUG_Print( const DBG_ADDR *addr, int count, char format, int level );
extern unsigned int DEBUG_FindStructElement(DBG_ADDR * addr,
const char * ele_name, int * tmpbuf);
extern struct datatype * DEBUG_GetPointerType(struct datatype * dt);
extern int DEBUG_GetObjectSize(struct datatype * dt);
extern unsigned int DEBUG_ArrayIndex(DBG_ADDR * addr, DBG_ADDR * result, int index);
extern struct datatype * DEBUG_FindOrMakePointerType(struct datatype * reftype);
extern long long int DEBUG_GetExprValue(DBG_ADDR * addr, char ** format);
extern int DEBUG_SetBitfieldParams(struct datatype * dt, int offset,
int nbits, struct datatype * dt2);
extern int DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2);
/* debugger/source.c */
extern void DEBUG_ShowDir(void);
extern void DEBUG_AddPath(const char * path);
extern void DEBUG_List(struct list_id * line1, struct list_id * line2,
int delta);
extern void DEBUG_NukePath(void);
/* debugger/dbg.y */
extern void DEBUG_EnterDebugger(void);

View File

@ -4,8 +4,8 @@
* Copyright 1994 Alexandre Julliard
*/
#ifndef DESKTOP_H
#define DESKTOP_H
#ifndef __WINE_DESKTOP_H
#define __WINE_DESKTOP_H
#include "windows.h"
@ -21,4 +21,4 @@ extern BOOL32 DESKTOP_SetPattern( LPCSTR pattern );
extern LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message,
WPARAM32 wParam, LPARAM lParam );
#endif /* DESKTOP_H */
#endif /* __WINE_DESKTOP_H */

View File

@ -4,8 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#ifndef DIALOG_H
#define DIALOG_H
#ifndef __WINE_DIALOG_H
#define __WINE_DIALOG_H
#include "windows.h"
#include "winproc.h"
@ -44,4 +44,4 @@ extern HWND32 DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
WINDOWPROCTYPE procType );
extern INT32 DIALOG_DoDialogBox( HWND32 hwnd, HWND32 owner );
#endif /* DIALOG_H */
#endif /* __WINE_DIALOG_H */

View File

@ -2,8 +2,8 @@
* dlgs.h - Common dialog's dialog control ID numbers *
******************************************************************************/
#ifndef DLGS_H
#define DLGS_H
#ifndef __WINE_DLGS_H
#define __WINE_DLGS_H
#define ctlFirst 0x0400
#define ctlLast 0x04ff
@ -183,4 +183,4 @@
#define FORMATDLGORD31 1543
#define FORMATDLGORD30 1544
#endif /* #ifdef DLGS_H */
#endif /* #ifdef __WINE_DLGS_H */

View File

@ -1,34 +0,0 @@
/*
* DOS file system declarations
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_DOS_FS_H
#define __WINE_DOS_FS_H
#include <time.h>
#include "windows.h"
#define MAX_PATHNAME_LEN 1024
#define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
extern void DOSFS_ToDosDateTime( time_t unixtime, WORD *pDate, WORD *pTime );
extern time_t DOSFS_DosDateTimeToUnixTime(WORD,WORD);
extern const char *DOSFS_ToDosFCBFormat( const char *name );
extern const char *DOSFS_ToDosDTAFormat( const char *name );
extern const char *DOSFS_IsDevice( const char *name );
extern BOOL32 DOSFS_FindUnixName( const char *path, const char *name,
char *buffer, int maxlen,
UINT32 drive_flags );
extern const char * DOSFS_GetUnixFileName( const char * name, int check_last );
extern const char * DOSFS_GetDosTrueName( const char *name, int unix_format );
extern int DOSFS_GetDosFileName( const char *name, char *buffer, int len );
extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft );
extern void DOSFS_UnixTimeToFileTime(time_t unixtime,LPFILETIME ft);
extern int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr,
int skip, WIN32_FIND_DATA32A *entry );
#endif /* __WINE_DOS_FS_H */

View File

@ -2,6 +2,9 @@
* Drivers definitions
*/
#ifndef __WINE_DRIVER_H
#define __WINE_DRIVER_H
#define DRV_LOAD 0x0001
#define DRV_ENABLE 0x0002
#define DRV_OPEN 0x0003
@ -64,5 +67,4 @@ HMODULE16 GetDriverModuleHandle(HDRVR16 hDriver);
HDRVR16 GetNextDriver(HDRVR16, DWORD);
BOOL16 GetDriverInfo(HDRVR16, DRIVERINFOSTRUCT16 *);
#endif /* __WINE_DRIVER_H */

View File

@ -7,9 +7,23 @@
#ifndef __WINE_FILE_H
#define __WINE_FILE_H
#include <time.h>
#include "windows.h"
#include "handle32.h"
#define MAX_PATHNAME_LEN 1024
/* Definition of a full DOS file name */
typedef struct
{
char long_name[MAX_PATHNAME_LEN]; /* Long pathname in Unix format */
char short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
int drive;
} DOS_FULL_NAME;
#define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
/* files/file.c */
extern void FILE_Destroy( K32OBJ *ptr );
extern void FILE_SetDosError(void);
@ -29,7 +43,21 @@ extern UINT32 DIR_GetTempUnixDir( LPSTR path, UINT32 count );
extern UINT32 DIR_GetDosPath( INT32 element, LPSTR path, UINT32 count );
extern UINT32 DIR_GetUnixPath( INT32 element, LPSTR path, UINT32 count );
extern DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
DWORD buflen, LPSTR buffer, LPSTR *lastpart,
BOOL32 win32 );
DOS_FULL_NAME *full_name, BOOL32 win32 );
/* files/dos_fs.c */
extern void DOSFS_UnixTimeToFileTime( time_t unixtime, LPFILETIME ft,
DWORD remainder );
extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
extern BOOL32 DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
extern const char *DOSFS_IsDevice( const char *name );
extern BOOL32 DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
INT32 long_len, LPSTR short_buf,
BOOL32 ignore_case );
extern BOOL32 DOSFS_GetFullName( LPCSTR name, BOOL32 check_last,
DOS_FULL_NAME *full );
extern int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr,
int skip, WIN32_FIND_DATA32A *entry );
#endif /* __WINE_FILE_H */

View File

@ -4,8 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#ifndef GDI_H
#define GDI_H
#ifndef __WINE_GDI_H
#define __WINE_GDI_H
#include "windows.h"
#include "ldt.h"
@ -158,14 +158,11 @@ typedef struct tagDC_FUNCS
INT32 (*pExcludeVisRect)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pExtFloodFill)(DC*,INT32,INT32,COLORREF,UINT32);
BOOL32 (*pExtTextOut)(DC*,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*);
BOOL32 (*pFillRgn)(DC*,HRGN32,HBRUSH32);
BOOL32 (*pFloodFill)(DC*,INT32,INT32,COLORREF);
BOOL32 (*pFrameRgn)(DC*,HRGN32,HBRUSH32,INT32,INT32);
COLORREF (*pGetPixel)(DC*,INT32,INT32);
BOOL32 (*pGetTextExtentPoint)(DC*,LPCSTR,INT32,LPSIZE32);
BOOL32 (*pGetTextMetrics)(DC*,TEXTMETRIC32A*);
INT32 (*pIntersectClipRect)(DC*,INT32,INT32,INT32,INT32);
INT32 (*pIntersectVisRect)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pInvertRgn)(DC*,HRGN32);
BOOL32 (*pLineTo)(DC*,INT32,INT32);
BOOL32 (*pMoveToEx)(DC*,INT32,INT32,LPPOINT32);
INT32 (*pOffsetClipRgn)(DC*,INT32,INT32);
@ -208,7 +205,6 @@ typedef struct tagDC_FUNCS
BOOL32 (*pSetWindowOrg)(DC*,INT32,INT32);
BOOL32 (*pStretchBlt)(DC*,INT32,INT32,INT32,INT32,DC*,INT32,INT32,INT32,INT32,DWORD);
INT32 (*pStretchDIBits)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32,LPSTR,LPBITMAPINFO,WORD,DWORD);
BOOL32 (*pTextOut)(DC*,INT32,INT32,LPCSTR,INT32);
} DC_FUNCTIONS;
/* DC hook codes */
@ -299,4 +295,4 @@ extern Window rootWindow;
extern int screenWidth, screenHeight, screenDepth;
extern int desktopX, desktopY; /* misc/main.c */
#endif /* GDI_H */
#endif /* __WINE_GDI_H */

View File

@ -43,45 +43,4 @@ typedef struct
extern void K32OBJ_IncCount( K32OBJ *ptr );
extern void K32OBJ_DecCount( K32OBJ *ptr );
/* The _*_OBJECT structures contain information needed about each
* particular type of handle. This information is a combination of
* equivalent UNIX-style handles/descriptors and general information
* that the Win32 API might request.
*
* The KERNEL_OBJECT structure must be the first member of any specific
* kernel object type's structure.
*/
typedef struct {
unsigned long magic;
} KERNEL_OBJECT;
/* Object number definitions. These numbers are used to
* validate the kernel object by comparison against the
* object's 'magic' value.
*/
#define KERNEL_OBJECT_UNUSED 2404554046UL
#define KERNEL_OBJECT_THREAD (KERNEL_OBJECT_UNUSED + 1)
#define KERNEL_OBJECT_PROCESS (KERNEL_OBJECT_UNUSED + 2)
#define KERNEL_OBJECT_FILE (KERNEL_OBJECT_UNUSED + 3)
#define KERNEL_OBJECT_SEMAPHORE (KERNEL_OBJECT_UNUSED + 4)
#define KERNEL_OBJECT_EVENT (KERNEL_OBJECT_UNUSED + 5)
#define KERNEL_OBJECT_REGKEY (KERNEL_OBJECT_UNUSED + 6)
#define KERNEL_OBJECT_FILEMAP (KERNEL_OBJECT_UNUSED + 7)
#define KERNEL_OBJECT_VRANGE (KERNEL_OBJECT_UNUSED + 8)
#define KERNEL_OBJECT_HEAP (KERNEL_OBJECT_UNUSED + 9)
#define KERNEL_OBJECT_HEAPITEM (KERNEL_OBJECT_UNUSED + 10)
/* Functions for checking kernel objects.
*/
int ValidateKernelObject(KERNEL_OBJECT *ptr);
/* For now, CreateKernelObject and ReleaseKernelObject will
* simply map to malloc() and free().
*/
#define CreateKernelObject(size) (malloc(size))
#define ReleaseKernelObject(ptr) (free(ptr))
#endif /* __WINE_HANDLE32_H */

View File

@ -3,6 +3,9 @@
* Copyright 1996 Marcus Meissner
*/
#ifndef __WINE_LZEXPAND_H
#define __WINE_LZEXPAND_H
#define LZERROR_BADINHANDLE 0xFFFF /* -1 */
#define LZERROR_BADOUTHANDLE 0xFFFE /* -2 */
#define LZERROR_READ 0xFFFD /* -3 */
@ -11,3 +14,5 @@
#define LZERROR_GLOBLOCK 0xFFFA /* -6 */
#define LZERROR_BADVALUE 0xFFF9 /* -7 */
#define LZERROR_UNKNOWNALG 0xFFF8 /* -8 */
#endif /* __WINE_LZEXPAND_H */

View File

@ -6,8 +6,8 @@
* MDI structure definitions.
*/
#ifndef MDI_H
#define MDI_H
#ifndef __WINE_MDI_H
#define __WINE_MDI_H
#include "windows.h"
@ -43,5 +43,5 @@ typedef struct
HWND self;
} MDICLIENTINFO;
#endif /* MDI_H */
#endif /* __WINE_MDI_H */

View File

@ -5,16 +5,14 @@
#ifndef __WINE_MENU_H
#define __WINE_MENU_H
extern BOOL MENU_Init(void);
extern HMENU16 MENU_GetDefSysMenu(void);
extern void MENU_InitSysMenuPopup(HMENU16 hmenu, DWORD style, DWORD clsStyle);
extern UINT MENU_GetMenuBarHeight( HWND hwnd, UINT menubarWidth,
int orgX, int orgY );
extern void MENU_TrackMouseMenuBar( WND* , INT16 ht, POINT16 pt );
extern void MENU_TrackKbdMenuBar( WND*, UINT16 wParam, INT16 vkey);
extern UINT MENU_DrawMenuBar( HDC32 hDC, LPRECT16 lprect,
HWND hwnd, BOOL suppress_draw );
extern LRESULT PopupMenuWndProc( HWND hwnd, UINT message,
WPARAM16 wParam, LPARAM lParam );
extern BOOL32 MENU_Init(void);
extern HMENU32 MENU_GetDefSysMenu(void);
extern void MENU_InitSysMenuPopup(HMENU32 hmenu, DWORD style, DWORD clsStyle);
extern UINT32 MENU_GetMenuBarHeight( HWND32 hwnd, UINT32 menubarWidth,
INT32 orgX, INT32 orgY );
extern void MENU_TrackMouseMenuBar( WND *wnd, INT32 ht, POINT32 pt );
extern void MENU_TrackKbdMenuBar( WND *wnd, UINT32 wParam, INT32 vkey );
extern UINT32 MENU_DrawMenuBar( HDC32 hDC, LPRECT32 lprect,
HWND32 hwnd, BOOL32 suppress_draw );
#endif /* __WINE_MENU_H */

View File

@ -4,8 +4,8 @@
* Copyright David W. Metcalfe, 1994
*/
#ifndef METAFILE_H
#define METAFILE_H
#ifndef __WINE_METAFILE_H
#define __WINE_METAFILE_H
#include "windows.h"
@ -37,5 +37,5 @@ BOOL32 MF_StretchBlt(DC *dcDest, short xDest, short yDest, short widthDest,
short heightDest, DC *dcSrc, short xSrc, short ySrc,
short widthSrc, short heightSrc, DWORD rop);
#endif /* METAFILE_H */
#endif /* __WINE_METAFILE_H */

View File

@ -43,5 +43,33 @@ extern BOOL32 MFDRV_ScaleViewportExt( struct tagDC *dc, INT32 xNum,
INT32 xDenom, INT32 yNum, INT32 yDenom );
extern BOOL32 MFDRV_ScaleWindowExt( struct tagDC *dc, INT32 xNum, INT32 xDenom,
INT32 yNum, INT32 yDenom );
extern BOOL32 MFDRV_MoveToEx(struct tagDC *dc, INT32 x, INT32 y, LPPOINT32 pt);
extern BOOL32 MFDRV_LineTo( struct tagDC *dc, INT32 x, INT32 y );
extern BOOL32 MFDRV_Arc( struct tagDC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 xstart, INT32 ystart, INT32 xend,
INT32 yend );
extern BOOL32 MFDRV_Pie( struct tagDC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 xstart, INT32 ystart, INT32 xend,
INT32 yend );
extern BOOL32 MFDRV_Chord( struct tagDC *dc, INT32 left, INT32 top, INT32 right,
INT32 bottom, INT32 xstart, INT32 ystart, INT32 xend,
INT32 yend );
extern BOOL32 MFDRV_Ellipse( struct tagDC *dc, INT32 left, INT32 top,
INT32 right, INT32 bottom );
extern BOOL32 MFDRV_Rectangle( struct tagDC *dc, INT32 left, INT32 top,
INT32 right, INT32 bottom);
extern BOOL32 MFDRV_RoundRect( struct tagDC *dc, INT32 left, INT32 top,
INT32 right, INT32 bottom, INT32 ell_width,
INT32 ell_height );
extern COLORREF MFDRV_SetPixel( struct tagDC *dc, INT32 x, INT32 y, COLORREF color );
extern BOOL32 MFDRV_Polyline( struct tagDC *dc, const LPPOINT32 pt,INT32 count);
extern BOOL32 MFDRV_Polygon( struct tagDC *dc, LPPOINT32 pt, INT32 count );
extern BOOL32 MFDRV_PolyPolygon( struct tagDC *dc, LPPOINT32 pt, LPINT32 counts,
UINT32 polygons);
extern BOOL32 MFDRV_ExtFloodFill( struct tagDC *dc, INT32 x, INT32 y,
COLORREF color, UINT32 fillType );
extern BOOL32 MFDRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y,
UINT32 flags, const RECT32 *lprect, LPCSTR str,
UINT32 count, const INT32 *lpDx );
#endif /* __WINE_METAFILEDRV_H */

View File

@ -2,8 +2,8 @@
* MMSYSTEM - Multimedia Wine Extension ... :-)
*/
#ifndef MMSYSTEM_H
#define MMSYSTEM_H
#ifndef __WINE_MMSYSTEM_H
#define __WINE_MMSYSTEM_H
typedef LPSTR HPSTR; /* a huge version of LPSTR */
typedef LPCSTR HPCSTR; /* a huge version of LPCSTR */
@ -1539,7 +1539,4 @@ DWORD widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
#endif /* MMSYSTEM_H */
#endif /* __WINE_MMSYSTEM_H */

View File

@ -4,8 +4,8 @@
* Copyright 1995 Alexandre Julliard
*/
#ifndef _WINE_MODULE_H
#define _WINE_MODULE_H
#ifndef __WINE_MODULE_H
#define __WINE_MODULE_H
#include "wintypes.h"
#include "pe_image.h"
@ -140,4 +140,4 @@ extern BOOL16 NE_LoadSegment( HMODULE16 hModule, WORD segnum );
extern void NE_FixupPrologs( NE_MODULE *pModule );
extern void NE_InitializeDLLs( HMODULE16 hModule );
#endif /* _WINE_MODULE_H */
#endif /* __WINE_MODULE_H */

View File

@ -1,5 +1,5 @@
#ifndef __MSDOS_H
#define __MSDOS_H
#ifndef __WINE_MSDOS_H
#define __WINE_MSDOS_H
#include <dirent.h>
#include "windows.h"
@ -158,4 +158,4 @@ extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus;
#define EL_Serial 0x04
#define EL_Memory 0x05
#endif /* __MSDOS_H */
#endif /* __WINE_MSDOS_H */

View File

@ -1,10 +1,8 @@
/* $Id: neexe.h,v 1.4 1993/07/04 04:04:21 root Exp root $
*/
/*
* Copyright Robert J. Amstadt, 1993
*/
#ifndef NEEXE_H
#define NEEXE_H
#ifndef __WINE_NEEXE_H
#define __WINE_NEEXE_H
#include "wintypes.h"
@ -229,4 +227,4 @@ struct resource_typeinfo_s
int load_typeinfo (int, struct resource_typeinfo_s *);
int load_nameinfo (int, struct resource_nameinfo_s *);
#endif /* NEEXE_H */
#endif /* __WINE_NEEXE_H */

View File

@ -21,5 +21,7 @@ extern LONG NC_HandleNCLButtonDown( HWND32 hwnd, WPARAM16 wParam,
extern LONG NC_HandleNCLButtonDblClk( WND *pWnd, WPARAM16 wParam, LPARAM lParam);
extern LONG NC_HandleSysCommand( HWND32 hwnd, WPARAM16 wParam, POINT16 pt );
extern LONG NC_HandleSetCursor( HWND32 hwnd, WPARAM16 wParam, LPARAM lParam );
extern void NC_DrawSysButton( HWND32 hwnd, HDC32 hdc, BOOL32 down );
extern BOOL32 NC_GetSysPopupPos( WND* wndPtr, RECT32* rect );
#endif /* __WINE_NONCLIENT_H */

View File

@ -2,6 +2,9 @@
* ole2.h - Declarations for OLE2
*/
#ifndef __WINE_OLE2_H
#define __WINE_OLE2_H
typedef LONG HRESULT;
#define S_OK 0
@ -10,3 +13,5 @@ typedef LONG HRESULT;
/* OLE version */
#define rmm 23
#define rup 639
#endif /* __WINE_OLE2_H */

View File

@ -4,8 +4,8 @@
* Copyright 1994 Alexandre Julliard
*/
#ifndef OPTIONS_H
#define OPTIONS_H
#ifndef __WINE_OPTIONS_H
#define __WINE_OPTIONS_H
#include "wintypes.h"
@ -50,7 +50,7 @@ struct options
int backingstore; /* Use backing store */
short cmdShow;
int debug;
int allowReadOnly; /* Opening a read only file will succeed even
int failReadOnly; /* Opening a read only file will fail
if write access is requested */
WINE_MODE mode; /* Start Wine in selected mode
(standard/enhanced) */
@ -70,4 +70,4 @@ extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name,
int def );
#endif
#endif /* __WINE_OPTIONS_H */

View File

@ -253,4 +253,22 @@ struct PE_Debug_dir
#define IMAGE_REL_BASED_HIGHADJ 4
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
/*
* This is the structure that appears at the very start of a .DBG file.
*/
struct PE_DBG_FileHeader {
unsigned short int Signature;
unsigned short int Flags;
unsigned short int Machine;
unsigned short int Characteristics;
unsigned int TimeDateStamp;
unsigned int CheckSum;
unsigned int ImageBase;
unsigned int SizeOfImage;
unsigned int NumberOfSections;
unsigned int ExportedNamesSize;
unsigned int DebugDirectorySize;
unsigned int Reserved[ 3 ];
};
#endif /* __WINE_PEEXE_H */

View File

@ -10,6 +10,7 @@
#include "windows.h"
#include "winbase.h"
#include "handle32.h"
#include "task.h"
/* Process handle entry */
typedef struct
@ -29,13 +30,13 @@ typedef struct
typedef struct
{
LPSTR environ; /* 00 Process environment strings */
DWORD unknown1; /* 04 Unknown */
DWORD env_size; /* 04 Environment size (was: Unknown) */
LPSTR cmd_line; /* 08 Command line */
LPSTR cur_dir; /* 0c Current directory */
STARTUPINFO32A *startup_info; /* 10 Startup information */
HANDLE32 hStdin; /* 14 Handle for standard input */
HANDLE32 hStdout; /* 18 Handle for standard output */
HANDLE32 hStderr; /* 1c Handle for standard error */
HANDLE32 hStdin; /* 14 Handle for standard input */
HANDLE32 hStdout; /* 18 Handle for standard output */
HANDLE32 hStderr; /* 1c Handle for standard error */
DWORD unknown2; /* 20 Unknown */
DWORD inherit_console; /* 24 Inherit console flag */
DWORD break_type; /* 28 Console events flag */
@ -66,7 +67,7 @@ typedef struct _PDB32
HANDLE32 system_heap; /* 34 System heap to allocate handles */
HTASK32 task; /* 38 Win16 task */
void *mem_map_files; /* 3c Pointer to mem-mapped files */
ENVDB *env_DB; /* 40 Environment database */
ENVDB *env_db; /* 40 Environment database */
HANDLE_TABLE *handle_table; /* 44 Handle table */
struct _PDB32 *parent; /* 48 Parent process */
void *modref_list; /* 4c MODREF list */
@ -91,13 +92,15 @@ typedef struct _PDB32
WORD error_mode; /* b6 Error mode */
K32OBJ *load_done_evt; /* b8 Event for process loading done */
DWORD unknown7; /* bc Unknown */
DWORD unknown8; /* c0 Unknown (NT) */
LCID locale; /* c4 Locale to be queried by GetThreadLocale (NT) */
} PDB32;
extern HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags);
extern K32OBJ *PROCESS_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type );
extern BOOL32 PROCESS_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD flags );
extern PDB32 *PROCESS_Create(void);
extern PDB32 *PROCESS_Create( TDB *pTask );
extern void PROCESS_Destroy( K32OBJ *ptr );
extern PDB32 *pCurrentProcess;

View File

@ -5,8 +5,8 @@
* Copyright 1994 Alexandre Julliard
*/
#ifndef SCROLL_H
#define SCROLL_H
#ifndef __WINE_SCROLL_H
#define __WINE_SCROLL_H
#include "windows.h"
@ -26,4 +26,4 @@ extern void SCROLL_DrawScrollBar( HWND32 hwnd, HDC32 hdc, INT32 nBar,
extern void SCROLL_HandleScrollEvent( HWND32 hwnd, INT32 nBar,
UINT32 msg, POINT32 pt );
#endif /* SCROLL_H */
#endif /* __WINE_SCROLL_H */

View File

@ -40,6 +40,11 @@ extern void SELECTOR_FreeBlock( WORD sel, WORD count );
#define WINE_CODE_SELECTOR 0x17
#endif /* svr4 || SCO_DS */
#ifdef __EMX__
#define WINE_DATA_SELECTOR 0x00 /* FIXME: This is wrong */
#define WINE_CODE_SELECTOR 0x00
#endif /* OS/2 */
#else /* WINELIB */
#define WINE_DATA_SELECTOR 0x00

View File

@ -1,8 +1,6 @@
/*
* Shell Library definitions
*/
#include "wintypes.h"
#ifndef __WINE_SHELL_H
#define __WINE_SHELL_H

View File

@ -4,8 +4,8 @@
* Copyright 1994 Alexandre Julliard
*/
#ifndef STATIC_H
#define STATIC_H
#ifndef __WINE_STATIC_H
#define __WINE_STATIC_H
#include "windows.h"
@ -19,4 +19,4 @@ typedef struct
extern LRESULT StaticWndProc(HWND hWnd,UINT uMsg,WPARAM16 wParam,LPARAM lParam );
#endif /* STATIC_H */
#endif /* __WINE_STATIC_H */

View File

@ -1,5 +1,5 @@
#ifndef __STRESS_H
#define __STRESS_H
#ifndef __WINE_STRESS_H
#define __WINE_STRESS_H
#include <windows.h>
@ -27,4 +27,4 @@ void UnAllocFileHandles(void);
}
#endif
#endif /* __STRESS_H */
#endif /* __WINE_STRESS_H */

View File

@ -5,12 +5,12 @@
*
*/
#ifndef _STRING32_H
#define _STRING32_H
#ifndef __WINE_STRING32_H
#define __WINE_STRING32_H
#include "wintypes.h"
LPWSTR STRING32_DupAnsiToUni(LPCSTR src);
LPWSTR STRING32_strdupW(LPCWSTR);
#endif
#endif /* __WINE_STRING32_H */

View File

@ -3,12 +3,6 @@
#define __WINE__STRUCT32_H
#include "handle32.h"
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*);
extern void STRUCT32_MINMAXINFO32to16( const MINMAXINFO32*, MINMAXINFO16* );
extern void STRUCT32_MINMAXINFO16to32( const MINMAXINFO16*, MINMAXINFO32* );
extern void STRUCT32_WINDOWPOS32to16( const WINDOWPOS32*, WINDOWPOS16* );

View File

@ -4,8 +4,8 @@
* Copyright Alexandre Julliard, 1994
*/
#ifndef SYSCOLOR_H
#define SYSCOLOR_H
#ifndef __WINE_SYSCOLOR_H
#define __WINE_SYSCOLOR_H
#include "windows.h"
@ -37,4 +37,4 @@ struct SysColorObjects
extern void SYSCOLOR_Init(void);
extern struct SysColorObjects sysColorObjects;
#endif /* SYSCOLOR_H */
#endif /* __WINE_SYSCOLOR_H */

View File

@ -4,8 +4,8 @@
* Copyright 1994 Alexandre Julliard
*/
#ifndef SYSMETRICS_H
#define SYSMETRICS_H
#ifndef __WINE_SYSMETRICS_H
#define __WINE_SYSMETRICS_H
#include "windows.h"
@ -77,4 +77,4 @@
extern void SYSMETRICS_Init(void);
extern short sysMetrics[SM_CMETRICS+1];
#endif
#endif /* __WINE_SYSMETRICS_H */

View File

@ -4,8 +4,8 @@
* Copyright 1995 Alexandre Julliard
*/
#ifndef _WINE_TASK_H
#define _WINE_TASK_H
#ifndef __WINE_TASK_H
#define __WINE_TASK_H
#include "wintypes.h"
@ -28,7 +28,8 @@ typedef struct
WORD reserved2[2];
WORD nbFiles; /* 32 Number of file handles */
SEGPTR fileHandlesPtr; /* 34 Pointer to file handle table */
WORD reserved3[18];
HANDLE16 hFileHandles; /* 38 Handle to fileHandlesPtr */
WORD reserved3[17];
BYTE fcb1[16]; /* 5c First FCB */
BYTE fcb2[20]; /* 6c Second FCB */
BYTE cmdLine[128]; /* 80 Command-line (first byte is len)*/
@ -117,4 +118,4 @@ extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
extern void TASK_KillCurrentTask( INT16 exitCode );
extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
#endif /* _WINE_TASK_H */
#endif /* __WINE_TASK_H */

View File

@ -1,5 +1,5 @@
#ifndef __TOOLHELP_H
#define __TOOLHELP_H
#ifndef __WINE_TOOLHELP_H
#define __WINE_TOOLHELP_H
#include "windows.h"
@ -343,4 +343,4 @@ struct {
FARPROC16 lpfnErrorAddr;
void **lpBadParam;
} NFYLOGPARAMERROR;
#endif /* __TOOLHELP_H */
#endif /* __WINE_TOOLHELP_H */

View File

@ -4,8 +4,8 @@
* Copyright 1993 Alexandre Julliard
*/
#ifndef USER_H
#define USER_H
#ifndef __WINE_USER_H
#define __WINE_USER_H
#include "ldt.h"
#include "local.h"
@ -23,4 +23,4 @@ extern WORD USER_HeapSel;
#define USER_HEAP_SEG_ADDR(handle) \
((handle) ? PTR_SEG_OFF_TO_SEGPTR(USER_HeapSel, (handle)) : (SEGPTR)0)
#endif /* USER_H */
#endif /* __WINE_USER_H */

Some files were not shown because too many files have changed in this diff Show More