Commit aca05783 authored by Alexandre Julliard's avatar Alexandre Julliard

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 :-(
parent 940d58c2
- 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.
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>
......
#! /bin/sh #! /bin/sh
#
# Configure script for wine
: ${EDITOR:=vi}
: ${PAGER:=more}
ALLDEFINES='' ALLDEFINES=''
echo # Ask question 'str' and sets 'var' reply (defaulting to 'def' on CR)
prompt ()
{
str="$1"
var="$2"
def="$3"
eval $var='$def'
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' ]
then then
WINELIB='#define WINELIB -DWINELIB' WINELIB='#define WINELIB -DWINELIB'
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
...@@ -32,54 +59,154 @@ echo -n 'Short filenames (Y/N) [N]? ' ...@@ -32,54 +59,154 @@ echo -n 'Short filenames (Y/N) [N]? '
read input read input
if [ "$input" = 'y' -o "$input" = 'Y' ] if [ "$input" = 'y' -o "$input" = 'Y' ]
then then
SHORTNAMES='#define ShortNames -DSHORTNAMES' SHORTNAMES='#define ShortNames -DSHORTNAMES'
ALLDEFINES="$ALLDEFINES -DSHORTNAMES" ALLDEFINES="$ALLDEFINES -DSHORTNAMES"
else 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
echo "Error while creating backup file. Fix it and run Configure again"
exit 1
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 else
WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "'$input'"' if [ ! -r $WINE_CONFIGFILE ]
then
echo 'Ok, remember to make it yourself later.'
fi
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 then
if grep seg_not_present /usr/include/linux/ldt.h NEWLINUXLDT='#define NEW_LDT_STRUCT'
then
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
...@@ -81,3 +81,37 @@ Some functions are defined as type "register" in the DLL specification files. ...@@ -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.
...@@ -87,7 +87,7 @@ SYSLIBS = -lm -lg ...@@ -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)) ...@@ -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]'`
...@@ -7,7 +7,7 @@ included in the original work (you may also add your own ...@@ -7,7 +7,7 @@ included in the original work (you may also add your own
copyright notice); and (3) agree to indemnify and hold all prior copyright notice); and (3) agree to indemnify and hold all prior
authors, copyright holders and licensors of the work harmless authors, copyright holders and licensors of the work harmless
from and against all damages arising from use of the work. from and against all damages arising from use of the work.
You may distribute sources of derivative works of the work You may distribute sources of derivative works of the work
provided that (1) (a) all source files of the original work that provided that (1) (a) all source files of the original work that
have been modified, (b) all source files of the derivative work have been modified, (b) all source files of the derivative work
...@@ -19,7 +19,7 @@ Sources") carry a prominent notice explaining the nature and date ...@@ -19,7 +19,7 @@ Sources") carry a prominent notice explaining the nature and date
of the modification and/or creation. You are encouraged to make of the modification and/or creation. You are encouraged to make
the Necessary Sources available under this license in order to the Necessary Sources available under this license in order to
further the development and acceptance of the work. further the development and acceptance of the work.
EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED EXCEPT AS OTHERWISE RESTRICTED BY LAW, THIS WORK IS PROVIDED
WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND, INCLUDING
BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF FITNESS FOR A
...@@ -27,4 +27,3 @@ PARTICULAR PURPOSE, MERCHANTABILITY OR TITLE. EXCEPT AS ...@@ -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.
...@@ -5,19 +5,18 @@ MODULE = controls ...@@ -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::
......
...@@ -10,6 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994"; ...@@ -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 ) ...@@ -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 );
} }
......
...@@ -7,12 +7,12 @@ ...@@ -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 ); ...@@ -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" }
}; };
......
...@@ -16,12 +16,7 @@ SRCS = \ ...@@ -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
......
...@@ -178,14 +178,16 @@ wine_debug(int signal, int * regs) ...@@ -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 */
......
...@@ -157,10 +157,10 @@ load_entrypoints(){ ...@@ -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(){ ...@@ -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;
......
...@@ -282,16 +282,18 @@ void dbg_bt(){ ...@@ -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(){ ...@@ -301,5 +303,6 @@ void dbg_bt(){
(SC_SS << 16)); (SC_SS << 16));
} }
} }
putchar('\n');
} }
...@@ -11,9 +11,7 @@ SRCS = \ ...@@ -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 = \ ...@@ -22,7 +20,6 @@ OBJS = \
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::
......
...@@ -11,14 +11,10 @@ SRCS = \ ...@@ -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::
......
...@@ -6,6 +6,4 @@ AllTarget() ...@@ -6,6 +6,4 @@ AllTarget()
depend:: depend::
CleanTarget()
includes:: includes::
...@@ -62,15 +62,16 @@ MakeDllFromSpec(winsock,$(TOP)/$(MODULE)) ...@@ -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
...@@ -26,6 +26,12 @@ struct thunk_s ...@@ -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
*/ */
...@@ -140,9 +146,24 @@ void FreeProcInstance(FARPROC func) ...@@ -140,9 +146,24 @@ 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);
......
...@@ -93,7 +93,7 @@ length 415 ...@@ -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 ...@@ -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 ...@@ -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
......
...@@ -110,12 +110,12 @@ DLLRelay(unsigned int func_num, unsigned int seg_off) ...@@ -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);
......
...@@ -270,9 +270,10 @@ length 540 ...@@ -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)
......
...@@ -33,6 +33,4 @@ AllTarget() ...@@ -33,6 +33,4 @@ AllTarget()
depend:: depend::
CleanTarget()
includes:: includes::
...@@ -10,9 +10,6 @@ ...@@ -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;
......
/*
* 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 */
This diff is collapsed. Click to expand it.
...@@ -16,15 +16,15 @@ ...@@ -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;
......
...@@ -17,21 +17,36 @@ typedef struct resource_name_table ...@@ -17,21 +17,36 @@ typedef struct resource_name_table
char id[MAX_NAME_LENGTH]; char id[MAX_NAME_LENGTH];
} RESNAMTAB; } RESNAMTAB;
struct ne_data {
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
char *lookup_table;
char *nrname_table;
char *rname_table;
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
{ {
struct w_files * next; struct w_files * next;
char * name; /* Name, as it appears in the windows binaries */ char * name; /* Name, as it appears in the windows binaries */
char * filename; /* Actual name of the unix file that satisfies this */ char * filename; /* Actual name of the unix file that satisfies this */
int fd; int fd;
struct mz_header_s *mz_header;
struct ne_header_s *ne_header;
struct ne_segment_table_entry_s *seg_table;
struct segment_descriptor_s *selector_table;
char * lookup_table;
char * nrname_table;
char * rname_table;
unsigned short hinstance; unsigned short hinstance;
RESNAMTAB *resnamtab; 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;
......
...@@ -302,7 +302,6 @@ extern HANDLE GDI_AllocObject( WORD, WORD ); ...@@ -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;
......
...@@ -15,7 +15,7 @@ typedef struct ...@@ -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;
......
...@@ -7,6 +7,7 @@ typedef struct tagLISTSTRUCT { ...@@ -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;
...@@ -26,7 +27,7 @@ typedef struct tagHEADLIST { ...@@ -26,7 +27,7 @@ typedef struct tagHEADLIST {
void *lpFirst; void *lpFirst;
DWORD dwStyle; DWORD dwStyle;
HWND hWndLogicParent; HWND hWndLogicParent;
HFONT hFont; HFONT hFont;
} HEADLIST; } HEADLIST;
typedef HEADLIST FAR* LPHEADLIST; typedef HEADLIST FAR* LPHEADLIST;
......
...@@ -10,6 +10,7 @@ struct dosdirent { ...@@ -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;
}; };
......
/*
* 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 */
...@@ -40,16 +40,6 @@ int set_ldt_entry(int entry, unsigned long base, unsigned int limit, ...@@ -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 */
......
#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 */
...@@ -77,12 +77,6 @@ extern int IPCCopySelector(int i_old, unsigned long new, int swap_type); ...@@ -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 */
/*
* 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 */
/* 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
...@@ -9,7 +9,7 @@ ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 );
......
/*
* *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 */
...@@ -8,6 +8,9 @@ SRCS = \ ...@@ -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) ...@@ -18,7 +21,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::
......
...@@ -6,6 +6,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -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, ...@@ -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);
......
/* /*
* 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"; ...@@ -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) ...@@ -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) ...@@ -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)
{ {
printf("FreeLibrary(%04X);\n", hLib); struct w_files *wpnt;
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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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)
{ {
......
...@@ -9,12 +9,6 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -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"; ...@@ -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) ...@@ -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) ...@@ -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,18 +93,8 @@ int _WinMain(int argc, char **argv) ...@@ -285,18 +93,8 @@ 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], '/');
if(!cp) cp = argv[0]; if(!cp) cp = argv[0];
...@@ -312,96 +110,14 @@ int _WinMain(int argc, char **argv) ...@@ -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->
selector_table[wine_files->ne_header->auto_data_seg-1].selector);
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->ne)
StartNEprogram(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 */
/*
* 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");
}
}
/*
* (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);
}
...@@ -12,6 +12,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -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"; ...@@ -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]; ...@@ -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) ...@@ -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, ...@@ -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,9 +663,8 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal) ...@@ -662,9 +663,8 @@ 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;
struct entry_tab_movable_s *etm; struct entry_tab_movable_s *etm;
...@@ -672,8 +672,7 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal) ...@@ -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) ...@@ -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) ...@@ -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)));
} }
...@@ -728,73 +727,6 @@ GetEntryPointFromOrdinal(struct w_files * wpnt, int ordinal) ...@@ -728,73 +727,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
*/ */
LPSTR GetDOSEnvironment(void) LPSTR GetDOSEnvironment(void)
...@@ -810,7 +742,6 @@ CreateEnvironment(void) ...@@ -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) ...@@ -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 * ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
} }
......
...@@ -12,14 +12,26 @@ ...@@ -12,14 +12,26 @@
#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"
#include "segmem.h" #include "segmem.h"
#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];
...@@ -90,8 +102,6 @@ static void win_fault(int signal, int code, struct sigcontext *scp) ...@@ -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
......
...@@ -3,9 +3,6 @@ ...@@ -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"; ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) {
......
...@@ -11,7 +11,6 @@ OBJS = $(SRCS:.c=.o) ...@@ -11,7 +11,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::
......
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"; ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
} }
...@@ -804,8 +802,8 @@ DWORD GetFreeSpace(UINT wFlags) ...@@ -804,8 +802,8 @@ DWORD GetFreeSpace(UINT wFlags)
for (i = 0; i < 512; i++) for (i = 0; i < 512; i++)
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) ...@@ -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 );
}
...@@ -8,8 +8,11 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
} }
...@@ -461,7 +440,7 @@ unsigned int ...@@ -461,7 +440,7 @@ unsigned int
WIN16_LocalFlags(unsigned int handle) WIN16_LocalFlags(unsigned int handle)
{ {
MDESC *m; MDESC *m;
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) | m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1; (handle & 0xffff)) - 1;
if (m->next != m || m->prev != m) if (m->next != m || m->prev != m)
...@@ -510,7 +489,7 @@ WIN16_LocalInit(unsigned int segment, unsigned int start, unsigned int end) ...@@ -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;
} }
...@@ -521,7 +500,7 @@ void * ...@@ -521,7 +500,7 @@ void *
WIN16_LocalLock(unsigned int handle) WIN16_LocalLock(unsigned int handle)
{ {
MDESC *m; MDESC *m;
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) | m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1; (handle & 0xffff)) - 1;
if (m->next != m || m->prev != m) if (m->next != m || m->prev != m)
...@@ -538,11 +517,12 @@ void * ...@@ -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);
...@@ -557,7 +537,7 @@ unsigned int ...@@ -557,7 +537,7 @@ unsigned int
WIN16_LocalSize(unsigned int handle) WIN16_LocalSize(unsigned int handle)
{ {
MDESC *m; MDESC *m;
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) | m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1; (handle & 0xffff)) - 1;
if (m->next != m || m->prev != m) if (m->next != m || m->prev != m)
...@@ -619,9 +599,7 @@ WORD GetFreeSystemResources(WORD SystemResourceType) ...@@ -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 */
......
...@@ -7,7 +7,6 @@ SRCS = \ ...@@ -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) ...@@ -35,7 +34,6 @@ OBJS = $(SRCS:.c=.o)
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS)) WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget() DependTarget()
CleanTarget()
includes:: includes::
......
...@@ -6,10 +6,6 @@ ...@@ -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"; ...@@ -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) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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) ...@@ -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() ...@@ -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() ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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() ...@@ -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) ...@@ -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) ...@@ -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() ...@@ -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
} }
......
...@@ -19,8 +19,10 @@ ...@@ -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) ...@@ -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); ...@@ -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); ...@@ -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) ...@@ -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); ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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); ...@@ -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) ...@@ -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); ...@@ -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); ...@@ -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) ...@@ -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); ...@@ -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); ...@@ -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); ...@@ -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); ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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 ...@@ -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);
......
...@@ -3,6 +3,8 @@ ...@@ -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 @@ ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -251,21 +245,31 @@ int DOS_ValidDrive(int drive)
return 1; return 1;
} }
int DOS_GetDefaultDrive(void)
int DOS_ValidDirectory(char *name)
{ {
#ifdef DEBUG char *dirname;
fprintf(stderr,"GetDefaultDrive (%c)\n",'A'+CurrentDrive); struct stat s;
#endif 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)
{
dprintf_dosfs(stddeb,"GetDefaultDrive (%c)\n",'A'+CurrentDrive);
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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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, ...@@ -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); ...@@ -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); ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
...@@ -12,6 +12,10 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; ...@@ -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() ...@@ -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,12 +47,12 @@ void LoadStartupDrivers() ...@@ -40,12 +47,12 @@ 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);
} }
/************************************************************************** /**************************************************************************
* OpenDriver [USER.252] * OpenDriver [USER.252]
*/ */
HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
{ {
...@@ -53,12 +60,12 @@ HDRVR OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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, ...@@ -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,15 +193,16 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags) ...@@ -185,15 +193,16 @@ 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;
} }
lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr); lpdrv = (LPDRIVERITEM) GlobalLock(hDrvr);
...@@ -208,7 +217,7 @@ HDRVR GetNextDriver(HDRVR hDrvr, DWORD dwFlags) ...@@ -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;
} }
......
...@@ -13,6 +13,10 @@ ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment