Release 960717

Wed Jul 17 16:10:16 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure.in]
	Generate include/config.h instead of putting everything on the
	command-line.
	Removed -with-malloc-debug option (not useful for end users
	anyway).
	Added check for memmove().

	* [include/wintypes.h] [*/Makefile.in]
	Added definition of __WINE__ symbol when compiling Wine code
	(emulator or library) as opposed to user programs.

	* [debugger/editline.c] [debugger/readline/*]
	Moved all the readline code into debugger/editline.c. Removed the
	readline subdirectory.

	* [files/profile.c]
	Added PROFILE_GetWineIniInt().

	* [include/stackframe.h] [loader/task.c]
	The 16-bit stackframe now also exists for Winelib (even though it
	only ever contains one frame).

	* [loader/module.c]
	Added function MODULE_CreateDummyModule() to create a dummy Win16
	module for Winelib and Win32.

	* [memory/ldt.c]
	Make sure the ldt entry contents will be acceptable for the Linux
	kernel.

	* [memory/selector.c]
	Fixed SetSelectorLimit() when the limit is in pages.

	* [misc/port.c]
	Added memmove().

	* [miscemu/dpmi.c]
	Clear the segment registers that contain the selector being freed
	in int31/ax=0001.
	Added missing break after SelectorAccessRights call.

	* [win32/struct32.c]
	Added conversions for MDICREATESTRUCT.

	* [windows/winproc.c]
	Added message conversions for WM_MDICREATE.

Tue Jul 16 19:46:24 1996  Pavel Kankovsky <KAN@frode.dcit.cz>

	* [windows/class.c]
	Added GetExePtr() call in CLASS_FindClassByAtom().

Mon Jul 15 17:49:38 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [if1632/*.spec]
	Some more trivial specs added.

	* [if1632/gdi32.spec] [objects/font.c][windows/dialog.c]
	CreateFont32* added, changed to new naming std.

	* [include/windows.h] [include/mmsystem.h] [include/wintypes.h]
	Some defines/types added.

	* [win32/thread.c]
	TlsSetValue() returns boolean.

	* [win32/resource.c] [loader/pe_resource.c] [loader/resource.c]
 	  [controls/menu.c] [objects/bitmap.c]
	Cleanup of the resource functions, mostly changes to new naming
 	standard and fixing of argument types so that they agree with the
 	win16/win32 API.

Thu Jul 11 15:00:00 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [windows/winpos.c]
	ShowWindow() fixes.

	* [windows/mdi.c]
	Fix reversed LPARAM in WM_MDIACTIVATE.

	* [wine.ini]
	New option AllocSystemColors tells Wine how many colors to grab
	from the system colormap.

	* [objects/bitblt.c] [objects/dc.c]
	Fixed pink garbage over Word buttons in PseudoColor. Added
	optional DSTINVERT shortcut for faster text selection.

	* [misc/wsprintf.c]
	Skip bogus segmented pointers in wsvnprintf16(). 

	* [objects/gdiobj.c]
	Added palette handling to UnrealizeObject(). 

	* [objects/color.c] [objects/palette.c] [windows/dce.c]
	Wine gets palette manager with support for more than 20 colors. 
	Only PseudoColor and TrueColor visuals tested so far.

	* [windows/winpos.c] [windows/win.c] 
	Set X size hints for WS_EX_DLGMODALFRAME windows (no resize) and
	use XReconfigureWMWindows() instead of XConfigureWindow() in
	managed mode.

	* [memory/global.c]
	Do not allocate more than 640K of DOS memory.

	* [misc/main.c]
	Do not allow -desktop and -managed together.
oldstable wine-960717
Alexandre Julliard 1996-07-17 20:02:21 +00:00
parent ca22b33dad
commit 18f92e764a
140 changed files with 3346 additions and 2560 deletions

View File

@ -1,13 +1,13 @@
This is release 960712 of Wine, the MS Windows emulator. This is still a
This is release 960717 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-960712: (see ChangeLog for details)
- Many built-in debugger improvements.
- Some more Win32 functions.
WHAT'S NEW with Wine-960717: (see ChangeLog for details)
- New palette management.
- Changes to the configuration process.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -16,10 +16,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960712.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960712.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960712.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960712.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960717.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960717.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960717.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960717.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

15
BUGS
View File

@ -1,26 +1,19 @@
1. 32-bit/16-bit call translation:
- EBP and ESP are sometimes corrupted while running 16-bit code.
2. Messaging:
1. Messaging:
- Message flow is not correct for multiple tasks
- Dialog Boxes created by WM_CREATE handler aren't visible
- MDI does not send WM_GETMINMAX message.
- resizing of MDI child windows sometimes leaves them unrepainted
3. Controls:
2. Controls:
- Some features are missing (like VK_SHIFT aided multiple selection in listboxes)
4. Miscellaneous:
3. Miscellaneous:
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors
- AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times.
- Dialogs don't support resources which are referred to as integers.
5. Where to look in source files:
4. Where to look in source files:
- grep for FIXME in the source files.

112
ChangeLog
View File

@ -1,3 +1,115 @@
----------------------------------------------------------------------
Wed Jul 17 16:10:16 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [configure.in]
Generate include/config.h instead of putting everything on the
command-line.
Removed -with-malloc-debug option (not useful for end users
anyway).
Added check for memmove().
* [include/wintypes.h] [*/Makefile.in]
Added definition of __WINE__ symbol when compiling Wine code
(emulator or library) as opposed to user programs.
* [debugger/editline.c] [debugger/readline/*]
Moved all the readline code into debugger/editline.c. Removed the
readline subdirectory.
* [files/profile.c]
Added PROFILE_GetWineIniInt().
* [include/stackframe.h] [loader/task.c]
The 16-bit stackframe now also exists for Winelib (even though it
only ever contains one frame).
* [loader/module.c]
Added function MODULE_CreateDummyModule() to create a dummy Win16
module for Winelib and Win32.
* [memory/ldt.c]
Make sure the ldt entry contents will be acceptable for the Linux
kernel.
* [memory/selector.c]
Fixed SetSelectorLimit() when the limit is in pages.
* [misc/port.c]
Added memmove().
* [miscemu/dpmi.c]
Clear the segment registers that contain the selector being freed
in int31/ax=0001.
Added missing break after SelectorAccessRights call.
* [win32/struct32.c]
Added conversions for MDICREATESTRUCT.
* [windows/winproc.c]
Added message conversions for WM_MDICREATE.
Tue Jul 16 19:46:24 1996 Pavel Kankovsky <KAN@frode.dcit.cz>
* [windows/class.c]
Added GetExePtr() call in CLASS_FindClassByAtom().
Mon Jul 15 17:49:38 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [if1632/*.spec]
Some more trivial specs added.
* [if1632/gdi32.spec] [objects/font.c][windows/dialog.c]
CreateFont32* added, changed to new naming std.
* [include/windows.h] [include/mmsystem.h] [include/wintypes.h]
Some defines/types added.
* [win32/thread.c]
TlsSetValue() returns boolean.
* [win32/resource.c] [loader/pe_resource.c] [loader/resource.c]
[controls/menu.c] [objects/bitmap.c]
Cleanup of the resource functions, mostly changes to new naming
standard and fixing of argument types so that they agree with the
win16/win32 API.
Thu Jul 11 15:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/winpos.c]
ShowWindow() fixes.
* [windows/mdi.c]
Fix reversed LPARAM in WM_MDIACTIVATE.
* [wine.ini]
New option AllocSystemColors tells Wine how many colors to grab
from the system colormap.
* [objects/bitblt.c] [objects/dc.c]
Fixed pink garbage over Word buttons in PseudoColor. Added
optional DSTINVERT shortcut for faster text selection.
* [misc/wsprintf.c]
Skip bogus segmented pointers in wsvnprintf16().
* [objects/gdiobj.c]
Added palette handling to UnrealizeObject().
* [objects/color.c] [objects/palette.c] [windows/dce.c]
Wine gets palette manager with support for more than 20 colors.
Only PseudoColor and TrueColor visuals tested so far.
* [windows/winpos.c] [windows/win.c]
Set X size hints for WS_EX_DLGMODALFRAME windows (no resize) and
use XReconfigureWMWindows() instead of XConfigureWindow() in
managed mode.
* [memory/global.c]
Do not allocate more than 640K of DOS memory.
* [misc/main.c]
Do not allow -desktop and -managed together.
----------------------------------------------------------------------
Fri Jul 12 17:43:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -6,8 +6,8 @@
SHELL = /bin/sh
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
DEFS = @DEFS@
CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
XPM_LIB = -lXpm
@ -17,13 +17,13 @@ YACC = @YACC@
LEX = @LEX@
LEXLIB = @LEXLIB@
DIVINCL = -I$(TOPSRC)/include
ALLCFLAGS = $(CFLAGS) $(DEFS) $(DIVINCL) $(X_CFLAGS) $(EXTRA_DEFS)
ALLCFLAGS = $(CFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) $(X_CFLAGS)
LDCOMBINE = ld -r
RM = rm -f
BUILD = $(TOPSRC)/tools/build
WINERC = $(TOPSRC)/rc/winerc
WINELIB = $(TOPSRC)/libwine.a
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)'
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
@SET_MAKE@
OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
@ -43,14 +43,14 @@ OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
echo "#include \"windows.h\"" >winerctmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c
cat $< >>winerctmp.c
$(CPP) $(DEFS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(RM) winerctmp.c
.rc.h:
echo "#include \"windows.h\"" >winerctmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c
cat $< >>winerctmp.c
$(CPP) $(DEFS) $(DIVINCL) -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(CPP) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(RM) winerctmp.c

View File

@ -13,20 +13,17 @@
SHELL = /bin/sh
CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
DEFS = @DEFS@ -DWINE_INI_GLOBAL=\"$(WINE_INI_GLOBAL)\"
X_CFLAGS = @X_CFLAGS@
CFLAGS = @CFLAGS@
OPTIONS = @OPTIONS@
X_LIBS = @X_LIBS@
TOPSRC = @top_srcdir@
DIVINCL = -I$(TOPSRC)/include
XPM_LIB = -lXpm
XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
LDLIBS = @LDLIBS@
XPM_LIB = -lXpm
XLIB = @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
LDLIBS = @LDLIBS@
AR = ar rc
RANLIB = @RANLIB@
RM = rm -f
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'DEFS=$(DEFS)'
SUBMAKE = $(MAKE) 'CC=$(CC)' 'CFLAGS=$(CFLAGS)' 'OPTIONS=$(OPTIONS)'
@SET_MAKE@
# Installation infos
@ -38,10 +35,8 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
sysconfdir = @sysconfdir@
mandir = @mandir@/man1
manext = .1
WINE_INI_GLOBAL = $(sysconfdir)/wine.conf
# Main target to build
@ -64,7 +59,6 @@ COMMONSUBDIRS = \
EMUSUBDIRS = \
tools \
debugger \
debugger/readline \
if1632 \
miscemu
@ -89,7 +83,6 @@ COMMONOBJS = \
EMUOBJS = \
debugger/debugger.o \
debugger/readline/readline.o \
if1632/if1632.o \
miscemu/miscemu.o
@ -141,7 +134,7 @@ clean:
(cd include; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc)
distclean: clean
$(RM) config.* Make.rules
$(RM) config.* Make.rules include/config.h
$(RM) `find . \( -name Makefile -o -size 0 \) -print`
dummy:

274
configure vendored
View File

@ -18,8 +18,6 @@ ac_help="$ac_help
--with-dll build Wine as a DLL instead of an emulator"
ac_help="$ac_help
--with-ipc use inter-process communication for DDE"
ac_help="$ac_help
--with-malloc-debug enable malloc() debugging"
ac_help="$ac_help
--with-x use the X Window System"
@ -523,6 +521,7 @@ else
fi
ac_aux_dir=
for ac_dir in tools $srcdir/tools; do
if test -f $ac_dir/install-sh; then
@ -552,48 +551,27 @@ test -z "$LDLIBS" && LDLIBS=-lm
# Check whether --with-library or --without-library was given.
if test "${with_library+set}" = set; then
withval="$with_library"
cat >> confdefs.h <<\EOF
#define WINELIB 1
EOF
MAIN_TARGET="libwine.a"
OPTIONS="-DWINELIB" MAIN_TARGET="libwine.a"
else
MAIN_TARGET="wine"
OPTIONS="" MAIN_TARGET="wine"
fi
# Check whether --with-dll or --without-dll was given.
if test "${with_dll+set}" = set; then
withval="$with_dll"
cat >> confdefs.h <<\EOF
#define WINELIB 1
EOF
cat >> confdefs.h <<\EOF
#define WINELIBDLL 1
EOF
MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"
OPTIONS="-DWINELIB -DWINELIBDLL" MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"
fi
# Check whether --with-ipc or --without-ipc was given.
if test "${with_ipc+set}" = set; then
withval="$with_ipc"
cat >> confdefs.h <<\EOF
#define CONFIG_IPC 1
EOF
OPTIONS="$OPTIONS -DCONFIG_IPC"
fi
# Check whether --with-malloc-debug or --without-malloc-debug was given.
if test "${with_malloc_debug+set}" = set; then
withval="$with_malloc_debug"
cat >> confdefs.h <<\EOF
#define MALLOC_DEBUGGING 1
EOF
fi
@ -709,7 +687,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:691: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -761,13 +739,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 765 "configure"
#line 743 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -776,13 +754,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 780 "configure"
#line 758 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:786: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@ -886,12 +864,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
#line 890 "configure"
#line 868 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -958,7 +936,7 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 962 "configure"
#line 940 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -966,7 +944,7 @@ int t() {
${x_direct_test_function}()
; return 0; }
EOF
if { (eval echo configure:970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@ -1087,7 +1065,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1091 "configure"
#line 1069 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1099,7 +1077,7 @@ int t() {
IceConnectionNumber()
; return 0; }
EOF
if { (eval echo configure:1103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1135,7 +1113,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1139 "configure"
#line 1117 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1147,7 +1125,7 @@ int t() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1174,7 +1152,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1178 "configure"
#line 1156 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1186,7 +1164,7 @@ int t() {
dnet_ntoa()
; return 0; }
EOF
if { (eval echo configure:1190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1218,7 +1196,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1222 "configure"
#line 1200 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1230,7 +1208,7 @@ int t() {
t_accept()
; return 0; }
EOF
if { (eval echo configure:1234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1262,7 +1240,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1266 "configure"
#line 1244 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1274,7 +1252,7 @@ int t() {
socket()
; return 0; }
EOF
if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1302,7 +1280,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket -lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1306 "configure"
#line 1284 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1314,7 +1292,7 @@ int t() {
socket()
; return 0; }
EOF
if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1412,7 +1390,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-l$ac_lib $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1416 "configure"
#line 1394 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1424,7 +1402,7 @@ int t() {
yywrap()
; return 0; }
EOF
if { (eval echo configure:1428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1406: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1539,7 +1517,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-li386 $LIBS"
cat > conftest.$ac_ext <<EOF
#line 1543 "configure"
#line 1521 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -1551,7 +1529,7 @@ int t() {
i386_set_ldt()
; return 0; }
EOF
if { (eval echo configure:1555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -1583,11 +1561,11 @@ else
ac_cv_c_cross=yes
else
cat > conftest.$ac_ext <<EOF
#line 1587 "configure"
#line 1565 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
{ (eval echo configure:1591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:1569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_cross=no
else
@ -1608,7 +1586,7 @@ else
ac_cv_c_gcc_strength_bug="yes"
else
cat > conftest.$ac_ext <<EOF
#line 1612 "configure"
#line 1590 "configure"
#include "confdefs.h"
int main(void) {
@ -1619,7 +1597,7 @@ int main(void) {
exit( Array[1] != -2 );
}
EOF
{ (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:1601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
ac_cv_c_gcc_strength_bug="no"
else
@ -1637,14 +1615,14 @@ echo "$ac_t""$ac_cv_c_gcc_strength_bug" 1>&6
fi
for ac_func in tcgetattr usleep
for ac_func in memmove tcgetattr usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1648 "configure"
#line 1626 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -1668,7 +1646,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:1650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -1690,49 +1668,12 @@ else
fi
done
for ac_hdr in stdlib.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1702 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'`
cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
else
echo "$ac_t""no" 1>&6
fi
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1736 "configure"
#line 1677 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -1787,7 +1728,7 @@ if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1791 "configure"
#line 1732 "configure"
#include "confdefs.h"
int main() { return 0; }
@ -1837,7 +1778,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
if { (eval echo configure:1841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1782: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@ -1861,7 +1802,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1865 "configure"
#line 1806 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -1869,7 +1810,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1873: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@ -1884,7 +1825,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1888 "configure"
#line 1829 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -1902,7 +1843,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 1906 "configure"
#line 1847 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -1923,7 +1864,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 1927 "configure"
#line 1868 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -1934,7 +1875,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
{ (eval echo configure:1938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
{ (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }
if test -s conftest && (./conftest; exit) 2>/dev/null; then
:
else
@ -1958,7 +1899,7 @@ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1962 "configure"
#line 1903 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2038,19 +1979,7 @@ fi
trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
cat > conftest.defs <<\EOF
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
s%\[%\\&%g
s%\]%\\&%g
s%\$%$$%g
EOF
DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
rm -f conftest.defs
DEFS=-DHAVE_CONFIG_H
# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}
@ -2093,7 +2022,6 @@ Make.rules
Makefile
controls/Makefile
debugger/Makefile
debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/Makefile
@ -2112,7 +2040,7 @@ rc/Makefile
resources/Makefile
tools/Makefile
win32/Makefile
windows/Makefile " | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
windows/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@ -2144,6 +2072,7 @@ s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@LDLIBS@%$LDLIBS%g
s%@MAIN_TARGET@%$MAIN_TARGET%g
s%@OPTIONS@%$OPTIONS%g
s%@SET_MAKE@%$SET_MAKE%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
@ -2168,7 +2097,6 @@ CONFIG_FILES=\${CONFIG_FILES-"Make.rules
Makefile
controls/Makefile
debugger/Makefile
debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/Makefile
@ -2243,6 +2171,108 @@ s%@INSTALL@%$INSTALL%g
fi; done
rm -f conftest.subs
# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_uB='\([ ]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'
CONFIG_HEADERS=${CONFIG_HEADERS-"include/config.h"}
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
# Support "outfile[:infile]", defaulting infile="outfile.in".
case "$ac_file" in
*:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
*) ac_file_in="${ac_file}.in" ;;
esac
echo creating $ac_file
rm -f conftest.frag conftest.in conftest.out
cp $ac_given_srcdir/$ac_file_in conftest.in
EOF
# Transform confdefs.h into a sed script conftest.vals that substitutes
# the proper values into config.h.in to produce config.h. And first:
# Protect against being on the right side of a sed subst in config.status.
# Protect against being in an unquoted here document in config.status.
rm -f conftest.vals
cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g
s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp
s%ac_u%ac_e%gp
EOF
sed -n -f conftest.hdr confdefs.h > conftest.vals
rm -f conftest.hdr
# This sed command replaces #undef with comments. This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >> conftest.vals <<\EOF
s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
EOF
# Break up conftest.vals because some shells have a limit on
# the size of here documents, and old seds have small limits too.
# Maximum number of lines to put in a single here document.
ac_max_here_lines=12
rm -f conftest.tail
while :
do
ac_lines=`grep -c . conftest.vals`
# grep -c gives empty output for an empty file on some AIX systems.
if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
# Write a limited-size here document to conftest.frag.
echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
echo 'CEOF
sed -f conftest.frag conftest.in > conftest.out
rm -f conftest.in
mv conftest.out conftest.in
' >> $CONFIG_STATUS
sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
rm -f conftest.vals
mv conftest.tail conftest.vals
done
rm -f conftest.vals
cat >> $CONFIG_STATUS <<\EOF
rm -f conftest.frag conftest.h
echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
cat conftest.in >> conftest.h
rm -f conftest.in
if cmp -s $ac_file conftest.h 2>/dev/null; then
echo "$ac_file is unchanged"
rm -f conftest.h
else
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
# The file is in a subdirectory.
test ! -d "$ac_dir" && mkdir "$ac_dir"
fi
rm -f $ac_file
mv conftest.h $ac_file
fi
fi; done
exit 0

View File

@ -3,6 +3,7 @@ dnl Author: Michael Patra <micky@marie.physik.tu-berlin.de>
dnl <patra@itp1.physik.tu-berlin.de>
AC_REVISION([configure.in 1.00])
AC_INIT(controls/edit.c)
AC_CONFIG_HEADER(include/config.h)
AC_CONFIG_AUX_DIR(tools)
# We want these before the checks, so the checks can modify their values.
@ -14,21 +15,19 @@ dnl **** Command-line arguments ****
AC_ARG_WITH(library,
[ --with-library build Wine as a library instead of an emulator],
[AC_DEFINE(WINELIB) MAIN_TARGET="libwine.a"],[MAIN_TARGET="wine"])
[OPTIONS="-DWINELIB" MAIN_TARGET="libwine.a"],
[OPTIONS="" MAIN_TARGET="wine"])
AC_ARG_WITH(dll,
[ --with-dll build Wine as a DLL instead of an emulator],
[AC_DEFINE(WINELIB) AC_DEFINE(WINELIBDLL)
MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"])
AC_SUBST(MAIN_TARGET)
[OPTIONS="-DWINELIB -DWINELIBDLL" MAIN_TARGET="libwine.so.1.0" CFLAGS="$CFLAGS -fPIC"])
AC_ARG_WITH(ipc,
[ --with-ipc use inter-process communication for DDE],
[AC_DEFINE(CONFIG_IPC)])
[OPTIONS="$OPTIONS -DCONFIG_IPC"])
AC_ARG_WITH(malloc-debug,
[ --with-malloc-debug enable malloc() debugging],
[AC_DEFINE(MALLOC_DEBUGGING)])
AC_SUBST(MAIN_TARGET)
AC_SUBST(OPTIONS)
dnl **** Check for some programs and libraries ****
@ -69,8 +68,7 @@ fi
dnl **** Check for functions and header files ****
AC_CHECK_FUNCS(tcgetattr usleep)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_FUNCS(memmove tcgetattr usleep)
AC_HEADER_STAT()
AC_C_CONST()
AC_TYPE_SIZE_T()
@ -85,7 +83,6 @@ Make.rules
Makefile
controls/Makefile
debugger/Makefile
debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/Makefile

View File

@ -1,6 +1,6 @@
TOPSRC = @top_srcdir@
MODULE = controls
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = controls
C_SRCS = \
button.c \

View File

@ -98,7 +98,7 @@ LRESULT ButtonWndProc(HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
if (!hbitmapCheckBoxes)
{
BITMAP16 bmp;
hbitmapCheckBoxes = LoadBitmap(0, MAKEINTRESOURCE(OBM_CHECKBOXES));
hbitmapCheckBoxes = LoadBitmap16(0, MAKEINTRESOURCE(OBM_CHECKBOXES));
GetObject16( hbitmapCheckBoxes, sizeof(bmp), &bmp );
checkBoxWidth = bmp.bmWidth / 4;
checkBoxHeight = bmp.bmHeight / 3;

View File

@ -51,7 +51,7 @@ static int COMBO_Init()
BITMAP16 bm;
dprintf_combo(stddeb, "COMBO_Init\n");
hComboBit = LoadBitmap(0, MAKEINTRESOURCE(OBM_COMBO));
hComboBit = LoadBitmap16(0, MAKEINTRESOURCE(OBM_COMBO));
GetObject16( hComboBit, sizeof(bm), &bm );
CBitHeight = bm.bmHeight;
CBitWidth = bm.bmWidth;

View File

@ -154,7 +154,7 @@ LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message,
ExitWindows( 0, 0 );
case WM_SETCURSOR:
return (LRESULT)SetCursor( LoadCursor( 0, IDC_ARROW ) );
return (LRESULT)SetCursor( LoadCursor16( 0, IDC_ARROW ) );
}
return 0;

View File

@ -617,7 +617,7 @@ static INT EDIT_CallWordBreakProc(WND *wndPtr, char *s, INT index, INT count, IN
EDITWORDBREAKPROC wbp = (EDITWORDBREAKPROC)EDIT_EM_GetWordBreakProc(wndPtr, 0, 0L);
if (wbp) {
return CallWordBreakProc((FARPROC)wbp,
return CallWordBreakProc((FARPROC16)wbp,
(LONG)MAKE_SEGPTR(s), index, count, action);
} else
return EDIT_WordBreakProc(s, index, count, action);
@ -2107,7 +2107,7 @@ static LRESULT EDIT_EM_Undo(WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT EDIT_WM_Char(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
char str[2];
char c = (char)wParam;
unsigned char c = (unsigned char)wParam;
switch (c) {
case '\r':
@ -2739,7 +2739,7 @@ static LRESULT EDIT_WM_Paste(WND *wndPtr, WPARAM wParam, LPARAM lParam)
static LRESULT EDIT_WM_SetCursor(WND *wndPtr, WPARAM wParam, LPARAM lParam)
{
if (LOWORD(lParam) == HTCLIENT) {
SetCursor(LoadCursor(0, IDC_IBEAM));
SetCursor(LoadCursor16(0, IDC_IBEAM));
return -1L;
} else
return 0L;

View File

@ -136,12 +136,12 @@ BOOL MENU_Init()
/* Load bitmaps */
if (!(hStdCheck = LoadBitmap( 0, MAKEINTRESOURCE(OBM_CHECK) )))
if (!(hStdCheck = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_CHECK) )))
return FALSE;
GetObject16( hStdCheck, sizeof(bm), &bm );
check_bitmap_width = bm.bmWidth;
check_bitmap_height = bm.bmHeight;
if (!(hStdMnArrow = LoadBitmap( 0, MAKEINTRESOURCE(OBM_MNARROW) )))
if (!(hStdMnArrow = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_MNARROW) )))
return FALSE;
GetObject16( hStdMnArrow, sizeof(bm), &bm );
arrow_bitmap_width = bm.bmWidth;
@ -2514,11 +2514,11 @@ HMENU LookupMenuHandle( HMENU hmenu, INT id )
/**********************************************************************
* LoadMenu (USER.150)
*/
HMENU LoadMenu( HINSTANCE instance, SEGPTR name )
HMENU16 LoadMenu16( HINSTANCE16 instance, SEGPTR name )
{
HRSRC hRsrc;
HGLOBAL handle;
HMENU hMenu;
HRSRC16 hRsrc;
HGLOBAL16 handle;
HMENU16 hMenu;
if (HIWORD(name))
{
@ -2534,16 +2534,38 @@ HMENU LoadMenu( HINSTANCE instance, SEGPTR name )
/* check for Win32 module */
instance = GetExePtr( instance );
if (MODULE_GetPtr(instance)->flags & NE_FFLAGS_WIN32)
return WIN32_LoadMenuA(instance,PTR_SEG_TO_LIN(name));
return LoadMenu32A(instance,PTR_SEG_TO_LIN(name));
if (!(hRsrc = FindResource( instance, name, RT_MENU ))) return 0;
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
hMenu = LoadMenuIndirect16( LockResource(handle) );
FreeResource( handle );
if (!(hRsrc = FindResource16( instance, name, RT_MENU ))) return 0;
if (!(handle = LoadResource16( instance, hRsrc ))) return 0;
hMenu = LoadMenuIndirect16(LockResource16(handle));
FreeResource16( handle );
return hMenu;
}
/*****************************************************************
* LoadMenu32A (USER32.370)
*/
HMENU32 LoadMenu32A( HINSTANCE32 instance, LPCSTR name )
{
HRSRC32 hrsrc = FindResource32A( instance, name, (LPSTR)RT_MENU );
if (!hrsrc) return 0;
return LoadMenuIndirect32A( (LPCVOID)LoadResource32( instance, hrsrc ));
}
/*****************************************************************
* LoadMenu32W (USER32.372)
*/
HMENU32 LoadMenu32W( HINSTANCE32 instance, LPCWSTR name )
{
HRSRC32 hrsrc = FindResource32W( instance, name, (LPWSTR)RT_MENU );
if (!hrsrc) return 0;
return LoadMenuIndirect32W( (LPCVOID)LoadResource32( instance, hrsrc ));
}
/**********************************************************************
* LoadMenuIndirect16 (USER.220)
*/

View File

@ -79,18 +79,18 @@ static UINT uTrackingPos = 0;
*/
static void SCROLL_LoadBitmaps(void)
{
hUpArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROW));
hDnArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROW));
hLfArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROW));
hRgArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROW));
hUpArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
hDnArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
hLfArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
hUpArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
hDnArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
hLfArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
hRgArrowI = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
hUpArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROW));
hDnArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROW));
hLfArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROW));
hRgArrow = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROW));
hUpArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
hDnArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
hLfArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
hRgArrowD = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
hUpArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
hDnArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
hLfArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
hRgArrowI = LoadBitmap16((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
}

View File

@ -87,9 +87,9 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
CREATESTRUCT16 *cs = (CREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam);
if (cs->lpszName)
{
HICON hicon = LoadIcon( cs->hInstance, cs->lpszName );
HICON16 hicon = LoadIcon16( cs->hInstance, cs->lpszName );
if (!hicon) /* Try OEM icon (FIXME: is this right?) */
hicon = LoadIcon( 0, cs->lpszName );
hicon = LoadIcon16( 0, cs->lpszName );
STATIC_SetIcon( wndPtr, hicon );
}
return 1;
@ -136,7 +136,7 @@ LRESULT StaticWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SETTEXT:
if (style == SS_ICON)
/* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon( wndPtr, LoadIcon( wndPtr->hInstance,
STATIC_SetIcon( wndPtr, LoadIcon16( wndPtr->hInstance,
(SEGPTR)lParam ));
else
DEFWND_SetText( wndPtr, (LPSTR)PTR_SEG_TO_LIN(lParam) );

View File

@ -15,32 +15,35 @@
#include "module.h"
#include "heap.h"
static WNDCLASS16 WIDGETS_BuiltinClasses16[] =
typedef struct
{
UINT16 style;
INT16 wndExtra;
HBRUSH16 background;
LPCSTR procName;
LPCSTR className;
} BUILTIN_CLASS_INFO16;
static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
{
{ CS_GLOBALCLASS | CS_PARENTDC,
(WNDPROC16)"StaticWndProc", 0, sizeof(STATICINFO),
0, 0, 0, 0, 0, (SEGPTR)"STATIC" },
sizeof(STATICINFO), 0, "StaticWndProc", "STATIC" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
(WNDPROC16)"ScrollBarWndProc", 0, sizeof(SCROLLINFO),
0, 0, 0, 0, 0, (SEGPTR)"SCROLLBAR" },
sizeof(SCROLLINFO), 0, "ScrollBarWndProc", "SCROLLBAR" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
(WNDPROC16)"ListBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"LISTBOX" },
8, 0, "ListBoxWndProc", "LISTBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
(WNDPROC16)"ComboBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOBOX" },
8, 0, "ComboBoxWndProc", "COMBOBOX" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
(WNDPROC16)"ComboLBoxWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)"COMBOLBOX" },
8, 0, "ComboLBoxWndProc", "COMBOLBOX" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
(WNDPROC16)"EditWndProc", 0, sizeof(DWORD),
0, 0, 0, 0, 0, (SEGPTR)"EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"PopupMenuWndProc", 0, 8,
0, 0, 0, 0, 0, (SEGPTR)POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"DefDlgProc", 0, DLGWINDOWEXTRA,
0, 0, 0, 0, 0, (SEGPTR)DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, (WNDPROC16)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO),
0, 0, 0, STOCK_LTGRAY_BRUSH, 0, (SEGPTR)"MDICLIENT" }
sizeof(DWORD), 0, "EditWndProc", "EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS,
sizeof(HMENU32), 0, "PopupMenuWndProc", POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS,
DLGWINDOWEXTRA, 0, "DefDlgProc", DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, sizeof(MDICLIENTINFO),
STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDICLIENT" }
};
#define NB_BUILTIN_CLASSES16 \
@ -67,20 +70,28 @@ BOOL WIDGETS_Init(void)
{
int i;
char *name;
WNDCLASS16 *class16 = WIDGETS_BuiltinClasses16;
const BUILTIN_CLASS_INFO16 *info16 = WIDGETS_BuiltinClasses16;
WNDCLASS16 class16;
WNDCLASS32A *class32 = WIDGETS_BuiltinClasses32;
if (!(name = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE;
/* Create 16-bit classes */
for (i = 0; i < NB_BUILTIN_CLASSES16; i++, class16++)
class16.cbClsExtra = 0;
class16.hInstance = 0;
class16.hIcon = 0;
class16.hCursor = LoadCursor16( 0, IDC_ARROW );
class16.lpszMenuName = (SEGPTR)0;
class16.lpszClassName = SEGPTR_GET(name);
for (i = 0; i < NB_BUILTIN_CLASSES16; i++, info16++)
{
strcpy( name, (char *)class16->lpszClassName );
class16->lpszClassName = SEGPTR_GET(name);
class16->hCursor = LoadCursor( 0, IDC_ARROW );
class16->lpfnWndProc = MODULE_GetWndProcEntry16( (char *)class16->lpfnWndProc );
if (!RegisterClass16( class16 )) return FALSE;
class16.style = info16->style;
class16.lpfnWndProc = (WNDPROC16)MODULE_GetWndProcEntry16( info16->procName );
class16.cbWndExtra = info16->wndExtra;
class16.hbrBackground = info16->background;
strcpy( name, info16->className );
if (!RegisterClass16( &class16 )) return FALSE;
}
/* Create 32-bit classes */
@ -90,7 +101,7 @@ BOOL WIDGETS_Init(void)
/* Just to make sure the string is > 0x10000 */
strcpy( name, (char *)class32->lpszClassName );
class32->lpszClassName = name;
class32->hCursor = LoadCursor( 0, IDC_ARROW );
class32->hCursor = LoadCursor16( 0, IDC_ARROW );
if (!RegisterClass32A( class32 )) return FALSE;
}

View File

@ -1,11 +1,11 @@
TOPSRC = @top_srcdir@
EXTRA_DEFS = -DUSE_READLINE
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = debugger
C_SRCS = \
break.c \
db_disasm.c \
editline.c \
hash.c \
info.c \
memory.c \

View File

@ -205,7 +205,7 @@ expr:
void
issue_prompt(){
#ifndef USE_READLINE
#ifdef DONT_USE_READLINE
fprintf(stderr,"Wine-dbg>");
#endif
}

View File

@ -1,8 +1,7 @@
/* Lexical scanner for command line parsing in the Wine debugger
/*
* Lexical scanner for command line parsing
*
* Version 1.0
* Eric Youngdale
* 9/93
* Copyright 1993 Eric Youngdale
*/
%{
@ -13,18 +12,20 @@
#include "xmalloc.h"
#include "y.tab.h"
#ifdef USE_READLINE
#ifndef DONT_USE_READLINE
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( (result = dbg_read((char *) buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "read() in flex scanner failed" );
#endif
extern char * readline(char *);
extern void add_history(char *);
static int dbg_read(char * buf, int size);
static char * make_symbol(char *);
void flush_symbols();
#endif /* DONT_USE_READLINE */
static int syntax_error;
%}
@ -136,7 +137,8 @@ mode { return tMODE; }
int yywrap(void) { return 1; }
#endif
#ifdef USE_READLINE
#ifndef DONT_USE_READLINE
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
@ -216,10 +218,10 @@ char * make_symbol(char * symbol){
return local_symbols[next_symbol++] = xstrdup(symbol);
}
void
flush_symbols(){
void flush_symbols()
{
while(--next_symbol>= 0) free(local_symbols[next_symbol]);
next_symbol = 0;
}
#endif
#endif /* DONT_USE_READLINE */

View File

@ -1,10 +1,38 @@
/* $Revision: 1.4 $
**
** Main editing routines for editline library.
*/
#include "editline.h"
/*
* Line-editing routines
*
* Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
*
*
* This software is not subject to any license of the American Telephone
* and Telegraph Company or of the Regents of the University of California.
*
* Permission is granted to anyone to use this software for any purpose on
* any computer system, and to alter it and redistribute it freely, subject
* to the following restrictions:
* 1. The authors are not responsible for the consequences of use of this
* software, no matter how awful, even if they arise from flaws in it.
* 2. The origin of this software must not be misrepresented, either by
* explicit claim or by omission. Since few users ever read sources,
* credits must appear in the documentation.
* 3. Altered versions must be plainly marked as such, and must not be
* misrepresented as being the original software. Since few users
* ever read sources, credits must appear in the documentation.
* 4. This notice may not be removed or altered.
*
* The code was heavily simplified for inclusion in Wine. -- AJ
*/
#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
typedef unsigned char CHAR;
/*
** Manifest constants.
@ -22,6 +50,17 @@
#if !defined(HIST_SIZE)
#define HIST_SIZE 20
#endif /* !defined(HIST_SIZE) */
#define CRLF "\r\n"
#define MEM_INC 64
#define SCREEN_INC 256
#define DISPOSE(p) free((char *)(p))
#define NEW(T, c) \
((T *)malloc((unsigned int)(sizeof (T) * (c))))
#define RENEW(p, T, c) \
(p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
#define COPYFROMTO(new, p, len) \
(void)memcpy((char *)(new), (char *)(p), (int)(len))
/*
** Command status codes.
@ -57,35 +96,35 @@ typedef struct _HISTORY {
/*
** Globals.
*/
int rl_eof;
int rl_erase;
int rl_intr;
int rl_kill;
static int rl_eof;
static int rl_erase;
static int rl_intr;
static int rl_kill;
STATIC CHAR NIL[] = "";
STATIC CONST CHAR *Input = NIL;
STATIC CHAR *Line;
STATIC CONST char *Prompt;
STATIC CHAR *Yanked;
STATIC char *Screen;
STATIC char NEWLINE[]= CRLF;
STATIC HISTORY H;
int rl_quit;
STATIC int Repeat;
STATIC int End;
STATIC int Mark;
STATIC int OldPoint;
STATIC int Point;
STATIC int PushBack;
STATIC int Pushed;
STATIC KEYMAP Map[33];
STATIC KEYMAP MetaMap[16];
STATIC SIZE_T Length;
STATIC SIZE_T ScreenCount;
STATIC SIZE_T ScreenSize;
STATIC char *backspace;
STATIC int TTYwidth;
STATIC int TTYrows;
static CHAR NIL[] = "";
static const CHAR *Input = NIL;
static CHAR *Line;
static const char *Prompt;
static CHAR *Yanked;
static char *Screen;
static char NEWLINE[]= CRLF;
static HISTORY H;
static int rl_quit;
static int Repeat;
static int End;
static int Mark;
static int OldPoint;
static int Point;
static int PushBack;
static int Pushed;
static KEYMAP Map[33];
static KEYMAP MetaMap[16];
static size_t Length;
static size_t ScreenCount;
static size_t ScreenSize;
static char *backspace;
static int TTYwidth;
static int TTYrows;
/* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */
int rl_meta_chars = 1;
@ -93,7 +132,7 @@ int rl_meta_chars = 1;
/*
** Declarations.
*/
STATIC CHAR *editinput();
static CHAR *editinput();
extern int read();
extern int write();
#if defined(USE_TERMCAP)
@ -106,7 +145,80 @@ extern int tgetent();
** TTY input/output functions.
*/
STATIC void
#ifdef HAVE_TCGETATTR
#include <termios.h>
static void
rl_ttyset(Reset)
int Reset;
{
static struct termios old;
struct termios new;
if (Reset == 0) {
(void)tcgetattr(0, &old);
rl_erase = old.c_cc[VERASE];
rl_kill = old.c_cc[VKILL];
rl_eof = old.c_cc[VEOF];
rl_intr = old.c_cc[VINTR];
rl_quit = old.c_cc[VQUIT];
new = old;
new.c_cc[VINTR] = -1;
new.c_cc[VQUIT] = -1;
new.c_lflag &= ~(ECHO | ICANON);
new.c_iflag &= ~(ISTRIP | INPCK);
new.c_cc[VMIN] = 1;
new.c_cc[VTIME] = 0;
(void)tcsetattr(0, TCSANOW, &new);
}
else
(void)tcsetattr(0, TCSANOW, &old);
}
#else /* HAVE_TCGETATTR */
static void
rl_ttyset(Reset)
int Reset;
{
static struct sgttyb old_sgttyb;
static struct tchars old_tchars;
struct sgttyb new_sgttyb;
struct tchars new_tchars;
if (Reset == 0) {
(void)ioctl(0, TIOCGETP, &old_sgttyb);
rl_erase = old_sgttyb.sg_erase;
rl_kill = old_sgttyb.sg_kill;
(void)ioctl(0, TIOCGETC, &old_tchars);
rl_eof = old_tchars.t_eofc;
rl_intr = old_tchars.t_intrc;
rl_quit = old_tchars.t_quitc;
new_sgttyb = old_sgttyb;
new_sgttyb.sg_flags &= ~ECHO;
new_sgttyb.sg_flags |= RAW;
#if defined(PASS8)
new_sgttyb.sg_flags |= PASS8;
#endif /* defined(PASS8) */
(void)ioctl(0, TIOCSETP, &new_sgttyb);
new_tchars = old_tchars;
new_tchars.t_intrc = -1;
new_tchars.t_quitc = -1;
(void)ioctl(0, TIOCSETC, &new_tchars);
}
else {
(void)ioctl(0, TIOCSETP, &old_sgttyb);
(void)ioctl(0, TIOCSETC, &old_tchars);
}
}
#endif /* HAVE_TCGETATTR */
static void
TTYflush()
{
if (ScreenCount) {
@ -115,7 +227,7 @@ TTYflush()
}
}
STATIC void
static void
TTYput(c)
CHAR c;
{
@ -126,7 +238,7 @@ TTYput(c)
}
}
STATIC void
static void
TTYputs(p)
CHAR *p;
{
@ -134,7 +246,7 @@ TTYputs(p)
TTYput(*p++);
}
STATIC void
static void
TTYshow(c)
CHAR c;
{
@ -155,7 +267,7 @@ TTYshow(c)
TTYput(c);
}
STATIC void
static void
TTYstring(p)
CHAR *p;
{
@ -163,7 +275,7 @@ TTYstring(p)
TTYshow(*p++);
}
STATIC unsigned int
static unsigned int
TTYget()
{
CHAR c;
@ -175,12 +287,12 @@ TTYget()
}
if (*Input)
return *Input++;
return read(0, &c, (SIZE_T)1) == 1 ? c : EOF;
return read(0, &c, (size_t)1) == 1 ? c : EOF;
}
#define TTYback() (backspace ? TTYputs((CHAR *)backspace) : TTYput('\b'))
STATIC void
static void
TTYbackn(n)
int n;
{
@ -188,7 +300,7 @@ TTYbackn(n)
TTYback();
}
STATIC void
static void
TTYinfo()
{
static int init;
@ -244,7 +356,7 @@ TTYinfo()
STATIC void
static void
reposition()
{
int i;
@ -256,7 +368,7 @@ reposition()
TTYshow(*p);
}
STATIC void
static void
left(Change)
STATUS Change;
{
@ -273,7 +385,7 @@ left(Change)
Point--;
}
STATIC void
static void
right(Change)
STATUS Change;
{
@ -282,7 +394,7 @@ right(Change)
Point++;
}
STATIC STATUS
static STATUS
ring_bell()
{
TTYput('\07');
@ -290,7 +402,7 @@ ring_bell()
return CSstay;
}
STATIC STATUS
static STATUS
do_macro(c)
unsigned int c;
{
@ -308,7 +420,7 @@ do_macro(c)
return CSstay;
}
STATIC STATUS
static STATUS
do_forward(move)
STATUS move;
{
@ -333,7 +445,7 @@ do_forward(move)
return CSstay;
}
STATIC STATUS
static STATUS
do_case(type)
CASE type;
{
@ -362,19 +474,19 @@ do_case(type)
return CSstay;
}
STATIC STATUS
static STATUS
case_down_word()
{
return do_case(TOlower);
}
STATIC STATUS
static STATUS
case_up_word()
{
return do_case(TOupper);
}
STATIC void
static void
ceol()
{
int extras;
@ -398,7 +510,7 @@ ceol()
TTYback();
}
STATIC void
static void
clear_line()
{
Point = -strlen(Prompt);
@ -409,11 +521,11 @@ clear_line()
Line[0] = '\0';
}
STATIC STATUS
static STATUS
insert_string(p)
CHAR *p;
{
SIZE_T len;
size_t len;
int i;
CHAR *new;
CHAR *q;
@ -442,19 +554,19 @@ insert_string(p)
}
STATIC CHAR *
static CHAR *
next_hist()
{
return H.Pos >= H.Size - 1 ? NULL : H.Lines[++H.Pos];
}
STATIC CHAR *
static CHAR *
prev_hist()
{
return H.Pos == 0 ? NULL : H.Lines[--H.Pos];
}
STATIC STATUS
static STATUS
do_insert_hist(p)
CHAR *p;
{
@ -467,7 +579,7 @@ do_insert_hist(p)
return insert_string(p);
}
STATIC STATUS
static STATUS
do_hist(move)
CHAR *(*move)();
{
@ -482,25 +594,25 @@ do_hist(move)
return do_insert_hist(p);
}
STATIC STATUS
static STATUS
h_next()
{
return do_hist(next_hist);
}
STATIC STATUS
static STATUS
h_prev()
{
return do_hist(prev_hist);
}
STATIC STATUS
static STATUS
h_first()
{
return do_insert_hist(H.Lines[H.Pos = 0]);
}
STATIC STATUS
static STATUS
h_last()
{
return do_insert_hist(H.Lines[H.Pos = H.Size - 1]);
@ -509,7 +621,7 @@ h_last()
/*
** Return zero if pat appears as a substring in text.
*/
STATIC int
static int
substrcmp(text, pat, len)
char *text;
char *pat;
@ -525,7 +637,7 @@ substrcmp(text, pat, len)
return 1;
}
STATIC CHAR *
static CHAR *
search_hist(search, move)
CHAR *search;
CHAR *(*move)();
@ -566,11 +678,11 @@ search_hist(search, move)
return NULL;
}
STATIC STATUS
static STATUS
h_search()
{
static int Searching;
CONST char *old_prompt;
const char *old_prompt;
CHAR *(*move)();
CHAR *p;
@ -592,7 +704,7 @@ h_search()
return do_insert_hist(p);
}
STATIC STATUS
static STATUS
fd_char()
{
int i;
@ -606,7 +718,7 @@ fd_char()
return CSstay;
}
STATIC void
static void
save_yank(begin, i)
int begin;
int i;
@ -619,13 +731,13 @@ save_yank(begin, i)
if (i < 1)
return;
if ((Yanked = NEW(CHAR, (SIZE_T)i + 1)) != NULL) {
if ((Yanked = NEW(CHAR, (size_t)i + 1)) != NULL) {
COPYFROMTO(Yanked, &Line[begin], i);
Yanked[i] = '\0';
}
}
STATIC STATUS
static STATUS
delete_string(count)
int count;
{
@ -668,7 +780,7 @@ delete_string(count)
return CSmove;
}
STATIC STATUS
static STATUS
bk_char()
{
int i;
@ -683,7 +795,7 @@ bk_char()
return CSstay;
}
STATIC STATUS
static STATUS
bk_del_char()
{
int i;
@ -698,7 +810,7 @@ bk_del_char()
return delete_string(i);
}
STATIC STATUS
static STATUS
redisplay()
{
TTYputs((CHAR *)NEWLINE);
@ -707,7 +819,7 @@ redisplay()
return CSmove;
}
STATIC STATUS
static STATUS
kill_line()
{
int i;
@ -733,7 +845,7 @@ kill_line()
return CSstay;
}
STATIC STATUS
static STATUS
insert_char(c)
int c;
{
@ -760,7 +872,7 @@ insert_char(c)
return s;
}
STATIC STATUS
static STATUS
meta()
{
unsigned int c;
@ -768,7 +880,6 @@ meta()
if ((c = TTYget()) == EOF)
return CSeof;
#if defined(ANSI_ARROWS)
/* Also include VT-100 arrows. */
if (c == '[' || c == 'O')
switch (c = TTYget()) {
@ -779,7 +890,6 @@ meta()
case 'C': return fd_char();
case 'D': return bk_char();
}
#endif /* defined(ANSI_ARROWS) */
if (isdigit(c)) {
for (Repeat = c - '0'; (c = TTYget()) != EOF && isdigit(c); )
@ -798,7 +908,7 @@ meta()
return ring_bell();
}
STATIC STATUS
static STATUS
emacs(c)
unsigned int c;
{
@ -820,7 +930,7 @@ emacs(c)
return s;
}
STATIC STATUS
static STATUS
TTYspecial(c)
unsigned int c;
{
@ -848,7 +958,7 @@ TTYspecial(c)
return CSdispatch;
}
STATIC CHAR *
static CHAR *
editinput()
{
unsigned int c;
@ -886,7 +996,7 @@ editinput()
return NULL;
}
STATIC void
static void
hist_add(p)
CHAR *p;
{
@ -905,24 +1015,9 @@ hist_add(p)
H.Pos = H.Size - 1;
}
/*
** For compatibility with FSF readline.
*/
/* ARGSUSED0 */
void
rl_reset_terminal(p)
char *p;
{
}
void
rl_initialize()
{
}
char *
readline(prompt)
CONST char *prompt;
const char *prompt;
{
CHAR *line;
@ -965,7 +1060,7 @@ add_history(p)
}
STATIC STATUS
static STATUS
beg_line()
{
if (Point) {
@ -975,13 +1070,13 @@ beg_line()
return CSstay;
}
STATIC STATUS
static STATUS
del_char()
{
return delete_string(Repeat == NO_ARG ? 1 : Repeat);
}
STATIC STATUS
static STATUS
end_line()
{
if (Point != End) {
@ -991,14 +1086,14 @@ end_line()
return CSstay;
}
STATIC STATUS
static STATUS
accept_line()
{
Line[End] = '\0';
return CSdone;
}
STATIC STATUS
static STATUS
transpose()
{
CHAR c;
@ -1016,7 +1111,7 @@ transpose()
return CSstay;
}
STATIC STATUS
static STATUS
quote()
{
unsigned int c;
@ -1024,7 +1119,7 @@ quote()
return (c = TTYget()) == EOF ? CSeof : insert_char((int)c);
}
STATIC STATUS
static STATUS
wipe()
{
int i;
@ -1042,14 +1137,14 @@ wipe()
return delete_string(Mark - Point);
}
STATIC STATUS
static STATUS
mk_set()
{
Mark = Point;
return CSstay;
}
STATIC STATUS
static STATUS
exchange()
{
unsigned int c;
@ -1065,7 +1160,7 @@ exchange()
return CSstay;
}
STATIC STATUS
static STATUS
yank()
{
if (Yanked && *Yanked)
@ -1073,7 +1168,7 @@ yank()
return CSstay;
}
STATIC STATUS
static STATUS
copy_region()
{
if (Mark > End)
@ -1087,7 +1182,7 @@ copy_region()
return CSstay;
}
STATIC STATUS
static STATUS
move_to_char()
{
unsigned int c;
@ -1104,13 +1199,13 @@ move_to_char()
return CSstay;
}
STATIC STATUS
static STATUS
fd_word()
{
return do_forward(CSmove);
}
STATIC STATUS
static STATUS
fd_kill_word()
{
int i;
@ -1124,7 +1219,7 @@ fd_kill_word()
return CSstay;
}
STATIC STATUS
static STATUS
bk_word()
{
int i;
@ -1145,7 +1240,7 @@ bk_word()
return CSstay;
}
STATIC STATUS
static STATUS
bk_kill_word()
{
(void)bk_word();
@ -1154,7 +1249,7 @@ bk_kill_word()
return CSstay;
}
STATIC int
static int
argify(line, avp)
CHAR *line;
CHAR ***avp;
@ -1200,7 +1295,7 @@ argify(line, avp)
return ac;
}
STATIC STATUS
static STATUS
last_argument()
{
CHAR **av;
@ -1226,7 +1321,7 @@ last_argument()
return s;
}
STATIC KEYMAP Map[33] = {
static KEYMAP Map[33] = {
{ CTL('@'), ring_bell },
{ CTL('A'), beg_line },
{ CTL('B'), bk_char },
@ -1260,7 +1355,7 @@ STATIC KEYMAP Map[33] = {
{ 0, NULL }
};
STATIC KEYMAP MetaMap[16]= {
static KEYMAP MetaMap[16]= {
{ CTL('H'), bk_kill_word },
{ DEL, bk_kill_word },
{ ' ', mk_set },

View File

@ -1,12 +0,0 @@
TOPSRC = @top_srcdir@
EXTRA_DEFS = -DHIDE -DANSI_ARROWS
MODULE = readline
C_SRCS = editline.c sysunix.c
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:

View File

@ -1,45 +0,0 @@
$Revision: 1.5 $
This is a line-editing library. It can be linked into almost any
program to provide command-line editing and recall.
It is call-compatible with the FSF readline library, but it is a
fraction of the size (and offers fewer features). It does not use
standard I/O. It is distributed under a "C News-like" copyright.
Configuration is done in the Makefile. Type "make testit" to get
a small slow shell for testing.
An earlier version was distributed with Byron's rc. Principal
changes over that version include:
Faster.
Is eight-bit clean (thanks to brendan@cs.widener.edu)
Written in K&R C, but ANSI compliant (gcc all warnings)
Propagates EOF properly; rc trip test now passes
Doesn't need or use or provide memmove.
More robust
Calling sequence changed to be compatible with readline.
Test program, new manpage, better configuration
More system-independant; includes Unix and OS-9 support.
Enjoy,
Rich $alz
<rsalz@osf.org>
Copyright 1992 Simmule Turner and Rich Salz. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it freely, subject
to the following restrictions:
1. The authors are not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.

View File

@ -1,175 +0,0 @@
.\" $Revision: 1.1 $
.TH EDITLINE 3
.SH NAME
editline \- command-line editing library with history
.SH SYNOPSIS
.nf
.B "char *"
.B "readline(prompt)"
.B " char *prompt;"
.B "void"
.B "add_history(line)"
.B " char *line;"
.fi
.SH DESCRIPTION
.I Editline
is a library that provides an line-editing interface with text recall.
It is intended to be compatible with the
.I readline
library provided by the Free Software Foundation, but much smaller.
The bulk of this manual page describes the user interface.
.PP
The
.I readline
routine returns a line of text with the trailing newline removed.
The data is returned in a buffer allocated with
.IR malloc (3),
so the space should be released with
.IR free (3)
when the calling program is done with it.
Before accepting input from the user, the specified
.I prompt
is displayed on the terminal.
.PP
The
.I add_history
routine makes a copy of the specified
.I line
and adds it to the internal history list.
.SS "User Interface"
A program that uses this library provides a simple emacs-like editing
interface to its users.
A line may be edited before it is sent to the calling program by typing either
control characters or escape sequences.
A control character, shown as a caret followed by a letter, is typed by
holding down the ``control'' key while the letter is typed.
For example, ``^A'' is a control-A.
An escape sequence is entered by typing the ``escape'' key followed by one or
more characters.
The escape key is abbreviated as ``ESC.''
Note that unlike control keys, case matters in escape sequences; ``ESC\ F''
is not the same as ``ESC\ f''.
.PP
An editing command may be typed anywhere on the line, not just at the
beginning.
In addition, a return may also be typed anywhere on the line, not just at
the end.
.PP
Most editing commands may be given a repeat count,
.IR n ,
where
.I n
is a number.
To enter a repeat count, type the escape key, the number, and then
the command to execute.
For example, ``ESC\ 4\ ^f'' moves forward four characters.
If a command may be given a repeat count then the text ``[n]'' is given at the
end of its description.
.PP
The following control characters are accepted:
.RS
.nf
.ta \w'ESC DEL 'u
^A Move to the beginning of the line
^B Move left (backwards) [n]
^D Delete character [n]
^E Move to end of line
^F Move right (forwards) [n]
^G Ring the bell
^H Delete character before cursor (backspace key) [n]
^I Complete filename (tab key); see below
^J Done with line (return key)
^K Kill to end of line (or column [n])
^L Redisplay line
^M Done with line (alternate return key)
^N Get next line from history [n]
^P Get previous line from history [n]
^R Search backward (forward if [n]) through history for text;
\& must start line if text begins with an uparrow
^T Transpose characters
^V Insert next character, even if it is an edit command
^W Wipe to the mark
^X^X Exchange current location and mark
^Y Yank back last killed text
^[ Start an escape sequence (escape key)
^]c Move forward to next character ``c''
^? Delete character before cursor (delete key) [n]
.fi
.RE
.PP
The following escape sequences are provided.
.RS
.nf
.ta \w'ESC DEL 'u
ESC\ ^H Delete previous word (backspace key) [n]
ESC\ DEL Delete previous word (delete key) [n]
ESC\ SP Set the mark (space key); see ^X^X and ^Y above
ESC\ \. Get the last (or [n]'th) word from previous line
ESC\ \? Show possible completions; see below
ESC\ < Move to start of history
ESC\ > Move to end of history
ESC\ b Move backward a word [n]
ESC\ d Delete word under cursor [n]
ESC\ f Move forward a word [n]
ESC\ l Make word lowercase [n]
ESC\ u Make word uppercase [n]
ESC\ y Yank back last killed text
ESC\ v Show library version
ESC\ w Make area up to mark yankable
ESC\ nn Set repeat count to the number nn
ESC\ C Read from environment variable ``_C_'', where C is
\& an uppercase letter
.fi
.RE
.PP
The
.I editline
library has a small macro facility.
If you type the escape key followed by an uppercase letter,
.IR C ,
then the contents of the environment variable
.I _C_
are read in as if you had typed them at the keyboard.
For example, if the variable
.I _L_
contains the following:
.RS
^A^Kecho '^V^[[H^V^[[2J'^M
.RE
Then typing ``ESC L'' will move to the beginning of the line, kill the
entire line, enter the echo command needed to clear the terminal (if your
terminal is like a VT-100), and send the line back to the shell.
.PP
The
.I editline
library also does filename completion.
Suppose the root directory has the following files in it:
.RS
.nf
.ta \w'core 'u
bin vmunix
core vmunix.old
.fi
.RE
If you type ``rm\ /v'' and then the tab key.
.I Editline
will then finish off as much of the name as possible by adding ``munix''.
Because the name is not unique, it will then beep.
If you type the escape key and a question mark, it will display the
two choices.
If you then type a period and a tab, the library will finish off the filename
for you:
.RS
.nf
.RI "rm /v[TAB]" munix .TAB old
.fi
.RE
The tab key is shown by ``[TAB]'' and the automatically-entered text
is shown in italics.
.SH "BUGS AND LIMITATIONS"
Cannot handle lines more than 80 columns.
.SH AUTHORS
Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy>
and Rich $alz <rsalz@osf.org>.
Original manual page by DaviD W. Sanderson <dws@ssec.wisc.edu>.

View File

@ -1,49 +0,0 @@
/* $Revision: 1.3 $
**
** Internal header file for editline library.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#define CRLF "\r\n"
#define SIZE_T size_t
#define CONST const
typedef unsigned char CHAR;
#if defined(HIDE)
#define STATIC static
#else
#define STATIC /* NULL */
#endif /* !defined(HIDE) */
#define MEM_INC 64
#define SCREEN_INC 256
#define DISPOSE(p) free((char *)(p))
#define NEW(T, c) \
((T *)malloc((unsigned int)(sizeof (T) * (c))))
#define RENEW(p, T, c) \
(p = (T *)realloc((char *)(p), (unsigned int)(sizeof (T) * (c))))
#define COPYFROMTO(new, p, len) \
(void)memcpy((char *)(new), (char *)(p), (int)(len))
/*
** Variables and routines internal to this package.
*/
extern int rl_eof;
extern int rl_erase;
extern int rl_intr;
extern int rl_kill;
extern int rl_quit;
extern char *rl_complete();
extern int rl_list_possib();
extern void rl_ttyset();
extern void rl_add_slash();

View File

@ -1,89 +0,0 @@
/* $Revision: 1.1 $
**
** Unix system-dependant routines for editline library.
*/
#include "editline.h"
#if defined(HAVE_TCGETATTR)
#include <termios.h>
void
rl_ttyset(Reset)
int Reset;
{
static struct termios old;
struct termios new;
if (Reset == 0) {
(void)tcgetattr(0, &old);
rl_erase = old.c_cc[VERASE];
rl_kill = old.c_cc[VKILL];
rl_eof = old.c_cc[VEOF];
rl_intr = old.c_cc[VINTR];
rl_quit = old.c_cc[VQUIT];
new = old;
new.c_cc[VINTR] = -1;
new.c_cc[VQUIT] = -1;
new.c_lflag &= ~(ECHO | ICANON);
new.c_iflag &= ~(ISTRIP | INPCK);
new.c_cc[VMIN] = 1;
new.c_cc[VTIME] = 0;
(void)tcsetattr(0, TCSANOW, &new);
}
else
(void)tcsetattr(0, TCSANOW, &old);
}
#else
#include <sgtty.h>
void
rl_ttyset(Reset)
int Reset;
{
static struct sgttyb old_sgttyb;
static struct tchars old_tchars;
struct sgttyb new_sgttyb;
struct tchars new_tchars;
if (Reset == 0) {
(void)ioctl(0, TIOCGETP, &old_sgttyb);
rl_erase = old_sgttyb.sg_erase;
rl_kill = old_sgttyb.sg_kill;
(void)ioctl(0, TIOCGETC, &old_tchars);
rl_eof = old_tchars.t_eofc;
rl_intr = old_tchars.t_intrc;
rl_quit = old_tchars.t_quitc;
new_sgttyb = old_sgttyb;
new_sgttyb.sg_flags &= ~ECHO;
new_sgttyb.sg_flags |= RAW;
#if defined(PASS8)
new_sgttyb.sg_flags |= PASS8;
#endif /* defined(PASS8) */
(void)ioctl(0, TIOCSETP, &new_sgttyb);
new_tchars = old_tchars;
new_tchars.t_intrc = -1;
new_tchars.t_quitc = -1;
(void)ioctl(0, TIOCSETC, &new_tchars);
}
else {
(void)ioctl(0, TIOCSETP, &old_sgttyb);
(void)ioctl(0, TIOCSETC, &old_tchars);
}
}
#endif /* defined(HAVE_TCGETATTR) */
void
rl_add_slash(path, p)
char *path;
char *p;
{
struct stat Sb;
if (stat(path, &Sb) >= 0)
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
}

View File

@ -1,5 +1,8 @@
TOPSRC = @top_srcdir@
MODULE = files
prefix = @prefix@
sysconfdir = @sysconfdir@
DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\"
TOPSRC = @top_srcdir@
MODULE = files
C_SRCS = \
directory.c \

View File

@ -848,7 +848,7 @@ HFILE _lcreat( LPCSTR path, INT32 attr )
/***********************************************************************
* _lcreat_uniq (Not a Windows API)
*/
HFILE _lcreat_uniq( LPCSTR path, INT attr )
HFILE _lcreat_uniq( LPCSTR path, INT32 attr )
{
DOS_FILE *file;
HFILE handle;

View File

@ -53,6 +53,7 @@ static const char PROFILE_WineIniName[] = "/.winerc";
/* Check for comments in profile */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
#define WINE_INI_GLOBAL ETCDIR "/wine.conf"
/***********************************************************************
* PROFILE_CopyEntry
@ -561,6 +562,26 @@ int PROFILE_GetWineIniString( const char *section, const char *key_name,
}
/***********************************************************************
* PROFILE_GetWineIniInt
*
* Get a config integer from the wine.ini file.
*/
int PROFILE_GetWineIniInt( const char *section, const char *key_name, int def )
{
char buffer[20];
char *p;
long result;
PROFILEKEY *key = PROFILE_Find( &WineProfile, section, key_name, FALSE );
if (!key || !key->value) return def;
PROFILE_CopyEntry( buffer, key->value, sizeof(buffer), TRUE );
result = strtol( buffer, &p, 0 );
if (p == buffer) return 0; /* No digits at all */
return (int)result;
}
/***********************************************************************
* PROFILE_LoadWineIni
*

View File

@ -1,5 +1,5 @@
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = if1632
DLLS = \

View File

@ -17,7 +17,7 @@ base 2
12 stub LBItemFromPt
13 stub DrawInsert
14 stub CreateUpDownControl
15 stub InitCommonControls
15 return InitCommonControls 4 0
16 stub CreateStatusWindowW
17 stub CreateToolbarEx
18 stub DestroyPropertySheetPage

View File

@ -64,7 +64,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
54 pascal16 CreateEllipticRgn(s_word s_word s_word s_word) CreateEllipticRgn
55 pascal16 CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect16
56 pascal16 CreateFont(s_word s_word s_word s_word s_word word word word
word word word word word ptr) CreateFont
word word word word word ptr) CreateFont16
57 pascal16 CreateFontIndirect(ptr) CreateFontIndirect16
58 pascal16 CreateHatchBrush(word long) CreateHatchBrush
60 pascal16 CreatePatternBrush(word) CreatePatternBrush
@ -241,12 +241,12 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
354 stub ShrinkGDIHeap
355 stub FTrapping0
360 pascal16 CreatePalette(ptr) CreatePalette
361 pascal16 GDISelectPalette(word word) GDISelectPalette
361 pascal16 GDISelectPalette(word word word) GDISelectPalette
362 pascal16 GDIRealizePalette(word) GDIRealizePalette
363 pascal16 GetPaletteEntries(word word word ptr) GetPaletteEntries
364 pascal16 SetPaletteEntries(word word word ptr) SetPaletteEntries
365 pascal16 RealizeDefaultPalette(word) RealizeDefaultPalette
366 stub UpdateColors
366 pascal16 UpdateColors(word) UpdateColors
367 pascal16 AnimatePalette(word word word ptr) AnimatePalette
368 pascal16 ResizePalette(word word) ResizePalette
370 pascal16 GetNearestPaletteIndex(word long) GetNearestPaletteIndex
@ -271,7 +271,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
409 stub CREATEUSERDISCARDABLEBITMAP
410 stub ISVALIDMETAFILE
411 pascal16 GetCurLogFont(word) GetCurLogFont
412 stub IsDCCurrentPalette
412 pascal16 IsDCCurrentPalette(word) IsDCCurrentPalette
439 pascal16 StretchDIBits (word s_word s_word word word word word
word word ptr ptr word long) StretchDIBits
440 pascal16 SetDIBits(word word word word ptr ptr word) SetDIBits

View File

@ -45,17 +45,19 @@ base 1
0040 stdcall CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect32
0041 stub CreateEnhMetaFileA
0042 stub CreateEnhMetaFileW
0043 stub CreateFontA
0043 stdcall CreateFontA(long long long long long long long long
long long long long long ptr) CreateFont32A
0044 stdcall CreateFontIndirectA(ptr) CreateFontIndirect32A
0045 stdcall CreateFontIndirectW(ptr) CreateFontIndirect32W
0046 stub CreateFontW
0046 stdcall CreateFontW(long long long long long long long long
long long long long long ptr) CreateFont32W
0047 stub CreateHalftonePalette
0048 stub CreateHatchBrush
0049 stdcall CreateICA(ptr ptr ptr ptr) CreateIC
0050 stub CreateICW
0051 stub CreateMetaFileA
0052 stub CreateMetaFileW
0053 stub CreatePalette
0053 stdcall CreatePalette(ptr) CreatePalette
0054 stub CreatePatternBrush
0055 stdcall CreatePen(long long long) CreatePen
0056 stub CreatePenIndirect
@ -282,7 +284,7 @@ base 1
0277 stub PolylineTo
0278 stdcall PtInRegion(long long long) PtInRegion
0279 stub PtVisible
0280 stdcall RealizePalette(long) RealizePalette32
0280 stdcall RealizePalette(long) RealizePalette
0281 stdcall RectInRegion(long ptr) RectInRegion32
0282 stdcall RectVisible(long ptr) RectVisible32
0283 stdcall Rectangle(long long long long long) Rectangle
@ -302,7 +304,7 @@ base 1
0297 stub SelectClipRgn
0298 stub SelectFontLocal
0299 stdcall SelectObject(long long) SelectObject
0300 stdcall SelectPalette(long long long) SelectPalette32
0300 stdcall SelectPalette(long long long) SelectPalette
0301 stub SetAbortProc
0302 stub SetArcDirection
0303 stdcall SetBitmapBits(long long ptr) SetBitmapBits
@ -334,7 +336,7 @@ base 1
0328 stub SetPixelFormat
0329 stub SetPixelV
0330 stub SetPolyFillMode
0331 stub SetROP2
0331 stdcall SetROP2(long long) SetROP2
0332 stdcall SetRectRgn(long long long long long) SetRectRgn
0333 stub SetRelAbs
0334 stub SetStretchBltMode

View File

@ -56,13 +56,13 @@ type win16
57 pascal16 GetProfileInt(ptr ptr s_word) GetProfileInt
58 pascal16 GetProfileString(ptr ptr ptr ptr word) GetProfileString
59 pascal16 WriteProfileString(ptr ptr ptr) WriteProfileString
60 pascal16 FindResource(word segptr segptr) FindResource
61 pascal16 LoadResource(word word) LoadResource
62 pascal LockResource(word) WIN16_LockResource
63 pascal16 FreeResource(word) FreeResource
64 pascal16 AccessResource(word word) AccessResource
65 pascal SizeofResource(word word) SizeofResource
66 pascal16 AllocResource(word word long) AllocResource
60 pascal16 FindResource(word segptr segptr) FindResource16
61 pascal16 LoadResource(word word) LoadResource16
62 pascal LockResource(word) WIN16_LockResource16
63 pascal16 FreeResource(word) FreeResource16
64 pascal16 AccessResource(word word) AccessResource16
65 pascal SizeofResource(word word) SizeofResource16
66 pascal16 AllocResource(word word long) AllocResource16
67 stub SetResourceHandler
68 pascal16 InitAtomTable(word) InitAtomTable
69 pascal16 FindAtom(segptr) FindAtom

View File

@ -524,7 +524,7 @@ base 1
0519 stub SetVolumeLabelW
0520 stub SetupComm
0521 stub ShowConsoleCursor
0522 stdcall SizeofResource(long long) SizeofResource
0522 stdcall SizeofResource(long long) SizeofResource32
0523 stdcall Sleep(long) Sleep
0524 stub SleepEx
0525 stub SuspendThread

View File

@ -19,22 +19,11 @@
dprintf_relay
#endif
/* Saved 16-bit stack for current process (Win16 only) */
WORD IF1632_Saved16_ss = 0;
WORD IF1632_Saved16_sp = 0;
/* Saved 32-bit stack for current process (Win16 only) */
DWORD IF1632_Saved32_esp = 0;
SEGPTR IF1632_Stack32_base = 0;
/* Original Unix stack */
DWORD IF1632_Original32_esp;
/***********************************************************************
* RELAY_Init
*/
BOOL RELAY_Init(void)
BOOL32 RELAY_Init(void)
{
WORD codesel;
@ -127,7 +116,7 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
/***********************************************************************
* RELAY_DebugCallFrom16Ret
*/
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, int args32 )
void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, SIGCONTEXT *context)
{
STACK16FRAME *frame;
WORD ordinal;
@ -156,13 +145,10 @@ void RELAY_DebugCallFrom16Ret( int func_type, int ret_val, int args32 )
case 2: /* regs */
printf( "retval=none ret=%04x:%04x ds=%04x\n",
frame->cs, frame->ip, frame->ds );
{
SIGCONTEXT *context = (SIGCONTEXT *)&args32;
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
ES_reg(context), EFL_reg(context) );
}
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
ES_reg(context), EFL_reg(context) );
break;
}
}
@ -274,7 +260,7 @@ void RELAY_DebugCallTo32( unsigned int func, int nbargs, unsigned int arg1 )
/**********************************************************************
* Catch (KERNEL.55)
*/
INT Catch( LPCATCHBUF lpbuf )
INT16 Catch( LPCATCHBUF lpbuf )
{
STACK16FRAME *pFrame = CURRENT_STACK16;
@ -298,7 +284,7 @@ INT Catch( LPCATCHBUF lpbuf )
/**********************************************************************
* Throw (KERNEL.56)
*/
int Throw( LPCATCHBUF lpbuf, int retval )
INT16 Throw( LPCATCHBUF lpbuf, INT16 retval )
{
STACK16FRAME *pFrame;

View File

@ -10,7 +10,7 @@ base 1
0005 stub DllGetClassObject
0006 stub DoEnvironmentSubstA
0007 stub DoEnvironmentSubstW
0008 stub DragAcceptFiles
0008 stdcall DragAcceptFiles(long long) DragAcceptFiles
0009 stub DragFinish
0010 stub DragQueryFile
0011 stub DragQueryFileA

View File

@ -149,7 +149,7 @@ heap 65520
147 pascal16 SetClipboardViewer(word) SetClipboardViewer
148 pascal16 GetClipboardViewer() GetClipboardViewer
149 pascal16 ChangeClipboardChain(word ptr) ChangeClipboardChain
150 pascal16 LoadMenu(word segptr) LoadMenu
150 pascal16 LoadMenu(word segptr) LoadMenu16
151 pascal16 CreateMenu() CreateMenu
152 pascal16 DestroyMenu(word) DestroyMenu
153 pascal16 ChangeMenu(word word segptr word word) ChangeMenu16
@ -172,11 +172,11 @@ heap 65520
170 pascal16 ArrangeIconicWindows(word) ArrangeIconicWindows
171 pascal16 WinHelp(word ptr word long) WinHelp
172 stub SwitchToThisWindow
173 pascal16 LoadCursor(word segptr) LoadCursor
174 pascal16 LoadIcon(word segptr) LoadIcon
175 pascal16 LoadBitmap(word segptr) LoadBitmap
176 pascal16 LoadString(word word ptr s_word) LoadString
177 pascal16 LoadAccelerators(word segptr) LoadAccelerators
173 pascal16 LoadCursor(word segptr) LoadCursor16
174 pascal16 LoadIcon(word segptr) LoadIcon16
175 pascal16 LoadBitmap(word segptr) LoadBitmap16
176 pascal16 LoadString(word word ptr s_word) LoadString16
177 pascal16 LoadAccelerators(word segptr) LoadAccelerators16
178 pascal16 TranslateAccelerator(word word ptr) TranslateAccelerator
179 pascal16 GetSystemMetrics(word) GetSystemMetrics
180 pascal GetSysColor(word) GetSysColor
@ -187,8 +187,8 @@ heap 65520
185 pascal16 GrayString(word word segptr segptr s_word s_word s_word s_word s_word) GrayString
186 pascal16 SwapMouseButton(word) SwapMouseButton
187 pascal16 EndMenu() EndMenu
188 pascal16 SetSysModalWindow(word) SetSysModalWindow
189 pascal16 GetSysModalWindow() GetSysModalWindow
188 pascal16 SetSysModalWindow(word) SetSysModalWindow16
189 pascal16 GetSysModalWindow() GetSysModalWindow16
190 pascal16 GetUpdateRect(word ptr word) GetUpdateRect16
191 pascal16 ChildWindowFromPoint(word long) ChildWindowFromPoint16
192 pascal16 InSendMessage() InSendMessage

View File

@ -137,7 +137,7 @@ base 1
0130 stdcall DestroyCaret() DestroyCaret
0131 stub DestroyCursor
0132 stub DestroyIcon
0133 stub DestroyMenu
0133 stdcall DestroyMenu(long) DestroyMenu
0134 stdcall DestroyWindow(long) DestroyWindow
0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) DialogBoxIndirectParam32A
0136 stub DialogBoxIndirectParamAorW
@ -358,28 +358,28 @@ base 1
0351 stub IsZoomed
0352 stdcall KillSystemTimer(long long) KillSystemTimer32
0353 stdcall KillTimer(long long) KillTimer32
0354 stdcall LoadAcceleratorsA(long ptr) WIN32_LoadAcceleratorsA
0355 stdcall LoadAcceleratorsW(long ptr) WIN32_LoadAcceleratorsW
0356 stdcall LoadBitmapA(long ptr) WIN32_LoadBitmapA
0357 stdcall LoadBitmapW(long ptr) WIN32_LoadBitmapW
0358 stdcall LoadCursorA(long ptr) WIN32_LoadCursorA
0354 stdcall LoadAcceleratorsA(long ptr) LoadAccelerators32A
0355 stdcall LoadAcceleratorsW(long ptr) LoadAccelerators32W
0356 stdcall LoadBitmapA(long ptr) LoadBitmap32A
0357 stdcall LoadBitmapW(long ptr) LoadBitmap32W
0358 stdcall LoadCursorA(long ptr) LoadCursor32A
0359 stub LoadCursorFromFileA
0360 stub LoadCursorFromFileW
0361 stdcall LoadCursorW(long ptr) WIN32_LoadCursorW
0362 stdcall LoadIconA(long ptr) WIN32_LoadIconA
0363 stdcall LoadIconW(long ptr) WIN32_LoadIconW
0361 stdcall LoadCursorW(long ptr) LoadCursor32W
0362 stdcall LoadIconA(long ptr) LoadIcon32A
0363 stdcall LoadIconW(long ptr) LoadIcon32W
0364 stub LoadImageA
0365 stub LoadImageW
0366 stub LoadKeyboardLayoutA
0367 stub LoadKeyboardLayoutW
0368 stub LoadLocalFonts
0369 stdcall LoadMenuA(long ptr) WIN32_LoadMenuA
0369 stdcall LoadMenuA(long ptr) LoadMenu32A
0370 stdcall LoadMenuIndirectA(ptr) LoadMenuIndirect32A
0371 stdcall LoadMenuIndirectW(ptr) LoadMenuIndirect32W
0372 stdcall LoadMenuW(long ptr) WIN32_LoadMenuW
0372 stdcall LoadMenuW(long ptr) LoadMenu32W
0373 stub LoadRemoteFonts
0374 stdcall LoadStringA(long long ptr long) WIN32_LoadStringA
0375 stdcall LoadStringW(long long ptr long) WIN32_LoadStringW
0374 stdcall LoadStringA(long long ptr long) LoadString32A
0375 stdcall LoadStringW(long long ptr long) LoadString32W
0376 stub LockWindowStation
0377 stub LockWindowUpdate
0378 stub LookupIconIdFromDirectory
@ -434,7 +434,7 @@ base 1
0427 stdcall RegisterClassExA(ptr) RegisterClassEx32A
0428 stdcall RegisterClassExW(ptr) RegisterClassEx32W
0429 stdcall RegisterClassW(ptr) RegisterClass32W
0430 stub RegisterClipboardFormatA
0430 stdcall RegisterClipboardFormatA(ptr) RegisterClipboardFormat
0431 stub RegisterClipboardFormatW
0432 stub RegisterHotKey
0433 stub RegisterLogonProcess

View File

@ -49,7 +49,7 @@ type win32
0048 stub mciLoadCommandResource
0049 stub mciSendCommandA
0050 stub mciSendCommandW
0051 stub mciSendStringA
0051 stdcall mciSendStringA(ptr ptr long long) mciSendString
0052 stub mciSendStringW
0053 stub mciSetDriverData
0054 stub mciSetYieldProc

View File

@ -123,7 +123,7 @@ extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD );
#define CallEnumObjectsProc( func, lpobj, lParam ) \
(*func)( lpobj, lParam )
#define CallEnumPropProc( func, hwnd, lpstr, data ) \
(*func)( hwnd, (LPCTSTR)(lpstr), data )
(*func)( hwnd, lpstr, data )
#define CallEnumTaskWndProc( func, hwnd, lParam ) \
(*func)( hwnd, lParam )
#define CallEnumWindowsProc16( func, hwnd, lParam ) \

View File

@ -1,17 +1,29 @@
#ifndef __WINE_COLOR_H
#define __WINE_COLOR_H
#include "palette.h"
#include "gdi.h"
extern HPALETTE16 COLOR_Init(void);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
extern void COLOR_SetMapping( DC *dc, HANDLE map, HANDLE revMap, WORD size );
extern BOOL COLOR_IsSolid( COLORREF color );
#define COLOR_FIXED 0x0001 /* read-only colormap - have to use XAllocColor (if not virtual)*/
#define COLOR_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
extern Colormap COLOR_WinColormap;
extern int COLOR_mapEGAPixel[16];
extern int* COLOR_PaletteToPixel;
extern int* COLOR_PixelToPalette;
extern int COLOR_ColormapSize;
#define COLOR_PRIVATE 0x1000 /* private colormap, identity mapping */
#define PC_SYS_USED 0x80 /* system peFlags */
#define PC_SYS_RESERVED 0x40
extern HPALETTE16 COLOR_Init(void);
extern COLORREF COLOR_ToLogical(int pixel);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
extern int COLOR_SetMapping( PALETTEOBJ* pal, BOOL mapOnly );
extern BOOL COLOR_IsSolid( COLORREF color );
extern Colormap COLOR_GetColormap();
extern UINT16 COLOR_GetSystemPaletteSize();
extern UINT16 COLOR_GetSystemPaletteFlags();
extern int COLOR_mapEGAPixel[16];
extern int* COLOR_PaletteToPixel;
extern int* COLOR_PixelToPalette;
extern int COLOR_ColormapSize;
#endif /* __WINE_COLOR_H */

View File

@ -0,0 +1,25 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the usleep function. */
#undef HAVE_USLEEP

View File

@ -21,6 +21,6 @@ extern int FILE_Fstat( HFILE hFile, BYTE *pattr, DWORD *psize,
extern HFILE FILE_Dup( HFILE hFile );
extern HFILE FILE_Dup2( HFILE hFile1, HFILE hFile2 );
extern INT32 FILE_Read( HFILE hFile, LPVOID buffer, UINT32 count );
extern INT _lcreat_uniq( LPCSTR path, INT attr );
extern HFILE _lcreat_uniq( LPCSTR path, INT32 attr );
#endif /* __WINE_FILE_H */

View File

@ -152,14 +152,6 @@ typedef struct
TEXTMETRIC16 metrics;
} X_PHYSFONT;
/* X physical palette information */
typedef struct
{
HANDLE16 hMapping; /* Color mapping table (or 0 for identity) */
HANDLE16 hRevMapping; /* Reverse color mapping table */
WORD mappingSize;
} X_PHYSPALETTE;
/* X-specific DC information */
typedef struct
{
@ -168,7 +160,6 @@ typedef struct
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
X_PHYSPALETTE pal;
} X_DC_INFO;

View File

@ -17,8 +17,8 @@
typedef struct
{
HANDLE16 next; /* 00 Next hook in chain */
HOOKPROC proc WINE_PACKED; /* 02 Hook procedure */
short id; /* 06 Hook id (WH_xxx) */
HOOKPROC16 proc WINE_PACKED; /* 02 Hook procedure */
INT16 id; /* 06 Hook id (WH_xxx) */
HQUEUE16 ownerQueue; /* 08 Owner queue (0 for system hook) */
HMODULE16 ownerModule; /* 0a Owner module */
WORD inHookProc; /* 0c TRUE if in this->proc */
@ -28,9 +28,9 @@ typedef struct
#define HOOK_MAGIC ((int)'H' | (int)'K' << 8) /* 'HK' */
extern HANDLE HOOK_GetHook( short id , HQUEUE hQueue );
extern DWORD HOOK_CallHooks( short id, short code,
WPARAM wParam, LPARAM lParam );
extern HANDLE16 HOOK_GetHook( INT16 id , HQUEUE16 hQueue );
extern LRESULT HOOK_CallHooks( INT16 id, INT16 code,
WPARAM16 wParam, LPARAM lParam );
extern void HOOK_FreeModuleHooks( HMODULE16 hModule );
extern void HOOK_FreeQueueHooks( HQUEUE16 hQueue );

View File

@ -19,7 +19,7 @@ enum seg_type
typedef struct
{
unsigned long base; /* base address */
unsigned long limit; /* segment limit */
unsigned long limit; /* segment limit (in pages or bytes) */
int seg_32bit; /* is segment 32-bit? */
int read_only; /* is segment read-only? */
int limit_in_pages; /* is the limit in pages or bytes? */

View File

@ -11,11 +11,11 @@
extern INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
extern HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size );
extern HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
extern HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
extern BOOL LIBRES_FreeResource( HGLOBAL handle );
extern HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc );
extern LPVOID LIBRES_LockResource( HGLOBAL handle );
extern DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc );
extern HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc );
extern LPVOID LIBRES_LockResource( HGLOBAL32 handle );
extern DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc );
#endif /* WINELIB */

View File

@ -1457,6 +1457,20 @@ typedef struct {
#define MCI_CONSTANT 8
#define MCI_END_CONSTANT 9
/* Mixer flags */
#define MIXER_OBJECTF_HANDLE 0x80000000L
#define MIXER_OBJECTF_MIXER 0x00000000L
#define MIXER_OBJECTF_HMIXER (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIXER)
#define MIXER_OBJECTF_WAVEOUT 0x10000000L
#define MIXER_OBJECTF_HWAVEOUT (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEOUT)
#define MIXER_OBJECTF_WAVEIN 0x20000000L
#define MIXER_OBJECTF_HWAVEIN (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_WAVEIN)
#define MIXER_OBJECTF_MIDIOUT 0x30000000L
#define MIXER_OBJECTF_HMIDIOUT (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIOUT)
#define MIXER_OBJECTF_MIDIIN 0x40000000L
#define MIXER_OBJECTF_HMIDIIN (MIXER_OBJECTF_HANDLE|MIXER_OBJECTF_MIDIIN)
#define MIXER_OBJECTF_AUX 0x50000000L
#define MAKEMCIRESOURCE(wRet, wRes) MAKELRESULT((wRet), (wRes))
typedef struct {

View File

@ -49,6 +49,7 @@ struct options
int ipc; /* Use IPC mechanisms */
WINE_LANGUAGE language; /* Current language */
int managed; /* Managed windows */
int perfectGraphics; /* Favor correctness over speed for graphics */
};
extern struct options Options;
@ -58,5 +59,7 @@ extern struct options Options;
extern int PROFILE_LoadWineIni(void);
extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len );
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name,
int def );
#endif

View File

@ -16,10 +16,13 @@ typedef struct
{
GDIOBJHDR header;
LOGPALETTE logpalette WINE_PACKED;
int *mapping;
} PALETTEOBJ;
#pragma pack(4)
extern int PALETTE_GetObject( PALETTEOBJ * palette, int count, LPSTR buffer );
extern BOOL PALETTE_DeleteObject( HPALETTE16 hpalette, PALETTEOBJ *palette );
extern BOOL PALETTE_UnrealizeObject( HPALETTE16 hpalette, PALETTEOBJ *palette);
#endif /* __WINE_PALETTE_H */

View File

@ -14,7 +14,6 @@ struct pe_data {
int base_addr;
int load_addr;
int vma_size;
int resource_offset; /* offset to resource typedirectory in file */
};
typedef struct pe_data PE_MODULE;

View File

@ -43,13 +43,13 @@ extern void LIBRES_RegisterResources(const struct resource* const * Res);
#define WINE_CONSTRUCTOR
#endif
extern int NE_AccessResource( HMODULE hModule, HRSRC hRsrc );
extern BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle );
extern HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId );
extern DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc );
extern SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle );
extern HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size );
extern HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc );
extern int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc );
extern BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle );
extern HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId );
extern DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc );
extern SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle );
extern HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size );
extern HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc );
extern HANDLE SYSRES_LoadResource( SYSTEM_RESOURCE id );
extern void SYSRES_FreeResource( HANDLE handle );

View File

@ -10,16 +10,6 @@
#include <stddef.h>
HANDLE32 FindResource32A( HINSTANCE hModule, LPCSTR name, LPCSTR type );
HANDLE32 FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type );
HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc );
LPVOID LockResource32( HANDLE32 handle );
BOOL FreeResource32( HANDLE32 handle );
INT AccessResource32( HINSTANCE hModule, HRSRC hRsrc );
DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc );
int WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int buflen);
int WIN32_LoadStringA(HINSTANCE instance, DWORD resource_id, LPSTR buffer, int buflen);
typedef struct _IMAGE_RESOURCE_DIRECTORY {
DWORD Characteristics;
DWORD TimeDateStamp;
@ -46,9 +36,4 @@ typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
WCHAR NameString[1];
} IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
HMENU WIN32_LoadMenuIndirectW(void *menu);
HMENU WIN32_LoadMenuW(HANDLE instance, LPCWSTR name);
HMENU WIN32_LoadMenuIndirectA(void *menu);
HMENU WIN32_LoadMenuA(HANDLE instance,LPCSTR name);
#endif /* __WINE_RESOURCE32_H */

View File

@ -56,12 +56,12 @@ extern SEGPTR IF1632_Stack32_base;
/* Original Unix stack */
extern DWORD IF1632_Original32_esp;
#ifndef WINELIB
#define CURRENT_STACK16 \
((STACK16FRAME *)PTR_SEG_OFF_TO_LIN(IF1632_Saved16_ss,IF1632_Saved16_sp))
#define CURRENT_DS (CURRENT_STACK16->ds)
#ifndef WINELIB
/* Make a segmented pointer from a pointer to a variable located */
/* on the 32-bit stack for the current task. */
#if 0
@ -71,8 +71,6 @@ extern DWORD IF1632_Original32_esp;
#endif
SEGPTR MAKE_SEGPTR(void *ptr);
#else
#define CURRENT_STACK16 error.error
#define CURRENT_DS ((WORD)GetTaskDS())
#define MAKE_SEGPTR(ptr) ((SEGPTR)ptr)
#endif

