1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

Release 941017

Sun Oct 16 13:29:07 1994  Alexandre Julliard  (julliard@lamisun.epfl.ch)

	* [controls/button.c]
	Implemented WM_GETDLGCODE, WM_SETFONT, BM_SETSTYLE, BM_SETCHECK,
	BM_SETSTATE.
	Implemented default button painting.
	Optimised redrawing.
	Fixed owner-draw buttons.

	* [controls/static.c]
	Implemented WM_SETFONT.
	A few optimisations in painting code.
	Bug fix for SS_SIMPLE controls.

	* [if1632/callback.c]
	Preliminary GetCodeHandle().

	* [if1632/gdi.spec]
	Changed 'pascal' to 'pascal16' everywhere it's needed.

	* [include/windows.h]
	Fixed a few data structures.

	* [memory/heap.c]
	Bug fix in HEAP_ReAlloc().

	* [misc/cursor.c]
	Fixed SetCursor().

	* [objects/bitblt.c]
	Fixed PatBlt() when using BLACKNESS or WHITENESS codes.

	* [objects/font.c]
	Better font mapping code.
	Implemented GetTextFace().

	* [objects/region.c]
	Bug fix in REGION_MakePixmap().
	Faster region copying.

	* [objects/text.c]
	Implemented ExtTextOut().
	Implemented DT_NOCLIP style for DrawText().

	* [windows/dc.c]
	Free the bitmap when deleting a memory DC.

	* [windows/dce.c]
	Added support for windows that have no associated X window.
	Implemented DCX_CLIPSIBLINGS and DCX_PARENTCLIP in GetDCEx().

	* [windows/defdlg.c]
	Implemented default push button handling and DM_SETDEFID.
	Implemented WM_NEXTDLGCTL.

	* [windows/dialog.c]
	Implemented default push button handling.
	Beginning of a keyboard interface in dialogs
	(does not really work yet).
	Fixed dialogs that use a special font.

	* [windows/event.c] [windows/focus.c]
	Added support for non-X windows.

	* [windows/graphics.c]
	Rewritten FloodFill() and implemented ExtFloodFill().

	* [windows/message.c]
	Cleaner hardware messages and X events handling.

	* [windows/defwnd.c] [windows/painting.c]
	Implemented WM_SETREDRAW.

	* [windows/win.c]
	Only create an X window for top-level windows, or for the desktop.
	Child windows now use their parent's drawable.

	* [windows/winpos.c]
	Beginning of support for non-X windows (still somewhat broken).
	Implemented *DeferWindowPos().

	* [*/Imakefile]
	Cleaned up some Imakefiles.
	Moved dc.c from windows/ to objects/.
	Moved cursor.c from misc/ to windows/.

Sun Oct 16 12:21:52 1994  Michael Patra <micky@marie.physik.tu-berlin.d400.de>

	* [include/debug.h]
	  [include/stddebug.h]
	  [*/*.c]
        Rewritten all the calls to printf for displaying debug-information
        (messages like "LoadImage: loading SOL (SOL.EXE)" etc.) 
        Added option "-debugmsg" to Wine. Example: "-debugmsg +all" will turn
        all these messages on, "-debugmsg -dll" will turn all messages 
	concerning DLLs off.

	* [controls/combo.c]
	Added some handling for combo controls with ownerdraw-styles
        (just creating and passing the necessary messages to the 
	corresponding listbox control; the edit-control needs to be
	replaced with something else).

	* [controls/edit.c]
	  [windows/dialog.c]
	Added support for use of global heap memory in dialogs with 
	edit controls.

	* [controls/listbox.c]
	Added support for item data.
	ListBoxInsertString(): Fixed bug for elements which are not inserted
	after the currently last element.
	
	* [misc/dos_fs.c]
	  [miscemu/int21.c]
	DOS_ValidDirectory(): Checks whether a given string is in fact the
	valid name of a directory.

Sat Oct 15 17:35:00 PDT 1994		<martin@cs.csufresno.edu>

	* [Imakefile]
	generate wine.sym after creating wine

	* [debugger/dbg.y]
	load "wine.sym" when entering debugger

	* [debugger/info.c]
	symbolic backtrace for 32-bit stack. Breaks 16-bit bt.

Sun Sep  25 12:00:00 PDT 1994   <martin@osiris.cs.csufresno.edu>

	* [rc/rc.y] [rc/rc.h] [rc/rc.l] [rc/winerc.c]
	Files created

Sun Sep 18 11:04:45 MET DST 1994          Dag Asheim (dash@ifi.uio.no)

	* [misc/spy.c]
	Exclude and Include no longer requires a terminating ';' to
	register the last component.

Thu Sep 15 23:10:09 MET DST 1994          Dag Asheim (dash@ifi.uio.no)

	* [Configure]
	Rewrote much of it.  Added capability to generate a wine.ini
	file.  Commented out the processor emulator options until that
	becomes interesting.  Gives a warning if it sees any *.rej
	files.  I hope I haven't assumed to much about the shell/OS so
	that it breaks under *BSD.

	* [misc/dos_fs.c]
	Removed/changed calls to ToUnix() (which calls tolower()) so
	that the part of the pathname which correspond with the drive
	letter on DOS no longer will be mapped to lowercase.  This
	means that it should be possible to have uppercase letters in
	the [drives] section of wine.ini.

	* [LICENSE]
	Cosmetic changes so that it displays better in the window you
	get from pressing "Credit_License" in the "About WINE" window.

Sun Aug 21 21:12:06 MET DST 1994	<erik@xs4all.nl>

	* [controls/menu.c]
	LoadMenu() moved to loader/resource.c.

	* [misc/main.c]
	Added stub for FileCDR().

	* [include/peexe.h]
	Added, from Eric's pe-test.

	* [include/resource.h]
	Added.

	* [loader/resources.c]
	Removed duplicated code in *Resource() functions.
	Moved NE-program specific functions into ne_image.c.
	Moved NE-fileformat functions to ne_resource.c.

	* [pe_image.c] [pe_resource.c]
	Added. Nothing implemented to run PE-executables, resource
	loading only.

	* [misc/file.c]
	Changed OpenFile() to use macros.

	* [misc/shell.c]
	Added NULL-ptr checks to ShellAbout().

	* [miscemu/int21.c]
	Fixed a few typos.

	* [miscemu/kernel.c]
	Added _DI = _DS, to put the caller's instance in DI. Doesn't
	work properly if caller changed DS :-(
This commit is contained in:
Alexandre Julliard 1994-10-17 18:12:41 +00:00
parent 940d58c201
commit aca057835e
135 changed files with 8180 additions and 5619 deletions

2
BUGS
View file

@ -1,8 +1,8 @@
- EBP and ESP are sometimes corrupted while running 16-bit code. - EBP and ESP are sometimes corrupted while running 16-bit code.
- Dialog Boxes created by WM_CREATE handler aren't visible - Dialog Boxes created by WM_CREATE handler aren't visible
- RegisterClass() with hbrBackground = COLOR_APPWORKSPACE+1 does not work.
- MDI does not send WM_GETMINMAX message. - MDI does not send WM_GETMINMAX message.
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0) - InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors - LoadCursor does not correctly handle bitmap cursors
- AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times. - AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times.
- Dialogs don't support resources which are referred to as integers. - Dialogs don't support resources which are referred to as integers.
- grep for FIXME in the source files.

191
ChangeLog
View file

@ -1,3 +1,194 @@
Sun Oct 16 13:29:07 1994 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [controls/button.c]
Implemented WM_GETDLGCODE, WM_SETFONT, BM_SETSTYLE, BM_SETCHECK,
BM_SETSTATE.
Implemented default button painting.
Optimised redrawing.
Fixed owner-draw buttons.
* [controls/static.c]
Implemented WM_SETFONT.
A few optimisations in painting code.
Bug fix for SS_SIMPLE controls.
* [if1632/callback.c]
Preliminary GetCodeHandle().
* [if1632/gdi.spec]
Changed 'pascal' to 'pascal16' everywhere it's needed.
* [include/windows.h]
Fixed a few data structures.
* [memory/heap.c]
Bug fix in HEAP_ReAlloc().
* [misc/cursor.c]
Fixed SetCursor().
* [objects/bitblt.c]
Fixed PatBlt() when using BLACKNESS or WHITENESS codes.
* [objects/font.c]
Better font mapping code.
Implemented GetTextFace().
* [objects/region.c]
Bug fix in REGION_MakePixmap().
Faster region copying.
* [objects/text.c]
Implemented ExtTextOut().
Implemented DT_NOCLIP style for DrawText().
* [windows/dc.c]
Free the bitmap when deleting a memory DC.
* [windows/dce.c]
Added support for windows that have no associated X window.
Implemented DCX_CLIPSIBLINGS and DCX_PARENTCLIP in GetDCEx().
* [windows/defdlg.c]
Implemented default push button handling and DM_SETDEFID.
Implemented WM_NEXTDLGCTL.
* [windows/dialog.c]
Implemented default push button handling.
Beginning of a keyboard interface in dialogs
(does not really work yet).
Fixed dialogs that use a special font.
* [windows/event.c] [windows/focus.c]
Added support for non-X windows.
* [windows/graphics.c]
Rewritten FloodFill() and implemented ExtFloodFill().
* [windows/message.c]
Cleaner hardware messages and X events handling.
* [windows/defwnd.c] [windows/painting.c]
Implemented WM_SETREDRAW.
* [windows/win.c]
Only create an X window for top-level windows, or for the desktop.
Child windows now use their parent's drawable.
* [windows/winpos.c]
Beginning of support for non-X windows (still somewhat broken).
Implemented *DeferWindowPos().
* [*/Imakefile]
Cleaned up some Imakefiles.
Moved dc.c from windows/ to objects/.
Moved cursor.c from misc/ to windows/.
Sun Oct 16 12:21:52 1994 Michael Patra <micky@marie.physik.tu-berlin.d400.de>
* [include/debug.h]
[include/stddebug.h]
[*/*.c]
Rewritten all the calls to printf for displaying debug-information
(messages like "LoadImage: loading SOL (SOL.EXE)" etc.)
Added option "-debugmsg" to Wine. Example: "-debugmsg +all" will turn
all these messages on, "-debugmsg -dll" will turn all messages
concerning DLLs off.
* [controls/combo.c]
Added some handling for combo controls with ownerdraw-styles
(just creating and passing the necessary messages to the
corresponding listbox control; the edit-control needs to be
replaced with something else).
* [controls/edit.c]
[windows/dialog.c]
Added support for use of global heap memory in dialogs with
edit controls.
* [controls/listbox.c]
Added support for item data.
ListBoxInsertString(): Fixed bug for elements which are not inserted
after the currently last element.
* [misc/dos_fs.c]
[miscemu/int21.c]
DOS_ValidDirectory(): Checks whether a given string is in fact the
valid name of a directory.
Sat Oct 15 17:35:00 PDT 1994 <martin@cs.csufresno.edu>
* [Imakefile]
generate wine.sym after creating wine
* [debugger/dbg.y]
load "wine.sym" when entering debugger
* [debugger/info.c]
symbolic backtrace for 32-bit stack. Breaks 16-bit bt.
Sun Sep 18 11:04:45 MET DST 1994 Dag Asheim (dash@ifi.uio.no)
* [misc/spy.c]
Exclude and Include no longer requires a terminating ';' to
register the last component.
Thu Sep 15 23:10:09 MET DST 1994 Dag Asheim (dash@ifi.uio.no)
* [Configure]
Rewrote much of it. Added capability to generate a wine.ini
file. Commented out the processor emulator options until that
becomes interesting. Gives a warning if it sees any *.rej
files. I hope I haven't assumed to much about the shell/OS so
that it breaks under *BSD.
* [misc/dos_fs.c]
Removed/changed calls to ToUnix() (which calls tolower()) so
that the part of the pathname which correspond with the drive
letter on DOS no longer will be mapped to lowercase. This
means that it should be possible to have uppercase letters in
the [drives] section of wine.ini.
* [LICENSE]
Cosmetic changes so that it displays better in the window you
get from pressing "Credit_License" in the "About WINE" window.
Sun Aug 21 21:12:06 MET DST 1994 <erik@xs4all.nl>
* [controls/menu.c]
LoadMenu() moved to loader/resource.c.
* [misc/main.c]
Added stub for FileCDR().
* [include/peexe.h]
Added, from Eric's pe-test.
* [include/resource.h]
Added.
* [loader/resources.c]
Removed duplicated code in *Resource() functions.
Moved NE-program specific functions into ne_image.c.
Moved NE-fileformat functions to ne_resource.c.
* [pe_image.c] [pe_resource.c]
Added. Nothing implemented to run PE-executables, resource
loading only.
* [misc/file.c]
Changed OpenFile() to use macros.
* [misc/shell.c]
Added NULL-ptr checks to ShellAbout().
* [miscemu/int21.c]
Fixed a few typos.
* [miscemu/kernel.c]
Added _DI = _DS, to put the caller's instance in DI. Doesn't
work properly if caller changed DS :-(
---------------------------------------------------------------------- ----------------------------------------------------------------------
Thu Aug 25 15:24:36 EDT 1994 <jrichard@cs.uml.edu> Thu Aug 25 15:24:36 EDT 1994 <jrichard@cs.uml.edu>

197
Configure
View file

@ -1,8 +1,29 @@
#! /bin/sh #! /bin/sh
#
# Configure script for wine
: ${EDITOR:=vi}
: ${PAGER:=more}
ALLDEFINES='' ALLDEFINES=''
# Ask question 'str' and sets 'var' reply (defaulting to 'def' on CR)
prompt ()
{
str="$1"
var="$2"
def="$3"
eval $var='$def'
echo echo
echo -n "$str [$def]? "
input=`head -1` # When using read, user must double all backslashes
if [ -n "$input" ]
then
eval $var='$input'
fi
}
echo -n 'Build Wine as emulator or library (E/L) [E]? ' echo -n 'Build Wine as emulator or library (E/L) [E]? '
read input read input
if [ "$input" = 'l' -o "$input" = 'L' ] if [ "$input" = 'l' -o "$input" = 'L' ]
@ -11,20 +32,26 @@ then
ALLDEFINES="$ALLDEFINES -DWINELIB" ALLDEFINES="$ALLDEFINES -DWINELIB"
else else
WINELIB='' WINELIB=''
echo -n 'Use processor emulator (*DOES*NOT*WORK*YET*) (Y/N) [N]? '
read input # Commented out until the processor emulator starts to work.
if [ "$input" = 'y' -o "$input" = 'Y' ] #
then # echo
PROCEMU='#define PROCEMU' # echo -n 'Use processor emulator (*DOES*NOT*WORK*YET*) (Y/N) [N]? '
echo -n 'bochs directory [/usr/src/bochs]? ' # read input
read input # if [ "$input" = 'y' -o "$input" = 'Y' ]
if [ "$input" = '' ] # then
then # PROCEMU='#define PROCEMU'
ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR=/usr/src/bochs" # echo
else # echo -n 'bochs directory [/usr/src/bochs]? '
ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR="$input # read input
fi # if [ "$input" = '' ]
fi # then
# ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR=/usr/src/bochs"
# else
# ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR="$input
# fi
# fi
fi fi
echo echo
@ -38,48 +65,148 @@ else
SHORTNAMES='' SHORTNAMES=''
fi fi
echo -n 'Global configfile name [/usr/local/etc/wine.conf]? ' prompt "Global configfile name" WINE_CONFIGFILE /usr/local/etc/wine.conf
WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "'$WINE_CONFIGFILE'"'
if [ -r $WINE_CONFIGFILE ]
then
DEFAULT_ANS=N
else
DEFAULT_ANS=Y
fi
echo
echo -n "Do you want to make a config file now (Y/N) [$DEFAULT_ANS]? "
read input read input
if [ "$input" = '' ] if [ "$input" = '' ]
then then
WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "/usr/local/etc/wine.conf"' input="$DEFAULT_ANS"
fi
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
if [ -r $WINE_CONFIGFILE ]
then
echo "Backing up the old file to ${WINE_CONFIGFILE}.old."
if cp $WINE_CONFIGFILE ${WINE_CONFIGFILE}.old
then :
else else
WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "'$input'"' echo "Error while creating backup file. Fix it and run Configure again"
exit 1
fi
fi fi
case `awk 'BEGIN {s=0} {if ($3=="msdos") s++} END {print s}' /etc/fstab` in
0) CF_C=/c;;
1) CF_C=`awk '{if ($3=="msdos") print $2}' /etc/fstab`;;
*) CF_C=`awk '{if ($3=="msdos") {print $2;exit}}' /etc/fstab`;;
esac
prompt "Which directory do you want to use as A:" CF_A /a
prompt "Which directory do you want to use as C:" CF_C $CF_C
prompt "Where is the Windows directory" CF_Windows 'c:\windows'
prompt "Where is the System directory" CF_System 'c:\windows\system'
prompt "Where should Windows apps store temp files" CF_Temp 'c:\temp'
prompt "Which path should be used to find executables and DLL's" CF_Path 'c:\windows;c:\windows\system'
prompt "Where is sysres.dll" CF_SystemResources `pwd`/sysres.dll
prompt "Where is COM1" CF_Com1 '/dev/cua0'
prompt "Where is COM2" CF_Com2 '/dev/cua1'
prompt "Where is LPT1" CF_Lpt1 '/dev/lp0'
prompt "Log messages to which file (CON = stdout)" CF_File 'CON'
echo
sed -n -e 's/^ *\"\(WM_[A-Z0-9]*\)\".*/\1/p' < misc/spy.c | \
sort | pr -ta4w83 | sed '1 i\
Here is the list of messages:\
\
' | $PAGER
prompt "Exclude which messages from the log" CF_Exclude 'WM_SIZE;WM_TIMER'
echo
echo "The config file $WINE_CONFIGFILE now looks like this:"
tee $WINE_CONFIGFILE << EOF
[drives]
A=$CF_A
C=$CF_C
[wine]
Windows=$CF_Windows
System=$CF_System
Temp=$CF_Temp
Path=$CF_Path
SystemResources=$CF_SystemResources
[serialports]
Com1=$CF_Com1
Com2=$CF_Com2
[parallelports]
Lpt1=$CF_Lpt1
[spy]
File=$CF_File
Exclude=$CF_Exclude
EOF
echo
echo -n "Do you want to edit it using $EDITOR (Y/N) [N]? "
read input
if [ "$input" = 'y' -o "$input" = 'Y' ]
then
$EDITOR $WINE_CONFIGFILE
fi
else
if [ ! -r $WINE_CONFIGFILE ]
then
echo 'Ok, remember to make it yourself later.'
fi
fi
NEWBUILD=''
if [ "`(domainname)`" = 'amscons.com' ] if [ "`(domainname)`" = 'amscons.com' ]
then then
echo
echo -n 'New build program (Y/N) [N]? ' echo -n 'New build program (Y/N) [N]? '
read input read input
if [ "$input" = 'y' -o "$input" = 'Y' ] if [ "$input" = 'y' -o "$input" = 'Y' ]
then then
NEWBUILD='#define NewBuild -DNEWBUILD' NEWBUILD='#define NewBuild -DNEWBUILD'
ALLDEFINES="$ALLDEFINES -DNEWBUILD" ALLDEFINES="$ALLDEFINES -DNEWBUILD"
else
NEWBUILD=''
fi fi
else
NEWBUILD=''
fi fi
NEWLINUXLDT='' NEWLINUXLDT=''
if [ -f /usr/include/linux/ldt.h ] if grep -s seg_not_present /usr/include/linux/ldt.h 2> /dev/null
then
if grep seg_not_present /usr/include/linux/ldt.h
then then
NEWLINUXLDT='#define NEW_LDT_STRUCT' NEWLINUXLDT='#define NEW_LDT_STRUCT'
fi fi
fi
echo '/* autoconf.h generated automatically. Run Configure. */' > autoconf.h cat > autoconf.h << EOF
echo $WINELIB >> autoconf.h /* autoconf.h generated automatically. Run Configure. */
echo $SHORTNAMES >> autoconf.h $WINELIB
echo $NEWBUILD >> autoconf.h $SHORTNAMES
echo $WINE_INI_GLOBAL >> autoconf.h $NEWBUILD
echo $NEWLINUXLDT >> autoconf.h $WINE_INI_GLOBAL
echo $ENDIAN >> autoconf.h $NEWLINUXLDT
echo $PROCEMU >> autoconf.h $ENDIAN
echo $PROCEMUDIR >> autoconf.h $PROCEMUDIR
echo "#define AutoDefines $ALLDEFINES" >> autoconf.h #define AutoDefines $ALLDEFINES
EOF
xmkmf -a xmkmf -a
if [ 0 -lt `find . -name "*.rej" -print | wc -l` ]
then
cat << EOF
WARNING: You have some files named "*.rej". Rejected patch files?
Maybe you tried to upgrade Wine by diff-files, and that patch failed.
If something doesn't work, this might be the reason. See "man patch".
List of "*.rej" files:
EOF
find . -name "*.rej" -print
echo
fi

View file

@ -81,3 +81,37 @@ Some functions are defined as type "register" in the DLL specification files.
Inorder to return values in the registers to the WIN16 program, the handler Inorder to return values in the registers to the WIN16 program, the handler
function must exit by calling ReturnFromRegisterFunc(). Look at the function function must exit by calling ReturnFromRegisterFunc(). Look at the function
DOS3Call() for an example of how this works. DOS3Call() for an example of how this works.
DEBUG MESSAGES:
To display a message only during debugging, you normally write something
like this:
#ifdef DEBUG_WIN
printf("abc...");
#endif
You can write this shorter (and better) in this way:
dprintf_win(stddeb,"abc...");
All symbols of the form dprintf_xxxx are macros defined in include/debug.h .
The macro-definitions are generated by the shell-script tools/make_debug. It
scans the source code for symbols of this forms and puts the necessary
macro definitions in include/debug.h and include/stddebug.h . These macros
test for the symbol DEBUG_XXXX (e.g. dprintf_win refers to DEBUG_WIN) being
defined and thus decided whether to actually display the text. If you want
to enable specific types of messages, simply put the corresponding
#define DEBUG_XXXX in include/stddebug.h . If you want to enable or disable
a specific type of message in just one c-source-file, put the corresponding
#define DEBUG_XXXX or #undefine DEBUG_XXXX between #include<stddebug.h> and
#include <debug.h> in that specific file. In addition you can change the
types of displayed messages by supplying the "-debugmsg" option to Wine.
The file handle "stddeb" is intended for displaying standard informational
messages, whereas "stdnimp" is intended for displaying messages concerning
not yet implemented functions.
You have to start tools/make_debug only if you introduced a new macro,
e.g. dprintf_win32s - not if you just changed one of the #define
DEBUG_XXX's in include/stddebug.h or in a specific file.

View file

@ -87,7 +87,7 @@ SYSLIBS = -lm -lg
MakeSubdirs($(SUBDIRS)) MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS))
AllTarget(wine) AllTarget(wine.sym)
#ifndef WINELIB #ifndef WINELIB
NormalProgramTarget(wine,$(EMUOBJS) $(COMMONOBJS),$(DEPXLIB),$(XLIB),$(SYSLIBS)) NormalProgramTarget(wine,$(EMUOBJS) $(COMMONOBJS),$(DEPXLIB),$(XLIB),$(SYSLIBS))
@ -95,9 +95,17 @@ NormalProgramTarget(wine,$(EMUOBJS) $(COMMONOBJS),$(DEPXLIB),$(XLIB),$(SYSLIBS))
NormalLibraryTarget(wine,$(LIBOBJS) $(COMMONOBJS)) NormalLibraryTarget(wine,$(LIBOBJS) $(COMMONOBJS))
#endif #endif
wine.sym: wine
nm wine|sort >wine.sym
clean::
$(RM) wine.sym
depend:: depend::
install:: install::
etags:: etags::
etags `find . -name '*.[chS]'` etags `find . -name '*.[chS]'`

View file

@ -27,4 +27,3 @@ PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS
OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR OTHERWISE PROVIDED BY LAW, NO AUTHOR, COPYRIGHT HOLDER OR
LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF LICENSOR SHALL BE LIABLE TO YOU FOR DAMAGES OF ANY KIND, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

View file

@ -5,19 +5,18 @@ MODULE = controls
SRCS = \ SRCS = \
button.c \ button.c \
combo.c \ combo.c \
desktop.c \
edit.c \
listbox.c \ listbox.c \
menu.c \ menu.c \
scroll.c \ scroll.c \
static.c \ static.c \
edit.c \
desktop.c \
widgets.c widgets.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

File diff suppressed because it is too large Load diff

View file

@ -5,11 +5,6 @@
* *
*/ */
#define DEBUG_COMBO
/*
#define DEBUG_COMBO
*/
static char Copyright[] = "Copyright Martin Ayotte, 1993"; static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <stdio.h> #include <stdio.h>
@ -22,6 +17,11 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "heap.h" #include "heap.h"
#include "win.h" #include "win.h"
#include "prototypes.h" #include "prototypes.h"
#include "stddebug.h"
/* #define DEBUG_COMBO */
/* #undef DEBUG_COMBO */
#include "debug.h"
HBITMAP hComboBit = 0; HBITMAP hComboBit = 0;
@ -34,26 +34,22 @@ int CreateComboStruct(HWND hwnd);
*/ */
LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ) LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{ {
WORD wRet;
RECT rect; RECT rect;
int y, count; int y, count;
int width, height; int width, height;
int AltState;
WND *wndPtr; WND *wndPtr;
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
HDC hDC, hMemDC; HDC hDC;
BITMAP bm; BITMAP bm;
char str[128]; char str[128];
PAINTSTRUCT paintstruct; PAINTSTRUCT paintstruct;
static RECT rectsel; int style;
switch(message) switch(message)
{ {
case WM_CREATE: case WM_CREATE:
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == NULL) return 0; if (wndPtr == NULL) return 0;
#ifdef DEBUG_COMBO dprintf_combo(stddeb,"Combo WM_CREATE %p !\n", lphc);
printf("Combo WM_CREATE %lX !\n", lphc);
#endif
if (hComboBit == (HBITMAP)NULL) if (hComboBit == (HBITMAP)NULL)
hComboBit = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_COMBO)); hComboBit = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_COMBO));
GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm); GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
@ -77,15 +73,21 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - bm.bmHeight, bm.bmHeight, 0, 0, width - bm.bmHeight, bm.bmHeight,
hwnd, 1, wndPtr->hInstance, 0L); hwnd, 1, wndPtr->hInstance, 0L);
style=0;
if ((wndPtr->dwStyle & CBS_HASSTRINGS) == CBS_HASSTRINGS)
style |= LBS_HASSTRINGS;
if ((wndPtr->dwStyle & CBS_OWNERDRAWFIXED) ==CBS_OWNERDRAWFIXED)
style |= LBS_OWNERDRAWFIXED;
if ((wndPtr->dwStyle & CBS_OWNERDRAWVARIABLE)==CBS_OWNERDRAWVARIABLE)
style |= LBS_OWNERDRAWVARIABLE;
lphc->hWndLBox = CreateWindow("LISTBOX", "", lphc->hWndLBox = CreateWindow("LISTBOX", "",
WS_POPUP | WS_BORDER | WS_VSCROLL | LBS_NOTIFY, WS_POPUP | WS_BORDER | WS_VSCROLL | LBS_NOTIFY | style,
rect.left, rect.top + bm.bmHeight, rect.left, rect.top + bm.bmHeight,
width, height, wndPtr->hwndParent, 0, width, height, wndPtr->hwndParent, 0,
wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd)); wndPtr->hInstance, (LPSTR)MAKELONG(0, hwnd));
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
#ifdef DEBUG_COMBO dprintf_combo(stddeb,"Combo Creation LBox=%X!\n",
printf("Combo Creation LBox=%X!\n", lphc->hWndLBox); lphc->hWndLBox);
#endif
return 0; return 0;
case WM_DESTROY: case WM_DESTROY:
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
@ -99,14 +101,11 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
*((LPHEADCOMBO *)&wndPtr->wExtra[1]) = 0; *((LPHEADCOMBO *)&wndPtr->wExtra[1]) = 0;
printf("Combo WM_DESTROY after clearing wExtra !\n"); printf("Combo WM_DESTROY after clearing wExtra !\n");
*/ */
#ifdef DEBUG_COMBO dprintf_combo(stddeb,"Combo WM_DESTROY %p !\n", lphc);
printf("Combo WM_DESTROY %lX !\n", lphc);
#endif
return DefWindowProc( hwnd, message, wParam, lParam ); return DefWindowProc( hwnd, message, wParam, lParam );
case WM_SHOWWINDOW: case WM_SHOWWINDOW:
#ifdef DEBUG_COMBO dprintf_combo(stddeb,"ComboBox WM_SHOWWINDOW hWnd=%04X !\n",
printf("ComboBox WM_SHOWWINDOW hWnd=%04X !\n", hwnd); hwnd);
#endif
if (!(wParam == 0 && lParam == 0L)) { if (!(wParam == 0 && lParam == 0L)) {
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
} }
@ -137,12 +136,12 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
} }
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
printf("Combo WM_LBUTTONDOWN wParam=%x lParam=%lX !\n", wParam, lParam); dprintf_combo(stddeb,"Combo WM_LBUTTONDOWN wParam=%x lParam=%lX !\n", wParam, lParam);
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
rect.left = rect.right - (rect.bottom - rect.top); rect.left = rect.right - (rect.bottom - rect.top);
hDC = GetDC(hwnd); hDC = GetDC(hwnd);
InflateRect(&rect, -1, -1); InflateRect(&rect, -1, -1);
DrawReliefRect(hDC, rect, 1, 1); GRAPH_DrawReliefRect(hDC, &rect, 1, 1);
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
@ -153,27 +152,27 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
SetFocus(lphc->hWndLBox); SetFocus(lphc->hWndLBox);
} }
else { else {
printf("before Combo Restore Focus !\n"); dprintf_combo(stddeb,"before Combo Restore Focus !\n");
SetFocus(lphc->hWndEdit); SetFocus(lphc->hWndEdit);
printf("before Combo List Hide !\n"); dprintf_combo(stddeb,"before Combo List Hide !\n");
ShowWindow(lphc->hWndLBox, SW_HIDE); ShowWindow(lphc->hWndLBox, SW_HIDE);
printf("before Combo List GetCurSel !\n"); dprintf_combo(stddeb,"before Combo List GetCurSel !\n");
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) { if (y != LB_ERR) {
printf("before Combo List GetText !\n"); dprintf_combo(stddeb,"before Combo List GetText !\n");
SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndLBox, LB_GETTEXT, (WORD)y, (LPARAM)str);
SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str); SendMessage(lphc->hWndEdit, WM_SETTEXT, (WORD)y, (LPARAM)str);
} }
printf("End of Combo List Hide !\n"); dprintf_combo(stddeb,"End of Combo List Hide !\n");
} }
break; break;
case WM_LBUTTONUP: case WM_LBUTTONUP:
printf("Combo WM_LBUTTONUP wParam=%x lParam=%lX !\n", wParam, lParam); dprintf_combo(stddeb,"Combo WM_LBUTTONUP wParam=%x lParam=%lX !\n", wParam, lParam);
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
rect.left = rect.right - (rect.bottom - rect.top); rect.left = rect.right - (rect.bottom - rect.top);
hDC = GetDC(hwnd); hDC = GetDC(hwnd);
InflateRect(&rect, -1, -1); InflateRect(&rect, -1, -1);
DrawReliefRect(hDC, rect, 1, 0); GRAPH_DrawReliefRect(hDC, &rect, 1, 0);
ReleaseDC(hwnd, hDC); ReleaseDC(hwnd, hDC);
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
@ -182,7 +181,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L); y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
count = SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L); count = SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L);
printf("COMBOBOX // GetKeyState(VK_MENU)=%d\n", GetKeyState(VK_MENU)); dprintf_combo(stddeb,"COMBOBOX // GetKeyState(VK_MENU)=%d\n", GetKeyState(VK_MENU));
if (GetKeyState(VK_MENU) < 0) { if (GetKeyState(VK_MENU) < 0) {
lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN; lphc->dwState = lphc->dwState ^ CB_SHOWDROPDOWN;
if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) { if ((lphc->dwState & CB_SHOWDROPDOWN) == CB_SHOWDROPDOWN) {
@ -223,21 +222,22 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
} }
break; break;
case WM_MEASUREITEM: case WM_MEASUREITEM:
printf("ComboBoxWndProc WM_MEASUREITEM !\n"); dprintf_combo(stddeb,"ComboBoxWndProc WM_MEASUREITEM !\n");
return(SendMessage(GetParent(hwnd), WM_MEASUREITEM, wParam, lParam)); return(SendMessage(GetParent(hwnd), WM_MEASUREITEM, wParam, lParam));
case WM_CTLCOLOR: case WM_CTLCOLOR:
return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam)); return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam));
case WM_DRAWITEM:
return(SendMessage(GetParent(hwnd), WM_DRAWITEM, wParam, lParam));
case WM_PAINT: case WM_PAINT:
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
hDC = BeginPaint(hwnd, &paintstruct); hDC = BeginPaint(hwnd, &paintstruct);
hMemDC = CreateCompatibleDC(hDC); if (hComboBit != 0) {
if (hMemDC != 0 && hComboBit != 0) {
GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm); GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hComboBit); GRAPH_DrawBitmap( hDC, hComboBit,
BitBlt(hDC, rect.right - bm.bmWidth, 0, rect.right - bm.bmWidth, 0,
bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight,
SRCCOPY );
} }
DeleteDC(hMemDC);
EndPaint(hwnd, &paintstruct); EndPaint(hwnd, &paintstruct);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
@ -264,41 +264,37 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
} }
break; break;
case CB_ADDSTRING: case CB_ADDSTRING:
#ifdef DEBUG_COMBO dprintf_combo(stddeb,"CB_ADDSTRING '%s' !\n", (LPSTR)lParam);
printf("CB_ADDSTRING '%s' !\n", (LPSTR)lParam);
#endif
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_ADDSTRING, wParam, lParam));
case CB_GETLBTEXT: case CB_GETLBTEXT:
#ifdef DEBUG_COMBO dprintf_combo(stddeb,"CB_GETLBTEXT #%u !\n", wParam);
printf("CB_GETLBTEXT #%u !\n", wParam);
#endif
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_GETTEXT, wParam, lParam));
case CB_GETLBTEXTLEN: case CB_GETLBTEXTLEN:
printf("CB_GETLBTEXTLEN !\n"); dprintf_combo(stddeb,"CB_GETLBTEXTLEN !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_GETTEXTLEN, wParam, lParam));
case CB_INSERTSTRING: case CB_INSERTSTRING:
printf("CB_INSERTSTRING '%s' !\n", (LPSTR)lParam); dprintf_combo(stddeb,"CB_INSERTSTRING '%s' !\n",(LPSTR)lParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_INSERTSTRING, wParam, lParam));
case CB_DELETESTRING: case CB_DELETESTRING:
printf("CB_DELETESTRING #%u !\n", wParam); dprintf_combo(stddeb,"CB_DELETESTRING #%u !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_DELETESTRING, wParam, 0L)); return(SendMessage(lphc->hWndLBox, LB_DELETESTRING, wParam, 0L));
case CB_RESETCONTENT: case CB_RESETCONTENT:
printf("CB_RESETCONTENT !\n"); dprintf_combo(stddeb,"CB_RESETCONTENT !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L)); return(SendMessage(lphc->hWndLBox, LB_RESETCONTENT, 0, 0L));
case CB_DIR: case CB_DIR:
printf("ComboBox CB_DIR !\n"); dprintf_combo(stddeb,"ComboBox CB_DIR !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_DIR, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_DIR, wParam, lParam));
@ -310,34 +306,35 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L)); return(SendMessage(lphc->hWndLBox, LB_GETCOUNT, 0, 0L));
case CB_GETCURSEL: case CB_GETCURSEL:
printf("ComboBox CB_GETCURSEL !\n"); dprintf_combo(stddeb,"ComboBox CB_GETCURSEL !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L)); return(SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L));
case CB_SETCURSEL: case CB_SETCURSEL:
printf("ComboBox CB_SETCURSEL wParam=%X !\n", wParam); dprintf_combo(stddeb,"ComboBox CB_SETCURSEL wParam=%X !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_SETCURSEL, wParam, 0L)); return(SendMessage(lphc->hWndLBox, LB_SETCURSEL, wParam, 0L));
case CB_GETEDITSEL: case CB_GETEDITSEL:
printf("ComboBox CB_GETEDITSEL !\n"); dprintf_combo(stddeb,"ComboBox CB_GETEDITSEL !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
/* return(SendMessage(lphc->hWndEdit, EM_GETSEL, 0, 0L)); */ /* return(SendMessage(lphc->hWndEdit, EM_GETSEL, 0, 0L)); */
break; break;
case CB_SETEDITSEL: case CB_SETEDITSEL:
printf("ComboBox CB_SETEDITSEL lParam=%lX !\n", lParam); dprintf_combo(stddeb,"ComboBox CB_SETEDITSEL lParam=%lX !\n",
lParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
/* return(SendMessage(lphc->hWndEdit, EM_SETSEL, 0, lParam)); */ /* return(SendMessage(lphc->hWndEdit, EM_SETSEL, 0, lParam)); */
break; break;
case CB_SELECTSTRING: case CB_SELECTSTRING:
printf("ComboBox CB_SELECTSTRING !\n"); dprintf_combo(stddeb,"ComboBox CB_SELECTSTRING !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
break; break;
case CB_SHOWDROPDOWN: case CB_SHOWDROPDOWN:
printf("ComboBox CB_SHOWDROPDOWN !\n"); dprintf_combo(stddeb,"ComboBox CB_SHOWDROPDOWN !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
lphc->dwState = lphc->dwState | CB_SHOWDROPDOWN; lphc->dwState = lphc->dwState | CB_SHOWDROPDOWN;
@ -352,19 +349,19 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
} }
break; break;
case CB_GETITEMDATA: case CB_GETITEMDATA:
printf("ComboBox CB_GETITEMDATA wParam=%X !\n", wParam); dprintf_combo(stddeb,"ComboBox CB_GETITEMDATA wParam=%X !\n", wParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0L)); return(SendMessage(lphc->hWndLBox, LB_GETITEMDATA, wParam, 0L));
break; break;
case CB_SETITEMDATA: case CB_SETITEMDATA:
printf("ComboBox CB_SETITEMDATA wParam=%X lParam=%lX !\n", wParam, lParam); dprintf_combo(stddeb,"ComboBox CB_SETITEMDATA wParam=%04X lParam=%08lX!\n", wParam, lParam);
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
return(SendMessage(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam)); return(SendMessage(lphc->hWndLBox, LB_SETITEMDATA, wParam, lParam));
break; break;
case CB_LIMITTEXT: case CB_LIMITTEXT:
printf("ComboBox CB_LIMITTEXT !\n"); dprintf_combo(stddeb,"ComboBox CB_LIMITTEXT !\n");
lphc = ComboGetStorageHeader(hwnd); lphc = ComboGetStorageHeader(hwnd);
if (lphc == NULL) return 0; if (lphc == NULL) return 0;
/* return(SendMessage(lphc->hWndEdit, EM_LIMITTEXT, wParam, 0L)); */ /* return(SendMessage(lphc->hWndEdit, EM_LIMITTEXT, wParam, 0L)); */
@ -384,7 +381,7 @@ LPHEADCOMBO ComboGetStorageHeader(HWND hwnd)
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == 0) { if (wndPtr == 0) {
printf("Bad Window handle on ComboBox !\n"); fprintf(stderr,"Bad Window handle on ComboBox !\n");
return 0; return 0;
} }
lphc = *((LPHEADCOMBO *)&wndPtr->wExtra[1]); lphc = *((LPHEADCOMBO *)&wndPtr->wExtra[1]);
@ -399,7 +396,7 @@ int CreateComboStruct(HWND hwnd)
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == 0) { if (wndPtr == 0) {
printf("Bad Window handle on ComboBox !\n"); fprintf(stderr,"Bad Window handle on ComboBox !\n");
return 0; return 0;
} }
lphc = (LPHEADCOMBO)malloc(sizeof(HEADCOMBO)); lphc = (LPHEADCOMBO)malloc(sizeof(HEADCOMBO));
@ -415,7 +412,8 @@ int CreateComboStruct(HWND hwnd)
*/ */
BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, int nIDLBox) BOOL DlgDirSelectComboBox(HWND hDlg, LPSTR lpStr, int nIDLBox)
{ {
printf("DlgDirSelectComboBox(%04X, '%s', %d) \n", hDlg, lpStr, nIDLBox); fprintf(stdnimp,"DlgDirSelectComboBox(%04X, '%s', %d) \n",
hDlg, lpStr, nIDLBox);
} }
@ -427,7 +425,7 @@ int DlgDirListComboBox(HWND hDlg, LPSTR lpPathSpec,
{ {
HWND hWnd; HWND hWnd;
LPHEADCOMBO lphc; LPHEADCOMBO lphc;
printf("DlgDirListComboBox(%04X, '%s', %d, %d, %04X) \n", dprintf_combo(stddeb,"DlgDirListComboBox(%04X, '%s', %d, %d, %04X) \n",
hDlg, lpPathSpec, nIDLBox, nIDStat, wType); hDlg, lpPathSpec, nIDLBox, nIDStat, wType);
hWnd = GetDlgItem(hDlg, nIDLBox); hWnd = GetDlgItem(hDlg, nIDLBox);
lphc = ComboGetStorageHeader(hWnd); lphc = ComboGetStorageHeader(hWnd);

View file

@ -10,6 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "win.h" #include "win.h"
#include "desktop.h" #include "desktop.h"
#include "prototypes.h" #include "prototypes.h"
@ -213,7 +214,7 @@ BOOL DESKTOP_SetPattern(char *pattern )
int i; int i;
for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff; for (i = 0; i < 8; i++) pattern[i] = pat[i] & 0xffff;
hbitmap = CreateBitmap( 8, 8, 1, 1, pattern ); hbitmap = CreateBitmap( 8, 8, 1, 1, (LPSTR)pattern );
infoPtr->hbrushPattern = CreatePatternBrush( hbitmap ); infoPtr->hbrushPattern = CreatePatternBrush( hbitmap );
DeleteObject( hbitmap ); DeleteObject( hbitmap );
} }

View file

@ -8,6 +8,7 @@
static char Copyright[] = "Copyright David W. Metcalfe, 1994"; static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <windows.h> #include <windows.h>
@ -16,8 +17,11 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
#include "class.h" #include "class.h"
#include "user.h" #include "user.h"
#include "scroll.h" #include "scroll.h"
#include "stddebug.h"
/* #define DEBUG_EDIT /* */ /* #define DEBUG_EDIT /* */
/* #undef DEBUG_EDIT /* */
#include "debug.h"
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \ #define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
SendMessage(GetParent(hWndCntrl), WM_COMMAND, \ SendMessage(GetParent(hWndCntrl), WM_COMMAND, \
@ -190,7 +194,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_FMTLINES: case EM_FMTLINES:
printf("edit: EM_FMTLINES message received\n"); fprintf(stdnimp,"edit: EM_FMTLINES message received\n");
if (!wParam) if (!wParam)
lResult = 1L; lResult = 1L;
else else
@ -224,7 +228,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_GETPASSWORDCHAR: case EM_GETPASSWORDCHAR:
printf("edit: cannot process EM_GETPASSWORDCHAR message\n"); fprintf(stdnimp,"edit: cannot process EM_GETPASSWORDCHAR message\n");
break; break;
case EM_GETRECT: case EM_GETRECT:
@ -236,7 +240,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_GETWORDBREAKPROC: case EM_GETWORDBREAKPROC:
printf("edit: cannot process EM_GETWORDBREAKPROC message\n"); fprintf(stdnimp,"edit: cannot process EM_GETWORDBREAKPROC message\n");
break; break;
case EM_LIMITTEXT: case EM_LIMITTEXT:
@ -264,7 +268,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_LINESCROLL: case EM_LINESCROLL:
printf("edit: cannot process EM_LINESCROLL message\n"); fprintf(stdnimp,"edit: cannot process EM_LINESCROLL message\n");
break; break;
case EM_REPLACESEL: case EM_REPLACESEL:
@ -283,16 +287,16 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_SETPASSWORDCHAR: case EM_SETPASSWORDCHAR:
printf("edit: cannot process EM_SETPASSWORDCHAR message\n"); fprintf(stdnimp,"edit: cannot process EM_SETPASSWORDCHAR message\n");
break; break;
case EM_SETREADONLY: case EM_SETREADONLY:
printf("edit: cannot process EM_SETREADONLY message\n"); fprintf(stdnimp,"edit: cannot process EM_SETREADONLY message\n");
break; break;
case EM_SETRECT: case EM_SETRECT:
case EM_SETRECTNP: case EM_SETRECTNP:
printf("edit: cannot process EM_SETRECT(NP) message\n"); fprintf(stdnimp,"edit: cannot process EM_SETRECT(NP) message\n");
break; break;
case EM_SETSEL: case EM_SETSEL:
@ -307,7 +311,7 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
break; break;
case EM_SETWORDBREAKPROC: case EM_SETWORDBREAKPROC:
printf("edit: cannot process EM_SETWORDBREAKPROC message\n"); fprintf(stdnimp,"edit: cannot process EM_SETWORDBREAKPROC message\n");
break; break;
case EM_UNDO: case EM_UNDO:
@ -317,6 +321,9 @@ LONG EditWndProc(HWND hwnd, WORD uMsg, WORD wParam, LONG lParam)
ShowCaret(hwnd); ShowCaret(hwnd);
break; break;
case WM_GETDLGCODE:
return DLGC_HASSETSEL | DLGC_WANTCHARS | DLGC_WANTARROWS;
case WM_CHAR: case WM_CHAR:
EDIT_CharMsg(hwnd, wParam); EDIT_CharMsg(hwnd, wParam);
break; break;
@ -461,11 +468,17 @@ long EDIT_NCCreateMsg(HWND hwnd, LONG lParam)
char *text; char *text;
int len; int len;
/* store pointer to local heap in window structure so that */ /* store pointer to local or global heap in window structure so that */
/* EDITSTATE structure itself can be stored on local heap */ /* EDITSTATE structure itself can be stored on local heap */
if (HEAP_LocalFindHeap(createStruct->hInstance)!=NULL)
(MDESC **)*(LONG *)(wndPtr->wExtra + 2) = (MDESC **)*(LONG *)(wndPtr->wExtra + 2) =
&HEAP_LocalFindHeap(createStruct->hInstance)->free_list; &HEAP_LocalFindHeap(createStruct->hInstance)->free_list;
else
{
(MDESC **)*(LONG *)(wndPtr->wExtra + 2) =
GlobalLock(createStruct->hInstance);
/* GlobalUnlock(createStruct->hInstance); */
}
/* allocate space for state variable structure */ /* allocate space for state variable structure */
(HANDLE)(*(wndPtr->wExtra)) = EDIT_HeapAlloc(hwnd, sizeof(EDITSTATE)); (HANDLE)(*(wndPtr->wExtra)) = EDIT_HeapAlloc(hwnd, sizeof(EDITSTATE));
es = (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); es = (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
@ -647,7 +660,7 @@ void EDIT_BuildTextPointers(HWND hwnd)
/* advance through current line */ /* advance through current line */
while (*cp && *cp != '\n') while (*cp && *cp != '\n')
{ {
len += EDIT_CharWidth(hwnd, *cp, len); len += EDIT_CharWidth(hwnd, (BYTE)*cp, len);
/* width of line in pixels */ /* width of line in pixels */
cp++; cp++;
} }
@ -697,10 +710,8 @@ void EDIT_PaintMsg(HWND hwnd)
hdc = BeginPaint(hwnd, &ps); hdc = BeginPaint(hwnd, &ps);
rc = ps.rcPaint; rc = ps.rcPaint;
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"WM_PAINT: rc=(%d,%d), (%d,%d)\n", rc.left, rc.top,
printf("WM_PAINT: rc=(%d,%d), (%d,%d)\n", rc.left, rc.top,
rc.right, rc.bottom); rc.right, rc.bottom);
#endif
if (es->PaintBkgd) if (es->PaintBkgd)
FillWindow(GetParent(hwnd), hwnd, hdc, CTLCOLOR_EDIT); FillWindow(GetParent(hwnd), hwnd, hdc, CTLCOLOR_EDIT);
@ -728,9 +739,7 @@ HANDLE EDIT_GetTextLine(HWND hwnd, int selection)
int len = 0; int len = 0;
char *cp, *cp1; char *cp, *cp1;
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"GetTextLine %d\n", selection);
printf("GetTextLine %d\n", selection);
#endif
cp = cp1 = EDIT_TextLine(hwnd, selection); cp = cp1 = EDIT_TextLine(hwnd, selection);
/* advance through line */ /* advance through line */
while (*cp && *cp != '\n') while (*cp && *cp != '\n')
@ -783,11 +792,9 @@ int EDIT_StrLength(HWND hwnd, char *str, int len, int pcol)
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
plen += EDIT_CharWidth(hwnd, *(str + i), pcol + plen); plen += EDIT_CharWidth(hwnd, (BYTE)(*(str + i)), pcol + plen);
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_StrLength: returning %d\n", plen);
printf("EDIT_StrLength: returning %d\n", plen);
#endif
return plen; return plen;
} }
@ -838,42 +845,32 @@ void EDIT_WriteTextLine(HWND hwnd, RECT *rect, int y)
else else
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"WriteTextLine %d\n", y);
printf("WriteTextLine %d\n", y);
#endif
/* make sure y is inside the window */ /* make sure y is inside the window */
if (y < es->wtop || y > (es->wtop + ClientHeight(wndPtr, es))) if (y < es->wtop || y > (es->wtop + ClientHeight(wndPtr, es)))
{ {
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_WriteTextLine: y (%d) is not a displayed line\n", y);
printf("EDIT_WriteTextLine: y (%d) is not a displayed line\n", y);
#endif
return; return;
} }
/* make sure rectangle is within window */ /* make sure rectangle is within window */
if (rc.left >= ClientWidth(wndPtr) - 1) if (rc.left >= ClientWidth(wndPtr) - 1)
{ {
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.left (%d) is greater than right edge\n",
printf("EDIT_WriteTextLine: rc.left (%d) is greater than right edge\n",
rc.left); rc.left);
#endif
return; return;
} }
if (rc.right <= 0) if (rc.right <= 0)
{ {
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_WriteTextLine: rc.right (%d) is less than left edge\n",
printf("EDIT_WriteTextLine: rc.right (%d) is less than left edge\n",
rc.right); rc.right);
#endif
return; return;
} }
if (y - es->wtop < (rc.top / es->txtht) || if (y - es->wtop < (rc.top / es->txtht) ||
y - es->wtop > (rc.bottom / es->txtht)) y - es->wtop > (rc.bottom / es->txtht))
{ {
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_WriteTextLine: y (%d) is outside window\n", y);
printf("EDIT_WriteTextLine: y (%d) is outside window\n", y);
#endif
return; return;
} }
@ -1010,9 +1007,7 @@ void EDIT_WriteText(HWND hwnd, char *lp, int off, int len, int row,
short *charWidths = (short *)EDIT_HeapAddr(hwnd, es->hCharWidths); short *charWidths = (short *)EDIT_HeapAddr(hwnd, es->hCharWidths);
char *blanks = (char *)EDIT_HeapAddr(hwnd, es->hBlankLine); char *blanks = (char *)EDIT_HeapAddr(hwnd, es->hBlankLine);
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_WriteText lp=%s, off=%d, len=%d, row=%d, col=%d, reverse=%d\n", lp, off, len, row, col, reverse);
printf("EDIT_WriteText lp=%s, off=%d, len=%d, row=%d, col=%d, reverse=%d\n", lp, off, len, row, col, reverse);
#endif
hdc = GetDC(hwnd); hdc = GetDC(hwnd);
hStr = EDIT_GetStr(hwnd, lp, off, len, &diff); hStr = EDIT_GetStr(hwnd, lp, off, len, &diff);
@ -1111,14 +1106,12 @@ HANDLE EDIT_GetStr(HWND hwnd, char *lp, int off, int len, int *diff)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_GetStr %s %d %d\n", lp, off, len);
printf("EDIT_GetStr %s %d %d\n", lp, off, len);
#endif
while (i < off) while (i < off)
{ {
s_i = i; s_i = i;
i += EDIT_CharWidth(hwnd, *(lp + ch), i); i += EDIT_CharWidth(hwnd, (BYTE)(*(lp + ch)), i);
ch++; ch++;
} }
@ -1133,7 +1126,7 @@ HANDLE EDIT_GetStr(HWND hwnd, char *lp, int off, int len, int *diff)
while (i < len + off) while (i < len + off)
{ {
i += EDIT_CharWidth(hwnd, *(lp + ch), i); i += EDIT_CharWidth(hwnd, (BYTE)(*(lp + ch)), i);
ch++; ch++;
} }
@ -1142,9 +1135,7 @@ HANDLE EDIT_GetStr(HWND hwnd, char *lp, int off, int len, int *diff)
for (i = ch1, j = 0; i < ch; i++, j++) for (i = ch1, j = 0; i < ch; i++, j++)
str[j] = lp[i]; str[j] = lp[i];
str[++j] = '\0'; str[++j] = '\0';
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_GetStr: returning %s\n", str);
printf("EDIT_GetStr: returning %s\n", str);
#endif
return hStr; return hStr;
} }
@ -1159,9 +1150,7 @@ void EDIT_CharMsg(HWND hwnd, WORD wParam)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_CharMsg: wParam=%c\n", (char)wParam);
printf("EDIT_CharMsg: wParam=%c\n", (char)wParam);
#endif
switch (wParam) switch (wParam)
{ {
@ -1203,9 +1192,7 @@ void EDIT_KeyTyped(HWND hwnd, short ch)
RECT rc; RECT rc;
BOOL FullPaint = FALSE; BOOL FullPaint = FALSE;
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_KeyTyped: ch=%c\n", (char)ch);
printf("EDIT_KeyTyped: ch=%c\n", (char)ch);
#endif
/* delete selected text (if any) */ /* delete selected text (if any) */
if (SelMarked(es)) if (SelMarked(es))
@ -1294,14 +1281,14 @@ void EDIT_KeyTyped(HWND hwnd, short ch)
/* test end of window */ /* test end of window */
if (es->WndCol >= ClientWidth(wndPtr) - if (es->WndCol >= ClientWidth(wndPtr) -
EDIT_CharWidth(hwnd, ch, es->WndCol + es->wleft)) EDIT_CharWidth(hwnd, (BYTE)ch, es->WndCol + es->wleft))
{ {
/* TODO:- Word wrap to be handled here */ /* TODO:- Word wrap to be handled here */
/* if (!(currchar == text + es->MaxTextLen - 2)) */ /* if (!(currchar == text + es->MaxTextLen - 2)) */
EDIT_KeyHScroll(hwnd, SB_LINEDOWN); EDIT_KeyHScroll(hwnd, SB_LINEDOWN);
} }
es->WndCol += EDIT_CharWidth(hwnd, ch, es->WndCol + es->wleft); es->WndCol += EDIT_CharWidth(hwnd, (BYTE)ch, es->WndCol + es->wleft);
es->CurrCol++; es->CurrCol++;
SetCaretPos(es->WndCol, es->WndRow * es->txtht); SetCaretPos(es->WndCol, es->WndRow * es->txtht);
ShowCaret(hwnd); ShowCaret(hwnd);
@ -1385,7 +1372,7 @@ void EDIT_Forward(HWND hwnd)
} }
else else
{ {
es->WndCol += EDIT_CharWidth(hwnd, *CurrChar, es->WndCol + es->wleft); es->WndCol += EDIT_CharWidth(hwnd, (BYTE)(*CurrChar), es->WndCol + es->wleft);
es->CurrCol++; es->CurrCol++;
if (es->WndCol >= ClientWidth(wndPtr)) if (es->WndCol >= ClientWidth(wndPtr))
EDIT_KeyHScroll(hwnd, SB_LINEDOWN); EDIT_KeyHScroll(hwnd, SB_LINEDOWN);
@ -1406,9 +1393,8 @@ void EDIT_Downward(HWND hwnd)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_Downward: WndRow=%d, wtop=%d, wlines=%d\n",
printf("EDIT_Downward: WndRow=%d, wtop=%d, wlines=%d\n", es->WndRow, es->wtop, es->wlines); es->WndRow, es->wtop, es->wlines);
#endif
if (IsMultiLine() && (es->WndRow + es->wtop + 1 < es->wlines)) if (IsMultiLine() && (es->WndRow + es->wtop + 1 < es->wlines))
{ {
@ -1469,12 +1455,12 @@ void EDIT_Backward(HWND hwnd)
{ {
--es->CurrCol; --es->CurrCol;
if (*CurrChar == VK_TAB) if (*CurrChar == VK_TAB)
es->WndCol -= EDIT_CharWidth(hwnd, *CurrChar, es->WndCol -= EDIT_CharWidth(hwnd, (BYTE)(*CurrChar),
EDIT_StrLength(hwnd, EDIT_StrLength(hwnd,
EDIT_TextLine(hwnd, es->CurrLine), EDIT_TextLine(hwnd, es->CurrLine),
es->CurrCol, 0)); es->CurrCol, 0));
else else
es->WndCol -= EDIT_CharWidth(hwnd, *CurrChar, 0); es->WndCol -= EDIT_CharWidth(hwnd, (BYTE)(*CurrChar), 0);
if (es->WndCol < 0) if (es->WndCol < 0)
EDIT_KeyHScroll(hwnd, SB_LINEUP); EDIT_KeyHScroll(hwnd, SB_LINEUP);
} }
@ -1502,7 +1488,7 @@ void EDIT_End(HWND hwnd)
while (*CurrChar && *CurrChar != '\n') while (*CurrChar && *CurrChar != '\n')
{ {
es->WndCol += EDIT_CharWidth(hwnd, *CurrChar, es->WndCol + es->wleft); es->WndCol += EDIT_CharWidth(hwnd, (BYTE)(*CurrChar), es->WndCol + es->wleft);
es->CurrCol++; es->CurrCol++;
} }
@ -1583,9 +1569,7 @@ void EDIT_KeyDownMsg(HWND hwnd, WORD wParam)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_KeyDownMsg: key=%x\n", wParam);
printf("EDIT_KeyDownMsg: key=%x\n", wParam);
#endif
HideCaret(hwnd); HideCaret(hwnd);
switch (wParam) switch (wParam)
@ -2014,9 +1998,7 @@ void EDIT_VScrollLine(HWND hwnd, WORD opt)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_VScrollLine: direction=%d\n", opt);
printf("EDIT_VScrollLine: direction=%d\n", opt);
#endif
if (opt == SB_LINEDOWN) if (opt == SB_LINEDOWN)
{ {
@ -2222,15 +2204,13 @@ int EDIT_PixelToChar(HWND hwnd, int row, int *pixel)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_PixelToChar: row=%d, pixel=%d\n", row, *pixel);
printf("EDIT_PixelToChar: row=%d, pixel=%d\n", row, *pixel);
#endif
text = EDIT_TextLine(hwnd, row); text = EDIT_TextLine(hwnd, row);
while (i < *pixel) while (i < *pixel)
{ {
s_i = i; s_i = i;
i += EDIT_CharWidth(hwnd, *(text + ch), i); i += EDIT_CharWidth(hwnd, (BYTE)(*(text + ch)), i);
ch++; ch++;
} }
@ -2581,9 +2561,7 @@ void EDIT_ExtendSel(HWND hwnd, int x, int y)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_ExtendSel: x=%d, y=%d\n", x, y);
printf("EDIT_ExtendSel: x=%d, y=%d\n", x, y);
#endif
bbl = es->SelEndLine; bbl = es->SelEndLine;
bbc = es->SelEndCol; bbc = es->SelEndCol;
@ -2657,9 +2635,7 @@ void EDIT_WriteSel(HWND hwnd, int y, int start, int end)
EDITSTATE *es = EDITSTATE *es =
(EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra))); (EDITSTATE *)EDIT_HeapAddr(hwnd, (HANDLE)(*(wndPtr->wExtra)));
#ifdef DEBUG_EDIT dprintf_edit(stddeb,"EDIT_WriteSel: y=%d start=%d end=%d\n", y, start,end);
printf("EDIT_WriteSel: y=%d start=%d end=%d\n", y, start, end);
#endif
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
/* make sure y is within the window */ /* make sure y is within the window */
@ -3023,10 +2999,13 @@ LONG EDIT_UndoMsg(HWND hwnd)
unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes) unsigned int EDIT_HeapAlloc(HWND hwnd, int bytes)
{ {
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
unsigned int ret;
return ((unsigned int)HEAP_Alloc((MDESC **) ret = ((unsigned int)HEAP_Alloc((MDESC **)
*(LONG *)(wndPtr->wExtra + 2), *(LONG *)(wndPtr->wExtra + 2),
GMEM_MOVEABLE, bytes) & 0xffff); GMEM_MOVEABLE, bytes) & 0xffff);
if (ret == 0)
printf("EDIT_HeapAlloc: Out of heap-memory\n");
return ret;
} }

View file

@ -5,9 +5,6 @@
* *
*/ */
/*
#define DEBUG_LISTBOX
*/
static char Copyright[] = "Copyright Martin Ayotte, 1993"; static char Copyright[] = "Copyright Martin Ayotte, 1993";
@ -24,6 +21,10 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "listbox.h" #include "listbox.h"
#include "scroll.h" #include "scroll.h"
#include "prototypes.h" #include "prototypes.h"
#include "stddebug.h"
/* #define DEBUG_LISTBOX /* */
/* #undef DEBUG_LISTBOX /* */
#include "debug.h"
#define GMEM_ZEROINIT 0x0040 #define GMEM_ZEROINIT 0x0040
@ -37,7 +38,8 @@ int CreateListBoxStruct(HWND hwnd);
void ListBoxAskMeasure(WND *wndPtr, LPHEADLIST lphl, LPLISTSTRUCT lpls); void ListBoxAskMeasure(WND *wndPtr, LPHEADLIST lphl, LPLISTSTRUCT lpls);
int ListBoxAddString(HWND hwnd, LPSTR newstr); int ListBoxAddString(HWND hwnd, LPSTR newstr);
int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr); int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr);
int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr); int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr, BOOL bItemData);
int ListBoxSetItemData(HWND hwnd, UINT uIndex, DWORD ItemData);
int ListBoxDeleteString(HWND hwnd, UINT uIndex); int ListBoxDeleteString(HWND hwnd, UINT uIndex);
int ListBoxFindString(HWND hwnd, UINT nFirst, LPSTR MatchStr); int ListBoxFindString(HWND hwnd, UINT nFirst, LPSTR MatchStr);
int ListBoxResetContent(HWND hwnd); int ListBoxResetContent(HWND hwnd);
@ -51,6 +53,11 @@ int ListBoxDefaultItem(HWND hwnd, WND *wndPtr,
LPHEADLIST lphl, LPLISTSTRUCT lpls); LPHEADLIST lphl, LPLISTSTRUCT lpls);
int ListBoxFindNextMatch(HWND hwnd, WORD wChar); int ListBoxFindNextMatch(HWND hwnd, WORD wChar);
#define HasStrings(wndPtr) ( \
( ((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) != LBS_OWNERDRAWFIXED) && \
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) != LBS_OWNERDRAWVARIABLE) ) || \
((wndPtr->dwStyle & LBS_HASSTRINGS) == LBS_HASSTRINGS) )
/*********************************************************************** /***********************************************************************
* ListBoxWndProc * ListBoxWndProc
@ -69,9 +76,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
case WM_CREATE: case WM_CREATE:
CreateListBoxStruct(hwnd); CreateListBoxStruct(hwnd);
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox WM_CREATE %lX !\n", lphl);
printf("ListBox WM_CREATE %lX !\n", lphl);
#endif
if (lphl == NULL) return 0; if (lphl == NULL) return 0;
createStruct = (CREATESTRUCT *)lParam; createStruct = (CREATESTRUCT *)lParam;
if (HIWORD(createStruct->lpCreateParams) != 0) if (HIWORD(createStruct->lpCreateParams) != 0)
@ -97,15 +102,12 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ListBoxResetContent(hwnd); ListBoxResetContent(hwnd);
free(lphl); free(lphl);
*((LPHEADLIST *)&wndPtr->wExtra[1]) = 0; *((LPHEADLIST *)&wndPtr->wExtra[1]) = 0;
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox WM_DESTROY %lX !\n", lphl);
printf("ListBox WM_DESTROY %lX !\n", lphl);
#endif
return 0; return 0;
case WM_VSCROLL: case WM_VSCROLL:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox WM_VSCROLL w=%04X l=%08X !\n",
printf("ListBox WM_VSCROLL w=%04X l=%08X !\n", wParam, lParam); wParam, lParam);
#endif
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return 0; if (lphl == NULL) return 0;
y = lphl->FirstVisible; y = lphl->FirstVisible;
@ -141,9 +143,8 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
return 0; return 0;
case WM_HSCROLL: case WM_HSCROLL:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox WM_HSCROLL w=%04X l=%08X !\n",
printf("ListBox WM_HSCROLL w=%04X l=%08X !\n", wParam, lParam); wParam, lParam);
#endif
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetStorageHeader(hwnd);
if (lphl == NULL) return 0; if (lphl == NULL) return 0;
y = lphl->FirstVisible; y = lphl->FirstVisible;
@ -220,7 +221,6 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (lphl == NULL) return 0; if (lphl == NULL) return 0;
SendMessage(lphl->hWndLogicParent, WM_COMMAND, wndPtr->wIDmenu, SendMessage(lphl->hWndLogicParent, WM_COMMAND, wndPtr->wIDmenu,
MAKELONG(hwnd, LBN_DBLCLK)); MAKELONG(hwnd, LBN_DBLCLK));
printf("ListBox Send LBN_DBLCLK !\n");
return 0; return 0;
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if ((wParam & MK_LBUTTON) != 0) { if ((wParam & MK_LBUTTON) != 0) {
@ -276,10 +276,12 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
hWndCtl = GetNextDlgTabItem(lphl->hWndLogicParent, hWndCtl = GetNextDlgTabItem(lphl->hWndLogicParent,
hwnd, !(GetKeyState(VK_SHIFT) < 0)); hwnd, !(GetKeyState(VK_SHIFT) < 0));
SetFocus(hWndCtl); SetFocus(hWndCtl);
#ifdef DEBUG_LISTBOX
if ((GetKeyState(VK_SHIFT) < 0)) if ((GetKeyState(VK_SHIFT) < 0))
printf("ListBox PreviousDlgTabItem %04X !\n", hWndCtl); dprintf_listbox(stddeb,"ListBox PreviousDlgTabItem %04X !\n", hWndCtl);
else else
printf("ListBox NextDlgTabItem %04X !\n", hWndCtl); dprintf_listbox(stddeb,"ListBox NextDlgTabItem %04X !\n", hWndCtl);
#endif
break; break;
case VK_HOME: case VK_HOME:
lphl->ItemFocused = 0; lphl->ItemFocused = 0;
@ -352,29 +354,21 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
StdDrawListBox(hwnd); StdDrawListBox(hwnd);
break; break;
case WM_SETFOCUS: case WM_SETFOCUS:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox WM_SETFOCUS !\n");
printf("ListBox WM_SETFOCUS !\n");
#endif
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
break; break;
case WM_KILLFOCUS: case WM_KILLFOCUS:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox WM_KILLFOCUS !\n");
printf("ListBox WM_KILLFOCUS !\n");
#endif
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
break; break;
case LB_RESETCONTENT: case LB_RESETCONTENT:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox LB_RESETCONTENT !\n");
printf("ListBox LB_RESETCONTENT !\n");
#endif
ListBoxResetContent(hwnd); ListBoxResetContent(hwnd);
return 0; return 0;
case LB_DIR: case LB_DIR:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox LB_DIR !\n");
printf("ListBox LB_DIR !\n");
#endif
wRet = ListBoxDirectory(hwnd, wParam, (LPSTR)lParam); wRet = ListBoxDirectory(hwnd, wParam, (LPSTR)lParam);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
@ -383,16 +377,12 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
wRet = ListBoxAddString(hwnd, (LPSTR)lParam); wRet = ListBoxAddString(hwnd, (LPSTR)lParam);
return wRet; return wRet;
case LB_GETTEXT: case LB_GETTEXT:
wRet = ListBoxGetText(hwnd, wParam, (LPSTR)lParam); wRet = ListBoxGetText(hwnd, wParam, (LPSTR)lParam, FALSE);
#ifdef DEBUG_LISTBOX
printf("ListBox LB_GETTEXT #%u '%s' !\n", wParam, (LPSTR)lParam);
#endif
return wRet; return wRet;
case LB_INSERTSTRING: case LB_INSERTSTRING:
wRet = ListBoxInsertString(hwnd, wParam, (LPSTR)lParam); wRet = ListBoxInsertString(hwnd, wParam, (LPSTR)lParam);
return wRet; return wRet;
case LB_DELETESTRING: case LB_DELETESTRING:
printf("ListBox LB_DELETESTRING #%u !\n", wParam);
wRet = ListBoxDeleteString(hwnd, wParam); wRet = ListBoxDeleteString(hwnd, wParam);
return wRet; return wRet;
case LB_FINDSTRING: case LB_FINDSTRING:
@ -405,13 +395,13 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
return lphl->ItemsCount; return lphl->ItemsCount;
case LB_GETCURSEL: case LB_GETCURSEL:
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetStorageHeader(hwnd);
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox LB_GETCURSEL %u !\n",
printf("ListBox LB_GETCURSEL %u !\n", lphl->ItemFocused); lphl->ItemFocused);
#endif
return lphl->ItemFocused; return lphl->ItemFocused;
case LB_GETHORIZONTALEXTENT: case LB_GETHORIZONTALEXTENT:
return wRet; return wRet;
case LB_GETITEMDATA: case LB_GETITEMDATA:
wRet = ListBoxGetText(hwnd, wParam, (LPSTR)lParam, TRUE);
return wRet; return wRet;
case LB_GETITEMHEIGHT: case LB_GETITEMHEIGHT:
return wRet; return wRet;
@ -441,25 +431,26 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
case LB_SETHORIZONTALEXTENT: case LB_SETHORIZONTALEXTENT:
return wRet; return wRet;
case LB_SETITEMDATA: case LB_SETITEMDATA:
wRet = ListBoxSetItemData(hwnd, wParam, lParam);
return wRet; return wRet;
case LB_SETTABSTOPS: case LB_SETTABSTOPS:
return wRet; return wRet;
case LB_SETCURSEL: case LB_SETCURSEL:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox LB_SETCURSEL wParam=%x !\n",
printf("ListBox LB_SETCURSEL wParam=%x !\n", wParam); wParam);
#endif
wRet = ListBoxSetCurSel(hwnd, wParam); wRet = ListBoxSetCurSel(hwnd, wParam);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
return wRet; return wRet;
case LB_SETSEL: case LB_SETSEL:
printf("ListBox LB_SETSEL wParam=%x lParam=%lX !\n", wParam, lParam); dprintf_listbox(stddeb,"ListBox LB_SETSEL wParam=%x lParam=%lX !\n", wParam, lParam);
wRet = ListBoxSetSel(hwnd, LOWORD(lParam), wParam); wRet = ListBoxSetSel(hwnd, LOWORD(lParam), wParam);
InvalidateRect(hwnd, NULL, TRUE); InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd); UpdateWindow(hwnd);
return wRet; return wRet;
case LB_SETTOPINDEX: case LB_SETTOPINDEX:
printf("ListBox LB_SETTOPINDEX wParam=%x !\n", wParam); dprintf_listbox(stddeb,"ListBox LB_SETTOPINDEX wParam=%x !\n",
wParam);
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetStorageHeader(hwnd);
lphl->FirstVisible = wParam; lphl->FirstVisible = wParam;
wndPtr = WIN_FindWndPtr(hwnd); wndPtr = WIN_FindWndPtr(hwnd);
@ -469,9 +460,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
UpdateWindow(hwnd); UpdateWindow(hwnd);
break; break;
case LB_SETITEMHEIGHT: case LB_SETITEMHEIGHT:
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBox LB_SETITEMHEIGHT wParam=%x lParam=%lX !\n", wParam, lParam);
printf("ListBox LB_SETITEMHEIGHT wParam=%x lParam=%lX !\n", wParam, lParam);
#endif
wRet = ListBoxSetItemHeight(hwnd, wParam, lParam); wRet = ListBoxSetItemHeight(hwnd, wParam, lParam);
return wRet; return wRet;
@ -566,8 +555,8 @@ void StdDrawListBox(HWND hwnd)
dwOldTextColor = SetTextColor(hdc, 0x00FFFFFFL); dwOldTextColor = SetTextColor(hdc, 0x00FFFFFFL);
FillRect(hdc, &lpls->dis.rcItem, GetStockObject(BLACK_BRUSH)); FillRect(hdc, &lpls->dis.rcItem, GetStockObject(BLACK_BRUSH));
} }
TextOut(hdc, rect.left + 5, h + 2, (char *)lpls->dis.itemData, TextOut(hdc, rect.left + 5, h + 2, (char *)lpls->itemText,
strlen((char *)lpls->dis.itemData)); strlen((char *)lpls->itemText));
if (lpls->dis.itemState != 0) { if (lpls->dis.itemState != 0) {
SetTextColor(hdc, dwOldTextColor); SetTextColor(hdc, dwOldTextColor);
} }
@ -597,7 +586,7 @@ EndOfPaint:
void OwnerDrawListBox(HWND hwnd) void OwnerDrawListBox(HWND hwnd)
{ {
WND *wndPtr; WND *wndPtr,*ParentWndPtr;
LPHEADLIST lphl; LPHEADLIST lphl;
LPLISTSTRUCT lpls; LPLISTSTRUCT lpls;
PAINTSTRUCT ps; PAINTSTRUCT ps;
@ -631,34 +620,41 @@ void OwnerDrawListBox(HWND hwnd)
for (i = 1; i <= lphl->ItemsCount; i++) { for (i = 1; i <= lphl->ItemsCount; i++) {
if (i >= lphl->FirstVisible) { if (i >= lphl->FirstVisible) {
lpls->dis.hDC = hdc; lpls->dis.hDC = hdc;
lpls->dis.hwndItem = hwnd;
lpls->dis.CtlType = ODT_LISTBOX;
lpls->dis.itemID = i - 1; lpls->dis.itemID = i - 1;
if ((!lpls->dis.CtlID)&&(lphl->hWndLogicParent))
{
ListBoxGetWindowAndStorage(lphl->hWndLogicParent, &ParentWndPtr);
lpls->dis.CtlID = ParentWndPtr->wIDmenu;
}
h2 = lpls->dis.rcItem.bottom - lpls->dis.rcItem.top; h2 = lpls->dis.rcItem.bottom - lpls->dis.rcItem.top;
lpls->dis.rcItem.top = h; lpls->dis.rcItem.top = h;
lpls->dis.rcItem.bottom = h + h2; lpls->dis.rcItem.bottom = h + h2;
lpls->dis.rcItem.left = rect.left; lpls->dis.rcItem.left = rect.left;
lpls->dis.rcItem.right = rect.right; lpls->dis.rcItem.right = rect.right;
lpls->dis.itemAction = ODA_DRAWENTIRE; lpls->dis.itemAction = ODA_DRAWENTIRE;
if (lpls->dis.itemState != 0) { /* if (lpls->dis.itemState != 0) {
lpls->dis.itemAction |= ODA_SELECT; lpls->dis.itemAction |= ODA_SELECT;
} }
if (lphl->ItemFocused == i - 1) { if (lphl->ItemFocused == i - 1) {
lpls->dis.itemAction |= ODA_FOCUS; lpls->dis.itemAction |= ODA_FOCUS;
} }*/
#ifdef DEBUT_LISTBOX dprintf_listbox(stddeb,"LBOX WM_DRAWITEM #%d left=%d top=%d right=%d bottom=%d !\n",
printf("LBOX WM_DRAWITEM #%d left=%d top=%d right=%d bottom=%d !\n", i-1, lpls->dis.rcItem.left, lpls->dis.rcItem.top,
i, lpls->dis.rcItem.left, lpls->dis.rcItem.top,
lpls->dis.rcItem.right, lpls->dis.rcItem.bottom); lpls->dis.rcItem.right, lpls->dis.rcItem.bottom);
printf("LBOX WM_DRAWITEM Parent=%X &dis=%lX CtlID=%u !\n", dprintf_listbox(stddeb,"LBOX WM_DRAWITEM Parent=%X &dis=%lX CtlID=%u !\n",
hWndParent, (LONG)&lpls->dis, lpls->dis.CtlID); hWndParent, (LONG)&lpls->dis, lpls->dis.CtlID);
printf("LBOX WM_DRAWITEM '%s' !\n", lpls->dis.itemData); dprintf_listbox(stddeb,"LBOX WM_DRAWITEM %08X!\n",lpls->dis.itemData);
#endif if (HasStrings(wndPtr))
SendMessage(lphl->hWndLogicParent, WM_DRAWITEM, i, (LPARAM)&lpls->dis); dprintf_listbox(stddeb," '%s'\n",lpls->itemText);
if (lpls->dis.itemState != 0) { SendMessage(lphl->hWndLogicParent, WM_DRAWITEM, i-1, (LPARAM)&lpls->dis);
/* if (lpls->dis.itemState != 0) {
InvertRect(hdc, &lpls->dis.rcItem); InvertRect(hdc, &lpls->dis.rcItem);
} } */
h += h2; h += h2;
lphl->ItemsVisible++; lphl->ItemsVisible++;
if (h > rect.bottom) goto EndOfPaint; /* if (h > rect.bottom) goto EndOfPaint;*/
} }
if (lpls->lpNext == NULL) goto EndOfPaint; if (lpls->lpNext == NULL) goto EndOfPaint;
lpls = (LPLISTSTRUCT)lpls->lpNext; lpls = (LPLISTSTRUCT)lpls->lpNext;
@ -672,6 +668,7 @@ EndOfPaint:
UpdateWindow(wndPtr->hWndVScroll); UpdateWindow(wndPtr->hWndVScroll);
*/ */
} }
} }
@ -739,7 +736,7 @@ void ListBoxAskMeasure(WND *wndPtr, LPHEADLIST lphl, LPLISTSTRUCT lpls)
HANDLE hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(MEASUREITEMSTRUCT)); HANDLE hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(MEASUREITEMSTRUCT));
measure = (MEASUREITEMSTRUCT *) USER_HEAP_ADDR(hTemp); measure = (MEASUREITEMSTRUCT *) USER_HEAP_ADDR(hTemp);
if (measure == NULL) { if (measure == NULL) {
printf("ListBoxAskMeasure() // Bad allocation of Measure struct !\n"); fprintf(stderr,"ListBoxAskMeasure() // Bad allocation of Measure struct !\n");
return; return;
} }
measure->CtlType = ODT_LISTBOX; measure->CtlType = ODT_LISTBOX;
@ -767,7 +764,7 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT)); hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT));
lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp); lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp);
if (lplsnew == NULL) { if (lplsnew == NULL) {
printf("ListBoxAddString() // Bad allocation of new item !\n"); fprintf(stderr,"ListBoxAddString() // Bad allocation of new item !\n");
return LB_ERRSPACE; return LB_ERRSPACE;
} }
lpls = lphl->lpFirst; lpls = lphl->lpFirst;
@ -780,30 +777,30 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
else else
lphl->lpFirst = lplsnew; lphl->lpFirst = lplsnew;
lphl->ItemsCount++; lphl->ItemsCount++;
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"Items Count = %u\n", lphl->ItemsCount);
printf("Items Count = %u\n", lphl->ItemsCount);
#endif
hTemp = 0; hTemp = 0;
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) { ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew);
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) != LBS_OWNERDRAWFIXED) && if (HasStrings(wndPtr))
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) != LBS_OWNERDRAWVARIABLE)) { {
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, strlen(newstr) + 1); hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, strlen(newstr) + 1);
str = (LPSTR)USER_HEAP_ADDR(hTemp); str = (LPSTR)USER_HEAP_ADDR(hTemp);
if (str == NULL) return LB_ERRSPACE; if (str == NULL) return LB_ERRSPACE;
strcpy(str, newstr); strcpy(str, newstr);
newstr = str; newstr = str;
#ifdef DEBUG_LISTBOX lplsnew->itemText = str;
printf("ListBoxAddString// after strcpy '%s'\n", str); lplsnew->dis.itemData = 0;
#endif dprintf_listbox(stddeb,"ListBoxAddString// after strcpy '%s'\n", str);
} }
else
{
lplsnew->itemText = NULL;
lplsnew->dis.itemData = (DWORD)newstr;
} }
ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew);
lplsnew->hMem = hTemp; lplsnew->hMem = hTemp;
lplsnew->lpNext = NULL; lplsnew->lpNext = NULL;
lplsnew->dis.itemID = lphl->ItemsCount; lplsnew->dis.itemID = lphl->ItemsCount;
lplsnew->dis.itemData = (DWORD)newstr;
lplsnew->hData = hTemp; lplsnew->hData = hTemp;
if ((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE) if (((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE)|| ((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED))
ListBoxAskMeasure(wndPtr, lphl, lplsnew); ListBoxAskMeasure(wndPtr, lphl, lplsnew);
if (wndPtr->dwStyle & WS_VSCROLL) if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount,
@ -821,7 +818,7 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
if (wndPtr->dwStyle & WS_HSCROLL) if (wndPtr->dwStyle & WS_HSCROLL)
ShowScrollBar(hwnd, SB_HORZ, TRUE); ShowScrollBar(hwnd, SB_HORZ, TRUE);
} }
return lphl->ItemsCount; return lphl->ItemsCount-1;
} }
@ -833,12 +830,14 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
HANDLE hTemp; HANDLE hTemp;
LPSTR str; LPSTR str;
UINT Count; UINT Count;
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ListBoxInsertString(%04X, %d, %08X);\n",
printf("ListBoxInsertString(%04X, %d, %08X);\n", hwnd, uIndex, newstr); hwnd, uIndex, newstr);
#endif
if (uIndex == (UINT)-1) return ListBoxAddString(hwnd, newstr); if (uIndex == (UINT)-1) return ListBoxAddString(hwnd, newstr);
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return LB_ERR; if (lphl == NULL) return LB_ERR;
/* The following line will cause problems if the content of the */
/* listbox is sorted by the listbox itself */
if (uIndex == lphl->ItemsCount) return ListBoxAddString(hwnd, newstr);
if (uIndex >= lphl->ItemsCount) return LB_ERR; if (uIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst; lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR; if (lpls == NULL) return LB_ERR;
@ -850,32 +849,44 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT)); hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(LISTSTRUCT));
lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp); lplsnew = (LPLISTSTRUCT) USER_HEAP_ADDR(hTemp);
if (lplsnew == NULL) { if (lplsnew == NULL) {
printf("ListBoxInsertString() // Bad allocation of new item !\n"); fprintf(stderr,"ListBoxInsertString() // Bad allocation of new item !\n");
return LB_ERRSPACE; return LB_ERRSPACE;
} }
ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew); ListBoxDefaultItem(hwnd, wndPtr, lphl, lplsnew);
lplsnew->hMem = hTemp; lplsnew->hMem = hTemp;
if (uIndex == 0)
{
lplsnew->lpNext = lphl->lpFirst;
lphl->lpFirst = lplsnew;
}
else
{
lplsnew->lpNext = lpls->lpNext;
lpls->lpNext = lplsnew; lpls->lpNext = lplsnew;
}
lphl->ItemsCount++; lphl->ItemsCount++;
hTemp = 0; hTemp = 0;
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) { if (HasStrings(wndPtr))
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) != LBS_OWNERDRAWFIXED) && {
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) != LBS_OWNERDRAWVARIABLE)) {
hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, strlen(newstr) + 1); hTemp = USER_HEAP_ALLOC(GMEM_MOVEABLE, strlen(newstr) + 1);
str = (LPSTR)USER_HEAP_ADDR(hTemp); str = (LPSTR)USER_HEAP_ADDR(hTemp);
if (str == NULL) return LB_ERRSPACE; if (str == NULL) return LB_ERRSPACE;
strcpy(str, newstr); strcpy(str, newstr);
newstr = str; newstr = str;
lplsnew->itemText = str;
lplsnew->dis.itemData = 0;
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
printf("ListBoxInsertString // after strcpy '%s'\n", str); printf("ListBoxInsertString // after strcpy '%s'\n", str);
#endif #endif
} }
} else
lplsnew->lpNext = NULL; {
lplsnew->dis.itemID = lphl->ItemsCount; lplsnew->itemText = NULL;
lplsnew->dis.itemData = (DWORD)newstr; lplsnew->dis.itemData = (DWORD)newstr;
}
lplsnew->dis.itemID = lphl->ItemsCount;
lplsnew->hData = hTemp; lplsnew->hData = hTemp;
if ((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE) if (((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE)|| ((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED))
ListBoxAskMeasure(wndPtr, lphl, lplsnew); ListBoxAskMeasure(wndPtr, lphl, lplsnew);
if (wndPtr->dwStyle & WS_VSCROLL) if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount,
@ -896,11 +907,41 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
printf("ListBoxInsertString // count=%d\n", lphl->ItemsCount); printf("ListBoxInsertString // count=%d\n", lphl->ItemsCount);
#endif #endif
return lphl->ItemsCount; return /* lphl->ItemsCount;*/ uIndex;
} }
int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr) int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr, BOOL bItemData)
{
WND *wndPtr;
LPHEADLIST lphl;
LPLISTSTRUCT lpls;
UINT Count;
if (!bItemData)
*OutStr=0;
lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return LB_ERR;
if (uIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
if (uIndex > lphl->ItemsCount) return LB_ERR;
for(Count = 0; Count < uIndex; Count++) {
if (lpls->lpNext == NULL) return LB_ERR;
lpls = (LPLISTSTRUCT)lpls->lpNext;
}
if (bItemData)
return lpls->dis.itemData;
if (!(HasStrings(wndPtr)) )
{
*((long *)OutStr) = lpls->dis.itemData;
return 4;
}
strcpy(OutStr, lpls->itemText);
return strlen(OutStr);
}
int ListBoxSetItemData(HWND hwnd, UINT uIndex, DWORD ItemData)
{ {
WND *wndPtr; WND *wndPtr;
LPHEADLIST lphl; LPHEADLIST lphl;
@ -916,16 +957,8 @@ int ListBoxGetText(HWND hwnd, UINT uIndex, LPSTR OutStr)
if (lpls->lpNext == NULL) return LB_ERR; if (lpls->lpNext == NULL) return LB_ERR;
lpls = (LPLISTSTRUCT)lpls->lpNext; lpls = (LPLISTSTRUCT)lpls->lpNext;
} }
if (((wndPtr->dwStyle & LBS_OWNERDRAWFIXED) == LBS_OWNERDRAWFIXED) || lpls->dis.itemData = ItemData;
((wndPtr->dwStyle & LBS_OWNERDRAWVARIABLE) == LBS_OWNERDRAWVARIABLE)) { return 1;
if ((wndPtr->dwStyle & LBS_HASSTRINGS) != LBS_HASSTRINGS) {
*((long *)OutStr) = lpls->dis.itemData;
return 4;
}
}
strcpy(OutStr, (char *)lpls->dis.itemData);
return strlen(OutStr);
} }
@ -972,17 +1005,25 @@ int ListBoxDeleteString(HWND hwnd, UINT uIndex)
int ListBoxFindString(HWND hwnd, UINT nFirst, LPSTR MatchStr) int ListBoxFindString(HWND hwnd, UINT nFirst, LPSTR MatchStr)
{ {
WND *wndPtr;
LPHEADLIST lphl; LPHEADLIST lphl;
LPLISTSTRUCT lpls; LPLISTSTRUCT lpls;
UINT Count; UINT Count;
lphl = ListBoxGetStorageHeader(hwnd); lphl = ListBoxGetWindowAndStorage(hwnd, &wndPtr);
if (lphl == NULL) return LB_ERR; if (lphl == NULL) return LB_ERR;
if (nFirst > lphl->ItemsCount) return LB_ERR; if (nFirst > lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst; lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR; if (lpls == NULL) return LB_ERR;
Count = 0; Count = 0;
while(lpls != NULL) { while(lpls != NULL) {
if (strcmp((char *)lpls->dis.itemData, MatchStr) == 0) return Count; if (HasStrings(wndPtr))
{
if (strcmp(lpls->itemText, MatchStr) == 0) return Count;
}
else
{
if (lpls->dis.itemData == (DWORD)MatchStr) return Count;
}
lpls = (LPLISTSTRUCT)lpls->lpNext; lpls = (LPLISTSTRUCT)lpls->lpNext;
Count++; Count++;
} }
@ -1004,9 +1045,7 @@ int ListBoxResetContent(HWND hwnd)
lpls2 = lpls; lpls2 = lpls;
lpls = (LPLISTSTRUCT)lpls->lpNext; lpls = (LPLISTSTRUCT)lpls->lpNext;
if (i != 0) { if (i != 0) {
#ifdef DEBUG_LISTBOX dprintf_listbox(stddeb,"ResetContent #%u\n", i);
printf("ResetContent #%u\n", i);
#endif
if (lpls2->hData != 0 && lpls2->hData != lpls2->hMem) if (lpls2->hData != 0 && lpls2->hData != lpls2->hMem)
USER_HEAP_FREE(lpls2->hData); USER_HEAP_FREE(lpls2->hData);
if (lpls2->hMem != 0) USER_HEAP_FREE(lpls2->hMem); if (lpls2->hMem != 0) USER_HEAP_FREE(lpls2->hMem);
@ -1016,8 +1055,8 @@ int ListBoxResetContent(HWND hwnd)
lphl->lpFirst = NULL; lphl->lpFirst = NULL;
lphl->FirstVisible = 1; lphl->FirstVisible = 1;
lphl->ItemsCount = 0; lphl->ItemsCount = 0;
lphl->ItemFocused = 0; lphl->ItemFocused = /*0*/-1;
lphl->PrevFocused = 0; lphl->PrevFocused = /*0*/-1;
if ((wndPtr->dwStyle && LBS_NOTIFY) != 0) if ((wndPtr->dwStyle && LBS_NOTIFY) != 0)
SendMessage(lphl->hWndLogicParent, WM_COMMAND, SendMessage(lphl->hWndLogicParent, WM_COMMAND,
wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE)); wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE));
@ -1123,26 +1162,37 @@ int ListBoxDirectory(HWND hwnd, UINT attrib, LPSTR filespec)
fprintf(stderr,"ListBoxDirectory: %s, %4x\n",filespec,attrib); fprintf(stderr,"ListBoxDirectory: %s, %4x\n",filespec,attrib);
#endif #endif
if ((dp = (struct dosdirent *)DOS_opendir(filespec)) ==NULL) return 0; if ((dp = (struct dosdirent *)DOS_opendir(filespec)) ==NULL) return 0;
while (dp = (struct dosdirent *)DOS_readdir(dp)) { while (dp = (struct dosdirent *)DOS_readdir(dp))
{
if (!dp->inuse) break; if (!dp->inuse) break;
#ifdef DEBUG_LISTBOX #ifdef DEBUG_LISTBOX
printf("ListBoxDirectory %08X '%s' !\n", dp->filename, dp->filename); printf("ListBoxDirectory %08X '%s' !\n", dp->filename, dp->filename);
#endif #endif
if (dp->attribute & FA_DIREC) { if (dp->attribute & FA_DIREC)
if (attrib & DDL_DIRECTORY) { {
if (attrib & DDL_DIRECTORY)
{
sprintf(temp, "[%s]", dp->filename); sprintf(temp, "[%s]", dp->filename);
if ( (wRet = ListBoxAddString(hwnd, temp)) == LB_ERR) break; if ( (wRet = ListBoxAddString(hwnd, temp)) == LB_ERR) break;
} }
} else }
if (attrib & DDL_EXCLUSIVE) { else
if (attrib & (DDL_READWRITE | DDL_READONLY | DDL_HIDDEN | DDL_SYSTEM) ) {
if ( (wRet = ListBoxAddString(hwnd, dp->filename)) == LB_ERR) if (attrib & DDL_EXCLUSIVE)
break; {
} else { if (attrib & (DDL_READWRITE | DDL_READONLY | DDL_HIDDEN |
DDL_SYSTEM) )
if ( (wRet = ListBoxAddString(hwnd, dp->filename))
== LB_ERR)
break;
}
else
{
if ( (wRet = ListBoxAddString(hwnd, dp->filename)) == LB_ERR) if ( (wRet = ListBoxAddString(hwnd, dp->filename)) == LB_ERR)
break; break;
} }
} }
}
DOS_closedir(dp); DOS_closedir(dp);
if (attrib & DDL_DRIVES) if (attrib & DDL_DRIVES)
@ -1221,7 +1271,7 @@ int ListBoxDefaultItem(HWND hwnd, WND *wndPtr,
{ {
RECT rect; RECT rect;
if (wndPtr == NULL || lphl == NULL || lpls == NULL) { if (wndPtr == NULL || lphl == NULL || lpls == NULL) {
printf("ListBoxDefaultItem() // Bad Pointers !\n"); fprintf(stderr,"ListBoxDefaultItem() // Bad Pointers !\n");
return FALSE; return FALSE;
} }
GetClientRect(hwnd, &rect); GetClientRect(hwnd, &rect);
@ -1259,7 +1309,7 @@ int ListBoxFindNextMatch(HWND hwnd, WORD wChar)
Count = 0; Count = 0;
while(lpls != NULL) { while(lpls != NULL) {
if (Count > lphl->ItemFocused) { if (Count > lphl->ItemFocused) {
if (*((char *)lpls->dis.itemData) == (char)wChar) { if (*(lpls->itemText) == (char)wChar) {
lphl->FirstVisible = Count - lphl->ItemsVisible / 2; lphl->FirstVisible = Count - lphl->ItemsVisible / 2;
if (lphl->FirstVisible < 1) lphl->FirstVisible = 1; if (lphl->FirstVisible < 1) lphl->FirstVisible = 1;
if ((wndPtr->dwStyle & LBS_MULTIPLESEL) == LBS_MULTIPLESEL) { if ((wndPtr->dwStyle & LBS_MULTIPLESEL) == LBS_MULTIPLESEL) {
@ -1280,7 +1330,7 @@ int ListBoxFindNextMatch(HWND hwnd, WORD wChar)
Count = 0; Count = 0;
lpls = lphl->lpFirst; lpls = lphl->lpFirst;
while(lpls != NULL) { while(lpls != NULL) {
if (*((char *)lpls->dis.itemData) == (char)wChar) { if (*(lpls->itemText) == (char)wChar) {
if (Count == lphl->ItemFocused) return LB_ERR; if (Count == lphl->ItemFocused) return LB_ERR;
lphl->FirstVisible = Count - lphl->ItemsVisible / 2; lphl->FirstVisible = Count - lphl->ItemsVisible / 2;
if (lphl->FirstVisible < 1) lphl->FirstVisible = 1; if (lphl->FirstVisible < 1) lphl->FirstVisible = 1;
@ -1307,7 +1357,7 @@ int ListBoxFindNextMatch(HWND hwnd, WORD wChar)
*/ */
BOOL DlgDirSelect(HWND hDlg, LPSTR lpStr, int nIDLBox) BOOL DlgDirSelect(HWND hDlg, LPSTR lpStr, int nIDLBox)
{ {
printf("DlgDirSelect(%04X, '%s', %d) \n", hDlg, lpStr, nIDLBox); fprintf(stdnimp,"DlgDirSelect(%04X, '%s', %d) \n", hDlg, lpStr, nIDLBox);
} }
@ -1318,11 +1368,27 @@ int DlgDirList(HWND hDlg, LPSTR lpPathSpec,
int nIDLBox, int nIDStat, WORD wType) int nIDLBox, int nIDStat, WORD wType)
{ {
HWND hWnd; HWND hWnd;
printf("DlgDirList(%04X, '%s', %d, %d, %04X) \n", int ret;
dprintf_listbox(stddeb,"DlgDirList(%04X, '%s', %d, %d, %04X) \n",
hDlg, lpPathSpec, nIDLBox, nIDStat, wType); hDlg, lpPathSpec, nIDLBox, nIDStat, wType);
if (nIDLBox)
hWnd = GetDlgItem(hDlg, nIDLBox); hWnd = GetDlgItem(hDlg, nIDLBox);
else
hWnd = 0;
if (hWnd)
ListBoxResetContent(hWnd); ListBoxResetContent(hWnd);
return ListBoxDirectory(hWnd, wType, lpPathSpec); if (hWnd)
ret=ListBoxDirectory(hWnd, wType, lpPathSpec);
else
ret=0;
if (nIDStat)
{
int drive;
drive = DOS_GetDefaultDrive();
SendDlgItemMessage(hDlg, nIDStat, WM_SETTEXT, 0,
(LONG) DOS_GetCurrentDir(drive) );
}
return ret;
} }

View file

@ -11,9 +11,6 @@ static char Copyright2[] = "Copyright Alexandre Julliard, 1994";
* This is probably not the meaning this style has in MS-Windows. * This is probably not the meaning this style has in MS-Windows.
*/ */
/*
#define DEBUG_MENU
*/
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
@ -27,6 +24,14 @@ static char Copyright2[] = "Copyright Alexandre Julliard, 1994";
#include "user.h" #include "user.h"
#include "win.h" #include "win.h"
#include "message.h" #include "message.h"
#include "debug.h"
/* #define DEBUG_MENU /* */
/* #undef DEBUG_MENU /* */
/* #define DEBUG_MENUCALC /* */
/* #undef DEBUG_MENUCALC /* */
/* #define DEBUG_MENUSHORTCUT /* */
/* #undef DEBUG_MENUSHORTCUT /* */
/* Dimension of the menu bitmaps */ /* Dimension of the menu bitmaps */
static WORD check_bitmap_width = 0, check_bitmap_height = 0; static WORD check_bitmap_width = 0, check_bitmap_height = 0;
@ -95,7 +100,7 @@ BOOL MENU_Init()
if (!(hSysMenu = LoadMenu( hSysRes, "SYSMENU" ))) if (!(hSysMenu = LoadMenu( hSysRes, "SYSMENU" )))
{ {
printf("SysMenu not found in system resources !\n"); fprintf(stderr,"SysMenu not found in system resources !\n");
return FALSE; return FALSE;
} }
@ -373,10 +378,8 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, LPPOPUPMENU lppop,
if ((lprect == NULL) || (lppop == NULL)) return; if ((lprect == NULL) || (lppop == NULL)) return;
if (lppop->nItems == 0) return; if (lppop->nItems == 0) return;
#ifdef DEBUG_MENUCALC dprintf_menucalc(stddeb,"MenuBarCalcSize left=%d top=%d right=%d bottom=%d !\n",
printf("MenuBarCalcSize left=%d top=%d right=%d bottom=%d !\n",
lprect->left, lprect->top, lprect->right, lprect->bottom); lprect->left, lprect->top, lprect->right, lprect->bottom);
#endif
items = (MENUITEM *)USER_HEAP_ADDR( lppop->hItems ); items = (MENUITEM *)USER_HEAP_ADDR( lppop->hItems );
lppop->Width = lprect->right - lprect->left; lppop->Width = lprect->right - lprect->left;
lppop->Height = 0; lppop->Height = 0;
@ -602,9 +605,8 @@ WORD MENU_DrawMenuBar(HDC hDC, LPRECT lprect, HWND hwnd, BOOL suppress_draw)
lppop = (LPPOPUPMENU) USER_HEAP_ADDR( wndPtr->wIDmenu ); lppop = (LPPOPUPMENU) USER_HEAP_ADDR( wndPtr->wIDmenu );
if (lppop == NULL || lprect == NULL) return SYSMETRICS_CYMENU; if (lppop == NULL || lprect == NULL) return SYSMETRICS_CYMENU;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"MENU_DrawMenuBar(%04X, %08X, %08X); !\n",
printf("MENU_DrawMenuBar(%04X, %08X, %08X); !\n", hDC, lprect, lppop); hDC, lprect, lppop);
#endif
if (lppop->Height == 0) MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd); if (lppop->Height == 0) MENU_MenuBarCalcSize(hDC, lprect, lppop, hwnd);
lprect->bottom = lprect->top + lppop->Height; lprect->bottom = lprect->top + lppop->Height;
if (suppress_draw) return lppop->Height; if (suppress_draw) return lppop->Height;
@ -1481,9 +1483,8 @@ BOOL ChangeMenu(HMENU hMenu, WORD nPos, LPSTR lpNewItem,
BOOL CheckMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags) BOOL CheckMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags)
{ {
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"CheckMenuItem (%04X, %04X, %04X) !\n",
printf("CheckMenuItem (%04X, %04X, %04X) !\n", hMenu, wItemID, wFlags); hMenu, wItemID, wFlags);
#endif
if (!(lpitem = MENU_FindItem(&hMenu, &wItemID, wFlags))) return FALSE; if (!(lpitem = MENU_FindItem(&hMenu, &wItemID, wFlags))) return FALSE;
if (wFlags & MF_CHECKED) lpitem->item_flags |= MF_CHECKED; if (wFlags & MF_CHECKED) lpitem->item_flags |= MF_CHECKED;
else lpitem->item_flags &= ~MF_CHECKED; else lpitem->item_flags &= ~MF_CHECKED;
@ -1497,9 +1498,8 @@ BOOL CheckMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags)
BOOL EnableMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags) BOOL EnableMenuItem(HMENU hMenu, WORD wItemID, WORD wFlags)
{ {
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"EnableMenuItem (%04X, %04X, %04X) !\n",
printf("EnableMenuItem (%04X, %04X, %04X) !\n", hMenu, wItemID, wFlags); hMenu, wItemID, wFlags);
#endif
if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return FALSE; if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return FALSE;
/* We can't have MF_GRAYED and MF_DISABLED together */ /* We can't have MF_GRAYED and MF_DISABLED together */
@ -1527,10 +1527,8 @@ int GetMenuString(HMENU hMenu, WORD wItemID,
{ {
LPMENUITEM lpitem; LPMENUITEM lpitem;
int maxsiz; int maxsiz;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetMenuString(%04X, %04X, %08X, %d, %04X);\n",
printf("GetMenuString(%04X, %04X, %08X, %d, %04X);\n",
hMenu, wItemID, str, nMaxSiz, wFlags); hMenu, wItemID, str, nMaxSiz, wFlags);
#endif
if (str == NULL) return FALSE; if (str == NULL) return FALSE;
lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ); lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags );
if (lpitem != NULL) { if (lpitem != NULL) {
@ -1540,9 +1538,7 @@ int GetMenuString(HMENU hMenu, WORD wItemID,
} }
else else
maxsiz = 0; maxsiz = 0;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetMenuString // Found !\n");
printf("GetMenuString // Found !\n");
#endif
return maxsiz; return maxsiz;
} }
return 0; return 0;
@ -1556,10 +1552,8 @@ BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, WORD wItemID, WORD wHilite)
{ {
LPPOPUPMENU menu; LPPOPUPMENU menu;
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"HiliteMenuItem(%04X, %04X, %04X, %04X);\n",
printf("HiliteMenuItem(%04X, %04X, %04X, %04X);\n",
hWnd, hMenu, wItemID, wHilite); hWnd, hMenu, wItemID, wHilite);
#endif
if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wHilite ))) return FALSE; if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wHilite ))) return FALSE;
if (!(menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return FALSE; if (!(menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return FALSE;
if (menu->FocusedItem == wItemID) return TRUE; if (menu->FocusedItem == wItemID) return TRUE;
@ -1575,9 +1569,8 @@ BOOL HiliteMenuItem(HWND hWnd, HMENU hMenu, WORD wItemID, WORD wHilite)
WORD GetMenuState(HMENU hMenu, WORD wItemID, WORD wFlags) WORD GetMenuState(HMENU hMenu, WORD wItemID, WORD wFlags)
{ {
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetMenuState(%04X, %04X, %04X);\n",
printf("GetMenuState(%04X, %04X, %04X);\n", hMenu, wItemID, wFlags); hMenu, wItemID, wFlags);
#endif
if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1; if (!(lpitem = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
if (lpitem->item_flags & MF_POPUP) if (lpitem->item_flags & MF_POPUP)
{ {
@ -1595,14 +1588,11 @@ WORD GetMenuState(HMENU hMenu, WORD wItemID, WORD wFlags)
WORD GetMenuItemCount(HMENU hMenu) WORD GetMenuItemCount(HMENU hMenu)
{ {
LPPOPUPMENU menu; LPPOPUPMENU menu;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetMenuItemCount(%04X);\n", hMenu);
printf("GetMenuItemCount(%04X);\n", hMenu);
#endif
menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu); menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu);
if (menu == NULL) return (WORD)-1; if (menu == NULL) return (WORD)-1;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetMenuItemCount(%04X) return %d \n",
printf("GetMenuItemCount(%04X) return %d \n", hMenu, menu->nItems); hMenu, menu->nItems);
#endif
return menu->nItems; return menu->nItems;
} }
@ -1615,9 +1605,7 @@ WORD GetMenuItemID(HMENU hMenu, int nPos)
LPPOPUPMENU menu; LPPOPUPMENU menu;
MENUITEM *item; MENUITEM *item;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetMenuItemID(%04X, %d);\n", hMenu, nPos);
printf("GetMenuItemID(%04X, %d);\n", hMenu, nPos);
#endif
if (!(menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return -1; if (!(menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return -1;
if ((nPos < 0) || (nPos >= menu->nItems)) return -1; if ((nPos < 0) || (nPos >= menu->nItems)) return -1;
item = (MENUITEM *) USER_HEAP_ADDR( menu->hItems ); item = (MENUITEM *) USER_HEAP_ADDR( menu->hItems );
@ -1635,14 +1623,12 @@ BOOL InsertMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewIt
MENUITEM *lpitem, *newItems; MENUITEM *lpitem, *newItems;
LPPOPUPMENU menu; LPPOPUPMENU menu;
#ifdef DEBUG_MENU
if (IS_STRING_ITEM(wFlags)) if (IS_STRING_ITEM(wFlags))
printf("InsertMenu (%04X, %04X, %04X, '%s') !\n", dprintf_menu(stddeb,"InsertMenu (%04X, %04X, %04X, '%s') !\n",
hMenu, wFlags, wItemID, lpNewItem); hMenu, wFlags, wItemID, lpNewItem);
else else
printf("InsertMenu (%04X, %04X, %04X, %04X, %08X) !\n", dprintf_menu(stddeb,"InsertMenu (%04X, %04X, %04X, %04X, %08X) !\n",
hMenu, nPos, wFlags, wItemID, lpNewItem); hMenu, nPos, wFlags, wItemID, lpNewItem);
#endif
/* Find where to insert new item */ /* Find where to insert new item */
@ -1724,9 +1710,8 @@ BOOL RemoveMenu(HMENU hMenu, WORD nPos, WORD wFlags)
{ {
LPPOPUPMENU menu; LPPOPUPMENU menu;
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"RemoveMenu (%04X, %04X, %04X) !\n",
printf("RemoveMenu (%04X, %04X, %04X) !\n", hMenu, nPos, wFlags); hMenu, nPos, wFlags);
#endif
if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE; if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
if (!(menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return FALSE; if (!(menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return FALSE;
@ -1774,14 +1759,12 @@ BOOL DeleteMenu(HMENU hMenu, WORD nPos, WORD wFlags)
BOOL ModifyMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewItem) BOOL ModifyMenu(HMENU hMenu, WORD nPos, WORD wFlags, WORD wItemID, LPSTR lpNewItem)
{ {
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU
if (IS_STRING_ITEM(wFlags)) if (IS_STRING_ITEM(wFlags))
printf("ModifyMenu (%04X, %04X, %04X, %04X, '%s') !\n", dprintf_menu(stddeb,"ModifyMenu (%04X, %04X, %04X, %04X, '%s') !\n",
hMenu, nPos, wFlags, wItemID, lpNewItem); hMenu, nPos, wFlags, wItemID, lpNewItem);
else else
printf("ModifyMenu (%04X, %04X, %04X, %04X, %08X) !\n", dprintf_menu(stddeb,"ModifyMenu (%04X, %04X, %04X, %04X, %08X) !\n",
hMenu, nPos, wFlags, wItemID, lpNewItem); hMenu, nPos, wFlags, wItemID, lpNewItem);
#endif
if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE; if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
if (IS_STRING_ITEM(lpitem->item_flags)) USER_HEAP_FREE( lpitem->hText ); if (IS_STRING_ITEM(lpitem->item_flags)) USER_HEAP_FREE( lpitem->hText );
@ -1832,10 +1815,8 @@ BOOL SetMenuItemBitmaps(HMENU hMenu, WORD nPos, WORD wFlags,
HBITMAP hNewCheck, HBITMAP hNewUnCheck) HBITMAP hNewCheck, HBITMAP hNewUnCheck)
{ {
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"SetMenuItemBitmaps (%04X, %04X, %04X, %04X, %08X) !\n",
printf("SetMenuItemBitmaps (%04X, %04X, %04X, %04X, %08X) !\n",
hMenu, nPos, wFlags, hNewCheck, hNewUnCheck); hMenu, nPos, wFlags, hNewCheck, hNewUnCheck);
#endif
if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE; if (!(lpitem = MENU_FindItem( &hMenu, &nPos, wFlags ))) return FALSE;
if (!hNewCheck && !hNewUnCheck) if (!hNewCheck && !hNewUnCheck)
@ -1862,9 +1843,7 @@ HMENU CreateMenu()
{ {
HMENU hMenu; HMENU hMenu;
LPPOPUPMENU menu; LPPOPUPMENU menu;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"CreateMenu !\n");
printf("CreateMenu !\n");
#endif
if (!(hMenu = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(POPUPMENU) ))) if (!(hMenu = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(POPUPMENU) )))
return 0; return 0;
menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu); menu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu);
@ -1878,9 +1857,7 @@ HMENU CreateMenu()
menu->hWnd = 0; menu->hWnd = 0;
menu->hItems = 0; menu->hItems = 0;
menu->FocusedItem = NO_SELECTED_ITEM; menu->FocusedItem = NO_SELECTED_ITEM;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"CreateMenu // return %04X\n", hMenu);
printf("CreateMenu // return %04X\n", hMenu);
#endif
return hMenu; return hMenu;
} }
@ -1891,9 +1868,7 @@ HMENU CreateMenu()
BOOL DestroyMenu(HMENU hMenu) BOOL DestroyMenu(HMENU hMenu)
{ {
LPPOPUPMENU lppop; LPPOPUPMENU lppop;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"DestroyMenu (%04X) !\n", hMenu);
printf("DestroyMenu (%04X) !\n", hMenu);
#endif
if (hMenu == 0) return FALSE; if (hMenu == 0) return FALSE;
lppop = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu); lppop = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu);
if (lppop == NULL) return FALSE; if (lppop == NULL) return FALSE;
@ -1906,44 +1881,15 @@ BOOL DestroyMenu(HMENU hMenu)
for (i = lppop->nItems; i > 0; i--, item++) for (i = lppop->nItems; i > 0; i--, item++)
{ {
if (item->item_flags & MF_POPUP) if (item->item_flags & MF_POPUP)
DestroyMenu( item->item_flags & MF_POPUP ); DestroyMenu( item->item_id );
} }
USER_HEAP_FREE( lppop->hItems ); USER_HEAP_FREE( lppop->hItems );
} }
USER_HEAP_FREE( hMenu ); USER_HEAP_FREE( hMenu );
#ifdef DEBUG_MENU dprintf_menu(stddeb,"DestroyMenu (%04X) // End !\n", hMenu);
printf("DestroyMenu (%04X) // End !\n", hMenu);
#endif
return TRUE; return TRUE;
} }
/**********************************************************************
* LoadMenu [USER.150]
*/
HMENU LoadMenu(HINSTANCE instance, char *menu_name)
{
HMENU hMenu;
HANDLE hMenu_desc;
MENU_HEADER *menu_desc;
#ifdef DEBUG_MENU
if ((LONG)menu_name & 0xFFFF0000L)
printf("LoadMenu: instance %02x, menu '%s'\n", instance, menu_name);
else
printf("LoadMenu: instance %02x, menu '%04X'\n", instance, menu_name);
#endif
if (instance == (HANDLE)NULL) instance = hSysRes;
if (menu_name == NULL ||
(hMenu_desc = RSC_LoadMenu(instance, menu_name)) == 0 ||
(menu_desc = (MENU_HEADER *) GlobalLock(hMenu_desc)) == NULL) {
return 0;
}
hMenu = LoadMenuIndirect((LPSTR)menu_desc);
GlobalUnlock( hMenu_desc );
return hMenu;
}
/********************************************************************** /**********************************************************************
* GetSystemMenu [USER.156] * GetSystemMenu [USER.156]
*/ */
@ -1992,19 +1938,19 @@ BOOL SetMenu(HWND hWnd, HMENU hMenu)
LPPOPUPMENU lpmenu; LPPOPUPMENU lpmenu;
WND * wndPtr = WIN_FindWndPtr(hWnd); WND * wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == NULL) { if (wndPtr == NULL) {
printf("SetMenu(%04X, %04X) // Bad window handle !\n", hWnd, hMenu); fprintf(stderr,"SetMenu(%04X, %04X) // Bad window handle !\n",
hWnd, hMenu);
return FALSE; return FALSE;
} }
#ifdef DEBUG_MENU dprintf_menu(stddeb,"SetMenu(%04X, %04X);\n", hWnd, hMenu);
printf("SetMenu(%04X, %04X);\n", hWnd, hMenu);
#endif
if (GetCapture() == hWnd) ReleaseCapture(); if (GetCapture() == hWnd) ReleaseCapture();
wndPtr->wIDmenu = hMenu; wndPtr->wIDmenu = hMenu;
if (hMenu != 0) if (hMenu != 0)
{ {
lpmenu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu); lpmenu = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu);
if (lpmenu == NULL) { if (lpmenu == NULL) {
printf("SetMenu(%04X, %04X) // Bad menu handle !\n", hWnd, hMenu); fprintf(stderr,"SetMenu(%04X, %04X) // Bad menu handle !\n",
hWnd, hMenu);
return FALSE; return FALSE;
} }
lpmenu->hWnd = hWnd; lpmenu->hWnd = hWnd;
@ -2025,9 +1971,7 @@ HMENU GetSubMenu(HMENU hMenu, short nPos)
{ {
LPPOPUPMENU lppop; LPPOPUPMENU lppop;
LPMENUITEM lpitem; LPMENUITEM lpitem;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"GetSubMenu (%04X, %04X) !\n", hMenu, nPos);
printf("GetSubMenu (%04X, %04X) !\n", hMenu, nPos);
#endif
if (!(lppop = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return 0; if (!(lppop = (LPPOPUPMENU) USER_HEAP_ADDR(hMenu))) return 0;
if ((WORD)nPos >= lppop->nItems) return 0; if ((WORD)nPos >= lppop->nItems) return 0;
lpitem = (MENUITEM *) USER_HEAP_ADDR( lppop->hItems ); lpitem = (MENUITEM *) USER_HEAP_ADDR( lppop->hItems );
@ -2043,15 +1987,12 @@ void DrawMenuBar(HWND hWnd)
{ {
WND *wndPtr; WND *wndPtr;
LPPOPUPMENU lppop; LPPOPUPMENU lppop;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"DrawMenuBar (%04X)\n", hWnd);
printf("DrawMenuBar (%04X)\n", hWnd);
#endif
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr != NULL && (wndPtr->dwStyle & WS_CHILD) == 0 && if (wndPtr != NULL && (wndPtr->dwStyle & WS_CHILD) == 0 &&
wndPtr->wIDmenu != 0) { wndPtr->wIDmenu != 0) {
#ifdef DEBUG_MENU dprintf_menu(stddeb,"DrawMenuBar wIDmenu=%04X \n",
printf("DrawMenuBar wIDmenu=%04X \n", wndPtr->wIDmenu); wndPtr->wIDmenu);
#endif
lppop = (LPPOPUPMENU) USER_HEAP_ADDR(wndPtr->wIDmenu); lppop = (LPPOPUPMENU) USER_HEAP_ADDR(wndPtr->wIDmenu);
if (lppop == NULL) return; if (lppop == NULL) return;
@ -2089,9 +2030,8 @@ HMENU LoadMenuIndirect(LPSTR menu_template)
{ {
HMENU hMenu; HMENU hMenu;
MENU_HEADER *menu_desc; MENU_HEADER *menu_desc;
#ifdef DEBUG_MENU dprintf_menu(stddeb,"LoadMenuIndirect: menu_template '%08X'\n",
printf("LoadMenuIndirect: menu_template '%08X'\n", menu_template); menu_template);
#endif
hMenu = CreateMenu(); hMenu = CreateMenu();
menu_desc = (MENU_HEADER *)menu_template; menu_desc = (MENU_HEADER *)menu_template;
ParseMenuResource((WORD *)(menu_desc + 1), 0, hMenu); ParseMenuResource((WORD *)(menu_desc + 1), 0, hMenu);
@ -2119,9 +2059,7 @@ HMENU CopySysMenu()
AppendMenu( hMenu, item->item_flags, item->item_id, item->item_text ); AppendMenu( hMenu, item->item_flags, item->item_id, item->item_text );
} }
#ifdef DEBUG_MENU dprintf_menu(stddeb,"CopySysMenu hMenu=%04X !\n", hMenu);
printf("CopySysMenu hMenu=%04X !\n", hMenu);
#endif
return hMenu; return hMenu;
} }

View file

@ -7,9 +7,6 @@
* by Peter Broadhurst, 940611 * by Peter Broadhurst, 940611
*/ */
/*
#define DEBUG_SCROLL
*/
static char Copyright[] = "Copyright Martin Ayotte, 1993"; static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <stdlib.h> #include <stdlib.h>
@ -22,6 +19,11 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "heap.h" #include "heap.h"
#include "win.h" #include "win.h"
#include "prototypes.h" #include "prototypes.h"
#include "stddebug.h"
/* #define DEBUG_SCROLL /* */
/* #undef DEBUG_SCROLL /* */
#include "debug.h"
HBITMAP hUpArrow = 0; HBITMAP hUpArrow = 0;
HBITMAP hDnArrow = 0; HBITMAP hDnArrow = 0;
@ -83,16 +85,12 @@ LONG ScrollBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam )
lpCreat->cx, 16, SWP_NOZORDER); lpCreat->cx, 16, SWP_NOZORDER);
} }
CreateScrollBarStruct(hWnd); CreateScrollBarStruct(hWnd);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBar Creation !\n");
printf("ScrollBar Creation !\n");
#endif
return 0; return 0;
case WM_DESTROY: case WM_DESTROY:
lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr); lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr);
if (lphs == 0) return 0; if (lphs == 0) return 0;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBar WM_DESTROY %lX !\n", lphs);
printf("ScrollBar WM_DESTROY %lX !\n", lphs);
#endif
free(lphs); free(lphs);
*((LPHEADSCROLL *)&wndPtr->wExtra[1]) = 0; *((LPHEADSCROLL *)&wndPtr->wExtra[1]) = 0;
return 0; return 0;
@ -116,9 +114,7 @@ LONG ScrollBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam )
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam)); return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
case WM_TIMER: case WM_TIMER:
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBar WM_TIMER wParam=%X lParam=%lX !\n", wParam, lParam);
printf("ScrollBar WM_TIMER wParam=%X lParam=%lX !\n", wParam, lParam);
#endif
lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr); lphs = ScrollBarGetWindowAndStorage(hWnd, &wndPtr);
KillTimer(hWnd, wParam); KillTimer(hWnd, wParam);
switch(lphs->ButtonDown) { switch(lphs->ButtonDown) {
@ -175,67 +171,51 @@ void ScrollBarButtonDown(HWND hWnd, int nBar, int x, int y)
if (nBar == SB_CTL) { if (nBar == SB_CTL) {
hWndParent = GetParent(hWnd); hWndParent = GetParent(hWnd);
dwOwner = MAKELONG(0, lphs->hWndOwner); dwOwner = MAKELONG(0, lphs->hWndOwner);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown SB_CTL // x=%d y=%d\n", x, y);
printf("ScrollBarButtonDown SB_CTL // x=%d y=%d\n", x, y);
#endif
} }
else { else {
hWndParent = hWnd; hWndParent = hWnd;
dwOwner = 0L; dwOwner = 0L;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown SB_?SCROLL // x=%d y=%d\n", x, y);
printf("ScrollBarButtonDown SB_?SCROLL // x=%d y=%d\n", x, y);
#endif
} }
/* /*
SetFocus(lphs->hWndOwner); SetFocus(lphs->hWndOwner);
*/ */
CopyRect(&rect, &lphs->rect); CopyRect(&rect, &lphs->rect);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollDown / x=%d y=%d left=%d top=%d right=%d bottom=%d \n",
printf("ScrollDown / x=%d y=%d left=%d top=%d right=%d bottom=%d \n",
x, y, rect.left, rect.top, rect.right, rect.bottom); x, y, rect.left, rect.top, rect.right, rect.bottom);
#endif
if (lphs->Direction == WM_VSCROLL) { if (lphs->Direction == WM_VSCROLL) {
width = rect.right - rect.left; width = rect.right - rect.left;
if (y <= lphs->rectUp.bottom) { if (y <= lphs->rectUp.bottom) {
lphs->ButtonDown = 1; lphs->ButtonDown = 1;
InvalidateRect(lphs->hWndOwner, &lphs->rectUp, TRUE); InvalidateRect(lphs->hWndOwner, &lphs->rectUp, TRUE);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_LINEUP\n");
printf("ScrollBarButtonDown send SB_LINEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEUP, dwOwner); SB_LINEUP, dwOwner);
} }
if (y >= lphs->rectDown.top) { if (y >= lphs->rectDown.top) {
lphs->ButtonDown = 2; lphs->ButtonDown = 2;
InvalidateRect(lphs->hWndOwner, &lphs->rectDown, TRUE); InvalidateRect(lphs->hWndOwner, &lphs->rectDown, TRUE);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_LINEDOWN\n");
printf("ScrollBarButtonDown send SB_LINEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEDOWN, dwOwner); SB_LINEDOWN, dwOwner);
} }
if (y > lphs->rectUp.bottom && y < (lphs->CurPix + width)) { if (y > lphs->rectUp.bottom && y < (lphs->CurPix + width)) {
lphs->ButtonDown = 5; lphs->ButtonDown = 5;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_PAGEUP\n");
printf("ScrollBarButtonDown send SB_PAGEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_PAGEUP, dwOwner); SB_PAGEUP, dwOwner);
} }
if (y < lphs->rectDown.top && y > (lphs->CurPix + (width << 1))) { if (y < lphs->rectDown.top && y > (lphs->CurPix + (width << 1))) {
lphs->ButtonDown = 6; lphs->ButtonDown = 6;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_PAGEDOWN\n");
printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_PAGEDOWN, dwOwner); SB_PAGEDOWN, dwOwner);
} }
if (lphs->MaxPix > 0 && y > (lphs->CurPix + width) && if (lphs->MaxPix > 0 && y > (lphs->CurPix + width) &&
y < (lphs->CurPix + (width << 1))) { y < (lphs->CurPix + (width << 1))) {
lphs->ThumbActive = TRUE; lphs->ThumbActive = TRUE;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"THUMB DOWN !\n");
printf("THUMB DOWN !\n");
#endif
} }
} }
else { else {
@ -243,43 +223,33 @@ void ScrollBarButtonDown(HWND hWnd, int nBar, int x, int y)
if (x <= lphs->rectUp.right) { if (x <= lphs->rectUp.right) {
lphs->ButtonDown = 3; lphs->ButtonDown = 3;
InvalidateRect(lphs->hWndOwner, &lphs->rectUp, TRUE); InvalidateRect(lphs->hWndOwner, &lphs->rectUp, TRUE);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_LINEUP\n");
printf("ScrollBarButtonDown send SB_LINEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEUP, dwOwner); SB_LINEUP, dwOwner);
} }
if (x >= lphs->rectDown.left) { if (x >= lphs->rectDown.left) {
lphs->ButtonDown = 4; lphs->ButtonDown = 4;
InvalidateRect(lphs->hWndOwner, &lphs->rectDown, TRUE); InvalidateRect(lphs->hWndOwner, &lphs->rectDown, TRUE);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_LINEDOWN\n");
printf("ScrollBarButtonDown send SB_LINEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_LINEDOWN, dwOwner); SB_LINEDOWN, dwOwner);
} }
if (x > lphs->rectUp.right && x < (lphs->CurPix + height)) { if (x > lphs->rectUp.right && x < (lphs->CurPix + height)) {
lphs->ButtonDown = 5; lphs->ButtonDown = 5;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_PAGEUP\n");
printf("ScrollBarButtonDown send SB_PAGEUP\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_PAGEUP, dwOwner); SB_PAGEUP, dwOwner);
} }
if (x < lphs->rectDown.left && x > (lphs->CurPix + (height << 1))) { if (x < lphs->rectDown.left && x > (lphs->CurPix + (height << 1))) {
lphs->ButtonDown = 6; lphs->ButtonDown = 6;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonDown send SB_PAGEDOWN\n");
printf("ScrollBarButtonDown send SB_PAGEDOWN\n");
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_PAGEDOWN, dwOwner); SB_PAGEDOWN, dwOwner);
} }
if (lphs->MaxPix > 0 && x > (lphs->CurPix + height) && if (lphs->MaxPix > 0 && x > (lphs->CurPix + height) &&
x < (lphs->CurPix + (height << 1))) { x < (lphs->CurPix + (height << 1))) {
lphs->ThumbActive = TRUE; lphs->ThumbActive = TRUE;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"THUMB DOWN !\n");
printf("THUMB DOWN !\n");
#endif
} }
} }
if (lphs->ButtonDown != 0) { if (lphs->ButtonDown != 0) {
@ -297,9 +267,7 @@ void ScrollBarButtonUp(HWND hWnd, int nBar, int x, int y)
LPHEADSCROLL lphs; LPHEADSCROLL lphs;
RECT rect, rect2; RECT rect, rect2;
HDC hDC; HDC hDC;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonUp // x=%d y=%d\n", x, y);
printf("ScrollBarButtonUp // x=%d y=%d\n", x, y);
#endif
lphs = GetScrollObjectStruct(hWnd, nBar); lphs = GetScrollObjectStruct(hWnd, nBar);
if(lphs->ThumbActive) if(lphs->ThumbActive)
{ {
@ -347,25 +315,19 @@ void ScrollBarMouseMove(HWND hWnd, int nBar, WORD wParam, int x, int y)
if (nBar == SB_CTL) { if (nBar == SB_CTL) {
hWndParent = GetParent(hWnd); hWndParent = GetParent(hWnd);
hWndOwner = lphs->hWndOwner; hWndOwner = lphs->hWndOwner;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonMove SB_CTL // x=%d y=%d\n", x, y);
printf("ScrollBarButtonMove SB_CTL // x=%d y=%d\n", x, y);
#endif
} }
else { else {
hWndParent = hWnd; hWndParent = hWnd;
hWndOwner = 0; hWndOwner = 0;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"ScrollBarButtonMove SB_?SCROLL // x=%d y=%d\n", x, y);
printf("ScrollBarButtonMove SB_?SCROLL // x=%d y=%d\n", x, y);
#endif
} }
if(x<lphs->rect.left||x>lphs->rect.right|| if(x<lphs->rect.left||x>lphs->rect.right||
y<lphs->rect.top||y>lphs->rect.bottom) y<lphs->rect.top||y>lphs->rect.bottom)
{ {
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"Rejecting thumb position !\n");
printf("Rejecting thumb position !\n");
#endif
lphs->ThumbVal=lphs->CurVal;/*revert to last set position*/ lphs->ThumbVal=lphs->CurVal;/*revert to last set position*/
} }
else else
@ -385,9 +347,8 @@ void ScrollBarMouseMove(HWND hWnd, int nBar, WORD wParam, int x, int y)
lphs->MaxPix) + lphs->MinVal; lphs->MaxPix) + lphs->MinVal;
} }
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"Scroll WM_MOUSEMOVE val=%d pix=%d\n",
printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", lphs->ThumbVal, y); lphs->ThumbVal, y);
#endif
SendMessage(hWndParent, lphs->Direction, SendMessage(hWndParent, lphs->Direction,
SB_THUMBTRACK, MAKELONG(lphs->ThumbVal, hWndOwner)); SB_THUMBTRACK, MAKELONG(lphs->ThumbVal, hWndOwner));
} }
@ -399,7 +360,7 @@ LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hWnd, WND **wndPtr)
LPHEADSCROLL lphs; LPHEADSCROLL lphs;
*(wndPtr) = Ptr = WIN_FindWndPtr(hWnd); *(wndPtr) = Ptr = WIN_FindWndPtr(hWnd);
if (Ptr == 0) { if (Ptr == 0) {
printf("Bad Window handle on ScrollBar !\n"); fprintf(stderr,"Bad Window handle on ScrollBar !\n");
return 0; return 0;
} }
lphs = *((LPHEADSCROLL *)&Ptr->wExtra[1]); lphs = *((LPHEADSCROLL *)&Ptr->wExtra[1]);
@ -413,7 +374,7 @@ LPHEADSCROLL ScrollBarGetStorageHeader(HWND hWnd)
LPHEADSCROLL lphs; LPHEADSCROLL lphs;
wndPtr = WIN_FindWndPtr(hWnd); wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) { if (wndPtr == 0) {
printf("Bad Window handle on ScrollBar !\n"); fprintf(stderr,"Bad Window handle on ScrollBar !\n");
return 0; return 0;
} }
lphs = *((LPHEADSCROLL *)&wndPtr->wExtra[1]); lphs = *((LPHEADSCROLL *)&wndPtr->wExtra[1]);
@ -427,20 +388,19 @@ void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL
HWND hWndParent; HWND hWndParent;
HBRUSH hBrush; HBRUSH hBrush;
HDC hMemDC; HDC hMemDC;
HBITMAP hOldBmp;
BITMAP bm; BITMAP bm;
RECT rect; RECT rect;
UINT i, w, w2, h, h2, siz; UINT i, w, w2, h, h2, siz;
char C[128]; char C[128];
if (lphs == NULL) return; if (lphs == NULL) return;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"StdDrawScrollBar nBar=%04X !\n", nBar);
printf("StdDrawScrollBar nBar=%04X !\n", nBar);
if (lphs->Direction == WM_VSCROLL) if (lphs->Direction == WM_VSCROLL)
printf("StdDrawScrollBar Vertical left=%d top=%d right=%d bottom=%d !\n", dprintf_scroll(stddeb,"StdDrawScrollBar Vertical left=%d top=%d right=%d bottom=%d !\n",
lprect->left, lprect->top, lprect->right, lprect->bottom); lprect->left, lprect->top, lprect->right, lprect->bottom);
else else
printf("StdDrawScrollBar Horizontal left=%d top=%d right=%d bottom=%d !\n", dprintf_scroll(stddeb,"StdDrawScrollBar Horizontal left=%d top=%d right=%d bottom=%d !\n",
lprect->left, lprect->top, lprect->right, lprect->bottom); lprect->left, lprect->top, lprect->right, lprect->bottom);
#endif
if (nBar == SB_CTL) if (nBar == SB_CTL)
hWndParent = GetParent(hWnd); hWndParent = GetParent(hWnd);
else else
@ -489,9 +449,9 @@ void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL
if (lphs->Direction == WM_VSCROLL) { if (lphs->Direction == WM_VSCROLL) {
GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm);
if (lphs->ButtonDown == 1) if (lphs->ButtonDown == 1)
SelectObject(hMemDC, hUpArrowD); hOldBmp = SelectObject(hMemDC, hUpArrowD);
else else
SelectObject(hMemDC, hUpArrow); hOldBmp = SelectObject(hMemDC, hUpArrow);
StretchBlt(hDC, rect.left, rect.top, w, h2, hMemDC, StretchBlt(hDC, rect.left, rect.top, w, h2, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm);
@ -507,9 +467,9 @@ void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL
else { else {
GetObject(hLfArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hLfArrow, sizeof(BITMAP), (LPSTR)&bm);
if (lphs->ButtonDown == 3) if (lphs->ButtonDown == 3)
SelectObject(hMemDC, hLfArrowD); hOldBmp = SelectObject(hMemDC, hLfArrowD);
else else
SelectObject(hMemDC, hLfArrow); hOldBmp = SelectObject(hMemDC, hLfArrow);
StretchBlt(hDC, rect.left, rect.top, w2, h, hMemDC, StretchBlt(hDC, rect.left, rect.top, w2, h, hMemDC,
0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
GetObject(hRgArrow, sizeof(BITMAP), (LPSTR)&bm); GetObject(hRgArrow, sizeof(BITMAP), (LPSTR)&bm);
@ -522,6 +482,7 @@ void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL
rect.left += w2; rect.left += w2;
rect.right -= w2; rect.right -= w2;
} }
SelectObject( hMemDC, hOldBmp );
DeleteDC(hMemDC); DeleteDC(hMemDC);
FillRect(hDC, &rect, hBrush); FillRect(hDC, &rect, hBrush);
if (lphs->MaxPix != 0) { if (lphs->MaxPix != 0) {
@ -534,9 +495,9 @@ void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH)); FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
InflateRect(&rect, -1, -1); InflateRect(&rect, -1, -1);
FillRect(hDC, &rect, GetStockObject(LTGRAY_BRUSH)); FillRect(hDC, &rect, GetStockObject(LTGRAY_BRUSH));
DrawReliefRect(hDC, rect, 2, 0); GRAPH_DrawReliefRect(hDC, &rect, 2, 0);
InflateRect(&rect, -3, -3); InflateRect(&rect, -3, -3);
DrawReliefRect(hDC, rect, 1, 1); GRAPH_DrawReliefRect(hDC, &rect, 1, 1);
} }
} }
@ -555,9 +516,7 @@ int CreateScrollBarStruct(HWND hWnd)
lphs = AllocScrollBar(WS_VSCROLL, width, height); lphs = AllocScrollBar(WS_VSCROLL, width, height);
else else
lphs = AllocScrollBar(WS_HSCROLL, width, height); lphs = AllocScrollBar(WS_HSCROLL, width, height);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"CreateScrollBarStruct %lX !\n", lphs);
printf("CreateScrollBarStruct %lX !\n", lphs);
#endif
*((LPHEADSCROLL *)&wndPtr->wExtra[1]) = lphs; *((LPHEADSCROLL *)&wndPtr->wExtra[1]) = lphs;
lphs->hWndOwner = hWnd; lphs->hWndOwner = hWnd;
CopyRect(&lphs->rect, &wndPtr->rectClient); CopyRect(&lphs->rect, &wndPtr->rectClient);
@ -587,7 +546,7 @@ LPHEADSCROLL AllocScrollBar(DWORD dwStyle, int width, int height)
hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD)); hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
lphs = (LPHEADSCROLL)malloc(sizeof(HEADSCROLL)); lphs = (LPHEADSCROLL)malloc(sizeof(HEADSCROLL));
if (lphs == 0) { if (lphs == 0) {
printf("Bad Memory Alloc on ScrollBar !\n"); fprintf(stderr,"Bad Memory Alloc on ScrollBar !\n");
return NULL; return NULL;
} }
lphs->ThumbActive = FALSE; lphs->ThumbActive = FALSE;
@ -630,9 +589,8 @@ void NC_CreateScrollBars(HWND hWnd)
if (wndPtr->dwStyle & WS_VSCROLL) { if (wndPtr->dwStyle & WS_VSCROLL) {
if (wndPtr->dwStyle & WS_HSCROLL) height -= SYSMETRICS_CYHSCROLL; if (wndPtr->dwStyle & WS_HSCROLL) height -= SYSMETRICS_CYHSCROLL;
lphs = AllocScrollBar(WS_VSCROLL, SYSMETRICS_CXVSCROLL, height); lphs = AllocScrollBar(WS_VSCROLL, SYSMETRICS_CXVSCROLL, height);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"NC_CreateScrollBars Vertical %lX !\n",
printf("NC_CreateScrollBars Vertical %lX !\n", lphs); lphs);
#endif
lphs->rect.left = width - SYSMETRICS_CYVSCROLL; lphs->rect.left = width - SYSMETRICS_CYVSCROLL;
lphs->rect.right = width; lphs->rect.right = width;
lphs->hWndOwner = hWnd; lphs->hWndOwner = hWnd;
@ -643,9 +601,7 @@ void NC_CreateScrollBars(HWND hWnd)
if (wndPtr->dwStyle & WS_HSCROLL) { if (wndPtr->dwStyle & WS_HSCROLL) {
if (wndPtr->dwStyle & WS_VSCROLL) width -= SYSMETRICS_CYVSCROLL; if (wndPtr->dwStyle & WS_VSCROLL) width -= SYSMETRICS_CYVSCROLL;
lphs = AllocScrollBar(WS_HSCROLL, width, SYSMETRICS_CYHSCROLL); lphs = AllocScrollBar(WS_HSCROLL, width, SYSMETRICS_CYHSCROLL);
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"NC_CreateScrollBars Horizontal %lX !\n", lphs);
printf("NC_CreateScrollBars Horizontal %lX !\n", lphs);
#endif
lphs->rect.top = height - SYSMETRICS_CYHSCROLL; lphs->rect.top = height - SYSMETRICS_CYHSCROLL;
lphs->rect.bottom = height; lphs->rect.bottom = height;
lphs->hWndOwner = hWnd; lphs->hWndOwner = hWnd;
@ -689,12 +645,10 @@ int SetScrollPos(HWND hWnd, int nBar, int nPos, BOOL bRedraw)
if(lphs->CurPix <0)lphs->CurPix=0; if(lphs->CurPix <0)lphs->CurPix=0;
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix; if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"SetScrollPos val=%d pixval=%d pixmax%d\n",
printf("SetScrollPos val=%d pixval=%d pixmax%d\n",
(short)nPos, lphs->CurPix, lphs->MaxPix); (short)nPos, lphs->CurPix, lphs->MaxPix);
printf("SetScrollPos min=%d max=%d\n", dprintf_scroll(stddeb,"SetScrollPos min=%d max=%d\n",
lphs->MinVal, lphs->MaxVal); lphs->MinVal, lphs->MaxVal);
#endif
if ((bRedraw) && (IsWindowVisible(lphs->hWndOwner))) { if ((bRedraw) && (IsWindowVisible(lphs->hWndOwner))) {
if (nBar == SB_CTL) { if (nBar == SB_CTL) {
InvalidateRect(lphs->hWndOwner, &lphs->rect, TRUE); InvalidateRect(lphs->hWndOwner, &lphs->rect, TRUE);
@ -745,9 +699,8 @@ void SetScrollRange(HWND hWnd, int nBar, int MinPos, int MaxPos, BOOL bRedraw)
(lphs->MaxVal - lphs->MinVal); (lphs->MaxVal - lphs->MinVal);
if(lphs->CurPix <0)lphs->CurPix=0; if(lphs->CurPix <0)lphs->CurPix=0;
if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix; if (lphs->CurPix > lphs->MaxPix) lphs->CurPix = lphs->MaxPix;
#ifdef DEBUG_SCROLL dprintf_scroll(stddeb,"SetScrollRange min=%d max=%d\n",
printf("SetScrollRange min=%d max=%d\n", lphs->MinVal, lphs->MaxVal); lphs->MinVal, lphs->MaxVal);
#endif
if ((bRedraw) && (IsWindowVisible(lphs->hWndOwner))) { if ((bRedraw) && (IsWindowVisible(lphs->hWndOwner))) {
if (nBar == SB_CTL) { if (nBar == SB_CTL) {
InvalidateRect(lphs->hWndOwner, &lphs->rect, TRUE); InvalidateRect(lphs->hWndOwner, &lphs->rect, TRUE);
@ -785,10 +738,8 @@ void GetScrollRange(HWND hWnd, int nBar, LPINT lpMin, LPINT lpMax)
void ShowScrollBar(HWND hWnd, WORD wBar, BOOL bFlag) void ShowScrollBar(HWND hWnd, WORD wBar, BOOL bFlag)
{ {
WND *wndPtr; WND *wndPtr;
printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag); dprintf_scroll(stddeb,"ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n",
#ifdef DEBUG_SCROLL hWnd, wBar, bFlag);
printf("ShowScrollBar hWnd=%04X wBar=%d bFlag=%d\n", hWnd, wBar, bFlag);
#endif
if (wBar == SB_CTL) { if (wBar == SB_CTL) {
if (bFlag) if (bFlag)
ShowWindow(hWnd, SW_SHOW); ShowWindow(hWnd, SW_SHOW);

View file

@ -11,85 +11,83 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1993";
#include <windows.h> #include <windows.h>
#include "win.h" #include "win.h"
#include "user.h" #include "user.h"
#include "static.h"
#include "icon.h"
extern void DEFWND_SetText( HWND hwnd, LPSTR text ); /* windows/defwnd.c */ extern void DEFWND_SetText( HWND hwnd, LPSTR text ); /* windows/defwnd.c */
static LONG PaintTextfn(HWND hwnd); static void PaintTextfn( HWND hwnd, HDC hdc );
static LONG PaintRectfn(HWND hwnd); static void PaintRectfn( HWND hwnd, HDC hdc );
static LONG PaintFramefn(HWND hwnd); static void PaintFramefn( HWND hwnd, HDC hdc );
static LONG PaintIconfn(HWND hwnd); static void PaintIconfn( HWND hwnd, HDC hdc );
static COLORREF color_windowframe, color_background, color_window, static COLORREF color_windowframe, color_background, color_window;
color_windowtext;
#define NOTIFY_PARENT(hWndCntrl, wNotifyCode) \
SendMessage(GetParent(hWndCntrl), WM_COMMAND, \
GetDlgCtrlID(hWndCntrl), MAKELPARAM(hWndCntrl, wNotifyCode));
#define DIM(array) ((sizeof array)/(sizeof array[0]))
typedef struct typedef void (*pfPaint)(HWND, HDC);
#define LAST_STATIC_TYPE SS_LEFTNOWORDWRAP
static pfPaint staticPaintFunc[LAST_STATIC_TYPE+1] =
{ {
LONG (*paintfn)(); PaintTextfn, /* SS_LEFT */
} STATICFN; PaintTextfn, /* SS_CENTER */
PaintTextfn, /* SS_RIGHT */
#define MAX_STATIC_TYPE 12 PaintIconfn, /* SS_ICON */
PaintRectfn, /* SS_BLACKRECT */
static STATICFN staticfn[MAX_STATIC_TYPE] = PaintRectfn, /* SS_GRAYRECT */
{ PaintRectfn, /* SS_WHITERECT */
{ (LONG(*)())PaintTextfn }, /* SS_LEFT */ PaintFramefn, /* SS_BLACKFRAME */
{ (LONG(*)())PaintTextfn }, /* SS_CENTER */ PaintFramefn, /* SS_GRAYFRAME */
{ (LONG(*)())PaintTextfn }, /* SS_RIGHT */ PaintFramefn, /* SS_WHITEFRAME */
{ (LONG(*)())PaintIconfn }, /* SS_ICON */ NULL, /* Not defined */
{ (LONG(*)())PaintRectfn }, /* SS_BLACKRECT */ PaintTextfn, /* SS_SIMPLE */
{ (LONG(*)())PaintRectfn }, /* SS_GRAYRECT */ PaintTextfn /* SS_LEFTNOWORDWRAP */
{ (LONG(*)())PaintRectfn }, /* SS_WHITERECT */
{ (LONG(*)())PaintFramefn }, /* SS_BLACKFRAME */
{ (LONG(*)())PaintFramefn }, /* SS_GRAYFRAME */
{ (LONG(*)())PaintFramefn }, /* SS_WHITEFRAME */
{ (LONG(*)())PaintTextfn }, /* SS_SIMPLE */
{ (LONG(*)())PaintTextfn } /* SS_LEFTNOWORDWRAP */
}; };
/***********************************************************************
* STATIC_SetIcon
*
* Set the icon for an SS_ICON control.
*/
static void STATIC_SetIcon( HWND hwnd, HICON hicon )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
if ((wndPtr->dwStyle & 0x0f) != SS_ICON) return;
if (infoPtr->hIcon) DestroyIcon( infoPtr->hIcon );
infoPtr->hIcon = hicon;
if (hicon)
{
ICONALLOC *icon = (ICONALLOC *) GlobalLock( hicon );
SetWindowPos( hwnd, 0, 0, 0,
icon->descriptor.Width, icon->descriptor.Height,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER );
GlobalUnlock( hicon );
}
}
/***********************************************************************
* StaticWndProc
*/
LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam) LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
{ {
LONG lResult = 0; LONG lResult = 0;
HDC hDC;
RECT rc;
LPSTR textPtr;
WND *wndPtr = WIN_FindWndPtr(hWnd); WND *wndPtr = WIN_FindWndPtr(hWnd);
LONG style = wndPtr->dwStyle & 0x0000000F; LONG style = wndPtr->dwStyle & 0x0000000F;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
switch (uMsg) { switch (uMsg) {
case WM_ENABLE: case WM_ENABLE:
InvalidateRect(hWnd, NULL, FALSE); InvalidateRect(hWnd, NULL, FALSE);
break; break;
case WM_NCCREATE:
if (style == SS_ICON)
{
/* Note: we use wndPtr->hText to store the icon handle */
CREATESTRUCT * createStruct = (CREATESTRUCT *)lParam;
if (createStruct->lpszName)
wndPtr->hText = LoadIcon( createStruct->hInstance,
createStruct->lpszName );
return 1;
}
else return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_NCDESTROY:
if (style == SS_ICON)
{
if (wndPtr->hText) DestroyIcon( wndPtr->hText );
wndPtr->hText = 0;
return 0;
}
else return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_CREATE: case WM_CREATE:
if (style < 0L || style >= (LONG)DIM(staticfn)) { if (style < 0L || style > LAST_STATIC_TYPE) {
lResult = -1L; lResult = -1L;
break; break;
} }
@ -97,48 +95,67 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
color_windowframe = GetSysColor(COLOR_WINDOWFRAME); color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_background = GetSysColor(COLOR_BACKGROUND); color_background = GetSysColor(COLOR_BACKGROUND);
color_window = GetSysColor(COLOR_WINDOW); color_window = GetSysColor(COLOR_WINDOW);
color_windowtext = GetSysColor(COLOR_WINDOWTEXT); if (style == SS_ICON)
lResult = 0L; {
if (style == SS_ICON) { CREATESTRUCT * createStruct = (CREATESTRUCT *)lParam;
/* if (createStruct->lpszName)
SetWindowPos(hWnd, (HWND)NULL, 0, 0, 32, 32, STATIC_SetIcon( hWnd, LoadIcon( createStruct->hInstance,
SWP_NOZORDER | SWP_NOMOVE); createStruct->lpszName ));
*/
} }
break; break;
case WM_DESTROY:
STATIC_SetIcon( hWnd, 0 ); /* Destroy the current icon */
break;
case WM_PAINT: case WM_PAINT:
if (staticfn[style].paintfn) if (staticPaintFunc[style])
(staticfn[style].paintfn)(hWnd); {
PAINTSTRUCT ps;
BeginPaint( hWnd, &ps );
(staticPaintFunc[style])( hWnd, ps.hdc );
EndPaint( hWnd, &ps );
}
break; break;
case WM_SYSCOLORCHANGE: case WM_SYSCOLORCHANGE:
color_windowframe = GetSysColor(COLOR_WINDOWFRAME); color_windowframe = GetSysColor(COLOR_WINDOWFRAME);
color_background = GetSysColor(COLOR_BACKGROUND); color_background = GetSysColor(COLOR_BACKGROUND);
color_window = GetSysColor(COLOR_WINDOW); color_window = GetSysColor(COLOR_WINDOW);
color_windowtext = GetSysColor(COLOR_WINDOWTEXT);
InvalidateRect(hWnd, NULL, TRUE); InvalidateRect(hWnd, NULL, TRUE);
break; break;
case WM_SETTEXT: case WM_SETTEXT:
if (style == SS_ICON) break;
DEFWND_SetText( hWnd, (LPSTR)lParam ); DEFWND_SetText( hWnd, (LPSTR)lParam );
InvalidateRect( hWnd, NULL, FALSE ); InvalidateRect( hWnd, NULL, FALSE );
UpdateWindow( hWnd ); UpdateWindow( hWnd );
break; break;
case WM_SETFONT:
if (style == SS_ICON) return 0;
infoPtr->hFont = wParam;
if (LOWORD(lParam))
{
InvalidateRect( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
}
break;
case WM_GETFONT:
return infoPtr->hFont;
case WM_NCHITTEST: case WM_NCHITTEST:
return HTTRANSPARENT; return HTTRANSPARENT;
case WM_GETDLGCODE:
return DLGC_STATIC;
case STM_GETICON: case STM_GETICON:
if (style != SS_ICON) return 0; return infoPtr->hIcon;
return (HICON)wndPtr->hText;
case STM_SETICON: case STM_SETICON:
if (style != SS_ICON) return 0; STATIC_SetIcon( hWnd, wParam );
if (wndPtr->hText) DestroyIcon( wndPtr->hText ); InvalidateRect( hWnd, NULL, FALSE );
wndPtr->hText = wParam;
InvalidateRect( hWnd, NULL, TRUE );
UpdateWindow( hWnd ); UpdateWindow( hWnd );
return 0; return 0;
@ -151,27 +168,19 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
} }
static LONG PaintTextfn(HWND hwnd) static void PaintTextfn( HWND hwnd, HDC hdc )
{ {
PAINTSTRUCT ps;
RECT rc; RECT rc;
HDC hdc;
HBRUSH hBrush; HBRUSH hBrush;
HANDLE hText;
char *text; char *text;
int textlen;
WORD wFormat; WORD wFormat;
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
LONG style = wndPtr->dwStyle; LONG style = wndPtr->dwStyle;
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
text = USER_HEAP_ADDR( wndPtr->hText );
textlen = GetWindowTextLength(hwnd);
hText = USER_HEAP_ALLOC(0, textlen+1);
text = USER_HEAP_ADDR(hText);
GetWindowText(hwnd, text, textlen+1);
switch (style & 0x0000000F) switch (style & 0x0000000F)
{ {
@ -199,70 +208,48 @@ static LONG PaintTextfn(HWND hwnd)
if (style & SS_NOPREFIX) if (style & SS_NOPREFIX)
wFormat |= DT_NOPREFIX; wFormat |= DT_NOPREFIX;
hBrush = SendMessage(GetParent(hwnd), WM_CTLCOLOR, (WORD)hdc, if (infoPtr->hFont) SelectObject( hdc, infoPtr->hFont );
hBrush = SendMessage( wndPtr->hwndParent, WM_CTLCOLOR, (WORD)hdc,
MAKELONG(hwnd, CTLCOLOR_STATIC)); MAKELONG(hwnd, CTLCOLOR_STATIC));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH); if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
FillRect(hdc, &rc, hBrush); FillRect(hdc, &rc, hBrush);
DrawText(hdc, text, textlen, &rc, wFormat); DrawText(hdc, text, -1, &rc, wFormat);
USER_HEAP_FREE(hText);
EndPaint(hwnd, &ps);
} }
static LONG PaintRectfn(HWND hwnd) static void PaintRectfn( HWND hwnd, HDC hdc )
{ {
PAINTSTRUCT ps;
RECT rc; RECT rc;
HDC hdc; HBRUSH hBrush;
HPEN hOldPen, hPen;
HBRUSH hOldBrush, hBrush;
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
switch (wndPtr->dwStyle & 0x0000000F) switch (wndPtr->dwStyle & 0x0000000F)
{ {
case SS_BLACKRECT: case SS_BLACKRECT:
hPen = CreatePen(PS_SOLID, 1, color_windowframe);
hBrush = CreateSolidBrush(color_windowframe); hBrush = CreateSolidBrush(color_windowframe);
break; break;
case SS_GRAYRECT: case SS_GRAYRECT:
hPen = CreatePen(PS_SOLID, 1, color_background);
hBrush = CreateSolidBrush(color_background); hBrush = CreateSolidBrush(color_background);
break; break;
case SS_WHITERECT: case SS_WHITERECT:
hPen = CreatePen(PS_SOLID, 1, color_window);
hBrush = CreateSolidBrush(color_window); hBrush = CreateSolidBrush(color_window);
break; break;
} }
FillRect( hdc, &rc, hBrush );
hOldPen = (HPEN)SelectObject(hdc, (HANDLE)hPen);
hOldBrush = (HBRUSH)SelectObject(hdc, (HANDLE)hBrush);
Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);
SelectObject(hdc, (HANDLE)hOldPen);
SelectObject(hdc, (HANDLE)hOldBrush);
DeleteObject((HANDLE)hPen);
DeleteObject((HANDLE)hBrush);
EndPaint(hwnd, &ps);
} }
static LONG PaintFramefn(HWND hwnd) static void PaintFramefn( HWND hwnd, HDC hdc )
{ {
PAINTSTRUCT ps;
RECT rc; RECT rc;
HDC hdc;
HPEN hOldPen, hPen; HPEN hOldPen, hPen;
HBRUSH hOldBrush, hBrush; HBRUSH hOldBrush, hBrush;
WND *wndPtr = WIN_FindWndPtr(hwnd); WND *wndPtr = WIN_FindWndPtr(hwnd);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
switch (wndPtr->dwStyle & 0x0000000F) switch (wndPtr->dwStyle & 0x0000000F)
@ -289,22 +276,19 @@ static LONG PaintFramefn(HWND hwnd)
SelectObject(hdc, (HANDLE)hOldBrush); SelectObject(hdc, (HANDLE)hOldBrush);
DeleteObject((HANDLE)hPen); DeleteObject((HANDLE)hPen);
DeleteObject((HANDLE)hBrush); DeleteObject((HANDLE)hBrush);
EndPaint(hwnd, &ps);
} }
static LONG PaintIconfn(HWND hwnd) static void PaintIconfn( HWND hwnd, HDC hdc )
{ {
WND *wndPtr;
PAINTSTRUCT ps;
RECT rc; RECT rc;
HDC hdc; HBRUSH hbrush;
WND *wndPtr = WIN_FindWndPtr(hwnd);
STATICINFO *infoPtr = (STATICINFO *)wndPtr->wExtra;
wndPtr = WIN_FindWndPtr(hwnd);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
FillRect(hdc, &rc, GetStockObject(WHITE_BRUSH)); hbrush = SendMessage( wndPtr->hwndParent, WM_CTLCOLOR, hdc,
if (wndPtr->hText) DrawIcon(hdc, rc.left, rc.top, wndPtr->hText ); MAKELONG(hwnd, CTLCOLOR_STATIC));
EndPaint(hwnd, &ps); FillRect( hdc, &rc, hbrush );
if (infoPtr->hIcon) DrawIcon( hdc, rc.left, rc.top, infoPtr->hIcon );
} }

View file

@ -7,12 +7,12 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "win.h" #include "win.h"
#include "button.h"
#include "static.h"
#include "desktop.h" #include "desktop.h"
#include "mdi.h" #include "mdi.h"
#include "gdi.h" #include "gdi.h"
LONG ButtonWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG StaticWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam ); LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
@ -24,25 +24,25 @@ LONG MDIClientWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
static WNDCLASS WIDGETS_BuiltinClasses[] = static WNDCLASS WIDGETS_BuiltinClasses[] =
{ {
{ CS_GLOBALCLASS, (LONG(*)())ButtonWndProc, 0, 2, { CS_GLOBALCLASS | CS_PARENTDC, ButtonWndProc, 0, sizeof(BUTTONINFO),
0, 0, 0, 0, NULL, "BUTTON" }, 0, 0, 0, 0, NULL, "BUTTON" },
{ CS_GLOBALCLASS, (LONG(*)())StaticWndProc, 0, 0, { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc, 0, sizeof(STATICINFO),
0, 0, 0, 0, NULL, "STATIC" }, 0, 0, 0, 0, NULL, "STATIC" },
{ CS_GLOBALCLASS, (LONG(*)())ScrollBarWndProc, 0, 8, { CS_GLOBALCLASS | CS_PARENTDC, ScrollBarWndProc, 0, 8,
0, 0, 0, 0, NULL, "SCROLLBAR" }, 0, 0, 0, 0, NULL, "SCROLLBAR" },
{ CS_GLOBALCLASS, (LONG(*)())ListBoxWndProc, 0, 8, { CS_GLOBALCLASS | CS_PARENTDC, ListBoxWndProc, 0, 8,
0, 0, 0, 0, NULL, "LISTBOX" }, 0, 0, 0, 0, NULL, "LISTBOX" },
{ CS_GLOBALCLASS, (LONG(*)())ComboBoxWndProc, 0, 8, { CS_GLOBALCLASS | CS_PARENTDC, ComboBoxWndProc, 0, 8,
0, 0, 0, 0, NULL, "COMBOBOX" }, 0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS, (LONG(*)())EditWndProc, 0, 4, { CS_GLOBALCLASS | CS_PARENTDC, EditWndProc, 0, 4,
0, 0, 0, 0, NULL, "EDIT" }, 0, 0, 0, 0, NULL, "EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS, (LONG(*)())PopupMenuWndProc, 0, 8, { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME }, 0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, sizeof(DESKTOPINFO), { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME }, 0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA, { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }, 0, 0, 0, 0, NULL, DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())MDIClientWndProc, 0, sizeof(MDICLIENTINFO), { CS_GLOBALCLASS, MDIClientWndProc, 0, sizeof(MDICLIENTINFO),
0, 0, 0, STOCK_LTGRAY_BRUSH, NULL, "MDICLIENT" } 0, 0, 0, STOCK_LTGRAY_BRUSH, NULL, "MDICLIENT" }
}; };

View file

@ -16,12 +16,7 @@ SRCS = \
lex.yy.c \ lex.yy.c \
info.c info.c
OBJS = \ OBJS = $(SRCS:.c=.o)
dbg.tab.o \
break.o \
hash.o \
lex.yy.o \
info.o
/* /*
* All the SUBDIR stuff * All the SUBDIR stuff

View file

@ -178,14 +178,16 @@ wine_debug(int signal, int * regs)
/* This is intended to read the entry points from the Windows image, and /* This is intended to read the entry points from the Windows image, and
insert them in the hash table. It does not work yet, so it is commented out. */ insert them in the hash table. It does not work yet, so it is commented out. */
#if 0
if(!loaded_symbols){ if(!loaded_symbols){
loaded_symbols++; loaded_symbols++;
read_symboltable("wine.sym");
#if 0
load_entrypoints(); load_entrypoints();
}
#endif #endif
}
/* Remove the breakpoints from memory... */ /* Remove the breakpoints from memory... */
fprintf(stderr,"Removing BPs\n");
insert_break(0); insert_break(0);
/* If we stopped on a breakpoint, report this fact */ /* If we stopped on a breakpoint, report this fact */

View file

@ -157,10 +157,10 @@ load_entrypoints(){
struct w_files * wpnt; struct w_files * wpnt;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next){ for(wpnt = wine_files; wpnt; wpnt = wpnt->next){
cpnt = wpnt->nrname_table; cpnt = wpnt->ne->nrname_table;
while(1==1){ while(1==1){
if( ((int) cpnt) - ((int)wpnt->nrname_table) > if( ((int) cpnt) - ((int)wpnt->ne->nrname_table) >
wpnt->ne_header->nrname_tab_length) break; wpnt->ne->ne_header->nrname_tab_length) break;
len = *cpnt++; len = *cpnt++;
strncpy(buffer, cpnt, len); strncpy(buffer, cpnt, len);
buffer[len] = 0; buffer[len] = 0;
@ -168,7 +168,7 @@ load_entrypoints(){
j = GetEntryPointFromOrdinal(wpnt, ordinal); j = GetEntryPointFromOrdinal(wpnt, ordinal);
address = j & 0xffff; address = j & 0xffff;
j = j >> 16; j = j >> 16;
address |= (wpnt->selector_table[j].selector) << 16; address |= (wpnt->ne->selector_table[j].selector) << 16;
fprintf(stderr,"%s -> %x\n", buffer, address); fprintf(stderr,"%s -> %x\n", buffer, address);
add_hash(buffer, (unsigned int *) address); add_hash(buffer, (unsigned int *) address);
cpnt += len + 2; cpnt += len + 2;

View file

@ -282,16 +282,18 @@ void dbg_bt(){
} }
fprintf(stderr,"Backtrace:\n"); fprintf(stderr,"Backtrace:\n");
fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, SC_CS, SC_EIP(dbg_mask)); fprintf(stderr,"%d ",frameno);
print_address(frame->u.win32.saved_ip,stderr);
cs = SC_CS; cs = SC_CS;
frame = (struct frame *) ((SC_EBP(dbg_mask) & ~1) | (SC_SS << 16)); frame = (struct frame *) ((SC_EBP(dbg_mask) & ~1) | (SC_SS << 16));
while((cs & 3) == 3) { while((cs & 3) == 3) {
/* See if in 32 bit mode or not. Assume GDT means 32 bit. */ /* See if in 32 bit mode or not. Assume GDT means 32 bit. */
if ((cs & 7) != 7) { if ((cs & 7) != 7) {
cs = frame->u.win32.saved_cs; void CallTo32();
fprintf(stderr,"%d %4.4x:%4.4x\n", frameno++, cs, fprintf(stderr,"\n%d ",frameno++);
frame->u.win32.saved_ip); print_address(frame->u.win32.saved_ip,stderr);
if(frame->u.win32.saved_ip<((char*)CallTo32+1000))break;
frame = (struct frame *) frame->u.win32.saved_bp; frame = (struct frame *) frame->u.win32.saved_bp;
} else { } else {
cs = frame->u.win16.saved_cs; cs = frame->u.win16.saved_cs;
@ -301,5 +303,6 @@ void dbg_bt(){
(SC_SS << 16)); (SC_SS << 16));
} }
} }
putchar('\n');
} }

View file

@ -11,9 +11,7 @@ SRCS = \
dis-buf.c \ dis-buf.c \
i386-dis.c i386-dis.c
OBJS = \ OBJS = $(SRCS:.c=.o)
dis-buf.o \
i386-dis.o
#ifdef xi386 #ifdef xi386
#define i386 1 #define i386 1
@ -22,7 +20,6 @@ OBJS = \
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

View file

@ -11,14 +11,10 @@ SRCS = \
editline.c \ editline.c \
sysunix.c sysunix.c
OBJS = \ OBJS = $(SRCS:.c=.o)
complete.o \
editline.o \
sysunix.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

View file

@ -6,6 +6,4 @@ AllTarget()
depend:: depend::
CleanTarget()
includes:: includes::

View file

@ -62,15 +62,16 @@ MakeDllFromSpec(winsock,$(TOP)/$(MODULE))
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
pop.h: $(TOP)/tools/build pop.h: $(TOP)/tools/build
$(TOP)/tools/build -p $(TOP)/tools/build -p
call.s: call.S pop.h
includes:: includes::
touch pop.h
install:: install::
clean:: clean::
$(RM) dll* dtb* pop.h call.s $(RM) dll* dtb* pop.h call.s
touch pop.h

View file

@ -26,6 +26,12 @@ struct thunk_s
unsigned char thunk[10]; unsigned char thunk[10];
}; };
static __inline__ int Is16bitAddress(void *address)
{
return ((unsigned int) address
>= (((FIRST_SELECTOR << 3) | 0x0007) << 16));
}
/********************************************************************** /**********************************************************************
* PushOn16 * PushOn16
*/ */
@ -139,10 +145,25 @@ void FreeProcInstance(FARPROC func)
} }
} }
/**********************************************************************
* GetCodeHandle (KERNEL.93)
*/
HANDLE GetCodeHandle( FARPROC proc )
{
struct thunk_s *tp = (struct thunk_s *)proc;
/* Return the code segment containing 'proc'. */
/* Not sure if this is really correct (shouldn't matter that much). */
printf( "STUB: GetCodeHandle(%p) returning %x\n",
tp->thunk[8] + (tp->thunk[9] << 8) );
return tp->thunk[8] + (tp->thunk[9] << 8);
}
/********************************************************************** /**********************************************************************
* CallWindowProc (USER.122) * CallWindowProc (USER.122)
*/ */
LONG CallWindowProc( FARPROC func, HWND hwnd, WORD message, LONG CallWindowProc( WNDPROC func, HWND hwnd, WORD message,
WORD wParam, LONG lParam ) WORD wParam, LONG lParam )
{ {
SpyMessage(hwnd, message, wParam, lParam); SpyMessage(hwnd, message, wParam, lParam);

View file

@ -5,15 +5,15 @@ id 3
length 490 length 490
1 pascal SetBkColor(word long) SetBkColor(1 2) 1 pascal SetBkColor(word long) SetBkColor(1 2)
2 pascal SetBkMode(word word) SetBkMode(1 2) 2 pascal16 SetBkMode(word word) SetBkMode(1 2)
3 pascal SetMapMode(word word) SetMapMode(1 2) 3 pascal16 SetMapMode(word word) SetMapMode(1 2)
4 pascal SetROP2(word word) SetROP2(1 2) 4 pascal16 SetROP2(word word) SetROP2(1 2)
5 pascal SetRelAbs(word word) SetRelAbs(1 2) 5 pascal16 SetRelAbs(word word) SetRelAbs(1 2)
6 pascal SetPolyFillMode(word word) SetPolyFillMode(1 2) 6 pascal16 SetPolyFillMode(word word) SetPolyFillMode(1 2)
7 pascal SetStretchBltMode(word word) SetStretchBltMode(1 2) 7 pascal16 SetStretchBltMode(word word) SetStretchBltMode(1 2)
8 pascal SetTextCharacterExtra(word s_word) SetTextCharacterExtra(1 2) 8 pascal16 SetTextCharacterExtra(word s_word) SetTextCharacterExtra(1 2)
9 pascal SetTextColor(word long) SetTextColor(1 2) 9 pascal SetTextColor(word long) SetTextColor(1 2)
10 pascal SetTextJustification(word s_word s_word) SetTextJustification(1 2 3) 10 pascal16 SetTextJustification(word s_word s_word) SetTextJustification(1 2 3)
11 pascal SetWindowOrg(word s_word s_word) SetWindowOrg(1 2 3) 11 pascal SetWindowOrg(word s_word s_word) SetWindowOrg(1 2 3)
12 pascal SetWindowExt(word s_word s_word) SetWindowExt(1 2 3) 12 pascal SetWindowExt(word s_word s_word) SetWindowExt(1 2 3)
13 pascal SetViewportOrg(word s_word s_word) SetViewportOrg(1 2 3) 13 pascal SetViewportOrg(word s_word s_word) SetViewportOrg(1 2 3)
@ -24,146 +24,146 @@ length 490
17 pascal OffsetViewportOrg(word s_word s_word) OffsetViewportOrg(1 2 3) 17 pascal OffsetViewportOrg(word s_word s_word) OffsetViewportOrg(1 2 3)
18 pascal ScaleViewportExt(word s_word s_word s_word s_word) 18 pascal ScaleViewportExt(word s_word s_word s_word s_word)
ScaleViewportExt(1 2 3 4 5) ScaleViewportExt(1 2 3 4 5)
19 pascal LineTo(word s_word s_word) LineTo(1 2 3) 19 pascal16 LineTo(word s_word s_word) LineTo(1 2 3)
20 pascal MoveTo(word s_word s_word) MoveTo(1 2 3) 20 pascal MoveTo(word s_word s_word) MoveTo(1 2 3)
21 pascal ExcludeClipRect(word s_word s_word s_word s_word) 21 pascal16 ExcludeClipRect(word s_word s_word s_word s_word)
ExcludeClipRect(1 2 3 4 5) ExcludeClipRect(1 2 3 4 5)
22 pascal IntersectClipRect(word s_word s_word s_word s_word) 22 pascal16 IntersectClipRect(word s_word s_word s_word s_word)
IntersectClipRect(1 2 3 4 5) IntersectClipRect(1 2 3 4 5)
23 pascal Arc(word s_word s_word s_word s_word s_word s_word s_word s_word) 23 pascal16 Arc(word s_word s_word s_word s_word s_word s_word s_word s_word)
Arc(1 2 3 4 5 6 7 8 9) Arc(1 2 3 4 5 6 7 8 9)
24 pascal Ellipse(word s_word s_word s_word s_word) Ellipse(1 2 3 4 5) 24 pascal16 Ellipse(word s_word s_word s_word s_word) Ellipse(1 2 3 4 5)
25 pascal FloodFill(word word word long) FloodFill(1 2 3 4) 25 pascal16 FloodFill(word s_word s_word long) FloodFill(1 2 3 4)
26 pascal Pie(word s_word s_word s_word s_word s_word s_word s_word s_word) 26 pascal16 Pie(word s_word s_word s_word s_word s_word s_word s_word s_word)
Pie(1 2 3 4 5 6 7 8 9) Pie(1 2 3 4 5 6 7 8 9)
27 pascal Rectangle(word s_word s_word s_word s_word) Rectangle(1 2 3 4 5) 27 pascal16 Rectangle(word s_word s_word s_word s_word) Rectangle(1 2 3 4 5)
28 pascal RoundRect(word s_word s_word s_word s_word s_word s_word) 28 pascal16 RoundRect(word s_word s_word s_word s_word s_word s_word)
RoundRect(1 2 3 4 5 6 7) RoundRect(1 2 3 4 5 6 7)
29 pascal PatBlt(word s_word s_word s_word s_word long) PatBlt(1 2 3 4 5 6) 29 pascal16 PatBlt(word s_word s_word s_word s_word long) PatBlt(1 2 3 4 5 6)
30 pascal SaveDC(word) SaveDC(1) 30 pascal16 SaveDC(word) SaveDC(1)
31 pascal SetPixel(word s_word s_word long) SetPixel(1 2 3 4) 31 pascal SetPixel(word s_word s_word long) SetPixel(1 2 3 4)
32 pascal OffsetClipRgn(word s_word s_word) OffsetClipRgn(1 2 3) 32 pascal16 OffsetClipRgn(word s_word s_word) OffsetClipRgn(1 2 3)
33 pascal TextOut(word s_word s_word ptr word) TextOut(1 2 3 4 5) 33 pascal16 TextOut(word s_word s_word ptr word) TextOut(1 2 3 4 5)
34 pascal BitBlt( word s_word s_word s_word s_word word s_word s_word long) 34 pascal16 BitBlt( word s_word s_word s_word s_word word s_word s_word long)
BitBlt(1 2 3 4 5 6 7 8 9) BitBlt(1 2 3 4 5 6 7 8 9)
35 pascal StretchBlt( word s_word s_word s_word s_word word s_word s_word s_word s_word long) 35 pascal16 StretchBlt( word s_word s_word s_word s_word word s_word s_word s_word s_word long)
StretchBlt(1 2 3 4 5 6 7 8 9 10 11) StretchBlt(1 2 3 4 5 6 7 8 9 10 11)
36 pascal Polygon (word ptr word) Polygon (1 2 3) 36 pascal16 Polygon (word ptr word) Polygon (1 2 3)
37 pascal Polyline (word ptr word) Polyline (1 2 3) 37 pascal16 Polyline (word ptr word) Polyline (1 2 3)
38 pascal Escape(word word word ptr ptr) Escape(1 2 3 4 5) 38 pascal Escape(word word word ptr ptr) Escape(1 2 3 4 5)
39 pascal RestoreDC(word s_word) RestoreDC(1 2) 39 pascal16 RestoreDC(word s_word) RestoreDC(1 2)
40 pascal FillRgn(word word word) FillRgn(1 2 3) 40 pascal16 FillRgn(word word word) FillRgn(1 2 3)
#41 pascal FrameRgn #41 pascal FrameRgn
42 pascal InvertRgn(word word) InvertRgn(1 2) 42 pascal16 InvertRgn(word word) InvertRgn(1 2)
43 pascal PaintRgn(word word) PaintRgn(1 2) 43 pascal16 PaintRgn(word word) PaintRgn(1 2)
44 pascal SelectClipRgn(word word) SelectClipRgn(1 2) 44 pascal16 SelectClipRgn(word word) SelectClipRgn(1 2)
45 pascal SelectObject(word word) SelectObject(1 2) 45 pascal16 SelectObject(word word) SelectObject(1 2)
#46 pascal __GP? #46 pascal __GP?
47 pascal CombineRgn(word word word word) CombineRgn(1 2 3 4) 47 pascal16 CombineRgn(word word word word) CombineRgn(1 2 3 4)
48 pascal CreateBitmap(word word word word ptr) CreateBitmap(1 2 3 4 5) 48 pascal16 CreateBitmap(word word word word ptr) CreateBitmap(1 2 3 4 5)
49 pascal CreateBitmapIndirect(ptr) CreateBitmapIndirect(1) 49 pascal16 CreateBitmapIndirect(ptr) CreateBitmapIndirect(1)
50 pascal CreateBrushIndirect(ptr) CreateBrushIndirect(1) 50 pascal16 CreateBrushIndirect(ptr) CreateBrushIndirect(1)
51 pascal CreateCompatibleBitmap(word word word) CreateCompatibleBitmap(1 2 3) 51 pascal16 CreateCompatibleBitmap(word word word) CreateCompatibleBitmap(1 2 3)
52 pascal CreateCompatibleDC(word) CreateCompatibleDC(1) 52 pascal16 CreateCompatibleDC(word) CreateCompatibleDC(1)
53 pascal CreateDC(ptr ptr ptr ptr) CreateDC(1 2 3 4) 53 pascal16 CreateDC(ptr ptr ptr ptr) CreateDC(1 2 3 4)
54 pascal CreateEllipticRgn(s_word s_word s_word s_word) 54 pascal16 CreateEllipticRgn(s_word s_word s_word s_word)
CreateEllipticRgn(1 2 3 4) CreateEllipticRgn(1 2 3 4)
55 pascal CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect(1) 55 pascal16 CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect(1)
56 pascal CreateFont(s_word s_word s_word s_word s_word word word word 56 pascal16 CreateFont(s_word s_word s_word s_word s_word word word word
word word word word word ptr) word word word word word ptr)
CreateFont(1 2 3 4 5 6 7 8 9 10 11 12 13 14) CreateFont(1 2 3 4 5 6 7 8 9 10 11 12 13 14)
57 pascal CreateFontIndirect(ptr) CreateFontIndirect(1) 57 pascal16 CreateFontIndirect(ptr) CreateFontIndirect(1)
58 pascal CreateHatchBrush(word long) CreateHatchBrush(1 2) 58 pascal16 CreateHatchBrush(word long) CreateHatchBrush(1 2)
60 pascal CreatePatternBrush(word) CreatePatternBrush(1) 60 pascal16 CreatePatternBrush(word) CreatePatternBrush(1)
61 pascal CreatePen(s_word s_word long) CreatePen(1 2 3) 61 pascal16 CreatePen(s_word s_word long) CreatePen(1 2 3)
62 pascal CreatePenIndirect(ptr) CreatePenIndirect(1) 62 pascal16 CreatePenIndirect(ptr) CreatePenIndirect(1)
63 pascal CreatePolygonRgn(ptr word word) CreatePolygonRgn(1 2 3) 63 pascal16 CreatePolygonRgn(ptr word word) CreatePolygonRgn(1 2 3)
64 pascal CreateRectRgn(s_word s_word s_word s_word) CreateRectRgn(1 2 3 4) 64 pascal16 CreateRectRgn(s_word s_word s_word s_word) CreateRectRgn(1 2 3 4)
65 pascal CreateRectRgnIndirect(ptr) CreateRectRgnIndirect(1) 65 pascal16 CreateRectRgnIndirect(ptr) CreateRectRgnIndirect(1)
66 pascal CreateSolidBrush(long) CreateSolidBrush(1) 66 pascal16 CreateSolidBrush(long) CreateSolidBrush(1)
67 pascal DPtoLP(word ptr s_word) DPtoLP(1 2 3) 67 pascal16 DPtoLP(word ptr s_word) DPtoLP(1 2 3)
68 pascal DeleteDC(word) DeleteDC(1) 68 pascal16 DeleteDC(word) DeleteDC(1)
69 pascal DeleteObject(word) DeleteObject(1) 69 pascal16 DeleteObject(word) DeleteObject(1)
70 pascal EnumFonts(word ptr ptr ptr) EnumFonts(1 2 3 4) 70 pascal16 EnumFonts(word ptr ptr ptr) EnumFonts(1 2 3 4)
71 pascal EnumObjects(word word ptr ptr) EnumObjects(1 2 3 4) 71 pascal16 EnumObjects(word word ptr ptr) EnumObjects(1 2 3 4)
72 pascal EqualRgn(word word) EqualRgn(1 2) 72 pascal16 EqualRgn(word word) EqualRgn(1 2)
73 pascal ExcludeVisRect(word s_word s_word s_word s_word) 73 pascal16 ExcludeVisRect(word s_word s_word s_word s_word)
ExcludeVisRect(1 2 3 4 5) ExcludeVisRect(1 2 3 4 5)
74 pascal GetBitmapBits(word long ptr) GetBitmapBits(1 2 3) 74 pascal GetBitmapBits(word long ptr) GetBitmapBits(1 2 3)
75 pascal GetBkColor(word) GetBkColor(1) 75 pascal GetBkColor(word) GetBkColor(1)
76 pascal GetBkMode(word) GetBkMode(1) 76 pascal16 GetBkMode(word) GetBkMode(1)
77 pascal GetClipBox(word ptr) GetClipBox(1 2) 77 pascal16 GetClipBox(word ptr) GetClipBox(1 2)
78 pascal GetCurrentPosition(word) GetCurrentPosition(1) 78 pascal GetCurrentPosition(word) GetCurrentPosition(1)
79 pascal GetDCOrg(word) GetDCOrg(1) 79 pascal GetDCOrg(word) GetDCOrg(1)
80 pascal GetDeviceCaps(word s_word) GetDeviceCaps(1 2) 80 pascal16 GetDeviceCaps(word s_word) GetDeviceCaps(1 2)
81 pascal GetMapMode(word) GetMapMode(1) 81 pascal16 GetMapMode(word) GetMapMode(1)
82 pascal GetObject(word word ptr) GetObject(1 2 3) 82 pascal16 GetObject(word word ptr) GetObject(1 2 3)
83 pascal GetPixel(word s_word s_word) GetPixel(1 2 3) 83 pascal GetPixel(word s_word s_word) GetPixel(1 2 3)
84 pascal GetPolyFillMode(word) GetPolyFillMode(1) 84 pascal16 GetPolyFillMode(word) GetPolyFillMode(1)
85 pascal GetROP2(word) GetROP2(1) 85 pascal16 GetROP2(word) GetROP2(1)
86 pascal GetRelAbs(word) GetRelAbs(1) 86 pascal16 GetRelAbs(word) GetRelAbs(1)
87 pascal GetStockObject(word) GetStockObject(1) 87 pascal16 GetStockObject(word) GetStockObject(1)
88 pascal GetStretchBltMode(word) GetStretchBltMode(1) 88 pascal16 GetStretchBltMode(word) GetStretchBltMode(1)
89 pascal GetTextCharacterExtra(word) GetTextCharacterExtra(1) 89 pascal16 GetTextCharacterExtra(word) GetTextCharacterExtra(1)
90 pascal GetTextColor(word) GetTextColor(1) 90 pascal GetTextColor(word) GetTextColor(1)
91 pascal GetTextExtent(word ptr s_word) GetTextExtent(1 2 3) 91 pascal GetTextExtent(word ptr s_word) GetTextExtent(1 2 3)
#92 pascal GetTextFace 92 pascal16 GetTextFace(word s_word ptr) GetTextFace(1 2 3)
93 pascal GetTextMetrics(word ptr) GetTextMetrics(1 2) 93 pascal16 GetTextMetrics(word ptr) GetTextMetrics(1 2)
94 pascal GetViewportExt(word) GetViewportExt(1) 94 pascal GetViewportExt(word) GetViewportExt(1)
95 pascal GetViewportOrg(word) GetViewportOrg(1) 95 pascal GetViewportOrg(word) GetViewportOrg(1)
96 pascal GetWindowExt(word) GetWindowExt(1) 96 pascal GetWindowExt(word) GetWindowExt(1)
97 pascal GetWindowOrg(word) GetWindowOrg(1) 97 pascal GetWindowOrg(word) GetWindowOrg(1)
98 pascal IntersectVisRect(word s_word s_word s_word s_word) 98 pascal16 IntersectVisRect(word s_word s_word s_word s_word)
IntersectVisRect(1 2 3 4 5) IntersectVisRect(1 2 3 4 5)
99 pascal LPtoDP(word ptr s_word) LPtoDP(1 2 3) 99 pascal16 LPtoDP(word ptr s_word) LPtoDP(1 2 3)
100 pascal LineDDA(s_word s_word s_word s_word ptr long) 100 pascal16 LineDDA(s_word s_word s_word s_word ptr long)
LineDDA(1 2 3 4 5 6) LineDDA(1 2 3 4 5 6)
101 pascal OffsetRgn(word s_word s_word) OffsetRgn(1 2 3) 101 pascal16 OffsetRgn(word s_word s_word) OffsetRgn(1 2 3)
102 pascal OffsetVisRgn(word s_word s_word) OffsetVisRgn(1 2 3) 102 pascal16 OffsetVisRgn(word s_word s_word) OffsetVisRgn(1 2 3)
103 pascal PtVisible(word s_word s_word) PtVisible(1 2 3) 103 pascal16 PtVisible(word s_word s_word) PtVisible(1 2 3)
104 pascal RectVisibleOld(word ptr) RectVisible(1 2) 104 pascal16 RectVisibleOld(word ptr) RectVisible(1 2)
105 pascal SelectVisRgn(word word) SelectVisRgn(1 2) 105 pascal16 SelectVisRgn(word word) SelectVisRgn(1 2)
106 pascal SetBitmapBits(word long ptr) SetBitmapBits(1 2 3) 106 pascal SetBitmapBits(word long ptr) SetBitmapBits(1 2 3)
117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3) 117 pascal SetDCOrg(word s_word s_word) SetDCOrg(1 2 3)
#121 pascal Death #121 pascal Death
#122 pascal ReSurRection #122 pascal ReSurRection
123 pascal PlayMetaFile(word word) PlayMetaFile(1 2) 123 pascal16 PlayMetaFile(word word) PlayMetaFile(1 2)
#124 pascal GetMetaFile #124 pascal GetMetaFile
125 pascal CreateMetaFile(ptr) CreateMetaFile(1) 125 pascal16 CreateMetaFile(ptr) CreateMetaFile(1)
126 pascal CloseMetaFile(word) CloseMetaFile(1) 126 pascal16 CloseMetaFile(word) CloseMetaFile(1)
127 pascal DeleteMetaFile(word) DeleteMetaFile(1) 127 pascal16 DeleteMetaFile(word) DeleteMetaFile(1)
128 pascal MulDiv(s_word s_word s_word) MulDiv(1 2 3) 128 pascal MulDiv(s_word s_word s_word) MulDiv(1 2 3)
129 pascal SaveVisRgn(word) SaveVisRgn(1) 129 pascal16 SaveVisRgn(word) SaveVisRgn(1)
130 pascal RestoreVisRgn(word) RestoreVisRgn(1) 130 pascal16 RestoreVisRgn(word) RestoreVisRgn(1)
131 pascal InquireVisRgn(word) InquireVisRgn(1) 131 pascal16 InquireVisRgn(word) InquireVisRgn(1)
132 pascal SetEnvironment(ptr ptr word) SetEnvironment(1 2 3) 132 pascal16 SetEnvironment(ptr ptr word) SetEnvironment(1 2 3)
133 pascal GetEnvironment(ptr ptr word) GetEnvironment(1 2 3) 133 pascal16 GetEnvironment(ptr ptr word) GetEnvironment(1 2 3)
134 pascal GetRgnBox(word ptr) GetRgnBox(1 2) 134 pascal16 GetRgnBox(word ptr) GetRgnBox(1 2)
#135 pascal ScanLr #135 pascal ScanLr
#136 pascal RemoveFontResource #136 pascal RemoveFontResource
148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg(1 2 3) 148 pascal SetBrushOrg(word s_word s_word) SetBrushOrg(1 2 3)
149 pascal GetBrushOrg(word) GetBrushOrg(1) 149 pascal GetBrushOrg(word) GetBrushOrg(1)
150 pascal UnrealizeObject(word) UnrealizeObject(1) 150 pascal16 UnrealizeObject(word) UnrealizeObject(1)
#151 pascal CopyMetaFile #151 pascal CopyMetaFile
153 pascal CreateIC(ptr ptr ptr ptr) CreateIC(1 2 3 4) 153 pascal16 CreateIC(ptr ptr ptr ptr) CreateIC(1 2 3 4)
154 pascal GetNearestColor(word long) GetNearestColor(1 2) 154 pascal GetNearestColor(word long) GetNearestColor(1 2)
#155 pascal QueryAbort #155 pascal QueryAbort
156 pascal CreateDiscardableBitmap(word word word) 156 pascal16 CreateDiscardableBitmap(word word word)
CreateDiscardableBitmap(1 2 3) CreateDiscardableBitmap(1 2 3)
#159 pascal GetMetaFileBits #159 pascal GetMetaFileBits
#160 pascal SetMetaFileBits #160 pascal SetMetaFileBits
161 pascal PtInRegion(word s_word s_word) PtInRegion(1 2 3) 161 pascal16 PtInRegion(word s_word s_word) PtInRegion(1 2 3)
162 pascal GetBitmapDimension(word) GetBitmapDimension(1) 162 pascal GetBitmapDimension(word) GetBitmapDimension(1)
163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension(1 2 3) 163 pascal SetBitmapDimension(word s_word s_word) SetBitmapDimension(1 2 3)
#169 pascal IsDCDirty #169 pascal IsDCDirty
#170 pascal SetDCStatus #170 pascal SetDCStatus
172 pascal SetRectRgn(word s_word s_word s_word s_word) SetRectRgn(1 2 3 4 5) 172 pascal16 SetRectRgn(word s_word s_word s_word s_word) SetRectRgn(1 2 3 4 5)
173 pascal GetClipRgn(word) GetClipRgn(1) 173 pascal16 GetClipRgn(word) GetClipRgn(1)
#175 pascal EnumMetaFile #175 pascal EnumMetaFile
176 pascal PlayMetaFileRecord(word ptr ptr word) PlayMetaFileRecord(1 2 3 4) 176 pascal16 PlayMetaFileRecord(word ptr ptr word) PlayMetaFileRecord(1 2 3 4)
179 pascal GetDCState(word) GetDCState(1) 179 pascal16 GetDCState(word) GetDCState(1)
180 pascal SetDCState(word word) SetDCState(1 2) 180 pascal16 SetDCState(word word) SetDCState(1 2)
181 pascal RectInRegionOld(word ptr) RectInRegion(1 2) 181 pascal16 RectInRegionOld(word ptr) RectInRegion(1 2)
#190 pascal SetDCHook #190 pascal SetDCHook
#191 pascal GetDCHook #191 pascal GetDCHook
#192 pascal SetHookFlags #192 pascal SetHookFlags
@ -203,7 +203,7 @@ length 490
#246 pascal STARTSPOOLPAGE #246 pascal STARTSPOOLPAGE
#247 pascal ENDSPOOLPAGE #247 pascal ENDSPOOLPAGE
#248 pascal QUERYJOB #248 pascal QUERYJOB
250 pascal Copy(ptr ptr word) Copy(1 2 3) 250 pascal16 Copy(ptr ptr word) Copy(1 2 3)
#253 pascal DeleteSpoolPage #253 pascal DeleteSpoolPage
#254 pascal SpoolFile #254 pascal SpoolFile
#300 pascal ENGINEENUMERATEFONT #300 pascal ENGINEENUMERATEFONT
@ -221,30 +221,31 @@ length 490
#312 pascal CONVERTOUTLINEFONTFILE #312 pascal CONVERTOUTLINEFONTFILE
#313 pascal GETRASTERIZERCAPS #313 pascal GETRASTERIZERCAPS
#314 pascal ENGINEEXTTEXTOUT #314 pascal ENGINEEXTTEXTOUT
330 pascal EnumFontFamilies(word ptr ptr ptr) EnumFontFamilies(1 2 3 4) 330 pascal16 EnumFontFamilies(word ptr ptr ptr) EnumFontFamilies(1 2 3 4)
#332 pascal GETKERNINGPAIRS #332 pascal GETKERNINGPAIRS
345 pascal GetTextAlign(word) GetTextAlign(1) 345 pascal16 GetTextAlign(word) GetTextAlign(1)
346 pascal SetTextAlign(word word) SetTextAlign(1 2) 346 pascal16 SetTextAlign(word word) SetTextAlign(1 2)
348 pascal Chord(word s_word s_word s_word s_word s_word s_word s_word s_word) 348 pascal16 Chord(word s_word s_word s_word s_word s_word s_word s_word s_word)
Chord(1 2 3 4 5 6 7 8 9) Chord(1 2 3 4 5 6 7 8 9)
349 pascal SetMapperFlags(word word) SetMapperFlags(1 2) 349 pascal SetMapperFlags(word word) SetMapperFlags(1 2)
350 pascal GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4) 350 pascal16 GetCharWidth(word word word ptr) GetCharWidth(1 2 3 4)
351 pascal ExtTextOut(word s_word s_word word ptr ptr s_word ptr) 351 pascal16 ExtTextOut(word s_word s_word word ptr ptr s_word ptr)
ExtTextOut(1 2 3 4 5 6 7 8) ExtTextOut(1 2 3 4 5 6 7 8)
#352 pascal GETPHYSICALFONTHANDLE #352 pascal GETPHYSICALFONTHANDLE
#353 pascal GETASPECTRATIOFILTER #353 pascal GETASPECTRATIOFILTER
#354 pascal SHRINKGDIHEAP #354 pascal SHRINKGDIHEAP
360 pascal CreatePalette(ptr) CreatePalette(1) 360 pascal16 CreatePalette(ptr) CreatePalette(1)
361 pascal GDISelectPalette(word word) GDISelectPalette(1 2) 361 pascal16 GDISelectPalette(word word) GDISelectPalette(1 2)
362 pascal GDIRealizePalette(word) GDIRealizePalette(1) 362 pascal16 GDIRealizePalette(word) GDIRealizePalette(1)
363 pascal GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4) 363 pascal16 GetPaletteEntries(word word word ptr) GetPaletteEntries(1 2 3 4)
364 pascal SetPaletteEntries(word word word ptr) SetPaletteEntries(1 2 3 4) 364 pascal16 SetPaletteEntries(word word word ptr) SetPaletteEntries(1 2 3 4)
365 pascal RealizeDefaultPalette(word) RealizeDefaultPalette(1) 365 pascal16 RealizeDefaultPalette(word) RealizeDefaultPalette(1)
#366 pascal UPDATECOLORS #366 pascal UPDATECOLORS
#367 pascal ANIMATEPALETTE #367 pascal ANIMATEPALETTE
#368 pascal RESIZEPALETTE #368 pascal RESIZEPALETTE
370 pascal GetNearestPaletteIndex(word long) GetNearestPaletteIndex(1 2) 370 pascal16 GetNearestPaletteIndex(word long) GetNearestPaletteIndex(1 2)
375 pascal GetSystemPaletteEntries(word word word ptr) 372 pascal16 ExtFloodFill(word s_word s_word long word) ExtFloodFill(1 2 3 4)
375 pascal16 GetSystemPaletteEntries(word word word ptr)
GetSystemPaletteEntries(1 2 3 4) GetSystemPaletteEntries(1 2 3 4)
#376 pascal RESETDC #376 pascal RESETDC
#377 pascal STARTDOC #377 pascal STARTDOC
@ -260,51 +261,53 @@ length 490
#407 pascal CREATEUSERBITMAP #407 pascal CREATEUSERBITMAP
#409 pascal CREATEUSERDISCARDABLEBITMAP #409 pascal CREATEUSERDISCARDABLEBITMAP
#410 pascal ISVALIDMETAFILE #410 pascal ISVALIDMETAFILE
411 pascal GetCurLogFont(word) GetCurLogFont(1) 411 pascal16 GetCurLogFont(word) GetCurLogFont(1)
#412 pascal ISDCCURRENTPALETTE #412 pascal ISDCCURRENTPALETTE
#439 pascal STRETCHDIBITS #439 pascal STRETCHDIBITS
440 pascal SetDIBits(word word word word ptr ptr word) SetDIBits(1 2 3 4 5 6 7) 440 pascal16 SetDIBits(word word word word ptr ptr word) SetDIBits(1 2 3 4 5 6 7)
441 pascal GetDIBits(word word word word ptr ptr word) GetDIBits(1 2 3 4 5 6 7) 441 pascal16 GetDIBits(word word word word ptr ptr word) GetDIBits(1 2 3 4 5 6 7)
442 pascal CreateDIBitmap(word ptr long ptr ptr word) 442 pascal16 CreateDIBitmap(word ptr long ptr ptr word)
CreateDIBitmap(1 2 3 4 5 6) CreateDIBitmap(1 2 3 4 5 6)
443 pascal SetDIBitsToDevice(word s_word s_word word word word word word word ptr ptr word) 443 pascal16 SetDIBitsToDevice(word s_word s_word word word word word word
word ptr ptr word)
SetDIBitsToDevice(1 2 3 4 5 6 7 8 9 10 11 12) SetDIBitsToDevice(1 2 3 4 5 6 7 8 9 10 11 12)
444 pascal CreateRoundRectRgn(s_word s_word s_word s_word s_word s_word) 444 pascal16 CreateRoundRectRgn(s_word s_word s_word s_word s_word s_word)
CreateRoundRectRgn(1 2 3 4 5 6) CreateRoundRectRgn(1 2 3 4 5 6)
445 pascal CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2) 445 pascal16 CreateDIBPatternBrush(word word) CreateDIBPatternBrush(1 2)
#449 pascal DEVICECOLORMATCH #449 pascal DEVICECOLORMATCH
450 pascal PolyPolygon(word ptr ptr word) PolyPolygon(1 2 3 4) 450 pascal16 PolyPolygon(word ptr ptr word) PolyPolygon(1 2 3 4)
451 pascal CreatePolyPolygonRgn(ptr ptr word word) 451 pascal16 CreatePolyPolygonRgn(ptr ptr word word)
CreatePolyPolygonRgn(1 2 3 4) CreatePolyPolygonRgn(1 2 3 4)
#452 pascal GDISEEGDIDO #452 pascal GDISEEGDIDO
#460 pascal GDITASKTERMINATION #460 pascal GDITASKTERMINATION
461 return SetObjectOwner 4 0 461 return SetObjectOwner 4 0
462 pascal IsGDIObject(word) IsGDIObject(1) 462 pascal16 IsGDIObject(word) IsGDIObject(1)
#463 pascal MAKEOBJECTPRIVATE #463 pascal MAKEOBJECTPRIVATE
#464 pascal FIXUPBOGUSPUBLISHERMETAFILE #464 pascal FIXUPBOGUSPUBLISHERMETAFILE
465 pascal RectVisible(word ptr) RectVisible(1 2) 465 pascal16 RectVisible(word ptr) RectVisible(1 2)
466 pascal RectInRegion(word ptr) RectInRegion(1 2) 466 pascal16 RectInRegion(word ptr) RectInRegion(1 2)
#467 pascal UNICODETOANSI #467 pascal UNICODETOANSI
468 pascal GetBitmapDimensionEx(word ptr) GetBitmapDimensionEx(1 2) 468 pascal16 GetBitmapDimensionEx(word ptr) GetBitmapDimensionEx(1 2)
469 pascal GetBrushOrgEx(word ptr) GetBrushOrgEx(1 2) 469 pascal16 GetBrushOrgEx(word ptr) GetBrushOrgEx(1 2)
470 pascal GetCurrentPositionEx(word ptr) GetCurrentPositionEx(1 2) 470 pascal16 GetCurrentPositionEx(word ptr) GetCurrentPositionEx(1 2)
471 pascal GetTextExtentPoint(word ptr s_word ptr) GetTextExtentPoint(1 2 3 4) 471 pascal16 GetTextExtentPoint(word ptr s_word ptr) GetTextExtentPoint(1 2 3 4)
472 pascal GetViewportExtEx(word ptr) GetViewportExtEx(1 2) 472 pascal16 GetViewportExtEx(word ptr) GetViewportExtEx(1 2)
473 pascal GetViewportOrgEx(word ptr) GetViewportOrgEx(1 2) 473 pascal16 GetViewportOrgEx(word ptr) GetViewportOrgEx(1 2)
474 pascal GetWindowExtEx(word ptr) GetWindowExtEx(1 2) 474 pascal16 GetWindowExtEx(word ptr) GetWindowExtEx(1 2)
475 pascal GetWindowOrgEx(word ptr) GetWindowOrgEx(1 2) 475 pascal16 GetWindowOrgEx(word ptr) GetWindowOrgEx(1 2)
476 pascal OffsetViewportOrgEx(word s_word s_word ptr) 476 pascal16 OffsetViewportOrgEx(word s_word s_word ptr)
OffsetViewportOrgEx(1 2 3 4) OffsetViewportOrgEx(1 2 3 4)
477 pascal OffsetWindowOrgEx(word s_word s_word ptr) OffsetWindowOrgEx(1 2 3 4) 477 pascal16 OffsetWindowOrgEx(word s_word s_word ptr)
478 pascal SetBitmapDimensionEx(word s_word s_word ptr) OffsetWindowOrgEx(1 2 3 4)
478 pascal16 SetBitmapDimensionEx(word s_word s_word ptr)
SetBitmapDimensionEx(1 2 3 4) SetBitmapDimensionEx(1 2 3 4)
479 pascal SetViewportExtEx(word s_word s_word ptr) SetViewportExtEx(1 2 3 4) 479 pascal16 SetViewportExtEx(word s_word s_word ptr) SetViewportExtEx(1 2 3 4)
480 pascal SetViewportOrgEx(word s_word s_word ptr) SetViewportOrgEx(1 2 3 4) 480 pascal16 SetViewportOrgEx(word s_word s_word ptr) SetViewportOrgEx(1 2 3 4)
481 pascal SetWindowExtEx(word s_word s_word ptr) SetWindowExtEx(1 2 3 4) 481 pascal16 SetWindowExtEx(word s_word s_word ptr) SetWindowExtEx(1 2 3 4)
482 pascal SetWindowOrgEx(word s_word s_word ptr) SetWindowOrgEx(1 2 3 4) 482 pascal16 SetWindowOrgEx(word s_word s_word ptr) SetWindowOrgEx(1 2 3 4)
483 pascal MoveToEx(word s_word s_word ptr) MoveToEx(1 2 3 4) 483 pascal16 MoveToEx(word s_word s_word ptr) MoveToEx(1 2 3 4)
484 pascal ScaleViewportExtEx(word s_word s_word s_word s_word ptr) 484 pascal16 ScaleViewportExtEx(word s_word s_word s_word s_word ptr)
ScaleViewportExtEx(1 2 3 4 5 6) ScaleViewportExtEx(1 2 3 4 5 6)
485 pascal ScaleWindowExtEx(word s_word s_word s_word s_word ptr) 485 pascal16 ScaleWindowExtEx(word s_word s_word s_word s_word ptr)
ScaleWindowExtEx(1 2 3 4 5 6) ScaleWindowExtEx(1 2 3 4 5 6)
#486 pascal GETASPECTRATIOFILEREX #486 pascal GETASPECTRATIOFILEREX

View file

@ -93,7 +93,7 @@ length 415
word word word word word) word word word word word)
KERNEL_InitTask() KERNEL_InitTask()
92 pascal16 GetTempDrive(byte) GetTempDrive(1) 92 pascal16 GetTempDrive(byte) GetTempDrive(1)
#93 pascal16 GETCODEHANDLE 93 pascal16 GetCodeHandle(ptr) GetCodeHandle(1)
#94 DEFINEHANDLETABLE #94 DEFINEHANDLETABLE
95 pascal16 LoadLibrary(ptr) LoadLibrary(1) 95 pascal16 LoadLibrary(ptr) LoadLibrary(1)
96 pascal16 FreeLibrary(word) FreeLibrary(1) 96 pascal16 FreeLibrary(word) FreeLibrary(1)
@ -108,7 +108,7 @@ length 415
#103 NETBIOSCALL #103 NETBIOSCALL
#104 GETCODEINFO #104 GETCODEINFO
#105 GETEXEVERSION #105 GETEXEVERSION
#106 SETSWAPAREASIZE 106 pascal SetSwapAreaSize(word) SetSwapAreaSize(1)
107 pascal SetErrorMode(word) SetErrorMode(1) 107 pascal SetErrorMode(word) SetErrorMode(1)
#108 SWITCHSTACKTO #108 SWITCHSTACKTO
#109 SWITCHSTACKBACK #109 SWITCHSTACKBACK
@ -135,7 +135,7 @@ length 415
GetPrivateProfileString(1 2 3 4 5 6) GetPrivateProfileString(1 2 3 4 5 6)
129 pascal16 WritePrivateProfileString(ptr ptr ptr ptr) 129 pascal16 WritePrivateProfileString(ptr ptr ptr ptr)
WritePrivateProfileString(1 2 3 4) WritePrivateProfileString(1 2 3 4)
#130 FILECBR 130 pascal FileCDR(ptr) FileCDR(1)
131 pascal GetDOSEnvironment() GetDOSEnvironment() 131 pascal GetDOSEnvironment() GetDOSEnvironment()
132 pascal GetWinFlags() GetWinFlags() 132 pascal GetWinFlags() GetWinFlags()
#133 GETEXEPTR #133 GETEXEPTR

View file

@ -110,12 +110,12 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
unsigned short *stack_p; unsigned short *stack_p;
ret_addr = (unsigned int *) ((char *) seg_off + 0x14); ret_addr = (unsigned int *) ((char *) seg_off + 0x14);
printf("Calling %s (%s.%d), 16-bit stack at %04x:%04x, ", printf("Call %s (%s.%d), stack=%04x:%04x, ",
dll_p->export_name, dll_p->export_name,
dll_builtin_table[dll_id].dll_name, ordinal, dll_builtin_table[dll_id].dll_name, ordinal,
seg_off >> 16, seg_off & 0xffff); seg_off >> 16, seg_off & 0xffff);
printf("return to %08x\n", *ret_addr); printf("ret=%08x", *ret_addr);
printf(" ESP %08x, EBP %08x, SS %04x\n", printf(" ESP=%08x, EBP=%08x, SS=%04x\n",
IF1632_Saved16_esp, IF1632_Saved16_ebp, IF1632_Saved16_esp, IF1632_Saved16_ebp,
IF1632_Saved16_ss); IF1632_Saved16_ss);

View file

@ -270,9 +270,10 @@ length 540
256 pascal GetDriverInfo(word ptr) GetDriverInfo(1 2) 256 pascal GetDriverInfo(word ptr) GetDriverInfo(1 2)
257 pascal GetNextDriver(word long) GetNextDriver(1 2) 257 pascal GetNextDriver(word long) GetNextDriver(1 2)
258 pascal MapWindowPoints(word word ptr word) MapWindowPoints(1 2 3 4) 258 pascal MapWindowPoints(word word ptr word) MapWindowPoints(1 2 3 4)
#259 BEGINDEFERWINDOWPOS 259 pascal16 BeginDeferWindowPos(s_word) BeginDeferWindowPos(1)
#260 DEFERWINDOWPOS 260 pascal16 DeferWindowPos(word word word s_word s_word s_word s_word word)
#261 ENDDEFERWINDOWPOS DeferWindowPos(1 2 3 4 5 6 7 8)
261 pascal16 EndDeferWindowPos(word) EndDeferWindowPos(1)
262 pascal GetWindow(word word) GetWindow(1 2) 262 pascal GetWindow(word word) GetWindow(1 2)
263 pascal GetMenuItemCount(word) GetMenuItemCount(1) 263 pascal GetMenuItemCount(word) GetMenuItemCount(1)
264 pascal GetMenuItemID(word word) GetMenuItemID(1 2) 264 pascal GetMenuItemID(word word) GetMenuItemID(1 2)

View file

@ -33,6 +33,4 @@ AllTarget()
depend:: depend::
CleanTarget()
includes:: includes::

View file

@ -10,9 +10,6 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "windows.h" #include "windows.h"
/* Handle of the bitmap selected by default in a memory DC */
extern HBITMAP BITMAP_hbitmapMemDC;
/* GCs used for B&W and color bitmap operations */ /* GCs used for B&W and color bitmap operations */
extern GC BITMAP_monoGC, BITMAP_colorGC; extern GC BITMAP_monoGC, BITMAP_colorGC;

33
include/button.h Normal file
View file

@ -0,0 +1,33 @@
/*
* Button-class extra info
*
* Copyright 1994 Alexandre Julliard
*/
#ifndef BUTTON_H
#define BUTTON_H
#include "windows.h"
/* Extra info for BUTTON windows */
/* Note: under MS-Windows, state is a BYTE and this structure is */
/* only 3 bytes long. I don't think there are programs out there */
/* broken enough to rely on this :-) */
typedef struct
{
WORD state; /* Current state */
HFONT hFont; /* Button font (or 0 for system font) */
} BUTTONINFO;
/* Button state values */
#define BUTTON_UNCHECKED 0x00
#define BUTTON_CHECKED 0x01
#define BUTTON_3STATE 0x02
#define BUTTON_HIGHLIGHTED 0x04
#define BUTTON_HASFOCUS 0x08
#define BUTTON_STATE(hwnd) ((WIN_FindWndPtr(hwnd))->wExtra[0])
extern LONG ButtonWndProc( HWND hWnd, WORD uMsg, WORD wParam, LONG lParam );
#endif /* BUTTON_H */

916
include/debug.h Normal file
View file

@ -0,0 +1,916 @@
#include <stdio.h>
#define stddeb stdout
#define stdnimp stderr
# /* Do not remove this line or change anything below this line */
#ifdef DEBUG_NONE_EXT
#undef DEBUG_ACCEL
#undef DEBUG_BITMAP
#undef DEBUG_CARET
#undef DEBUG_CDAUDIO
#undef DEBUG_CLASS
#undef DEBUG_CLIPBOARD
#undef DEBUG_CLIPPING
#undef DEBUG_COMBO
#undef DEBUG_COMM
#undef DEBUG_CURSOR
#undef DEBUG_DC
#undef DEBUG_DIALOG
#undef DEBUG_DLL
#undef DEBUG_DOSFS
#undef DEBUG_DRIVER
#undef DEBUG_EDIT
#undef DEBUG_ENUM
#undef DEBUG_EVENT
#undef DEBUG_EXEC
#undef DEBUG_FILE
#undef DEBUG_FIXUP
#undef DEBUG_FONT
#undef DEBUG_GDI
#undef DEBUG_GRAPHICS
#undef DEBUG_HEAP
#undef DEBUG_ICON
#undef DEBUG_INT
#undef DEBUG_KEY
#undef DEBUG_KEYBOARD
#undef DEBUG_LDT
#undef DEBUG_LISTBOX
#undef DEBUG_MCIWAVE
#undef DEBUG_MDI
#undef DEBUG_MENU
#undef DEBUG_MENUCALC
#undef DEBUG_MESSAGE
#undef DEBUG_METAFILE
#undef DEBUG_MODULE
#undef DEBUG_MSG
#undef DEBUG_NONCLIENT
#undef DEBUG_PALETTE
#undef DEBUG_REGION
#undef DEBUG_RESOURCE
#undef DEBUG_SCROLL
#undef DEBUG_SYSCOLOR
#undef DEBUG_TEXT
#undef DEBUG_TIMER
#undef DEBUG_UTILITY
#undef DEBUG_WIN
#endif
#ifdef DEBUG_ALL_EXT
#define DEBUG_ACCEL
#define DEBUG_BITMAP
#define DEBUG_CARET
#define DEBUG_CDAUDIO
#define DEBUG_CLASS
#define DEBUG_CLIPBOARD
#define DEBUG_CLIPPING
#define DEBUG_COMBO
#define DEBUG_COMM
#define DEBUG_CURSOR
#define DEBUG_DC
#define DEBUG_DIALOG
#define DEBUG_DLL
#define DEBUG_DOSFS
#define DEBUG_DRIVER
#define DEBUG_EDIT
#define DEBUG_ENUM
#define DEBUG_EVENT
#define DEBUG_EXEC
#define DEBUG_FILE
#define DEBUG_FIXUP
#define DEBUG_FONT
#define DEBUG_GDI
#define DEBUG_GRAPHICS
#define DEBUG_HEAP
#define DEBUG_ICON
#define DEBUG_INT
#define DEBUG_KEY
#define DEBUG_KEYBOARD
#define DEBUG_LDT
#define DEBUG_LISTBOX
#define DEBUG_MCIWAVE
#define DEBUG_MDI
#define DEBUG_MENU
#define DEBUG_MENUCALC
#define DEBUG_MESSAGE
#define DEBUG_METAFILE
#define DEBUG_MODULE
#define DEBUG_MSG
#define DEBUG_NONCLIENT
#define DEBUG_PALETTE
#define DEBUG_REGION
#define DEBUG_RESOURCE
#define DEBUG_SCROLL
#define DEBUG_SYSCOLOR
#define DEBUG_TEXT
#define DEBUG_TIMER
#define DEBUG_UTILITY
#define DEBUG_WIN
#endif
#ifdef DEBUG_RUNTIME
#ifdef DEBUG_DEFINE_VARIABLES
short debug_msg_enabled[]={
#ifdef DEBUG_ACCEL
1,
#else
0,
#endif
#ifdef DEBUG_BITMAP
1,
#else
0,
#endif
#ifdef DEBUG_CARET
1,
#else
0,
#endif
#ifdef DEBUG_CDAUDIO
1,
#else
0,
#endif
#ifdef DEBUG_CLASS
1,
#else
0,
#endif
#ifdef DEBUG_CLIPBOARD
1,
#else
0,
#endif
#ifdef DEBUG_CLIPPING
1,
#else
0,
#endif
#ifdef DEBUG_COMBO
1,
#else
0,
#endif
#ifdef DEBUG_COMM
1,
#else
0,
#endif
#ifdef DEBUG_CURSOR
1,
#else
0,
#endif
#ifdef DEBUG_DC
1,
#else
0,
#endif
#ifdef DEBUG_DIALOG
1,
#else
0,
#endif
#ifdef DEBUG_DLL
1,
#else
0,
#endif
#ifdef DEBUG_DOSFS
1,
#else
0,
#endif
#ifdef DEBUG_DRIVER
1,
#else
0,
#endif
#ifdef DEBUG_EDIT
1,
#else
0,
#endif
#ifdef DEBUG_ENUM
1,
#else
0,
#endif
#ifdef DEBUG_EVENT
1,
#else
0,
#endif
#ifdef DEBUG_EXEC
1,
#else
0,
#endif
#ifdef DEBUG_FILE
1,
#else
0,
#endif
#ifdef DEBUG_FIXUP
1,
#else
0,
#endif
#ifdef DEBUG_FONT
1,
#else
0,
#endif
#ifdef DEBUG_GDI
1,
#else
0,
#endif
#ifdef DEBUG_GRAPHICS
1,
#else
0,
#endif
#ifdef DEBUG_HEAP
1,
#else
0,
#endif
#ifdef DEBUG_ICON
1,
#else
0,
#endif
#ifdef DEBUG_INT
1,
#else
0,
#endif
#ifdef DEBUG_KEY
1,
#else
0,
#endif
#ifdef DEBUG_KEYBOARD
1,
#else
0,
#endif
#ifdef DEBUG_LDT
1,
#else
0,
#endif
#ifdef DEBUG_LISTBOX
1,
#else
0,
#endif
#ifdef DEBUG_MCIWAVE
1,
#else
0,
#endif
#ifdef DEBUG_MDI
1,
#else
0,
#endif
#ifdef DEBUG_MENU
1,
#else
0,
#endif
#ifdef DEBUG_MENUCALC
1,
#else
0,
#endif
#ifdef DEBUG_MESSAGE
1,
#else
0,
#endif
#ifdef DEBUG_METAFILE
1,
#else
0,
#endif
#ifdef DEBUG_MODULE
1,
#else
0,
#endif
#ifdef DEBUG_MSG
1,
#else
0,
#endif
#ifdef DEBUG_NONCLIENT
1,
#else
0,
#endif
#ifdef DEBUG_PALETTE
1,
#else
0,
#endif
#ifdef DEBUG_REGION
1,
#else
0,
#endif
#ifdef DEBUG_RESOURCE
1,
#else
0,
#endif
#ifdef DEBUG_SCROLL
1,
#else
0,
#endif
#ifdef DEBUG_SYSCOLOR
1,
#else
0,
#endif
#ifdef DEBUG_TEXT
1,
#else
0,
#endif
#ifdef DEBUG_TIMER
1,
#else
0,
#endif
#ifdef DEBUG_UTILITY
1,
#else
0,
#endif
#ifdef DEBUG_WIN
1,
#else
0,
#endif
0};
#else
extern short debug_msg_enabled[];
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_accel if(debug_msg_enabled[0]) fprintf
#else
#ifdef DEBUG_ACCEL
#define dprintf_accel fprintf
#else
#define dprintf_accel
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_bitmap if(debug_msg_enabled[1]) fprintf
#else
#ifdef DEBUG_BITMAP
#define dprintf_bitmap fprintf
#else
#define dprintf_bitmap
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_caret if(debug_msg_enabled[2]) fprintf
#else
#ifdef DEBUG_CARET
#define dprintf_caret fprintf
#else
#define dprintf_caret
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_cdaudio if(debug_msg_enabled[3]) fprintf
#else
#ifdef DEBUG_CDAUDIO
#define dprintf_cdaudio fprintf
#else
#define dprintf_cdaudio
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_class if(debug_msg_enabled[4]) fprintf
#else
#ifdef DEBUG_CLASS
#define dprintf_class fprintf
#else
#define dprintf_class
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_clipboard if(debug_msg_enabled[5]) fprintf
#else
#ifdef DEBUG_CLIPBOARD
#define dprintf_clipboard fprintf
#else
#define dprintf_clipboard
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_clipping if(debug_msg_enabled[6]) fprintf
#else
#ifdef DEBUG_CLIPPING
#define dprintf_clipping fprintf
#else
#define dprintf_clipping
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_combo if(debug_msg_enabled[7]) fprintf
#else
#ifdef DEBUG_COMBO
#define dprintf_combo fprintf
#else
#define dprintf_combo
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_comm if(debug_msg_enabled[8]) fprintf
#else
#ifdef DEBUG_COMM
#define dprintf_comm fprintf
#else
#define dprintf_comm
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_cursor if(debug_msg_enabled[9]) fprintf
#else
#ifdef DEBUG_CURSOR
#define dprintf_cursor fprintf
#else
#define dprintf_cursor
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_dc if(debug_msg_enabled[10]) fprintf
#else
#ifdef DEBUG_DC
#define dprintf_dc fprintf
#else
#define dprintf_dc
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_dialog if(debug_msg_enabled[11]) fprintf
#else
#ifdef DEBUG_DIALOG
#define dprintf_dialog fprintf
#else
#define dprintf_dialog
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_dll if(debug_msg_enabled[12]) fprintf
#else
#ifdef DEBUG_DLL
#define dprintf_dll fprintf
#else
#define dprintf_dll
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_dosfs if(debug_msg_enabled[13]) fprintf
#else
#ifdef DEBUG_DOSFS
#define dprintf_dosfs fprintf
#else
#define dprintf_dosfs
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_driver if(debug_msg_enabled[14]) fprintf
#else
#ifdef DEBUG_DRIVER
#define dprintf_driver fprintf
#else
#define dprintf_driver
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_edit if(debug_msg_enabled[15]) fprintf
#else
#ifdef DEBUG_EDIT
#define dprintf_edit fprintf
#else
#define dprintf_edit
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_enum if(debug_msg_enabled[16]) fprintf
#else
#ifdef DEBUG_ENUM
#define dprintf_enum fprintf
#else
#define dprintf_enum
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_event if(debug_msg_enabled[17]) fprintf
#else
#ifdef DEBUG_EVENT
#define dprintf_event fprintf
#else
#define dprintf_event
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_exec if(debug_msg_enabled[18]) fprintf
#else
#ifdef DEBUG_EXEC
#define dprintf_exec fprintf
#else
#define dprintf_exec
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_file if(debug_msg_enabled[19]) fprintf
#else
#ifdef DEBUG_FILE
#define dprintf_file fprintf
#else
#define dprintf_file
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_fixup if(debug_msg_enabled[20]) fprintf
#else
#ifdef DEBUG_FIXUP
#define dprintf_fixup fprintf
#else
#define dprintf_fixup
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_font if(debug_msg_enabled[21]) fprintf
#else
#ifdef DEBUG_FONT
#define dprintf_font fprintf
#else
#define dprintf_font
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_gdi if(debug_msg_enabled[22]) fprintf
#else
#ifdef DEBUG_GDI
#define dprintf_gdi fprintf
#else
#define dprintf_gdi
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_graphics if(debug_msg_enabled[23]) fprintf
#else
#ifdef DEBUG_GRAPHICS
#define dprintf_graphics fprintf
#else
#define dprintf_graphics
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_heap if(debug_msg_enabled[24]) fprintf
#else
#ifdef DEBUG_HEAP
#define dprintf_heap fprintf
#else
#define dprintf_heap
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_icon if(debug_msg_enabled[25]) fprintf
#else
#ifdef DEBUG_ICON
#define dprintf_icon fprintf
#else
#define dprintf_icon
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_int if(debug_msg_enabled[26]) fprintf
#else
#ifdef DEBUG_INT
#define dprintf_int fprintf
#else
#define dprintf_int
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_key if(debug_msg_enabled[27]) fprintf
#else
#ifdef DEBUG_KEY
#define dprintf_key fprintf
#else
#define dprintf_key
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_keyboard if(debug_msg_enabled[28]) fprintf
#else
#ifdef DEBUG_KEYBOARD
#define dprintf_keyboard fprintf
#else
#define dprintf_keyboard
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_ldt if(debug_msg_enabled[29]) fprintf
#else
#ifdef DEBUG_LDT
#define dprintf_ldt fprintf
#else
#define dprintf_ldt
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_listbox if(debug_msg_enabled[30]) fprintf
#else
#ifdef DEBUG_LISTBOX
#define dprintf_listbox fprintf
#else
#define dprintf_listbox
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_mciwave if(debug_msg_enabled[31]) fprintf
#else
#ifdef DEBUG_MCIWAVE
#define dprintf_mciwave fprintf
#else
#define dprintf_mciwave
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_mdi if(debug_msg_enabled[32]) fprintf
#else
#ifdef DEBUG_MDI
#define dprintf_mdi fprintf
#else
#define dprintf_mdi
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_menu if(debug_msg_enabled[33]) fprintf
#else
#ifdef DEBUG_MENU
#define dprintf_menu fprintf
#else
#define dprintf_menu
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_menucalc if(debug_msg_enabled[34]) fprintf
#else
#ifdef DEBUG_MENUCALC
#define dprintf_menucalc fprintf
#else
#define dprintf_menucalc
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_message if(debug_msg_enabled[35]) fprintf
#else
#ifdef DEBUG_MESSAGE
#define dprintf_message fprintf
#else
#define dprintf_message
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_metafile if(debug_msg_enabled[36]) fprintf
#else
#ifdef DEBUG_METAFILE
#define dprintf_metafile fprintf
#else
#define dprintf_metafile
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_module if(debug_msg_enabled[37]) fprintf
#else
#ifdef DEBUG_MODULE
#define dprintf_module fprintf
#else
#define dprintf_module
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_msg if(debug_msg_enabled[38]) fprintf
#else
#ifdef DEBUG_MSG
#define dprintf_msg fprintf
#else
#define dprintf_msg
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_nonclient if(debug_msg_enabled[39]) fprintf
#else
#ifdef DEBUG_NONCLIENT
#define dprintf_nonclient fprintf
#else
#define dprintf_nonclient
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_palette if(debug_msg_enabled[40]) fprintf
#else
#ifdef DEBUG_PALETTE
#define dprintf_palette fprintf
#else
#define dprintf_palette
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_region if(debug_msg_enabled[41]) fprintf
#else
#ifdef DEBUG_REGION
#define dprintf_region fprintf
#else
#define dprintf_region
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_resource if(debug_msg_enabled[42]) fprintf
#else
#ifdef DEBUG_RESOURCE
#define dprintf_resource fprintf
#else
#define dprintf_resource
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_scroll if(debug_msg_enabled[43]) fprintf
#else
#ifdef DEBUG_SCROLL
#define dprintf_scroll fprintf
#else
#define dprintf_scroll
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_syscolor if(debug_msg_enabled[44]) fprintf
#else
#ifdef DEBUG_SYSCOLOR
#define dprintf_syscolor fprintf
#else
#define dprintf_syscolor
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_text if(debug_msg_enabled[45]) fprintf
#else
#ifdef DEBUG_TEXT
#define dprintf_text fprintf
#else
#define dprintf_text
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_timer if(debug_msg_enabled[46]) fprintf
#else
#ifdef DEBUG_TIMER
#define dprintf_timer fprintf
#else
#define dprintf_timer
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_utility if(debug_msg_enabled[47]) fprintf
#else
#ifdef DEBUG_UTILITY
#define dprintf_utility fprintf
#else
#define dprintf_utility
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_win if(debug_msg_enabled[48]) fprintf
#else
#ifdef DEBUG_WIN
#define dprintf_win fprintf
#else
#define dprintf_win
#endif
#endif
#ifdef DEBUG_RUNTIME
#ifdef DEBUG_DEFINE_VARIABLES
static char *debug_msg_name[] = {
"accel",
"bitmap",
"caret",
"cdaudio",
"class",
"clipboard",
"clipping",
"combo",
"comm",
"cursor",
"dc",
"dialog",
"dll",
"dosfs",
"driver",
"edit",
"enum",
"event",
"exec",
"file",
"fixup",
"font",
"gdi",
"graphics",
"heap",
"icon",
"int",
"key",
"keyboard",
"ldt",
"listbox",
"mciwave",
"mdi",
"menu",
"menucalc",
"message",
"metafile",
"module",
"msg",
"nonclient",
"palette",
"region",
"resource",
"scroll",
"syscolor",
"text",
"timer",
"utility",
"win",
""};
#endif
#endif

View file

@ -16,15 +16,15 @@
*/ */
typedef struct typedef struct
{ {
LONG msgResult; LONG msgResult; /* Result of EndDialog() / Default button id */
FARPROC dlgProc; WNDPROC dlgProc; /* Dialog procedure */
LONG userInfo; LONG userInfo; /* User information (for DWL_USER) */
HWND hwndFocus; HWND hwndFocus; /* Current control with focus */
HFONT hUserFont; HFONT hUserFont; /* Dialog font */
HMENU hMenu; HMENU hMenu; /* Dialog menu */
WORD xBaseUnit; WORD xBaseUnit; /* Dialog units (depends on the font) */
WORD yBaseUnit; WORD yBaseUnit;
WORD fEnd; WORD fEnd; /* EndDialog() called for this dialog */
HANDLE hDialogHeap; HANDLE hDialogHeap;
} DIALOGINFO; } DIALOGINFO;

View file

@ -17,23 +17,38 @@ typedef struct resource_name_table
char id[MAX_NAME_LENGTH]; char id[MAX_NAME_LENGTH];
} RESNAMTAB; } RESNAMTAB;
struct w_files struct ne_data {
{
struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */
int fd;
struct mz_header_s *mz_header;
struct ne_header_s *ne_header; struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table; struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table; struct segment_descriptor_s *selector_table;
char *lookup_table; char *lookup_table;
char *nrname_table; char *nrname_table;
char *rname_table; char *rname_table;
unsigned short hinstance;
RESNAMTAB *resnamtab; RESNAMTAB *resnamtab;
}; };
struct pe_data {
struct pe_header_s *pe_header;
struct pe_segment_table *pe_seg;
struct PE_Import_Directory *pe_import;
struct PE_Export_Directory *pe_export;
struct PE_Resource_Directory *pe_resource;
int resource_offset; /* offset to resource typedirectory in file */
};
struct w_files
{
struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */
int fd;
unsigned short hinstance;
int initialised;
struct mz_header_s *mz_header;
struct ne_data *ne;
struct pe_data *pe;
};
extern struct w_files *wine_files; extern struct w_files *wine_files;
typedef struct dll_arg_relocation_s typedef struct dll_arg_relocation_s

View file

@ -302,7 +302,6 @@ extern HANDLE GDI_AllocObject( WORD, WORD );
extern BOOL GDI_FreeObject( HANDLE ); extern BOOL GDI_FreeObject( HANDLE );
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD ); extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
extern Display * XT_display; /* Will be removed */
extern Display * display; extern Display * display;
extern Screen * screen; extern Screen * screen;
extern Window rootWindow; extern Window rootWindow;

View file

@ -15,7 +15,7 @@ typedef struct
{ {
HHOOK next; /* Next hook in chain */ HHOOK next; /* Next hook in chain */
HOOKPROC proc; /* Hook procedure */ HOOKPROC proc; /* Hook procedure */
short id; /* Hook id (WH_???) */ short id; /* Hook id (WH_xxx) */
HTASK htask; /* Task owning this hook */ HTASK htask; /* Task owning this hook */
} HOOKDATA; } HOOKDATA;

View file

@ -7,6 +7,7 @@ typedef struct tagLISTSTRUCT {
DRAWITEMSTRUCT dis; DRAWITEMSTRUCT dis;
HANDLE hMem; HANDLE hMem;
HANDLE hData; HANDLE hData;
char *itemText;
void *lpNext; void *lpNext;
} LISTSTRUCT; } LISTSTRUCT;
typedef LISTSTRUCT FAR* LPLISTSTRUCT; typedef LISTSTRUCT FAR* LPLISTSTRUCT;

View file

@ -10,6 +10,7 @@ struct dosdirent {
char filename[256]; char filename[256];
char filemask[12]; char filemask[12];
char attribute; char attribute;
char search_attribute;
long filesize; long filesize;
long filetime; long filetime;
}; };

214
include/peexe.h Normal file
View file

@ -0,0 +1,214 @@
/*
* Copyright Eric Youngdale (1994)
*/
#ifndef __WINE_PEEXE_H
#define __WINE_PEEXE_H
struct coff_header
{
u_short Machine;
u_short NumberOfSections;
u_long TimeDateStamp;
u_long PointerToSymbolTable;
u_long NumberOfSymbols;
u_short SizeOfOptionalHeader;
u_short Characteristics;
};
/* These defines describe the meanings of the bits in the Characteristics
field */
#define IMAGE_FILE_RELOCS_STRIPPED 1 /* No relocation info */
#define IMAGE_FILE_EXECUTABLE_IMAGE 2
#define IMAGE_FILE_LINE_NUMS_STRIPPED 4
#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
#define IMAGE_FILE_16BIT_MACHINE 0x40
#define IMAGE_FILE_BYTES_REVERSED_LO 0x80
#define IMAGE_FILE_32BIT_MACHINE 0x100
#define IMAGE_FILE_DEBUG_STRIPPED 0x200
#define IMAGE_FILE_SYSTEM 0x1000
#define IMAGE_FILE_DLL 0x2000
#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
/* These are the settings of the Machine field. */
#define IMAGE_FILE_MACHINE_UNKNOWN 0
#define IMAGE_FILE_MACHINE_I860 0x14d
#define IMAGE_FILE_MACHINE_I386 0x14c
#define IMAGE_FILE_MACHINE_R3000 0x162
#define IMAGE_FILE_MACHINE_R4000 0x166
#define IMAGE_FILE_MACHINE_ALPHA 0x184
struct Directory
{
u_long Virtual_address;
u_long Size;
};
/* Optional coff header - used by NT to provide additional information. */
struct ocoffhdr
{
u_short Magic; /* Good old COFF magic 0413 */
u_char MajorLinkerVersion;
u_char MinorLinkerVersion;
u_long SizeOfCode;
u_long SizeOfInitializedData;
u_long SizeOfUninitializedData;
u_long AddressOfEntryPoint;
u_long BaseOfCode;
u_long BaseOfData;
u_long BaseOfImage;
u_long SectionAlignment;
u_long FileAlignment;
u_short MajorOperatingSystemVersion;
u_short MinorOperatingSystemVersion;
u_short MajorImageVersion;
u_short MinorImageVersion;
u_short MajorSubsystemVersion;
u_short MinorSubsystemVersion;
u_long Unknown1;
u_long SizeOfImage;
u_long SizeOfHeaders;
u_long CheckSum;
u_short Subsystem;
u_short DllCharacteristics;
u_long SizeOfStackReserve;
u_long SizeOfStackCommit;
u_long SizeOfHeapReserve;
u_long SizeOfHeapCommit;
u_long LoaderFlags;
u_long NumberOfRvaAndSizes;
struct Directory DataDirectory[16];
};
/* These are indexes into the DataDirectory array */
#define IMAGE_FILE_EXPORT_DIRECTORY 0
#define IMAGE_FILE_IMPORT_DIRECTORY 1
#define IMAGE_FILE_RESOURCE_DIRECTORY 2
#define IMAGE_FILE_EXCEPTION_DIRECTORY 3
#define IMAGE_FILE_SECURITY_DIRECTORY 4
#define IMAGE_FILE_BASE_RELOCATION_TABLE 5
#define IMAGE_FILE_DEBUG_DIRECTORY 6
#define IMAGE_FILE_DESCRIPTION_STRING 7
#define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
#define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
#define IMAGE_FILE_CALLBACK_DIRECTORY 10
struct pe_header_s
{
char magic[4]; /* Must be 'P', 'E', 0, 0 */
struct coff_header coff;
struct ocoffhdr opt_coff;
};
struct pe_segment_table
{
u_char Name[8];
u_long Virtual_Size;
u_long Virtual_Address;
u_long Size_Of_Raw_Data;
u_long PointerToRawData;
u_long PointerToRelocations;
u_long PointerToLinenumbers;
u_short NumberOfRelocations;
u_short NumberOfLinenumbers;
u_long Characteristics;
};
/* These defines are for the Characteristics bitfield. */
#define IMAGE_SCN_TYPE_CNT_CODE 0x20
#define IMAGE_SCN_TYPE_CNT_INITIALIZED_DATA 0x40
#define IMAGE_SCN_TYPE_CNT_UNINITIALIZED_DATA 0x80
#define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
#define IMAGE_SCN_MEM_SHARED 0x10000000
#define IMAGE_SCN_MEM_EXECUTE 0x20000000
#define IMAGE_SCN_MEM_READ 0x40000000
#define IMAGE_SCN_MEM_WRITE 0x80000000
/*
* Import module directory stuff
*/
struct PE_Import_Directory
{
u_int Import_List;
u_int reserved[2];
u_int ModuleName;
u_int reserved1;
};
struct pe_import_name
{
u_short Hint;
u_char Name[1];
};
/*
* Export module directory stuff
*/
struct PE_Export_Directory
{
u_long Characteristics;
u_long TimeDateStamp;
u_short Major_version;
u_short Minor_version;
u_long Name;
u_long Base;
u_long Number_Of_Functions;
u_long Number_Of_Names;
u_long * AddressOfFunctions;
u_long * AddressOfNames;
u_short * Address_Of_Name_Ordinals;
};
/*
* Resource directory stuff
*/
struct PE_Resource_Directory
{
u_long Characteristics;
u_long TimeDateStamp;
u_short MajorVersion;
u_short MinorVersion;
u_short NumberOfNamedEntries;
u_short NumberOfIdEntries;
};
struct PE_Directory_Entry
{
u_long Name;
u_long OffsetToData;
};
struct PE_Directory_Name_String
{
u_short Length;
char NameString[1];
};
struct PE_Directory_Name_String_U
{
u_short Length;
u_short NameString[1];
};
struct PE_Resource_Leaf_Entry
{
u_long OffsetToData;
u_long Size;
u_long CodePage;
u_long Reserved;
};
#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
#endif /* __WINE_PEEXE_H */

View file

@ -40,16 +40,6 @@ int set_ldt_entry(int entry, unsigned long base, unsigned int limit,
extern int OpenResourceFile(HANDLE instance); extern int OpenResourceFile(HANDLE instance);
extern HBITMAP ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image ); extern HBITMAP ConvertCoreBitmap( HDC hdc, BITMAPCOREHEADER * image );
extern HBITMAP ConvertInfoBitmap( HDC hdc, BITMAPINFO * image ); extern HBITMAP ConvertInfoBitmap( HDC hdc, BITMAPINFO * image );
extern int FindResourceByNumber(struct resource_nameinfo_s *result_p,
int type_id, int resource_id);
extern int FindResourceByName(struct resource_nameinfo_s *result_p,
int type_id, char *resource_name);
extern HICON LoadIcon(HANDLE instance, LPSTR icon_name);
extern HANDLE RSC_LoadResource(int instance, char *rsc_name, int type,
int *image_size_ret);
extern int LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen);
extern HANDLE RSC_LoadMenu(HANDLE instance, LPSTR menu_name);
extern HBITMAP LoadBitmap(HANDLE instance, LPSTR bmp_name);
/* loader/selector.c */ /* loader/selector.c */

23
include/resource.h Normal file
View file

@ -0,0 +1,23 @@
#ifndef __WINE_RESOURCE_H
#define __WINE_RESOURCE_H
#include "dlls.h"
typedef struct resource_s {
struct resource_s *next;
HANDLE info_mem; /* this struct */
int size_shift;
struct resource_nameinfo_s nameinfo;
HANDLE rsc_mem; /* resource data */
/* */
HANDLE instance; /* resource instance */
LPSTR name; /* resource name */
LPSTR type; /* resource type */
int count; /* lock count */
int size; /* resource size */
int fd; /* fd */
int offset; /* offset */
struct w_files *wpnt;
} RESOURCE;
#endif /* __WINE_RESOURCE_H */

View file

@ -77,12 +77,6 @@ extern int IPCCopySelector(int i_old, unsigned long new, int swap_type);
#define FIRST_SELECTOR 8 #define FIRST_SELECTOR 8
static __inline__ int Is16bitAddress(void *address)
{
return ((unsigned int) address
>= (((FIRST_SELECTOR << 3) | 0x0007) << 16));
}
extern SEGDESC Segments[]; extern SEGDESC Segments[];
#endif /* SEGMEM_H */ #endif /* SEGMEM_H */

22
include/static.h Normal file
View file

@ -0,0 +1,22 @@
/*
* Static-class extra info
*
* Copyright 1994 Alexandre Julliard
*/
#ifndef STATIC_H
#define STATIC_H
#include "windows.h"
/* Extra info for STATIC windows */
typedef struct
{
HFONT hFont; /* Control font (or 0 for system font) */
WORD dummy; /* Don't know what MS-Windows puts in there */
HICON hIcon; /* Icon handle for SS_ICON controls */
} STATICINFO;
extern LONG StaticWndProc( HWND hWnd, WORD uMsg, WORD wParam, LONG lParam );
#endif /* STATIC_H */

178
include/stddebug.h Normal file
View file

@ -0,0 +1,178 @@
/* If you define this you can enable or disable specific debugging- */
/* messages at run-time by supplying the "-debugmsg" option to Wine */
#define DEBUG_RUNTIME /* */
/* Define this if you want to enable all debugging-messages, except */
/* the ones explicitly disabled in a specific *.c-file. */
/* #define DEBUG_ALL */
/* Define this if you want to enable all debugging-messages, even */
/* the ones explicitly disabled in specific *.c-files. */
/* #define DEBUG_ALL_EXT */
/* Define this if you want to disable all debugging-messages, except */
/* the ones explicitly enabled in a specifiy *.c-file. */
/* #define DEBUG_NONE */
/* Define this if you want to disable all debugging-messages, even */
/* the ones explicitly enabled in specific *.c-files. */
/* #define DEBUG_NONE_EXT */
/* You can enable or disable specific debugging-messages here. */
/* However, this can be overridden in the individual *.c-files */
/* between #include <stddebug.h> and #include <debug.h> */
/* #define DEBUG_EDIT */
/* #define DEBUG_MENU */
/* #define DEBUG_MENUCALC */
/* #define DEBUG_SCROLL */
/* #define DEBUG_COMBO */
/* #define DEBUG_LISTBOX */
/* #define DEBUG_TASK */
/* #define DEBUG_SELECTORS */
/* #define DEBUG_RESOURCE */
/* #define DEBUG_ACCEL */
/* #define DEBUG_FIXUP */
/* #define DEBUG_MODULE */
/* #define DEBUG_LDT */
/* #define DEBUG_HEAP */
/* #define DEBUG_MCIWAVE */
/* #define DEBUG_MCIWAVE */
/* #define DEBUG_INT */
/* #define DEBUG_METAFILE */
/* #define DEBUG_GDI */
/* #define DEBUG_BITMAP */
/* #define DEBUG_FONT */
/* #define DEBUG_PALETTE */
/* #define DEBUG_ICON */
/* #define DEBUG_REGION */
/* #define DEBUG_TEXT */
/* #define DEBUG_CLIPPING */
/* #define DEBUG_CARET */
/* #define DEBUG_CLASS */
/* #define DEBUG_DC */
/* #define DEBUG_DIALOG */
/* #define DEBUG_MESSAGE */
/* #define DEBUG_EVENT */
/* #define DEBUG_KEY */
/* #define DEBUG_GRAPHICS */
/* #define DEBUG_MDI */
/* #define DEBUG_MSG */
/* #define DEBUG_NONCLIENT */
/* #define DEBUG_SYSCOLOR */
/* #define DEBUG_TIMER */
/* #define DEBUG_UTILITY */
/* #define DEBUG_WIN */
/* #define DEBUG_ENUM */
/* #define DEBUG_DLL */
# /* Do not remove this line or change anything below this line */
#ifdef DEBUG_NONE
#undef DEBUG_ACCEL
#undef DEBUG_BITMAP
#undef DEBUG_CARET
#undef DEBUG_CDAUDIO
#undef DEBUG_CLASS
#undef DEBUG_CLIPBOARD
#undef DEBUG_CLIPPING
#undef DEBUG_COMBO
#undef DEBUG_COMM
#undef DEBUG_CURSOR
#undef DEBUG_DC
#undef DEBUG_DIALOG
#undef DEBUG_DLL
#undef DEBUG_DOSFS
#undef DEBUG_DRIVER
#undef DEBUG_EDIT
#undef DEBUG_ENUM
#undef DEBUG_EVENT
#undef DEBUG_EXEC
#undef DEBUG_FILE
#undef DEBUG_FIXUP
#undef DEBUG_FONT
#undef DEBUG_GDI
#undef DEBUG_GRAPHICS
#undef DEBUG_HEAP
#undef DEBUG_ICON
#undef DEBUG_INT
#undef DEBUG_KEY
#undef DEBUG_KEYBOARD
#undef DEBUG_LDT
#undef DEBUG_LISTBOX
#undef DEBUG_MCIWAVE
#undef DEBUG_MDI
#undef DEBUG_MENU
#undef DEBUG_MENUCALC
#undef DEBUG_MESSAGE
#undef DEBUG_METAFILE
#undef DEBUG_MODULE
#undef DEBUG_MSG
#undef DEBUG_NONCLIENT
#undef DEBUG_PALETTE
#undef DEBUG_REGION
#undef DEBUG_RESOURCE
#undef DEBUG_SCROLL
#undef DEBUG_SYSCOLOR
#undef DEBUG_TEXT
#undef DEBUG_TIMER
#undef DEBUG_UTILITY
#undef DEBUG_WIN
#endif
#ifdef DEBUG_ALL
#define DEBUG_ACCEL
#define DEBUG_BITMAP
#define DEBUG_CARET
#define DEBUG_CDAUDIO
#define DEBUG_CLASS
#define DEBUG_CLIPBOARD
#define DEBUG_CLIPPING
#define DEBUG_COMBO
#define DEBUG_COMM
#define DEBUG_CURSOR
#define DEBUG_DC
#define DEBUG_DIALOG
#define DEBUG_DLL
#define DEBUG_DOSFS
#define DEBUG_DRIVER
#define DEBUG_EDIT
#define DEBUG_ENUM
#define DEBUG_EVENT
#define DEBUG_EXEC
#define DEBUG_FILE
#define DEBUG_FIXUP
#define DEBUG_FONT
#define DEBUG_GDI
#define DEBUG_GRAPHICS
#define DEBUG_HEAP
#define DEBUG_ICON
#define DEBUG_INT
#define DEBUG_KEY
#define DEBUG_KEYBOARD
#define DEBUG_LDT
#define DEBUG_LISTBOX
#define DEBUG_MCIWAVE
#define DEBUG_MDI
#define DEBUG_MENU
#define DEBUG_MENUCALC
#define DEBUG_MESSAGE
#define DEBUG_METAFILE
#define DEBUG_MODULE
#define DEBUG_MSG
#define DEBUG_NONCLIENT
#define DEBUG_PALETTE
#define DEBUG_REGION
#define DEBUG_RESOURCE
#define DEBUG_SCROLL
#define DEBUG_SYSCOLOR
#define DEBUG_TEXT
#define DEBUG_TIMER
#define DEBUG_UTILITY
#define DEBUG_WIN
#endif

View file

@ -9,7 +9,7 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include "windows.h" #include "class.h"
#define WND_MAGIC 0x444e4957 /* 'WIND' */ #define WND_MAGIC 0x444e4957 /* 'WIND' */
@ -38,7 +38,7 @@ typedef struct tagWND
HRGN hrgnUpdate; /* Update region */ HRGN hrgnUpdate; /* Update region */
HWND hwndPrevActive; /* Previous active top-level window */ HWND hwndPrevActive; /* Previous active top-level window */
HWND hwndLastActive; /* Last active popup hwnd */ HWND hwndLastActive; /* Last active popup hwnd */
FARPROC lpfnWndProc; /* Window procedure */ WNDPROC lpfnWndProc; /* Window procedure */
DWORD dwStyle; /* Window style (from CreateWindow) */ DWORD dwStyle; /* Window style (from CreateWindow) */
DWORD dwExStyle; /* Extended style (from CreateWindowEx) */ DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */ HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
@ -48,10 +48,7 @@ typedef struct tagWND
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */ WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
HANDLE hText; /* Handle of window text */ HANDLE hText; /* Handle of window text */
WORD flags; /* Misc. flags (see below) */ WORD flags; /* Misc. flags (see below) */
Window window; /* X window */ Window window; /* X window (only for top-level windows) */
HICON hIcon; /* icon's MS-windows handle */
WORD iconWidth; /* width of icon */
WORD iconHeight; /* height of icon */
RECT rectClientSave; /* where client rect is saved when icon*/ RECT rectClientSave; /* where client rect is saved when icon*/
HMENU hSysMenu; /* window's copy of System Menu */ HMENU hSysMenu; /* window's copy of System Menu */
HANDLE hProp; /* Handle of Properties List */ HANDLE hProp; /* Handle of Properties List */
@ -63,14 +60,16 @@ typedef struct tagWND
#define WIN_ERASE_UPDATERGN 0x01 /* Update region needs erasing */ #define WIN_ERASE_UPDATERGN 0x01 /* Update region needs erasing */
#define WIN_NEEDS_BEGINPAINT 0x02 /* WM_PAINT sent to window */ #define WIN_NEEDS_BEGINPAINT 0x02 /* WM_PAINT sent to window */
#define WIN_GOT_SIZEMSG 0x04 /* WM_SIZE has been sent to the window */ #define WIN_GOT_SIZEMSG 0x04 /* WM_SIZE has been sent to the window */
#define WIN_OWN_DC 0x08 /* Win class has style CS_OWNDC */ #define WIN_RESTORE_MAX 0x08 /* Maximize when restoring */
#define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */ #define WIN_INTERNAL_PAINT 0x10 /* Internal WM_PAINT message pending */
#define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */ #define WIN_NO_REDRAW 0x20 /* WM_SETREDRAW called for this window */
#define WIN_RESTORE_MAX 0x40 /* Maximize when restoring */
#define WIN_INTERNAL_PAINT 0x80 /* Internal WM_PAINT message pending */ #define WIN_CLASS_INFO(wndPtr) (CLASS_FindClassPtr((wndPtr)->hClass)->wc)
#define WIN_CLASS_STYLE(wndPtr) (WIN_CLASS_INFO(wndPtr).style)
/* Window functions */ /* Window functions */
WND *WIN_FindWndPtr( HWND hwnd ); WND *WIN_FindWndPtr( HWND hwnd );
Window WIN_GetXWindow( HWND hwnd );
BOOL WIN_UnlinkWindow( HWND hwnd ); BOOL WIN_UnlinkWindow( HWND hwnd );
BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter ); BOOL WIN_LinkWindow( HWND hwnd, HWND hwndInsertAfter );
HWND WIN_FindWinToRepaint( HWND hwnd ); HWND WIN_FindWinToRepaint( HWND hwnd );

View file

@ -50,6 +50,7 @@ DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH); DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(LOCALHANDLE); DECLARE_HANDLE(LOCALHANDLE);
DECLARE_HANDLE(HMETAFILE); DECLARE_HANDLE(HMETAFILE);
DECLARE_HANDLE(HDWP);
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
@ -81,41 +82,6 @@ DECLARE_HANDLE(HMETAFILE);
#define min(a,b) (((a) < (b)) ? (a) : (b)) #define min(a,b) (((a) < (b)) ? (a) : (b))
#endif #endif
/*
typedef long LONG;
typedef WORD HANDLE;
typedef HANDLE HWND;
typedef HANDLE HDC;
typedef HANDLE HCLASS;
typedef HANDLE HCURSOR;
typedef HANDLE HFONT;
typedef HANDLE HPEN;
typedef HANDLE HRGN;
typedef HANDLE HPALETTE;
typedef HANDLE HICON;
typedef HANDLE HINSTANCE;
typedef HANDLE HMENU;
typedef HANDLE HBITMAP;
typedef HANDLE HBRUSH;
typedef HANDLE LOCALHANDLE;
typedef char *LPSTR;
typedef char *NPSTR;
typedef short *LPINT;
typedef void *LPVOID;
typedef long (*FARPROC)();
typedef int CATCHBUF[9];
typedef int *LPCATCHBUF;
#define TRUE 1
#define FALSE 0
#define CW_USEDEFAULT ((short)0x8000)
#define FAR
#define NEAR
#define PASCAL
#ifndef NULL
#define NULL (void *)0
#endif
*/
typedef struct { INT x, y; } POINT; typedef struct { INT x, y; } POINT;
typedef POINT *PPOINT; typedef POINT *PPOINT;
@ -158,19 +124,11 @@ typedef PAINTSTRUCT *LPPAINTSTRUCT;
/* Window classes */ /* Window classes */
#ifdef WINELIB
typedef LONG (*WNDPROC)(HWND, UINT, WPARAM, LPARAM); typedef LONG (*WNDPROC)(HWND, UINT, WPARAM, LPARAM);
#else
typedef LONG (* WNDPROC)();
#endif
typedef struct { typedef struct {
WORD style; WORD style;
#ifdef WINELIB WNDPROC lpfnWndProc WINE_PACKED;
WNDPROC lpfnWndProc;
#else
LONG (*lpfnWndProc)() WINE_PACKED;
#endif
INT cbClsExtra, cbWndExtra; INT cbClsExtra, cbWndExtra;
HANDLE hInstance; HANDLE hInstance;
HICON hIcon; HICON hIcon;
@ -772,9 +730,9 @@ typedef struct tagTEXTMETRIC
BYTE tmBreakChar; BYTE tmBreakChar;
BYTE tmPitchAndFamily; BYTE tmPitchAndFamily;
BYTE tmCharSet; BYTE tmCharSet;
INT tmOverhang; INT tmOverhang WINE_PACKED;
INT tmDigitizedAspectX; INT tmDigitizedAspectX WINE_PACKED;
INT tmDigitizedAspectY; INT tmDigitizedAspectY WINE_PACKED;
} TEXTMETRIC, *PTEXTMETRIC, *NPTEXTMETRIC, *LPTEXTMETRIC; } TEXTMETRIC, *PTEXTMETRIC, *NPTEXTMETRIC, *LPTEXTMETRIC;
/* tmPitchAndFamily values */ /* tmPitchAndFamily values */
@ -793,6 +751,10 @@ typedef struct tagTEXTMETRIC
#define TA_BOTTOM 0x08 #define TA_BOTTOM 0x08
#define TA_BASELINE 0x18 #define TA_BASELINE 0x18
/* ExtTextOut() parameters */
#define ETO_GRAYED 0x01
#define ETO_OPAQUE 0x02
#define ETO_CLIPPED 0x04
typedef struct tagPALETTEENTRY typedef struct tagPALETTEENTRY
{ {
@ -872,6 +834,10 @@ typedef struct tagLOGPEN
#define ABSOLUTE 1 #define ABSOLUTE 1
#define RELATIVE 2 #define RELATIVE 2
/* Flood fill modes */
#define FLOODFILLBORDER 0
#define FLOODFILLSURFACE 1
/* Device parameters for GetDeviceCaps() */ /* Device parameters for GetDeviceCaps() */
#define DRIVERVERSION 0 #define DRIVERVERSION 0
#define TECHNOLOGY 2 #define TECHNOLOGY 2
@ -1567,14 +1533,7 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define SW_PARENTOPENING 3 #define SW_PARENTOPENING 3
#define SW_OTHERRESTORED 4 #define SW_OTHERRESTORED 4
/* /* ShowWindow() codes */
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED,
SW_SHOWMAXIMIZED, SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW,
SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE,
SW_INTERNAL_HIDE, SW_INTERNAL_RESTORE };
*/
#define SW_HIDE 0 #define SW_HIDE 0
#define SW_SHOWNORMAL 1 #define SW_SHOWNORMAL 1
#define SW_NORMAL 1 #define SW_NORMAL 1
@ -1732,7 +1691,6 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED,
#define WS_GROUP 0x00020000L #define WS_GROUP 0x00020000L
#define WS_TABSTOP 0x00010000L #define WS_TABSTOP 0x00010000L
#define WS_MINIMIZEBOX 0x00020000L #define WS_MINIMIZEBOX 0x00020000L
#define WS_MINIMIZEBOX 0x00020000L
#define WS_MAXIMIZEBOX 0x00010000L #define WS_MAXIMIZEBOX 0x00010000L
#define WS_TILED WS_OVERLAPPED #define WS_TILED WS_OVERLAPPED
#define WS_ICONIC WS_MINIMIZE #define WS_ICONIC WS_MINIMIZE
@ -2069,8 +2027,8 @@ typedef struct tagDRAWITEMSTRUCT
UINT itemState; UINT itemState;
HWND hwndItem; HWND hwndItem;
HDC hDC; HDC hDC;
RECT rcItem; RECT rcItem WINE_PACKED;
DWORD itemData; DWORD itemData WINE_PACKED;
} DRAWITEMSTRUCT; } DRAWITEMSTRUCT;
typedef DRAWITEMSTRUCT NEAR* PDRAWITEMSTRUCT; typedef DRAWITEMSTRUCT NEAR* PDRAWITEMSTRUCT;
typedef DRAWITEMSTRUCT FAR* LPDRAWITEMSTRUCT; typedef DRAWITEMSTRUCT FAR* LPDRAWITEMSTRUCT;
@ -2084,7 +2042,7 @@ typedef struct tagMEASUREITEMSTRUCT
UINT itemID; UINT itemID;
UINT itemWidth; UINT itemWidth;
UINT itemHeight; UINT itemHeight;
DWORD itemData; DWORD itemData WINE_PACKED;
} MEASUREITEMSTRUCT; } MEASUREITEMSTRUCT;
typedef MEASUREITEMSTRUCT NEAR* PMEASUREITEMSTRUCT; typedef MEASUREITEMSTRUCT NEAR* PMEASUREITEMSTRUCT;
typedef MEASUREITEMSTRUCT FAR* LPMEASUREITEMSTRUCT; typedef MEASUREITEMSTRUCT FAR* LPMEASUREITEMSTRUCT;
@ -2112,7 +2070,7 @@ typedef struct tagCOMPAREITEMSTRUCT
UINT itemID1; UINT itemID1;
DWORD itemData1; DWORD itemData1;
UINT itemID2; UINT itemID2;
DWORD itemData2; DWORD itemData2 WINE_PACKED;
} COMPAREITEMSTRUCT; } COMPAREITEMSTRUCT;
typedef COMPAREITEMSTRUCT NEAR* PCOMPAREITEMSTRUCT; typedef COMPAREITEMSTRUCT NEAR* PCOMPAREITEMSTRUCT;
typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT; typedef COMPAREITEMSTRUCT FAR* LPCOMPAREITEMSTRUCT;
@ -2269,9 +2227,9 @@ typedef struct tagMETAHEADER
WORD mtType; WORD mtType;
WORD mtHeaderSize; WORD mtHeaderSize;
WORD mtVersion; WORD mtVersion;
DWORD mtSize __attribute__ ((packed)); DWORD mtSize WINE_PACKED;
WORD mtNoObjects; WORD mtNoObjects;
DWORD mtMaxRecord __attribute__ ((packed)); DWORD mtMaxRecord WINE_PACKED;
WORD mtNoParameters; WORD mtNoParameters;
} METAHEADER; } METAHEADER;
@ -2296,9 +2254,9 @@ typedef HANDLETABLE *LPHANDLETABLE;
/* Clipboard metafile picture structure */ /* Clipboard metafile picture structure */
typedef struct tagMETAFILEPICT typedef struct tagMETAFILEPICT
{ {
int mm; INT mm;
int xExt; INT xExt;
int yExt; INT yExt;
HMETAFILE hMF; HMETAFILE hMF;
} METAFILEPICT; } METAFILEPICT;
typedef METAFILEPICT *LPMETAFILEPICT; typedef METAFILEPICT *LPMETAFILEPICT;
@ -2488,6 +2446,7 @@ Fa(BOOL,DestroyIcon,HICON,a)
Fa(BOOL,DestroyMenu,HMENU,a) Fa(BOOL,DestroyMenu,HMENU,a)
Fa(BOOL,DestroyWindow,HWND,a) Fa(BOOL,DestroyWindow,HWND,a)
Fa(BOOL,EnableHardwareInput,BOOL,a) Fa(BOOL,EnableHardwareInput,BOOL,a)
Fa(BOOL,EndDeferWindowPos,HDWP,hWinPosInfo)
Fa(BOOL,FreeModule,HANDLE,a) Fa(BOOL,FreeModule,HANDLE,a)
Fa(BOOL,FreeResource,HANDLE,a) Fa(BOOL,FreeResource,HANDLE,a)
#ifndef GLOBAL_SOURCE #ifndef GLOBAL_SOURCE
@ -2534,7 +2493,7 @@ Fa(DWORD,GlobalSize,HANDLE,a)
#endif #endif
Fa(DWORD,OemKeyScan,WORD,a) Fa(DWORD,OemKeyScan,WORD,a)
Fa(FARPROC,LocalNotify,FARPROC,a) Fa(FARPROC,LocalNotify,FARPROC,a)
Fa(HANDLE,BeginDeferWindowPos,int,nNumWindows) Fa(HDWP,BeginDeferWindowPos,INT,nNumWindows)
Fa(HMETAFILE,CloseMetaFile,HANDLE,a) Fa(HMETAFILE,CloseMetaFile,HANDLE,a)
Fa(HANDLE,CreateMetaFile,LPSTR,a) Fa(HANDLE,CreateMetaFile,LPSTR,a)
Fa(HANDLE,GetAtomHandle,ATOM,a) Fa(HANDLE,GetAtomHandle,ATOM,a)
@ -2653,7 +2612,6 @@ Fa(short,GetTextCharacterExtra,HDC,a)
Fa(void,ClipCursor,LPRECT,a) Fa(void,ClipCursor,LPRECT,a)
Fa(void,CloseWindow,HWND,a) Fa(void,CloseWindow,HWND,a)
Fa(void,DrawMenuBar,HWND,a) Fa(void,DrawMenuBar,HWND,a)
Fa(void,EndDeferWindowPos,HANDLE,hWinPosInfo)
Fa(void,FatalExit,int,a) Fa(void,FatalExit,int,a)
Fa(void,FreeLibrary,HANDLE,a) Fa(void,FreeLibrary,HANDLE,a)
Fa(void,FreeProcInstance,FARPROC,a) Fa(void,FreeProcInstance,FARPROC,a)
@ -2876,6 +2834,7 @@ Fc(HPEN,CreatePen,short,a,short,b,COLORREF,c)
Fc(HRGN,CreatePolygonRgn,LPPOINT,a,short,b,short,c) Fc(HRGN,CreatePolygonRgn,LPPOINT,a,short,b,short,c)
Fc(HWND,GetNextDlgGroupItem,HWND,a,HWND,b,BOOL,c) Fc(HWND,GetNextDlgGroupItem,HWND,a,HWND,b,BOOL,c)
Fc(HWND,GetNextDlgTabItem,HWND,a,HWND,b,BOOL,c) Fc(HWND,GetNextDlgTabItem,HWND,a,HWND,b,BOOL,c)
Fc(INT,GetTextFace,HDC,a,INT,b,LPSTR,c)
Fc(LONG,GetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c) Fc(LONG,GetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c)
Fc(LONG,SetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c) Fc(LONG,SetBitmapBits,HBITMAP,a,LONG,b,LPSTR,c)
Fc(LONG,SetClassLong,HWND,a,short,b,LONG,c) Fc(LONG,SetClassLong,HWND,a,short,b,LONG,c)
@ -2894,7 +2853,6 @@ Fc(int,GetInstanceData,HANDLE,a,NPSTR,b,int,c)
Fc(int,GetKeyNameText,LONG,a,LPSTR,b,int,c) Fc(int,GetKeyNameText,LONG,a,LPSTR,b,int,c)
Fc(int,GetModuleFileName,HANDLE,a,LPSTR,b,short,c) Fc(int,GetModuleFileName,HANDLE,a,LPSTR,b,short,c)
Fc(int,GetObject,HANDLE,a,int,b,LPSTR,c) Fc(int,GetObject,HANDLE,a,int,b,LPSTR,c)
Fc(int,GetTextFace,HDC,a,int,b,LPSTR,c)
Fc(int,GetUpdateRgn,HWND,a,HRGN,b,BOOL,c) Fc(int,GetUpdateRgn,HWND,a,HRGN,b,BOOL,c)
Fc(int,GetWindowText,HWND,a,LPSTR,b,int,c) Fc(int,GetWindowText,HWND,a,LPSTR,b,int,c)
Fc(int,MulDiv,int,a,int,b,int,c) Fc(int,MulDiv,int,a,int,b,int,c)
@ -2929,7 +2887,7 @@ Fd(BOOL,GetMessage,LPMSG,msg,HWND,b,WORD,c,WORD,d)
Fd(BOOL,GetTextExtentPoint,HDC,a,LPSTR,b,short,c,LPSIZE,d) Fd(BOOL,GetTextExtentPoint,HDC,a,LPSTR,b,short,c,LPSIZE,d)
Fd(BOOL,DrawIcon,HDC,a,short,b,short,c,HICON,d) Fd(BOOL,DrawIcon,HDC,a,short,b,short,c,HICON,d)
Fd(BOOL,EnumMetaFile,HDC,a,LOCALHANDLE,b,FARPROC,c,BYTE FAR*,d) Fd(BOOL,EnumMetaFile,HDC,a,LOCALHANDLE,b,FARPROC,c,BYTE FAR*,d)
Fd(BOOL,FloodFill,HDC,a,short,b,short,c,DWORD,d) Fd(BOOL,FloodFill,HDC,a,INT,b,INT,c,COLORREF,d)
Fd(BOOL,GetCharWidth,HDC,a,WORD,b,WORD,c,LPINT,d) Fd(BOOL,GetCharWidth,HDC,a,WORD,b,WORD,c,LPINT,d)
Fd(BOOL,HiliteMenuItem,HWND,a,HMENU,b,WORD,c,WORD,d) Fd(BOOL,HiliteMenuItem,HWND,a,HMENU,b,WORD,c,WORD,d)
Fd(BOOL,MoveToEx,HDC,a,short,b,short,c,LPPOINT,d) Fd(BOOL,MoveToEx,HDC,a,short,b,short,c,LPPOINT,d)
@ -2948,8 +2906,8 @@ Fd(HHOOK,SetWindowsHookEx,short,a,HOOKPROC,b,HINSTANCE,c,HTASK,d)
Fd(HRGN,CreateEllipticRgn,short,a,short,b,short,c,short,d) Fd(HRGN,CreateEllipticRgn,short,a,short,b,short,c,short,d)
Fd(HRGN,CreatePolyPolygonRgn,LPPOINT,a,LPINT,b,short,c,short,d) Fd(HRGN,CreatePolyPolygonRgn,LPPOINT,a,LPINT,b,short,c,short,d)
Fd(HRGN,CreateRectRgn,short,a,short,b,short,c,short,d) Fd(HRGN,CreateRectRgn,short,a,short,b,short,c,short,d)
Fd(HWND,CreateDialog,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d) Fd(HWND,CreateDialog,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d)
Fd(HWND,CreateDialogIndirect,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d) Fd(HWND,CreateDialogIndirect,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d)
Fd(LONG,DefDlgProc,HWND,a,WORD,b,WORD,c,LONG,d) Fd(LONG,DefDlgProc,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(LONG,DefMDIChildProc,HWND,a,WORD,b,WORD,c,LONG,d) Fd(LONG,DefMDIChildProc,HWND,a,WORD,b,WORD,c,LONG,d)
Fd(LONG,DefWindowProc,HWND,a,WORD,b,WORD,c,LONG,d) Fd(LONG,DefWindowProc,HWND,a,WORD,b,WORD,c,LONG,d)
@ -2966,8 +2924,8 @@ Fd(BOOL,SetWindowOrgEx,HDC,a,short,b,short,c,LPPOINT,d)
Fd(BOOL,OffsetViewportOrgEx,HDC,a,short,b,short,c,LPPOINT,d) Fd(BOOL,OffsetViewportOrgEx,HDC,a,short,b,short,c,LPPOINT,d)
Fd(BOOL,OffsetWindowOrgEx,HDC,a,short,b,short,c,LPPOINT,d) Fd(BOOL,OffsetWindowOrgEx,HDC,a,short,b,short,c,LPPOINT,d)
Fd(int,CombineRgn,HRGN,a,HRGN,b,HRGN,c,short,d) Fd(int,CombineRgn,HRGN,a,HRGN,b,HRGN,c,short,d)
Fd(int,DialogBox,HINSTANCE,a,LPCSTR,b,HWND,c,FARPROC,d) Fd(int,DialogBox,HINSTANCE,a,LPCSTR,b,HWND,c,WNDPROC,d)
Fd(int,DialogBoxIndirect,HANDLE,a,HANDLE,b,HWND,c,FARPROC,d) Fd(int,DialogBoxIndirect,HANDLE,a,HANDLE,b,HWND,c,WNDPROC,d)
Fd(int,EnumFonts,HDC,a,LPSTR,b,FARPROC,c,LPSTR,d) Fd(int,EnumFonts,HDC,a,LPSTR,b,FARPROC,c,LPSTR,d)
Fd(int,EnumObjects,HDC,a,int,b,FARPROC,c,LPSTR,d) Fd(int,EnumObjects,HDC,a,int,b,FARPROC,c,LPSTR,d)
Fd(int,GetDlgItemText,HWND,a,WORD,b,LPSTR,c,WORD,d) Fd(int,GetDlgItemText,HWND,a,WORD,b,LPSTR,c,WORD,d)
@ -2989,10 +2947,10 @@ Fd(void,SetDlgItemInt,HWND,a,WORD,b,WORD,c,BOOL,d)
Fe(BOOL,Rectangle,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom) Fe(BOOL,Rectangle,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom)
Fe(int,DrawText,HDC,a,LPSTR,str,int,c,LPRECT,d,WORD,flag) Fe(int,DrawText,HDC,a,LPSTR,str,int,c,LPRECT,d,WORD,flag)
Fe(BOOL,PeekMessage,LPMSG,a,HWND,b,WORD,c,WORD,d,WORD,e) Fe(BOOL,PeekMessage,LPMSG,a,HWND,b,WORD,c,WORD,d,WORD,e)
Fe(LONG,CallWindowProc,FARPROC,a,HWND,b,WORD,c,WORD,d,LONG,e) Fe(LONG,CallWindowProc,WNDPROC,a,HWND,b,WORD,c,WORD,d,LONG,e)
Fe(BOOL,ChangeMenu,HMENU,a,WORD,b,LPSTR,c,WORD,d,WORD,e) Fe(BOOL,ChangeMenu,HMENU,a,WORD,b,LPSTR,c,WORD,d,WORD,e)
Fe(BOOL,Ellipse,HDC,a,int,b,int,c,int,d,int,e) Fe(BOOL,Ellipse,HDC,a,int,b,int,c,int,d,int,e)
Fe(BOOL,ExtFloodFill,HDC,a,int,b,int,c,DWORD,d,WORD,e) Fe(BOOL,ExtFloodFill,HDC,a,INT,b,INT,c,COLORREF,d,WORD,e)
Fe(BOOL,FrameRgn,HDC,a,HRGN,b,HBRUSH,e,int,c,int,d) Fe(BOOL,FrameRgn,HDC,a,HRGN,b,HBRUSH,e,int,c,int,d)
Fe(BOOL,InsertMenu,HMENU,a,WORD,b,WORD,c,WORD,d,LPSTR,e) Fe(BOOL,InsertMenu,HMENU,a,WORD,b,WORD,c,WORD,d,LPSTR,e)
Fe(BOOL,ModifyMenu,HMENU,a,WORD,b,WORD,c,WORD,d,LPSTR,e) Fe(BOOL,ModifyMenu,HMENU,a,WORD,b,WORD,c,WORD,d,LPSTR,e)
@ -3002,12 +2960,12 @@ Fe(DWORD,GetTabbedTextExtent,HDC,a,LPSTR,b,int,c,int,d,LPINT,e)
Fe(DWORD,ScaleViewportExt,HDC,a,short,b,short,c,short,d,short,e) Fe(DWORD,ScaleViewportExt,HDC,a,short,b,short,c,short,d,short,e)
Fe(DWORD,ScaleWindowExt,HDC,a,short,b,short,c,short,d,short,e) Fe(DWORD,ScaleWindowExt,HDC,a,short,b,short,c,short,d,short,e)
Fe(HBITMAP,CreateBitmap,short,a,short,b,BYTE,c,BYTE,d,LPSTR,e) Fe(HBITMAP,CreateBitmap,short,a,short,b,BYTE,c,BYTE,d,LPSTR,e)
Fe(HWND,CreateDialogIndirectParam,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d,LPARAM,e) Fe(HWND,CreateDialogIndirectParam,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d,LPARAM,e)
Fe(HWND,CreateDialogParam,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d,LPARAM,e) Fe(HWND,CreateDialogParam,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d,LPARAM,e)
Fe(LONG,DefFrameProc,HWND,a,HWND,b,WORD,c,WORD,d,LONG,e) Fe(LONG,DefFrameProc,HWND,a,HWND,b,WORD,c,WORD,d,LONG,e)
Fe(LONG,SendDlgItemMessage,HWND,a,WORD,b,WORD,c,WORD,d,LONG,e) Fe(LONG,SendDlgItemMessage,HWND,a,WORD,b,WORD,c,WORD,d,LONG,e)
Fe(int,DialogBoxIndirectParam,HANDLE,a,HANDLE,b,HWND,c,FARPROC,d,LONG,e) Fe(int,DialogBoxIndirectParam,HANDLE,a,HANDLE,b,HWND,c,WNDPROC,d,LONG,e)
Fe(int,DialogBoxParam,HANDLE,a,LPCSTR,b,HWND,c,FARPROC,d,LONG,e) Fe(int,DialogBoxParam,HANDLE,a,LPCSTR,b,HWND,c,WNDPROC,d,LONG,e)
Fe(int,DlgDirList,HWND,a,LPSTR,b,int,c,int,d,WORD,e) Fe(int,DlgDirList,HWND,a,LPSTR,b,int,c,int,d,WORD,e)
Fe(int,DlgDirListComboBox,HWND,a,LPSTR,b,int,c,int,d,WORD,e) Fe(int,DlgDirListComboBox,HWND,a,LPSTR,b,int,c,int,d,WORD,e)
Fe(int,Escape,HDC,a,int,b,int,c,LPSTR,d,LPSTR,e) Fe(int,Escape,HDC,a,int,b,int,c,LPSTR,d,LPSTR,e)
@ -3041,7 +2999,7 @@ Fg(int,GetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f)
Fg(int,SetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f) Fg(int,SetDIBits,HDC,a,HANDLE,a2,WORD,b,WORD,c,LPSTR,d,LPBITMAPINFO,e,WORD,f)
Fg(BOOL,SetWindowPos,HWND,a,HWND,b,short,c,short,d,short,e,short,f,WORD,g) Fg(BOOL,SetWindowPos,HWND,a,HWND,b,short,c,short,d,short,e,short,f,WORD,g)
Fh(BOOL,ExtTextOut,HDC,a,short,b,short,c,WORD,d,LPRECT,e,LPSTR,f,WORD,g,LPINT,h) Fh(BOOL,ExtTextOut,HDC,a,short,b,short,c,WORD,d,LPRECT,e,LPSTR,f,WORD,g,LPINT,h)
Fh(HANDLE,DeferWindowPos,HANDLE,hWinPosInfo,HWND,hWnd,HWND,hWndInsertAfter,int,x,int,y,int,cx,int,cy,WORD,wFlags) Fh(HDWP,DeferWindowPos,HDWP,hWinPosInfo,HWND,hWnd,HWND,hWndInsertAfter,INT,x,INT,y,INT,cx,INT,cy,WORD,wFlags)
Fh(LONG,TabbedTextOut,HDC,a,short,b,short,c,LPSTR,d,short,e,short,f,LPINT,g,short,h) Fh(LONG,TabbedTextOut,HDC,a,short,b,short,c,LPSTR,d,short,e,short,f,LPINT,g,short,h)
Fh(int,ScrollWindowEx,HWND,a,short,b,short,c,LPRECT,d,LPRECT,e,HRGN,f,LPRECT,g,WORD,h) Fh(int,ScrollWindowEx,HWND,a,short,b,short,c,LPRECT,d,LPRECT,e,HRGN,f,LPRECT,g,WORD,h)
Fi(BOOL,Arc,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd) Fi(BOOL,Arc,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom,int,xStart,int,yStart,int,xEnd,int,yEnd)

21
include/winpos.h Normal file
View file

@ -0,0 +1,21 @@
/*
* *DeferWindowPos() structure and definitions
*
* Copyright 1994 Alexandre Julliard
*/
#ifndef WINPOS_H
#define WINPOS_H
#define DWP_MAGIC 0x5057 /* 'WP' */
typedef struct
{
WORD actualCount;
WORD suggestedCount;
WORD valid;
WORD wMagic;
WINDOWPOS winPos[1];
} DWP;
#endif /* WINPOS_H */

View file

@ -8,6 +8,9 @@ SRCS = \
ldtlib.c \ ldtlib.c \
main.c \ main.c \
ne_image.c \ ne_image.c \
ne_resource.c \
pe_image.c \
pe_resource.c \
selector.c \ selector.c \
signal.c \ signal.c \
library.c \ library.c \
@ -18,7 +21,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

View file

@ -6,6 +6,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include "autoconf.h" #include "autoconf.h"
#include "stddebug.h"
/* #define DEBUG_LDT /* */
/* #undef DEBUG_LDT /* */
#include "debug.h"
#ifdef linux #ifdef linux
#include <linux/unistd.h> #include <linux/unistd.h>
@ -76,12 +80,11 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
struct segment_descriptor *sd; struct segment_descriptor *sd;
int ret; int ret;
#ifdef DEBUG_LDT dprintf_ldt(stddeb,
printf("set_ldt_entry: entry=%x base=%x limit=%x%s %s-bit contents=%d %s\n", "set_ldt_entry: entry=%x base=%x limit=%x%s %s-bit contents=%d %s\n",
entry, base, limit, limit_in_pages_flag?"-pages":"", entry, base, limit, limit_in_pages_flag?"-pages":"",
seg_32bit_flag?"32":"16", seg_32bit_flag?"32":"16",
contents, read_only_flag?"read-only":""); contents, read_only_flag?"read-only":"");
#endif
sd = make_sd(base, limit, contents, read_only_flag, seg_32bit_flag, limit_in_pages_flag); sd = make_sd(base, limit, contents, read_only_flag, seg_32bit_flag, limit_in_pages_flag);
ret = i386_set_ldt(entry, (union descriptor *)sd, 1); ret = i386_set_ldt(entry, (union descriptor *)sd, 1);

View file

@ -1,11 +1,8 @@
/* /*
* Modules & Libraries functions * Module & Library functions
*/ */
static char Copyright[] = "Copyright Martin Ayotte, 1994"; static char Copyright[] = "Copyright 1993, 1994 Martin Ayotte, Robert J. Amstadt, Erik Bos";
/*
#define DEBUG_MODULE
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -13,18 +10,31 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "neexe.h"
#include "segmem.h"
#include "dlls.h"
#include "wine.h" #include "wine.h"
#include "wineopts.h"
#include "arch.h"
#include "options.h"
#include "prototypes.h" #include "prototypes.h"
#include "windows.h" #include "windows.h"
#include "dlls.h"
#include "task.h" #include "task.h"
#include "toolhelp.h" #include "toolhelp.h"
#include "stddebug.h"
/* #define DEBUG_MODULE /* */
/* #undef DEBUG_MODULE /* */
#include "debug.h"
extern struct w_files *wine_files; extern char WindowsPath[256];
extern struct dll_name_table_entry_s dll_builtin_table[]; extern struct dll_name_table_entry_s dll_builtin_table[];
extern char *GetDosFileName(char *);
struct w_files *GetFileInfo(HANDLE); extern HANDLE hSysRes;
char *GetDosFileName(char *);
struct w_files *wine_files = NULL;
static char *DLL_Extensions[] = { "dll", NULL };
static char *EXE_Extensions[] = { "exe", NULL };
#define IS_BUILTIN_DLL(handle) ((handle >> 8) == 0xff) #define IS_BUILTIN_DLL(handle) ((handle >> 8) == 0xff)
@ -48,6 +58,196 @@ void ExtractDLLName(char *libname, char *temp)
} }
} }
struct w_files *
GetFileInfo(unsigned short instance)
{
register struct w_files *w = wine_files;
while (w && w->hinstance != instance)
w = w->next;
return w;
}
int IsDLLLoaded(char *name)
{
struct w_files *wpnt;
if(FindDLLTable(name))
return 1;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
if(strcmp(wpnt->name, name) == 0)
return 1;
return 0;
}
void InitDLL(struct w_files *wpnt)
{
if (wpnt->ne)
InitNEDLL(wpnt);
else
InitPEDLL(wpnt);
}
void InitializeLoadedDLLs(struct w_files *wpnt)
{
static flagReadyToRun = 0;
struct w_files *final_wpnt;
printf("InitializeLoadedDLLs %08X\n", wpnt);
if (wpnt == NULL)
{
flagReadyToRun = 1;
fprintf(stderr, "Initializing DLLs\n");
}
if (!flagReadyToRun)
return;
#if 1
if (wpnt != NULL)
fprintf(stderr, "Initializing %s\n", wpnt->name);
#endif
/*
* Initialize libraries
*/
if (!wpnt)
{
wpnt = wine_files;
final_wpnt = NULL;
}
else
{
final_wpnt = wpnt->next;
}
for( ; wpnt != final_wpnt; wpnt = wpnt->next)
InitDLL(wpnt);
}
/**********************************************************************
* LoadImage
* Load one executable into memory
*/
HINSTANCE LoadImage(char *module, int filetype, int change_dir)
{
HINSTANCE handle;
struct w_files *wpnt, *wpnt1;
char buffer[256], header[2], modulename[64], *fullname;
ExtractDLLName(module, modulename);
printf("LoadImage [%s]\n", module);
/* built-in one ? */
if (FindDLLTable(modulename)) {
return GetModuleHandle(modulename);
}
/* already loaded ? */
for (wpnt = wine_files ; wpnt ; wpnt = wpnt->next)
if (strcasecmp(wpnt->name, modulename) == 0)
return wpnt->hinstance;
/*
* search file
*/
fullname = FindFile(buffer, sizeof(buffer), module,
(filetype == EXE ? EXE_Extensions : DLL_Extensions),
WindowsPath);
if (fullname == NULL)
{
fprintf(stderr, "LoadImage: I can't find %s.dll | %s.exe !\n",
module, module);
return 2;
}
fullname = GetDosFileName(fullname);
fprintf(stderr,"LoadImage: loading %s (%s)\n [%s]\n",
module, buffer, fullname);
if (change_dir && fullname)
{
char dirname[256];
char *p;
strcpy(dirname, fullname);
p = strrchr(dirname, '\\');
*p = '\0';
DOS_SetDefaultDrive(dirname[0] - 'A');
DOS_ChangeDir(dirname[0] - 'A', dirname + 2);
}
/* First allocate a spot to store the info we collect, and add it to
* our linked list if we could load the file.
*/
wpnt = (struct w_files *) malloc(sizeof(struct w_files));
/*
* Open file for reading.
*/
wpnt->fd = open(buffer, O_RDONLY);
if (wpnt->fd < 0)
return 2;
/*
* Establish header pointers.
*/
wpnt->filename = strdup(buffer);
wpnt->name = strdup(modulename);
/* read mz header */
wpnt->mz_header = (struct mz_header_s *) malloc(sizeof(struct mz_header_s));;
lseek(wpnt->fd, 0, SEEK_SET);
if (read(wpnt->fd, wpnt->mz_header, sizeof(struct mz_header_s)) !=
sizeof(struct mz_header_s))
{
myerror("Unable to read MZ header from file");
}
if (wpnt->mz_header->must_be_0x40 != 0x40)
myerror("This is not a Windows program");
/* read first two bytes to determine filetype */
lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
read(wpnt->fd, &header, sizeof(header));
handle = 0;
if (header[0] == 'N' && header[1] == 'E')
handle = LoadNEImage(wpnt);
if (header[0] == 'P' && header[1] == 'E')
handle = LoadPEImage(wpnt);
wpnt->hinstance = handle;
if (handle > 32) {
/* ok, loaded, add to the end of the list */
if(wine_files == NULL)
wine_files = wpnt;
else {
wpnt1 = wine_files;
while(wpnt1->next)
wpnt1 = wpnt1->next;
wpnt1->next = wpnt;
}
wpnt->next = NULL;
return handle;
} else {
fprintf(stderr, "wine: (%s) unknown fileformat !\n", wpnt->filename);
close(wpnt->fd);
free(wpnt->filename);
free(wpnt->name);
free(wpnt);
return 14;
}
}
/********************************************************************** /**********************************************************************
* GetModuleHandle [KERNEL.47] * GetModuleHandle [KERNEL.47]
*/ */
@ -174,22 +374,27 @@ HANDLE LoadLibrary(LPSTR libname)
return h; return h;
} }
/********************************************************************** /**********************************************************************
* FreeLibrary [KERNEL.96] * FreeLibrary [KERNEL.96]
*/ */
void FreeLibrary(HANDLE hLib) void FreeLibrary(HANDLE hLib)
{ {
struct w_files *wpnt;
printf("FreeLibrary(%04X);\n", hLib); printf("FreeLibrary(%04X);\n", hLib);
/* built-in dll ? */ /* built-in dll ? */
if (IS_BUILTIN_DLL(hLib)) if (IS_BUILTIN_DLL(hLib) || hLib == 0 || hLib == hSysRes)
return; return;
/* /*
while (lpMod != NULL) { while (lpMod != NULL) {
if (lpMod->hInst == hLib) { if (lpMod->hInst == hLib) {
if (lpMod->Count == 1) { if (lpMod->Count == 1) {
wpnt = GetFileInfo(hLib);
if (wpnt->ne)
NEunloadImage(wpnt);
else
PEunloadImage(wpnt);
if (hLib != (HANDLE)NULL) GlobalFree(hLib); if (hLib != (HANDLE)NULL) GlobalFree(hLib);
if (lpMod->ModuleName != NULL) free(lpMod->ModuleName); if (lpMod->ModuleName != NULL) free(lpMod->ModuleName);
if (lpMod->FileName != NULL) free(lpMod->FileName); if (lpMod->FileName != NULL) free(lpMod->FileName);
@ -215,7 +420,7 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
#ifdef WINELIB #ifdef WINELIB
WINELIB_UNIMP ("GetProcAddress"); WINELIB_UNIMP ("GetProcAddress");
#else #else
int i, sel, addr, ret; int sel, addr, ret;
register struct w_files *w = wine_files; register struct w_files *w = wine_files;
int ordinal, len; int ordinal, len;
char * cpnt; char * cpnt;
@ -275,11 +480,11 @@ FARPROC GetProcAddress(HANDLE hModule, char *proc_name)
{ {
AnsiUpper(proc_name); AnsiUpper(proc_name);
printf("GetProcAddress: %04X, '%s'\n", hModule, proc_name); printf("GetProcAddress: %04X, '%s'\n", hModule, proc_name);
cpnt = w->nrname_table; cpnt = w->ne->nrname_table;
while(TRUE) while(TRUE)
{ {
if (((int) cpnt) - ((int)w->nrname_table) > if (((int) cpnt) - ((int)w->ne->nrname_table) >
w->ne_header->nrname_tab_length) return NULL; w->ne->ne_header->nrname_tab_length) return NULL;
len = *cpnt++; len = *cpnt++;
strncpy(C, cpnt, len); strncpy(C, cpnt, len);
C[len] = '\0'; C[len] = '\0';
@ -343,24 +548,24 @@ FillModStructLoaded(MODULEENTRY *lpModule, struct w_files *dll)
} }
/********************************************************************** /**********************************************************************
* ModuleFirst [TOOHELP.59] * ModuleFirst [TOOLHELP.59]
*/ */
BOOL ModuleFirst(MODULEENTRY *lpModule) BOOL ModuleFirst(MODULEENTRY *lpModule)
{ {
printf("ModuleFirst(%08X)\n", lpModule); printf("ModuleFirst(%08X)\n", (int) lpModule);
FillModStructBuiltIn(lpModule, &dll_builtin_table[0]); FillModStructBuiltIn(lpModule, &dll_builtin_table[0]);
return TRUE; return TRUE;
} }
/********************************************************************** /**********************************************************************
* ModuleNext [TOOHELP.60] * ModuleNext [TOOLHELP.60]
*/ */
BOOL ModuleNext(MODULEENTRY *lpModule) BOOL ModuleNext(MODULEENTRY *lpModule)
{ {
struct w_files *w; struct w_files *w;
printf("ModuleNext(%08X)\n", lpModule); printf("ModuleNext(%08X)\n", (int) lpModule);
if (IS_BUILTIN_DLL(lpModule->hModule)) { if (IS_BUILTIN_DLL(lpModule->hModule)) {
/* last built-in ? */ /* last built-in ? */
@ -383,13 +588,13 @@ BOOL ModuleNext(MODULEENTRY *lpModule)
} }
/********************************************************************** /**********************************************************************
* ModuleFindHandle [TOOHELP.62] * ModuleFindHandle [TOOLHELP.62]
*/ */
HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule) HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule)
{ {
struct w_files *w; struct w_files *w;
printf("ModuleFindHandle(%08X, %04X)\n", lpModule, hModule); printf("ModuleFindHandle(%08X, %04X)\n", (int) lpModule, (int)hModule);
/* built-in dll ? */ /* built-in dll ? */
if (IS_BUILTIN_DLL(hModule)) { if (IS_BUILTIN_DLL(hModule)) {
@ -406,7 +611,7 @@ HMODULE ModuleFindHandle(MODULEENTRY *lpModule, HMODULE hModule)
} }
/********************************************************************** /**********************************************************************
* ModuleFindName [TOOHELP.61] * ModuleFindName [TOOLHELP.61]
*/ */
HMODULE ModuleFindName(MODULEENTRY *lpModule, LPCSTR lpstrName) HMODULE ModuleFindName(MODULEENTRY *lpModule, LPCSTR lpstrName)
{ {

View file

@ -9,12 +9,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#ifdef linux
#include <linux/unistd.h>
#include <linux/head.h>
#include <linux/ldt.h>
#include <linux/segment.h>
#endif
#include "neexe.h" #include "neexe.h"
#include "segmem.h" #include "segmem.h"
#include "prototypes.h" #include "prototypes.h"
@ -23,32 +17,22 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "windows.h" #include "windows.h"
#include "wineopts.h" #include "wineopts.h"
#include "arch.h" #include "arch.h"
#include "task.h"
#include "options.h" #include "options.h"
#include "stddebug.h"
/* #define DEBUG_DLL /* */
/* #undef DEBUG_DLL /* */
#include "debug.h"
/* #define DEBUG_FIXUP */
extern HANDLE CreateNewTask(HINSTANCE hInst);
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
extern void CallTo32();
char *GetDosFileName(char *unixfilename); char *GetDosFileName(char *unixfilename);
char *GetModuleName(struct w_files * wpnt, int index, char *buffer);
extern unsigned char ran_out;
extern char WindowsPath[256]; extern char WindowsPath[256];
char *WIN_ProgramName;
unsigned short WIN_StackSize;
unsigned short WIN_HeapSize;
struct w_files * wine_files = NULL;
char **Argv; char **Argv;
int Argc; int Argc;
HINSTANCE hSysRes; HINSTANCE hSysRes;
unsigned short WIN_StackSize;
static char *DLL_Extensions[] = { "dll", NULL }; unsigned short WIN_HeapSize;
static char *EXE_Extensions[] = { "exe", NULL };
/********************************************************************** /**********************************************************************
* myerror * myerror
@ -64,195 +48,19 @@ myerror(const char *s)
exit(1); exit(1);
} }
/**********************************************************************
* GetFilenameFromInstance
*/
char *
GetFilenameFromInstance(unsigned short instance)
{
register struct w_files *w = wine_files;
while (w && w->hinstance != instance)
w = w->next;
if (w)
return w->filename;
else
return NULL;
}
struct w_files *
GetFileInfo(unsigned short instance)
{
register struct w_files *w = wine_files;
while (w && w->hinstance != instance)
w = w->next;
return w;
}
#ifndef WINELIB
/**********************************************************************
*
* Load MZ Header
*/
void load_mz_header(int fd, struct mz_header_s *mz_header)
{
if (read(fd, mz_header, sizeof(struct mz_header_s)) !=
sizeof(struct mz_header_s))
{
myerror("Unable to read MZ header from file");
}
}
#endif
int IsDLLLoaded(char *name)
{
struct w_files *wpnt;
if(FindDLLTable(name))
return 1;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
if(strcmp(wpnt->name, name) == 0)
return 1;
return 0;
}
/**********************************************************************
* LoadImage
* Load one executable into memory
*/
HINSTANCE LoadImage(char *module, int filetype, int change_dir)
{
unsigned int read_size;
int i;
struct w_files * wpnt, *wpnt1;
unsigned int status;
char buffer[256], header[2], modulename[64], *fullname;
ExtractDLLName(module, modulename);
printf("%sLoadImage \n", module);
/* built-in one ? */
if (FindDLLTable(modulename)) {
return GetModuleHandle(modulename);
}
/* already loaded ? */
for (wpnt = wine_files ; wpnt ; wpnt = wpnt->next)
if (strcasecmp(wpnt->name, modulename) == 0)
return wpnt->hinstance;
/*
* search file
*/
fullname = FindFile(buffer, sizeof(buffer), module,
(filetype == EXE ? EXE_Extensions : DLL_Extensions),
WindowsPath);
if (fullname == NULL)
{
fprintf(stderr, "LoadImage: I can't find %s.dll | %s.exe !\n",
module, module);
return 2;
}
fullname = GetDosFileName(fullname);
WIN_ProgramName = strdup(fullname);
fprintf(stderr,"LoadImage: loading %s (%s)\n [%s]\n",
module, buffer, WIN_ProgramName);
if (change_dir && fullname)
{
char dirname[256];
char *p;
strcpy(dirname, fullname);
p = strrchr(dirname, '\\');
*p = '\0';
DOS_SetDefaultDrive(dirname[0] - 'A');
DOS_ChangeDir(dirname[0] - 'A', dirname + 2);
}
/* First allocate a spot to store the info we collect, and add it to
* our linked list.
*/
wpnt = (struct w_files *) malloc(sizeof(struct w_files));
if(wine_files == NULL)
wine_files = wpnt;
else {
wpnt1 = wine_files;
while(wpnt1->next) wpnt1 = wpnt1->next;
wpnt1->next = wpnt;
};
wpnt->next = NULL;
wpnt->resnamtab = (RESNAMTAB *) -1;
/*
* Open file for reading.
*/
wpnt->fd = open(buffer, O_RDONLY);
if (wpnt->fd < 0)
return 2;
/*
* Establish header pointers.
*/
wpnt->filename = strdup(buffer);
wpnt->name = strdup(modulename);
/* if(module) {
wpnt->name = strdup(module);
ToDos(wpnt->name);
}*/
/* read mz header */
wpnt->mz_header = (struct mz_header_s *) malloc(sizeof(struct mz_header_s));;
status = lseek(wpnt->fd, 0, SEEK_SET);
load_mz_header (wpnt->fd, wpnt->mz_header);
if (wpnt->mz_header->must_be_0x40 != 0x40 &&
wpnt->mz_header->must_be_0x40 != 0x1e)
myerror("This is not a Windows program");
/* read first two bytes to determine filetype */
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
read(wpnt->fd, &header, sizeof(header));
if (header[0] == 'N' && header[1] == 'E')
return (LoadNEImage(wpnt));
if (header[0] == 'P' && header[1] == 'E') {
printf("win32 applications are not supported");
return 14;
}
fprintf(stderr, "wine: (%s) unknown fileformat !\n", wpnt->filename);
return 14;
}
#ifndef WINELIB #ifndef WINELIB
/********************************************************************** /**********************************************************************
* main * main
*/ */
int _WinMain(int argc, char **argv) int _WinMain(int argc, char **argv)
{ {
int segment; char *p, filename[256];
char *p;
char *sysresname;
char filename[256];
HANDLE hTaskMain; HANDLE hTaskMain;
HINSTANCE hInstMain; HINSTANCE hInstMain;
struct w_files *wpnt;
#ifdef WINESTAT #ifdef WINESTAT
char * cp; char * cp;
#endif #endif
struct w_files * wpnt;
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int rv;
Argc = argc - 1; Argc = argc - 1;
Argv = argv + 1; Argv = argv + 1;
@ -274,7 +82,7 @@ int _WinMain(int argc, char **argv)
fprintf(stderr, "wine: can't load %s!.\n", Argv[0]); fprintf(stderr, "wine: can't load %s!.\n", Argv[0]);
exit(1); exit(1);
} }
hTaskMain = CreateNewTask(hInstMain); hTaskMain = CreateNewTask(hInstMain, 0);
printf("_WinMain // hTaskMain=%04X hInstMain=%04X !\n", hTaskMain, hInstMain); printf("_WinMain // hTaskMain=%04X hInstMain=%04X !\n", hTaskMain, hInstMain);
GetPrivateProfileString("wine", "SystemResources", "sysres.dll", GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
@ -285,17 +93,7 @@ int _WinMain(int argc, char **argv)
fprintf(stderr, "wine: can't load %s!.\n", filename); fprintf(stderr, "wine: can't load %s!.\n", filename);
exit(1); exit(1);
} else } else
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes); dprintf_dll(stddeb,"System Resources Loaded // hSysRes='%04X'\n", hSysRes);
/*
* Fixup references.
*/
/* wpnt = wine_files;
for(wpnt = wine_files; wpnt; wpnt = wpnt->next)
for (segment = 0; segment < wpnt->ne_header->n_segment_tab; segment++)
if (FixupSegment(wpnt, segment) < 0)
myerror("fixup failed.");
*/
#ifdef WINESTAT #ifdef WINESTAT
cp = strrchr(argv[0], '/'); cp = strrchr(argv[0], '/');
@ -312,96 +110,14 @@ int _WinMain(int argc, char **argv)
*/ */
init_wine_signals(); init_wine_signals();
/* wpnt = GetFileInfo(hInstMain);
* Fixup stack and jump to start. if (Options.debug)
*/ wine_debug(0, NULL);
WIN_StackSize = wine_files->ne_header->stack_length;
WIN_HeapSize = wine_files->ne_header->local_heap_length;
ds_reg = (wine_files-> if (wpnt->ne)
selector_table[wine_files->ne_header->auto_data_seg-1].selector); StartNEprogram(wpnt);
cs_reg = wine_files->selector_table[wine_files->ne_header->cs-1].selector;
ip_reg = wine_files->ne_header->ip;
ss_reg = wine_files->selector_table[wine_files->ne_header->ss-1].selector;
sp_reg = wine_files->ne_header->sp;
if (Options.debug) wine_debug(0, NULL);
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
void InitDLL(struct w_files *wpnt)
{
int cs_reg, ds_reg, ip_reg, rv;
/*
* Is this a library?
*/
if (wpnt->ne_header->format_flags & 0x8000)
{
if (!(wpnt->ne_header->format_flags & 0x0001))
{
/* Not SINGLEDATA */
fprintf(stderr, "Library is not marked SINGLEDATA\n");
exit(1);
}
ds_reg = wpnt->selector_table[wpnt->
ne_header->auto_data_seg-1].selector;
cs_reg = wpnt->selector_table[wpnt->ne_header->cs-1].selector;
ip_reg = wpnt->ne_header->ip;
if (cs_reg) {
fprintf(stderr, "Initializing %s, cs:ip %04x:%04x, ds %04x\n",
wpnt->name, cs_reg, ip_reg, ds_reg);
rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg);
printf ("rv = %x\n", rv);
} else
printf("%s skipped\n", wpnt->name);
}
}
void InitializeLoadedDLLs(struct w_files *wpnt)
{
static flagReadyToRun = 0;
struct w_files *final_wpnt;
printf("InitializeLoadedDLLs %08X\n", wpnt);
if (wpnt == NULL)
{
flagReadyToRun = 1;
fprintf(stderr, "Initializing DLLs\n");
}
if (!flagReadyToRun)
return;
#if 1
if (wpnt != NULL)
fprintf(stderr, "Initializing %s\n", wpnt->name);
#endif
/*
* Initialize libraries
*/
if (!wpnt)
{
wpnt = wine_files;
final_wpnt = NULL;
}
else else
{ StartPEprogram(wpnt);
final_wpnt = wpnt->next;
}
for( ; wpnt != final_wpnt; wpnt = wpnt->next)
InitDLL(wpnt);
}
#else /* #ifndef WINELIB */
void InitDLL(struct w_files *wpnt)
{
} }
#endif /* #ifndef WINELIB */ #endif /* #ifndef WINELIB */

View file

@ -7,8 +7,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <ctype.h>
#ifdef linux #ifdef linux
#include <linux/unistd.h>
#include <linux/head.h> #include <linux/head.h>
#include <linux/ldt.h> #include <linux/ldt.h>
#include <linux/segment.h> #include <linux/segment.h>
@ -24,20 +24,23 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "wineopts.h" #include "wineopts.h"
#include "arch.h" #include "arch.h"
#include "options.h" #include "options.h"
#include "stddebug.h"
/* #define DEBUG_FIXUP /* */ /* #define DEBUG_FIXUP /* */
/* #undef DEBUG_FIXUP /* */
#include "debug.h"
extern HANDLE CreateNewTask(HINSTANCE hInst); extern HANDLE CreateNewTask(HINSTANCE hInst);
extern void InitializeLoadedDLLs(struct w_files *wpnt);
extern int CallToInit16(unsigned long csip, unsigned long sssp, extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds); unsigned short ds);
extern void InitializeLoadedDLLs(struct w_files *wpnt); extern void CallTo32();
extern void FixupFunctionPrologs(struct w_files * wpnt);
char * GetModuleName(struct w_files * wpnt, int index, char *buffer);
extern char WindowsPath[256]; extern char WindowsPath[256];
char *WIN_ProgramName; extern unsigned short WIN_StackSize;
extern unsigned short WIN_HeapSize;
HINSTANCE hSysRes; int FixupSegment(struct w_files *, int);
void FixupFunctionPrologs(struct w_files *);
char *GetModuleName(struct w_files * wpnt, int index, char *buffer);
#ifndef WINELIB #ifndef WINELIB
@ -61,71 +64,61 @@ HINSTANCE LoadNEImage(struct w_files *wpnt)
{ {
unsigned int read_size, status, segment; unsigned int read_size, status, segment;
int i; int i;
char buffer[256];
char *fullname;
HANDLE t;
wpnt->ne_header = (struct ne_header_s *) malloc(sizeof(struct ne_header_s)); wpnt->ne = malloc(sizeof(struct ne_data));
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET); wpnt->ne->resnamtab = NULL;
load_ne_header (wpnt->fd, wpnt->ne_header); wpnt->ne->ne_header = malloc(sizeof(struct ne_header_s));
lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
load_ne_header(wpnt->fd, wpnt->ne->ne_header);
#ifndef WINELIB #ifndef WINELIB
/* /*
* Create segment selectors. * Create segment selectors.
*/ */
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset + status = lseek(wpnt->fd, wpnt->mz_header->ne_offset +
wpnt->ne_header->segment_tab_offset, wpnt->ne->ne_header->segment_tab_offset,
SEEK_SET); SEEK_SET);
read_size = wpnt->ne_header->n_segment_tab * read_size = wpnt->ne->ne_header->n_segment_tab *
sizeof(struct ne_segment_table_entry_s); sizeof(struct ne_segment_table_entry_s);
wpnt->seg_table = (struct ne_segment_table_entry_s *) malloc(read_size); wpnt->ne->seg_table = (struct ne_segment_table_entry_s *) malloc(read_size);
if (read(wpnt->fd, wpnt->seg_table, read_size) != read_size) if (read(wpnt->fd, wpnt->ne->seg_table, read_size) != read_size)
myerror("Unable to read segment table header from file"); myerror("Unable to read segment table header from file");
wpnt->selector_table = CreateSelectors(wpnt); wpnt->ne->selector_table = CreateSelectors(wpnt);
wpnt->hinstance = (wpnt-> wpnt->hinstance = (wpnt->ne->
selector_table[wpnt->ne_header->auto_data_seg-1]. selector_table[wpnt->ne->ne_header->auto_data_seg-1].
selector); selector);
#endif #endif
/* Get the lookup table. This is used for looking up the addresses /* Get the lookup table. This is used for looking up the addresses
of functions that are exported */ of functions that are exported */
read_size = wpnt->ne_header->entry_tab_length; read_size = wpnt->ne->ne_header->entry_tab_length;
wpnt->lookup_table = (char *) malloc(read_size); wpnt->ne->lookup_table = (char *) malloc(read_size);
lseek(wpnt->fd, wpnt->mz_header->ne_offset + lseek(wpnt->fd, wpnt->mz_header->ne_offset +
wpnt->ne_header->entry_tab_offset, SEEK_SET); wpnt->ne->ne_header->entry_tab_offset, SEEK_SET);
if (read(wpnt->fd, wpnt->lookup_table, read_size) != read_size) if (read(wpnt->fd, wpnt->ne->lookup_table, read_size) != read_size)
myerror("Unable to read lookup table header from file"); myerror("Unable to read lookup table header from file");
/* Get the iname table. This is used for looking up the names /* Get the iname table. This is used for looking up the names
of functions that are exported */ of functions that are exported */
status = lseek(wpnt->fd, wpnt->ne_header->nrname_tab_offset, SEEK_SET); status = lseek(wpnt->fd, wpnt->ne->ne_header->nrname_tab_offset, SEEK_SET);
read_size = wpnt->ne_header->nrname_tab_length; read_size = wpnt->ne->ne_header->nrname_tab_length;
wpnt->nrname_table = (char *) malloc(read_size); wpnt->ne->nrname_table = (char *) malloc(read_size);
if (read(wpnt->fd, wpnt->nrname_table, read_size) != read_size) if (read(wpnt->fd, wpnt->ne->nrname_table, read_size) != read_size)
myerror("Unable to read nrname table header from file"); myerror("Unable to read nrname table header from file");
status = lseek(wpnt->fd, wpnt->mz_header->ne_offset + status = lseek(wpnt->fd, wpnt->mz_header->ne_offset +
wpnt->ne_header->rname_tab_offset, SEEK_SET); wpnt->ne->ne_header->rname_tab_offset, SEEK_SET);
read_size = wpnt->ne_header->moduleref_tab_offset - read_size = wpnt->ne->ne_header->moduleref_tab_offset -
wpnt->ne_header->rname_tab_offset; wpnt->ne->ne_header->rname_tab_offset;
wpnt->rname_table = (char *) malloc(read_size); wpnt->ne->rname_table = (char *) malloc(read_size);
if (read(wpnt->fd, wpnt->rname_table, read_size) != read_size) if (read(wpnt->fd, wpnt->ne->rname_table, read_size) != read_size)
myerror("Unable to read rname table header from file"); myerror("Unable to read rname table header from file");
/* Now get the module name, if the current one is a filename */
/* nope, name by which dll is loaded is used !
if (strchr(wpnt->name, '\\') || strchr(wpnt->name, '/') ) {
wpnt->name = (char*) malloc(*wpnt->rname_table + 1);
memcpy(wpnt->name, wpnt->rname_table+1, *wpnt->rname_table);
}
wpnt->name[*wpnt->rname_table] = 0;
*/
/* /*
* Now load any DLLs that this module refers to. * Now load any DLLs that this module refers to.
*/ */
for(i=0; i<wpnt->ne_header->n_mod_ref_tab; i++) for(i=0; i<wpnt->ne->ne_header->n_mod_ref_tab; i++)
{ {
char buff[14]; char buff[14];
GetModuleName(wpnt, i + 1, buff); GetModuleName(wpnt, i + 1, buff);
@ -136,7 +129,7 @@ HINSTANCE LoadNEImage(struct w_files *wpnt)
#ifndef WINELIB #ifndef WINELIB
/* fixup references */ /* fixup references */
for (segment = 0; segment < wpnt->ne_header->n_segment_tab; segment++) for (segment = 0; segment < wpnt->ne->ne_header->n_segment_tab; segment++)
if (FixupSegment(wpnt, segment) < 0) if (FixupSegment(wpnt, segment) < 0)
myerror("fixup failed."); myerror("fixup failed.");
@ -174,7 +167,7 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer)
{ {
int fd = wpnt->fd; int fd = wpnt->fd;
struct mz_header_s *mz_header = wpnt->mz_header; struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne_header; struct ne_header_s *ne_header = wpnt->ne->ne_header;
int length; int length;
WORD name_offset, status; WORD name_offset, status;
int i; int i;
@ -194,7 +187,8 @@ GetModuleName(struct w_files * wpnt, int index, char *buffer)
/* Module names are always upper case */ /* Module names are always upper case */
for(i=0; i<length; i++) for(i=0; i<length; i++)
if(buffer[i] >= 'a' && buffer[i] <= 'z') buffer[i] &= ~0x20; if (islower(buffer[i]))
buffer[i] = toupper(buffer[i]);
return buffer; return buffer;
} }
@ -209,13 +203,12 @@ FixupSegment(struct w_files * wpnt, int segment_num)
{ {
int fd = wpnt->fd; int fd = wpnt->fd;
struct mz_header_s *mz_header = wpnt->mz_header; struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne_header; struct ne_header_s *ne_header = wpnt->ne->ne_header;
struct ne_segment_table_entry_s *seg_table = wpnt->seg_table; struct ne_segment_table_entry_s *seg_table = wpnt->ne->seg_table;
struct segment_descriptor_s *selector_table = wpnt->selector_table; struct segment_descriptor_s *selector_table = wpnt->ne->selector_table;
struct relocation_entry_s *rep, *rep1; struct relocation_entry_s *rep, *rep1;
struct ne_segment_table_entry_s *seg; struct ne_segment_table_entry_s *seg;
struct segment_descriptor_s *sel; struct segment_descriptor_s *sel;
struct dll_table_entry_s *dll_table;
int status; int status;
unsigned short *sp; unsigned short *sp;
unsigned int selector, address; unsigned int selector, address;
@ -229,10 +222,8 @@ FixupSegment(struct w_files * wpnt, int segment_num)
seg = &seg_table[segment_num]; seg = &seg_table[segment_num];
sel = &selector_table[segment_num]; sel = &selector_table[segment_num];
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb, "Segment fixups for %s, segment %d, selector %x\n",
printf("Segment fixups for %s, segment %d, selector %x\n",
wpnt->name, segment_num, (int) sel->base_addr >> 16); wpnt->name, segment_num, (int) sel->base_addr >> 16);
#endif
if ((seg->seg_data_offset == 0) || if ((seg->seg_data_offset == 0) ||
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA)) !(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
@ -293,10 +284,8 @@ FixupSegment(struct w_files * wpnt, int segment_num)
return -1; return -1;
} }
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb,"%d: %s.%d: %04.4x:%04.4x\n", i + 1,
printf("%d: %s.%d: %04.4x:%04.4x\n", i + 1, dll_name, ordinal, dll_name, ordinal, selector, address);
selector, address);
#endif
break; break;
case NE_RELTYPE_NAMEADD: case NE_RELTYPE_NAMEADD:
@ -328,10 +317,8 @@ FixupSegment(struct w_files * wpnt, int segment_num)
return -1; return -1;
} }
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb,"%d: %s %s.%d: %04.4x:%04.4x\n", i + 1,
printf("%d: %s %s.%d: %04.4x:%04.4x\n", i + 1, func_name, func_name, dll_name, ordinal, selector, address);
dll_name, ordinal, selector, address);
#endif
break; break;
case NE_RELTYPE_INTERNAL: case NE_RELTYPE_INTERNAL:
@ -348,9 +335,8 @@ FixupSegment(struct w_files * wpnt, int segment_num)
address = rep->target2; address = rep->target2;
} }
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb,"%d: %04.4x:%04.4x\n",
printf("%d: %04.4x:%04.4x\n", i + 1, selector, address); i + 1, selector, address);
#endif
break; break;
case 7: case 7:
@ -362,19 +348,20 @@ FixupSegment(struct w_files * wpnt, int segment_num)
* successfully emulate the coprocessor if it doesn't * successfully emulate the coprocessor if it doesn't
* exist. * exist.
*/ */
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb,
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ", "%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type, i + 1, rep->address_type, rep->relocation_type,
rep->offset); rep->offset);
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2); dprintf_fixup(stddeb,"TARGET %04.4x %04.4x\n",
#endif rep->target1, rep->target2);
continue; continue;
default: default:
fprintf(stderr,"%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ", dprintf_fixup(stddeb,
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type, i + 1, rep->address_type, rep->relocation_type,
rep->offset); rep->offset);
fprintf(stderr,"TARGET %04.4x %04.4x\n", dprintf_fixup(stddeb,"TARGET %04.4x %04.4x\n",
rep->target1, rep->target2); rep->target1, rep->target2);
free(rep1); free(rep1);
return -1; return -1;
@ -388,23 +375,21 @@ FixupSegment(struct w_files * wpnt, int segment_num)
{ {
if (FindDLLTable(dll_name) == NULL) if (FindDLLTable(dll_name) == NULL)
additive = 2; additive = 2;
dprintf_fixup(stddeb,
fprintf(stderr,"%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ", "%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type, i + 1, rep->address_type, rep->relocation_type,
rep->offset); rep->offset);
fprintf(stderr,"TARGET %04.4x %04.4x\n", dprintf_fixup(stddeb,"TARGET %04.4x %04.4x\n",
rep->target1, rep->target2); rep->target1, rep->target2);
fprintf(stderr, " Additive = %d\n", additive); dprintf_fixup(stddeb, " Additive = %d\n", additive);
} }
switch (rep->address_type) switch (rep->address_type)
{ {
case NE_RADDR_OFFSET16: case NE_RADDR_OFFSET16:
do { do {
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb," %04.4x:%04.4x:%04.4x OFFSET16\n",
printf(" %04.4x:%04.4x:%04.4x OFFSET16\n",
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp); (unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
#endif
next_addr = *sp; next_addr = *sp;
*sp = (unsigned short) address; *sp = (unsigned short) address;
if (additive == 2) if (additive == 2)
@ -417,10 +402,8 @@ FixupSegment(struct w_files * wpnt, int segment_num)
case NE_RADDR_POINTER32: case NE_RADDR_POINTER32:
do { do {
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb," %04.4x:%04.4x:%04.4x POINTER32\n",
printf(" %04.4x:%04.4x:%04.4x POINTER32\n",
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp); (unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
#endif
next_addr = *sp; next_addr = *sp;
*sp = (unsigned short) address; *sp = (unsigned short) address;
if (additive == 2) if (additive == 2)
@ -434,10 +417,8 @@ FixupSegment(struct w_files * wpnt, int segment_num)
case NE_RADDR_SELECTOR: case NE_RADDR_SELECTOR:
do { do {
#ifdef DEBUG_FIXUP dprintf_fixup(stddeb," %04.4x:%04.4x:%04.4x SELECTOR\n",
printf(" %04.4x:%04.4x:%04.4x SELECTOR\n",
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp); (unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
#endif
next_addr = *sp; next_addr = *sp;
*sp = (unsigned short) selector; *sp = (unsigned short) selector;
sp = (unsigned short *) ((char *) sel->base_addr + next_addr); sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
@ -449,10 +430,12 @@ FixupSegment(struct w_files * wpnt, int segment_num)
break; break;
default: default:
printf("%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ", dprintf_fixup(stddeb,
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04.4x, ",
i + 1, rep->address_type, rep->relocation_type, i + 1, rep->address_type, rep->relocation_type,
rep->offset); rep->offset);
printf("TARGET %04.4x %04.4x\n", rep->target1, rep->target2); dprintf_fixup(stddeb,
"TARGET %04.4x %04.4x\n", rep->target1, rep->target2);
free(rep1); free(rep1);
return -1; return -1;
} }
@ -462,4 +445,60 @@ FixupSegment(struct w_files * wpnt, int segment_num)
return 0; return 0;
} }
int NEunloadImage(struct w_files *wpnt)
{
printf("NEunloadImage() called!\n");
/* free resources, image */
return 1;
}
int StartNEprogram(struct w_files *wpnt)
{
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
/*
* Fixup stack and jump to start.
*/
WIN_StackSize = wpnt->ne->ne_header->stack_length;
WIN_HeapSize = wpnt->ne->ne_header->local_heap_length;
ds_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->auto_data_seg-1].selector;
cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1].selector;
ip_reg = wpnt->ne->ne_header->ip;
ss_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->ss-1].selector;
sp_reg = wpnt->ne->ne_header->sp;
return CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
}
void InitNEDLL(struct w_files *wpnt)
{
int cs_reg, ds_reg, ip_reg, rv;
/*
* Is this a library?
*/
if (wpnt->ne->ne_header->format_flags & 0x8000)
{
if (!(wpnt->ne->ne_header->format_flags & 0x0001))
{
/* Not SINGLEDATA */
fprintf(stderr, "Library is not marked SINGLEDATA\n");
exit(1);
}
ds_reg = wpnt->ne->selector_table[wpnt->ne->
ne_header->auto_data_seg-1].selector;
cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1].selector;
ip_reg = wpnt->ne->ne_header->ip;
if (cs_reg) {
fprintf(stderr, "Initializing %s, cs:ip %04x:%04x, ds %04x\n",
wpnt->name, cs_reg, ip_reg, ds_reg);
rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg);
printf ("rv = %x\n", rv);
} else
printf("%s skipped\n", wpnt->name);
}
}
#endif /* !WINELIB */ #endif /* !WINELIB */

499
loader/ne_resource.c Normal file
View file

@ -0,0 +1,499 @@
static char RCSId[] = "$Id: ne_resource.c,v 1.4 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "windows.h"
#include "neexe.h"
#include "peexe.h"
#include "arch.h"
#include "dlls.h"
#include "resource.h"
/* #define DEBUG_RESOURCE */
static int ResourceFd = -1;
static HANDLE ResourceInst = 0;
static struct w_files *ResourceFileInfo;
/**********************************************************************
* RSC_LoadNameTable
*/
void RSC_LoadNameTable(void)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
RESNAMTAB *top, *new;
char read_buf[1024];
char *p;
int i;
unsigned short len;
off_t rtoff;
off_t saved_pos;
top = NULL;
/*
* Move to beginning of resource table.
*/
rtoff = (ResourceFileInfo->mz_header->ne_offset +
ResourceFileInfo->ne->ne_header->resource_tab_offset);
lseek(ResourceFd, rtoff, SEEK_SET);
/*
* Read block size.
*/
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
return;
}
size_shift = CONV_SHORT(size_shift);
/*
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
if (!load_typeinfo (ResourceFd, &typeinfo))
break;
if (typeinfo.type_id == 0)
break;
if (typeinfo.type_id == 0x800f)
{
for (i = 0; i < typeinfo.count; i++)
{
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
break;
}
saved_pos = lseek(ResourceFd, 0, SEEK_CUR);
lseek(ResourceFd, (long) nameinfo.offset << size_shift,
SEEK_SET);
read(ResourceFd, &len, sizeof(len));
while (len)
{
new = (RESNAMTAB *) GlobalQuickAlloc(sizeof(*new));
new->next = top;
top = new;
read(ResourceFd, &new->type_ord, 2);
read(ResourceFd, &new->id_ord, 2);
read(ResourceFd, read_buf, len - 6);
p = read_buf + strlen(read_buf) + 1;
strncpy(new->id, p, MAX_NAME_LENGTH);
new->id[MAX_NAME_LENGTH - 1] = '\0';
read(ResourceFd, &len, sizeof(len));
}
lseek(ResourceFd, saved_pos, SEEK_SET);
}
break;
}
else
{
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
ResourceFileInfo->ne->resnamtab = top;
}
/**********************************************************************
* OpenResourceFile
*/
int
OpenResourceFile(HANDLE instance)
{
struct w_files *w;
char *res_file;
if (ResourceInst == instance)
return ResourceFd;
w = GetFileInfo(instance);
if (w == NULL)
return -1;
ResourceFileInfo = w;
res_file = w->filename;
if (ResourceFd >= 0)
close(ResourceFd);
ResourceInst = instance;
ResourceFd = open (res_file, O_RDONLY);
#if 1
#ifndef WINELIB
if (w->ne->resnamtab == (RESNAMTAB *) -1)
{
RSC_LoadNameTable();
}
#endif
#endif
#ifdef DEBUG_RESOURCE
printf("OpenResourceFile(%04X) // file='%s' hFile=%04X !\n",
instance, w->filename, ResourceFd);
#endif
return ResourceFd;
}
int load_typeinfo (int fd, struct resource_typeinfo_s *typeinfo)
{
return read (fd, typeinfo, sizeof (*typeinfo)) == sizeof (*typeinfo);
}
int type_match(int type_id1, int type_id2, int fd, off_t off)
{
off_t old_pos;
unsigned char c;
size_t nbytes;
char name[256];
if (type_id1 == -1)
return 1;
if ((type_id1 & 0xffff0000) == 0) {
if ((type_id2 & 0x8000) == 0)
return 0;
return (type_id1 & 0x000f) == (type_id2 & 0x000f);
}
if ((type_id2 & 0x8000) != 0)
return 0;
#ifdef DEBUG_RESOURCE
printf("type_compare: type_id2=%04X !\n", type_id2);
#endif
old_pos = lseek(fd, 0, SEEK_CUR);
lseek(fd, off + type_id2, SEEK_SET);
read(fd, &c, 1);
nbytes = CONV_CHAR_TO_LONG (c);
#ifdef DEBUG_RESOURCE
printf("type_compare: namesize=%d\n", nbytes);
#endif
read(fd, name, nbytes);
lseek(fd, old_pos, SEEK_SET);
name[nbytes] = '\0';
#ifdef DEBUG_RESOURCE
printf("type_compare: name=`%s'\n", name);
#endif
return strcasecmp((char *) type_id1, name) == 0;
}
/**********************************************************************
* FindResourceByNumber
*/
int
FindResourceByNumber(struct resource_nameinfo_s *result_p,
int type_id, int resource_id)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
int i;
off_t rtoff;
/*
* Move to beginning of resource table.
*/
rtoff = (ResourceFileInfo->mz_header->ne_offset +
ResourceFileInfo->ne->ne_header->resource_tab_offset);
lseek(ResourceFd, rtoff, SEEK_SET);
/*
* Read block size.
*/
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
printf("FindResourceByNumber (%d) bad block size !\n",(int) resource_id);
return -1;
}
size_shift = CONV_SHORT(size_shift);
/*
* Find resource.
*/
for (;;) {
if (!load_typeinfo (ResourceFd, &typeinfo)){
printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id);
return -1;
}
#ifdef DEBUG_RESOURCE
printf("FindResourceByNumber type=%X count=%d ?=%d searched=%08X\n",
typeinfo.type_id, typeinfo.count, typeinfo.reserved, type_id);
#endif
if (typeinfo.type_id == 0) break;
if (type_match(type_id, typeinfo.type_id, ResourceFd, rtoff)) {
for (i = 0; i < typeinfo.count; i++) {
#ifndef WINELIB
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
#else
if (!load_nameinfo (ResourceFd, &nameinfo))
#endif
{
printf("FindResourceByNumber (%X) bad nameinfo size !\n", resource_id);
return -1;
}
#ifdef DEBUG_RESOURCE
printf("FindResource: search type=%X id=%X // type=%X id=%X\n",
type_id, resource_id, typeinfo.type_id, nameinfo.id);
#endif
if (nameinfo.id == resource_id) {
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
return -1;
}
/**********************************************************************
* FindResourceByName
*/
int
FindResourceByName(struct resource_nameinfo_s *result_p,
int type_id, char *resource_name)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
off_t old_pos, new_pos;
unsigned char nbytes;
char name[256];
int i;
off_t rtoff;
/*
* Check for loaded name table.
*/
if (ResourceFileInfo->ne->resnamtab != NULL)
{
RESNAMTAB *e;
for (e = ResourceFileInfo->ne->resnamtab; e != NULL; e = e->next)
{
if (e->type_ord == (type_id & 0x000f) &&
strcasecmp(e->id, resource_name) == 0)
{
return FindResourceByNumber(result_p, type_id, e->id_ord);
}
}
return -1;
}
/*
* Move to beginning of resource table.
*/
rtoff = (ResourceFileInfo->mz_header->ne_offset +
ResourceFileInfo->ne->ne_header->resource_tab_offset);
lseek(ResourceFd, rtoff, SEEK_SET);
/*
* Read block size.
*/
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
sizeof(size_shift))
{
printf("FindResourceByName (%s) bad block size !\n", resource_name);
return -1;
}
size_shift = CONV_SHORT (size_shift);
/*
* Find resource.
*/
for (;;)
{
if (!load_typeinfo (ResourceFd, &typeinfo))
{
printf("FindResourceByName (%s) bad typeinfo size !\n", resource_name);
return -1;
}
#ifdef DEBUG_RESOURCE
printf("FindResourceByName typeinfo.type_id=%X count=%d type_id=%X\n",
typeinfo.type_id, typeinfo.count, type_id);
#endif
if (typeinfo.type_id == 0) break;
if (type_match(type_id, typeinfo.type_id, ResourceFd, rtoff))
{
for (i = 0; i < typeinfo.count; i++)
{
#ifndef WINELIB
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
#else
if (!load_nameinfo (ResourceFd, &nameinfo))
#endif
{
printf("FindResourceByName (%s) bad nameinfo size !\n", resource_name);
return -1;
}
/*
if ((nameinfo.id & 0x8000) != 0) continue;
*/
#ifdef DEBUG_RESOURCE
printf("FindResourceByName // nameinfo.id=%04X !\n", nameinfo.id);
#endif
old_pos = lseek(ResourceFd, 0, SEEK_CUR);
new_pos = rtoff + nameinfo.id;
lseek(ResourceFd, new_pos, SEEK_SET);
read(ResourceFd, &nbytes, 1);
#ifdef DEBUG_RESOURCE
printf("FindResourceByName // namesize=%d !\n", nbytes);
#endif
nbytes = CONV_CHAR_TO_LONG (nbytes);
read(ResourceFd, name, nbytes);
lseek(ResourceFd, old_pos, SEEK_SET);
name[nbytes] = '\0';
#ifdef DEBUG_RESOURCE
printf("FindResourceByName type_id=%X (%d of %d) name='%s' resource_name='%s'\n",
typeinfo.type_id, i + 1, typeinfo.count,
name, resource_name);
#endif
if (strcasecmp(name, resource_name) == 0)
{
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
return -1;
}
/**********************************************************************
* GetRsrcCount [internal]
*/
int GetRsrcCount(HINSTANCE hInst, int type_id)
{
struct resource_typeinfo_s typeinfo;
struct resource_nameinfo_s nameinfo;
unsigned short size_shift;
off_t rtoff;
if (hInst == 0) return 0;
#ifdef DEBUG_RESOURCE
printf("GetRsrcCount hInst=%04X typename=%08X\n", hInst, type_id);
#endif
if (OpenResourceFile(hInst) < 0) return 0;
/*
* Move to beginning of resource table.
*/
rtoff = (ResourceFileInfo->mz_header->ne_offset +
ResourceFileInfo->ne->ne_header->resource_tab_offset);
lseek(ResourceFd, rtoff, SEEK_SET);
/*
* Read block size.
*/
if (read(ResourceFd, &size_shift, sizeof(size_shift)) != sizeof(size_shift)) {
printf("GetRsrcCount // bad block size !\n");
return -1;
}
size_shift = CONV_SHORT (size_shift);
for (;;) {
if (!load_typeinfo (ResourceFd, &typeinfo)) {
printf("GetRsrcCount // bad typeinfo size !\n");
return 0;
}
#ifdef DEBUG_RESOURCE
printf("GetRsrcCount // typeinfo.type_id=%X count=%d type_id=%X\n",
typeinfo.type_id, typeinfo.count, type_id);
#endif
if (typeinfo.type_id == 0) break;
if (type_match(type_id, typeinfo.type_id, ResourceFd, rtoff)) {
return typeinfo.count;
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
return 0;
}
/**********************************************************************
* NE_FindResource [KERNEL.60]
*/
int
NE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name,
RESOURCE *r)
{
int type;
#ifdef DEBUG_RESOURCE
printf("NE_FindResource hInst=%04X typename=%08X resname=%08X\n",
instance, type_name, resource_name);
#endif
ResourceFd = r->fd;
ResourceFileInfo = r->wpnt;
/* nametable loaded ? */
if (r->wpnt->ne->resnamtab == NULL)
RSC_LoadNameTable();
if (((int) type_name & 0xffff0000) == 0)
{
type = (int) type_name;
}
else if (type_name[0] == '\0')
{
type = -1;
}
else if (type_name[0] == '#')
{
type = atoi(type_name + 1);
}
else
{
type = (int) type_name;
}
if (((int) resource_name & 0xffff0000) == 0)
{
r->size_shift = FindResourceByNumber(&r->nameinfo, type,
(int) resource_name | 0x8000);
}
else if (resource_name[0] == '\0')
{
r->size_shift = FindResourceByNumber(&r->nameinfo, type, -1);
}
else if (resource_name[0] == '#')
{
r->size_shift = FindResourceByNumber(&r->nameinfo, type,
atoi(resource_name + 1));
}
else
{
r->size_shift = FindResourceByName(&r->nameinfo, type, resource_name);
}
if (r->size_shift == -1)
{
printf("NE_FindResource hInst=%04X typename=%08X resname=%08X not found!\n",
instance, (int) type_name, (int) resource_name);
return 0;
}
r->size = r->nameinfo.length << r->size_shift;
r->offset = r->nameinfo.offset << r->size_shift;
return 1;
}

213
loader/pe_image.c Normal file
View file

@ -0,0 +1,213 @@
/*
* Copyright 1994 Eric Youndale & Erik Bos
*
* based on Eric Youndale's pe-test and:
*
* ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include "windows.h"
#include "dlls.h"
#include "neexe.h"
#include "peexe.h"
#define MAP_ANONYMOUS 0x20
unsigned int load_addr;
void my_wcstombs(char * result, u_short * source, int len)
{
while(len--) {
if(isascii(*source)) *result++ = *source++;
else {
printf("Unable to handle unicode right now\n");
exit(0);
}
};
}
char * xmmap(char * vaddr, unsigned int v_size, int prot, int flags,
int fd, unsigned int file_offset)
{
char * result;
result = mmap(vaddr, v_size, prot, flags, fd, file_offset);
if((unsigned int) result != 0xffffffff) return result;
/* Sigh. Alignment must be wrong for mmap. Do this the hard way. */
if(!(flags & MAP_FIXED)) {
vaddr = 0x40000000;
flags |= MAP_FIXED;
};
mmap(vaddr, v_size, prot, MAP_ANONYMOUS | flags, 0, 0);
lseek(fd, file_offset, SEEK_SET);
read(fd, vaddr, v_size);
return vaddr;
};
dump_exports(struct PE_Export_Directory * pe_exports)
{
char * Module;
int i;
u_short * ordinal;
u_long * function;
u_char ** name, *ename;
Module = ((char *) load_addr) + pe_exports->Name;
printf("\n*******EXPORT DATA*******\nModule name is %s, %d functions, %d names\n",
Module,
pe_exports->Number_Of_Functions,
pe_exports->Number_Of_Names);
ordinal = (u_short *) (((char *) load_addr) + (int) pe_exports->Address_Of_Name_Ordinals);
function = (u_long *) (((char *) load_addr) + (int) pe_exports->AddressOfFunctions);
name = (u_char **) (((char *) load_addr) + (int) pe_exports->AddressOfNames);
printf("%-32s Ordinal Virt Addr\n", "Function Name");
for(i=0; i< pe_exports->Number_Of_Functions; i++)
{
ename = (char *) (((char *) load_addr) + (int) *name++);
printf("%-32s %4d %8.8x\n", ename, *ordinal++, *function++);
}
return;
}
dump_imports(struct PE_Import_Directory *pe_imports)
{
struct PE_Import_Directory * pe_imp;
/* OK, now dump the import list */
printf("\nDumping imports list\n");
pe_imp = pe_imports;
while (pe_imp->ModuleName)
{
char * Module, *Function;
struct pe_import_name * pe_name;
unsigned int * import_list;
char * c;
Module = ((char *) load_addr) + pe_imp->ModuleName;
printf("%s\n", Module);
c = strchr(Module, '.');
if (c) *c = 0;
import_list = (unsigned int *)
(((unsigned int) load_addr) + pe_imp->Import_List);
while(*import_list)
{
pe_name = (struct pe_import_name *) ((int) load_addr + *import_list);
printf("--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
import_list++;
}
pe_imp++;
};
}
static void dump_table(struct w_files *wpnt)
{
int i;
printf("Dump of segment table\n");
printf(" Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n");
for(i=0; i< wpnt->pe->pe_header->coff.NumberOfSections; i++)
{
printf("%8s: %4.4x %8.8x %8.8x %8.8x %8.8x %8.8x %4.4x %4.4x %8.8x\n",
wpnt->pe->pe_seg[i].Name,
wpnt->pe->pe_seg[i].Virtual_Size,
wpnt->pe->pe_seg[i].Virtual_Address,
wpnt->pe->pe_seg[i].Size_Of_Raw_Data,
wpnt->pe->pe_seg[i].PointerToRawData,
wpnt->pe->pe_seg[i].PointerToRelocations,
wpnt->pe->pe_seg[i].PointerToLinenumbers,
wpnt->pe->pe_seg[i].NumberOfRelocations,
wpnt->pe->pe_seg[i].NumberOfLinenumbers,
wpnt->pe->pe_seg[i].Characteristics);
}
}
/**********************************************************************
* LoadPEImage
* Load one PE format executable into memory
*/
HINSTANCE LoadPEImage(struct w_files *wpnt)
{
int i, result;
wpnt->pe = malloc(sizeof(struct pe_data));
wpnt->pe->pe_header = malloc(sizeof(struct pe_header_s));
/* read PE header */
lseek(wpnt->fd, wpnt->mz_header->ne_offset, SEEK_SET);
read(wpnt->fd, wpnt->pe->pe_header, sizeof(struct pe_header_s));
/* read sections */
wpnt->pe->pe_seg = malloc(sizeof(struct pe_segment_table) *
wpnt->pe->pe_header->coff.NumberOfSections);
read(wpnt->fd, wpnt->pe->pe_seg, sizeof(struct pe_segment_table) *
wpnt->pe->pe_header->coff.NumberOfSections);
load_addr = wpnt->pe->pe_header->opt_coff.BaseOfImage;
dump_table(wpnt);
for(i=0; i < wpnt->pe->pe_header->coff.NumberOfSections; i++)
{
if(!load_addr) {
result = xmmap(0, wpnt->pe->pe_seg[i].Size_Of_Raw_Data, 7, MAP_PRIVATE,
wpnt->fd, wpnt->pe->pe_seg[i].PointerToRawData);
load_addr = (unsigned int) result - wpnt->pe->pe_seg[i].Virtual_Address;
} else {
result = xmmap((char *) load_addr + wpnt->pe->pe_seg[i].Virtual_Address,
wpnt->pe->pe_seg[i].Size_Of_Raw_Data, 7, MAP_PRIVATE | MAP_FIXED,
wpnt->fd, wpnt->pe->pe_seg[i].PointerToRawData);
}
if(strcmp(wpnt->pe->pe_seg[i].Name, ".idata") == 0)
wpnt->pe->pe_import = (struct PE_Import_Directory *) result;
if(strcmp(wpnt->pe->pe_seg[i].Name, ".edata") == 0)
wpnt->pe->pe_export = (struct PE_Export_Directory *) result;
if(strcmp(wpnt->pe->pe_seg[i].Name, ".rsrc") == 0) {
wpnt->pe->pe_resource = (struct PE_Resource_Directory *) result;
/* save offset for PE_FindResource */
wpnt->pe->resource_offset = wpnt->pe->pe_seg[i].Virtual_Address -
wpnt->pe->pe_seg[i].PointerToRawData;
}
}
if(wpnt->pe->pe_import) dump_imports(wpnt->pe->pe_import);
if(wpnt->pe->pe_export) dump_exports(wpnt->pe->pe_export);
wpnt->hinstance = 0x8000;
return (wpnt->hinstance);
}
int PEunloadImage(struct w_files *wpnt)
{
printf("PEunloadImage() called!\n");
/* free resources, image, unmap */
return 1;
}
int StartPEprogram(struct w_files *wpnt)
{
printf("StartPEprogram() called!\n");
return 0;
}
void InitPEDLL(struct w_files *wpnt)
{
/* Is this a library? */
if (wpnt->pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL) {
printf("InitPEDLL() called!\n");
}
}

151
loader/pe_resource.c Normal file
View file

@ -0,0 +1,151 @@
/*
* (c) 1994 Erik Bos <erik@hacktic.nl>
*
* based on Eric Youndale's pe-test and:
*
* ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "windows.h"
#include "neexe.h"
#include "peexe.h"
#include "dlls.h"
#include "resource.h"
#define DEBUG_RESOURCE
static int
find_lang(char *root, struct PE_Resource_Directory *resource, RESOURCE *r)
{
int i;
struct PE_Directory_Entry *type_dir;
struct PE_Resource_Leaf_Entry *leaf;
type_dir = (struct PE_Directory_Entry *)(resource + 1);
type_dir += resource->NumberOfNamedEntries;
/* grab the 1st resource available */
leaf = (struct PE_Resource_Leaf_Entry *) (root + type_dir->OffsetToData);
#ifdef DEBUG_RESOURCE
printf("\t\tPE_findlang: id %8x\n", (int) type_dir->Name);
printf("\t\taddress %d, size %d, language id %d\n", leaf->OffsetToData, leaf->Size, leaf->CodePage);
#endif
r->offset = leaf->OffsetToData - r->wpnt->pe->resource_offset;
r->size = leaf->Size;
printf("\t\toffset %d, size %d\n", r->offset, r->size);
return 1;
/* for(i=0; i< resource->NumberOfIdEntries; i++) {
leaf = (root + (type_dir->OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY));
#ifdef DEBUG_RESOURCE
printf("\t\tPE_findlang: id %8x\n", (int) type_dir->Name);
printf("\t\t%x %x %x\n", leaf->OffsetToData, leaf->Size,
leaf->CodePage);
#endif
type_dir++;
} */
}
static int
find_resource(char *root, struct PE_Resource_Directory *resource,
LPSTR resource_name, RESOURCE *r)
{
int i;
char res_name[256];
struct PE_Directory_Entry *type_dir;
struct PE_Directory_Name_String_U *name;
type_dir = (struct PE_Directory_Entry *)(resource + 1);
if (HIWORD((DWORD)resource_name)) {
for(i=0; i< resource->NumberOfNamedEntries; i++) {
name = (struct PE_Directory_Name_String_U *)(root + (type_dir->Name & ~IMAGE_RESOURCE_NAME_IS_STRING));
memset(res_name, 0, sizeof(res_name));
my_wcstombs(res_name, name->NameString, name->Length);
#ifdef DEBUG_RESOURCE
printf("\tPE_findresource: name %s\n", res_name);
#endif
if (strcasecmp(res_name, resource_name) == 0)
return find_lang(root, (struct PE_Resource_Directory *) (root + (type_dir->OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY)), r);
type_dir++;
}
} else {
type_dir += resource->NumberOfNamedEntries;
for(i=0; i< resource->NumberOfIdEntries; i++) {
#ifdef DEBUG_RESOURCE
printf("\tPE_findresource: name %8x\n", (int) type_dir->Name);
#endif
if (type_dir->Name == ((int) resource_name & 0xff))
return find_lang(root, (struct PE_Resource_Directory *) (root + (type_dir->OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY)), r);
type_dir++;
}
}
return 0;
}
static int
find_type(struct PE_Resource_Directory *resource, LPSTR resource_name,
LPSTR type_name, RESOURCE *r)
{
int i;
char *root, res_name[256];
struct PE_Directory_Entry *type_dir;
struct PE_Directory_Name_String_U *name;
root = (char *) resource;
type_dir = (struct PE_Directory_Entry *)(resource + 1);
if (HIWORD((DWORD)type_name)) {
for(i=0; i< resource->NumberOfNamedEntries; i++) {
name = (struct PE_Directory_Name_String_U *)(root + (type_dir->Name & ~IMAGE_RESOURCE_NAME_IS_STRING));
memset(res_name, 0, sizeof(res_name));
my_wcstombs(res_name, name->NameString, name->Length);
#ifdef DEBUG_RESOURCE
printf("PE_findtype: type %s\n", res_name);
#endif
if (strcasecmp(res_name, type_name) == 0)
return find_resource(root, (struct PE_Resource_Directory *) (root + (type_dir->OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY)), resource_name, r);
type_dir++;
}
} else {
type_dir += resource->NumberOfNamedEntries;
for(i=0; i< resource->NumberOfIdEntries; i++) {
#ifdef DEBUG_RESOURCE
printf("PE_findtype: type %8x\n", (int) type_dir->Name);
#endif
if (type_dir->Name == ((int) type_name & 0xff))
return find_resource(root, (struct PE_Resource_Directory *) (root + (type_dir->OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY)), resource_name, r);
type_dir++;
}
}
return 0;
}
/**********************************************************************
* PE_FindResource [KERNEL.60]
*/
int
PE_FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name,
RESOURCE *r)
{
#ifdef DEBUG_RESOURCE
printf("PE_FindResource hInst=%04X typename=%08X resname=%08X\n",
instance, (int) type_name, (int) resource_name);
#endif
if (HIWORD((DWORD)resource_name))
if (resource_name[0] == '#')
resource_name = (LPSTR) atoi(resource_name + 1);
if (HIWORD((DWORD)type_name))
if (type_name[0] == '#')
type_name = (LPSTR) atoi(type_name + 1);
return find_type(r->wpnt->pe->pe_resource, resource_name, type_name,r);
}

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <errno.h> #include <errno.h>
#ifdef __linux__ #ifdef __linux__
#include <sys/mman.h>
#include <linux/unistd.h> #include <linux/unistd.h>
#include <linux/head.h> #include <linux/head.h>
#include <linux/mman.h> #include <linux/mman.h>
@ -28,8 +29,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#include "prototypes.h" #include "prototypes.h"
#include "debug.h"
/* #define DEBUG_SELECTORS /* */ /* #define DEBUG_SELECTORS /* */
/* #undef DEBUG_SELECTORS /* */
#ifdef linux #ifdef linux
#define DEV_ZERO #define DEV_ZERO
@ -60,7 +63,6 @@ SEGDESC Segments[MAX_SELECTORS];
extern void KERNEL_Ordinal_102(); extern void KERNEL_Ordinal_102();
extern void UNIXLIB_Ordinal_0(); extern void UNIXLIB_Ordinal_0();
extern char *WIN_ProgramName;
extern char WindowsPath[256]; extern char WindowsPath[256];
extern char **Argv; extern char **Argv;
@ -505,8 +507,7 @@ CreateNewSegments(int code_flag, int read_only, int length, int n_segments)
i = FindUnusedSelectors(n_segments); i = FindUnusedSelectors(n_segments);
#ifdef DEBUG_SELECTORS #ifdef DEBUG_SELECTORS
fprintf(stderr, fprintf(stddeb, "Using %d segments starting at index %d.\n", n_segments, i);
"Using %d segments starting at index %d.\n", n_segments, i);
#endif #endif
/* /*
@ -609,10 +610,10 @@ unsigned int GetEntryDLLName(char * dll_name, char * function, int * sel,
/* Not a builtin symbol, look to see what the file has for us */ /* Not a builtin symbol, look to see what the file has for us */
for(wpnt = wine_files; wpnt; wpnt = wpnt->next){ for(wpnt = wine_files; wpnt; wpnt = wpnt->next){
if(strcasecmp(wpnt->name, dll_name)) continue; if(strcasecmp(wpnt->name, dll_name)) continue;
cpnt = wpnt->nrname_table; cpnt = wpnt->ne->nrname_table;
while(1==1){ while(1==1){
if( ((int) cpnt) - ((int)wpnt->nrname_table) > if( ((int) cpnt) - ((int)wpnt->ne->nrname_table) >
wpnt->ne_header->nrname_tab_length) return 1; wpnt->ne->ne_header->nrname_tab_length) return 1;
len = *cpnt++; len = *cpnt++;
if(strncmp(cpnt, function, len) == 0) break; if(strncmp(cpnt, function, len) == 0) break;
cpnt += len + 2; cpnt += len + 2;
@ -662,8 +663,7 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
{ {
int fd = wpnt->fd; int fd = wpnt->fd;
struct mz_header_s *mz_header = wpnt->mz_header; struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne_header; struct ne_header_s *ne_header = wpnt->ne->ne_header;
union lookup entry_tab_pointer; union lookup entry_tab_pointer;
struct entry_tab_header_s *eth; struct entry_tab_header_s *eth;
@ -672,8 +672,7 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
int current_ordinal; int current_ordinal;
int i; int i;
entry_tab_pointer.cpnt = wpnt->ne->lookup_table;
entry_tab_pointer.cpnt = wpnt->lookup_table;
/* /*
* Let's walk through the table until we get to our entry. * Let's walk through the table until we get to our entry.
*/ */
@ -707,7 +706,7 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
if (current_ordinal == ordinal) if (current_ordinal == ordinal)
{ {
return ((unsigned int) return ((unsigned int)
(wpnt->selector_table[etm->seg_number - 1].base_addr + (wpnt->ne->selector_table[etm->seg_number - 1].base_addr +
etm->offset)); etm->offset));
} }
} }
@ -718,7 +717,7 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
if (current_ordinal == ordinal) if (current_ordinal == ordinal)
{ {
return ((unsigned int) return ((unsigned int)
(wpnt->selector_table[eth->seg_number - 1].base_addr + (wpnt->ne->selector_table[eth->seg_number - 1].base_addr +
(int) etf->offset[0] + (int) etf->offset[0] +
((int) etf->offset[1] << 8))); ((int) etf->offset[1] << 8)));
} }
@ -726,73 +725,6 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal)
} }
} }
} }
/**********************************************************************
*/
void
FixupFunctionPrologs(struct w_files * wpnt)
{
struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne_header;
union lookup entry_tab_pointer;
struct entry_tab_header_s *eth;
struct entry_tab_movable_s *etm;
struct entry_tab_fixed_s *etf;
unsigned char *fixup_ptr;
int i;
if (!(ne_header->format_flags & 0x0001))
return;
entry_tab_pointer.cpnt = wpnt->lookup_table;
/*
* Let's walk through the table and fixup prologs as we go.
*/
while (1)
{
/* Get bundle header */
eth = entry_tab_pointer.eth++;
/* Check for end of table */
if (eth->n_entries == 0)
return;
/* Check for empty bundle */
if (eth->seg_number == 0)
continue;
/* Examine each bundle */
for (i = 0; i < eth->n_entries; i++)
{
/* Moveable segment */
if (eth->seg_number >= 0xfe)
{
etm = entry_tab_pointer.etm++;
fixup_ptr = (wpnt->selector_table[etm->seg_number-1].base_addr
+ etm->offset);
}
else
{
etf = entry_tab_pointer.etf++;
fixup_ptr = (wpnt->selector_table[eth->seg_number-1].base_addr
+ (int) etf->offset[0]
+ ((int) etf->offset[1] << 8));
}
/* Verify the signature */
if (((fixup_ptr[0] == 0x1e && fixup_ptr[1] == 0x58)
|| (fixup_ptr[0] == 0x8c && fixup_ptr[1] == 0xd8))
&& fixup_ptr[2] == 0x90)
{
fixup_ptr[0] = 0xb8; /* MOV AX, */
fixup_ptr[1] = wpnt->hinstance;
fixup_ptr[2] = (wpnt->hinstance >> 8);
}
}
}
}
/********************************************************************** /**********************************************************************
* GetDOSEnvironment * GetDOSEnvironment
@ -810,7 +742,6 @@ CreateEnvironment(void)
{ {
char **e; char **e;
char *p; char *p;
unsigned short *w;
SEGDESC * s; SEGDESC * s;
s = CreateNewSegments(0, 0, PAGE_SIZE, 1); s = CreateNewSegments(0, 0, PAGE_SIZE, 1);
@ -836,18 +767,15 @@ CreateEnvironment(void)
} }
*p++ = '\0'; *p++ = '\0';
w = (unsigned short *) p;
*w = strlen(WIN_ProgramName);
strcpy(p + 2, WIN_ProgramName);
/* /*
* Display environment * Display environment
*/ */
fprintf(stderr, "Environment at %08.8x\n", s->base_addr); #ifdef DEBUG_SELECTORS
fprintf(stddeb, "Environment at %08.8x\n", s->base_addr);
for (p = s->base_addr; *p; p += strlen(p) + 1) for (p = s->base_addr; *p; p += strlen(p) + 1)
fprintf(stderr, " %s\n", p); fprintf(stddeb, " %s\n", p);
p += 3; #endif
fprintf(stderr, " Program: %s\n", p);
return s; return s;
} }
@ -918,8 +846,8 @@ SEGDESC *
CreateSelectors(struct w_files * wpnt) CreateSelectors(struct w_files * wpnt)
{ {
int fd = wpnt->fd; int fd = wpnt->fd;
struct ne_segment_table_entry_s *seg_table = wpnt->seg_table; struct ne_segment_table_entry_s *seg_table = wpnt->ne->seg_table;
struct ne_header_s *ne_header = wpnt->ne_header; struct ne_header_s *ne_header = wpnt->ne->ne_header;
SEGDESC *selectors, *s, *stmp; SEGDESC *selectors, *s, *stmp;
unsigned short auto_data_sel; unsigned short auto_data_sel;
int contents, read_only; int contents, read_only;
@ -1059,13 +987,78 @@ CreateSelectors(struct w_files * wpnt)
return selectors; return selectors;
} }
/**********************************************************************
*/
void
FixupFunctionPrologs(struct w_files * wpnt)
{
struct mz_header_s *mz_header = wpnt->mz_header;
struct ne_header_s *ne_header = wpnt->ne->ne_header;
union lookup entry_tab_pointer;
struct entry_tab_header_s *eth;
struct entry_tab_movable_s *etm;
struct entry_tab_fixed_s *etf;
unsigned char *fixup_ptr;
int i;
if (!(ne_header->format_flags & 0x0001))
return;
entry_tab_pointer.cpnt = wpnt->ne->lookup_table;
/*
* Let's walk through the table and fixup prologs as we go.
*/
while (1)
{
/* Get bundle header */
eth = entry_tab_pointer.eth++;
/* Check for end of table */
if (eth->n_entries == 0)
return;
/* Check for empty bundle */
if (eth->seg_number == 0)
continue;
/* Examine each bundle */
for (i = 0; i < eth->n_entries; i++)
{
/* Moveable segment */
if (eth->seg_number >= 0xfe)
{
etm = entry_tab_pointer.etm++;
fixup_ptr = (wpnt->ne->selector_table[etm->seg_number-1].base_addr
+ etm->offset);
}
else
{
etf = entry_tab_pointer.etf++;
fixup_ptr = (wpnt->ne->selector_table[eth->seg_number-1].base_addr
+ (int) etf->offset[0]
+ ((int) etf->offset[1] << 8));
}
/* Verify the signature */
if (((fixup_ptr[0] == 0x1e && fixup_ptr[1] == 0x58)
|| (fixup_ptr[0] == 0x8c && fixup_ptr[1] == 0xd8))
&& fixup_ptr[2] == 0x90)
{
fixup_ptr[0] = 0xb8; /* MOV AX, */
fixup_ptr[1] = wpnt->hinstance;
fixup_ptr[2] = (wpnt->hinstance >> 8);
}
}
}
}
/*********************************************************************** /***********************************************************************
* GetSelectorBase (KERNEL.186) * GetSelectorBase (KERNEL.186)
*/ */
DWORD GetSelectorBase(WORD wSelector) DWORD GetSelectorBase(WORD wSelector)
{ {
fprintf(stderr, "GetSelectorBase(selector %4X) stub!\n", wSelector); fprintf(stdnimp, "GetSelectorBase(selector %4X) stub!\n", wSelector);
} }
/*********************************************************************** /***********************************************************************
@ -1073,7 +1066,7 @@ DWORD GetSelectorBase(WORD wSelector)
*/ */
void SetSelectorBase(WORD wSelector, DWORD dwBase) void SetSelectorBase(WORD wSelector, DWORD dwBase)
{ {
fprintf(stderr, "SetSelectorBase(selector %4X, base %8X) stub!\n", fprintf(stdnimp, "SetSelectorBase(selector %4X, base %8X) stub!\n",
wSelector, dwBase); wSelector, dwBase);
} }
@ -1082,7 +1075,7 @@ void SetSelectorBase(WORD wSelector, DWORD dwBase)
*/ */
DWORD GetSelectorLimit(WORD wSelector) DWORD GetSelectorLimit(WORD wSelector)
{ {
fprintf(stderr, "GetSelectorLimit(selector %4X) stub!\n", wSelector); fprintf(stdnimp, "GetSelectorLimit(selector %4X) stub!\n", wSelector);
return 0xffff; return 0xffff;
} }
@ -1092,7 +1085,7 @@ DWORD GetSelectorLimit(WORD wSelector)
*/ */
void SetSelectorLimit(WORD wSelector, DWORD dwLimit) void SetSelectorLimit(WORD wSelector, DWORD dwLimit)
{ {
fprintf(stderr, "SetSelectorLimit(selector %4X, base %8X) stub!\n", fprintf(stdnimp, "SetSelectorLimit(selector %4X, base %8X) stub!\n",
wSelector, dwLimit); wSelector, dwLimit);
} }

View file

@ -12,8 +12,10 @@
#include <syscall.h> #include <syscall.h>
#endif #endif
#ifdef linux #ifdef linux
#define inline __inline__ /* So we can compile with -ansi */
#include <linux/sched.h> #include <linux/sched.h>
#include <asm/system.h> #include <asm/system.h>
#undef inline
#endif #endif
#include "wine.h" #include "wine.h"
@ -21,6 +23,16 @@
#include "prototypes.h" #include "prototypes.h"
#include "win.h" #include "win.h"
extern int do_int10(struct sigcontext_struct *);
extern int do_int13(struct sigcontext_struct *);
extern int do_int15(struct sigcontext_struct *);
extern int do_int16(struct sigcontext_struct *);
extern int do_int25(struct sigcontext_struct *);
extern int do_int26(struct sigcontext_struct *);
extern int do_int2a(struct sigcontext_struct *);
extern int do_int2f(struct sigcontext_struct *);
extern int do_int31(struct sigcontext_struct *);
#if !defined(BSD4_4) || defined(linux) #if !defined(BSD4_4) || defined(linux)
char * cstack[4096]; char * cstack[4096];
#endif #endif
@ -90,8 +102,6 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
{ {
#endif #endif
unsigned char * instr; unsigned char * instr;
unsigned int * dump;
int i;
/* First take care of a few preliminaries */ /* First take care of a few preliminaries */
#ifdef linux #ifdef linux

View file

@ -3,9 +3,6 @@
*/ */
static char Copyright[] = "Copyright Martin Ayotte, 1994"; static char Copyright[] = "Copyright Martin Ayotte, 1994";
/*
#define DEBUG_TASK
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -15,6 +12,12 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "windows.h" #include "windows.h"
#include "wine.h" #include "wine.h"
#include "task.h" #include "task.h"
#include "debug.h"
/* #define DEBUG_TASK /* */
/* #undef DEBUG_TASK /* */
static LPWINETASKENTRY lpTaskList = NULL; static LPWINETASKENTRY lpTaskList = NULL;
static int nTaskCount = 0; static int nTaskCount = 0;
@ -27,7 +30,7 @@ HTASK GetCurrentTask()
LPWINETASKENTRY lpTask = lpTaskList; LPWINETASKENTRY lpTask = lpTaskList;
int pid = getpid(); int pid = getpid();
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("GetCurrentTask() // unix_pid=%08X !\n", pid); fprintf(stddeb,"GetCurrentTask() // unix_pid=%08X !\n", pid);
#endif #endif
if (lpTask == NULL) return 0; if (lpTask == NULL) return 0;
while (TRUE) { while (TRUE) {
@ -36,7 +39,7 @@ HTASK GetCurrentTask()
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
} }
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("GetCurrentTask() returned hTask=%04X !\n", lpTask->te.hTask); fprintf(stddeb,"GetCurrentTask() returned hTask=%04X !\n", lpTask->te.hTask);
#endif #endif
return lpTask->te.hTask; return lpTask->te.hTask;
} }
@ -47,7 +50,9 @@ HTASK GetCurrentTask()
*/ */
WORD GetNumTasks() WORD GetNumTasks()
{ {
printf("GetNumTasks() returned %d !\n", nTaskCount); #ifdef DEBUG_TASK
fprintf(stddeb,"GetNumTasks() returned %d !\n", nTaskCount);
#endif
return nTaskCount; return nTaskCount;
} }
@ -60,17 +65,23 @@ HTASK GetWindowTask(HWND hWnd)
HWND *wptr; HWND *wptr;
int count; int count;
LPWINETASKENTRY lpTask = lpTaskList; LPWINETASKENTRY lpTask = lpTaskList;
printf("GetWindowTask(%04X) !\n", hWnd); #ifdef DEBUG_TASK
fprintf(stddeb,"GetWindowTask(%04X) !\n", hWnd);
#endif
while (lpTask != NULL) { while (lpTask != NULL) {
wptr = lpTask->lpWndList; wptr = lpTask->lpWndList;
if (wptr != NULL) { if (wptr != NULL) {
count = 0; count = 0;
while (++count < MAXWIN_PER_TASK) { while (++count < MAXWIN_PER_TASK) {
printf("GetWindowTask // searching %04X %04X !\n", #ifdef DEBUG_TASK
fprintf(stddeb,"GetWindowTask // searching %04X %04X !\n",
lpTask->te.hTask, *(wptr)); lpTask->te.hTask, *(wptr));
#endif
if (*(wptr) == hWnd) { if (*(wptr) == hWnd) {
printf("GetWindowTask(%04X) found hTask=%04X !\n", #ifdef DEBUG_TASK
fprintf(stddeb,"GetWindowTask(%04X) found hTask=%04X !\n",
hWnd, lpTask->te.hTask); hWnd, lpTask->te.hTask);
#endif
return lpTask->te.hTask; return lpTask->te.hTask;
} }
wptr++; wptr++;
@ -91,22 +102,30 @@ BOOL EnumTaskWindows(HANDLE hTask, FARPROC lpEnumFunc, LONG lParam)
BOOL bRet; BOOL bRet;
int count = 0; int count = 0;
LPWINETASKENTRY lpTask = lpTaskList; LPWINETASKENTRY lpTask = lpTaskList;
printf("EnumTaskWindows(%04X, %08X, %08X) !\n", hTask, lpEnumFunc, lParam); #ifdef DEBUG_TASK
fprintf(stddeb,"EnumTaskWindows(%04X, %08X, %08X) !\n", hTask, lpEnumFunc, lParam);
#endif
while (TRUE) { while (TRUE) {
if (lpTask->te.hTask == hTask) break; if (lpTask->te.hTask == hTask) break;
if (lpTask == NULL) { if (lpTask == NULL) {
printf("EnumTaskWindows // hTask=%04X not found !\n", hTask); #ifdef DEBUG_TASK
fprintf(stddeb,"EnumTaskWindows // hTask=%04X not found !\n", hTask);
#endif
return FALSE; return FALSE;
} }
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
} }
printf("EnumTaskWindows // found hTask=%04X !\n", hTask); #ifdef DEBUG_TASK
fprintf(stddeb,"EnumTaskWindows // found hTask=%04X !\n", hTask);
#endif
wptr = lpTask->lpWndList; wptr = lpTask->lpWndList;
if (wptr == NULL) return FALSE; if (wptr == NULL) return FALSE;
if (lpEnumFunc == NULL) return FALSE; if (lpEnumFunc == NULL) return FALSE;
while ((hWnd = *(wptr++)) != 0) { while ((hWnd = *(wptr++)) != 0) {
if (++count >= MAXWIN_PER_TASK) return FALSE; if (++count >= MAXWIN_PER_TASK) return FALSE;
printf("EnumTaskWindows // hWnd=%04X count=%d !\n", hWnd, count); #ifdef DEBUG_TASK
fprintf(stddeb,"EnumTaskWindows // hWnd=%04X count=%d !\n", hWnd, count);
#endif
#ifdef WINELIB #ifdef WINELIB
bRet = (*lpEnumFunc)(hWnd, lParam); bRet = (*lpEnumFunc)(hWnd, lParam);
#else #else
@ -140,7 +159,7 @@ HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent)
hTask = GlobalAlloc(GMEM_MOVEABLE, sizeof(WINETASKENTRY)); hTask = GlobalAlloc(GMEM_MOVEABLE, sizeof(WINETASKENTRY));
lpNewTask = (LPWINETASKENTRY) GlobalLock(hTask); lpNewTask = (LPWINETASKENTRY) GlobalLock(hTask);
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("CreateNewTask entry allocated %08X\n", lpNewTask); fprintf(stddeb,"CreateNewTask entry allocated %08X\n", lpNewTask);
#endif #endif
if (lpNewTask == NULL) return 0; if (lpNewTask == NULL) return 0;
if (lpTaskList == NULL) { if (lpTaskList == NULL) {
@ -173,7 +192,7 @@ HANDLE CreateNewTask(HINSTANCE hInst, HTASK hTaskParent)
if (lpNewTask->lpWndList != NULL) if (lpNewTask->lpWndList != NULL)
memset((LPSTR)lpNewTask->lpWndList, 0, MAXWIN_PER_TASK * sizeof(HWND)); memset((LPSTR)lpNewTask->lpWndList, 0, MAXWIN_PER_TASK * sizeof(HWND));
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("CreateNewTask // unix_pid=%08X return hTask=%04X\n", fprintf(stddeb,"CreateNewTask // unix_pid=%08X return hTask=%04X\n",
lpNewTask->unix_pid, hTask); lpNewTask->unix_pid, hTask);
#endif #endif
GlobalUnlock(hTask); GlobalUnlock(hTask);
@ -191,12 +210,12 @@ BOOL AddWindowToTask(HTASK hTask, HWND hWnd)
int count = 0; int count = 0;
LPWINETASKENTRY lpTask = lpTaskList; LPWINETASKENTRY lpTask = lpTaskList;
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("AddWindowToTask(%04X, %04X); !\n", hTask, hWnd); fprintf(stddeb,"AddWindowToTask(%04X, %04X); !\n", hTask, hWnd);
#endif #endif
while (TRUE) { while (TRUE) {
if (lpTask->te.hTask == hTask) break; if (lpTask->te.hTask == hTask) break;
if (lpTask == NULL) { if (lpTask == NULL) {
printf("AddWindowToTask // hTask=%04X not found !\n", hTask); fprintf(stderr,"AddWindowToTask // hTask=%04X not found !\n", hTask);
return FALSE; return FALSE;
} }
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
@ -209,7 +228,7 @@ BOOL AddWindowToTask(HTASK hTask, HWND hWnd)
} }
*wptr = hWnd; *wptr = hWnd;
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("AddWindowToTask // window added, count=%d !\n", count); fprintf(stddeb,"AddWindowToTask // window added, count=%d !\n", count);
#endif #endif
return TRUE; return TRUE;
} }
@ -224,12 +243,12 @@ BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd)
int count = 0; int count = 0;
LPWINETASKENTRY lpTask = lpTaskList; LPWINETASKENTRY lpTask = lpTaskList;
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("RemoveWindowToTask(%04X, %04X); !\n", hTask, hWnd); fprintf(stddeb,"RemoveWindowToTask(%04X, %04X); !\n", hTask, hWnd);
#endif #endif
while (TRUE) { while (TRUE) {
if (lpTask->te.hTask == hTask) break; if (lpTask->te.hTask == hTask) break;
if (lpTask == NULL) { if (lpTask == NULL) {
printf("RemoveWindowFromTask // hTask=%04X not found !\n", hTask); fprintf(stderr,"RemoveWindowFromTask // hTask=%04X not found !\n", hTask);
return FALSE; return FALSE;
} }
lpTask = lpTask->lpNextTask; lpTask = lpTask->lpNextTask;
@ -246,15 +265,16 @@ BOOL RemoveWindowFromTask(HTASK hTask, HWND hWnd)
wptr++; wptr++;
} }
#ifdef DEBUG_TASK #ifdef DEBUG_TASK
printf("RemoveWindowFromTask // window removed, count=%d !\n", --count); fprintf(stddeb,"RemoveWindowFromTask // window removed, count=%d !\n", --count);
#endif #endif
return TRUE; return TRUE;
} }
BOOL TaskFirst(LPTASKENTRY lpTask) BOOL TaskFirst(LPTASKENTRY lpTask)
{ {
printf("TaskFirst(%8x)\n", (int) lpTask); #ifdef DEBUG_TASK
fprintf(stddeb,"TaskFirst(%8x)\n", (int) lpTask);
#endif
if (lpTaskList) { if (lpTaskList) {
memcpy(lpTask, &lpTaskList->te, lpTask->dwSize); memcpy(lpTask, &lpTaskList->te, lpTask->dwSize);
return TRUE; return TRUE;
@ -265,9 +285,9 @@ BOOL TaskFirst(LPTASKENTRY lpTask)
BOOL TaskNext(LPTASKENTRY lpTask) BOOL TaskNext(LPTASKENTRY lpTask)
{ {
LPWINETASKENTRY list; LPWINETASKENTRY list;
#ifdef DEBUG_TASK
printf("TaskNext(%8x)\n", (int) lpTask); fprintf(stddeb,"TaskNext(%8x)\n", (int) lpTask);
#endif
list = lpTaskList; list = lpTaskList;
while (list) { while (list) {
if (list->te.hTask == lpTask->hTask) { if (list->te.hTask == lpTask->hTask) {
@ -286,9 +306,9 @@ BOOL TaskNext(LPTASKENTRY lpTask)
BOOL TaskFindHandle(LPTASKENTRY lpTask, HTASK hTask) BOOL TaskFindHandle(LPTASKENTRY lpTask, HTASK hTask)
{ {
static LPWINETASKENTRY list; static LPWINETASKENTRY list;
#ifdef DEBUG_TASK
printf("TaskFindHandle(%8x,%4x)\n", (int) lpTask, hTask); fprintf(stddeb,"TaskFindHandle(%8x,%4x)\n", (int) lpTask, hTask);
#endif
list = lpTaskList; list = lpTaskList;
while (list) { while (list) {
if (list->te.hTask == hTask) { if (list->te.hTask == hTask) {

View file

@ -11,7 +11,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

View file

@ -1,7 +1,6 @@
static char RCSId[] = "$Id: global.c,v 1.2 1993/07/04 04:04:21 root Exp root $"; static char RCSId[] = "$Id: global.c,v 1.2 1993/07/04 04:04:21 root Exp root $";
static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
/* #define DEBUG_HEAP /* */
#define GLOBAL_SOURCE #define GLOBAL_SOURCE
#include <stdio.h> #include <stdio.h>
@ -11,6 +10,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "toolhelp.h" #include "toolhelp.h"
#include "heap.h" #include "heap.h"
#include "segmem.h" #include "segmem.h"
#include "stddebug.h"
/* #define DEBUG_HEAP /* */
/* #undef DEBUG_HEAP /* */
#include "debug.h"
GDESC *GlobalList = NULL; GDESC *GlobalList = NULL;
static unsigned short next_unused_handle = 1; static unsigned short next_unused_handle = 1;
@ -99,7 +103,7 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
s = CreateNewSegments(0, 0, 0x10000, n_segments); s = CreateNewSegments(0, 0, 0x10000, n_segments);
if (s == NULL) if (s == NULL)
{ {
printf("GlobalGetFreeSegments // bad CreateNewSegments !\n"); fprintf(stderr,"GlobalGetFreeSegments // bad CreateNewSegments !\n");
return NULL; return NULL;
} }
for (count = 0; count < n_segments; count++, s++) for (count = 0; count < n_segments; count++, s++)
@ -107,7 +111,7 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
g = (GDESC *) malloc(sizeof(*g)); g = (GDESC *) malloc(sizeof(*g));
if (g == NULL) if (g == NULL)
{ {
printf("GlobalGetFreeSegments // bad GDESC malloc !\n"); fprintf(stderr,"GlobalGetFreeSegments // bad GDESC malloc !\n");
return NULL; return NULL;
} }
g->prev = g_prev; g->prev = g_prev;
@ -145,7 +149,7 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
{ {
if (g == NULL) if (g == NULL)
{ {
printf("GlobalGetFreeSegments // bad Segments chain !\n"); fprintf(stderr,"GlobalGetFreeSegments // bad Segments chain !\n");
return NULL; return NULL;
} }
g->sequence = i + 1; g->sequence = i + 1;
@ -178,9 +182,9 @@ GlobalAlloc(unsigned int flags, unsigned long size)
GDESC *g_prev; GDESC *g_prev;
void *m; void *m;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"GlobalAlloc flags %4X, size %d\n", flags, size);
printf("GlobalAlloc flags %4X, size %d\n", flags, size);
#endif if (size == 0) size = 1;
/* /*
* If this block is fixed or very big we need to allocate entire * If this block is fixed or very big we need to allocate entire
@ -243,9 +247,7 @@ GlobalAlloc(unsigned int flags, unsigned long size)
* We have a new block. Let's create a GDESC entry for it. * We have a new block. Let's create a GDESC entry for it.
*/ */
g = malloc(sizeof(*g)); g = malloc(sizeof(*g));
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"New GDESC %08x\n", g);
printf("New GDESC %08x\n", g);
#endif
if (g == NULL) if (g == NULL)
return 0; return 0;
@ -268,9 +270,7 @@ GlobalAlloc(unsigned int flags, unsigned long size)
if ((next_unused_handle & 7) == 7) if ((next_unused_handle & 7) == 7)
next_unused_handle++; next_unused_handle++;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"GlobalAlloc: returning %04x\n", g->handle);
printf("GlobalAlloc: returning %04x\n", g->handle);
#endif
return g->handle; return g->handle;
} }
} }
@ -344,9 +344,7 @@ GlobalLock(unsigned int block)
g->lock_count++; g->lock_count++;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"GlobalLock: returning %08x\n", g->addr);
printf("GlobalLock: returning %08x\n", g->addr);
#endif
return g->addr; return g->addr;
} }
@ -805,7 +803,7 @@ DWORD GetFreeSpace(UINT wFlags)
if (free_map[i] == 1) if (free_map[i] == 1)
total_free++; total_free++;
printf("GetFreeSpace // return %ld !\n", total_free << 16); dprintf_heap(stddeb,"GetFreeSpace // return %ld !\n", total_free << 16);
return total_free << 16; return total_free << 16;
} }
@ -816,3 +814,12 @@ BOOL MemManInfo(LPMEMMANINFO lpmmi)
{ {
return 1; return 1;
} }
/***********************************************************************
* SetSwapAreaSize (KERNEL.106)
*/
LONG SetSwapAreaSize( WORD size )
{
printf( "STUB: SetSwapAreaSize(%d)\n", size );
return MAKELONG( size, 0xffff );
}

View file

@ -8,8 +8,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "segmem.h" #include "segmem.h"
#include "heap.h" #include "heap.h"
#include "regfunc.h" #include "regfunc.h"
#include "stddebug.h"
/* #define DEBUG_HEAP /* */ /* #define DEBUG_HEAP /* */
/* #undef DEBUG_HEAP /* */
#include "debug.h"
LHEAP *LocalHeaps = NULL; LHEAP *LocalHeaps = NULL;
@ -46,9 +49,9 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
{ {
MDESC *m, *m_new; MDESC *m, *m_new;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"HeapAlloc: free_list %08x, flags %x, bytes %d\n",
printf("HeapAlloc: free_list %08x, flags %x, bytes %d\n",
free_list, flags, bytes); free_list, flags, bytes);
#ifdef DEBUG_HEAP
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif #endif
@ -83,8 +86,8 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
m->flags = 0; m->flags = 0;
if (flags & GLOBAL_FLAGS_ZEROINIT) if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m + 1, 0, bytes); memset(m + 1, 0, bytes);
dprintf_heap(stddeb,"HeapAlloc: returning %08x\n", (m + 1));
#ifdef DEBUG_HEAP #ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", (m + 1));
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif #endif
return (void *) (m + 1); return (void *) (m + 1);
@ -107,15 +110,15 @@ HEAP_Alloc(MDESC **free_list, int flags, int bytes)
m->flags = 0; m->flags = 0;
if (flags & GLOBAL_FLAGS_ZEROINIT) if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m + 1, 0, bytes); memset(m + 1, 0, bytes);
dprintf_heap(stddeb,"HeapAlloc: returning %08x\n", (m + 1));
#ifdef DEBUG_HEAP #ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", (m + 1));
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif #endif
return (void *) (m + 1); return (void *) (m + 1);
} }
dprintf_heap(stddeb,"HeapAlloc: returning %08x\n", 0);
#ifdef DEBUG_HEAP #ifdef DEBUG_HEAP
printf("HeapAlloc: returning %08x\n", 0);
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif #endif
return 0; return 0;
@ -140,40 +143,36 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
*/ */
m = (MDESC *) old_block - 1; m = (MDESC *) old_block - 1;
dprintf_heap(stddeb,"HEAP_ReAlloc new_size=%d !\n", new_size);
dprintf_heap(stddeb,"HEAP_ReAlloc old_block=%08X !\n", old_block);
dprintf_heap(stddeb,"HEAP_ReAlloc m=%08X free_list=%08X !\n", m,free_list);
dprintf_heap(stddeb,"HEAP_ReAlloc m->prev=%08X !\n", m->prev);
dprintf_heap(stddeb,"HEAP_ReAlloc m->next=%08X !\n", m->next);
dprintf_heap(stddeb,"HEAP_ReAlloc *free_list=%08X !\n", *free_list);
#ifdef DEBUG_HEAP #ifdef DEBUG_HEAP
printf("HEAP_ReAlloc new_size=%d !\n", new_size);
printf("HEAP_ReAlloc old_block=%08X !\n", old_block);
printf("HEAP_ReAlloc m=%08X free_list=%08X !\n", m, free_list);
printf("HEAP_ReAlloc m->prev=%08X !\n", m->prev);
printf("HEAP_ReAlloc m->next=%08X !\n", m->next);
printf("HEAP_ReAlloc *free_list=%08X !\n", *free_list);
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif #endif
if (m->prev != m || m->next != m || if (m->prev != m || m->next != m ||
((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000)) ((int) m & 0xffff0000) != ((int) *free_list & 0xffff0000))
{ {
#ifdef DEBUG_HEAP fprintf(stderr,"Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
printf("Attempt to resize bad pointer, m = %08x, *free_list = %08x\n",
m, free_list); m, free_list);
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif
return NULL; return NULL;
} }
/* /*
* Check for grow block * Check for grow block
*/ */
#ifdef DEBUG_HEAP
printf("HEAP_ReAlloc Check for grow block !\n");
#endif
dprintf_heap(stddeb,"HEAP_ReAlloc Check for grow block !\n");
if (new_size > m->length) if (new_size > m->length)
{ {
m_free = m + 1 + m->length / sizeof(MDESC); m_free = m + 1 + m->length / sizeof(MDESC);
if (m_free->next == m_free || if (m_free->next == m_free ||
m_free->prev == m_free || m_free->prev == m_free ||
m_free->length + sizeof(MDESC) < new_size) m_free->length + 2*sizeof(MDESC) < new_size - m->length)
{ {
void *new_p = HEAP_Alloc(free_list, flags, new_size); void *new_p = HEAP_Alloc(free_list, flags, new_size);
if (new_p ==NULL) if (new_p ==NULL)
@ -196,9 +195,7 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
m->length += sizeof(MDESC) + m_free->length; m->length += sizeof(MDESC) + m_free->length;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"HEAP_ReAlloc before GLOBAL_FLAGS_ZEROINIT !\n");
printf("HEAP_ReAlloc before GLOBAL_FLAGS_ZEROINIT !\n");
#endif
if (flags & GLOBAL_FLAGS_ZEROINIT) if (flags & GLOBAL_FLAGS_ZEROINIT)
memset(m_free, '\0', sizeof(MDESC) + m_free->length); memset(m_free, '\0', sizeof(MDESC) + m_free->length);
} }
@ -206,15 +203,13 @@ HEAP_ReAlloc(MDESC **free_list, void *old_block,
/* /*
* Check for shrink block. * Check for shrink block.
*/ */
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"HEAP_ReAlloc Check for shrink block !\n");
printf("HEAP_ReAlloc Check for shrink block !\n"); if (new_size + 4*sizeof(MDESC) < m->length)
#endif
if (new_size < m->length - 4 * sizeof(MDESC))
{ {
m_free = m + new_size / sizeof(MDESC) + 2; m_free = m + new_size / sizeof(MDESC) + 2;
m_free->next = m_free; m_free->next = m_free;
m_free->prev = m_free; m_free->prev = m_free;
m_free->length = m->length - (int) m_free - (int) m; m_free->length = m->length - ((int) m_free - (int) m);
m->length = (int) m_free - (int) (m + 1); m->length = (int) m_free - (int) (m + 1);
HEAP_Free(free_list, m_free + 1); HEAP_Free(free_list, m_free + 1);
} }
@ -236,9 +231,9 @@ HEAP_Free(MDESC **free_list, void *block)
MDESC *m; MDESC *m;
MDESC *m_prev; MDESC *m_prev;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"HeapFree: free_list %08x, block %08x\n",
printf("HeapFree: free_list %08x, block %08x\n",
free_list, block); free_list, block);
#ifdef DEBUG_HEAP
HEAP_CheckHeap(free_list); HEAP_CheckHeap(free_list);
#endif #endif
@ -248,11 +243,9 @@ HEAP_Free(MDESC **free_list, void *block)
m_free = (MDESC *) block - 1; m_free = (MDESC *) block - 1;
if (m_free->prev != m_free || m_free->next != m_free) if (m_free->prev != m_free || m_free->next != m_free)
{ {
#ifdef DEBUG_HEAP fprintf(stderr,"Attempt to free bad pointer,"
printf("Attempt to free bad pointer,"
"m_free = %08x, *free_list = %08x\n", "m_free = %08x, *free_list = %08x\n",
m_free, free_list); m_free, free_list);
#endif
return -1; return -1;
} }
@ -265,11 +258,9 @@ HEAP_Free(MDESC **free_list, void *block)
} }
else if (((int) m_free & 0xffff0000) != ((int) *free_list & 0xffff0000)) else if (((int) m_free & 0xffff0000) != ((int) *free_list & 0xffff0000))
{ {
#ifdef DEBUG_HEAP fprintf(stderr,"Attempt to free bad pointer,"
printf("Attempt to free bad pointer,"
"m_free = %08x, *free_list = %08x\n", "m_free = %08x, *free_list = %08x\n",
m_free, free_list); m_free, free_list);
#endif
return -1; return -1;
} }
@ -282,22 +273,18 @@ HEAP_Free(MDESC **free_list, void *block)
if (m_prev != NULL && (int) m_prev + m_prev->length > (int) m_free) if (m_prev != NULL && (int) m_prev + m_prev->length > (int) m_free)
{ {
#ifdef DEBUG_HEAP fprintf(stderr,"Attempt to free bad pointer,"
printf("Attempt to free bad pointer,"
"m_free = %08x, m_prev = %08x (length %x)\n", "m_free = %08x, m_prev = %08x (length %x)\n",
m_free, m_prev, m_prev->length); m_free, m_prev, m_prev->length);
#endif
return -1; return -1;
} }
if ((m != NULL && (int) m_free + m_free->length > (int) m) || if ((m != NULL && (int) m_free + m_free->length > (int) m) ||
(int) m_free + m_free->length > ((int) m_free | 0xffff)) (int) m_free + m_free->length > ((int) m_free | 0xffff))
{ {
#ifdef DEBUG_HEAP fprintf(stderr,"Attempt to free bad pointer,"
printf("Attempt to free bad pointer,"
"m_free = %08x (length %x), m = %08x\n", "m_free = %08x (length %x), m = %08x\n",
m_free, m_free->length, m); m_free, m_free->length, m);
#endif
return -1; return -1;
} }
@ -359,9 +346,7 @@ HEAP_LocalFindHeap(unsigned short owner)
{ {
LHEAP *lh; LHEAP *lh;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"HEAP_LocalFindHeap: owner %04x\n", owner);
printf("HEAP_LocalFindHeap: owner %04x\n", owner);
#endif
for (lh = LocalHeaps; lh != NULL; lh = lh->next) for (lh = LocalHeaps; lh != NULL; lh = lh->next)
{ {
@ -380,10 +365,8 @@ HEAP_LocalInit(unsigned short owner, void *start, int length)
{ {
LHEAP *lh; LHEAP *lh;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"HEAP_LocalInit: owner %04x, start %08x, length %04x\n"
printf("HEAP_LocalInit: owner %04x, start %08x, length %04x\n", ,owner, start, length);
owner, start, length);
#endif
if (length < 2 * sizeof(MDESC)) if (length < 2 * sizeof(MDESC))
return; return;
@ -424,16 +407,12 @@ WIN16_LocalAlloc(int flags, int bytes)
{ {
void *m; void *m;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"WIN16_LocalAlloc: flags %x, bytes %d\n", flags,bytes);
printf("WIN16_LocalAlloc: flags %x, bytes %d\n", flags, bytes); dprintf_heap(stddeb," called from segment %04x\n", Stack16Frame[11]);
printf(" called from segment %04x\n", Stack16Frame[11]);
#endif
m = HEAP_Alloc(LOCALHEAP(), flags, bytes); m = HEAP_Alloc(LOCALHEAP(), flags, bytes);
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"WIN16_LocalAlloc: returning %x\n", (int) m);
printf("WIN16_LocalAlloc: returning %x\n", (int) m);
#endif
return m; return m;
} }
@ -510,7 +489,7 @@ WIN16_LocalInit(unsigned int segment, unsigned int start, unsigned int end)
HEAP_Init(&lh->free_list, HEAP_Init(&lh->free_list,
(void *) ((segment << 16) | start), end - start + 1); (void *) ((segment << 16) | start), end - start + 1);
} }
printf("WIN16_LocalInit // return segment=%04X !\n", segment); dprintf_heap(stddeb,"WIN16_LocalInit // return segment=%04X !\n", segment);
return segment; return segment;
} }
@ -538,11 +517,12 @@ void *
WIN16_LocalReAlloc(unsigned int handle, int bytes, int flags) WIN16_LocalReAlloc(unsigned int handle, int bytes, int flags)
{ {
void *m; void *m;
#ifdef DEBUG_HEAP dprintf_heap(stddeb,"WIN16_LocalReAlloc(%04X, %d, %04X); !\n",
printf("WIN16_LocalReAlloc(%04X, %d, %04X); !\n", handle, bytes, flags); handle, bytes, flags);
printf("WIN16_LocalReAlloc // LOCALHEAP()=%08X !\n", LOCALHEAP()); dprintf_heap(stddeb,"WIN16_LocalReAlloc // LOCALHEAP()=%08X !\n",
printf("WIN16_LocalReAlloc // *LOCALHEAP()=%08X !\n", *LOCALHEAP()); LOCALHEAP());
#endif dprintf_heap(stddeb,"WIN16_LocalReAlloc // *LOCALHEAP()=%08X !\n",
*LOCALHEAP());
m = HEAP_ReAlloc(LOCALHEAP(), (void *) m = HEAP_ReAlloc(LOCALHEAP(), (void *)
(((int) *LOCALHEAP() & 0xffff0000) | (handle & 0xffff)), (((int) *LOCALHEAP() & 0xffff0000) | (handle & 0xffff)),
bytes, flags); bytes, flags);
@ -619,9 +599,7 @@ WORD GetFreeSystemResources(WORD SystemResourceType)
unsigned int UserFree=0,UserResult=0; unsigned int UserFree=0,UserResult=0;
unsigned int result=0; unsigned int result=0;
MDESC *m; MDESC *m;
dprintf_heap(stddeb,"GetFreeSystemResources(%u)\n",SystemResourceType);
printf("GetFreeSystemResources(%u)\n",SystemResourceType);
switch(SystemResourceType) { switch(SystemResourceType) {
case(USERRESOURCES): case(USERRESOURCES):
for (m = USER_Heap; m != NULL; m = m->next) /* add up free area in heap */ for (m = USER_Heap; m != NULL; m = m->next) /* add up free area in heap */

View file

@ -7,7 +7,6 @@ SRCS = \
atom.c \ atom.c \
clipboard.c \ clipboard.c \
comm.c \ comm.c \
cursor.c \
dos_fs.c \ dos_fs.c \
driver.c \ driver.c \
exec.c \ exec.c \
@ -35,7 +34,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

File diff suppressed because it is too large Load diff

View file

@ -6,10 +6,6 @@
static char Copyright[] = "Copyright Martin Ayotte, 1994"; static char Copyright[] = "Copyright Martin Ayotte, 1994";
/*
#define DEBUG_CLIPBOARD
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
@ -20,6 +16,10 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "prototypes.h" #include "prototypes.h"
#include "heap.h" #include "heap.h"
#include "win.h" #include "win.h"
#include "stddebug.h"
/* #define DEBUG_CLIPBOARD /* */
/* #undef DEBUG_CLIPBOARD /* */
#include "debug.h"
typedef struct tagCLIPFORMAT { typedef struct tagCLIPFORMAT {
WORD wFormatID; WORD wFormatID;
@ -58,9 +58,7 @@ BOOL OpenClipboard(HWND hWnd)
{ {
if (hWndClipboardOwner != 0) return FALSE; if (hWndClipboardOwner != 0) return FALSE;
hWndClipboardOwner = hWnd; hWndClipboardOwner = hWnd;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"OpenClipboard(%04X); !\n", hWnd);
printf("OpenClipboard(%04X); !\n", hWnd);
#endif
return TRUE; return TRUE;
} }
@ -72,9 +70,7 @@ BOOL CloseClipboard()
{ {
if (hWndClipboardOwner == 0) return FALSE; if (hWndClipboardOwner == 0) return FALSE;
hWndClipboardOwner = 0; hWndClipboardOwner = 0;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"CloseClipboard(); !\n");
printf("CloseClipboard(); !\n");
#endif
return TRUE; return TRUE;
} }
@ -86,9 +82,7 @@ BOOL EmptyClipboard()
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
if (hWndClipboardOwner == 0) return FALSE; if (hWndClipboardOwner == 0) return FALSE;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"EmptyClipboard(); !\n");
printf("EmptyClipboard(); !\n");
#endif
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) break; if (lpFormat == NULL) break;
if (lpFormat->hData != 0) { if (lpFormat->hData != 0) {
@ -106,9 +100,8 @@ BOOL EmptyClipboard()
*/ */
HWND GetClipboardOwner() HWND GetClipboardOwner()
{ {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("GetClipboardOwner() = %04X !\n", hWndClipboardOwner); "GetClipboardOwner() = %04X !\n", hWndClipboardOwner);
#endif
return hWndClipboardOwner; return hWndClipboardOwner;
} }
@ -119,9 +112,8 @@ HWND GetClipboardOwner()
HANDLE SetClipboardData(WORD wFormat, HANDLE hData) HANDLE SetClipboardData(WORD wFormat, HANDLE hData)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("SetClipboardDate(%04X, %04X) !\n", wFormat, hData); "SetClipboardDate(%04X, %04X) !\n", wFormat, hData);
#endif
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
@ -139,9 +131,7 @@ HANDLE SetClipboardData(WORD wFormat, HANDLE hData)
HANDLE GetClipboardData(WORD wFormat) HANDLE GetClipboardData(WORD wFormat)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"GetClipboardData(%04X) !\n", wFormat);
printf("GetClipboardData(%04X) !\n", wFormat);
#endif
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
@ -161,17 +151,14 @@ int CountClipboardFormats()
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) break; if (lpFormat == NULL) break;
if (lpFormat->hData != 0) { if (lpFormat->hData != 0) {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("CountClipboardFormats // Find Not Empty (%04X) !\n", "CountClipboardFormats // Find Not Empty (%04X) !\n",
lpFormat->hData); lpFormat->hData);
#endif
FormatCount++; FormatCount++;
} }
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"CountClipboardFormats() = %d !\n", FormatCount);
printf("CountClipboardFormats() = %d !\n", FormatCount);
#endif
return FormatCount; return FormatCount;
} }
@ -182,9 +169,7 @@ int CountClipboardFormats()
WORD EnumClipboardFormats(WORD wFormat) WORD EnumClipboardFormats(WORD wFormat)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"EnumClipboardFormats(%04X) !\n", wFormat);
printf("EnumClipboardFormats(%04X) !\n", wFormat);
#endif
if (wFormat == 0) { if (wFormat == 0) {
if (lpFormat->hData != 0) if (lpFormat->hData != 0)
return lpFormat->wFormatID; return lpFormat->wFormatID;
@ -196,20 +181,17 @@ WORD EnumClipboardFormats(WORD wFormat)
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"EnumClipboardFormats // Find Last (%04X) !\n",
printf("EnumClipboardFormats // Find Last (%04X) !\n",
lpFormat->wFormatID); lpFormat->wFormatID);
#endif
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->hData != 0) break; if (lpFormat->hData != 0) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("EnumClipboardFormats // Find Not Empty Id=%04X hData=%04X !\n", "EnumClipboardFormats // Find Not Empty Id=%04X hData=%04X !\n",
lpFormat->wFormatID, lpFormat->hData); lpFormat->wFormatID, lpFormat->hData);
#endif
return lpFormat->wFormatID; return lpFormat->wFormatID;
} }
@ -229,9 +211,7 @@ WORD RegisterClipboardFormat(LPCSTR FormatName)
lpNewFormat = (LPCLIPFORMAT)malloc(sizeof(CLIPFORMAT)); lpNewFormat = (LPCLIPFORMAT)malloc(sizeof(CLIPFORMAT));
if (lpNewFormat == NULL) return 0; if (lpNewFormat == NULL) return 0;
lpFormat->NextFormat = lpNewFormat; lpFormat->NextFormat = lpNewFormat;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"RegisterClipboardFormat('%s') !\n", FormatName);
printf("RegisterClipboardFormat('%s') !\n", FormatName);
#endif
lpNewFormat->wFormatID = LastRegFormat; lpNewFormat->wFormatID = LastRegFormat;
lpNewFormat->wRefCount = 1; lpNewFormat->wRefCount = 1;
lpNewFormat->Name = (LPSTR)malloc(strlen(FormatName) + 1); lpNewFormat->Name = (LPSTR)malloc(strlen(FormatName) + 1);
@ -254,20 +234,18 @@ WORD RegisterClipboardFormat(LPCSTR FormatName)
int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen) int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("GetClipboardFormat(%04X, %08X, %d) !\n", wFormat, retStr, maxlen); "GetClipboardFormat(%04X, %08X, %d) !\n", wFormat, retStr, maxlen);
#endif
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return 0; if (lpFormat == NULL) return 0;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
lpFormat = lpFormat->NextFormat; lpFormat = lpFormat->NextFormat;
} }
if (lpFormat->Name == NULL) return 0; if (lpFormat->Name == NULL) return 0;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("GetClipboardFormat // Name='%s' !\n", lpFormat->Name); "GetClipboardFormat // Name='%s' !\n", lpFormat->Name);
#endif
maxlen = min(maxlen - 1, strlen(lpFormat->Name)); maxlen = min(maxlen - 1, strlen(lpFormat->Name));
printf("GetClipboardFormat // maxlen=%d !\n", maxlen); dprintf_clipboard(stddeb,"GetClipboardFormat // maxlen=%d !\n", maxlen);
memcpy(retStr, lpFormat->Name, maxlen); memcpy(retStr, lpFormat->Name, maxlen);
retStr[maxlen] = 0; retStr[maxlen] = 0;
return maxlen; return maxlen;
@ -279,9 +257,7 @@ int GetClipboardFormatName(WORD wFormat, LPSTR retStr, short maxlen)
*/ */
HWND SetClipboardViewer(HWND hWnd) HWND SetClipboardViewer(HWND hWnd)
{ {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"SetClipboardFormat(%04X) !\n", hWnd);
printf("SetClipboardFormat(%04X) !\n", hWnd);
#endif
hWndViewer = hWnd; hWndViewer = hWnd;
} }
@ -291,9 +267,8 @@ HWND SetClipboardViewer(HWND hWnd)
*/ */
HWND GetClipboardViewer() HWND GetClipboardViewer()
{ {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"GetClipboardFormat() = %04X !\n", hWndViewer);
printf("GetClipboardFormat() = %04X !\n", hWndViewer); return hWndViewer;
#endif
} }
@ -302,9 +277,8 @@ HWND GetClipboardViewer()
*/ */
BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext) BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext)
{ {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stdnimp,
printf("ChangeClipboardChain(%04X, %04X) !\n", hWnd, hWndNext); "ChangeClipboardChain(%04X, %04X) !\n", hWnd, hWndNext);
#endif
} }
@ -314,9 +288,7 @@ BOOL ChangeClipboardChain(HWND hWnd, HWND hWndNext)
BOOL IsClipboardFormatAvailable(WORD wFormat) BOOL IsClipboardFormatAvailable(WORD wFormat)
{ {
LPCLIPFORMAT lpFormat = ClipFormats; LPCLIPFORMAT lpFormat = ClipFormats;
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,"IsClipboardFormatAvailable(%04X) !\n", wFormat);
printf("IsClipboardFormatAvailable(%04X) !\n", wFormat);
#endif
while(TRUE) { while(TRUE) {
if (lpFormat == NULL) return FALSE; if (lpFormat == NULL) return FALSE;
if (lpFormat->wFormatID == wFormat) break; if (lpFormat->wFormatID == wFormat) break;
@ -331,9 +303,8 @@ BOOL IsClipboardFormatAvailable(WORD wFormat)
*/ */
HWND GetOpenClipboardWindow() HWND GetOpenClipboardWindow()
{ {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stddeb,
printf("GetOpenClipboardWindow() = %04X !\n", hWndClipboardOwner); "GetOpenClipboardWindow() = %04X !\n", hWndClipboardOwner);
#endif
return hWndClipboardOwner; return hWndClipboardOwner;
} }
@ -343,9 +314,8 @@ HWND GetOpenClipboardWindow()
*/ */
int GetPriorityClipboardFormat(WORD FAR *lpPriorityList, short nCount) int GetPriorityClipboardFormat(WORD FAR *lpPriorityList, short nCount)
{ {
#ifdef DEBUG_CLIPBOARD dprintf_clipboard(stdnimp,
printf("GetPriorityClipboardFormat(%08X, %d) !\n", lpPriorityList, nCount); "GetPriorityClipboardFormat(%08X, %d) !\n", lpPriorityList, nCount);
#endif
} }

View file

@ -19,8 +19,10 @@
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#include "comm.h" #include "comm.h"
#include "stddebug.h"
/* #define DEBUG_COMM /* */ /* #define DEBUG_COMM /* */
/* #undef DEBUG_COMM /* */
#include "debug.h"
int commerror = 0, eventmask = 0; int commerror = 0, eventmask = 0;
@ -141,9 +143,8 @@ int BuildCommDCB(LPSTR device, DCB FAR *lpdcb)
int port; int port;
char *ptr, temp[256]; char *ptr, temp[256];
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb); "BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb);
#endif
commerror = 0; commerror = 0;
if (!strncasecmp(device,"COM",3)) { if (!strncasecmp(device,"COM",3)) {
@ -174,14 +175,14 @@ fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb);
strcpy(temp,device+5); strcpy(temp,device+5);
ptr = strtok(temp, ","); ptr = strtok(temp, ",");
fprintf(stderr,"BuildCommDCB: baudrate (%s)\n", ptr); dprintf_comm(stddeb,"BuildCommDCB: baudrate (%s)\n", ptr);
lpdcb->BaudRate = atoi(ptr); lpdcb->BaudRate = atoi(ptr);
ptr = strtok(NULL, ","); ptr = strtok(NULL, ",");
if (islower(*ptr)) if (islower(*ptr))
*ptr = toupper(*ptr); *ptr = toupper(*ptr);
fprintf(stderr,"BuildCommDCB: parity (%c)\n", *ptr); dprintf_comm(stddeb,"BuildCommDCB: parity (%c)\n", *ptr);
switch (*ptr) { switch (*ptr) {
case 'N': case 'N':
lpdcb->Parity = NOPARITY; lpdcb->Parity = NOPARITY;
@ -205,11 +206,11 @@ fprintf(stderr,"BuildCommDCB: (%s), ptr %d\n", device, (long) lpdcb);
} }
ptr = strtok(NULL, ","); ptr = strtok(NULL, ",");
fprintf(stderr, "BuildCommDCB: charsize (%c)\n", *ptr); dprintf_comm(stddeb, "BuildCommDCB: charsize (%c)\n", *ptr);
lpdcb->ByteSize = *ptr - '0'; lpdcb->ByteSize = *ptr - '0';
ptr = strtok(NULL, ","); ptr = strtok(NULL, ",");
fprintf(stderr, "BuildCommDCB: stopbits (%c)\n", *ptr); dprintf_comm(stddeb, "BuildCommDCB: stopbits (%c)\n", *ptr);
switch (*ptr) { switch (*ptr) {
case '1': case '1':
lpdcb->StopBits = ONESTOPBIT; lpdcb->StopBits = ONESTOPBIT;
@ -230,10 +231,8 @@ int OpenComm(LPSTR device, UINT cbInQueue, UINT cbOutQueue)
{ {
int port, fd; int port, fd;
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue); "OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
#endif
commerror = 0; commerror = 0;
if (!strncasecmp(device,"COM",3)) { if (!strncasecmp(device,"COM",3)) {
@ -288,10 +287,7 @@ fprintf(stderr,"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
int CloseComm(int fd) int CloseComm(int fd)
{ {
#ifdef DEBUG_COMM dprintf_comm(stddeb,"CloseComm: fd %d\n", fd);
fprintf(stderr,"CloseComm: fd %d\n", fd);
#endif
if (close(fd) == -1) { if (close(fd) == -1) {
commerror = WinError(); commerror = WinError();
return -1; return -1;
@ -305,10 +301,7 @@ int SetCommBreak(int fd)
{ {
struct DosDeviceStruct *ptr; struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM dprintf_comm(stddeb,"SetCommBreak: fd: %d\n", fd);
fprintf(stderr,"SetCommBreak: fd: %d\n", fd);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) { if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
@ -323,10 +316,7 @@ int ClearCommBreak(int fd)
{ {
struct DosDeviceStruct *ptr; struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM dprintf_comm(stddeb,"ClearCommBreak: fd: %d\n", fd);
fprintf(stderr,"ClearCommBreak: fd: %d\n", fd);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) { if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
@ -342,10 +332,8 @@ LONG EscapeCommFunction(int fd, int nFunction)
int max; int max;
struct termios port; struct termios port;
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"EscapeCommFunction fd: %d, function: %d\n", fd, nFunction); "EscapeCommFunction fd: %d, function: %d\n", fd, nFunction);
#endif
if (tcgetattr(fd, &port) == -1) { if (tcgetattr(fd, &port) == -1) {
commerror = WinError(); commerror = WinError();
return -1; return -1;
@ -392,7 +380,9 @@ fprintf(stderr,"EscapeCommFunction fd: %d, function: %d\n", fd, nFunction);
break; break;
default: default:
fprintf(stderr,"EscapeCommFunction fd: %d, unknown function: %d\n", fd, nFunction); fprintf(stderr,
"EscapeCommFunction fd: %d, unknown function: %d\n",
fd, nFunction);
break; break;
} }
@ -409,10 +399,7 @@ int FlushComm(int fd, int fnQueue)
{ {
int queue; int queue;
#ifdef DEBUG_COMM dprintf_comm(stddeb,"FlushComm fd: %d, queue: %d\n", fd, fnQueue);
fprintf(stderr,"FlushComm fd: %d, queue: %d\n", fd, fnQueue);
#endif
switch (fnQueue) { switch (fnQueue) {
case 0: case 0:
queue = TCOFLUSH; queue = TCOFLUSH;
@ -421,7 +408,9 @@ fprintf(stderr,"FlushComm fd: %d, queue: %d\n", fd, fnQueue);
queue = TCIFLUSH; queue = TCIFLUSH;
break; break;
default: default:
fprintf(stderr,"FlushComm fd: %d, UNKNOWN queue: %d\n", fd, fnQueue); fprintf(stderr,
"FlushComm fd: %d, UNKNOWN queue: %d\n",
fd, fnQueue);
return -1; return -1;
} }
@ -436,28 +425,23 @@ fprintf(stderr,"FlushComm fd: %d, queue: %d\n", fd, fnQueue);
int GetCommError(int fd, COMSTAT FAR *lpStat) int GetCommError(int fd, COMSTAT FAR *lpStat)
{ {
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"GetCommError: fd %d (current error %d)\n", fd, commerror); "GetCommError: fd %d (current error %d)\n", fd, commerror);
#endif
return(commerror); return(commerror);
} }
UINT FAR* SetCommEventMask(int fd, UINT fuEvtMask) UINT FAR* SetCommEventMask(int fd, UINT fuEvtMask)
{ {
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"SetCommEventMask: fd %d, mask %d\n", fd, fuEvtMask); "SetCommEventMask: fd %d, mask %d\n", fd, fuEvtMask);
#endif
eventmask |= fuEvtMask; eventmask |= fuEvtMask;
return (UINT *)&eventmask; return (UINT *)&eventmask;
} }
UINT GetCommEventMask(int fd, int fnEvtClear) UINT GetCommEventMask(int fd, int fnEvtClear)
{ {
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"GetCommEventMask: fd %d, mask %d\n", fd, fnEvtClear); "GetCommEventMask: fd %d, mask %d\n", fd, fnEvtClear);
#endif
eventmask &= ~fnEvtClear; eventmask &= ~fnEvtClear;
return eventmask; return eventmask;
} }
@ -466,10 +450,8 @@ int SetCommState(DCB FAR *lpdcb)
{ {
struct termios port; struct termios port;
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb); "SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb);
#endif
if (tcgetattr(lpdcb->Id, &port) == -1) { if (tcgetattr(lpdcb->Id, &port) == -1) {
commerror = WinError(); commerror = WinError();
return -1; return -1;
@ -489,7 +471,7 @@ fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb);
port.c_lflag &= ~(ICANON|ECHO|ISIG); port.c_lflag &= ~(ICANON|ECHO|ISIG);
port.c_lflag |= NOFLSH; port.c_lflag |= NOFLSH;
fprintf(stderr,"SetCommState: baudrate %d\n",lpdcb->BaudRate); dprintf_comm(stddeb,"SetCommState: baudrate %d\n",lpdcb->BaudRate);
#ifdef CBAUD #ifdef CBAUD
port.c_cflag &= ~CBAUD; port.c_cflag &= ~CBAUD;
switch (lpdcb->BaudRate) { switch (lpdcb->BaudRate) {
@ -577,7 +559,7 @@ fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb);
} }
port.c_ispeed = port.c_ospeed; port.c_ispeed = port.c_ospeed;
#endif #endif
fprintf(stderr,"SetCommState: bytesize %d\n",lpdcb->ByteSize); dprintf_comm(stddeb,"SetCommState: bytesize %d\n",lpdcb->ByteSize);
port.c_cflag &= ~CSIZE; port.c_cflag &= ~CSIZE;
switch (lpdcb->ByteSize) { switch (lpdcb->ByteSize) {
case 5: case 5:
@ -597,7 +579,7 @@ fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb);
return -1; return -1;
} }
fprintf(stderr,"SetCommState: parity %d\n",lpdcb->Parity); dprintf_comm(stddeb,"SetCommState: parity %d\n",lpdcb->Parity);
port.c_cflag &= ~(PARENB | PARODD); port.c_cflag &= ~(PARENB | PARODD);
if (lpdcb->fParity) if (lpdcb->fParity)
switch (lpdcb->Parity) { switch (lpdcb->Parity) {
@ -618,7 +600,7 @@ fprintf(stderr,"SetCommState: fd %d, ptr %d\n", lpdcb->Id, (long) lpdcb);
} }
fprintf(stderr,"SetCommState: stopbits %d\n",lpdcb->StopBits); dprintf_comm(stddeb,"SetCommState: stopbits %d\n",lpdcb->StopBits);
switch (lpdcb->StopBits) { switch (lpdcb->StopBits) {
case ONESTOPBIT: case ONESTOPBIT:
port.c_cflag &= ~CSTOPB; port.c_cflag &= ~CSTOPB;
@ -655,10 +637,7 @@ int GetCommState(int fd, DCB FAR *lpdcb)
{ {
struct termios port; struct termios port;
#ifdef DEBUG_COMM dprintf_comm(stddeb,"GetCommState: fd %d, ptr %d\n", fd, (long) lpdcb);
fprintf(stderr,"GetCommState: fd %d, ptr %d\n", fd, (long) lpdcb);
#endif
if (tcgetattr(fd, &port) == -1) { if (tcgetattr(fd, &port) == -1) {
commerror = WinError(); commerror = WinError();
return -1; return -1;
@ -772,10 +751,8 @@ int TransmitCommChar(int fd, char chTransmit)
{ {
struct DosDeviceStruct *ptr; struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"TransmitCommChar: fd %d, data %d \n", fd, chTransmit); "TransmitCommChar: fd %d, data %d \n", fd, chTransmit);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) { if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
@ -799,10 +776,7 @@ int UngetCommChar(int fd, char chUnget)
{ {
struct DosDeviceStruct *ptr; struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM dprintf_comm(stddeb,"UngetCommChar: fd %d (char %d)\n", fd, chUnget);
fprintf(stderr,"UngetCommChar: fd %d (char %d)\n", fd, chUnget);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) { if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
@ -825,10 +799,8 @@ int ReadComm(int fd, LPSTR lpvBuf, int cbRead)
int status, length; int status, length;
struct DosDeviceStruct *ptr; struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM dprintf_comm(stddeb,
fprintf(stderr,"ReadComm: fd %d, ptr %d, length %d\n", fd, (long) lpvBuf, cbRead); "ReadComm: fd %d, ptr %d, length %d\n", fd, (long) lpvBuf, cbRead);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) { if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
@ -864,10 +836,8 @@ int WriteComm(int fd, LPSTR lpvBuf, int cbWrite)
int x, length; int x, length;
struct DosDeviceStruct *ptr; struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM dprintf_comm(stddeb,"WriteComm: fd %d, ptr %d, length %d\n",
fprintf(stderr,"WriteComm: fd %d, ptr %d, length %d\n", fd, (long) lpvBuf, cbWrite); fd, (long) lpvBuf, cbWrite);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) { if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID; commerror = IE_BADID;
return -1; return -1;
@ -878,10 +848,8 @@ fprintf(stderr,"WriteComm: fd %d, ptr %d, length %d\n", fd, (long) lpvBuf, cbWri
return -1; return -1;
} }
#ifdef DEBUG_COMM
for (x=0; x != cbWrite ; x++) for (x=0; x != cbWrite ; x++)
fprintf(stderr,"%c", *(lpvBuf + x) ); dprintf_comm(stddeb,"%c", *(lpvBuf + x) );
#endif
length = write(fd, (void *) lpvBuf, cbWrite); length = write(fd, (void *) lpvBuf, cbWrite);

View file

@ -3,6 +3,8 @@
* NOV 1993 Erik Bos (erik@(trashcan.)hacktic.nl) * NOV 1993 Erik Bos (erik@(trashcan.)hacktic.nl)
* *
* FindFile by Bob, hacked for dos & unixpaths by Erik. * FindFile by Bob, hacked for dos & unixpaths by Erik.
*
* Bugfix by dash@ifi.uio.no: ToUnix() was called to often
*/ */
#include <ctype.h> #include <ctype.h>
@ -28,8 +30,10 @@
#include "prototypes.h" #include "prototypes.h"
#include "autoconf.h" #include "autoconf.h"
#include "comm.h" #include "comm.h"
#include "stddebug.h"
/* #define DEBUG /* */ /* #define DEBUG_DOSFS /* */
/* #undef DEBIG_DOSFS /* */
#include "debug.h"
#define WINE_INI_USER "~/.winerc" #define WINE_INI_USER "~/.winerc"
#define MAX_OPEN_DIRS 16 #define MAX_OPEN_DIRS 16
@ -141,8 +145,7 @@ void DOS_InitFS(void)
for (x=0; x!=MAX_DOS_DRIVES; x++) { for (x=0; x!=MAX_DOS_DRIVES; x++) {
if (DosDrives[x].rootdir != NULL) { if (DosDrives[x].rootdir != NULL) {
#ifdef DEBUG dprintf_dosfs(stddeb, "DOSFS: %c: => %-40s %s %s %X %d\n",
fprintf(stderr, "DOSFS: %c: => %-40s %s %s %X %d\n",
'A'+x, 'A'+x,
DosDrives[x].rootdir, DosDrives[x].rootdir,
DosDrives[x].cwd, DosDrives[x].cwd,
@ -150,21 +153,18 @@ void DOS_InitFS(void)
DosDrives[x].serialnumber, DosDrives[x].serialnumber,
DosDrives[x].disabled DosDrives[x].disabled
); );
#endif
} }
} }
for (x=0; x!=MAX_OPEN_DIRS ; x++) for (x=0; x!=MAX_OPEN_DIRS ; x++)
DosDirs[x].inuse = 0; DosDirs[x].inuse = 0;
#ifdef DEBUG dprintf_dosfs(stddeb,"wine.ini = %s\n",WINE_INI);
fprintf(stderr,"wine.ini = %s\n",WINE_INI); dprintf_dosfs(stddeb,"win.ini = %s\n",WIN_INI);
fprintf(stderr,"win.ini = %s\n",WIN_INI); dprintf_dosfs(stddeb,"windir = %s\n",WindowsDirectory);
fprintf(stderr,"windir = %s\n",WindowsDirectory); dprintf_dosfs(stddeb,"sysdir = %s\n",SystemDirectory);
fprintf(stderr,"sysdir = %s\n",SystemDirectory); dprintf_dosfs(stddeb,"tempdir = %s\n",TempDirectory);
fprintf(stderr,"tempdir = %s\n",TempDirectory); dprintf_dosfs(stddeb,"path = %s\n",WindowsPath);
fprintf(stderr,"path = %s\n",WindowsPath);
#endif
} }
WORD DOS_GetEquipment(void) WORD DOS_GetEquipment(void)
@ -224,23 +224,17 @@ WORD DOS_GetEquipment(void)
equipment = (diskdrives << 6) | (serialports << 9) | equipment = (diskdrives << 6) | (serialports << 9) |
(parallelports << 14) | 0x02; (parallelports << 14) | 0x02;
#ifdef DEBUG dprintf_dosfs(stddeb, "DOS_GetEquipment : diskdrives = %d serialports = %d "
fprintf(stderr, "DOS_GetEquipment : diskdrives = %d serialports = %d "
"parallelports = %d\n" "parallelports = %d\n"
"DOS_GetEquipment : equipment = %d\n", "DOS_GetEquipment : equipment = %d\n",
diskdrives, serialports, parallelports, equipment); diskdrives, serialports, parallelports, equipment);
#endif
return (equipment); return (equipment);
} }
int DOS_ValidDrive(int drive) int DOS_ValidDrive(int drive)
{ {
/* dprintf_dosfs(stddeb,"ValidDrive %c (%d)\n",'A'+drive,drive);
#ifdef DEBUG
fprintf(stderr,"ValidDrive %c (%d)\n",'A'+drive,drive);
#endif
*/
if (drive >= MAX_DOS_DRIVES) if (drive >= MAX_DOS_DRIVES)
return 0; return 0;
if (DosDrives[drive].rootdir == NULL) if (DosDrives[drive].rootdir == NULL)
@ -251,21 +245,31 @@ int DOS_ValidDrive(int drive)
return 1; return 1;
} }
int DOS_ValidDirectory(char *name)
{
char *dirname;
struct stat s;
if ((dirname = GetUnixFileName(name)) == NULL)
return 0;
if (stat(dirname,&s))
return 0;
if (!S_ISDIR(s.st_mode))
return 0;
return 1;
}
int DOS_GetDefaultDrive(void) int DOS_GetDefaultDrive(void)
{ {
#ifdef DEBUG dprintf_dosfs(stddeb,"GetDefaultDrive (%c)\n",'A'+CurrentDrive);
fprintf(stderr,"GetDefaultDrive (%c)\n",'A'+CurrentDrive);
#endif
return( CurrentDrive); return( CurrentDrive);
} }
void DOS_SetDefaultDrive(int drive) void DOS_SetDefaultDrive(int drive)
{ {
#ifdef DEBUG dprintf_dosfs(stddeb,"SetDefaultDrive to %c:\n",'A'+drive);
fprintf(stderr,"SetDefaultDrive to %c:\n",'A'+drive);
#endif
if (DOS_ValidDrive(drive)) if (DOS_ValidDrive(drive))
CurrentDrive = drive; CurrentDrive = drive;
} }
@ -336,11 +340,9 @@ static void GetUnixDirName(char *rootdir, char *name)
cwdptr = rootdir + strlen(rootdir); cwdptr = rootdir + strlen(rootdir);
nameptr = name; nameptr = name;
/*
#ifdef DEBUG dprintf_dosfs(stddeb,"GetUnixDirName: %s <=> %s => ",rootdir, name);
fprintf(stderr,"GetUnixDirName: %s <=> %s => ",rootdir, name);
#endif
*/
while (*nameptr) { while (*nameptr) {
if (*nameptr == '.' & !filename) { if (*nameptr == '.' & !filename) {
nameptr++; nameptr++;
@ -379,11 +381,11 @@ static void GetUnixDirName(char *rootdir, char *name)
*cwdptr = '\0'; *cwdptr = '\0';
ToUnix(rootdir); ToUnix(rootdir);
/*
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr,"%s\n", rootdir); fprintf(stderr,"%s\n", rootdir);
#endif #endif
*/
} }
char *GetUnixFileName(char *dosfilename) char *GetUnixFileName(char *dosfilename)
@ -408,12 +410,7 @@ char *GetUnixFileName(char *dosfilename)
strcat(temp, DosDrives[drive].cwd); strcat(temp, DosDrives[drive].cwd);
GetUnixDirName(temp + strlen(DosDrives[drive].rootdir), dosfilename); GetUnixDirName(temp + strlen(DosDrives[drive].rootdir), dosfilename);
ToUnix(temp); dprintf_dosfs(stddeb,"GetUnixFileName: %s => %s\n", dosfilename, temp);
#ifdef DEBUG
fprintf(stderr,"GetUnixFileName: %s => %s\n", dosfilename, temp);
#endif
return(temp); return(temp);
} }
@ -427,7 +424,6 @@ char *GetDosFileName(char *unixfilename)
if (DosDrives[i].rootdir != NULL) { if (DosDrives[i].rootdir != NULL) {
strcpy(rootdir, DosDrives[i].rootdir); strcpy(rootdir, DosDrives[i].rootdir);
strcat(rootdir, "/"); strcat(rootdir, "/");
ToUnix(rootdir);
if (strncmp(rootdir, unixfilename, strlen(rootdir)) == 0) { if (strncmp(rootdir, unixfilename, strlen(rootdir)) == 0) {
sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(rootdir)); sprintf(temp, "%c:\\%s", 'A' + i, unixfilename + strlen(rootdir));
ToDos(temp); ToDos(temp);
@ -451,30 +447,34 @@ char *DOS_GetCurrentDir(int drive)
strcpy(temp, DosDrives[drive].cwd); strcpy(temp, DosDrives[drive].cwd);
ToDos(temp); ToDos(temp);
fprintf(stderr, "2 %s\n", temp);
ChopOffSlash(temp); ChopOffSlash(temp);
#ifdef DEBUG dprintf_dosfs(stddeb,"DOS_GetCWD: %c: %s\n",'A'+drive, temp + 1);
fprintf(stderr,"DOS_GetCWD: %c: %s\n",'A'+drive, temp + 1);
#endif
return (temp + 1); return (temp + 1);
} }
int DOS_ChangeDir(int drive, char *dirname) int DOS_ChangeDir(int drive, char *dirname)
{ {
char temp[256]; char temp[256],old[256];
if (!DOS_ValidDrive(drive)) if (!DOS_ValidDrive(drive))
return 0; return 0;
strcpy(temp, dirname); strcpy(temp, dirname);
ToUnix(temp); ToUnix(temp);
strcpy(old, DosDrives[drive].cwd);
GetUnixDirName(DosDrives[drive].cwd, temp); GetUnixDirName(DosDrives[drive].cwd, temp);
strcat(DosDrives[drive].cwd,"/"); strcat(DosDrives[drive].cwd,"/");
#ifdef DEBUG
fprintf(stderr,"DOS_SetCWD: %c: %s\n",'A'+drive, DosDrives[drive].cwd); dprintf_dosfs(stddeb,"DOS_SetCWD: %c: %s\n",'A'+drive,
#endif DosDrives[drive].cwd);
if (!DOS_ValidDirectory(DosDrives[drive].cwd))
{
strcpy(DosDrives[drive].cwd, old);
return 0;
}
return 1; return 1;
} }
@ -489,12 +489,11 @@ int DOS_MakeDir(int drive, char *dirname)
GetUnixDirName(temp, dirname); GetUnixDirName(temp, dirname);
strcat(DosDrives[drive].cwd,"/"); strcat(DosDrives[drive].cwd,"/");
ToUnix(temp); ToUnix(temp + strlen(DosDrives[drive].cwd));
mkdir(temp,0); mkdir(temp,0);
#ifdef DEBUG dprintf_dosfs(stddeb,
fprintf(stderr,"DOS_MakeDir: %c:\%s => %s",'A'+drive, dirname, temp); "DOS_MakeDir: %c:\%s => %s",'A'+drive, dirname, temp);
#endif
return 1; return 1;
} }
@ -541,7 +540,8 @@ int DOS_GetFreeSpace(int drive, long *size, long *available)
return 0; return 0;
if (statfs(DosDrives[drive].rootdir, &info) < 0) { if (statfs(DosDrives[drive].rootdir, &info) < 0) {
fprintf(stderr,"dosfs: cannot do statfs(%s)\n",DosDrives[drive].rootdir); fprintf(stderr,"dosfs: cannot do statfs(%s)\n",
DosDrives[drive].rootdir);
return 0; return 0;
} }
@ -563,7 +563,6 @@ char *FindFile(char *buffer, int buflen, char *filename, char **extensions,
if (strchr(filename, '\\') != NULL) if (strchr(filename, '\\') != NULL)
{ {
strncpy(buffer, GetUnixFileName(filename), buflen); strncpy(buffer, GetUnixFileName(filename), buflen);
ToUnix(buffer);
stat( buffer, &filestat); stat( buffer, &filestat);
if (S_ISREG(filestat.st_mode)) if (S_ISREG(filestat.st_mode))
return buffer; return buffer;
@ -577,10 +576,7 @@ char *FindFile(char *buffer, int buflen, char *filename, char **extensions,
return buffer; return buffer;
} }
#ifdef DEBUG dprintf_dosfs(stddeb,"FindFile: looking for %s\n", filename);
fprintf(stderr,"FindFile: looking for %s\n", filename);
#endif
rootnamelen = strlen(filename); rootnamelen = strlen(filename);
if ((rootname = malloc(rootnamelen + 1)) == NULL) if ((rootname = malloc(rootnamelen + 1)) == NULL)
return NULL; return NULL;
@ -600,10 +596,7 @@ fprintf(stderr,"FindFile: looking for %s\n", filename);
else else
d = opendir( dirname ); d = opendir( dirname );
#ifdef DEBUG dprintf_dosfs(stddeb,"in %s\n",dirname);
fprintf(stderr,"in %s\n",dirname);
#endif
if (d != NULL) if (d != NULL)
{ {
while ((f = readdir(d)) != NULL) while ((f = readdir(d)) != NULL)
@ -637,7 +630,6 @@ fprintf(stderr,"FindFile: looking for %s\n", filename);
if (S_ISREG(filestat.st_mode)) { if (S_ISREG(filestat.st_mode)) {
closedir(d); closedir(d);
free(rootname); free(rootname);
ToUnix(buffer);
return buffer; return buffer;
} else } else
found = 0; found = 0;
@ -693,7 +685,6 @@ char *WinIniFileName(void)
strcpy(name, GetUnixFileName(WindowsDirectory)); strcpy(name, GetUnixFileName(WindowsDirectory));
strcat(name, "/"); strcat(name, "/");
strcat(name, "win.ini"); strcat(name, "win.ini");
ToUnix(name);
name = realloc(name, strlen(name) + 1); name = realloc(name, strlen(name) + 1);
@ -704,10 +695,7 @@ static int match(char *filename, char *filemask)
{ {
int x, masklength = strlen(filemask); int x, masklength = strlen(filemask);
#ifdef DEBUG dprintf_dosfs(stddeb, "match: %s, %s\n", filename, filemask);
fprintf(stderr, "match: %s, %s\n", filename, filemask);
#endif
for (x = 0; x != masklength ; x++) { for (x = 0; x != masklength ; x++) {
/* printf("(%c%c) ", *filename, filemask[x]); /* printf("(%c%c) ", *filename, filemask[x]);
*/ */
@ -763,9 +751,7 @@ struct dosdirent *DOS_opendir(char *dosdirname)
} }
} }
#ifdef DEBUG dprintf_dosfs(stddeb,"DOS_opendir: %s -> %s\n", unixdirname, temp);
fprintf(stderr,"DOS_opendir: %s -> %s\n", unixdirname, temp);
#endif
DosDirs[x].inuse = 1; DosDirs[x].inuse = 1;
strcpy(DosDirs[x].unixpath, temp); strcpy(DosDirs[x].unixpath, temp);
@ -800,7 +786,7 @@ struct dosdirent *DOS_readdir(struct dosdirent *de)
strcpy(temp,de->unixpath); strcpy(temp,de->unixpath);
strcat(temp,"/"); strcat(temp,"/");
strcat(temp,de->filename); strcat(temp,de->filename);
ToUnix(temp); ToUnix(temp + strlen(de->unixpath));
stat (temp, &st); stat (temp, &st);
de->attribute = 0x0; de->attribute = 0x0;

View file

@ -12,6 +12,10 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include "user.h" #include "user.h"
#include "dlls.h" #include "dlls.h"
#include "driver.h" #include "driver.h"
#include "stddebug.h"
/* #define DEBUG_DRIVER /* */
/* #undef DEBUG_DRIVER /* */
#include "debug.h"
LPDRIVERITEM lpDrvItemList = NULL; LPDRIVERITEM lpDrvItemList = NULL;
@ -23,16 +27,19 @@ void LoadStartupDrivers()
LPSTR file = "SYSTEM.INI"; LPSTR file = "SYSTEM.INI";
if (GetPrivateProfileString("drivers", NULL, if (GetPrivateProfileString("drivers", NULL,
"", str, sizeof(str), file) < 2) { "", str, sizeof(str), file) < 2) {
printf("LoadStartupDrivers // can't find drivers section in '%s'\n", file); fprintf(stderr,
"LoadStartupDrivers // can't find drivers section in '%s'\n",
file);
return; return;
} }
while(strlen(ptr) != 0) { while(strlen(ptr) != 0) {
printf("LoadStartupDrivers // str='%s'\n", ptr); dprintf_driver(stddeb,"LoadStartupDrivers // str='%s'\n", ptr);
hDrv = OpenDriver(ptr, "drivers", 0L); hDrv = OpenDriver(ptr, "drivers", 0L);
printf("LoadStartupDrivers // hDrv=%04X\n", hDrv); dprintf_driver(stddeb,
"LoadStartupDrivers // hDrv=%04X\n", hDrv);
ptr += strlen(ptr) + 1; ptr += strlen(ptr) + 1;
} }
printf("LoadStartupDrivers // end of list !\n"); dprintf_driver(stddeb,"LoadStartupDrivers // end of list !\n");
} }
/************************************************************************** /**************************************************************************
@ -40,7 +47,7 @@ void LoadStartupDrivers()
*/ */
LRESULT WINAPI SendDriverMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2) LRESULT WINAPI SendDriverMessage(HDRVR hDriver, WORD msg, LPARAM lParam1, LPARAM lParam2)
{ {
printf("SendDriverMessage(%04X, %04X, %08X, %08X);\n", dprintf_driver(stdnimp,"SendDriverMessage(%04X, %04X, %08X, %08X);\n",
hDriver, msg, lParam1, lParam2); hDriver, msg, lParam1, lParam2);
} }
@ -53,12 +60,12 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
LPDRIVERITEM lpnewdrv; LPDRIVERITEM lpnewdrv;
LPDRIVERITEM lpdrv = lpDrvItemList; LPDRIVERITEM lpdrv = lpDrvItemList;
char DrvName[128]; char DrvName[128];
printf("OpenDriver('%s', '%s', %08X);\n", dprintf_driver(stddeb,"OpenDriver('%s', '%s', %08X);\n",
lpDriverName, lpSectionName, lParam); lpDriverName, lpSectionName, lParam);
if (lpSectionName == NULL) lpSectionName = "drivers"; if (lpSectionName == NULL) lpSectionName = "drivers";
GetPrivateProfileString(lpSectionName, lpDriverName, GetPrivateProfileString(lpSectionName, lpDriverName,
"", DrvName, sizeof(DrvName), "SYSTEM.INI"); "", DrvName, sizeof(DrvName), "SYSTEM.INI");
printf("OpenDriver // DrvName='%s'\n", DrvName); dprintf_driver(stddeb,"OpenDriver // DrvName='%s'\n", DrvName);
if (strlen(DrvName) < 1) return 0; if (strlen(DrvName) < 1) return 0;
while (lpdrv != NULL) { while (lpdrv != NULL) {
if (lpdrv->lpNextItem == NULL) break; if (lpdrv->lpNextItem == NULL) break;
@ -88,7 +95,7 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
lpnewdrv->lpPrevItem = lpdrv; lpnewdrv->lpPrevItem = lpdrv;
} }
lpnewdrv->lpDrvProc = NULL; lpnewdrv->lpDrvProc = NULL;
printf("OpenDriver // hDrvr=%04X loaded !\n", hDrvr); dprintf_driver(stddeb,"OpenDriver // hDrvr=%04X loaded !\n", hDrvr);
return hDrvr; return hDrvr;
} }
@ -98,7 +105,8 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2) LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
printf("CloseDriver(%04X, %08X, %08X);\n", hDrvr, lParam1, lParam2); dprintf_driver(stddeb,
"CloseDriver(%04X, %08X, %08X);\n", hDrvr, lParam1, lParam2);
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv != NULL && lpdrv->dis.hDriver == hDrvr) { if (lpdrv != NULL && lpdrv->dis.hDriver == hDrvr) {
if (lpdrv->lpPrevItem) if (lpdrv->lpPrevItem)
@ -107,7 +115,7 @@ LRESULT CloseDriver(HDRVR hDrvr, LPARAM lParam1, LPARAM lParam2)
((LPDRIVERITEM)lpdrv->lpNextItem)->lpPrevItem = lpdrv->lpPrevItem; ((LPDRIVERITEM)lpdrv->lpNextItem)->lpPrevItem = lpdrv->lpPrevItem;
GlobalUnlock(hDrvr); GlobalUnlock(hDrvr);
GlobalFree(hDrvr); GlobalFree(hDrvr);
printf("CloseDriver // hDrvr=%04X closed !\n", hDrvr); dprintf_driver(stddeb,"CloseDriver // hDrvr=%04X closed !\n", hDrvr);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@ -120,7 +128,7 @@ HANDLE GetDriverModuleHandle(HDRVR hDrvr)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
HANDLE hModule = 0; HANDLE hModule = 0;
printf("GetDriverModuleHandle(%04X);\n", hDrvr); dprintf_driver(stddeb,"GetDriverModuleHandle(%04X);\n", hDrvr);
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv != NULL) { if (lpdrv != NULL) {
hModule = lpdrv->dis.hModule; hModule = lpdrv->dis.hModule;
@ -169,7 +177,7 @@ LRESULT DefDriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
BOOL GetDriverInfo(HDRVR hDrvr, LPDRIVERINFOSTRUCT lpDrvInfo) BOOL GetDriverInfo(HDRVR hDrvr, LPDRIVERINFOSTRUCT lpDrvInfo)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
printf("GetDriverInfo(%04X, %08X);\n", hDrvr, lpDrvInfo); dprintf_driver(stddeb,"GetDriverInfo(%04X, %08X);\n", hDrvr, lpDrvInfo);
if (lpDrvInfo == NULL) return FALSE; if (lpDrvInfo == NULL) return FALSE;
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
if (lpdrv == NULL) return FALSE; if (lpdrv == NULL) return FALSE;
@ -185,14 +193,15 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags)
{ {
LPDRIVERITEM lpdrv; LPDRIVERITEM lpdrv;
HDRVR hRetDrv = 0; HDRVR hRetDrv = 0;
printf("GetNextDriver(%04X, %08X);\n", hDrvr, dwFlags); dprintf_driver(stddeb,"GetNextDriver(%04X, %08X);\n", hDrvr, dwFlags);
if (hDrvr == 0) { if (hDrvr == 0) {
if (lpDrvItemList == NULL) { if (lpDrvItemList == NULL) {
printf("GetNextDriver // drivers list empty !\n"); dprintf_driver(stddeb,
"GetNextDriver // drivers list empty !\n");
LoadStartupDrivers(); LoadStartupDrivers();
if (lpDrvItemList == NULL) return 0; if (lpDrvItemList == NULL) return 0;
} }
printf("GetNextDriver // return first %04X !\n", dprintf_driver(stddeb,"GetNextDriver // return first %04X !\n",
lpDrvItemList->dis.hDriver); lpDrvItemList->dis.hDriver);
return lpDrvItemList->dis.hDriver; return lpDrvItemList->dis.hDriver;
} }
@ -208,7 +217,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags)
} }
GlobalUnlock(hDrvr); GlobalUnlock(hDrvr);
} }
printf("GetNextDriver // return %04X !\n", hRetDrv); dprintf_driver(stddeb,"GetNextDriver // return %04X !\n", hRetDrv);
return hRetDrv; return hRetDrv;
} }

View file

@ -13,6 +13,10 @@
#include "dlls.h" #include "dlls.h"
#include "wine.h" #include "wine.h"
#include "windows.h" #include "windows.h"
#include "stddebug.h"
/* #define DEBUG_EXEC /* */
/* #undef DEBUG_EXEC /* */
#include "debug.h"
#define HELP_CONTEXT 0x0001 #define HELP_CONTEXT 0x0001
#define HELP_QUIT 0x0002 #define HELP_QUIT 0x0002
@ -53,40 +57,41 @@ void InitializeLoadedNewDLLs(HINSTANCE hInst)
int cs_reg, ds_reg, ip_reg; int cs_reg, ds_reg, ip_reg;
int rv; int rv;
fprintf(stderr, "Initializing New DLLs\n"); dprintf_exec(stddeb, "Initializing New DLLs\n");
/* /*
* Initialize libraries * Initialize libraries
*/ */
printf("InitializeLoadedNewDLLs() before searching hInst=%04X !\n", hInst); dprintf_exec(stddeb,
"InitializeLoadedNewDLLs() before searching hInst=%04X !\n", hInst);
w = wine_files; w = wine_files;
while (w && w->hinstance != hInst) w = w->next; while (w && w->hinstance != hInst) w = w->next;
if (w == NULL) return; if (w == NULL) return;
printf("InitializeLoadedNewDLLs() // before InitLoop !\n"); dprintf_exec(stddeb,"InitializeLoadedNewDLLs() // before InitLoop !\n");
for(wpnt = w; wpnt; wpnt = wpnt->next) for(wpnt = w; wpnt; wpnt = wpnt->next)
{ {
/* /*
* Is this a library? * Is this a library?
*/ */
if (wpnt->ne_header->format_flags & 0x8000) if (wpnt->ne->ne_header->format_flags & 0x8000)
{ {
if (!(wpnt->ne_header->format_flags & 0x0001)) if (!(wpnt->ne->ne_header->format_flags & 0x0001))
{ {
/* Not SINGLEDATA */ /* Not SINGLEDATA */
fprintf(stderr, "Library is not marked SINGLEDATA\n"); fprintf(stderr, "Library is not marked SINGLEDATA\n");
exit(1); exit(1);
} }
ds_reg = wpnt->selector_table[wpnt-> ds_reg = wpnt->ne->selector_table[wpnt->ne->
ne_header->auto_data_seg-1].selector; ne_header->auto_data_seg-1].selector;
cs_reg = wpnt->selector_table[wpnt->ne_header->cs-1].selector; cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1].selector;
ip_reg = wpnt->ne_header->ip; ip_reg = wpnt->ne->ne_header->ip;
fprintf(stderr, "Initializing %s, cs:ip %04x:%04x, ds %04x\n", dprintf_exec(stddeb, "Initializing %s, cs:ip %04x:%04x, ds %04x\n",
wpnt->name, cs_reg, ip_reg, ds_reg); wpnt->name, cs_reg, ip_reg, ds_reg);
rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg); rv = CallTo16(cs_reg << 16 | ip_reg, ds_reg);
printf ("rv = %x\n", rv); dprintf_exec(stddeb,"rv = %x\n", rv);
} }
} }
} }
@ -100,28 +105,29 @@ void StartNewTask(HINSTANCE hInst)
int rv; int rv;
int segment; int segment;
printf("StartNewTask() before searching hInst=%04X !\n", hInst); dprintf_exec(stddeb,
"StartNewTask() before searching hInst=%04X !\n", hInst);
wpnt = wine_files; wpnt = wine_files;
while (wpnt && wpnt->hinstance != hInst) wpnt = wpnt->next; while (wpnt && wpnt->hinstance != hInst) wpnt = wpnt->next;
if (wpnt == NULL) return; if (wpnt == NULL) return;
printf("StartNewTask() // before FixupSegment !\n"); dprintf_exec(stddeb,"StartNewTask() // before FixupSegment !\n");
for(w = wpnt; w; w = w->next) { for(w = wpnt; w; w = w->next) {
for (segment = 0; segment < w->ne_header->n_segment_tab; segment++) { for (segment = 0; segment < w->ne->ne_header->n_segment_tab; segment++) {
if (FixupSegment(w, segment) < 0) { if (FixupSegment(w, segment) < 0) {
myerror("fixup failed."); myerror("fixup failed.");
} }
} }
} }
printf("StartNewTask() before InitializeLoadedNewDLLs !\n"); dprintf_exec(stddeb,"StartNewTask() before InitializeLoadedNewDLLs !\n");
InitializeLoadedNewDLLs(hInst); InitializeLoadedNewDLLs(hInst);
printf("StartNewTask() before setup register !\n"); dprintf_exec(stddeb,"StartNewTask() before setup register !\n");
ds_reg = (wpnt->selector_table[wpnt->ne_header->auto_data_seg-1].selector); ds_reg = (wpnt->ne->selector_table[wpnt->ne->ne_header->auto_data_seg-1].selector);
cs_reg = wpnt->selector_table[wpnt->ne_header->cs-1].selector; cs_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->cs-1].selector;
ip_reg = wpnt->ne_header->ip; ip_reg = wpnt->ne->ne_header->ip;
ss_reg = wpnt->selector_table[wpnt->ne_header->ss-1].selector; ss_reg = wpnt->ne->selector_table[wpnt->ne->ne_header->ss-1].selector;
sp_reg = wpnt->ne_header->sp; sp_reg = wpnt->ne->ne_header->sp;
printf("StartNewTask() before CallToInit16() !\n"); dprintf_exec(stddeb,"StartNewTask() before CallToInit16() !\n");
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg); rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv); printf ("rv = %x\n", rv);
@ -141,7 +147,7 @@ HANDLE LoadModule(LPSTR modulefile, LPVOID lpParamBlk)
{ {
PARAMBLOCK *pblk = lpParamBlk; PARAMBLOCK *pblk = lpParamBlk;
WORD *lpCmdShow; WORD *lpCmdShow;
printf("LoadModule '%s' %08X\n", modulefile, lpParamBlk); dprintf_exec(stddeb,"LoadModule '%s' %08X\n", modulefile, lpParamBlk);
if (lpParamBlk == NULL) return 0; if (lpParamBlk == NULL) return 0;
lpCmdShow = (WORD *)pblk->lpCmdShow; lpCmdShow = (WORD *)pblk->lpCmdShow;
return WinExec(pblk->lpCmdLine, lpCmdShow[1]); return WinExec(pblk->lpCmdLine, lpCmdShow[1]);
@ -159,7 +165,7 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
LPFNWINMAIN lpfnMain; LPFNWINMAIN lpfnMain;
HINSTANCE hInst = 0; HINSTANCE hInst = 0;
HANDLE hTask = 0; HANDLE hTask = 0;
printf("WinExec('%s', %04X)\n", lpCmdLine, nCmdShow); dprintf_exec(stddeb,"WinExec('%s', %04X)\n", lpCmdLine, nCmdShow);
/* ArgV[0] = "wine"; /* ArgV[0] = "wine";
c = 1; */ c = 1; */
for (x = x2 = 0; x < strlen(lpCmdLine) + 1; x++) { for (x = x2 = 0; x < strlen(lpCmdLine) + 1; x++) {
@ -171,36 +177,43 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
} }
} }
ArgV[c] = NULL; ArgV[c] = NULL;
for (c = 0; ArgV[c] != NULL; c++) printf("--> '%s' \n", ArgV[c]); for (c = 0; ArgV[c] != NULL; c++)
dprintf_exec(stddeb,"--> '%s' \n", ArgV[c]);
switch(fork()) { switch(fork()) {
case -1: case -1:
printf("Can't 'fork' process !\n"); fprintf(stderr,"Can't 'fork' process !\n");
break; break;
case 0: case 0:
if ((hInst = LoadImage(ArgV[0], EXE, 1)) == (HINSTANCE) NULL ) { if ((hInst = LoadImage(ArgV[0], EXE, 1)) == (HINSTANCE) NULL ) {
fprintf(stderr, "wine: can't find %s!.\n", ArgV[0]); fprintf(stderr, "wine: can't find %s!.\n", ArgV[0]);
printf("Child process died !\n"); fprintf(stderr,"Child process died !\n");
exit(1); exit(1);
} }
hTask = CreateNewTask(hInst); hTask = CreateNewTask(hInst);
printf("WinExec // hTask=%04X hInst=%04X !\n", hTask, hInst); dprintf_exec(stddeb,
"WinExec // hTask=%04X hInst=%04X !\n", hTask, hInst);
StartNewTask(hInst); StartNewTask(hInst);
/* /*
lpfnMain = (LPFNWINMAIN)GetProcAddress(hInst, (LPSTR)0L); lpfnMain = (LPFNWINMAIN)GetProcAddress(hInst, (LPSTR)0L);
printf("WineExec() // lpfnMain=%08X\n", (LONG)lpfnMain); dprintf_exec(stddeb,
"WineExec() // lpfnMain=%08X\n", (LONG)lpfnMain);
if (lpfnMain != NULL) { if (lpfnMain != NULL) {
(lpfnMain)(hInst, 0, lpCmdLine, nCmdShow); (lpfnMain)(hInst, 0, lpCmdLine, nCmdShow);
printf("WineExec() // after lpfnMain\n"); dprintf_exec(stddeb,
"WineExec() // after lpfnMain\n");
} }
*/ */
/* hTask = CreateNewTask(0); /* hTask = CreateNewTask(0);
printf("WinExec // New Task hTask=%04X !\n", hTask); dprintf_exec(stddeb,
"WinExec // New Task hTask=%04X !\n", hTask);
execvp(ArgV[0], ArgV); */ execvp(ArgV[0], ArgV); */
printf("Child process died !\n"); fprintf(stderr,"Child process died !\n");
exit(1); exit(1);
default: default:
printf("WinExec (Main process stay alive) hTask=%04X !\n", hTask); dprintf_exec(stddeb,
"WinExec (Main process stay alive) hTask=%04X !\n",
hTask);
break; break;
} }
for (c = 0; ArgV[c] != NULL; c++) free(ArgV[c]); for (c = 0; ArgV[c] != NULL; c++) free(ArgV[c]);
@ -213,7 +226,8 @@ WORD WinExec(LPSTR lpCmdLine, WORD nCmdShow)
*/ */
BOOL ExitWindows(DWORD dwReserved, WORD wRetCode) BOOL ExitWindows(DWORD dwReserved, WORD wRetCode)
{ {
printf("EMPTY STUB !!! ExitWindows(%08X, %04X) !\n", dwReserved, wRetCode); dprintf_exec(stdnimp,"EMPTY STUB !!! ExitWindows(%08X, %04X) !\n",
dwReserved, wRetCode);
} }
@ -223,18 +237,19 @@ BOOL ExitWindows(DWORD dwReserved, WORD wRetCode)
BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData) BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
{ {
char str[256]; char str[256];
printf("WinHelp(%s, %u, %lu)\n", lpHelpFile, wCommand, dwData); dprintf_exec(stddeb,"WinHelp(%s, %u, %lu)\n",
lpHelpFile, wCommand, dwData);
switch(wCommand) { switch(wCommand) {
case 0: case 0:
case HELP_HELPONHELP: case HELP_HELPONHELP:
GetWindowsDirectory(str, sizeof(str)); GetWindowsDirectory(str, sizeof(str));
strcat(str, "\\winhelp.exe"); strcat(str, "\\winhelp.exe");
printf("'%s'\n", str); dprintf_exec(stddeb,"'%s'\n", str);
break; break;
case HELP_INDEX: case HELP_INDEX:
GetWindowsDirectory(str, sizeof(str)); GetWindowsDirectory(str, sizeof(str));
strcat(str, "\\winhelp.exe"); strcat(str, "\\winhelp.exe");
printf("'%s'\n", str); dprintf_exec(stddeb,"'%s'\n", str);
break; break;
default: default:
return FALSE; return FALSE;

View file

@ -22,8 +22,8 @@
#include <limits.h> #include <limits.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <windows.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h>
#include "prototypes.h" #include "prototypes.h"
#include "regfunc.h" #include "regfunc.h"
#include "windows.h" #include "windows.h"
@ -31,11 +31,13 @@
#include "msdos.h" #include "msdos.h"
#include "registers.h" #include "registers.h"
#include "options.h" #include "options.h"
#include "stddebug.h"
/* #define DEBUG_FILE /* */
/* #undef DEBUG_FILE /* */
#include "debug.h"
#define MAX_PATH 255 #define MAX_PATH 255
/* #define DEBUG_FILE /* */
char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256]; char WindowsDirectory[256], SystemDirectory[256], TempDirectory[256];
extern char WindowsPath[256]; extern char WindowsPath[256];
@ -55,18 +57,13 @@ INT _lopen (LPSTR lpPathName, INT iReadWrite)
int handle; int handle;
char *UnixFileName; char *UnixFileName;
#ifdef DEBUG_FILE dprintf_file(stddeb, "_lopen: open('%s', %X);\n", lpPathName, iReadWrite);
fprintf (stderr, "_lopen: open('%s', %X);\n", lpPathName, iReadWrite);
#endif
if ((UnixFileName = GetUnixFileName(lpPathName)) == NULL) if ((UnixFileName = GetUnixFileName(lpPathName)) == NULL)
return HFILE_ERROR; return HFILE_ERROR;
iReadWrite &= 0x000F; iReadWrite &= 0x000F;
handle = open (UnixFileName, iReadWrite); handle = open (UnixFileName, iReadWrite);
#ifdef DEBUG_FILE dprintf_file(stddeb, "_lopen: open: %s (handle %d)\n", UnixFileName, handle);
fprintf (stderr, "_lopen: open: %s (handle %d)\n", UnixFileName, handle);
#endif
if (handle == -1) if (handle == -1)
return HFILE_ERROR; return HFILE_ERROR;
@ -81,10 +78,8 @@ INT _lread (INT hFile, LPSTR lpBuffer, WORD wBytes)
{ {
int result; int result;
#ifdef DEBUG_FILE dprintf_file(stddeb, "_lread: handle %d, buffer = %ld, length = %d\n",
fprintf(stderr, "_lread: handle %d, buffer = %ld, length = %d\n",
hFile, (int) lpBuffer, wBytes); hFile, (int) lpBuffer, wBytes);
#endif
result = read (hFile, lpBuffer, wBytes); result = read (hFile, lpBuffer, wBytes);
@ -101,12 +96,9 @@ INT _lwrite (INT hFile, LPSTR lpBuffer, WORD wBytes)
{ {
int result; int result;
#if 0 dprintf_file(stddeb, "_lwrite: handle %d, buffer = %ld, length = %d\n",
#ifdef DEBUG_FILE
fprintf(stderr, "_lwrite: handle %d, buffer = %ld, length = %d\n",
hFile, (int) lpBuffer, wBytes); hFile, (int) lpBuffer, wBytes);
#endif
#endif
result = write (hFile, lpBuffer, wBytes); result = write (hFile, lpBuffer, wBytes);
if (result == -1) if (result == -1)
@ -120,9 +112,7 @@ INT _lwrite (INT hFile, LPSTR lpBuffer, WORD wBytes)
***************************************************************************/ ***************************************************************************/
INT _lclose (INT hFile) INT _lclose (INT hFile)
{ {
#ifdef DEBUG_FILE dprintf_file(stddeb, "_lclose: handle %d\n", hFile);
fprintf(stderr, "_lclose: handle %d\n", hFile);
#endif
if (close (hFile)) if (close (hFile))
return HFILE_ERROR; return HFILE_ERROR;
else else
@ -135,9 +125,11 @@ INT _lclose (INT hFile)
INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle) INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
{ {
int handle; int handle;
#ifndef PROCEMU
struct sigcontext_struct ccontext; struct sigcontext_struct ccontext;
/* To make macros like EAX happy */ /* To make macros like EAX happy */
struct sigcontext_struct *context=&ccontext; struct sigcontext_struct *context=&ccontext;
#endif
char filename[MAX_PATH+1]; char filename[MAX_PATH+1];
int action; int action;
struct stat s; struct stat s;
@ -145,9 +137,7 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
int res; int res;
int verify_time; int verify_time;
#ifdef DEBUG_FILE dprintf_file(stddeb,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
fprintf(stderr,"Openfile(%s,<struct>,%d) ",lpFileName,wStyle);
#endif
action = wStyle & 0xff00; action = wStyle & 0xff00;
@ -196,14 +186,12 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) ) if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break; break;
GetWindowsDirectory (filename,MAX_PATH); GetWindowsDirectory (filename,MAX_PATH);
if (filename[1] != ':') if (filename[1] != ':') strcat(filename,"\\");
strcat(filename,'\\');
strcat (filename, lpFileName); strcat (filename, lpFileName);
if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) ) if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break; break;
GetSystemDirectory (filename,MAX_PATH); GetSystemDirectory (filename,MAX_PATH);
if (filename[1] != ':') if (filename[1] != ':') strcat(filename,"\\");
strcat(filename,'\\');
strcat (filename, lpFileName); strcat (filename, lpFileName);
if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) ) if ( (!stat(GetUnixFileName(filename), &s)) && (S_ISREG(s.st_mode)) )
break; break;
@ -263,17 +251,17 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
/* Now we are actually going to open the file. According to Microsoft's /* Now we are actually going to open the file. According to Microsoft's
Knowledge Basis, this is done by calling int 21h, ax=3dh. */ Knowledge Basis, this is done by calling int 21h, ax=3dh. */
EAX = 0x00003d00; AX = 0x3d00;
EAX = (EAX & 0xffffff0f) | (wStyle & 0x0070); /* Handle OF_SHARE_xxx etc. */ AL = (AL & 0x0f) | (wStyle & 0x70); /* Handle OF_SHARE_xxx etc. */
EAX = (EAX & 0xfffffff0) | (wStyle & 0x0003); /* Handle OF_READ etc. */ AL = (AL & 0xf0) | (wStyle & 0x03); /* Handle OF_READ etc. */
DS = segment (ofs->szPathName); DS = segment (ofs->szPathName);
EDX = (EDX & 0xffff0000) | offset (ofs->szPathName); DX = offset (ofs->szPathName);
OpenExistingFile (context); OpenExistingFile (context);
if (EFL & 0x00000001) /* Cflag */ if (EFL & 0x00000001) /* Cflag */
{ {
ofs->nErrCode = (AX & 0x00ff); ofs->nErrCode = AL;
return -1; return -1;
} }
@ -293,7 +281,7 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
#endif #endif
WORD SetHandleCount (WORD wNumber) WORD SetHandleCount (WORD wNumber)
{ {
printf("SetHandleCount(%d)\n",wNumber); dprintf_file(stddeb,"SetHandleCount(%d)\n",wNumber);
return((wNumber<OPEN_MAX) ? wNumber : OPEN_MAX); return((wNumber<OPEN_MAX) ? wNumber : OPEN_MAX);
} }
@ -304,9 +292,8 @@ LONG _llseek (INT hFile, LONG lOffset, INT nOrigin)
{ {
int origin; int origin;
#ifdef DEBUG_FILE dprintf_file(stddeb, "_llseek: handle %d, offset %ld, origin %d\n",
fprintf(stderr, "_llseek: handle %d, offset %ld, origin %d\n", hFile, lOffset, nOrigin); hFile, lOffset, nOrigin);
#endif
switch (nOrigin) { switch (nOrigin) {
case 1: origin = SEEK_CUR; case 1: origin = SEEK_CUR;
@ -328,10 +315,8 @@ INT _lcreat (LPSTR lpszFilename, INT fnAttribute)
int handle; int handle;
char *UnixFileName; char *UnixFileName;
#ifdef DEBUG_FILE dprintf_file(stddeb, "_lcreat: filename %s, attributes %d\n",
fprintf(stderr, "_lcreat: filename %s, attributes %d\n",lpszFilename, lpszFilename, fnAttribute);
fnAttribute);
#endif
if ((UnixFileName = GetUnixFileName(lpszFilename)) == NULL) if ((UnixFileName = GetUnixFileName(lpszFilename)) == NULL)
return HFILE_ERROR; return HFILE_ERROR;
handle = open (UnixFileName, O_CREAT | O_TRUNC | O_WRONLY, 426); handle = open (UnixFileName, O_CREAT | O_TRUNC | O_WRONLY, 426);
@ -348,9 +333,7 @@ INT _lcreat (LPSTR lpszFilename, INT fnAttribute)
UINT GetDriveType(INT drive) UINT GetDriveType(INT drive)
{ {
#ifdef DEBUG_FILE dprintf_file(stddeb,"GetDriveType %c:\n",'A'+drive);
fprintf(stderr,"GetDriveType %c:\n",'A'+drive);
#endif
if (!DOS_ValidDrive(drive)) if (!DOS_ValidDrive(drive))
return DRIVE_DOESNOTEXIST; return DRIVE_DOESNOTEXIST;
@ -366,9 +349,7 @@ UINT GetDriveType(INT drive)
***************************************************************************/ ***************************************************************************/
BYTE GetTempDrive(BYTE chDriveLetter) BYTE GetTempDrive(BYTE chDriveLetter)
{ {
#ifdef DEBUG_FILE dprintf_file(stddeb,"GetTempDrive (%d)\n",chDriveLetter);
fprintf(stderr,"GetTempDrive (%d)\n",chDriveLetter);
#endif
return('C'); return('C');
} }
@ -382,9 +363,7 @@ UINT GetWindowsDirectory(LPSTR lpszSysPath, UINT cbSysPath)
else else
strcpy(lpszSysPath, WindowsDirectory); strcpy(lpszSysPath, WindowsDirectory);
#ifdef DEBUG_FILE dprintf_file(stddeb,"GetWindowsDirectory (%s)\n",lpszSysPath);
fprintf(stderr,"GetWindowsDirectory (%s)\n",lpszSysPath);
#endif
ChopOffSlash(lpszSysPath); ChopOffSlash(lpszSysPath);
return(strlen(lpszSysPath)); return(strlen(lpszSysPath));
@ -399,9 +378,7 @@ UINT GetSystemDirectory(LPSTR lpszSysPath, UINT cbSysPath)
else else
strcpy(lpszSysPath, SystemDirectory); strcpy(lpszSysPath, SystemDirectory);
#ifdef DEBUG_FILE dprintf_file(stddeb,"GetSystemDirectory (%s)\n",lpszSysPath);
fprintf(stderr,"GetSystemDirectory (%s)\n",lpszSysPath);
#endif
ChopOffSlash(lpszSysPath); ChopOffSlash(lpszSysPath);
return(strlen(lpszSysPath)); return(strlen(lpszSysPath));
@ -428,10 +405,8 @@ INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP
ToDos(lpszTempFileName); ToDos(lpszTempFileName);
#ifdef DEBUG_FILE dprintf_file(stddeb,"GetTempFilename: %c %s %d => %s\n",bDriveLetter,
fprintf(stderr,"GetTempFilename: %c %s %d => %s\n",bDriveLetter,
lpszPrefixString,uUnique,lpszTempFileName); lpszPrefixString,uUnique,lpszTempFileName);
#endif
if ((handle = _lcreat (lpszTempFileName, 0x0000)) == -1) { if ((handle = _lcreat (lpszTempFileName, 0x0000)) == -1) {
fprintf(stderr,"GetTempFilename: can't create temp file '%s' !\n", lpszTempFileName); fprintf(stderr,"GetTempFilename: can't create temp file '%s' !\n", lpszTempFileName);
} }
@ -446,7 +421,7 @@ INT GetTempFileName(BYTE bDriveLetter, LPCSTR lpszPrefixString, UINT uUnique, LP
***************************************************************************/ ***************************************************************************/
WORD SetErrorMode(WORD x) WORD SetErrorMode(WORD x)
{ {
fprintf(stderr,"wine: SetErrorMode %4x (ignored)\n",x); dprintf_file(stdnimp,"wine: SetErrorMode %4x (ignored)\n",x);
} }
/*************************************************************************** /***************************************************************************

View file

@ -3,16 +3,21 @@ static char Copyright[] = "Copyright Scott A. Laird, Erik Bos 1993, 1994";
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include "prototypes.h" #include "prototypes.h"
#include "windows.h" #include "windows.h"
#include "keyboard.h" #include "keyboard.h"
#include "stddebug.h"
/* #define DEBUG_KEYBOARD /* */
/* #undef DEBUG_KEYBOARD /* */
#include "debug.h"
int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState, int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
LPVOID lpChar, WORD wFlags) LPVOID lpChar, WORD wFlags)
{ {
int i; int i;
printf("ToAscii (%d,%d)\n",wVirtKey, wScanCode); dprintf_keyboard(stddeb,"ToAscii (%d,%d)\n",wVirtKey, wScanCode);
/* FIXME: this is not sufficient but better than returing -1 */ /* FIXME: this is not sufficient but better than returing -1 */
@ -29,7 +34,7 @@ int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
DWORD OemKeyScan(WORD wOemChar) DWORD OemKeyScan(WORD wOemChar)
{ {
printf("*OemKeyScan (%d)\n",wOemChar); dprintf_keyboard(stddeb,"*OemKeyScan (%d)\n",wOemChar);
return wOemChar; return wOemChar;
} }
@ -41,7 +46,7 @@ WORD VkKeyScan(WORD cChar)
{ {
int i; int i;
printf("VkKeyScan (%d)\n",cChar); dprintf_keyboard(stddeb,"VkKeyScan (%d)\n",cChar);
for (i = 0 ; i != KeyTableSize ; i++) for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].ASCII == cChar) if (KeyTable[i].ASCII == cChar)
@ -52,7 +57,7 @@ WORD VkKeyScan(WORD cChar)
int GetKeyboardType(int nTypeFlag) int GetKeyboardType(int nTypeFlag)
{ {
printf("GetKeyboardType(%d)\n",nTypeFlag); dprintf_keyboard(stddeb,"GetKeyboardType(%d)\n",nTypeFlag);
switch(nTypeFlag) switch(nTypeFlag)
{ {
case 0: /* Keyboard type */ case 0: /* Keyboard type */
@ -104,7 +109,7 @@ WORD MapVirtualKey(WORD wCode, WORD wMapType)
int GetKbCodePage(void) int GetKbCodePage(void)
{ {
printf("GetKbCodePage()\n"); dprintf_keyboard(stddeb,"GetKbCodePage()\n");
return 850; return 850;
} }
@ -112,7 +117,7 @@ int GetKeyNameText(LONG lParam, LPSTR lpBuffer, int nSize)
{ {
int i; int i;
printf("GetKeyNameText(%d,<ptr>, %d)\n",lParam,nSize); dprintf_keyboard(stddeb,"GetKeyNameText(%d,<ptr>, %d)\n",lParam,nSize);
lParam >>= 16; lParam >>= 16;
lParam &= 0xff; lParam &= 0xff;

View file

@ -100,8 +100,8 @@ LPSTR AnsiUpper(LPSTR strOrChar)
} }
return strOrChar; return strOrChar;
} else } else
if (IsCharLower((char) strOrChar)) if (IsCharLower((int)strOrChar))
return (LPSTR) ToUpper(strOrChar); return (LPSTR) ToUpper((int)strOrChar);
else else
return (LPSTR) strOrChar; return (LPSTR) strOrChar;
} }
@ -133,8 +133,8 @@ LPSTR AnsiLower(LPSTR strOrChar)
} }
return strOrChar; return strOrChar;
} else } else
if (IsCharUpper((char) strOrChar)) if (IsCharUpper((int)strOrChar))
return (LPSTR) ToLower(strOrChar); return (LPSTR) ToLower((int)strOrChar);
else else
return (LPSTR) strOrChar; return (LPSTR) strOrChar;
} }

View file

@ -9,6 +9,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#include <locale.h> #include <locale.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xresource.h> #include <X11/Xresource.h>
@ -19,6 +20,9 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include "options.h" #include "options.h"
#include "prototypes.h" #include "prototypes.h"
#include "texts.h" #include "texts.h"
#define DEBUG_DEFINE_VARIABLES
#include "stddebug.h"
#include "debug.h"
#define WINE_CLASS "Wine" /* Class name for resources */ #define WINE_CLASS "Wine" /* Class name for resources */
@ -33,8 +37,6 @@ typedef ENVENTRY *LPENVENTRY;
LPENVENTRY lpEnvList = NULL; LPENVENTRY lpEnvList = NULL;
Display * XT_display; /* To be removed */
Display *display; Display *display;
Screen *screen; Screen *screen;
Window rootWindow; Window rootWindow;
@ -42,7 +44,6 @@ int screenWidth = 0, screenHeight = 0; /* Desktop window dimensions */
int screenDepth = 0; /* Screen depth to use */ int screenDepth = 0; /* Screen depth to use */
int desktopX = 0, desktopY = 0; /* Desktop window position (if any) */ int desktopX = 0, desktopY = 0; /* Desktop window position (if any) */
char *ProgramName; /* Used by resource.c with WINELIB */
extern ButtonTexts ButtonText; extern ButtonTexts ButtonText;
struct options Options = struct options Options =
@ -70,7 +71,8 @@ static XrmOptionDescRec optionsTable[] =
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" }, { "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL }, { "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" }, { "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" } { "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" },
{ "-debugmsg", ".debugmsg", XrmoptionSepArg, (caddr_t)NULL }
}; };
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0])) #define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
@ -89,7 +91,8 @@ static XrmOptionDescRec optionsTable[] =
" -synchronous Turn on synchronous display mode\n" \ " -synchronous Turn on synchronous display mode\n" \
" -backingstore Turn on backing store\n" \ " -backingstore Turn on backing store\n" \
" -spy file Turn on message spying to the specified file\n" \ " -spy file Turn on message spying to the specified file\n" \
" -relaydbg Display call relay information\n" " -relaydbg Display call relay information\n" \
" -debugmsg name Turn debugging-messages on or off\n"
/*********************************************************************** /***********************************************************************
@ -232,9 +235,6 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
exit(1); exit(1);
} }
/* Use app-defaults */
display->db = db;
/* Get all options */ /* Get all options */
if (MAIN_GetResource( db, ".iconic", &value )) if (MAIN_GetResource( db, ".iconic", &value ))
Options.cmdShow = SW_SHOWMINIMIZED; Options.cmdShow = SW_SHOWMINIMIZED;
@ -254,6 +254,49 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
screenDepth = atoi( value.addr ); screenDepth = atoi( value.addr );
if (MAIN_GetResource( db, ".desktop", &value)) if (MAIN_GetResource( db, ".desktop", &value))
Options.desktopGeometry = value.addr; Options.desktopGeometry = value.addr;
if (MAIN_GetResource( db, ".debugmsg", &value))
{
#ifndef DEBUG_RUNTIME
fprintf(stderr,"%s: Option \"-debugmsg\" not implemented.\n" \
" Recompile with DEBUG_RUNTIME in include/stddebug.h defined.\n",
argv[0]);
exit(1);
#else
char *p=(char*)value.addr;
if (strlen(p)<3)
goto msgerror;
if ((*p!='+')&&(*p!='-'))
goto msgerror;
if (!strcasecmp(p+1,"all"))
{
int i;
for (i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
debug_msg_enabled[i]=(*p=='+');
}
else
{
int i;
for (i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
if (debug_msg_name && (!strcasecmp(p+1,debug_msg_name[i])))
{
debug_msg_enabled[i]=(*p=='+');
break;
}
if (i==sizeof(debug_msg_enabled)/sizeof(short))
{
msgerror:
fprintf(stderr,"%s: Syntax: -debugmsg +xxx or -debugmsg -xxx with xxx one of\n",argv[0]);
fprintf(stderr,"%-9s ","all");
for(i=0;i<sizeof(debug_msg_enabled)/sizeof(short);i++)
if(debug_msg_name[i])
fprintf(stderr,"%-9s%c",debug_msg_name[i],
(((i+2)%8==0)?'\n':' '));
fprintf(stderr,"\n\n");
exit(1);
}
}
#endif
}
/* MAIN_GetAllButtonTexts(db); */ /* MAIN_GetAllButtonTexts(db); */
@ -371,7 +414,6 @@ int main( int argc, char *argv[] )
screen = DefaultScreenOfDisplay( display ); screen = DefaultScreenOfDisplay( display );
screenWidth = WidthOfScreen( screen ); screenWidth = WidthOfScreen( screen );
screenHeight = HeightOfScreen( screen ); screenHeight = HeightOfScreen( screen );
XT_display = display;
if (screenDepth) /* -depth option specified */ if (screenDepth) /* -depth option specified */
{ {
depth_list = XListDepths(display,DefaultScreen(display),&depth_count); depth_list = XListDepths(display,DefaultScreen(display),&depth_count);
@ -390,7 +432,6 @@ int main( int argc, char *argv[] )
if (Options.desktopGeometry) MAIN_CreateDesktop( argc, argv ); if (Options.desktopGeometry) MAIN_CreateDesktop( argc, argv );
else rootWindow = DefaultRootWindow( display ); else rootWindow = DefaultRootWindow( display );
ProgramName = argv [0];
MAIN_SaveSetup(); MAIN_SaveSetup();
DOS_InitFS(); DOS_InitFS();
Comm_Init(); Comm_Init();
@ -690,3 +731,11 @@ BOOL IsRomModule(HANDLE x)
return FALSE; return FALSE;
} }
/***********************************************************************
* FileCDR (KERNEL.130)
*/
void FileCDR(FARPROC x)
{
printf("FileCDR(%8x)\n", (int) x);
}

View file

@ -11,18 +11,21 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#ifdef BUILTIN_MMSYSTEM #ifdef BUILTIN_MMSYSTEM
/* #include <stdio.h>
#define DEBUG_CDAUDIO #include <stdlib.h>
*/ #include <unistd.h>
#include <string.h>
#include "stdio.h" #include <fcntl.h>
#include <sys/ioctl.h>
#include "win.h" #include "win.h"
#include "user.h" #include "user.h"
#include "driver.h" #include "driver.h"
#include "mmsystem.h" #include "mmsystem.h"
#include "stddebug.h"
/* #define DEBUG_CDAUDIO /* */
/* #undef DEBUG_CDAUDIO /* */
#include "debug.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#ifdef linux #ifdef linux
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
@ -84,9 +87,8 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
#ifdef linux #ifdef linux
UINT wDevID; UINT wDevID;
int cdrom; int cdrom;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciOpen(%08X, %08X);\n",
printf("CDAUDIO_mciOpen(%08X, %08X);\n", dwFlags, lpParms); dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
wDevID = lpParms->wDeviceID; wDevID = lpParms->wDeviceID;
if (CDADev[wDevID].nUseCount > 0) { if (CDADev[wDevID].nUseCount > 0) {
@ -103,14 +105,14 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
CDADev[wDevID].fShareable = dwFlags & MCI_OPEN_SHAREABLE; CDADev[wDevID].fShareable = dwFlags & MCI_OPEN_SHAREABLE;
} }
if (dwFlags & MCI_OPEN_ELEMENT) { if (dwFlags & MCI_OPEN_ELEMENT) {
printf("CDAUDIO_mciOpen // MCI_OPEN_ELEMENT !\n"); dprintf_cdaudio(stddeb,"CDAUDIO_mciOpen // MCI_OPEN_ELEMENT !\n");
/* return MCIERR_NO_ELEMENT_ALLOWED; */ /* return MCIERR_NO_ELEMENT_ALLOWED; */
} }
memcpy(&CDADev[wDevID].openParms, lpParms, sizeof(MCI_OPEN_PARMS)); memcpy(&CDADev[wDevID].openParms, lpParms, sizeof(MCI_OPEN_PARMS));
CDADev[wDevID].wNotifyDeviceID = lpParms->wDeviceID; CDADev[wDevID].wNotifyDeviceID = lpParms->wDeviceID;
CDADev[wDevID].unixdev = open (CDAUDIO_DEV, O_RDONLY, 0); CDADev[wDevID].unixdev = open (CDAUDIO_DEV, O_RDONLY, 0);
if (CDADev[wDevID].unixdev == -1) { if (CDADev[wDevID].unixdev == -1) {
printf("CDAUDIO_mciOpen // can't open '%s' !\n", CDAUDIO_DEV); fprintf(stderr,"CDAUDIO_mciOpen // can't open '%s' !\n", CDAUDIO_DEV);
return MCIERR_HARDWARE; return MCIERR_HARDWARE;
} }
CDADev[wDevID].mode = 0; CDADev[wDevID].mode = 0;
@ -122,11 +124,13 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
CDADev[wDevID].lpdwTrackLen = NULL; CDADev[wDevID].lpdwTrackLen = NULL;
CDADev[wDevID].lpdwTrackPos = NULL; CDADev[wDevID].lpdwTrackPos = NULL;
if (!CDAUDIO_GetTracksInfo(wDevID)) { if (!CDAUDIO_GetTracksInfo(wDevID)) {
printf("CDAUDIO_mciOpen // error reading TracksInfo !\n"); fprintf(stderr,"CDAUDIO_mciOpen // error reading TracksInfo !\n");
/* return MCIERR_INTERNAL; */ /* return MCIERR_INTERNAL; */
} }
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciOpen // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciOpen // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -142,9 +146,8 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
DWORD CDAUDIO_mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciClose(%u, %08X, %08X);\n",
printf("CDAUDIO_mciClose(%u, %08X, %08X);\n", wDevID, dwParam, lpParms); wDevID, dwParam, lpParms);
#endif
if (CDADev[wDevID].lpdwTrackLen != NULL) free(CDADev[wDevID].lpdwTrackLen); if (CDADev[wDevID].lpdwTrackLen != NULL) free(CDADev[wDevID].lpdwTrackLen);
if (CDADev[wDevID].lpdwTrackPos != NULL) free(CDADev[wDevID].lpdwTrackPos); if (CDADev[wDevID].lpdwTrackPos != NULL) free(CDADev[wDevID].lpdwTrackPos);
close(CDADev[wDevID].unixdev); close(CDADev[wDevID].unixdev);
@ -158,12 +161,12 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
LPMCI_GETDEVCAPS_PARMS lpParms) LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciGetDevCaps(%u, %08X, %08X);\n",
printf("CDAUDIO_mciGetDevCaps(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (dwFlags & MCI_GETDEVCAPS_ITEM) { if (dwFlags & MCI_GETDEVCAPS_ITEM) {
printf("CDAUDIO_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08X;\n", dprintf_cdaudio(stddeb,
"CDAUDIO_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08X;\n",
lpParms->dwItem); lpParms->dwItem);
switch(lpParms->dwItem) { switch(lpParms->dwItem) {
case MCI_GETDEVCAPS_CAN_RECORD: case MCI_GETDEVCAPS_CAN_RECORD:
@ -197,7 +200,9 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} }
printf("CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08X;\n", lpParms->dwReturn); dprintf_cdaudio(stddeb,
"CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08X;\n",
lpParms->dwReturn);
return 0; return 0;
#else #else
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
@ -210,9 +215,8 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms) DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciInfo(%u, %08X, %08X);\n",
printf("CDAUDIO_mciInfo(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
lpParms->lpstrReturn = NULL; lpParms->lpstrReturn = NULL;
switch(dwFlags) { switch(dwFlags) {
@ -238,15 +242,14 @@ DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms)
DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus(%u, %08X, %08X);\n",
printf("CDAUDIO_mciStatus(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (CDADev[wDevID].unixdev == 0) return MMSYSERR_NOTENABLED; if (CDADev[wDevID].unixdev == 0) return MMSYSERR_NOTENABLED;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_mciStatus // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); "CDAUDIO_mciStatus // MCI_NOTIFY_SUCCESSFUL %08X !\n",
#endif lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -255,19 +258,17 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
case MCI_STATUS_CURRENT_TRACK: case MCI_STATUS_CURRENT_TRACK:
if (!CDAUDIO_GetCDStatus(wDevID)) return MCIERR_INTERNAL; if (!CDAUDIO_GetCDStatus(wDevID)) return MCIERR_INTERNAL;
lpParms->dwReturn = CDADev[wDevID].nCurTrack; lpParms->dwReturn = CDADev[wDevID].nCurTrack;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // CURRENT_TRACK=%u!\n", lpParms->dwReturn);
printf("CDAUDIO_mciStatus // CURRENT_TRACK=%u!\n", lpParms->dwReturn);
#endif
return 0; return 0;
case MCI_STATUS_LENGTH: case MCI_STATUS_LENGTH:
if (CDADev[wDevID].nTracks == 0) { if (CDADev[wDevID].nTracks == 0) {
if (!CDAUDIO_GetTracksInfo(wDevID)) { if (!CDAUDIO_GetTracksInfo(wDevID)) {
printf("CDAUDIO_mciStatus // error reading TracksInfo !\n"); fprintf(stderr,"CDAUDIO_mciStatus // error reading TracksInfo !\n");
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
} }
} }
if (dwFlags & MCI_TRACK) { if (dwFlags & MCI_TRACK) {
printf("CDAUDIO_mciStatus // MCI_TRACK #%u LENGTH=??? !\n", dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_TRACK #%u LENGTH=??? !\n",
lpParms->dwTrack); lpParms->dwTrack);
if (lpParms->dwTrack > CDADev[wDevID].nTracks) if (lpParms->dwTrack > CDADev[wDevID].nTracks)
return MCIERR_OUTOFRANGE; return MCIERR_OUTOFRANGE;
@ -277,26 +278,24 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
lpParms->dwReturn = CDADev[wDevID].dwTotalLen; lpParms->dwReturn = CDADev[wDevID].dwTotalLen;
lpParms->dwReturn = CDAUDIO_CalcTime(wDevID, lpParms->dwReturn = CDAUDIO_CalcTime(wDevID,
CDADev[wDevID].dwTimeFormat, lpParms->dwReturn); CDADev[wDevID].dwTimeFormat, lpParms->dwReturn);
printf("CDAUDIO_mciStatus // LENGTH=%u !\n", lpParms->dwReturn); dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // LENGTH=%u !\n", lpParms->dwReturn);
return 0; return 0;
case MCI_STATUS_MODE: case MCI_STATUS_MODE:
if (!CDAUDIO_GetCDStatus(wDevID)) return MCIERR_INTERNAL; if (!CDAUDIO_GetCDStatus(wDevID)) return MCIERR_INTERNAL;
lpParms->dwReturn = CDADev[wDevID].mode; lpParms->dwReturn = CDADev[wDevID].mode;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_MODE=%08X !\n",
printf("CDAUDIO_mciStatus // MCI_STATUS_MODE=%08X !\n",
lpParms->dwReturn); lpParms->dwReturn);
#endif
return 0; return 0;
case MCI_STATUS_MEDIA_PRESENT: case MCI_STATUS_MEDIA_PRESENT:
lpParms->dwReturn = (CDADev[wDevID].nTracks > 0) ? TRUE : FALSE; lpParms->dwReturn = (CDADev[wDevID].nTracks > 0) ? TRUE : FALSE;
if (lpParms->dwReturn == FALSE) if (lpParms->dwReturn == FALSE)
printf("CDAUDIO_mciStatus // MEDIA_NOT_PRESENT !\n"); fprintf(stderr,"CDAUDIO_mciStatus // MEDIA_NOT_PRESENT !\n");
else else
printf("CDAUDIO_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n"); dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
return 0; return 0;
case MCI_STATUS_NUMBER_OF_TRACKS: case MCI_STATUS_NUMBER_OF_TRACKS:
lpParms->dwReturn = CDAUDIO_GetNumberOfTracks(wDevID); lpParms->dwReturn = CDAUDIO_GetNumberOfTracks(wDevID);
printf("CDAUDIO_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %u !\n", dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %u !\n",
lpParms->dwReturn); lpParms->dwReturn);
if (lpParms->dwReturn == (WORD)-1) return MCIERR_INTERNAL; if (lpParms->dwReturn == (WORD)-1) return MCIERR_INTERNAL;
return 0; return 0;
@ -305,39 +304,33 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
lpParms->dwReturn = CDADev[wDevID].dwCurFrame; lpParms->dwReturn = CDADev[wDevID].dwCurFrame;
if (dwFlags & MCI_STATUS_START) { if (dwFlags & MCI_STATUS_START) {
lpParms->dwReturn = CDADev[wDevID].dwFirstOffset; lpParms->dwReturn = CDADev[wDevID].dwFirstOffset;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
printf("CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
#endif
} }
if (dwFlags & MCI_TRACK) { if (dwFlags & MCI_TRACK) {
if (lpParms->dwTrack > CDADev[wDevID].nTracks) if (lpParms->dwTrack > CDADev[wDevID].nTracks)
return MCIERR_OUTOFRANGE; return MCIERR_OUTOFRANGE;
lpParms->dwReturn = CDADev[wDevID].lpdwTrackPos[lpParms->dwTrack - 1]; lpParms->dwReturn = CDADev[wDevID].lpdwTrackPos[lpParms->dwTrack - 1];
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // get MCI_TRACK #%u !\n", lpParms->dwTrack);
printf("CDAUDIO_mciStatus // get MCI_TRACK #%u !\n", lpParms->dwTrack);
#endif
} }
lpParms->dwReturn = CDAUDIO_CalcTime(wDevID, lpParms->dwReturn = CDAUDIO_CalcTime(wDevID,
CDADev[wDevID].dwTimeFormat, lpParms->dwReturn); CDADev[wDevID].dwTimeFormat, lpParms->dwReturn);
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_POSITION=%08X !\n",
printf("CDAUDIO_mciStatus // MCI_STATUS_POSITION=%08X !\n",
lpParms->dwReturn); lpParms->dwReturn);
#endif
return 0; return 0;
case MCI_STATUS_READY: case MCI_STATUS_READY:
printf("CDAUDIO_mciStatus // MCI_STATUS_READY !\n"); dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_READY !\n");
lpParms->dwReturn = TRUE; lpParms->dwReturn = TRUE;
return 0; return 0;
case MCI_STATUS_TIME_FORMAT: case MCI_STATUS_TIME_FORMAT:
printf("CDAUDIO_mciStatus // MCI_STATUS_TIME_FORMAT !\n"); dprintf_cdaudio(stddeb,"CDAUDIO_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
lpParms->dwReturn = MCI_FORMAT_MILLISECONDS; lpParms->dwReturn = MCI_FORMAT_MILLISECONDS;
return 0; return 0;
default: default:
printf("CDAUDIO_mciStatus // unknowm command %04X !\n", lpParms->dwItem); fprintf(stderr,"CDAUDIO_mciStatus // unknown command %04X !\n", lpParms->dwItem);
return MCIERR_UNRECOGNIZED_COMMAND; return MCIERR_UNRECOGNIZED_COMMAND;
} }
} }
printf("CDAUDIO_mciStatus // not MCI_STATUS_ITEM !\n"); fprintf(stderr,"CDAUDIO_mciStatus // not MCI_STATUS_ITEM !\n");
return 0; return 0;
#else #else
return MMSYSERR_NOTENABLED; return MMSYSERR_NOTENABLED;
@ -356,16 +349,15 @@ DWORD CDAUDIO_CalcTime(UINT wDevID, DWORD dwFormatType, DWORD dwFrame)
UINT wMinutes; UINT wMinutes;
UINT wSeconds; UINT wSeconds;
UINT wFrames; UINT wFrames;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_CalcTime(%u, %08X, %lu);\n",
printf("CDAUDIO_CalcTime(%u, %08X, %lu);\n", wDevID, dwFormatType, dwFrame); wDevID, dwFormatType, dwFrame);
#endif
TryAGAIN: TryAGAIN:
switch (dwFormatType) { switch (dwFormatType) {
case MCI_FORMAT_MILLISECONDS: case MCI_FORMAT_MILLISECONDS:
dwTime = dwFrame / CDFRAMES_PERSEC * 1000; dwTime = dwFrame / CDFRAMES_PERSEC * 1000;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_CalcTime // MILLISECONDS %u\n", dwTime); "CDAUDIO_CalcTime // MILLISECONDS %u\n",
#endif dwTime);
break; break;
case MCI_FORMAT_MSF: case MCI_FORMAT_MSF:
wMinutes = dwFrame / CDFRAMES_PERMIN; wMinutes = dwFrame / CDFRAMES_PERMIN;
@ -373,10 +365,8 @@ TryAGAIN:
wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes -
CDFRAMES_PERSEC * wSeconds; CDFRAMES_PERSEC * wSeconds;
dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames); dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_CalcTime // MSF %02u:%02u:%02u -> dwTime=%u\n",
printf("CDAUDIO_CalcTime // MSF %02u:%02u:%02u -> dwTime=%u\n",
wMinutes, wSeconds, wFrames, dwTime); wMinutes, wSeconds, wFrames, dwTime);
#endif
break; break;
case MCI_FORMAT_TMSF: case MCI_FORMAT_TMSF:
for (wTrack = 0; wTrack < CDADev[wDevID].nTracks; wTrack++) { for (wTrack = 0; wTrack < CDADev[wDevID].nTracks; wTrack++) {
@ -390,10 +380,9 @@ TryAGAIN:
wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes - wFrames = dwFrame - CDFRAMES_PERMIN * wMinutes -
CDFRAMES_PERSEC * wSeconds; CDFRAMES_PERSEC * wSeconds;
dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames); dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_CalcTime // %02u-%02u:%02u:%02u\n", "CDAUDIO_CalcTime // %02u-%02u:%02u:%02u\n",
wTrack, wMinutes, wSeconds, wFrames); wTrack, wMinutes, wSeconds, wFrames);
#endif
break; break;
default: default:
/* unknown format ! force TMSF ! ... */ /* unknown format ! force TMSF ! ... */
@ -413,36 +402,34 @@ DWORD CDAUDIO_CalcFrame(UINT wDevID, DWORD dwFormatType, DWORD dwTime)
DWORD dwFrame = 0; DWORD dwFrame = 0;
#ifdef linux #ifdef linux
UINT wTrack; UINT wTrack;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_CalcFrame(%u, %08X, %lu);\n",
printf("CDAUDIO_CalcFrame(%u, %08X, %lu);\n", wDevID, dwFormatType, dwTime); wDevID, dwFormatType, dwTime);
#endif
TryAGAIN: TryAGAIN:
switch (dwFormatType) { switch (dwFormatType) {
case MCI_FORMAT_MILLISECONDS: case MCI_FORMAT_MILLISECONDS:
dwFrame = dwTime * CDFRAMES_PERSEC / 1000; dwFrame = dwTime * CDFRAMES_PERSEC / 1000;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_CalcFrame // MILLISECONDS %u\n", dwFrame); "CDAUDIO_CalcFrame // MILLISECONDS %u\n",
#endif dwFrame);
break; break;
case MCI_FORMAT_MSF: case MCI_FORMAT_MSF:
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_CalcFrame // MSF %02u:%02u:%02u\n", "CDAUDIO_CalcFrame // MSF %02u:%02u:%02u\n",
MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime), MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime),
MCI_MSF_FRAME(dwTime)); MCI_MSF_FRAME(dwTime));
#endif
dwFrame += CDFRAMES_PERMIN * MCI_MSF_MINUTE(dwTime); dwFrame += CDFRAMES_PERMIN * MCI_MSF_MINUTE(dwTime);
dwFrame += CDFRAMES_PERSEC * MCI_MSF_SECOND(dwTime); dwFrame += CDFRAMES_PERSEC * MCI_MSF_SECOND(dwTime);
dwFrame += MCI_MSF_FRAME(dwTime); dwFrame += MCI_MSF_FRAME(dwTime);
break; break;
case MCI_FORMAT_TMSF: case MCI_FORMAT_TMSF:
wTrack = MCI_TMSF_TRACK(dwTime); wTrack = MCI_TMSF_TRACK(dwTime);
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_CalcFrame // TMSF %02u-%02u:%02u:%02u\n", "CDAUDIO_CalcFrame // TMSF %02u-%02u:%02u:%02u\n",
MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime), MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime),
MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime)); MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
printf("CDAUDIO_CalcFrame // TMSF trackpos[%u]=%u\n", dprintf_cdaudio(stddeb,
"CDAUDIO_CalcFrame // TMSF trackpos[%u]=%u\n",
wTrack, CDADev[wDevID].lpdwTrackPos[wTrack - 1]); wTrack, CDADev[wDevID].lpdwTrackPos[wTrack - 1]);
#endif
dwFrame = CDADev[wDevID].lpdwTrackPos[wTrack - 1]; dwFrame = CDADev[wDevID].lpdwTrackPos[wTrack - 1];
dwFrame += CDFRAMES_PERMIN * MCI_TMSF_MINUTE(dwTime); dwFrame += CDFRAMES_PERMIN * MCI_TMSF_MINUTE(dwTime);
dwFrame += CDFRAMES_PERSEC * MCI_TMSF_SECOND(dwTime); dwFrame += CDFRAMES_PERSEC * MCI_TMSF_SECOND(dwTime);
@ -467,7 +454,9 @@ UINT CDAUDIO_GetNumberOfTracks(UINT wDevID)
struct cdrom_tochdr hdr; struct cdrom_tochdr hdr;
if (CDADev[wDevID].nTracks == 0) { if (CDADev[wDevID].nTracks == 0) {
if (ioctl(CDADev[wDevID].unixdev, CDROMREADTOCHDR, &hdr)) { if (ioctl(CDADev[wDevID].unixdev, CDROMREADTOCHDR, &hdr)) {
printf("GetNumberOfTracks(%u) // Error occured !\n", wDevID); fprintf(stderr,
"GetNumberOfTracks(%u) // Error occured !\n",
wDevID);
return (WORD)-1; return (WORD)-1;
} }
CDADev[wDevID].nTracks = hdr.cdth_trk1; CDADev[wDevID].nTracks = hdr.cdth_trk1;
@ -491,7 +480,8 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
if (CDADev[wDevID].nTracks == 0) { if (CDADev[wDevID].nTracks == 0) {
if (CDAUDIO_GetNumberOfTracks(wDevID) == (WORD)-1) return FALSE; if (CDAUDIO_GetNumberOfTracks(wDevID) == (WORD)-1) return FALSE;
} }
printf("CDAUDIO_GetTracksInfo // nTracks=%u\n", CDADev[wDevID].nTracks); dprintf_cdaudio(stddeb,"CDAUDIO_GetTracksInfo // nTracks=%u\n",
CDADev[wDevID].nTracks);
if (CDADev[wDevID].lpdwTrackLen != NULL) if (CDADev[wDevID].lpdwTrackLen != NULL)
free(CDADev[wDevID].lpdwTrackLen); free(CDADev[wDevID].lpdwTrackLen);
CDADev[wDevID].lpdwTrackLen = (LPDWORD)malloc( CDADev[wDevID].lpdwTrackLen = (LPDWORD)malloc(
@ -502,7 +492,8 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
(CDADev[wDevID].nTracks + 1) * sizeof(DWORD)); (CDADev[wDevID].nTracks + 1) * sizeof(DWORD));
if (CDADev[wDevID].lpdwTrackLen == NULL || if (CDADev[wDevID].lpdwTrackLen == NULL ||
CDADev[wDevID].lpdwTrackPos == NULL) { CDADev[wDevID].lpdwTrackPos == NULL) {
printf("CDAUDIO_GetTracksInfo // error allocating track table !\n"); fprintf(stderr,
"CDAUDIO_GetTracksInfo // error allocating track table !\n");
return FALSE; return FALSE;
} }
memset(CDADev[wDevID].lpdwTrackLen, 0, memset(CDADev[wDevID].lpdwTrackLen, 0,
@ -516,7 +507,8 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
entry.cdte_track = i + 1; entry.cdte_track = i + 1;
entry.cdte_format = CDROM_MSF; entry.cdte_format = CDROM_MSF;
if (ioctl(CDADev[wDevID].unixdev, CDROMREADTOCENTRY, &entry)) { if (ioctl(CDADev[wDevID].unixdev, CDROMREADTOCENTRY, &entry)) {
printf("CDAUDIO_GetTracksInfo // error read entry\n"); fprintf(stderr,
"CDAUDIO_GetTracksInfo // error read entry\n");
return FALSE; return FALSE;
} }
start = CDFRAMES_PERSEC * (SECONDS_PERMIN * start = CDFRAMES_PERSEC * (SECONDS_PERMIN *
@ -524,7 +516,9 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
entry.cdte_addr.msf.frame; entry.cdte_addr.msf.frame;
if (i == 0) { if (i == 0) {
CDADev[wDevID].dwFirstOffset = last_start = start; CDADev[wDevID].dwFirstOffset = last_start = start;
printf("CDAUDIO_GetTracksInfo // dwFirstOffset=%u\n", start); dprintf_cdaudio(stddeb,
"CDAUDIO_GetTracksInfo // dwFirstOffset=%u\n",
start);
} }
else { else {
length = start - last_start; length = start - last_start;
@ -533,12 +527,14 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
total_length += length; total_length += length;
CDADev[wDevID].lpdwTrackLen[i - 1] = length; CDADev[wDevID].lpdwTrackLen[i - 1] = length;
CDADev[wDevID].lpdwTrackPos[i - 1] = start; CDADev[wDevID].lpdwTrackPos[i - 1] = start;
printf("CDAUDIO_GetTracksInfo // track #%u start=%u len=%u\n", dprintf_cdaudio(stddeb,
"CDAUDIO_GetTracksInfo // track #%u start=%u len=%u\n",
i, start, length); i, start, length);
} }
} }
CDADev[wDevID].dwTotalLen = total_length; CDADev[wDevID].dwTotalLen = total_length;
printf("CDAUDIO_GetTracksInfo // total_len=%u\n", total_length); dprintf_cdaudio(stddeb,"CDAUDIO_GetTracksInfo // total_len=%u\n",
total_length);
fflush(stdout); fflush(stdout);
return TRUE; return TRUE;
#else #else
@ -556,36 +552,28 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID)
int oldmode = CDADev[wDevID].mode; int oldmode = CDADev[wDevID].mode;
CDADev[wDevID].sc.cdsc_format = CDROM_MSF; CDADev[wDevID].sc.cdsc_format = CDROM_MSF;
if (ioctl(CDADev[wDevID].unixdev, CDROMSUBCHNL, &CDADev[wDevID].sc)) { if (ioctl(CDADev[wDevID].unixdev, CDROMSUBCHNL, &CDADev[wDevID].sc)) {
#ifdef DEBUG_CDAUDIO fprintf(stderr,"CDAUDIO_GetCDStatus // opened or no_media !\n");
printf("CDAUDIO_GetCDStatus // opened or no_media !\n");
#endif
CDADev[wDevID].mode = MCI_MODE_NOT_READY; CDADev[wDevID].mode = MCI_MODE_NOT_READY;
return TRUE; return TRUE;
} }
switch (CDADev[wDevID].sc.cdsc_audiostatus) { switch (CDADev[wDevID].sc.cdsc_audiostatus) {
case CDROM_AUDIO_INVALID: case CDROM_AUDIO_INVALID:
printf("CDAUDIO_GetCDStatus // device doesn't support status !\n"); fprintf(stderr,"CDAUDIO_GetCDStatus // device doesn't support status !\n");
return FALSE; return FALSE;
case CDROM_AUDIO_NO_STATUS: case CDROM_AUDIO_NO_STATUS:
CDADev[wDevID].mode = MCI_MODE_STOP; CDADev[wDevID].mode = MCI_MODE_STOP;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // MCI_MODE_STOP !\n");
printf("CDAUDIO_GetCDStatus // MCI_MODE_STOP !\n");
#endif
break; break;
case CDROM_AUDIO_PLAY: case CDROM_AUDIO_PLAY:
CDADev[wDevID].mode = MCI_MODE_PLAY; CDADev[wDevID].mode = MCI_MODE_PLAY;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // MCI_MODE_PLAY !\n");
printf("CDAUDIO_GetCDStatus // MCI_MODE_PLAY !\n");
#endif
break; break;
case CDROM_AUDIO_PAUSED: case CDROM_AUDIO_PAUSED:
CDADev[wDevID].mode = MCI_MODE_PAUSE; CDADev[wDevID].mode = MCI_MODE_PAUSE;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // MCI_MODE_PAUSE !\n");
printf("CDAUDIO_GetCDStatus // MCI_MODE_PAUSE !\n");
#endif
break; break;
default: default:
printf("CDAUDIO_GetCDStatus // status=%02X !\n", dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // status=%02X !\n",
CDADev[wDevID].sc.cdsc_audiostatus); CDADev[wDevID].sc.cdsc_audiostatus);
} }
CDADev[wDevID].nCurTrack = CDADev[wDevID].sc.cdsc_trk; CDADev[wDevID].nCurTrack = CDADev[wDevID].sc.cdsc_trk;
@ -593,16 +581,14 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID)
CDFRAMES_PERMIN * CDADev[wDevID].sc.cdsc_absaddr.msf.minute + CDFRAMES_PERMIN * CDADev[wDevID].sc.cdsc_absaddr.msf.minute +
CDFRAMES_PERSEC * CDADev[wDevID].sc.cdsc_absaddr.msf.second + CDFRAMES_PERSEC * CDADev[wDevID].sc.cdsc_absaddr.msf.second +
CDADev[wDevID].sc.cdsc_absaddr.msf.frame; CDADev[wDevID].sc.cdsc_absaddr.msf.frame;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_GetCDStatus // %02u-%02u:%02u:%02u \n",
printf("CDAUDIO_GetCDStatus // %02u-%02u:%02u:%02u \n",
CDADev[wDevID].sc.cdsc_trk, CDADev[wDevID].sc.cdsc_trk,
CDADev[wDevID].sc.cdsc_absaddr.msf.minute, CDADev[wDevID].sc.cdsc_absaddr.msf.minute,
CDADev[wDevID].sc.cdsc_absaddr.msf.second, CDADev[wDevID].sc.cdsc_absaddr.msf.second,
CDADev[wDevID].sc.cdsc_absaddr.msf.frame); CDADev[wDevID].sc.cdsc_absaddr.msf.frame);
#endif
if (oldmode != CDADev[wDevID].mode && oldmode == MCI_MODE_OPEN) { if (oldmode != CDADev[wDevID].mode && oldmode == MCI_MODE_OPEN) {
if (!CDAUDIO_GetTracksInfo(wDevID)) { if (!CDAUDIO_GetTracksInfo(wDevID)) {
printf("CDAUDIO_GetCDStatus // error updating TracksInfo !\n"); fprintf(stderr,"CDAUDIO_GetCDStatus // error updating TracksInfo !\n");
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
} }
} }
@ -620,9 +606,8 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
#ifdef linux #ifdef linux
int start, end; int start, end;
struct cdrom_msf msf; struct cdrom_msf msf;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay(%u, %08X, %08X);\n",
printf("CDAUDIO_mciPlay(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (CDADev[wDevID].unixdev == 0) return MMSYSERR_NOTENABLED; if (CDADev[wDevID].unixdev == 0) return MMSYSERR_NOTENABLED;
start = 0; end = CDADev[wDevID].dwTotalLen; start = 0; end = CDADev[wDevID].dwTotalLen;
@ -630,18 +615,15 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
if (dwFlags & MCI_FROM) { if (dwFlags & MCI_FROM) {
start = CDAUDIO_CalcFrame(wDevID, start = CDAUDIO_CalcFrame(wDevID,
CDADev[wDevID].dwTimeFormat, lpParms->dwFrom); CDADev[wDevID].dwTimeFormat, lpParms->dwFrom);
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay // MCI_FROM=%08X -> %u \n",
printf("CDAUDIO_mciPlay // MCI_FROM=%08X -> %u \n",
lpParms->dwFrom, start); lpParms->dwFrom, start);
#endif
} }
if (dwFlags & MCI_TO) { if (dwFlags & MCI_TO) {
end = CDAUDIO_CalcFrame(wDevID, end = CDAUDIO_CalcFrame(wDevID,
CDADev[wDevID].dwTimeFormat, lpParms->dwTo); CDADev[wDevID].dwTimeFormat, lpParms->dwTo);
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_mciPlay // MCI_TO=%08X -> %u \n", "CDAUDIO_mciPlay // MCI_TO=%08X -> %u \n",
lpParms->dwTo, end); lpParms->dwTo, end);
#endif
} }
start += CDADev[wDevID].dwFirstOffset; start += CDADev[wDevID].dwFirstOffset;
end += CDADev[wDevID].dwFirstOffset; end += CDADev[wDevID].dwFirstOffset;
@ -652,21 +634,21 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
msf.cdmsf_sec1 = (end % CDFRAMES_PERMIN) / CDFRAMES_PERSEC; msf.cdmsf_sec1 = (end % CDFRAMES_PERMIN) / CDFRAMES_PERSEC;
msf.cdmsf_frame1 = end % CDFRAMES_PERSEC; msf.cdmsf_frame1 = end % CDFRAMES_PERSEC;
if (ioctl(CDADev[wDevID].unixdev, CDROMSTART)) { if (ioctl(CDADev[wDevID].unixdev, CDROMSTART)) {
printf("CDAUDIO_mciPlay // motor doesn't start !\n"); fprintf(stderr,"CDAUDIO_mciPlay // motor doesn't start !\n");
return MCIERR_HARDWARE; return MCIERR_HARDWARE;
} }
if (ioctl(CDADev[wDevID].unixdev, CDROMPLAYMSF, &msf)) { if (ioctl(CDADev[wDevID].unixdev, CDROMPLAYMSF, &msf)) {
printf("CDAUDIO_mciPlay // device doesn't play !\n"); fprintf(stderr,"CDAUDIO_mciPlay // device doesn't play !\n");
return MCIERR_HARDWARE; return MCIERR_HARDWARE;
} }
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciPlay // msf = %d:%d:%d %d:%d:%d\n",
printf("CDAUDIO_mciPlay // msf = %d:%d:%d %d:%d:%d\n",
msf.cdmsf_min0, msf.cdmsf_sec0, msf.cdmsf_frame0, msf.cdmsf_min0, msf.cdmsf_sec0, msf.cdmsf_frame0,
msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1); msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1);
#endif
CDADev[wDevID].mode = MCI_MODE_PLAY; CDADev[wDevID].mode = MCI_MODE_PLAY;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciPlay // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciPlay // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -682,14 +664,15 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciStop(%u, %08X, %08X);\n",
printf("CDAUDIO_mciStop(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (ioctl(CDADev[wDevID].unixdev, CDROMSTOP)) return MCIERR_HARDWARE; if (ioctl(CDADev[wDevID].unixdev, CDROMSTOP)) return MCIERR_HARDWARE;
CDADev[wDevID].mode = MCI_MODE_STOP; CDADev[wDevID].mode = MCI_MODE_STOP;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciStop // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciStop // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -705,14 +688,15 @@ DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciPause(%u, %08X, %08X);\n",
printf("CDAUDIO_mciPause(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (ioctl(CDADev[wDevID].unixdev, CDROMPAUSE)) return MCIERR_HARDWARE; if (ioctl(CDADev[wDevID].unixdev, CDROMPAUSE)) return MCIERR_HARDWARE;
CDADev[wDevID].mode = MCI_MODE_PAUSE; CDADev[wDevID].mode = MCI_MODE_PAUSE;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciPause // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciPause // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -728,14 +712,15 @@ DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciResume(%u, %08X, %08X);\n",
printf("CDAUDIO_mciResume(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (ioctl(CDADev[wDevID].unixdev, CDROMRESUME)) return MCIERR_HARDWARE; if (ioctl(CDADev[wDevID].unixdev, CDROMRESUME)) return MCIERR_HARDWARE;
CDADev[wDevID].mode = MCI_MODE_STOP; CDADev[wDevID].mode = MCI_MODE_STOP;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciResume // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciResume // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -753,9 +738,8 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
#ifdef linux #ifdef linux
DWORD dwRet; DWORD dwRet;
MCI_PLAY_PARMS PlayParms; MCI_PLAY_PARMS PlayParms;
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciSeek(%u, %08X, %08X);\n",
printf("CDAUDIO_mciSeek(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
if (ioctl(CDADev[wDevID].unixdev, CDROMRESUME)) return MCIERR_HARDWARE; if (ioctl(CDADev[wDevID].unixdev, CDROMRESUME)) return MCIERR_HARDWARE;
CDADev[wDevID].mode = MCI_MODE_SEEK; CDADev[wDevID].mode = MCI_MODE_SEEK;
@ -774,7 +758,9 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
if (dwRet != 0) return dwRet; if (dwRet != 0) return dwRet;
dwRet = CDAUDIO_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms); dwRet = CDAUDIO_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms);
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciSeek // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciSeek // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -791,9 +777,8 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
{ {
#ifdef linux #ifdef linux
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciSet(%u, %08X, %08X);\n",
printf("CDAUDIO_mciSet(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); wDevID, dwFlags, lpParms);
#endif
if (lpParms == NULL) return MCIERR_INTERNAL; if (lpParms == NULL) return MCIERR_INTERNAL;
/* /*
printf("CDAUDIO_mciSet // dwTimeFormat=%08X\n", lpParms->dwTimeFormat); printf("CDAUDIO_mciSet // dwTimeFormat=%08X\n", lpParms->dwTimeFormat);
@ -802,33 +787,30 @@ DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
if (dwFlags & MCI_SET_TIME_FORMAT) { if (dwFlags & MCI_SET_TIME_FORMAT) {
switch (lpParms->dwTimeFormat) { switch (lpParms->dwTimeFormat) {
case MCI_FORMAT_MILLISECONDS: case MCI_FORMAT_MILLISECONDS:
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,
printf("CDAUDIO_mciSet // MCI_FORMAT_MILLISECONDS !\n"); "CDAUDIO_mciSet // MCI_FORMAT_MILLISECONDS !\n");
#endif
break; break;
case MCI_FORMAT_MSF: case MCI_FORMAT_MSF:
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciSet // MCI_FORMAT_MSF !\n");
printf("CDAUDIO_mciSet // MCI_FORMAT_MSF !\n");
#endif
break; break;
case MCI_FORMAT_TMSF: case MCI_FORMAT_TMSF:
#ifdef DEBUG_CDAUDIO dprintf_cdaudio(stddeb,"CDAUDIO_mciSet // MCI_FORMAT_TMSF !\n");
printf("CDAUDIO_mciSet // MCI_FORMAT_TMSF !\n");
#endif
break; break;
default: default:
printf("CDAUDIO_mciSet // bad time format !\n"); fprintf(stderr,"CDAUDIO_mciSet // bad time format !\n");
return MCIERR_BAD_TIME_FORMAT; return MCIERR_BAD_TIME_FORMAT;
} }
CDADev[wDevID].dwTimeFormat = lpParms->dwTimeFormat; CDADev[wDevID].dwTimeFormat = lpParms->dwTimeFormat;
} }
if (dwFlags & MCI_SET_DOOR_OPEN) { if (dwFlags & MCI_SET_DOOR_OPEN) {
printf("CDAUDIO_mciSet // MCI_SET_DOOR_OPEN !\n"); dprintf_cdaudio(stddeb,
"CDAUDIO_mciSet // MCI_SET_DOOR_OPEN !\n");
if (ioctl(CDADev[wDevID].unixdev, CDROMEJECT)) return MCIERR_HARDWARE; if (ioctl(CDADev[wDevID].unixdev, CDROMEJECT)) return MCIERR_HARDWARE;
CDADev[wDevID].nTracks = 0; CDADev[wDevID].nTracks = 0;
} }
if (dwFlags & MCI_SET_DOOR_CLOSED) { if (dwFlags & MCI_SET_DOOR_CLOSED) {
printf("CDAUDIO_mciSet // MCI_SET_DOOR_CLOSED !\n"); dprintf_cdaudio(stddeb,
"CDAUDIO_mciSet // MCI_SET_DOOR_CLOSED !\n");
if (ioctl(CDADev[wDevID].unixdev, CDROMEJECT)) return MCIERR_HARDWARE; if (ioctl(CDADev[wDevID].unixdev, CDROMEJECT)) return MCIERR_HARDWARE;
CDADev[wDevID].nTracks = 0; CDADev[wDevID].nTracks = 0;
} }
@ -836,7 +818,9 @@ DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION; if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
if (dwFlags & MCI_NOTIFY) { if (dwFlags & MCI_NOTIFY) {
printf("CDAUDIO_mciSet // MCI_NOTIFY_SUCCESSFUL %08X !\n", lpParms->dwCallback); dprintf_cdaudio(stddeb,
"CDAUDIO_mciSet // MCI_NOTIFY_SUCCESSFUL %08X !\n",
lpParms->dwCallback);
mciDriverNotify((HWND)LOWORD(lpParms->dwCallback), mciDriverNotify((HWND)LOWORD(lpParms->dwCallback),
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
@ -910,12 +894,13 @@ LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
return CDAUDIO_mciSeek(dwDevID, dwParam1, return CDAUDIO_mciSeek(dwDevID, dwParam1,
(LPMCI_SEEK_PARMS)dwParam2); (LPMCI_SEEK_PARMS)dwParam2);
case MCI_SET_DOOR_OPEN: case MCI_SET_DOOR_OPEN:
printf("CDAUDIO_DriverProc // MCI_SET_DOOR_OPEN !\n"); dprintf_cdaudio(stddeb,
"CDAUDIO_DriverProc // MCI_SET_DOOR_OPEN !\n");
if (ioctl(CDADev[dwDevID].unixdev, CDROMEJECT)) return MCIERR_HARDWARE; if (ioctl(CDADev[dwDevID].unixdev, CDROMEJECT)) return MCIERR_HARDWARE;
CDADev[dwDevID].nTracks = 0; CDADev[dwDevID].nTracks = 0;
return 0; return 0;
case MCI_SET_DOOR_CLOSED: case MCI_SET_DOOR_CLOSED:
printf("CDAUDIO_DriverProc // MCI_SET_DOOR_CLOSED !\n"); dprintf_cdaudio(stddeb,"CDAUDIO_DriverProc // MCI_SET_DOOR_CLOSED !\n");
if (ioctl(CDADev[dwDevID].unixdev, CDROMEJECT, 1)) return MCIERR_HARDWARE; if (ioctl(CDADev[dwDevID].unixdev, CDROMEJECT, 1)) return MCIERR_HARDWARE;
CDADev[dwDevID].nTracks = 0; CDADev[dwDevID].nTracks = 0;
return 0; return 0;

View file

@ -14,6 +14,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <windows.h> #include <windows.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include "prototypes.h" #include "prototypes.h"
@ -93,8 +94,16 @@ int MessageBox(HWND hWnd, LPSTR str, LPSTR title, WORD type)
lpmb->Title = (LPSTR) malloc(strlen(title) + 1); lpmb->Title = (LPSTR) malloc(strlen(title) + 1);
strcpy(lpmb->Title, title); strcpy(lpmb->Title, title);
/* lpmb->Str = str;*/ /* lpmb->Str = str;*/
if (str && *str)
{
lpmb->Str = (LPSTR) malloc(strlen(str) + 1); lpmb->Str = (LPSTR) malloc(strlen(str) + 1);
strcpy(lpmb->Str, str); strcpy(lpmb->Str, str);
}
else
{
lpmb->Str = (LPSTR) malloc(8);
strcpy(lpmb->Str, "Message");
}
lpmb->wType = type; lpmb->wType = type;
lpmb->ActiveFlg = TRUE; lpmb->ActiveFlg = TRUE;
wndClass.style = CS_HREDRAW | CS_VREDRAW ; wndClass.style = CS_HREDRAW | CS_VREDRAW ;

View file

@ -11,14 +11,16 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#ifdef BUILTIN_MMSYSTEM #ifdef BUILTIN_MMSYSTEM
#include "stdio.h" #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "win.h" #include "win.h"
#include "user.h" #include "user.h"
#include "driver.h" #include "driver.h"
#include "mmsystem.h" #include "mmsystem.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#ifdef linux #ifdef linux
#include <linux/soundcard.h> #include <linux/soundcard.h>
#endif #endif

View file

@ -7,7 +7,9 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#ifndef WINELIB #ifndef WINELIB
#include "stdio.h" #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "win.h" #include "win.h"

View file

@ -359,10 +359,17 @@ INT AboutDlgProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam);
*/ */
INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon) INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
{ {
fprintf(stderr, "ShellAbout ! (%s, %s)\n", szApp, szOtherStuff); /* fprintf(stderr, "ShellAbout ! (%s, %s)\n", szApp, szOtherStuff);*/
if (szApp)
strcpy(AppName, szApp); strcpy(AppName, szApp);
else
*AppName = 0;
if (szOtherStuff)
strcpy(AppMisc, szOtherStuff); strcpy(AppMisc, szOtherStuff);
else
*AppMisc = 0;
return DialogBox(hSysRes, "SHELL_ABOUT_MSGBOX", hWnd, (FARPROC)AboutDlgProc); return DialogBox(hSysRes, "SHELL_ABOUT_MSGBOX", hWnd, (FARPROC)AboutDlgProc);
} }

View file

@ -241,8 +241,8 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_EXITSIZEMOVE" /* 0x0232 */ "WM_EXITSIZEMOVE" /* 0x0232 */
}; };
char SpyFilters[256]; char SpyFilters[256+1];
char SpyIncludes[256]; char SpyIncludes[256+1];
#endif /* NOSPY */ #endif /* NOSPY */
@ -303,7 +303,14 @@ void SpyInit(void)
} }
GetPrivateProfileString("spy", "exclude", "", SpyFilters, GetPrivateProfileString("spy", "exclude", "", SpyFilters,
sizeof(SpyFilters), WINE_INI); sizeof(SpyFilters)-1, WINE_INI);
GetPrivateProfileString("spy", "include", "", SpyIncludes, GetPrivateProfileString("spy", "include", "", SpyIncludes,
sizeof(SpyIncludes), WINE_INI); sizeof(SpyIncludes)-1, WINE_INI);
if (*SpyIncludes != 0) {
strcat(SpyIncludes, ";");
}
if (*SpyFilters != 0) {
strcat(SpyFilters, ";");
}
} }

View file

@ -22,7 +22,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

View file

@ -2,6 +2,10 @@
#include <stdio.h> #include <stdio.h>
#include "prototypes.h" #include "prototypes.h"
#include "regfunc.h" #include "regfunc.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
struct Win87EmInfoStruct { struct Win87EmInfoStruct {
unsigned short Version; unsigned short Version;
@ -15,8 +19,8 @@ struct Win87EmInfoStruct {
int int
WIN87_fpmath() WIN87_fpmath()
{ {
printf( "_fpmath: (%x:%x %x %x)\n",_CONTEXT->sc_cs, _CONTEXT->sc_eip, dprintf_int(stddeb, "_fpmath: (%x:%x %x %x)\n",_CONTEXT->sc_cs,
_CONTEXT->sc_es, _BX & 0xffff); _CONTEXT->sc_eip, _CONTEXT->sc_es, _BX & 0xffff);
switch(_BX & 0xffff) switch(_BX & 0xffff)
{ {
@ -31,17 +35,19 @@ WIN87_fpmath()
void void
WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS, int cbWin87EmInfoStruct) WIN87_WinEm87Info(struct Win87EmInfoStruct *pWIS, int cbWin87EmInfoStruct)
{ {
printf( "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct); dprintf_int(stddeb, "__WinEm87Info(%p,%d)\n",pWIS,cbWin87EmInfoStruct);
} }
void void
WIN87_WinEm87Restore(void *pWin87EmSaveArea, int cbWin87EmSaveArea) WIN87_WinEm87Restore(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{ {
printf( "__WinEm87Restore(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea); dprintf_int(stddeb, "__WinEm87Restore(%p,%d)\n",
pWin87EmSaveArea,cbWin87EmSaveArea);
} }
void void
WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea) WIN87_WinEm87Save(void *pWin87EmSaveArea, int cbWin87EmSaveArea)
{ {
printf( "__WinEm87Save(%p,%d)\n",pWin87EmSaveArea,cbWin87EmSaveArea); dprintf_int(stddeb, "__WinEm87Save(%p,%d)\n",
pWin87EmSaveArea,cbWin87EmSaveArea);
} }

View file

@ -2,6 +2,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context) void IntBarf(int i, struct sigcontext_struct *context)
{ {

View file

@ -2,6 +2,12 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context);
int do_int13(struct sigcontext_struct *context) int do_int13(struct sigcontext_struct *context)
{ {

View file

@ -2,6 +2,12 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context);
int do_int15(struct sigcontext_struct *context) int do_int15(struct sigcontext_struct *context)
{ {

View file

@ -2,6 +2,12 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context);
int do_int16(struct sigcontext_struct *context) int do_int16(struct sigcontext_struct *context)
{ {

View file

@ -4,21 +4,29 @@
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "options.h" #include "options.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
#ifdef linux #ifdef linux
#define inline __inline__ /* So we can compile with -ansi */
#include <linux/sched.h> /* needed for HZ */ #include <linux/sched.h> /* needed for HZ */
#undef inline
#endif #endif
#define BCD_TO_BIN(x) ((x&15) + (x>>4)*10) #define BCD_TO_BIN(x) ((x&15) + (x>>4)*10)
#define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4)) #define BIN_TO_BCD(x) ((x%10) + ((x/10)<<4))
void IntBarf(int i, struct sigcontext_struct *context);
int do_int1A(struct sigcontext_struct * context){ int do_int1A(struct sigcontext_struct * context){
time_t ltime; time_t ltime;
struct tm *bdtime; struct tm *bdtime;
int ticks; int ticks;
if (Options.relay_debug) { if (Options.relay_debug) {
printf("int1A: AX %04x, BX %04x, CX %04x, DX %04x, " fprintf(stddeb,"int1A: AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n", "SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES); AX, BX, CX, DX, SI, DI, DS, ES);
} }
@ -30,7 +38,8 @@ int do_int1A(struct sigcontext_struct * context){
CX = ticks >> 16; CX = ticks >> 16;
DX = ticks & 0x0000FFFF; DX = ticks & 0x0000FFFF;
AX = 0; /* No midnight rollover */ AX = 0; /* No midnight rollover */
printf("int1a_00 // ltime=%ld ticks=%ld\n", ltime, ticks); dprintf_int(stddeb,"int1a_00 // ltime=%ld ticks=%ld\n",
ltime, ticks);
break; break;
case 2: case 2:

View file

@ -22,6 +22,10 @@
#include "msdos.h" #include "msdos.h"
#include "registers.h" #include "registers.h"
#include "options.h" #include "options.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
WORD ExtendedError, CodePage = 437; WORD ExtendedError, CodePage = 437;
BYTE ErrorClass, Action, ErrorLocus; BYTE ErrorClass, Action, ErrorLocus;
@ -38,6 +42,7 @@ WORD sharing_retries = 3; /* number of retries at sharing violation */
WORD sharing_pause = 1; /* pause between retries */ WORD sharing_pause = 1; /* pause between retries */
extern char TempDirectory[]; extern char TempDirectory[];
void IntBarf(int i, struct sigcontext_struct *context);
static int Error(int e, int class, int el) static int Error(int e, int class, int el)
{ {
@ -89,6 +94,7 @@ void errno_to_doserr(void)
} }
} }
/*
static void Barf(struct sigcontext_struct *context) static void Barf(struct sigcontext_struct *context)
{ {
fprintf(stderr, "int21: unknown/not implemented parameters:\n"); fprintf(stderr, "int21: unknown/not implemented parameters:\n");
@ -96,6 +102,7 @@ static void Barf(struct sigcontext_struct *context)
"SI %04x, DI %04x, DS %04x, ES %04x\n", "SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES); AX, BX, CX, DX, SI, DI, DS, ES);
} }
*/
void ChopOffWhiteSpace(char *string) void ChopOffWhiteSpace(char *string)
{ {
@ -265,9 +272,9 @@ static void WriteFile(struct sigcontext_struct *context)
if (BX < 3) { if (BX < 3) {
for (x = 0;x != CX;x++) { for (x = 0;x != CX;x++) {
fprintf(stderr, "%c", *ptr++); dprintf_int(stddeb, "%c", *ptr++);
} }
fflush(stderr); fflush(stddeb);
Error (0,0,0); Error (0,0,0);
AL = CX; AL = CX;
@ -356,6 +363,12 @@ static void ioctlGenericBlkDevReq(struct sigcontext_struct *context)
else else
drive = BL - 1; drive = BL - 1;
if (!DOS_ValidDrive(drive)) {
AX = 0x02;
SetCflag;
return;
}
if (CH != 0x08) { if (CH != 0x08) {
IntBarf(0x21, context); IntBarf(0x21, context);
return; return;
@ -363,6 +376,7 @@ static void ioctlGenericBlkDevReq(struct sigcontext_struct *context)
switch (CL) { switch (CL) {
case 0x60: /* get device parameters */ case 0x60: /* get device parameters */
/* used by w4wgrp's winfile */ /* used by w4wgrp's winfile */
memset(dataptr, 0, 0x26);
dataptr[0] = 0x04; dataptr[0] = 0x04;
dataptr[6] = 0; /* media type */ dataptr[6] = 0; /* media type */
if (drive > 1) if (drive > 1)
@ -378,7 +392,6 @@ static void ioctlGenericBlkDevReq(struct sigcontext_struct *context)
setword(&dataptr[4], 80); /* # of cylinders */ setword(&dataptr[4], 80); /* # of cylinders */
} }
CreateBPB(drive, &dataptr[7]); CreateBPB(drive, &dataptr[7]);
AL = 0;
ResetCflag; ResetCflag;
return; return;
default: default:
@ -471,7 +484,7 @@ void OpenExistingFile(struct sigcontext_struct *context)
break; break;
case 0x30: /* DENYREAD */ case 0x30: /* DENYREAD */
fprintf(stderr, dprintf_int(stdnimp,
"OpenExistingFile (%s): DENYREAD changed to DENYALL\n", "OpenExistingFile (%s): DENYREAD changed to DENYALL\n",
pointer(DS,DX)); pointer(DS,DX));
case 0x10: /* DENYALL */ case 0x10: /* DENYALL */
@ -536,7 +549,7 @@ static void RenameFile(struct sigcontext_struct *context)
{ {
char *newname, *oldname; char *newname, *oldname;
fprintf(stderr,"int21: renaming %s to %s\n", dprintf_int(stddeb,"int21: renaming %s to %s\n",
pointer(DS,DX), pointer(ES,DI) ); pointer(DS,DX), pointer(ES,DI) );
oldname = GetUnixFileName( pointer(DS,DX) ); oldname = GetUnixFileName( pointer(DS,DX) );
@ -551,7 +564,7 @@ static void MakeDir(struct sigcontext_struct *context)
{ {
char *dirname; char *dirname;
fprintf(stderr,"int21: makedir %s\n", pointer(DS,DX) ); dprintf_int(stddeb,"int21: makedir %s\n", pointer(DS,DX) );
if ((dirname = GetUnixFileName( pointer(DS,DX) ))== NULL) { if ((dirname = GetUnixFileName( pointer(DS,DX) ))== NULL) {
AL = CanNotMakeDir; AL = CanNotMakeDir;
@ -572,19 +585,23 @@ static void ChangeDir(struct sigcontext_struct *context)
int drive; int drive;
char *dirname = pointer(DS,DX); char *dirname = pointer(DS,DX);
drive = DOS_GetDefaultDrive(); drive = DOS_GetDefaultDrive();
fprintf(stderr,"int21: changedir %s\n", dirname); dprintf_int(stddeb,"int21: changedir %s\n", dirname);
if (dirname != NULL && dirname[1] == ':') { if (dirname != NULL && dirname[1] == ':') {
drive = toupper(dirname[0]) - 'A'; drive = toupper(dirname[0]) - 'A';
dirname += 2; dirname += 2;
} }
DOS_ChangeDir(drive, dirname); if (!DOS_ChangeDir(drive, dirname))
{
SetCflag;
AX=0x03;
}
} }
static void RemoveDir(struct sigcontext_struct *context) static void RemoveDir(struct sigcontext_struct *context)
{ {
char *dirname; char *dirname;
fprintf(stderr,"int21: removedir %s\n", pointer(DS,DX) ); dprintf_int(stddeb,"int21: removedir %s\n", pointer(DS,DX) );
if ((dirname = GetUnixFileName( pointer(DS,DX) ))== NULL) { if ((dirname = GetUnixFileName( pointer(DS,DX) ))== NULL) {
AL = CanNotMakeDir; AL = CanNotMakeDir;
@ -623,14 +640,16 @@ static void FindNext(struct sigcontext_struct *context)
SetCflag; SetCflag;
return; return;
} }
} while (*(dta + 0x0c) != dp->attribute); } /* while (*(dta + 0x0c) != dp->attribute);*/
while ( ( dp->search_attribute & dp->attribute) != dp->attribute);
*(dta + 0x15) = dp->attribute;
setword(&dta[0x16], 0x1234); /* time */ setword(&dta[0x16], 0x1234); /* time */
setword(&dta[0x18], 0x1234); /* date */ setword(&dta[0x18], 0x1234); /* date */
setdword(&dta[0x1a], dp->filesize); setdword(&dta[0x1a], dp->filesize);
strncpy(dta + 0x1e, dp->filename, 13); strncpy(dta + 0x1e, dp->filename, 13);
AL; AL = 0;
ResetCflag; ResetCflag;
return; return;
} }
@ -640,7 +659,7 @@ static void FindFirst(struct sigcontext_struct *context)
BYTE drive, *path = pointer(DS, DX); BYTE drive, *path = pointer(DS, DX);
struct dosdirent *dp; struct dosdirent *dp;
if (path[1] == ':') { if ((*path)&&(path[1] == ':')) {
drive = (islower(*path) ? toupper(*path) : *path) - 'A'; drive = (islower(*path) ? toupper(*path) : *path) - 'A';
if (!DOS_ValidDrive(drive)) { if (!DOS_ValidDrive(drive)) {
@ -674,6 +693,7 @@ static void FindFirst(struct sigcontext_struct *context)
return; return;
} }
dp->search_attribute = ECX & (FA_LABEL | FA_DIREC);
memcpy(dta + 0x0d, &dp, sizeof(dp)); memcpy(dta + 0x0d, &dp, sizeof(dp));
FindNext(context); FindNext(context);
} }
@ -720,7 +740,7 @@ static void CreateTempFile(struct sigcontext_struct *context)
sprintf(temp,"%s\\win%d.tmp",TempDirectory,(int) getpid()); sprintf(temp,"%s\\win%d.tmp",TempDirectory,(int) getpid());
fprintf(stderr,"CreateTempFile %s\n",temp); dprintf_int(stddeb,"CreateTempFile %s\n",temp);
handle = open(GetUnixFileName(temp), O_CREAT | O_TRUNC | O_RDWR); handle = open(GetUnixFileName(temp), O_CREAT | O_TRUNC | O_RDWR);
@ -793,7 +813,7 @@ static void GetDiskSerialNumber(struct sigcontext_struct *context)
strncpy(dataptr + 6, DOS_GetVolumeLabel(drive), 8); strncpy(dataptr + 6, DOS_GetVolumeLabel(drive), 8);
strncpy(dataptr + 0x11, "FAT16 ", 8); strncpy(dataptr + 0x11, "FAT16 ", 8);
AL; AL = 0;
ResetCflag; ResetCflag;
} }
@ -830,8 +850,8 @@ static void DumpFCB(BYTE *fcb)
for (y = 0; y !=2 ; y++) { for (y = 0; y !=2 ; y++) {
for (x = 0; x!=15;x++) for (x = 0; x!=15;x++)
fprintf(stderr, "%02x ", *fcb++); dprintf_int(stddeb, "%02x ", *fcb++);
fprintf(stderr,"\n"); dprintf_int(stddeb,"\n");
} }
} }
@ -850,14 +870,14 @@ static void FindFirstFCB(struct sigcontext_struct *context)
if ((*fcb) == 0xff) if ((*fcb) == 0xff)
{ {
standard_fcb = fcb + 7; standard_fcb = (struct fcb *)(fcb + 7);
output_fcb = dta + 7; output_fcb = (struct fcb *)(dta + 7);
*dta = 0xff; *dta = 0xff;
} }
else else
{ {
standard_fcb = fcb; standard_fcb = (struct fcb *)fcb;
output_fcb = dta; output_fcb = (struct fcb *)dta;
} }
if (standard_fcb->drive) if (standard_fcb->drive)
@ -883,14 +903,14 @@ static void FindFirstFCB(struct sigcontext_struct *context)
memset(&output_fcb->name, ' ', 11); memset(&output_fcb->name, ' ', 11);
if (DOS_GetVolumeLabel(drive) != NULL) if (DOS_GetVolumeLabel(drive) != NULL)
{ {
strncpy(&output_fcb->name, DOS_GetVolumeLabel(drive), 11); strncpy(output_fcb->name, DOS_GetVolumeLabel(drive), 11);
AL = 0x00; AL = 0x00;
return; return;
} }
} }
} }
strncpy(&(output_fcb->name),&(standard_fcb->name),11); strncpy(output_fcb->name, standard_fcb->name, 11);
if (*fcb == 0xff) if (*fcb == 0xff)
*(dta+6) = ( *(fcb+6) & (!FA_DIREC)); *(dta+6) = ( *(fcb+6) & (!FA_DIREC));
@ -940,11 +960,11 @@ static void DeleteFileFCB(struct sigcontext_struct *context)
while (DOS_readdir(dp) != NULL) while (DOS_readdir(dp) != NULL)
{ {
strcpy(ptr, dp->filename); strcpy(ptr, dp->filename);
fprintf(stderr, "int21: delete file %s\n", temp); dprintf_int(stddeb, "int21: delete file %s\n", temp);
/* unlink(GetUnixFileName(temp)); */ /* unlink(GetUnixFileName(temp)); */
} }
DOS_closedir(dp); DOS_closedir(dp);
AL; AL = 0;
} }
static void RenameFileFCB(struct sigcontext_struct *context) static void RenameFileFCB(struct sigcontext_struct *context)
@ -986,10 +1006,11 @@ static void RenameFileFCB(struct sigcontext_struct *context)
{ {
strcpy(oldnameptr, dp->filename); strcpy(oldnameptr, dp->filename);
strcpy(newnameptr, fcb + 1); strcpy(newnameptr, fcb + 1);
fprintf(stderr, "int21: renamefile %s -> %s\n", oldname, newname); dprintf_int(stddeb, "int21: renamefile %s -> %s\n",
oldname, newname);
} }
DOS_closedir(dp); DOS_closedir(dp);
AL; AL = 0;
} }
@ -1080,7 +1101,7 @@ int do_int21(struct sigcontext_struct * context)
{ {
if (Options.relay_debug) if (Options.relay_debug)
{ {
printf("int21: AX %04x, BX %04x, CX %04x, DX %04x, " fprintf(stddeb,"int21: AX %04x, BX %04x, CX %04x, DX %04x, "
"SI %04x, DI %04x, DS %04x, ES %04x\n", "SI %04x, DI %04x, DS %04x, ES %04x\n",
AX, BX, CX, DX, SI, DI, DS, ES); AX, BX, CX, DX, SI, DI, DS, ES);
} }
@ -1197,7 +1218,9 @@ int do_int21(struct sigcontext_struct * context)
case 0x25: /* SET INTERRUPT VECTOR */ case 0x25: /* SET INTERRUPT VECTOR */
/* Ignore any attempt to set a segment vector */ /* Ignore any attempt to set a segment vector */
fprintf(stderr, "int21: set interrupt vector %2x (%04x:%04x)\n", AL, DS, DX); dprintf_int(stdnimp,
"int21: set interrupt vector %2x (%04x:%04x)\n",
AL, DS, DX);
break; break;
case 0x2a: /* GET SYSTEM DATE */ case 0x2a: /* GET SYSTEM DATE */
@ -1265,7 +1288,8 @@ int do_int21(struct sigcontext_struct * context)
case 0x35: /* GET INTERRUPT VECTOR */ case 0x35: /* GET INTERRUPT VECTOR */
/* Return a NULL segment selector - this will bomb, /* Return a NULL segment selector - this will bomb,
if anyone ever tries to use it */ if anyone ever tries to use it */
fprintf(stderr, "int21: get interrupt vector %2x\n", AX & 0xff); dprintf_int(stdnimp, "int21: get interrupt vector %2x\n",
AX & 0xff);
ES = 0; ES = 0;
BX = 0; BX = 0;
break; break;

View file

@ -3,6 +3,10 @@
#include "registers.h" #include "registers.h"
#include "msdos.h" #include "msdos.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
int do_int25(struct sigcontext_struct *context) int do_int25(struct sigcontext_struct *context)
{ {
@ -18,7 +22,7 @@ int do_int25(struct sigcontext_struct *context)
begin = DX; begin = DX;
length = CX; length = CX;
} }
fprintf(stderr, "int25: abs diskread, drive %d, sector %d, " dprintf_int(stdnimp, "int25: abs diskread, drive %d, sector %d, "
"count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr); "count %d, buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
memset(dataptr, 0, length * 512); memset(dataptr, 0, length * 512);

View file

@ -3,6 +3,12 @@
#include "registers.h" #include "registers.h"
#include "msdos.h" #include "msdos.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context);
int do_int26(struct sigcontext_struct *context) int do_int26(struct sigcontext_struct *context)
{ {
@ -19,7 +25,7 @@ int do_int26(struct sigcontext_struct *context)
length = CX; length = CX;
} }
fprintf(stderr,"int26: abs diskwrite, drive %d, sector %d, count %d," dprintf_int(stdnimp,"int26: abs diskwrite, drive %d, sector %d, count %d,"
" buffer %d\n", EAX & 0xff, begin, length, (int) dataptr); " buffer %d\n", EAX & 0xff, begin, length, (int) dataptr);
ResetCflag; ResetCflag;

View file

@ -2,6 +2,12 @@
#include <stdlib.h> #include <stdlib.h>
#include "msdos.h" #include "msdos.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context);
int do_int2a(struct sigcontext_struct *context) int do_int2a(struct sigcontext_struct *context)
{ {

View file

@ -2,10 +2,14 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
void IntBarf(int i, struct sigcontext_struct *context);
int do_int2f_16(struct sigcontext_struct *context); int do_int2f_16(struct sigcontext_struct *context);
int do_int2f(struct sigcontext_struct *context) int do_int2f(struct sigcontext_struct *context)
{ {
switch((context->sc_eax >> 8) & 0xff) switch((context->sc_eax >> 8) & 0xff)
@ -33,16 +37,16 @@ int do_int2f_16(struct sigcontext_struct *context)
switch(context->sc_eax & 0xff) { switch(context->sc_eax & 0xff) {
case 0x00: case 0x00:
/* return 'major/minor' for MSWin 3.1 */ /* return 'major/minor' for MSWin 3.1 */
printf("do_int2f_16 // return 'major/minor' for MSWin 3.1 !\n"); dprintf_int(stddeb,"do_int2f_16 // return 'major/minor' for MSWin 3.1 !\n");
context->sc_eax = 0x0310; context->sc_eax = 0x0310;
return 1; return 1;
case 0x86: case 0x86:
/* operating in protected mode under DPMI */ /* operating in protected mode under DPMI */
printf("do_int2f_16 // operating in protected mode under DPMI !\n"); dprintf_int(stddeb,"do_int2f_16 // operating in protected mode under DPMI !\n");
context->sc_eax = 0x0000; context->sc_eax = 0x0000;
return 1; return 1;
case 0x87: case 0x87:
printf("do_int2f_16 // return DPMI flags !\n"); dprintf_int(stddeb,"do_int2f_16 // return DPMI flags !\n");
context->sc_eax = 0x0000; /* DPMI Installed */ context->sc_eax = 0x0000; /* DPMI Installed */
context->sc_ebx = 0x0001; /* 32bits available */ context->sc_ebx = 0x0001; /* 32bits available */
context->sc_ecx = 0x04; /* processor 486 */ context->sc_ecx = 0x04; /* processor 486 */

View file

@ -2,6 +2,10 @@
#include <stdlib.h> #include <stdlib.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
typedef struct { typedef struct {
WORD accessed : 1; WORD accessed : 1;
@ -33,7 +37,8 @@ BOOL DPMI_SetDescriptor(HANDLE pmSel, LPDESCRIPTOR lpDesc);
int do_int31(struct sigcontext_struct *context) int do_int31(struct sigcontext_struct *context)
{ {
LPDESCRIPTOR lpDesc; LPDESCRIPTOR lpDesc;
printf("do_int31 // context->sc_eax=%04X\n", context->sc_eax); dprintf_int(stddeb,"do_int31 // context->sc_eax=%04X\n",
context->sc_eax);
switch(context->sc_eax) switch(context->sc_eax)
{ {
case 0x0000: case 0x0000:
@ -60,35 +65,43 @@ HANDLE DPMI_GetNewSelector(WORD selcount)
{ {
LPSTR ptr; LPSTR ptr;
HANDLE pmSel; HANDLE pmSel;
printf("DPMI_GetNewSelector(%d); !\n", selcount); dprintf_int(stddeb,"DPMI_GetNewSelector(%d); !\n", selcount);
pmSel = GlobalAlloc(GMEM_FIXED, 4096); pmSel = GlobalAlloc(GMEM_FIXED, 4096);
ptr = GlobalLock(pmSel); ptr = GlobalLock(pmSel);
printf("DPMI_GetNewSelector() return %04X !\n", pmSel); dprintf_int(stddeb,"DPMI_GetNewSelector() return %04X !\n", pmSel);
return pmSel; return pmSel;
} }
BOOL DPMI_FreeSelector(HANDLE pmSel) BOOL DPMI_FreeSelector(HANDLE pmSel)
{ {
printf("DPMI_FreeSelector(%04X); !\n", pmSel); dprintf_int(stddeb,"DPMI_FreeSelector(%04X); !\n", pmSel);
GlobalFree(pmSel); GlobalFree(pmSel);
return 0; return 0;
} }
BOOL DPMI_SetDescriptor(HANDLE pmSel, LPDESCRIPTOR lpDesc) BOOL DPMI_SetDescriptor(HANDLE pmSel, LPDESCRIPTOR lpDesc)
{ {
printf("DPMI_SetDescriptor(%04X, %08X); !\n", pmSel, lpDesc); dprintf_int(stdnimp,"DPMI_SetDescriptor(%04X, %08X); !\n",
printf("DPMI lpDesc->Limit=%u \n", lpDesc->Limit); pmSel, lpDesc);
printf("DPMI lpDesc->addr_lo=%04X \n", lpDesc->addr_lo); dprintf_int(stdnimp,"DPMI lpDesc->Limit=%u \n", lpDesc->Limit);
printf("DPMI lpDesc->addr_hi=%02X \n", lpDesc->addr_hi); dprintf_int(stdnimp,"DPMI lpDesc->addr_lo=%04X \n", lpDesc->addr_lo);
printf("DPMI lpDesc->access.accessed=%u \n", lpDesc->access.accessed); dprintf_int(stdnimp,"DPMI lpDesc->addr_hi=%02X \n", lpDesc->addr_hi);
printf("DPMI lpDesc->access.read_write=%u \n", lpDesc->access.read_write); dprintf_int(stdnimp,"DPMI lpDesc->access.accessed=%u \n",
printf("DPMI lpDesc->access.conf_exp=%u \n", lpDesc->access.conf_exp); lpDesc->access.accessed);
printf("DPMI lpDesc->access.code=%u \n", lpDesc->access.code); dprintf_int(stdnimp,"DPMI lpDesc->access.read_write=%u \n",
printf("DPMI lpDesc->access.xsystem=%u \n", lpDesc->access.xsystem); lpDesc->access.read_write);
printf("DPMI lpDesc->access.dpl=%u \n", lpDesc->access.dpl); dprintf_int(stdnimp,"DPMI lpDesc->access.conf_exp=%u \n",
printf("DPMI lpDesc->access.present=%u \n", lpDesc->access.present); lpDesc->access.conf_exp);
printf("DPMI lpDesc->reserved=%04X \n", lpDesc->reserved); dprintf_int(stdnimp,"DPMI lpDesc->access.code=%u \n",
lpDesc->access.code);
dprintf_int(stdnimp,"DPMI lpDesc->access.xsystem=%u \n",
lpDesc->access.xsystem);
dprintf_int(stdnimp,"DPMI lpDesc->access.dpl=%u \n",
lpDesc->access.dpl);
dprintf_int(stdnimp,"DPMI lpDesc->access.present=%u \n",
lpDesc->access.present);
dprintf_int(stdnimp,"DPMI lpDesc->reserved=%04X \n", lpDesc->reserved);
return FALSE; return FALSE;
} }

View file

@ -3,6 +3,10 @@
#include <time.h> #include <time.h>
#include "registers.h" #include "registers.h"
#include "wine.h" #include "wine.h"
#include "stddebug.h"
/* #define DEBUG_INT */
/* #undef DEBUG_INT */
#include "debug.h"
static BYTE cmosaddress; static BYTE cmosaddress;
@ -18,7 +22,7 @@ static BYTE cmosimage[64] = {
void inportb(struct sigcontext_struct *context) void inportb(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: inb (%x)\n", DX); dprintf_int(stddeb, "IO: inb (%x)\n", DX);
switch(DX) { switch(DX) {
case 0x70: case 0x70:
@ -33,14 +37,14 @@ void inportb(struct sigcontext_struct *context)
void inport(struct sigcontext_struct *context) void inport(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: in (%x)\n", DX); dprintf_int(stdnimp, "IO: in (%x)\n", DX);
AX = 0xffff; AX = 0xffff;
} }
void outportb(struct sigcontext_struct *context) void outportb(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: outb (%x), %x\n", DX, AX); dprintf_int(stdnimp, "IO: outb (%x), %x\n", DX, AX);
switch (EDX & 0xffff) switch (EDX & 0xffff)
{ {
@ -56,5 +60,5 @@ void outportb(struct sigcontext_struct *context)
void outport(struct sigcontext_struct *context) void outport(struct sigcontext_struct *context)
{ {
fprintf(stderr, "IO: out (%x), %x\n", DX, AX); dprintf_int(stdnimp, "IO: out (%x), %x\n", DX, AX);
} }

View file

@ -6,6 +6,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h" #include "prototypes.h"
#include "regfunc.h" #include "regfunc.h"
#include "options.h" #include "options.h"
#include "stddebug.h"
#include "debug.h"
extern unsigned short WIN_StackSize; extern unsigned short WIN_StackSize;
@ -18,9 +20,8 @@ KERNEL_LockSegment(int segment)
if (segment == -1) if (segment == -1)
segment = *(Stack16Frame + 6); segment = *(Stack16Frame + 6);
#ifdef RELAY_DEBUG if (Options.relay_debug)
printf("LockSegment: segment %x\n", segment); fprintf(stddeb,"LockSegment: segment %x\n", segment);
#endif
return segment; return segment;
} }
@ -34,9 +35,8 @@ KERNEL_UnlockSegment(int segment)
if (segment == -1) if (segment == -1)
segment = *(Stack16Frame + 6); segment = *(Stack16Frame + 6);
#ifdef RELAY_DEBUG if (Options.relay_debug)
printf("UnlockSegment: segment %x\n", segment); fprintf(stddeb,"UnlockSegment: segment %x\n", segment);
#endif
return segment; return segment;
} }
@ -50,6 +50,11 @@ KERNEL_InitTask()
_AX = 1; _AX = 1;
_CX = WIN_StackSize; _CX = WIN_StackSize;
_DX = Options.cmdShow; _DX = Options.cmdShow;
_DI = _DS;
/* FIXME: DI should contain the instance handle of the caller, _DS doesn't
always work as the caller might have changed it. */
_SI = 0; _SI = 0;
ReturnFromRegisterFunc(); ReturnFromRegisterFunc();
/* Function does not return */ /* Function does not return */
@ -61,8 +66,7 @@ KERNEL_InitTask()
int int
KERNEL_WaitEvent(int task) KERNEL_WaitEvent(int task)
{ {
#ifdef RELAY_DEBUG if (Options.relay_debug)
printf("WaitEvent: task %d\n", task); fprintf(stddeb,"WaitEvent: task %d\n", task);
#endif
return 0; return 0;
} }

View file

@ -3,44 +3,28 @@
MODULE = objects MODULE = objects
SRCS = \ SRCS = \
bitblt.c \
bitmap.c \ bitmap.c \
brush.c \ brush.c \
clipping.c \
color.c \
dc.c \
dcvalues.c \
dib.c \
dither.c \
font.c \ font.c \
gdiobj.c \ gdiobj.c \
linedda.c \
metafile.c \
palette.c \ palette.c \
pen.c \ pen.c \
dib.c \
region.c \ region.c \
text.c \ text.c
dcvalues.c \
clipping.c \
bitblt.c \
linedda.c \
color.c \
dither.c \
metafile.c
OBJS = \ OBJS = $(SRCS:.c=.o)
bitmap.o \
brush.o \
font.o \
gdiobj.o \
palette.o \
pen.o \
dib.o \
region.o \
text.o \
dcvalues.o \
clipping.o \
bitblt.o \
linedda.o \
color.o \
dither.o \
metafile.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::

View file

@ -13,6 +13,11 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h" #include "gdi.h"
#include "metafile.h" #include "metafile.h"
#include "options.h"
#include "stddebug.h"
/* #define DEBUG_GDI /* */
/* #undef DEBUG_GDI /* */
#include "debug.h"
extern const int DC_XROPfunction[]; extern const int DC_XROPfunction[];
@ -26,8 +31,6 @@ extern const int DC_XROPfunction[];
BOOL PatBlt( HDC hdc, short left, short top, BOOL PatBlt( HDC hdc, short left, short top,
short width, short height, DWORD rop) short width, short height, DWORD rop)
{ {
int x1, x2, y1, y2;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) if (!dc)
{ {
@ -38,22 +41,42 @@ BOOL PatBlt( HDC hdc, short left, short top,
return TRUE; return TRUE;
} }
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "PatBlt: %d %d,%d %dx%d %06x\n",
printf( "PatBlt: %d %d,%d %dx%d %06x\n",
hdc, left, top, width, height, rop ); hdc, left, top, width, height, rop );
#endif
/* Convert ROP3 code to ROP2 code */
rop >>= 16; rop >>= 16;
if (!DC_SetupGCForBrush( dc )) rop &= 0x0f; if (!DC_SetupGCForBrush( dc )) rop &= 0x0f;
else rop = (rop & 0x03) | ((rop >> 4) & 0x0c); else rop = (rop & 0x03) | ((rop >> 4) & 0x0c);
XSetFunction( XT_display, dc->u.x.gc, DC_XROPfunction[rop] );
x1 = dc->w.DCOrgX + XLPTODP( dc, left ); /* Special case for BLACKNESS and WHITENESS */
x2 = dc->w.DCOrgX + XLPTODP( dc, left + width ); if (!Options.usePrivateMap && ((rop == R2_BLACK-1) || (rop == R2_WHITE-1)))
y1 = dc->w.DCOrgY + YLPTODP( dc, top ); {
y2 = dc->w.DCOrgY + YLPTODP( dc, top + height ); XSetForeground( display, dc->u.x.gc, (rop == R2_BLACK-1) ?
XFillRectangle( XT_display, dc->u.x.drawable, dc->u.x.gc, BlackPixelOfScreen(screen) : WhitePixelOfScreen(screen));
MIN(x1,x2), MIN(y1,y2), abs(x2-x1), abs(y2-y1) ); XSetFillStyle( display, dc->u.x.gc, FillSolid );
rop = R2_COPYPEN;
}
XSetFunction( display, dc->u.x.gc, DC_XROPfunction[rop] );
left = dc->w.DCOrgX + XLPTODP( dc, left );
top = dc->w.DCOrgY + YLPTODP( dc, top );
/* Convert dimensions to device coords */
if ((width = (width * dc->w.VportExtX) / dc->w.WndExtX) < 0)
{
width = -width;
left -= width;
}
if ((height = (height * dc->w.VportExtY) / dc->w.WndExtY) < 0)
{
height = -height;
top -= height;
}
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
left, top, width, height );
return TRUE; return TRUE;
} }
@ -69,10 +92,9 @@ BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
DWORD saverop = rop; DWORD saverop = rop;
DC *dcDest, *dcSrc; DC *dcDest, *dcSrc;
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "BitBlt: %04x %d,%d %dx%d %04x %d,%d %08x\n",
printf( "BitBlt: %d %d,%d %dx%d %d %d,%d %08x\n",
hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, rop); hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, rop);
#endif
if (width == 0 || height == 0) return FALSE; if (width == 0 || height == 0) return FALSE;
if ((rop & 0xcc0000) == ((rop & 0x330000) << 2)) if ((rop & 0xcc0000) == ((rop & 0x330000) << 2))
return PatBlt( hdcDest, xDest, yDest, width, height, rop ); return PatBlt( hdcDest, xDest, yDest, width, height, rop );
@ -80,7 +102,7 @@ BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
rop >>= 16; rop >>= 16;
if ((rop & 0x0f) != (rop >> 4)) if ((rop & 0x0f) != (rop >> 4))
{ {
printf( "BitBlt: Unimplemented ROP %02x\n", rop ); dprintf_gdi(stdnimp, "BitBlt: Unimplemented ROP %02x\n", rop );
return FALSE; return FALSE;
} }
@ -109,21 +131,21 @@ BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
return FALSE; /* Should call StretchBlt here */ return FALSE; /* Should call StretchBlt here */
DC_SetupGCForText( dcDest ); DC_SetupGCForText( dcDest );
XSetFunction( XT_display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f] ); XSetFunction( display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f] );
if (dcSrc->w.bitsPerPixel == dcDest->w.bitsPerPixel) if (dcSrc->w.bitsPerPixel == dcDest->w.bitsPerPixel)
{ {
XCopyArea( XT_display, dcSrc->u.x.drawable, XCopyArea( display, dcSrc->u.x.drawable,
dcDest->u.x.drawable, dcDest->u.x.gc, dcDest->u.x.drawable, dcDest->u.x.gc,
MIN(xs1,xs2), MIN(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1), min(xs1,xs2), min(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1),
MIN(xd1,xd2), MIN(yd1,yd2) ); min(xd1,xd2), min(yd1,yd2) );
} }
else else
{ {
if (dcSrc->w.bitsPerPixel != 1) return FALSE; if (dcSrc->w.bitsPerPixel != 1) return FALSE;
XCopyPlane( XT_display, dcSrc->u.x.drawable, XCopyPlane( display, dcSrc->u.x.drawable,
dcDest->u.x.drawable, dcDest->u.x.gc, dcDest->u.x.drawable, dcDest->u.x.gc,
MIN(xs1,xs2), MIN(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1), min(xs1,xs2), min(ys1,ys2), abs(xs2-xs1), abs(ys2-ys1),
MIN(xd1,xd2), MIN(yd1,yd2), 1 ); min(xd1,xd2), min(yd1,yd2), 1 );
} }
return TRUE; return TRUE;
} }
@ -248,7 +270,7 @@ static void wonb_stretch(XImage *sxi, XImage *dxi,
/* scaling without having to worry about overflows. */ /* scaling without having to worry about overflows. */
/* ##### muldiv64() borrowed from svgalib 1.03 ##### */ /* ##### muldiv64() borrowed from svgalib 1.03 ##### */
static inline int muldiv64( int m1, int m2, int d ) static __inline__ int muldiv64( int m1, int m2, int d )
{ {
/* int32 * int32 -> int64 / int32 -> int32 */ /* int32 * int32 -> int64 / int32 -> int32 */
#ifdef i386 #ifdef i386
@ -331,13 +353,11 @@ BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short h
WORD stretchmode; WORD stretchmode;
BOOL flg; BOOL flg;
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
fprintf(stderr, "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
hdcDest, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc, hdcDest, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc,
ySrc, widthSrc, heightSrc, rop ); ySrc, widthSrc, heightSrc, rop );
printf("StretchMode is %x\n", dprintf_gdi(stddeb, "StretchMode is %x\n",
((DC *)GDI_GetObjPtr(hdcDest, DC_MAGIC))->w.stretchBltMode); ((DC *)GDI_GetObjPtr(hdcDest, DC_MAGIC))->w.stretchBltMode);
#endif
if (widthDest == 0 || heightDest == 0) return FALSE; if (widthDest == 0 || heightDest == 0) return FALSE;
if (widthSrc == 0 || heightSrc == 0) return FALSE; if (widthSrc == 0 || heightSrc == 0) return FALSE;
@ -356,7 +376,7 @@ BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short h
rop >>= 16; rop >>= 16;
if ((rop & 0x0f) != (rop >> 4)) if ((rop & 0x0f) != (rop >> 4))
{ {
printf( "StretchBlt: Unimplemented ROP %02x\n", rop ); dprintf_gdi(stdnimp, "StretchBlt: Unimplemented ROP %02x\n", rop );
return FALSE; return FALSE;
} }
@ -427,7 +447,7 @@ BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short h
DC_SetupGCForText(dcDest); DC_SetupGCForText(dcDest);
XSetFunction(display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f]); XSetFunction(display, dcDest->u.x.gc, DC_XROPfunction[rop & 0x0f]);
XPutImage(display, dcDest->u.x.drawable, dcDest->u.x.gc, XPutImage(display, dcDest->u.x.drawable, dcDest->u.x.gc,
dxi, 0, 0, MIN(xd1,xd2), MIN(yd1,yd2), dxi, 0, 0, min(xd1,xd2), min(yd1,yd2),
widthDest, heightDest); widthDest, heightDest);
/* now free the images we created */ /* now free the images we created */

View file

@ -6,23 +6,28 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993"; static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#include "gdi.h" #include "gdi.h"
#include "bitmap.h" #include "bitmap.h"
#include "stddebug.h"
/* #define DEBUG_GDI /* */
/* #undef DEBUG_GDI /* */
/* #define DEBUG_BITMAP /* */
/* #define DEBUG_BITMAP /* */
#include "debug.h"
/* Include OEM bitmaps */ /* Include OEM bitmaps */
#include "bitmaps/check_boxes" #include "bitmaps/check_boxes"
#include "bitmaps/check_mark" #include "bitmaps/check_mark"
#include "bitmaps/menu_arrow" #include "bitmaps/menu_arrow"
/* Handle of the bitmap selected by default in a memory DC */
HBITMAP BITMAP_hbitmapMemDC = 0;
/* GCs used for B&W and color bitmap operations */ /* GCs used for B&W and color bitmap operations */
GC BITMAP_monoGC = 0, BITMAP_colorGC = 0; GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
extern void DC_InitDC( HDC hdc ); /* dc.c */
/*********************************************************************** /***********************************************************************
* BITMAP_Init * BITMAP_Init
@ -49,9 +54,7 @@ BOOL BITMAP_Init()
XFreePixmap( display, tmpPixmap ); XFreePixmap( display, tmpPixmap );
} }
} }
return TRUE;
BITMAP_hbitmapMemDC = CreateBitmap( 1, 1, 1, 1, NULL );
return (BITMAP_hbitmapMemDC != 0);
} }
@ -143,10 +146,8 @@ HBITMAP CreateBitmap( short width, short height,
BYTE planes, BYTE bpp, LPSTR bits ) BYTE planes, BYTE bpp, LPSTR bits )
{ {
BITMAP bitmap = { 0, width, height, 0, planes, bpp, bits }; BITMAP bitmap = { 0, width, height, 0, planes, bpp, bits };
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "CreateBitmap: %dx%d, %d colors\n",
printf( "CreateBitmap: %dx%d, %d colors\n",
width, height, 1 << (planes*bpp) ); width, height, 1 << (planes*bpp) );
#endif
return CreateBitmapIndirect( &bitmap ); return CreateBitmapIndirect( &bitmap );
} }
@ -157,9 +158,8 @@ HBITMAP CreateBitmap( short width, short height,
HBITMAP CreateCompatibleBitmap( HDC hdc, short width, short height ) HBITMAP CreateCompatibleBitmap( HDC hdc, short width, short height )
{ {
DC * dc; DC * dc;
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "CreateCompatibleBitmap: %d %dx%d\n",
printf( "CreateCompatibleBitmap: %d %dx%d\n", hdc, width, height ); hdc, width, height );
#endif
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0; if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
return CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL ); return CreateBitmap( width, height, 1, dc->w.bitsPerPixel, NULL );
} }
@ -222,11 +222,9 @@ LONG GetBitmapBits( HBITMAP hbitmap, LONG count, LPSTR buffer )
bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return 0; if (!bmp) return 0;
#ifdef DEBUG_BITMAP dprintf_bitmap(stddeb, "GetBitmapBits: %dx%d %d colors %p\n",
printf( "GetBitmapBits: %dx%d %d colors %p\n",
bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
1 << bmp->bitmap.bmBitsPixel, buffer ); 1 << bmp->bitmap.bmBitsPixel, buffer );
#endif
/* Only get entire lines */ /* Only get entire lines */
height = count / bmp->bitmap.bmWidthBytes; height = count / bmp->bitmap.bmWidthBytes;
if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight; if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;
@ -253,11 +251,10 @@ LONG SetBitmapBits( HBITMAP hbitmap, LONG count, LPSTR buffer )
bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return 0; if (!bmp) return 0;
#ifdef DEBUG_BITMAP dprintf_bitmap(stddeb, "SetBitmapBits: %dx%d %d colors %p\n",
printf( "SetBitmapBits: %dx%d %d colors %p\n",
bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
1 << bmp->bitmap.bmBitsPixel, buffer ); 1 << bmp->bitmap.bmBitsPixel, buffer );
#endif
/* Only set entire lines */ /* Only set entire lines */
height = count / bmp->bitmap.bmWidthBytes; height = count / bmp->bitmap.bmWidthBytes;
if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight; if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;
@ -314,9 +311,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap,
XFreeGC( display, dc->u.x.gc ); XFreeGC( display, dc->u.x.gc );
dc->u.x.gc = XCreateGC( display, dc->u.x.drawable, 0, NULL ); dc->u.x.gc = XCreateGC( display, dc->u.x.drawable, 0, NULL );
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel; dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
/* Re-select objects with changed depth */ DC_InitDC( hdc );
SelectObject( hdc, dc->w.hPen );
SelectObject( hdc, dc->w.hBrush );
} }
return prevHandle; return prevHandle;
} }
@ -326,7 +321,7 @@ HBITMAP BITMAP_SelectObject( HDC hdc, DC * dc, HBITMAP hbitmap,
*/ */
HBITMAP CreateDiscardableBitmap(HDC hdc, short width, short height) HBITMAP CreateDiscardableBitmap(HDC hdc, short width, short height)
{ {
printf("CreateDiscardableBitmap(%04X, %d, %d); " dprintf_bitmap(stddeb,"CreateDiscardableBitmap(%04X, %d, %d); "
"// call CreateCompatibleBitmap() for now!\n", "// call CreateCompatibleBitmap() for now!\n",
hdc, width, height); hdc, width, height);
return CreateCompatibleBitmap(hdc, width, height); return CreateCompatibleBitmap(hdc, width, height);

View file

@ -10,7 +10,10 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "bitmap.h" #include "bitmap.h"
#include "prototypes.h" #include "prototypes.h"
#include "metafile.h" #include "metafile.h"
#include "stddebug.h"
/* #define DEBUG_GDI /* */
/* #undef DEBUG_GDI /* */
#include "debug.h"
#define NB_HATCH_STYLES 6 #define NB_HATCH_STYLES 6
@ -47,9 +50,7 @@ HBRUSH CreateBrushIndirect( LOGBRUSH * brush )
HBRUSH CreateHatchBrush( short style, COLORREF color ) HBRUSH CreateHatchBrush( short style, COLORREF color )
{ {
LOGBRUSH logbrush = { BS_HATCHED, color, style }; LOGBRUSH logbrush = { BS_HATCHED, color, style };
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "CreateHatchBrush: %d %06x\n", style, color );
printf( "CreateHatchBrush: %d %06x\n", style, color );
#endif
if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0; if ((style < 0) || (style >= NB_HATCH_STYLES)) return 0;
return CreateBrushIndirect( &logbrush ); return CreateBrushIndirect( &logbrush );
} }
@ -63,9 +64,7 @@ HBRUSH CreatePatternBrush( HBITMAP hbitmap )
LOGBRUSH logbrush = { BS_PATTERN, 0, 0 }; LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
BITMAPOBJ *bmp, *newbmp; BITMAPOBJ *bmp, *newbmp;
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "CreatePatternBrush: %d\n", hbitmap );
printf( "CreatePatternBrush: %d\n", hbitmap );
#endif
/* Make a copy of the bitmap */ /* Make a copy of the bitmap */
@ -89,9 +88,7 @@ HBRUSH CreateDIBPatternBrush( HANDLE hbitmap, WORD coloruse )
BITMAPINFO *info, *newInfo; BITMAPINFO *info, *newInfo;
int size; int size;
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "CreateDIBPatternBrush: %d\n", hbitmap );
printf( "CreateDIBPatternBrush: %d\n", hbitmap );
#endif
/* Make a copy of the bitmap */ /* Make a copy of the bitmap */
@ -122,9 +119,7 @@ HBRUSH CreateDIBPatternBrush( HANDLE hbitmap, WORD coloruse )
HBRUSH CreateSolidBrush( COLORREF color ) HBRUSH CreateSolidBrush( COLORREF color )
{ {
LOGBRUSH logbrush = { BS_SOLID, color, 0 }; LOGBRUSH logbrush = { BS_SOLID, color, 0 };
#ifdef DEBUG_GDI dprintf_gdi(stddeb, "CreateSolidBrush: %06x\n", color );
printf( "CreateSolidBrush: %06x\n", color );
#endif
return CreateBrushIndirect( &logbrush ); return CreateBrushIndirect( &logbrush );
} }

View file

@ -9,7 +9,10 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <stdio.h> #include <stdio.h>
#include "gdi.h" #include "gdi.h"
#include "metafile.h" #include "metafile.h"
#include "stddebug.h"
/* #define DEBUG_CLIPPING /* */
/* #undef DEBUG_CLIPPING /* */
#include "debug.h"
/*********************************************************************** /***********************************************************************
* CLIPPING_SetDeviceClipping * CLIPPING_SetDeviceClipping
@ -109,9 +112,7 @@ int SelectClipRgn( HDC hdc, HRGN hrgn )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "SelectClipRgn: %d %d\n", hdc, hrgn );
printf( "SelectClipRgn: %d %d\n", hdc, hrgn );
#endif
return CLIPPING_SelectRgn( dc, &dc->w.hClipRgn, hrgn ); return CLIPPING_SelectRgn( dc, &dc->w.hClipRgn, hrgn );
} }
@ -124,9 +125,7 @@ int SelectVisRgn( HDC hdc, HRGN hrgn )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "SelectVisRgn: %d %d\n", hdc, hrgn );
printf( "SelectVisRgn: %d %d\n", hdc, hrgn );
#endif
return CLIPPING_SelectRgn( dc, &dc->w.hVisRgn, hrgn ); return CLIPPING_SelectRgn( dc, &dc->w.hVisRgn, hrgn );
} }
@ -145,9 +144,7 @@ int OffsetClipRgn( HDC hdc, short x, short y )
return NULLREGION; /* ?? */ return NULLREGION; /* ?? */
} }
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "OffsetClipRgn: %d %d,%d\n", hdc, x, y );
printf( "OffsetClipRgn: %d %d,%d\n", hdc, x, y );
#endif
if (dc->w.hClipRgn) if (dc->w.hClipRgn)
{ {
@ -166,9 +163,7 @@ int OffsetVisRgn( HDC hdc, short x, short y )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "OffsetVisRgn: %d %d,%d\n", hdc, x, y );
printf( "OffsetVisRgn: %d %d,%d\n", hdc, x, y );
#endif
if (dc->w.hVisRgn) if (dc->w.hVisRgn)
{ {
@ -240,10 +235,8 @@ int ExcludeClipRect( HDC hdc, short left, short top,
return NULLREGION; /* ?? */ return NULLREGION; /* ?? */
} }
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "ExcludeClipRect: %d %dx%d,%dx%d\n",
printf( "ExcludeClipRect: %d %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
#endif
return CLIPPING_IntersectRect( dc, &dc->w.hClipRgn, left, top, return CLIPPING_IntersectRect( dc, &dc->w.hClipRgn, left, top,
right, bottom, 1 ); right, bottom, 1 );
} }
@ -264,10 +257,8 @@ int IntersectClipRect( HDC hdc, short left, short top,
return NULLREGION; /* ?? */ return NULLREGION; /* ?? */
} }
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "IntersectClipRect: %d %dx%d,%dx%d\n",
printf( "IntersectClipRect: %d %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
#endif
return CLIPPING_IntersectRect( dc, &dc->w.hClipRgn, left, top, return CLIPPING_IntersectRect( dc, &dc->w.hClipRgn, left, top,
right, bottom, 0 ); right, bottom, 0 );
} }
@ -281,10 +272,8 @@ int ExcludeVisRect( HDC hdc, short left, short top,
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "ExcludeVisRect: %d %dx%d,%dx%d\n",
printf( "ExcludeVisRect: %d %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
#endif
return CLIPPING_IntersectRect( dc, &dc->w.hVisRgn, left, top, return CLIPPING_IntersectRect( dc, &dc->w.hVisRgn, left, top,
right, bottom, 1 ); right, bottom, 1 );
} }
@ -298,10 +287,8 @@ int IntersectVisRect( HDC hdc, short left, short top,
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "IntersectVisRect: %d %dx%d,%dx%d\n",
printf( "IntersectVisRect: %d %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
#endif
return CLIPPING_IntersectRect( dc, &dc->w.hVisRgn, left, top, return CLIPPING_IntersectRect( dc, &dc->w.hVisRgn, left, top,
right, bottom, 0 ); right, bottom, 0 );
} }
@ -314,11 +301,10 @@ BOOL PtVisible( HDC hdc, short x, short y )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING
printf( "PtVisible: %d %d,%d\n", hdc, x, y ); dprintf_clipping(stddeb, "PtVisible: %d %d,%d\n", hdc, x, y );
#endif if (!dc->w.hGCClipRgn) return FALSE;
if (!dc->w.hClipRgn) return FALSE; return PtInRegion( dc->w.hGCClipRgn, XLPTODP(dc,x), YLPTODP(dc,y) );
return PtInRegion( dc->w.hClipRgn, x, y );
} }
@ -327,13 +313,16 @@ BOOL PtVisible( HDC hdc, short x, short y )
*/ */
BOOL RectVisible( HDC hdc, LPRECT rect ) BOOL RectVisible( HDC hdc, LPRECT rect )
{ {
RECT tmpRect;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return FALSE;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb,"RectVisible: %d %p\n", hdc, rect );
printf( "RectVisible: %d %p\n", hdc, rect ); if (!dc->w.hGCClipRgn) return FALSE;
#endif tmpRect.left = XLPTODP(dc, rect->left);
if (!dc->w.hClipRgn) return FALSE; tmpRect.top = YLPTODP(dc, rect->top);
return RectInRegion( dc->w.hClipRgn, rect ); tmpRect.right = XLPTODP(dc, rect->right);
tmpRect.bottom = YLPTODP(dc, rect->bottom);
return RectInRegion( dc->w.hGCClipRgn, &tmpRect );
} }
@ -344,9 +333,7 @@ int GetClipBox( HDC hdc, LPRECT rect )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "GetClipBox: %d %p\n", hdc, rect );
printf( "GetClipBox: %d %p\n", hdc, rect );
#endif
if (dc->w.hGCClipRgn) return GetRgnBox( dc->w.hGCClipRgn, rect ); if (dc->w.hGCClipRgn) return GetRgnBox( dc->w.hGCClipRgn, rect );
else else
@ -368,9 +355,7 @@ HRGN SaveVisRgn( HDC hdc )
RGNOBJ *obj, *copyObj; RGNOBJ *obj, *copyObj;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0; if (!dc) return 0;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "SaveVisRgn: %d\n", hdc );
printf( "SaveVisRgn: %d\n", hdc );
#endif
if (!dc->w.hVisRgn) return 0; if (!dc->w.hVisRgn) return 0;
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC ))) if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC )))
return 0; return 0;
@ -393,9 +378,7 @@ int RestoreVisRgn( HDC hdc )
RGNOBJ *obj, *savedObj; RGNOBJ *obj, *savedObj;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return ERROR; if (!dc) return ERROR;
#ifdef DEBUG_CLIPPING dprintf_clipping(stddeb, "RestoreVisRgn: %d\n", hdc );
printf( "RestoreVisRgn: %d\n", hdc );
#endif
if (!dc->w.hVisRgn) return ERROR; if (!dc->w.hVisRgn) return ERROR;
if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC ))) if (!(obj = (RGNOBJ *) GDI_GetObjPtr( dc->w.hVisRgn, REGION_MAGIC )))
return ERROR; return ERROR;

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