Release 980822

Sat Aug 22 17:46:19 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [include/dosexe.h] [include/module.h] [include/pe_image.h] 
	  [include/process.h] [include/windows.h] [loader/dos/module.c]
	  [loader/module.c] [loader/ne/module.c] [loader/pe_image.c]
	  [scheduler/process.c] [win32/process.c]
	Partially implemented CreateProcess32.

	* [win32/device.c] [relay32/kernel32.spec] [scheduler/k32obj.c]
	  [misc/registry.c] [win32/file.c]
	Partially implemented VxDCall (VMM registry services).

	* [files/dos_fs.c]
	DOSFS_FindNext made thread-safe.

	* [include/sig_context.h] [include/syslevel.h] [loader/signal.c]
	  [scheduler/syslevel.c] [tools/build.c]
	Replaced CALLTO16_Current_fs by SYSLEVEL_Win16CurrentTeb.

	* [win32/kernel32.c]
	Bugfix: QT_Thunk/FT_Thunk should return 'long' in DX:AX, not EAX.

	* [if1632/relay.c] [relay32/builtin32.c] [windows/msgbox.c]
	  [msdos/int20.c] [msdos/int21.c]
	Use ExitProcess instead of TASK_KillCurrentTask.

	* [include/task.h] [include/thread.h] [loader/task.c] 
	  [scheduler/thread.c] [include/queue.h] [windows/message.c] 
	  [windows/queue.c] [windows/win.c]
	Prevent Win32 threads from entering the TASK_Reschedule loop.
	(Note: Win32 messaging still doesn't work correctly; this patch
	is just preventing the system from crashing when Win32 threads
	call messaging functions. Messages will probably still get lost.)

	* [scheduler/critsection.c]
	Deactivated the use of SEM_UNDO for the SYSTEM_LOCK semaphore;
	for some reason, this leads to problems after threads terminate... 

Sat Aug 22 15:00:00 1998  Jrgen Schmied <juergen.schmied@metronet.de>

	* [include/authors.h]
	New file, includes all names of the developer (former shell.c)

	* [Makefile.in][configure][configure.in][dlls/Makefile.in]
	  [dlls/shell32/Makefile.in][shres.rc]
	Created dlls/shell32 and moved the shell32 stuff in it.
	Started to create internal resources.

	* [dlls/shell32/*]
	Split the shell32 implementation into smaller files.
	New classes: IContextMenu, IExtractIcon, IShellView.
	Implemented Shell_GetImageList().
	shell32 links to comctl32 now dynamically so it can use
	internal/external implementations.

	* [documentation/internal-dll] [documentation/shell32]
	New, could anybody do a spellcheck?

	* [include/commctrl.h]
	Many new LV constants, structures, functions.

	* [controls/comctl32undoc.c]
	Rewrote the DSA* functions.

	* [windows/winpos.c]
	SetShellWindow32, GetShellWindow32.

Sat Aug 22 14:02:15 1998  Alexander Lukyanov <lav@long.yar.ru>

	* [loader/resource.c]
	Mark last accelerator as such in LoadAccelerators32W.

	* [relay32/shell32.spec] [misc/shell.c]
	Add stubs for SHGetSpecialFolderPath[AW].

Sat Aug 22 02:07:42 1998  Adrian Harvey <adrian@select.com.au>

	* [include/file.h] [file/file.c] [msdos/int21.c] [msdos/vxd.c]
	  [misc/lzexpand.c] [win32/kernel32.c] [documentation/filehandles]
	Fixed file handle handling.  Created universal HFILE16 to HFILE32
	translation macro from msdos/int21 code by Ove Kaaven.
	Used macro in all Win16 functions so that win32 handles are translated
	to avoid DOS/Win16 stdxx handles.
	Removed handle translation from int21.c where Win16 functions are
	called.  Changed remaining calls to use new macro names.
	Documented filehandle handling and differences between win 16 & 32.

Fri Aug 21 20:32:49 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [server/process.c] [server/thread.c]
	Implemented object wait queues and synchronization.

Fri Aug 21 18:40:02 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [graphics/psdrv/*]
	DEVMODE dmPaper{Width|Length} fields are in 0.1mm.
	Select a 100 pixel default font in CreateDC.

Thu Aug 20 22:47:39 1998  Uwe Bonnes  <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [objects/bitmap.c]
	Handle bits=32 in SetBitmapBits32 and GetBitmapBits32.

	* [msdos/int21.c]
	Add handling of Int21 0A and 37.

	* [misc/commdlg.c]
	Use MapHModuleLS and MapHModuleSL when translating HINSTANCE16 to
	HINSTANCE32 and vice versa.

	* [win32/file.c]
	CreateFile32A: Abort if filename == NULL.

Thu Aug 20 12:28:31 1998  Marcus Meissner <marcus@jet.franken.de>

	* [*/*]
	Lots of missing prototypes added, some parameter types adapted to match
	SDK.

	* [debugger/stabs.c]
	Don't loop forever if we don't find wine or one of the libxxx.so.

	* [loader/ne/module.c]
	Implemented MapHModuleLS,MapHModuleSL,MapHinstLS,MapHinstSL.

	* [misc/network.c]
	Implemented WNetGetUser32A.

	* [misc/shellord.c]
	Implemented ILRemoveLastID.

	* [multimedia/dsound.c]
	Fixed StarCraft memory leak.

	* [graphics/ddraw.c]
	Removed some unnecessary simple relaying functions, tried polishing
	up the Xlib implementation (still doesn't work), temp. removed Xshm
	code (to be remerged with working Xlib code).

Tue Aug 18 22:29:17 1998  Ove Kaaven <ovek@arcticnet.no>

	* [multimedia/mmio.c] [multimedia/mmsystem.c]
	Fixed most mmio bugs, fully implementing mmioSetBuffer
	buffering, ability to read memory files, and the
	sndPlaySound() SND_MEMORY flag. Most mmio-using programs
	now work fine.

	* [include/dosexe.h] [include/miscemu.h] [include/module.h]
	  [loader/module.c] [loader/task.c] [msdos/dosmem.c]
	Improved DOS VM flexibility and portability somewhat. (Did
	I get the #ifdefs right this time, BSD-ers?)

	* [msdos/int21.c]
	Made "Get Current PSP address" work as expected in a DOS VM.

	* [loader/dos/*]
	Began improving flexibility and portability somewhat. It
	should be easier to add DPMI RMCB callbacks now. The
	DOS VM no longer leaves big files lying around in /tmp
	after a crash.

Tue Aug 18 12:38:31 1998 Turchanov Sergey <turchanov@usa.net>

	* [relay32/winmm.spec]
	This patch allows WinAmp to play WAV files (at least in PCM
	format).

Sun Aug 16 05:34:13 1998  Pablo Saratxaga <srtxg@chanae.alphanet.ch>

	* [windows/keyboard.c]
	Corrected keyboard code to properly handle keys : ? ~ and "
	on non US keyboards.

Sat Aug 15 18:47:14 1998  Brian Craft <bcboy@dorothy.wanglab.brandeis.edu>

	* [windows/win.c]
	Fixed severe bug in EnumChildWindwos().

Thu Aug 13 21:05:35 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [controls/tooltips.c]
	Fixed some bugs. Added subclassing support.

	* [controls/toolbar.c]
	Improved tooltip integration. Fixed some bugs.

	* [controls/commctrl.c]
	Changed control registration and added some documentation.
	Fixed ShowHideMenuCtl.

	* [controls/rebar.c][include/rebar.h][include/commctrl.h]
	Improved rebar implementation (still no display).

	* [controls/pager.c][include/pager.h][include/commctrl.h]
	Improved pager implementation (still no display).

	* [misc/imagelist.c]
	Fixed a bug.

	* [documentation/common_controls]
	Updated.

Sun Aug  9 19:50:20 1998  James Juran <jrj120@psu.edu>

	* [Makefile.in] [documentation/Makefile.in] 
	  [programs/Makefile.in] [programs/*/Makefile.in]
	Added uninstall rules, cleaned up install rules a little bit.

Sun Aug  9 13:21:35 1998  Andreas Mohr <100.30936@germany.net>

	* [loader/ne/module.c] [if1632/kernel.spec]
	Added the undocumented HIWORD of GetModuleHandle (hFirstModule).

	* [loader/ne/segment.c]
	Wine forgot to set some NE_SEGFLAGS_*.
	Combined with another loader change, this fixed the
	"BLINKER -- error in loading module" or ghost MessageBox problem
	that about 1% of all Windows programs have.
	Some BLINKER programs still don't work, though.
	But I'm working on it, with great help from Blinkinc.

	* [loader/task.c]
	InitTask needs to decrement the SP register by two as Win95 does.

Sun Aug  9 02:41:28 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [if1632/kernel.spec] [relay32/kernel32.spec] [scheduler/syslevel.c]
	  [loader/main.c] [win32/ordinals.c] [include/syslevel.h] 
	  [scheduler/Makefile.in]
	Implemented Win95 'syslevel' routines (including Win16Lock).

	* [if1632/relay.c] [if1632/thunk.c] [tools/build.c] [loader/task.c]
	  [loader/ne/segment.c] [win32/kernel32.c] [memory/selector.c]
	  [include/stackframe.h] [include/thread.h]
	16-bit %fs handling revised.  Use Win16Lock where appropriate.

	* [include/thread.h] [scheduler/synchro.c] [windows/message.c] 
	  [windows/queue.c] [win32/process.c]
	Implemented MsgWaitForMultipleObjects.

	* [files/change.c] [files/Makefile.in] [scheduler/k32obj.c] 
	  [win32/newfns.c]
	Implemented (dummy) file change notification objects.

	* [debugger/dbg.y] [scheduler/process.c] [scheduler/thread.c]
	  [include/process.h] [include/thread.h]
	Suspend all threads except current when hitting debugger break point.

	* [objects/dib.c]
	Bugfix for CreateDIBSection.
This commit is contained in:
Alexandre Julliard 1998-08-22 19:03:56 +00:00
parent 767e6f6f9d
commit 85ed45e377
163 changed files with 11364 additions and 5786 deletions

View File

@ -1,16 +1,15 @@
This is release 980809 of Wine, the MS Windows emulator. This is still a
This is release 980822 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-980809: (see ChangeLog for details)
- Preliminary DOS executables support.
- Postscript driver improvements.
- More client/server stuff.
- Better shell32.dll builtin support.
- Proper Win16 mutex locking.
WHAT'S NEW with Wine-980822: (see ChangeLog for details)
- Improved mmio support.
- VxDCall support.
- More common controls and shell32 stuff.
- Better DOS executables support.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -19,10 +18,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-980809.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980809.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/Wine-980809.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980809.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-980822.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980822.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/Wine-980822.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980822.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

236
ChangeLog
View File

@ -1,3 +1,212 @@
----------------------------------------------------------------------
Sat Aug 22 17:46:19 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [include/dosexe.h] [include/module.h] [include/pe_image.h]
[include/process.h] [include/windows.h] [loader/dos/module.c]
[loader/module.c] [loader/ne/module.c] [loader/pe_image.c]
[scheduler/process.c] [win32/process.c]
Partially implemented CreateProcess32.
* [win32/device.c] [relay32/kernel32.spec] [scheduler/k32obj.c]
[misc/registry.c] [win32/file.c]
Partially implemented VxDCall (VMM registry services).
* [files/dos_fs.c]
DOSFS_FindNext made thread-safe.
* [include/sig_context.h] [include/syslevel.h] [loader/signal.c]
[scheduler/syslevel.c] [tools/build.c]
Replaced CALLTO16_Current_fs by SYSLEVEL_Win16CurrentTeb.
* [win32/kernel32.c]
Bugfix: QT_Thunk/FT_Thunk should return 'long' in DX:AX, not EAX.
* [if1632/relay.c] [relay32/builtin32.c] [windows/msgbox.c]
[msdos/int20.c] [msdos/int21.c]
Use ExitProcess instead of TASK_KillCurrentTask.
* [include/task.h] [include/thread.h] [loader/task.c]
[scheduler/thread.c] [include/queue.h] [windows/message.c]
[windows/queue.c] [windows/win.c]
Prevent Win32 threads from entering the TASK_Reschedule loop.
(Note: Win32 messaging still doesn't work correctly; this patch
is just preventing the system from crashing when Win32 threads
call messaging functions. Messages will probably still get lost.)
* [scheduler/critsection.c]
Deactivated the use of SEM_UNDO for the SYSTEM_LOCK semaphore;
for some reason, this leads to problems after threads terminate...
Sat Aug 22 15:00:00 1998 Jürgen Schmied <juergen.schmied@metronet.de>
* [include/authors.h]
New file, includes all names of the developer (former shell.c)
* [Makefile.in][configure][configure.in][dlls/Makefile.in]
[dlls/shell32/Makefile.in][shres.rc]
Created dlls/shell32 and moved the shell32 stuff in it.
Started to create internal resources.
* [dlls/shell32/*]
Split the shell32 implementation into smaller files.
New classes: IContextMenu, IExtractIcon, IShellView.
Implemented Shell_GetImageList().
shell32 links to comctl32 now dynamically so it can use
internal/external implementations.
* [documentation/internal-dll] [documentation/shell32]
New, could anybody do a spellcheck?
* [include/commctrl.h]
Many new LV constants, structures, functions.
* [controls/comctl32undoc.c]
Rewrote the DSA* functions.
* [windows/winpos.c]
SetShellWindow32, GetShellWindow32.
Sat Aug 22 14:02:15 1998 Alexander Lukyanov <lav@long.yar.ru>
* [loader/resource.c]
Mark last accelerator as such in LoadAccelerators32W.
* [relay32/shell32.spec] [misc/shell.c]
Add stubs for SHGetSpecialFolderPath[AW].
Sat Aug 22 02:07:42 1998 Adrian Harvey <adrian@select.com.au>
* [include/file.h] [file/file.c] [msdos/int21.c] [msdos/vxd.c]
[misc/lzexpand.c] [win32/kernel32.c] [documentation/filehandles]
Fixed file handle handling. Created universal HFILE16 to HFILE32
translation macro from msdos/int21 code by Ove Kaaven.
Used macro in all Win16 functions so that win32 handles are translated
to avoid DOS/Win16 stdxx handles.
Removed handle translation from int21.c where Win16 functions are
called. Changed remaining calls to use new macro names.
Documented filehandle handling and differences between win 16 & 32.
Fri Aug 21 20:32:49 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [server/process.c] [server/thread.c]
Implemented object wait queues and synchronization.
Fri Aug 21 18:40:02 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>
* [graphics/psdrv/*]
DEVMODE dmPaper{Width|Length} fields are in 0.1mm.
Select a 100 pixel default font in CreateDC.
Thu Aug 20 22:47:39 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
* [objects/bitmap.c]
Handle bits=32 in SetBitmapBits32 and GetBitmapBits32.
* [msdos/int21.c]
Add handling of Int21 0A and 37.
* [misc/commdlg.c]
Use MapHModuleLS and MapHModuleSL when translating HINSTANCE16 to
HINSTANCE32 and vice versa.
* [win32/file.c]
CreateFile32A: Abort if filename == NULL.
Thu Aug 20 12:28:31 1998 Marcus Meissner <marcus@jet.franken.de>
* [*/*]
Lots of missing prototypes added, some parameter types adapted to match
SDK.
* [debugger/stabs.c]
Don't loop forever if we don't find wine or one of the libxxx.so.
* [loader/ne/module.c]
Implemented MapHModuleLS,MapHModuleSL,MapHinstLS,MapHinstSL.
* [misc/network.c]
Implemented WNetGetUser32A.
* [misc/shellord.c]
Implemented ILRemoveLastID.
* [multimedia/dsound.c]
Fixed StarCraft memory leak.
* [graphics/ddraw.c]
Removed some unnecessary simple relaying functions, tried polishing
up the Xlib implementation (still doesn't work), temp. removed Xshm
code (to be remerged with working Xlib code).
Tue Aug 18 22:29:17 1998 Ove Kaaven <ovek@arcticnet.no>
* [multimedia/mmio.c] [multimedia/mmsystem.c]
Fixed most mmio bugs, fully implementing mmioSetBuffer
buffering, ability to read memory files, and the
sndPlaySound() SND_MEMORY flag. Most mmio-using programs
now work fine.
* [include/dosexe.h] [include/miscemu.h] [include/module.h]
[loader/module.c] [loader/task.c] [msdos/dosmem.c]
Improved DOS VM flexibility and portability somewhat. (Did
I get the #ifdefs right this time, BSD-ers?)
* [msdos/int21.c]
Made "Get Current PSP address" work as expected in a DOS VM.
* [loader/dos/*]
Began improving flexibility and portability somewhat. It
should be easier to add DPMI RMCB callbacks now. The
DOS VM no longer leaves big files lying around in /tmp
after a crash.
Tue Aug 18 12:38:31 1998 Turchanov Sergey <turchanov@usa.net>
* [relay32/winmm.spec]
This patch allows WinAmp to play WAV files (at least in PCM
format).
Sun Aug 16 05:34:13 1998 Pablo Saratxaga <srtxg@chanae.alphanet.ch>
* [windows/keyboard.c]
Corrected keyboard code to properly handle keys : ? ~ and "
on non US keyboards.
Sat Aug 15 18:47:14 1998 Brian Craft <bcboy@dorothy.wanglab.brandeis.edu>
* [windows/win.c]
Fixed severe bug in EnumChildWindwos().
Thu Aug 13 21:05:35 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [controls/tooltips.c]
Fixed some bugs. Added subclassing support.
* [controls/toolbar.c]
Improved tooltip integration. Fixed some bugs.
* [controls/commctrl.c]
Changed control registration and added some documentation.
Fixed ShowHideMenuCtl.
* [controls/rebar.c][include/rebar.h][include/commctrl.h]
Improved rebar implementation (still no display).
* [controls/pager.c][include/pager.h][include/commctrl.h]
Improved pager implementation (still no display).
* [misc/imagelist.c]
Fixed a bug.
* [documentation/common_controls]
Updated.
Sun Aug 9 19:50:20 1998 James Juran <jrj120@psu.edu>
* [Makefile.in] [documentation/Makefile.in]
[programs/Makefile.in] [programs/*/Makefile.in]
Added uninstall rules, cleaned up install rules a little bit.
----------------------------------------------------------------------
Sun Aug 9 13:21:35 1998 Andreas Mohr <100.30936@germany.net>
@ -15,6 +224,33 @@ Sun Aug 9 13:21:35 1998 Andreas Mohr <100.30936@germany.net>
* [loader/task.c]
InitTask needs to decrement the SP register by two as Win95 does.
Sun Aug 9 02:41:28 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [if1632/kernel.spec] [relay32/kernel32.spec] [scheduler/syslevel.c]
[loader/main.c] [win32/ordinals.c] [include/syslevel.h]
[scheduler/Makefile.in]
Implemented Win95 'syslevel' routines (including Win16Lock).
* [if1632/relay.c] [if1632/thunk.c] [tools/build.c] [loader/task.c]
[loader/ne/segment.c] [win32/kernel32.c] [memory/selector.c]
[include/stackframe.h] [include/thread.h]
16-bit %fs handling revised. Use Win16Lock where appropriate.
* [include/thread.h] [scheduler/synchro.c] [windows/message.c]
[windows/queue.c] [win32/process.c]
Implemented MsgWaitForMultipleObjects.
* [files/change.c] [files/Makefile.in] [scheduler/k32obj.c]
[win32/newfns.c]
Implemented (dummy) file change notification objects.
* [debugger/dbg.y] [scheduler/process.c] [scheduler/thread.c]
[include/process.h] [include/thread.h]
Suspend all threads except current when hitting debugger break point.
* [objects/dib.c]
Bugfix for CreateDIBSection.
Sat Aug 8 19:11:46 1998 Marcus Meissner <marcus@jet.franken.de>
* [*/*]

View File

@ -5,6 +5,7 @@
# clean: remove all intermediate files
# distclean: also remove all files created by configure
# install: install everything
# uninstall: uninstall everything
# depend: create the dependencies
# etags: create a TAGS file for Emacs.
# manpages: compile manpages for Wine API
@ -26,6 +27,7 @@ LIBSUBDIRS = \
tools \
tools/wrc \
controls \
dlls/shell32 \
files \
graphics \
graphics/metafiledrv \
@ -75,6 +77,7 @@ INSTALLSUBDIRS = $(DOCSUBDIRS)
LIBOBJS = \
controls/controls.o \
dlls/shell32/shell32.o \
files/files.o \
graphics/graphics.o \
graphics/metafiledrv/metafiledrv.o \
@ -112,6 +115,8 @@ all: $(MAIN_TARGET)
install:: install_$(MAIN_TARGET)
uninstall:: uninstall_$(MAIN_TARGET)
emu: wine
lib: $(LIBSUBDIRS) $(LIB_TARGET)
@ -129,28 +134,47 @@ libwine.so.1.0: $(LIBOBJS)
$(CC) -shared -Wl,-soname,libwine.so -o$@ $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
install_emu: install_lib
-mkdirhier $(bindir)
-mkdirhier $(libdir)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(INSTALL_PROGRAM) wine $(bindir)/wine
$(INSTALL_DATA) wine.sym $(libdir)/wine.sym
$(INSTALL_PROGRAM) loader/dos/dosmod $(bindir)/dosmod
uninstall_emu: uninstall_lib
$(RM) $(bindir)/wine $(bindir)/dosmod
install_lib: install_includes
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(INSTALL_DATA) $(LIB_TARGET) $(libdir)
$(INSTALL_DATA) wine.sym $(libdir)/wine.sym
uninstall_lib: uninstall_includes
cd $(libdir); $(RM) $(LIB_TARGET)
$(RM) $(libdir)/wine.sym
install_includes: dummy
if [ -d $(includedir) ]; then : ; else $(MKDIR) $(includedir); fi
[ -d $(includedir) ] || $(MKDIR) $(includedir)
cd $(TOPSRCDIR)/include; $(INSTALL_DATA) windows.h wintypes.h $(includedir)
# Don't just do a rm -rf on $(includedir) -- don't want to wipe out
# anything extra the user may have put there.
uninstall_includes: dummy
$(RM) $(includedir)/windows.h $(includedir)/wintypes.h
-rmdir $(includedir)
$(ALLSUBDIRS): dummy
@cd $@; $(SUBMAKE)
install_programs: dummy
@cd programs; $(SUBMAKE) install
uninstall_programs: dummy
@cd programs; $(SUBMAKE) uninstall
install::
for i in $(INSTALLSUBDIRS); do (cd $$i && $(MAKE) install) || exit 1; done
uninstall::
for i in $(INSTALLSUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit 1; done
depend:: dummy
for i in $(DEPENDSUBDIRS); do (cd $$i && $(MAKE) depend) || exit 1; done

4
configure vendored
View File

@ -3396,6 +3396,8 @@ Make.rules
Makefile
controls/Makefile
debugger/Makefile
dlls/Makefile
dlls/shell32/Makefile
documentation/Makefile
files/Makefile
graphics/Makefile
@ -3531,6 +3533,8 @@ CONFIG_FILES=\${CONFIG_FILES-"Make.rules
Makefile
controls/Makefile
debugger/Makefile
dlls/Makefile
dlls/shell32/Makefile
documentation/Makefile
files/Makefile
graphics/Makefile

View File

@ -460,6 +460,8 @@ Make.rules
Makefile
controls/Makefile
debugger/Makefile
dlls/Makefile
dlls/shell32/Makefile
documentation/Makefile
files/Makefile
graphics/Makefile

View File

@ -2,7 +2,7 @@
* Undocumented functions from COMCTL32.DLL
*
* Copyright 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
*
* 1998 Juergen Schmied <j.schmied@metronet.de>
* NOTES
* All of these functions are UNDOCUMENTED!! And I mean UNDOCUMENTED!!!!
* Do NOT rely on names or contents of undocumented structures and types!!!
@ -22,17 +22,6 @@
#include "heap.h"
#include "debug.h"
typedef struct _DSA_DATA
{
DWORD dwEntryCount;
DWORD dwMaxCount;
DWORD dwInitial;
DWORD dwGrow;
LPSTR *ptrs;
} DSA_DATA, *LPDSA_DATA;
typedef struct _DPA_DATA
{
DWORD dwEntryCount;
@ -47,22 +36,30 @@ DWORD WINAPI DPA_GetPtr (DWORD, DWORD);
DWORD WINAPI DPA_InsertPtr (DWORD, DWORD, DWORD);
CRITICAL_SECTION cs_comctl_alloc;
HANDLE32 hComctl32Heap=0;
/**************************************************************************
* Alloc [COMCTL32.71]
*
*/
LPVOID WINAPI
COMCTL32_Alloc (DWORD dwParam)
{
LPVOID lpPtr;
LPVOID WINAPI COMCTL32_Alloc (DWORD dwParam)
{ LPVOID lpPtr;
lpPtr = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, dwParam);
TRACE (commctrl, "(0x%08lx)\n", dwParam);
TRACE (commctrl, "(0x%08lx) ret=0x%08lx\n", dwParam, (DWORD)lpPtr);
if (hComctl32Heap==0)
{ EnterCriticalSection((void*)&cs_comctl_alloc);
hComctl32Heap=HeapCreate(0,1,0x4000000);
LeaveCriticalSection((void*)&cs_comctl_alloc);
TRACE (commctrl, "Heap created: 0x%08x\n", hComctl32Heap);
if (! hComctl32Heap)
return FALSE;
}
// lpPtr = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, dwParam);
lpPtr = HeapAlloc (hComctl32Heap, HEAP_ZERO_MEMORY, dwParam);
TRACE (commctrl, "-- ret=%p\n", lpPtr);
return lpPtr;
}
@ -76,16 +73,16 @@ LPVOID WINAPI
COMCTL32_ReAlloc (LPVOID dwParam1, DWORD dwParam2)
{
LPVOID dwPtr;
TRACE (commctrl, "(0x%08lx 0x%08lx)\n",(DWORD)dwParam1, dwParam2);
if (dwParam1 == 0)
dwPtr = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
dwPtr = HeapAlloc (hComctl32Heap, HEAP_ZERO_MEMORY,
dwParam2);
else
dwPtr = HeapReAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
dwPtr = HeapReAlloc (hComctl32Heap, HEAP_ZERO_MEMORY,
dwParam1, dwParam2);
TRACE (commctrl, "(0x%08lx 0x%08lx) ret=0x%08lx\n",
(DWORD)dwParam1, dwParam2, (DWORD)dwPtr);
TRACE (commctrl, "-- ret=0x%08lx\n", (DWORD)dwPtr);
return dwPtr;
}
@ -100,7 +97,7 @@ DWORD WINAPI
COMCTL32_Free (LPVOID dwParam)
{
TRACE (commctrl, "(0x%08lx)\n", (DWORD)dwParam);
HeapFree (GetProcessHeap (), 0, dwParam);
HeapFree (hComctl32Heap, 0, dwParam);
return 0;
}
@ -115,7 +112,7 @@ DWORD WINAPI
COMCTL32_GetSize (LPVOID dwParam)
{
TRACE (commctrl, "(0x%08lx)\n", (DWORD)dwParam);
return (HeapSize (GetProcessHeap (), 0, dwParam));
return (HeapSize (hComctl32Heap, 0, dwParam));
}
@ -155,217 +152,283 @@ COMCTL32_Str_SetPtrA (LPSTR lpStr, LPVOID *lpPtr)
return FALSE;
}
/*************************************************************************
* The DSA-API is a set of functions to create and manipulate arrays of
* fix sized memory blocks. This arrays can store any kind of data (strings,
* icons...) so the name "dynamic string array" is a bit misleading.
*
* STATUS
* complete
*/
typedef struct _DSA_DATA
{ DWORD dwEntryCount;
BYTE * pData;
DWORD dwMaxCount;
DWORD dwElementSize;
DWORD dwGrow;
} DSA_DATA, *LPDSA_DATA;
/**************************************************************************
* DSA_Create [COMCTL32.320] Creates a dynamic string array
*
* PARAMS
* dwParam1 [I]
* dwParam2 [I]
* dwSize [I] size of the array elements
* dwGrow [I]
* RETURNS
* pointer to a array control structure. use this like a handle.
*/
DWORD WINAPI
DSA_Create (DWORD dwParam1, DWORD dwParam2)
{
LPDSA_DATA dsaPtr;
LPDSA_DATA WINAPI DSA_Create (DWORD dwSize, DWORD dwGrow)
{ LPDSA_DATA dsaPtr;
dsaPtr = (LPDSA_DATA)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
sizeof(DSA_DATA));
dsaPtr->dwInitial = dwParam1;
dsaPtr->dwGrow = dwParam2;
TRACE (commctrl, "(size=0x%08lx grow=0x%08lx)\n", dwSize, dwGrow);
TRACE (commctrl, "(0x%08lx 0x%08lx) ret=0x%08lx\n",
dwParam1, dwParam2, (DWORD)dsaPtr);
return (DWORD)dsaPtr;
if ((dsaPtr=(LPDSA_DATA)COMCTL32_Alloc(sizeof(DSA_DATA))));
{ dsaPtr->dwEntryCount=0x00;
dsaPtr->pData=NULL;
dsaPtr->dwMaxCount=0x00;
dsaPtr->dwElementSize=dwSize;
if ( dwGrow == 0 )
dsaPtr->dwGrow=1;
else
dsaPtr->dwGrow=dwGrow;
return dsaPtr;
}
return FALSE;
}
/**************************************************************************
* DSA_Destroy [COMCTL32.321] Destroys a dynamic string array
*
* PARAMS
* dwParam1 [I]
* dsaPtr [I] pointer to the array control structure
* RETURNS
* TRUE if dsaPtr = NULL or success
* FALSE if failure
*/
DWORD WINAPI
DSA_Destroy (DWORD dwParam1)
{
LPDSA_DATA dsaPtr = (LPDSA_DATA)dwParam1;
DWORD i;
BOOL32 WINAPI DSA_Destroy (const LPDSA_DATA dsaPtr )
{ TRACE (commctrl, "(%p)\n", dsaPtr);
TRACE (commctrl, "(0x%08lx):semi-stub!\n", dwParam1);
if (! dsaPtr)
return FALSE;
if (dsaPtr->ptrs) {
for (i = 0; i < dsaPtr->dwEntryCount; i++) {
if (dsaPtr->ptrs[i])
HeapFree (GetProcessHeap (), 0, (LPSTR)dsaPtr->ptrs[i]);
}
if (dsaPtr->pData && (! COMCTL32_Free(dsaPtr->pData)))
{ return FALSE;
}
HeapFree (GetProcessHeap (), 0, dsaPtr);
return 0;
return COMCTL32_Free (dsaPtr);
}
/**************************************************************************
* DSA_GetItem [COMCTL32.322]
*
* PARAMS
* dsaPtr [I] pointer to the array control structure
* dwItem [I] number of the Item to get
+ * pDest [O] destination buffer. Has to be >= dwElementSize.
*/
DWORD WINAPI
DSA_GetItem (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3)
{
LPDSA_DATA dsaPtr = (LPDSA_DATA)dwParam1;
BOOL32 WINAPI DSA_GetItem (const LPDSA_DATA dsaPtr, DWORD dwItem, LPBYTE pDest)
{ BYTE * pSrc;
FIXME (commctrl, "(0x%08lx 0x%08lx 0x%08lx): stub!\n",
dwParam1, dwParam2, dwParam3);
if (dsaPtr == NULL)
return 0;
if (dsaPtr->ptrs == NULL)
return 0;
if ((dwParam2 < 0) || (dwParam2 >= dsaPtr->dwEntryCount))
return 0;
// FIXME (commctrl, "\"%s\"\n", (LPSTR)dsaPtr->ptrs[dwParam2]);
return (DWORD)lstrcpy32A ((LPSTR)dwParam3, (LPSTR)dsaPtr->ptrs[dwParam2]);
TRACE (commctrl, "(%p 0x%08lx %p)\n", dsaPtr, dwItem, pDest);
if ( (!dsaPtr) || (dwItem < 0) || (dwItem >= dsaPtr->dwEntryCount))
return FALSE;
pSrc = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem);
memmove(pDest,pSrc,dsaPtr->dwElementSize);
return TRUE;
}
/**************************************************************************
* DSA_GetItemPtr [COMCTL32.323]
*
* PARAMS
* dsaPtr [I] pointer to the array control structure
* dwItem [I] number of the Item to get
* RETURNS
* pointer ti a item
*/
LPBYTE WINAPI DSA_GetItemPtr (const LPDSA_DATA dsaPtr, DWORD dwItem)
{ BYTE * pSrc;
DWORD WINAPI
DSA_GetItemPtr (DWORD dwParam1, DWORD dwParam2)
{
LPDSA_DATA dsaPtr = (LPDSA_DATA)dwParam1;
TRACE (commctrl, "(%p 0x%08lx)\n", dsaPtr, dwItem);
TRACE (commctrl, "(0x%08lx 0x%08lx)\n", dwParam1, dwParam2);
if ((!dsaPtr) || (dwItem < 0) || (dwItem >= dsaPtr->dwEntryCount))
return FALSE;
pSrc = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem);
TRACE (commctrl, "-- ret=%p\n", pSrc);
if (dsaPtr == NULL)
return 0;
if (dsaPtr->ptrs == NULL)
return 0;
if ((dwParam2 < 0) || (dwParam2 >= dsaPtr->dwEntryCount))
return 0;
TRACE (commctrl, "ret=0x%08lx\n", (DWORD)dsaPtr->ptrs[dwParam2]);
return (DWORD)dsaPtr->ptrs[dwParam2];
return pSrc;
}
/**************************************************************************
* DSA_SetItem [COMCTL32.325]
*
* PARAMS
* dsaPtr [I] pointer to the array control structure
* dwItem [I] index for the new element
* pSrc [I] the element
*/
BOOL32 WINAPI DSA_SetItem (const LPDSA_DATA dsaPtr, DWORD dwItem, LPBYTE pSrc)
{ LPBYTE pDest;
DWORD dwSize, dwNewItems;
LPBYTE lpTemp;
TRACE (commctrl, "(%p 0x%08lx %p)\n", dsaPtr, dwItem, pSrc);
DWORD WINAPI
DSA_InsertItem (DWORD dwParam1, DWORD dwParam2, LPSTR lpString)
{
LPDSA_DATA dsaPtr = (LPDSA_DATA)dwParam1;
DWORD dwIndex;
INT32 len;
TRACE (commctrl, "(0x%08lx 0x%08lx \"%s\"):semi-stub!\n",
dwParam1, dwParam2, lpString);
if (dsaPtr->ptrs == NULL) {
dsaPtr->ptrs = (LPSTR*)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
dsaPtr->dwInitial * sizeof(LPVOID));
dsaPtr->dwMaxCount = dsaPtr->dwInitial;
dwIndex = 0;
len = lstrlen32A (lpString);
dsaPtr->ptrs[dwIndex] =
(LPSTR)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, len+1);
lstrcpy32A (dsaPtr->ptrs[dwIndex], lpString);
if ((!dsaPtr) || dwItem<0 )
return FALSE;
if (dsaPtr->dwEntryCount <= dwItem) /* within the old array */
{ if ( dsaPtr->dwMaxCount > dwItem)
{ dsaPtr->dwEntryCount = dwItem; /* within the allocated space, set a new boundary */
}
else
{ /* resize the block of memory*/
dwNewItems = dsaPtr->dwGrow * ( (WORD)((dwItem-1)/dsaPtr->dwGrow) +1);
dwSize = dsaPtr->dwElementSize * dwNewItems;
lpTemp = (LPBYTE) COMCTL32_ReAlloc(dsaPtr->pData,dwSize);
if (! lpTemp )
{ return FALSE;
}
dsaPtr->dwMaxCount = dwNewItems;
dsaPtr->pData = lpTemp;
}
}
else {
TRACE (commctrl, "(0x%08lx 0x%08lx)\n",
dsaPtr->dwEntryCount, dsaPtr->dwMaxCount);
if (dwParam2 >= dsaPtr->dwEntryCount) {
if (dsaPtr->dwEntryCount < dsaPtr->dwMaxCount) {
dwIndex = dsaPtr->dwEntryCount;
len = lstrlen32A (lpString);
dsaPtr->ptrs[dwIndex] =
(LPSTR)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, len+1);
lstrcpy32A (dsaPtr->ptrs[dwIndex], lpString);
}
else {
/* allocate new pointer list and copy all pointers */
LPSTR *lpOldPtrs = dsaPtr->ptrs;
dsaPtr->ptrs = (LPSTR*)HeapAlloc (SystemHeap, HEAP_ZERO_MEMORY,
(dsaPtr->dwInitial + dsaPtr->dwGrow) *
sizeof(LPVOID));
memcpy (dsaPtr->ptrs, lpOldPtrs,
dsaPtr->dwMaxCount * sizeof(LPVOID));
dsaPtr->dwMaxCount += dsaPtr->dwGrow;
HeapFree (GetProcessHeap (), 0, lpOldPtrs);
/* put the new entry in */
pDest = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem);
TRACE (commctrl,"move dest=%p src=%p size=%x",pDest,pSrc,dsaPtr->dwElementSize);
memmove(pDest,pSrc,dsaPtr->dwElementSize);
return TRUE;
}
/* add new string */
dwIndex = dsaPtr->dwEntryCount;
len = lstrlen32A (lpString);
dsaPtr->ptrs[dwIndex] =
(LPSTR)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, len+1);
lstrcpy32A (dsaPtr->ptrs[dwIndex], lpString);
}
}
else {
FIXME (commctrl, "inserting! stub!\n");
/**************************************************************************
* DSA_InsertItem [COMCTL32.325]
*
* PARAMS
* dsaPtr [I] pointer to the array control structure
* dwItem [I] index for the new element
* pSrc [I] the element
*
* RETURNS
* the position of the new element
*/
DWORD WINAPI DSA_InsertItem (const LPDSA_DATA dsaPtr, DWORD dwItem, LPBYTE pSrc)
{ DWORD dwNewItems, dwSize,i;
LPBYTE lpTemp, lpDest;
LPDWORD p;
TRACE(commctrl, "(%p 0x%08lx %p)\n", dsaPtr, dwItem, pSrc);
dwIndex = dwParam2;
}
if ( (!dsaPtr) || dwItem<0 )
return -1;
for (i=0; i<dsaPtr->dwElementSize;i+=4)
{ p = *(DWORD**)(pSrc+i);
if ( IsBadStringPtr32A ((char*)p,256))
{ TRACE(commctrl,"-- 0x%04lx=%p\n",i,(DWORD*)p);
}
else
{ TRACE(commctrl,"-- 0x%04lx=%p [%s]\n",i,p,debugstr_a((char*)p));
}
}
if (dwItem > dsaPtr->dwEntryCount) /* when dwItem > dwEntryCount then append*/
dwItem = dsaPtr->dwEntryCount+1;
if (dwItem >= dsaPtr->dwMaxCount) /* do we need to resize ? */
{ dwNewItems = dsaPtr->dwMaxCount + dsaPtr->dwGrow;
dwSize = dsaPtr->dwElementSize * dwNewItems;
lpTemp = (LPBYTE)COMCTL32_ReAlloc(dsaPtr->pData,dwSize);
if (!lpTemp)
{ return -1;
}
dsaPtr->dwMaxCount = dwNewItems;
dsaPtr->pData = lpTemp;
}
if (dwItem < dsaPtr->dwEntryCount) /* do we need to move elements ?*/
{ lpTemp = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem);
lpDest = lpTemp + dsaPtr->dwElementSize;
TRACE (commctrl,"-- move dest=%p src=%p size=%x\n",lpDest,lpTemp,dsaPtr->dwElementSize);
memmove (lpDest,lpTemp,dsaPtr->dwElementSize);
}
/* ok, we can put the new Item in*/
dsaPtr->dwEntryCount++;
TRACE (commctrl, "ret=0x%08lx\n", dwIndex);
return (dwIndex);
lpDest = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem);
TRACE (commctrl,"-- move dest=%p src=%p size=%x\n",lpDest,pSrc,dsaPtr->dwElementSize);
memmove (lpDest,pSrc,dsaPtr->dwElementSize);
return dsaPtr->dwEntryCount;
}
/**************************************************************************
* DSA_DeleteItem [COMCTL32.326]
*
* PARAMS
* dsaPtr [I] pointer to the array control structure
* dwItem [I] index for the element to delete
* RETURNS
* number of the element deleted
*/
DWORD WINAPI DSA_DeleteItem (const LPDSA_DATA dsaPtr, DWORD dwItem)
{ LPBYTE lpDest,lpSrc;
DWORD dwSize;
TRACE (commctrl, "(%p 0x%08lx)\n", dsaPtr, dwItem);
if ( (! dsaPtr) || dwItem<0 || dwItem>=dsaPtr->dwEntryCount)
return FALSE;
DWORD WINAPI
DSA_DeleteItem (DWORD dwParam1, DWORD dwParam2)
{
LPDSA_DATA dsaPtr = (LPDSA_DATA)dwParam1;
TRACE (commctrl, "(0x%08lx 0x%08lx):semi-stub!\n",
dwParam1, dwParam2);
if (dsaPtr->ptrs) {
if (dsaPtr->dwEntryCount == 1) {
if (dsaPtr->ptrs[dwParam2])
HeapFree (GetProcessHeap (), 0, dsaPtr->ptrs[dwParam2]);
dsaPtr->dwEntryCount--;
if ( dwItem < dsaPtr->dwEntryCount-1 ) /* do we need to move ?*/
{ lpDest = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem);
lpSrc = lpDest + dsaPtr->dwElementSize;
dwSize = dsaPtr->dwElementSize * (dsaPtr->dwEntryCount-dwItem-1);
TRACE (commctrl,"-- move dest=%p src=%p size=%x\n",lpDest,lpSrc,dwSize);
memmove (lpDest,lpSrc,dwSize);
}
else {
LPSTR *oldPtrs = dsaPtr->ptrs;
TRACE (commctrl, "complex delete!\n");
dsaPtr->dwEntryCount--;
if ( (dsaPtr->dwMaxCount-dsaPtr->dwEntryCount) >= dsaPtr->dwGrow) /* free memory ?*/
{ dwSize = dsaPtr->dwElementSize * dsaPtr->dwEntryCount;
lpDest = (LPBYTE) COMCTL32_ReAlloc(dsaPtr->pData,dwSize);
if (!lpDest)
{ return FALSE;
}
dsaPtr->dwMaxCount = dsaPtr->dwEntryCount;
dsaPtr->pData = lpDest;
if (dsaPtr->ptrs[dwParam2])
HeapFree (GetProcessHeap (), 0, dsaPtr->ptrs[dwParam2]);
dsaPtr->dwEntryCount--;
dsaPtr->ptrs =
(LPSTR*)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
dsaPtr->dwEntryCount * sizeof(LPVOID));
if (dwParam2 > 0) {
memcpy (&dsaPtr->ptrs[0], &oldPtrs[0],
dwParam2 * sizeof(LPSTR));
}
if (dwParam2 < dsaPtr->dwEntryCount) {
memcpy (&dsaPtr->ptrs[dwParam2], &oldPtrs[dwParam2+1],
(dsaPtr->dwEntryCount - dwParam2) * sizeof(LPSTR));
}
HeapFree (GetProcessHeap (), 0, oldPtrs);
}
if (dsaPtr->dwEntryCount == 0) {
HeapFree (GetProcessHeap (), 0, dsaPtr->ptrs);
dsaPtr->ptrs = NULL;
}
}
return 0;
return dwItem;
}
/**************************************************************************
* DSA_DeleteAllItems [COMCTL32.326]
* deletes all elements and initializes array
*
* PARAMS
* dsaPtr [I] pointer to the array control structure
*
* RETURNS
* TRUE/FALSE
*/
BOOL32 WINAPI DSA_DeleteAllItems (const LPDSA_DATA dsaPtr)
{ TRACE (commctrl, "(%p)\n", dsaPtr);
if (! dsaPtr)
return FALSE;
if (dsaPtr->pData && (! COMCTL32_Free(dsaPtr->pData)))
{ return FALSE;
}
dsaPtr->dwEntryCount=0x00;
dsaPtr->pData=NULL;
dsaPtr->dwMaxCount=0x00;
return TRUE;
}
/**************************************************************************/
DWORD WINAPI

View File

@ -22,18 +22,43 @@
#include "updown.h"
#include "debug.h"
/***********************************************************************
* ComCtl32LibMain
* ComCtl32LibMain [Internal] Initializes the internal 'COMCTL32.DLL'.
*
* PARAMS
* hinstDLL [I]
* fdwReason [I]
* lpvReserved [I]
*
*/
BOOL32 WINAPI ComCtl32LibMain (HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ TRACE(commctrl,"%x,%lx,%p\n",hinstDLL,fdwReason,lpvReserved);
if ( fdwReason == DLL_PROCESS_ATTACH)
{ InitCommonControls();
}
return TRUE;
BOOL32 WINAPI
ComCtl32LibMain (HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE (commctrl, "%x,%lx,%p\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
TRACE (commctrl, "No animation class implemented!\n");
HEADER_Register ();
TRACE (commctrl, "No hotkey class implemented!\n");
LISTVIEW_Register ();
PROGRESS_Register ();
STATUS_Register ();
TRACE (commctrl, "No tab class implemented!\n");
TOOLBAR_Register ();
TOOLTIPS_Register ();
TRACKBAR_Register ();
TREEVIEW_Register ();
UPDOWN_Register ();
break;
}
return TRUE;
}
/***********************************************************************
* DrawStatusText32A [COMCTL32.5][COMCTL32.27]
*
@ -73,9 +98,18 @@ DrawStatusText32A (HDC32 hdc, LPRECT32 lprc, LPCSTR text, UINT32 style)
/***********************************************************************
* DrawStatusText32W [COMCTL32.28]
*
* Draws text with borders, like in a status bar.
*
* PARAMS
* hdc [I] handle to the window's display context
* lprc [I] pointer to a rectangle
* text [I] pointer to the text
* style [I]
*/
void WINAPI DrawStatusText32W( HDC32 hdc, LPRECT32 lprc, LPCWSTR text,
UINT32 style )
VOID WINAPI
DrawStatusText32W (HDC32 hdc, LPRECT32 lprc, LPCWSTR text, UINT32 style)
{
LPSTR p = HEAP_strdupWtoA( GetProcessHeap(), 0, text );
DrawStatusText32A(hdc, lprc, p, style);
@ -137,19 +171,14 @@ HWND32 WINAPI CreateUpDownControl( DWORD style, INT32 x, INT32 y,
* None.
*
* NOTES
* Calls InitCommonControlsEx.
* InitCommonControlsEx should be used instead.
* This function is just a dummy.
* The Win95 controls are registered at the DLL's initialization.
* To register other controls InitCommonControlsEx must be used.
*/
VOID WINAPI
InitCommonControls (VOID)
{
INITCOMMONCONTROLSEX icc;
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx (&icc);
}
@ -160,6 +189,10 @@ InitCommonControls (VOID)
*
* PARAMS
* lpInitCtrls [I] pointer to a INITCOMMONCONTROLS structure.
*
* NOTES
* Only the additinal common controls are registered by this function.
* The Win95 controls are registered at the DLL's initialization.
*/
BOOL32 WINAPI
@ -173,49 +206,21 @@ InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
if (lpInitCtrls == NULL) return FALSE;
if (lpInitCtrls->dwSize < sizeof(INITCOMMONCONTROLSEX)) return FALSE;
for (cCount = 0; cCount <= 31; cCount++) {
for (cCount = 0; cCount < 32; cCount++) {
dwMask = 1 << cCount;
if (!(lpInitCtrls->dwICC & dwMask))
continue;
switch (lpInitCtrls->dwICC & dwMask) {
case ICC_LISTVIEW_CLASSES:
LISTVIEW_Register ();
HEADER_Register ();
break;
case ICC_TREEVIEW_CLASSES:
TREEVIEW_Register ();
TOOLTIPS_Register ();
break;
case ICC_BAR_CLASSES:
TOOLBAR_Register ();
STATUS_Register ();
TRACKBAR_Register ();
TOOLTIPS_Register ();
break;
case ICC_TAB_CLASSES:
TRACE (commctrl, "No tab class implemented!\n");
TOOLTIPS_Register ();
UPDOWN_Register ();
break;
case ICC_UPDOWN_CLASS:
UPDOWN_Register ();
break;
case ICC_PROGRESS_CLASS:
PROGRESS_Register ();
break;
case ICC_HOTKEY_CLASS:
TRACE (commctrl, "No hotkey class implemented!\n");
break;
/* dummy initialization */
case ICC_ANIMATE_CLASS:
TRACE (commctrl, "No animation class implemented!\n");
case ICC_BAR_CLASSES:
case ICC_LISTVIEW_CLASSES:
case ICC_TREEVIEW_CLASSES:
case ICC_TAB_CLASSES:
case ICC_UPDOWN_CLASS:
case ICC_PROGRESS_CLASS:
case ICC_HOTKEY_CLASS:
break;
/* advanced classes - not included in Win95 */
@ -267,6 +272,10 @@ InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls)
* hInst
* hwndStatus
* lpwIDs
*
* NOTES
* Some features are still missing because of incomplete WM_MENUSELECT
* messages (16->32 bit conversion).
*/
VOID WINAPI
@ -528,32 +537,60 @@ GetEffectiveClientRect (HWND32 hwnd, LPRECT32 lpRect, LPINT32 lpInfo)
/***********************************************************************
* ShowHideMenuCtl [COMCTL32.3]
* ShowHideMenuCtl [COMCTL32.3]
*
* Shows or hides controls and updates the corresponding menu item.
*
* PARAMS
* hwnd [I] handle to the client window.
* uFlags [I] menu command id
* lpInfo [I] pointer to an array of integers
* uFlags [I] menu command id.
* lpInfo [I] pointer to an array of integers. (See NOTES.)
*
* NOTES
* The official documentation is incomplete! This has been fixed.
*
* lpInfo
* The array of integers contains pairs of values. BOTH values of
* the first pair must be the handles to application's main menu.
* Each subsequent pair consists of a menu id and control id.
*/
BOOL32 WINAPI
ShowHideMenuCtl (HWND32 hwnd, UINT32 uFlags, LPINT32 lpInfo)
{
LPINT32 lpMenuId;
FIXME (commctrl, "(0x%08x 0x%08x %p): empty stub!\n",
hwnd, uFlags, lpInfo);
#if 0
if (GetMenuState (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
/* checked -> hide control */
if (lpInfo == NULL)
return FALSE;
if (!(lpInfo[0]) || !(lpInfo[1]))
return FALSE;
/* search for control */
lpMenuId = &lpInfo[2];
while (*lpMenuId != uFlags)
lpMenuId += 2;
if (GetMenuState32 (lpInfo[1], uFlags, MF_BYCOMMAND) & MFS_CHECKED) {
/* uncheck menu item */
CheckMenuItem32 (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_UNCHECKED);
/* hide control */
lpMenuId++;
SetWindowPos32 (GetDlgItem32 (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
SWP_HIDEWINDOW);
}
else {
/* not checked -> show control */
/* check menu item */
CheckMenuItem32 (lpInfo[0], *lpMenuId, MF_BYCOMMAND | MF_CHECKED);
/* show control */
lpMenuId++;
SetWindowPos32 (GetDlgItem32 (hwnd, *lpMenuId), 0, 0, 0, 0, 0,
SWP_SHOWWINDOW);
}
#endif
return FALSE;
return TRUE;
}

View File

@ -3852,7 +3852,7 @@ BOOL32 WINAPI SetMenuItemInfo32W(HMENU32 hmenu, UINT32 item, BOOL32 bypos,
/**********************************************************************
* SetMenuDefaultItem32 (USER32.489)
*/
BOOL32 WINAPI SetMenuDefaultItem32(HMENU32 hmenu, UINT32 item, BOOL32 bypos)
BOOL32 WINAPI SetMenuDefaultItem32(HMENU32 hmenu, UINT32 item, UINT32 bypos)
{
MENUITEM *menuitem = MENU_FindItem(&hmenu, &item, bypos);
POPUPMENU *menu;
@ -3938,7 +3938,7 @@ BOOL32 WINAPI InsertMenuItem32W(HMENU32 hMenu, UINT32 uItem, BOOL32 bypos,
BOOL32 WINAPI CheckMenuRadioItem32(HMENU32 hMenu,
UINT32 first, UINT32 last, UINT32 check,
BOOL32 bypos)
UINT32 bypos)
{
MENUITEM *mifirst, *milast, *micheck;
HMENU32 mfirst = hMenu, mlast = hMenu, mcheck = hMenu;

View File

@ -24,6 +24,17 @@
#define PAGER_GetInfoPtr(wndPtr) ((PAGER_INFO *)wndPtr->wExtra[0])
static __inline__ LRESULT
PAGER_ForwardMouse (WND *wndPtr, WPARAM32 wParam)
{
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr);
infoPtr->bForward = (BOOL32)wParam;
return 0;
}
static __inline__ LRESULT
PAGER_GetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
@ -51,6 +62,28 @@ PAGER_GetButtonSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << PAGER_GetButtonState >>
// << PAGER_GetDropTarget >>
static __inline__ LRESULT
PAGER_GetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr);
return infoPtr->iPos;
}
static LRESULT
PAGER_RecalcSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
// PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr);
FIXME (pager, "empty stub!\n");
return 0;
}
static __inline__ LRESULT
@ -108,6 +141,18 @@ PAGER_SetChild (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
static __inline__ LRESULT
PAGER_SetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr);
infoPtr->iPos = (INT32)lParam;
/* FIXME: redraw */
return 0;
}
static LRESULT
PAGER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
@ -120,7 +165,7 @@ PAGER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
wndPtr->wExtra[0] = (DWORD)infoPtr;
if (infoPtr == NULL) {
ERR (treeview, "could not allocate info memory!\n");
ERR (pager, "could not allocate info memory!\n");
return 0;
}
@ -134,6 +179,7 @@ PAGER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->clrBk = GetSysColor32 (COLOR_BTNFACE);
infoPtr->iBorder = 0;
infoPtr->iButtonSize = 0;
infoPtr->iPos = 0;
return 0;
@ -148,7 +194,7 @@ PAGER_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
/* free tree view info data */
/* free pager info data */
HeapFree (GetProcessHeap (), 0, infoPtr);
return 0;
@ -169,15 +215,19 @@ PAGER_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << PAGER_MouseMove >>
// << PAGER_Paint >>
LRESULT WINAPI
PagerWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
PAGER_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg)
{
// case PGM_FORWARDMOUSE:
case PGM_FORWARDMOUSE:
return PAGER_ForwardMouse (wndPtr, wParam);
case PGM_GETBKCOLOR:
return PAGER_GetBkColor (wndPtr, wParam, lParam);
@ -190,8 +240,12 @@ PagerWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
// case PGM_GETBUTTONSTATE:
// case PGM_GETDROPTARGET:
// case PGM_GETPOS:
// case PGM_RECALCSIZE:
case PGM_GETPOS:
return PAGER_SetPos (wndPtr, wParam, lParam);
case PGM_RECALCSIZE:
return PAGER_RecalcSize (wndPtr, wParam, lParam);
case PGM_SETBKCOLOR:
return PAGER_SetBkColor (wndPtr, wParam, lParam);
@ -205,7 +259,8 @@ PagerWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case PGM_SETCHILD:
return PAGER_SetChild (wndPtr, wParam, lParam);
// case PGM_SETPOS:
case PGM_SETPOS:
return PAGER_SetPos (wndPtr, wParam, lParam);
case WM_CREATE:
return PAGER_Create (wndPtr, wParam, lParam);
@ -242,7 +297,7 @@ PAGER_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
wndClass.lpfnWndProc = (WNDPROC32)PagerWindowProc;
wndClass.lpfnWndProc = (WNDPROC32)PAGER_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(PAGER_INFO *);
wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);

View File

@ -24,18 +24,573 @@
#define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0])
// << REBAR_BeginDrag >>
// << REBAR_DeleteBand >>
// << REBAR_DragMove >>
// << REBAR_EndDrag >>
// << REBAR_GetBandBorders >>
__inline__ static LRESULT
REBAR_GetBandCount (WND *wndPtr)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
TRACE (rebar, "band count %u!\n", infoPtr->uNumBands);
return infoPtr->uNumBands;
}
static LRESULT
REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
REBAR_BAND *lpBand;
if (lprbbi == NULL)
return FALSE;
if (lprbbi->cbSize < sizeof (LPREBARBANDINFO32A))
return FALSE;
if ((UINT32)wParam >= infoPtr->uNumBands)
return FALSE;
TRACE (rebar, "index %u\n", (UINT32)wParam);
/* copy band information */
lpBand = &infoPtr->bands[(UINT32)wParam];
if (lprbbi->fMask & RBBIM_STYLE)
lprbbi->fStyle = lpBand->fStyle;
if (lprbbi->fMask & RBBIM_COLORS) {
lprbbi->clrFore = lpBand->clrFore;
lprbbi->clrBack = lpBand->clrBack;
}
if ((lprbbi->fMask & RBBIM_TEXT) &&
(lprbbi->lpText) && (lpBand->lpText)) {
lstrcpyn32A (lprbbi->lpText, lpBand->lpText, lprbbi->cch);
}
if (lprbbi->fMask & RBBIM_IMAGE)
lprbbi->iImage = lpBand->iImage;
if (lprbbi->fMask & RBBIM_CHILD)
lprbbi->hwndChild = lpBand->hwndChild;
if (lprbbi->fMask & RBBIM_CHILDSIZE) {
lprbbi->cxMinChild = lpBand->cxMinChild;
lprbbi->cyMinChild = lpBand->cyMinChild;
lprbbi->cyMaxChild = lpBand->cyMaxChild;
lprbbi->cyChild = lpBand->cyChild;
lprbbi->cyIntegral = lpBand->cyIntegral;
}
if (lprbbi->fMask & RBBIM_SIZE)
lprbbi->cx = lpBand->cx;
if (lprbbi->fMask & RBBIM_BACKGROUND)
lprbbi->hbmBack = lpBand->hbmBack;
if (lprbbi->fMask & RBBIM_ID)
lprbbi->wID = lpBand->wID;
/* FIXME: check for size of band info structure */
if (lprbbi->fMask & RBBIM_IDEALSIZE)
lprbbi->cxIdeal = lpBand->cxIdeal;
if (lprbbi->fMask & RBBIM_LPARAM)
lprbbi->lParam = lpBand->lParam;
if (lprbbi->fMask & RBBIM_HEADERSIZE)
lprbbi->cxHeader = lpBand->cxHeader;
return TRUE;
}
// << REBAR_GetBandInfo32W >>
// << REBAR_GetBarHeight >>
static LRESULT
REBAR_GetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
LPREBARINFO lpInfo = (LPREBARINFO)lParam;
if (lpInfo == NULL)
return FALSE;
if (lpInfo->cbSize < sizeof (REBARINFO))
return FALSE;
TRACE (rebar, "getting bar info!\n");
if (infoPtr->himl) {
lpInfo->himl = infoPtr->himl;
lpInfo->fMask |= RBIM_IMAGELIST;
}
return TRUE;
}
__inline__ static LRESULT
REBAR_GetBkColor (WND *wndPtr)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
return infoPtr->clrBk;
}
// << REBAR_GetColorScheme >>
// << REBAR_GetRowHeight >>
__inline__ static LRESULT
REBAR_GetTextColor (WND *wndPtr)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
return infoPtr->clrText;
}
// << REBAR_GetToolTips >>
// << REBAR_GetUnicodeFormat >>
// << REBAR_HitTest >>
static LRESULT
REBAR_IdToIndex (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
UINT32 i;
if (infoPtr == NULL)
return -1;
if (infoPtr->uNumBands < 1)
return -1;
TRACE (rebar, "id %u\n", (UINT32)wParam);
for (i = 0; i < infoPtr->uNumBands; i++) {
if (infoPtr->bands[i].wID == (UINT32)wParam)
return i;
}
return -1;
}
static LRESULT
REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
UINT32 uIndex = (UINT32)wParam;
REBAR_BAND *lpBand;
if (infoPtr == NULL)
return FALSE;
if (lprbbi == NULL)
return FALSE;
if (lprbbi->cbSize < sizeof (REBARBANDINFO32A))
return FALSE;
if (infoPtr->uNumBands == 0) {
infoPtr->bands =
(REBAR_BAND *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
sizeof (REBAR_BAND));
uIndex = 0;
}
else {
REBAR_BAND *oldBands = infoPtr->bands;
infoPtr->bands =
(REBAR_BAND *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
(infoPtr->uNumBands+1)*sizeof(REBAR_BAND));
if ((INT32)uIndex == -1)
uIndex = infoPtr->uNumBands;
/* pre copy */
/* post copy */
HeapFree (GetProcessHeap (), 0, &oldBands);
}
infoPtr->uNumBands++;
TRACE (rebar, "index %u!\n", uIndex);
/* initialize band (infoPtr->bands[uIndex])*/
lpBand = &infoPtr->bands[uIndex];
if (lprbbi->fMask & RBBIM_STYLE)
lpBand->fStyle = lprbbi->fStyle;
if (lprbbi->fMask & RBBIM_COLORS) {
lpBand->clrFore = lprbbi->clrFore;
lpBand->clrBack = lprbbi->clrBack;
}
if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
INT32 len = lstrlen32A (lprbbi->lpText);
if (len > 0) {
lpBand->lpText =
(LPSTR)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, len + 1);
lstrcpy32A (lpBand->lpText, lprbbi->lpText);
}
}
if (lprbbi->fMask & RBBIM_IMAGE)
lpBand->iImage = lprbbi->iImage;
if (lprbbi->fMask & RBBIM_CHILD)
lpBand->hwndChild = lprbbi->hwndChild;
if (lprbbi->fMask & RBBIM_CHILDSIZE) {
lpBand->cxMinChild = lprbbi->cxMinChild;
lpBand->cyMinChild = lprbbi->cyMinChild;
lpBand->cyMaxChild = lprbbi->cyMaxChild;
lpBand->cyChild = lprbbi->cyChild;
lpBand->cyIntegral = lprbbi->cyIntegral;
}
if (lprbbi->fMask & RBBIM_SIZE)
lpBand->cx = lprbbi->cx;
if (lprbbi->fMask & RBBIM_BACKGROUND)
lpBand->hbmBack = lprbbi->hbmBack;
if (lprbbi->fMask & RBBIM_ID)
lpBand->wID = lprbbi->wID;
/* FIXME: check for size of band info structure */
if (lprbbi->fMask & RBBIM_IDEALSIZE)
lpBand->cxIdeal = lprbbi->cxIdeal;
if (lprbbi->fMask & RBBIM_LPARAM)
lpBand->lParam = lprbbi->lParam;
if (lprbbi->fMask & RBBIM_HEADERSIZE)
lpBand->cxHeader = lprbbi->cxHeader;
return TRUE;
}
// << REBAR_InsertBand32W >>
// << REBAR_MaximizeBand >>
// << REBAR_MinimizeBand >>
// << REBAR_MoveBand >>
static LRESULT
REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
LPREBARBANDINFO32A lprbbi = (LPREBARBANDINFO32A)lParam;
REBAR_BAND *lpBand;
if (lprbbi == NULL)
return FALSE;
if (lprbbi->cbSize < sizeof (LPREBARBANDINFO32A))
return FALSE;
if ((UINT32)wParam >= infoPtr->uNumBands)
return FALSE;
TRACE (rebar, "index %u\n", (UINT32)wParam);
/* set band information */
lpBand = &infoPtr->bands[(UINT32)wParam];
if (lprbbi->fMask & RBBIM_STYLE)
lpBand->fStyle = lprbbi->fStyle;
if (lprbbi->fMask & RBBIM_COLORS) {
lpBand->clrFore = lprbbi->clrFore;
lpBand->clrBack = lprbbi->clrBack;
}
if ((lprbbi->fMask & RBBIM_TEXT) && (lprbbi->lpText)) {
/*
INT32 len = lstrlen32A (lprbbi->lpText);
if (len > 0) {
lpBand->lpText =
(LPSTR)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, len + 1);
lstrcpy32A (lpBand->lpText, lprbbi->lpText);
}
*/
}
if (lprbbi->fMask & RBBIM_IMAGE)
lpBand->iImage = lprbbi->iImage;
if (lprbbi->fMask & RBBIM_CHILD)
lpBand->hwndChild = lprbbi->hwndChild;
if (lprbbi->fMask & RBBIM_CHILDSIZE) {
lpBand->cxMinChild = lprbbi->cxMinChild;
lpBand->cyMinChild = lprbbi->cyMinChild;
lpBand->cyMaxChild = lprbbi->cyMaxChild;
lpBand->cyChild = lprbbi->cyChild;
lpBand->cyIntegral = lprbbi->cyIntegral;
}
if (lprbbi->fMask & RBBIM_SIZE)
lpBand->cx = lprbbi->cx;
if (lprbbi->fMask & RBBIM_BACKGROUND)
lpBand->hbmBack = lprbbi->hbmBack;
if (lprbbi->fMask & RBBIM_ID)
lpBand->wID = lprbbi->wID;
/* FIXME: check for size of band info structure */
if (lprbbi->fMask & RBBIM_IDEALSIZE)
lpBand->cxIdeal = lprbbi->cxIdeal;
if (lprbbi->fMask & RBBIM_LPARAM)
lpBand->lParam = lprbbi->lParam;
if (lprbbi->fMask & RBBIM_HEADERSIZE)
lpBand->cxHeader = lprbbi->cxHeader;
return TRUE;
}
// << REBAR_SetBandInfo32W >>
static LRESULT
REBAR_SetBarInfo (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
LPREBARINFO lpInfo = (LPREBARINFO)lParam;
if (lpInfo == NULL)
return FALSE;
if (lpInfo->cbSize < sizeof (REBARINFO))
return FALSE;
TRACE (rebar, "setting bar info!\n");
if (lpInfo->fMask & RBIM_IMAGELIST)
infoPtr->himl = lpInfo->himl;
return TRUE;
}
static LRESULT
REBAR_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
COLORREF clrTemp;
clrTemp = infoPtr->clrBk;
infoPtr->clrBk = (COLORREF)lParam;
TRACE (rebar, "background color 0x%06lx!\n", infoPtr->clrBk);
return clrTemp;
}
// << REBAR_SetColorScheme >>
// << REBAR_SetPalette >>
// << REBAR_SetParent >>
static LRESULT
REBAR_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr);
COLORREF clrTemp;
clrTemp = infoPtr->clrText;
infoPtr->clrText = (COLORREF)lParam;
TRACE (rebar, "text color 0x%06lx!\n", infoPtr->clrText);
return clrTemp;
}
// << REBAR_SetTooltips >>
// << REBAR_SetUnicodeFormat >>
// << REBAR_ShowBand >>
// << REBAR_SizeToRect >>
static LRESULT
REBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = (REBAR_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY,
sizeof(REBAR_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr;
if (infoPtr == NULL) {
ERR (rebar, "could not allocate info memory!\n");
return 0;
}
if ((REBAR_INFO*)wndPtr->wExtra[0] != infoPtr) {
ERR (rebar, "pointer assignment error!\n");
return 0;
}
infoPtr->clrText = CLR_NONE;
infoPtr->clrText = RGB(0, 0, 0);
TRACE (rebar, "created!\n");
return 0;
}
static LRESULT
REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
REBAR_INFO *infoPtr = REBAR_GetInfoPtr(wndPtr);
REBAR_BAND *lpBand;
INT32 i;
/* free rebar bands */
if ((infoPtr->uNumBands > 0) && infoPtr->bands) {
/* clean up each band */
for (i = 0; i < infoPtr->uNumBands; i++) {
lpBand = &infoPtr->bands[i];
/* delete text strings */
if (lpBand->lpText) {
HeapFree (GetProcessHeap (), 0, lpBand->lpText);
lpBand->lpText = NULL;
}
}
/* free band array */
HeapFree (GetProcessHeap (), 0, infoPtr->bands);
infoPtr->bands = NULL;
}
/* free rebar info data */
HeapFree (GetProcessHeap (), 0, infoPtr);
TRACE (rebar, "destroyed!\n");
return 0;
}
LRESULT WINAPI
RebarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg)
{
// case WM_CREATE:
// return REBAR_Create (wndPtr, wParam, lParam);
// case RB_BEGINDRAG:
// case RB_DELETEBAND:
// case RB_DRAGMOVE:
// case RB_ENDDRAG:
// case RB_GETBANDBORDERS:
// case WM_DESTROY:
// return REBAR_Destroy (wndPtr, wParam, lParam);
case RB_GETBANDCOUNT:
return REBAR_GetBandCount (wndPtr);
// case RB_GETBANDINFO32: /* outdated, just for compatibility */
case RB_GETBANDINFO32A:
return REBAR_GetBandInfo32A (wndPtr, wParam, lParam);
// case RB_GETBANDINFO32W:
// case RB_GETBARHEIGHT:
case RB_GETBARINFO:
return REBAR_GetBarInfo (wndPtr, wParam, lParam);
case RB_GETBKCOLOR:
return REBAR_GetBkColor (wndPtr);
// case RB_GETCOLORSCHEME:
// case RB_GETDROPTARGET:
// case RB_GETPALETTE:
// case RB_GETRECT:
// case RB_GETROWCOUNT:
// case RB_GETROWHEIGHT:
case RB_GETTEXTCOLOR:
return REBAR_GetTextColor (wndPtr);
// case RB_GETTOOLTIPS:
// case RB_GETUNICODEFORMAT:
// case RB_HITTEST:
case RB_IDTOINDEX:
return REBAR_IdToIndex (wndPtr, wParam, lParam);
case RB_INSERTBAND32A:
return REBAR_InsertBand32A (wndPtr, wParam, lParam);
// case RB_INSERTBAND32W:
// case RB_MAXIMIZEBAND:
// case RB_MINIMIZEBAND:
// case RB_MOVEBAND:
case RB_SETBANDINFO32A:
return REBAR_SetBandInfo32A (wndPtr, wParam, lParam);
// case RB_SETBANDINFO32W:
case RB_SETBARINFO:
return REBAR_SetBarInfo (wndPtr, wParam, lParam);
case RB_SETBKCOLOR:
return REBAR_SetBkColor (wndPtr, wParam, lParam);
// case RB_SETCOLORSCHEME:
// case RB_SETPALETTE:
// case RB_SETPARENT:
case RB_SETTEXTCOLOR:
return REBAR_SetTextColor (wndPtr, wParam, lParam);
// case RB_SETTOOLTIPS:
// case RB_SETUNICODEFORMAT:
// case RB_SHOWBAND:
// case RB_SIZETORECT:
case WM_CREATE:
return REBAR_Create (wndPtr, wParam, lParam);
case WM_DESTROY:
return REBAR_Destroy (wndPtr, wParam, lParam);
// case WM_GETFONT:
@ -70,7 +625,7 @@ REBAR_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
wndClass.lpfnWndProc = (WNDPROC32)RebarWindowProc;
wndClass.lpfnWndProc = (WNDPROC32)REBAR_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(REBAR_INFO *);
wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);

View File

@ -10,7 +10,7 @@
* - Notifications.
* - Fix TB_GETBITMAPFLAGS.
* - Fix TB_GETROWS and TB_SETROWS.
* - Tooltip support (under contruction).
* - Tooltip support (almost complete).
* - Unicode suppport.
* - Internal COMMCTL32 bitmaps.
* - Fix TOOLBAR_Customize. (Customize dialog.)
@ -22,7 +22,7 @@
* enablebtn.exe, getbmp.exe, getbtn.exe, getflags.exe, hidebtn.exe,
* indetbtn.exe, insbtn.exe, pressbtn.exe, setbtnsz.exe, setcmdid.exe,
* setparnt.exe, setrows.exe, toolwnd.exe.
* - additional features.
* - Microsofts controlspy examples.
*/
#include "windows.h"
@ -248,20 +248,29 @@ TOOLBAR_CalcToolbar (WND *wndPtr)
INT32 x, y, cx, cy;
BOOL32 bVertical;
SIZE32 sizeString;
RECT32 rect = {0, 0, 0, 0};
TOOLBAR_CalcStrings (wndPtr, &sizeString);
if (sizeString.cy > 0)
infoPtr->nButtonHeight = sizeString.cy + infoPtr->nBitmapHeight + 6;
else if (infoPtr->nButtonHeight < infoPtr->nBitmapHeight + 6)
infoPtr->nButtonHeight = infoPtr->nBitmapHeight + 6;
if (sizeString.cx > infoPtr->nBitmapWidth)
infoPtr->nButtonWidth = sizeString.cx + 6;
else if (infoPtr->nButtonWidth < infoPtr->nBitmapWidth + 6)
infoPtr->nButtonWidth = infoPtr->nBitmapWidth + 6;
x = infoPtr->nIndent;
y = TOP_BORDER;
cx = infoPtr->nButtonWidth;
cy = infoPtr->nButtonHeight;
nRows = 1;
rect.top = y;
rect.left = x;
rect.bottom = y + cy;
rect.right = x;
btnPtr = infoPtr->buttons;
for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) {
@ -279,14 +288,14 @@ TOOLBAR_CalcToolbar (WND *wndPtr)
x = 0;
y += cy;
cx = infoPtr->nWidth;
cy = ((btnPtr->iBitmap == 0) ?
SEPARATOR_WIDTH : btnPtr->iBitmap) * 2 / 3;
cy = ((btnPtr->iBitmap > 0) ?
btnPtr->iBitmap : SEPARATOR_WIDTH) * 2 / 3;
nRows++;
bVertical = TRUE;
}
else
cx = (btnPtr->iBitmap == 0) ?
SEPARATOR_WIDTH : btnPtr->iBitmap;
cx = (btnPtr->iBitmap > 0) ?
btnPtr->iBitmap : SEPARATOR_WIDTH;
}
else {
/* this must be a button */
@ -299,6 +308,13 @@ TOOLBAR_CalcToolbar (WND *wndPtr)
btnPtr->rect.right = x + cx;
btnPtr->rect.bottom = y + cy;
if (rect.left > x)
rect.left = x;
if (rect.right < x + cx)
rect.right = x + cx;
if (rect.bottom < y + cy)
rect.bottom = y + cy;
if (infoPtr->hwndToolTip) {
TTTOOLINFO32A ti;
@ -322,6 +338,8 @@ TOOLBAR_CalcToolbar (WND *wndPtr)
}
infoPtr->nHeight = y + cy + BOTTOM_BORDER;
infoPtr->maxSize.cx = rect.right - rect.left;
infoPtr->maxSize.cy = rect.bottom - rect.top;
TRACE (toolbar, "toolbar height %d\n", infoPtr->nHeight);
}
@ -541,13 +559,13 @@ TOOLBAR_AddButtons32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->buttons[nOldButtons+nCount].dwData = lpTbb[nCount].dwData;
infoPtr->buttons[nOldButtons+nCount].iString = lpTbb[nCount].iString;
if (infoPtr->hwndToolTip) {
if ((infoPtr->hwndToolTip) && !(lpTbb[nCount].fsStyle & TBSTYLE_SEP)) {
TTTOOLINFO32A ti;
ZeroMemory (&ti, sizeof(TTTOOLINFO32A));
ti.cbSize = sizeof (TTTOOLINFO32A);
ti.hwnd = wndPtr->hwndSelf;
ti.uId = (LPSTR)lpTbb[nCount].idCommand;
ti.uId = lpTbb[nCount].idCommand;
ti.hinst = 0;
ti.lpszText = LPSTR_TEXTCALLBACK32A;
@ -654,7 +672,7 @@ TOOLBAR_AutoSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
INT32 x, y, cx, cy;
UINT32 uPosFlags = 0;
FIXME (toolbar, "auto size!\n");
TRACE (toolbar, "resizing!\n");
parent = GetParent32 (wndPtr->hwndSelf);
GetClientRect32(parent, &parent_rect);
@ -805,7 +823,8 @@ TOOLBAR_DeleteButton (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
return FALSE;
if (infoPtr->hwndToolTip) {
if ((infoPtr->hwndToolTip) &&
!(infoPtr->buttons[nIndex].fsStyle & TBSTYLE_SEP)) {
TTTOOLINFO32A ti;
ZeroMemory (&ti, sizeof(TTTOOLINFO32A));
@ -1102,7 +1121,14 @@ TOOLBAR_GetMaxSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
LPSIZE32 lpSize = (LPSIZE32)lParam;
FIXME (toolbar, "empty stub!\n");
if (lpSize == NULL)
return FALSE;
lpSize->cx = infoPtr->maxSize.cx;
lpSize->cx = infoPtr->maxSize.cy;
TRACE (toolbar, "maximum size %d x %d\n",
infoPtr->maxSize.cx, infoPtr->maxSize.cy);
return TRUE;
}
@ -1110,7 +1136,31 @@ TOOLBAR_GetMaxSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
// << TOOLBAR_GetObject >>
// << TOOLBAR_GetPadding >>
// << TOOLBAR_GetRect >>
static LRESULT
TOOLBAR_GetRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
TBUTTON_INFO *btnPtr;
LPRECT32 lpRect;
INT32 nIndex;
if (infoPtr == NULL) return FALSE;
nIndex = (INT32)wParam;
btnPtr = &infoPtr->buttons[nIndex];
if ((nIndex < 0) || (nIndex >= infoPtr->nNumButtons))
return FALSE;
lpRect = (LPRECT32)lParam;
if (lpRect == NULL) return FALSE;
lpRect->left = btnPtr->rect.left;
lpRect->right = btnPtr->rect.right;
lpRect->bottom = btnPtr->rect.bottom;
lpRect->top = btnPtr->rect.top;
return TRUE;
}
static LRESULT
@ -1151,7 +1201,16 @@ TOOLBAR_GetStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << TOOLBAR_GetTextRows >>
static LRESULT
TOOLBAR_GetTextRows (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
if (infoPtr == NULL)
return 0;
return infoPtr->nMaxTextRows;
}
static LRESULT
@ -1164,7 +1223,16 @@ TOOLBAR_GetToolTips (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << TOOLBAR_GetUnicodeFormat >>
static LRESULT
TOOLBAR_GetUnicodeFormat (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
TRACE (toolbar, "%s hwnd=0x%04x stub!\n",
infoPtr->bUnicode ? "TRUE" : "FALSE", wndPtr->hwndSelf);
return infoPtr->bUnicode;
}
static LRESULT
@ -1193,7 +1261,7 @@ TOOLBAR_HideButton (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
static LRESULT
__inline__ static LRESULT
TOOLBAR_HitTest (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
return TOOLBAR_InternalHitTest (wndPtr, (LPPOINT32)lParam);
@ -1262,7 +1330,7 @@ TOOLBAR_InsertButton32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->buttons[nIndex].dwData = lpTbb->dwData;
infoPtr->buttons[nIndex].iString = lpTbb->iString;
if (infoPtr->hwndToolTip) {
if ((infoPtr->hwndToolTip) && !(lpTbb->fsStyle & TBSTYLE_SEP)) {
TTTOOLINFO32A ti;
ZeroMemory (&ti, sizeof(TTTOOLINFO32A));
@ -1482,7 +1550,19 @@ TOOLBAR_SetButtonSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << TOOLBAR_SetButtonWidth >>
static LRESULT
TOOLBAR_SetButtonWidth (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
if (infoPtr == NULL)
return FALSE;
infoPtr->cxMin = (INT32)LOWORD(lParam);
infoPtr->cxMax = (INT32)HIWORD(lParam);
return TRUE;
}
static LRESULT
@ -1496,6 +1576,12 @@ TOOLBAR_SetCmdId (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->buttons[nIndex].idCommand = (INT32)lParam;
if (infoPtr->hwndToolTip) {
FIXME (toolbar, "change tool tip!\n");
}
return TRUE;
}
@ -1608,7 +1694,20 @@ TOOLBAR_SetInsertMarkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << TOOLBAR_SetMaxTextRows >>
static LRESULT
TOOLBAR_SetMaxTextRows (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
if (infoPtr == NULL)
return FALSE;
infoPtr->nMaxTextRows = (INT32)wParam;
return TRUE;
}
// << TOOLBAR_SetPadding >>
@ -1679,6 +1778,12 @@ TOOLBAR_SetStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
TOOLBAR_DrawButton (wndPtr, btnPtr, hdc);
ReleaseDC32 (wndPtr->hwndSelf, hdc);
if (infoPtr->hwndToolTip) {
FIXME (toolbar, "change tool tip!\n");
}
return TRUE;
}
@ -1698,10 +1803,15 @@ static LRESULT
TOOLBAR_SetUnicodeFormat (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
BOOL32 bTemp;
FIXME (toolbar, "hwnd=0x%04x stub!\n", wndPtr->hwndSelf);
TRACE (toolbar, "%s hwnd=0x%04x stub!\n",
((BOOL32)wParam) ? "TRUE" : "FALSE", wndPtr->hwndSelf);
return 0;
bTemp = infoPtr->bUnicode;
infoPtr->bUnicode = (BOOL32)wParam;
return bTemp;
}
@ -1719,8 +1829,12 @@ TOOLBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->nHeight = infoPtr->nButtonHeight + TOP_BORDER + BOTTOM_BORDER;
infoPtr->nMaxRows = 1;
infoPtr->nMaxTextRows = 1;
infoPtr->cxMin = -1;
infoPtr->cxMax = -1;
infoPtr->bCaptured = 0;
infoPtr->bCaptured = FALSE;
infoPtr->bUnicode = FALSE;
infoPtr->nButtonDown = -1;
infoPtr->nOldHit = -1;
@ -1737,8 +1851,7 @@ TOOLBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
CreateWindowEx32A (0, TOOLTIPS_CLASS32A, NULL, TTS_ALWAYSTIP,
CW_USEDEFAULT32, CW_USEDEFAULT32,
CW_USEDEFAULT32, CW_USEDEFAULT32,
wndPtr->hwndSelf, 0,
wndPtr->hInstance, 0);
wndPtr->hwndSelf, 0, 0, 0);
/* Send NM_TOOLTIPSCREATED notification */
if (infoPtr->hwndToolTip) {
@ -1997,7 +2110,7 @@ TOOLBAR_MouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
// << TOOLBAR_NCActivate >>
static LRESULT
@ -2005,8 +2118,7 @@ TOOLBAR_NCCalcSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
if (!(wndPtr->dwStyle & CCS_NODIVIDER)) {
LPRECT32 winRect = (LPRECT32)lParam;
winRect->top += 2;
winRect->bottom += 2;
winRect->top += 2;
}
return DefWindowProc32A (wndPtr->hwndSelf, WM_NCCALCSIZE, wParam, lParam);
@ -2096,11 +2208,25 @@ TOOLBAR_Notify (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
LPNMHDR lpnmh = (LPNMHDR)lParam;
if ((infoPtr->hwndToolTip) && ((lpnmh->code == TTN_GETDISPINFO32A) ||
(lpnmh->code == TTN_GETDISPINFO32W))) {
TRACE (toolbar, "passing WM_NOTIFY!\n");
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
wParam, lParam);
if ((infoPtr->hwndToolTip) && (lpnmh->hwndFrom == infoPtr->hwndToolTip)) {
SendMessage32A (infoPtr->hwndNotify, WM_NOTIFY, wParam, lParam);
#if 0
if (lpnmh->code == TTN_GETDISPINFO32A) {
LPNMTTDISPINFO32A lpdi = (LPNMTTDISPINFO32A)lParam;
FIXME (toolbar, "retrieving ASCII string\n");
}
else if (lpnmh->code == TTN_GETDISPINFO32W) {
LPNMTTDISPINFO32W lpdi = (LPNMTTDISPINFO32W)lParam;
FIXME (toolbar, "retrieving UNICODE string\n");
}
#endif
}
return 0;
@ -2286,7 +2412,9 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
// case TB_GETOBJECT: /* 4.71 */
// case TB_GETPADDING: /* 4.71 */
// case TB_GETRECT: /* 4.70 */
case TB_GETRECT:
return TOOLBAR_GetRect (wndPtr, wParam, lParam);
case TB_GETROWS:
return TOOLBAR_GetRows (wndPtr, wParam, lParam);
@ -2297,12 +2425,14 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case TB_GETSTYLE:
return TOOLBAR_GetStyle (wndPtr, wParam, lParam);
// case TB_GETTEXTROWS: /* 4.70 */
case TB_GETTEXTROWS:
return TOOLBAR_GetTextRows (wndPtr, wParam, lParam);
case TB_GETTOOLTIPS:
return TOOLBAR_GetToolTips (wndPtr, wParam, lParam);
// case TB_GETUNICODEFORMAT:
case TB_GETUNICODEFORMAT:
return TOOLBAR_GetUnicodeFormat (wndPtr, wParam, lParam);
case TB_HIDEBUTTON:
return TOOLBAR_HideButton (wndPtr, wParam, lParam);
@ -2363,7 +2493,8 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case TB_SETBUTTONSIZE:
return TOOLBAR_SetButtonSize (wndPtr, wParam, lParam);
// case TB_SETBUTTONWIDTH: /* 4.70 */
case TB_SETBUTTONWIDTH:
return TOOLBAR_SetButtonWidth (wndPtr, wParam, lParam);
case TB_SETCMDID:
return TOOLBAR_SetCmdId (wndPtr, wParam, lParam);
@ -2394,7 +2525,9 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case TB_SETINSERTMARKCOLOR:
return TOOLBAR_SetInsertMarkColor (wndPtr, wParam, lParam);
// case TB_SETMAXTEXTROWS: /* 4.70 */
case TB_SETMAXTEXTROWS:
return TOOLBAR_SetMaxTextRows (wndPtr, wParam, lParam);
// case TB_SETPADDING: /* 4.71 */
case TB_SETPARENT:

View File

@ -4,24 +4,18 @@
* Copyright 1998 Eric Kohl
*
* TODO:
* - Subclassing.
* - Tracking tooltips (under construction).
* - TTS_ALWAYSTIP (undefined).
* - Unicode support.
* - Custom draw support.
* - The "lParam" variable from NMTTDISPINFO32A is not handled
* in TOOLTIPS_GetTipText.
*
* Testing:
* - Run tests using Waite Group Windows95 API Bible Volume 2.
* The second cdrom (chapter 3) contains executables activate.exe,
* curtool.exe, deltool.exe, enumtools.exe, getinfo.exe, getiptxt.exe,
* hittest.exe, needtext.exe, newrect.exe, updtext.exe and winfrpt.exe.
*
* - Activate.exe, deltool.exe, enumtool.exe, getinfo.exe and getiptxt.exe
* are the only working examples, since subclassing is not implemented.
*
* Fixme:
* - The "lParam" variable from NMTTDISPINFO32A is not handled
* in TOOLTIPS_GetTipText.
*/
#include "windows.h"
@ -35,10 +29,15 @@
#define ID_TIMER1 1 /* show delay timer */
#define ID_TIMER2 2 /* auto pop timer */
#define ID_TIMER3 3 /* tool leave timer */
#define TT_SUBCLASS_PROP "CC32SubclassInfo" /* property name of tooltip window handle */
#define TOOLTIPS_GetInfoPtr(wndPtr) ((TOOLTIPS_INFO *)wndPtr->wExtra[0])
LRESULT CALLBACK
TOOLTIPS_SubclassProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam);
static VOID
TOOLTIPS_Refresh (WND *wndPtr, HDC32 hdc)
{
@ -91,8 +90,8 @@ TOOLTIPS_GetTipText (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
ttnmdi.lpszText = infoPtr->szTipText;
TRACE (tooltips, "hdr.idFrom = %x\n", ttnmdi.hdr.idFrom);
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&ttnmdi);
SendMessage32A (toolPtr->hwnd, WM_NOTIFY,
(WPARAM32)toolPtr->uId, (LPARAM)&ttnmdi);
if (ttnmdi.hinst) {
LoadString32A (ttnmdi.hinst, (UINT32)ttnmdi.szText,
@ -195,17 +194,17 @@ TOOLTIPS_Show (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
return;
}
TRACE (tooltips, "Show tooltip %d!\n", infoPtr->nTool);
TRACE (tooltips, "Show tooltip %d!\n", infoPtr->nCurrentTool);
toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
hdr.hwndFrom = wndPtr->hwndSelf;
hdr.idFrom = infoPtr->nTool;
hdr.idFrom = toolPtr->uId;
hdr.code = TTN_SHOW;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&hdr);
SendMessage32A (toolPtr->hwnd, WM_NOTIFY,
(WPARAM32)toolPtr->uId, (LPARAM)&hdr);
TRACE (tooltips, "\"%s\"\n", infoPtr->szTipText);
toolPtr = &infoPtr->tools[infoPtr->nTool];
TOOLTIPS_CalcTipSize (wndPtr, infoPtr, &size);
TRACE (tooltips, "size %d - %d\n", size.cx, size.cy);
@ -232,9 +231,8 @@ TOOLTIPS_Show (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
TRACE (tooltips, "pos %d - %d\n", pt.x, pt.y);
// SetWindowPos32 (wndPtr->hwndSelf, HWND_TOP, pt.x, pt.y,
// size.cx, size.cy, SWP_SHOWWINDOW);
SetWindowPos32 (wndPtr->hwndSelf, HWND_TOP, 1, 1,
// SetWindowPos32 (wndPtr->hwndSelf, HWND_TOP, 1, 1,
SetWindowPos32 (wndPtr->hwndSelf, HWND_TOP, pt.x, pt.y,
size.cx, size.cy, SWP_SHOWWINDOW);
SetTimer32 (wndPtr->hwndSelf, ID_TIMER2, infoPtr->nAutoPopTime, 0);
@ -244,19 +242,21 @@ TOOLTIPS_Show (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
static VOID
TOOLTIPS_Hide (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
{
TTTOOL_INFO *toolPtr;
NMHDR hdr;
if (infoPtr->nCurrentTool == -1)
return;
toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
TRACE (tooltips, "Hide tooltip %d!\n", infoPtr->nCurrentTool);
KillTimer32 (wndPtr->hwndSelf, ID_TIMER2);
hdr.hwndFrom = wndPtr->hwndSelf;
hdr.idFrom = infoPtr->nCurrentTool;
hdr.idFrom = toolPtr->uId;
hdr.code = TTN_POP;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&hdr);
SendMessage32A (toolPtr->hwnd, WM_NOTIFY,
(WPARAM32)toolPtr->uId, (LPARAM)&hdr);
infoPtr->nCurrentTool = -1;
@ -270,22 +270,6 @@ TOOLTIPS_GetToolFromInfoA (TOOLTIPS_INFO *infoPtr, LPTTTOOLINFO32A lpToolInfo)
TTTOOL_INFO *toolPtr;
INT32 nTool;
#if 0
for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
toolPtr = &infoPtr->tools[nTool];
if (toolPtr->uFlags & TTF_IDISHWND) {
if (lpToolInfo->uId == toolPtr->uId)
return nTool;
}
else {
if ((lpToolInfo->hwnd == toolPtr->hwnd) &&
(lpToolInfo->uId == toolPtr->uId))
return nTool;
}
}
#endif
for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
toolPtr = &infoPtr->tools[nTool];
@ -316,11 +300,7 @@ TOOLTIPS_GetToolFromPoint (TOOLTIPS_INFO *infoPtr, HWND32 hwnd, LPPOINT32 lpPt)
for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
toolPtr = &infoPtr->tools[nTool];
if (toolPtr->uFlags & TTF_IDISHWND) {
if ((HWND32)toolPtr->uId == hwnd)
return nTool;
}
else {
if (!(toolPtr->uFlags & TTF_IDISHWND)) {
if (hwnd != toolPtr->hwnd)
continue;
if (!PtInRect32 (&toolPtr->rect, *lpPt))
@ -329,10 +309,34 @@ TOOLTIPS_GetToolFromPoint (TOOLTIPS_INFO *infoPtr, HWND32 hwnd, LPPOINT32 lpPt)
}
}
for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
toolPtr = &infoPtr->tools[nTool];
if (toolPtr->uFlags & TTF_IDISHWND) {
if ((HWND32)toolPtr->uId == hwnd)
return nTool;
}
}
return -1;
}
static INT32
TOOLTIPS_GetToolFromMessage (TOOLTIPS_INFO *infoPtr, HWND32 hwndTool)
{
DWORD dwPos;
POINT32 pt;
dwPos = GetMessagePos ();
pt.x = (INT32)LOWORD(dwPos);
pt.y = (INT32)HIWORD(dwPos);
ScreenToClient32 (hwndTool, &pt);
return TOOLTIPS_GetToolFromPoint (infoPtr, hwndTool, &pt);
}
static BOOL32
TOOLTIPS_CheckTool (WND *wndPtr)
{
@ -381,9 +385,6 @@ TOOLTIPS_AddTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (lpToolInfo == NULL) return FALSE;
if (lpToolInfo->uFlags & TTF_SUBCLASS)
FIXME (tooltips, "subclassing not supported!\n");
TRACE (tooltips, "add tool (%x) %x %d%s!\n",
wndPtr->hwndSelf, lpToolInfo->hwnd, lpToolInfo->uId,
(lpToolInfo->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
@ -435,6 +436,44 @@ TOOLTIPS_AddTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (lpToolInfo->cbSize >= sizeof(TTTOOLINFO32A))
toolPtr->lParam = lpToolInfo->lParam;
/* install subclassing */
if (toolPtr->uFlags & TTF_SUBCLASS) {
if (toolPtr->uFlags & TTF_IDISHWND) {
LPTT_SUBCLASS_INFO lpttsi =
(LPTT_SUBCLASS_INFO)GetProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP);
if (lpttsi == NULL) {
lpttsi = (LPTT_SUBCLASS_INFO)HeapAlloc (GetProcessHeap(),
HEAP_ZERO_MEMORY, sizeof(TT_SUBCLASS_INFO));
lpttsi->wpOrigProc =
(WNDPROC32)SetWindowLong32A ((HWND32)toolPtr->uId,
GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);
lpttsi->hwndToolTip = wndPtr->hwndSelf;
lpttsi->uRefCount++;
SetProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP,
(HANDLE32)lpttsi);
}
else
ERR (tooltips, "A window tool must only be listed once!\n");
}
else {
LPTT_SUBCLASS_INFO lpttsi =
(LPTT_SUBCLASS_INFO)GetProp32A (toolPtr->hwnd, TT_SUBCLASS_PROP);
if (lpttsi == NULL) {
lpttsi = (LPTT_SUBCLASS_INFO)HeapAlloc (GetProcessHeap(),
HEAP_ZERO_MEMORY, sizeof(TT_SUBCLASS_INFO));
lpttsi->wpOrigProc =
(WNDPROC32)SetWindowLong32A (toolPtr->hwnd,
GWL_WNDPROC,(LONG)TOOLTIPS_SubclassProc);
lpttsi->hwndToolTip = wndPtr->hwndSelf;
lpttsi->uRefCount++;
SetProp32A (toolPtr->hwnd, TT_SUBCLASS_PROP, (HANDLE32)lpttsi);
}
else
lpttsi->uRefCount++;
}
TRACE (tooltips, "subclassing installed!\n");
}
return TRUE;
}
@ -465,6 +504,38 @@ TOOLTIPS_DelTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
HeapFree (GetProcessHeap (), 0, toolPtr->lpszText);
}
/* remove subclassing */
if (toolPtr->uFlags & TTF_SUBCLASS) {
if (toolPtr->uFlags & TTF_IDISHWND) {
LPTT_SUBCLASS_INFO lpttsi =
(LPTT_SUBCLASS_INFO)GetProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP);
if (lpttsi) {
SetWindowLong32A ((HWND32)toolPtr->uId, GWL_WNDPROC,
(LONG)lpttsi->wpOrigProc);
RemoveProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP);
HeapFree (GetProcessHeap(), 0, &lpttsi);
}
else
ERR (tooltips, "Invalid data handle!\n");
}
else {
LPTT_SUBCLASS_INFO lpttsi =
(LPTT_SUBCLASS_INFO)GetProp32A (toolPtr->hwnd, TT_SUBCLASS_PROP);
if (lpttsi) {
if (lpttsi->uRefCount == 1) {
SetWindowLong32A ((HWND32)toolPtr->uId, GWL_WNDPROC,
(LONG)lpttsi->wpOrigProc);
RemoveProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP);
HeapFree (GetProcessHeap(), 0, &lpttsi);
}
else
lpttsi->uRefCount--;
}
else
ERR (tooltips, "Invalid data handle!\n");
}
}
/* delete tool from tool list */
if (infoPtr->uNumTools == 1) {
HeapFree (GetProcessHeap (), 0, infoPtr->tools);
@ -734,7 +805,9 @@ TOOLTIPS_NewToolRect32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
INT32 nTool;
if (!(lpti)) return 0;
#if 0
if (lpti->cbSize < sizeof(TTTOOLINFO32A)) return 0;
#endif
nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpti);
if (nTool == -1) return 0;
@ -766,17 +839,11 @@ TOOLTIPS_RelayEvent (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
LPMSG32 lpMsg = (LPMSG32)lParam;
POINT32 pt;
if (lpMsg == NULL) {
if (lParam == NULL) {
ERR (tooltips, "lpMsg == NULL!\n");
return 0;
}
pt = lpMsg->pt;
ScreenToClient32 (lpMsg->hwnd, &pt);
infoPtr->nOldTool = infoPtr->nTool;
infoPtr->nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lpMsg->hwnd, &pt);
TRACE (tooltips, "tool (%x) %d %d\n", wndPtr->hwndSelf, infoPtr->nOldTool, infoPtr->nTool);
switch (lpMsg->message) {
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
@ -784,10 +851,22 @@ TOOLTIPS_RelayEvent (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
pt = lpMsg->pt;
ScreenToClient32 (lpMsg->hwnd, &pt);
infoPtr->nOldTool = infoPtr->nTool;
infoPtr->nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lpMsg->hwnd, &pt);
TRACE (tooltips, "tool (%x) %d %d\n",
wndPtr->hwndSelf, infoPtr->nOldTool, infoPtr->nTool);
TOOLTIPS_Hide (wndPtr, infoPtr);
break;
case WM_MOUSEMOVE:
pt = lpMsg->pt;
ScreenToClient32 (lpMsg->hwnd, &pt);
infoPtr->nOldTool = infoPtr->nTool;
infoPtr->nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lpMsg->hwnd, &pt);
TRACE (tooltips, "tool (%x) %d %d\n",
wndPtr->hwndSelf, infoPtr->nOldTool, infoPtr->nTool);
TRACE (tooltips, "WM_MOUSEMOVE (%04x %d %d)\n",
wndPtr->hwndSelf, pt.x, pt.y);
if ((infoPtr->bActive) && (infoPtr->nTool != infoPtr->nOldTool)) {
@ -1103,14 +1182,33 @@ static LRESULT
TOOLTIPS_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr);
TTTOOL_INFO *toolPtr;
/* free tools */
if (infoPtr->tools) {
INT32 i;
for (i = 0; i < infoPtr->uNumTools; i++) {
if ((infoPtr->tools[i].hinst) && (infoPtr->tools[i].lpszText)) {
if (infoPtr->tools[i].lpszText != LPSTR_TEXTCALLBACK32A)
HeapFree (GetProcessHeap (), 0, infoPtr->tools[i].lpszText);
toolPtr = &infoPtr->tools[i];
if ((toolPtr->hinst) && (toolPtr->lpszText)) {
if (toolPtr->lpszText != LPSTR_TEXTCALLBACK32A)
HeapFree (GetProcessHeap (), 0, toolPtr->lpszText);
}
/* remove subclassing */
if (toolPtr->uFlags & TTF_SUBCLASS) {
LPTT_SUBCLASS_INFO lpttsi;
if (toolPtr->uFlags & TTF_IDISHWND)
lpttsi = (LPTT_SUBCLASS_INFO)GetProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP);
else
lpttsi = (LPTT_SUBCLASS_INFO)GetProp32A (toolPtr->hwnd, TT_SUBCLASS_PROP);
if (lpttsi) {
SetWindowLong32A ((HWND32)toolPtr->uId, GWL_WNDPROC,
(LONG)lpttsi->wpOrigProc);
RemoveProp32A ((HWND32)toolPtr->uId, TT_SUBCLASS_PROP);
HeapFree (GetProcessHeap(), 0, &lpttsi);
}
}
}
HeapFree (GetProcessHeap (), 0, infoPtr->tools);
@ -1249,8 +1347,72 @@ TOOLTIPS_WinIniChange (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
}
LRESULT WINAPI
ToolTipsWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
LRESULT CALLBACK
TOOLTIPS_SubclassProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
{
LPTT_SUBCLASS_INFO lpttsi =
(LPTT_SUBCLASS_INFO)GetProp32A (hwnd, TT_SUBCLASS_PROP);
WND *wndPtr;
TOOLTIPS_INFO *infoPtr;
UINT32 nTool;
switch (uMsg) {
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
{
wndPtr = WIN_FindWndPtr(lpttsi->hwndToolTip);
infoPtr = TOOLTIPS_GetInfoPtr(wndPtr);
nTool = TOOLTIPS_GetToolFromMessage (infoPtr, hwnd);
TRACE (tooltips, "subclassed mouse message %04x\n", uMsg);
infoPtr->nOldTool = infoPtr->nTool;
infoPtr->nTool = nTool;
TOOLTIPS_Hide (wndPtr, infoPtr);
}
break;
case WM_MOUSEMOVE:
{
wndPtr = WIN_FindWndPtr(lpttsi->hwndToolTip);
infoPtr = TOOLTIPS_GetInfoPtr(wndPtr);
nTool = TOOLTIPS_GetToolFromMessage (infoPtr, hwnd);
TRACE (tooltips, "subclassed WM_MOUSEMOVE\n");
infoPtr->nOldTool = infoPtr->nTool;
infoPtr->nTool = nTool;
if ((infoPtr->bActive) &&
(infoPtr->nTool != infoPtr->nOldTool)) {
if (infoPtr->nOldTool == -1) {
SetTimer32 (wndPtr->hwndSelf, ID_TIMER1,
infoPtr->nInitialTime, 0);
TRACE (tooltips, "timer 1 started!\n");
}
else {
TOOLTIPS_Hide (wndPtr, infoPtr);
SetTimer32 (wndPtr->hwndSelf, ID_TIMER1,
infoPtr->nReshowTime, 0);
TRACE (tooltips, "timer 2 started!\n");
}
}
if (infoPtr->nCurrentTool != -1) {
SetTimer32 (wndPtr->hwndSelf, ID_TIMER3, 100, 0);
TRACE (tooltips, "timer 3 started!\n");
}
}
break;
}
return CallWindowProc32A (lpttsi->wpOrigProc, hwnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK
TOOLTIPS_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
@ -1423,7 +1585,7 @@ TOOLTIPS_Register (void)
ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
wndClass.lpfnWndProc = (WNDPROC32)ToolTipsWindowProc;
wndClass.lpfnWndProc = (WNDPROC32)TOOLTIPS_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(TOOLTIPS_INFO *);
wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);

View File

@ -1075,7 +1075,7 @@ DEBUG_ProcessElfObject(char * filename, unsigned int load_offset)
goto leave;
}
free(fn);
if (t) s = t+1;
if (t) s = t+1; else break;
}
if (!s || !*s) fprintf(stderr," not found");
free(paths);

21
dlls/Makefile.in Normal file
View File

@ -0,0 +1,21 @@
SUBDIRS = \
shell32
all: $(SUBDIRS)
$(SUBDIRS): dummy
@cd $@; $(MAKE)
depend:
for i in $(SUBDIRS); do (cd $$i; $(MAKE) depend) || exit 1; done
install:
for i in $(SUBDIRS); do (cd $$i; $(MAKE) install) || exit 1; done
uninstall:
for i in $(SUBDIRS); do (cd $$i; $(MAKE) uninstall) || exit 1; done
clean:
for i in $(SUBDIRS); do (cd $$i; $(MAKE) clean) || exit 1; done
dummy:

30
dlls/shell32/Makefile.in Normal file
View File

@ -0,0 +1,30 @@
DEFS = @DLLFLAGS@ -D__WINE__
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = shell32
WRCEXTRA = -A -p $*
C_SRCS = \
contmenu.c \
enumidlist.c \
folders.c \
pidl.c \
shell32_main.c \
shellole.c \
shellord.c \
shlfolder.c \
shlview.c
RC_SRCS = \
shres.rc
all: check_wrc $(MODULE).o
@MAKE_RULES@
$(RC_SRCS:.rc=.s): $(WRC)
### Dependencies:

383
dlls/shell32/contmenu.c Normal file
View File

@ -0,0 +1,383 @@
/*
* IContextMenu
*
* Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de>
*/
#include "windows.h"
#include "winerror.h"
#include "debug.h"
#include "shlobj.h"
#include "shell32_main.h"
#define IDM_EXPLORE 0
#define IDM_OPEN 1
#define IDM_RENAME 2
#define IDM_LAST IDM_RENAME
#define __T(x) x
#define _T(x) __T(x)
#define TEXT _T
static HRESULT WINAPI IContextMenu_QueryInterface(LPCONTEXTMENU ,REFIID , LPVOID *);
static ULONG WINAPI IContextMenu_AddRef(LPCONTEXTMENU);
static ULONG WINAPI IContextMenu_Release(LPCONTEXTMENU);
static HRESULT WINAPI IContextMenu_QueryContextMenu(LPCONTEXTMENU , HMENU32 ,UINT32 ,UINT32 ,UINT32 ,UINT32);
static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU, LPCMINVOKECOMMANDINFO);
static HRESULT WINAPI IContextMenu_GetCommandString(LPCONTEXTMENU , UINT32 ,UINT32 ,LPUINT32 ,LPSTR ,UINT32);
BOOL32 IContextMenu_AllocPidlTable(LPCONTEXTMENU, DWORD);
void IContextMenu_FreePidlTable(LPCONTEXTMENU);
BOOL32 IContextMenu_CanRenameItems(LPCONTEXTMENU);
BOOL32 IContextMenu_FillPidlTable(LPCONTEXTMENU, LPCITEMIDLIST *, UINT32);
static struct IContextMenu_VTable cmvt =
{ IContextMenu_QueryInterface,
IContextMenu_AddRef,
IContextMenu_Release,
IContextMenu_QueryContextMenu,
IContextMenu_InvokeCommand,
IContextMenu_GetCommandString
};
/**************************************************************************
* IContextMenu_QueryInterface
*/
static HRESULT WINAPI IContextMenu_QueryInterface(LPCONTEXTMENU this,REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = (LPUNKNOWN)(LPCONTEXTMENU)this;
}
else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/
{ *ppvObj = (LPCONTEXTMENU)this;
}
else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/
{ *ppvObj = (LPSHELLEXTINIT)this;
}
if(*ppvObj)
{ (*(LPCONTEXTMENU*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/**************************************************************************
* IContextMenu_AddRef
*/
static ULONG WINAPI IContextMenu_AddRef(LPCONTEXTMENU this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1);
return ++(this->ref);
}
/**************************************************************************
* IContextMenu_Release
*/
static ULONG WINAPI IContextMenu_Release(LPCONTEXTMENU this)
{ TRACE(shell,"(%p)->()\n",this);
if (!--(this->ref))
{ TRACE(shell," destroying IContextMenu(%p)\n",this);
if(this->pSFParent)
this->pSFParent->lpvtbl->fnRelease(this->pSFParent);
/*make sure the pidl is freed*/
if(this->aPidls)
{ IContextMenu_FreePidlTable(this);
}
if(this->pPidlMgr)
PidlMgr_Destructor(this->pPidlMgr);
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}
/**************************************************************************
* IContextMenu_Constructor()
*/
LPCONTEXTMENU IContextMenu_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST *aPidls, UINT32 uItemCount)
{ LPCONTEXTMENU cm;
UINT32 u;
cm = (LPCONTEXTMENU)HeapAlloc(GetProcessHeap(),0,sizeof(IContextMenu));
cm->lpvtbl=&cmvt;
cm->ref = 1;
cm->pSFParent = pSFParent;
if(cm->pSFParent)
cm->pSFParent->lpvtbl->fnAddRef(cm->pSFParent);
cm->aPidls = NULL;
cm->pPidlMgr = PidlMgr_Constructor();
IContextMenu_AllocPidlTable(cm, uItemCount);
if(cm->aPidls)
{ IContextMenu_FillPidlTable(cm, aPidls, uItemCount);
}
cm->bAllValues = 1;
for(u = 0; u < uItemCount; u++)
{ cm->bAllValues &= (cm->pPidlMgr->lpvtbl->fnIsValue(cm->pPidlMgr, aPidls[u]) ? 1 : 0);
}
TRACE(shell,"(%p)->()\n",cm);
return cm;
}
/**************************************************************************
* IContextMenu_QueryContextMenu()
*/
static HRESULT WINAPI IContextMenu_QueryContextMenu( LPCONTEXTMENU this, HMENU32 hmenu,
UINT32 indexMenu,UINT32 idCmdFirst,UINT32 idCmdLast,UINT32 uFlags)
{ BOOL32 fExplore ;
MENUITEMINFO32A mii;
TRACE(shell,"(%p)->(hmenu=%x indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",this, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
if(!(CMF_DEFAULTONLY & uFlags))
{ if(!this->bAllValues)
{ fExplore = uFlags & CMF_EXPLORE;
if(fExplore)
{ ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_EXPLORE;
mii.fType = MFT_STRING;
mii.dwTypeData = TEXT("&Explore");
mii.fState = MFS_ENABLED | MFS_DEFAULT;
InsertMenuItem32A( hmenu, indexMenu++, TRUE, &mii);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_OPEN;
mii.fType = MFT_STRING;
mii.dwTypeData = TEXT("&Open");
mii.fState = MFS_ENABLED;
InsertMenuItem32A( hmenu, indexMenu++, TRUE, &mii);
}
else
{ ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_OPEN;
mii.fType = MFT_STRING;
mii.dwTypeData = TEXT("&Open");
mii.fState = MFS_ENABLED | MFS_DEFAULT;
InsertMenuItem32A( hmenu, indexMenu++, TRUE, &mii);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_EXPLORE;
mii.fType = MFT_STRING;
mii.dwTypeData = TEXT("&Explore");
mii.fState = MFS_ENABLED;
InsertMenuItem32A( hmenu, indexMenu++, TRUE, &mii);
}
if(uFlags & CMF_CANRENAME)
{ ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.wID = 0;
mii.fType = MFT_SEPARATOR;
InsertMenuItem32A( hmenu, indexMenu++, TRUE, &mii);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
mii.wID = idCmdFirst + IDM_RENAME;
mii.fType = MFT_STRING;
mii.dwTypeData = TEXT("&Rename");
mii.fState = (IContextMenu_CanRenameItems(this) ? MFS_ENABLED : MFS_DISABLED);
InsertMenuItem32A( hmenu, indexMenu++, TRUE, &mii);
}
}
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (IDM_LAST + 1));
}
return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0);
}
/**************************************************************************
* IContextMenu_InvokeCommand()
*/
static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU this, LPCMINVOKECOMMANDINFO lpcmi)
{ LPITEMIDLIST pidlTemp,pidlFQ;
SHELLEXECUTEINFO sei;
int i;
TRACE(shell,"(%p)->(execinfo=%p)\n",this,lpcmi);
if(HIWORD(lpcmi->lpVerb))
{ //the command is being sent via a verb
return NOERROR;
}
if(LOWORD(lpcmi->lpVerb) > IDM_LAST)
return E_INVALIDARG;
switch(LOWORD(lpcmi->lpVerb))
{ case IDM_EXPLORE:
case IDM_OPEN:
/* Find the first item in the list that is not a value. These commands
should never be invoked if there isn't at least one key item in the list.*/
for(i = 0; this->aPidls[i]; i++)
{ if(!this->pPidlMgr->lpvtbl->fnIsValue(this->pPidlMgr, this->aPidls[i]))
break;
}
pidlTemp = ILCombine(this->pSFParent->mpidl, this->aPidls[i]);
pidlFQ = ILCombine(this->pSFParent->mpidlNSRoot, pidlTemp);
SHFree(pidlTemp);
ZeroMemory(&sei, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME;
sei.lpIDList = pidlFQ;
sei.lpClass = TEXT("folder");
sei.hwnd = lpcmi->hwnd;
sei.nShow = SW_SHOWNORMAL;
if(LOWORD(lpcmi->lpVerb) == IDM_EXPLORE)
{ sei.lpVerb = TEXT("explore");
}
else
{ sei.lpVerb = TEXT("open");
}
ShellExecuteEx32A(&sei);
SHFree(pidlFQ);
break;
case IDM_RENAME:
MessageBeep32(MB_OK);
/*handle rename for the view here*/
break;
}
return NOERROR;
}
/**************************************************************************
* IContextMenu_GetCommandString()
*/
static HRESULT WINAPI IContextMenu_GetCommandString( LPCONTEXTMENU this, UINT32 idCommand,
UINT32 uFlags,LPUINT32 lpReserved,LPSTR lpszName,UINT32 uMaxNameLen)
{ HRESULT hr = E_INVALIDARG;
TRACE(shell,"(%p)->(idcom=%x flags=%x %p name=%s len=%x)\n",this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen);
switch(uFlags)
{ case GCS_HELPTEXT:
hr = E_NOTIMPL;
break;
case GCS_VERBA:
switch(idCommand)
{ case IDM_RENAME:
strcpy((LPSTR)lpszName, "rename");
hr = NOERROR;
break;
}
break;
/* NT 4.0 with IE 3.0x or no IE will always call this with GCS_VERBW. In this
case, you need to do the lstrcpyW to the pointer passed.*/
case GCS_VERBW:
switch(idCommand)
{ case IDM_RENAME:
lstrcpyAtoW((LPWSTR)lpszName, "rename");
hr = NOERROR;
break;
}
break;
case GCS_VALIDATE:
hr = NOERROR;
break;
}
return hr;
}
/**************************************************************************
* IContextMenu_AllocPidlTable()
*/
BOOL32 IContextMenu_AllocPidlTable(LPCONTEXTMENU this, DWORD dwEntries)
{ //add one for NULL terminator
TRACE(shell,"(%p)->(entrys=%u)\n",this, dwEntries);
dwEntries++;
this->aPidls = (LPITEMIDLIST*)SHAlloc(dwEntries * sizeof(LPITEMIDLIST));
if(this->aPidls)
{ ZeroMemory(this->aPidls, dwEntries * sizeof(LPITEMIDLIST)); /*set all of the entries to NULL*/
}
return (this->aPidls != NULL);
}
/**************************************************************************
* IContextMenu_FreePidlTable()
*/
void IContextMenu_FreePidlTable(LPCONTEXTMENU this)
{ int i;
TRACE(shell,"(%p)->()\n",this);
if(this->aPidls)
{ for(i = 0; this->aPidls[i]; i++)
{ SHFree(this->aPidls[i]);
}
SHFree(this->aPidls);
this->aPidls = NULL;
}
}
/**************************************************************************
* IContextMenu_FillPidlTable()
*/
BOOL32 IContextMenu_FillPidlTable(LPCONTEXTMENU this, LPCITEMIDLIST *aPidls, UINT32 uItemCount)
{ UINT32 i;
TRACE(shell,"(%p)->(apidl=%p count=%u)\n",this, aPidls, uItemCount);
if(this->aPidls)
{ for(i = 0; i < uItemCount; i++)
{ this->aPidls[i] = ILClone(aPidls[i]);
}
return TRUE;
}
return FALSE;
}
/**************************************************************************
* IContextMenu_CanRenameItems()
*/
BOOL32 IContextMenu_CanRenameItems(LPCONTEXTMENU this)
{ UINT32 i;
DWORD dwAttributes;
TRACE(shell,"(%p)->()\n",this);
if(this->aPidls)
{ if(this->pPidlMgr)
{ for(i = 0; this->aPidls[i]; i++){} /*get the number of items assigned to this object*/
if(i > 1) /*you can't rename more than one item at a time*/
{ return FALSE;
}
dwAttributes = SFGAO_CANRENAME;
this->pSFParent->lpvtbl->fnGetAttributesOf(this->pSFParent, i,
(LPCITEMIDLIST*)this->aPidls, &dwAttributes);
return dwAttributes & SFGAO_CANRENAME;
}
}
return FALSE;
}

357
dlls/shell32/enumidlist.c Normal file
View File

@ -0,0 +1,357 @@
/*
* IEnumIDList
*
* Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de>
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "ole.h"
#include "ole2.h"
#include "debug.h"
#include "compobj.h"
#include "interfaces.h"
#include "shlobj.h"
#include "shell.h"
#include "winerror.h"
#include "winnls.h"
#include "winproc.h"
#include "commctrl.h"
#include "shell32_main.h"
/* IEnumIDList Implementation */
static HRESULT WINAPI IEnumIDList_QueryInterface(LPENUMIDLIST,REFIID,LPVOID*);
static ULONG WINAPI IEnumIDList_AddRef(LPENUMIDLIST);
static ULONG WINAPI IEnumIDList_Release(LPENUMIDLIST);
static HRESULT WINAPI IEnumIDList_Next(LPENUMIDLIST,ULONG,LPITEMIDLIST*,ULONG*);
static HRESULT WINAPI IEnumIDList_Skip(LPENUMIDLIST,ULONG);
static HRESULT WINAPI IEnumIDList_Reset(LPENUMIDLIST);
static HRESULT WINAPI IEnumIDList_Clone(LPENUMIDLIST,LPENUMIDLIST*);
static BOOL32 WINAPI IEnumIDList_CreateEnumList(LPENUMIDLIST,LPCSTR, DWORD);
static BOOL32 WINAPI IEnumIDList_AddToEnumList(LPENUMIDLIST,LPITEMIDLIST);
static BOOL32 WINAPI IEnumIDList_DeleteList(LPENUMIDLIST);
/**************************************************************************
* IEnumIDList_VTable
*/
static IEnumIDList_VTable eidlvt =
{ IEnumIDList_QueryInterface,
IEnumIDList_AddRef,
IEnumIDList_Release,
IEnumIDList_Next,
IEnumIDList_Skip,
IEnumIDList_Reset,
IEnumIDList_Clone,
IEnumIDList_CreateEnumList,
IEnumIDList_AddToEnumList,
IEnumIDList_DeleteList
};
/**************************************************************************
* IEnumIDList_Constructor
*/
LPENUMIDLIST IEnumIDList_Constructor( LPCSTR lpszPath, DWORD dwFlags, HRESULT* pResult)
{ LPENUMIDLIST lpeidl;
lpeidl = (LPENUMIDLIST)HeapAlloc(GetProcessHeap(),0,sizeof(IEnumIDList));
lpeidl->ref = 1;
lpeidl->lpvtbl = &eidlvt;
lpeidl->mpFirst=NULL;
lpeidl->mpLast=NULL;
lpeidl->mpCurrent=NULL;
TRACE(shell,"(%p)->(%s 0x%08lx %p)\n",lpeidl,debugstr_a(lpszPath),dwFlags,pResult);
lpeidl->mpPidlMgr=PidlMgr_Constructor();
if (!lpeidl->mpPidlMgr)
{ if (pResult)
{ *pResult=E_OUTOFMEMORY;
HeapFree(GetProcessHeap(),0,lpeidl);
return NULL;
}
}
if(!IEnumIDList_CreateEnumList(lpeidl, lpszPath, dwFlags))
{ if(pResult)
{ *pResult = E_OUTOFMEMORY;
HeapFree(GetProcessHeap(),0,lpeidl->mpPidlMgr);
HeapFree(GetProcessHeap(),0,lpeidl);
return NULL;
}
}
TRACE(shell,"-- (%p)->()\n",lpeidl);
return lpeidl;
}
/**************************************************************************
* EnumIDList::QueryInterface
*/
static HRESULT WINAPI IEnumIDList_QueryInterface(
LPENUMIDLIST this, REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
}
else if(IsEqualIID(riid, &IID_IEnumIDList)) /*IEnumIDList*/
{ *ppvObj = (IEnumIDList*)this;
}
if(*ppvObj)
{ (*(LPENUMIDLIST*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/******************************************************************************
* IEnumIDList_AddRef
*/
static ULONG WINAPI IEnumIDList_AddRef(LPENUMIDLIST this)
{ TRACE(shell,"(%p)->()\n",this);
return ++(this->ref);
}
/******************************************************************************
* IEnumIDList_Release
*/
static ULONG WINAPI IEnumIDList_Release(LPENUMIDLIST this)
{ TRACE(shell,"(%p)->()\n",this);
if (!--(this->ref))
{ TRACE(shell," destroying IEnumIDList(%p)\n",this);
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}
/**************************************************************************
* IEnumIDList_Next
*/
static HRESULT WINAPI IEnumIDList_Next(
LPENUMIDLIST this,ULONG celt,LPITEMIDLIST * rgelt,ULONG *pceltFetched)
{ ULONG i;
HRESULT hr = S_OK;
LPITEMIDLIST temp;
TRACE(shell,"(%p)->(%ld,%p, %p)\n",this,celt,rgelt,pceltFetched);
/* It is valid to leave pceltFetched NULL when celt is 1. Some of explorer's
subsystems actually use it (and so may a third party browser)
*/
if(pceltFetched)
*pceltFetched = 0;
*rgelt=0;
if(celt > 1 && !pceltFetched)
{ return E_INVALIDARG;
}
for(i = 0; i < celt; i++)
{ if(!(this->mpCurrent))
{ hr = S_FALSE;
break;
}
temp = ILClone(this->mpCurrent->pidl);
rgelt[i] = temp;
this->mpCurrent = this->mpCurrent->pNext;
}
if(pceltFetched)
{ *pceltFetched = i;
}
return hr;
}
/**************************************************************************
* IEnumIDList_Skip
*/
static HRESULT WINAPI IEnumIDList_Skip(
LPENUMIDLIST this,ULONG celt)
{ DWORD dwIndex;
HRESULT hr = S_OK;
TRACE(shell,"(%p)->(%lu)\n",this,celt);
for(dwIndex = 0; dwIndex < celt; dwIndex++)
{ if(!this->mpCurrent)
{ hr = S_FALSE;
break;
}
this->mpCurrent = this->mpCurrent->pNext;
}
return hr;
}
/**************************************************************************
* IEnumIDList_Reset
*/
static HRESULT WINAPI IEnumIDList_Reset(LPENUMIDLIST this)
{ TRACE(shell,"(%p)\n",this);
this->mpCurrent = this->mpFirst;
return S_OK;
}
/**************************************************************************
* IEnumIDList_Clone
*/
static HRESULT WINAPI IEnumIDList_Clone(
LPENUMIDLIST this,LPENUMIDLIST * ppenum)
{ TRACE(shell,"(%p)->() to (%p)->() E_NOTIMPL\n",this,ppenum);
return E_NOTIMPL;
}
/**************************************************************************
* EnumIDList_CreateEnumList()
* fixme: devices not handled
* fixme: add wildcards to path
*/
static BOOL32 WINAPI IEnumIDList_CreateEnumList(LPENUMIDLIST this, LPCSTR lpszPath, DWORD dwFlags)
{ LPITEMIDLIST pidl=NULL;
WIN32_FIND_DATA32A stffile;
HANDLE32 hFile;
DWORD dwDrivemap;
CHAR szDriveName[4];
CHAR szPath[MAX_PATH];
TRACE(shell,"(%p)->(%s 0x%08lx) \n",this,debugstr_a(lpszPath),dwFlags);
if (lpszPath && lpszPath[0]!='\0')
{ strcpy(szPath, lpszPath);
PathAddBackslash(szPath);
strcat(szPath,"*.*");
}
/*enumerate the folders*/
if(dwFlags & SHCONTF_FOLDERS)
{ /* special case - we can't enumerate the Desktop level Objects (MyComputer,Nethood...
so we need to fake an enumeration of those.*/
if(!lpszPath)
{ TRACE (shell,"-- (%p)-> enumerate SHCONTF_FOLDERS (special) items\n",this);
//create the pidl for this item
pidl = this->mpPidlMgr->lpvtbl->fnCreateMyComputer(this->mpPidlMgr);
if(pidl)
{ if(!IEnumIDList_AddToEnumList(this, pidl))
return FALSE;
}
}
else if (lpszPath[0]=='\0') /* enumerate the drives*/
{ TRACE (shell,"-- (%p)-> enumerate SHCONTF_FOLDERS (drives)\n",this);
dwDrivemap = GetLogicalDrives();
strcpy (szDriveName,"A:\\");
while (szDriveName[0]<='Z')
{ if(dwDrivemap & 0x00000001L)
{ pidl = this->mpPidlMgr->lpvtbl->fnCreateDrive(this->mpPidlMgr,szDriveName );
if(pidl)
{ if(!IEnumIDList_AddToEnumList(this, pidl))
return FALSE;
}
}
szDriveName[0]++;
dwDrivemap = dwDrivemap >> 1;
}
}
else
{ TRACE (shell,"-- (%p)-> enumerate SHCONTF_FOLDERS of %s\n",this,debugstr_a(szPath));
hFile = FindFirstFile32A(szPath,&stffile);
if ( hFile != INVALID_HANDLE_VALUE32 )
{ do
{ if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && strcmp (stffile.cFileName, ".") && strcmp (stffile.cFileName, ".."))
{ pidl = this->mpPidlMgr->lpvtbl->fnCreateFolder(this->mpPidlMgr, stffile.cFileName);
if(pidl)
{ if(!IEnumIDList_AddToEnumList(this, pidl))
{ return FALSE;
}
}
else
{ return FALSE;
}
}
} while( FindNextFile32A(hFile,&stffile));
FindClose32 (hFile);
}
}
}
//enumerate the non-folder items (values)
if(dwFlags & SHCONTF_NONFOLDERS)
{ if(lpszPath)
{ TRACE (shell,"-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n",this,debugstr_a(szPath));
hFile = FindFirstFile32A(szPath,&stffile);
if ( hFile != INVALID_HANDLE_VALUE32 )
{ do
{ if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{ pidl = this->mpPidlMgr->lpvtbl->fnCreateValue(this->mpPidlMgr, stffile.cFileName);
if(pidl)
{ if(!IEnumIDList_AddToEnumList(this, pidl))
{ return FALSE;
}
}
else
{ return FALSE;
}
}
} while( FindNextFile32A(hFile,&stffile));
FindClose32 (hFile);
}
}
}
return TRUE;
}
/**************************************************************************
* EnumIDList_AddToEnumList()
*/
static BOOL32 WINAPI IEnumIDList_AddToEnumList(LPENUMIDLIST this,LPITEMIDLIST pidl)
{ LPENUMLIST pNew;
TRACE(shell,"(%p)->(pidl=%p)\n",this,pidl);
pNew = (LPENUMLIST)HeapAlloc(GetProcessHeap(),0,sizeof(ENUMLIST));
if(pNew)
{ //set the next pointer
pNew->pNext = NULL;
pNew->pidl = pidl;
//is this the first item in the list?
if(!this->mpFirst)
{ this->mpFirst = pNew;
this->mpCurrent = pNew;
}
if(this->mpLast)
{ //add the new item to the end of the list
this->mpLast->pNext = pNew;
}
//update the last item pointer
this->mpLast = pNew;
TRACE(shell,"-- (%p)->(first=%p, last=%p)\n",this,this->mpFirst,this->mpLast);
return TRUE;
}
return FALSE;
}
/**************************************************************************
* EnumIDList_DeleteList()
*/
static BOOL32 WINAPI IEnumIDList_DeleteList(LPENUMIDLIST this)
{ LPENUMLIST pDelete;
TRACE(shell,"(%p)->()\n",this);
while(this->mpFirst)
{ pDelete = this->mpFirst;
this->mpFirst = pDelete->pNext;
SHFree(pDelete->pidl);
SHFree(pDelete);
}
this->mpFirst = this->mpLast = this->mpCurrent = NULL;
return TRUE;
}

224
dlls/shell32/folders.c Normal file
View File

@ -0,0 +1,224 @@
/*
* Shell Folder stuff (...and all the OLE-Objects of SHELL32.DLL)
*
* Copyright 1997 Marcus Meissner
* Copyright 1998 Juergen Schmied
*
* !!! currently work in progress on all classes !!!
* <contact juergen.schmied@metronet.de, 980801>
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "ole.h"
#include "ole2.h"
#include "debug.h"
#include "compobj.h"
#include "interfaces.h"
#include "shlobj.h"
#include "shell.h"
#include "winerror.h"
#include "winnls.h"
#include "winproc.h"
#include "commctrl.h"
#include "shell32_main.h"
/******************************************************************************
* foreward declaration
*/
/* IExtractIcon implementation*/
static HRESULT WINAPI IExtractIcon_QueryInterface(LPEXTRACTICON, REFIID, LPVOID *);
static ULONG WINAPI IExtractIcon_AddRef(LPEXTRACTICON);
static ULONG WINAPI IExtractIcon_AddRef(LPEXTRACTICON);
static ULONG WINAPI IExtractIcon_Release(LPEXTRACTICON);
static HRESULT IExtractIcon_GetIconLocation(LPEXTRACTICON, UINT32, LPSTR, UINT32, int *, UINT32 *);
static HRESULT IExtractIcon_Extract(LPEXTRACTICON, LPCSTR, UINT32, HICON32 *, HICON32 *, UINT32);
/* IShellLink Implementation */
static HRESULT WINAPI IShellLink_QueryInterface(LPSHELLLINK,REFIID,LPVOID*);
static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK);
static ULONG WINAPI IShellLink_Release(LPSHELLLINK);
/***********************************************************************
* IExtractIcon implementation
*/
static struct IExtractIcon_VTable eivt =
{ IExtractIcon_QueryInterface,
IExtractIcon_AddRef,
IExtractIcon_Release,
IExtractIcon_GetIconLocation,
IExtractIcon_Extract
};
/**************************************************************************
* IExtractIcon_Constructor
*/
LPEXTRACTICON IExtractIcon_Constructor(LPCITEMIDLIST pidl)
{ LPEXTRACTICON ei;
ei=(LPEXTRACTICON)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIcon));
ei->ref=1;
ei->lpvtbl=&eivt;
ei->pidl=ILClone(pidl);
TRACE(shell,"(%p)\n",ei);
return ei;
}
/**************************************************************************
* IExtractIcon_QueryInterface
*/
static HRESULT WINAPI IExtractIcon_QueryInterface( LPEXTRACTICON this, REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
}
else if(IsEqualIID(riid, &IID_IExtractIcon)) /*IExtractIcon*/
{ *ppvObj = (IExtractIcon*)this;
}
if(*ppvObj)
{ (*(LPEXTRACTICON*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/**************************************************************************
* IExtractIcon_AddRef
*/
static ULONG WINAPI IExtractIcon_AddRef(LPEXTRACTICON this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1);
return ++(this->ref);
}
/**************************************************************************
* IExtractIcon_Release
*/
static ULONG WINAPI IExtractIcon_Release(LPEXTRACTICON this)
{ TRACE(shell,"(%p)->()\n",this);
if (!--(this->ref))
{ TRACE(shell," destroying IExtractIcon(%p)\n",this);
SHFree(this->pidl);
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}
/**************************************************************************
* IExtractIcon_GetIconLocation
* NOTE
* FIXME returns allways the icon no. 3 (closed Folder)
*/
static HRESULT IExtractIcon_GetIconLocation(LPEXTRACTICON this, UINT32 uFlags, LPSTR szIconFile, UINT32 cchMax, int * piIndex, UINT32 * pwFlags)
{ FIXME (shell,"(%p) (flags=%u file=%s max=%u %p %p) semi-stub\n", this, uFlags, szIconFile, cchMax, piIndex, pwFlags);
*pwFlags = GIL_NOTFILENAME;
*piIndex = 3;
return NOERROR;
}
/**************************************************************************
* IExtractIcon_Extract
*/
static HRESULT IExtractIcon_Extract(LPEXTRACTICON this, LPCSTR pszFile, UINT32 nIconIndex, HICON32 *phiconLarge, HICON32 *phiconSmall, UINT32 nIconSize)
{ FIXME (shell,"(%p) (file=%s index=%u %p %p size=%u) semi-stub\n", this, pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
*phiconLarge = pImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT);
*phiconSmall = pImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT);
return S_OK;
}
/**************************************************************************
* IShellLink Implementation
*/
static struct IShellLink_VTable slvt = {
IShellLink_QueryInterface,
IShellLink_AddRef,
IShellLink_Release,
(void *)0xcafe0004,
(void *)0xcafe0005,
(void *)0xcafe0006,
(void *)0xcafe0007,
(void *)0xcafe0008,
(void *)0xcafe0009,
(void *)0xcafe0010,
(void *)0xcafe0011,
(void *)0xcafe0012,
(void *)0xcafe0013,
(void *)0xcafe0014,
(void *)0xcafe0015,
(void *)0xcafe0016,
(void *)0xcafe0017,
(void *)0xcafe0018,
(void *)0xcafe0019,
(void *)0xcafe0020,
(void *)0xcafe0021
};
/**************************************************************************
* IShellLink_Constructor
*/
LPSHELLLINK IShellLink_Constructor()
{ LPSHELLLINK sl;
sl = (LPSHELLLINK)HeapAlloc(GetProcessHeap(),0,sizeof(IShellLink));
sl->ref = 1;
sl->lpvtbl = &slvt;
TRACE(shell,"(%p)->()\n",sl);
return sl;
}
/**************************************************************************
* IShellLink::QueryInterface
*/
static HRESULT WINAPI IShellLink_QueryInterface(
LPSHELLLINK this, REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
}
else if(IsEqualIID(riid, &IID_IShellLink)) /*IShellLink*/
{ *ppvObj = (LPSHELLLINK)this;
}
if(*ppvObj)
{ (*(LPSHELLLINK*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/******************************************************************************
* IShellLink_AddRef
*/
static ULONG WINAPI IShellLink_AddRef(LPSHELLLINK this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
return ++(this->ref);
}
/******************************************************************************
* IClassFactory_Release
*/
static ULONG WINAPI IShellLink_Release(LPSHELLLINK this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
if (!--(this->ref))
{ TRACE(shell,"-- destroying IShellLink(%p)\n",this);
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}

846
dlls/shell32/pidl.c Normal file
View File

@ -0,0 +1,846 @@
/*
* pidl Handling
*
* Copyright 1998 Juergen Schmied
*
* !!! currently work in progress on all classes !!!
* <contact juergen.schmied@metronet.de, 980801>
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "ole.h"
#include "ole2.h"
#include "debug.h"
#include "compobj.h"
#include "interfaces.h"
#include "shlobj.h"
#include "shell.h"
#include "winerror.h"
#include "winnls.h"
#include "winproc.h"
#include "commctrl.h"
#include "shell32_main.h"
#include "pidl.h"
void pdump (LPCITEMIDLIST pidl)
{ DWORD type;
CHAR * szData;
LPITEMIDLIST pidltemp = pidl;
TRACE(pidl,"---------- pidl=%p \n", pidl);
do
{ szData = ((LPPIDLDATA )(pidltemp->mkid.abID))->szText;
type = ((LPPIDLDATA )(pidltemp->mkid.abID))->type;
TRACE(pidl,"---- pidl=%p size=%u type=%lx %s\n",pidltemp, pidltemp->mkid.cb,type,debugstr_a(szData));
pidltemp = (LPITEMIDLIST)(((BYTE*)pidltemp)+pidltemp->mkid.cb);
} while (pidltemp->mkid.cb);
}
/*************************************************************************
* ILGetDisplayName [SHELL32.15]
*/
BOOL32 WINAPI ILGetDisplayName(LPCITEMIDLIST iil,LPSTR path)
{ FIXME(pidl,"(%p,%p),stub, return e:!\n",iil,path);
strcpy(path,"e:\\");
return TRUE;
}
/*************************************************************************
* ILFindLastID [SHELL32.16]
*/
LPSHITEMID WINAPI ILFindLastID(LPITEMIDLIST iil)
{ LPSHITEMID lastsii,sii;
TRACE(pidl,"%p\n",iil);
if (!iil)
{ return NULL;
}
sii = &(iil->mkid);
lastsii = sii;
while (sii->cb)
{ lastsii = sii;
sii = (LPSHITEMID)(((char*)sii)+sii->cb);
}
return lastsii;
}
/*************************************************************************
* ILRemoveLastID [SHELL32.17]
* NOTES
* Removes the last item
*/
BOOL32 WINAPI ILRemoveLastID(LPCITEMIDLIST pidl)
{ LPCITEMIDLIST xpidl;
TRACE(shell,"pidl=%p\n",pidl);
if (!pidl || !pidl->mkid.cb)
return 0;
ILFindLastID(pidl)->cb = 0;
return 1;
}
/*************************************************************************
* ILClone [SHELL32.18]
*
* NOTES
* dupicate an idlist
*/
LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
{ DWORD len;
LPITEMIDLIST newpidl;
TRACE(pidl,"%p\n",pidl);
if (!pidl)
return NULL;
len = ILGetSize(pidl);
newpidl = (LPITEMIDLIST)SHAlloc(len);
if (newpidl)
memcpy(newpidl,pidl,len);
return newpidl;
}
/*************************************************************************
* ILCloneFirst [SHELL32.19]
*
* NOTES
* duplicates the first idlist of a complex pidl
*/
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
{ FIXME(pidl,"pidl=%p\n",pidl);
return NULL;
}
/*************************************************************************
* ILCombine [SHELL32.25]
*
* NOTES
* Concatenates two complex idlists.
* The pidl is the first one, pidlsub the next one
* Does not destroy the passed in idlists!
*/
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2)
{ DWORD len1,len2;
LPITEMIDLIST pidlNew;
TRACE(pidl,"pidl=%p pidl=%p\n",pidl1,pidl2);
if(!pidl1 && !pidl2)
{ return NULL;
}
if(!pidl1)
{ pidlNew = ILClone(pidl2);
return pidlNew;
}
if(!pidl2)
{ pidlNew = ILClone(pidl1);
return pidlNew;
}
len1 = ILGetSize(pidl1)-2;
len2 = ILGetSize(pidl2);
pidlNew = SHAlloc(len1+len2);
if (pidlNew)
{ memcpy(pidlNew,pidl1,len1);
memcpy(((BYTE *)pidlNew)+len1,pidl2,len2);
}
/* TRACE(pidl,"--new pidl=%p\n",pidlNew);*/
return pidlNew;
}
/*************************************************************************
* ILGetSize [SHELL32.152]
* gets the byte size of an idlist including zero terminator (pidl)
*
* PARAMETERS
* pidl ITEMIDLIST
*
* RETURNS
* size of pidl
*
* NOTES
* exported by ordinal
*/
DWORD WINAPI ILGetSize(LPITEMIDLIST pidl)
{ LPSHITEMID si = &(pidl->mkid);
DWORD len=0;
TRACE(pidl,"pidl=%p\n",pidl);
if (pidl)
{ while (si->cb)
{ len += si->cb;
si = (LPSHITEMID)(((LPBYTE)si)+si->cb);
}
len += 2;
}
/* TRACE(pidl,"-- size=%lu\n",len);*/
return len;
}
/*************************************************************************
* ILGetNext [SHELL32.153]
* gets the next simple pidl ot of a complex pidl
*
* PARAMETERS
* pidl ITEMIDLIST
*
* RETURNS
* pointer to next element
*
*/
LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl)
{ LPITEMIDLIST nextpidl;
TRACE(pidl,"(pidl=%p)\n",pidl);
if(pidl)
{ nextpidl = (LPITEMIDLIST)(LPBYTE)(((LPBYTE)pidl) + pidl->mkid.cb);
return nextpidl;
}
else
{ return (NULL);
}
}
/*************************************************************************
* ILAppend [SHELL32.154]
*
* NOTES
* Adds the single item to the idlist indicated by pidl.
* if bEnd is 0, adds the item to the front of the list,
* otherwise adds the item to the end.
* Destroys the passed in idlist!
*/
LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl,LPCITEMIDLIST item,BOOL32 bEnd)
{ TRACE(pidl,"(pidl=%p,pidl=%p,%08u)\n",pidl,item,bEnd);
return NULL;
}
/*************************************************************************
* ILFree [SHELL32.155]
*
* NOTES
* free_check_ptr - frees memory (if not NULL)
* allocated by SHMalloc allocator
* exported by ordinal
*/
DWORD WINAPI ILFree(LPVOID pidl)
{ TRACE(pidl,"(pidl=0x%08lx)\n",(DWORD)pidl);
if (!pidl)
return 0;
return SHFree(pidl);
}
/**************************************************************************
* INTERNAL CLASS pidlmgr
*/
static struct PidlMgr_VTable pmgrvt = {
PidlMgr_CreateDesktop,
PidlMgr_CreateMyComputer,
PidlMgr_CreateDrive,
PidlMgr_CreateFolder,
PidlMgr_CreateValue,
PidlMgr_GetDesktop,
PidlMgr_GetDrive,
PidlMgr_GetLastItem,
PidlMgr_GetItemText,
PidlMgr_IsDesktop,
PidlMgr_IsMyComputer,
PidlMgr_IsDrive,
PidlMgr_IsFolder,
PidlMgr_IsValue,
PidlMgr_HasFolders,
PidlMgr_GetFolderText,
PidlMgr_GetValueText,
PidlMgr_GetValueType,
PidlMgr_GetDataText,
PidlMgr_GetPidlPath,
PidlMgr_Create,
PidlMgr_GetData,
PidlMgr_GetDataPointer,
PidlMgr_SeparatePathAndValue
};
/**************************************************************************
* PidlMgr_Constructor
*/
LPPIDLMGR PidlMgr_Constructor()
{ LPPIDLMGR pmgr;
pmgr = (LPPIDLMGR)HeapAlloc(GetProcessHeap(),0,sizeof(pidlmgr));
pmgr->lpvtbl = &pmgrvt;
TRACE(pidl,"(%p)->()\n",pmgr);
/** FIXMEDllRefCount++;*/
return pmgr;
}
/**************************************************************************
* PidlMgr_Destructor
*/
void PidlMgr_Destructor(LPPIDLMGR this)
{ HeapFree(GetProcessHeap(),0,this);
TRACE(pidl,"(%p)->()\n",this);
/** FIXMEDllRefCount--;*/
}
/**************************************************************************
* PidlMgr_CreateDesktop()
* PidlMgr_CreateMyComputer()
* PidlMgr_CreateDrive()
* PidlMgr_CreateFolder()
* PidlMgr_CreateValue()
*/
LPITEMIDLIST PidlMgr_CreateDesktop(LPPIDLMGR this)
{ TRACE(pidl,"(%p)->()\n",this);
return PidlMgr_Create(this,PT_DESKTOP, NULL, 0);
}
LPITEMIDLIST PidlMgr_CreateMyComputer(LPPIDLMGR this)
{ TRACE(pidl,"(%p)->()\n",this);
return PidlMgr_Create(this,PT_MYCOMP, (void *)"My Computer", strlen ("My Computer")+1);
}
LPITEMIDLIST PidlMgr_CreateDrive(LPPIDLMGR this, LPCSTR lpszNew)
{ char sTemp[4];
strncpy (sTemp,lpszNew,4);
sTemp[2]='\\';
sTemp[3]=0x00;
TRACE(pidl,"(%p)->(%s)\n",this,sTemp);
return PidlMgr_Create(this,PT_DRIVE,(LPVOID)&sTemp[0],4);
}
LPITEMIDLIST PidlMgr_CreateFolder(LPPIDLMGR this, LPCSTR lpszNew)
{ TRACE(pidl,"(%p)->(%s)\n",this,lpszNew);
return PidlMgr_Create(this,PT_FOLDER, (LPVOID)lpszNew, strlen(lpszNew)+1);
}
LPITEMIDLIST PidlMgr_CreateValue(LPPIDLMGR this,LPCSTR lpszNew)
{ TRACE(pidl,"(%p)->(%s)\n",this,lpszNew);
return PidlMgr_Create(this,PT_VALUE, (LPVOID)lpszNew, strlen(lpszNew)+1);
}
/**************************************************************************
* PidlMgr_GetDesktop()
*
* FIXME: quick hack
*/
BOOL32 PidlMgr_GetDesktop(LPPIDLMGR this,LPCITEMIDLIST pidl,LPSTR pOut)
{ TRACE(pidl,"(%p)->(%p %p)\n",this,pidl,pOut);
return (BOOL32)PidlMgr_GetData(this,PT_DESKTOP, pidl, (LPVOID)pOut, 255);
}
/**************************************************************************
* PidlMgr_GetDrive()
*
* FIXME: quick hack
*/
BOOL32 PidlMgr_GetDrive(LPPIDLMGR this,LPCITEMIDLIST pidl,LPSTR pOut, UINT16 uSize)
{ LPITEMIDLIST pidlTemp=NULL;
TRACE(pidl,"(%p)->(%p,%p,%u)\n",this,pidl,pOut,uSize);
if(PidlMgr_IsMyComputer(this,pidl))
{ pidlTemp = ILGetNext(pidl);
}
else if (pidlTemp && PidlMgr_IsDrive(this,pidlTemp))
{ return (BOOL32)PidlMgr_GetData(this,PT_DRIVE, pidlTemp, (LPVOID)pOut, uSize);
}
return FALSE;
}
/**************************************************************************
* PidlMgr_GetLastItem()
* Gets the last item in the list
*/
LPITEMIDLIST PidlMgr_GetLastItem(LPPIDLMGR this,LPCITEMIDLIST pidl)
{ LPITEMIDLIST pidlLast = NULL;
TRACE(pidl,"(%p)->(pidl=%p)\n",this,pidl);
if(pidl)
{ while(pidl->mkid.cb)
{ pidlLast = (LPITEMIDLIST)pidl;
pidl = ILGetNext(pidl);
}
}
return pidlLast;
}
/**************************************************************************
* PidlMgr_GetItemText()
* Gets the text for only this item
*/
DWORD PidlMgr_GetItemText(LPPIDLMGR this,LPCITEMIDLIST pidl, LPSTR lpszText, UINT16 uSize)
{ TRACE(pidl,"(%p)->(pidl=%p %p %x)\n",this,pidl,lpszText,uSize);
if (PidlMgr_IsMyComputer(this, pidl))
{ return PidlMgr_GetData(this,PT_MYCOMP, pidl, (LPVOID)lpszText, uSize);
}
if (PidlMgr_IsDrive(this, pidl))
{ return PidlMgr_GetData(this,PT_DRIVE, pidl, (LPVOID)lpszText, uSize);
}
return PidlMgr_GetData(this,PT_TEXT, pidl, (LPVOID)lpszText, uSize);
}
/**************************************************************************
* PidlMgr_IsDesktop()
* PidlMgr_IsDrive()
* PidlMgr_IsFolder()
* PidlMgr_IsValue()
*/
BOOL32 PidlMgr_IsDesktop(LPPIDLMGR this,LPCITEMIDLIST pidl)
{ TRACE(pidl,"%p->(%p)\n",this,pidl);
if (! pidl)
return FALSE;
return ( pidl->mkid.cb == 0x00 );
}
BOOL32 PidlMgr_IsMyComputer(LPPIDLMGR this,LPCITEMIDLIST pidl)
{ LPPIDLDATA pData;
TRACE(pidl,"%p->(%p)\n",this,pidl);
if (! pidl)
return FALSE;
pData = PidlMgr_GetDataPointer(this,pidl);
return (PT_MYCOMP == pData->type);
}
BOOL32 PidlMgr_IsDrive(LPPIDLMGR this,LPCITEMIDLIST pidl)
{ LPPIDLDATA pData;
TRACE(pidl,"%p->(%p)\n",this,pidl);
if (! pidl)
return FALSE;
pData = PidlMgr_GetDataPointer(this,pidl);
return (PT_DRIVE == pData->type);
}
BOOL32 PidlMgr_IsFolder(LPPIDLMGR this,LPCITEMIDLIST pidl)
{ LPPIDLDATA pData;
TRACE(pidl,"%p->(%p)\n",this,pidl);
if (! pidl)
return FALSE;
pData = PidlMgr_GetDataPointer(this,pidl);
return (PT_FOLDER == pData->type);
}
BOOL32 PidlMgr_IsValue(LPPIDLMGR this,LPCITEMIDLIST pidl)
{ LPPIDLDATA pData;
TRACE(pidl,"%p->(%p)\n",this,pidl);
if (! pidl)
return FALSE;
pData = PidlMgr_GetDataPointer(this,pidl);
return (PT_VALUE == pData->type);
}
/**************************************************************************
* PidlMgr_HasFolders()
* fixme: quick hack
*/
BOOL32 PidlMgr_HasFolders(LPPIDLMGR this, LPSTR pszPath, LPCITEMIDLIST pidl)
{ BOOL32 bResult= FALSE;
WIN32_FIND_DATA32A stffile;
HANDLE32 hFile;
TRACE(pidl,"(%p)->%p %p\n",this, pszPath, pidl);
hFile = FindFirstFile32A(pszPath,&stffile);
do
{ if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{ bResult= TRUE;
}
} while( FindNextFile32A(hFile,&stffile));
FindClose32 (hFile);
return bResult;
}
/**************************************************************************
* PidlMgr_GetFolderText()
* Creates a Path string from a PIDL, filtering out the special Folders
*/
DWORD PidlMgr_GetFolderText(LPPIDLMGR this,LPCITEMIDLIST pidl,
LPSTR lpszPath, DWORD dwSize)
{ LPITEMIDLIST pidlTemp;
DWORD dwCopied = 0;
TRACE(pidl,"(%p)->(%p)\n",this,pidl);
if(!pidl)
{ return 0;
}
if(PidlMgr_IsMyComputer(this,pidl))
{ pidlTemp = ILGetNext(pidl);
TRACE(pidl,"-- (%p)->skip My Computer\n",this);
}
else
{ pidlTemp = (LPITEMIDLIST)pidl;
}
//if this is NULL, return the required size of the buffer
if(!lpszPath)
{ while(pidlTemp->mkid.cb)
{ LPPIDLDATA pData = PidlMgr_GetDataPointer(this,pidlTemp);
//add the length of this item plus one for the backslash
dwCopied += strlen(pData->szText) + 1; /* FIXME pData->szText is not every time a string*/
pidlTemp = ILGetNext(pidlTemp);
}
//add one for the NULL terminator
TRACE(pidl,"-- (%p)->(size=%lu)\n",this,dwCopied);
return dwCopied + 1;
}
*lpszPath = 0;
while(pidlTemp->mkid.cb && (dwCopied < dwSize))
{ LPPIDLDATA pData = PidlMgr_GetDataPointer(this,pidlTemp);
//if this item is a value, then skip it and finish
if(PT_VALUE == pData->type)
{ break;
}
strcat(lpszPath, pData->szText);
strcat(lpszPath, "\\");
dwCopied += strlen(pData->szText) + 1;
pidlTemp = ILGetNext(pidlTemp);
TRACE(pidl,"-- (%p)->(size=%lu,%s)\n",this,dwCopied,lpszPath);
}
//remove the last backslash if necessary
if(dwCopied)
{ if(*(lpszPath + strlen(lpszPath) - 1) == '\\')
{ *(lpszPath + strlen(lpszPath) - 1) = 0;
dwCopied--;
}
}
TRACE(pidl,"-- (%p)->(path=%s)\n",this,lpszPath);
return dwCopied;
}
/**************************************************************************
* PidlMgr_GetValueText()
* Gets the text for the last item in the list
*/
DWORD PidlMgr_GetValueText(LPPIDLMGR this,
LPCITEMIDLIST pidl, LPSTR lpszValue, DWORD dwSize)
{ LPITEMIDLIST pidlTemp=pidl;
CHAR szText[MAX_PATH];
TRACE(pidl,"(%p)->(pidl=%p %p 0x%08lx)\n",this,pidl,lpszValue,dwSize);
if(!pidl)
{ return 0;
}
while(pidlTemp->mkid.cb && !PidlMgr_IsValue(this,pidlTemp))
{ pidlTemp = ILGetNext(pidlTemp);
}
if(!pidlTemp->mkid.cb)
{ return 0;
}
PidlMgr_GetItemText(this, pidlTemp, szText, sizeof(szText));
if(!lpszValue)
{ return strlen(szText) + 1;
}
strcpy(lpszValue, szText);
TRACE(pidl,"-- (%p)->(pidl=%p %p=%s 0x%08lx)\n",this,pidl,lpszValue,lpszValue,dwSize);
return strlen(lpszValue);
}
/**************************************************************************
* PidlMgr_GetValueType()
*/
BOOL32 PidlMgr_GetValueType( LPPIDLMGR this,
LPCITEMIDLIST pidlPath,
LPCITEMIDLIST pidlValue,
LPDWORD pdwType)
{ LPSTR lpszFolder,
lpszValueName;
DWORD dwNameSize;
FIXME(pidl,"(%p)->(%p %p %p) stub\n",this,pidlPath,pidlValue,pdwType);
if(!pidlPath)
{ return FALSE;
}
if(!pidlValue)
{ return FALSE;
}
if(!pdwType)
{ return FALSE;
}
//get the Desktop
//PidlMgr_GetDesktop(this,pidlPath);
/* fixme: add the driveletter here*/
//assemble the Folder string
dwNameSize = PidlMgr_GetFolderText(this,pidlPath, NULL, 0);
lpszFolder = (LPSTR)HeapAlloc(GetProcessHeap(),0,dwNameSize);
if(!lpszFolder)
{ return FALSE;
}
PidlMgr_GetFolderText(this,pidlPath, lpszFolder, dwNameSize);
//assemble the value name
dwNameSize = PidlMgr_GetValueText(this,pidlValue, NULL, 0);
lpszValueName = (LPSTR)HeapAlloc(GetProcessHeap(),0,dwNameSize);
if(!lpszValueName)
{ HeapFree(GetProcessHeap(),0,lpszFolder);
return FALSE;
}
PidlMgr_GetValueText(this,pidlValue, lpszValueName, dwNameSize);
/* fixme: we've got the path now do something with it
-like get the filetype*/
pdwType=NULL;
HeapFree(GetProcessHeap(),0,lpszFolder);
HeapFree(GetProcessHeap(),0,lpszValueName);
return TRUE;
}
/**************************************************************************
* PidlMgr_GetDataText()
*/
DWORD PidlMgr_GetDataText( LPPIDLMGR this,
LPCITEMIDLIST pidlPath, LPCITEMIDLIST pidlValue, LPSTR lpszOut, DWORD dwOutSize)
{ LPSTR lpszFolder,
lpszValueName;
DWORD dwNameSize;
FIXME(pidl,"(%p)->(pidl=%p pidl=%p) stub\n",this,pidlPath,pidlValue);
if(!lpszOut || !pidlPath || !pidlValue)
{ return FALSE;
}
/* fixme: get the driveletter*/
//assemble the Folder string
dwNameSize = PidlMgr_GetFolderText(this,pidlPath, NULL, 0);
lpszFolder = (LPSTR)HeapAlloc(GetProcessHeap(),0,dwNameSize);
if(!lpszFolder)
{ return FALSE;
}
PidlMgr_GetFolderText(this,pidlPath, lpszFolder, dwNameSize);
//assemble the value name
dwNameSize = PidlMgr_GetValueText(this,pidlValue, NULL, 0);
lpszValueName = (LPSTR)HeapAlloc(GetProcessHeap(),0,dwNameSize);
if(!lpszValueName)
{ HeapFree(GetProcessHeap(),0,lpszFolder);
return FALSE;
}
PidlMgr_GetValueText(this,pidlValue, lpszValueName, dwNameSize);
/* fixme: we've got the path now do something with it*/
HeapFree(GetProcessHeap(),0,lpszFolder);
HeapFree(GetProcessHeap(),0,lpszValueName);
TRACE(pidl,"-- (%p)->(%p=%s 0x%08lx)\n",this,lpszOut,lpszOut,dwOutSize);
return TRUE;
}
/**************************************************************************
* CPidlMgr::GetPidlPath()
* Create a string that includes the Drive name, the folder text and
* the value text.
*/
DWORD PidlMgr_GetPidlPath(LPPIDLMGR this,
LPCITEMIDLIST pidl, LPSTR lpszOut, DWORD dwOutSize)
{ LPSTR lpszTemp;
WORD len;
TRACE(pidl,"(%p)->(%p,%lu)\n",this,lpszOut,dwOutSize);
if(!lpszOut)
{ return 0;
}
*lpszOut = 0;
lpszTemp = lpszOut;
dwOutSize -= PidlMgr_GetFolderText(this,pidl, lpszTemp, dwOutSize);
//add a backslash if necessary
len = strlen(lpszTemp);
if (len && lpszTemp[len-1]!='\\')
{ lpszTemp[len+0]='\\';
lpszTemp[len+1]='\0';
dwOutSize--;
}
lpszTemp = lpszOut + strlen(lpszOut);
//add the value string
PidlMgr_GetValueText(this,pidl, lpszTemp, dwOutSize);
//remove the last backslash if necessary
if(*(lpszOut + strlen(lpszOut) - 1) == '\\')
{ *(lpszOut + strlen(lpszOut) - 1) = 0;
}
TRACE(pidl,"-- (%p)->(%p=%s,%lu)\n",this,lpszOut,lpszOut,dwOutSize);
return strlen(lpszOut);
}
/**************************************************************************
* PidlMgr_Create()
* Creates a new PIDL
* type = PT_DESKTOP | PT_DRIVE | PT_FOLDER | PT_VALUE
* pIn = data
* uInSize = size of data
*/
LPITEMIDLIST PidlMgr_Create(LPPIDLMGR this,PIDLTYPE type, LPVOID pIn, UINT16 uInSize)
{ LPITEMIDLIST pidlOut=NULL;
UINT16 uSize;
LPITEMIDLIST pidlTemp=NULL;
LPPIDLDATA pData;
TRACE(pidl,"(%p)->(%x %p %x)\n",this,type,pIn,uInSize);
if ( type == PT_DESKTOP)
{ pidlOut = SHAlloc(2);
pidlOut->mkid.cb=0x0000;
return pidlOut;
}
if (! pIn)
{ return NULL;
}
uSize = 2 + (sizeof(PIDLTYPE)) + uInSize + 2; /* cb + PIDLTYPE + uInSize +2 */
pidlOut = SHAlloc(uSize);
pidlTemp = pidlOut;
if(pidlOut)
{ pidlTemp->mkid.cb = uSize - 2;
pData =(LPPIDLDATA) &(pidlTemp->mkid.abID[0]);
pData->type = type;
switch(type)
{ case PT_MYCOMP:
memcpy(pData->szText, pIn, uInSize);
TRACE(pidl,"- (%p)->create My Computer: %s\n",this,debugstr_a(pData->szText));
break;
case PT_DRIVE:
memcpy(pData->szText, pIn, uInSize);
TRACE(pidl,"- (%p)->create Drive: %s\n",this,debugstr_a(pData->szText));
break;
case PT_FOLDER:
case PT_VALUE:
memcpy(pData->szText, pIn, uInSize);
TRACE(pidl,"- (%p)->create Value: %s\n",this,debugstr_a(pData->szText));
break;
default:
FIXME(pidl,"- (%p) wrong argument\n",this);
break;
}
pidlTemp = ILGetNext(pidlTemp);
pidlTemp->mkid.cb = 0x00;
}
TRACE(pidl,"-- (%p)->(pidl=%p, size=%u)\n",this,pidlOut,uSize-2);
return pidlOut;
}
/**************************************************************************
* PidlMgr_GetData(PIDLTYPE, LPCITEMIDLIST, LPVOID, UINT16)
*/
DWORD PidlMgr_GetData(
LPPIDLMGR this,
PIDLTYPE type,
LPCITEMIDLIST pidl,
LPVOID pOut,
UINT16 uOutSize)
{ LPPIDLDATA pData;
DWORD dwReturn=0;
TRACE(pidl,"(%p)->(%x %p %p %x)\n",this,type,pidl,pOut,uOutSize);
if(!pidl)
{ return 0;
}
pData = PidlMgr_GetDataPointer(this,pidl);
//copy the data
switch(type)
{ case PT_MYCOMP: if(uOutSize < 1)
return 0;
if(PT_MYCOMP != pData->type)
return 0;
*(LPSTR)pOut = 0;
strncpy((LPSTR)pOut, "My Computer", uOutSize);
dwReturn = strlen((LPSTR)pOut);
break;
case PT_DRIVE: if(uOutSize < 1)
return 0;
if(PT_DRIVE != pData->type)
return 0;
*(LPSTR)pOut = 0;
strncpy((LPSTR)pOut, pData->szText, uOutSize);
dwReturn = strlen((LPSTR)pOut);
break;
case PT_FOLDER:
case PT_VALUE:
case PT_TEXT: *(LPSTR)pOut = 0;
strncpy((LPSTR)pOut, pData->szText, uOutSize);
dwReturn = strlen((LPSTR)pOut);
break;
default: break;
}
TRACE(pidl,"-- (%p)->(%p=%s 0x%08lx)\n",this,pOut,(char*)pOut,dwReturn);
return dwReturn;
}
/**************************************************************************
* PidlMgr_GetDataPointer()
*/
LPPIDLDATA PidlMgr_GetDataPointer(LPPIDLMGR this,LPITEMIDLIST pidl)
{ if(!pidl)
{ return NULL;
}
TRACE(pidl,"(%p)->(%p)\n" ,this, pidl);
return (LPPIDLDATA)(pidl->mkid.abID);
}
/**************************************************************************
* CPidlMgr_SeparatePathAndValue)
* Creates a separate path and value PIDL from a fully qualified PIDL.
*/
BOOL32 PidlMgr_SeparatePathAndValue(LPPIDLMGR this,
LPITEMIDLIST pidlFQ, LPITEMIDLIST *ppidlPath, LPITEMIDLIST *ppidlValue)
{ LPITEMIDLIST pidlTemp;
TRACE(pidl,"(%p)->(pidl=%p pidl=%p pidl=%p)",this,pidlFQ,ppidlPath,ppidlValue);
if(!pidlFQ)
{ return FALSE;
}
*ppidlValue = PidlMgr_GetLastItem(this,pidlFQ);
if(!PidlMgr_IsValue(this,*ppidlValue))
{ return FALSE;
}
*ppidlValue = ILClone(*ppidlValue);
*ppidlPath = ILClone(pidlFQ);
pidlTemp = PidlMgr_GetLastItem(this,*ppidlPath);
pidlTemp->mkid.cb = 0x00;
return TRUE;
}

31
dlls/shell32/pidl.h Normal file
View File

@ -0,0 +1,31 @@
/* INTERNAL CLASS pidlmgr */
#ifndef __WINE_PIDL_H
#define __WINE_PIDL_H
extern LPITEMIDLIST PidlMgr_CreateDesktop(LPPIDLMGR);
extern LPITEMIDLIST PidlMgr_CreateMyComputer(LPPIDLMGR);
extern LPITEMIDLIST PidlMgr_CreateDrive(LPPIDLMGR,LPCSTR);
extern LPITEMIDLIST PidlMgr_CreateFolder(LPPIDLMGR,LPCSTR);
extern LPITEMIDLIST PidlMgr_CreateValue(LPPIDLMGR,LPCSTR);
extern BOOL32 PidlMgr_GetDesktop(LPPIDLMGR,LPCITEMIDLIST,LPSTR);
extern BOOL32 PidlMgr_GetDrive(LPPIDLMGR,LPCITEMIDLIST,LPSTR,UINT16);
extern LPITEMIDLIST PidlMgr_GetLastItem(LPPIDLMGR,LPCITEMIDLIST);
extern DWORD PidlMgr_GetItemText(LPPIDLMGR,LPCITEMIDLIST,LPSTR,UINT16);
extern BOOL32 PidlMgr_IsDesktop(LPPIDLMGR,LPCITEMIDLIST);
extern BOOL32 PidlMgr_IsMyComputer(LPPIDLMGR,LPCITEMIDLIST);
extern BOOL32 PidlMgr_IsDrive(LPPIDLMGR,LPCITEMIDLIST);
extern BOOL32 PidlMgr_IsFolder(LPPIDLMGR,LPCITEMIDLIST);
extern BOOL32 PidlMgr_IsValue(LPPIDLMGR,LPCITEMIDLIST);
extern BOOL32 PidlMgr_HasFolders(LPPIDLMGR,LPSTR,LPCITEMIDLIST);
extern DWORD PidlMgr_GetFolderText(LPPIDLMGR,LPCITEMIDLIST,LPSTR,DWORD);
extern DWORD PidlMgr_GetValueText(LPPIDLMGR,LPCITEMIDLIST,LPSTR,DWORD);
extern BOOL32 PidlMgr_GetValueType(LPPIDLMGR,LPCITEMIDLIST,LPCITEMIDLIST,LPDWORD);
extern DWORD PidlMgr_GetDataText(LPPIDLMGR,LPCITEMIDLIST,LPCITEMIDLIST,LPSTR,DWORD);
extern DWORD PidlMgr_GetPidlPath(LPPIDLMGR,LPCITEMIDLIST,LPSTR,DWORD);
extern LPITEMIDLIST PidlMgr_Create(LPPIDLMGR,PIDLTYPE,LPVOID,UINT16);
extern DWORD PidlMgr_GetData(LPPIDLMGR,PIDLTYPE,LPCITEMIDLIST,LPVOID,UINT16);
extern LPPIDLDATA PidlMgr_GetDataPointer(LPPIDLMGR,LPCITEMIDLIST);
extern BOOL32 PidlMgr_SeparatePathAndValue(LPPIDLMGR,LPITEMIDLIST,LPITEMIDLIST*,LPITEMIDLIST*);
#endif

962
dlls/shell32/shell32_main.c Normal file
View File

@ -0,0 +1,962 @@
/*
* Shell basics
*
* 1998 Marcus Meissner
* 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include "windows.h"
#include "winerror.h"
#include "file.h"
#include "shell.h"
#include "heap.h"
#include "module.h"
#include "neexe.h"
#include "resource.h"
#include "dlgs.h"
#include "win.h"
#include "graphics.h"
#include "cursoricon.h"
#include "interfaces.h"
#include "sysmetrics.h"
#include "shlobj.h"
#include "debug.h"
#include "winreg.h"
#include "imagelist.h"
#include "commctrl.h"
#include "authors.h"
#include "shell32_main.h"
/*************************************************************************
* CommandLineToArgvW [SHELL32.7]
*/
LPWSTR* WINAPI CommandLineToArgvW(LPWSTR cmdline,LPDWORD numargs)
{ LPWSTR *argv,s,t;
int i;
TRACE(shell,"\n");
/* to get writeable copy */
cmdline = HEAP_strdupW( GetProcessHeap(), 0, cmdline);
s=cmdline;i=0;
while (*s)
{ /* space */
if (*s==0x0020)
{ i++;
s++;
while (*s && *s==0x0020)
s++;
continue;
}
s++;
}
argv=(LPWSTR*)HeapAlloc( GetProcessHeap(), 0, sizeof(LPWSTR)*(i+1) );
s=t=cmdline;
i=0;
while (*s)
{ if (*s==0x0020)
{ *s=0;
argv[i++]=HEAP_strdupW( GetProcessHeap(), 0, t );
*s=0x0020;
while (*s && *s==0x0020)
s++;
if (*s)
t=s+1;
else
t=s;
continue;
}
s++;
}
if (*t)
argv[i++]=(LPWSTR)HEAP_strdupW( GetProcessHeap(), 0, t );
HeapFree( GetProcessHeap(), 0, cmdline );
argv[i]=NULL;
*numargs=i;
return argv;
}
/*************************************************************************
* Control_RunDLL [SHELL32.12]
*
* Wild speculation in the following!
*
* http://premium.microsoft.com/msdn/library/techart/msdn193.htm
*/
void WINAPI Control_RunDLL (HWND32 hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4)
{ FIXME(shell, "(%08x, %p, \"%s\", %08lx)\n",
hwnd, code ? code : "(null)", cmd ? cmd : "(null)", arg4);
}
/*************************************************************************
* Shell_GetImageList [SHELL32.71]
*
* PARAMETERS
* imglist[1|2] [OUT] pointer which recive imagelist handles
*
* NOTES
* undocumented
* I don't know, which pointer is which. They may have to be
* exchanged. (jsch)
*/
BOOL32 WINAPI Shell_GetImageList(HIMAGELIST * imglist1,HIMAGELIST * imglist2)
{ WARN(shell,"(%p,%p):semi-stub.\n",imglist1,imglist2);
if (imglist1)
{ *imglist1=ShellBigIconList;
}
if (imglist2)
{ *imglist2=ShellSmallIconList;
}
return TRUE;
}
/*************************************************************************
* SHGetFileInfoA [SHELL32.218]
*
* FIXME
*
*/
HIMAGELIST ShellSmallIconList = 0;
HIMAGELIST ShellBigIconList = 0;
DWORD WINAPI SHGetFileInfo32A(LPCSTR path,DWORD dwFileAttributes,
SHFILEINFO32A *psfi, UINT32 sizeofpsfi,
UINT32 flags )
{ CHAR szTemp[MAX_PATH];
DWORD ret=0;
TRACE(shell,"(%s,0x%lx,%p,0x%x,0x%x)\n",
path,dwFileAttributes,psfi,sizeofpsfi,flags);
/* translate the pidl to a path*/
if (flags & SHGFI_PIDL)
{ SHGetPathFromIDList32A ((LPCITEMIDLIST)path,szTemp);
TRACE(shell,"pidl=%p is %s\n",path,szTemp);
}
else
{ TRACE(shell,"path=%p\n",path);
}
if (flags & SHGFI_ATTRIBUTES)
{ FIXME(shell,"file attributes, stub\n");
psfi->dwAttributes=SFGAO_FILESYSTEM;
ret=TRUE;
}
if (flags & SHGFI_DISPLAYNAME)
{ if (flags & SHGFI_PIDL)
{ strcpy(psfi->szDisplayName,szTemp);
}
else
{ strcpy(psfi->szDisplayName,path);
TRACE(shell,"displayname=%s\n", szTemp);
}
ret=TRUE;
}
if (flags & SHGFI_TYPENAME)
{ FIXME(shell,"get the file type, stub\n");
strcpy(psfi->szTypeName,"");
ret=TRUE;
}
if (flags & SHGFI_ICONLOCATION)
{ FIXME(shell,"location of icon, stub\n");
strcpy(psfi->szDisplayName,"");
ret=TRUE;
}
if (flags & SHGFI_EXETYPE)
FIXME(shell,"type of executable, stub\n");
if (flags & SHGFI_LINKOVERLAY)
FIXME(shell,"set icon to link, stub\n");
if (flags & SHGFI_OPENICON)
FIXME(shell,"set to open icon, stub\n");
if (flags & SHGFI_SELECTED)
FIXME(shell,"set icon to selected, stub\n");
if (flags & SHGFI_SHELLICONSIZE)
FIXME(shell,"set icon to shell size, stub\n");
if (flags & SHGFI_USEFILEATTRIBUTES)
FIXME(shell,"use the dwFileAttributes, stub\n");
if (flags & SHGFI_ICON)
{ FIXME(shell,"icon handle\n");
if (flags & SHGFI_SMALLICON)
{ TRACE(shell,"set to small icon\n");
psfi->hIcon=pImageList_GetIcon(ShellSmallIconList,32,ILD_NORMAL);
ret = (DWORD) ShellSmallIconList;
}
else
{ TRACE(shell,"set to big icon\n");
psfi->hIcon=pImageList_GetIcon(ShellBigIconList,32,ILD_NORMAL);
ret = (DWORD) ShellBigIconList;
}
}
if (flags & SHGFI_SYSICONINDEX)
{ FIXME(shell,"get the SYSICONINDEX\n");
psfi->iIcon=32;
if (flags & SHGFI_SMALLICON)
{ TRACE(shell,"set to small icon\n");
ret = (DWORD) ShellSmallIconList;
}
else
{ TRACE(shell,"set to big icon\n");
ret = (DWORD) ShellBigIconList;
}
}
return ret;
}
/*************************************************************************
* ExtractIcon32A (SHELL32.133)
*/
HICON32 WINAPI ExtractIcon32A( HINSTANCE32 hInstance, LPCSTR lpszExeFileName,
UINT32 nIconIndex )
{ HGLOBAL16 handle = InternalExtractIcon(hInstance,lpszExeFileName,nIconIndex, 1);
TRACE(shell,"\n");
if( handle )
{
HICON16* ptr = (HICON16*)GlobalLock16(handle);
HICON16 hIcon = *ptr;
GlobalFree16(handle);
return hIcon;
}
return 0;
}
/*************************************************************************
* ExtractIcon32W (SHELL32.180)
*/
HICON32 WINAPI ExtractIcon32W( HINSTANCE32 hInstance, LPCWSTR lpszExeFileName,
UINT32 nIconIndex )
{ LPSTR exefn;
HICON32 ret;
TRACE(shell,"\n");
exefn = HEAP_strdupWtoA(GetProcessHeap(),0,lpszExeFileName);
ret = ExtractIcon32A(hInstance,exefn,nIconIndex);
HeapFree(GetProcessHeap(),0,exefn);
return ret;
}
/*************************************************************************
* FindExecutable32A (SHELL32.184)
*/
HINSTANCE32 WINAPI FindExecutable32A( LPCSTR lpFile, LPCSTR lpDirectory,
LPSTR lpResult )
{ HINSTANCE32 retval=31; /* default - 'No association was found' */
char old_dir[1024];
TRACE(shell, "File %s, Dir %s\n",
(lpFile != NULL?lpFile:"-"),
(lpDirectory != NULL?lpDirectory:"-"));
lpResult[0]='\0'; /* Start off with an empty return string */
/* trap NULL parameters on entry */
if (( lpFile == NULL ) || ( lpResult == NULL ))
{ /* FIXME - should throw a warning, perhaps! */
return 2; /* File not found. Close enough, I guess. */
}
if (lpDirectory)
{ GetCurrentDirectory32A( sizeof(old_dir), old_dir );
SetCurrentDirectory32A( lpDirectory );
}
retval = SHELL_FindExecutable( lpFile, "open", lpResult );
TRACE(shell, "returning %s\n", lpResult);
if (lpDirectory)
SetCurrentDirectory32A( old_dir );
return retval;
}
typedef struct
{ LPCSTR szApp;
LPCSTR szOtherStuff;
HICON32 hIcon;
} ABOUT_INFO;
#define IDC_STATIC_TEXT 100
#define IDC_LISTBOX 99
#define IDC_WINE_TEXT 98
#define DROP_FIELD_TOP (-15)
#define DROP_FIELD_HEIGHT 15
extern HICON32 hIconTitleFont;
static BOOL32 __get_dropline( HWND32 hWnd, LPRECT32 lprect )
{ HWND32 hWndCtl = GetDlgItem32(hWnd, IDC_WINE_TEXT);
if( hWndCtl )
{ GetWindowRect32( hWndCtl, lprect );
MapWindowPoints32( 0, hWnd, (LPPOINT32)lprect, 2 );
lprect->bottom = (lprect->top += DROP_FIELD_TOP);
return TRUE;
}
return FALSE;
}
/*************************************************************************
* SHAppBarMessage32 [SHELL32.207]
*/
UINT32 WINAPI SHAppBarMessage32(DWORD msg, PAPPBARDATA data)
{ FIXME(shell,"(0x%08lx,%p): stub\n", msg, data);
#if 0
switch (msg)
{ case ABM_ACTIVATE:
case ABM_GETAUTOHIDEBAR:
case ABM_GETSTATE:
case ABM_GETTASKBARPOS:
case ABM_NEW:
case ABM_QUERYPOS:
case ABM_REMOVE:
case ABM_SETAUTOHIDEBAR:
case ABM_SETPOS:
case ABM_WINDOWPOSCHANGED:
;
}
#endif
return 0;
}
/*************************************************************************
* SHBrowseForFolderA [SHELL32.209]
*
*/
LPITEMIDLIST WINAPI SHBrowseForFolder32A (LPBROWSEINFO32A lpbi)
{ FIXME (shell, "(%lx,%s) empty stub!\n", (DWORD)lpbi, lpbi->lpszTitle);
return NULL;
}
/*************************************************************************
* SHGetDesktopFolder [SHELL32.216]
*
* SDK header win95/shlobj.h: This is equivalent to call CoCreateInstance with
* CLSID_ShellDesktop
* CoCreateInstance(CLSID_Desktop, NULL, CLSCTX_INPROC, IID_IShellFolder, &pshf);
*
* RETURNS
* the interface to the shell desktop folder.
*
* FIXME
* the pdesktopfolder has to be released at the end (at dll unloading???)
*/
LPSHELLFOLDER pdesktopfolder=NULL;
DWORD WINAPI SHGetDesktopFolder(LPSHELLFOLDER *shellfolder)
{ HRESULT hres = E_OUTOFMEMORY;
LPCLASSFACTORY lpclf;
TRACE(shell,"%p->(%p)\n",shellfolder,*shellfolder);
if (pdesktopfolder)
{ hres = NOERROR;
}
else
{ lpclf = IClassFactory_Constructor();
/* fixme: the buildin IClassFactory_Constructor is at the moment only
for rclsid=CLSID_ShellDesktop, so we get the right Interface (jsch)*/
if(lpclf)
{ hres = lpclf->lpvtbl->fnCreateInstance(lpclf,NULL,(REFIID)&IID_IShellFolder, (void*)&pdesktopfolder);
lpclf->lpvtbl->fnRelease(lpclf);
}
}
if (pdesktopfolder)
{ *shellfolder = pdesktopfolder;
pdesktopfolder->lpvtbl->fnAddRef(pdesktopfolder);
}
else
{ *shellfolder=NULL;
}
TRACE(shell,"-- %p->(%p)\n",shellfolder, *shellfolder);
return hres;
}
/*************************************************************************
* SHGetPathFromIDList [SHELL32.221][NT 4.0: SHELL32.219]
*/
BOOL32 WINAPI SHGetPathFromIDList32(LPCITEMIDLIST pidl,LPSTR pszPath)
{ TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
return SHGetPathFromIDList32A(pidl,pszPath);
}
/*************************************************************************
* SHGetSpecialFolderLocation [SHELL32.223]
* gets the folder locations from the registry and creates a pidl
* creates missing reg keys and directorys
*
* PARAMS
* hwndOwner [I]
* nFolder [I] CSIDL_xxxxx
* ppidl [O] PIDL of a special folder
*
* RETURNS
* HResult
*
* FIXME
* - look for "User Shell Folder" first
*
*/
HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITEMIDLIST * ppidl)
{ LPSHELLFOLDER shellfolder;
DWORD pchEaten,tpathlen=MAX_PATH,type,dwdisp,res;
CHAR pszTemp[256],buffer[256],tpath[MAX_PATH],npath[MAX_PATH];
LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0];
HKEY key;
enum
{ FT_UNKNOWN= 0x00000000,
FT_DIR= 0x00000001,
FT_DESKTOP= 0x00000002
} tFolder;
TRACE(shell,"(%04x,%d,%p)\n", hwndOwner,nFolder,ppidl);
strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
res=RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp);
if (res)
{ ERR(shell,"Could not create key %s %08lx \n",buffer,res);
return E_OUTOFMEMORY;
}
tFolder=FT_DIR;
switch (nFolder)
{ case CSIDL_BITBUCKET:
strcpy (buffer,"xxx"); /*not in the registry*/
TRACE (shell,"looking for Recycler\n");
tFolder=FT_UNKNOWN;
break;
case CSIDL_CONTROLS:
strcpy (buffer,"xxx"); /*virtual folder*/
TRACE (shell,"looking for Control\n");
tFolder=FT_UNKNOWN;
break;
case CSIDL_DESKTOP:
strcpy (buffer,"xxx"); /*virtual folder*/
TRACE (shell,"looking for Desktop\n");
tFolder=FT_DESKTOP;
break;
case CSIDL_DESKTOPDIRECTORY:
strcpy (buffer,"Desktop");
break;
case CSIDL_DRIVES:
strcpy (buffer,"xxx"); /*virtual folder*/
TRACE (shell,"looking for Drives\n");
tFolder=FT_UNKNOWN;
break;
case CSIDL_FONTS:
strcpy (buffer,"Fonts");
break;
case CSIDL_NETHOOD:
strcpy (buffer,"NetHood");
break;
case CSIDL_NETWORK:
strcpy (buffer,"xxx"); /*virtual folder*/
TRACE (shell,"looking for Network\n");
tFolder=FT_UNKNOWN;
break;
case CSIDL_PERSONAL:
strcpy (buffer,"Personal");
break;
case CSIDL_FAVORITES:
strcpy (buffer,"Favorites");
break;
case CSIDL_PRINTERS:
strcpy (buffer,"PrintHood");
break;
case CSIDL_PROGRAMS:
strcpy (buffer,"Programs");
break;
case CSIDL_RECENT:
strcpy (buffer,"Recent");
break;
case CSIDL_SENDTO:
strcpy (buffer,"SendTo");
break;
case CSIDL_STARTMENU:
strcpy (buffer,"Start Menu");
break;
case CSIDL_STARTUP:
strcpy (buffer,"Startup");
break;
case CSIDL_TEMPLATES:
strcpy (buffer,"Templates");
break;
default:
ERR (shell,"unknown CSIDL\n");
tFolder=FT_UNKNOWN;
break;
}
TRACE(shell,"Key=%s\n",buffer);
type=REG_SZ;
switch (tFolder)
{ case FT_DIR:
/* Directory: get the value from the registry, if its not there
create it and the directory*/
if (RegQueryValueEx32A(key,buffer,NULL,&type,tpath,&tpathlen))
{ GetWindowsDirectory32A(npath,MAX_PATH);
PathAddBackslash(npath);
switch (nFolder)
{ case CSIDL_DESKTOPDIRECTORY:
strcat (npath,"Desktop");
break;
case CSIDL_FONTS:
strcat (npath,"Fonts");
break;
case CSIDL_NETHOOD:
strcat (npath,"NetHood");
break;
case CSIDL_PERSONAL:
strcpy (npath,"C:\\Personal");
break;
case CSIDL_FAVORITES:
strcat (npath,"Favorites");
break;
case CSIDL_PRINTERS:
strcat (npath,"PrintHood");
break;
case CSIDL_PROGRAMS:
strcat (npath,"Start Menu");
CreateDirectory32A(npath,NULL);
strcat (npath,"\\Programs");
break;
case CSIDL_RECENT:
strcat (npath,"Recent");
break;
case CSIDL_SENDTO:
strcat (npath,"SendTo");
break;
case CSIDL_STARTMENU:
strcat (npath,"Start Menu");
break;
case CSIDL_STARTUP:
strcat (npath,"Start Menu");
CreateDirectory32A(npath,NULL);
strcat (npath,"\\Startup");
break;
case CSIDL_TEMPLATES:
strcat (npath,"Templates");
break;
default:
RegCloseKey(key);
return E_OUTOFMEMORY;
}
if (RegSetValueEx32A(key,buffer,0,REG_SZ,npath,sizeof(npath)+1))
{ ERR(shell,"could not create value %s\n",buffer);
RegCloseKey(key);
return E_OUTOFMEMORY;
}
TRACE(shell,"value %s=%s created\n",buffer,npath);
CreateDirectory32A(npath,NULL);
}
break;
case FT_DESKTOP:
strcpy (tpath,"Desktop");
break;
default:
RegCloseKey(key);
return E_OUTOFMEMORY;
break;
}
RegCloseKey(key);
TRACE(shell,"Value=%s\n",tpath);
LocalToWideChar32(lpszDisplayName, tpath, 256);
if (SHGetDesktopFolder(&shellfolder)==S_OK)
{ shellfolder->lpvtbl->fnParseDisplayName(shellfolder,hwndOwner, NULL,lpszDisplayName,&pchEaten,ppidl,NULL);
shellfolder->lpvtbl->fnRelease(shellfolder);
}
TRACE(shell, "-- (new pidl %p)\n",*ppidl);
return NOERROR;
}
/*************************************************************************
* SHHelpShortcuts_RunDLL [SHELL32.224]
*
*/
DWORD WINAPI SHHelpShortcuts_RunDLL (DWORD dwArg1, DWORD dwArg2, DWORD dwArg3, DWORD dwArg4)
{ FIXME (exec, "(%lx, %lx, %lx, %lx) empty stub!\n",
dwArg1, dwArg2, dwArg3, dwArg4);
return 0;
}
/*************************************************************************
* SHLoadInProc [SHELL32.225]
*
*/
DWORD WINAPI SHLoadInProc (DWORD dwArg1)
{ FIXME (shell, "(%lx) empty stub!\n", dwArg1);
return 0;
}
/*************************************************************************
* ShellExecute32A (SHELL32.245)
*/
HINSTANCE32 WINAPI ShellExecute32A( HWND32 hWnd, LPCSTR lpOperation,
LPCSTR lpFile, LPCSTR lpParameters,
LPCSTR lpDirectory, INT32 iShowCmd )
{ TRACE(shell,"\n");
return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
lpDirectory, iShowCmd );
}
/*************************************************************************
* AboutDlgProc32 (not an exported API function)
*/
LRESULT WINAPI AboutDlgProc32( HWND32 hWnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam )
{ HWND32 hWndCtl;
char Template[512], AppTitle[512];
TRACE(shell,"\n");
switch(msg)
{ case WM_INITDIALOG:
{ ABOUT_INFO *info = (ABOUT_INFO *)lParam;
if (info)
{ const char* const *pstr = SHELL_People;
SendDlgItemMessage32A(hWnd, stc1, STM_SETICON32,info->hIcon, 0);
GetWindowText32A( hWnd, Template, sizeof(Template) );
sprintf( AppTitle, Template, info->szApp );
SetWindowText32A( hWnd, AppTitle );
SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT),
info->szOtherStuff );
hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
SendMessage32A( hWndCtl, WM_SETREDRAW, 0, 0 );
SendMessage32A( hWndCtl, WM_SETFONT, hIconTitleFont, 0 );
while (*pstr)
{ SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)*pstr );
pstr++;
}
SendMessage32A( hWndCtl, WM_SETREDRAW, 1, 0 );
}
}
return 1;
case WM_PAINT:
{ RECT32 rect;
PAINTSTRUCT32 ps;
HDC32 hDC = BeginPaint32( hWnd, &ps );
if( __get_dropline( hWnd, &rect ) )
GRAPH_DrawLines( hDC, (LPPOINT32)&rect, 1, GetStockObject32( BLACK_PEN ) );
EndPaint32( hWnd, &ps );
}
break;
case WM_LBTRACKPOINT:
hWndCtl = GetDlgItem32(hWnd, IDC_LISTBOX);
if( (INT16)GetKeyState16( VK_CONTROL ) < 0 )
{ if( DragDetect32( hWndCtl, *((LPPOINT32)&lParam) ) )
{ INT32 idx = SendMessage32A( hWndCtl, LB_GETCURSEL32, 0, 0 );
if( idx != -1 )
{ INT32 length = SendMessage32A( hWndCtl, LB_GETTEXTLEN32, (WPARAM32)idx, 0 );
HGLOBAL16 hMemObj = GlobalAlloc16( GMEM_MOVEABLE, length + 1 );
char* pstr = (char*)GlobalLock16( hMemObj );
if( pstr )
{ HCURSOR16 hCursor = LoadCursor16( 0, MAKEINTRESOURCE16(OCR_DRAGOBJECT) );
SendMessage32A( hWndCtl, LB_GETTEXT32, (WPARAM32)idx, (LPARAM)pstr );
SendMessage32A( hWndCtl, LB_DELETESTRING32, (WPARAM32)idx, 0 );
UpdateWindow32( hWndCtl );
if( !DragObject16((HWND16)hWnd, (HWND16)hWnd, DRAGOBJ_DATA, 0, (WORD)hMemObj, hCursor) )
SendMessage32A( hWndCtl, LB_ADDSTRING32, (WPARAM32)-1, (LPARAM)pstr );
}
if( hMemObj )
GlobalFree16( hMemObj );
}
}
}
break;
case WM_QUERYDROPOBJECT:
if( wParam == 0 )
{ LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA )
{ RECT32 rect;
if( __get_dropline( hWnd, &rect ) )
{ POINT32 pt = { lpDragInfo->pt.x, lpDragInfo->pt.y };
rect.bottom += DROP_FIELD_HEIGHT;
if( PtInRect32( &rect, pt ) )
{ SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
return TRUE;
}
}
}
}
break;
case WM_DROPOBJECT:
if( wParam == hWnd )
{ LPDRAGINFO lpDragInfo = (LPDRAGINFO)PTR_SEG_TO_LIN((SEGPTR)lParam);
if( lpDragInfo && lpDragInfo->wFlags == DRAGOBJ_DATA && lpDragInfo->hList )
{ char* pstr = (char*)GlobalLock16( (HGLOBAL16)(lpDragInfo->hList) );
if( pstr )
{ static char __appendix_str[] = " with";
hWndCtl = GetDlgItem32( hWnd, IDC_WINE_TEXT );
SendMessage32A( hWndCtl, WM_GETTEXT, 512, (LPARAM)Template );
if( !lstrncmp32A( Template, "WINE", 4 ) )
SetWindowText32A( GetDlgItem32(hWnd, IDC_STATIC_TEXT), Template );
else
{ char* pch = Template + strlen(Template) - strlen(__appendix_str);
*pch = '\0';
SendMessage32A( GetDlgItem32(hWnd, IDC_LISTBOX), LB_ADDSTRING32,
(WPARAM32)-1, (LPARAM)Template );
}
lstrcpy32A( Template, pstr );
lstrcat32A( Template, __appendix_str );
SetWindowText32A( hWndCtl, Template );
SetWindowLong32A( hWnd, DWL_MSGRESULT, 1 );
return TRUE;
}
}
}
break;
case WM_COMMAND:
if (wParam == IDOK)
{ EndDialog32(hWnd, TRUE);
return TRUE;
}
break;
}
return 0;
}
/*************************************************************************
* ShellAbout32A (SHELL32.243)
*/
BOOL32 WINAPI ShellAbout32A( HWND32 hWnd, LPCSTR szApp, LPCSTR szOtherStuff,
HICON32 hIcon )
{ ABOUT_INFO info;
TRACE(shell,"\n");
info.szApp = szApp;
info.szOtherStuff = szOtherStuff;
info.hIcon = hIcon;
if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
return DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
hWnd, AboutDlgProc32, (LPARAM)&info );
}
/*************************************************************************
* ShellAbout32W (SHELL32.244)
*/
BOOL32 WINAPI ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
HICON32 hIcon )
{ BOOL32 ret;
ABOUT_INFO info;
TRACE(shell,"\n");
info.szApp = HEAP_strdupWtoA( GetProcessHeap(), 0, szApp );
info.szOtherStuff = HEAP_strdupWtoA( GetProcessHeap(), 0, szOtherStuff );
info.hIcon = hIcon;
if (!hIcon) info.hIcon = LoadIcon16( 0, MAKEINTRESOURCE16(OIC_WINEICON) );
ret = DialogBoxIndirectParam32A( WIN_GetWindowInstance( hWnd ),
SYSRES_GetResPtr( SYSRES_DIALOG_SHELL_ABOUT_MSGBOX ),
hWnd, AboutDlgProc32, (LPARAM)&info );
HeapFree( GetProcessHeap(), 0, (LPSTR)info.szApp );
HeapFree( GetProcessHeap(), 0, (LPSTR)info.szOtherStuff );
return ret;
}
/*************************************************************************
* Shell_NotifyIcon [SHELL32.296]
* 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 )
{ TRACE(shell,"\n");
return FALSE;
}
/*************************************************************************
* Shell_NotifyIcon [SHELL32.297]
* 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 )
{ TRACE(shell,"\n");
return FALSE;
}
/*************************************************************************
* FreeIconList
*/
void WINAPI FreeIconList( DWORD dw )
{ FIXME(shell, "(%lx): stub\n",dw);
}
/*************************************************************************
* SHGetPathFromIDList32A [SHELL32.261][NT 4.0: SHELL32.220]
*
* PARAMETERS
* pidl, [IN] pidl
* pszPath [OUT] path
*
* RETURNS
* path from a passed PIDL.
*
* NOTES
* exported by name
*
* FIXME
* fnGetDisplayNameOf can return different types of OLEString
*/
DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath)
{ STRRET lpName;
LPSHELLFOLDER shellfolder;
CHAR buffer[MAX_PATH],tpath[MAX_PATH];
DWORD type,tpathlen=MAX_PATH,dwdisp;
HKEY key;
TRACE(shell,"(pidl=%p,%p)\n",pidl,pszPath);
if (!pidl)
{ strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\");
if (RegCreateKeyEx32A(HKEY_CURRENT_USER,buffer,0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&key,&dwdisp))
{ return E_OUTOFMEMORY;
}
type=REG_SZ;
strcpy (buffer,"Desktop"); /*registry name*/
if ( RegQueryValueEx32A(key,buffer,NULL,&type,tpath,&tpathlen))
{ GetWindowsDirectory32A(tpath,MAX_PATH);
PathAddBackslash(tpath);
strcat (tpath,"Desktop"); /*folder name*/
RegSetValueEx32A(key,buffer,0,REG_SZ,tpath,tpathlen);
CreateDirectory32A(tpath,NULL);
}
RegCloseKey(key);
strcpy(pszPath,tpath);
}
else
{ if (SHGetDesktopFolder(&shellfolder)==S_OK)
{ shellfolder->lpvtbl->fnGetDisplayNameOf(shellfolder,pidl,SHGDN_FORPARSING,&lpName);
shellfolder->lpvtbl->fnRelease(shellfolder);
}
/*WideCharToLocal32(pszPath, lpName.u.pOleStr, MAX_PATH);*/
strcpy(pszPath,lpName.u.cStr);
/* fixme free the olestring*/
}
TRACE(shell,"-- (%s)\n",pszPath);
return NOERROR;
}
/*************************************************************************
* SHGetPathFromIDList32W [SHELL32.262]
*/
DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath)
{ FIXME (shell,"(pidl=%p %s):stub.\n", pidl, debugstr_w(pszPath));
return 0;
}
void (CALLBACK* pDLLInitComctl)();
INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
INT32(CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
/*************************************************************************
* SHELL32 LibMain
*
* FIXME
* at the moment the icons are extracted from shell32.dll
* free the imagelists
*/
HINSTANCE32 shell32_hInstance;
BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ HICON32 htmpIcon;
UINT32 iiconindex;
UINT32 index;
CHAR szShellPath[MAX_PATH];
HINSTANCE32 hComctl32;
TRACE(shell,"0x%x 0x%lx %p\n", hinstDLL, fdwReason, lpvReserved);
shell32_hInstance = hinstDLL;
GetWindowsDirectory32A(szShellPath,MAX_PATH);
PathAddBackslash(szShellPath);
strcat(szShellPath,"system\\shell32.dll");
if (fdwReason==DLL_PROCESS_ATTACH)
{ hComctl32 = LoadLibrary32A("COMCTL32.DLL");
if (hComctl32)
{ pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx");
if (pDLLInitComctl)
{ pDLLInitComctl();
}
pImageList_Create=GetProcAddress32(hComctl32,"ImageList_Create");
pImageList_AddIcon=GetProcAddress32(hComctl32,"ImageList_AddIcon");
pImageList_ReplaceIcon=GetProcAddress32(hComctl32,"ImageList_ReplaceIcon");
pImageList_GetIcon=GetProcAddress32(hComctl32,"ImageList_GetIcon");
FreeLibrary32(hComctl32);
}
else
{ /* panic, imediately exit wine*/
ERR(shell,"P A N I C error getting functionpointers\n");
exit (1);
}
if ( ! ShellSmallIconList )
{ if ( (ShellSmallIconList = pImageList_Create(sysMetrics[SM_CXSMICON],sysMetrics[SM_CYSMICON],0x101,0,0x20)) )
{ for (index=0;index < 40; index++)
{ if ( ! ( htmpIcon = ExtractIcon32A(hinstDLL, szShellPath, index))
|| ( -1 == (iiconindex = pImageList_AddIcon (ShellSmallIconList, htmpIcon))) )
{ ERR(shell,"could not initialize iconlist (is shell32.dll in the system directory?)\n");
break;
}
}
}
}
if ( ! ShellBigIconList )
{ if ( (ShellBigIconList = pImageList_Create(SYSMETRICS_CXSMICON, SYSMETRICS_CYSMICON,0x101,0,0x20)) )
{ for (index=0;index < 40; index++)
{ if ( ! (htmpIcon = ExtractIcon32A( hinstDLL, szShellPath, index))
|| (-1 == (iiconindex = pImageList_AddIcon (ShellBigIconList, htmpIcon))) )
{ ERR(shell,"could not initialize iconlist (is shell32.dll in the system directory?)\n");
break;
}
}
}
}
TRACE(shell,"hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);
}
return TRUE;
}

View File

@ -0,0 +1,31 @@
/*
* internal Shell32 Library definitions
*/
#ifndef __WINE_SHELL_MAIN_H
#define __WINE_SHELL_MAIN_H
/*******************************************
* global SHELL32.DLL variables
*/
extern HINSTANCE32 shell32_hInstance;
extern UINT32 shell32_DllRefCount;
extern HIMAGELIST ShellSmallIconList;
extern HIMAGELIST ShellBigIconList;
/*******************************************
* pointer to functions dynamically loaded
*/
extern void (CALLBACK* pDLLInitComctl)();
extern INT32 (CALLBACK* pImageList_AddIcon) (HIMAGELIST himl, HICON32 hIcon);
extern INT32(CALLBACK* pImageList_ReplaceIcon) (HIMAGELIST, INT32, HICON32);
extern HIMAGELIST (CALLBACK * pImageList_Create) (INT32,INT32,UINT32,INT32,INT32);
extern HICON32 (CALLBACK * pImageList_GetIcon) (HIMAGELIST, INT32, UINT32);
/* FIXME should be moved to a header file. IsEqualGUID
is declared but not exported in compobj.c !!!*/
#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
#endif

346
dlls/shell32/shellole.c Normal file
View File

@ -0,0 +1,346 @@
/*
* Shell Folder stuff (...and all the OLE-Objects of SHELL32.DLL)
*
* Copyright 1997 Marcus Meissner
* Copyright 1998 Juergen Schmied <juergen.schmied@metronet.de>
*
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "ole.h"
#include "ole2.h"
#include "debug.h"
#include "compobj.h"
#include "interfaces.h"
#include "shlobj.h"
#include "shell.h"
#include "winerror.h"
#include "winnls.h"
#include "winproc.h"
#include "commctrl.h"
#include "shell32_main.h"
/*************************************************************************
*
*/
typedef DWORD (* WINAPI GetClassPtr)(REFCLSID,REFIID,LPVOID);
static GetClassPtr SH_find_moduleproc(LPSTR dllname,HMODULE32 *xhmod,LPSTR name)
{ HMODULE32 hmod;
FARPROC32 dllunload,nameproc;
if (xhmod)
{ *xhmod = 0;
}
if (!strcasecmp(PathFindFilename(dllname),"shell32.dll"))
{ return (GetClassPtr)SHELL32_DllGetClassObject;
}
hmod = LoadLibraryEx32A(dllname,0,LOAD_WITH_ALTERED_SEARCH_PATH);
if (!hmod)
{ return NULL;
}
dllunload = GetProcAddress32(hmod,"DllCanUnloadNow");
if (!dllunload)
{ if (xhmod)
{ *xhmod = hmod;
}
}
nameproc = GetProcAddress32(hmod,name);
if (!nameproc)
{ FreeLibrary32(hmod);
return NULL;
}
/* register unloadable dll with unloadproc ... */
return (GetClassPtr)nameproc;
}
/*************************************************************************
*
*/
static DWORD SH_get_instance(REFCLSID clsid,LPSTR dllname,LPVOID unknownouter,REFIID refiid,LPVOID inst)
{ GetClassPtr dllgetclassob;
DWORD hres;
LPCLASSFACTORY classfac;
char xclsid[50],xrefiid[50];
WINE_StringFromCLSID((LPCLSID)clsid,xclsid);
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(shell,"\n\tCLSID:%s,%s,%p,\n\tIID:%s,%p\n",xclsid, dllname,unknownouter,xrefiid,inst);
dllgetclassob = SH_find_moduleproc(dllname,NULL,"DllGetClassObject");
if (!dllgetclassob)
{ return 0x80070000|GetLastError();
}
/* FIXME */
/*
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,inst);
if (hres<0)
return hres;
*/
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,&classfac);
if (hres<0 || (hres>=0x80000000))
{ return hres;
}
if (!classfac)
{ FIXME(shell,"no classfactory, but hres is 0x%ld!\n",hres);
return E_FAIL;
}
classfac->lpvtbl->fnCreateInstance(classfac,unknownouter,refiid,inst);
classfac->lpvtbl->fnRelease(classfac);
return 0;
}
/*************************************************************************
* SHCoCreateInstance [SHELL32.102]
*
* NOTES
* exported by ordinal
*/
LRESULT WINAPI SHCoCreateInstance(LPSTR aclsid,CLSID *clsid,LPUNKNOWN unknownouter,REFIID refiid,LPVOID inst)
{ char buffer[256],xclsid[48],xiid[48],path[260],tmodel[100];
HKEY inprockey;
DWORD pathlen,type,tmodellen;
DWORD hres;
WINE_StringFromCLSID(refiid,xiid);
if (clsid)
{ WINE_StringFromCLSID(clsid,xclsid);
}
else
{ if (!aclsid)
{ return 0x80040154;
}
strcpy(xclsid,aclsid);
}
TRACE(shell,"(%p,\n\tSID:\t%s,%p,\n\tIID:\t%s,%p)\n",aclsid,xclsid,unknownouter,xiid,inst);
sprintf(buffer,"CLSID\\%s\\InProcServer32",xclsid);
if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT,buffer,0,0x02000000,&inprockey))
{ return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
}
pathlen=sizeof(path);
if (RegQueryValue32A(inprockey,NULL,path,&pathlen))
{ RegCloseKey(inprockey);
return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
}
TRACE(shell, "Server dll is %s\n",path);
tmodellen=sizeof(tmodel);
type=REG_SZ;
if (RegQueryValueEx32A(inprockey,"ThreadingModel",NULL,&type,tmodel,&tmodellen))
{ RegCloseKey(inprockey);
return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
}
TRACE(shell, "Threading model is %s\n",tmodel);
hres=SH_get_instance(clsid,path,unknownouter,refiid,inst);
if (hres<0)
{ hres=SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
}
RegCloseKey(inprockey);
return hres;
}
/*************************************************************************
* SHELL32_DllGetClassObject [SHELL32.128]
*
* [Standart OLE/COM Interface Method]
* This Function retrives the pointer to a specified interface (iid) of
* a given class (rclsid).
* With this pointer it's possible to call the IClassFactory_CreateInstance
* method to get a instance of the requested Class.
* This function does NOT instantiate the Class!!!
*
* RETURNS
* HRESULT
*
*/
DWORD WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid,REFIID iid,LPVOID *ppv)
{ HRESULT hres = E_OUTOFMEMORY;
LPCLASSFACTORY lpclf;
char xclsid[50],xiid[50];
WINE_StringFromCLSID((LPCLSID)rclsid,xclsid);
WINE_StringFromCLSID((LPCLSID)iid,xiid);
TRACE(shell,"\n\tCLSID:\t%s,\n\tIID:\t%s\n",xclsid,xiid);
*ppv = NULL;
if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)||
IsEqualCLSID(rclsid, &CLSID_ShellLink))
{ if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)) /*debug*/
{ TRACE(shell,"requested CLSID_ShellDesktop\n");
}
if(IsEqualCLSID(rclsid, &CLSID_ShellLink)) /*debug*/
{ TRACE(shell,"requested CLSID_ShellLink\n");
}
lpclf = IClassFactory_Constructor();
if(lpclf)
{ hres = lpclf->lpvtbl->fnQueryInterface(lpclf,iid, ppv);
lpclf->lpvtbl->fnRelease(lpclf);
}
}
else
{ WARN(shell, "clsid(%s) not in buildin SHELL32\n",xclsid);
hres = CLASS_E_CLASSNOTAVAILABLE;
}
TRACE(shell,"RETURN pointer to interface: %p\n",ppv);
return hres;
}
/*************************************************************************
* 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(LPMALLOC32 *lpmal)
{ TRACE(shell,"(%p)\n", lpmal);
return CoGetMalloc32(0,lpmal);
}
/**************************************************************************
* IClassFactory Implementation
*/
static HRESULT WINAPI IClassFactory_QueryInterface(LPCLASSFACTORY,REFIID,LPVOID*);
static ULONG WINAPI IClassFactory_AddRef(LPCLASSFACTORY);
static ULONG WINAPI IClassFactory_Release(LPCLASSFACTORY);
static HRESULT WINAPI IClassFactory_CreateInstance();
static HRESULT WINAPI IClassFactory_LockServer();
/**************************************************************************
* IClassFactory_VTable
*/
static IClassFactory_VTable clfvt =
{ IClassFactory_QueryInterface,
IClassFactory_AddRef,
IClassFactory_Release,
IClassFactory_CreateInstance,
IClassFactory_LockServer
};
/**************************************************************************
* IClassFactory_Constructor
*/
LPCLASSFACTORY IClassFactory_Constructor()
{ LPCLASSFACTORY lpclf;
lpclf= (LPCLASSFACTORY)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactory));
lpclf->ref = 1;
lpclf->lpvtbl = &clfvt;
TRACE(shell,"(%p)->()\n",lpclf);
return lpclf;
}
/**************************************************************************
* IClassFactory::QueryInterface
*/
static HRESULT WINAPI IClassFactory_QueryInterface(
LPCLASSFACTORY this, REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
}
else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
{ *ppvObj = (IClassFactory*)this;
}
if(*ppvObj)
{ (*(LPCLASSFACTORY*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/******************************************************************************
* IClassFactory_AddRef
*/
static ULONG WINAPI IClassFactory_AddRef(LPCLASSFACTORY this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
return ++(this->ref);
}
/******************************************************************************
* IClassFactory_Release
*/
static ULONG WINAPI IClassFactory_Release(LPCLASSFACTORY this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
if (!--(this->ref))
{ TRACE(shell,"-- destroying IClassFactory(%p)\n",this);
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}
/******************************************************************************
* IClassFactory_CreateInstance
*/
static HRESULT WINAPI IClassFactory_CreateInstance(
LPCLASSFACTORY this, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
{ IUnknown *pObj = NULL;
HRESULT hres;
char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject);
*ppObject = NULL;
if(pUnknown)
{ return(CLASS_E_NOAGGREGATION);
}
if (IsEqualIID(riid, &IID_IShellFolder))
{ pObj = (IUnknown *)IShellFolder_Constructor(NULL,NULL);
}
else if (IsEqualIID(riid, &IID_IShellView))
{ pObj = (IUnknown *)IShellView_Constructor();
}
else if (IsEqualIID(riid, &IID_IShellLink))
{ pObj = (IUnknown *)IShellLink_Constructor();
}
else if (IsEqualIID(riid, &IID_IExtractIcon))
{ pObj = (IUnknown *)IExtractIcon_Constructor(NULL);
}
else if (IsEqualIID(riid, &IID_IContextMenu))
{ pObj = (IUnknown *)IContextMenu_Constructor(NULL, NULL, 0);
}
else
{ ERR(shell,"unknown IID requested\n\tIID:\t%s\n",xriid);
return(E_NOINTERFACE);
}
if (!pObj)
{ return(E_OUTOFMEMORY);
}
hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
pObj->lpvtbl->fnRelease(pObj);
TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject);
return hres;
}
/******************************************************************************
* IClassFactory_LockServer
*/
static HRESULT WINAPI IClassFactory_LockServer(LPCLASSFACTORY this, BOOL32 fLock)
{ TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock);
return E_NOTIMPL;
}

View File

@ -30,19 +30,8 @@
#include "shlobj.h"
#include "debug.h"
#include "winreg.h"
#include "shell32_main.h"
void pdump (LPCITEMIDLIST pidl)
{ DWORD type;
CHAR * szData;
LPITEMIDLIST pidltemp = pidl;
TRACE(shell,"---------- pidl=%p \n", pidl);
do
{ szData = ((LPPIDLDATA )(pidltemp->mkid.abID))->szText;
type = ((LPPIDLDATA )(pidltemp->mkid.abID))->type;
TRACE (shell,"---- pidl=%p size=%u type=%lx %s\n",pidltemp, pidltemp->mkid.cb,type,debugstr_a(szData));
pidltemp = (LPITEMIDLIST)(((BYTE*)pidltemp)+pidltemp->mkid.cb);
} while (pidltemp->mkid.cb);
}
/*************************************************************************
* SHChangeNotifyRegister [SHELL32.2]
* NOTES
@ -69,116 +58,6 @@ SHChangeNotifyDeregister(LONG x1,LONG x2)
{ FIXME(shell,"(0x%08lx,0x%08lx):stub.\n",x1,x2);
return 0;
}
/*************************************************************************
* ILGetDisplayName [SHELL32.15]
* get_path_from_itemlist(itemlist,path); ? not sure...
*/
BOOL32 WINAPI ILGetDisplayName(LPCITEMIDLIST iil,LPSTR path) {
FIXME(shell,"(%p,%p),stub, return e:!\n",iil,path);
strcpy(path,"e:\\");
return TRUE;
}
/*************************************************************************
* ILFindLastID [SHELL32.16]
*/
LPSHITEMID WINAPI ILFindLastID(LPITEMIDLIST iil) {
LPSHITEMID lastsii,sii;
TRACE(shell,"%p\n",iil);
if (!iil)
return NULL;
sii = &(iil->mkid);
lastsii = sii;
while (sii->cb) {
lastsii = sii;
sii = (LPSHITEMID)(((char*)sii)+sii->cb);
}
return lastsii;
}
/*************************************************************************
* ILFindLastID [SHELL32.17]
* NOTES
* Creates a new list with the last item removed
*/
LPITEMIDLIST WINAPI ILRemoveLastID(LPCITEMIDLIST pidl)
{ TRACE(shell,"pidl=%p\n",pidl);
return NULL;
}
/*************************************************************************
* ILClone [SHELL32.18]
*
* NOTES
* dupicate an idlist
*/
LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
{ DWORD len;
LPITEMIDLIST newpidl;
TRACE(shell,"%p\n",pidl);
if (!pidl)
return NULL;
len = ILGetSize(pidl);
newpidl = (LPITEMIDLIST)SHAlloc(len);
if (newpidl)
memcpy(newpidl,pidl,len);
return newpidl;
}
/*************************************************************************
* ILCloneFirst [SHELL32.19]
*
* NOTES
* duplicates the first idlist of a complex pidl
*/
LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
{ FIXME(shell,"pidl=%p\n",pidl);
return NULL;
}
/*************************************************************************
* ILCombine [SHELL32.25]
*
* NOTES
* Concatenates two complex idlists.
* The pidl is the first one, pidlsub the next one
* Does not destroy the passed in idlists!
*/
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1,LPCITEMIDLIST pidl2)
{ DWORD len1,len2;
LPITEMIDLIST pidlNew;
TRACE(shell,"pidl=%p pidl=%p\n",pidl1,pidl2);
if(!pidl1 && !pidl2)
{ return NULL;
}
if(!pidl1)
{ pidlNew = ILClone(pidl2);
return pidlNew;
}
if(!pidl2)
{ pidlNew = ILClone(pidl1);
return pidlNew;
}
len1 = ILGetSize(pidl1)-2;
len2 = ILGetSize(pidl2);
pidlNew = SHAlloc(len1+len2);
if (pidlNew)
{ memcpy(pidlNew,pidl1,len1);
memcpy(((BYTE *)pidlNew)+len1,pidl2,len2);
}
/* TRACE(shell,"--new pidl=%p\n",pidlNew);*/
return pidlNew;
}
/*************************************************************************
* PathIsRoot [SHELL32.29]
@ -279,14 +158,14 @@ LPSTR WINAPI PathRemoveBlanks(LPSTR str)
* NOTES
* basename(char *fn);
*/
LPSTR WINAPI PathFindFilename(LPSTR fn) {
LPSTR basefn;
TRACE(shell,"%s\n",fn);
LPSTR WINAPI PathFindFilename(LPSTR fn)
{ LPSTR basefn;
TRACE(shell,"%s\n",fn);
basefn = fn;
while (fn[0]) {
if (((fn[0]=='\\') || (fn[0]==':')) && fn[1] && fn[1]!='\\')
basefn = fn+1;
fn++;
while (fn[0])
{ if (((fn[0]=='\\') || (fn[0]==':')) && fn[1] && fn[1]!='\\')
basefn = fn+1;
fn++;
}
return basefn;
}
@ -486,17 +365,6 @@ DWORD WINAPI SHGetSettings(DWORD x,DWORD y,DWORD z) {
);
return 0;
}
/*************************************************************************
* Shell_GetImageList [SHELL32.71]
*
* NOTES
* returns internal shell values in the passed pointers
*/
BOOL32 WINAPI Shell_GetImageList(LPDWORD x,LPDWORD y) {
FIXME(shell,"(%p,%p):stub.\n",x,y);
return TRUE;
}
/*************************************************************************
* Shell_GetCachedImageIndex [SHELL32.72]
@ -558,6 +426,8 @@ SHMapPIDLToSystemImageListIndex(DWORD x,DWORD y,DWORD z)
*
* NOTES
* exported by ordinal
* FIXME
* wrong implemented OleStr is NOT wide string !!!! (jsch)
*/
BOOL32 WINAPI
OleStrToStrN (LPSTR lpMulti, INT32 nMulti, LPCWSTR lpWide, INT32 nWide) {
@ -570,7 +440,9 @@ OleStrToStrN (LPSTR lpMulti, INT32 nMulti, LPCWSTR lpWide, INT32 nWide) {
*
* NOTES
* exported by ordinal
*/
* FIXME
* wrong implemented OleStr is NOT wide string !!!! (jsch)
*/
BOOL32 WINAPI
StrToOleStrN (LPWSTR lpWide, INT32 nWide, LPCSTR lpMulti, INT32 nMulti) {
return MultiByteToWideChar (0, 0, lpMulti, nMulti, lpWide, nWide);
@ -631,125 +503,6 @@ void WINAPI RegisterShellHook32(HWND32 hwnd, DWORD y) {
FIXME(shell,"(0x%08x,0x%08lx):stub.\n",hwnd,y);
}
/*************************************************************************
*
*/
typedef DWORD (* WINAPI GetClassPtr)(REFCLSID,REFIID,LPVOID);
static GetClassPtr SH_find_moduleproc(LPSTR dllname,HMODULE32 *xhmod,
LPSTR name)
{ HMODULE32 hmod;
FARPROC32 dllunload,nameproc;
if (xhmod) *xhmod = 0;
if (!strcasecmp(PathFindFilename(dllname),"shell32.dll"))
return (GetClassPtr)SHELL32_DllGetClassObject;
hmod = LoadLibraryEx32A(dllname,0,LOAD_WITH_ALTERED_SEARCH_PATH);
if (!hmod)
return NULL;
dllunload = GetProcAddress32(hmod,"DllCanUnloadNow");
if (!dllunload)
if (xhmod) *xhmod = hmod;
nameproc = GetProcAddress32(hmod,name);
if (!nameproc) {
FreeLibrary32(hmod);
return NULL;
}
/* register unloadable dll with unloadproc ... */
return (GetClassPtr)nameproc;
}
/*************************************************************************
*
*/
static DWORD SH_get_instance(
REFCLSID clsid,
LPSTR dllname,
LPVOID unknownouter,
REFIID refiid,
LPVOID inst)
{ GetClassPtr dllgetclassob;
DWORD hres;
LPCLASSFACTORY classfac;
char xclsid[50],xrefiid[50];
WINE_StringFromCLSID((LPCLSID)clsid,xclsid);
WINE_StringFromCLSID((LPCLSID)refiid,xrefiid);
TRACE(shell,"\n\tCLSID:%s,%s,%p,\n\tIID:%s,%p\n",
xclsid, dllname,unknownouter,xrefiid,inst);
dllgetclassob = SH_find_moduleproc(dllname,NULL,"DllGetClassObject");
if (!dllgetclassob)
return 0x80070000|GetLastError();
/* FIXME */
/*
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,inst);
if (hres<0)
return hres;
*/
hres = (*dllgetclassob)(clsid,(REFIID)&IID_IClassFactory,&classfac);
if (hres<0 || (hres>=0x80000000))
return hres;
if (!classfac) {
FIXME(shell,"no classfactory, but hres is 0x%ld!\n",hres);
return E_FAIL;
}
classfac->lpvtbl->fnCreateInstance(classfac,unknownouter,refiid,inst);
classfac->lpvtbl->fnRelease(classfac);
return 0;
}
/*************************************************************************
* SHCoCreateInstance [SHELL32.102]
*
* NOTES
* exported by ordinal
*/
LRESULT WINAPI SHCoCreateInstance(
LPSTR aclsid,CLSID *clsid,LPUNKNOWN unknownouter,REFIID refiid,LPVOID inst
) {
char buffer[256],xclsid[48],xiid[48],path[260],tmodel[100];
HKEY inprockey;
DWORD pathlen,type,tmodellen;
DWORD hres;
WINE_StringFromCLSID(refiid,xiid);
if (clsid)
WINE_StringFromCLSID(clsid,xclsid);
else {
if (!aclsid)
return 0x80040154;
strcpy(xclsid,aclsid);
}
TRACE(shell,"(%p,\n\tSID:\t%s,%p,\n\tIID:\t%s,%p)\n",aclsid,xclsid,unknownouter,xiid,inst);
sprintf(buffer,"CLSID\\%s\\InProcServer32",xclsid);
if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT,buffer,0,0x02000000,&inprockey))
return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
pathlen=sizeof(path);
if (RegQueryValue32A(inprockey,NULL,path,&pathlen)) {
RegCloseKey(inprockey);
return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
}
TRACE(shell, "Server dll is %s\n",path);
tmodellen=sizeof(tmodel);
type=REG_SZ;
if (RegQueryValueEx32A(inprockey,"ThreadingModel",NULL,&type,tmodel,&tmodellen)) {
RegCloseKey(inprockey);
return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
}
TRACE(shell, "Threading model is %s\n",tmodel);
hres=SH_get_instance(clsid,path,unknownouter,refiid,inst);
if (hres<0)
hres=SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst);
RegCloseKey(inprockey);
return hres;
}
/*************************************************************************
* ShellMessageBoxA [SHELL32.183]
*
@ -775,7 +528,6 @@ ShellMessageBoxA(HMODULE32 hmod,HWND32 hwnd,DWORD id,DWORD x,DWORD type,LPVOID a
/*MessageBox32A(hwnd,buf3,buf,id|0x10000);*/
}
/*************************************************************************
* SHRestricted [SHELL32.100]
*
@ -816,49 +568,6 @@ DWORD WINAPI SHRestricted (DWORD pol) {
return 0;
}
/*************************************************************************
* ILGetSize [SHELL32.152]
* gets the byte size of an idlist including zero terminator (pidl)
*
* PARAMETERS
* pidl ITEMIDLIST
*
* RETURNS
* size of pidl
*
* NOTES
* exported by ordinal
*/
DWORD WINAPI ILGetSize(LPITEMIDLIST pidl)
{ LPSHITEMID si = &(pidl->mkid);
DWORD len=0;
TRACE(shell,"pidl=%p\n",pidl);
if (pidl)
{ while (si->cb)
{ len += si->cb;
si = (LPSHITEMID)(((LPBYTE)si)+si->cb);
}
len += 2;
}
/* TRACE(shell,"-- size=%lu\n",len);*/
return len;
}
/*************************************************************************
* ILAppend [SHELL32.154]
*
* NOTES
* Adds the single item to the idlist indicated by pidl.
* if bEnd is 0, adds the item to the front of the list,
* otherwise adds the item to the end.
* Destroys the passed in idlist!
*/
LPITEMIDLIST WINAPI ILAppend(LPITEMIDLIST pidl,LPCITEMIDLIST item,BOOL32 bEnd)
{ TRACE(shell,"(pidl=%p,pidl=%p,%08u)\n",pidl,item,bEnd);
return NULL;
}
/*************************************************************************
* PathGetExtension [SHELL32.158]
*
@ -918,22 +627,6 @@ LPVOID WINAPI SHAlloc(DWORD len) {
return ret;
}
/*************************************************************************
* ILFree [SHELL32.155]
*
* NOTES
* free_check_ptr - frees memory (if not NULL)
* allocated by SHMalloc allocator
* exported by ordinal
*/
DWORD WINAPI ILFree(LPVOID pidl)
{ TRACE (shell,"(pidl=0x%08lx)\n",(DWORD)pidl);
if (!pidl)
return 0;
return SHFree(pidl);
}
/*************************************************************************
* OpenRegStream [SHELL32.85]
*
@ -969,7 +662,6 @@ DWORD WINAPI SHRevokeDragDrop(DWORD x) {
return 0;
}
/*************************************************************************
* RunFileDlg [SHELL32.61]
*
@ -985,7 +677,6 @@ RunFileDlg (HWND32 hwndOwner, DWORD dwParam1, DWORD dwParam2,
return 0;
}
/*************************************************************************
* ExitWindowsDialog [SHELL32.60]
*
@ -999,7 +690,6 @@ ExitWindowsDialog (HWND32 hwndOwner)
return 0;
}
/*************************************************************************
* ArrangeWindows [SHELL32.184]
*
@ -1013,7 +703,6 @@ ArrangeWindows (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3,
return 0;
}
/*************************************************************************
* SHCLSIDFromString [SHELL32.147]
*
@ -1024,7 +713,6 @@ DWORD WINAPI
SHCLSIDFromString (DWORD dwParam1, DWORD dwParam2)
{
FIXME (shell,"(0x%lx 0x%lx):stub.\n", dwParam1, dwParam2);
FIXME (shell,"(\"%s\" \"%s\"):stub.\n", (LPSTR)dwParam1, (LPSTR)dwParam2);
return 0;
@ -1123,8 +811,8 @@ HRESULT WINAPI FileMenu_Create (DWORD u, DWORD v, DWORD w, DWORD x, DWORD z)
* ShellExecuteEx [SHELL32.291]
*
*/
HRESULT WINAPI ShellExecuteEx (DWORD u)
{ FIXME(shell,"0x%08lx stub\n",u);
BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFOA u)
{ FIXME(shell,"%p stub\n",u);
return 0;
}
/*************************************************************************

782
dlls/shell32/shlfolder.c Normal file
View File

@ -0,0 +1,782 @@
/*
* Shell Folder stuff (...and all the OLE-Objects of SHELL32.DLL)
*
* Copyright 1997 Marcus Meissner
* Copyright 1998 Juergen Schmied
*
* !!! currently work in progress on all classes 980818 !!!
* <contact juergen.schmied@metronet.de>
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "ole.h"
#include "ole2.h"
#include "debug.h"
#include "compobj.h"
#include "interfaces.h"
#include "shlobj.h"
#include "shell.h"
#include "winerror.h"
#include "winnls.h"
#include "winproc.h"
#include "commctrl.h"
#include "shell32_main.h"
static HRESULT WINAPI IShellFolder_QueryInterface(LPSHELLFOLDER,REFIID,LPVOID*);
static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER);
static ULONG WINAPI IShellFolder_Release(LPSHELLFOLDER);
static HRESULT WINAPI IShellFolder_Initialize(LPSHELLFOLDER,LPCITEMIDLIST);
static HRESULT WINAPI IShellFolder_ParseDisplayName(LPSHELLFOLDER,HWND32,LPBC,LPOLESTR32,DWORD*,LPITEMIDLIST*,DWORD*);
static HRESULT WINAPI IShellFolder_EnumObjects(LPSHELLFOLDER,HWND32,DWORD,LPENUMIDLIST*);
static HRESULT WINAPI IShellFolder_BindToObject(LPSHELLFOLDER,LPCITEMIDLIST,LPBC,REFIID,LPVOID*);
static HRESULT WINAPI IShellFolder_BindToStorage(LPSHELLFOLDER,LPCITEMIDLIST,LPBC,REFIID,LPVOID*);
static HRESULT WINAPI IShellFolder_CompareIDs(LPSHELLFOLDER,LPARAM,LPCITEMIDLIST,LPCITEMIDLIST);
static HRESULT WINAPI IShellFolder_CreateViewObject(LPSHELLFOLDER,HWND32,REFIID,LPVOID*);
static HRESULT WINAPI IShellFolder_GetAttributesOf(LPSHELLFOLDER,UINT32,LPCITEMIDLIST*,DWORD*);
static HRESULT WINAPI IShellFolder_GetUIObjectOf(LPSHELLFOLDER,HWND32,UINT32,LPCITEMIDLIST*,REFIID,UINT32*,LPVOID*);
static HRESULT WINAPI IShellFolder_GetDisplayNameOf(LPSHELLFOLDER,LPCITEMIDLIST,DWORD,LPSTRRET);
static HRESULT WINAPI IShellFolder_SetNameOf(LPSHELLFOLDER,HWND32,LPCITEMIDLIST,LPCOLESTR32,DWORD,LPITEMIDLIST*);
static BOOL32 WINAPI IShellFolder_GetFolderPath(LPSHELLFOLDER,LPSTR,DWORD);
/***************************************************************************
* GetNextElement (internal function)
*
* gets a part of a string till the first backslash
*
* PARAMETERS
* pszNext [IN] string to get the element from
* pszOut [IN] pointer to buffer whitch receives string
* dwOut [IN] length of pszOut
*
* RETURNS
* LPSTR pointer to first, not yet parsed char
*/
LPSTR GetNextElement(LPSTR pszNext,LPSTR pszOut,DWORD dwOut)
{ LPSTR pszTail = pszNext;
DWORD dwCopy;
TRACE(shell,"(%s %p 0x%08lx)\n",debugstr_a(pszNext),pszOut,dwOut);
if(!pszNext || !*pszNext)
return NULL;
while(*pszTail && (*pszTail != '\\'))
{ pszTail++;
}
dwCopy=((LPBYTE)pszTail-(LPBYTE)pszNext)/sizeof(CHAR)+1;
lstrcpyn32A(pszOut, pszNext, (dwOut<dwCopy)? dwOut : dwCopy);
if(*pszTail)
{ pszTail++;
}
TRACE(shell,"--(%s %s 0x%08lx)\n",debugstr_a(pszNext),debugstr_a(pszOut),dwOut);
return pszTail;
}
/***********************************************************************
* IShellFolder implementation
*/
static struct IShellFolder_VTable sfvt =
{ IShellFolder_QueryInterface,
IShellFolder_AddRef,
IShellFolder_Release,
IShellFolder_ParseDisplayName,
IShellFolder_EnumObjects,
IShellFolder_BindToObject,
IShellFolder_BindToStorage,
IShellFolder_CompareIDs,
IShellFolder_CreateViewObject,
IShellFolder_GetAttributesOf,
IShellFolder_GetUIObjectOf,
IShellFolder_GetDisplayNameOf,
IShellFolder_SetNameOf,
IShellFolder_GetFolderPath
};
/**************************************************************************
* IShellFolder_Constructor
*/
LPSHELLFOLDER IShellFolder_Constructor(LPSHELLFOLDER pParent,LPITEMIDLIST pidl)
{ LPSHELLFOLDER sf;
DWORD dwSize=0;
sf=(LPSHELLFOLDER)HeapAlloc(GetProcessHeap(),0,sizeof(IShellFolder));
sf->ref=1;
sf->lpvtbl=&sfvt;
sf->mlpszFolder=NULL;
sf->mpSFParent=pParent;
TRACE(shell,"(%p)->(parent=%p, pidl=%p)\n",sf,pParent, pidl);
/* create own pidl-manager*/
sf->pPidlMgr = PidlMgr_Constructor();
if (! sf->pPidlMgr )
{ HeapFree(GetProcessHeap(),0,sf);
ERR (shell,"-- Could not initialize PidMGR\n");
return NULL;
}
/* keep a copy of the pidl in the instance*/
sf->mpidl = ILClone(pidl);
sf->mpidlNSRoot = NULL;
if(sf->mpidl) /* do we have a pidl?*/
{ dwSize = 0;
if(sf->mpSFParent->mlpszFolder)
{ dwSize += strlen(sf->mpSFParent->mlpszFolder) + 1;
}
dwSize += sf->pPidlMgr->lpvtbl->fnGetFolderText(sf->pPidlMgr,sf->mpidl,NULL,0);
sf->mlpszFolder = SHAlloc(dwSize);
if(sf->mlpszFolder)
{ *(sf->mlpszFolder)=0x00;
if(sf->mpSFParent->mlpszFolder)
{ strcpy(sf->mlpszFolder, sf->mpSFParent->mlpszFolder);
PathAddBackslash (sf->mlpszFolder);
}
sf->pPidlMgr->lpvtbl->fnGetFolderText(sf->pPidlMgr, sf->mpidl, sf->mlpszFolder+strlen(sf->mlpszFolder), dwSize-strlen(sf->mlpszFolder));
}
}
TRACE(shell,"-- (%p)->(%p,%p,parent=%s)\n",sf,pParent, pidl, debugstr_a(sf->mlpszFolder));
return sf;
}
/**************************************************************************
* IShellFolder::QueryInterface
* PARAMETERS
* REFIID riid, //[in ] Requested InterfaceID
* LPVOID* ppvObject) //[out] Interface* to hold the result
*/
static HRESULT WINAPI IShellFolder_QueryInterface(
LPSHELLFOLDER this, REFIID riid, LPVOID *ppvObj)
{ char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s,%p)\n",this,xriid,ppvObj);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
}
else if(IsEqualIID(riid, &IID_IShellFolder)) /*IShellFolder*/
{ *ppvObj = (IShellFolder*)this;
}
if(*ppvObj)
{ (*(LPSHELLFOLDER*)ppvObj)->lpvtbl->fnAddRef(this);
TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
return S_OK;
}
TRACE(shell,"-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/**************************************************************************
* IShellFolder::AddRef
*/
static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,(this->ref)+1);
return ++(this->ref);
}
/**************************************************************************
* IShellFolder_Release
*/
static ULONG WINAPI IShellFolder_Release(LPSHELLFOLDER this)
{ TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
if (!--(this->ref))
{ TRACE(shell,"-- destroying IShellFolder(%p)\n",this);
if (pdesktopfolder==this)
{ pdesktopfolder=NULL;
TRACE(shell,"-- destroyed IShellFolder(%p) was Desktopfolder\n",this);
}
if (this->pPidlMgr)
{ PidlMgr_Destructor(this->pPidlMgr);
}
if(this->mpidlNSRoot)
{ SHFree(this->mpidlNSRoot);
}
if(this->mpidl)
{ SHFree(this->mpidl);
}
if(this->mlpszFolder)
{ SHFree(this->mlpszFolder);
}
HeapFree(GetProcessHeap(),0,this);
return 0;
}
return this->ref;
}
/**************************************************************************
* IShellFolder_ParseDisplayName
* PARAMETERS
* HWND hwndOwner, //[in ] Parent window for any message's
* LPBC pbc, //[in ] reserved
* LPOLESTR lpszDisplayName,//[in ] "Unicode" displayname.
* ULONG* pchEaten, //[out] (unicode) characters processed
* LPITEMIDLIST* ppidl, //[out] complex pidl to item
* ULONG* pdwAttributes //[out] items attributes
*
* FIXME:
* pdwAttributes: not used
*/
static HRESULT WINAPI IShellFolder_ParseDisplayName(
LPSHELLFOLDER this,
HWND32 hwndOwner,
LPBC pbcReserved,
LPOLESTR32 lpszDisplayName,
DWORD *pchEaten,
LPITEMIDLIST *ppidl,
DWORD *pdwAttributes)
{ HRESULT hr=E_OUTOFMEMORY;
LPITEMIDLIST pidlFull=NULL, pidlTemp = NULL, pidlOld = NULL;
LPSTR pszNext=NULL;
CHAR szElement[MAX_PATH];
BOOL32 bType;
DWORD dwChars=lstrlen32W(lpszDisplayName) + 1;
LPSTR pszTemp=(LPSTR)HeapAlloc(GetProcessHeap(),0,dwChars * sizeof(CHAR));
TRACE(shell,"(%p)->(HWND=0x%08x,%p,%p=%s,%p,pidl=%p,%p)\n",
this,hwndOwner,pbcReserved,lpszDisplayName,debugstr_w(lpszDisplayName),pchEaten,ppidl,pdwAttributes);
if(pszTemp)
{ hr = E_FAIL;
WideCharToLocal32(pszTemp, lpszDisplayName, dwChars);
if(*pszTemp)
{ if (strcmp(pszTemp,"Desktop")==0)
{ pidlFull = (LPITEMIDLIST)HeapAlloc(GetProcessHeap(),0,2);
pidlFull->mkid.cb = 0;
}
else
{ pidlFull = this->pPidlMgr->lpvtbl->fnCreateMyComputer(this->pPidlMgr);
/* check if the lpszDisplayName is Folder or File*/
bType = ! (GetFileAttributes32A(pszNext)&FILE_ATTRIBUTE_DIRECTORY);
pszNext = GetNextElement(pszTemp, szElement, MAX_PATH);
pidlTemp = this->pPidlMgr->lpvtbl->fnCreateDrive(this->pPidlMgr,szElement);
pidlOld = pidlFull;
pidlFull = ILCombine(pidlFull,pidlTemp);
SHFree(pidlOld);
if(pidlFull)
{ while((pszNext=GetNextElement(pszNext, szElement, MAX_PATH)))
{ if(!*pszNext && bType)
{ pidlTemp = this->pPidlMgr->lpvtbl->fnCreateValue(this->pPidlMgr,szElement);
}
else
{ pidlTemp = this->pPidlMgr->lpvtbl->fnCreateFolder(this->pPidlMgr,szElement);
}
pidlOld = pidlFull;
pidlFull = ILCombine(pidlFull,pidlTemp);
SHFree(pidlOld);
}
hr = S_OK;
}
}
}
}
HeapFree(GetProcessHeap(),0,pszTemp);
*ppidl = pidlFull;
return hr;
}
/**************************************************************************
* IShellFolder_EnumObjects
* PARAMETERS
* HWND hwndOwner, //[in ] Parent Window
* DWORD grfFlags, //[in ] SHCONTF enumeration mask
* LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
*/
static HRESULT WINAPI IShellFolder_EnumObjects(
LPSHELLFOLDER this,
HWND32 hwndOwner,
DWORD dwFlags,
LPENUMIDLIST* ppEnumIDList)
{ HRESULT hr;
TRACE(shell,"(%p)->(HWND=0x%08x,0x%08lx,%p)\n",this,hwndOwner,dwFlags,ppEnumIDList);
*ppEnumIDList = NULL;
*ppEnumIDList = IEnumIDList_Constructor (this->mlpszFolder, dwFlags, &hr);
TRACE(shell,"-- (%p)->(new ID List: %p)\n",this,*ppEnumIDList);
if(!*ppEnumIDList)
{ return hr;
}
return S_OK;
}
/**************************************************************************
* IShellFolder_Initialize()
* IPersistFolder Method
*/
static HRESULT WINAPI IShellFolder_Initialize(
LPSHELLFOLDER this,
LPCITEMIDLIST pidl)
{ TRACE(shell,"(%p)->(pidl=%p)\n",this,pidl);
if(this->mpidlNSRoot)
{ SHFree(this->mpidlNSRoot);
this->mpidlNSRoot = NULL;
}
this->mpidlNSRoot=ILClone(pidl);
return S_OK;
}
/**************************************************************************
* IShellFolder_BindToObject
* PARAMETERS
* LPCITEMIDLIST pidl, //[in ] complex pidl to open
* LPBC pbc, //[in ] reserved
* REFIID riid, //[in ] Initial Interface
* LPVOID* ppvObject //[out] Interface*
*/
static HRESULT WINAPI IShellFolder_BindToObject(
LPSHELLFOLDER this,
LPCITEMIDLIST pidl,
LPBC pbcReserved,
REFIID riid,
LPVOID * ppvOut)
{ char xriid[50];
HRESULT hr;
LPSHELLFOLDER pShellFolder;
WINE_StringFromCLSID(riid,xriid);
TRACE(shell,"(%p)->(pidl=%p,%p,\n\tIID:%s,%p)\n",this,pidl,pbcReserved,xriid,ppvOut);
*ppvOut = NULL;
pShellFolder = IShellFolder_Constructor(this, pidl);
if(!pShellFolder)
return E_OUTOFMEMORY;
/* pShellFolder->lpvtbl->fnInitialize(pShellFolder, this->mpidlNSRoot);*/
IShellFolder_Initialize(pShellFolder, this->mpidlNSRoot);
hr = pShellFolder->lpvtbl->fnQueryInterface(pShellFolder, riid, ppvOut);
pShellFolder->lpvtbl->fnRelease(pShellFolder);
TRACE(shell,"-- (%p)->(interface=%p)\n",this, ppvOut);
return hr;
}
/**************************************************************************
* IShellFolder_BindToStorage
* PARAMETERS
* LPCITEMIDLIST pidl, //[in ] complex pidl to store
* LPBC pbc, //[in ] reserved
* REFIID riid, //[in ] Initial storage interface
* LPVOID* ppvObject //[out] Interface* returned
*/
static HRESULT WINAPI IShellFolder_BindToStorage(
LPSHELLFOLDER this,
LPCITEMIDLIST pidl, /*simple/complex pidl*/
LPBC pbcReserved,
REFIID riid,
LPVOID *ppvOut)
{ char xriid[50];
WINE_StringFromCLSID(riid,xriid);
FIXME(shell,"(%p)->(pidl=%p,%p,\n\tIID:%s,%p) stub\n",this,pidl,pbcReserved,xriid,ppvOut);
*ppvOut = NULL;
return E_NOTIMPL;
}
/**************************************************************************
* IShellFolder_CompareIDs
*
* PARMETERS
* LPARAM lParam, //[in ] Column?
* LPCITEMIDLIST pidl1, //[in ] simple pidl
* LPCITEMIDLIST pidl2) //[in ] simple pidl
* FIXME
* we have to handle simple pidl's only
*/
static HRESULT WINAPI IShellFolder_CompareIDs(
LPSHELLFOLDER this,
LPARAM lParam,
LPCITEMIDLIST pidl1, /*simple pidl*/
LPCITEMIDLIST pidl2) /*simple pidl*/
{ CHAR szString1[MAX_PATH] = "";
CHAR szString2[MAX_PATH] = "";
int nReturn;
LPCITEMIDLIST pidlTemp1 = pidl1, pidlTemp2 = pidl2;
TRACE(shell,"(%p)->(0x%08lx,pidl1=%p,pidl2=%p)\n",this,lParam,pidl1,pidl2);
/*Special case - If one of the items is a Path and the other is a File, always
make the Path come before the File.*/
/* get the last item in each list */
while((ILGetNext(pidlTemp1))->mkid.cb)
pidlTemp1 = ILGetNext(pidlTemp1);
while((ILGetNext(pidlTemp2))->mkid.cb)
pidlTemp2 = ILGetNext(pidlTemp2);
/* at this point, both pidlTemp1 and pidlTemp2 point to the last item in the list */
if(this->pPidlMgr->lpvtbl->fnIsValue(this->pPidlMgr,pidlTemp1) != this->pPidlMgr->lpvtbl->fnIsValue(this->pPidlMgr,pidlTemp2))
{ if(this->pPidlMgr->lpvtbl->fnIsValue(this->pPidlMgr,pidlTemp1))
return 1;
return -1;
}
this->pPidlMgr->lpvtbl->fnGetDrive(this->pPidlMgr, pidl1,szString1,sizeof(szString1));
this->pPidlMgr->lpvtbl->fnGetDrive(this->pPidlMgr, pidl2,szString1,sizeof(szString2));
nReturn = strcasecmp(szString1, szString2);
if(nReturn)
return nReturn;
this->pPidlMgr->lpvtbl->fnGetFolderText(this->pPidlMgr, pidl1,szString1,sizeof(szString1));
this->pPidlMgr->lpvtbl->fnGetFolderText(this->pPidlMgr, pidl2,szString2,sizeof(szString2));
nReturn = strcasecmp(szString1, szString2);
if(nReturn)
return nReturn;
this->pPidlMgr->lpvtbl->fnGetValueText(this->pPidlMgr,pidl1,szString1,sizeof(szString1));
this->pPidlMgr->lpvtbl->fnGetValueText(this->pPidlMgr,pidl2,szString2,sizeof(szString2));
return strcasecmp(szString1, szString2);
}
/**************************************************************************
* IShellFolder_CreateViewObject
* Creates an View Object representing the ShellFolder
* IShellView / IShellBrowser / IContextMenu
*
* PARAMETERS
* HWND hwndOwner, // Handle of owner window
* REFIID riid, // Requested initial interface
* LPVOID* ppvObject) // Resultant interface*
*
* NOTES
* the same as SHCreateShellFolderViewEx ???
*/
static HRESULT WINAPI IShellFolder_CreateViewObject(
LPSHELLFOLDER this,
HWND32 hwndOwner,
REFIID riid,
LPVOID *ppvOut)
{ LPSHELLVIEW pShellView;
char xriid[50];
HRESULT hr;
WINE_StringFromCLSID(riid,xriid);
TRACE(shell,"(%p)->(hwnd=0x%x,\n\tIID:\t%s,%p)\n",this,hwndOwner,xriid,ppvOut);
*ppvOut = NULL;
pShellView = IShellView_Constructor(this, this->mpidl);
if(!pShellView)
return E_OUTOFMEMORY;
hr = pShellView->lpvtbl->fnQueryInterface(pShellView, riid, ppvOut);
pShellView->lpvtbl->fnRelease(pShellView);
TRACE(shell,"-- (%p)->(interface=%p)\n",this, ppvOut);
return hr;
}
/**************************************************************************
* IShellFolder_GetAttributesOf
*
* PARAMETERS
* UINT cidl, //[in ] num elements in pidl array
+ LPCITEMIDLIST* apidl, //[in ] simple pidl array
* ULONG* rgfInOut) //[out] result array
*
* FIXME: quick hack
* Note: rgfInOut is documented as being an array of ULONGS.
* This does not seem to be the case. Testing this function using the shell to
* call it with cidl > 1 (by deleting multiple items) reveals that the shell
* passes ONE element in the array and writing to further elements will
* cause the shell to fail later.
*/
static HRESULT WINAPI IShellFolder_GetAttributesOf(
LPSHELLFOLDER this,
UINT32 cidl,
LPCITEMIDLIST *apidl, /*simple pidl's*/
DWORD *rgfInOut)
{ LPCITEMIDLIST * pidltemp;
DWORD i;
TRACE(shell,"(%p)->(%d,%p,%p)\n",this,cidl,apidl,rgfInOut);
if ((! cidl )| (!apidl) | (!rgfInOut))
return E_INVALIDARG;
pidltemp=apidl;
*rgfInOut = 0x00;
i=cidl;
TRACE(shell,"-- mask=0x%08lx\n",*rgfInOut);
do
{ if (*pidltemp)
{ if (this->pPidlMgr->lpvtbl->fnIsDesktop(this->pPidlMgr, *pidltemp))
{ *rgfInOut |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR);
}
else if (this->pPidlMgr->lpvtbl->fnIsMyComputer(this->pPidlMgr, *pidltemp))
{ *rgfInOut |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER);
}
else if (this->pPidlMgr->lpvtbl->fnIsDrive(this->pPidlMgr, *pidltemp))
{ *rgfInOut |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR | SFGAO_FILESYSTEM);
}
else if (this->pPidlMgr->lpvtbl->fnIsFolder(this->pPidlMgr, *pidltemp))
{ *rgfInOut |= (SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER);
}
else if (this->pPidlMgr->lpvtbl->fnIsValue(this->pPidlMgr, *pidltemp))
{ *rgfInOut |= (SFGAO_FILESYSTEM);
}
}
pidltemp++;
cidl--;
} while (cidl > 0 && *pidltemp);
return S_OK;
}
/**************************************************************************
* IShellFolder_GetUIObjectOf
*
* PARAMETERS
* HWND hwndOwner, //[in ] Parent window for any output
* UINT cidl, //[in ] array size
* LPCITEMIDLIST* apidl, //[in ] simple pidl array
* REFIID riid, //[in ] Requested Interface
* UINT* prgfInOut, //[ ] reserved
* LPVOID* ppvObject) //[out] Resulting Interface
*
* NOTES
* This function gets asked to return "view objects" for one or more (multiple select)
* items:
* The viewobject typically is an COM object with one of the following interfaces:
* IExtractIcon,IDataObject,IContextMenu
* In order to support icon positions in the default Listview your DataObject
* must implement the SetData method (in addition to GetData :) - the shell passes
* a barely documented "Icon positions" structure to SetData when the drag starts,
* and GetData's it if the drop is in another explorer window that needs the positions.
*/
static HRESULT WINAPI IShellFolder_GetUIObjectOf( LPSHELLFOLDER this,HWND32 hwndOwner,UINT32 cidl,
LPCITEMIDLIST * apidl, REFIID riid, UINT32 * prgfInOut,LPVOID * ppvOut)
{ char xclsid[50];
LPEXTRACTICON pei;
LPCONTEXTMENU pcm;
LPITEMIDLIST pidl;
WINE_StringFromCLSID(riid,xclsid);
TRACE(shell,"(%p)->(%u,%u,pidl=%p,\n\tIID:%s,%p,%p)\n",
this,hwndOwner,cidl,apidl,xclsid,prgfInOut,ppvOut);
*ppvOut = NULL;
if(IsEqualIID(riid, &IID_IContextMenu))
{ pcm = IContextMenu_Constructor(this, apidl, cidl);
if(pcm)
{ *ppvOut = pcm;
return S_OK;
}
}
if(cidl != 1)
return E_FAIL;
if(IsEqualIID(riid, &IID_IExtractIcon))
{ pidl = ILCombine(this->mpidl, apidl[0]);
pei = IExtractIcon_Constructor(pidl);
/* The temp PIDL can be deleted because the new CExtractIcon either failed or
made its own copy of it. */
SHFree(pidl);
if(pei)
{ *ppvOut = pei;
return S_OK;
}
return E_OUTOFMEMORY;
}
/* if(IsEqualIID(riid, IID_IQueryInfo))
{ CQueryInfo *pqit;
LPITEMIDLIST pidl;
pidl = m_pPidlMgr->Concatenate(m_pidl, pPidl[0]);
pqit = new CQueryInfo(pidl);
*/
/* The temp PIDL can be deleted because the new CQueryInfo either failed or
made its own copy of it. */
/* m_pPidlMgr->Delete(pidl);
if(pqit)
{ *ppvReturn = pqit;
return S_OK;
}
return E_OUTOFMEMORY;
}
*/
ERR(shell,"(%p)->E_NOINTERFACE\n",this);
return E_NOINTERFACE;
}
/**************************************************************************
* IShellFolder_GetDisplayNameOf
* Retrieves the display name for the specified file object or subfolder
*
* PARAMETERS
* LPCITEMIDLIST pidl, //[in ] complex pidl to item
* DWORD dwFlags, //[in ] SHGNO formatting flags
* LPSTRRET lpName) //[out] Returned display name
*
* FIXME
* if the name is in the pidl the ret value should be a STRRET_OFFSET
*/
#define GET_SHGDN_FOR(dwFlags) ((DWORD)dwFlags & (DWORD)0x0000FF00)
#define GET_SHGDN_RELATION(dwFlags) ((DWORD)dwFlags & (DWORD)0x000000FF)
static HRESULT WINAPI IShellFolder_GetDisplayNameOf(
LPSHELLFOLDER this,
LPCITEMIDLIST pidl, /* simple/complex pidl*/
DWORD dwFlags,
LPSTRRET lpName)
{ CHAR szText[MAX_PATH];
CHAR szTemp[MAX_PATH];
CHAR szSpecial[MAX_PATH];
CHAR szDrive[MAX_PATH];
DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags;
LPITEMIDLIST pidlTemp=NULL;
BOOL32 bSimplePidl=FALSE;
TRACE(shell,"(%p)->(pidl=%p,0x%08lx,%p)\n",this,pidl,dwFlags,lpName);
if (!pidl)
{ return E_OUTOFMEMORY;
}
szSpecial[0]=0x00;
szDrive[0]=0x00;
/* test if simple(relative) or complex(absolute) pidl */
pidlTemp = ILGetNext(pidl);
if (pidlTemp->mkid.cb==0x00)
{ bSimplePidl = TRUE;
}
if (this->pPidlMgr->lpvtbl->fnIsDesktop(this->pPidlMgr, pidl))
{ strcpy (szText,"Desktop");
}
else
{ if (this->pPidlMgr->lpvtbl->fnIsMyComputer(this->pPidlMgr, pidl))
{ this->pPidlMgr->lpvtbl->fnGetItemText(this->pPidlMgr, pidl, szSpecial, MAX_PATH);
}
if (this->pPidlMgr->lpvtbl->fnIsDrive(this->pPidlMgr, pidl))
{ pidlTemp = this->pPidlMgr->lpvtbl->fnGetLastItem(this->pPidlMgr,pidl);
if (pidlTemp)
{ this->pPidlMgr->lpvtbl->fnGetItemText(this->pPidlMgr, pidlTemp, szTemp, MAX_PATH);
}
if ( dwFlags==SHGDN_NORMAL || dwFlags==SHGDN_INFOLDER)
{ GetVolumeInformation32A(szTemp,szDrive,MAX_PATH,&dwVolumeSerialNumber,&dwMaximumComponetLength,&dwFileSystemFlags,NULL,0);
if (szTemp[2]=='\\')
{ szTemp[2]=0x00;
}
strcat (szDrive," (");
strcat (szDrive,szTemp);
strcat (szDrive,")");
}
else
{ PathAddBackslash (szTemp);
strcpy(szDrive,szTemp);
}
}
switch(dwFlags)
{ case SHGDN_NORMAL:
this->pPidlMgr->lpvtbl->fnGetPidlPath(this->pPidlMgr, pidl, szText, MAX_PATH);
break;
case SHGDN_INFOLDER:
pidlTemp = this->pPidlMgr->lpvtbl->fnGetLastItem(this->pPidlMgr,pidl);
if (pidlTemp)
{ this->pPidlMgr->lpvtbl->fnGetItemText(this->pPidlMgr, pidlTemp, szText, MAX_PATH);
}
break;
case SHGDN_FORPARSING:
if (bSimplePidl)
{ /* if the IShellFolder has parents, get the path from the
parent and add the ItemName*/
szText[0]=0x00;
if (this->mlpszFolder && strlen (this->mlpszFolder))
{ if (strcmp(this->mlpszFolder,"My Computer"))
{ strcpy (szText,this->mlpszFolder);
PathAddBackslash (szText);
}
}
pidlTemp = this->pPidlMgr->lpvtbl->fnGetLastItem(this->pPidlMgr,pidl);
if (pidlTemp)
{ this->pPidlMgr->lpvtbl->fnGetItemText(this->pPidlMgr, pidlTemp, szTemp, MAX_PATH );
}
strcat(szText,szTemp);
}
else
{ /* if the pidl is absolute, get everything from the pidl*/
this->pPidlMgr->lpvtbl->fnGetPidlPath(this->pPidlMgr, pidl, szText, MAX_PATH);
}
break;
default: return E_INVALIDARG;
}
if ((szText[0]==0x00 && szDrive[0]!=0x00)|| (bSimplePidl && szDrive[0]!=0x00))
{ strcpy(szText,szDrive);
}
if (szText[0]==0x00 && szSpecial[0]!=0x00)
{ strcpy(szText,szSpecial);
}
}
TRACE(shell,"-- (%p)->(%s,%s,%s)\n",this,szSpecial,szDrive,szText);
if(!(lpName))
{ return E_OUTOFMEMORY;
}
lpName->uType = STRRET_CSTR;
strcpy(lpName->u.cStr,szText);
return S_OK;
}
/**************************************************************************
* IShellFolder_SetNameOf
* Changes the name of a file object or subfolder, possibly changing its item
* identifier in the process.
*
* PARAMETERS
* HWND hwndOwner, //[in ] Owner window for output
* LPCITEMIDLIST pidl, //[in ] simple pidl of item to change
* LPCOLESTR lpszName, //[in ] the items new display name
* DWORD dwFlags, //[in ] SHGNO formatting flags
* LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
*/
static HRESULT WINAPI IShellFolder_SetNameOf(
LPSHELLFOLDER this,
HWND32 hwndOwner,
LPCITEMIDLIST pidl, /*simple pidl*/
LPCOLESTR32 lpName,
DWORD dw,
LPITEMIDLIST *pPidlOut)
{ FIXME(shell,"(%p)->(%u,pidl=%p,%s,%lu,%p),stub!\n",
this,hwndOwner,pidl,debugstr_w(lpName),dw,pPidlOut);
return E_NOTIMPL;
}
/**************************************************************************
* IShellFolder_GetFolderPath
* FIXME: drive not included
*/
static BOOL32 WINAPI IShellFolder_GetFolderPath(LPSHELLFOLDER this, LPSTR lpszOut, DWORD dwOutSize)
{ CHAR szTemp[MAX_PATH];
DWORD dwSize;
TRACE(shell,"(%p)->(%p %lu)\n",this, lpszOut, dwOutSize);
if (!lpszOut)
{ return FALSE;
}
*lpszOut=0;
dwSize = strlen (this->mlpszFolder) +1;
if ( dwSize > dwOutSize)
return FALSE;
strcpy(lpszOut, this->mlpszFolder);
TRACE(shell,"-- (%p)->(return=%s)\n",this, lpszOut);
return TRUE;
}

1185
dlls/shell32/shlview.c Normal file

File diff suppressed because it is too large Load Diff

21
dlls/shell32/shres.rc Normal file
View File

@ -0,0 +1,21 @@
#include "shresdef.h"
// we have to find a solution for the icons
// IDI_FOLDER ICON DISCARDABLE "folder.ico"
// IDI_FOLDEROPEN ICON DISCARDABLE "folderop.ico"
STRINGTABLE DISCARDABLE
BEGIN
IDS_FILE_TITLE "Files: "
IDS_MI_FILE "&Files"
IDS_MI_VIEW_FILES "&View Files"
IDS_TB_VIEW_FILES "View Filess"
IDS_MI_VIEW_IDW "Show &Docking Window"
IDS_TB_VIEW_IDW "Show Docking Window"
IDS_COLUMN1 "Name"
IDS_COLUMN2 "Date"
IDS_COLUMN3 "Size"
IDS_COLUMN4 "Attributes"
END

21
dlls/shell32/shresdef.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef __WINE_SHELL_RES_H
#define __WINE_SHELL_RES_H
#define IDS_FILE_TITLE 1
#define IDS_MI_FILE 2
#define IDS_MI_VIEW_FILES 3
#define IDS_TB_VIEW_FILES 4
#define IDS_MI_VIEW_IDW 5
#define IDS_TB_VIEW_IDW 6
#define IDS_COLUMN1 7
#define IDS_COLUMN2 8
#define IDS_COLUMN3 9
#define IDS_COLUMN4 10
#define IDS_MI_FILEITEM 12
#define IDI_FOLDER 101
#define IDI_FOLDEROPEN 102
#endif

View File

@ -52,10 +52,16 @@ $(INCLUDES):
install::
$(INSTALL_DATA) $(SRCDIR)/wine.man $(mandir)/wine$(manext)
uninstall::
$(RM) $(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
uninstall_info:
for i in $(INFOFILES); do $(RM) $(infodir)/$$i; done
clean::
$(RM) $(INFOFILES) $(DVIFILES) $(INCLUDES)
$(RM) wine.aux wine.cp wine.cps wine.fn wine.fns wine.ky wine.log \

View File

@ -199,7 +199,7 @@
- Basic functionality is almost done. (dll version 4.0)
Notes:
Bitmaps are not correctly displayed.
- Bitmaps are not correctly displayed.
3.19 Tooltip Control
@ -212,7 +212,6 @@
Notes:
- Unicode support is still missing.
- No subclassing.
3.20 Trackbar Control
@ -236,9 +235,6 @@
Status:
- Dummy control. No functionality.
Notes:
Author needed!! Any volunteers??
3.22 Updown Control
-------------------
@ -270,7 +266,7 @@
------------------------
There are quite a lot of undocumented functions like:
- DSA (Dynnamic String Array?) functions.
- DSA (Dynnamic Structure Array) functions.
- DPA (Dymnamic Pointer Array?) functions.
- MRU ("Most Recently Used" List) functions.
- other unknown functions.
@ -278,12 +274,13 @@
Have a look at relay32/comctl32.spec.
5.1 Dymnamic String Arrays ??? (DSA)
5.1 Dymnamic Structure Arrays (DSA)
------------------------------------
Most of the DSA functions are implemented. I used TASKMAN.EXE to write them.
Since TASKMAN.EXE doesn't bail out or crash I think I've done it right.
Have a look at the source code to get more information.
Further documentation will be written...
@ -298,16 +295,32 @@
Further documentation will be written...
5.3 MenuHelp
5.3 "Most Recently Used" - List (MRU)
-------------------------------------
Currently no information available!
5.4 MenuHelp
------------
Has to be written...
5.4 GetEffectiveClientRect
5.5 GetEffectiveClientRect
--------------------------
Has to be written...
5.6 ShowHideMenuCtl
-------------------
The official documentation provided by MS is incomplete.
lpInfo:
...
Both values of the first pair must be the handle to the applications main
menu.
...
6. Epilogue
-----------
You see, much work has still to be done. If you are interested in writing

26
documentation/filehandles Normal file
View File

@ -0,0 +1,26 @@
DOS treats the first 5 file handles as special cases. They map directly
to stdin, stdout, stderr, stdaux and stdprn. Windows 16 inherits this
behavoir, and in fact, win16 handles are interchangable with DOS handles.
Some nasty windows programs even do this!
Windows32 issues file handles starting from 1, on the grounds that
most GUI processes don't need a stdin, out, etc.
The wine handle code is implemented in the Win32 style, and the Win16
functions use two macros to convert to and from the two types.
The macros are defined in file.h as follows.:
#define HFILE16_TO_HFILE32(handle) \
(((handle)==0) ? GetStdHandle(STD_INPUT_HANDLE) : \
((handle)==1) ? GetStdHandle(STD_OUTPUT_HANDLE) : \
((handle)==2) ? GetStdHandle(STD_ERROR_HANDLE) : \
(handle)-5)
#define HFILE32_TO_HFILE16(handle) ({ HFILE32 hnd=handle; \
((hnd==HFILE_ERROR32) ? HFILE_ERROR16 : \
(HFILE16)hnd+5); })
WARNING: be careful not to use the macro HFILE16_TO_HFILE32 on
functions with side-effects, as it will cause them to be evaluated
several times. This could be considered a bug, but the use of this
macro is limited enough not to need a rewrite.

View File

@ -0,0 +1,75 @@
This document describes some points you should know when you are going to
implement the internal counterparts to external DLL's. Only 32 bit DLL's
are considered.
1. The LibMain function
-----------------------
These are the way to do some initialising when a process or thread is attached
to the dll. The function name is taken from a *.spec file line:
init YourFunctionName
the you have to implement the function:
BOOL32 WINAPI YourLibMain(HINSTANCE32 hinstDLL,
DWORD fdwReason, LPVOID lpvReserved)
{ if (fdwReason==DLL_PROCESS_ATTACH)
{ ...
}
....
}
2. Using functions from other build-in DLL's
--------------------------------------------
The problem here is, that you can't know if you have to call the function from
the internal or the external DLL. If you just call the function you will get
the internal implementation. If the external DLL is loaded the executed program
will use the external and you the internal DLL.
When you -as example- fill a iconlist placed in the internal DLL the
application wont get the icons from the external DLL.
To go around this you have to call the functions over pointer.
/* definition of the pointer type*/
void (CALLBACK* pDLLInitComctl)();
/* getting the function address this should be done in the
LibMain function when called with DLL_PROCESS_ATTACH*/
BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason,
LPVOID lpvReserved)
{ HINSTANCE32 hComctl32;
if (fdwReason==DLL_PROCESS_ATTACH)
{ /* load the external / internal DLL*/
hComctl32 = LoadLibrary32A("COMCTL32.DLL");
if (hComctl32)
{ /* get the function pointer */
pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx");
/* check it */
if (pDLLInitComctl)
{ /* use it */
pDLLInitComctl();
}
/* free the DLL / decrease the ref count */
FreeLibrary32(hComctl32);
}
else
{ /* do some panic*/
ERR(shell,"P A N I C error getting functionpointers\n");
exit (1);
}
}
....
3. Getting resources from a *.rc file linked to the DLL
-------------------------------------------------------
< If you know how, write some lines>
----------
<juergen.schmied@metronet.de>

71
documentation/shell32 Normal file
View File

@ -0,0 +1,71 @@
SHELL32
development status
Author needed!! Any volunteers??
mail to <juergen.schmied@metronet.de>
1. Introduction
---------------
All parts of this DLL are currently under development. About a third of
base functionality is roughly in place. The missing parts are the icon
(shell icon cache) handling and the dialogs provided from the dll like
the file copy status window.
The basis comes from Marcus Meissner and I <juergen.schmied@metronet.de>
implemented the classes and filled function stubs.
2. General Information
----------------------
3. Functions
------------
4. Classes
----------
4.1 IContextMenu
----------------
Status:
- development started
4.2 IShellExtInit
-----------------
only interface definition
4.3 IEnumIDList
---------------
Status:
- Almost finished.
4.4.IShellFolder
----------------
Status:
- roughly finished.
4.5 IShellView
--------------
Status:
- under development
4.6 IShellBrowser
-----------------
Status:
- only interface definition
it's implemented by the explorer
don't know if we need it
4.7. PIDL Manager
-----------------
Status:
- roughly complete will be migrated to a set of functions because it's
not holding any instance data,
5. Structures
-------------
5.1 PIDL
--------

View File

@ -24,6 +24,7 @@
#include "file.h"
#include "heap.h"
#include "msdos.h"
#include "syslevel.h"
#include "debug.h"
/* Define the VFAT ioctl to get both short and long file names */
@ -74,16 +75,6 @@ BYTE DOS_ErrorClass;
BYTE DOS_ErrorAction;
BYTE DOS_ErrorLocus;
/* Info structure for FindFirstFile handle */
typedef struct
{
LPSTR path;
LPSTR mask;
int drive;
int skip;
} FIND_FIRST_INFO;
/* Directory info for DOSFS_ReadDir */
typedef struct
{
@ -95,6 +86,19 @@ typedef struct
#endif
} DOS_DIR;
/* Info structure for FindFirstFile handle */
typedef struct
{
LPSTR path;
LPSTR long_mask;
LPSTR short_mask;
BYTE attr;
int drive;
int cur_pos;
DOS_DIR *dir;
} FIND_FIRST_INFO;
/***********************************************************************
* DOSFS_ValidDOSName
@ -1016,33 +1020,23 @@ DWORD WINAPI GetFullPathName32W( LPCWSTR name, DWORD len, LPWSTR buffer,
return ret;
}
/***********************************************************************
* DOSFS_FindNext
*
* Find the next matching file. Return the number of entries read to find
* the matching one, or 0 if no more entries.
* 'short_mask' is the 8.3 mask (in FCB format), 'long_mask' is the long
* file name mask. Either or both can be NULL.
* DOSFS_FindNextEx
*/
int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr,
int skip, WIN32_FIND_DATA32A *entry )
static int DOSFS_FindNextEx( FIND_FIRST_INFO *info, WIN32_FIND_DATA32A *entry )
{
static DOS_DIR *dir = NULL;
int count = 0;
static char buffer[MAX_PATHNAME_LEN];
static int cur_pos = 0;
static int drive_root = 0;
char *p;
char dos_name[13];
BYTE attr = info->attr | FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
UINT32 flags = DRIVE_GetFlags( info->drive );
char *p, buffer[MAX_PATHNAME_LEN];
const char *drive_path;
int drive_root;
LPCSTR long_name, short_name;
UINT32 flags;
BY_HANDLE_FILE_INFORMATION info;
BY_HANDLE_FILE_INFORMATION fileinfo;
char dos_name[13];
if ((attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL)
if ((info->attr & ~(FA_UNUSED | FA_ARCHIVE | FA_RDONLY)) == FA_LABEL)
{
if (skip) return 0;
if (info->cur_pos) return 0;
entry->dwFileAttributes = FILE_ATTRIBUTE_LABEL;
DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftCreationTime, 0 );
DOSFS_UnixTimeToFileTime( (time_t)0, &entry->ftLastAccessTime, 0 );
@ -1051,37 +1045,23 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
entry->nFileSizeLow = 0;
entry->dwReserved0 = 0;
entry->dwReserved1 = 0;
DOSFS_ToDosDTAFormat( DRIVE_GetLabel( drive ), entry->cFileName );
strcpy( entry->cAlternateFileName, entry->cFileName );
DOSFS_ToDosDTAFormat( DRIVE_GetLabel( info->drive ), entry->cFileName );
strcpy( entry->cAlternateFileName, entry->cFileName );
info->cur_pos++;
return 1;
}
/* Check the cached directory */
if (dir && !strcmp( buffer, path ) && (cur_pos <= skip)) skip -= cur_pos;
else /* Not in the cache, open it anew */
{
const char *drive_path;
TRACE(dosfs, "cache miss, path=%s skip=%d buf=%s cur=%d\n",
path, skip, buffer, cur_pos );
cur_pos = skip;
if (dir) DOSFS_CloseDir(dir);
if (!*path) path = "/";
if (!(dir = DOSFS_OpenDir(path))) return 0;
drive_path = path + strlen(DRIVE_GetRoot(drive));
while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
drive_root = !*drive_path;
TRACE(dosfs, "drive_root = %d\n", drive_root);
lstrcpyn32A( buffer, path, sizeof(buffer) - 1 );
}
drive_path = info->path + strlen(DRIVE_GetRoot( info->drive ));
while ((*drive_path == '/') || (*drive_path == '\\')) drive_path++;
drive_root = !*drive_path;
lstrcpyn32A( buffer, info->path, sizeof(buffer) - 1 );
strcat( buffer, "/" );
p = buffer + strlen(buffer);
attr |= FA_UNUSED | FA_ARCHIVE | FA_RDONLY;
flags = DRIVE_GetFlags( drive );
while (DOSFS_ReadDir( dir, &long_name, &short_name ))
while (DOSFS_ReadDir( info->dir, &long_name, &short_name ))
{
if (skip-- > 0) continue;
count++;
info->cur_pos++;
/* Don't return '.' and '..' in the root of the drive */
if (drive_root && (long_name[0] == '.') &&
@ -1090,15 +1070,15 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
/* Check the long mask */
if (long_mask)
if (info->long_mask)
{
if (!DOSFS_MatchLong( long_mask, long_name,
if (!DOSFS_MatchLong( info->long_mask, long_name,
flags & DRIVE_CASE_SENSITIVE )) continue;
}
/* Check the short mask */
if (short_mask)
if (info->short_mask)
{
if (!short_name)
{
@ -1106,27 +1086,27 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
!(flags & DRIVE_CASE_SENSITIVE) );
short_name = dos_name;
}
if (!DOSFS_MatchShort( short_mask, short_name )) continue;
if (!DOSFS_MatchShort( info->short_mask, short_name )) continue;
}
/* Check the file attributes */
lstrcpyn32A( p, long_name, sizeof(buffer) - (int)(p - buffer) );
if (!FILE_Stat( buffer, &info ))
if (!FILE_Stat( buffer, &fileinfo ))
{
WARN(dosfs, "can't stat %s\n", buffer);
continue;
}
if (info.dwFileAttributes & ~attr) continue;
if (fileinfo.dwFileAttributes & ~attr) continue;
/* We now have a matching entry; fill the result and return */
entry->dwFileAttributes = info.dwFileAttributes;
entry->ftCreationTime = info.ftCreationTime;
entry->ftLastAccessTime = info.ftLastAccessTime;
entry->ftLastWriteTime = info.ftLastWriteTime;
entry->nFileSizeHigh = info.nFileSizeHigh;
entry->nFileSizeLow = info.nFileSizeLow;
entry->dwFileAttributes = fileinfo.dwFileAttributes;
entry->ftCreationTime = fileinfo.ftCreationTime;
entry->ftLastAccessTime = fileinfo.ftLastAccessTime;
entry->ftLastWriteTime = fileinfo.ftLastWriteTime;
entry->nFileSizeHigh = fileinfo.nFileSizeHigh;
entry->nFileSizeLow = fileinfo.nFileSizeLow;
if (short_name)
DOSFS_ToDosDTAFormat( short_name, entry->cAlternateFileName );
@ -1139,15 +1119,75 @@ int DOSFS_FindNext( const char *path, const char *short_mask,
TRACE(dosfs, "returning %s (%s) %02lx %ld\n",
entry->cFileName, entry->cAlternateFileName,
entry->dwFileAttributes, entry->nFileSizeLow );
cur_pos += count;
p[-1] = '\0'; /* Remove trailing slash in buffer */
return count;
return 1;
}
DOSFS_CloseDir( dir );
dir = NULL;
return 0; /* End of directory */
}
/***********************************************************************
* DOSFS_FindNext
*
* Find the next matching file. Return the number of entries read to find
* the matching one, or 0 if no more entries.
* 'short_mask' is the 8.3 mask (in FCB format), 'long_mask' is the long
* file name mask. Either or both can be NULL.
*
* NOTE: This is supposed to be only called by the int21 emulation
* routines. Thus, we should own the Win16Mutex anyway.
* Nevertheless, we explicitly enter it to ensure the static
* directory cache is protected.
*/
int DOSFS_FindNext( const char *path, const char *short_mask,
const char *long_mask, int drive, BYTE attr,
int skip, WIN32_FIND_DATA32A *entry )
{
static FIND_FIRST_INFO info = { NULL };
LPCSTR short_name, long_name;
int count;
SYSLEVEL_EnterWin16Lock();
/* Check the cached directory */
if (!(info.dir && info.path == path && info.short_mask == short_mask
&& info.long_mask == long_mask && info.drive == drive
&& info.attr == attr && info.cur_pos <= skip))
{
/* Not in the cache, open it anew */
if (info.dir) DOSFS_CloseDir( info.dir );
info.path = (LPSTR)path;
info.long_mask = (LPSTR)long_mask;
info.short_mask = (LPSTR)short_mask;
info.attr = attr;
info.drive = drive;
info.cur_pos = 0;
info.dir = DOSFS_OpenDir( info.path );
}
/* Skip to desired position */
while (info.cur_pos < skip)
if (DOSFS_ReadDir( info.dir, &long_name, &short_name ))
info.cur_pos++;
else
break;
if (info.cur_pos == skip && DOSFS_FindNextEx( &info, entry ))
count = info.cur_pos - skip;
else
count = 0;
if (!count)
{
DOSFS_CloseDir( info.dir );
memset( &info, '\0', sizeof(info) );
}
SYSLEVEL_LeaveWin16Lock();
return count;
}
/*************************************************************************
* FindFirstFile16 (KERNEL.413)
@ -1165,11 +1205,16 @@ HANDLE16 WINAPI FindFirstFile16( LPCSTR path, WIN32_FIND_DATA32A *data )
return INVALID_HANDLE_VALUE16;
info = (FIND_FIRST_INFO *)GlobalLock16( handle );
info->path = HEAP_strdupA( SystemHeap, 0, full_name.long_name );
info->mask = strrchr( info->path, '/' );
*(info->mask++) = '\0';
info->long_mask = strrchr( info->path, '/' );
*(info->long_mask++) = '\0';
info->short_mask = NULL;
info->attr = 0xff;
if (path[0] && (path[1] == ':')) info->drive = toupper(*path) - 'A';
else info->drive = DRIVE_GetCurrentDrive();
info->skip = 0;
info->cur_pos = 0;
info->dir = DOSFS_OpenDir( info->path );
GlobalUnlock16( handle );
if (!FindNextFile16( handle, data ))
{
@ -1222,7 +1267,6 @@ HANDLE32 WINAPI FindFirstFile32W( LPCWSTR path, WIN32_FIND_DATA32W *data )
BOOL16 WINAPI FindNextFile16( HANDLE16 handle, WIN32_FIND_DATA32A *data )
{
FIND_FIRST_INFO *info;
int count;
if (!(info = (FIND_FIRST_INFO *)GlobalLock16( handle )))
{
@ -1230,20 +1274,19 @@ BOOL16 WINAPI FindNextFile16( HANDLE16 handle, WIN32_FIND_DATA32A *data )
return FALSE;
}
GlobalUnlock16( handle );
if (!info->path)
if (!info->path || !info->dir)
{
DOS_ERROR( ER_NoMoreFiles, EC_MediaError, SA_Abort, EL_Disk );
return FALSE;
}
if (!(count = DOSFS_FindNext( info->path, NULL, info->mask, info->drive,
0xff, info->skip, data )))
if (!DOSFS_FindNextEx( info, data ))
{
DOSFS_CloseDir( info->dir ); info->dir = NULL;
HeapFree( SystemHeap, 0, info->path );
info->path = info->mask = NULL;
info->path = info->long_mask = NULL;
DOS_ERROR( ER_NoMoreFiles, EC_MediaError, SA_Abort, EL_Disk );
return FALSE;
}
info->skip += count;
return TRUE;
}
@ -1289,6 +1332,7 @@ BOOL16 WINAPI FindClose16( HANDLE16 handle )
DOS_ERROR( ER_InvalidHandle, EC_ProgramError, SA_Abort, EL_Disk );
return FALSE;
}
if (info->dir) DOSFS_CloseDir( info->dir );
if (info->path) HeapFree( SystemHeap, 0, info->path );
GlobalUnlock16( handle );
GlobalFree16( handle );

View File

@ -871,7 +871,7 @@ error: /* We get here if there was an error opening the file */
*/
HFILE16 WINAPI OpenFile16( LPCSTR name, OFSTRUCT *ofs, UINT16 mode )
{
return FILE_DoOpenFile( name, ofs, mode, FALSE );
return HFILE32_TO_HFILE16(FILE_DoOpenFile( name, ofs, mode, FALSE ));
}
@ -890,7 +890,7 @@ HFILE32 WINAPI OpenFile32( LPCSTR name, OFSTRUCT *ofs, UINT32 mode )
HFILE16 WINAPI _lclose16( HFILE16 hFile )
{
TRACE(file, "handle %d\n", hFile );
return CloseHandle( hFile ) ? 0 : HFILE_ERROR16;
return CloseHandle( HFILE16_TO_HFILE32( hFile ) ) ? 0 : HFILE_ERROR16;
}
@ -917,7 +917,7 @@ LONG WINAPI WIN16_hread( HFILE16 hFile, SEGPTR buffer, LONG count )
/* Some programs pass a count larger than the allocated buffer */
maxlen = GetSelectorLimit( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1;
if (count > maxlen) count = maxlen;
return _lread32( hFile, PTR_SEG_TO_LIN(buffer), count );
return _lread32(HFILE16_TO_HFILE32(hFile), PTR_SEG_TO_LIN(buffer), count );
}
@ -955,7 +955,7 @@ UINT32 WINAPI _lread32( HFILE32 handle, LPVOID buffer, UINT32 count )
*/
UINT16 WINAPI _lread16( HFILE16 hFile, LPVOID buffer, UINT16 count )
{
return (UINT16)_lread32( hFile, buffer, (LONG)count );
return (UINT16)_lread32(HFILE16_TO_HFILE32(hFile), buffer, (LONG)count );
}
@ -966,7 +966,7 @@ HFILE16 WINAPI _lcreat16( LPCSTR path, INT16 attr )
{
int mode = (attr & 1) ? 0444 : 0666;
TRACE(file, "%s %02x\n", path, attr );
return (HFILE16)FILE_Create( path, mode, FALSE );
return (HFILE16) HFILE32_TO_HFILE16(FILE_Create( path, mode, FALSE ));
}
@ -1038,7 +1038,7 @@ DWORD WINAPI SetFilePointer( HFILE32 hFile, LONG distance, LONG *highword,
*/
LONG WINAPI _llseek16( HFILE16 hFile, LONG lOffset, INT16 nOrigin )
{
return SetFilePointer( hFile, lOffset, NULL, nOrigin );
return SetFilePointer( HFILE16_TO_HFILE32(hFile), lOffset, NULL, nOrigin );
}
@ -1056,7 +1056,7 @@ LONG WINAPI _llseek32( HFILE32 hFile, LONG lOffset, INT32 nOrigin )
*/
HFILE16 WINAPI _lopen16( LPCSTR path, INT16 mode )
{
return _lopen32( path, mode );
return HFILE32_TO_HFILE16(_lopen32( path, mode ));
}
@ -1091,7 +1091,7 @@ HFILE32 WINAPI _lopen32( LPCSTR path, INT32 mode )
*/
UINT16 WINAPI _lwrite16( HFILE16 hFile, LPCSTR buffer, UINT16 count )
{
return (UINT16)_hwrite32( hFile, buffer, (LONG)count );
return (UINT16)_hwrite32( HFILE16_TO_HFILE32(hFile), buffer, (LONG)count );
}
/***********************************************************************
@ -1108,7 +1108,7 @@ UINT32 WINAPI _lwrite32( HFILE32 hFile, LPCSTR buffer, UINT32 count )
*/
LONG WINAPI _hread16( HFILE16 hFile, LPVOID buffer, LONG count)
{
return _lread32( hFile, buffer, count );
return _lread32( HFILE16_TO_HFILE32(hFile), buffer, count );
}
@ -1126,7 +1126,7 @@ LONG WINAPI _hread32( HFILE32 hFile, LPVOID buffer, LONG count)
*/
LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
{
return _hwrite32( hFile, buffer, count );
return _hwrite32( HFILE16_TO_HFILE32(hFile), buffer, count );
}

View File

@ -945,7 +945,7 @@ INT32 WINAPI GetProfileString32W( LPCWSTR section, LPCWSTR entry,
/***********************************************************************
* GetProfileSection32A (KERNEL32.268)
*/
INT32 WINAPI GetProfileSection32A( LPCSTR section, LPSTR buffer, UINT32 len )
INT32 WINAPI GetProfileSection32A( LPCSTR section, LPSTR buffer, DWORD len )
{
return GetPrivateProfileSection32A( section, buffer, len, "win.ini" );
}
@ -1080,7 +1080,7 @@ INT32 WINAPI GetPrivateProfileString32W( LPCWSTR section, LPCWSTR entry,
* GetPrivateProfileSection32A (KERNEL32.255)
*/
INT32 WINAPI GetPrivateProfileSection32A( LPCSTR section, LPSTR buffer,
UINT32 len, LPCSTR filename )
DWORD len, LPCSTR filename )
{
if (PROFILE_Open( filename ))
return PROFILE_GetSection(CurProfile->section, section, buffer, len,
@ -1186,7 +1186,7 @@ WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size,
/***********************************************************************
* GetPrivateProfileStruct32A (KERNEL32.370)
*/
WORD WINAPI GetPrivateProfileStruct32A (LPCSTR section, LPCSTR key,
BOOL32 WINAPI GetPrivateProfileStruct32A (LPCSTR section, LPCSTR key,
LPVOID buf, UINT32 len, LPCSTR filename)
{
PROFILEKEY *k;
@ -1204,7 +1204,7 @@ WORD WINAPI GetPrivateProfileStruct32A (LPCSTR section, LPCSTR key,
/***********************************************************************
* WritePrivateProfileStruct32A (KERNEL32.744)
*/
WORD WINAPI WritePrivateProfileStruct32A (LPCSTR section, LPCSTR key,
BOOL32 WINAPI WritePrivateProfileStruct32A (LPCSTR section, LPCSTR key,
LPVOID buf, UINT32 bufsize, LPCSTR filename)
{
if ((!section) && (!key) && (!buf)) { /* flush the cache */

File diff suppressed because it is too large Load Diff

View File

@ -755,8 +755,8 @@ BOOL32 WINAPI PolyPolygon32( HDC32 hdc, LPPOINT32 pt, LPINT32 counts,
/**********************************************************************
* PolyPolyline32 (GDI32.272)
*/
BOOL32 WINAPI PolyPolyline32( HDC32 hdc, LPPOINT32 pt, LPINT32 counts,
UINT32 polylines )
BOOL32 WINAPI PolyPolyline32( HDC32 hdc, LPPOINT32 pt, LPDWORD counts,
DWORD polylines )
{
DC * dc = DC_GetDCPtr( hdc );

View File

@ -44,8 +44,10 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODE16 *dm1, PSDRV_DEVMODE16 *dm2,
}
if(page) {
dm1->dmPublic.dmPaperSize = dm2->dmPublic.dmPaperSize;
dm1->dmPublic.dmPaperWidth = page->PaperDimension->x * 25.4 / 72.0;
dm1->dmPublic.dmPaperLength = page->PaperDimension->y * 25.4 / 72.0;
dm1->dmPublic.dmPaperWidth = page->PaperDimension->x *
254.0 / 72.0;
dm1->dmPublic.dmPaperLength = page->PaperDimension->y *
254.0 / 72.0;
TRACE(psdrv, "Changing page to %s %d x %d\n", page->FullName,
dm1->dmPublic.dmPaperWidth, dm1->dmPublic.dmPaperLength );
} else {

View File

@ -169,6 +169,12 @@ static PSDRV_DEVMODE16 DefaultDevmode =
HANDLE32 PSDRV_Heap = 0;
static HANDLE32 PSDRV_DefaultFont = 0;
static LOGFONT32A DefaultLogFont = {
100, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, 0, 0,
DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, ""
};
/*********************************************************************
* PSDRV_Init
*
@ -180,6 +186,7 @@ BOOL32 PSDRV_Init(void)
TRACE(psdrv, "\n");
PSDRV_Heap = HeapCreate(0, 0x10000, 0);
PSDRV_GetFontMetrics();
PSDRV_DefaultFont = CreateFontIndirect32A(&DefaultLogFont);
return DRIVER_RegisterDriver( "WINEPS", &PSDRV_Funcs );
}
@ -225,11 +232,11 @@ static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
memcpy(devCaps, &PSDRV_DevCaps, sizeof(PSDRV_DevCaps));
if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_PORTRAIT) {
devCaps->horzSize = physDev->Devmode->dmPublic.dmPaperWidth;
devCaps->vertSize = physDev->Devmode->dmPublic.dmPaperLength;
devCaps->horzSize = physDev->Devmode->dmPublic.dmPaperWidth / 10;
devCaps->vertSize = physDev->Devmode->dmPublic.dmPaperLength / 10;
} else {
devCaps->horzSize = physDev->Devmode->dmPublic.dmPaperLength;
devCaps->vertSize = physDev->Devmode->dmPublic.dmPaperWidth;
devCaps->horzSize = physDev->Devmode->dmPublic.dmPaperLength / 10;
devCaps->vertSize = physDev->Devmode->dmPublic.dmPaperWidth / 10;
}
devCaps->horzRes = physDev->pi->ppd->DefaultResolution *
@ -252,6 +259,7 @@ static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
dc->w.hVisRgn = CreateRectRgn32(0, 0, dc->w.devCaps->horzRes,
dc->w.devCaps->vertRes);
dc->w.hFont = PSDRV_DefaultFont;
physDev->job.output = HEAP_strdupA( PSDRV_Heap, 0, output );
physDev->job.hJob = 0;
return TRUE;

View File

@ -753,7 +753,7 @@ X11DRV_PolyPolygon( DC *dc, LPPOINT32 pt, LPINT32 counts, UINT32 polygons)
* X11DRV_PolyPolyline
*/
BOOL32
X11DRV_PolyPolyline( DC *dc, LPPOINT32 pt, LPINT32 counts, UINT32 polylines )
X11DRV_PolyPolyline( DC *dc, LPPOINT32 pt, LPDWORD counts, DWORD polylines )
{
if (DC_SetupGCForPen ( dc ))
{

View File

@ -218,7 +218,7 @@ file gdi.exe
305 stub ENGINEGETGLYPHBMP
306 stub ENGINEMAKEFONTDIR
307 pascal16 GetCharABCWidths(word word word ptr) GetCharABCWidths16
308 pascal GetOutlineTextMetrics(word word ptr) GetOutlineTextMetrics
308 pascal GetOutlineTextMetrics(word word ptr) GetOutlineTextMetrics16
309 pascal GetGlyphOutline(word word word ptr long ptr ptr) GetGlyphOutline16
310 pascal16 CreateScalableFontResource(word str str str) CreateScalableFontResource16
311 stub GetFontData

View File

@ -8,7 +8,7 @@ type win16
5 pascal16 AnsiToOem(str ptr) AnsiToOem16
6 pascal16 OemToAnsi(str ptr) OemToAnsi16
7 return SetSpeed 2 65535
#100 pascal ScreenSwitchEnable
100 pascal ScreenSwitchEnable(word) ScreenSwitchEnable
#126 pascal GetTableSeg
#127 pascal NewTable
128 pascal OemKeyScan(word) OemKeyScan

View File

@ -236,7 +236,7 @@ void RELAY_Unimplemented16(void)
MSG("No handler for Win16 routine %s (called from %04x:%04x)\n",
BUILTIN_GetEntryPoint16(frame->entry_cs,frame->entry_ip,&ordinal),
frame->cs, frame->ip );
TASK_KillCurrentTask(1);
ExitProcess(1);
}

View File

@ -368,7 +368,7 @@ file user.exe
398 pascal16 GetClassInfoEx(word segstr ptr) GetClassInfoEx16
399 stub ChildWindowFromPointEx
400 stub FinalUserInit
402 pascal16 GetPriorityClipboardFormat(word ptr s_word) GetPriorityClipboardFormat16
402 pascal16 GetPriorityClipboardFormat(ptr s_word) GetPriorityClipboardFormat16
403 pascal16 UnregisterClass(segstr word) UnregisterClass16
404 pascal16 GetClassInfo(word segstr ptr) GetClassInfo16
406 pascal16 CreateCursor(word word word word word ptr ptr) CreateCursor16

147
include/authors.h Normal file
View File

@ -0,0 +1,147 @@
#ifndef __WINE_AUTHORS_H
#define __WINE_AUTHORS_H
static const char * const SHELL_People[] =
{
"Bob Amstadt",
"Dag Asheim",
"Martin Ayotte",
"Karl Backström",
"Peter Bajusz",
"Marcel Baur",
"Georg Beyerle",
"Ross Biro",
"Martin Boehme",
"Uwe Bonnes",
"Erik Bos",
"Fons Botman",
"John Brezak",
"Andrew Bulhak",
"John Burton",
"Niels de Carpentier",
"Gordon Chaffee",
"Jimen Ching",
"Pascal Cuoq",
"David A. Cuthbert",
"Huw D. M. Davies",
"Roman Dolejsi",
"Frans van Dorsselaer",
"Chris Faherty",
"Carsten Fallesen",
"Paul Falstad",
"David Faure",
"Claus Fischer",
"Olaf Flebbe",
"Chad Fraleigh",
"Matthew Francis",
"Peter Galbavy",
"Ramon Garcia",
"Matthew Ghio",
"Jody Goldberg",
"Hans de Graaff",
"Charles M. Hannum",
"Adrian Harvey",
"John Harvey",
"Bill Hawes",
"Cameron Heide",
"Jochen Hoenicke",
"Onno Hovers",
"Jeffrey Hsu",
"Miguel de Icaza",
"Jukka Iivonen",
"Lee Jaekil",
"Alexandre Julliard",
"Bang Jun-Young",
"Pavel Kankovsky",
"Jochen Karrer",
"Andreas Kirschbaum",
"Rein Klazes",
"Albrecht Kleine",
"Eric Kohl",
"Jon Konrath",
"Alex Korobka",
"Greg Kreider",
"Anand Kumria",
"Ove Kåven",
"Scott A. Laird",
"David Lee Lambert",
"Andrew Lewycky",
"Per Lindström",
"Martin von Loewis",
"Michiel van Loon",
"Kenneth MacDonald",
"Peter MacDonald",
"William Magro",
"Juergen Marquardt",
"Ricardo Massaro",
"Marcus Meissner",
"Graham Menhennitt",
"David Metcalfe",
"Bruce Milner",
"Steffen Moeller",
"Andreas Mohr",
"James Moody",
"Philippe De Muyter",
"Itai Nahshon",
"Kristian Nielsen",
"Henrik Olsen",
"Michael Patra",
"Dimitrie O. Paun",
"Jim Peterson",
"Robert Pouliot",
"Keith Reynolds",
"Slaven Rezic",
"John Richardson",
"Rick Richardson",
"Doug Ridgway",
"Bernhard Rosenkraenzer",
"Johannes Ruscheinski",
"Thomas Sandford",
"Constantine Sapuntzakis",
"Pablo Saratxaga",
"Daniel Schepler",
"Peter Schlaile",
"Ulrich Schmid",
"Bernd Schmidt",
"Juergen Schmied",
"Ingo Schneider",
"Victor Schneider",
"Yngvi Sigurjonsson",
"Stephen Simmons",
"Rick Sladkey",
"William Smith",
"Dominik Strasser",
"Vadim Strizhevsky",
"Bertho Stultiens",
"Erik Svendsen",
"Tristan Tarrant",
"Andrew Taylor",
"Duncan C Thomson",
"Goran Thyni",
"Jimmy Tirtawangsa",
"Jon Tombs",
"Linus Torvalds",
"Gregory Trubetskoy",
"Petri Tuomola",
"Michael Veksler",
"Sven Verdoolaege",
"Ronan Waide",
"Eric Warnke",
"Manfred Weichel",
"Ulrich Weigand",
"Morten Welinder",
"Len White",
"Lawson Whitney",
"Jan Willamowius",
"Carl Williams",
"Karl Guenter Wuensch",
"Eric Youngdale",
"James Youngman",
"Nikita V. Youshchenko",
"Mikolaj Zalewski",
"John Zero",
"Luiz Otavio L. Zorzella",
NULL
};
#endif /* __WINE_AUTHORS_H */

View File

@ -55,14 +55,64 @@ BOOL32 WINAPI InitCommonControlsEx (LPINITCOMMONCONTROLSEX);
#define CCM_FIRST 0x2000
#define CCM_SETBKCOLOR (CCM_FIRST+1) /* lParam = bkColor */
#define CCM_SETCOLORSCHEME (CCM_FIRST+2)
#define CCM_GETCOLORSCHEME (CCM_FIRST+3)
#define CCM_GETDROPTARGET (CCM_FIRST+4)
#define CCM_SETUNICODEFORMAT (CCM_FIRST+5)
#define CCM_GETUNICODEFORMAT (CCM_FIRST+6)
/* common notification codes */
#define NM_FIRST (0U-0U)
#define NM_LAST (0U-99U)
/* common notification codes (WM_NOTIFY)*/
#define NM_FIRST (0U- 0U) // generic to all controls
#define NM_LAST (0U- 99U)
#define LVN_FIRST (0U-100U) // listview
#define LVN_LAST (0U-199U)
#define HDN_FIRST (0U-300U) // header
#define HDN_LAST (0U-399U)
#define TVN_FIRST (0U-400U) // treeview
#define TVN_LAST (0U-499U)
#define TTN_FIRST (0U-520U) // tooltips
#define TTN_LAST (0U-549U)
#define TCN_FIRST (0U-550U) // tab control
#define TCN_LAST (0U-580U)
// Shell reserved (0U-580U) - (0U-589U)
#define CDN_FIRST (0U-601U) // common dialog (new)
#define CDN_LAST (0U-699U)
#define TBN_FIRST (0U-700U) // toolbar
#define TBN_LAST (0U-720U)
#define UDN_FIRST (0U-721) // updown
#define UDN_LAST (0U-740)
#define MCN_FIRST (0U-750U) // monthcal
#define MCN_LAST (0U-759U)
#define DTN_FIRST (0U-760U) // datetimepick
#define DTN_LAST (0U-799U)
#define CBEN_FIRST (0U-800U) // combo box ex
#define CBEN_LAST (0U-830U)
#define RBN_FIRST (0U-831U) // rebar
#define RBN_LAST (0U-859U)
#define IPN_FIRST (0U-860U) // internet address
#define IPN_LAST (0U-879U) // internet address
#define SBN_FIRST (0U-880U) // status bar
#define SBN_LAST (0U-899U)
#define PGN_FIRST (0U-900U) // Pager Control
#define PGN_LAST (0U-950U)
#define NM_OUTOFMEMORY (NM_FIRST-1)
#define NM_CLICK (NM_FIRST-2)
@ -81,6 +131,66 @@ BOOL32 WINAPI InitCommonControlsEx (LPINITCOMMONCONTROLSEX);
#define NM_CHAR (NM_FIRST-18)
#define NM_TOOLTIPSCREATED (NM_FIRST-19)
#define HDN_ITEMCHANGINGA (HDN_FIRST-0)
#define HDN_ITEMCHANGINGW (HDN_FIRST-20)
#define HDN_ITEMCHANGEDA (HDN_FIRST-1)
#define HDN_ITEMCHANGEDW (HDN_FIRST-21)
#define HDN_ITEMCLICKA (HDN_FIRST-2)
#define HDN_ITEMCLICKW (HDN_FIRST-22)
#define HDN_ITEMDBLCLICKA (HDN_FIRST-3)
#define HDN_ITEMDBLCLICKW (HDN_FIRST-23)
#define HDN_DIVIDERDBLCLICKA (HDN_FIRST-5)
#define HDN_DIVIDERDBLCLICKW (HDN_FIRST-25)
#define HDN_BEGINTRACKA (HDN_FIRST-6)
#define HDN_BEGINTRACKW (HDN_FIRST-26)
#define HDN_ENDTRACKA (HDN_FIRST-7)
#define HDN_ENDTRACKW (HDN_FIRST-27)
#define HDN_TRACKA (HDN_FIRST-8)
#define HDN_TRACKW (HDN_FIRST-28)
#define HDN_GETDISPINFOA (HDN_FIRST-9)
#define HDN_GETDISPINFOW (HDN_FIRST-29)
#define HDN_BEGINDRAG (HDN_FIRST-10)
#define HDN_ENDDRAG (HDN_FIRST-11)
#define HDN_ITEMCHANGING HDN_ITEMCHANGINGA
#define HDN_ITEMCHANGED HDN_ITEMCHANGEDA
#define HDN_ITEMCLICK HDN_ITEMCLICKA
#define HDN_ITEMDBLCLICK HDN_ITEMDBLCLICKA
#define HDN_DIVIDERDBLCLICK HDN_DIVIDERDBLCLICKA
#define HDN_BEGINTRACK HDN_BEGINTRACKA
#define HDN_ENDTRACK HDN_ENDTRACKA
#define HDN_TRACK HDN_TRACKA
#define HDN_GETDISPINFO HDN_GETDISPINFOA
#define LVN_ITEMCHANGING (LVN_FIRST-0)
#define LVN_ITEMCHANGED (LVN_FIRST-1)
#define LVN_INSERTITEM (LVN_FIRST-2)
#define LVN_DELETEITEM (LVN_FIRST-3)
#define LVN_DELETEALLITEMS (LVN_FIRST-4)
#define LVN_BEGINLABELEDITA (LVN_FIRST-5)
#define LVN_BEGINLABELEDITW (LVN_FIRST-75)
#define LVN_ENDLABELEDITA (LVN_FIRST-6)
#define LVN_ENDLABELEDITW (LVN_FIRST-76)
#define LVN_COLUMNCLICK (LVN_FIRST-8)
#define LVN_BEGINDRAG (LVN_FIRST-9)
#define LVN_BEGINRDRAG (LVN_FIRST-11)
#define LVN_ODCACHEHINT (LVN_FIRST-13)
#define LVN_ODFINDITEMA (LVN_FIRST-52)
#define LVN_ODFINDITEMW (LVN_FIRST-79)
#define LVN_ITEMACTIVATE (LVN_FIRST-14)
#define LVN_ODSTATECHANGED (LVN_FIRST-15)
#define LVN_HOTTRACK (LVN_FIRST-21)
#define LVN_GETDISPINFOA (LVN_FIRST-50)
#define LVN_GETDISPINFOW (LVN_FIRST-77)
#define LVN_SETDISPINFOA (LVN_FIRST-51)
#define LVN_SETDISPINFOW (LVN_FIRST-78)
#define LVN_ODFINDITEM LVN_ODFINDITEMA
#define LVN_BEGINLABELEDIT LVN_BEGINLABELEDITA
#define LVN_ENDLABELEDIT LVN_ENDLABELEDITA
#define LVN_GETDISPINFO LVN_GETDISPINFOA
#define LVN_SETDISPINFO LVN_SETDISPINFOA
/* callback constants */
#define LPSTR_TEXTCALLBACK32A ((LPSTR)-1L)
@ -952,6 +1062,103 @@ typedef struct tagNMTTDISPINFOW
#define REBARCLASSNAME32W L"ReBarWindow32"
#define REBARCLASSNAME WINELIB_NAME_AW(REBARCLASSNAME)
#define RBIM_IMAGELIST 0x00000001
#define RBBIM_STYLE 0x00000001
#define RBBIM_COLORS 0x00000002
#define RBBIM_TEXT 0x00000004
#define RBBIM_IMAGE 0x00000008
#define RBBIM_CHILD 0x00000010
#define RBBIM_CHILDSIZE 0x00000020
#define RBBIM_SIZE 0x00000040
#define RBBIM_BACKGROUND 0x00000080
#define RBBIM_ID 0x00000100
#define RBBIM_IDEALSIZE 0x00000200
#define RBBIM_LPARAM 0x00000400
#define RBBIM_HEADERSIZE 0x00000800
#define RB_INSERTBAND32A (WM_USER+1)
#define RB_INSERTBAND32W (WM_USER+10)
#define RB_INSERTBANND WINELIB_NAME_AW(RB_INSERTBAND)
#define RB_DELETEBAND (WM_USER+2)
#define RB_GETBARINFO (WM_USER+3)
#define RB_SETBARINFO (WM_USER+4)
#define RB_GETBANDINFO32 (WM_USER+5) /* just for compatibility */
#define RB_SETBANDINFO32A (WM_USER+6)
#define RB_SETBANDINFO32W (WM_USER+11)
#define RB_SETBANDINFO WINELIB_NAME_AW(RB_SETBANDINFO)
#define RB_SETPARENT (WM_USER+7)
#define RB_HITTEST (WM_USER+8)
#define RB_GETRECT (WM_USER+9)
#define RB_GETBANDCOUNT (WM_USER+12)
#define RB_GETROWCOUNT (WM_USER+13)
#define RB_GETROWHEIGHT (WM_USER+14)
#define RB_IDTOINDEX (WM_USER+16)
#define RB_GETTOOLTIPS (WM_USER+17)
#define RB_SETTOOLTIPS (WM_USER+18)
#define RB_SETBKCOLOR (WM_USER+19)
#define RB_GETBKCOLOR (WM_USER+20)
#define RB_SETTEXTCOLOR (WM_USER+21)
#define RB_GETTEXTCOLOR (WM_USER+22)
#define RB_SIZETORECT (WM_USER+23)
#define RB_BEGINDRAG (WM_USER+24)
#define RB_ENDDRAG (WM_USER+25)
#define RB_DRAGMOVE (WM_USER+26)
#define RB_GETBARHEIGHT (WM_USER+27)
#define RB_GETBANDINFO32W (WM_USER+28)
#define RB_GETBANDINFO32A (WM_USER+29)
#define RB_GETBANDINFO WINELIB_NAME_AW(RB_GETBANDINFO)
#define RB_MINIMIZEBAND (WM_USER+30)
#define RB_MAXIMIZEBAND (WM_USER+31)
#define RB_GETBANDORDERS (WM_USER+34)
#define RB_SHOWBAND (WM_USER+35)
#define RB_SETPALETTE (WM_USER+37)
#define RB_GETPALETTE (WM_USER+38)
#define RB_MOVEBAND (WM_USER+39)
#define RB_GETDROPTARGET CCS_GETDROPTARGET
#define RB_SETCOLORSCHEME CCS_SETCOLORSCHEME
#define RB_GETCOLORSCHEME CCS_GETCOLORSCHEME
#define RB_SETUNICODEFORMAT CCS_SETUNICODEFORMAT
#define RB_GETUNICODEFORMAT CCS_GETUNICODEFORMAT
typedef struct tagREBARINFO
{
UINT32 cbSize;
UINT32 fMask;
HIMAGELIST himl;
} REBARINFO, *LPREBARINFO;
typedef struct tagREBARBANDINFOA
{
UINT32 cbSize;
UINT32 fMask;
UINT32 fStyle;
COLORREF clrFore;
COLORREF clrBack;
LPSTR lpText;
UINT32 cch;
INT32 iImage;
HWND32 hwndChild;
UINT32 cxMinChild;
UINT32 cyMinChild;
UINT32 cx;
HBITMAP32 hbmBack;
UINT32 wID;
UINT32 cyChild;
UINT32 cyMaxChild;
UINT32 cyIntegral;
UINT32 cxIdeal;
LPARAM lParam;
UINT32 cxHeader;
} REBARBANDINFO32A, *LPREBARBANDINFO32A;
/* Trackbar control */
@ -1119,8 +1326,196 @@ typedef struct tagNMTTDISPINFOW
#define LVM_FIRST 0x1000
#define LVM_SETBKCOLOR (LVM_FIRST+1)
#define LVM_GETIMAGELIST (LVM_FIRST+2)
#define LVM_SETIMAGELIST (LVM_FIRST+3)
#define LVM_GETITEMCOUNT (LVM_FIRST+4)
#define LVM_GETITEM (LVM_FIRST+5)
#define LVM_INSERTITEM (LVM_FIRST+7)
#define LVM_DELETEALLITEMS (LVM_FIRST+9)
#define LVM_SETITEMPOSITION (LVM_FIRST+15)
#define LVM_INSERTCOLUMN (LVM_FIRST+27)
#define LVM_SORTITEMS (LVM_FIRST+48)
#define LVM_GETSELECTEDCOUNT (LVM_FIRST+50)
#define LVS_ICON 0x0000
#define LVS_REPORT 0x0001
#define LVS_SMALLICON 0x0002
#define LVS_LIST 0x0003
#define LVS_TYPEMASK 0x0003
#define LVS_SINGLESEL 0x0004
#define LVS_SHOWSELALWAYS 0x0008
#define LVS_SORTASCENDING 0x0010
#define LVS_SORTDESCENDING 0x0020
#define LVS_SHAREIMAGELISTS 0x0040
#define LVS_NOLABELWRAP 0x0080
#define LVS_AUTOARRANGE 0x0100
#define LVS_EDITLABELS 0x0200
#define LVS_OWNERDATA 0x1000
#define LVS_NOSCROLL 0x2000
#define LVS_TYPESTYLEMASK 0xfc00
#define LVS_ALIGNTOP 0x0000
#define LVS_ALIGNLEFT 0x0800
#define LVS_ALIGNMASK 0x0c00
#define LVS_OWNERDRAWFIXED 0x0400
#define LVS_NOCOLUMNHEADER 0x4000
#define LVS_NOSORTHEADER 0x8000
#define I_IMAGECALLBACK (-1)
#define I_INDENTCALLBACK (-1)
#define LV_ITEMA LVITEMA
#define LV_ITEMW LVITEMW
#define LV_ITEM LVITEM
#define LVITEMA_V1_SIZE CCSIZEOF_STRUCT(LVITEMA, lParam)
#define LVITEMW_V1_SIZE CCSIZEOF_STRUCT(LVITEMW, lParam)
typedef struct tagLVITEMA
{
UINT32 mask;
int iItem;
int iSubItem;
UINT32 state;
UINT32 stateMask;
LPSTR pszText;
int cchTextMax;
int iImage;
LPARAM lParam;
int iIndent; //(_WIN32_IE >= 0x0300)
} LVITEMA, * LPLVITEMA;
typedef struct tagLVITEMW
{
UINT32 mask;
int iItem;
int iSubItem;
UINT32 state;
UINT32 stateMask;
LPWSTR pszText;
int cchTextMax;
int iImage;
LPARAM lParam;
int iIndent; //(_WIN32_IE >= 0x0300)
} LVITEMW, * LPLVITEMW;
#define LVITEM LVITEMA
#define LPLVITEM LPLVITEMA
#define LVITEM_V1_SIZE LVITEMA_V1_SIZE
#define LV_COLUMNA LVCOLUMNA
#define LV_COLUMNW LVCOLUMNW
#define LV_COLUMN LVCOLUMN
#define LVCOLUMNA_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNA, iSubItem)
#define LVCOLUMNW_V1_SIZE CCSIZEOF_STRUCT(LVCOLUMNW, iSubItem)
typedef struct tagLVCOLUMNA
{ UINT32 mask;
int fmt;
int cx;
LPSTR pszText;
int cchTextMax;
int iSubItem;
int iImage; //(_WIN32_IE >= 0x0300)
int iOrder; //(_WIN32_IE >= 0x0300)
} LVCOLUMNA,* LPLVCOLUMNA;
typedef struct tagLVCOLUMNW
{ UINT32 mask;
int fmt;
int cx;
LPWSTR pszText;
int cchTextMax;
int iSubItem;
int iImage; //(_WIN32_IE >= 0x0300)
int iOrder; //(_WIN32_IE >= 0x0300)
} LVCOLUMNW,* LPLVCOLUMNW;
#define LVCOLUMN LVCOLUMNA
#define LPLVCOLUMN LPLVCOLUMNA
#define LVCOLUMN_V1_SIZE LVCOLUMNA_V1_SIZE
#define LVCF_FMT 0x0001
#define LVCF_WIDTH 0x0002
#define LVCF_TEXT 0x0004
#define LVCF_SUBITEM 0x0008
#define LVCF_IMAGE 0x0010
#define LVCF_ORDER 0x0020
#define LVCFMT_LEFT 0x0000
#define LVCFMT_RIGHT 0x0001
#define LVCFMT_CENTER 0x0002
#define LVCFMT_JUSTIFYMASK 0x0003
#define LVCFMT_IMAGE 0x0800
#define LVCFMT_BITMAP_ON_RIGHT 0x1000
#define LVCFMT_COL_HAS_IMAGES 0x8000
#define SNDMSG SendMessage32A
#define ListView_GetImageList(hwnd, iImageList) (HIMAGELIST)SNDMSG((hwnd), LVM_GETIMAGELIST, (WPARAM)(INT)(iImageList), 0L)
#define LVSIL_NORMAL 0
#define LVSIL_SMALL 1
#define LVSIL_STATE 2
#define ListView_SetImageList(hwnd, himl, iImageList) (HIMAGELIST)(UINT32)SNDMSG((hwnd), LVM_SETIMAGELIST, (WPARAM32)(iImageList), (LPARAM)(UINT32)(HIMAGELIST)(himl))
#define ListView_GetItemCount(hwnd)(int)SNDMSG((hwnd), LVM_GETITEMCOUNT, 0, 0L)
#define ListView_GetItem(hwnd, pitem)(BOOL32)SNDMSG((hwnd), LVM_GETITEM, 0, (LPARAM)(LV_ITEM *)(pitem))
#define ListView_InsertItem(hwnd, pitem) (int)SNDMSG((hwnd), LVM_INSERTITEM, 0, (LPARAM)(const LV_ITEM *)(pitem))
#define ListView_DeleteAllItems(hwnd) (BOOL32)SNDMSG((hwnd), LVM_DELETEALLITEMS, 0, 0L)
#define ListView_InsertColumn(hwnd, iCol, pcol)(int)SNDMSG((hwnd), LVM_INSERTCOLUMN, (WPARAM32)(int)(iCol), (LPARAM)(const LV_COLUMN *)(pcol))
typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM);
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)(BOOL32)SNDMSG((hwndLV), LVM_SORTITEMS, (WPARAM32)(LPARAM)_lPrm,(LPARAM)(PFNLVCOMPARE)_pfnCompare)
#define ListView_SetItemPosition(hwndLV, i, x, y)(BOOL32)SNDMSG((hwndLV), LVM_SETITEMPOSITION, (WPARAM32)(int)(i), MAKELPARAM((x), (y)))
#define ListView_GetSelectedCount(hwndLV)(UINT32)SNDMSG((hwndLV), LVM_GETSELECTEDCOUNT, 0, 0L)
#define LVIF_TEXT 0x0001
#define LVIF_IMAGE 0x0002
#define LVIF_PARAM 0x0004
#define LVIF_STATE 0x0008
#define LVIF_INDENT 0x0010
#define LVIF_NORECOMPUTE 0x0800
#define LVIS_FOCUSED 0x0001
#define LVIS_SELECTED 0x0002
#define LVIS_CUT 0x0004
#define LVIS_DROPHILITED 0x0008
#define LVIS_ACTIVATING 0x0020
#define LVIS_OVERLAYMASK 0x0F00
#define LVIS_STATEIMAGEMASK 0xF000
#define LPNM_LISTVIEW LPNMLISTVIEW
#define NM_LISTVIEW NMLISTVIEW
typedef struct tagNMLISTVIEW
{ NMHDR hdr;
int iItem;
int iSubItem;
UINT32 uNewState;
UINT32 uOldState;
UINT32 uChanged;
POINT32 ptAction;
LPARAM lParam;
} NMLISTVIEW,*LPNMLISTVIEW;
#define LV_DISPINFOA NMLVDISPINFOA
#define LV_DISPINFOW NMLVDISPINFOW
#define LV_DISPINFO NMLVDISPINFO
typedef struct tagLVDISPINFO {
NMHDR hdr;
LVITEMA item;
} NMLVDISPINFOA, *LPNMLVDISPINFOA;
typedef struct tagLVDISPINFOW {
NMHDR hdr;
LVITEMW item;
} NMLVDISPINFOW, * LPNMLVDISPINFOW;
#define NMLVDISPINFO NMLVDISPINFOA
#endif /* __WINE_COMMCTRL_H */

View File

@ -876,7 +876,6 @@ FAR * ) PURE;
struct _common_directdrawdata {
DWORD depth;
DWORD height,width; /* SetDisplayMode */
HWND32 mainwindow;
};
struct _dga_directdrawdata {
@ -887,12 +886,16 @@ struct _dga_directdrawdata {
struct _xlib_directdrawdata {
Window drawable;
int use_xshm;
/* are these needed for anything? (draw_surf is the active surface)
IDirectDrawSurface *surfs;
DWORD num_surfs, alloc_surfs, draw_surf; */
IDirectDrawSurface *surfs;
DWORD num_surfs, alloc_surfs, draw_surf; */
int paintable;
ATOM winclass;
HWND32 window;
/* current window implementation */
ATOM winclass;
HWND32 window;
PAINTSTRUCT32 ps;
};
struct IDirectDraw {
@ -901,7 +904,6 @@ struct IDirectDraw {
struct _common_directdrawdata d;
union {
struct _xlib_directdrawdata xlib;
struct _xlib_directdrawdata xshm;
struct _dga_directdrawdata dga;
} e;
};
@ -957,8 +959,6 @@ struct IDirectDraw2 {
struct _common_directdrawdata d;
union {
struct _xlib_directdrawdata xlib;
/* only different in image create&put */
struct _xlib_directdrawdata xshm;
struct _dga_directdrawdata dga;
} e;
};
@ -967,7 +967,7 @@ struct IDirectDraw2 {
#define THIS LPDIRECTDRAWSURFACE this
struct _common_directdrawsurface {
LPDIRECTDRAWPALETTE palette;
LPDIRECTDRAW ddraw;
LPDIRECTDRAW2 ddraw;
LPDIRECTDRAWSURFACE3 backbuffer;
LPVOID surface;
DWORD lpitch,width,height;
@ -977,16 +977,12 @@ struct _dga_directdrawsurface {
DWORD fb_height;
};
struct _xshm_directdrawsurface {
struct _xlib_directdrawsurface {
XImage *image;
#ifdef HAVE_LIBXXSHM
XShmSegmentInfo shminfo;
#endif
};
struct _xlib_directdrawsurface {
XImage *image;
BOOL32 surface_is_image_data;
};
typedef struct IDirectDrawSurface_VTable {
/*** IUnknown methods ***/
@ -1034,7 +1030,6 @@ struct IDirectDrawSurface {
struct _common_directdrawsurface s;
union {
struct _dga_directdrawsurface dga;
struct _xshm_directdrawsurface xshm;
struct _xlib_directdrawsurface xlib;
} t;
};
@ -1181,5 +1176,8 @@ struct IDirectDrawColorControl {
#undef STDMETHOD
#undef STDMETHOD_
extern HRESULT WINAPI DirectDrawCreate( LPGUID lpGUID,LPDIRECTDRAW *lplpDD,LPUNKNOWN pUnkOuter );
HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN);
HRESULT WINAPI DirectDrawEnumerate32A(LPDDENUMCALLBACK32A,LPVOID);
HRESULT WINAPI DirectDrawEnumerate32W(LPDDENUMCALLBACK32W,LPVOID);
#define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate)
#endif

View File

@ -87,58 +87,59 @@
#define dbch_ole 79
#define dbch_pager 80
#define dbch_palette 81
#define dbch_print 82
#define dbch_process 83
#define dbch_profile 84
#define dbch_progress 85
#define dbch_prop 86
#define dbch_psdrv 87
#define dbch_rebar 88
#define dbch_reg 89
#define dbch_region 90
#define dbch_relay 91
#define dbch_resource 92
#define dbch_s 93
#define dbch_scroll 94
#define dbch_security 95
#define dbch_segment 96
#define dbch_selector 97
#define dbch_sem 98
#define dbch_sendmsg 99
#define dbch_shell 100
#define dbch_shm 101
#define dbch_snoop 102
#define dbch_sound 103
#define dbch_static 104
#define dbch_statusbar 105
#define dbch_stress 106
#define dbch_string 107
#define dbch_syscolor 108
#define dbch_system 109
#define dbch_task 110
#define dbch_text 111
#define dbch_thread 112
#define dbch_thunk 113
#define dbch_timer 114
#define dbch_toolbar 115
#define dbch_toolhelp 116
#define dbch_tooltips 117
#define dbch_trackbar 118
#define dbch_treeview 119
#define dbch_tweak 120
#define dbch_uitools 121
#define dbch_updown 122
#define dbch_ver 123
#define dbch_virtual 124
#define dbch_vxd 125
#define dbch_win 126
#define dbch_win16drv 127
#define dbch_win32 128
#define dbch_wing 129
#define dbch_winsock 130
#define dbch_wnet 131
#define dbch_x11 132
#define dbch_x11drv 133
#define dbch_pidl 82
#define dbch_print 83
#define dbch_process 84
#define dbch_profile 85
#define dbch_progress 86
#define dbch_prop 87
#define dbch_psdrv 88
#define dbch_rebar 89
#define dbch_reg 90
#define dbch_region 91
#define dbch_relay 92
#define dbch_resource 93
#define dbch_s 94
#define dbch_scroll 95
#define dbch_security 96
#define dbch_segment 97
#define dbch_selector 98
#define dbch_sem 99
#define dbch_sendmsg 100
#define dbch_shell 101
#define dbch_shm 102
#define dbch_snoop 103
#define dbch_sound 104
#define dbch_static 105
#define dbch_statusbar 106
#define dbch_stress 107
#define dbch_string 108
#define dbch_syscolor 109
#define dbch_system 110
#define dbch_task 111
#define dbch_text 112
#define dbch_thread 113
#define dbch_thunk 114
#define dbch_timer 115
#define dbch_toolbar 116
#define dbch_toolhelp 117
#define dbch_tooltips 118
#define dbch_trackbar 119
#define dbch_treeview 120
#define dbch_tweak 121
#define dbch_uitools 122
#define dbch_updown 123
#define dbch_ver 124
#define dbch_virtual 125
#define dbch_vxd 126
#define dbch_win 127
#define dbch_win16drv 128
#define dbch_win32 129
#define dbch_wing 130
#define dbch_winsock 131
#define dbch_wnet 132
#define dbch_x11 133
#define dbch_x11drv 134
/* Definitions for classes identifiers */
#define dbcl_fixme 0
#define dbcl_err 1

View File

@ -4,7 +4,7 @@
#include "debugtools.h"
#endif
#define DEBUG_CHANNEL_COUNT 134
#define DEBUG_CHANNEL_COUNT 135
#ifdef DEBUG_RUNTIME
short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
{1, 1, 0, 0},
@ -141,6 +141,7 @@ short debug_msg_enabled[][DEBUG_CLASS_COUNT] = {
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
{1, 1, 0, 0},
};
const char* debug_ch_name[] = {
"1",
@ -225,6 +226,7 @@ const char* debug_ch_name[] = {
"ole",
"pager",
"palette",
"pidl",
"print",
"process",
"profile",

View File

@ -15,24 +15,25 @@
typedef struct _DOSTASK {
LPVOID img;
unsigned img_ofs;
WORD psp_seg,load_seg;
HMODULE16 hModule;
struct vm86plus_struct VM86;
int fn, state;
#ifdef MZ_USESYSV
/* SYSV IPC is not quite supported yet... */
key_t shm_key;
int shm_id;
#else
char mm_name[128];
int mm_fd;
#endif
int read_pipe,write_pipe;
pid_t task;
} DOSTASK, *LPDOSTASK;
extern HINSTANCE16 MZ_LoadModule( LPCSTR name, LPCSTR cmdline, LPCSTR env, UINT16 show_cmd );
#define MZ_SUPPORTED
extern int MZ_InitTask( LPDOSTASK lpDosTask );
extern int MZ_RunModule( LPDOSTASK lpDosTask );
extern void MZ_KillModule( LPDOSTASK lpDosTask );
extern int DOSVM_Process( LPDOSTASK lpDosTask );
#endif /* linux */
extern HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env,
LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info );
extern int DOSVM_Enter( PCONTEXT context );

View File

@ -40,6 +40,17 @@ typedef struct
int flags;
} DOS_DEVICE;
/* Macros to convert 16 bit to 32 bit file handles and back */
#define HFILE16_TO_HFILE32(handle) \
(((handle)==0) ? GetStdHandle(STD_INPUT_HANDLE) : \
((handle)==1) ? GetStdHandle(STD_OUTPUT_HANDLE) : \
((handle)==2) ? GetStdHandle(STD_ERROR_HANDLE) : \
(handle)-5)
#define HFILE32_TO_HFILE16(handle) ({ HFILE32 hnd=handle; \
((hnd==HFILE_ERROR32) ? HFILE_ERROR16 : \
(HFILE16)hnd+5); })
/* files/file.c */
extern FILE_OBJECT *FILE_GetFile( HFILE32 handle );

View File

@ -200,7 +200,7 @@ typedef struct tagDC_FUNCS
BOOL32 (*pPatBlt)(DC*,INT32,INT32,INT32,INT32,DWORD);
BOOL32 (*pPie)(DC*,INT32,INT32,INT32,INT32,INT32,INT32,INT32,INT32);
BOOL32 (*pPolyPolygon)(DC*,LPPOINT32,LPINT32,UINT32);
BOOL32 (*pPolyPolyline)(DC*,LPPOINT32,LPINT32,UINT32);
BOOL32 (*pPolyPolyline)(DC*,LPPOINT32,LPDWORD,DWORD);
BOOL32 (*pPolygon)(DC*,LPPOINT32,INT32);
BOOL32 (*pPolyline)(DC*,LPPOINT32,INT32);
BOOL32 (*pPolyBezier)(DC*,POINT32, LPPOINT32,DWORD);

View File

@ -18,32 +18,32 @@ typedef struct
INT32 fmt;
LPARAM lParam;
INT32 iImage;
INT32 iOrder;
INT32 iOrder; /* see documentation of HD_ITEM */
BOOL32 bDown;
RECT32 rect;
BOOL32 bDown; /* is item pressed? (used for drawing) */
RECT32 rect; /* bounding rectangle of the item */
} HEADER_ITEM;
typedef struct
{
UINT32 uNumItem;
INT32 nHeight;
HFONT32 hFont;
HCURSOR32 hcurArrow;
HCURSOR32 hcurDivider;
HCURSOR32 hcurDivopen;
BOOL32 bCaptured;
BOOL32 bPressed;
BOOL32 bTracking;
INT32 iMoveItem;
INT32 xTrackOffset;
INT32 xOldTrack;
INT32 nOldWidth;
INT32 iHotItem;
UINT32 uNumItem; /* number of items (columns) */
INT32 nHeight; /* height of the header (pixels) */
HFONT32 hFont; /* handle to the current font */
HCURSOR32 hcurArrow; /* handle to the arrow cursor */
HCURSOR32 hcurDivider; /* handle to a cursor (used over dividers) <-|-> */
HCURSOR32 hcurDivopen; /* handle to a cursor (used over dividers) <-||-> */
BOOL32 bCaptured; /* Is the mouse captured? */
BOOL32 bPressed; /* Is a header item pressed (down)? */
BOOL32 bTracking; /* Is in tracking mode? */
INT32 iMoveItem; /* index of tracked item. (Tracking mode) */
INT32 xTrackOffset; /* distance between the right side of the tracked item and the cursor */
INT32 xOldTrack; /* track offset (see above) after the last WM_MOUSEMOVE */
INT32 nOldWidth; /* width of a sizing item after the last WM_MOUSEMOVE */
INT32 iHotItem; /* index of hot item (cursor is over this item) */
HIMAGELIST himl;
HEADER_ITEM *items;
HIMAGELIST himl; /* handle to a image list (may be 0) */
HEADER_ITEM *items; /* pointer to array of HEADER_ITEM's */
} HEADER_INFO;

View File

@ -17,6 +17,7 @@ extern DWORD DOSMEM_CollateTable;
extern BOOL32 DOSMEM_Init(HMODULE16 hModule);
extern void DOSMEM_Tick(void);
extern WORD DOSMEM_AllocSelector(WORD);
extern char * DOSMEM_MemoryBase(HMODULE16 hModule);
extern LPVOID DOSMEM_GetBlock(HMODULE16 hModule, UINT32 size, UINT16* p);
extern BOOL32 DOSMEM_FreeBlock(HMODULE16 hModule, void* ptr);
extern LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT32 size, UINT16* p);
@ -36,6 +37,10 @@ extern void IO_outport( int port, int count, DWORD value );
/* msdos/int1a.c */
extern DWORD INT1A_GetTicksSinceMidnight(void);
extern void WINAPI INT_Int1aHandler(CONTEXT*);
/* msdos/int2f.c */
extern void WINAPI INT_Int2fHandler(CONTEXT*);
/* loader/signal.c */
extern BOOL32 SIGNAL_Init(void);

View File

@ -52,6 +52,7 @@ typedef struct _NE_MODULE
HMODULE16 self; /* 44 Handle for this module */
WORD self_loading_sel; /* 46 Selector used for self-loading apps. */
struct _DOSTASK *lpDosTask;
LPVOID dos_image; /* pointer to DOS memory (for DOS apps) */
} NE_MODULE;
@ -98,7 +99,7 @@ typedef struct
{
LPSTR lpEnvAddress;
LPSTR lpCmdLine;
LPSTR lpCmdShow;
UINT16 *lpCmdShow;
DWORD dwReserved;
} LOADPARAMS32;
@ -140,8 +141,6 @@ extern FARPROC32 MODULE_GetProcAddress32( struct _PDB32*pdb,HMODULE32 hModule,LP
extern WINE_MODREF *MODULE32_LookupHMODULE( struct _PDB32 *process, HMODULE32 hModule );
extern HMODULE32 MODULE_FindModule32( struct _PDB32 *process, LPCSTR path );
extern HMODULE32 MODULE_CreateDummyModule( const OFSTRUCT *ofs );
extern HINSTANCE16 MODULE_Load( LPCSTR name, BOOL32 implicit, LPCSTR cmd_line,
LPCSTR env, UINT32 show_cmd );
extern FARPROC16 MODULE_GetWndProcEntry16( const char *name );
extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE32 hmodule, LPCSTR name );

View File

@ -14,7 +14,8 @@ typedef struct tagPAGER_INFO
COLORREF clrBk;
INT32 iBorder;
INT32 iButtonSize;
INT32 iPos;
BOOL32 bForward;
} PAGER_INFO;

View File

@ -40,8 +40,9 @@ extern HRSRC32 PE_FindResourceEx32W(struct _wine_modref*,LPCWSTR,LPCWSTR,WORD);
extern DWORD PE_SizeofResource32(HMODULE32,HRSRC32);
extern HMODULE32 PE_LoadLibraryEx32A(LPCSTR,struct _PDB32*,HFILE32,DWORD);
extern HGLOBAL32 PE_LoadResource32(struct _wine_modref *wm,HRSRC32);
extern HINSTANCE16 PE_LoadModule( LPCSTR name, LPCSTR cmd_line,
LPCSTR env, UINT16 showCmd );
extern HINSTANCE16 PE_CreateProcess( LPCSTR name, LPCSTR cmd_line,
LPCSTR env, LPSTARTUPINFO32A startup,
LPPROCESS_INFORMATION info );
struct _PDB32; /* forward definition */
struct _THDB; /* forward definition */

View File

@ -142,7 +142,7 @@ extern PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access, int *server_handle
extern PDB32 *PROCESS_IdToPDB( DWORD id );
extern PDB32 *PROCESS_Create( struct _NE_MODULE *pModule, LPCSTR cmd_line,
LPCSTR env, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance, UINT32 cmdShow,
HINSTANCE16 hPrevInstance, STARTUPINFO32A *startup,
PROCESS_INFORMATION *info );
extern void PROCESS_SuspendOtherThreads(void);
extern void PROCESS_ResumeOtherThreads(void);

View File

@ -80,6 +80,8 @@ extern void QUEUE_WalkQueues(void);
extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue );
extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
extern void QUEUE_Signal( HTASK16 hTask );
extern void QUEUE_Wait(void);
extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue );

View File

@ -7,10 +7,38 @@
#ifndef __WINE_REBAR_H
#define __WINE_REBAR_H
typedef struct tagREBAR_BAND
{
UINT32 fStyle;
COLORREF clrFore;
COLORREF clrBack;
INT32 iImage;
HWND32 hwndChild;
UINT32 cxMinChild;
UINT32 cyMinChild;
UINT32 cx;
HBITMAP32 hbmBack;
UINT32 wID;
UINT32 cyChild;
UINT32 cyMaxChild;
UINT32 cyIntegral;
UINT32 cxIdeal;
LPARAM lParam;
UINT32 cxHeader;
LPSTR lpText;
} REBAR_BAND;
typedef struct tagREBAR_INFO
{
UINT32 uDummy; /* this is just a dummy to keep the compiler happy */
COLORREF clrBk; /* background color */
COLORREF clrText; /* text color */
HIMAGELIST himl; /* handle to imagelist */
UINT32 uNumBands; /* number of bands in the rebar */
REBAR_BAND *bands; /* pointer to the array of rebar bands */
} REBAR_INFO;

View File

@ -86,6 +86,18 @@ struct get_process_info_reply
};
/* Retrieve information about a thread */
struct get_thread_info_request
{
int handle; /* thread handle */
};
struct get_thread_info_reply
{
void* pid; /* server thread id */
int exit_code; /* thread exit code */
};
/* Close a handle for the current process */
struct close_handle_request
{
@ -123,6 +135,23 @@ struct open_process_reply
};
/* Wait for handles */
struct select_request
{
int count; /* handles count */
int flags; /* wait flags (see below) */
int timeout; /* timeout in ms */
/* int handles[] */
};
struct select_reply
{
int signaled; /* signaled handle */
};
#define SELECT_ALL 1
#define SELECT_MSG 2
#define SELECT_ALERTABLE 4
#define SELECT_TIMEOUT 8
/* client-side functions */
#ifndef __WINE_SERVER__
@ -134,8 +163,10 @@ extern int CLIENT_TerminateThread( int handle, int exit_code );
extern int CLIENT_CloseHandle( int handle );
extern int CLIENT_DuplicateHandle( int src_process, int src_handle, int dst_process,
int dst_handle, DWORD access, BOOL32 inherit, DWORD options );
extern int CLIENT_GetThreadInfo( int handle, struct get_thread_info_reply *reply );
extern int CLIENT_GetProcessInfo( int handle, struct get_process_info_reply *reply );
extern int CLIENT_OpenProcess( void *pid, DWORD access, BOOL32 inherit );
extern int CLIENT_Select( int count, int *handles, int flags, int timeout );
#endif /* __WINE_SERVER__ */
#endif /* __WINE_SERVER_H */

View File

@ -18,17 +18,22 @@
struct object;
struct object_name;
struct thread;
struct object_ops
{
void (*dump)(struct object *,int); /* dump the object (for debugging) */
void (*destroy)(struct object *); /* destroy on refcount == 0 */
void (*dump)(struct object *,int); /* dump the object (for debugging) */
int (*signaled)(struct object *,struct thread *); /* is object signaled? */
int (*satisfied)(struct object *,struct thread *); /* wait satisfied; return 1 if abandoned */
void (*destroy)(struct object *); /* destroy on refcount == 0 */
};
struct object
{
unsigned int refcount;
const struct object_ops *ops;
struct wait_queue_entry *head;
struct wait_queue_entry *tail;
struct object_name *name;
};

View File

@ -10,9 +10,11 @@ enum request
REQ_TERMINATE_PROCESS,
REQ_TERMINATE_THREAD,
REQ_GET_PROCESS_INFO,
REQ_GET_THREAD_INFO,
REQ_CLOSE_HANDLE,
REQ_DUP_HANDLE,
REQ_OPEN_PROCESS,
REQ_SELECT,
REQ_NB_REQUESTS
};
@ -26,9 +28,11 @@ DECL_HANDLER(init_thread);
DECL_HANDLER(terminate_process);
DECL_HANDLER(terminate_thread);
DECL_HANDLER(get_process_info);
DECL_HANDLER(get_thread_info);
DECL_HANDLER(close_handle);
DECL_HANDLER(dup_handle);
DECL_HANDLER(open_process);
DECL_HANDLER(select);
static const struct handler {
void (*handler)();
@ -39,9 +43,11 @@ static const struct handler {
{ (void(*)())req_terminate_process, sizeof(struct terminate_process_request) },
{ (void(*)())req_terminate_thread, sizeof(struct terminate_thread_request) },
{ (void(*)())req_get_process_info, sizeof(struct get_process_info_request) },
{ (void(*)())req_get_thread_info, sizeof(struct get_thread_info_request) },
{ (void(*)())req_close_handle, sizeof(struct close_handle_request) },
{ (void(*)())req_dup_handle, sizeof(struct dup_handle_request) },
{ (void(*)())req_open_process, sizeof(struct open_process_request) },
{ (void(*)())req_select, sizeof(struct select_request) },
};
#endif /* WANT_REQUEST_HANDLERS */

View File

@ -16,21 +16,26 @@
/* thread structure */
struct process;
struct thread_wait;
enum run_state { STARTING, RUNNING, TERMINATED };
struct thread
{
struct object obj; /* object header */
struct thread *next; /* system-wide thread list */
struct thread *prev;
struct thread *proc_next; /* per-process thread list */
struct thread *proc_prev;
struct process *process;
int error; /* current error code */
int exit_code; /* thread exit code */
int client_fd; /* client fd for socket communications */
int unix_pid; /* Unix pid of client */
enum request last_req; /* last request received (for debugging) */
char *name;
struct object obj; /* object header */
struct thread *next; /* system-wide thread list */
struct thread *prev;
struct thread *proc_next; /* per-process thread list */
struct thread *proc_prev;
struct process *process;
struct thread_wait *wait; /* current wait condition if sleeping */
int error; /* current error code */
enum run_state state; /* running state */
int exit_code; /* thread exit code */
int client_fd; /* client fd for socket communications */
int unix_pid; /* Unix pid of client */
enum request last_req; /* last request received (for debugging) */
char *name;
};
extern struct thread *current;
@ -41,10 +46,16 @@ extern struct thread *create_thread( int fd, void *pid, int *thread_handle,
int *process_handle );
extern struct thread *get_thread_from_id( void *id );
extern struct thread *get_thread_from_handle( int handle, unsigned int access );
extern void get_thread_info( struct thread *thread,
struct get_thread_info_reply *reply );
extern int send_reply( struct thread *thread, int pass_fd,
int n, ... /* arg_1, len_1, ..., arg_n, len_n */ );
extern void kill_thread( struct thread *thread, int exit_code );
extern void thread_killed( struct thread *thread, int exit_code );
extern void thread_timeout(void);
extern void sleep_on( struct thread *thread, int count, int *handles,
int flags, int timeout );
extern void wake_up( struct object *obj, int max );
#define SET_ERROR(err) (current->error = (err))
#define CLEAR_ERROR() (current->error = 0)

View File

@ -6,15 +6,29 @@
#include "windows.h"
#include "winreg.h"
#include "imagelist.h"
#ifndef MAX_PATH
#define MAX_PATH 260
#endif
/****************************************************************************
* shell 16
*/
extern void SHELL_LoadRegistry();
extern void SHELL_SaveRegistry();
extern void SHELL_Init();
/* global functions used from shell32 */
extern HINSTANCE32 SHELL_FindExecutable(LPCSTR,LPCSTR ,LPSTR);
extern HGLOBAL16 WINAPI InternalExtractIcon(HINSTANCE16,LPCSTR,UINT16,WORD);
/****************************************************************************
* shell 32
*/
/****************************************************************************
* common return codes
*/
#define SHELL_ERROR_SUCCESS 0L
#define SHELL_ERROR_BADDB 1L
#define SHELL_ERROR_BADKEY 2L
@ -25,8 +39,8 @@ extern void SHELL_Init();
#define SHELL_ERROR_INVALID_PARAMETER 7L
#define SHELL_ERROR_ACCESS_DENIED 8L
/******************************
* common shell file structures
/****************************************************************************
* common shell file structures
*/
#define FO_MOVE 0x0001
#define FO_COPY 0x0002
@ -63,8 +77,8 @@ typedef struct { /* structure for dropped files */
/* memory block with filenames follows */
} DROPFILESTRUCT, *LPDROPFILESTRUCT;
/******************************
* NOTIFYICONDATA
/****************************************************************************
* NOTIFYICONDATA
*/
typedef struct _NOTIFYICONDATA {
DWORD cbSize;
@ -76,8 +90,8 @@ typedef struct _NOTIFYICONDATA {
CHAR szTip[64];
} NOTIFYICONDATA, *PNOTIFYICONDATA;
/*******************************
* SHITEMID, ITEMIDLIST, PIDL API
/****************************************************************************
* SHITEMID, ITEMIDLIST, PIDL API
*/
typedef struct
{ WORD cb; /* nr of bytes in this item */
@ -89,6 +103,7 @@ typedef struct
} ITEMIDLIST,*LPITEMIDLIST,*LPCITEMIDLIST;
LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl);
LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl);
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST iil1,LPCITEMIDLIST iil2);
DWORD WINAPI ILGetSize(LPITEMIDLIST pidl);
@ -97,7 +112,7 @@ DWORD WINAPI SHGetPathFromIDList32W (LPCITEMIDLIST pidl,LPWSTR pszPath);
#define SHGetPathFromIDList WINELIB_NAME_AW(SHGetPathFromIDList)
/****************************************************************************
* SHFILEINFO API
* SHFILEINFO API
*/
typedef struct tagSHFILEINFO32A {
HICON32 hIcon; /* icon */
@ -122,7 +137,7 @@ DWORD WINAPI SHGetFileInfo32W(LPCWSTR,DWORD,SHFILEINFO32W*,UINT32,UINT32);
#define SHGetFileInfo WINELIB_NAME_AW(SHGetFileInfo)
/****************************************************************************
* SHFILEOPSTRUCT API
* SHFILEOPSTRUCT API
*/
typedef struct _SHFILEOPSTRUCTA
{ HWND32 hwnd;
@ -153,7 +168,7 @@ DECL_WINELIB_TYPE_AW(SHFILEOPSTRUCT)
DWORD WINAPI SHFileOperation32(LPSHFILEOPSTRUCT32 lpFileOp);
/****************
/****************************************************************************
* APPBARDATA
*/
typedef struct _AppBarData {
@ -188,6 +203,7 @@ typedef struct
{ LPITEMIDLIST pidl;
DWORD unknown;
} IDSTRUCT;
DWORD WINAPI SHChangeNotifyRegister(HWND32 hwnd,LONG events1,LONG events2,DWORD msg,int count,IDSTRUCT *idlist);
DWORD WINAPI SHChangeNotifyDeregister(LONG x1,LONG x2);
@ -199,14 +215,18 @@ DWORD WINAPI SHChangeNotifyDeregister(LONG x1,LONG x2);
DWORD WINAPI SHAddToRecentDocs(UINT32 uFlags, LPCVOID pv);
/****************************************************************************
* string and path functions
*/
LPSTR WINAPI PathAddBackslash(LPSTR path);
LPSTR WINAPI PathCombine(LPSTR target,LPSTR x1,LPSTR x2);
LPSTR WINAPI PathRemoveBlanks(LPSTR str);
LPSTR WINAPI PathFindFilename(LPSTR fn);
/****************************************************************************
* other functions
*/
LPVOID WINAPI SHAlloc(DWORD len);
DWORD WINAPI SHFree(LPVOID x);
LPSTR WINAPI PathAddBackslash(LPSTR path);
LPSTR WINAPI PathCombine(LPSTR target,LPSTR x1,LPSTR x2);
LPSTR WINAPI PathRemoveBlanks(LPSTR str);
#define SE_ERR_SHARE 26
#define SE_ERR_ASSOCINCOMPLETE 27
@ -233,10 +253,4 @@ LPSTR WINAPI PathRemoveBlanks(LPSTR str);
#define CSIDL_FONTS 0x0014
#define CSIDL_TEMPLATES 0x0015
/*******************************************
* global SHELL32.DLL variables
*/
extern HINSTANCE32 shell32_hInstance;
extern UINT32 shell32_DllRefCount;
#endif /* __WINE_SHELL_H */

View File

@ -7,6 +7,7 @@
#include "compobj.h"
#include "storage.h"
#include "commctrl.h"
#include "interfaces.h"
#define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
#define STDMETHOD_(type,xfn) type (CALLBACK *fn##xfn)
@ -25,11 +26,15 @@ DWORD WINAPI SHELL32_DllGetClassObject(LPCLSID,REFIID,LPVOID*);
typedef LPVOID LPBC; /* *IBindCtx really */
/* foreward declaration of the objects*/
typedef struct IEnumIDList IEnumIDList,*LPENUMIDLIST;
typedef struct tagSHELLFOLDER *LPSHELLFOLDER,IShellFolder;
typedef struct tagSHELLVIEW *LPSHELLVIEW,IShellView;
typedef struct tagSHELLBROWSER *LPSHELLBROWSER,IShellBrowser;
typedef struct IContextMenu IContextMenu, *LPCONTEXTMENU;
typedef struct IShellExtInit IShellExtInit, *LPSHELLEXTINIT;
typedef struct IEnumIDList IEnumIDList, *LPENUMIDLIST;
typedef struct tagSHELLFOLDER *LPSHELLFOLDER, IShellFolder;
typedef struct tagSHELLVIEW *LPSHELLVIEW, IShellView;
typedef struct tagSHELLBROWSER *LPSHELLBROWSER,IShellBrowser;
typedef struct IDataObject IDataObject, *LPDATAOBJECT;
/****************************************************************************
* SHELL ID
*/
@ -114,17 +119,18 @@ typedef struct PidlMgr_VTable
STDMETHOD_(LPITEMIDLIST, CreateDrive) (THIS_ LPCSTR);
STDMETHOD_(LPITEMIDLIST, CreateFolder) (THIS_ LPCSTR);
STDMETHOD_(LPITEMIDLIST, CreateValue) (THIS_ LPCSTR);
/* STDMETHOD_(void, Delete) (THIS_ LPITEMIDLIST);*/
STDMETHOD_(LPITEMIDLIST, GetNextItem) (THIS_ LPCITEMIDLIST);
STDMETHOD_(BOOL32, GetDesktop) (THIS_ LPCITEMIDLIST, LPSTR);
STDMETHOD_(BOOL32, GetDrive) (THIS_ LPCITEMIDLIST, LPSTR, UINT16);
STDMETHOD_(LPITEMIDLIST, GetLastItem) (THIS_ LPCITEMIDLIST);
STDMETHOD_(DWORD, GetItemText) (THIS_ LPCITEMIDLIST, LPSTR, UINT16);
STDMETHOD_(BOOL32, IsDesktop) (THIS_ LPCITEMIDLIST);
STDMETHOD_(BOOL32, IsMyComputer) (THIS_ LPCITEMIDLIST);
STDMETHOD_(BOOL32, IsDrive) (THIS_ LPCITEMIDLIST);
STDMETHOD_(BOOL32, IsFolder) (THIS_ LPCITEMIDLIST);
STDMETHOD_(BOOL32, IsValue) (THIS_ LPCITEMIDLIST);
STDMETHOD_(BOOL32, HasFolders) (THIS_ LPSTR, LPCITEMIDLIST);
STDMETHOD_(DWORD, GetFolderText) (THIS_ LPCITEMIDLIST, LPSTR, DWORD);
STDMETHOD_(DWORD, GetValueText) (THIS_ LPCITEMIDLIST, LPSTR, DWORD);
@ -147,6 +153,136 @@ extern LPPIDLMGR PidlMgr_Constructor();
extern void PidlMgr_Destructor(THIS);
#endif
#undef THIS
/*****************************************************************************
* IContextMenu interface
*/
#define THIS LPCONTEXTMENU this
/* QueryContextMenu uFlags */
#define CMF_NORMAL 0x00000000
#define CMF_DEFAULTONLY 0x00000001
#define CMF_VERBSONLY 0x00000002
#define CMF_EXPLORE 0x00000004
#define CMF_NOVERBS 0x00000008
#define CMF_CANRENAME 0x00000010
#define CMF_NODEFAULT 0x00000020
#define CMF_INCLUDESTATIC 0x00000040
#define CMF_RESERVED 0xffff0000 // View specific
/* GetCommandString uFlags */
#define GCS_VERBA 0x00000000 // canonical verb
#define GCS_HELPTEXTA 0x00000001 // help text (for status bar)
#define GCS_VALIDATEA 0x00000002 // validate command exists
#define GCS_VERBW 0x00000004 // canonical verb (unicode)
#define GCS_HELPTEXTW 0x00000005 // help text (unicode version)
#define GCS_VALIDATEW 0x00000006 // validate command exists (unicode)
#define GCS_UNICODE 0x00000004 // for bit testing - Unicode string
#define GCS_VERB GCS_VERBA
#define GCS_HELPTEXT GCS_HELPTEXTA
#define GCS_VALIDATE GCS_VALIDATEA
#define CMDSTR_NEWFOLDERA "NewFolder"
#define CMDSTR_VIEWLISTA "ViewList"
#define CMDSTR_VIEWDETAILSA "ViewDetails"
#define CMDSTR_NEWFOLDERW L"NewFolder"
#define CMDSTR_VIEWLISTW L"ViewList"
#define CMDSTR_VIEWDETAILSW L"ViewDetails"
#define CMDSTR_NEWFOLDER CMDSTR_NEWFOLDERA
#define CMDSTR_VIEWLIST CMDSTR_VIEWLISTA
#define CMDSTR_VIEWDETAILS CMDSTR_VIEWDETAILSA
#define CMIC_MASK_HOTKEY SEE_MASK_HOTKEY
#define CMIC_MASK_ICON SEE_MASK_ICON
#define CMIC_MASK_FLAG_NO_UI SEE_MASK_FLAG_NO_UI
#define CMIC_MASK_UNICODE SEE_MASK_UNICODE
#define CMIC_MASK_NO_CONSOLE SEE_MASK_NO_CONSOLE
#define CMIC_MASK_HASLINKNAME SEE_MASK_HASLINKNAME
#define CMIC_MASK_FLAG_SEP_VDM SEE_MASK_FLAG_SEPVDM
#define CMIC_MASK_HASTITLE SEE_MASK_HASTITLE
#define CMIC_MASK_ASYNCOK SEE_MASK_ASYNCOK
#define CMIC_MASK_PTINVOKE 0x20000000
/*NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor */
typedef struct _CMINVOKECOMMANDINFO
{ DWORD cbSize; // sizeof(CMINVOKECOMMANDINFO)
DWORD fMask; // any combination of CMIC_MASK_*
HWND32 hwnd; // might be NULL (indicating no owner window)
LPCSTR lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
LPCSTR lpParameters; // might be NULL (indicating no parameter)
LPCSTR lpDirectory; // might be NULL (indicating no specific directory)
int nShow; // one of SW_ values for ShowWindow() API
DWORD dwHotKey;
HANDLE32 hIcon;
} CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO;
typedef struct _CMInvokeCommandInfoEx
{ DWORD cbSize; // must be sizeof(CMINVOKECOMMANDINFOEX)
DWORD fMask; // any combination of CMIC_MASK_*
HWND32 hwnd; // might be NULL (indicating no owner window)
LPCSTR lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
LPCSTR lpParameters; // might be NULL (indicating no parameter)
LPCSTR lpDirectory; // might be NULL (indicating no specific directory)
int nShow; // one of SW_ values for ShowWindow() API
DWORD dwHotKey;
HANDLE32 hIcon;
LPCSTR lpTitle; // For CreateProcess-StartupInfo.lpTitle
LPCWSTR lpVerbW; // Unicode verb (for those who can use it)
LPCWSTR lpParametersW; // Unicode parameters (for those who can use it)
LPCWSTR lpDirectoryW; // Unicode directory (for those who can use it)
LPCWSTR lpTitleW; // Unicode title (for those who can use it)
POINT32 ptInvoke; // Point where it's invoked
} CMINVOKECOMMANDINFOEX, *LPCMINVOKECOMMANDINFOEX;
typedef struct IContextMenu_VTable
{ // *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(QueryContextMenu)(THIS_ HMENU32 hmenu,UINT32 indexMenu,UINT32 idCmdFirst, UINT32 idCmdLast,UINT32 uFlags) PURE;
STDMETHOD(InvokeCommand)(THIS_ LPCMINVOKECOMMANDINFO lpici) PURE;
STDMETHOD(GetCommandString)(THIS_ UINT32 idCmd,UINT32 uType,UINT32 * pwReserved,LPSTR pszName,UINT32 cchMax) PURE;
} IContextMenu_VTable,*LPCONTEXTMENU_VTABLE;
struct IContextMenu
{ LPCONTEXTMENU_VTABLE lpvtbl;
DWORD ref;
LPSHELLFOLDER pSFParent;
LPITEMIDLIST *aPidls;
LPPIDLMGR pPidlMgr;
BOOL32 bAllValues;
};
#undef THIS
/*****************************************************************************
* IShellExtInit interface
*/
#define THIS LPSHELLEXTINIT this
typedef struct IShellExtInit_VTable
{ // *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
// *** IShellExtInit methods ***
STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder, LPDATAOBJECT lpdobj, HKEY hkeyProgID) PURE;
} IShellExtInit_VTable,*LPSHELLEXTINIT_VTABLE;
struct IShellExtInit
{ LPSHELLEXTINIT_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
/*****************************************************************************
@ -310,16 +446,20 @@ typedef struct IShellFolder_VTable {
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,LPCOLESTR32 lpszName, DWORD uFlags,LPITEMIDLIST * ppidlOut) PURE;
/* utility functions */
STDMETHOD_(BOOL32,GetFolderPath)(THIS_ LPSTR, DWORD);
} *LPSHELLFOLDER_VTABLE,IShellFolder_VTable;
struct tagSHELLFOLDER {
LPSHELLFOLDER_VTABLE lpvtbl;
DWORD ref;
LPSTR mlpszFolder;
LPPIDLMGR pPidlMgr;
LPITEMIDLIST mpidl;
LPITEMIDLIST mpidlNSRoot;
LPSHELLFOLDER mpSFParent;
DWORD ref;
LPSTR mlpszFolder;
LPPIDLMGR pPidlMgr;
LPITEMIDLIST mpidl;
LPITEMIDLIST mpidlNSRoot;
LPSHELLFOLDER mpSFParent;
};
extern LPSHELLFOLDER pdesktopfolder;
@ -330,6 +470,12 @@ extern LPSHELLFOLDER pdesktopfolder;
*/
#define THIS LPSHELLBROWSER this
#define FCW_STATUS 0x0001
#define FCW_TOOLBAR 0x0002
#define FCW_TREE 0x0003
#define FCW_INTERNETBAR 0x0006
#define FCW_PROGRESS 0x0008
typedef struct IShellBrowser_VTable
{ // *** IUnknown methods ***
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
@ -383,6 +529,42 @@ struct tagSHELLBROWSER
#define SVGIO_SELECTION 0x00000001
#define SVGIO_ALLVIEW 0x00000002
/* The explorer dispatches WM_COMMAND messages based on the range of
command/menuitem IDs. All the IDs of menuitems that the view (right
pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
won't dispatch them). The view should not deal with any menuitems
in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
version of the shell).
FCIDM_SHVIEWFIRST/LAST for the right pane (IShellView)
FCIDM_BROWSERFIRST/LAST for the explorer frame (IShellBrowser)
FCIDM_GLOBAL/LAST for the explorer's submenu IDs
*/
#define FCIDM_SHVIEWFIRST 0x0000
#define FCIDM_SHVIEWLAST 0x7fff
#define FCIDM_BROWSERFIRST 0xa000
#define FCIDM_BROWSERLAST 0xbf00
#define FCIDM_GLOBALFIRST 0x8000
#define FCIDM_GLOBALLAST 0x9fff
/*
* Global submenu IDs and separator IDs
*/
#define FCIDM_MENU_FILE (FCIDM_GLOBALFIRST+0x0000)
#define FCIDM_MENU_EDIT (FCIDM_GLOBALFIRST+0x0040)
#define FCIDM_MENU_VIEW (FCIDM_GLOBALFIRST+0x0080)
#define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
#define FCIDM_MENU_TOOLS (FCIDM_GLOBALFIRST+0x00c0)
#define FCIDM_MENU_TOOLS_SEP_GOTO (FCIDM_GLOBALFIRST+0x00c1)
#define FCIDM_MENU_HELP (FCIDM_GLOBALFIRST+0x0100)
#define FCIDM_MENU_FIND (FCIDM_GLOBALFIRST+0x0140)
#define FCIDM_MENU_EXPLORE (FCIDM_GLOBALFIRST+0x0150)
#define FCIDM_MENU_FAVORITES (FCIDM_GLOBALFIRST+0x0170)
/* control IDs known to the view */
#define FCIDM_TOOLBAR (FCIDM_BROWSERFIRST + 0)
#define FCIDM_STATUS (FCIDM_BROWSERFIRST + 1)
/* uState values for IShellView::UIActivate */
typedef enum
{ SVUIA_DEACTIVATE = 0,
@ -424,8 +606,11 @@ struct tagSHELLVIEW
LPSHELLFOLDER pSFParent;
LPSHELLBROWSER pShellBrowser;
HWND32 hWnd;
HWND32 hWndList;
FOLDERSETTINGS FolderSettings;
HWND32 hWndParent;
HMENU32 hMenu;
UINT32 uState;
};
typedef GUID SHELLVIEWID;
@ -498,19 +683,173 @@ struct IShellLink {
#undef THIS
#ifdef __WINE__
/****************************************************************************
* IExtractIcon interface
*
* FIXME
* Is the ExtractIconA interface
*/
#define THIS LPEXTRACTICON this
/* GetIconLocation() input flags*/
#define GIL_OPENICON 0x0001 // allows containers to specify an "open" look
#define GIL_FORSHELL 0x0002 // icon is to be displayed in a ShellFolder
#define GIL_ASYNC 0x0020 // this is an async extract, return E_ASYNC
/* GetIconLocation() return flags */
#define GIL_SIMULATEDOC 0x0001 // simulate this document icon for this
#define GIL_PERINSTANCE 0x0002 // icons from this class are per instance (each file has its own)
#define GIL_PERCLASS 0x0004 // icons from this class per class (shared for all files of this type)
#define GIL_NOTFILENAME 0x0008 // location is not a filename, must call ::ExtractIcon
#define GIL_DONTCACHE 0x0010 // this icon should not be cached
typedef struct IExtractIcon IExtractIcon,*LPEXTRACTICON;
typedef struct IExtractIcon_VTable
{ /*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IExtractIcon methods ***/
STDMETHOD(GetIconLocation)(THIS_ UINT32 uFlags, LPSTR szIconFile, UINT32 cchMax, int * piIndex, UINT32 * pwFlags) PURE;
STDMETHOD(Extract)(THIS_ LPCSTR pszFile, UINT32 nIconIndex, HICON32 *phiconLarge, HICON32 *phiconSmall, UINT32 nIconSize) PURE;
}IExtractIccon_VTable,*LPEXTRACTICON_VTABLE;
struct IExtractIcon
{ LPEXTRACTICON_VTABLE lpvtbl;
DWORD ref;
LPITEMIDLIST pidl;
};
#undef THIS
/****************************************************************************
* IShellIcon interface
*/
#define THIS LPSHELLICON this
typedef struct IShellIcon IShellIcon,*LPSHELLICON;
typedef struct IShellIcon_VTable
{ /*** IUnknown methods ***/
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IShellIcon methods ***/
STDMETHOD(GetIconOf)(THIS_ LPCITEMIDLIST pidl, UINT32 flags, LPINT32 lpIconIndex) PURE;
} IShellIcon_VTable,*LPSHELLICON_VTABLE;
struct IShellIcon
{ LPSHELLICON_VTABLE lpvtbl;
DWORD ref;
};
#undef THIS
/****************************************************************************
* Class constructors
*/
#ifdef __WINE__
extern LPCLASSFACTORY IClassFactory_Constructor();
extern LPCONTEXTMENU IContextMenu_Constructor(LPSHELLFOLDER, LPCITEMIDLIST *, UINT32);
extern LPSHELLFOLDER IShellFolder_Constructor(LPSHELLFOLDER,LPITEMIDLIST);
extern LPSHELLVIEW IShellView_Constructor();
extern LPSHELLLINK IShellLink_Constructor();
extern LPENUMIDLIST IEnumIDList_Constructor(LPCSTR,DWORD,HRESULT*);
extern LPEXTRACTICON IExtractIcon_Constructor(LPITEMIDLIST);
#endif
/****************************************************************************
* Shell Execute API
*/
#define SE_ERR_FNF 2 // file not found
#define SE_ERR_PNF 3 // path not found
#define SE_ERR_ACCESSDENIED 5 // access denied
#define SE_ERR_OOM 8 // out of memory
#define SE_ERR_DLLNOTFOUND 32
#define SE_ERR_SHARE 26
#define SE_ERR_ASSOCINCOMPLETE 27
#define SE_ERR_DDETIMEOUT 28
#define SE_ERR_DDEFAIL 29
#define SE_ERR_DDEBUSY 30
#define SE_ERR_NOASSOC 31
#define SEE_MASK_CLASSNAME 0x00000001
#define SEE_MASK_CLASSKEY 0x00000003
#define SEE_MASK_IDLIST 0x00000004
#define SEE_MASK_INVOKEIDLIST 0x0000000c
#define SEE_MASK_ICON 0x00000010
#define SEE_MASK_HOTKEY 0x00000020
#define SEE_MASK_NOCLOSEPROCESS 0x00000040
#define SEE_MASK_CONNECTNETDRV 0x00000080
#define SEE_MASK_FLAG_DDEWAIT 0x00000100
#define SEE_MASK_DOENVSUBST 0x00000200
#define SEE_MASK_FLAG_NO_UI 0x00000400
#define SEE_MASK_UNICODE 0x00004000
#define SEE_MASK_NO_CONSOLE 0x00008000
#define SEE_MASK_ASYNCOK 0x00100000
#define SEE_MASK_HMONITOR 0x00200000
typedef struct _SHELLEXECUTEINFOA
{ DWORD cbSize;
ULONG fMask;
HWND32 hwnd;
LPCSTR lpVerb;
LPCSTR lpFile;
LPCSTR lpParameters;
LPCSTR lpDirectory;
int nShow;
HINSTANCE32 hInstApp;
/* Optional fields */
LPVOID lpIDList;
LPCSTR lpClass;
HKEY hkeyClass;
DWORD dwHotKey;
union
{ HANDLE32 hIcon;
HANDLE32 hMonitor;
} u;
HANDLE32 hProcess;
} SHELLEXECUTEINFOA, *LPSHELLEXECUTEINFOA;
typedef struct _SHELLEXECUTEINFOW
{ DWORD cbSize;
ULONG fMask;
HWND32 hwnd;
LPCWSTR lpVerb;
LPCWSTR lpFile;
LPCWSTR lpParameters;
LPCWSTR lpDirectory;
int nShow;
HINSTANCE32 hInstApp;
/* Optional fields*/
LPVOID lpIDList;
LPCWSTR lpClass;
HKEY hkeyClass;
DWORD dwHotKey;
union
{ HANDLE32 hIcon;
HANDLE32 hMonitor;
} u;
HANDLE32 hProcess;
} SHELLEXECUTEINFOW, *LPSHELLEXECUTEINFOW;
DECL_WINELIB_TYPE_AW(SHELLEXECUTEINFO)
typedef SHELLEXECUTEINFOA SHELLEXECUTEINFO;
typedef LPSHELLEXECUTEINFOA LPSHELLEXECUTEINFO;
BOOL32 WINAPI ShellExecuteEx32A(LPSHELLEXECUTEINFOA lpExecInfo);
BOOL32 WINAPI ShellExecuteEx32W(LPSHELLEXECUTEINFOW lpExecInfo);
#define ShellExecuteEx WINELIB_NAME_AW(ShellExecuteEx)
void WINAPI WinExecErrorA(HWND32 hwnd, int error, LPCSTR lpstrFileName, LPCSTR lpstrTitle);
void WINAPI WinExecErrorW(HWND32 hwnd, int error, LPCWSTR lpstrFileName, LPCWSTR lpstrTitle);
#define WinExecError WINELIB_NAME_AW(WinExecError)
/****************************************************************************
* SHBrowseForFolder API
*/
typedef int (CALLBACK* BFFCALLBACK)(HWND32 hwnd, UINT32 uMsg, LPARAM lParam, LPARAM lpData);
typedef struct tagBROWSEINFO32A {
@ -585,8 +924,9 @@ LPITEMIDLIST WINAPI SHBrowseForFolder32A(LPBROWSEINFO32A lpbi);
#define SHBrowseForFolder WINELIB_NAME_AW(SHBrowseForFolder)
/****************************************************************************
* shlview structures
*/
* shlview structures
*/
/*
* IShellFolderViewCallback Callback
* This "callback" is called by the shells default IShellView implementation (that
@ -619,6 +959,29 @@ typedef struct _SHELLVIEWDATA // idl
DWORD viewmode; // NF_* enum
} SHELLVIEWDATA, * LPSHELLVIEWDATA;
/*
The shell keeps track of some per-user state to handle display
options that is of major interest to ISVs.
The key one requested right now is "DoubleClickInWebView".
*/
typedef struct
{ BOOL32 fShowAllObjects : 1;
BOOL32 fShowExtensions : 1;
BOOL32 fNoConfirmRecycle : 1;
BOOL32 fShowSysFiles : 1;
BOOL32 fShowCompColor : 1;
BOOL32 fDoubleClickInWebView : 1;
BOOL32 fDesktopHTML : 1;
BOOL32 fWin95Classic : 1;
BOOL32 fDontPrettyPath : 1;
BOOL32 fShowAttribCol : 1;
BOOL32 fMapNetDrvBtn : 1;
BOOL32 fShowInfoTip : 1;
BOOL32 fHideIcons : 1;
UINT32 fRestFlags : 3;
} SHELLFLAGSTATE, * LPSHELLFLAGSTATE;
#undef PURE
#undef FAR
#undef THIS

View File

@ -217,10 +217,10 @@ typedef struct _CONTEXT /* Note 1 */
#define FL_sig(context) (*(WORD*)&EFL_sig(context))
#ifdef FS_sig
extern WORD CALLTO16_Current_fs;
#include "syslevel.h"
#define HANDLER_INIT() \
SET_FS(IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT)) ? \
FS_sig(HANDLER_CONTEXT) : CALLTO16_Current_fs)
FS_sig(HANDLER_CONTEXT) : SYSLEVEL_Win16CurrentTeb)
#else
#define HANDLER_INIT() /* nothing */
#endif

View File

@ -10,6 +10,8 @@
#include "wintypes.h"
#include "winbase.h"
extern WORD SYSLEVEL_Win16CurrentTeb;
void SYSLEVEL_Init(void);
VOID SYSLEVEL_EnterWin16Lock(VOID);
VOID SYSLEVEL_LeaveWin16Lock(VOID);

View File

@ -147,6 +147,7 @@ extern THHOOK *pThhook;
extern HTASK16 TASK_Create( struct _THDB *thdb, struct _NE_MODULE *pModule,
HINSTANCE16 hInstance, HINSTANCE16 hPrevInstance,
UINT16 cmdShow );
extern void TASK_StartTask( HTASK16 hTask );
extern void TASK_KillCurrentTask( INT16 exitCode );
extern HTASK16 TASK_GetNextTask( HTASK16 hTask );
extern void TASK_Reschedule(void);

View File

@ -44,6 +44,7 @@ typedef struct
BOOL32 wait_all; /* Wait for all objects flag */
BOOL32 wait_msg; /* Wait for message flag */
K32OBJ *objs[MAXIMUM_WAIT_OBJECTS]; /* Object pointers */
int server[MAXIMUM_WAIT_OBJECTS]; /* Server handles */
} WAIT_STRUCT;
/* Thread database */
@ -128,6 +129,7 @@ extern THDB *THREAD_Create( struct _PDB32 *pdb, DWORD stack_size,
int *server_thandle, int *server_phandle,
LPTHREAD_START_ROUTINE start_addr, LPVOID param );
extern THDB *THREAD_Current(void);
extern BOOL32 THREAD_IsWin16( THDB *thdb );
extern void THREAD_Start( THDB *thdb );
extern THDB *THREAD_GetPtr( HANDLE32 handle, DWORD access, int *server_handle );
extern void THREAD_AddQueue( THREAD_QUEUE *queue, THDB *thread );

View File

@ -32,17 +32,18 @@ typedef struct tagTOOLBAR_INFO
INT32 nBitmapHeight;
INT32 nBitmapWidth;
INT32 nIndent;
INT32 nMaxRows; /* maximum number of rows */
INT32 nMaxRows; /* maximum number of button rows */
INT32 nMaxTextRows; /* maximum number of text rows */
INT32 cxMin; /* minimum button width */
INT32 cxMax; /* maximum button width */
INT32 nNumButtons; /* number of buttons */
INT32 nNumBitmaps; /* number of bitmaps */
INT32 nNumStrings; /* number of strings */
BOOL32 bCaptured;
BOOL32 bUnicode; /* ASCII (FALSE) or Unicode (TRUE)? */
BOOL32 bCaptured; /* mouse captured? */
INT32 nButtonDown;
INT32 nOldHit;
INT32 nHotItem; /* index of the "hot" item */
HFONT32 hFont; /* text font */
HIMAGELIST himlDef; /* default image list */
HIMAGELIST himlHot; /* hot image list */
@ -50,12 +51,13 @@ typedef struct tagTOOLBAR_INFO
HWND32 hwndToolTip; /* handle to tool tip control */
HWND32 hwndNotify; /* handle to the window that gets notifications */
BOOL32 bTransparent; /* background transparency flag */
BOOL32 bAutoSize;
BOOL32 bAutoSize; /* auto size deadlock indicator */
DWORD dwExStyle; /* extended toolbar style */
SIZE32 maxSize; /* maximum toolbar size */
COLORREF clrInsertMark; /* insert mark color */
TBUTTON_INFO *buttons;
TBUTTON_INFO *buttons; /* pointer to button array */
CHAR **strings;
} TOOLBAR_INFO;

View File

@ -8,6 +8,14 @@
#define __WINE_TOOLTIPS_H
typedef struct tagTT_SUBCLASS_INFO
{
WNDPROC32 wpOrigProc;
HWND32 hwndToolTip;
UINT32 uRefCount;
} TT_SUBCLASS_INFO, *LPTT_SUBCLASS_INFO;
typedef struct tagTTTOOL_INFO
{
UINT32 uFlags;
@ -17,8 +25,6 @@ typedef struct tagTTTOOL_INFO
HINSTANCE32 hinst;
LPSTR lpszText;
LPARAM lParam;
WNDPROC32 lpfnOrigProc;
} TTTOOL_INFO;

View File

@ -11,8 +11,8 @@
#include "wintypes.h"
int TWEAK_Init();
int TWEAK_CheckConfiguration();
int TWEAK_Init(void);
int TWEAK_CheckConfiguration(void);
void TWEAK_DrawReliefRect95(HDC32, RECT32 const *);
void TWEAK_DrawRevReliefRect95(HDC32, RECT32 const *);
void TWEAK_DrawMenuSeparatorHoriz95(HDC32, UINT32, UINT32, UINT32);

View File

@ -1 +1 @@
#define WINE_RELEASE_INFO "Wine release 980809"
#define WINE_RELEASE_INFO "Wine release 980822"

View File

@ -7,6 +7,7 @@
#define WAIT_OBJECT_0 0
#define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0
#define WAIT_ABANDONED_0 STATUS_ABANDONED_WAIT_0
#define WAIT_IO_COMPLETION STATUS_USER_APC
#define WAIT_TIMEOUT STATUS_TIMEOUT
#define PAGE_NOACCESS 0x01
@ -189,6 +190,7 @@ void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
void WINAPI LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
HANDLE32 WINAPI OpenProcess(DWORD access, BOOL32 inherit, DWORD id);
void WINAPI RaiseException(DWORD,DWORD,DWORD,const LPDWORD);
int WINAPI TerminateProcess(HANDLE32 h, int ret);
BOOL32 WINAPI TerminateProcess(HANDLE32,DWORD);
BOOL32 WINAPI TerminateThread(HANDLE32,DWORD);
#endif /* __WINE_WINBASE_H */

View File

@ -1073,6 +1073,10 @@ typedef DWORD COLORREF;
#define CTLCOLOR_SCROLLBAR 5
#define CTLCOLOR_STATIC 6
#define ICM_OFF 1
#define ICM_ON 2
#define ICM_QUERY 3
/* Bitmaps */
typedef struct
@ -2165,6 +2169,7 @@ typedef struct
BYTE pad0;
WORD key;
WORD cmd;
WORD pad1;
} ACCEL32, *LPACCEL32;
DECL_WINELIB_TYPE(ACCEL)
@ -3178,6 +3183,7 @@ typedef struct
#define WM_MDICASCADE 0x0227
#define WM_MDIICONARRANGE 0x0228
#define WM_MDIGETACTIVE 0x0229
#define WM_MDIREFRESHMENU 0x0234
/* D&D messages */
#define WM_DROPOBJECT 0x022A
@ -5282,6 +5288,27 @@ typedef struct {
#define TIME_ZONE_ID_STANDARD 1
#define TIME_ZONE_ID_DAYLIGHT 2
/* CreateProcess: dwCreationFlag values
*/
#define DEBUG_PROCESS 0x00000001
#define DEBUG_ONLY_THIS_PROCESS 0x00000002
#define CREATE_SUSPENDED 0x00000004
#define DETACHED_PROCESS 0x00000008
#define CREATE_NEW_CONSOLE 0x00000010
#define NORMAL_PRIORITY_CLASS 0x00000020
#define IDLE_PRIORITY_CLASS 0x00000040
#define HIGH_PRIORITY_CLASS 0x00000080
#define REALTIME_PRIORITY_CLASS 0x00000100
#define CREATE_NEW_PROCESS_GROUP 0x00000200
#define CREATE_UNICODE_ENVIRONMENT 0x00000400
#define CREATE_SEPARATE_WOW_VDM 0x00000800
#define CREATE_SHARED_WOW_VDM 0x00001000
#define CREATE_DEFAULT_ERROR_MODE 0x04000000
#define CREATE_NO_WINDOW 0x08000000
#define PROFILE_USER 0x10000000
#define PROFILE_KERNEL 0x20000000
#define PROFILE_SERVER 0x40000000
/* File object type definitions
*/
@ -6312,6 +6339,7 @@ INT16 WINAPI GetCommError(INT16,LPCOMSTAT);
UINT16 WINAPI GetCommEventMask(INT16,UINT16);
HBRUSH16 WINAPI GetControlBrush(HWND16,HDC16,UINT16);
VOID WINAPI GetCodeInfo(FARPROC16,LPVOID);
HFONT16 WINAPI GetCurLogFont(HDC16);
HANDLE16 WINAPI GetCurrentPDB(void);
DWORD WINAPI GetCurrentPosition(HDC16);
HTASK16 WINAPI GetCurrentTask(void);
@ -6336,6 +6364,7 @@ FARPROC16 WINAPI GetMouseEventProc(void);
UINT16 WINAPI GetNumTasks(void);
DWORD WINAPI GetSelectorBase(WORD);
DWORD WINAPI GetSelectorLimit(WORD);
FARPROC16 WINAPI GetSetKernelDOSProc(FARPROC16 DosProc);
HINSTANCE16 WINAPI GetTaskDS(void);
HQUEUE16 WINAPI GetTaskQueue(HTASK16);
BYTE WINAPI GetTempDrive(BYTE);
@ -6375,6 +6404,7 @@ WORD WINAPI LocalHandleDelta(WORD);
WORD WINAPI LocalHeapSize(void);
HICON16 WINAPI LoadIconHandler(HGLOBAL16,BOOL16);
BOOL16 WINAPI LocalInit(HANDLE16,WORD,WORD);
HMODULE32 WINAPI LoadLibraryEx32W16(LPCSTR,HANDLE16,DWORD);
FARPROC16 WINAPI LocalNotify(FARPROC16);
HTASK16 WINAPI LockCurrentTask(BOOL16);
HMENU16 WINAPI LookupMenuHandle(HMENU16,INT16);
@ -6467,6 +6497,13 @@ HICON32 WINAPI CreateIconIndirect(LPICONINFO);
HANDLE32 WINAPI CreateMutex32A(LPSECURITY_ATTRIBUTES,BOOL32,LPCSTR);
HANDLE32 WINAPI CreateMutex32W(LPSECURITY_ATTRIBUTES,BOOL32,LPCWSTR);
#define CreateMutex WINELIB_NAME_AW(CreateMutex)
BOOL32 WINAPI CreateProcess32A(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,
LPSECURITY_ATTRIBUTES,BOOL32,DWORD,LPVOID,LPCSTR,
LPSTARTUPINFO32A,LPPROCESS_INFORMATION);
BOOL32 WINAPI CreateProcess32W(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTES,
LPSECURITY_ATTRIBUTES,BOOL32,DWORD,LPVOID,LPCWSTR,
LPSTARTUPINFO32W,LPPROCESS_INFORMATION);
#define CreateProcess WINELIB_NAME_AW(CreateProcess)
HANDLE32 WINAPI CreateSemaphore32A(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCSTR);
HANDLE32 WINAPI CreateSemaphore32W(LPSECURITY_ATTRIBUTES,LONG,LONG,LPCWSTR);
#define CreateSemaphore WINELIB_NAME_AW(CreateSemaphore)
@ -6508,12 +6545,19 @@ DWORD WINAPI ExpandEnvironmentStrings32A(LPCSTR,LPSTR,DWORD);
DWORD WINAPI ExpandEnvironmentStrings32W(LPCWSTR,LPWSTR,DWORD);
#define ExpandEnvironmentStrings WINELIB_NAME_AW(ExpandEnvironmentStrings)
HRGN32 WINAPI ExtCreateRegion(LPXFORM,DWORD,LPRGNDATA);
INT32 WINAPI ExtEscape32(HDC32,INT32,INT32,LPCSTR,INT32,LPSTR);
BOOL32 WINAPI FileTimeToDosDateTime(const FILETIME*,LPWORD,LPWORD);
BOOL32 WINAPI FileTimeToLocalFileTime(const FILETIME*,LPFILETIME);
BOOL32 WINAPI FileTimeToSystemTime(const FILETIME*,LPSYSTEMTIME);
HANDLE32 WINAPI FindFirstChangeNotification32A(LPCSTR,BOOL32,DWORD);
HANDLE32 WINAPI FindFirstChangeNotification32W(LPCWSTR,BOOL32,DWORD);
#define FindFirstChangeNotification WINELIB_NAME_AW(FindFirstChangeNotification)
BOOL32 WINAPI FindNextChangeNotification(HANDLE32);
BOOL32 WINAPI FindCloseChangeNotification(HANDLE32);
HRSRC32 WINAPI FindResourceEx32A(HMODULE32,LPCSTR,LPCSTR,WORD);
HRSRC32 WINAPI FindResourceEx32W(HMODULE32,LPCWSTR,LPCWSTR,WORD);
#define FindResourceEx WINELIB_NAME_AW(FindResourceEx)
BOOL32 WINAPI FixBrushOrgEx(HDC32,INT32,INT32,LPPOINT32);
BOOL32 WINAPI FlushConsoleInputBuffer(HANDLE32);
BOOL32 WINAPI FlushFileBuffers(HFILE32);
BOOL32 WINAPI FlushViewOfFile(LPCVOID, DWORD);
@ -6525,16 +6569,16 @@ BOOL32 WINAPI FreeEnvironmentStrings32A(LPSTR);
BOOL32 WINAPI FreeEnvironmentStrings32W(LPWSTR);
#define FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
UINT32 WINAPI GetACP(void);
LPCSTR WINAPI GetCommandLine32A();
LPCWSTR WINAPI GetCommandLine32W();
LPCSTR WINAPI GetCommandLine32A(void);
LPCWSTR WINAPI GetCommandLine32W(void);
#define GetCommandLine WINELIB_NAME_AW(GetCommandLine)
BOOL32 WINAPI GetCommTimeouts(INT32,LPCOMMTIMEOUTS);
BOOL32 WINAPI GetComputerName32A(LPSTR,LPDWORD);
BOOL32 WINAPI GetComputerName32W(LPWSTR,LPDWORD);
#define GetComputerName WINELIB_NAME_AW(GetComputerName)
UINT32 WINAPI GetConsoleCP();
UINT32 WINAPI GetConsoleCP(void);
BOOL32 WINAPI GetConsoleMode(HANDLE32,LPDWORD);
UINT32 WINAPI GetConsoleOutputCP();
UINT32 WINAPI GetConsoleOutputCP(void);
DWORD WINAPI GetConsoleTitle32A(LPSTR,DWORD);
DWORD WINAPI GetConsoleTitle32W(LPWSTR,DWORD);
#define GetConsoleTitle WINELIB_NAME_AW(GetConsoleTitle)
@ -6580,6 +6624,8 @@ DWORD WINAPI GetLogicalDrives(void);
DWORD WINAPI GetLongPathName32A(LPCSTR,LPSTR,DWORD);
DWORD WINAPI GetLongPathName32W(LPCWSTR,LPWSTR,DWORD);
#define GetLongPathName WINELIB_NAME_AW(GetLongPathName)
UINT32 WINAPI GetMenuDefaultItem32(HMENU32,UINT32,UINT32);
#define GetMenuDefaultItem WINELIB_NAME(GetMenuDefaultItem)
BOOL32 WINAPI GetMenuItemInfo32A(HMENU32,UINT32,BOOL32,MENUITEMINFO32A*);
BOOL32 WINAPI GetMenuItemInfo32W(HMENU32,UINT32,BOOL32,MENUITEMINFO32W*);
#define GetMenuItemInfo WINELIB_NAME_AW(GetMenuItemInfo)
@ -6589,9 +6635,6 @@ BOOL32 WINAPI GetNumberOfConsoleMouseButtons(LPDWORD);
DWORD WINAPI GetObjectType(HANDLE32);
UINT32 WINAPI GetOEMCP(void);
DWORD WINAPI GetPriorityClass(HANDLE32);
INT32 WINAPI GetPrivateProfileSection32A(LPCSTR,LPSTR,UINT32,LPCSTR);
INT32 WINAPI GetPrivateProfileSection32W(LPCWSTR,LPWSTR,UINT32,LPCWSTR);
#define GetPrivateProfileSection WINELIB_NAME_AW(GetPrivateProfileSection)
HANDLE32 WINAPI GetProcessHeap(void);
DWORD WINAPI GetRegionData(HRGN32,DWORD,LPRGNDATA);
DWORD WINAPI GetShortPathName32A(LPCSTR,LPSTR,DWORD);
@ -6613,7 +6656,7 @@ BOOL32 WINAPI GetTextExtentExPoint32W(HDC32,LPCWSTR,INT32,INT32,
INT32 WINAPI GetTimeFormat32A(LCID,DWORD,LPSYSTEMTIME,LPCSTR,LPSTR,INT32);
INT32 WINAPI GetTimeFormat32W(LCID,DWORD,LPSYSTEMTIME,LPCWSTR,LPWSTR,INT32);
#define GetTimeFormat WINELIB_NAME_AW(GetTimeFormat)
LCID WINAPI GetThreadLocale();
LCID WINAPI GetThreadLocale(void);
INT32 WINAPI GetThreadPriority(HANDLE32);
BOOL32 WINAPI GetThreadSelectorEntry(HANDLE32,DWORD,LPLDT_ENTRY);
BOOL32 WINAPI GetUserName32A(LPSTR,LPDWORD);
@ -6645,6 +6688,8 @@ BOOL32 WINAPI LockFile(HFILE32,DWORD,DWORD,DWORD,DWORD);
BOOL32 WINAPI LookupPrivilegeValue32A(LPCSTR,LPCSTR,LPVOID);
BOOL32 WINAPI LookupPrivilegeValue32W(LPCWSTR,LPCWSTR,LPVOID);
#define LookupPrivilegeValue WINELIB_NAME_AW(LookupPrivilegeValue)
HMODULE32 WINAPI MapHModuleSL(HMODULE16);
HMODULE16 WINAPI MapHModuleLS(HMODULE32);
SEGPTR WINAPI MapLS(LPVOID);
LPVOID WINAPI MapSL(SEGPTR);
LPVOID WINAPI MapViewOfFile(HANDLE32,DWORD,DWORD,DWORD,DWORD);
@ -6682,8 +6727,10 @@ HANDLE32 WINAPI OpenSemaphore32W(DWORD,BOOL32,LPCWSTR);
HANDLE32 WINAPI OpenService32A(HANDLE32,LPCSTR,DWORD);
HANDLE32 WINAPI OpenService32W(HANDLE32,LPCWSTR,DWORD);
#define OpenService WINELIB_NAME_AW(OpenService)
BOOL32 WINAPI PaintDesktop(HDC32);
BOOL32 WINAPI PlayEnhMetaFile(HDC32,HENHMETAFILE32,const RECT32*);
BOOL32 WINAPI PlayEnhMetaFileRecord(HDC32,LPHANDLETABLE32,const ENHMETARECORD*,UINT32);
BOOL32 WINAPI PolyPolyline32(HDC32,LPPOINT32,LPDWORD,DWORD);
BOOL32 WINAPI PulseEvent(HANDLE32);
DWORD WINAPI QueryDosDevice32A(LPCSTR,LPSTR,DWORD);
DWORD WINAPI QueryDosDevice32W(LPCWSTR,LPWSTR,DWORD);
@ -6775,6 +6822,8 @@ BOOL32 WINAPI SetFileTime(HFILE32,const FILETIME*,const FILETIME*,
INT32 WINAPI SetGraphicsMode(HDC32,INT32);
BOOL32 WINAPI SetHandleInformation(HANDLE32,DWORD,DWORD);
VOID WINAPI SetLastErrorEx(DWORD,DWORD);
BOOL32 WINAPI SetMenuDefaultItem32(HMENU32,UINT32,UINT32);
#define SetMenuDefaultItem WINELIB_NAME(SetMenuDefaultItem)
BOOL32 WINAPI SetMenuItemInfo32A(HMENU32,UINT32,BOOL32,const MENUITEMINFO32A*);
BOOL32 WINAPI SetMenuItemInfo32W(HMENU32,UINT32,BOOL32,const MENUITEMINFO32W*);
#define SetMenuItemInfo WINELIB_NAME_AW(SetMenuItemInfo)
@ -6802,6 +6851,7 @@ DWORD WINAPI TlsAlloc(void);
BOOL32 WINAPI TlsFree(DWORD);
LPVOID WINAPI TlsGetValue(DWORD);
BOOL32 WINAPI TlsSetValue(DWORD,LPVOID);
BOOL32 WINAPI TranslateCharsetInfo(LPDWORD,LPCHARSETINFO,DWORD);
VOID WINAPI UnMapLS(SEGPTR);
BOOL32 WINAPI UnlockFile(HFILE32,DWORD,DWORD,DWORD,DWORD);
BOOL32 WINAPI UnmapViewOfFile(LPVOID);
@ -6862,6 +6912,7 @@ LANGID WINAPI GetUserDefaultLangID(void);
LCID WINAPI GetUserDefaultLCID(void);
ATOM WINAPI GlobalDeleteAtom(ATOM);
VOID WINAPI LZDone(void);
VOID WINAPI ScreenSwitchEnable(WORD);
DWORD WINAPI OemKeyScan(WORD);
DWORD WINAPI RegCloseKey(HKEY);
DWORD WINAPI RegFlushKey(HKEY);
@ -7023,6 +7074,9 @@ DWORD WINAPI CheckMenuItem32(HMENU32,UINT32,UINT32);
BOOL16 WINAPI CheckMenuRadioButton16(HMENU16,UINT16,UINT16,UINT16,BOOL16);
BOOL32 WINAPI CheckMenuRadioButton32(HMENU32,UINT32,UINT32,UINT32,BOOL32);
#define CheckMenuRadioButton WINELIB_NAME(CheckMenuRadioButton)
BOOL16 WINAPI CheckMenuRadioItem16(HMENU16,UINT16,UINT16,UINT16,UINT16);
BOOL32 WINAPI CheckMenuRadioItem32(HMENU32,UINT32,UINT32,UINT32,UINT32);
#define CheckMenuRadioItem WINELIB_NAME(CheckMenuRadioItem)
BOOL16 WINAPI CheckRadioButton16(HWND16,UINT16,UINT16,UINT16);
BOOL32 WINAPI CheckRadioButton32(HWND32,UINT32,UINT32,UINT32);
#define CheckRadioButton WINELIB_NAME(CheckRadioButton)
@ -7067,6 +7121,9 @@ HCURSOR16 WINAPI CopyCursor16(HINSTANCE16,HCURSOR16);
HICON16 WINAPI CopyIcon16(HINSTANCE16,HICON16);
HICON32 WINAPI CopyIcon32(HICON32);
#define CopyIcon WINELIB_NAME(CopyIcon)
HICON16 WINAPI CopyImage16(HANDLE16,UINT16,INT16,INT16,UINT16);
HICON32 WINAPI CopyImage32(HANDLE32,UINT32,INT32,INT32,UINT32);
#define CopyImage WINELIB_NAME(CopyImage)
LONG WINAPI CopyLZFile16(HFILE16,HFILE16);
LONG WINAPI CopyLZFile32(HFILE32,HFILE32);
#define CopyLZFile WINELIB_NAME(CopyLZFile)
@ -7377,6 +7434,10 @@ BOOL32 WINAPI DrawIconEx32(HDC32,INT32,INT32,HICON32,INT32,INT32,
VOID WINAPI DrawMenuBar16(HWND16);
BOOL32 WINAPI DrawMenuBar32(HWND32);
#define DrawMenuBar WINELIB_NAME(DrawMenuBar)
BOOL16 WINAPI DrawState16A(HDC16,HBRUSH16,DRAWSTATEPROC16,LPARAM,WPARAM16,INT16,INT16,INT16,INT16,UINT16);
BOOL32 WINAPI DrawState32A(HDC32,HBRUSH32,DRAWSTATEPROC32,LPARAM,WPARAM32,INT32,INT32,INT32,INT32,UINT32);
BOOL32 WINAPI DrawState32W(HDC32,HBRUSH32,DRAWSTATEPROC32,LPARAM,WPARAM32,INT32,INT32,INT32,INT32,UINT32);
#define DrawState WINELIB_NAME_AW(DrawState)
INT16 WINAPI DrawText16(HDC16,LPCSTR,INT16,LPRECT16,UINT16);
INT32 WINAPI DrawText32A(HDC32,LPCSTR,INT32,LPRECT32,UINT32);
INT32 WINAPI DrawText32W(HDC32,LPCWSTR,INT32,LPRECT32,UINT32);
@ -7572,6 +7633,9 @@ UINT16 WINAPI GetAtomName16(ATOM,LPSTR,INT16);
UINT32 WINAPI GetAtomName32A(ATOM,LPSTR,INT32);
UINT32 WINAPI GetAtomName32W(ATOM,LPWSTR,INT32);
#define GetAtomName WINELIB_NAME_AW(GetAtomName)
BOOL16 WINAPI GetAspectRatioFilterEx16(HDC16,LPSIZE16);
BOOL32 WINAPI GetAspectRatioFilterEx32(HDC32,LPSIZE32);
#define GetAspectRatioFilterEx WINELIB_NAME(GetAspectRatioFilterEx)
LONG WINAPI GetBitmapBits16(HBITMAP16,LONG,LPVOID);
LONG WINAPI GetBitmapBits32(HBITMAP32,LONG,LPVOID);
#define GetBitmapBits WINELIB_NAME(GetBitmapBits)
@ -7600,6 +7664,9 @@ BOOL16 WINAPI GetCharABCWidths16(HDC16,UINT16,UINT16,LPABC16);
BOOL32 WINAPI GetCharABCWidths32A(HDC32,UINT32,UINT32,LPABC32);
BOOL32 WINAPI GetCharABCWidths32W(HDC32,UINT32,UINT32,LPABC32);
#define GetCharABCWidths WINELIB_NAME_AW(GetCharABCWidths)
DWORD WINAPI GetCharacterPlacement32A(HDC32,LPCSTR,INT32,INT32,GCP_RESULTS32A*,DWORD);
DWORD WINAPI GetCharacterPlacement32W(HDC32,LPCWSTR,INT32,INT32,GCP_RESULTS32W*,DWORD);
#define GetCharacterPlacement WINELIB_NAME_AW(GetCharacterPlacement)
BOOL16 WINAPI GetCharWidth16(HDC16,UINT16,UINT16,LPINT16);
BOOL32 WINAPI GetCharWidth32A(HDC32,UINT32,UINT32,LPINT32);
BOOL32 WINAPI GetCharWidth32W(HDC32,UINT32,UINT32,LPINT32);
@ -7689,6 +7756,9 @@ BOOL16 WINAPI GetDiskFreeSpace16(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
BOOL32 WINAPI GetDiskFreeSpace32A(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
BOOL32 WINAPI GetDiskFreeSpace32W(LPCWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
#define GetDiskFreeSpace WINELIB_NAME_AW(GetDiskFreeSpace)
BOOL32 WINAPI GetDiskFreeSpaceEx32A(LPCSTR,LPULARGE_INTEGER,LPULARGE_INTEGER,LPULARGE_INTEGER);
BOOL32 WINAPI GetDiskFreeSpaceEx32W(LPCWSTR,LPULARGE_INTEGER,LPULARGE_INTEGER,LPULARGE_INTEGER);
#define GetDiskFreeSpaceEx WINELIB_NAME_AW(GetDiskFreeSpaceEx)
INT16 WINAPI GetDlgCtrlID16(HWND16);
INT32 WINAPI GetDlgCtrlID32(HWND32);
#define GetDlgCtrlID WINELIB_NAME(GetDlgCtrlID)
@ -7728,6 +7798,11 @@ DWORD WINAPI GetFileVersionInfo32W(LPCWSTR,DWORD,DWORD,LPVOID);
HWND16 WINAPI GetFocus16(void);
HWND32 WINAPI GetFocus32(void);
#define GetFocus WINELIB_NAME(GetFocus)
DWORD WINAPI GetFontData32(HDC32,DWORD,DWORD,LPVOID,DWORD);
#define GetFontData WINELIB_NAME(GetFontData)
DWORD WINAPI GetFontLanguageInfo16(HDC16);
DWORD WINAPI GetFontLanguageInfo32(HDC32);
#define GetFontLanguageInfo WINELIB_NAME(GetFontLanguageInfo)
HWND16 WINAPI GetForegroundWindow16(void);
HWND32 WINAPI GetForegroundWindow32(void);
#define GetForegroundWindow WINELIB_NAME(GetForegroundWindow)
@ -7831,6 +7906,11 @@ INT32 WINAPI GetObject32W(HANDLE32,INT32,LPVOID);
HWND16 WINAPI GetOpenClipboardWindow16(void);
HWND32 WINAPI GetOpenClipboardWindow32(void);
#define GetOpenClipboardWindow WINELIB_NAME(GetOpenClipboardWindow)
/* FIXME: LPVOID should be LPOUTLINETEXTMETRIC{16,32A,32W} */
UINT16 WINAPI GetOutlineTextMetrics16(HDC16,UINT16,LPVOID);
UINT32 WINAPI GetOutlineTextMetrics32A(HDC32,UINT32,LPVOID);
UINT32 WINAPI GetOutlineTextMetrics32W(HDC32,UINT32,LPVOID);
#define GetOutlineTextMetrics WINELIB_NAME_AW(GetOutlineTextMetrics)
UINT16 WINAPI GetPaletteEntries16(HPALETTE16,UINT16,UINT16,LPPALETTEENTRY);
UINT32 WINAPI GetPaletteEntries32(HPALETTE32,UINT32,UINT32,LPPALETTEENTRY);
#define GetPaletteEntries WINELIB_NAME(GetPaletteEntries)
@ -7854,10 +7934,22 @@ UINT16 WINAPI GetPrivateProfileInt16(LPCSTR,LPCSTR,INT16,LPCSTR);
UINT32 WINAPI GetPrivateProfileInt32A(LPCSTR,LPCSTR,INT32,LPCSTR);
UINT32 WINAPI GetPrivateProfileInt32W(LPCWSTR,LPCWSTR,INT32,LPCWSTR);
#define GetPrivateProfileInt WINELIB_NAME_AW(GetPrivateProfileInt)
INT16 WINAPI GetPrivateProfileSection16(LPCSTR,LPSTR,UINT16,LPCSTR);
INT32 WINAPI GetPrivateProfileSection32A(LPCSTR,LPSTR,DWORD,LPCSTR);
INT32 WINAPI GetPrivateProfileSection32W(LPCWSTR,LPWSTR,DWORD,LPCWSTR);
#define GetPrivateProfileSection WINELIB_NAME_AW(GetPrivateProfileSection)
WORD WINAPI GetPrivateProfileSectionNames16(LPSTR,UINT16,LPCSTR);
DWORD WINAPI GetPrivateProfileSectionNames32A(LPSTR,DWORD,LPCSTR);
DWORD WINAPI GetPrivateProfileSectionNames32W(LPWSTR,DWORD,LPCWSTR);
#define GetPrivateProfileSectionNames WINELIB_NAME_AW(GetPrivateProfileSectionNames)
INT16 WINAPI GetPrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT16,LPCSTR);
INT32 WINAPI GetPrivateProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT32,LPCSTR);
INT32 WINAPI GetPrivateProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT32,LPCWSTR);
#define GetPrivateProfileString WINELIB_NAME_AW(GetPrivateProfileString)
BOOL16 WINAPI GetPrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR);
BOOL32 WINAPI GetPrivateProfileStruct32A(LPCSTR,LPCSTR,LPVOID,UINT32,LPCSTR);
BOOL32 WINAPI GetPrivateProfileStruct32W(LPCWSTR,LPCWSTR,LPVOID,UINT32,LPCWSTR);
#define GetPrivateProfileStruct WINELIB_NAME_AW(GetPrivateProfileStruct)
FARPROC16 WINAPI GetProcAddress16(HMODULE16,SEGPTR);
FARPROC32 WINAPI GetProcAddress32(HMODULE32,LPCSTR);
#define GetProcAddress WINELIB_NAME(GetProcAddress)
@ -7866,6 +7958,9 @@ UINT32 WINAPI GetProfileInt32A(LPCSTR,LPCSTR,INT32);
UINT32 WINAPI GetProfileInt32W(LPCWSTR,LPCWSTR,INT32);
#define GetProfileInt WINELIB_NAME_AW(GetProfileInt)
INT16 WINAPI GetProfileString16(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT16);
INT32 WINAPI GetProfileSection32A(LPCSTR,LPSTR,DWORD);
INT32 WINAPI GetProfileSection32W(LPCWSTR,LPWSTR,DWORD);
#define GetProfileSection WINELIB_NAME_AW(GetProfileSection)
INT32 WINAPI GetProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPSTR,UINT32);
INT32 WINAPI GetProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,UINT32);
#define GetProfileString WINELIB_NAME_AW(GetProfileString)
@ -8033,6 +8128,9 @@ BOOL32 WINAPI GetWindowPlacement32(HWND32,LPWINDOWPLACEMENT32);
void WINAPI GetWindowRect16(HWND16,LPRECT16);
void WINAPI GetWindowRect32(HWND32,LPRECT32);
#define GetWindowRect WINELIB_NAME(GetWindowRect)
INT16 WINAPI GetWindowRgn16(HWND16,HRGN16);
INT32 WINAPI GetWindowRgn32(HWND32,HRGN32);
#define GetWindowRgn WINELIB_NAME(GetWindowRgn)
UINT16 WINAPI GetWindowsDirectory16(LPSTR,UINT16);
UINT32 WINAPI GetWindowsDirectory32A(LPSTR,UINT32);
UINT32 WINAPI GetWindowsDirectory32W(LPWSTR,UINT32);
@ -8283,7 +8381,7 @@ HMENU32 WINAPI LoadMenuIndirect32A(LPCVOID);
HMENU32 WINAPI LoadMenuIndirect32W(LPCVOID);
#define LoadMenuIndirect WINELIB_NAME_AW(LoadMenuIndirect)
HINSTANCE16 WINAPI LoadModule16(LPCSTR,LPVOID);
DWORD WINAPI LoadModule32(LPCSTR,LPVOID);
HINSTANCE32 WINAPI LoadModule32(LPCSTR,LPVOID);
#define LoadModule WINELIB_NAME(LoadModule)
HGLOBAL16 WINAPI LoadResource16(HINSTANCE16,HRSRC16);
HGLOBAL32 WINAPI LoadResource32(HMODULE32,HRSRC32);
@ -8546,6 +8644,9 @@ UINT16 WINAPI RegisterClipboardFormat16(LPCSTR);
UINT32 WINAPI RegisterClipboardFormat32A(LPCSTR);
UINT32 WINAPI RegisterClipboardFormat32W(LPCWSTR);
#define RegisterClipboardFormat WINELIB_NAME_AW(RegisterClipboardFormat)
HRESULT WINAPI RegisterDragDrop16(HWND16,LPVOID);
HRESULT WINAPI RegisterDragDrop32(HWND32,LPVOID);
#define RegisterDragDrop WINELIB_NAME(RegisterDragDrop)
WORD WINAPI RegisterWindowMessage16(SEGPTR);
WORD WINAPI RegisterWindowMessage32A(LPCSTR);
WORD WINAPI RegisterWindowMessage32W(LPCWSTR);
@ -8782,6 +8883,7 @@ HWND32 WINAPI SetParent32(HWND32,HWND32);
COLORREF WINAPI SetPixel16(HDC16,INT16,INT16,COLORREF);
COLORREF WINAPI SetPixel32(HDC32,INT32,INT32,COLORREF);
#define SetPixel WINELIB_NAME(SetPixel)
BOOL32 WINAPI SetPixelV32(HDC32,INT32,INT32,COLORREF);
BOOL32 WINAPI SetPixelFormat(HDC32,int,PIXELFORMATDESCRIPTOR*);
INT16 WINAPI SetPolyFillMode16(HDC16,INT16);
INT32 WINAPI SetPolyFillMode32(HDC32,INT32);
@ -8901,6 +9003,9 @@ HHOOK WINAPI SetWindowsHookEx32W(INT32,HOOKPROC32,HINSTANCE32,DWORD);
BOOL16 WINAPI SetWindowPos16(HWND16,HWND16,INT16,INT16,INT16,INT16,WORD);
BOOL32 WINAPI SetWindowPos32(HWND32,HWND32,INT32,INT32,INT32,INT32,WORD);
#define SetWindowPos WINELIB_NAME(SetWindowPos)
INT16 WINAPI SetWindowRgn16(HWND16,HRGN16,BOOL16);
INT32 WINAPI SetWindowRgn32(HWND32,HRGN32,BOOL32);
#define SetWindowRgn WINELIB_NAME(SetWindowRgn)
void WINAPI SetWindowText16(HWND16,SEGPTR);
void WINAPI SetWindowText32A(HWND32,LPCSTR);
void WINAPI SetWindowText32W(HWND32,LPCWSTR);
@ -9057,10 +9162,18 @@ HWND32 WINAPI WindowFromDC32(HDC32);
HWND16 WINAPI WindowFromPoint16(POINT16);
HWND32 WINAPI WindowFromPoint32(POINT32);
#define WindowFromPoint WINELIB_NAME(WindowFromPoint)
BOOL16 WINAPI WritePrivateProfileSection16(LPCSTR,LPCSTR,LPCSTR);
BOOL32 WINAPI WritePrivateProfileSection32A(LPCSTR,LPCSTR,LPCSTR);
BOOL32 WINAPI WritePrivateProfileSection32W(LPCWSTR,LPCWSTR,LPCWSTR);
#define WritePrivateProfileSection WINELIB_NAME_AW(WritePrivateProfileSection)
BOOL16 WINAPI WritePrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL32 WINAPI WritePrivateProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL32 WINAPI WritePrivateProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
#define WritePrivateProfileString WINELIB_NAME_AW(WritePrivateProfileString)
BOOL16 WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR);
BOOL32 WINAPI WritePrivateProfileStruct32A(LPCSTR,LPCSTR,LPVOID,UINT32,LPCSTR);
BOOL32 WINAPI WritePrivateProfileStruct32W(LPCWSTR,LPCWSTR,LPVOID,UINT32,LPCWSTR);
#define WritePrivateProfileStruct WINELIB_NAME_AW(WritePrivateProfileStruct)
BOOL16 WINAPI WriteProfileString16(LPCSTR,LPCSTR,LPCSTR);
BOOL32 WINAPI WriteProfileString32A(LPCSTR,LPCSTR,LPCSTR);
BOOL32 WINAPI WriteProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR);
@ -9154,9 +9267,11 @@ HPEN16 WINAPI GetSysColorPen16(INT16);
HPEN32 WINAPI GetSysColorPen32(INT32);
INT32 WINAPI LoadMessage32A(HMODULE32,UINT32,WORD,LPSTR,INT32);
INT32 WINAPI LoadMessage32W(HMODULE32,UINT32,WORD,LPWSTR,INT32);
UINT32 WINAPI WIN16_GetTempDrive(BYTE);
SEGPTR WINAPI WIN16_GlobalLock16(HGLOBAL16);
SEGPTR WINAPI WIN16_LockResource16(HGLOBAL16);
LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);
UINT16 WINAPI WIN16_lread(HFILE16,SEGPTR,UINT16);
INT32 WINAPI lstrncmp32A(LPCSTR,LPCSTR,INT32);
INT32 WINAPI lstrncmp32W(LPCWSTR,LPCWSTR,INT32);
INT32 WINAPI lstrncmpi32A(LPCSTR,LPCSTR,INT32);

View File

@ -22,6 +22,9 @@ extern int WIN32_LastError;
*/
#define ERROR_UNKNOWN 99999
#define SEVERITY_SUCCESS 0
#define SEVERITY_ERROR 1
#define ERROR_SUCCESS 0
#define ERROR_FILE_NOT_FOUND 2
#define ERROR_PATH_NOT_FOUND 3

View File

@ -135,6 +135,7 @@ typedef void* SEGPTR;
DECLARE_HANDLE(HACCEL);
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(HCOLORSPACE);
DECLARE_HANDLE(HCURSOR);
DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HDROP);
@ -243,6 +244,7 @@ DECL_WINELIB_TYPE(HACCEL)
DECL_WINELIB_TYPE(HANDLE)
DECL_WINELIB_TYPE(HBITMAP)
DECL_WINELIB_TYPE(HBRUSH)
DECL_WINELIB_TYPE(HCOLORSPACE)
DECL_WINELIB_TYPE(HCURSOR)
DECL_WINELIB_TYPE(HDC)
DECL_WINELIB_TYPE(HDROP)

View File

@ -98,7 +98,7 @@ extern BOOL32 X11DRV_Polygon( struct tagDC *dc, LPPOINT32 pt, INT32 count );
extern BOOL32 X11DRV_PolyPolygon( struct tagDC *dc, LPPOINT32 pt,
LPINT32 counts, UINT32 polygons);
extern BOOL32 X11DRV_PolyPolyline( struct tagDC *dc, LPPOINT32 pt,
LPINT32 counts, UINT32 polylines);
LPDWORD counts, DWORD polylines);
extern HGDIOBJ32 X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ32 handle );

View File

@ -9,7 +9,9 @@ C_SRCS = \
module.c \
dosvm.c
all: $(MODULE).o dosmod
PROGRAMS = dosmod
all: $(MODULE).o $(PROGRAMS)
dosmod: dosmod.c
$(CC) $(ALLCFLAGS) -o dosmod $<

View File

@ -6,18 +6,26 @@
#ifdef linux
/* force dosmod at high addresses */
/* apparently ELF images are usually loaded high anyway */
#ifndef __ELF__
/* if not, force dosmod at high addresses */
asm(".org 0x110000");
#endif __ELF__
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/vm86.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
/* FIXME: hack because libc vm86 may be the old syscall version */
static __inline__ int vm86plus( int func, struct vm86plus_struct *ptr )
@ -50,16 +58,37 @@ int main(int argc,char**argv)
void*img;
struct vm86plus_struct VM86;
int func,ret;
off_t fofs=0;
pid_t ppid=getppid();
/* fprintf(stderr,"main is at %08lx, file is %s, fd=%d\n",(unsigned long)&main,argv[0],mfd); */
if (mfd<0) return 1;
/* Map in our DOS image at the start of the process address space */
img=mmap(NULL,0x110000,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_FIXED|MAP_SHARED,mfd,0);
if (argv[1]) {
/* Ulrich Weigand suggested mapping in the DOS image directly from the Wine
address space */
fofs=atol(argv[1]);
/* linux currently only allows mapping a process memory if it's being ptraced */
/* Linus doesn't like it, so this probably won't work in the future */
/* it doesn't even work for me right now */
ptrace(PTRACE_ATTACH,ppid,0,0);
kill(ppid,SIGSTOP);
waitpid(ppid,NULL,0);
}
img=mmap(NULL,0x110000,PROT_EXEC|PROT_READ|PROT_WRITE,MAP_FIXED|MAP_SHARED,mfd,fofs);
if (argv[1]) {
ptrace(PTRACE_DETACH,ppid,0,0);
kill(ppid,SIGCONT);
}
if (img==(void*)-1) {
fprintf(stderr,"DOS memory map failed, error=%s\n",strerror(errno));
fprintf(stderr,"in attempt to map %s, offset %08lX, length 110000, to offset 0\n",argv[0],fofs);
return 1;
}
/* fprintf(stderr,"Successfully mapped DOS memory, entering vm86 loop\n"); */
/* report back to the main program that we're ready */
ret=0;
write(1,&ret,sizeof(ret));
/* context exchange loop */
do {
if (read(0,&func,sizeof(func))!=sizeof(func)) return 1;

View File

@ -2,6 +2,8 @@
* DOS Virtual Machine
*
* Copyright 1998 Ove Kåven
*
* This code hasn't been completely cleaned up yet.
*/
#ifdef linux
@ -17,14 +19,16 @@
#include <sys/stat.h>
#include "windows.h"
#include "winbase.h"
#include "winnt.h"
#include "msdos.h"
#include "miscemu.h"
#include "debug.h"
#include "module.h"
#include "task.h"
#include "ldt.h"
#include "dosexe.h"
void DOSVM_Dump( LPDOSTASK lpDosTask)
static void DOSVM_Dump( LPDOSTASK lpDosTask)
{
unsigned iofs;
BYTE*inst;
@ -48,6 +52,7 @@ void DOSVM_Dump( LPDOSTASK lpDosTask)
fprintf(stderr,"AX=%04lX CX=%04lX DX=%04lX BX=%04lX\n",REGS.eax,REGS.ebx,REGS.ecx,REGS.edx);
fprintf(stderr,"SI=%04lX DI=%04lX SP=%04lX BP=%04lX\n",REGS.esi,REGS.edi,REGS.esp,REGS.ebp);
fprintf(stderr,"CS=%04X DS=%04X ES=%04X SS=%04X\n",REGS.cs,REGS.ds,REGS.es,REGS.ss);
fprintf(stderr,"EIP=%04lX EFLAGS=%08lX\n",REGS.eip,REGS.eflags);
iofs=((DWORD)REGS.cs<<4)+REGS.eip;
#undef REGS
@ -59,8 +64,10 @@ void DOSVM_Dump( LPDOSTASK lpDosTask)
exit(0);
}
int DOSVM_Int(int vect, LPDOSTASK lpDosTask, PCONTEXT context )
static int DOSVM_Int(int vect, LPDOSTASK lpDosTask, PCONTEXT context )
{
/* we should really map to if1632/wprocs.spec, but not all
interrupt handlers are adapted to support our VM yet */
switch (vect) {
case 0x20:
return -1;
@ -68,21 +75,30 @@ int DOSVM_Int(int vect, LPDOSTASK lpDosTask, PCONTEXT context )
if (AH_reg(context)==0x4c) return -1;
DOS3Call(context);
break;
case 0x1a:
INT_Int1aHandler(context);
break;
case 0x2f:
INT_Int2fHandler(context);
break;
}
return 0;
}
#define CV CP(eax,Eax); CP(ecx,Ecx); CP(edx,Edx); CP(ebx,Ebx); \
CP(esi,Esi); CP(edi,Edi); CP(esp,Esp); CP(ebp,Ebp); \
CP(cs,SegCs); CP(ds,SegDs); CP(es,SegEs); \
CP(ss,SegSs); CP(fs,SegFs); CP(gs,SegGs); \
CP(eip,Eip); CP(eflags,EFlags)
int DOSVM_Process( LPDOSTASK lpDosTask )
{
CONTEXT context;
int ret=0;
#define REGS lpDosTask->VM86.regs
context.Eax=REGS.eax; context.Ecx=REGS.ecx; context.Edx=REGS.edx; context.Ebx=REGS.ebx;
context.Esi=REGS.esi; context.Edi=REGS.edi; context.Esp=REGS.esp; context.Ebp=REGS.ebp;
context.SegCs=REGS.cs; context.SegDs=REGS.ds; context.SegEs=REGS.es;
context.SegSs=REGS.ss; context.SegFs=REGS.fs; context.SegGs=REGS.gs;
context.Eip=REGS.eip; context.EFlags=REGS.eflags;
#define CP(x,y) context.y = lpDosTask->VM86.regs.x
CV;
#undef CP
(void*)V86BASE(&context)=lpDosTask->img;
switch (VM86_TYPE(lpDosTask->fn)) {
@ -106,13 +122,67 @@ int DOSVM_Process( LPDOSTASK lpDosTask )
}
lpDosTask->fn=VM86_ENTER;
REGS.eax=context.Eax; REGS.ecx=context.Ecx; REGS.edx=context.Edx; REGS.ebx=context.Ebx;
REGS.esi=context.Esi; REGS.edi=context.Edi; REGS.esp=context.Esp; REGS.ebp=context.Ebp;
REGS.cs=context.SegCs; REGS.ds=context.SegDs; REGS.es=context.SegEs;
REGS.ss=context.SegSs; REGS.fs=context.SegFs; REGS.gs=context.SegGs;
REGS.eip=context.Eip; REGS.eflags=context.EFlags;
#undef REGS
#define CP(x,y) lpDosTask->VM86.regs.x = context.y
CV;
#undef CP
return ret;
}
int DOSVM_Enter( PCONTEXT context )
{
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
NE_MODULE *pModule = NE_GetPtr( pTask->hModule );
LPDOSTASK lpDosTask;
int stat;
GlobalUnlock16( GetCurrentTask() );
if (!pModule) {
ERR(module,"No task is currently active!\n");
return -1;
}
if (!pModule->lpDosTask) {
/* no VM86 (dosmod) task is currently running, start one */
if ((lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL)
return 0;
lpDosTask->img=DOSMEM_MemoryBase(pModule->self);
lpDosTask->hModule=pModule->self;
stat=MZ_InitTask(lpDosTask);
if (stat<32) {
free(lpDosTask);
return -1;
}
pModule->lpDosTask = lpDosTask;
pModule->dos_image = lpDosTask->img;
/* Note: we're leaving it running after this, in case we need it again,
as this minimizes the overhead of starting it up every time...
it will be killed automatically when the current task terminates */
} else lpDosTask=pModule->lpDosTask;
if (context) {
#define CP(x,y) lpDosTask->VM86.regs.x = context->y
CV;
#undef CP
}
/* main loop */
while ((stat = MZ_RunModule(lpDosTask)) >= 0)
if (stat > 0 && DOSVM_Process(lpDosTask) < 0)
break;
if (context) {
#define CP(x,y) context->y = lpDosTask->VM86.regs.x
CV;
#undef CP
}
return 0;
}
#else /* !linux */
int DOSVM_Enter( PCONTEXT context )
{
ERR(module,"DOS realmode not supported on this architecture!\n");
return -1;
}
#endif /* linux */

View File

@ -2,6 +2,8 @@
* DOS (MZ) loader
*
* Copyright 1998 Ove Kåven
*
* This code hasn't been completely cleaned up yet.
*/
#ifdef linux
@ -15,16 +17,8 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef MZ_USESYSV
#include <sys/ipc.h>
#include <sys/shm.h>
#else
#include <sys/mman.h>
#endif
#include <sys/vm86.h>
#ifdef MZ_USESYSV
#include <linux/mm.h> /* FIXME: where else should I fetch the PAGE_SIZE define? */
#endif
#include "windows.h"
#include "winbase.h"
#include "module.h"
@ -35,15 +29,14 @@
#include "debug.h"
#include "dosexe.h"
/* define this to try mapping through /proc/pid/mem instead of a temp file,
but Linus doesn't like mmapping /proc/pid/mem, so it doesn't work for me */
#undef MZ_MAPSELF
#define BIOS_DATA_SEGMENT 0x40
#define BIOS_SEGMENT BIOSSEG /* BIOSSEG is defined to 0xf000 in sys/vm86.h */
#define STUB_SEGMENT BIOS_SEGMENT
#ifdef MZ_USESYSV
/* it might be that SYSV supports START_OFFSET 0 after all, haven't checked */
#define START_OFFSET PAGE_SIZE
#else
#define START_OFFSET 0
#endif
#define PSP_SIZE 0x10
#define SEG16(ptr,seg) ((LPVOID)((BYTE*)ptr+((DWORD)(seg)<<4)))
@ -80,7 +73,10 @@ static void MZ_InitPSP( LPVOID lpPSP, LPCSTR cmdline, LPCSTR env )
psp->nextParagraph=0x9FFF;
/* copy parameters */
if (cmd) {
#if 0
/* command.com doesn't do this */
while (*cmd == ' ') cmd++;
#endif
psp->cmdLine[0]=strlen(cmd);
strcpy(psp->cmdLine+1,cmd);
psp->cmdLine[psp->cmdLine[0]+1]='\r';
@ -89,11 +85,11 @@ static void MZ_InitPSP( LPVOID lpPSP, LPCSTR cmdline, LPCSTR env )
/* FIXME: integrate the PDB stuff from Wine (loader/task.c) */
}
static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, LPDOSTASK lpDosTask )
static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env,
LPDOSTASK lpDosTask, NE_MODULE *pModule )
{
IMAGE_DOS_HEADER mz_header;
DWORD image_start,image_size,min_size,max_size,avail;
WORD psp_seg,load_seg;
BYTE*psp_start,*load_start;
int x;
SEGPTR reloc;
@ -111,10 +107,10 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, LPDOSTASK lp
/* allocate 1MB+64K shared memory */
lpDosTask->img_ofs=START_OFFSET;
#ifdef MZ_USESYSV
lpDosTask->key=ftok(".",'d'); /* FIXME: this is from my IPC intro doc */
lpDosTask->shm_id=shmget(lpDosTask->key,0x110000-START_OFFSET,IPC_CREAT|SHM_R|SHM_W);
lpDosTask->img=shmat(lpDosTask->shm_id,NULL,0);
#ifdef MZ_MAPSELF
lpDosTask->img=VirtualAlloc(NULL,0x110000,MEM_COMMIT,PAGE_READWRITE);
/* make sure mmap accepts it */
((char*)lpDosTask->img)[0x10FFFF]=0;
#else
tmpnam(lpDosTask->mm_name);
/* strcpy(lpDosTask->mm_name,"/tmp/mydosimage"); */
@ -131,6 +127,7 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, LPDOSTASK lp
return 0;
}
TRACE(module,"DOS VM86 image mapped at %08lx\n",(DWORD)lpDosTask->img);
pModule->dos_image=lpDosTask->img;
/* initialize the memory */
MZ_InitSystem(lpDosTask->img);
@ -147,12 +144,12 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, LPDOSTASK lp
return 0;
}
if (avail>max_size) avail=max_size;
psp_start=DOSMEM_GetBlock(lpDosTask->hModule,avail,&psp_seg);
psp_start=DOSMEM_GetBlock(lpDosTask->hModule,avail,&lpDosTask->psp_seg);
if (!psp_start) {
ERR(module, "error allocating DOS memory\n");
return 0;
}
load_seg=psp_seg+PSP_SIZE;
lpDosTask->load_seg=lpDosTask->psp_seg+PSP_SIZE;
load_start=psp_start+(PSP_SIZE<<4);
MZ_InitPSP(psp_start, cmdline, env);
@ -169,26 +166,27 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, LPDOSTASK lp
for (x=0; x<mz_header.e_crlc; x++) {
if (_lread16(hFile,&reloc,sizeof(reloc)) != sizeof(reloc))
return 11; /* invalid exe */
*(WORD*)SEGPTR16(load_start,reloc)+=load_seg;
*(WORD*)SEGPTR16(load_start,reloc)+=lpDosTask->load_seg;
}
/* initialize vm86 struct */
memset(&lpDosTask->VM86,0,sizeof(lpDosTask->VM86));
lpDosTask->VM86.regs.cs=load_seg+mz_header.e_cs;
lpDosTask->VM86.regs.cs=lpDosTask->load_seg+mz_header.e_cs;
lpDosTask->VM86.regs.eip=mz_header.e_ip;
lpDosTask->VM86.regs.ss=load_seg+mz_header.e_ss;
lpDosTask->VM86.regs.ss=lpDosTask->load_seg+mz_header.e_ss;
lpDosTask->VM86.regs.esp=mz_header.e_sp;
lpDosTask->VM86.regs.ds=psp_seg;
lpDosTask->VM86.regs.es=psp_seg;
lpDosTask->VM86.regs.ds=lpDosTask->psp_seg;
lpDosTask->VM86.regs.es=lpDosTask->psp_seg;
/* hmm, what else do we need? */
return 32;
}
static int MZ_InitTask( LPDOSTASK lpDosTask )
int MZ_InitTask( LPDOSTASK lpDosTask )
{
int read_fd[2],write_fd[2];
pid_t child;
char *fname,*farg,arg[16],fproc[64];
/* create read pipe */
if (pipe(read_fd)<0) return 0;
@ -199,15 +197,36 @@ static int MZ_InitTask( LPDOSTASK lpDosTask )
lpDosTask->write_pipe=write_fd[1];
lpDosTask->fn=VM86_ENTER;
lpDosTask->state=1;
TRACE(module,"Preparing to load DOS EXE support module: forking\n");
/* if we have a mapping file, use it */
fname=lpDosTask->mm_name; farg=NULL;
if (!fname[0]) {
/* otherwise, map our own memory image */
sprintf(fproc,"/proc/%d/mem",getpid());
sprintf(arg,"%ld",(unsigned long)lpDosTask->img);
fname=fproc; farg=arg;
}
TRACE(module,"Preparing to load DOS VM support module: forking\n");
if ((child=fork())<0) {
close(write_fd[0]); close(write_fd[1]);
close(read_fd[0]); close(read_fd[1]); return 0;
}
if (child!=0) {
/* parent process */
int ret;
close(read_fd[1]); close(write_fd[0]);
lpDosTask->task=child;
/* wait for child process to signal readiness */
do {
if (read(lpDosTask->read_pipe,&ret,sizeof(ret))!=sizeof(ret)) {
if ((errno==EINTR)||(errno==EAGAIN)) continue;
/* failure */
ERR(module,"dosmod has failed to initialize\n");
return 0;
}
} while (0);
/* all systems are now go */
} else {
/* child process */
close(read_fd[0]); close(write_fd[1]);
@ -215,9 +234,9 @@ static int MZ_InitTask( LPDOSTASK lpDosTask )
dup2(write_fd[0],0); /* stdin */
dup2(read_fd[1],1); /* stdout */
/* now load dosmod */
execlp("dosmod",lpDosTask->mm_name,NULL);
execl("dosmod",lpDosTask->mm_name,NULL);
execl("loader/dos/dosmod",lpDosTask->mm_name,NULL);
execlp("dosmod",fname,farg,NULL);
execl("dosmod",fname,farg,NULL);
execl("loader/dos/dosmod",fname,farg,NULL);
/* if failure, exit */
ERR(module,"Failed to spawn dosmod, error=%s\n",strerror(errno));
exit(1);
@ -225,8 +244,8 @@ static int MZ_InitTask( LPDOSTASK lpDosTask )
return 32;
}
HINSTANCE16 MZ_LoadModule( LPCSTR name, LPCSTR cmdline,
LPCSTR env, UINT16 show_cmd )
HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env,
LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info )
{
LPDOSTASK lpDosTask;
HMODULE16 hModule;
@ -234,7 +253,6 @@ HINSTANCE16 MZ_LoadModule( LPCSTR name, LPCSTR cmdline,
NE_MODULE *pModule;
HFILE16 hFile;
OFSTRUCT ofs;
PROCESS_INFORMATION info;
int err;
if ((lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL)
@ -252,29 +270,41 @@ HINSTANCE16 MZ_LoadModule( LPCSTR name, LPCSTR cmdline,
pModule->lpDosTask = lpDosTask;
lpDosTask->img=NULL; lpDosTask->mm_name[0]=0; lpDosTask->mm_fd=-1;
err = MZ_LoadImage( hFile, cmdline, env, lpDosTask );
err = MZ_LoadImage( hFile, cmdline, env, lpDosTask, pModule );
_lclose16(hFile);
pModule->dos_image = lpDosTask->img;
if (err<32) {
if (lpDosTask->img!=NULL) munmap(lpDosTask->img,0x110000-START_OFFSET);
if (lpDosTask->mm_fd>=0) close(lpDosTask->mm_fd);
if (lpDosTask->mm_name[0]!=0) unlink(lpDosTask->mm_name);
if (lpDosTask->mm_name[0]!=0) {
if (lpDosTask->img!=NULL) munmap(lpDosTask->img,0x110000-START_OFFSET);
if (lpDosTask->mm_fd>=0) close(lpDosTask->mm_fd);
unlink(lpDosTask->mm_name);
} else
if (lpDosTask->img!=NULL) VirtualFree(lpDosTask->img,0x110000,MEM_RELEASE);
return err;
}
err = MZ_InitTask( lpDosTask );
if (lpDosTask->mm_name[0]!=0) {
/* we unlink the temp file here to avoid leaving a mess in /tmp
if/when Wine crashes; the mapping still remains open, though */
unlink(lpDosTask->mm_name);
}
if (err<32) {
MZ_KillModule( lpDosTask );
/* FIXME: cleanup hModule */
return err;
}
MZ_InitTask( lpDosTask );
hInstance = NE_CreateInstance(pModule, NULL, (cmdline == NULL));
PROCESS_Create( pModule, cmdline, env, hInstance, 0, show_cmd, &info );
/* we don't need the handles for now */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
PROCESS_Create( pModule, cmdline, env, hInstance, 0, startup, info );
return hInstance;
}
void MZ_KillModule( LPDOSTASK lpDosTask )
{
munmap(lpDosTask->img,0x110000-START_OFFSET);
close(lpDosTask->mm_fd);
unlink(lpDosTask->mm_name);
if (lpDosTask->mm_name[0]!=0) {
munmap(lpDosTask->img,0x110000-START_OFFSET);
close(lpDosTask->mm_fd);
} else VirtualFree(lpDosTask->img,0x110000,MEM_RELEASE);
close(lpDosTask->read_pipe);
close(lpDosTask->write_pipe);
kill(lpDosTask->task,SIGTERM);
@ -310,4 +340,13 @@ int MZ_RunModule( LPDOSTASK lpDosTask )
return 0;
}
#endif /* linux */
#else /* !linux */
HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env,
LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info )
{
WARN(module,"DOS executables not supported on this architecture\n");
return (HMODULE16)11; /* invalid exe */
}
#endif

View File

@ -11,6 +11,7 @@
#include <sys/types.h>
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
#include "class.h"
#include "file.h"
#include "global.h"
@ -284,16 +285,11 @@ HMODULE32 MODULE_FindModule32(
/**********************************************************************
* MODULE_Load
*
* Implementation of LoadModule().
*
* cmd_line must contain the whole command-line, including argv[0] (and
* without a preceding length byte).
* If cmd_line is NULL, the module is loaded as a library even if it is a .exe
* NE_CreateProcess
*/
HINSTANCE16 MODULE_Load( LPCSTR name, BOOL32 implicit,
LPCSTR cmd_line, LPCSTR env, UINT32 show_cmd )
static HINSTANCE16 NE_CreateProcess( LPCSTR name, LPCSTR cmd_line, LPCSTR env,
LPSTARTUPINFO32A startup,
LPPROCESS_INFORMATION info )
{
HMODULE16 hModule;
HINSTANCE16 hInstance, hPrevInstance;
@ -305,38 +301,24 @@ HINSTANCE16 MODULE_Load( LPCSTR name, BOOL32 implicit,
lstrcpyn32A( ofs.szPathName, name, sizeof(ofs.szPathName) );
if ((hModule = MODULE_CreateDummyModule( &ofs )) < 32) return hModule;
pModule = (NE_MODULE *)GlobalLock16( hModule );
hInstance = NE_CreateInstance( pModule, &hPrevInstance,
(cmd_line == NULL) );
hInstance = NE_CreateInstance( pModule, &hPrevInstance, FALSE );
}
else
{
hInstance = NE_LoadModule( name, &hPrevInstance, implicit,
(cmd_line == NULL) );
if ((hInstance == 21) && cmd_line)
return PE_LoadModule( name, cmd_line, env, show_cmd );
#ifdef linux
if (hInstance == 11)
return MZ_LoadModule(name, cmd_line, env, show_cmd );
#endif
hInstance = NE_LoadModule( name, &hPrevInstance, FALSE, FALSE );
pModule = hInstance >= 32 ? NE_GetPtr( hInstance ) : NULL;
}
/* Create a task for this instance */
if (hInstance < 32) return hInstance;
pModule = NE_GetPtr( hInstance );
if (cmd_line && !(pModule->flags & NE_FFLAGS_LIBMODULE))
if (pModule && !(pModule->flags & NE_FFLAGS_LIBMODULE))
{
PDB32 *pdb;
PROCESS_INFORMATION info;
pModule->flags |= NE_FFLAGS_GUI;
pdb = PROCESS_Create( pModule, cmd_line, env, hInstance,
hPrevInstance, show_cmd, &info );
/* we don't need the handles for now */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
if (pdb && (GetNumTasks() > 1)) Yield16();
hPrevInstance, startup, info );
}
return hInstance;
@ -349,77 +331,239 @@ HINSTANCE16 MODULE_Load( LPCSTR name, BOOL32 implicit,
HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
{
LOADPARAMS *params;
LPSTR cmd_line, new_cmd_line;
UINT16 show_cmd = 0;
LPCVOID env = NULL;
LOADPARAMS32 params32;
HINSTANCE16 hInstance;
LPSTR cmd_line;
if (!paramBlock || (paramBlock == (LPVOID)-1))
return LoadLibrary16( name );
/* Transfer arguments to 32-bit param-block */
params = (LOADPARAMS *)paramBlock;
cmd_line = (LPSTR)PTR_SEG_TO_LIN( params->cmdLine );
/* PowerPoint passes NULL as showCmd */
if (params->showCmd)
show_cmd = *((UINT16 *)PTR_SEG_TO_LIN(params->showCmd)+1);
memset( &params32, '\0', sizeof(params32) );
cmd_line = (LPSTR)PTR_SEG_TO_LIN( params->cmdLine );
if (!cmd_line) cmd_line = "";
else if (*cmd_line) cmd_line++; /* skip the length byte */
if (!(new_cmd_line = HeapAlloc( GetProcessHeap(), 0,
strlen(cmd_line) + strlen(name) + 2 )))
if (!(params32.lpCmdLine = HeapAlloc( GetProcessHeap(), 0,
strlen(cmd_line)+strlen(name)+2 )))
return 0;
strcpy( new_cmd_line, name );
strcat( new_cmd_line, " " );
strcat( new_cmd_line, cmd_line );
strcpy( params32.lpCmdLine, name );
strcat( params32.lpCmdLine, " " );
strcat( params32.lpCmdLine, cmd_line );
if (params->hEnvironment) env = GlobalLock16( params->hEnvironment );
hInstance = MODULE_Load( name, FALSE, new_cmd_line, env, show_cmd );
if (params->hEnvironment)
params32.lpEnvAddress = GlobalLock16( params->hEnvironment );
if (params->showCmd)
params32.lpCmdShow = PTR_SEG_TO_LIN( params->showCmd );
/* Call LoadModule32 */
hInstance = LoadModule32( name, &params32 );
/* Clean up */
if (params->hEnvironment) GlobalUnlock16( params->hEnvironment );
HeapFree( GetProcessHeap(), 0, new_cmd_line );
HeapFree( GetProcessHeap(), 0, params32.lpCmdLine );
return hInstance;
}
/**********************************************************************
* LoadModule32 (KERNEL32.499)
*
* FIXME
*
* This should get implemented via CreateProcess -- MODULE_Load
* is resolutely 16-bit.
*/
DWORD WINAPI LoadModule32( LPCSTR name, LPVOID paramBlock )
HINSTANCE32 WINAPI LoadModule32( LPCSTR name, LPVOID paramBlock )
{
LOADPARAMS32 *params = (LOADPARAMS32 *)paramBlock;
#if 0
STARTUPINFO st;
PROCESSINFORMATION pi;
st.cb = sizeof(STARTUPINFO);
st.wShowWindow = p->lpCmdShow[2] ; WRONG
PROCESS_INFORMATION info;
STARTUPINFO32A startup;
HINSTANCE32 hInstance;
PDB32 *pdb;
TDB *tdb;
BOOL32 ret = CreateProcess32A( name, p->lpCmdLine,
NULL, NULL, FALSE, 0, p->lpEnvAddress,
NULL, &st, &pi);
if (!ret) {
/* handle errors appropriately */
}
CloseHandle32(pi.hProcess);
CloseHandle32(pi.hThread);
memset( &startup, '\0', sizeof(startup) );
startup.cb = sizeof(startup);
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = params->lpCmdShow? params->lpCmdShow[1] : 0;
#else
return MODULE_Load( name, FALSE, params->lpCmdLine, params->lpEnvAddress,
*((UINT16 *)params->lpCmdShow + 1) );
#endif
if (!CreateProcess32A( name, params->lpCmdLine,
NULL, NULL, FALSE, 0, params->lpEnvAddress,
NULL, &startup, &info ))
return GetLastError(); /* guaranteed to be < 32 */
/* Get hInstance from process */
pdb = PROCESS_IdToPDB( info.dwProcessId );
tdb = pdb? (TDB *)GlobalLock16( pdb->task ) : NULL;
hInstance = tdb? tdb->hInstance : 0;
/* Close off the handles */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
return hInstance;
}
/**********************************************************************
* CreateProcess32A (KERNEL32.171)
*/
BOOL32 WINAPI CreateProcess32A( LPCSTR lpApplicationName, LPSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL32 bInheritHandles, DWORD dwCreationFlags,
LPVOID lpEnvironment, LPCSTR lpCurrentDirectory,
LPSTARTUPINFO32A lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInfo )
{
HINSTANCE16 hInstance;
LPCSTR cmdline;
PDB32 *pdb;
char name[256];
/* Get name and command line */
if (!lpApplicationName && !lpCommandLine)
{
SetLastError( ERROR_FILE_NOT_FOUND );
return FALSE;
}
cmdline = lpCommandLine? lpCommandLine : lpApplicationName;
if (lpApplicationName)
lstrcpyn32A(name, lpApplicationName, sizeof(name) - 4);
else
{
char *ptr = strchr(lpCommandLine, ' ');
int len = (ptr? ptr-lpCommandLine : strlen(lpCommandLine)) + 1;
if (len > sizeof(name) - 4) len = sizeof(name) - 4;
lstrcpyn32A(name, lpCommandLine, len);
}
if (!strchr(name, '\\') && !strchr(name, '.'))
strcat(name, ".exe");
/* Warn if unsupported features are used */
if (lpProcessAttributes)
FIXME(module, "(%s,...): lpProcessAttributes ignored\n", name);
if (lpThreadAttributes)
FIXME(module, "(%s,...): lpThreadAttributes ignored\n", name);
if (bInheritHandles)
FIXME(module, "(%s,...): bInheritHandles ignored\n", name);
if (dwCreationFlags & DEBUG_PROCESS)
FIXME(module, "(%s,...): DEBUG_PROCESS ignored\n", name);
if (dwCreationFlags & DEBUG_ONLY_THIS_PROCESS)
FIXME(module, "(%s,...): DEBUG_ONLY_THIS_PROCESS ignored\n", name);
if (dwCreationFlags & CREATE_SUSPENDED)
FIXME(module, "(%s,...): CREATE_SUSPENDED ignored\n", name);
if (dwCreationFlags & DETACHED_PROCESS)
FIXME(module, "(%s,...): DETACHED_PROCESS ignored\n", name);
if (dwCreationFlags & CREATE_NEW_CONSOLE)
FIXME(module, "(%s,...): CREATE_NEW_CONSOLE ignored\n", name);
if (dwCreationFlags & NORMAL_PRIORITY_CLASS)
FIXME(module, "(%s,...): NORMAL_PRIORITY_CLASS ignored\n", name);
if (dwCreationFlags & IDLE_PRIORITY_CLASS)
FIXME(module, "(%s,...): IDLE_PRIORITY_CLASS ignored\n", name);
if (dwCreationFlags & HIGH_PRIORITY_CLASS)
FIXME(module, "(%s,...): HIGH_PRIORITY_CLASS ignored\n", name);
if (dwCreationFlags & REALTIME_PRIORITY_CLASS)
FIXME(module, "(%s,...): REALTIME_PRIORITY_CLASS ignored\n", name);
if (dwCreationFlags & CREATE_NEW_PROCESS_GROUP)
FIXME(module, "(%s,...): CREATE_NEW_PROCESS_GROUP ignored\n", name);
if (dwCreationFlags & CREATE_UNICODE_ENVIRONMENT)
FIXME(module, "(%s,...): CREATE_UNICODE_ENVIRONMENT ignored\n", name);
if (dwCreationFlags & CREATE_SEPARATE_WOW_VDM)
FIXME(module, "(%s,...): CREATE_SEPARATE_WOW_VDM ignored\n", name);
if (dwCreationFlags & CREATE_SHARED_WOW_VDM)
FIXME(module, "(%s,...): CREATE_SHARED_WOW_VDM ignored\n", name);
if (dwCreationFlags & CREATE_DEFAULT_ERROR_MODE)
FIXME(module, "(%s,...): CREATE_DEFAULT_ERROR_MODE ignored\n", name);
if (dwCreationFlags & CREATE_NO_WINDOW)
FIXME(module, "(%s,...): CREATE_NO_WINDOW ignored\n", name);
if (dwCreationFlags & PROFILE_USER)
FIXME(module, "(%s,...): PROFILE_USER ignored\n", name);
if (dwCreationFlags & PROFILE_KERNEL)
FIXME(module, "(%s,...): PROFILE_KERNEL ignored\n", name);
if (dwCreationFlags & PROFILE_SERVER)
FIXME(module, "(%s,...): PROFILE_SERVER ignored\n", name);
if (lpCurrentDirectory)
FIXME(module, "(%s,...): lpCurrentDirectory %s ignored\n",
name, lpCurrentDirectory);
if (lpStartupInfo->lpDesktop)
FIXME(module, "(%s,...): lpStartupInfo->lpDesktop %s ignored\n",
name, lpStartupInfo->lpDesktop);
if (lpStartupInfo->lpTitle)
FIXME(module, "(%s,...): lpStartupInfo->lpTitle %s ignored\n",
name, lpStartupInfo->lpTitle);
if (lpStartupInfo->dwFlags & STARTF_USECOUNTCHARS)
FIXME(module, "(%s,...): STARTF_USECOUNTCHARS (%ld,%ld) ignored\n",
name, lpStartupInfo->dwXCountChars, lpStartupInfo->dwYCountChars);
if (lpStartupInfo->dwFlags & STARTF_USEFILLATTRIBUTE)
FIXME(module, "(%s,...): STARTF_USEFILLATTRIBUTE %lx ignored\n",
name, lpStartupInfo->dwFillAttribute);
if (lpStartupInfo->dwFlags & STARTF_RUNFULLSCREEN)
FIXME(module, "(%s,...): STARTF_RUNFULLSCREEN ignored\n", name);
if (lpStartupInfo->dwFlags & STARTF_FORCEONFEEDBACK)
FIXME(module, "(%s,...): STARTF_FORCEONFEEDBACK ignored\n", name);
if (lpStartupInfo->dwFlags & STARTF_FORCEOFFFEEDBACK)
FIXME(module, "(%s,...): STARTF_FORCEOFFFEEDBACK ignored\n", name);
if (lpStartupInfo->dwFlags & STARTF_USEHOTKEY)
FIXME(module, "(%s,...): STARTF_USEHOTKEY ignored\n", name);
/* Try NE (or winelib) module */
hInstance = NE_CreateProcess( name, cmdline, lpEnvironment,
lpStartupInfo, lpProcessInfo );
/* Try PE module */
if (hInstance == 21)
hInstance = PE_CreateProcess( name, cmdline, lpEnvironment,
lpStartupInfo, lpProcessInfo );
/* Try DOS module */
#ifdef linux
if (hInstance == 11)
hInstance = MZ_CreateProcess( name, cmdline, lpEnvironment,
lpStartupInfo, lpProcessInfo );
#endif
if (hInstance < 32)
{
SetLastError( hInstance );
return FALSE;
}
/* Get hTask from process and start the task */
pdb = PROCESS_IdToPDB( lpProcessInfo->dwProcessId );
if (pdb) TASK_StartTask( pdb->task );
return TRUE;
}
/**********************************************************************
* CreateProcess32W (KERNEL32.172)
*/
BOOL32 WINAPI CreateProcess32W( LPCWSTR lpApplicationName, LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL32 bInheritHandles, DWORD dwCreationFlags,
LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory,
LPSTARTUPINFO32W lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInfo )
{
FIXME(win32, "(%s,%s,...): stub\n", debugstr_w(lpApplicationName),
debugstr_w(lpCommandLine));
/* make from lcc uses system as fallback if CreateProcess returns
FALSE, so return false */
return FALSE;
}
/***********************************************************************
* GetModuleHandle (KERNEL32.237)
*/
HMODULE32 WINAPI GetModuleHandle32A(LPCSTR module)
{
TRACE(win32, "%s\n", module ? module : "NULL");
if (module == NULL)
return PROCESS_Current()->exe_modref->module;
else
@ -582,10 +726,21 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
char *p, filename[256];
static int use_load_module = 1;
int spacelimit = 0, exhausted = 0;
LOADPARAMS32 params;
UINT16 paramCmdShow[2];
if (!lpCmdLine)
return 2; /* File not found */
/* Set up LOADPARAMS32 buffer for LoadModule32 */
memset( &params, '\0', sizeof(params) );
params.lpCmdLine = (LPSTR)lpCmdLine;
params.lpCmdShow = paramCmdShow;
params.lpCmdShow[0] = 2;
params.lpCmdShow[1] = nCmdShow;
/* Keep trying to load a file by trying different filenames; e.g.,
for the cmdline "abcd efg hij", try "abcd" with args "efg hij",
then "abcd efg" with arg "hij", and finally "abcd efg hij" with
@ -625,7 +780,7 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
{
/* Winelib: Use LoadModule() only for the program itself */
if (__winelib) use_load_module = 0;
handle = MODULE_Load( filename, FALSE, lpCmdLine, NULL, nCmdShow );
handle = LoadModule32( filename, &params );
if (handle == 2) /* file not found */
{
/* Check that the original file name did not have a suffix */
@ -635,8 +790,7 @@ HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
{
p = filename + strlen(filename);
strcpy( p, ".exe" );
handle = MODULE_Load( filename, FALSE, lpCmdLine,
NULL, nCmdShow );
handle = LoadModule32( filename, &params );
*p = '\0'; /* Remove extension */
}
}

View File

@ -19,6 +19,7 @@
#include "process.h"
#include "toolhelp.h"
#include "snoop.h"
#include "stackframe.h"
#include "debug.h"
FARPROC16 (*fnSNOOP16_GetProcAddress16)(HMODULE16,DWORD,FARPROC16) = NULL;
@ -744,6 +745,8 @@ HINSTANCE16 NE_LoadModule( LPCSTR name, HINSTANCE16 *hPrevInstance,
{
HINSTANCE16 prev;
pModule = NE_GetPtr( hModule );
if ( pModule->module32 ) return (HINSTANCE16)21;
hInstance = NE_CreateInstance( pModule, &prev, lib_only );
if (hInstance != prev) /* not a library */
NE_LoadSegment( pModule, pModule->dgroup );
@ -1115,3 +1118,55 @@ BOOL16 WINAPI ModuleFindHandle( MODULEENTRY *lpme, HMODULE16 hModule )
lpme->wNext = hModule;
return ModuleNext( lpme );
}
/***************************************************************************
* MapHModuleLS (KERNEL32.520)
*/
HMODULE16 WINAPI MapHModuleLS(HMODULE32 hmod) {
NE_MODULE *pModule;
if (!hmod)
return ((TDB*)GlobalLock16(GetCurrentTask()))->hInstance;
if (!HIWORD(hmod))
return hmod; /* we already have a 16 bit module handle */
pModule = (NE_MODULE*)GlobalLock16(hFirstModule);
while (pModule) {
if (pModule->module32 == hmod)
return pModule->self;
pModule = (NE_MODULE*)GlobalLock16(pModule->next);
}
return 0;
}
/***************************************************************************
* MapHModuleSL (KERNEL32.521)
*/
HMODULE32 WINAPI MapHModuleSL(HMODULE16 hmod) {
NE_MODULE *pModule;
if (!hmod) {
TDB *pTask = (TDB*)GlobalLock16(GetCurrentTask());
hmod = pTask->hInstance;
}
pModule = (NE_MODULE*)GlobalLock16(hmod);
if ( (pModule->magic!=IMAGE_OS2_SIGNATURE) ||
!(pModule->flags & NE_FFLAGS_WIN32)
)
return 0;
return pModule->module32;
}
/***************************************************************************
* MapHInstLS (KERNEL32.516)
*/
REGS_ENTRYPOINT(MapHInstLS) {
EAX_reg(context) = MapHModuleLS(EAX_reg(context));
}
/***************************************************************************
* MapHInstLS (KERNEL32.518)
*/
REGS_ENTRYPOINT(MapHInstSL) {
EAX_reg(context) = MapHModuleSL(EAX_reg(context));
}

View File

@ -374,7 +374,7 @@ HGLOBAL16 WINAPI DirectResAlloc( HINSTANCE16 hInstance, WORD wType,
*/
INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
{
HFILE32 fd;
HFILE16 fd;
NE_MODULE *pModule = NE_GetPtr( hModule );
if (!pModule || !pModule->res_table || !hRsrc) return -1;
@ -383,11 +383,11 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc )
assert( !__winelib ); /* Can't use Win16 resource functions in Winelib */
if ((fd = _lopen32( NE_MODULE_NAME(pModule), OF_READ )) != -1)
if ((fd = _lopen16( NE_MODULE_NAME(pModule), OF_READ )) != -1)
{
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
NE_NAMEINFO *pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
_llseek32( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
_llseek16( fd, (int)pNameInfo->offset << sizeShift, SEEK_SET );
}
return fd;
}

View File

@ -827,8 +827,9 @@ HMODULE32 PE_LoadLibraryEx32A (LPCSTR name, PDB32 *process,
* FIXME: this function should use PE_LoadLibraryEx32A, but currently can't
* due to the PROCESS_Create stuff.
*/
HINSTANCE16 PE_LoadModule( LPCSTR name, LPCSTR cmd_line,
LPCSTR env, UINT16 show_cmd )
HINSTANCE16 PE_CreateProcess( LPCSTR name, LPCSTR cmd_line,
LPCSTR env, LPSTARTUPINFO32A startup,
LPPROCESS_INFORMATION info )
{
HMODULE16 hModule16;
HMODULE32 hModule32;
@ -836,8 +837,8 @@ HINSTANCE16 PE_LoadModule( LPCSTR name, LPCSTR cmd_line,
NE_MODULE *pModule;
HFILE32 hFile;
OFSTRUCT ofs;
THDB *thdb = THREAD_Current();
PDB32 *process;
TDB *pTask;
WINE_MODREF *wm;
if ((hFile = OpenFile32( name, &ofs, OF_READ )) == HFILE_ERROR32)
@ -850,21 +851,13 @@ HINSTANCE16 PE_LoadModule( LPCSTR name, LPCSTR cmd_line,
pModule->module32 = hModule32 = PE_LoadImage( hFile );
if (hModule32 < 32) return 21;
hInstance = NE_CreateInstance( pModule, NULL, (cmd_line == NULL) );
if (cmd_line &&
!(PE_HEADER(hModule32)->FileHeader.Characteristics & IMAGE_FILE_DLL))
{
PROCESS_INFORMATION info;
PDB32 *pdb = PROCESS_Create( pModule, cmd_line, env,
hInstance, 0, show_cmd, &info );
TDB *pTask = (TDB *)GlobalLock16( pdb->task );
thdb = pTask->thdb;
/* we don't need the handles for now */
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
}
if (PE_HEADER(hModule32)->FileHeader.Characteristics & IMAGE_FILE_DLL)
return 11;
process = thdb->process;
hInstance = NE_CreateInstance( pModule, NULL, FALSE );
process = PROCESS_Create( pModule, cmd_line, env,
hInstance, 0, startup, info );
pTask = (TDB *)GlobalLock16( process->task );
wm=(WINE_MODREF*)HeapAlloc(process->heap,HEAP_ZERO_MEMORY,sizeof(*wm));
wm->type = MODULE32_PE;
@ -878,8 +871,10 @@ HINSTANCE16 PE_LoadModule( LPCSTR name, LPCSTR cmd_line,
return 0;
}
pModule->module32 = wm->module;
/* FIXME: Yuck. Is there no other good place to do that? */
PE_InitTls( thdb );
PE_InitTls( pTask->thdb );
return hInstance;
}
@ -916,7 +911,7 @@ static void PE_InitDLL(WINE_MODREF *wm, DWORD type,LPVOID lpReserved)
if ((PE_HEADER(wm->module)->FileHeader.Characteristics & IMAGE_FILE_DLL) &&
(PE_HEADER(wm->module)->OptionalHeader.AddressOfEntryPoint)
) {
FARPROC32 entry = (FARPROC32)RVA_PTR( wm->module,
DWORD (CALLBACK *entry)(HMODULE32,DWORD,LPVOID) = (void*)RVA_PTR( wm->module,
OptionalHeader.AddressOfEntryPoint );
TRACE(relay, "CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
entry, wm->module, type, lpReserved );

View File

@ -66,7 +66,7 @@ HANDLE32 WINAPI FindResourceEx32A( HMODULE32 hModule, LPCSTR name, LPCSTR type,
*/
HRSRC32 WINAPI FindResourceEx32W( HMODULE32 hModule, LPCWSTR name,
LPCWSTR type, WORD lang )
{
{ HRSRC32 ret;
WINE_MODREF *wm = MODULE32_LookupHMODULE(PROCESS_Current(),hModule);
HRSRC32 hrsrc;
@ -83,7 +83,10 @@ HRSRC32 WINAPI FindResourceEx32W( HMODULE32 hModule, LPCWSTR name,
if (wm) {
switch (wm->type) {
case MODULE32_PE:
return PE_FindResourceEx32W(wm,name,type,lang);
ret = PE_FindResourceEx32W(wm,name,type,lang);
if ( ret==0 )
ERR(resource,"%s not found!\n",debugres_w (name));
return ret;
default:
ERR(module,"unknown module type %d\n",wm->type);
break;
@ -229,6 +232,7 @@ HACCEL32 WINAPI LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
{
HRSRC32 hRsrc;
HACCEL32 hRetval;
DWORD size;
if (HIWORD(lpTableName))
TRACE(accel, "%p '%s'\n",
@ -244,6 +248,13 @@ HACCEL32 WINAPI LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
}
else {
hRetval = LoadResource32( instance, hRsrc );
size = SizeofResource32( instance, hRsrc );
if(size>=sizeof(ACCEL32))
{
LPACCEL32 accel_table = (LPACCEL32) hRetval;
/* mark last element as such - sometimes it is not marked in image */
accel_table[size/sizeof(ACCEL32)-1].fVirt |= 0x80;
}
}
TRACE(accel, "returning HACCEL 0x%x\n", hRsrc);

View File

@ -34,9 +34,6 @@
#include "sig_context.h"
#include "winsock.h"
/* Global variable to save %fs register while in 16-bit code */
WORD CALLTO16_Current_fs;
/* Linux sigaction function */
#if defined(linux) && defined(__i386__)

View File

@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "windows.h"
#include "user.h"
@ -55,6 +56,9 @@ static UINT16 nTaskCount = 0;
static void TASK_YieldToSystem(TDB*);
extern BOOL32 THREAD_InitDone;
/***********************************************************************
* TASK_InstallTHHook
*/
@ -78,7 +82,6 @@ HTASK16 TASK_GetNextTask( HTASK16 hTask )
return (hFirstTask != hTask) ? hFirstTask : 0;
}
/***********************************************************************
* TASK_LinkTask
*/
@ -222,8 +225,7 @@ static BOOL32 TASK_FreeThunk( HTASK16 hTask, SEGPTR thunk )
*/
static void TASK_CallToStart(void)
{
int exit_code = 1;
TDB *pTask = (TDB *)GlobalLock16( hCurrentTask );
TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
NE_MODULE *pModule = NE_GetPtr( pTask->hModule );
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
@ -237,7 +239,11 @@ static void TASK_CallToStart(void)
{
/* FIXME: all this is an ugly hack */
FARPROC32 entry = (FARPROC32)RVA_PTR( PROCESS_Current()->exe_modref->module, OptionalHeader.AddressOfEntryPoint );
LPTHREAD_START_ROUTINE entry = (LPTHREAD_START_ROUTINE)
RVA_PTR(pModule->module32, OptionalHeader.AddressOfEntryPoint);
DWORD size = PE_HEADER(pModule->module32)->OptionalHeader.SizeOfStackReserve;
DWORD id;
THDB *thdb;
pTask->userhandler = (USERSIGNALPROC)&USER_SignalProc;
if (pModule->heap_size)
@ -246,22 +252,27 @@ static void TASK_CallToStart(void)
InitApp( pTask->hModule );
PE_InitializeDLLs( PROCESS_Current(), DLL_PROCESS_ATTACH, (LPVOID)-1 );
TRACE(relay, "(entryproc=%p)\n", entry );
exit_code = entry();
TASK_KillCurrentTask( exit_code );
}
#ifdef linux
else if (pModule->lpDosTask)
{
int stat;
while ((stat = MZ_RunModule(pModule->lpDosTask)) >= 0)
if (stat > 0 && DOSVM_Process(pModule->lpDosTask) < 0)
break;
#if 1
ExitProcess( entry(NULL) );
#else
CreateThread( NULL, size, entry, NULL, 0, &id );
thdb = THREAD_ID_TO_THDB( id );
MZ_KillModule(pModule->lpDosTask);
TASK_KillCurrentTask( 0 );
}
while ( thdb->exit_code == 0x103 )
{
WaitEvent( 0 );
QUEUE_Signal( pTask->hSelf );
}
ExitProcess( thdb->exit_code );
#endif
}
else if (pModule->dos_image)
{
DOSVM_Enter( NULL );
ExitProcess( 0 );
}
else
{
/* Registers at initialization must be:
@ -295,13 +306,17 @@ static void TASK_CallToStart(void)
Callbacks->CallRegisterShortProc( &context, 0 );
/* This should never return */
ERR( task, "Main program returned! (should never happen)\n" );
TASK_KillCurrentTask( 1 );
ExitProcess( 1 );
}
}
/***********************************************************************
* TASK_Create
*
* NOTE: This routine might be called by a Win32 thread. We don't have
* any real problems with that, since we operated merely on a private
* TDB structure that is not yet linked into the task list.
*/
HTASK16 TASK_Create( THDB *thdb, NE_MODULE *pModule, HINSTANCE16 hInstance,
HINSTANCE16 hPrevInstance, UINT16 cmdShow)
@ -339,7 +354,7 @@ HTASK16 TASK_Create( THDB *thdb, NE_MODULE *pModule, HINSTANCE16 hInstance,
pTask->hInstance = hInstance;
pTask->hPrevInstance = hPrevInstance;
pTask->hModule = pModule->self;
pTask->hParent = hCurrentTask;
pTask->hParent = GetCurrentTask();
pTask->magic = TDB_MAGIC;
pTask->nCmdShow = cmdShow;
pTask->thdb = thdb;
@ -439,9 +454,6 @@ HTASK16 TASK_Create( THDB *thdb, NE_MODULE *pModule, HINSTANCE16 hInstance,
if (!THREAD_Current()->cur_stack)
THREAD_Current()->cur_stack = pTask->thdb->cur_stack;
/* Add the task to the linked list */
TASK_LinkTask( hTask );
TRACE(task, "module='%s' cmdline='%s' task=%04x\n",
name, cmd_line, hTask );
@ -449,6 +461,35 @@ HTASK16 TASK_Create( THDB *thdb, NE_MODULE *pModule, HINSTANCE16 hInstance,
return hTask;
}
/***********************************************************************
* TASK_StartTask
*
* NOTE: This routine might be called by a Win32 thread. Thus, we need
* to be careful to protect global data structures. We do this
* by entering the Win16Lock while linking the task into the
* global task list.
*/
void TASK_StartTask( HTASK16 hTask )
{
/* Add the task to the linked list */
SYSLEVEL_EnterWin16Lock();
TASK_LinkTask( hTask );
SYSLEVEL_LeaveWin16Lock();
TRACE(task, "linked task %04x\n", hTask );
/* Get the task up and running. If we ourselves are a 16-bit task,
we simply Yield(). If we are 32-bit however, we need to signal
the main process somehow (NOT YET IMPLEMENTED!) */
if ( GetCurrentTask() )
if ( THREAD_IsWin16( THREAD_Current() ) )
Yield16();
else
FIXME(task, "Don't know how to start 16-bit task from 32-bit thread. Move the mouse!\n");
}
/***********************************************************************
* TASK_DeleteTask
@ -498,9 +539,25 @@ static void TASK_DeleteTask( HTASK16 hTask )
*/
void TASK_KillCurrentTask( INT16 exitCode )
{
TDB* pTask = (TDB*) GlobalLock16( hCurrentTask );
TDB* pTask = (TDB*) GlobalLock16( GetCurrentTask() );
NE_MODULE* pModule = NE_GetPtr( pTask->hModule );
if (!pTask) USER_ExitWindows(); /* No current task yet */
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
/* Enter the Win16Lock to protect global data structures
NOTE: We never explicitly leave it again. This shouldn't matter
though, as it will be released in TASK_Reschedule and this
task won't ever get scheduled again ... */
SYSLEVEL_EnterWin16Lock();
assert(hCurrentTask == GetCurrentTask());
TRACE(task, "Killing task %04x\n", hCurrentTask );
/* Delete active sockets */
@ -508,6 +565,12 @@ void TASK_KillCurrentTask( INT16 exitCode )
if( pTask->pwsi )
WINSOCK_DeleteTaskWSI( pTask, pTask->pwsi );
#ifdef MZ_SUPPORTED
/* Kill DOS VM task */
if ( pModule->lpDosTask )
MZ_KillModule( pModule->lpDosTask );
#endif
/* Perform USER cleanup */
if (pTask->userhandler)
@ -567,9 +630,15 @@ void TASK_Reschedule(void)
HTASK16 hTask = 0;
STACK16FRAME *newframe16;
SYSLEVEL_ReleaseWin16Lock();
/* NOTE: As we are entered from 16-bit code, we hold the Win16Lock.
We hang onto it thoughout most of this routine, so that accesses
to global variables (most notably the task list) are protected. */
assert(hCurrentTask == GetCurrentTask());
TRACE(task, "entered with hTask %04x (pid %d)\n", hCurrentTask, getpid());
#ifdef CONFIG_IPC
/* FIXME: What about the Win16Lock ??? */
dde_reschedule();
#endif
/* First check if there's a task to kill */
@ -616,13 +685,19 @@ void TASK_Reschedule(void)
/* No task found, wait for some events to come in */
/* NOTE: We release the Win16Lock while waiting for events. This is to enable
Win32 threads to thunk down to 16-bit temporarily. Since Win16
tasks won't execute and Win32 threads are not allowed to enter
TASK_Reschedule anyway, there should be no re-entrancy problem ... */
SYSLEVEL_ReleaseWin16Lock();
EVENT_WaitNetEvent( TRUE, TRUE );
SYSLEVEL_RestoreWin16Lock();
}
if (hTask == hCurrentTask)
{
TRACE(task, "returning to the current task(%04x)\n", hTask );
SYSLEVEL_RestoreWin16Lock();
return; /* Nothing to do */
}
pNewTask = (TDB *)GlobalLock16( hTask );
@ -655,6 +730,12 @@ void TASK_Reschedule(void)
/* Switch to the new stack */
/* NOTE: We need to release/restore the Win16Lock, as the task
switched to might be at another recursion level than
the old task ... */
SYSLEVEL_ReleaseWin16Lock();
hCurrentTask = hTask;
SET_CUR_THREAD( pNewTask->thdb );
pNewTask->ss_sp = pNewTask->thdb->cur_stack;
@ -673,6 +754,12 @@ void TASK_YieldToSystem(TDB* pTask)
{
MESSAGEQUEUE* pQ;
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
Callbacks->CallTaskRescheduleProc();
if( pTask )
@ -702,7 +789,7 @@ void WINAPI InitTask( CONTEXT *context )
LONG stacklow, stackhi;
if (context) EAX_reg(context) = 0;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
if (!(pModule = NE_GetPtr( pTask->hModule ))) return;
/* This is a hack to install task USER signal handler before
@ -770,8 +857,15 @@ BOOL16 WINAPI WaitEvent( HTASK16 hTask )
{
TDB *pTask;
if (!hTask) hTask = hCurrentTask;
if (!hTask) hTask = GetCurrentTask();
pTask = (TDB *)GlobalLock16( hTask );
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return TRUE;
}
if (pTask->nEvents > 0)
{
pTask->nEvents--;
@ -793,8 +887,16 @@ void WINAPI PostEvent( HTASK16 hTask )
{
TDB *pTask;
if (!hTask) hTask = hCurrentTask;
if (!hTask) hTask = GetCurrentTask();
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return;
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
memset(0, 0, 4096);
return;
}
pTask->nEvents++;
}
@ -807,7 +909,7 @@ void WINAPI SetPriority( HTASK16 hTask, INT16 delta )
TDB *pTask;
INT16 newpriority;
if (!hTask) hTask = hCurrentTask;
if (!hTask) hTask = GetCurrentTask();
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return;
newpriority = pTask->priority + delta;
if (newpriority < -32) newpriority = -32;
@ -825,7 +927,7 @@ void WINAPI SetPriority( HTASK16 hTask, INT16 delta )
*/
HTASK16 WINAPI LockCurrentTask( BOOL16 bLock )
{
if (bLock) hLockedTask = hCurrentTask;
if (bLock) hLockedTask = GetCurrentTask();
else hLockedTask = 0;
return hLockedTask;
}
@ -845,9 +947,14 @@ HTASK16 WINAPI IsTaskLocked(void)
*/
void WINAPI OldYield(void)
{
TDB *pCurTask;
TDB *pCurTask = (TDB *)GlobalLock16( GetCurrentTask() );
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
pCurTask = (TDB *)GlobalLock16( hCurrentTask );
if (pCurTask) pCurTask->nEvents++; /* Make sure we get back here */
TASK_YieldToSystem(pCurTask);
if (pCurTask) pCurTask->nEvents--;
@ -859,7 +966,14 @@ void WINAPI OldYield(void)
*/
void WINAPI DirectedYield( HTASK16 hTask )
{
TDB *pCurTask = (TDB *)GlobalLock16( hCurrentTask );
TDB *pCurTask = (TDB *)GlobalLock16( GetCurrentTask() );
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
pCurTask->hYieldTo = hTask;
OldYield();
}
@ -870,8 +984,15 @@ void WINAPI DirectedYield( HTASK16 hTask )
*/
void WINAPI UserYield(void)
{
TDB *pCurTask = (TDB *)GlobalLock16( hCurrentTask );
TDB *pCurTask = (TDB *)GlobalLock16( GetCurrentTask() );
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock16( pCurTask->hQueue );
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
/* Handle sent messages */
while (queue && (queue->wakeBits & QS_SENDMESSAGE))
QUEUE_ReceiveMessage( queue );
@ -889,7 +1010,14 @@ void WINAPI UserYield(void)
*/
void WINAPI Yield16(void)
{
TDB *pCurTask = (TDB *)GlobalLock16( hCurrentTask );
TDB *pCurTask = (TDB *)GlobalLock16( GetCurrentTask() );
if ( !THREAD_IsWin16( THREAD_Current() ) )
{
FIXME(task, "called for Win32 thread (%04x)!\n", THREAD_Current()->teb_sel);
return;
}
if (pCurTask) pCurTask->hYieldTo = 0;
if (pCurTask && pCurTask->hQueue) UserYield();
else OldYield();
@ -905,7 +1033,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
SEGPTR thunkaddr;
if (!hInstance) hInstance = CURRENT_DS;
thunkaddr = TASK_AllocThunk( hCurrentTask );
thunkaddr = TASK_AllocThunk( GetCurrentTask() );
if (!thunkaddr) return (FARPROC16)0;
thunk = PTR_SEG_TO_LIN( thunkaddr );
lfunc = PTR_SEG_TO_LIN( func );
@ -935,7 +1063,7 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
void WINAPI FreeProcInstance16( FARPROC16 func )
{
TRACE(task, "(%08lx)\n", (DWORD)func );
TASK_FreeThunk( hCurrentTask, (SEGPTR)func );
TASK_FreeThunk( GetCurrentTask(), (SEGPTR)func );
}
@ -977,7 +1105,7 @@ HQUEUE16 WINAPI SetTaskQueue( HTASK16 hTask, HQUEUE16 hQueue )
HQUEUE16 hPrev;
TDB *pTask;
if (!hTask) hTask = hCurrentTask;
if (!hTask) hTask = GetCurrentTask();
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return 0;
hPrev = pTask->hQueue;
@ -996,7 +1124,7 @@ HQUEUE16 WINAPI GetTaskQueue( HTASK16 hTask )
{
TDB *pTask;
if (!hTask) hTask = hCurrentTask;
if (!hTask) hTask = GetCurrentTask();
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return 0;
return pTask->hQueue;
}
@ -1012,7 +1140,7 @@ void WINAPI SwitchStackTo( WORD seg, WORD ptr, WORD top )
INSTANCEDATA *pData;
UINT16 copySize;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
if (!(pData = (INSTANCEDATA *)GlobalLock16( seg ))) return;
TRACE(task, "old=%04x:%04x new=%04x:%04x\n",
SELECTOROF( pTask->thdb->cur_stack ),
@ -1056,7 +1184,7 @@ void WINAPI SwitchStackBack( CONTEXT *context )
STACK16FRAME *oldFrame, *newFrame;
INSTANCEDATA *pData;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
if (!(pData = (INSTANCEDATA *)GlobalLock16(SELECTOROF(pTask->thdb->cur_stack))))
return;
if (!pData->old_ss_sp)
@ -1116,14 +1244,14 @@ void WINAPI GetTaskQueueES( CONTEXT *context )
*/
HTASK16 WINAPI GetCurrentTask(void)
{
return hCurrentTask;
return THREAD_InitDone? PROCESS_Current()->task : 0;
}
DWORD WINAPI WIN16_GetCurrentTask(void)
{
/* This is the version used by relay code; the first task is */
/* returned in the high word of the result */
return MAKELONG( hCurrentTask, hFirstTask );
return MAKELONG( GetCurrentTask(), hFirstTask );
}
@ -1134,7 +1262,7 @@ HANDLE16 WINAPI GetCurrentPDB(void)
{
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
return pTask->hPDB;
}
@ -1159,7 +1287,7 @@ WORD WINAPI GetExeVersion(void)
{
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
return pTask->version;
}
@ -1172,7 +1300,7 @@ UINT16 WINAPI SetErrorMode16( UINT16 mode )
TDB *pTask;
UINT16 oldMode;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
oldMode = pTask->error_mode;
pTask->error_mode = mode;
pTask->thdb->process->error_mode = mode;
@ -1196,7 +1324,7 @@ SEGPTR WINAPI GetDOSEnvironment(void)
{
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
return PTR_SEG_OFF_TO_SEGPTR( pTask->pdb.environment, 0 );
}
@ -1220,7 +1348,7 @@ HINSTANCE16 WINAPI GetTaskDS(void)
{
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
return pTask->hInstance;
}
@ -1248,7 +1376,7 @@ FARPROC16 WINAPI SetTaskSignalProc( HTASK16 hTask, FARPROC16 proc )
TDB *pTask;
FARPROC16 oldProc;
if (!hTask) hTask = hCurrentTask;
if (!hTask) hTask = GetCurrentTask();
if (!(pTask = (TDB *)GlobalLock16( hTask ))) return NULL;
oldProc = (FARPROC16)pTask->userhandler;
pTask->userhandler = (USERSIGNALPROC)proc;
@ -1271,7 +1399,7 @@ WORD WINAPI SetSigHandler( FARPROC16 newhandler, FARPROC16* oldhandler,
{
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return 0;
if (oldmode) *oldmode = pTask->signal_flags;
pTask->signal_flags = newmode;
if (oldhandler) *oldhandler = pTask->sighandler;
@ -1288,7 +1416,7 @@ VOID WINAPI GlobalNotify( FARPROC16 proc )
{
TDB *pTask;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return;
if (!(pTask = (TDB *)GlobalLock16( GetCurrentTask() ))) return;
pTask->discardhandler = proc;
}

View File

@ -25,7 +25,6 @@ C_SRCS = \
printdrv.c \
registry.c \
shell.c \
shellord.c \
sound.c \
spy.c \
stress.c \

View File

@ -73,7 +73,7 @@ BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn )
if (lpofn->Flags & OFN_WINE32) {
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE)
{
if (!(template = LockResource32( lpofn->hInstance )))
if (!(template = LockResource32( MapHModuleSL(lpofn->hInstance ))))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
@ -81,13 +81,14 @@ BOOL16 WINAPI GetOpenFileName16( SEGPTR ofn )
}
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
if (!(hResInfo = FindResource32A(lpofn->hInstance,
if (!(hResInfo = FindResource32A(MapHModuleSL(lpofn->hInstance),
PTR_SEG_TO_LIN(lpofn->lpTemplateName), RT_DIALOG32A)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
if (!(hDlgTmpl = LoadResource32( lpofn->hInstance, hResInfo )) ||
if (!(hDlgTmpl = LoadResource32( MapHModuleSL(lpofn->hInstance),
hResInfo )) ||
!(template = LockResource32( hDlgTmpl )))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
@ -198,7 +199,7 @@ BOOL16 WINAPI GetSaveFileName16( SEGPTR ofn)
if (lpofn->Flags & OFN_WINE32) {
if (lpofn->Flags & OFN_ENABLETEMPLATEHANDLE)
{
if (!(template = LockResource32( lpofn->hInstance )))
if (!(template = LockResource32( MapHModuleSL(lpofn->hInstance ))))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
return FALSE;
@ -207,14 +208,15 @@ BOOL16 WINAPI GetSaveFileName16( SEGPTR ofn)
else if (lpofn->Flags & OFN_ENABLETEMPLATE)
{
HANDLE32 hResInfo;
if (!(hResInfo = FindResource32A(lpofn->hInstance,
if (!(hResInfo = FindResource32A(MapHModuleSL(lpofn->hInstance),
PTR_SEG_TO_LIN(lpofn->lpTemplateName),
RT_DIALOG32A)))
{
CommDlgLastError = CDERR_FINDRESFAILURE;
return FALSE;
}
if (!(hDlgTmpl = LoadResource32(lpofn->hInstance,hResInfo)) ||
if (!(hDlgTmpl = LoadResource32(MapHModuleSL(lpofn->hInstance),
hResInfo)) ||
!(template = LockResource32(hDlgTmpl)))
{
CommDlgLastError = CDERR_LOADRESFAILURE;
@ -3646,8 +3648,7 @@ static BOOL32 Commdlg_GetFileName32A( BOOL16 (CALLBACK *dofunction)(SEGPTR x),
memset(ofn16,'\0',sizeof(*ofn16));
ofn16->lStructSize = sizeof(*ofn16);
ofn16->hwndOwner = ofn->hwndOwner;
/* FIXME: OPENFILENAME16 got only 16 bit for HINSTANCE... */
ofn16->hInstance = 0;
ofn16->hInstance = MapHModuleLS(ofn->hInstance);
if (ofn->lpstrFilter) {
LPSTR s,x;
@ -3736,8 +3737,7 @@ static BOOL32 Commdlg_GetFileName32W( BOOL16 (CALLBACK *dofunction)(SEGPTR x),
memset(ofn16,'\0',sizeof(*ofn16));
ofn16->lStructSize = sizeof(*ofn16);
ofn16->hwndOwner = ofn->hwndOwner;
/* FIXME: OPENFILENAME16 got only 16 bit for HINSTANCE... */
ofn16->hInstance = 0;
ofn16->hInstance = MapHModuleLS(ofn->hInstance);
if (ofn->lpstrFilter) {
LPWSTR s;
LPSTR x,y;
@ -3881,7 +3881,7 @@ BOOL32 WINAPI ChooseColor32A(LPCHOOSECOLOR32A lpChCol )
memset(lpcc16,'\0',sizeof(*lpcc16));
lpcc16->lStructSize=sizeof(*lpcc16);
lpcc16->hwndOwner=lpChCol->hwndOwner;
lpcc16->hInstance=0; /* FIXME:MODULE_HANDLEtoHMODULE16(lpChCol->hInstance)*/
lpcc16->hInstance=MapHModuleLS(lpChCol->hInstance);
lpcc16->rgbResult=lpChCol->rgbResult;
memcpy(ccref,lpChCol->lpCustColors,64);
lpcc16->lpCustColors=(COLORREF*)SEGPTR_GET(ccref);
@ -3915,7 +3915,7 @@ BOOL32 WINAPI ChooseColor32W(LPCHOOSECOLOR32W lpChCol )
memset(lpcc16,'\0',sizeof(*lpcc16));
lpcc16->lStructSize=sizeof(*lpcc16);
lpcc16->hwndOwner=lpChCol->hwndOwner;
lpcc16->hInstance=0; /*FIXME:MODULE_HANDLEtoHMODULE16(lpChCol->hInstance)*/
lpcc16->hInstance=MapHModuleLS(lpChCol->hInstance);
lpcc16->rgbResult=lpChCol->rgbResult;
memcpy(ccref,lpChCol->lpCustColors,64);
lpcc16->lpCustColors=(COLORREF*)SEGPTR_GET(ccref);

View File

@ -556,7 +556,7 @@ ImageList_Create (INT32 cx, INT32 cy, UINT32 flags,
himl->clrBk = CLR_NONE;
/* initialize overlay mask indices */
for (nCount = 0; nCount <= MAX_OVERLAYIMAGE; nCount++)
for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
himl->nOvlIdx[nCount] = -1;
hdc = CreateCompatibleDC32 (0);
@ -1691,7 +1691,7 @@ ImageList_Remove (HIMAGELIST himl, INT32 i)
himl->cMaxImage = himl->cInitial + himl->cGrow;
himl->cCurImage = 0;
for (nCount = 0; nCount <= MAX_OVERLAYIMAGE; nCount++)
for (nCount = 0; nCount < MAX_OVERLAYIMAGE; nCount++)
himl->nOvlIdx[nCount] = -1;
DeleteObject32 (himl->hbmImage);
@ -1921,10 +1921,10 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT32 i, HICON32 hIcon)
if (hdcImage)
DeleteDC32 (hdcImage);
// FIXME (imagelist, "deleting hbmColor!\n");
DeleteObject32 (ii.hbmColor);
// FIXME (imagelist, "deleted hbmColor!\n");
DeleteObject32 (ii.hbmMask);
if (ii.hbmColor)
DeleteObject32 (ii.hbmColor);
if (ii.hbmMask)
DeleteObject32 (ii.hbmMask);
return (nIndex);
}

View File

@ -668,6 +668,7 @@ DWORD WINAPI FormatMessage32A(
if (nSize && talloced<nSize) {
target = (char*)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
}
TRACE(resource,"-- %s\n",target);
if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
/* nSize is the MINIMUM size */
*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc32(GMEM_ZEROINIT,talloced);

View File

@ -137,7 +137,7 @@ INT32 WINAPI LZStart32(void)
*/
HFILE16 WINAPI LZInit16( HFILE16 hfSrc )
{
return LZInit32( hfSrc );
return LZInit32( HFILE16_TO_HFILE32(hfSrc) );
}

View File

@ -7,6 +7,9 @@
*/
#include <ctype.h>
#include <sys/types.h>
#include <pwd.h>
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
@ -425,6 +428,31 @@ UINT16 WINAPI WNetGetUser(LPSTR lpLocalName, LPSTR lpUserName, DWORD *lpSize)
return WN_NO_NETWORK;
}
/**************************************************************************
* WNetGetUser [MPR.86]
* FIXME: we should not return ourselves, but the owner of the drive lpLocalName
*/
DWORD WINAPI WNetGetUser32A(LPCSTR lpLocalName, LPSTR lpUserName, DWORD *lpSize)
{
struct passwd *pwd = getpwuid(getuid());
FIXME(wnet, "(%s, %p, %p), mostly stub\n", lpLocalName, lpUserName, lpSize);
if (pwd) {
if (strlen(pwd->pw_name)+1>*lpSize) {
*lpSize = strlen(pwd->pw_name)+1;
SetLastError(ERROR_MORE_DATA);
return ERROR_MORE_DATA;
}
strcpy(lpUserName,pwd->pw_name);
if (lpSize)
*lpSize = strlen(pwd->pw_name)+1;
return WN_SUCCESS;
}
/* FIXME: wrong return value */
SetLastError(ERROR_NO_NETWORK);
return ERROR_NO_NETWORK;
}
/**************************************************************************
* WNetGetError [USER.519]
*/

View File

@ -99,7 +99,9 @@ static struct openhandle {
} *openhandles=NULL;
static int nrofopenhandles=0;
/* Starts after 1 because 0,1 are reserved for Win16 */
static int currenthandle=1;
/* Note: Should always be even, as Win95 ADVAPI32.DLL reserves odd
HKEYs for remote registry access */
static int currenthandle=2;
/*
@ -1743,7 +1745,8 @@ DWORD WINAPI RegOpenKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey, DWORD dwReserved,
if (!lpszSubKey || !*lpszSubKey) {
/* Either NULL or pointer to empty string, so return a new handle
to the original hkey */
add_handle(++currenthandle,lpNextKey,samDesired);
currenthandle += 2;
add_handle(currenthandle,lpNextKey,samDesired);
*retkey=currenthandle;
return ERROR_SUCCESS;
}
@ -1776,7 +1779,8 @@ DWORD WINAPI RegOpenKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey, DWORD dwReserved,
lpNextKey = lpxkey;
}
add_handle(++currenthandle,lpxkey,samDesired);
currenthandle += 2;
add_handle(currenthandle,lpxkey,samDesired);
*retkey = currenthandle;
TRACE(reg," Returning %x\n", currenthandle);
FREE_KEY_PATH;
@ -1909,7 +1913,8 @@ DWORD WINAPI RegCreateKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey,
return ERROR_INVALID_PARAMETER;
if (!lpszSubKey || !*lpszSubKey) {
add_handle(++currenthandle,lpNextKey,samDesired);
currenthandle += 2;
add_handle(currenthandle,lpNextKey,samDesired);
*retkey=currenthandle;
TRACE(reg, "Returning %x\n", currenthandle);
lpNextKey->flags|=REG_OPTION_TAINTED;
@ -1938,7 +1943,8 @@ DWORD WINAPI RegCreateKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey,
lpNextKey = lpxkey;
}
if (lpxkey) {
add_handle(++currenthandle,lpxkey,samDesired);
currenthandle += 2;
add_handle(currenthandle,lpxkey,samDesired);
lpxkey->flags |= REG_OPTION_TAINTED;
*retkey = currenthandle;
TRACE(reg, "Returning %x\n", currenthandle);
@ -1977,7 +1983,8 @@ DWORD WINAPI RegCreateKeyEx32W( HKEY hkey, LPCWSTR lpszSubKey,
lpNextKey = *lplpPrevKey;
i++;
}
add_handle(++currenthandle,lpNextKey,samDesired);
currenthandle += 2;
add_handle(currenthandle,lpNextKey,samDesired);
/*FIXME: flag handling correct? */
lpNextKey->flags= fdwOptions |REG_OPTION_TAINTED;

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,6 @@
#include "miscemu.h"
#include "module.h"
#include "task.h"
#include "dosexe.h"
#include "debug.h"
HANDLE16 DOSMEM_BiosSeg; /* BIOS data segment at 0x40:0 */
@ -112,13 +111,14 @@ static dosmem_info* info_block = NULL;
*
* Gets the DOS memory base.
*/
static char *DOSMEM_MemoryBase(HMODULE16 hModule)
char *DOSMEM_MemoryBase(HMODULE16 hModule)
{
TDB *pTask = hModule ? NULL : (TDB *)GlobalLock16( GetCurrentTask() );
NE_MODULE *pModule = (hModule || pTask) ? NE_GetPtr( hModule ? hModule : pTask->hModule ) : NULL;
if (pModule && pModule->lpDosTask)
return pModule->lpDosTask->img;
GlobalUnlock16( GetCurrentTask() );
if (pModule && pModule->dos_image)
return pModule->dos_image;
else
return DOSMEM_dosmem;
}
@ -431,7 +431,6 @@ LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT32 size, UINT16* pse
UINT32 DOSMEM_Available(HMODULE16 hModule)
{
UINT32 blocksize, available = 0;
char *block = NULL;
dosmem_entry *dm;
dm = root_block;

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