View File

@ -25,6 +25,10 @@ void STRUCT32_MSG32to16(const MSG32 *msg32,MSG16 *msg16);
void STRUCT32_CREATESTRUCT32Ato16(const CREATESTRUCT32A*,CREATESTRUCT16*);
void STRUCT32_CREATESTRUCT16to32A(const CREATESTRUCT16*,CREATESTRUCT32A*);
void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A*,
MDICREATESTRUCT16*);
void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16*,
MDICREATESTRUCT32A*);
#pragma pack(1)

View File

@ -51,51 +51,51 @@ typedef struct
/* Task database. See 'Windows Internals' p. 226 */
typedef struct
{
HTASK hNext; /* Selector of next TDB */
WORD sp; /* Stack pointer of task */
WORD ss; /* Stack segment of task */
WORD nEvents; /* Events for this task */
char priority; /* Task priority, between -32 and 15 */
BYTE unused1;
HGLOBAL hStack32; /* Handle to 32-bit stack */
HTASK hSelf; /* Selector of this TDB */
HANDLE hPrevInstance; /* Previous instance of the module */
DWORD esp; /* 32-bit stack pointer */
WORD ctrlword8087; /* 80x87 control word */
WORD flags; /* Task flags */
UINT error_mode; /* Error mode (see SetErrorMode) */
WORD version; /* Expected Windows version */
HANDLE hInstance; /* Instance handle for this task */
HMODULE hModule; /* Module handle */
HQUEUE hQueue; /* Selector of task message queue */
HTASK hParent; /* Selector of TDB of parent task */
WORD signal_flags; /* Flags related to signal handler */
DWORD sighandler WINE_PACKED; /* Signal handler */
DWORD userhandler WINE_PACKED; /* USER signal handler */
DWORD discardhandler WINE_PACKED; /* Handler for GlobalDiscard() */
DWORD int0 WINE_PACKED; /* int 0 (divide by zero) handler */
DWORD int2 WINE_PACKED; /* int 2 (NMI) handler */
DWORD int4 WINE_PACKED; /* int 4 (INTO) handler */
DWORD int6 WINE_PACKED; /* int 6 (invalid opcode) handler */
DWORD int7 WINE_PACKED; /* int 7 (coprocessor) handler */
DWORD int3e WINE_PACKED; /* int 3e (80x87 emulator) handler */
DWORD int75 WINE_PACKED; /* int 75 (80x87 error) handler */
DWORD compat_flags WINE_PACKED; /* Compatibility flags */
BYTE unused4[14];
HANDLE hPDB; /* Selector of PDB (i.e. PSP) */
SEGPTR dta WINE_PACKED; /* Current DTA */
BYTE curdrive; /* Current drive */
BYTE curdir[65]; /* Current directory */
WORD nCmdShow; /* cmdShow parameter to WinMain */
HTASK hYieldTo; /* Next task to schedule */
DWORD dlls_to_init; /* Ptr to list of DLL to initialize */
HANDLE hCSAlias; /* Code segment alias for this TDB */
THUNKS thunks WINE_PACKED; /* Make proc instance thunks */
WORD more_thunks[6*4]; /* Space for 6 more thunks */
BYTE module_name[8]; /* Module name for task */
WORD magic; /* TDB signature */
DWORD unused7;
PDB pdb; /* PDB for this task */
HTASK16 hNext; /* 00 Selector of next TDB */
WORD sp; /* 02 Stack pointer of task */
WORD ss; /* 04 Stack segment of task */
WORD nEvents; /* 06 Events for this task */
char priority; /* 08 Task priority, -32..15 */
BYTE unused1; /* 09 */
HGLOBAL16 hStack32; /* 0a Handle to 32-bit stack */
HTASK16 hSelf; /* 0c Selector of this TDB */
HANDLE16 hPrevInstance; /* 0e Previous instance of module */
DWORD esp; /* 10 32-bit stack pointer */
WORD ctrlword8087; /* 14 80x87 control word */
WORD flags; /* 16 Task flags */
UINT16 error_mode; /* 18 Error mode (see SetErrorMode)*/
WORD version; /* 1a Expected Windows version */
HANDLE16 hInstance; /* 1c Instance handle for task */
HMODULE16 hModule; /* 1e Module handle */
HQUEUE16 hQueue; /* 20 Selector of task queue */
HTASK16 hParent; /* 22 Selector of TDB of parent */
WORD signal_flags; /* 24 Flags for signal handler */
DWORD sighandler WINE_PACKED; /* 26 Signal handler */
DWORD userhandler WINE_PACKED; /* 2a USER signal handler */
DWORD discardhandler WINE_PACKED; /* 2e Handler for GlobalDiscard() */
DWORD int0 WINE_PACKED; /* 32 int 0 (divide by 0) handler */
DWORD int2 WINE_PACKED; /* 36 int 2 (NMI) handler */
DWORD int4 WINE_PACKED; /* 3a int 4 (INTO) handler */
DWORD int6 WINE_PACKED; /* 3e int 6 (invalid opc) handler */
DWORD int7 WINE_PACKED; /* 42 int 7 (coprocessor) handler */
DWORD int3e WINE_PACKED; /* 46 int 3e (80x87 emu) handler */
DWORD int75 WINE_PACKED; /* 4a int 75 (80x87 error) handler */
DWORD compat_flags WINE_PACKED; /* 4e Compatibility flags */
BYTE unused4[14]; /* 52 */
HANDLE16 hPDB; /* 60 Selector of PDB (i.e. PSP) */
SEGPTR dta WINE_PACKED; /* 62 Current DTA */
BYTE curdrive; /* 66 Current drive */
BYTE curdir[65]; /* 67 Current directory */
WORD nCmdShow; /* a8 cmdShow parameter to WinMain */
HTASK16 hYieldTo; /* aa Next task to schedule */
DWORD dlls_to_init; /* ac Ptr to DLLs to initialize */
HANDLE16 hCSAlias; /* b0 Code segment for this TDB */
THUNKS thunks WINE_PACKED; /* b2 Make proc instance thunks */
WORD more_thunks[6*4]; /* c2 Space for 6 more thunks */
BYTE module_name[8]; /* f2 Module name for task */
WORD magic; /* fa TDB signature */
DWORD unused7; /* fc */
PDB pdb; /* 100 PDB for this task */
} TDB;
#define TDB_MAGIC ('T' | ('D' << 8))
@ -107,10 +107,11 @@ typedef struct
#pragma pack(4)
extern BOOL TASK_Init(void);
extern HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance,
HANDLE hPrevInstance, HANDLE hEnvironment,
char *cmdLine, WORD cmdShow );
extern void TASK_KillCurrentTask( int exitCode );
extern BOOL32 TASK_Init(void);
extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance,
HANDLE16 hEnvironment, LPCSTR cmdLine,
UINT16 cmdShow );
extern void TASK_KillCurrentTask( INT16 exitCode );
#endif /* _WINE_TASK_H */

View File

