Release 971221

Fri Dec 19 10:50:46 1997  Douglas Ridgway  <ridgway@winehq.com>

	* [Make.rules.in] [Makefile.in] [documentation/Makefile.in]
 	  [documentation/README.documentation]
	First cut at Wine API documentation. No longer install reference
	manual by default.

Wed Dec 17 21:32:23 1997  Andreas Mohr <100.30936@germany.net>

	* [files/file.c]
	Fixed GetTempFileName16() to use current path of requested drive
	as needed.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/dciman32.spec]
	  [if1632/msvfw32.spec] [if1632/tapi32.spec] [if1632/wow32.spec]
	Added misc DLLs needed by various apps.

Wed Dec 17 12:01:50 1997  Morten Eriksen <mortene@sim.no>

	* [if1632/gdi32.spec] [include/windows.h] [objects/palette.c]
	Inserted empty stub for CreateHalftonePalette.

Tue Dec 16 22:08:06 1997  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [windows/mdi.c]
	Use VK_TAB instead of VK_SEPARATOR in TranslateMDISysAccel().

	* [graphics/metafiledrv/init.c]
	DeleteDC() on a MetaDC doesn't do anything - it shouldn't. Therefore
	fix cleanup of MetaDCs in CloseMetaFile(); they now actually get
	removed from the GDI heap!

	* [graphics/x11drv/xfont.c]
	Preserve FO_MATCH_XYINDEP flag in XFONT_MatchFIList(). Should reduce
	the number of bold-italic matches.

Tue Dec 16 20:11:43 1997  Bertho Stultiens <bertho@panter.soci.aau.dk>

	* [graphics/painting.c]
	Included an implementation of DrawState

	* [if1632/thunk.c]
	Changed many fprintfs into dprintf_thunk

	* [include/cache.h] [graphics/cache.c]
	New files to hold cached handles to regulary used GDI object.

	* [include/windows.h]
	Added DRAWSTATExx typedefs
	Added DSS_DEFAULT define for DrawState

	* [objects/text.c]
	New implementation of GrayString()

	* [controls/uitools.c]
	Implemented DrawFrameControl() functions
	Changed DrawEdge() behaviour to win95 implementation

Mon Dec 15 23:43:01 1997  Martin Boehme <boehme@informatik.mu-luebeck.de>

	* [graphics/path.c] [include/path.h] [graphics/painting.c]
	  [if1632/gdi32.spec] [include/gdi.h] [include/windows.h]
	  [objects/dc.c]
        Added preliminary support for GDI paths.

	* [objects/dc.c]
	Added DC_Init_DC_INFO function for initializing WIN_DC_INFO
	structure.

	* [include/windows.h] [include/gdi.h] [objects/gdiobj.c]
	Added DEFAULT_GUI_FONT.

	* [include/winerror.h]
	Added a few error codes.

	* [memory/heap.c]
	Changed HeapAlloc to make the correct calls to SetLastError
	(now conforms to NT's behaviour).

	* [windows/win.c]
	Changed WIN_CreateWindowEx to allow child windows with zero
	width / height.

Sun Dec 14 12:01:07 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [if1632/*] [relay32/*]
	Moved all 32-bit relay stuff to relay32/

	* [fi1632/thunk.c] [win32/kernel32.c]
	Moved all KERNEL32 ordinal functions to kernel32.c

	* [memory/selector.c]
	Initialize selectors in AllocSelectorArray.

	* [tools/build.c]
	Generate C instead of assembly for Win32 relays.
	Fixed stack corruption in CallTo16 functions, found by Bertho
	Stultiens.
	
Sun Dec 14 10:55:00 1997  Andreas Mohr <100.30936@germany.net>

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/ole2thk.spec]
	Added built-in OLE2THK.DLL. 

	* [if1632/toolhelp.spec] [include/toolhelp.h] [memory/selector.c]
	  [misc/toolhelp.c]
	Added stubs for StackTraceFirst(), StackTraceCSIPFirst(),
	StackTraceNext(), UTSelectorOffsetToLinear()
	and UTLinearToSelectorOffset().

Sat Dec 13 17:26:41 1997  Alex Korobka  <alex@trantor.pharm.sunysb.edu>

	* [misc/winsock.c]
	32-bit API fixes for reported problems (thanks to Marcus
	and David).

	* [graphics/x11drv/xfont.c]
	Little tweak in point size calculation.

	* [windows/defwnd.c] [windows/dce.c] [windows/winhelp.c]
	  [windows/winproc.c] [windows/win.c]
	Bug fixes.

Sat Dec 13 16:35:14 1997  Kai Morich <kai.morich@rhein-neckar.netsurf.de>

	* [files/dos_fs.c]
	OpenFile with empty filename and OF_PARSE returns current dir.

	* [misc/commdlg.c]
	Ignore initial dir if bogus.

	* [files/file.c]
	Locking an identic region in a file must not be an error.

	* [misc/lstr.c]
	Use wide char ctype functions.

Fri Dec 12 23:46:22 1997  Uwe Bonnes  <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [file/drive.c]
	First attempt for GetDiskFreeSpaceEx.

Fri Dec 12 23:18:41 1997  Marcus Meissner  <msmeissn@cip.informatik.uni-erlangen.de>

	* [loader/pe_resource.c]	
	Fixed wrongly appearing menus problem (only use default lookups in
	last resource subtree).

	* [multimedia/*.c]
	Added win32 support for time* and joy* lowlevel drivers,
	(not excessively tested), some misc fixes and cleanups.

	* [misc/shellord.c][misc/shell.c][ole/folders.c][ole/ifs.c]
	  [include/interfaces.h][include/shlobj.h]
	Added some more undocumented SHELL32 functions, some shell folder
 	interface stubs added, SHGetMalloc, SHGetDesktopFolder,
	SHGetSpecialFolderLocation, SHGetPathFromIDList stubs added,
	IMalloc, IUnknown implemented.

	* [windows/msgbox.c]
	Implemented MessageBoxIndirect*, some internal changes.

	* [if1632/thunk.c]
	KERNEL_431 implemented.

	* [objects/gdiobj.c]
	GetCurrentObject implemented.

Wed Dec  3 01:09:17 1997  Gordon Chaffee  <chaffee@apu.cs.berkeley.edu>

	* [objects/dib.c]
	Fix a couple small DIB problems.

	* [controls/edit.c]
	Fix a typo.

	* [files/dos_fs.c]
	Try normal readdir in case fs is specified as vfat but isn't.

	* [files/profile.c]
	Implementation of WritePrivateProfileSection32A from Uwe Bonnes.

	* [misc/printdrv.c]
	OpenPrinter32A stub, helps Word97 start.

	* [objects/text.c]
	Fixup implementation of GetTextCharsetInfo.

	* [scheduler/process.c]
	Fix environment variable expansion.

	* [win32/code_page.c]
	Make MultiByteToWideChar and WideCharToMultiByte conform in return
	values and error conditions to those in Windows NT 4.0.

	* [windows/message.c]
	Fix broadcasting problems in Win32.  The Win32 docs say to use
	HWND_TOPMOST to broadcast to all Win32 Windows.

	* [memory/virtual.c] [loader/pe_image.c]
	Do not map in VirtualAlloc if address is specified and space is
	not available.  This is required by Win32.

	* [include/pen.h] [include/x11drv.h] [objects/dc.c]
	  [objects/pen.c] [graphics/x11drv/pen.c]
	Support for ExtCreatePen.

Tue Dec  2 20:22:06 1997  Morten Welinder  <terra@diku.dk>

	* [*/*.c] [*/*.h]
	Add lots of prototypes.

	* [if1632/kernel32.spec][include/windows.h][include/winnt.h]
	  [misc/cpu.c]
	Define IsProcessorFeaturePresent.

	* [misc/crtdll.c]
 	(CRTDLL__getcwd): Allocate enough memory for the terminating zero.

	* [misc/ver.c]
	Improve check for null component in _find_data[AW].  Plug leaks
	in VerQueryValue*.

	* [win32/console.c][if1632/kernel32.spec]
	Add stubs for GetConsoleCursorInfo32, SetConsoleCursorInfo32.

	* [windows/message.c][if1632/user32.spec][include/windows.h]
	Define SendMessageTimeout*.

	* [graphics/x11drv/xfont.c]
	Change algorithm of __genericCheckSum to be alignment safe.

	* [misc/main.c] [misc/winsock.c] [misc/winsock_dns.c]
	Include winsock.h early to avoid Solaris problem.

	* [include/windows.h]
	Undef FSHIFT before we define it.

	* [rc/winerc.c]
	Include <fcntl.h> instead of <sys/fcntl.h>.

	* [files/file.c]
	Use strerror in FILE_SetDosError if available.

	* [include/config.h.in] [configure.in]
	Check for strerror.

	* [objects/gdiobj.c]
	Make static font structures aligned.

Mon Dec  1 10:10:21 1997  Karl Garrison  <karlos@eznet.net>

	* [win32/console.c] [if1632/kernel32.spec] [include/windows.h]
	Added stub for GetNumberOfConsoleMouseButtons.
	Added stub for PeekConsoleInput(A,W).
	Fixed parameter list for WriteConsole(A,W).
	GetNumberOfConsoleInputEvents now returns 0 events instead of 1
	(since low-level console functions are not yet supported).
	GetConsoleMode no longer returns ENABLE_WINDOW_INPUT and
	ENABLE_MOUSE_INPUT since these are not currently implemented.
This commit is contained in:
Alexandre Julliard 1997-12-21 19:17:50 +00:00
parent e658d82093
commit 44ed71f52f
185 changed files with 9077 additions and 2824 deletions

View File

@ -1,14 +1,16 @@
This is release 971130 of Wine, the MS Windows emulator. This is still a
This is release 971221 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-971130: (see ChangeLog for details)
- Better Win32s support.
- Lots of new Win32 functions.
- DIB handling improvements.
WHAT'S NEW with Wine-971221: (see ChangeLog for details)
- Preliminary GDI paths support.
- DrawFrameControl implementation.
- Multimedia support for time and joystick functions.
- Win32 spec files now generate C code for Winelib.
- Tons of new Win32 functions and stubs.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -17,10 +19,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-971130.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-971130.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-971130.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-971130.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-971221.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-971221.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-971221.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-971221.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

View File

@ -102,6 +102,7 @@ Rick Sladkey,
William Smith,
Dominik Strasser,
Vadim Strizhevsky,
Bertho Stultiens,
Erik Svendsen,
Tristan Tarrant,
Andrew Taylor,

12
BUGS
View File

@ -5,7 +5,7 @@ done something for one of the problems. You are encouraged to
add new entries and, more importantly, remove those for the
bugs you fixed ;-)
------------------------------------------------------------
As of Nov 1997 -
As of Dec 1997 -
General:
@ -32,13 +32,15 @@ General:
Miscellaneous:
* Invisible controls in BCW dialogs.
* 16-bit Eudora 1.5.2 goes into recursion trying to display
a horizontal scrollbar (SetScrollPos() artifact).
* mIRC 'commands' menu stays on top and will not refresh.
* mIRC is unable to show 'Options' dialog.
* Tab switching in mIRC 'Setup' dialog leaks memory.
* Tab switching in mIRC 'Setup' dialog stops erasing background
after a random number of repetitions.
* nBytesWidth in CURSORICONINFO is bogus for some bpp
(doesn't reflect the fact that bits are packed and 16-bit aligned).
@ -47,7 +49,7 @@ Miscellaneous:
(probably because of bytes width stuff).
* Netscape displays partially downloaded inline graphics with
wrong offsets. Bitmap is missing in the splash-window.
wrong offsets.
* Text alignment problems in Word and Write (variable pitch fonts).
@ -62,6 +64,8 @@ Miscellaneous:
* AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple
times.
* X11DRV_PaintRgn doesn't respect mapping modes
Where to look in source files:
* grep for FIXME in the source files.

262
ChangeLog
View File

@ -1,3 +1,265 @@
----------------------------------------------------------------------
Fri Dec 19 10:50:46 1997 Douglas Ridgway <ridgway@winehq.com>
* [Make.rules.in] [Makefile.in] [documentation/Makefile.in]
[documentation/README.documentation]
First cut at Wine API documentation. No longer install reference
manual by default.
Wed Dec 17 21:32:23 1997 Andreas Mohr <100.30936@germany.net>
* [files/file.c]
Fixed GetTempFileName16() to use current path of requested drive
as needed.
* [if1632/Makefile.in] [if1632/builtin.c] [if1632/dciman32.spec]
[if1632/msvfw32.spec] [if1632/tapi32.spec] [if1632/wow32.spec]
Added misc DLLs needed by various apps.
Wed Dec 17 12:01:50 1997 Morten Eriksen <mortene@sim.no>
* [if1632/gdi32.spec] [include/windows.h] [objects/palette.c]
Inserted empty stub for CreateHalftonePalette.
Tue Dec 16 22:08:06 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [windows/mdi.c]
Use VK_TAB instead of VK_SEPARATOR in TranslateMDISysAccel().
* [graphics/metafiledrv/init.c]
DeleteDC() on a MetaDC doesn't do anything - it shouldn't. Therefore
fix cleanup of MetaDCs in CloseMetaFile(); they now actually get
removed from the GDI heap!
* [graphics/x11drv/xfont.c]
Preserve FO_MATCH_XYINDEP flag in XFONT_MatchFIList(). Should reduce
the number of bold-italic matches.
Tue Dec 16 20:11:43 1997 Bertho Stultiens <bertho@panter.soci.aau.dk>
* [graphics/painting.c]
Included an implementation of DrawState
* [if1632/thunk.c]
Changed many fprintfs into dprintf_thunk
* [include/cache.h] [graphics/cache.c]
New files to hold cached handles to regulary used GDI object.
* [include/windows.h]
Added DRAWSTATExx typedefs
Added DSS_DEFAULT define for DrawState
* [objects/text.c]
New implementation of GrayString()
* [controls/uitools.c]
Implemented DrawFrameControl() functions
Changed DrawEdge() behaviour to win95 implementation
Mon Dec 15 23:43:01 1997 Martin Boehme <boehme@informatik.mu-luebeck.de>
* [graphics/path.c] [include/path.h] [graphics/painting.c]
[if1632/gdi32.spec] [include/gdi.h] [include/windows.h]
[objects/dc.c]
Added preliminary support for GDI paths.
* [objects/dc.c]
Added DC_Init_DC_INFO function for initializing WIN_DC_INFO
structure.
* [include/windows.h] [include/gdi.h] [objects/gdiobj.c]
Added DEFAULT_GUI_FONT.
* [include/winerror.h]
Added a few error codes.
* [memory/heap.c]
Changed HeapAlloc to make the correct calls to SetLastError
(now conforms to NT's behaviour).
* [windows/win.c]
Changed WIN_CreateWindowEx to allow child windows with zero
width / height.
Sun Dec 14 12:01:07 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [if1632/*] [relay32/*]
Moved all 32-bit relay stuff to relay32/
* [fi1632/thunk.c] [win32/kernel32.c]
Moved all KERNEL32 ordinal functions to kernel32.c
* [memory/selector.c]
Initialize selectors in AllocSelectorArray.
* [tools/build.c]
Generate C instead of assembly for Win32 relays.
Fixed stack corruption in CallTo16 functions, found by Bertho
Stultiens.
Sun Dec 14 10:55:00 1997 Andreas Mohr <100.30936@germany.net>
* [if1632/Makefile.in] [if1632/builtin.c] [if1632/ole2thk.spec]
Added built-in OLE2THK.DLL.
* [if1632/toolhelp.spec] [include/toolhelp.h] [memory/selector.c]
[misc/toolhelp.c]
Added stubs for StackTraceFirst(), StackTraceCSIPFirst(),
StackTraceNext(), UTSelectorOffsetToLinear()
and UTLinearToSelectorOffset().
Sat Dec 13 17:26:41 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [misc/winsock.c]
32-bit API fixes for reported problems (thanks to Marcus
and David).
* [graphics/x11drv/xfont.c]
Little tweak in point size calculation.
* [windows/defwnd.c] [windows/dce.c] [windows/winhelp.c]
[windows/winproc.c] [windows/win.c]
Bug fixes.
Sat Dec 13 16:35:14 1997 Kai Morich <kai.morich@rhein-neckar.netsurf.de>
* [files/dos_fs.c]
OpenFile with empty filename and OF_PARSE returns current dir.
* [misc/commdlg.c]
Ignore initial dir if bogus.
* [files/file.c]
Locking an identic region in a file must not be an error.
* [misc/lstr.c]
Use wide char ctype functions.
Fri Dec 12 23:46:22 1997 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
* [file/drive.c]
First attempt for GetDiskFreeSpaceEx.
Fri Dec 12 23:18:41 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [loader/pe_resource.c]
Fixed wrongly appearing menus problem (only use default lookups in
last resource subtree).
* [multimedia/*.c]
Added win32 support for time* and joy* lowlevel drivers,
(not excessively tested), some misc fixes and cleanups.
* [misc/shellord.c][misc/shell.c][ole/folders.c][ole/ifs.c]
[include/interfaces.h][include/shlobj.h]
Added some more undocumented SHELL32 functions, some shell folder
interface stubs added, SHGetMalloc, SHGetDesktopFolder,
SHGetSpecialFolderLocation, SHGetPathFromIDList stubs added,
IMalloc, IUnknown implemented.
* [windows/msgbox.c]
Implemented MessageBoxIndirect*, some internal changes.
* [if1632/thunk.c]
KERNEL_431 implemented.
* [objects/gdiobj.c]
GetCurrentObject implemented.
Wed Dec 3 01:09:17 1997 Gordon Chaffee <chaffee@apu.cs.berkeley.edu>
* [objects/dib.c]
Fix a couple small DIB problems.
* [controls/edit.c]
Fix a typo.
* [files/dos_fs.c]
Try normal readdir in case fs is specified as vfat but isn't.
* [files/profile.c]
Implementation of WritePrivateProfileSection32A from Uwe Bonnes.
* [misc/printdrv.c]
OpenPrinter32A stub, helps Word97 start.
* [objects/text.c]
Fixup implementation of GetTextCharsetInfo.
* [scheduler/process.c]
Fix environment variable expansion.
* [win32/code_page.c]
Make MultiByteToWideChar and WideCharToMultiByte conform in return
values and error conditions to those in Windows NT 4.0.
* [windows/message.c]
Fix broadcasting problems in Win32. The Win32 docs say to use
HWND_TOPMOST to broadcast to all Win32 Windows.
* [memory/virtual.c] [loader/pe_image.c]
Do not map in VirtualAlloc if address is specified and space is
not available. This is required by Win32.
* [include/pen.h] [include/x11drv.h] [objects/dc.c]
[objects/pen.c] [graphics/x11drv/pen.c]
Support for ExtCreatePen.
Tue Dec 2 20:22:06 1997 Morten Welinder <terra@diku.dk>
* [*/*.c] [*/*.h]
Add lots of prototypes.
* [if1632/kernel32.spec][include/windows.h][include/winnt.h]
[misc/cpu.c]
Define IsProcessorFeaturePresent.
* [misc/crtdll.c]
(CRTDLL__getcwd): Allocate enough memory for the terminating zero.
* [misc/ver.c]
Improve check for null component in _find_data[AW]. Plug leaks
in VerQueryValue*.
* [win32/console.c][if1632/kernel32.spec]
Add stubs for GetConsoleCursorInfo32, SetConsoleCursorInfo32.
* [windows/message.c][if1632/user32.spec][include/windows.h]
Define SendMessageTimeout*.
* [graphics/x11drv/xfont.c]
Change algorithm of __genericCheckSum to be alignment safe.
* [misc/main.c] [misc/winsock.c] [misc/winsock_dns.c]
Include winsock.h early to avoid Solaris problem.
* [include/windows.h]
Undef FSHIFT before we define it.
* [rc/winerc.c]
Include <fcntl.h> instead of <sys/fcntl.h>.
* [files/file.c]
Use strerror in FILE_SetDosError if available.
* [include/config.h.in] [configure.in]
Check for strerror.
* [objects/gdiobj.c]
Make static font structures aligned.
Mon Dec 1 10:10:21 1997 Karl Garrison <karlos@eznet.net>
* [win32/console.c] [if1632/kernel32.spec] [include/windows.h]
Added stub for GetNumberOfConsoleMouseButtons.
Added stub for PeekConsoleInput(A,W).
Fixed parameter list for WriteConsole(A,W).
GetNumberOfConsoleInputEvents now returns 0 events instead of 1
(since low-level console functions are not yet supported).
GetConsoleMode no longer returns ENABLE_WINDOW_INPUT and
ENABLE_MOUSE_INPUT since these are not currently implemented.
----------------------------------------------------------------------
Sat Nov 29 12:35:26 1997 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -36,6 +36,7 @@ LDCOMBINE = ld -r
AR = ar rc
RM = rm -f
MKDIR = mkdir
C2MAN = c2man
BUILD = $(TOPOBJDIR)/tools/build@PROGEXT@
MAKEDEP = $(TOPOBJDIR)/tools/makedep@PROGEXT@
WINERC = $(TOPOBJDIR)/rc/winerc@PROGEXT@
@ -108,6 +109,10 @@ $(BUILD) checkbuild:
$(MODULE).o: $(OBJS)
$(LDCOMBINE) $(OBJS) -o $(MODULE).o
# Rule for man pages
man: $(C_SRCS)
for i in $(C_SRCS); do $(C2MAN) -L -o$(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) $$i; done
# Misc. rules

View File

@ -7,6 +7,7 @@
# install: install everything
# depend: create the dependencies
# etags: create a TAGS file for Emacs.
# manpages: compile manpages for Wine API
#
# Main target to build
@ -24,6 +25,7 @@ MODULE = none
LIBSUBDIRS = \
rc \
tools \
controls \
files \
graphics \
@ -44,11 +46,11 @@ LIBSUBDIRS = \
windows
EMUSUBDIRS = \
tools \
debugger \
graphics/win16drv \
if1632 \
miscemu
miscemu \
relay32
PROGSUBDIRS = libtest programs
@ -90,7 +92,8 @@ EMUOBJS = \
debugger/debugger.o \
graphics/win16drv/win16drv.o \
if1632/if1632.o \
miscemu/miscemu.o
miscemu/miscemu.o \
relay32/relay32.o
all: $(MAIN_TARGET)
@ -139,6 +142,10 @@ depend:: dummy
TAGS etags:
etags `find $(TOPSRCDIR) -name '*.[chS]' -print | grep -v dbgmain`
manpages:
-$(MKDIR) $(TOPOBJDIR)/documentation/man3w
for i in $(LIBSUBDIRS); do (cd $$i && $(MAKE) man); done
clean::
for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done
for i in include; do (cd $$i; $(RM) *.o \#*\# *~ *.bak *.orig *.rej *.flc); done

6
configure vendored
View File

@ -2070,7 +2070,7 @@ fi
for ac_func in memmove tcgetattr usleep wait4 waitpid
for ac_func in memmove strerror tcgetattr usleep wait4 waitpid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:2077: checking for $ac_func" >&5
@ -2523,10 +2523,12 @@ multimedia/Makefile
objects/Makefile
ole/Makefile
programs/Makefile
programs/notepad/Makefile
programs/progman/Makefile
programs/winhelp/Makefile
programs/winver/Makefile
rc/Makefile
relay32/Makefile
resources/Makefile
scheduler/Makefile
tools/Makefile
@ -2647,10 +2649,12 @@ multimedia/Makefile
objects/Makefile
ole/Makefile
programs/Makefile
programs/notepad/Makefile
programs/progman/Makefile
programs/winhelp/Makefile
programs/winver/Makefile
rc/Makefile
relay32/Makefile
resources/Makefile
scheduler/Makefile
tools/Makefile

View File

@ -114,7 +114,7 @@ AC_SUBST(DLLFLAGS)
dnl **** Check for functions and header files ****
AC_CHECK_FUNCS(memmove tcgetattr usleep wait4 waitpid)
AC_CHECK_FUNCS(memmove strerror tcgetattr usleep wait4 waitpid)
AC_HEADER_STAT()
AC_C_CONST()
AC_TYPE_SIZE_T()
@ -148,10 +148,12 @@ multimedia/Makefile
objects/Makefile
ole/Makefile
programs/Makefile
programs/notepad/Makefile
programs/progman/Makefile
programs/winhelp/Makefile
programs/winver/Makefile
rc/Makefile
relay32/Makefile
resources/Makefile
scheduler/Makefile
tools/Makefile

View File

@ -3494,7 +3494,7 @@ static LRESULT EDIT_WM_LButtonDown(WND *wnd, EDITSTATE *es, DWORD keys, INT32 x,
e = EDIT_CharFromPos(wnd, es, x, y, &after_wrap);
EDIT_EM_SetSel(wnd, es, (keys & MK_SHIFT) ? es->selection_start : e, e, after_wrap);
EDIT_EM_ScrollCaret(wnd, es);
es->region_posx = es->region_posx = 0;
es->region_posx = es->region_posy = 0;
SetTimer32(wnd->hwndSelf, 0, 100, NULL);
return 0;
}

View File

@ -3878,7 +3878,7 @@ BOOL16 WINAPI InsertMenuItem16( HMENU16 hmenu, UINT16 pos, BOOL16 byposition,
BOOL32 WINAPI InsertMenuItem32A(HMENU32 hMenu, UINT32 uItem, BOOL32 bypos,
const MENUITEMINFO32A *lpmii)
{
MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos);
MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
return SetMenuItemInfo32_common(item, lpmii, FALSE);
}
@ -3889,7 +3889,7 @@ BOOL32 WINAPI InsertMenuItem32A(HMENU32 hMenu, UINT32 uItem, BOOL32 bypos,
BOOL32 WINAPI InsertMenuItem32W(HMENU32 hMenu, UINT32 uItem, BOOL32 bypos,
const MENUITEMINFO32W *lpmii)
{
MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos);
MENUITEM *item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
return SetMenuItemInfo32_common(item, (const MENUITEMINFO32A*)lpmii, TRUE);
}

File diff suppressed because it is too large Load Diff

View File

@ -141,7 +141,7 @@ void DEBUG_Help(void)
" delete display <disnum>\n",
"Wine-specific commands:",
" mode [16,32] walk [wnd,class,queue] <handle>",
" mode [16,32] walk [wnd,class,queue,module]",
" info (see 'help info' for options)\n",
"The 'x' command accepts repeat counts and formats (including 'i') in the",
@ -176,13 +176,13 @@ void DEBUG_HelpInfo(void)
" info display Shows auto-display expressions in use",
" info locals Displays values of all local vars for current frame",
" info maps Dumps all virtual memory mappings",
" info module Displays information about all modules",
" info queue <handle> Dumps queue information",
" info module <handle> Displays internal module state",
" info queue <handle> Displays internal queue state",
" info reg Displays values in all registers at top of stack",
" info segments Dumps information about all known segments",
" info share Dumps information about shared libraries",
" info stack Dumps information about top of stack",
" info wnd <handle> Dumps information about all windows",
" info wnd <handle> Displays internal window state",
"",
NULL
};

View File

@ -22,6 +22,10 @@ DVIFILES = wine.dvi
all: $(INFOFILES) $(DVIFILES)
info: $(INFOFILES)
dvi: $(DVIFILES)
@MAKE_RULES@
$(INFOFILES): $(SOURCES)
@ -34,13 +38,17 @@ $(INCLUDES):
$(RM) $(INCLUDES)
for i in $(INCLUDES); do $(LN_S) $(TOPSRCDIR)/$$i $$i || exit 1; done
install:: $(INFOFILES)
for i in $(INFOFILES); do $(INSTALL_DATA) $$i $(infodir)/$$i; done
install::
$(INSTALL_DATA) $(SRCDIR)/wine.man $(mandir)/wine$(manext)
# Not done by default because of makeinfo bugs
install_info: $(INFOFILES)
for i in $(INFOFILES); do $(INSTALL_DATA) $$i $(infodir)/$$i; done
clean::
$(RM) $(INFOFILES) $(DVIFILES) $(INCLUDES)
$(RM) wine.aux wine.cp wine.cps wine.fn wine.fns wine.ky wine.log \
wine.pg wine.toc wine.tp wine.tps wine.vr wine.vrs
$(RM) -r man3w
### Dependencies:

View File

@ -0,0 +1,122 @@
Wine Documentation README
Wine Man Page
The man page for the wine emulator is in this directory. It is installed
by 'make install'.
Wine Reference Manual
Texinfo source for preliminary comprehensive documentation is in
this directory. Use 'make info' in this directory to generate the GNU
info version, 'make dvi' to generate the DVI version (hit 'r' to
ignore errors), or 'make all' for both. It is no longer installed by
default.
Wine API documentation
Do a 'make manpages' in the Wine toplevel directory to generate the
API manpages from the Wine source, or 'make man' in any source
subdirectory to generate manpages from only that directory. The
manpages will be deposited in [documentation/man3w]. You will need
c2man, available as source from http://www.debian.org/ and other
places. Apply the patch included at the end of this file for improved
terse description formatting. The man pages are not installed
automatically.
Other READMEs
Other informational files are in this directory as well as scattered
through the source tree.
Other resources:
Usenet: news:comp.emulators.ms-windows.wine
WWW: http://www.winehq.com/
Writing Wine API Documentation
To improve the documentation of the Wine API, just add comments to the
existing source. For example,
/******************************************************************
* PlayMetaFile32 (GDI32.265) Render metafile to device
*
* The metafile is rendered in the device context specified by hdc.
*
* RETURNS
*
* Always returns TRUE.
*
* FIXME
* Wine metafiles are not 100% binary compatible with Microsoft Windows
* metafiles.
*/
BOOL32 WINAPI PlayMetaFile32(
HDC32 hdc, /* handle of device context in which to render metafile */
HMETAFILE32 hmf /* metafile handle */
) {
becomes, after processing with c2man and nroff -man,
PlayMetaFile32(3w) PlayMetaFile32(3w)
NAME
PlayMetaFile32 - PlayMetaFile32 (GDI32.265) Render
metafile to device
SYNOPSIS
BOOL32 PlayMetaFile32
(
HDC32 hdc,
HMETAFILE32 hmf
);
PARAMETERS
HDC32 hdc
Handle of device context in which to render
metafile.
HMETAFILE32 hmf
Metafile handle.
DESCRIPTION
The metafile is rendered in the device context specified
by hdc.
RETURNS
Always returns TRUE.
FIXME
Wine metafiles are not 100% binary compatible with
Microsoft Windows metafiles.
----------------------------------------------------------------
Patch for c2man:
diff -u c2man-2.41.orig/manpage.c c2man-2.41/manpage.c
--- c2man-2.41.orig/manpage.c Tue Apr 23 21:13:44 1996
+++ c2man-2.41/manpage.c Thu Dec 18 13:20:08 1997
@@ -585,10 +585,15 @@
const char *endterse, *afterdash = skipdash(start_line);
/* find the end of the terse comment */
- while (*c && *c != '.' && *c != '\n')
+ while (*c && *c != '\n')
+ {
c++;
+ /* '.' ends terse description only if it ends sentence */
+ if (*(c-1)=='.' && *c && isspace(*c))
+ break;
+ }
- endterse = *c == '.' ? c+1 : c;
+ endterse = c;
*terse = alloc_string(
afterdash < endterse ? afterdash : start_line,
endterse);

135
documentation/how-to-port Normal file
View File

@ -0,0 +1,135 @@
What is this?
------------
This note is a short description of
* How to port Wine to your favourite operating system
* Why you probably shouldn't use "#ifdef MyOS"
* What to do instead.
This document does not say a thing about how to port Wine to non-386
operating systems, though. You would need a CPU emulator. Let's get
Wine into a better shape on 386 first, OK?
Why "#ifdef MyOS" is probably a mistake.
---------------------------------------
Operating systems change. Maybe yours doesn't have the "foo.h"
header, but maybe a future version will have it. If you want
to "#include <foo.h>", it doesn't matter what operating system
you are using; it only matters whether "foo.h" is there.
Furthermore, operating systems change names or "fork" into
several ones. An "#ifdef MyOs" will break over time.
If you use the feature of Autoconf, the Gnu auto-configuration
utility wisely, you will help future porters automatically
because your changes will test for _features_, not names of
operating systems. A feature can be many things:
* existance of a header file
* existance of a library function
* existance of libraries
* bugs in header files, library functions, the compiler, ...
* (you name it)
You will need Gnu Autoconf, which you can get from your
friendly Gnu mirror. This program takes Wine's "configure.in"
file and produces a "configure" shell script that users use to
configure Wine to their system.
There _are_ exceptions to the "avoid #ifdef MyOS" rule. Wine,
for example, needs the internals of the signal stack -- that
cannot easily be described in terms of features.
Let's now turn to specific porting problems and how to solve
them.
MyOS doesn't have the `foo.h' header!
------------------------------------
This first step is to make Autoconf check for this header.
In configure.in you add a segment like this in the section
that checks for header files (search for "header files"):
AC_CHECK_HEADER(foo.h, AC_DEFINE(HAVE_FOO_H))
If your operating system supports a header file with the
same contents but a different name, say bar.h, add a check
for that also.
Now you can change
#include <foo.h>
to
#ifdef HAVE_FOO_H
#include <foo.h>
#elif defined (HAVE_BAR_H)
#include <bat.h>
#endif
If your system doesn't have a corresponding header file even
though it has the library functions being used, you might
have to add an "#else" section to the conditional. Avoid
this if you can.
You will also need to add "#undef HAVE_FOO_H" (etc.) to
include/config.h.in
Finish up with "make configure" and "./configure".
MyOS doesn't have the `bar' function!
------------------------------------
A typical example of this is the `memmove'. To solve this
problem you would add `memmove' to the list of functions
that Autoconf checks for. In configure.in you search for
AC_CHECK_FUNCS and add `memmove'. (You will notice that
someone already did this for this particular function.)
Secondly, you will also need to add "#undef HAVE_BAR"
to include/config.h.in
The next step depends on the nature of the missing function.
Case 1: It's easy to write a complete emulation of the
function. (`memmove' belongs to this case.)
You add your emulation in misc/port.c surrounded by
"#ifndef HAVE_MEMMOVE" and "#endif".
You might have to add a prototype for your function. If so,
include/miscemu.h might be the place. Don't forget to protect
that definition by "#ifndef HAVE_MEMMOVE" and "#endif" also!
Case 2: A general emulation is hard, but Wine is only using
a special case.
An example is the various "wait" calls used in SIGNAL_child
from loader/signal.c. Here we have a multi-branch case on
features:
#ifdef HAVE_THIS
...
#elif defined (HAVE_THAT)
...
#elif defined (HAVE_SOMETHING_ELSE)
...
#endif
Note that this is very different from testing on operating
systems. If a new version of your operating systems comes
out and adds a new function, this code will magically start
using it.
Finish up with "make configure" and "./configure".

View File

@ -8,6 +8,7 @@
#include <sys/types.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
@ -373,15 +374,15 @@ static BOOL32 DOSFS_ReadDir( DOS_DIR *dir, LPCSTR *long_name,
#ifdef VFAT_IOCTL_READDIR_BOTH
if (dir->fd != -1)
{
if (ioctl( dir->fd, VFAT_IOCTL_READDIR_BOTH, (long)dir->dirent ) == -1)
return FALSE;
if (!dir->dirent[0].d_reclen) return FALSE;
if (!DOSFS_ToDosFCBFormat( dir->dirent[0].d_name, dir->short_name ))
dir->short_name[0] = '\0';
*short_name = dir->short_name;
if (dir->dirent[1].d_name[0]) *long_name = dir->dirent[1].d_name;
else *long_name = dir->dirent[0].d_name;
return TRUE;
if (ioctl( dir->fd, VFAT_IOCTL_READDIR_BOTH, (long)dir->dirent ) != -1) {
if (!dir->dirent[0].d_reclen) return FALSE;
if (!DOSFS_ToDosFCBFormat( dir->dirent[0].d_name, dir->short_name ))
dir->short_name[0] = '\0';
*short_name = dir->short_name;
if (dir->dirent[1].d_name[0]) *long_name = dir->dirent[1].d_name;
else *long_name = dir->dirent[0].d_name;
return TRUE;
}
}
#endif /* VFAT_IOCTL_READDIR_BOTH */
@ -518,8 +519,8 @@ BOOL32 DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
if (!(dir = DOSFS_OpenDir( path )))
{
dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir\n",
path, name );
dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
path, name, strerror(errno) );
return FALSE;
}
@ -853,16 +854,18 @@ static DWORD DOSFS_DoGetFullPathName( LPCSTR name, DWORD len, LPSTR result,
p = buffer;
*p++ = 'A' + drive;
*p++ = ':';
if (IS_END_OF_NAME(*name)) /* Absolute path */
if (IS_END_OF_NAME(*name) && (*name)) /* Absolute path */
{
while ((*name == '\\') || (*name == '/')) name++;
}
else /* Relative path */
else /* Relative path or empty path */
{
*p++ = '\\';
lstrcpyn32A( p, DRIVE_GetDosCwd(drive), sizeof(buffer) - 3 );
if (*p) p += strlen(p); else p--;
}
if (!*name) /* empty path */
*p++ = '\\';
*p = '\0';
while (*name)

View File

@ -652,6 +652,57 @@ BOOL32 WINAPI GetDiskFreeSpace32W( LPCWSTR root, LPDWORD cluster_sectors,
}
/***********************************************************************
* GetDiskFreeSpaceEx32A (KERNEL32.871)
*/
BOOL32 WINAPI GetDiskFreeSpaceEx32A( LPCSTR root,
LPULARGE_INTEGER avail,
LPULARGE_INTEGER total,
LPULARGE_INTEGER totalfree)
{
int drive;
DWORD size,available;
if (!root) drive = DRIVE_GetCurrentDrive();
else
{
if ((root[1]) && ((root[1] != ':') || (root[2] != '\\')))
{
fprintf( stderr, "GetDiskFreeSpaceExA: invalid root '%s'\n",
root );
return FALSE;
}
drive = toupper(root[0]) - 'A';
}
if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
/*FIXME: Do we have the number of bytes available to the user? */
avail->HighPart = total->HighPart = 0;
avail->LowPart = available;
total->LowPart = size;
if(totalfree)
{
totalfree->HighPart =0;
totalfree->LowPart= available;
}
return TRUE;
}
/***********************************************************************
* GetDiskFreeSpaceEx32W (KERNEL32.873)
*/
BOOL32 WINAPI GetDiskFreeSpaceEx32W( LPCWSTR root, LPULARGE_INTEGER avail,
LPULARGE_INTEGER total,
LPULARGE_INTEGER totalfree)
{
LPSTR xroot;
BOOL32 ret;
xroot = HEAP_strdupWtoA( GetProcessHeap(), 0, root);
ret = GetDiskFreeSpaceEx32A( xroot, avail, total, totalfree);
HeapFree( GetProcessHeap(), 0, xroot );
return ret;
}
/***********************************************************************
* GetDriveType16 (KERNEL.136)
*/

View File

@ -147,7 +147,7 @@ void FILE_SetDosError(void)
int save_errno = errno; /* errno gets overwritten by printf */
dprintf_file(stddeb, "FILE_SetDosError: errno = %d %s\n", errno,
sys_errlist[errno] );
strerror(errno) );
switch (save_errno)
{
case EAGAIN:
@ -531,7 +531,7 @@ UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
char temppath[144];
if (!(drive & ~TF_FORCEDRIVE)) /* drive 0 means current default drive */
drive |= DRIVE_GetCurrentDrive();
drive |= DRIVE_GetCurrentDrive() + 'A';
if ((drive & TF_FORCEDRIVE) &&
!DRIVE_IsValid( toupper(drive & ~TF_FORCEDRIVE) - 'A' ))
@ -542,12 +542,17 @@ UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
}
if (drive & TF_FORCEDRIVE)
sprintf(temppath,"%c:", drive & ~TF_FORCEDRIVE );
{
sprintf( temppath, "%c:\\", drive & ~TF_FORCEDRIVE );
lstrcpyn32A( temppath + 3,
DRIVE_GetDosCwd( toupper(drive & ~TF_FORCEDRIVE) - 'A'),
129 );
}
else
{
GetTempPath32A( 132, temppath );
strcat( temppath, "\\" );
}
strcat( temppath, "\\" );
return (UINT16)GetTempFileName32A( temppath, prefix, unique, buffer );
}
@ -1603,6 +1608,8 @@ static BOOL32 DOS_AddLock(FILE_OBJECT *file, struct flock *f)
/* check if lock overlaps a current lock for the same file */
for (curr = locks; curr; curr = curr->next) {
if (strcmp(curr->unix_name, file->unix_name) == 0) {
if ((f->l_start == curr->base) && (f->l_len == curr->len))
return TRUE;/* region is identic */
if ((f->l_start < (curr->base + curr->len)) &&
((f->l_start + f->l_len) > curr->base)) {
/* region overlaps */

View File

@ -942,6 +942,8 @@ INT32 WINAPI GetPrivateProfileString32A( LPCSTR section, LPCSTR entry,
LPCSTR def_val, LPSTR buffer,
INT32 len, LPCSTR filename )
{
if (!filename)
filename = "win.ini";
if (PROFILE_Open( filename ))
return PROFILE_GetString( section, entry, def_val, buffer, len );
lstrcpyn32A( buffer, def_val, len );
@ -1021,6 +1023,27 @@ BOOL32 WINAPI WritePrivateProfileString32W( LPCWSTR section, LPCWSTR entry,
return res;
}
/***********************************************************************
* WritePrivateProfileSection32A (KERNEL32)
*/
BOOL32 WINAPI WritePrivateProfileSection32A( LPCSTR section,
LPCSTR string, LPCSTR filename )
{
char *p =(char*)string;
fprintf( stdnimp,"WritePrivateProfileSection32A empty stup\n");
if (debugging_profile) {
fprintf(stddeb,"file(%s) => [%s]\n", filename,section);
while (*(p+1)) {
fprintf(stddeb,"%s\n",p);
p += strlen(p);
p += 1;
}
}
return FALSE;
}
/***********************************************************************
* WriteOutProfiles (KERNEL.315)

View File

@ -7,12 +7,14 @@ MODULE = graphics
C_SRCS = \
bitblt.c \
cache.c \
driver.c \
env.c \
escape.c \
fontengine.c \
mapping.c \
painting.c \
path.c \
wing.c
all: $(MODULE).o

41
graphics/cache.c Normal file
View File

@ -0,0 +1,41 @@
/*
* Wine internally cached objects to speedup some things and prevent
* infinite duplication of trivial code and data.
*
* Copyright 1997 Bertho A. Stultiens
*
*/
#include "windows.h"
#include "cache.h"
static const WORD wPattern55AA[] =
{
0x5555, 0xaaaa, 0x5555, 0xaaaa,
0x5555, 0xaaaa, 0x5555, 0xaaaa
};
static HBRUSH32 hPattern55AABrush = 0;
static HBITMAP32 hPattern55AABitmap = 0;
/*********************************************************************
* CACHE_GetPattern55AABrush
*/
HBRUSH32 CACHE_GetPattern55AABrush(void)
{
if (!hPattern55AABrush)
hPattern55AABrush = CreatePatternBrush32(CACHE_GetPattern55AABitmap());
return hPattern55AABrush;
}
/*********************************************************************
* CACHE_GetPattern55AABitmap
*/
HBITMAP32 CACHE_GetPattern55AABitmap(void)
{
if (!hPattern55AABitmap)
hPattern55AABitmap = CreateBitmap32( 8, 8, 1, 1, wPattern55AA );
return hPattern55AABitmap;
}

View File

@ -12,15 +12,13 @@
#include "stddebug.h"
#include "debug.h"
static BOOL32 MFDRV_DeleteDC( DC *dc );
static const DC_FUNCTIONS MFDRV_Funcs =
{
MFDRV_Arc, /* pArc */
MFDRV_BitBlt, /* pBitBlt */
MFDRV_Chord, /* pChord */
NULL, /* pCreateDC */
MFDRV_DeleteDC, /* pDeleteDC */
NULL, /* no implementation */ /* pCreateDC */
NULL, /* no implementation */ /* pDeleteDC */
NULL, /* pDeleteObject */
MFDRV_Ellipse, /* pEllipse */
NULL, /* pEnumDeviceFonts */
@ -30,7 +28,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_ExtFloodFill, /* pExtFloodFill */
MFDRV_ExtTextOut, /* pExtTextOut */
NULL, /* pGetCharWidth */
NULL /* no implementation */, /* pGetPixel */
NULL, /* no implementation */ /* pGetPixel */
NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */
@ -131,6 +129,7 @@ static BOOL32 MFDRV_DeleteDC( DC *dc )
if (physDev->mh) HeapFree( SystemHeap, 0, physDev->mh );
HeapFree( SystemHeap, 0, physDev );
dc->physDev = NULL;
GDI_FreeObject(dc->hSelf);
return TRUE;
}
@ -154,13 +153,13 @@ HDC16 WINAPI CreateMetaFile16( LPCSTR filename )
physDev->mh->mtType = METAFILE_DISK;
if ((hFile = _lcreat32( filename, 0 )) == HFILE_ERROR32)
{
DeleteDC32( dc->hSelf );
MFDRV_DeleteDC( dc );
return 0;
}
if (_lwrite32( hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh)) == HFILE_ERROR32)
{
DeleteDC32( dc->hSelf );
MFDRV_DeleteDC( dc );
return 0;
}
physDev->mh->mtNoParameters = hFile; /* store file descriptor here */
@ -186,7 +185,7 @@ HMETAFILE16 WINAPI CloseMetaFile16( HDC16 hdc )
dprintf_metafile( stddeb, "CloseMetaFile(%04x)\n", hdc );
if (!(dc = DC_GetDCPtr( hdc ))) return 0;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ))) return 0;
physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
/* Construct the end of metafile record - this is documented
@ -195,7 +194,7 @@ HMETAFILE16 WINAPI CloseMetaFile16( HDC16 hdc )
if (!MF_MetaParam0(dc, META_EOF))
{
DeleteDC32( hdc );
MFDRV_DeleteDC( dc );
return 0;
}
@ -205,13 +204,13 @@ HMETAFILE16 WINAPI CloseMetaFile16( HDC16 hdc )
physDev->mh->mtNoParameters = 0;
if (_llseek32(hFile, 0L, 0) == HFILE_ERROR32)
{
DeleteDC32( hdc );
MFDRV_DeleteDC( dc );
return 0;
}
if (_lwrite32( hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh)) == HFILE_ERROR32)
{
DeleteDC32( hdc );
MFDRV_DeleteDC( dc );
return 0;
}
_lclose32(hFile);
@ -223,7 +222,7 @@ HMETAFILE16 WINAPI CloseMetaFile16( HDC16 hdc )
physDev->mh->mtSize * sizeof(WORD),
GetCurrentPDB(), FALSE, FALSE, FALSE, NULL );
physDev->mh = NULL; /* So it won't be deleted */
DeleteDC32( hdc );
MFDRV_DeleteDC( dc );
return hmf;
}

View File

@ -2,6 +2,7 @@
* Misc. graphics operations
*
* Copyright 1993, 1994 Alexandre Julliard
* Copyright 1997 Bertho A. Stultiens
*/
#include <math.h>
@ -20,18 +21,13 @@
#include "metafile.h"
#include "syscolor.h"
#include "palette.h"
#include "cache.h"
#include "color.h"
#include "region.h"
#include "path.h"
#include "stddebug.h"
#include "debug.h"
BOOL32 DrawDiagEdge32(HDC32 hdc, RECT32 *rect, UINT32 edge, UINT32 flags);
BOOL32 DrawRectEdge32(HDC32 hdc, RECT32 *rect, UINT32 edge, UINT32 flags);
BOOL32 DrawFrameButton32(HDC32 hdc, LPRECT32 rc, UINT32 uState);
BOOL32 DrawFrameCaption32(HDC32 hdc, LPRECT32 rc, UINT32 uState);
BOOL32 DrawFrameMenu32(HDC32 hdc, LPRECT32 rc, UINT32 uState);
BOOL32 DrawFrameScroll32(HDC32 hdc, LPRECT32 rc, UINT32 uState);
/***********************************************************************
* LineTo16 (GDI.19)
*/
@ -48,6 +44,10 @@ BOOL32 WINAPI LineTo32( HDC32 hdc, INT32 x, INT32 y )
{
DC * dc = DC_GetDCPtr( hdc );
if(dc && PATH_IsPathOpen(dc->w.path))
if(!PATH_LineTo(hdc, x, y))
return FALSE;
return dc && dc->funcs->pLineTo &&
dc->funcs->pLineTo(dc,x,y);
}
@ -87,6 +87,10 @@ BOOL32 WINAPI MoveToEx32( HDC32 hdc, INT32 x, INT32 y, LPPOINT32 pt )
{
DC * dc = DC_GetDCPtr( hdc );
if(dc && PATH_IsPathOpen(dc->w.path))
if(!PATH_MoveTo(hdc))
return FALSE;
return dc && dc->funcs->pMoveToEx &&
dc->funcs->pMoveToEx(dc,x,y,pt);
}
@ -680,7 +684,7 @@ BOOL32 WINAPI FloodFill32( HDC32 hdc, INT32 x, INT32 y, COLORREF color )
/**********************************************************************
* DrawFrameControl32 (USER32.152)
* DrawAnimatedRects32 (USER32.153)
*/
BOOL32 WINAPI DrawAnimatedRects32( HWND32 hwnd, int idAni,
const LPRECT32 lprcFrom,
@ -691,13 +695,238 @@ BOOL32 WINAPI DrawAnimatedRects32( HWND32 hwnd, int idAni,
return TRUE;
}
BOOL32 WINAPI DrawState32A(
HDC32 hdc,HBRUSH32 hbrush,DRAWSTATEPROC drawstateproc,
LPARAM lparam,WPARAM32 wparam,INT32 x,INT32 y,INT32 z,INT32 a,UINT32 b
) {
fprintf(stderr,"DrawStateA(%x,%x,%p,0x%08lx,0x%08x,%d,%d,%d,%d,%d),stub\n",
hdc,hbrush,drawstateproc,lparam,wparam,x,y,z,a,b
);
return TRUE;
/**********************************************************************
* PAINTING_DrawStateJam
*
* Jams in the requested type in the dc
*/
static BOOL32 PAINTING_DrawStateJam(HDC32 hdc, UINT32 opcode,
DRAWSTATEPROC32 func, LPARAM lp, WPARAM32 wp,
LPRECT32 rc, UINT32 dtflags,
BOOL32 unicode, BOOL32 _32bit)
{
HDC32 memdc;
HBITMAP32 hbmsave;
BOOL32 retval;
INT32 cx = rc->right - rc->left;
INT32 cy = rc->bottom - rc->top;
switch(opcode)
{
case DST_TEXT:
case DST_PREFIXTEXT:
if(unicode)
return DrawText32W(hdc, (LPWSTR)lp, (INT32)wp, rc, dtflags);
else if(_32bit)
return DrawText32A(hdc, (LPSTR)lp, (INT32)wp, rc, dtflags);
else
return DrawText32A(hdc, (LPSTR)PTR_SEG_TO_LIN(lp), (INT32)wp, rc, dtflags);
case DST_ICON:
return DrawIcon32(hdc, rc->left, rc->top, (HICON32)lp);
case DST_BITMAP:
memdc = CreateCompatibleDC32(hdc);
if(!memdc) return FALSE;
hbmsave = (HBITMAP32)SelectObject32(memdc, (HBITMAP32)lp);
if(!hbmsave)
{
DeleteDC32(memdc);
return FALSE;
}
retval = BitBlt32(hdc, rc->left, rc->top, cx, cy, memdc, 0, 0, SRCCOPY);
SelectObject32(memdc, hbmsave);
DeleteDC32(memdc);
return retval;
case DST_COMPLEX:
if(func)
if(_32bit)
return func(hdc, lp, wp, cx, cy);
else
return (BOOL32)((DRAWSTATEPROC16)func)((HDC16)hdc, (LPARAM)lp, (WPARAM16)wp, (INT16)cx, (INT16)cy);
else
return FALSE;
}
return FALSE;
}
/**********************************************************************
* PAINTING_DrawState32()
*/
static BOOL32 PAINTING_DrawState32(HDC32 hdc, HBRUSH32 hbr,
DRAWSTATEPROC32 func, LPARAM lp, WPARAM32 wp,
INT32 x, INT32 y, INT32 cx, INT32 cy,
UINT32 flags, BOOL32 unicode, BOOL32 _32bit)
{
HBITMAP32 hbm, hbmsave;
HFONT32 hfsave;
HBRUSH32 hbsave;
HDC32 memdc;
RECT32 rc;
UINT32 dtflags = DT_NOCLIP;
COLORREF fg, bg;
UINT32 opcode = flags & 0xf;
INT32 len = wp;
BOOL32 retval, tmp;
if((opcode == DST_TEXT || opcode == DST_PREFIXTEXT) && !len) /* The string is '\0' terminated */
{
if(unicode)
len = lstrlen32W((LPWSTR)lp);
else if(_32bit)
len = lstrlen32A((LPSTR)lp);
else
len = lstrlen32A((LPSTR)PTR_SEG_TO_LIN(lp));
}
/* Find out what size the image has if not given by caller */
if(!cx || !cy)
{
SIZE32 s;
CURSORICONINFO *ici;
BITMAPOBJ *bmp;
switch(opcode)
{
case DST_TEXT:
case DST_PREFIXTEXT:
if(unicode)
retval = GetTextExtentPoint32W(hdc, (LPWSTR)lp, len, &s);
else if(_32bit)
retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s);
else
retval = GetTextExtentPoint32A(hdc, PTR_SEG_TO_LIN(lp), len, &s);
if(!retval) return FALSE;
break;
case DST_ICON:
ici = (CURSORICONINFO *)GlobalLock16((HGLOBAL16)lp);
if(!ici) return FALSE;
s.cx = ici->nWidth;
s.cy = ici->nHeight;
GlobalUnlock16((HGLOBAL16)lp);
break;
case DST_BITMAP:
bmp = (BITMAPOBJ *)GDI_GetObjPtr((HBITMAP16)lp, BITMAP_MAGIC);
if(!bmp) return FALSE;
s.cx = bmp->bitmap.bmWidth;
s.cy = bmp->bitmap.bmHeight;
break;
case DST_COMPLEX: /* cx and cy must be set in this mode */
return FALSE;
}
if(!cx) cx = s.cx;
if(!cy) cy = s.cy;
}
rc.left = x;
rc.top = y;
rc.right = x + cx;
rc.bottom = y + cy;
if(flags & DSS_RIGHT) /* This one is not documented in the win32.hlp file */
dtflags |= DT_RIGHT;
if(opcode == DST_TEXT)
dtflags |= DT_NOPREFIX;
/* For DSS_NORMAL we just jam in the image and return */
if((flags & 0x7ff0) == DSS_NORMAL)
{
return PAINTING_DrawStateJam(hdc, opcode, func, lp, len, &rc, dtflags, unicode, _32bit);
}
/* For all other states we need to convert the image to B/W in a local bitmap */
/* before it is displayed */
fg = SetTextColor32(hdc, RGB(0, 0, 0));
bg = SetBkColor32(hdc, RGB(255, 255, 255));
hbm = NULL; hbmsave = NULL; memdc = NULL; memdc = NULL; hbsave = NULL;
retval = FALSE; /* assume failure */
/* From here on we must use "goto cleanup" when something goes wrong */
hbm = CreateBitmap32(cx, cy, 1, 1, NULL);
if(!hbm) goto cleanup;
memdc = CreateCompatibleDC32(hdc);
if(!memdc) goto cleanup;
hbmsave = (HBITMAP32)SelectObject32(memdc, hbm);
if(!hbmsave) goto cleanup;
rc.left = rc.top = 0;
rc.right = cx;
rc.bottom = cy;
if(!FillRect32(memdc, &rc, (HBRUSH32)GetStockObject32(WHITE_BRUSH))) goto cleanup;
SetBkColor32(memdc, RGB(255, 255, 255));
SetTextColor32(memdc, RGB(0, 0, 0));
hfsave = (HFONT32)SelectObject32(memdc, GetCurrentObject(hdc, OBJ_FONT));
if(!hfsave && (opcode == DST_TEXT || opcode == DST_PREFIXTEXT)) goto cleanup;
tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode, _32bit);
if(hfsave) SelectObject32(memdc, hfsave);
if(!tmp) goto cleanup;
/* These states cause the image to be dithered */
if(flags & (DSS_UNION|DSS_DISABLED))
{
hbsave = (HBRUSH32)SelectObject32(memdc, CACHE_GetPattern55AABrush());
if(!hbsave) goto cleanup;
tmp = PatBlt32(memdc, 0, 0, cx, cy, 0x00FA0089);
if(hbsave) SelectObject32(memdc, hbsave);
if(!tmp) goto cleanup;
}
hbsave = (HBRUSH32)SelectObject32(hdc, hbr ? hbr : GetStockObject32(WHITE_BRUSH));
if(!hbsave) goto cleanup;
if(!BitBlt32(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
/* DSS_DEFAULT makes the image boldface */
if(flags & DSS_DEFAULT)
{
if(!BitBlt32(hdc, x+1, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
}
retval = TRUE; /* We succeeded */
cleanup:
SetTextColor32(hdc, fg);
SetBkColor32(hdc, bg);
if(hbsave) SelectObject32(hdc, hbsave);
if(hbmsave) SelectObject32(memdc, hbmsave);
if(hbm) DeleteObject32(hbm);
if(memdc) DeleteDC32(memdc);
return retval;
}
/**********************************************************************
* DrawState32A() (USER32.162)
*/
BOOL32 WINAPI DrawState32A(HDC32 hdc, HBRUSH32 hbr,
DRAWSTATEPROC32 func, LPARAM ldata, WPARAM32 wdata,
INT32 x, INT32 y, INT32 cx, INT32 cy, UINT32 flags)
{
return PAINTING_DrawState32(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, FALSE, TRUE);
}
/**********************************************************************
* DrawState32W() (USER32.163)
*/
BOOL32 WINAPI DrawState32W(HDC32 hdc, HBRUSH32 hbr,
DRAWSTATEPROC32 func, LPARAM ldata, WPARAM32 wdata,
INT32 x, INT32 y, INT32 cx, INT32 cy, UINT32 flags)
{
return PAINTING_DrawState32(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, TRUE, TRUE);
}
/**********************************************************************
* DrawState16() (USER.449)
*/
BOOL16 WINAPI DrawState16(HDC16 hdc, HBRUSH16 hbr,
DRAWSTATEPROC16 func, LPARAM ldata, WPARAM16 wdata,
INT16 x, INT16 y, INT16 cx, INT16 cy, UINT16 flags)
{
return PAINTING_DrawState32(hdc, hbr, (DRAWSTATEPROC32)func, ldata, wdata, x, y, cx, cy, flags, FALSE, FALSE);
}

704
graphics/path.c Normal file
View File

@ -0,0 +1,704 @@
/*
* Graphics paths (BeginPath, EndPath etc.)
*
* Copyright 1997 Martin Boehme
*/
#include <assert.h>
#include <malloc.h>
#include "windows.h"
#include "winerror.h"
#include "dc.h"
#include "debug.h"
#include "path.h"
/* Notes on the implementation
*
* The implementation is based on dynamically resizable arrays of points and
* flags. I dithered for a bit before deciding on this implementation, and
* I had even done a bit of work on a linked list version before switching
* to arrays. It's a bit of a tradeoff. When you use linked lists, the
* implementation of FlattenPath is easier, because you can rip the
* PT_BEZIERTO entries out of the middle of the list and link the
* corresponding PT_LINETO entries in. However, when you use arrays,
* PathToRegion becomes easier, since you can essentially just pass your array
* of points to CreatePolyPolygonRgn. Also, if I'd used linked lists, I would
* have had the extra effort of creating a chunk-based allocation scheme
* in order to use memory effectively. That's why I finally decided to use
* arrays. Note by the way that the array based implementation has the same
* linear time complexity that linked lists would have since the arrays grow
* exponentially.
*
* The points are stored in the path in device coordinates. This is
* consistent with the way Windows does things (for instance, see the Win32
* SDK documentation for GetPath).
*
* The word "stroke" appears in several places (e.g. in the flag
* GdiPath.newStroke). A stroke consists of a PT_MOVETO followed by one or
* more PT_LINETOs or PT_BEZIERTOs, up to, but not including, the next
* PT_MOVETO. Note that this is not the same as the definition of a figure;
* a figure can contain several strokes.
*
* I modified the drawing functions (MoveTo, LineTo etc.) to test whether
* the path is open and to call the corresponding function in path.c if this
* is the case. A more elegant approach would be to modify the function
* pointers in the DC_FUNCTIONS structure; however, this would be a lot more
* complex. Also, the performance degradation caused by my approach in the
* case where no path is open is so small that it cannot be measured.
*
* Martin Boehme
*/
/* FIXME: A lot of stuff isn't implemented yet. There is much more to come. */
#define NUM_ENTRIES_INITIAL 16 /* Initial size of points / flags arrays */
#define GROW_FACTOR_NUMER 2 /* Numerator of grow factor for the array */
#define GROW_FACTOR_DENOM 1 /* Denominator of grow factor */
static BOOL32 PATH_PathToRegion(const GdiPath *pPath, INT32 nPolyFillMode,
HRGN32 *pHrgn);
static void PATH_EmptyPath(GdiPath *pPath);
static BOOL32 PATH_AddEntry(GdiPath *pPath, POINT32 point, BYTE flags);
static BOOL32 PATH_ReserveEntries(GdiPath *pPath, INT32 numEntries);
static BOOL32 PATH_GetPathFromHDC(HDC32 hdc, GdiPath **ppPath);
/***********************************************************************
* BeginPath32 (GDI32.9)
*/
BOOL32 WINAPI BeginPath32(HDC32 hdc)
{
GdiPath *pPath;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
/* If path is already open, do nothing */
if(pPath->state==PATH_Open)
return TRUE;
/* Make sure that path is empty */
PATH_EmptyPath(pPath);
/* Initialize variables for new path */
pPath->newStroke=TRUE;
pPath->state=PATH_Open;
return TRUE;
}
/***********************************************************************
* EndPath32 (GDI32.78)
*/
BOOL32 WINAPI EndPath32(HDC32 hdc)
{
GdiPath *pPath;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
/* Check that path is currently being constructed */
if(pPath->state!=PATH_Open)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
}
/* Set flag to indicate that path is finished */
pPath->state=PATH_Closed;
return TRUE;
}
/***********************************************************************
* AbortPath32 (GDI32.1)
*/
BOOL32 WINAPI AbortPath32(HDC32 hdc)
/* FIXME: Check that SetLastError is being called correctly */
{
GdiPath *pPath;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Remove all entries from the path */
PATH_EmptyPath(pPath);
return TRUE;
}
/***********************************************************************
* CloseFigure32 (GDI32.16)
*/
BOOL32 WINAPI CloseFigure32(HDC32 hdc)
/* FIXME: Check that SetLastError is being called correctly */
{
GdiPath *pPath;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Check that path is open */
if(pPath->state!=PATH_Open)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
}
/* Set PT_CLOSEFIGURE on the last entry and start a new stroke */
if(pPath->numEntriesUsed)
{
pPath->pFlags[pPath->numEntriesUsed-1]|=PT_CLOSEFIGURE;
pPath->newStroke=TRUE;
}
return TRUE;
}
/***********************************************************************
* GetPath32 (GDI32.210)
*/
INT32 WINAPI GetPath32(HDC32 hdc, LPPOINT32 pPoints, LPBYTE pTypes,
INT32 nSize)
{
GdiPath *pPath;
BOOL32 temp_flag;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_PARAMETER);
return -1;
}
/* Check that path is closed */
if(pPath->state!=PATH_Closed)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return -1;
}
if(nSize==0)
return pPath->numEntriesUsed;
else if(nSize<pPath->numEntriesUsed)
{
SetLastError(ERROR_INVALID_PARAMETER);
return -1;
}
else
{
memcpy(pPoints, pPath->pPoints, sizeof(POINT32)*pPath->numEntriesUsed);
memcpy(pTypes, pPath->pFlags, sizeof(BYTE)*pPath->numEntriesUsed);
/* Convert the points to logical coordinates */
temp_flag=DPtoLP32(hdc, pPoints, pPath->numEntriesUsed);
/* Since hdc is valid, conversion should never fail */
assert(temp_flag);
return pPath->numEntriesUsed;
}
}
/***********************************************************************
* PathToRegion32 (GDI32.261)
*/
HRGN32 WINAPI PathToRegion32(HDC32 hdc)
/* FIXME: Check that SetLastError is being called correctly */
/* The documentation does not state this explicitly, but a test under Windows
* shows that the region which is returned should be in device coordinates.
*/
{
GdiPath *pPath;
HRGN32 hrgnRval;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
/* Check that path is closed */
if(pPath->state!=PATH_Closed)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return 0;
}
/* FIXME: Should we empty the path even if conversion failed? */
if(PATH_PathToRegion(pPath, GetPolyFillMode32(hdc), &hrgnRval))
PATH_EmptyPath(pPath);
else
hrgnRval=0;
return hrgnRval;
}
/***********************************************************************
* FillPath32 (GDI32.100)
*/
BOOL32 WINAPI FillPath32(HDC32 hdc)
/* FIXME: Check that SetLastError is being called correctly */
{
GdiPath *pPath;
INT32 mapMode;
POINT32 ptViewportExt, ptViewportOrg, ptWindowExt, ptWindowOrg;
HRGN32 hrgn;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Check that path is closed */
if(pPath->state!=PATH_Closed)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
}
/* Construct a region from the path and fill it */
if(PATH_PathToRegion(pPath, GetPolyFillMode32(hdc), &hrgn))
{
/* Since PaintRgn interprets the region as being in logical coordinates
* but the points we store for the path are already in device
* coordinates, we have to set the mapping mode to MM_TEXT temporarily.
*/
/* Save the information about the old mapping mode */
mapMode=GetMapMode32(hdc);
GetViewportExtEx32(hdc, &ptViewportExt);
GetViewportOrgEx32(hdc, &ptViewportOrg);
GetWindowExtEx32(hdc, &ptWindowExt);
GetWindowOrgEx32(hdc, &ptWindowOrg);
/* FIXME: Once world transforms become available, we will have to do
* a GetWorldTransform, too (along with a SetWorldTransform later on).
* Moral: Perhaps I should have used SaveDC right away. The reason why
* I didn't is that I wanted to avoid the overhead of a full SaveDC
* (especially since SaveDC now saves the current path as well).
*/
/* Set MM_TEXT */
SetMapMode32(hdc, MM_TEXT);
/* Paint the region */
PaintRgn32(hdc, hrgn);
/* Restore the old mapping mode */
SetMapMode32(hdc, mapMode);
SetViewportExtEx32(hdc, ptViewportExt.x, ptViewportExt.y, NULL);
SetViewportOrgEx32(hdc, ptViewportOrg.x, ptViewportOrg.y, NULL);
SetWindowExtEx32(hdc, ptWindowExt.x, ptWindowExt.y, NULL);
SetWindowOrgEx32(hdc, ptWindowOrg.x, ptWindowOrg.y, NULL);
/* Empty the path */
PATH_EmptyPath(pPath);
return TRUE;
}
else
{
/* FIXME: Should the path be emptied even if conversion failed? */
/* PATH_EmptyPath(pPath); */
return FALSE;
}
}
/***********************************************************************
* SelectClipPath32 (GDI32.296)
*/
BOOL32 WINAPI SelectClipPath32(HDC32 hdc, int iMode)
/* FIXME: Check that SetLastError is being called correctly */
{
GdiPath *pPath;
HRGN32 hrgnPath, hrgnClip;
BOOL32 success = FALSE;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
/* Check that path is closed */
if(pPath->state!=PATH_Closed)
{
SetLastError(ERROR_CAN_NOT_COMPLETE);
return FALSE;
}
/* Construct a region from the path */
if(PATH_PathToRegion(pPath, GetPolyFillMode32(hdc), &hrgnPath))
{
hrgnClip=CreateRectRgn32(0, 0, 0, 0);
if(hrgnClip!=NULL)
{
success=(GetClipRgn32(hdc, hrgnClip)!=-1) &&
(CombineRgn32(hrgnClip, hrgnClip, hrgnPath, iMode)!=ERROR) &&
(SelectClipRgn32(hdc, hrgnClip)!=ERROR);
DeleteObject32(hrgnClip);
}
DeleteObject32(hrgnPath);
/* Empty the path */
if(success)
PATH_EmptyPath(pPath);
/* FIXME: Should this function delete the path even if it failed? */
return success;
}
else
return FALSE;
}
/***********************************************************************
* Exported functions
*/
/* PATH_InitGdiPath
*
* Initializes the GdiPath structure.
*/
void PATH_InitGdiPath(GdiPath *pPath)
{
assert(pPath!=NULL);
pPath->state=PATH_Null;
pPath->pPoints=NULL;
pPath->pFlags=NULL;
pPath->numEntriesUsed=0;
pPath->numEntriesAllocated=0;
}
/* PATH_DestroyGdiPath
*
* Destroys a GdiPath structure (frees the memory in the arrays).
*/
void PATH_DestroyGdiPath(GdiPath *pPath)
{
assert(pPath!=NULL);
free(pPath->pPoints);
free(pPath->pFlags);
}
/* PATH_AssignGdiPath
*
* Copies the GdiPath structure "pPathSrc" to "pPathDest". A deep copy is
* performed, i.e. the contents of the pPoints and pFlags arrays are copied,
* not just the pointers. Since this means that the arrays in pPathDest may
* need to be resized, pPathDest should have been initialized using
* PATH_InitGdiPath (in C++, this function would be an assignment operator,
* not a copy constructor).
* Returns TRUE if successful, else FALSE.
*/
BOOL32 PATH_AssignGdiPath(GdiPath *pPathDest, const GdiPath *pPathSrc)
{
assert(pPathDest!=NULL && pPathSrc!=NULL);
/* Make sure destination arrays are big enough */
if(!PATH_ReserveEntries(pPathDest, pPathSrc->numEntriesUsed))
return FALSE;
/* Perform the copy operation */
memcpy(pPathDest->pPoints, pPathSrc->pPoints,
sizeof(POINT32)*pPathSrc->numEntriesUsed);
memcpy(pPathDest->pFlags, pPathSrc->pFlags,
sizeof(INT32)*pPathSrc->numEntriesUsed);
pPathDest->state=pPathSrc->state;
pPathDest->numEntriesUsed=pPathSrc->numEntriesUsed;
pPathDest->newStroke=pPathSrc->newStroke;
return TRUE;
}
/* PATH_MoveTo
*
* Should be called when a MoveTo is performed on a DC that has an
* open path. This starts a new stroke. Returns TRUE if successful, else
* FALSE.
*/
BOOL32 PATH_MoveTo(HDC32 hdc)
{
GdiPath *pPath;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
return FALSE;
/* Check that path is open */
if(pPath->state!=PATH_Open)
/* FIXME: Do we have to call SetLastError? */
return FALSE;
/* Start a new stroke */
pPath->newStroke=TRUE;
return TRUE;
}
/* PATH_LineTo
*
* Should be called when a LineTo is performed on a DC that has an
* open path. This adds a PT_LINETO entry to the path (and possibly
* a PT_MOVETO entry, if this is the first LineTo in a stroke).
* Returns TRUE if successful, else FALSE.
*/
BOOL32 PATH_LineTo(HDC32 hdc, INT32 x, INT32 y)
{
GdiPath *pPath;
POINT32 point, pointCurPos;
/* Get pointer to path */
if(!PATH_GetPathFromHDC(hdc, &pPath))
return FALSE;
/* Check that path is open */
if(pPath->state!=PATH_Open)
/* FIXME: Do we have to call SetLastError? */
return FALSE;
/* Convert point to device coordinates */
point.x=x;
point.y=y;
if(!LPtoDP32(hdc, &point, 1))
return FALSE;
/* Add a PT_MOVETO if necessary */
if(pPath->newStroke)
{
pPath->newStroke=FALSE;
if(!GetCurrentPositionEx32(hdc, &pointCurPos) ||
!LPtoDP32(hdc, &pointCurPos, 1))
return FALSE;
if(!PATH_AddEntry(pPath, pointCurPos, PT_MOVETO))
return FALSE;
}
/* Add a PT_LINETO entry */
return PATH_AddEntry(pPath, point, PT_LINETO);
}
/***********************************************************************
* Internal functions
*/
/* PATH_PathToRegion
*
* Creates a region from the specified path using the specified polygon
* filling mode. The path is left unchanged. A handle to the region that
* was created is stored in *pHrgn. If successful, TRUE is returned; if an
* error occurs, SetLastError is called with the appropriate value and
* FALSE is returned.
*/
static BOOL32 PATH_PathToRegion(const GdiPath *pPath, INT32 nPolyFillMode,
HRGN32 *pHrgn)
{
int numStrokes, iStroke, i;
INT32 *pNumPointsInStroke;
HRGN32 hrgn;
assert(pPath!=NULL);
assert(pHrgn!=NULL);
/* FIXME: What happens when number of points is zero? */
/* First pass: Find out how many strokes there are in the path */
/* FIXME: We could eliminate this with some bookkeeping in GdiPath */
numStrokes=0;
for(i=0; i<pPath->numEntriesUsed; i++)
if((pPath->pFlags[i] & ~PT_CLOSEFIGURE) == PT_MOVETO)
numStrokes++;
/* Allocate memory for number-of-points-in-stroke array */
pNumPointsInStroke=(int *)malloc(sizeof(int)*numStrokes);
if(!pNumPointsInStroke)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
/* Second pass: remember number of points in each polygon */
iStroke=-1; /* Will get incremented to 0 at beginning of first stroke */
for(i=0; i<pPath->numEntriesUsed; i++)
{
/* Is this the beginning of a new stroke? */
if((pPath->pFlags[i] & ~PT_CLOSEFIGURE) == PT_MOVETO)
{
iStroke++;
pNumPointsInStroke[iStroke]=0;
}
pNumPointsInStroke[iStroke]++;
}
/* Create a region from the strokes */
hrgn=CreatePolyPolygonRgn32(pPath->pPoints, pNumPointsInStroke,
numStrokes, nPolyFillMode);
if(hrgn==NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
/* Free memory for number-of-points-in-stroke array */
free(pNumPointsInStroke);
/* Success! */
*pHrgn=hrgn;
return TRUE;
}
/* PATH_EmptyPath
*
* Removes all entries from the path and sets the path state to PATH_Null.
*/
static void PATH_EmptyPath(GdiPath *pPath)
{
assert(pPath!=NULL);
pPath->state=PATH_Null;
pPath->numEntriesUsed=0;
}
/* PATH_AddEntry
*
* Adds an entry to the path. For "flags", pass either PT_MOVETO, PT_LINETO
* or PT_BEZIERTO, optionally ORed with PT_CLOSEFIGURE. Returns TRUE if
* successful, FALSE otherwise (e.g. if not enough memory was available).
*/
BOOL32 PATH_AddEntry(GdiPath *pPath, POINT32 point, BYTE flags)
{
assert(pPath!=NULL);
/* Check that path is open */
if(pPath->state!=PATH_Open)
return FALSE;
/* Reserve enough memory for an extra path entry */
if(!PATH_ReserveEntries(pPath, pPath->numEntriesUsed+1))
return FALSE;
/* Store information in path entry */
pPath->pPoints[pPath->numEntriesUsed]=point;
pPath->pFlags[pPath->numEntriesUsed]=flags;
/* Increment entry count */
pPath->numEntriesUsed++;
return TRUE;
}
/* PATH_ReserveEntries
*
* Ensures that at least "numEntries" entries (for points and flags) have
* been allocated; allocates larger arrays and copies the existing entries
* to those arrays, if necessary. Returns TRUE if successful, else FALSE.
*/
static BOOL32 PATH_ReserveEntries(GdiPath *pPath, INT32 numEntries)
{
INT32 numEntriesToAllocate;
POINT32 *pPointsNew;
BYTE *pFlagsNew;
assert(pPath!=NULL);
assert(numEntries>=0);
/* Do we have to allocate more memory? */
if(numEntries > pPath->numEntriesAllocated)
{
/* Find number of entries to allocate. We let the size of the array
* grow exponentially, since that will guarantee linear time
* complexity. */
if(pPath->numEntriesAllocated)
{
numEntriesToAllocate=pPath->numEntriesAllocated;
while(numEntriesToAllocate<numEntries)
numEntriesToAllocate=numEntriesToAllocate*GROW_FACTOR_NUMER/
GROW_FACTOR_DENOM;
}
else
numEntriesToAllocate=NUM_ENTRIES_INITIAL;
/* Allocate new arrays */
pPointsNew=(POINT32 *)malloc(numEntriesToAllocate * sizeof(POINT32));
if(!pPointsNew)
return FALSE;
pFlagsNew=(BYTE *)malloc(numEntriesToAllocate * sizeof(BYTE));
if(!pFlagsNew)
{
free(pPointsNew);
return FALSE;
}
/* Copy old arrays to new arrays and discard old arrays */
if(pPath->pPoints)
{
assert(pPath->pFlags);
memcpy(pPointsNew, pPath->pPoints,
sizeof(POINT32)*pPath->numEntriesUsed);
memcpy(pFlagsNew, pPath->pFlags,
sizeof(BYTE)*pPath->numEntriesUsed);
free(pPath->pPoints);
free(pPath->pFlags);
}
pPath->pPoints=pPointsNew;
pPath->pFlags=pFlagsNew;
pPath->numEntriesAllocated=numEntriesToAllocate;
}
return TRUE;
}
/* PATH_GetPathFromHDC
*
* Retrieves a pointer to the GdiPath structure contained in an HDC and
* places it in *ppPath. TRUE is returned if successful, FALSE otherwise.
*/
static BOOL32 PATH_GetPathFromHDC(HDC32 hdc, GdiPath **ppPath)
{
DC *pDC;
pDC=DC_GetDCPtr(hdc);
if(pDC)
{
*ppPath=&pDC->w.path;
return TRUE;
}
else
return FALSE;
}

View File

@ -4,8 +4,11 @@
* Copyright 1997 John Harvey
*/
#include <stdio.h>
#include "heap.h"
#include "win16drv.h"
#include "stddebug.h"
#include "debug.h"
/**********************************************************************
* WIN16DRV_MoveToEx
@ -57,9 +60,9 @@ WIN16DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
BOOL32 bRet = 0;
POINT16 points[2];
printf("In WIN16drv_Rectangle, x %d y %d DCOrgX %d y %d\n",
dprintf_win16drv(stddeb, "In WIN16DRV_Rectangle, x %d y %d DCOrgX %d y %d\n",
left, top, dc->w.DCOrgX, dc->w.DCOrgY);
printf("In WIN16drv_Rectangle, VPortOrgX %d y %d\n",
dprintf_win16drv(stddeb, "In WIN16DRV_Rectangle, VPortOrgX %d y %d\n",
dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top);

View File

@ -386,8 +386,8 @@ BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
return TRUE;
}
extern BOOL32 WIN16DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top,
INT32 width, INT32 height, DWORD rop )
BOOL32 WIN16DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top,
INT32 width, INT32 height, DWORD rop )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;

View File

@ -44,7 +44,7 @@ static int __WinGOK = -1;
static BITMAPINFOHEADER __bmpiWinG = { 0, 1, -1, 1, 8, BI_RGB, 1, 0, 0, 0, 0 };
static void __initWinG()
static void __initWinG(void)
{
if( __WinGOK < 0 )
{

View File

@ -250,11 +250,14 @@ X11DRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom)
bottom -= (width + 1) / 2;
}
if (DC_SetupGCForBrush( dc ))
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + (width + 1) / 2,
dc->w.DCOrgY + top + (width + 1) / 2,
right-left-width-1, bottom-top-width-1);
if ((right > left + width) && (bottom > top + width))
{
if (DC_SetupGCForBrush( dc ))
XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left + (width + 1) / 2,
dc->w.DCOrgY + top + (width + 1) / 2,
right-left-width-1, bottom-top-width-1);
}
if (DC_SetupGCForPen( dc ))
XDrawRectangle( display, dc->u.x.drawable, dc->u.x.gc,
dc->w.DCOrgX + left, dc->w.DCOrgY + top,

View File

@ -108,8 +108,6 @@ static DeviceCaps X11DRV_DevCaps = {
*/
BOOL32 X11DRV_Init(void)
{
extern BOOL32 COLOR_Init();
/* FIXME: colormap management should be merged with the X11DRV */
if( !COLOR_Init() ) return FALSE;

View File

@ -13,6 +13,7 @@ static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
static const char PEN_alternate[] = { 1,1 }; /* FIXME */
/***********************************************************************
* PEN_SelectObject
@ -22,12 +23,15 @@ HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
HPEN32 prevHandle = dc->w.hPen;
dc->w.hPen = hpen;
dc->u.x.pen.style = pen->logpen.lopnStyle;
dc->u.x.pen.style = pen->logpen.lopnStyle & PS_STYLE_MASK;
dc->u.x.pen.endcap = pen->logpen.lopnStyle & PS_ENDCAP_MASK;
dc->u.x.pen.linejoin = pen->logpen.lopnStyle & PS_JOIN_MASK;
dc->u.x.pen.width = pen->logpen.lopnWidth.x * dc->vportExtX / dc->wndExtX;
if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
switch(pen->logpen.lopnStyle)
switch(pen->logpen.lopnStyle & PS_STYLE_MASK)
{
case PS_DASH:
dc->u.x.pen.dashes = (char *)PEN_dash;
@ -45,6 +49,14 @@ HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
dc->u.x.pen.dash_len = 6;
break;
case PS_ALTERNATE:
/* FIXME: should be alternating _pixels_ that are set */
dc->u.x.pen.dashes = (char *)PEN_alternate;
dc->u.x.pen.dash_len = 2;
break;
case PS_USERSTYLE:
/* FIXME */
break;
}
return prevHandle;

View File

@ -170,13 +170,14 @@ static UINT16 __lfCheckSum( LPLOGFONT16 plf )
return checksum;
}
static UINT16 __genericCheckSum( UINT16* ptr, int size )
static UINT16 __genericCheckSum( const void *ptr, int size )
{
UINT16 checksum = 0;
unsigned i;
unsigned int checksum = 0;
const char *p = (const char *)ptr;
while (size-- > 0)
checksum ^= (checksum << 3) + (checksum >> 29) + *p++;
for( i = 0, size >>= 1; i < size; i++ ) checksum ^= *ptr++;
return checksum;
return checksum & 0xffff;
}
/*************************************************************************
@ -613,7 +614,7 @@ static void XFONT_SetFontMetric(fontInfo* fi, fontResource* fr, XFontStruct* xfs
fi->df.dfExternalLeading = (INT16)el;
fi->df.dfPoints = (INT16)(((INT32)(fi->df.dfPixHeight -
fi->df.dfInternalLeading) * 72) / fi->df.dfVertRes);
fi->df.dfInternalLeading) * 72 + (fi->df.dfVertRes >> 1)) / fi->df.dfVertRes);
if( xfs->min_bounds.width != xfs->max_bounds.width )
fi->df.dfPitchAndFamily |= TMPF_FIXED_PITCH; /* au contraire! */
@ -831,25 +832,25 @@ static void XFONT_WindowsNames( char* buffer )
}
for( up = 0; relocTable[up]; up++ )
if( PROFILE_GetWineIniString( INIFontSection, relocTable[up], "", buffer, 128 ) )
{
while( *buffer && isspace(*buffer) ) buffer++;
for( fr = NULL, pfr = fontList; pfr; pfr = pfr->next )
if( PROFILE_GetWineIniString( INIFontSection, relocTable[up], "", buffer, 128 ) )
{
i = lstrlen32A( pfr->resource );
if( !lstrncmpi32A( pfr->resource, buffer, i) )
{
if( fr )
{
fr->next = pfr->next;
pfr->next = fontList;
fontList = pfr;
}
break;
}
fr = pfr;
while( *buffer && isspace(*buffer) ) buffer++;
for( fr = NULL, pfr = fontList; pfr; pfr = pfr->next )
{
i = lstrlen32A( pfr->resource );
if( !lstrncmpi32A( pfr->resource, buffer, i) )
{
if( fr )
{
fr->next = pfr->next;
pfr->next = fontList;
fontList = pfr;
}
break;
}
fr = pfr;
}
}
}
}
/***********************************************************************
@ -1078,7 +1079,7 @@ static BOOL32 XFONT_ReadCachedMetrics( int fd, int res, unsigned x_checksum, int
pfi->df.dfFace = pfr->lfFaceName;
pfi->df.dfHorizRes = pfi->df.dfVertRes = res;
pfi->df.dfPoints = (INT16)(((INT32)(pfi->df.dfPixHeight -
pfi->df.dfInternalLeading) * 72) / res );
pfi->df.dfInternalLeading) * 72 + (res >> 1)) / res );
pfi->next = pfi + 1;
if( j > pfr->count ) break;
@ -1244,9 +1245,10 @@ static void XFONT_CheckIniCallback(
/* Make sure this is a valid key */
if((strncasecmp(key, INISubSection, 5) == 0) ||
(strcasecmp(key, INIDefault) == 0) ||
(strcasecmp(key, INIGlobalMetrics) == 0) ||
(strcasecmp(key, INIResolution) == 0) )
(strcasecmp( key, INIDefault) == 0) ||
(strcasecmp( key, INIDefaultFixed) == 0) ||
(strcasecmp( key, INIGlobalMetrics) == 0) ||
(strcasecmp( key, INIResolution) == 0) )
{
/* Valid key; make sure the value doesn't contain a wildcard */
if(strchr(value, '*')) {
@ -1331,7 +1333,7 @@ BOOL32 X11DRV_FONT_Init( DeviceCaps* pDevCaps )
#endif
j = lstrlen32A( x_pattern[i] );
if( j ) x_checksum ^= __genericCheckSum( (UINT16*)(x_pattern[i]), j );
if( j ) x_checksum ^= __genericCheckSum( x_pattern[i], j );
}
x_checksum |= X_PFONT_MAGIC;
@ -1557,7 +1559,8 @@ static UINT32 XFONT_Match( fontMatch* pfm )
if( plf->lfCharSet == DEFAULT_CHARSET )
{
if( (pfi->df.dfCharSet!= ANSI_CHARSET) && (pfi->df.dfCharSet!=DEFAULT_CHARSET) ) penalty += 0x200;
if( (pfi->df.dfCharSet!= ANSI_CHARSET) && (pfi->df.dfCharSet!=DEFAULT_CHARSET) )
penalty += 0x200;
}
else if (plf->lfCharSet != pfi->df.dfCharSet) penalty += 0x200;
@ -1650,9 +1653,11 @@ static UINT32 XFONT_MatchFIList( fontMatch* pfm )
{
BOOL32 skipRaster = (pfm->flags & FO_MATCH_NORASTER);
UINT32 current_score, score = (UINT32)(-1);
UINT16 origflags = pfm->flags; /* Preserve FO_MATCH_XYINDEP */
fontMatch fm = *pfm;
for( fm.pfi = pfm->pfr->fi; fm.pfi && score; fm.pfi = fm.pfi->next )
for( fm.pfi = pfm->pfr->fi; fm.pfi && score; fm.pfi = fm.pfi->next,
fm.flags = origflags )
{
if( skipRaster && !(fm.pfi->fi_flags & FI_SCALABLE) )
continue;

View File

@ -6,56 +6,39 @@ VPATH = @srcdir@
MODULE = if1632
DLLS = \
advapi32.spec \
comctl32.spec \
comdlg32.spec \
commdlg.spec \
compobj.spec \
crtdll.spec \
ddeml.spec \
gdi.spec \
gdi32.spec \
kernel.spec \
kernel32.spec \
keyboard.spec \
lz32.spec \
lzexpand.spec \
mmsystem.spec \
mouse.spec \
mpr.spec \
ntdll.spec \
ole2.spec \
ole2conv.spec \
ole2disp.spec \
ole2nls.spec \
ole2prox.spec \
ole32.spec \
ole2thk.spec \
olecli.spec \
olecli32.spec \
olesvr.spec \
olesvr32.spec \
shell.spec \
shell32.spec \
sound.spec \
storage.spec \
stress.spec \
system.spec \
toolhelp.spec \
user.spec \
user32.spec \
ver.spec \
version.spec \
w32skrnl.spec \
w32sys.spec \
win32s16.spec \
win87em.spec \
winaspi.spec \
windebug.spec \
wing.spec \
winmm.spec \
winsock.spec \
winspool.spec \
wprocs.spec \
wsock32.spec
wprocs.spec
SPEC_FILES = $(DLLS:.spec=.s)
@ -68,7 +51,6 @@ C_SRCS = \
GEN_ASM_SRCS = \
$(SPEC_FILES) \
call32.s \
callfrom16.s \
callto16.s
@ -86,9 +68,6 @@ $(SPEC_FILES): $(BUILD)
callfrom16.s: $(SPEC_FILES)
$(BUILD) -o $@ -callfrom16 `cat $(SPEC_FILES) | grep CallFrom16_ | sed 's/.*CallFrom16_\(.*\)/\1/' | sort | uniq`
call32.s: $(BUILD)
$(BUILD) -o $@ -call32
callto16.s: $(SRCDIR)/thunk.c $(BUILD)
$(BUILD) -o $@ -callto16 $(SRCDIR)/thunk.c

View File

@ -8,6 +8,7 @@
#include <ctype.h>
#include <string.h>
#include "windows.h"
#include "builtin32.h"
#include "gdi.h"
#include "global.h"
#include "heap.h"
@ -34,158 +35,89 @@ typedef struct
typedef struct
{
const char *name; /* DLL name */
int base; /* Ordinal base */
int nb_funcs; /* Number of functions */
int nb_names; /* Number of function names */
const void **functions; /* Pointer to function table */
const char * const *names; /* Pointer to names table */
const WORD *ordinals; /* Pointer to ordinals table */
const BYTE *args; /* Pointer to argument lengths */
const DWORD *argtypes; /* Pointer to argument types bitmask */
} WIN32_DESCRIPTOR;
typedef union
{
const char *name; /* DLL name */
WIN16_DESCRIPTOR win16; /* Descriptor for Win16 DLL */
WIN32_DESCRIPTOR win32; /* Descriptor for Win32 DLL */
} DLL_DESCRIPTOR;
typedef struct
{
BYTE call; /* 0xe8 call callfrom32 (relative) */
DWORD callfrom32 WINE_PACKED; /* RELAY_CallFrom32 relative addr */
BYTE ret; /* 0xc2 ret $n or 0xc3 ret */
WORD args; /* nb of args to remove from the stack */
} DEBUG_ENTRY_POINT;
typedef struct
{
const DLL_DESCRIPTOR *descr; /* DLL descriptor */
DEBUG_ENTRY_POINT *dbg_funcs; /* Relay debugging functions table */
int flags; /* flags (see below) */
} BUILTIN_DLL;
const WIN16_DESCRIPTOR *descr; /* DLL descriptor */
int flags; /* flags (see below) */
} BUILTIN16_DLL;
/* DLL flags */
#define DLL_FLAG_NOT_USED 0x01 /* Use original Windows DLL if possible */
#define DLL_FLAG_ALWAYS_USED 0x02 /* Always use built-in DLL */
#define DLL_FLAG_WIN32 0x04 /* DLL is a Win32 DLL */
/* 16-bit DLLs */
extern const DLL_DESCRIPTOR KERNEL_Descriptor;
extern const DLL_DESCRIPTOR USER_Descriptor;
extern const DLL_DESCRIPTOR GDI_Descriptor;
extern const DLL_DESCRIPTOR WIN87EM_Descriptor;
extern const DLL_DESCRIPTOR MMSYSTEM_Descriptor;
extern const DLL_DESCRIPTOR SHELL_Descriptor;
extern const DLL_DESCRIPTOR SOUND_Descriptor;
extern const DLL_DESCRIPTOR KEYBOARD_Descriptor;
extern const DLL_DESCRIPTOR WINSOCK_Descriptor;
extern const DLL_DESCRIPTOR STRESS_Descriptor;
extern const DLL_DESCRIPTOR SYSTEM_Descriptor;
extern const DLL_DESCRIPTOR TOOLHELP_Descriptor;
extern const DLL_DESCRIPTOR MOUSE_Descriptor;
extern const DLL_DESCRIPTOR COMMDLG_Descriptor;
extern const DLL_DESCRIPTOR OLE2_Descriptor;
extern const DLL_DESCRIPTOR OLE2CONV_Descriptor;
extern const DLL_DESCRIPTOR OLE2DISP_Descriptor;
extern const DLL_DESCRIPTOR OLE2NLS_Descriptor;
extern const DLL_DESCRIPTOR OLE2PROX_Descriptor;
extern const DLL_DESCRIPTOR OLECLI_Descriptor;
extern const DLL_DESCRIPTOR OLESVR_Descriptor;
extern const DLL_DESCRIPTOR COMPOBJ_Descriptor;
extern const DLL_DESCRIPTOR STORAGE_Descriptor;
extern const DLL_DESCRIPTOR WPROCS_Descriptor;
extern const DLL_DESCRIPTOR DDEML_Descriptor;
extern const DLL_DESCRIPTOR LZEXPAND_Descriptor;
extern const DLL_DESCRIPTOR VER_Descriptor;
extern const DLL_DESCRIPTOR W32SYS_Descriptor;
extern const DLL_DESCRIPTOR WIN32S16_Descriptor;
extern const DLL_DESCRIPTOR WING_Descriptor;
extern const DLL_DESCRIPTOR WINASPI_Descriptor;
/* 32-bit DLLs */
extern const DLL_DESCRIPTOR ADVAPI32_Descriptor;
extern const DLL_DESCRIPTOR COMCTL32_Descriptor;
extern const DLL_DESCRIPTOR COMDLG32_Descriptor;
extern const DLL_DESCRIPTOR CRTDLL_Descriptor;
extern const DLL_DESCRIPTOR GDI32_Descriptor;
extern const DLL_DESCRIPTOR KERNEL32_Descriptor;
extern const DLL_DESCRIPTOR LZ32_Descriptor;
extern const DLL_DESCRIPTOR MPR_Descriptor;
extern const DLL_DESCRIPTOR NTDLL_Descriptor;
extern const DLL_DESCRIPTOR OLE32_Descriptor;
extern const DLL_DESCRIPTOR OLECLI32_Descriptor;
extern const DLL_DESCRIPTOR OLESVR32_Descriptor;
extern const DLL_DESCRIPTOR SHELL32_Descriptor;
extern const DLL_DESCRIPTOR USER32_Descriptor;
extern const DLL_DESCRIPTOR VERSION_Descriptor;
extern const DLL_DESCRIPTOR W32SKRNL_Descriptor;
extern const DLL_DESCRIPTOR WINMM_Descriptor;
extern const DLL_DESCRIPTOR WINSPOOL_Descriptor;
extern const DLL_DESCRIPTOR WSOCK32_Descriptor;
extern const WIN16_DESCRIPTOR COMMDLG_Descriptor;
extern const WIN16_DESCRIPTOR COMPOBJ_Descriptor;
extern const WIN16_DESCRIPTOR DDEML_Descriptor;
extern const WIN16_DESCRIPTOR GDI_Descriptor;
extern const WIN16_DESCRIPTOR KERNEL_Descriptor;
extern const WIN16_DESCRIPTOR KEYBOARD_Descriptor;
extern const WIN16_DESCRIPTOR LZEXPAND_Descriptor;
extern const WIN16_DESCRIPTOR MMSYSTEM_Descriptor;
extern const WIN16_DESCRIPTOR MOUSE_Descriptor;
extern const WIN16_DESCRIPTOR OLE2CONV_Descriptor;
extern const WIN16_DESCRIPTOR OLE2DISP_Descriptor;
extern const WIN16_DESCRIPTOR OLE2NLS_Descriptor;
extern const WIN16_DESCRIPTOR OLE2PROX_Descriptor;
extern const WIN16_DESCRIPTOR OLE2THK_Descriptor;
extern const WIN16_DESCRIPTOR OLE2_Descriptor;
extern const WIN16_DESCRIPTOR OLECLI_Descriptor;
extern const WIN16_DESCRIPTOR OLESVR_Descriptor;
extern const WIN16_DESCRIPTOR SHELL_Descriptor;
extern const WIN16_DESCRIPTOR SOUND_Descriptor;
extern const WIN16_DESCRIPTOR STORAGE_Descriptor;
extern const WIN16_DESCRIPTOR STRESS_Descriptor;
extern const WIN16_DESCRIPTOR SYSTEM_Descriptor;
extern const WIN16_DESCRIPTOR TOOLHELP_Descriptor;
extern const WIN16_DESCRIPTOR USER_Descriptor;
extern const WIN16_DESCRIPTOR VER_Descriptor;
extern const WIN16_DESCRIPTOR W32SYS_Descriptor;
extern const WIN16_DESCRIPTOR WIN32S16_Descriptor;
extern const WIN16_DESCRIPTOR WIN87EM_Descriptor;
extern const WIN16_DESCRIPTOR WINASPI_Descriptor;
extern const WIN16_DESCRIPTOR WINDEBUG_Descriptor;
extern const WIN16_DESCRIPTOR WING_Descriptor;
extern const WIN16_DESCRIPTOR WINSOCK_Descriptor;
extern const WIN16_DESCRIPTOR WPROCS_Descriptor;
/* Table of all built-in DLLs */
static BUILTIN_DLL BuiltinDLLs[] =
static BUILTIN16_DLL BuiltinDLLs[] =
{
/* Win16 DLLs */
{ &KERNEL_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &USER_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &GDI_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &SYSTEM_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &WIN87EM_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &SHELL_Descriptor, NULL, 0 },
{ &SOUND_Descriptor, NULL, 0 },
{ &KEYBOARD_Descriptor, NULL, 0 },
{ &WINSOCK_Descriptor, NULL, 0 },
{ &STRESS_Descriptor, NULL, 0 },
{ &MMSYSTEM_Descriptor, NULL, 0 },
{ &TOOLHELP_Descriptor, NULL, 0 },
{ &MOUSE_Descriptor, NULL, 0 },
{ &COMMDLG_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2CONV_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2DISP_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2NLS_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLE2PROX_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLECLI_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &OLESVR_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &COMPOBJ_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &STORAGE_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &WPROCS_Descriptor, NULL, DLL_FLAG_ALWAYS_USED },
{ &DDEML_Descriptor, NULL, DLL_FLAG_NOT_USED },
{ &LZEXPAND_Descriptor, NULL, 0 },
{ &VER_Descriptor, NULL, 0 },
{ &W32SYS_Descriptor, NULL, 0 },
{ &WIN32S16_Descriptor, NULL, 0 },
{ &WING_Descriptor, NULL, 0 },
{ &WINASPI_Descriptor, NULL, 0 },
/* Win32 DLLs */
{ &ADVAPI32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &COMCTL32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &COMDLG32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &CRTDLL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &GDI32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &KERNEL32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &LZ32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &MPR_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &NTDLL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &OLE32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &OLECLI32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &OLESVR32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
{ &SHELL32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &USER32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &VERSION_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &W32SKRNL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &WINMM_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &WINSPOOL_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &WSOCK32_Descriptor, NULL, DLL_FLAG_WIN32 },
{ &KERNEL_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &USER_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &GDI_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &SYSTEM_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &WPROCS_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &WINDEBUG_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &COMMDLG_Descriptor, DLL_FLAG_NOT_USED },
{ &COMPOBJ_Descriptor, DLL_FLAG_NOT_USED },
{ &DDEML_Descriptor, DLL_FLAG_NOT_USED },
{ &KEYBOARD_Descriptor, 0 },
{ &LZEXPAND_Descriptor, 0 },
{ &MMSYSTEM_Descriptor, 0 },
{ &MOUSE_Descriptor, 0 },
{ &OLE2CONV_Descriptor, DLL_FLAG_NOT_USED },
{ &OLE2DISP_Descriptor, DLL_FLAG_NOT_USED },
{ &OLE2NLS_Descriptor, DLL_FLAG_NOT_USED },
{ &OLE2PROX_Descriptor, DLL_FLAG_NOT_USED },
{ &OLE2THK_Descriptor, DLL_FLAG_NOT_USED },
{ &OLE2_Descriptor, DLL_FLAG_NOT_USED },
{ &OLECLI_Descriptor, DLL_FLAG_NOT_USED },
{ &OLESVR_Descriptor, DLL_FLAG_NOT_USED },
{ &SHELL_Descriptor, 0 },
{ &SOUND_Descriptor, 0 },
{ &STORAGE_Descriptor, DLL_FLAG_NOT_USED },
{ &STRESS_Descriptor, 0 },
{ &TOOLHELP_Descriptor, 0 },
{ &VER_Descriptor, 0 },
{ &W32SYS_Descriptor, 0 },
{ &WIN32S16_Descriptor, 0 },
{ &WIN87EM_Descriptor, DLL_FLAG_NOT_USED },
{ &WINASPI_Descriptor, 0 },
{ &WING_Descriptor, 0 },
{ &WINSOCK_Descriptor, 0 },
/* Last entry */
{ NULL, NULL, 0 }
{ NULL, 0 }
};
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
@ -242,188 +174,6 @@ static HMODULE16 BUILTIN_DoLoadModule16( const WIN16_DESCRIPTOR *descr )
}
/***********************************************************************
* BUILTIN_DoLoadModule32
*
* Load a built-in Win32 module. Helper function for BUILTIN_LoadModule
* and BUILTIN_Init.
*/
static HMODULE32 BUILTIN_DoLoadModule32( BUILTIN_DLL *dll )
{
extern void RELAY_CallFrom32();
HMODULE16 hModule;
NE_MODULE *pModule;
OFSTRUCT ofs;
IMAGE_DATA_DIRECTORY *dir;
IMAGE_DOS_HEADER *dos;
IMAGE_NT_HEADERS *nt;
IMAGE_SECTION_HEADER *sec;
IMAGE_EXPORT_DIRECTORY *exp;
LPVOID *funcs;
LPSTR *names;
DEBUG_ENTRY_POINT *entry;
PE_MODREF *pem;
INT32 i, size;
BYTE *addr;
/* Allocate the module */
size = (sizeof(IMAGE_DOS_HEADER)
+ sizeof(IMAGE_NT_HEADERS)
+ 2 * sizeof(IMAGE_SECTION_HEADER)
+ sizeof(IMAGE_EXPORT_DIRECTORY)
+ dll->descr->win32.nb_funcs * sizeof(LPVOID)
+ dll->descr->win32.nb_names * sizeof(LPSTR));
if (debugging_relay)
size += dll->descr->win32.nb_funcs * sizeof(DEBUG_ENTRY_POINT);
addr = VirtualAlloc( NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
if (!addr) return 0;
dos = (IMAGE_DOS_HEADER *)addr;
nt = (IMAGE_NT_HEADERS *)(dos + 1);
sec = (IMAGE_SECTION_HEADER *)(nt + 1);
exp = (IMAGE_EXPORT_DIRECTORY *)(sec + 2);
funcs = (LPVOID *)(exp + 1);
names = (LPSTR *)(funcs + dll->descr->win32.nb_funcs);
entry = (DEBUG_ENTRY_POINT *)(names + dll->descr->win32.nb_names);
/* Build the DOS and NT headers */
dos->e_magic = IMAGE_DOS_SIGNATURE;
dos->e_lfanew = sizeof(*dos);
nt->Signature = IMAGE_NT_SIGNATURE;
nt->FileHeader.Machine = IMAGE_FILE_MACHINE_I386;
nt->FileHeader.NumberOfSections = 2; /* exports + code */
nt->FileHeader.SizeOfOptionalHeader = sizeof(nt->OptionalHeader);
nt->FileHeader.Characteristics = IMAGE_FILE_DLL;
nt->OptionalHeader.Magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
nt->OptionalHeader.SizeOfCode = 0x1000;
nt->OptionalHeader.SizeOfInitializedData = 0;
nt->OptionalHeader.SizeOfUninitializedData = 0;
nt->OptionalHeader.ImageBase = (DWORD)addr;
nt->OptionalHeader.SectionAlignment = 0x1000;
nt->OptionalHeader.FileAlignment = 0x1000;
nt->OptionalHeader.MajorOperatingSystemVersion = 1;
nt->OptionalHeader.MinorOperatingSystemVersion = 0;
nt->OptionalHeader.MajorSubsystemVersion = 4;
nt->OptionalHeader.MinorSubsystemVersion = 0;
nt->OptionalHeader.SizeOfImage = size;
nt->OptionalHeader.SizeOfHeaders = (BYTE *)exp - addr;
nt->OptionalHeader.NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES;
/* Build the export directory */
dir = &nt->OptionalHeader.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY];
dir->VirtualAddress = (BYTE *)exp - addr;
dir->Size = sizeof(*exp)
+ dll->descr->win32.nb_funcs * sizeof(LPVOID)
+ dll->descr->win32.nb_names * sizeof(LPSTR);
/* Build the exports section */
strcpy( sec->Name, ".edata" );
sec->Misc.VirtualSize = dir->Size;
sec->VirtualAddress = (BYTE *)exp - addr;
sec->SizeOfRawData = dir->Size;
sec->PointerToRawData = (BYTE *)exp - addr;
sec->Characteristics = (IMAGE_SCN_CNT_INITIALIZED_DATA |
IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ |
IMAGE_SCN_MEM_WRITE);
/* Build the code section */
sec++;
strcpy( sec->Name, ".code" );
if (debugging_relay)
sec->SizeOfRawData = dll->descr->win32.nb_funcs * sizeof(DEBUG_ENTRY_POINT);
else
sec->SizeOfRawData = 1;
sec->Misc.VirtualSize = sec->SizeOfRawData;
sec->VirtualAddress = (BYTE *)entry - addr;
sec->PointerToRawData = (BYTE *)entry - addr;
sec->Characteristics = (IMAGE_SCN_CNT_INITIALIZED_DATA |
IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ);
/* Build the exports section data */
exp->Name = (BYTE *)dll->descr->name - addr; /*??*/
exp->Base = dll->descr->win32.base;
exp->NumberOfFunctions = dll->descr->win32.nb_funcs;
exp->NumberOfNames = dll->descr->win32.nb_names;
exp->AddressOfFunctions = (LPDWORD *)((BYTE *)funcs - addr);
exp->AddressOfNames = (LPDWORD *)((BYTE *)names - addr);
exp->AddressOfNameOrdinals = (LPWORD *)((BYTE *)dll->descr->win32.ordinals - addr);
/* Build the funcs table */
if (debugging_relay)
{
dll->dbg_funcs = entry;
for (i = 0; i < dll->descr->win32.nb_funcs; i++, funcs++, entry++)
{
BYTE args = dll->descr->win32.args[i];
entry->call = 0xe8; /* call */
switch(args)
{
case 0xfe: /* register func */
entry->callfrom32 = (DWORD)dll->descr->win32.functions[i] -
(DWORD)&entry->ret;
entry->ret = 0x90; /* nop */
entry->args = 0;
*funcs = (LPVOID)((BYTE *)entry - addr);
break;
case 0xff: /* stub or extern */
if (dll->descr->win32.functions[i])
*funcs = (LPVOID)((BYTE *)dll->descr->win32.functions[i]
- addr);
break;
default: /* normal function (stdcall or cdecl) */
entry->callfrom32 = (DWORD)RELAY_CallFrom32 -
(DWORD)&entry->ret;
entry->ret = (args & 0x80) ? 0xc3 : 0xc2; /*ret/ret $n*/
entry->args = (args & 0x7f) * sizeof(int);
*funcs = (LPVOID)((BYTE *)entry - addr);
break;
}
}
}
else
{
for (i = 0; i < dll->descr->win32.nb_funcs; i++, funcs++)
if (dll->descr->win32.functions[i])
*funcs = (LPVOID)((BYTE *)dll->descr->win32.functions[i]
- addr);
}
/* Build the names table */
for (i = 0; i < exp->NumberOfNames; i++, names++)
if (dll->descr->win32.names[i])
*names = (LPSTR)((BYTE *)dll->descr->win32.names[i] - addr);
/* Create a modref */
pem = (PE_MODREF *)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*pem) );
pem->module = (HMODULE32)addr;
pem->pe_export = exp;
pem->next = pCurrentProcess->modref_list;
pCurrentProcess->modref_list = pem;
/* Create a Win16 dummy module */
sprintf( ofs.szPathName, "%s.DLL", dll->descr->name );
hModule = MODULE_CreateDummyModule( &ofs );
pModule = (NE_MODULE *)GlobalLock16( hModule );
pModule->flags = NE_FFLAGS_SINGLEDATA | NE_FFLAGS_BUILTIN |
NE_FFLAGS_LIBMODULE | NE_FFLAGS_WIN32;
pModule->module32 = (HMODULE32)addr;
return pModule->module32;
}
/***********************************************************************
* BUILTIN_Init
*
@ -431,22 +181,15 @@ static HMODULE32 BUILTIN_DoLoadModule32( BUILTIN_DLL *dll )
*/
BOOL32 BUILTIN_Init(void)
{
BUILTIN_DLL *dll;
BUILTIN16_DLL *dll;
NE_MODULE *pModule;
WORD vector;
HMODULE16 hModule;
for (dll = BuiltinDLLs; dll->descr; dll++)
{
if (!(dll->flags & DLL_FLAG_ALWAYS_USED)) continue;
if (dll->flags & DLL_FLAG_WIN32)
{
if (!BUILTIN_DoLoadModule32( dll )) return FALSE;
}
else
{
if (!BUILTIN_DoLoadModule16( &dll->descr->win16 )) return FALSE;
}
if (dll->flags & DLL_FLAG_ALWAYS_USED)
if (!BUILTIN_DoLoadModule16( dll->descr )) return FALSE;
}
/* Set the USER and GDI heap selectors */
@ -488,7 +231,7 @@ BOOL32 BUILTIN_Init(void)
*/
HMODULE32 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
{
BUILTIN_DLL *table;
BUILTIN16_DLL *table;
char dllname[16], *p;
/* Fix the name in case we have a full path and extension */
@ -499,13 +242,10 @@ HMODULE32 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
for (table = BuiltinDLLs; table->descr; table++)
if (!lstrcmpi32A( table->descr->name, dllname )) break;
if (!table->descr) return 0;
if (!table->descr) return BUILTIN32_LoadModule( name, force );
if ((table->flags & DLL_FLAG_NOT_USED) && !force) return 0;
if (table->flags & DLL_FLAG_WIN32)
return BUILTIN_DoLoadModule32( table );
else
return BUILTIN_DoLoadModule16( &table->descr->win16 );
return BUILTIN_DoLoadModule16( table->descr );
}
@ -584,45 +324,6 @@ LPCSTR BUILTIN_GetEntryPoint16( WORD cs, WORD ip, WORD *pOrd )
}
/***********************************************************************
* BUILTIN_GetEntryPoint32
*
* Return the name of the DLL entry point corresponding
* to a relay entry point address. This is used only by relay debugging.
*
* This function _must_ return the real entry point to call
* after the debug info is printed.
*/
FARPROC32 BUILTIN_GetEntryPoint32( char *buffer, void *relay, DWORD *typemask )
{
BUILTIN_DLL *dll;
int ordinal, i;
const WIN32_DESCRIPTOR *descr;
/* First find the module */
for (dll = BuiltinDLLs; dll->descr; dll++)
if ((dll->flags & DLL_FLAG_WIN32) &&
((void *)dll->dbg_funcs <= relay) &&
((void *)(dll->dbg_funcs + dll->descr->win32.nb_funcs) > relay))
break;
assert(dll->descr);
descr = &dll->descr->win32;
/* Now find the function */
ordinal = ((DWORD)relay-(DWORD)dll->dbg_funcs) / sizeof(DEBUG_ENTRY_POINT);
for (i = 0; i < descr->nb_names; i++)
if (descr->ordinals[i] == ordinal) break;
assert( i < descr->nb_names );
sprintf( buffer, "%s.%d: %s", descr->name, ordinal + descr->base,
descr->names[i] );
*typemask = descr->argtypes[ordinal];
return (FARPROC32)descr->functions[ordinal];
}
/**********************************************************************
* BUILTIN_DefaultIntHandler
*
@ -644,7 +345,7 @@ void BUILTIN_DefaultIntHandler( CONTEXT *context )
*/
BOOL32 BUILTIN_ParseDLLOptions( const char *str )
{
BUILTIN_DLL *dll;
BUILTIN16_DLL *dll;
const char *p;
while (*str)
@ -685,7 +386,7 @@ BOOL32 BUILTIN_ParseDLLOptions( const char *str )
void BUILTIN_PrintDLLs(void)
{
int i;
BUILTIN_DLL *dll;
BUILTIN16_DLL *dll;
fprintf(stderr,"Example: -dll -ole2 Do not use emulated OLE2.DLL\n");
fprintf(stderr,"Available DLLs:\n");

View File

@ -213,16 +213,16 @@ file krnl386.exe
213 stub KERNEL_213
214 stub KERNEL_214
216 pascal RegEnumKey(long long ptr long) RegEnumKey16
217 pascal RegOpenKey(long ptr ptr) RegOpenKey16
218 pascal RegCreateKey(long ptr ptr) RegCreateKey16
219 pascal RegDeleteKey(long ptr) RegDeleteKey16
217 pascal RegOpenKey(long str ptr) RegOpenKey16
218 pascal RegCreateKey(long str ptr) RegCreateKey16
219 pascal RegDeleteKey(long str) RegDeleteKey16
220 pascal RegCloseKey(long) RegCloseKey
221 pascal RegSetValue(long ptr long ptr long) RegSetValue16
222 pascal RegDeleteValue(long ptr) RegDeleteValue16
221 pascal RegSetValue(long str long ptr long) RegSetValue16
222 pascal RegDeleteValue(long str) RegDeleteValue16
223 pascal RegEnumValue(long long ptr ptr ptr ptr ptr ptr) RegEnumValue16
224 pascal RegQueryValue(long ptr ptr ptr) RegQueryValue16
225 pascal RegQueryValueEx(long ptr ptr ptr ptr ptr) RegQueryValueEx16
226 pascal RegSetValueEx(long ptr long long ptr long) RegSetValueEx16
224 pascal RegQueryValue(long str ptr ptr) RegQueryValue16
225 pascal RegQueryValueEx(long str ptr ptr ptr ptr) RegQueryValueEx16
226 pascal RegSetValueEx(long str long long ptr long) RegSetValueEx16
227 pascal RegFlushKey(long) RegFlushKey
228 stub K228
229 stub K229
@ -298,7 +298,7 @@ file krnl386.exe
420 pascal GetFileAttributes(ptr) GetFileAttributes16
421 pascal16 SetFileAttributes(ptr long) SetFileAttributes16
422 pascal16 GetDiskFreeSpace(ptr ptr ptr ptr ptr) GetDiskFreeSpace16
431 stub KERNEL_431
431 pascal16 KERNEL_431(str word) KERNEL_431
432 stub FileTimeToLocalFileTime
435 stub KERNEL_435
439 stub KERNEL_439

View File

@ -12,14 +12,14 @@ type win16
32 stub STACKENTER
33 stub STACKLEAVE
34 stub MMDRVINSTALL
101 pascal JOYGETNUMDEVS() JoyGetNumDevs
102 pascal JOYGETDEVCAPS(word ptr word) JoyGetDevCaps
103 pascal JOYGETPOS(word ptr) JoyGetPos
104 pascal JOYGETTHRESHOLD(word ptr) JoyGetThreshold
105 pascal JOYRELEASECAPTURE(word) JoyReleaseCapture
106 pascal JOYSETCAPTURE(word word word word) JoySetCapture
107 pascal JOYSETTHRESHOLD(word word) JoySetThreshold
109 pascal JOYSETCALIBRATION(word) JoySetCalibration
101 pascal joyGetNumDevs() joyGetNumDevs16
102 pascal joyGetDevCaps(word ptr word) joyGetDevCaps16
103 pascal joyGetPos(word ptr) joyGetPos16
104 pascal joyGetThreshold(word ptr) joyGetThreshold16
105 pascal joyReleaseCapture(word) joyReleaseCapture16
106 pascal joySetCapture(word word word word) joySetCapture16
107 pascal joySetThreshold(word word) joySetThreshold16
109 pascal joySetCalibration(word) joySetCalibration16
110 stub JOYGETPOSEX
111 stub JOYCONFIGCHANGED
201 pascal midiOutGetNumDevs() midiOutGetNumDevs16
@ -99,20 +99,20 @@ type win16
512 pascal waveInGetPosition(word ptr word) waveInGetPosition16
513 pascal waveInGetID(word ptr) waveInGetID16
514 pascal waveInMessage(word word long long) waveInMessage16
601 pascal timeGetSystemTime(ptr word) timeGetSystemTime
602 pascal timeSetEvent(word word segptr long word) timeSetEvent
603 pascal timeKillEvent(word) timeKillEvent
604 pascal timeGetDevCaps(ptr word) timeGetDevCaps
605 pascal timeBeginPeriod(word) timeBeginPeriod
606 pascal timeEndPeriod(word) timeEndPeriod
601 pascal timeGetSystemTime(ptr word) timeGetSystemTime16
602 pascal timeSetEvent(word word segptr long word) timeSetEvent16
603 pascal timeKillEvent(word) timeKillEvent16
604 pascal timeGetDevCaps(ptr word) timeGetDevCaps16
605 pascal timeBeginPeriod(word) timeBeginPeriod16
606 pascal timeEndPeriod(word) timeEndPeriod16
607 pascal timeGetTime() timeGetTime
701 pascal MCISENDCOMMAND(word word long long) mciSendCommand
702 pascal MCISENDSTRING(str ptr word word) mciSendString
703 pascal MCIGETDEVICEID(ptr) mciGetDeviceID
705 stub MCILOADCOMMANDRESOURCE
703 pascal mciGetDeviceID(ptr) mciGetDeviceID
705 pascal mciLoadCommandResource(word str word) mciLoadCommandResource16
706 pascal mciGetErrorString(long ptr word) mciGetErrorString16
707 stub MCISETDRIVERDATA
708 stub MCIGETDRIVERDATA
707 pascal mciSetDriverData(word long) mciSetDriverData16
708 pascal mciGetDriverData(word) mciGetDriverData16
710 stub MCIDRIVERYIELD
711 stub MCIDRIVERNOTIFY
712 stub MCIEXECUTE
@ -131,9 +131,9 @@ type win16
807 pascal mixerGetLineControls(word ptr long) mixerGetLineControls16
808 pascal mixerGetControlDetails(word ptr long) mixerGetControlDetails16
809 pascal mixerSetControlDetails(word ptr long) mixerSetControlDetails16
900 stub MMTASKCREATE
900 pascal mmTaskCreate(ptr long long) mmTaskCreate16
902 stub MMTASKBLOCK
903 stub MMTASKSIGNAL
903 pascal mmTaskSignal(word) mmTaskSignal16
904 stub MMGETCURRENTTASK
905 stub MMTASKYIELD
1100 pascal DRVOPEN(str str long) DrvOpen
@ -141,12 +141,12 @@ type win16
1102 pascal DRVSENDMESSAGE(word word long long) DrvSendMessage
1103 pascal DRVGETMODULEHANDLE(word) DrvGetModuleHandle
1104 pascal DRVDEFDRIVERPROC(long word word long long) DrvDefDriverProc
1120 stub MMTHREADCREATE
1121 stub MMTHREADSIGNAL
1120 pascal mmThreadCreate(ptr ptr long long) mmThreadCreate16
1121 pascal mmThreadSignal(word) mmThreadSignal16
1122 stub MMTHREADBLOCK
1123 stub MMTHREADISCURRENT
1124 stub MMTHREADISVALID
1125 stub MMTHREADGETTASK
1125 pascal mmThreadGetTask(word) mmThreadGetTask16
1150 stub MMSHOWMMCPLPROPERTYSHEET
1210 pascal mmioOpen(str ptr long) mmioOpen16
1211 pascal MMIOCLOSE(word word) mmioClose

10
if1632/ole2thk.spec Normal file
View File

@ -0,0 +1,10 @@
name ole2thk
type win16
1 stub WEP
2 stub ROT16_ISRUNNING16
3 stub ISWIN32SHANDLE
4 stub ___EXPORTEDSTUB
5 stub COTHKCOMMON
6 stub ROT16_GETTIMEOFLASTCHANGE16
7 stub ROT16_GETOBJECT16

View File

@ -232,208 +232,6 @@ void RELAY_DebugCallTo16( int* stack, int nb_args )
}
/***********************************************************************
* RELAY_CallFrom32
*
* Stack layout on entry to this function:
* ... ...
* (esp+12) arg2
* (esp+8) arg1
* (esp+4) ret_addr
* (esp) return addr to relay code
*/
int RELAY_CallFrom32( int ret_addr, ... )
{
int i, ret;
char buffer[80];
FARPROC32 func;
DWORD mask, typemask;
int *args = &ret_addr;
/* Relay addr is the return address for this function */
BYTE *relay_addr = (BYTE *)args[-1];
WORD nb_args = *(WORD *)(relay_addr + 1) / sizeof(int);
assert(debugging_relay);
func = BUILTIN_GetEntryPoint32( buffer, relay_addr - 5, &typemask );
printf( "Call %s(", buffer );
args++;
for (i = 0, mask = 3; i < nb_args; i++, mask <<= 2)
{
if (i) printf( "," );
if ((typemask & mask) && HIWORD(args[i]))
{
if (typemask & (2<<(2*i)))
{
char buff[80];
lstrcpynWtoA( buff, (LPWSTR)args[i], sizeof(buff) );
printf( "%08x L\"%s\"", args[i], buff );
}
else printf( "%08x \"%s\"", args[i], (char *)args[i] );
}
else printf( "%08x", args[i] );
}
printf( ") ret=%08x\n", ret_addr );
if (*relay_addr == 0xc3) /* cdecl */
{
LRESULT (*cfunc)() = (LRESULT(*)())func;
switch(nb_args)
{
case 0: ret = cfunc(); break;
case 1: ret = cfunc(args[0]); break;
case 2: ret = cfunc(args[0],args[1]); break;
case 3: ret = cfunc(args[0],args[1],args[2]); break;
case 4: ret = cfunc(args[0],args[1],args[2],args[3]); break;
case 5: ret = cfunc(args[0],args[1],args[2],args[3],args[4]); break;
case 6: ret = cfunc(args[0],args[1],args[2],args[3],args[4],
args[5]); break;
case 7: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6]); break;
case 8: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7]); break;
case 9: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8]); break;
case 10: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9]); break;
case 11: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10]); break;
case 12: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],
args[11]); break;
case 13: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12]); break;
case 14: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13]); break;
case 15: ret = cfunc(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13],args[14]); break;
default:
fprintf( stderr, "RELAY_CallFrom32: Unsupported nb args %d\n",
nb_args );
assert(FALSE);
}
}
else /* stdcall */
{
switch(nb_args)
{
case 0: ret = func(); break;
case 1: ret = func(args[0]); break;
case 2: ret = func(args[0],args[1]); break;
case 3: ret = func(args[0],args[1],args[2]); break;
case 4: ret = func(args[0],args[1],args[2],args[3]); break;
case 5: ret = func(args[0],args[1],args[2],args[3],args[4]); break;
case 6: ret = func(args[0],args[1],args[2],args[3],args[4],
args[5]); break;
case 7: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6]); break;
case 8: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7]); break;
case 9: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8]); break;
case 10: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9]); break;
case 11: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10]); break;
case 12: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],
args[11]); break;
case 13: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12]); break;
case 14: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13]); break;
case 15: ret = func(args[0],args[1],args[2],args[3],args[4],args[5],
args[6],args[7],args[8],args[9],args[10],args[11],
args[12],args[13],args[14]); break;
default:
fprintf( stderr, "RELAY_CallFrom32: Unsupported nb args %d\n",
nb_args );
assert(FALSE);
}
}
printf( "Ret %s() retval=%08x ret=%08x\n", buffer, ret, ret_addr );
return ret;
}
/***********************************************************************
* RELAY_CallFrom32Regs
*
* 'stack' points to the relay addr on the stack.
* Stack layout:
* ... ...
* (esp+216) ret_addr
* (esp+212) return to relay debugging code (only when debugging_relay)
* (esp+208) entry point to call
* (esp+4) CONTEXT
* (esp) return addr to relay code
*/
void RELAY_CallFrom32Regs( CONTEXT context,
void (CALLBACK *entry_point)(CONTEXT *),
BYTE *relay_addr, int ret_addr )
{
if (!debugging_relay)
{
/* Simply call the entry point */
entry_point( &context );
}
else
{
char buffer[80];
DWORD typemask;
__RESTORE_ES;
/* Fixup the context structure because of the extra parameter */
/* pushed by the relay debugging code */
EIP_reg(&context) = ret_addr;
ESP_reg(&context) += sizeof(int);
BUILTIN_GetEntryPoint32( buffer, relay_addr - 5, &typemask );
printf("Call %s(regs) ret=%08x\n", buffer, ret_addr );
printf(" EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
EAX_reg(&context), EBX_reg(&context), ECX_reg(&context),
EDX_reg(&context), ESI_reg(&context), EDI_reg(&context) );
printf(" EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
EBP_reg(&context), ESP_reg(&context), EIP_reg(&context),
DS_reg(&context), ES_reg(&context), FS_reg(&context),
GS_reg(&context), EFL_reg(&context) );
/* Now call the real function */
entry_point( &context );
printf("Ret %s() retval=regs ret=%08x\n", buffer, ret_addr );
printf(" EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
EAX_reg(&context), EBX_reg(&context), ECX_reg(&context),
EDX_reg(&context), ESI_reg(&context), EDI_reg(&context) );
printf(" EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
EBP_reg(&context), ESP_reg(&context), EIP_reg(&context),
DS_reg(&context), ES_reg(&context), FS_reg(&context),
GS_reg(&context), EFL_reg(&context) );
}
}
/***********************************************************************
* RELAY_Unimplemented32
*
* This function is called for unimplemented 32-bit entry points (declared
* as 'stub' in the spec file).
*/
void RELAY_Unimplemented32( const char *dll_name, int ordinal,
const char *func_name, int ret_addr )
{
__RESTORE_ES; /* Just in case */
fprintf( stderr, "No handler for Win32 routine %s.%d: %s (called from %08x)\n",
dll_name, ordinal, func_name, ret_addr );
TASK_KillCurrentTask(1);
}
/**********************************************************************
* Catch (KERNEL.55)
*

View File

@ -1,10 +1,10 @@
/*
* Emulator and Win95 thunks
* Emulator thunks
*
* Copyright 1996, 1997 Alexandre Julliard
* Copyright 1997 Marcus Meissner
*/
#include <stdio.h>
#include "windows.h"
#include "callback.h"
#include "resource.h"
@ -26,8 +26,8 @@
/* by the build program to generate the file if1632/callto16.S */
/* ### start build ### */
extern LONG CALLBACK CallTo16_regs_short(const CONTEXT *context, INT32 offset);
extern LONG CALLBACK CallTo16_regs_long (const CONTEXT *context, INT32 offset);
extern LONG CALLBACK CallTo16_sreg_(const CONTEXT *context, INT32 offset);
extern LONG CALLBACK CallTo16_lreg_(const CONTEXT *context, INT32 offset);
extern WORD CALLBACK CallTo16_word_ (FARPROC16);
extern WORD CALLBACK CallTo16_word_w (FARPROC16,WORD);
extern LONG CALLBACK CallTo16_long_l (FARPROC16,LONG);
@ -98,7 +98,8 @@ extern void CallFrom16_long_wwwll(void);
/* Callbacks function table for the emulator */
static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
{
(void *)CallTo16_regs_short, /* CallRegisterProc */
(void *)CallTo16_sreg_, /* CallRegisterShortProc */
(void *)CallTo16_lreg_, /* CallRegisterLongProc */
THUNK_CallTaskReschedule, /* CallTaskRescheduleProc */
CallFrom16_long_wwwll, /* CallFrom16WndProc */
THUNK_CallWndProc16, /* CallWndProc */
@ -110,6 +111,7 @@ static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
(void *)CallTo16_word_ww, /* CallBootAppProc */
(void *)CallTo16_word_www, /* CallLoadAppSegProc */
(void *)CallTo16_word_, /* CallSystemTimerProc */
(void *)CallTo16_long_l, /* CallWOWCallbackProc */
(void *)CallTo16_long_l, /* CallASPIPostProc */
(void *)CallTo16_word_lwll, /* CallDrvControlProc */
(void *)CallTo16_word_lwlll, /* CallDrvEnableProc */
@ -183,7 +185,7 @@ static void THUNK_Free( THUNK *thunk )
return;
}
}
fprintf( stderr, "THUNK_Free: invalid thunk addr %p\n", thunk );
dprintf_thunk( stddeb, "THUNK_Free: invalid thunk addr %p\n", thunk );
}
@ -246,7 +248,7 @@ static LRESULT WINAPI THUNK_CallWndProc16( WNDPROC16 proc, HWND16 hwnd,
args[4] = hwnd;
/* args[5] and args[6] are used by relay code to store the stack pointer */
ret = CallTo16_regs_short( &context, -(5 * sizeof(WORD)) );
ret = CallTo16_sreg_( &context, -(5 * sizeof(WORD)) );
if (offset) STACK16_POP(offset);
return ret;
}
@ -572,598 +574,3 @@ FARPROC16 WINAPI THUNK_SetResourceHandler( HMODULE16 hModule, SEGPTR typeId, FAR
}
return NULL;
}
/***********************************************************************
* *
* Win95 internal thunks *
* *
***********************************************************************/
/***********************************************************************
* Generates a FT_Prolog call.
*
* 0FB6D1 movzbl edx,cl
* 8B1495xxxxxxxx mov edx,[4*edx + xxxxxxxx]
* 68xxxxxxxx push FT_Prolog
* C3 lret
*/
static void _write_ftprolog(LPBYTE thunk,DWORD thunkstart) {
LPBYTE x;
x = thunk;
*x++ = 0x0f;*x++=0xb6;*x++=0xd1; /* movzbl edx,cl */
*x++ = 0x8B;*x++=0x14;*x++=0x95;*(DWORD*)x= thunkstart;
x+=4; /* mov edx, [4*edx + thunkstart] */
*x++ = 0x68; *(DWORD*)x = (DWORD)GetProcAddress32(GetModuleHandle32A("KERNEL32"),"FT_Prolog");
x+=4; /* push FT_Prolog */
*x++ = 0xC3; /* lret */
/* fill rest with 0xCC / int 3 */
}
/***********************************************************************
* FT_PrologPrime (KERNEL32.89)
*/
void WINAPI FT_PrologPrime(DWORD startind,LPBYTE thunk) {
_write_ftprolog(thunk,*(DWORD*)(startind+thunk));
}
/***********************************************************************
* Generates a QT_Thunk style call.
*
* 33C9 xor ecx, ecx
* 8A4DFC mov cl , [ebp-04]
* 8B148Dxxxxxxxx mov edx, [4*ecx + (EAX+EDX)]
* B8yyyyyyyy mov eax, QT_Thunk
* FFE0 jmp eax
*/
static void _write_qtthunk(LPBYTE start,DWORD thunkstart) {
LPBYTE x;
x = start;
*x++ = 0x33;*x++=0xC9; /* xor ecx,ecx */
*x++ = 0x8A;*x++=0x4D;*x++=0xFC; /* movb cl,[ebp-04] */
*x++ = 0x8B;*x++=0x14;*x++=0x8D;*(DWORD*)x= thunkstart;
x+=4; /* mov edx, [4*ecx + (EAX+EDX) */
*x++ = 0xB8; *(DWORD*)x = (DWORD)GetProcAddress32(GetModuleHandle32A("KERNEL32"),"QT_Thunk");
x+=4; /* mov eax , QT_Thunk */
*x++ = 0xFF; *x++ = 0xE0; /* jmp eax */
/* should fill the rest of the 32 bytes with 0xCC */
}
/***********************************************************************
* ThunkConnect32 (KERNEL32)
* Connects a 32bit and a 16bit thunkbuffer.
*/
struct thunkstruct
{
char magic[4];
DWORD length;
DWORD ptr;
DWORD x0C;
DWORD x10;
DWORD x14;
DWORD x18;
DWORD x1C;
DWORD x20;
};
UINT32 WINAPI ThunkConnect32( struct thunkstruct *ths, LPSTR thunkfun16,
LPSTR module16, LPSTR module32, HMODULE32 hmod32,
DWORD dllinitarg1 )
{
HINSTANCE16 hmm;
SEGPTR thkbuf;
struct thunkstruct *ths16;
fprintf(stdnimp,"ThunkConnect32(<struct>,%s,%s,%s,%x,%lx)\n",
thunkfun16,module32,module16,hmod32,dllinitarg1
);
fprintf(stdnimp," magic = %c%c%c%c\n",
ths->magic[0],
ths->magic[1],
ths->magic[2],
ths->magic[3]
);
fprintf(stdnimp," length = %lx\n",ths->length);
if (lstrncmp32A(ths->magic,"SL01",4)&&lstrncmp32A(ths->magic,"LS01",4))
return 0;
hmm=LoadModule16(module16,NULL);
if (hmm<=32)
return 0;
thkbuf=(SEGPTR)WIN32_GetProcAddress16(hmm,thunkfun16);
if (!thkbuf)
return 0;
ths16=(struct thunkstruct*)PTR_SEG_TO_LIN(thkbuf);
if (lstrncmp32A(ths16->magic,ths->magic,4))
return 0;
if (!lstrncmp32A(ths->magic,"SL01",4)) {
if (ths16->length != ths->length)
return 0;
ths->x0C = (DWORD)ths16;
fprintf(stderr," ths16 magic is 0x%08lx\n",*(DWORD*)ths16->magic);
if (*((DWORD*)ths16->magic) != 0x0000304C)
return 0;
if (!*(WORD*)(((LPBYTE)ths16)+0x12))
return 0;
}
if (!lstrncmp32A(ths->magic,"LS01",4)) {
if (ths16->length != ths->length)
return 0;
ths->ptr = (DWORD)PTR_SEG_TO_LIN(ths16->ptr);
/* code offset for QT_Thunk is at 0x1C... */
_write_qtthunk (((LPBYTE)ths) + ths->x1C,ths->ptr);
/* code offset for FT_Prolog is at 0x20... */
_write_ftprolog(((LPBYTE)ths) + ths->x20,ths->ptr);
return 1;
}
return TRUE;
}
/**********************************************************************
* QT_Thunk (KERNEL32)
*
* The target address is in EDX.
* The 16 bit arguments start at ESP+4.
* The number of 16bit argumentbytes is EBP-ESP-0x44 (68 Byte thunksetup).
* [ok]
*/
VOID WINAPI QT_Thunk(CONTEXT *context)
{
CONTEXT context16;
DWORD argsize;
memcpy(&context16,context,sizeof(context16));
CS_reg(&context16) = HIWORD(EDX_reg(context));
IP_reg(&context16) = LOWORD(EDX_reg(context));
argsize = EBP_reg(context)-ESP_reg(context)-0x44;
/* additional 4 bytes used by the relaycode for storing the stackptr */
memcpy( ((LPBYTE)CURRENT_STACK16)-argsize-4,
(LPBYTE)ESP_reg(context)+4,
argsize
);
EAX_reg(context) = CallTo16_regs_short(&context16,-argsize);
}
/**********************************************************************
* WOWCallback16 (KERNEL32.62)
*/
DWORD WINAPI WOWCallback16(FARPROC16 fproc,DWORD arg)
{
DWORD ret;
fprintf(stderr,"WOWCallback16(%p,0x%08lx) ",fproc,arg);
ret = CallTo16_long_l(fproc,arg);
fprintf(stderr,"... returns %ld\n",ret);
return ret;
}
/***********************************************************************
* _KERNEL32_52 (KERNEL32.52)
* Returns a pointer to ThkBuf in the 16bit library SYSTHUNK.DLL.
* [ok probably]
*/
LPVOID WINAPI _KERNEL32_52()
{
HMODULE32 hmod = LoadLibrary16("systhunk.dll");
if (hmod<=32)
return 0;
return PTR_SEG_TO_LIN(WIN32_GetProcAddress16(hmod,"ThkBuf"));
}
/***********************************************************************
* _KERNEL32_43 (KERNEL32.42)
* A thunkbuffer link routine
* The thunkbuf looks like:
*
* 00: DWORD length ? don't know exactly
* 04: SEGPTR ptr ? where does it point to?
* The pointer ptr is written into the first DWORD of 'thunk'.
* (probably correct implemented)
* [ok probably]
*/
DWORD WINAPI _KERNEL32_43(LPDWORD thunk,LPCSTR thkbuf,DWORD len,
LPCSTR dll16,LPCSTR dll32)
{
HINSTANCE16 hmod;
LPDWORD addr;
SEGPTR segaddr;
hmod = LoadLibrary16(dll16);
if (hmod<32) {
fprintf(stderr,"KERNEL32_43->failed to load 16bit DLL %s, error %d\n",dll16,hmod);
return 0;
}
segaddr = (DWORD)WIN32_GetProcAddress16(hmod,(LPSTR)thkbuf);
if (!segaddr) {
fprintf(stderr,"KERNEL32_43->no %s exported from %s!\n",thkbuf,dll16);
return 0;
}
addr = (LPDWORD)PTR_SEG_TO_LIN(segaddr);
if (addr[0] != len) {
fprintf(stderr,"KERNEL32_43->thkbuf length mismatch? %ld vs %ld\n",len,addr[0]);
return 0;
}
if (!addr[1])
return 0;
*(DWORD*)thunk = addr[1];
return addr[1];
}
/***********************************************************************
* _KERNEL32_45 (KERNEL32.44)
* Another 32->16 thunk, the difference to QT_Thunk is, that the called routine
* uses 0x66 lret, and that we have to pass CX in DI.
* (there seems to be some kind of BL/BX return magic too...)
*
* [doesn't crash anymore]
*/
VOID WINAPI _KERNEL32_45(CONTEXT *context)
{
CONTEXT context16;
LPBYTE curstack;
DWORD ret,stacksize;
fprintf(stderr,"KERNEL32_45(%%eax=0x%08lx(%%cx=0x%04lx,%%edx=0x%08lx))\n",
(DWORD)EAX_reg(context),(DWORD)CX_reg(context),(DWORD)EDX_reg(context)
);
stacksize = EBP_reg(context)-ESP_reg(context);
fprintf(stderr," stacksize = %ld\n",stacksize);
memcpy(&context16,context,sizeof(context16));
DI_reg(&context16) = CX_reg(context);
CS_reg(&context16) = HIWORD(EAX_reg(context));
IP_reg(&context16) = LOWORD(EAX_reg(context));
curstack = PTR_SEG_TO_LIN(STACK16_PUSH(stacksize));
memcpy(curstack-stacksize,(LPBYTE)ESP_reg(context),stacksize);
ret = CallTo16_regs_long(&context16,0);
STACK16_POP(stacksize);
fprintf(stderr,". returned %08lx\n",ret);
EAX_reg(context) = ret;
}
/***********************************************************************
* _KERNEL32_40 (KERNEL32.40)
* YET Another 32->16 thunk, the difference to the others is still mysterious
* target address is EDX
*
* [crashes]
*/
VOID WINAPI _KERNEL32_40(CONTEXT *context)
{
CONTEXT context16;
LPBYTE curstack;
DWORD ret,stacksize;
fprintf(stderr,"_KERNEL32_40(EDX=0x%08lx)\n",
EDX_reg(context)
);
stacksize = EBP_reg(context)-ESP_reg(context);
fprintf(stderr," stacksize = %ld\n",stacksize);
fprintf(stderr,"on top of stack: 0x%04x\n",*(WORD*)ESP_reg(context));
memcpy(&context16,context,sizeof(context16));
CS_reg(&context16) = HIWORD(EDX_reg(context));
IP_reg(&context16) = LOWORD(EDX_reg(context));
curstack = PTR_SEG_TO_LIN(STACK16_PUSH(stacksize));
memcpy(curstack-stacksize,(LPBYTE)ESP_reg(context),stacksize);
ret = CallTo16_regs_short(&context16,0);
STACK16_POP(stacksize);
fprintf(stderr,". returned %08lx\n",ret);
EAX_reg(context) = ret;
}
/***********************************************************************
* (KERNEL32.41)
* A thunk setup routine.
* Expects a pointer to a preinitialized thunkbuffer in the first argument
* looking like:
* 00..03: unknown (pointer, check _41, _43, _46)
* 04: EB1E jmp +0x20
*
* 06..23: unknown (space for replacement code, check .90)
*
* 24:>E800000000 call offset 29
* 29:>58 pop eax ( target of call )
* 2A: 2D25000000 sub eax,0x00000025 ( now points to offset 4 )
* 2F: BAxxxxxxxx mov edx,xxxxxxxx
* 34: 68yyyyyyyy push KERNEL32.90
* 39: C3 ret
*
* 3A: EB1E jmp +0x20
* 3E ... 59: unknown (space for replacement code?)
* 5A: E8xxxxxxxx call <32bitoffset xxxxxxxx>
* 5F: 5A pop edx
* 60: 81EA25xxxxxx sub edx, 0x25xxxxxx
* 66: 52 push edx
* 67: 68xxxxxxxx push xxxxxxxx
* 6C: 68yyyyyyyy push KERNEL32.89
* 71: C3 ret
* 72: end?
* This function checks if the code is there, and replaces the yyyyyyyy entries
* by the functionpointers.
* The thunkbuf looks like:
*
* 00: DWORD length ? don't know exactly
* 04: SEGPTR ptr ? where does it point to?
* The segpointer ptr is written into the first DWORD of 'thunk'.
* [ok probably]
*/
LPVOID WINAPI _KERNEL32_41(LPBYTE thunk,LPCSTR thkbuf,DWORD len,LPCSTR dll16,
LPCSTR dll32)
{
HMODULE32 hkrnl32 = GetModuleHandle32A("KERNEL32");
HMODULE16 hmod;
LPDWORD addr,addr2;
DWORD segaddr;
/* FIXME: add checks for valid code ... */
/* write pointers to kernel32.89 and kernel32.90 (+ordinal base of 1) */
*(DWORD*)(thunk+0x35) = (DWORD)GetProcAddress32(hkrnl32,(LPSTR)90);
*(DWORD*)(thunk+0x6D) = (DWORD)GetProcAddress32(hkrnl32,(LPSTR)89);
hmod = LoadLibrary16(dll16);
if (hmod<32) {
fprintf(stderr,"KERNEL32_41->failed to load 16bit DLL %s, error %d\n",dll16,hmod);
return NULL;
}
segaddr = (DWORD)WIN32_GetProcAddress16(hmod,(LPSTR)thkbuf);
if (!segaddr) {
fprintf(stderr,"KERNEL32_41->no %s exported from %s!\n",thkbuf,dll16);
return NULL;
}
addr = (LPDWORD)PTR_SEG_TO_LIN(segaddr);
if (addr[0] != len) {
fprintf(stderr,"KERNEL32_41->thkbuf length mismatch? %ld vs %ld\n",len,addr[0]);
return NULL;
}
addr2 = PTR_SEG_TO_LIN(addr[1]);
if (HIWORD(addr2))
*(DWORD*)thunk = (DWORD)addr2;
return addr2;
}
/***********************************************************************
* (KERNEL32.90)
* QT Thunk priming function
* Rewrites the first part of the thunk to use the QT_Thunk interface
* and jumps to the start of that code.
* [ok]
*/
VOID WINAPI _KERNEL32_90(CONTEXT *context)
{
_write_qtthunk((LPBYTE)EAX_reg(context),*(DWORD*)(EAX_reg(context)+EDX_reg(context)));
/* we just call the real QT_Thunk right now
* we can bypass the relaycode, for we already have the registercontext
*/
EDX_reg(context) = *(DWORD*)((*(DWORD*)(EAX_reg(context)+EDX_reg(context)))+4*(((BYTE*)EBP_reg(context))[-4]));
return QT_Thunk(context);
}
/***********************************************************************
* (KERNEL32.45)
* Another thunkbuf link routine.
* The start of the thunkbuf looks like this:
* 00: DWORD length
* 04: SEGPTR address for thunkbuffer pointer
* [ok probably]
*/
VOID WINAPI _KERNEL32_46(LPBYTE thunk,LPSTR thkbuf,DWORD len,LPSTR dll16,
LPSTR dll32)
{
LPDWORD addr;
HMODULE16 hmod;
SEGPTR segaddr;
hmod = LoadLibrary16(dll16);
if (hmod < 32) {
fprintf(stderr,"KERNEL32_46->couldn't load %s, error %d\n",dll16,hmod);
return;
}
segaddr = (SEGPTR)WIN32_GetProcAddress16(hmod,thkbuf);
if (!segaddr) {
fprintf(stderr,"KERNEL32_46-> haven't found %s in %s!\n",thkbuf,dll16);
return;
}
addr = (LPDWORD)PTR_SEG_TO_LIN(segaddr);
if (addr[0] != len) {
fprintf(stderr,"KERNEL32_46-> length of thkbuf differs from expected length! (%ld vs %ld)\n",addr[0],len);
return;
}
*(DWORD*)PTR_SEG_TO_LIN(addr[1]) = (DWORD)thunk;
}
/**********************************************************************
* _KERNEL32_87
* Check if thunking is initialized (ss selector set up etc.)
* We do that differently, so just return TRUE.
* [ok]
*/
BOOL32 WINAPI _KERNEL32_87()
{
return TRUE;
}
/**********************************************************************
* _KERNEL32_88
* One of the real thunking functions. This one seems to be for 32<->32
* thunks. It should probably be capable of crossing processboundaries.
*
* And YES, I've seen nr=48 (somewhere in the Win95 32<->16 OLE coupling)
* [ok]
*/
DWORD WINAPIV _KERNEL32_88( DWORD nr, DWORD flags, FARPROC32 fun, ... )
{
DWORD i,ret;
DWORD *args = ((DWORD *)&fun) + 1;
fprintf(stderr,"KERNEL32_88(%ld,0x%08lx,%p,[ ",nr,flags,fun);
for (i=0;i<nr/4;i++) fprintf(stderr,"0x%08lx,",args[i]);
fprintf(stderr,"])");
switch (nr) {
case 0: ret = fun();
break;
case 4: ret = fun(args[0]);
break;
case 8: ret = fun(args[0],args[1]);
break;
case 12: ret = fun(args[0],args[1],args[2]);
break;
case 16: ret = fun(args[0],args[1],args[2],args[3]);
break;
case 20: ret = fun(args[0],args[1],args[2],args[3],args[4]);
break;
case 24: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5]);
break;
case 28: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6]);
break;
case 32: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
break;
case 36: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]);
break;
case 40: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9]);
break;
case 44: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10]);
break;
case 48: ret = fun(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11]);
break;
default:
fprintf(stderr," unsupported nr of arguments, %ld\n",nr);
ret = 0;
break;
}
fprintf(stderr," returning %ld ...\n",ret);
return ret;
}
/**********************************************************************
* KERNEL_619 (KERNEL)
* Seems to store y and z depending on x in some internal lists...
*/
WORD WINAPI _KERNEL_619(WORD x,DWORD y,DWORD z)
{
fprintf(stderr,"KERNEL_619(0x%04x,0x%08lx,0x%08lx)\n",x,y,z);
return x;
}
/**********************************************************************
* AllocSLCallback (KERNEL32)
*
* Win95 uses some structchains for callbacks. It allocates them
* in blocks of 100 entries, size 32 bytes each, layout:
* blockstart:
* 0: PTR nextblockstart
* 4: entry *first;
* 8: WORD sel ( start points to blockstart)
* A: WORD unknown
* 100xentry:
* 00..17: Code
* 18: PDB *owning_process;
* 1C: PTR blockstart
*
* We ignore this for now. (Just a note for further developers)
* FIXME: use this method, so we don't waste selectors...
*
* Following code is then generated by AllocSLCallback. The code is 16 bit, so
* the 0x66 prefix switches from word->long registers.
*
* 665A pop edx
* 6668x arg2 x pushl <arg2>
* 6652 push edx
* EAx arg1 x jmpf <arg1>
*
* returns the startaddress of this thunk.
*
* Note, that they look very similair to the ones allocates by THUNK_Alloc.
*/
DWORD WINAPI
AllocSLCallback(DWORD finalizer,DWORD callback) {
LPBYTE x,thunk = HeapAlloc( GetProcessHeap(), 0, 32 );
WORD sel;
x=thunk;
*x++=0x66;*x++=0x5a; /* popl edx */
*x++=0x66;*x++=0x68;*(DWORD*)x=finalizer;x+=4; /* pushl finalizer */
*x++=0x66;*x++=0x52; /* pushl edx */
*x++=0xea;*(DWORD*)x=callback;x+=4; /* jmpf callback */
*(DWORD*)(thunk+18) = GetCurrentProcessId();
sel = SELECTOR_AllocBlock( thunk , 32, SEGMENT_CODE, FALSE, FALSE );
return (sel<<16)|0;
}
void WINAPI
FreeSLCallback(DWORD x) {
fprintf(stderr,"FreeSLCallback(0x%08lx)\n",x);
}
/**********************************************************************
* KERNEL_358 (KERNEL)
* Allocates a code segment which starts at the address passed in x. limit
* 0xfffff, and returns the pointer to the start.
*/
DWORD WINAPI
_KERNEL_358(DWORD x) {
WORD sel;
fprintf(stderr,"_KERNEL_358(0x%08lx),stub\n",x);
if (!HIWORD(x))
return x;
sel = SELECTOR_AllocBlock( PTR_SEG_TO_LIN(x) , 0xffff, SEGMENT_CODE, FALSE, FALSE );
return (sel<<16)|(0x0000);
}
/**********************************************************************
* KERNEL_359 (KERNEL)
* Frees the code segment of the passed linear pointer (This has usually
* been allocated by _KERNEL_358).
*/
VOID WINAPI
_KERNEL_359(DWORD x) {
DWORD savedsssp;
fprintf(stderr,"_KERNEL_359(0x%08lx),stub\n",x);
if ((HIWORD(x) & 7)!=7)
return;
savedsssp = IF1632_Saved16_ss_sp;IF1632_Saved16_ss_sp = 0;
SELECTOR_FreeBlock(x>>16,1);
IF1632_Saved16_ss_sp = savedsssp;
return;
}
/**********************************************************************
* KERNEL_472 (KERNEL)
* something like GetCurrenthInstance.
*/
VOID WINAPI
_KERNEL_472(CONTEXT *context) {
fprintf(stderr,"_KERNEL_472(0x%08lx),stub\n",EAX_reg(context));
if (!EAX_reg(context)) {
TDB *pTask = (TDB*)GlobalLock16(GetCurrentTask());
AX_reg(context)=pTask->hInstance;
return;
}
if (!HIWORD(EAX_reg(context)))
return; /* returns the passed value */
/* hmm ... fixme */
}

View File

@ -17,9 +17,9 @@ type win16
63 pascal16 TaskFirst(ptr) TaskFirst
64 pascal16 TaskNext(ptr) TaskNext
65 pascal16 TaskFindHandle(ptr word) TaskFindHandle
66 stub STACKTRACEFIRST
67 stub STACKTRACECSIPFIRST
68 stub STACKTRACENEXT
66 pascal16 StackTraceFirst(ptr word) StackTraceFirst
67 pascal16 StackTraceCSIPFirst(ptr word word word word) StackTraceCSIPFirst
68 pascal16 StackTraceNext(ptr) StackTraceNext
69 pascal16 ClassFirst(ptr) ClassFirst
70 pascal16 ClassNext(ptr) ClassNext
71 pascal16 SystemHeapInfo(ptr) SystemHeapInfo

View File

@ -346,7 +346,7 @@ file user.exe
383 stub GetWindowContextHelpID
384 stub SetMenuContextHelpID
385 stub GetMenuContextHelpID
389 stub LoadImage
389 pascal LoadImage(word segstr word word word word) LoadImage16
390 stub CopyImage
391 stub SignalProc32
394 pascal16 DrawIconEx(word word word word word word word word word) DrawIconEx16
@ -373,7 +373,7 @@ file user.exe
417 pascal GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions
418 pascal16 SetMenuItemBitmaps(word word word word word) SetMenuItemBitmaps16
420 pascal16 wsprintf() WIN16_wsprintf16
421 pascal16 wvsprintf(ptr ptr ptr) wvsprintf16
421 pascal16 wvsprintf(ptr str ptr) wvsprintf16
422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16
423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16
427 pascal16 FindWindowEx(word word segstr str) FindWindowEx16

View File

@ -2,7 +2,7 @@ name win32s16
type win16
1 stub WEP
2 stub BOOTTASK
2 pascal16 BootTask() BootTask
3 stub CREATEPROCESS
4 stub WAITFORDEBUGEVENT
5 pascal CONTINUEDEBUGEVENT(long long long) ContinueDebugEvent
@ -48,8 +48,8 @@ type win16
45 stub FAPILOG16
46 stub ALLOCCALLBACK
47 stub LINEARTOHUGESELECTOROFFSET
48 stub UTSELECTOROFFSETTOLINEAR
49 stub UTLINEARTOSELECTOROFFSET
48 pascal UTSelectorOffsetToLinear(ptr) UTSelectorOffsetToLinear
49 pascal UTLinearToSelectorOffset(ptr) UTLinearToSelectorOffset
50 stub SELFOREIGNTIB
51 stub MYGLOBALREALLOC
52 stub CREATEPEHEADER

6
if1632/windebug.spec Normal file
View File

@ -0,0 +1,6 @@
name windebug
type win16
1 stub WINDEBUG
2 stub WEP
3 pascal WinNotify() WinNotify

View File

@ -16,7 +16,7 @@ type win16
8 pascal htonl(long) WINSOCK_htonl
9 pascal16 htons(word) WINSOCK_htons
10 pascal inet_addr(ptr) WINSOCK_inet_addr
11 pascal inet_ntoa(long) WINSOCK_inet_ntoa
11 pascal inet_ntoa(long) WINSOCK_inet_ntoa16
12 pascal16 ioctlsocket(word long ptr) WINSOCK_ioctlsocket16
13 pascal16 listen(word word) WINSOCK_listen16
14 pascal ntohl(long) WINSOCK_ntohl
@ -36,20 +36,20 @@ type win16
55 pascal getservbyname(ptr ptr) WINSOCK_getservbyname16
56 pascal getservbyport(word ptr) WINSOCK_getservbyport16
57 pascal gethostname(ptr word) WINSOCK_gethostname16
101 pascal16 WSAAsyncSelect(word word word long) WSAAsyncSelect
101 pascal16 WSAAsyncSelect(word word word long) WSAAsyncSelect16
102 pascal16 WSAAsyncGetHostByAddr(word word ptr word word segptr word)
WSAAsyncGetHostByAddr
WSAAsyncGetHostByAddr16
103 pascal16 WSAAsyncGetHostByName(word word ptr segptr word)
WSAAsyncGetHostByName
WSAAsyncGetHostByName16
104 pascal16 WSAAsyncGetProtoByNumber(word word word segptr word)
WSAAsyncGetProtoByNumber
WSAAsyncGetProtoByNumber16
105 pascal16 WSAAsyncGetProtoByName(word word ptr segptr word)
WSAAsyncGetProtoByName
WSAAsyncGetProtoByName16
106 pascal16 WSAAsyncGetServByPort(word word word ptr segptr word)
WSAAsyncGetServByPort
WSAAsyncGetServByPort16
107 pascal16 WSAAsyncGetServByName(word word ptr ptr segptr word)
WSAAsyncGetServByName
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest
WSAAsyncGetServByName16
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest16
109 pascal16 WSASetBlockingHook(segptr) WSASetBlockingHook16
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook16
111 pascal16 WSAGetLastError() WSAGetLastError

31
include/builtin32.h Normal file
View File

@ -0,0 +1,31 @@
/*
* Win32 built-in DLLs definitions
*
* Copyright 1997 Alexandre Julliard
*/
#ifndef __WINE_BUILTIN32_H
#define __WINE_BUILTIN32_H
typedef void (*ENTRYPOINT32)();
typedef struct
{
const char *name; /* DLL name */
int base; /* Ordinal base */
int nb_funcs; /* Number of functions */
int nb_names; /* Number of function names */
int nb_reg_funcs; /* Number of register functions */
const ENTRYPOINT32 *functions; /* Pointer to function table */
const char * const *names; /* Pointer to names table */
const unsigned short *ordinals; /* Pointer to ordinals table */
const unsigned char *args; /* Pointer to argument lengths */
const unsigned int *argtypes; /* Pointer to argument types bitmask */
} BUILTIN32_DESCRIPTOR;
extern ENTRYPOINT32 BUILTIN32_GetEntryPoint( char *buffer, void *relay,
unsigned int *typemask );
extern void BUILTIN32_Unimplemented( const BUILTIN32_DESCRIPTOR *descr,
int ordinal );
#endif /* __WINE_BUILTIN32_H */

17
include/cache.h Normal file
View File

@ -0,0 +1,17 @@
/*
* Wine internally cached objects to speedup some things and prevent
* infinite duplication of trivial code and data.
*
* Copyright 1997 Bertho A. Stultiens
*
*/
#ifndef __WINE_CACHE_H
#define __WINE_CACHE_H
#include "wintypes.h"
HBRUSH32 CACHE_GetPattern55AABrush(void);
HBITMAP32 CACHE_GetPattern55AABitmap(void);
#endif /* __WINE_CACHE_H */

View File

@ -19,7 +19,8 @@ extern int (*IF1632_CallLargeStack)( int (*func)(), void *arg );
typedef struct
{
VOID (CALLBACK *CallRegisterProc)( CONTEXT *, INT32 );
LONG (CALLBACK *CallRegisterShortProc)( CONTEXT *, INT32 );
LONG (CALLBACK *CallRegisterLongProc)( CONTEXT *, INT32 );
VOID (CALLBACK *CallTaskRescheduleProc)(void);
VOID (CALLBACK *CallFrom16WndProc)(void);
LRESULT (CALLBACK *CallWndProc)( WNDPROC16, HWND16, UINT16,
@ -36,6 +37,7 @@ typedef struct
VOID (CALLBACK *CallBootAppProc)( FARPROC16, HANDLE16, HFILE16 );
WORD (CALLBACK *CallLoadAppSegProc)( FARPROC16, HANDLE16, HFILE16, WORD );
VOID (CALLBACK *CallSystemTimerProc)( FARPROC16 );
DWORD (CALLBACK *CallWOWCallbackProc)( FARPROC16, DWORD );
LRESULT (CALLBACK *CallASPIPostProc)( FARPROC16, SEGPTR );
/* Following are the graphics driver callbacks */
WORD (CALLBACK *CallDrvControlProc)( FARPROC16, SEGPTR, WORD,

View File

@ -14,6 +14,7 @@
#define PC_SYS_RESERVED 0x40 /* system palentry is not to be mapped to */
#define PC_SYS_MAPPED 0x10 /* logical palentry is a direct alias for system palentry */
extern BOOL32 COLOR_Init(void);
extern void COLOR_Cleanup(void);
extern COLORREF COLOR_ToLogical(int pixel);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
@ -22,11 +23,13 @@ extern BOOL32 COLOR_IsSolid( COLORREF color );
extern Colormap COLOR_GetColormap();
extern UINT16 COLOR_GetSystemPaletteSize();
extern UINT16 COLOR_GetSystemPaletteFlags();
extern const PALETTEENTRY* COLOR_GetSystemPaletteTemplate(void);
extern BOOL32 COLOR_GetMonoPlane( int* );
extern COLORREF COLOR_LookupNearestColor( PALETTEENTRY*, int, COLORREF );
extern int COLOR_PaletteLookupPixel( PALETTEENTRY*, int, int* , COLORREF, BOOL32 );
extern COLORREF COLOR_GetSystemPaletteEntry(UINT32);
extern int COLOR_LookupSystemPixel(COLORREF col);
extern int COLOR_mapEGAPixel[16];
extern int* COLOR_PaletteToPixel;

View File

@ -11,7 +11,7 @@ struct tagGUID
BYTE Data4[8];
};
typedef struct tagGUID GUID;
typedef struct tagGUID GUID,*LPGUID;
typedef struct tagGUID CLSID,*LPCLSID,*REFCLSID;
typedef struct tagGUID IID,*REFIID,*LPIID;

View File

@ -21,6 +21,9 @@
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR

View File

@ -50,6 +50,9 @@ typedef struct
#pragma pack(4)
extern HCURSOR16 CURSORICON_IconToCursor( HICON16 hIcon,
BOOL32 bSemiTransparent );
extern Cursor CURSORICON_XCursor; /* Current X cursor */
#endif /* __WINE_CURSORICON_H */

View File

@ -22,6 +22,7 @@
#define DCX_DCEEMPTY 0x00000800
#define DCX_DCEBUSY 0x00001000
#define DCX_DCEDIRTY 0x00002000
#define DCX_WINDOWPAINT 0x00020000
#define DCX_KEEPCLIPRGN 0x00040000
#define DCX_NOCLIPCHILDREN 0x00080000

View File

@ -78,6 +78,7 @@
#undef DEBUG_STRING
#undef DEBUG_TASK
#undef DEBUG_TEXT
#undef DEBUG_THUNK
#undef DEBUG_TIMER
#undef DEBUG_TOOLHELP
#undef DEBUG_TWEAK
@ -164,6 +165,7 @@
#define DEBUG_STRING
#define DEBUG_TASK
#define DEBUG_TEXT
#define DEBUG_THUNK
#define DEBUG_TIMER
#define DEBUG_TOOLHELP
#define DEBUG_TWEAK
@ -540,6 +542,11 @@ short debug_msg_enabled[]={
#else
0,
#endif
#ifdef DEBUG_THUNK
1,
#else
0,
#endif
#ifdef DEBUG_TIMER
1,
#else
@ -1539,8 +1546,21 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_timer if(!debug_msg_enabled[72]) ; else fprintf
#define debugging_timer debug_msg_enabled[72]
#define dprintf_thunk if(!debug_msg_enabled[72]) ; else fprintf
#define debugging_thunk debug_msg_enabled[72]
#else
#ifdef DEBUG_THUNK
#define dprintf_thunk fprintf
#define debugging_thunk 1
#else
#define dprintf_thunk while(0) fprintf
#define debugging_thunk 0
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_timer if(!debug_msg_enabled[73]) ; else fprintf
#define debugging_timer debug_msg_enabled[73]
#else
#ifdef DEBUG_TIMER
#define dprintf_timer fprintf
@ -1552,8 +1572,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_toolhelp if(!debug_msg_enabled[73]) ; else fprintf
#define debugging_toolhelp debug_msg_enabled[73]
#define dprintf_toolhelp if(!debug_msg_enabled[74]) ; else fprintf
#define debugging_toolhelp debug_msg_enabled[74]
#else
#ifdef DEBUG_TOOLHELP
#define dprintf_toolhelp fprintf
@ -1565,8 +1585,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_tweak if(!debug_msg_enabled[74]) ; else fprintf
#define debugging_tweak debug_msg_enabled[74]
#define dprintf_tweak if(!debug_msg_enabled[75]) ; else fprintf
#define debugging_tweak debug_msg_enabled[75]
#else
#ifdef DEBUG_TWEAK
#define dprintf_tweak fprintf
@ -1578,8 +1598,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_updown if(!debug_msg_enabled[75]) ; else fprintf
#define debugging_updown debug_msg_enabled[75]
#define dprintf_updown if(!debug_msg_enabled[76]) ; else fprintf
#define debugging_updown debug_msg_enabled[76]
#else
#ifdef DEBUG_UPDOWN
#define dprintf_updown fprintf
@ -1591,8 +1611,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_ver if(!debug_msg_enabled[76]) ; else fprintf
#define debugging_ver debug_msg_enabled[76]
#define dprintf_ver if(!debug_msg_enabled[77]) ; else fprintf
#define debugging_ver debug_msg_enabled[77]
#else
#ifdef DEBUG_VER
#define dprintf_ver fprintf
@ -1604,8 +1624,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_virtual if(!debug_msg_enabled[77]) ; else fprintf
#define debugging_virtual debug_msg_enabled[77]
#define dprintf_virtual if(!debug_msg_enabled[78]) ; else fprintf
#define debugging_virtual debug_msg_enabled[78]
#else
#ifdef DEBUG_VIRTUAL
#define dprintf_virtual fprintf
@ -1617,8 +1637,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_vxd if(!debug_msg_enabled[78]) ; else fprintf
#define debugging_vxd debug_msg_enabled[78]
#define dprintf_vxd if(!debug_msg_enabled[79]) ; else fprintf
#define debugging_vxd debug_msg_enabled[79]
#else
#ifdef DEBUG_VXD
#define dprintf_vxd fprintf
@ -1630,8 +1650,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_win if(!debug_msg_enabled[79]) ; else fprintf
#define debugging_win debug_msg_enabled[79]
#define dprintf_win if(!debug_msg_enabled[80]) ; else fprintf
#define debugging_win debug_msg_enabled[80]
#else
#ifdef DEBUG_WIN
#define dprintf_win fprintf
@ -1643,8 +1663,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_win16drv if(!debug_msg_enabled[80]) ; else fprintf
#define debugging_win16drv debug_msg_enabled[80]
#define dprintf_win16drv if(!debug_msg_enabled[81]) ; else fprintf
#define debugging_win16drv debug_msg_enabled[81]
#else
#ifdef DEBUG_WIN16DRV
#define dprintf_win16drv fprintf
@ -1656,8 +1676,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_win32 if(!debug_msg_enabled[81]) ; else fprintf
#define debugging_win32 debug_msg_enabled[81]
#define dprintf_win32 if(!debug_msg_enabled[82]) ; else fprintf
#define debugging_win32 debug_msg_enabled[82]
#else
#ifdef DEBUG_WIN32
#define dprintf_win32 fprintf
@ -1669,8 +1689,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_winsock if(!debug_msg_enabled[82]) ; else fprintf
#define debugging_winsock debug_msg_enabled[82]
#define dprintf_winsock if(!debug_msg_enabled[83]) ; else fprintf
#define debugging_winsock debug_msg_enabled[83]
#else
#ifdef DEBUG_WINSOCK
#define dprintf_winsock fprintf
@ -1757,6 +1777,7 @@ static char *debug_msg_name[] = {
"string",
"task",
"text",
"thunk",
"timer",
"toolhelp",
"tweak",

View File

@ -11,6 +11,7 @@
#include "ldt.h"
#include "local.h"
#include "x11drv.h"
#include "path.h"
/* GDI objects magic numbers */
#define PEN_MAGIC 0x4f47
@ -100,6 +101,8 @@ typedef struct
HBITMAP16 hFirstBitmap; /* Bitmap selected at creation of the DC */
HANDLE16 hDevice;
HPALETTE16 hPalette;
GdiPath path;
WORD ROPmode;
WORD polyFillMode;
@ -246,7 +249,7 @@ typedef struct tagDC_FUNCS
/* Stock objects handles */
#define NB_STOCK_OBJECTS (SYSTEM_FIXED_FONT + 1)
#define NB_STOCK_OBJECTS (DEFAULT_GUI_FONT + 1)
#define STOCK_WHITE_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+WHITE_BRUSH))
#define STOCK_LTGRAY_BRUSH ((HBRUSH16)(FIRST_STOCK_HANDLE+LTGRAY_BRUSH))
@ -265,11 +268,12 @@ typedef struct tagDC_FUNCS
#define STOCK_DEVICE_DEFAULT_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEVICE_DEFAULT_FONT))
#define STOCK_DEFAULT_PALETTE ((HPALETTE16)(FIRST_STOCK_HANDLE+DEFAULT_PALETTE))
#define STOCK_SYSTEM_FIXED_FONT ((HFONT16)(FIRST_STOCK_HANDLE+SYSTEM_FIXED_FONT))
#define STOCK_DEFAULT_GUI_FONT ((HFONT16)(FIRST_STOCK_HANDLE+DEFAULT_GUI_FONT))
#define FIRST_STOCK_FONT STOCK_OEM_FIXED_FONT
#define LAST_STOCK_FONT STOCK_SYSTEM_FIXED_FONT
#define LAST_STOCK_FONT STOCK_DEFAULT_GUI_FONT
#define LAST_STOCK_HANDLE ((DWORD)STOCK_SYSTEM_FIXED_FONT)
#define LAST_STOCK_HANDLE ((DWORD)STOCK_DEFAULT_GUI_FONT)
/* Device <-> logical coords conversion */

View File

@ -5,6 +5,13 @@
#include "ole2.h"
#include "compobj.h"
#define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
#define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
#define PURE
#define FAR
#define THIS_ THIS,
DEFINE_OLEGUID(IID_IUnknown,0,0,0);
DEFINE_OLEGUID(IID_IClassFactory,1,0,0);
DEFINE_OLEGUID(IID_IMalloc,2,0,0);
@ -18,28 +25,65 @@ DEFINE_OLEGUID(IID_IRootStorage,0x12,0,0);
DEFINE_OLEGUID(IID_IMessageFilter,0x16,0,0);
DEFINE_OLEGUID(IID_IStdMarshalInfo,0x18,0,0);
typedef struct tagUNKNOWN *LPUNKNOWN,IUnknown;
#define THIS LPUNKNOWN this
typedef struct IUnknown *LPUNKNOWN,IUnknown;
typedef struct {
HRESULT (CALLBACK *fnQueryInterface)(LPUNKNOWN this,REFIID refiid,LPVOID *obj);
HRESULT (CALLBACK *fnAddRef)(LPUNKNOWN this);
HRESULT (CALLBACK *fnRelease)(LPUNKNOWN this);
} *LPUNKNOWN_VTABLE;
STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
} *LPUNKNOWN_VTABLE,IUnknown_VTable;
struct tagUNKNOWN {
struct IUnknown {
LPUNKNOWN_VTABLE lpvtbl;
/* internal stuff. Not needed until we actually implement IUnknown */
DWORD ref;
};
#undef THIS
typedef struct tagCLASSFACTORY *LPCLASSFACTORY,IClassFactory;
#define THIS LPCLASSFACTORY this
typedef struct IClassFactory *LPCLASSFACTORY,IClassFactory;
typedef struct {
HRESULT (CALLBACK *fnQueryInterface)(LPCLASSFACTORY this,REFIID refiid,LPVOID *obj);
HRESULT (CALLBACK *fnAddRef)(LPCLASSFACTORY this);
HRESULT (CALLBACK *fnRelease)(LPCLASSFACTORY this);
HRESULT (CALLBACK *fnCreateInstance)(LPCLASSFACTORY this,LPUNKNOWN pUnkOuter,REFIID riid,LPVOID * ppvObject);
} *LPCLASSFACTORY_VTABLE;
STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(CreateInstance) (THIS_ LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObject) PURE;
} *LPCLASSFACTORY_VTABLE,IClassFactory_VTable;
struct tagCLASSFACTORY {
LPCLASSFACTORY_VTABLE lpvtbl;
/*internal stuff. Not needed until we actually implement IClassFactory*/
struct IClassFactory {
LPCLASSFACTORY_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
#define THIS LPMALLOC this
typedef struct IMalloc *LPMALLOC,IMalloc;
typedef struct {
STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID FAR* ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD_(LPVOID,Alloc) ( THIS_ DWORD cb);
STDMETHOD_(LPVOID,Realloc) ( THIS_ LPVOID pv,DWORD cb);
STDMETHOD_(VOID,Free) ( THIS_ LPVOID pv);
STDMETHOD_(DWORD,GetSize) ( THIS_ LPVOID pv);
STDMETHOD_(LPINT32,DidAlloc) ( THIS_ LPVOID pv);
STDMETHOD_(LPVOID,HeapMinimize) ( THIS );
} *LPMALLOC_VTABLE,IMalloc_VTable;
struct IMalloc {
LPMALLOC_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
/* private prototypes for the constructors */
#ifdef __WINE__
LPUNKNOWN IUnknown_Constructor();
LPMALLOC IMalloc_Constructor();
#endif
#undef STDMETHOD
#undef STDMETHOD_
#undef PURE
#undef FAR
#undef THIS_
#endif /*_WINE_INTERFACES_H*/

View File

@ -18,6 +18,7 @@ typedef LPCSTR HPCSTR; /* a huge version of LPCSTR */
#define MAXPNAMELEN 32 /* max product name length (including NULL) */
#define MAXERRORLENGTH 128 /* max error text length (including NULL) */
#define MAX_JOYSTICKOEMVXDNAME 260
typedef WORD VERSION; /* major (high byte), minor (low byte) */
@ -27,6 +28,9 @@ DECL_WINELIB_TYPE(MMVERSION);
typedef UINT16 MCIDEVICEID16;
typedef UINT32 MCIDEVICEID32;
DECL_WINELIB_TYPE(MCIDEVICEID);
typedef UINT16 MMRESULT16;
typedef UINT32 MMRESULT32;
DECL_WINELIB_TYPE(MMRESULT);
typedef struct {
UINT16 wType; /* indicates the contents of the union */
@ -733,24 +737,45 @@ DWORD WINAPI auxOutMessage32(UINT32,UINT32,DWORD,DWORD);
#define TIMERR_NOCANDO (TIMERR_BASE+1) /* request not completed */
#define TIMERR_STRUCT (TIMERR_BASE+33) /* time struct size */
typedef void (CALLBACK *LPTIMECALLBACK) (UINT16 uTimerID, UINT16 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
typedef void (CALLBACK *LPTIMECALLBACK16)(UINT16 uTimerID, UINT16 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
typedef void (CALLBACK *LPTIMECALLBACK32)(UINT32 uTimerID, UINT32 uMessage, DWORD dwUser, DWORD dw1, DWORD dw2);
DECL_WINELIB_TYPE(LPTIMECALLBACK);
#define TIME_ONESHOT 0 /* program timer for single event */
#define TIME_PERIODIC 1 /* program for continuous periodic event */
typedef struct {
UINT16 wPeriodMin; /* minimum period supported */
UINT16 wPeriodMax; /* maximum period supported */
} TIMECAPS, *LPTIMECAPS;
UINT16 wPeriodMin; /* minimum period supported */
UINT16 wPeriodMax; /* maximum period supported */
} TIMECAPS16,*LPTIMECAPS16;
UINT16 WINAPI timeGetSystemTime(LPMMTIME16 lpTime, UINT16 uSize);
DWORD WINAPI timeGetTime(void);
UINT16 WINAPI timeSetEvent(UINT16 uDelay, UINT16 uResolution,
LPTIMECALLBACK lpFunction, DWORD dwUser, UINT16 uFlags);
UINT16 WINAPI timeKillEvent(UINT16 uTimerID);
UINT16 WINAPI timeGetDevCaps(TIMECAPS * lpTimeCaps, UINT16 uSize);
UINT16 WINAPI timeBeginPeriod(UINT16 uPeriod);
UINT16 WINAPI timeEndPeriod(UINT16 uPeriod);
typedef struct {
UINT32 wPeriodMin;
UINT32 wPeriodMax;
} TIMECAPS32, *LPTIMECAPS32;
DECL_WINELIB_TYPE(TIMECAPS);
DECL_WINELIB_TYPE(LPTIMECAPS);
MMRESULT16 WINAPI timeGetSystemTime16(LPMMTIME16,UINT16);
MMRESULT32 WINAPI timeGetSystemTime32(LPMMTIME32,UINT32);
#define timeGetSystemTime WINELIB_NAME(timeGetSystemTime)
DWORD WINAPI timeGetTime(); /* same for win32/win16 */
MMRESULT16 WINAPI timeSetEvent16(UINT16,UINT16,LPTIMECALLBACK16,DWORD,UINT16);
MMRESULT32 WINAPI timeSetEvent32(UINT32,UINT32,LPTIMECALLBACK32,DWORD,UINT32);
#define timeSetEvent WINELIB_NAME(timeSetEvent)
MMRESULT16 WINAPI timeKillEvent16(UINT16);
MMRESULT32 WINAPI timeKillEvent32(UINT32);
#define timeKillEvent WINELIB_NAME(timeKillEvent)
MMRESULT16 WINAPI timeGetDevCaps16(LPTIMECAPS16,UINT16);
MMRESULT32 WINAPI timeGetDevCaps32(LPTIMECAPS32,UINT32);
#define timeGetDevCaps WINELIB_NAME(timeGetDevCaps)
MMRESULT16 WINAPI timeBeginPeriod16(UINT16);
MMRESULT32 WINAPI timeBeginPeriod32(UINT32);
#define timeBeginPeriod WINELIB_NAME(timeBeginPeriod)
MMRESULT16 WINAPI timeEndPeriod16(UINT16);
MMRESULT32 WINAPI timeEndPeriod32(UINT32);
#define timeEndPeriod WINELIB_NAME(timeEndPeriod)
#define JOYERR_NOERROR (0) /* no error */
#define JOYERR_PARMS (JOYERR_BASE+5) /* bad parameters */
@ -770,8 +795,8 @@ UINT16 WINAPI timeEndPeriod(UINT16 uPeriod);
#define JOYSTICKID2 1
typedef struct {
UINT16 wMid; /* manufacturer ID */
UINT16 wPid; /* product ID */
WORD wMid; /* manufacturer ID */
WORD wPid; /* product ID */
char szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
UINT16 wXmin; /* minimum x position value */
UINT16 wXmax; /* maximum x position value */
@ -782,23 +807,116 @@ typedef struct {
UINT16 wNumButtons; /* number of buttons */
UINT16 wPeriodMin; /* minimum message period when captured */
UINT16 wPeriodMax; /* maximum message period when captured */
} JOYCAPS, *LPJOYCAPS;
/* win95,nt4 additions: */
UINT16 wRmin; /* minimum r position value */
UINT16 wRmax; /* maximum r position value */
UINT16 wUmin; /* minimum u (5th axis) position value */
UINT16 wUmax; /* maximum u (5th axis) position value */
UINT16 wVmin; /* minimum v (6th axis) position value */
UINT16 wVmax; /* maximum v (6th axis) position value */
UINT16 wCaps; /* joystick capabilites */
UINT16 wMaxAxes; /* maximum number of axes supported */
UINT16 wNumAxes; /* number of axes in use */
UINT16 wMaxButtons; /* maximum number of buttons supported */
CHAR szRegKey[MAXPNAMELEN]; /* registry key */
CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME]; /* OEM VxD in use */
} JOYCAPS16, *LPJOYCAPS16;
typedef struct {
WORD wMid;
WORD wPid;
CHAR szPname[MAXPNAMELEN];
UINT32 wXmin;
UINT32 wXmax;
UINT32 wYmin;
UINT32 wYmax;
UINT32 wZmin;
UINT32 wZmax;
UINT32 wNumButtons;
UINT32 wPeriodMin;
UINT32 wPeriodMax;
UINT32 wRmin;
UINT32 wRmax;
UINT32 wUmin;
UINT32 wUmax;
UINT32 wVmin;
UINT32 wVmax;
UINT32 wCaps;
UINT32 wMaxAxes;
UINT32 wNumAxes;
UINT32 wMaxButtons;
CHAR szRegKey[MAXPNAMELEN];
CHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
} JOYCAPS32A, *LPJOYCAPS32A;
typedef struct {
WORD wMid;
WORD wPid;
WCHAR szPname[MAXPNAMELEN];
UINT32 wXmin;
UINT32 wXmax;
UINT32 wYmin;
UINT32 wYmax;
UINT32 wZmin;
UINT32 wZmax;
UINT32 wNumButtons;
UINT32 wPeriodMin;
UINT32 wPeriodMax;
UINT32 wRmin;
UINT32 wRmax;
UINT32 wUmin;
UINT32 wUmax;
UINT32 wVmin;
UINT32 wVmax;
UINT32 wCaps;
UINT32 wMaxAxes;
UINT32 wNumAxes;
UINT32 wMaxButtons;
WCHAR szRegKey[MAXPNAMELEN];
WCHAR szOEMVxD[MAX_JOYSTICKOEMVXDNAME];
} JOYCAPS32W, *LPJOYCAPS32W;
DECL_WINELIB_TYPE_AW(JOYCAPS)
DECL_WINELIB_TYPE_AW(LPJOYCAPS)
typedef struct {
UINT16 wXpos; /* x position */
UINT16 wYpos; /* y position */
UINT16 wZpos; /* z position */
UINT16 wButtons; /* button states */
} JOYINFO, *LPJOYINFO;
} JOYINFO16, *LPJOYINFO16;
UINT16 WINAPI joyGetDevCaps(UINT16 uJoyID, JOYCAPS * lpCaps, UINT16 uSize);
UINT16 WINAPI joyGetNumDevs(void);
UINT16 WINAPI joyGetPos(UINT16 uJoyID, JOYINFO * lpInfo);
UINT16 WINAPI joyGetThreshold(UINT16 uJoyID, UINT16 * lpuThreshold);
UINT16 WINAPI joyReleaseCapture(UINT16 uJoyID);
UINT16 WINAPI joySetCapture(HWND16 hwnd, UINT16 uJoyID, UINT16 uPeriod,
BOOL16 bChanged);
UINT16 WINAPI joySetThreshold(UINT16 uJoyID, UINT16 uThreshold);
typedef struct {
UINT32 wXpos;
UINT32 wYpos;
UINT32 wZpos;
UINT32 wButtons;
} JOYINFO32, *LPJOYINFO32;
DECL_WINELIB_TYPE(JOYINFO)
DECL_WINELIB_TYPE(LPJOYINFO)
MMRESULT16 WINAPI joyGetDevCaps16 (UINT16,LPJOYCAPS16 ,UINT16);
MMRESULT32 WINAPI joyGetDevCaps32A(UINT32,LPJOYCAPS32A,UINT32);
MMRESULT32 WINAPI joyGetDevCaps32W(UINT32,LPJOYCAPS32W,UINT32);
#define joyGetDevCaps WINELIB_NAME_AW(joyGetDevCaps)
UINT16 WINAPI joyGetNumDevs16(void);
UINT32 WINAPI joyGetNumDevs32(void);
#define joyGetNumDevs WINELIB_NAME(joyGetNumDevs)
MMRESULT16 WINAPI joyGetPos16(UINT16,LPJOYINFO16);
MMRESULT32 WINAPI joyGetPos32(UINT32,LPJOYINFO32);
#define joyGetPos WINELIB_NAME(joyGetPos)
MMRESULT16 WINAPI joyGetThreshold16(UINT16,UINT16*);
MMRESULT32 WINAPI joyGetThreshold32(UINT32,UINT32*);
#define joyGetThreshold WINELIB_NAME(joyGetThreshold)
MMRESULT16 WINAPI joyReleaseCapture16(UINT16);
MMRESULT32 WINAPI joyReleaseCapture32(UINT32);
#define joyReleaseCapture WINELIB_NAME(joyReleaseCapture)
MMRESULT16 WINAPI joySetCapture16(HWND16,UINT16,UINT16,BOOL16);
MMRESULT32 WINAPI joySetCapture32(HWND32,UINT32,UINT32,BOOL32);
#define joySetCapture WINELIB_NAME(joySetCapture)
MMRESULT16 WINAPI joySetThreshold16(UINT16,UINT16);
MMRESULT32 WINAPI joySetThreshold32(UINT32,UINT32);
#define joySetThreshold WINELIB_NAME(joySetThreshold)
typedef struct {
WORD wMid; /* manufacturer id */
@ -2560,11 +2678,11 @@ typedef struct {
} MIDIOPENDESC, *LPMIDIOPENDESC;
typedef struct {
UINT16 wDelay;
UINT16 wResolution;
LPTIMECALLBACK lpFunction;
DWORD dwUser;
UINT16 wFlags;
UINT16 wDelay;
UINT16 wResolution;
LPTIMECALLBACK16 lpFunction;
DWORD dwUser;
UINT16 wFlags;
} TIMEREVENT, *LPTIMEREVENT;
typedef struct tMIXEROPENDESC
@ -2603,6 +2721,16 @@ BOOL16 WINAPI DriverCallback(DWORD dwCallBack, UINT16 uFlags, HANDLE16 hDev,
WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
DWORD WINAPI auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
struct LINUX_MCIDRIVER {
HDRVR16 hdrv;
DRIVERPROC16 driverproc;
MCI_OPEN_DRIVER_PARMS modp;
MCI_OPEN_PARMS16 mop;
DWORD private;
};
#pragma pack(4)
DWORD WINAPI mixMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2);
DWORD WINAPI midMessage(WORD wDevID, WORD wMsg, DWORD dwUser,

View File

@ -156,6 +156,27 @@ typedef struct _UNICODE_STRING {
LPWSTR Buffer;
} UNICODE_STRING,*LPUNICODE_STRING;
BOOL32 WINAPI IsValidSid(LPSID);
BOOL32 WINAPI EqualSid(LPSID,LPSID);
BOOL32 WINAPI EqualPrefixSid(LPSID,LPSID);
DWORD WINAPI GetSidLengthRequired(BYTE);
BOOL32 WINAPI AllocateAndInitializeSid(LPSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,
DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,
DWORD,LPSID*);
VOID* WINAPI FreeSid(LPSID);
BOOL32 WINAPI InitializeSecurityDescriptor(SECURITY_DESCRIPTOR*,DWORD);
BOOL32 WINAPI InitializeSid(LPSID,LPSID_IDENTIFIER_AUTHORITY,BYTE);
DWORD* WINAPI GetSidSubAuthority(LPSID,DWORD);
BYTE * WINAPI GetSidSubAuthorityCount(LPSID);
DWORD WINAPI GetLengthSid(LPSID);
BOOL32 WINAPI CopySid(DWORD,LPSID,LPSID);
BOOL32 WINAPI LookupAccountSid32A(LPCSTR,PSID,LPCSTR,LPDWORD,LPCSTR,LPDWORD,
PSID_NAME_USE);
BOOL32 WINAPI LookupAccountSid32W(LPCWSTR,PSID,LPCWSTR,LPDWORD,LPCWSTR,LPDWORD,
PSID_NAME_USE);
LPSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(LPSID);
#ifdef __cplusplus
}
#endif

45
include/path.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Graphics paths (BeginPath, EndPath etc.)
*
* Copyright 1997 Martin Boehme
*/
#ifndef __WINE_PATH_H
#define __WINE_PATH_H
/* It should not be necessary to access the contents of the GdiPath
* structure directly; if you find that the exported functions don't
* allow you to do what you want, then please place a new exported
* function that does this job in path.c.
*/
typedef enum tagGdiPathState
{
PATH_Null,
PATH_Open,
PATH_Closed
} GdiPathState;
typedef struct tagGdiPath
{
GdiPathState state;
POINT32 *pPoints;
BYTE *pFlags;
int numEntriesUsed, numEntriesAllocated;
BOOL32 newStroke;
} GdiPath;
#define PATH_IsPathOpen(path) ((path).state==PATH_Open)
/* Returns TRUE if the specified path is in the open state, i.e. in the
* state where points will be added to the path, or FALSE otherwise. This
* function is implemented as a macro for performance reasons.
*/
extern void PATH_InitGdiPath(GdiPath *pPath);
extern void PATH_DestroyGdiPath(GdiPath *pPath);
extern BOOL32 PATH_AssignGdiPath(GdiPath *pPathDest,
const GdiPath *pPathSrc);
extern BOOL32 PATH_MoveTo(HDC32 hdc);
extern BOOL32 PATH_LineTo(HDC32 hdc, INT32 x, INT32 y);
#endif /* __WINE_PATH_H */

View File

@ -41,6 +41,6 @@ extern HGLOBAL32 PE_LoadResource32(HINSTANCE32,HRSRC32);
struct _PDB32; /* forward definition */
extern void PE_InitializeDLLs(struct _PDB32*,DWORD,LPVOID);
extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD);
extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL32);
#endif /* __WINE_PE_IMAGE_H */

View File

@ -32,6 +32,16 @@ typedef struct { /* structure for dropped files */
/* memory block with filenames follows */
} DROPFILESTRUCT, *LPDROPFILESTRUCT;
typedef struct _NOTIFYICONDATA {
DWORD cbSize;
HWND32 hWnd;
UINT32 uID;
UINT32 uFlags;
UINT32 uCallbackMessage;
HICON32 hIcon;
CHAR szTip[64];
} NOTIFYICONDATA, *PNOTIFYICONDATA;
typedef struct tagSHFILEINFO32A {
HICON32 hIcon; /* icon */
int iIcon; /* icon index */
@ -59,8 +69,6 @@ typedef struct _AppBarData {
LPARAM lParam;
} APPBARDATA, *PAPPBARDATA;
DECL_WINELIB_TYPE(APPBARDATA);
#define SHGFI_ICON 0x000000100 /* get icon */
#define SHGFI_DISPLAYNAME 0x000000200 /* get display name */
#define SHGFI_TYPENAME 0x000000400 /* get type name */
@ -87,4 +95,22 @@ DWORD WINAPI SHGetFileInfo32W(LPCWSTR,DWORD,SHFILEINFO32W*,UINT32,UINT32);
#define SE_ERR_DDEBUSY 30
#define SE_ERR_NOASSOC 31
#define CSIDL_DESKTOP 0x0000
#define CSIDL_PROGRAMS 0x0002
#define CSIDL_CONTROLS 0x0003
#define CSIDL_PRINTERS 0x0004
#define CSIDL_PERSONAL 0x0005
#define CSIDL_FAVORITES 0x0006
#define CSIDL_STARTUP 0x0007
#define CSIDL_RECENT 0x0008
#define CSIDL_SENDTO 0x0009
#define CSIDL_BITBUCKET 0x000a
#define CSIDL_STARTMENU 0x000b
#define CSIDL_DESKTOPDIRECTORY 0x0010
#define CSIDL_DRIVES 0x0011
#define CSIDL_NETWORK 0x0012
#define CSIDL_NETHOOD 0x0013
#define CSIDL_FONTS 0x0014
#define CSIDL_TEMPLATES 0x0015
#endif /* __WINE_SHELL_H */

View File

@ -1,12 +1,19 @@
#ifndef _WINE_SHLOBJ_H
#define _WINE_SHLOBJ_H
#include "shell.h"
#include "ole.h"
#include "ole2.h"
#include "compobj.h"
#define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
#define STDMETHOD_(type,xfn) type (CALLBACK *fn##xfn)
#define PURE
#define FAR
#define THIS_ THIS,
typedef LPVOID LPBC; /* *IBindCtx really */
typedef LPVOID LPSTRRET,LPENUMIDLIST;
/*
* shell32 classids
@ -28,6 +35,21 @@ DEFINE_SHLGUID(IID_IFileViewer, 0x000214F0L, 0, 0);
DEFINE_SHLGUID(IID_IEnumIDList, 0x000214F2L, 0, 0);
DEFINE_SHLGUID(IID_IFileViewerSite, 0x000214F3L, 0, 0);
#define STRRET_WSTR 0x0000
#define STRRET_OFFSET 0x0001
#define STRRET_CSTR 0x0002
typedef struct _STRRET
{
UINT32 uType; /* STRRET_xxx */
union
{
LPWSTR pOleStr; /* OLESTR that will be freed */
UINT32 uOffset; /* Offset into SHITEMID (ANSI) */
char cStr[MAX_PATH]; /* Buffer to fill in */
} DUMMYUNIONNAME;
} STRRET,*LPSTRRET;
typedef struct {
WORD cb; /* nr of bytes in this item */
BYTE abID[1];/* first byte in this item */
@ -37,29 +59,198 @@ typedef struct {
SHITEMID mkid; /* first itemid in list */
} ITEMIDLIST,*LPITEMIDLIST,*LPCITEMIDLIST;
/* The IShellFolder interface ... the basic interface for a lot of stuff */
/*****************************************************************************
* IEnumIDList interface
*/
#define THIS LPENUMIDLIST this
typedef struct IEnumIDList IEnumIDList,*LPENUMIDLIST;
typedef struct IEnumIDList_VTable {
/* *** IUnknown methods *** */
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/* *** IEnumIDList methods *** */
STDMETHOD(Next) (THIS_ ULONG celt,
LPITEMIDLIST *rgelt,
ULONG *pceltFetched) PURE;
STDMETHOD(Skip) (THIS_ ULONG celt) PURE;
STDMETHOD(Reset) (THIS) PURE;
STDMETHOD(Clone) (THIS_ IEnumIDList **ppenum) PURE;
} IEnumIDList_VTable,*LPENUMIDLIST_VTABLE;
struct IEnumIDList {
LPENUMIDLIST_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
/************************************************************************
* The IShellFolder interface ... the basic interface for a lot of stuff
*/
#define THIS LPSHELLFOLDER this
/* IShellFolder::GetDisplayNameOf/SetNameOf uFlags */
typedef enum
{
SHGDN_NORMAL = 0, /* default (display purpose) */
SHGDN_INFOLDER = 1, /* displayed under a folder (relative)*/
SHGDN_FORPARSING = 0x8000, /* for ParseDisplayName or path */
} SHGNO;
/* IShellFolder::EnumObjects */
typedef enum tagSHCONTF
{
SHCONTF_FOLDERS = 32, /* for shell browser */
SHCONTF_NONFOLDERS = 64, /* for default view */
SHCONTF_INCLUDEHIDDEN = 128, /* for hidden/system objects */
} SHCONTF;
/* from oleidl.h */
#define DROPEFFECT_NONE 0
#define DROPEFFECT_COPY 1
#define DROPEFFECT_MOVE 2
#define DROPEFFECT_LINK 4
#define DROPEFFECT_SCROLL 0x80000000
/* IShellFolder::GetAttributesOf flags */
#define SFGAO_CANCOPY DROPEFFECT_COPY /* Objects can be copied */
#define SFGAO_CANMOVE DROPEFFECT_MOVE /* Objects can be moved */
#define SFGAO_CANLINK DROPEFFECT_LINK /* Objects can be linked */
#define SFGAO_CANRENAME 0x00000010L /* Objects can be renamed */
#define SFGAO_CANDELETE 0x00000020L /* Objects can be deleted */
#define SFGAO_HASPROPSHEET 0x00000040L /* Objects have property sheets */
#define SFGAO_DROPTARGET 0x00000100L /* Objects are drop target */
#define SFGAO_CAPABILITYMASK 0x00000177L
#define SFGAO_LINK 0x00010000L /* Shortcut (link) */
#define SFGAO_SHARE 0x00020000L /* shared */
#define SFGAO_READONLY 0x00040000L /* read-only */
#define SFGAO_GHOSTED 0x00080000L /* ghosted icon */
#define SFGAO_DISPLAYATTRMASK 0x000F0000L
#define SFGAO_FILESYSANCESTOR 0x10000000L /* It contains file system folder */
#define SFGAO_FOLDER 0x20000000L /* It's a folder. */
#define SFGAO_FILESYSTEM 0x40000000L /* is a file system thing (file/folder/root) */
#define SFGAO_HASSUBFOLDER 0x80000000L /* Expandable in the map pane */
#define SFGAO_CONTENTSMASK 0x80000000L
#define SFGAO_VALIDATE 0x01000000L /* invalidate cached information */
#define SFGAO_REMOVABLE 0x02000000L /* is this removeable media? */
typedef struct tagSHELLFOLDER *LPSHELLFOLDER,IShellFolder;
typedef struct {
HRESULT (CALLBACK *fnQueryInterface)(LPSHELLFOLDER this,REFIID refiid,LPVOID *obj);
HRESULT (CALLBACK *fnAddRef)(LPSHELLFOLDER this);
HRESULT (CALLBACK *fnRelease)(LPSHELLFOLDER this);
/* IShellFolder methods */
typedef struct IShellFolder_VTable {
/* *** IUnknown methods *** */
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
HRESULT (CALLBACK *fnParseDisplayName) (LPSHELLFOLDER this,HWND32 hwndOwner,LPBC pbcReserved,LPOLESTR lpszDisplayName,DWORD * pchEaten,LPITEMIDLIST * ppidl, DWORD *pdwAttributes) ;
HRESULT (CALLBACK *fnEnumObjects)( LPSHELLFOLDER this,HWND32 hwndOwner, DWORD grfFlags, LPENUMIDLIST* ppenumIDList);
HRESULT (CALLBACK *fnBindToObject)(LPSHELLFOLDER this, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvOut);
HRESULT (CALLBACK *fnBindToStorage)(LPSHELLFOLDER this, LPCITEMIDLIST pidl, LPBC pbcReserved, REFIID riid, LPVOID * ppvObj);
HRESULT (CALLBACK *fnCompareIDs) (LPSHELLFOLDER this, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2);
HRESULT (CALLBACK *fnCreateViewObject) (LPSHELLFOLDER this, HWND32 hwndOwner, REFIID riid, LPVOID * ppvOut);
HRESULT (CALLBACK *fnGetAttributesOf) (LPSHELLFOLDER this, UINT32 cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut);
HRESULT (CALLBACK *fnGetUIObjectOf) (LPSHELLFOLDER this, HWND32 hwndOwner, UINT32 cidl, LPCITEMIDLIST * apidl, REFIID riid, UINT32 * prgfInOut, LPVOID * ppvOut);
HRESULT (CALLBACK *fnGetDisplayNameOf) (LPSHELLFOLDER this, LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName);
HRESULT (CALLBACK *fnSetNameOf) (LPSHELLFOLDER this, HWND32 hwndOwner, LPCITEMIDLIST pidl, LPCOLESTR lpszName, DWORD uFlags, LPITEMIDLIST * ppidlOut);
} *LPSHELLFOLDER_VTABLE;
/* *** IShellFolder methods *** */
STDMETHOD(ParseDisplayName) (THIS_ HWND32 hwndOwner,
LPBC pbcReserved, LPOLESTR lpszDisplayName,
ULONG * pchEaten, LPITEMIDLIST * ppidl, ULONG *pdwAttributes) PURE;
STDMETHOD(EnumObjects) ( THIS_ HWND32 hwndOwner, DWORD grfFlags, LPENUMIDLIST
* ppenumIDList) PURE;
STDMETHOD(BindToObject) (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
REFIID riid, LPVOID * ppvOut) PURE;
STDMETHOD(BindToStorage) (THIS_ LPCITEMIDLIST pidl, LPBC pbcReserved,
REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD(CompareIDs) (THIS_ LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) PURE;
STDMETHOD(CreateViewObject) (THIS_ HWND32 hwndOwner, REFIID riid, LPVOID * ppvOut) PURE;
STDMETHOD(GetAttributesOf) (THIS_ UINT32 cidl, LPCITEMIDLIST * apidl,
ULONG * rgfInOut) PURE;
STDMETHOD(GetUIObjectOf) (THIS_ HWND32 hwndOwner, UINT32 cidl, LPCITEMIDLIST
* apidl,
REFIID riid, UINT32 * prgfInOut, LPVOID * ppvOut) PURE;
STDMETHOD(GetDisplayNameOf) (THIS_ LPCITEMIDLIST pidl, DWORD uFlags, LPSTRRET lpName) PURE;
STDMETHOD(SetNameOf) (THIS_ HWND32 hwndOwner, LPCITEMIDLIST pidl,
LPCOLESTR lpszName, DWORD uFlags,
LPITEMIDLIST * ppidlOut) PURE;
} *LPSHELLFOLDER_VTABLE,IShellFolder_VTable;
struct tagSHELLFOLDER {
LPSHELLFOLDER_VTABLE *lpvtbl;
LPSHELLFOLDER_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
/****************************************************************************
* IShellLink interface
*/
#define THIS LPSHELLLINK this
/* IShellLink::Resolve fFlags */
typedef enum {
SLR_NO_UI = 0x0001,
SLR_ANY_MATCH = 0x0002,
SLR_UPDATE = 0x0004,
} SLR_FLAGS;
/* IShellLink::GetPath fFlags */
typedef enum {
SLGP_SHORTPATH = 0x0001,
SLGP_UNCPRIORITY = 0x0002,
} SLGP_FLAGS;
typedef struct IShellLink IShellLink,*LPSHELLLINK;
typedef struct IShellLink_VTable
{
// *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(GetPath)(THIS_ LPSTR pszFile, INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE;
STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE;
STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE;
STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE;
STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE;
STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE;
STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE;
STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE;
STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE;
STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE;
STDMETHOD(SetHotkey)(THIS_ WORD wHotkey) PURE;
STDMETHOD(GetShowCmd)(THIS_ INT32 *piShowCmd) PURE;
STDMETHOD(SetShowCmd)(THIS_ INT32 iShowCmd) PURE;
STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, INT32 cchIconPath, INT32 *piIcon) PURE;
STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, INT32 iIcon) PURE;
STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE;
STDMETHOD(Resolve)(THIS_ HWND32 hwnd, DWORD fFlags) PURE;
STDMETHOD(SetPath)(THIS_ LPCSTR pszFile) PURE;
} IShellLink_VTable,*LPSHELLLINK_VTABLE;
struct IShellLink {
LPSHELLLINK_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
#ifdef __WINE__
extern LPSHELLFOLDER IShellFolder_Constructor();
extern LPSHELLLINK IShellLink_Constructor();
extern LPENUMIDLIST IEnumIDList_Constructor();
#endif
DWORD WINAPI SHELL32_DllGetClassObject(LPCLSID,REFIID,LPVOID*);
#undef PURE
#undef FAR
#undef THIS
#undef THIS_
#undef STDMETHOD
#undef STDMETHOD_
#endif /*_WINE_SHLOBJ_H*/

View File

@ -148,6 +148,7 @@
#undef DEBUG_STRING
#undef DEBUG_TASK
#undef DEBUG_TEXT
#undef DEBUG_THUNK
#undef DEBUG_TIMER
#undef DEBUG_TOOLHELP
#undef DEBUG_TWEAK
@ -234,6 +235,7 @@
#define DEBUG_STRING
#define DEBUG_TASK
#define DEBUG_TEXT
#define DEBUG_THUNK
#define DEBUG_TIMER
#define DEBUG_TOOLHELP
#define DEBUG_TWEAK

View File

@ -131,5 +131,6 @@ extern HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
UINT16 cmdShow );
extern void TASK_KillCurrentTask( INT16 exitCode );
extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
extern void TASK_Reschedule(void);
#endif /* __WINE_TASK_H */

View File

@ -348,6 +348,18 @@ typedef struct {
void **lpBadParam;
} NFYLOGPARAMERROR;
typedef struct {
DWORD dwSize;
HTASK16 hTask;
WORD wSS;
WORD wBP;
WORD wCS;
WORD wIP;
HMODULE16 hModule;
WORD wSegment;
WORD wFlags;
} STACKTRACEENTRY;
#pragma pack(4)
#endif /* __WINE_TOOLHELP_H */

View File

@ -24,5 +24,8 @@ extern WORD USER_HeapSel;
((handle) ? PTR_SEG_OFF_TO_SEGPTR(USER_HeapSel, (handle)) : (SEGPTR)0)
void USER_SignalProc(HANDLE16, UINT16, UINT16, HINSTANCE16, HQUEUE16);
void USER_ExitWindows(void);
HGLOBAL16 USER_CallDefaultRsrcHandler( HGLOBAL16 hMemObj, HMODULE16 hModule,
HRSRC16 hRsrc );
#endif /* __WINE_USER_H */

View File

@ -1 +1 @@
#define WINE_RELEASE_INFO "Wine release 971130"
#define WINE_RELEASE_INFO "Wine release 971221"

View File

@ -1591,13 +1591,30 @@ typedef struct
DECL_WINELIB_TYPE(LOGPEN);
DECL_WINELIB_TYPE(LPLOGPEN);
#define PS_SOLID 0
#define PS_DASH 1
#define PS_DOT 2
#define PS_DASHDOT 3
#define PS_DASHDOTDOT 4
#define PS_NULL 5
#define PS_INSIDEFRAME 6
#define PS_SOLID 0x00000000
#define PS_DASH 0x00000001
#define PS_DOT 0x00000002
#define PS_DASHDOT 0x00000003
#define PS_DASHDOTDOT 0x00000004
#define PS_NULL 0x00000005
#define PS_INSIDEFRAME 0x00000006
#define PS_USERSTYLE 0x00000007
#define PS_ALTERNATE 0x00000008
#define PS_STYLE_MASK 0x0000000f
#define PS_ENDCAP_ROUND 0x00000000
#define PS_ENDCAP_SQUARE 0x00000100
#define PS_ENDCAP_FLAT 0x00000200
#define PS_ENDCAP_MASK 0x00000f00
#define PS_JOIN_ROUND 0x00000000
#define PS_JOIN_BEVEL 0x00001000
#define PS_JOIN_MITER 0x00002000
#define PS_JOIN_MASK 0x0000f000
#define PS_COSMETIC 0x00000000
#define PS_GEOMETRIC 0x00010000
#define PS_TYPE_MASK 0x000f0000
/* Regions */
@ -1947,6 +1964,10 @@ typedef struct {
HBITMAP32 hbmColor;
} ICONINFO,*LPICONINFO;
#ifdef FSHIFT
/* Gcc on Solaris has a version of this that we don't care about. */
#undef FSHIFT
#endif
#define FVIRTKEY TRUE /* Assumed to be == TRUE */
#define FNOINVERT 0x02
@ -2557,6 +2578,7 @@ typedef struct tagCOMSTAT
#define DEVICE_DEFAULT_FONT 14
#define DEFAULT_PALETTE 15
#define SYSTEM_FIXED_FONT 16
#define DEFAULT_GUI_FONT 17
/* DragObject stuff */
@ -3038,33 +3060,47 @@ DECL_WINELIB_TYPE_AW(LPMENUITEMINFO);
#define GCW_HBRBACKGROUND (-10)
#endif
#define MB_OK 0x0000
#define MB_OKCANCEL 0x0001
#define MB_ABORTRETRYIGNORE 0x0002
#define MB_YESNOCANCEL 0x0003
#define MB_YESNO 0x0004
#define MB_RETRYCANCEL 0x0005
#define MB_TYPEMASK 0x000F
#define MB_OK 0x00000000
#define MB_OKCANCEL 0x00000001
#define MB_ABORTRETRYIGNORE 0x00000002
#define MB_YESNOCANCEL 0x00000003
#define MB_YESNO 0x00000004
#define MB_RETRYCANCEL 0x00000005
#define MB_TYPEMASK 0x0000000F
#define MB_ICONHAND 0x0010
#define MB_ICONQUESTION 0x0020
#define MB_ICONEXCLAMATION 0x0030
#define MB_ICONASTERISK 0x0040
#define MB_ICONMASK 0x00F0
#define MB_ICONHAND 0x00000010
#define MB_ICONQUESTION 0x00000020
#define MB_ICONEXCLAMATION 0x00000030
#define MB_ICONASTERISK 0x00000040
#define MB_USERICON 0x00000080
#define MB_ICONMASK 0x000000F0
#define MB_ICONINFORMATION MB_ICONASTERISK
#define MB_ICONSTOP MB_ICONHAND
#define MB_ICONINFORMATION MB_ICONASTERISK
#define MB_ICONSTOP MB_ICONHAND
#define MB_ICONWARNING MB_ICONEXCLAMATION
#define MB_ICONERROR MB_ICONHAND
#define MB_DEFBUTTON1 0x0000
#define MB_DEFBUTTON2 0x0100
#define MB_DEFBUTTON3 0x0200
#define MB_DEFMASK 0x0F00
#define MB_DEFBUTTON1 0x00000000
#define MB_DEFBUTTON2 0x00000100
#define MB_DEFBUTTON3 0x00000200
#define MB_DEFBUTTON4 0x00000300
#define MB_DEFMASK 0x00000F00
#define MB_APPLMODAL 0x0000
#define MB_SYSTEMMODAL 0x1000
#define MB_TASKMODAL 0x2000
#define MB_APPLMODAL 0x00000000
#define MB_SYSTEMMODAL 0x00001000
#define MB_TASKMODAL 0x00002000
#define MB_MODEMASK 0x00003000
#define MB_NOFOCUS 0x8000
#define MB_HELP 0x00004000
#define MB_NOFOCUS 0x00008000
#define MB_MISCMASK 0x0000C000
#define MB_SETFOREGROUND 0x00010000
#define MB_DEFAULT_DESKTOP_ONLY 0x00020000
#define MB_SERVICE_NOTIFICATION 0x00040000
#define MB_TOPMOST 0x00040000
#define MB_RIGHT 0x00080000
#define MB_RTLREADING 0x00100000
#define DT_TOP 0
@ -3165,7 +3201,9 @@ DECL_WINELIB_TYPE_AW(LPMENUITEMINFO);
#define DFCS_MONO 0x8000
/* DrawState defines ... */
typedef BOOL32 (CALLBACK *DRAWSTATEPROC)(HDC32,LPARAM,WPARAM32,INT32,INT32);
typedef BOOL16 (CALLBACK *DRAWSTATEPROC16)(HDC16,LPARAM,WPARAM16,INT16,INT16);
typedef BOOL32 (CALLBACK *DRAWSTATEPROC32)(HDC32,LPARAM,WPARAM32,INT32,INT32);
DECL_WINELIB_TYPE(DRAWSTATEPROC);
/* Image type */
#define DST_COMPLEX 0x0000
@ -3178,6 +3216,7 @@ typedef BOOL32 (CALLBACK *DRAWSTATEPROC)(HDC32,LPARAM,WPARAM32,INT32,INT32);
#define DSS_NORMAL 0x0000
#define DSS_UNION 0x0010 /* Gray string appearance */
#define DSS_DISABLED 0x0020
#define DSS_DEFAULT 0x0040 /* Make it bold */
#define DSS_MONO 0x0080
#define DSS_RIGHT 0x8000
@ -4875,6 +4914,20 @@ typedef struct
DECL_WINELIB_TYPE_AW(DEVMODE);
DECL_WINELIB_TYPE_AW(LPDEVMODE);
typedef struct _PRINTER_DEFAULTS32A {
LPSTR pDatatype;
LPDEVMODE32A pDevMode;
ACCESS_MASK DesiredAccess;
} PRINTER_DEFAULTS32A, *LPPRINTER_DEFAULTS32A;
typedef struct _PRINTER_DEFAULTS32W {
LPWSTR pDatatype;
LPDEVMODE32W pDevMode;
ACCESS_MASK DesiredAccess;
} PRINTER_DEFAULTS32W, *LPPRINTER_DEFAULTS32W;
DECL_WINELIB_TYPE_AW(PRINTER_DEFAULTS);
typedef struct _SYSTEM_POWER_STATUS
{
BOOL16 ACLineStatus;
@ -4910,6 +4963,12 @@ typedef struct _SYSTEM_POWER_STATUS
#define LR_LOADREALSIZE 0x0020
#define LR_LOADMAP3DCOLORS 0x1000
/* Flags for PolyDraw and GetPath */
#define PT_CLOSEFIGURE 0x0001
#define PT_LINETO 0x0002
#define PT_BEZIERTO 0x0004
#define PT_MOVETO 0x0006
typedef struct _LARGE_INTEGER
{
DWORD LowPart;
@ -5333,6 +5392,79 @@ typedef struct _LDT_ENTRY {
} HighWord;
} LDT_ENTRY, *LPLDT_ENTRY;
#define RDH_RECTANGLES 1
typedef struct _RGNDATAHEADER {
DWORD dwSize;
DWORD iType;
DWORD nCount;
DWORD nRgnSize;
RECT32 rcBound;
} RGNDATAHEADER,*LPRGNDATAHEADER;
typedef struct _RGNDATA {
RGNDATAHEADER rdh;
char Buffer[1];
} RGNDATA,*PRGNDATA,*LPRGNDATA;
#define HELPINFO_WINDOW 0x0001
#define HELPINFO_MENUITEM 0x0002
typedef struct /* Structure pointed to by lParam of WM_HELP */
{
UINT32 cbSize; /* Size in bytes of this struct */
INT32 iContextType; /* Either HELPINFO_WINDOW or HELPINFO_MENUITEM */
INT32 iCtrlId; /* Control Id or a Menu item Id. */
HANDLE32 hItemHandle; /* hWnd of control or hMenu. */
DWORD dwContextId; /* Context Id associated with this item */
POINT32 MousePos; /* Mouse Position in screen co-ordinates */
} HELPINFO,*LPHELPINFO;
typedef void (CALLBACK *MSGBOXCALLBACK)(LPHELPINFO lpHelpInfo);
typedef struct /* not sure if the 16bit version is correct */
{
UINT16 cbSize;
HWND16 hwndOwner;
HINSTANCE16 hInstance;
LPCSTR lpszText;
LPCSTR lpszCaption;
DWORD dwStyle;
LPCSTR lpszIcon;
DWORD dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
} MSGBOXPARAMS16,*LPMSGBOXPARAMS16;
typedef struct
{
UINT32 cbSize;
HWND32 hwndOwner;
HINSTANCE32 hInstance;
LPCSTR lpszText;
LPCSTR lpszCaption;
DWORD dwStyle;
LPCSTR lpszIcon;
DWORD dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
} MSGBOXPARAMS32A,*LPMSGBOXPARAMS32A;
typedef struct
{
UINT32 cbSize;
HWND32 hwndOwner;
HINSTANCE32 hInstance;
LPCWSTR lpszText;
LPCWSTR lpszCaption;
DWORD dwStyle;
LPCWSTR lpszIcon;
DWORD dwContextHelpId;
MSGBOXCALLBACK lpfnMsgBoxCallback;
DWORD dwLanguageId;
} MSGBOXPARAMS32W,*LPMSGBOXPARAMS32W;
DECL_WINELIB_TYPE_AW(MSGBOXPARAMS)
#pragma pack(4)
/* Declarations for functions that exist only in Win16 */
@ -5390,6 +5522,7 @@ WORD WINAPI GetExpWinVer(HMODULE16);
DWORD WINAPI GetFileResourceSize(LPCSTR,SEGPTR,SEGPTR,LPDWORD);
DWORD WINAPI GetFileResource(LPCSTR,SEGPTR,SEGPTR,DWORD,DWORD,LPVOID);
DWORD WINAPI GetHeapSpaces(HMODULE16);
WORD WINAPI GetIconID(HGLOBAL16,DWORD);
INT16 WINAPI GetInstanceData(HINSTANCE16,WORD,INT16);
HGLOBAL16 WINAPI GetMetaFileBits(HMETAFILE16);
BOOL16 WINAPI GetModuleName(HINSTANCE16,LPSTR,INT16);
@ -5434,6 +5567,7 @@ HGLOBAL16 WINAPI LoadDIBIconHandler(HGLOBAL16,HMODULE16,HRSRC16);
WORD WINAPI LocalCountFree(void);
WORD WINAPI LocalHandleDelta(WORD);
WORD WINAPI LocalHeapSize(void);
HICON16 WINAPI LoadIconHandler(HGLOBAL16,BOOL16);
BOOL16 WINAPI LocalInit(HANDLE16,WORD,WORD);
FARPROC16 WINAPI LocalNotify(FARPROC16);
HTASK16 WINAPI LockCurrentTask(BOOL16);
@ -5509,6 +5643,7 @@ HFILE32 WINAPI CreateFile32A(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
HFILE32 WINAPI CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,
DWORD,DWORD,HANDLE32);
#define CreateFile WINELIB_NAME_AW(CreateFile)
HPALETTE32 WINAPI CreateHalftonePalette(HDC32);
HANDLE32 WINAPI CreateFileMapping32A(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,
DWORD,DWORD,LPCSTR);
HANDLE32 WINAPI CreateFileMapping32W(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,
@ -5558,7 +5693,11 @@ BOOL32 WINAPI FileTimeToSystemTime(const FILETIME*,LPSYSTEMTIME);
HRSRC32 WINAPI FindResourceEx32A(HINSTANCE32,LPCSTR,LPCSTR,WORD);
HRSRC32 WINAPI FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD);
#define FindResourceEx WINELIB_NAME_AW(FindResourceEx)
BOOL32 WINAPI FlushConsoleInputBuffer(HANDLE32);
BOOL32 WINAPI FlushFileBuffers(HFILE32);
DWORD WINAPI FormatMessage32A(DWORD,LPCVOID,DWORD,DWORD,LPSTR,
DWORD,LPDWORD);
#define FormatMessage WINELIB_NAME_AW(FormatMessage)
BOOL32 WINAPI FreeEnvironmentStrings32A(LPSTR);
BOOL32 WINAPI FreeEnvironmentStrings32W(LPWSTR);
#define FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
@ -5570,7 +5709,14 @@ BOOL32 WINAPI GetCommTimeouts(INT32,LPCOMMTIMEOUTS);
BOOL32 WINAPI GetComputerName32A(LPSTR,LPDWORD);
BOOL32 WINAPI GetComputerName32W(LPWSTR,LPDWORD);
#define GetComputerName WINELIB_NAME_AW(GetComputerName)
UINT32 WINAPI GetConsoleCP();
BOOL32 WINAPI GetConsoleMode(HANDLE32,LPDWORD);
UINT32 WINAPI GetConsoleOutputCP();
DWORD WINAPI GetConsoleTitle32A(LPSTR,DWORD);
DWORD WINAPI GetConsoleTitle32W(LPWSTR,DWORD);
#define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
BOOL32 WINAPI GetCPInfo(UINT32,LPCPINFO);
HANDLE32 WINAPI GetCurrentObject(HDC32,UINT32);
HANDLE32 WINAPI GetCurrentProcess(void);
DWORD WINAPI GetCurrentProcessId(void);
HANDLE32 WINAPI GetCurrentThread(void);
@ -5589,11 +5735,14 @@ DWORD WINAPI GetFileType(HFILE32);
DWORD WINAPI GetFullPathName32A(LPCSTR,DWORD,LPSTR,LPSTR*);
DWORD WINAPI GetFullPathName32W(LPCWSTR,DWORD,LPWSTR,LPWSTR*);
#define GetFullPathName WINELIB_NAME_AW(GetFullPathName)
DWORD WINAPI GetLargestConsoleWindowSize(HANDLE32);
VOID WINAPI GetLocalTime(LPSYSTEMTIME);
DWORD WINAPI GetLogicalDrives(void);
BOOL32 WINAPI GetMenuItemInfo32A(HMENU32,UINT32,BOOL32,MENUITEMINFO32A*);
BOOL32 WINAPI GetMenuItemInfo32W(HMENU32,UINT32,BOOL32,MENUITEMINFO32W*);
#define GetMenuItemInfo WINELIB_NAME_AW(GetMenuItemInfo)
BOOL32 WINAPI GetNumberOfConsoleInputEvents(HANDLE32,LPDWORD);
BOOL32 WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
DWORD WINAPI GetObjectType(HANDLE32);
UINT32 WINAPI GetOEMCP(void);
DWORD WINAPI GetPriorityClass(HANDLE32);
@ -5635,6 +5784,7 @@ DWORD WINAPI HeapSize(HANDLE32,DWORD,LPVOID);
BOOL32 WINAPI HeapUnlock(HANDLE32);
BOOL32 WINAPI HeapValidate(HANDLE32,DWORD,LPCVOID);
BOOL32 WINAPI IsDBCSLeadByteEx(UINT32,BYTE);
BOOL32 WINAPI IsProcessorFeaturePresent(DWORD);
BOOL32 WINAPI IsWindowUnicode(HWND32);
BOOL32 WINAPI IsValidLocale(DWORD,DWORD);
BOOL32 WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
@ -5702,6 +5852,7 @@ DWORD WINAPI SearchPath32W(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*);
BOOL32 WINAPI SetBrushOrgEx(HDC32,INT32,INT32,LPPOINT32);
BOOL32 WINAPI SetCommMask(INT32,DWORD);
BOOL32 WINAPI SetCommTimeouts(INT32,LPCOMMTIMEOUTS);
BOOL32 WINAPI SetConsoleMode(HANDLE32,DWORD);
BOOL32 WINAPI SetConsoleTitle32A(LPCSTR);
BOOL32 WINAPI SetConsoleTitle32W(LPCWSTR);
#define SetConsoleTitle WINELIB_NAME_AW(SetConsoleTitle)
@ -5743,8 +5894,8 @@ BOOL32 WINAPI VirtualProtectEx(HANDLE32,LPVOID,DWORD,DWORD,LPDWORD);
BOOL32 WINAPI VirtualQuery(LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
BOOL32 WINAPI VirtualQueryEx(HANDLE32,LPCVOID,LPMEMORY_BASIC_INFORMATION,DWORD);
BOOL32 WINAPI VirtualUnlock(LPVOID,DWORD);
BOOL32 WINAPI WriteConsole32A(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
BOOL32 WINAPI WriteConsole32W(HANDLE32,LPVOID,DWORD,LPDWORD,LPVOID);
BOOL32 WINAPI WriteConsole32A(HANDLE32,LPCVOID,DWORD,LPDWORD,LPVOID);
BOOL32 WINAPI WriteConsole32W(HANDLE32,LPCVOID,DWORD,LPDWORD,LPVOID);
#define WriteConsole WINELIB_NAME_AW(WriteConsole)
BOOL32 WINAPI WriteFile(HFILE32,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
@ -5778,6 +5929,9 @@ VOID WINAPI WaitMessage(VOID);
/* Declarations for functions that change between Win16 and Win32 */
BOOL16 WINAPI AbortPath16(HDC16);
BOOL32 WINAPI AbortPath32(HDC32);
#define AbortPath WINELIB_NAME(AbortPath)
LRESULT WINAPI AboutDlgProc16(HWND16,UINT16,WPARAM16,LPARAM);
LRESULT WINAPI AboutDlgProc32(HWND32,UINT32,WPARAM32,LPARAM);
#define AboutDlgProc WINELIB_NAME(AboutDlgProc)
@ -5855,6 +6009,9 @@ HDWP32 WINAPI BeginDeferWindowPos32(INT32);
HDC16 WINAPI BeginPaint16(HWND16,LPPAINTSTRUCT16);
HDC32 WINAPI BeginPaint32(HWND32,LPPAINTSTRUCT32);
#define BeginPaint WINELIB_NAME(BeginPaint)
BOOL16 WINAPI BeginPath16(HDC16);
BOOL32 WINAPI BeginPath32(HDC32);
#define BeginPath WINELIB_NAME(BeginPath)
BOOL16 WINAPI BitBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16,DWORD);
BOOL32 WINAPI BitBlt32(HDC32,INT32,INT32,INT32,INT32,HDC32,INT32,INT32,DWORD);
#define BitBlt WINELIB_NAME(BitBlt)
@ -5946,6 +6103,9 @@ BOOL32 WINAPI ClipCursor32(const RECT32*);
BOOL16 WINAPI CloseClipboard16(void);
BOOL32 WINAPI CloseClipboard32(void);
#define CloseClipboard WINELIB_NAME(CloseClipboard)
BOOL16 WINAPI CloseFigure16(HDC16);
BOOL32 WINAPI CloseFigure32(HDC32);
#define CloseFigure WINELIB_NAME(CloseFigure)
HMETAFILE16 WINAPI CloseMetaFile16(HDC16);
HMETAFILE32 WINAPI CloseMetaFile32(HDC32);
#define CloseMetaFile WINELIB_NAME(CloseMetaFile)
@ -6304,6 +6464,9 @@ INT32 WINAPI EndDoc32(HDC32);
BOOL16 WINAPI EndPaint16(HWND16,const PAINTSTRUCT16*);
BOOL32 WINAPI EndPaint32(HWND32,const PAINTSTRUCT32*);
#define EndPaint WINELIB_NAME(EndPaint)
BOOL16 WINAPI EndPath16(HDC16);
BOOL32 WINAPI EndPath32(HDC32);
#define EndPath WINELIB_NAME(EndPath)
BOOL16 WINAPI EnumChildWindows16(HWND16,WNDENUMPROC16,LPARAM);
BOOL32 WINAPI EnumChildWindows32(HWND32,WNDENUMPROC32,LPARAM);
#define EnumChildWindows WINELIB_NAME(EnumChildWindows)
@ -6360,6 +6523,9 @@ INT32 WINAPI ExcludeUpdateRgn32(HDC32,HWND32);
BOOL16 WINAPI ExitWindows16(DWORD,UINT16);
#define ExitWindows32(a,b) ExitWindowsEx(EWX_LOGOFF,0xffffffff)
#define ExitWindows WINELIB_NAME(ExitWindows)
HPEN16 WINAPI ExtCreatePen16(DWORD,DWORD,const LOGBRUSH16*,DWORD,const DWORD*);
HPEN32 WINAPI ExtCreatePen32(DWORD,DWORD,const LOGBRUSH32*,DWORD,const DWORD*);
#define ExtCreatePen WINELIB_NAME(ExtCreatePen)
BOOL16 WINAPI ExtFloodFill16(HDC16,INT16,INT16,COLORREF,UINT16);
BOOL32 WINAPI ExtFloodFill32(HDC32,INT32,INT32,COLORREF,UINT32);
#define ExtFloodFill WINELIB_NAME(ExtFloodFill)
@ -6382,6 +6548,9 @@ void WINAPI FatalAppExit16(UINT16,LPCSTR);
void WINAPI FatalAppExit32A(UINT32,LPCSTR);
void WINAPI FatalAppExit32W(UINT32,LPCWSTR);
#define FatalAppExit WINELIB_NAME_AW(FatalAppExit)
BOOL16 WINAPI FillPath16(HDC16);
BOOL32 WINAPI FillPath32(HDC32);
#define FillPath WINELIB_NAME(FillPath)
INT16 WINAPI FillRect16(HDC16,const RECT16*,HBRUSH16);
INT32 WINAPI FillRect32(HDC32,const RECT32*,HBRUSH32);
#define FillRect WINELIB_NAME(FillRect)
@ -6402,11 +6571,11 @@ HINSTANCE32 WINAPI FindExecutable32W(LPCWSTR,LPCWSTR,LPWSTR);
HANDLE16 WINAPI FindFirstFile16(LPCSTR,LPWIN32_FIND_DATA32A);
HANDLE32 WINAPI FindFirstFile32A(LPCSTR,LPWIN32_FIND_DATA32A);
HANDLE32 WINAPI FindFirstFile32W(LPCWSTR,LPWIN32_FIND_DATA32W);
#define FindFirst WINELIB_NAME_AW(FindFirst)
#define FindFirstFile WINELIB_NAME_AW(FindFirstFile)
BOOL16 WINAPI FindNextFile16(HANDLE16,LPWIN32_FIND_DATA32A);
BOOL32 WINAPI FindNextFile32A(HANDLE32,LPWIN32_FIND_DATA32A);
BOOL32 WINAPI FindNextFile32W(HANDLE32,LPWIN32_FIND_DATA32W);
#define FindNext WINELIB_NAME_AW(FindNext)
#define FindNextFile WINELIB_NAME_AW(FindNextFile)
HRSRC16 WINAPI FindResource16(HINSTANCE16,SEGPTR,SEGPTR);
HRSRC32 WINAPI FindResource32A(HINSTANCE32,LPCSTR,LPCSTR);
HRSRC32 WINAPI FindResource32W(HINSTANCE32,LPCWSTR,LPCWSTR);
@ -6563,6 +6732,9 @@ HWND32 WINAPI GetDesktopWindow32(void);
INT16 WINAPI GetDeviceCaps16(HDC16,INT16);
INT32 WINAPI GetDeviceCaps32(HDC32,INT32);
#define GetDeviceCaps WINELIB_NAME(GetDeviceCaps)
UINT16 WINAPI GetDIBColorTable16(HDC16,UINT16,UINT16,RGBQUAD*);
UINT32 WINAPI GetDIBColorTable32(HDC32,UINT32,UINT32,RGBQUAD*);
#define GetDIBColorTable WINELIB_NAME(GetDIBColorTable)
INT16 WINAPI GetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPSTR,LPBITMAPINFO,UINT16);
INT32 WINAPI GetDIBits32(HDC32,HBITMAP32,UINT32,UINT32,LPSTR,LPBITMAPINFO,UINT32);
#define GetDIBits WINELIB_NAME(GetDIBits)
@ -6718,6 +6890,9 @@ UINT32 WINAPI GetPaletteEntries32(HPALETTE32,UINT32,UINT32,LPPALETTEENTRY);
HWND16 WINAPI GetParent16(HWND16);
HWND32 WINAPI GetParent32(HWND32);
#define GetParent WINELIB_NAME(GetParent)
INT16 WINAPI GetPath16(HDC16,LPPOINT16,LPBYTE,INT16);
INT32 WINAPI GetPath32(HDC32,LPPOINT32,LPBYTE,INT32);
#define GetPath WINELIB_NAME(GetPath)
COLORREF WINAPI GetPixel16(HDC16,INT16,INT16);
COLORREF WINAPI GetPixel32(HDC32,INT32,INT32);
#define GetPixel WINELIB_NAME(GetPixel)
@ -7228,6 +7403,10 @@ INT16 WINAPI MessageBox16(HWND16,LPCSTR,LPCSTR,UINT16);
INT32 WINAPI MessageBox32A(HWND32,LPCSTR,LPCSTR,UINT32);
INT32 WINAPI MessageBox32W(HWND32,LPCWSTR,LPCWSTR,UINT32);
#define MessageBox WINELIB_NAME_AW(MessageBox)
INT16 WINAPI MessageBoxIndirect16(LPMSGBOXPARAMS16);
INT32 WINAPI MessageBoxIndirect32A(LPMSGBOXPARAMS32A);
INT32 WINAPI MessageBoxIndirect32W(LPMSGBOXPARAMS32W);
#define MessageBoxIndirect WINELIB_NAME_AW(MessageBoxIndirect)
BOOL16 WINAPI ModifyMenu16(HMENU16,UINT16,UINT16,UINT16,SEGPTR);
BOOL32 WINAPI ModifyMenu32A(HMENU32,UINT32,UINT32,UINT32,LPCSTR);
BOOL32 WINAPI ModifyMenu32W(HMENU32,UINT32,UINT32,UINT32,LPCWSTR);
@ -7292,6 +7471,9 @@ BOOL32 WINAPI PaintRgn32(HDC32,HRGN32);
BOOL16 WINAPI PatBlt16(HDC16,INT16,INT16,INT16,INT16,DWORD);
BOOL32 WINAPI PatBlt32(HDC32,INT32,INT32,INT32,INT32,DWORD);
#define PatBlt WINELIB_NAME(PatBlt)
HRGN16 WINAPI PathToRegion16(HDC16);
HRGN32 WINAPI PathToRegion32(HDC32);
#define PathToRegion WINELIB_NAME(PathToRegion)
BOOL16 WINAPI PeekMessage16(LPMSG16,HWND16,UINT16,UINT16,UINT16);
BOOL32 WINAPI PeekMessage32A(LPMSG32,HWND32,UINT32,UINT32,UINT32);
BOOL32 WINAPI PeekMessage32W(LPMSG32,HWND32,UINT32,UINT32,UINT32);
@ -7469,6 +7651,9 @@ INT16 WINAPI ScrollWindowEx16(HWND16,INT16,INT16,const RECT16*,
INT32 WINAPI ScrollWindowEx32(HWND32,INT32,INT32,const RECT32*,
const RECT32*,HRGN32,LPRECT32,UINT32);
#define ScrollWindowEx WINELIB_NAME(ScrollWindowEx)
BOOL16 WINAPI SelectClipPath16(HDC16,INT16);
BOOL32 WINAPI SelectClipPath32(HDC32,INT32);
#define SelectClipPath WINELIB_NAME(SelectClipPath)
INT16 WINAPI SelectClipRgn16(HDC16,HRGN16);
INT32 WINAPI SelectClipRgn32(HDC32,HRGN32);
#define SelectClipRgn WINELIB_NAME(SelectClipRgn)
@ -7486,6 +7671,13 @@ LRESULT WINAPI SendMessage16(HWND16,UINT16,WPARAM16,LPARAM);
LRESULT WINAPI SendMessage32A(HWND32,UINT32,WPARAM32,LPARAM);
LRESULT WINAPI SendMessage32W(HWND32,UINT32,WPARAM32,LPARAM);
#define SendMessage WINELIB_NAME_AW(SendMessage)
LRESULT WINAPI SendMessageTimeout16(HWND16,UINT16,WPARAM16,LPARAM,UINT16,
UINT16,LPWORD);
LRESULT WINAPI SendMessageTimeout32A(HWND32,UINT32,WPARAM32,LPARAM,UINT32,
UINT32,LPDWORD);
LRESULT WINAPI SendMessageTimeout32W(HWND32,UINT32,WPARAM32,LPARAM,UINT32,
UINT32,LPDWORD);
#define SendMessageTimeout WINELIB_NAME_AW(SendMessageTimeout)
HWND16 WINAPI SetActiveWindow16(HWND16);
HWND32 WINAPI SetActiveWindow32(HWND32);
#define SetActiveWindow WINELIB_NAME(SetActiveWindow)
@ -7542,6 +7734,9 @@ BOOL32 WINAPI SetCursorPos32(INT32,INT32);
BOOL16 WINAPI SetDeskWallPaper16(LPCSTR);
BOOL32 WINAPI SetDeskWallPaper32(LPCSTR);
#define SetDeskWallPaper WINELIB_NAME(SetDeskWallPaper)
UINT16 WINAPI SetDIBColorTable16(HDC16,UINT16,UINT16,RGBQUAD*);
UINT32 WINAPI SetDIBColorTable32(HDC32,UINT32,UINT32,RGBQUAD*);
#define SetDIBColorTable WINELIB_NAME(SetDIBColorTable)
INT16 WINAPI SetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPCVOID,const BITMAPINFO*,UINT16);
INT32 WINAPI SetDIBits32(HDC32,HBITMAP32,UINT32,UINT32,LPCVOID,const BITMAPINFO*,UINT32);
#define SetDIBits WINELIB_NAME(SetDIBits)

View File

@ -17,6 +17,7 @@ extern int WIN32_LastError;
#define ERROR_TOO_MANY_OPEN_FILES 4
#define ERROR_ACCESS_DENIED 5
#define ERROR_INVALID_HANDLE 6
#define ERROR_NOT_ENOUGH_MEMORY 8
#define ERROR_BAD_FORMAT 11
#define ERROR_OUTOFMEMORY 14
#define ERROR_NO_MORE_FILES 18
@ -28,6 +29,7 @@ extern int WIN32_LastError;
#define ERROR_BROKEN_PIPE 109
#define ERROR_DISK_FULL 112
#define ERROR_CALL_NOT_IMPLEMENTED 120
#define ERROR_INSUFFICIENT_BUFFER 122
#define ERROR_SEEK_ON_DEVICE 132
#define ERROR_DIR_NOT_EMPTY 145
#define ERROR_BUSY 170
@ -35,9 +37,22 @@ extern int WIN32_LastError;
#define ERROR_FILENAME_EXCED_RANGE 206
#define ERROR_MORE_DATA 234
#define ERROR_NO_MORE_ITEMS 259
#define ERROR_INVALID_ADDRESS 487
#define ERROR_CAN_NOT_COMPLETE 1003
#define ERROR_IO_DEVICE 1117
#define ERROR_POSSIBLE_DEADLOCK 1131
#define ERROR_BAD_DEVICE 1200
#define ERROR_NO_NETWORK 1222
#define ERROR_COMMITMENT_LIMIT 1455
/* HRESULT values for OLE, SHELL and other Interface stuff */
#define NOERROR 0
#define S_OK 0
#define E_UNEXPECTED 0x8000FFFF
#define E_OUTOFMEMORY 0x8007000E
#define E_INVALIDARG 0x80070057
#define OLE_E_ENUM_NOMORE 0x80040002
#define CLASS_E_CLASSNOTAVAILABLE 0x80040111
#endif /* __WINE_WINERROR_H */

View File

@ -24,6 +24,12 @@
#define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
#define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
/* Processor feature flags. */
#define PF_FLOATING_POINT_PRECISION_ERRATA 0
#define PF_FLOATING_POINT_EMULATED 1
#define PF_COMPARE_EXCHANGE_DOUBLE 2
#define PF_MMX_INSTRUCTIONS_AVAILABLE 3
/* The Win32 register context */
#define CONTEXT_i386 0x00010000

View File

@ -41,5 +41,8 @@ extern LONG WINPOS_SendNCCalcSize(HWND32 hwnd, BOOL32 calcValidRect,
extern LONG WINPOS_HandleWindowPosChanging16(WND *wndPtr, WINDOWPOS16 *winpos);
extern LONG WINPOS_HandleWindowPosChanging32(WND *wndPtr, WINDOWPOS32 *winpos);
extern INT16 WINPOS_WindowFromPoint( WND* scopeWnd, POINT16 pt, WND **ppWnd );
extern void WINPOS_CheckInternalPos( HWND32 hwnd );
extern BOOL32 WINPOS_ActivateOtherWindow(WND* pWnd);
extern BOOL32 WINPOS_CreateInternalPosAtom(void);
#endif /* __WINE_WINPOS_H */

View File

@ -61,46 +61,62 @@ typedef struct
{
UINT16 fd_count; /* how many are SET? */
SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} ws_fd_set;
} ws_fd_set16;
typedef struct
{
UINT32 fd_count; /* how many are SET? */
SOCKET32 fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} ws_fd_set32;
/* ws_fd_set operations */
INT16 WINAPI __WSAFDIsSet16( SOCKET16, ws_fd_set * );
INT32 WINAPI __WSAFDIsSet32( SOCKET32, ws_fd_set * );
INT16 WINAPI __WSAFDIsSet16( SOCKET16, ws_fd_set16 * );
INT32 WINAPI __WSAFDIsSet32( SOCKET32, ws_fd_set32 * );
#define __WSAFDIsSet WINELIB_NAME(__WSAFDIsSet);
#define WS_FD_CLR(fd, set) do { \
#define __WS_FD_CLR(fd, set, cast) do { \
UINT16 __i; \
for (__i = 0; __i < ((ws_fd_set*)(set))->fd_count ; __i++) \
for (__i = 0; __i < ((cast*)(set))->fd_count ; __i++) \
{ \
if (((ws_fd_set*)(set))->fd_array[__i] == fd) \
if (((cast*)(set))->fd_array[__i] == fd) \
{ \
while (__i < ((ws_fd_set*)(set))->fd_count-1) \
while (__i < ((cast*)(set))->fd_count-1) \
{ \
((ws_fd_set*)(set))->fd_array[__i] = \
((ws_fd_set*)(set))->fd_array[__i+1]; \
((cast*)(set))->fd_array[__i] = \
((cast*)(set))->fd_array[__i+1]; \
__i++; \
} \
((ws_fd_set*)(set))->fd_count--; \
((cast*)(set))->fd_count--; \
break; \
} \
} \
} while(0)
#define WS_FD_CLR16(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set16)
#define WS_FD_CLR32(fd, set) __WS_FD_CLR((fd),(set), ws_fd_set32)
#define WS_FD_CLR WINELIB_NAME(WS_FD_CLR);
#define WS_FD_SET(fd, set) do { \
if (((ws_fd_set*)(set))->fd_count < FD_SETSIZE) \
((ws_fd_set*)(set))->fd_array[((ws_fd_set*)(set))->fd_count++]=(fd);\
#define __WS_FD_SET(fd, set, cast) do { \
if (((cast*)(set))->fd_count < FD_SETSIZE) \
((cast*)(set))->fd_array[((cast*)(set))->fd_count++]=(fd);\
} while(0)
#define WS_FD_SET16(fd, set) __WS_FD_SET((fd),(set), ws_fd_set16)
#define WS_FD_SET32(fd, set) __WS_FD_SET((fd),(set), ws_fd_set32)
#define WS_FD_SET WINELIB_NAME(WS_FD_SET);
#define WS_FD_ZERO(set) (((ws_fd_set*)(set))->fd_count=0)
#define WS_FD_ZERO16(set) (((ws_fd_set16*)(set))->fd_count=0)
#define WS_FD_ZERO32(set) (((ws_fd_set32*)(set))->fd_count=0)
#define WS_FD_ZERO WINELIB_NAME(WS_FD_ZERO);
#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET16)(fd), (ws_fd_set*)(set))
#define WS_FD_ISSET16(fd, set) __WSAFDIsSet16((SOCKET16)(fd), (ws_fd_set16*)(set))
#define WS_FD_ISSET32(fd, set) __WSAFDIsSet32((SOCKET32)(fd), (ws_fd_set32*)(set))
#define WS_FD_ISSET WINELIB_NAME(WS_FD_ISSET);
/*
* Internet address (old style... should be updated)
*/
typedef struct ws_addr_in
struct ws_in_addr
{
union {
struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
@ -113,15 +129,15 @@ typedef struct ws_addr_in
#define ws_imp S_un.S_un_w.s_w2 /* imp */
#define ws_impno S_un.S_un_b.s_b4 /* imp # */
#define ws_lh S_un.S_un_b.s_b3 /* logical host */
} _ws_in_addr;
};
typedef struct ws_sockaddr_in
struct ws_sockaddr_in
{
INT16 sin_family;
UINT16 sin_port;
_ws_in_addr sin_addr;
char sin_zero[8];
} _ws_sockaddr_in;
struct ws_in_addr sin_addr;
BYTE sin_zero[8];
};
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
@ -356,27 +372,51 @@ INT32 WINAPI WSAUnhookBlockingHook32(void);
FARPROC16 WINAPI WSASetBlockingHook16(FARPROC16 lpBlockFunc);
FARPROC32 WINAPI WSASetBlockingHook32(FARPROC32 lpBlockFunc);
#define WSASetBlockingHook WINELIB_NAME(WSASetBlockingHook)
HANDLE16 WINAPI WSAAsyncGetServByName(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, LPCSTR proto,
SEGPTR buf, INT16 buflen);
HANDLE16 WINAPI WSAAsyncGetServByPort(HWND16 hWnd, UINT16 wMsg, INT16 port,
LPCSTR proto, SEGPTR buf, INT16 buflen);
HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 wMsg, LPCSTR name, LPCSTR proto,
SEGPTR buf, INT16 buflen);
HANDLE32 WINAPI WSAAsyncGetServByName32(HWND32 hWnd, UINT32 uMsg, LPCSTR name, LPCSTR proto,
LPSTR sbuf, INT32 buflen);
#define WSAAsyncGetServByName WINELIB_NAME(WSAAsyncGetServByName)
HANDLE16 WINAPI WSAAsyncGetProtoByName(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, SEGPTR buf, INT16 buflen);
HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 wMsg, INT16 port,
LPCSTR proto, SEGPTR buf, INT16 buflen);
HANDLE32 WINAPI WSAAsyncGetServByPort32(HWND32 hWnd, UINT32 uMsg, INT32 port,
LPCSTR proto, LPSTR sbuf, INT32 buflen);
#define WSAAsyncGetServByPort WINELIB_NAME(WSAAsyncGetServByPort)
HANDLE16 WINAPI WSAAsyncGetProtoByNumber(HWND16 hWnd, UINT16 wMsg,
INT16 number, SEGPTR buf, INT16 buflen);
HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, SEGPTR buf, INT16 buflen);
HANDLE32 WINAPI WSAAsyncGetProtoByName32(HWND32 hWnd, UINT32 uMsg,
LPCSTR name, LPSTR sbuf, INT32 buflen);
#define WSAAsyncGetProtoByByName WINELIB_NAME(WSAAsyncGetProtoByByName)
HANDLE16 WINAPI WSAAsyncGetHostByName(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, SEGPTR buf, INT16 buflen);
HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd, UINT16 wMsg,
INT16 number, SEGPTR buf, INT16 buflen);
HANDLE32 WINAPI WSAAsyncGetProtoByNumber32(HWND32 hWnd, UINT32 uMsg,
INT32 number, LPSTR sbuf, INT32 buflen);
#define WSAAsyncGetProtoByNumber WINELIB_NAME(WSAAsyncGetProtoByNumber)
HANDLE16 WINAPI WSAAsyncGetHostByAddr(HWND16 hWnd, UINT16 wMsg, LPCSTR addr,
HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, SEGPTR buf, INT16 buflen);
HANDLE32 WINAPI WSAAsyncGetHostByName32(HWND32 hWnd, UINT32 uMsg,
LPCSTR name, LPSTR sbuf, INT32 buflen);
#define WSAAsyncGetHostByName WINELIB_NAME(WSAAsyncGetHostByName)
HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 wMsg, LPCSTR addr,
INT16 len, INT16 type, SEGPTR buf, INT16 buflen);
INT16 WINAPI WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle);
INT16 WINAPI WSAAsyncSelect(SOCKET16 s, HWND16 hWnd, UINT16 wMsg,
UINT32 lEvent);
HANDLE32 WINAPI WSAAsyncGetHostByAddr32(HWND32 hWnd, UINT32 uMsg, LPCSTR addr,
INT32 len, INT32 type, LPSTR sbuf, INT32 buflen);
#define WSAAsyncGetHostByAddr WINELIB_NAME(WSAAsyncGetHostByAddr)
INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle);
INT32 WINAPI WSACancelAsyncRequest32(HANDLE32 hAsyncTaskHandle);
#define WSACancelAsyncRequest WINELIB_NAME(WSACancelAsyncRequest)
INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, UINT32 lEvent);
INT32 WINAPI WSAAsyncSelect32(SOCKET32 s, HWND32 hWnd, UINT32 uMsg, UINT32 lEvent);
#define WSAAsyncSelect WINELIB_NAME(WSAAsyncSelect)
#ifdef __cplusplus
}
@ -458,12 +498,18 @@ typedef struct __aop
/* custom data */
HWND16 hWnd; /* hWnd to post */
UINT16 uMsg; /* uMsg message to. */
HWND32 hWnd; /* hWnd to post */
UINT32 uMsg; /* uMsg message to. */
SEGPTR buffer_base; /* buffer to copy result to */
UINT16 buflen;
UINT16 flags; /* WSMSG_ASYNC_... */
union
{
SEGPTR seg_base;
LPSTR lin_base;
void* ptr_base;
} b; /* buffer to copy result to */
UINT32 buflen;
UINT32 flags; /* WSMSG_ASYNC_... */
} ws_async_op;
#define WSMSG_ASYNC_HOSTBYNAME 0x0001
@ -472,6 +518,7 @@ typedef struct __aop
#define WSMSG_ASYNC_PROTOBYNUM 0x0020
#define WSMSG_ASYNC_SERVBYNAME 0x0100
#define WSMSG_ASYNC_SERVBYPORT 0x0200
#define WSMSG_ASYNC_WIN32 0x1000
#define WSMSG_DEAD_AOP 0x8000
typedef struct __sop /* WSAAsyncSelect() control struct */
@ -479,8 +526,8 @@ typedef struct __sop /* WSAAsyncSelect() control struct */
struct __sop *next, *prev;
struct __ws* pws;
HWND16 hWnd;
UINT16 uMsg;
HWND32 hWnd;
UINT32 uMsg;
} ws_select_op;
typedef struct __ws /* socket */

View File

@ -88,6 +88,7 @@ typedef int INT32;
typedef unsigned int UINT32;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned long ULONG;
typedef unsigned char BYTE;
typedef long LONG;
typedef char CHAR;

View File

@ -14,6 +14,8 @@
typedef struct
{
int style;
int endcap;
int linejoin;
int pixel;
int width;
char * dashes;

View File

@ -526,7 +526,7 @@ static HMODULE32 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) {
fprintf(stderr, "Sorry, this is an OS/2 linear executable (LX) file !\n");
return (HMODULE32)11;
return (HMODULE32)12;
}
/* We now have a valid NE header */
@ -1508,9 +1508,9 @@ HINSTANCE16 WINAPI LoadLibrary16( LPCSTR libname )
*
* FIXME: rough guesswork, don't know what "Private" means
*/
HMODULE32 WINAPI PrivateLoadLibrary(LPCSTR libname)
HINSTANCE32 WINAPI PrivateLoadLibrary(LPCSTR libname)
{
return LoadLibrary16(libname);
return (HINSTANCE32)LoadLibrary16(libname);
}
@ -1529,9 +1529,9 @@ void WINAPI FreeLibrary16( HINSTANCE16 handle )
*
* FIXME: rough guesswork, don't know what "Private" means
*/
void WINAPI PrivateFreeLibrary(HMODULE32 handle)
void WINAPI PrivateFreeLibrary(HINSTANCE32 handle)
{
FreeLibrary16(handle);
FreeLibrary16((HINSTANCE16)handle);
}

View File

@ -55,8 +55,8 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
if (!pSeg->filepos) return TRUE; /* No file image, just return */
fd = MODULE_OpenFile( pModule->self );
dprintf_module( stddeb, "Loading segment %d, selector=%04x\n",
segnum, pSeg->selector );
dprintf_module( stddeb, "Loading segment %d, selector=%04x, flags=%04x\n",
segnum, pSeg->selector, pSeg->flags );
lseek( fd, pSeg->filepos << pModule->alignment, SEEK_SET );
if (pSeg->size) size = pSeg->size;
else if (pSeg->minsize) size = pSeg->minsize;
@ -631,7 +631,7 @@ static BOOL32 NE_InitDLL( TDB* pTask, HMODULE16 hModule )
dprintf_dll( stddeb, "Calling LibMain, cs:ip=%04lx:%04x ds=%04lx di=%04x cx=%04x\n",
CS_reg(&context), IP_reg(&context), DS_reg(&context),
DI_reg(&context), CX_reg(&context) );
Callbacks->CallRegisterProc( &context, 0 );
Callbacks->CallRegisterShortProc( &context, 0 );
return TRUE;
}
@ -674,4 +674,5 @@ void NE_InitializeDLLs( HMODULE16 hModule )
/* It does nothing */
void WINAPI PatchCodeHandle(HANDLE16 hSel)
{
fprintf(stderr,"PatchCodeHandle(%04x),stub!\n",hSel);
}

View File

@ -167,7 +167,7 @@ FARPROC32 PE_FindExportedFunction( HMODULE32 hModule, LPCSTR funcName)
}
void
fixup_imports (PDB32 *process,PE_MODREF *pem)
fixup_imports (PDB32 *process,PE_MODREF *pem,HMODULE32 hModule)
{
IMAGE_IMPORT_DESCRIPTOR *pe_imp;
int fixup_failed = 0;
@ -207,10 +207,10 @@ fixup_imports (PDB32 *process,PE_MODREF *pem)
/* don't use MODULE_Load, Win32 creates new task differently */
res = PE_LoadLibraryEx32A( name, 0, 0 );
if (res <= (HMODULE32) 32) {
char *p, buffer[256];
char *p, buffer[1024];
/* Try with prepending the path of the current module */
GetModuleFileName32A( pem->module, buffer, sizeof (buffer));
GetModuleFileName32A( hModule, buffer, sizeof (buffer));
if (!(p = strrchr (buffer, '\\')))
p = buffer;
strcpy (p + 1, name);
@ -522,6 +522,11 @@ static HMODULE32 PE_MapImage( HMODULE32 hModule, PDB32 *process,
load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size,
MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE );
if (load_addr == 0) {
load_addr = (DWORD)VirtualAlloc( NULL, vma_size,
MEM_RESERVE | MEM_COMMIT,
PAGE_EXECUTE_READWRITE );
}
pem->module = (HMODULE32)load_addr;
dprintf_win32(stddeb, "Load addr is really %lx, range %x\n",
@ -647,7 +652,7 @@ static HMODULE32 PE_MapImage( HMODULE32 hModule, PDB32 *process,
if(pem->pe_reloc) do_relocations(pem);
if(pem->pe_export) dump_exports(pem->module);
if(pem->pe_import) fixup_imports(process,pem);
if(pem->pe_import) fixup_imports(process,pem,hModule);
if (pem->pe_export)
modname = (char*)RVA(pem->pe_export->Name);
@ -671,6 +676,7 @@ HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
/******************************************************************************
* The PE Library Loader frontend.
* FIXME: handle the flags.
* internal module handling should be made better here (and in builtin.c)
*/
HMODULE32 PE_LoadLibraryEx32A (LPCSTR name, HFILE32 hFile, DWORD flags) {
OFSTRUCT ofs;
@ -690,6 +696,27 @@ HMODULE32 PE_LoadLibraryEx32A (LPCSTR name, HFILE32 hFile, DWORD flags) {
pem = pem->next;
}
pModule = MODULE_GetPtr(hModule);
if (pModule->flags & NE_FFLAGS_BUILTIN) {
PDB32 *process = (PDB32*)GetCurrentProcessId();
IMAGE_DOS_HEADER *dh;
IMAGE_NT_HEADERS *nh;
IMAGE_SECTION_HEADER *sh;
/* we only come here if we already have 'loaded' the
* internal dll but in another process. Just create
* a PE_MODREF and return.
*/
pem = (PE_MODREF*)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,sizeof(*pem));
pem->module = hModule;
dh = (IMAGE_DOS_HEADER*)pem->module;
nh = (IMAGE_NT_HEADERS*)(dh+1);
sh = (IMAGE_SECTION_HEADER*)(nh+1);
pem->pe_export = (IMAGE_EXPORT_DIRECTORY*)(sh+2);
pem->next = process->modref_list;
process->modref_list = pem;
return hModule;
}
} else {
/* try to load builtin, enabled modules first */

View File

@ -53,7 +53,8 @@ HMODULE32toPE_MODREF(HMODULE32 hmod) {
*
*/
LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
LPCWSTR name,DWORD root)
LPCWSTR name,DWORD root,
BOOL32 allowdefault)
{
int entrynum;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY entryTable;
@ -64,7 +65,7 @@ LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
char buf[10];
lstrcpynWtoA(buf,name+1,10);
return GetResDirEntryW(resdirptr,(LPCWSTR)atoi(buf),root);
return GetResDirEntryW(resdirptr,(LPCWSTR)atoi(buf),root,allowdefault);
}
entryTable = (LPIMAGE_RESOURCE_DIRECTORY_ENTRY) (
(BYTE *) resdirptr +
@ -94,7 +95,7 @@ LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
root +
entryTable[entrynum].u2.s.OffsetToDirectory);
/* just use first entry if no default can be found */
if (!name && resdirptr->NumberOfIdEntries)
if (allowdefault && !name && resdirptr->NumberOfIdEntries)
return (LPIMAGE_RESOURCE_DIRECTORY) (
root +
entryTable[0].u2.s.OffsetToDirectory);
@ -118,14 +119,14 @@ HANDLE32 PE_FindResourceEx32W(
resdirptr = pem->pe_resource;
root = (DWORD) resdirptr;
if ((resdirptr = GetResDirEntryW(resdirptr, type, root)) == NULL)
if ((resdirptr = GetResDirEntryW(resdirptr, type, root, FALSE)) == NULL)
return 0;
if ((resdirptr = GetResDirEntryW(resdirptr, name, root)) == NULL)
if ((resdirptr = GetResDirEntryW(resdirptr, name, root, FALSE)) == NULL)
return 0;
result = (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT32)lang, root);
result = (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)(UINT32)lang, root, FALSE);
/* Try LANG_NEUTRAL, too */
if(!result)
return (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)0, root);
return (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)0, root, TRUE);
return result;
}
@ -243,7 +244,7 @@ PE_EnumResourceNames32A(
typeW = HEAP_strdupAtoW(heap,0,type);
else
typeW = (LPWSTR)type;
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource);
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE);
if (HIWORD(typeW))
HeapFree(heap,0,typeW);
if (!resdir)
@ -282,7 +283,7 @@ PE_EnumResourceNames32W(
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource);
resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE);
if (!resdir)
return FALSE;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
@ -324,7 +325,7 @@ PE_EnumResourceLanguages32A(
nameW = HEAP_strdupAtoW(heap,0,name);
else
nameW = (LPWSTR)name;
resdir = GetResDirEntryW(resdir,nameW,(DWORD)pem->pe_resource);
resdir = GetResDirEntryW(resdir,nameW,(DWORD)pem->pe_resource,FALSE);
if (HIWORD(nameW))
HeapFree(heap,0,nameW);
if (!resdir)
@ -333,7 +334,7 @@ PE_EnumResourceLanguages32A(
typeW = HEAP_strdupAtoW(heap,0,type);
else
typeW = (LPWSTR)type;
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource);
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pem->pe_resource,FALSE);
if (HIWORD(typeW))
HeapFree(heap,0,typeW);
if (!resdir)
@ -367,10 +368,10 @@ PE_EnumResourceLanguages32W(
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pem->pe_resource;
resdir = GetResDirEntryW(resdir,name,(DWORD)pem->pe_resource);
resdir = GetResDirEntryW(resdir,name,(DWORD)pem->pe_resource,FALSE);
if (!resdir)
return FALSE;
resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource);
resdir = GetResDirEntryW(resdir,type,(DWORD)pem->pe_resource,FALSE);
if (!resdir)
return FALSE;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));

View File

@ -386,7 +386,7 @@ static void TASK_CallToStart(void)
SELECTOROF(IF1632_Saved16_ss_sp),
OFFSETOF(IF1632_Saved16_ss_sp) );
Callbacks->CallRegisterProc( &context, 0 );
Callbacks->CallRegisterShortProc( &context, 0 );
/* This should never return */
fprintf( stderr, "TASK_CallToStart: Main program returned!\n" );
TASK_KillCurrentTask( 1 );
@ -629,8 +629,6 @@ static void TASK_DeleteTask( HTASK16 hTask )
*/
void TASK_KillCurrentTask( INT16 exitCode )
{
extern void USER_ExitWindows(void);
TDB* pTask = (TDB*) GlobalLock16( hCurrentTask );
if (!pTask) USER_ExitWindows(); /* No current task yet */

View File

@ -885,7 +885,7 @@ LPVOID WINAPI HeapAlloc( HANDLE32 heap, DWORD flags, DWORD size )
dprintf_heap( stddeb, "HeapAlloc(%08x,%08lx,%08lx): returning NULL\n",
heap, flags, size );
if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
SetLastError( ERROR_OUTOFMEMORY );
SetLastError( ERROR_COMMITMENT_LIMIT );
return NULL;
}
@ -911,7 +911,6 @@ LPVOID WINAPI HeapAlloc( HANDLE32 heap, DWORD flags, DWORD size )
else if (debugging_heap) memset( pInUse + 1, ARENA_INUSE_FILLER, size );
if (!(flags & HEAP_NO_SERIALIZE)) HeapUnlock( heap );
SetLastError( 0 );
dprintf_heap( stddeb, "HeapAlloc(%08x,%08lx,%08lx): returning %08lx\n",
heap, flags, size, (DWORD)(pInUse + 1) );

View File

@ -22,7 +22,8 @@
*/
WORD WINAPI AllocSelectorArray( WORD count )
{
WORD i, size = 0;
WORD i, sel, size = 0;
ldt_entry entry;
if (!count) return 0;
for (i = FIRST_LDT_ENTRY_TO_ALLOC; i < LDT_SIZE; i++)
@ -31,9 +32,22 @@ WORD WINAPI AllocSelectorArray( WORD count )
else if (++size >= count) break;
}
if (i == LDT_SIZE) return 0;
/* Mark selector as allocated */
while (size--) ldt_flags_copy[i--] |= LDT_FLAGS_ALLOCATED;
return ENTRY_TO_SELECTOR( i + 1 );
sel = i - size + 1;
entry.base = 0;
entry.type = SEGMENT_DATA;
entry.seg_32bit = FALSE;
entry.read_only = FALSE;
entry.limit_in_pages = FALSE;
entry.limit = 1; /* avoid 0 base and limit */
for (i = 0; i < count; i++)
{
/* Mark selector as allocated */
ldt_flags_copy[sel + i] |= LDT_FLAGS_ALLOCATED;
LDT_SetEntry( sel + i, &entry );
}
return ENTRY_TO_SELECTOR( sel );
}
@ -652,3 +666,24 @@ void WINAPI WOWGetVDMPointerUnfix(DWORD vp)
fprintf(stdnimp,"WOWGetVDMPointerUnfix(%08lx), STUB\n",vp);
/* FIXME: unfix heapsegment */
}
/***********************************************************************
* UTSelectorOffsetToLinear (WIN32S16.48)
*
* rough guesswork, but seems to work (I had no "reasonable" docu)
*/
LPVOID WINAPI UTSelectorOffsetToLinear(SEGPTR sptr)
{
return PTR_SEG_TO_LIN(sptr);
}
/***********************************************************************
* UTLinearToSelectorOffset (WIN32S16.49)
*
* FIXME: I don't know if that's the right way to do linear -> segmented
*/
SEGPTR WINAPI UTLinearToSelectorOffset(LPVOID lptr)
{
fprintf( stderr, "UTLinearToSelectorOffset(%p): stub\n", lptr );
return (SEGPTR)lptr;
}

View File

@ -21,6 +21,10 @@
#include "stddebug.h"
#include "debug.h"
#ifndef MS_SYNC
#define MS_SYNC 0
#endif
/* File mapping */
typedef struct
{
@ -190,6 +194,8 @@ static FILE_VIEW *VIRTUAL_CreateView( UINT32 base, UINT32 size, UINT32 offset,
/* Create the view structure */
assert( !(base & page_mask) );
assert( !(size & page_mask) );
size >>= page_shift;
if (!(view = (FILE_VIEW *)malloc( sizeof(*view) + size - 1 ))) return NULL;
view->base = base;
@ -490,6 +496,13 @@ LPVOID WINAPI VirtualAlloc( LPVOID addr, DWORD size, DWORD type, DWORD protect)
if (view_size > size)
FILE_munmap( (void *)(ptr + size), 0, view_size - size );
}
else if (ptr != base)
{
/* We couldn't get the address we wanted */
FILE_munmap( (void *)ptr, 0, view_size );
SetLastError( ERROR_INVALID_ADDRESS );
return NULL;
}
if (!(view = VIRTUAL_CreateView( ptr, size, 0, 0, vprot, NULL )))
{
FILE_munmap( (void *)ptr, 0, size );
@ -1097,7 +1110,7 @@ BOOL32 WINAPI FlushViewOfFile( LPCVOID base, DWORD cbFlush )
return FALSE;
}
if (!cbFlush) cbFlush = view->size;
if (!msync( addr, cbFlush, MS_SYNC )) return TRUE;
if (!msync( (void *)addr, cbFlush, MS_SYNC )) return TRUE;
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;

View File

@ -37,6 +37,8 @@ C_SRCS = \
w32scomb.c \
w32skrnl.c \
w32sys.c \
win32s16.c \
windebug.c \
winsock.c \
winsock_dns.c \
wsprintf.c \

View File

@ -7,8 +7,8 @@
#include <assert.h>
#include <stdio.h>
#include "callback.h"
#include "task.h"
extern void TASK_Reschedule(void); /* loader/task.c */
/**********************************************************************
* CALLBACK_CallWndProc
@ -24,10 +24,11 @@ static LRESULT WINAPI CALLBACK_CallWndProc( WNDPROC16 proc, HWND16 hwnd,
/**********************************************************************
* CALLBACK_CallRegisterProc
*/
static VOID WINAPI CALLBACK_CallRegisterProc( CONTEXT *context, INT32 offset)
static LONG WINAPI CALLBACK_CallRegisterProc( CONTEXT *context, INT32 offset)
{
fprintf( stderr, "Cannot call a register proc in Winelib\n" );
assert( FALSE );
return 0;
}
@ -123,6 +124,15 @@ static LRESULT WINAPI CALLBACK_CallASPIPostProc( FARPROC16 proc, SEGPTR ptr )
return proc( ptr );
}
/**********************************************************************
* CALLBACK_CallWOWCallbackProc
*/
static DWORD WINAPI CALLBACK_CallWOWCallbackProc( FARPROC16 proc, DWORD dw )
{
return proc( dw );
}
/**********************************************************************
* CALLBACK_WinelibTable
*
@ -130,7 +140,8 @@ static LRESULT WINAPI CALLBACK_CallASPIPostProc( FARPROC16 proc, SEGPTR ptr )
*/
static const CALLBACKS_TABLE CALLBACK_WinelibTable =
{
CALLBACK_CallRegisterProc, /* CallRegisterProc */
CALLBACK_CallRegisterProc, /* CallRegisterShortProc */
CALLBACK_CallRegisterProc, /* CallRegisterLongProc */
TASK_Reschedule, /* CallTaskRescheduleProc */
NULL, /* CallFrom16WndProc */
CALLBACK_CallWndProc, /* CallWndProc */
@ -142,6 +153,7 @@ static const CALLBACKS_TABLE CALLBACK_WinelibTable =
CALLBACK_CallBootAppProc, /* CallBootAppProc */
CALLBACK_CallLoadAppSegProc, /* CallLoadAppSegProc */
CALLBACK_CallSystemTimerProc, /* CallSystemTimerProc */
CALLBACK_CallWOWCallbackProc, /* CallWOWCallbackProc */
CALLBACK_CallASPIPostProc, /* CallASPIPostProc */
/* The graphics driver callbacks are never used in Winelib */
NULL, /* CallDrvControlProc */

View File

@ -538,10 +538,14 @@ static LONG FILEDLG_WMInitDialog(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam)
}
else
*tmpstr = 0;
if (!FILEDLG_ScanDir(hWnd, tmpstr))
fprintf(stderr, "FileDlg: couldn't read initial directory %s!\n", tmpstr);
/* select current drive in combo 2 */
n = DRIVE_GetCurrentDrive();
if (!FILEDLG_ScanDir(hWnd, tmpstr)) {
*tmpstr = 0;
if (!FILEDLG_ScanDir(hWnd, tmpstr))
fprintf(stderr, "FileDlg: couldn't read initial directory %s!\n",tmpstr);
}
/* select current drive in combo 2, omit missing drives */
for(i=0, n=-1; i<=DRIVE_GetCurrentDrive(); i++)
if (DRIVE_IsValid(i)) n++;
SendDlgItemMessage16(hWnd, cmb2, CB_SETCURSEL16, n, 0);
if (!(lpofn->Flags & OFN_SHOWHELP))
ShowWindow32(GetDlgItem32(hWnd, pshHelp), SW_HIDE);

View File

@ -1,7 +1,7 @@
/*
* What processor?
*
* Copyright 1995 Morten Welinder
* Copyright 1995,1997 Morten Welinder
* Copyright 1997 Marcus Meissner
*/
@ -9,6 +9,7 @@
#include <ctype.h>
#include <string.h>
#include "windows.h"
#include "winnt.h"
VOID WINAPI GetSystemInfo(LPSYSTEM_INFO si)
{
@ -99,3 +100,25 @@ VOID WINAPI GetSystemInfo(LPSYSTEM_INFO si)
return;
#endif /* linux */
}
/* IsProcessorFeaturePresent [KERNEL32.880] */
BOOL32 WINAPI IsProcessorFeaturePresent (DWORD feature)
{
SYSTEM_INFO si;
GetSystemInfo (&si);
/* FIXME: these are relatively stupid approximations. */
switch (feature)
{
case PF_FLOATING_POINT_PRECISION_ERRATA:
return si.wProcessorLevel == 5;
case PF_FLOATING_POINT_EMULATED:
return FALSE;
case PF_COMPARE_EXCHANGE_DOUBLE:
return si.wProcessorLevel >= 5;
case PF_MMX_INSTRUCTIONS_AVAILABLE:
return FALSE;
default:
return FALSE;
}
}

View File

@ -30,6 +30,7 @@ Unresolved issues Uwe Bonnes 970904:
#include <ctype.h>
#include <math.h>
#include <fcntl.h>
#include <setjmp.h>
#include "win.h"
#include "windows.h"
#include "stddebug.h"
@ -438,7 +439,7 @@ INT32 __cdecl CRTDLL__write(INT32 fd,LPCVOID buf,UINT32 count)
if (fd == -1)
len = -1;
else if (fd<=2)
len = (UINT32)write(fd,buf,(LONG)len);
len = (UINT32)write(fd,buf,(LONG)count);
else
len = _lwrite32(fd,buf,count);
dprintf_crtdll(stddeb,"CRTDLL_write %d/%d byte to dfh %d from %p,\n",
@ -456,6 +457,8 @@ INT32 __cdecl CRTDLL__write(INT32 fd,LPCVOID buf,UINT32 count)
* FIXME _exit (CRTDLL.87)
* FIXME exit (CRTDLL.359)
*
* atexit-processing comes to mind -- MW.
*
*/
void __cdecl CRTDLL__cexit(INT32 ret)
{
@ -502,10 +505,13 @@ INT32 __cdecl CRTDLL_fflush(LPVOID stream)
*/
LPSTR __cdecl CRTDLL_gets(LPSTR buf)
{
char * ret;
/* BAD, for the whole WINE process blocks... just done this way to test
* windows95's ftp.exe.
*/
return gets(buf);
ret = gets(buf);
dprintf_crtdll(stddeb,"CRTDLL_gets got %s\n",ret);
return ret;
}
@ -762,12 +768,12 @@ INT32 CRTDLL_system(LPSTR x)
bp = buffer + strlen(buffer);
i = strlen(buffer) + strlen(x) +2;
/* Calculate needed buffer size tp prevent overflow*/
/* Calculate needed buffer size to prevent overflow. */
while (*y) {
if (*y =='\\') i++;
y++;
}
/* if buffer to short, exit */
/* If buffer too short, exit. */
if (i > SYSBUF_LENGTH) {
dprintf_crtdll(stddeb,"_system buffer to small\n");
return 127;
@ -780,7 +786,7 @@ INT32 CRTDLL_system(LPSTR x)
bp++; y++;
if (*(y-1) =='\\') *bp++ = '\\';
}
/* remove spaces from end of string */
/* Remove spaces from end of string. */
while (*(y-1) == ' ') {
bp--;y--;
}
@ -835,6 +841,16 @@ LPWSTR __cdecl CRTDLL__wcslwr(LPWSTR x)
}
/*********************************************************************
* longjmp (CRTDLL.426)
*/
VOID __cdecl CRTDLL_longjmp(jmp_buf env, int val)
{
dprintf_crtdll(stdnimp,"CRTDLL_longjmp semistup, expect crash\n");
dprintf_crtdll(stddeb, "CRTDLL_longjmp semistup, expect crash\n");
return longjmp(env, val);
}
/*********************************************************************
* malloc (CRTDLL.427)
*/
@ -1088,14 +1104,14 @@ LPWSTR __cdecl CRTDLL_wcscat( LPWSTR s1, LPCWSTR s2 )
/*********************************************************************
* wcschr (CRTDLL.504)
*/
LPWSTR __cdecl CRTDLL_wcschr(LPWSTR str,WCHAR xchar)
LPWSTR __cdecl CRTDLL_wcschr(LPCWSTR str,WCHAR xchar)
{
LPWSTR s;
LPCWSTR s;
s=str;
do {
if (*s==xchar)
return s;
return (LPWSTR)s;
} while (*s++);
return NULL;
}
@ -1345,7 +1361,7 @@ INT32 __cdecl CRTDLL_mbstowcs(LPWSTR wcs, LPCSTR mbs, INT32 size)
{
/* Slightly modified lstrcpynAtoW functions from memory/strings.c
* We need the numberr of characters transfered
* We need the number of characters transfered
* FIXME: No multibyte support yet
*/
@ -1522,9 +1538,8 @@ CHAR* __cdecl CRTDLL__getcwd(LPSTR buf, INT32 size)
len = size;
if (!buf) {
len = size;
if (size < 0) /* allocate as big as nescessary */
len =GetCurrentDirectory32A(1,test);
len =GetCurrentDirectory32A(1,test) + 1;
if(!(buf = CRTDLL_malloc(len)))
{
/* set error to OutOfRange */

View File

@ -10,40 +10,50 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <wctype.h>
#include "windows.h"
#include "winnt.h" /* HEAP_ macros */
#include "task.h"
#include "heap.h"
#include "ldt.h"
#include "stackframe.h"
#include "module.h"
#include "stddebug.h"
#include "debug.h"
#define ToUpper(c) toupper(c)
#define ToLower(c) tolower(c)
/* Funny to divide them between user and kernel. */
/* IsCharAlpha USER 433 */
/* be careful: always use functions from wctype.h if character > 255 */
/***********************************************************************
* IsCharAlpha (USER.433)
*/
BOOL16 WINAPI IsCharAlpha16(CHAR ch)
{
return isalpha(ch); /* This is probably not right for NLS */
}
/* IsCharAlphanumeric USER 434 */
/***********************************************************************
* IsCharAlphanumeric (USER.434)
*/
BOOL16 WINAPI IsCharAlphaNumeric16(CHAR ch)
{
return isalnum(ch);
}
/* IsCharUpper USER 435 */
/***********************************************************************
* IsCharUpper (USER.435)
*/
BOOL16 WINAPI IsCharUpper16(CHAR ch)
{
return isupper(ch);
}
/* IsCharLower USER 436 */
/***********************************************************************
* IsCharLower (USER.436)
*/
BOOL16 WINAPI IsCharLower16(CHAR ch)
{
return islower(ch);
@ -64,7 +74,7 @@ SEGPTR WINAPI AnsiUpper16( SEGPTR strOrChar )
for (s = PTR_SEG_TO_LIN(strOrChar); *s; s++) *s = toupper(*s);
return strOrChar;
}
else return (SEGPTR)ToUpper( (int)strOrChar );
else return toupper((char)strOrChar);
}
@ -93,7 +103,7 @@ SEGPTR WINAPI AnsiLower16( SEGPTR strOrChar )
for (s = PTR_SEG_TO_LIN( strOrChar ); *s; s++) *s = tolower( *s );
return strOrChar;
}
else return (SEGPTR)tolower( (int)strOrChar );
else return tolower((char)strOrChar);
}
@ -274,7 +284,7 @@ LPSTR WINAPI CharLower32A(LPSTR x)
}
return x;
}
else return (LPSTR)tolower(LOWORD(x));
else return (LPSTR)tolower((char)(int)x);
}
/***********************************************************************
@ -285,6 +295,7 @@ DWORD WINAPI CharLowerBuff32A(LPSTR x,DWORD buflen)
{
DWORD done=0;
if (!x) return 0; /* YES */
while (*x && (buflen--))
{
*x=tolower(*x);
@ -302,9 +313,10 @@ DWORD WINAPI CharLowerBuff32W(LPWSTR x,DWORD buflen)
{
DWORD done=0;
if (!x) return 0; /* YES */
while (*x && (buflen--))
{
*x=tolower(*x);
*x=towlower(*x);
x++;
done++;
}
@ -322,12 +334,12 @@ LPWSTR WINAPI CharLower32W(LPWSTR x)
LPWSTR s = x;
while (*s)
{
*s=tolower(*s);
*s=towlower(*s);
s++;
}
return x;
}
else return (LPWSTR)tolower(LOWORD(x));
else return (LPWSTR)towlower(LOWORD(x));
}
/***********************************************************************
@ -346,7 +358,7 @@ LPSTR WINAPI CharUpper32A(LPSTR x)
}
return x;
}
else return (LPSTR)toupper(LOWORD(x));
return (LPSTR)toupper((char)(int)x);
}
/***********************************************************************
@ -357,6 +369,7 @@ DWORD WINAPI CharUpperBuff32A(LPSTR x,DWORD buflen)
{
DWORD done=0;
if (!x) return 0; /* YES */
while (*x && (buflen--))
{
*x=toupper(*x);
@ -374,9 +387,10 @@ DWORD WINAPI CharUpperBuff32W(LPWSTR x,DWORD buflen)
{
DWORD done=0;
if (!x) return 0; /* YES */
while (*x && (buflen--))
{
*x=toupper(*x);
*x=towupper(*x);
x++;
done++;
}
@ -394,12 +408,12 @@ LPWSTR WINAPI CharUpper32W(LPWSTR x)
LPWSTR s = x;
while (*s)
{
*s=toupper(*s);
*s=towupper(*s);
s++;
}
return x;
}
else return (LPWSTR)toupper(LOWORD(x));
else return (LPWSTR)towupper(LOWORD(x));
}
/***********************************************************************
@ -426,7 +440,7 @@ BOOL32 WINAPI IsCharAlphaNumeric32A(CHAR x)
*/
BOOL32 WINAPI IsCharAlphaNumeric32W(WCHAR x)
{
return isalnum(x);
return iswalnum(x);
}
/***********************************************************************
@ -435,7 +449,7 @@ BOOL32 WINAPI IsCharAlphaNumeric32W(WCHAR x)
*/
BOOL32 WINAPI IsCharAlpha32W(WCHAR x)
{
return isalpha(x);
return iswalpha(x);
}
/***********************************************************************
@ -453,7 +467,7 @@ BOOL32 WINAPI IsCharLower32A(CHAR x)
*/
BOOL32 WINAPI IsCharLower32W(WCHAR x)
{
return islower(x);
return iswlower(x);
}
/***********************************************************************
@ -471,7 +485,7 @@ BOOL32 WINAPI IsCharUpper32A(CHAR x)
*/
BOOL32 WINAPI IsCharUpper32W(WCHAR x)
{
return isupper(x);
return iswupper(x);
}
/***********************************************************************

View File

@ -18,12 +18,12 @@
#include <X11/Xutil.h>
#include <X11/Xlocale.h>
#include <X11/cursorfont.h>
#include "winsock.h"
#include "heap.h"
#include "message.h"
#include "msdos.h"
#include "windows.h"
#include "color.h"
#include "winsock.h"
#include "options.h"
#include "desktop.h"
#include "process.h"

View File

@ -156,7 +156,7 @@ int WINAPI WNetUnlockQueueData(LPSTR szQueue)
/**************************************************************************
* WNetGetConnection [USER.512]
*/
int WINAPI WNetGetConnection16(LPSTR lpLocalName,
int WINAPI WNetGetConnection16(LPCSTR lpLocalName,
LPSTR lpRemoteName, UINT16 *cbRemoteName)
{
const char *path;

View File

@ -49,3 +49,11 @@ void *memmove( void *dest, const void *src, unsigned int len )
return dest;
}
#endif /* HAVE_MEMMOVE */
#ifndef HAVE_STRERROR
const char *strerror( int err )
{
/* Let's hope we have sys_errlist then */
return sys_errlist[err];
}
#endif /* HAVE_STRERROR */

View File

@ -89,6 +89,14 @@ LONG WINAPI DocumentProperties32A(HWND32 hWnd,HANDLE32 hPrinter,
return 1;
}
BOOL32 WINAPI OpenPrinter32A(LPSTR lpPrinterName,HANDLE32 *phPrinter,
LPPRINTER_DEFAULTS32A pDefault)
{
fprintf(stderr,"OpenPrinter32A(%s,%p,%p), stub\n",
lpPrinterName, phPrinter, pDefault);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
BOOL32 WINAPI EnumPrinters32A(DWORD dwType, LPSTR lpszName,
DWORD dwLevel, LPBYTE lpbPrinters,
DWORD cbBuf, LPDWORD lpdwNeeded,

View File

@ -8,6 +8,7 @@
#include <unistd.h>
#include <ctype.h>
#include "windows.h"
#include "winerror.h"
#include "file.h"
#include "shell.h"
#include "heap.h"
@ -125,6 +126,7 @@ static const char * const SHELL_People[] =
"William Smith",
"Dominik Strasser",
"Vadim Strizhevsky",
"Bertho Stultiens",
"Erik Svendsen",
"Tristan Tarrant",
"Andrew Taylor",
@ -181,9 +183,6 @@ typedef struct
#pragma pack(4)
extern HICON16 WINAPI LoadIconHandler( HGLOBAL16 hResource, BOOL16 bNew );
extern WORD WINAPI GetIconID( HGLOBAL16 hResource, DWORD resType );
static const char* lpstrMsgWndCreated = "OTHERWINDOWCREATED";
static const char* lpstrMsgWndDestroyed = "OTHERWINDOWDESTROYED";
static const char* lpstrMsgShellActivate = "ACTIVATESHELLWINDOW";
@ -754,6 +753,29 @@ BOOL32 WINAPI ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
return ret;
}
/*************************************************************************
* Shell_NotifyIcon [SHELL32.249]
* FIXME
* This function is supposed to deal with the systray.
* Any ideas on how this is to be implimented?
*/
BOOL32 WINAPI Shell_NotifyIcon( DWORD dwMessage,
PNOTIFYICONDATA pnid )
{
return FALSE;
}
/*************************************************************************
* Shell_NotifyIcon [SHELL32.240]
* FIXME
* This function is supposed to deal with the systray.
* Any ideas on how this is to be implimented?
*/
BOOL32 WINAPI Shell_NotifyIconA(DWORD dwMessage,
PNOTIFYICONDATA pnid )
{
return FALSE;
}
/*************************************************************************
* SHELL_GetResourceTable
@ -1048,7 +1070,7 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
_lclose32( hFile);
return 0;
}
icongroupresdir = GetResDirEntryW(rootresdir,(LPWSTR)RT_GROUP_ICON,(DWORD)rootresdir);
icongroupresdir = GetResDirEntryW(rootresdir,(LPWSTR)RT_GROUP_ICON,(DWORD)rootresdir,FALSE);
if (!icongroupresdir) {
fprintf(stderr,"InternalExtractIcon: No Icongroupresourcedirectory!\n");
UnmapViewOfFile(peimage);
@ -1094,7 +1116,7 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
/* go down this resource entry, name */
resdir = (LPIMAGE_RESOURCE_DIRECTORY)((DWORD)rootresdir+(xresent->u2.s.OffsetToDirectory));
/* default language (0) */
resdir = GetResDirEntryW(resdir,(LPWSTR)0,(DWORD)rootresdir);
resdir = GetResDirEntryW(resdir,(LPWSTR)0,(DWORD)rootresdir,TRUE);
igdataent = (LPIMAGE_RESOURCE_DATA_ENTRY)resdir;
/* lookup address in mapped image for virtual address */
@ -1116,13 +1138,9 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
/* found */
cid = (CURSORICONDIR*)igdata;
cids[i] = cid;
fprintf(stderr,"cursoricondir %d: idType %d, idCount %d\n",
i,cid->idType,cid->idCount
);
RetPtr[i] = LookupIconIdFromDirectoryEx32(igdata,TRUE,SYSMETRICS_CXICON,SYSMETRICS_CYICON,0);
fprintf(stderr,"-> best match is %08x\n",RetPtr[i]);
}
iconresdir=GetResDirEntryW(rootresdir,(LPWSTR)RT_ICON,(DWORD)rootresdir);
iconresdir=GetResDirEntryW(rootresdir,(LPWSTR)RT_ICON,(DWORD)rootresdir,FALSE);
if (!iconresdir) {
fprintf(stderr,"InternalExtractIcon: No Iconresourcedirectory!\n");
UnmapViewOfFile(peimage);
@ -1133,8 +1151,8 @@ HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16 hInstance,
for (i=0;i<n;i++) {
LPIMAGE_RESOURCE_DIRECTORY xresdir;
xresdir = GetResDirEntryW(iconresdir,(LPWSTR)RetPtr[i],(DWORD)rootresdir);
xresdir = GetResDirEntryW(xresdir,(LPWSTR)0,(DWORD)rootresdir);
xresdir = GetResDirEntryW(iconresdir,(LPWSTR)RetPtr[i],(DWORD)rootresdir,FALSE);
xresdir = GetResDirEntryW(xresdir,(LPWSTR)0,(DWORD)rootresdir,TRUE);
idataent = (LPIMAGE_RESOURCE_DATA_ENTRY)xresdir;
@ -1214,6 +1232,12 @@ HICON32 WINAPI ExtractIcon32W( HINSTANCE32 hInstance, LPCWSTR lpszExeFileName,
* Return icon for given file (either from file itself or from associated
* executable) and patch parameters if needed.
*/
HICON32 WINAPI ExtractAssociatedIcon32A(HINSTANCE32 hInst,LPSTR lpIconPath,
LPWORD lpiIcon)
{
return ExtractAssociatedIcon16(hInst,lpIconPath,lpiIcon);
}
HICON16 WINAPI ExtractAssociatedIcon16(HINSTANCE16 hInst,LPSTR lpIconPath,
LPWORD lpiIcon)
{
@ -1541,26 +1565,101 @@ void WINAPI FreeIconList( DWORD dw )
*
* http://premium.microsoft.com/msdn/library/sdkdoc/api2_48fo.htm
*/
/* This is the wrong place, but where is the right one? */
#if 0
#define E_OUTOFMEMORY 0x8007000EL
HRESULT32 WINAPI SHELL32_DllGetClassObject (REFCLSID32 clsid,
REFIID32 riid,
LPVOID *ppv)
DWORD WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid,REFIID iid,LPVOID *ppv)
{
HRESULT32 hres = E_OUTOFMEMORY;
*ppv = NULL;
char xclsid[50],xiid[50];
HRESULT hres = E_OUTOFMEMORY;
fprintf (stdnimp, "SHELL32_DllGetClassObject (0x%x,0x%x,%p) -- STUB\n",
clsid, riid, ppv);
return hres;
}
#endif
StringFromCLSID((LPCLSID)rclsid,xclsid);
StringFromCLSID((LPCLSID)iid,xiid);
fprintf(stderr,"SHELL32_DllGetClassObject(%s,%s,%p)\n",xclsid,xiid,ppv);
DWORD WINAPI SHGetDesktopFolder(LPSHELLFOLDER *shellfolder) {
*shellfolder = NULL;
*ppv = NULL;
/* SDK example code looks like this:
*
HRESULT hres = E_OUTOFMEMORY;
*ppv = NULL;
CClassFactory *pClassFactory = new CClassFactory(rclsid);
if (pClassFactory) {
hRes = pClassFactory->QueryInterface(riid,ppv);
pClassFactory->Release();
}
return hRes;
*
* The magic of the whole stuff is still unclear to me, so just hack together
* something.
*/
if (!memcmp(rclsid,&CLSID_ShellDesktop,sizeof(CLSID_ShellDesktop))) {
fprintf(stderr," requested CLSID_ShellDesktop, creating it.\n");
*ppv = IShellFolder_Constructor();
/* FIXME: Initialize this folder to be the shell desktop folder */
return 0;
}
fprintf (stdnimp, " -> clsid not found. returning E_OUTOFMEMORY.\n");
return hres;
}
/*************************************************************************
* SHGetDesktopFolder [SHELL32.216]
* returns the interface to the shell desktop folder.
*
* [SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
* CLSID_ShellDesktop.
*
* CoCreateInstance(CLSID_Desktop, NULL,
* CLSCTX_INPROC, IID_IShellFolder, &pshf);
* ]
* So what we are doing is currently wrong....
*/
DWORD WINAPI SHGetDesktopFolder(LPSHELLFOLDER *shellfolder) {
*shellfolder = IShellFolder_Constructor();
return NOERROR;
}
/*************************************************************************
* SHGetMalloc [SHELL32.220]
* returns the interface to shell malloc.
*
* [SDK header win95/shlobj.h:
* equivalent to: #define SHGetMalloc(ppmem) CoGetMalloc(MEMCTX_TASK, ppmem)
* ]
* What we are currently doing is not very wrong, since we always use the same
* heap (ProcessHeap).
*/
DWORD WINAPI SHGetMalloc(LPMALLOC *lpmal) {
fprintf(stderr,"SHGetMalloc()\n");
*lpmal = IMalloc_Constructor();
return NOERROR;
}
/*************************************************************************
* SHGetSpecialFolderLocation [SHELL32.223]
* returns the PIDL of a special folder
*
* nFolder is a CSIDL_xxxxx.
*/
HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITEMIDLIST * ppidl) {
fprintf(stderr,"SHGetSpecialFolderLocation(%04x,%d,%p),stub!\n",
hwndOwner,nFolder,ppidl
);
*ppidl = (LPITEMIDLIST)HeapAlloc(GetProcessHeap(),0,2*sizeof(ITEMIDLIST));
/* FIXME: we return only the empty ITEMIDLIST currently. */
(*ppidl)->mkid.cb = 0;
return NOERROR;
}
/*************************************************************************
* SHGetPathFromIDList [SHELL32.221]
* returns the path from a passed PIDL.
*/
BOOL32 WINAPI SHGetPathFromIDList(LPCITEMIDLIST pidl,LPSTR pszPath) {
fprintf(stderr,"SHGetPathFromIDList(%p,%p),stub!\n",pidl,pszPath);
lstrcpy32A(pszPath,"E:\\"); /* FIXME */
return NOERROR;
}

View File

@ -31,6 +31,81 @@
#include "debug.h"
#include "winreg.h"
/*************************************************************************
* SHELL32_2 [SHELL32.2]
*/
DWORD WINAPI SHELL32_2(HWND32 hwnd,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
fprintf(stderr,"SHELL32_2(0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",
hwnd,x2,x3,x4,x5,x6
);
return 0;
}
/*************************************************************************
* SHELL32_16 [SHELL32.16]
* find_lastitem_in_itemidlist()
*/
LPSHITEMID WINAPI SHELL32_16(LPITEMIDLIST iil) {
LPSHITEMID lastsii,sii;
if (!iil)
return NULL;
sii = &(iil->mkid);
lastsii = sii;
while (sii->cb) {
lastsii = sii;
sii = (LPSHITEMID)(((char*)sii)+sii->cb);
}
return lastsii;
}
/*************************************************************************
* SHELL32_29 [SHELL32.29]
* is_rootdir(const char*path)
*/
BOOL32 WINAPI SHELL32_29(LPCSTR x) {
if (!lstrcmp32A(x+1,":\\")) /* "X:\" */
return 1;
if (!lstrcmp32A(x,"\\")) /* "\" */
return 1;
if (x[0]=='\\' && x[1]=='\\') { /* UNC "\\<xx>\" */
int foundbackslash = 0;
x=x+2;
while (*x) {
if (*x++=='\\')
foundbackslash++;
}
if (foundbackslash<=1) /* max 1 \ more ... */
return 1;
}
return 0;
}
/*************************************************************************
* SHELL32_30 [SHELL32.30]
* get_rootdir(char*path,int drive)
*/
DWORD WINAPI SHELL32_30(LPSTR root,BYTE drive) {
strcpy(root,"A:\\");
root[0]+=drive;
return root;
}
/*************************************************************************
* SHELL32_31 [SHELL32.31]
* returns pointer to last . in last pathcomponent or at \0.
*/
LPSTR WINAPI SHELL32_31(LPSTR path) {
LPSTR lastpoint = NULL;
while (*path) {
if (*path=='\\'||*path==' ')
lastpoint=NULL;
if (*path=='.')
lastpoint=path;
path++;
}
return lastpoint?lastpoint:path;
}
/*************************************************************************
* SHELL32_32 [SHELL32.32]
* append \ if there is none
@ -47,6 +122,27 @@ LPSTR WINAPI SHELL32_32(LPSTR path) {
return path+len;
}
/*************************************************************************
* SHELL32_33 [SHELL32.33]
* remove spaces from beginning and end of passed string
*/
LPSTR WINAPI SHELL32_33(LPSTR str) {
LPSTR x = str;
while (*x==' ') x++;
if (x!=str)
lstrcpy32A(str,x);
if (!*str)
return str;
x=str+strlen(str)-1;
while (*x==' ')
x--;
if (*x==' ')
*x='\0';
return x;
}
/*************************************************************************
* SHELL32_34 [SHELL32.34]
* basename(char *fn);
@ -134,6 +230,27 @@ LPSTR WINAPI SHELL32_36(LPSTR x1,LPSTR x2) {
return SHELL32_37(x1,x1,x2);
}
/*************************************************************************
* SHELL32_39 [SHELL32.39]
* isUNC(const char*path);
*/
BOOL32 WINAPI SHELL32_39(LPCSTR path) {
if ((path[0]=='\\') && (path[1]=='\\'))
return TRUE;
return FALSE;
}
/*************************************************************************
* SHELL32_45 [SHELL32.45]
* file_exists(char *fn);
*/
BOOL32 WINAPI SHELL32_45(LPSTR fn) {
if (GetFileAttributes32A(fn)==-1)
return FALSE;
else
return TRUE;
}
/*************************************************************************
* SHELL32_52 [SHELL32.52]
* look for next arg in string. handle "quoted" strings
@ -153,14 +270,95 @@ LPSTR WINAPI SHELL32_52(LPSTR cmdline) {
}
/*************************************************************************
* SHELL32_45 [SHELL32.45]
* file_exists(char *fn);
* SHELL32_56 [SHELL32.56]
* unquote string (remove ")
*/
BOOL32 WINAPI SHELL32_45(LPSTR fn) {
if (GetFileAttributes32A(fn)==-1)
return FALSE;
else
return TRUE;
VOID WINAPI SHELL32_56(LPSTR str) {
DWORD len = lstrlen32A(str);
if (*str!='"') return;
if (str[len-1]!='"') return;
str[len-1]='\0';
lstrcpy32A(str,str+1);
return;
}
/*************************************************************************
* SHELL32_58 [SHELL32.58]
*/
DWORD WINAPI SHELL32_58(LPCSTR src,DWORD x2,LPSTR target,DWORD pathlen) {
fprintf(stderr,"SHELL32_58(%s,0x%08lx,%p,%ld),STUB!\n",
src,x2,target,pathlen
);
if (!src)
return 0;
return 0;
}
/*************************************************************************
* SHELL32_62 [SHELL32.62]
*/
DWORD WINAPI SHELL32_62(DWORD x,DWORD y,DWORD z,DWORD a) {
fprintf(stderr,"SHELL32_62(%08lx,%08lx,%08lx,%08lx),stub!\n",x,y,z,a);
return 0xffffffff;
}
/*************************************************************************
* SHELL32_63 [SHELL32.63]
*/
DWORD WINAPI SHELL32_63(HWND32 howner, LPSTR targetbuf, DWORD len, DWORD x, LPCSTR suffix, LPCSTR y, LPCSTR cmd) {
fprintf(stderr,"SHELL32_63(%04x,%p,%ld,%08lx,%s,%s,%s),stub!\n",
howner,targetbuf,len,x,suffix,y,cmd
);
/* puts up a Open Dialog and requests input into targetbuf */
/* OFN_HIDEREADONLY|OFN_NOCHANGEDIR|OFN_FILEMUSTEXIST|OFN_unknown */
lstrcpy32A(targetbuf,"x:\\s3.exe");
return 1;
}
/*************************************************************************
* SHELL32_68 [SHELL32.68]
*/
DWORD WINAPI SHELL32_68(DWORD x,DWORD y,DWORD z) {
fprintf(stderr,"SHELL32_68(0x%08lx,0x%08lx,0x%08lx),stub!\n",
x,y,z
);
return 0;
}
/*************************************************************************
* SHELL32_71 [SHELL32.71]
* returns internal shell values in the passed pointers
*/
BOOL32 WINAPI SHELL32_71(LPDWORD x,LPDWORD y) {
fprintf(stderr,"SHELL32_71(%p,%p),stub!\n",x,y);
return TRUE;
}
/*************************************************************************
* SHELL32_72 [SHELL32.72]
* dunno. something with icons
*/
void WINAPI SHELL32_72(LPSTR x,DWORD y,DWORD z) {
fprintf(stderr,"SHELL32_72(%s,%08lx,%08lx),stub!\n",x,y,z);
}
/*************************************************************************
* SHELL32_89 [SHELL32.89]
*/
DWORD WINAPI SHELL32_89(DWORD x1,DWORD x2,DWORD x3) {
fprintf(stderr,"SHELL32_89(0x%08lx,0x%08lx,0x%08lx),stub!\n",
x1,x2,x3
);
return 0;
}
/*************************************************************************
* SHELL32_119 [SHELL32.119]
* unknown
*/
void WINAPI SHELL32_119(LPVOID x) {
fprintf(stderr,"SHELL32_119(%p(%s)),stub\n",x,(char *)x);
}
/*************************************************************************
@ -181,14 +379,6 @@ void WINAPI SHELL32_181(DWORD x,DWORD y) {
fprintf(stderr,"SHELL32_181(0x%08lx,0x%08lx)\n",x,y);
}
/*************************************************************************
* SHELL32_119 [SHELL32.119]
* unknown
*/
void WINAPI SHELL32_119(LPVOID x) {
fprintf(stderr,"SHELL32_119(%p),stub\n",x);
}
/*************************************************************************
* SHELL32_75 [SHELL32.75]
* unknown
@ -198,16 +388,26 @@ BOOL32 WINAPI SHELL32_75(LPDWORD x,LPDWORD y) {
return TRUE;
}
DWORD WINAPI
SHELL32_DllGetClassObject(REFCLSID *clsid,REFIID *iid,LPVOID *x) {
char xclsid[50],xiid[50];
StringFromCLSID((LPCLSID)clsid,xclsid);
StringFromCLSID((LPCLSID)iid,xiid);
fprintf(stderr,"SHELL32_DllGetClassObject(%s,%s,%p), STUB\n",xclsid,xiid,x);
/*************************************************************************
* SHELL32_77 [SHELL32.77]
*/
DWORD WINAPI SHELL32_77(DWORD x,DWORD y,DWORD z) {
fprintf(stderr,"SHELL32_77(%08lx,%08lx,%08lx),stub!\n",x,y,z);
return 0;
}
/*************************************************************************
* SHELL32_79 [SHELL32.79]
* create_directory_and_notify(...)
*/
DWORD WINAPI SHELL32_79(LPCSTR dir,LPVOID xvoid) {
fprintf(stderr,"mkdir %s,%p\n",dir,xvoid);
if (!CreateDirectory32A(dir,xvoid))
return FALSE;
/* SHChangeNotify(8,1,dir,0); */
return TRUE;
}
static FARPROC32 _find_moduleproc(LPSTR dllname,HMODULE32 *xhmod,LPSTR name) {
HMODULE32 hmod;
FARPROC32 dllunload,nameproc;
@ -236,18 +436,26 @@ static DWORD _get_instance(REFCLSID clsid,LPSTR dllname,
) {
DWORD WINAPI (*dllgetclassob)(REFCLSID,REFIID,LPVOID);
DWORD hres;
/*
LPCLASSFACTORY classfac;
*/
dllgetclassob = (DWORD(*)(REFCLSID,REFIID,LPVOID))_find_moduleproc(dllname,NULL,"DllGetClassObject");
if (!dllgetclassob)
return 0x80070000|GetLastError();
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,&classfac);
/* FIXME */
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,inst);
if (hres<0)
return hres;
/*
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,&classfac);
if (hres<0)
return hres;
classfac->lpvtbl->fnCreateInstance(classfac,unknownouter,refiid,inst);
classfac->lpvtbl->fnRelease(classfac);
*/
return 0;
}
/*************************************************************************
@ -320,24 +528,6 @@ void __cdecl SHELL32_183(HMODULE32 hmod,HWND32 hwnd,DWORD id,DWORD x,DWORD type,
}
/*************************************************************************
* SHELL32_71 [SHELL32.71]
* returns internal shell values in the passed pointers
*/
BOOL32 WINAPI SHELL32_71(LPDWORD x,LPDWORD y) {
fprintf(stderr,"SHELL32_71(%p,%p),stub!\n",x,y);
return TRUE;
}
/*************************************************************************
* SHELL32_72 [SHELL32.72]
* dunno. something with icons
*/
void WINAPI SHELL32_72(LPSTR x,DWORD y,DWORD z) {
fprintf(stderr,"SHELL32_72(%s,%08lx,%08lx),stub!\n",x,y,z);
}
/*************************************************************************
* SHELL32_100 [SHELL32.100]
* walks through policy table, queries <app> key, <type> value, returns
@ -375,56 +565,6 @@ DWORD WINAPI SHELL32_100(DWORD pol) {
}
DWORD WINAPI SHELL32_77(DWORD x,DWORD y,DWORD z) {
fprintf(stderr,"SHELL32_77(%08lx,%08lx,%08lx),stub!\n",x,y,z);
return 0;
}
/*************************************************************************
* SHELL32_79 [SHELL32.79]
* create_directory_and_notify(...)
*/
DWORD WINAPI SHELL32_79(LPCSTR dir,LPVOID xvoid) {
fprintf(stderr,"mkdir %s,%p\n",dir,xvoid);
if (!CreateDirectory32A(dir,xvoid))
return FALSE;
/* SHChangeNotify(8,1,dir,0); */
return TRUE;
}
/*************************************************************************
* SHELL32_165 [SHELL32.165]
* create_path_and_notify(...)
*/
DWORD WINAPI SHELL32_165(DWORD x,LPCSTR path) {
if (SHELL32_79(path,(LPVOID)x))
return 0;
fprintf(stderr,"SHELL32_165(%08lx,%s),stub!\n",x,path);
return 0;
}
/*************************************************************************
* SHELL32_29 [SHELL32.29]
* is_rootdir(const char*path)
*/
BOOL32 WINAPI SHELL32_29(LPCSTR x) {
if (!lstrcmp32A(x+1,":\\")) /* "X:\" */
return 1;
if (!lstrcmp32A(x,"\\")) /* "\" */
return 1;
if (x[0]=='\\' && x[1]=='\\') { /* UNC "\\<xx>\" */
int foundbackslash = 0;
x=x+2;
while (*x) {
if (*x++=='\\')
foundbackslash++;
}
if (foundbackslash<=1) /* max 1 \ more ... */
return 1;
}
return 0;
}
/*************************************************************************
* SHELL32_152 [SHELL32.152]
* itemlist_length
@ -442,6 +582,34 @@ DWORD WINAPI SHELL32_152(LPITEMIDLIST iil) {
return len;
}
/*************************************************************************
* SHELL32_158 [SHELL32.158]
*/
LPSTR WINAPI SHELL32_158(LPSTR path,DWORD y,DWORD z) {
fprintf(stderr,"SHELL32_158(%s,%08lx,%08lx)\n",path,y,z);
path = SHELL32_31(path);
return *path?(path+1):path;
}
/*************************************************************************
* SHELL32_165 [SHELL32.165]
* create_path_and_notify(...)
*/
DWORD WINAPI SHELL32_165(DWORD x,LPCSTR path) {
if (SHELL32_79(path,(LPVOID)x))
return 0;
fprintf(stderr,"SHELL32_165(%08lx,%s),stub!\n",x,path);
return 0;
}
/*************************************************************************
* SHELL32_195 [SHELL32.195]
* free_ptr() - frees memory using IMalloc
*/
DWORD WINAPI SHELL32_195(LPVOID x) {
return LocalFree32((HANDLE32)x);
}
/*************************************************************************
* SHELL32_196 [SHELL32.196]
* void *task_alloc(DWORD len), uses SHMalloc allocator
@ -480,32 +648,6 @@ LPITEMIDLIST WINAPI SHELL32_25(LPITEMIDLIST iil1,LPITEMIDLIST iil2) {
return newiil;
}
/*************************************************************************
* SHELL32_16 [SHELL32.16]
* find_lastitem_in_itemidlist()
*/
LPSHITEMID WINAPI SHELL32_16(LPITEMIDLIST iil) {
LPSHITEMID lastsii,sii;
if (!iil)
return NULL;
sii = &(iil->mkid);
lastsii = sii;
while (sii->cb) {
lastsii = sii;
sii = (LPSHITEMID)(((char*)sii)+sii->cb);
}
return lastsii;
}
/*************************************************************************
* SHELL32_195 [SHELL32.195]
* free_ptr() - frees memory using IMalloc
*/
DWORD WINAPI SHELL32_195(LPVOID x) {
return LocalFree32((HANDLE32)x);
}
/*************************************************************************
* SHELL32_155 [SHELL32.155]
* free_check_ptr - frees memory (if not NULL) allocated by SHMalloc allocator
@ -515,11 +657,3 @@ DWORD WINAPI SHELL32_155(LPVOID x) {
return 0;
return SHELL32_195(x);
}
/*************************************************************************
* SHELL32_62 [SHELL32.62]
*/
DWORD WINAPI SHELL32_62(DWORD x,DWORD y,DWORD z,DWORD a) {
fprintf(stderr,"SHELL32_62(%08lx,%08lx,%08lx,%08lx),stub!\n",x,y,z,a);
return 0xffffffff;
}

View File

@ -70,3 +70,18 @@ BOOL16 WINAPI NotifyUnregister( HTASK16 htask )
nrofnotifys--;
return TRUE;
}
BOOL16 WINAPI StackTraceCSIPFirst(STACKTRACEENTRY *ste, WORD wSS, WORD wCS, WORD wIP, WORD wBP)
{
return TRUE;
}
BOOL16 WINAPI StackTraceFirst(STACKTRACEENTRY *ste, HTASK16 Task)
{
return TRUE;
}
BOOL16 WINAPI StackTraceNext(STACKTRACEENTRY *ste)
{
return TRUE;
}

View File

@ -310,10 +310,6 @@ static int find_ne_resource(
}
}
extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(
LPIMAGE_RESOURCE_DIRECTORY resdirptr,LPCWSTR name,DWORD root
);
/* Loads the specified PE resource.
* FIXME: shouldn't load the whole image
*/
@ -368,20 +364,20 @@ find_pe_resource(
continue;
}
resourcedir = (LPIMAGE_RESOURCE_DIRECTORY)(image+resdir.VirtualAddress);
xresdir = GetResDirEntryW(resourcedir,typeid,(DWORD)resourcedir);
xresdir = GetResDirEntryW(resourcedir,typeid,(DWORD)resourcedir,FALSE);
if (!xresdir) {
dprintf_ver(stddeb,"...no typeid entry found for %p\n",typeid);
HeapFree(GetProcessHeap(),0,image);
return 0;
}
xresdir = GetResDirEntryW(xresdir,resid,(DWORD)resourcedir);
xresdir = GetResDirEntryW(xresdir,resid,(DWORD)resourcedir,FALSE);
if (!xresdir) {
dprintf_ver(stddeb,"...no resid entry found for %p\n",resid);
HeapFree(GetProcessHeap(),0,image);
return 0;
}
xresdir = GetResDirEntryW(xresdir,0,(DWORD)resourcedir);
xresdir = GetResDirEntryW(xresdir,0,(DWORD)resourcedir,TRUE);
if (!xresdir) {
dprintf_ver(stddeb,"...no 0 (default language) entry found for %p\n",resid);
HeapFree(GetProcessHeap(),0,image);
@ -1181,7 +1177,8 @@ _find_dataA(BYTE *block,LPCSTR str, int buff_remain) {
nextslash++;
if (!*nextslash)
nextslash=NULL;
}
} else if (*str == 0)
return NULL;
while (1) {
@ -1208,7 +1205,7 @@ _find_dataA(BYTE *block,LPCSTR str, int buff_remain) {
}
/* this one used for Win32 resources, which are always in UNICODE format */
extern LPWSTR CRTDLL_wcschr(LPCWSTR str,WCHAR xchar);
extern LPWSTR __cdecl CRTDLL_wcschr(LPCWSTR str,WCHAR xchar);
static BYTE*
_find_dataW(BYTE *block,LPCWSTR str, int buff_remain) {
LPWSTR nextslash;
@ -1227,7 +1224,8 @@ _find_dataW(BYTE *block,LPCWSTR str, int buff_remain) {
nextslash++;
if (!*nextslash)
nextslash=NULL;
}
} else if (*str == 0)
return NULL;
while (1) {
@ -1298,6 +1296,7 @@ DWORD WINAPI VerQueryValue16(SEGPTR segblock,LPCSTR subblock,SEGPTR *buffer,
if (!b) {
fprintf(stderr,"key %s not found in versionresource.\n",s);
*buflen=0;
free (s);
return 0;
}
db=(struct dbW*)b;
@ -1315,6 +1314,7 @@ DWORD WINAPI VerQueryValue16(SEGPTR segblock,LPCSTR subblock,SEGPTR *buffer,
if (!b) {
fprintf(stderr,"key %s not found in versionresource.\n",s);
*buflen=0;
free (s);
return 0;
}
db=(struct dbA*)b;
@ -1358,6 +1358,7 @@ DWORD WINAPI VerQueryValue32A(LPVOID vblock,LPCSTR subblock,
if (!b) {
fprintf(stderr,"key %s not found in versionresource.\n",s);
*buflen=0;
free (s);
return 0;
}
db = (struct dbW*)b;
@ -1369,12 +1370,15 @@ DWORD WINAPI VerQueryValue32A(LPVOID vblock,LPCSTR subblock,
HeapFree(GetProcessHeap(),0,xs);
} else
dprintf_ver(stderr,"->%p\n",b);
/* This is a leak. */
b = HEAP_strdupWtoA(GetProcessHeap(),0,(WCHAR*)b);
} else {
struct dbA *db;
b=_find_dataA(block,s,*(WORD*)block);
if (!b) {
fprintf(stderr,"key %s not found in versionresource.\n",subblock);
*buflen=0;
free (s);
return 0;
}
db=(struct dbA*)b;

View File

@ -10,13 +10,14 @@
#include <stdlib.h>
#include "windows.h"
#include "module.h"
#include "ldt.h"
/***********************************************************************
* Get16DLLAddress (KERNEL32)
*
* rough guesswork, but seems to work
*/
FARPROC16 Get16DLLAddress(HMODULE32 handle, LPSTR name) {
FARPROC16 WINAPI Get16DLLAddress(HMODULE16 handle, LPSTR name) {
if (!handle) handle=GetModuleHandle16("WIN32S16");
return (FARPROC16)WIN32_GetProcAddress16(handle, name);
}

View File

@ -10,7 +10,7 @@
#include <stdlib.h>
#include <stdio.h>
LPSTR WINAPI GetWin32sDirectory()
LPSTR WINAPI GetWin32sDirectory(void)
{
static char *sysdir;
LPSTR text;
@ -24,7 +24,7 @@ LPSTR WINAPI GetWin32sDirectory()
}
/* FIXME */
SEGPTR WINAPI _GetThunkBuff()
SEGPTR WINAPI _GetThunkBuff(void)
{
return (SEGPTR)NULL;
}

16
misc/win32s16.c Normal file
View File

@ -0,0 +1,16 @@
/*
* WIN32S16
* DLL for Win32s
*
* Copyright (c) 1997 Andreas Mohr
*/
#include "windows.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
void BootTask()
{
fprintf(stderr, "BootTask(): should only be used by WIN32S.EXE.\n");
}

20
misc/windebug.c Normal file
View File

@ -0,0 +1,20 @@
/*
* WINDEBUG.DLL
*
* Copyright (c) 1997 Andreas Mohr
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "windows.h"
#include "module.h"
/***********************************************************************
* WinNotify (WINDEBUG.1)
* written without _any_ docu
*/
DWORD WinNotify() {
fprintf(stderr, "WinNotify(): stub !\n");
return NULL;
}

View File

@ -4,7 +4,6 @@
*
* (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
*
* TODO: 32-bit asynchronous services.
*/
#include <stdio.h>
@ -32,13 +31,13 @@
#include <netdb.h>
#include <unistd.h>
#include "winsock.h"
#include "windows.h"
#include "winnt.h"
#include "heap.h"
#include "ldt.h"
#include "task.h"
#include "message.h"
#include "winsock.h"
#include "miscemu.h"
#include "stddebug.h"
#include "debug.h"
@ -148,25 +147,31 @@ static ws_socket* wsi_alloc_socket(LPWSINFO pwsi, int fd)
return NULL;
}
static fd_set* fd_set_import( fd_set* fds, LPWSINFO pwsi, ws_fd_set* ws, int* highfd )
static fd_set* fd_set_import( fd_set* fds, LPWSINFO pwsi, void* wsfds, int* highfd, BOOL32 b32 )
{
/* translate Winsock fd set into local fd set */
if( ws )
if( wsfds )
{
int i;
ws_socket* pws;
#define wsfds16 ((ws_fd_set16*)wsfds)
#define wsfds32 ((ws_fd_set32*)wsfds)
ws_socket* pws;
int i, count;
FD_ZERO(fds);
for( i = 0; i < (ws->fd_count) ; i++ )
count = (b32) ? wsfds32->fd_count : wsfds16->fd_count;
for( i = 0; i < count; i++ )
{
pws = (ws_socket*)WS_HANDLE2PTR(ws->fd_array[i]);
if( _check_ws(pwsi, pws) )
{
if( pws->fd > *highfd ) *highfd = pws->fd;
FD_SET(pws->fd, fds);
}
pws = (b32) ? (ws_socket*)WS_HANDLE2PTR(wsfds32->fd_array[i])
: (ws_socket*)WS_HANDLE2PTR(wsfds16->fd_array[i]);
if( _check_ws(pwsi, pws) )
{
if( pws->fd > *highfd ) *highfd = pws->fd;
FD_SET(pws->fd, fds);
}
}
#undef wsfds32
#undef wsfds16
return fds;
}
return NULL;
@ -182,20 +187,23 @@ __inline__ static int sock_error_p(int s)
return optval != 0;
}
static int fd_set_export( LPWSINFO pwsi, fd_set* fds, fd_set* exceptfds, ws_fd_set* ws )
static int fd_set_export( LPWSINFO pwsi, fd_set* fds, fd_set* exceptfds, void* wsfds, BOOL32 b32 )
{
int num_err = 0;
/* translate local fd set into Winsock fd set, adding
* errors to exceptfds (only if app requested it) */
if( ws )
if( wsfds )
{
int i, j, count = ws->fd_count;
#define wsfds16 ((ws_fd_set16*)wsfds)
#define wsfds32 ((ws_fd_set32*)wsfds)
int i, j, count = (b32) ? wsfds32->fd_count : wsfds16->fd_count;
for( i = 0, j = 0; i < count; i++ )
{
ws_socket *pws = (ws_socket*)WS_HANDLE2PTR(ws->fd_array[i]);
ws_socket *pws = (b32) ? (ws_socket*)WS_HANDLE2PTR(wsfds32->fd_array[i])
: (ws_socket*)WS_HANDLE2PTR(wsfds16->fd_array[i]);
int fd = pws->fd;
if( _check_ws(pwsi, pws) && FD_ISSET(fd, fds) )
@ -206,11 +214,19 @@ static int fd_set_export( LPWSINFO pwsi, fd_set* fds, fd_set* exceptfds, ws_fd_s
num_err++;
}
else
ws->fd_array[j++] = ws->fd_array[i];
if( b32 )
wsfds32->fd_array[j++] = wsfds32->fd_array[i];
else
wsfds16->fd_array[j++] = wsfds16->fd_array[i];
}
}
ws->fd_count = j;
if( b32 ) wsfds32->fd_count = j;
else wsfds16->fd_count = j;
dprintf_winsock(stddeb, "\n");
#undef wsfds32
#undef wsfds16
}
return num_err;
}
@ -386,7 +402,7 @@ INT32 WINSOCK_DeleteTaskWSI( TDB* pTask, LPWSINFO pwsi )
if( pwsi->sock[i].psop )
{
n++;
WSAAsyncSelect( (SOCKET16)WS_PTR2HANDLE(pwsi->sock + i), 0, 0, 0 );
WSAAsyncSelect32( (SOCKET16)WS_PTR2HANDLE(pwsi->sock + i), 0, 0, 0 );
}
close(pwsi->sock[i].fd); j++;
}
@ -504,8 +520,8 @@ SOCKET32 WINAPI WINSOCK_accept32(SOCKET32 s, struct sockaddr *addr,
EVENT_AddIO( pws->fd, EVENT_IO_READ ); /* reenabler */
/* async select the accept()'ed socket */
WSAAsyncSelect( s, pws->psop->hWnd, pws->psop->uMsg,
pws->flags & ~WS_FD_ACCEPT );
WSAAsyncSelect32( s, pws->psop->hWnd, pws->psop->uMsg,
pws->flags & ~WS_FD_ACCEPT );
}
return s;
}
@ -538,13 +554,13 @@ INT32 WINAPI WINSOCK_bind32(SOCKET32 s, struct sockaddr *name, INT32 namelen)
dprintf_winsock(stddeb, "WS_BIND(%08x): socket %04x, ptr %8x, length %d\n",
(unsigned)pwsi, s, (int) name, namelen);
#if DEBUG_SOCKADDR
/* #if DEBUG_SOCKADDR */
dump_sockaddr(name);
#endif
/* #endif */
if ( _check_ws(pwsi, pws) )
if ( namelen >= sizeof(*name) )
if ( ((struct sockaddr_in *)name)->sin_family == AF_INET )
if ( ((struct ws_sockaddr_in *)name)->sin_family == AF_INET )
if ( bind(pws->fd, name, namelen) < 0 )
{
int loc_errno = errno;
@ -585,7 +601,7 @@ INT32 WINAPI WINSOCK_closesocket32(SOCKET32 s)
{
int fd = pws->fd;
if( pws->psop ) WSAAsyncSelect( s, 0, 0, 0 );
if( pws->psop ) WSAAsyncSelect32( s, 0, 0, 0 );
pws->fd = -1;
pws->flags = (unsigned)pwsi->last_free;
@ -789,7 +805,7 @@ u_long WINAPI WINSOCK_htonl(u_long hostlong) { return( htonl(hostlong) ); }
*/
u_short WINAPI WINSOCK_htons(u_short hostshort) { return( htons(hostshort) ); }
/***********************************************************************
* inet_addr() (WINSOCK.10)
* inet_addr() (WINSOCK.10)(WSOCK32.10)
*/
u_long WINAPI WINSOCK_inet_addr(char *cp) { return( inet_addr(cp) ); }
/***********************************************************************
@ -802,34 +818,40 @@ u_long WINAPI WINSOCK_ntohl(u_long netlong) { return( ntohl(netlong) ); }
u_short WINAPI WINSOCK_ntohs(u_short netshort) { return( ntohs(netshort) ); }
/***********************************************************************
* inet_ntoa() (WINSOCK.11)
* inet_ntoa() (WINSOCK.11)(WSOCK32.11)
*/
SEGPTR WINAPI WINSOCK_inet_ntoa(struct in_addr in)
char* WINAPI WINSOCK_inet_ntoa32(struct in_addr in)
{
/* use "buffer for dummies" here because some applications have
* propensity to decode addresses in ws_hostent structure without
* saving them first...
*/
LPWSINFO pwsi = wsi_find(GetCurrentTask());
LPWSINFO pwsi = wsi_find(GetCurrentTask());
if( pwsi )
{
char* s = inet_ntoa(in);
if( s )
if( pwsi )
{
if( pwsi->dbuffer == NULL )
if((pwsi->dbuffer = (char*) SEGPTR_ALLOC(32)) == NULL )
{
pwsi->err = WSAENOBUFS;
return (SEGPTR)NULL;
}
strncpy(pwsi->dbuffer, s, 32 );
return SEGPTR_GET(pwsi->dbuffer);
char* s = inet_ntoa(in);
if( s )
{
if( pwsi->dbuffer == NULL )
if((pwsi->dbuffer = (char*) SEGPTR_ALLOC(32)) == NULL )
{
pwsi->err = WSAENOBUFS;
return NULL;
}
strncpy(pwsi->dbuffer, s, 32 );
return pwsi->dbuffer;
}
pwsi->err = wsaErrno();
}
pwsi->err = wsaErrno();
}
return (SEGPTR)NULL;
return NULL;
}
SEGPTR WINAPI WINSOCK_inet_ntoa16(struct in_addr in)
{
char* retVal = WINSOCK_inet_ntoa32(in);
return retVal ? SEGPTR_GET(retVal) : (SEGPTR)NULL;
}
/***********************************************************************
@ -1019,16 +1041,15 @@ INT16 WINAPI WINSOCK_recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags,
}
/***********************************************************************
* select() (WINSOCK.18)
* select() (WINSOCK.18)(WSOCK32.18)
*/
INT16 WINAPI WINSOCK_select16(INT16 nfds, ws_fd_set *ws_readfds,
ws_fd_set *ws_writefds, ws_fd_set *ws_exceptfds,
struct timeval *timeout)
static INT32 __ws_select( BOOL32 b32, void *ws_readfds, void *ws_writefds, void *ws_exceptfds,
struct timeval *timeout )
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_SELECT(%08x): nfds %d (ignored), read %8x, write %8x, excp %8x\n",
(unsigned) pwsi, nfds, (unsigned) ws_readfds, (unsigned) ws_writefds, (unsigned) ws_exceptfds);
dprintf_winsock(stddeb, "WS_SELECT(%08x): read %8x, write %8x, excp %8x\n",
(unsigned) pwsi, (unsigned) ws_readfds, (unsigned) ws_writefds, (unsigned) ws_exceptfds);
if( pwsi )
{
@ -1036,28 +1057,41 @@ INT16 WINAPI WINSOCK_select16(INT16 nfds, ws_fd_set *ws_readfds,
fd_set readfds, writefds, exceptfds;
fd_set *p_read, *p_write, *p_except;
p_read = fd_set_import(&readfds, pwsi, ws_readfds, &highfd);
p_write = fd_set_import(&writefds, pwsi, ws_writefds, &highfd);
p_except = fd_set_import(&exceptfds, pwsi, ws_exceptfds, &highfd);
p_read = fd_set_import(&readfds, pwsi, ws_readfds, &highfd, b32);
p_write = fd_set_import(&writefds, pwsi, ws_writefds, &highfd, b32);
p_except = fd_set_import(&exceptfds, pwsi, ws_exceptfds, &highfd, b32);
if( (highfd = select(highfd + 1, p_read, p_write, p_except, timeout)) >= 0 )
{
if( highfd )
{
fd_set_export(pwsi, &readfds, p_except, ws_readfds);
fd_set_export(pwsi, &writefds, p_except, ws_writefds);
fd_set_export(pwsi, &readfds, p_except, ws_readfds, b32);
fd_set_export(pwsi, &writefds, p_except, ws_writefds, b32);
if (p_except && ws_exceptfds)
{
int i, j, count = ws_exceptfds->fd_count;
#define wsfds16 ((ws_fd_set16*)ws_exceptfds)
#define wsfds32 ((ws_fd_set32*)ws_exceptfds)
int i, j, count = (b32) ? wsfds32->fd_count : wsfds16->fd_count;
for (i = j = 0; i < count; i++)
{
ws_socket *pws = (ws_socket *)WS_HANDLE2PTR(ws_exceptfds->fd_array[i]);
ws_socket *pws = (b32) ? (ws_socket *)WS_HANDLE2PTR(wsfds32->fd_array[i])
: (ws_socket *)WS_HANDLE2PTR(wsfds16->fd_array[i]);
if( _check_ws(pwsi, pws) && FD_ISSET(pws->fd, &exceptfds) )
ws_exceptfds->fd_array[j++] = ws_exceptfds->fd_array[i];
{
if( b32 )
wsfds32->fd_array[j++] = wsfds32->fd_array[i];
else
wsfds16->fd_array[j++] = wsfds16->fd_array[i];
}
}
ws_exceptfds->fd_count = j;
if( b32 )
wsfds32->fd_count = j;
else
wsfds16->fd_count = j;
#undef wsfds32
#undef wsfds16
}
}
return highfd;
@ -1067,15 +1101,19 @@ INT16 WINAPI WINSOCK_select16(INT16 nfds, ws_fd_set *ws_readfds,
return SOCKET_ERROR;
}
/***********************************************************************
* select() (WSOCK32.18)
*/
INT32 WINAPI WINSOCK_select32(INT32 nfds, ws_fd_set *ws_readfds,
ws_fd_set *ws_writefds, ws_fd_set *ws_exceptfds,
INT16 WINAPI WINSOCK_select16(INT16 nfds, ws_fd_set16 *ws_readfds,
ws_fd_set16 *ws_writefds, ws_fd_set16 *ws_exceptfds,
struct timeval *timeout)
{
return (INT16)__ws_select( FALSE, ws_readfds, ws_writefds, ws_exceptfds, timeout );
}
INT32 WINAPI WINSOCK_select32(INT32 nfds, ws_fd_set32 *ws_readfds,
ws_fd_set32 *ws_writefds, ws_fd_set32 *ws_exceptfds,
struct timeval *timeout)
{
/* struct timeval is the same for both 32- and 16-bit code */
return WINSOCK_select16( (INT16)nfds, ws_readfds, ws_writefds, ws_exceptfds, timeout );
return (INT32)__ws_select( TRUE, ws_readfds, ws_writefds, ws_exceptfds, timeout );
}
@ -1088,7 +1126,7 @@ INT32 WINAPI WINSOCK_send32(SOCKET32 s, char *buf, INT32 len, INT32 flags)
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_SEND(%08x): socket %04x, ptr %08x, length %d, flags %d\n",
(unsigned)pwsi, s, (unsigned) buf, len, flags);
(unsigned)pwsi, s, (unsigned) buf, len, flags);
if( _check_ws(pwsi, pws) )
{
int length;
@ -1221,7 +1259,7 @@ INT32 WINAPI WINSOCK_shutdown32(SOCKET32 s, INT32 how)
case 2: /* drop all */
default:
WSAAsyncSelect( s, 0, 0, 0 );
WSAAsyncSelect32( s, 0, 0, 0 );
break;
}
@ -1586,23 +1624,40 @@ INT16 WINAPI WINSOCK_gethostname16(char *name, INT16 namelen)
*/
/* winsock_dns.c */
extern HANDLE16 __WSAsyncDBQuery(LPWSINFO pwsi, HWND16 hWnd, UINT16 uMsg, INT16 type, LPCSTR init,
INT16 len, LPCSTR proto, SEGPTR sbuf, INT16 buflen, UINT32 flag);
extern HANDLE16 __WSAsyncDBQuery(LPWSINFO pwsi, HWND32 hWnd, UINT32 uMsg, INT32 type, LPCSTR init,
INT32 len, LPCSTR proto, void* sbuf, INT32 buflen, UINT32 flag);
/***********************************************************************
* WSAAsyncGetHostByAddr() (WINSOCK.102)
*/
HANDLE16 WINAPI WSAAsyncGetHostByAddr(HWND16 hWnd, UINT16 uMsg, LPCSTR addr,
HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 uMsg, LPCSTR addr,
INT16 len, INT16 type, SEGPTR sbuf, INT16 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetHostByAddr(%08x): hwnd %04x, msg %04x, addr %08x[%i]\n",
dprintf_winsock(stddeb, "WS_AsyncGetHostByAddr16(%08x): hwnd %04x, msg %04x, addr %08x[%i]\n",
(unsigned)pwsi, hWnd, uMsg, (unsigned)addr , len );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, type, addr, len,
NULL, sbuf, buflen, WSMSG_ASYNC_HOSTBYADDR );
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_HOSTBYADDR );
return 0;
}
/***********************************************************************
* WSAAsyncGetHostByAddr() (WSOCK32.102)
*/
HANDLE32 WINAPI WSAAsyncGetHostByAddr32(HWND32 hWnd, UINT32 uMsg, LPCSTR addr,
INT32 len, INT32 type, LPSTR sbuf, INT32 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetHostByAddr32(%08x): hwnd %04x, msg %08x, addr %08x[%i]\n",
(unsigned)pwsi, (HWND16)hWnd, uMsg, (unsigned)addr , len );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, type, addr, len,
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_HOSTBYADDR | WSMSG_ASYNC_WIN32);
return 0;
}
@ -1610,17 +1665,17 @@ HANDLE16 WINAPI WSAAsyncGetHostByAddr(HWND16 hWnd, UINT16 uMsg, LPCSTR addr,
/***********************************************************************
* WSAAsyncGetHostByName() (WINSOCK.103)
*/
HANDLE16 WINAPI WSAAsyncGetHostByName(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
SEGPTR sbuf, INT16 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetHostByName(%08x): hwnd %04x, msg %04x, host %s, buffer %i\n",
(unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING, (int)buflen );
dprintf_winsock(stddeb, "WS_AsyncGetHostByName16(%08x): hwnd %04x, msg %04x, host %s,
buffer %i\n", (unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING, (int)buflen );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
NULL, sbuf, buflen, WSMSG_ASYNC_HOSTBYNAME );
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_HOSTBYNAME );
return 0;
}
@ -1628,12 +1683,14 @@ HANDLE16 WINAPI WSAAsyncGetHostByName(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
* WSAAsyncGetHostByName32() (WSOCK32.103)
*/
HANDLE32 WINAPI WSAAsyncGetHostByName32(HWND32 hWnd, UINT32 uMsg, LPCSTR name,
LPSTR sbuf, INT32 buflen)
LPSTR sbuf, INT32 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetHostByName(%08x): hwnd %04x, msg %04x, host %s, buffer %i\n",
(unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING, (int)buflen );
dprintf_winsock(stddeb, "WS_AsyncGetHostByName32(%08x): hwnd %04x, msg %08x, host %s,
buffer %i\n", (unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING, (int)buflen );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_HOSTBYNAME | WSMSG_ASYNC_WIN32);
return 0;
}
@ -1641,17 +1698,34 @@ HANDLE32 WINAPI WSAAsyncGetHostByName32(HWND32 hWnd, UINT32 uMsg, LPCSTR name,
/***********************************************************************
* WSAAsyncGetProtoByName() (WINSOCK.105)
*/
HANDLE16 WINAPI WSAAsyncGetProtoByName(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
SEGPTR sbuf, INT16 buflen)
HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
SEGPTR sbuf, INT16 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetProtoByName(%08x): hwnd %04x, msg %04x, protocol %s\n",
(unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING );
dprintf_winsock(stddeb, "WS_AsyncGetProtoByName16(%08x): hwnd %04x, msg %08x, protocol %s\n",
(unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
NULL, sbuf, buflen, WSMSG_ASYNC_PROTOBYNAME );
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_PROTOBYNAME );
return 0;
}
/***********************************************************************
* WSAAsyncGetProtoByName() (WSOCK32.105)
*/
HANDLE32 WINAPI WSAAsyncGetProtoByName32(HWND32 hWnd, UINT32 uMsg, LPCSTR name,
LPSTR sbuf, INT32 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetProtoByName32(%08x): hwnd %04x, msg %08x, protocol %s\n",
(unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_PROTOBYNAME | WSMSG_ASYNC_WIN32);
return 0;
}
@ -1659,17 +1733,34 @@ HANDLE16 WINAPI WSAAsyncGetProtoByName(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
/***********************************************************************
* WSAAsyncGetProtoByNumber() (WINSOCK.104)
*/
HANDLE16 WINAPI WSAAsyncGetProtoByNumber(HWND16 hWnd, UINT16 uMsg, INT16 number,
SEGPTR sbuf, INT16 buflen)
HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd, UINT16 uMsg, INT16 number,
SEGPTR sbuf, INT16 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetProtoByNumber(%08x): hwnd %04x, msg %04x, num %i\n",
dprintf_winsock(stddeb, "WS_AsyncGetProtoByNumber16(%08x): hwnd %04x, msg %04x, num %i\n",
(unsigned)pwsi, hWnd, uMsg, number );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, number, NULL, 0,
NULL, sbuf, buflen, WSMSG_ASYNC_PROTOBYNUM );
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_PROTOBYNUM );
return 0;
}
/***********************************************************************
* WSAAsyncGetProtoByNumber() (WSOCK32.104)
*/
HANDLE32 WINAPI WSAAsyncGetProtoByNumber32(HWND32 hWnd, UINT32 uMsg, INT32 number,
LPSTR sbuf, INT32 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetProtoByNumber32(%08x): hwnd %04x, msg %08x, num %i\n",
(unsigned)pwsi, (HWND16)hWnd, uMsg, number );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, number, NULL, 0,
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_PROTOBYNUM | WSMSG_ASYNC_WIN32);
return 0;
}
@ -1677,65 +1768,105 @@ HANDLE16 WINAPI WSAAsyncGetProtoByNumber(HWND16 hWnd, UINT16 uMsg, INT16 number,
/***********************************************************************
* WSAAsyncGetServByName() (WINSOCK.107)
*/
HANDLE16 WINAPI WSAAsyncGetServByName(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
LPCSTR proto, SEGPTR sbuf, INT16 buflen)
HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name,
LPCSTR proto, SEGPTR sbuf, INT16 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetServByName(%08x): hwnd %04x, msg %04x, name %s, proto %s\n",
dprintf_winsock(stddeb, "WS_AsyncGetServByName16(%08x): hwnd %04x, msg %04x, name %s, proto %s\n",
(unsigned)pwsi, hWnd, uMsg, (name)?name:NULL_STRING, (proto)?proto:NULL_STRING );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
proto, sbuf, buflen, WSMSG_ASYNC_SERVBYNAME );
proto, (void*)sbuf, buflen, WSMSG_ASYNC_SERVBYNAME );
return 0;
}
/***********************************************************************
* WSAAsyncGetServByName() (WSOCK32.107)
*/
HANDLE32 WINAPI WSAAsyncGetServByName32(HWND32 hWnd, UINT32 uMsg, LPCSTR name,
LPCSTR proto, LPSTR sbuf, INT32 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetServByName32(%08x): hwnd %04x, msg %08x, name %s, proto %s\n",
(unsigned)pwsi, (HWND16)hWnd, uMsg, (name)?name:NULL_STRING, (proto)?proto:NULL_STRING );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, 0, name, 0,
proto, (void*)sbuf, buflen, WSMSG_ASYNC_SERVBYNAME | WSMSG_ASYNC_WIN32);
return 0;
}
/***********************************************************************
* WSAAsyncGetServByPort() (WINSOCK.106)
*/
HANDLE16 WINAPI WSAAsyncGetServByPort(HWND16 hWnd, UINT16 uMsg, INT16 port,
LPCSTR proto, SEGPTR sbuf, INT16 buflen)
HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 uMsg, INT16 port,
LPCSTR proto, SEGPTR sbuf, INT16 buflen)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncGetServByPort(%08x): hwnd %04x, msg %04x, port %i, proto %s\n",
dprintf_winsock(stddeb, "WS_AsyncGetServByPort16(%08x): hwnd %04x, msg %04x, port %i, proto %s\n",
(unsigned)pwsi, hWnd, uMsg, port, (proto)?proto:NULL_STRING );
if( pwsi )
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, port, proto, 0,
NULL, sbuf, buflen, WSMSG_ASYNC_SERVBYPORT );
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_SERVBYPORT );
return 0;
}
/***********************************************************************
* WSACancelAsyncRequest() (WINSOCK.108)
* WSAAsyncGetServByPort() (WSOCK32.106)
*/
INT16 WINAPI WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle)
HANDLE32 WINAPI WSAAsyncGetServByPort32(HWND32 hWnd, UINT32 uMsg, INT32 port,
LPCSTR proto, LPSTR sbuf, INT32 buflen)
{
INT16 retVal = SOCKET_ERROR;
LPWSINFO pwsi = wsi_find(GetCurrentTask());
ws_async_op* p_aop = (ws_async_op*)WS_HANDLE2PTR(hAsyncTaskHandle);
dprintf_winsock(stddeb, "WS_CancelAsyncRequest(%08x): handle %04x\n",
(unsigned)pwsi, hAsyncTaskHandle);
dprintf_winsock(stddeb, "WS_AsyncGetServByPort32(%08x): hwnd %04x, msg %08x, port %i, proto %s\n",
(unsigned)pwsi, (HWND16)hWnd, uMsg, port, (proto)?proto:NULL_STRING );
if( pwsi )
{
SIGNAL_MaskAsyncEvents( TRUE ); /* block SIGIO */
if( WINSOCK_cancel_async_op(p_aop) )
{
WS_FREE(p_aop);
pwsi->num_async_rq--;
retVal = 0;
}
else pwsi->err = WSAEINVAL;
SIGNAL_MaskAsyncEvents( FALSE );
}
return retVal;
return __WSAsyncDBQuery(pwsi, hWnd, uMsg, port, proto, 0,
NULL, (void*)sbuf, buflen, WSMSG_ASYNC_SERVBYPORT | WSMSG_ASYNC_WIN32);
return 0;
}
/***********************************************************************
* WSACancelAsyncRequest() (WINSOCK.108)(WSOCK32.109)
*/
INT32 WINAPI WSACancelAsyncRequest32(HANDLE32 hAsyncTaskHandle)
{
INT32 retVal = SOCKET_ERROR;
LPWSINFO pwsi = wsi_find(GetCurrentTask());
ws_async_op* p_aop = (ws_async_op*)WS_HANDLE2PTR(hAsyncTaskHandle);
dprintf_winsock(stddeb, "WS_CancelAsyncRequest(%08x): handle %08x\n",
(unsigned)pwsi, hAsyncTaskHandle);
if( pwsi )
{
SIGNAL_MaskAsyncEvents( TRUE ); /* block SIGIO */
if( WINSOCK_cancel_async_op(p_aop) )
{
WS_FREE(p_aop);
pwsi->num_async_rq--;
retVal = 0;
}
else pwsi->err = WSAEINVAL;
SIGNAL_MaskAsyncEvents( FALSE );
}
return retVal;
}
INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle)
{
return (HANDLE16)WSACancelAsyncRequest16((HANDLE32)hAsyncTaskHandle);
}
/***********************************************************************
* WSAAsyncSelect() (WINSOCK.101)
* WSAAsyncSelect() (WINSOCK.101)(WSOCK32.101)
*/
static ws_select_op* __ws_select_list = NULL;
@ -1838,7 +1969,7 @@ BOOL32 WINSOCK_HandleIO( int* max_fd, int num_pending, fd_set io_set[3] )
/* this will be reenabled when send() or sendto() fail with
* WSAEWOULDBLOCK */
if( PostMessage16( psop->hWnd, psop->uMsg, (WPARAM16)WS_PTR2HANDLE(psop->pws),
if( PostMessage32A( psop->hWnd, psop->uMsg, (WPARAM32)WS_PTR2HANDLE(psop->pws),
(LPARAM)WSAMAKESELECTREPLY( WS_FD_WRITE, 0 ) ) )
{
dprintf_winsock(stddeb, "\t hwnd %04x - %04x, %08x\n",
@ -1905,8 +2036,8 @@ BOOL32 WINSOCK_HandleIO( int* max_fd, int num_pending, fd_set io_set[3] )
{
dprintf_winsock(stddeb, "\t hwnd %04x - %04x, %08x\n",
psop->hWnd, psop->uMsg, (unsigned)dwEvent );
PostMessage16( psop->hWnd, psop->uMsg,
(WPARAM16)WS_PTR2HANDLE(psop->pws), (LPARAM)dwEvent );
PostMessage32A( psop->hWnd, psop->uMsg,
(WPARAM32)WS_PTR2HANDLE(psop->pws), (LPARAM)dwEvent );
bPost = FALSE;
num_posted++;
}
@ -1918,14 +2049,13 @@ BOOL32 WINSOCK_HandleIO( int* max_fd, int num_pending, fd_set io_set[3] )
return ( num_posted ) ? TRUE : FALSE;
}
INT16 WINAPI WSAAsyncSelect(SOCKET16 s, HWND16 hWnd, UINT16 uMsg, UINT32 lEvent)
INT32 WINAPI WSAAsyncSelect32(SOCKET32 s, HWND32 hWnd, UINT32 uMsg, UINT32 lEvent)
{
ws_socket* pws = (ws_socket*)WS_HANDLE2PTR(s);
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_AsyncSelect(%08x): %04x, hWnd %04x, uMsg %04x, event %08x\n",
(unsigned)pwsi, s, hWnd, uMsg, (unsigned)lEvent );
dprintf_winsock(stddeb, "WS_AsyncSelect(%08x): %04x, hWnd %04x, uMsg %08x, event %08x\n",
(unsigned)pwsi, (SOCKET16)s, (HWND16)hWnd, uMsg, (unsigned)lEvent );
if( _check_ws(pwsi, pws) )
{
ws_select_op* psop;
@ -1996,15 +2126,20 @@ INT16 WINAPI WSAAsyncSelect(SOCKET16 s, HWND16 hWnd, UINT16 uMsg, UINT32 lEvent)
return SOCKET_ERROR;
}
INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, UINT32 lEvent)
{
return (INT16)WSAAsyncSelect32( s, hWnd, wMsg, lEvent );
}
/***********************************************************************
* __WSAFDIsSet() (WINSOCK.151)
*/
INT16 WINAPI __WSAFDIsSet16(SOCKET16 s, ws_fd_set *set)
INT16 WINAPI __WSAFDIsSet16(SOCKET16 s, ws_fd_set16 *set)
{
int i = set->fd_count;
dprintf_winsock(stddeb, "__WSAFDIsSet(%d,%8lx)\n", s,(unsigned long)set);
dprintf_winsock(stddeb, "__WSAFDIsSet16(%d,%8lx)\n", s,(unsigned long)set);
while (i--)
if (set->fd_array[i] == s) return 1;
@ -2014,9 +2149,15 @@ INT16 WINAPI __WSAFDIsSet16(SOCKET16 s, ws_fd_set *set)
/***********************************************************************
* __WSAFDIsSet() (WSOCK32.151)
*/
INT32 WINAPI __WSAFDIsSet32(SOCKET32 s, ws_fd_set *set)
INT32 WINAPI __WSAFDIsSet32(SOCKET32 s, ws_fd_set32 *set)
{
return __WSAFDIsSet16( (SOCKET16)s, set );
int i = set->fd_count;
dprintf_winsock(stddeb, "__WSAFDIsSet32(%d,%8lx)\n", s,(unsigned long)set);
while (i--)
if (set->fd_array[i] == s) return 1;
return 0;
}
/***********************************************************************
@ -2121,25 +2262,74 @@ INT32 WINAPI WSAUnhookBlockingHook32(void)
return SOCKET_ERROR;
}
/*
* TCP/IP action codes.
*/
#define WSCNTL_TCPIP_QUERY_INFO 0x00000000
#define WSCNTL_TCPIP_SET_INFO 0x00000001
#define WSCNTL_TCPIP_ICMP_ECHO 0x00000002
#define WSCNTL_TCPIP_TEST 0x00000003
/***********************************************************************
* WsControl()
*
* WsControl seems to be an undocumented Win95 function. A lot of
* discussion about WsControl can be found on the net, e.g.
* Subject: Re: WSOCK32.DLL WsControl Exported Function
* From: "Peter Rindfuss" <rindfuss-s@medea.wz-berlin.de>
* Date: 1997/08/17
*/
VOID WINAPI WsControl(DWORD x1,DWORD x2,LPDWORD x3,LPDWORD x4,
LPDWORD x5,LPDWORD x6)
DWORD WINAPI WsControl(DWORD protocoll,DWORD action,
LPVOID inbuf,LPDWORD inbuflen,
LPVOID outbuf,LPDWORD outbuflen)
{
fprintf(stdnimp,"WsControl(%lx,%lx,%p,%p,%p,%p)\n",
x1,x2,x3,x4,x5,x6
);
fprintf(stdnimp,"WsControl(x,x,%lx,%lx,%lx,%lx)\n",
x3?*x3:0,x4?*x4:0,x5?*x5:0,x6?*x6:0
);
switch (action) {
case WSCNTL_TCPIP_ICMP_ECHO:
{
unsigned int addr = *(unsigned int*)inbuf;
#if 0
int timeout= *(unsigned int*)(inbuf+4);
short x1 = *(unsigned short*)(inbuf+8);
short sendbufsize = *(unsigned short*)(inbuf+10);
char x2 = *(unsigned char*)(inbuf+12);
char ttl = *(unsigned char*)(inbuf+13);
char service = *(unsigned char*)(inbuf+14);
char type= *(unsigned char*)(inbuf+15); /* 0x2: don't fragment*/
#endif
fprintf(stdnimp,"WsControl(ICMP_ECHO) to 0x%08x stub \n",
addr);
break;
}
default:
fprintf(stdnimp,"WsControl(%lx,%lx,%p,%p,%p,%p) stub\n",
protocoll,action,inbuf,inbuflen,outbuf,outbuflen);
}
return FALSE;
}
/*********************************************************
* WS_s_perror WSOCK32.1108
*/
void WINAPI WS_s_perror(LPCSTR message)
{
fprintf(stdnimp,"s_perror %s stub\n",message);
return;
}
/* ----------------------------------- end of API stuff */
/* ----------------------------------- helper functions */
/* ----------------------------------- helper functions -
*
* TODO: Merge WS_dup_..() stuff into one function that
* would operate with a generic structure containing internal
* pointers (via some sort of a template).
*/
static int list_size(char** l, int item_size)
{
@ -2193,34 +2383,29 @@ int WS_dup_he(LPWSINFO pwsi, struct hostent* p_he, int flag)
int size = hostent_size(p_he);
if( size )
{
char* p_name,*p_aliases,*p_addr,*p_base,*p;
struct ws_hostent* p_to;
char* p_name,*p_aliases,*p_addr,*p_base,*p;
_check_buffer(pwsi, size);
p_to = (struct ws_hostent*)pwsi->buffer;
p = pwsi->buffer;
p_base = (flag & WS_DUP_OFFSET) ? NULL
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
p += (flag & WS_DUP_NATIVE) ? sizeof(struct hostent) : sizeof(struct ws_hostent);
p += sizeof(struct ws_hostent);
p_name = p;
strcpy(p, p_he->h_name); p += strlen(p) + 1;
p_aliases = p;
p += list_dup(p_he->h_aliases, p, p_base + (p - pwsi->buffer), 0);
p_addr = p;
list_dup(p_he->h_addr_list, p, p_base + (p - pwsi->buffer), p_he->h_length);
if( flag & WS_DUP_NATIVE )
{ struct hostent* p_to = (struct hostent*)pwsi->buffer;
p_to->h_addrtype = p_he->h_addrtype; p_to->h_length = p_he->h_length;
p_to->h_name = p_base + (p_name - pwsi->buffer);
p_to->h_aliases = (char**)(p_base + (p_aliases - pwsi->buffer));
p_to->h_addr_list = (char**)(p_base + (p_addr - pwsi->buffer)); }
else
{ struct ws_hostent* p_to = (struct ws_hostent*)pwsi->buffer;
p_to->h_addrtype = (INT16)p_he->h_addrtype;
p_to->h_length = (INT16)p_he->h_length;
p_to->h_name = (SEGPTR)(p_base + (p_name - pwsi->buffer));
p_to->h_aliases = (SEGPTR)(p_base + (p_aliases - pwsi->buffer));
p_to->h_addr_list = (SEGPTR)(p_base + (p_addr - pwsi->buffer));
return (size + sizeof(struct ws_hostent) - sizeof(struct hostent)); }
p_to->h_addrtype = (INT16)p_he->h_addrtype;
p_to->h_length = (INT16)p_he->h_length;
p_to->h_name = (SEGPTR)(p_base + (p_name - pwsi->buffer));
p_to->h_aliases = (SEGPTR)(p_base + (p_aliases - pwsi->buffer));
p_to->h_addr_list = (SEGPTR)(p_base + (p_addr - pwsi->buffer));
size += (sizeof(struct ws_hostent) - sizeof(struct hostent));
}
return size;
}
@ -2242,28 +2427,25 @@ int WS_dup_pe(LPWSINFO pwsi, struct protoent* p_pe, int flag)
int size = protoent_size(p_pe);
if( size )
{
char* p_name,*p_aliases,*p_base,*p;
struct ws_protoent* p_to;
char* p_name,*p_aliases,*p_base,*p;
_check_buffer(pwsi, size);
p_to = (struct ws_protoent*)pwsi->buffer;
p = pwsi->buffer;
p_base = (flag & WS_DUP_OFFSET) ? NULL
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
p += (flag & WS_DUP_NATIVE)? sizeof(struct protoent) : sizeof(struct ws_protoent);
p += sizeof(struct ws_protoent);
p_name = p;
strcpy(p, p_pe->p_name); p += strlen(p) + 1;
p_aliases = p;
list_dup(p_pe->p_aliases, p, p_base + (p - pwsi->buffer), 0);
if( flag & WS_DUP_NATIVE )
{ struct protoent* p_to = (struct protoent*)pwsi->buffer;
p_to->p_proto = p_pe->p_proto;
p_to->p_name = p_base + (p_name - pwsi->buffer);
p_to->p_aliases = (char**)(p_base + (p_aliases - pwsi->buffer)); }
else
{ struct ws_protoent* p_to = (struct ws_protoent*)pwsi->buffer;
p_to->p_proto = (INT16)p_pe->p_proto;
p_to->p_name = (SEGPTR)(p_base) + (p_name - pwsi->buffer);
p_to->p_aliases = (SEGPTR)((p_base) + (p_aliases - pwsi->buffer));
return (size + sizeof(struct ws_protoent) - sizeof(struct protoent)); }
p_to->p_proto = (INT16)p_pe->p_proto;
p_to->p_name = (SEGPTR)(p_base) + (p_name - pwsi->buffer);
p_to->p_aliases = (SEGPTR)((p_base) + (p_aliases - pwsi->buffer));
size += (sizeof(struct ws_protoent) - sizeof(struct protoent));
}
return size;
}
@ -2285,9 +2467,11 @@ int WS_dup_se(LPWSINFO pwsi, struct servent* p_se, int flag)
int size = servent_size(p_se);
if( size )
{
char* p_name,*p_aliases,*p_proto,*p_base,*p;
struct ws_servent* p_to;
char* p_name,*p_aliases,*p_proto,*p_base,*p;
_check_buffer(pwsi, size);
p_to = (struct ws_servent*)pwsi->buffer;
p = pwsi->buffer;
p_base = (flag & WS_DUP_OFFSET) ? NULL
: ((flag & WS_DUP_SEGPTR) ? (char*)SEGPTR_GET(p) : p);
@ -2299,19 +2483,12 @@ int WS_dup_se(LPWSINFO pwsi, struct servent* p_se, int flag)
p_aliases = p;
list_dup(p_se->s_aliases, p, p_base + (p - pwsi->buffer), 0);
if( flag & WS_DUP_NATIVE )
{ struct servent* p_to = (struct servent*)pwsi->buffer;
p_to->s_port = p_se->s_port;
p_to->s_name = p_base + (p_name - pwsi->buffer);
p_to->s_proto = p_base + (p_proto - pwsi->buffer);
p_to->s_aliases = (char**)(p_base + (p_aliases - pwsi->buffer)); }
else
{ struct ws_servent* p_to = (struct ws_servent*)pwsi->buffer;
p_to->s_port = (INT16)p_se->s_port;
p_to->s_name = (SEGPTR)(p_base + (p_name - pwsi->buffer));
p_to->s_proto = (SEGPTR)(p_base + (p_proto - pwsi->buffer));
p_to->s_aliases = (SEGPTR)(p_base + (p_aliases - pwsi->buffer));
return (size + sizeof(struct ws_servent) - sizeof(struct servent)); }
p_to->s_port = (INT16)p_se->s_port;
p_to->s_name = (SEGPTR)(p_base + (p_name - pwsi->buffer));
p_to->s_proto = (SEGPTR)(p_base + (p_proto - pwsi->buffer));
p_to->s_aliases = (SEGPTR)(p_base + (p_aliases - pwsi->buffer));
size += (sizeof(struct ws_servent) - sizeof(struct servent));
}
return size;
}
@ -2323,7 +2500,7 @@ UINT16 wsaErrno(void)
int loc_errno = errno;
#if defined(__FreeBSD__)
dprintf_winsock(stderr, "winsock: errno %d, (%s).\n",
errno, sys_errlist[errno]);
errno, strerror(errno));
#else
dprintf_winsock(stderr, "winsock: errno %d\n", errno);
#endif
@ -2398,7 +2575,7 @@ UINT16 wsaHerrno(void)
#if defined(__FreeBSD__)
dprintf_winsock(stderr, "winsock: h_errno %d, (%s).\n",
h_errno, sys_errlist[h_errno]);
h_errno, strerror(h_errno));
#else
dprintf_winsock(stderr, "winsock: h_errno %d.\n", h_errno);
#ifndef sun

View File

@ -29,12 +29,12 @@
extern int h_errno;
#include "winsock.h"
#include "windows.h"
#include "heap.h"
#include "ldt.h"
#include "message.h"
#include "miscemu.h"
#include "winsock.h"
#include "debug.h"
#ifndef FASYNC
@ -67,9 +67,9 @@ static int __async_io_max_fd = 0;
static fd_set __async_io_fdset;
static ws_async_op* __async_op_list = NULL;
static void fixup_wshe(struct ws_hostent* p_wshe, SEGPTR base);
static void fixup_wspe(struct ws_protoent* p_wspe, SEGPTR base);
static void fixup_wsse(struct ws_servent* p_wsse, SEGPTR base);
static void fixup_wshe(struct ws_hostent* p_wshe, void* base);
static void fixup_wspe(struct ws_protoent* p_wspe, void* base);
static void fixup_wsse(struct ws_servent* p_wsse, void* base);
extern void EVENT_AddIO( int fd, unsigned flag );
extern void EVENT_DeleteIO( int fd, unsigned flag );
@ -274,19 +274,21 @@ static int aop_control(ws_async_op* p_aop, int flag )
{
if( (int)LOWORD(lLength) <= p_aop->buflen )
{
char* buffer = (char*)PTR_SEG_TO_LIN(p_aop->buffer_base);
char* buffer = (p_aop->flags & WSMSG_ASYNC_WIN32)
? p_aop->b.lin_base : (char*)PTR_SEG_TO_LIN(p_aop->b.seg_base);
read(p_aop->fd[0], buffer, LOWORD(lLength));
switch( p_aop->flags )
{
case WSMSG_ASYNC_HOSTBYNAME:
case WSMSG_ASYNC_HOSTBYADDR:
fixup_wshe((struct ws_hostent*)buffer, p_aop->buffer_base); break;
fixup_wshe((struct ws_hostent*)buffer, p_aop->b.ptr_base); break;
case WSMSG_ASYNC_PROTOBYNAME:
case WSMSG_ASYNC_PROTOBYNUM:
fixup_wspe((struct ws_protoent*)buffer, p_aop->buffer_base); break;
fixup_wspe((struct ws_protoent*)buffer, p_aop->b.ptr_base); break;
case WSMSG_ASYNC_SERVBYNAME:
case WSMSG_ASYNC_SERVBYPORT:
fixup_wsse((struct ws_servent*)buffer, p_aop->buffer_base); break;
fixup_wsse((struct ws_servent*)buffer, p_aop->b.ptr_base); break;
default:
if( p_aop->flags ) fprintf(stderr,"Received unknown async request!\n");
return AOP_CONTROL_REMOVE;
@ -302,14 +304,14 @@ static int aop_control(ws_async_op* p_aop, int flag )
/* FIXME: update num_async_rq */
EVENT_DeleteIO( p_aop->fd[0], EVENT_IO_READ );
PostMessage16( p_aop->hWnd, p_aop->uMsg, __ws_gethandle(p_aop), (LPARAM)lLength );
PostMessage32A( p_aop->hWnd, p_aop->uMsg, __ws_gethandle(p_aop), (LPARAM)lLength );
return AOP_CONTROL_REMOVE; /* one-shot request */
}
HANDLE16 __WSAsyncDBQuery(LPWSINFO pwsi, HWND16 hWnd, UINT16 uMsg, INT16 type, LPSTR init,
INT16 len, LPSTR proto, SEGPTR sbuf, INT16 buflen, UINT32 flag)
HANDLE16 __WSAsyncDBQuery(LPWSINFO pwsi, HWND32 hWnd, UINT32 uMsg, INT32 type, LPSTR init,
INT32 len, LPSTR proto, void* sbuf, INT32 buflen, UINT32 flag)
{
/* queue 'flag' request and fork off its handler */
@ -328,7 +330,8 @@ HANDLE16 __WSAsyncDBQuery(LPWSINFO pwsi, HWND16 hWnd, UINT16 uMsg, INT16 type, L
async_ctl.ws_aop->hWnd = hWnd;
async_ctl.ws_aop->uMsg = uMsg;
async_ctl.ws_aop->buffer_base = sbuf; async_ctl.ws_aop->buflen = buflen;
async_ctl.ws_aop->b.ptr_base = sbuf;
async_ctl.ws_aop->buflen = buflen;
async_ctl.ws_aop->flags = flag;
async_ctl.ws_aop->aop_control = &aop_control;
@ -441,19 +444,20 @@ void WS_do_async_gethost(LPWSINFO pwsi, unsigned flag )
close(async_ctl.ws_aop->fd[0]);
dprintf_winsock(stddeb,"DNS: getting hostent for [%s]\n", async_ctl.rq.name );
p_he = (flag & WSMSG_ASYNC_HOSTBYNAME)
? gethostbyname(async_ctl.rq.name)
: gethostbyaddr(async_ctl.rq.name,
async_ctl.ilength, async_ctl.type);
dprintf_winsock(stddeb,"DNS: done!\n");
if( p_he ) size = WS_dup_he(pwsi, p_he, WS_DUP_SEGPTR | WS_DUP_OFFSET );
dprintf_winsock(stddeb,"DNS: got hostent for [%s]\n", async_ctl.rq.name );
if( p_he ) /* convert to the Winsock format with internal pointers as offsets */
size = WS_dup_he(pwsi, p_he, WS_DUP_OFFSET |
((flag & WSMSG_ASYNC_WIN32) ? WS_DUP_LINEAR : WS_DUP_SEGPTR) );
if( size )
{
async_ctl.buffer = pwsi->buffer;
async_ctl.ilength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
async_ctl.buffer = pwsi->buffer;
async_ctl.ilength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
_async_notify( flag );
}
else _async_fail();
@ -468,11 +472,16 @@ void WS_do_async_getproto(LPWSINFO pwsi, unsigned flag )
p_pe = (flag & WSMSG_ASYNC_PROTOBYNAME)
? getprotobyname(async_ctl.rq.name)
: getprotobynumber(async_ctl.type);
if( p_pe ) size = WS_dup_pe(pwsi, p_pe, WS_DUP_SEGPTR | WS_DUP_OFFSET );
dprintf_winsock(stddeb,"DNS: got protoent for [%s]\n", async_ctl.rq.name );
if( p_pe ) /* convert to the Winsock format with internal pointers as offsets */
size = WS_dup_pe(pwsi, p_pe, WS_DUP_OFFSET |
((flag & WSMSG_ASYNC_WIN32) ? WS_DUP_LINEAR : WS_DUP_SEGPTR) );
if( size )
{
async_ctl.buffer = pwsi->buffer;
async_ctl.ilength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
async_ctl.buffer = pwsi->buffer;
async_ctl.ilength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
_async_notify( flag );
}
else _async_fail();
@ -487,19 +496,32 @@ void WS_do_async_getserv(LPWSINFO pwsi, unsigned flag )
p_se = (flag & WSMSG_ASYNC_SERVBYNAME)
? getservbyname(async_ctl.rq.name, async_ctl.buffer)
: getservbyport(async_ctl.type, async_ctl.buffer);
if( p_se ) size = WS_dup_se(pwsi, p_se, WS_DUP_SEGPTR | WS_DUP_OFFSET );
if( p_se ) /* convert to the Winsock format with internal pointers as offsets */
size = WS_dup_se(pwsi, p_se, WS_DUP_OFFSET |
((flag & WSMSG_ASYNC_WIN32) ? WS_DUP_LINEAR : WS_DUP_SEGPTR) );
if( size )
{
async_ctl.buffer = pwsi->buffer;
async_ctl.ilength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
async_ctl.buffer = pwsi->buffer;
async_ctl.ilength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
_async_notify( flag );
}
else _async_fail();
}
/* ----------------------------------- helper functions */
/* ----------------------------------- helper functions -
*
* Raw results from pipe contain internal pointers stored as
* offsets relative to the beginning of the buffer and we need
* to apply a fixup before passing them to applications.
*
* NOTE: It is possible to exploit the fact that fork() doesn't
* change the buffer address by storing fixed up pointers right
* in the handler. However, this will get in the way if we ever
* get to implementing DNS helper daemon a-la Netscape.
*/
void fixup_wshe(struct ws_hostent* p_wshe, SEGPTR base)
void fixup_wshe(struct ws_hostent* p_wshe, void* base)
{
/* add 'base' to ws_hostent pointers to convert them from offsets */
@ -515,7 +537,7 @@ void fixup_wshe(struct ws_hostent* p_wshe, SEGPTR base)
for(i=0;p_addr[i];i++) p_addr[i] += (unsigned)base;
}
void fixup_wspe(struct ws_protoent* p_wspe, SEGPTR base)
void fixup_wspe(struct ws_protoent* p_wspe, void* base)
{
int i;
unsigned* p_aliases = (unsigned*)((char*)p_wspe + (unsigned)p_wspe->p_aliases);
@ -524,7 +546,7 @@ void fixup_wspe(struct ws_protoent* p_wspe, SEGPTR base)
for(i=0;p_aliases[i];i++) p_aliases[i] += (unsigned)base;
}
void fixup_wsse(struct ws_servent* p_wsse, SEGPTR base)
void fixup_wsse(struct ws_servent* p_wsse, void* base)
{
int i;
unsigned* p_aliases = (unsigned*)((char*)p_wsse + (unsigned)p_wsse->s_aliases);

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