From a0d77315e4d2bebe25acf58a4cbb86208fc1cfbb Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 13 Sep 1998 16:32:00 +0000 Subject: [PATCH] Release 980913 Fri Sep 11 13:14:35 1998 Andreas Mohr <100.30936@germany.net> * [files/file.c] [include/file.h] Fixed SetFilePointer to allow negative positions as in DOS. * [graphics/ddraw.c] Added some methods to IDirect3D. * [ole/compobj.c] [if1632/compobj.spec] Added/implemented CoCreateStandardMalloc16, CoGetClassObject, CoCreateInstance, LookupETask, SetETask, CoGetState16. * [loader/task.c] MakeProcInstance: return 0 if func == NULL. * [*/*] [tools/winapi-check] Added zillions of missing WINAPI's and __cdecl's. (oops, several caused by myself) Wrote script for automated checking. * [if1632/compobj.spec] Many stub names. * [misc/ddeml.c] [ole/compobj.c] Some stubs. Tue Sep 9 21:36:48 1998 Anders Carlsson * [dlls/comctl32/Makefile.in] [dlls/comctl32/commctrl.c] [dlls/comctl32/tab.c] [include/commctrl.h] [include/tab.h] Added preliminary tab control support. Sat Sep 5 16:27:20 1998 Huw D M Davies * [graphics/psdrv/*] More changes to the PostScript driver: Implemented pens and solid brushes. Colour/greyscale for fonts, pens and brushes. To get coloured output you need to have *ColorDevice set to true in your PPD, otherwise you'll get greyscale. Landscape mode now works, as does non-A4 page sizes. Encoding of fonts to ANSI is better, Symbol works again. * [objects/dc.c] [include/gdi.h] [*/*] Moved dc->w.{text,background}Pixel to X11DRV_PDEVICE where they belong. Sat Sep 5 05:12:09 1998 Ove Kaaven * [include/dosexe.h] [include/miscemu.h] [include/msdos.h] [loader/dos/dosvm.c] [loader/dos/module.c] [msdos/dpmi.c] [msdos/int2f.c] [msdos/interrupts.c] Fixed portability. Adapted some code to make it easier to integrate the DOS subsystem with the DPMI subsystem, made the DPMI simulated real-mode interrupts be handled the V86 way. Added support for .COM files. Made int2f DPMI check fail, to avoid pkunzip crashing in attempting to use DPMI. Generally moved stuff around a little. It is now technically possible to load several DOS programs into the same memory space. Not tested, though. Fri Sep 4 21:40:45 1998 Marcus Meissner * [if1632/kernel.spec] Changed 500-53x stubnames accordingly to nt3.51 krnl386.exe. * [win32/except.c] Fixed one bad program behaviour, (deleting SEH while in first walk). RtlUnwind is broken too I think (it should unwind on success, not while walking the exception chain). * [ole/ole2nls.c] Get*DefaultLCID returns 0x400|id. expected by one application. * [if1632/snoop.c] Handle non-standard SP returns more graceful. * [windows/class.c] hinstances are mostly irrelevant for win32. * [memory/string.c] [misc/registry.c] lstrcmpi32W: use toupper for characters < 0x100. (speedup hack for registry.c) Some small speedup hacks for registry.c Thu Sep 3 20:40:16 1998 Eric Kohl * [Makefile.in][configure][configure.in][dlls/Makefile.in] [dlls/comctl32/Makefile.in] Created dlls/comctl32 and moved the common controls stuff to it. * [misc/version.c] Removed COMCTL32_DllGetVersion. The fixed function is part of the common controls stuff. * [dlls/comctl32/*.c][include/commctrl.h] Added structure size tests. * [dlls/comctl32/toolbar.c] Fixed a bug in TOOLBAR_GetMaxWidth(). * [dlls/comctl32/animate.c][include/animate.h] [dlls/comctl32/comboex.c][include/comboex.h] [dlls/comctl32/hotkey.c][include/hotkey.h] [dlls/comctl32/listview.c][include/listview.h] [dlls/comctl32/commctrl.c][include/commctrl.h] New files. Added Animation, ComboBoxEx, Hotkey and Listview control dummies. * [dlls/comctl32/tooltips.c] Fixed a display bug and font selection. * [dlls/comctl32/comctl32undoc.c][include/commctrl.h] Added missing DPA functions. Fixed bugs and published the function prototypes. * [documentation/common_controls] Updated. Wed Sep 2 15:43:45 1998 Patrik Stridvall * [AUTHORS] [include/authors.h] Added myself as a Wine author. * [memory/virtual.c] [objects/dc.c] Fixed runtime errors for Solaris. * [misc/ddeml.c] [objects/gdiobj.c] Minor fixes. * [win32/device.c] Added stubs for IFSMgr VxDCall and a partial implementation of IFSMgr DeviceIo. * [relay32/Makefile.in] [relay32/builtin32.c] [relay32/imm32.spec] [relay32/msnet32.spec] [relay32/oledlg.spec] Added new spec files for IMM32.DLL, MSNET32.DLL, OLEDLG.DLL. * [misc/Makefile.in] [misc/imm.c] [include/imm.h] Added news files for implementation of IMM32.DLL. All functions return 0 as is correct for all Western Languages. * [ole/Makefile.in] [ole/oledlg.c] [include/oledlg.h] Added new files for implementation of OLEDLG.DLL. Added stubs with FIXME:s for all functions. Wed Sep 2 10:50:00 1998 Juergen Schmied * [dlls/shell32/contmenu.c][dlls/shell32/shellole.c] [dlls/shell32/shlfolder.c][dlls/shell32/shlview.c] [documentation/shell32][include/shell.h] Clean up, bugfixes. * [dlls/shell32/enumidlist.c] Fileattributes implemented. * [dlls/shell32/pidl.c] Class pidlmgr splited into functions, structures changed, some functions rewritten. * [dlls/shell32/shell32_main.c] Small changes and bugfixes SHGetFileInfoA, SHGetSpecialFolderLocation. * [dlls/shell32/shellord.c][relay32/shell32.spec] Parameter documented, implemented SHCloneSpecialIDList. Stub improved ShellExecuteEx32A. New stubs SHFind_InitMenuPopup, FileMenu_InitMenuPopup, FileMenu_Create, FileMenu_TrackPopupMenuEx, SHWinHelp, SHRunConrolPanel, DAD_ShowDragImage, FileMenu_Destroy, SHGetDataFromIDListA, SHFileOperationA. * [include/winnls.h][include/ole2nls.c] TIME_FORCE24HOURFORMAT, TIME_NOTIMEMARKER implemented in OLE_GetFormatA, GetTimeFormat32A. * [win32/code_page.c] WideCharToMultiByte: parameter checking and returning of strlen implemented. * [windows/keyboard.c][windows/defwnd.c] Debug messages added. * [windows/win.c] WIN_SetWindowLong GWL_STYLE and GWL_EXSTYLE implemented. * [controls/menu.c] Missing line added. * [include/winerror.h] Macros for SUCCEEDED and FAILED added. Mon Aug 31 00:55:31 1998 Ulrich Weigand * [loader/module.c] Bugfix: LoadModule16 should *not* call LoadModule32. * [files/dos_fs.c] Bugfix: don't crash if given directory doesn't exist. Sat Aug 29 15:00:49 1998 Turchanov Sergey * [include/mmsystem.h][multimedia/mmsystem.c][relay32/winmm.spec] Almost completed implementation of [snd]PlaySound (except flags SND_ALIAS_ID and SND_APPLICATION). * [if1632/user.spec][windows/winpos.c] Added SetWindowRgn16 stub. Sat Aug 29 02:53:31 1998 Alexander Lukyanov * [files/drive.c] GetDriveType32A: return DRIVE_DOESNOTEXIST in case of non existent drive. * [msdos/int21.c] INT21_FindFirstFCB: check drive validity to prevent oops. * [win32/file.c] CreateFile32A: duplicate STD_{INPUT,OUTPUT}_HANDLE. * [files/dos_fs.c] Make DOSFS_OpenDir treat "" as "/". DOSFS_OpenDevice: duplicate STD_{INPUT,OUTPUT}_HANDLE. * [windows/dialog.c] GetNextDlgTabItem32: use last/first item instead of first/last when hwndCtrl==0. This fixes initial focus. Sat Aug 29 02:46:32 1998 Adrian Harvey * [include/process.h] [include/process.c] Renamed PROCESS_SELF to CURRENT_PROCESS_PSEUDOHANDLE in line with thread constant, and Win32 documentation (which calls it a pseudohandle.) Made GetCurrentProcess actually use this constant instead of the value. * [include/process.h] [include/thread.h] [scheduler/thread.c] [scheduler/process.c] [scheduler/handle.c] Modify HANDLE_GetObjPtr to understand about CURRENT_THREAD_PSEUDOHANDLE and CURRENT_PROCESS_PSEUDOHANDLE. This allows DuplicateHandle to do the correct thing with these handles. Removed now duplicate functionality from THREAD_GetPtr and PROCESS_GetPtr. * [loader/ne/segment.c] Fixed two places where HFILE32s were being created and passed to 16-bit code. This should unbreak NE self-loading code. Added two casts to remove compile time warnings. Fri Aug 28 21:04:13 1998 Joseph Pranevich * [msdos/dosmem.c] [msdos/int2f.c] Added beginnings of DOS error table. * [msdos/int1a.c] Stub for subfunction 0xb0. * [msdos/int10.c] [loader/dos/dosvm.c] INT 10 support completely rewritten and lots of debugging added. Now, DOS apps that use INT 10 to write to the screen will work. (Beyond Zork does, at least. Somewhat.) * [include/miscemu.h] [msdos/dosmem.c] [msdos/int21.c] Another shot at getting MS's generic error message facility right. * [msdos/int21.c] Command.Com wanted to set its own PSP address. I let it. Wed Aug 26 12:26:20 1998 Matthew Toseland * [include/file.h] [misc/lzexpand.c] Fixed LZCopy16 by fixing HFILE16/HFILE32 convertor macros so don't convert lzw handles. Tue Aug 25 22:22:55 1998 Uwe Bonnes * [misc/registry.c] In RegEnumvalue, ivalue == 0 is a legal request and should return the first entry. * [msdos/int21.c] Add handling for Int21-48/49 in Win16. Makes blinker demo work. * [windows/winproc.c] Add Msg32A<->Msg32W translation for LB_ADDSTRING. Tue Aug 25 21:03:31 1998 Kristian Nielsen * [windows/win.c] Fix for SetParent(): MS Windows 3.11 does not clear the WS_CHILD flag when a child window is reparented to the desktop window. Mon Aug 24 20:55:22 1998 Berend Reitsma * [controls/menu.c] Menus created with SetMenuItemInfo and InsertMenuItem should work now. Sun Aug 23 23:23:23 1998 Alex Korobka * [controls/combo.c] Added CB_GETITEMHEIGHT. * [windows/winpos.c] WM_NCHITTEST, SWP_FRAMECHANGED bugfixes. Sat Aug 22 21:15:29 1998 Alex Priem * [files/profile.c] [include/windows.h] Added GetPrivateProfileSectionNames[AW],GetPrivateProfileSectionW, GetPrivateProfileStructW, GetProfileSectionW, WriteProfileSection[AW], WritePrivateProfileStructW. --- ANNOUNCE | 19 +- AUTHORS | 1 + BUGS | 2 +- ChangeLog | 316 ++++++ Makefile.in | 2 + configure | 2 + configure.in | 1 + controls/Makefile.in | 13 - controls/combo.c | 43 +- controls/comctl32undoc.c | 586 ----------- controls/edit.c | 1 + controls/listbox.c | 2 +- controls/listview.c | 244 ----- controls/menu.c | 20 +- controls/static.c | 2 +- controls/trackbar.c | 437 -------- controls/widgets.c | 1 - dlls/Makefile.in | 1 + dlls/comctl32/Makefile.in | 32 + dlls/comctl32/animate.c | 225 +++++ dlls/comctl32/comboex.c | 283 ++++++ dlls/comctl32/comctl32undoc.c | 1269 ++++++++++++++++++++++++ {controls => dlls/comctl32}/commctrl.c | 435 ++++---- {controls => dlls/comctl32}/header.c | 38 +- dlls/comctl32/hotkey.c | 360 +++++++ {misc => dlls/comctl32}/imagelist.c | 2 + dlls/comctl32/listview.c | 600 +++++++++++ {controls => dlls/comctl32}/pager.c | 85 +- {controls => dlls/comctl32}/progress.c | 0 {controls => dlls/comctl32}/rebar.c | 194 +++- {controls => dlls/comctl32}/status.c | 0 dlls/comctl32/tab.c | 392 ++++++++ {controls => dlls/comctl32}/toolbar.c | 201 ++-- {controls => dlls/comctl32}/tooltips.c | 171 +++- dlls/comctl32/trackbar.c | 901 +++++++++++++++++ {controls => dlls/comctl32}/treeview.c | 92 +- {controls => dlls/comctl32}/updown.c | 0 dlls/shell32/Makefile.in | 4 +- dlls/shell32/contmenu.c | 138 +-- dlls/shell32/enumidlist.c | 274 ++--- dlls/shell32/folders.c | 20 +- dlls/shell32/pidl.c | 764 ++++++-------- dlls/shell32/pidl.h | 121 ++- dlls/shell32/shell32_main.c | 336 ++++--- dlls/shell32/shellole.c | 150 ++- dlls/shell32/shellord.c | 165 ++- dlls/shell32/shlfolder.c | 435 ++++---- dlls/shell32/shlview.c | 427 ++++---- documentation/common_controls | 64 +- documentation/filehandles | 5 + documentation/shell32 | 16 +- files/dos_fs.c | 22 +- files/drive.c | 7 +- files/file.c | 73 +- files/profile.c | 152 ++- graphics/ddraw.c | 64 +- graphics/metafiledrv/graphics.c | 20 + graphics/metafiledrv/init.c | 8 +- graphics/psdrv/Makefile.in | 3 + graphics/psdrv/README | 35 +- graphics/psdrv/afm.c | 146 ++- graphics/psdrv/brush.c | 73 ++ graphics/psdrv/color.c | 135 +++ graphics/psdrv/driver.c | 12 +- graphics/psdrv/font.c | 40 +- graphics/psdrv/graphics.c | 37 +- graphics/psdrv/init.c | 37 +- graphics/psdrv/objects.c | 21 - graphics/psdrv/pen.c | 90 ++ graphics/psdrv/ppd.c | 18 +- graphics/psdrv/ps.c | 327 +++++- graphics/win16drv/init.c | 3 +- graphics/wing.c | 4 +- graphics/x11drv/bitblt.c | 19 +- graphics/x11drv/graphics.c | 34 + graphics/x11drv/init.c | 4 +- graphics/x11drv/text.c | 6 +- if1632/compobj.spec | 75 +- if1632/kernel.spec | 47 +- if1632/ole2.spec | 2 +- if1632/snoop.c | 25 +- if1632/thunk.c | 15 + if1632/user.spec | 2 +- include/animate.h | 19 + include/authors.h | 1 + include/comboex.h | 23 + include/commctrl.h | 974 ++++++++++++------ include/debug.h | 248 ++--- include/debugdefs.h | 12 +- include/dosexe.h | 1 + include/file.h | 4 + include/gdi.h | 2 - include/hotkey.h | 22 + include/imm.h | 24 + include/listview.h | 21 + include/metafiledrv.h | 2 + include/miscemu.h | 7 + include/mmsystem.h | 1 + include/msdos.h | 2 +- include/oledlg.h | 45 + include/pager.h | 8 +- include/pe_image.h | 3 +- include/process.h | 3 + include/psdrv.h | 85 +- include/rebar.h | 2 +- include/region.h | 8 - include/shell.h | 16 +- include/shlobj.h | 157 +-- include/tab.h | 36 + include/thread.h | 3 + include/toolbar.h | 2 +- include/tooltips.h | 38 +- include/trackbar.h | 9 +- include/ts_xlib.h | 1 + include/version.h | 2 +- include/windows.h | 5 + include/winerror.h | 4 +- include/winnls.h | 3 + include/x11drv.h | 4 + libtest/hello4.c | 30 +- loader/dos/Makefile.in | 2 +- loader/dos/dosmod.c | 6 +- loader/dos/dosvm.c | 36 +- loader/dos/module.c | 171 ++-- loader/module.c | 82 +- loader/ne/resource.c | 2 +- loader/ne/segment.c | 17 +- loader/pe_image.c | 3 +- loader/resource.c | 2 +- loader/task.c | 4 + memory/global.c | 8 +- memory/string.c | 6 +- memory/virtual.c | 17 +- misc/Makefile.in | 2 +- misc/crtdll.c | 4 +- misc/ddeml.c | 46 + misc/imm.c | 546 ++++++++++ misc/lzexpand.c | 15 +- misc/main.c | 8 + misc/ntdll.c | 5 +- misc/registry.c | 31 +- misc/version.c | 56 -- misc/win32s16.c | 2 +- misc/windebug.c | 2 +- msdos/dosmem.c | 58 ++ msdos/dpmi.c | 159 +-- msdos/int10.c | 289 +++++- msdos/int1a.c | 33 +- msdos/int21.c | 62 +- msdos/int2f.c | 69 +- msdos/interrupts.c | 32 + multimedia/mmsystem.c | 256 ++++- objects/dc.c | 64 +- objects/gdiobj.c | 6 +- objects/region.c | 20 +- objects/text.c | 4 +- ole/Makefile.in | 1 + ole/compobj.c | 86 +- ole/ole2.c | 20 + ole/ole2nls.c | 81 +- ole/oledlg.c | 292 ++++++ relay32/Makefile.in | 3 + relay32/builtin32.c | 6 + relay32/comctl32.spec | 73 +- relay32/imm32.spec | 75 ++ relay32/kernel32.spec | 20 +- relay32/msnet32.spec | 100 ++ relay32/ole32.spec | 2 +- relay32/oledlg.spec | 26 + relay32/shell32.spec | 18 +- relay32/snoop.c | 7 +- relay32/user32.spec | 10 +- scheduler/handle.c | 13 + scheduler/process.c | 19 +- scheduler/thread.c | 16 +- tools/build.c | 2 +- tools/testrun | 17 +- tools/winapi-check | 49 + tsx11/X11_calls | 1 + tsx11/ts_xlib.c | 11 + win32/code_page.c | 7 +- win32/device.c | 320 +++++- win32/except.c | 4 +- win32/file.c | 17 +- windows/class.c | 4 +- windows/dce.c | 2 +- windows/defwnd.c | 12 +- windows/dialog.c | 2 +- windows/graphics.c | 12 +- windows/keyboard.c | 2 + windows/mdi.c | 21 +- windows/message.c | 4 +- windows/user.c | 2 +- windows/win.c | 56 +- windows/winpos.c | 69 +- windows/winproc.c | 4 + 196 files changed, 12122 insertions(+), 4764 deletions(-) delete mode 100644 controls/comctl32undoc.c delete mode 100644 controls/listview.c delete mode 100644 controls/trackbar.c create mode 100644 dlls/comctl32/Makefile.in create mode 100644 dlls/comctl32/animate.c create mode 100644 dlls/comctl32/comboex.c create mode 100644 dlls/comctl32/comctl32undoc.c rename {controls => dlls/comctl32}/commctrl.c (84%) rename {controls => dlls/comctl32}/header.c (98%) create mode 100644 dlls/comctl32/hotkey.c rename {misc => dlls/comctl32}/imagelist.c (99%) create mode 100644 dlls/comctl32/listview.c rename {controls => dlls/comctl32}/pager.c (74%) rename {controls => dlls/comctl32}/progress.c (100%) rename {controls => dlls/comctl32}/rebar.c (75%) rename {controls => dlls/comctl32}/status.c (100%) create mode 100644 dlls/comctl32/tab.c rename {controls => dlls/comctl32}/toolbar.c (94%) rename {controls => dlls/comctl32}/tooltips.c (91%) create mode 100644 dlls/comctl32/trackbar.c rename {controls => dlls/comctl32}/treeview.c (75%) rename {controls => dlls/comctl32}/updown.c (100%) create mode 100644 graphics/psdrv/brush.c create mode 100644 graphics/psdrv/color.c create mode 100644 graphics/psdrv/pen.c create mode 100644 include/animate.h create mode 100644 include/comboex.h create mode 100644 include/hotkey.h create mode 100644 include/imm.h create mode 100644 include/oledlg.h create mode 100644 include/tab.h create mode 100644 misc/imm.c create mode 100644 ole/oledlg.c create mode 100644 relay32/imm32.spec create mode 100644 relay32/msnet32.spec create mode 100644 relay32/oledlg.spec create mode 100644 tools/winapi-check diff --git a/ANNOUNCE b/ANNOUNCE index 5c0bea14207..d73d5d44240 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,15 +1,14 @@ -This is release 980822 of Wine, the MS Windows emulator. This is still a +This is release 980913 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-980822: (see ChangeLog for details) - - Improved mmio support. - - VxDCall support. - - More common controls and shell32 stuff. - - Better DOS executables support. +WHAT'S NEW with Wine-980913: (see ChangeLog for details) + - Even more common controls stuff. + - Many PostScript driver improvements. + - More DOS executables support. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -18,10 +17,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-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 + ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-980913.tar.gz + ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980913.tar.gz + ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/ALPHA/wine/development/Wine-980913.tar.gz + ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980913.tar.gz It should also be available from any site that mirrors tsx-11 or sunsite. diff --git a/AUTHORS b/AUTHORS index 87e0804e5a6..d12f9ff7044 100644 --- a/AUTHORS +++ b/AUTHORS @@ -113,6 +113,7 @@ Stephen Simmons, Rick Sladkey, William Smith, Dominik Strasser, +Patrik Stridvall, Vadim Strizhevsky, Bertho Stultiens, Erik Svendsen, diff --git a/BUGS b/BUGS index e7113ad844c..157eb72273a 100644 --- a/BUGS +++ b/BUGS @@ -18,7 +18,7 @@ General: * Very alpha printing code using win16 drivers. - * Very alpha internal Postscript driver. [h.davies1@physics.ox.ac.uk] + * Very alpha internal PostScript driver. [h.davies1@physics.ox.ac.uk] * Extremely alpha Win95 interface code. * No OLE2 and OLE32 support (including OLE2 interfaces etc.). diff --git a/ChangeLog b/ChangeLog index b6e4c549adb..2b00865dc9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,319 @@ +---------------------------------------------------------------------- +Fri Sep 11 13:14:35 1998 Andreas Mohr <100.30936@germany.net> + + * [files/file.c] [include/file.h] + Fixed SetFilePointer to allow negative positions as in DOS. + + * [graphics/ddraw.c] + Added some methods to IDirect3D. + + * [ole/compobj.c] [if1632/compobj.spec] + Added/implemented CoCreateStandardMalloc16, + CoGetClassObject, CoCreateInstance, + LookupETask, SetETask, CoGetState16. + + * [loader/task.c] + MakeProcInstance: return 0 if func == NULL. + + * [*/*] [tools/winapi-check] + Added zillions of missing WINAPI's and __cdecl's. + (oops, several caused by myself) + Wrote script for automated checking. + + * [if1632/compobj.spec] + Many stub names. + + * [misc/ddeml.c] [ole/compobj.c] + Some stubs. + +Tue Sep 9 21:36:48 1998 Anders Carlsson + + * [dlls/comctl32/Makefile.in] [dlls/comctl32/commctrl.c] + [dlls/comctl32/tab.c] [include/commctrl.h] [include/tab.h] + Added preliminary tab control support. + +Sat Sep 5 16:27:20 1998 Huw D M Davies + + * [graphics/psdrv/*] + More changes to the PostScript driver: + Implemented pens and solid brushes. + Colour/greyscale for fonts, pens and brushes. + To get coloured output you need to have *ColorDevice set to true + in your PPD, otherwise you'll get greyscale. + Landscape mode now works, as does non-A4 page sizes. + Encoding of fonts to ANSI is better, Symbol works again. + + * [objects/dc.c] [include/gdi.h] [*/*] + Moved dc->w.{text,background}Pixel to X11DRV_PDEVICE where they + belong. + +Sat Sep 5 05:12:09 1998 Ove Kaaven + + * [include/dosexe.h] [include/miscemu.h] [include/msdos.h] + [loader/dos/dosvm.c] [loader/dos/module.c] [msdos/dpmi.c] + [msdos/int2f.c] [msdos/interrupts.c] + Fixed portability. Adapted some code to make it easier to + integrate the DOS subsystem with the DPMI subsystem, made + the DPMI simulated real-mode interrupts be handled the V86 + way. Added support for .COM files. Made int2f DPMI check + fail, to avoid pkunzip crashing in attempting to use DPMI. + Generally moved stuff around a little. + It is now technically possible to load several DOS programs + into the same memory space. Not tested, though. + +Fri Sep 4 21:40:45 1998 Marcus Meissner + + * [if1632/kernel.spec] + Changed 500-53x stubnames accordingly to nt3.51 krnl386.exe. + + * [win32/except.c] + Fixed one bad program behaviour, (deleting SEH while in + first walk). RtlUnwind is broken too I think (it should unwind + on success, not while walking the exception chain). + + * [ole/ole2nls.c] + Get*DefaultLCID returns 0x400|id. expected by one application. + + * [if1632/snoop.c] + Handle non-standard SP returns more graceful. + + * [windows/class.c] + hinstances are mostly irrelevant for win32. + + * [memory/string.c] [misc/registry.c] + lstrcmpi32W: use toupper for characters < 0x100. (speedup hack + for registry.c) + Some small speedup hacks for registry.c + +Thu Sep 3 20:40:16 1998 Eric Kohl + + * [Makefile.in][configure][configure.in][dlls/Makefile.in] + [dlls/comctl32/Makefile.in] + Created dlls/comctl32 and moved the common controls stuff to it. + + * [misc/version.c] + Removed COMCTL32_DllGetVersion. The fixed function is part + of the common controls stuff. + + * [dlls/comctl32/*.c][include/commctrl.h] + Added structure size tests. + + * [dlls/comctl32/toolbar.c] + Fixed a bug in TOOLBAR_GetMaxWidth(). + + * [dlls/comctl32/animate.c][include/animate.h] + [dlls/comctl32/comboex.c][include/comboex.h] + [dlls/comctl32/hotkey.c][include/hotkey.h] + [dlls/comctl32/listview.c][include/listview.h] + [dlls/comctl32/commctrl.c][include/commctrl.h] + New files. Added Animation, ComboBoxEx, Hotkey and + Listview control dummies. + + * [dlls/comctl32/tooltips.c] + Fixed a display bug and font selection. + + * [dlls/comctl32/comctl32undoc.c][include/commctrl.h] + Added missing DPA functions. Fixed bugs and published the + function prototypes. + + * [documentation/common_controls] + Updated. + +Wed Sep 2 15:43:45 1998 Patrik Stridvall + + * [AUTHORS] [include/authors.h] + Added myself as a Wine author. + + * [memory/virtual.c] [objects/dc.c] + Fixed runtime errors for Solaris. + + * [misc/ddeml.c] [objects/gdiobj.c] + Minor fixes. + + * [win32/device.c] + Added stubs for IFSMgr VxDCall and + a partial implementation of IFSMgr DeviceIo. + + * [relay32/Makefile.in] [relay32/builtin32.c] [relay32/imm32.spec] + [relay32/msnet32.spec] [relay32/oledlg.spec] + Added new spec files for IMM32.DLL, MSNET32.DLL, OLEDLG.DLL. + + * [misc/Makefile.in] [misc/imm.c] [include/imm.h] + Added news files for implementation of IMM32.DLL. + All functions return 0 as is correct for all Western Languages. + + * [ole/Makefile.in] [ole/oledlg.c] [include/oledlg.h] + Added new files for implementation of OLEDLG.DLL. + Added stubs with FIXME:s for all functions. + +Wed Sep 2 10:50:00 1998 Juergen Schmied + + * [dlls/shell32/contmenu.c][dlls/shell32/shellole.c] + [dlls/shell32/shlfolder.c][dlls/shell32/shlview.c] + [documentation/shell32][include/shell.h] + Clean up, bugfixes. + + * [dlls/shell32/enumidlist.c] + Fileattributes implemented. + + * [dlls/shell32/pidl.c] + Class pidlmgr splited into functions, structures changed, + some functions rewritten. + + * [dlls/shell32/shell32_main.c] + Small changes and bugfixes SHGetFileInfoA, SHGetSpecialFolderLocation. + + * [dlls/shell32/shellord.c][relay32/shell32.spec] + Parameter documented, implemented SHCloneSpecialIDList. + Stub improved ShellExecuteEx32A. + New stubs SHFind_InitMenuPopup, FileMenu_InitMenuPopup, + FileMenu_Create, FileMenu_TrackPopupMenuEx, SHWinHelp, + SHRunConrolPanel, DAD_ShowDragImage, FileMenu_Destroy, + SHGetDataFromIDListA, SHFileOperationA. + + * [include/winnls.h][include/ole2nls.c] + TIME_FORCE24HOURFORMAT, TIME_NOTIMEMARKER implemented + in OLE_GetFormatA, GetTimeFormat32A. + + * [win32/code_page.c] + WideCharToMultiByte: parameter checking and returning of strlen + implemented. + + * [windows/keyboard.c][windows/defwnd.c] + Debug messages added. + + * [windows/win.c] + WIN_SetWindowLong GWL_STYLE and GWL_EXSTYLE implemented. + + * [controls/menu.c] + Missing line added. + + * [include/winerror.h] + Macros for SUCCEEDED and FAILED added. + +Mon Aug 31 00:55:31 1998 Ulrich Weigand + + * [loader/module.c] + Bugfix: LoadModule16 should *not* call LoadModule32. + + * [files/dos_fs.c] + Bugfix: don't crash if given directory doesn't exist. + +Sat Aug 29 15:00:49 1998 Turchanov Sergey + + * [include/mmsystem.h][multimedia/mmsystem.c][relay32/winmm.spec] + Almost completed implementation of [snd]PlaySound (except + flags SND_ALIAS_ID and SND_APPLICATION). + + * [if1632/user.spec][windows/winpos.c] + Added SetWindowRgn16 stub. + +Sat Aug 29 02:53:31 1998 Alexander Lukyanov + + * [files/drive.c] + GetDriveType32A: return DRIVE_DOESNOTEXIST in case of non + existent drive. + + * [msdos/int21.c] + INT21_FindFirstFCB: check drive validity to prevent oops. + + * [win32/file.c] + CreateFile32A: duplicate STD_{INPUT,OUTPUT}_HANDLE. + + * [files/dos_fs.c] + Make DOSFS_OpenDir treat "" as "/". + DOSFS_OpenDevice: duplicate STD_{INPUT,OUTPUT}_HANDLE. + + * [windows/dialog.c] + GetNextDlgTabItem32: use last/first item instead of first/last + when hwndCtrl==0. This fixes initial focus. + +Sat Aug 29 02:46:32 1998 Adrian Harvey + + * [include/process.h] [include/process.c] + Renamed PROCESS_SELF to CURRENT_PROCESS_PSEUDOHANDLE in line + with thread constant, and Win32 documentation (which calls it + a pseudohandle.) Made GetCurrentProcess actually use this + constant instead of the value. + + * [include/process.h] [include/thread.h] [scheduler/thread.c] + [scheduler/process.c] [scheduler/handle.c] + Modify HANDLE_GetObjPtr to understand about + CURRENT_THREAD_PSEUDOHANDLE and CURRENT_PROCESS_PSEUDOHANDLE. + This allows DuplicateHandle to do the correct thing with these + handles. Removed now duplicate functionality from THREAD_GetPtr + and PROCESS_GetPtr. + + * [loader/ne/segment.c] + Fixed two places where HFILE32s were being created and passed to + 16-bit code. This should unbreak NE self-loading code. + Added two casts to remove compile time warnings. + +Fri Aug 28 21:04:13 1998 Joseph Pranevich + + * [msdos/dosmem.c] [msdos/int2f.c] + Added beginnings of DOS error table. + + * [msdos/int1a.c] + Stub for subfunction 0xb0. + + * [msdos/int10.c] [loader/dos/dosvm.c] + INT 10 support completely rewritten and lots of debugging + added. Now, DOS apps that use INT 10 to write to the screen will + work. (Beyond Zork does, at least. Somewhat.) + + * [include/miscemu.h] [msdos/dosmem.c] [msdos/int21.c] + Another shot at getting MS's generic error message facility + right. + + * [msdos/int21.c] + Command.Com wanted to set its own PSP address. I let it. + +Wed Aug 26 12:26:20 1998 Matthew Toseland + + * [include/file.h] [misc/lzexpand.c] + Fixed LZCopy16 by fixing HFILE16/HFILE32 convertor macros so don't + convert lzw handles. + +Tue Aug 25 22:22:55 1998 Uwe Bonnes + + * [misc/registry.c] + In RegEnumvalue, ivalue == 0 is a legal request and should + return the first entry. + + * [msdos/int21.c] + Add handling for Int21-48/49 in Win16. Makes blinker demo work. + + * [windows/winproc.c] + Add Msg32A<->Msg32W translation for LB_ADDSTRING. + +Tue Aug 25 21:03:31 1998 Kristian Nielsen + + * [windows/win.c] + Fix for SetParent(): MS Windows 3.11 does not clear the WS_CHILD + flag when a child window is reparented to the desktop window. + +Mon Aug 24 20:55:22 1998 Berend Reitsma + + * [controls/menu.c] + Menus created with SetMenuItemInfo and InsertMenuItem should + work now. + +Sun Aug 23 23:23:23 1998 Alex Korobka + + * [controls/combo.c] + Added CB_GETITEMHEIGHT. + + * [windows/winpos.c] + WM_NCHITTEST, SWP_FRAMECHANGED bugfixes. + +Sat Aug 22 21:15:29 1998 Alex Priem + + * [files/profile.c] [include/windows.h] + Added GetPrivateProfileSectionNames[AW],GetPrivateProfileSectionW, + GetPrivateProfileStructW, GetProfileSectionW, + WriteProfileSection[AW], WritePrivateProfileStructW. + ---------------------------------------------------------------------- Sat Aug 22 17:46:19 1998 Ulrich Weigand diff --git a/Makefile.in b/Makefile.in index 3f88e15e2f6..d4433a04005 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,6 +27,7 @@ LIBSUBDIRS = \ tools \ tools/wrc \ controls \ + dlls/comctl32 \ dlls/shell32 \ files \ graphics \ @@ -77,6 +78,7 @@ INSTALLSUBDIRS = $(DOCSUBDIRS) LIBOBJS = \ controls/controls.o \ + dlls/comctl32/comctl32.o \ dlls/shell32/shell32.o \ files/files.o \ graphics/graphics.o \ diff --git a/configure b/configure index 4c6f44cdcf5..d36a6c72188 100755 --- a/configure +++ b/configure @@ -3397,6 +3397,7 @@ Makefile controls/Makefile debugger/Makefile dlls/Makefile +dlls/comctl32/Makefile dlls/shell32/Makefile documentation/Makefile files/Makefile @@ -3534,6 +3535,7 @@ Makefile controls/Makefile debugger/Makefile dlls/Makefile +dlls/comctl32/Makefile dlls/shell32/Makefile documentation/Makefile files/Makefile diff --git a/configure.in b/configure.in index cf1d4147543..d6a0c7831b0 100644 --- a/configure.in +++ b/configure.in @@ -461,6 +461,7 @@ Makefile controls/Makefile debugger/Makefile dlls/Makefile +dlls/comctl32/Makefile dlls/shell32/Makefile documentation/Makefile files/Makefile diff --git a/controls/Makefile.in b/controls/Makefile.in index a49d7101aaf..e2369d6bda1 100644 --- a/controls/Makefile.in +++ b/controls/Makefile.in @@ -8,27 +8,14 @@ MODULE = controls C_SRCS = \ button.c \ combo.c \ - comctl32undoc.c \ - commctrl.c \ desktop.c \ edit.c \ - header.c \ icontitle.c \ listbox.c \ - listview.c \ menu.c \ - pager.c \ - progress.c \ - rebar.c \ scroll.c \ static.c \ - status.c \ - toolbar.c \ - tooltips.c \ - trackbar.c \ - treeview.c \ uitools.c \ - updown.c \ widgets.c all: $(MODULE).o diff --git a/controls/combo.c b/controls/combo.c index 1b8e1d73033..b7a44db68be 100644 --- a/controls/combo.c +++ b/controls/combo.c @@ -129,6 +129,7 @@ static LRESULT COMBO_NCDestroy( LPHEADCOMBO lphc ) return 0; } + /*********************************************************************** * CBCalcPlacement * @@ -142,22 +143,6 @@ static void CBCalcPlacement( LPHEADCOMBO lphc, LPRECT32 lprEdit, /* get combo height and width */ - if( lphc->editHeight ) - size.cy = lphc->editHeight; - else - { - HDC32 hDC = GetDC32( lphc->self->hwndSelf ); - HFONT32 hPrevFont = 0; - - if( lphc->hFont ) hPrevFont = SelectObject32( hDC, lphc->hFont ); - - GetTextExtentPoint32A( hDC, "0", 1, &size); - - size.cy += size.cy / 4 + 4 * SYSMETRICS_CYBORDER; - - if( hPrevFont ) SelectObject32( hDC, hPrevFont ); - ReleaseDC32( lphc->self->hwndSelf, hDC ); - } size.cx = rect.right - rect.left; if( CB_OWNERDRAWN(lphc) ) @@ -181,6 +166,23 @@ static void CBCalcPlacement( LPHEADCOMBO lphc, LPRECT32 lprEdit, } size.cy = u; } + else if( lphc->editHeight ) /* explicitly set height */ + size.cy = lphc->editHeight; + else + { + HDC32 hDC = GetDC32( lphc->self->hwndSelf ); + HFONT32 hPrevFont = 0; + + if( lphc->hFont ) hPrevFont = SelectObject32( hDC, lphc->hFont ); + + GetTextExtentPoint32A( hDC, "0", 1, &size); + + size.cy += size.cy / 4 + 4 * SYSMETRICS_CYBORDER; + + if( hPrevFont ) SelectObject32( hDC, hPrevFont ); + ReleaseDC32( lphc->self->hwndSelf, hDC ); + } + /* calculate text and button placement */ @@ -1419,10 +1421,17 @@ LRESULT WINAPI ComboWndProc( HWND32 hwnd, UINT32 message, return SendMessage32A( lphc->hWndLBox, LB_FINDSTRINGEXACT32, wParam, lParam ); case CB_SETITEMHEIGHT16: - wParam = (INT32)(INT16)wParam; + wParam = (INT32)(INT16)wParam; /* signed integer */ case CB_SETITEMHEIGHT32: return COMBO_SetItemHeight( lphc, (INT32)wParam, (INT32)lParam); + case CB_GETITEMHEIGHT16: + wParam = (INT32)(INT16)wParam; + case CB_GETITEMHEIGHT32: + if( (INT32)wParam >= 0 ) + return SendMessage32A( lphc->hWndLBox, LB_GETITEMHEIGHT32, wParam, 0); + return (lphc->RectEdit.bottom - lphc->RectEdit.top); + case CB_RESETCONTENT16: case CB_RESETCONTENT32: SendMessage32A( lphc->hWndLBox, LB_RESETCONTENT32, 0, 0 ); diff --git a/controls/comctl32undoc.c b/controls/comctl32undoc.c deleted file mode 100644 index aa5c83dc97b..00000000000 --- a/controls/comctl32undoc.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Undocumented functions from COMCTL32.DLL - * - * Copyright 1998 Eric Kohl - * 1998 Juergen Schmied - * NOTES - * All of these functions are UNDOCUMENTED!! And I mean UNDOCUMENTED!!!! - * Do NOT rely on names or contents of undocumented structures and types!!! - * These functions are used by EXPLORER.EXE, IEXPLORE.EXE and - * COMCTL32.DLL (internally). - * - * TODO - * - Fix DSA_InsertItem. - * - Fix DSA_GetItem. - * - Write documentation. - */ - -#include -#include -#include -#include "windows.h" -#include "heap.h" -#include "debug.h" - -typedef struct _DPA_DATA -{ - DWORD dwEntryCount; - DWORD dwMaxCount; - DWORD dwGrow; - LPDWORD ptrs; -} DPA_DATA, *LPDPA_DATA; - - -DWORD WINAPI DPA_Create (DWORD); -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; - - TRACE (commctrl, "(0x%08lx)\n", dwParam); - - 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; -} - - -/************************************************************************** - * ReAlloc [COMCTL32.72] - * - */ - -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 (hComctl32Heap, HEAP_ZERO_MEMORY, - dwParam2); - else - dwPtr = HeapReAlloc (hComctl32Heap, HEAP_ZERO_MEMORY, - dwParam1, dwParam2); - - TRACE (commctrl, "-- ret=0x%08lx\n", (DWORD)dwPtr); - - return dwPtr; -} - - -/************************************************************************** - * Free [COMCTL32.73] - * - */ - -DWORD WINAPI -COMCTL32_Free (LPVOID dwParam) -{ - TRACE (commctrl, "(0x%08lx)\n", (DWORD)dwParam); - HeapFree (hComctl32Heap, 0, dwParam); - - return 0; -} - - -/************************************************************************** - * GetSize [COMCTL32.74] - * - */ - -DWORD WINAPI -COMCTL32_GetSize (LPVOID dwParam) -{ - TRACE (commctrl, "(0x%08lx)\n", (DWORD)dwParam); - return (HeapSize (hComctl32Heap, 0, dwParam)); -} - - - -/************************************************************************** - * Str_SetPtrA [COMCTL32.234] - * - * PARAMS - * dwParam1 [I] - * dwParam2 [I] - */ - -BOOL32 WINAPI -COMCTL32_Str_SetPtrA (LPSTR lpStr, LPVOID *lpPtr) -{ - INT32 len; - LPSTR ptr; - - FIXME (commctrl, "(0x%08lx 0x%08lx)\n", (DWORD)lpStr, (DWORD)lpPtr); - FIXME (commctrl, "(\"%s\" \"%s\")\n", lpStr, (LPSTR)*lpPtr); - - if (lpStr) { - len = lstrlen32A (lpStr); - ptr = COMCTL32_ReAlloc (lpPtr, len + 1); - if (!(ptr)) - return FALSE; - lstrcpy32A (ptr, lpStr); - *lpPtr = ptr; - return TRUE; - } - - if (*lpPtr) { - COMCTL32_Free (*lpPtr); - return TRUE; - } - - 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 - * dwSize [I] size of the array elements - * dwGrow [I] - * RETURNS - * pointer to a array control structure. use this like a handle. - */ - -LPDSA_DATA WINAPI DSA_Create (DWORD dwSize, DWORD dwGrow) -{ LPDSA_DATA dsaPtr; - - TRACE (commctrl, "(size=0x%08lx grow=0x%08lx)\n", dwSize, dwGrow); - - 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 - * dsaPtr [I] pointer to the array control structure - * RETURNS - * TRUE if dsaPtr = NULL or success - * FALSE if failure - */ - -BOOL32 WINAPI DSA_Destroy (const LPDSA_DATA dsaPtr ) -{ TRACE (commctrl, "(%p)\n", dsaPtr); - - if (! dsaPtr) - return FALSE; - - if (dsaPtr->pData && (! COMCTL32_Free(dsaPtr->pData))) - { return FALSE; - } - 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. - */ - -BOOL32 WINAPI DSA_GetItem (const LPDSA_DATA dsaPtr, DWORD dwItem, LPBYTE pDest) -{ BYTE * pSrc; - - 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; - - TRACE (commctrl, "(%p 0x%08lx)\n", dsaPtr, dwItem); - - if ((!dsaPtr) || (dwItem < 0) || (dwItem >= dsaPtr->dwEntryCount)) - return FALSE; - pSrc = dsaPtr->pData + (dsaPtr->dwElementSize * dwItem); - - TRACE (commctrl, "-- ret=%p\n", pSrc); - - 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); - - 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; - } - } - /* 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; -} - -/************************************************************************** - * 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); - - if ( (!dsaPtr) || dwItem<0 ) - return -1; - - for (i=0; idwElementSize;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++; - 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; - - 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); - } - - 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; - - } - 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 -DPA_Create (DWORD dwParam1) -{ - LPDPA_DATA dpaPtr; - - TRACE (commctrl, "(0x%08lx)\n", dwParam1); - - dpaPtr = (LPDPA_DATA)HeapAlloc (SystemHeap, HEAP_ZERO_MEMORY, sizeof(DPA_DATA)); - dpaPtr->dwGrow = dwParam1; - - TRACE (commctrl, "ret=0x%08lx\n", (DWORD)dpaPtr); - - return (DWORD)dpaPtr; -} - - - -DWORD WINAPI -DPA_GetPtr (DWORD dwParam1, DWORD dwParam2) -{ - LPDPA_DATA dpaPtr = (LPDPA_DATA)dwParam1; - - TRACE (commctrl, "(0x%08lx 0x%08lx)\n", dwParam1, dwParam2); - - if (dpaPtr == NULL) - return 0; - if (dpaPtr->ptrs == NULL) - return 0; - if ((dwParam2 < 0) || (dwParam2 >= dpaPtr->dwEntryCount)) - return 0; - - TRACE (commctrl, "ret=0x%08lx\n", (DWORD)dpaPtr->ptrs[dwParam2]); - - return (DWORD)dpaPtr->ptrs[dwParam2]; -} - - - -DWORD WINAPI -DPA_InsertPtr (DWORD dwParam1, DWORD dwParam2, DWORD dwParam3) -{ - LPDPA_DATA dpaPtr = (LPDPA_DATA)dwParam1; - DWORD dwIndex; - - TRACE (commctrl, "(0x%08lx 0x%08lx 0x%lx)\n", - dwParam1, dwParam2, dwParam3); - - if (dpaPtr->ptrs == NULL) { - dpaPtr->ptrs = (LPDWORD)HeapAlloc (SystemHeap, HEAP_ZERO_MEMORY, - dpaPtr->dwGrow * sizeof(LPVOID)); - dpaPtr->dwMaxCount = dpaPtr->dwGrow; - dwIndex = 0; - dpaPtr->ptrs[dwIndex] = dwParam3; - } - else { - FIXME (commctrl, "adding to existing array! stub!\n"); - - - dwIndex = dwParam2; - } - - dpaPtr->dwEntryCount++; - - return (dwIndex); -} - - -/************************************************************************** - * DPA_CreateEx [COMCTL32.340] - * - */ - -DWORD WINAPI -DPA_CreateEx (DWORD dwParam1, DWORD dwParam2) -{ - FIXME (commctrl, "(0x%08lx 0x%08lx)\n", - dwParam1, dwParam2); - - return 0; -} - - -/************************************************************************** - * SendNotify [COMCTL32.341] - * - */ - -DWORD WINAPI -COMCTL32_SendNotify (DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4) -{ - FIXME (commctrl, "(0x%08lx 0x%08lx 0x%08lx 0x%08lx)\n", - dw1, dw2, dw3, dw4); - - return 0; -} - - - -/************************************************************************** - * StrChrA [COMCTL32.350] - * - */ - -LPSTR WINAPI -COMCTL32_StrChrA (LPCSTR lpString, CHAR cChar) -{ - return strchr (lpString, cChar); -} - - -/************************************************************************** - * StrStrIA [COMCTL32.355] - */ - -LPSTR WINAPI -COMCTL32_StrStrIA (LPCSTR lpStr1, LPCSTR lpStr2) -{ - INT32 len1, len2, i; - CHAR first; - - if (*lpStr2 == 0) - return ((LPSTR)lpStr1); - len1 = 0; - while (lpStr1[len1] != 0) ++len1; - len2 = 0; - while (lpStr2[len2] != 0) ++len2; - if (len2 == 0) - return ((LPSTR)(lpStr1 + len1)); - first = tolower (*lpStr2); - while (len1 >= len2) { - if (tolower(*lpStr1) == first) { - for (i = 1; i < len2; ++i) - if (tolower (lpStr1[i]) != tolower(lpStr2[i])) - break; - if (i >= len2) - return ((LPSTR)lpStr1); - } - ++lpStr1; --len1; - } - return (NULL); -} - - -/************************************************************************** - * StrToIntA [COMCTL32.357] Converts a string to a signed integer. - */ - -INT32 WINAPI -COMCTL32_StrToIntA (LPSTR lpString) -{ - return atoi(lpString); -} - diff --git a/controls/edit.c b/controls/edit.c index bfb724a5311..8a90e01c1c7 100644 --- a/controls/edit.c +++ b/controls/edit.c @@ -514,6 +514,7 @@ LRESULT WINAPI EditWndProc( HWND32 hwnd, UINT32 msg, case EM_REPLACESEL32: DPRINTF_EDIT_MSG32("EM_REPLACESEL"); EDIT_EM_ReplaceSel(wnd, es, (BOOL32)wParam, (LPCSTR)lParam); + result = 1; break; /* message 0x00c3 missing from specs */ diff --git a/controls/listbox.c b/controls/listbox.c index 25af76505ba..9571034471e 100644 --- a/controls/listbox.c +++ b/controls/listbox.c @@ -312,7 +312,7 @@ static void LISTBOX_UpdateSize( WND *wnd, LB_DESCR *descr ) GetClientRect32( wnd->hwndSelf, &rect ); descr->width = rect.right - rect.left; descr->height = rect.bottom - rect.top; - if (!(descr->style & LBS_NOINTEGRALHEIGHT)) + if (!(descr->style & LBS_NOINTEGRALHEIGHT) && !IS_OWNERDRAW(descr)) { if ((descr->height > descr->item_height) && (descr->height % descr->item_height)) diff --git a/controls/listview.c b/controls/listview.c deleted file mode 100644 index 1c600c5155d..00000000000 --- a/controls/listview.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Listview control - * - * Copyright 1998 Eric Kohl - * - * NOTES - * This is just a dummy control. An author is needed! Any volunteers? - * I will only improve this control once in a while. - * Eric - * - * TODO: - * - All messages. - * - All notifications. - */ - -#include "windows.h" -#include "commctrl.h" -#include "listview.h" -#include "heap.h" -#include "win.h" -#include "debug.h" - - -#define LISTVIEW_GetInfoPtr(wndPtr) ((LISTVIEW_INFO *)wndPtr->wExtra[0]) - - -static VOID -LISTVIEW_Refresh (WND *wndPtr, HDC32 hdc) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - - -} - - - -static LRESULT -LISTVIEW_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - if (!(infoPtr)) return FALSE; - - /* set background color */ - infoPtr->clrBk = (COLORREF)lParam; - - return TRUE; -} - - -static LRESULT -LISTVIEW_SetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - FIXME (listview, "(0x%08x 0x%08lx)\n", wParam, lParam); - - return 0; -} - - -static LRESULT -LISTVIEW_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - /* initialize info structure */ - infoPtr->clrBk = CLR_NONE; - - return 0; -} - - -static LRESULT -LISTVIEW_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - - return 0; -} - - -static LRESULT -LISTVIEW_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - if (infoPtr->clrBk == CLR_NONE) { - return SendMessage32A (GetParent32 (wndPtr->hwndSelf), - WM_ERASEBKGND, wParam, lParam); - } - else { - RECT32 rect; - HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk); - GetClientRect32 (wndPtr->hwndSelf, &rect); - FillRect32 ((HDC32)wParam, &rect, hBrush); - DeleteObject32 (hBrush); - return FALSE; - } - return FALSE; -} - - -static LRESULT -LISTVIEW_NCCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr; - - /* allocate memory for info structure */ - infoPtr = (LISTVIEW_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, - sizeof(LISTVIEW_INFO)); - wndPtr->wExtra[0] = (DWORD)infoPtr; - - if (infoPtr == NULL) { - ERR (listview, "could not allocate info memory!\n"); - return 0; - } - - if ((LISTVIEW_INFO*)wndPtr->wExtra[0] != infoPtr) { - ERR (listview, "pointer assignment error!\n"); - return 0; - } - - return DefWindowProc32A (wndPtr->hwndSelf, WM_NCCREATE, wParam, lParam); -} - - -static LRESULT -LISTVIEW_NCDestroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); - - - - - /* free list view info data */ - HeapFree (GetProcessHeap (), 0, infoPtr); - - return 0; -} - - -static LRESULT -LISTVIEW_Paint (WND *wndPtr, WPARAM32 wParam) -{ - HDC32 hdc; - PAINTSTRUCT32 ps; - - hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam; - LISTVIEW_Refresh (wndPtr, hdc); - if (!wParam) - EndPaint32 (wndPtr->hwndSelf, &ps); - return 0; -} - - -LRESULT WINAPI -ListviewWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) -{ - WND *wndPtr = WIN_FindWndPtr(hwnd); - - switch (uMsg) - { - - case LVM_SETBKCOLOR: - return LISTVIEW_SetBkColor (wndPtr, wParam, lParam); - - - case LVM_SETIMAGELIST: - return LISTVIEW_SetImageList (wndPtr, wParam, lParam); - - - - -// case WM_CHAR: -// case WM_COMMAND: - - case WM_CREATE: - return LISTVIEW_Create (wndPtr, wParam, lParam); - - case WM_DESTROY: - return LISTVIEW_Destroy (wndPtr, wParam, lParam); - - case WM_ERASEBKGND: - return LISTVIEW_EraseBackground (wndPtr, wParam, lParam); - -// case WM_GETDLGCODE: -// case WM_GETFONT: -// case WM_HSCROLL: - -// case WM_MOUSEMOVE: -// return LISTVIEW_MouseMove (wndPtr, wParam, lParam); - - case WM_NCCREATE: - return LISTVIEW_NCCreate (wndPtr, wParam, lParam); - - case WM_NCDESTROY: - return LISTVIEW_NCDestroy (wndPtr, wParam, lParam); - -// case WM_NOTIFY: - - case WM_PAINT: - return LISTVIEW_Paint (wndPtr, wParam); - -// case WM_RBUTTONDOWN: -// case WM_SETFOCUS: -// case WM_SETFONT: -// case WM_SETREDRAW: -// case WM_TIMER: -// case WM_VSCROLL: -// case WM_WINDOWPOSCHANGED: -// case WM_WININICHANGE: - - default: - if (uMsg >= WM_USER) - ERR (listview, "unknown msg %04x wp=%08x lp=%08lx\n", - uMsg, wParam, lParam); - return DefWindowProc32A (hwnd, uMsg, wParam, lParam); - } - return 0; -} - - -void -LISTVIEW_Register (void) -{ - WNDCLASS32A wndClass; - - if (GlobalFindAtom32A (WC_LISTVIEW32A)) return; - - ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); - wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; - wndClass.lpfnWndProc = (WNDPROC32)ListviewWindowProc; - wndClass.cbClsExtra = 0; - wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); - wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); - wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1); - wndClass.lpszClassName = WC_LISTVIEW32A; - - RegisterClass32A (&wndClass); -} - diff --git a/controls/menu.c b/controls/menu.c index 45a25c60b7d..894096404bd 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -760,7 +760,7 @@ static void MENU_MenuBarCalcSize( HDC32 hdc, LPRECT32 lprect, if ((lprect == NULL) || (lppop == NULL)) return; if (lppop->nItems == 0) return; - TRACE(menu,"MENU_MenuBarCalcSize left=%d top=%d right=%d bottom=%d\n", + TRACE(menu,"left=%d top=%d right=%d bottom=%d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); lppop->Width = lprect->right - lprect->left; lppop->Height = 0; @@ -1102,7 +1102,7 @@ static void MENU_DrawPopupMenu( HWND32 hwnd, HDC32 hdc, HMENU32 hmenu ) SetROP232( hdc, ropPrev ); } else - TWEAK_DrawReliefRect95(hdc, &rect); + DrawEdge32 (hdc, &rect, EDGE_RAISED, BF_RECT); /* draw menu items */ @@ -2968,6 +2968,7 @@ UINT32 WINAPI GetMenuItemID32( HMENU32 hMenu, INT32 nPos ) if (!(menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu))) return -1; if ((nPos < 0) || (nPos >= menu->nItems)) return -1; + if (menu->items[nPos].fType & MF_POPUP) return -1; return menu->items[nPos].wID; } @@ -3814,8 +3815,21 @@ static BOOL32 SetMenuItemInfo32_common(MENUITEM * menu, if (lpmii->fMask & MIIM_ID) menu->wID = lpmii->wID; - if (lpmii->fMask & MIIM_SUBMENU) + if (lpmii->fMask & MIIM_SUBMENU) { menu->hSubMenu = lpmii->hSubMenu; + if (menu->hSubMenu) { + POPUPMENU *subMenu = (POPUPMENU *)USER_HEAP_LIN_ADDR((UINT16)menu->hSubMenu); + if (IS_A_MENU(subMenu)) { + subMenu->wFlags |= MF_POPUP; + menu->fType |= MF_POPUP; + } + else + /* FIXME: Return an error ? */ + menu->fType &= ~MF_POPUP; + } + else + menu->fType &= ~MF_POPUP; + } if (lpmii->fMask & MIIM_CHECKMARKS) { diff --git a/controls/static.c b/controls/static.c index ac53bbd4b06..70c65f03e84 100644 --- a/controls/static.c +++ b/controls/static.c @@ -271,7 +271,6 @@ LRESULT WINAPI StaticWndProc( HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, case WM_GETDLGCODE: return DLGC_STATIC; - return infoPtr->hIcon; case STM_GETIMAGE: case STM_GETICON16: case STM_GETICON32: @@ -283,6 +282,7 @@ LRESULT WINAPI StaticWndProc( HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, InvalidateRect32( hWnd, NULL, FALSE ); UpdateWindow32( hWnd ); break; + case STM_SETICON16: case STM_SETICON32: lResult = STATIC_SetIcon( wndPtr, (HICON16)wParam ); diff --git a/controls/trackbar.c b/controls/trackbar.c deleted file mode 100644 index 48e587ba437..00000000000 --- a/controls/trackbar.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Trackbar control - * - * Copyright 1998 Eric Kohl - * - * NOTES - * This is just a dummy control. An author is needed! Any volunteers? - * I will only improve this control once in a while. - * Eric - * - * TODO: - * - All messages. - * - All notifications. - */ - -#include "windows.h" -#include "commctrl.h" -#include "trackbar.h" -#include "heap.h" -#include "win.h" -#include "debug.h" - - -#define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)wndPtr->wExtra[0]) - - -static VOID -TRACKBAR_Refresh (WND *wndPtr, HDC32 hdc) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - RECT32 rect; - - GetClientRect32 (wndPtr->hwndSelf, &rect); - - /* draw channel */ - DrawEdge32 (hdc, &infoPtr->rcChannel, EDGE_SUNKEN, BF_RECT); - - /* draw thumb */ - if (!(wndPtr->dwStyle & TBS_NOTHUMB)) { - - } - - /* draw ticks */ - if (!(wndPtr->dwStyle & TBS_NOTICKS)) { - - } - - if (infoPtr->bFocus) - DrawFocusRect32 (hdc, &rect); -} - - -static LRESULT -TRACKBAR_ClearSel (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - infoPtr->nSelMin = 0; - infoPtr->nSelMax = 0; - - if ((BOOL32)wParam) { - HDC32 hdc = GetDC32 (wndPtr->hwndSelf); - TRACKBAR_Refresh (wndPtr, hdc); - ReleaseDC32 (wndPtr->hwndSelf, hdc); - } - - return 0; -} - - -// << TRACKBAR_ClearTics >> -// << TRACKBAR_GetChannelRect >> - - -static LRESULT -TRACKBAR_GetLineSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nLineSize; -} - - -// << TRACKBAR_GetNumTics >> - - -static LRESULT -TRACKBAR_GetPageSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nPageSize; -} - - -static LRESULT -TRACKBAR_GetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nPos; -} - - -// << TRACKBAR_GetPTics >> - - -static LRESULT -TRACKBAR_GetRangeMax (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nRangeMax; -} - - -static LRESULT -TRACKBAR_GetRangeMin (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nRangeMin; -} - - -static LRESULT -TRACKBAR_GetSelEnd (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nSelMax; -} - - -static LRESULT -TRACKBAR_GetSelStart (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nSelMin; -} - - -static LRESULT -TRACKBAR_GetThumbLength (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - return infoPtr->nThumbLen; -} - - - - - - -static LRESULT -TRACKBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr; - - infoPtr = (TRACKBAR_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, - sizeof(TRACKBAR_INFO)); - wndPtr->wExtra[0] = (DWORD)infoPtr; - - - /* default values */ - infoPtr->nRangeMin = 0; - infoPtr->nRangeMax = 100; - infoPtr->nLineSize = 1; - infoPtr->nPageSize = 20; - infoPtr->nSelMin = 0; - infoPtr->nSelMax = 0; - infoPtr->nPos = 0; - infoPtr->nThumbLen = 23; /* initial thumb length */ - - - return 0; -} - - -static LRESULT -TRACKBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - - - - HeapFree (GetProcessHeap (), 0, infoPtr); - - return 0; -} - - -static LRESULT -TRACKBAR_KillFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - HDC32 hdc; - - infoPtr->bFocus = FALSE; - - hdc = GetDC32 (wndPtr->hwndSelf); - TRACKBAR_Refresh (wndPtr, hdc); - ReleaseDC32 (wndPtr->hwndSelf, hdc); - - return 0; -} - - -static LRESULT -TRACKBAR_LButtonDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - - SetFocus32 (wndPtr->hwndSelf); - - return 0; -} - - -static LRESULT -TRACKBAR_Paint (WND *wndPtr, WPARAM32 wParam) -{ - HDC32 hdc; - PAINTSTRUCT32 ps; - - hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam; - TRACKBAR_Refresh (wndPtr, hdc); - if(!wParam) - EndPaint32 (wndPtr->hwndSelf, &ps); - return 0; -} - - -static LRESULT -TRACKBAR_SetFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - HDC32 hdc; - - infoPtr->bFocus = TRUE; - - hdc = GetDC32 (wndPtr->hwndSelf); - TRACKBAR_Refresh (wndPtr, hdc); - ReleaseDC32 (wndPtr->hwndSelf, hdc); - - return 0; -} - - -static LRESULT -TRACKBAR_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) -{ - TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); - RECT32 rect; - - GetClientRect32 (wndPtr->hwndSelf, &rect); - - /* calculate channel rect */ - if (wndPtr->dwStyle & TBS_VERT) { - infoPtr->rcChannel.top = rect.top + 8; - infoPtr->rcChannel.bottom = rect.bottom - 8; - - /* FIXME */ - infoPtr->rcChannel.left = rect.left + 10; - infoPtr->rcChannel.right = rect.left + 14; - - } - else { - infoPtr->rcChannel.left = rect.left + 8; - infoPtr->rcChannel.right = rect.right - 8; - - /* FIXME */ - if (wndPtr->dwStyle & TBS_BOTH) { - infoPtr->rcChannel.top = rect.bottom / 2 - 2; - infoPtr->rcChannel.bottom = rect.bottom / 2 + 2; - - } - else if (wndPtr->dwStyle & TBS_TOP) { - infoPtr->rcChannel.top = rect.top + 10; - infoPtr->rcChannel.bottom = rect.top + 14; - - } - else { - /* TBS_BOTTOM */ - infoPtr->rcChannel.top = rect.bottom - 14; - infoPtr->rcChannel.bottom = rect.bottom - 10; - } - } - - return 0; -} - - -// << TRACKBAR_Timer >> -// << TRACKBAR_WinIniChange >> - - -LRESULT WINAPI -TrackbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) -{ - WND *wndPtr = WIN_FindWndPtr(hwnd); - - switch (uMsg) - { - case TBM_CLEARSEL: - return TRACKBAR_ClearSel (wndPtr, wParam, lParam); - -// case TBM_CLEARTICS: -// case TBM_GETBUDDY: -// case TBM_GETCHANNELRECT: - - case TBM_GETLINESIZE: - return TRACKBAR_GetLineSize (wndPtr, wParam, lParam); - -// case TBM_GETNUMTICS: - - case TBM_GETPAGESIZE: - return TRACKBAR_GetPageSize (wndPtr, wParam, lParam); - - case TBM_GETPOS: - return TRACKBAR_GetPos (wndPtr, wParam, lParam); - -// case TBM_GETPTICS: - - case TBM_GETRANGEMAX: - return TRACKBAR_GetRangeMax (wndPtr, wParam, lParam); - - case TBM_GETRANGEMIN: - return TRACKBAR_GetRangeMin (wndPtr, wParam, lParam); - - case TBM_GETSELEND: - return TRACKBAR_GetSelEnd (wndPtr, wParam, lParam); - - case TBM_GETSELSTART: - return TRACKBAR_GetSelStart (wndPtr, wParam, lParam); - - case TBM_GETTHUMBLENGTH: - return TRACKBAR_GetThumbLength (wndPtr, wParam, lParam); - -// case TBM_GETTHUMBRECT: -// case TBM_GETTIC: -// case TBM_GETTICPOS: -// case TBM_GETTOOLTIPS: -// case TBM_GETUNICODEFORMAT: -// case TBM_SETBUDDY: -// case TBM_SETPAGESIZE: -// case TBM_SETPOS: -// case TBM_SETRANGE: -// case TBM_SETRANGEMAX: -// case TBM_SETRANGEMIN: -// case TBM_SETSEL: -// case TBM_SETSELEND: -// case TBM_SETSELSTART: -// case TBM_SETTHUMBLENGTH: -// case TBM_SETTIC: -// case TBM_SETTICFREQ: -// case TBM_SETTIPSIDE: -// case TBM_SETTOOLTIPS: -// case TBM_SETUNICODEFORMAT: - - -// case WM_CAPTURECHANGED: - - case WM_CREATE: - return TRACKBAR_Create (wndPtr, wParam, lParam); - - case WM_DESTROY: - return TRACKBAR_Destroy (wndPtr, wParam, lParam); - -// case WM_ENABLE: - -// case WM_ERASEBKGND: -// return 0; - - case WM_GETDLGCODE: - return DLGC_WANTARROWS; - -// case WM_KEYDOWN: - -// case WM_KEYUP: - - case WM_KILLFOCUS: - return TRACKBAR_KillFocus (wndPtr, wParam, lParam); - - case WM_LBUTTONDOWN: - return TRACKBAR_LButtonDown (wndPtr, wParam, lParam); - -// case WM_LBUTTONUP: - -// case WM_MOUSEMOVE: -// return TRACKBAR_MouseMove (wndPtr, wParam, lParam); - - case WM_PAINT: - return TRACKBAR_Paint (wndPtr, wParam); - - case WM_SETFOCUS: - return TRACKBAR_SetFocus (wndPtr, wParam, lParam); - - case WM_SIZE: - return TRACKBAR_Size (wndPtr, wParam, lParam); - -// case WM_TIMER: - -// case WM_WININICHANGE: - - default: - if (uMsg >= WM_USER) - ERR (trackbar, "unknown msg %04x wp=%08x lp=%08lx\n", - uMsg, wParam, lParam); - return DefWindowProc32A (hwnd, uMsg, wParam, lParam); - } - return 0; -} - - -void -TRACKBAR_Register (void) -{ - WNDCLASS32A wndClass; - - if (GlobalFindAtom32A (TRACKBAR_CLASS32A)) return; - - ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); - wndClass.style = CS_GLOBALCLASS; - wndClass.lpfnWndProc = (WNDPROC32)TrackbarWindowProc; - wndClass.cbClsExtra = 0; - wndClass.cbWndExtra = sizeof(TRACKBAR_INFO *); - wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); - wndClass.hbrBackground = (HBRUSH32)(COLOR_3DFACE + 1); - wndClass.lpszClassName = TRACKBAR_CLASS32A; - - RegisterClass32A (&wndClass); -} - diff --git a/controls/widgets.c b/controls/widgets.c index 20ca3471aac..51fe1bc0329 100644 --- a/controls/widgets.c +++ b/controls/widgets.c @@ -7,7 +7,6 @@ #include #include "win.h" -#include "commctrl.h" #include "button.h" #include "static.h" #include "scroll.h" diff --git a/dlls/Makefile.in b/dlls/Makefile.in index efbafbcf272..67e3a95c531 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -1,4 +1,5 @@ SUBDIRS = \ + comctl32 \ shell32 all: $(SUBDIRS) diff --git a/dlls/comctl32/Makefile.in b/dlls/comctl32/Makefile.in new file mode 100644 index 00000000000..8c7b770fa3d --- /dev/null +++ b/dlls/comctl32/Makefile.in @@ -0,0 +1,32 @@ +DEFS = @DLLFLAGS@ -D__WINE__ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = comctl32 + +C_SRCS = \ + animate.c \ + comboex.c \ + comctl32undoc.c \ + commctrl.c \ + header.c \ + hotkey.c \ + imagelist.c \ + listview.c \ + pager.c \ + progress.c \ + rebar.c \ + status.c \ + tab.c \ + toolbar.c \ + tooltips.c \ + trackbar.c \ + treeview.c \ + updown.c + +all: $(MODULE).o + +@MAKE_RULES@ + +### Dependencies: diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c new file mode 100644 index 00000000000..9303711f192 --- /dev/null +++ b/dlls/comctl32/animate.c @@ -0,0 +1,225 @@ +/* + * Animation control + * + * Copyright 1998 Eric Kohl + * + * NOTES + * This is just a dummy control. An author is needed! Any volunteers? + * I will only improve this control once in a while. + * Eric + * + * TODO: + * - All messages. + * - All notifications. + */ + +#include "windows.h" +#include "commctrl.h" +#include "animate.h" +#include "win.h" +#include "debug.h" + + +#define ANIMATE_GetInfoPtr(wndPtr) ((ANIMATE_INFO *)wndPtr->wExtra[0]) + + +static LRESULT +ANIMATE_Open32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); + + if (!lParam) { + + FIXME (animate, "close avi: empty stub!\n"); + + return TRUE; + } + + if (HIWORD(lParam)) { + + FIXME (animate, "(\"%s\") empty stub!\n", (LPSTR)lParam); + + } + else { + + FIXME (animate, "(%u) empty stub!\n", (WORD)LOWORD(lParam)); + + } + + + return TRUE; +} + + +static LRESULT +ANIMATE_Play (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); + INT32 nFrom = (INT32)LOWORD(lParam); + INT32 nTo = (INT32)HIWORD(lParam); + INT32 nRepeat = (INT32)wParam; + +#if 0 + /* nothing opened */ + if (...) + return FALSE; +#endif + + if (nRepeat == -1) { + + FIXME (animate, "(loop from=%d to=%d) empty stub!\n", + nFrom, nTo); + + } + else { + + FIXME (animate, "(repeat=%d from=%d to=%d) empty stub!\n", + nRepeat, nFrom, nTo); + + } + + + return TRUE; +} + + +static LRESULT +ANIMATE_Stop (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); + +#if 0 + /* nothing opened */ + if (...) + return FALSE; +#endif + + return TRUE; +} + + + +static LRESULT +ANIMATE_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + ANIMATE_INFO *infoPtr; + + /* allocate memory for info structure */ + infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc (sizeof(ANIMATE_INFO)); + wndPtr->wExtra[0] = (DWORD)infoPtr; + + if (infoPtr == NULL) { + ERR (animate, "could not allocate info memory!\n"); + return 0; + } + + if ((ANIMATE_INFO*)wndPtr->wExtra[0] != infoPtr) { + ERR (animate, "pointer assignment error!\n"); + return 0; + } + + /* set default settings */ + + + return 0; +} + + +static LRESULT +ANIMATE_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); + + + + + /* free animate info data */ + COMCTL32_Free (infoPtr); + + return 0; +} + + +#if 0 +static LRESULT +ANIMATE_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); +/* + HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk); + RECT32 rect; + + GetClientRect32 (wndPtr->hwndSelf, &rect); + FillRect32 ((HDC32)wParam, &rect, hBrush); + DeleteObject32 (hBrush); +*/ + return TRUE; +} +#endif + + + +LRESULT WINAPI +ANIMATE_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + + switch (uMsg) + { + case ACM_OPEN32A: + return ANIMATE_Open32A (wndPtr, wParam, lParam); + +// case ACM_OPEN32W: +// return ANIMATE_Open32W (wndPtr, wParam, lParam); + + case ACM_PLAY: + return ANIMATE_Play (wndPtr, wParam, lParam); + + case ACM_STOP: + return ANIMATE_Stop (wndPtr, wParam, lParam); + + + case WM_CREATE: + return ANIMATE_Create (wndPtr, wParam, lParam); + + case WM_DESTROY: + return ANIMATE_Destroy (wndPtr, wParam, lParam); + +// case WM_ERASEBKGND: +// return ANIMATE_EraseBackground (wndPtr, wParam, lParam); + +// case WM_NCCREATE: +// case WM_NCHITTEST: +// case WM_PAINT: +// case WM_SIZE: +// case WM_STYLECHANGED: +// case WM_TIMER: + + default: + if (uMsg >= WM_USER) + ERR (animate, "unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); + return DefWindowProc32A (hwnd, uMsg, wParam, lParam); + } + return 0; +} + + +void +ANIMATE_Register (void) +{ + WNDCLASS32A wndClass; + + if (GlobalFindAtom32A (ANIMATE_CLASS32A)) return; + + ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); + wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; + wndClass.lpfnWndProc = (WNDPROC32)ANIMATE_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = sizeof(ANIMATE_INFO *); + wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); + wndClass.hbrBackground = (HBRUSH32)(COLOR_BTNFACE + 1); + wndClass.lpszClassName = ANIMATE_CLASS32A; + + RegisterClass32A (&wndClass); +} diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c new file mode 100644 index 00000000000..7c7dc900b02 --- /dev/null +++ b/dlls/comctl32/comboex.c @@ -0,0 +1,283 @@ +/* + * ComboBoxEx control + * + * Copyright 1998 Eric Kohl + * + * NOTES + * This is just a dummy control. An author is needed! Any volunteers? + * I will only improve this control once in a while. + * Eric + * + * TODO: + * - All messages. + * - All notifications. + * + * FIXME: + * - should include "combo.h" + */ + +#include "windows.h" +#include "commctrl.h" +#include "comboex.h" +#include "win.h" +#include "debug.h" + +#define ID_CB_EDIT 1001 + +#define COMBOEX_GetInfoPtr(wndPtr) ((COMBOEX_INFO *)wndPtr->wExtra[0]) + + +// << COMBOEX_DeleteItem >> + + +__inline__ static LRESULT +COMBOEX_GetComboControl (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + + TRACE (comboex, "\n"); + + return (LRESULT)infoPtr->hwndCombo; +} + + +__inline__ static LRESULT +COMBOEX_GetEditControl (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + + if ((wndPtr->dwStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWN) + return 0; + + FIXME (comboex, "-- 0x%x\n", GetDlgItem32 (infoPtr->hwndCombo, ID_CB_EDIT)); + + return (LRESULT)GetDlgItem32 (infoPtr->hwndCombo, ID_CB_EDIT); +} + + +__inline__ static LRESULT +COMBOEX_GetExtendedStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + + return (LRESULT)infoPtr->dwExtStyle; +} + + +__inline__ static LRESULT +COMBOEX_GetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + + TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); + + return (LRESULT)infoPtr->himl; +} + + + + +static LRESULT +COMBOEX_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + + FIXME (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); + + return -1; +} + + + +static LRESULT +COMBOEX_SetExtendedStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + DWORD dwTemp; + + TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); + + dwTemp = infoPtr->dwExtStyle; + + if ((DWORD)wParam) { + infoPtr->dwExtStyle = (infoPtr->dwExtStyle & ~(DWORD)wParam) | (DWORD)lParam; + } + else + infoPtr->dwExtStyle = (DWORD)lParam; + + /* FIXME: repaint?? */ + + return (LRESULT)dwTemp; +} + + +__inline__ static LRESULT +COMBOEX_SetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + HIMAGELIST himlTemp; + + TRACE (comboex, "(0x%08x 0x%08lx)\n", wParam, lParam); + + himlTemp = infoPtr->himl; + infoPtr->himl = (HIMAGELIST)lParam; + + return (LRESULT)himlTemp; +} + + + + +static LRESULT +COMBOEX_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr; + DWORD dwComboStyle; + + /* allocate memory for info structure */ + infoPtr = (COMBOEX_INFO *)COMCTL32_Alloc (sizeof(COMBOEX_INFO)); + wndPtr->wExtra[0] = (DWORD)infoPtr; + + if (infoPtr == NULL) { + ERR (listview, "could not allocate info memory!\n"); + return 0; + } + + if ((COMBOEX_INFO*)wndPtr->wExtra[0] != infoPtr) { + ERR (listview, "pointer assignment error!\n"); + return 0; + } + + + /* initialize info structure */ + + + /* create combo box */ + dwComboStyle = + wndPtr->dwStyle & (CBS_SIMPLE|CBS_DROPDOWN|CBS_DROPDOWNLIST|WS_CHILD); + + infoPtr->hwndCombo = + CreateWindow32A ("ComboBox", "", + WS_CHILD | WS_VISIBLE | CBS_OWNERDRAWFIXED | dwComboStyle, + 0, 0, 0, 0, wndPtr->hwndSelf, (HMENU32)1, + wndPtr->hInstance, NULL); + + + return 0; +} + + +static LRESULT +COMBOEX_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + + + if (infoPtr->hwndCombo) + DestroyWindow32 (infoPtr->hwndCombo); + + + + + /* free comboex info data */ + COMCTL32_Free (infoPtr); + + return 0; +} + + +static LRESULT +COMBOEX_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr(wndPtr); + RECT32 rect; + + GetClientRect32 (wndPtr->hwndSelf, &rect); + + MoveWindow32 (infoPtr->hwndCombo, 0, 0, rect.right -rect.left, + rect.bottom - rect.top, TRUE); + + return 0; +} + + +LRESULT WINAPI +COMBOEX_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + + switch (uMsg) + { +// case CBEM_DELETEITEM: + + case CBEM_GETCOMBOCONTROL: + return COMBOEX_GetComboControl (wndPtr, wParam, lParam); + + case CBEM_GETEDITCONTROL: + return COMBOEX_GetEditControl (wndPtr, wParam, lParam); + + case CBEM_GETEXTENDEDSTYLE: + return COMBOEX_GetExtendedStyle (wndPtr, wParam, lParam); + + case CBEM_GETIMAGELIST: + return COMBOEX_GetImageList (wndPtr, wParam, lParam); + +// case CBEM_GETITEM32A: +// case CBEM_GETITEM32W: +// case CBEM_GETUNICODEFORMAT: +// case CBEM_HASEDITCHANGED: + + case CBEM_INSERTITEM32A: + return COMBOEX_InsertItem32A (wndPtr, wParam, lParam); + +// case CBEM_INSERTITEM32W: + + case CBEM_SETEXTENDEDSTYLE: + return COMBOEX_SetExtendedStyle (wndPtr, wParam, lParam); + + case CBEM_SETIMAGELIST: + return COMBOEX_SetImageList (wndPtr, wParam, lParam); + +// case CBEM_SETITEM32A: +// case CBEM_SETITEM32W: +// case CBEM_SETUNICODEFORMAT: + + + case WM_CREATE: + return COMBOEX_Create (wndPtr, wParam, lParam); + + case WM_DESTROY: + return COMBOEX_Destroy (wndPtr, wParam, lParam); + + case WM_SIZE: + return COMBOEX_Size (wndPtr, wParam, lParam); + + default: + if (uMsg >= WM_USER) + ERR (comboex, "unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); + return DefWindowProc32A (hwnd, uMsg, wParam, lParam); + } + return 0; +} + + +void +COMBOEX_Register (void) +{ + WNDCLASS32A wndClass; + + if (GlobalFindAtom32A (WC_COMBOBOXEX32A)) return; + + ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); + wndClass.style = CS_GLOBALCLASS; + wndClass.lpfnWndProc = (WNDPROC32)COMBOEX_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = sizeof(COMBOEX_INFO *); + wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); + wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1); + wndClass.lpszClassName = WC_COMBOBOXEX32A; + + RegisterClass32A (&wndClass); +} + diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c new file mode 100644 index 00000000000..e45f77f0035 --- /dev/null +++ b/dlls/comctl32/comctl32undoc.c @@ -0,0 +1,1269 @@ +/* + * Undocumented functions from COMCTL32.DLL + * + * Copyright 1998 Eric Kohl + * 1998 Juergen Schmied + * NOTES + * All of these functions are UNDOCUMENTED!! And I mean UNDOCUMENTED!!!! + * Do NOT rely on names or contents of undocumented structures and types!!! + * These functions are used by EXPLORER.EXE, IEXPLORE.EXE and + * COMCTL32.DLL (internally). + * + * TODO + * - Write documentation. + */ + +#include +#include +#include +#include "windows.h" +#include "commctrl.h" +#include "heap.h" +#include "debug.h" + + +CRITICAL_SECTION cs_comctl_alloc; +HANDLE32 hComctl32Heap = 0; + + +/************************************************************************** + * Alloc [COMCTL32.71] + * + * Allocates memory block from the dll's local heap + * + * PARAMS + * dwSize [I] size of the allocated memory block + * + * RETURNS + * Success: pointer to allocated memory block + * Failure: NULL + */ + +LPVOID WINAPI +COMCTL32_Alloc (DWORD dwSize) +{ + LPVOID lpPtr; + + TRACE (commctrl, "(0x%lx)\n", dwSize); + + if (hComctl32Heap == 0) { + EnterCriticalSection ((void*)&cs_comctl_alloc); + hComctl32Heap = HeapCreate (0, 1, 0x4000000); + LeaveCriticalSection ((void*)&cs_comctl_alloc); + TRACE (commctrl, "Heap created: 0x%x\n", hComctl32Heap); + if (!hComctl32Heap) + return NULL; + } + + lpPtr = HeapAlloc (hComctl32Heap, HEAP_ZERO_MEMORY, dwSize); + TRACE (commctrl, "-- ret=%p\n", lpPtr); + return lpPtr; +} + + +/************************************************************************** + * ReAlloc [COMCTL32.72] + * + * Changes the size of an allocated memory block or allocates a memory + * block using the dll's local heap. + * + * PARAMS + * lpSrc [I] pointer to memory block which will be resized + * dwSize [I] new size of the memory block. + * + * RETURNS + * Success: pointer to the resized memory block + * Failure: NULL + * + * NOTES + * If lpSrc is a NULL-pointer, then COMCTL32_ReAlloc allocates a memory + * block like COMCTL32_Alloc. + */ + +LPVOID WINAPI +COMCTL32_ReAlloc (LPVOID lpSrc, DWORD dwSize) +{ + LPVOID lpDest; + + TRACE (commctrl, "(%p 0x%08lx)\n", lpSrc, dwSize); + + if (hComctl32Heap == 0) { + EnterCriticalSection ((void*)&cs_comctl_alloc); + hComctl32Heap = HeapCreate (0, 1, 0x4000000); + LeaveCriticalSection ((void*)&cs_comctl_alloc); + TRACE (commctrl, "Heap created: 0x%x\n", hComctl32Heap); + if (!hComctl32Heap) + return NULL; + } + + if (lpSrc) + lpDest = HeapReAlloc (hComctl32Heap, HEAP_ZERO_MEMORY, lpSrc, dwSize); + else + lpDest = HeapAlloc (hComctl32Heap, HEAP_ZERO_MEMORY, dwSize); + + TRACE (commctrl, "-- ret=%p\n", lpDest); + + return lpDest; +} + + +/************************************************************************** + * Free [COMCTL32.73] +.* + * Frees an allocated memory block from the dll's local heap. + * + * PARAMS + * lpMem [I] pointer to memory block which will be freed + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +COMCTL32_Free (LPVOID lpMem) +{ + TRACE (commctrl, "(%p)\n", lpMem); + + return HeapFree (hComctl32Heap, 0, lpMem); +} + + +/************************************************************************** + * GetSize [COMCTL32.74] + * + * Retrieves the size of the specified memory block from the dll's + * local heap. + * + * PARAMS + * lpMem [I] pointer to an allocated memory block + * + * RETURNS + * Success: size of the specified memory block + * Failure: 0 + */ + +DWORD WINAPI +COMCTL32_GetSize (LPVOID lpMem) +{ + TRACE (commctrl, "(%p)\n", lpMem); + + return HeapSize (hComctl32Heap, 0, lpMem); +} + + +/************************************************************************** + * CreateMRUListA [COMCTL32.151] + * + * PARAMS + * dwParam + * + * RETURNS + */ + +DWORD WINAPI +CreateMRUList32A (DWORD dwParam) +{ + + FIXME (commctrl, "(%lx)\n", dwParam); + + return 1; +} + + + + +/************************************************************************** + * Str_SetPtrA [COMCTL32.234] + * + * PARAMS + * dwParam1 [I] + * dwParam2 [I] + * + * RETURNS + */ + +BOOL32 WINAPI +COMCTL32_Str_SetPtrA (LPSTR lpStr, LPVOID *lpPtr) +{ + INT32 len; + LPSTR ptr; + + TRACE (commctrl, "(%p %p)\n", lpStr, lpPtr); + + if (lpStr) { + len = lstrlen32A (lpStr); + ptr = COMCTL32_ReAlloc (lpPtr, len + 1); + if (!(ptr)) + return FALSE; + lstrcpy32A (ptr, lpStr); + if (!lpPtr) + return FALSE; + *lpPtr = ptr; + return TRUE; + } + + if (*lpPtr) { + COMCTL32_Free (*lpPtr); + return TRUE; + } + + return FALSE; +} + + +/************************************************************************** + * The DSA-API is a set of functions to create and manipulate arrays of + * fix sized memory blocks. These arrays can store any kind of data + * (strings, icons...). + */ + +/************************************************************************** + * DSA_Create [COMCTL32.320] Creates a dynamic storage array + * + * PARAMS + * nSize [I] size of the array elements + * nGrow [I] number of elements by which the array grows when it is filled + * + * RETURNS + * Success: pointer to a array control structure. use this like a handle. + * Failure: NULL + */ + +HDSA WINAPI +DSA_Create (INT32 nSize, INT32 nGrow) +{ + HDSA hdsa; + + TRACE (commctrl, "(size=%d grow=%d)\n", nSize, nGrow); + + hdsa = (HDSA)COMCTL32_Alloc (sizeof(DSA)); + if (hdsa) + { + hdsa->nItemCount = 0; + hdsa->pData = NULL; + hdsa->nMaxCount = 0; + hdsa->nItemSize = nSize; + hdsa->nGrow = MIN(1, nGrow); + } + + return hdsa; +} + + +/************************************************************************** + * DSA_Destroy [COMCTL32.321] Destroys a dynamic storage array + * + * PARAMS + * hdsa [I] pointer to the array control structure + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DSA_Destroy (const HDSA hdsa) +{ + TRACE (commctrl, "(%p)\n", hdsa); + + if (!hdsa) + return FALSE; + + if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) + return FALSE; + + return COMCTL32_Free (hdsa); +} + + +/************************************************************************** + * DSA_GetItem [COMCTL32.322] + * + * PARAMS + * hdsa [I] pointer to the array control structure + * nIndex [I] number of the Item to get + * pDest [O] destination buffer. Has to be >= dwElementSize. + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DSA_GetItem (const HDSA hdsa, INT32 nIndex, LPVOID pDest) +{ + LPVOID pSrc; + + TRACE (commctrl, "(%p %d %p)\n", hdsa, nIndex, pDest); + + if (!hdsa) + return FALSE; + if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) + return FALSE; + + pSrc = hdsa->pData + (hdsa->nItemSize * nIndex); + memmove (pDest, pSrc, hdsa->nItemSize); + + return TRUE; +} + + +/************************************************************************** + * DSA_GetItemPtr [COMCTL32.323] + * + * Retrieves a pointer to the specified item. + * + * PARAMS + * hdsa [I] pointer to the array control structure + * nIndex [I] index of the desired item + * + * RETURNS + * Success: pointer to an item + * Failure: NULL + */ + +LPVOID WINAPI +DSA_GetItemPtr (const HDSA hdsa, INT32 nIndex) +{ + LPVOID pSrc; + + TRACE (commctrl, "(%p %d)\n", hdsa, nIndex); + + if (!hdsa) + return NULL; + if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) + return NULL; + + pSrc = hdsa->pData + (hdsa->nItemSize * nIndex); + + TRACE (commctrl, "-- ret=%p\n", pSrc); + + return pSrc; +} + + +/************************************************************************** + * DSA_SetItem [COMCTL32.325] + * + * Sets the contents of an item in the array. + * + * PARAMS + * hdsa [I] pointer to the array control structure + * nIndex [I] index for the item + * pSrc [I] pointer to the new item data + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DSA_SetItem (const HDSA hdsa, INT32 nIndex, LPVOID pSrc) +{ + INT32 nSize, nNewItems; + LPVOID pDest, lpTemp; + + TRACE (commctrl, "(%p %d %p)\n", hdsa, nIndex, pSrc); + + if ((!hdsa) || nIndex < 0) + return FALSE; + + if (hdsa->nItemCount <= nIndex) { + /* within the old array */ + if (hdsa->nMaxCount > nIndex) { + /* within the allocated space, set a new boundary */ + hdsa->nItemCount = nIndex; + } + else { + /* resize the block of memory */ + nNewItems = + hdsa->nGrow * ((INT32)((nIndex - 1) / hdsa->nGrow) + 1); + nSize = hdsa->nItemSize * nNewItems; + + lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); + if (!lpTemp) + return FALSE; + + hdsa->nMaxCount = nNewItems; + hdsa->pData = lpTemp; + } + } + + /* put the new entry in */ + pDest = hdsa->pData + (hdsa->nItemSize * nIndex); + TRACE (commctrl, "-- move dest=%p src=%p size=%d\n", + pDest, pSrc, hdsa->nItemSize); + memmove (pDest, pSrc, hdsa->nItemSize); + + return TRUE; +} + + +/************************************************************************** + * DSA_InsertItem [COMCTL32.325] + * + * PARAMS + * hdsa [I] pointer to the array control structure + * nIndex [I] index for the new item + * pSrc [I] pointer to the element + * + * RETURNS + * Success: position of the new item + * Failure: -1 + */ + +INT32 WINAPI +DSA_InsertItem (const HDSA hdsa, INT32 nIndex, LPVOID pSrc) +{ + INT32 nNewItems, nSize, i; + LPVOID lpTemp, lpDest; + LPDWORD p; + + TRACE(commctrl, "(%p %d %p)\n", hdsa, nIndex, pSrc); + + if ((!hdsa) || nIndex < 0) + return -1; + + for (i = 0; i < hdsa->nItemSize; i += 4) { + p = *(DWORD**)(pSrc + i); + if (IsBadStringPtr32A ((char*)p, 256)) + TRACE (commctrl, "-- %d=%p\n", i, (DWORD*)p); + else + TRACE (commctrl, "-- %d=%p [%s]\n", i, p, debugstr_a((char*)p)); + } + + /* when nIndex > nItemCount then append */ + if (nIndex >= hdsa->nItemCount) + nIndex = hdsa->nItemCount; + + /* do we need to resize ? */ + if (hdsa->nItemCount >= hdsa->nMaxCount) { + nNewItems = hdsa->nMaxCount + hdsa->nGrow; + nSize = hdsa->nItemSize * nNewItems; + + lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); + if (!lpTemp) + return -1; + + hdsa->nMaxCount = nNewItems; + hdsa->pData = lpTemp; + } + + /* do we need to move elements ? */ + if (nIndex < hdsa->nItemCount) { + lpTemp = hdsa->pData + (hdsa->nItemSize * nIndex); + lpDest = lpTemp + hdsa->nItemSize; + nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize; + TRACE (commctrl, "-- move dest=%p src=%p size=%d\n", + lpDest, lpTemp, nSize); + memmove (lpDest, lpTemp, nSize); + } + + /* ok, we can put the new Item in */ + hdsa->nItemCount++; + lpDest = hdsa->pData + (hdsa->nItemSize * nIndex); + TRACE (commctrl, "-- move dest=%p src=%p size=%d\n", + lpDest, pSrc, hdsa->nItemSize); + memmove (lpDest, pSrc, hdsa->nItemSize); + + return hdsa->nItemCount; +} + + +/************************************************************************** + * DSA_DeleteItem [COMCTL32.326] + * + * PARAMS + * hdsa [I] pointer to the array control structure + * nIndex [I] index for the element to delete + * + * RETURNS + * Success: number of the deleted element + * Failure: -1 + */ + +INT32 WINAPI +DSA_DeleteItem (const HDSA hdsa, INT32 nIndex) +{ + LPVOID lpDest,lpSrc; + INT32 nSize; + + TRACE (commctrl, "(%p %d)\n", hdsa, nIndex); + + if (!hdsa) + return -1; + if (nIndex < 0 || nIndex >= hdsa->nItemCount) + return -1; + + /* do we need to move ? */ + if (nIndex < hdsa->nItemCount - 1) { + lpDest = hdsa->pData + (hdsa->nItemSize * nIndex); + lpSrc = lpDest + hdsa->nItemSize; + nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1); + TRACE (commctrl, "-- move dest=%p src=%p size=%d\n", + lpDest, lpSrc, nSize); + memmove (lpDest, lpSrc, nSize); + } + + hdsa->nItemCount--; + + /* free memory ? */ + if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) { + nSize = hdsa->nItemSize * hdsa->nItemCount; + + lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); + if (!lpDest) + return -1; + + hdsa->nMaxCount = hdsa->nItemCount; + hdsa->pData = lpDest; + } + + return nIndex; +} + + +/************************************************************************** + * DSA_DeleteAllItems [COMCTL32.326] + * + * Removes all items and reinitializes the array. + * + * PARAMS + * hdsa [I] pointer to the array control structure + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DSA_DeleteAllItems (const HDSA hdsa) +{ + TRACE (commctrl, "(%p)\n", hdsa); + + if (!hdsa) + return FALSE; + if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) + return FALSE; + + hdsa->nItemCount = 0; + hdsa->pData = NULL; + hdsa->nMaxCount = 0; + + return TRUE; +} + + +/************************************************************************** + * The DPA-API is a set of functions to create and manipulate arrays of + * pointers. + */ + +/************************************************************************** + * DPA_Create [COMCTL32.328] Creates a dynamic pointer array + * + * PARAMS + * nGrow [I] number of items by which the array grows when it is filled + * + * RETURNS + * Success: handle (pointer) to the pointer array. + * Failure: NULL + */ + +HDPA WINAPI +DPA_Create (INT32 nGrow) +{ + HDPA hdpa; + + TRACE (commctrl, "(%d)\n", nGrow); + + hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); + if (hdpa) { + hdpa->nGrow = MIN(8, nGrow); + hdpa->hHeap = hComctl32Heap; + hdpa->nMaxCount = hdpa->nGrow * 2; + hdpa->ptrs = + (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID)); + } + + TRACE (commctrl, "-- %p\n", hdpa); + + return hdpa; +} + + +/************************************************************************** + * DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DPA_Destroy (const HDPA hdpa) +{ + TRACE (commctrl, "(%p)\n", hdpa); + + if (!hdpa) + return FALSE; + + if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) + return FALSE; + + return HeapFree (hdpa->hHeap, 0, hdpa); +} + + +/************************************************************************** + * DPA_Grow [COMCTL32.330] + * + * Sets the growth amount. + * + * PARAMS + * hdpa [I] handle (pointer) to the existing (source) pointer array + * nGrow [I] number of items, the array grows, when it's too small + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DPA_Grow (const HDPA hdpa, INT32 nGrow) +{ + FIXME (commctrl, "(%p %d) stub!\n", hdpa, nGrow); + + if (!hdpa) + return FALSE; + + hdpa->nGrow = MIN(8, nGrow); + + return TRUE; +} + + +/************************************************************************** + * DPA_Clone [COMCTL32.331] + * + * Copies a pointer array to an other one or creates a copy + * + * PARAMS + * hdpa [I] handle (pointer) to the existing (source) pointer array + * hdpaNew [O] handle (pointer) to the destination pointer array + * + * RETURNS + * Success: pointer to the destination pointer array. + * Failure: NULL + * + * NOTES + * - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer + * array will be created and it's handle (pointer) is returned. + * - If 'hdpa' is a NULL-Pointer, the original implementation crashes, + * this implementation just returns NULL. + */ + +HDPA WINAPI +DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) +{ + INT32 nNewItems, nSize; + HDPA hdpaTemp; + + if (!hdpa) + return NULL; + + FIXME (commctrl, "(%p %p) stub!\n", hdpa, hdpaNew); + + if (!hdpaNew) { + /* create a new DPA */ + hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + sizeof(DPA)); + hdpaTemp->hHeap = hdpa->hHeap; + hdpaTemp->nGrow = hdpa->nGrow; + } + else + hdpaTemp = hdpaNew; + + if (hdpaTemp->ptrs) { + /* remove old pointer array */ + HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs); + hdpaTemp->ptrs = NULL; + hdpaTemp->nItemCount = 0; + hdpaTemp->nMaxCount = 0; + } + + /* create a new pointer array */ + nNewItems = hdpaTemp->nGrow * + ((INT32)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1); + nSize = nNewItems * sizeof(LPVOID); + hdpaTemp->ptrs = + (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); + hdpaTemp->nMaxCount = nNewItems; + + /* clone the pointer array */ + hdpaTemp->nItemCount = hdpa->nItemCount; + memmove (hdpaTemp->ptrs, hdpa->ptrs, + hdpaTemp->nItemCount * sizeof(LPVOID)); + + return hdpaTemp; +} + + +/************************************************************************** + * DPA_GetPtr [COMCTL32.332] + * + * Retrieves a pointer from a dynamic pointer array + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * nIndex [I] array index of the desired pointer + * + * RETURNS + * Success: pointer + * Failure: NULL + */ + +LPVOID WINAPI +DPA_GetPtr (const HDPA hdpa, INT32 i) +{ + TRACE (commctrl, "(%p %d)\n", hdpa, i); + + if (!hdpa) + return NULL; + if (!hdpa->ptrs) + return NULL; + if ((i < 0) || (i >= hdpa->nItemCount)) + return NULL; + + TRACE (commctrl, "-- %p\n", hdpa->ptrs[i]); + + return hdpa->ptrs[i]; +} + + +/************************************************************************** + * DPA_GetPtrIndex [COMCTL32.333] + * + * Retrieves the index of the specified pointer + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * p [I] pointer + * + * RETURNS + * Success: index of the specified pointer + * Failure: -1 + */ + +INT32 WINAPI +DPA_GetPtrIndex (const HDPA hdpa, LPVOID p) +{ + INT32 i; + + if (!hdpa->ptrs) + return -1; + + for (i = 0; i < hdpa->nItemCount; i++) { + if (hdpa->ptrs[i] == p) + return i; + } + + return -1; +} + + +/************************************************************************** + * DPA_InsertPtr [COMCTL32.334] + * + * Inserts a pointer into a dynamic pointer array + * + * PARAMS + * hdpa [I] handle (pointer) to the array + * i [I] array index + * p [I] pointer to insert + * + * RETURNS + * Success: index of the inserted pointer + * Failure: -1 + */ + +INT32 WINAPI +DPA_InsertPtr (const HDPA hdpa, INT32 i, LPVOID p) +{ + INT32 nNewItems, nSize, nIndex = 0; + LPVOID *lpTemp, *lpDest; + + TRACE (commctrl, "(%p %d %p)\n", hdpa, i, p); + + if ((!hdpa) || (i < 0)) + return -1; + + if (!hdpa->ptrs) { + hdpa->ptrs = + (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->nGrow * sizeof(LPVOID)); + if (!hdpa->ptrs) + return -1; + hdpa->nMaxCount = hdpa->nGrow; + nIndex = 0; + } + else { + if (hdpa->nItemCount > hdpa->nMaxCount) { + TRACE (commctrl, "-- resizing\n"); + nNewItems = hdpa->nMaxCount + hdpa->nGrow; + nSize = nNewItems * sizeof(LPVOID); + + lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->ptrs, nSize); + if (!lpTemp) + return -1; + hdpa->nMaxCount = nNewItems; + hdpa->ptrs = lpTemp; + } + + if (i >= hdpa->nItemCount) { + TRACE (commctrl, "-- appending at %d\n", nIndex); + nIndex = hdpa->nItemCount; + } + else { + TRACE (commctrl, "-- inserting at %d\n", i); + lpTemp = hdpa->ptrs + (sizeof(LPVOID) * i); + lpDest = lpTemp + sizeof(LPVOID); + nSize = (hdpa->nItemCount - i) * sizeof(LPVOID); + TRACE (commctrl, "-- move dest=%p src=%p size=%x\n", + lpDest, lpTemp, nSize); + memmove (lpDest, lpTemp, nSize); + nIndex = i; + } + } + + /* insert item */ + hdpa->nItemCount++; + hdpa->ptrs[nIndex] = p; + + return nIndex; +} + + +/************************************************************************** + * DPA_SetPtr [COMCTL32.335] + * + * Sets a pointer in the pointer array + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * i [I] index of the pointer that will be set + * p [I] pointer to be set + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DPA_SetPtr (const HDPA hdpa, INT32 i, LPVOID p) +{ + LPVOID *lpTemp; + + TRACE (commctrl, "(%p %d %p)\n", hdpa, i, p); + + if ((!hdpa) || i < 0) + return FALSE; + + if (hdpa->nItemCount <= i) { + /* within the old array */ + if (hdpa->nMaxCount > i) { + /* within the allocated space, set a new boundary */ + hdpa->nItemCount = i; + } + else { + /* resize the block of memory */ + INT32 nNewItems = + hdpa->nGrow * ((INT32)((i - 1) / hdpa->nGrow) + 1); + INT32 nSize = nNewItems * sizeof(LPVOID); + + lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->ptrs, nSize); + if (!lpTemp) + return FALSE; + + hdpa->nItemCount = nNewItems; + hdpa->ptrs = lpTemp; + } + } + + /* put the new entry in */ + hdpa->ptrs[i] = p; + + return TRUE; +} + + +/************************************************************************** + * DPA_DeletePtr [COMCTL32.336] + * + * Removes a pointer from the pointer array. + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * i [I] index of the pointer that will be deleted + * + * RETURNS + * Success: deleted pointer + * Failure: NULL + */ + +LPVOID WINAPI +DPA_DeletePtr (const HDPA hdpa, INT32 i) +{ + LPVOID lpDest, lpSrc, lpTemp = NULL; + INT32 nSize; + + TRACE (commctrl, "(%p %d)\n", hdpa, i); + + if ((!hdpa) || i < 0 || i >= hdpa->nItemCount) + return NULL; + + lpTemp = hdpa->ptrs[i]; + + /* do we need to move ?*/ + if (i < hdpa->nItemCount - 1) { + lpDest = hdpa->ptrs + (i * sizeof (LPVOID)); + lpSrc = lpDest + sizeof(LPVOID); + nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID); + TRACE (commctrl,"-- move dest=%p src=%p size=%x\n", + lpDest, lpSrc, nSize); + memmove (lpDest, lpSrc, nSize); + } + + hdpa->nItemCount --; + + /* free memory ?*/ + if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { + INT32 nNewItems = MIN(hdpa->nGrow * 2, hdpa->nItemCount); + nSize = nNewItems * sizeof(LPVOID); + lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->ptrs, nSize); + if (!lpDest) + return NULL; + + hdpa->nMaxCount = nNewItems; + hdpa->ptrs = (LPVOID*)lpDest; + } + + return lpTemp; +} + + +/************************************************************************** + * DPA_DeleteAllPtrs [COMCTL32.337] + * + * Removes all pointers and reinitializes the array. + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DPA_DeleteAllPtrs (const HDPA hdpa) +{ + TRACE (commctrl, "(%p)\n", hdpa); + + if (!hdpa) + return FALSE; + + if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) + return FALSE; + + hdpa->nItemCount = 0; + hdpa->nMaxCount = hdpa->nGrow * 2; + hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->nMaxCount * sizeof(LPVOID)); + + return TRUE; +} + + +/************************************************************************** + * DPA_QuickSort [Internal] + * + * Modified version of quicksort (used by DPA_Sort). + * + * PARAMS + * lpPtrs [I] pointer to the pointer array + * l [I] index of the "left border" of the partition + * r [I] index of the "right border" of the partition + * pfnCompare [I] pointer to the compare function + * lParam [I] user defined value (3rd parameter in compare function) + * + * RETURNS + * NONE + * + * NOTES + * Taken from R.Sedgewick "Algorithms in C"! + * If something goes wrong, blame HIM not ME! (Eric Kohl) + */ + +static VOID +DPA_QuickSort (LPVOID *lpPtrs , INT32 l, INT32 r, + PFNDPACOMPARE pfnCompare, LPARAM lParam) +{ + LPVOID t, v; + INT32 i, j; + + if (l > r) { + v = lpPtrs[r]; + i = l - 1; + j = r; + for (;;) { + while ((pfnCompare)(lpPtrs[++i], v, lParam) < 0); + while ((pfnCompare)(lpPtrs[--j], v, lParam) > 0); + if (i >= j) + break; + t = lpPtrs[i]; + lpPtrs[i] = lpPtrs[j]; + lpPtrs[j] = t; + } + t = lpPtrs[i]; + lpPtrs[i] = lpPtrs[r]; + lpPtrs[r] = t; + DPA_QuickSort (lpPtrs, l, i - 1, pfnCompare, lParam); + DPA_QuickSort (lpPtrs, i + 1, r, pfnCompare, lParam); + } +} + + +/************************************************************************** + * DPA_Sort [COMCTL32.338] + * + * Sorts a pointer array using a user defined compare function + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * pfnCompare [I] pointer to the compare function + * lParam [I] user defined value (3rd parameter of compare function) + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ + +BOOL32 WINAPI +DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) +{ + if (!hdpa || !pfnCompare) + return FALSE; + + TRACE (commctrl, "(%p %p 0x%lx)\n", hdpa, pfnCompare, lParam); + + DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1, pfnCompare, lParam); + + return TRUE; +} + + +/************************************************************************** + * DPA_Search [COMCTL32.339] + * + * Searches a pointer array for a specified pointer + * + * PARAMS + * hdpa [I] handle (pointer) to the pointer array + * pFind [I] pointer to search for + * nStart [I] start index + * pfnCompare [I] pointer to the compare function + * lParam [I] user defined value (3rd parameter of compare function) + * uOptions [I] search options + * + * RETURNS + * Success: index of the pointer in the array. + * Failure: -1 + * + * NOTES + * Binary search taken from R.Sedgewick "Algorithms in C"! + * If something goes wrong, blame HIM not ME! (Eric Kohl) + */ + +INT32 WINAPI +DPA_Search (const HDPA hdpa, LPVOID pFind, INT32 nStart, + PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT32 uOptions) +{ + if (!hdpa || !pfnCompare || !pFind) + return -1; + + TRACE (commctrl, "(%p %p %d %p 0x%08lx 0x%08x)\n", + hdpa, pFind, nStart, pfnCompare, lParam, uOptions); + + if (uOptions & DPAS_SORTED) { + /* array is sorted --> use binary search */ + INT32 l, r, x, n; + LPVOID *lpPtr; + + l = (nStart == -1) ? 0 : nStart; + r = hdpa->nItemCount - 1; + lpPtr = hdpa->ptrs; + while (r >= l) { + x = (l + r) / 2; + n = (pfnCompare)(pFind, lpPtr[x], lParam); + if (n < 0) + r = x - 1; + else + l = x + 1; + if (n == 0) { + TRACE (commctrl, "-- ret=%d\n", n); + return n; + } + } + + if (uOptions & DPAS_INSERTBEFORE) { + TRACE (commctrl, "-- ret=%d\n", r); + return r; + } + + if (uOptions & DPAS_INSERTAFTER) { + TRACE (commctrl, "-- ret=%d\n", r); + return l; + } + } + else { + /* array is not sorted --> use linear search */ + LPVOID *lpPtr; + INT32 nIndex; + + FIXME (commctrl, "linear search\n"); + + nIndex = (nStart == -1)? 0 : nStart; + lpPtr = hdpa->ptrs; + for (; nIndex < hdpa->nItemCount; nIndex++) { + if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) { + TRACE (commctrl, "-- ret=%d\n", nIndex); + return nIndex; + } + } + } + + TRACE (commctrl, "-- not found: ret=-1\n"); + return -1; +} + + +/************************************************************************** + * DPA_CreateEx [COMCTL32.340] + * + * Creates a dynamic pointer array using the specified size and heap. + * + * PARAMS + * nGrow [I] number of items by which the array grows when it is filled + * hHeap [I] handle to the heap where the array is stored + * + * RETURNS + * Success: handle (pointer) to the pointer array. + * Failure: NULL + */ + +HDPA WINAPI +DPA_CreateEx (INT32 nGrow, HANDLE32 hHeap) +{ + HDPA hdpa; + + TRACE (commctrl, "(%d 0x%x)\n", nGrow, hHeap); + + if (hHeap) + hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA)); + else + hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); + + if (hdpa) { + hdpa->nGrow = MIN(8, nGrow); + hdpa->hHeap = hHeap ? hHeap : hComctl32Heap; + hdpa->nMaxCount = hdpa->nGrow * 2; + hdpa->ptrs = + (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, + hdpa->nMaxCount * sizeof(LPVOID)); + } + + TRACE (commctrl, "-- %p\n", hdpa); + + return hdpa; +} + + +/************************************************************************** + * SendNotify [COMCTL32.341] + * + */ + +DWORD WINAPI +COMCTL32_SendNotify (DWORD dw1, DWORD dw2, DWORD dw3, DWORD dw4) +{ + FIXME (commctrl, "(0x%08lx 0x%08lx 0x%08lx 0x%08lx)\n", + dw1, dw2, dw3, dw4); + + return 0; +} + + + +/************************************************************************** + * StrChrA [COMCTL32.350] + * + */ + +LPSTR WINAPI +COMCTL32_StrChrA (LPCSTR lpString, CHAR cChar) +{ + return strchr (lpString, cChar); +} + + +/************************************************************************** + * StrStrIA [COMCTL32.355] + */ + +LPSTR WINAPI +COMCTL32_StrStrIA (LPCSTR lpStr1, LPCSTR lpStr2) +{ + INT32 len1, len2, i; + CHAR first; + + if (*lpStr2 == 0) + return ((LPSTR)lpStr1); + len1 = 0; + while (lpStr1[len1] != 0) ++len1; + len2 = 0; + while (lpStr2[len2] != 0) ++len2; + if (len2 == 0) + return ((LPSTR)(lpStr1 + len1)); + first = tolower (*lpStr2); + while (len1 >= len2) { + if (tolower(*lpStr1) == first) { + for (i = 1; i < len2; ++i) + if (tolower (lpStr1[i]) != tolower(lpStr2[i])) + break; + if (i >= len2) + return ((LPSTR)lpStr1); + } + ++lpStr1; --len1; + } + return (NULL); +} + + +/************************************************************************** + * StrToIntA [COMCTL32.357] Converts a string to a signed integer. + */ + +INT32 WINAPI +COMCTL32_StrToIntA (LPSTR lpString) +{ + return atoi(lpString); +} + diff --git a/controls/commctrl.c b/dlls/comctl32/commctrl.c similarity index 84% rename from controls/commctrl.c rename to dlls/comctl32/commctrl.c index 629fc504abb..0c6f00e0dae 100644 --- a/controls/commctrl.c +++ b/dlls/comctl32/commctrl.c @@ -9,18 +9,23 @@ #include "win.h" #include "heap.h" #include "commctrl.h" +#include "animate.h" +#include "comboex.h" #include "header.h" +#include "hotkey.h" #include "listview.h" #include "pager.h" #include "progress.h" #include "rebar.h" #include "status.h" +#include "tab.h" #include "toolbar.h" #include "tooltips.h" #include "trackbar.h" #include "treeview.h" #include "updown.h" #include "debug.h" +#include "winerror.h" /*********************************************************************** @@ -40,13 +45,13 @@ ComCtl32LibMain (HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved) switch (fdwReason) { case DLL_PROCESS_ATTACH: - TRACE (commctrl, "No animation class implemented!\n"); + ANIMATE_Register (); HEADER_Register (); - TRACE (commctrl, "No hotkey class implemented!\n"); + HOTKEY_Register (); LISTVIEW_Register (); PROGRESS_Register (); STATUS_Register (); - TRACE (commctrl, "No tab class implemented!\n"); + TAB_Register (); TOOLBAR_Register (); TOOLTIPS_Register (); TRACKBAR_Register (); @@ -59,6 +64,176 @@ ComCtl32LibMain (HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } +/*********************************************************************** + * MenuHelp [COMCTL32.2] + * + * PARAMS + * uMsg + * wParam + * lParam + * hMainMenu + * hInst + * hwndStatus + * lpwIDs + * + * RETURNS + * None + * + * NOTES + * Some features are still missing because of incomplete WM_MENUSELECT + * messages (16->32 bit conversion). + */ + +VOID WINAPI +MenuHelp (UINT32 uMsg, WPARAM32 wParam, LPARAM lParam, HMENU32 hMainMenu, + HINSTANCE32 hInst, HWND32 hwndStatus, LPUINT32 lpwIDs) +{ + char szStatusText[128]; + + if (!IsWindow32 (hwndStatus)) return; + + switch (uMsg) { + case WM_MENUSELECT: + TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n", + wParam, lParam); + + if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) { + /* menu was closed */ + SendMessage32A (hwndStatus, SB_SIMPLE, FALSE, 0); + } + else { + if (HIWORD(wParam) & MF_POPUP) { + FIXME (commctrl, "popup 0x%08x 0x%08lx\n", wParam, lParam); + + szStatusText[0] = 0; + } + else { + TRACE (commctrl, "menu item selected!\n"); + if (!LoadString32A (hInst, LOWORD(wParam), szStatusText, 128)) + szStatusText[0] = 0; + } + SendMessage32A (hwndStatus, SB_SETTEXT32A, 255 | SBT_NOBORDERS, + (LPARAM)szStatusText); + SendMessage32A (hwndStatus, SB_SIMPLE, TRUE, 0); + } + break; + + default: + WARN (commctrl, "Invalid Message!\n"); + break; + } +} + + +/*********************************************************************** + * 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. (See NOTES.) + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + * 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; + + TRACE (commctrl, "%x, %x, %p\n", hwnd, uFlags, lpInfo); + + 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 { + /* 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); + } + + return TRUE; +} + + +/*********************************************************************** + * GetEffectiveClientRect [COMCTL32.4] + * + * PARAMS + * hwnd [I] handle to the client window. + * lpRect [O] pointer to the rectangle of the client window + * lpInfo [I] pointer to an array of integers + * + * RETURNS + * None. + * + * NOTES + * + */ + +VOID WINAPI +GetEffectiveClientRect (HWND32 hwnd, LPRECT32 lpRect, LPINT32 lpInfo) +{ + RECT32 rcCtrl; + INT32 *lpRun; + HWND32 hwndCtrl; + + TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n", + (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo); + + GetClientRect32 (hwnd, lpRect); + lpRun = lpInfo; + + do { + lpRun += 2; + if (*lpRun == 0) + return; + lpRun++; + hwndCtrl = GetDlgItem32 (hwnd, *lpRun); + if (GetWindowLong32A (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { + TRACE (commctrl, "control id 0x%x\n", *lpRun); + GetWindowRect32 (hwndCtrl, &rcCtrl); + MapWindowPoints32 ((HWND32)0, hwnd, (LPPOINT32)&rcCtrl, 2); + SubtractRect32 (lpRect, lpRect, &rcCtrl); + } + lpRun++; + } while (*lpRun); +} + + /*********************************************************************** * DrawStatusText32A [COMCTL32.5][COMCTL32.27] * @@ -111,17 +286,17 @@ DrawStatusText32A (HDC32 hdc, LPRECT32 lprc, LPCSTR 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); - HeapFree( GetProcessHeap(), 0, p ); + LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, text); + DrawStatusText32A (hdc, lprc, p, style); + HeapFree (GetProcessHeap (), 0, p ); } /*********************************************************************** * CreateStatusWindow32A [COMCTL32.6][COMCTL32.21] */ -HWND32 WINAPI CreateStatusWindow32A( INT32 style, LPCSTR text, HWND32 parent, - UINT32 wid ) +HWND32 WINAPI +CreateStatusWindow32A (INT32 style, LPCSTR text, HWND32 parent, UINT32 wid) { return CreateWindow32A(STATUSCLASSNAME32A, text, style, CW_USEDEFAULT32, CW_USEDEFAULT32, @@ -145,20 +320,21 @@ HWND32 WINAPI CreateStatusWindow32W( INT32 style, LPCWSTR text, HWND32 parent, /*********************************************************************** * CreateUpDownControl (COMCTL32.16) */ -HWND32 WINAPI CreateUpDownControl( DWORD style, INT32 x, INT32 y, - INT32 cx, INT32 cy, HWND32 parent, - INT32 id, HINSTANCE32 inst, HWND32 buddy, - INT32 maxVal, INT32 minVal, INT32 curVal ) +HWND32 WINAPI +CreateUpDownControl (DWORD style, INT32 x, INT32 y, INT32 cx, INT32 cy, + HWND32 parent, INT32 id, HINSTANCE32 inst, + HWND32 buddy, INT32 maxVal, INT32 minVal, INT32 curVal) { - HWND32 hUD = CreateWindow32A(UPDOWN_CLASS32A, 0, style, x, y, cx, cy, - parent, id, inst, 0); - if(hUD){ - SendMessage32A(hUD, UDM_SETBUDDY, buddy, 0); - SendMessage32A(hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); - SendMessage32A(hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); - } + HWND32 hUD = + CreateWindow32A (UPDOWN_CLASS32A, 0, style, x, y, cx, cy, + parent, id, inst, 0); + if (hUD) { + SendMessage32A (hUD, UDM_SETBUDDY, buddy, 0); + SendMessage32A (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); + SendMessage32A (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); + } - return hUD; + return hUD; } @@ -198,30 +374,30 @@ InitCommonControls (VOID) BOOL32 WINAPI InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls) { - INT32 cCount; - DWORD dwMask; + INT32 cCount; + DWORD dwMask; - TRACE(commctrl,"\n"); + TRACE(commctrl,"\n"); - if (lpInitCtrls == NULL) return FALSE; - if (lpInitCtrls->dwSize < sizeof(INITCOMMONCONTROLSEX)) return FALSE; + if (lpInitCtrls == NULL) return FALSE; + if (lpInitCtrls->dwSize < sizeof(INITCOMMONCONTROLSEX)) return FALSE; - for (cCount = 0; cCount < 32; cCount++) { - dwMask = 1 << cCount; - if (!(lpInitCtrls->dwICC & dwMask)) - continue; + for (cCount = 0; cCount < 32; cCount++) { + dwMask = 1 << cCount; + if (!(lpInitCtrls->dwICC & dwMask)) + continue; - switch (lpInitCtrls->dwICC & dwMask) { - /* dummy initialization */ - case ICC_ANIMATE_CLASS: - 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; + switch (lpInitCtrls->dwICC & dwMask) { + /* dummy initialization */ + case ICC_ANIMATE_CLASS: + 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 */ case ICC_DATE_CLASSES: @@ -232,7 +408,7 @@ InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls) break; case ICC_USEREX_CLASSES: - TRACE (commctrl, "No comboex class implemented!\n"); + COMBOEX_Register (); break; case ICC_COOL_CLASSES: @@ -254,68 +430,10 @@ InitCommonControlsEx (LPINITCOMMONCONTROLSEX lpInitCtrls) default: WARN (commctrl, "Unknown class! dwICC=0x%lX\n", dwMask); break; + } } - } - return TRUE; -} - - -/*********************************************************************** - * MenuHelp [COMCTL32.2] - * - * PARAMS - * uMsg - * wParam - * lParam - * hMainMenu - * hInst - * hwndStatus - * lpwIDs - * - * NOTES - * Some features are still missing because of incomplete WM_MENUSELECT - * messages (16->32 bit conversion). - */ - -VOID WINAPI -MenuHelp (UINT32 uMsg, WPARAM32 wParam, LPARAM lParam, HMENU32 hMainMenu, - HINSTANCE32 hInst, HWND32 hwndStatus, LPUINT32 lpwIDs) -{ - char szStatusText[128]; - - if (!IsWindow32 (hwndStatus)) return; - - switch (uMsg) { - case WM_MENUSELECT: - TRACE (commctrl, "WM_MENUSELECT wParam=0x%X lParam=0x%lX\n", - wParam, lParam); - - if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) { - /* menu was closed */ - SendMessage32A (hwndStatus, SB_SIMPLE, FALSE, 0); - } - else { - if (HIWORD(wParam) & MF_POPUP) { - FIXME (commctrl, "popup 0x%08x 0x%08lx\n", wParam, lParam); - - szStatusText[0] = 0; - } - else { - TRACE (commctrl, "menu item selected!\n"); - if (!LoadString32A (hInst, LOWORD(wParam), szStatusText, 128)) - szStatusText[0] = 0; - } - SendMessage32A (hwndStatus, SB_SETTEXT32A, 255 | SBT_NOBORDERS, - (LPARAM)szStatusText); - SendMessage32A (hwndStatus, SB_SIMPLE, TRUE, 0); - } - break; - - default: - WARN (commctrl, "Invalid Message!\n"); - break; - } + return TRUE; } @@ -387,6 +505,10 @@ CreateToolbarEx (HWND32 hwnd, DWORD style, UINT32 wID, INT32 nBitmaps, * wFlags * lpColorMap * iNumMaps + * + * RETURNS + * Success: bitmap handle + * Failure: 0 */ HBITMAP32 WINAPI @@ -496,101 +618,34 @@ CreateToolbar (HWND32 hwnd, DWORD style, UINT32 wID, INT32 nBitmaps, /*********************************************************************** - * GetEffectiveClientRect [COMCTL32.4] + * DllGetVersion [COMCTL32.25] + * + * Retrieves version information of the 'COMCTL32.DLL' * * PARAMS - * hwnd [I] handle to the client window. - * lpRect [O] pointer to the rectangle of the client window - * lpInfo [I] pointer to an array of integers + * pdvi [O] pointer to version information structure. * - * NOTES + * REURNS + * Success: S_OK + * Failure: E_INVALIDARG */ -VOID WINAPI -GetEffectiveClientRect (HWND32 hwnd, LPRECT32 lpRect, LPINT32 lpInfo) +HRESULT WINAPI +COMCTL32_DllGetVersion (DLLVERSIONINFO *pdvi) { - RECT32 rcCtrl; - INT32 *lpRun; - HWND32 hwndCtrl; - - TRACE (commctrl, "(0x%08lx 0x%08lx 0x%08lx)\n", - (DWORD)hwnd, (DWORD)lpRect, (DWORD)lpInfo); - - GetClientRect32 (hwnd, lpRect); - lpRun = lpInfo; - - do { - lpRun += 2; - if (*lpRun == 0) - return; - lpRun++; - hwndCtrl = GetDlgItem32 (hwnd, *lpRun); - if (GetWindowLong32A (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { - TRACE (commctrl, "control id 0x%x\n", *lpRun); - GetWindowRect32 (hwndCtrl, &rcCtrl); - MapWindowPoints32 ((HWND32)0, hwnd, (LPPOINT32)&rcCtrl, 2); - SubtractRect32 (lpRect, lpRect, &rcCtrl); - } - lpRun++; - } while (*lpRun); -} - - -/*********************************************************************** - * 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. (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 (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 { - /* 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); + if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) { + WARN(ver, "wrong DLLVERSIONINFO size from app"); + return E_INVALIDARG; } - return TRUE; + pdvi->dwMajorVersion = 4; + pdvi->dwMinorVersion = 72; + pdvi->dwBuildNumber = 2106; + pdvi->dwPlatformID = 1; + + TRACE (commctrl, "%lu.%lu.%lu.%lu\n", + pdvi->dwMajorVersion, pdvi->dwMinorVersion, + pdvi->dwBuildNumber, pdvi->dwPlatformID); + + return S_OK; } diff --git a/controls/header.c b/dlls/comctl32/header.c similarity index 98% rename from controls/header.c rename to dlls/comctl32/header.c index 1e7097aa32e..813512c9ac7 100644 --- a/controls/header.c +++ b/dlls/comctl32/header.c @@ -447,7 +447,7 @@ HEADER_SendHeaderNotify (WND *wndPtr, UINT32 code, INT32 iItem) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr); NMHEADERA nmhdr; - HD_ITEMA nmitem; + HDITEM32A nmitem; nmhdr.hdr.hwndFrom = wndPtr->hwndSelf; nmhdr.hdr.idFrom = wndPtr->wIDmenu; @@ -565,13 +565,15 @@ static LRESULT HEADER_GetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr); - HD_ITEMA *phdi; - INT32 iItem; - UINT32 uMask; + HDITEM32A *phdi; + INT32 iItem; + UINT32 uMask; - phdi = (HD_ITEMA*)lParam; + phdi = (HDITEM32A*)lParam; iItem = (INT32)wParam; + if (phdi == NULL) + return FALSE; if ((iItem < 0) || (iItem > infoPtr->uNumItem - 1)) return FALSE; @@ -668,13 +670,12 @@ static LRESULT HEADER_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr); - HD_ITEMA *phdi; - HDC32 hdc; - INT32 iItem, len; + HDITEM32A *phdi = (HDITEM32A*)lParam; + INT32 iItem = (INT32)wParam; + HDC32 hdc; + INT32 len; - phdi = (HD_ITEMA*)lParam; - iItem = (INT32)wParam; - + if (phdi == NULL) return -1; if (iItem < 0) return -1; if (iItem > infoPtr->uNumItem) iItem = infoPtr->uNumItem; @@ -796,13 +797,12 @@ static LRESULT HEADER_SetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr); - HD_ITEMA *phdi; - INT32 iItem; - HDC32 hdc; - - phdi = (HD_ITEMA*)lParam; - iItem = (INT32)wParam; + HDITEM32A *phdi = (HDITEM32A*)lParam; + INT32 iItem = (INT32)wParam; + HDC32 hdc; + if (phdi == NULL) + return FALSE; if ((iItem < 0) || (iItem > infoPtr->uNumItem - 1)) return FALSE; @@ -1221,7 +1221,7 @@ HEADER_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) LRESULT WINAPI -HeaderWindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam) +HEADER_WindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam) { WND *wndPtr = WIN_FindWndPtr(hwnd); @@ -1317,7 +1317,7 @@ void HEADER_Register( void ) ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; - wndClass.lpfnWndProc = (WNDPROC32)HeaderWindowProc; + wndClass.lpfnWndProc = (WNDPROC32)HEADER_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(HEADER_INFO *); wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c new file mode 100644 index 00000000000..a0c24d63199 --- /dev/null +++ b/dlls/comctl32/hotkey.c @@ -0,0 +1,360 @@ +/* + * Hotkey control + * + * Copyright 1998 Eric Kohl + * + * NOTES + * Development in progress. An author is needed! Any volunteers? + * I will only improve this control once in a while. + * Eric + * + * TODO: + * - Some messages. + * - Display code. + */ + +#include "windows.h" +#include "commctrl.h" +#include "hotkey.h" +#include "win.h" +#include "debug.h" + + +#define HOTKEY_GetInfoPtr(wndPtr) ((HOTKEY_INFO *)wndPtr->wExtra[0]) + + +// << HOTHEY_GetHotKey >> +// << HOTHEY_SetHotKey >> +// << HOTHEY_SetRules >> + + + +// << HOTKEY_Char >> + + +static LRESULT +HOTKEY_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr; + TEXTMETRIC32A tm; + HDC32 hdc; + + /* allocate memory for info structure */ + infoPtr = (HOTKEY_INFO *)COMCTL32_Alloc (sizeof(HOTKEY_INFO)); + wndPtr->wExtra[0] = (DWORD)infoPtr; + + if (infoPtr == NULL) { + ERR (listview, "could not allocate info memory!\n"); + return 0; + } + + if ((HOTKEY_INFO*)wndPtr->wExtra[0] != infoPtr) { + ERR (listview, "pointer assignment error!\n"); + return 0; + } + + + /* initialize info structure */ + + /* get default font height */ + hdc = GetDC32 (wndPtr->hwndSelf); + GetTextMetrics32A (hdc, &tm); + infoPtr->nHeight = tm.tmHeight; + ReleaseDC32 (wndPtr->hwndSelf, hdc); + + return 0; +} + + +static LRESULT +HOTKEY_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + + + /* free hotkey info data */ + COMCTL32_Free (infoPtr); + + return 0; +} + + +static LRESULT +HOTKEY_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + HBRUSH32 hBrush; + RECT32 rc; + + hBrush = + (HBRUSH32)SendMessage32A (wndPtr->parent->hwndSelf, WM_CTLCOLOREDIT, + wParam, (LPARAM)wndPtr->hwndSelf); + if (hBrush) + hBrush = (HBRUSH32)GetStockObject32 (WHITE_BRUSH); + GetClientRect32 (wndPtr->hwndSelf, &rc); + + FillRect32 ((HDC32)wParam, &rc, hBrush); + + return -1; +} + + +__inline__ static LRESULT +HOTKEY_GetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + return infoPtr->hFont; +} + + +static LRESULT +HOTKEY_KeyDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + switch (wParam) { + case VK_RETURN: + case VK_TAB: + case VK_SPACE: + case VK_DELETE: + case VK_ESCAPE: + case VK_BACK: + return DefWindowProc32A (wndPtr->hwndSelf, WM_KEYDOWN, wParam, lParam); + + case VK_SHIFT: + case VK_CONTROL: + case VK_MENU: + FIXME (hotkey, "modifier key pressed!\n"); + break; + + default: + FIXME (hotkey, " %d\n", wParam); + break; + } + + return TRUE; +} + + +static LRESULT +HOTKEY_KeyUp (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + FIXME (hotkey, " %d\n", wParam); + + return 0; +} + + +static LRESULT +HOTKEY_KillFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + infoPtr->bFocus = FALSE; + DestroyCaret32 (); + + return 0; +} + + +static LRESULT +HOTKEY_LButtonDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ +// HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + SetFocus32 (wndPtr->hwndSelf); + + return 0; +} + + +__inline__ static LRESULT +HOTKEY_NCCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + wndPtr->dwExStyle |= WS_EX_CLIENTEDGE; + + return DefWindowProc32A (wndPtr->hwndSelf, WM_NCCREATE, wParam, lParam); +} + + + + + +static LRESULT +HOTKEY_SetFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + infoPtr->bFocus = TRUE; + + + CreateCaret32 (wndPtr->hwndSelf, (HBITMAP32)0, 1, infoPtr->nHeight); + + SetCaretPos32 (1, 1); + + ShowCaret32 (wndPtr->hwndSelf); + + + return 0; +} + + +__inline__ static LRESULT +HOTKEY_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + TEXTMETRIC32A tm; + HDC32 hdc; + HFONT32 hOldFont = 0; + + infoPtr->hFont = (HFONT32)wParam; + + hdc = GetDC32 (wndPtr->hwndSelf); + if (infoPtr->hFont) + hOldFont = SelectObject32 (hdc, infoPtr->hFont); + + GetTextMetrics32A (hdc, &tm); + infoPtr->nHeight = tm.tmHeight; + + if (infoPtr->hFont) + SelectObject32 (hdc, hOldFont); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + + if (LOWORD(lParam)) { + + FIXME (hotkey, "force redraw!\n"); + + } + + return 0; +} + + +static LRESULT +HOTKEY_SysKeyDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + switch (wParam) { + case VK_RETURN: + case VK_TAB: + case VK_SPACE: + case VK_DELETE: + case VK_ESCAPE: + case VK_BACK: + return DefWindowProc32A (wndPtr->hwndSelf, WM_SYSKEYDOWN, wParam, lParam); + + case VK_SHIFT: + case VK_CONTROL: + case VK_MENU: + FIXME (hotkey, "modifier key pressed!\n"); + break; + + default: + FIXME (hotkey, " %d\n", wParam); + break; + } + + return TRUE; +} + + +static LRESULT +HOTKEY_SysKeyUp (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HOTKEY_INFO *infoPtr = HOTKEY_GetInfoPtr(wndPtr); + + FIXME (hotkey, " %d\n", wParam); + + return 0; +} + + + +LRESULT WINAPI +HOTKEY_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + + switch (uMsg) + { +// case HKM_GETHOTKEY: +// case HKM_SETHOTKEY: +// case HKM_SETRULES: + +// case WM_CHAR: + + case WM_CREATE: + return HOTKEY_Create (wndPtr, wParam, lParam); + + case WM_DESTROY: + return HOTKEY_Destroy (wndPtr, wParam, lParam); + + case WM_ERASEBKGND: + return HOTKEY_EraseBackground (wndPtr, wParam, lParam); + + case WM_GETDLGCODE: + return DLGC_WANTCHARS | DLGC_WANTARROWS; + + case WM_GETFONT: + return HOTKEY_GetFont (wndPtr, wParam, lParam); + + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + return HOTKEY_KeyDown (wndPtr, wParam, lParam); + + case WM_KEYUP: + case WM_SYSKEYUP: + return HOTKEY_KeyUp (wndPtr, wParam, lParam); + + case WM_KILLFOCUS: + return HOTKEY_KillFocus (wndPtr, wParam, lParam); + + case WM_LBUTTONDOWN: + return HOTKEY_LButtonDown (wndPtr, wParam, lParam); + + case WM_NCCREATE: + return HOTKEY_NCCreate (wndPtr, wParam, lParam); + +// case WM_PAINT: + + case WM_SETFOCUS: + return HOTKEY_SetFocus (wndPtr, wParam, lParam); + + case WM_SETFONT: + return HOTKEY_SetFont (wndPtr, wParam, lParam); + +// case WM_SYSCHAR: + + default: + if (uMsg >= WM_USER) + ERR (hotkey, "unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); + return DefWindowProc32A (hwnd, uMsg, wParam, lParam); + } + return 0; +} + + +void +HOTKEY_Register (void) +{ + WNDCLASS32A wndClass; + + if (GlobalFindAtom32A (HOTKEY_CLASS32A)) return; + + ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); + wndClass.style = CS_GLOBALCLASS; + wndClass.lpfnWndProc = (WNDPROC32)HOTKEY_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = sizeof(HOTKEY_INFO *); + wndClass.hCursor = 0; + wndClass.hbrBackground = 0; + wndClass.lpszClassName = HOTKEY_CLASS32A; + + RegisterClass32A (&wndClass); +} diff --git a/misc/imagelist.c b/dlls/comctl32/imagelist.c similarity index 99% rename from misc/imagelist.c rename to dlls/comctl32/imagelist.c index 8cafd4abe64..6fbbd332ce9 100644 --- a/misc/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -1921,8 +1921,10 @@ ImageList_ReplaceIcon (HIMAGELIST himl, INT32 i, HICON32 hIcon) if (hdcImage) DeleteDC32 (hdcImage); +// FIXME (imagelist, "deleting hbmColor!\n"); if (ii.hbmColor) DeleteObject32 (ii.hbmColor); +// FIXME (imagelist, "deleted hbmColor!\n"); if (ii.hbmMask) DeleteObject32 (ii.hbmMask); diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c new file mode 100644 index 00000000000..91fe4cbd77a --- /dev/null +++ b/dlls/comctl32/listview.c @@ -0,0 +1,600 @@ +/* + * Listview control + * + * Copyright 1998 Eric Kohl + * + * NOTES + * This is just a dummy control. An author is needed! Any volunteers? + * I will only improve this control once in a while. + * Eric + * + * TODO: + * - All messages. + * - All notifications. + */ + +#include "windows.h" +#include "commctrl.h" +#include "listview.h" +#include "win.h" +#include "debug.h" + + +#define LISTVIEW_GetInfoPtr(wndPtr) ((LISTVIEW_INFO *)wndPtr->wExtra[0]) + + +static VOID +LISTVIEW_Refresh (WND *wndPtr, HDC32 hdc) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + + +} + + + +// << LISTVIEW_FindItem >> + + +static LRESULT +LISTVIEW_GetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + return infoPtr->clrBk; +} + + +// << LISTVIEW_GetBkImage >> + + +__inline__ static LRESULT +LISTVIEW_GetColumnWidth (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + HDITEM32A hdi; + + hdi.mask = HDI_WIDTH; + if (SendMessage32A (infoPtr->hwndHeader, HDM_GETITEM32A, + wParam, (LPARAM)&hdi)) + return hdi.cxy; + + return 0; +} + + + + +__inline__ static LRESULT +LISTVIEW_GetHeader (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + return infoPtr->hwndHeader; +} + + +static LRESULT +LISTVIEW_GetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + TRACE (listview, "(0x%08x)\n", wParam); + + switch (wParam) { + case LVSIL_NORMAL: + return (LRESULT)infoPtr->himlNormal; + + case LVSIL_SMALL: + return (LRESULT)infoPtr->himlSmall; + + case LVSIL_STATE: + return (LRESULT)infoPtr->himlState; + } + + return (LRESULT)NULL; +} + + +static LRESULT +LISTVIEW_GetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + FIXME (listview, "(0x%08x) empty stub!\n", wParam); + + + + return TRUE; +} + + + +__inline__ static LRESULT +LISTVIEW_GetItemCount (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + return infoPtr->nItemCount; +} + + + +static LRESULT +LISTVIEW_GetStringWidth32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + LPSTR lpsz = (LPSTR)lParam; + HFONT32 hFont, hOldFont; + HDC32 hdc; + SIZE32 size; + + if (!lpsz) + return 0; + + TRACE (listview, "(%s) empty stub!\n", lpsz); + + hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject32 (SYSTEM_FONT); + hdc = GetDC32 (0); + hOldFont = SelectObject32 (hdc, hFont); + GetTextExtentPoint32A (hdc, lpsz, lstrlen32A(lpsz), &size); + SelectObject32 (hdc, hOldFont); + ReleaseDC32 (0, hdc); + + TRACE (listview, "-- ret=%d\n", size.cx); + + return (LRESULT)size.cx; +} + + + + +static LRESULT +LISTVIEW_InsertColumn32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + LPLVCOLUMN32A lpcol = (LPLVCOLUMN32A)lParam; + HDITEM32A hdi; + + if (!lpcol) + return -1; + + TRACE (listview, "(%d %p) empty stub!\n", (INT32)wParam, lpcol); + + ZeroMemory (&hdi, sizeof(HDITEM32A)); + + if (lpcol->mask & LVCF_FMT) { + if (wParam == 0) + hdi.fmt |= HDF_LEFT; + else if (lpcol->fmt & LVCFMT_LEFT) + hdi.fmt |= HDF_LEFT; + else if (lpcol->fmt & LVCFMT_RIGHT) + hdi.fmt |= HDF_RIGHT; + else if (lpcol->fmt & LVCFMT_CENTER) + hdi.fmt |= HDF_CENTER; + + if (lpcol->fmt & LVCFMT_COL_HAS_IMAGES) + hdi.fmt |= HDF_IMAGE; + + hdi.mask |= HDI_FORMAT; + } + + if (lpcol->mask & LVCF_WIDTH) { + hdi.mask |= HDI_WIDTH; + hdi.cxy = lpcol->cx; + } + + if (lpcol->mask & LVCF_TEXT) { + hdi.mask |= (HDI_TEXT | HDI_FORMAT); + hdi.pszText = lpcol->pszText; + hdi.fmt |= HDF_STRING; + } + + if (lpcol->mask & LVCF_IMAGE) { + hdi.mask |= HDI_IMAGE; + hdi.iImage = lpcol->iImage; + } + + if (lpcol->mask & LVCF_ORDER) { + hdi.mask |= HDI_ORDER; + hdi.iOrder = lpcol->iOrder; + } + + return (LRESULT)SendMessage32A (infoPtr->hwndHeader, HDM_INSERTITEM32A, + wParam, (LPARAM)&hdi); +} + + + + +static LRESULT +LISTVIEW_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + if (!(infoPtr)) return FALSE; + + /* set background color */ + TRACE (listview, "0x%06x\n", (COLORREF)lParam); + infoPtr->clrBk = (COLORREF)lParam; + + return TRUE; +} + + +static LRESULT +LISTVIEW_SetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + HIMAGELIST himlTemp = 0; + + TRACE (listview, "(0x%08x 0x%08lx)\n", wParam, lParam); + + switch (wParam) { + case LVSIL_NORMAL: + himlTemp = infoPtr->himlNormal; + infoPtr->himlNormal = (HIMAGELIST)lParam; + return (LRESULT)himlTemp; + + case LVSIL_SMALL: + himlTemp = infoPtr->himlSmall; + infoPtr->himlSmall = (HIMAGELIST)lParam; + return (LRESULT)himlTemp; + + case LVSIL_STATE: + himlTemp = infoPtr->himlState; + infoPtr->himlState = (HIMAGELIST)lParam; + return (LRESULT)himlTemp; + } + + return (LRESULT)NULL; +} + + + + +static LRESULT +LISTVIEW_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + /* info structure is created at NCCreate */ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + LOGFONT32A logFont; + DWORD dwStyle = WS_CHILD | WS_VISIBLE; + + + /* initialize info structure */ + infoPtr->clrBk = CLR_NONE; + + if (!(wndPtr->dwStyle & LVS_REPORT) || + (wndPtr->dwStyle & LVS_NOCOLUMNHEADER)) + dwStyle |= HDS_HIDDEN; + if (!(wndPtr->dwStyle & LVS_NOSORTHEADER)) + dwStyle |= HDS_BUTTONS; + + /* create header */ + infoPtr->hwndHeader = + CreateWindow32A (WC_HEADER32A, "", dwStyle, + 0, 0, 0, 0, wndPtr->hwndSelf, + (HMENU32)0, wndPtr->hInstance, NULL); + + /* get default font (icon title) */ + SystemParametersInfo32A (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); + infoPtr->hDefaultFont = CreateFontIndirect32A (&logFont); + infoPtr->hFont = infoPtr->hDefaultFont; + + /* set header font */ + SendMessage32A (infoPtr->hwndHeader, WM_SETFONT, + (WPARAM32)infoPtr->hFont, (LPARAM)TRUE); + + + infoPtr->hdsaItems = DSA_Create (sizeof(LISTVIEW_ITEM), 10); + + return 0; +} + + +static LRESULT +LISTVIEW_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + DSA_Destroy (infoPtr->hdsaItems); + + /* destroy header */ + if (infoPtr->hwndHeader) + DestroyWindow32 (infoPtr->hwndHeader); + + /* destroy font */ + infoPtr->hFont = (HFONT32)0; + if (infoPtr->hDefaultFont) + DeleteObject32 (infoPtr->hDefaultFont); + + + + return 0; +} + + +static LRESULT +LISTVIEW_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + if (infoPtr->clrBk == CLR_NONE) { + return SendMessage32A (GetParent32 (wndPtr->hwndSelf), + WM_ERASEBKGND, wParam, lParam); + } + else { + HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk); + FillRect32 ((HDC32)wParam, &infoPtr->rcList, hBrush); + DeleteObject32 (hBrush); + return FALSE; + } + return FALSE; +} + + +__inline__ static LRESULT +LISTVIEW_GetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + return infoPtr->hFont; +} + + +// << LISTVIEW_HScroll >> +// << LISTVIEW_KeyDown >> +// << LISTVIEW_KillFocus >> + + +static LRESULT +LISTVIEW_NCCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr; + + /* allocate memory for info structure */ + infoPtr = (LISTVIEW_INFO *)COMCTL32_Alloc (sizeof(LISTVIEW_INFO)); + wndPtr->wExtra[0] = (DWORD)infoPtr; + + if (infoPtr == NULL) { + ERR (listview, "could not allocate info memory!\n"); + return 0; + } + + if ((LISTVIEW_INFO*)wndPtr->wExtra[0] != infoPtr) { + ERR (listview, "pointer assignment error!\n"); + return 0; + } + + return DefWindowProc32A (wndPtr->hwndSelf, WM_NCCREATE, wParam, lParam); +} + + +static LRESULT +LISTVIEW_NCDestroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + + + + + /* free list view info data */ + COMCTL32_Free (infoPtr); + + return 0; +} + + +static LRESULT +LISTVIEW_Paint (WND *wndPtr, WPARAM32 wParam) +{ + HDC32 hdc; + PAINTSTRUCT32 ps; + + hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam; + LISTVIEW_Refresh (wndPtr, hdc); + if (!wParam) + EndPaint32 (wndPtr->hwndSelf, &ps); + return 0; +} + + + + +static LRESULT +LISTVIEW_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + HFONT32 hFont = (HFONT32)wParam; + + infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont; + + /* set header font */ + SendMessage32A (infoPtr->hwndHeader, WM_SETFONT, wParam, lParam); + + /* reinitialize the listview */ + + + + if (lParam) { + /* force redraw */ + + + } + + return 0; +} + + + + +static LRESULT +LISTVIEW_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr); + HDLAYOUT hl; + WINDOWPOS32 wp; + RECT32 rc; + + rc.top = 0; + rc.left = 0; + rc.right = LOWORD(lParam); + rc.bottom = HIWORD(lParam); + + hl.prc = &rc; + hl.pwpos = ℘ + SendMessage32A (infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl); + + SetWindowPos32 (infoPtr->hwndHeader, wndPtr->hwndSelf, + wp.x, wp.y, wp.cx, wp.cy, wp.flags); + + GetClientRect32 (wndPtr->hwndSelf, &infoPtr->rcList); + infoPtr->rcList.top += wp.cy; + + return 0; +} + + +LRESULT WINAPI +LISTVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + + switch (uMsg) + { +// case LVM_DELETEALLITEMS: + + case LVM_GETBKCOLOR: + return LISTVIEW_GetBkColor (wndPtr, wParam, lParam); + + + case LVM_GETCOLUMNWIDTH: + return LISTVIEW_GetColumnWidth (wndPtr, wParam, lParam); + + + case LVM_GETHEADER: + return LISTVIEW_GetHeader (wndPtr, wParam, lParam); + +// case LVM_GETISEARCHSTRING: + + case LVM_GETIMAGELIST: + return LISTVIEW_GetImageList (wndPtr, wParam, lParam); + + case LVM_GETITEM32A: + return LISTVIEW_GetItem32A (wndPtr, wParam, lParam); + +// case LVM_GETITEM32W: + + case LVM_GETITEMCOUNT: + return LISTVIEW_GetItemCount (wndPtr, wParam, lParam); + +// case LVM_GETSELECTEDCOUNT: + + case LVM_GETSTRINGWIDTH32A: + return LISTVIEW_GetStringWidth32A (wndPtr, wParam, lParam); + +// case LVM_GETSTRINGWIDTH32W: +// case LVM_GETSUBITEMRECT: + + case LVM_INSERTCOLUMN32A: + return LISTVIEW_InsertColumn32A (wndPtr, wParam, lParam); + + +// case LVM_INSERTCOLUMN32W: + +// case LVM_INSERTITEM32A: +// case LVM_INSERTITEM32W: + + + case LVM_SETBKCOLOR: + return LISTVIEW_SetBkColor (wndPtr, wParam, lParam); + + + case LVM_SETIMAGELIST: + return LISTVIEW_SetImageList (wndPtr, wParam, lParam); + +// case LVM_SETITEMPOSITION: + +// case LVM_SORTITEMS: + + +// case WM_CHAR: +// case WM_COMMAND: + + case WM_CREATE: + return LISTVIEW_Create (wndPtr, wParam, lParam); + + case WM_DESTROY: + return LISTVIEW_Destroy (wndPtr, wParam, lParam); + + case WM_ERASEBKGND: + return LISTVIEW_EraseBackground (wndPtr, wParam, lParam); + + case WM_GETDLGCODE: + return DLGC_WANTTAB | DLGC_WANTARROWS; + + case WM_GETFONT: + return LISTVIEW_GetFont (wndPtr, wParam, lParam); + +// case WM_HSCROLL: + +// case WM_MOUSEMOVE: +// return LISTVIEW_MouseMove (wndPtr, wParam, lParam); + + case WM_NCCREATE: + return LISTVIEW_NCCreate (wndPtr, wParam, lParam); + + case WM_NCDESTROY: + return LISTVIEW_NCDestroy (wndPtr, wParam, lParam); + +// case WM_NOTIFY: + + case WM_PAINT: + return LISTVIEW_Paint (wndPtr, wParam); + +// case WM_RBUTTONDOWN: +// case WM_SETFOCUS: + + case WM_SETFONT: + return LISTVIEW_SetFont (wndPtr, wParam, lParam); + +// case WM_SETREDRAW: + + case WM_SIZE: + return LISTVIEW_Size (wndPtr, wParam, lParam); + +// case WM_TIMER: +// case WM_VSCROLL: +// case WM_WINDOWPOSCHANGED: +// case WM_WININICHANGE: + + default: + if (uMsg >= WM_USER) + ERR (listview, "unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); + return DefWindowProc32A (hwnd, uMsg, wParam, lParam); + } + return 0; +} + + +void +LISTVIEW_Register (void) +{ + WNDCLASS32A wndClass; + + if (GlobalFindAtom32A (WC_LISTVIEW32A)) return; + + ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); + wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; + wndClass.lpfnWndProc = (WNDPROC32)LISTVIEW_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *); + wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); + wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1); + wndClass.lpszClassName = WC_LISTVIEW32A; + + RegisterClass32A (&wndClass); +} + diff --git a/controls/pager.c b/dlls/comctl32/pager.c similarity index 74% rename from controls/pager.c rename to dlls/comctl32/pager.c index 60612c2e42a..e5c231ed851 100644 --- a/controls/pager.c +++ b/dlls/comctl32/pager.c @@ -16,7 +16,6 @@ #include "windows.h" #include "commctrl.h" #include "pager.h" -#include "heap.h" #include "win.h" #include "debug.h" @@ -49,7 +48,7 @@ PAGER_GetBorder (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - return (LRESULT)infoPtr->iBorder; + return (LRESULT)infoPtr->nBorder; } @@ -58,11 +57,21 @@ PAGER_GetButtonSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - return (LRESULT)infoPtr->iButtonSize; + return (LRESULT)infoPtr->nButtonSize; +} + + +static LRESULT +PAGER_GetButtonState (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); + + FIXME (pager, "empty stub!\n"); + + return PGF_INVISIBLE; } -// << PAGER_GetButtonState >> // << PAGER_GetDropTarget >> @@ -71,16 +80,33 @@ PAGER_GetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - return infoPtr->iPos; + return infoPtr->nPos; } static LRESULT PAGER_RecalcSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { -// PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); + PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); + NMPGCALCSIZE nmpgcs; - FIXME (pager, "empty stub!\n"); + if (infoPtr->hwndChild) { + nmpgcs.hdr.hwndFrom = wndPtr->hwndSelf; + nmpgcs.hdr.idFrom = wndPtr->wIDmenu; + nmpgcs.hdr.code = PGN_CALCSIZE; + nmpgcs.dwFlag = + (wndPtr->dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT; + SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY, + (WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmpgcs); + + infoPtr->nChildSize = + (wndPtr->dwStyle & PGS_HORZ) ? nmpgcs.iWidth : nmpgcs.iHeight; + + + FIXME (pager, "Child size %d\n", infoPtr->nChildSize); + + + } return 0; } @@ -104,9 +130,9 @@ static __inline__ LRESULT PAGER_SetBorder (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - INT32 nTemp = infoPtr->iBorder; + INT32 nTemp = infoPtr->nBorder; - infoPtr->iBorder = (INT32)lParam; + infoPtr->nBorder = (INT32)lParam; /* FIXME: redraw */ @@ -118,9 +144,11 @@ static __inline__ LRESULT PAGER_SetButtonSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - INT32 nTemp = infoPtr->iButtonSize; + INT32 nTemp = infoPtr->nButtonSize; - infoPtr->iButtonSize = (INT32)lParam; + infoPtr->nButtonSize = (INT32)lParam; + + FIXME (pager, "size=%d\n", infoPtr->nButtonSize); /* FIXME: redraw */ @@ -133,9 +161,15 @@ PAGER_SetChild (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - infoPtr->hwndChild = (HWND32)lParam; + infoPtr->hwndChild = IsWindow32 ((HWND32)lParam) ? (HWND32)lParam : 0; + + FIXME (pager, "hwnd=%x\n", infoPtr->hwndChild); /* FIXME: redraw */ + SetParent32 (infoPtr->hwndChild, wndPtr->hwndSelf); + SetWindowPos32 (infoPtr->hwndChild, wndPtr->hwndSelf, + 0, 0, 40, 40, SWP_SHOWWINDOW); + RedrawWindow32 (wndPtr->hwndSelf, NULL, 0, RDW_INVALIDATE); return 0; } @@ -146,9 +180,13 @@ PAGER_SetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { PAGER_INFO *infoPtr = PAGER_GetInfoPtr(wndPtr); - infoPtr->iPos = (INT32)lParam; + infoPtr->nPos = (INT32)lParam; + + FIXME (pager, "pos=%d\n", infoPtr->nPos); /* FIXME: redraw */ + SetWindowPos32 (infoPtr->hwndChild, wndPtr->hwndSelf, + 0, 0, 0, 0, SWP_NOSIZE); return 0; } @@ -160,8 +198,7 @@ PAGER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) PAGER_INFO *infoPtr; /* allocate memory for info structure */ - infoPtr = (PAGER_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, - sizeof(PAGER_INFO)); + infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO)); wndPtr->wExtra[0] = (DWORD)infoPtr; if (infoPtr == NULL) { @@ -177,9 +214,9 @@ PAGER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) /* set default settings */ infoPtr->hwndChild = 0; infoPtr->clrBk = GetSysColor32 (COLOR_BTNFACE); - infoPtr->iBorder = 0; - infoPtr->iButtonSize = 0; - infoPtr->iPos = 0; + infoPtr->nBorder = 0; + infoPtr->nButtonSize = 0; + infoPtr->nPos = 0; return 0; @@ -195,7 +232,7 @@ PAGER_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) /* free pager info data */ - HeapFree (GetProcessHeap (), 0, infoPtr); + COMCTL32_Free (infoPtr); return 0; } @@ -208,9 +245,9 @@ PAGER_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk); RECT32 rect; - GetClientRect32 (wndPtr->hwndSelf, &rect); - FillRect32 ((HDC32)wParam, &rect, hBrush); - DeleteObject32 (hBrush); +// GetClientRect32 (wndPtr->hwndSelf, &rect); +// FillRect32 ((HDC32)wParam, &rect, hBrush); +// DeleteObject32 (hBrush); return TRUE; } @@ -238,7 +275,9 @@ PAGER_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) case PGM_GETBUTTONSIZE: return PAGER_GetButtonSize (wndPtr, wParam, lParam); -// case PGM_GETBUTTONSTATE: + case PGM_GETBUTTONSTATE: + return PAGER_GetButtonState (wndPtr, wParam, lParam); + // case PGM_GETDROPTARGET: case PGM_GETPOS: diff --git a/controls/progress.c b/dlls/comctl32/progress.c similarity index 100% rename from controls/progress.c rename to dlls/comctl32/progress.c diff --git a/controls/rebar.c b/dlls/comctl32/rebar.c similarity index 75% rename from controls/rebar.c rename to dlls/comctl32/rebar.c index a36bbffbfdd..b27b5f552e9 100644 --- a/controls/rebar.c +++ b/dlls/comctl32/rebar.c @@ -24,6 +24,26 @@ #define REBAR_GetInfoPtr(wndPtr) ((REBAR_INFO *)wndPtr->wExtra[0]) + + +static VOID +REBAR_Refresh (WND *wndPtr, HDC32 hdc) +{ + RECT32 rect; + HBRUSH32 hbrBk; + + GetClientRect32 (wndPtr->hwndSelf, &rect); + + hbrBk = CreateSolidBrush32 (RGB (192, 192, 192)); + FillRect32 (hdc, &rect, hbrBk); + DeleteObject32 (hbrBk); +} + + + + + + // << REBAR_BeginDrag >> // << REBAR_DeleteBand >> // << REBAR_DragMove >> @@ -51,7 +71,7 @@ REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi == NULL) return FALSE; - if (lprbbi->cbSize < sizeof (LPREBARBANDINFO32A)) + if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A) return FALSE; if ((UINT32)wParam >= infoPtr->uNumBands) return FALSE; @@ -97,16 +117,17 @@ REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi->fMask & RBBIM_ID) lprbbi->wID = lpBand->wID; - /* FIXME: check for size of band info structure */ + /* check for additional data */ + if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) { + if (lprbbi->fMask & RBBIM_IDEALSIZE) + lprbbi->cxIdeal = lpBand->cxIdeal; - if (lprbbi->fMask & RBBIM_IDEALSIZE) - lprbbi->cxIdeal = lpBand->cxIdeal; + if (lprbbi->fMask & RBBIM_LPARAM) + lprbbi->lParam = lpBand->lParam; - if (lprbbi->fMask & RBBIM_LPARAM) - lprbbi->lParam = lpBand->lParam; - - if (lprbbi->fMask & RBBIM_HEADERSIZE) - lprbbi->cxHeader = lpBand->cxHeader; + if (lprbbi->fMask & RBBIM_HEADERSIZE) + lprbbi->cxHeader = lpBand->cxHeader; + } return TRUE; } @@ -114,7 +135,16 @@ REBAR_GetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) // << REBAR_GetBandInfo32W >> -// << REBAR_GetBarHeight >> + +static LRESULT +REBAR_GetBarHeight (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); + + FIXME (rebar, "returns fixed height of 40 pixels!\n"); + + return 40; +} static LRESULT @@ -187,10 +217,13 @@ REBAR_IdToIndex (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TRACE (rebar, "id %u\n", (UINT32)wParam); for (i = 0; i < infoPtr->uNumBands; i++) { - if (infoPtr->bands[i].wID == (UINT32)wParam) + if (infoPtr->bands[i].wID == (UINT32)wParam) { + TRACE (rebar, "band %u found!\n", i); return i; + } } + TRACE (rebar, "no band found!\n"); return -1; } @@ -207,9 +240,11 @@ REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) return FALSE; if (lprbbi == NULL) return FALSE; - if (lprbbi->cbSize < sizeof (REBARBANDINFO32A)) + if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A) return FALSE; + TRACE (rebar, "insert band at %u!\n", uIndex); + if (infoPtr->uNumBands == 0) { infoPtr->bands = (REBAR_BAND *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, @@ -221,12 +256,20 @@ REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) infoPtr->bands = (REBAR_BAND *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, (infoPtr->uNumBands+1)*sizeof(REBAR_BAND)); - if ((INT32)uIndex == -1) + if (((INT32)uIndex == -1) || (uIndex > infoPtr->uNumBands)) uIndex = infoPtr->uNumBands; - /* pre copy */ + /* pre insert copy */ + if (uIndex > 0) { + memcpy (&infoPtr->bands[0], &oldBands[0], + uIndex * sizeof(REBAR_BAND)); + } /* post copy */ + if (uIndex < infoPtr->uNumBands - 1) { + memcpy (&infoPtr->bands[uIndex+1], &oldBands[uIndex], + (infoPtr->uNumBands - uIndex - 1) * sizeof(REBAR_BAND)); + } HeapFree (GetProcessHeap (), 0, &oldBands); } @@ -258,8 +301,11 @@ REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi->fMask & RBBIM_IMAGE) lpBand->iImage = lprbbi->iImage; - if (lprbbi->fMask & RBBIM_CHILD) + if (lprbbi->fMask & RBBIM_CHILD) { lpBand->hwndChild = lprbbi->hwndChild; + lpBand->hwndPrevParent = + SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf); + } if (lprbbi->fMask & RBBIM_CHILDSIZE) { lpBand->cxMinChild = lprbbi->cxMinChild; @@ -278,16 +324,17 @@ REBAR_InsertBand32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi->fMask & RBBIM_ID) lpBand->wID = lprbbi->wID; - /* FIXME: check for size of band info structure */ + /* check for additional data */ + if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) { + if (lprbbi->fMask & RBBIM_IDEALSIZE) + lpBand->cxIdeal = lprbbi->cxIdeal; - if (lprbbi->fMask & RBBIM_IDEALSIZE) - lpBand->cxIdeal = lprbbi->cxIdeal; + if (lprbbi->fMask & RBBIM_LPARAM) + lpBand->lParam = lprbbi->lParam; - if (lprbbi->fMask & RBBIM_LPARAM) - lpBand->lParam = lprbbi->lParam; - - if (lprbbi->fMask & RBBIM_HEADERSIZE) - lpBand->cxHeader = lprbbi->cxHeader; + if (lprbbi->fMask & RBBIM_HEADERSIZE) + lpBand->cxHeader = lprbbi->cxHeader; + } return TRUE; } @@ -308,7 +355,7 @@ REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi == NULL) return FALSE; - if (lprbbi->cbSize < sizeof (LPREBARBANDINFO32A)) + if (lprbbi->cbSize < REBARBANDINFO_V3_SIZE32A) return FALSE; if ((UINT32)wParam >= infoPtr->uNumBands) return FALSE; @@ -340,8 +387,11 @@ REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi->fMask & RBBIM_IMAGE) lpBand->iImage = lprbbi->iImage; - if (lprbbi->fMask & RBBIM_CHILD) + if (lprbbi->fMask & RBBIM_CHILD) { lpBand->hwndChild = lprbbi->hwndChild; + lpBand->hwndPrevParent = + SetParent32 (lpBand->hwndChild, wndPtr->hwndSelf); + } if (lprbbi->fMask & RBBIM_CHILDSIZE) { lpBand->cxMinChild = lprbbi->cxMinChild; @@ -360,16 +410,17 @@ REBAR_SetBandInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lprbbi->fMask & RBBIM_ID) lpBand->wID = lprbbi->wID; - /* FIXME: check for size of band info structure */ + /* check for additional data */ + if (lprbbi->cbSize >= sizeof (REBARBANDINFO32A)) { + if (lprbbi->fMask & RBBIM_IDEALSIZE) + lpBand->cxIdeal = lprbbi->cxIdeal; - if (lprbbi->fMask & RBBIM_IDEALSIZE) - lpBand->cxIdeal = lprbbi->cxIdeal; + if (lprbbi->fMask & RBBIM_LPARAM) + lpBand->lParam = lprbbi->lParam; - if (lprbbi->fMask & RBBIM_LPARAM) - lpBand->lParam = lprbbi->lParam; - - if (lprbbi->fMask & RBBIM_HEADERSIZE) - lpBand->cxHeader = lprbbi->cxHeader; + if (lprbbi->fMask & RBBIM_HEADERSIZE) + lpBand->cxHeader = lprbbi->cxHeader; + } return TRUE; } @@ -436,8 +487,38 @@ REBAR_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) // << REBAR_SetTooltips >> // << REBAR_SetUnicodeFormat >> -// << REBAR_ShowBand >> -// << REBAR_SizeToRect >> + + +static LRESULT +REBAR_ShowBand (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); + + if (((INT32)wParam < 0) || ((INT32)wParam > infoPtr->uNumBands)) + return FALSE; + + if ((BOOL32)lParam) + FIXME (rebar, "show band %d\n", (INT32)wParam); + else + FIXME (rebar, "hide band %d\n", (INT32)wParam); + + return TRUE; +} + + +static LRESULT +REBAR_SizeToRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + REBAR_INFO *infoPtr = REBAR_GetInfoPtr (wndPtr); + LPRECT32 lpRect = (LPRECT32)lParam; + + if (lpRect == NULL) + return FALSE; + + FIXME (rebar, "layout change not implemented!\n"); + + return TRUE; +} @@ -447,8 +528,7 @@ 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)); + infoPtr = (REBAR_INFO *)COMCTL32_Alloc (sizeof(REBAR_INFO)); wndPtr->wExtra[0] = (DWORD)infoPtr; if (infoPtr == NULL) { @@ -461,7 +541,7 @@ REBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) return 0; } - + /* initialize info structure */ infoPtr->clrText = CLR_NONE; infoPtr->clrText = RGB(0, 0, 0); @@ -497,7 +577,7 @@ REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } /* free rebar info data */ - HeapFree (GetProcessHeap (), 0, infoPtr); + COMCTL32_Free (infoPtr); TRACE (rebar, "destroyed!\n"); return 0; @@ -505,6 +585,20 @@ REBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +static LRESULT +REBAR_Paint (WND *wndPtr, WPARAM32 wParam) +{ + HDC32 hdc; + PAINTSTRUCT32 ps; + + hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam; + REBAR_Refresh (wndPtr, hdc); + if (!wParam) + EndPaint32 (wndPtr->hwndSelf, &ps); + return 0; +} + + LRESULT WINAPI REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) @@ -529,7 +623,9 @@ REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) // case RB_GETBANDINFO32W: -// case RB_GETBARHEIGHT: + + case RB_GETBARHEIGHT: + return REBAR_GetBarHeight (wndPtr, wParam, lParam); case RB_GETBARINFO: return REBAR_GetBarInfo (wndPtr, wParam, lParam); @@ -582,8 +678,12 @@ REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) // case RB_SETTOOLTIPS: // case RB_SETUNICODEFORMAT: -// case RB_SHOWBAND: -// case RB_SIZETORECT: + + case RB_SHOWBAND: + return REBAR_ShowBand (wndPtr, wParam, lParam); + + case RB_SIZETORECT: + return REBAR_SizeToRect (wndPtr, wParam, lParam); case WM_CREATE: @@ -597,8 +697,8 @@ REBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) // case WM_MOUSEMOVE: // return REBAR_MouseMove (wndPtr, wParam, lParam); -// case WM_PAINT: -// return REBAR_Paint (wndPtr, wParam); + case WM_PAINT: + return REBAR_Paint (wndPtr, wParam); // case WM_SETFONT: @@ -624,12 +724,12 @@ REBAR_Register (void) if (GlobalFindAtom32A (REBARCLASSNAME32A)) return; ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); - wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS; + wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = (WNDPROC32)REBAR_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(REBAR_INFO *); - wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); - wndClass.hbrBackground = 0; + wndClass.hCursor = 0; + wndClass.hbrBackground = (HBRUSH32) COLOR_BTNFACE + 1; wndClass.lpszClassName = REBARCLASSNAME32A; RegisterClass32A (&wndClass); diff --git a/controls/status.c b/dlls/comctl32/status.c similarity index 100% rename from controls/status.c rename to dlls/comctl32/status.c diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c new file mode 100644 index 00000000000..21eca639ab1 --- /dev/null +++ b/dlls/comctl32/tab.c @@ -0,0 +1,392 @@ +/* + * Tab control + * + * Copyright 1998 Anders Carlsson + * + * TODO: + * Image list support + * Multiline support + * Unicode support + * Updown control support + * Look and feel + * Messages to be added in commctrl.h + * ... + */ + +#include "windows.h" +#include "commctrl.h" +#include "tab.h" +#include "heap.h" +#include "win.h" +#include "debug.h" + + +#define TAB_GetInfoPtr(wndPtr) ((TAB_INFO *)wndPtr->wExtra[0]) + +static BOOL32 +TAB_SendSimpleNotify (WND *wndPtr, UINT32 code) +{ + NMHDR nmhdr; + + nmhdr.hwndFrom = wndPtr->hwndSelf; + nmhdr.idFrom = wndPtr->wIDmenu; + nmhdr.code = code; + + return (BOOL32) SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY, + (WPARAM32) nmhdr.idFrom, (LPARAM) &nmhdr); +} + +static LRESULT +TAB_GetCurSel (WND *wndPtr) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + + return infoPtr->iSelected; +} + +static LRESULT +TAB_LButtonUp (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + POINT32 pt; + RECT32 rect; + INT32 iCount; + + pt.x = (INT32)LOWORD(lParam); + pt.y = (INT32)HIWORD(lParam); + + GetClientRect32 (wndPtr->hwndSelf, &rect); + + if (PtInRect32 (&rect, pt)) + { + for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) { + rect = infoPtr->items[iCount].rect; + if (PtInRect32 (&rect, pt)) { + TRACE(tab, "On Tab, item %d\n", iCount); + + if (infoPtr->iSelected != iCount) { + infoPtr->iSelected = iCount; + + TAB_SendSimpleNotify(wndPtr, TCN_SELCHANGE); + } + + return 0; + } + } + } + + return 0; +} + +static void +TAB_SetItemBounds (WND *wndPtr) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + RECT32 rect; + HFONT32 hFont, hOldFont; + INT32 i, left; + SIZE32 size; + HDC32 hdc; + + /* FIXME: Is this needed? */ + GetClientRect32 (wndPtr->hwndSelf, &rect); + + hdc = GetDC32(wndPtr->hwndSelf); + + hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject32 (SYSTEM_FONT); + hOldFont = SelectObject32 (hdc, hFont); + + left = rect.left; + + for (i = 0; i < infoPtr->uNumItem; i++) + { + infoPtr->items[i].rect.left = left; + infoPtr->items[i].rect.top = infoPtr->rect.top; + + GetTextExtentPoint32A(hdc, + infoPtr->items[i].pszText, + lstrlen32A(infoPtr->items[i].pszText), &size); + infoPtr->items[i].rect.right = left + size.cx+2*5; + infoPtr->items[i].rect.bottom = infoPtr->rect.top + 20; + TRACE(tab, "TextSize: %i - ", size.cx); + TRACE(tab, "Rect: T %i, L %i, B %i, R %i\n", + infoPtr->items[i].rect.top, + infoPtr->items[i].rect.left, + infoPtr->items[i].rect.bottom, + infoPtr->items[i].rect.right); + left += (size.cx + 11); + } + + SelectObject32 (hdc, hOldFont); + ReleaseDC32 (wndPtr->hwndSelf, hdc); +} + +static void +TAB_DrawItem (WND *wndPtr, HDC32 hdc, INT32 iItem) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + TAB_ITEM *pti = &infoPtr->items[iItem]; + RECT32 r; + INT32 oldBkMode; + + HPEN32 hwPen = CreatePen32 (PS_SOLID, 1, RGB (255, 255, 255 )); + HPEN32 hbPen = CreatePen32 (PS_SOLID, 1, GetSysColor32 (COLOR_BTNSHADOW)); + HPEN32 hsdPen = CreatePen32(PS_SOLID, 1, GetSysColor32 (COLOR_BTNTEXT)); + HPEN32 htmpPen = (HPEN32)NULL; + + CopyRect32(&r, &pti->rect); + + htmpPen = hwPen; + htmpPen = SelectObject32 (hdc, htmpPen); + MoveToEx32 (hdc, r.left, r.bottom, NULL); + LineTo32 (hdc, r.left, r.top + 2); + LineTo32 (hdc, r.left +2, r.top); + + LineTo32 (hdc, r.right -1, r.top); + htmpPen = SelectObject32 (hdc, htmpPen); + + htmpPen = SelectObject32 (hdc, hbPen); + MoveToEx32 (hdc, r.right-1, r.top, NULL); + LineTo32 (hdc,r.right-1, r.bottom-1); + hbPen = SelectObject32 (hdc, hsdPen); + MoveToEx32 (hdc, r.right, r.top+1, NULL); + LineTo32(hdc, r.right,r.bottom); + hsdPen = SelectObject32(hdc,htmpPen); + DeleteObject32(hwPen); + DeleteObject32(hbPen); + DeleteObject32(hsdPen); + + oldBkMode = SetBkMode32(hdc, TRANSPARENT); + r.left += 3; + r.right -= 3; + SetTextColor32 (hdc, COLOR_BTNTEXT); + DrawText32A(hdc, pti->pszText, lstrlen32A(pti->pszText), + &r, DT_LEFT|DT_SINGLELINE|DT_VCENTER); + if (oldBkMode != TRANSPARENT) + SetBkMode32(hdc, oldBkMode); +} + +static void +TAB_DrawBorder (WND *wndPtr, HDC32 hdc) +{ + HPEN32 htmPen; + HPEN32 hwPen = GetStockObject32(WHITE_PEN); + HPEN32 hbPen = GetStockObject32(BLACK_PEN); + HPEN32 hShade = CreatePen32 ( PS_SOLID, 1, GetSysColor32 (COLOR_BTNSHADOW)); + RECT32 rect; + + htmPen = SelectObject32 (hdc, hwPen); + GetClientRect32 (wndPtr->hwndSelf, &rect); + + MoveToEx32 (hdc, rect.left, rect.bottom, NULL); + LineTo32 (hdc, rect.left, rect.top+20); + + LineTo32 (hdc, rect.right, rect.top+20); + + hwPen = SelectObject32 (hdc, htmPen); + LineTo32 (hdc, rect.right, rect.bottom ); + LineTo32 (hdc, rect.left, rect.bottom); + hbPen = SelectObject32 (hdc, hShade ); + MoveToEx32 (hdc, rect.right-1, rect.top+20, NULL); + LineTo32 (hdc, rect.right-1, rect.bottom-1); + LineTo32 (hdc, rect.left, rect.bottom-1); + hShade = SelectObject32(hdc, hShade); + DeleteObject32 (hShade); +} + + +static void +TAB_Refresh (WND *wndPtr, HDC32 hdc) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + HFONT32 hFont, hOldFont; + RECT32 rect; + HBRUSH32 hbrBk; + INT32 i; + + TAB_DrawBorder (wndPtr, hdc); + + for (i = 0; i < infoPtr->uNumItem; i++) { + TAB_DrawItem (wndPtr, hdc, i); + } + +} + +static LRESULT +TAB_Paint (WND *wndPtr, WPARAM32 wParam) +{ + HDC32 hdc; + PAINTSTRUCT32 ps; + + hdc = wParam== 0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam; + TAB_Refresh (wndPtr, hdc); + + if(!wParam) + EndPaint32 (wndPtr->hwndSelf, &ps); + return 0; +} + +static LRESULT +TAB_InsertItem (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + TCITEM *pti; + HDC32 hdc; + INT32 iItem, len; + + pti = (TCITEM*)lParam; + iItem = (INT32)wParam; + + if (iItem < 0) return -1; + if (iItem > infoPtr->uNumItem) + iItem = infoPtr->uNumItem; + + if (infoPtr->uNumItem == 0) { + infoPtr->items = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, + sizeof (TAB_ITEM)); + infoPtr->uNumItem++; + } + else { + TAB_ITEM *oldItems = infoPtr->items; + + infoPtr->uNumItem++; + infoPtr->items = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, + sizeof (TAB_ITEM) * infoPtr->uNumItem); + + /* pre insert copy */ + if (iItem > 0) { + memcpy (&infoPtr->items[0], &oldItems[0], + iItem * sizeof(TAB_ITEM)); + } + + /* post insert copy */ + if (iItem < infoPtr->uNumItem - 1) { + memcpy (&infoPtr->items[iItem+1], &oldItems[iItem], + (infoPtr->uNumItem - iItem) * sizeof(TAB_ITEM)); + + } + + HeapFree (GetProcessHeap (), 0, oldItems); + } + + infoPtr->items[iItem].mask = pti->mask; + if (pti->mask & TCIF_TEXT) { + len = lstrlen32A (pti->pszText); + infoPtr->items[iItem].pszText = + HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, len+1); + lstrcpy32A (infoPtr->items[iItem].pszText, pti->pszText); + infoPtr->items[iItem].cchTextMax = pti->cchTextMax; + } + + + + if (pti->mask & TCIF_IMAGE) + infoPtr->items[iItem].iImage = pti->iImage; + + if (pti->mask & TCIF_PARAM) + infoPtr->items[iItem].lParam = pti->lParam; + + hdc = GetDC32 (wndPtr->hwndSelf); + TAB_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + + TRACE(tab, "[%04x]: added item %d '%s'\n", + wndPtr->hwndSelf, iItem, infoPtr->items[iItem].pszText); + + TAB_SetItemBounds(wndPtr); + return iItem; +} + +static LRESULT +TAB_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TAB_INFO *infoPtr; + + infoPtr = (TAB_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, + sizeof(TAB_INFO)); + wndPtr->wExtra[0] = (DWORD)infoPtr; + + infoPtr->uNumItem = 0; + infoPtr->hFont = 0; + infoPtr->items = 0; + infoPtr->hcurArrow = LoadCursor32A (0, IDC_ARROW32A); + infoPtr->iSelected = -1; + + TRACE(tab, "Created tab control, hwnd [%04x]\n", wndPtr->hwndSelf); + return 0; +} + +static LRESULT +TAB_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TAB_INFO *infoPtr = TAB_GetInfoPtr(wndPtr); + INT32 iItem; + + if (infoPtr->items) { + for (iItem = 0; iItem < infoPtr->uNumItem; iItem++) { + if (infoPtr->items[iItem].pszText) + HeapFree (GetProcessHeap (), 0, infoPtr->items[iItem].pszText); + } + HeapFree (GetProcessHeap (), 0, infoPtr->items); + } + + HeapFree (GetProcessHeap (), 0, infoPtr); + + return 0; +} + +LRESULT WINAPI +TAB_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + + switch (uMsg) + { + + case TCM_GETCURSEL: + return TAB_GetCurSel (wndPtr); + + case TCM_INSERTITEM: + return TAB_InsertItem (wndPtr, wParam, lParam); + + case WM_CREATE: + return TAB_Create (wndPtr, wParam, lParam); + + case WM_DESTROY: + return TAB_Destroy (wndPtr, wParam, lParam); + + case WM_LBUTTONUP: + return TAB_LButtonUp (wndPtr, wParam, lParam); + case WM_PAINT: + return TAB_Paint (wndPtr, wParam); + + + default: + if (uMsg >= WM_USER) + ERR (tab, "unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); + return DefWindowProc32A (hwnd, uMsg, wParam, lParam); + } + return 0; +} + + +void +TAB_Register (void) +{ + WNDCLASS32A wndClass; + + if (GlobalFindAtom32A (WC_TABCONTROL32A)) return; + + ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); + wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS; + wndClass.lpfnWndProc = (WNDPROC32)TAB_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = sizeof(TAB_INFO *); + wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); + wndClass.hbrBackground = 0; + wndClass.lpszClassName = WC_TABCONTROL32A; + + RegisterClass32A (&wndClass); +} + diff --git a/controls/toolbar.c b/dlls/comctl32/toolbar.c similarity index 94% rename from controls/toolbar.c rename to dlls/comctl32/toolbar.c index 142ffb6ee1a..a1ac4e3ddbe 100644 --- a/controls/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -13,6 +13,7 @@ * - Tooltip support (almost complete). * - Unicode suppport. * - Internal COMMCTL32 bitmaps. + * - Fix TOOLBAR_SetButtonInfo32A. * - Fix TOOLBAR_Customize. (Customize dialog.) * * Testing: @@ -26,6 +27,7 @@ */ #include "windows.h" +#include "sysmetrics.h" #include "commctrl.h" #include "cache.h" #include "toolbar.h" @@ -151,8 +153,12 @@ TOOLBAR_DrawButton (WND *wndPtr, TBUTTON_INFO *btnPtr, HDC32 hdc) if ((btnPtr->fsStyle & TBSTYLE_CHECK) && (btnPtr->fsState & TBSTATE_CHECKED)) { HBRUSH32 hbr; - DrawEdge32 (hdc, &rc, EDGE_SUNKEN, - BF_RECT | BF_MIDDLE | BF_ADJUST); + if (bFlat) + DrawEdge32 (hdc, &rc, BDR_SUNKENOUTER, + BF_RECT | BF_MIDDLE | BF_ADJUST); + else + DrawEdge32 (hdc, &rc, EDGE_SUNKEN, + BF_RECT | BF_MIDDLE | BF_ADJUST); hbr = SelectObject32 (hdc, CACHE_GetPattern55AABrush ()); PatBlt32 (hdc, rc.left, rc.top, rc.right - rc.left, @@ -248,7 +254,6 @@ TOOLBAR_CalcToolbar (WND *wndPtr) INT32 x, y, cx, cy; BOOL32 bVertical; SIZE32 sizeString; - RECT32 rect = {0, 0, 0, 0}; TOOLBAR_CalcStrings (wndPtr, &sizeString); @@ -267,10 +272,11 @@ TOOLBAR_CalcToolbar (WND *wndPtr) cx = infoPtr->nButtonWidth; cy = infoPtr->nButtonHeight; nRows = 1; - rect.top = y; - rect.left = x; - rect.bottom = y + cy; - rect.right = x; + + infoPtr->rcBound.top = y; + infoPtr->rcBound.left = x; + infoPtr->rcBound.bottom = y + cy; + infoPtr->rcBound.right = x; btnPtr = infoPtr->buttons; for (i = 0; i < infoPtr->nNumButtons; i++, btnPtr++) { @@ -300,7 +306,6 @@ TOOLBAR_CalcToolbar (WND *wndPtr) else { /* this must be a button */ cx = infoPtr->nButtonWidth; - } btnPtr->rect.left = x; @@ -308,12 +313,12 @@ 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->rcBound.left > x) + infoPtr->rcBound.left = x; + if (infoPtr->rcBound.right < x + cx) + infoPtr->rcBound.right = x + cx; + if (infoPtr->rcBound.bottom < y + cy) + infoPtr->rcBound.bottom = y + cy; if (infoPtr->hwndToolTip) { TTTOOLINFO32A ti; @@ -338,8 +343,6 @@ 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); } @@ -550,22 +553,23 @@ TOOLBAR_AddButtons32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) infoPtr->nNumButtons = nNewButtons; - /* insert new button data (bad implementation)*/ + /* insert new button data */ for (nCount = 0; nCount < nAddButtons; nCount++) { - infoPtr->buttons[nOldButtons+nCount].iBitmap = lpTbb[nCount].iBitmap; - infoPtr->buttons[nOldButtons+nCount].idCommand = lpTbb[nCount].idCommand; - infoPtr->buttons[nOldButtons+nCount].fsState = lpTbb[nCount].fsState; - infoPtr->buttons[nOldButtons+nCount].fsStyle = lpTbb[nCount].fsStyle; - infoPtr->buttons[nOldButtons+nCount].dwData = lpTbb[nCount].dwData; - infoPtr->buttons[nOldButtons+nCount].iString = lpTbb[nCount].iString; + TBUTTON_INFO *btnPtr = &infoPtr->buttons[nOldButtons+nCount]; + btnPtr->iBitmap = lpTbb[nCount].iBitmap; + btnPtr->idCommand = lpTbb[nCount].idCommand; + btnPtr->fsState = lpTbb[nCount].fsState; + btnPtr->fsStyle = lpTbb[nCount].fsStyle; + btnPtr->dwData = lpTbb[nCount].dwData; + btnPtr->iString = lpTbb[nCount].iString; - if ((infoPtr->hwndToolTip) && !(lpTbb[nCount].fsStyle & TBSTYLE_SEP)) { + if ((infoPtr->hwndToolTip) && !(btnPtr->fsStyle & TBSTYLE_SEP)) { TTTOOLINFO32A ti; ZeroMemory (&ti, sizeof(TTTOOLINFO32A)); ti.cbSize = sizeof (TTTOOLINFO32A); ti.hwnd = wndPtr->hwndSelf; - ti.uId = lpTbb[nCount].idCommand; + ti.uId = btnPtr->idCommand; ti.hinst = 0; ti.lpszText = LPSTR_TEXTCALLBACK32A; @@ -672,7 +676,7 @@ TOOLBAR_AutoSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) INT32 x, y, cx, cy; UINT32 uPosFlags = 0; - TRACE (toolbar, "resizing!\n"); + TRACE (toolbar, "resize forced!\n"); parent = GetParent32 (wndPtr->hwndSelf); GetClientRect32(parent, &parent_rect); @@ -693,7 +697,7 @@ TOOLBAR_AutoSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) uPosFlags |= SWP_NOMOVE; if (!(wndPtr->dwStyle & CCS_NODIVIDER)) - cy += 2; + cy += sysMetrics[SM_CYEDGE]; infoPtr->bAutoSize = TRUE; SetWindowPos32 (wndPtr->hwndSelf, HWND_TOP, parent_rect.left, parent_rect.top, @@ -960,7 +964,6 @@ TOOLBAR_GetButtonInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lpTbInfo->cbSize < sizeof(LPTBBUTTONINFO32A)) return -1; nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT32)wParam); - if (nIndex == -1) return -1; @@ -968,22 +971,16 @@ TOOLBAR_GetButtonInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lpTbInfo->dwMask & TBIF_COMMAND) lpTbInfo->idCommand = btnPtr->idCommand; - if (lpTbInfo->dwMask & TBIF_IMAGE) lpTbInfo->iImage = btnPtr->iBitmap; - if (lpTbInfo->dwMask & TBIF_LPARAM) lpTbInfo->lParam = btnPtr->dwData; - if (lpTbInfo->dwMask & TBIF_SIZE) lpTbInfo->cx = (WORD)(btnPtr->rect.right - btnPtr->rect.left); - if (lpTbInfo->dwMask & TBIF_STATE) lpTbInfo->fsState = btnPtr->fsState; - if (lpTbInfo->dwMask & TBIF_STYLE) lpTbInfo->fsStyle = btnPtr->fsStyle; - if (lpTbInfo->dwMask & TBIF_TEXT) { if ((btnPtr->iString >= 0) || (btnPtr->iString < infoPtr->nNumStrings)) lstrcpyn32A (lpTbInfo->pszText, @@ -1124,11 +1121,12 @@ TOOLBAR_GetMaxSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lpSize == NULL) return FALSE; - lpSize->cx = infoPtr->maxSize.cx; - lpSize->cx = infoPtr->maxSize.cy; + lpSize->cx = infoPtr->rcBound.right - infoPtr->rcBound.left; + lpSize->cy = infoPtr->rcBound.bottom - infoPtr->rcBound.top; TRACE (toolbar, "maximum size %d x %d\n", - infoPtr->maxSize.cx, infoPtr->maxSize.cy); + infoPtr->rcBound.right - infoPtr->rcBound.left, + infoPtr->rcBound.bottom - infoPtr->rcBound.top); return TRUE; } @@ -1532,7 +1530,56 @@ TOOLBAR_SetBitmapSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -// << TOOLBAR_SetButtonInfo >> +static LRESULT +TOOLBAR_SetButtonInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr); + LPTBBUTTONINFO32A lptbbi = (LPTBBUTTONINFO32A)lParam; + TBUTTON_INFO *btnPtr; + INT32 nIndex; + + if (lptbbi == NULL) + return FALSE; + if (lptbbi->cbSize < sizeof(LPTBBUTTONINFO32A)) + return FALSE; + + nIndex = TOOLBAR_GetButtonIndex (infoPtr, (INT32)wParam); + if (nIndex == -1) + return FALSE; + + btnPtr = &infoPtr->buttons[nIndex]; + if (lptbbi->dwMask & TBIF_COMMAND) + btnPtr->idCommand = lptbbi->idCommand; + if (lptbbi->dwMask & TBIF_IMAGE) + btnPtr->iBitmap = lptbbi->iImage; + if (lptbbi->dwMask & TBIF_LPARAM) + btnPtr->dwData = lptbbi->lParam; +// if (lptbbi->dwMask & TBIF_SIZE) +// btnPtr->cx = lptbbi->cx; + if (lptbbi->dwMask & TBIF_STATE) + btnPtr->fsState = lptbbi->fsState; + if (lptbbi->dwMask & TBIF_STYLE) + btnPtr->fsStyle = lptbbi->fsStyle; + + if (lptbbi->dwMask & TBIF_TEXT) { + if ((btnPtr->iString >= 0) || + (btnPtr->iString < infoPtr->nNumStrings)) { +#if 0 + CHAR *lpString = infoPtr->strings[btnPtr->iString]; + INT32 len = lstrlen32A (lptbbi->pszText); + + lpString = HeapReAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(char)*(len+1)); + +#endif + + } + } + + return TRUE; +} + + +// << TOOLBAR_SetButtonInfo32W >> static LRESULT @@ -1729,8 +1776,30 @@ static LRESULT TOOLBAR_SetRows (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr); + LPRECT32 lprc = (LPRECT32)lParam; + HDC32 hdc; - FIXME (toolbar, "support multiple rows!\n"); + if (LOWORD(wParam) > 1) { + + FIXME (toolbar, "multiple rows not supported!\n"); + + } + + /* recalculate toolbar */ + TOOLBAR_CalcToolbar (wndPtr); + + /* return bounding rectangle */ + if (lprc) { + lprc->left = infoPtr->rcBound.left; + lprc->right = infoPtr->rcBound.right; + lprc->top = infoPtr->rcBound.top; + lprc->bottom = infoPtr->rcBound.bottom; + } + + /* repaint toolbar */ + hdc = GetDC32 (wndPtr->hwndSelf); + TOOLBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); return 0; } @@ -1788,7 +1857,7 @@ TOOLBAR_SetStyle (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLBAR_SetToolTips (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr); @@ -1997,7 +2066,6 @@ TOOLBAR_LButtonDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TOOLBAR_DrawButton (wndPtr, btnPtr, hdc); ReleaseDC32 (wndPtr->hwndSelf, hdc); } - return 0; } @@ -2113,13 +2181,11 @@ TOOLBAR_MouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) // << TOOLBAR_NCActivate >> -static LRESULT +__inline__ static LRESULT TOOLBAR_NCCalcSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { - if (!(wndPtr->dwStyle & CCS_NODIVIDER)) { - LPRECT32 winRect = (LPRECT32)lParam; - winRect->top += 2; - } + if (!(wndPtr->dwStyle & CCS_NODIVIDER)) + ((LPRECT32)lParam)->top += sysMetrics[SM_CYEDGE]; return DefWindowProc32A (wndPtr->hwndSelf, WM_NCCALCSIZE, wParam, lParam); } @@ -2159,9 +2225,8 @@ TOOLBAR_NCCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) static LRESULT TOOLBAR_NCPaint (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { - HDC32 hdc; - RECT32 rect; HWND32 hwnd = wndPtr->hwndSelf; + HDC32 hdc; if ( wndPtr->dwStyle & WS_MINIMIZE || !WIN_IsWindowDrawable( wndPtr, 0 )) return 0; /* Nothing to do */ @@ -2179,22 +2244,8 @@ TOOLBAR_NCPaint (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) return 0; } - if (!(wndPtr->flags & WIN_MANAGED)) { - if (!(wndPtr->dwStyle & CCS_NODIVIDER)) { - rect.left = wndPtr->rectClient.left; - rect.top = wndPtr->rectClient.top - 2; - rect.right = wndPtr->rectClient.right; - - SelectObject32 ( hdc, GetSysColorPen32 (COLOR_3DSHADOW)); - MoveToEx32 (hdc, rect.left, rect.top, NULL); - LineTo32 (hdc, rect.right, rect.top); - rect.top++; - SelectObject32 ( hdc, GetSysColorPen32 (COLOR_3DHILIGHT)); - MoveToEx32 (hdc, rect.left, rect.top, NULL); - LineTo32 (hdc, rect.right, rect.top); - } - - } + if (!(wndPtr->flags & WIN_MANAGED) && !(wndPtr->dwStyle & CCS_NODIVIDER)) + DrawEdge32 (hdc, &wndPtr->rectWindow, EDGE_ETCHED, BF_TOP); ReleaseDC32( hwnd, hdc ); @@ -2301,7 +2352,7 @@ TOOLBAR_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } if (!(wndPtr->dwStyle & CCS_NODIVIDER)) - cy += 2; + cy += sysMetrics[SM_CYEDGE]; SetWindowPos32 (wndPtr->hwndSelf, 0, parent_rect.left, parent_rect.top, cx, cy, uPosFlags | SWP_NOZORDER); @@ -2310,8 +2361,19 @@ TOOLBAR_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } +static LRESULT +TOOLBAR_StyleChanged (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + HDC32 hdc; + TOOLBAR_AutoSize (wndPtr, wParam, lParam); + hdc = GetDC32 (wndPtr->hwndSelf); + TOOLBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + + return 0; +} @@ -2487,7 +2549,9 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) case TB_SETBITMAPSIZE: return TOOLBAR_SetBitmapSize (wndPtr, wParam, lParam); -// case TB_SETBUTTONINFO32A: /* 4.71 */ + case TB_SETBUTTONINFO32A: + return TOOLBAR_SetButtonInfo32A (wndPtr, wParam, lParam); + // case TB_SETBUTTONINFO32W: /* 4.71 */ case TB_SETBUTTONSIZE: @@ -2554,8 +2618,6 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) case WM_CREATE: return TOOLBAR_Create (wndPtr, wParam, lParam); -// case WM_COMMAND: - case WM_DESTROY: return TOOLBAR_Destroy (wndPtr, wParam, lParam); @@ -2601,6 +2663,9 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) case WM_SIZE: return TOOLBAR_Size (wndPtr, wParam, lParam); + case WM_STYLECHANGED: + return TOOLBAR_StyleChanged (wndPtr, wParam, lParam); + // case WM_SYSCOLORCHANGE: // case WM_WININICHANGE: diff --git a/controls/tooltips.c b/dlls/comctl32/tooltips.c similarity index 91% rename from controls/tooltips.c rename to dlls/comctl32/tooltips.c index baf6971d1d2..93ea5f3f96f 100644 --- a/controls/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -29,7 +29,9 @@ #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 */ + +/* property name of tooltip window handle */ +#define TT_SUBCLASS_PROP "CC32SubclassInfo" #define TOOLTIPS_GetInfoPtr(wndPtr) ((TOOLTIPS_INFO *)wndPtr->wExtra[0]) @@ -160,6 +162,7 @@ TOOLTIPS_CalcTipSize (WND *wndPtr, TOOLTIPS_INFO *infoPtr, LPSIZE32 lpSize) hdc = GetDC32 (wndPtr->hwndSelf); hOldFont = SelectObject32 (hdc, infoPtr->hFont); DrawText32A (hdc, infoPtr->szTipText, -1, &rc, uFlags); + GetTextExtentPoint32A (hdc, infoPtr->szTipText, lstrlen32A(infoPtr->szTipText), lpSize); SelectObject32 (hdc, hOldFont); ReleaseDC32 (wndPtr->hwndSelf, hdc); @@ -337,8 +340,8 @@ TOOLTIPS_GetToolFromMessage (TOOLTIPS_INFO *infoPtr, HWND32 hwndTool) } -static BOOL32 -TOOLTIPS_CheckTool (WND *wndPtr) +static INT32 +TOOLTIPS_CheckTool (WND *wndPtr, BOOL32 bShowTest) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); POINT32 pt; @@ -349,13 +352,23 @@ TOOLTIPS_CheckTool (WND *wndPtr) hwndTool = SendMessage32A (wndPtr->hwndSelf, TTM_WINDOWFROMPOINT, 0, (LPARAM)&pt); if (hwndTool == 0) - return FALSE; + return -1; ScreenToClient32 (hwndTool, &pt); nTool = TOOLTIPS_GetToolFromPoint (infoPtr, hwndTool, &pt); + if (nTool == -1) + return -1; + +#if 0 + if (!(wndPtr->dwStyle & TTS_ALWAYSTIP) && bShowTest) { + if (!IsWindowEnabled32 (infoPtr->tools[infoPtr->nTool].hwnd)) + return -1; + } +#endif + TRACE (tooltips, "tool %d\n", nTool); - return (nTool != -1); + return nTool; } @@ -383,7 +396,10 @@ TOOLTIPS_AddTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) LPTTTOOLINFO32A lpToolInfo = (LPTTTOOLINFO32A)lParam; TTTOOL_INFO *toolPtr; - if (lpToolInfo == NULL) return FALSE; + if (lpToolInfo == NULL) + return FALSE; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; TRACE (tooltips, "add tool (%x) %x %d%s!\n", wndPtr->hwndSelf, lpToolInfo->hwnd, lpToolInfo->uId, @@ -436,7 +452,7 @@ TOOLTIPS_AddTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) if (lpToolInfo->cbSize >= sizeof(TTTOOLINFO32A)) toolPtr->lParam = lpToolInfo->lParam; - /* install subclassing */ + /* install subclassing hook */ if (toolPtr->uFlags & TTF_SUBCLASS) { if (toolPtr->uFlags & TTF_IDISHWND) { LPTT_SUBCLASS_INFO lpttsi = @@ -453,7 +469,7 @@ TOOLTIPS_AddTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) (HANDLE32)lpttsi); } else - ERR (tooltips, "A window tool must only be listed once!\n"); + WARN (tooltips, "A window tool must only be listed once!\n"); } else { LPTT_SUBCLASS_INFO lpttsi = @@ -489,8 +505,12 @@ TOOLTIPS_DelTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TTTOOL_INFO *toolPtr; INT32 nTool; - if (lpToolInfo == NULL) return 0; - if (infoPtr->uNumTools == 0) return 0; + if (lpToolInfo == NULL) + return 0; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return 0; + if (infoPtr->uNumTools == 0) + return 0; nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); if (nTool == -1) return 0; @@ -575,8 +595,12 @@ TOOLTIPS_EnumTools32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) LPTTTOOLINFO32A lpToolInfo = (LPTTTOOLINFO32A)lParam; TTTOOL_INFO *toolPtr; - if (uIndex >= infoPtr->uNumTools) return FALSE; - if (lpToolInfo == NULL) return FALSE; + if (lpToolInfo == NULL) + return FALSE; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; + if (uIndex >= infoPtr->uNumTools) + return FALSE; TRACE (tooltips, "index=%u\n", uIndex); @@ -604,21 +628,26 @@ static LRESULT TOOLTIPS_GetCurrentTool32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); - LPTTTOOLINFO32A lpti = (LPTTTOOLINFO32A)lParam; + LPTTTOOLINFO32A lpToolInfo = (LPTTTOOLINFO32A)lParam; TTTOOL_INFO *toolPtr; - if (lpti) { + if (lpToolInfo == NULL) + return FALSE; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; + + if (lpToolInfo) { if (infoPtr->nCurrentTool > -1) { toolPtr = &infoPtr->tools[infoPtr->nCurrentTool]; /* copy tool data */ - lpti->uFlags = toolPtr->uFlags; - lpti->rect = toolPtr->rect; - lpti->hinst = toolPtr->hinst; - lpti->lpszText = toolPtr->lpszText; + lpToolInfo->uFlags = toolPtr->uFlags; + lpToolInfo->rect = toolPtr->rect; + lpToolInfo->hinst = toolPtr->hinst; + lpToolInfo->lpszText = toolPtr->lpszText; - if (lpti->cbSize >= sizeof(TTTOOLINFO32A)) - lpti->lParam = toolPtr->lParam; + if (lpToolInfo->cbSize >= sizeof(TTTOOLINFO32A)) + lpToolInfo->lParam = toolPtr->lParam; return TRUE; } @@ -673,7 +702,7 @@ TOOLTIPS_GetMargin (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLTIPS_GetMaxTipWidth (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -686,16 +715,18 @@ static LRESULT TOOLTIPS_GetText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); - LPTTTOOLINFO32A lpti = (LPTTTOOLINFO32A)lParam; + LPTTTOOLINFO32A lpToolInfo = (LPTTTOOLINFO32A)lParam; INT32 nTool; - if (!(lpti)) return 0; - if (lpti->cbSize < sizeof(TTTOOLINFO32A)) return 0; + if (lpToolInfo == NULL) + return 0; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return 0; - nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpti); + nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); if (nTool == -1) return 0; - lstrcpy32A (lpti->lpszText, infoPtr->tools[nTool].lpszText); + lstrcpy32A (lpToolInfo->lpszText, infoPtr->tools[nTool].lpszText); return 0; } @@ -704,7 +735,7 @@ TOOLTIPS_GetText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) // << TOOLTIPS_GetText32W >> -static LRESULT +__inline__ static LRESULT TOOLTIPS_GetTipBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -712,7 +743,7 @@ TOOLTIPS_GetTipBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLTIPS_GetTipTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -720,7 +751,7 @@ TOOLTIPS_GetTipTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLTIPS_GetToolCount (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -736,8 +767,12 @@ TOOLTIPS_GetToolInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TTTOOL_INFO *toolPtr; INT32 nTool; - if (lpToolInfo == NULL) return FALSE; - if (infoPtr->uNumTools == 0) return FALSE; + if (lpToolInfo == NULL) + return FALSE; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; + if (infoPtr->uNumTools == 0) + return FALSE; nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); if (nTool == -1) return FALSE; @@ -804,10 +839,10 @@ TOOLTIPS_NewToolRect32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) LPTTTOOLINFO32A lpti = (LPTTTOOLINFO32A)lParam; INT32 nTool; - if (!(lpti)) return 0; -#if 0 - if (lpti->cbSize < sizeof(TTTOOLINFO32A)) return 0; -#endif + if (lpti == NULL) + return 0; + if (lpti->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpti); if (nTool == -1) return 0; @@ -821,7 +856,7 @@ TOOLTIPS_NewToolRect32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) // << TOOLTIPS_NewToolRect32W >> -static LRESULT +__inline__ static LRESULT TOOLTIPS_Pop (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -839,7 +874,7 @@ TOOLTIPS_RelayEvent (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) LPMSG32 lpMsg = (LPMSG32)lParam; POINT32 pt; - if (lParam == NULL) { + if (lParam == 0) { ERR (tooltips, "lpMsg == NULL!\n"); return 0; } @@ -947,7 +982,7 @@ TOOLTIPS_SetMargin (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLTIPS_SetMaxTipWidth (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -959,7 +994,7 @@ TOOLTIPS_SetMaxTipWidth (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLTIPS_SetTipBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -970,7 +1005,7 @@ TOOLTIPS_SetTipBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) } -static LRESULT +__inline__ static LRESULT TOOLTIPS_SetTipTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); @@ -989,7 +1024,10 @@ TOOLTIPS_SetToolInfo32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TTTOOL_INFO *toolPtr; INT32 nTool; - if (lpToolInfo == NULL) return 0; + if (lpToolInfo == NULL) + return 0; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return 0; nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); if (nTool == -1) return 0; @@ -1036,18 +1074,23 @@ TOOLTIPS_TrackActivate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); LPTTTOOLINFO32A lpToolInfo = (LPTTTOOLINFO32A)lParam; + if (lpToolInfo == NULL) + return 0; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; + if ((BOOL32)wParam) { /* activate */ infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); if (infoPtr->nTrackTool != -1) { infoPtr->bTrackActive = TRUE; - /* FIXME : show tool tip */ + /* FIXME : show tool tip ??? */ } } else { /* deactivate */ - /* FIXME : hide tool tip */ + /* FIXME : hide tool tip ??? */ infoPtr->bTrackActive = FALSE; infoPtr->nTrackTool = -1; @@ -1094,7 +1137,10 @@ TOOLTIPS_UpdateTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) TTTOOL_INFO *toolPtr; INT32 nTool; - if (lpToolInfo == NULL) return 0; + if (lpToolInfo == NULL) + return 0; + if (lpToolInfo->cbSize < TTTOOLINFO_V1_SIZE32A) + return FALSE; nTool = TOOLTIPS_GetToolFromInfoA (infoPtr, lpToolInfo); if (nTool == -1) return 0; @@ -1140,7 +1186,7 @@ static LRESULT TOOLTIPS_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr; - LOGFONT32A logFont; + NONCLIENTMETRICS32A nclm; /* allocate memory for info structure */ infoPtr = (TOOLTIPS_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, @@ -1158,8 +1204,9 @@ TOOLTIPS_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) infoPtr->clrBk = GetSysColor32 (COLOR_INFOBK); infoPtr->clrText = GetSysColor32 (COLOR_INFOTEXT); - SystemParametersInfo32A( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 ); - infoPtr->hFont = CreateFontIndirect32A( &logFont ); + nclm.cbSize = sizeof(NONCLIENTMETRICS32A); + SystemParametersInfo32A (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); + infoPtr->hFont = CreateFontIndirect32A (&nclm.lfStatusFont); infoPtr->nMaxTipWidth = -1; infoPtr->nTool = -1; @@ -1253,8 +1300,24 @@ static LRESULT TOOLTIPS_MouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); + TTTOOL_INFO *toolPtr = &infoPtr->tools[infoPtr->nTool]; - TOOLTIPS_Hide (wndPtr, infoPtr); + if (toolPtr->uFlags & TTF_TRANSPARENT) { +#if 0 + POINT32 pt; + RECT32 rc; + + pt.x = (INT32)LOWORD(lParam); + pt.y = (INT32)HIWORD(lParam); + + GetClientRect32 (toolPtr->hwnd, &rc); + ScreenToClient32 (toolPtr->hwnd, &pt); + if (PtInRect32 (&rc, pt)) + SendMessage32A (toolPtr->hwnd, WM_MOUSEMOVE, wParam, lParam); +#endif + } + else + TOOLTIPS_Hide (wndPtr, infoPtr); return 0; } @@ -1310,7 +1373,8 @@ TOOLTIPS_Timer (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { case ID_TIMER1: KillTimer32 (wndPtr->hwndSelf, ID_TIMER1); - TOOLTIPS_Show (wndPtr, infoPtr); + if (TOOLTIPS_CheckTool (wndPtr, TRUE) == infoPtr->nTool) + TOOLTIPS_Show (wndPtr, infoPtr); break; case ID_TIMER2: @@ -1319,7 +1383,7 @@ TOOLTIPS_Timer (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) case ID_TIMER3: KillTimer32 (wndPtr->hwndSelf, ID_TIMER3); - if (TOOLTIPS_CheckTool (wndPtr) == FALSE) { + if (TOOLTIPS_CheckTool (wndPtr, FALSE) == -1) { infoPtr->nTool = -1; infoPtr->nOldTool = -1; TOOLTIPS_Hide (wndPtr, infoPtr); @@ -1334,14 +1398,15 @@ static LRESULT TOOLTIPS_WinIniChange (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr(wndPtr); - LOGFONT32A logFont; + NONCLIENTMETRICS32A nclm; infoPtr->clrBk = GetSysColor32 (COLOR_INFOBK); infoPtr->clrText = GetSysColor32 (COLOR_INFOTEXT); DeleteObject32 (infoPtr->hFont); - SystemParametersInfo32A( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 ); - infoPtr->hFont = CreateFontIndirect32A( &logFont ); + nclm.cbSize = sizeof(NONCLIENTMETRICS32A); + SystemParametersInfo32A (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); + infoPtr->hFont = CreateFontIndirect32A (&nclm.lfStatusFont); return 0; } diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c new file mode 100644 index 00000000000..f80f433f8a8 --- /dev/null +++ b/dlls/comctl32/trackbar.c @@ -0,0 +1,901 @@ +/* + * Trackbar control + * + * Copyright 1998 Eric Kohl + * + * NOTES + * Development in progress. Author needed! Any volunteers? + * I will only improve this control once in a while. + * Eric + * + * TODO: + * - Some messages. + * - display code. + * - user interaction. + * - tic handling. + * - All notifications. + */ + +#include "windows.h" +#include "commctrl.h" +#include "trackbar.h" +#include "heap.h" +#include "win.h" +#include "debug.h" + + +#define TRACKBAR_GetInfoPtr(wndPtr) ((TRACKBAR_INFO *)wndPtr->wExtra[0]) + + +static VOID +TRACKBAR_Refresh (WND *wndPtr, HDC32 hdc) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + RECT32 rcClient, rcChannel; + + GetClientRect32 (wndPtr->hwndSelf, &rcClient); + + /* draw channel */ + rcChannel = infoPtr->rcChannel; + DrawEdge32 (hdc, &rcChannel, EDGE_SUNKEN, BF_RECT | BF_ADJUST); + if (wndPtr->dwStyle & TBS_ENABLESELRANGE) { + /* fill the channel */ + HBRUSH32 hbr = CreateSolidBrush32 (RGB(255,255,255)); + FillRect32 (hdc, &rcChannel, hbr); + DeleteObject32 (hbr); + } + + /* draw ticks */ + if (!(wndPtr->dwStyle & TBS_NOTICKS)) { + + } + + /* draw thumb */ + if (!(wndPtr->dwStyle & TBS_NOTHUMB)) { + + } + + if (infoPtr->bFocus) + DrawFocusRect32 (hdc, &rcClient); +} + + +static VOID +TRACKBAR_Calc (WND *wndPtr, TRACKBAR_INFO *infoPtr, LPRECT32 lpRect) +{ + INT32 cyChannel; + + if (wndPtr->dwStyle & TBS_ENABLESELRANGE) + cyChannel = MAX(infoPtr->uThumbLen - 8, 4); + else + cyChannel = 4; + + /* calculate channel rect */ + if (wndPtr->dwStyle & TBS_VERT) { + infoPtr->rcChannel.top = lpRect->top + 8; + infoPtr->rcChannel.bottom = lpRect->bottom - 8; + + if (wndPtr->dwStyle & TBS_BOTH) { + infoPtr->rcChannel.left = (lpRect->bottom - cyChannel ) / 2; + infoPtr->rcChannel.right = (lpRect->bottom + cyChannel) / 2; + } + else if (wndPtr->dwStyle & TBS_LEFT) { + infoPtr->rcChannel.left = lpRect->left + 10; + infoPtr->rcChannel.right = infoPtr->rcChannel.left + cyChannel; + } + else { + /* TBS_RIGHT */ + infoPtr->rcChannel.right = lpRect->right - 10; + infoPtr->rcChannel.left = infoPtr->rcChannel.right - cyChannel; + } + } + else { + infoPtr->rcChannel.left = lpRect->left + 8; + infoPtr->rcChannel.right = lpRect->right - 8; + + if (wndPtr->dwStyle & TBS_BOTH) { + infoPtr->rcChannel.top = (lpRect->bottom - cyChannel ) / 2; + infoPtr->rcChannel.bottom = (lpRect->bottom + cyChannel) / 2; + } + else if (wndPtr->dwStyle & TBS_TOP) { + infoPtr->rcChannel.top = lpRect->top + 10; + infoPtr->rcChannel.bottom = infoPtr->rcChannel.top + cyChannel; + } + else { + /* TBS_BOTTOM */ + infoPtr->rcChannel.bottom = lpRect->bottom - 10; + infoPtr->rcChannel.top = infoPtr->rcChannel.bottom - cyChannel; + } + } +} + + +static VOID +TRACKBAR_AlignBuddies (WND *wndPtr, TRACKBAR_INFO *infoPtr) +{ + HWND32 hwndParent = GetParent32 (wndPtr->hwndSelf); + RECT32 rcSelf, rcBuddy; + INT32 x, y; + + GetWindowRect32 (wndPtr->hwndSelf, &rcSelf); + MapWindowPoints32 (HWND_DESKTOP, hwndParent, (LPPOINT32)&rcSelf, 2); + + /* align buddy left or above */ + if (infoPtr->hwndBuddyLA) { + GetWindowRect32 (infoPtr->hwndBuddyLA, &rcBuddy); + MapWindowPoints32 (HWND_DESKTOP, hwndParent, (LPPOINT32)&rcBuddy, 2); + + if (wndPtr->dwStyle & TBS_VERT) { + x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 - + (rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left; + y = rcSelf.top - (rcBuddy.bottom - rcBuddy.top); + } + else { + x = rcSelf.left - (rcBuddy.right - rcBuddy.left); + y = (infoPtr->rcChannel.bottom + infoPtr->rcChannel.top) / 2 - + (rcBuddy.bottom - rcBuddy.top) / 2 + rcSelf.top; + } + + SetWindowPos32 (infoPtr->hwndBuddyLA, 0, x, y, 0, 0, + SWP_NOZORDER | SWP_NOSIZE); + } + + + /* align buddy right or below */ + if (infoPtr->hwndBuddyRB) { + GetWindowRect32 (infoPtr->hwndBuddyRB, &rcBuddy); + MapWindowPoints32 (HWND_DESKTOP, hwndParent, (LPPOINT32)&rcBuddy, 2); + + if (wndPtr->dwStyle & TBS_VERT) { + x = (infoPtr->rcChannel.right + infoPtr->rcChannel.left) / 2 - + (rcBuddy.right - rcBuddy.left) / 2 + rcSelf.left; + y = rcSelf.bottom; + } + else { + x = rcSelf.right; + y = (infoPtr->rcChannel.bottom + infoPtr->rcChannel.top) / 2 - + (rcBuddy.bottom - rcBuddy.top) / 2 + rcSelf.top; + } + SetWindowPos32 (infoPtr->hwndBuddyRB, 0, x, y, 0, 0, + SWP_NOZORDER | SWP_NOSIZE); + } +} + + +static LRESULT +TRACKBAR_ClearSel (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + infoPtr->nSelMin = 0; + infoPtr->nSelMax = 0; + + if ((BOOL32)wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_ClearTics (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (infoPtr->tics) { + FIXME (trackbar, "is this correct??\n"); + HeapFree (GetProcessHeap (), 0, infoPtr->tics); + infoPtr->tics = NULL; + infoPtr->uNumTics = 2; + } + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_GetBuddy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (wParam) + /* buddy is left or above */ + return (LRESULT)infoPtr->hwndBuddyLA; + + /* buddy is right or below */ + return (LRESULT) infoPtr->hwndBuddyRB; +} + + +static LRESULT +TRACKBAR_GetChannelRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + LPRECT32 lprc = (LPRECT32)lParam; + + if (lprc == NULL) + return 0; + + lprc->left = infoPtr->rcChannel.left; + lprc->right = infoPtr->rcChannel.right; + lprc->bottom = infoPtr->rcChannel.bottom; + lprc->top = infoPtr->rcChannel.top; + + return 0; +} + + +static LRESULT +TRACKBAR_GetLineSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nLineSize; +} + + +static LRESULT +TRACKBAR_GetNumTics (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (wndPtr->dwStyle & TBS_NOTICKS) + return 0; + + return infoPtr->uNumTics; +} + + +static LRESULT +TRACKBAR_GetPageSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nPageSize; +} + + +static LRESULT +TRACKBAR_GetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nPos; +} + + +// << TRACKBAR_GetPTics >> + + +static LRESULT +TRACKBAR_GetRangeMax (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nRangeMax; +} + + +static LRESULT +TRACKBAR_GetRangeMin (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nRangeMin; +} + + +static LRESULT +TRACKBAR_GetSelEnd (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nSelMax; +} + + +static LRESULT +TRACKBAR_GetSelStart (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->nSelMin; +} + + +static LRESULT +TRACKBAR_GetThumbLength (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + return infoPtr->uThumbLen; +} + + + +// << TRACKBAR_GetThumbRect >> +// case TBM_GETTIC: +// case TBM_GETTICPOS: + + +static LRESULT +TRACKBAR_GetToolTips (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (wndPtr->dwStyle & TBS_TOOLTIPS) + return (LRESULT)infoPtr->hwndToolTip; + return 0; +} + + +// case TBM_GETUNICODEFORMAT: + + +static LRESULT +TRACKBAR_SetBuddy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + HWND32 hwndTemp; + + if (wParam) { + /* buddy is left or above */ + hwndTemp = infoPtr->hwndBuddyLA; + infoPtr->hwndBuddyLA = (HWND32)lParam; + + FIXME (trackbar, "move buddy!\n"); + } + else { + /* buddy is right or below */ + hwndTemp = infoPtr->hwndBuddyRB; + infoPtr->hwndBuddyRB = (HWND32)lParam; + + FIXME (trackbar, "move buddy!\n"); + } + + TRACKBAR_AlignBuddies (wndPtr, infoPtr); + + return (LRESULT)hwndTemp; +} + + +static LRESULT +TRACKBAR_SetLineSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + INT32 nTemp = infoPtr->nLineSize; + + infoPtr->nLineSize = (INT32)lParam; + + return nTemp; +} + + +static LRESULT +TRACKBAR_SetPageSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + INT32 nTemp = infoPtr->nPageSize; + + infoPtr->nPageSize = (INT32)lParam; + + return nTemp; +} + + +static LRESULT +TRACKBAR_SetPos (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + infoPtr->nPos = (INT32)HIWORD(lParam); + + if (infoPtr->nPos < infoPtr->nRangeMin) + infoPtr->nPos = infoPtr->nRangeMin; + + if (infoPtr->nPos > infoPtr->nRangeMax) + infoPtr->nPos = infoPtr->nRangeMax; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetRange (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + infoPtr->nRangeMin = (INT32)LOWORD(lParam); + infoPtr->nRangeMax = (INT32)HIWORD(lParam); + + if (infoPtr->nPos < infoPtr->nRangeMin) + infoPtr->nPos = infoPtr->nRangeMin; + + if (infoPtr->nPos > infoPtr->nRangeMax) + infoPtr->nPos = infoPtr->nRangeMax; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetRangeMax (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + infoPtr->nRangeMax = (INT32)lParam; + if (infoPtr->nPos > infoPtr->nRangeMax) + infoPtr->nPos = infoPtr->nRangeMax; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetRangeMin (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + infoPtr->nRangeMin = (INT32)lParam; + if (infoPtr->nPos < infoPtr->nRangeMin) + infoPtr->nPos = infoPtr->nRangeMin; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetSel (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (!wndPtr->dwStyle & TBS_ENABLESELRANGE) + return 0; + + infoPtr->nSelMin = (INT32)LOWORD(lParam); + infoPtr->nSelMax = (INT32)HIWORD(lParam); + + if (infoPtr->nSelMin < infoPtr->nRangeMin) + infoPtr->nSelMin = infoPtr->nRangeMin; + if (infoPtr->nSelMax > infoPtr->nRangeMax) + infoPtr->nSelMax = infoPtr->nRangeMax; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetSelEnd (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (!wndPtr->dwStyle & TBS_ENABLESELRANGE) + return 0; + + infoPtr->nSelMax = (INT32)lParam; + if (infoPtr->nSelMax > infoPtr->nRangeMax) + infoPtr->nSelMax = infoPtr->nRangeMax; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetSelStart (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (!wndPtr->dwStyle & TBS_ENABLESELRANGE) + return 0; + + infoPtr->nSelMin = (INT32)lParam; + if (infoPtr->nSelMin < infoPtr->nRangeMin) + infoPtr->nSelMin = infoPtr->nRangeMin; + + if (wParam) { + HDC32 hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + } + + return 0; +} + + +static LRESULT +TRACKBAR_SetThumbLength (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + if (wndPtr->dwStyle & TBS_FIXEDLENGTH) + infoPtr->uThumbLen = (UINT32)wParam; + + return 0; +} + + +static LRESULT +TRACKBAR_SetTic (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + INT32 nPos = (INT32)lParam; + + if (nPos < infoPtr->nRangeMin) + return FALSE; + if (nPos > infoPtr->nRangeMax) + return FALSE; + + FIXME (trackbar, "%d - empty stub!\n", nPos); + + return TRUE; +} + + +// case TBM_SETTICFREQ: + + +static LRESULT +TRACKBAR_SetTipSide (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + INT32 fTemp = infoPtr->fLocation; + + infoPtr->fLocation = (INT32)wParam; + + return fTemp; +} + + +static LRESULT +TRACKBAR_SetToolTips (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + infoPtr->hwndToolTip = (HWND32)wParam; + + return 0; +} + + +// case TBM_SETUNICODEFORMAT: + + + + +static LRESULT +TRACKBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr; + + infoPtr = (TRACKBAR_INFO *)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, + sizeof(TRACKBAR_INFO)); + wndPtr->wExtra[0] = (DWORD)infoPtr; + + + /* default values */ + infoPtr->nRangeMin = 0; + infoPtr->nRangeMax = 100; + infoPtr->nLineSize = 1; + infoPtr->nPageSize = 20; + infoPtr->nSelMin = 0; + infoPtr->nSelMax = 0; + infoPtr->nPos = 0; + infoPtr->uThumbLen = 23; /* initial thumb length */ + infoPtr->uNumTics = 2; /* default start and end tic */ + + + return 0; +} + + +static LRESULT +TRACKBAR_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + + + + HeapFree (GetProcessHeap (), 0, infoPtr); + + return 0; +} + + +static LRESULT +TRACKBAR_KillFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + HDC32 hdc; + + infoPtr->bFocus = FALSE; + hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + InvalidateRect32 (wndPtr->hwndSelf, NULL, TRUE); + + return 0; +} + + +static LRESULT +TRACKBAR_LButtonDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + + SetFocus32 (wndPtr->hwndSelf); + + return 0; +} + + +static LRESULT +TRACKBAR_Paint (WND *wndPtr, WPARAM32 wParam) +{ + HDC32 hdc; + PAINTSTRUCT32 ps; + + hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam; + TRACKBAR_Refresh (wndPtr, hdc); + if(!wParam) + EndPaint32 (wndPtr->hwndSelf, &ps); + return 0; +} + + +static LRESULT +TRACKBAR_SetFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + HDC32 hdc; + + infoPtr->bFocus = TRUE; + + hdc = GetDC32 (wndPtr->hwndSelf); + TRACKBAR_Refresh (wndPtr, hdc); + ReleaseDC32 (wndPtr->hwndSelf, hdc); + + return 0; +} + + +static LRESULT +TRACKBAR_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TRACKBAR_INFO *infoPtr = TRACKBAR_GetInfoPtr(wndPtr); + RECT32 rcClient; + + GetClientRect32 (wndPtr->hwndSelf, &rcClient); + + TRACKBAR_Calc (wndPtr, infoPtr, &rcClient); + TRACKBAR_AlignBuddies (wndPtr, infoPtr); + + return 0; +} + + +// << TRACKBAR_Timer >> +// << TRACKBAR_WinIniChange >> + + +LRESULT WINAPI +TRACKBAR_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) +{ + WND *wndPtr = WIN_FindWndPtr(hwnd); + + switch (uMsg) + { + case TBM_CLEARSEL: + return TRACKBAR_ClearSel (wndPtr, wParam, lParam); + + case TBM_CLEARTICS: + return TRACKBAR_ClearTics (wndPtr, wParam, lParam); + + case TBM_GETBUDDY: + return TRACKBAR_GetBuddy (wndPtr, wParam, lParam); + + case TBM_GETCHANNELRECT: + return TRACKBAR_GetChannelRect (wndPtr, wParam, lParam); + + case TBM_GETLINESIZE: + return TRACKBAR_GetLineSize (wndPtr, wParam, lParam); + + case TBM_GETNUMTICS: + return TRACKBAR_GetNumTics (wndPtr, wParam, lParam); + + case TBM_GETPAGESIZE: + return TRACKBAR_GetPageSize (wndPtr, wParam, lParam); + + case TBM_GETPOS: + return TRACKBAR_GetPos (wndPtr, wParam, lParam); + +// case TBM_GETPTICS: + + case TBM_GETRANGEMAX: + return TRACKBAR_GetRangeMax (wndPtr, wParam, lParam); + + case TBM_GETRANGEMIN: + return TRACKBAR_GetRangeMin (wndPtr, wParam, lParam); + + case TBM_GETSELEND: + return TRACKBAR_GetSelEnd (wndPtr, wParam, lParam); + + case TBM_GETSELSTART: + return TRACKBAR_GetSelStart (wndPtr, wParam, lParam); + + case TBM_GETTHUMBLENGTH: + return TRACKBAR_GetThumbLength (wndPtr, wParam, lParam); + +// case TBM_GETTHUMBRECT: +// case TBM_GETTIC: +// case TBM_GETTICPOS: + + case TBM_GETTOOLTIPS: + return TRACKBAR_GetToolTips (wndPtr, wParam, lParam); + +// case TBM_GETUNICODEFORMAT: + + case TBM_SETBUDDY: + return TRACKBAR_SetBuddy (wndPtr, wParam, lParam); + + case TBM_SETLINESIZE: + return TRACKBAR_SetLineSize (wndPtr, wParam, lParam); + + case TBM_SETPAGESIZE: + return TRACKBAR_SetPageSize (wndPtr, wParam, lParam); + + case TBM_SETPOS: + return TRACKBAR_SetPos (wndPtr, wParam, lParam); + + case TBM_SETRANGE: + return TRACKBAR_SetRange (wndPtr, wParam, lParam); + + case TBM_SETRANGEMAX: + return TRACKBAR_SetRangeMax (wndPtr, wParam, lParam); + + case TBM_SETRANGEMIN: + return TRACKBAR_SetRangeMin (wndPtr, wParam, lParam); + + case TBM_SETSEL: + return TRACKBAR_SetSel (wndPtr, wParam, lParam); + + case TBM_SETSELEND: + return TRACKBAR_SetSelEnd (wndPtr, wParam, lParam); + + case TBM_SETSELSTART: + return TRACKBAR_SetSelStart (wndPtr, wParam, lParam); + + case TBM_SETTHUMBLENGTH: + return TRACKBAR_SetThumbLength (wndPtr, wParam, lParam); + + case TBM_SETTIC: + return TRACKBAR_SetTic (wndPtr, wParam, lParam); + +// case TBM_SETTICFREQ: + + case TBM_SETTIPSIDE: + return TRACKBAR_SetTipSide (wndPtr, wParam, lParam); + + case TBM_SETTOOLTIPS: + return TRACKBAR_SetToolTips (wndPtr, wParam, lParam); + +// case TBM_SETUNICODEFORMAT: + + +// case WM_CAPTURECHANGED: + + case WM_CREATE: + return TRACKBAR_Create (wndPtr, wParam, lParam); + + case WM_DESTROY: + return TRACKBAR_Destroy (wndPtr, wParam, lParam); + +// case WM_ENABLE: + +// case WM_ERASEBKGND: +// return 0; + + case WM_GETDLGCODE: + return DLGC_WANTARROWS; + +// case WM_KEYDOWN: + +// case WM_KEYUP: + + case WM_KILLFOCUS: + return TRACKBAR_KillFocus (wndPtr, wParam, lParam); + + case WM_LBUTTONDOWN: + return TRACKBAR_LButtonDown (wndPtr, wParam, lParam); + +// case WM_LBUTTONUP: + +// case WM_MOUSEMOVE: +// return TRACKBAR_MouseMove (wndPtr, wParam, lParam); + + case WM_PAINT: + return TRACKBAR_Paint (wndPtr, wParam); + + case WM_SETFOCUS: + return TRACKBAR_SetFocus (wndPtr, wParam, lParam); + + case WM_SIZE: + return TRACKBAR_Size (wndPtr, wParam, lParam); + +// case WM_TIMER: + +// case WM_WININICHANGE: + + default: + if (uMsg >= WM_USER) + ERR (trackbar, "unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); + return DefWindowProc32A (hwnd, uMsg, wParam, lParam); + } + return 0; +} + + +void +TRACKBAR_Register (void) +{ + WNDCLASS32A wndClass; + + if (GlobalFindAtom32A (TRACKBAR_CLASS32A)) return; + + ZeroMemory (&wndClass, sizeof(WNDCLASS32A)); + wndClass.style = CS_GLOBALCLASS; + wndClass.lpfnWndProc = (WNDPROC32)TRACKBAR_WindowProc; + wndClass.cbClsExtra = 0; + wndClass.cbWndExtra = sizeof(TRACKBAR_INFO *); + wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A); + wndClass.hbrBackground = (HBRUSH32)(COLOR_3DFACE + 1); + wndClass.lpszClassName = TRACKBAR_CLASS32A; + + RegisterClass32A (&wndClass); +} diff --git a/controls/treeview.c b/dlls/comctl32/treeview.c similarity index 75% rename from controls/treeview.c rename to dlls/comctl32/treeview.c index 992b5d8a2c6..a4eac4720ac 100644 --- a/controls/treeview.c +++ b/dlls/comctl32/treeview.c @@ -25,24 +25,44 @@ +static LRESULT +TREEVIEW_GetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) +{ + TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(wndPtr); + + switch ((INT32)wParam) { + case TVSIL_NORMAL: + return (LRESULT)infoPtr->himlNormal; + + case TVSIL_STATE: + return (LRESULT)infoPtr->himlState; + } + + return (LRESULT)NULL; +} + + + + static LRESULT TREEVIEW_SetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) { TREEVIEW_INFO *infoPtr = TREEVIEW_GetInfoPtr(wndPtr); HIMAGELIST himlTemp; - if ((INT32)wParam == TVSIL_NORMAL) { - himlTemp = infoPtr->himlNormal; - infoPtr->himlNormal = (HIMAGELIST)lParam; - } - else if ((INT32)wParam == TVSIL_STATE) { - himlTemp = infoPtr->himlState; - infoPtr->himlState = (HIMAGELIST)lParam; - } - else - return 0; + switch ((INT32)wParam) { + case TVSIL_NORMAL: + himlTemp = infoPtr->himlNormal; + infoPtr->himlNormal = (HIMAGELIST)lParam; + return (LRESULT)himlTemp; - return (LRESULT)himlTemp; + case TVSIL_STATE: + himlTemp = infoPtr->himlState; + infoPtr->himlState = (HIMAGELIST)lParam; + return (LRESULT)himlTemp; + } + + return (LRESULT)NULL; } @@ -116,12 +136,12 @@ TREEVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) switch (uMsg) { - case TVM_INSERTITEMA: - FIXME (treeview, "Unimplemented msg TVM_INSERTITEMA\n"); + case TVM_INSERTITEM32A: + FIXME (treeview, "Unimplemented msg TVM_INSERTITEM32A\n"); return 0; - case TVM_INSERTITEMW: - FIXME (treeview, "Unimplemented msg TVM_INSERTITEMW\n"); + case TVM_INSERTITEM32W: + FIXME (treeview, "Unimplemented msg TVM_INSERTITEM32W\n"); return 0; case TVM_DELETEITEM: @@ -148,10 +168,8 @@ TREEVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) FIXME (treeview, "Unimplemented msg TVM_SETINDENT\n"); return 0; - case TVM_GETIMAGELIST: - FIXME (treeview, "Unimplemented msg TVM_GETIMAGELIST\n"); - return 0; - //return TREEVIEW_GetImageList (wndPtr, wParam, lParam); + case TVM_GETIMAGELIST: + return TREEVIEW_GetImageList (wndPtr, wParam, lParam); case TVM_SETIMAGELIST: return TREEVIEW_SetImageList (wndPtr, wParam, lParam); @@ -164,28 +182,28 @@ TREEVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) FIXME (treeview, "Unimplemented msg TVM_SELECTITEM \n"); return 0; - case TVM_GETITEMA: - FIXME (treeview, "Unimplemented msg TVM_GETITEMA\n"); + case TVM_GETITEM32A: + FIXME (treeview, "Unimplemented msg TVM_GETITEM32A\n"); return 0; - case TVM_GETITEMW: - FIXME (treeview, "Unimplemented msg TVM_GETITEMW\n"); + case TVM_GETITEM32W: + FIXME (treeview, "Unimplemented msg TVM_GETITEM32W\n"); return 0; - case TVM_SETITEMA: - FIXME (treeview, "Unimplemented msg TVM_SETITEMA\n"); + case TVM_SETITEM32A: + FIXME (treeview, "Unimplemented msg TVM_SETITEM32A\n"); return 0; - case TVM_SETITEMW: - FIXME (treeview, "Unimplemented msg TVM_SETITEMW\n"); + case TVM_SETITEM32W: + FIXME (treeview, "Unimplemented msg TVM_SETITEM32W\n"); return 0; - case TVM_EDITLABELA: - FIXME (treeview, "Unimplemented msg TVM_EDITLABELA \n"); + case TVM_EDITLABEL32A: + FIXME (treeview, "Unimplemented msg TVM_EDITLABEL32A\n"); return 0; - case TVM_EDITLABELW: - FIXME (treeview, "Unimplemented msg TVM_EDITLABELW \n"); + case TVM_EDITLABEL32W: + FIXME (treeview, "Unimplemented msg TVM_EDITLABEL32W\n"); return 0; case TVM_GETEDITCONTROL: @@ -220,12 +238,12 @@ TREEVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) FIXME (treeview, "Unimplemented msg TVM_ENDEDITLABELNOW\n"); return 0; - case TVM_GETISEARCHSTRINGA: - FIXME (treeview, "Unimplemented msg TVM_GETISEARCHSTRINGA\n"); + case TVM_GETISEARCHSTRING32A: + FIXME (treeview, "Unimplemented msg TVM_GETISEARCHSTRING32A\n"); return 0; - case TVM_GETISEARCHSTRINGW: - FIXME (treeview, "Unimplemented msg TVM_GETISEARCHSTRINGW\n"); + case TVM_GETISEARCHSTRING32W: + FIXME (treeview, "Unimplemented msg TVM_GETISEARCHSTRING32W\n"); return 0; case TVM_SETTOOLTIPS: @@ -261,8 +279,8 @@ TREEVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam) default: if (uMsg >= WM_USER) - FIXME (treeview, "Unknown msg %04x wp=%08x lp=%08lx\n", - uMsg, wParam, lParam); + FIXME (treeview, "Unknown msg %04x wp=%08x lp=%08lx\n", + uMsg, wParam, lParam); return DefWindowProc32A (hwnd, uMsg, wParam, lParam); } return 0; diff --git a/controls/updown.c b/dlls/comctl32/updown.c similarity index 100% rename from controls/updown.c rename to dlls/comctl32/updown.c diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in index 59a0004301d..2a7f2044347 100644 --- a/dlls/shell32/Makefile.in +++ b/dlls/shell32/Makefile.in @@ -17,8 +17,8 @@ C_SRCS = \ shlfolder.c \ shlview.c -RC_SRCS = \ - shres.rc +# RC_SRCS = \ +# shres.rc all: check_wrc $(MODULE).o diff --git a/dlls/shell32/contmenu.c b/dlls/shell32/contmenu.c index 52ce25307c6..9aa758c631c 100644 --- a/dlls/shell32/contmenu.c +++ b/dlls/shell32/contmenu.c @@ -6,6 +6,7 @@ #include "windows.h" #include "winerror.h" #include "debug.h" +#include "pidl.h" #include "shlobj.h" #include "shell32_main.h" @@ -22,8 +23,9 @@ 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_InvokeCommand(LPCONTEXTMENU, LPCMINVOKECOMMANDINFO32); static HRESULT WINAPI IContextMenu_GetCommandString(LPCONTEXTMENU , UINT32 ,UINT32 ,LPUINT32 ,LPSTR ,UINT32); +static HRESULT WINAPI IContextMenu_HandleMenuMsg(LPCONTEXTMENU, UINT32, WPARAM32, LPARAM); BOOL32 IContextMenu_AllocPidlTable(LPCONTEXTMENU, DWORD); void IContextMenu_FreePidlTable(LPCONTEXTMENU); @@ -33,10 +35,12 @@ BOOL32 IContextMenu_FillPidlTable(LPCONTEXTMENU, LPCITEMIDLIST *, UINT32); static struct IContextMenu_VTable cmvt = { IContextMenu_QueryInterface, IContextMenu_AddRef, - IContextMenu_Release, + IContextMenu_Release, IContextMenu_QueryContextMenu, IContextMenu_InvokeCommand, - IContextMenu_GetCommandString + IContextMenu_GetCommandString, + IContextMenu_HandleMenuMsg, + (void *) 0xdeadbabe /* just paranoia */ }; /************************************************************************** * IContextMenu_QueryInterface @@ -56,10 +60,11 @@ static HRESULT WINAPI IContextMenu_QueryInterface(LPCONTEXTMENU this,REFIID riid } else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ { *ppvObj = (LPSHELLEXTINIT)this; + WARN(shell,"-- LPSHELLEXTINIT pointer requested\n"); } if(*ppvObj) - { (*(LPCONTEXTMENU*)ppvObj)->lpvtbl->fnAddRef(this); + { (*(LPCONTEXTMENU *)ppvObj)->lpvtbl->fnAddRef(this); TRACE(shell,"-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); return S_OK; } @@ -78,25 +83,23 @@ static ULONG WINAPI IContextMenu_AddRef(LPCONTEXTMENU this) * IContextMenu_Release */ static ULONG WINAPI IContextMenu_Release(LPCONTEXTMENU this) -{ TRACE(shell,"(%p)->()\n",this); - if (!--(this->ref)) - { TRACE(shell," destroying IContextMenu(%p)\n",this); +{ TRACE(shell,"(%p)->()\n",this); + if (!--(this->ref)) + { TRACE(shell," destroying IContextMenu(%p)\n",this); - if(this->pSFParent) + if(this->pSFParent) this->pSFParent->lpvtbl->fnRelease(this->pSFParent); - /*make sure the pidl is freed*/ - if(this->aPidls) - { IContextMenu_FreePidlTable(this); + /*make sure the pidl is freed*/ + if(this->aPidls) + { IContextMenu_FreePidlTable(this); + } + + + HeapFree(GetProcessHeap(),0,this); + return 0; } - - if(this->pPidlMgr) - PidlMgr_Destructor(this->pPidlMgr); - - HeapFree(GetProcessHeap(),0,this); - return 0; - } - return this->ref; + return this->ref; } /************************************************************************** @@ -115,7 +118,6 @@ LPCONTEXTMENU IContextMenu_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST *a cm->pSFParent->lpvtbl->fnAddRef(cm->pSFParent); cm->aPidls = NULL; - cm->pPidlMgr = PidlMgr_Constructor(); IContextMenu_AllocPidlTable(cm, uItemCount); @@ -125,10 +127,10 @@ LPCONTEXTMENU IContextMenu_Constructor(LPSHELLFOLDER pSFParent, LPCITEMIDLIST *a cm->bAllValues = 1; for(u = 0; u < uItemCount; u++) - { cm->bAllValues &= (cm->pPidlMgr->lpvtbl->fnIsValue(cm->pPidlMgr, aPidls[u]) ? 1 : 0); + { cm->bAllValues &= (_ILIsValue(aPidls[u]) ? 1 : 0); } - TRACE(shell,"(%p)->()\n",cm); - return cm; + TRACE(shell,"(%p)->()\n",cm); + return cm; } @@ -210,12 +212,12 @@ static HRESULT WINAPI IContextMenu_QueryContextMenu( LPCONTEXTMENU this, HMENU3 /************************************************************************** * IContextMenu_InvokeCommand() */ -static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU this, LPCMINVOKECOMMANDINFO lpcmi) +static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU this, LPCMINVOKECOMMANDINFO32 lpcmi) { LPITEMIDLIST pidlTemp,pidlFQ; - SHELLEXECUTEINFO sei; + SHELLEXECUTEINFO32A sei; int i; - TRACE(shell,"(%p)->(execinfo=%p)\n",this,lpcmi); + TRACE(shell,"(%p)->(invcom=%p verb=%p)\n",this,lpcmi,lpcmi->lpVerb); if(HIWORD(lpcmi->lpVerb)) { //the command is being sent via a verb @@ -232,7 +234,7 @@ static HRESULT WINAPI IContextMenu_InvokeCommand(LPCONTEXTMENU this, LPCMINVOKEC 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])) + { if(!_ILIsValue(this->aPidls[i])) break; } @@ -273,46 +275,56 @@ static HRESULT WINAPI IContextMenu_GetCommandString( LPCONTEXTMENU this, UINT32 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); + TRACE(shell,"(%p)->(idcom=%x flags=%x %p name=%p len=%x)\n",this, idCommand, uFlags, lpReserved, lpszName, uMaxNameLen); - switch(uFlags) + switch(uFlags) { case GCS_HELPTEXT: - hr = E_NOTIMPL; - break; + hr = E_NOTIMPL; + break; case GCS_VERBA: - switch(idCommand) - { case IDM_RENAME: - strcpy((LPSTR)lpszName, "rename"); - hr = NOERROR; - break; - } - break; + 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.*/ + /* 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; + switch(idCommand) + { case IDM_RENAME: + lstrcpyAtoW((LPWSTR)lpszName, "rename"); + hr = NOERROR; + break; + } + break; case GCS_VALIDATE: - hr = NOERROR; - break; + hr = NOERROR; + break; } + TRACE(shell,"-- (%p)->(name=%s)\n",this, lpszName); return hr; } - +/************************************************************************** +* IContextMenu_HandleMenuMsg() +* NOTES +* should be only in IContextMenu2 and IContextMenu3 +* is nevertheless called from word95 +*/ +static HRESULT WINAPI IContextMenu_HandleMenuMsg(LPCONTEXTMENU this, UINT32 uMsg,WPARAM32 wParam,LPARAM lParam) +{ TRACE(shell,"(%p)->(msg=%x wp=%x lp=%lx)\n",this, uMsg, wParam, lParam); + return E_NOTIMPL; +} /************************************************************************** * IContextMenu_AllocPidlTable() */ BOOL32 IContextMenu_AllocPidlTable(LPCONTEXTMENU this, DWORD dwEntries) { //add one for NULL terminator - TRACE(shell,"(%p)->(entrys=%u)\n",this, dwEntries); + TRACE(shell,"(%p)->(entrys=%lu)\n",this, dwEntries); dwEntries++; this->aPidls = (LPITEMIDLIST*)SHAlloc(dwEntries * sizeof(LPITEMIDLIST)); @@ -327,17 +339,17 @@ BOOL32 IContextMenu_AllocPidlTable(LPCONTEXTMENU this, DWORD dwEntries) * IContextMenu_FreePidlTable() */ void IContextMenu_FreePidlTable(LPCONTEXTMENU this) -{ int i; +{ int i; TRACE(shell,"(%p)->()\n",this); if(this->aPidls) { for(i = 0; this->aPidls[i]; i++) - { SHFree(this->aPidls[i]); - } + { SHFree(this->aPidls[i]); + } - SHFree(this->aPidls); - this->aPidls = NULL; + SHFree(this->aPidls); + this->aPidls = NULL; } } @@ -366,18 +378,16 @@ BOOL32 IContextMenu_CanRenameItems(LPCONTEXTMENU this) 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; - } + { 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 dwAttributes & SFGAO_CANRENAME; + } return FALSE; } diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c index 4afff0ce515..960d6acde5e 100644 --- a/dlls/shell32/enumidlist.c +++ b/dlls/shell32/enumidlist.c @@ -18,7 +18,7 @@ #include "winnls.h" #include "winproc.h" #include "commctrl.h" - +#include "pidl.h" #include "shell32_main.h" /* IEnumIDList Implementation */ @@ -63,27 +63,17 @@ LPENUMIDLIST IEnumIDList_Constructor( LPCSTR lpszPath, DWORD dwFlags, HRESULT* p 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; - } - } + TRACE(shell,"(%p)->(%s 0x%08lx %p)\n",lpeidl,debugstr_a(lpszPath),dwFlags,pResult); if(!IEnumIDList_CreateEnumList(lpeidl, lpszPath, dwFlags)) - { if(pResult) - { *pResult = E_OUTOFMEMORY; - HeapFree(GetProcessHeap(),0,lpeidl->mpPidlMgr); - HeapFree(GetProcessHeap(),0,lpeidl); - return NULL; - } - } + { if(pResult) + { *pResult = E_OUTOFMEMORY; + HeapFree(GetProcessHeap(),0,lpeidl); + return NULL; + } + } - TRACE(shell,"-- (%p)->()\n",lpeidl); + TRACE(shell,"-- (%p)->()\n",lpeidl); return lpeidl; } @@ -128,8 +118,9 @@ 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; + IEnumIDList_DeleteList(this); + HeapFree(GetProcessHeap(),0,this); + return 0; } return this->ref; } @@ -140,38 +131,38 @@ static ULONG WINAPI IEnumIDList_Release(LPENUMIDLIST this) static HRESULT WINAPI IEnumIDList_Next( LPENUMIDLIST this,ULONG celt,LPITEMIDLIST * rgelt,ULONG *pceltFetched) -{ ULONG i; - HRESULT hr = S_OK; - LPITEMIDLIST temp; +{ 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; +/* 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; + 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; + 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; + return hr; } /************************************************************************** @@ -215,96 +206,123 @@ static HRESULT WINAPI IEnumIDList_Clone( * 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]; +{ LPITEMIDLIST pidl=NULL; + LPPIDLDATA pData=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); + TRACE(shell,"(%p)->(%s 0x%08lx) \n",this,debugstr_a(lpszPath),dwFlags); - if (lpszPath && lpszPath[0]!='\0') - { strcpy(szPath, lpszPath); - PathAddBackslash(szPath); - strcat(szPath,"*.*"); - } + 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.*/ + /*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); + { 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)); + pidl = _ILCreateMyComputer(); + if(pidl) + { pData = _ILGetDataPointer(pidl); + pData->u.generic.dwSFGAO = SFGAO_HASPROPSHEET | SFGAO_READONLY | SFGAO_HASSUBFOLDER; + 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 = _ILCreateDrive(szDriveName); + pData = _ILGetDataPointer(pidl); + pData->u.drive.dwSFGAO = SFGAO_HASPROPSHEET | SFGAO_READONLY | SFGAO_CANLINK | + SFGAO_HASSUBFOLDER | SFGAO_DROPTARGET | SFGAO_FILESYSTEM; + 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 = _ILCreateFolder( stffile.cFileName); + if(pidl) + { pData = _ILGetDataPointer(pidl); + pData->u.folder.dwSFGAO = SFGAO_CANCOPY | SFGAO_CANDELETE | SFGAO_CANLINK | + SFGAO_CANMOVE | SFGAO_CANRENAME | SFGAO_DROPTARGET | + SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER; + if ( stffile.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + { pData->u.folder.dwSFGAO |= SFGAO_READONLY; + } + FileTimeToDosDateTime(&stffile.ftLastWriteTime,&pData->u.folder.uFileDate,&pData->u.folder.uFileTime); + pData->u.folder.dwFileSize = stffile.nFileSizeLow; + pData->u.folder.uFileAttribs=stffile.dwFileAttributes; + strncpy (pData->u.folder.szAlternateName, stffile.cAlternateFileName,14); + 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; + } + } + } + //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 = _ILCreateValue( stffile.cFileName); + if(pidl) + { pData = _ILGetDataPointer(pidl); + pData->u.file.dwSFGAO = SFGAO_CANCOPY | SFGAO_CANDELETE | SFGAO_CANLINK | + SFGAO_CANMOVE | SFGAO_CANRENAME | SFGAO_DROPTARGET | + SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM; + if ( stffile.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + { pData->u.file.dwSFGAO |= SFGAO_READONLY; + } + FileTimeToDosDateTime(&stffile.ftLastWriteTime,&pData->u.file.uFileDate,&pData->u.file.uFileTime); + pData->u.file.dwFileSize = stffile.nFileSizeLow; + pData->u.file.uFileAttribs=stffile.dwFileAttributes; + strncpy (pData->u.file.szAlternateName, stffile.cAlternateFileName,14); + if(!IEnumIDList_AddToEnumList(this, pidl)) + { return FALSE; + } + } + else + { return FALSE; + } + } + } while( FindNextFile32A(hFile,&stffile)); + FindClose32 (hFile); + } + } + } + return TRUE; } /************************************************************************** @@ -314,7 +332,7 @@ static BOOL32 WINAPI IEnumIDList_AddToEnumList(LPENUMIDLIST this,LPITEMIDLIST pi { LPENUMLIST pNew; TRACE(shell,"(%p)->(pidl=%p)\n",this,pidl); - pNew = (LPENUMLIST)HeapAlloc(GetProcessHeap(),0,sizeof(ENUMLIST)); + pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST)); if(pNew) { //set the next pointer pNew->pNext = NULL; diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index e9e078cf113..75374f97d9f 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -35,8 +35,8 @@ 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); +static HRESULT WINAPI IExtractIcon_GetIconLocation(LPEXTRACTICON, UINT32, LPSTR, UINT32, int *, UINT32 *); +static HRESULT WINAPI IExtractIcon_Extract(LPEXTRACTICON, LPCSTR, UINT32, HICON32 *, HICON32 *, UINT32); /* IShellLink Implementation */ static HRESULT WINAPI IShellLink_QueryInterface(LPSHELLLINK,REFIID,LPVOID*); @@ -118,16 +118,22 @@ static ULONG WINAPI IExtractIcon_Release(LPEXTRACTICON this) * 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) +static HRESULT WINAPI 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; + if (!szIconFile) + { *piIndex = 20; + } + else + { *piIndex = 3; + } + *pwFlags = GIL_NOTFILENAME; + + return NOERROR; } /************************************************************************** * IExtractIcon_Extract */ -static HRESULT IExtractIcon_Extract(LPEXTRACTICON this, LPCSTR pszFile, UINT32 nIconIndex, HICON32 *phiconLarge, HICON32 *phiconSmall, UINT32 nIconSize) +static HRESULT WINAPI 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); diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 7b1440a5d13..caed624badd 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -26,16 +26,18 @@ #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); +{ DWORD type; + CHAR * szData; + LPITEMIDLIST pidltemp = pidl; + TRACE(pidl,"---------- pidl=%p \n", pidl); + do + { type = _ILGetDataPointer(pidltemp)->type; + szData = _ILGetTextPointer(type, _ILGetDataPointer(pidltemp)); + + TRACE(pidl,"---- pidl=%p size=%u type=%lx %s\n",pidltemp, pidltemp->mkid.cb,type,debugstr_a(szData)); + + pidltemp = ILGetNext(pidltemp); + } while (pidltemp->mkid.cb); } /************************************************************************* * ILGetDisplayName [SHELL32.15] @@ -48,20 +50,18 @@ BOOL32 WINAPI ILGetDisplayName(LPCITEMIDLIST iil,LPSTR path) /************************************************************************* * ILFindLastID [SHELL32.16] */ -LPSHITEMID WINAPI ILFindLastID(LPITEMIDLIST iil) -{ LPSHITEMID lastsii,sii; +LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl) +{ LPITEMIDLIST pidlLast = NULL; - 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); + TRACE(pidl,"(pidl=%p)\n",pidl); + + if(pidl) + { while(pidl->mkid.cb) + { pidlLast = (LPITEMIDLIST)pidl; + pidl = ILGetNext(pidl); + } } - return lastsii; + return pidlLast; } /************************************************************************* * ILRemoveLastID [SHELL32.17] @@ -69,13 +69,11 @@ LPSHITEMID WINAPI ILFindLastID(LPITEMIDLIST iil) * 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; +{ TRACE(shell,"pidl=%p\n",pidl); + if (!pidl || !pidl->mkid.cb) + return 0; + ILFindLastID(pidl)->mkid.cb = 0; + return 1; } /************************************************************************* @@ -181,7 +179,7 @@ DWORD WINAPI ILGetSize(LPITEMIDLIST pidl) } /************************************************************************* * ILGetNext [SHELL32.153] - * gets the next simple pidl ot of a complex pidl + * gets the next simple pidl of a complex pidl * * PARAMETERS * pidl ITEMIDLIST @@ -191,16 +189,16 @@ DWORD WINAPI ILGetSize(LPITEMIDLIST pidl) * */ LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl) -{ LPITEMIDLIST nextpidl; +{ LPITEMIDLIST nextpidl; - TRACE(pidl,"(pidl=%p)\n",pidl); - if(pidl) - { nextpidl = (LPITEMIDLIST)(LPBYTE)(((LPBYTE)pidl) + pidl->mkid.cb); - return nextpidl; - } - else - { return (NULL); - } + TRACE(pidl,"(pidl=%p)\n",pidl); + if(pidl) + { nextpidl = (LPITEMIDLIST)(LPBYTE)(((LPBYTE)pidl) + pidl->mkid.cb); + return nextpidl; + } + else + { return (NULL); + } } /************************************************************************* * ILAppend [SHELL32.154] @@ -231,152 +229,83 @@ DWORD WINAPI ILFree(LPVOID pidl) } /************************************************************************** -* INTERNAL CLASS pidlmgr +* internal functions */ -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 + * _ILCreateDesktop() + * _ILCreateMyComputer() + * _ILCreateDrive() + * _ILCreateFolder() + * _ILCreateValue() */ -LPPIDLMGR PidlMgr_Constructor() -{ LPPIDLMGR pmgr; - pmgr = (LPPIDLMGR)HeapAlloc(GetProcessHeap(),0,sizeof(pidlmgr)); - pmgr->lpvtbl = &pmgrvt; - TRACE(pidl,"(%p)->()\n",pmgr); - /** FIXMEDllRefCount++;*/ - return pmgr; +LPITEMIDLIST WINAPI _ILCreateDesktop() +{ TRACE(pidl,"()\n"); + return _ILCreate(PT_DESKTOP, NULL, 0); } -/************************************************************************** - * PidlMgr_Destructor - */ -void PidlMgr_Destructor(LPPIDLMGR this) -{ HeapFree(GetProcessHeap(),0,this); - TRACE(pidl,"(%p)->()\n",this); - /** FIXMEDllRefCount--;*/ +LPITEMIDLIST WINAPI _ILCreateMyComputer() +{ TRACE(pidl,"()\n"); + return _ILCreate(PT_MYCOMP, (void *)"My Computer", strlen ("My Computer")+1); } - -/************************************************************************** - * 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); +LPITEMIDLIST WINAPI _ILCreateDrive( 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); + TRACE(pidl,"(%s)\n",sTemp); + return _ILCreate(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 WINAPI _ILCreateFolder( LPCSTR lpszNew) +{ TRACE(pidl,"(%s)\n",lpszNew); + return _ILCreate(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); +LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR lpszNew) +{ TRACE(pidl,"(%s)\n",lpszNew); + return _ILCreate(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() + * _ILGetDrive() * * FIXME: quick hack */ -BOOL32 PidlMgr_GetDrive(LPPIDLMGR this,LPCITEMIDLIST pidl,LPSTR pOut, UINT16 uSize) -{ LPITEMIDLIST pidlTemp=NULL; +BOOL32 WINAPI _ILGetDrive(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); + TRACE(pidl,"(%p,%p,%u)\n",pidl,pOut,uSize); + if(_ILIsMyComputer(pidl)) + { pidlTemp = ILGetNext(pidl); } - else if (pidlTemp && PidlMgr_IsDrive(this,pidlTemp)) - { return (BOOL32)PidlMgr_GetData(this,PT_DRIVE, pidlTemp, (LPVOID)pOut, uSize); + else if (pidlTemp && _ILIsDrive(pidlTemp)) + { return (BOOL32)_ILGetData(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() + * _ILGetItemText() * 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); +DWORD WINAPI _ILGetItemText(LPCITEMIDLIST pidl, LPSTR lpszText, UINT16 uSize) +{ TRACE(pidl,"(pidl=%p %p %x)\n",pidl,lpszText,uSize); + if (_ILIsMyComputer(pidl)) + { return _ILGetData(PT_MYCOMP, pidl, (LPVOID)lpszText, uSize); } - if (PidlMgr_IsDrive(this, pidl)) - { return PidlMgr_GetData(this,PT_DRIVE, pidl, (LPVOID)lpszText, uSize); + if (_ILIsDrive(pidl)) + { return _ILGetData(PT_DRIVE, pidl, (LPVOID)lpszText, uSize); } - return PidlMgr_GetData(this,PT_TEXT, pidl, (LPVOID)lpszText, uSize); + if (_ILIsFolder (pidl)) + { return _ILGetData(PT_FOLDER, pidl, (LPVOID)lpszText, uSize); + } + return _ILGetData(PT_VALUE, pidl, (LPVOID)lpszText, uSize); } /************************************************************************** - * PidlMgr_IsDesktop() - * PidlMgr_IsDrive() - * PidlMgr_IsFolder() - * PidlMgr_IsValue() + * _ILIsDesktop() + * _ILIsDrive() + * _ILIsFolder() + * _ILIsValue() */ -BOOL32 PidlMgr_IsDesktop(LPPIDLMGR this,LPCITEMIDLIST pidl) -{ TRACE(pidl,"%p->(%p)\n",this,pidl); +BOOL32 WINAPI _ILIsDesktop(LPCITEMIDLIST pidl) +{ TRACE(pidl,"(%p)\n",pidl); if (! pidl) return FALSE; @@ -384,239 +313,184 @@ BOOL32 PidlMgr_IsDesktop(LPPIDLMGR this,LPCITEMIDLIST pidl) return ( pidl->mkid.cb == 0x00 ); } -BOOL32 PidlMgr_IsMyComputer(LPPIDLMGR this,LPCITEMIDLIST pidl) +BOOL32 WINAPI _ILIsMyComputer(LPCITEMIDLIST pidl) { LPPIDLDATA pData; - TRACE(pidl,"%p->(%p)\n",this,pidl); + TRACE(pidl,"(%p)\n",pidl); if (! pidl) return FALSE; - pData = PidlMgr_GetDataPointer(this,pidl); + pData = _ILGetDataPointer(pidl); return (PT_MYCOMP == pData->type); } -BOOL32 PidlMgr_IsDrive(LPPIDLMGR this,LPCITEMIDLIST pidl) +BOOL32 WINAPI _ILIsDrive(LPCITEMIDLIST pidl) { LPPIDLDATA pData; - TRACE(pidl,"%p->(%p)\n",this,pidl); + TRACE(pidl,"(%p)\n",pidl); if (! pidl) return FALSE; - pData = PidlMgr_GetDataPointer(this,pidl); + pData = _ILGetDataPointer(pidl); return (PT_DRIVE == pData->type); } -BOOL32 PidlMgr_IsFolder(LPPIDLMGR this,LPCITEMIDLIST pidl) +BOOL32 WINAPI _ILIsFolder(LPCITEMIDLIST pidl) { LPPIDLDATA pData; - TRACE(pidl,"%p->(%p)\n",this,pidl); + TRACE(pidl,"(%p)\n",pidl); if (! pidl) return FALSE; - pData = PidlMgr_GetDataPointer(this,pidl); + pData = _ILGetDataPointer(pidl); return (PT_FOLDER == pData->type); } -BOOL32 PidlMgr_IsValue(LPPIDLMGR this,LPCITEMIDLIST pidl) +BOOL32 WINAPI _ILIsValue(LPCITEMIDLIST pidl) { LPPIDLDATA pData; - TRACE(pidl,"%p->(%p)\n",this,pidl); + TRACE(pidl,"(%p)\n",pidl); if (! pidl) return FALSE; - pData = PidlMgr_GetDataPointer(this,pidl); + pData = _ILGetDataPointer(pidl); return (PT_VALUE == pData->type); } /************************************************************************** - * PidlMgr_HasFolders() + * _ILHasFolders() * fixme: quick hack */ -BOOL32 PidlMgr_HasFolders(LPPIDLMGR this, LPSTR pszPath, LPCITEMIDLIST pidl) -{ BOOL32 bResult= FALSE; - WIN32_FIND_DATA32A stffile; - HANDLE32 hFile; +BOOL32 WINAPI _ILHasFolders( LPSTR pszPath, LPCITEMIDLIST pidl) +{ BOOL32 bResult= FALSE; + WIN32_FIND_DATA32A stffile; + HANDLE32 hFile; - TRACE(pidl,"(%p)->%p %p\n",this, pszPath, pidl); + TRACE(pidl,"%p %p\n", pszPath, pidl); - hFile = FindFirstFile32A(pszPath,&stffile); - do - { if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) - { bResult= TRUE; - } - } while( FindNextFile32A(hFile,&stffile)); - FindClose32 (hFile); + hFile = FindFirstFile32A(pszPath,&stffile); + do + { if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) + { bResult= TRUE; + } + } while( FindNextFile32A(hFile,&stffile)); + FindClose32 (hFile); return bResult; } - /************************************************************************** - * PidlMgr_GetFolderText() + * _ILGetFolderText() * 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; +DWORD WINAPI _ILGetFolderText(LPCITEMIDLIST pidl,LPSTR lpszPath, DWORD dwSize) +{ LPITEMIDLIST pidlTemp; + DWORD dwCopied = 0; + LPSTR pText; - TRACE(pidl,"(%p)->(%p)\n",this,pidl); + TRACE(pidl,"(%p)\n",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; + if(!pidl) + { return 0; } - - strcat(lpszPath, pData->szText); - strcat(lpszPath, "\\"); - dwCopied += strlen(pData->szText) + 1; - pidlTemp = ILGetNext(pidlTemp); - TRACE(pidl,"-- (%p)->(size=%lu,%s)\n",this,dwCopied,lpszPath); - } + if(_ILIsMyComputer(pidl)) + { pidlTemp = ILGetNext(pidl); + TRACE(pidl,"-- skip My Computer\n"); + } + else + { pidlTemp = (LPITEMIDLIST)pidl; + } - //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; + //if this is NULL, return the required size of the buffer + if(!lpszPath) + { while(pidlTemp->mkid.cb) + { LPPIDLDATA pData = _ILGetDataPointer(pidlTemp); + pText = _ILGetTextPointer(pData->type,pData); + + /*add the length of this item plus one for the backslash + fixme: is one to much, drive has its own backslash*/ + dwCopied += strlen(pText) + 1; + pidlTemp = ILGetNext(pidlTemp); + } + + //add one for the NULL terminator + TRACE(pidl,"-- (size=%lu)\n",dwCopied); + return dwCopied + 1; + } + + *lpszPath = 0; + + while(pidlTemp->mkid.cb && (dwCopied < dwSize)) + { LPPIDLDATA pData = _ILGetDataPointer(pidlTemp); + + //if this item is a value, then skip it and finish + if(PT_VALUE == pData->type) + { break; + } + pText = _ILGetTextPointer(pData->type,pData); + strcat(lpszPath, pText); + PathAddBackslash(lpszPath); + dwCopied += strlen(pText) + 1; + pidlTemp = ILGetNext(pidlTemp); + + TRACE(pidl,"-- (size=%lu,%s)\n",dwCopied,lpszPath); + } + + //remove the last backslash if necessary + if(dwCopied) + { if(*(lpszPath + strlen(lpszPath) - 1) == '\\') + { *(lpszPath + strlen(lpszPath) - 1) = 0; + dwCopied--; + } + } + TRACE(pidl,"-- (path=%s)\n",lpszPath); + return dwCopied; } /************************************************************************** - * PidlMgr_GetValueText() + * _ILGetValueText() * Gets the text for the last item in the list */ -DWORD PidlMgr_GetValueText(LPPIDLMGR this, +DWORD WINAPI _ILGetValueText( LPCITEMIDLIST pidl, LPSTR lpszValue, DWORD dwSize) -{ LPITEMIDLIST pidlTemp=pidl; - CHAR szText[MAX_PATH]; +{ LPITEMIDLIST pidlTemp=pidl; + CHAR szText[MAX_PATH]; - TRACE(pidl,"(%p)->(pidl=%p %p 0x%08lx)\n",this,pidl,lpszValue,dwSize); + TRACE(pidl,"(pidl=%p %p 0x%08lx)\n",pidl,lpszValue,dwSize); - if(!pidl) - { return 0; + if(!pidl) + { return 0; } - while(pidlTemp->mkid.cb && !PidlMgr_IsValue(this,pidlTemp)) - { pidlTemp = ILGetNext(pidlTemp); - } - - if(!pidlTemp->mkid.cb) - { return 0; + while(pidlTemp->mkid.cb && !_ILIsValue(pidlTemp)) + { pidlTemp = ILGetNext(pidlTemp); } - PidlMgr_GetItemText(this, pidlTemp, szText, sizeof(szText)); + if(!pidlTemp->mkid.cb) + { return 0; + } - 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); + _ILGetItemText( pidlTemp, szText, sizeof(szText)); + + if(!lpszValue) + { return strlen(szText) + 1; + } + strcpy(lpszValue, szText); + TRACE(pidl,"-- (pidl=%p %p=%s 0x%08lx)\n",pidl,lpszValue,lpszValue,dwSize); + return strlen(lpszValue); } /************************************************************************** - * PidlMgr_GetValueType() + * _ILGetDataText() + * NOTES + * used from ShellView */ -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) +DWORD WINAPI _ILGetDataText( 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); + FIXME(pidl,"(pidl=%p pidl=%p) stub\n",pidlPath,pidlValue); if(!lpszOut || !pidlPath || !pidlValue) { return FALSE; @@ -625,43 +499,42 @@ DWORD PidlMgr_GetDataText( LPPIDLMGR this, /* fixme: get the driveletter*/ //assemble the Folder string - dwNameSize = PidlMgr_GetFolderText(this,pidlPath, NULL, 0); + dwNameSize = _ILGetFolderText(pidlPath, NULL, 0); lpszFolder = (LPSTR)HeapAlloc(GetProcessHeap(),0,dwNameSize); if(!lpszFolder) { return FALSE; } - PidlMgr_GetFolderText(this,pidlPath, lpszFolder, dwNameSize); + _ILGetFolderText(pidlPath, lpszFolder, dwNameSize); //assemble the value name - dwNameSize = PidlMgr_GetValueText(this,pidlValue, NULL, 0); + dwNameSize = _ILGetValueText(pidlValue, NULL, 0); lpszValueName = (LPSTR)HeapAlloc(GetProcessHeap(),0,dwNameSize); if(!lpszValueName) { HeapFree(GetProcessHeap(),0,lpszFolder); return FALSE; } - PidlMgr_GetValueText(this,pidlValue, lpszValueName, dwNameSize); + _ILGetValueText(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); + TRACE(pidl,"-- (%p=%s 0x%08lx)\n",lpszOut,lpszOut,dwOutSize); return TRUE; } /************************************************************************** - * CPidlMgr::GetPidlPath() + * _ILGetPidlPath() * 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) +DWORD WINAPI _ILGetPidlPath( LPCITEMIDLIST pidl, LPSTR lpszOut, DWORD dwOutSize) { LPSTR lpszTemp; WORD len; - TRACE(pidl,"(%p)->(%p,%lu)\n",this,lpszOut,dwOutSize); + TRACE(pidl,"(%p,%lu)\n",lpszOut,dwOutSize); if(!lpszOut) { return 0; @@ -670,7 +543,7 @@ DWORD PidlMgr_GetPidlPath(LPPIDLMGR this, *lpszOut = 0; lpszTemp = lpszOut; - dwOutSize -= PidlMgr_GetFolderText(this,pidl, lpszTemp, dwOutSize); + dwOutSize -= _ILGetFolderText(pidl, lpszTemp, dwOutSize); //add a backslash if necessary len = strlen(lpszTemp); @@ -683,164 +556,165 @@ DWORD PidlMgr_GetPidlPath(LPPIDLMGR this, lpszTemp = lpszOut + strlen(lpszOut); //add the value string - PidlMgr_GetValueText(this,pidl, lpszTemp, dwOutSize); + _ILGetValueText(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); + TRACE(pidl,"-- (%p=%s,%lu)\n",lpszOut,lpszOut,dwOutSize); return strlen(lpszOut); } /************************************************************************** - * PidlMgr_Create() + * _ILCreate() * 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; +LPITEMIDLIST WINAPI _ILCreate(PIDLTYPE type, LPVOID pIn, UINT16 uInSize) +{ LPITEMIDLIST pidlOut=NULL; + UINT16 uSize; + LPITEMIDLIST pidlTemp=NULL; + LPPIDLDATA pData; + LPSTR pszDest; + + TRACE(pidl,"(%x %p %x)\n",type,pIn,uInSize); - 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 ( type == PT_DESKTOP) + { pidlOut = SHAlloc(2); + pidlOut->mkid.cb=0x0000; + return pidlOut; } - if (! pIn) + 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; - } + /* the sizes of: cb(2), pidldata-1, szText+1, next cb(2) */ + switch (type) + { case PT_DRIVE: + uSize = 4 + 10; + break; + default: + uSize = 4 + (sizeof(PIDLDATA)) + uInSize; + } + pidlOut = SHAlloc(uSize); + pidlTemp = pidlOut; + if(pidlOut) + { pidlTemp->mkid.cb = uSize - 2; + pData =_ILGetDataPointer(pidlTemp); + pszDest = _ILGetTextPointer(type, pData); + pData->type = type; + switch(type) + { case PT_MYCOMP: + memcpy(pszDest, pIn, uInSize); + TRACE(pidl,"- create My Computer: %s\n",debugstr_a(pszDest)); + break; + case PT_DRIVE: + memcpy(pszDest, pIn, uInSize); + TRACE(pidl,"- create Drive: %s\n",debugstr_a(pszDest)); + break; + case PT_FOLDER: + case PT_VALUE: + memcpy(pszDest, pIn, uInSize); + TRACE(pidl,"- create Value: %s\n",debugstr_a(pszDest)); + break; + default: + FIXME(pidl,"-- wrong argument\n"); + break; + } - pidlTemp = ILGetNext(pidlTemp); - pidlTemp->mkid.cb = 0x00; - } - TRACE(pidl,"-- (%p)->(pidl=%p, size=%u)\n",this,pidlOut,uSize-2); - return pidlOut; + pidlTemp = ILGetNext(pidlTemp); + pidlTemp->mkid.cb = 0x00; + } + TRACE(pidl,"-- (pidl=%p, size=%u)\n",pidlOut,uSize-2); + return pidlOut; } /************************************************************************** - * PidlMgr_GetData(PIDLTYPE, LPCITEMIDLIST, LPVOID, UINT16) + * _ILGetData(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); +DWORD WINAPI _ILGetData(PIDLTYPE type, LPCITEMIDLIST pidl, LPVOID pOut, UINT16 uOutSize) +{ LPPIDLDATA pData; + DWORD dwReturn=0; + LPSTR pszSrc; - if(!pidl) - { return 0; + TRACE(pidl,"(%x %p %p %x)\n",type,pidl,pOut,uOutSize); + + if(!pidl) + { return 0; } - pData = PidlMgr_GetDataPointer(this,pidl); + *(LPSTR)pOut = 0; - //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; + pData = _ILGetDataPointer(pidl); + if ( pData->type != type) + { ERR(pidl,"-- wrong type\n"); + return 0; + } + pszSrc = _ILGetTextPointer(pData->type, pData); - 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; + switch(type) + { case PT_MYCOMP: + if(uOutSize < 1) + return 0; + strncpy((LPSTR)pOut, "My Computer", 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; + case PT_DRIVE: + if(uOutSize < 1) + return 0; + strncpy((LPSTR)pOut, pszSrc, uOutSize); + dwReturn = strlen((LPSTR)pOut); + break; + + case PT_FOLDER: + case PT_VALUE: + strncpy((LPSTR)pOut, pszSrc, uOutSize); + dwReturn = strlen((LPSTR)pOut); + break; + default: + ERR(pidl,"-- unknown type\n"); + break; + } + TRACE(pidl,"-- (%p=%s 0x%08lx)\n",pOut,(char*)pOut,dwReturn); + return dwReturn; } /************************************************************************** - * PidlMgr_GetDataPointer() + * _ILGetDataPointer() */ -LPPIDLDATA PidlMgr_GetDataPointer(LPPIDLMGR this,LPITEMIDLIST pidl) -{ if(!pidl) - { return NULL; +LPPIDLDATA WINAPI _ILGetDataPointer(LPITEMIDLIST pidl) +{ if(!pidl) + { return NULL; } - TRACE(pidl,"(%p)->(%p)\n" ,this, pidl); - return (LPPIDLDATA)(pidl->mkid.abID); + TRACE(pidl,"(%p)\n", pidl); + return (LPPIDLDATA)(&pidl->mkid.abID); } - /************************************************************************** - * CPidlMgr_SeparatePathAndValue) - * Creates a separate path and value PIDL from a fully qualified PIDL. + * _ILGetTextPointer() + * gets a pointer to the string stored in the 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; +LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata) +{ TRACE(pidl,"(type=%x data=%p)\n", type, pidldata); + + if(!pidldata) + { return NULL; } - - *ppidlValue = PidlMgr_GetLastItem(this,pidlFQ); - - if(!PidlMgr_IsValue(this,*ppidlValue)) - { return FALSE; + switch (type) + { case PT_DRIVE: + return (LPSTR)&(pidldata->u.drive.szDriveName); + case PT_MYCOMP: + case PT_FOLDER: + case PT_VALUE: + return (LPSTR)&(pidldata->u.file.szText); } - - *ppidlValue = ILClone(*ppidlValue); - *ppidlPath = ILClone(pidlFQ); - - pidlTemp = PidlMgr_GetLastItem(this,*ppidlPath); - pidlTemp->mkid.cb = 0x00; - - return TRUE; + return NULL; } diff --git a/dlls/shell32/pidl.h b/dlls/shell32/pidl.h index 0817b536f76..03ca832ab5b 100644 --- a/dlls/shell32/pidl.h +++ b/dlls/shell32/pidl.h @@ -1,31 +1,100 @@ -/* INTERNAL CLASS pidlmgr */ - +/* + * internal pidl functions + * 1998 + * + * DO NOT use this definitions outside the shell32.dll ! + * + * The contents of a pidl should never used from a application + * directly. + * + * This stuff is used from SHGetFileAttributes, ShellFolder + * EnumIDList and ShellView. + */ + #ifndef __WINE_PIDL_H #define __WINE_PIDL_H +#include "shlobj.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*); +/* +* the pidl does cache fileattributes to speed up SHGetAttributes when +* displaying a big number of files. +* +* a pidl of NULL means the desktop +* +* The structure of the pidl seens to be a union. The first byte of the +* PIDLDATA desribes the type of pidl. +* +* first byte - my Computer 0x1F +* control/printer 0x2E +* drive 0x23 +* folder 0x31 +* drive: the second byte is the start of a string +* C : \ +* 43 3A 5C +* file: see the PIDLDATA structure +*/ +#define PT_DESKTOP 0x0000 /*fixme*/ +#define PT_MYCOMP 0x001F +#define PT_SPECIAL 0x002E +#define PT_DRIVE 0x0023 +#define PT_FOLDER 0x0031 +#define PT_VALUE 0x0033 /*fixme*/ + +#pragma pack(1) +typedef WORD PIDLTYPE; + typedef struct tagPIDLDATA +{ PIDLTYPE type; + union + { struct + { CHAR szDriveName[4]; + /* end of MS compatible*/ + DWORD dwSFGAO; + } drive; + struct + { DWORD dwFileSize; + WORD uFileDate; + WORD uFileTime; + WORD uFileAttribs; + /* end of MS compatible*/ + DWORD dwSFGAO; + CHAR szAlternateName[14]; /* the 8.3 Name*/ + CHAR szText[1]; /* last entry, variable size */ + } file, folder, generic; + }u; +} + /* here starts my implementation*/ + PIDLDATA, *LPPIDLDATA; +#pragma pack(4) + + LPITEMIDLIST WINAPI _ILCreateDesktop(); + LPITEMIDLIST WINAPI _ILCreateMyComputer(); + LPITEMIDLIST WINAPI _ILCreateDrive(LPCSTR); + LPITEMIDLIST WINAPI _ILCreateFolder(LPCSTR); + LPITEMIDLIST WINAPI _ILCreateValue(LPCSTR); + LPITEMIDLIST WINAPI _ILCreate(PIDLTYPE,LPVOID,UINT16); + + BOOL32 WINAPI _ILGetDrive(LPCITEMIDLIST,LPSTR,UINT16); + DWORD WINAPI _ILGetItemText(LPCITEMIDLIST,LPSTR,UINT16); + DWORD WINAPI _ILGetFolderText(LPCITEMIDLIST,LPSTR,DWORD); + DWORD WINAPI _ILGetValueText(LPCITEMIDLIST,LPSTR,DWORD); + DWORD WINAPI _ILGetDataText(LPCITEMIDLIST,LPCITEMIDLIST,LPSTR,DWORD); + DWORD WINAPI _ILGetPidlPath(LPCITEMIDLIST,LPSTR,DWORD); + DWORD WINAPI _ILGetData(PIDLTYPE,LPCITEMIDLIST,LPVOID,UINT16); + + BOOL32 WINAPI _ILIsDesktop(LPCITEMIDLIST); + BOOL32 WINAPI _ILIsMyComputer(LPCITEMIDLIST); + BOOL32 WINAPI _ILIsDrive(LPCITEMIDLIST); + BOOL32 WINAPI _ILIsFolder(LPCITEMIDLIST); + BOOL32 WINAPI _ILIsValue(LPCITEMIDLIST); + + BOOL32 WINAPI _ILHasFolders(LPSTR,LPCITEMIDLIST); + + LPPIDLDATA WINAPI _ILGetDataPointer(LPCITEMIDLIST); + LPSTR WINAPI _ILGetTextPointer(PIDLTYPE type, LPPIDLDATA pidldata); +/* + BOOL32 WINAPI _ILGetDesktop(LPCITEMIDLIST,LPSTR); + BOOL32 WINAPI _ILSeparatePathAndValue(LPITEMIDLIST,LPITEMIDLIST*,LPITEMIDLIST*); + BOOL32 WINAPI _ILGetValueType(LPCITEMIDLIST,LPCITEMIDLIST,LPDWORD); +*/ #endif diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 2a348f8b793..ea3923739c1 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -30,6 +30,7 @@ #include "commctrl.h" #include "authors.h" +#include "pidl.h" #include "shell32_main.h" /************************************************************************* @@ -108,16 +109,16 @@ 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; - } + } + if (imglist2) + { *imglist2=ShellSmallIconList; + } return TRUE; } /************************************************************************* - * SHGetFileInfoA [SHELL32.218] + * SHGetFileInfoA [SHELL32.218] * * FIXME * @@ -128,43 +129,51 @@ HIMAGELIST ShellBigIconList = 0; DWORD WINAPI SHGetFileInfo32A(LPCSTR path,DWORD dwFileAttributes, SHFILEINFO32A *psfi, UINT32 sizeofpsfi, UINT32 flags ) -{ CHAR szTemp[MAX_PATH]; - DWORD ret=0; +{ CHAR szTemp[MAX_PATH]; + LPPIDLDATA pData; + DWORD ret=0; - TRACE(shell,"(%s,0x%lx,%p,0x%x,0x%x)\n", + 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); - } + /* 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_ATTRIBUTES) + { if (flags & SHGFI_PIDL) + { pData = _ILGetDataPointer((LPCITEMIDLIST)path); + psfi->dwAttributes = pData->u.generic.dwSFGAO; /* fixme: no direct access*/ + ret=TRUE; + } + else + { psfi->dwAttributes=SFGAO_FILESYSTEM; + ret=TRUE; + } + FIXME(shell,"file attributes, stub\n"); + } - 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_DISPLAYNAME) + { if (flags & SHGFI_PIDL) + { strcpy(psfi->szDisplayName,szTemp); + } + else + { strcpy(psfi->szDisplayName,path); + } + TRACE(shell,"displayname=%s\n", psfi->szDisplayName); + ret=TRUE; + } - if (flags & SHGFI_TYPENAME) - { FIXME(shell,"get the file type, stub\n"); - strcpy(psfi->szTypeName,""); - ret=TRUE; - } + if (flags & SHGFI_TYPENAME) + { FIXME(shell,"get the file type, stub\n"); + strcpy(psfi->szTypeName,"FIXME: Type"); + ret=TRUE; + } if (flags & SHGFI_ICONLOCATION) { FIXME(shell,"location of icon, stub\n"); @@ -422,17 +431,17 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE LPWSTR lpszDisplayName = (LPWSTR)&pszTemp[0]; HKEY key; - enum - { FT_UNKNOWN= 0x00000000, + enum + { FT_UNKNOWN= 0x00000000, FT_DIR= 0x00000001, FT_DESKTOP= 0x00000002 } tFolder; - TRACE(shell,"(%04x,%d,%p)\n", hwndOwner,nFolder,ppidl); + TRACE(shell,"(%04x,%d,%p)\n", hwndOwner,nFolder,ppidl); - strcpy(buffer,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders\\"); + 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); + 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; @@ -440,151 +449,152 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND32 hwndOwner, INT32 nFolder, LPITE 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; + { 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); + TRACE(shell,"Key=%s\n",buffer); - type=REG_SZ; + type=REG_SZ; - switch (tFolder) + 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); + if (RegQueryValueEx32A(key,buffer,NULL,&type,tpath,&tpathlen)) + { GetWindowsDirectory32A(npath,MAX_PATH); PathAddBackslash(npath); - switch (nFolder) - { case CSIDL_DESKTOPDIRECTORY: - strcat (npath,"Desktop"); - break; + switch (nFolder) + { case CSIDL_DESKTOPDIRECTORY: + strcat (npath,"Desktop"); + break; case CSIDL_FONTS: - strcat (npath,"Fonts"); - break; + strcat (npath,"Fonts"); + break; case CSIDL_NETHOOD: - strcat (npath,"NetHood"); - break; + strcat (npath,"NetHood"); + break; case CSIDL_PERSONAL: - strcpy (npath,"C:\\Personal"); - break; + strcpy (npath,"C:\\Personal"); + break; case CSIDL_FAVORITES: - strcat (npath,"Favorites"); - break; + strcat (npath,"Favorites"); + break; case CSIDL_PRINTERS: - strcat (npath,"PrintHood"); - break; + strcat (npath,"PrintHood"); + break; case CSIDL_PROGRAMS: - strcat (npath,"Start Menu"); - CreateDirectory32A(npath,NULL); - strcat (npath,"\\Programs"); - break; + strcat (npath,"Start Menu"); + CreateDirectory32A(npath,NULL); + strcat (npath,"\\Programs"); + break; case CSIDL_RECENT: - strcat (npath,"Recent"); - break; + strcat (npath,"Recent"); + break; case CSIDL_SENDTO: - strcat (npath,"SendTo"); - break; + strcat (npath,"SendTo"); + break; case CSIDL_STARTMENU: - strcat (npath,"Start Menu"); - break; + strcat (npath,"Start Menu"); + break; case CSIDL_STARTUP: - strcat (npath,"Start Menu"); - CreateDirectory32A(npath,NULL); - strcat (npath,"\\Startup"); - break; + strcat (npath,"Start Menu"); + CreateDirectory32A(npath,NULL); + strcat (npath,"\\Startup"); + break; case CSIDL_TEMPLATES: - strcat (npath,"Templates"); - break; - default: + 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; + } + 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); + strcpy(tpath,npath); + } + break; + case FT_DESKTOP: + strcpy (tpath,"Desktop"); + break; default: - RegCloseKey(key); - return E_OUTOFMEMORY; - break; - } + RegCloseKey(key); + return E_OUTOFMEMORY; + break; + } RegCloseKey(key); - TRACE(shell,"Value=%s\n",tpath); - LocalToWideChar32(lpszDisplayName, tpath, 256); + 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); @@ -935,7 +945,7 @@ BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRe exit (1); } if ( ! ShellSmallIconList ) - { if ( (ShellSmallIconList = pImageList_Create(sysMetrics[SM_CXSMICON],sysMetrics[SM_CYSMICON],0x101,0,0x20)) ) + { if ( (ShellSmallIconList = pImageList_Create(sysMetrics[SM_CXSMICON],sysMetrics[SM_CYSMICON],ILC_COLORDDB | ILC_MASK,0,0x20)) ) { for (index=0;index < 40; index++) { if ( ! ( htmpIcon = ExtractIcon32A(hinstDLL, szShellPath, index)) || ( -1 == (iiconindex = pImageList_AddIcon (ShellSmallIconList, htmpIcon))) ) @@ -946,7 +956,7 @@ BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason, LPVOID lpvRe } } if ( ! ShellBigIconList ) - { if ( (ShellBigIconList = pImageList_Create(SYSMETRICS_CXSMICON, SYSMETRICS_CYSMICON,0x101,0,0x20)) ) + { if ( (ShellBigIconList = pImageList_Create(SYSMETRICS_CXSMICON, SYSMETRICS_CYSMICON,ILC_COLORDDB | ILC_MASK,0,0x20)) ) { for (index=0;index < 40; index++) { if ( ! (htmpIcon = ExtractIcon32A( hinstDLL, szShellPath, index)) || (-1 == (iiconindex = pImageList_AddIcon (ShellBigIconList, htmpIcon))) ) diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index fbbc42ec381..bf78ba6c4d2 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -29,29 +29,30 @@ typedef DWORD (* WINAPI GetClassPtr)(REFCLSID,REFIID,LPVOID); static GetClassPtr SH_find_moduleproc(LPSTR dllname,HMODULE32 *xhmod,LPSTR name) -{ HMODULE32 hmod; - FARPROC32 dllunload,nameproc; +{ HMODULE32 hmod; + FARPROC32 dllunload,nameproc; + TRACE(shell,"dll=%s, hmodule=%p, name=%s\n",dllname, xhmod, name); if (xhmod) - { *xhmod = 0; - } + { *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; - } - } + { *xhmod = hmod; + } + } nameproc = GetProcAddress32(hmod,name); if (!nameproc) - { FreeLibrary32(hmod); + { FreeLibrary32(hmod); return NULL; } /* register unloadable dll with unloadproc ... */ @@ -73,21 +74,14 @@ static DWORD SH_get_instance(REFCLSID clsid,LPSTR dllname,LPVOID unknownouter,RE 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); + { FIXME(shell,"no classfactory, but hres is 0x%ld!\n",hres); return E_FAIL; } classfac->lpvtbl->fnCreateInstance(classfac,unknownouter,refiid,inst); @@ -111,11 +105,11 @@ LRESULT WINAPI SHCoCreateInstance(LPSTR aclsid,CLSID *clsid,LPUNKNOWN unknownout 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); @@ -124,11 +118,11 @@ LRESULT WINAPI SHCoCreateInstance(LPSTR aclsid,CLSID *clsid,LPUNKNOWN unknownout 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); + { RegCloseKey(inprockey); return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst); } @@ -136,7 +130,7 @@ LRESULT WINAPI SHCoCreateInstance(LPSTR aclsid,CLSID *clsid,LPUNKNOWN unknownout tmodellen=sizeof(tmodel); type=REG_SZ; if (RegQueryValueEx32A(inprockey,"ThreadingModel",NULL,&type,tmodel,&tmodellen)) - { RegCloseKey(inprockey); + { RegCloseKey(inprockey); return SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst); } @@ -144,8 +138,8 @@ LRESULT WINAPI SHCoCreateInstance(LPSTR aclsid,CLSID *clsid,LPUNKNOWN unknownout hres=SH_get_instance(clsid,path,unknownouter,refiid,inst); if (hres<0) - { hres=SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst); - } + { hres=SH_get_instance(clsid,"shell32.dll",unknownouter,refiid,inst); + } RegCloseKey(inprockey); return hres; } @@ -178,11 +172,11 @@ DWORD WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid,REFIID iid,LPVOID *ppv) if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)|| IsEqualCLSID(rclsid, &CLSID_ShellLink)) { if(IsEqualCLSID(rclsid, &CLSID_ShellDesktop)) /*debug*/ - { TRACE(shell,"requested CLSID_ShellDesktop\n"); - } + { TRACE(shell,"-- requested CLSID_ShellDesktop\n"); + } if(IsEqualCLSID(rclsid, &CLSID_ShellLink)) /*debug*/ - { TRACE(shell,"requested CLSID_ShellLink\n"); - } + { TRACE(shell,"-- requested CLSID_ShellLink\n"); + } lpclf = IClassFactory_Constructor(); if(lpclf) { hres = lpclf->lpvtbl->fnQueryInterface(lpclf,iid, ppv); @@ -190,10 +184,10 @@ DWORD WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid,REFIID iid,LPVOID *ppv) } } else - { WARN(shell, "clsid(%s) not in buildin SHELL32\n",xclsid); + { WARN(shell, "-- CLSID not found\n"); hres = CLASS_E_CLASSNOTAVAILABLE; } - TRACE(shell,"RETURN pointer to interface: %p\n",ppv); + TRACE(shell,"-- return pointer to interface: %p\n",*ppv); return hres; } @@ -249,26 +243,26 @@ LPCLASSFACTORY IClassFactory_Constructor() */ 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); +{ char xriid[50]; + WINE_StringFromCLSID((LPCLSID)riid,xriid); + TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid); - *ppvObj = NULL; + *ppvObj = NULL; - if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ - { *ppvObj = this; - } - else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/ - { *ppvObj = (IClassFactory*)this; - } + 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; - } + 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; + return E_NOINTERFACE; } /****************************************************************************** * IClassFactory_AddRef @@ -294,12 +288,12 @@ static ULONG WINAPI IClassFactory_Release(LPCLASSFACTORY this) */ static HRESULT WINAPI IClassFactory_CreateInstance( LPCLASSFACTORY this, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject) -{ IUnknown *pObj = NULL; +{ 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); + WINE_StringFromCLSID((LPCLSID)riid,xriid); + TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject); *ppObject = NULL; @@ -308,39 +302,39 @@ static HRESULT WINAPI IClassFactory_CreateInstance( } 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); - } + { 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); - } + 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); + pObj->lpvtbl->fnRelease(pObj); + TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject); - return hres; + 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; +{ TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock); + return E_NOTIMPL; } diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index ae9990f9628..b8aa3f834f5 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -416,8 +416,8 @@ BOOL32 WINAPI PathYetAnotherMakeUniqueName(LPDWORD x,LPDWORD y) { * */ DWORD WINAPI -SHMapPIDLToSystemImageListIndex(DWORD x,DWORD y,DWORD z) -{ FIXME(shell,"(%08lx,%08lx,%08lx):stub.\n",x,y,z); +SHMapPIDLToSystemImageListIndex(LPSHELLFOLDER sh,DWORD y,DWORD z) +{ FIXME(shell,"(folder=%p,%08lx,%08lx):stub.\n",sh,y,z); return 0; } @@ -452,15 +452,22 @@ StrToOleStrN (LPWSTR lpWide, INT32 nWide, LPCSTR lpMulti, INT32 nMulti) { * SHCloneSpecialIDList [SHELL32.89] * * PARAMETERS - * hwnd + * hwndOwner [in] + * nFolder [in] CSIDL_xxxxx ?? + * + * RETURNS + * pidl ?? * NOTES * exported by ordinal */ -DWORD WINAPI SHCloneSpecialIDList(HWND32 hwnd,DWORD x2,DWORD x3) { - FIXME(shell,"(hwnd=0x%x,0x%lx,0x%lx):stub.\n", - hwnd,x2,x3 - ); - return S_OK; +LPITEMIDLIST WINAPI SHCloneSpecialIDList(HWND32 hwndOwner,DWORD nFolder,DWORD x3) +{ LPITEMIDLIST ppidl; + WARN(shell,"(hwnd=0x%x,csidl=0x%lx,0x%lx):semi-stub.\n", + hwndOwner,nFolder,x3); + + SHGetSpecialFolderLocation(hwndOwner, nFolder, &ppidl); + + return ppidl; } /************************************************************************* @@ -484,7 +491,7 @@ BOOL32 WINAPI IsLFNDrive(LPCSTR path) { * exported by ordinal */ void WINAPI SHGetSpecialFolderPath(DWORD x1,DWORD x2,DWORD x3,DWORD x4) { - FIXME(shell,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx):stub.\n", + FIXME(shell,"(0x%04lx,0x%04lx,csidl=0x%04lx,0x%04lx):stub.\n", x1,x2,x3,x4 ); } @@ -513,8 +520,8 @@ void WINAPI RegisterShellHook32(HWND32 hwnd, DWORD y) { */ void __cdecl ShellMessageBoxA(HMODULE32 hmod,HWND32 hwnd,DWORD id,DWORD x,DWORD type,LPVOID arglist) { - char buf[100],buf2[100],*buf3; - LPVOID args = &arglist; + char buf[100],buf2[100]/*,*buf3*/; +/* LPVOID args = &arglist;*/ if (!LoadString32A(hmod,x,buf,100)) strcpy(buf,"Desktop"); @@ -584,11 +591,12 @@ LPSTR WINAPI PathGetExtension(LPSTR path,DWORD y,DWORD z) * SHCreateDirectory [SHELL32.165] * * NOTES - * exported by ordinal + * exported by ordinal + * not sure about LPSECURITY_ATTRIBUTES */ -DWORD WINAPI SHCreateDirectory(DWORD x,LPCSTR path) { - TRACE(shell,"(%08lx,%s):stub.\n",x,path); - if (CreateDirectory32A(path,x)) +DWORD WINAPI SHCreateDirectory(LPSECURITY_ATTRIBUTES sec,LPCSTR path) { + TRACE(shell,"(%p,%s):stub.\n",sec,path); + if (CreateDirectory32A(path,sec)) return TRUE; /* SHChangeNotify(8,1,path,0); */ return FALSE; @@ -760,7 +768,7 @@ DWORD WINAPI SHAddToRecentDocs32 (UINT32 uFlags,LPCVOID pv) * exported by name */ DWORD WINAPI SHFileOperation32 ( - LPSHFILEOPSTRUCT32 lpFileOp) + LPSHFILEOPSTRUCT32A lpFileOp) { FIXME (shell,"(%p):stub.\n", lpFileOp); return 1; } @@ -794,34 +802,100 @@ HRESULT WINAPI SHCreateShellFolderViewEx32( /************************************************************************* * SHFind_InitMenuPopup [SHELL32.149] * + * NOTES + * Registers the menu behind the "Start" button + * + * PARAMETERS + * hMenu [in] handel of menu previously created + * hWndParent [in] parent window + * w [in] no pointer + * x [in] no pointer */ -HRESULT WINAPI SHFind_InitMenuPopup (DWORD u, DWORD v, DWORD w, DWORD x) -{ FIXME(shell,"0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",u,v,w,x); - return 0; +HRESULT WINAPI SHFind_InitMenuPopup (HMENU32 hMenu, HWND32 hWndParent, DWORD w, DWORD x) +{ FIXME(shell,"hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n", + hMenu,hWndParent,w,x); + return 0; +} +/************************************************************************* + * FileMenu_InitMenuPopup [SHELL32.109] + * + */ +HRESULT WINAPI FileMenu_InitMenuPopup (DWORD hmenu) +{ FIXME(shell,"hmenu=0x%lx stub\n",hmenu); + return 0; } /************************************************************************* * FileMenu_Create [SHELL32.114] * + * w retval from LoadBitmapA + * + * */ HRESULT WINAPI FileMenu_Create (DWORD u, DWORD v, DWORD w, DWORD x, DWORD z) -{ FIXME(shell,"0x%08lx 0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",u,v,w,x,z); +{ FIXME(shell,"0x%08lx 0x%08lx hbmp=0x%lx 0x%08lx 0x%08lx stub\n",u,v,w,x,z); return 0; } +/************************************************************************* + * FileMenu_TrackPopupMenuEx [SHELL32.116] + * + * PARAMETERS + * uFlags [in] according to TrackPopupMenuEx + * posX [in] + * posY [in] + * hWndParent [in] + * z could be rect (trace) or TPMPARAMS (TrackPopupMenuEx) + */ +HRESULT WINAPI FileMenu_TrackPopupMenuEx (DWORD t, DWORD uFlags, DWORD posX, DWORD posY, HWND32 hWndParent, DWORD z) +{ FIXME(shell,"0x%lx flags=0x%lx posx=0x%lx posy=0x%lx hwndp=0x%x 0x%lx stub\n", + t,uFlags,posX,posY, hWndParent,z); + return 0; +} +/************************************************************************* + * SHWinHelp [SHELL32.127] + * + */ +HRESULT WINAPI SHWinHelp (DWORD v, DWORD w, DWORD x, DWORD z) +{ FIXME(shell,"0x%08lx 0x%08lx 0x%08lx 0x%08lx stub\n",v,w,x,z); + return 0; +} +/************************************************************************* + * SHRunConrolPanel [SHELL32.161] + * + */ +HRESULT WINAPI SHRunConrolPanel (DWORD x, DWORD z) +{ FIXME(shell,"0x%08lx 0x%08lx stub\n",x,z); + return 0; +} /************************************************************************* * ShellExecuteEx [SHELL32.291] * */ -BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFOA u) -{ FIXME(shell,"%p stub\n",u); - return 0; +BOOL32 WINAPI ShellExecuteEx32A (LPSHELLEXECUTEINFO32A sei) +{ CHAR szTemp[MAX_PATH]; + FIXME(shell,"%p stub\n",sei); + + if (sei->fMask & SEE_MASK_IDLIST) + { SHGetPathFromIDList32A (sei->lpIDList,szTemp); + TRACE (shell,"-- idlist=%p (%s)\n", sei->lpIDList, szTemp); + } + + if (sei->fMask & SEE_MASK_CLASSNAME) + { TRACE (shell,"-- classname= %s\n", sei->lpClass); + } + + if (sei->lpVerb) + { TRACE (shell,"-- action=%s\n", sei->lpVerb); + } + + return 0; } /************************************************************************* * SHSetInstanceExplorer [SHELL32.176] * */ HRESULT WINAPI SHSetInstanceExplorer (DWORD u) -{ FIXME(shell,"0x%08lx stub\n",u); - return 0; +{ FIXME(shell,"0x%08lx stub\n",u); + return 0; } /************************************************************************* * SHGetInstanceExplorer [SHELL32.256] @@ -830,8 +904,8 @@ HRESULT WINAPI SHSetInstanceExplorer (DWORD u) * exported by name */ HRESULT WINAPI SHGetInstanceExplorer (DWORD u) -{ FIXME(shell,"0x%08lx stub\n",u); - return 0; +{ FIXME(shell,"0x%08lx stub\n",u); + return 0; } /************************************************************************* * SHFreeUnusedLibraries [SHELL32.123] @@ -840,6 +914,43 @@ HRESULT WINAPI SHGetInstanceExplorer (DWORD u) * exported by name */ HRESULT WINAPI SHFreeUnusedLibraries (DWORD u) +{ FIXME(shell,"0x%08lx stub\n",u); + return 0; +} +/************************************************************************* + * DAD_ShowDragImage [SHELL32.137] + * + * NOTES + * exported by name + */ +HRESULT WINAPI DAD_ShowDragImage (DWORD u) { FIXME(shell,"0x%08lx stub\n",u); return 0; } +/************************************************************************* + * FileMenu_Destroy [SHELL32.118] + * + * NOTES + * exported by name + */ +HRESULT WINAPI FileMenu_Destroy (DWORD u) +{ FIXME(shell,"0x%08lx stub\n",u); + return 0; +} +/************************************************************************* + * SHGetDataFromIDListA [SHELL32.247] + * + */ +HRESULT WINAPI SHGetDataFromIDListA(DWORD u, DWORD v, DWORD w, DWORD x, DWORD y) +{ FIXME(shell,"0x%04lx 0x%04lx 0x%04lx 0x%04lx 0x%04lx stub\n",u,v,w,x,y); + return 0; +} +/************************************************************************* + * SHFileOperationA [SHELL32.243] + * + */ +HRESULT WINAPI SHFileOperationA(DWORD x) +{ FIXME(shell,"0x%08lx stub\n",x); + return 0; + +} diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index 4a516cff593..5b03dcb7937 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -22,7 +22,7 @@ #include "winnls.h" #include "winproc.h" #include "commctrl.h" - +#include "pidl.h" #include "shell32_main.h" static HRESULT WINAPI IShellFolder_QueryInterface(LPSHELLFOLDER,REFIID,LPVOID*); @@ -55,25 +55,25 @@ static BOOL32 WINAPI IShellFolder_GetFolderPath(LPSHELLFOLDER,LPSTR,DWORD); * 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); +{ LPSTR pszTail = pszNext; + DWORD dwCopy; + TRACE(shell,"(%s %p 0x%08lx)\n",debugstr_a(pszNext),pszOut,dwOut); - if(!pszNext || !*pszNext) - return NULL; + if(!pszNext || !*pszNext) + return NULL; - while(*pszTail && (*pszTail != '\\')) - { pszTail++; - } - dwCopy=((LPBYTE)pszTail-(LPBYTE)pszNext)/sizeof(CHAR)+1; - lstrcpyn32A(pszOut, pszNext, (dwOutref=1; - sf->lpvtbl=&sfvt; - sf->mlpszFolder=NULL; + 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); + /* 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)); - } - } + if(sf->mpidl) /* do we have a pidl?*/ + { dwSize = 0; + if(sf->mpSFParent->mlpszFolder) + { dwSize += strlen(sf->mpSFParent->mlpszFolder) + 1; + } + dwSize += _ILGetFolderText(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); + } + _ILGetFolderText(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)); + TRACE(shell,"-- (%p)->(%p,%p,parent=%s)\n",sf,pParent, pidl, debugstr_a(sf->mlpszFolder)); return sf; } /************************************************************************** @@ -185,30 +177,27 @@ static ULONG WINAPI IShellFolder_AddRef(LPSHELLFOLDER this) * 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); +{ 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); - } + if (pdesktopfolder==this) + { pdesktopfolder=NULL; + TRACE(shell,"-- destroyed IShellFolder(%p) was Desktopfolder\n",this); + } + if(this->mpidlNSRoot) + { SHFree(this->mpidlNSRoot); + } + if(this->mpidl) + { SHFree(this->mpidl); + } + if(this->mlpszFolder) + { SHFree(this->mlpszFolder); + } - HeapFree(GetProcessHeap(),0,this); + HeapFree(GetProcessHeap(),0,this); - return 0; + return 0; } return this->ref; } @@ -245,46 +234,46 @@ static HRESULT WINAPI IShellFolder_ParseDisplayName( 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); + 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 = _ILCreateMyComputer(); - /* check if the lpszDisplayName is Folder or File*/ - bType = ! (GetFileAttributes32A(pszNext)&FILE_ATTRIBUTE_DIRECTORY); - pszNext = GetNextElement(pszTemp, szElement, MAX_PATH); + /* 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); + pidlTemp = _ILCreateDrive(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; - } - } - } - } + if(pidlFull) + { while((pszNext=GetNextElement(pszNext, szElement, MAX_PATH))) + { if(!*pszNext && bType) + { pidlTemp = _ILCreateValue(szElement); + } + else + { pidlTemp = _ILCreateFolder(szElement); + } + pidlOld = pidlFull; + pidlFull = ILCombine(pidlFull,pidlTemp); + SHFree(pidlOld); + } + hr = S_OK; + } + } + } + } HeapFree(GetProcessHeap(),0,pszTemp); - *ppidl = pidlFull; - return hr; + *ppidl = pidlFull; + return hr; } /************************************************************************** @@ -415,26 +404,26 @@ static HRESULT WINAPI IShellFolder_CompareIDs( 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)) + if(_ILIsValue(pidlTemp1) != _ILIsValue(pidlTemp2)) + { if(_ILIsValue(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)); + _ILGetDrive( pidl1,szString1,sizeof(szString1)); + _ILGetDrive( 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)); + _ILGetFolderText( pidl1,szString1,sizeof(szString1)); + _ILGetFolderText( 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)); + _ILGetValueText(pidl1,szString1,sizeof(szString1)); + _ILGetValueText(pidl2,szString2,sizeof(szString2)); return strcasecmp(szString1, szString2); } @@ -489,11 +478,7 @@ static HRESULT WINAPI IShellFolder_CreateViewObject( * 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) +static HRESULT WINAPI IShellFolder_GetAttributesOf(LPSHELLFOLDER this,UINT32 cidl,LPCITEMIDLIST *apidl,DWORD *rgfInOut) { LPCITEMIDLIST * pidltemp; DWORD i; @@ -510,19 +495,19 @@ static HRESULT WINAPI IShellFolder_GetAttributesOf( do { if (*pidltemp) - { if (this->pPidlMgr->lpvtbl->fnIsDesktop(this->pPidlMgr, *pidltemp)) + { if (_ILIsDesktop( *pidltemp)) { *rgfInOut |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR); } - else if (this->pPidlMgr->lpvtbl->fnIsMyComputer(this->pPidlMgr, *pidltemp)) + else if (_ILIsMyComputer( *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 (_ILIsDrive( *pidltemp)) + { *rgfInOut |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM); } - else if (this->pPidlMgr->lpvtbl->fnIsFolder(this->pPidlMgr, *pidltemp)) - { *rgfInOut |= (SFGAO_FOLDER | SFGAO_FILESYSTEM | SFGAO_HASSUBFOLDER); + else if (_ILIsFolder( *pidltemp)) + { *rgfInOut |= (SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM ); } - else if (this->pPidlMgr->lpvtbl->fnIsValue(this->pPidlMgr, *pidltemp)) + else if (_ILIsValue( *pidltemp)) { *rgfInOut |= (SFGAO_FILESYSTEM); } } @@ -628,110 +613,107 @@ static HRESULT WINAPI IShellFolder_GetUIObjectOf( LPSHELLFOLDER this,HWND32 hwnd #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]; +static HRESULT WINAPI IShellFolder_GetDisplayNameOf( LPSHELLFOLDER this, LPCITEMIDLIST 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; + DWORD dwVolumeSerialNumber,dwMaximumComponetLength,dwFileSystemFlags; + LPITEMIDLIST pidlTemp=NULL; BOOL32 bSimplePidl=FALSE; - TRACE(shell,"(%p)->(pidl=%p,0x%08lx,%p)\n",this,pidl,dwFlags,lpName); + TRACE(shell,"(%p)->(pidl=%p,0x%08lx,%p)\n",this,pidl,dwFlags,lpName); - if (!pidl) - { return E_OUTOFMEMORY; - } + if (!pidl) + { return E_OUTOFMEMORY; + } - szSpecial[0]=0x00; - szDrive[0]=0x00; + szSpecial[0]=0x00; + szDrive[0]=0x00; - /* test if simple(relative) or complex(absolute) pidl */ - pidlTemp = ILGetNext(pidl); + /* 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)) + if (_ILIsDesktop( 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); - } - } + { if (_ILIsMyComputer( pidl)) + { _ILGetItemText( pidl, szSpecial, MAX_PATH); + } + if (_ILIsDrive( pidl)) + { pidlTemp = ILFindLastID(pidl); + if (pidlTemp) + { _ILGetItemText( 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); + switch(dwFlags) + { case SHGDN_NORMAL: + _ILGetPidlPath( pidl, szText, MAX_PATH); + break; + case SHGDN_INFOLDER: + pidlTemp = ILFindLastID(pidl); + if (pidlTemp) + { _ILGetItemText( 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 = ILFindLastID(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); - } - } + { _ILGetItemText( pidlTemp, szTemp, MAX_PATH ); + } + strcat(szText,szTemp); + } + else + { /* if the pidl is absolute, get everything from the pidl*/ + _ILGetPidlPath( 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); + 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; + if(!(lpName)) + { return E_OUTOFMEMORY; + } + lpName->uType = STRRET_CSTR; + strcpy(lpName->u.cStr,szText); + return S_OK; } /************************************************************************** @@ -762,21 +744,20 @@ static HRESULT WINAPI IShellFolder_SetNameOf( * 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); +{ DWORD dwSize; - TRACE(shell,"-- (%p)->(return=%s)\n",this, lpszOut); - return TRUE; + 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; } diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 90796db4bb1..3939b386cd0 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -97,7 +97,8 @@ LPSHELLVIEW IShellView_Constructor(LPSHELLFOLDER pFolder, LPCITEMIDLIST pidl) sv->lpvtbl=&svvt; sv->mpidl = ILClone(pidl); - + sv->hMenu=0; + sv->pSFParent = pFolder; if(sv->pSFParent) sv->pSFParent->lpvtbl->fnAddRef(sv->pSFParent); @@ -118,8 +119,8 @@ BOOL32 ShellView_CreateList (LPSHELLVIEW this) TRACE(shell,"%p\n",this); - dwStyle = WS_TABSTOP | WS_VISIBLE |WS_CHILD | WS_BORDER | LVS_REPORT | - LVS_SHAREIMAGELISTS | LVS_EDITLABELS ; + dwStyle = WS_TABSTOP | WS_VISIBLE | WS_CHILD | WS_BORDER | + LVS_ICON | LVS_SHAREIMAGELISTS | LVS_EDITLABELS ; this->hWndList=CreateWindowEx32A( WS_EX_CLIENTEDGE,WC_LISTVIEW32A,NULL,dwStyle, 0,0,0,0, @@ -143,7 +144,7 @@ int nColumn3=100; int nColumn4=100; BOOL32 ShellView_InitList(LPSHELLVIEW this) -{ LV_COLUMN lvColumn; +{ LVCOLUMN32A lvColumn; CHAR szString[50]; TRACE(shell,"%p\n",this); @@ -152,29 +153,32 @@ BOOL32 ShellView_InitList(LPSHELLVIEW this) ListView_DeleteAllItems(this->hWndList); /*empty the list*/ //initialize the columns - lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM; + lvColumn.fmt = LVCFMT_LEFT; lvColumn.pszText = szString; lvColumn.cx = nColumn1; strcpy(szString,"File"); /*LoadString32A(shell32_hInstance, IDS_COLUMN1, szString, sizeof(szString));*/ - ListView_InsertColumn(this->hWndList, 0, &lvColumn); + ListView_InsertColumn32A(this->hWndList, 0, &lvColumn); lvColumn.cx = nColumn2; - strcpy(szString,"IDS_COLUMN2"); - ListView_InsertColumn(this->hWndList, 1, &lvColumn); + strcpy(szString,"COLUMN2"); + ListView_InsertColumn32A(this->hWndList, 1, &lvColumn); lvColumn.cx = nColumn3; - strcpy(szString,"IDS_COLUMN3"); - ListView_InsertColumn(this->hWndList, 2, &lvColumn); + strcpy(szString,"COLUMN3"); + ListView_InsertColumn32A(this->hWndList, 2, &lvColumn); lvColumn.cx = nColumn4; - strcpy(szString,"IDS_COLUMN4"); - ListView_InsertColumn(this->hWndList, 3, &lvColumn); - - ListView_SetImageList(this->hWndList, ShellBigIconList, LVSIL_SMALL); + strcpy(szString,"COLUMN4"); + ListView_InsertColumn32A(this->hWndList, 3, &lvColumn); + ListView_SetImageList(this->hWndList, ShellSmallIconList, LVSIL_SMALL); + ListView_SetImageList(this->hWndList, ShellBigIconList, LVSIL_NORMAL); + ListView_SetBkColor(this->hWndList, 0x00800000 ); + return TRUE; } /************************************************************************** @@ -204,11 +208,11 @@ void ShellView_FillList(LPSHELLVIEW this) { LPENUMIDLIST pEnumIDList; LPITEMIDLIST pidl; DWORD dwFetched; - LV_ITEM lvItem; + LVITEM32A lvItem; TRACE(shell,"%p\n",this); - if(S_OK == this->pSFParent->lpvtbl->fnEnumObjects(this->pSFParent,this->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList)) + if(SUCCEEDED(this->pSFParent->lpvtbl->fnEnumObjects(this->pSFParent,this->hWnd, SHCONTF_NONFOLDERS | SHCONTF_FOLDERS, &pEnumIDList))) { SendMessage32A(this->hWndList, WM_SETREDRAW, FALSE, 0); /*turn the listview's redrawing off*/ while((S_OK == pEnumIDList->lpvtbl->fnNext(pEnumIDList,1, &pidl, &dwFetched)) && dwFetched) @@ -219,7 +223,7 @@ void ShellView_FillList(LPSHELLVIEW this) lvItem.lParam = (LPARAM)ILClone(pidl); /*set the item's data*/ lvItem.pszText = LPSTR_TEXTCALLBACK32A; /*get text on a callback basis*/ lvItem.iImage = I_IMAGECALLBACK; /*get the image on a callback basis*/ - ListView_InsertItem(this->hWndList, &lvItem); /*add the item*/ + ListView_InsertItem32A(this->hWndList, &lvItem); /*add the item*/ } /*sort the items*/ @@ -267,9 +271,11 @@ HMENU32 ShellView_BuildFileMenu(LPSHELLVIEW this) { CHAR szText[MAX_PATH]; MENUITEMINFO32A mii; int nTools,i; - HMENU32 hSubMenu = CreatePopupMenu32(); + HMENU32 hSubMenu; TRACE(shell,"(%p) stub\n",this); + + hSubMenu = CreatePopupMenu32(); if(hSubMenu) { /*get the number of items in our global array*/ for(nTools = 0; g_Tools[nTools].idCommand != -1; nTools++){} @@ -478,7 +484,7 @@ LRESULT ShellView_OnKillFocus(LPSHELLVIEW this) } /************************************************************************** -* CShellView::AddRemoveDockingWindow() +* ShellView_AddRemoveDockingWindow() */ BOOL32 ShellView_AddRemoveDockingWindow(LPSHELLVIEW this, BOOL32 bAdd) { TRACE(shell,"(%p)->(badd=0x%08x) stub\n",this,bAdd); @@ -536,28 +542,6 @@ BOOL32 ShellView_AddRemoveDockingWindow(LPSHELLVIEW this, BOOL32 bAdd) return bReturn;*/ } -/************************************************************************** -* ShellView_OnCommand() -*/ -LRESULT ShellView_OnCommand(LPSHELLVIEW this,DWORD dwCmdID, DWORD dwCmd, HWND32 hwndCmd) -{ TRACE(shell,"(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",this, dwCmdID, dwCmd, hwndCmd); - switch(dwCmdID) - { case IDM_VIEW_FILES: - g_bViewKeys = ! g_bViewKeys; - IShellView_Refresh(this); - break; - - case IDM_VIEW_IDW: - g_bShowIDW = ! g_bShowIDW; - ShellView_AddRemoveDockingWindow(this, g_bShowIDW); - break; - - case IDM_MYFILEITEM: - MessageBeep32(MB_OK); - break; - } - return 0; -} /************************************************************************** * ShellView_CanDoIDockingWindow() */ @@ -590,12 +574,12 @@ LRESULT ShellView_UpdateMenu(LPSHELLVIEW this, HMENU32 hMenu) CheckMenuItem32(hMenu, IDM_VIEW_FILES, MF_BYCOMMAND | (g_bViewKeys ? MF_CHECKED: MF_UNCHECKED)); if(ShellView_CanDoIDockingWindow(this)) - { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_ENABLED); - CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | (g_bShowIDW ? MF_CHECKED: MF_UNCHECKED)); + { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_ENABLED); + CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | (g_bShowIDW ? MF_CHECKED: MF_UNCHECKED)); } else { EnableMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); - CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_UNCHECKED); + CheckMenuItem32(hMenu, IDM_VIEW_IDW, MF_BYCOMMAND | MF_UNCHECKED); } return 0; } @@ -604,7 +588,7 @@ LRESULT ShellView_UpdateMenu(LPSHELLVIEW this, HMENU32 hMenu) * ShellView_UpdateShellSettings() **************************************************************************/ -typedef void (WINAPI *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); +typedef void (CALLBACK *PFNSHGETSETTINGSPROC)(LPSHELLFLAGSTATE lpsfs, DWORD dwMask); void ShellView_UpdateShellSettings(LPSHELLVIEW this) @@ -664,202 +648,239 @@ LRESULT ShellView_OnSettingChange(LPSHELLVIEW this, LPCSTR lpszSection) * ShellView_DoContextMenu() */ void ShellView_DoContextMenu(LPSHELLVIEW this, WORD x, WORD y, BOOL32 fDefault) -{ UINT32 uSelected = ListView_GetSelectedCount(this->hWndList); +{ UINT32 uCommand, i, uSelected = ListView_GetSelectedCount(this->hWndList); + HMENU32 hMenu; + BOOL32 fExplore = FALSE; + HWND32 hwndTree = 0; + INT32 nMenuIndex; LPITEMIDLIST *aSelectedItems; - UINT32 i; - LPCONTEXTMENU pContextMenu = NULL; - LVITEM lvItem; - UINT32 uCommand; + LVITEM32A lvItem; MENUITEMINFO32A mii; - int nMenuIndex; - CMINVOKECOMMANDINFO cmi; - + LPCONTEXTMENU pContextMenu = NULL; + CMINVOKECOMMANDINFO32 cmi; + TRACE(shell,"(%p)->(0x%08x 0x%08x 0x%08x) stub\n",this, x, y, fDefault); aSelectedItems = (LPITEMIDLIST*)SHAlloc(uSelected * sizeof(LPITEMIDLIST)); if(aSelectedItems) - { ZeroMemory(&lvItem, sizeof(lvItem)); + { TRACE(shell,"-- aSelectedItems\n"); + ZeroMemory(&lvItem, sizeof(lvItem)); lvItem.mask = LVIF_STATE | LVIF_PARAM; lvItem.stateMask = LVIS_SELECTED; lvItem.iItem = 0; i = 0; - while(ListView_GetItem(this->hWndList, &lvItem) && (i < uSelected)) - { if(lvItem.state & LVIS_SELECTED) - { aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam; - i++; - } - lvItem.iItem++; - } + while(ListView_GetItem32A(this->hWndList, &lvItem) && (i < uSelected)) + { if(lvItem.state & LVIS_SELECTED) + { aSelectedItems[i] = (LPITEMIDLIST)lvItem.lParam; + i++; + } + lvItem.iItem++; + } this->pSFParent->lpvtbl->fnGetUIObjectOf(this->pSFParent, this->hWndParent, uSelected, (LPCITEMIDLIST*)aSelectedItems, &IID_IContextMenu, NULL,(LPVOID*)&pContextMenu); if(pContextMenu) - { HMENU32 hMenu = CreatePopupMenu32(); + { TRACE(shell,"-- pContextMenu\n"); + hMenu = CreatePopupMenu32(); /* See if we are in Explore or Open mode. If the browser's tree is present, then we are in Explore mode.*/ - BOOL32 fExplore = FALSE; - HWND32 hwndTree = 0; - if(S_OK==(this->pShellBrowser->lpvtbl->fnGetControlWindow(this->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree) - { fExplore = TRUE; - } + fExplore = FALSE; + hwndTree = 0; + if(SUCCEEDED(this->pShellBrowser->lpvtbl->fnGetControlWindow(this->pShellBrowser,FCW_TREE, &hwndTree)) && hwndTree) + { TRACE(shell,"-- fExplore\n"); + fExplore = TRUE; + } - if(hMenu && S_OK==(pContextMenu->lpvtbl->fnQueryContextMenu(pContextMenu, + if(hMenu && SUCCEEDED(pContextMenu->lpvtbl->fnQueryContextMenu(pContextMenu, hMenu,0,MENU_OFFSET,MENU_MAX,CMF_NORMAL | - (uSelected != 1 ? 0 : CMF_CANRENAME) | (fExplore ? CMF_EXPLORE : 0)))) - { if(fDefault) - { uCommand = 0; + (uSelected != 1 ? 0 : CMF_CANRENAME) | + (fExplore ? CMF_EXPLORE : 0)))) + { if(fDefault) + { TRACE(shell,"-- fDefault\n"); + uCommand = 0; - ZeroMemory(&mii, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STATE | MIIM_ID; + ZeroMemory(&mii, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STATE | MIIM_ID; - nMenuIndex = 0; + nMenuIndex = 0; - //find the default item in the menu - while(GetMenuItemInfo32A(hMenu, nMenuIndex, TRUE, &mii)) - { if(mii.fState & MFS_DEFAULT) - { uCommand = mii.wID; - break; - } - nMenuIndex++; - } - } - else - { uCommand = TrackPopupMenu32( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,this->hWnd,NULL); - } + /*find the default item in the menu*/ + while(GetMenuItemInfo32A(hMenu, nMenuIndex, TRUE, &mii)) + { if(mii.fState & MFS_DEFAULT) + { uCommand = mii.wID; + break; + } + nMenuIndex++; + } + } + else + { TRACE(shell,"-- ! fDefault\n"); + uCommand = TrackPopupMenu32( hMenu,TPM_LEFTALIGN | TPM_RETURNCMD,x,y,0,this->hWnd,NULL); + } - if(uCommand > 0) - { ZeroMemory(&cmi, sizeof(cmi)); - cmi.cbSize = sizeof(cmi); - cmi.hwnd = this->hWndParent; - cmi.lpVerb = (LPCSTR)MAKEINTRESOURCE32A(uCommand - MENU_OFFSET); - pContextMenu->lpvtbl->fnInvokeCommand(pContextMenu, &cmi); - } - DestroyMenu32(hMenu); - } - pContextMenu->lpvtbl->fnRelease(pContextMenu); - } - SHFree(aSelectedItems); + if(uCommand > 0) + { TRACE(shell,"-- ! uCommand\n"); + ZeroMemory(&cmi, sizeof(cmi)); + cmi.cbSize = sizeof(cmi); + cmi.hwnd = this->hWndParent; + cmi.lpVerb = (LPCSTR)MAKEINTRESOURCE32A(uCommand - MENU_OFFSET); + pContextMenu->lpvtbl->fnInvokeCommand(pContextMenu, &cmi); + } + DestroyMenu32(hMenu); + } + pContextMenu->lpvtbl->fnRelease(pContextMenu); + } + SHFree(aSelectedItems); } } +/************************************************************************** +* ShellView_OnCommand() +*/ +LRESULT ShellView_OnCommand(LPSHELLVIEW this,DWORD dwCmdID, DWORD dwCmd, HWND32 hwndCmd) +{ TRACE(shell,"(%p)->(0x%08lx 0x%08lx 0x%08x) stub\n",this, dwCmdID, dwCmd, hwndCmd); + switch(dwCmdID) + { case IDM_VIEW_FILES: + g_bViewKeys = ! g_bViewKeys; + IShellView_Refresh(this); + break; + + case IDM_VIEW_IDW: + g_bShowIDW = ! g_bShowIDW; + ShellView_AddRemoveDockingWindow(this, g_bShowIDW); + break; + + case IDM_MYFILEITEM: + MessageBeep32(MB_OK); + break; + + default: + FIXME(shell,"-- unknown command\n"); + } + return 0; +} + /************************************************************************** * ShellView_OnNotify() */ LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh) -{ NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh; - LV_DISPINFO *lpdi = (LV_DISPINFO *)lpnmh; - LPITEMIDLIST pidl; - DWORD dwCursor; - STRRET str; - UINT32 uFlags; - IExtractIcon *pei; +{ NM_LISTVIEW *lpnmlv = (NM_LISTVIEW*)lpnmh; + NMLVDISPINFO32A *lpdi = (NMLVDISPINFO32A *)lpnmh; + LPITEMIDLIST pidl; + DWORD dwCursor; + STRRET str; + UINT32 uFlags; + IExtractIcon *pei; - TRACE(shell,"%p CtlID=%u lpnmh->code=%x\n",this,CtlID,lpnmh->code); + TRACE(shell,"%p CtlID=%u lpnmh->code=%x\n",this,CtlID,lpnmh->code); - switch(lpnmh->code) - { case NM_SETFOCUS: - TRACE(shell,"NM_SETFOCUS %p\n",this); - ShellView_OnSetFocus(this); - break; + switch(lpnmh->code) + { case NM_SETFOCUS: + TRACE(shell,"NM_SETFOCUS %p\n",this); + ShellView_OnSetFocus(this); + break; - case NM_KILLFOCUS: - TRACE(shell,"NM_KILLFOCUS %p\n",this); - ShellView_OnDeactivate(this); - break; + case NM_KILLFOCUS: + TRACE(shell,"NM_KILLFOCUS %p\n",this); + ShellView_OnDeactivate(this); + break; - case HDN_ENDTRACK: - TRACE(shell,"HDN_ENDTRACK %p\n",this); - /*nColumn1 = ListView_GetColumnWidth(this->hWndList, 0); - nColumn2 = ListView_GetColumnWidth(this->hWndList, 1);*/ - return 0; + case HDN_ENDTRACK32A: + TRACE(shell,"HDN_ENDTRACK32A %p\n",this); + /*nColumn1 = ListView_GetColumnWidth(this->hWndList, 0); + nColumn2 = ListView_GetColumnWidth(this->hWndList, 1);*/ + return 0; - case LVN_DELETEITEM: - TRACE(shell,"LVN_DELETEITEM %p\n",this); - SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ - break; + case LVN_DELETEITEM: + TRACE(shell,"LVN_DELETEITEM %p\n",this); + SHFree((LPITEMIDLIST)lpnmlv->lParam); /*delete the pidl because we made a copy of it*/ + break; #ifdef LVN_ITEMACTIVATE - case LVN_ITEMACTIVATE: - -#else //LVN_ITEMACTIVATE - case NM_DBLCLK: - case NM_RETURN: -#endif //LVN_ITEMACTIVATE - TRACE(shell,"LVN_ITEMACTIVATE | NM_RETURN %p\n",this); - ShellView_DoContextMenu(this, 0, 0, TRUE); - return 0; + case LVN_ITEMACTIVATE: +#else + case NM_DBLCLK: + case NM_RETURN: +#endif + TRACE(shell,"LVN_ITEMACTIVATE | NM_RETURN %p\n",this); + ShellView_DoContextMenu(this, 0, 0, TRUE); + return 0; - case LVN_GETDISPINFO: - TRACE(shell,"LVN_GETDISPINFO %p\n",this); - pidl = (LPITEMIDLIST)lpdi->item.lParam; + case NM_RCLICK: + TRACE(shell,"NM_RCLICK %p\n",this); + dwCursor = GetMessagePos(); + ShellView_DoContextMenu(this, LOWORD(dwCursor), HIWORD(dwCursor), FALSE); + + case LVN_GETDISPINFO32A: + TRACE(shell,"LVN_GETDISPINFO32A %p\n",this); + pidl = (LPITEMIDLIST)lpdi->item.lParam; - if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ - { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ - { if(PidlMgr_IsValue(NULL,pidl)) /*is this a value or a folder?*/ - { PidlMgr_GetDataText(NULL,this->mpidl, pidl, lpdi->item.pszText, lpdi->item.cchTextMax); - if(!*lpdi->item.pszText) - sprintf(lpdi->item.pszText, "file attrib %u", lpdi->item.iSubItem ); - } - else /*its a folder*/ - { sprintf(lpdi->item.pszText, "folder attrib %u", lpdi->item.iSubItem ); - } - } - } - else /*the item text is being requested*/ - { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ - { if(S_OK==this->pSFParent->lpvtbl->fnGetDisplayNameOf(this->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str)) - { if(STRRET_WSTR == str.uType) - { WideCharToLocal32(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax); - SHFree(str.u.pOleStr); - } - if(STRRET_CSTR == str.uType) - { strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax); - } - } - } + if(lpdi->item.iSubItem) /*is the sub-item information being requested?*/ + { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ + { if(_ILIsValue(pidl)) /*is this a value or a folder?*/ + { _ILGetDataText(this->mpidl, pidl, lpdi->item.pszText, lpdi->item.cchTextMax); + if(!*lpdi->item.pszText) + sprintf(lpdi->item.pszText, "file attrib %u", lpdi->item.iSubItem ); + } + else /*its a folder*/ + { sprintf(lpdi->item.pszText, "folder attrib %u", lpdi->item.iSubItem ); + } + } + } + else /*the item text is being requested*/ + { if(lpdi->item.mask & LVIF_TEXT) /*is the text being requested?*/ + { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetDisplayNameOf(this->pSFParent,pidl, SHGDN_NORMAL | SHGDN_INFOLDER, &str))) + { if(STRRET_WSTR == str.uType) + { WideCharToLocal32(lpdi->item.pszText, str.u.pOleStr, lpdi->item.cchTextMax); + SHFree(str.u.pOleStr); + } + if(STRRET_CSTR == str.uType) + { strncpy(lpdi->item.pszText, str.u.cStr, lpdi->item.cchTextMax); + } + } + } - if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/ - { if(S_OK == (this->pSFParent->lpvtbl->fnGetUIObjectOf(this->pSFParent,this->hWnd,1, - (LPCITEMIDLIST*)&pidl, (REFIID)&IID_IExtractIcon, NULL, (LPVOID*)&pei))) - { //GetIconLoaction will give us the index into our image list - pei->lpvtbl->fnGetIconLocation(pei, GIL_FORSHELL, NULL, 0, &lpdi->item.iImage, &uFlags); - pei->lpvtbl->fnRelease(pei); - } - } - } - TRACE(shell,"-- text=%s image=%x\n",lpdi->item.pszText, lpdi->item.iImage); - return 0; + if(lpdi->item.mask & LVIF_IMAGE) /*is the image being requested?*/ + { if(SUCCEEDED(this->pSFParent->lpvtbl->fnGetUIObjectOf(this->pSFParent,this->hWnd,1, + (LPCITEMIDLIST*)&pidl, (REFIID)&IID_IExtractIcon, NULL, (LPVOID*)&pei))) + { //GetIconLoaction will give us the index into our image list + pei->lpvtbl->fnGetIconLocation(pei, GIL_FORSHELL, NULL, 0, &lpdi->item.iImage, &uFlags); + pei->lpvtbl->fnRelease(pei); + } + } + } + TRACE(shell,"-- text=%s image=%x\n",lpdi->item.pszText, lpdi->item.iImage); + return 0; - case NM_RCLICK: - TRACE(shell,"NM_RCLICK %p\n",this); - dwCursor = GetMessagePos(); - ShellView_DoContextMenu(this, LOWORD(dwCursor), HIWORD(dwCursor), FALSE); + case NM_CLICK: + TRACE(shell,"NM_CLICK %p\n",this); + break; - case NM_CLICK: - TRACE(shell,"NM_CLICK %p\n",this); - break; + case LVN_ITEMCHANGING: + TRACE(shell,"LVN_ITEMCHANGING %p\n",this); + break; - case LVN_ITEMCHANGING: - TRACE(shell,"LVN_ITEMCHANGING %p\n",this); - break; + case LVN_ITEMCHANGED: + TRACE(shell,"LVN_ITEMCHANGED %p\n",this); + break; - case NM_CUSTOMDRAW: - TRACE(shell,"NM_CUSTOMDRAW %p\n",this); - break; + case NM_CUSTOMDRAW: + TRACE(shell,"NM_CUSTOMDRAW %p\n",this); + break; - default: - WARN (shell,"-- WM_NOTIFY unhandled\n"); - return 0; - } - return 0; + default: + WARN (shell,"-- WM_NOTIFY unhandled\n"); + return 0; + } + return 0; } /************************************************************************** @@ -875,7 +896,8 @@ LRESULT ShellView_OnNotify(LPSHELLVIEW this, UINT32 CtlID, LPNMHDR lpnmh) LRESULT CALLBACK ShellView_WndProc(HWND32 hWnd, UINT32 uMessage, WPARAM32 wParam, LPARAM lParam) { LPSHELLVIEW pThis = (LPSHELLVIEW)GetWindowLong32A(hWnd, GWL_USERDATA); LPCREATESTRUCT32A lpcs; - + DWORD dwCursor; + FIXME(shell,"(hwnd=%x msg=%x wparm=%x lparm=%lx)\n",hWnd, uMessage, wParam, lParam); switch (uMessage) @@ -970,6 +992,11 @@ LRESULT CALLBACK ShellView_WndProc(HWND32 hWnd, UINT32 uMessage, WPARAM32 wParam case WM_PARENTNOTIFY: TRACE(shell,"WM_PARENTNOTIFY\n"); + if ( LOWORD(wParam) == WM_RBUTTONDOWN ) /* fixme: should not be handled here*/ + { dwCursor = GetMessagePos(); + ShellView_DoContextMenu(pThis, LOWORD(dwCursor), HIWORD(dwCursor), FALSE); + return TRUE; + } break; case WM_MOUSEACTIVATE: @@ -1033,7 +1060,7 @@ static ULONG WINAPI IShellView_Release(LPSHELLVIEW this) return this->ref; } /************************************************************************** -* IShellView::GetWindow +* ShellView_GetWindow */ static HRESULT WINAPI IShellView_GetWindow(LPSHELLVIEW this,HWND32 * phWnd) { TRACE(shell,"(%p) stub\n",this); @@ -1045,9 +1072,19 @@ static HRESULT WINAPI IShellView_ContextSensitiveHelp(LPSHELLVIEW this,BOOL32 fE { FIXME(shell,"(%p) stub\n",this); return E_NOTIMPL; } +/************************************************************************** +* IShellView_TranslateAccelerator +* +* FIXME: +* use the accel functions +*/ static HRESULT WINAPI IShellView_TranslateAccelerator(LPSHELLVIEW this,LPMSG32 lpmsg) -{ FIXME(shell,"(%p)->(%p) stub\n",this,lpmsg); - return E_NOTIMPL; +{ FIXME(shell,"(%p)->(%p: hwnd=%x msg=%x lp=%lx wp=%x) stub\n",this,lpmsg, lpmsg->hwnd, lpmsg->message, lpmsg->lParam, lpmsg->wParam); +/* switch (lpmsg->message) + { case WM_RBUTTONDOWN: + return SendMessage32A ( lpmsg->hwnd, WM_NOTIFY, ); + }*/ + return S_FALSE; } static HRESULT WINAPI IShellView_EnableModeless(LPSHELLVIEW this,BOOL32 fEnable) { FIXME(shell,"(%p) stub\n",this); @@ -1151,7 +1188,7 @@ static HRESULT WINAPI IShellView_DestroyViewWindow(LPSHELLVIEW this) IShellView_UIActivate(this, SVUIA_DEACTIVATE); if(this->hMenu) { DestroyMenu32(this->hMenu); - } + } DestroyWindow32(this->hWnd); this->pShellBrowser->lpvtbl->fnRelease(this->pShellBrowser); return S_OK; diff --git a/documentation/common_controls b/documentation/common_controls index 43b44305727..69c2c9f9299 100644 --- a/documentation/common_controls +++ b/documentation/common_controls @@ -29,19 +29,29 @@ ----------- This paragraph describes the development status of the common controls. - - 3.1 Animation Control --------------------- + Author: + Dummy written by Eric Kohl. + Status: - - Nothing done at all. + - Dummy control. No functionality. + + Notes: + Author needed!! Any volunteers?? 3.2 Combo Box Ex Control ------------------------ + Author: + Dummy written by Eric Kohl. + Status: - - Nothing done at all. + - Dummy control. No functionality. + + Notes: + Author needed!! Any volunteers?? 3.3 Date and Time Picker Control @@ -49,18 +59,27 @@ Status: - Nothing done at all. + Notes: + Author needed!! Any volunteers?? + 3.4 Drag List Box Control ------------------------- Status: - Nothing done at all. + Notes: + Author needed!! Any volunteers?? + 3.5 Flat Scroll Bar Control --------------------------- Status: - Nothing done at all. + Notes: + Author needed!! Any volunteers?? + 3.6 Header Control ------------------ @@ -73,8 +92,14 @@ 3.7 Hot Key Control ------------------- + Author: + Dummy written by Eric Kohl. + Status: - - Nothing done at all. + Dummy control. No functionality. + + Notes: + Author needed!! Any volunteers?? 3.8 Image List (no control) @@ -96,21 +121,30 @@ Status: - Nothing done at all. + Notes: + Author needed!! Any volunteers?? + 3.10 List View Control ---------------------- Author: - James Michael Mastros + Dummy written by Eric Kohl. Status: - Development in progress. + Notes: + Author needed!! Any volunteers?? + 3.11 Month Calendar Control --------------------------- Status: - Nothing done at all. + Notes: + Author needed!! Any volunteers?? + 3.12 Pager Control ------------------ @@ -217,13 +251,11 @@ 3.20 Trackbar Control --------------------- Author: - Dummy written by Eric Kohl. + Dummy written by Eric Kohl + Alex Priem (alexp@sci.kun.nl) Status: - - Dummy control. No functionality. - - Notes: - Author needed!! Any volunteers?? + Under construction. 3.21 Tree View Control @@ -233,7 +265,7 @@ Alex Priem (alexp@sci.kun.nl) Status: - - Dummy control. No functionality. + Under contstruction. 3.22 Updown Control @@ -266,16 +298,16 @@ ------------------------ There are quite a lot of undocumented functions like: - - DSA (Dynnamic Structure Array) functions. - - DPA (Dymnamic Pointer Array?) functions. + - DSA (Dynnamic Storage Array) functions. + - DPA (Dymnamic Pointer Array) functions. - MRU ("Most Recently Used" List) functions. - other unknown functions. Have a look at relay32/comctl32.spec. -5.1 Dymnamic Structure Arrays (DSA) ------------------------------------- +5.1 Dymnamic Storage 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. diff --git a/documentation/filehandles b/documentation/filehandles index d002e4a3213..b0575963b6d 100644 --- a/documentation/filehandles +++ b/documentation/filehandles @@ -14,13 +14,18 @@ The macros are defined in file.h as follows.: (((handle)==0) ? GetStdHandle(STD_INPUT_HANDLE) : \ ((handle)==1) ? GetStdHandle(STD_OUTPUT_HANDLE) : \ ((handle)==2) ? GetStdHandle(STD_ERROR_HANDLE) : \ + ((handle)>0x400) ? handle : \ (handle)-5) #define HFILE32_TO_HFILE16(handle) ({ HFILE32 hnd=handle; \ ((hnd==HFILE_ERROR32) ? HFILE_ERROR16 : \ + ((handle>0x400) ? handle : \ (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. + +NOTE: The 0x400 special case above deals with LZW filehandles (see +misc/lzexpand.c). diff --git a/documentation/shell32 b/documentation/shell32 index 4fcb2ef522c..676486abd15 100644 --- a/documentation/shell32 +++ b/documentation/shell32 @@ -27,6 +27,12 @@ implemented the classes and filled function stubs. ---------------- Status: - development started + + Undocumented: + word95 gets a IContextMenu Interface and calls HandleMenuMsg() + whitch should only a member of IContextMenu2. + I suppose IContextMenu and IContextMenu2/3 are using the same vtable + and are in effect the same. 4.2 IShellExtInit ----------------- @@ -60,12 +66,20 @@ implemented the classes and filled function stubs. 4.7. PIDL Manager ----------------- Status: - - roughly complete will be migrated to a set of functions because it's + - roughly complete will be migrated to a set of functions because it's not holding any instance data, + Undocumented: + MS says: the abID of SHITEMID should be treated as binary data and not + be interpreted by applications. Applys to everyone but MS itself. + Word95 interprets the contents of abID (Filesize/Date) so we have to go + for binary compatibility here. + I expect the file open/close dialog in comctl32 does so also. + 5. Structures ------------- 5.1 PIDL -------- + diff --git a/files/dos_fs.c b/files/dos_fs.c index fd168c4fee1..f662eac0ca1 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -320,6 +320,10 @@ static DOS_DIR *DOSFS_OpenDir( LPCSTR path ) return NULL; } + /* Treat empty path as root directory. This simplifies path split into + directory and mask in several other places */ + if (!*path) path = "/"; + #ifdef VFAT_IOCTL_READDIR_BOTH /* Check if the VFAT ioctl is supported on this directory */ @@ -609,7 +613,7 @@ HFILE32 DOSFS_OpenDevice( const char *name, int unixmode ) FILE_OBJECT *file; HFILE32 handle; - if (!name) return NULL; /* if FILE_DupUnixHandle was used */ + if (!name) return (HFILE32)NULL; /* if FILE_DupUnixHandle was used */ if (name[0] && (name[1] == ':')) name += 2; if ((p = strrchr( name, '/' ))) name = p + 1; if ((p = strrchr( name, '\\' ))) name = p + 1; @@ -624,18 +628,24 @@ HFILE32 DOSFS_OpenDevice( const char *name, int unixmode ) if (!strcmp(DOSFS_Devices[i].name,"NUL")) return FILE_OpenUnixFile("/dev/null",unixmode); if (!strcmp(DOSFS_Devices[i].name,"CON")) { + HFILE32 to_dup; + HFILE32 handle; switch (unixmode) { case O_RDONLY: - return GetStdHandle( STD_INPUT_HANDLE ); + to_dup = GetStdHandle( STD_INPUT_HANDLE ); break; case O_WRONLY: - return GetStdHandle( STD_OUTPUT_HANDLE ); + to_dup = GetStdHandle( STD_OUTPUT_HANDLE ); break; default: FIXME(dosfs,"can't open CON read/write\n"); return HFILE_ERROR32; break; } + if (!DuplicateHandle( GetCurrentProcess(), to_dup, GetCurrentProcess(), + &handle, 0, FALSE, DUPLICATE_SAME_ACCESS )) + handle = HFILE_ERROR32; + return handle; } if (!strcmp(DOSFS_Devices[i].name,"SCSIMGR$")) { if ((handle = FILE_Alloc( &file )) == INVALID_HANDLE_VALUE32) @@ -1166,19 +1176,19 @@ int DOSFS_FindNext( const char *path, const char *short_mask, /* Skip to desired position */ while (info.cur_pos < skip) - if (DOSFS_ReadDir( info.dir, &long_name, &short_name )) + if (info.dir && DOSFS_ReadDir( info.dir, &long_name, &short_name )) info.cur_pos++; else break; - if (info.cur_pos == skip && DOSFS_FindNextEx( &info, entry )) + if (info.dir && info.cur_pos == skip && DOSFS_FindNextEx( &info, entry )) count = info.cur_pos - skip; else count = 0; if (!count) { - DOSFS_CloseDir( info.dir ); + if (info.dir) DOSFS_CloseDir( info.dir ); memset( &info, '\0', sizeof(info) ); } diff --git a/files/drive.c b/files/drive.c index fa813aff7ac..0fa08c5064a 100644 --- a/files/drive.c +++ b/files/drive.c @@ -784,7 +784,7 @@ UINT32 WINAPI GetDriveType32A( LPCSTR root ) case TYPE_HD: return DRIVE_FIXED; case TYPE_CDROM: return DRIVE_CDROM; case TYPE_NETWORK: return DRIVE_REMOTE; - case TYPE_INVALID: + case TYPE_INVALID: return DRIVE_DOESNOTEXIST; default: return DRIVE_CANNOTDETERMINE; } } @@ -1040,3 +1040,8 @@ BOOL32 WINAPI GetVolumeInformation32W( LPCWSTR root, LPWSTR label, HeapFree( GetProcessHeap(), 0, xfsname ); return ret; } + +BOOL32 WINAPI SetVolumeLabel32A(LPCSTR rootpath,LPCSTR volname) { + FIXME(dosfs,"(%s,%s),stub!\n",rootpath,volname); + return TRUE; +} diff --git a/files/file.c b/files/file.c index a2bd5dd3f98..205c63088c4 100644 --- a/files/file.c +++ b/files/file.c @@ -87,6 +87,7 @@ HFILE32 FILE_Alloc( FILE_OBJECT **file ) (*file)->unix_handle = -1; (*file)->unix_name = NULL; (*file)->type = FILE_TYPE_DISK; + (*file)->pos = 0; handle = HANDLE_Alloc( PROCESS_Current(), &(*file)->header, FILE_ALL_ACCESS | GENERIC_READ | @@ -112,7 +113,8 @@ static BOOL32 FILE_Read(K32OBJ *ptr, LPVOID lpBuffer, DWORD nNumberOfChars, return TRUE; } - if ((result = read(file->unix_handle, lpBuffer, nNumberOfChars)) == -1) + if ( (file->pos < 0) || /* workaround, see SetFilePointer */ + ((result = read(file->unix_handle, lpBuffer, nNumberOfChars)) == -1) ) { FILE_SetDosError(); return FALSE; @@ -144,6 +146,11 @@ static BOOL32 FILE_Write(K32OBJ *ptr, LPCVOID lpBuffer, DWORD nNumberOfChars, * win32 doesn't have interrupted system calls */ + if (file->pos < 0) { /* workaround, see SetFilePointer */ + FILE_SetDosError(); + return FALSE; + } + for (;;) { result = write(file->unix_handle, lpBuffer, nNumberOfChars); @@ -871,6 +878,7 @@ error: /* We get here if there was an error opening the file */ */ HFILE16 WINAPI OpenFile16( LPCSTR name, OFSTRUCT *ofs, UINT16 mode ) { + TRACE(file,"OpenFile16(%s,%i)\n", name, mode); return HFILE32_TO_HFILE16(FILE_DoOpenFile( name, ofs, mode, FALSE )); } @@ -999,7 +1007,7 @@ DWORD WINAPI SetFilePointer( HFILE32 hFile, LONG distance, LONG *highword, DWORD method ) { FILE_OBJECT *file; - int origin, result; + DWORD result = 0xffffffff; if (highword && *highword) { @@ -1008,28 +1016,56 @@ DWORD WINAPI SetFilePointer( HFILE32 hFile, LONG distance, LONG *highword, return 0xffffffff; } TRACE(file, "handle %d offset %ld origin %ld\n", - hFile, distance, method ); + hFile, distance, method ); if (!(file = FILE_GetFile( hFile ))) return 0xffffffff; + + + /* the pointer may be positioned before the start of the file; + no error is returned in that case, + but subsequent attempts at I/O will produce errors. + This is not allowed with Unix lseek(), + so we'll need some emulation here */ switch(method) { - case FILE_CURRENT: origin = SEEK_CUR; break; - case FILE_END: origin = SEEK_END; break; - default: origin = SEEK_SET; break; + case FILE_CURRENT: + distance += file->pos; /* fall through */ + case FILE_BEGIN: + if ((result = lseek(file->unix_handle, distance, SEEK_SET)) == -1) + { + if ((INT32)distance < 0) + file->pos = result = distance; + } + else + file->pos = result; + break; + case FILE_END: + if ((result = lseek(file->unix_handle, distance, SEEK_END)) == -1) + { + if ((INT32)distance < 0) + { + /* get EOF */ + result = lseek(file->unix_handle, 0, SEEK_END); + + /* return to the old pos, as the first lseek failed */ + lseek(file->unix_handle, file->pos, SEEK_END); + + file->pos = (result += distance); + } + else + ERR(file, "lseek: unknown error. Please report.\n"); + } + else file->pos = result; + break; + default: + ERR(file, "Unknown origin %ld !\n", method); } - if ((result = lseek( file->unix_handle, distance, origin )) == -1) - { - /* care for this pathological case: - SetFilePointer(00000006,ffffffff,00000000,00000002) - ret=0062ab4a fs=01c7 */ - if ((distance != -1)) + if (result == -1) FILE_SetDosError(); - else - result = 0; - } + FILE_ReleaseFile( file ); - return (DWORD)result; + return result; } @@ -1665,7 +1701,7 @@ BOOL32 WINAPI CopyFile32W( LPCWSTR source, LPCWSTR dest, BOOL32 fail_if_exists) /*********************************************************************** - * SetFileTime (KERNEL32.493) + * SetFileTime (KERNEL32.650) */ BOOL32 WINAPI SetFileTime( HFILE32 hFile, const FILETIME *lpCreationTime, @@ -1676,7 +1712,7 @@ BOOL32 WINAPI SetFileTime( HFILE32 hFile, struct utimbuf utimbuf; if (!file) return FILE_TYPE_UNKNOWN; /* FIXME: correct? */ - TRACE(file,"(%s,%p,%p,%p)\n", + TRACE(file,"('%s',%p,%p,%p)\n", file->unix_name, lpCreationTime, lpLastAccessTime, @@ -1692,6 +1728,7 @@ BOOL32 WINAPI SetFileTime( HFILE32 hFile, utimbuf.modtime = 0; /* FIXME */ if (-1==utime(file->unix_name,&utimbuf)) { + MSG("Couldn't set the time for file '%s'. Insufficient permissions !?\n", file->unix_name); FILE_ReleaseFile( file ); FILE_SetDosError(); return FALSE; diff --git a/files/profile.c b/files/profile.c index 49b58d79add..e9215132502 100644 --- a/files/profile.c +++ b/files/profile.c @@ -951,6 +951,19 @@ INT32 WINAPI GetProfileSection32A( LPCSTR section, LPSTR buffer, DWORD len ) } +/*********************************************************************** + * GetProfileSection32W (KERNEL32) + */ +INT32 WINAPI GetProfileSection32W( LPCWSTR section, LPWSTR buffer, DWORD len ) +{ + if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini" ); + return GetPrivateProfileSection32W( section, buffer, len, wininiW ); +} + + + + + /*********************************************************************** * WriteProfileString16 (KERNEL.59) */ @@ -1089,6 +1102,25 @@ INT32 WINAPI GetPrivateProfileSection32A( LPCSTR section, LPSTR buffer, return 0; } +/*********************************************************************** + * GetPrivateProfileSection32W (KERNEL32.256) + */ + +INT32 WINAPI GetPrivateProfileSection32W (LPCWSTR section, LPWSTR buffer, + DWORD len, LPCWSTR filename ) + +{ + LPSTR sectionA = HEAP_strdupWtoA( GetProcessHeap(), 0, section ); + LPSTR filenameA = HEAP_strdupWtoA( GetProcessHeap(), 0, filename ); + LPSTR bufferA = HeapAlloc( GetProcessHeap(), 0, len ); + INT32 ret = GetPrivateProfileSection32A( sectionA, bufferA, len, + filenameA ); + HeapFree( GetProcessHeap(), 0, sectionA ); + HeapFree( GetProcessHeap(), 0, filenameA ); + HeapFree( GetProcessHeap(), 0, bufferA); + return ret; +} + /*********************************************************************** * WritePrivateProfileString16 (KERNEL.129) */ @@ -1136,7 +1168,7 @@ BOOL32 WINAPI WritePrivateProfileSection32A( LPCSTR section, { char *p =(char*)string; - FIXME(profile, "WritePrivateProfileSection32A empty stup\n"); + FIXME(profile, "WritePrivateProfileSection32A empty stub\n"); if (TRACE_ON(profile)) { TRACE(profile, "(%s) => [%s]\n", filename, section); while (*(p+1)) { @@ -1149,6 +1181,43 @@ BOOL32 WINAPI WritePrivateProfileSection32A( LPCSTR section, return FALSE; } +/*********************************************************************** + * WritePrivateProfileSection32W (KERNEL32) + */ +BOOL32 WINAPI WritePrivateProfileSection32W( LPCWSTR section, + LPCWSTR string, LPCWSTR filename) + +{ + LPSTR sectionA = HEAP_strdupWtoA( GetProcessHeap(), 0, section ); + LPSTR stringA = HEAP_strdupWtoA( GetProcessHeap(), 0, string ); + LPSTR filenameA = HEAP_strdupWtoA( GetProcessHeap(), 0, filename ); + BOOL32 res = WritePrivateProfileSection32A( sectionA, stringA, filenameA ); + HeapFree( GetProcessHeap(), 0, sectionA ); + HeapFree( GetProcessHeap(), 0, stringA ); + HeapFree( GetProcessHeap(), 0, filenameA ); + return res; +} + + +/*********************************************************************** + * WriteProfileSection32A (KERNEL32.747) + */ +BOOL32 WINAPI WriteProfileSection32A( LPCSTR section, LPCSTR keys_n_values) + +{ + return WritePrivateProfileSection32A( section, keys_n_values, "win.ini"); +} + +/*********************************************************************** + * WriteProfileSection32W (KERNEL32.748) + */ +BOOL32 WINAPI WriteProfileSection32W( LPCWSTR section, LPCWSTR keys_n_values) +{ + if (!wininiW) wininiW = HEAP_strdupAtoW( SystemHeap, 0, "win.ini"); + + return (WritePrivateProfileSection32W (section,keys_n_values, wininiW)); +} + /*********************************************************************** * GetPrivateProfileSectionNames16 (KERNEL.143) */ @@ -1182,6 +1251,45 @@ WORD WINAPI GetPrivateProfileSectionNames16( LPSTR buffer, WORD size, } +/*********************************************************************** + * GetProfileSectionNames16 (KERNEL.142) + */ +WORD WINAPI GetProfileSectionNames16( LPSTR buffer, WORD size) + +{ + return (GetPrivateProfileSectionNames16 (buffer,size,"win.ini")); +} + + +/*********************************************************************** + * GetPrivateProfileSectionNames32A (KERNEL32.365) + */ +DWORD WINAPI GetPrivateProfileSectionNames32A( LPSTR buffer, DWORD size, + LPCSTR filename) + +{ + return (GetPrivateProfileSectionNames16 (buffer,size,filename)); +} + + +/*********************************************************************** + * GetPrivateProfileSectionNames32W (KERNEL32.366) + */ +DWORD WINAPI GetPrivateProfileSectionNames32W( LPWSTR buffer, DWORD size, + LPCWSTR filename) + +{ + LPSTR filenameA = HEAP_strdupWtoA( GetProcessHeap(), 0, filename ); + LPSTR bufferA = HeapAlloc( GetProcessHeap(), 0, size); + + INT32 ret = GetPrivateProfileSectionNames16 (bufferA, size, filenameA); + lstrcpynAtoW( buffer, bufferA, size); + HeapFree( GetProcessHeap(), 0, bufferA); + HeapFree( GetProcessHeap(), 0, filenameA ); + + return ret; +} + /*********************************************************************** * GetPrivateProfileStruct32A (KERNEL32.370) @@ -1200,6 +1308,30 @@ BOOL32 WINAPI GetPrivateProfileStruct32A (LPCSTR section, LPCSTR key, return FALSE; } +/*********************************************************************** + * GetPrivateProfileStruct32W (KERNEL32.543) + */ +BOOL32 WINAPI GetPrivateProfileStruct32W (LPCWSTR section, LPCWSTR key, + LPVOID buffer, UINT32 len, LPCWSTR filename) +{ + LPSTR sectionA = HEAP_strdupWtoA( GetProcessHeap(), 0, section ); + LPSTR keyA = HEAP_strdupWtoA( GetProcessHeap(), 0, key); + LPSTR filenameA = HEAP_strdupWtoA( GetProcessHeap(), 0, filename ); + LPSTR bufferA = HeapAlloc( GetProcessHeap(), 0, len ); + + INT32 ret = GetPrivateProfileStruct32A( sectionA, keyA, bufferA, + len, filenameA ); + lstrcpynAtoW( buffer, bufferA, len ); + HeapFree( GetProcessHeap(), 0, bufferA); + HeapFree( GetProcessHeap(), 0, sectionA ); + HeapFree( GetProcessHeap(), 0, keyA ); + HeapFree( GetProcessHeap(), 0, filenameA ); + + return ret; +} + + + /*********************************************************************** * WritePrivateProfileStruct32A (KERNEL32.744) @@ -1216,6 +1348,24 @@ BOOL32 WINAPI WritePrivateProfileStruct32A (LPCSTR section, LPCSTR key, return PROFILE_SetString( section, key, buf); } +/*********************************************************************** + * WritePrivateProfileStruct32W (KERNEL32.544) + */ +BOOL32 WINAPI WritePrivateProfileStruct32W (LPCWSTR section, LPCWSTR key, + LPVOID buf, UINT32 bufsize, LPCWSTR filename) +{ + LPSTR sectionA = HEAP_strdupWtoA( GetProcessHeap(), 0, section ); + LPSTR keyA = HEAP_strdupWtoA( GetProcessHeap(), 0, key); + LPSTR filenameA = HEAP_strdupWtoA( GetProcessHeap(), 0, filename ); + INT32 ret = WritePrivateProfileStruct32A( sectionA, keyA, buf, bufsize, + filenameA ); + HeapFree( GetProcessHeap(), 0, sectionA ); + HeapFree( GetProcessHeap(), 0, keyA ); + HeapFree( GetProcessHeap(), 0, filenameA ); + + return ret; +} + /*********************************************************************** * WriteOutProfiles (KERNEL.315) diff --git a/graphics/ddraw.c b/graphics/ddraw.c index 3c64fcc6d2a..3e00742d44b 100644 --- a/graphics/ddraw.c +++ b/graphics/ddraw.c @@ -369,6 +369,7 @@ static HRESULT WINAPI Xlib_IDirectDrawSurface3_Unlock( this->t.xlib.image->width, this->t.xlib.image->height ); + TSXSetWindowColormap(display,this->s.ddraw->e.xlib.drawable,this->s.palette->cm); return 0; } @@ -995,13 +996,67 @@ static struct IDirectDrawPalette_VTable xlib_ddpalvt = { Xlib_IDirectDrawPalette_SetEntries }; +static HRESULT WINAPI IDirect3D_QueryInterface( + LPDIRECT3D this,REFIID refiid,LPVOID *obj +) { + /* FIXME: Not sure if this is correct */ + char xrefiid[50]; + + WINE_StringFromCLSID((LPCLSID)refiid,xrefiid); + TRACE(ddraw,"(%p)->(%s,%p)\n",this,xrefiid,obj); + if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { + *obj = this; + this->lpvtbl->fnAddRef(this); + return 0; + } + if (!memcmp(&IID_IDirect3D,refiid,sizeof(IID_IDirect3D))) { + LPDIRECT3D d3d; + + d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d)); + d3d->ref = 1; + d3d->ddraw = (LPDIRECTDRAW)this; + this->lpvtbl->fnAddRef(this); + d3d->lpvtbl = &d3dvt; + *obj = d3d; + return 0; + } + if (!memcmp(&IID_IDirect3D2,refiid,sizeof(IID_IDirect3D))) { + LPDIRECT3D2 d3d; + + d3d = HeapAlloc(GetProcessHeap(),0,sizeof(*d3d)); + d3d->ref = 1; + d3d->ddraw = (LPDIRECTDRAW)this; + this->lpvtbl->fnAddRef(this); + d3d->lpvtbl = &d3d2vt; + *obj = d3d; + return 0; + } + FIXME(ddraw,"(%p):interface for IID %s NOT found!\n",this,xrefiid); + return OLE_E_ENUM_NOMORE; +} + +static ULONG WINAPI IDirect3D_AddRef(LPDIRECT3D this) { + return ++(this->ref); +} + +static ULONG WINAPI IDirect3D_Release(LPDIRECT3D this) +{ + TRACE(ddraw,"(%p)->Release()\n",this); + if (!--(this->ref)) { + this->ddraw->lpvtbl->fnRelease(this->ddraw); + HeapFree(GetProcessHeap(),0,this); + return 0; + } + return this->ref; +} + /******************************************************************************* * IDirect3D */ static struct IDirect3D_VTable d3dvt = { - (void*)1, - (void*)2, - (void*)3, + (void*)IDirect3D_QueryInterface, + (void*)IDirect3D_AddRef, + (void*)IDirect3D_Release, (void*)4, (void*)5, (void*)6, @@ -1014,8 +1069,7 @@ static struct IDirect3D_VTable d3dvt = { * IDirect3D2 */ static ULONG WINAPI IDirect3D2_Release(LPDIRECT3D2 this) { - this->ref--; - if (!this->ref) { + if (!--(this->ref)) { this->ddraw->lpvtbl->fnRelease(this->ddraw); HeapFree(GetProcessHeap(),0,this); return 0; diff --git a/graphics/metafiledrv/graphics.c b/graphics/metafiledrv/graphics.c index f6615fff1b1..4afe9651be5 100644 --- a/graphics/metafiledrv/graphics.c +++ b/graphics/metafiledrv/graphics.c @@ -202,3 +202,23 @@ MFDRV_PaintRgn( DC *dc, HRGN32 hrgn ) return MF_MetaParam1( dc, META_PAINTREGION, index ); } + +/********************************************************************** + * MFDRV_SetBkColor + */ +COLORREF +MFDRV_SetBkColor( DC *dc, COLORREF color ) +{ + return MF_MetaParam2(dc, META_SETBKCOLOR, HIWORD(color), LOWORD(color)); +} + + +/********************************************************************** + * MFDRV_SetTextColor + */ +COLORREF +MFDRV_SetTextColor( DC *dc, COLORREF color ) +{ + return MF_MetaParam2(dc, META_SETTEXTCOLOR, HIWORD(color), LOWORD(color)); +} + diff --git a/graphics/metafiledrv/init.c b/graphics/metafiledrv/init.c index a9b5d2e009b..38695205aa8 100644 --- a/graphics/metafiledrv/init.c +++ b/graphics/metafiledrv/init.c @@ -57,7 +57,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pSelectClipRgn */ MFDRV_SelectObject, /* pSelectObject */ NULL, /* pSelectPalette */ - NULL, /* pSetBkColor */ + MFDRV_SetBkColor, /* pSetBkColor */ NULL, /* pSetBkMode */ NULL, /* pSetDeviceClipping */ NULL, /* pSetDIBitsToDevice */ @@ -70,7 +70,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = NULL, /* pSetStretchBltMode */ NULL, /* pSetTextAlign */ NULL, /* pSetTextCharacterExtra */ - NULL, /* pSetTextColor */ + MFDRV_SetTextColor, /* pSetTextColor */ NULL, /* pSetTextJustification */ MFDRV_SetViewportExt, /* pSetViewportExt */ MFDRV_SetViewportOrg, /* pSetViewportOrg */ @@ -310,7 +310,7 @@ BOOL32 WINAPI DeleteMetaFile32( /* need wide version as well */ -HDC32 CreateEnhMetaFile32A( +HDC32 WINAPI CreateEnhMetaFile32A( HDC32 hdc, /* optional reference DC */ LPCSTR filename, /* optional filename for disk metafiles */ const RECT32 *rect, /* optional bounding rectangle */ @@ -351,7 +351,7 @@ HDC32 CreateEnhMetaFile32A( return 0; } -HENHMETAFILE32 CloseEnhMetaFile32( +HENHMETAFILE32 WINAPI CloseEnhMetaFile32( HDC32 hdc /* metafile DC */ ) { diff --git a/graphics/psdrv/Makefile.in b/graphics/psdrv/Makefile.in index c8295596c43..aa3dddeff7e 100644 --- a/graphics/psdrv/Makefile.in +++ b/graphics/psdrv/Makefile.in @@ -7,12 +7,15 @@ MODULE = psdrv C_SRCS = \ afm.c \ + brush.c \ + color.c \ driver.c \ escape.c \ font.c \ graphics.c \ init.c \ objects.c \ + pen.c \ ppd.c \ ps.c \ text.c diff --git a/graphics/psdrv/README b/graphics/psdrv/README index 33a0a1b33a5..458b443fe61 100644 --- a/graphics/psdrv/README +++ b/graphics/psdrv/README @@ -1,8 +1,8 @@ -Wine Postscript Driver +Wine PostScript Driver ====================== -When complete this will allow Wine to generate Postscript files without needing -an external printer driver. It should be possible to print to a non Postscript +When complete this will allow Wine to generate PostScript files without needing +an external printer driver. It should be possible to print to a non PostScript printer by filtering the output through ghostscript. @@ -14,15 +14,15 @@ should be quite easy, I'd just like to improve it first. The driver behaves as if it were a DRV file called WINEPS.DRV . To install it as the default printer driver add -device=Wine Postscript Driver,WINEPS,LPT1: +device=Wine PostScript Driver,WINEPS,LPT1: to the [windows] section of win.ini . You may prefer to add -Wine Postscript Driver=WINEPS,LPT1: +Wine PostScript Driver=WINEPS,LPT1: to the [devices] section of win.ini instead. -You will need Adobe Font Metric (AFM) files for the (type 1 Postscript) fonts +You will need Adobe Font Metric (AFM) files for the (type 1 PostScript) fonts that you wish to use. You can get these from ftp://ftp.adobe.com/pub/adobe/type/win/all/afmfiles . The directories base17 or @@ -39,13 +39,16 @@ file=/unix/path/name/filename.afm for each AFM file that you wish to use. [This might change in the future] -You also require a ppd file for your printer. This describes certain +You also require a PPD file for your printer. This describes certain characteristics of the printer such as which fonts are installed, how to select manual feed etc. Adobe also has many of these on its website, have a look in ftp://ftp.adobe.com/pub/adobe/printerdrivers/win/all/ -Put the ppd in the directory from which you start wine and call it default.ppd +Put the PPD in the directory from which you start wine and call it default.ppd [this will definitely change soon]. +To enable colour printing you need to have the *ColorDevice entry in the PPD +set to true, otherwise the driver will generate greyscale. + Note that you need not set printer=on in the [wine] section of wine.conf, this enables printing via external printer drivers and does not affect wineps. @@ -63,21 +66,21 @@ specify whether you have optional extras such as envelope feeders. You will therefore find a larger than normal selection of input bins in the print setup dialog box. I've only really tested ppd parsing on the hp4m6_v1.ppd file. -Landscape mode probably doesn't quite work yet (this is easy to fix). - -Graphics are basically non-existent. Only MoveTo/LineTo/Rectangle with a thin -black pen. - -No colour. - -AFM parsing is not finished (or ideal). +Many graphics functions to do. No TrueType download. +AdvancedSetup dialog box. + Many partially implemented functions. ps.c is becoming messy. +No clipping. + +Notepad often starts text too far to the left depending on the margin +settings. However the win3.1 pscript.drv (under wine) also does this. + Probably many more... Since the driver is very alpha, things are likely to change quickly. diff --git a/graphics/psdrv/afm.c b/graphics/psdrv/afm.c index 4477c277fb7..dbbc60d08a0 100644 --- a/graphics/psdrv/afm.c +++ b/graphics/psdrv/afm.c @@ -30,66 +30,81 @@ FONTFAMILY *PSDRV_AFMFontList = NULL; */ static void PSDRV_AFMGetCharMetrics(AFM *afm, FILE *fp) { - char buf[256]; - char *cp, *item, *value; - int i, charno; + char line[256], valbuf[256]; + char *cp, *item, *value, *curpos, *endpos; + int i; + AFMMETRICS **insert = &afm->Metrics, *metric; for(i = 0; i < afm->NumofMetrics; i++) { - char *name = NULL; - if(!fgets(buf, sizeof(buf), fp)) { + if(!fgets(line, sizeof(line), fp)) { ERR(psdrv, "Unexpected EOF\n"); return; } - cp = buf + strlen(buf); + + metric = *insert = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, + sizeof(AFMMETRICS) ); + insert = &metric->next; + + cp = line + strlen(line); do { *cp = '\0'; cp--; - } while(cp > buf && isspace(*cp)); + } while(cp > line && isspace(*cp)); - item = strtok(buf, ";"); - if(!strncmp(item, "C ", 2)) { - value = strchr(item, ' '); - sscanf(value, " %d", &charno); - } else if(!strncmp(item, "CH ", 3)) { - value = strrchr(item, ' '); - sscanf(value, " %x", &charno); - } else { - WARN(psdrv, "Don't understand '%s'\n", item); - return; - } - - while((item = strtok(NULL, ";"))) { + curpos = line; + while(*curpos) { + item = curpos; while(isspace(*item)) item++; - value = strchr(item, ' '); - if(!value) /* last char maybe a ';' but no white space after it */ - break; - value++; + value = strpbrk(item, " \t"); + while(isspace(*value)) + value++; + cp = endpos = strchr(value, ';'); + while(isspace(*--cp)) + ; + memcpy(valbuf, value, cp - value + 1); + valbuf[cp - value + 1] = '\0'; + value = valbuf; - if(!strncmp("WX ", item, 3) || !strncmp("W0X ", item, 4)) { - if(charno >= 0 && charno <= 0xff) - sscanf(value, "%f", &(afm->CharWidths[charno])); + if(!strncmp(item, "C ", 2)) { + value = strchr(item, ' '); + sscanf(value, " %d", &metric->C); + + } else if(!strncmp(item, "CH ", 3)) { + value = strrchr(item, ' '); + sscanf(value, " %x", &metric->C); } - /* would carry on here to scan in BBox, name and ligs */ - /* Carry on to find BBox (or actually just ascent) of Aring. This - will provide something like the lfHeight value */ + else if(!strncmp("WX ", item, 3) || !strncmp("W0X ", item, 4)) { + sscanf(value, "%f", &metric->WX); + if(metric->C >= 0 && metric->C <= 0xff) + afm->CharWidths[metric->C] = metric->WX; + } else if(!strncmp("N ", item, 2)) { - name = value; /* may end in space */ + metric->N = HEAP_strdupA( PSDRV_Heap, 0, value); } else if(!strncmp("B ", item, 2)) { - if(name && !strncmp("Aring", name, 5)) { - float llx, lly, urx, ury; - llx = lly = urx = ury = 0.0; - sscanf(value, "%f%f%f%f", &llx, &lly, &urx, &ury); - afm->FullAscender = ury; - } + sscanf(value, "%f%f%f%f", &metric->B.llx, &metric->B.lly, + &metric->B.urx, &metric->B.ury); + + /* Store height of Aring to use as lfHeight */ + if(metric->N && !strncmp(metric->N, "Aring", 5)) + afm->FullAscender = metric->B.ury; } + /* Ligatures go here... */ + + curpos = endpos + 1; } + +#if 0 + TRACE(psdrv, "Metrics for '%s' WX = %f B = %f,%f - %f,%f\n", + metric->N, metric->WX, metric->B.llx, metric->B.lly, + metric->B.urx, metric->B.ury); +#endif } return; @@ -113,6 +128,8 @@ static AFM *PSDRV_AFMParse(char const *file) AFM *afm; char *cp; + TRACE(psdrv, "parsing '%s'\n", file); + if((fp = fopen(file, "r")) == NULL) { MSG("Can't open AFM file '%s'. Please check wine.conf .\n", file); return NULL; @@ -133,7 +150,8 @@ static AFM *PSDRV_AFMParse(char const *file) value = strchr(buf, ' '); if(value) - value++; + while(isspace(*value)) + value++; if(!strncmp("FontName", buf, 8)) { afm->FontName = HEAP_strdupA(PSDRV_Heap, 0, value); @@ -223,8 +241,10 @@ static AFM *PSDRV_AFMParse(char const *file) continue; } - - + if(!strncmp("EncodingScheme", buf, 14)) { + afm->EncodingScheme = HEAP_strdupA(PSDRV_Heap, 0, value); + continue; + } } fclose(fp); @@ -324,12 +344,49 @@ void PSDRV_AddAFMtoList(FONTFAMILY **head, AFM *afm) return; } - + +/********************************************************** + * + * PSDRV_ReencodeCharWidths + * + * Re map the CharWidths field of the afm to correspond to an ANSI encoding + * + */ +static void PSDRV_ReencodeCharWidths(AFM *afm) +{ + int i; + AFMMETRICS *metric; + + for(i = 0; i < 256; i++) { + if(isalnum(i)) + continue; + if(PSDRV_ANSIVector[i] == NULL) { + afm->CharWidths[i] = 0.0; + continue; + } + for(metric = afm->Metrics; metric; metric = metric->next) { + if(!strcmp(metric->N, PSDRV_ANSIVector[i])) { + afm->CharWidths[i] = metric->WX; + break; + } + } + if(!metric) { + WARN(psdrv, "Couldn't find glyph '%s' in font '%s'\n", + PSDRV_ANSIVector[i], afm->FontName); + afm->CharWidths[i] = 0.0; + } + } + return; +} + /*********************************************************** * * PSDRV_afmfilesCallback * * Callback for PROFILE_EnumerateWineIniSection + * Try to parse AFM file `value', alter the CharWidths field of afm struct if + * the font is using AdobeStandardEncoding to correspond to WinANSI, then add + * afm to system font list. */ static void PSDRV_afmfilesCallback(char const *key, char const *value, void *user) @@ -337,8 +394,13 @@ void *user) AFM *afm; afm = PSDRV_AFMParse(value); - if(afm) + if(afm) { + if(afm->EncodingScheme && + !strcmp(afm->EncodingScheme, "AdobeStandardEncoding")) { + PSDRV_ReencodeCharWidths(afm); + } PSDRV_AddAFMtoList(&PSDRV_AFMFontList, afm); + } return; } diff --git a/graphics/psdrv/brush.c b/graphics/psdrv/brush.c new file mode 100644 index 00000000000..8a82afd539a --- /dev/null +++ b/graphics/psdrv/brush.c @@ -0,0 +1,73 @@ +/* + * PostScript brush handling + * + * Copyright 1998 Huw D M Davies + * + */ + +#include "windows.h" +#include "psdrv.h" +#include "brush.h" +#include "debug.h" + + +/*********************************************************************** + * PSDRV_BRUSH_SelectObject + */ +HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush ) +{ + HBRUSH32 prevbrush = dc->w.hBrush; + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + + TRACE(psdrv, "hbrush = %08x\n", hbrush); + dc->w.hBrush = hbrush; + + switch(brush->logbrush.lbStyle) { + + case BS_SOLID: + physDev->brush.style = BS_SOLID; + PSDRV_CreateColor(physDev, &physDev->brush.color, + brush->logbrush.lbColor); + break; + + case BS_NULL: + physDev->brush.style = BS_NULL; + break; + + case BS_HATCHED: + case BS_PATTERN: + FIXME(psdrv, "Unsupported brush style %d\n", brush->logbrush.lbStyle); + break; + + default: + FIXME(psdrv, "Unrecognized brush style %d\n", brush->logbrush.lbStyle); + break; + } + + physDev->brush.set = FALSE; + return prevbrush; +} + + +/********************************************************************** + * + * PSDRV_SetBrush + * + */ +BOOL32 PSDRV_SetBrush(DC *dc) +{ + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + + switch (physDev->brush.style) { + case BS_SOLID: + PSDRV_WriteSetColor(dc, &physDev->brush.color); + break; + + default: + return FALSE; + break; + + } + physDev->brush.set = TRUE; + return TRUE; +} diff --git a/graphics/psdrv/color.c b/graphics/psdrv/color.c new file mode 100644 index 00000000000..f53e037aac4 --- /dev/null +++ b/graphics/psdrv/color.c @@ -0,0 +1,135 @@ +/* + * PostScript colour functions + * + * Copyright 1998 Huw D M Davies + * + */ + +#include "windows.h" +#include "psdrv.h" +#include "debug.h" + +/********************************************************************** + * PSDRV_CmpColor + * + * Return TRUE if col1 == col2 + */ +BOOL32 PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2) +{ + if(col1->type != col2->type) + return FALSE; + + switch(col1->type) { + case PSCOLOR_GRAY: + if(col1->value.gray.i == col2->value.gray.i) + return TRUE; + break; + case PSCOLOR_RGB: + if( col1->value.rgb.r == col2->value.rgb.r && + col1->value.rgb.g == col2->value.rgb.g && + col1->value.rgb.b == col2->value.rgb.b ) + return TRUE; + break; + default: + ERR(psdrv, "Unknown colour type %d\n", col1->type); + } + return FALSE; +} + + +/********************************************************************** + * PSDRV_CopyColor + * + * Copies col2 into col1. Return FALSE on error. + */ +BOOL32 PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2) +{ + + switch(col2->type) { + case PSCOLOR_GRAY: + col1->value.gray.i = col2->value.gray.i; + break; + + case PSCOLOR_RGB: + col1->value.rgb.r = col2->value.rgb.r; + col1->value.rgb.g = col2->value.rgb.g; + col1->value.rgb.b = col2->value.rgb.b; + break; + + default: + ERR(psdrv, "Unknown colour type %d\n", col1->type); + return FALSE; + } + + col1->type = col2->type; + return TRUE; +} + + +/********************************************************************** + * PSDRV_CreateColor + * + * Creates a PostScript colour from a COLORREF. + * Result is grey scale if ColorDevice field of ppd is FALSE else an + * rgb colour is produced. + */ +void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, + COLORREF wincolor ) +{ + int ctype = wincolor >> 24; + float r, g, b; + + if(ctype != 0) + FIXME(psdrv, "Colour is %08lx\n", wincolor); + + r = (wincolor & 0xff) / 256.0; + g = ((wincolor >> 8) & 0xff) / 256.0; + b = ((wincolor >> 16) & 0xff) / 256.0; + + if(physDev->pi->ppd->ColorDevice) { + pscolor->type = PSCOLOR_RGB; + pscolor->value.rgb.r = r; + pscolor->value.rgb.g = g; + pscolor->value.rgb.b = b; + } else { + pscolor->type = PSCOLOR_GRAY; + /* FIXME configurable */ + pscolor->value.gray.i = r * 0.3 + g * 0.59 + b * 0.11; + } + return; +} + + +/*********************************************************************** + * PSDRV_SetBkColor + */ +COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color ) +{ + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + COLORREF oldColor; + + oldColor = dc->w.backgroundColor; + dc->w.backgroundColor = color; + + PSDRV_CreateColor(physDev, &physDev->bkColor, color); + + return oldColor; +} + + +/*********************************************************************** + * PSDRV_SetTextColor + */ +COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color ) +{ + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + COLORREF oldColor; + + oldColor = dc->w.textColor; + dc->w.textColor = color; + + PSDRV_CreateColor(physDev, &physDev->font.color, color); + physDev->font.set = FALSE; + return oldColor; +} + diff --git a/graphics/psdrv/driver.c b/graphics/psdrv/driver.c index ee62d63fa0e..3c456aa1c18 100644 --- a/graphics/psdrv/driver.c +++ b/graphics/psdrv/driver.c @@ -9,13 +9,13 @@ * */ -#include -#include -#include -#include #include -#include -#include +#include "windows.h" +#include "psdrv.h" +#include "debug.h" +#include "resource.h" +#include "win.h" +#include "print.h" static LONG Resolutions[][2] = { {600,600} }; diff --git a/graphics/psdrv/font.c b/graphics/psdrv/font.c index 6abab35208a..6a058806fea 100644 --- a/graphics/psdrv/font.c +++ b/graphics/psdrv/font.c @@ -37,7 +37,7 @@ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, it = TRUE; if(lf->lfWeight > 550) bd = TRUE; - lstrcpy32A(FaceName, lf->lfFaceName); + strcpy(FaceName, lf->lfFaceName); if(FaceName[0] == '\0') { switch(lf->lfPitchAndFamily & 0xf0) { @@ -45,16 +45,16 @@ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, break; case FF_ROMAN: case FF_SCRIPT: - lstrcpy32A(FaceName, "Times"); + strcpy(FaceName, "Times"); break; case FF_SWISS: - lstrcpy32A(FaceName, "Helvetica"); + strcpy(FaceName, "Helvetica"); break; case FF_MODERN: - lstrcpy32A(FaceName, "Courier"); + strcpy(FaceName, "Courier"); break; case FF_DECORATIVE: - lstrcpy32A(FaceName, "Symbol"); + strcpy(FaceName, "Symbol"); break; } } @@ -62,23 +62,25 @@ HFONT16 PSDRV_FONT_SelectObject( DC * dc, HFONT16 hfont, if(FaceName[0] == '\0') { switch(lf->lfPitchAndFamily & 0x0f) { case VARIABLE_PITCH: - lstrcpy32A(FaceName, "Times"); + strcpy(FaceName, "Times"); break; default: - lstrcpy32A(FaceName, "Courier"); + strcpy(FaceName, "Courier"); break; } } + TRACE(psdrv, "Trying to find facename '%s'\n", FaceName); + for(family = physDev->pi->Fonts; family; family = family->next) { - if(!lstrncmp32A(FaceName, family->FamilyName, - strlen(family->FamilyName))) + if(!strcmp(FaceName, family->FamilyName)) break; } if(!family) family = physDev->pi->Fonts; - + TRACE(psdrv, "Got family '%s'\n", family->FamilyName); + for(afmle = family->afmlist; afmle; afmle = afmle->next) { if( (bd == (afmle->afm->Weight == FW_BOLD)) && (it == (afmle->afm->ItalicAngle != 0.0)) ) @@ -165,8 +167,8 @@ BOOL32 PSDRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count, width = 0.0; for(i = 0; i < count && str[i]; i++) { - width += physDev->font.afm->CharWidths[ (UINT32)str[i] ]; - TRACE(psdrv, "Width after %dth char '%c' = %f\n", i, str[i], width); + width += physDev->font.afm->CharWidths[ *((unsigned char *)str + i) ]; +/* TRACE(psdrv, "Width after %dth char '%c' = %f\n", i, str[i], width);*/ } width *= physDev->font.scale; TRACE(psdrv, "Width after scale (%f) is %f\n", physDev->font.scale, width); @@ -182,11 +184,17 @@ BOOL32 PSDRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count, BOOL32 PSDRV_SetFont( DC *dc ) { PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + BOOL32 ReEncode = FALSE; + PSDRV_WriteSetColor(dc, &physDev->font.color); if(physDev->font.set) return TRUE; - PSDRV_WriteReencodeFont(dc); - PSDRV_WriteSetFont(dc); + if(physDev->font.afm->EncodingScheme && + !strcmp(physDev->font.afm->EncodingScheme, "AdobeStandardEncoding")) + ReEncode = TRUE; + if(ReEncode) + PSDRV_WriteReencodeFont(dc); + PSDRV_WriteSetFont(dc, ReEncode); physDev->font.set = TRUE; return TRUE; } @@ -218,7 +226,7 @@ static UINT32 PSDRV_GetFontMetric(DC *dc, AFM *pafm, NEWTEXTMETRIC16 *pTM, pTM->tmPitchAndFamily |= TMPF_DEVICE; plf->lfPitchAndFamily = 0; - lstrcpyn32A( plf->lfFaceName, pafm->FamilyName, LF_FACESIZE ); + strncpy( plf->lfFaceName, pafm->FamilyName, LF_FACESIZE ); #undef plf pTM->tmAscent = pafm->FullAscender * scale; @@ -252,7 +260,7 @@ BOOL32 PSDRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf, if( plf->lfFaceName[0] ) { TRACE(psdrv, "lfFaceName = '%s'\n", plf->lfFaceName); for(family = physDev->pi->Fonts; family; family = family->next) { - if(!lstrncmp32A(plf->lfFaceName, family->FamilyName, + if(!strncmp(plf->lfFaceName, family->FamilyName, strlen(family->FamilyName))) break; } diff --git a/graphics/psdrv/graphics.c b/graphics/psdrv/graphics.c index 9b0e02dac27..70a84ce69df 100644 --- a/graphics/psdrv/graphics.c +++ b/graphics/psdrv/graphics.c @@ -3,7 +3,6 @@ * * Copyright 1998 Huw D M Davies * - * Not much here yet... */ #include #include "windows.h" @@ -25,7 +24,7 @@ BOOL32 PSDRV_MoveToEx(DC *dc, INT32 x, INT32 y, LPPOINT32 pt) dc->w.CursPosX = x; dc->w.CursPosY = y; - return PSDRV_WriteMoveTo(dc, XLPTODP(dc, x), YLPTODP(dc, y)); + return TRUE; } /*********************************************************************** @@ -35,6 +34,9 @@ BOOL32 PSDRV_LineTo(DC *dc, INT32 x, INT32 y) { TRACE(psdrv, "%d %d\n", x, y); + PSDRV_SetPen(dc); + PSDRV_WriteMoveTo(dc, XLPTODP(dc, dc->w.CursPosX), + YLPTODP(dc, dc->w.CursPosY)); PSDRV_WriteLineTo(dc, XLPTODP(dc, x), YLPTODP(dc, y)); PSDRV_WriteStroke(dc); @@ -56,7 +58,13 @@ BOOL32 PSDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, TRACE(psdrv, "%d %d - %d %d\n", left, top, right, bottom); PSDRV_WriteRectangle(dc, XLPTODP(dc, left), YLPTODP(dc, top), - width, height); + width, height); + + PSDRV_SetBrush(dc); + PSDRV_Writegsave(dc); + PSDRV_WriteFill(dc); + PSDRV_Writegrestore(dc); + PSDRV_SetPen(dc); PSDRV_WriteStroke(dc); return TRUE; } @@ -65,10 +73,25 @@ BOOL32 PSDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, /*********************************************************************** * PSDRV_Ellipse */ -BOOL32 PSDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom ) +BOOL32 PSDRV_Ellipse( DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom) { + INT32 x, y, a, b; + TRACE(psdrv, "%d %d - %d %d\n", left, top, right, bottom); - + + x = XLPTODP(dc, (left + right)/2); + y = YLPTODP(dc, (top + bottom)/2); + + a = XLSTODS(dc, (right - left)/2); + b = YLSTODS(dc, (bottom - top)/2); + + PSDRV_WriteEllispe(dc, x, y, a, b); + PSDRV_SetBrush(dc); + PSDRV_Writegsave(dc); + PSDRV_WriteFill(dc); + PSDRV_Writegrestore(dc); + PSDRV_SetPen(dc); + PSDRV_WriteStroke(dc); return TRUE; } @@ -81,6 +104,7 @@ BOOL32 PSDRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count ) INT32 i; TRACE(psdrv, "count = %d\n", count); + PSDRV_SetPen(dc); PSDRV_WriteMoveTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y)); for(i = 1; i < count; i++) PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[i].x), YLPTODP(dc, pt[i].y)); @@ -97,6 +121,8 @@ BOOL32 PSDRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count ) INT32 i; TRACE(psdrv, "count = %d\n", count); FIXME(psdrv, "Hack!\n"); + + PSDRV_SetPen(dc); PSDRV_WriteMoveTo(dc, XLPTODP(dc, pt[0].x), YLPTODP(dc, pt[0].y)); for(i = 1; i < count; i++) PSDRV_WriteLineTo(dc, XLPTODP(dc, pt[i].x), YLPTODP(dc, pt[i].y)); @@ -108,4 +134,3 @@ BOOL32 PSDRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count ) return TRUE; } - diff --git a/graphics/psdrv/init.c b/graphics/psdrv/init.c index 6a62a5a3a90..cc43a6d3132 100644 --- a/graphics/psdrv/init.c +++ b/graphics/psdrv/init.c @@ -5,14 +5,14 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include +#include "windows.h" +#include "gdi.h" +#include "psdrv.h" +#include "debug.h" +#include "heap.h" +#include "winreg.h" +#include "print.h" +#include "winerror.h" static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODE16* initData ); @@ -62,7 +62,7 @@ static const DC_FUNCTIONS PSDRV_Funcs = NULL, /* pSelectClipRgn */ PSDRV_SelectObject, /* pSelectObject */ NULL, /* pSelectPalette */ - NULL, /* pSetBkColor */ + PSDRV_SetBkColor, /* pSetBkColor */ NULL, /* pSetBkMode */ NULL, /* pSetDeviceClipping */ NULL, /* pSetDIBitsToDevice */ @@ -75,7 +75,7 @@ static const DC_FUNCTIONS PSDRV_Funcs = NULL, /* pSetStretchBltMode */ NULL, /* pSetTextAlign */ NULL, /* pSetTextCharacterExtra */ - NULL, /* pSetTextColor */ + PSDRV_SetTextColor, /* pSetTextColor */ NULL, /* pSetTextJustification */ NULL, /* pSetViewportExt (optional) */ NULL, /* pSetViewportOrg (optional) */ @@ -202,6 +202,8 @@ static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, TRACE(psdrv, "(%s %s %s %p)\n", driver, device, output, initData); + if(!pi) return FALSE; + if(!pi->Fonts) { MSG("To use WINEPS you need to install some AFM files.\n"); return FALSE; @@ -252,6 +254,13 @@ static BOOL32 PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, physDev->pi->ppd->DefaultResolution; devCaps->aspectXY = (int)hypot( (double)devCaps->aspectX, (double)devCaps->aspectY ); + + if(physDev->pi->ppd->ColorDevice) { + devCaps->bitsPixel = 8; + devCaps->numColors = 256; + /* FIXME are these values OK? */ + } + /* etc */ dc->w.devCaps = devCaps; @@ -324,6 +333,14 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) } pi->ppd = PSDRV_ParsePPD(pi->Devmode->dmDrvPrivate.ppdFileName); + if(!pi->ppd) { + HeapFree(PSDRV_Heap, 0, pi->FriendlyName); + HeapFree(PSDRV_Heap, 0, pi->Devmode); + HeapFree(PSDRV_Heap, 0, pi); + *last = NULL; + return NULL; + } + pi->next = NULL; pi->Fonts = NULL; diff --git a/graphics/psdrv/objects.c b/graphics/psdrv/objects.c index b8d8d476239..187161e38c9 100644 --- a/graphics/psdrv/objects.c +++ b/graphics/psdrv/objects.c @@ -24,27 +24,6 @@ static HBITMAP16 PSDRV_BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap, } -/*********************************************************************** - * PSDRV_BRUSH_SelectObject - */ -static HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, - BRUSHOBJ * brush ) -{ - FIXME(psdrv, "stub\n"); - return 0; -} - - -/*********************************************************************** - * PSDRV_PEN_SelectObject - */ -static HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen ) -{ - FIXME(psdrv, "stub\n"); - return 0; -} - - /*********************************************************************** * PSDRV_SelectObject */ diff --git a/graphics/psdrv/pen.c b/graphics/psdrv/pen.c new file mode 100644 index 00000000000..958ffdaff6f --- /dev/null +++ b/graphics/psdrv/pen.c @@ -0,0 +1,90 @@ +/* + * PostScript pen handling + * + * Copyright 1998 Huw D M Davies + * + */ + +#include "windows.h" +#include "pen.h" +#include "psdrv.h" +#include "debug.h" + +static char PEN_dash[] = "50 30"; /* ----- ----- ----- */ +static char PEN_dot[] = "20"; /* -- -- -- -- -- -- */ +static char PEN_dashdot[] = "40 30 20 30"; /* ---- -- ---- -- */ +static char PEN_dashdotdot[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */ +static char PEN_alternate[] = "1"; + +/*********************************************************************** + * PSDRV_PEN_SelectObject + */ +extern HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen ) +{ + HPEN32 prevpen = dc->w.hPen; + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + + TRACE(psdrv, "hpen = %08x colour = %08lx\n", hpen, pen->logpen.lopnColor); + dc->w.hPen = hpen; + + physDev->pen.width = XLSTODS(dc, pen->logpen.lopnWidth.x); + if(physDev->pen.width < 0) + physDev->pen.width = -physDev->pen.width; + + PSDRV_CreateColor(physDev, &physDev->pen.color, pen->logpen.lopnColor); + + if(physDev->pen.width > 1) { /* dashes only for 0 or 1 pixel pens */ + physDev->pen.dash = NULL; + } else { + switch(pen->logpen.lopnStyle & PS_STYLE_MASK) { + case PS_DASH: + physDev->pen.dash = PEN_dash; + break; + + case PS_DOT: + physDev->pen.dash = PEN_dot; + break; + + case PS_DASHDOT: + physDev->pen.dash = PEN_dashdot; + break; + + case PS_DASHDOTDOT: + physDev->pen.dash = PEN_dashdotdot; + break; + + case PS_ALTERNATE: + physDev->pen.dash = PEN_alternate; + break; + + default: + physDev->pen.dash = NULL; + break; + } + } + + physDev->pen.set = FALSE; + return prevpen; +} + + +/********************************************************************** + * + * PSDRV_SetPen + * + */ +BOOL32 PSDRV_SetPen(DC *dc) +{ + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + + PSDRV_WriteSetColor(dc, &physDev->pen.color); + + if(!physDev->pen.set) { + PSDRV_WriteSetPen(dc); + physDev->pen.set = TRUE; + } + + return TRUE; +} + + diff --git a/graphics/psdrv/ppd.c b/graphics/psdrv/ppd.c index 8364d7205c4..8f8d5c8a48d 100644 --- a/graphics/psdrv/ppd.c +++ b/graphics/psdrv/ppd.c @@ -5,14 +5,14 @@ * Copyright 1998 Huw D M Davies */ -#include -#include /* HEAP_ZERO_MEMORY */ -#include -#include -#include #include #include -#include +#include "windows.h" +#include "winnt.h" /* HEAP_ZERO_MEMORY */ +#include "heap.h" +#include "debug.h" +#include "psdrv.h" +#include "print.h" typedef struct { char *key; @@ -400,8 +400,10 @@ PPD *PSDRV_ParsePPD(char *fname) TRACE(psdrv, "%s\n", fname); - if((fp = fopen(fname, "r")) == NULL) + if((fp = fopen(fname, "r")) == NULL) { + WARN(psdrv, "Couldn't open ppd file '%s'\n", fname); return NULL; + } ppd = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*ppd)); if(!ppd) { @@ -551,7 +553,7 @@ PPD *PSDRV_ParsePPD(char *fname) if(!strcmp(tuple.value, "Plus90")) ppd->LandscapeOrientation = 90; else if(!strcmp(tuple.value, "Minus90")) - ppd->LandscapeOrientation = 270; + ppd->LandscapeOrientation = -90; /* anything else, namely 'any', leaves value at 0 */ diff --git a/graphics/psdrv/ps.c b/graphics/psdrv/ps.c index 0893ee688d7..d301c36082b 100644 --- a/graphics/psdrv/ps.c +++ b/graphics/psdrv/ps.c @@ -5,92 +5,197 @@ * */ -#include -#include -#include -#include #include +#include +#include "windows.h" +#include "psdrv.h" +#include "print.h" +#include "debug.h" -char psheader[] = /* title llx lly urx ury */ -"%%!PS-Adobe-3.0 (not quite)\n" +static char psheader[] = /* title llx lly urx ury orientation */ +"%%!PS-Adobe-3.0\n" "%%%%Creator: Wine PostScript Driver\n" "%%%%Title: %s\n" "%%%%BoundingBox: %d %d %d %d\n" "%%%%Pages: (atend)\n" -"%%%%EndComments\n" -"%%%%BeginProlog\n" +"%%%%Orientation: %s\n" +"%%%%EndComments\n"; + +static char psbeginprolog[] = +"%%BeginProlog\n"; + +static char psendprolog[] = +"%%EndProlog\n"; + +static char psvectorstart[] = +"/ANSIEncoding [\n"; + +static char psvectorend[] = +"] def\n"; + +static char psprolog[] = /* output ANSIEncoding vector first */ "/reencodefont {\n" "findfont\n" "dup length dict begin\n" "{1 index /FID ne {def} {pop pop} ifelse} forall\n" -"/Encoding ISOLatin1Encoding def\n" +"/Encoding ANSIEncoding def\n" "currentdict\n" "end\n" "definefont pop\n" "} bind def\n" -"%%%%EndProlog\n"; +"/tmpmtrx matrix def\n"; -char psbeginsetup[] = +static char psbeginsetup[] = "%%BeginSetup\n"; -char psendsetup[] = +static char psendsetup[] = "%%EndSetup\n"; -char psbeginfeature[] = /* feature, value */ +static char psbeginfeature[] = /* feature, value */ "mark {\n" "%%%%BeginFeature: %s %s\n"; -char psendfeature[] = +static char psendfeature[] = "\n%%EndFeature\n" "} stopped cleartomark\n"; -char psnewpage[] = /* name, number */ +static char psnewpage[] = /* name, number, xres, yres, xtrans, ytrans, rot */ "%%%%Page: %s %d\n" "%%%%BeginPageSetup\n" "/pgsave save def\n" -"72 600 div dup scale\n" -"0 7014 translate\n" +"72 %d div 72 %d div scale\n" +"%d %d translate\n" "1 -1 scale\n" +"%d rotate\n" "%%%%EndPageSetup\n"; -char psendpage[] = +static char psendpage[] = "pgsave restore\n" "showpage\n"; -char psfooter[] = /* pages */ +static char psfooter[] = /* pages */ "%%%%Trailer\n" "%%%%Pages: %d\n" "%%%%EOF\n"; -char psmoveto[] = /* x, y */ +static char psmoveto[] = /* x, y */ "%d %d moveto\n"; -char pslineto[] = /* x, y */ +static char pslineto[] = /* x, y */ "%d %d lineto\n"; -char psrlineto[] = /* dx, dy */ -"%d %d rlineto\n"; - -char psstroke[] = +static char psstroke[] = "stroke\n"; -char psrectangle[] = /* x, y, width, height, -width */ +static char psrectangle[] = /* x, y, width, height, -width */ "%d %d moveto\n" "%d 0 rlineto\n" "0 %d rlineto\n" "%d 0 rlineto\n" "closepath\n"; -char psshow[] = /* string */ +static char psshow[] = /* string */ "(%s) show\n"; -char pssetfont[] = /* fontname, xscale, yscale, ascent, escapement */ +static char pssetfont[] = /* fontname, xscale, yscale, ascent, escapement */ "/%s findfont\n" "[%d 0 0 %d 0 0]\n" "%d 10 div matrix rotate\n" "matrix concatmatrix\n" "makefont setfont\n"; +static char pssetlinewidth[] = /* width */ +"%d setlinewidth\n"; + +static char pssetdash[] = /* dash, offset */ +"[%s] %d setdash\n"; + +static char pssetgray[] = /* gray */ +"%.2f setgray\n"; + +static char pssetrgbcolor[] = /* r, g, b */ +"%.2f %.2f %.2f setrgbcolor\n"; + +static char psellipse[] = /* x, y, a, b */ +"tmpmtrx currentmatrix pop\n" +"%d %d translate\n" +"%d %d scale\n" +"0 0 1 0 360 arc\n" +"tmpmtrx setmatrix\n"; + +static char psgsave[] = +"gsave\n"; + +static char psgrestore[] = +"grestore\n"; + +static char psfill[] = +"fill\n"; + +char *PSDRV_ANSIVector[256] = { +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +"space", "exclam", "quotedbl", "numbersign", +"dollar", "percent", "ampersand", "quotesingle", +"parenleft", "parenright", "asterisk", "plus", +"comma", "hyphen", "period", "slash", +"zero", "one", "two", "three", +"four", "five", "six", "seven", +"eight", "nine", "colon", "semicolon", +"less", "equal", "greater", "question", +"at", "A", "B", "C", +"D", "E", "F", "G", +"H", "I", "J", "K", +"L", "M", "N", "O", +"P", "Q", "R", "S", +"T", "U", "V", "W", +"X", "Y", "Z", "bracketleft", +"backslash", "bracketright", "asciicircum", "underscore", +"grave", "a", "b", "c", +"d", "e", "f", "g", +"h", "i", "j", "k", +"l", "m", "n", "o", +"p", "q", "r", "s", +"t", "u", "v", "w", +"x", "y", "z", "braceleft", +"bar", "braceright", "asciitilde", NULL, +NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, +NULL, "quoteleft", "quoteright", NULL, +NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, +NULL, NULL, NULL, NULL, +NULL, "exclamdown", "cent", "sterling", +"currency", "yen", "brokenbar", "section", +"dieresis", "copyright", "ordfeminine", "guillemotleft", +"logicalnot", "hyphen", "registered", "macron", +"degree", "plusminus", "twosuperior", "threesuperior", +"acute", "mu", "paragraph", "periodcentered", +"cedilla", "onesuperior", "ordmasculine", "guillemotright", +"onequarter", "onehalf", "threequarters","questiondown", +"Agrave", "Aacute", "Acircumflex", "Atilde", +"Adieresis", "Aring", "AE", "Ccedilla", +"Egrave", "Eacute", "Ecircumflex", "Edieresis", +"Igrave", "Iacute", "Icircumflex", "Idieresis", +"Eth", "Ntilde", "Ograve", "Oacute", +"Ocircumflex", "Otilde", "Odieresis", "multiply", +"Oslash", "Ugrave", "Uacute", "Ucircumflex", +"Udieresis", "Yacute", "Thorn", "germandbls", +"agrave", "aacute", "acircumflex", "atilde", +"adieresis", "aring", "ae", "ccedilla", +"egrave", "eacute", "ecircumflex", "edieresis", +"igrave", "iacute", "icircumflex", "idieresis", +"eth", "ntilde", "ograve", "oacute", +"ocircumflex", "otilde", "odieresis", "divide", +"oslash", "ugrave", "uacute", "ucircumflex", +"udieresis", "yacute", "thorn", "ydieresis" +}; + + char psreencodefont[] = /* newfontname basefontname*/ "/%s /%s reencodefont\n"; @@ -117,7 +222,7 @@ INT32 PSDRV_WriteFeature(HANDLE16 hJob, char *feature, char *value, strlen(feature) + strlen(value)); - wsprintf32A(buf, psbeginfeature, feature, value); + sprintf(buf, psbeginfeature, feature, value); WriteSpool( hJob, buf, strlen(buf) ); WriteSpool( hJob, invocation, strlen(invocation) ); @@ -133,9 +238,10 @@ INT32 PSDRV_WriteFeature(HANDLE16 hJob, char *feature, char *value, INT32 PSDRV_WriteHeader( DC *dc, char *title, int len ) { PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; - char *buf, *titlebuf; + char *buf, *titlebuf, *orient, vectbuf[256]; INPUTSLOT *slot; PAGESIZE *page; + int urx, ury, i, j; titlebuf = (char *)HeapAlloc( PSDRV_Heap, 0, len+1 ); if(!titlebuf) { @@ -145,16 +251,28 @@ INT32 PSDRV_WriteHeader( DC *dc, char *title, int len ) memcpy(titlebuf, title, len); titlebuf[len] = '\0'; - buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) + len + 20); + buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psheader) + len + 30); if(!buf) { WARN(psdrv, "HeapAlloc failed\n"); HeapFree( PSDRV_Heap, 0, titlebuf ); return 0; } - wsprintf32A(buf, psheader, title, 0, 0, - (int) (dc->w.devCaps->horzSize * 72.0 / 25.4), - (int) (dc->w.devCaps->vertSize * 72.0 / 25.4) ); + if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) { + /* BBox co-ords are in default user co-ord system so urx < ury even in + landscape mode */ + urx = (int) (dc->w.devCaps->vertSize * 72.0 / 25.4); + ury = (int) (dc->w.devCaps->horzSize * 72.0 / 25.4); + orient = "Landscape"; + } else { + urx = (int) (dc->w.devCaps->horzSize * 72.0 / 25.4); + ury = (int) (dc->w.devCaps->vertSize * 72.0 / 25.4); + orient = "Portrait"; + } + + /* FIXME should do something better with BBox */ + + sprintf(buf, psheader, title, 0, 0, urx, ury, orient); if( WriteSpool( physDev->job.hJob, buf, strlen(buf) ) != strlen(buf) ) { @@ -166,6 +284,28 @@ INT32 PSDRV_WriteHeader( DC *dc, char *title, int len ) HeapFree( PSDRV_Heap, 0, titlebuf ); HeapFree( PSDRV_Heap, 0, buf ); + WriteSpool( physDev->job.hJob, psbeginprolog, strlen(psbeginprolog) ); + WriteSpool( physDev->job.hJob, psvectorstart, strlen(psvectorstart) ); + + for(i = 0; i < 256; i += 8) { + vectbuf[0] = '\0'; + for(j = 0; j < 8; j++) { + strcat(vectbuf, "/"); + if(PSDRV_ANSIVector[i+j]) { + strcat(vectbuf, PSDRV_ANSIVector[i+j]); + strcat(vectbuf, " "); + } else { + strcat(vectbuf, ".notdef "); + } + } + strcat(vectbuf, "\n"); + WriteSpool( physDev->job.hJob, vectbuf, strlen(vectbuf) ); + } + + WriteSpool( physDev->job.hJob, psvectorend, strlen(psvectorend) ); + WriteSpool( physDev->job.hJob, psprolog, strlen(psprolog) ); + WriteSpool( physDev->job.hJob, psendprolog, strlen(psendprolog) ); + WriteSpool( physDev->job.hJob, psbeginsetup, strlen(psbeginsetup) ); @@ -189,7 +329,6 @@ INT32 PSDRV_WriteHeader( DC *dc, char *title, int len ) } } - WriteSpool( physDev->job.hJob, psendsetup, strlen(psendsetup) ); @@ -208,7 +347,7 @@ INT32 PSDRV_WriteFooter( DC *dc ) return 0; } - wsprintf32A(buf, psfooter, physDev->job.PageNo); + sprintf(buf, psfooter, physDev->job.PageNo); if( WriteSpool( physDev->job.hJob, buf, strlen(buf) ) != strlen(buf) ) { @@ -242,16 +381,35 @@ INT32 PSDRV_WriteNewPage( DC *dc ) PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; char *buf; char name[100]; - - wsprintf32A(name, "%d", physDev->job.PageNo); + signed int xtrans, ytrans, rotation; - buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psnewpage) + 100 ); + sprintf(name, "%d", physDev->job.PageNo); + + buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psnewpage) + 200 ); if(!buf) { WARN(psdrv, "HeapAlloc failed\n"); return 0; } - wsprintf32A(buf, psnewpage, name, physDev->job.PageNo); + if(physDev->Devmode->dmPublic.dmOrientation == DMORIENT_LANDSCAPE) { + if(physDev->pi->ppd->LandscapeOrientation == -90) { + xtrans = dc->w.devCaps->vertRes; + ytrans = dc->w.devCaps->horzRes; + rotation = 90; + } else { + xtrans = ytrans = 0; + rotation = -90; + } + } else { + xtrans = 0; + ytrans = dc->w.devCaps->vertRes; + rotation = 0; + } + + sprintf(buf, psnewpage, name, physDev->job.PageNo, + dc->w.devCaps->logPixelsX, dc->w.devCaps->logPixelsY, + xtrans, ytrans, rotation); + if( WriteSpool( physDev->job.hJob, buf, strlen(buf) ) != strlen(buf) ) { WARN(psdrv, "WriteSpool error\n"); @@ -267,7 +425,7 @@ BOOL32 PSDRV_WriteMoveTo(DC *dc, INT32 x, INT32 y) { char buf[100]; - wsprintf32A(buf, psmoveto, x, y); + sprintf(buf, psmoveto, x, y); return PSDRV_WriteSpool(dc, buf, strlen(buf)); } @@ -275,7 +433,7 @@ BOOL32 PSDRV_WriteLineTo(DC *dc, INT32 x, INT32 y) { char buf[100]; - wsprintf32A(buf, pslineto, x, y); + sprintf(buf, pslineto, x, y); return PSDRV_WriteSpool(dc, buf, strlen(buf)); } @@ -292,13 +450,21 @@ BOOL32 PSDRV_WriteRectangle(DC *dc, INT32 x, INT32 y, INT32 width, { char buf[100]; - wsprintf32A(buf, psrectangle, x, y, width, height, -width); + sprintf(buf, psrectangle, x, y, width, height, -width); return PSDRV_WriteSpool(dc, buf, strlen(buf)); } -static char encodingext[] = "-ISOLatin1"; +BOOL32 PSDRV_WriteEllispe(DC *dc, INT32 x, INT32 y, INT32 a, INT32 b) +{ + char buf[256]; -BOOL32 PSDRV_WriteSetFont(DC *dc) + sprintf(buf, psellipse, x, y, a, b); + return PSDRV_WriteSpool(dc, buf, strlen(buf)); +} + +static char encodingext[] = "-ANSI"; + +BOOL32 PSDRV_WriteSetFont(DC *dc, BOOL32 UseANSI) { PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; char *buf, *newbuf; @@ -320,9 +486,12 @@ BOOL32 PSDRV_WriteSetFont(DC *dc) return FALSE; } - wsprintf32A(newbuf, "%s%s", physDev->font.afm->FontName, encodingext); + if(UseANSI) + sprintf(newbuf, "%s%s", physDev->font.afm->FontName, encodingext); + else + strcpy(newbuf, physDev->font.afm->FontName); - wsprintf32A(buf, pssetfont, newbuf, + sprintf(buf, pssetfont, newbuf, physDev->font.size, -physDev->font.size, -physDev->font.escapement); @@ -331,6 +500,49 @@ BOOL32 PSDRV_WriteSetFont(DC *dc) return TRUE; } +BOOL32 PSDRV_WriteSetColor(DC *dc, PSCOLOR *color) +{ + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + char buf[256]; + + if(PSDRV_CmpColor(&physDev->inkColor, color)) + return TRUE; + + PSDRV_CopyColor(&physDev->inkColor, color); + switch(color->type) { + case PSCOLOR_RGB: + sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g, + color->value.rgb.b); + return PSDRV_WriteSpool(dc, buf, strlen(buf)); + + case PSCOLOR_GRAY: + sprintf(buf, pssetgray, color->value.gray.i); + return PSDRV_WriteSpool(dc, buf, strlen(buf)); + + default: + ERR(psdrv, "Unkonwn colour type %d\n", color->type); + break; + } + + return FALSE; +} + +BOOL32 PSDRV_WriteSetPen(DC *dc) +{ + PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; + char buf[256]; + + sprintf(buf, pssetlinewidth, physDev->pen.width); + PSDRV_WriteSpool(dc, buf, strlen(buf)); + + if(physDev->pen.dash) { + sprintf(buf, pssetdash, physDev->pen.dash, 0); + PSDRV_WriteSpool(dc, buf, strlen(buf)); + } + + return TRUE; +} + BOOL32 PSDRV_WriteReencodeFont(DC *dc) { PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; @@ -354,8 +566,8 @@ BOOL32 PSDRV_WriteReencodeFont(DC *dc) return FALSE; } - wsprintf32A(newbuf, "%s%s", physDev->font.afm->FontName, encodingext); - wsprintf32A(buf, psreencodefont, newbuf, physDev->font.afm->FontName); + sprintf(newbuf, "%s%s", physDev->font.afm->FontName, encodingext); + sprintf(buf, psreencodefont, newbuf, physDev->font.afm->FontName); PSDRV_WriteSpool(dc, buf, strlen(buf)); @@ -392,7 +604,7 @@ BOOL32 PSDRV_WriteShow(DC *dc, char *str, INT32 count) buf1 = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psshow) + done); - wsprintf32A(buf1, psshow, buf); + sprintf(buf1, psshow, buf); PSDRV_WriteSpool(dc, buf1, strlen(buf1)); HeapFree(PSDRV_Heap, 0, buf); @@ -401,6 +613,21 @@ BOOL32 PSDRV_WriteShow(DC *dc, char *str, INT32 count) return TRUE; } +BOOL32 PSDRV_WriteFill(DC *dc) +{ + return PSDRV_WriteSpool(dc, psfill, sizeof(psfill)-1); +} + +BOOL32 PSDRV_Writegsave(DC *dc) +{ + return PSDRV_WriteSpool(dc, psgsave, sizeof(psgsave)-1); +} + +BOOL32 PSDRV_Writegrestore(DC *dc) +{ + return PSDRV_WriteSpool(dc, psgrestore, sizeof(psgrestore)-1); +} + diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c index 053a2f32c4f..d389b98ef57 100644 --- a/graphics/win16drv/init.c +++ b/graphics/win16drv/init.c @@ -660,9 +660,8 @@ int WINAPI WriteSpool(HANDLE16 hJob, LPSTR lpData, WORD cch) nRet = cch; if (pPrintJob->hDC == 0) { ERR(print, "hDC == 0 !\n"); - return SP_ERROR; } - if (!(QueryAbort(pPrintJob->hDC, (nRet == SP_OUTOFDISK) ? nRet : 0 ))) + else if (!(QueryAbort(pPrintJob->hDC, (nRet == SP_OUTOFDISK) ? nRet : 0 ))) { CloseJob(hJob); /* printing aborted */ nRet = SP_APPABORT; diff --git a/graphics/wing.c b/graphics/wing.c index a68cacf4564..02166709206 100644 --- a/graphics/wing.c +++ b/graphics/wing.c @@ -1,5 +1,5 @@ /* - * WingG support + * WinG support * * Started by Robert Pouliot */ @@ -55,7 +55,7 @@ static void __initWinG(void) return; } } - FIXME(wing,"WinG: no joy.\n"); + FIXME(wing,"WinG: incorrect depth or unsupported card.\n"); __WinGOK = False; } } diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c index 6cc8994b596..87ddb157d3e 100644 --- a/graphics/x11drv/bitblt.c +++ b/graphics/x11drv/bitblt.c @@ -837,8 +837,9 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, rectDst.bottom - rectDst.top, dcDst->w.bitsPerPixel ); BITBLT_StretchImage( imageSrc, imageDst, widthSrc, heightSrc, widthDst, heightDst, &rectSrc, &rectDst, - dcDst->w.textPixel, dcDst->w.bitsPerPixel != 1 ? - dcDst->w.backgroundPixel : dcSrc->w.backgroundPixel, + dcDst->u.x.textPixel, dcDst->w.bitsPerPixel != 1 ? + dcDst->u.x.backgroundPixel : + dcSrc->u.x.backgroundPixel, dcDst->w.stretchBltMode ); XPutImage( display, pixmap, gc, imageDst, 0, 0, 0, 0, rectDst.right - rectDst.left, rectDst.bottom - rectDst.top ); @@ -900,14 +901,14 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, if (COLOR_PixelToPalette) { XSetBackground( display, gc, - COLOR_PixelToPalette[dcDst->w.textPixel] ); + COLOR_PixelToPalette[dcDst->u.x.textPixel] ); XSetForeground( display, gc, - COLOR_PixelToPalette[dcDst->w.backgroundPixel]); + COLOR_PixelToPalette[dcDst->u.x.backgroundPixel]); } else { - XSetBackground( display, gc, dcDst->w.textPixel ); - XSetForeground( display, gc, dcDst->w.backgroundPixel ); + XSetBackground( display, gc, dcDst->u.x.textPixel ); + XSetForeground( display, gc, dcDst->u.x.backgroundPixel ); } XCopyPlane( display, dcSrc->u.x.drawable, pixmap, gc, visRectSrc->left, visRectSrc->top, @@ -923,7 +924,7 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, for (y = 0; y < height; y++) for (x = 0; x < width; x++) XPutPixel(imageDst, x, y, (XGetPixel(imageSrc,x,y) == - dcSrc->w.backgroundPixel) ); + dcSrc->u.x.backgroundPixel) ); XPutImage( display, pixmap, gc, imageDst, 0, 0, 0, 0, width, height ); XDestroyImage( imageSrc ); @@ -1239,8 +1240,8 @@ static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst, } if (dcSrc->w.bitsPerPixel == 1) { - XSetBackground( display, dcDst->u.x.gc, dcDst->w.textPixel ); - XSetForeground( display, dcDst->u.x.gc, dcDst->w.backgroundPixel ); + XSetBackground( display, dcDst->u.x.gc, dcDst->u.x.textPixel ); + XSetForeground( display, dcDst->u.x.gc, dcDst->u.x.backgroundPixel ); XSetFunction( display, dcDst->u.x.gc, GXcopy ); XSetGraphicsExposures( display, dcDst->u.x.gc, True ); XCopyPlane( display, dcSrc->u.x.drawable, diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c index 3e5f189572d..e60fed834f7 100644 --- a/graphics/x11drv/graphics.c +++ b/graphics/x11drv/graphics.c @@ -1099,3 +1099,37 @@ X11DRV_PolyBezier(DC *dc, POINT32 start, POINT32 *BezierPoints, DWORD count) free(xpoints); return TRUE; } + +/********************************************************************** + * X11DRV_SetBkColor + */ +COLORREF +X11DRV_SetBkColor( DC *dc, COLORREF color ) +{ + X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; + COLORREF oldColor; + + oldColor = dc->w.backgroundColor; + dc->w.backgroundColor = color; + + physDev->backgroundPixel = COLOR_ToPhysical( dc, color ); + + return oldColor; +} + +/********************************************************************** + * X11DRV_SetTextColor + */ +COLORREF +X11DRV_SetTextColor( DC *dc, COLORREF color ) +{ + X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; + COLORREF oldColor; + + oldColor = dc->w.textColor; + dc->w.textColor = color; + + physDev->textPixel = COLOR_ToPhysical( dc, color ); + + return oldColor; +} diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c index cf91c6d575d..89c29361938 100644 --- a/graphics/x11drv/init.c +++ b/graphics/x11drv/init.c @@ -61,7 +61,7 @@ static const DC_FUNCTIONS X11DRV_Funcs = NULL, /* pSelectClipRgn */ X11DRV_SelectObject, /* pSelectObject */ NULL, /* pSelectPalette */ - NULL, /* pSetBkColor */ + X11DRV_SetBkColor, /* pSetBkColor */ NULL, /* pSetBkMode */ X11DRV_SetDeviceClipping, /* pSetDeviceClipping */ NULL, /* pSetDIBitsToDevice */ @@ -74,7 +74,7 @@ static const DC_FUNCTIONS X11DRV_Funcs = NULL, /* pSetStretchBltMode */ NULL, /* pSetTextAlign */ NULL, /* pSetTextCharacterExtra */ - NULL, /* pSetTextColor */ + X11DRV_SetTextColor, /* pSetTextColor */ NULL, /* pSetTextJustification */ NULL, /* pSetViewportExt (optional) */ NULL, /* pSetViewportOrg (optional) */ diff --git a/graphics/x11drv/text.c b/graphics/x11drv/text.c index 09c78b0d27b..0b93e1060b3 100644 --- a/graphics/x11drv/text.c +++ b/graphics/x11drv/text.c @@ -103,7 +103,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags, if (flags & ETO_OPAQUE) { - TSXSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel ); + TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel ); TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc, dc->w.DCOrgX + rect.left, dc->w.DCOrgY + rect.top, rect.right-rect.left, rect.bottom-rect.top ); @@ -196,7 +196,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags, (y - ascent < rect.top) || (y + descent >= rect.bottom)) { - TSXSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel ); + TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel ); TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc, dc->w.DCOrgX + x, dc->w.DCOrgY + y - ascent, @@ -208,7 +208,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags, /* Draw the text (count > 0 verified) */ - TSXSetForeground( display, dc->u.x.gc, dc->w.textPixel ); + TSXSetForeground( display, dc->u.x.gc, dc->u.x.textPixel ); if (!dc->w.charExtra && !dc->w.breakExtra && !lpDx) { if(!rotated) diff --git a/if1632/compobj.spec b/if1632/compobj.spec index d37bbef6ea5..fb9e76b65fd 100644 --- a/if1632/compobj.spec +++ b/if1632/compobj.spec @@ -7,7 +7,7 @@ type win16 4 pascal CoGetMalloc(long ptr) CoGetMalloc16 5 pascal CoRegisterClassObject(ptr ptr long long ptr) CoRegisterClassObject16 6 stub COREVOKECLASSOBJECT -7 stub COGETCLASSOBJECT +7 pascal CoGetClassObject(ptr long ptr ptr ptr) CoGetClassObject 8 stub COMARSHALINTERFACE 9 stub COUNMARSHALINTERFACE 10 stub COLOADLIBRARY @@ -29,13 +29,13 @@ type win16 26 stub GETSCODE 27 pascal CoRegisterMessageFilter(ptr ptr) CoRegisterMessageFilter16 28 stub COISHANDLERCONNECTED -#29 WEP +29 stub SHRADDREF 30 pascal CoFileTimeToDosDateTime(ptr ptr ptr) FileTimeToDosDateTime 31 pascal CoDosDateTimeToFileTime(word word ptr) DosDateTimeToFileTime 32 stub COMARSHALHRESULT 33 stub COUNMARSHALHRESULT 34 pascal CoGetCurrentProcess() CoGetCurrentProcess -#35 ___EXPORTEDSTUB +35 stub SHRCREATE 36 stub COISOLE1CLASS 37 stub _GUID_NULL 38 stub _IID_IUNKNOWN @@ -71,7 +71,7 @@ type win16 68 stub PROPAGATERESULT 69 stub IIDFROMSTRING 70 stub _IID_ISTDMARSHALINFO -71 stub COCREATESTANDARDMALLOC +71 pascal CoCreateStandardMalloc(long ptr) CoCreateStandardMalloc16 72 stub _IID_IEXTERNALCONNECTION 73 stub COCREATEGUID 75 stub FNASSERT @@ -94,21 +94,31 @@ type win16 92 stub LRPCGETTHREADWINDOW 93 stub TIMERCALLBACKPROC 94 pascal LookupETask(ptr ptr) LookupETask -95 stub SETETASK +95 pascal16 SetETask(word ptr) SetETask 96 stub LRPCFREEMONITORDATA 97 stub REMLOOKUPSHUNK +98 stub SHRGETSIZE +99 stub CALLTHKMGRUNINITIALIZE 100 stub ??0CARRAYFVALUE@@REC@KI@Z 101 stub ??1CARRAYFVALUE@@REC@XZ 102 stub ?ASSERTVALID@CARRAYFVALUE@@RFCXXZ 103 stub ?FREEEXTRA@CARRAYFVALUE@@RECXXZ 104 stub ?_GETAT@CARRAYFVALUE@@RFCPEXH@Z 105 stub ?GETSIZE@CARRAYFVALUE@@RFCHXZ +106 stub ?REMOVEALL@CARRAYFVALUE@@RECXXZ +107 stub SHRDESTROY 108 stub ?INDEXOF@CARRAYFVALUE@@RECHPEXII@Z 109 stub ?INSERTAT@CARRAYFVALUE@@RECHHPEXH@Z +110 stub COSETSTATE 111 stub ?REMOVEAT@CARRAYFVALUE@@RECXHH@Z 112 stub ?SETAT@CARRAYFVALUE@@RECXHPEX@Z 113 stub ?SETATGROW@CARRAYFVALUE@@RECHHPEX@Z 114 stub ?SETSIZE@CARRAYFVALUE@@RECHHH@Z +115 pascal CoGetState(ptr) CoGetState16 +116 stub DLLENTRYPOINT +117 stub ?RELEASE@CSTDMALLOC@@VEAKXZ +118 stub ?ALLOC@CSTDMALLOC@@VEAPEXK@Z +119 stub SHRRELEASE 120 stub ?GETASSOCAT@CMAPKEYTOVALUE@@BFCPEUCASSOC@1@PEXIAEI@Z 121 stub ?SETASSOCKEY@CMAPKEYTOVALUE@@BFCHPEUCASSOC@1@PEXI@Z 122 stub ??1CMAPKEYTOVALUE@@REC@XZ @@ -126,6 +136,7 @@ type win16 134 stub ?GETASSOCVALUE@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEX@Z 135 stub ?REMOVEKEY@CMAPKEYTOVALUE@@RECHPEXI@Z 136 stub ?REMOVEALL@CMAPKEYTOVALUE@@RECXXZ +137 stub SHRALLOC 138 stub ?FREEASSOCKEY@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@@Z 139 stub ?SETAT@CMAPKEYTOVALUE@@RECHPEXI0@Z 140 stub ?LOOKUPHKEY@CMAPKEYTOVALUE@@RFCHKPEX@Z @@ -137,16 +148,64 @@ type win16 146 stub ?GETASSOCVALUEPTR@CMAPKEYTOVALUE@@BFCXPEUCASSOC@1@PEPEX@Z 147 stub ?LOOKUPADD@CMAPKEYTOVALUE@@RFCHPEXI0@Z 148 stub MKVDEFAULTHASHKEY +149 stub DELETE16 150 stub COMEMCTXOF 151 stub COMEMALLOC 152 stub COMEMFREE +153 stub SHRREALLOC +154 stub ___EXPORTEDSTUB +155 stub LRPCREGISTERWIN32SMONITOR +156 stub MYREMGETINFOFORCID +157 stub SHRFREE +158 stub OPNEW16 +159 stub ADDCOINFO 160 stub CORUNMODALLOOP 161 stub COHANDLEINCOMINGCALL 162 stub COSETACKSTATE - +163 stub SHRDIDALLOC +164 stub ?GETAT@CARRAYFVALUE@@RFCPEXH@Z +165 stub ?GETUPPERBOUND@CARRAYFVALUE@@RFCHXZ +166 stub OPDELETE16 +167 stub ?GETSIZEVALUE@CARRAYFVALUE@@RFCHXZ +168 stub ?PROXY1632ADDREF@@ZAKPEVCPROXY1632@@@Z +169 stub REMLOOKUPSHUNK +170 stub ?ISEMPTY@CMAPKEYTOVALUE@@RFCHXZ +171 stub ?FREE@CSTDMALLOC@@VEAXPEX@Z +172 stub CALLTHKMGRINITIALIZE +173 stub ?REALLOC@CSTDMALLOC@@VEAPEXPEXK@Z +174 stub ?SM16RHQI@@ZAPEXPEVCSM16RELEASEHANDLER@@AFUGUID@@PEPEX@Z +175 stub ?PROXY1632METHOD10@@ZAKPEVCPROXY1632@@@Z +176 stub ___EXPORTEDSTUB +177 stub ?PROXY1632METHOD20@@ZAKPEVCPROXY1632@@@Z +178 stub ?PROXY1632METHOD11@@ZAKPEVCPROXY1632@@@Z +179 stub ?PROXY1632METHOD30@@ZAKPEVCPROXY1632@@@Z +180 stub ?PROXY1632METHOD21@@ZAKPEVCPROXY1632@@@Z +181 stub ?PROXY1632METHOD12@@ZAKPEVCPROXY1632@@@Z +182 stub ?PROXY1632METHOD31@@ZAKPEVCPROXY1632@@@Z +183 stub ?PROXY1632METHOD22@@ZAKPEVCPROXY1632@@@Z +184 stub ?PROXY1632METHOD13@@ZAKPEVCPROXY1632@@@Z +185 stub ?GETSIZE@CSTDMALLOC@@VEAKPEX@Z +186 stub ?PROXY1632METHOD23@@ZAKPEVCPROXY1632@@@Z +187 stub ?PROXY1632METHOD14@@ZAKPEVCPROXY1632@@@Z +188 stub ?PROXY1632METHOD24@@ZAKPEVCPROXY1632@@@Z +189 stub ?PROXY1632METHOD15@@ZAKPEVCPROXY1632@@@Z +190 stub ?PROXY1632METHOD25@@ZAKPEVCPROXY1632@@@Z +191 stub ?PROXY1632METHOD16@@ZAKPEVCPROXY1632@@@Z +192 stub ?PROXY1632METHOD26@@ZAKPEVCPROXY1632@@@Z +193 stub ?PROXY1632METHOD17@@ZAKPEVCPROXY1632@@@Z +194 stub ?PROXY1632METHOD27@@ZAKPEVCPROXY1632@@@Z +195 stub ?PROXY1632METHOD18@@ZAKPEVCPROXY1632@@@Z +196 stub ?PROXY1632METHOD28@@ZAKPEVCPROXY1632@@@Z +197 stub ?ADDREF@CSTDMALLOC@@VEAKXZ +198 stub ?PROXY1632METHOD19@@ZAKPEVCPROXY1632@@@Z +199 stub ?PROXY1632METHOD29@@ZAKPEVCPROXY1632@@@Z +200 stub CALL32INITIALIZE 201 pascal CALLOBJECTINWOW(ptr ptr) CallObjectInWOW -204 stub COMPOBJ_204 -207 stub COMPOBJ_207 +203 stub CALLOBJECTINWOWCHECKINIT +204 stub CALLOBJECTINWOWCHECKTHKMGR +205 stub CONVERTHR1632 +206 stub CONVERTHR3216 +207 stub ADDAPPCOMPATFLAG # WINE internal relays (for Win16 interfaces) 500 cdecl IMalloc16_QueryInterface(ptr ptr ptr) IMalloc16_QueryInterface diff --git a/if1632/kernel.spec b/if1632/kernel.spec index 52bcd9aef05..f15d568b1e8 100644 --- a/if1632/kernel.spec +++ b/if1632/kernel.spec @@ -142,7 +142,7 @@ file krnl386.exe 139 stub DoSignal 140 pascal16 SetSigHandler(segptr ptr ptr word word) SetSigHandler 141 stub InitTask1 -142 stub GetProfileSectionNames +142 pascal16 GetProfileSectionNames(ptr word) GetProfileSectionNames16 143 pascal16 GetPrivateProfileSectionNames(ptr word str) GetPrivateProfileSectionNames16 144 pascal16 CreateDirectory(ptr ptr) CreateDirectory16 145 pascal16 RemoveDirectory(ptr) RemoveDirectory16 @@ -325,25 +325,46 @@ file krnl386.exe 485 pascal GetProcessDWORD(long s_word) GetProcessDword 486 stub KERNEL_486 491 stub RegisterServiceProcess -500 stub KERNEL_500 -502 stub KERNEL_502 -503 stub KERNEL_503 -511 stub KERNEL_511 + +# Those stubs can be found in WindowNT3.51 krnl386.exe. Some are used by Win95 +# too, some seem to specify different functions in Win95... Ugh. +500 pascal WOW16Call(word word word) WOW16Call +501 stub KDDBGOUT +502 stub WOWGETNEXTVDMCOMMAND +503 stub WOWREGISTERSHELLWINDOWHANDLE +504 stub WOWLOADMODULE +505 stub WOWQUERYPERFORMANCECOUNTER +506 stub WOWCURSORICONOP +507 stub WOWFAILEDEXEC +508 stub WOWCLOSECOMPORT +509 stub WOWKILLREMOTETASK +511 stub WOWKILLREMOTETASK +512 stub WOWQUERYDEBUG 513 pascal LoadLibraryEx32W(ptr long long) LoadLibraryEx32W16 514 pascal16 FreeLibrary32W(long) FreeLibrary32 515 pascal GetProcAddress32W(long str) GetProcAddress32 516 pascal GetVDMPointer32W(segptr long) GetVDMPointer32W 517 pascal CallProc32W() WIN16_CallProc32W 518 pascal CallProcEx32W() WIN16_CallProcEx32W -519 stub KERNEL_519 -522 stub KERNEL_522 -523 stub KERNEL_523 -525 stub KERNEL_525 -531 stub KERNEL_531 -532 stub KERNEL_532 +519 stub EXITKERNELTHUNK +# the __MOD_ variables are WORD datareferences. +520 equate __MOD_KERNEL 4200 +521 equate __MOD_DKERNEL 4201 +522 equate __MOD_USER 4203 +523 equate __MOD_DUSER 4204 +524 equate __MOD_GDI 4205 +525 equate __MOD_DGDI 4206 +526 equate __MOD_KEYBOARD 4207 +527 equate __MOD_SOUND 4208 +528 equate __MOD_SHELL 4209 +529 equate __MOD_WINSOCK 4210 +530 equate __MOD_TOOLHELP 4211 +531 equate __MOD_MMEDIA 4212 +532 equate __MOD_COMMDLG 4213 540 stub KERNEL_540 -541 stub KERNEL_541 -544 stub KERNEL_544 +541 stub WOWSETEXITONLASTAPP +544 stub WOWSETCOMPATHANDLE + 600 stub KERNEL_600 601 stub KERNEL_601 604 stub KERNEL_604 diff --git a/if1632/ole2.spec b/if1632/ole2.spec index bc54fdcbc59..77894ddfb37 100644 --- a/if1632/ole2.spec +++ b/if1632/ole2.spec @@ -36,7 +36,7 @@ type win16 33 stub READSTRINGSTREAM 34 stub WRITESTRINGSTREAM 35 pascal RegisterDragDrop(word segptr) RegisterDragDrop16 -36 stub REVOKEDRAGDROP +36 pascal RevokeDragDrop(word) RevokeDragDrop16 37 stub DODRAGDROP 38 stub CREATEOLEADVISEHOLDER 39 stub CREATEDATAADVISEHOLDER diff --git a/if1632/snoop.c b/if1632/snoop.c index 1f946655029..bec67530663 100644 --- a/if1632/snoop.c +++ b/if1632/snoop.c @@ -229,18 +229,6 @@ void WINAPI SNOOP16_Entry(CONTEXT *context) { FIXME(snoop,"entrypoint 0x%08lx not found\n",entry); return; /* oops */ } - /* guess cdecl ... */ - if (fun->nrofargs<0) { - /* Typical cdecl return frame is: - * add esp, xxxxxxxx - * which has (for xxxxxxxx up to 255 the opcode "83 C4 xx". - */ - LPBYTE reteip = (LPBYTE)PTR_SEG_TO_LIN(CALLER1REF); - - if ((reteip[0]==0x83)&&(reteip[1]==0xc4)) - fun->nrofargs=reteip[2]/2; - } - while (*rets) { for (i=0;ientry)/sizeof((*rets)->entry[0]);i++) if (!(*rets)->entry[i].origreturn) @@ -273,7 +261,8 @@ void WINAPI SNOOP16_Entry(CONTEXT *context) { if(!ret->show) return; DPRINTF("Call %s.%ld: %s(",dll->name,ordinal,fun->name); if (fun->nrofargs>0) { - max = fun->nrofargs; if (max>16) max=16; + max = fun->nrofargs; + if (max>16) max=16; for (i=max;i--;) DPRINTF("%04x%s",*(WORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8+sizeof(WORD)*i),i?",":""); if (max!=fun->nrofargs) @@ -294,8 +283,9 @@ void WINAPI SNOOP16_Return(CONTEXT *context) { * will be the difference between orig and current SP * If pascal -> everything ok. */ - if (ret->dll->funs[ret->ordinal].nrofargs<0) + if (ret->dll->funs[ret->ordinal].nrofargs<0) { ret->dll->funs[ret->ordinal].nrofargs=(SP_reg(context)-ret->origSP-4)/2; + } IP_reg(context) = LOWORD(ret->origreturn); CS_reg(context) = HIWORD(ret->origreturn); if(!ret->show) { @@ -305,10 +295,15 @@ void WINAPI SNOOP16_Return(CONTEXT *context) { DPRINTF("Ret %s.%ld: %s(",ret->dll->name,ret->ordinal,ret->dll->funs[ret->ordinal].name); max = ret->dll->funs[ret->ordinal].nrofargs; - if (max>16) max=16; + if (max>16) + max=16; + if (max<0) + max=0; for (i=max;i--;) DPRINTF("%04x%s",ret->args[i],i?",":""); + if (max!=ret->dll->funs[ret->ordinal].nrofargs) + DPRINTF(" ..."); DPRINTF(") retval = %04x:%04x ret=%04x:%04x\n", DX_reg(context),AX_reg(context),HIWORD(ret->origreturn),LOWORD(ret->origreturn) ); diff --git a/if1632/thunk.c b/if1632/thunk.c index 83f5d87ea87..39d5b1d7992 100644 --- a/if1632/thunk.c +++ b/if1632/thunk.c @@ -898,3 +898,18 @@ void WINAPI C16ThkSL01(CONTEXT *context) } } } + +DWORD WINAPI +WOW16Call(WORD x,WORD y,WORD z) { + int i; + DWORD calladdr; + FIXME(thunk,"(0x%04x,0x%04x,%d),calling (",x,y,z); + + for (i=0;imember)-((LPBYTE)((name*)0))))+ \ + sizeof(((name*)0)->member)) +#endif + +#define SNDMSG WINELIB_NAME_AW(SendMessage) + + /* StatusWindow */ #define STATUSCLASSNAME16 "msctls_statusbar" #define STATUSCLASSNAME32A "msctls_statusbar32" -#define STATUSCLASSNAME32W L"msctls_statusbar32" +#define STATUSCLASSNAME32W L"msctls_statusbar32" #define STATUSCLASSNAME WINELIB_NAME_AW(STATUSCLASSNAME) +#define SBT_NOBORDERS 0x0100 +#define SBT_POPOUT 0x0200 +#define SBT_RTLREADING 0x0400 /* not supported */ +#define SBT_TOOLTIPS 0x0800 +#define SBT_OWNERDRAW 0x1000 + +#define SBARS_SIZEGRIP 0x0100 + #define SB_SETTEXT32A (WM_USER+1) #define SB_SETTEXT32W (WM_USER+11) #define SB_SETTEXT WINELIB_NAME_AW(SB_SETTEXT) @@ -245,19 +155,10 @@ typedef struct tagNMTOOLTIPSCREATED #define SB_GETICON (WM_USER+20) #define SB_SETBKCOLOR CCM_SETBKCOLOR /* lParam = bkColor */ -#define SBT_NOBORDERS 0x0100 -#define SBT_POPOUT 0x0200 -#define SBT_RTLREADING 0x0400 /* not supported */ -#define SBT_TOOLTIPS 0x0800 -#define SBT_OWNERDRAW 0x1000 - -#define SBARS_SIZEGRIP 0x0100 - #define SBN_FIRST (0U-880U) #define SBN_LAST (0U-899U) #define SBN_SIMPLEMODECHANGE (SBN_FIRST-0) - HWND32 WINAPI CreateStatusWindow32A (INT32, LPCSTR, HWND32, UINT32); HWND32 WINAPI CreateStatusWindow32W (INT32, LPCWSTR, HWND32, UINT32); #define CreateStatusWindow WINELIB_NAME_AW(CreateStatusWindow) @@ -270,10 +171,10 @@ VOID WINAPI MenuHelp (UINT32, WPARAM32, LPARAM, HMENU32, /* UpDown */ -#define UPDOWN_CLASS16 "msctls_updown" -#define UPDOWN_CLASS32A "msctls_updown32" -#define UPDOWN_CLASS32W L"msctls_updown32" /*FIXME*/ -#define UPDOWN_CLASS WINELIB_NAME_AW(UPDOWN_CLASS) +#define UPDOWN_CLASS16 "msctls_updown" +#define UPDOWN_CLASS32A "msctls_updown32" +#define UPDOWN_CLASS32W L"msctls_updown32" +#define UPDOWN_CLASS WINELIB_NAME_AW(UPDOWN_CLASS) typedef struct tagUDACCEL { @@ -294,6 +195,7 @@ typedef struct tagUDACCEL #define UDS_NOTHOUSANDS 0x0080 #define UDN_FIRST (0U-721) +#define UDN_LAST (0U-740) #define UDN_DELTAPOS (UDN_FIRST-1) #define UDM_SETRANGE (WM_USER+101) @@ -336,18 +238,17 @@ HWND32 WINAPI CreateUpDownControl (DWORD, INT32, INT32, INT32, INT32, typedef struct { - INT32 iLow; - INT32 iHigh; + INT32 iLow; + INT32 iHigh; } PBRANGE, *PPBRANGE; /* ImageList */ /* -#if defined(__WINE__) && defined(__WINE_IMAGELIST_C) -#else +#if !defined(__WINE__) || !defined(__WINE_IMAGELIST_C) struct _IMAGELIST; typedef struct _IMAGELIST *HIMAGELIST; -#endif*/ /* __WINE__ */ +#endif */ /* __WINE__ */ #define CLR_NONE 0xFFFFFFFF #define CLR_DEFAULT 0xFF000000 @@ -468,11 +369,10 @@ BOOL32 WINAPI ImageList_Write (HIMAGELIST, LPSTREAM32); /* Header control */ -#define WC_HEADER16 "SysHeader" -#define WC_HEADER32A "SysHeader32" -#define WC_HEADER32W L"SysHeader32" - -#define WC_HEADER WINELIB_NAME_AW(WC_HEADER) +#define WC_HEADER16 "SysHeader" +#define WC_HEADER32A "SysHeader32" +#define WC_HEADER32W L"SysHeader32" +#define WC_HEADER WINELIB_NAME_AW(WC_HEADER) #define HDS_HORZ 0x0000 #define HDS_BUTTONS 0x0002 @@ -540,25 +440,35 @@ BOOL32 WINAPI ImageList_Write (HIMAGELIST, LPSTREAM32); #define HDN_LAST (0U-399U) #define HDN_ITEMCHANGING32A (HDN_FIRST-0) #define HDN_ITEMCHANGING32W (HDN_FIRST-20) +#define HDN_ITEMCHANGING WINELIB_NAME_AW(HDN_ITEMCHANGING) #define HDN_ITEMCHANGED32A (HDN_FIRST-1) #define HDN_ITEMCHANGED32W (HDN_FIRST-21) +#define HDN_ITEMCHANGED WINELIB_NAME_AW(HDN_ITEMCHANGED) #define HDN_ITEMCLICK32A (HDN_FIRST-2) #define HDN_ITEMCLICK32W (HDN_FIRST-22) +#define HDN_ITEMCLICK WINELIB_NAME_AW(HDN_ITEMCLICK) #define HDN_ITEMDBLCLICK32A (HDN_FIRST-3) #define HDN_ITEMDBLCLICK32W (HDN_FIRST-23) +#define HDN_ITEMDBLCLICK WINELIB_NAME_AW(HDN_ITEMDBLCLICK) #define HDN_DIVIDERDBLCLICK32A (HDN_FIRST-5) #define HDN_DIVIDERDBLCLICK32W (HDN_FIRST-25) +#define HDN_DIVIDERDBLCLICK WINELIB_NAME_AW(HDN_DIVIDERDBLCLICK) #define HDN_BEGINTRACK32A (HDN_FIRST-6) #define HDN_BEGINTRACK32W (HDN_FIRST-26) +#define HDN_BEGINTRACK WINELIB_NAME_AW(HDN_BEGINTRACK) #define HDN_ENDTRACK32A (HDN_FIRST-7) #define HDN_ENDTRACK32W (HDN_FIRST-27) +#define HDN_ENDTRACK WINELIB_NAME_AW(HDN_ENDTRACK) #define HDN_TRACK32A (HDN_FIRST-8) #define HDN_TRACK32W (HDN_FIRST-28) +#define HDN_TRACK WINELIB_NAME_AW(HDN_TRACK) #define HDN_GETDISPINFO32A (HDN_FIRST-9) #define HDN_GETDISPINFO32W (HDN_FIRST-29) +#define HDN_GETDISPINFO WINELIB_NAME_AW(HDN_GETDISPINFO) #define HDN_BEGINDRACK (HDN_FIRST-10) #define HDN_ENDDRACK (HDN_FIRST-11) + typedef struct _HD_LAYOUT { RECT32 *prc; @@ -578,7 +488,27 @@ typedef struct _HD_ITEMA LPARAM lParam; INT32 iImage; INT32 iOrder; -} HD_ITEMA; +} HDITEM32A, *LPHDITEM32A; + +typedef struct _HD_ITEMW +{ + UINT32 mask; + INT32 cxy; + LPWSTR pszText; + HBITMAP32 hbm; + INT32 cchTextMax; + INT32 fmt; + LPARAM lParam; + INT32 iImage; + INT32 iOrder; +} HDITEM32W, *LPHDITEM32W; + +#define HDITEM WINELIB_NAME_AW(HDITEM) +#define LPHDITEM WINELIB_NAME_AW(LPHDITEM) + +#define HDITEM_V1_SIZE32A CCSIZEOF_STRUCT(HDITEM32A, lParam) +#define HDITEM_V1_SIZE32W CCSIZEOF_STRUCT(HDITEM32W, lParam) +#define HDITEM_V1_SIZE WINELIB_NAME_AW(HDITEM_V1_SIZE) typedef struct _HD_HITTESTINFO { @@ -591,56 +521,55 @@ typedef struct _HD_HITTESTINFO typedef struct tagNMHEADERA { - NMHDR hdr; - INT32 iItem; - INT32 iButton; - HD_ITEMA *pitem; + NMHDR hdr; + INT32 iItem; + INT32 iButton; + HDITEM32A *pitem; } NMHEADERA, *LPNMHEADERA; - +#ifndef __WINE__ #define Header_GetItemCount(hwndHD) \ - (INT32)SendMessage32A((hwndHD),HDM_GETITEMCOUNT,0,0L) + (INT32)SNDMSG((hwndHD),HDM_GETITEMCOUNT,0,0L) #define Header_InsertItem(hwndHD,i,phdi) \ - (INT32)SendMessage32A((hwndHD),HDM_INSERTITEM,(WPARAM32)(INT32)(i),\ - (LPARAM)(const HD_ITEMA*)(phdi)) + (INT32)SNDMSG((hwndHD),HDM_INSERTITEM,(WPARAM32)(INT32)(i),(LPARAM)(const HDITEM *)(phdi)) #define Header_DeleteItem(hwndHD,i) \ - (BOOL32)SendMessage32A((hwndHD),HDM_DELETEITEM,(WPARAM32)(INT32)(i),0L) + (BOOL32)SNDMSG((hwndHD),HDM_DELETEITEM,(WPARAM32)(INT32)(i),0L) #define Header_GetItem(hwndHD,i,phdi) \ - (BOOL32)SendMessage32A((hwndHD),HDM_GETITEM,(WPARAM32)(INT32)(i),(LPARAM)(HD_ITEMA*)(phdi)) + (BOOL32)SNDMSG((hwndHD),HDM_GETITEM,(WPARAM32)(INT32)(i),(LPARAM)(HDITEM *)(phdi)) #define Header_SetItem(hwndHD,i,phdi) \ - (BOOL32)SendMessage32A((hwndHD),HDM_SETITEM,(WPARAM32)(INT32)(i),(LPARAM)(const HD_ITEMA*)(phdi)) + (BOOL32)SNDMSG((hwndHD),HDM_SETITEM,(WPARAM32)(INT32)(i),(LPARAM)(const HDITEM *)(phdi)) #define Header_Layout(hwndHD,playout) \ - (BOOL32)SendMessage32A((hwndHD),HDM_LAYOUT,0,(LPARAM)(LPHDLAYOUT)(playout)) + (BOOL32)SNDMSG((hwndHD),HDM_LAYOUT,0,(LPARAM)(LPHDLAYOUT)(playout)) #define Header_GetItemRect(hwnd,iItem,lprc) \ - (BOOL32)SendMessage32A((hwnd),HDM_GETITEMRECT,(WPARAM32)iItem,(LPARAM)lprc) + (BOOL32)SNDMSG((hwnd),HDM_GETITEMRECT,(WPARAM32)iItem,(LPARAM)lprc) #define Header_SetImageList(hwnd,himl) \ - (HIMAGELIST)SendMessage32A((hwnd),HDM_SETIMAGELIST,0,(LPARAM)himl) + (HIMAGELIST)SNDMSG((hwnd),HDM_SETIMAGELIST,0,(LPARAM)himl) #define Header_GetImageList(hwnd) \ - (HIMAGELIST)SendMessage32A((hwnd),HDM_GETIMAGELIST,0,0) + (HIMAGELIST)SNDMSG((hwnd),HDM_GETIMAGELIST,0,0) #define Header_OrderToIndex(hwnd,i) \ - (INT32)SendMessage32A((hwnd),HDM_ORDERTOINDEX,(WPARAM32)i,0) + (INT32)SNDMSG((hwnd),HDM_ORDERTOINDEX,(WPARAM32)i,0) #define Header_CreateDragImage(hwnd,i) \ - (HIMAGELIST)SendMessage32A((hwnd),HDM_CREATEDRAGIMAGE,(WPARAM32)i,0) + (HIMAGELIST)SNDMSG((hwnd),HDM_CREATEDRAGIMAGE,(WPARAM32)i,0) #define Header_GetOrderArray(hwnd,iCount,lpi) \ - (BOOL32)SendMessage32A((hwnd),HDM_GETORDERARRAY,(WPARAM32)iCount,(LPARAM)lpi) + (BOOL32)SNDMSG((hwnd),HDM_GETORDERARRAY,(WPARAM32)iCount,(LPARAM)lpi) #define Header_SetOrderArray(hwnd,iCount,lpi) \ - (BOOL32)SendMessage32A((hwnd),HDM_SETORDERARRAY,(WPARAM32)iCount,(LPARAM)lpi) + (BOOL32)SNDMSG((hwnd),HDM_SETORDERARRAY,(WPARAM32)iCount,(LPARAM)lpi) #define Header_SetHotDivider(hwnd,fPos,dw) \ - (INT32)SendMessage32A((hwnd),HDM_SETHOTDIVIDER,(WPARAM32)fPos,(LPARAM)dw) + (INT32)SNDMSG((hwnd),HDM_SETHOTDIVIDER,(WPARAM32)fPos,(LPARAM)dw) #define Header_SetUnicodeFormat(hwnd,fUnicode) \ - (BOOL32)SendMessage32A((hwnd),HDM_SETUNICODEFORMAT,(WPARAM32)(fUnicode),0) + (BOOL32)SNDMSG((hwnd),HDM_SETUNICODEFORMAT,(WPARAM32)(fUnicode),0) #define Header_GetUnicodeFormat(hwnd) \ - (BOOL32)SendMessage32A((hwnd),HDM_GETUNICODEFORMAT,0,0) + (BOOL32)SNDMSG((hwnd),HDM_GETUNICODEFORMAT,0,0) +#endif /* #ifndef __WINE__ */ /* Toolbar */ -#define TOOLBARCLASSNAME16 "ToolbarWindow" -#define TOOLBARCLASSNAME32W L"ToolbarWindow32" -#define TOOLBARCLASSNAME32A "ToolbarWindow32" +#define TOOLBARCLASSNAME16 "ToolbarWindow" +#define TOOLBARCLASSNAME32W L"ToolbarWindow32" +#define TOOLBARCLASSNAME32A "ToolbarWindow32" #define TOOLBARCLASSNAME WINELIB_NAME_AW(TOOLBARCLASSNAME) - #define CMB_MASKED 0x02 #define TBSTATE_CHECKED 0x01 @@ -652,7 +581,6 @@ typedef struct tagNMHEADERA #define TBSTATE_ELLIPSES 0x40 #define TBSTATE_MARKED 0x80 - #define TBSTYLE_BUTTON 0x00 #define TBSTYLE_SEP 0x01 #define TBSTYLE_CHECK 0x02 @@ -675,14 +603,6 @@ typedef struct tagNMHEADERA #define TBIF_COMMAND 0x00000020 #define TBIF_SIZE 0x00000040 -#define TBN_FIRST (0U-700U) -#define TBN_LAST (0U-720U) -#define TBN_GETBUTTONINFO32A (TBN_FIRST-0) -#define TBN_GETBUTTONINFO32W (TBN_FIRST-20) - -#define TBN_GETINFOTIP32A (TBN_FIRST-18) -#define TBN_GETINFOTIP32W (TBN_FIRST-19) - #define TB_ENABLEBUTTON (WM_USER+1) #define TB_CHECKBUTTON (WM_USER+2) @@ -775,13 +695,20 @@ typedef struct tagNMHEADERA #define TB_SETPADDING (WM_USER+87) #define TB_SETINSERTMARKCOLOR (WM_USER+88) #define TB_GETINSERTMARKCOLOR (WM_USER+89) - #define TB_SETCOLORSCHEME CCM_SETCOLORSCHEME #define TB_GETCOLORSCHEME CCM_GETCOLORSCHEME - #define TB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT #define TB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT +#define TBN_FIRST (0U-700U) +#define TBN_LAST (0U-720U) +#define TBN_GETBUTTONINFO32A (TBN_FIRST-0) +#define TBN_GETBUTTONINFO32W (TBN_FIRST-20) +#define TBN_GETBUTTONINFO WINELIB_NAME_AW(TBN_GETBUTTONINFO) +#define TBN_GETINFOTIP32A (TBN_FIRST-18) +#define TBN_GETINFOTIP32W (TBN_FIRST-19) +#define TBN_GETINFOTIP WINELIB_NAME_AW(TBN_GETINFOTIP) + /* This is just for old CreateToolbar. */ /* Don't use it in new programs. */ @@ -904,9 +831,9 @@ CreateMappedBitmap (HINSTANCE32, INT32, UINT32, LPCOLORMAP, INT32); /* Tool tips */ -#define TOOLTIPS_CLASS16 "tooltips_class" +#define TOOLTIPS_CLASS16 "tooltips_class" +#define TOOLTIPS_CLASS32A "tooltips_class32" #define TOOLTIPS_CLASS32W L"tooltips_class32" -#define TOOLTIPS_CLASS32A "tooltips_class32" #define TOOLTIPS_CLASS WINELIB_NAME_AW(TOOLTIPS_CLASS) #define INFOTIPSIZE 1024 @@ -1014,6 +941,10 @@ typedef struct tagTOOLINFOW { #define PTOOLINFO WINELIB_NAME_AW(PTOOLINFO) #define LPTTTOOLINFO WINELIB_NAME_AW(LPTTTOOLINFO) +#define TTTOOLINFO_V1_SIZE32A CCSIZEOF_STRUCT(TTTOOLINFO32A, lpszText) +#define TTTOOLINFO_V1_SIZE32W CCSIZEOF_STRUCT(TTTOOLINFO32W, lpszText) +#define TTTOOLINFO_V1_SIZE WINELIB_NAME_AW(TTTOOLINFO_V1_SIZE) + typedef struct _TT_HITTESTINFOA { HWND32 hwnd; @@ -1054,6 +985,10 @@ typedef struct tagNMTTDISPINFOW #define NMTTDISPINFO WINELIB_NAME_AW(NMTTDISPINFO) #define LPNMTTDISPINFO WINELIB_NAME_AW(LPNMTTDISPINFO) +#define NMTTDISPINFO_V1_SIZE32A CCSIZEOF_STRUCT(NMTTDISPINFO32A, uFlags) +#define NMTTDISPINFO_V1_SIZE32W CCSIZEOF_STRUCT(NMTTDISPINFO32W, uFlags) +#define NMTTDISPINFO_V1_SIZE WINELIB_NAME_AW(NMTTDISPINFO_V1_SIZE) + /* Rebar control */ @@ -1111,10 +1046,8 @@ typedef struct tagNMTTDISPINFOW #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) @@ -1124,6 +1057,9 @@ typedef struct tagNMTTDISPINFOW #define RB_SETUNICODEFORMAT CCS_SETUNICODEFORMAT #define RB_GETUNICODEFORMAT CCS_GETUNICODEFORMAT +#define RBN_FIRST (0U-831U) +#define RBN_LAST (0U-859U) + typedef struct tagREBARINFO { @@ -1156,8 +1092,41 @@ typedef struct tagREBARBANDINFOA UINT32 cxHeader; } REBARBANDINFO32A, *LPREBARBANDINFO32A; +typedef REBARBANDINFO32A const *LPCREBARBANDINFO32A; +typedef struct tagREBARBANDINFOW +{ + 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; +} REBARBANDINFO32W, *LPREBARBANDINFO32W; +typedef REBARBANDINFO32W const *LPCREBARBANDINFO32W; + +#define REBARBANDINFO WINELIB_NAME_AW(REBARBANDINFO) +#define LPREBARBANDINFO WINELIB_NAME_AW(LPREBARBANDINFO) +#define LPCREBARBANDINFO WINELIB_NAME_AW(LPCREBARBANDINFO) + +#define REBARBANDINFO_V3_SIZE32A CCSIZEOF_STRUCT(REBARBANDINFO32A, wID) +#define REBARBANDINFO_V3_SIZE32W CCSIZEOF_STRUCT(REBARBANDINFO32W, wID) +#define REBARBANDINFO_V3_SIZE WINELIB_NAME_AW(REBARBANDINFO_V3_SIZE) /* Trackbar control */ @@ -1257,8 +1226,21 @@ typedef struct tagREBARBANDINFOA #define PGB_TOPORLEFT 0 #define PGB_BOTTOMORRIGHT 1 -#define PGM_FIRST 0x1400 +/* only used with PGN_SCROLL */ +#define PGF_SCROLLUP 1 +#define PGF_SCROLLDOWN 2 +#define PGF_SCROLLLEFT 4 +#define PGF_SCROLLRIGHT 8 +#define PGK_SHIFT 1 +#define PGK_CONTROL 2 +#define PGK_MENU 4 + +/* only used with PGN_CALCSIZE */ +#define PGF_CALCWIDTH 1 +#define PGF_CALCHEIGHT 2 + +#define PGM_FIRST 0x1400 #define PGM_SETCHILD (PGM_FIRST+1) #define PGM_RECALCSIZE (PGM_FIRST+2) #define PGM_FORWARDMOUSE (PGM_FIRST+3) @@ -1273,21 +1255,44 @@ typedef struct tagREBARBANDINFOA #define PGM_GETBUTTONSTATE (PGM_FIRST+12) #define PGM_GETDROPTARGET CCM_GETDROPTARGET +#define PGN_FIRST (0U-900U) +#define PGN_LAST (0U-950U) +#define PGN_SCROLL (PGN_FIRST-1) +#define PGN_CALCSIZE (PGN_FIRST-2) + +typedef struct +{ + NMHDR hdr; + WORD fwKeys; + RECT32 rcParent; + INT32 iDir; + INT32 iXpos; + INT32 iYpos; + INT32 iScroll; +} NMPGSCROLL, *LPNMPGSCROLL; + +typedef struct +{ + NMHDR hdr; + DWORD dwFlag; + INT32 iWidth; + INT32 iHeight; +} NMPGCALCSIZE, *LPNMPGCALCSIZE; /* Treeview control */ #define WC_TREEVIEW32A "SysTreeView32" #define WC_TREEVIEW32W L"SysTreeView32" -#define WC_TREEVIEW WINELIB_NAME_AW(WC_TREEVIEW) +#define WC_TREEVIEW WINELIB_NAME_AW(WC_TREEVIEW) #define TVSIL_NORMAL 0 #define TVSIL_STATE 2 #define TV_FIRST 0x1100 - -#define TVM_INSERTITEMA (TV_FIRST+0) -#define TVM_INSERTITEMW (TV_FIRST+50) +#define TVM_INSERTITEM32A (TV_FIRST+0) +#define TVM_INSERTITEM32W (TV_FIRST+50) +#define TVM_INSERTITEM WINELIB_NAME_AW(TVM_INSERTITEM) #define TVM_DELETEITEM (TV_FIRST+1) #define TVM_EXPAND (TV_FIRST+2) #define TVM_GETITEMRECT (TV_FIRST+4) @@ -1298,12 +1303,15 @@ typedef struct tagREBARBANDINFOA #define TVM_SETIMAGELIST (TV_FIRST+9) #define TVM_GETNEXTITEM (TV_FIRST+10) #define TVM_SELECTITEM (TV_FIRST+11) -#define TVM_GETITEMA (TV_FIRST+12) -#define TVM_GETITEMW (TV_FIRST+62) -#define TVM_SETITEMA (TV_FIRST+13) -#define TVM_SETITEMW (TV_FIRST+63) -#define TVM_EDITLABELA (TV_FIRST+14) -#define TVM_EDITLABELW (TV_FIRST+65) +#define TVM_GETITEM32A (TV_FIRST+12) +#define TVM_GETITEM32W (TV_FIRST+62) +#define TVM_GETITEM WINELIB_NAME_AW(TVM_GETITEM) +#define TVM_SETITEM32A (TV_FIRST+13) +#define TVM_SETITEM32W (TV_FIRST+63) +#define TVM_SETITEM WINELIB_NAME_AW(TVM_SETITEM) +#define TVM_EDITLABEL32A (TV_FIRST+14) +#define TVM_EDITLABEL32W (TV_FIRST+65) +#define TVM_EDITLABEL WINELIB_NAME_AW(TVM_EDITLABEL) #define TVM_GETEDITCONTROL (TV_FIRST+15) #define TVM_GETVISIBLECOUNT (TV_FIRST+16) #define TVM_HITTEST (TV_FIRST+17) @@ -1312,10 +1320,28 @@ typedef struct tagREBARBANDINFOA #define TVM_ENSUREVISIBLE (TV_FIRST+20) #define TVM_SORTCHILDRENCB (TV_FIRST+21) #define TVM_ENDEDITLABELNOW (TV_FIRST+22) -#define TVM_GETISEARCHSTRINGA (TV_FIRST+23) -#define TVM_GETISEARCHSTRINGW (TV_FIRST+64) +#define TVM_GETISEARCHSTRING32A (TV_FIRST+23) +#define TVM_GETISEARCHSTRING32W (TV_FIRST+64) +#define TVM_GETISEARCHSTRING WINELIB_NAME_AW(TVM_GETISEARCHSTRING) #define TVM_SETTOOLTIPS (TV_FIRST+24) #define TVM_GETTOOLTIPS (TV_FIRST+25) +#define TVM_SETINSERTMARK (TV_FIRST+26) +#define TVM_SETITEMHEIGHT (TV_FIRST+27) +#define TVM_GETITEMHEIGHT (TV_FIRST+28) +#define TVM_SETBKCOLOR (TV_FIRST+29) +#define TVM_SETTEXTCOLOR (TV_FIRST+30) +#define TVM_GETBKCOLOR (TV_FIRST+31) +#define TVM_GETTEXTCOLOR (TV_FIRST+32) +#define TVM_SETSCROLLTIME (TV_FIRST+33) +#define TVM_GETSCROLLTIME (TV_FIRST+34) +#define TVM_SETINSERTMARKCOLOR (TV_FIRST+37) +#define TVM_GETINSERTMARKCOLOR (TV_FIRST+38) +#define TVM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define TVM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT + +#define TVN_FIRST (0U-400U) +#define TVN_LAST (0U-499U) + /* Listview control */ @@ -1323,20 +1349,6 @@ typedef struct tagREBARBANDINFOA #define WC_LISTVIEW32W L"SysListView32" #define WC_LISTVIEW WINELIB_NAME_AW(WC_LISTVIEW) -#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 @@ -1360,80 +1372,6 @@ typedef struct tagREBARBANDINFOA #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 @@ -1441,7 +1379,6 @@ typedef struct tagLVCOLUMNW #define LVCF_IMAGE 0x0010 #define LVCF_ORDER 0x0020 - #define LVCFMT_LEFT 0x0000 #define LVCFMT_RIGHT 0x0001 #define LVCFMT_CENTER 0x0002 @@ -1450,25 +1387,10 @@ typedef struct tagLVCOLUMNW #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 @@ -1485,37 +1407,435 @@ typedef int (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM); #define LVIS_OVERLAYMASK 0x0F00 #define LVIS_STATEIMAGEMASK 0xF000 -#define LPNM_LISTVIEW LPNMLISTVIEW -#define NM_LISTVIEW NMLISTVIEW +#define LVM_FIRST 0x1000 +#define LVM_GETBKCOLOR (LVM_FIRST+0) +#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_GETITEM32A (LVM_FIRST+5) +#define LVM_GETITEM32W (LVM_FIRST+75) +#define LVM_GETITEM WINELIB_NAME_AW(LVM_GETITEM) +#define LVM_SETITEM32A (LVM_FIRST+6) +#define LVM_SETITEM32W (LVM_FIRST+76) +#define LVM_SETITEM WINELIB_NAME_AW(LVM_SETITEM) +#define LVM_INSERTITEM32A (LVM_FIRST+7) +#define LVM_INSERTITEM32W (LVM_FIRST+77) +#define LVM_INSERTITEM WINELIB_NAME_AW(LVM_INSERTITEM) +#define LVM_DELETEITEM (LVM_FIRST+8) +#define LVM_DELETEALLITEMS (LVM_FIRST+9) +#define LVM_GETCALLBACKMASK (LVM_FIRST+10) +#define LVM_SETCALLBACKMASK (LVM_FIRST+11) +#define LVM_GETNEXTITEM (LVM_FIRST+12) +#define LVM_FINDITEM32A (LVM_FIRST+13) +#define LVM_FINDITEM32W (LVM_FIRST+83) +#define LVM_FINDITEM WINELIB_NAME_AW(LVM_FINDITEM) +#define LVM_GETITEMRECT (LVM_FIRST+14) +#define LVM_SETITEMPOSITION (LVM_FIRST+15) +#define LVM_GETITEMPOSITION (LVM_FIRST+16) +#define LVM_GETSTRINGWIDTH32A (LVM_FIRST+17) +#define LVM_GETSTRINGWIDTH32W (LVM_FIRST+87) +#define LVM_GETSTRINGWIDTH WINELIB_NAME_AW(LVM_GETSTRINGWIDTH) +#define LVM_HITTEST (LVM_FIRST+18) +#define LVM_ENSUREVISIBLE (LVM_FIRST+19) +#define LVM_SCROLL (LVM_FIRST+20) +#define LVM_REDRAWITEMS (LVM_FIRST+21) +#define LVM_ARRANGE (LVM_FIRST+22) +#define LVM_EDITLABEL32A (LVM_FIRST+23) +#define LVM_EDITLABEL32W (LVM_FIRST+118) +#define LVM_EDITLABEL WINELIB_NAME_AW(LVM_EDITLABEL) +#define LVM_GETEDITCONTROL (LVM_FIRST+24) +#define LVM_GETCOLUMN32A (LVM_FIRST+25) +#define LVM_GETCOLUMN32W (LVM_FIRST+95) +#define LVM_GETCOLUMN WINELIB_NAME_AW(LVM_GETCOLUMN) +#define LVM_SETCOLUMN32A (LVM_FIRST+26) +#define LVM_SETCOLUMN32W (LVM_FIRST+96) +#define LVM_SETCOLUMN WINELIB_NAME_AW(LVM_SETCOLUMN) +#define LVM_INSERTCOLUMN32A (LVM_FIRST+27) +#define LVM_INSERTCOLUMN32W (LVM_FIRST+97) +#define LVM_INSERTCOLUMN WINELIB_NAME_AW(LVM_INSERTCOLUMN) +#define LVM_DELETECOLUMN (LVM_FIRST+28) +#define LVM_GETCOLUMNWIDTH (LVM_FIRST+29) +#define LVM_GETHEADER (LVM_FIRST+30) + +#define LVM_SORTITEMS (LVM_FIRST+48) +#define LVM_GETSELECTEDCOUNT (LVM_FIRST+50) + +#define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+54) +#define LVM_GETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+55) + + +#define LVN_FIRST (0U-100U) +#define LVN_LAST (0U-199U) +#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_BEGINLABELEDIT32A (LVN_FIRST-5) +#define LVN_BEGINLABELEDIT32W (LVN_FIRST-75) +#define LVN_BEGINLABELEDIT WINELIB_NAME_AW(LVN_BEGINLABELEDIT) +#define LVN_ENDLABELEDIT32A (LVN_FIRST-6) +#define LVN_ENDLABELEDIT32W (LVN_FIRST-76) +#define LVN_ENDLABELEDIT WINELIB_NAME_AW(LVN_ENDLABELEDIT) +#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_ODFINDITEM32A (LVN_FIRST-52) +#define LVN_ODFINDITEM32W (LVN_FIRST-79) +#define LVN_ODFINDITEM WINELIB_NAME_AW(LVN_ODFINDITEM) +#define LVN_ITEMACTIVATE (LVN_FIRST-14) +#define LVN_ODSTATECHANGED (LVN_FIRST-15) +#define LVN_HOTTRACK (LVN_FIRST-21) +#define LVN_GETDISPINFO32A (LVN_FIRST-50) +#define LVN_GETDISPINFO32W (LVN_FIRST-77) +#define LVN_GETDISPINFO WINELIB_NAME_AW(LVN_GETDISPINFO) +#define LVN_SETDISPINFO32A (LVN_FIRST-51) +#define LVN_SETDISPINFO32W (LVN_FIRST-78) +#define LVN_SETDISPINFO WINELIB_NAME_AW(LVN_SETDISPINFO) + + +typedef struct tagLVITEMA +{ + UINT32 mask; + INT32 iItem; + INT32 iSubItem; + UINT32 state; + UINT32 stateMask; + LPSTR pszText; + INT32 cchTextMax; + INT32 iImage; + LPARAM lParam; + INT32 iIndent; /* (_WIN32_IE >= 0x0300) */ +} LVITEM32A, *LPLVITEM32A; + +typedef struct tagLVITEMW +{ + UINT32 mask; + INT32 iItem; + INT32 iSubItem; + UINT32 state; + UINT32 stateMask; + LPWSTR pszText; + INT32 cchTextMax; + INT32 iImage; + LPARAM lParam; + INT32 iIndent; /* (_WIN32_IE >= 0x0300) */ +} LVITEM32W, *LPLVITEM32W; + +#define LVITEM32 WINELIB_NAME_AW(LVITEM) +#define LPLVITEM32 WINELIB_NAME_AW(LPLVITEM) + +#define LVITEM_V1_SIZE32A CCSIZEOF_STRUCT(LVITEM32A, lParam) +#define LVITEM_V1_SIZE32W CCSIZEOF_STRUCT(LVITEM32W, lParam) +#define LVITEM_V1_SIZE WINELIB_NAME_AW(LVITEM_V1_SIZE) + +#define LV_ITEM LVITEM + +/* Tab Control */ + +#define WC_TABCONTROL16 "SysTabControl" +#define WC_TABCONTROL32A "SysTabControl32" +#define WC_TABCONTROL32W L"SysTabControl32" + +#define WC_TABCONTROL WINELIB_NAME_AW(WC_TABCONTROL) + +#define TCM_FIRST 0x1300 + +#define TCM_INSERTITEM (TCM_FIRST + 7) +#define TCM_GETCURSEL (TCM_FIRST + 11) + +#define TCIF_TEXT 0x0001 +#define TCIF_IMAGE 0x0002 +#define TCIF_RTLREADING 0x0004 +#define TCIF_PARAM 0x0008 + +typedef struct tagTCITEM { + UINT32 mask; + UINT32 lpReserved1; + UINT32 lpReserved2; + LPSTR pszText; + int cchTextMax; + int iImage; + LPARAM lParam; +} TCITEM, *LPTCITEM; + +#define TCN_FIRST (0U-550U) +#define TCN_LAST (0U-580U) +#define TCN_KEYDOWN (TCN_FIRST - 0) +#define TCN_SELCHANGE (TCN_FIRST - 1) +#define TCN_SELCHANGING (TCN_FIRST - 2) + +typedef struct tagLVCOLUMNA +{ + UINT32 mask; + INT32 fmt; + INT32 cx; + LPSTR pszText; + INT32 cchTextMax; + INT32 iSubItem; + INT32 iImage; /* (_WIN32_IE >= 0x0300) */ + INT32 iOrder; /* (_WIN32_IE >= 0x0300) */ +} LVCOLUMN32A, *LPLVCOLUMN32A; + +typedef struct tagLVCOLUMNW +{ + UINT32 mask; + INT32 fmt; + INT32 cx; + LPWSTR pszText; + INT32 cchTextMax; + INT32 iSubItem; + INT32 iImage; /* (_WIN32_IE >= 0x0300) */ + INT32 iOrder; /* (_WIN32_IE >= 0x0300) */ +} LVCOLUMN32W, *LPLVCOLUMN32W; + +#define LVCOLUMN WINELIB_NAME_AW(LVCOLUMN) +#define LPLVCOLUMN WINELIB_NAME_AW(LPLVCOLUMN) + +#define LVCOLUMN_V1_SIZE32A CCSIZEOF_STRUCT(LVCOLUMN32A, iSubItem) +#define LVCOLUMN_V1_SIZE32W CCSIZEOF_STRUCT(LVCOLUMN32W, iSubItem) +#define LVCOLUMN_V1_SIZE WINELIB_NAME_AW(LVCOLUMN_V1_SIZE) + +#define LV_COLUMN LVCOLUMN + typedef struct tagNMLISTVIEW -{ NMHDR hdr; - int iItem; - int iSubItem; +{ + NMHDR hdr; + INT32 iItem; + INT32 iSubItem; UINT32 uNewState; UINT32 uOldState; UINT32 uChanged; POINT32 ptAction; LPARAM lParam; -} NMLISTVIEW,*LPNMLISTVIEW; +} NMLISTVIEW, *LPNMLISTVIEW; + +#define LPNM_LISTVIEW LPNMLISTVIEW +#define NM_LISTVIEW NMLISTVIEW -#define LV_DISPINFOA NMLVDISPINFOA -#define LV_DISPINFOW NMLVDISPINFOW +typedef struct tagLVDISPINFO +{ + NMHDR hdr; + LVITEM32A item; +} NMLVDISPINFO32A, *LPNMLVDISPINFO32A; + +typedef struct tagLVDISPINFOW +{ + NMHDR hdr; + LVITEM32W item; +} NMLVDISPINFO32W, *LPNMLVDISPINFO32W; + +#define NMLVDISPINFO WINELIB_NAME_AW(NMLVDISPINFO) +#define LPNMLVDISPINFO WINELIB_NAME_AW(LPNMLVDISPINFO) #define LV_DISPINFO NMLVDISPINFO -typedef struct tagLVDISPINFO { - NMHDR hdr; - LVITEMA item; -} NMLVDISPINFOA, *LPNMLVDISPINFOA; -typedef struct tagLVDISPINFOW { - NMHDR hdr; - LVITEMW item; -} NMLVDISPINFOW, * LPNMLVDISPINFOW; +typedef INT32 (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM); -#define NMLVDISPINFO NMLVDISPINFOA +#define ListView_SetBkColor(hwnd,clrBk) \ + (BOOL32)SendMessage32A((hwnd),LVM_SETBKCOLOR,0,(LPARAM)(COLORREF)(clrBk)) +#define ListView_GetImageList(hwnd,iImageList) \ + (HIMAGELIST)SendMessage32A((hwnd),LVM_GETIMAGELIST,(WPARAM)(INT32)(iImageList),0L) +#define ListView_SetImageList(hwnd,himl,iImageList) \ + (HIMAGELIST)(UINT32)SendMessage32A((hwnd),LVM_SETIMAGELIST,(WPARAM32)(iImageList),(LPARAM)(UINT32)(HIMAGELIST)(himl)) +#define ListView_GetItemCount(hwnd) \ + (INT32)SendMessage32A((hwnd),LVM_GETITEMCOUNT,0,0L) +#define ListView_GetItem32A(hwnd,pitem) \ + (BOOL32)SendMessage32A((hwnd),LVM_GETITEM32A,0,(LPARAM)(LVITEM32A *)(pitem)) +#define ListView_GetItem32W(hwnd,pitem) \ + (BOOL32)SendMessage32W((hwnd),LVM_GETITEM32W,0,(LPARAM)(LVITEM32W *)(pitem)) +#define ListView_GetItem WINELIB_NAME_AW(ListView_GetItem) +#define ListView_InsertItem32A(hwnd,pitem) \ + (INT32)SendMessage32A((hwnd),LVM_INSERTITEM32A,0,(LPARAM)(const LVITEM32A *)(pitem)) +#define ListView_InsertItem32W(hwnd,pitem) \ + (INT32)SendMessage32W((hwnd),LVM_INSERTITEM32W,0,(LPARAM)(const LVITEM32W *)(pitem)) +#define ListView_InsertItem WINELIB_NAME_AW(ListView_InsertItem) +#define ListView_DeleteAllItems(hwnd) \ + (BOOL32)SendMessage32A((hwnd),LVM_DELETEALLITEMS,0,0L) +#define ListView_InsertColumn32A(hwnd,iCol,pcol) \ + (INT32)SendMessage32A((hwnd),LVM_INSERTCOLUMN32A,(WPARAM32)(INT32)(iCol),(LPARAM)(const LVCOLUMN32A *)(pcol)) +#define ListView_InsertColumn32W(hwnd,iCol,pcol) \ + (INT32)SendMessage32W((hwnd),LVM_INSERTCOLUMN32W,(WPARAM32)(INT32)(iCol),(LPARAM)(const LVCOLUMN32W *)(pcol)) +#define ListView_InsertColumn WINELIB_NAME_AW(ListView_InsertColumn) +#define ListView_SortItems(hwndLV,_pfnCompare,_lPrm) \ + (BOOL32)SendMessage32A((hwndLV),LVM_SORTITEMS,(WPARAM32)(LPARAM)_lPrm,(LPARAM)(PFNLVCOMPARE)_pfnCompare) +#define ListView_SetItemPosition(hwndLV, i, x, y) \ + (BOOL32)SendMessage32A((hwndLV),LVM_SETITEMPOSITION,(WPARAM32)(INT32)(i),MAKELPARAM((x),(y))) +#define ListView_GetSelectedCount(hwndLV) \ + (UINT32)SendMessage32A((hwndLV),LVM_GETSELECTEDCOUNT,0,0L) + + +/* ComboBoxEx control */ + +#define WC_COMBOBOXEX32A "ComboBoxEx32" +#define WC_COMBOBOXEX32W L"ComboBoxEx32" +#define WC_COMBOBOXEX WINELIB_NAME_AW(WC_COMBOBOXEX) + +#define CBEM_INSERTITEM32A (WM_USER+1) +#define CBEM_INSERTITEM32W (WM_USER+11) +#define CBEM_INSERTITEM WINELIB_NAME_AW(CBEM_INSERTITEM) +#define CBEM_SETIMAGELIST (WM_USER+2) +#define CBEM_GETIMAGELIST (WM_USER+3) +#define CBEM_GETITEM32A (WM_USER+4) +#define CBEM_GETITEM32W (WM_USER+13) +#define CBEM_GETITEM WINELIB_NAME_AW(CBEM_GETITEM) +#define CBEM_SETITEM32A (WM_USER+5) +#define CBEM_SETITEM32W (WM_USER+12) +#define CBEM_SETITEM WINELIB_NAME_AW(CBEM_SETITEM) +#define CBEM_GETCOMBOCONTROL (WM_USER+6) +#define CBEM_GETEDITCONTROL (WM_USER+7) +#define CBEM_SETEXSTYLE (WM_USER+8) +#define CBEM_GETEXSTYLE (WM_USER+9) +#define CBEM_GETEXTENDEDSTYLE (WM_USER+9) +#define CBEM_SETEXTENDEDSTYLE (WM_USER+14) +#define CBEM_HASEDITCHANGED (WM_USER+10) +#define CBEM_SETUNICODEFORMAT CCM_SETUNICODEFORMAT +#define CBEM_GETUNICODEFORMAT CCM_GETUNICODEFORMAT + +#define CBEN_FIRST (0U-800U) +#define CBEN_LAST (0U-830U) + + +/* Hotkey control */ + +#define HOTKEY_CLASS16 "msctls_hotkey" +#define HOTKEY_CLASS32A "msctls_hotkey32" +#define HOTKEY_CLASS32W L"msctls_hotkey32" +#define HOTKEY_CLASS WINELIB_NAME_AW(HOTKEY_CLASS) + +#define HOTKEYF_SHIFT 0x01 +#define HOTKEYF_CONTROL 0x02 +#define HOTKEYF_ALT 0x04 +#define HOTKEYF_EXT 0x08 + +#define HKCOMB_NONE 0x0001 +#define HKCOMB_S 0x0002 +#define HKCOMB_C 0x0004 +#define HKCOMB_A 0x0008 +#define HKCOMB_SC 0x0010 +#define HKCOMB_SA 0x0020 +#define HKCOMB_CA 0x0040 +#define HKCOMB_SCA 0x0080 + +#define HKM_SETHOTKEY (WM_USER+1) +#define HKM_GETHOTKEY (WM_USER+2) +#define HKM_SETRULES (WM_USER+3) + + +/* animate control */ + +#define ANIMATE_CLASS32A "SysAnimate32" +#define ANIMATE_CLASS32W L"SysAnimate32" +#define ANIMATE_CLASS WINELIB_NAME_AW(ANIMATE_CLASS) + +#define ACS_CENTER 0x0001 +#define ACS_TRANSPARENT 0x0002 +#define ACS_AUTOPLAY 0x0004 +#define ACS_TIMER 0x0008 /* no threads, just timers */ + +#define ACM_OPEN32A (WM_USER+100) +#define ACM_OPEN32W (WM_USER+103) +#define ACM_OPEN WINELIB_NAME_AW(ACM_OPEN) +#define ACM_PLAY (WM_USER+101) +#define ACM_STOP (WM_USER+102) + +#define ACN_START 1 +#define ACN_STOP 2 + +#ifndef __WINE__ +#define Animate_Create(hwndP,id,dwStyle,hInstance) \ + CreateWindow(ANIMATE_CLASS,NULL,dwStyle,0,0,0,0,hwndP,(HMENU32)(id),hInstance,NULL) +#define Animate_Open(hwnd,szName) \ + (BOOL32)SNDMSG(hwnd,ACM_OPEN,0,(LPARAM)(LPTSTR)(szName)) +#define Animate_OpenEx(hwnd,hInst,szName) \ + (BOOL32)SNDMSG(hwnd,ACM_OPEN,(WPARAM32)hInst,(LPARAM)(LPTSTR)(szName)) +#define Animate_Play(hwnd,from,to,rep) \ + (BOOL32)SNDMSG(hwnd,ACM_PLAY,(WPARAM32)(UINT32)(rep),(LPARAM)MAKELONG(from,to)) +#define Animate_Stop(hwnd) \ + (BOOL32)SNDMSG(hwnd,ACM_STOP,0,0) +#define Animate_Close(hwnd) \ + Animate_Open(hwnd,NULL) +#define Animate_Seek(hwnd,frame) \ + Animate_Play(hwnd,frame,frame,1) +#endif /* __WINE__ */ + + + +/************************************************************************** + * UNDOCUMENTED functions + */ + +/* local heap memory functions */ + +LPVOID WINAPI COMCTL32_Alloc (DWORD dwSize); +LPVOID WINAPI COMCTL32_ReAlloc (LPVOID lpSrc, DWORD dwSize); +BOOL32 WINAPI COMCTL32_Free (LPVOID lpMem); +DWORD WINAPI COMCTL32_GetSize (LPVOID lpMem); + + +/* Dynamic Storage Array */ + +typedef struct _DSA +{ + INT32 nItemCount; + LPVOID pData; + INT32 nMaxCount; + INT32 nItemSize; + INT32 nGrow; +} DSA, *HDSA; + +HDSA WINAPI DSA_Create (INT32 nSize, INT32 nGrow); +BOOL32 WINAPI DSA_DeleteAllItems (const HDSA hdsa); +INT32 WINAPI DSA_DeleteItem (const HDSA hdsa, INT32 nIndex); +BOOL32 WINAPI DSA_Destroy (const HDSA hdsa); +BOOL32 WINAPI DSA_GetItem (const HDSA hdsa, INT32 nIndex, LPVOID pDest); +LPVOID WINAPI DSA_GetItemPtr (const HDSA hdsa, INT32 nIndex); +INT32 WINAPI DSA_InsertItem (const HDSA hdsa, INT32 nIndex, LPVOID pSrc); +BOOL32 WINAPI DSA_SetItem (const HDSA hdsa, INT32 nIndex, LPVOID pSrc); + + +/* Dynamic Pointer Array */ + +typedef struct _DPA +{ + INT32 nItemCount; + LPVOID *ptrs; + HANDLE32 hHeap; + INT32 nGrow; + INT32 nMaxCount; +} DPA, *HDPA; + +HDPA WINAPI DPA_Create (INT32 nGrow); +HDPA WINAPI DPA_CreateEx (INT32 nGrow, HANDLE32 hHeap); +BOOL32 WINAPI DPA_Destroy (const HDPA hdpa); +HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew); +LPVOID WINAPI DPA_GetPtr (const HDPA hdpa, INT32 i); +INT32 WINAPI DPA_GetPtrIndex (const HDPA hdpa, LPVOID p); +BOOL32 WINAPI DPA_Grow (const HDPA pdpa, INT32 cp); +BOOL32 WINAPI DPA_SetPtr (const HDPA hdpa, INT32 i, LPVOID p); +INT32 WINAPI DPA_InsertPtr (const HDPA hdpa, INT32 i, LPVOID p); +LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT32 i); +BOOL32 WINAPI DPA_DeleteAllPtrs (const HDPA hdpa); + +typedef INT32 (CALLBACK *PFNDPACOMPARE)(LPVOID p1, LPVOID p2, LPARAM lParam); +BOOL32 WINAPI DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam); + +#define DPAS_SORTED 0x0001 +#define DPAS_INSERTBEFORE 0x0002 +#define DPAS_INSERTAFTER 0x0004 + +INT32 WINAPI DPA_Search (const HDPA hdpa, LPVOID pFind, INT32 nStart, + PFNDPACOMPARE pfnCompare, + LPARAM lParam, UINT32 uOptions); + +#define DPA_GetPtrCount(hdpa) (*(INT32*)(hdpa)) +#define DPA_GetPtrPtr(hdpa) (*((LPVOID**)((BYTE*)(hdpa)+sizeof(INT32)))) +#define DPA_FastGetPtr(hdpa,i) (DPA_GetPtrPtr(hdpa)[i]) #endif /* __WINE_COMMCTRL_H */ diff --git a/include/debug.h b/include/debug.h index 962d8260b74..971d4720022 100644 --- a/include/debug.h +++ b/include/debug.h @@ -13,133 +13,137 @@ #define dbch_6 5 #define dbch_accel 6 #define dbch_advapi 7 -#define dbch_aspi 8 -#define dbch_atom 9 -#define dbch_bitblt 10 -#define dbch_bitmap 11 -#define dbch_caret 12 -#define dbch_cd 13 +#define dbch_animate 8 +#define dbch_aspi 9 +#define dbch_atom 10 +#define dbch_bitblt 11 +#define dbch_bitmap 12 +#define dbch_caret 13 #define dbch_cdaudio 14 #define dbch_class 15 #define dbch_clipboard 16 #define dbch_clipping 17 #define dbch_combo 18 -#define dbch_comm 19 -#define dbch_commctrl 20 -#define dbch_commdlg 21 -#define dbch_console 22 -#define dbch_crtdll 23 -#define dbch_cursor 24 -#define dbch_dc 25 -#define dbch_dde 26 -#define dbch_ddeml 27 -#define dbch_ddraw 28 -#define dbch_debug 29 -#define dbch_dialog 30 -#define dbch_dinput 31 -#define dbch_dll 32 -#define dbch_dosfs 33 -#define dbch_dosmem 34 -#define dbch_dplay 35 -#define dbch_driver 36 -#define dbch_dsound 37 -#define dbch_edit 38 -#define dbch_event 39 -#define dbch_exec 40 -#define dbch_file 41 -#define dbch_fixup 42 -#define dbch_font 43 -#define dbch_gdi 44 -#define dbch_global 45 -#define dbch_graphics 46 -#define dbch_header 47 -#define dbch_heap 48 -#define dbch_hook 49 -#define dbch_icon 50 -#define dbch_imagelist 51 -#define dbch_int 52 -#define dbch_int21 53 -#define dbch_int31 54 -#define dbch_key 55 -#define dbch_keyboard 56 -#define dbch_ldt 57 -#define dbch_listbox 58 -#define dbch_listview 59 -#define dbch_local 60 -#define dbch_mci 61 -#define dbch_mcianim 62 -#define dbch_mciwave 63 -#define dbch_mdi 64 -#define dbch_menu 65 -#define dbch_message 66 -#define dbch_metafile 67 -#define dbch_midi 68 -#define dbch_mmaux 69 -#define dbch_mmio 70 -#define dbch_mmsys 71 -#define dbch_mmtime 72 -#define dbch_module 73 -#define dbch_mpr 74 -#define dbch_msg 75 -#define dbch_msvideo 76 -#define dbch_nonclient 77 -#define dbch_ntdll 78 -#define dbch_ole 79 -#define dbch_pager 80 -#define dbch_palette 81 -#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 +#define dbch_comboex 19 +#define dbch_comm 20 +#define dbch_commctrl 21 +#define dbch_commdlg 22 +#define dbch_console 23 +#define dbch_crtdll 24 +#define dbch_cursor 25 +#define dbch_dc 26 +#define dbch_dde 27 +#define dbch_ddeml 28 +#define dbch_ddraw 29 +#define dbch_debug 30 +#define dbch_dialog 31 +#define dbch_dinput 32 +#define dbch_dll 33 +#define dbch_dosfs 34 +#define dbch_dosmem 35 +#define dbch_dplay 36 +#define dbch_driver 37 +#define dbch_dsound 38 +#define dbch_edit 39 +#define dbch_event 40 +#define dbch_exec 41 +#define dbch_file 42 +#define dbch_fixup 43 +#define dbch_font 44 +#define dbch_gdi 45 +#define dbch_global 46 +#define dbch_graphics 47 +#define dbch_header 48 +#define dbch_heap 49 +#define dbch_hook 50 +#define dbch_hotkey 51 +#define dbch_icon 52 +#define dbch_imagelist 53 +#define dbch_int 54 +#define dbch_int10 55 +#define dbch_int21 56 +#define dbch_int31 57 +#define dbch_key 58 +#define dbch_keyboard 59 +#define dbch_ldt 60 +#define dbch_listbox 61 +#define dbch_listview 62 +#define dbch_local 63 +#define dbch_mci 64 +#define dbch_mcianim 65 +#define dbch_mciwave 66 +#define dbch_mdi 67 +#define dbch_menu 68 +#define dbch_message 69 +#define dbch_metafile 70 +#define dbch_midi 71 +#define dbch_mmaux 72 +#define dbch_mmio 73 +#define dbch_mmsys 74 +#define dbch_mmtime 75 +#define dbch_module 76 +#define dbch_mpr 77 +#define dbch_msg 78 +#define dbch_msvideo 79 +#define dbch_nonclient 80 +#define dbch_ntdll 81 +#define dbch_ole 82 +#define dbch_pager 83 +#define dbch_palette 84 +#define dbch_pidl 85 +#define dbch_print 86 +#define dbch_process 87 +#define dbch_profile 88 +#define dbch_progress 89 +#define dbch_prop 90 +#define dbch_psdrv 91 +#define dbch_rebar 92 +#define dbch_reg 93 +#define dbch_region 94 +#define dbch_relay 95 +#define dbch_resource 96 +#define dbch_s 97 +#define dbch_scroll 98 +#define dbch_security 99 +#define dbch_segment 100 +#define dbch_selector 101 +#define dbch_sem 102 +#define dbch_sendmsg 103 +#define dbch_shell 104 +#define dbch_shm 105 +#define dbch_snoop 106 +#define dbch_sound 107 +#define dbch_static 108 +#define dbch_statusbar 109 +#define dbch_stress 110 +#define dbch_string 111 +#define dbch_syscolor 112 +#define dbch_system 113 +#define dbch_tab 114 +#define dbch_task 115 +#define dbch_text 116 +#define dbch_thread 117 +#define dbch_thunk 118 +#define dbch_timer 119 +#define dbch_toolbar 120 +#define dbch_toolhelp 121 +#define dbch_tooltips 122 +#define dbch_trackbar 123 +#define dbch_treeview 124 +#define dbch_tweak 125 +#define dbch_uitools 126 +#define dbch_updown 127 +#define dbch_ver 128 +#define dbch_virtual 129 +#define dbch_vxd 130 +#define dbch_win 131 +#define dbch_win16drv 132 +#define dbch_win32 133 +#define dbch_wing 134 +#define dbch_winsock 135 +#define dbch_wnet 136 +#define dbch_x11 137 +#define dbch_x11drv 138 /* Definitions for classes identifiers */ #define dbcl_fixme 0 #define dbcl_err 1 diff --git a/include/debugdefs.h b/include/debugdefs.h index 60cededb660..7ff6fd7cab8 100644 --- a/include/debugdefs.h +++ b/include/debugdefs.h @@ -4,7 +4,7 @@ #include "debugtools.h" #endif -#define DEBUG_CHANNEL_COUNT 135 +#define DEBUG_CHANNEL_COUNT 139 #ifdef DEBUG_RUNTIME short debug_msg_enabled[][DEBUG_CLASS_COUNT] = { {1, 1, 0, 0}, @@ -142,6 +142,10 @@ short debug_msg_enabled[][DEBUG_CLASS_COUNT] = { {1, 1, 0, 0}, {1, 1, 0, 0}, {1, 1, 0, 0}, +{1, 1, 0, 0}, +{1, 1, 0, 0}, +{1, 1, 0, 0}, +{1, 1, 0, 0}, }; const char* debug_ch_name[] = { "1", @@ -152,17 +156,18 @@ const char* debug_ch_name[] = { "6", "accel", "advapi", +"animate", "aspi", "atom", "bitblt", "bitmap", "caret", -"cd", "cdaudio", "class", "clipboard", "clipping", "combo", +"comboex", "comm", "commctrl", "commdlg", @@ -194,9 +199,11 @@ const char* debug_ch_name[] = { "header", "heap", "hook", +"hotkey", "icon", "imagelist", "int", +"int10", "int21", "int31", "key", @@ -255,6 +262,7 @@ const char* debug_ch_name[] = { "string", "syscolor", "system", +"tab", "task", "text", "thread", diff --git a/include/dosexe.h b/include/dosexe.h index ad3a89205d8..3eb82f573fa 100644 --- a/include/dosexe.h +++ b/include/dosexe.h @@ -28,6 +28,7 @@ typedef struct _DOSTASK { #define MZ_SUPPORTED extern int MZ_InitTask( LPDOSTASK lpDosTask ); +extern int MZ_InitMemory( LPDOSTASK lpDosTask, NE_MODULE *pModule ); extern int MZ_RunModule( LPDOSTASK lpDosTask ); extern void MZ_KillModule( LPDOSTASK lpDosTask ); extern int DOSVM_Process( LPDOSTASK lpDosTask ); diff --git a/include/file.h b/include/file.h index fc5f8067bc7..eb5470882a0 100644 --- a/include/file.h +++ b/include/file.h @@ -21,6 +21,7 @@ typedef struct int mode; char *unix_name; DWORD type; /* Type for win32 apps */ + DWORD pos; /* workaround to emulate weird DOS error handling */ } FILE_OBJECT; /* Definition of a full DOS file name */ @@ -41,14 +42,17 @@ typedef struct } DOS_DEVICE; /* Macros to convert 16 bit to 32 bit file handles and back */ +/* LZW handles are exempt as if not, could go below 0x400 */ #define HFILE16_TO_HFILE32(handle) \ (((handle)==0) ? GetStdHandle(STD_INPUT_HANDLE) : \ ((handle)==1) ? GetStdHandle(STD_OUTPUT_HANDLE) : \ ((handle)==2) ? GetStdHandle(STD_ERROR_HANDLE) : \ + ((handle)>=0x400) ? handle : \ (handle)-5) #define HFILE32_TO_HFILE16(handle) ({ HFILE32 hnd=handle; \ ((hnd==HFILE_ERROR32) ? HFILE_ERROR16 : \ + ((hnd)>=0x400) ? hnd : \ (HFILE16)hnd+5); }) diff --git a/include/gdi.h b/include/gdi.h index c8ca418f7c7..073ffec721f 100644 --- a/include/gdi.h +++ b/include/gdi.h @@ -112,8 +112,6 @@ typedef struct WORD backgroundMode; COLORREF backgroundColor; COLORREF textColor; - int backgroundPixel; - int textPixel; short brushOrgX; short brushOrgY; diff --git a/include/hotkey.h b/include/hotkey.h new file mode 100644 index 00000000000..f583a2e78c1 --- /dev/null +++ b/include/hotkey.h @@ -0,0 +1,22 @@ +/* + * Hotkey class extra info + * + * Copyright 1998 Eric Kohl + */ + +#ifndef __WINE_HOTKEY_H +#define __WINE_HOTKEY_H + + +typedef struct tagHOTKEY_INFO +{ + HFONT32 hFont; + BOOL32 bFocus; + INT32 nHeight; + +} HOTKEY_INFO; + + +extern void HOTKEY_Register (void); + +#endif /* __WINE_HOTKEY_H */ diff --git a/include/imm.h b/include/imm.h new file mode 100644 index 00000000000..5b40a6b1a63 --- /dev/null +++ b/include/imm.h @@ -0,0 +1,24 @@ +/* + * imm.h - Declarations for IMM32 + */ + +#ifndef __WINE_IMM_H +#define __WINE_IMM_H + +typedef DWORD HIMC32; +typedef DWORD HIMCC32; + +typedef HKL32 *LPHKL32; + +typedef int (CALLBACK *REGISTERWORDENUMPROCA)(LPCSTR, DWORD, LPCSTR, LPVOID); +typedef int (CALLBACK *REGISTERWORDENUMPROCW)(LPCWSTR, DWORD, LPCWSTR, LPVOID); + +typedef void *LPCANDIDATELIST; +typedef void *LPCANDIDATEFORM; + +typedef void *LPSTYLEBUFA; +typedef void *LPSTYLEBUFW; + +typedef void *LPCOMPOSITIONFORM; + +#endif /* __WINE_IMM_H */ diff --git a/include/listview.h b/include/listview.h index 7e8c920ea58..10795e7fdc3 100644 --- a/include/listview.h +++ b/include/listview.h @@ -8,10 +8,31 @@ #define __WINE_LISTVIEW_H +typedef struct tagLISTVIEW_ITEM +{ + UINT32 state; + LPSTR pszText; + INT32 iImage; + LPARAM lParam; + INT32 iIndent; + + HDSA hdsaItem; +} LISTVIEW_ITEM; + + typedef struct tagLISTVIEW_INFO { COLORREF clrBk; + HIMAGELIST himlNormal; + HIMAGELIST himlSmall; + HIMAGELIST himlState; + INT32 nItemCount; + HWND32 hwndHeader; + HFONT32 hDefaultFont; + HFONT32 hFont; + RECT32 rcList; /* "client" area of the list (without header) */ + HDSA hdsaItems; } LISTVIEW_INFO; diff --git a/include/metafiledrv.h b/include/metafiledrv.h index b82ac98cfc2..b55b4101c43 100644 --- a/include/metafiledrv.h +++ b/include/metafiledrv.h @@ -68,6 +68,8 @@ extern BOOL32 MFDRV_Polygon( struct tagDC *dc, LPPOINT32 pt, INT32 count ); extern BOOL32 MFDRV_PolyPolygon( struct tagDC *dc, LPPOINT32 pt, LPINT32 counts, UINT32 polygons); extern HGDIOBJ32 MFDRV_SelectObject( DC *dc, HGDIOBJ32 handle ); +extern COLORREF MFDRV_SetBkColor( DC *dc, COLORREF color ); +extern COLORREF MFDRV_SetTextColor( DC *dc, COLORREF color ); extern BOOL32 MFDRV_ExtFloodFill( struct tagDC *dc, INT32 x, INT32 y, COLORREF color, UINT32 fillType ); extern BOOL32 MFDRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y, diff --git a/include/miscemu.h b/include/miscemu.h index 6855762913b..9c2b26ac857 100644 --- a/include/miscemu.h +++ b/include/miscemu.h @@ -14,6 +14,9 @@ extern HANDLE16 DOSMEM_BiosSeg; extern DWORD DOSMEM_CollateTable; +extern DWORD DOSMEM_ErrorCall; +extern DWORD DOSMEM_ErrorBuffer; + extern BOOL32 DOSMEM_Init(HMODULE16 hModule); extern void DOSMEM_Tick(void); extern WORD DOSMEM_AllocSelector(WORD); @@ -29,6 +32,7 @@ extern UINT32 DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */ /* msdos/interrupts.c */ extern FARPROC16 INT_GetHandler( BYTE intnum ); extern void INT_SetHandler( BYTE intnum, FARPROC16 handler ); +extern int INT_RealModeInterrupt( BYTE intnum, PCONTEXT context ); /* msdos/ioports.c */ extern void IO_port_init (void); @@ -39,6 +43,9 @@ extern void IO_outport( int port, int count, DWORD value ); extern DWORD INT1A_GetTicksSinceMidnight(void); extern void WINAPI INT_Int1aHandler(CONTEXT*); +/* msdos/int20.c */ +extern void WINAPI INT_Int20Handler(CONTEXT*); + /* msdos/int2f.c */ extern void WINAPI INT_Int2fHandler(CONTEXT*); diff --git a/include/mmsystem.h b/include/mmsystem.h index a0d46c8a1cd..1e102159545 100644 --- a/include/mmsystem.h +++ b/include/mmsystem.h @@ -191,6 +191,7 @@ BOOL32 WINAPI PlaySound32W(LPCWSTR pszSound, HMODULE32 hmod, DWORD fdwSound); #define SND_ALIAS_ID 0x00110000L /* alias is a predefined ID */ #define SND_FILENAME 0x00020000L /* name is file name */ #define SND_RESOURCE 0x00040004L /* name is resource name or atom */ +#define SND_PURGE 0x00000040L /* purge all sounds */ /* waveform audio error return values */ #define WAVERR_BADFORMAT (WAVERR_BASE + 0) /* unsupported wave format */ diff --git a/include/msdos.h b/include/msdos.h index f154dab296f..dccb0720734 100644 --- a/include/msdos.h +++ b/include/msdos.h @@ -193,7 +193,7 @@ extern BYTE DOS_ErrorClass, DOS_ErrorAction, DOS_ErrorLocus; #define EL_Memory 0x05 void WINAPI DOS3Call( CONTEXT *context ); -void do_mscdex( CONTEXT *context, int dorealmode ); +void do_mscdex( CONTEXT *context ); void do_mscdex_dd (CONTEXT * context, int dorealmode); #endif /* __WINE_MSDOS_H */ diff --git a/include/oledlg.h b/include/oledlg.h new file mode 100644 index 00000000000..1b937fcfe90 --- /dev/null +++ b/include/oledlg.h @@ -0,0 +1,45 @@ +/* + * oledlg.h - Declarations for OLEDLG + */ + +#ifndef __WINE_OLEDLG_H +#define __WINE_OLEDLG_H + +#define OLEUI_FALSE 0 +#define OLEUI_SUCCESS 1 /* Same as OLEUI_OK */ +#define OLEUI_OK 1 /* OK button pressed */ +#define OLEUI_CANCEL 2 /* Cancel button pressed */ + +typedef void *LPOLEUIINSERTOBJECTA; /* FIXME: stub */ +typedef void *LPOLEUIINSERTOBJECTW; /* FIXME: stub */ + +typedef void *LPOLEUIPASTESPECIALA; /* FIXME: stub */ +typedef void *LPOLEUIPASTESPECIALW; /* FIXME: stub */ + +typedef void *LPOLEUIEDITLINKSA; /* FIXME: stub */ +typedef void *LPOLEUIEDITLINKSW; /* FIXME: stub */ + +typedef void *LPOLEUICHANGEICONA; /* FIXME: stub */ +typedef void *LPOLEUICHANGEICONW; /* FIXME: stub */ + +typedef void *LPOLEUICONVERTA; /* FIXME: stub */ +typedef void *LPOLEUICONVERTW; /* FIXME: stub */ + +typedef void *LPOLEUIBUSYA; /* FIXME: stub */ +typedef void *LPOLEUIBUSYW; /* FIXME: stub */ + +typedef void *LPOLEUILINKCONTAINERA; /* FIXME: stub */ +typedef void *LPOLEUILINKCONTAINERW; /* FIXME: stub */ + +typedef void *LPOLEUIOBJECTPROPSA; /* FIXME: stub */ +typedef void *LPOLEUIOBJECTPROPSW; /* FIXME: stub */ + +typedef void *LPOLEUICHANGESOURCEA; /* FIXME: stub */ +typedef void *LPOLEUICHANGESOURCEW; /* FIXME: stub */ + +#endif /* __WINE_OLEDLG_H */ + + + + + diff --git a/include/pager.h b/include/pager.h index 0808084875c..73421474918 100644 --- a/include/pager.h +++ b/include/pager.h @@ -12,11 +12,13 @@ typedef struct tagPAGER_INFO { HWND32 hwndChild; COLORREF clrBk; - INT32 iBorder; - INT32 iButtonSize; - INT32 iPos; + INT32 nBorder; + INT32 nButtonSize; + INT32 nPos; BOOL32 bForward; + INT32 nChildSize; + } PAGER_INFO; diff --git a/include/pe_image.h b/include/pe_image.h index bba57335e3f..cb1d0ddbc4c 100644 --- a/include/pe_image.h +++ b/include/pe_image.h @@ -44,11 +44,12 @@ extern HINSTANCE16 PE_CreateProcess( LPCSTR name, LPCSTR cmd_line, LPCSTR env, LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info ); -struct _PDB32; /* forward definition */ struct _THDB; /* forward definition */ extern void PE_InitializeDLLs(struct _PDB32*,DWORD,LPVOID); extern void PE_InitTls(struct _THDB*); extern LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY,LPCWSTR,DWORD,BOOL32); +typedef DWORD (CALLBACK*DLLENTRYPROC32)(HMODULE32,DWORD,LPVOID); + #endif /* __WINE_PE_IMAGE_H */ diff --git a/include/process.h b/include/process.h index 539aee17453..bce8f7f00fd 100644 --- a/include/process.h +++ b/include/process.h @@ -31,6 +31,9 @@ typedef struct HANDLE_ENTRY entries[1]; } HANDLE_TABLE; +/* Current Process pseudo-handle - Returned by GetCurrentProcess*/ +#define CURRENT_PROCESS_PSEUDOHANDLE ((HANDLE32)0x7fffffff) + /* Win32 process environment database */ typedef struct { diff --git a/include/psdrv.h b/include/psdrv.h index 171e0858c19..f3ee787b7ae 100644 --- a/include/psdrv.h +++ b/include/psdrv.h @@ -6,6 +6,8 @@ */ #include "windows.h" #include "font.h" +#include "pen.h" +#include "brush.h" typedef struct { float llx, lly, urx, ury; @@ -30,6 +32,7 @@ typedef struct _tagAFM { char *FontName; char *FullName; char *FamilyName; + char *EncodingScheme; int Weight; /* FW_NORMAL etc. */ float ItalicAngle; BOOL32 IsFixedPitch; @@ -124,7 +127,7 @@ typedef struct { int LanguageLevel; BOOL32 ColorDevice; int DefaultResolution; - int LandscapeOrientation; + signed int LandscapeOrientation; char *JCLBegin; char *JCLToPSInterpreter; char *JCLEnd; @@ -161,15 +164,50 @@ typedef struct _tagPI { struct _tagPI *next; } PRINTERINFO; +typedef struct { + float r, g, b; +} PSRGB; + +typedef struct { + float i; +} PSGRAY; + + +/* def's for PSCOLOR.type */ +#define PSCOLOR_GRAY 0 +#define PSCOLOR_RGB 1 + +typedef struct { + int type; + union { + PSRGB rgb; + PSGRAY gray; + } value; +} PSCOLOR; + typedef struct { AFM *afm; TEXTMETRIC32A tm; INT32 size; float scale; INT32 escapement; + PSCOLOR color; BOOL32 set; /* Have we done a setfont yet */ } PSFONT; +typedef struct { + PSCOLOR color; + UINT32 style; + BOOL32 set; +} PSBRUSH; + +typedef struct { + INT32 width; + char *dash; + PSCOLOR color; + BOOL32 set; +} PSPEN; + typedef struct { HANDLE16 hJob; LPSTR output; /* Output file/port */ @@ -178,15 +216,19 @@ typedef struct { INT32 PageNo; } JOB; -typedef struct -{ +typedef struct { PSFONT font; /* Current PS font */ + PSPEN pen; + PSBRUSH brush; + PSCOLOR bkColor; + PSCOLOR inkColor; /* Last colour set */ JOB job; PSDRV_DEVMODE16 *Devmode; PRINTERINFO *pi; } PSDRV_PDEVICE; extern HANDLE32 PSDRV_Heap; +extern char *PSDRV_ANSIVector[256]; extern void PSDRV_MergeDevmodes(PSDRV_DEVMODE16 *dm1, PSDRV_DEVMODE16 *dm2, PRINTERINFO *pi); @@ -199,7 +241,19 @@ extern void PSDRV_FreeAFMList( FONTFAMILY *head ); extern BOOL32 PSDRV_Init(void); extern HFONT16 PSDRV_FONT_SelectObject( DC *dc, HFONT16 hfont, FONTOBJ *font); +extern HPEN32 PSDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen ); +extern HBRUSH32 PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, + BRUSHOBJ * brush ); + +extern BOOL32 PSDRV_SetBrush(DC *dc); extern BOOL32 PSDRV_SetFont( DC *dc ); +extern BOOL32 PSDRV_SetPen( DC *dc ); + +extern BOOL32 PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2); +extern BOOL32 PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2); +extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, + COLORREF wincolor ); + extern INT32 PSDRV_WriteHeader( DC *dc, char *title, int len ); extern INT32 PSDRV_WriteFooter( DC *dc ); @@ -210,17 +264,24 @@ extern BOOL32 PSDRV_WriteLineTo(DC *dc, INT32 x, INT32 y); extern BOOL32 PSDRV_WriteStroke(DC *dc); extern BOOL32 PSDRV_WriteRectangle(DC *dc, INT32 x, INT32 y, INT32 width, INT32 height); -extern BOOL32 PSDRV_WriteSetFont(DC *dc); +extern BOOL32 PSDRV_WriteSetFont(DC *dc, BOOL32 UseANSI); extern BOOL32 PSDRV_WriteShow(DC *dc, char *str, INT32 count); extern BOOL32 PSDRV_WriteReencodeFont(DC *dc); +extern BOOL32 PSDRV_WriteSetPen(DC *dc); +extern BOOL32 PSDRV_WriteEllispe(DC *dc, INT32 x, INT32 y, INT32 a, INT32 b); +extern BOOL32 PSDRV_WriteSetColor(DC *dc, PSCOLOR *color); +extern BOOL32 PSDRV_WriteSetBrush(DC *dc); +extern BOOL32 PSDRV_WriteFill(DC *dc); +extern BOOL32 PSDRV_Writegsave(DC *dc); +extern BOOL32 PSDRV_Writegrestore(DC *dc); - - +extern BOOL32 PSDRV_Ellipse(DC *dc, INT32 left, INT32 top, INT32 right, + INT32 bottom); extern BOOL32 PSDRV_EnumDeviceFonts( DC* dc, LPLOGFONT16 plf, DEVICEFONTENUMPROC proc, LPARAM lp ); extern INT32 PSDRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput, @@ -233,11 +294,13 @@ extern BOOL32 PSDRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count, extern BOOL32 PSDRV_GetTextMetrics( DC *dc, TEXTMETRIC32A *metrics ); extern BOOL32 PSDRV_LineTo( DC *dc, INT32 x, INT32 y ); extern BOOL32 PSDRV_MoveToEx( DC *dc, INT32 x, INT32 y, LPPOINT32 pt ); -extern BOOL32 PSDRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count ); extern BOOL32 PSDRV_Polygon( DC *dc, LPPOINT32 pt, INT32 count ); -extern HGDIOBJ32 PSDRV_SelectObject( DC *dc, HGDIOBJ32 handle ); - +extern BOOL32 PSDRV_Polyline( DC *dc, const LPPOINT32 pt, INT32 count ); extern BOOL32 PSDRV_Rectangle(DC *dc, INT32 left, INT32 top, INT32 right, INT32 bottom); -extern BOOL32 PSDRV_Ellipse(DC *dc, INT32 left, INT32 top, INT32 right, - INT32 bottom); +extern HGDIOBJ32 PSDRV_SelectObject( DC *dc, HGDIOBJ32 handle ); +extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color ); +extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color ); + + + diff --git a/include/rebar.h b/include/rebar.h index ff925129770..8dd760bf0ef 100644 --- a/include/rebar.h +++ b/include/rebar.h @@ -27,7 +27,7 @@ typedef struct tagREBAR_BAND UINT32 cxHeader; LPSTR lpText; - + HWND32 hwndPrevParent; } REBAR_BAND; diff --git a/include/region.h b/include/region.h index 263379b2e37..2d7be115689 100644 --- a/include/region.h +++ b/include/region.h @@ -384,11 +384,3 @@ extern BOOL32 REGION_LPTODP( HDC32 hdc, HRGN32 hDest, HRGN32 hSrc ); #endif /* __WINE_REGION_H */ - - - - - - - - diff --git a/include/shell.h b/include/shell.h index e9dc4c52925..3475ca494bf 100644 --- a/include/shell.h +++ b/include/shell.h @@ -93,6 +93,7 @@ typedef struct _NOTIFYICONDATA { /**************************************************************************** * SHITEMID, ITEMIDLIST, PIDL API */ +#pragma pack(1) typedef struct { WORD cb; /* nr of bytes in this item */ BYTE abID[1];/* first byte in this item */ @@ -101,10 +102,12 @@ typedef struct typedef struct { SHITEMID mkid; /* first itemid in list */ } ITEMIDLIST,*LPITEMIDLIST,*LPCITEMIDLIST; +#pragma pack(4) LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl); LPITEMIDLIST WINAPI ILGetNext(LPITEMIDLIST pidl); LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST iil1,LPCITEMIDLIST iil2); +LPITEMIDLIST WINAPI ILFindLastID(LPITEMIDLIST pidl); DWORD WINAPI ILGetSize(LPITEMIDLIST pidl); DWORD WINAPI SHGetPathFromIDList32A (LPCITEMIDLIST pidl,LPSTR pszPath); @@ -161,12 +164,10 @@ typedef struct _SHFILEOPSTRUCTW LPCWSTR lpszProgressTitle; } SHFILEOPSTRUCT32W, *LPSHFILEOPSTRUCT32W; -typedef SHFILEOPSTRUCT32A SHFILEOPSTRUCT32; -typedef LPSHFILEOPSTRUCT32A LPSHFILEOPSTRUCT32; +#define SHFILEOPSTRUCT WINELIB_NAME_AW(SHFILEOPSTRUCT) +#define LPSHFILEOPSTRUCT WINELIB_NAME_AW(LPSHFILEOPSTRUCT) -DECL_WINELIB_TYPE_AW(SHFILEOPSTRUCT) - -DWORD WINAPI SHFileOperation32(LPSHFILEOPSTRUCT32 lpFileOp); +DWORD WINAPI SHFileOperation32(LPSHFILEOPSTRUCT32A lpFileOp); /**************************************************************************** * APPBARDATA @@ -215,6 +216,10 @@ DWORD WINAPI SHChangeNotifyDeregister(LONG x1,LONG x2); DWORD WINAPI SHAddToRecentDocs(UINT32 uFlags, LPCVOID pv); +/**************************************************************************** +* SHGetSpecialFolderLocation API +*/ +HRESULT WINAPI SHGetSpecialFolderLocation(HWND32, INT32, LPITEMIDLIST *); /**************************************************************************** * string and path functions */ @@ -253,4 +258,5 @@ DWORD WINAPI SHFree(LPVOID x); #define CSIDL_FONTS 0x0014 #define CSIDL_TEMPLATES 0x0015 + #endif /* __WINE_SHELL_H */ diff --git a/include/shlobj.h b/include/shlobj.h index 4a900ac4c20..fd4599d4b80 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -26,15 +26,15 @@ DWORD WINAPI SHELL32_DllGetClassObject(LPCLSID,REFIID,LPVOID*); typedef LPVOID LPBC; /* *IBindCtx really */ /* foreward declaration of the objects*/ - -typedef struct IContextMenu IContextMenu, *LPCONTEXTMENU; -typedef struct IShellExtInit IShellExtInit, *LPSHELLEXTINIT; -typedef struct IEnumIDList IEnumIDList, *LPENUMIDLIST; +typedef struct tagCONTEXTMENU *LPCONTEXTMENU, IContextMenu; +typedef struct tagSHELLEXTINIT *LPSHELLEXTINIT,IShellExtInit; +typedef struct tagENUMIDLIST *LPENUMIDLIST, IEnumIDList; typedef struct tagSHELLFOLDER *LPSHELLFOLDER, IShellFolder; typedef struct tagSHELLVIEW *LPSHELLVIEW, IShellView; typedef struct tagSHELLBROWSER *LPSHELLBROWSER,IShellBrowser; typedef struct IDataObject IDataObject, *LPDATAOBJECT; + /**************************************************************************** * SHELL ID */ @@ -48,7 +48,7 @@ DEFINE_SHLGUID(FMTID_InternetSite, 0x000214A1L, 0, 0); DEFINE_SHLGUID(CGID_Explorer, 0x000214D0L, 0, 0); DEFINE_SHLGUID(CGID_ShellDocView, 0x000214D1L, 0, 0); - /* shell32 Interface ids */ + /* shell32interface ids */ DEFINE_SHLGUID(IID_INewShortcutHookA, 0x000214E1L, 0, 0); DEFINE_SHLGUID(IID_IShellBrowser, 0x000214E2L, 0, 0); DEFINE_SHLGUID(IID_IShellView, 0x000214E3L, 0, 0); @@ -85,75 +85,11 @@ typedef struct _STRRET { UINT32 uType; /* STRRET_xxx */ union { LPWSTR pOleStr; /* OLESTR that will be freed */ - UINT32 uOffset; /* Offset into SHITEMID (ANSI) */ + UINT32 uOffset; /* OffsetINT32o SHITEMID (ANSI) */ char cStr[MAX_PATH]; /* Buffer to fill in */ }u; } STRRET,*LPSTRRET; -/**************************************************************************** - * INTERNAL CLASS: PIDL-Manager - * Source: HOWTO extend the explorer namespace - * ftp.microsoft.com/ ... softlib ... regview.exe - */ -#define THIS LPPIDLMGR this -typedef enum tagPIDLTYPE -{ PT_DESKTOP = 0x00000000, - PT_MYCOMP = 0x00000001, - PT_CONTROL = 0x00000002, - PT_RECYCLER =0x00000004, - PT_DRIVE = 0x00000008, - PT_FOLDER = 0x00000010, - PT_VALUE = 0x00000020, - PT_TEXT = PT_FOLDER | PT_VALUE -} PIDLTYPE; - -typedef struct tagPIDLDATA -{ PIDLTYPE type; - CHAR szText[1]; -} PIDLDATA, FAR *LPPIDLDATA; - -typedef struct pidlmgr pidlmgr,*LPPIDLMGR; -typedef struct PidlMgr_VTable -{ STDMETHOD_(LPITEMIDLIST, CreateDesktop) (THIS); - STDMETHOD_(LPITEMIDLIST, CreateMyComputer) (THIS); - STDMETHOD_(LPITEMIDLIST, CreateDrive) (THIS_ LPCSTR); - STDMETHOD_(LPITEMIDLIST, CreateFolder) (THIS_ LPCSTR); - STDMETHOD_(LPITEMIDLIST, CreateValue) (THIS_ LPCSTR); - - 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); - STDMETHOD_(BOOL32, GetValueType) (THIS_ LPCITEMIDLIST, LPCITEMIDLIST, LPDWORD); - STDMETHOD_(DWORD, GetDataText) (THIS_ LPCITEMIDLIST, LPCITEMIDLIST, LPSTR, DWORD); - STDMETHOD_(DWORD, GetPidlPath) (THIS_ LPCITEMIDLIST, LPSTR, DWORD); - STDMETHOD_(LPITEMIDLIST, Create) (THIS_ PIDLTYPE, LPVOID, UINT16); - STDMETHOD_(DWORD, GetData) (THIS_ PIDLTYPE, LPCITEMIDLIST, LPVOID, UINT16); - STDMETHOD_(LPPIDLDATA, GetDataPointer) (THIS_ LPCITEMIDLIST); - STDMETHOD_(BOOL32, SeparatePathAndValue) (THIS_ LPCITEMIDLIST, LPITEMIDLIST*, LPITEMIDLIST*); - -} *LPPIDLMGR_VTABLE,PidlMgr_VTable; - -struct pidlmgr -{ LPPIDLMGR_VTABLE lpvtbl; -}; - -#ifdef __WINE__ -extern LPPIDLMGR PidlMgr_Constructor(); -extern void PidlMgr_Destructor(THIS); -#endif - -#undef THIS /***************************************************************************** * IContextMenu interface */ @@ -207,27 +143,27 @@ extern void PidlMgr_Destructor(THIS); #define CMIC_MASK_PTINVOKE 0x20000000 /*NOTE: When SEE_MASK_HMONITOR is set, hIcon is treated as hMonitor */ -typedef struct _CMINVOKECOMMANDINFO +typedef struct tagCMINVOKECOMMANDINFO { 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 + INT32 nShow; // one of SW_ values for ShowWindow() API DWORD dwHotKey; HANDLE32 hIcon; -} CMINVOKECOMMANDINFO, *LPCMINVOKECOMMANDINFO; +} CMINVOKECOMMANDINFO32, *LPCMINVOKECOMMANDINFO32; -typedef struct _CMInvokeCommandInfoEx +typedef struct tagCMInvokeCommandInfoEx { 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 + INT32 nShow; // one of SW_ values for ShowWindow() API DWORD dwHotKey; @@ -239,7 +175,7 @@ typedef struct _CMInvokeCommandInfoEx LPCWSTR lpTitleW; // Unicode title (for those who can use it) POINT32 ptInvoke; // Point where it's invoked -} CMINVOKECOMMANDINFOEX, *LPCMINVOKECOMMANDINFOEX; +} CMINVOKECOMMANDINFOEX32, *LPCMINVOKECOMMANDINFOEX32; typedef struct IContextMenu_VTable @@ -249,16 +185,21 @@ typedef struct IContextMenu_VTable 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(InvokeCommand)(THIS_ LPCMINVOKECOMMANDINFO32 lpici) PURE; STDMETHOD(GetCommandString)(THIS_ UINT32 idCmd,UINT32 uType,UINT32 * pwReserved,LPSTR pszName,UINT32 cchMax) PURE; + + /* undocumented not only in ContextMenu2 */ + STDMETHOD(HandleMenuMsg)(THIS_ UINT32 uMsg,WPARAM32 wParam,LPARAM lParam) PURE; + + /* possibly another nasty entry from ContextMenu3 ?*/ + void * guard; } IContextMenu_VTable,*LPCONTEXTMENU_VTABLE; -struct IContextMenu +struct tagCONTEXTMENU { LPCONTEXTMENU_VTABLE lpvtbl; DWORD ref; LPSHELLFOLDER pSFParent; LPITEMIDLIST *aPidls; - LPPIDLMGR pPidlMgr; BOOL32 bAllValues; }; @@ -278,7 +219,7 @@ typedef struct IShellExtInit_VTable STDMETHOD(Initialize)(THIS_ LPCITEMIDLIST pidlFolder, LPDATAOBJECT lpdobj, HKEY hkeyProgID) PURE; } IShellExtInit_VTable,*LPSHELLEXTINIT_VTABLE; -struct IShellExtInit +struct tagSHELLEXTINIT { LPSHELLEXTINIT_VTABLE lpvtbl; DWORD ref; }; @@ -316,10 +257,9 @@ typedef struct IEnumIDList_VTable } IEnumIDList_VTable,*LPENUMIDLIST_VTABLE; -struct IEnumIDList +struct tagENUMIDLIST { LPENUMIDLIST_VTABLE lpvtbl; - DWORD ref; - LPPIDLMGR mpPidlMgr; + DWORD ref; LPENUMLIST mpFirst; LPENUMLIST mpLast; LPENUMLIST mpCurrent; @@ -456,7 +396,6 @@ struct tagSHELLFOLDER { LPSHELLFOLDER_VTABLE lpvtbl; DWORD ref; LPSTR mlpszFolder; - LPPIDLMGR pPidlMgr; LPITEMIDLIST mpidl; LPITEMIDLIST mpidlNSRoot; LPSHELLFOLDER mpSFParent; @@ -466,7 +405,7 @@ extern LPSHELLFOLDER pdesktopfolder; #undef THIS /************************************************************************ -* IShellBrowser Inteface +* IShellBrowser interface */ #define THIS LPSHELLBROWSER this @@ -512,7 +451,7 @@ struct tagSHELLBROWSER #undef THIS /************************************************************************ -* IShellView Inteface +* IShellView interface */ #define THIS LPSHELLVIEW this @@ -646,18 +585,18 @@ typedef struct IShellLink_VTable STDMETHOD_(ULONG,AddRef) (THIS) PURE; STDMETHOD_(ULONG,Release) (THIS) PURE; - STDMETHOD(GetPath)(THIS_ LPSTR pszFile, INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE; + STDMETHOD(GetPath)(THIS_ LPSTR pszFile,INT32 cchMaxPath, WIN32_FIND_DATA32A *pfd, DWORD fFlags) PURE; STDMETHOD(GetIDList)(THIS_ LPITEMIDLIST * ppidl) PURE; STDMETHOD(SetIDList)(THIS_ LPCITEMIDLIST pidl) PURE; - STDMETHOD(GetDescription)(THIS_ LPSTR pszName, int cchMaxName) PURE; + STDMETHOD(GetDescription)(THIS_ LPSTR pszName,INT32 cchMaxName) PURE; STDMETHOD(SetDescription)(THIS_ LPCSTR pszName) PURE; - STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir, int cchMaxPath) PURE; + STDMETHOD(GetWorkingDirectory)(THIS_ LPSTR pszDir,INT32 cchMaxPath) PURE; STDMETHOD(SetWorkingDirectory)(THIS_ LPCSTR pszDir) PURE; - STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs, int cchMaxPath) PURE; + STDMETHOD(GetArguments)(THIS_ LPSTR pszArgs,INT32 cchMaxPath) PURE; STDMETHOD(SetArguments)(THIS_ LPCSTR pszArgs) PURE; STDMETHOD(GetHotkey)(THIS_ WORD *pwHotkey) PURE; @@ -666,8 +605,8 @@ typedef struct IShellLink_VTable STDMETHOD(GetShowCmd)(THIS_ INT32 *piShowCmd) PURE; STDMETHOD(SetShowCmd)(THIS_ INT32 iShowCmd) PURE; - STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath, INT32 cchIconPath, INT32 *piIcon) PURE; - STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath, INT32 iIcon) PURE; + STDMETHOD(GetIconLocation)(THIS_ LPSTR pszIconPath,INT32 cchIconPath,INT32 *piIcon) PURE; + STDMETHOD(SetIconLocation)(THIS_ LPCSTR pszIconPath,INT32 iIcon) PURE; STDMETHOD(SetRelativePath)(THIS_ LPCSTR pszPathRel, DWORD dwReserved) PURE; @@ -684,7 +623,7 @@ struct IShellLink { #undef THIS /**************************************************************************** - * IExtractIcon interface + * IExtractIconinterface * * FIXME * Is the ExtractIconA interface @@ -711,7 +650,7 @@ typedef struct IExtractIcon_VTable STDMETHOD_(ULONG,Release) (THIS) PURE; /*** IExtractIcon methods ***/ - STDMETHOD(GetIconLocation)(THIS_ UINT32 uFlags, LPSTR szIconFile, UINT32 cchMax, int * piIndex, UINT32 * pwFlags) PURE; + STDMETHOD(GetIconLocation)(THIS_ UINT32 uFlags, LPSTR szIconFile, UINT32 cchMax,INT32 * piIndex, UINT32 * pwFlags) PURE; STDMETHOD(Extract)(THIS_ LPCSTR pszFile, UINT32 nIconIndex, HICON32 *phiconLarge, HICON32 *phiconSmall, UINT32 nIconSize) PURE; }IExtractIccon_VTable,*LPEXTRACTICON_VTABLE; @@ -796,7 +735,7 @@ typedef struct _SHELLEXECUTEINFOA LPCSTR lpFile; LPCSTR lpParameters; LPCSTR lpDirectory; - int nShow; + INT32 nShow; HINSTANCE32 hInstApp; /* Optional fields */ LPVOID lpIDList; @@ -808,7 +747,7 @@ typedef struct _SHELLEXECUTEINFOA HANDLE32 hMonitor; } u; HANDLE32 hProcess; -} SHELLEXECUTEINFOA, *LPSHELLEXECUTEINFOA; +} SHELLEXECUTEINFO32A, *LPSHELLEXECUTEINFO32A; typedef struct _SHELLEXECUTEINFOW { DWORD cbSize; @@ -818,7 +757,7 @@ typedef struct _SHELLEXECUTEINFOW LPCWSTR lpFile; LPCWSTR lpParameters; LPCWSTR lpDirectory; - int nShow; + INT32 nShow; HINSTANCE32 hInstApp; /* Optional fields*/ LPVOID lpIDList; @@ -830,19 +769,17 @@ typedef struct _SHELLEXECUTEINFOW HANDLE32 hMonitor; } u; HANDLE32 hProcess; -} SHELLEXECUTEINFOW, *LPSHELLEXECUTEINFOW; +} SHELLEXECUTEINFO32W, *LPSHELLEXECUTEINFO32W; -DECL_WINELIB_TYPE_AW(SHELLEXECUTEINFO) +#define SHELLEXECUTEINFO WINELIB_NAME_AW(SHELLEXECUTEINFO) +#define LPSHELLEXECUTEINFO WINELIB_NAME_AW(LPSHELLEXECUTEINFO) -typedef SHELLEXECUTEINFOA SHELLEXECUTEINFO; -typedef LPSHELLEXECUTEINFOA LPSHELLEXECUTEINFO; - -BOOL32 WINAPI ShellExecuteEx32A(LPSHELLEXECUTEINFOA lpExecInfo); -BOOL32 WINAPI ShellExecuteEx32W(LPSHELLEXECUTEINFOW lpExecInfo); +BOOL32 WINAPI ShellExecuteEx32A(LPSHELLEXECUTEINFO32A lpExecInfo); +BOOL32 WINAPI ShellExecuteEx32W(LPSHELLEXECUTEINFO32W 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); +void WINAPI WinExecError32A(HWND32 hwnd,INT32 error, LPCSTR lpstrFileName, LPCSTR lpstrTitle); +void WINAPI WinExecError32W(HWND32 hwnd,INT32 error, LPCWSTR lpstrFileName, LPCWSTR lpstrTitle); #define WinExecError WINELIB_NAME_AW(WinExecError) @@ -850,7 +787,7 @@ void WINAPI WinExecErrorW(HWND32 hwnd, int error, LPCWSTR lpstrFileName, LPCWSTR /**************************************************************************** * SHBrowseForFolder API */ -typedef int (CALLBACK* BFFCALLBACK)(HWND32 hwnd, UINT32 uMsg, LPARAM lParam, LPARAM lpData); +typedef INT32 (CALLBACK* BFFCALLBACK)(HWND32 hwnd, UINT32 uMsg, LPARAM lParam, LPARAM lpData); typedef struct tagBROWSEINFO32A { HWND32 hwndOwner; @@ -860,7 +797,7 @@ typedef struct tagBROWSEINFO32A { UINT32 ulFlags; BFFCALLBACK lpfn; LPARAM lParam; - int iImage; + INT32 iImage; } BROWSEINFO32A, *PBROWSEINFO32A, *LPBROWSEINFO32A; typedef struct tagBROWSEINFO32W { @@ -871,7 +808,7 @@ typedef struct tagBROWSEINFO32W { UINT32 ulFlags; BFFCALLBACK lpfn; LPARAM lParam; - int iImage; + INT32 iImage; } BROWSEINFO32W, *PBROWSEINFO32W, *LPBROWSEINFO32W; #define BROWSEINFO WINELIB_NAME_AW(BROWSEINFO) @@ -961,7 +898,7 @@ typedef struct _SHELLVIEWDATA // idl /* The shell keeps track of some per-user state to handle display - options that is of major interest to ISVs. + options that is of majorinterest to ISVs. The key one requested right now is "DoubleClickInWebView". */ typedef struct diff --git a/include/tab.h b/include/tab.h new file mode 100644 index 00000000000..6b0b6311dbe --- /dev/null +++ b/include/tab.h @@ -0,0 +1,36 @@ +/* + * Tab control class extra info + * + * Copyright 1998 Anders Carlsson + */ + +#ifndef __WINE_TAB_H +#define __WINE_TAB_H + +typedef struct tagTAB_ITEM +{ + UINT32 mask; + UINT32 lpReserved1; + UINT32 lpReserved2; + LPSTR pszText; + INT32 cchTextMax; + INT32 iImage; + LPARAM lParam; + RECT32 rect; /* bounding rectangle of the item */ +} TAB_ITEM; + +typedef struct tagTAB_INFO +{ + UINT32 uNumItem; /* number of tab items */ + INT32 nHeight; /* height of the tab row */ + HFONT32 hFont; /* handle to the current font */ + HCURSOR32 hcurArrow; /* handle to the current cursor */ + INT32 iSelected; /* the currently selected item */ + TAB_ITEM *items; /* pointer to an array of TAB_ITEM's */ + RECT32 rect; +} TAB_INFO; + + +extern void TAB_Register (void); + +#endif /* __WINE_TAB_H */ diff --git a/include/thread.h b/include/thread.h index 58ad89a64e9..22e62bfd5e6 100644 --- a/include/thread.h +++ b/include/thread.h @@ -114,6 +114,9 @@ typedef THREAD_ENTRY *THREAD_QUEUE; #define THREAD_ID_TO_THDB(id) ((THDB *)((id) ^ THREAD_OBFUSCATOR)) #define THDB_TO_THREAD_ID(thdb) ((DWORD)(thdb) ^ THREAD_OBFUSCATOR) +/* The pseudo handle value returned by GetCurrentThread */ +#define CURRENT_THREAD_PSEUDOHANDLE 0xfffffffe + #ifdef __i386__ /* On the i386, the current thread is in the %fs register */ # define SET_CUR_THREAD(thdb) SET_FS((thdb)->teb_sel) diff --git a/include/toolbar.h b/include/toolbar.h index 4af9f98ff8b..1f4f4434c07 100644 --- a/include/toolbar.h +++ b/include/toolbar.h @@ -53,9 +53,9 @@ typedef struct tagTOOLBAR_INFO BOOL32 bTransparent; /* background transparency flag */ BOOL32 bAutoSize; /* auto size deadlock indicator */ DWORD dwExStyle; /* extended toolbar style */ - SIZE32 maxSize; /* maximum toolbar size */ COLORREF clrInsertMark; /* insert mark color */ + RECT32 rcBound; /* bounding rectangle */ TBUTTON_INFO *buttons; /* pointer to button array */ CHAR **strings; diff --git a/include/tooltips.h b/include/tooltips.h index 2750cb47b55..d0d0c72a79a 100644 --- a/include/tooltips.h +++ b/include/tooltips.h @@ -30,25 +30,25 @@ typedef struct tagTTTOOL_INFO typedef struct tagTOOLTIPS_INFO { - CHAR szTipText[INFOTIPSIZE]; - BOOL32 bActive; - BOOL32 bTrackActive; - UINT32 uNumTools; - COLORREF clrBk; - COLORREF clrText; - HFONT32 hFont; - INT32 xTrackPos; - INT32 yTrackPos; - INT32 nMaxTipWidth; - INT32 nTool; - INT32 nOldTool; - INT32 nCurrentTool; - INT32 nTrackTool; - INT32 nAutomaticTime; - INT32 nReshowTime; - INT32 nAutoPopTime; - INT32 nInitialTime; - RECT32 rcMargin; + CHAR szTipText[INFOTIPSIZE]; + BOOL32 bActive; + BOOL32 bTrackActive; + UINT32 uNumTools; + COLORREF clrBk; + COLORREF clrText; + HFONT32 hFont; + INT32 xTrackPos; + INT32 yTrackPos; + INT32 nMaxTipWidth; + INT32 nTool; + INT32 nOldTool; + INT32 nCurrentTool; + INT32 nTrackTool; + INT32 nAutomaticTime; + INT32 nReshowTime; + INT32 nAutoPopTime; + INT32 nInitialTime; + RECT32 rcMargin; TTTOOL_INFO *tools; } TOOLTIPS_INFO; diff --git a/include/trackbar.h b/include/trackbar.h index 0645f6a4780..f9ee1e806a1 100644 --- a/include/trackbar.h +++ b/include/trackbar.h @@ -16,10 +16,17 @@ typedef struct tagTRACKBAR_INFO INT32 nSelMin; INT32 nSelMax; INT32 nPos; - INT32 nThumbLen; + UINT32 uThumbLen; + UINT32 uNumTics; + HWND32 hwndToolTip; + HWND32 hwndBuddyLA; + HWND32 hwndBuddyRB; + INT32 fLocation; BOOL32 bFocus; RECT32 rcChannel; + RECT32 rcThumb; + LPLONG tics; } TRACKBAR_INFO; diff --git a/include/ts_xlib.h b/include/ts_xlib.h index f78176c97f8..5a100f97c78 100644 --- a/include/ts_xlib.h +++ b/include/ts_xlib.h @@ -124,6 +124,7 @@ extern int TSXUngrabServer(Display*); extern int TSXUninstallColormap(Display*, Colormap); extern int TSXUnmapWindow(Display*, Window); extern int TSXWarpPointer(Display*, Window, Window, int, int, unsigned int, unsigned int, int, int); +extern XIM TSXOpenIM(Display*, struct _XrmHashBucketRec*, char*, char*); extern int (*TSXSynchronize(Display *, Bool))(Display *); extern void TS_XInitImageFuncPtrs(XImage *); diff --git a/include/version.h b/include/version.h index a6ca1205389..0062e057e80 100644 --- a/include/version.h +++ b/include/version.h @@ -1 +1 @@ -#define WINE_RELEASE_INFO "Wine release 980822" +#define WINE_RELEASE_INFO "Wine release 980913" diff --git a/include/windows.h b/include/windows.h index e5c9f74f69e..8765e68b204 100644 --- a/include/windows.h +++ b/include/windows.h @@ -8702,6 +8702,9 @@ BOOL32 WINAPI ResizePalette32(HPALETTE32,UINT32); BOOL16 WINAPI RestoreDC16(HDC16,INT16); BOOL32 WINAPI RestoreDC32(HDC32,INT32); #define RestoreDC WINELIB_NAME(RestoreDC) +HRESULT WINAPI RevokeDragDrop16(HWND16); +HRESULT WINAPI RevokeDragDrop32(HWND32); +#define RevokeDragDrop WINELIB_NAME(RevokeDragDrop) BOOL16 WINAPI RoundRect16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16); BOOL32 WINAPI RoundRect32(HDC32,INT32,INT32,INT32,INT32,INT32,INT32); #define RoundRect WINELIB_NAME(RoundRect) @@ -9169,6 +9172,8 @@ BOOL32 WINAPI WritePrivateProfileSection32W(LPCWSTR,LPCWSTR,LPCWSTR); BOOL16 WINAPI WritePrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPCSTR); BOOL32 WINAPI WritePrivateProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPCSTR); BOOL32 WINAPI WritePrivateProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR); +BOOL32 WINAPI WriteProfileSection32A(LPCSTR,LPCSTR); +BOOL32 WINAPI WriteProfileSection32W(LPCWSTR,LPCWSTR); #define WritePrivateProfileString WINELIB_NAME_AW(WritePrivateProfileString) BOOL16 WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR); BOOL32 WINAPI WritePrivateProfileStruct32A(LPCSTR,LPCSTR,LPVOID,UINT32,LPCSTR); diff --git a/include/winerror.h b/include/winerror.h index 91db7950df3..1d368fb5d00 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -13,7 +13,8 @@ extern int WIN32_LastError; ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) #define MAKE_SCODE(sev,fac,code) \ ((SCODE) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) - +#define SUCCEEDED(stat) ((HRESULT)(stat)>=0) +#define FAILED(stat) ((HRESULT)(stat)<0) /* ERROR_UNKNOWN is a placeholder for error conditions which haven't * been tested yet so we're not exactly sure what will be returned. @@ -59,6 +60,7 @@ extern int WIN32_LastError; #define ERROR_NOT_OWNER 288 #define ERROR_TOO_MANY_POSTS 298 #define ERROR_INVALID_ADDRESS 487 +#define ERROR_INVALID_ACCESS_TO_MEM 998 #define ERROR_CAN_NOT_COMPLETE 1003 #define ERROR_BADKEY 1010 /* Config reg key invalid */ #define ERROR_CANTREAD 1012 /* Config reg key couldn't be read */ diff --git a/include/winnls.h b/include/winnls.h index 4967925a6a3..50249988df0 100644 --- a/include/winnls.h +++ b/include/winnls.h @@ -289,6 +289,9 @@ #define DATE_LONGDATE 0x00000002 /* use long date picture */ #define DATE_USE_ALT_CALENDAR 0x00000004 /* use alternate calendar */ /* alt. calendar support is broken anyway */ + +#define TIME_FORCE24HOURFORMAT 0x00000008 /* force 24 hour format*/ +#define TIME_NOTIMEMARKER 0x00000004 /* show no AM/PM */ #define TIME_NOSECONDS 0x00000002 /* show no seconds */ #define TIME_NOMINUTESORSECONDS 0x0000001 /* show no minutes either */ diff --git a/include/x11drv.h b/include/x11drv.h index 5968388794e..cb05e0d1971 100644 --- a/include/x11drv.h +++ b/include/x11drv.h @@ -43,6 +43,8 @@ typedef struct X_PHYSFONT font; X_PHYSPEN pen; X_PHYSBRUSH brush; + int backgroundPixel; + int textPixel; } X11DRV_PDEVICE; typedef INT32 (*DEVICEFONTENUMPROC)(LPENUMLOGFONT16,LPNEWTEXTMETRIC16,UINT16,LPARAM); @@ -102,6 +104,8 @@ extern BOOL32 X11DRV_PolyPolyline( struct tagDC *dc, LPPOINT32 pt, extern HGDIOBJ32 X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ32 handle ); +extern COLORREF X11DRV_SetBkColor( struct tagDC *dc, COLORREF color ); +extern COLORREF X11DRV_SetTextColor( struct tagDC *dc, COLORREF color ); extern BOOL32 X11DRV_ExtFloodFill( struct tagDC *dc, INT32 x, INT32 y, COLORREF color, UINT32 fillType ); extern BOOL32 X11DRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y, diff --git a/libtest/hello4.c b/libtest/hello4.c index 964c52192ee..b625f65167a 100644 --- a/libtest/hello4.c +++ b/libtest/hello4.c @@ -3,12 +3,15 @@ void Write (HDC dc, int x, int y, char *s) { + SetBkMode(dc, TRANSPARENT); TextOut (dc, x, y, s, strlen (s)); } LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) { static short xChar, yChar; + static RECT rectHola; + static char* strHola = "Hola"; HDC dc; PAINTSTRUCT ps; TEXTMETRIC tm; @@ -19,12 +22,20 @@ LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) GetTextMetrics (dc, &tm); xChar = tm.tmAveCharWidth; yChar = tm.tmHeight; + GetTextExtentPoint32( dc, strHola, strlen(strHola), ((LPSIZE)&rectHola) + 1 ); + OffsetRect( &rectHola, xChar, yChar ); ReleaseDC (wnd, dc); break; + case WM_HSCROLL: + case WM_VSCROLL: + InvalidateRect(wnd, &rectHola, TRUE ); + ScrollChildren32(wnd, msg, w, l); + return 0; + case WM_PAINT: dc = BeginPaint (wnd, &ps); - Write (dc, xChar, yChar, "Hola"); + Write (dc, xChar, yChar, strHola); EndPaint (wnd, &ps); break; @@ -41,6 +52,7 @@ LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l) LRESULT WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l) { static short xChar, yChar; + static RECT rectInfo; char buf[128]; HDC dc; PAINTSTRUCT ps; @@ -59,10 +71,19 @@ LRESULT WndProc2 (HWND wnd, UINT msg, WPARAM w, LPARAM l) dc = BeginPaint (wnd, &ps); sprintf(buf,"ps.rcPaint = {left = %d, top = %d, right = %d, bottom = %d}", ps.rcPaint.left,ps.rcPaint.top,ps.rcPaint.right,ps.rcPaint.bottom); + rectInfo.left = rectInfo.top = 0; + GetTextExtentPoint32 (dc, buf, strlen(buf), ((LPSIZE)&rectInfo) + 1 ); + OffsetRect (&rectInfo, xChar, yChar ); Write (dc, xChar, yChar, buf); EndPaint (wnd, &ps); break; + case WM_MOVE: + case WM_SIZE: + InvalidateRect( wnd, &rectInfo, TRUE ); + CalcChildScroll( (UINT16)GetParent(wnd), SB_BOTH ); + break; + case WM_DESTROY: PostQuitMessage (0); break; @@ -97,19 +118,20 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show) return FALSE; } - wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW, + wnd = CreateWindow (className, winName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, inst, 0); if (!prev){ class.lpfnWndProc = WndProc2; class.lpszClassName = class2Name; + class.hbrBackground = GetStockObject(GRAY_BRUSH); if (!RegisterClass (&class)) return FALSE; } - wnd2= CreateWindow (class2Name,"Test app", WS_BORDER | WS_CHILD, - 50, 50, 350, 50, wnd, 0, inst, 0); + wnd2= CreateWindow (class2Name,"Child window", WS_CAPTION | WS_CHILD | WS_THICKFRAME, + 50, 50, 350, 100, wnd, 0, inst, 0); ShowWindow (wnd, show); UpdateWindow (wnd); diff --git a/loader/dos/Makefile.in b/loader/dos/Makefile.in index 67b4c7a9a08..257425d723e 100644 --- a/loader/dos/Makefile.in +++ b/loader/dos/Makefile.in @@ -14,7 +14,7 @@ PROGRAMS = dosmod all: $(MODULE).o $(PROGRAMS) dosmod: dosmod.c - $(CC) $(ALLCFLAGS) -o dosmod $< + $(CC) $(ALLCFLAGS) -o dosmod dosmod.c @MAKE_RULES@ diff --git a/loader/dos/dosmod.c b/loader/dos/dosmod.c index 9807ecf580f..1be21714490 100644 --- a/loader/dos/dosmod.c +++ b/loader/dos/dosmod.c @@ -22,12 +22,14 @@ asm(".org 0x110000"); #include #include #include -#include #include #include #include -/* FIXME: hack because libc vm86 may be the old syscall version */ + /* FIXME: hack because libc vm86 may be the old syscall version */ + +#define SYS_vm86 166 + static __inline__ int vm86plus( int func, struct vm86plus_struct *ptr ) { int res; diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c index ec2e91d8a2e..9b4abb875fa 100644 --- a/loader/dos/dosvm.c +++ b/loader/dos/dosvm.c @@ -6,8 +6,6 @@ * This code hasn't been completely cleaned up yet. */ -#ifdef linux - #include #include #include @@ -28,6 +26,8 @@ #include "ldt.h" #include "dosexe.h" +#ifdef MZ_SUPPORTED + static void DOSVM_Dump( LPDOSTASK lpDosTask) { unsigned iofs; @@ -64,24 +64,10 @@ static void DOSVM_Dump( LPDOSTASK lpDosTask) exit(0); } -static int DOSVM_Int(int vect, LPDOSTASK lpDosTask, PCONTEXT context ) +static int DOSVM_Int(int vect, 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; - case 0x21: - if (AH_reg(context)==0x4c) return -1; - DOS3Call(context); - break; - case 0x1a: - INT_Int1aHandler(context); - break; - case 0x2f: - INT_Int2fHandler(context); - break; - } + /* moved to INT_RealModeInterrupt in msdos/interrupts.c */ + INT_RealModeInterrupt(vect,context); return 0; } @@ -109,8 +95,8 @@ int DOSVM_Process( LPDOSTASK lpDosTask ) DOSVM_Dump(lpDosTask); break; case VM86_INTx: - TRACE(int,"DOS EXE calls INT %02x\n",VM86_ARG(lpDosTask->fn)); - ret=DOSVM_Int(VM86_ARG(lpDosTask->fn),lpDosTask,&context); break; + TRACE(int,"DOS EXE calls INT %02x with AX=%04lx\n",VM86_ARG(lpDosTask->fn),context.Eax); + ret=DOSVM_Int(VM86_ARG(lpDosTask->fn),&context); break; case VM86_STI: break; case VM86_PICRETURN: @@ -144,9 +130,9 @@ int DOSVM_Enter( PCONTEXT context ) /* 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); + stat=MZ_InitMemory(lpDosTask,pModule); + if (stat>=32) stat=MZ_InitTask(lpDosTask); if (stat<32) { free(lpDosTask); return -1; @@ -177,7 +163,7 @@ int DOSVM_Enter( PCONTEXT context ) return 0; } -#else /* !linux */ +#else /* !MZ_SUPPORTED */ int DOSVM_Enter( PCONTEXT context ) { @@ -185,4 +171,4 @@ int DOSVM_Enter( PCONTEXT context ) return -1; } -#endif /* linux */ +#endif diff --git a/loader/dos/module.c b/loader/dos/module.c index cce308f0fe4..249413545c9 100644 --- a/loader/dos/module.c +++ b/loader/dos/module.c @@ -6,8 +6,6 @@ * This code hasn't been completely cleaned up yet. */ -#ifdef linux - #include #include #include @@ -17,18 +15,22 @@ #include #include #include -#include -#include #include "windows.h" #include "winbase.h" #include "module.h" #include "task.h" +#include "file.h" #include "ldt.h" #include "process.h" #include "miscemu.h" #include "debug.h" #include "dosexe.h" +#ifdef MZ_SUPPORTED + +#include +#include + /* 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 @@ -85,25 +87,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, NE_MODULE *pModule ) +int MZ_InitMemory( LPDOSTASK lpDosTask, NE_MODULE *pModule ) { - IMAGE_DOS_HEADER mz_header; - DWORD image_start,image_size,min_size,max_size,avail; - BYTE*psp_start,*load_start; int x; - SEGPTR reloc; - if ((_hread16(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) || - (mz_header.e_magic != IMAGE_DOS_SIGNATURE)) - return 11; /* invalid exe */ - /* calculate load size */ - image_start=mz_header.e_cparhdr<<4; - image_size=mz_header.e_cp<<9; /* pages are 512 bytes */ - if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp; - image_size-=image_start; - min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4); - max_size=image_size+((DWORD)mz_header.e_maxalloc<<4)+(PSP_SIZE<<4); + if (lpDosTask->img_ofs) return 32; /* already allocated */ /* allocate 1MB+64K shared memory */ lpDosTask->img_ofs=START_OFFSET; @@ -132,7 +120,43 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, /* initialize the memory */ MZ_InitSystem(lpDosTask->img); TRACE(module,"Initializing DOS memory structures\n"); + /* FIXME: make DOSMEM_Init copy static dosmem memory into newly allocated shared memory */ DOSMEM_Init(lpDosTask->hModule); + return 32; +} + +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; + BYTE*psp_start,*load_start; + int x,old_com=0; + SEGPTR reloc; + + if ((_hread16(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) || + (mz_header.e_magic != IMAGE_DOS_SIGNATURE)) { +#if 0 + return 11; /* invalid exe */ +#endif + old_com=1; /* assume .COM file */ + image_start=0; + image_size=GetFileSize(HFILE16_TO_HFILE32(hFile),NULL); + min_size=0x10000; max_size=0x100000; + mz_header.e_crlc=0; + mz_header.e_ss=0; mz_header.e_sp=0xFFFE; + mz_header.e_cs=0; mz_header.e_ip=0x100; + } else { + /* calculate load size */ + image_start=mz_header.e_cparhdr<<4; + image_size=mz_header.e_cp<<9; /* pages are 512 bytes */ + if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp; + image_size-=image_start; + min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4); + max_size=image_size+((DWORD)mz_header.e_maxalloc<<4)+(PSP_SIZE<<4); + } + + MZ_InitMemory(lpDosTask,pModule); /* FIXME: allocate memory for environment variables */ @@ -149,24 +173,26 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, ERR(module, "error allocating DOS memory\n"); return 0; } - lpDosTask->load_seg=lpDosTask->psp_seg+PSP_SIZE; + lpDosTask->load_seg=lpDosTask->psp_seg+(old_com?0:PSP_SIZE); load_start=psp_start+(PSP_SIZE<<4); MZ_InitPSP(psp_start, cmdline, env); /* load executable image */ - TRACE(module,"loading DOS EXE image size, %08lx bytes\n",image_size); + TRACE(module,"loading DOS %s image size, %08lx bytes\n",old_com?"COM":"EXE",image_size); _llseek16(hFile,image_start,FILE_BEGIN); if ((_hread16(hFile,load_start,image_size)) != image_size) return 11; /* invalid exe */ - /* load relocation table */ - TRACE(module,"loading DOS EXE relocation table, %d entries\n",mz_header.e_lfarlc); - /* FIXME: is this too slow without read buffering? */ - _llseek16(hFile,mz_header.e_lfarlc,FILE_BEGIN); - for (x=0; xload_seg; + if (mz_header.e_crlc) { + /* load relocation table */ + TRACE(module,"loading DOS EXE relocation table, %d entries\n",mz_header.e_lfarlc); + /* FIXME: is this too slow without read buffering? */ + _llseek16(hFile,mz_header.e_lfarlc,FILE_BEGIN); + for (x=0; xload_seg; + } } /* initialize vm86 struct */ @@ -184,9 +210,10 @@ static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env, int MZ_InitTask( LPDOSTASK lpDosTask ) { + extern char * DEBUG_argv0; int read_fd[2],write_fd[2]; pid_t child; - char *fname,*farg,arg[16],fproc[64]; + char *fname,*farg,arg[16],fproc[64],path[256],*fpath; /* create read pipe */ if (pipe(read_fd)<0) return 0; @@ -236,7 +263,14 @@ int MZ_InitTask( LPDOSTASK lpDosTask ) /* now load dosmod */ execlp("dosmod",fname,farg,NULL); execl("dosmod",fname,farg,NULL); + /* hmm, they didn't install properly */ execl("loader/dos/dosmod",fname,farg,NULL); + /* last resort, try to find it through argv[0] */ + fpath=strrchr(strcpy(path,DEBUG_argv0),'/'); + if (fpath) { + strcpy(fpath,"/loader/dos/dosmod"); + execl(path,fname,farg,NULL); + } /* if failure, exit */ ERR(module,"Failed to spawn dosmod, error=%s\n",strerror(errno)); exit(1); @@ -247,56 +281,65 @@ int MZ_InitTask( LPDOSTASK lpDosTask ) HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env, LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info ) { - LPDOSTASK lpDosTask; + LPDOSTASK lpDosTask = NULL; /* keep gcc from complaining */ HMODULE16 hModule; HINSTANCE16 hInstance; - NE_MODULE *pModule; + TDB *pTask = (TDB*)GlobalLock16( GetCurrentTask() ); + NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL; HFILE16 hFile; OFSTRUCT ofs; - int err; + int err, alloc = !(pModule && pModule->dos_image); - if ((lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL) + GlobalUnlock16( GetCurrentTask() ); + + if (alloc && (lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL) return 0; if ((hFile = OpenFile16( name, &ofs, OF_READ )) == HFILE_ERROR16) return 2; /* File not found */ - if ((hModule = MODULE_CreateDummyModule(&ofs)) < 32) - return hModule; + if (alloc) { + if ((hModule = MODULE_CreateDummyModule(&ofs)) < 32) + return hModule; - lpDosTask->hModule = hModule; + lpDosTask->hModule = hModule; - pModule = (NE_MODULE *)GlobalLock16(hModule); - pModule->lpDosTask = lpDosTask; + pModule = (NE_MODULE *)GlobalLock16(hModule); + pModule->lpDosTask = lpDosTask; - lpDosTask->img=NULL; lpDosTask->mm_name[0]=0; lpDosTask->mm_fd=-1; + lpDosTask->img=NULL; lpDosTask->mm_name[0]=0; lpDosTask->mm_fd=-1; + } else lpDosTask=pModule->lpDosTask; err = MZ_LoadImage( hFile, cmdline, env, lpDosTask, pModule ); _lclose16(hFile); - pModule->dos_image = lpDosTask->img; - if (err<32) { + if (alloc) { + pModule->dos_image = lpDosTask->img; + if (err<32) { + 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) { - if (lpDosTask->img!=NULL) munmap(lpDosTask->img,0x110000-START_OFFSET); - if (lpDosTask->mm_fd>=0) close(lpDosTask->mm_fd); + /* 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); - } 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; - } + } + if (err<32) { + MZ_KillModule( lpDosTask ); + /* FIXME: cleanup hModule */ + return err; + } - hInstance = NE_CreateInstance(pModule, NULL, (cmdline == NULL)); - PROCESS_Create( pModule, cmdline, env, hInstance, 0, startup, info ); - return hInstance; + hInstance = NE_CreateInstance(pModule, NULL, (cmdline == NULL)); + PROCESS_Create( pModule, cmdline, env, hInstance, 0, startup, info ); + return hInstance; + } else { + return (err<32) ? err : pTask->hInstance; + } } void MZ_KillModule( LPDOSTASK lpDosTask ) @@ -340,7 +383,7 @@ int MZ_RunModule( LPDOSTASK lpDosTask ) return 0; } -#else /* !linux */ +#else /* !MZ_SUPPORTED */ HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env, LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info ) diff --git a/loader/module.c b/loader/module.c index 0804df33534..1bbe11a5b8f 100644 --- a/loader/module.c +++ b/loader/module.c @@ -306,20 +306,22 @@ static HINSTANCE16 NE_CreateProcess( LPCSTR name, LPCSTR cmd_line, LPCSTR env, else { hInstance = NE_LoadModule( name, &hPrevInstance, FALSE, FALSE ); - pModule = hInstance >= 32 ? NE_GetPtr( hInstance ) : NULL; + if (hInstance < 32) return hInstance; + + if ( !(pModule = NE_GetPtr(hInstance)) + || (pModule->flags & NE_FFLAGS_LIBMODULE)) + { + /* FIXME: cleanup */ + return 11; + } } /* Create a task for this instance */ - if (pModule && !(pModule->flags & NE_FFLAGS_LIBMODULE)) - { - PDB32 *pdb; + pModule->flags |= NE_FFLAGS_GUI; /* FIXME: is this necessary? */ - pModule->flags |= NE_FFLAGS_GUI; - - pdb = PROCESS_Create( pModule, cmd_line, env, hInstance, - hPrevInstance, startup, info ); - } + PROCESS_Create( pModule, cmd_line, env, hInstance, + hPrevInstance, startup, info ); return hInstance; } @@ -331,39 +333,63 @@ static HINSTANCE16 NE_CreateProcess( LPCSTR name, LPCSTR cmd_line, LPCSTR env, HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock ) { LOADPARAMS *params; - LOADPARAMS32 params32; - HINSTANCE16 hInstance; - LPSTR cmd_line; + LPSTR cmd_line, new_cmd_line; + LPCVOID env = NULL; + STARTUPINFO32A startup; + PROCESS_INFORMATION info; + HINSTANCE16 hInstance, hPrevInstance; + NE_MODULE *pModule; + PDB32 *pdb; + + /* Load module */ if (!paramBlock || (paramBlock == (LPVOID)-1)) return LoadLibrary16( name ); - /* Transfer arguments to 32-bit param-block */ - params = (LOADPARAMS *)paramBlock; - memset( ¶ms32, '\0', sizeof(params32) ); + hInstance = NE_LoadModule( name, &hPrevInstance, FALSE, FALSE ); + if ( hInstance < 32 || !(pModule = NE_GetPtr(hInstance)) + || (pModule->flags & NE_FFLAGS_LIBMODULE)) + return hInstance; + /* Create a task for this instance */ + + pModule->flags |= NE_FFLAGS_GUI; /* FIXME: is this necessary? */ + + params = (LOADPARAMS *)paramBlock; 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 (!(params32.lpCmdLine = HeapAlloc( GetProcessHeap(), 0, - strlen(cmd_line)+strlen(name)+2 ))) + if (!(new_cmd_line = HeapAlloc( GetProcessHeap(), 0, + strlen(cmd_line)+strlen(name)+2 ))) return 0; - strcpy( params32.lpCmdLine, name ); - strcat( params32.lpCmdLine, " " ); - strcat( params32.lpCmdLine, cmd_line ); + strcpy( new_cmd_line, name ); + strcat( new_cmd_line, " " ); + strcat( new_cmd_line, cmd_line ); - if (params->hEnvironment) - params32.lpEnvAddress = GlobalLock16( params->hEnvironment ); + if (params->hEnvironment) env = GlobalLock16( params->hEnvironment ); + + memset( &info, '\0', sizeof(info) ); + memset( &startup, '\0', sizeof(startup) ); + startup.cb = sizeof(startup); if (params->showCmd) - params32.lpCmdShow = PTR_SEG_TO_LIN( params->showCmd ); + { + startup.dwFlags = STARTF_USESHOWWINDOW; + startup.wShowWindow = ((UINT16 *)PTR_SEG_TO_LIN(params->showCmd))[1]; + } - /* Call LoadModule32 */ - hInstance = LoadModule32( name, ¶ms32 ); + pdb = PROCESS_Create( pModule, new_cmd_line, env, + hInstance, hPrevInstance, &startup, &info ); + + CloseHandle( info.hThread ); + CloseHandle( info.hProcess ); - /* Clean up */ if (params->hEnvironment) GlobalUnlock16( params->hEnvironment ); - HeapFree( GetProcessHeap(), 0, params32.lpCmdLine ); + HeapFree( GetProcessHeap(), 0, new_cmd_line ); + + /* Start task */ + + if (pdb) TASK_StartTask( pdb->task ); return hInstance; } @@ -521,11 +547,9 @@ BOOL32 WINAPI CreateProcess32A( LPCSTR lpApplicationName, LPSTR lpCommandLine, lpStartupInfo, lpProcessInfo ); /* Try DOS module */ -#ifdef linux if (hInstance == 11) hInstance = MZ_CreateProcess( name, cmdline, lpEnvironment, lpStartupInfo, lpProcessInfo ); -#endif if (hInstance < 32) { diff --git a/loader/ne/resource.c b/loader/ne/resource.c index 90fb4160468..da379441a62 100644 --- a/loader/ne/resource.c +++ b/loader/ne/resource.c @@ -383,7 +383,7 @@ INT16 WINAPI AccessResource16( HINSTANCE16 hModule, HRSRC16 hRsrc ) assert( !__winelib ); /* Can't use Win16 resource functions in Winelib */ - if ((fd = _lopen16( NE_MODULE_NAME(pModule), OF_READ )) != -1) + if ((fd = _lopen16( NE_MODULE_NAME(pModule), OF_READ )) != HFILE_ERROR16) { WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table); NE_NAMEINFO *pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc); diff --git a/loader/ne/segment.c b/loader/ne/segment.c index ff92d5c43cc..8215c302bf0 100644 --- a/loader/ne/segment.c +++ b/loader/ne/segment.c @@ -106,10 +106,11 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) stack16Top->ip = 0; stack16Top->cs = 0; TRACE(dll,"CallLoadAppSegProc(hmodule=0x%04x,hf=0x%04x,segnum=%d\n", - pModule->self,hf,segnum - ); + pModule->self,hf,segnum ); newselector = Callbacks->CallLoadAppSegProc(selfloadheader->LoadAppSeg, - pModule->self, hf, segnum ); + pModule->self, + HFILE32_TO_HFILE16(hf), + segnum ); TRACE(dll,"Ret CallLoadAppSegProc: selector = 0x%04x\n",newselector); _lclose32( hf ); if (newselector != oldselector) { @@ -218,7 +219,7 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) *((BYTE *)pTarget + pTarget->name_table), (char *)pTarget + pTarget->name_table + 1, ordinal ); - address = 0xdeadbeef; + address = (FARPROC16)0xdeadbeef; } } if (TRACE_ON(fixup)) @@ -248,7 +249,7 @@ BOOL32 NE_LoadSegment( NE_MODULE *pModule, WORD segnum ) *((BYTE *)pTarget + pTarget->name_table), (char *)pTarget + pTarget->name_table + 1, func_name ); } - if (!address) address = 0xdeadbeef; + if (!address) address = (FARPROC16) 0xdeadbeef; if (TRACE_ON(fixup)) { NE_MODULE *pTarget = NE_GetPtr( module ); @@ -418,8 +419,10 @@ BOOL32 NE_LoadAllSegments( NE_MODULE *pModule ) stack16Top->cs = 0; hf = FILE_DupUnixHandle( NE_OpenFile( pModule ) ); - TRACE(dll,"CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n",pModule->self,hf); - Callbacks->CallBootAppProc(selfloadheader->BootApp, pModule->self, hf); + TRACE(dll,"CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n",pModule->self, + HFILE32_TO_HFILE16(hf)); + Callbacks->CallBootAppProc(selfloadheader->BootApp, pModule->self, + HFILE32_TO_HFILE16(hf)); TRACE(dll,"Return from CallBootAppProc\n"); _lclose32(hf); /* some BootApp procs overwrite the selector of dgroup */ diff --git a/loader/pe_image.c b/loader/pe_image.c index 8ef9b7394e9..dd26b2bf176 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -911,8 +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) ) { - DWORD (CALLBACK *entry)(HMODULE32,DWORD,LPVOID) = (void*)RVA_PTR( wm->module, - OptionalHeader.AddressOfEntryPoint ); + DLLENTRYPROC32 entry = (void*)RVA_PTR( wm->module,OptionalHeader.AddressOfEntryPoint ); TRACE(relay, "CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n", entry, wm->module, type, lpReserved ); entry( wm->module, type, lpReserved ); diff --git a/loader/resource.c b/loader/resource.c index 798b8a517ef..6d11b557833 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -85,7 +85,7 @@ HRSRC32 WINAPI FindResourceEx32W( HMODULE32 hModule, LPCWSTR name, case MODULE32_PE: ret = PE_FindResourceEx32W(wm,name,type,lang); if ( ret==0 ) - ERR(resource,"%s not found!\n",debugres_w (name)); + ERR(resource,"(0x%08lx(%s),%s not found!\n",hModule,wm->modname,debugres_w (name)); return ret; default: ERR(module,"unknown module type %d\n",wm->type); diff --git a/loader/task.c b/loader/task.c index 099333e30ac..df06353efdb 100644 --- a/loader/task.c +++ b/loader/task.c @@ -1032,6 +1032,10 @@ FARPROC16 WINAPI MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance ) BYTE *thunk,*lfunc; SEGPTR thunkaddr; + if (!func) { + ERR(task, "Ouch ! MakeProcInstance called with func == NULL !\n"); + return (FARPROC16)0; /* Windows seems to do the same */ + } if (!hInstance) hInstance = CURRENT_DS; thunkaddr = TASK_AllocThunk( GetCurrentTask() ); if (!thunkaddr) return (FARPROC16)0; diff --git a/memory/global.c b/memory/global.c index f2ba8f003b1..fd8bb5b5d14 100644 --- a/memory/global.c +++ b/memory/global.c @@ -1190,6 +1190,12 @@ HGLOBAL32 WINAPI GlobalReAlloc32( /* make a fixed block moveable * actually only NT is able to do this. But it's soo simple */ + if (hmem == 0) + { + ERR(global, "GlobalReAlloc32 with null handle!\n"); + SetLastError( ERROR_INVALID_ACCESS_TO_MEM ); + return 0; + } size=HeapSize(GetProcessHeap(), 0, (LPVOID) hmem); hnew=GlobalAlloc32( flags, size); palloc=GlobalLock32(hnew); @@ -1501,7 +1507,7 @@ SEGPTR WINAPI WOWGlobalAllocLock16(DWORD flags,DWORD cb,HGLOBAL16 *hmem) * * Combined GlobalUnlock and GlobalFree. */ -WORD WOWGlobalUnlockFree16(DWORD vpmem) { +WORD WINAPI WOWGlobalUnlockFree16(DWORD vpmem) { if (!GlobalUnlock16(HIWORD(vpmem))) return 0; return GlobalFree16(HIWORD(vpmem)); diff --git a/memory/string.c b/memory/string.c index 85f77f2251d..decad7aa96d 100644 --- a/memory/string.c +++ b/memory/string.c @@ -213,7 +213,11 @@ INT32 WINAPI lstrcmpi32W( LPCWSTR str1, LPCWSTR str2 ) } while (*str1) { - if ((res = towupper(*str1) - towupper(*str2)) != 0) return res; + if ((*str1<0x100 ) && (*str2<0x100)) { + if ((res = toupper(*str1) - toupper(*str2)) != 0) return res; + } else { + if ((res = towupper(*str1) - towupper(*str2)) != 0) return res; + } str1++; str2++; } diff --git a/memory/virtual.c b/memory/virtual.c index 801237c4470..3b4e94f3228 100644 --- a/memory/virtual.c +++ b/memory/virtual.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -1111,7 +1112,7 @@ HANDLE32 WINAPI CreateFileMapping32A( /* Check parameters */ TRACE(virtual,"(%x,%p,%08lx,%08lx%08lx,%s)\n", - hFile, sa, protect, size_high, size_low, name ); + hFile, sa, protect, size_high, size_low, debugstr_a(name) ); vprot = VIRTUAL_GetProt( protect ); if (protect & SEC_RESERVE) @@ -1359,9 +1360,17 @@ LPVOID WINAPI MapViewOfFileEx( ptr = (UINT32)FILE_dommap( mapping->file, addr, 0, size, 0, offset_low, VIRTUAL_GetUnixProt( mapping->protect ), flags ); - if (ptr == (UINT32)-1) - { - SetLastError( ERROR_OUTOFMEMORY ); + if (ptr == (UINT32)-1) { + /* KB: Q125713, 25-SEP-1995, "Common File Mapping Problems and + * Platform Differences": + * Windows NT: ERROR_INVALID_PARAMETER + * Windows 95: ERROR_INVALID_ADDRESS. + * FIXME: So should we add a module dependend check here? -MM + */ + if (errno==ENOMEM) + SetLastError( ERROR_OUTOFMEMORY ); + else + SetLastError( ERROR_INVALID_PARAMETER ); goto error; } diff --git a/misc/Makefile.in b/misc/Makefile.in index c1d31707a54..bc5f783c42e 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -15,7 +15,7 @@ C_SRCS = \ ddeml.c \ debugstr.c \ error.c \ - imagelist.c \ + imm.c \ lstr.c \ lzexpand.c \ main.c \ diff --git a/misc/crtdll.c b/misc/crtdll.c index 6b808a4e59e..85e99de7123 100644 --- a/misc/crtdll.c +++ b/misc/crtdll.c @@ -877,7 +877,7 @@ INT32 __cdecl CRTDLL__strnicmp( LPCSTR s1, LPCSTR s2, INT32 n ) * * convert a string in place to lowercase */ -LPSTR CRTDLL__strlwr(LPSTR x) +LPSTR __cdecl CRTDLL__strlwr(LPSTR x) { unsigned char *y =x; @@ -895,7 +895,7 @@ LPSTR CRTDLL__strlwr(LPSTR x) /********************************************************************* * system (CRTDLL.485) */ -INT32 CRTDLL_system(LPSTR x) +INT32 __cdecl CRTDLL_system(LPSTR x) { #define SYSBUF_LENGTH 1500 char buffer[SYSBUF_LENGTH]; diff --git a/misc/ddeml.c b/misc/ddeml.c index 7a5c47a448f..069b1fc966d 100644 --- a/misc/ddeml.c +++ b/misc/ddeml.c @@ -56,6 +56,10 @@ UINT32 WINAPI DdeInitialize32W( LPDWORD pidInst, PFNCALLBACK32 pfnCallback, DWORD afCmd, DWORD ulRes ) { FIXME(ddeml, "(%p,%p,%ld,%ld): stub\n",pidInst,pfnCallback,afCmd,ulRes); + + if(pidInst) + *pidInst = 0; + return DMLERR_NO_ERROR; } @@ -528,3 +532,45 @@ int WINAPI DdeCmpStringHandles( HSZ hsz1, HSZ hsz2 ) return 0; } + +/***************************************************************** + * PackDDElParam (USER32.414) + * + * RETURNS + * success: nonzero + * failure: zero + */ +UINT32 WINAPI PackDDElParam32(UINT32 msg, UINT32 uiLo, UINT32 uiHi) +{ + FIXME(ddeml, "stub.\n"); + return 0; +} + + +/***************************************************************** + * UnpackDDElParam (USER32.562) + * + * RETURNS + * success: nonzero + * failure: zero + */ +UINT32 WINAPI UnpackDDElParam32(UINT32 msg, UINT32 lParam, + UINT32 *uiLo, UINT32 *uiHi) +{ + FIXME(ddeml, "stub.\n"); + return 0; +} + + +/***************************************************************** + * FreeDDElParam (USER32.204) + * + * RETURNS + * success: nonzero + * failure: zero + */ +UINT32 WINAPI FreeDDElParam32(UINT32 msg, UINT32 lParam) +{ + FIXME(ddeml, "stub.\n"); + return 0; +} diff --git a/misc/imm.c b/misc/imm.c new file mode 100644 index 00000000000..579477d686e --- /dev/null +++ b/misc/imm.c @@ -0,0 +1,546 @@ +/* + * IMM32 library + * + * Copyright 1998 Patrik Stridvall + */ + +#include "windows.h" +#include "wintypes.h" +#include "imm.h" + +/*********************************************************************** + * ImmAssociateContext32 (IMM32.1) + */ + +HIMC32 WINAPI ImmAssociateContext32(HWND32 hWnd, HIMC32 hIMC) +{ + return NULL; +} + +/*********************************************************************** + * ImmConfigureIME32A (IMM32.2) + */ + +BOOL32 WINAPI ImmConfigureIME32A(HKL32 hKL, HWND32 hWnd, DWORD dwMode, LPVOID lpData) +{ + return FALSE; +} + +/*********************************************************************** + * ImmConfigureIME32W (IMM32.3) + */ + +BOOL32 WINAPI ImmConfigureIME32W(HKL32 hKL, HWND32 hWnd, DWORD dwMode, LPVOID lpData) +{ + return FALSE; +} + +/*********************************************************************** + * ImmCreateContext32 (IMM32.4) + */ + +HIMC32 WINAPI ImmCreateContext32() +{ + return NULL; +} + +/*********************************************************************** + * ImmDestroyContext32 (IMM32.7) + */ + +BOOL32 WINAPI ImmDestroyContext32(HIMC32 hIMC) +{ + return FALSE; +} + + +/*********************************************************************** + * ImmEnumRegisterWord32A (IMM32.10) + */ + +UINT32 WINAPI ImmEnumRegisterWord32A( + HKL32 hKL, REGISTERWORDENUMPROCA lpfnEnumProc, + LPCSTR lpszReading, DWORD dwStyle, + LPCSTR lpszRegister, LPVOID lpData) +{ + return 0; +} + +/*********************************************************************** + * ImmEnumRegisterWord32W (IMM32.11) + */ + +UINT32 WINAPI ImmEnumRegisterWord32W( + HKL32 hKL, REGISTERWORDENUMPROCW lpfnEnumProc, + LPCWSTR lpszReading, DWORD dwStyle, + LPCWSTR lpszRegister, LPVOID lpData) +{ + return 0; +} + +/*********************************************************************** + * ImmEscape32A (IMM32.12) + */ + +LRESULT WINAPI ImmEscape32A(HKL32 hKL, HIMC32 hIMC, UINT32 uEscape, LPVOID lpData) +{ + return 0; +} + +/*********************************************************************** + * ImmEscape32W (IMM32.13) + */ + +LRESULT WINAPI ImmEscape32W(HKL32 hKL, HIMC32 hIMC, UINT32 uEscape, LPVOID lpData) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCandidateList32A (IMM32.15) + */ + +DWORD WINAPI ImmGetCandidateList32A(HIMC32 hIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCandidateListCount32A (IMM32.16) + */ + +DWORD WINAPI ImmGetCandidateListCount32A(HIMC32 hIMC, LPDWORD lpdwListCount) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCandidateListCount32W (IMM32.17) + */ + +DWORD WINAPI ImmGetCandidateListCount32W(HIMC32 hIMC, LPDWORD lpdwListCount) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCandidateList32W (IMM32.18) + */ + +DWORD WINAPI ImmGetCandidateList32W(HIMC32 hIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCandidateWindow32 (IMM32.19) + */ + +BOOL32 WINAPI ImmGetCandidateWindow32(HIMC32 hIMC, DWORD dwBufLen, LPCANDIDATEFORM lpCandidate) +{ + return FALSE; +} + +/*********************************************************************** + * ImmGetCompositionFont32A (IMM32.20) + */ + +BOOL32 WINAPI ImmGetCompositionFont32A(HIMC32 hIMC, LPLOGFONT32A lplf) +{ + return FALSE; +} + +/*********************************************************************** + * ImmGetCompositionFont32W (IMM32.21) + */ + +BOOL32 WINAPI ImmGetCompositionFont32W(HIMC32 hIMC, LPLOGFONT32W lplf) +{ + return FALSE; +} + +/*********************************************************************** + * ImmGetCompositionString32A (IMM32.22) + */ + +LONG WINAPI ImmGetCompositionString32A(HIMC32 hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCompositionString32W (IMM32.23) + */ + +LONG WINAPI ImmGetCompositionString32W(HIMC32 hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetCompositionWindow32 (IMM32.24) + */ + +BOOL32 WINAPI ImmGetCompositionWindow32(HIMC32 hIMC, LPCOMPOSITIONFORM lpCompForm) +{ + return 0; +} + +/*********************************************************************** + * ImmGetContext32 (IMM32.25) + */ + +HIMC32 WINAPI ImmGetContext32(HWND32 hWnd) +{ + return NULL; +} + +/*********************************************************************** + * ImmGetConversionList32A (IMM32.26) + */ + +DWORD WINAPI ImmGetConversionList32A( + HKL32 hKL, HIMC32 hIMC, + LPCSTR pSrc, LPCANDIDATELIST lpDst, + DWORD dwBufLen, UINT32 uFlag) +{ + return 0; +} + +/*********************************************************************** + * ImmGetConversionList32W (IMM32.27) + */ + +DWORD WINAPI ImmGetConversionList32W( + HKL32 hKL, HIMC32 hIMC, + LPCWSTR pSrc, LPCANDIDATELIST lpDst, + DWORD dwBufLen, UINT32 uFlag) +{ + return 0; +} + +/*********************************************************************** + * ImmGetConversionStatus32 (IMM32.28) + */ + +BOOL32 WINAPI ImmGetConversionStatus32( + HIMC32 hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence) +{ + return FALSE; +} + +/*********************************************************************** + * ImmGetDefaultIMEWnd32 (IMM32.29) + */ + +HWND32 WINAPI ImmGetDefaultIMEWnd32(HWND32 hWnd) +{ + return NULL; +} + +/*********************************************************************** + * ImmGetDescription32A (IMM32.30) + */ + +UINT32 WINAPI ImmGetDescription32A(HKL32 hKL, LPSTR lpszDescription, UINT32 uBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetDescription32W (IMM32.31) + */ + +UINT32 WINAPI ImmGetDescription32W(HKL32 hKL, LPWSTR lpszDescription, UINT32 uBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetGuideLine32A (IMM32.32) + */ + +DWORD WINAPI ImmGetGuideLine32A(HIMC32 hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetGuideLine32W (IMM32.33) + */ + +DWORD WINAPI ImmGetGuideLine32W(HIMC32 hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetIMEFileName32A (IMM32.38) + */ + +UINT32 WINAPI ImmGetIMEFileName32A(HKL32 hKL, LPSTR lpszFileName, UINT32 uBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetIMEFileName32W (IMM32.39) + */ + +UINT32 WINAPI ImmGetIMEFileName32W(HKL32 hKL, LPWSTR lpszFileName, UINT32 uBufLen) +{ + return 0; +} + +/*********************************************************************** + * ImmGetOpenStatus32 (IMM32.40) + */ + +BOOL32 WINAPI ImmGetOpenStatus32(HIMC32 hIMC) +{ + return FALSE; +} + +/*********************************************************************** + * ImmGetProperty32 (IMM32.41) + */ + +DWORD WINAPI ImmGetProperty32(HKL32 hKL, DWORD fdwIndex) +{ + return 0; +} + +/*********************************************************************** + * ImmGetRegisterWordStyle32A (IMM32.42) + */ + +UINT32 WINAPI ImmGetRegisterWordStyle32A(HKL32 hKL, UINT32 nItem, LPSTYLEBUFA lpStyleBuf) +{ + return 0; +} + +/*********************************************************************** + * ImmGetRegisterWordStyle32W (IMM32.43) + */ + +UINT32 WINAPI ImmGetRegisterWordStyle32W(HKL32 hKL, UINT32 nItem, LPSTYLEBUFW lpStyleBuf) +{ + return 0; +} + +/*********************************************************************** + * ImmGetStatusWindowPos32 (IMM32.44) + */ + +BOOL32 WINAPI ImmGetStatusWindowPos32(HIMC32 hIMC, LPPOINT32 lpptPos) +{ + return FALSE; +} + +/*********************************************************************** + * ImmGetVirtualKey32 (IMM32.45) + */ + +UINT32 WINAPI ImmGetVirtualKey32(HWND32 hWnd) +{ + return 0; +} + +/*********************************************************************** + * ImmInstallIME32A (IMM32.46) + */ + +HKL32 WINAPI ImmInstallIME32A(LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText) +{ + return NULL; +} + +/*********************************************************************** + * ImmInstallIME32W (IMM32.47) + */ + +HKL32 WINAPI ImmInstallIME32W(LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText) +{ + return NULL; +} + +/*********************************************************************** + * ImmIsIME32 (IMM32.48) + */ + +BOOL32 WINAPI ImmIsIME32(HKL32 hKL) +{ + return FALSE; +} + +/*********************************************************************** + * ImmIsUIMessage32A (IMM32.49) + */ + +BOOL32 WINAPI ImmIsUIMessage32A(HWND32 hWndIME, UINT32 msg, WPARAM32 wParam, LPARAM lParam) +{ + return FALSE; +} + +/*********************************************************************** + * ImmIsUIMessage32W (IMM32.50) + */ + +BOOL32 WINAPI ImmIsUIMessage32W(HWND32 hWndIME, UINT32 msg, WPARAM32 wParam, LPARAM lParam) +{ + return FALSE; +} + +/*********************************************************************** + * ImmNotifyIME32 (IMM32.53) + */ + +BOOL32 WINAPI ImmNotifyIME32(HIMC32 hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) +{ + return FALSE; +} + +/*********************************************************************** + * ImmRegisterWord32A (IMM32.55) + */ + +BOOL32 WINAPI ImmRegisterWord32A(HKL32 hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister) +{ + return FALSE; +} + +/*********************************************************************** + * ImmRegisterWord32W (IMM32.56) + */ + +BOOL32 WINAPI ImmRegisterWord32W(HKL32 hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister) +{ + return FALSE; +} + +/*********************************************************************** + * ImmReleaseContext32 (IMM32.57) + */ + +BOOL32 WINAPI ImmReleaseContext32(HWND32 hWnd, HIMC32 hIMC) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetCandidateWindow32 (IMM32.58) + */ + +BOOL32 WINAPI ImmSetCandidateWindow32 (HIMC32 hIMC, LPCANDIDATEFORM lpCandidate) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetCompositionFont32A (IMM32.59) + */ + +BOOL32 WINAPI ImmSetCompositionFont32A(HIMC32 hIMC, LPLOGFONT32A lplf) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetCompositionFont32W (IMM32.60) + */ + +BOOL32 WINAPI ImmSetCompositionFont32W(HIMC32 hIMC, LPLOGFONT32W lplf) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetCompositionString32A (IMM32.61) + */ + +BOOL32 WINAPI ImmSetCompositionString32A( + HIMC32 hIMC, DWORD dwIndex, + LPCVOID lpComp, DWORD dwCompLen, + LPCVOID lpRead, DWORD dwReadLen) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetCompositionString32W (IMM32.62) + */ + +BOOL32 WINAPI ImmSetCompositionString32W( + HIMC32 hIMC, DWORD dwIndex, + LPCVOID lpComp, DWORD dwCompLen, + LPCVOID lpRead, DWORD dwReadLen) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetCompositionWindow32 (IMM32.63) + */ + +BOOL32 WINAPI ImmSetCompositionWindow32(HIMC32 hIMC, LPCOMPOSITIONFORM lpCompForm) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetConversionStatus32 (IMM32.64) + */ + +BOOL32 WINAPI ImmSetConversionStatus32(HIMC32 hIMC, DWORD fdwConversion, DWORD fdwSentence) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetOpenStatus32 (IMM32.66) + */ + +BOOL32 WINAPI ImmSetOpenStatus32(HIMC32 hIMC, BOOL32 fOpen) +{ + return FALSE; +} + +/*********************************************************************** + * ImmSetStatusWindowPos32 (IMM32.67) + */ + +BOOL32 WINAPI ImmSetStatusWindowPos32(HIMC32 hIMC, LPPOINT32 lpptPos) +{ + return FALSE; +} + + +/*********************************************************************** + * ImmSimulateHotKey32 (IMM32.69) + */ + +BOOL32 WINAPI ImmSimulateHotKey32(HWND32 hWnd, DWORD dwHotKeyID) +{ + return FALSE; +} + +/*********************************************************************** + * ImmUnregisterWord32A (IMM32.72) + */ + +BOOL32 WINAPI ImmUnregisterWord32A(HKL32 hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister) +{ + return FALSE; +} + +/*********************************************************************** + * ImmUnregisterWord32W (IMM32.?) + * FIXME + * I haven't been able to find the ordinal for this function, + * This means it can't be called from outside the DLL. + */ + +BOOL32 WINAPI ImmUnregisterWord32W(HKL32 hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister) +{ + return FALSE; +} diff --git a/misc/lzexpand.c b/misc/lzexpand.c index 495ea9bcf80..d968b193609 100644 --- a/misc/lzexpand.c +++ b/misc/lzexpand.c @@ -137,7 +137,7 @@ INT32 WINAPI LZStart32(void) */ HFILE16 WINAPI LZInit16( HFILE16 hfSrc ) { - return LZInit32( HFILE16_TO_HFILE32(hfSrc) ); + return HFILE32_TO_HFILE16( LZInit32( HFILE16_TO_HFILE32(hfSrc) ) ); } @@ -307,7 +307,7 @@ INT32 WINAPI GetExpandedName32W( LPCWSTR in, LPWSTR out ) */ INT16 WINAPI LZRead16( HFILE16 fd, LPVOID buf, UINT16 toread ) { - return LZRead32(fd,buf,toread); + return LZRead32(HFILE16_TO_HFILE32(fd),buf,toread); } @@ -412,7 +412,7 @@ INT32 WINAPI LZRead32( HFILE32 fd, LPVOID vbuf, UINT32 toread ) */ LONG WINAPI LZSeek16( HFILE16 fd, LONG off, INT16 type ) { - return LZSeek32( fd, off, type ); + return LZSeek32( HFILE16_TO_HFILE32(fd), off, type ); } @@ -456,10 +456,11 @@ LONG WINAPI LZSeek32( HFILE32 fd, LONG off, INT32 type ) /*********************************************************************** * LZCopy16 (LZEXPAND.1) + * */ LONG WINAPI LZCopy16( HFILE16 src, HFILE16 dest ) { - return LZCopy32( src, dest ); + return LZCopy32( HFILE16_TO_HFILE32(src), HFILE16_TO_HFILE32(dest) ); } @@ -541,7 +542,7 @@ static LPSTR LZEXPAND_MangleName( LPCSTR fn ) */ HFILE16 WINAPI LZOpenFile16( LPCSTR fn, LPOFSTRUCT ofs, UINT16 mode ) { - return LZOpenFile32A( fn, ofs, mode ); + return HFILE32_TO_HFILE16 ( LZOpenFile32A( fn, ofs, mode ) ); } @@ -601,7 +602,7 @@ HFILE32 WINAPI LZOpenFile32W( LPCWSTR fn, LPOFSTRUCT ofs, UINT32 mode ) */ void WINAPI LZClose16( HFILE16 fd ) { - return LZClose32( fd ); + return LZClose32( HFILE16_TO_HFILE32 (fd) ); } @@ -636,7 +637,7 @@ void WINAPI LZClose32( HFILE32 fd ) LONG WINAPI CopyLZFile16( HFILE16 src, HFILE16 dest ) { TRACE(file,"(%d,%d)\n",src,dest); - return LZCopy32(src,dest); + return LZCopy32(HFILE16_TO_HFILE32(src),HFILE16_TO_HFILE32(dest)); } diff --git a/misc/main.c b/misc/main.c index 814c5a476c2..0925f5d0431 100644 --- a/misc/main.c +++ b/misc/main.c @@ -402,6 +402,14 @@ static void MAIN_ParseOptions( int *argc, char *argv[] ) exit(1); } + /* tell the libX11 that we will do input method handling ourselves + * that keep libX11 from doing anything whith dead keys, allowing Wine + * to have total control over dead keys, that is this line allows + * them to work in Wine, even whith a libX11 including the dead key + * patches from Th.Quinot (http://Web.FdN.FR/~tquinot/dead-keys.en.html) + */ + TSXOpenIM(display,NULL,NULL,NULL); + /* Merge file and screen databases */ if ((xrm_string = TSXResourceManagerString( display )) != NULL) { diff --git a/misc/ntdll.c b/misc/ntdll.c index 60f7f8cd69b..48188aa5364 100644 --- a/misc/ntdll.c +++ b/misc/ntdll.c @@ -570,11 +570,8 @@ DWORD WINAPI NtOpenFile(DWORD x1,DWORD flags,DWORD x3,DWORD x4,DWORD alignment,D /************************************************************************** * NTDLL_chkstk (NTDLL.862) - * - * NOTES - * Should this be WINAPI? */ -void NTDLL_chkstk(void) +void WINAPI NTDLL_chkstk(void) { /* FIXME: should subtract %eax bytes from stack pointer */ FIXME(ntdll, "(void): stub\n"); diff --git a/misc/registry.c b/misc/registry.c index b2d1de4eded..b0b81a82fd9 100644 --- a/misc/registry.c +++ b/misc/registry.c @@ -690,7 +690,9 @@ static LPKEYSTRUCT _find_or_add_key( LPKEYSTRUCT lpkey, LPWSTR keyname ) lplpkey= &(lpkey->nextsub); lpxkey = *lplpkey; while (lpxkey) { - if (!lstrcmpi32W(lpxkey->keyname,keyname)) + if ( (lpxkey->keyname[0]==keyname[0]) && + !lstrcmpi32W(lpxkey->keyname,keyname) + ) break; lplpkey = &(lpxkey->next); lpxkey = *lplpkey; @@ -726,6 +728,7 @@ static void _find_or_add_value( LPKEYSTRUCT lpkey, LPWSTR name, DWORD type, break; } else { if ( val->name!=NULL && + val->name[0]==name[0] && !lstrcmpi32W(val->name,name) ) break; @@ -1080,7 +1083,7 @@ static void _copy_registry( LPKEYSTRUCT from, LPKEYSTRUCT to ) * header: * 0 : "RGKN" - magic * 4 : DWORD offset to first RGDB section - * 8 : DWORD offset to ? + * 8 : DWORD offset to the root record * C..0x1B: ? (fill in) * 0x20 ... offset_of_RGDB_part: Disk Key Entry structures * @@ -1239,18 +1242,22 @@ static LPKEYSTRUCT _w95_processKey ( LPKEYSTRUCT lpkey, bytesread+=len;\ } - do { - XREAD(&dkh, sizeof (dkh)); - if (dkh.nrLS == nrLS) break; + while (curdata < next) { + struct dkh *xdkh = curdata; - curdata += dkh.nextkeyoff - sizeof(dkh); - } while (curdata < next); + bytesread += sizeof(dkh); /* FIXME... nextkeyoff? */ + if (xdkh->nrLS == nrLS) { + memcpy(&dkh,xdkh,sizeof(dkh)); + curdata += sizeof(dkh); + break; + } + curdata += xdkh->nextkeyoff; + }; if (dkh.nrLS != nrLS) return (NULL); - if (nrgdb != dkh.nrMS) { + if (nrgdb != dkh.nrMS) return (NULL); - } assert((dkh.keynamelen<2) || curdata[0]); lpxkey=_find_or_add_key(lpkey,strcvtA2W(curdata, dkh.keynamelen)); @@ -1287,9 +1294,7 @@ static LPKEYSTRUCT _w95_processKey ( LPKEYSTRUCT lpkey, len, info->lastmodified ); - } - return (lpxkey); } @@ -2798,10 +2803,6 @@ DWORD WINAPI RegEnumValue32W( HKEY hkey, DWORD iValue, LPWSTR lpszValue, if (!lpkey) return ERROR_INVALID_HANDLE; - /* None asked for */ - if (!iValue) - return ERROR_SUCCESS; - if (lpkey->nrofvalues <= iValue) return ERROR_NO_MORE_ITEMS; diff --git a/misc/version.c b/misc/version.c index ea0348c81f8..181588fb703 100644 --- a/misc/version.c +++ b/misc/version.c @@ -322,62 +322,6 @@ void WINAPI DiagOutput(LPCSTR str) DPRINTF("DIAGOUTPUT:%s\n",str); } -/*********************************************************************** - * DllGetVersion [COMCTL32.25] - * - * - * - */ -HRESULT WINAPI COMCTL32_DllGetVersion(DLLVERSIONINFO *pdvi) -{ - VERSION ver = VERSION_GetVersion(); - - if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) - { - WARN(ver, "wrong DLLVERSIONINFO size from app"); - return OLE_ERROR_SIZE; /* FIXME: is this error correct ? */ - } - - pdvi->dwPlatformID = VersionData[ver].getVersionEx.dwPlatformId; - switch(VersionData[ver].getVersion32) - { - case 0x80000a03: /* Win 3.1 */ - { - pdvi->dwMajorVersion = 3; - pdvi->dwMinorVersion = 51; - pdvi->dwBuildNumber = 0; - } - break; - case 0xc0000004: /* Win 95 */ - { - pdvi->dwMajorVersion = 4; - pdvi->dwMinorVersion = 0; - pdvi->dwBuildNumber = 950; - } - break; - case 0x04213303: /* NT 3.51 FIXME: correct ? */ - { - pdvi->dwMajorVersion = 3; - pdvi->dwMinorVersion = 51; - pdvi->dwBuildNumber = 0x421; - } - break; - case 0x05650004: /* NT 4.0 FIXME: correct ? */ - { - pdvi->dwMajorVersion = 4; - pdvi->dwMinorVersion = 0; - pdvi->dwBuildNumber = 0x565; - } - break; - default: - { - ERR(ver, "Unknown Windows version, please add it to the list !\n"); - } - break; - } - return 0; /* winerror.h: NOERROR */ -} - /*********************************************************************** * OaBuildVersion [OLEAUT32.170] */ diff --git a/misc/win32s16.c b/misc/win32s16.c index 48b00cb4b30..42913d11019 100644 --- a/misc/win32s16.c +++ b/misc/win32s16.c @@ -10,7 +10,7 @@ #include "windows.h" #include "debug.h" -void BootTask() +void WINAPI BootTask() { MSG("BootTask(): should only be used by WIN32S.EXE.\n"); } diff --git a/misc/windebug.c b/misc/windebug.c index c22c7125bc5..53b4e257fb8 100644 --- a/misc/windebug.c +++ b/misc/windebug.c @@ -14,7 +14,7 @@ * WinNotify (WINDEBUG.3) * written without _any_ docu */ -void WinNotify(CONTEXT *context) +void WINAPI WinNotify(CONTEXT *context) { FIXME(dll, "(AX=%04x):stub.\n", AX_reg(context)); switch (AX_reg(context)) diff --git a/msdos/dosmem.c b/msdos/dosmem.c index 1affb0a84ba..85ee94d6381 100644 --- a/msdos/dosmem.c +++ b/msdos/dosmem.c @@ -79,6 +79,9 @@ static char *DOSMEM_dosmem; DWORD DOSMEM_CollateTable; + DWORD DOSMEM_ErrorCall; + DWORD DOSMEM_ErrorBuffer; + /* use 2 low bits of 'size' for the housekeeping */ #define DM_BLOCK_DEBUG 0xABE00000 @@ -185,6 +188,60 @@ static void DOSMEM_InitCollateTable() for ( i = 0; i < 0x100; i++) *tbl++ = i; } +/*********************************************************************** + * DOSMEM_InitErrorTable + * + * Initialises the error tables (DOS 5+) + */ +static void DOSMEM_InitErrorTable() +{ + DWORD x; + char *call; + + /* We will use a snippet of real mode code that calls */ + /* a WINE-only interrupt to handle moving the requested */ + /* message into the buffer... */ + + /* FIXME - There is still something wrong... */ + + /* FIXME - Find hex values for opcodes... + + (On call, AX contains message number + DI contains 'offset' (??) + Resturn, ES:DI points to counted string ) + + PUSH BX + MOV BX, AX + MOV AX, (arbitrary subfunction number) + INT (WINE-only interrupt) + POP BX + RET + + */ + + const int code = 4; + const int buffer = 80; + const int SIZE_TO_ALLOCATE = code + buffer; + + /* FIXME - Complete rewrite of the table system to save */ + /* precious DOS space. Now, we return the 0001:???? as */ + /* DOS 4+ (??, it seems to be the case in MS 7.10) treats that */ + /* as a special case and programs will use the alternate */ + /* interface (a farcall returned with INT 24 (AX = 0x122e, DL = */ + /* 0x08) which lets us have a smaller memory footprint anyway. */ + + x = GlobalDOSAlloc(SIZE_TO_ALLOCATE); + + DOSMEM_ErrorCall = MAKELONG(0,(x>>16)); + DOSMEM_ErrorBuffer = DOSMEM_ErrorCall + code; + + call = DOSMEM_MapRealToLinear(DOSMEM_ErrorCall); + + memset(call, 0, SIZE_TO_ALLOCATE); + + /* Fixme - Copy assembly into buffer here */ +} + /*********************************************************************** * DOSMEM_InitMemory * @@ -245,6 +302,7 @@ BOOL32 DOSMEM_Init(HMODULE16 hModule) DOSMEM_FillBiosSegment(); DOSMEM_InitMemory(0); DOSMEM_InitCollateTable(); + DOSMEM_InitErrorTable(); } else DOSMEM_InitMemory(hModule); diff --git a/msdos/dpmi.c b/msdos/dpmi.c index ebcfca162b8..48ae756b8d1 100644 --- a/msdos/dpmi.c +++ b/msdos/dpmi.c @@ -143,7 +143,7 @@ static void INT_GetRealModeContext( REALMODECALL *call, CONTEXT *context ) ESI_reg(context) = call->esi; EDI_reg(context) = call->edi; EBP_reg(context) = call->ebp; - EFL_reg(context) = call->fl; + EFL_reg(context) = call->fl | 0x00020000; /* V86 */ EIP_reg(context) = call->ip; ESP_reg(context) = call->sp; CS_reg(context) = call->cs; @@ -151,6 +151,7 @@ static void INT_GetRealModeContext( REALMODECALL *call, CONTEXT *context ) ES_reg(context) = call->es; FS_reg(context) = call->fs; GS_reg(context) = call->gs; + (char*)V86BASE(context) = DOSMEM_MemoryBase(0); } @@ -188,160 +189,8 @@ static void INT_DoRealModeInt( CONTEXT *context ) INT_GetRealModeContext( call, &realmode_ctx ); RESET_CFLAG(context); - switch (BL_reg(context)) - { - case 0x2f: /* int2f */ - switch (AH_reg(&realmode_ctx)) - { - case 0x15: - /* MSCDEX hook */ - do_mscdex( &realmode_ctx, 1 ); - break; - case 0x7a: - /* NOVELL NetWare */ - switch (AL_reg(&realmode_ctx)) - { - case 0x20: /* Get VLM Call Address */ - /* return nothing -> NetWare not installed */ - break; - default: - SET_CFLAG(context); - break; - } - break; - default: - SET_CFLAG(context); - break; - } - break; - case 0x21: /* int21 */ - switch (AH_reg(&realmode_ctx)) - { - case 0x52: - ES_reg(&realmode_ctx) = 0; - EBX_reg(&realmode_ctx) = 0; - break; - case 0x65: - switch (AL_reg(&realmode_ctx)) - { - case 0x06: - {/* get collate table */ - /* ES:DI is a REALMODE pointer to 5 byte dosmem - * we fill that with 0x6, realmode pointer to collateTB - */ - char *table = DOSMEM_MapRealToLinear( - MAKELONG(EDI_reg(&realmode_ctx),ES_reg(&realmode_ctx))); - *(BYTE*)table = 0x06; - *(DWORD*)(table+1) = DOSMEM_CollateTable; - CX_reg(&realmode_ctx) = 258;/*FIXME: size of table?*/ - break; - } - default: - SET_CFLAG(context); - break; - } - break; - case 0x44: - switch (AL_reg(&realmode_ctx)) - { - case 0x0D: - {/* generic block device request */ - BYTE *dataptr = DOSMEM_MapRealToLinear( - MAKELONG(EDX_reg(&realmode_ctx),DS_reg(&realmode_ctx))); - int drive = DOS_GET_DRIVE(BL_reg(&realmode_ctx)); - if (CH_reg(&realmode_ctx) != 0x08) - { - SET_CFLAG(context); - break; - } - switch (CL_reg(&realmode_ctx)) - { - case 0x66: - { - char label[12],fsname[9],path[4]; - DWORD serial; - - strcpy(path,"x:\\");path[0]=drive+'A'; - GetVolumeInformation32A(path,label,12,&serial,NULL,NULL,fsname,9); - *(WORD*)dataptr = 0; - memcpy(dataptr+2,&serial,4); - memcpy(dataptr+6,label ,11); - memcpy(dataptr+17,fsname,8); - break; - } - case 0x60: /* get device parameters */ - /* used by defrag.exe of win95 */ - memset(dataptr, 0, 0x26); - dataptr[0] = 0x04; - dataptr[6] = 0; /* media type */ - if (drive > 1) - { - dataptr[1] = 0x05; /* fixed disk */ - setword(&dataptr[2], 0x01); /* non removable */ - setword(&dataptr[4], 0x300); /* # of cylinders */ - } - else - { - dataptr[1] = 0x07; /* block dev, floppy */ - setword(&dataptr[2], 0x02); /* removable */ - setword(&dataptr[4], 80); /* # of cylinders */ - } - CreateBPB(drive, &dataptr[7], FALSE); - break; - default: - SET_CFLAG(context); - break; - } - } - break; - default: - SET_CFLAG(context); - break; - } - break; - case 0x58: /* GET OR SET MEMORY/UMB ALLOCATION STRATEGY */ - TRACE(int31,"GET OR SET MEMORY/UMB ALLOCATION STRATEGY subfunction %d\n", - AL_reg(context)); - switch (AL_reg(context)) - { - case 0x00: - AX_reg(context) = 1; - break; - case 0x02: - AX_reg(context) = 0; - break; - case 0x01: - case 0x03: - break; - } - RESET_CFLAG(context); - break; - case 0x60: {/* CANONICALIZE PATH */ - LPCSTR path = (LPCSTR)DOSMEM_MapRealToLinear((DS_reg(&realmode_ctx)<<16)+SI_reg(&realmode_ctx)); - - TRACE(int31,"TRUENAME %s\n",path); - if (!GetFullPathName32A( - path, - 128, - (LPSTR)DOSMEM_MapRealToLinear( - (ES_reg(&realmode_ctx)<<16)+DI_reg(&realmode_ctx)), - NULL - )) - SET_CFLAG(context); - else - AX_reg(&realmode_ctx) = 0; - } - break; - default: - SET_CFLAG(context); - break; - } - break; - default: - SET_CFLAG(context); - break; - } - + if (INT_RealModeInterrupt( BL_reg(context), context )) + SET_CFLAG(context); if (EFL_reg(context)&1) { FIXME(int31,"%02x: EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n", BL_reg(context), EAX_reg(&realmode_ctx), EBX_reg(&realmode_ctx), diff --git a/msdos/int10.c b/msdos/int10.c index d58c29eb095..5017e011c70 100644 --- a/msdos/int10.c +++ b/msdos/int10.c @@ -7,33 +7,300 @@ /* #define DEBUG_INT */ #include "debug.h" - /********************************************************************** * INT_Int10Handler * * Handler for int 10h (video). + * + * NOTE: + * Most INT 10 functions for text-mode, CGA, EGA, and VGA cards + * are present in this list. (SVGA and XGA are not) That is not + * to say that all these functions should be supported, but if + * anyone is braindamaged enough to want to emulate one of these + * beasts then this should get you started. + * + * NOTE: + * Several common graphical extensions used by Microsoft hook + * off of here. I have *not* added them to this list (yet). They + * include: + * + * MSHERC.COM - More functionality for Hercules cards. + * EGA.SYS (also MOUSE.COM) - More for EGA cards. + * + * Yes, MS also added this support into their mouse driver. Don't + * ask me, I don't work for them. + * + * Joseph Pranevich - 9/98 */ + void WINAPI INT_Int10Handler( CONTEXT *context ) { switch(AH_reg(context)) { - case 0x0f: - AL_reg(context) = 0x5b; + case 0x00: /* SET VIDEO MODE */ + /* If the mode is 0x02 or 0x07 then we are still in + 80x25 text and can ignore the request */ + if ((AL_reg(context) == 0x02) || (AL_reg(context) == 0x07)) + break; + + FIXME(int10, "Set Video Mode - Not Supported\n"); break; - case 0x12: - if (BL_reg(context) == 0x10) - { - BX_reg(context) = 0x0003; - CX_reg(context) = 0x0009; + case 0x01: /* SET CURSOR SHAPE */ + FIXME(int10, "Set Cursor Shape - Not Supported\n"); + break; + + case 0x02: /* SET CURSOR POSITION */ + FIXME(int10, "Set Cursor Position - Not Supported\n"); + break; + + case 0x03: /* GET CURSOR POSITION AND SIZE */ + FIXME(int10, "Get Cursor Position and Size - Not Supported\n"); + CX_reg(context) = 0x0000; /* Bogus cursor data */ + DX_reg(context) = 0x0000; + break; + + case 0x04: /* READ LIGHT PEN POSITION */ + FIXME(int10, "Read Light Pen Position - Not Supported\n"); + AH_reg(context) = 0x00; /* Not down */ + break; + + case 0x05: /* SELECT ACTIVE DISPLAY PAGE */ + FIXME(int10, "Select Active Display Page - Not Supported\n"); + break; + + case 0x06: /* SCROLL UP WINDOW */ + FIXME(int10, "Scroll Up Window - Not Supported\n"); + break; + + case 0x07: /* SCROLL DOWN WINDOW */ + FIXME(int10, "Scroll Down Window - Not Supported\n"); + break; + + case 0x08: /* READ CHARACTER AND ATTRIBUTE AT CURSOR POSITION */ + FIXME(int10, + "Read Character and Attribute at Cursor Position - Not Supported\n"); + break; + + case 0x09: /* WRITE CHARACTER AND ATTRIBUTE AT CURSOR POSITION */ + case 0x0a: /* WRITE CHARACTER ONLY AT CURSOR POSITION */ + while (CX_reg(context)) { + _lwrite16(1, &AL_reg(context), 1); + (CX_reg(context))--; } break; - - case 0x1a: - BX_reg(context) = 0x0008; + + case 0x0b: + switch BH_reg(context) { + case 0x00: /* SET BACKGROUND/BORDER COLOR */ + FIXME(int10, "Set Background/Border Color - Not Supported\n"); + break; + case 0x01: /* SET PALETTE */ + FIXME(int10, "Set Palette - Not Supported\n"); + break; + default: + FIXME(int10, "INT 10 AH = 0x0b BH = 0x%x - Unknown\n", + BH_reg(context)); + break; + } + break; + + case 0x0c: /* WRITE GRAPHICS PIXEL */ + /* Not in graphics mode, can ignore w/o error */ + FIXME(int10, "Write Graphics Pixel - Not Supported\n"); + break; + + case 0x0d: /* READ GRAPHICS PIXEL */ + /* Not in graphics mode, can ignore w/o error */ + FIXME(int10, "Read Graphics Pixel - Not Supported\n"); + break; + + case 0x0e: /* TELETYPE OUTPUT */ + _lwrite16(1, &AL_reg(context), 1); + break; + + case 0x0f: /* GET CURRENT VIDEO MODE */ + AL_reg(context) = 0x5b; /* WHY ARE WE RETURNING THIS? */ + break; + + case 0x10: + switch AL_reg(context) { + case 0x00: /* SET SINGLE PALETTE REGISTER */ + FIXME(int10, "Set Single Palette Register - Not Supported\n"); + break; + case 0x01: /* SET BORDER (OVERSCAN) */ + FIXME(int10, "Set Border (Overscan) - Not Supported\n"); + break; + case 0x02: /* SET ALL PALETTE REGISTERS */ + FIXME(int10, "Set all palette registers - Not Supported\n"); + break; + case 0x03: /* TOGGLE INTENSITY/BLINKING BIT */ + FIXME(int10, "Toggle Intensity/Blinking Bit - Not Supported\n"); + break; + case 0x07: /* GET INDIVIDUAL PALETTE REGISTER */ + FIXME(int10, "Get Individual Palette Register - Not Supported\n"); + break; + case 0x08: /* READ OVERSCAN (BORDER COLOR) REGISTER */ + FIXME(int10, + "Read Overscan (Border Color) Register - Not Supported\n"); + break; + case 0x09: /* READ ALL PALETTE REGISTERS AND OVERSCAN REGISTER */ + FIXME(int10, + "Read All Palette Registers and Overscan Register " + " - Not Supported\n"); + break; + case 0x10: /* SET INDIVIDUAL DAC REGISTER */ + FIXME(int10, "Set Individual DAC register - Not Supported\n"); + break; + case 0x12: /* SET BLOCK OF DAC REGISTERS */ + FIXME(int10, "Set Block of DAC registers - Not Supported\n"); + break; + case 0x13: /* SELECT VIDEO DAC COLOR PAGE */ + FIXME(int10, "Select video DAC color page - Not Supported\n"); + break; + case 0x15: /* READ INDIVIDUAL DAC REGISTER */ + FIXME(int10, "Read individual DAC register - Not Supported\n"); + break; + case 0x17: /* READ BLOCK OF DAC REGISTERS */ + FIXME(int10, "Read block of DAC registers - Not Supported\n"); + break; + case 0x18: /* SET PEL MASK */ + FIXME(int10, "Set PEL mask - Not Supported\n"); + break; + case 0x19: /* READ PEL MASK */ + FIXME(int10, "Read PEL mask - Not Supported\n"); + break; + case 0x1a: /* GET VIDEO DAC COLOR PAGE STATE */ + FIXME(int10, "Get video DAC color page state - Not Supported\n"); + break; + case 0x1b: /* PERFORM GRAY-SCALE SUMMING */ + FIXME(int10, "Perform Gray-scale summing - Not Supported\n"); + break; + default: + FIXME(int10, "INT 10 AH = 0x10 AL = 0x%x - Unknown\n", + AL_reg(context)); + break; + } + break; + + case 0x11: /* TEXT MODE CHARGEN */ + /* Note that second subfunction is *almost* identical. */ + /* See INTERRUPT.A for details. */ + switch AH_reg(context) { + case 0x00: /* LOAD USER SPECIFIED PATTERNS */ + case 0x10: + FIXME(int10, "Load User Specified Patterns - Not Supported\n"); + break; + case 0x01: /* LOAD ROM MONOCHROME PATTERNS */ + case 0x11: + FIXME(int10, "Load ROM Monochrome Patterns - Not Suppoted\n"); + break; + case 0x02: /* LOAD ROM 8x8 DOUBLE-DOT PATTERNS */ + case 0x12: + FIXME(int10, + "Load ROM 8x8 Double Dot Patterns - Not Supported\n"); + break; + case 0x03: /* SET BLOCK SPECIFIER */ + FIXME(int10, "Set Block Specifier - Not Supported\n"); + break; + case 0x04: /* LOAD ROM 8x16 CHARACTER SET */ + case 0x14: + FIXME(int10, "Load ROM 8x16 Character Set - Not Supported\n"); + break; + case 0x20: /* SET USER 8x16 GRAPHICS CHARS */ + FIXME(int10, "Set User 8x16 Graphics Chars - Not Supported\n"); + break; + case 0x21: /* SET USER GRAPICS CHARACTERS */ + FIXME(int10, "Set User Graphics Characters - Not Supported\n"); + break; + case 0x22: /* SET ROM 8x14 GRAPHICS CHARS */ + FIXME(int10, "Set ROM 8x14 Graphics Chars - Not Supported\n"); + break; + case 0x23: /* SET ROM 8x8 DBL DOT CHARS */ + FIXME(int10, + "Set ROM 8x8 Dbl Dot Chars (Graphics) - Not Supported\n"); + break; + case 0x24: /* LOAD 8x16 GRAPHIC CHARS */ + FIXME(int10, "Load 8x16 Graphic Chars - Not Supported\n"); + break; + case 0x30: /* GET FONT INFORMATION */ + FIXME(int10, "Get Font Information - Not Supported\n"); + break; + default: + FIXME(int10, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n", + AL_reg(context)); + break; + } + break; + + case 0x12: /* ALTERNATE FUNCTION SELECT */ + switch BL_reg(context) { + case 0x10: /* GET EGA INFO */ + TRACE(int10, "EGA Info Requested"); + BX_reg(context) = 0x0003; + CX_reg(context) = 0x0009; + break; + case 0x20: /* ALTERNATE PRTSC */ + FIXME(int10, "Install Alternate Print Screen - Not Supported\n"); + break; + case 0x30: /* SELECT VERTICAL RESOULTION */ + FIXME(int10, "Select Vertical Resoultion - Not Supported\n"); + break; + case 0x31: /* ENABLE/DISABLE PALETTE LOADING */ + FIXME(int10, "Palette Loading - Not Supported\n"); + break; + case 0x32: /* ENABLE/DISABLE VIDEO ADDRERSSING */ + FIXME(int10, "Video Addressing - Not Supported\n"); + break; + case 0x33: /* ENABLE/DISABLE GRAY SCALE SUMMING */ + FIXME(int10, "Gray Scale Summing - Not Supported\n"); + break; + case 0x34: /* ENABLE/DISABLE CURSOR EMULATION */ + FIXME(int10, "Cursor Emulation - Not Supported\n"); + break; + case 0x36: /* VIDEO ADDRESS CONTROL */ + FIXME(int10, "Video Address Control - Not Supported\n"); + break; + default: + FIXME(int10, "INT 10 AH = 0x11 AL = 0x%x - Unknown\n", + AL_reg(context)); + break; + } + break; + + case 0x13: /* WRITE STRING */ + /* This one does not imply that string be at cursor. */ + FIXME(int10, "Write String - Not Supported\n"); + break; + + case 0x1a: + switch AL_reg(context) { + case 0x00: /* GET DISPLAY COMBINATION CODE */ + TRACE(int10, "Get Display Combination Code"); + /* Why are we saying this? */ + /* Do we need to check if we are in a windows or text app? */ + BX_reg(context) = 0x0008; /* VGA w/ color analog display */ + break; + case 0x01: /* SET DISPLAY COMBINATION CODE */ + FIXME(int10, "Set Display Combination Code - Not Supported\n"); + break; + default: + FIXME(int10, "INT 10 AH = 0x1a AL = 0x%x - Unknown\n", + AL_reg(context)); + break; + } + break; + + case 0x1b: /* FUNCTIONALITY/STATE INFORMATION */ + FIXME(int10, "Get Functionality/State Information - Not Supported\n"); + break; + + case 0x1c: /* SAVE/RESTORE VIDEO STATE */ + FIXME(int10, "Save/Restore Video State - Not Supported\n"); break; default: + FIXME(int10, "Unknown - 0x%x\n", AH_reg(context)); INT_BARF( context, 0x10 ); } } diff --git a/msdos/int1a.c b/msdos/int1a.c index 1436bb3d27d..3504f67e357 100644 --- a/msdos/int1a.c +++ b/msdos/int1a.c @@ -39,8 +39,10 @@ DWORD INT1A_GetTicksSinceMidnight(void) /********************************************************************** * INT_Int1aHandler * - * Handler for int 1ah (date and time). - */ + * Handler for int 1ah + * 0x00 - 0x07 - date and time + * 0x?? - 0x?? - Microsoft Real Time Compression Interface + */ void WINAPI INT_Int1aHandler( CONTEXT *context ) { time_t ltime; @@ -49,7 +51,7 @@ void WINAPI INT_Int1aHandler( CONTEXT *context ) switch(AH_reg(context)) { - case 0: + case 0x00: ticks = INT1A_GetTicksSinceMidnight(); CX_reg(context) = HIWORD(ticks); DX_reg(context) = LOWORD(ticks); @@ -57,7 +59,7 @@ void WINAPI INT_Int1aHandler( CONTEXT *context ) TRACE(int,"int1a: AH=00 -- ticks=%ld\n", ticks); break; - case 2: + case 0x02: ltime = time(NULL); bdtime = localtime(<ime); @@ -65,7 +67,7 @@ void WINAPI INT_Int1aHandler( CONTEXT *context ) BIN_TO_BCD(bdtime->tm_min); DX_reg(context) = (BIN_TO_BCD(bdtime->tm_sec)<<8); - case 4: + case 0x04: ltime = time(NULL); bdtime = localtime(<ime); CX_reg(context) = (BIN_TO_BCD(bdtime->tm_year/100)<<8) | @@ -75,18 +77,29 @@ void WINAPI INT_Int1aHandler( CONTEXT *context ) break; /* setting the time,date or RTC is not allow -EB */ - case 1: + case 0x01: /* set system time */ - case 3: + case 0x03: /* set RTC time */ - case 5: + case 0x05: /* set RTC date */ - case 6: + case 0x06: /* set ALARM */ - case 7: + case 0x07: /* cancel ALARM */ break; + case 0xb0: /* Microsoft Real Time Compression */ + switch AL_reg(context) + { + case 0x01: + /* not present */ + break; + default: + INT_BARF(context, 0x1a); + } + break; + default: INT_BARF( context, 0x1a ); } diff --git a/msdos/int21.c b/msdos/int21.c index a4e95f1c80a..a17b6302c7d 100644 --- a/msdos/int21.c +++ b/msdos/int21.c @@ -732,6 +732,7 @@ static int INT21_FindFirstFCB( CONTEXT *context ) if (*fcb == 0xff) pFCB = (FINDFILE_FCB *)(fcb + 7); else pFCB = (FINDFILE_FCB *)fcb; drive = DOS_GET_DRIVE( pFCB->drive ); + if (!DRIVE_IsValid( drive )) return 0; root = DRIVE_GetRoot( drive ); cwd = DRIVE_GetUnixCwd( drive ); pFCB->unixPath = HeapAlloc( GetProcessHeap(), 0, @@ -894,6 +895,21 @@ INT21_networkfunc (CONTEXT *context) } } +static void INT21_SetCurrentPSP(CONTEXT *context) +{ +/* FIXME - What is this MZ stuff and what if it isn't supported?? */ +#ifdef MZ_SUPPORTED + TDB *pTask = hModule ? NULL : (TDB *)GlobalLock16( GetCurrentTask() ); + NE_MODULE *pModule = (hModule || pTask) ? NE_GetPtr( hModule ? hModule : pTask->hModule ) : NULL; + + GlobalUnlock16( GetCurrentTask() ); + if (pModule->lpDosTask) + pModule->lpDosTask->psp_seg = BX_reg(context); +#else + FIXME(int21, "MZ Not Supported.\n"); +#endif +} + static WORD INT21_GetCurrentPSP() { #ifdef MZ_SUPPORTED @@ -1189,8 +1205,13 @@ void WINAPI DOS3Call( CONTEXT *context ) (AL_reg(context) == 0x00)?"OEM number":"version flag"); AX_reg(context) = (HIWORD(GetVersion16()) >> 8) | (HIWORD(GetVersion16()) << 8); - BX_reg(context) = 0x0012; /* 0x123456 is Wine's serial # */ - CX_reg(context) = 0x3456; +#if 0 + AH_reg(context) = 0x7; + AL_reg(context) = 0xA; +#endif + + BX_reg(context) = 0x00FF; /* 0x123456 is Wine's serial # */ + CX_reg(context) = 0x0000; break; case 0x31: /* TERMINATE AND STAY RESIDENT */ @@ -1554,10 +1575,21 @@ void WINAPI DOS3Call( CONTEXT *context ) case 0x48: /* ALLOCATE MEMORY */ TRACE(int21,"ALLOCATE MEMORY for %d paragraphs\n", BX_reg(context)); { - LPVOID *mem = DOSMEM_GetBlock(0,BX_reg(context)<<4,NULL); + LPVOID *mem; + if (ISV86(context)) + { + mem= DOSMEM_GetBlock(0,(DWORD)BX_reg(context)<<4,NULL); if (mem) AX_reg(context) = DOSMEM_MapLinearToDos(mem)>>4; - else { + } + else + { + mem = (LPVOID)GlobalDOSAlloc(BX_reg(context)<<4); + if (mem) + AX_reg(context) = (DWORD)mem&0xffff; + } + if (!mem) + { SET_CFLAG(context); AX_reg(context) = 0x0008; /* insufficient memory */ BX_reg(context) = DOSMEM_Available(0)>>4; @@ -1567,15 +1599,29 @@ void WINAPI DOS3Call( CONTEXT *context ) case 0x49: /* FREE MEMORY */ TRACE(int21,"FREE MEMORY segment %04lX\n", ES_reg(context)); - if (!DOSMEM_FreeBlock(0,DOSMEM_MapDosToLinear(ES_reg(context)<<4))) { + BOOL32 ret; + if (ISV86(context)) + ret= DOSMEM_FreeBlock(0,DOSMEM_MapDosToLinear(ES_reg(context)<<4)); + else + { + ret = !GlobalDOSFree(ES_reg(context)); + /* If we don't reset ES_reg, we will fail in the relay code */ + ES_reg(context)=ret; + } + if (!ret) + { + TRACE(int21,"FREE MEMORY failed\n"); SET_CFLAG(context); AX_reg(context) = 0x0009; /* memory block address invalid */ } + } break; case 0x4a: /* RESIZE MEMORY BLOCK */ TRACE(int21,"RESIZE MEMORY segment %04lX to %d paragraphs\n", ES_reg(context), BX_reg(context)); + if (!ISV86(context)) + FIXME(int21,"RESIZE MEMORY probably insufficent implementation. Expect crash soon\n"); { LPVOID *mem = DOSMEM_ResizeBlock(0,DOSMEM_MapDosToLinear(ES_reg(context)<<4), BX_reg(context)<<4,NULL); @@ -1624,7 +1670,11 @@ void WINAPI DOS3Call( CONTEXT *context ) } else AX_reg(context) = 0; /* OK */ break; - + case 0x50: /* SET CURRENT PROCESS ID (SET PSP ADDRESS) */ + TRACE(int21, "SET CURRENT PROCESS ID (GET PSP ADDRESS)\n"); + /* FIXME: Is this right? */ + INT21_SetCurrentPSP(context); + break; case 0x51: /* GET PSP ADDRESS */ TRACE(int21,"GET CURRENT PROCESS ID (GET PSP ADDRESS)\n"); /* FIXME: should we return the original DOS PSP upon */ diff --git a/msdos/int2f.c b/msdos/int2f.c index 914333a5a76..0559fff1236 100644 --- a/msdos/int2f.c +++ b/msdos/int2f.c @@ -26,19 +26,61 @@ static void do_int2f_16( CONTEXT *context ); */ void WINAPI INT_Int2fHandler( CONTEXT *context ) { + TRACE(int,"Subfunction 0x%X\n", AH_reg(context)); + switch(AH_reg(context)) { case 0x10: AL_reg(context) = 0xff; /* share is installed */ break; + case 0x12: + switch (AL_reg(context)) + { + case 0x2e: /* get or set DOS error table address */ + switch (DL_reg(context)) + { + /* Four tables: even commands are 'get', odd are 'set' */ + /* DOS 5.0+ ignores "set" commands */ + case 0x01: + case 0x03: + case 0x05: + case 0x07: + case 0x09: + break; + /* Instead of having a message table in DOS-space, */ + /* we can use a special case for MS-DOS to force */ + /* the secondary interface. */ + case 0x00: + case 0x02: + case 0x04: + case 0x06: + ES_reg(context) = 0x0001; + DI_reg(context) = 0x0000; + break; + case 0x08: + FIXME(int, "No real-mode handler for errors yet! (bye!)"); + break; + default: + INT_BARF(context, 0x2f); + } + break; + default: + INT_BARF(context, 0x2f); + } + break; + case 0x15: /* mscdex */ - do_mscdex(context, FALSE ); + do_mscdex(context); break; case 0x16: do_int2f_16( context ); break; + case 0x43: + FIXME(int,"check for XMS (not supported)\n"); + AL_reg(context) = 0x42; /* != 0x80 */ + break; case 0x45: switch (AL_reg(context)) @@ -82,6 +124,17 @@ void WINAPI INT_Int2fHandler( CONTEXT *context ) INT_BARF( context, 0x2f ); } break; + case 0x7a: /* NOVELL NetWare */ + switch (AL_reg(context)) + { + case 0x20: /* Get VLM Call Address */ + /* return nothing -> NetWare not installed */ + break; + default: + SET_CFLAG(context); + break; + } + break; case 0xb7: /* append */ AL_reg(context) = 0; /* not installed */ break; @@ -162,7 +215,9 @@ static void do_int2f_16( CONTEXT *context ) /* FIXME: is this right? Specs say that this should only be callable in real (v86) mode which we never enter. */ + /* FIXME: we do now, and this breaks pkunzip */ case 0x87: /* DPMI installation check */ + if (ISV86(context)) break; /* so bail out for now if in v86 mode */ { SYSTEM_INFO si; @@ -185,7 +240,7 @@ static void do_int2f_16( CONTEXT *context ) } } -void do_mscdex( CONTEXT *context, int dorealmode ) +void do_mscdex( CONTEXT *context ) { int drive, count; char *p; @@ -218,10 +273,7 @@ void do_mscdex( CONTEXT *context, int dorealmode ) break; case 0x0D: /* get drive letters */ - if (dorealmode) - p = DOSMEM_MapRealToLinear(MAKELONG(BX_reg(context),ES_reg(context))); - else - p = PTR_SEG_OFF_TO_LIN(ES_reg(context), BX_reg(context)); + p = CTX_SEG_OFF_TO_LIN(context, ES_reg(context), BX_reg(context)); memset( p, 0, MAX_DOS_DRIVES ); for (drive = 0; drive < MAX_DOS_DRIVES; drive++) { @@ -230,8 +282,11 @@ void do_mscdex( CONTEXT *context, int dorealmode ) break; #ifdef linux + /* FIXME: why a new linux-only CDROM drive access, for crying out loud? + * There are pretty complete routines in multimedia/mcicda.c already! */ case 0x10: /* direct driver acces */ - do_mscdex_dd(context,dorealmode); + FIXME(cdaudio,"mscdex should use multimedia/mcicda.c"); + do_mscdex_dd(context,ISV86(context)); break; #endif diff --git a/msdos/interrupts.c b/msdos/interrupts.c index da6ff2ae0a8..79c714454df 100644 --- a/msdos/interrupts.c +++ b/msdos/interrupts.c @@ -39,3 +39,35 @@ void INT_SetHandler( BYTE intnum, FARPROC16 handler ) intnum, HIWORD(handler), LOWORD(handler) ); INT_Vectors[intnum] = handler; } + + +/********************************************************************** + * INT_RealModeInterrupt + * + * Handle real mode interrupts + */ +int INT_RealModeInterrupt( BYTE intnum, PCONTEXT context ) +{ + /* we should really map to if1632/wprocs.spec, but not all + * interrupt handlers are adapted to support real mode yet */ + switch (intnum) { + case 0x10: + INT_Int10Handler(context); + break; + case 0x1a: + INT_Int1aHandler(context); + break; + case 0x20: + INT_Int20Handler(context); + break; + case 0x21: + DOS3Call(context); + break; + case 0x2f: + INT_Int2fHandler(context); + break; + default: + return 1; + } + return 0; +} diff --git a/multimedia/mmsystem.c b/multimedia/mmsystem.c index 40d44244c3d..deffa1a7cd4 100644 --- a/multimedia/mmsystem.c +++ b/multimedia/mmsystem.c @@ -118,46 +118,55 @@ MMSYSTEM_MMTIME16to32(LPMMTIME32 mmt32,LPMMTIME16 mmt16) { memcpy(&(mmt16->u),&(mmt32->u),sizeof(mmt16->u)); } -/************************************************************************** - * PlaySoundA [WINMM.1] - */ -BOOL32 WINAPI PlaySound32A(LPCSTR pszSound, HMODULE32 hmod, DWORD fdwSound) +HANDLE32 PlaySound_hThread = 0; +HANDLE32 PlaySound_hPlayEvent = 0; +HANDLE32 PlaySound_hReadyEvent = 0; +HANDLE32 PlaySound_hMiddleEvent = 0; +BOOL32 PlaySound_Result = FALSE; +int PlaySound_Stop = FALSE; +int PlaySound_Playing = FALSE; + +LPCSTR PlaySound_pszSound = NULL; +HMODULE32 PlaySound_hmod = 0; +DWORD PlaySound_fdwSound = 0; +int PlaySound_Loop = FALSE; +int PlaySound_SearchMode = 0; /* 1 - sndPlaySound search order + 2 - PlaySound order */ + +HMMIO16 get_mmioFromFile(LPCSTR lpszName) { - TRACE(mmsys, "pszSound='%p' hmod=%04X fdwSound=%08lX\n", - pszSound, hmod, fdwSound); - if(hmod != 0 || !(fdwSound & SND_FILENAME)) { - FIXME(mmsys, "only disk sound files are supported. Type: %08lx\n",fdwSound); - return FALSE; - } else - return sndPlaySound(pszSound, (UINT16) fdwSound); + return mmioOpen16((LPSTR)lpszName, NULL, + MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); } -/************************************************************************** - * PlaySoundW [WINMM.18] - */ -BOOL32 WINAPI PlaySound32W(LPCWSTR pszSound, HMODULE32 hmod, DWORD fdwSound) +HMMIO16 get_mmioFromProfile(UINT32 uFlags, LPCSTR lpszName) { - LPSTR pszSoundA = HEAP_strdupWtoA(GetProcessHeap(),0,pszSound); - BOOL32 bSound; - - bSound = PlaySound32A(pszSoundA, hmod, fdwSound); - HeapFree(GetProcessHeap(),0,pszSoundA); - return bSound; + char str[128]; + LPSTR ptr; + HMMIO16 hmmio; + TRACE(mmsys, "searching in SystemSound List !\n"); + GetProfileString32A("Sounds", (LPSTR)lpszName, "", str, sizeof(str)); + if (strlen(str) == 0) { + if (uFlags & SND_NODEFAULT) return 0; + GetProfileString32A("Sounds", "Default", "", str, sizeof(str)); + if (strlen(str) == 0) return 0; + } + if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0'; + hmmio = get_mmioFromFile(str); + if (hmmio == 0) { + WARN(mmsys, "can't find SystemSound='%s' !\n", str); + return 0; + } + return hmmio; } -/************************************************************************** -* sndPlaySound [MMSYSTEM.2] -*/ -BOOL16 WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT16 uFlags) +BOOL16 WINAPI proc_PlaySound(LPCSTR lpszSoundName, UINT32 uFlags) { BOOL16 bRet = FALSE; HMMIO16 hmmio; MMCKINFO ckMainRIFF; - char str[128]; - LPSTR ptr; - TRACE(mmsys, "SoundName='%s' uFlags=%04X !\n", - lpszSoundName, uFlags); + TRACE(mmsys, "SoundName='%s' uFlags=%04X !\n", lpszSoundName, uFlags); if (lpszSoundName == NULL) { TRACE(mmsys, "Stop !\n"); return FALSE; @@ -170,26 +179,32 @@ BOOL16 WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT16 uFlags) mminfo.cchBuffer = -1; TRACE(mmsys, "Memory sound %p\n",lpszSoundName); hmmio = mmioOpen16(NULL, &mminfo, MMIO_READ); - } else - hmmio = mmioOpen16((LPSTR)lpszSoundName, NULL, - MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); + } else { + hmmio = 0; + if (uFlags & SND_ALIAS) + if ((hmmio=get_mmioFromProfile(uFlags, lpszSoundName)) == 0) + return FALSE; - if (hmmio == 0) - { - TRACE(mmsys, "searching in SystemSound List !\n"); - GetProfileString32A("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str)); - if (strlen(str) == 0) return FALSE; - if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0'; - hmmio = mmioOpen16(str, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); - if (hmmio == 0) - { - WARN(mmsys, "can't find SystemSound='%s' !\n", str); - return FALSE; - } + if (uFlags & SND_FILENAME) + if ((hmmio=get_mmioFromFile(lpszSoundName)) == 0) return FALSE; + + if (PlaySound_SearchMode == 1) { + PlaySound_SearchMode = 0; + if ((hmmio=get_mmioFromFile(lpszSoundName)) == 0) + if ((hmmio=get_mmioFromProfile(uFlags, lpszSoundName)) == 0) + return FALSE; + } + + if (PlaySound_SearchMode == 2) { + PlaySound_SearchMode = 0; + if ((hmmio=get_mmioFromProfile(uFlags | SND_NODEFAULT, lpszSoundName)) == 0) + if ((hmmio=get_mmioFromFile(lpszSoundName)) == 0) + if ((hmmio=get_mmioFromProfile(uFlags, lpszSoundName)) == 0) return FALSE; + } } - + if (mmioDescend(hmmio, &ckMainRIFF, NULL, 0) == 0) - { + do { TRACE(mmsys, "ParentChunk ckid=%.4s fccType=%.4s cksize=%08lX \n", (LPSTR)&ckMainRIFF.ckid, (LPSTR)&ckMainRIFF.fccType, ckMainRIFF.cksize); @@ -252,6 +267,11 @@ BOOL16 WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT16 uFlags) { while( left ) { + if (PlaySound_Stop) { + PlaySound_Stop = FALSE; + PlaySound_Loop = FALSE; + break; + } if (bufsize > left) bufsize = left; count = mmioRead32(hmmio,waveHdr.lpData,bufsize); if (count < 1) break; @@ -275,12 +295,150 @@ BOOL16 WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT16 uFlags) } } } - } + } while (PlaySound_Loop); if (hmmio != 0) mmioClose32(hmmio, 0); return bRet; } +static DWORD PlaySound_Thread(LPVOID arg) +{ + DWORD res; + HRSRC32 hRES; + HGLOBAL32 hGLOB; + void *ptr; + + while (TRUE) { + PlaySound_Playing=FALSE; + SetEvent(PlaySound_hReadyEvent); + res=WaitForSingleObject(PlaySound_hPlayEvent, INFINITE32); + ResetEvent(PlaySound_hReadyEvent); + SetEvent(PlaySound_hMiddleEvent); + if (res==WAIT_FAILED) ExitThread(2); + if (res!=WAIT_OBJECT_0) continue; + PlaySound_Playing=TRUE; + + if ((PlaySound_fdwSound & SND_RESOURCE) == SND_RESOURCE) { + if ((hRES=FindResource32A(PlaySound_hmod, PlaySound_pszSound, + "WAVE"))==0) { + PlaySound_Result=FALSE; + continue; + } + if ((hGLOB=LoadResource32(PlaySound_hmod, hRES))==0) { + PlaySound_Result=FALSE; + continue; + } + if ( (ptr=LockResource32(hGLOB)) == NULL ) { + FreeResource32(hGLOB); + PlaySound_Result=FALSE; + continue; + } + PlaySound_Result=proc_PlaySound(ptr, + ((UINT16) PlaySound_fdwSound ^ SND_RESOURCE) | SND_MEMORY); + FreeResource32(hGLOB); + continue; + } + PlaySound_Result=proc_PlaySound(PlaySound_pszSound, + (UINT16) PlaySound_fdwSound); + } +} + +/************************************************************************** + * PlaySoundA [WINMM.1] + */ +BOOL32 WINAPI PlaySound32A(LPCSTR pszSound, HMODULE32 hmod, DWORD fdwSound) +{ + static LPSTR StrDup = NULL; + + TRACE(mmsys, "pszSound='%p' hmod=%04X fdwSound=%08lX\n", + pszSound, hmod, fdwSound); + + if (PlaySound_hThread == 0) { /* This is the first time they called us */ + DWORD id; + if ((PlaySound_hThread = CreateThread(NULL, 0, PlaySound_Thread, + 0, 0, &id)) == 0) return FALSE; + if ((PlaySound_hReadyEvent=CreateEvent32A(NULL, TRUE, FALSE, NULL)) == 0) + return FALSE; + if ((PlaySound_hMiddleEvent=CreateEvent32A(NULL, FALSE, FALSE, NULL)) == 0) + return FALSE; + if ((PlaySound_hPlayEvent=CreateEvent32A(NULL, FALSE, FALSE, NULL)) == 0) + return FALSE; + } + +/* FIXME? I see no difference between SND_WAIT and SND_NOSTOP ! */ + if ((fdwSound & (SND_NOWAIT | SND_NOSTOP)) && PlaySound_Playing) return FALSE; + + /* Trying to stop if playing */ + if (PlaySound_Playing) PlaySound_Stop = TRUE; + +/* Waiting playing thread to get ready. I think 10 secs is ok & if not then leave*/ + if (WaitForSingleObject(PlaySound_hReadyEvent, 1000*10) != WAIT_OBJECT_0) + return FALSE; + + if (!pszSound || (fdwSound & SND_PURGE)) return FALSE; /* We stoped playing so leaving */ + + if (PlaySound_SearchMode != 1) PlaySound_SearchMode = 2; + if (!(fdwSound & SND_ASYNC)) { + if (fdwSound & SND_LOOP) return FALSE; + PlaySound_pszSound = pszSound; + PlaySound_hmod = hmod; + PlaySound_fdwSound = fdwSound; + PlaySound_Result = FALSE; + SetEvent(PlaySound_hPlayEvent); + if (WaitForSingleObject(PlaySound_hMiddleEvent, INFINITE32) != + WAIT_OBJECT_0) return FALSE; + if (WaitForSingleObject(PlaySound_hReadyEvent, INFINITE32) != + WAIT_OBJECT_0) return FALSE; + return PlaySound_Result; + } else { + PlaySound_hmod = hmod; + PlaySound_fdwSound = fdwSound; + PlaySound_Result = FALSE; + if (StrDup) { + HeapFree(GetProcessHeap(), 0, StrDup); + StrDup = NULL; + } + if (!((fdwSound & SND_MEMORY) || ((fdwSound & SND_RESOURCE) && + !((DWORD)pszSound >> 16)) || !pszSound)) { + StrDup = HEAP_strdupA(GetProcessHeap(),0,pszSound); + PlaySound_pszSound = StrDup; + } else PlaySound_pszSound = pszSound; + PlaySound_Loop = fdwSound & SND_LOOP; + SetEvent(PlaySound_hPlayEvent); + ResetEvent(PlaySound_hMiddleEvent); + return TRUE; + } + return FALSE; +} + +/************************************************************************** + * PlaySoundW [WINMM.18] + */ +BOOL32 WINAPI PlaySound32W(LPCWSTR pszSound, HMODULE32 hmod, DWORD fdwSound) +{ + LPSTR pszSoundA; + BOOL32 bSound; + + if (!((fdwSound & SND_MEMORY) || ((fdwSound & SND_RESOURCE) && + !((DWORD)pszSound >> 16)) || !pszSound)) { + pszSoundA = HEAP_strdupWtoA(GetProcessHeap(),0,pszSound); + bSound = PlaySound32A(pszSoundA, hmod, fdwSound); + HeapFree(GetProcessHeap(),0,pszSoundA); + } else + bSound = PlaySound32A((LPCSTR)pszSound, hmod, fdwSound); + + return bSound; +} + +/************************************************************************** +* sndPlaySound [MMSYSTEM.2] +*/ +BOOL16 WINAPI sndPlaySound(LPCSTR lpszSoundName, UINT16 uFlags) +{ + PlaySound_SearchMode = 1; + return PlaySound32A(lpszSoundName, 0, uFlags); +} + /************************************************************************** * mmsystemGetVersion [WINMM.134] */ @@ -1416,9 +1574,9 @@ DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS16 lpParms) } /************************************************************************** - * mciLoadCommandResource + * mciLoadCommandResource16 */ -UINT16 mciLoadCommandResource16(HANDLE16 hinst,LPCSTR resname,UINT16 type) +UINT16 WINAPI mciLoadCommandResource16(HANDLE16 hinst,LPCSTR resname,UINT16 type) { char buf[200]; OFSTRUCT ofs; diff --git a/objects/dc.c b/objects/dc.c index 1899d4879fd..b1ad95e1db1 100644 --- a/objects/dc.c +++ b/objects/dc.c @@ -117,8 +117,6 @@ static void DC_Init_DC_INFO( WIN_DC_INFO *win_dc_info ) win_dc_info->backgroundMode = OPAQUE; win_dc_info->backgroundColor = RGB( 255, 255, 255 ); win_dc_info->textColor = RGB( 0, 0, 0 ); - win_dc_info->backgroundPixel = 0; - win_dc_info->textPixel = 0; win_dc_info->brushOrgX = 0; win_dc_info->brushOrgY = 0; win_dc_info->textAlign = TA_LEFT | TA_TOP | TA_NOUPDATECP; @@ -234,13 +232,13 @@ BOOL32 DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors ) * We need to swap foreground and background because * Windows does it the wrong way... */ - val.foreground = dc->w.backgroundPixel; - val.background = dc->w.textPixel; + val.foreground = dc->u.x.backgroundPixel; + val.background = dc->u.x.textPixel; } else { val.foreground = dc->u.x.brush.pixel; - val.background = dc->w.backgroundPixel; + val.background = dc->u.x.backgroundPixel; } if (fMapColors && COLOR_PixelToPalette) { @@ -358,7 +356,7 @@ BOOL32 DC_SetupGCForPen( DC * dc ) val.foreground = dc->u.x.pen.pixel; val.function = DC_XROPfunction[dc->w.ROPmode-1]; } - val.background = dc->w.backgroundPixel; + val.background = dc->u.x.backgroundPixel; val.fill_style = FillSolid; if ((dc->u.x.pen.style!=PS_SOLID) && (dc->u.x.pen.style!=PS_INSIDEFRAME)) { @@ -421,8 +419,8 @@ BOOL32 DC_SetupGCForText( DC * dc ) if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc); val.function = GXcopy; /* Text is always GXcopy */ - val.foreground = dc->w.textPixel; - val.background = dc->w.backgroundPixel; + val.foreground = dc->u.x.textPixel; + val.background = dc->u.x.backgroundPixel; val.fill_style = FillSolid; val.font = xfs->fid; @@ -538,8 +536,6 @@ HDC16 WINAPI GetDCState( HDC16 hdc ) newdc->w.backgroundMode = dc->w.backgroundMode; newdc->w.backgroundColor = dc->w.backgroundColor; newdc->w.textColor = dc->w.textColor; - newdc->w.backgroundPixel = dc->w.backgroundPixel; - newdc->w.textPixel = dc->w.textPixel; newdc->w.brushOrgX = dc->w.brushOrgX; newdc->w.brushOrgY = dc->w.brushOrgY; newdc->w.textAlign = dc->w.textAlign; @@ -621,8 +617,6 @@ void WINAPI SetDCState( HDC16 hdc, HDC16 hdcs ) dc->w.backgroundMode = dcs->w.backgroundMode; dc->w.backgroundColor = dcs->w.backgroundColor; dc->w.textColor = dcs->w.textColor; - dc->w.backgroundPixel = dcs->w.backgroundPixel; - dc->w.textPixel = dcs->w.textPixel; dc->w.brushOrgX = dcs->w.brushOrgX; dc->w.brushOrgY = dcs->w.brushOrgY; dc->w.textAlign = dcs->w.textAlign; @@ -659,6 +653,8 @@ void WINAPI SetDCState( HDC16 hdc, HDC16 hdcs ) SelectObject32( hdc, dcs->w.hBrush ); SelectObject32( hdc, dcs->w.hFont ); SelectObject32( hdc, dcs->w.hPen ); + SetBkColor32( hdc, dcs->w.backgroundColor); + SetTextColor32( hdc, dcs->w.textColor); GDISelectPalette( hdc, dcs->w.hPalette, FALSE ); GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdcs ); @@ -800,8 +796,8 @@ HDC16 WINAPI CreateDC16( LPCSTR driver, LPCSTR device, LPCSTR output, if (!(dc = DC_AllocDC( funcs ))) return 0; dc->w.flags = 0; - TRACE(dc, "(%s %s %s): returning %04x\n", - driver, device, output, dc->hSelf ); + TRACE(dc, "(driver=%s, device=%s, output=%s): returning %04x\n", + debugstr_a(driver), debugstr_a(device), debugstr_a(output), dc->hSelf ); if (dc->funcs->pCreateDC && !dc->funcs->pCreateDC( dc, driver, device, output, initData )) @@ -1057,19 +1053,15 @@ COLORREF WINAPI SetBkColor16( HDC16 hdc, COLORREF color ) COLORREF WINAPI SetBkColor32( HDC32 hdc, COLORREF color ) { COLORREF oldColor; - DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); - if (!dc) - { - dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); - if (!dc) return 0x80000000; - MF_MetaParam2(dc, META_SETBKCOLOR, HIWORD(color), LOWORD(color)); - GDI_HEAP_UNLOCK( hdc ); - return 0; /* ?? */ + DC * dc = DC_GetDCPtr( hdc ); + + if (!dc) return 0x80000000; + if (dc->funcs->pSetBkColor) + oldColor = dc->funcs->pSetBkColor(dc, color); + else { + oldColor = dc->w.backgroundColor; + dc->w.backgroundColor = color; } - - oldColor = dc->w.backgroundColor; - dc->w.backgroundColor = color; - dc->w.backgroundPixel = COLOR_ToPhysical( dc, color ); GDI_HEAP_UNLOCK( hdc ); return oldColor; } @@ -1090,19 +1082,15 @@ COLORREF WINAPI SetTextColor16( HDC16 hdc, COLORREF color ) COLORREF WINAPI SetTextColor32( HDC32 hdc, COLORREF color ) { COLORREF oldColor; - DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); - if (!dc) - { - dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); - if (!dc) return 0x80000000; - MF_MetaParam2(dc, META_SETTEXTCOLOR, HIWORD(color), LOWORD(color)); - GDI_HEAP_UNLOCK( hdc ); - return 0; /* ?? */ + DC * dc = DC_GetDCPtr( hdc ); + + if (!dc) return 0x80000000; + if (dc->funcs->pSetTextColor) + oldColor = dc->funcs->pSetTextColor(dc, color); + else { + oldColor = dc->w.textColor; + dc->w.textColor = color; } - - oldColor = dc->w.textColor; - dc->w.textColor = color; - dc->w.textPixel = COLOR_ToPhysical( dc, color ); GDI_HEAP_UNLOCK( hdc ); return oldColor; } diff --git a/objects/gdiobj.c b/objects/gdiobj.c index c3ded34b549..ca129595c83 100644 --- a/objects/gdiobj.c +++ b/objects/gdiobj.c @@ -366,11 +366,15 @@ BOOL32 WINAPI DeleteObject32( HGDIOBJ32 obj ) case PALETTE_MAGIC: return PALETTE_DeleteObject(obj,(PALETTEOBJ*)header); case BITMAP_MAGIC: return BITMAP_DeleteObject( obj, (BITMAPOBJ*)header); case REGION_MAGIC: return REGION_DeleteObject( obj, (RGNOBJ*)header ); + case 0 : + WARN(gdi, "Already deleted\n"); + break; + default: + WARN(gdi, "Unknown magic number (%d)\n",header->wMagic); } return FALSE; } - /*********************************************************************** * GetStockObject16 (GDI.87) */ diff --git a/objects/region.c b/objects/region.c index 1f014a1c31d..062bb27b4de 100644 --- a/objects/region.c +++ b/objects/region.c @@ -122,16 +122,17 @@ static WINEREGION *REGION_AllocWineRegion( void ) { WINEREGION *pReg; - if (!(pReg = HeapAlloc(SystemHeap, 0, sizeof( WINEREGION )))) - return NULL; - if (!(pReg->rects = HeapAlloc(SystemHeap, 0, sizeof( RECT32 )))) + if ((pReg = HeapAlloc(SystemHeap, 0, sizeof( WINEREGION )))) { + if ((pReg->rects = HeapAlloc(SystemHeap, 0, sizeof( RECT32 )))) + { + pReg->size = 1; + EMPTY_REGION(pReg); + return pReg; + } HeapFree(SystemHeap, 0, pReg); - return NULL; } - pReg->size = 1; - EMPTY_REGION(pReg); - return pReg; + return NULL; } /*********************************************************************** @@ -2517,9 +2518,8 @@ HRGN32 WINAPI CreatePolygonRgn32( const POINT32 *points, INT32 count, */ HRGN32 WINAPI GetRandomRgn(DWORD dwArg1, DWORD dwArg2, DWORD dwArg3) { - FIXME (region, "(0x%08x 0x%08x 0x%08x): empty stub!\n", + FIXME (region, "(0x%08lx 0x%08lx 0x%08lx): empty stub!\n", dwArg1, dwArg2, dwArg3); - return NULL; + return 0; } - diff --git a/objects/text.c b/objects/text.c index f7f0cbf9273..08e80d36d66 100644 --- a/objects/text.c +++ b/objects/text.c @@ -319,7 +319,7 @@ INT32 WINAPI DrawText32W( HDC32 hdc, LPCWSTR str, INT32 count, /*********************************************************************** * DrawTextEx32A (USER32.165) */ -INT32 DrawTextEx32A( HDC32 hdc, LPCSTR str, INT32 count, +INT32 WINAPI DrawTextEx32A( HDC32 hdc, LPCSTR str, INT32 count, LPRECT32 rect, UINT32 flags, LPDRAWTEXTPARAMS dtp ) { TRACE(text,"(%d,'%s',%d,%p,0x%08x,%p)\n",hdc,str,count,rect,flags,dtp); @@ -330,7 +330,7 @@ INT32 DrawTextEx32A( HDC32 hdc, LPCSTR str, INT32 count, /*********************************************************************** * DrawTextEx32W (USER32.166) */ -INT32 DrawTextEx32W( HDC32 hdc, LPCWSTR str, INT32 count, +INT32 WINAPI DrawTextEx32W( HDC32 hdc, LPCWSTR str, INT32 count, LPRECT32 rect, UINT32 flags, LPDRAWTEXTPARAMS dtp ) { TRACE(text,"(%d,%p,%d,%p,0x%08x,%p)\n",hdc,str,count,rect,flags,dtp); diff --git a/ole/Makefile.in b/ole/Makefile.in index 134f4fc3b36..64a7fe479fa 100644 --- a/ole/Makefile.in +++ b/ole/Makefile.in @@ -13,6 +13,7 @@ C_SRCS = \ ole2disp.c \ ole2nls.c \ olecli.c \ + oledlg.c \ olesvr.c \ storage.c \ typelib.c diff --git a/ole/compobj.c b/ole/compobj.c index a5fc327083f..30d0869e355 100644 --- a/ole/compobj.c +++ b/ole/compobj.c @@ -28,6 +28,9 @@ LPMALLOC16 currentMalloc16=NULL; LPMALLOC32 currentMalloc32=NULL; +HTASK16 hETask = 0; +WORD Table_ETask[62]; + /*********************************************************************** * CoBuildVersion [COMPOBJ.1] * @@ -101,6 +104,18 @@ HRESULT WINAPI CoGetMalloc32( return S_OK; } +/*********************************************************************** + * CoCreateStandardMalloc16 [COMPOBJ.71] + */ +OLESTATUS WINAPI CoCreateStandardMalloc16(DWORD dwMemContext, + LPMALLOC16 *lpMalloc) +{ + /* FIXME: docu says we shouldn't return the same allocator as in + * CoGetMalloc16 */ + *lpMalloc = IMalloc16_Constructor(); + return S_OK; +} + /*********************************************************************** * CoDisconnectObject */ @@ -400,13 +415,25 @@ OLESTATUS WINAPI CLSIDFromProgID32( /*********************************************************************** * LookupETask (COMPOBJ.94) */ -OLESTATUS WINAPI LookupETask(LPVOID p1,LPVOID p2) { - FIXME(ole,"(%p,%p),stub!\n",p1,p2); +OLESTATUS WINAPI LookupETask(HTASK16 *hTask,LPVOID p) { + FIXME(ole,"(%p,%p),stub!\n",hTask,p); + if ((*hTask = GetCurrentTask()) == hETask) { + memcpy(p, Table_ETask, sizeof(Table_ETask)); + } return 0; } /*********************************************************************** - * LookupETask (COMPOBJ.201) + * SetETask (COMPOBJ.95) + */ +OLESTATUS WINAPI SetETask(HTASK16 hTask, LPVOID p) { + FIXME(ole,"(%04x,%p),stub!\n",hTask,p); + hETask = hTask; + return 0; +} + +/*********************************************************************** + * CallObjectInWOW (COMPOBJ.201) */ OLESTATUS WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) { FIXME(ole,"(%p,%p),stub!\n",p1,p2); @@ -455,6 +482,30 @@ OLESTATUS WINAPI CoRegisterClassObject32( return 0; } +/*********************************************************************** + * CoGetClassObject [COMPOBJ.7] + */ +HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, + LPVOID pvReserved, REFIID iid, LPVOID *ppv) +{ + char xclsid[50],xiid[50]; + LPCLASSFACTORY lpclf; + HRESULT hres = E_UNEXPECTED; + + WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); + WINE_StringFromCLSID((LPCLSID)iid,xiid); + TRACE(ole,"\n\tCLSID:\t%s,\n\tIID:\t%s\n",xclsid,xiid); + + *ppv = NULL; + lpclf = IClassFactory_Constructor(); + if (lpclf) + { + hres = lpclf->lpvtbl->fnQueryInterface(lpclf,iid, ppv); + lpclf->lpvtbl->fnRelease(lpclf); + } + return hres; +} + /*********************************************************************** * CoRegisterMessageFilter [COMPOBJ.27] */ @@ -473,23 +524,32 @@ HRESULT WINAPI CoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, - REFIID riid, + REFIID iid, LPVOID *ppv ) { +#if 0 char buf[80],xbuf[80]; if (rclsid) WINE_StringFromCLSID(rclsid,buf); else sprintf(buf,"",(DWORD)rclsid); - if (riid) - WINE_StringFromCLSID(riid,xbuf); + if (iid) + WINE_StringFromCLSID(iid,xbuf); else - sprintf(xbuf,"",(DWORD)riid); + sprintf(xbuf,"",(DWORD)iid); FIXME(ole,"(%s,%p,0x%08lx,%s,%p): stub !\n",buf,pUnkOuter,dwClsContext,xbuf,ppv); *ppv = NULL; - return S_OK; +#else + HRESULT hres; + LPCLASSFACTORY lpclf = 0; + + CoGetClassObject(rclsid, dwClsContext, NULL, &IID_IClassFactory, (LPVOID)&lpclf); + hres = lpclf->lpvtbl->fnCreateInstance(lpclf, pUnkOuter, iid, ppv); + lpclf->lpvtbl->fnRelease(lpclf); + return hres; +#endif } /*********************************************************************** @@ -571,3 +631,13 @@ HRESULT WINAPI CoLockObjectExternal32( FIXME(ole,"(%p,%d,%d),stub!\n",pUnk,fLock,fLastUnlockReleases); return S_OK; } + +/*********************************************************************** + * CoGetState16 [COMPOBJ.115] + */ +HRESULT WINAPI CoGetState16(LPDWORD state) +{ + FIXME(ole, "(%p),stub!\n", state); + *state = 0; + return S_OK; +} diff --git a/ole/ole2.c b/ole/ole2.c index 228b01c4649..d14ef0c16cc 100644 --- a/ole/ole2.c +++ b/ole/ole2.c @@ -105,3 +105,23 @@ HRESULT WINAPI RegisterDragDrop32( FIXME(ole,"(0x%04x,%p),stub!\n",hwnd,pDropTarget); return S_OK; } + +/*********************************************************************** + * RevokeDragDrop16 (OLE2.36) + */ +HRESULT WINAPI RevokeDragDrop16( + HWND16 hwnd +) { + FIXME(ole,"(0x%04x),stub!\n",hwnd); + return S_OK; +} + +/*********************************************************************** + * RevokeDragDrop32 (OLE32.141) + */ +HRESULT WINAPI RevokeDragDrop32( + HWND32 hwnd +) { + FIXME(ole,"(0x%04x),stub!\n",hwnd); + return S_OK; +} diff --git a/ole/ole2nls.c b/ole/ole2nls.c index e1684ea676f..4d97329b748 100644 --- a/ole/ole2nls.c +++ b/ole/ole2nls.c @@ -236,7 +236,7 @@ LCID WINAPI GetSystemDefaultLCID() */ LANGID WINAPI GetUserDefaultLangID() { - return (WORD)GetUserDefaultLCID(); + return 0x400|(WORD)GetUserDefaultLCID(); } /*********************************************************************** @@ -244,7 +244,7 @@ LANGID WINAPI GetUserDefaultLangID() */ LANGID WINAPI GetSystemDefaultLangID() { - return GetUserDefaultLangID(); + return 0x400|GetUserDefaultLangID(); } /*********************************************************************** @@ -261,7 +261,7 @@ INT32 WINAPI GetLocaleInfo32A(LCID lcid,LCTYPE LCType,LPSTR buf,INT32 len) char *retString; int found,i; - TRACE(ole,"(%8lX,%8lX,%p,%4X)\n", + TRACE(ole,"(0x%lx,0x%lx,%p,%x)\n", lcid,LCType,buf,len); LCType &= ~(LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP); @@ -2046,20 +2046,24 @@ UINT32 WINAPI CompareString32W(DWORD lcid, DWORD fdwStyle, INT32 WINAPI OLE_GetFormatA(LCID locale, DWORD flags, + DWORD tflags, LPSYSTEMTIME xtime, - LPCSTR format, + LPCSTR _format, LPSTR date, INT32 datelen) { INT32 inpos, outpos; int count, type, inquote, Overflow; char buf[40]; + char format[40]; + char * pos; int buflen; const char * _dgfmt[] = { "%d", "%02d" }; const char ** dgfmt = _dgfmt - 1; /* report, for debugging */ - TRACE(ole, "func(%8lx,%8lx, time(d=%d,h=%d,m=%d,s=%d), fmt:\'%s\' (at %p), %p (%9s), len=%d)\n", locale, flags, + TRACE(ole, "(0x%lx,0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:\'%s\' (at %p), %p (%s), len=%d)\n", + locale, flags, tflags, xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond, format, format, date, date, datelen); @@ -2069,6 +2073,21 @@ INT32 WINAPI OLE_GetFormatA(LCID locale, type = '\0'; date[0] = buf[0] = '\0'; + strcpy(format,_format); + + /* alter the formatstring, while it works for all languages now in wine + its possible that it fails when the time looks like ss:mm:hh as example*/ + if (tflags & (TIME_NOMINUTESORSECONDS)) + { if ((pos = strstr ( format, ":mm"))) + { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 ); + } + } + if (tflags & (TIME_NOSECONDS)) + { if ((pos = strstr ( format, ":ss"))) + { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 ); + } + } + for (inpos = 0;; inpos++) { /* TRACE(ole, "STATE inpos=%2d outpos=%2d count=%d inquote=%d type=%c buf,date = %c,%c\n", inpos, outpos, count, inquote, type, buf[inpos], date[outpos]); */ if (inquote) { @@ -2130,9 +2149,7 @@ INT32 WINAPI OLE_GetFormatA(LCID locale, sprintf(buf, "%d", xtime->wYear); } else if (count == 3) { strcpy(buf, "yyy"); - WARN(ole, - "unknown format,\ -c=%c, n=%d\n", type, count); + WARN(ole, "unknown format, c=%c, n=%d\n", type, count); } else { sprintf(buf, dgfmt[count], xtime->wYear % 100); } @@ -2142,9 +2159,7 @@ c=%c, n=%d\n", type, count); strcpy(buf, "AD"); } else { strcpy(buf, "g"); - WARN(ole, - "unknown format, \ -c=%c, n=%d\n", type, count); + WARN(ole, "unknown format, c=%c, n=%d\n", type, count); } } else if (type == 'h') { /* gives us hours 1:00 -- 12:00 */ @@ -2152,9 +2167,9 @@ c=%c, n=%d\n", type, count); } else if (type == 'H') { /* 24-hour time */ sprintf(buf, dgfmt[count], xtime->wHour); - } else if (type == 'm') { + } else if ( type == 'm') { sprintf(buf, dgfmt[count], xtime->wMinute); - } else if (type == 's') { + } else if ( type == 's') { sprintf(buf, dgfmt[count], xtime->wSecond); } else if (type == 't') { if (count == 1) { @@ -2235,7 +2250,7 @@ c=%c, n=%d\n", type, count); /************************************************************** * OLE_GetFormatW [internal] */ -INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, +INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags, LPSYSTEMTIME xtime, LPCWSTR format, LPWSTR output, INT32 outlen) @@ -2254,8 +2269,8 @@ INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, /* make a debug report */ lstrcpynWtoA(abuf, format, sizeof(format)); - TRACE(ole, "args: %8lx, %8lx, time(d=%d,h=%d,m=%d,s=%d), fmt:\'%s\' (at %p), %p with max len %d\n", - locale, flags, + TRACE(ole, "args: 0x%lx, 0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt:\'%s\' (at %p), %p with max len %d\n", + locale, flags, tflags, xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond, abuf, format, output, outlen); @@ -2354,10 +2369,10 @@ INT32 WINAPI OLE_GetFormatW(LCID locale, DWORD flags, } else if (type == 'H') { wsnprintf32W(buf, 5, argarr[count], xtime->wHour); - } else if (type == 'm') { + } else if (type == 'm' ) { wsnprintf32W(buf, 5, argarr[count], xtime->wMinute); - } else if (type == 's') { + } else if (type == 's' ) { wsnprintf32W(buf, 5, argarr[count], xtime->wSecond); } else if (type == 't') { @@ -2507,7 +2522,7 @@ INT32 WINAPI GetDateFormat32A(LCID locale,DWORD flags, }; - ret = OLE_GetFormatA(thislocale, flags, thistime, thisformat, + ret = OLE_GetFormatA(thislocale, flags, 0, thistime, thisformat, date, datelen); @@ -2599,6 +2614,7 @@ GetTimeFormat32A(LCID locale, /* in */ DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */; TRACE(ole,"GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,xtime,format,timestr,timelen); + if (!locale) { locale = LOCALE_SYSTEM_DEFAULT; } @@ -2608,32 +2624,27 @@ GetTimeFormat32A(LCID locale, /* in */ } else if (locale == LOCALE_USER_DEFAULT) { thislocale = GetUserDefaultLCID(); - } + } else { thislocale = locale; } + + if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT )) + { FIXME(ole,"TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n"); + } + flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/ + if (format == NULL) - { if (flags&LOCALE_NOUSEROVERRIDE) /*use system default*/ + { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/ { thislocale = GetSystemDefaultLCID(); } - switch (flags) - { case TIME_NOSECONDS: - FIXME(ole,"TIME_NOSECONDS not yet implemented"); - break; - case TIME_NOMINUTESORSECONDS: - FIXME(ole,"TIME_NOMINUTESORSECONDS not yet implemented"); - break; - } - GetLocaleInfo32A(thislocale, thisflags, format_buf,sizeof(format_buf)); + GetLocaleInfo32A(thislocale, thisflags, format_buf, sizeof(format_buf)); thisformat = format_buf; } else { thisformat = format; } - if (!locale) - { locale = GetSystemDefaultLCID(); - } if (xtime == NULL) /* NULL means use the current local time*/ { GetSystemTime(&t); thistime = &t; @@ -2641,7 +2652,7 @@ GetTimeFormat32A(LCID locale, /* in */ else { thistime = xtime; } - return OLE_GetFormatA(thislocale, thisflags, thistime, thisformat,timestr, timelen); + return OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat, timestr, timelen); } @@ -2706,7 +2717,7 @@ GetTimeFormat32W(LCID locale,DWORD flags, GetSystemTime(realtime); } - retval = OLE_GetFormatW(locale, flags, realtime, realformat, timestr, timelen); + retval = OLE_GetFormatW(locale, flags, 0, realtime, realformat, timestr, timelen); if (fmt_buf) free(fmt_buf); return retval; diff --git a/ole/oledlg.c b/ole/oledlg.c new file mode 100644 index 00000000000..51d60519d12 --- /dev/null +++ b/ole/oledlg.c @@ -0,0 +1,292 @@ +/* + * OLEDLG library + * + * Copyright 1998 Patrik Stridvall + */ + +#include "windows.h" +#include "wintypes.h" +#include "winerror.h" +#include "ole.h" +#include "oledlg.h" +#include "compobj.h" +#include "debug.h" + +/*********************************************************************** + * OleUIAddVerbMenu32A (OLEDLG.1) + */ + +BOOL32 WINAPI OleUIAddVerbMenu32A( + LPOLEOBJECT lpOleObj, LPCSTR lpszShortType, + HMENU32 hMenu, UINT32 uPos, UINT32 uIDVerbMin, UINT32 uIDVerbMax, + BOOL32 bAddConvert, UINT32 idConvert, HMENU32 *lphMenu) +{ + FIXME(ole,"(%p,%s,0x%08x,%d,%d,%d,%d,%d,%p): stub\n", + lpOleObj, lpszShortType, + hMenu, uPos, uIDVerbMin, uIDVerbMax, + bAddConvert, idConvert, lphMenu + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * OleUIAddVerbMenu32W (OLEDLG.14) + */ + +BOOL32 WINAPI OleUIAddVerbMenu32W( + LPOLEOBJECT lpOleObj, LPCWSTR lpszShortType, + HMENU32 hMenu, UINT32 uPos, UINT32 uIDVerbMin, UINT32 uIDVerbMax, + BOOL32 bAddConvert, UINT32 idConvert, HMENU32 *lphMenu) +{ + FIXME(ole,"(%p,%s,0x%08x,%d,%d,%d,%d,%d,%p): stub\n", + lpOleObj, lpszShortType, + hMenu, uPos, uIDVerbMin, uIDVerbMax, + bAddConvert, idConvert, lphMenu + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * OleUICanConvertOrActivateAs32 (OLEDLG.2) + */ + +BOOL32 WINAPI OleUICanConvertOrActivateAs32( + REFCLSID rClsid, BOOL32 fIsLinkedObject, WORD wFormat) +{ + FIXME(ole,"stub\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * OleUIInsertObject32A (OLEDLG.3) + */ + +UINT32 WINAPI OleUIInsertObject32A(LPOLEUIINSERTOBJECTA lpOleUIInsertObject) +{ + FIXME(ole,"(%p): stub\n",lpOleUIInsertObject); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIInsertObject32W (OLEDLG.20) + */ + +UINT32 WINAPI OleUIInsertObject32W(LPOLEUIINSERTOBJECTW lpOleUIInsertObject) +{ + FIXME(ole,"(%p): stub\n",lpOleUIInsertObject); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIPasteSpecial32A (OLEDLG.4) + */ + +UINT32 WINAPI OleUIPasteSpecial32A(LPOLEUIPASTESPECIALA lpOleUIPasteSpecial) +{ + FIXME(ole,"(%p): stub\n",lpOleUIPasteSpecial); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIPasteSpecial32W (OLEDLG.22) + */ + +UINT32 WINAPI OleUIPasteSpecial32W(LPOLEUIPASTESPECIALW lpOleUIPasteSpecial) +{ + FIXME(ole,"(%p): stub\n",lpOleUIPasteSpecial); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIEditLinks32A (OLEDLG.5) + */ + +UINT32 WINAPI OleUIEditLinks32A(LPOLEUIEDITLINKSA lpOleUIEditLinks) +{ + FIXME(ole,"(%p): stub\n",lpOleUIEditLinks); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIEditLinks32W (OLEDLG.19) + */ + +UINT32 WINAPI OleUIEditLinks32W(LPOLEUIEDITLINKSW lpOleUIEditLinks) +{ + FIXME(ole,"(%p): stub\n",lpOleUIEditLinks); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIChangeIcon32A (OLEDLG.6) + */ + +UINT32 WINAPI OleUIChangeIcon32A(LPOLEUICHANGEICONA lpOleUIChangeIcon) +{ + FIXME(ole,"(%p): stub\n",lpOleUIChangeIcon); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIChangeIcon32W (OLEDLG.16) + */ + +UINT32 WINAPI OleUIChangeIcon32W(LPOLEUICHANGEICONW lpOleUIChangeIcon) +{ + FIXME(ole,"(%p): stub\n",lpOleUIChangeIcon); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIConvert32A (OLEDLG.7) + */ + +UINT32 WINAPI OleUIConvert32A(LPOLEUICONVERTA lpOleUIConvert) +{ + FIXME(ole,"(%p): stub\n",lpOleUIConvert); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIConvert32W (OLEDLG.18) + */ + +UINT32 WINAPI OleUIConvert32W(LPOLEUICONVERTW lpOleUIConvert) +{ + FIXME(ole,"(%p): stub\n",lpOleUIConvert); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIBusy32A (OLEDLG.8) + */ + +UINT32 WINAPI OleUIBusy32A(LPOLEUIBUSYA lpOleUIBusy) +{ + FIXME(ole,"(%p): stub\n",lpOleUIBusy); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIBusy32W (OLEDLG.15) + */ + +UINT32 WINAPI OleUIBusy32W(LPOLEUIBUSYW lpOleUIBusy) +{ + FIXME(ole,"(%p): stub\n",lpOleUIBusy); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIUpdateLinks32A (OLEDLG.9) + */ + +BOOL32 WINAPI OleUIUpdateLinks32A( + LPOLEUILINKCONTAINERA lpOleUILinkCntr, + HWND32 hwndParent, LPSTR lpszTitle, INT32 cLinks) +{ + FIXME(ole,"(%p,0x%08x,%s,%d): stub\n", + lpOleUILinkCntr,hwndParent,lpszTitle, cLinks); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * OleUIUpdateLinks32W (OLEDLG.?) + * FIXME + * I haven't been able to find the ordinal for this function, + * This means it can't be called from outside the DLL. + */ + +BOOL32 WINAPI OleUIUpdateLinks32W( + LPOLEUILINKCONTAINERW lpOleUILinkCntr, + HWND32 hwndParent, LPWSTR lpszTitle, INT32 cLinks) +{ + FIXME(ole,"(%p,0x%08x,%s,%d): stub\n",lpOleUILinkCntr,hwndParent,lpszTitle, cLinks); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * OleUIPromptUser32A (OLEDLG.10) + */ + +INT32 __cdecl OleUIPromptUser32A(INT32 nTemplate, HWND32 hwndParent, ...) +{ + FIXME(ole,"(%d,0x%08x,...): stub\n",nTemplate,hwndParent); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIPromptUser32W (OLEDLG.13) + */ + +INT32 __cdecl OleUIPromptUser32W(INT32 nTemplate, HWND32 hwndParent, ...) +{ + FIXME(ole,"(%d,0x%08x,...): stub\n",nTemplate,hwndParent); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIObjectProperties32A (OLEDLG.11) + */ + +UINT32 WINAPI OleUIObjectProperties32A(LPOLEUIOBJECTPROPSA lpOleUIObjectProps) +{ + FIXME(ole,"(%p): stub\n",lpOleUIObjectProps); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIObjectProperties32W (OLEDLG.21) + */ + +UINT32 WINAPI OleUIObjectProperties32W(LPOLEUIOBJECTPROPSW lpOleUIObjectProps) +{ + FIXME(ole,"(%p): stub\n",lpOleUIObjectProps); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIChangeSource32A (OLEDLG.12) + */ + +UINT32 OleUIChangeSource32A(LPOLEUICHANGESOURCEA lpOleUIChangeSource) +{ + FIXME(ole,"(%p): stub\n",lpOleUIChangeSource); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + +/*********************************************************************** + * OleUIChangeSource32W (OLEDLG.17) + */ + +UINT32 OleUIChangeSource32W(LPOLEUICHANGESOURCEW lpOleUIChangeSource) +{ + FIXME(ole,"(%p): stub\n",lpOleUIChangeSource); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return OLEUI_FALSE; +} + + + diff --git a/relay32/Makefile.in b/relay32/Makefile.in index 0ce4e4924c9..9d871949155 100644 --- a/relay32/Makefile.in +++ b/relay32/Makefile.in @@ -17,14 +17,17 @@ DLLS = \ dplayx.spec \ dsound.spec \ gdi32.spec \ + imm32.spec \ kernel32.spec \ lz32.spec \ mpr.spec \ + msnet32.spec \ msvfw32.spec \ ntdll.spec \ ole32.spec \ oleaut32.spec \ olecli32.spec \ + oledlg.spec \ olesvr32.spec \ rasapi32.spec \ shell32.spec \ diff --git a/relay32/builtin32.c b/relay32/builtin32.c index 04c579e897e..18081a987e4 100644 --- a/relay32/builtin32.c +++ b/relay32/builtin32.c @@ -39,14 +39,17 @@ extern const BUILTIN32_DESCRIPTOR DPLAY_Descriptor; extern const BUILTIN32_DESCRIPTOR DPLAYX_Descriptor; extern const BUILTIN32_DESCRIPTOR DSOUND_Descriptor; extern const BUILTIN32_DESCRIPTOR GDI32_Descriptor; +extern const BUILTIN32_DESCRIPTOR IMM32_Descriptor; extern const BUILTIN32_DESCRIPTOR KERNEL32_Descriptor; extern const BUILTIN32_DESCRIPTOR LZ32_Descriptor; extern const BUILTIN32_DESCRIPTOR MPR_Descriptor; +extern const BUILTIN32_DESCRIPTOR MSNET32_Descriptor; extern const BUILTIN32_DESCRIPTOR MSVFW32_Descriptor; extern const BUILTIN32_DESCRIPTOR NTDLL_Descriptor; extern const BUILTIN32_DESCRIPTOR OLE32_Descriptor; extern const BUILTIN32_DESCRIPTOR OLEAUT32_Descriptor; extern const BUILTIN32_DESCRIPTOR OLECLI32_Descriptor; +extern const BUILTIN32_DESCRIPTOR OLEDLG_Descriptor; extern const BUILTIN32_DESCRIPTOR OLESVR32_Descriptor; extern const BUILTIN32_DESCRIPTOR RASAPI32_Descriptor; extern const BUILTIN32_DESCRIPTOR SHELL32_Descriptor; @@ -73,14 +76,17 @@ static BUILTIN32_DLL BuiltinDLLs[] = { &DPLAYX_Descriptor, TRUE }, { &DSOUND_Descriptor, TRUE }, { &GDI32_Descriptor, TRUE }, + { &IMM32_Descriptor, FALSE }, { &KERNEL32_Descriptor, TRUE }, { &LZ32_Descriptor, TRUE }, { &MPR_Descriptor, TRUE }, + { &MSNET32_Descriptor, FALSE }, { &MSVFW32_Descriptor, FALSE }, { &NTDLL_Descriptor, TRUE }, { &OLE32_Descriptor, FALSE }, { &OLEAUT32_Descriptor, FALSE }, { &OLECLI32_Descriptor, FALSE }, + { &OLEDLG_Descriptor, FALSE }, { &OLESVR32_Descriptor, FALSE }, { &RASAPI32_Descriptor, FALSE }, { &SHELL32_Descriptor, TRUE }, diff --git a/relay32/comctl32.spec b/relay32/comctl32.spec index c385cf69064..e1f35e53867 100644 --- a/relay32/comctl32.spec +++ b/relay32/comctl32.spec @@ -77,9 +77,9 @@ init ComCtl32LibMain 69 stdcall ImageList_ReplaceIcon(ptr long long) ImageList_ReplaceIcon 70 stdcall ImageList_SetBkColor(ptr long) ImageList_SetBkColor 71 stdcall Alloc(long) COMCTL32_Alloc - 72 stdcall ReAlloc(long long) COMCTL32_ReAlloc - 73 stdcall Free(long) COMCTL32_Free - 74 stdcall GetSize(long) COMCTL32_GetSize + 72 stdcall ReAlloc(ptr long) COMCTL32_ReAlloc + 73 stdcall Free(ptr) COMCTL32_Free + 74 stdcall GetSize(ptr) COMCTL32_GetSize 75 stdcall ImageList_SetDragCursorImage(ptr long long long) ImageList_SetDragCursorImage 76 stdcall ImageList_SetFilter(ptr long long) ImageList_SetFilter 77 stdcall ImageList_SetIconSize(ptr long long) ImageList_SetIconSize @@ -94,19 +94,19 @@ init ComCtl32LibMain 86 stub UninitializeFlatSB 87 stub _TrackMouseEvent -151 stub CreateMRUList -152 stub FreeMRUList -153 stub AddMRUStringA -154 stub EnumMRUListA -155 stub FindMRUStringA -156 stub DelMRUString +151 stdcall CreateMRUListA(long) CreateMRUList32A +152 stub FreeMRUList@4 +153 stub AddMRUStringA@8 +154 stub EnumMRUListA@16 +155 stub FindMRUStringA@12 +156 stub DelMRUString@8 157 stub COMCTL32_157 163 stub CreatePage 164 stub CreateProxyPage -167 stub AddMRUData -169 stub FindMRUData +167 stub AddMRUData@12 +169 stub FindMRUData@16 233 stub Str_GetPtrA 234 stdcall Str_SetPtrA(long long) COMCTL32_Str_SetPtrA @@ -116,24 +116,23 @@ init ComCtl32LibMain 320 stdcall DSA_Create(long long) DSA_Create 321 stdcall DSA_Destroy(ptr) DSA_Destroy 322 stdcall DSA_GetItem(ptr long long) DSA_GetItem -323 stdcall DSA_GetItemPtr(long long) DSA_GetItemPtr -324 stdcall DSA_InsertItem(long long long) DSA_InsertItem -325 stdcall DSA_SetItem (long long long) DSA_SetItem -326 stdcall DSA_DeleteItem(long long) DSA_DeleteItem -327 stub DSA_DeleteAllItems - +323 stdcall DSA_GetItemPtr(ptr long) DSA_GetItemPtr +324 stdcall DSA_InsertItem(ptr long long) DSA_InsertItem +325 stdcall DSA_SetItem (ptr long long) DSA_SetItem +326 stdcall DSA_DeleteItem(ptr long) DSA_DeleteItem +327 stdcall DSA_DeleteAllItems(ptr) DSA_DeleteAllItems 328 stdcall DPA_Create(long) DPA_Create -329 stub DPA_Destroy -330 stub DPA_Grow -331 stub DPA_Clone -332 stdcall DPA_GetPtr(long long) DPA_GetPtr -333 stub DPA_GetPtrIndex -334 stdcall DPA_InsertPtr(long long long) DPA_InsertPtr -335 stub DPA_SetPtr -336 stub DPA_DeletePtr -337 stub DPA_DeleteAllPtrs -338 stub DPA_Sort -339 stub DPA_Search +329 stdcall DPA_Destroy(ptr) DPA_Destroy +330 stdcall DPA_Grow(ptr long) DPA_Grow +331 stdcall DPA_Clone(ptr ptr) DPA_Clone +332 stdcall DPA_GetPtr(ptr long) DPA_GetPtr +333 stdcall DPA_GetPtrIndex(ptr ptr) DPA_GetPtrIndex +334 stdcall DPA_InsertPtr(ptr long ptr) DPA_InsertPtr +335 stdcall DPA_SetPtr(ptr long ptr) DPA_SetPtr +336 stdcall DPA_DeletePtr(ptr long) DPA_DeletePtr +337 stdcall DPA_DeleteAllPtrs(ptr) DPA_DeleteAllPtrs +338 stdcall DPA_Sort(ptr ptr long) DPA_Sort +339 stdcall DPA_Search(ptr ptr long ptr long long) DPA_Search 340 stdcall DPA_CreateEx(long long) DPA_CreateEx 341 stdcall SendNotify(long long long long) COMCTL32_SendNotify 342 stub SendNotifyEx @@ -163,12 +162,12 @@ init ComCtl32LibMain 373 stub StrRStrIW 374 stub StrCSpnIA 375 stub StrCSpnIW -376 stub IntlStrEqWorkerA -377 stub IntlStrEqWorkerW +376 stub IntlStrEqWorkerA@16 +377 stub IntlStrEqWorkerW@16 -382 stub SmoothScrollWindow -383 stub DoReaderMode -384 stub SetPathWordBreakProc +382 stub SmoothScrollWindow@4 +383 stub DoReaderMode@4 +384 stub SetPathWordBreakProc@8 385 stub COMCTL32_385 386 stub COMCTL32_386 387 stub COMCTL32_387 @@ -176,10 +175,10 @@ init ComCtl32LibMain 389 stub COMCTL32_389 390 stub COMCTL32_390 -400 stub COMCTL32_400 -401 stub COMCTL32_401 -402 stub COMCTL32_402 -403 stub COMCTL32_403 +400 stub CreateMRUListW@4 +401 stub AddMRUStringW@8 +402 stub FindMRUStringW@12 +403 stub EnumMRUListW@16 404 stub COMCTL32_404 410 stub COMCTL32_410 diff --git a/relay32/imm32.spec b/relay32/imm32.spec new file mode 100644 index 00000000000..f85fb830616 --- /dev/null +++ b/relay32/imm32.spec @@ -0,0 +1,75 @@ +name imm32 +type win32 + + 1 stdcall ImmAssociateContext(long long) ImmAssociateContext32 + 2 stdcall ImmConfigureIMEA(long long long ptr) ImmConfigureIME32A + 3 stdcall ImmConfigureIMEW(long long long ptr) ImmConfigureIME32W + 4 stdcall ImmCreateContext() ImmCreateContext32 + 5 stub ImmCreateIMCC + 6 stub ImmCreateSoftKeyboard + 7 stdcall ImmDestroyContext(long) ImmDestroyContext32 + 8 stub ImmDestroyIMCC + 9 stub ImmDestroySoftKeyboard + 10 stdcall ImmEnumRegisterWordA(long ptr str long str ptr) ImmEnumRegisterWord32A + 11 stdcall ImmEnumRegisterWordW(long ptr wstr long wstr ptr) ImmEnumRegisterWord32W + 12 stdcall ImmEscapeA(long long long ptr) ImmEscape32A + 13 stdcall ImmEscapeW(long long long ptr) ImmEscape32W + 14 stub ImmGenerateMessage + 15 stdcall ImmGetCandidateListA(long long ptr long) ImmGetCandidateList32A + 16 stdcall ImmGetCandidateListCountA(long ptr) ImmGetCandidateListCount32A + 17 stdcall ImmGetCandidateListCountW(long ptr) ImmGetCandidateListCount32W + 18 stdcall ImmGetCandidateListW(long long ptr long) ImmGetCandidateList32W + 19 stdcall ImmGetCandidateWindow(long long ptr) ImmGetCandidateWindow32 + 20 stdcall ImmGetCompositionFontA(long ptr) ImmGetCompositionFont32A + 21 stdcall ImmGetCompositionFontW(long ptr) ImmGetCompositionFont32W + 22 stdcall ImmGetCompositionStringA (long long ptr long) ImmGetCompositionString32A + 23 stdcall ImmGetCompositionStringW (long long ptr long) ImmGetCompositionString32W + 24 stdcall ImmGetCompositionWindow(long ptr) ImmGetCompositionWindow32 + 25 stdcall ImmGetContext(long) ImmGetContext32 + 26 stdcall ImmGetConversionListA(long long str ptr long long) ImmGetConversionList32A + 27 stdcall ImmGetConversionListW(long long wstr ptr long long) ImmGetConversionList32W + 28 stdcall ImmGetConversionStatus(long ptr ptr) ImmGetConversionStatus32 + 29 stdcall ImmGetDefaultIMEWnd(long) ImmGetDefaultIMEWnd32 + 30 stdcall ImmGetDescriptionA(long str long) ImmGetDescription32A + 31 stdcall ImmGetDescriptionW(long wstr long) ImmGetDescription32W + 32 stdcall ImmGetGuideLineA(long long str long) ImmGetGuideLine32A + 33 stdcall ImmGetGuideLineW(long long wstr long) ImmGetGuideLine32W + 34 stub ImmGetHotKey + 35 stub ImmGetIMCCLockCount + 36 stub ImmGetIMCCSize + 37 stub ImmGetIMCLockCount + 38 stdcall ImmGetIMEFileNameA(long str long) ImmGetIMEFileName32A + 39 stdcall ImmGetIMEFileNameW(long wstr long) ImmGetIMEFileName32W + 40 stdcall ImmGetOpenStatus(long) ImmGetOpenStatus32 + 41 stdcall ImmGetProperty(long long) ImmGetProperty32 + 42 stdcall ImmGetRegisterWordStyleA(long long ptr) ImmGetRegisterWordStyle32A + 43 stdcall ImmGetRegisterWordStyleW(long long ptr) ImmGetRegisterWordStyle32W + 44 stdcall ImmGetStatusWindowPos(long ptr) ImmGetStatusWindowPos32 + 45 stdcall ImmGetVirtualKey(long) ImmGetVirtualKey32 + 46 stdcall ImmInstallIMEA(str str) ImmInstallIME32A + 47 stdcall ImmInstallIMEW(wstr wstr) ImmInstallIME32W + 48 stdcall ImmIsIME(long) ImmIsIME32 + 49 stdcall ImmIsUIMessageA(long long long long) ImmIsUIMessage32A + 50 stdcall ImmIsUIMessageW(long long long long) ImmIsUIMessage32W + 51 stub ImmLockIMC + 52 stub ImmLockIMCC + 53 stdcall ImmNotifyIME(long long long long) ImmNotifyIME32 + 54 stub ImmReSizeIMCC + 55 stdcall ImmRegisterWordA(long str long str) ImmRegisterWord32A + 56 stdcall ImmRegisterWordW(long wstr long wstr) ImmRegisterWord32W + 57 stdcall ImmReleaseContext(long long) ImmReleaseContext32 + 58 stdcall ImmSetCandidateWindow(long ptr) ImmSetCandidateWindow32 + 59 stdcall ImmSetCompositionFontA(long ptr) ImmSetCompositionFont32A + 60 stdcall ImmSetCompositionFontW(long ptr) ImmSetCompositionFont32W + 61 stdcall ImmSetCompositionStringA(long long ptr long ptr long) ImmSetCompositionString32A + 62 stdcall ImmSetCompositionStringW(long long ptr long ptr long) ImmSetCompositionString32W + 63 stdcall ImmSetCompositionWindow(long ptr) ImmSetCompositionWindow32 + 64 stdcall ImmSetConversionStatus(long long long) ImmSetConversionStatus32 + 65 stub ImmSetHotKey + 66 stdcall ImmSetOpenStatus(long long) ImmSetOpenStatus32 + 67 stdcall ImmSetStatusWindowPos(long ptr) ImmSetStatusWindowPos32 + 68 stub ImmShowSoftKeyboard + 69 stdcall ImmSimulateHotKey(long long) ImmSimulateHotKey32 + 70 stub ImmUnlockIMC + 71 stub ImmUnlockIMCC + 72 stdcall ImmUnregisterWordA(long str long str) ImmUnregisterWord32A diff --git a/relay32/kernel32.spec b/relay32/kernel32.spec index 2c08e16912c..7e11ef542ad 100644 --- a/relay32/kernel32.spec +++ b/relay32/kernel32.spec @@ -379,13 +379,13 @@ type win32 362 stdcall GetPrivateProfileIntA(str str long str) GetPrivateProfileInt32A 363 stdcall GetPrivateProfileIntW(wstr wstr long wstr) GetPrivateProfileInt32W 364 stdcall GetPrivateProfileSectionA(str str long str) GetPrivateProfileSection32A -365 stub GetPrivateProfileSectionNamesA -366 stub GetPrivateProfileSectionNamesW -367 stub GetPrivateProfileSectionW +365 stdcall GetPrivateProfileSectionNamesA(ptr long str) GetPrivateProfileSectionNames32A +366 stdcall GetPrivateProfileSectionNamesW(ptr long wstr) GetPrivateProfileSectionNames32W +367 stdcall GetPrivateProfileSectionW(wstr wstr long wstr) GetPrivateProfileSection32W 368 stdcall GetPrivateProfileStringA(str str str ptr long str) GetPrivateProfileString32A 369 stdcall GetPrivateProfileStringW(wstr wstr wstr ptr long wstr) GetPrivateProfileString32W 370 stdcall GetPrivateProfileStructA (str str ptr long str) GetPrivateProfileStruct32A -371 stub GetPrivateProfileStructW +371 stdcall GetPrivateProfileStructW(wstr wstr ptr long wstr) GetPrivateProfileStruct32W 372 stdcall GetProcAddress(long str) GetProcAddress32 373 stdcall GetProcessAffinityMask(long ptr ptr) GetProcessAffinityMask 374 stdcall GetProcessFlags(long) GetProcessFlags @@ -399,7 +399,7 @@ type win32 382 stdcall GetProfileIntA(str str long) GetProfileInt32A 383 stdcall GetProfileIntW(wstr wstr long) GetProfileInt32W 384 stdcall GetProfileSectionA(str str long) GetProfileSection32A -385 stub GetProfileSectionW +385 stdcall GetProfileSectionW(wstr wstr long) GetProfileSection32W 386 stdcall GetProfileStringA(str str str ptr long) GetProfileString32A 387 stdcall GetProfileStringW(wstr wstr wstr ptr long) GetProfileString32W 388 stub GetQueuedCompletionStatus @@ -689,7 +689,7 @@ type win32 672 stdcall SetThreadPriority(long long) SetThreadPriority 673 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation 674 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter -675 stub SetVolumeLabelA +675 stdcall SetVolumeLabelA(str str) SetVolumeLabel32A 676 stub SetVolumeLabelW 677 stdcall SetupComm(long long long) SetupComm 678 stdcall SizeofResource(long long) SizeofResource32 @@ -755,14 +755,14 @@ type win32 738 stdcall WriteFile(long ptr long ptr ptr) WriteFile 739 stub WriteFileEx 740 stdcall WritePrivateProfileSectionA(str str str) WritePrivateProfileSection32A -741 stub WritePrivateProfileSectionW +741 stdcall WritePrivateProfileSectionW(wstr wstr wstr) WritePrivateProfileSection32W 742 stdcall WritePrivateProfileStringA(str str str str) WritePrivateProfileString32A 743 stdcall WritePrivateProfileStringW(wstr wstr wstr wstr) WritePrivateProfileString32W 744 stdcall WritePrivateProfileStructA (str str ptr long str) WritePrivateProfileStruct32A -745 stub WritePrivateProfileStructW +745 stdcall WritePrivateProfileStructW(wstr wstr ptr long wstr) WritePrivateProfileStruct32W 746 stdcall WriteProcessMemory(long ptr ptr long ptr) WriteProcessMemory -747 stub WriteProfileSectionA -748 stub WriteProfileSectionW +747 stdcall WriteProfileSectionA(str str) WriteProfileSection32A +748 stdcall WriteProfileSectionW(str str) WriteProfileSection32W 749 stdcall WriteProfileStringA(str str str) WriteProfileString32A 750 stdcall WriteProfileStringW(wstr wstr wstr) WriteProfileString32W 751 stub WriteTapemark diff --git a/relay32/msnet32.spec b/relay32/msnet32.spec new file mode 100644 index 00000000000..7b316dd3a8e --- /dev/null +++ b/relay32/msnet32.spec @@ -0,0 +1,100 @@ +name msnet32 +type win32 + + 1 stub MSNET32_1 + 2 stub MSNET32_2 + 3 stub MSNET32_3 + 4 stub MSNET32_4 + 5 stub MSNET32_5 + 6 stub MSNET32_6 + 7 stub MSNET32_7 + 8 stub MSNET32_8 + 9 stub MSNET32_9 + 10 stub MSNET32_10 + 11 stub MSNET32_11 + 12 stub MSNET32_12 + 13 stub MSNET32_13 + 14 stub MSNET32_14 + 15 stub MSNET32_15 + 16 stub MSNET32_16 + 17 stub MSNET32_17 + 18 stub MSNET32_18 + 19 stub MSNET32_19 + 20 stub MSNET32_20 + 21 stub MSNET32_21 + 22 stub MSNET32_22 + 23 stub MSNET32_23 + 24 stub MSNET32_24 + 25 stub MSNET32_25 + 26 stub MSNET32_26 + 27 stub MSNET32_27 + 28 stub MSNET32_28 + 29 stub MSNET32_29 + 30 stub MSNET32_30 + 31 stub MSNET32_31 + 32 stub MSNET32_32 + 33 stub MSNET32_33 + 34 stub MSNET32_34 + 35 stub MSNET32_35 + 36 stub MSNET32_36 + 37 stub MSNET32_37 + 38 stub MSNET32_38 + 39 stub MSNET32_39 + 40 stub MSNET32_40 + 41 stub MSNET32_41 + 42 stub MSNET32_42 + 43 stub MSNET32_43 + 44 stub MSNET32_44 + 45 stub MSNET32_45 + 46 stub MSNET32_46 + 47 stub MSNET32_47 + 48 stub MSNET32_48 + 49 stub MSNET32_49 + 50 stub MSNET32_50 + 51 stub MSNET32_51 + 52 stub MSNET32_52 + 53 stub MSNET32_53 + 54 stub MSNET32_54 + 55 stub MSNET32_55 + 56 stub MSNET32_56 + 57 stub MSNET32_57 + 58 stub MSNET32_58 + 59 stub MSNET32_59 + 60 stub MSNET32_60 + 61 stub MSNET32_61 + 62 stub MSNET32_62 + 63 stub MSNET32_63 + 64 stub MSNET32_64 + 65 stub MSNET32_65 + 66 stub MSNET32_66 + 67 stub MSNET32_67 + 68 stub MSNET32_68 + 69 stub MSNET32_69 + 70 stub MSNET32_70 + 71 stub MSNET32_71 + 72 stub MSNET32_72 + 73 stub MSNET32_73 + 74 stub MSNET32_74 + 75 stub MSNET32_75 + 76 stub MSNET32_76 + 77 stub MSNET32_77 + 78 stub MSNET32_78 + 79 stub MSNET32_79 + 80 stub MSNET32_80 + 81 stub MSNET32_81 + 82 stub MSNET32_82 + 83 stub MSNET32_83 + 84 stub MSNET32_84 + 85 stub MSNET32_85 + 86 stub MSNET32_86 + 87 stub MSNET32_87 + 88 stub MSNET32_88 + 89 stub MSNET32_89 + 90 stub MSNET32_90 + 91 stub MSNET32_91 + 92 stub MSNET32_92 + 93 stub MSNET32_93 + 94 stub MSNET32_94 + 95 stub MSNET32_95 + 96 stub MSNET32_96 + diff --git a/relay32/ole32.spec b/relay32/ole32.spec index 4883fdbb4e0..dc4f26ecfed 100644 --- a/relay32/ole32.spec +++ b/relay32/ole32.spec @@ -141,7 +141,7 @@ type win32 138 stub ReadStringStream 139 stdcall RegisterDragDrop(long ptr) RegisterDragDrop32 140 stub ReleaseStgMedium -141 stub RevokeDragDrop +141 stdcall RevokeDragDrop(long) RevokeDragDrop32 142 stub SetConvertStg 143 stub SetDocumentBitStg 144 stdcall StgCreateDocfile(wstr long long ptr) StgCreateDocFile32 diff --git a/relay32/oledlg.spec b/relay32/oledlg.spec new file mode 100644 index 00000000000..ba6b630cc56 --- /dev/null +++ b/relay32/oledlg.spec @@ -0,0 +1,26 @@ +name oledlg +type win32 + + 1 stdcall OleUIAddVerbMenuA(ptr str long long long long long long ptr) OleUIAddVerbMenu32A + 2 stdcall OleUICanConvertOrActivateAs(ptr long long) OleUICanConvertOrActivateAs32 + 3 stdcall OleUIInsertObjectA(ptr) OleUIInsertObject32A + 4 stdcall OleUIPasteSpecialA(ptr) OleUIPasteSpecial32A + 5 stdcall OleUIEditLinksA(ptr) OleUIEditLinks32A + 6 stdcall OleUIChangeIconA(ptr) OleUIChangeIcon32A + 7 stdcall OleUIConvertA(ptr) OleUIConvert32A + 8 stdcall OleUIBusyA(ptr) OleUIBusy32A + 9 stdcall OleUIUpdateLinksA(ptr long str long) OleUIUpdateLinks32A + 10 varargs OleUIPromptUserA() OleUIPromptUser32A + 11 stdcall OleUIObjectPropertiesA(ptr) OleUIObjectProperties32A + 12 stdcall OleUIChangeSourceA(ptr) OleUIChangeSource32A + 13 varargs OleUIPromptUserW() OleUIPromptUser32W + 14 stdcall OleUIAddVerbMenuW(ptr wstr long long long long long long ptr) OleUIAddVerbMenu32W + 15 stdcall OleUIBusyW(ptr) OleUIBusy32W + 16 stdcall OleUIChangeIconW(ptr) OleUIChangeIcon32W + 17 stdcall OleUIChangeSourceW(ptr) OleUIChangeSource32W + 18 stdcall OleUIConvertW(ptr) OleUIConvert32W + 19 stdcall OleUIEditLinksW(ptr) OleUIEditLinks32W + 20 stdcall OleUIInsertObjectW(ptr) OleUIInsertObject32W + 21 stdcall OleUIObjectPropertiesW(ptr) OleUIObjectProperties32W + 22 stdcall OleUIPasteSpecialW(ptr) OleUIPasteSpecial32W + diff --git a/relay32/shell32.spec b/relay32/shell32.spec index 64e3546fc1a..d7fd6d0aad2 100644 --- a/relay32/shell32.spec +++ b/relay32/shell32.spec @@ -114,16 +114,16 @@ init Shell32LibMain 106 stub FileMenu_FindSubMenuByPidl 107 stub FileMenu_GetLastSelectedItemPidls 108 stub FileMenu_HandleMenuChar - 109 stub FileMenu_InitMenuPopup + 109 stdcall FileMenu_InitMenuPopup (long) FileMenu_InitMenuPopup 110 stub FileMenu_InsertUsingPidl 111 stub FileMenu_Invalidate 112 stub FileMenu_MeasureItem 113 stub FileMenu_ReplaceUsingPidl 114 stdcall FileMenu_Create (long long long long long) FileMenu_Create 115 stub FileMenu_AppendItem - 116 stub FileMenu_TrackPopupMenuEx + 116 stdcall FileMenu_TrackPopupMenuEx (long long long long long long) FileMenu_TrackPopupMenuEx 117 stub FileMenu_DeleteItemByCmd - 118 stub FileMenu_Destroy + 118 stdcall FileMenu_Destroy (long) FileMenu_Destroy 119 stdcall IsLFNDrive(str) IsLFNDrive 120 stub FileMenu_AbortInitMenu 121 stub SHFlushClipboard @@ -132,7 +132,7 @@ init Shell32LibMain 124 stub FileMenu_AppendFilesForPidl 125 stub FileMenu_AddFilesForPidl 126 stub SHOutOfMemoryMessageBox - 127 stub SHWinHelp + 127 stdcall SHWinHelp (long long long long) SHWinHelp 128 stdcall DllGetClassObject(long long ptr) SHELL32_DllGetClassObject 129 stub DAD_AutoScroll 130 stub DAD_DragEnter @@ -142,7 +142,7 @@ init Shell32LibMain 134 stub DAD_DragMove 135 stub DragQueryPoint # exported by name 136 stub DAD_SetDragImage - 137 stub DAD_ShowDragImage + 137 stdcall DAD_ShowDragImage (long) DAD_ShowDragImage 138 stub DuplicateIcon # exported by name 139 stub Desktop_UpdateBriefcaseOnEvent 140 stub FileMenu_DeleteItemByIndex @@ -166,7 +166,7 @@ init Shell32LibMain 158 stdcall PathGetExtension(str long long) PathGetExtension 159 stub PathIsDirectory 160 stub SHNetConnectionDialog - 161 stub SHRunConrolPanel + 161 stdcall SHRunConrolPanel (long long)SHRunConrolPanel 162 stub SHSimpleIDListFromPath 163 stub StrToOleStr 164 stub Win32DeleteFile @@ -247,12 +247,12 @@ init Shell32LibMain 239 stdcall SHChangeNotify (long long ptr ptr) SHChangeNotify32 # exported by name 240 stub SHEmptyRecycleBinA@12 # exported by name 241 stub SHEmptyRecycleBinW@12 # exported by name - 242 stdcall SHFileOperation(ptr) SHFileOperation32 # exported by name - 243 stub SHFileOperationA@4 # exported by name + 242 stdcall SHFileOperation (ptr) SHFileOperation32 # exported by name + 243 stdcall SHFileOperationA (long) SHFileOperationA # exported by name 244 stub SHFileOperationW@4 # exported by name 245 stub SHFormatDrive@16 # exported by name 246 stub SHFreeNameMappings@4 # exported by name - 247 stub SHGetDataFromIDListA@20 # exported by name + 247 stdcall SHGetDataFromIDListA (long long long long long) SHGetDataFromIDListA # exported by name 248 stub SHGetDataFromIDListW@20 # exported by name 249 stub PathParseIconLocation@4 250 stub PathRemoveExtension@4 diff --git a/relay32/snoop.c b/relay32/snoop.c index 9bc4e38e0c8..52c4ab8b0d9 100644 --- a/relay32/snoop.c +++ b/relay32/snoop.c @@ -283,6 +283,11 @@ REGS_ENTRYPOINT(SNOOP_Entry) { FIXME(snoop,"entrypoint 0x%08lx not found\n",entry); return; /* oops */ } + if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name)) { + /* we don't display, so we don't need returndisplay either */ + EIP_reg(context)= (DWORD)fun->origfun; + return; + } /* guess cdecl ... */ if (fun->nrofargs<0) { /* Typical cdecl return frame is: @@ -297,6 +302,7 @@ REGS_ENTRYPOINT(SNOOP_Entry) { } } + while (*rets) { for (i=0;ientry)/sizeof((*rets)->entry[0]);i++) if (!(*rets)->entry[i].origreturn) @@ -323,7 +329,6 @@ REGS_ENTRYPOINT(SNOOP_Entry) { EIP_reg(context)= (DWORD)fun->origfun; - ret->show = SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name); if(!ret->show) return; DPRINTF("Call %s.%ld: %s(",dll->name,ordinal,fun->name); if (fun->nrofargs>0) { diff --git a/relay32/user32.spec b/relay32/user32.spec index ad34414e9e9..57a215d51ae 100644 --- a/relay32/user32.spec +++ b/relay32/user32.spec @@ -204,7 +204,7 @@ type win32 201 stdcall FindWindowW(wstr wstr) FindWindow32W 202 stdcall FlashWindow(long long) FlashWindow32 203 stdcall FrameRect(long ptr long) FrameRect32 -204 stub FreeDDElParam +204 stdcall FreeDDElParam(long long) FreeDDElParam32 205 stdcall GetActiveWindow() GetActiveWindow32 206 stdcall GetAppCompatFlags(long) GetAppCompatFlags32 207 stdcall GetAsyncKeyState(long) GetAsyncKeyState32 @@ -414,7 +414,7 @@ type win32 411 stub OpenInputDesktop 412 stub OpenWindowStationA 413 stub OpenWindowStationW -414 stub PackDDElParam +414 stdcall PackDDElParam(long long long) PackDDElParam32 415 stdcall PaintDesktop(long) PaintDesktop 416 stdcall PeekMessageA(ptr long long long long) PeekMessage32A 417 stdcall PeekMessageW(ptr long long long long) PeekMessage32W @@ -562,7 +562,7 @@ type win32 559 stdcall UnionRect(ptr ptr ptr) UnionRect32 560 stub UnloadKeyboardLayout 561 stub UnlockWindowStation -562 stub UnpackDDElParam +562 stdcall UnpackDDElParam(long long ptr ptr) UnpackDDElParam32 563 stdcall UnregisterClassA(str long) UnregisterClass32A 564 stdcall UnregisterClassW(wstr long) UnregisterClass32W 565 stdcall UnregisterHotKey(long long) UnregisterHotKey @@ -608,3 +608,7 @@ type win32 604 stub ChangeDisplaySettingsA 605 stub ChangeDisplaySettingsW 606 stdcall SetWindowText(long str) SetWindowText32A +607 stub GetMonitorInfoA +608 stub MonitorFromWindow +609 stub MonitorFromRect +610 stub MonitorFromPoint diff --git a/scheduler/handle.c b/scheduler/handle.c index 4d5957dc3d9..0f5bdc0c928 100644 --- a/scheduler/handle.c +++ b/scheduler/handle.c @@ -12,6 +12,7 @@ #include "heap.h" #include "process.h" #include "server.h" +#include "thread.h" #define HTABLE_SIZE 0x30 /* Handle table initial size */ #define HTABLE_INC 0x10 /* Handle table increment */ @@ -167,6 +168,18 @@ K32OBJ *HANDLE_GetObjPtr( PDB32 *pdb, HANDLE32 handle, else ptr = NULL; } + else if (handle == CURRENT_THREAD_PSEUDOHANDLE) + { + ptr = (K32OBJ *)THREAD_Current(); + if (server_handle) *server_handle = CURRENT_THREAD_PSEUDOHANDLE; + K32OBJ_IncCount( ptr ); + } + else if (handle == CURRENT_PROCESS_PSEUDOHANDLE) + { + ptr = (K32OBJ *)PROCESS_Current(); + if (server_handle) *server_handle = CURRENT_PROCESS_PSEUDOHANDLE; + K32OBJ_IncCount( ptr ); + } SYSTEM_UNLOCK(); if (!ptr) SetLastError( ERROR_INVALID_HANDLE ); return ptr; diff --git a/scheduler/process.c b/scheduler/process.c index 3c1f94a8810..adaf7822523 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -22,9 +22,6 @@ #include "server.h" #include "debug.h" -/* Process self-handle */ -#define PROCESS_SELF ((HANDLE32)0x7fffffff) - static BOOL32 PROCESS_Signaled( K32OBJ *obj, DWORD thread_id ); static BOOL32 PROCESS_Satisfied( K32OBJ *obj, DWORD thread_id ); static void PROCESS_AddWait( K32OBJ *obj, DWORD thread_id ); @@ -59,16 +56,8 @@ PDB32 *PROCESS_Current(void) */ PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access, int *server_handle ) { - PDB32 *pdb = PROCESS_Current(); - - if (handle == PROCESS_SELF) - { - if (server_handle) *server_handle = PROCESS_SELF; - K32OBJ_IncCount( &pdb->header ); - return pdb; - } - return (PDB32 *)HANDLE_GetObjPtr( pdb, handle, K32OBJ_PROCESS, access, - server_handle ); + return (PDB32 *)HANDLE_GetObjPtr( PROCESS_Current(), handle, + K32OBJ_PROCESS, access, server_handle ); } @@ -451,7 +440,7 @@ BOOL32 WINAPI TerminateProcess( HANDLE32 handle, DWORD exit_code ) */ HANDLE32 WINAPI GetCurrentProcess(void) { - return 0x7fffffff; + return CURRENT_PROCESS_PSEUDOHANDLE; } @@ -735,7 +724,7 @@ HANDLE32 WINAPI ConvertToGlobalHandle(HANDLE32 h) * A service process calls this function to ensure that it continues to run * even after a user logged off. */ -DWORD RegisterServiceProcess(DWORD dwProcessId, DWORD dwType) +DWORD WINAPI RegisterServiceProcess(DWORD dwProcessId, DWORD dwType) { /* I don't think that Wine needs to do anything in that function */ return 1; /* success */ diff --git a/scheduler/thread.c b/scheduler/thread.c index 60365d529ad..b836b9c124b 100644 --- a/scheduler/thread.c +++ b/scheduler/thread.c @@ -42,9 +42,6 @@ const K32OBJ_OPS THREAD_Ops = THREAD_Destroy /* destroy */ }; -/* The pseudohandle used for the current thread, see GetCurrentThread */ -#define CURRENT_THREAD_PSEUDOHANDLE 0xfffffffe - /* Is threading code initialized? */ BOOL32 THREAD_InitDone = FALSE; @@ -56,17 +53,8 @@ BOOL32 THREAD_InitDone = FALSE; */ THDB *THREAD_GetPtr( HANDLE32 handle, DWORD access, int *server_handle ) { - THDB *thread; - - if (handle == CURRENT_THREAD_PSEUDOHANDLE) /* Self-thread handle */ - { - thread = THREAD_Current(); - if (server_handle) *server_handle = CURRENT_THREAD_PSEUDOHANDLE; - K32OBJ_IncCount( &thread->header ); - } - else thread = (THDB *)HANDLE_GetObjPtr( PROCESS_Current(), handle, - K32OBJ_THREAD, access, server_handle ); - return thread; + return (THDB *)HANDLE_GetObjPtr( PROCESS_Current(), handle, + K32OBJ_THREAD, access, server_handle ); } diff --git a/tools/build.c b/tools/build.c index bd7f1e9103f..47d7ebdf0fa 100644 --- a/tools/build.c +++ b/tools/build.c @@ -1597,7 +1597,7 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile ) /* Save 16-bit fs and leave room for Win16Mutex recursion count */ - fprintf( outfile, "\tpushw %%fs\n" ); + fprintf( outfile, "\t.byte 0x66\n\tpushl %%fs\n" ); fprintf( outfile, "\tpushw $0\n" ); /* Setup bp to point to its copy on the stack */ diff --git a/tools/testrun b/tools/testrun index 6508c0101a4..7a52af2657e 100755 --- a/tools/testrun +++ b/tools/testrun @@ -29,7 +29,7 @@ $changelog = '/home/marcus/wine/ChangeLog'; # How long before automatically killing all subprocesses # 30 is good for automatic testing, 300 or more for interactive testing. # -$waittime = 30; +$waittime = 50; # #diff command # @@ -132,7 +132,7 @@ sub kill_subprocesses { # kill all subprocesses called 'wine'. Do not kill find, diff, sh # and friends, which are also subprocesses of us. foreach (keys %kids) { - next unless ($cmdline{$_} =~ /wine/); + next unless ($cmdline{$_} =~ /(wine|dosmod)/); # if we have already killed it using -TERM, use -KILL if ($killedalready{$_}) { kill(9,$_); # FIXME: use correct number? @@ -195,18 +195,7 @@ while ($exe=) { # Skip all mssetup, acmsetup , installshield whatever exes. # they seem to work, mostly and starting them is just annoying. - next if ($exe =~ /acmsetup/); - next if ($exe =~ /unwise/); - next if ($exe =~ /testexit/); - next if ($exe =~ /_msset/); - next if ($exe =~ /isun/i); - next if ($exe =~ /st4u/); - next if ($exe =~ /st5u/); - next if ($exe =~ /_mstest/); - next if ($exe =~ /_isdel/); - next if ($exe =~ /ms-setup/); - next if ($exe =~ /~mss/); - next if ($exe =~ /unin/); + next if ($exe =~ /acmsetup|unwise|testexit|_msset|isun|st4u|st5u|_mstest|_isdel|ms-setup|~ms|unin/io); $runfile = $exe; $runfile =~ s/[\/ ]/_/g; diff --git a/tools/winapi-check b/tools/winapi-check new file mode 100644 index 00000000000..22e6405fd02 --- /dev/null +++ b/tools/winapi-check @@ -0,0 +1,49 @@ +#!/bin/sh +# This quick and dirty script prints the names of functions that don't have a +# WINAPI in its header declaration or don't appear in any .c file at all. +# I don't think it's very intelligent to use it when having < 64 MB ;) +# FIXME: This script skips .spec function entries that occupy two or more +# .spec lines ! + +if [ ! -e ./ChangeLog ] ; then + echo You are not in Wine main directory ! + exit +fi +echo crtdll.spec, ntdll.spec and wsock32.spec will be mentioned many times, +echo as they use original UNIX functions that don\'t exist in Wine .c code. +echo +FIND_LIST="`find . -name "*.c"`" +for i in if1632/*.spec relay32/*.spec +do +# skip wprocs.spec, as it contains many funcs that don't need a WINAPI + if [ $i = "if1632/wprocs.spec" ] ; then + continue + fi + LINE="`egrep "stdcall|cdecl|pascal|register" $i|grep -v "^#"|tr -d " "|tr "\n" " "`" + for j in $LINE + do + if [ -n "`echo "$j"|grep \)`" ] ; then + FUNC="`echo $j|cut -f2 -d\)|cut -f1 -d'#'`" + if [ -n "$FUNC" ] ; then + if [ -z "`grep -B 1 $FUNC $FIND_LIST|egrep "WINAPI|__cdecl|DC_GET_VAL|DC_SET_MODE|REGS_ENTRYPOINT"`" ] ; then + case $FUNC in # "black list" + "GetBrushOrgEx16" ) ;; + "GetCurrentPositionEx16" ) ;; + "GetViewportExtEx16" ) ;; + "GetViewportOrgEx16" ) ;; + "GetWindowExtEx16" ) ;; + "GetWindowOrgEx16" ) ;; + + "GetBrushOrgEx32" ) ;; + "GetCurrentPositionEx32" ) ;; + "GetViewportExtEx32" ) ;; + "GetViewportOrgEx32" ) ;; + "GetWindowExtEx32" ) ;; + "GetWindowOrgEx32" ) ;; + * ) echo "$i: $FUNC" ;; + esac + fi + fi + fi + done +done diff --git a/tsx11/X11_calls b/tsx11/X11_calls index 3f92e5b7860..3fe237062de 100644 --- a/tsx11/X11_calls +++ b/tsx11/X11_calls @@ -93,6 +93,7 @@ XMapWindow XNextEvent XOffsetRegion XOpenDisplay +XOpenIM XParseGeometry XPending XPointInRegion diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c index 40d727f8992..117c7364370 100644 --- a/tsx11/ts_xlib.c +++ b/tsx11/ts_xlib.c @@ -1249,6 +1249,17 @@ int TSXWarpPointer(Display* a0, Window a1, Window a2, int a3, int a4, unsigned return r; } +XIM TSXOpenIM(Display* a0, struct _XrmHashBucketRec* a1, char* a2, char* a3) +{ + XIM r; + TRACE(x11, "Call XOpenIM\n"); + EnterCriticalSection( &X11DRV_CritSection ); + r = XOpenIM(a0, a1, a2, a3); + LeaveCriticalSection( &X11DRV_CritSection ); + TRACE(x11, "Ret XOpenIM\n"); + return r; +} + int (*TSXSynchronize(Display *a0, Bool a1))(Display *) { int (*r)(Display *); diff --git a/win32/code_page.c b/win32/code_page.c index ec18479dda0..2cdf09e5d6d 100644 --- a/win32/code_page.c +++ b/win32/code_page.c @@ -166,7 +166,6 @@ INT32 WINAPI MultiByteToWideChar(UINT32 page, DWORD flags, * ERRORS * ERROR_INSUFFICIENT_BUFFER * ERROR_INVALID_FLAGS (not yet implemented) - * ERROR_INVALID_PARAMETER (not yet implemented) * * BUGS * Does not properly handle codepage conversions. @@ -180,6 +179,12 @@ INT32 WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, LPCWSTR src, int count = 0; int eos = 0; int dont_copy= (dstlen==0); + + if ((!src) | ((!dst) && (!dont_copy)) ) + { SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (page!=GetACP() && page!=CP_OEMCP && page!=CP_ACP) FIXME(win32,"Conversion in CP %d not supported\n",page); #if 0 diff --git a/win32/device.c b/win32/device.c index 9ce240e09c8..832c941a246 100644 --- a/win32/device.c +++ b/win32/device.c @@ -3,6 +3,7 @@ * * Copyright 1998 Marcus Meissner * Copyright 1998 Ulrich Weigand + * Copyright 1998 Patrik Stridvall * */ @@ -26,6 +27,9 @@ #include "debug.h" #include "winioctl.h" #include "stackframe.h" +#include "winnt.h" +#include "msdos.h" +#include "miscemu.h" static void DEVICE_Destroy(K32OBJ *dev); const K32OBJ_OPS DEVICE_Ops = @@ -59,6 +63,14 @@ static BOOL32 DeviceIo_VTDAPI(DEVICE_OBJECT *dev, DWORD dwIoControlCode, static BOOL32 VxDCall_VMM( DWORD *retv, DWORD service, CONTEXT *context ); +static BOOL32 VxDCall_IFSMgr( DWORD *retv, DWORD service, CONTEXT *context ); + +static BOOL32 DeviceIo_IFSMgr(DEVICE_OBJECT *dev, DWORD dwIoControlCode, + LPVOID lpvInBuffer, DWORD cbInBuffer, + LPVOID lpvOutBuffer, DWORD cbOutBuffer, + LPDWORD lpcbBytesReturned, + LPOVERLAPPED lpOverlapped); + /* * VxD names are taken from the Win95 DDK */ @@ -137,7 +149,7 @@ struct VxDInfo { "WINSOCK", 0x003E, NULL, NULL }, { "WSOCK", 0x003E, NULL, NULL }, { "WSIPX", 0x003F, NULL, NULL }, - { "IFSMgr", 0x0040, NULL, NULL }, + { "IFSMgr", 0x0040, VxDCall_IFSMgr, DeviceIo_IFSMgr }, { "VCDFSD", 0x0041, NULL, NULL }, { "MRCI2", 0x0042, NULL, NULL }, { "PCI", 0x0043, NULL, NULL }, @@ -253,6 +265,143 @@ LPCSTR VMM_Service_Name[N_VMM_SERVICE] = }; +/* + * IFSMgr VxDCall service + */ + +#define N_IFSMGR_SERVICE 118 + +LPCSTR IFSMgr_Service_Name[N_IFSMGR_SERVICE] = +{ + "Get_Version", /* 0x0000 */ + "RegisterMount", /* 0x0001 */ + "RegisterNet", /* 0x0002 */ + "RegisterMailSlot", /* 0x0003 */ + "Attach", /* 0x0004 */ + "Detach", /* 0x0005 */ + "Get_NetTime", /* 0x0006 */ + "Get_DOSTime", /* 0x0007 */ + "SetupConnection", /* 0x0008 */ + "DerefConnection", /* 0x0009 */ + "ServerDOSCall", /* 0x000A */ + "CompleteAsync", /* 0x000B */ + "RegisterHeap", /* 0x000C */ + "GetHeap", /* 0x000D */ + "RetHeap", /* 0x000E */ + "CheckHeap", /* 0x000F */ + "CheckHeapItem", /* 0x0010 */ + "FillHeapSpare", /* 0x0011 */ + "Block", /* 0x0012 */ + "Wakeup", /* 0x0013 */ + "Yield", /* 0x0014 */ + "SchedEvent", /* 0x0015 */ + "QueueEvent", /* 0x0016 */ + "KillEvent", /* 0x0017 */ + "FreeIOReq", /* 0x0018 */ + "MakeMailSlot", /* 0x0019 */ + "DeleteMailSlot", /* 0x001A */ + "WriteMailSlot", /* 0x001B */ + "PopUp", /* 0x001C */ + "printf", /* 0x001D */ + "AssertFailed", /* 0x001E */ + "LogEntry", /* 0x001F */ + "DebugMenu", /* 0x0020 */ + "DebugVars", /* 0x0021 */ + "GetDebugString", /* 0x0022 */ + "GetDebugHexNum", /* 0x0023 */ + "NetFunction", /* 0x0024 */ + "DoDelAllUses", /* 0x0025 */ + "SetErrString", /* 0x0026 */ + "GetErrString", /* 0x0027 */ + "SetReqHook", /* 0x0028 */ + "SetPathHook", /* 0x0029 */ + "UseAdd", /* 0x002A */ + "UseDel", /* 0x002B */ + "InitUseAdd", /* 0x002C */ + "ChangeDir", /* 0x002D */ + "DelAllUses", /* 0x002E */ + "CDROM_Attach", /* 0x002F */ + "CDROM_Detach", /* 0x0030 */ + "Win32DupHandle", /* 0x0031 */ + "Ring0_FileIO", /* 0x0032 */ + "Win32_Get_Ring0_Handle", /* 0x0033 */ + "Get_Drive_Info", /* 0x0034 */ + "Ring0GetDriveInfo", /* 0x0035 */ + "BlockNoEvents", /* 0x0036 */ + "NetToDosTime", /* 0x0037 */ + "DosToNetTime", /* 0x0038 */ + "DosToWin32Time", /* 0x0039 */ + "Win32ToDosTime", /* 0x003A */ + "NetToWin32Time", /* 0x003B */ + "Win32ToNetTime", /* 0x003C */ + "MetaMatch", /* 0x003D */ + "TransMatch", /* 0x003E */ + "CallProvider", /* 0x003F */ + "UniToBCS", /* 0x0040 */ + "UniToBCSPath", /* 0x0041 */ + "BCSToUni", /* 0x0042 */ + "UniToUpper", /* 0x0043 */ + "UniCharToOEM", /* 0x0044 */ + "CreateBasis", /* 0x0045 */ + "MatchBasisName", /* 0x0046 */ + "AppendBasisTail", /* 0x0047 */ + "FcbToShort", /* 0x0048 */ + "ShortToFcb", /* 0x0049 */ + "ParsePath", /* 0x004A */ + "Query_PhysLock", /* 0x004B */ + "_VolFlush", /* 0x004C */ + "NotifyVolumeArrival", /* 0x004D */ + "NotifyVolumeRemoval", /* 0x004E */ + "QueryVolumeRemoval", /* 0x004F */ + "FSDUnmountCFSD", /* 0x0050 */ + "GetConversionTablePtrs", /* 0x0051 */ + "CheckAccessConflict", /* 0x0052 */ + "LockFile", /* 0x0053 */ + "UnlockFile", /* 0x0054 */ + "RemoveLocks", /* 0x0055 */ + "CheckLocks", /* 0x0056 */ + "CountLocks", /* 0x0057 */ + "ReassignLockFileInst", /* 0x0058 */ + "UnassignLockList", /* 0x0059 */ + "MountChildVolume", /* 0x005A */ + "UnmountChildVolume", /* 0x005B */ + "SwapDrives", /* 0x005C */ + "FSDMapFHtoIOREQ", /* 0x005D */ + "FSDParsePath", /* 0x005E */ + "FSDAttachSFT", /* 0x005F */ + "GetTimeZoneBias", /* 0x0060 */ + "PNPEvent", /* 0x0061 */ + "RegisterCFSD", /* 0x0062 */ + "Win32MapExtendedHandleToSFT", /* 0x0063 */ + "DbgSetFileHandleLimit", /* 0x0064 */ + "Win32MapSFTToExtendedHandle", /* 0x0065 */ + "FSDGetCurrentDrive", /* 0x0066 */ + "InstallFileSystemApiHook", /* 0x0067 */ + "RemoveFileSystemApiHook", /* 0x0068 */ + "RunScheduledEvents", /* 0x0069 */ + "CheckDelResource", /* 0x006A */ + "Win32GetVMCurdir", /* 0x006B */ + "SetupFailedConnection", /* 0x006C */ + "_GetMappedErr", /* 0x006D */ + "ShortToLossyFcb", /* 0x006F */ + "GetLockState", /* 0x0070 */ + "BcsToBcs", /* 0x0071 */ + "SetLoopback", /* 0x0072 */ + "ClearLoopback", /* 0x0073 */ + "ParseOneElement", /* 0x0074 */ + "BcsToBcsUpper" /* 0x0075 */ +}; + + +/* + * IFSMgr DeviceIO service + */ + +#define IFS_IOCTL_21 100 +#define IFS_IOCTL_2F 101 +#define IFS_IOCTL_GET_RES 102 +#define IFS_IOCTL_GET_NETPRO_NAME_A 103 + HANDLE32 DEVICE_Open(LPCSTR filename, DWORD access) { @@ -273,7 +422,7 @@ HANDLE32 DEVICE_Open(LPCSTR filename, DWORD access) if (!lstrcmpi32A(VxDList[i].name, filename)) break; if (VxDList[i].name) - dev->info = VxDList + i; + dev->info = &VxDList[i]; else FIXME(win32, "Unknown VxD %s\n", filename); @@ -331,17 +480,21 @@ BOOL32 WINAPI DeviceIoControl(HANDLE32 hDevice, DWORD dwIoControlCode, } /* Check if this is a user defined control code for a VxD */ - if( HIWORD( dwIoControlCode ) == 0 ) - { - if ( dev->info && dev->info->deviceio ) - return dev->info->deviceio( dev, dwIoControlCode, - lpvInBuffer, cbInBuffer, - lpvOutBuffer, cbOutBuffer, - lpcbBytesReturned, lpOverlapped ); - - /* FIXME: Set appropriate error */ - FIXME( win32, "Unimplemented control %ld for VxD device %s\n", - dwIoControlCode, dev->devname ); + if( HIWORD( dwIoControlCode ) == 0 ) + { + if ( dev->info && dev->info->deviceio ) + { + return dev->info->deviceio( dev, dwIoControlCode, + lpvInBuffer, cbInBuffer, + lpvOutBuffer, cbOutBuffer, + lpcbBytesReturned, lpOverlapped ); + } + else + { + /* FIXME: Set appropriate error */ + FIXME( win32, "Unimplemented control %ld for VxD device %s\n", + dwIoControlCode, dev->devname ); + } } else { @@ -685,3 +838,144 @@ BOOL32 VxDCall_VMM( DWORD *retv, DWORD service, CONTEXT *context ) return ok; } + +/*********************************************************************** + * VxDCall_IFSMgr + */ +BOOL32 VxDCall_IFSMgr( DWORD *retv, DWORD service, CONTEXT *context ) +{ + if (LOWORD(service) < N_IFSMGR_SERVICE) + FIXME(win32, "Unimplemented service %s (%08lx)\n", + IFSMgr_Service_Name[LOWORD(service)], service); + else + FIXME(win32, "Unknown service %08lx\n", service); + + return FALSE; +} + + + +/*********************************************************************** + * DeviceIo_IFSMgr + * NOTES + * The ioctls is used by 'MSNET32.DLL'. + * + * I have been unable to uncover any documentation about the ioctls so + * the implementation of the cases IFS_IOCTL_21 and IFS_IOCTL_2F are + * based on a resonable guesses on information found in the Windows 95 DDK. + * + */ + +struct win32apireq { + unsigned long ar_proid; + unsigned long ar_eax; + unsigned long ar_ebx; + unsigned long ar_ecx; + unsigned long ar_edx; + unsigned long ar_esi; + unsigned long ar_edi; + unsigned long ar_ebp; + unsigned short ar_error; + unsigned short ar_pad; +}; + +static void win32apieq_2_CONTEXT(struct win32apireq *pIn,CONTEXT *pCxt) +{ + memset(pCxt,0,sizeof(CONTEXT)); + + pCxt->ContextFlags=CONTEXT_INTEGER|CONTEXT_CONTROL; + pCxt->Eax = pIn->ar_eax; + pCxt->Ebx = pIn->ar_ebx; + pCxt->Ecx = pIn->ar_ecx; + pCxt->Edx = pIn->ar_edx; + pCxt->Esi = pIn->ar_esi; + pCxt->Edi = pIn->ar_edi; + + /* FIXME: Only partial CONTEXT_CONTROL */ + pCxt->Ebp = pIn->ar_ebp; + + /* FIXME: pIn->ar_proid ignored */ + /* FIXME: pIn->ar_error ignored */ + /* FIXME: pIn->ar_pad ignored */ +} + +static void CONTEXT_2_win32apieq(CONTEXT *pCxt,struct win32apireq *pOut) +{ + memset(pOut,0,sizeof(struct win32apireq)); + + pOut->ar_eax = pCxt->Eax; + pOut->ar_ebx = pCxt->Ebx; + pOut->ar_ecx = pCxt->Ecx; + pOut->ar_edx = pCxt->Edx; + pOut->ar_esi = pCxt->Esi; + pOut->ar_edi = pCxt->Edi; + + /* FIXME: Only partial CONTEXT_CONTROL */ + pOut->ar_ebp = pCxt->Ebp; + + /* FIXME: pOut->ar_proid ignored */ + /* FIXME: pOut->ar_error ignored */ + /* FIXME: pOut->ar_pad ignored */ +} + +static BOOL32 DeviceIo_IFSMgr(DEVICE_OBJECT *dev, DWORD dwIoControlCode, + LPVOID lpvInBuffer, DWORD cbInBuffer, + LPVOID lpvOutBuffer, DWORD cbOutBuffer, + LPDWORD lpcbBytesReturned, + LPOVERLAPPED lpOverlapped) +{ + BOOL32 retv = TRUE; + TRACE(win32,"(%p,%ld,%p,%ld,%p,%ld,%p,%p): stub\n", + dev,dwIoControlCode, + lpvInBuffer,cbInBuffer, + lpvOutBuffer,cbOutBuffer, + lpcbBytesReturned, + lpOverlapped); + + switch (dwIoControlCode) + { + case IFS_IOCTL_21: + case IFS_IOCTL_2F:{ + CONTEXT cxt; + struct win32apireq *pIn=(struct win32apireq *) lpvInBuffer; + struct win32apireq *pOut=(struct win32apireq *) lpvOutBuffer; + + TRACE(win32, + "Control '%s': " + "proid=0x%08lx, eax=0x%08lx, ebx=0x%08lx, ecx=0x%08lx, " + "edx=0x%08lx, esi=0x%08lx, edi=0x%08lx, ebp=0x%08lx, " + "error=0x%04x, pad=0x%04x\n", + (dwIoControlCode==IFS_IOCTL_21)?"IFS_IOCTL_21":"IFS_IOCTL_2F", + pIn->ar_proid, pIn->ar_eax, pIn->ar_ebx, pIn->ar_ecx, + pIn->ar_edx, pIn->ar_esi, pIn->ar_edi, pIn->ar_ebp, + pIn->ar_error, pIn->ar_pad + ); + + win32apieq_2_CONTEXT(pIn,&cxt); + + if(dwIoControlCode==IFS_IOCTL_21) + { + DOS3Call(&cxt); /* Call int 21h */ + } else { + INT_Int2fHandler(&cxt); /* Call int 2Fh */ + } + + CONTEXT_2_win32apieq(&cxt,pOut); + + retv = TRUE; + } break; + case IFS_IOCTL_GET_RES:{ + FIXME(win32, "Control 'IFS_IOCTL_GET_RES' not implemented\n"); + retv = FALSE; + } break; + case IFS_IOCTL_GET_NETPRO_NAME_A:{ + FIXME(win32, "Control 'IFS_IOCTL_GET_NETPRO_NAME_A' not implemented\n"); + retv = FALSE; + } break; + default: + FIXME(win32, "Control %ld not implemented\n", dwIoControlCode); + retv = FALSE; + } + + return retv; +} diff --git a/win32/except.c b/win32/except.c index 63674db2b80..014cb7f1475 100644 --- a/win32/except.c +++ b/win32/except.c @@ -161,11 +161,13 @@ REGS_ENTRYPOINT(RaiseException) while((pframe!=NULL)&&(pframe!=((void *)0xFFFFFFFF))) { + PEXCEPTION_FRAME prevframe; TRACE(win32,"calling exception handler at 0x%x\n", (int) pframe->Handler); dispatch=0; TRACE(relay,"(except=%p,record=%p,frame=%p,context=%p,dispatch=%p)\n", pframe->Handler, &record, pframe, context, &dispatch ); + prevframe = pframe->Prev; retval=pframe->Handler(&record,pframe,context,&dispatch); TRACE(win32,"exception handler returns 0x%x, dispatch=0x%x\n", @@ -173,7 +175,7 @@ REGS_ENTRYPOINT(RaiseException) if(retval==ExceptionContinueExecution) break; - pframe=pframe->Prev; + pframe=prevframe; } if (retval!=ExceptionContinueExecution) diff --git a/win32/file.c b/win32/file.c index a595d86791f..243c06d4198 100644 --- a/win32/file.c +++ b/win32/file.c @@ -129,6 +129,7 @@ HFILE32 WINAPI CreateFile32A(LPCSTR filename, DWORD access, DWORD sharing, DWORD attributes, HANDLE32 template) { int access_flags, create_flags; + HFILE32 to_dup = HFILE_ERROR32; /* handle to dup */ /* Translate the various flags to Unix-style. */ @@ -165,12 +166,22 @@ HFILE32 WINAPI CreateFile32A(LPCSTR filename, DWORD access, DWORD sharing, return HFILE_ERROR32; } - /* If the name is either CONIN$ or CONOUT$, give them stdin + /* If the name is either CONIN$ or CONOUT$, give them duplicated stdin * or stdout, respectively. */ - if(!strcmp(filename, "CONIN$")) return GetStdHandle( STD_INPUT_HANDLE ); - if(!strcmp(filename, "CONOUT$")) return GetStdHandle( STD_OUTPUT_HANDLE ); + if(!strcmp(filename, "CONIN$")) + to_dup = GetStdHandle( STD_INPUT_HANDLE ); + else if(!strcmp(filename, "CONOUT$")) + to_dup = GetStdHandle( STD_OUTPUT_HANDLE ); + if(to_dup != HFILE_ERROR32) + { + HFILE32 handle; + if (!DuplicateHandle( GetCurrentProcess(), to_dup, GetCurrentProcess(), + &handle, access, FALSE, 0 )) + handle = HFILE_ERROR32; + return handle; + } return FILE_Open( filename, access_flags | create_flags ); } diff --git a/windows/class.c b/windows/class.c index aef5cd351e4..bde35d146ce 100644 --- a/windows/class.c +++ b/windows/class.c @@ -1102,8 +1102,8 @@ BOOL32 WINAPI GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name, TRACE(class,"%x %p %p\n",hInstance, name, wc); if (!(atom = GlobalFindAtom32A( name )) || - !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) || - (hInstance != classPtr->hInstance)) return FALSE; + !(classPtr = CLASS_FindClassByAtom( atom, hInstance )) + /*|| (hInstance != classPtr->hInstance) */ ) return FALSE; wc->style = classPtr->style; wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc, WIN_PROC_32A ); diff --git a/windows/dce.c b/windows/dce.c index 1e9b316f081..25145c8d627 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -144,7 +144,7 @@ void DCE_FreeWindowDCE( WND* pWnd ) } else if( pDCE->DCXflags & DCX_DCEBUSY ) /* shared cache DCE */ { - ERR(cd,"[%04x] GetDC() without ReleaseDC()!\n", + ERR(dc,"[%04x] GetDC() without ReleaseDC()!\n", pWnd->hwndSelf); DCE_ReleaseDC( pDCE ); } diff --git a/windows/defwnd.c b/windows/defwnd.c index 1a57fa4c15d..46117e7a204 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -164,9 +164,15 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam, case WM_CONTEXTMENU: if( wndPtr->dwStyle & WS_CHILD ) SendMessage32A( wndPtr->parent->hwndSelf, msg, wParam, lParam ); - - /* else - * FIXME: Track system popup if click was in the caption area. */ + else + if (wndPtr->hSysMenu) + { /* + TrackPopupMenu32(wndPtr->hSysMenu,TPM_LEFTALIGN | TPM_RETURNCMD,LOWORD(lParam),HIWORD(lParam),0,wndPtr->hwndSelf,NULL); + DestroyMenu32(wndPtr->hSysMenu); + */ + FIXME(win,"Display default popup menu\n"); + /* Track system popup if click was in the caption area. */ + } break; case WM_NCACTIVATE: diff --git a/windows/dialog.c b/windows/dialog.c index 2226a2e9827..691813e488a 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -1583,7 +1583,7 @@ HWND32 WINAPI GetNextDlgTabItem32( HWND32 hwndDlg, HWND32 hwndCtrl, { /* No ctrl specified -> start from the beginning */ if (!(pWndCtrl = pWndDlg->child)) return 0; - if (fPrevious) while (pWndCtrl->next) pWndCtrl = pWndCtrl->next; + if (!fPrevious) while (pWndCtrl->next) pWndCtrl = pWndCtrl->next; } pWndLast = pWndCtrl; diff --git a/windows/graphics.c b/windows/graphics.c index fcdf859a7d3..2a1e9e20969 100644 --- a/windows/graphics.c +++ b/windows/graphics.c @@ -84,8 +84,8 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, TSXSetFunction( display, dc->u.x.gc, GXcopy ); if (bmp->bitmap.bmBitsPixel == 1) { - TSXSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel ); - TSXSetBackground( display, dc->u.x.gc, dc->w.textPixel ); + TSXSetForeground( display, dc->u.x.gc, dc->u.x.backgroundPixel ); + TSXSetBackground( display, dc->u.x.gc, dc->u.x.textPixel ); TSXCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc, xsrc, ysrc, width, height, xdest, ydest, 1 ); } @@ -97,13 +97,13 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap, if( COLOR_GetMonoPlane(&plane) ) { - TSXSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel ); - TSXSetBackground( display, dc->u.x.gc, dc->w.textPixel ); + TSXSetForeground(display, dc->u.x.gc, dc->u.x.backgroundPixel); + TSXSetBackground(display, dc->u.x.gc, dc->u.x.textPixel); } else { - TSXSetForeground( display, dc->u.x.gc, dc->w.textPixel ); - TSXSetBackground( display, dc->u.x.gc, dc->w.backgroundPixel ); + TSXSetForeground(display, dc->u.x.gc, dc->u.x.textPixel); + TSXSetBackground(display, dc->u.x.gc, dc->u.x.backgroundPixel); } TSXCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc, xsrc, ysrc, width, height, xdest, ydest, plane ); diff --git a/windows/keyboard.c b/windows/keyboard.c index 667f2d58c64..5422700c46d 100644 --- a/windows/keyboard.c +++ b/windows/keyboard.c @@ -773,6 +773,8 @@ INT32 WINAPI TranslateAccelerator32(HWND32 hWnd, HACCEL32 hAccel, LPMSG32 msg) { LPACCEL32 lpAccelTbl = (LPACCEL32)LockResource32(hAccel); int i; + + TRACE(accel,"hwnd=0x%x hacc=0x%x msg=0x%x wp=0x%x lp=0x%lx\n", hWnd, hAccel, msg->message, msg->wParam, msg->lParam); if (hAccel == 0 || msg == NULL || (msg->message != WM_KEYDOWN && diff --git a/windows/mdi.c b/windows/mdi.c index dadc4c8bf28..f38c164c095 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -259,7 +259,7 @@ static LRESULT MDIRefreshMenu( HWND32 hwnd, HMENU32 hmenuFrame, TRACE(mdi, "%04x %04x %04x\n", hwnd, hmenuFrame, hmenuWindow); - FIXME(mdi,"partially function stub"); + FIXME(mdi,"partial function stub\n"); return oldFrameMenu; } @@ -1600,7 +1600,6 @@ void WINAPI CalcChildScroll( HWND16 hwnd, WORD scroll ) { RECT32 childRect, clientRect; INT32 vmin, vmax, hmin, hmax, vpos, hpos; - BOOL32 noscroll = FALSE; WND *pWnd, *Wnd; if (!(Wnd = pWnd = WIN_FindWndPtr( hwnd ))) return; @@ -1608,11 +1607,14 @@ void WINAPI CalcChildScroll( HWND16 hwnd, WORD scroll ) SetRectEmpty32( &childRect ); for ( pWnd = pWnd->child; pWnd; pWnd = pWnd->next ) - { - UnionRect32( &childRect, &pWnd->rectWindow, &childRect ); + { if( pWnd->dwStyle & WS_MAXIMIZE ) - noscroll = TRUE; - } + { + ShowScrollBar32(hwnd, SB_BOTH, FALSE); + return; + } + UnionRect32( &childRect, &pWnd->rectWindow, &childRect ); + } UnionRect32( &childRect, &clientRect, &childRect ); /* jump through the hoops to prevent excessive flashing @@ -1623,11 +1625,8 @@ void WINAPI CalcChildScroll( HWND16 hwnd, WORD scroll ) vmin = childRect.top; vmax = childRect.bottom - clientRect.bottom; vpos = clientRect.top - childRect.top; - if( noscroll ) - ShowScrollBar32(hwnd, SB_BOTH, FALSE); - else switch( scroll ) - { + { case SB_HORZ: vpos = hpos; vmin = hmin; vmax = hmax; case SB_VERT: @@ -1639,7 +1638,7 @@ void WINAPI CalcChildScroll( HWND16 hwnd, WORD scroll ) hmin, hmax, hpos); SetWindowPos32(hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED ); - } + } } diff --git a/windows/message.c b/windows/message.c index 972e6ef31d7..ea6c8486ccd 100644 --- a/windows/message.c +++ b/windows/message.c @@ -1585,7 +1585,7 @@ static BOOL32 MSG_DoTranslateMessage( UINT32 message, HWND32 hwnd, TRACE(key, "(%s, %04X, %08lX)\n", SPY_GetMsgName(message), wParam, lParam ); - if ((message != WM_KEYDOWN) && (message != WM_SYSKEYDOWN)) return FALSE; + if ((message != WM_KEYDOWN) && (message != WM_SYSKEYDOWN)) return FALSE; TRACE(key, "Translating key %04X, scancode %04X\n", wParam, HIWORD(lParam) ); @@ -1912,7 +1912,7 @@ BOOL32 WINAPI SendMessageCallBack32A( HWND32 hWnd,UINT32 Msg,WPARAM32 wParam,LPARAM lParam, /*SENDASYNCPROC*/FARPROC32 lpResultCallBack,DWORD dwData ) { - FIXME(msg,"(0x%04x,0x%04x,0x%08lx,0x%08lx,%p,0x%08lx),stub!\n", + FIXME(msg,"(0x%04x,0x%04x,0x%08x,0x%08lx,%p,0x%08lx),stub!\n", hWnd,Msg,wParam,lParam,lpResultCallBack,dwData ); return FALSE; diff --git a/windows/user.c b/windows/user.c index 97cc7739965..46bfd5b1eea 100644 --- a/windows/user.c +++ b/windows/user.c @@ -351,7 +351,7 @@ BOOL32 WINAPI EnumDisplaySettings32A(LPCSTR name,DWORD n,LPDEVMODE32A devmode) { * * Used by Turbo Debugger for Windows */ -FARPROC16 SetEventHook(FARPROC16 lpfnEventHook) +FARPROC16 WINAPI SetEventHook(FARPROC16 lpfnEventHook) { FIXME(hook, "(lpfnEventHook=%08x): stub\n", (UINT32)lpfnEventHook); return NULL; diff --git a/windows/win.c b/windows/win.c index 456f2153977..575457b39ee 100644 --- a/windows/win.c +++ b/windows/win.c @@ -1560,7 +1560,9 @@ static LONG WIN_SetWindowLong( HWND32 hwnd, INT32 offset, LONG newval, { LONG *ptr, retval; WND * wndPtr = WIN_FindWndPtr( hwnd ); - + STYLESTRUCT style; + + TRACE(win,"%x=%p %x %lx %x\n",hwnd, wndPtr, offset, newval, type); if (!wndPtr) return 0; if (offset >= 0) { @@ -1581,27 +1583,41 @@ static LONG WIN_SetWindowLong( HWND32 hwnd, INT32 offset, LONG newval, } else switch(offset) { - case GWL_ID: - ptr = (DWORD*)&wndPtr->wIDmenu; - break; - case GWL_HINSTANCE: - return SetWindowWord32( hwnd, offset, newval ); + case GWL_ID: + ptr = (DWORD*)&wndPtr->wIDmenu; + break; + case GWL_HINSTANCE: + return SetWindowWord32( hwnd, offset, newval ); case GWL_WNDPROC: - retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type ); - WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval, + retval = (LONG)WINPROC_GetProc( wndPtr->winproc, type ); + WINPROC_SetProc( &wndPtr->winproc, (WNDPROC16)newval, type, WIN_PROC_WINDOW ); - return retval; + return retval; case GWL_STYLE: + if (wndPtr->flags & WIN_ISWIN32) + { style.styleOld = wndPtr->dwStyle; + newval &= ~(WS_VISIBLE | WS_CHILD); /* Some bits can't be changed this way */ + style.styleNew = newval | (style.styleOld & (WS_VISIBLE | WS_CHILD)); - /* FIXME: WM_STYLE... messages for WIN_ISWIN32 windows */ - - ptr = &wndPtr->dwStyle; - /* Some bits can't be changed this way */ - newval &= ~(WS_VISIBLE | WS_CHILD); - newval |= (*ptr & (WS_VISIBLE | WS_CHILD)); - break; - case GWL_USERDATA: ptr = &wndPtr->userdata; break; - case GWL_EXSTYLE: ptr = &wndPtr->dwExStyle; break; + SendMessage32A(hwnd,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style); + wndPtr->dwStyle = style.styleNew; + SendMessage32A(hwnd,WM_STYLECHANGED,GWL_STYLE,(LPARAM)&style); + UpdateWindow32(hwnd); + return style.styleOld; + } + case GWL_USERDATA: + ptr = &wndPtr->userdata; + break; + case GWL_EXSTYLE: + if (wndPtr->flags & WIN_ISWIN32) + { style.styleOld = wndPtr->dwExStyle; + style.styleNew = newval; + SendMessage32A(hwnd,WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&style); + wndPtr->dwExStyle = newval; + SendMessage32A(hwnd,WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&style); + UpdateWindow32(hwnd); + return style.styleOld; + } default: WARN( win, "Invalid offset %d\n", offset ); return 0; @@ -1939,9 +1955,7 @@ HWND32 WINAPI SetParent32( HWND32 hwndChild, HWND32 hwndNewParent ) /* FIXME: Create an X counterpart for reparented top-level windows * when not in the desktop mode. */ - if ( pWndParent == pWndDesktop ) - wndPtr->dwStyle &= ~WS_CHILD; - else wndPtr->dwStyle |= WS_CHILD; + if ( pWndParent != pWndDesktop ) wndPtr->dwStyle |= WS_CHILD; WIN_LinkWindow(hwndChild, HWND_BOTTOM); if( bFixupDCE ) diff --git a/windows/winpos.c b/windows/winpos.c index 74af90a0a7f..d1bbd21ebe1 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -260,7 +260,7 @@ BOOL32 WINAPI GetWindowRgn32 ( HWND32 hwnd, HRGN32 hrgn ) /*********************************************************************** * SetWindowRgn32 */ -BOOL32 WINAPI SetWindowRgn32 ( HWND32 hwnd, HRGN32 hrgn,BOOL32 bRedraw) +INT32 WINAPI SetWindowRgn32( HWND32 hwnd, HRGN32 hrgn,BOOL32 bRedraw) { @@ -268,6 +268,17 @@ BOOL32 WINAPI SetWindowRgn32 ( HWND32 hwnd, HRGN32 hrgn,BOOL32 bRedraw) return TRUE; } +/*********************************************************************** + * SetWindowRgn16 + */ +INT16 WINAPI SetWindowRgn16( HWND16 hwnd, HRGN16 hrgn,BOOL16 bRedraw) + +{ + + FIXME (win, "SetWindowRgn16: stub\n"); + return TRUE; +} + /*********************************************************************** * GetClientRect16 (USER.33) @@ -349,8 +360,15 @@ INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd ) INT16 hittest = HTERROR; POINT16 xy = pt; - *ppWnd = NULL; + *ppWnd = NULL; wndPtr = wndScope->child; + if( wndScope->flags & WIN_MANAGED ) + { + /* this prevents mouse clicks from going "through" scrollbars in managed mode */ + if( pt.x < wndScope->rectClient.left || pt.x >= wndScope->rectClient.right || + pt.y < wndScope->rectClient.top || pt.y >= wndScope->rectClient.bottom ) + goto hittest; + } MapWindowPoints16( GetDesktopWindow16(), wndScope->hwndSelf, &xy, 1 ); for (;;) @@ -388,6 +406,7 @@ INT16 WINPOS_WindowFromPoint( WND* wndScope, POINT16 pt, WND **ppWnd ) else wndPtr = wndPtr->next; } +hittest: /* If nothing found, try the scope window */ if (!*ppWnd) *ppWnd = wndScope; @@ -1801,7 +1820,7 @@ static void WINPOS_MoveWindowZOrder( HWND32 hwnd, HWND32 hwndAfter ) * WINPOS_ReorderOwnedPopups * * fix Z order taking into account owned popups - - * basically we need to maintain them above owner window + * basically we need to maintain them above the window that owns them */ HWND32 WINPOS_ReorderOwnedPopups(HWND32 hwndInsertAfter,WND* wndPtr,WORD flags) { @@ -2303,37 +2322,47 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, newClientRect.left - newWindowRect.left) || (oldClientRect.top - oldWindowRect.top != newClientRect.top - newWindowRect.top) || - winpos.flags & SWP_NOCOPYBITS ) + (winpos.flags & SWP_NOCOPYBITS) ) + { + /* if the client area moved as a result of WM_NCCALCSIZE returning + * obscure WVR_ALIGNxxx flags then we simply redraw the whole thing + * + * TODO: use WINPOS_SizeMoveClean() if there is no SWP_NOCOPYBITS + */ PAINT_RedrawWindow( wndPtr->hwndSelf, NULL, 0, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE, 0 ); + } else if( winpos.flags & SWP_FRAMECHANGED ) { WORD wErase = 0; RECT32 rect; - if( oldClientRect.right > newClientRect.right ) + if( newClientRect.right > oldClientRect.right ) /* redraw exposed client area on the right */ { - rect.left = newClientRect.right; rect.top = newClientRect.top; - rect.right = oldClientRect.right; rect.bottom = newClientRect.bottom; + rect.top = 0; rect.bottom = newClientRect.bottom - newClientRect.top; + rect.left = oldClientRect.right - newClientRect.left; + rect.right = newClientRect.right - newClientRect.left; wErase = 1; PAINT_RedrawWindow( wndPtr->hwndSelf, &rect, 0, - RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN, 0 ); + RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW | RDW_ALLCHILDREN, 0 ); } - if( oldClientRect.bottom > newClientRect.bottom ) + if( newClientRect.bottom > oldClientRect.bottom ) /* redraw exposed client area on the bottom */ { - rect.left = newClientRect.left; rect.top = newClientRect.bottom; - rect.right = (wErase)?oldClientRect.right:newClientRect.right; - rect.bottom = oldClientRect.bottom; + rect.left = 0; rect.right = ((wErase)?oldClientRect.right:newClientRect.right) - newClientRect.left; + rect.top = oldClientRect.bottom - newClientRect.top; + rect.bottom = newClientRect.bottom - newClientRect.top; wErase = 1; PAINT_RedrawWindow( wndPtr->hwndSelf, &rect, 0, - RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN, 0 ); + RDW_INVALIDATE | RDW_FRAME | RDW_ERASE | RDW_ERASENOW | RDW_ALLCHILDREN, 0 ); } - if( !wErase ) wndPtr->flags |= WIN_NEEDS_NCPAINT; + if( !wErase ) /* just update the nonclient area */ + wndPtr->flags |= WIN_NEEDS_NCPAINT; } + uFlags |= SMC_NOPARENTERASE; /* X windows do not have eraseable parents */ } - else + else /* not an X window */ { RECT32 oldClientRect = wndPtr->rectClient; @@ -2347,7 +2376,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, newClientRect.right - newClientRect.left ) result &= ~WVR_HREDRAW; if( !(flags & (SWP_NOREDRAW | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) ) - { + { uFlags |= ((winpos.flags & SWP_NOCOPYBITS) || (result >= WVR_HREDRAW && result < WVR_VALIDRECTS)) ? SMC_NOCOPY : 0; uFlags |= (winpos.flags & SWP_FRAMECHANGED) ? SMC_DRAWFRAME : 0; @@ -2356,13 +2385,13 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, uFlags = WINPOS_SizeMoveClean(wndPtr, visRgn, &oldWindowRect, &oldClientRect, uFlags); else - { - /* adjust frame and do not erase parent */ + { + /* adjust the frame and do not erase the parent */ if( winpos.flags & SWP_FRAMECHANGED ) wndPtr->flags |= WIN_NEEDS_NCPAINT; if( winpos.flags & SWP_NOZORDER ) uFlags |= SMC_NOPARENTERASE; - } - } + } + } DeleteObject32(visRgn); } diff --git a/windows/winproc.c b/windows/winproc.c index bb6ff926470..c8138602553 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -402,6 +402,7 @@ INT32 WINPROC_MapMsg32ATo32W( UINT32 msg, WPARAM32 wParam, LPARAM *plparam ) } return 1; case WM_SETTEXT: + case LB_ADDSTRING32: *plparam = (LPARAM)HEAP_strdupAtoW( SystemHeap, 0, (LPCSTR)*plparam ); return (*plparam ? 1 : -1); case WM_NCCREATE: @@ -464,6 +465,7 @@ void WINPROC_UnmapMsg32ATo32W( UINT32 msg, WPARAM32 wParam, LPARAM lParam ) HeapFree( SystemHeap, 0, ptr ); } break; + case LB_ADDSTRING32: case WM_SETTEXT: HeapFree( SystemHeap, 0, (void *)lParam ); break; @@ -512,6 +514,7 @@ INT32 WINPROC_MapMsg32WTo32A( UINT32 msg, WPARAM32 wParam, LPARAM *plparam ) } return 1; case WM_SETTEXT: + case LB_ADDSTRING32: *plparam = (LPARAM)HEAP_strdupWtoA( SystemHeap, 0, (LPCWSTR)*plparam ); return (*plparam ? 1 : -1); case WM_NCCREATE: @@ -574,6 +577,7 @@ void WINPROC_UnmapMsg32WTo32A( UINT32 msg, WPARAM32 wParam, LPARAM lParam ) HeapFree( SystemHeap, 0, ptr ); } break; + case LB_ADDSTRING32: case WM_SETTEXT: HeapFree( SystemHeap, 0, (void *)lParam ); break;