@ -8,9 +8,7 @@ extern "C" {
#include "wintypes.h"
#include "winuser.h"
#ifndef WINELIB
#pragma pack(1)
#endif
/* The SIZE structure */
@ -57,9 +55,7 @@ DECL_WINELIB_TYPE(LPPOINT);
((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y)
#define MAKEPOINT16(l) (*((POINT16 *)&(l)))
#ifdef WINELIB16
#define MAKEPOINT(l) MAKEPOINT16(l)
#endif
#define MAKEPOINT WINELIB_NAME(MAKEPOINT)
/* The RECT structure */
@ -1116,6 +1112,11 @@ typedef struct tagPALETTEENTRY
BYTE peRed, peGreen, peBlue, peFlags;
} PALETTEENTRY, *LPPALETTEENTRY;
/* Logical palette entry flags */
#define PC_RESERVED 0x01
#define PC_EXPLICIT 0x02
#define PC_NOCOLLAPSE 0x04
typedef struct
{
WORD palVersion;
@ -1538,12 +1539,11 @@ typedef struct
#define ONESTOPBIT 0
#define ONE5STOPBITS 1
#define TWOSTOPBITS 2
#define IGNORE 0
#ifdef WINELIB32
#define INFINITE 0xFFFFFFFF
#else
#define INFINITE 0xFFFF
#endif
#define INFINITE16 0xFFFF
#define INFINITE32 0xFFFFFFFF
#define INFINITE WINELIB_NAME(INFINITE)
#define CE_RXOVER 0x0001
#define CE_OVERRUN 0x0002
@ -2157,6 +2157,8 @@ typedef struct
#define SWP_NOSENDCHANGING 0x0400
#define SWP_DEFERERASE 0x2000
#define HWND_BROADCAST ((HWND)0xffff)
/* SetWindowPos() hwndInsertAfter field values */
#define HWND_TOP ((HWND)0)
#define HWND_BOTTOM ((HWND)1)
@ -3177,19 +3179,20 @@ typedef struct _SYSTEM_POWER_STATUS
DWORD BatteryFullLifeTime;
} SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS;
#ifndef WINELIB
#pragma pack(4)
#endif
/* Declarations for functions that exist only in Win16 */
WORD AllocSelector(WORD);
WORD AllocSelectorArray(WORD);
INT16 Catch(LPCATCHBUF);
HANDLE16 FarGetOwner(HGLOBAL16);
VOID FarSetOwner(HGLOBAL16,HANDLE16);
VOID FillWindow(HWND16,HWND16,HDC16,HBRUSH16);
WORD FreeSelector(WORD);
DWORD GetBitmapDimension(HBITMAP16);
HTASK16 GetCurrentTask(void);
HMODULE16 GetExePtr(HANDLE16);
HINSTANCE16 GetTaskDS(void);
HQUEUE16 GetTaskQueue(HTASK16);
BOOL16 LocalInit(HANDLE16,WORD,WORD);
@ -3203,6 +3206,7 @@ DWORD SetViewportExt(HDC16,INT16,INT16);
DWORD SetViewportOrg(HDC16,INT16,INT16);
DWORD SetWindowExt(HDC16,INT16,INT16);
DWORD SetWindowOrg(HDC16,INT16,INT16);
INT16 Throw(LPCATCHBUF,INT16);
VOID hmemcpy(LPVOID,LPCVOID,LONG);
/* Declarations for functions that exist only in Win32 */
@ -3266,6 +3270,7 @@ INT16 LZStart(void);
INT16 OffsetRgn(HRGN32,INT32,INT32);
HFILE OpenFile(LPCSTR,OFSTRUCT*,UINT32);
BOOL16 PtInRegion(HRGN32,INT32,INT32);
UINT16 RealizePalette(HDC32);
DWORD RegCloseKey(HKEY);
DWORD RegFlushKey(HKEY);
LONG SetBitmapBits(HBITMAP32,LONG,LPCVOID);
@ -3283,12 +3288,18 @@ HFILE _lopen(LPCSTR,INT32);
/* Declarations for functions that change between Win16 and Win32 */
INT16 AccessResource16(HINSTANCE16,HRSRC16);
INT32 AccessResource32(HINSTANCE32,HRSRC32);
#define AccessResource WINELIB_NAME(AccessResource)
BOOL16 AdjustWindowRect16(LPRECT16,DWORD,BOOL16);
BOOL32 AdjustWindowRect32(LPRECT32,DWORD,BOOL32);
#define AdjustWindowRect WINELIB_NAME(AdjustWindowRect)
BOOL16 AdjustWindowRectEx16(LPRECT16,DWORD,BOOL16,DWORD);
BOOL32 AdjustWindowRectEx32(LPRECT32,DWORD,BOOL32,DWORD);
#define AdjustWindowRectEx WINELIB_NAME(AdjustWindowRectEx)
HGLOBAL16 AllocResource16(HINSTANCE16,HRSRC16,DWORD);
HGLOBAL32 AllocResource32(HINSTANCE32,HRSRC32,DWORD);
#define AllocResource WINELIB_NAME(AllocResource)
BOOL16 AppendMenu16(HMENU16,UINT16,UINT16,SEGPTR);
BOOL32 AppendMenu32A(HMENU32,UINT32,UINT32,LPCSTR);
BOOL32 AppendMenu32W(HMENU32,UINT32,UINT32,LPCWSTR);
@ -3386,6 +3397,10 @@ BOOL32 CreateDirectory32W(LPCWSTR,LPSECURITY_ATTRIBUTES);
HRGN16 CreateEllipticRgnIndirect16(const RECT16 *);
HRGN32 CreateEllipticRgnIndirect32(const RECT32 *);
#define CreateEllipticRgnIndirect WINELIB_NAME(CreateEllipticRgnIndirect)
HFONT16 CreateFont16(INT16,INT16,INT16,INT16,INT16,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR);
HFONT32 CreateFont32A(INT32,INT32,INT32,INT32,INT32,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,LPCSTR);
HFONT32 CreateFont32W(INT32,INT32,INT32,INT32,INT32,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,LPCWSTR);
#define CreateFont WINELIB_NAME_AW(CreateFont)
HFONT16 CreateFontIndirect16(const LOGFONT16*);
HFONT32 CreateFontIndirect32A(const LOGFONT32A*);
HFONT32 CreateFontIndirect32W(const LOGFONT32W*);
@ -3496,6 +3511,10 @@ BOOL32 ExtTextOut32W(HDC32,INT32,INT32,UINT32,const RECT32*,LPCWSTR,UINT32,c
INT16 FillRect16(HDC16,const RECT16*,HBRUSH16);
INT32 FillRect32(HDC32,const RECT32*,HBRUSH32);
#define FillRect WINELIB_NAME(FillRect)
HRSRC16 FindResource16(HINSTANCE16,SEGPTR,SEGPTR);
HRSRC32 FindResource32A(HINSTANCE32,LPCSTR,LPCSTR);
HRSRC32 FindResource32W(HINSTANCE32,LPCWSTR,LPCWSTR);
#define FindResource WINELIB_NAME_AW(FindResource)
HWND16 FindWindow16(SEGPTR,LPCSTR);
HWND32 FindWindow32A(LPCSTR,LPCSTR);
HWND32 FindWindow32W(LPCWSTR,LPCWSTR);
@ -3513,6 +3532,9 @@ BOOL16 FreeModule16(HMODULE16);
void FreeProcInstance16(FARPROC16);
#define FreeProcInstance32(proc) /*nothing*/
#define FreeProcInstance WINELIB_NAME(FreeProcInstance)
BOOL16 FreeResource16(HGLOBAL16);
BOOL32 FreeResource32(HGLOBAL32);
#define FreeResource WINELIB_NAME(FreeResource)
BOOL16 GetBitmapDimensionEx16(HBITMAP16,LPSIZE16);
BOOL32 GetBitmapDimensionEx32(HBITMAP32,LPSIZE32);
#define GetBitmapDimensionEx WINELIB_NAME(GetBitmapDimensionEx)
@ -3603,6 +3625,9 @@ INT32 GetRgnBox32(HRGN32,LPRECT32);
DWORD GetShortPathName32A(LPCSTR,LPSTR,DWORD);
DWORD GetShortPathName32W(LPCWSTR,LPWSTR,DWORD);
#define GetShortPathName WINELIB_NAME_AW(GetShortPathName)
HWND16 GetSysModalWindow16(void);
#define GetSysModalWindow32() ((HWND32)0)
#define GetSysModalWindow WINELIB_NAME(GetSysModalWindow)
UINT16 GetSystemDirectory16(LPSTR,UINT16);
UINT32 GetSystemDirectory32A(LPSTR,UINT32);
UINT32 GetSystemDirectory32W(LPWSTR,UINT32);
@ -3744,10 +3769,37 @@ HFILE LZOpenFile32W(LPCWSTR,LPOFSTRUCT,UINT32);
INT16 LZRead16(HFILE,SEGPTR,UINT16);
INT32 LZRead32(HFILE,LPVOID,UINT32);
#define LZRead WINELIB_NAME(LZRead)
HACCEL16 LoadAccelerators16(HINSTANCE16,SEGPTR);
HACCEL32 LoadAccelerators32A(HINSTANCE32,LPCSTR);
HACCEL32 LoadAccelerators32W(HINSTANCE32,LPCWSTR);
#define LoadAccelerators WINELIB_NAME_AW(LoadAccelerators)
HBITMAP16 LoadBitmap16(HANDLE16,SEGPTR);
HBITMAP32 LoadBitmap32A(HANDLE32,LPCSTR);
HBITMAP32 LoadBitmap32W(HANDLE32,LPCWSTR);
#define LoadBitmap WINELIB_NAME(LoadBitmap)
HCURSOR16 LoadCursor16(HINSTANCE16,SEGPTR);
HCURSOR32 LoadCursor32A(HINSTANCE32,LPCSTR);
HCURSOR32 LoadCursor32W(HINSTANCE32,LPCWSTR);
#define LoadCursor WINELIB_NAME_AW(LoadCursor)
HICON16 LoadIcon16(HINSTANCE16,SEGPTR);
HICON32 LoadIcon32A(HINSTANCE32,LPCSTR);
HICON32 LoadIcon32W(HINSTANCE32,LPCWSTR);
#define LoadIcon WINELIB_NAME_AW(LoadIcon)
HMENU16 LoadMenu16(HINSTANCE16,SEGPTR);
HMENU32 LoadMenu32A(HINSTANCE32,LPCSTR);
HMENU32 LoadMenu32W(HINSTANCE32,LPCWSTR);
#define LoadMenu WINELIB_NAME_AW(LoadMenu)
HMENU16 LoadMenuIndirect16(LPCVOID);
HMENU32 LoadMenuIndirect32A(LPCVOID);
HMENU32 LoadMenuIndirect32W(LPCVOID);
#define LoadMenuIndirect WINELIB_NAME_AW(LoadMenuIndirect)
HGLOBAL16 LoadResource16(HINSTANCE16,HRSRC16);
HGLOBAL32 LoadResource32(HINSTANCE32,HRSRC32);
#define LoadResource WINELIB_NAME(LoadResource)
INT16 LoadString16(HINSTANCE16,UINT16,LPSTR,INT16);
INT32 LoadString32A(HINSTANCE32,UINT32,LPSTR,INT32);
INT32 LoadString32W(HINSTANCE32,UINT32,LPWSTR,INT32);
#define LoadString WINELIB_NAME_AW(LoadString)
HLOCAL16 LocalAlloc16(UINT16,WORD);
HLOCAL32 LocalAlloc32(UINT32,DWORD);
#define LocalAlloc WINELIB_NAME(LocalAlloc)
@ -3778,6 +3830,9 @@ UINT32 LocalSize32(HLOCAL32);
BOOL16 LocalUnlock16(HLOCAL16);
BOOL32 LocalUnlock32(HLOCAL32);
#define LocalUnlock WINELIB_NAME(LocalUnlock)
LPVOID LockResource16(HGLOBAL16);
LPVOID LockResource32(HGLOBAL32);
#define LockResource WINELIB_NAME(LockResource)
HGLOBAL16 LockSegment16(HGLOBAL16);
#define LockSegment32(handle) GlobalFix((HANDLE32)(handle))
#define LockSegment WINELIB_NAME(LockSegment)
@ -3962,6 +4017,9 @@ void SetRect32(LPRECT32,INT32,INT32,INT32,INT32);
void SetRectEmpty16(LPRECT16);
void SetRectEmpty32(LPRECT32);
#define SetRectEmpty WINELIB_NAME(SetRectEmpty)
HWND16 SetSysModalWindow16(HWND16);
#define SetSysModalWindow32(hwnd) ((HWND32)0)
#define SetSysModalWindow WINELIB_NAME(SetSysModalWindow)
UINT16 SetSystemTimer16(HWND16,UINT16,UINT16,TIMERPROC16);
UINT32 SetSystemTimer32(HWND32,UINT32,UINT32,TIMERPROC32);
#define SetSystemTimer WINELIB_NAME(SetSystemTimer)
@ -4092,7 +4150,37 @@ LPSTR lstrcpynWtoA(LPSTR,LPCWSTR,INT32);
#ifndef NO_TRANSITION_TYPES
#ifndef WINELIB
#ifdef __WINE__
# ifdef WINELIB32
typedef INT32 INT;
typedef UINT32 UINT;
typedef BOOL32 BOOL;
typedef WPARAM32 WPARAM;
typedef HANDLE32 HANDLE;
typedef HANDLE32 HBITMAP;
typedef HANDLE32 HBRUSH;
typedef HANDLE32 HCURSOR;
typedef HANDLE32 HDC;
typedef HANDLE32 HDRVR;
typedef HANDLE32 HFONT;
typedef HANDLE32 HGLOBAL;
typedef HANDLE32 HICON;
typedef HANDLE32 HINSTANCE;
typedef HANDLE32 HMENU;
typedef HANDLE32 HMETAFILE;
typedef HANDLE32 HMIDI;
typedef HANDLE32 HMIDIIN;
typedef HANDLE32 HMIDIOUT;
typedef HANDLE32 HMMIO;
typedef HANDLE32 HQUEUE;
typedef HANDLE32 HRGN;
typedef HANDLE32 HRSRC;
typedef HANDLE32 HTASK;
typedef HANDLE32 HWAVE;
typedef HANDLE32 HWAVEIN;
typedef HANDLE32 HWAVEOUT;
typedef HANDLE32 HWND;
# else /* WINELIB32 */
typedef INT16 INT;
typedef UINT16 UINT;
typedef BOOL16 BOOL;
@ -4113,7 +4201,6 @@ typedef HANDLE16 HMIDI;
typedef HANDLE16 HMIDIIN;
typedef HANDLE16 HMIDIOUT;
typedef HANDLE16 HMMIO;
typedef HANDLE16 HMODULE;
typedef HANDLE16 HQUEUE;
typedef HANDLE16 HRGN;
typedef HANDLE16 HRSRC;
@ -4122,8 +4209,8 @@ typedef HANDLE16 HWAVE;
typedef HANDLE16 HWAVEIN;
typedef HANDLE16 HWAVEOUT;
typedef HANDLE16 HWND;
typedef FARPROC16 FARPROC;
#endif /* WINELIB */
# endif /* WINELIB32 */
#endif /* __WINE__ */
/* Callback function pointers types. */
@ -4135,7 +4222,7 @@ typedef int (*FONTENUMPROC)(const void*,const void*,DWORD,LPARAM);
typedef int (*GOBJENUMPROC)(LPVOID,LPARAM);
/*typedef int (*MFENUMPROC)(HDC,HANDLETABLE*,METARECORD*,int,LPARAM);*/
typedef int (*MFENUMPROC)(HDC,void*,void*,int,LPARAM);
typedef BOOL (*PROPENUMPROC)(HWND,LPCTSTR,HANDLE);
typedef BOOL (*PROPENUMPROC)(HWND,LPCSTR,HANDLE);
#else
typedef SEGPTR DRIVERPROC;
typedef SEGPTR EDITWORDBREAKPROC;
@ -4144,15 +4231,11 @@ typedef SEGPTR GOBJENUMPROC;
typedef SEGPTR MFENUMPROC;
typedef SEGPTR PROPENUMPROC;
#endif
typedef FARPROC HOOKPROC;
INT AccessResource(HINSTANCE,HRSRC);
ATOM AddAtom(SEGPTR);
INT AddFontResource(LPCSTR);
WORD AllocCStoDSAlias(WORD);
WORD AllocDStoCSAlias(WORD);
HGLOBAL AllocResource(HINSTANCE,HRSRC,DWORD);
BOOL AnimatePalette(HPALETTE16,UINT,UINT,LPPALETTEENTRY);
LPSTR AnsiLower(LPSTR);
UINT AnsiLowerBuff(LPSTR,UINT);
@ -4172,7 +4255,6 @@ BOOL BuildCommDCB(LPCSTR,DCB*);
void CalcChildScroll(HWND,WORD);
BOOL CallMsgFilter(SEGPTR,INT);
LRESULT CallNextHookEx(HHOOK,INT,WPARAM,LPARAM);
INT Catch(LPCATCHBUF);
BOOL ChangeClipboardChain(HWND,HWND);
WORD ChangeSelector(WORD,WORD);
INT CheckMenuItem(HMENU,UINT,UINT);
@ -4194,7 +4276,6 @@ HANDLE CreateCursorIconIndirect(HANDLE,CURSORICONINFO*,const BYTE*,const BYT
HDC CreateDC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
HBRUSH CreateDIBPatternBrush(HGLOBAL,UINT);
HBITMAP CreateDIBitmap(HDC,BITMAPINFOHEADER*,DWORD,LPVOID,BITMAPINFO*,UINT);
HFONT CreateFont(INT,INT,INT,INT,INT,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR);
HBRUSH CreateHatchBrush(INT,COLORREF);
HDC CreateIC(LPCSTR,LPCSTR,LPCSTR,const DEVMODE*);
HICON CreateIcon(HINSTANCE,INT,INT,BYTE,BYTE,const BYTE*,const BYTE*);
@ -4248,21 +4329,17 @@ int ExcludeClipRect(HDC,short,short,short,short);
int ExcludeVisRect(HDC,short,short,short,short);
BOOL ExitWindows(DWORD,WORD);
HICON ExtractIcon(HINSTANCE,LPCSTR,WORD);
HANDLE16 FarGetOwner(HANDLE16);
void FarSetOwner(HANDLE16,HANDLE16);
void FatalAppExit(UINT,LPCSTR);
void FatalExit(int);
BOOL FillRgn(HDC,HRGN,HBRUSH);
ATOM FindAtom(SEGPTR);
HINSTANCE FindExecutable(LPCSTR,LPCSTR,LPSTR);
HRSRC FindResource(HINSTANCE,SEGPTR,SEGPTR);
BOOL FlashWindow(HWND,BOOL);
int FlushComm(int,int);
BOOL FrameRgn(HDC,HRGN,HBRUSH,int,int);
void FreeLibrary(HANDLE);
BOOL FreeResource(HGLOBAL);
UINT GDIRealizePalette(HDC);
HPALETTE16 GDISelectPalette(HDC,HPALETTE16);
HPALETTE16 GDISelectPalette(HDC,HPALETTE16,WORD);
HWND GetActiveWindow(void);
DWORD GetAspectRatioFilter(HDC);
int GetAsyncKeyState(int);
@ -4279,8 +4356,8 @@ HANDLE GetClipboardData(WORD);
int GetClipboardFormatName(WORD,LPSTR,short);
HWND GetClipboardOwner(void);
HWND GetClipboardViewer(void);
HANDLE GetCodeHandle(FARPROC);
void GetCodeInfo(FARPROC,LPVOID);
HANDLE GetCodeHandle(FARPROC16);
void GetCodeInfo(FARPROC16,LPVOID);
int GetCommError(int,COMSTAT*);
UINT GetCommEventMask(int,int);
int GetCommState(int,DCB*);
@ -4304,7 +4381,6 @@ HWND GetDlgItem(HWND,WORD);
WORD GetDlgItemInt(HWND,WORD,BOOL*,BOOL);
WORD GetDoubleClickTime(void);
int GetEnvironment(LPSTR,LPSTR,WORD);
HMODULE GetExePtr(HANDLE);
HWND GetFocus(void);
DWORD GetFreeSpace(UINT16);
DWORD GetHeapSpaces(HMODULE16);
@ -4334,7 +4410,7 @@ HANDLE GetMetaFileBits(HANDLE);
int GetModuleFileName(HANDLE,LPSTR,short);
HMODULE16 GetModuleHandle(LPCSTR);
int GetModuleUsage(HANDLE);
FARPROC GetMouseEventProc(void);
FARPROC16 GetMouseEventProc(void);
DWORD GetNearestColor(HDC,DWORD);
WORD GetNearestPaletteIndex(HPALETTE16,DWORD);
HWND GetNextDlgGroupItem(HWND,HWND,BOOL);
@ -4364,7 +4440,6 @@ HANDLE GetStockObject(int);
WORD GetStretchBltMode(HDC);
HMENU GetSubMenu(HMENU,short);
COLORREF GetSysColor(short);
HWND GetSysModalWindow(void);
HMENU GetSystemMenu(HWND,BOOL);
int GetSystemMetrics(WORD);
WORD GetSystemPaletteEntries(HDC,WORD,WORD,LPPALETTEENTRY);
@ -4399,13 +4474,13 @@ void GlobalFix(HGLOBAL16);
void GlobalFreeAll(HGLOBAL16);
HGLOBAL16 GlobalLRUNewest(HGLOBAL16);
HGLOBAL16 GlobalLRUOldest(HGLOBAL16);
void GlobalNotify(FARPROC);
void GlobalNotify(FARPROC16);
WORD GlobalPageLock(HGLOBAL16);
WORD GlobalPageUnlock(HGLOBAL16);
BOOL16 GlobalUnWire(HGLOBAL16);
void GlobalUnfix(HGLOBAL16);
SEGPTR GlobalWire(HGLOBAL16);
BOOL GrayString(HDC,HBRUSH,FARPROC,LPARAM,INT,INT,INT,INT,INT);
BOOL GrayString(HDC,HBRUSH,FARPROC16,LPARAM,INT,INT,INT,INT,INT);
BOOL HiliteMenuItem(HWND,HMENU,UINT,UINT);
BOOL InSendMessage(void);
WORD InitAtomTable(WORD);
@ -4433,19 +4508,11 @@ BOOL IsWindowEnabled(HWND);
BOOL IsWindowVisible(HWND);
BOOL IsZoomed(HWND);
void LimitEmsPages(DWORD);
void LineDDA(short,short,short,short,FARPROC,long);
void LineDDA(short,short,short,short,FARPROC16,long);
BOOL LineTo(HDC,short,short);
HANDLE LoadAccelerators(HANDLE,SEGPTR);
HBITMAP LoadBitmap(HANDLE,SEGPTR);
HCURSOR LoadCursor(HANDLE,SEGPTR);
HICON LoadIcon(HANDLE,SEGPTR);
HANDLE LoadLibrary(LPCSTR);
HMENU LoadMenu(HANDLE,SEGPTR);
HANDLE LoadModule(LPCSTR,LPVOID);
HGLOBAL LoadResource(HINSTANCE,HRSRC);
int LoadString(HANDLE,WORD,LPSTR,int);
FARPROC LocalNotify(FARPROC);
LPVOID LockResource(HGLOBAL);
FARPROC16 LocalNotify(FARPROC16);
HMENU LookupMenuHandle(HMENU,INT);
WORD MapVirtualKey(WORD,WORD);
void MessageBeep(WORD);
@ -4482,7 +4549,6 @@ void ProfStop(void);
BOOL PtVisible(HDC,short,short);
int ReadComm(int,LPSTR,int);
WORD RealizeDefaultPalette(HDC);
UINT RealizePalette(HDC);
BOOL Rectangle(HDC,INT,INT,INT,INT);
WORD RegisterClipboardFormat(LPCSTR);
void ReleaseCapture(void);
@ -4546,7 +4612,7 @@ WORD SetPolyFillMode(HDC,WORD);
BOOL SetProp(HWND,SEGPTR,HANDLE);
WORD SetROP2(HDC,WORD);
WORD SetRelAbs(HDC,WORD);
FARPROC SetResourceHandler(HANDLE,LPSTR,FARPROC);
FARPROC16 SetResourceHandler(HANDLE,LPSTR,FARPROC16);
int SetScrollPos(HWND,int,int,BOOL);
void SetScrollRange(HWND,int,int,int,BOOL);
WORD SetSelectorBase(WORD,DWORD);
@ -4555,7 +4621,6 @@ int SetSoundNoise(int,int);
WORD SetStretchBltMode(HDC,WORD);
LONG SetSwapAreaSize(WORD);
void SetSysColors(int,LPINT16,COLORREF*);
HWND SetSysModalWindow(HWND);
WORD SetSystemPaletteUse(HDC,WORD);
BOOL SetSystemPowerState(BOOL, BOOL);
BOOL SetSystemTime(const SYSTEMTIME*);
@ -4572,14 +4637,14 @@ int SetVoiceSound(int,LONG,int);
int SetVoiceThreshold(int,int);
BOOL SetWinDebugInfo(LPWINDEBUGINFO);
BOOL SetWindowPos(HWND,HWND,INT,INT,INT,INT,WORD);
FARPROC SetWindowsHook(short,FARPROC);
HHOOK SetWindowsHookEx(short,HOOKPROC,HINSTANCE,HTASK);
FARPROC16 SetWindowsHook(short,HOOKPROC16);
HHOOK SetWindowsHookEx(INT16,HOOKPROC16,HINSTANCE,HTASK);
HINSTANCE ShellExecute(HWND,LPCSTR,LPCSTR,LPSTR,LPCSTR,INT);
int ShowCursor(BOOL);
void ShowOwnedPopups(HWND,BOOL);
void ShowScrollBar(HWND,WORD,BOOL);
BOOL ShowWindow(HWND,int);
DWORD SizeofResource(HINSTANCE,HRSRC);
DWORD SizeofResource(HMODULE16,HRSRC);
VOID Sleep(DWORD); /* Win32 */
int StartSound(void);
int StopSound(void);
@ -4592,14 +4657,13 @@ void SwitchStackTo(WORD,WORD,WORD);
int SyncAllVoices(void);
BOOL SystemParametersInfo(UINT,UINT,LPVOID,UINT);
LONG TabbedTextOut(HDC,short,short,LPSTR,short,short,LPINT16,short);
int Throw(LPCATCHBUF,int);
int ToAscii(WORD,WORD,LPSTR,LPVOID,WORD);
int TranslateAccelerator(HWND,HANDLE,LPMSG16);
BOOL TranslateMDISysAccel(HWND,LPMSG16);
BOOL TranslateMessage(LPMSG16);
int TransmitCommChar(int,char);
int UngetCommChar(int,char);
BOOL UnhookWindowsHook(short,FARPROC);
BOOL UnhookWindowsHook(short,HOOKPROC16);
BOOL UnhookWindowsHookEx(HHOOK);
BOOL UnrealizeObject(HBRUSH);
int UpdateColors(HDC);

View File

@ -196,7 +196,7 @@ void WSASetLastError(INT iError);
INT WSAGetLastError(void);
BOOL WSAIsBlocking(void);
INT WSAUnhookBlockingHook(void);
FARPROC WSASetBlockingHook(FARPROC lpBlockFunc);
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc);
INT WSACancelBlockingCall(void);
HANDLE WSAAsyncGetServByName(HWND hWnd, u_int wMsg,
LPCSTR name, LPCSTR proto,

View File

@ -7,6 +7,15 @@
#ifndef __WINE_WINTYPES_H
#define __WINE_WINTYPES_H
#ifdef __WINE__
#include "config.h"
#endif
#if !defined(__WINE__) && !defined(WINELIB)
/* If we are not compiling Wine, then we are using Winelib */
#define WINELIB
#endif
#ifdef WINELIB
# ifdef WINELIB16
# undef WINELIB32
@ -28,7 +37,10 @@
/* Macros to map Winelib names to the correct implementation name */
/* depending on WINELIB16, WINELIB32 and UNICODE macros. */
#ifdef WINELIB
#ifdef __WINE__
# define WINELIB_NAME(func) this is a syntax error
# define WINELIB_NAME_AW(func) this is a syntax error
#else /* __WINE__ */
# ifdef WINELIB32
# define WINELIB_NAME(func) func##32
# ifdef UNICODE
@ -40,18 +52,15 @@
# define WINELIB_NAME(func) func##16
# define WINELIB_NAME_AW(func) func##16
# endif /* WINELIB32 */
#else /* WINELIB */
# define WINELIB_NAME(func) this is a syntax error
# define WINELIB_NAME_AW(func) this is a syntax error
#endif /* WINELIB */
#endif /* __WINE__ */
#ifdef WINELIB
# define DECL_WINELIB_TYPE(type) typedef WINELIB_NAME(type) type
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type
#else /* WINELIB */
#ifdef __WINE__
# define DECL_WINELIB_TYPE(type) /* nothing */
# define DECL_WINELIB_TYPE_AW(type) /* nothing */
#endif /* WINELIB */
#else /* __WINE__ */
# define DECL_WINELIB_TYPE(type) typedef WINELIB_NAME(type) type
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type
#endif /* __WINE__ */
/* Standard data types. These are the same for emulator and library. */
@ -86,6 +95,7 @@ typedef ACCESS_MASK REGSAM;
typedef INT16 HFILE;
typedef HANDLE32 HHOOK;
typedef HANDLE32 HKEY;
typedef HANDLE32 HMIXEROBJ;
/* Pointers types. These are the same for emulator and library. */
@ -104,6 +114,7 @@ typedef UINT16 *LPUINT16;
typedef INT32 *LPINT32;
typedef UINT32 *LPUINT32;
typedef HKEY *LPHKEY;
typedef HMIXEROBJ *LPHMIXEROBJ;
/* Special case: a segmented pointer is just a pointer in the library. */
@ -153,6 +164,7 @@ DECLARE_HANDLE(HWND);
typedef LRESULT (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
typedef LRESULT (*FARPROC16)();
typedef LRESULT (*HOOKPROC16)(INT16,WPARAM16,LPARAM);
typedef VOID (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD);
typedef LRESULT (*WNDENUMPROC16)(HWND16,LPARAM);
typedef LRESULT (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
@ -161,6 +173,7 @@ typedef LRESULT (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM);
typedef LRESULT (*DLGPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
typedef LRESULT (*FARPROC32)();
typedef LRESULT (*HOOKPROC32)(INT32,WPARAM32,LPARAM);
typedef VOID (*TIMERPROC32)(HWND32,UINT32,UINT32,DWORD);
typedef LRESULT (*WNDENUMPROC32)(HWND32,LPARAM);
typedef LRESULT (*WNDPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
@ -169,7 +182,7 @@ typedef LRESULT (*WNDPROC32)(HWND32,UINT32,WPARAM32,LPARAM);
/* These types are _not_ defined for the emulator, because they */
/* depend on the UNICODE macro that only exists in user's code. */
#ifdef WINELIB
#ifndef __WINE__
# if defined(WINELIB32) && defined(UNICODE)
typedef WCHAR TCHAR;
typedef LPWSTR LPTSTR;
@ -179,7 +192,7 @@ typedef CHAR TCHAR;
typedef LPSTR LPTSTR;
typedef LPCSTR LPCTSTR;
# endif /* WINELIB32 && UNICODE */
#endif /* WINELIB */
#endif /* __WINE__ */
/* Data types specific to the library. These do _not_ exist in the emulator. */
@ -247,7 +260,7 @@ DECL_WINELIB_TYPE(WNDPROC);
/* Define some empty macros for compatibility with Windows code. */
#ifdef WINELIB
#ifndef __WINE__
#define CALLBACK
#define NEAR
#define FAR
@ -257,15 +270,15 @@ DECL_WINELIB_TYPE(WNDPROC);
#define _near
#define _pascal
#define __export
#endif /* WINELIB */
#endif /* __WINE__ */
/* Macro for structure packing. */
#ifdef WINELIB
#define WINE_PACKED
#else
#ifdef __GNUC__
#define WINE_PACKED __attribute__ ((packed))
#endif /* WINELIB */
#else
#define WINE_PACKED /* nothing */
#endif
/* Macros to split words and longs. */
@ -289,7 +302,7 @@ DECL_WINELIB_TYPE(WNDPROC);
/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
#if !defined(WINELIB) || defined(__i386__)
#ifdef __i386__
#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
#define GET_WORD(ptr) (*(WORD *)(ptr))
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
@ -303,7 +316,7 @@ DECL_WINELIB_TYPE(WNDPROC);
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
#endif /* !WINELIB || __i386__ */
#endif /* __i386__ */
/* MIN and MAX macros */

View File

@ -40,6 +40,8 @@ typedef struct
LPCWSTR lpszClassName;
} WNDCLASS32W, *LPWNDCLASS32W;
#pragma pack(1)
typedef struct
{
UINT16 style;
@ -54,6 +56,8 @@ typedef struct
SEGPTR lpszClassName WINE_PACKED;
} WNDCLASS16, *LPWNDCLASS16;
#pragma pack(4)
typedef struct
{
UINT32 cbSize;

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = ipc

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = library

View File

@ -32,7 +32,7 @@ void LIBRES_RegisterResources(const struct resource* const * Res)
/**********************************************************************
* LIBRES_FindResource
*/
HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
HRSRC32 LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
{
int nameid=0,typeid;
ResListE* ResBlock;
@ -68,12 +68,12 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
for(Res=ResBlock->Resources; *Res; Res++)
if(name)
{
if((*Res)->type==typeid && !lstrcmpi((*Res)->name,name))
return (HRSRC)*Res;
if((*Res)->type==typeid && !lstrcmpi32A((*Res)->name,name))
return (HRSRC32)*Res;
}
else
if((*Res)->type==typeid && (*Res)->id==nameid)
return (HRSRC)*Res;
return (HRSRC32)*Res;
return 0;
}
@ -81,16 +81,16 @@ HRSRC LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type )
/**********************************************************************
* LIBRES_LoadResource
*/
HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc )
HGLOBAL32 LIBRES_LoadResource( HINSTANCE hModule, HRSRC32 hRsrc )
{
return (HGLOBAL)(((struct resource*)hRsrc)->bytes);
return (HGLOBAL32)(((struct resource*)hRsrc)->bytes);
}
/**********************************************************************
* LIBRES_LockResource
*/
LPVOID LIBRES_LockResource( HGLOBAL handle )
LPVOID LIBRES_LockResource( HGLOBAL32 handle )
{
return (LPVOID)handle;
}
@ -118,7 +118,7 @@ INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc )
/**********************************************************************
* LIBRES_SizeofResource
*/
DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc )
{
return (DWORD)(((struct resource*)hRsrc)->size);
}

View File

@ -41,7 +41,7 @@ int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
}
}
WORD CallTo16_word_ ( FARPROC func, WORD arg ) { return func(arg); }
WORD CallTo16_word_ ( FARPROC16 func, WORD arg ) { return func(arg); }
extern LRESULT AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ColorDlgProc(HWND,UINT,WPARAM,LPARAM);
@ -60,22 +60,16 @@ extern LRESULT ReplaceTextDlgProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT ScrollBarWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT StaticWndProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT SystemMessageBoxProc(HWND,UINT,WPARAM,LPARAM);
extern LRESULT TASK_Reschedule(HWND,UINT,WPARAM,LPARAM);
LRESULT ErrorProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
fprintf(stderr,"ERROR: ErrorProc() called!\n");
return 0;
}
extern LRESULT TASK_Reschedule(void);
/***********************************************************************
* MODULE_GetWndProcEntry16 (not a Windows API function)
*
* Return an entry point from the WPROCS dll.
*/
WNDPROC MODULE_GetWndProcEntry16( char *name )
FARPROC16 MODULE_GetWndProcEntry16( char *name )
{
#define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return proc
#define MAP_STR_TO_PROC(str,proc) if(!strcmp(name,str))return (FARPROC16)proc
MAP_STR_TO_PROC("AboutDlgProc",AboutDlgProc);
MAP_STR_TO_PROC("ColorDlgProc",ColorDlgProc);
MAP_STR_TO_PROC("ComboBoxWndProc",ComboBoxWndProc);
@ -96,7 +90,7 @@ WNDPROC MODULE_GetWndProcEntry16( char *name )
MAP_STR_TO_PROC("SystemMessageBoxProc",SystemMessageBoxProc);
MAP_STR_TO_PROC("TASK_Reschedule",TASK_Reschedule);
fprintf(stderr,"warning: No mapping for %s(), add one in library/miscstubs.c\n",name);
return ErrorProc;
return NULL;
}
void DEBUG_EnterDebugger(void)

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = loader

View File

