-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.
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.
-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.
+----------------------------------------------------------------------
+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>
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
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)
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
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
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
EMUSUBDIRS = \
tools \
debugger \
- debugger/readline \
if1632 \
miscemu
EMUOBJS = \
debugger/debugger.o \
- debugger/readline/readline.o \
if1632/if1632.o \
miscemu/miscemu.o
(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:
--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"
fi
+
ac_aux_dir=
for ac_dir in tools $srcdir/tools; do
if test -f $ac_dir/install-sh; then
# 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
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
# 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
:
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
:
# 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*
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; }
${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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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) {
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
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. */
; 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
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>
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; }
; 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
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>
#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*
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
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
:
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')
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
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
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}
Makefile
controls/Makefile
debugger/Makefile
-debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/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
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
Makefile
controls/Makefile
debugger/Makefile
-debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/Makefile
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
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.
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 ****
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()
Makefile
controls/Makefile
debugger/Makefile
-debugger/readline/Makefile
files/Makefile
if1632/Makefile
ipc/Makefile
-TOPSRC = @top_srcdir@
-
-MODULE = controls
+DEFS = -D__WINE__
+TOPSRC = @top_srcdir@
+MODULE = controls
C_SRCS = \
button.c \
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;
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;
ExitWindows( 0, 0 );
case WM_SETCURSOR:
- return (LRESULT)SetCursor( LoadCursor( 0, IDC_ARROW ) );
+ return (LRESULT)SetCursor( LoadCursor16( 0, IDC_ARROW ) );
}
return 0;
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);
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':
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;
/* 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;
/**********************************************************************
* 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))
{
/* 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)
*/
*/
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));
}
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;
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) );
#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 \
{
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 */
/* 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;
}
-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 \
void
issue_prompt(){
-#ifndef USE_READLINE
+#ifdef DONT_USE_READLINE
fprintf(stderr,"Wine-dbg>");
#endif
}
-/* 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
*/
%{
#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;
%}
int yywrap(void) { return 1; }
#endif
-#ifdef USE_READLINE
+#ifndef DONT_USE_READLINE
+
#ifndef whitespace
#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
#endif
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 */
-/* $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.
#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.
/*
** Globals.
*/
-int rl_eof;
-int rl_erase;
-int rl_intr;
-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 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;
+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;
/*
** Declarations.
*/
-STATIC CHAR *editinput();
+static CHAR *editinput();
extern int read();
extern int write();
#if defined(USE_TERMCAP)
** 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) {
}
}
-STATIC void
+static void
TTYput(c)
CHAR c;
{
}
}
-STATIC void
+static void
TTYputs(p)
CHAR *p;
{
TTYput(*p++);
}
-STATIC void
+static void
TTYshow(c)
CHAR c;
{
TTYput(c);
}
-STATIC void
+static void
TTYstring(p)
CHAR *p;
{
TTYshow(*p++);
}
-STATIC unsigned int
+static unsigned int
TTYget()
{
CHAR c;
}
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;
{
TTYback();
}
-STATIC void
+static void
TTYinfo()
{
static int init;
\f
-STATIC void
+static void
reposition()
{
int i;
TTYshow(*p);
}
-STATIC void
+static void
left(Change)
STATUS Change;
{
Point--;
}
-STATIC void
+static void
right(Change)
STATUS Change;
{
Point++;
}
-STATIC STATUS
+static STATUS
ring_bell()
{
TTYput('\07');
return CSstay;
}
-STATIC STATUS
+static STATUS
do_macro(c)
unsigned int c;
{
return CSstay;
}
-STATIC STATUS
+static STATUS
do_forward(move)
STATUS move;
{
return CSstay;
}
-STATIC STATUS
+static STATUS
do_case(type)
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;
TTYback();
}
-STATIC void
+static void
clear_line()
{
Point = -strlen(Prompt);
Line[0] = '\0';
}
-STATIC STATUS
+static STATUS
insert_string(p)
CHAR *p;
{
- SIZE_T len;
+ size_t len;
int i;
CHAR *new;
CHAR *q;
}
\f
-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;
{
return insert_string(p);
}
-STATIC STATUS
+static STATUS
do_hist(move)
CHAR *(*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]);
/*
** Return zero if pat appears as a substring in text.
*/
-STATIC int
+static int
substrcmp(text, pat, len)
char *text;
char *pat;
return 1;
}
-STATIC CHAR *
+static CHAR *
search_hist(search, move)
CHAR *search;
CHAR *(*move)();
return NULL;
}
-STATIC STATUS
+static STATUS
h_search()
{
static int Searching;
- CONST char *old_prompt;
+ const char *old_prompt;
CHAR *(*move)();
CHAR *p;
return do_insert_hist(p);
}
-STATIC STATUS
+static STATUS
fd_char()
{
int i;
return CSstay;
}
-STATIC void
+static void
save_yank(begin, i)
int begin;
int 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;
{
return CSmove;
}
-STATIC STATUS
+static STATUS
bk_char()
{
int i;
return CSstay;
}
-STATIC STATUS
+static STATUS
bk_del_char()
{
int i;
return delete_string(i);
}
-STATIC STATUS
+static STATUS
redisplay()
{
TTYputs((CHAR *)NEWLINE);
return CSmove;
}
-STATIC STATUS
+static STATUS
kill_line()
{
int i;
return CSstay;
}
-STATIC STATUS
+static STATUS
insert_char(c)
int c;
{
return s;
}
-STATIC STATUS
+static STATUS
meta()
{
unsigned int c;
if ((c = TTYget()) == EOF)
return CSeof;
-#if defined(ANSI_ARROWS)
/* Also include VT-100 arrows. */
if (c == '[' || c == 'O')
switch (c = TTYget()) {
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); )
return ring_bell();
}
-STATIC STATUS
+static STATUS
emacs(c)
unsigned int c;
{
return s;
}
-STATIC STATUS
+static STATUS
TTYspecial(c)
unsigned int c;
{
return CSdispatch;
}
-STATIC CHAR *
+static CHAR *
editinput()
{
unsigned int c;
return NULL;
}
-STATIC void
+static void
hist_add(p)
CHAR *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;
}
\f
-STATIC STATUS
+static STATUS
beg_line()
{
if (Point) {
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) {
return CSstay;
}
-STATIC STATUS
+static STATUS
accept_line()
{
Line[End] = '\0';
return CSdone;
}
-STATIC STATUS
+static STATUS
transpose()
{
CHAR c;
return CSstay;
}
-STATIC STATUS
+static STATUS
quote()
{
unsigned int c;
return (c = TTYget()) == EOF ? CSeof : insert_char((int)c);
}
-STATIC STATUS
+static STATUS
wipe()
{
int i;
return delete_string(Mark - Point);
}
-STATIC STATUS
+static STATUS
mk_set()
{
Mark = Point;
return CSstay;
}
-STATIC STATUS
+static STATUS
exchange()
{
unsigned int c;
return CSstay;
}
-STATIC STATUS
+static STATUS
yank()
{
if (Yanked && *Yanked)
return CSstay;
}
-STATIC STATUS
+static STATUS
copy_region()
{
if (Mark > End)
return CSstay;
}
-STATIC STATUS
+static STATUS
move_to_char()
{
unsigned int c;
return CSstay;
}
-STATIC STATUS
+static STATUS
fd_word()
{
return do_forward(CSmove);
}
-STATIC STATUS
+static STATUS
fd_kill_word()
{
int i;
return CSstay;
}
-STATIC STATUS
+static STATUS
bk_word()
{
int i;
return CSstay;
}
-STATIC STATUS
+static STATUS
bk_kill_word()
{
(void)bk_word();
return CSstay;
}
-STATIC int
+static int
argify(line, avp)
CHAR *line;
CHAR ***avp;
return ac;
}
-STATIC STATUS
+static STATUS
last_argument()
{
CHAR **av;
return s;
}
-STATIC KEYMAP Map[33] = {
+static KEYMAP Map[33] = {
{ CTL('@'), ring_bell },
{ CTL('A'), beg_line },
{ CTL('B'), bk_char },
{ 0, NULL }
};
-STATIC KEYMAP MetaMap[16]= {
+static KEYMAP MetaMap[16]= {
{ CTL('H'), bk_kill_word },
{ DEL, bk_kill_word },
{ ' ', mk_set },
+++ /dev/null
-TOPSRC = @top_srcdir@
-EXTRA_DEFS = -DHIDE -DANSI_ARROWS
-
-MODULE = readline
-
-C_SRCS = editline.c sysunix.c
-
-all: $(MODULE).o
-
-@MAKE_RULES@
-
-### Dependencies:
+++ /dev/null
-$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.
+++ /dev/null
-.\" $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>.
+++ /dev/null
-/* $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();
+++ /dev/null
-/* $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) ? "/" : " ");
-}
-TOPSRC = @top_srcdir@
-MODULE = files
+prefix = @prefix@
+sysconfdir = @sysconfdir@
+DEFS = -D__WINE__ -DETCDIR=\"$(sysconfdir)\"
+TOPSRC = @top_srcdir@
+MODULE = files
C_SRCS = \
directory.c \
/***********************************************************************
* _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;
/* Check for comments in profile */
#define IS_ENTRY_COMMENT(str) ((str)[0] == ';')
+#define WINE_INI_GLOBAL ETCDIR "/wine.conf"
/***********************************************************************
* PROFILE_CopyEntry
}
+/***********************************************************************
+ * 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
*
+DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
-
MODULE = if1632
DLLS = \
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
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
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
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
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
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
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
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
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
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
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;
/***********************************************************************
* 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;
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;
}
}
/**********************************************************************
* Catch (KERNEL.55)
*/
-INT Catch( LPCATCHBUF lpbuf )
+INT16 Catch( LPCATCHBUF lpbuf )
{
STACK16FRAME *pFrame = CURRENT_STACK16;
/**********************************************************************
* Throw (KERNEL.56)
*/
-int Throw( LPCATCHBUF lpbuf, int retval )
+INT16 Throw( LPCATCHBUF lpbuf, INT16 retval )
{
STACK16FRAME *pFrame;
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
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
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
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
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
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
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
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
#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 ) \
#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 */
--- /dev/null
+/* 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
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 */
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
{
X_PHYSFONT font;
X_PHYSPEN pen;
X_PHYSBRUSH brush;
- X_PHYSPALETTE pal;
} X_DC_INFO;
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 */
#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 );
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? */
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 */
#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 {
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;
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
{
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 */
int base_addr;
int load_addr;
int vma_size;
- int resource_offset; /* offset to resource typedirectory in file */
};
typedef struct pe_data PE_MODULE;
#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 );
#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;
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 */
/* 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
#endif
SEGPTR MAKE_SEGPTR(void *ptr);
#else
-#define CURRENT_STACK16 error.error
-#define CURRENT_DS ((WORD)GetTaskDS())
#define MAKE_SEGPTR(ptr) ((SEGPTR)ptr)
#endif
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)
/* 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))
#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 */
#include "wintypes.h"
#include "winuser.h"
-#ifndef WINELIB
#pragma pack(1)
-#endif
/* The SIZE structure */
((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 */
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;
#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
#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)
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);
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 */
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);
/* 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);
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*);
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);
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)
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);
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)
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)
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)
#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;
typedef HANDLE16 HMIDIIN;
typedef HANDLE16 HMIDIOUT;
typedef HANDLE16 HMMIO;
-typedef HANDLE16 HMODULE;
typedef HANDLE16 HQUEUE;
typedef HANDLE16 HRGN;
typedef HANDLE16 HRSRC;
typedef HANDLE16 HWAVEIN;
typedef HANDLE16 HWAVEOUT;
typedef HANDLE16 HWND;
-typedef FARPROC16 FARPROC;
-#endif /* WINELIB */
+# endif /* WINELIB32 */
+#endif /* __WINE__ */
/* Callback function pointers types. */
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;
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);
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);
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*);
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);
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*);
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);
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);
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);
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);
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);
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);
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);
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*);
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);
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);
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,
#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
/* 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
# 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. */
typedef INT16 HFILE;
typedef HANDLE32 HHOOK;
typedef HANDLE32 HKEY;
+typedef HANDLE32 HMIXEROBJ;
/* Pointers types. These are the same for emulator and library. */
typedef INT32 *LPINT32;
typedef UINT32 *LPUINT32;
typedef HKEY *LPHKEY;
+typedef HMIXEROBJ *LPHMIXEROBJ;
/* Special case: a segmented pointer is just a pointer in the library. */
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);
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);
/* 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;
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. */
/* Define some empty macros for compatibility with Windows code. */
-#ifdef WINELIB
+#ifndef __WINE__
#define CALLBACK
#define NEAR
#define FAR
#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. */
/* 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))
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 */
LPCWSTR lpszClassName;
} WNDCLASS32W, *LPWNDCLASS32W;
+#pragma pack(1)
+
typedef struct
{
UINT16 style;
SEGPTR lpszClassName WINE_PACKED;
} WNDCLASS16, *LPWNDCLASS16;
+#pragma pack(4)
+
typedef struct
{
UINT32 cbSize;
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = ipc
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = library
/**********************************************************************
* 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;
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;
}
/**********************************************************************
* 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;
}
/**********************************************************************
* LIBRES_SizeofResource
*/
-DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
+DWORD LIBRES_SizeofResource( HINSTANCE hModule, HRSRC32 hRsrc )
{
return (DWORD)(((struct resource*)hRsrc)->size);
}
}
}
-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);
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);
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)
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = loader
*/
HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL16 force )
{
- HMODULE hModule;
+ HMODULE16 hModule;
NE_MODULE *pModule;
BUILTIN_DLL *table;
char dllname[16], *p;
*/
void MODULE_WalkModules(void)
{
- HMODULE hModule = hFirstModule;
+ HMODULE16 hModule = hFirstModule;
fprintf( stderr, "Module Flags Name\n" );
while (hModule)
{
}
+/***********************************************************************
+ * 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
*/
HANDLE hInstance, hPrevInstance;
NE_MODULE *pModule;
LOADPARAMS *params = (LOADPARAMS *)paramBlock;
+ OFSTRUCT ofs;
#ifndef WINELIB
WORD *pModRef, *pDLLs;
HFILE hFile;
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;
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 */
/***********************************************************************
* 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;
*
* 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;
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
*
* 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)
{
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 );
* 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;
{
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],
ret = MAKELONG( p[1], p[2] );
break;
}
- FreeResource( handle );
+ FreeResource16( handle );
if (ret) return ret;
}
}
/***********************************************************************
* 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;
/***********************************************************************
* 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;
/***********************************************************************
* NE_AccessResource
*/
-int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
+int NE_AccessResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
int fd;
/***********************************************************************
* NE_SizeofResource
*/
-DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
+DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
/***********************************************************************
* NE_LoadResource
*/
-HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc )
+HGLOBAL NE_LoadResource( HMODULE16 hModule, HRSRC hRsrc )
{
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
/***********************************************************************
* NE_LockResource
*/
-SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle )
+SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL handle )
{
/* May need to reload the resource if discarded */
/***********************************************************************
* NE_FreeResource
*/
-BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
+BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL handle )
{
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
}
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 */
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++;
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");
/* 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 */
{
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];
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);
* 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;
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;
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;
-
- lseek(fd,0,SEEK_SET);
- read( fd, &mz_header, sizeof(mz_header) );
-
- 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;
-
- hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size );
- if (!hModule) return (HINSTANCE)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=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;
-
- /* 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;
- 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++;
+ HMODULE16 hModule;
+ HINSTANCE16 hInstance;
+ NE_MODULE *pModule;
+ SEGTABLEENTRY *pSegment;
+ FARPROC16 startup;
+ struct mz_header_s mz_header;
- pStr=(char*)pSegment;
- pModule->name_table=(int)pStr-(int)pModule;
- strcpy(pStr,"\x08W32SXXXX");
- pStr+=9;
+ if ((hModule = MODULE_CreateDummyModule( ofs )) < 32) return hModule;
+ pModule = (NE_MODULE *)GlobalLock16( hModule );
+ pModule->flags = NE_FFLAGS_WIN32;
- /* All tables zero terminated */
- pModule->res_table=pModule->import_table=pModule->entry_table=
- (int)pStr-(int)pModule;
+ lseek( fd, 0, SEEK_SET );
+ read( fd, &mz_header, sizeof(mz_header) );
- MODULE_RegisterModule( pModule );
+ /* Set the startup address */
- pe = PE_LoadImage( fd, hModule, mz_header.ne_offset );
+ startup = MODULE_GetWndProcEntry16("Win32CallToStart");
+ pSegment = NE_SEG_TABLE(pModule) + pModule->cs - 1;
+ pSegment->selector = SELECTOROF(startup); /* FIXME */
+ pModule->ip = OFFSETOF(startup);
- pModule->pe_module = pe;
- pModule->heap_size=0x1000;
- pModule->stack_size=0xE000;
+ pModule->pe_module = PE_LoadImage( fd, hModule, mz_header.ne_offset );
- /* CreateInstance allocates now 64KB */
- hInstance=MODULE_CreateInstance(hModule,NULL /* FIX: NULL? really? */);
+ hInstance = MODULE_CreateInstance( hModule, params );
- /* 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);
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;
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 );
}
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 );
#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)
-{
- struct PE_Directory_Entry *type_dir;
- struct PE_Resource_Leaf_Entry *leaf;
+#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)
- 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;
+/**********************************************************************
+ * GetResDirEntryW
+ *
+ * Helper function - goes down one level of PE resource tree
+ *
+ */
+PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr,
+ LPCWSTR name,
+ DWORD root)
+{
+ int entrynum;
+ PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
+ int namelen;
-/* 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++;
- } */
+ 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 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;
+ }
}
-static int
-find_resource(char *root, struct PE_Resource_Directory *resource,
- LPSTR resource_name, RESOURCE *r)
+/**********************************************************************
+ * GetResDirEntryA
+ *
+ * Helper function - goes down one level of PE resource tree
+ *
+ */
+PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY resdirptr,
+ LPCSTR name,
+ DWORD root)
{
- 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);
+ LPWSTR xname;
+ PIMAGE_RESOURCE_DIRECTORY ret;
- 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++;
- }
- }
- return 0;
+ 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;
}
-static int
-find_type(struct PE_Resource_Directory *resource, LPSTR resource_name,
- LPSTR type_name)
+/**********************************************************************
+ * PE_FindResource32W
+ */
+HANDLE32 PE_FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
{
- 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);
+ PE_MODULE *pe;
+ NE_MODULE *pModule;
+ PIMAGE_RESOURCE_DIRECTORY resdirptr;
+ DWORD root;
+ HANDLE32 result;
- 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++;
- }
- }
+ 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_FindResource [KERNEL.60]
+ * PE_LoadResource32
*/
-int
-PE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
- RESOURCE *r)
+HANDLE32 PE_LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc )
{
- 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);
+ 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 */
#include "stddebug.h"
#include "debug.h"
#include "libres.h"
+#include "string32.h"
+#include "xmalloc.h"
#define PrintId(name) \
if (HIWORD((DWORD)name)) \
/**********************************************************************
- * 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 */
{
#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 );
/**********************************************************************
- * 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, "LoadResource: module=%04x res=%04x\n",
+ 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, "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 );
#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 );
#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 );
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 ) );
/**********************************************************************
- * FreeResource (KERNEL.63)
+ * LockResource32 (KERNEL32.384)
+ */
+LPVOID LockResource32( HGLOBAL32 handle )
+{
+ return (LPVOID)handle;
+}
+
+
+/**********************************************************************
+ * FreeResource16 (KERNEL.63)
*/
-BOOL FreeResource( HGLOBAL handle )
+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 );
#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 );
/**********************************************************************
- * 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 );
/**********************************************************************
- * 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;
/**********************************************************************
- * 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;
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 = LoadResource16( instance, hRsrc ))) return 0;
+
+ 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);
+ 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);
+ 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 = LoadResource( instance, hRsrc ))) return 0;
+ if (!(rsc_mem = LoadResource32( instance, hRsrc ))) return 0;
- lp = (BYTE *)LockResource(rsc_mem);
- n = SizeofResource( instance, hRsrc ) / sizeof(ACCELENTRY);
+ 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++;
}
GlobalUnlock16(hAccel);
- FreeResource( rsc_mem );
+ FreeResource32(rsc_mem);
return hAccel;
+#else
+ fprintf(stderr,"LoadAcceleratorsW: not implemented\n");
+ return 0x100; /* Return something anyway */
+#endif
}
-\f
+
+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]
*/
GlobalUnlock16(hAccel);
return 0;
}
-\f
+
/**********************************************************************
- * 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;
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;
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;
+}
#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();
/***********************************************************************
* TASK_Init
*/
-BOOL TASK_Init(void)
+BOOL32 TASK_Init(void)
{
TASK_RescheduleProc = MODULE_GetWndProcEntry16( "TASK_Reschedule" );
if (!(hDOSEnvironment = TASK_CreateDOSEnvironment()))
/***********************************************************************
* 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;
/***********************************************************************
* TASK_UnlinkTask
*/
-static void TASK_UnlinkTask( HTASK hTask )
+static void TASK_UnlinkTask( HTASK16 hTask )
{
- HTASK *prevTask;
+ HTASK16 *prevTask;
TDB *pTask;
prevTask = &hFirstTask;
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*/ );
/***********************************************************************
* 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;
SEGTABLEENTRY *pSegTable;
LPSTR name;
char filename[256];
-#ifndef WINELIB32
char *stack16Top, *stack32Top;
STACK16FRAME *frame16;
STACK32FRAME *frame32;
+#ifndef WINELIB32
extern DWORD CALLTO16_RetAddr_word;
#endif
/* 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;
/* Allocate the 32-bit stack */
-#ifndef WINELIB
pTask->hStack32 = GLOBAL_Alloc( GMEM_FIXED, STACK32_SIZE, pTask->hPDB,
FALSE, FALSE, FALSE );
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 */
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 */
/* Add a breakpoint at the start of the task */
+#ifndef WINELIB
if (Options.debug)
{
if (pModule->flags & NE_FFLAGS_WIN32)
DEBUG_AddBreakpoint( &addr );
}
}
-#endif
+#endif /* WINELIB */
/* Add the task to the linked list */
* 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 );
/* 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;
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) */
/* 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
}
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",
*thunk++ = (BYTE)(hInstance >> 8);
*thunk++ = 0xea; /* ljmp func */
*(DWORD *)thunk = (DWORD)func;
- return (FARPROC)thunkaddr;
+ return (FARPROC16)thunkaddr;
#endif
}
/**********************************************************************
* GetCodeHandle (KERNEL.93)
*/
-HANDLE GetCodeHandle( FARPROC proc )
+HANDLE GetCodeHandle( FARPROC16 proc )
{
#ifndef WINELIB32
HANDLE handle;
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;
}
/***********************************************************************
* 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 */
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = memory
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))
/***********************************************************************
* 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 */ );
}
*/
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;
}
/***********************************************************************
* FarSetOwner (KERNEL.403)
*/
-void FarSetOwner( HANDLE16 handle, HANDLE16 hOwner )
+void FarSetOwner( HGLOBAL16 handle, HANDLE16 hOwner )
{
GET_ARENA_PTR(handle)->hOwner = hOwner;
}
/***********************************************************************
* FarGetOwner (KERNEL.404)
*/
-HANDLE16 FarGetOwner( HANDLE16 handle )
+HANDLE16 FarGetOwner( HGLOBAL16 handle )
{
return GET_ARENA_PTR(handle)->hOwner;
}
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;
}
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 */
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] );
}
#include "stddebug.h"
#include "debug.h"
-#ifndef WINELIB
-#pragma pack(1)
-#endif
-
typedef struct
{
/* Arena header */
BYTE lock; /* Lock count */
} LOCALHANDLEENTRY;
+#pragma pack(1)
+
typedef struct
{
WORD check; /* 00 Heap checking flag */
WORD magic; /* 28 Magic number */
} LOCALHEAPINFO;
-#ifndef WINELIB
#pragma pack(4)
-#endif
#define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */
}
/* Clear the saved 16-bit selector */
-#ifndef WINELIB
frame = CURRENT_STACK16;
while (frame)
{
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;
}
{
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;
}
*/
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 );
}
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = misc
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)
{
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)
if (!(lpofn->Flags & OFN_ENABLETEMPLATEHANDLE))
{
- if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource( hDlgTmpl );
+ if (lpofn->Flags & OFN_ENABLETEMPLATE) FreeResource16( hDlgTmpl );
else SYSRES_FreeResource( hDlgTmpl );
}
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 );
(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 );
}
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)
{
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)
(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;
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);
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)
(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;
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);
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);
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 .*/
LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
{
char buffer[200];
- FARPROC enumCallback;
+ FARPROC16 enumCallback;
HFONT hFont/*,hFontOld*/;
int i,j;
long l;
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");
HMODULE16 GetDriverModuleHandle(HDRVR16 hDrvr)
{
LPDRIVERITEM lpdrv;
- HMODULE hModule = 0;
+ HMODULE16 hModule = 0;
dprintf_driver( stddeb, "GetDriverModuleHandle(%04x);\n", hDrvr);
#else
LANG_En,
#endif
- FALSE /* Managed windows */
+ FALSE, /* Managed windows */
+ FALSE /* Perfect graphics */
};
{ "-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" },
" -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"
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))
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 );
/***********************************************************************
* FileCDR (KERNEL.130)
*/
-void FileCDR(FARPROC x)
+void FileCDR(FARPROC16 x)
{
printf("FileCDR(%8x)\n", (int) x);
}
+/*
+ * 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;
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 */
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 ),
* 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 )
{
*lpiIcon = 6; /* generic icon - found nothing */
GetModuleFileName(hInst, lpIconPath, 0x80);
- hIcon = LoadIcon( hInst, MAKEINTRESOURCE(*lpiIcon));
+ hIcon = LoadIcon16( hInst, MAKEINTRESOURCE(*lpiIcon));
}
return hIcon;
static struct notify
{
HTASK htask;
- FARPROC lpfnCallback;
+ FARPROC16 lpfnCallback;
WORD wFlags;
} *notifys = NULL;
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;
return 0;
}
-FARPROC WSASetBlockingHook(FARPROC lpBlockFunc)
+FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc)
{
dprintf_winsock(stddeb, "WSA_SetBlockHook %8lx, STUB!\n", (unsigned long) lpBlockFunc);
BlockFunction = lpBlockFunc;
- return (FARPROC) lpBlockFunc;
+ return (FARPROC16) lpBlockFunc;
}
INT WSAUnhookBlockingHook(void)
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:
}
/* 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 */
/***********************************************************************
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = miscemu
#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"
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 */
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) )))
if ((BL_reg(context) == 0x2f) && ((p->eax & 0xFF00) == 0x1500))
{
do_mscdex( context );
+ break;
}
- else SET_CFLAG(context);
+ SET_CFLAG(context);
}
break;
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);
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);
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = multimedia
typedef struct tagTIMERENTRY {
WORD wDelay;
WORD wResol;
- FARPROC lpFunc;
+ FARPROC16 lpFunc;
HINSTANCE hInstance;
DWORD dwUser;
WORD wFlags;
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);
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",
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = objects
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)
{
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,
#include "callback.h"
#include "dc.h"
#include "bitmap.h"
+#include "heap.h"
+#include "string32.h"
#include "stddebug.h"
#include "debug.h"
/**********************************************************************
- * 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 */
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 );
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
* Color functions
*
* Copyright 1993 Alexandre Julliard
+ * Copyright 1996 Alex Korobka
*/
#include <stdlib.h>
#include <X11/Xlib.h>
#include <stdio.h>
+#include <string.h>
#include "windows.h"
#include "options.h"
#include "gdi.h"
#include "color.h"
-#include "palette.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
-Colormap COLOR_WinColormap = 0;
-static int COLOR_FixedMap = 0;
+/* Palette indexed mode:
-static int COLOR_Redshift = 0;
-static int COLOR_Redmax = 0;
+ * logical palette -> mapping -> pixel
+ *
+ *
+ * Windows needs contiguous color space ( from 0 to n ) but
+ * it is possible only with private colormap. Otherwise we
+ * have to map DC palette indices to real pixel values.
+ * With private colormap it boils down to identity mapping. The
+ * other special case is when we have fixed color visual with
+ * screendepth > 8 - we abandon mapping altogether (pixel
+ * values can be calculated without X server assistance).
+ *
+ * For info about general Windows palette management read
+ * http://198.105.232.5/MSDN/LIBRARY/TECHNOTE/CH3.HTM
+ */
+
+extern void BITBLT_SetAccelMode( int ); /* speed up INVERT raster ops whenever possible
+ * parameter is a speedup level (see bitblt.c)
+ */
+
+typedef struct
+{
+ Colormap colorMap;
+ UINT16 size;
+ UINT16 flags;
+} CSPACE;
+
+static CSPACE cSpace = {0, 0, 0};
+
+static int COLOR_Redshift = 0; /* to handle abortive COLOR_VIRTUAL visuals */
+static int COLOR_Redmax = 0;
static int COLOR_Greenshift = 0;
-static int COLOR_Greenmax = 0;
-static int COLOR_Blueshift = 0;
-static int COLOR_Bluemax = 0;
-static int COLOR_Graymax = 0;
+static int COLOR_Greenmax = 0;
+static int COLOR_Blueshift = 0;
+static int COLOR_Bluemax = 0;
+static int COLOR_Graymax = 0;
+
+/* System color space.
+ *
+ * First 10 and last 10 colors in COLOR_sysPalette are
+ * "guarded". RealizePalette changes only the rest of colorcells. For
+ * currently inactive window it changes only DC palette mappings.
+ */
+
+#define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */
+
+Visual* visual = NULL;
- /* System palette static colors */
+static PALETTEENTRY* COLOR_sysPal = NULL; /* current system palette */
+static int COLOR_gapStart = 256;
+static int COLOR_gapEnd = -1;
-#define NB_RESERVED_COLORS 20
+ /* First free dynamic color cell, 0 = full palette, -1 = fixed palette */
+static int COLOR_firstFree = 0;
- /* The first and last eight colors are EGA colors */
-static const PALETTEENTRY COLOR_sysPaletteEntries[NB_RESERVED_COLORS] =
+ /* Maps entry in the system palette to X pixel value */
+int* COLOR_PaletteToPixel = NULL;
+
+ /* Maps pixel to the entry in the system palette */
+int* COLOR_PixelToPalette = NULL;
+
+static const PALETTEENTRY __sysPalTemplate[NB_RESERVED_COLORS] =
{
+ /* first 10 entries in the system palette */
/* red green blue flags */
- { 0x00, 0x00, 0x00, 0 },
- { 0x80, 0x00, 0x00, 0 },
- { 0x00, 0x80, 0x00, 0 },
- { 0x80, 0x80, 0x00, 0 },
- { 0x00, 0x00, 0x80, 0 },
- { 0x80, 0x00, 0x80, 0 },
- { 0x00, 0x80, 0x80, 0 },
- { 0xc0, 0xc0, 0xc0, 0 },
- { 0xc0, 0xdc, 0xc0, 0 },
- { 0xa6, 0xca, 0xf0, 0 },
-
- { 0xff, 0xfb, 0xf0, 0 },
- { 0xa0, 0xa0, 0xa4, 0 },
- { 0x80, 0x80, 0x80, 0 },
- { 0xff, 0x00, 0x00, 0 },
- { 0x00, 0xff, 0x00, 0 },
- { 0xff, 0xff, 0x00, 0 },
- { 0x00, 0x00, 0xff, 0 },
- { 0xff, 0x00, 0xff, 0 },
- { 0x00, 0xff, 0xff, 0 },
- { 0xff, 0xff, 0xff, 0 }
+ { 0x00, 0x00, 0x00, PC_SYS_USED },
+ { 0x80, 0x00, 0x00, PC_SYS_USED },
+ { 0x00, 0x80, 0x00, PC_SYS_USED },
+ { 0x80, 0x80, 0x00, PC_SYS_USED },
+ { 0x00, 0x00, 0x80, PC_SYS_USED },
+ { 0x80, 0x00, 0x80, PC_SYS_USED },
+ { 0x00, 0x80, 0x80, PC_SYS_USED },
+ { 0xc0, 0xc0, 0xc0, PC_SYS_USED },
+ { 0xc0, 0xdc, 0xc0, PC_SYS_USED },
+ { 0xa6, 0xca, 0xf0, PC_SYS_USED },
+
+ /* ... c_min/2 dynamic colorcells */
+
+ /* ... gap (for sparse palettes) */
+
+ /* ... c_min/2 dynamic colorcells */
+
+ { 0xff, 0xfb, 0xf0, PC_SYS_USED },
+ { 0xa0, 0xa0, 0xa4, PC_SYS_USED },
+ { 0x80, 0x80, 0x80, PC_SYS_USED },
+ { 0xff, 0x00, 0x00, PC_SYS_USED },
+ { 0x00, 0xff, 0x00, PC_SYS_USED },
+ { 0xff, 0xff, 0x00, PC_SYS_USED },
+ { 0x00, 0x00, 0xff, PC_SYS_USED },
+ { 0xff, 0x00, 0xff, PC_SYS_USED },
+ { 0x00, 0xff, 0xff, PC_SYS_USED },
+ { 0xff, 0xff, 0xff, PC_SYS_USED } /* last 10 */
};
-static HANDLE hSysColorTranslation = 0;
-static HANDLE hRevSysColorTranslation = 0;
+ /* Map an EGA index (0..15) to a pixel value in the system color space. */
- /* Map an EGA index (0..15) to a pixel value. Used for dithering. */
int COLOR_mapEGAPixel[16];
-int* COLOR_PaletteToPixel = NULL;
-int* COLOR_PixelToPalette = NULL;
-int COLOR_ColormapSize = 0;
+/***********************************************************************
+ * Misc auxiliary functions
+ */
+Colormap COLOR_GetColormap(void)
+{
+ return cSpace.colorMap;
+}
+
+UINT16 COLOR_GetSystemPaletteSize(void)
+{
+ return (cSpace.flags & COLOR_PRIVATE) ? cSpace.size : 256;
+}
+
+UINT16 COLOR_GetSystemPaletteFlags(void)
+{
+ return cSpace.flags;
+}
+
+void COLOR_FormatSystemPalette(void)
+{
+ int i, j = COLOR_firstFree = NB_RESERVED_COLORS/2;
+
+ COLOR_sysPal[j].peFlags = 0;
+ for( i = NB_RESERVED_COLORS/2 + 1 ; i < 256 - NB_RESERVED_COLORS/2 ; i++ )
+ if( i < COLOR_gapStart || i > COLOR_gapEnd )
+ {
+ COLOR_sysPal[i].peFlags = 0; /* unused tag */
+ COLOR_sysPal[j].peRed = i; /* next */
+ j = i;
+ }
+ COLOR_sysPal[j].peRed = 0; /* terminal */
+}
+
/***********************************************************************
- * COLOR_BuildMap
+ * COLOR_BuildPrivateMap/COLOR_BuildSharedMap
*
- * Fill the private colormap.
+ * Executed only one time so we don't care about sloppiness,
+ * the rest have to be very tight though...
*/
-static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
+static BOOL COLOR_BuildPrivateMap(CSPACE* cs)
{
+ /* Private colormap - identity mapping */
+
XColor color;
- int r, g, b, red_incr, green_incr, blue_incr;
- int index = 0;
+ int i;
- /* Fill the whole map with a range of colors */
+ COLOR_sysPal = (PALETTEENTRY*)xmalloc(sizeof(PALETTEENTRY)*cs->size);
- blue_incr = 0x10000 >> (depth / 3);
- red_incr = 0x10000 >> ((depth + 1) / 3);
- green_incr = 0x10000 >> ((depth + 2) / 3);
+ dprintf_palette(stddeb,"\tbuilding private map - %i palette entries\n", cs->size);
- for (r = red_incr - 1; r < 0x10000; r += red_incr)
- for (g = green_incr - 1; g < 0x10000; g += green_incr)
- for (b = blue_incr - 1; b < 0x10000; b += blue_incr)
+ /* Allocate system palette colors */
+
+ for( i=0; i < cs->size; i++ )
+ {
+ if( i < NB_RESERVED_COLORS/2 )
+ {
+ color.red = __sysPalTemplate[i].peRed * 65535 / 255;
+ color.green = __sysPalTemplate[i].peGreen * 65535 / 255;
+ color.blue = __sysPalTemplate[i].peBlue * 65535 / 255;
+ COLOR_sysPal[i] = __sysPalTemplate[i];
+ }
+ else if( i >= cs->size - NB_RESERVED_COLORS/2 )
+ {
+ int j = NB_RESERVED_COLORS + i - cs->size;
+ color.red = __sysPalTemplate[j].peRed * 65535 / 255;
+ color.green = __sysPalTemplate[j].peGreen * 65535 / 255;
+ color.blue = __sysPalTemplate[j].peBlue * 65535 / 255;
+ COLOR_sysPal[i] = __sysPalTemplate[j];
+ }
+
+ color.flags = DoRed | DoGreen | DoBlue;
+ color.pixel = i;
+ XStoreColor(display, cs->colorMap, &color);
+
+ /* Set EGA mapping if color in the first or last eight */
+
+ if (i < 8)
+ COLOR_mapEGAPixel[i] = color.pixel;
+ else if (i >= cs->size - 8 )
+ COLOR_mapEGAPixel[i - (cs->size - 16)] = color.pixel;
+ }
+
+ COLOR_PixelToPalette = COLOR_PaletteToPixel = NULL;
+
+ COLOR_gapStart = 256; COLOR_gapEnd = -1;
+
+ COLOR_firstFree = (cs->size > NB_RESERVED_COLORS)?NB_RESERVED_COLORS/2 : -1;
+ return FALSE;
+}
+
+static BOOL COLOR_BuildSharedMap(CSPACE* cs)
+{
+ XColor color;
+ unsigned long sysPixel[NB_RESERVED_COLORS];
+ unsigned long* pixDynMapping = NULL;
+ unsigned long plane_masks[1];
+ int i, j;
+ int color_ini_max = 256;
+
+ /* read "AllocSystemColors" from wine.conf */
+
+ color_ini_max = PROFILE_GetWineIniInt( "options", "AllocSystemColors", 256);
+ if (color_ini_max > 256) color_ini_max = 256;
+ if (color_ini_max < 20) color_ini_max = 20;
+ dprintf_palette(stddeb,"COLOR_Init: %d colors configured.\n",color_ini_max);
+
+ dprintf_palette(stddeb,"\tbuilding shared map - %i palette entries\n", cs->size);
+
+ /* Be nice and allocate system colors as read-only */
+
+ for( i = 0; i < NB_RESERVED_COLORS; i++ )
+ {
+ color.red = __sysPalTemplate[i].peRed * 65535 / 255;
+ color.green = __sysPalTemplate[i].peGreen * 65535 / 255;
+ color.blue = __sysPalTemplate[i].peBlue * 65535 / 255;
+ color.flags = DoRed | DoGreen | DoBlue;
+
+ if (!XAllocColor( display, cSpace.colorMap, &color ))
+ {
+ fprintf(stderr, "Warning: Not enough free colors for system palette.\n" );
+ color.pixel = color.red = color.green = color.blue = 0;
+ }
+
+ sysPixel[i] = color.pixel;
+
+ dprintf_palette(stddeb,"\tsyscolor(%lx) -> pixel %i\n",
+ *(COLORREF*)(__sysPalTemplate+i), (int)color.pixel);
+
+ /* Set EGA mapping if color in the first or last eight */
+
+ if (i < 8)
+ COLOR_mapEGAPixel[i] = color.pixel;
+ else if (i >= NB_RESERVED_COLORS - 8 )
+ COLOR_mapEGAPixel[i - (NB_RESERVED_COLORS-16)] = color.pixel;
+ }
+
+ if( !(cSpace.flags & COLOR_FIXED) )
+ {
+ int c_min = 0, c_max = cs->size, c_val;
+
+ dprintf_palette(stddeb,"\tdynamic colormap... ");
+
+ /* comment this out if you want to debug palette init */
+
+ XGrabServer(display);
+
+ /* let's become the first client that actually follows
+ * X guidelines and does binary search...
+ */
+
+ pixDynMapping = (unsigned long*)xmalloc(sizeof(long)*cs->size);
+ while( c_max - c_min > 0 )
+ {
+ c_val = (c_max + c_min)/2 + (c_max + c_min)%2;
+
+ if( !XAllocColorCells(display, cs->colorMap, False,
+ plane_masks, 0, pixDynMapping, c_val) )
+ c_max = c_val - 1;
+ else
+ {
+ XFreeColors(display, cs->colorMap, pixDynMapping, c_val, 0);
+ c_min = c_val;
+ }
+ }
+
+ if( c_min > color_ini_max - NB_RESERVED_COLORS)
+ c_min = color_ini_max - NB_RESERVED_COLORS;
+
+ c_min = (c_min/2) + (c_min/2); /* need even set for split palette */
+
+ if( c_min > 0 )
+ if( !XAllocColorCells(display, cs->colorMap, False,
+ plane_masks, 0, pixDynMapping, c_min) )
{
- if (index >= size) break;
- color.pixel = index++;
- color.red = r;
- color.green = g;
- color.blue = b;
- XStoreColor( display, map, &color );
+ fprintf(stderr,"Inexplicable failure during colorcell allocation.\n");
+ c_min = 0;
}
- return TRUE;
+ cs->size = c_min + NB_RESERVED_COLORS;
+
+ COLOR_gapStart = cs->size/2;
+ COLOR_gapEnd = 256 - cs->size/2;
+
+ XUngrabServer(display);
+
+ dprintf_palette(stddeb,"adjusted size %i colorcells\n", cs->size);
+ }
+ else if( cSpace.flags & COLOR_VIRTUAL )
+ {
+ /* virtual colorspace - ToPhysical takes care of
+ * color translations but we have to allocate full palette
+ * to maintain compatibility
+ */
+ dprintf_palette(stddeb,"\tvirtual colorspace - screendepth %i\n", screenDepth);
+ }
+ else cs->size = NB_RESERVED_COLORS; /* system palette only - however we can alloc a bunch
+ * of colors and map to them */
+
+ dprintf_palette(stddeb,"Shared system palette uses %i colors.\n", cs->size);
+
+ /* Set gap to account for pixel shortage. It has to be right in the center
+ * of the system palette because otherwise raster ops get screwed.
+ * ( if we have 100 color palette and application does invert for pixel 1
+ * it gets pixel 254 - far beyond our pathetic palette unless these 100
+ * colors are mapped with the gap in the middle )
+ */
+
+ if( cs->size >= 256 )
+ { COLOR_gapStart = 256; COLOR_gapEnd = -1; }
+ else
+ { COLOR_gapStart = cs->size/2; COLOR_gapEnd = 255 - cs->size/2; }
+
+ COLOR_firstFree = ( cs->size > NB_RESERVED_COLORS &&
+ (cs->flags & COLOR_VIRTUAL || !(cs->flags & COLOR_FIXED)) )
+ ? NB_RESERVED_COLORS/2 : -1;
+
+ COLOR_sysPal = (PALETTEENTRY*)xmalloc(sizeof(PALETTEENTRY)*256);
+
+ /* Setup system palette entry <-> pixel mappings and fill in 20 fixed entries */
+
+ if( screenDepth <= 8 )
+ {
+ COLOR_PixelToPalette = (int*)xmalloc(sizeof(int)*256);
+ COLOR_PaletteToPixel = (int*)xmalloc(sizeof(int)*256);
+
+ for( i = j = 0; i < 256; i++ )
+ {
+ if( i >= COLOR_gapStart && i <= COLOR_gapEnd )
+ {
+ COLOR_PaletteToPixel[i] = 0;
+ COLOR_sysPal[i].peFlags = 0; /* mark as unused */
+ continue;
+ }
+
+ if( i < NB_RESERVED_COLORS/2 )
+ {
+ COLOR_PaletteToPixel[i] = sysPixel[i];
+ COLOR_sysPal[i] = __sysPalTemplate[i];
+ }
+ else if( i >= 256 - NB_RESERVED_COLORS/2 )
+ {
+ COLOR_PaletteToPixel[i] = sysPixel[(i + NB_RESERVED_COLORS) - 256];
+ COLOR_sysPal[i] = __sysPalTemplate[(i + NB_RESERVED_COLORS) - 256];
+ }
+ else if( pixDynMapping )
+ COLOR_PaletteToPixel[i] = pixDynMapping[j++];
+ else
+ COLOR_PaletteToPixel[i] = i;
+
+ dprintf_palette(stddeb,"\tindex %i -> pixel %i\n", i, COLOR_PaletteToPixel[i]);
+
+ memset( COLOR_PixelToPalette, 0, 256*sizeof(int) );
+ COLOR_PixelToPalette[COLOR_PaletteToPixel[i]] = i;
+ }
+ }
+ if( pixDynMapping ) free(pixDynMapping);
+ return TRUE;
}
/***********************************************************************
* COLOR_InitPalette
*
- * Create the system palette.
+ * Create the system palette and initialize mapping tables.
*/
static HPALETTE16 COLOR_InitPalette(void)
{
- int i, size, pixel;
- XColor color;
- HPALETTE16 hpalette;
- LOGPALETTE * palPtr;
- WORD *colorTranslation, *revTranslation;
+ int i;
+ HPALETTE16 hpalette;
+ LOGPALETTE * palPtr;
- size = DefaultVisual( display, DefaultScreen(display) )->map_entries;
- COLOR_ColormapSize = size;
- if (screenDepth <= 8)
- {
- if (!(hSysColorTranslation = GDI_HEAP_ALLOC(sizeof(WORD)*NB_RESERVED_COLORS )))
- return FALSE;
- if (!(hRevSysColorTranslation = GDI_HEAP_ALLOC( sizeof(WORD)*size )))
- return FALSE;
- colorTranslation = (WORD *) GDI_HEAP_LIN_ADDR( hSysColorTranslation );
- revTranslation = (WORD *) GDI_HEAP_LIN_ADDR( hRevSysColorTranslation );
- }
- else colorTranslation = revTranslation = NULL;
+ /* calculate max palette size */
- if ((COLOR_WinColormap == DefaultColormapOfScreen(screen)) && (screenDepth <= 8))
- {
- COLOR_PaletteToPixel = (int *)xmalloc( sizeof(int) * size );
- COLOR_PixelToPalette = (int *)xmalloc( sizeof(int) * size );
- for (i = 0; i < size; i++) /* Set the default mapping */
- COLOR_PaletteToPixel[i] = COLOR_PixelToPalette[i] = i;
- }
+ cSpace.size = visual->map_entries;
- for (i = 0; i < NB_RESERVED_COLORS; i++)
- {
- color.red = COLOR_sysPaletteEntries[i].peRed * 65535 / 255;
- color.green = COLOR_sysPaletteEntries[i].peGreen * 65535 / 255;
- color.blue = COLOR_sysPaletteEntries[i].peBlue * 65535 / 255;
- color.flags = DoRed | DoGreen | DoBlue;
+ if (cSpace.flags & COLOR_PRIVATE)
+ COLOR_BuildPrivateMap( &cSpace );
+ else
+ COLOR_BuildSharedMap( &cSpace );
- if (i < NB_RESERVED_COLORS/2)
- {
- /* Bottom half of the colormap */
- pixel = i;
- if (pixel >= size/2) continue;
- }
- else
- {
- /* Top half of the colormap */
- pixel = size - NB_RESERVED_COLORS + i;
- if (pixel < size/2) continue;
- }
- if (COLOR_WinColormap != DefaultColormapOfScreen(screen))
- {
- color.pixel = pixel;
- XStoreColor( display, COLOR_WinColormap, &color );
- }
- else
- {
- if (!XAllocColor( display, COLOR_WinColormap, &color ))
- {
- fprintf(stderr, "Warning: Not enough free colors. Try using the -privatemap option.\n" );
- color.pixel = color.red = color.green = color.blue = 0;
- }
- else if (COLOR_PaletteToPixel)
- {
- COLOR_PaletteToPixel[pixel] = color.pixel;
- COLOR_PixelToPalette[color.pixel] = pixel;
- }
- }
- if (colorTranslation) colorTranslation[i] = color.pixel;
- if (revTranslation) revTranslation[color.pixel] = i;
- /* Set EGA mapping if color in the first or last eight */
- if (i < 8)
- COLOR_mapEGAPixel[i] = color.pixel;
- else if (i >= NB_RESERVED_COLORS-8)
- COLOR_mapEGAPixel[i - (NB_RESERVED_COLORS-16)] = color.pixel;
- }
+ /* Build free list ( use peRed as "next" ) */
+
+ if( COLOR_firstFree != -1 )
+ COLOR_FormatSystemPalette();
- palPtr = malloc( sizeof(LOGPALETTE) + (NB_RESERVED_COLORS-1)*sizeof(PALETTEENTRY) );
+ /* create default palette (20 system colors) */
+
+ palPtr = xmalloc( sizeof(LOGPALETTE) + (NB_RESERVED_COLORS-1)*sizeof(PALETTEENTRY) );
if (!palPtr) return FALSE;
+
palPtr->palVersion = 0x300;
palPtr->palNumEntries = NB_RESERVED_COLORS;
- memcpy( palPtr->palPalEntry, COLOR_sysPaletteEntries,
- sizeof(COLOR_sysPaletteEntries) );
+ for( i = 0; i < NB_RESERVED_COLORS; i ++ )
+ {
+ palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed;
+ palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen;
+ palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue;
+ palPtr->palPalEntry[i].peFlags = 0;
+ }
hpalette = CreatePalette( palPtr );
free( palPtr );
return hpalette;
}
-void
-COLOR_Computeshifts(unsigned long maskbits, int *shift, int *max)
+
+/***********************************************************************
+ * COLOR_Computeshifts
+ *
+ * Calculate conversion parameters for direct mapped visuals
+ */
+void COLOR_Computeshifts(unsigned long maskbits, int *shift, int *max)
{
int i;
- if(maskbits==0) {
+ if (maskbits==0)
+ {
*shift=0;
*max=0;
return;
*max = maskbits;
}
+
/***********************************************************************
* COLOR_Init
*
* Initialize color map and system palette.
+ *
*/
HPALETTE16 COLOR_Init(void)
{
- Visual * visual = DefaultVisual( display, DefaultScreen(display) );
+ visual = DefaultVisual( display, DefaultScreen(display) );
+
+ dprintf_palette(stddeb,"COLOR_Init: initializing palette manager...");
switch(visual->class)
{
+ case DirectColor:
+ cSpace.flags |= COLOR_VIRTUAL;
case GrayScale:
case PseudoColor:
- case DirectColor:
- COLOR_FixedMap = 0;
if (Options.usePrivateMap)
{
- COLOR_WinColormap = XCreateColormap( display, rootWindow,
+ XSetWindowAttributes win_attr;
+
+ cSpace.flags |= COLOR_PRIVATE;
+ cSpace.colorMap = XCreateColormap( display, rootWindow,
visual, AllocAll );
- if (COLOR_WinColormap)
+ if (cSpace.colorMap)
{
- COLOR_BuildMap( COLOR_WinColormap, screenDepth,
- visual->map_entries );
- if (rootWindow != DefaultRootWindow(display))
- {
- XSetWindowAttributes win_attr;
- win_attr.colormap = COLOR_WinColormap;
+ if( rootWindow != DefaultRootWindow(display) )
+ {
+ win_attr.colormap = cSpace.colorMap;
XChangeWindowAttributes( display, rootWindow,
- CWColormap, &win_attr );
- }
- break;
+ CWColormap, &win_attr );
+ }
+ break;
}
}
- COLOR_WinColormap = DefaultColormapOfScreen( screen );
+ cSpace.colorMap = DefaultColormapOfScreen( screen );
break;
+
case StaticGray:
- COLOR_WinColormap = DefaultColormapOfScreen( screen );
- COLOR_FixedMap = 1;
+ cSpace.colorMap = DefaultColormapOfScreen( screen );
+ cSpace.flags |= COLOR_FIXED;
COLOR_Graymax = (1<<screenDepth)-1;
break;
- case StaticColor:
+
case TrueColor:
- COLOR_WinColormap = DefaultColormapOfScreen( screen );
- COLOR_FixedMap = 1;
+ cSpace.flags |= COLOR_VIRTUAL;
+ case StaticColor:
+ cSpace.colorMap = DefaultColormapOfScreen( screen );
+ cSpace.flags |= COLOR_FIXED;
COLOR_Computeshifts(visual->red_mask, &COLOR_Redshift, &COLOR_Redmax);
COLOR_Computeshifts(visual->green_mask, &COLOR_Greenshift, &COLOR_Greenmax);
COLOR_Computeshifts(visual->blue_mask, &COLOR_Blueshift, &COLOR_Bluemax);
break;
}
+
+ dprintf_palette(stddeb," visual class %i\n", visual->class);
+
return COLOR_InitPalette();
}
BOOL COLOR_IsSolid( COLORREF color )
{
int i;
- const PALETTEENTRY *pEntry = COLOR_sysPaletteEntries;
+ const PALETTEENTRY *pEntry = COLOR_sysPal;
+
+ if (color & 0xff000000) return TRUE; /* indexed color */
- if (color & 0xff000000) return TRUE;
- if (!color || (color == 0xffffff)) return TRUE;
- for (i = NB_RESERVED_COLORS; i > 0; i--, pEntry++)
+ if (!color || (color == 0xffffff)) return TRUE; /* black or white */
+
+ for (i = 0; i < 256 ; i++, pEntry++)
{
+ if( i < COLOR_gapStart || i > COLOR_gapEnd )
if ((GetRValue(color) == pEntry->peRed) &&
(GetGValue(color) == pEntry->peGreen) &&
(GetBValue(color) == pEntry->peBlue)) return TRUE;
/***********************************************************************
- * COLOR_ToPhysical
+ * COLOR_PaletteLookup
*
- * Return the physical color closest to 'color'.
+ */
+int COLOR_PaletteLookupPixel( PALETTEENTRY* palPalEntry, int size,
+ int* mapping, COLORREF col, BOOL skipReserved )
+{
+ int i, best = 0, diff = 0x7fffffff;
+ int r,g,b;
+
+ for( i = 0; i < size; i++ )
+ {
+ if( !(palPalEntry[i].peFlags & PC_SYS_USED) ||
+ (skipReserved && palPalEntry[i].peFlags & PC_SYS_RESERVED) )
+ continue;
+
+ r = palPalEntry[i].peRed - GetRValue(col);
+ g = palPalEntry[i].peGreen - GetGValue(col);
+ b = palPalEntry[i].peBlue - GetBValue(col);
+
+ r = r*r + g*g + b*b;
+
+ if( r < diff ) { best = i; diff = r; }
+ }
+ return (mapping) ? mapping[best] : best;
+}
+
+
+/***********************************************************************
+ * COLOR_PaletteLookupExactIndex
*
- * ESW: This still needs a lot of work; in particular, what happens when
- * we have really large (> 8 bit) DirectColor boards?
- * But it should work better in 16 and 24 bit modes now.
- * (At least it pays attention to the X server's description
- * in TrueColor mode, instead of blindly passing through the
- * color spec and swapping red to blue or losing blue and part of the
- * green entirely, depending on what mode one is in!)
+ */
+int COLOR_PaletteLookupExactIndex( PALETTEENTRY* palPalEntry, int size,
+ COLORREF col )
+{
+ int i;
+ BYTE r = GetRValue(col), g = GetGValue(col), b = GetBValue(col);
+ for( i = 0; i < size; i++ )
+ {
+ if( palPalEntry[i].peFlags & PC_SYS_USED ) /* skip gap */
+ if( palPalEntry[i].peRed == r &&
+ palPalEntry[i].peGreen == g &&
+ palPalEntry[i].peBlue == b )
+ return i;
+ }
+ return -1;
+}
+
+
+/***********************************************************************
+ * COLOR_ToLogical
*
+ * Return RGB color for given X pixel.
+ */
+COLORREF COLOR_ToLogical(int pixel)
+{
+ XColor color;
+
+ if (screenDepth > 8) return pixel;
+ if ((screenDepth <= 8) && (pixel < 256) && !(cSpace.flags & COLOR_VIRTUAL))
+ return ( *(COLORREF*)(COLOR_sysPal + ((COLOR_PixelToPalette)?COLOR_PixelToPalette[pixel]:pixel)) ) & 0x00ffffff;
+
+ color.pixel = pixel;
+ XQueryColor(display, cSpace.colorMap, &color);
+
+ return RGB((color.red * 255)/COLOR_Redmax,
+ (color.green * 255)/COLOR_Greenmax,
+ (color.blue * 255)/COLOR_Bluemax);
+}
+
+
+/***********************************************************************
+ * COLOR_ToPhysical
+ *
+ * Return the physical color closest to 'color'.
*/
int COLOR_ToPhysical( DC *dc, COLORREF color )
{
- WORD index = 0;
- WORD *mapping;
- unsigned char spec_type;
+ WORD index = 0;
+ unsigned char spec_type;
+ HPALETTE16 hPal = (dc)? dc->w.hPalette: STOCK_DEFAULT_PALETTE;
spec_type = color >> 24;
- if (spec_type == 0xff)
- {
+
+ if( spec_type == 0xff )
+ {
spec_type = 0; /* 'write' seems to need that for 'Page 1' text */
color &= 0xffffff;
- }
- if (spec_type > 2)
- fprintf(stderr, "COLOR_ToPhysical : color >> 24 not in {-1,0,1,2} : %08lx\n",
- color);
+ }
+
+ if( spec_type > 2 )
+ {
+ fprintf(stderr, "COLOR_ToPhysical : invalid RGB specifier for: %08lx\n", color);
+ spec_type = 0;
+ }
+
if (dc && (dc->w.bitsPerPixel == 1) && (spec_type == 0))
{
/* monochrome */
if (((color >> 16) & 0xff) +
((color >> 8) & 0xff) + (color & 0xff) > 255*3/2)
- return 1; /* white */
- else return 0; /* black */
+ return 1; /* white */
+ else return 0; /* black */
}
- if (COLOR_FixedMap)
+ if ( cSpace.flags & COLOR_FIXED )
{
- /* there is no colormap possible; we are going to have to compute
- the pixel value from the visual information stored earlier */
+ /* there is no colormap limitation; we are going to have to compute
+ * the pixel value from the visual information stored earlier
+ */
- unsigned long red, green, blue;
- unsigned idx;
- PALETTEOBJ * palPtr;
+ unsigned long red, green, blue;
+ unsigned idx = 0;
+ PALETTEOBJ * palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
switch(spec_type)
{
- case 0: /* RGB */
- case 2: /* PALETTERGB -- needs some work, but why bother; we've got a REALLY LARGE number of colors...? */
- default:
+ default:
+ case 0: /* RGB */
+
red = GetRValue(color);
green = GetGValue(color);
blue = GetBValue(color);
break;
- case 1: /* PALETTEIDX -- hmm, get the real color from the stock palette */
- palPtr = (PALETTEOBJ *) GDI_GetObjPtr( STOCK_DEFAULT_PALETTE, PALETTE_MAGIC);
- idx = color & 0xffff;
+ case 2: /* PALETTERGB - not sure if we really need to search palette */
+
+ idx = COLOR_PaletteLookupPixel( palPtr->logpalette.palPalEntry,
+ palPtr->logpalette.palNumEntries,
+ NULL, color, FALSE);
+ case 1: /* PALETTEINDEX */
+
+ idx = ((spec_type == 1)?color:idx) & 0xffff;
+
if (idx >= palPtr->logpalette.palNumEntries)
{
- fprintf(stderr, "COLOR_ToPhysical(%lx) : idx %d is out of bounds, assuming black\n", color, idx);
+ fprintf(stderr, "\tRGB(%lx) : idx %d is out of bounds, assuming black\n", color, idx);
/* out of bounds */
red = green = blue = 0;
}
- else
+ else if( palPtr->mapping ) return palPtr->mapping[idx];
+ else
{
red = palPtr->logpalette.palPalEntry[idx].peRed;
green = palPtr->logpalette.palPalEntry[idx].peGreen;
return (red << COLOR_Redshift) | (green << COLOR_Greenshift) | (blue << COLOR_Blueshift);
}
}
- else switch(spec_type)
- {
- default:
- case 0: /* RGB */
- index = GetNearestPaletteIndex( STOCK_DEFAULT_PALETTE, color );
- break;
- case 1: /* PALETTEINDEX */
- index = color & 0xffff;
- break;
- case 2: /* PALETTERGB */
- if (dc) index = GetNearestPaletteIndex( dc->w.hPalette, color );
- else index = 0;
- break;
- }
- if (dc&&dc->u.x.pal.mappingSize)
- {
- if (index >= dc->u.x.pal.mappingSize)
- {
- fprintf(stderr, "COLOR_ToPhysical(%lx) : idx %d is >= dc->u.x.pal.mappingSize, assuming pixel 0\n", color, index);
- return 0;
- }
- mapping = (WORD *) GDI_HEAP_LIN_ADDR( dc->u.x.pal.hMapping );
- }
- else
+ else
{
- if (index >= NB_RESERVED_COLORS)
- {
- fprintf(stderr, "COLOR_ToPhysical(%lx) : idx %d is >= NB_RESERVED_COLORS, assuming pixel 0\n", color, index);
- return 0;
- }
- mapping = (WORD *) GDI_HEAP_LIN_ADDR( hSysColorTranslation );
+ PALETTEOBJ* palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC);
+
+ /* palPtr can be NULL when DC is being destroyed */
+
+ if( !palPtr ) return 0;
+ else if( !palPtr->mapping )
+ dprintf_palette(stddeb,"\tpalette %04x is not realized\n", dc->w.hPalette);
+
+ switch(spec_type) /* we have to peruse DC and system palette */
+ {
+ default:
+ case 0: /* RGB */
+ index = COLOR_PaletteLookupPixel( COLOR_sysPal, 256,
+ COLOR_PaletteToPixel, color, FALSE);
+
+ /* dprintf_palette(stddeb,"\tRGB(%lx) -> pixel %i\n", color, index);
+ */
+ break;
+ case 1: /* PALETTEINDEX */
+ index = color & 0xffff;
+
+ if( index >= palPtr->logpalette.palNumEntries )
+ fprintf(stderr, "\tRGB(%lx) : index %i is out of bounds\n", color, index);
+ else if( palPtr->mapping ) index = palPtr->mapping[index];
+
+ /* dprintf_palette(stddeb,"\tPALETTEINDEX(%04x) -> pixel %i\n", (WORD)color, index);
+ */
+ break;
+ case 2: /* PALETTERGB */
+ index = COLOR_PaletteLookupPixel( palPtr->logpalette.palPalEntry,
+ palPtr->logpalette.palNumEntries,
+ palPtr->mapping, color, FALSE);
+ /* dprintf_palette(stddeb,"\tPALETTERGB(%lx) -> pixel %i\n", color, index);
+ */
+ break;
+ }
}
- if (mapping) return mapping[index];
- else return index; /* Identity mapping */
+
+ return index;
}
/***********************************************************************
* COLOR_SetMapping
*
- * Set the color-mapping table in a DC.
+ * Set the color-mapping table for selected palette.
+ * Return number of entries which mapping has changed.
*/
-void COLOR_SetMapping( DC *dc, HANDLE map, HANDLE revMap, WORD size )
+int COLOR_SetMapping( PALETTEOBJ* palPtr, BOOL mapOnly )
{
- WORD *pmap, *pnewmap;
- WORD i;
-
- if (dc->u.x.pal.hMapping && (dc->u.x.pal.hMapping != hSysColorTranslation))
- GDI_HEAP_FREE( dc->u.x.pal.hMapping );
- if (dc->u.x.pal.hRevMapping &&
- (dc->u.x.pal.hRevMapping != hRevSysColorTranslation))
- GDI_HEAP_FREE( dc->u.x.pal.hRevMapping );
- if (map && (map != hSysColorTranslation))
- {
- /* Copy mapping table */
- dc->u.x.pal.hMapping = GDI_HEAP_ALLOC( sizeof(WORD) * size );
- pmap = (WORD *) GDI_HEAP_LIN_ADDR( map );
- pnewmap = (WORD *) GDI_HEAP_LIN_ADDR( dc->u.x.pal.hMapping );
- memcpy( pnewmap, pmap, sizeof(WORD)*size );
- /* Build reverse table */
- dc->u.x.pal.hRevMapping = GDI_HEAP_ALLOC(sizeof(WORD)*COLOR_ColormapSize);
- pmap = (WORD *) GDI_HEAP_LIN_ADDR( dc->u.x.pal.hRevMapping );
- for (i = 0; i < size; i++) pmap[pnewmap[i]] = i;
- }
- else
+ int i, index;
+ char flag;
+ int prevMapping = (palPtr->mapping) ? 1 : 0;
+ int iRemapped = 0;
+
+ /* free dynamic colors in system palette -
+ * certain optimization is to free them only when they are needed */
+
+ if( !mapOnly && COLOR_firstFree != -1)
+ COLOR_FormatSystemPalette();
+
+ /* initialize palette mapping table */
+
+ palPtr->mapping = (int*)xrealloc(palPtr->mapping, sizeof(int)*
+ palPtr->logpalette.palNumEntries);
+
+ for( i = 0; i < palPtr->logpalette.palNumEntries; i++ )
{
- dc->u.x.pal.hMapping = map;
- dc->u.x.pal.hRevMapping = map ? hRevSysColorTranslation : 0;
- }
- dc->u.x.pal.mappingSize = size;
-}
+ index = -1;
+ flag = PC_SYS_USED;
+ switch( palPtr->logpalette.palPalEntry[i].peFlags & 0x07 )
+ {
+ case PC_EXPLICIT: /* palette entries are indices into system palette */
+ index = *(WORD*)(palPtr->logpalette.palPalEntry + i);
+ if( index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd) )
+ {
+ fprintf(stderr,"PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index);
+ index = 0;
+ }
+ break;
-/***********************************************************************
- * RealizeDefaultPalette (GDI.365)
- */
-WORD RealizeDefaultPalette( HDC hdc )
-{
- DC *dc;
- if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
- dc->w.hPalette = STOCK_DEFAULT_PALETTE;
- COLOR_SetMapping( dc, hSysColorTranslation,
- hRevSysColorTranslation, NB_RESERVED_COLORS );
- return NB_RESERVED_COLORS;
+ case PC_RESERVED: /* forbid future mappings to this entry */
+ flag |= PC_SYS_RESERVED;
+ /* fall through */
+ default: /* try to collapse identical colors */
+ index = COLOR_PaletteLookupExactIndex(COLOR_sysPal, 256,
+ *(COLORREF*)(palPtr->logpalette.palPalEntry + i));
+ /* fall through */
+ case PC_NOCOLLAPSE:
+ if( index < 0 )
+ {
+ if( COLOR_firstFree > 0 && !(cSpace.flags & COLOR_FIXED) && !mapOnly )
+ {
+ XColor color;
+ index = COLOR_firstFree; /* ought to be available */
+ COLOR_firstFree = COLOR_sysPal[index].peRed;
+ color.pixel = (COLOR_PaletteToPixel) ? COLOR_PaletteToPixel[index] : index;
+ color.red = palPtr->logpalette.palPalEntry[i].peRed * 65535 / 255;
+ color.green = palPtr->logpalette.palPalEntry[i].peGreen * 65535 / 255;
+ color.blue = palPtr->logpalette.palPalEntry[i].peBlue * 65535 / 255;
+ color.flags = DoRed | DoGreen | DoBlue;
+ XStoreColor(display, cSpace.colorMap, &color);
+ COLOR_sysPal[index] = palPtr->logpalette.palPalEntry[i];
+ COLOR_sysPal[index].peFlags = flag;
+ if( COLOR_PaletteToPixel ) index = COLOR_PaletteToPixel[index];
+ break;
+ }
+ else if ( cSpace.flags & COLOR_VIRTUAL )
+ {
+ index = COLOR_ToPhysical( NULL, 0x00ffffff &
+ *(COLORREF*)(palPtr->logpalette.palPalEntry + i));
+ break;
+ }
+
+ /* we have to map to existing entry in the system palette */
+
+ index = COLOR_PaletteLookupPixel(COLOR_sysPal, 256, NULL,
+ *(COLORREF*)(palPtr->logpalette.palPalEntry + i), TRUE);
+ }
+
+ if( COLOR_PaletteToPixel ) index = COLOR_PaletteToPixel[index];
+ break;
+ }
+
+ if( !prevMapping || palPtr->mapping[i] != index ) iRemapped++;
+ palPtr->mapping[i] = index;
+
+ /* dprintf_palette(stddeb,"\tentry %i (%lx) -> pixel %i\n", i,
+ *(COLORREF*)(palPtr->logpalette.palPalEntry + i), index);
+ */
+ }
+ return iRemapped;
}
* 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,
width, height, colors );
if (entry) *dirEntry = *entry;
}
- FreeResource( hMem );
+ FreeResource16( hMem );
return (entry != NULL);
}
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 */
/* 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;
}
/***********************************************************************
* 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,
/***********************************************************************
* 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",
*/
WORD GetIconID( HANDLE hResource, DWORD resType )
{
- CURSORICONDIR *lpDir = LockResource(hResource);
+ CURSORICONDIR *lpDir = LockResource16(hResource);
if (!lpDir || lpDir->idReserved ||
((lpDir->idType != 1) && (lpDir->idType != 2)))
*/
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);
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;
}
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 );
}
/***********************************************************************
- * 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
*/
{
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 );
#define OBJ_PEN 1
#define OBJ_BRUSH 2
-#define MAX_OBJ 1024
-HANDLE *lpPenBrushList = NULL;
-
-
/***********************************************************************
* GDI stock objects
*/
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 );
}
/***********************************************************************
* 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;
}
* LineDDA (GDI.100)
*/
void LineDDA(short nXStart, short nYStart, short nXEnd, short nYEnd,
- FARPROC callback, long lParam)
+ FARPROC16 callback, long lParam)
{
int xadd = 1, yadd = 1;
int err,erradd;
attrs = (XpmAttributes *)xmalloc( XpmAttributesSize() );
attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
- attrs->colormap = COLOR_WinColormap;
+ attrs->colormap = COLOR_GetColormap();
attrs->depth = color ? screenDepth : 1;
attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
* GDI palette objects
*
* Copyright 1993,1994 Alexandre Julliard
+ * Copyright 1996 Alex Korobka
*
*/
#include <stdlib.h>
/* #define DEBUG_PALETTE */
#include "debug.h"
+extern HWND DCE_hDC2hWnd( HDC ); /* get associated window by
+ * walking DCE list */
+
static WORD SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */
+static HPALETTE16 hPrimaryPalette = 0; /* used for WM_PALETTECHANGED */
+static HPALETTE16 hLastRealizedPalette = 0; /* UnrealizeObject() needs it */
+
/***********************************************************************
* PALETTE_GetNearestIndexAndColor
*/
-static WORD PALETTE_GetNearestIndexAndColor(HPALETTE16 hpalette, COLORREF *color)
+static WORD PALETTE_GetNearestIndexAndColor( HPALETTE16 hpalette,
+ COLORREF *color)
{
int i, minDist, dist;
WORD index = 0;
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
if (!palPtr) return 0;
- if ((COLOR_WinColormap != DefaultColormapOfScreen(screen)) &&
- (hpalette == STOCK_DEFAULT_PALETTE))
+ if ( hpalette == STOCK_DEFAULT_PALETTE )
{
if ((*color & 0xffffff) == 0) return 0; /* Entry 0 is black */
if ((*color & 0xffffff) == 0xffffff) /* Max entry is white */
return palPtr->logpalette.palNumEntries - 1;
}
-
+
r = GetRValue(*color);
g = GetGValue(*color);
b = GetBValue(*color);
}
entry++;
}
+
entry = &palPtr->logpalette.palPalEntry[index];
*color = RGB( entry->peRed, entry->peGreen, entry->peBlue );
return index;
}
+/***********************************************************************
+ * PALETTE_ValidateFlags
+ */
+void PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, int size)
+{
+ int i = 0;
+ for( ; i<size ; i++ )
+ lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07);
+}
+
+
/***********************************************************************
* CreatePalette (GDI.360)
*/
{
PALETTEOBJ * palettePtr;
HPALETTE16 hpalette;
- int size;
+ int size = sizeof(LOGPALETTE) + (palette->palNumEntries - 1) * sizeof(PALETTEENTRY);
+
+ dprintf_palette(stddeb,"CreatePalette: ");
- size = sizeof(LOGPALETTE) + (palette->palNumEntries - 1) * sizeof(PALETTEENTRY);
- hpalette = GDI_AllocObject( sizeof(GDIOBJHDR) + size, PALETTE_MAGIC );
+ dprintf_palette(stddeb,"%i entries, ", palette->palNumEntries);
+
+ hpalette = GDI_AllocObject( size + sizeof(int*) +sizeof(GDIOBJHDR) , PALETTE_MAGIC );
if (!hpalette) return 0;
+
palettePtr = (PALETTEOBJ *) GDI_HEAP_LIN_ADDR( hpalette );
memcpy( &palettePtr->logpalette, palette, size );
+ PALETTE_ValidateFlags(palettePtr->logpalette.palPalEntry,
+ palettePtr->logpalette.palNumEntries);
+ palettePtr->mapping = NULL;
+
+ dprintf_palette(stddeb,"returning %04x\n", hpalette);
return hpalette;
}
{
PALETTEOBJ * palPtr;
int numEntries;
+
+ dprintf_palette(stddeb,"GetPaletteEntries: hpal = %04x, %i entries\n", hpalette, count);
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
if (!palPtr) return 0;
+
numEntries = palPtr->logpalette.palNumEntries;
if (start >= numEntries) return 0;
if (start+count > numEntries) count = numEntries - start;
memcpy( entries, &palPtr->logpalette.palPalEntry[start],
count * sizeof(PALETTEENTRY) );
+ for( numEntries = 0; numEntries < count ; numEntries++ )
+ if( entries[numEntries].peFlags & 0xF0 ) entries[numEntries].peFlags = 0;
return count;
}
{
PALETTEOBJ * palPtr;
int numEntries;
-
+
+ dprintf_palette(stddeb,"SetPaletteEntries: hpal = %04x, %i entries\n", hpalette, count);
+
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
if (!palPtr) return 0;
+
numEntries = palPtr->logpalette.palNumEntries;
if (start >= numEntries) return 0;
if (start+count > numEntries) count = numEntries - start;
memcpy( &palPtr->logpalette.palPalEntry[start], entries,
count * sizeof(PALETTEENTRY) );
+ PALETTE_ValidateFlags(palPtr->logpalette.palPalEntry,
+ palPtr->logpalette.palNumEntries);
return count;
}
*/
BOOL ResizePalette(HPALETTE16 hPal, UINT cEntries)
{
+
+ /* should simply realloc memory and zero out
+ * added entries, if any */
+
fprintf(stdnimp,"ResizePalette: empty stub! \n");
return FALSE;
}
/***********************************************************************
* SetSystemPaletteUse (GDI.373)
- * Should this be per DC rather than system wide?
- * Currently, it does not matter as the use is only set and returned,
- * but not taken into account
*/
WORD SetSystemPaletteUse( HDC hdc, WORD use)
{
WORD old=SystemPaletteUse;
- printf("SetSystemPaletteUse(%04x,%04x) // empty stub !!!\n", hdc, use);
+ fprintf(stdnimp,"SetSystemPaletteUse(%04x,%04x) // empty stub !!!\n", hdc, use);
SystemPaletteUse=use;
return old;
}
*/
WORD GetSystemPaletteUse( HDC hdc )
{
- printf("GetSystemPaletteUse(%04x) // empty stub !!!\n", hdc);
+ fprintf(stdnimp,"GetSystemPaletteUse(%04x) // empty stub !!!\n", hdc);
return SystemPaletteUse;
}
count = dc->w.devCaps->sizePalette - start;
for (i = 0; i < count; i++)
{
- color.pixel = start + i;
- XQueryColor( display, COLOR_WinColormap, &color );
+ color.pixel = (COLOR_PaletteToPixel)
+ ? COLOR_PaletteToPixel[start + i]
+ : start + i;
+ XQueryColor( display, COLOR_GetColormap(), &color );
entries[i].peRed = color.red >> 8;
entries[i].peGreen = color.green >> 8;
entries[i].peBlue = color.blue >> 8;
}
+/***********************************************************************
+ * PALETTE_UnrealizeObject
+ */
+BOOL PALETTE_UnrealizeObject( HPALETTE16 hpalette, PALETTEOBJ *palette )
+{
+ if (palette->mapping)
+ {
+ free( palette->mapping );
+ palette->mapping = NULL;
+ }
+ if (hLastRealizedPalette == hpalette) hLastRealizedPalette = 0;
+ return TRUE;
+}
+
+
+/***********************************************************************
+ * PALETTE_DeleteObject
+ */
+BOOL PALETTE_DeleteObject( HPALETTE16 hpalette, PALETTEOBJ *palette )
+{
+ free( palette->mapping );
+ return GDI_FreeObject( hpalette );
+}
+
+
/***********************************************************************
* GDISelectPalette (GDI.361)
*/
-HPALETTE16 GDISelectPalette( HDC hdc, HPALETTE16 hpal )
+HPALETTE16 GDISelectPalette( HDC hdc, HPALETTE16 hpal, WORD wBkg)
{
HPALETTE16 prev;
DC *dc;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
prev = dc->w.hPalette;
dc->w.hPalette = hpal;
- if (hpal != STOCK_DEFAULT_PALETTE) COLOR_SetMapping( dc, 0, 0, 0 );
- else RealizeDefaultPalette( hdc ); /* Always realize default palette */
+ if (!wBkg) hPrimaryPalette = hpal;
return prev;
}
/***********************************************************************
* GDIRealizePalette (GDI.362)
+ *
*/
UINT GDIRealizePalette( HDC hdc )
{
- UINT realized = 0;
- COLORREF color;
DC* dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ) ;
PALETTEOBJ* palPtr;
+ int realized = 0;
- dprintf_palette(stdnimp, "GDIRealizePalette: %04x...", hdc );
-
- if( dc )
- {
+ dprintf_palette(stddeb, "GDIRealizePalette: %04x...", hdc );
+
+ if( dc && dc->w.hPalette != hLastRealizedPalette )
+ {
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( dc->w.hPalette, PALETTE_MAGIC );
-
- if( palPtr )
- {
- WORD index, i;
- HANDLE hMap;
- WORD* pMap;
-
- hMap = GDI_HEAP_ALLOC(sizeof(WORD)*palPtr->logpalette.palNumEntries);
- pMap = (WORD*)GDI_HEAP_LIN_ADDR( hMap );
-
- if( pMap )
- {
- for (i = 0; i < palPtr->logpalette.palNumEntries ; i++)
- {
- color = *(COLORREF*)(palPtr->logpalette.palPalEntry + i);
- index = PALETTE_GetNearestIndexAndColor( STOCK_DEFAULT_PALETTE, &color);
- if( index != i ) realized++;
- pMap[i] = index;
- }
- COLOR_SetMapping(dc, hMap, 0, i);
- GDI_HEAP_FREE(hMap);
- }
- }
- }
+
+ realized = COLOR_SetMapping(palPtr, dc->w.hPalette != hPrimaryPalette
+ || dc->w.hPalette == STOCK_DEFAULT_PALETTE );
+ hLastRealizedPalette = dc->w.hPalette;
+ }
+ else dprintf_palette(stddeb, " skipping ");
+
dprintf_palette(stdnimp, " realized %i colors\n", realized );
- return realized;
+ return (UINT)realized;
}
/***********************************************************************
- * SelectPalette (USER.282)
+ * RealizeDefaultPalette (GDI.365)
*/
-HPALETTE16 SelectPalette(HDC hDC, HPALETTE16 hPal, BOOL bForceBackground)
+WORD RealizeDefaultPalette( HDC hdc )
{
- return GDISelectPalette( hDC, hPal );
+ DC *dc;
+
+ dprintf_palette(stddeb,"RealizeDefaultPalette: %04x\n", hdc );
+
+ if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
+ if ( dc->w.flags & DC_MEMORY ) return 0;
+
+ hPrimaryPalette = STOCK_DEFAULT_PALETTE;
+ hLastRealizedPalette = STOCK_DEFAULT_PALETTE;
+ return COLOR_SetMapping( (PALETTEOBJ*)GDI_GetObjPtr(STOCK_DEFAULT_PALETTE, PALETTE_MAGIC ), TRUE);
}
/***********************************************************************
- * SelectPalette32 (GDI32.300)
+ * IsDCCurrentPalette (GDI.412)
*/
-HPALETTE16 SelectPalette32(HDC hDC, HPALETTE16 hPal, BOOL bForceBackground)
+BOOL IsDCCurrentPalette(HDC hDC)
{
- return GDISelectPalette( hDC, hPal );
+ DC* dc = (DC *)GDI_GetObjPtr( hDC, DC_MAGIC );
+ return (dc->w.hPalette == hPrimaryPalette);
}
-
/***********************************************************************
- * RealizePalette (USER.283)
+ * SelectPalette (USER.282)
*/
-UINT RealizePalette(HDC hDC)
+HPALETTE16 SelectPalette( HDC hDC, HPALETTE16 hPal, BOOL bForceBackground )
{
- return GDIRealizePalette( hDC );
+ WORD wBkgPalette = 1;
+ PALETTEOBJ* lpt = (PALETTEOBJ*) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
+
+ dprintf_palette(stddeb,"SelectPalette: dc %04x pal %04x, force=%i ",
+ hDC, hPal, bForceBackground);
+ if( !lpt ) return 0;
+
+ dprintf_palette(stddeb," entries = %d\n",
+ lpt->logpalette.palNumEntries);
+
+ if( hPal != STOCK_DEFAULT_PALETTE )
+ {
+ HWND hWnd = DCE_hDC2hWnd( hDC );
+ HWND hActive = GetActiveWindow();
+
+ /* set primary palette if it's related to current active */
+
+ if( hWnd && (hActive == hWnd || IsChild(hActive,hWnd)) &&
+ !bForceBackground )
+ wBkgPalette = 0;
+ }
+ return GDISelectPalette( hDC, hPal, wBkgPalette);
}
/***********************************************************************
- * RealizePalette32 (GDI32.280)
+ * RealizePalette (USER.283) (GDI32.280)
*/
-UINT RealizePalette32(HDC hDC)
+UINT16 RealizePalette( HDC32 hDC )
{
- return GDIRealizePalette( hDC );
+ UINT16 realized = GDIRealizePalette( hDC );
+
+ /* do not send anything if no colors were changed */
+
+ if( IsDCCurrentPalette( hDC ) && realized )
+ {
+ /* Send palette change notification */
+
+ HWND hWnd;
+ if( (hWnd = DCE_hDC2hWnd( hDC )) )
+ SendMessage16( HWND_BROADCAST, WM_PALETTECHANGED, hWnd, 0L);
+ }
+ return realized;
}
+
+/**********************************************************************
+ * UpdateColors (GDI.366)
+ *
+ */
+int UpdateColors( HDC hDC )
+{
+ HWND hWnd = DCE_hDC2hWnd( hDC );
+
+ /* Docs say that we have to remap current drawable pixel by pixel
+ * but it would take forever given the speed of XGet/PutPixel.
+ */
+ if (hWnd) InvalidateRect16( hWnd, NULL, FALSE );
+ return 0x666;
+}
/***********************************************************************
* GrayString (USER.185)
*/
-BOOL GrayString(HDC hdc, HBRUSH hbr, FARPROC gsprc, LPARAM lParam,
+BOOL GrayString(HDC hdc, HBRUSH hbr, FARPROC16 gsprc, LPARAM lParam,
INT cch, INT x, INT y, INT cx, INT cy)
{
BOOL ret;
return strlen(str);
}
-SEGPTR lstrcpy( SEGPTR target, SEGPTR source )
+LPSTR lstrcpy32A( LPSTR dst, LPCSTR src )
{
- strcpy( (char *)target, (char *)source );
- return target;
+ if (!src || !dst) return NULL;
+ strcpy( dst, src );
+ return dst;
}
void hmemcpy(LPVOID hpvDest, LPCVOID hpvSource, LONG cbCopy)
hlpfile->lpszPath = GlobalLock(hHlpFile);
hlpfile->lpszPath += sizeof(HLPFILE);
- lstrcpy(hlpfile->lpszPath, (SEGPTR) lpszPath);
+ strcpy(hlpfile->lpszPath, lpszPath);
phrases.hBuffer = topic.hBuffer = hFileBuffer = 0;
/* Create main Window */
if (!page) LoadString(Globals.hInstance, IDS_WINE_HELP, szCaption, sizeof(szCaption));
hWnd = CreateWindow (bPopup ? TEXT_WIN_CLASS_NAME : MAIN_WIN_CLASS_NAME,
- page ? (SEGPTR) page->file->lpszTitle : (SEGPTR) szCaption,
+ page ? page->file->lpszTitle : szCaption,
bPopup ? WS_POPUPWINDOW | WS_BORDER : WS_OVERLAPPEDWINDOW,
origin.x, origin.y, size.cx, size.cy,
0, bPrimary ? LoadMenu(Globals.hInstance, STRING_MENU_Xx) : 0,
- Globals.hInstance, (SEGPTR) win);
+ Globals.hInstance, win);
ShowWindow (hWnd, nCmdShow);
UpdateWindow (hWnd);
/* Create button box and text Window */
CreateWindow(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE,
- 0, 0, 0, 0, hWnd, 0, Globals.hInstance, (SEGPTR) win);
+ 0, 0, 0, 0, hWnd, 0, Globals.hInstance, win);
CreateWindow(TEXT_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE,
- 0, 0, 0, 0, hWnd, 0, Globals.hInstance, (SEGPTR) win);
+ 0, 0, 0, 0, hWnd, 0, Globals.hInstance, win);
/* Fall through */
case WM_USER:
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
PROGRAM = winerc
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
-
MODULE = resources
LANGUAGES = En Es De No Fr Fi Da Cz Eo It Ko
-TOPSRC = @top_srcdir@
+DEFS = -D__WINE__
+TOPSRC = @top_srcdir@
PROGRAM = build
MODULE = none
* (ebp) previous ebp
*
* Prototypes for the CallTo16 functions:
- * extern WORD CallTo16_word_xxx( FARPROC func, WORD ds, args... );
- * extern LONG CallTo16_long_xxx( FARPROC func, WORD ds, args... );
- * extern void CallTo16_regs_( FARPROC func, WORD ds, WORD es, WORD bp,
+ * extern WORD CallTo16_word_xxx( FARPROC16 func, WORD ds, args... );
+ * extern LONG CallTo16_long_xxx( FARPROC16 func, WORD ds, args... );
+ * extern void CallTo16_regs_( FARPROC16 func, WORD ds, WORD es, WORD bp,
* WORD ax, WORD bx, WORD cx, WORD dx,
* WORD si, WORD di );
*/
* (ebp) previous ebp
*
* Prototype for the CallTo32 functions:
- * extern LONG CallTo32_nn( FARPROC func, args... );
+ * extern LONG CallTo32_nn( FARPROC32 func, args... );
*/
static void BuildCallTo32Func( int args )
{
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = win32
newfns.c \
object_mgt.c \
process.c \
- resource.c \
string32.c \
struct32.c \
thread.c \
#include "win.h"
#include "struct32.h"
#include "string32.h"
-#include "resource32.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
/***********************************************************************
- * LoadCursor
+ * LoadCursorW (USER32.361)
*/
-HCURSOR WIN32_LoadCursorW( HANDLE hInstance, LPCWSTR name )
+HCURSOR32 LoadCursor32W(HINSTANCE32 hInstance,LPCWSTR name)
{
return CURSORICON32_Load( hInstance, name,
SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE);
}
-HCURSOR WIN32_LoadCursorA(HANDLE hInstance, LPCSTR name)
+/***********************************************************************
+ * LoadCursorA (USER32.358)
+ */
+HCURSOR32 LoadCursor32A(HINSTANCE32 hInstance,LPCSTR name)
{
- HCURSOR res=0;
+ HCURSOR32 res=0;
if(!HIWORD(name))
- return WIN32_LoadCursorW(hInstance, name);
+ return LoadCursor32W(hInstance,(LPCWSTR)name);
else {
LPWSTR uni = STRING32_DupAnsiToUni(name);
- res = WIN32_LoadCursorW(hInstance, uni);
+ res = LoadCursor32W(hInstance, uni);
free(uni);
}
return res;
/***********************************************************************
- * LoadIcon
+ * LoadIconW (USER32.363)
*/
-HICON WIN32_LoadIconW( HANDLE hInstance, LPCWSTR name )
+HICON32 LoadIcon32W(HINSTANCE32 hInstance,LPCWSTR name)
{
return CURSORICON32_Load( hInstance, name,
SYSMETRICS_CXICON, SYSMETRICS_CYICON,
MIN( 16, 1 << screenDepth ), FALSE );
}
-HICON WIN32_LoadIconA( HANDLE hInstance, LPCSTR name)
+/***********************************************************************
+ * LoadIconA (USER32.362)
+ */
+HICON32 LoadIcon32A(HINSTANCE32 hInstance,LPCSTR name)
{
- HICON res=0;
+ HICON32 res=0;
if(!HIWORD(name))
- return WIN32_LoadIconW(hInstance, name);
+ return LoadIcon32W(hInstance, (LPCWSTR)name);
else {
LPWSTR uni = STRING32_DupAnsiToUni(name);
- res = WIN32_LoadIconW(hInstance, uni);
+ res = LoadIcon32W(hInstance, uni);
free(uni);
}
return res;
}
-
+
char *cp;
PDB *pdb = (PDB *)GlobalLock16( GetCurrentPDB() );
-#ifndef WINELIB
- strcpy(buffer, MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ) );
- cp = buffer+strlen(buffer);
- *cp++ = ' ';
-#else
- cp = buffer;
-#endif;
- memcpy( cp, &pdb->cmdLine[1], pdb->cmdLine[0] );
+ lstrcpyn32A( buffer, MODULE_GetModuleName( GetExePtr(GetCurrentTask()) ),
+ sizeof(buffer) - 1 );
+ cp = buffer + strlen(buffer);
+ if (pdb->cmdLine[0])
+ {
+ *cp++ = ' ';
+ memcpy( cp, &pdb->cmdLine[1], pdb->cmdLine[0] );
+ }
dprintf_win32(stddeb,"CommandLine = %s\n", buffer );
return buffer;
}
/***********************************************************************
* GetModuleFileNameA (KERNEL32.235)
*/
-DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
+DWORD GetModuleFileNameA(HMODULE32 hModule, LPSTR lpFilename, DWORD nSize)
{
strcpy(lpFilename, "c:\\dummy");
return 8;
/***********************************************************************
* GetModuleHandle (KERNEL32.237)
*/
-HMODULE WIN32_GetModuleHandle(char *module)
+HMODULE32 WIN32_GetModuleHandle(char *module)
{
- HMODULE hModule;
+ HMODULE32 hModule;
dprintf_win32(stddeb, "GetModuleHandle: %s\n", module ? module : "NULL");
/* Freecell uses the result of GetModuleHandleA(0) as the hInstance in
return WinHelp(hWnd,lpszHelp,uCommand,dwData);
}
-HHOOK SetWindowsHookEx32A(int HookId, HOOKPROC hookfn, HINSTANCE hModule,
+HHOOK SetWindowsHookEx32A(int HookId, HOOKPROC32 hookfn, HINSTANCE hModule,
DWORD ThreadId)
{
BOOL GetProcessAffinityMask(HANDLE32 hProcess, LPDWORD lpProcessAffinityMask,
LPDWORD lpSystemAffinityMask)
{
- dprintf_task(stddeb,"GetProcessAffinityMask(%x,%x,%x)\n",
+ dprintf_task(stddeb,"GetProcessAffinityMask(%x,%lx,%lx)\n",
hProcess,(lpProcessAffinityMask?*lpProcessAffinityMask:0),
(lpSystemAffinityMask?*lpSystemAffinityMask:0));
/* It is definitely important for a process to know on what processor
*/
BOOL SetThreadAffinityMask(HANDLE32 hThread, DWORD dwThreadAffinityMask)
{
- dprintf_task(stddeb,"SetThreadAffinityMask(%x,%x)\n",hThread,
+ dprintf_task(stddeb,"SetThreadAffinityMask(%x,%lx)\n",hThread,
dwThreadAffinityMask);
/* FIXME: We let it fail */
return 1;
+++ /dev/null
-/*
- * Win32 Resources
- *
- * Copyright 1995 Thomas Sandford
- * Copyright 1996 Martin von Loewis
- *
- * 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 <sys/types.h>
-#include "wintypes.h"
-#include "windows.h"
-#include "kernel32.h"
-#include "pe_image.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"
-#include "debug.h"
-
-int language = 0x0409;
-
-#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)
-{
- int entrynum;
- PIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
- int namelen;
-
- 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 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;
- }
-}
-
-/**********************************************************************
- * GetResDirEntryA
- *
- * Helper function - goes down one level of PE resource tree
- *
- */
-PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY resdirptr,
- LPCSTR name,
- DWORD root)
-{
- 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;
-}
-
-/**********************************************************************
- * FindResourceA (KERNEL32.128)
- */
-HANDLE32 FindResource32A( HINSTANCE 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;
-}
-
-/**********************************************************************
- * FindResourceW (KERNEL32.131)
- */
-HANDLE32 FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
-{
-#ifndef WINELIB
- PE_MODULE *pe;
- NE_MODULE *pModule;
- PIMAGE_RESOURCE_DIRECTORY resdirptr;
- DWORD root;
- HANDLE32 result;
-
- /* 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, "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;
-
-#else
- return LIBRES_FindResource( hModule, name, type );
-#endif
-}
-
-
-/**********************************************************************
- * LoadResource (KERNEL32.370)
- */
-HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc )
-{
-#ifndef WINELIB
- 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, "LoadResource: 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);
-#else
- return LIBRES_LoadResource( hModule, hRsrc );
-#endif
-}
-
-
-/**********************************************************************
- * LockResource (KERNEL.62)
- */
-LPVOID LockResource32( HANDLE32 handle )
-{
- return (LPVOID) handle;
-}
-
-/**********************************************************************
- * FreeResource (KERNEL.63)
- */
-BOOL FreeResource32( HANDLE32 handle )
-{
- /* no longer used in Win32 */
- return TRUE;
-}
-
-/**********************************************************************
- * AccessResource (KERNEL.64)
- */
-INT AccessResource32( HINSTANCE hModule, HRSRC 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;
-}
-
-
-/**********************************************************************
- * SizeofResource (KERNEL.65)
- */
-DWORD SizeofResource32( HINSTANCE hModule, HRSRC hRsrc )
-{
- hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
- dprintf_resource(stddeb, "SizeofResource: module=%04x res=%04x\n",
- hModule, hRsrc );
- fprintf(stderr,"SizeofResource32: not implemented\n");
- return 0;
-}
-
-/**********************************************************************
- * LoadAccelerators [USER.177]
-*/
-HANDLE32 WIN32_LoadAcceleratorsW(HINSTANCE instance, LPCWSTR lpTableName)
-{
-#if 0
- HANDLE32 hAccel;
- HANDLE32 rsc_mem;
- HANDLE32 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 = FindResource32( instance, lpTableName,
- (LPCWSTR)RT_ACCELERATOR )))
- return 0;
- if (!(rsc_mem = LoadResource32( instance, hRsrc ))) return 0;
-
- lp = (BYTE *)LockResource32(rsc_mem);
- n = SizeofResource( 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);
- FreeResource( rsc_mem );
- return hAccel;
-#else
- fprintf(stderr,"LoadAcceleratorsW: not implemented\n");
- return 0x100; /* Return something anyway */
-#endif
-}
-
-HANDLE32 WIN32_LoadAcceleratorsA(HINSTANCE instance, LPCSTR lpTableName)
-{
- LPWSTR uni;
- HANDLE32 result;
- if (HIWORD(lpTableName))
- uni=STRING32_DupAnsiToUni(lpTableName);
- else
- uni=(LPWSTR)lpTableName;
- result=WIN32_LoadAcceleratorsW(instance,uni);
- if (HIWORD(uni))
- free(uni);
- return result;
-}
-\f
-/**********************************************************************
- * LoadString
- */
-int
-WIN32_LoadStringW(HINSTANCE instance, DWORD resource_id, LPWSTR buffer, int buflen)
-{
- HANDLE32 hmem, 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
- }
- dprintf_resource(stddeb,"LoadString // '%s' copied !\n", buffer);
- return i;
-}
-\f
-/**********************************************************************
- * LoadStringA
- */
-int
-WIN32_LoadStringA(HINSTANCE instance, DWORD resource_id, LPSTR buffer, int buflen)
-{
- WCHAR *buffer2 = xmalloc(buflen*2);
- int retval = WIN32_LoadStringW(instance, resource_id, buffer2, buflen);
-
- while (*buffer2)
- *buffer++ = (char) *buffer2++;
- *buffer = 0;
- return retval;
-}
-
-HICON LoadIconW32(HINSTANCE hisnt, LPCWSTR lpszIcon)
-
-{
- return LoadIcon(0, IDI_APPLICATION);
-}
-
-HICON LoadIconA32(HINSTANCE hinst, LPCSTR lpszIcon)
-
-{
- return LoadIconW32(hinst, lpszIcon);
-}
-/**********************************************************************
- * LoadBitmapW
- */
-HBITMAP WIN32_LoadBitmapW( HANDLE instance, LPCWSTR name )
-{
- HBITMAP hbitmap = 0;
- HDC hdc;
- HANDLE32 hRsrc;
- HANDLE32 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;
-}
-/**********************************************************************
- * LoadBitmapA
- */
-HBITMAP WIN32_LoadBitmapA( HANDLE instance, LPCSTR name )
-{
- HBITMAP res;
- if(!HIWORD(name))
- res = WIN32_LoadBitmapW(instance,(LPWSTR)name);
- else{
- LPWSTR uni=STRING32_DupAnsiToUni(name);
- res=WIN32_LoadBitmapW(instance,uni);
- free(uni);
- }
- return res;
-}
-
-/*****************************************************************
- * LoadMenuW (USER32.372)
- */
-HMENU WIN32_LoadMenuW(HANDLE instance, LPCWSTR name)
-{
- HANDLE32 hrsrc;
- hrsrc=FindResource32W(instance,name,(LPWSTR)RT_MENU);
- if(!hrsrc)return 0;
- return LoadMenuIndirect32W( LoadResource32(instance, hrsrc) );
-}
-
-/*****************************************************************
- * LoadMenuA (USER32.370)
- */
-HMENU WIN32_LoadMenuA(HANDLE instance,LPCSTR name)
-{
- HMENU res;
- if(!HIWORD(name))
- res = WIN32_LoadMenuW(instance,(LPWSTR)name);
- else{
- LPWSTR uni=STRING32_DupAnsiToUni(name);
- res=WIN32_LoadMenuW(instance,uni);
- free(uni);
- }
- return res;
-}
to->style = from->style;
to->dwExStyle = from->dwExStyle;
}
+
+/* The strings are not copied */
+void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCT32A* from,
+ MDICREATESTRUCT16* to )
+{
+ to->hOwner = (HINSTANCE16)from->hOwner;
+ to->x = (INT16)from->x;
+ to->y = (INT16)from->y;
+ to->cx = (INT16)from->cx;
+ to->cy = (INT16)from->cy;
+ to->style = from->style;
+ to->lParam = from->lParam;
+}
+
+void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from,
+ MDICREATESTRUCT32A *to )
+{
+ to->hOwner = (HINSTANCE32)from->hOwner;
+ to->x = (INT32)from->x;
+ to->y = (INT32)from->y;
+ to->cx = (INT32)from->cx;
+ to->cy = (INT32)from->cy;
+ to->style = from->style;
+ to->lParam = from->lParam;
+}
+
/***********************************************************************
* Tls is available only for the single thread
+ * (BTW: TLS means Thread Local Storage)
*/
static LPVOID* Tls=0;
static int TlsCount=0;
return Tls[index];
}
-void TlsSetValue(DWORD index,LPVOID value)
+BOOL32 TlsSetValue(DWORD index,LPVOID value)
{
if(index>=TlsCount)
{
/* FIXME: Set last error*/
- return;
+ return FALSE;
}
Tls[index]=value;
+ return TRUE;
}
/* FIXME: This is required to work cross-addres space as well */
*/
VOID Sleep(DWORD cMilliseconds)
{
- if(cMilliseconds == INFINITE)
+ if(cMilliseconds == INFINITE32)
while(1) sleep(1000); /* Spin forever */
usleep(cMilliseconds*1000);
}
#include "xmalloc.h"
#include "handle32.h"
#include "struct32.h"
-#include "resource32.h"
#include "string32.h"
#include "win.h"
#include "debug.h"
+DEFS = -D__WINE__
TOPSRC = @top_srcdir@
MODULE = windows
{
CLASS * class;
+ if (hinstance != 0xffff) hinstance = GetExePtr(hinstance);
+
/* First search task-specific classes */
for (class = firstClass; (class); class = class->next)
{
if (class->style & CS_GLOBALCLASS) continue;
if ((class->atomName == atom) &&
- ((hinstance==(HINSTANCE16)0xffff) ||
+ ((hinstance == 0xffff) ||
(hinstance == class->hInstance))) return class;
}
* DCX_WINDOWPAINT - BeginPaint specific flag
*/
-#include "options.h"
#include "dce.h"
#include "class.h"
#include "win.h"
return hdce;
}
+/**********************************************************************
+ * DCE_hDC2hWnd
+ */
+HWND DCE_hDC2hWnd(HDC hDC)
+{
+ HANDLE hdce = DCE_FindDCE(hDC);
+
+ if( hdce )
+ {
+ DCE* dce = (DCE *) USER_HEAP_LIN_ADDR(hdce);
+ return dce->hwndCurrent;
+ }
+
+ return 0;
+}
+
/***********************************************************************
* DCE_InvalidateDCE
*
}
/* optimize away GetVisRgn for desktop if it isn't there */
- else if( hwnd==GetDesktopWindow() && !Options.desktopGeometry )
+ else if ((hwnd == GetDesktopWindow()) &&
+ (rootWindow == DefaultRootWindow(display)))
hrgnVisible = CreateRectRgn( 0, 0, SYSMETRICS_CXSCREEN,
SYSMETRICS_CYSCREEN);
else hrgnVisible = DCE_GetVisRgn( hwnd, flags );
{
SetDCState( dce->hDC, defaultDCstate );
dce->DCXflags = DCX_CACHE;
+ dce->hwndCurrent = 0;
}
return 1;
}
HICON hI = 0;
UINT16 len = 1;
while(len < 64)
- if( (hI = LoadIcon(wndPtr->hInstance,MAKEINTRESOURCE(len))) )
+ if( (hI = LoadIcon16(wndPtr->hInstance,MAKEINTRESOURCE(len))) )
return (LRESULT)hI;
}
break;
#include "heap.h"
#include "win.h"
#include "ldt.h"
-#include "resource32.h"
#include "stackframe.h"
#include "string32.h"
#include "user.h"
if (template.menuName)
{
LPSTR str = SEGPTR_STRDUP( template.menuName ); /* FIXME: win32 */
- hMenu = LoadMenu( hInst, SEGPTR_GET(str) );
+ hMenu = LoadMenu16( hInst, SEGPTR_GET(str) );
SEGPTR_FREE( str );
}
{
/* The font height must be negative as it is a point size */
/* (see CreateFont() documentation in the Windows SDK). */
- hFont = CreateFont( -template.pointSize, 0, 0, 0, FW_DONTCARE,
+ hFont = CreateFont16( -template.pointSize, 0, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE,
template.faceName ); /* FIXME: win32 */
dprintf_dialog(stddeb, "CreateDialogParam16: %04x,%08lx,%04x,%08lx,%ld\n",
hInst, (DWORD)dlgTemplate, owner, (DWORD)dlgProc, param );
- if (!(hRsrc = FindResource( hInst, dlgTemplate, RT_DIALOG ))) return 0;
- if (!(hmem = LoadResource( hInst, hRsrc ))) return 0;
- if (!(data = LockResource( hmem ))) hwnd = 0;
+ if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOG ))) return 0;
+ if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
+ if (!(data = LockResource16( hmem ))) hwnd = 0;
else hwnd = CreateDialogIndirectParam16( hInst, data, owner,
dlgProc, param );
- FreeResource( hmem );
+ FreeResource16( hmem );
return hwnd;
}
{
HANDLE32 hrsrc = FindResource32W( hInst, name, (LPWSTR)RT_DIALOG );
if (!hrsrc) return 0;
- return CreateDialogIndirectParam32W( hInst, LoadResource32( hInst, hrsrc ),
+ return CreateDialogIndirectParam32W( hInst,
+ (LPVOID)LoadResource32(hInst, hrsrc),
owner, dlgProc, param );
}
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/types.h>
/***********************************************************************
* GetMouseEventProc (USER.337)
*/
-FARPROC GetMouseEventProc(void)
+FARPROC16 GetMouseEventProc(void)
{
HMODULE16 hmodule = GetModuleHandle("USER");
return MODULE_GetEntryPoint( hmodule,
* FOCUS_SetXFocus
*
* Set the X focus.
+ * Explicit colormap management seems to work only with OLVWM.
*/
static void FOCUS_SetXFocus( HWND hwnd )
{
if (!hwnd) /* If setting the focus to 0, uninstall the colormap */
{
- if (COLOR_WinColormap != DefaultColormapOfScreen(screen))
- XUninstallColormap( display, COLOR_WinColormap );
+ if (COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE)
+ XUninstallColormap( display, COLOR_GetColormap() );
return;
}
if (!XGetWindowAttributes( display, win, &win_attr ) ||
(win_attr.map_state != IsViewable))
return; /* If window is not viewable, don't change anything */
+
XSetInputFocus( display, win, RevertToParent, CurrentTime );
- if (COLOR_WinColormap != DefaultColormapOfScreen(screen))
- XInstallColormap( display, COLOR_WinColormap );
+ if (COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE)
+ XInstallColormap( display, COLOR_GetColormap() );
}
/*****************************************************************
#include "metafile.h"
#include "syscolor.h"
#include "stddebug.h"
+#include "palette.h"
#include "color.h"
#include "region.h"
#include "debug.h"
COLORREF SetPixel( HDC hdc, short x, short y, COLORREF color )
{
Pixel pixel;
- PALETTEENTRY entry;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
XSetFunction( display, dc->u.x.gc, GXcopy );
XDrawPoint( display, dc->u.x.drawable, dc->u.x.gc, x, y );
- if (screenDepth <= 8)
- {
- GetPaletteEntries( dc->w.hPalette, pixel, 1, &entry );
- return RGB( entry.peRed, entry.peGreen, entry.peBlue );
- }
- else return (COLORREF)pixel;
+ /* inefficient but simple... */
+
+ return COLOR_ToLogical(pixel);
}
*/
COLORREF GetPixel( HDC hdc, short x, short y )
{
- PALETTEENTRY entry;
XImage * image;
- WORD * mapping;
int pixel;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
pixel = XGetPixel( image, 0, 0 );
XDestroyImage( image );
- if (screenDepth > 8) return pixel;
- mapping = (WORD *) GDI_HEAP_LIN_ADDR( dc->u.x.pal.hRevMapping );
- if (mapping) pixel = mapping[pixel];
- GetPaletteEntries( dc->w.hPalette, pixel, 1, &entry );
- return RGB( entry.peRed, entry.peGreen, entry.peBlue );
+ return COLOR_ToLogical(pixel);
}
* Warning!
* A HHOOK is a 32-bit handle for compatibility with Windows 3.0 where it was
* a pointer to the next function. Now it is in fact composed of a USER heap
- * handle in the low 16 bits and of a HOOK_MAGIC value in the high 16 bits
- * (except for WINELIB32 where it is a 32-bit handle). -- AJ
+ * handle in the low 16 bits and of a HOOK_MAGIC value in the high 16 bits.
*/
+#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include "hook.h"
#include "queue.h"
#include "user.h"
*
* Get the next hook of a given hook.
*/
-static HANDLE HOOK_GetNextHook( HANDLE hook )
+static HANDLE16 HOOK_GetNextHook( HANDLE16 hook )
{
HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook );
if (!data || !hook) return 0;
*
* Get the first hook for a given type.
*/
-HANDLE HOOK_GetHook( short id , HQUEUE hQueue )
+HANDLE16 HOOK_GetHook( INT16 id , HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
- HANDLE hook = 0;
+ HANDLE16 hook = 0;
if ((queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(hQueue) )) != NULL)
hook = queue->hooks[id - WH_FIRST_HOOK];
*
* Install a given hook.
*/
-HANDLE HOOK_SetHook( short id, HOOKPROC proc, HINSTANCE hInst, HTASK hTask )
+static HANDLE16 HOOK_SetHook( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst,
+ HTASK16 hTask )
{
HOOKDATA *data;
- HANDLE handle;
- HQUEUE hQueue = 0;
+ HANDLE16 handle;
+ HQUEUE16 hQueue = 0;
if ((id < WH_FIRST_HOOK) || (id > WH_LAST_HOOK)) return 0;
if (!(hInst = GetExePtr( hInst ))) return 0;
- dprintf_hook( stddeb, "Setting hook %d: %08lx %04x %04x\n",
- id, (DWORD)proc, hInst, hTask );
+ dprintf_hook( stddeb, "Setting hook %d: %08x %04x %04x\n",
+ id, (UINT32)proc, hInst, hTask );
if (hTask) /* Task-specific hook */
{
/* Create the hook structure */
- if (!(handle = (HANDLE)USER_HEAP_ALLOC( sizeof(HOOKDATA) ))) return 0;
+ if (!(handle = USER_HEAP_ALLOC( sizeof(HOOKDATA) ))) return 0;
data = (HOOKDATA *) USER_HEAP_LIN_ADDR( handle );
data->proc = proc;
data->id = id;
*
* Remove a hook from the list.
*/
-static BOOL HOOK_RemoveHook( HANDLE hook )
+static BOOL32 HOOK_RemoveHook( HANDLE16 hook )
{
HOOKDATA *data;
HANDLE16 *prevHook;
{
/* Mark it for deletion later on */
dprintf_hook( stddeb, "Hook still running, deletion delayed\n" );
- data->proc = (FARPROC)0;
+ data->proc = (HOOKPROC16)0;
return TRUE;
}
*
* Call a hook procedure.
*/
-static DWORD HOOK_CallHook( HANDLE hook, short code,
- WPARAM wParam, LPARAM lParam )
+static LRESULT HOOK_CallHook( HANDLE16 hook, INT16 code,
+ WPARAM16 wParam, LPARAM lParam )
{
HOOKDATA *data;
MESSAGEQUEUE *queue;
- HANDLE prevHook;
- DWORD ret;
+ HANDLE16 prevHook;
+ LRESULT ret;
/* Find the first hook with a valid proc */
*
* Call a hook chain.
*/
-DWORD HOOK_CallHooks( short id, short code, WPARAM wParam, LPARAM lParam )
+LRESULT HOOK_CallHooks( INT16 id, INT16 code, WPARAM16 wParam, LPARAM lParam )
{
- HANDLE hook = HOOK_GetHook( id , 0 );
+ HANDLE16 hook = HOOK_GetHook( id , 0 );
if (!hook) return 0;
return HOOK_CallHook( hook, code, wParam, lParam );
}
/***********************************************************************
* SetWindowsHook (USER.121)
*/
-FARPROC SetWindowsHook( short id, HOOKPROC proc )
+FARPROC16 SetWindowsHook( INT16 id, HOOKPROC16 proc )
{
#ifdef WINELIB
- HINSTANCE hInst = 0;
+ HINSTANCE16 hInst = 0;
#else
- HINSTANCE hInst = FarGetOwner( HIWORD(proc) );
+ HINSTANCE16 hInst = FarGetOwner( HIWORD(proc) );
#endif
/* WH_MSGFILTER is the only task-specific hook for SetWindowsHook() */
- HTASK hTask = (id == WH_MSGFILTER) ? GetCurrentTask() : 0;
+ HTASK16 hTask = (id == WH_MSGFILTER) ? GetCurrentTask() : 0;
- HANDLE handle = HOOK_SetHook( id, proc, hInst, hTask );
- if (!handle) return (FARPROC)-1;
+ HANDLE16 handle = HOOK_SetHook( id, proc, hInst, hTask );
+ if (!handle) return (FARPROC16)-1;
if (!((HOOKDATA *)USER_HEAP_LIN_ADDR( handle ))->next) return 0;
/* Not sure if the return value is correct; should not matter much
* since it's never used (see DefHookProc). -- AJ */
-#ifdef WINELIB32
- return (FARPROC)handle;
-#else
- return (FARPROC)MAKELONG( handle, HOOK_MAGIC );
-#endif
+ return (FARPROC16)MAKELONG( handle, HOOK_MAGIC );
}
/***********************************************************************
* UnhookWindowsHook (USER.234)
*/
-BOOL UnhookWindowsHook( short id, HOOKPROC proc )
+BOOL16 UnhookWindowsHook( INT16 id, HOOKPROC16 proc )
{
- HANDLE hook = HOOK_GetHook( id , 0 );
+ HANDLE16 hook = HOOK_GetHook( id , 0 );
dprintf_hook( stddeb, "UnhookWindowsHook: %d %08lx\n", id, (DWORD)proc );
/***********************************************************************
* DefHookProc (USER.235)
*/
-DWORD DefHookProc( short code, WORD wParam, DWORD lParam, HHOOK *hhook )
+LRESULT DefHookProc( INT16 code, WPARAM16 wParam, LPARAM lParam, HHOOK *hhook )
{
/* Note: the *hhook parameter is never used, since we rely on the
* current hook value from the task queue to find the next hook. */
MESSAGEQUEUE *queue;
- HANDLE next;
+ HANDLE16 next;
if (!(queue = (MESSAGEQUEUE *)GlobalLock16( GetTaskQueue(0) ))) return 0;
if (!(next = HOOK_GetNextHook( queue->hCurHook ))) return 0;
/***********************************************************************
* CallMsgFilter (USER.123)
*/
-BOOL CallMsgFilter( SEGPTR msg, INT code )
+BOOL16 CallMsgFilter( SEGPTR msg, INT16 code )
{
- if (GetSysModalWindow()) return FALSE;
+ if (GetSysModalWindow16()) return FALSE;
if (HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg )) return TRUE;
return HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg );
}
/***********************************************************************
* SetWindowsHookEx (USER.291)
*/
-HHOOK SetWindowsHookEx( short id, HOOKPROC proc, HINSTANCE hInst, HTASK hTask )
+HHOOK SetWindowsHookEx( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst,
+ HTASK16 hTask )
{
- HANDLE handle = HOOK_SetHook( id, proc, hInst, hTask );
-#ifdef WINELIB32
- return (HHOOK)handle;
-#else
+ HANDLE16 handle = HOOK_SetHook( id, proc, hInst, hTask );
return MAKELONG( handle, HOOK_MAGIC );
-#endif
}
/***********************************************************************
* UnhookWindowHookEx (USER.292)
*/
-BOOL UnhookWindowsHookEx( HHOOK hhook )
+BOOL16 UnhookWindowsHookEx( HHOOK hhook )
{
-#ifdef WINELIB32
- return HOOK_RemoveHook( (HANDLE)hhook );
-#else
if (HIWORD(hhook) != HOOK_MAGIC) return FALSE; /* Not a new format hook */
return HOOK_RemoveHook( LOWORD(hhook) );
-#endif
}
/***********************************************************************
* CallNextHookEx (USER.293)
*/
-LRESULT CallNextHookEx( HHOOK hhook, INT code, WPARAM wParam, LPARAM lParam )
+LRESULT CallNextHookEx(HHOOK hhook, INT16 code, WPARAM16 wParam, LPARAM lParam)
{
- HANDLE next;
-#ifdef WINELIB32
- if (!(next = HOOK_GetNextHook( (HANDLE)hhook ))) return 0;
-#else
+ HANDLE16 next;
if (HIWORD(hhook) != HOOK_MAGIC) return 0; /* Not a new format hook */
if (!(next = HOOK_GetNextHook( LOWORD(hhook) ))) return 0;
-#endif
return HOOK_CallHook( next, code, wParam, lParam );
}
WS_CLIPCHILDREN | WS_DISABLED | WS_VSCROLL | WS_HSCROLL );
style |= (WS_VISIBLE | WS_OVERLAPPEDWINDOW);
}
-
+
hwnd = CreateWindow16( (LPCSTR)PTR_SEG_TO_LIN(cs->szClass),
(LPCSTR)PTR_SEG_TO_LIN(cs->szTitle), style,
cs->x, cs->y, cs->cx, cs->cy, parent,
(HMENU)(DWORD)(WORD)wIDmenu, w->hInstance,
(LPVOID)lParam);
+ /* MDI windows are WS_CHILD so they won't be activated by CreateWindow */
+
if (hwnd)
{
+ WND* wnd = WIN_FindWndPtr( hwnd );
+
MDI_MenuModifyItem(w ,hwnd);
+ if( wnd->dwStyle & WS_MINIMIZE && ci->hwndActiveChild )
+ ShowWindow( hwnd, SW_SHOWMINNOACTIVE );
+ else
+ {
+ SetWindowPos( hwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE );
+ if( wnd->dwStyle & WS_MAXIMIZE )
+ {
+ MDI_AugmentFrameMenu( ci, w->parent, hwnd );
+ MDI_UpdateFrameText( w->parent, ci->self, MDI_REPAINTFRAME, NULL );
+ }
+ }
dprintf_mdi(stddeb, "MDICreateChild: created child - %04x\n",hwnd);
}
else
if( wndPrev )
{
SendMessage16( prevActiveWnd, WM_NCACTIVATE, FALSE, 0L );
+
#ifdef WINELIB32
SendMessage32A( prevActiveWnd, WM_MDIACTIVATE, (WPARAM)prevActiveWnd,
(LPARAM)hWndChild);
-#else
+#else
+
SendMessage16( prevActiveWnd, WM_MDIACTIVATE, FALSE,
MAKELONG(hWndChild,prevActiveWnd));
-#endif
+#endif
/* uncheck menu item */
if( clientInfo->hWindowMenu )
CheckMenuItem( clientInfo->hWindowMenu,
(LPARAM)prevActiveWnd );
#else
SendMessage16( hWndChild, WM_MDIACTIVATE, TRUE,
- MAKELONG(prevActiveWnd,hWndChild) );
+ MAKELONG(hWndChild,prevActiveWnd));
#endif
return 1;
{
HDC hDCSrc = CreateCompatibleDC(0);
HDC hDCDest = CreateCompatibleDC(hDCSrc);
- HBITMAP hbClose = LoadBitmap(0, MAKEINTRESOURCE(OBM_CLOSE) );
- HBITMAP hbCopy,hb_src,hb_dest;
+ HBITMAP16 hbClose = LoadBitmap16(0, MAKEINTRESOURCE(OBM_CLOSE) );
+ HBITMAP16 hbCopy,hb_src,hb_dest;
hb_src = SelectObject(hDCSrc,hbClose);
hbCopy = CreateCompatibleBitmap(hDCSrc,SYSMETRICS_CXSIZE, SYSMETRICS_CYSIZE);
if (!hBmpClose)
{
hBmpClose = CreateMDIMenuBitmap();
- hBmpRestore = LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE) );
+ hBmpRestore = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORE) );
}
MDI_UpdateFrameText(frameWnd, hwnd, MDI_NOFRAMEREPAINT,frameWnd->text);
SendMessage16( hMaxChild, WM_SETREDRAW, TRUE, 0L );
}
+ dprintf_mdi(stddeb,"\tMDI: maximizing child %04x\n", hwnd );
+
ci->hwndChildMaximized = hwnd; /* !!! */
MDI_AugmentFrameMenu( ci, clientWnd->parent, hwnd);
switch(lpmb->type & MB_ICONMASK) {
case MB_ICONEXCLAMATION:
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
- (WPARAM)LoadIcon(0, IDI_EXCLAMATION), 0);
+ (WPARAM)LoadIcon16(0, IDI_EXCLAMATION), 0);
break;
case MB_ICONQUESTION:
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
- (WPARAM)LoadIcon(0, IDI_QUESTION), 0);
+ (WPARAM)LoadIcon16(0, IDI_QUESTION), 0);
break;
case MB_ICONASTERISK:
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
- (WPARAM)LoadIcon(0, IDI_ASTERISK), 0);
+ (WPARAM)LoadIcon16(0, IDI_ASTERISK), 0);
break;
case MB_ICONHAND:
default:
SendDlgItemMessage16(hwnd, stc1, STM_SETICON,
- (WPARAM)LoadIcon(0, IDI_HAND), 0);
+ (WPARAM)LoadIcon16(0, IDI_HAND), 0);
break;
}
if (!hbitmapClose)
{
- if (!(hbitmapClose = LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE) )))
+ if (!(hbitmapClose = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_CLOSE) )))
return;
- hbitmapMinimize = LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE) );
- hbitmapMinimizeD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED) );
- hbitmapMaximize = LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM) );
- hbitmapMaximizeD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOMD) );
- hbitmapRestore = LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE) );
- hbitmapRestoreD = LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORED) );
+ hbitmapMinimize = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_REDUCE) );
+ hbitmapMinimizeD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_REDUCED) );
+ hbitmapMaximize = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_ZOOM) );
+ hbitmapMaximizeD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_ZOOMD) );
+ hbitmapRestore = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORE) );
+ hbitmapRestoreD = LoadBitmap16( 0, MAKEINTRESOURCE(OBM_RESTORED) );
}
if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)
case HTLEFT:
case HTRIGHT:
- return (LONG)SetCursor( LoadCursor( 0, IDC_SIZEWE ) );
+ return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZEWE ) );
case HTTOP:
case HTBOTTOM:
- return (LONG)SetCursor( LoadCursor( 0, IDC_SIZENS ) );
+ return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZENS ) );
case HTTOPLEFT:
case HTBOTTOMRIGHT:
- return (LONG)SetCursor( LoadCursor( 0, IDC_SIZENWSE ) );
+ return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZENWSE ) );
case HTTOPRIGHT:
case HTBOTTOMLEFT:
- return (LONG)SetCursor( LoadCursor( 0, IDC_SIZENESW ) );
+ return (LONG)SetCursor( LoadCursor16( 0, IDC_SIZENESW ) );
}
/* Default cursor: arrow */
- return (LONG)SetCursor( LoadCursor( 0, IDC_ARROW ) );
+ return (LONG)SetCursor( LoadCursor16( 0, IDC_ARROW ) );
}
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
-static HQUEUE hFirstQueue = 0;
-static HQUEUE hmemSysMsgQueue = 0;
+static HQUEUE16 hFirstQueue = 0;
+static HQUEUE16 hmemSysMsgQueue = 0;
static MESSAGEQUEUE *pMouseQueue = NULL; /* Queue for last mouse message */
static MESSAGEQUEUE *pKbdQueue = NULL; /* Queue for last kbd message */
-static HQUEUE hDoomedQueue = 0;
+static HQUEUE16 hDoomedQueue = 0;
static MESSAGEQUEUE *sysMsgQueue = NULL;
/***********************************************************************
BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
{
MESSAGEQUEUE * msgQueue = (MESSAGEQUEUE*)GlobalLock16(hQueue);
- HQUEUE *pPrev;
+ HQUEUE16 *pPrev;
dprintf_msg(stddeb,"Deleting message queue %04x\n", hQueue);
if ((message >= WM_KEYFIRST) && (message <= WM_KEYLAST)) wakeBit = QS_KEY;
else wakeBit = (message == WM_MOUSEMOVE) ? QS_MOUSEMOVE : QS_MOUSEBUTTON;
- if (!(hwnd = GetSysModalWindow()))
+ if (!(hwnd = GetSysModalWindow16()))
{
if (wakeBit == QS_KEY)
{
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <X11/Xatom.h>
#include "options.h"
#include "class.h"
FocusChangeMask;
win_attr.override_redirect = TRUE;
}
- win_attr.colormap = COLOR_WinColormap;
+ win_attr.colormap = COLOR_GetColormap();
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.save_under = ((classPtr->style & CS_SAVEBITS) != 0);
win_attr.cursor = CURSORICON_XCursor;
XA_WM_DELETE_WINDOW = XInternAtom( display, "WM_DELETE_WINDOW",
False );
XSetWMProtocols( display, wndPtr->window, &XA_WM_DELETE_WINDOW, 1 );
+
+ if ((wndPtr->flags & WIN_MANAGED) &&
+ (cs->dwExStyle & WS_EX_DLGMODALFRAME))
+ {
+ XSizeHints* size_hints = XAllocSizeHints();
+
+ if (size_hints)
+ {
+ size_hints->min_width = size_hints->max_width = cs->cx;
+ size_hints->min_height = size_hints->max_height = cs->cy;
+ size_hints->flags = (PSize | PMinSize | PMaxSize);
+ XSetWMSizeHints( display, wndPtr->window, size_hints,
+ XA_WM_NORMAL_HINTS );
+ XFree(size_hints);
+ }
+ }
+
if (cs->hwndParent) /* Get window owner */
{
Window win = WIN_GetXWindow( cs->hwndParent );
LoadMenu(cs->hInstance,(SEGPTR)classPtr->menuNameA);
#else
SEGPTR menuName = (SEGPTR)GetClassLong16( hwnd, GCL_MENUNAME );
- if (menuName) cs->hMenu = LoadMenu( cs->hInstance, menuName );
+ if (menuName) cs->hMenu = LoadMenu16( cs->hInstance, menuName );
#endif
}
if (cs->hMenu) SetMenu( hwnd, cs->hMenu );
/*******************************************************************
- * SetSysModalWindow [USER.188]
+ * SetSysModalWindow16 (USER.188)
*/
-HWND SetSysModalWindow(HWND hWnd)
+HWND16 SetSysModalWindow16( HWND16 hWnd )
{
HWND hWndOldModal = hwndSysModal;
hwndSysModal = hWnd;
/*******************************************************************
- * GetSysModalWindow [USER.189]
+ * GetSysModalWindow16 (USER.52)
*/
-HWND GetSysModalWindow(void)
+HWND16 GetSysModalWindow16(void)
{
return hwndSysModal;
}
+
/*******************************************************************
* DRAG_QueryUpdate
*
if( !lpDragInfo || !spDragInfo ) return 0L;
- hBummer = LoadCursor(0,IDC_BUMMER);
+ hBummer = LoadCursor16(0,IDC_BUMMER);
if( !hBummer || !wndPtr )
{
* 1995,1996 Alex Korobka
*/
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
#include "sysmetrics.h"
#include "heap.h"
#include "module.h"
#include "message.h"
#include "queue.h"
#include "stackframe.h"
+#include "options.h"
#include "winpos.h"
#include "dce.h"
#include "nonclient.h"
/* #define DEBUG_WIN */
#include "debug.h"
-#define SWP_NOPOSCHANGE (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
+#define SWP_AGG_NOGEOMETRYCHANGE \
+ (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
+#define SWP_AGG_NOPOSCHANGE \
+ (SWP_AGG_NOGEOMETRYCHANGE | SWP_NOZORDER)
+#define SWP_AGG_STATUSFLAGS \
+ (SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
/* ----- external functions ----- */
BOOL ShowWindow( HWND hwnd, int cmd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
- BOOL wasVisible;
+ BOOL32 wasVisible, showFlag;
POINT16 maxSize;
int swpflags = 0;
short x = 0, y = 0, cx = 0, cy = 0;
if( wndPtr->dwStyle & WS_MINIMIZE )
if( !SendMessage16( hwnd, WM_QUERYOPEN, 0, 0L ) )
{
- swpflags |= SWP_NOSIZE;
+ swpflags |= SWP_NOSIZE | SWP_NOMOVE;
break;
}
{
if( !SendMessage16( hwnd, WM_QUERYOPEN, 0, 0L) )
{
- swpflags |= SWP_NOSIZE;
+ swpflags |= SWP_NOSIZE | SWP_NOMOVE;
break;
}
wndPtr->ptIconPos.x = wndPtr->rectWindow.left;
break;
}
+ showFlag = (cmd != SW_HIDE);
+ if (showFlag != wasVisible)
+ {
+ SendMessage16( hwnd, WM_SHOWWINDOW, showFlag, 0 );
+ if (!IsWindow( hwnd )) return wasVisible;
+ }
+
/* We can't activate a child window */
if (wndPtr->dwStyle & WS_CHILD) swpflags |= SWP_NOACTIVATE | SWP_NOZORDER;
- SendMessage16( hwnd, WM_SHOWWINDOW, (cmd != SW_HIDE), 0 );
SetWindowPos( hwnd, HWND_TOP, x, y, cx, cy, swpflags );
+ if (!IsWindow( hwnd )) return wasVisible;
if (wndPtr->flags & WIN_NEED_SIZE)
{
+ /* should happen only in CreateWindowEx() */
int wParam = SIZE_RESTORED;
wndPtr->flags &= ~WIN_NEED_SIZE;
{
if (!SendMessage16( hwndPrevActive, WM_NCACTIVATE, FALSE, 0 ))
{
- if (GetSysModalWindow() != hWnd) return 0;
+ if (GetSysModalWindow16() != hWnd) return 0;
/* disregard refusal if hWnd is sysmodal */
}
DeleteObject(newVisRgn);
}
+
+/***********************************************************************
+ * WINPOS_ForceXWindowRaise
+ */
+void WINPOS_ForceXWindowRaise( WND* pWnd )
+{
+ XWindowChanges winChanges;
+ WND *wndStop, *wndLast;
+
+ if (!pWnd->window) return;
+
+ wndLast = wndStop = pWnd;
+ winChanges.stack_mode = Above;
+ XReconfigureWMWindow( display, pWnd->window, 0, CWStackMode, &winChanges );
+
+ /* Recursively raise owned popups according to their z-order
+ * (it would be easier with sibling-related Below but it doesn't
+ * work very well with SGI mwm for instance)
+ */
+ while (wndLast)
+ {
+ WND *wnd = WIN_GetDesktop()->child;
+ wndLast = NULL;
+ while (wnd != wndStop)
+ {
+ if (wnd->owner == pWnd &&
+ (wnd->dwStyle & WS_POPUP) &&
+ (wnd->dwStyle & WS_VISIBLE))
+ wndLast = wnd;
+ wnd = wnd->next;
+ }
+ if (wndLast)
+ {
+ WINPOS_ForceXWindowRaise( wndLast );
+ wndStop = wndLast;
+ }
+ }
+}
+
+
/***********************************************************************
* WINPOS_SetXWindowPos
*
winChanges.width = winpos->cx;
winChanges.height = winpos->cy;
changeMask |= CWWidth | CWHeight;
+
+ /* Tweak dialog window size hints */
+
+ if ((wndPtr->flags & WIN_MANAGED) &&
+ (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME))
+ {
+ XSizeHints *size_hints = XAllocSizeHints();
+
+ if (size_hints)
+ {
+ long supplied_return;
+
+ XGetWMSizeHints( display, wndPtr->window, size_hints,
+ &supplied_return, XA_WM_NORMAL_HINTS);
+ size_hints->min_width = size_hints->max_width = winpos->cx;
+ size_hints->min_height = size_hints->max_height = winpos->cy;
+ XSetWMSizeHints( display, wndPtr->window, size_hints,
+ XA_WM_NORMAL_HINTS );
+ XFree(size_hints);
+ }
+ }
}
if (!(winpos->flags & SWP_NOMOVE))
{
}
changeMask |= CWStackMode;
}
- if (changeMask)
- XConfigureWindow( display, wndPtr->window, changeMask, &winChanges );
+ if (!changeMask) return;
+ if (wndPtr->flags & WIN_MANAGED)
+ XReconfigureWMWindow( display, wndPtr->window, 0,
+ changeMask, &winChanges );
+ else XConfigureWindow( display, wndPtr->window, changeMask, &winChanges );
}
HRGN visRgn = 0;
int result = 0;
- dprintf_win(stddeb,"SetWindowPos: hwnd %04x, flags %08x\n", hwnd, flags);
-
+ dprintf_win(stddeb,"SetWindowPos: hwnd %04x, (%i,%i)-(%i,%i) flags %08x\n",
+ hwnd, x, y, x+cx, y+cy, flags);
/* Check window handle */
if (hwnd == GetDesktopWindow()) return FALSE;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
- /* Check for windows that may not be resized
- FIXME: this should be done only for Windows 3.0 programs */
- if (flags ==(SWP_SHOWWINDOW) || flags ==(SWP_HIDEWINDOW ) )
- flags |= SWP_NOSIZE | SWP_NOMOVE;
+ if (wndPtr->dwStyle & WS_VISIBLE) flags &= ~SWP_SHOWWINDOW;
+ else
+ {
+ flags &= ~SWP_HIDEWINDOW;
+ if (!(flags & SWP_SHOWWINDOW)) flags |= SWP_NOREDRAW;
+ }
+
+/* Check for windows that may not be resized
+ FIXME: this should be done only for Windows 3.0 programs
+ */ if (flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW ) )
+ flags |= SWP_NOSIZE | SWP_NOMOVE;
/* Check dimensions */
BOOL bNoCopy = (flags & SWP_NOCOPYBITS) ||
(result >= WVR_HREDRAW && result < WVR_VALIDRECTS);
- if( (winpos.flags & SWP_NOPOSCHANGE) != SWP_NOPOSCHANGE )
+ if( (winpos.flags & SWP_AGG_NOGEOMETRYCHANGE) != SWP_AGG_NOGEOMETRYCHANGE )
/* optimize cleanup by BitBlt'ing where possible */
WINPOS_SizeMoveClean(wndPtr, visRgn, &oldWindowRect, &oldClientRect, bNoCopy);
/* And last, send the WM_WINDOWPOSCHANGED message */
- if (!(winpos.flags & SWP_NOSENDCHANGING))
+ dprintf_win(stddeb,"\tstatus flags = %04x\n", winpos.flags & SWP_AGG_STATUSFLAGS);
+
+ if ( ((winpos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) &&
+ !(winpos.flags & SWP_NOSENDCHANGING))
SendMessage16( winpos.hwnd, WM_WINDOWPOSCHANGED,
0, (LPARAM)MAKE_SEGPTR(&winpos) );
static void CallFrom32_stdcall_5(void) {}
#endif /* WINELIB */
-/* Reference 16->32A thunk */
-static const WINPROC_THUNK_FROM16 WINPROC_ThunkRef16To32A =
-{
- 0x58, /* popl %eax */
- 0x68, 0x00000000, /* pushl $proc32 */
- 0x50, /* pushl %eax */
- 0x5566, /* pushw %bp */
- 0x68, (void (*)())WINPROC_CallProc16To32A, /* pushl $thunk32 */
- 0x9a, CallFrom16_long_wwwll, /* lcall cs:relay */
- WINE_CODE_SELECTOR
-};
-
-/* Reference 16->32W thunk */
-static const WINPROC_THUNK_FROM16 WINPROC_ThunkRef16To32W =
-{
- 0x58, /* popl %eax */
- 0x68, 0x00000000, /* pushl $proc32 */
- 0x50, /* pushl %eax */
- 0x5566, /* pushw %bp */
- 0x68, (void (*)())WINPROC_CallProc16To32W, /* pushl $thunk32 */
- 0x9a, CallFrom16_long_wwwll, /* lcall cs:relay */
- WINE_CODE_SELECTOR
-};
-
-/* Reference 32->16 thunk */
-static const WINPROC_THUNK_FROM32 WINPROC_ThunkRef32To16 =
-{
- 0x58, /* popl %eax */
- 0x68, 0x00000000, /* pushl $proc16 */
- 0x50, /* pushl %eax */
- 0x55, /* pushl %ebp */
- 0x68, "WINPROC_CallProc32ATo16", /* pushl $name */
- 0x68, (void (*)())WINPROC_CallProc32ATo16, /* pushl $thunk32 */
- 0xe9, CallFrom32_stdcall_5 /* jmp relay */
-};
-
-/* Reference 32->32 jump */
-static const WINPROC_JUMP WINPROC_JumpRef =
-{
- 0xe9, 0x00000000 /* jmp proc (relative) */
-};
-
static HANDLE32 WinProcHeap;
/**********************************************************************
{
ptr = (BYTE *)handle;
/* First check if it is the jmp address */
- if (*ptr == WINPROC_JumpRef.jmp)
- ptr -= (int)&((WINDOWPROC *)0)->jmp -
- (int)&((WINDOWPROC *)0)->thunk;
+ if (*ptr == 0xe9 /* jmp */) ptr -= (int)&((WINDOWPROC *)0)->jmp -
+ (int)&((WINDOWPROC *)0)->thunk;
/* Now it must be the thunk address */
- if (*ptr == WINPROC_ThunkRef16To32A.popl_eax)
- ptr -= (int)&((WINDOWPROC *)0)->thunk;
+ if (*ptr == 0x58 /* popl eax */) ptr -= (int)&((WINDOWPROC *)0)->thunk;
/* Now we have a pointer to the WINDOWPROC struct */
if (((WINDOWPROC *)ptr)->magic == WINPROC_MAGIC)
return (WINDOWPROC *)ptr;
{
ptr = (BYTE *)PTR_SEG_TO_LIN(handle);
/* It must be the thunk address */
- if (*ptr == WINPROC_ThunkRef32To16.popl_eax)
- ptr -= (int)&((WINDOWPROC *)0)->thunk;
+ if (*ptr == 0x58 /* popl eax */) ptr -= (int)&((WINDOWPROC *)0)->thunk;
/* Now we have a pointer to the WINDOWPROC struct */
if (((WINDOWPROC *)ptr)->magic == WINPROC_MAGIC)
return (WINDOWPROC *)ptr;
switch(type)
{
case WIN_PROC_16:
- proc->thunk.t_from32 = WINPROC_ThunkRef32To16;
- proc->thunk.t_from32.proc = func;
- /* We need to fix the relative jump target */
- proc->thunk.t_from32.relay = (void (*)())((DWORD)proc->thunk.t_from32.relay -
+ proc->thunk.t_from32.popl_eax = 0x58; /* popl %eax */
+ proc->thunk.t_from32.pushl_func = 0x68; /* pushl $proc */
+ proc->thunk.t_from32.proc = func;
+ proc->thunk.t_from32.pushl_eax = 0x50; /* pushl %eax */
+ proc->thunk.t_from32.pushl_ebp = 0x55; /* pushl %ebp */
+ proc->thunk.t_from32.pushl_name = 0x68; /* pushl $name */
+ proc->thunk.t_from32.name = "WINPROC_CallProc32ATo16";
+ proc->thunk.t_from32.pushl_thunk = 0x68; /* pushl $thunkfrom32 */
+ proc->thunk.t_from32.thunk32 = (void(*)())WINPROC_CallProc32ATo16;
+ proc->thunk.t_from32.jmp = 0xe9; /* jmp relay*/
+ proc->thunk.t_from32.relay = /* relative jump */
+ (void (*)())((DWORD)CallFrom32_stdcall_5 -
(DWORD)(&proc->thunk.t_from32.relay + 1));
break;
case WIN_PROC_32A:
- proc->thunk.t_from16 = WINPROC_ThunkRef16To32A;
- proc->thunk.t_from16.proc = (FARPROC32)func;
- proc->jmp = WINPROC_JumpRef;
- /* Fixup relative jump */
- proc->jmp.proc = (WNDPROC32)((DWORD)func -
- (DWORD)(&proc->jmp.proc + 1));
- break;
case WIN_PROC_32W:
- proc->thunk.t_from16 = WINPROC_ThunkRef16To32W;
- proc->thunk.t_from16.proc = (WNDPROC32)func;
- proc->jmp = WINPROC_JumpRef;
+ proc->thunk.t_from16.popl_eax = 0x58; /* popl %eax */
+ proc->thunk.t_from16.pushl_func = 0x68; /* pushl $proc */
+ proc->thunk.t_from16.proc = (FARPROC32)func;
+ proc->thunk.t_from16.pushl_eax = 0x50; /* pushl %eax */
+ proc->thunk.t_from16.pushw_bp = 0x5566; /* pushw %bp */
+ proc->thunk.t_from16.pushl_thunk = 0x68; /* pushl $thunkfrom16 */
+ proc->thunk.t_from16.thunk32 = (type == WIN_PROC_32A) ?
+ (void(*)())WINPROC_CallProc16To32A :
+ (void(*)())WINPROC_CallProc16To32W;
+ proc->thunk.t_from16.lcall = 0x9a; /* lcall cs:relay */
+ proc->thunk.t_from16.relay = CallFrom16_long_wwwll;
+ proc->thunk.t_from16.cs = WINE_CODE_SELECTOR;
+ proc->jmp.jmp = 0xe9;
/* Fixup relative jump */
proc->jmp.proc = (WNDPROC32)((DWORD)func -
(DWORD)(&proc->jmp.proc + 1));
*plparam = (LPARAM)cs;
}
return 1;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT32W *cs =
+ (MDICREATESTRUCT32W *)HeapAlloc( SystemHeap, 0, sizeof(*cs) );
+ if (!cs) return -1;
+ *cs = *(MDICREATESTRUCT32W *)*plparam;
+ if (HIWORD(cs->szClass))
+ cs->szClass = STRING32_DupAnsiToUni( (LPCSTR)cs->szClass );
+ if (HIWORD(cs->szTitle))
+ cs->szTitle = STRING32_DupAnsiToUni( (LPCSTR)cs->szTitle );
+ *plparam = (LPARAM)cs;
+ }
+ return 1;
+ case WM_ASKCBFORMATNAME:
+ case WM_COMPAREITEM:
+ case WM_DELETEITEM:
+ case WM_DEVMODECHANGE:
+ case WM_MDIACTIVATE:
+ case WM_MEASUREITEM:
+ case WM_PAINTCLIPBOARD:
+ case WM_SIZECLIPBOARD:
+ case WM_WININICHANGE:
+ fprintf( stderr, "MapMsg32ATo32W: message %04x needs translation\n",
+ msg );
+ return -1;
default: /* No translation needed */
return 0;
}
HeapFree( SystemHeap, 0, cs );
}
break;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT32W *cs = (MDICREATESTRUCT32W *)lParam;
+ if (HIWORD(cs->szTitle)) free( (LPVOID)cs->szTitle );
+ if (HIWORD(cs->szClass)) free( (LPVOID)cs->szClass );
+ HeapFree( SystemHeap, 0, cs );
+ }
+ break;
}
}
*plparam = (LPARAM)cs;
}
return 1;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT32A *cs =
+ (MDICREATESTRUCT32A *)HeapAlloc( SystemHeap, 0, sizeof(*cs) );
+ if (!cs) return -1;
+ *cs = *(MDICREATESTRUCT32A *)*plparam;
+ if (HIWORD(cs->szTitle))
+ cs->szTitle = STRING32_DupUniToAnsi( (LPCWSTR)cs->szTitle );
+ if (HIWORD(cs->szClass))
+ cs->szClass = STRING32_DupUniToAnsi( (LPCWSTR)cs->szClass );
+ *plparam = (LPARAM)cs;
+ }
+ return 1;
+ case WM_ASKCBFORMATNAME:
+ case WM_COMPAREITEM:
+ case WM_DELETEITEM:
+ case WM_DEVMODECHANGE:
+ case WM_MDIACTIVATE:
+ case WM_MEASUREITEM:
+ case WM_PAINTCLIPBOARD:
+ case WM_SIZECLIPBOARD:
+ case WM_WININICHANGE:
+ fprintf( stderr, "MapMsg32WTo32A: message %04x needs translation\n",
+ msg );
+ return -1;
default: /* No translation needed */
return 0;
}
HeapFree( SystemHeap, 0, cs );
}
break;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT32A *cs = (MDICREATESTRUCT32A *)lParam;
+ if (HIWORD(cs->szTitle)) free( (LPVOID)cs->szTitle );
+ if (HIWORD(cs->szClass)) free( (LPVOID)cs->szClass );
+ HeapFree( SystemHeap, 0, cs );
+ }
+ break;
}
}
case WM_GETTEXT:
*plparam = (LPARAM)PTR_SEG_TO_LIN(*plparam);
return 0;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT16 *cs16 =
+ (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
+ MDICREATESTRUCT32A *cs =
+ (MDICREATESTRUCT32A *)HeapAlloc( SystemHeap, 0,
+ sizeof(*cs) + sizeof(LPARAM) );
+ if (!cs) return -1;
+ STRUCT32_MDICREATESTRUCT16to32A( cs16, cs );
+ cs->szTitle = (LPCSTR)PTR_SEG_TO_LIN(cs16->szTitle);
+ cs->szClass = (LPCSTR)PTR_SEG_TO_LIN(cs16->szClass);
+ *(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */
+ *plparam = (LPARAM)cs;
+ }
+ return 1;
case WM_MDISETMENU:
*pwparam32 = (WPARAM32)(HMENU32)LOWORD(*plparam);
*plparam = (LPARAM)(HMENU32)HIWORD(*plparam);
case WM_DELETEITEM:
case WM_DEVMODECHANGE:
case WM_MDIACTIVATE:
- case WM_MDICREATE:
case WM_MEASUREITEM:
case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD:
HeapFree( SystemHeap, 0, mmi );
}
break;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT32A *cs = (MDICREATESTRUCT32A *)lParam;
+ lParam = *(LPARAM *)(cs + 1);
+ STRUCT32_MDICREATESTRUCT32Ato16( cs,
+ (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) );
+ HeapFree( SystemHeap, 0, cs );
+ }
+ break;
case WM_NCCALCSIZE:
{
NCCALCSIZE_PARAMS16 *nc16;
*plparam = (LPARAM)cs;
}
return 1;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT16 *cs16 =
+ (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(*plparam);
+ MDICREATESTRUCT32W *cs =
+ (MDICREATESTRUCT32W *)HeapAlloc( SystemHeap, 0,
+ sizeof(*cs) + sizeof(LPARAM) );
+ if (!cs) return -1;
+ STRUCT32_MDICREATESTRUCT16to32A( cs16, (MDICREATESTRUCT32A *)cs );
+ cs->szTitle = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szTitle);
+ cs->szClass = (LPCWSTR)PTR_SEG_TO_LIN(cs16->szClass);
+ if (HIWORD(cs->szTitle))
+ cs->szTitle = STRING32_DupAnsiToUni( (LPCSTR)cs->szTitle );
+ if (HIWORD(cs->szClass))
+ cs->szClass = STRING32_DupAnsiToUni( (LPCSTR)cs->szClass );
+ *(LPARAM *)(cs + 1) = *plparam; /* Store the previous lParam */
+ *plparam = (LPARAM)cs;
+ }
+ return 1;
default: /* No Unicode translation needed */
return WINPROC_MapMsg16To32A( msg16, wParam16, pmsg32,
pwparam32, plparam );
HeapFree( SystemHeap, 0, cs );
}
break;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT32W *cs = (MDICREATESTRUCT32W *)lParam;
+ lParam = *(LPARAM *)(cs + 1);
+ STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCT32A *)cs,
+ (MDICREATESTRUCT16 *)PTR_SEG_TO_LIN(lParam) );
+ if (HIWORD(cs->szTitle)) free( (LPVOID)cs->szTitle );
+ if (HIWORD(cs->szClass)) free( (LPVOID)cs->szClass );
+ HeapFree( SystemHeap, 0, cs );
+ }
+ break;
default:
WINPROC_UnmapMsg16To32A( msg, wParam, lParam );
break;
*plparam = (LPARAM)SEGPTR_GET(str);
}
return 1;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT16 *cs;
+ MDICREATESTRUCT32A *cs32 = (MDICREATESTRUCT32A *)*plparam;
+ LPSTR name, cls;
+
+ if (!(cs = SEGPTR_NEW(MDICREATESTRUCT16))) return -1;
+ STRUCT32_MDICREATESTRUCT32Ato16( cs32, cs );
+ name = SEGPTR_STRDUP( cs32->szTitle );
+ cls = SEGPTR_STRDUP( cs32->szClass );
+ cs->szTitle = SEGPTR_GET(name);
+ cs->szClass = SEGPTR_GET(cls);
+ *plparam = (LPARAM)SEGPTR_GET(cs);
+ }
+ return 1;
case WM_MDISETMENU:
*pwparam16 = TRUE; /* FIXME? */
*plparam = MAKELPARAM( (HMENU16)LOWORD(wParam32),
case WM_DELETEITEM:
case WM_DEVMODECHANGE:
case WM_MDIACTIVATE:
- case WM_MDICREATE:
case WM_MEASUREITEM:
case WM_PAINTCLIPBOARD:
case WM_SIZECLIPBOARD:
SEGPTR_FREE( (LPARAM *)str - 1 );
}
break;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT16 *cs = (MDICREATESTRUCT16*)PTR_SEG_TO_LIN(lParam);
+ SEGPTR_FREE( PTR_SEG_TO_LIN(cs->szTitle) );
+ SEGPTR_FREE( PTR_SEG_TO_LIN(cs->szClass) );
+ SEGPTR_FREE( cs );
+ }
+ break;
case WM_NCCALCSIZE:
{
NCCALCSIZE_PARAMS32 *nc32;
*plparam = (LPARAM)SEGPTR_GET(cs);
}
return 1;
+ case WM_MDICREATE:
+ {
+ MDICREATESTRUCT16 *cs;
+ MDICREATESTRUCT32W *cs32 = (MDICREATESTRUCT32W *)*plparam;
+
+ if (!(cs = SEGPTR_NEW(MDICREATESTRUCT16))) return -1;
+ STRUCT32_MDICREATESTRUCT32Ato16( (MDICREATESTRUCT32A *)cs32, cs );
+ if (HIWORD(cs32->szTitle))
+ {
+ LPSTR name = SEGPTR_ALLOC( lstrlen32W(cs32->szTitle) + 1 );
+ STRING32_UniToAnsi( name, cs32->szTitle );
+ cs->szTitle = SEGPTR_GET(name);
+ }
+ else cs->szTitle = (SEGPTR)cs32->szTitle;
+ if (HIWORD(cs32->szClass))
+ {
+ LPSTR name = SEGPTR_ALLOC( lstrlen32W(cs32->szClass) + 1 );
+ STRING32_UniToAnsi( name, cs32->szClass );
+ cs->szClass = SEGPTR_GET(name);
+ }
+ else cs->szClass = (SEGPTR)cs32->szClass;
+ *pmsg16 = (UINT16)msg32;
+ *pwparam16 = (WPARAM16)LOWORD(wParam32);
+ *plparam = (LPARAM)SEGPTR_GET(cs);
+ }
+ return 1;
case WM_SETTEXT:
{
LPSTR str = SEGPTR_ALLOC( lstrlen32W((LPWSTR)*plparam) + 1 );
Path=c:\windows;c:\windows\system;e:\;e:\test;f:\
SymbolTableFile=./wine.sym
+[options]
+AllocSystemColors=100
+
[fonts]
system=*-helvetica
mssansserif=*-helvetica
.\" -*- nroff -*-
.TH WINE 1 "September 1, 1995" "Version 9/1/95" "Windows Emulation"
.SH NAME
-wine \- run Windows 3.x programs under Linux
+wine \- run Windows programs under Unix
.SH SYNOPSIS
.B wine
[
]
.SH DESCRIPTION
.B wine
-invokes the Linux Windows emulator.
+invokes the Windows emulator.
.PP
.B wine
currently runs a number of games and small applications (approximately