@ -199,7 +199,7 @@ BOOL16 BUILTIN_Init(void)
*/
HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL16 force )
{
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
BUILTIN_DLL *table;
char dllname[16], *p;

View File

@ -194,7 +194,7 @@ void MODULE_DumpModule( HMODULE16 hmodule )
*/
void MODULE_WalkModules(void)
{
HMODULE hModule = hFirstModule;
HMODULE16 hModule = hFirstModule;
fprintf( stderr, "Module Flags Name\n" );
while (hModule)
{
@ -368,6 +368,84 @@ HINSTANCE16 MODULE_CreateInstance( HMODULE16 hModule, LOADPARAMS *params )
}
/***********************************************************************
* MODULE_CreateDummyModule
*
* Create a dummy NE module for Win32 or Winelib.
*/
HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
{
HMODULE16 hModule;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
char *pStr;
INT32 of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
+ strlen(ofs->szPathName) + 1;
INT32 size = sizeof(NE_MODULE) +
/* loaded file info */
of_size +
/* segment table: DS,CS */
2 * sizeof(SEGTABLEENTRY) +
/* name table */
9 +
/* several empty tables */
8;
hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
if (!hModule) return (HMODULE16)11; /* invalid exe */
FarSetOwner( hModule, hModule );
pModule = (NE_MODULE *)GlobalLock16( hModule );
/* Set all used entries */
pModule->magic = NE_SIGNATURE;
pModule->count = 1;
pModule->next = 0;
pModule->flags = 0;
pModule->dgroup = 1;
pModule->ss = 1;
pModule->cs = 2;
pModule->heap_size = 0xe000;
pModule->stack_size = 0x1000;
pModule->seg_count = 2;
pModule->modref_count = 0;
pModule->nrname_size = 0;
pModule->fileinfo = sizeof(NE_MODULE);
pModule->os_flags = NE_OSFLAGS_WINDOWS;
pModule->expected_version = 0x030a;
pModule->self = hModule;
/* Set loaded file information */
memcpy( pModule + 1, ofs, of_size );
((OFSTRUCT *)(pModule+1))->cBytes = of_size - 1;
pSegment = (SEGTABLEENTRY*)((char*)(pModule + 1) + of_size);
pModule->seg_table = pModule->dgroup_entry = (int)pSegment - (int)pModule;
/* Data segment */
pSegment->size = 0;
pSegment->flags = NE_SEGFLAGS_DATA;
pSegment->minsize = 0x1000;
pSegment++;
/* Code segment */
pSegment->flags = 0;
pSegment++;
/* Module name */
pStr = (char *)pSegment;
pModule->name_table = (int)pStr - (int)pModule;
strcpy( pStr, "\x08W32SXXXX" );
pStr += 9;
/* All tables zero terminated */
pModule->res_table = pModule->import_table = pModule->entry_table =
(int)pStr - (int)pModule;
MODULE_RegisterModule( pModule );
return hModule;
}
/***********************************************************************
* MODULE_LoadExeHeader
*/
@ -932,6 +1010,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
HANDLE hInstance, hPrevInstance;
NE_MODULE *pModule;
LOADPARAMS *params = (LOADPARAMS *)paramBlock;
OFSTRUCT ofs;
#ifndef WINELIB
WORD *pModRef, *pDLLs;
HFILE hFile;
@ -941,8 +1020,6 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
if (!hModule) /* We have to load the module */
{
OFSTRUCT ofs;
/* Try to load the built-in first if not disabled */
if ((hModule = BUILTIN_LoadModule( name, FALSE ))) return hModule;
@ -1134,13 +1211,11 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
pModule->count++;
}
#else
hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(NE_MODULE));
lstrcpyn32A( ofs.szPathName, name, sizeof(ofs.szPathName) );
if ((hModule = MODULE_CreateDummyModule( &ofs )) < 32) return hModule;
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->count = 1;
pModule->magic = NE_SIGNATURE;
pModule->self = hModule;
hPrevInstance = 0;
hInstance = MODULE_CreateInstance( hModule, (LOADPARAMS*)paramBlock );
hInstance = MODULE_CreateInstance( hModule, params );
#endif /* WINELIB */
/* Create a task for this instance */

View File

@ -30,13 +30,13 @@
/***********************************************************************
* NE_LoadSegment
*/
BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
BOOL NE_LoadSegment( HMODULE16 hModule, WORD segnum )
{
NE_MODULE *pModule;
SEGTABLEENTRY *pSegTable, *pSeg;
WORD *pModuleTable;
WORD count, i, offset;
HMODULE module;
HMODULE16 module;
FARPROC16 address;
int fd;
struct relocation_entry_s *rep, *reloc_entries;
@ -449,7 +449,7 @@ void NE_FixupPrologs( NE_MODULE *pModule )
*
* Call the DLL initialization code
*/
static BOOL NE_InitDLL( HMODULE hModule )
static BOOL NE_InitDLL( HMODULE16 hModule )
{
#ifndef WINELIB
int cs_reg, ds_reg, ip_reg, cx_reg, di_reg, bp_reg;
@ -498,7 +498,7 @@ static BOOL NE_InitDLL( HMODULE hModule )
pModule->cs = 0; /* Don't initialize it twice */
dprintf_dll( stddeb, "Calling LibMain, cs:ip=%04x:%04x ds=%04x di=%04x cx=%04x\n",
cs_reg, ip_reg, ds_reg, di_reg, cx_reg );
return CallTo16_regs_( (FARPROC)(cs_reg << 16 | ip_reg), ds_reg,
return CallTo16_regs_( (FARPROC16)(cs_reg << 16 | ip_reg), ds_reg,
0 /*es*/, 0 /*bp*/, 0 /*ax*/, 0 /*bx*/,
cx_reg, 0 /*dx*/, 0 /*si*/, di_reg );
#else
@ -513,10 +513,10 @@ static BOOL NE_InitDLL( HMODULE hModule )
*
* Initialize the loaded DLLs.
*/
void NE_InitializeDLLs( HMODULE hModule )
void NE_InitializeDLLs( HMODULE16 hModule )
{
NE_MODULE *pModule;
HMODULE *pDLL;
HMODULE16 *pDLL;
if (!(pModule = MODULE_GetPtr( hModule ))) return;
if (pModule->flags & NE_FFLAGS_WIN32)
@ -528,7 +528,7 @@ void NE_InitializeDLLs( HMODULE hModule )
{
HANDLE to_init = pModule->dlls_to_init;
pModule->dlls_to_init = 0;
for (pDLL = (HMODULE *)GlobalLock16( to_init ); *pDLL; pDLL++)
for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++)
{
NE_InitializeDLLs( *pDLL );
NE_InitDLL( *pDLL );

View File

@ -30,7 +30,7 @@
* Find the type and resource id from their names.
* Return value is MAKELONG( typeId, resId ), or 0 if not found.
*/
static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
static DWORD NE_FindNameTableId( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
{
NE_MODULE *pModule;
NE_TYPEINFO *pTypeInfo;
@ -52,9 +52,9 @@ static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
{
dprintf_resource( stddeb, "NameTable entry: type=%04x id=%04x\n",
pTypeInfo->type_id, pNameInfo->id );
handle = LoadResource( hModule,
handle = LoadResource16( hModule,
(HANDLE)((int)pNameInfo - (int)pModule) );
for(p = (WORD*)LockResource(handle); p && *p; p = (WORD *)((char*)p+*p))
for(p = (WORD*)LockResource16(handle); p && *p; p = (WORD *)((char*)p+*p))
{
dprintf_resource( stddeb," type=%04x '%s' id=%04x '%s'\n",
p[1], (char *)(p+3), p[2],
@ -88,7 +88,7 @@ static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
ret = MAKELONG( p[1], p[2] );
break;
}
FreeResource( handle );
FreeResource16( handle );
if (ret) return ret;
}
}
@ -134,7 +134,7 @@ static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
/***********************************************************************
* NE_FindResource
*/
HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
HRSRC NE_FindResource( HMODULE16 hModule, SEGPTR typeId, SEGPTR resId )
{
NE_TYPEINFO *pTypeInfo;
HRSRC hRsrc;
@ -211,7 +211,7 @@ HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
/***********************************************************************
* NE_AllocResource
*/
HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
HGLOBAL NE_AllocResource( HMODULE16 hModule, HRSRC hRsrc, DWORD size )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
@ -231,7 +231,7 @@ HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
/***********************************************************************
* NE_AccessResource
*/
int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
int fd;
@ -254,7 +254,7 @@ int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
/***********************************************************************
* NE_SizeofResource
*/
DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
@ -272,7 +272,7 @@ DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
/***********************************************************************
* NE_LoadResource
*/
HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc )
HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
@ -307,7 +307,7 @@ HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc )
/***********************************************************************
* NE_LockResource
*/
SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle )
SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle )
{
/* May need to reload the resource if discarded */
@ -318,7 +318,7 @@ SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle )
/***********************************************************************
* NE_FreeResource
*/
BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle )
{
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
@ -346,7 +346,7 @@ BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
}
pTypeInfo = (NE_TYPEINFO *)pNameInfo;
}
fprintf( stderr, "FreeResource: %04x %04x not found!\n", hModule, handle );
fprintf( stderr, "NE_FreeResource: %04x %04x not found!\n", hModule, handle );
return handle;
}
#endif /* WINELIB */

View File

@ -122,7 +122,7 @@ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName)
if(strcmp(ename,funcName)==0)
return (FARPROC32)(load_addr + *function);
}else{
if(funcName == (int)*ordinal + exports->Base)
if((int)funcName == (int)*ordinal + exports->Base)
return (FARPROC32)(load_addr + *function);
}
function++;
@ -132,14 +132,14 @@ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName)
return NULL;
}
void fixup_imports(struct pe_data *pe, HMODULE hModule)
void fixup_imports(struct pe_data *pe, HMODULE16 hModule)
{
struct PE_Import_Directory * pe_imp;
int fixup_failed=0;
unsigned int load_addr = pe->load_addr;
int i;
NE_MODULE *ne_mod;
HMODULE *mod_ptr;
HMODULE16 *mod_ptr;
/* OK, now dump the import list */
dprintf_win32(stddeb, "\nDumping imports list\n");
@ -151,7 +151,7 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
/* Now, allocate memory for dlls_to_init */
ne_mod = GlobalLock16(hModule);
ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT,(i+1) * sizeof(HMODULE),
ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT,(i+1) * sizeof(HMODULE16),
hModule, FALSE, FALSE, FALSE );
mod_ptr = GlobalLock16(ne_mod->dlls_to_init);
/* load the modules and put their handles into the list */
@ -159,7 +159,7 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
{
char *name = (char*)load_addr+pe_imp->ModuleName;
mod_ptr[i] = LoadModule(name,(LPVOID)-1);
if(mod_ptr[i]<=(HMODULE)32)
if(mod_ptr[i]<=(HMODULE16)32)
{
char *p, buffer[256];
@ -169,7 +169,7 @@ void fixup_imports(struct pe_data *pe, HMODULE hModule)
strcpy( p + 1, name );
mod_ptr[i] = LoadModule( buffer, (LPVOID)-1 );
}
if(mod_ptr[i]<=(HMODULE)32)
if(mod_ptr[i]<=(HMODULE16)32)
{
fprintf(stderr,"Module %s not found\n",name);
exit(0);
@ -349,7 +349,7 @@ static void do_relocations(struct pe_data *pe)
* PE_LoadImage
* Load one PE format executable into memory
*/
static struct pe_data *PE_LoadImage( int fd, HMODULE hModule, WORD offset )
static struct pe_data *PE_LoadImage( int fd, HMODULE16 hModule, WORD offset )
{
struct pe_data *pe;
int i, result;
@ -433,16 +433,9 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE hModule, WORD offset )
if(strcmp(pe->pe_seg[i].Name, ".edata") == 0)
pe->pe_export = (struct PE_Export_Directory *) result;
if(strcmp(pe->pe_seg[i].Name, ".rsrc") == 0) {
if(strcmp(pe->pe_seg[i].Name, ".rsrc") == 0)
pe->pe_resource = (struct PE_Resource_Directory *) result;
#if 0
/* FIXME pe->resource_offset should be deleted from structure if this
ifdef doesn't break anything */
/* save offset for PE_FindResource */
pe->resource_offset = pe->pe_seg[i].Virtual_Address -
pe->pe_seg[i].PointerToRawData;
#endif
}
if(strcmp(pe->pe_seg[i].Name, ".reloc") == 0)
pe->pe_reloc = (struct PE_Reloc_Block *) result;
@ -522,113 +515,45 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE hModule, WORD offset )
return pe;
}
HINSTANCE MODULE_CreateInstance(HMODULE hModule,LOADPARAMS *params);
HINSTANCE MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
void InitTask( SIGCONTEXT *context );
HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
{
PE_MODULE *pe;
int size, of_size;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
char *pStr;
DWORD cts;
HMODULE hModule;
HINSTANCE hInstance;
struct mz_header_s mz_header;
HMODULE16 hModule;
HINSTANCE16 hInstance;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
FARPROC16 startup;
struct mz_header_s mz_header;
lseek(fd,0,SEEK_SET);
read( fd, &mz_header, sizeof(mz_header) );
if ((hModule = MODULE_CreateDummyModule( ofs )) < 32) return hModule;
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->flags = NE_FFLAGS_WIN32;
of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
+ strlen(ofs->szPathName) + 1;
size = sizeof(NE_MODULE) +
/* loaded file info */
of_size +
/* segment table: DS,CS */
2 * sizeof(SEGTABLEENTRY) +
/* name table */
9 +
/* several empty tables */
8;
lseek( fd, 0, SEEK_SET );
read( fd, &mz_header, sizeof(mz_header) );
hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
if (!hModule) return (HINSTANCE)11; /* invalid exe */
/* Set the startup address */
FarSetOwner( hModule, hModule );
pModule = (NE_MODULE*)GlobalLock16(hModule);
startup = MODULE_GetWndProcEntry16("Win32CallToStart");
pSegment = NE_SEG_TABLE(pModule) + pModule->cs - 1;
pSegment->selector = SELECTOROF(startup); /* FIXME */
pModule->ip = OFFSETOF(startup);
/* Set all used entries */
pModule->magic=NE_SIGNATURE;
pModule->count=1;
pModule->next=0;
pModule->flags=NE_FFLAGS_WIN32;
pModule->dgroup=1;
pModule->ss=1;
pModule->cs=2;
/* Who wants to LocalAlloc for a PE Module? */
pModule->heap_size=0x1000;
pModule->stack_size=0xF000;
pModule->seg_count=1;
pModule->modref_count=0;
pModule->nrname_size=0;
pModule->fileinfo=sizeof(NE_MODULE);
pModule->os_flags=NE_OSFLAGS_WINDOWS;
pModule->expected_version=0x30A;
pModule->self = hModule;
pModule->pe_module = PE_LoadImage( fd, hModule, mz_header.ne_offset );
/* Set loaded file information */
memcpy( pModule + 1, ofs, of_size );
((OFSTRUCT *)(pModule+1))->cBytes = of_size - 1;
hInstance = MODULE_CreateInstance( hModule, params );
pSegment=(SEGTABLEENTRY*)((char*)(pModule + 1) + of_size);
pModule->seg_table=pModule->dgroup_entry=(int)pSegment-(int)pModule;
pSegment->size=0;
pSegment->flags=NE_SEGFLAGS_DATA;
pSegment->minsize=0x1000;
pSegment++;
cts=(DWORD)MODULE_GetWndProcEntry16("Win32CallToStart");
#ifdef WINELIB32
pSegment->selector=(void*)cts;
pModule->ip=0;
#else
pSegment->selector=cts>>16; /* FIXME!! */
pModule->ip=cts & 0xFFFF;
#endif
pSegment++;
pStr=(char*)pSegment;
pModule->name_table=(int)pStr-(int)pModule;
strcpy(pStr,"\x08W32SXXXX");
pStr+=9;
/* All tables zero terminated */
pModule->res_table=pModule->import_table=pModule->entry_table=
(int)pStr-(int)pModule;
MODULE_RegisterModule( pModule );
pe = PE_LoadImage( fd, hModule, mz_header.ne_offset );
pModule->pe_module = pe;
pModule->heap_size=0x1000;
pModule->stack_size=0xE000;
/* CreateInstance allocates now 64KB */
hInstance=MODULE_CreateInstance(hModule,NULL /* FIX: NULL? really? */);
/* FIXME: Is this really the correct place to initialise the DLL? */
if ((pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)) {
/* PE_InitDLL(hModule); */
} else {
TASK_CreateTask(hModule,hInstance,0,
params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine),
*((WORD*)PTR_SEG_TO_LIN(params->showCmd)+1));
PE_InitializeDLLs(hModule);
}
return hInstance;
if (!(pModule->pe_module->pe_header->coff.Characteristics & IMAGE_FILE_DLL))
{
TASK_CreateTask( hModule, hInstance, 0,
params->hEnvironment,
(LPSTR)PTR_SEG_TO_LIN( params->cmdLine ),
*((WORD*)PTR_SEG_TO_LIN(params->showCmd) + 1) );
PE_InitializeDLLs( hModule );
}
return hInstance;
}
int USER_InitApp(HINSTANCE hInstance);
@ -637,29 +562,29 @@ void PE_InitTEB(int hTEB);
void PE_Win32CallToStart( SIGCONTEXT *context )
{
int fs;
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
dprintf_win32(stddeb,"Going to start Win32 program\n");
InitTask( &context );
InitTask( context );
hModule = GetExePtr( GetCurrentTask() );
pModule = MODULE_GetPtr( hModule );
USER_InitApp( hModule );
fs=(int)GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, 0x10000 );
PE_InitTEB(fs);
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs));
CallTaskStart32( (FARPROC)(pModule->pe_module->load_addr +
CallTaskStart32( (FARPROC32)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->opt_coff.AddressOfEntryPoint) );
}
int PE_UnloadImage( HMODULE hModule )
int PE_UnloadImage( HMODULE16 hModule )
{
printf("PEunloadImage() called!\n");
/* free resources, image, unmap */
return 1;
}
static void PE_InitDLL(HMODULE hModule)
static void PE_InitDLL(HMODULE16 hModule)
{
NE_MODULE *pModule;
PE_MODULE *pe;
@ -675,7 +600,7 @@ static void PE_InitDLL(HMODULE hModule)
if (pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)
{
printf("InitPEDLL() called!\n");
CallDLLEntryProc32( (FARPROC)(pe->load_addr +
CallDLLEntryProc32( (FARPROC32)(pe->load_addr +
pe->pe_header->opt_coff.AddressOfEntryPoint),
hModule, 0, 0 );
}
@ -708,16 +633,16 @@ void PE_InitTEB(int hTEB)
pTEB->taskid = getpid();
}
void PE_InitializeDLLs(HMODULE hModule)
void PE_InitializeDLLs(HMODULE16 hModule)
{
NE_MODULE *pModule;
HMODULE *pDLL;
HMODULE16 *pDLL;
pModule = MODULE_GetPtr( GetExePtr(hModule) );
if (pModule->dlls_to_init)
{
HANDLE to_init = pModule->dlls_to_init;
pModule->dlls_to_init = 0;
for (pDLL = (HMODULE *)GlobalLock16( to_init ); *pDLL; pDLL++)
for (pDLL = (HMODULE16 *)GlobalLock16( to_init ); *pDLL; pDLL++)
{
PE_InitializeDLLs( *pDLL );
PE_InitDLL( *pDLL );

View File

@ -1,154 +1,167 @@
#ifndef WINELIB
/*
* (c) 1994 Erik Bos <erik@xs4all.nl>
* PE (Portable Execute) File Resources
*
* based on Eric Youndale's pe-test and:
* Copyright 1995 Thomas Sandford
* Copyright 1996 Martin von Loewis
*
* ftp.microsoft.com:/pub/developer/MSDN/CD8/PEFILE.ZIP
* Based on the Win16 resource handling code in loader/resource.c
* Copyright 1993 Robert J. Amstadt
* Copyright 1995 Alexandre Julliard
*
* This is not even at ALPHA level yet. Don't expect it to work!
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "wintypes.h"
#include "windows.h"
#include "ldt.h"
#include "neexe.h"
#include "peexe.h"
#include "kernel32.h"
#include "pe_image.h"
#include "resource.h"
#include "module.h"
#include "handle32.h"
#include "libres.h"
#include "resource32.h"
#include "stackframe.h"
#include "neexe.h"
#include "accel.h"
#include "xmalloc.h"
#include "string32.h"
#include "stddebug.h"
/* #define DEBUG_RESOURCE */
#include "debug.h"
#if 0
int language = 0x0409;
static int
find_lang(char *root, struct PE_Resource_Directory *resource, RESOURCE *r)
#define PrintIdA(name) \
if (HIWORD((DWORD)name)) \
dprintf_resource( stddeb, "'%s'", name); \
else \
dprintf_resource( stddeb, "#%04x", LOWORD(name));
#define PrintIdW(name)
#define PrintId(name)
/**********************************************************************
* GetResDirEntryW
*
* Helper function - goes down one level of PE resource tree
*
*/
PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr,
LPCWSTR name,
DWORD root)
{
struct PE_Directory_Entry *type_dir;
struct PE_Resource_Leaf_Entry *leaf;
int entrynum;
PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
int namelen;
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);
dprintf_resource(stddeb, "\t\tPE_findlang: id %8x\n", (int) type_dir->Name);
dprintf_resource(stddeb, "\t\taddress %ld, size %ld, language id %ld\n", leaf->OffsetToData, leaf->Size, leaf->CodePage);
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));
dprintf_resource(stddeb, "\t\tPE_findlang: id %8x\n",
(int) type_dir->Name);
dprintf_resource(stddeb, "\t\t%x %x %x\n", leaf->OffsetToData,
leaf->Size, leaf->CodePage);
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);
dprintf_resource(stddeb, "\tPE_findresource: name %s\n", res_name);
if (lstrcmpi(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++) {
dprintf_resource(stddeb, "\tPE_findresource: name %8x\n", (int) type_dir->Name);
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++;
}
if (HIWORD(name)) {
/* FIXME: what about #xxx names? */
entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
(BYTE *) resdirptr +
sizeof(IMAGE_RESOURCE_DIRECTORY));
namelen = lstrlen32W(name);
for (entrynum = 0; entrynum < resdirptr->NumberOfNamedEntries; entrynum++)
{
PIMAGE_RESOURCE_DIR_STRING_U str =
(PIMAGE_RESOURCE_DIR_STRING_U) (root +
(entryTable[entrynum].Name & 0x7fffffff));
if(namelen != str->Length)
continue;
if(lstrncmpi32W(name,str->NameString,str->Length)==0)
return (PIMAGE_RESOURCE_DIRECTORY) (
root +
(entryTable[entrynum].OffsetToData & 0x7fffffff));
}
return 0;
}
static int
find_type(struct PE_Resource_Directory *resource, LPSTR resource_name,
LPSTR type_name)
{
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);
dprintf_resource(stddeb, "PE_findtype: type %s\n",
res_name);
if (lstrcmpi(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++) {
dprintf_resource(stddeb, "PE_findtype: type %8x\n", (int) type_dir->Name);
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;
return NULL;
} else {
entryTable = (PIMAGE_RESOURCE_DIRECTORY_ENTRY) (
(BYTE *) resdirptr +
sizeof(IMAGE_RESOURCE_DIRECTORY) +
resdirptr->NumberOfNamedEntries * sizeof(IMAGE_RESOURCE_DIRECTORY_ENTRY));
for (entrynum = 0; entrynum < resdirptr->NumberOfIdEntries; entrynum++)
if ((DWORD)entryTable[entrynum].Name == (DWORD)name)
return (PIMAGE_RESOURCE_DIRECTORY) (
root +
(entryTable[entrynum].OffsetToData & 0x7fffffff));
return NULL;
}
}
/**********************************************************************
* PE_FindResource [KERNEL.60]
* GetResDirEntryA
*
* Helper function - goes down one level of PE resource tree
*
*/
int
PE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
RESOURCE *r)
PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY resdirptr,
LPCSTR name,
DWORD root)
{
dprintf_resource(stddeb, "PE_FindResource hInst=%04X typename=%08X resname=%08X\n",
instance, (int) type_name, (int) resource_name);
if (HIWORD(resource_name))
{
char *resource_name_ptr = PTR_SEG_TO_LIN( resource_name );
if (resource_name_ptr[0] == '#')
resource_name = (SEGPTR) atoi(resource_name_ptr + 1);
else
resource_name = (SEGPTR)resource_name_ptr;
}
if (HIWORD(type_name))
{
char *type_name_ptr = PTR_SEG_TO_LIN( type_name );
if (type_name_ptr[0] == '#')
type_name = (SEGPTR) atoi(type_name_ptr + 1);
else
type_name = (SEGPTR) type_name_ptr;
}
return find_type(r->wpnt->pe->pe_resource, resource_name, type_name);
LPWSTR xname;
PIMAGE_RESOURCE_DIRECTORY ret;
if (HIWORD((DWORD)name))
xname = STRING32_DupAnsiToUni(name);
else
xname = (LPWSTR)name;
ret=GetResDirEntryW(resdirptr,xname,root);
if (HIWORD((DWORD)name))
free(xname);
return ret;
}
/**********************************************************************
* PE_FindResource32W
*/
HANDLE32 PE_FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
{
PE_MODULE *pe;
NE_MODULE *pModule;
PIMAGE_RESOURCE_DIRECTORY resdirptr;
DWORD root;
HANDLE32 result;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource: module=%08x type=", hModule );
PrintId( type );
dprintf_resource( stddeb, " name=" );
PrintId( name );
dprintf_resource( stddeb, "\n" );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; /* FIXME? */
if (!(pe = pModule->pe_module) || !pe->pe_resource) return 0;
resdirptr = (PIMAGE_RESOURCE_DIRECTORY) pe->pe_resource;
root = (DWORD) resdirptr;
if ((resdirptr = GetResDirEntryW(resdirptr, type, root)) == NULL)
return 0;
if ((resdirptr = GetResDirEntryW(resdirptr, name, root)) == NULL)
return 0;
result = (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)language, root);
/* Try LANG_NEUTRAL, too */
if(!result)
return (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)0, root);
return result;
}
/**********************************************************************
* PE_LoadResource32
*/
HANDLE32 PE_LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc )
{
NE_MODULE *pModule;
PE_MODULE *pe;
if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "PE_LoadResource32: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; /* FIXME? */
if (!(pe = pModule->pe_module) || !pe->pe_resource) return 0;
return (HANDLE32) (pe->load_addr+((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData);
}
#endif
#endif /* WINELIB */

View File

@ -23,6 +23,8 @@
#include "stddebug.h"
#include "debug.h"
#include "libres.h"
#include "string32.h"
#include "xmalloc.h"
#define PrintId(name) \
if (HIWORD((DWORD)name)) \
@ -32,14 +34,14 @@
/**********************************************************************
* FindResource (KERNEL.60)
* FindResource16 (KERNEL.60)
*/
HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
HRSRC16 FindResource16( HMODULE16 hModule, SEGPTR name, SEGPTR type )
{
NE_MODULE *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource: module=%04x type=", hModule );
dprintf_resource(stddeb, "FindResource16: module=%04x type=", hModule );
PrintId( type );
if (HIWORD(name)) /* Check for '#xxx' name */
{
@ -55,7 +57,7 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to FindResource() for Win32 module\n");
fprintf(stderr,"Don't know how to FindResource16() for Win32 module\n");
return 0;
}
return NE_FindResource( hModule, type, name );
@ -66,21 +68,67 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
/**********************************************************************
* LoadResource (KERNEL.61)
* FindResource32A (KERNEL32.128)
*/
HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
HANDLE32 FindResource32A( HINSTANCE32 hModule, LPCSTR name, LPCSTR type )
{
LPWSTR xname,xtype;
HANDLE32 ret;
if (HIWORD((DWORD)name)) xname = STRING32_DupAnsiToUni(name);
else xname = (LPWSTR)name;
if (HIWORD((DWORD)type)) xtype = STRING32_DupAnsiToUni(type);
else xtype = (LPWSTR)type;
ret = FindResource32W(hModule,xname,xtype);
if (HIWORD((DWORD)name)) free(xname);
if (HIWORD((DWORD)type)) free(xtype);
return ret;
}
/**********************************************************************
* FindResource32W (KERNEL32.131)
*/
HRSRC32 FindResource32W( HINSTANCE32 hModule, LPCWSTR name, LPCWSTR type )
{
#ifndef WINELIB
NE_MODULE *pModule;
/* Sometimes we get passed hModule = 0x00000000. FIXME: is GetTaskDS()
* ok?
*/
if (!hModule) hModule = GetTaskDS();
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource32W: module=%08x type=", hModule );
PrintId( type );
dprintf_resource( stddeb, " name=" );
PrintId( name );
dprintf_resource( stddeb, "\n" );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
return PE_FindResource32W(hModule,name,type);
#else
return LIBRES_FindResource( hModule, name, type );
#endif
}
/**********************************************************************
* LoadResource16 (KERNEL.61)
*/
HGLOBAL16 LoadResource16( HMODULE16 hModule, HRSRC16 hRsrc )
{
NE_MODULE *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "LoadResource: module=%04x res=%04x\n",
dprintf_resource(stddeb, "LoadResource16: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to LoadResource() for Win32 module\n");
fprintf(stderr,"Don't know how to LoadResource16() for Win32 module\n");
return 0;
}
return NE_LoadResource( hModule, hRsrc );
@ -89,15 +137,41 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
#endif
}
/**********************************************************************
* LoadResource32 (KERNEL32.370)
*/
HGLOBAL32 LoadResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
{
#ifndef WINELIB
NE_MODULE *pModule;
if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "LoadResource32: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32))
{
fprintf(stderr,"LoadResource32: tried to load a non win32 resource.\n");
return 0; /* FIXME? */
}
return PE_LoadResource32(hModule,hRsrc);
#else
return LIBRES_LoadResource( hModule, hRsrc );
#endif
}
/**********************************************************************
* LockResource (KERNEL.62)
*/
/* 16-bit version */
SEGPTR WIN16_LockResource( HGLOBAL handle )
SEGPTR WIN16_LockResource16(HGLOBAL16 handle)
{
#ifndef WINELIB
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
@ -115,11 +189,11 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
#endif
}
/* 32-bit version */
LPVOID LockResource( HGLOBAL handle )
/* WINELIB 16-bit version */
LPVOID LockResource16( HGLOBAL16 handle )
{
#ifndef WINELIB
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
@ -128,7 +202,7 @@ LPVOID LockResource( HGLOBAL handle )
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to LockResource() for Win32 module\n");
fprintf(stderr,"Don't know how to LockResource16() for Win32 module\n");
return 0;
}
return (LPSTR)PTR_SEG_TO_LIN( NE_LockResource( hModule, handle ) );
@ -139,21 +213,30 @@ LPVOID LockResource( HGLOBAL handle )
/**********************************************************************
* FreeResource (KERNEL.63)
* LockResource32 (KERNEL32.384)
*/
BOOL FreeResource( HGLOBAL handle )
LPVOID LockResource32( HGLOBAL32 handle )
{
return (LPVOID)handle;
}
/**********************************************************************
* FreeResource16 (KERNEL.63)
*/
BOOL16 FreeResource16( HGLOBAL16 handle )
{
#ifndef WINELIB
HMODULE hModule;
HMODULE16 hModule;
NE_MODULE *pModule;
dprintf_resource(stddeb, "FreeResource: handle=%04x\n", handle );
dprintf_resource(stddeb, "FreeResource16: handle=%04x\n", handle );
if (!handle) return FALSE;
hModule = GetExePtr( handle );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to FreeResource() for Win32 module\n");
fprintf(stderr,"Don't know how to FreeResource16() for Win32 module\n");
return 0;
}
return NE_FreeResource( hModule, handle );
@ -162,23 +245,32 @@ BOOL FreeResource( HGLOBAL handle )
#endif
}
/**********************************************************************
* FreeResource32 (KERNEL32.145)
*/
BOOL32 FreeResource32( HGLOBAL32 handle )
{
/* no longer used in Win32 */
return TRUE;
}
/**********************************************************************
* AccessResource (KERNEL.64)
* AccessResource16 (KERNEL.64)
*/
INT AccessResource( HINSTANCE hModule, HRSRC hRsrc )
INT16 AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
{
NE_MODULE *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
dprintf_resource(stddeb, "AccessResource16: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to AccessResource() for Win32 module\n");
fprintf(stderr,"Don't know how to AccessResource16() for Win32 module\n");
return 0;
}
return NE_AccessResource( hModule, hRsrc );
@ -189,20 +281,34 @@ INT AccessResource( HINSTANCE hModule, HRSRC hRsrc )
/**********************************************************************
* SizeofResource (KERNEL.65)
* AccessResource32 (KERNEL32.64)
*/
DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc )
INT32 AccessResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
{
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
fprintf(stderr,"AccessResource32: not implemented\n");
return 0;
}
/**********************************************************************
* SizeofResource16 (KERNEL.65)
*/
DWORD SizeofResource16( HMODULE16 hModule, HRSRC16 hRsrc )
{
NE_MODULE *pModule;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "SizeofResource: module=%04x res=%04x\n",
dprintf_resource(stddeb, "SizeofResource16: module=%04x res=%04x\n",
hModule, hRsrc );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to SizeOfResource() for Win32 module\n");
fprintf(stderr,"Don't know how to SizeOfResource16() for Win32 module\n");
return 0;
}
return NE_SizeofResource( hModule, hRsrc );
@ -213,9 +319,22 @@ DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc )
/**********************************************************************
* AllocResource (KERNEL.66)
* SizeofResource32 (KERNEL32.522)
*/
HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
DWORD SizeofResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
{
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "SizeofResource32: module=%04x res=%04x\n",
hModule, hRsrc );
fprintf(stderr,"SizeofResource32: not implemented\n");
return 0;
}
/**********************************************************************
* AllocResource16 (KERNEL.66)
*/
HGLOBAL16 AllocResource16( HMODULE16 hModule, HRSRC16 hRsrc, DWORD size )
{
NE_MODULE *pModule;
@ -255,13 +374,13 @@ HANDLE DirectResAlloc(HANDLE hInstance, WORD wType, WORD wSize)
/**********************************************************************
* LoadAccelerators [USER.177]
* LoadAccelerators16 [USER.177]
*/
HANDLE LoadAccelerators(HANDLE instance, SEGPTR lpTableName)
HACCEL16 LoadAccelerators16(HINSTANCE16 instance, SEGPTR lpTableName)
{
HANDLE hAccel;
HANDLE rsc_mem;
HRSRC hRsrc;
HACCEL16 hAccel;
HGLOBAL16 rsc_mem;
HRSRC16 hRsrc;
BYTE *lp;
ACCELHEADER *lpAccelTbl;
int i, n;
@ -273,12 +392,12 @@ HANDLE LoadAccelerators(HANDLE instance, SEGPTR lpTableName)
dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
instance, LOWORD(lpTableName) );
if (!(hRsrc = FindResource( instance, lpTableName, RT_ACCELERATOR )))
if (!(hRsrc = FindResource16( instance, lpTableName, RT_ACCELERATOR )))
return 0;
if (!(rsc_mem = LoadResource( instance, hRsrc ))) return 0;
if (!(rsc_mem = LoadResource16( instance, hRsrc ))) return 0;
lp = (BYTE *)LockResource(rsc_mem);
n = SizeofResource( instance, hRsrc ) / sizeof(ACCELENTRY);
lp = (BYTE *)LockResource16(rsc_mem);
n = SizeofResource16(instance,hRsrc)/sizeof(ACCELENTRY);
hAccel = GlobalAlloc16(GMEM_MOVEABLE,
sizeof(ACCELHEADER) + (n + 1)*sizeof(ACCELENTRY));
lpAccelTbl = (LPACCELHEADER)GlobalLock16(hAccel);
@ -297,10 +416,78 @@ HANDLE LoadAccelerators(HANDLE instance, SEGPTR lpTableName)
lpAccelTbl->wCount++;
}
GlobalUnlock16(hAccel);
FreeResource( rsc_mem );
FreeResource16( rsc_mem );
return hAccel;
}
/**********************************************************************
* LoadAccelerators32W [USER.177]
*/
HACCEL32 LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
{
#if 0
HACCEL32 hAccel;
HGLOBAL32 rsc_mem;
HRSRC32 hRsrc;
BYTE *lp;
ACCELHEADER *lpAccelTbl;
int i, n;
if (HIWORD(lpTableName))
dprintf_accel( stddeb, "LoadAccelerators: %04x '%s'\n",
instance, (char *)( lpTableName ) );
else
dprintf_accel( stddeb, "LoadAccelerators: %04x %04x\n",
instance, LOWORD(lpTableName) );
if (!(hRsrc = FindResource32W( instance, lpTableName,
(LPCWSTR)RT_ACCELERATOR )))
return 0;
if (!(rsc_mem = LoadResource32( instance, hRsrc ))) return 0;
lp = (BYTE *)LockResource32(rsc_mem);
n = SizeofResource32(instance,hRsrc)/sizeof(ACCELENTRY);
hAccel = GlobalAlloc16(GMEM_MOVEABLE,
sizeof(ACCELHEADER) + (n + 1)*sizeof(ACCELENTRY));
lpAccelTbl = (LPACCELHEADER)GlobalLock16(hAccel);
lpAccelTbl->wCount = 0;
for (i = 0; i < n; i++) {
lpAccelTbl->tbl[i].type = *(lp++);
lpAccelTbl->tbl[i].wEvent = *((WORD *)lp);
lp += 2;
lpAccelTbl->tbl[i].wIDval = *((WORD *)lp);
lp += 2;
if (lpAccelTbl->tbl[i].wEvent == 0) break;
dprintf_accel(stddeb,
"Accelerator #%u / event=%04X id=%04X type=%02X \n",
i, lpAccelTbl->tbl[i].wEvent, lpAccelTbl->tbl[i].wIDval,
lpAccelTbl->tbl[i].type);
lpAccelTbl->wCount++;
}
GlobalUnlock16(hAccel);
FreeResource32(rsc_mem);
return hAccel;
#else
fprintf(stderr,"LoadAcceleratorsW: not implemented\n");
return 0x100; /* Return something anyway */
#endif
}
HACCEL32 LoadAccelerators32A(HINSTANCE32 instance,LPCSTR lpTableName)
{
LPWSTR uni;
HACCEL32 result;
if (HIWORD(lpTableName))
uni=STRING32_DupAnsiToUni(lpTableName);
else
uni=(LPWSTR)lpTableName;
result=LoadAccelerators32W(instance,uni);
if (HIWORD(uni))
free(uni);
return result;
}
/**********************************************************************
* TranslateAccelerator [USER.178]
*/
@ -351,14 +538,15 @@ int TranslateAccelerator(HWND hWnd, HANDLE hAccel, LPMSG16 msg)
GlobalUnlock16(hAccel);
return 0;
}
/**********************************************************************
* LoadString
* LoadString16
*/
int
LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
INT16
LoadString16(HINSTANCE16 instance,UINT16 resource_id,LPSTR buffer,INT16 buflen)
{
HANDLE hmem, hrsrc;
HGLOBAL16 hmem;
HRSRC16 hrsrc;
unsigned char *p;
int string_num;
int i;
@ -366,12 +554,12 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
dprintf_resource(stddeb,"LoadString: inst=%04x id=%04x buff=%08x len=%d\n",
instance, resource_id, (int) buffer, buflen);
hrsrc = FindResource( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING );
hrsrc = FindResource16( instance, (SEGPTR)((resource_id>>4)+1), RT_STRING );
if (!hrsrc) return 0;
hmem = LoadResource( instance, hrsrc );
hmem = LoadResource16( instance, hrsrc );
if (!hmem) return 0;
p = LockResource(hmem);
p = LockResource16(hmem);
string_num = resource_id & 0x000f;
for (i = 0; i < string_num; i++)
p += *p + 1;
@ -392,11 +580,73 @@ LoadString(HANDLE instance, WORD resource_id, LPSTR buffer, int buflen)
fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
}
FreeResource( hmem );
FreeResource16( hmem );
dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
return i;
}
/**********************************************************************
* LoadString32W (USER32.375)
*/
INT32
LoadString32W(HINSTANCE32 instance,UINT32 resource_id,LPWSTR buffer,int buflen)
{
HGLOBAL32 hmem;
HRSRC32 hrsrc;
WCHAR *p;
int string_num;
int i;
dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
"length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
hrsrc = FindResource32W( instance, (LPCWSTR)((resource_id>>4)+1),
(LPCWSTR)RT_STRING );
if (!hrsrc) return 0;
hmem = LoadResource32( instance, hrsrc );
if (!hmem) return 0;
p = LockResource32(hmem);
string_num = resource_id & 0x000f;
for (i = 0; i < string_num; i++)
p += *p + 1;
dprintf_resource( stddeb, "strlen = %d\n", (int)*p );
i = MIN(buflen - 1, *p);
if (buffer == NULL)
return i;
if (i > 0) {
memcpy(buffer, p + 1, i * sizeof (WCHAR));
buffer[i] = (WCHAR) 0;
} else {
if (buflen > 1) {
buffer[0] = (WCHAR) 0;
return 0;
}
#if 0
fprintf(stderr,"LoadString // I dont know why , but caller give buflen=%d *p=%d !\n", buflen, *p);
fprintf(stderr,"LoadString // and try to obtain string '%s'\n", p + 1);
#endif
}
#if 0
dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
#endif
return i;
}
/**********************************************************************
* LoadString32A (USER32.374)
*/
INT32
LoadString32A(HINSTANCE32 instance,UINT32 resource_id,LPSTR buffer,int buflen)
{
LPWSTR buffer2 = (LPWSTR)xmalloc(buflen*2);
INT32 retval = LoadString32W(instance,resource_id,buffer2,buflen);
STRING32_UniToAnsi(buffer,buffer2);
free(buffer2);
return retval;
}

View File

@ -38,19 +38,27 @@
#define STACK32_SIZE 0x10000
extern void USER_AppExit(HTASK, HINSTANCE, HQUEUE );
/* ------ Internal variables ------ */
static HTASK hFirstTask = 0;
static HTASK hCurrentTask = 0;
static HTASK hTaskToKill = 0;
static HTASK hLockedTask = 0;
/* Saved 16-bit stack for current process (Win16 only) */
WORD IF1632_Saved16_ss = 0;
WORD IF1632_Saved16_sp = 0;
/* Saved 32-bit stack for current process (Win16 only) */
DWORD IF1632_Saved32_esp = 0;
SEGPTR IF1632_Stack32_base = 0;
/* Original Unix stack */
DWORD IF1632_Original32_esp;
static HTASK16 hFirstTask = 0;
static HTASK16 hCurrentTask = 0;
static HTASK16 hTaskToKill = 0;
static HTASK16 hLockedTask = 0;
static WORD nTaskCount = 0;
static HANDLE hDOSEnvironment = 0;
/* ------ Internal declarations ------ */
/* TASK_Reschedule() 16-bit entry point */
static FARPROC TASK_RescheduleProc;
static FARPROC16 TASK_RescheduleProc;
#ifdef WINELIB
#define TASK_SCHEDULE() TASK_Reschedule();
@ -63,7 +71,7 @@ static HANDLE TASK_CreateDOSEnvironment(void);
/***********************************************************************
* TASK_Init
*/
BOOL TASK_Init(void)
BOOL32 TASK_Init(void)
{
TASK_RescheduleProc = MODULE_GetWndProcEntry16( "TASK_Reschedule" );
if (!(hDOSEnvironment = TASK_CreateDOSEnvironment()))
@ -196,9 +204,9 @@ static HANDLE TASK_CreateDOSEnvironment(void)
/***********************************************************************
* TASK_LinkTask
*/
static void TASK_LinkTask( HTASK hTask )
static void TASK_LinkTask( HTASK16 hTask )
{
HTASK *prevTask;
HTASK16 *prevTask;
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return;
@ -218,9 +226,9 @@ static void TASK_LinkTask( HTASK hTask )
/***********************************************************************
* TASK_UnlinkTask
*/
static void TASK_UnlinkTask( HTASK hTask )
static void TASK_UnlinkTask( HTASK16 hTask )
{
HTASK *prevTask;
HTASK16 *prevTask;
TDB *pTask;
prevTask = &hFirstTask;
@ -369,7 +377,7 @@ static void TASK_CallToStart(void)
cs_reg, ip_reg, ds_reg,
IF1632_Saved16_ss, IF1632_Saved16_sp);
CallTo16_regs_( (FARPROC)(cs_reg << 16 | ip_reg), ds_reg,
CallTo16_regs_( (FARPROC16)(cs_reg << 16 | ip_reg), ds_reg,
pTask->hPDB /*es*/, 0 /*bp*/, 0 /*ax*/,
pModule->stack_size /*bx*/, pModule->heap_size /*cx*/,
0 /*dx*/, 0 /*si*/, ds_reg /*di*/ );
@ -384,8 +392,9 @@ static void TASK_CallToStart(void)
/***********************************************************************
* TASK_CreateTask
*/
HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
HANDLE hEnvironment, char *cmdLine, WORD cmdShow )
HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance, HANDLE16 hEnvironment,
LPCSTR cmdLine, UINT16 cmdShow )
{
HTASK hTask;
TDB *pTask;
@ -394,10 +403,10 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
SEGTABLEENTRY *pSegTable;
LPSTR name;
char filename[256];
#ifndef WINELIB32
char *stack16Top, *stack32Top;
STACK16FRAME *frame16;
STACK32FRAME *frame32;
#ifndef WINELIB32
extern DWORD CALLTO16_RetAddr_word;
#endif
@ -466,17 +475,16 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
/* Fill the PDB */
pTask->pdb.int20 = 0x20cd;
#ifndef WINELIB
pTask->pdb.dispatcher[0] = 0x9a; /* ljmp */
#ifndef WINELIB
*(FARPROC16 *)&pTask->pdb.dispatcher[1] = MODULE_GetEntryPoint( GetModuleHandle("KERNEL"), 102 ); /* KERNEL.102 is DOS3Call() */
pTask->pdb.savedint22 = INT_GetHandler( 0x22 );
pTask->pdb.savedint23 = INT_GetHandler( 0x23 );
pTask->pdb.savedint24 = INT_GetHandler( 0x24 );
pTask->pdb.fileHandlesPtr = (SEGPTR)MAKELONG( 0x18,
GlobalHandleToSel(pTask->hPDB) );
#else
pTask->pdb.fileHandlesPtr = pTask->pdb.fileHandles;
#endif
pTask->pdb.fileHandlesPtr =
PTR_SEG_OFF_TO_SEGPTR( GlobalHandleToSel(pTask->hPDB),
(int)&((PDB *)0)->fileHandles );
memset( pTask->pdb.fileHandles, 0xff, sizeof(pTask->pdb.fileHandles) );
pTask->pdb.environment = hEnvironment;
pTask->pdb.nbFiles = 20;
@ -504,7 +512,6 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
/* Allocate the 32-bit stack */
#ifndef WINELIB
pTask->hStack32 = GLOBAL_Alloc( GMEM_FIXED, STACK32_SIZE, pTask->hPDB,
FALSE, FALSE, FALSE );
@ -520,8 +527,10 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
frame32->ecx = 0;
frame32->ebx = 0;
frame32->ebp = 0;
#ifndef WINELIB
frame32->retaddr = (DWORD)TASK_CallToStart;
frame32->codeselector = WINE_CODE_SELECTOR;
#endif
pTask->esp = (DWORD)frame32;
/* Create the 16-bit stack frame */
@ -531,15 +540,17 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
pSegTable[pModule->ss-1].minsize + pModule->stack_size) & ~1;
stack16Top = (char *)PTR_SEG_OFF_TO_LIN( pTask->ss, pTask->sp );
frame16 = (STACK16FRAME *)stack16Top - 1;
frame16->saved_ss = 0; /*pTask->ss;*/
frame16->saved_sp = 0; /*pTask->sp;*/
frame16->saved_ss = 0;
frame16->saved_sp = 0;
frame16->ds = frame16->es = pTask->hInstance;
frame16->entry_point = 0;
frame16->entry_ip = OFFSETOF(TASK_RescheduleProc) + 14;
frame16->entry_cs = SELECTOROF(TASK_RescheduleProc);
frame16->bp = 0;
#ifndef WINELIB
frame16->ip = LOWORD( CALLTO16_RetAddr_word );
frame16->cs = HIWORD( CALLTO16_RetAddr_word );
#endif /* WINELIB */
pTask->sp -= sizeof(STACK16FRAME);
/* If there's no 16-bit stack yet, use a part of the new task stack */
@ -554,6 +565,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
/* Add a breakpoint at the start of the task */
#ifndef WINELIB
if (Options.debug)
{
if (pModule->flags & NE_FFLAGS_WIN32)
@ -570,7 +582,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
DEBUG_AddBreakpoint( &addr );
}
}
#endif
#endif /* WINELIB */
/* Add the task to the linked list */
@ -626,7 +638,7 @@ static void TASK_DeleteTask( HTASK hTask )
* be killed when either TASK_Reschedule or this function is called again
* in the context of another task.
*/
void TASK_KillCurrentTask( int exitCode )
void TASK_KillCurrentTask( INT16 exitCode )
{
extern void EXEC_ExitWindows( int retCode );
@ -731,7 +743,6 @@ void TASK_Reschedule(void)
/* Save the stacks of the previous task (if any) */
#ifndef WINELIB /* FIXME: JBP: IF1632 not allowed in libwine.a */
if (pOldTask)
{
pOldTask->ss = IF1632_Saved16_ss;
@ -739,7 +750,6 @@ void TASK_Reschedule(void)
pOldTask->esp = IF1632_Saved32_esp;
}
else IF1632_Original32_esp = IF1632_Saved32_esp;
#endif
/* Make the task the last in the linked list (round-robin scheduling) */
@ -751,12 +761,10 @@ void TASK_Reschedule(void)
/* Switch to the new stack */
hCurrentTask = hTask;
#ifndef WINELIB /* FIXME: JBP: IF1632 not allowed in libwine.a */
IF1632_Saved16_ss = pNewTask->ss;
IF1632_Saved16_sp = pNewTask->sp;
IF1632_Saved32_esp = pNewTask->esp;
IF1632_Stack32_base = WIN16_GlobalLock16( pNewTask->hStack32 );
#endif
}
@ -965,7 +973,7 @@ FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
SEGPTR thunkaddr;
thunkaddr = TASK_AllocThunk( hCurrentTask );
if (!thunkaddr) return (FARPROC)0;
if (!thunkaddr) return (FARPROC16)0;
thunk = PTR_SEG_TO_LIN( thunkaddr );
dprintf_task( stddeb, "MakeProcInstance(%08lx,%04x): got thunk %08lx\n",
@ -976,7 +984,7 @@ FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
*thunk++ = (BYTE)(hInstance >> 8);
*thunk++ = 0xea; /* ljmp func */
*(DWORD *)thunk = (DWORD)func;
return (FARPROC)thunkaddr;
return (FARPROC16)thunkaddr;
#endif
}
@ -996,7 +1004,7 @@ void FreeProcInstance16( FARPROC16 func )
/**********************************************************************
* GetCodeHandle (KERNEL.93)
*/
HANDLE GetCodeHandle( FARPROC proc )
HANDLE GetCodeHandle( FARPROC16 proc )
{
#ifndef WINELIB32
HANDLE handle;
@ -1109,7 +1117,7 @@ int GetInstanceData( HANDLE instance, WORD buffer, int len )
char *ptr = (char *)GlobalLock16( instance );
if (!ptr || !len) return 0;
if ((int)buffer + len >= 0x10000) len = 0x10000 - buffer;
memcpy( ptr + buffer, (char *)GlobalLock16( CURRENT_DS ) + buffer, len );
memcpy( (char *)GlobalLock16(CURRENT_DS) + buffer, ptr + buffer, len );
return len;
}
@ -1178,11 +1186,11 @@ BOOL IsTask( HTASK hTask )
/***********************************************************************
* GetExePtr (KERNEL.133)
*/
HMODULE GetExePtr( HANDLE handle )
HMODULE16 GetExePtr( HANDLE16 handle )
{
char *ptr;
HTASK hTask;
HANDLE owner;
HTASK16 hTask;
HANDLE16 owner;
/* Check for module handle */

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = memory

View File

@ -46,6 +46,8 @@ typedef struct
static GLOBALARENA *pGlobalArena = NULL;
static int globalArenaSize = 0;
static DWORD globalDOSfree = 655350;
#define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */
#define GET_ARENA_PTR(handle) (pGlobalArena + ((handle) >> __AHSHIFT))
@ -550,11 +552,21 @@ BOOL16 GlobalUnWire( HGLOBAL16 handle )
/***********************************************************************
* GlobalDOSAlloc (KERNEL.184)
*
* Some programs rely on failure to allocate > 640K total with this function
*/
DWORD GlobalDOSAlloc( DWORD size )
{
WORD sel = GlobalAlloc16( GMEM_FIXED, size );
WORD sel;
if (size > globalDOSfree) return 0;
sel = GlobalAlloc16( GMEM_FIXED, size );
dprintf_global( stddeb, "GlobalDOSAlloc: %08lx -> returning %04x\n",
size, sel );
if (!sel) return 0;
globalDOSfree -= size;
return MAKELONG( sel, sel /* this one ought to be a real-mode segment */ );
}
@ -564,7 +576,12 @@ DWORD GlobalDOSAlloc( DWORD size )
*/
WORD GlobalDOSFree( WORD sel )
{
return GlobalFree16( GlobalHandle16(sel) ) ? sel : 0;
GLOBALARENA *pArena = GET_ARENA_PTR(sel);
if (!pArena) return sel;
globalDOSfree += pArena->size;
GlobalFree16( pArena->handle );
return 0;
}
@ -652,7 +669,7 @@ void GlobalUnfix( HGLOBAL16 handle )
/***********************************************************************
* FarSetOwner (KERNEL.403)
*/
void FarSetOwner( HANDLE16 handle, HANDLE16 hOwner )
void FarSetOwner( HGLOBAL16 handle, HANDLE16 hOwner )
{
GET_ARENA_PTR(handle)->hOwner = hOwner;
}
@ -661,7 +678,7 @@ void FarSetOwner( HANDLE16 handle, HANDLE16 hOwner )
/***********************************************************************
* FarGetOwner (KERNEL.404)
*/
HANDLE16 FarGetOwner( HANDLE16 handle )
HANDLE16 FarGetOwner( HGLOBAL16 handle )
{
return GET_ARENA_PTR(handle)->hOwner;
}

View File

@ -95,6 +95,7 @@ int LDT_GetEntry( int entry, ldt_entry *content )
content->seg_32bit = (ldt_flags_copy[entry] & LDT_FLAGS_32BIT) != 0;
content->read_only = (ldt_flags_copy[entry] & LDT_FLAGS_READONLY) !=0;
content->limit_in_pages = (ldt_flags_copy[entry] & LDT_FLAGS_BIG) !=0;
if (content->limit_in_pages) content->limit >>= 12;
return ret;
}
@ -134,7 +135,34 @@ int LDT_SetEntry( int entry, const ldt_entry *content )
ldt_info.contents = content->type;
ldt_info.read_exec_only = content->read_only != 0;
ldt_info.limit_in_pages = content->limit_in_pages != 0;
ret = modify_ldt(1, &ldt_info, sizeof(ldt_info));
/* Make sure the info will be accepted by the kernel */
/* This is ugly, but what can I do? */
if (content->type == SEGMENT_STACK)
{
/* FIXME */
}
else
{
if (ldt_info.base_addr >= 0xc0000000)
{
fprintf( stderr, "LDT_SetEntry: invalid base addr %08lx\n",
ldt_info.base_addr );
return -1;
}
if (content->limit_in_pages)
{
if ((ldt_info.limit << 12) + 0xfff >
0xc0000000 - ldt_info.base_addr)
ldt_info.limit = (0xc0000000 - 0xfff - ldt_info.base_addr) >> 12;
}
else
{
if (ldt_info.limit > 0xc0000000 - ldt_info.base_addr)
ldt_info.limit = 0xc0000000 - ldt_info.base_addr;
}
}
if ((ret = modify_ldt(1, &ldt_info, sizeof(ldt_info))) < 0)
perror( "modify_ldt" );
}
#endif /* linux */
@ -223,10 +251,9 @@ void LDT_Print( int start, int length )
flags[1] = (ldt_flags_copy[i] & LDT_FLAGS_READONLY) ? '-' : 'w';
flags[2] = '-';
}
printf("%04x: sel=%04x base=%08lx limit=%05lx %s %d-bit %c%c%c\n",
printf("%04x: sel=%04x base=%08lx limit=%08lx %d-bit %c%c%c\n",
i, ENTRY_TO_SELECTOR(i),
ldt_copy[i].base, ldt_copy[i].limit,
ldt_flags_copy[i] & LDT_FLAGS_BIG ? "(pages)" : "(bytes)",
ldt_flags_copy[i] & LDT_FLAGS_32BIT ? 32 : 16,
flags[0], flags[1], flags[2] );
}

View File

@ -26,10 +26,6 @@
#include "stddebug.h"
#include "debug.h"
#ifndef WINELIB
#pragma pack(1)
#endif
typedef struct
{
/* Arena header */
@ -61,6 +57,8 @@ typedef struct
BYTE lock; /* Lock count */
} LOCALHANDLEENTRY;
#pragma pack(1)
typedef struct
{
WORD check; /* 00 Heap checking flag */
@ -85,9 +83,7 @@ typedef struct
WORD magic; /* 28 Magic number */
} LOCALHEAPINFO;
#ifndef WINELIB
#pragma pack(4)
#endif
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */

View File

@ -82,7 +82,6 @@ WORD FreeSelector( WORD sel )
}
/* Clear the saved 16-bit selector */
#ifndef WINELIB
frame = CURRENT_STACK16;
while (frame)
{
@ -90,7 +89,6 @@ WORD FreeSelector( WORD sel )
if ((frame->es >= sel) && (frame->es < nextsel)) frame->es = 0;
frame = PTR_SEG_OFF_TO_LIN(frame->saved_ss, frame->saved_sp);
}
#endif
return 0;
}
@ -297,7 +295,9 @@ WORD SetSelectorLimit( WORD sel, DWORD limit )
{
ldt_entry entry;
LDT_GetEntry( SELECTOR_TO_ENTRY(sel), &entry );
entry.limit = limit;
entry.limit_in_pages = (limit >= 0x100000);
if (entry.limit_in_pages) entry.limit = limit >> 12;
else entry.limit = limit;
LDT_SetEntry( SELECTOR_TO_ENTRY(sel), &entry );
return sel;
}

View File

@ -357,25 +357,7 @@ VOID RtlFillMemory( LPVOID ptr, UINT32 len, UINT32 fill )
*/
VOID RtlMoveMemory( LPVOID dst, LPCVOID src, UINT32 len )
{
/* memcpy does not support overlapped copies, */
/* and memmove is not portable. */
if (((BYTE *)dst + len <= (BYTE *)src) ||
((BYTE *)src + len <= (BYTE *)dst))
{
memcpy( dst, src, len );
return;
}
/* do it the hard way (FIXME: could do better than this) */
if (dst < src)
{
while (len--) *((BYTE *)dst)++ = *((BYTE *)src)++;
}
else
{
dst = (BYTE *)dst + len - 1;
src = (BYTE *)src + len - 1;
while (len--) *((BYTE *)dst)-- = *((BYTE *)src)--;
}
memmove( dst, src, len );
}

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = misc

View File

@ -38,11 +38,11 @@ static BOOL FileDlg_Init()
static BOOL initialized = 0;
if (!initialized) {
if (!hFolder) hFolder = LoadBitmap(0, MAKEINTRESOURCE(OBM_FOLDER));
if (!hFolder2) hFolder2 = LoadBitmap(0, MAKEINTRESOURCE(OBM_FOLDER2));
if (!hFloppy) hFloppy = LoadBitmap(0, MAKEINTRESOURCE(OBM_FLOPPY));
if (!hHDisk) hHDisk = LoadBitmap(0, MAKEINTRESOURCE(OBM_HDISK));
if (!hCDRom) hCDRom = LoadBitmap(0, MAKEINTRESOURCE(OBM_CDROM));
if (!hFolder) hFolder = LoadBitmap16(0, MAKEINTRESOURCE(OBM_FOLDER));
if (!hFolder2) hFolder2 = LoadBitmap16(0, MAKEINTRESOURCE(OBM_FOLDER2));
if (!hFloppy) hFloppy = LoadBitmap16(0, MAKEINTRESOURCE(OBM_FLOPPY));
if (!hHDisk) hHDisk = LoadBitmap16(0, MAKEINTRESOURCE(OBM_HDISK));
if (!hCDRom) hCDRom = LoadBitmap16(0, MAKEINTRESOURCE(OBM_CDROM));
if (hFolder == 0 || hFolder2 == 0 || hFloppy == 0 ||
hHDisk == 0 || hCDRom == 0)
{
@ -68,13 +68,13 @@ BOOL GetOpenFileName(LPOPENFILENAME lpofn)
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE) hDlgTmpl = lpofn->hInstance;
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG)))
if (!(hResInfo = FindResource16(lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpofn->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_OPEN_FILE );
if (!hDlgTmpl)
@ -90,7 +90,7 @@ BOOL GetOpenFileName(LPOPENFILENAME lpofn)
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
@ -115,13 +115,13 @@ BOOL GetSaveFileName(LPOPENFILENAME lpofn)
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
hInst = lpofn->hInstance;
if (!(hResInfo = FindResource( lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG )))
if (!(hResInfo = FindResource16(lpofn->hInstance,
lpofn->lpTemplateName, RT_DIALOG )))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpofn->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpofn->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_SAVE_FILE );
@ -131,7 +131,7 @@ BOOL GetSaveFileName(LPOPENFILENAME lpofn)
(DWORD)lpofn);
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
@ -375,7 +375,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
SetDlgItemText32A( hWnd, edt1, tmpstr );
/* get drive list */
*tmpstr = 0;
DlgDirListComboBox16(hWnd, tmpstr, cmb2, 0, 0xC000);
DlgDirListComboBox16(hWnd, (LPSTR)MAKE_SEGPTR(tmpstr), cmb2, 0, 0xC000);
/* read initial directory */
if (PTR_SEG_TO_LIN(lpofn->lpstrInitialDir) != NULL)
{
@ -1101,13 +1101,13 @@ BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
if (lpChCol->Flags & CC_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChCol->hInstance;
else if (lpChCol->Flags & CC_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpChCol->hInstance,
lpChCol->lpTemplateName, RT_DIALOG)))
if (!(hResInfo = FindResource16(lpChCol->hInstance,
lpChCol->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpChCol->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpChCol->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_COLOR );
if (!hDlgTmpl)
@ -1121,7 +1121,7 @@ BOOL ChooseColor(LPCHOOSECOLOR lpChCol)
(DWORD)lpChCol );
if (!(lpChCol->Flags & CC_ENABLETEMPLATEHANDLE))
{
if (lpChCol->Flags & CC_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpChCol->Flags & CC_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
return bRet;
@ -1576,7 +1576,7 @@ static void CC_PrepareColorGraph(HWND hDlg)
HBRUSH hbrush;
HDC hdc ;
RECT16 rect,client;
HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT));
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
GetClientRect16(hwnd,&client);
hdc=GetDC(hwnd);
@ -2182,13 +2182,13 @@ BOOL ChooseFont(LPCHOOSEFONT lpChFont)
if (lpChFont->Flags & CF_ENABLETEMPLATEHANDLE) hDlgTmpl = lpChFont->hInstance;
else if (lpChFont->Flags & CF_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource( lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
if (!(hResInfo = FindResource16(lpChFont->hInstance,
lpChFont->lpTemplateName, RT_DIALOG)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
hDlgTmpl = LoadResource( lpChFont->hInstance, hResInfo );
hDlgTmpl = LoadResource16( lpChFont->hInstance, hResInfo );
}
else hDlgTmpl = SYSRES_LoadResource( SYSRES_DIALOG_CHOOSE_FONT );
if (!hDlgTmpl)
@ -2202,7 +2202,7 @@ BOOL ChooseFont(LPCHOOSEFONT lpChFont)
(DWORD)lpChFont );
if (!(lpChFont->Flags & CF_ENABLETEMPLATEHANDLE))
{
if (lpChFont->Flags & CF_ENABLETEMPLATE) FreeResource( hDlgTmpl );
if (lpChFont->Flags & CF_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
return bRet;
@ -2381,9 +2381,9 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
HDC hdc;
int i,j,res,init=0;
long l;
FARPROC enumCallback = MODULE_GetWndProcEntry16("FontFamilyEnumProc");
FARPROC16 enumCallback = MODULE_GetWndProcEntry16("FontFamilyEnumProc");
LPLOGFONT16 lpxx;
HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT));
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
LPCHOOSEFONT lpcf;
SetWindowLong32A(hDlg, DWL_USER, lParam);
@ -2398,7 +2398,7 @@ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
if (!hBitmapTT)
hBitmapTT = LoadBitmap(0, MAKEINTRESOURCE(OBM_TRTYPE));
hBitmapTT = LoadBitmap16(0, MAKEINTRESOURCE(OBM_TRTYPE));
if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner))
ShowWindow(GetDlgItem(hDlg,pshHelp),SW_HIDE);
@ -2495,7 +2495,7 @@ LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam)
BITMAP16 bm;
LPMEASUREITEMSTRUCT16 lpmi=PTR_SEG_TO_LIN((LPMEASUREITEMSTRUCT16)lParam);
if (!hBitmapTT)
hBitmapTT = LoadBitmap(0, MAKEINTRESOURCE(OBM_TRTYPE));
hBitmapTT = LoadBitmap16(0, MAKEINTRESOURCE(OBM_TRTYPE));
GetObject16( hBitmapTT, sizeof(bm), &bm );
lpmi->itemHeight=bm.bmHeight;
/* FIXME: use MAX of bm.bmHeight and tm.tmHeight .*/
@ -2615,7 +2615,7 @@ LRESULT CFn_WMCtlColor(HWND hDlg, WPARAM wParam, LPARAM lParam)
LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
char buffer[200];
FARPROC enumCallback;
FARPROC16 enumCallback;
HFONT hFont/*,hFontOld*/;
int i,j;
long l;
@ -2636,7 +2636,7 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
i=SendDlgItemMessage16(hDlg,cmb1,CB_GETCURSEL,0,0);
if (i!=CB_ERR)
{
HCURSOR hcursor=SetCursor(LoadCursor(0,IDC_WAIT));
HCURSOR hcursor=SetCursor(LoadCursor16(0,IDC_WAIT));
SendDlgItemMessage16(hDlg,cmb1,CB_GETLBTEXT,i,(LPARAM)MAKE_SEGPTR(buffer));
dprintf_commdlg(stddeb,"WM_COMMAND/cmb1 =>%s\n",buffer);
enumCallback = MODULE_GetWndProcEntry16("FontStyleEnumProc");

View File

@ -195,7 +195,7 @@ LRESULT CloseDriver(HDRVR16 hDrvr, LPARAM lParam1, LPARAM lParam2)
HMODULE16 GetDriverModuleHandle(HDRVR16 hDrvr)
{
LPDRIVERITEM lpdrv;
HMODULE hModule = 0;
HMODULE16 hModule = 0;
dprintf_driver( stddeb, "GetDriverModuleHandle(%04x);\n", hDrvr);

View File

@ -111,7 +111,8 @@ struct options Options =
#else
LANG_En,
#endif
FALSE /* Managed windows */
FALSE, /* Managed windows */
FALSE /* Perfect graphics */
};
@ -125,6 +126,7 @@ static XrmOptionDescRec optionsTable[] =
{ "-ipc", ".ipc", XrmoptionNoArg, (caddr_t)"off"},
{ "-language", ".language", XrmoptionSepArg, (caddr_t)"En" },
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-perfect", ".perfect", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
@ -158,6 +160,7 @@ static XrmOptionDescRec optionsTable[] =
" -managed Allow the window manager to manage created windows\n" \
" -mode mode Start Wine in a particular mode (standard or enhanced)\n" \
" -name name Set the application name\n" \
" -perfect Favor correctness over speed for graphical operations\n" \
" -privatemap Use a private color map\n" \
" -synchronous Turn on synchronous display mode\n" \
" -winver Version to imitate (one of win31,win95,nt351)\n"
@ -407,6 +410,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.allowReadOnly = TRUE;
if (MAIN_GetResource( db, ".ipc", &value ))
Options.ipc = TRUE;
if (MAIN_GetResource( db, ".perfect", &value ))
Options.perfectGraphics = TRUE;
if (MAIN_GetResource( db, ".depth", &value))
screenDepth = atoi( value.addr );
if (MAIN_GetResource( db, ".desktop", &value))
@ -615,6 +620,13 @@ int main( int argc, char *argv[] )
MAIN_ParseOptions( &argc, argv );
if (Options.desktopGeometry && Options.managed)
{
fprintf( stderr, "%s: -managed and -desktop options cannot be used together\n",
Options.programName );
exit(1);
}
screen = DefaultScreenOfDisplay( display );
screenWidth = WidthOfScreen( screen );
screenHeight = HeightOfScreen( screen );
@ -1175,7 +1187,7 @@ BOOL SwapMouseButton(BOOL fSwap)
/***********************************************************************
* FileCDR (KERNEL.130)
*/
void FileCDR(FARPROC x)
void FileCDR(FARPROC16 x)
{
printf("FileCDR(%8x)\n", (int) x);
}

View File

@ -1,8 +1,14 @@
/*
* Misc. functions for systems that don't have them
*
* Copyright 1996 Alexandre Julliard
*/
#include "config.h"
#include <sys/types.h>
#include <sys/time.h>
#ifndef HAVE_USLEEP
unsigned int usleep (unsigned int useconds)
{
struct timeval delay;
@ -13,8 +19,28 @@ unsigned int usleep (unsigned int useconds)
select( 0, 0, 0, 0, &delay );
return 0;
}
#endif /* HAVE_USLEEP */
#ifndef HAVE_MEMMOVE
void *memmove( void *dst, const void *src, unsigned int len )
{
/* Use memcpy if not overlapping */
if (((char *)dst + len <= (char *)src) ||
((char *)src + len <= (char *)dst))
{
memcpy( dst, src, len );
}
/* Otherwise do it the hard way (FIXME: could do better than this) */
else if (dst < src)
{
while (len--) *((char *)dst)++ = *((char *)src)++;
}
else
{
dst = (char *)dst + len - 1;
src = (char *)src + len - 1;
while (len--) *((char *)dst)-- = *((char *)src)--;
}
return dst;
}
#endif /* HAVE_MEMMOVE */

View File

@ -359,7 +359,7 @@ INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon)
else *AppMisc = 0;
AppMisc[sizeof(AppMisc)-1]=0;
if (!hIcon) hIcon = LoadIcon(0,MAKEINTRESOURCE(OIC_WINEICON));
if (!hIcon) hIcon = LoadIcon16(0,MAKEINTRESOURCE(OIC_WINEICON));
handle = SYSRES_LoadResource( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX );
if (!handle) return FALSE;
bRet = DialogBoxIndirectParam16( WIN_GetWindowInstance( hWnd ),
@ -552,9 +552,9 @@ HICON ExtractIcon(HINSTANCE hInstance, LPCSTR lpszExeFileName, WORD nIconIndex)
* Return icon for given file (either from file itself or from associated
* executable) and patch parameters if needed.
*/
HICON ExtractAssociatedIcon(HINSTANCE hInst,LPSTR lpIconPath, LPWORD lpiIcon)
HICON16 ExtractAssociatedIcon(HINSTANCE16 hInst,LPSTR lpIconPath,LPWORD lpiIcon)
{
HICON hIcon = ExtractIcon(hInst, lpIconPath, *lpiIcon);
HICON16 hIcon = ExtractIcon(hInst, lpIconPath, *lpiIcon);
if( hIcon < 2 )
{
@ -580,7 +580,7 @@ HICON ExtractAssociatedIcon(HINSTANCE hInst,LPSTR lpIconPath, LPWORD lpiIcon)
*lpiIcon = 6; /* generic icon - found nothing */
GetModuleFileName(hInst, lpIconPath, 0x80);
hIcon = LoadIcon( hInst, MAKEINTRESOURCE(*lpiIcon));
hIcon = LoadIcon16( hInst, MAKEINTRESOURCE(*lpiIcon));
}
return hIcon;

View File

@ -23,7 +23,7 @@
static struct notify
{
HTASK htask;
FARPROC lpfnCallback;
FARPROC16 lpfnCallback;
WORD wFlags;
} *notifys = NULL;

View File

@ -37,7 +37,7 @@
static WORD wsa_errno;
static int wsa_initted;
static key_t wine_key = 0;
static FARPROC BlockFunction;
static FARPROC16 BlockFunction;
static fd_set fd_in_use;
extern int h_errno;
@ -1423,7 +1423,7 @@ BOOL WSAIsBlocking(void)
return 0;
}
FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc)
{
dprintf_winsock(stddeb, "WSA_SetBlockHook %8lx, STUB!\n", (unsigned long) lpBlockFunc);
@ -1434,7 +1434,7 @@ FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
BlockFunction = lpBlockFunc;
return (FARPROC) lpBlockFunc;
return (FARPROC16) lpBlockFunc;
}
INT WSAUnhookBlockingHook(void)

View File

@ -254,7 +254,8 @@ INT16 wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec, LPCVOID args )
break;
case WPR_WSTRING: /* No Unicode in Win16 */
case WPR_STRING:
cur_arg = (DWORD)PTR_SEG_TO_LIN( *(SEGPTR *)args );
if (IsBadReadPtr( *(SEGPTR *)args, 1 )) cur_arg = (DWORD)"";
else cur_arg = (DWORD)PTR_SEG_TO_LIN( *(SEGPTR *)args );
args = (SEGPTR *)args + 1;
break;
case WPR_HEXA:
@ -498,16 +499,14 @@ INT16 wsprintf16( LPSTR buffer, LPCSTR spec, ... )
}
/* Emulator version */
#ifndef WINELIB
INT16 WIN16_wsprintf16(void)
{
SEGPTR *win_stack = (DWORD *)CURRENT_STACK16->args;
SEGPTR *win_stack = (SEGPTR *)CURRENT_STACK16->args;
LPSTR buffer = (LPSTR)PTR_SEG_TO_LIN(win_stack[0]);
LPCSTR spec = (LPCSTR)PTR_SEG_TO_LIN(win_stack[1]);
return wvsprintf16( buffer, spec, &win_stack[2] );
}
#endif /* WINELIB */
/***********************************************************************

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = miscemu

View File

@ -6,9 +6,9 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "heap.h"
#include "ldt.h"
#include "module.h"
#include "miscemu.h"
@ -68,6 +68,19 @@ void INT_Int31Handler( SIGCONTEXT *context )
AX_reg(context) = 0x8022; /* invalid selector */
SET_CFLAG(context);
}
else
{
/* If a segment register contains the selector being freed, */
/* set it to zero. */
if (!((DS_reg(context)^BX_reg(context)) & ~3)) DS_reg(context) = 0;
if (!((ES_reg(context)^BX_reg(context)) & ~3)) ES_reg(context) = 0;
#ifdef FS_reg
if (!((FS_reg(context)^BX_reg(context)) & ~3)) FS_reg(context) = 0;
#endif
#ifdef GS_reg
if (!((GS_reg(context)^BX_reg(context)) & ~3)) GS_reg(context) = 0;
#endif
}
break;
case 0x0002: /* Real mode segment to descriptor */
@ -135,6 +148,7 @@ void INT_Int31Handler( SIGCONTEXT *context )
case 0x0009: /* Set selector access rights */
SelectorAccessRights( BX_reg(context), 1, CX_reg(context) );
break;
case 0x000a: /* Allocate selector alias */
if (!(AX_reg(context) = AllocCStoDSAlias( BX_reg(context) )))
@ -199,8 +213,9 @@ void INT_Int31Handler( SIGCONTEXT *context )
if ((BL_reg(context) == 0x2f) && ((p->eax & 0xFF00) == 0x1500))
{
do_mscdex( context );
break;
}
else SET_CFLAG(context);
SET_CFLAG(context);
}
break;
@ -242,8 +257,8 @@ void INT_Int31Handler( SIGCONTEXT *context )
break;
case 0x0501: /* Allocate memory block */
if (!(ptr = (BYTE *)malloc( MAKELONG( CX_reg(context),
BX_reg(context) ) )))
if (!(ptr = (BYTE *)HeapAlloc( SystemHeap, 0,MAKELONG( CX_reg(context),
BX_reg(context) ))))
{
AX_reg(context) = 0x8012; /* linear memory not available */
SET_CFLAG(context);
@ -256,12 +271,14 @@ void INT_Int31Handler( SIGCONTEXT *context )
break;
case 0x0502: /* Free memory block */
free( (void *)MAKELONG( DI_reg(context), SI_reg(context) ) );
HeapFree( SystemHeap, 0,
(void *)MAKELONG( DI_reg(context), SI_reg(context) ) );
break;
case 0x0503: /* Resize memory block */
if (!(ptr = (BYTE *)realloc( (void *)MAKELONG(DI_reg(context),SI_reg(context)),
MAKELONG(CX_reg(context),BX_reg(context)))))
if (!(ptr = (BYTE *)HeapReAlloc( SystemHeap, 0,
(void *)MAKELONG(DI_reg(context),SI_reg(context)),
MAKELONG(CX_reg(context),BX_reg(context)))))
{
AX_reg(context) = 0x8012; /* linear memory not available */
SET_CFLAG(context);

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = multimedia

View File

@ -27,7 +27,7 @@ static MMTIME mmSysTimeSMPTE;
typedef struct tagTIMERENTRY {
WORD wDelay;
WORD wResol;
FARPROC lpFunc;
FARPROC16 lpFunc;
HINSTANCE hInstance;
DWORD dwUser;
WORD wFlags;
@ -52,7 +52,7 @@ static VOID TIME_MMSysTimeCallback( HWND32 hwnd, UINT32 msg,
lpTimer->wCurTime--;
if (lpTimer->wCurTime == 0) {
lpTimer->wCurTime = lpTimer->wDelay;
if (lpTimer->lpFunc != (FARPROC) NULL) {
if (lpTimer->lpFunc != (FARPROC16) NULL) {
dprintf_mmtime(stddeb, "MMSysTimeCallback // before CallBack16 !\n");
dprintf_mmtime(stddeb, "MMSysTimeCallback // lpFunc=%p wTimerID=%04X dwUser=%08lX !\n",
lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser);
@ -151,7 +151,7 @@ WORD timeSetEvent(WORD wDelay, WORD wResol, LPTIMECALLBACK lpFunc,
lpNewTimer->wCurTime = wDelay;
lpNewTimer->wDelay = wDelay;
lpNewTimer->wResol = wResol;
lpNewTimer->lpFunc = (FARPROC) lpFunc;
lpNewTimer->lpFunc = (FARPROC16) lpFunc;
lpNewTimer->hInstance = GetTaskDS();
dprintf_mmtime(stddeb, "timeSetEvent // hInstance=%04X !\n", lpNewTimer->hInstance);
dprintf_mmtime(stddeb, "timeSetEvent // PTR_SEG_TO_LIN(lpFunc)=%p !\n",

View File

@ -1,3 +1,4 @@
DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = objects

View File

@ -1106,15 +1106,25 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
case DSTINVERT: /* 0x55 */
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel ||
!Options.perfectGraphics)
{
XSetFunction( display, dcDst->u.x.gc, GXinvert );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
}
break;
case PATINVERT: /* 0x5a */
/* FIXME: This is not really correct, but for now PATINVERT is */
/* used to draw the window moving frame, so it has to be fast. */
if (Options.perfectGraphics) break;
if (!DC_SetupGCForBrush( dcDst )) return TRUE;
XSetFunction( display, dcDst->u.x.gc, GXxor );
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
case SRCCOPY: /* 0xcc */
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{
@ -1155,8 +1165,8 @@ BOOL BITBLT_InternalStretchBlt( DC *dcDst, short xDst, short yDst,
else
{
XSetFunction( display, dcDst->u.x.gc, GXcopy );
XSetForeground( display, dcDst->u.x.gc,
COLOR_PaletteToPixel[COLOR_ColormapSize-1] );
XSetForeground( display, dcDst->u.x.gc,
COLOR_PaletteToPixel[COLOR_GetSystemPaletteSize() - 1]);
XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
}
XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,

View File

@ -12,6 +12,8 @@
#include "callback.h"
#include "dc.h"
#include "bitmap.h"
#include "heap.h"
#include "string32.h"
#include "stddebug.h"
#include "debug.h"
@ -227,24 +229,24 @@ LONG SetBitmapBits( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
/**********************************************************************
* LoadBitmap (USER.175)
* LoadBitmap16 (USER.175)
*/
HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
HBITMAP16 LoadBitmap16( HINSTANCE16 instance, SEGPTR name )
{
HBITMAP hbitmap = 0;
HBITMAP16 hbitmap = 0;
HDC hdc;
HRSRC hRsrc;
HGLOBAL handle;
HRSRC16 hRsrc;
HGLOBAL16 handle;
BITMAPINFO *info;
if (HIWORD(name))
{
char *str = (char *)PTR_SEG_TO_LIN( name );
dprintf_bitmap( stddeb, "LoadBitmap(%04x,'%s')\n", instance, str );
dprintf_bitmap( stddeb, "LoadBitmap16(%04x,'%s')\n", instance, str );
if (str[0] == '#') name = (SEGPTR)(DWORD)(WORD)atoi( str + 1 );
}
else
dprintf_bitmap( stddeb, "LoadBitmap(%04x,%04x)\n",
dprintf_bitmap( stddeb, "LoadBitmap16(%04x,%04x)\n",
instance, LOWORD(name) );
if (!instance) /* OEM bitmap */
@ -253,10 +255,10 @@ HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
return OBM_LoadBitmap( LOWORD((int)name) );
}
if (!(hRsrc = FindResource( instance, name, RT_BITMAP ))) return 0;
if (!(handle = LoadResource( instance, hRsrc ))) return 0;
if (!(hRsrc = FindResource16( instance, name, RT_BITMAP ))) return 0;
if (!(handle = LoadResource16( instance, hRsrc ))) return 0;
info = (BITMAPINFO *)LockResource( handle );
info = (BITMAPINFO *)LockResource16( handle );
if ((hdc = GetDC(0)) != 0)
{
char *bits = (char *)info + DIB_BitmapInfoSize( info, DIB_RGB_COLORS );
@ -264,10 +266,59 @@ HBITMAP LoadBitmap( HANDLE instance, SEGPTR name )
bits, info, DIB_RGB_COLORS );
ReleaseDC( 0, hdc );
}
FreeResource( handle );
FreeResource16( handle );
return hbitmap;
}
/**********************************************************************
* LoadBitmap32W (USER32.357)
*/
HBITMAP32 LoadBitmap32W( HINSTANCE32 instance, LPCWSTR name )
{
HBITMAP32 hbitmap = 0;
HDC hdc;
HRSRC32 hRsrc;
HGLOBAL32 handle;
BITMAPINFO *info;
if (!instance) /* OEM bitmap */
{
if (HIWORD((int)name)) return 0;
return OBM_LoadBitmap( LOWORD((int)name) );
}
if (!(hRsrc = FindResource32W( instance, name,
(LPWSTR)RT_BITMAP ))) return 0;
if (!(handle = LoadResource32( instance, hRsrc ))) return 0;
info = (BITMAPINFO *)LockResource32( handle );
if ((hdc = GetDC(0)) != 0)
{
char *bits = (char *)info + DIB_BitmapInfoSize( info, DIB_RGB_COLORS );
hbitmap = CreateDIBitmap( hdc, &info->bmiHeader, CBM_INIT,
bits, info, DIB_RGB_COLORS );
ReleaseDC( 0, hdc );
}
return hbitmap;
}
/**********************************************************************
* LoadBitmap32A (USER32.356)
*/
HBITMAP32 LoadBitmap32A( HINSTANCE32 instance, LPCSTR name )
{
HBITMAP32 res;
if (!HIWORD(name)) res = LoadBitmap32W(instance,(LPWSTR)name);
else
{
LPWSTR uni = STRING32_DupAnsiToUni(name);
res = LoadBitmap32W(instance,uni);
free(uni);
}
return res;
}
/***********************************************************************
* BITMAP_DeleteObject

File diff suppressed because it is too large Load Diff

View File

@ -198,20 +198,20 @@ static CURSORDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir,
* Load the icon/cursor directory for a given resource name and find the
* best matching entry.
*/
static BOOL CURSORICON_LoadDirEntry(HANDLE hInstance, SEGPTR name,
static BOOL CURSORICON_LoadDirEntry(HINSTANCE32 hInstance, SEGPTR name,
int width, int height, int colors,
BOOL fCursor, CURSORICONDIRENTRY *dirEntry)
{
HRSRC hRsrc;
HANDLE hMem;
HRSRC16 hRsrc;
HGLOBAL16 hMem;
CURSORICONDIR *dir;
CURSORICONDIRENTRY *entry = NULL;
if (!(hRsrc = FindResource( hInstance, name,
if (!(hRsrc = FindResource16( hInstance, name,
fCursor ? RT_GROUP_CURSOR : RT_GROUP_ICON )))
return FALSE;
if (!(hMem = LoadResource( hInstance, hRsrc ))) return FALSE;
if ((dir = (CURSORICONDIR *)LockResource( hMem )))
if (!(hMem = LoadResource16( hInstance, hRsrc ))) return FALSE;
if ((dir = (CURSORICONDIR *)LockResource16( hMem )))
{
if (fCursor)
entry = (CURSORICONDIRENTRY *)CURSORICON_FindBestCursor( dir,
@ -221,7 +221,7 @@ static BOOL CURSORICON_LoadDirEntry(HANDLE hInstance, SEGPTR name,
width, height, colors );
if (entry) *dirEntry = *entry;
}
FreeResource( hMem );
FreeResource16( hMem );
return (entry != NULL);
}
@ -245,11 +245,11 @@ HANDLE CURSORICON_LoadHandler( HANDLE handle, HINSTANCE hInstance,
if (fCursor) /* If cursor, get the hotspot */
{
POINT16 *pt = (POINT16 *)LockResource( handle );
POINT16 *pt = (POINT16 *)LockResource16( handle );
hotspot = *pt;
bmi = (BITMAPINFO *)(pt + 1);
}
else bmi = (BITMAPINFO *)LockResource( handle );
else bmi = (BITMAPINFO *)LockResource16( handle );
/* Create a copy of the bitmap header */
@ -391,13 +391,13 @@ static HANDLE CURSORICON_Load( HANDLE hInstance, SEGPTR name, int width,
/* Load the resource */
if (!(hRsrc = FindResource( hInstance,
if (!(hRsrc = FindResource16( hInstance,
MAKEINTRESOURCE( dirEntry.icon.wResId ),
fCursor ? RT_CURSOR : RT_ICON ))) return 0;
if (!(handle = LoadResource( hInstance, hRsrc ))) return 0;
if (!(handle = LoadResource16( hInstance, hRsrc ))) return 0;
hRet = CURSORICON_LoadHandler( handle, hInstance, fCursor );
FreeResource(handle);
FreeResource16(handle);
return hRet;
}
@ -463,13 +463,13 @@ HCURSOR CURSORICON_IconToCursor(HICON hIcon)
/***********************************************************************
* LoadCursor (USER.173)
*/
HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name )
HCURSOR16 LoadCursor16( HINSTANCE16 hInstance, SEGPTR name )
{
if (HIWORD(name))
dprintf_cursor( stddeb, "LoadCursor: %04x '%s'\n",
dprintf_cursor( stddeb, "LoadCursor16: %04x '%s'\n",
hInstance, (char *)PTR_SEG_TO_LIN( name ) );
else
dprintf_cursor( stddeb, "LoadCursor: %04x %04x\n",
dprintf_cursor( stddeb, "LoadCursor16: %04x %04x\n",
hInstance, LOWORD(name) );
return CURSORICON_Load( hInstance, name,
@ -480,7 +480,7 @@ HCURSOR LoadCursor( HANDLE hInstance, SEGPTR name )
/***********************************************************************
* LoadIcon (USER.174)
*/
HICON LoadIcon( HANDLE hInstance, SEGPTR name )
HICON16 LoadIcon16(HINSTANCE16 hInstance,SEGPTR name)
{
if (HIWORD(name))
dprintf_icon( stddeb, "LoadIcon: %04x '%s'\n",
@ -935,7 +935,7 @@ void GetClipCursor32( RECT32 *rect )
*/
WORD GetIconID( HANDLE hResource, DWORD resType )
{
CURSORICONDIR *lpDir = LockResource(hResource);
CURSORICONDIR *lpDir = LockResource16(hResource);
if (!lpDir || lpDir->idReserved ||
((lpDir->idType != 1) && (lpDir->idType != 2)))

View File

@ -334,8 +334,8 @@ BOOL DC_SetupGCForText( DC * dc )
*/
BOOL DC_CallHookProc(DC* dc, WORD code, LPARAM lParam)
{
BOOL bRet = 0;
FARPROC ptr = GDI_GetDefDCHook();
BOOL bRet = FALSE;
FARPROC16 ptr = GDI_GetDefDCHook();
dprintf_dc(stddeb,"CallDCHook: code %04x\n", code);
@ -379,8 +379,6 @@ HDC GetDCState( HDC hdc )
newdc->w.hClipRgn = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( newdc->w.hClipRgn, dc->w.hClipRgn, 0, RGN_COPY );
}
COLOR_SetMapping( newdc, dc->u.x.pal.hMapping,
dc->u.x.pal.hRevMapping, dc->u.x.pal.mappingSize );
return handle;
}
@ -421,8 +419,6 @@ void SetDCState( HDC hdc, HDC hdcs )
SelectObject( hdc, dcs->w.hBrush );
SelectObject( hdc, dcs->w.hFont );
COLOR_SetMapping( dc, dcs->u.x.pal.hMapping,
dcs->u.x.pal.hRevMapping, dcs->u.x.pal.mappingSize );
}

View File

@ -430,22 +430,56 @@ HFONT32 CreateFontIndirect32W( const LOGFONT32W *font )
/***********************************************************************
* CreateFont (GDI.56)
* CreateFont16 (GDI.56)
*/
HFONT CreateFont( INT height, INT width, INT esc, INT orient, INT weight,
BYTE italic, BYTE underline, BYTE strikeout, BYTE charset,
BYTE outpres, BYTE clippres, BYTE quality, BYTE pitch,
LPCSTR name )
HFONT16 CreateFont16( INT16 height, INT16 width, INT16 esc, INT16 orient,
INT16 weight, BYTE italic, BYTE underline,
BYTE strikeout, BYTE charset, BYTE outpres,
BYTE clippres, BYTE quality, BYTE pitch, LPCSTR name )
{
LOGFONT16 logfont = {height, width, esc, orient, weight, italic, underline,
strikeout, charset, outpres, clippres, quality, pitch, };
dprintf_font(stddeb,"CreateFont(%d,%d)\n", height, width);
dprintf_font(stddeb,"CreateFont16(%d,%d)\n", height, width);
if (name) lstrcpyn32A(logfont.lfFaceName,name,sizeof(logfont.lfFaceName));
else logfont.lfFaceName[0] = '\0';
return CreateFontIndirect16( &logfont );
}
/*************************************************************************
* CreateFont32A (GDI32.43)
*/
HFONT32 CreateFont32A( INT32 height, INT32 width, INT32 esc, INT32 orient,
INT32 weight, DWORD italic, DWORD underline,
DWORD strikeout, DWORD charset, DWORD outpres,
DWORD clippres, DWORD quality, DWORD pitch, LPCSTR name)
{
return (HFONT32)CreateFont16( height, width, esc, orient, weight, italic,
underline, strikeout, charset, outpres,
clippres, quality, pitch, name );
}
/*************************************************************************
* CreateFont32W (GDI32.46)
*/
HFONT32 CreateFont32W( INT32 height, INT32 width, INT32 esc, INT32 orient,
INT32 weight, DWORD italic, DWORD underline,
DWORD strikeout, DWORD charset, DWORD outpres,
DWORD clippres, DWORD quality, DWORD pitch,
LPCWSTR name )
{
LPSTR namea = name ? STRING32_DupUniToAnsi(name) : NULL;
HFONT32 ret = (HFONT32)CreateFont16( height, width, esc, orient, weight,
italic, underline, strikeout, charset,
outpres, clippres, quality, pitch,
namea );
free(namea);
return ret;
}
/***********************************************************************
* FONT_GetObject
*/
@ -483,7 +517,7 @@ HFONT FONT_SelectObject( DC * dc, HFONT hfont, FONTOBJ * font )
{
HFONT hnewfont;
hnewfont = CreateFont(10, 7, 0, 0, FW_DONTCARE,
hnewfont = CreateFont16(10, 7, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE, "*" );
font = (FONTOBJ *) GDI_HEAP_LIN_ADDR( hnewfont );

View File

@ -27,10 +27,6 @@ WORD GDI_HeapSel = 0;
#define OBJ_PEN 1
#define OBJ_BRUSH 2
#define MAX_OBJ 1024
HANDLE *lpPenBrushList = NULL;
/***********************************************************************
* GDI stock objects
*/
@ -277,7 +273,7 @@ BOOL DeleteObject( HGDIOBJ16 obj )
case PEN_MAGIC: return GDI_FreeObject( obj );
case BRUSH_MAGIC: return BRUSH_DeleteObject( obj, (BRUSHOBJ*)header );
case FONT_MAGIC: return GDI_FreeObject( obj );
case PALETTE_MAGIC: return GDI_FreeObject( obj );
case PALETTE_MAGIC: return PALETTE_DeleteObject(obj,(PALETTEOBJ*)header);
case BITMAP_MAGIC: return BITMAP_DeleteObject( obj, (BITMAPOBJ*)header);
case REGION_MAGIC: return REGION_DeleteObject( obj, (RGNOBJ*)header );
}
@ -412,9 +408,26 @@ HANDLE SelectObject( HDC hdc, HANDLE handle )
/***********************************************************************
* UnrealizeObject (GDI.150)
*/
BOOL UnrealizeObject( HANDLE handle )
BOOL UnrealizeObject( HANDLE obj )
{
dprintf_gdi(stdnimp, "UnrealizeObject: %04x\n", handle );
/* Check if object is valid */
GDIOBJHDR * header = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( obj );
if (!header) return FALSE;
dprintf_gdi( stddeb, "UnrealizeObject: %04x\n", obj );
/* Unrealize object */
switch(header->wMagic)
{
case PALETTE_MAGIC:
return PALETTE_UnrealizeObject( obj, (PALETTEOBJ *)header );
case BRUSH_MAGIC:
/* Windows resets the brush origin. We don't need to. */
break;
}
return TRUE;
}

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