diff -urN wine-20050310/ANNOUNCE wine-20050419/ANNOUNCE --- wine-20050310/ANNOUNCE 2005-03-10 21:10:32.000000000 +0100 +++ wine-20050419/ANNOUNCE 2005-04-19 14:54:44.000000000 +0200 @@ -1,14 +1,14 @@ -This is release 20050310 of Wine, a free implementation of Windows on +This is release 20050419 of Wine, a free implementation of Windows on Unix. This is still a developers only release. There are many bugs and unimplemented features. Most applications still do not work correctly. -WHAT'S NEW with Wine-20050310: (see ChangeLog for details) - - Initial implementation of a true Richedit control. - - Shell extension for browsing Unix directories. - - More MSI work. - - PBuffer support in OpenGL. - - Window painting regressions should be fixed. +WHAT'S NEW with Wine-20050419: (see ChangeLog for details) + - Mailslot support. + - Support for side mouse buttons (X buttons). + - More Richedit improvements. + - Loading of Windows registry files disabled for now. + - Many code cleanups. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -17,8 +17,8 @@ the release is available at the ftp sites. The sources will be available from the following locations: - http://www.ibiblio.org/pub/Linux/ALPHA/wine/development/Wine-20050310.tar.gz - http://prdownloads.sourceforge.net/wine/Wine-20050310.tar.gz + http://www.ibiblio.org/pub/Linux/ALPHA/wine/development/Wine-20050419.tar.gz + http://prdownloads.sourceforge.net/wine/Wine-20050419.tar.gz It should also be available from any other site that mirrors ibiblio.org. These locations also hold pre-built documentation packages in various diff -urN wine-20050310/ChangeLog wine-20050419/ChangeLog --- wine-20050310/ChangeLog 2005-03-10 21:10:32.000000000 +0100 +++ wine-20050419/ChangeLog 2005-04-19 14:54:44.000000000 +0200 @@ -1,4 +1,2568 @@ ---------------------------------------------------------------- +2005-04-19 Alexandre Julliard + + * dlls/wtsapi32/wtsapi32.c, dlls/wtsapi32/wtsapi32.spec, + include/wtsapi32.h: + Huw Davies + WTSFreeMemory stub. + + * dlls/advapi32/tests/registry.c: James Hawkins + Set the backup/restore privilege. + + * dlls/kernel/tests/file.c: + Stefan Leichter + Exclude crashing CreateFileW test on NT4. + + * server/file.c, server/file.h, server/mapping.c: + Cleaned up handling of 64-bit file sizes. + + * dlls/ntdll/virtual.c: Troy Rollo + Fix SEGVs in NtCreateSection and NtMapViewOfSection. + + * dlls/advpack/reg.c: Troy Rollo + Prevent SEGV in RegInstall when pstTable is NULL. + + * dlls/advapi32/service.c: Troy Rollo + Correct test of BOOL return value in ControlService. + + * dlls/advapi32/tests/registry.c: James Hawkins + Remove two unnecessary traces. + Break up one test into two. + + * dlls/ntdll/tests/info.c, dlls/ntdll/tests/rtlstr.c, + dlls/shell32/shellord.c, dlls/twain/twain.h, documentation/ole.sgml, + include/custcntl.h: + Francois Gouget + Assorted spelling fixes. + + * dlls/shell32/shlfileop.c: Troy Rollo + Fix SEGV for non-fully-qualified destination paths. + Don't fail ShFileOperationW if FOF_ALLOWUNDO is passed. + + * dlls/msi/tests/db.c, dlls/msi/tests/record.c, + dlls/shell32/tests/shelllink.c, dlls/user/tests/msg.c: + Francois Gouget + Add trailing '\n's to ok() calls. + + * dlls/dplayx/dplay.c: Francois Gouget + DPSET_REMOTE is 0 so we cannot do (flags & DPSET_REMOTE). Instead + check that the DPSET_LOCAL flag is not set. + + * dlls/commdlg/filedlgbrowser.c: Francois Gouget + SBSP_ABSOLUTE is 0 so we cannot do (wFlags & SBSP_ABSOLUTE). + Add COMDLG32_DumpSBSPFlags(). + + * documentation/winedev-otherdebug.sgml: + Aaron Arvey + Added section "Which code has been tested?" describing gcov usage. + + * dlls/advapi32/tests/registry.c: James Hawkins + Add RegUnLoadKey test. + + * dlls/user/menu.c: Jose Alonso + Change the order of DispatchMessage and message removal. + +2005-04-18 Alexandre Julliard + + * tools/widl/widl.c: Juan Lang + Always initialize header file name, to prevent "#include (null)" + statements in generated files. + + * tools/wine.inf: Benjamin Cutler + Add default registry entries for power management. + + * dlls/kernel/tests/atom.c: Eric Pouech + Copied the atom tests for global atom so that we can test local atoms + too. + + * dlls/kernel/locale.c: + Removed unused data fields in the LANG_FIND_DATA structure. + + * dlls/ntdll/sync.c, include/wine/server_protocol.h, + server/protocol.def: + Eric Pouech + Removed the no longer user APC_ASYNC kind of APC. + + * windows/syscolor.c: Rein Klazes + Fix addressing the magic GDIOBJHDR field in + SYSCOLOR_MakeObjectSystem. + + * dlls/user/text.c: Peter Berg Larsen + Eliminate strncpy. Correct a \0 assingment to the modstr variable. + + * dlls/msi/format.c: Peter Berg Larsen + Remove 2 identicals calls to strlenW. + + * dlls/dmloader/container.c, dlls/dmusic/collection.c, + dlls/kernel/task.c, dlls/rsaenh/rsaenh.c, dlls/shlwapi/path.c, + dlls/shlwapi/url.c, dlls/winedos/devices.c, dlls/wininet/urlcache.c: + Peter Berg Larsen + Strncpy elimination. + + * dlls/dbghelp/type.c: Peter Berg Larsen + Eliminate strncpy and correct some NameLen bugs. + + * dlls/dbghelp/module.c: Peter Berg Larsen + Elimination of lstrcpyn, and corrected a potential pointer bug. + + * dlls/cabinet/cabextract.c: Peter Berg Larsen + Eliminate a strncpy and remove unused variable. + + * dlls/kernel/sync.c, dlls/ntdll/file.c, + include/wine/server_protocol.h, include/winternl.h, + server/named_pipe.c, server/protocol.def, server/trace.c: + Eric Pouech + - moved named pipe creation to ntdll + - server now handles the named pipe flags as the NTDLL values (not the + KERNEL32 ones) + - named pipes in server now use the async IO mechanism for + connect/wait ops + + * dlls/dinput/data_formats.c: Robert Reif + Added keyboard data format. + + * dlls/comctl32/tooltips.c, dlls/commdlg/filedlg.c, + dlls/devenum/parsedisplayname.c, dlls/dmband/band.c, + dlls/dmcompos/chordmap.c, dlls/dmime/audiopath.c, dlls/dmime/graph.c, + dlls/dmime/segment.c, dlls/dmloader/loaderstream.c, + dlls/dmscript/script.c, dlls/dmstyle/style.c, dlls/gdi/font.c, + dlls/gdi/freetype.c, dlls/itss/chm_lib.c, dlls/msi/cond.y, + dlls/msvcrt/locale.c, dlls/msvideo/mciwnd.c, + dlls/msvideo/msvideo16.c, dlls/oledlg/insobjdlg.c, + dlls/quartz/filtermapper.c, dlls/shell32/debughlp.c, + dlls/shell32/shelllink.c, dlls/shell32/shellpath.c, + dlls/shell32/shlexec.c, dlls/shell32/systray.c, dlls/user/edit.c, + dlls/winedos/int21.c, dlls/wininet/dialogs.c, + dlls/wininet/internet.c, dlls/wininet/utility.c, + dlls/winmm/wineoss/audio.c, programs/winecfg/drivedetect.c, + tools/sfnt2fnt.c: + Peter Berg Larsen + Replace strncpy with memcpy or lstrcpyn. + + * dlls/comctl32/treeview.c: Vitaliy Margolen + Don't redraw if no information has changed. + Fixed endless redraw loop if app using callback for images and/or + text. + Keep color changes made by app for the current draw cycle. + + * dlls/commdlg/printdlg.c, include/commdlg.h: + Eric Pouech + Added proper definition for PRINTDLGEX[AW] structures. + + * programs/winetest/gui.c, programs/winetest/main.c, + programs/winetest/util.c, programs/winetest/winetest.h, + programs/winetest/winetest.rc: + Ferenc Wagner + Enforce valid tag syntax during input. + + * dlls/msacm/imaadp32/imaadp32.c, dlls/msvcrt/mbcs.c, + programs/winecfg/winecfg.c: + Eric Pouech + Fixed some signed / unsigned pointer casts. + + * documentation/architecture.sgml, documentation/winedev-kernel.sgml: + Eric Pouech + - Using uniform DocBook tags for DLLs, commands, environment vars... + - Moved detailed memory management from archi to kernel(s) part. + - Enhanced process handling description. + - Added section about 16 bit processes' support. + - Added section about DOS support. + + * documentation/debugger.sgml: Eric Pouech + Minor cleanups. + + * dlls/advapi32/tests/registry.c: Jakob Eriksson + Fail gracefully on permission denied. + + * dlls/ntdll/nt.c: Benjamin Cutler + Add semi-stub for NtPowerInformation(SystemPowerCapabilities, ...). + + * dlls/comctl32/datetime.c: Duane Clark + The datetime should be initialized with local time. + + * dlls/advpack/advpack.c, dlls/advpack/advpack.spec, include/advpub.h: + Sami Aario + Added stubs for RunSetupCommand and DelNode. + + * dlls/x11drv/clipboard.c: Eric Pouech + Correctness for const pointer casts. + + * programs/progman/dialog.c, programs/progman/program.c: + Eric Pouech + Removed a couple of unneeded casts. + +2005-04-16 Alexandre Julliard + + * dlls/ntdll/ntdll.spec, dlls/ntdll/sync.c, include/winternl.h: + Mike McCormack + Declare and define a stub for NtSignalAndWaitForSingleObject. + + * dlls/gdi/gdi16.c: Richard Cohen + CreateBitmap16 should use only the first byte of planes & bpp. + + * dlls/advapi32/registry.c, dlls/advapi32/tests/registry.c: + James Hawkins + RegDeleteKey fails if the lpSubKey param is NULL. + + * dlls/riched20/caret.c, dlls/riched20/editor.c, + dlls/riched20/editor.h, dlls/riched20/editstr.h, + dlls/riched20/paint.c, dlls/riched20/para.c, dlls/riched20/run.c, + dlls/riched20/style.c, dlls/riched20/wrap.c: + Krzysztof Foltman + - removed trailing spaces from some files + - tab support + - indent support + + * dlls/comctl32/datetime.c: Duane Clark + Add support for direct keyboard input to numeric fields. + + * dlls/hhctrl.ocx/hhctrl.c: Mike Hearn + - Add text dumping of the requested command. + - Make the stub message appear for more commands. + + * dlls/ntdll/nt.c, dlls/ntdll/ntdll.spec, include/winternl.h: + Benjamin Cutler + - Correct args for NtPowerInformation. + - Add stub for NtInitiatePowerAction. + +2005-04-15 Alexandre Julliard + + * loader/preloader.c: Aaron Arvey + Added __bb_init_func for linking purposes. + + * dlls/mshtml/htmldoc.c, dlls/mshtml/mshtml_private.h, + dlls/mshtml/oleobj.c, dlls/mshtml/view.c: + Jacek Caban + - More implementation of view + - Added IOleInPlaceActiveObject + + * dlls/advapi32/tests/registry.c: Jakob Eriksson + ERROR_PRIVILEGE_NOT_HELD can be returned for NT4. + + * dlls/advapi32/tests/crypt.c: Jakob Eriksson + Win98 can return ERROR_CALL_NOT_IMPLEMENTED. + + * dlls/dciman32/dciman32.spec, dlls/dciman32/dciman_main.c: + Brian Vincent + Add stub for DCICreatePrimary. + + * dlls/shell32/shfldr_fs.c: Huw Davies + When we're hiding file extensions then SetNameOf should append the + original extension if SHGDN_FORPARSING isn't set. + The flags passed to SetNameOf refer to the dst string not the src + pidl. + + * dlls/ole32/moniker.c: Dmitry Timoshkov + Zero out an invalidated runningObjectTableInstance pointer. + + * tools/winedump/main.c: Francois Gouget + Mention the 'emf' and 'lnk' modes in the usage summary. + Add -? and --help synonyms for -h as is customary. + puts("") already prints a '\n' so we don't need a second one. + + * programs/winemenubuilder/winemenubuilder.c: + Francois Gouget + If winemenubuilder is given a list of menus to recreate, it should not + give up on the first menu that fails. + + * dlls/comctl32/datetime.c: Duane Clark + Hour '0' corresponds to 12AM. + + * dlls/ntdll/nt.c, dlls/ntdll/tests/.cvsignore, + dlls/ntdll/tests/Makefile.in, dlls/ntdll/tests/info.c: + Paul Vriens + Start of unit tests for *Info* functions. + Check needed length regardless of given length. + Return STATUS_INVALID_INFO_CLASS for non-implemented classes. + Return STATUS_ACCESS_VIOLATION if no buffer given. + + * dlls/gdi/tests/metafile.c: Mike McCormack + Simple unit tests for GdiIs*DC functions. + + * include/wtsapi32.h: Mike McCormack + Add some more Windows Terminal Server API definitions. + + * tools/widl/client.c, tools/widl/server.c: + Juan Lang + Put space between include directive and include file. + + * tools/widl/widl.man: Juan Lang + Add proxy/stub options to widl man page. + + * dlls/ole32/ole32.spec, dlls/ole32/stg_prop.c, + dlls/ole32/tests/stg_prop.c: + Juan Lang + Implement FmtIdToPropStgName & PropStgNameToFmtId, with tests. + + * dlls/comctl32/toolbar.c: Robert Shearman + Fix TB_GETBUTTONSIZE to return the correct width/height for no + buttons. + + * dlls/comctl32/datetime.c: Robert Shearman + - Use SetWindowPos to move the buddy window into position instead of + destroying it and recreating it at the new position. + - Clear the background in WM_VSCROLL to avoid problems with + antialiased text drawing on top of itself multiple times. + + * include/wingdi.h: Mike McCormack + Add prototypes for some Gdi* functions. + +2005-04-14 Alexandre Julliard + + * dlls/comctl32/updown.c: Dimitrie O. Paun + Keep track of WS_DISABLED explicitely, as it doesn't generate a + WM_STYLECHANGED message. + + * dlls/comctl32/listview.c: Dimitrie O. Paun + Add support for LVN_ODSTATECHANGED. + Minor typo fixes. + + * dlls/gdi/dc.c, dlls/gdi/gdi32.spec: + Mike McCormack + Implement GdiIs*DC functions. + + * dlls/user/tests/.cvsignore, dlls/user/tests/Makefile.in, + dlls/user/tests/menu.c: + Robert Shearman + Add a test for a menu problem I found. + + * dlls/user/menu.c: Robert Shearman + Recalculate the menu on calling ModifyMenu so that the menu items are + shown at the correct width. + + * dlls/comctl32/treeview.c: Vitaliy Margolen + Send notifies after invalidating changed areas. + Don't use custom draw returned colors for control. + + * dlls/ole32/stg_prop.c: Fixed a buffer overflow. + + * dlls/x11drv/dib.c: Rein Klazes + In X11DRV_DIB_SetImageBits avoid BadMatch errors when calling + XGetSubImage. + + * dlls/x11drv/opengl.c, dlls/x11drv/x11drv.h, + dlls/x11drv/x11drv_main.c, dlls/x11drv/xvidmode.c: + Include Xmd.h in x11drv.h with the proper defines to make it work, and + remove related hacks in various C files. + + * dlls/msvcrt/wcs.c: Rein Klazes + Fix decoding printf format in case the field width specifier is a '*'. + + * tools/wrc/parser.y: Michael Lin + Change menu item options to use optional comma. + + * include/winuser.h: Michael Lin + Define WINUSERAPI. + + * dlls/oleaut32/typelib.c: Daniel Remenak + Remove unused variable in _copy_arg. + + * dlls/wininet/internet.c: Benjamin Cutler + Better handling of hInternet == NULL for INTERNET_OPTION_PROXY in + INET_QueryOptionHelper. MSDN says to return 'global proxy info' when + hInternet == NULL. Thanks to Juan Lang for helping with this. + + * dlls/comctl32/datetime.c, dlls/comctl32/monthcal.c: + Duane Clark + Monday is day number '1'. + Set day of week when a day is selected in the calender. + Use fixed width fields in datetime. + DTS_TIMEFORMAT is a two bit field, so test accordingly. + Reposition and resize the updown control when the datetime control is + resized. + Respond to updown inputs. + + * dlls/mshtml/Makefile.in, dlls/mshtml/htmldoc.c, dlls/mshtml/main.c, + dlls/mshtml/mshtml_private.h, dlls/mshtml/view.c: + Jacek Caban + Added more implementation of IDocumentView. + + * programs/regedit/En.rc, programs/regedit/Makefile.in, + programs/regedit/edit.c, programs/regedit/hexedit.c, + programs/regedit/main.c, programs/regedit/main.h, + programs/regedit/resource.h: + Robert Shearman + - Add neutral English resources. + - Add a control for editing binary data. + - Add a binary value editor dialog. + + * dlls/kernel/console.c, programs/wineconsole/user.c, + programs/wineconsole/winecon_private.h, + programs/wineconsole/wineconsole.c: + Rein Klazes + In AllocConsole() pass the wShowWindow value and STARTF_USESHOWWINDOW + flag from the calling process to the console process. Make wineconsole + use the CmdShow parameter in the ShowWindow call. + +2005-04-13 Alexandre Julliard + + * dlls/user/controls.h, dlls/user/text.c, dlls/user/uitools.c, + dlls/user/user_private.h, windows/defwnd.c, windows/nonclient.c, + windows/syscolor.c: + Moved handling of the 55AA pattern brush to syscolor.c so that it can + be made a system object (found by Rein Klazes). + + * dlls/wininet/internet.c: Benjamin Cutler + Check for an invalid hInternet handle in INET_QueryOptionHelper for + INTERNET_OPTION_PROXY before attempting to use it. + + * dlls/gdi/bitmap.c, dlls/gdi/gdi_private.h, dlls/gdi/wing.c, + include/gdi.h: + Moved the BITMAPOBJ structure to gdi_private.h. + + * dlls/x11drv/xim.c: Marcus Meissner + Terminate XCreateIC() argument list with NULL instead of just 0. + + * dlls/x11drv/bitmap.c: + Use an X context to associate the phys bitmap data to a bitmap handle + instead of directly accessing the bitmap structure. + + * dlls/x11drv/x11drv.spec: Huw Davies + RegisterClipboardFormat takes a unicode string now. + + * dlls/oleaut32/olepicture.c: + Alex Villacís Lasso + - Fix leftover negative sign in height parameter for transparent + bitmap. + - Properly announce whether bitmap is transparent in get_Attributes. + - GIF transparency is now palette-index based, instead of RGB based. + - Keep original bitmap and XOR mask separate, so that get_Handle + returns original bitmap. + + * dlls/shell32/shellole.c: Martin Fuchs + Correct comments of some export ordinals. + + * dlls/gdi/gdi32.spec, dlls/ole32/ole2_16.c, dlls/x11drv/clipboard.c: + Dimitrie O. Paun + Remove the need for the non-standard (Close|Delete)MetaFile16(). + + * dlls/gdi/dib.c, dlls/gdi/gdi_private.h, dlls/x11drv/dib.c, + dlls/x11drv/x11drv.h, dlls/x11drv/x11drv.spec: + Moved the driver-independent part of CreateDIBSection into GDI. + + * dlls/mshtml/Makefile.in, dlls/mshtml/htmldoc.c, + dlls/mshtml/mshtml_private.h, dlls/mshtml/oleobj.c, + dlls/mshtml/view.c: + Jacek Caban + - Added IOleDocumentView interface. + - Added implementation of DoVerb and CreateView. + + * dlls/advapi32/tests/registry.c: James Hawkins + Pass an empty string instead of NULL to RegDeleteKey to delete hKey. + + * windows/spy.c: Vitaliy Margolen + Dump whole NMHEADERA notify structure for TreeViews. + + * dlls/comctl32/tab.c: Vitaliy Margolen + Draw only visible tabs. + + * dlls/dsound/propset.c: Robert Reif + Fully implement WAVEDEVICEMAPPING property set. + + * dlls/shell32/debughlp.c, dlls/shell32/pidl.c, dlls/shell32/pidl.h, + dlls/shell32/shelllink.c: + Huw Davies + Add a unicode pidl type. + Improve support for PT_YAGUID. + Improve IShellLink debugging. + + * dlls/x11drv/bitmap.c, dlls/x11drv/dib.c, dlls/x11drv/x11drv.h: + Store DIB section information directly in the phys bitmap structure + and get rid of the X11DRV_DIBSECTION structure. + Get rid of the unused AuxMod DIB state. + + * tools/winebuild/relay.c: Marcus Meissner + Use correct movw instead of movl when handling segment registers. + + * dlls/ole32/ole2.c, dlls/ole32/ole32.spec: + Juan Lang + Implement PropSys{Alloc|Free}String, and support BSTRs in + PropVariant{Clear|Copy} using them. + + * dlls/riched20/editor.c, dlls/riched20/editor.h, + dlls/riched20/editstr.h, dlls/riched20/reader.c, dlls/riched20/rtf.h: + Phil Krylov + Make RTF reader fall back to simple text if a correct RTF header is + not detected. This should fix some installers. + + * dlls/shell32/regsvr.c, include/shlguid.h: + Steven Edwards + Register Shell Drag and Drop Helper. + + * dlls/comctl32/comctl_Sv.rc, dlls/comctl32/rsrc.rc: + Andreas Bjerkeholt + Swedish translation. + + * dlls/advapi32/security.c: Steven Edwards + Partially implement CreateProcessAsUser. + + * dlls/shell32/shfldr_unixfs.c: + Michael Jung + Implemented the UnixFolder's IShellFolder2::CompareIDs method. + + * dlls/oleaut32/oleaut32.spec, dlls/oleaut32/variant.c: + Daniel Remenak + Implemented VarIdiv. + + * dlls/gdi/enhmetafile.c, dlls/gdi/tests/metafile.c: + Robert Shearman + - Fix scaling when converting MF -> EMF. + - Tests for conversions (although not for the above bug). + +2005-04-12 Alexandre Julliard + + * dlls/shell32/folders.c, dlls/shell32/shres.rc, + dlls/shell32/shresdef.h: + Huw Davies + Better icon handling for some special folders. + Identify and add defines for a bunch of shell icons. + + * dlls/x11drv/bitblt.c, dlls/x11drv/bitmap.c, dlls/x11drv/dib.c, + dlls/x11drv/init.c, dlls/x11drv/x11drv.h, dlls/x11drv/xrender.c: + Store a pointer to the currently selected phys bitmap in the device + structure. Create a phys bitmap for the default stock bitmap too. + + * include/winnt.h: Ivan Leo Puoti + Added typedef for DEVICE_POWER_STATE. + + * dlls/shell32/shfldr_unixfs.c: + Michael Jung + Implemented enough of IShellFolder2 to make UnixFolder work within the + open/save-dialogs. + + * dlls/mshtml/Makefile.in, dlls/mshtml/htmldoc.c, dlls/mshtml/main.c, + dlls/mshtml/mshtml_private.h, dlls/mshtml/oleobj.c, + dlls/mshtml/persist.c: + Jacek Caban + Stub implementation of IOleObject and IOleDocument. + + * dlls/x11drv/bitmap.c, dlls/x11drv/dib.c, dlls/x11drv/x11drv.h: + Store the bitmap handle in the phys bitmap structure, and avoid a few + more GDI_GetObjPtr calls. + + * dlls/shell32/shlview.c: Huw Davies + If ICommDlgBrowser_OnDefaultCommand returns anything other than S_OK + then we should call the default handler. + + * dlls/comctl32/listview.c: Robert Shearman + Use ES_AUTOHSCROLL for edit box. + + * dlls/oleaut32/variant.c: Daniel Remenak + Return DISP_E_DIVBYZERO instead of crashing when asked to divide a + variant by zero. + + * dlls/shell32/shfldr_desktop.c: Juan Lang + Use Unicode string result from GetDisplayNameOf if it isn't + representable using ANSI. + + * dlls/msi/format.c: Juan Lang + Log missing environment vars for easier debugging. + + * dlls/winmm/wavemap/wavemap.c: Robert Reif + Stub out DRVM_MAPPER_RECONFIGURE support. + +2005-04-11 Alexandre Julliard + + * dlls/x11drv/bitmap.c, dlls/x11drv/brush.c, dlls/x11drv/dib.c, + dlls/x11drv/x11drv.h: + Store the pixmap depth and the DIBSECTION pointer in the phys bitmap + structure. Avoid a few GDI_GetObjPtr calls. + + * include/Makefile.in: Add new powrprof.h header. + + * dlls/quartz/memallocator.c: Robert Shearman + Return an error instead of crashing later on a divide by zero + exception when an alignment of 0 is specified. + + * dlls/ole32/stg_prop.c, dlls/ole32/tests/stg_prop.c: + Juan Lang + - add write support to IPropertyStorage, with tests + - misc. cleanups the tests turned up + + * include/shobjidl.idl: Huw Davies + Add some missing SFGAO_ defines and fix SFGAO_GHOSTED. + + * dlls/shell32/shlfolder.c, dlls/shell32/tests/shlfolder.c: + Huw Davies + Directory items should have the SFGOA_FILESYSANCESTOR attribute. + Add a test for this and cleanup the shlfolder test a bit. + + * dlls/mscms/profile.c, dlls/mscms/tests/profile.c: + Vincent Béron + Don't reference c:\windows directly. + + * tools/wine.inf: Juan Lang + Register control\class\{GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR}. + + * include/powrprof.h, include/winnt.h: + Benjamin Cutler + Added function/enum/structs for power management API. + + * dlls/mshtml/Makefile.in, dlls/mshtml/htmldoc.c, + dlls/mshtml/mshtml_private.h, dlls/mshtml/persist.c: + Jacek Caban + Stub implementation od IPersist, IPersistMoniker, IPersistFile, + IMonikerProp. + + * dlls/kernel/tests/mailslot.c, server/mailslot.c: + Mike McCormack + Calculate the size of the next mailslot message correctly. + + * dlls/wininet/internet.c, dlls/wininet/tests/http.c: + Jason Edmeades + Ensure A->W version of InternetCrackURL passes correct length values, + and associated tests. + + * dlls/msi/action.c, dlls/msi/custom.c, dlls/msi/format.c: + Steven Edwards + Avoid using ver.h in favor of winver.h. + + * programs/winetest/gui.c, programs/winetest/main.c, + programs/winetest/winetest.h: + Ferenc Wagner + Use the same maximum length for tags given on the command line and + tags entered in the GUI. + + * dlls/ole32/dictionary.c, dlls/ole32/dictionary.h, + dlls/ole32/stg_prop.c, dlls/ole32/tests/.cvsignore, + dlls/ole32/tests/Makefile.in, dlls/ole32/tests/stg_prop.c: + Juan Lang + Add traces, add unit tests for IPropertyStorage, and fix the problems + they caught. + + * dlls/wininet/internet.c: Juan Lang + - set size required correctly for all supported options + - tidy up a few lines of indenting in INET_QueryOptionHelper + - implement querying INTERNET_OPTION_PROXY + + * dlls/ddraw/dsurface/dib.c: Matthew Mastracci + Correctly lock and unlock surface for a single-surface Blt() and + BltFast() call. + + * dlls/advapi32/security.c: Hans Leidekker + Implement GetNamedSecurityInfo. + + * dlls/x11drv/dib.c: Rein Klazes + Fix X11DRV_DIB_SetImageBits_RLE(4|8) when an non-zero x-offset + (argument left) is specified. + + * dlls/opengl32/opengl_ext.c: Tom Wickline + Sync to the latest opengl specs. + + * dlls/riched20/editor.c: Hannu Valtonen + Added mousewheel support. + + * dlls/ntdll/tests/reg.c: Paul Vriens + Flags should be or-ed. + + * dlls/comctl32/tab.c: Dimitrie O. Paun + Tab unicodification. + + * dlls/comctl32/monthcal.c: Dimitrie O. Paun + MonthCal unicodification. + + * dlls/kernel/sync.c, dlls/ntdll/file.c, include/winternl.h: + Mike McCormack + Move mailslot set and query info implementation to ntdll. + + * dlls/shell32/.cvsignore, dlls/shell32/Makefile.in, + dlls/shell32/classes.c, dlls/shell32/folders.c, + dlls/shell32/iconcache.c, dlls/shell32/shell32_main.c, + dlls/shell32/shres.rc, dlls/shell32/shresdef.h: + Huw Davies + Fix the icon resource ids (most were off by one). + Fix IExtractIcon_{GetIconLocation,Extract} to use -ve icon resource + ids and fix bugs relating to confusion between resource ids and the + system imagelist indicies. + Extend the system imagelist initialization hack to load both +ve and + -ve resource ids. + Add a printer icon (that'll be used by an upcoming printer folder + patch). + + * dlls/mpr/mpr_Es.rc, dlls/msi/msi_Es.rc, dlls/shdocvw/Es.rc, + dlls/shdocvw/shdocvw.rc, dlls/wininet/wininet_Es.rc, + dlls/winmm/winmm_Es.rc: + José Manuel Ferrer Ortiz + Spanish translations updated. + + * include/ole2.h: Michael Lin + Added missing OleDraw() declaration. + + * dlls/gdi/freetype.c: Vincent Béron + Make static some functions used only in a single file. + + * dlls/dsound/primary.c: Robert Reif + Initialize primary buffer on open. + + * dlls/setupapi/devinst.c, include/cfgmgr32.h: + Juan Lang + Implement SetupDiClassNameFromGuidExA. + + * include/propidl.idl: Juan Lang + Add a few missing declarations. + + * programs/regedit/listview.c, programs/regedit/main.c, + programs/regedit/treeview.c: + Marcus Meissner + Removed inclusion of process.h (not needed and breaks with gcc4). + + * dlls/urlmon/urlmon.spec, dlls/urlmon/urlmon_main.c: + Mike McCormack + Add stub for FaultInIEFeature. + + * include/wtypes.idl: Mike McCormack + Add uCLSSPEC, CSPLATFORM and QUERYCONTEXT structures. + + * dlls/comctl32/syslink.c: Dimitrie O. Paun + Audit the code against Comctl32.dll version 6.0. + Handle notification and styles as in the other controls. + Maintain the const for strings throughout parsing. + + * include/Makefile.in: Dimitrie O. Paun + Remove reference to nonexistant strmif.h. + + * dlls/comctl32/monthcal.c: Ulrich Czekalla + Clear systemtime struct so we don't return garbage in uninitialized + fields. + + * programs/uninstaller/En.rc: Hannu Valtonen + Fix a typo in uninstaller's english appname. + + * tools/wine.inf: Hannu Valtonen + Run msi files with msiexec. + Change Control Panel\Desktop to correct case. + + * dlls/x11drv/dib.c: Glenn Wurster + Fix array index crash in buidling GDI palette from logical palette. + + * dlls/advapi32/crypt.c, dlls/advapi32/crypt.h, + dlls/advapi32/tests/crypt.c: + Michael Jung + Make crypt functions more robust in case of incorrect api usage. + + * server/window.c: Raphael Junqueira + Fix potential region leak. + + * dlls/advapi32/tests/registry.c: James Hawkins + Create the 'Test' value in a temporary subkey to avoid conflicts + between tests. + + * DEVELOPERS-HINTS: Dimitrie O. Paun + Added cryptdll/ and stdole32.tlb/. + + * dlls/dsound/tests/dsound8.c, include/dsound.h: + James Hawkins + Remove nonstandard type LPLPVOID. + + * documentation/ole.sgml: Mike Hearn + More notes about the inner workings of DCOM. + + * dlls/ddraw/d3ddevice/mesa.c, dlls/ddraw/d3dtexture.c, + dlls/ddraw/mesa_private.h: + Lionel Ulmer + Create the GL texture id at texture-binding time. + + * dlls/riched20/editor.c: Krzysztof Foltman + - EM_CANPASTE implemented + - updated TODO list (including list of (un)implemented messages) + - fixed WM_PASTE (the previous version might not close the clipboard + if it didn't contain a usable format) + - scrollbar operations (like clicking on arrows) should update + scrollbar's current position + + * include/windef.h: Vincent Béron + Fix a typo in a comment. + + * dlls/gdi/metafile.c, dlls/gdi/mfdrv/init.c: + Dimitrie O. Paun + Cleanup the API docs. Few indentation/formatting fixes. + + * dlls/winmm/tests/capture.c, dlls/winmm/tests/wave.c, + dlls/winmm/tests/winmm_test.h: + Robert Reif + Changed regression test to make sure position is correctly checked + when a different type is returned. + Added Jeremy White's WAVE_FORMAT_DIRECT/WAVE_MAPPER fix. + Added waveInGetPosition checks. + + * dlls/winmm/wavemap/wavemap.c: Robert Reif + Correctly handle where waveOutGetPosition changes timepos.wType + because the requested type is not supported. + Added Jeremy White's waveOutGetPosition fix to waveInGetPosition. + + * dlls/hhctrl.ocx/hhctrl.c: Mike Hearn + Only do unicode conversion in HTML Help control when filename is + specified. + + * dlls/msi/dialog.c, dlls/msi/msipriv.h, dlls/msi/record.c: + Mike McCormack + Load and display bitmaps in the dialogs. + + * dlls/user/tests/win.c, windows/scroll.c: + Rein Klazes + In ScrollWindowEx, if the window already has an update region then add + this to hrgnUpdate. With a conformance test. + + * programs/winetest/gui.c, programs/winetest/main.c: + Ferenc Wagner + Silence some signedness warnings. + +2005-03-31 Alexandre Julliard + + * dlls/x11drv/bitmap.c, dlls/x11drv/dib.c, dlls/x11drv/x11drv.h: + Introduced an X_PHYSBITMAP structure to allow storing more x11drv + information about a bitmap than just the pixmap id. + + * dlls/kernel/tests/file.c, dlls/user/tests/msg.c, + dlls/user/tests/win.c: + Rein Klazes + Fix some incorrect uses of the ok macro where the result depends on + the evaluation order of its arguments. + + * dlls/msvcrt/file.c, dlls/msvcrt/tests/file.c: + Hans Leidekker + Implement and test _chsize. + + * dlls/x11drv/xrender.c: + Avoid directly accessing the BITMAPOBJ structure. + + * dlls/x11drv/window.c, dlls/x11drv/x11drv.h: + Removed the no longer needed X11DRV_get_client_area_offset function. + + * dlls/x11drv/dce.c, include/wine/server_protocol.h, + server/protocol.def, server/trace.c, server/window.c: + Return the coordinates information needed to setup the DC parameters + in the get_visible_region request instead of requiring the client to + compute it again. + + * dlls/user/tests/win.c, windows/scroll.c: + Rein Klazes + If ScrollWindowEx do not use the DCX_USESTYLE to get a DC. Instead + calculate DCX_CLIPSIBLINGS, DCX_PARENTCLIP and DCX_CLIPCHILDREN. The + DCX_CLIPCHILDREN is not used when ScrollWindowEx is called with a + SW_SCROLLCHILDREN flag. With a couple of regression tests. + + * dlls/winsock/socket16.c: Rein Klazes + Fix a copy&paste bug in get_buffer_pe. + + * dlls/ole32/stg_prop.c, dlls/ole32/stg_stream.c, + dlls/ole32/storage32.c, dlls/ole32/storage32.h: + Mike McCormack + Eliminate forward declarations, make functions static. + + * programs/winetest/gui.c, programs/winetest/main.c, + programs/winetest/resource.h, programs/winetest/winetest.h, + programs/winetest/winetest.rc: + Ferenc Wagner + Ask for a tag if one was not given on the command line. + + * dlls/gdi/clipping.c, dlls/gdi/dc.c, dlls/gdi/gdi_private.h: + Added support for the DC meta region. + + * dlls/mshtml/Makefile.in, dlls/mshtml/htmldoc.c, dlls/mshtml/main.c, + dlls/mshtml/mshtml_private.h: + Jacek Caban + Stub implementation of HTMLDocument2 interface. + + * dlls/user/tests/text.c: Paul Vriens + Use textlen instead of len. + Use textheight as the return value of DrawTextA. + + * dlls/advapi32/tests/security.c: + Stefan Leichter + Fix GetFileSecurityA test on Win98. + + * dlls/winmm/winealsa/audio.c: Paul van Schayck + Don't stop looking for devices if one can't be opened. + + * dlls/winspool/info.c: Huw Davies + Set the registry keys under HCU\Software\Microsoft\Windows + NT\CurrentVersion to mimic the win.ini values. + + * dlls/shell32/debughlp.c: Mike McCormack + Fix up PIDL dumping code. + + * dlls/x11drv/keyboard.c: Aric Cyr + Japanese 106 Keyboard fix. + +2005-03-30 Alexandre Julliard + + * dlls/kernel/file.c, dlls/kernel/sync.c, dlls/kernel/tests/mailslot.c, + dlls/ntdll/file.c, include/wine/server_protocol.h, + server/Makefile.in, server/mailslot.c, server/protocol.def, + server/request.h, server/trace.c: + Mike McCormack + Implement mailslots. + + * dlls/user/menu.c, dlls/user/tests/msg.c, windows/nonclient.c, + windows/win.c: + Dmitry Timoshkov + - Make GetSystemMenu respect CS_NOCLOSE. + - EnableMenuItem should not generate WM_WINDOWPOSCHANGING message. + - Make nonclient code check for presence of SC_CLOSE, not CS_NOCLOSE + window class style. + - Add a test case. + + * dlls/advapi32/crypt.c: Michael Jung + Removed the incomplete signature checking code. + + * dlls/user/painting.c, dlls/user/tests/dce.c, dlls/x11drv/dce.c, + server/window.c, windows/nonclient.c: + The update region passed in WM_NCPAINT and the clipping region passed + to GetDCEx have to be in screen coordinates. + + * dlls/comctl32/syslink.c, dlls/gdi/palette.c, dlls/kernel/comm.c, + dlls/msi/dialog.c, dlls/ntdll/rtlstr.c, dlls/ole32/compobj.c, + dlls/ole32/tests/marshal.c, dlls/oleaut32/typelib.h, + dlls/rpcrt4/rpc_binding.c, dlls/rsaenh/mpi.c, + dlls/shell32/shfldr_unixfs.c, dlls/wininet/internet.c, + dlls/winsock/tests/sock.c, dlls/x11drv/xfont.c, + programs/regedit/regproc.c, tools/widl/typelib_struct.h: + Francois Gouget + Assorted spelling fixes. + + * include/urlmon.idl: Jacek Caban + Added IMonikerProp and IInternetPriority interfaces. + + * include/mshtmdid.h: Jacek Caban + Added some definitions. + + * dlls/kernel/computername.c: Hans Leidekker + Return a computername constructed from the hostname. + + * dlls/kernel/ne_module.c: + Better handling of 16-bit native dlls when a 32-bit builtin with the + same name exists; should help with the 16-bit cards.dll issue. + Replace some magic error numbers by the corresponding names. + + * dlls/user/painting.c, dlls/user/tests/dce.c, + dlls/user/user_private.h, dlls/x11drv/dce.c, dlls/x11drv/x11drv.spec, + include/win.h: + Only reset the clip region in GetDC() if a new region is specified. + Don't release the clip region for window DCs in ReleaseDC(), except + when called from EndPaint(). + Added a bunch of tests. + + * dlls/user/menu.c: + Uwe Bonnes + Zero out return string in GetMenuStringA/W. + + * dlls/ntdll/ntdll.spec, dlls/ntdll/sec.c: + Mike McCormack + Stub implementation of RtlAbsoluteToSelfRelativeSD. + + * dlls/dsound/tests/dsound.c, dlls/dsound/tests/dsound8.c: + Robert Reif + Keep dsound8.c and dsound.c in sync. + + * dlls/oleaut32/olepicture.c: + Alex Villacís Lasso + Initialize [orig|himetric][Width|Height] for PICTYPE_ICON case. + + * dlls/advapi32/registry.c, dlls/ntdll/reg.c: + Robert Shearman + Move save_registry and unload_key server calls to ntdll. + + * dlls/msi/action.c: Aric Stewart + Make sure the GUID of the typelib we are registering matches the guid + requested from MSI. If not search the given typelib file to find the + typelib requested to register. + +2005-03-29 Alexandre Julliard + + * programs/winetest/main.c: Ferenc Wagner + Try using a stable temporary directory at first to silence ZoneAlarm + warnings. + + * dlls/advapi32/service.c: Mike McCormack + Implement ChangeServiceConfig. + + * dlls/msacm/format.c, dlls/psapi/psapi_main.c, dlls/user/text.c, + dlls/wininet/netconnection.c: + Peter Berg Larsen + Janitorial: Get rid of strncpy/strncpyW. + + * dlls/winmm/winealsa/audio.c: + Jerry Jenkins + Improve winealsa dsound driver by accessing sound driver's buffer + directly in an undocumented way. + + * dlls/d3d8/directx.c, dlls/d3d9/cubetexture.c, + dlls/d3d9/d3d9_private.h, dlls/d3d9/device.c, dlls/d3d9/directx.c, + dlls/d3d9/texture.c, dlls/d3d9/volume.c, dlls/d3d9/volumetexture.c, + dlls/wined3d/basetexture.c, dlls/wined3d/cubetexture.c, + dlls/wined3d/device.c, dlls/wined3d/directx.c, + dlls/wined3d/drawprim.c, dlls/wined3d/indexbuffer.c, + dlls/wined3d/resource.c, dlls/wined3d/surface.c, + dlls/wined3d/texture.c, dlls/wined3d/vertexbuffer.c, + dlls/wined3d/volume.c, dlls/wined3d/volumetexture.c, + dlls/wined3d/wined3d_private.h, include/wine/wined3d_interface.h: + Oliver Stieber + - Volume now inherits Resource. This isn't the way Microsoft implements + the interface but it is more correct way (Microsoft even have a + resource type of volume). + - Moved usage, format, allocatedMemory and size onto the resource + class structure. + - Refactored Preload for classes that inherit BaseTexture, preload now + binds the texture instead of bind texture calling preload, bindTexture + allocated a glTexture if there isn't one. + - Added two new class static members BaseTexture_CleanUp and + Resource_CleanUp that should be called by classes that implement + BaseTexture or Resource. + + * dlls/user/tests/.cvsignore, dlls/user/tests/Makefile.in, + dlls/user/tests/dce.c, dlls/x11drv/dce.c: + Only restore the DC attributes on the next GetDC, and add support for + the DCX_NORESETATTRS flag. + Get rid of the DCE flags, simplify the code a bit. + Add some test cases. + + * dlls/oleaut32/olepicture.c: + Alex Villacís Lasso + Fix failure to notice the use of a GIF palette index greater or equal + to 128 for transparency. + + * programs/regedit/Cs.rc, programs/regedit/De.rc, + programs/regedit/En.rc, programs/regedit/Es.rc, + programs/regedit/Fr.rc, programs/regedit/It.rc, + programs/regedit/Ja.rc, programs/regedit/Pl.rc, + programs/regedit/Pt.rc: + Jacek Caban + Added ES_AUTOHSCROLL style to the edittext changing text data. + + * dlls/gdi/enhmetafile.c, dlls/gdi/tests/metafile.c: + Huw Davies + In a call to EnumEnhMetaFile when hdc is NULL, lpRect may be NULL. Add + a test for this. + + * dlls/ole32/storage32.c: Huw Davies + WriteFmtUserTypeStg doesn't pull a CLSID from the registry - it's + unclear when (if at all) this gets written. + + * dlls/user/kbd16.c, dlls/user/lstr.c, dlls/user/user16.c: + Moved 16-bit string functions to user16.c and kbd16.c. + + * dlls/dbghelp/dbghelp_private.h, dlls/dbghelp/elf_module.c, + dlls/dbghelp/minidump.c, dlls/dbghelp/module.c, dlls/dbghelp/path.c, + dlls/dbghelp/pe_module.c, include/dbghelp.h: + Eric Pouech + - Various improvements for minidump module information + . added timestamp & checksum in PE module + . added size & checksum in ELF module + . wine loader now appears with its pathname. + - Implemented PE & ELF timestamp & checksum validation in + SymFindFileInPath. + + * dlls/user/Makefile.in, dlls/user/uitools.c, windows/rect.c: + Moved rectangle functions to uitools.c and removed rect.c. + + * dlls/winspool/info.c: Dimitrie O. Paun + Unicodify WINSPOOL_OpenDriverReg(). + + * dlls/ole32/compobj.c: Huw Davies + Don't close reg key if the open failed. + + * dlls/oleaut32/tmarshal.c: Marcus Meissner + Serialize NULL pointer interfaces correctly. + + * dlls/user/tests/msg.c, windows/scroll.c: + Rein Klazes + ScrollWindow should call ScrollWindowEx with the SW_ERASE flag + set. With conformance test. + + * server/fd.c, server/file.c, server/file.h, server/serial.c, + server/sock.c: + Eric Pouech + Clean-up async IO internal functions. + + * dlls/advapi32/registry.c, dlls/ntdll/reg.c, include/winternl.h, + server/registry.c: + James Hawkins + - Implement NtLoadKey. + - Forward RegLoadKey to NtLoadKey. + + * dlls/user/user16.c, windows/rect.c: + Moved 16-bit rectangle functions to user16.c. + + * dlls/kernel/kernel32.spec, dlls/kernel/locale.c: + Troy Rollo + Implement SetCPGlobal (an undocumented Win32 API). + + * dlls/advapi32/tests/crypt.c: Michael Jung + Added a test for advapi32, which documents a crash in wine triggered + by incorrect api usage. + + * dlls/ole32/clipboard.c, dlls/ole32/ole2.c: + Vincent Béron + Change prototypes so gcc with some warnings doesn't bark. + + * tools/winapi/win32.api: Vincent Béron + rsabase doesn't use any types now, so remove it. + + * dlls/advapi32/security.c, dlls/advapi32/tests/security.c: + Stefan Leichter + Fix GetFileSecurityW for not existing directories/files. + + * dlls/dbghelp/msc.c, dlls/dbghelp/symbol.c: + Eric Pouech + - PDB: better checking for error conditions + - Fixed name demangling (when activated) when searching for a symbol + + * dlls/ntdll/tests/reg.c: Jacek Caban + Fixed ntdll:reg test on win9x. + + * dlls/x11drv/keyboard.c: Dmitry Timoshkov + Handle control characters in VkKeyScanEx similar to what Windows + does. + + * dlls/user/scroll.c, dlls/user/tests/win.c: + Rein Klazes + - GetScrollRange should return an empty range, both upper and lower + limit zero, if the window has no scrollbars (msdn). + - GetScrollInfo's return value is TRUE is nBar is SB_CTL or if + anything is filled in the SCROLLINFO structure, otherwise the return + value is FALSE. + + * dlls/oleaut32/tmarshal.c: Marcus Meissner + Fixed VT_BSTR|VT_BYREF marshalling. + Added VT_I4|VT_BYREF marshalling. + + * dlls/msi/Makefile.in, dlls/msi/database.c, dlls/msi/msi.c: + Mike McCormack + Split out database functions, remove dependence on wine/unicode.h. + +2005-03-28 Alexandre Julliard + + * dlls/commdlg/filedlg.c, dlls/dmband/band.c, dlls/dmcompos/chordmap.c, + dlls/dmime/audiopath.c, dlls/dmime/graph.c, dlls/dmime/segment.c, + dlls/iphlpapi/ifenum.c, dlls/iphlpapi/iphlpapi_main.c, + dlls/kernel/atom16.c, dlls/kernel/profile.c, dlls/rsaenh/rsaenh.c, + dlls/shlwapi/path.c, dlls/shlwapi/string.c, dlls/shlwapi/url.c, + dlls/wininet/cookie.c, dlls/wininet/ftp.c, dlls/wininet/http.c, + dlls/wininet/internet.c, dlls/dbghelp/dbghelp.c, + dlls/dbghelp/module.c, dlls/dbghelp/symbol.c, dlls/dsound/capture.c, + dlls/dsound/dsound_main.c, dlls/dsound/propset.c, + dlls/dswave/dswave.c, dlls/gdi/env.c, dlls/kernel/tests/process.c, + dlls/msi/action.c, dlls/msi/appsearch.c, dlls/msi/dialog.c, + dlls/msi/format.c, dlls/msvcrt/dir.c, dlls/msvideo/msvideo16.c, + dlls/opengl32/wgl.c, dlls/quartz/dsoundrender.c, + dlls/quartz/parser.c, dlls/quartz/transform.c, + dlls/quartz/videorenderer.c, dlls/quartz/waveparser.c, + dlls/setupapi/devinst.c, dlls/setupapi/setupcab.c, + dlls/tapi32/assisted.c, dlls/wineps/afm2c.c, dlls/winsock/socket.c, + programs/msiexec/msiexec.c, programs/regedit/regproc.c, + programs/winecfg/drive.c, programs/winedbg/memory.c, + programs/winemine/main.c, windows/spy.c: + Peter Berg Larsen + Janitorial: Get rid of strncpy/strncpyW. + + * dlls/x11drv/bitmap.c, dlls/x11drv/clipboard.c, dlls/x11drv/dib.c, + dlls/x11drv/x11drv.h: + Merged X11DRV_BITMAP_CreateBitmapHeaderFromPixmap into + X11DRV_DIB_CreateDIBFromPixmap and simplified the code a bit. + + * dlls/kernel/sync.c, dlls/kernel/tests/mailslot.c, dlls/ntdll/file.c, + dlls/ntdll/nt.c, include/winternl.h: + Mike McCormack + Implement CreateMailslot using NtCreateMailslotFile. + + * dlls/ole32/compositemoniker.c: Mike McCormack + Remove function prototypes, make functions static. + + * programs/wcmd/batch.c: Vincent Béron + Native wcmd.exe accepts CALLs to .exe files. + + * tools/widl/widltypes.h: Vincent Béron + Keep types sorted in alphabetical order. + + * tools/widl/parser.l, tools/widl/parser.y: + Vincent Béron + Add support for single in idl files. + + * dlls/advapi32/tests/security.c: + Stefan Leichter + Added a test for GetFileSecurityA. + + * dlls/oleaut32/tmarshal.c: Marcus Meissner + Fixed ppvObject serializer (deref twice instead of once). + Actually pass back return value of remote call in type marshaller. + + * dlls/kernel/tests/time.c: Jakob Eriksson + Remove tests that fail badly on Windows 98. + + * dlls/ntdll/tests/error.c: Saulius Krasuckas + Fix an error code for ME. + + * include/axextend.idl: Vladdy Impaler + Define the IAMStreamConfig interface. + + * configure, configure.ac: Jacek Caban + Added checking for artsc library. + +2005-03-27 Alexandre Julliard + + * dlls/x11drv/bitmap.c, dlls/x11drv/brush.c, dlls/x11drv/dib.c, + dlls/x11drv/window.c, dlls/x11drv/x11ddraw.c, dlls/x11drv/x11drv.h: + Added X11DRV_get_pixmap and X11DRV_set_pixmap functions to avoid + direct accesses to the physBitmap field of the bitmap structure. + + * dlls/ole32/bindctx.c: Mike McCormack + Remove function prototypes, make functions static. + + * dlls/oleaut32/tmarshal.c: Mike Hearn + Fix BSTR tracing in the typelib marshaller. + + * dlls/gdi/gdi_private.h, dlls/x11drv/bitmap.c, dlls/x11drv/init.c, + dlls/x11drv/x11drv.h, include/gdi.h: + Store the handle to the stock bitmap when the first DC is created to + avoid exporting the DEFAULT_BITMAP define. + + * dlls/oleaut32/tmarshal.c: Marcus Meissner + Format VT_UI1, VT_I1, VT_UI2, VT_I2 correctly. + + * dlls/ole32/datacache.c: Mike McCormack + Remove unnecessary function prototypes. + + * dlls/ole32/antimoniker.c: Mike McCormack + Remove function prototypes, make functions static. + + * dlls/x11drv/dce.c, dlls/x11drv/init.c, dlls/x11drv/x11drv.h: + Store the DCE pointer in the DC physDev structure using an x11drv GDI + escape. + + * dlls/shell32/shelllink.c: Mike McCormack + Use api definitions, remove duplicate code. + + * dlls/setupapi/stubs.c: Hans Leidekker + Remove stray 8bit character. + + * dlls/winmm/winealsa/audio.c: + Jerry Jenkins + Don't mistake frames for bytes. + + * dlls/comctl32/rebar.c: Robert Shearman + Fix size passed to SPI_NONCLIENTMETRICS. + + * dlls/oleaut32/tmarshal.c: Marcus Meissner + Added IDispatch::GetIDsOfNames() special case serializing. + Handle VT_PTR / NULL marshalling correctly. + + * windows/nonclient.c, windows/winpos.c: + Ulrich Czekalla + When computing nonclient area take into consideration that a child + windows with the WS_POPUP style can have a menu bar. + +2005-03-25 Alexandre Julliard + + * dlls/gdi/dc.c, dlls/gdi/gdi_private.h, dlls/gdi/gdiobj.c, + include/gdi.h: + Explicitly store the stack of saved DCs in the DC structure instead of + using the 16-bit hNext field in the object header. + + * dlls/gdi/clipping.c, dlls/gdi/dc.c, dlls/gdi/gdi_private.h: + Maintain the stack of saved vis regions in the DC structure instead of + storing it directly in the region objects. + + * dlls/comctl32/animate.c, dlls/comctl32/commctrl.c, + dlls/comctl32/imagelist.c, dlls/comctl32/listview.c, + dlls/comctl32/propsheet.c, dlls/comctl32/syslink.c, + dlls/comctl32/toolbar.c: + Dimitrie O. Paun + Use {Alloc,ReAlloc,Free}() instead of Heap{Alloc,ReAlloc,Free}(). + + * dlls/shell32/tests/shlfileop.c: Paul Vriens + Print retval in decimal to avoid confusion. + NT4 fails with ERROR_INVALID_TARGET_HANDLE instead of + ERROR_REDIR_PAUSED. + Use some correct messages on error. + Extra tracing. + + * dlls/user/menu.c, dlls/user/tests/win.c: + Ulrich Czekalla + Child windows with the WS_POPUP style are allowed to have a menu. + + * dlls/uuid/uuid.c, include/.cvsignore, include/Makefile.in, + include/mshtmhst.idl: + Jacek Caban + Added mshtmhst.idl. + + * programs/winetest/main.c: Ferenc Wagner + Check desktop visibility after processing command line arguments. + + * dlls/user/tests/msg.c, dlls/user/tests/win.c, dlls/x11drv/scroll.c, + windows/scroll.c: + Rein Klazes + ScrollDC and X11DRV_SCROLLDC should scroll only pixels coming from + within the visible region, clipped to the clipping region if that + exists. Add the destination of pixels coming from the outside of this + region to the update region. With tests that depend on this. + + * dlls/user/Makefile.in, dlls/user/painting.c, dlls/user/user16.c, + dlls/user/user32.spec, dlls/user/user_main.c, + dlls/user/user_private.h, dlls/x11drv/Makefile.in, dlls/x11drv/dce.c, + dlls/x11drv/window.c, dlls/x11drv/winpos.c, dlls/x11drv/x11drv.h, + dlls/x11drv/x11drv.spec, include/dce.h, include/win.h, + windows/class.c, windows/dce.c, windows/nonclient.c, windows/win.c: + Moved DCE support to the X11 driver. + + * dlls/kernel/virtual.c: Mike Hearn + Don't fault on NULL pointers in Is*Ptr functions. + + * dlls/oleaut32/tmarshal.c: Mike Hearn + Fix PARAMFLAG_FOUT typo in the tmarshaller. + + * dlls/msi/msi.c, dlls/msi/record.c: + Mike McCormack + Use strdup, implement MsiDatabaseImportA. + + * dlls/user/menu.c: Ulrich Czekalla + Don't map point to parent's client window because the rest of the code + assumes screen coordinates. + + * dlls/user/user32.spec, dlls/x11drv/window.c, include/win.h, + include/wine/server_protocol.h, server/protocol.def, + server/request.h, server/trace.c, server/window.c, windows/win.c: + Replace the link_window request by a set_parent request since that is + all link_window is used for at this point. + Get rid of the WIN_LinkWindow/UnlinkWindow functions. + + * dlls/comctl32/updown.c: Dimitrie O. Paun + Proper handling for GWL_STYLE. + Minor cleanups. + + * dlls/comctl32/toolbar.c: Dimitrie O. Paun + Fix a memory leak in toolbar. Avoid casts. + + * dlls/advapi32/tests/registry.c: James Hawkins + Replace a trace with a previously removed test. + + * dlls/comctl32/propsheet.c, dlls/comctl32/syslink.c: + Dimitrie O. Paun + Handle wParam in WM_PAINT properly: if non-null, it is the hdc we are + supposed to use to draw into. + + * dlls/comctl32/pager.c: Dimitrie O. Paun + Add Robert Shearman's explanation about WM_NCPAINT. + Move testing comments in a more appropriate place. + + * dlls/quartz/tests/filtergraph.c: Jakob Eriksson + Don't run FilterGraph tests if FilterGraph functionality is not + available. + + * dlls/kernel/tests/thread.c: Jakob Eriksson + Fix thread affinity test for SMP machines. + + * dlls/netapi32/tests/access.c: Jakob Eriksson + No need continuing tests if no NetUserGetInfo. + +2005-03-24 Alexandre Julliard + + * dlls/x11drv/init.c, dlls/x11drv/xrender.c: + Try a TrueColor visual if Xrender fails with a DirectColor one. + + * dlls/comctl32/propsheet.c, dlls/commdlg/filedlg.c, + dlls/commdlg/printdlg.c, dlls/commdlg/printdlg16.c, + dlls/d3d8/surface.c, dlls/ddraw/d3ddevice/mesa.c, + dlls/ddraw/dsurface/dib.c, dlls/dinput/device.c, + dlls/dinput/dinput_main.c, dlls/dinput/mouse.c, + dlls/dmstyle/commandtrack.c, dlls/dplayx/dplay.c, + dlls/dplayx/dplaysp.c, dlls/dplayx/dplayx_global.c, + dlls/dplayx/dplobby.c, dlls/dplayx/lobbysp.c, + dlls/dplayx/name_server.c, dlls/gdi/enhmfdrv/init.c, dlls/gdi/font.c, + dlls/gdi/gdi16.c, dlls/gdi/mfdrv/bitblt.c, dlls/gdi/mfdrv/graphics.c, + dlls/gdi/mfdrv/init.c, dlls/gdi/palette.c, dlls/gdi/path.c, + dlls/imagehlp/access.c, dlls/imm32/imm.c, dlls/iphlpapi/ifenum.c, + dlls/iphlpapi/iphlpapi_main.c, dlls/iphlpapi/ipstats.c, + dlls/kernel/comm.c, dlls/kernel/format_msg.c, dlls/kernel/heap.c, + dlls/kernel/local16.c, dlls/kernel/ne_segment.c, + dlls/kernel/resource16.c, dlls/kernel/toolhelp.c, + dlls/lzexpand/lzexpand_main.c, dlls/mapi32/util.c, dlls/mpr/wnet.c, + dlls/msacm/internal.c, dlls/mscms/profile.c, dlls/msdmo/dmoreg.c, + dlls/msi/action.c, dlls/msi/custom.c, dlls/msvcrt/process.c, + dlls/msvideo/msvideo_main.c, dlls/netapi32/nbcmdqueue.c, + dlls/netapi32/nbnamecache.c, dlls/netapi32/nbt.c, + dlls/netapi32/netbios.c, dlls/oleaut32/oleaut.c, + dlls/oleaut32/olepicture.c, dlls/oleaut32/typelib.c, + dlls/oledlg/insobjdlg.c, dlls/quartz/filtergraph.c, + dlls/riched20/editor.h, dlls/rpcrt4/rpcrt4_main.c, + dlls/rsaenh/handle.c, dlls/rsaenh/implglue.c, dlls/rsaenh/rsaenh.c, + dlls/secur32/secur32.c, dlls/setupapi/devinst.c, + dlls/setupapi/diskspace.c, dlls/shell32/shelllink.c, + dlls/shlwapi/istream.c, dlls/shlwapi/reg.c, dlls/shlwapi/regstream.c, + dlls/shlwapi/string.c, dlls/shlwapi/url.c, dlls/ttydrv/palette.c, + dlls/user/dde/misc.c, dlls/user/exticon.c, dlls/user/listbox.c, + dlls/user/lstr.c, dlls/vnbt.vxd/vnbt.c, dlls/winaspi/winaspi32.c, + dlls/wined3d/surface.c, dlls/wineps/glyphlist.c, dlls/wineps/init.c, + dlls/wineps/ps.c, dlls/wininet/internet.c, dlls/wininet/urlcache.c, + dlls/winmm/mciseq/mcimidi.c, dlls/winmm/winealsa/audio.c, + dlls/winmm/winealsa/midi.c, dlls/winmm/wineaudioio/audio.c, + dlls/winmm/wineoss/dscapture.c, dlls/winmm/wineoss/dsrender.c, + dlls/winmm/winmm.c, dlls/winsock/socket.c, dlls/x11drv/bitblt.c, + dlls/x11drv/clipboard.c, dlls/x11drv/dib.c, dlls/x11drv/palette.c, + dlls/x11drv/xdnd.c, dlls/x11drv/xfont.c, windows/winproc.c: + Jakob Eriksson + Get rid of HeapAlloc casts. + + * dlls/ttydrv/wnd.c, dlls/user/user32.spec, dlls/x11drv/event.c, + dlls/x11drv/winpos.c, windows/winpos.c: + Avoid calling WIN_ListChildren from the graphics drivers. + + * server/queue.c, windows/nonclient.c, windows/spy.c: + Added support for xbuttons. + + * dlls/user/message.c, dlls/x11drv/mouse.c, include/winuser.h: + Kevin Koltzau + Added full support for xbuttons (side mouse buttons). + + * dlls/kernel/tests/pipe.c: + Take into account the more correct behavior of recent Linux kernels. + + * dlls/msi/msi.c, dlls/msi/msiquery.c, dlls/msi/package.c, + dlls/msi/preview.c: + Mike McCormack + Replace instances of HeapAlloc/MultiByteToWideChar with the internally + defined strdupAtoW. + + * dlls/msi/action.c: Aric Stewart + If running in UI mode, then display the UI mode dialogs at the end of + the installs. + + * dlls/oleaut32/vartype.c: + Alex Villacís Lasso + After Float->string conversion via sprintfW(), VarDecFromR[4|8] is + forced to use US locale for string->Decimal conversion, to agree with + sprintfW(). + + * dlls/advapi32/tests/registry.c: Jakob Eriksson + Fix some Windows 95 issues. + + * dlls/ttydrv/wnd.c, dlls/user/menu.c, dlls/user/message.c, + dlls/user/msg16.c, dlls/user/painting.c, dlls/user/scroll.c, + dlls/x11drv/desktop.c, dlls/x11drv/winpos.c, include/win.h, + windows/class.c, windows/dce.c, windows/defdlg.c, windows/dialog.c, + windows/mdi.c, windows/nonclient.c, windows/win.c, windows/winpos.c: + Don't maintain a client-side WND structure for the desktop window. + Made WIN_GetPtr return WND_DESKTOP in that case. + + * dlls/msi/dialog.c: Mike McCormack + Make sure there's only one place we allocate dialog controls. + + * dlls/msi/registry.c: Mike McCormack + Clean up registry functions. + + * dlls/riched20/writer.c: Phil Krylov + Fixed \u keyword to output signed 16-bit values. Also fixed CP_SYMBOL + conversion and the detection of the default font's codepage. + + * dlls/wtsapi32/wtsapi32.c: Hans Leidekker + Pretend there are 0 terminal server sessions and processes. + + * dlls/ntdll/relay.c: Rein Klazes + Support relay tracing of functions with 18 arguments. + + * dlls/dinput/keyboard.c, dlls/dinput/mouse.c: + Raphael Junqueira + - use WINE_DINPUT_KEYBOARD_MAX_KEYS instead hard-coded 256 value + - better use of critical section + - some cleanup to better understand code paths + - logic correction on SetWindowsHookExA/UnhookWindowsHookEx on + keyboard. + + * tools/widl/parser.y: Jacek Caban + Added handling of unsigned type. + + * dlls/comctl32/imagelist.c: Huw Davies + The depth of the colour bitmap needs to match that of the screen. + + * dlls/comctl32/comctl32undoc.c: Dimitrie O. Paun + Complete the unicodification of comctl32undoc. + +2005-03-23 Alexandre Julliard + + * dlls/user/hook.c, dlls/user/message.c, include/win.h, windows/user.c, + windows/win.c, windows/winproc.c: + Get rid of the window lock suspend mechanism. + + * dlls/comctl32/comboex.c, dlls/comctl32/header.c, + dlls/comctl32/listview.c, dlls/comctl32/monthcal.c, + dlls/comctl32/rebar.c, dlls/comctl32/tab.c, dlls/commdlg/colordlg.c, + dlls/commdlg/colordlg16.c, dlls/commdlg/filedlg.c, + dlls/commdlg/filedlgbrowser.c, dlls/d3d8/d3d8_private.h, + dlls/d3d8/device.c, dlls/d3d9/surface.c, dlls/dbghelp/elf_module.c, + dlls/dbghelp/minidump.c, dlls/dmband/band.c, + dlls/dmstyle/styletrack.c, dlls/dplayx/dplay.c, + dlls/dplayx/dplobby.c, dlls/gdi/enhmetafile.c, dlls/kernel/instr.c, + dlls/mapi32/prop.c, dlls/mscms/profile.c, dlls/msi/appsearch.c, + dlls/msrle32/msrle32.c, dlls/ntdll/file.c, dlls/ntdll/server.c, + dlls/ole32/errorinfo.c, dlls/ole32/hglobalstream.c, + dlls/ole32/memlockbytes.c, dlls/ole32/memlockbytes16.c, + dlls/ole32/oleproxy.c, dlls/ole32/storage32.h, + dlls/oleaut32/safearray.c, dlls/oleaut32/typelib.c, + dlls/shell32/autocomplete.c, dlls/shell32/cpanelfolder.c, + dlls/shell32/memorystream.c, dlls/shell32/pidl.c, + dlls/shell32/shellfolder.h, dlls/shell32/shellole.c, + dlls/shell32/shfldr_fs.c, dlls/shell32/shfldr_mycomp.c, + dlls/shell32/shlexec.c, dlls/shell32/shlfolder.c, + dlls/shell32/shlmenu.c, dlls/shell32/shv_bg_cmenu.c, + dlls/shlwapi/ordinal.c, dlls/shlwapi/reg.c, dlls/user/edit.c, + dlls/user/tests/sysparams.c, dlls/wined3d/basetexture.c, + dlls/wined3d/device.c, dlls/wined3d/directx.c, dlls/wineps/escape.c, + dlls/wininet/http.c, dlls/winmm/winealsa/midi.c, + dlls/winmm/wineoss/midi.c, documentation/ole.sgml, + documentation/winedev-kernel.sgml, include/objbase.h, + include/winnt.h, libs/wine/loader.c, programs/winedbg/break.c, + tools/font_convert.sh, tools/wrc/newstruc.c: + Francois Gouget + Assorted spelling fixes. + + * dlls/advapi32/eventlog.c: Hans Leidekker + Pretend there are 0 log records. + Improve traces. + + * dlls/x11drv/clipboard.c: Ron Jensen + Avoid bad visual errors in thread_selection_wnd(). + + * dlls/ttydrv/wnd.c, dlls/user/user32.spec, dlls/x11drv/winpos.c: + Get rid of the remaining WIN_FindWndPtr calls. + + * dlls/advapi32/tests/registry.c: James Hawkins + Add RegSaveKey, RegLoadKey tests. + + * dlls/comctl32/treeview.c: + Jason Edmeades + Make the treeview correctly search when the top index is selected. + + * dlls/kernel/tests/pipe.c: + Alex Villacís Lasso + Test for PeekNamedPipe with zero-length buffer. + + * dlls/winmm/winealsa/audio.c: Robert Reif + Don't fail when opening a device in direct sound mode. Rather, try + alternate formats first before failing. + + * dlls/ntdll/version.c: C. Scott Ananian + Teach VERSION_GetLinkedDLLVersion about Mingw32 applications. + + * dlls/user/message.c, include/wine/server_protocol.h, + server/protocol.def, server/queue.c, server/request.h, + server/trace.c: + Create a new server request for accepting hardware messages instead of + abusing reply_message. + Allow passing the determined window for a hardware message back to the + server to have it redispatch the message to the correct thread. + + * dlls/user/tests/win.c, dlls/x11drv/window.c, windows/win.c: + Robert Shearman + - Window styles passed to CreateWindowEx must the same as passed in + CREATESTRUCT for WM_CREATE/WM_NCCREATE. + - Fix cases where WS_EX_WINDOWEDGE style is applied. + - Tests for the above. + + * dlls/msi/msi.c, dlls/msi/msi.spec: Marcus Meissner + Fixed MsiDatabaseImportA, MsiDatabaseImportW, and + MsiCreateAndVerifyInstallerDirectory stub parameter counts. + + * dlls/comctl32/treeview.c: Dimitrie O. Paun + Complete unicodification of the treeview common control. + + * dlls/comctl32/tooltips.c: Dimitrie O. Paun + Complete unicodification of the tooltips common control. + + * dlls/comctl32/toolbar.c: Dimitrie O. Paun + Complete unicodification of the toolbar common control. + Move a header comment for consistency with the other controls. + Very small alignment fixes. + + * dlls/comctl32/rebar.c: Dimitrie O. Paun + Complete unicodification of the rebar common control. + + * dlls/comctl32/propsheet.c: Dimitrie O. Paun + Complete unicodification of the propsheet common control. + + * dlls/comctl32/header.c: Dimitrie O. Paun + Complete unicodification of the header common control. + + * dlls/comctl32/flatsb.c: Dimitrie O. Paun + Complete unicodification of the flatsb common control. + + * dlls/comctl32/commctrl.c: Dimitrie O. Paun + Complete unicodification. + + * dlls/winmm/winealsa/audio.c: Jeremy White + Revamp the volume logic to be more self contained, fix a few bugs so + that the volume is correctly read, and is correctly converted to + windows style volume numbers. + +2005-03-22 Alexandre Julliard + + * dlls/user/message.c: + Simplify hardware message processing by merging the "raw" and "cooked" + processing into a single function. + + * dlls/x11drv/desktop.c, dlls/x11drv/mouse.c, dlls/x11drv/window.c, + dlls/x11drv/winpos.c: + Hans Leidekker + Fix some -Wsign-compare and -Wuninitialized warnings. + + * dlls/kernel/virtual.c: Mike Hearn + Log to +seh when an IsBad* function faults. + + * dlls/shell32/tests/shlfileop.c: Jakob Eriksson + If the device gets interrupted, we just give up. + + * dlls/dsound/tests/dsound8.c: Jakob Eriksson + Test fix. + + * windows/cursoricon.c, windows/winproc.c: + Dimitrie O. Paun + Eliminate useless HeapAlloc() casts. + + * dlls/kernel/tests/file.c: + Fetch again the file time to compare against to avoid rounding errors. + + * dlls/kernel/tests/pipe.c: Jakob Eriksson + Abort if we can't create a named pipe at all. + + * dlls/advapi32/security.c, dlls/comcat/information.c, + dlls/comctl32/comctl32undoc.c, dlls/comctl32/commctrl.c, + dlls/ole32/tests/marshal.c, dlls/shlwapi/tests/path.c, + dlls/wininet/tests/http.c: + Jakob Eriksson + Eliminate HeapAlloc casts. + + * dlls/kernel/sync.c: Alex Villacís Lasso + PeekNamedPipe now checks both for a NULL buffer and a zero-length + buffer before trying to recv() from the pipe. + + * dlls/shlwapi/tests/shreg.c: Jakob Eriksson + More trace info. + + * dlls/shell32/tests/string.c: Jakob Eriksson + StrRetToStrNAW returns ok on NT4, though it should return FALSE. + + * dlls/ole32/tests/storage32.c: Jakob Eriksson + More trace info from storage32 test. + + * dlls/ntdll/tests/env.c: Jakob Eriksson + More trace info. + + * windows/winpos.c: Ulrich Czekalla + Use GetAncestor instead of GetParent. + + * dlls/ntdll/time.c: Rustam Chernotkach + Added support for ANAT (Anadyr Standard Time) to TZ_INFO. + + * dlls/kernel/tests/environ.c: Jakob Eriksson + If the variable does not exist, just return. + + * dlls/msi/tests/record.c: Jakob Eriksson + Windows 98 doesn't like it when we delete the tempfile. + + * dlls/msi/tests/db.c: Aric Stewart + Test package creation. + + * dlls/user/tests/msg.c, windows/mdi.c: + Dmitry Timoshkov + If an MDI child becomes active restore previously maximized MDI + child. + + * dlls/kernel/tests/file.c: Jakob Eriksson + Fix patching error in file time test. + + * dlls/x11drv/keyboard.c: Dmitry Timoshkov + Add support for Serbian cyrillic X11 keyboard layout. + + * loader/preloader.c: Mike Hearn + Increase PE reserve area size to 512Mb. + + * dlls/riched20/editor.c, dlls/riched20/editstr.h, + dlls/riched20/reader.c, dlls/riched20/rtf.h, dlls/riched20/writer.c: + Phil Krylov + Made RTF reader and writer handle codepages mostly similar to the + original riched20.dll. + + * dlls/user/edit.c, dlls/user/tests/edit.c: + C. Scott Ananian + EDIT_EM_SetSel: Old/new selection range ordering code would break when + old_end < start < end < old_start. + Reset EF_UPDATE flag after we've sent the update. + + * dlls/msi/msi.rc, dlls/msi/msi_Nl.rc, dlls/shdocvw/Nl.rc, + dlls/shdocvw/shdocvw.rc: + Hans Leidekker + Dutch resource translation. + + * dlls/advapi32/tests/security.c: Jakob Eriksson + Fix for NT4 behaviour. + +2005-03-21 Alexandre Julliard + + * dlls/x11drv/mouse.c, dlls/x11drv/winpos.c, dlls/x11drv/x11ddraw.c, + dlls/x11drv/x11drv.h, dlls/x11drv/x11drv_main.c, + include/wine/server_protocol.h, server/protocol.def, + server/request.h, server/trace.c, server/window.c: + Try to always keep the server window Z-order in sync with the X11 one + using a heuristic based on mouse and expose events. + + * dlls/wininet/urlcache.c, include/wininet.h: + Troy Rollo + Implement CreateUrlCacheEntryW and CommitUrlCacheEntryW. Replace the + existing 'A' versions with calls to the 'W' versions. + + * dlls/winmm/winealsa/audio.c: Robert Reif + Fix direct sound capabilities to match hardware. + + * programs/winebrowser/main.c: Huw Davies + Fix usage printf. + + * dlls/winmm/winealsa/audio.c: Fixed a missing patch chunk. + + * dlls/comctl32/animate.c: Dimitrie O. Paun + Pull the WM_TIMER handling into its own function. + ANIMATE_DrawFrame shouldn't worry about locking, the lock should be + held by the caller. + + * dlls/ole32/clipboard.c, dlls/ole32/compobj.c, dlls/ole32/errorinfo.c, + dlls/ole32/ftmarshal.c, dlls/ole32/oleobj.c, + dlls/ole32/stg_bigblockfile.c, dlls/ole32/storage32.c, + dlls/shell32/autocomplete.c, dlls/shell32/enumidlist.c, + dlls/shell32/folders.c, dlls/shell32/shell.c, + dlls/shell32/shellole.c, dlls/shell32/shlmenu.c, + dlls/shell32/shlview.c, dlls/shell32/shv_bg_cmenu.c, + dlls/shell32/shv_item_cmenu.c: + Mike McCormack + Eliminate casts of the return value of HeapAlloc. + + * dlls/riched20/reader.c, dlls/riched20/rtf.h: + Mike McCormack + Remove casts and unused code. + + * programs/regedit/childwnd.c, programs/regedit/framewnd.c, + programs/regedit/main.h: + Robert Shearman + Always display path in status bar. + + * programs/winebrowser/main.c: Hans Leidekker + Prevent crash when no URL is specified. + + * dlls/winsock/tests/sock.c: Thomas Kho + Added tests for sendto, recvfrom, and getservbyname. + + * dlls/winmm/winealsa/audio.c: Robert Reif + Clean up handle usage. + + * dlls/x11drv/winpos.c: + Don't try to resync Z-order on ConfigureNotify events, this cannot + work right anyway. + + * dlls/avifil32/api.c, dlls/itss/itss.c, dlls/ole32/compobj.c, + dlls/twain/twain16_main.c, dlls/winmm/mmsystem.c: + Vincent Béron + Correct and complete some api documentation. + + * dlls/shlwapi/tests/path.c, dlls/shlwapi/url.c: + Troy Rollo + Corrections to UrlIsW and UrlIsA. + URL_IS_OPAQUE results depend only on the scheme, not on the URL. + URL_IS_FILEURL also only depends on the scheme ("file:"). + + * dlls/x11drv/palette.c: Glenn Wurster + Remove break statements missed in last patch. + + * tools/winapi/win16.api, tools/winapi/win32.api: + Vincent Béron + Teach winapi about types newly used in various dlls. + + * tools/winapi_check/winapi_function.pm, + tools/winapi_check/winapi_local.pm, + tools/winapi_check/winapi_parser.pm: + Vincent Béron + Teach winapi_check about other calling convention shorthands (they all + are really stdcall). + + * dlls/wined3d/wined3d.spec: + Vincent Béron + WineDirect3DCreate has 3 args in the source. + + * dlls/ntdll/loader.c, dlls/riched20/editor.c: + Vincent Béron + Use "" for Windows includes in dlls, instead of <>. + + * dlls/atl/registrar.c: Jacek Caban + Key words and replacements are case insensitive. + + * dlls/comctl32/treeview.c: Robert Shearman + iSelectedImage is allowed to be 0. + + * dlls/shlwapi/reg.c: Robert Shearman + Fix SHCopyKey to treat string parameter correctly as source path + instead of destination path. + + * dlls/advapi32/security.c, dlls/avifil32/api.c, + dlls/wininet/urlcache.c, dlls/wtsapi32/wtsapi32.c, include/aclapi.h, + include/vfw.h, include/wtsapi32.h: + Vincent Béron + Fixed some calling conventions. + + * dlls/comctl32/comboex.c: Dimitrie O. Paun + Complete unicodification. + + * dlls/comctl32/pager.c: Dimitrie O. Paun + Proper handling for GWL_STYLE. + Store and use hwndSelf in the PAGER_INFO. + Pass the infoPtr around instead of hwnd. + Use proper types in the function signatures. + Fix a few return statements. + + * dlls/ole32/storage32.c: Troy Rollo + Fix test for STGM_SHARE_EXCLUSIVE on nameless DocFiles. + + * programs/regedit/listview.c: Robert Shearman + - Add icons for the value pane. + - Display REG_MULTI_SZ values. + - Make the lack of support for certain value types more noticeable to + the user. + + * programs/regedit/edit.c: Robert Shearman + - Display an error message if any edit operation fails. + - Make key renaming fail if the destination key already exists. + - Better error recovery in the case where SHCopyKey fails. + + * dlls/ddraw/dclipper/main.c: Christian Costa + Removed wrong FIXMEs. + + * dlls/winmm/driver.c, dlls/winmm/mci.c: + Filip Navara + Specify correct buffer size in GetPrivateProfileStringW calls. + + * dlls/ntdll/file.c: Ivan Leo Puoti + Improve parameter checking in NtCreateFile. + Add documentation for ea_buffer and ea_length. + + * dlls/ddraw/dsurface/dib.c: Matthew Mastracci + If a FOURCC surface specifies DDSD_PITCH, use that instead of + dwLinearSize. + + * dlls/comctl32/animate.c: Dimitrie O. Paun + Delete the critical section when freeing up the infoPtr. + + * dlls/winmm/winealsa/audio.c: Robert Reif + Print out message name to make reading traces easier. + + * dlls/riched20/caret.c, dlls/riched20/editor.c, + dlls/riched20/editor.h, dlls/riched20/editstr.h, + dlls/riched20/paint.c: + Krzysztof Foltman + - PageUp key support. + - Support for "normal" scroll bar functionality (line and page + scrolling). + +2005-03-19 Alexandre Julliard + + * dlls/kernel/process.c, dlls/ntdll/thread.c, include/thread.h, + include/winnt.h, include/winternl.h: + Added support for the TLS expansion slots, adding an extra 1024 + entries. + + * dlls/winmm/winealsa/audio.c, dlls/winmm/winearts/audio.c, + dlls/winmm/wineaudioio/audio.c, dlls/winmm/winejack/audio.c, + dlls/winmm/winenas/audio.c: + Robert Reif + Fall back to default prepare/unprepare header functions. + + * dlls/dsound/mixer.c: Robert Reif + Fix block align error message to show length before fix up. + + * dlls/shell32/memorystream.c: Mike McCormack + Fix usage of STGM_ enumerations, remove forward declaration. + + * dlls/shell32/dataobject.c: Mike McCormack + Remove forward declarations of interface methods. + + * dlls/shell32/cpanelfolder.c, dlls/shell32/shell32_main.h: + Mike McCormack + Remove an unused function. + + * dlls/msi/suminfo.c, dlls/msi/tests/.cvsignore, + dlls/msi/tests/Makefile.in, dlls/msi/tests/suminfo.c: + Mike McCormack + - test cases for summary information + - fix memory leaks + + * configure, configure.ac: Francois Gouget + Issue a warning if no sound system was found. + + * dlls/riched20/caret.c, dlls/riched20/editor.c, + dlls/riched20/editor.h, dlls/riched20/editstr.h, + dlls/riched20/paint.c, dlls/riched20/run.c, dlls/riched20/string.c, + dlls/riched20/wrap.c: + Krzysztof Foltman + - made string operations consistent wrt whitespace handling (which + should greatly improve stability of the wrap code and eliminate + regressions of the most recent versions) + - completely new scrollbar handling (much more reliable) and related + redraw fixes + - Page Down handler (no Page Up yet, fixing wrap/redraw/scrollbar bugs + was of higher priority) + + * dlls/rpcrt4/rpc_server.c: Robert Shearman + Fix deadlock caused by not leaving the critical section on all code + paths. + + * dlls/ole32/ole2impl.c: Robert Shearman + Fix memory leak in OleDuplicateData on error path (found by Smatch). + + * dlls/kernel/locale.c: Ulrich Czekalla + GetCPInfo should return FALSE if called with NULL info buffer. + + * dlls/atl/registrar.c: Jacek Caban + Added implementation of File[Un]Register and Resource[Un]RegisterSz. + + * tools/wine.inf: Paul Millar + Bring default registry in line with implicit default behaviour by + using the --auto option with winedbg. + + * dlls/version/install.c: Jon Griffiths + Avoid a magic number. + +2005-03-18 Alexandre Julliard + + * programs/winetest/util.c, tools/winegcc/utils.c: + Fixed other instances of the xrealloc(0) bug. + + * dlls/comctl32/tests/updown.c, dlls/comctl32/updown.c: + C. Scott Ananian + UPDOWN_GetBuddyInt should not fail when the control is empty. + + * tools/winebuild/build.h, tools/winebuild/res16.c, + tools/winebuild/res32.c: + Jon Griffiths + -Wunsigned fixes. + + * tools/winebuild/utils.c: + Don't crash on xrealloc(0) (found by Jon Griffiths). + + * dlls/oleaut32/tests/vartype.c: Jacek Caban + Fixed vartype test. + + * dlls/msi/msipriv.h, dlls/msi/suminfo.c, include/msi.h, + include/msiquery.h: + Mike McCormack + Implement summary information loading and saving. + + * dlls/shlwapi/ordinal.c, dlls/shlwapi/shlwapi.spec: + Jon Griffiths + Implement @188,190,195,200,256,478,481. + IUnknown_EnableModeless() also handles IOleInPlaceActiveObject. + + * dlls/comctl32/animate.c: + Revert changes to the painting code, the WM_CTLCOLORSTATIC message + should not be sent from the animation thread. + + * dlls/winmm/winealsa/audio.c: Robert Reif + Add support for more than one sound card. + Fix wave out support when no volume control is present. + Use proper structure for wave in device caps. + + * dlls/winmm/tests/wave.c: Robert Reif + Check wave out volume support. + + * dlls/atl/atl.rgs: Jacek Caban + Fixed atl.rgs. + + * dlls/atl/registrar.c: Jacek Caban + Keys may have only one of attributes. + + * dlls/dinput/joystick_linuxinput.c: + Gerald Pfeifer + Fix compilation of the case without proper Linux joystick support. + + * dlls/riched20/editor.c, dlls/riched20/reader.c, dlls/riched20/rtf.h: + Phil Krylov + Fixed support for RTF documents using ANSI charset and added support + for multibyte charsets, so that BIG5 and UTF-8 RTF documents are + working now. + +2005-03-17 Alexandre Julliard + + * dlls/kernel/format_msg.c, dlls/kernel/tests/heap.c, + dlls/mapi32/imalloc.c, dlls/ole32/ifs.c, dlls/shell32/cpanelfolder.c, + dlls/shell32/dragdrophelper.c, dlls/shell32/shelllink.c, + dlls/shell32/shellole.c, dlls/shell32/shellord.c, + dlls/shell32/shfldr_desktop.c, dlls/shell32/shfldr_fs.c, + dlls/shell32/shfldr_mycomp.c, dlls/shlwapi/reg.c: + Jon Griffiths + Use LMEM_ flags for LocalAlloc(), not GMEM_ (GlobalAlloc). + + * server/queue.c: + Revert the previous change, this is not working right yet. + + * dlls/shell32/shlexec.c: Aric Stewart + For ShellExecuteExA we need to copy out the hProcess value from the W + structure. + + * dlls/ole32/Makefile.in, dlls/ole32/dictionary.c, + dlls/ole32/dictionary.h, dlls/ole32/stg_prop.c: + Juan Lang + Begin implementing IPropertyStorage. + + * dlls/x11drv/winpos.c, include/wine/server_protocol.h, + server/protocol.def, server/trace.c, server/window.c: + Make the server know about the visible area of a window, which is the + window rect minus the caption and borders when they are handled by the + window manager. + + * dlls/kernel/comm.c, dlls/kernel/file.c, dlls/kernel/tests/file.c, + dlls/kernel/tests/generated.c, dlls/ntdll/loader.c, + dlls/quartz/filesource.c, dlls/wininet/urlcache.c, + dlls/winsock/socket.c, include/winbase.h, include/wininet.h, + include/winnt.h: + Dmitry Timoshkov + Match OVERLAPPED structure to the SDK definition. + + * dlls/winmm/wineoss/audio.c: Robert Reif + Fall back to default header prepare and unprepare functions. + + * dlls/shell32/shlfolder.c: Mike McCormack + Remove some dead code and some ifdefs. + + * dlls/wininet/internet.c, dlls/wininet/tests/http.c: + Hans Leidekker + Add more tests and fix InternetTimeToSystemTimeW accordingly. + + * dlls/shell32/debughlp.c: Mike McCormack + Fix a regression in the file open dialog. + + * dlls/ntdll/reg.c: Ivan Leo Puoti + Add parameter checking and remove last fixme. + + * dlls/kernel/tests/time.c: Jakob Eriksson + More trace info. + + * dlls/winmm/winealsa/audio.c: Robert Reif + Use real device name. + + * dlls/ttydrv/wnd.c, dlls/x11drv/winpos.c, + include/wine/server_protocol.h, server/protocol.def, server/trace.c, + server/window.c: + Compute the top clipping window directly on the server side. + + * dlls/winsock/tests/sock.c: Jakob Eriksson + More trace info. + + * dlls/atl/Makefile.in: Mike McCormack + Fix dependencies. + + * dlls/shell32/shfldr_desktop.c: Mike McCormack + Convert path to unicode, rearrange to remove forward declaration. + + * dlls/riched20/editor.c, dlls/riched20/reader.c, dlls/riched20/rtf.h: + Phil Krylov + Replaced slow and outdated character set handling in RTF reader by + Unicode/codepages support. Added charset->codepage conversion. + + * include/winbase.h: Mike McCormack + Declare inline string function WINAPI (found by Krzysztof Foltman). + + * include/shlguid.h, include/shlobj.h: + Jon Griffiths + Add some missing interfaces. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, + dlls/ole32/marshal.c, dlls/ole32/rpc.c, dlls/ole32/stubmanager.c, + include/objbase.h: + Robert Shearman + - Add critsec debugging info. + - Move the modal loop called during RPCs into CoWaitForMultipleHandles. + - Use a mutex for long remoting calls to IRemUnknown methods. + - Remove locking in apartment_disconnectproxies as it is not needed. + - Use PostMessage instead of SendMessage so we can run the message + loop or not as appropriate. + + * dlls/winmm/lolvldrv.c, dlls/winmm/winemm.h: + Jeremy White + Do not fallback to defaults if a driver, mapper, or midi is specified + in the registry; consolidate MMDRV_Init() into a single function. + + * dlls/ole32/storage32.c, dlls/ole32/storage32.h: + Juan Lang + Add a comment about byte order, change types to reduce casting and not + cast away constness. + + * dlls/atl/atl.spec, dlls/atl/registrar.c: + Jacek Caban + Added implementation of DllCanUnloadNow. + + * dlls/riched20/caret.c, dlls/riched20/editor.c, + dlls/riched20/editor.h, dlls/riched20/paint.c, dlls/riched20/para.c, + dlls/riched20/reader.c, dlls/riched20/richole.c, dlls/riched20/rtf.h, + dlls/riched20/run.c, dlls/riched20/string.c, dlls/riched20/wrap.c: + Krzysztof Foltman + - RTF reader doesn't use RichEdit messages anymore (which saves on + unnecessary repaints) + - added unicode character support to RTF import (like: \u12345 ?) + - small fixes + - fixed whitespace identification bug + - removed drawing of paragraph marks + - improved stub implementations for IRichEditOle + +2005-03-16 Alexandre Julliard + + * dlls/riched20/writer.c: Phil Krylov + Improved RTF export. + + * include/richedit.h: Phil Krylov + Added missing PFE_ and PFA_ definitions. + + * dlls/wininet/tests/http.c: Jakob Eriksson + Test failed before on 98, NT4, 2000 and XP. + + * dlls/x11drv/keyboard.c, dlls/x11drv/mouse.c: + Don't force injected hardware messages to be queued in the current + thread. + + * server/queue.c: + Queue hardware messages even if we don't find a window for them the + first time around. + + * Make.rules.in, dlls/Maketest.rules.in, tools/.cvsignore, + tools/Makefile.in, tools/make_ctests, tools/make_ctests.c: + Converted the make_ctests script to C (based on a patch by Royce + Mitchell III). + + * server/window.c: + Converted the window children lists to standard lists. + + * dlls/atl/.cvsignore, dlls/atl/Makefile.in, dlls/atl/atl.rgs, + dlls/atl/atl_main.c, dlls/atl/registrar.c, dlls/atl/regsvr.c, + dlls/atl/rsrc.rc: + Jacek Caban + Use ATLRegistrar to register atl.dll. + + * dlls/comctl32/tests/.cvsignore, dlls/comctl32/tests/Makefile.in, + dlls/comctl32/tests/updown.c: + C. Scott Ananian + Started a unit test case for the updown control. + + * dlls/shell32/debughlp.c: Filip Navara + _dbg_ILGetNext returns NULL if pidl->mkid.cb is zero, fix the loops + accordingly. + + * dlls/riched20/editor.h: Jason Edmeades + Correct memory allocation macro. + + * include/msidefs.h, include/propidl.idl: + Mike McCormack + Add property IDs for MSI summary information. + + * dlls/kernel/tests/path.c: Jakob Eriksson + Fix broken test. + + * dlls/ddraw/tests/ddrawmodes.c: Jakob Eriksson + SetDisplayMode can return DDERR_UNSUPPORTED. If it does, we shouldn't + try to restore something either. + + * dlls/ntdll/directory.c, dlls/ntdll/file.c: + Ulrich Czekalla + Don't mark a file as readonly if it has any write bit set. + + * programs/uninstaller/main.c: + Dmitry Timoshkov + GetDlgItemTextW takes buffer length in WCHARs not bytes. + + * dlls/comctl32/animate.c: Dimitrie O. Paun + Audit the control against Comctl32.dll version 6.0. + Proper handling of GWL_STYLE. + Implement WM_CLOSE. Fix WM_SIZE implementation. + Small cleanups. + + * dlls/shlwapi/tests/clist.c: Jon Griffiths + Fix two failures and (hopefully) a crash with early versions. + + * dlls/shell32/shellpath.c: Juan Lang + Correct registering shell folders (values in Shell Folders key weren't + getting written). + + * include/shlobj.h: Mike McCormack + Add defines for SLDF flags. + + * dlls/msi/action.c, dlls/msi/action.h, dlls/msi/custom.c, + dlls/msi/dialog.c, dlls/msi/format.c, dlls/msi/msipriv.h, + dlls/msi/table.c: + Mike McCormack + - Rename dupstrW to strdupW, and remove duplicate definition. + - Move definition of string manipulation functions to msipriv.h. + + * dlls/user/tests/win.c: Dmitry Timoshkov + Actually print dwExStyle in case of a mismatch. + + * dlls/winmm/winmm.c: Robert Reif + Provide default implementation of waveInPrepareHeader and + waveInUnprepareHeader if driver doesn't support them. + + * dlls/dsound/capture.c: Robert Reif + waveInPrepareHeader and waveInUnprepareHeader are not really needed + because the contents don't change. + + * documentation/getting.sgml: Francois Gouget + Fix a link to Wine's HowTo. + + * dlls/riched20/editor.c, dlls/riched20/reader.c, dlls/riched20/rtf.h: + Krzysztof Foltman + - Unknown destinations are now correctly skipped (so loading an RTF + file generated by, for example, OpenOffice doesn't produce lots of + garbage anymore). + - Format stack for RTF groups (so that RTF reader can correctly read + what RTF writer wrote :) ) + + * dlls/wtsapi32/wtsapi32.c, dlls/wtsapi32/wtsapi32.spec, + include/wtsapi32.h: + Hans Leidekker + Stub implementations for WTSCloseServer, WTSDisconnectSession, + WTSEnumerateProcesses{A,W}, WTSEnumerateSessions{A,W}, + WTSQuerySessionInformationA. + +2005-03-15 Alexandre Julliard + + * dlls/dinput/dinput_main.c, dlls/dinput/dinput_private.h, + dlls/dinput/joystick_linux.c, dlls/dinput/joystick_linuxinput.c, + dlls/dinput/keyboard.c, dlls/dinput/mouse.c: + Build a static list of devices instead of relying on ELF + constructors. + + * dlls/kernel/tests/environ.c: Jakob Eriksson + More trace info. + + * dlls/advapi32/tests/crypt.c: Jakob Eriksson + CryptAcquireContextA() can return NTE_FAIL on Windows 98. + + * dlls/dbghelp/msc.c: Filip Navara + Initialize the "toc" field in the pdb_lookup structure in order to + prevent pdb_free_lookup from trying to delete invalid pointers. + + * dlls/dsound/propset.c: Robert Reif + Unconditionally free memory. Should make smatch happy. + + * dlls/riched20/reader.c, dlls/riched20/rtf.h: + Phil Krylov + Implemented hash table lookup for RTF keywords in RTF reader. + + * tools/winebuild/build.h, tools/winebuild/main.c, + tools/winebuild/spec32.c, tools/winebuild/utils.c: + Use the correct file name in the "generated automatically" comments. + + * dlls/riched20/editor.c, dlls/riched20/writer.c: + Krzysztof Foltman + - WM_COPY (and WM_CUT) can now put both Unicode and RTF format (thanks + to Phil Krylov's RTF generator code). + - New message implemented - WM_PASTE. + - RTF reader: rtfPlain implemented (kind of). + - RTF writer: rewritten main loop (the old one crashed in some + circumstances when SFF_SELECTION was used). + + * dlls/dsound/capture.c, dlls/dsound/dsound.c, + dlls/dsound/dsound_main.c, dlls/dsound/dsound_private.h, + dlls/dsound/mixer.c, dlls/dsound/primary.c, dlls/dsound/propset.c: + Robert Reif + Change some global variable names. + Cleanup usage of global dsound variable to not use local variable of + same name. + Almost ready to add support for more than one sound card at the same + time. + + * DEVELOPERS-HINTS: Tom Wickline + Add three missing dlls to the list. + + * dlls/comctl32/animate.c: Dimitrie O. Paun + Cleanup and simplify the painting code. + Fix a potential bug along the way. + + * dlls/winmm/wavemap/wavemap.c, dlls/winmm/mci.c: + Robert Reif + Fix memory leak in error path. + + * dlls/winmm/lolvldrv.c: Robert Reif + Fix memory leak when there are too many drivers. + + * dlls/winmm/winmm.c: Jason Edmeades + Avoid trap in mixerGetLineControlsA when cControls is uninitialized + and MIXER_GETLINECONTROLSSF_ONEBYTYPE requested. + +2005-03-14 Alexandre Julliard + + * dlls/mlang/tests/mlang.c: + Stefan Leichter + Make mlang_test.exe loadable on NT 4.0. + + * dlls/riched20/Makefile.in, dlls/riched20/editor.c, + dlls/riched20/editor.h, dlls/riched20/editstr.h, + dlls/riched20/writer.c: + Phil Krylov + Initial implementation of EM_STREAMOUT and RTF writer. + + * dlls/riched20/reader.c, dlls/riched20/rtf.h: + Phil Krylov + Added "generator" RTF destination handling. + + * include/richedit.h: Phil Krylov + Added missing PFA_JUSTIFY definition. + + * dlls/advapi32/tests/security.c: + Avoid accessing an uninitialized string in the failure case. + + * documentation/samples/config, documentation/wine.conf.man, + misc/registry.c: + Get rid of the remaining registry configuration parameters. + + * server/queue.c: + Avoid returning hardware messages if they have no chance to match the + filter. + + * dlls/advpack/advpack.c, dlls/advpack/advpack.spec: + Matthew Mastracci + Implement RegisterOCX. + Stub for DelNodeRunDLL32. + + * dlls/user/tests/msg.c, dlls/user/tests/win.c, windows/win.c: + Dmitry Timoshkov + Do not release capture before sending WM_NCDESTROY message, update the + tests to reflect that. + + * include/shlguid.h, include/shlobj.h, include/shobjidl.idl: + Mike McCormack + Move interface declarations to shobjidl.idl. + + * dlls/user/lstr.c, dlls/user/message.c: + Peter Berg Larsen + Assorted memleak fixes. Found on Michael Stefaniuc smatch list. + + * documentation/samples/config, misc/registry.c, server/registry.c: + Get rid of the registry saving level hack. + Make periodic saving the default behavior. + + * dlls/rpcrt4/rpcrt4_main.c: Ralf S. Engelschall + Fix incorrect random multicast MAC address creation. + + * dlls/ntdll/ntdll.spec: Ivan Leo Puoti + Update ntdll.spec against current Microsoft build. + + * dlls/atl/.cvsignore, dlls/atl/Makefile.in, dlls/atl/atliface.idl, + dlls/atl/registrar.c, dlls/atl/regsvr.c: + Jacek Caban + Added implementation of ATLRegistrar. + + * dlls/comctl32/treeview.c: Evan Deaubl + TREEVIEW_DoSelectItem should not do any of the TVGN_FIRSTVISIBLE work + if the newSelect parameter is NULL. + + * dlls/shell32/shell32_main.h, dlls/shell32/shfldr_desktop.c, + dlls/shell32/shlview.c, dlls/shell32/shv_bg_cmenu.c: + Martin Fuchs + - switch to correct shell desktop context menu + - launch desk.cpl when activating the desktop context menu entry + "properties" + - don't send WM_COMMAND if we didn't get a shell view window + + * programs/winedbg/dbg.y: C. Scott Ananian + Add tSTRING to the pathname production, so that you can quote a + pathname which contains 'odd' characters. + + * programs/winedbg/debug.l: C. Scott Ananian + Move definition of 'tPATH' token up, so that '/', '.' and '0xA' (etc) + are lexed as paths (in the appropriate contexts) instead of as + operator or number tokens. + Add '-' to the set of characters legal in a pathname. + + * documentation/winedev-kernel.sgml: + Eric Pouech + - reorganisation of full chapter + - rewrote the console part + - added FS documentation + + * dlls/ole32/clipboard.c: Joris Huizer + A few memory checks avoiding memory leaks. + + * dlls/wined3d/basetexture.c, dlls/wined3d/cubetexture.c, + dlls/wined3d/device.c, dlls/wined3d/surface.c, + dlls/wined3d/texture.c, dlls/wined3d/volume.c, + dlls/wined3d/volumetexture.c, dlls/wined3d/wined3d_private.h, + include/wine/wined3d_interface.h: + Oliver Stieber + Encapsulate texture, surface encapsulated. + Added BindTexture, GetTextureDimensions, UnBindTexture. + Proper GetContainer support for surface. + SetContainer added to surface and volume. + SetInPbufferState added to surface (until gl context management is + implemented). + Minor changes: + - BaseTexture no longer 'holds' a reference to IWineD3DDevice to + prevent circular referencing. + - Better managment of referinging for texture. + - Some TODO's for implementing a context manager. + - Better preload implementation. + - Fix compile warning in device.c Set/GetSamplerState. + - Add QueryInterface support for surface. + - Format X8R8G8B8 added to locking. + + * dlls/rpcrt4/ndr_midl.c, dlls/rpcrt4/rpc_binding.c, + dlls/rpcrt4/rpc_message.c, dlls/rpcrt4/rpc_server.c, + dlls/rpcrt4/rpcrt4.spec, dlls/rpcrt4/rpcrt4_main.c: + Robert Shearman + - RpcMgmtStopServerListen should not affect auto-listen interfaces. + - Implement stub for RpcRevertToSelfEx. + - Change the more verbose files to use a new debug channel, "rpc." + + * dlls/comctl32/tests/mru.c: Jon Griffiths + Comment out a test that crashes on early versions. + + * dlls/shlwapi/path.c, dlls/shlwapi/tests/path.c: + Jon Griffiths + Tests and small fix for PathMakePretty(). + Fix a crash and test failure with early native dlls. + + * dlls/comctl32/animate.c: Dimitrie O. Paun + Unicodification and typesafe interfaces. + + * dlls/oleaut32/tmarshal.c: Mike Hearn + Robert Shearman + - Implement VT_BYREF | VT_BSTR marshalling. + - Add more integer types for marshaling and unmarshaling. + - Implement VT_BYREF | VT_BSTR unmarshaling. + - Don't allocate memory for TKIND_DISPATCH/TKIND_INTERFACE + unmarshaling as it will be lost in the success case and interferes + with the failure case. + + * dlls/ntdll/reg.c: Ivan Leo Puoti + Make Rtl*Registry* functions case insensitive. + + * dlls/riched20/caret.c: Gerald Pfeifer + Make ME_ArrowLeft() return a value in every case. + + * include/npapi.h: Martin Fuchs + Fix function definitions for msvc build. + + * dlls/commdlg/printdlg.c: Juan Lang + Change a fixme to a warn, and use W version of call. + + * dlls/gdi/metafile.c: Ulrich Czekalla + If a zero index is passed to META_SELECTCLIPREGION reset the clip + region. + + * programs/winetest/main.c: Dmitry Timoshkov + Special case Win9x platforms in the desktop visibility test, in Win98 + GetUserObjectInformation is a stub returning ERROR_CALL_NOT_IMPLEMENTED. + + * dlls/netapi32/tests/wksta.c: Juan Lang + Fix a test to pass under XP. + + * dlls/user/tests/msg.c, dlls/user/tests/win.c: + Dmitry Timoshkov + Fix some msg.c and win.c failures running on NT4 and XP. + + * programs/winecfg/drive.c, programs/winecfg/driveui.c: + Steven Edwards + Porting fixes. + + * dlls/mscms/mscms.spec: Steven Edwards + Correct CheckBitmapBits entry. + + * dlls/mapi32/Makefile.in: Steven Edwards + Link mapi32 to ntdll. + + * dlls/ntdll/time.c: Alex Villacís Lasso + Add ECT to timezone list. + + * dlls/dsound/tests/propset.c: Robert Reif + Private property sets do not exist in early versions of Direct Sound + so skip tests if not supported. + Add tests for A, W and 1 variations of data. + + * dlls/dsound/propset.c: Robert Reif + Add missing functionality. + Add more and better error messages. + Add checks for failed HeapAlloc. + + * dlls/x11drv/clipboard.c, dlls/x11drv/xrender.c: + Peter Berg Larsen + Assorted memleak fixes. Found on Michael Stefaniuc smatch list. + +2005-03-11 Alexandre Julliard + + * dlls/wsock32/socket.c: Replace calloc() by HeapAlloc(). + + * include/dinput.h: Get rid of version #ifdefs. + + * dlls/ole32/storage32.c, dlls/ole32/tests/storage32.c: + Mike McCormack + StgOpenStorage shouldn't open zero length storage files. + + * programs/uninstaller/Cs.rc, programs/uninstaller/De.rc, + programs/uninstaller/Es.rc, programs/uninstaller/Fr.rc, + programs/uninstaller/It.rc, programs/uninstaller/Pt.rc, + programs/uninstaller/rsrc.rc: + Jonathan Ernst + Internationalization. + + * documentation/samples/config, misc/registry.c: + Get rid of the Windows registry loading on startup, this needs to be + done differently. + + * dlls/winsock/tests/sock.c: Thomas Kho + Added select_server() test that uses select() in serving clients. + + * dlls/wsock32/socket.c, dlls/winmm/driver.c, dlls/winmm/mmio.c, + dlls/winmm/mmsystem.c, dlls/winmm/time.c: + Peter Berg Larsen + Assorted memleak fixes. Found on Michael Stefaniuc smatch list. + + * programs/uninstaller/En.rc, programs/uninstaller/Makefile.in, + programs/uninstaller/main.c, programs/uninstaller/rsrc.rc: + Jonathan Ernst + Add search field with find-as-you-type function. + + * tools/winegcc/winegcc.c: Dimitrie O. Paun + Use -isystem for system includes as they should be processed after the + -I includes. Spotted by Boaz Harrosh. + + * dlls/d3d9/basetexture.c, dlls/d3d9/cubetexture.c, + dlls/d3d9/indexbuffer.c, dlls/d3d9/resource.c, dlls/d3d9/surface.c, + dlls/d3d9/texture.c, dlls/d3d9/vertexbuffer.c, dlls/d3d9/volume.c, + dlls/d3d9/volumetexture.c, dlls/d3d9/vshaderdeclaration.c: + Oliver Stieber + Change AddRef in queryInterface to IUnknown_AddRef. + Move ppVoulme to d3d9voloumeimpl structure. + Some minor stylistic changes (making everything the same). + + * dlls/riched20/editor.c, dlls/riched20/reader.c, dlls/riched20/run.c, + dlls/riched20/style.c, dlls/riched20/undo.c: + Krzysztof Foltman + - EM_STREAMIN can now deal with undo in a reasonable manner (no + multiple undo actions in one EM_STREAMIN). + - Related changes to undo code (umIgnore mode is now handled + correctly). + - Numerous improvements in the RTF reader: it reads some character + attributes now (you will have proper small print in license agreements + now). + - Fixed a memory overwrite bug in conversion from CHARFORMAT2A to + CHARFORMAT2W. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, + dlls/ole32/marshal.c, dlls/ole32/rpc.c, dlls/ole32/stubmanager.c: + Robert Shearman + - Rename apartment functions to become more object-oriented. + - Rename register_ifstub to marshal_object to more accurately describe + what it does. + - Add new function, apartment_getoxid, to prepare for a possible + future patch where remoting is started on demand. + + * dlls/oleaut32/tmarshal.c: Robert Shearman + Add outer unknown support for typelib marshaler. + +2005-03-10 Alexandre Julliard + + * VERSION, configure, ANNOUNCE, ChangeLog: Release 20050310. + +---------------------------------------------------------------- 2005-03-10 Alexandre Julliard * dlls/shdocvw/shdocvw_main.c: Juan Lang diff -urN wine-20050310/DEVELOPERS-HINTS wine-20050419/DEVELOPERS-HINTS --- wine-20050310/DEVELOPERS-HINTS 2004-11-30 18:23:37.000000000 +0100 +++ wine-20050419/DEVELOPERS-HINTS 2005-04-11 14:52:20.000000000 +0200 @@ -29,6 +29,7 @@ commdlg/ - Common dialog boxes (both 16 & 32 bit) crtdll/ - Old C runtime library crypt32/ - Cryptography + cryptdll/ - Cryptography Manager ctl3d/ - 3D Effects for Common GUI Components d3d8/ - Direct3D (3D graphics) d3d9/ - Direct3D (3D graphics) @@ -112,11 +113,13 @@ qcap/ - DirectShow runtime quartz/ - DirectShow runtime rasapi32/ - Remote Access Server interface + riched20/ - Rich text editing control version 2.0 richedit/ - Rich text editing control rpcrt4/ - Remote Procedure Call runtime rsabase/ - RSA encryption rsaenh/ - Crypto API that provides algorithms for DES, 3DES, and RSA among others secur32/ - Contains Windows Security functions + sensapi/ - System Event Notification Service serialui/ - Serial port property pages setupapi/ - Setup interface shdocvw/ - Shell document object and control @@ -124,6 +127,7 @@ shfolder/ - Shell folder service shlwapi/ - Shell Light-Weight interface snmpapi/ - SNMP protocol interface (networking) + stdole32.tlb/ - Standard OLE typelib sti/ - Still Image service tapi32/ - Telephone interface ttydrv/ - TTY display driver (Wine specific) @@ -169,6 +173,7 @@ wintrust/ - Trust verification interface wow32/ - WOW subsystem wsock32/ - Sockets 1.1 (networking) + wtsapi32/ - Terminal Services x11drv/ - X11 display driver (Wine specific) Winelib programs (under programs/): diff -urN wine-20050310/Make.rules.in wine-20050419/Make.rules.in --- wine-20050310/Make.rules.in 2005-03-08 17:55:26.000000000 +0100 +++ wine-20050419/Make.rules.in 2005-03-16 21:02:17.000000000 +0100 @@ -64,6 +64,7 @@ RUNTEST = $(TOPSRCDIR)/tools/runtest WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild MAKEDEP = $(TOOLSDIR)/tools/makedep +MAKECTESTS = $(TOOLSDIR)/tools/make_ctests WRC = $(TOOLSDIR)/tools/wrc/wrc BIN2RES = $(TOOLSDIR)/tools/bin2res WMC = $(TOOLSDIR)/tools/wmc/wmc diff -urN wine-20050310/VERSION wine-20050419/VERSION --- wine-20050310/VERSION 2005-03-10 21:10:33.000000000 +0100 +++ wine-20050419/VERSION 2005-04-19 14:54:44.000000000 +0200 @@ -1 +1 @@ -Wine version 20050310 +Wine version 20050419 diff -urN wine-20050310/configure wine-20050419/configure --- wine-20050310/configure 2005-03-10 21:10:33.000000000 +0100 +++ wine-20050419/configure 2005-04-19 14:54:44.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Wine 20050310. +# Generated by GNU Autoconf 2.59 for Wine 20050419. # # Report bugs to . # @@ -269,8 +269,8 @@ # Identity of this package. PACKAGE_NAME='Wine' PACKAGE_TARNAME='wine' -PACKAGE_VERSION='20050310' -PACKAGE_STRING='Wine 20050310' +PACKAGE_VERSION='20050419' +PACKAGE_STRING='Wine 20050419' PACKAGE_BUGREPORT='wine-devel@winehq.org' ac_unique_file="server/atom.c" @@ -788,7 +788,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Wine 20050310 to adapt to many kinds of systems. +\`configure' configures Wine 20050419 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -853,7 +853,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Wine 20050310:";; + short | recursive ) echo "Configuration of Wine 20050419:";; esac cat <<\_ACEOF @@ -984,7 +984,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Wine configure 20050310 +Wine configure 20050419 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -998,7 +998,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Wine $as_me 20050310, which was +It was created by Wine $as_me 20050419, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -11186,7 +11186,71 @@ ARTSC_LIBS=`$ARTSCCONFIG --libs` save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $ARTSC_CFLAGS" - cat >conftest.$ac_ext <<_ACEOF + echo "$as_me:$LINENO: checking for arts_init in -lartsc" >&5 +echo $ECHO_N "checking for arts_init in -lartsc... $ECHO_C" >&6 +if test "${ac_cv_lib_artsc_arts_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lartsc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char arts_init (); +int +main () +{ +arts_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_artsc_arts_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_artsc_arts_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_artsc_arts_init" >&5 +echo "${ECHO_T}$ac_cv_lib_artsc_arts_init" >&6 +if test $ac_cv_lib_artsc_arts_init = yes; then + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -11224,7 +11288,7 @@ (exit $ac_status); }; }; then ARTSLIBS=$ARTSC_LIBS - ARTSINCL=$ARTSC_CFLAGS + ARTSINCL=$ARTSC_CFLAGS cat >>confdefs.h <<\_ACEOF @@ -11237,6 +11301,8 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + CFLAGS="$save_CFLAGS" fi @@ -20353,7 +20419,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by Wine $as_me 20050310, which was +This file was extended by Wine $as_me 20050419, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20416,7 +20482,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Wine config.status 20050310 +Wine config.status 20050419 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -21667,6 +21733,15 @@ echo "*** enable Wine to use TrueType fonts." fi +if test -z "$ALSALIBS" -a -z "$ARTSC_LIBS" -a -z "$AUDIOIOLIBS" -a \ + -z "$ac_cv_lib_soname_jack" -a -z "$NASLIBS" -a \ + "$ac_cv_c_opensoundsystem" = "no" +then + echo "*** No sound system was found. Windows applications will be silent." + echo "*** The currently supported sound systems are:" + echo "*** ALSA, ARTS, AudioIO, Jack, NAS and OSS" +fi + echo echo "Configure finished. Do '${ac_make} depend && ${ac_make}' to compile Wine." echo diff -urN wine-20050310/configure.ac wine-20050419/configure.ac --- wine-20050310/configure.ac 2005-03-05 12:19:14.000000000 +0100 +++ wine-20050419/configure.ac 2005-03-28 11:58:45.000000000 +0200 @@ -671,10 +671,11 @@ ARTSC_LIBS=`$ARTSCCONFIG --libs` save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $ARTSC_CFLAGS" - AC_TRY_COMPILE([#include ],[arts_stream_t stream;], - [AC_SUBST(ARTSLIBS, $ARTSC_LIBS) - AC_SUBST(ARTSINCL, $ARTSC_CFLAGS) - AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])]) + AC_CHECK_LIB(artsc,arts_init, + [AC_TRY_COMPILE([#include ],[arts_stream_t stream;], + [AC_SUBST(ARTSLIBS, $ARTSC_LIBS) + AC_SUBST(ARTSINCL, $ARTSC_CFLAGS) + AC_DEFINE(HAVE_ARTS, 1, [Define if you have ARTS sound server])])],) CFLAGS="$save_CFLAGS" fi @@ -1787,6 +1788,15 @@ echo "*** enable Wine to use TrueType fonts." fi +if test -z "$ALSALIBS" -a -z "$ARTSC_LIBS" -a -z "$AUDIOIOLIBS" -a \ + -z "$ac_cv_lib_soname_jack" -a -z "$NASLIBS" -a \ + "$ac_cv_c_opensoundsystem" = "no" +then + echo "*** No sound system was found. Windows applications will be silent." + echo "*** The currently supported sound systems are:" + echo "*** ALSA, ARTS, AudioIO, Jack, NAS and OSS" +fi + echo echo "Configure finished. Do '${ac_make} depend && ${ac_make}' to compile Wine." echo diff -urN wine-20050310/dlls/Maketest.rules.in wine-20050419/dlls/Maketest.rules.in --- wine-20050310/dlls/Maketest.rules.in 2004-10-20 01:06:12.000000000 +0200 +++ wine-20050419/dlls/Maketest.rules.in 2005-03-16 21:02:17.000000000 +0100 @@ -46,8 +46,8 @@ # Rules for building test list -$(TESTLIST): Makefile.in $(TOPSRCDIR)/tools/make_ctests - $(TOPSRCDIR)/tools/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST) +$(TESTLIST): Makefile.in $(MAKECTESTS) + $(MAKECTESTS) -o $@ $(CTESTS) depend: $(TESTLIST) diff -urN wine-20050310/dlls/advapi32/crypt.c wine-20050419/dlls/advapi32/crypt.c --- wine-20050310/dlls/advapi32/crypt.c 2004-12-21 15:34:18.000000000 +0100 +++ wine-20050419/dlls/advapi32/crypt.c 2005-04-11 14:55:36.000000000 +0200 @@ -22,7 +22,6 @@ * TODO: * - Reference counting * - Thread-safing - * - Signature checking */ #include @@ -179,6 +178,7 @@ FIXME("Failed to load dll %s\n", debugstr_a(pImage)); goto error; } + provider->dwMagic = MAGIC_CRYPTPROV; provider->refcount = 1; errorcode = NTE_PROVIDER_DLL_FAIL; @@ -224,6 +224,7 @@ SetLastError(errorcode); if (provider) { + provider->dwMagic = 0; if (provider->hModule) FreeLibrary(provider->hModule); CRYPT_Free(provider->pVTable); @@ -255,7 +256,6 @@ PCRYPTPROV pProv = NULL; HKEY key; PSTR imagepath = NULL, keyname = NULL, provname = NULL, temp = NULL; - BYTE* signature; DWORD keytype, type, len; ULONG r; @@ -378,74 +378,19 @@ SetLastError(NTE_PROV_TYPE_ENTRY_BAD); goto error; } - - r = RegQueryValueExA(key, "Signature", NULL, &keytype, NULL, &len); - if ( r == ERROR_SUCCESS && keytype == REG_BINARY ) - { - if (!(signature = CRYPT_Alloc(len))) - { - RegCloseKey(key); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto error; - } - r = RegQueryValueExA(key, "Signature", NULL, NULL, signature, &len); - if ( r != ERROR_SUCCESS ) - { - TRACE("error %ld reading 'Signature'\n", r ); - CRYPT_Free(signature); - RegCloseKey(key); - SetLastError(NTE_PROV_TYPE_ENTRY_BAD); - goto error; - } - } - else - { - r = RegQueryValueExA(key, "SigInFile", NULL, &keytype, NULL, &len); - if (r != ERROR_SUCCESS) - { - TRACE("error %ld reading size of 'SigInFile'\n", r ); - RegCloseKey(key); - SetLastError(NTE_PROV_TYPE_ENTRY_BAD); - goto error; - } - else - { - /* FIXME: The presence of the SigInFile value indicates the - * provider's signature is in its resources, so need to read it. - * But since CRYPT_VerifyImage is stubbed, provide any old thing - * for now. - */ - if (!(signature = CRYPT_Alloc(1))) - { - RegCloseKey(key); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto error; - } - } - } RegCloseKey(key); len = ExpandEnvironmentStringsA(temp, NULL, 0); if ( !(imagepath = CRYPT_Alloc(len)) ) { - CRYPT_Free(signature); SetLastError(ERROR_NOT_ENOUGH_MEMORY); goto error; } if (!ExpandEnvironmentStringsA(temp, imagepath, len)) { - CRYPT_Free(signature); /* ExpandEnvironmentStrings will call SetLastError */ goto error; } - - if (!CRYPT_VerifyImage(imagepath, signature)) - { - CRYPT_Free(signature); - SetLastError(NTE_SIGNATURE_FILE_BAD); - goto error; - } pProv = CRYPT_LoadProvider(imagepath); - CRYPT_Free(signature); if (!pProv) { /* CRYPT_LoadProvider calls SetLastError */ goto error; @@ -457,9 +402,10 @@ /* MSDN: When this flag is set, the value returned in phProv is undefined, * and thus, the CryptReleaseContext function need not be called afterwards. * Therefore, we must clean up everything now. - */ + */ if (dwFlags & CRYPT_DELETEKEYSET) { + pProv->dwMagic = 0; FreeLibrary(pProv->hModule); CRYPT_Free(provname); CRYPT_Free(pProv->pFuncs); @@ -475,6 +421,7 @@ error: if (pProv) { + pProv->dwMagic = 0; if (pProv->hModule) FreeLibrary(pProv->hModule); if (pProv->pVTable) @@ -551,6 +498,12 @@ return FALSE; } + if (pProv->dwMagic != MAGIC_CRYPTPROV) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + pProv->refcount++; return TRUE; } @@ -581,10 +534,17 @@ return FALSE; } + if (pProv->dwMagic != MAGIC_CRYPTPROV) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + pProv->refcount--; if (pProv->refcount <= 0) { ret = pProv->pFuncs->pCPReleaseContext(pProv->hPrivate, dwFlags); + pProv->dwMagic = 0; FreeLibrary(pProv->hModule); #if 0 CRYPT_Free(pProv->pVTable->pContextInfo); @@ -623,6 +583,9 @@ if (!hProv) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); + if (prov->dwMagic != MAGIC_CRYPTPROV) + CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + return prov->pFuncs->pCPGenRandom(prov->hPrivate, dwLen, pbBuffer); } @@ -656,7 +619,7 @@ if (!prov) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!phHash) + if (!phHash || prov->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); if (dwFlags) CRYPT_ReturnLastError(NTE_BAD_FLAGS); @@ -705,7 +668,7 @@ TRACE("(0x%lx, 0x%lx, %d, %08lx, %p, %p)\n", hKey, hHash, Final, dwFlags, pbData, pdwDataLen); - if (!key || !pbData || !pdwDataLen) + if (!key || !pbData || !pdwDataLen || !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = key->pProvider; @@ -740,7 +703,7 @@ if (!prov || !hash) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!phKey) + if (!phKey || prov->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); if ( !(key = CRYPT_Alloc(sizeof(CRYPTKEY))) ) CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -781,6 +744,9 @@ if (!hash) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); + if (!hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV) + CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + prov = hash->pProvider; ret = prov->pFuncs->pCPDestroyHash(prov->hPrivate, hash->hPrivate); CRYPT_Free(hash); @@ -810,6 +776,9 @@ if (!key) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); + if (!key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) + CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + prov = key->pProvider; ret = prov->pFuncs->pCPDestroyKey(prov->hPrivate, key->hPrivate); CRYPT_Free(key); @@ -840,8 +809,11 @@ TRACE("(0x%lx, %p, %08ld, %p)\n", hHash, pdwReserved, dwFlags, phHash); orghash = (PCRYPTHASH)hHash; - if (!orghash || pdwReserved || !phHash) + if (!orghash || pdwReserved || !phHash || !orghash->pProvider || + orghash->pProvider->dwMagic != MAGIC_CRYPTPROV) + { CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + } prov = orghash->pProvider; if (!prov->pFuncs->pCPDuplicateHash) @@ -883,8 +855,11 @@ TRACE("(0x%lx, %p, %08ld, %p)\n", hKey, pdwReserved, dwFlags, phKey); orgkey = (PCRYPTKEY)hKey; - if (!orgkey || pdwReserved || !phKey) + if (!orgkey || pdwReserved || !phKey || !orgkey->pProvider || + orgkey->pProvider->dwMagic != MAGIC_CRYPTPROV) + { CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + } prov = orgkey->pProvider; if (!prov->pFuncs->pCPDuplicateKey) @@ -935,7 +910,7 @@ TRACE("(0x%lx, 0x%lx, %d, %08ld, %p, %p, %ld)\n", hKey, hHash, Final, dwFlags, pbData, pdwDataLen, dwBufLen); - if (!key || !pdwDataLen) + if (!key || !pdwDataLen || !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = key->pProvider; @@ -1177,7 +1152,7 @@ TRACE("(0x%lx, 0x%lx, %ld, %08ld, %p, %p)\n", hKey, hExpKey, dwBlobType, dwFlags, pbData, pdwDataLen); - if (!key || !pdwDataLen) + if (!key || !pdwDataLen || !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = key->pProvider; @@ -1209,7 +1184,7 @@ if (!prov) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!phKey) + if (!phKey || !prov || prov->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); if ( !(key = CRYPT_Alloc(sizeof(CRYPTKEY))) ) CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -1338,7 +1313,7 @@ TRACE("(0x%lx, %ld, %p, %p, %08ld)\n", hHash, dwParam, pbData, pdwDataLen, dwFlags); - if (!hash || !pdwDataLen) + if (!hash || !pdwDataLen || !hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = hash->pProvider; @@ -1373,7 +1348,7 @@ TRACE("(0x%lx, %ld, %p, %p, %08ld)\n", hKey, dwParam, pbData, pdwDataLen, dwFlags); - if (!key || !pdwDataLen) + if (!key || !pdwDataLen || !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = key->pProvider; @@ -1407,6 +1382,9 @@ TRACE("(0x%lx, %ld, %p, %p, %08ld)\n", hProv, dwParam, pbData, pdwDataLen, dwFlags); + if (!prov || prov->dwMagic != MAGIC_CRYPTPROV) + CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + return prov->pFuncs->pCPGetProvParam(prov->hPrivate, dwParam, pbData, pdwDataLen, dwFlags); } @@ -1433,7 +1411,7 @@ if (!prov) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!phUserKey) + if (!phUserKey || prov->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); if ( !(key = CRYPT_Alloc(sizeof(CRYPTKEY))) ) CRYPT_ReturnLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -1476,7 +1454,7 @@ if (!hash) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!pbData || !dwDataLen) + if (!pbData || !dwDataLen || !hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = hash->pProvider; @@ -1506,6 +1484,9 @@ if (!hash || !key) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); + if (!hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV) + CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); + prov = hash->pProvider; return prov->pFuncs->pCPHashSessionKey(prov->hPrivate, hash->hPrivate, key->hPrivate, dwFlags); } @@ -1533,7 +1514,7 @@ TRACE("(0x%lx, %p, %ld, 0x%lx, %08ld, %p)\n", hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey); - if (!prov || !pbData || !dwDataLen || !phKey) + if (!prov || !pbData || !dwDataLen || !phKey || prov->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); if ( !(importkey = CRYPT_Alloc(sizeof(CRYPTKEY))) ) @@ -1584,7 +1565,7 @@ if (!hash) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!pdwSigLen) + if (!pdwSigLen || !hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = hash->pProvider; @@ -1635,7 +1616,7 @@ TRACE("(0x%lx, %ld, %p, %08ld)\n", hHash, dwParam, pbData, dwFlags); - if (!hash || !pbData) + if (!hash || !pbData || !hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = hash->pProvider; @@ -1665,7 +1646,7 @@ TRACE("(0x%lx, %ld, %p, %08ld)\n", hKey, dwParam, pbData, dwFlags); - if (!key || !pbData) + if (!key || !pbData || !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = key->pProvider; @@ -1820,6 +1801,8 @@ if (!prov) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); + if (prov->dwMagic != MAGIC_CRYPTPROV) + CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); if (dwFlags & PP_USE_HARDWARE_RNG) { FIXME("PP_USE_HARDWARE_RNG: What do I do with this?\n"); @@ -1875,9 +1858,13 @@ if (!hash || !key) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); - if (!pbSignature || !dwSigLen) + if (!pbSignature || !dwSigLen || + !hash->pProvider || hash->pProvider->dwMagic != MAGIC_CRYPTPROV || + !key->pProvider || key->pProvider->dwMagic != MAGIC_CRYPTPROV) + { CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); - + } + prov = hash->pProvider; return prov->pFuncs->pCPVerifySignature(prov->hPrivate, hash->hPrivate, pbSignature, dwSigLen, key->hPrivate, sDescription, dwFlags); diff -urN wine-20050310/dlls/advapi32/crypt.h wine-20050419/dlls/advapi32/crypt.h --- wine-20050310/dlls/advapi32/crypt.h 2004-10-04 22:42:05.000000000 +0200 +++ wine-20050419/dlls/advapi32/crypt.h 2005-04-11 14:55:36.000000000 +0200 @@ -56,8 +56,11 @@ BOOL (WINAPI *pCPVerifySignature)(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags); } PROVFUNCS, *PPROVFUNCS; +#define MAGIC_CRYPTPROV 0xA39E741F + typedef struct tagCRYPTPROV { + DWORD dwMagic; UINT refcount; HMODULE hModule; PPROVFUNCS pFuncs; diff -urN wine-20050310/dlls/advapi32/eventlog.c wine-20050419/dlls/advapi32/eventlog.c --- wine-20050310/dlls/advapi32/eventlog.c 2005-01-03 15:56:42.000000000 +0100 +++ wine-20050419/dlls/advapi32/eventlog.c 2005-03-23 14:09:27.000000000 +0100 @@ -49,7 +49,7 @@ */ BOOL WINAPI BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ) { - FIXME("stub\n"); + FIXME("(%p,%s) stub\n", hEventLog, debugstr_a(lpBackupFileName)); return TRUE; } @@ -58,10 +58,9 @@ * * see BackupEventLogA */ -BOOL WINAPI -BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) +BOOL WINAPI BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) { - FIXME("stub\n"); + FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName)); return TRUE; } @@ -80,9 +79,9 @@ * Failure: zero. Fails if the event log is empty or if lpBackupFileName * exists. */ -BOOL WINAPI ClearEventLogA ( HANDLE hEventLog, LPCSTR lpBackupFileName ) +BOOL WINAPI ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ) { - FIXME("stub\n"); + FIXME("(%p,%s) stub\n", hEventLog, debugstr_a(lpBackupFileName)); return TRUE; } @@ -91,9 +90,9 @@ * * see ClearEventLogA */ -BOOL WINAPI ClearEventLogW ( HANDLE hEventLog, LPCWSTR lpBackupFileName ) +BOOL WINAPI ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) { - FIXME("stub\n"); + FIXME("(%p,%s) stub\n", hEventLog, debugstr_w(lpBackupFileName)); return TRUE; } @@ -109,9 +108,9 @@ * Success: nonzero * Failure: zero */ -BOOL WINAPI CloseEventLog ( HANDLE hEventLog ) +BOOL WINAPI CloseEventLog( HANDLE hEventLog ) { - FIXME("stub\n"); + FIXME("(%p) stub\n", hEventLog); return TRUE; } @@ -129,7 +128,7 @@ */ BOOL WINAPI DeregisterEventSource( HANDLE hEventLog ) { - FIXME("(%p): stub\n",hEventLog); + FIXME("(%p) stub\n", hEventLog); return TRUE; } @@ -147,11 +146,14 @@ * the log. * Failure: zero */ -BOOL WINAPI -GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords ) +BOOL WINAPI GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords ) { - FIXME("stub\n"); - return TRUE; + FIXME("(%p,%p) stub\n", hEventLog, NumberOfRecords); + + if (!NumberOfRecords) return FALSE; + *NumberOfRecords = 0; + + return TRUE; } /****************************************************************************** @@ -168,11 +170,14 @@ * record in the log. * Failure: zero */ -BOOL WINAPI -GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ) +BOOL WINAPI GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ) { - FIXME(":stub\n"); - return TRUE; + FIXME("(%p,%p) stub\n", hEventLog, OldestRecord); + + if (!OldestRecord) return FALSE; + *OldestRecord = 0; + + return TRUE; } /****************************************************************************** @@ -191,7 +196,7 @@ */ BOOL WINAPI NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent ) { - FIXME("stub\n"); + FIXME("(%p,%p) stub\n", hEventLog, hEvent); return TRUE; } @@ -209,11 +214,10 @@ * Success: Handle to the backup event log. * Failure: NULL */ -HANDLE WINAPI -OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName ) +HANDLE WINAPI OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName ) { - FIXME("stub\n"); - return (HANDLE)1; + FIXME("(%s,%s) stub\n", debugstr_a(lpUNCServerName), debugstr_a(lpFileName)); + return (HANDLE)0xcafe4242; } /****************************************************************************** @@ -221,11 +225,10 @@ * * see OpenBackupEventLogA */ -HANDLE WINAPI -OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ) +HANDLE WINAPI OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ) { - FIXME("stub\n"); - return (HANDLE)1; + FIXME("(%s,%s) stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpFileName)); + return (HANDLE)0xcafe4242; } /****************************************************************************** @@ -242,9 +245,9 @@ * Success: Handle to an event log. * Failure: NULL */ -HANDLE WINAPI OpenEventLogA(LPCSTR uncname,LPCSTR source) +HANDLE WINAPI OpenEventLogA( LPCSTR uncname, LPCSTR source ) { - FIXME("(%s,%s),stub!\n",uncname,source); + FIXME("(%s,%s) stub\n", debugstr_a(uncname), debugstr_a(source)); return (HANDLE)0xcafe4242; } @@ -253,11 +256,10 @@ * * see OpenEventLogA */ -HANDLE WINAPI -OpenEventLogW( LPCWSTR uncname, LPCWSTR source ) +HANDLE WINAPI OpenEventLogW( LPCWSTR uncname, LPCWSTR source ) { - FIXME("stub\n"); - return (HANDLE)1; + FIXME("(%s,%s) stub\n", debugstr_w(uncname), debugstr_w(source)); + return (HANDLE)0xcafe4242; } /****************************************************************************** @@ -282,8 +284,9 @@ BOOL WINAPI ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded ) { - FIXME("stub\n"); - return TRUE; + FIXME("(%p,0x%08lx,0x%08lx,%p,0x%08lx,%p,%p) stub\n", hEventLog, dwReadFlags, + dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded); + return FALSE; } /****************************************************************************** @@ -291,13 +294,12 @@ * * see ReadEventLogA */ -BOOL WINAPI -ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, - LPVOID lpBuffer, DWORD nNumberOfBytesToRead, - DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded ) +BOOL WINAPI ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, + LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD *pnBytesRead, DWORD *pnMinNumberOfBytesNeeded ) { - FIXME("stub\n"); - return TRUE; + FIXME("(%p,0x%08lx,0x%08lx,%p,0x%08lx,%p,%p) stub\n", hEventLog, dwReadFlags, + dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded); + return FALSE; } /****************************************************************************** @@ -316,10 +318,12 @@ */ HANDLE WINAPI RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ) { - UNICODE_STRING lpUNCServerNameW; UNICODE_STRING lpSourceNameW; HANDLE ret; + + FIXME("(%s,%s): stub\n", debugstr_a(lpUNCServerName), debugstr_a(lpSourceName)); + RtlCreateUnicodeStringFromAsciiz(&lpUNCServerNameW, lpUNCServerName); RtlCreateUnicodeStringFromAsciiz(&lpSourceNameW, lpSourceName); ret = RegisterEventSourceW(lpUNCServerNameW.Buffer,lpSourceNameW.Buffer); @@ -333,12 +337,10 @@ * * see RegisterEventSourceA */ -HANDLE WINAPI -RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) +HANDLE WINAPI RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) { - FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName), - debugstr_w(lpSourceName)); - return (HANDLE)1; + FIXME("(%s,%s): stub\n", debugstr_w(lpUNCServerName), debugstr_w(lpSourceName)); + return (HANDLE)0xcafe4242; } /****************************************************************************** @@ -374,6 +376,9 @@ int i; BOOL ret; + FIXME("(%p,0x%04x,0x%04x,0x%08lx,%p,0x%04x,0x%08lx,%p,%p): stub\n", hEventLog, + wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData); + if (wNumStrings == 0) return TRUE; if (!lpStrings) return TRUE; @@ -398,13 +403,14 @@ * * see ReportEventA */ -BOOL WINAPI -ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, - DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, - DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData ) +BOOL WINAPI ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, + PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR *lpStrings, LPVOID lpRawData ) { int i; + FIXME("(%p,0x%04x,0x%04x,0x%08lx,%p,0x%04x,0x%08lx,%p,%p): stub\n", hEventLog, + wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData); + /* partial stub */ if (wNumStrings == 0) return TRUE; @@ -429,5 +435,4 @@ } } return TRUE; - } diff -urN wine-20050310/dlls/advapi32/registry.c wine-20050419/dlls/advapi32/registry.c --- wine-20050310/dlls/advapi32/registry.c 2005-02-25 17:52:10.000000000 +0100 +++ wine-20050419/dlls/advapi32/registry.c 2005-04-16 12:49:10.000000000 +0200 @@ -871,9 +871,11 @@ DWORD ret; HKEY tmp; + if (!name) return ERROR_INVALID_PARAMETER; + if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; - if (!name || !*name) + if (!*name) { ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) ); } @@ -905,9 +907,11 @@ DWORD ret; HKEY tmp; + if (!name) return ERROR_INVALID_PARAMETER; + if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; - if (!name || !*name) + if (!*name) { ret = RtlNtStatusToDosError( NtDeleteKey( hkey ) ); } @@ -1588,42 +1592,28 @@ */ LONG WINAPI RegLoadKeyW( HKEY hkey, LPCWSTR subkey, LPCWSTR filename ) { - HANDLE file; - DWORD ret, len, err = GetLastError(); - HKEY shkey; - - TRACE( "(%p,%s,%s)\n", hkey, debugstr_w(subkey), debugstr_w(filename) ); - - if (!filename || !*filename) return ERROR_INVALID_PARAMETER; - if (!subkey || !*subkey) return ERROR_INVALID_PARAMETER; - if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; + OBJECT_ATTRIBUTES destkey, file; + UNICODE_STRING subkeyW, filenameW; - len = strlenW( subkey ) * sizeof(WCHAR); - if (len > MAX_PATH*sizeof(WCHAR)) return ERROR_INVALID_PARAMETER; + if (!(hkey = get_special_root_hkey(hkey))) return ERROR_INVALID_HANDLE; - if ((file = CreateFileW( filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0 )) == INVALID_HANDLE_VALUE) - { - ret = GetLastError(); - goto done; - } - - RegCreateKeyW(hkey,subkey,&shkey); - - SERVER_START_REQ( load_registry ) - { - req->hkey = shkey; - req->file = file; - wine_server_add_data( req, subkey, len ); - ret = RtlNtStatusToDosError( wine_server_call(req) ); - } - SERVER_END_REQ; - CloseHandle( file ); - RegCloseKey(shkey); + destkey.Length = sizeof(destkey); + destkey.RootDirectory = hkey; /* root key: HKLM or HKU */ + destkey.ObjectName = &subkeyW; /* name of the key */ + destkey.Attributes = 0; + destkey.SecurityDescriptor = NULL; + destkey.SecurityQualityOfService = NULL; + RtlInitUnicodeString(&subkeyW, subkey); + + file.Length = sizeof(file); + file.RootDirectory = NULL; + file.ObjectName = &filenameW; /* file containing the hive */ + file.Attributes = OBJ_CASE_INSENSITIVE; + file.SecurityDescriptor = NULL; + file.SecurityQualityOfService = NULL; + RtlDosPathNameToNtPathName_U(filename, &filenameW, NULL, NULL); - done: - SetLastError( err ); /* restore the last error code */ - return ret; + return RtlNtStatusToDosError( NtLoadKey(&destkey, &file) ); } @@ -1634,43 +1624,20 @@ */ LONG WINAPI RegLoadKeyA( HKEY hkey, LPCSTR subkey, LPCSTR filename ) { - WCHAR buffer[MAX_PATH]; - HANDLE file; - DWORD ret, len, err = GetLastError(); - HKEY shkey; - - TRACE( "(%p,%s,%s)\n", hkey, debugstr_a(subkey), debugstr_a(filename) ); - - if (!filename || !*filename) return ERROR_INVALID_PARAMETER; - if (!subkey || !*subkey) return ERROR_INVALID_PARAMETER; - if (!(hkey = get_special_root_hkey( hkey ))) return ERROR_INVALID_HANDLE; - - if (!(len = MultiByteToWideChar( CP_ACP, 0, subkey, strlen(subkey), buffer, MAX_PATH ))) - return ERROR_INVALID_PARAMETER; + UNICODE_STRING subkeyW, filenameW; + STRING subkeyA, filenameA; + NTSTATUS status; - if ((file = CreateFileA( filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0 )) == INVALID_HANDLE_VALUE) - { - ret = GetLastError(); - goto done; - } + RtlInitAnsiString(&subkeyA, subkey); + RtlInitAnsiString(&filenameA, filename); - RegCreateKeyA(hkey,subkey,&shkey); + if ((status = RtlAnsiStringToUnicodeString(&subkeyW, &subkeyA, TRUE))) + return RtlNtStatusToDosError(status); - SERVER_START_REQ( load_registry ) - { - req->hkey = shkey; - req->file = file; - wine_server_add_data( req, buffer, len * sizeof(WCHAR) ); - ret = RtlNtStatusToDosError( wine_server_call(req) ); - } - SERVER_END_REQ; - CloseHandle( file ); - RegCloseKey(shkey); + if ((status = RtlAnsiStringToUnicodeString(&filenameW, &filenameA, TRUE))) + return RtlNtStatusToDosError(status); - done: - SetLastError( err ); /* restore the last error code */ - return ret; + return RegLoadKeyW(hkey, subkeyW.Buffer, filenameW.Buffer); } @@ -1717,13 +1684,7 @@ MESSAGE("Wow, we are already fiddling with a temp file %s with an ordinal as high as %d !\nYou might want to delete all corresponding temp files in that directory.\n", debugstr_w(buffer), count); } - SERVER_START_REQ( save_registry ) - { - req->hkey = hkey; - req->file = handle; - ret = RtlNtStatusToDosError( wine_server_call( req ) ); - } - SERVER_END_REQ; + ret = RtlNtStatusToDosError(NtSaveKey(hkey, handle)); CloseHandle( handle ); if (!ret) @@ -1828,12 +1789,8 @@ if( ret ) return ERROR_INVALID_PARAMETER; - SERVER_START_REQ( unload_registry ) - { - req->hkey = shkey; - ret = RtlNtStatusToDosError( wine_server_call(req) ); - } - SERVER_END_REQ; + ret = RtlNtStatusToDosError(NtUnloadKey(shkey)); + RegCloseKey(shkey); return ret; diff -urN wine-20050310/dlls/advapi32/security.c wine-20050419/dlls/advapi32/security.c --- wine-20050310/dlls/advapi32/security.c 2005-03-07 12:00:24.000000000 +0100 +++ wine-20050419/dlls/advapi32/security.c 2005-04-13 13:02:59.000000000 +0200 @@ -1323,6 +1323,9 @@ DWORD iLocNow; SECURITY_DESCRIPTOR_RELATIVE *pSDRelative; + if(INVALID_FILE_ATTRIBUTES == GetFileAttributesW(lpFileName)) + return FALSE; + FIXME("(%s) : returns fake SECURITY_DESCRIPTOR\n", debugstr_w(lpFileName) ); nNeeded = sizeof(SECURITY_DESCRIPTOR_RELATIVE); @@ -2360,7 +2363,7 @@ { FIXME("%s %d %ld %p %p %p %p\n", debugstr_w(pObjectName), ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl); - return ERROR_CALL_NOT_IMPLEMENTED; + return ERROR_SUCCESS; } /****************************************************************************** @@ -2800,7 +2803,7 @@ LPWSTR StringSecurityDescriptorW; len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0); - StringSecurityDescriptorW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + StringSecurityDescriptorW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (StringSecurityDescriptorW) { @@ -2909,7 +2912,7 @@ else { UINT len = MultiByteToWideChar(CP_ACP, 0, StringSid, -1, NULL, 0); - LPWSTR wStringSid = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, + LPWSTR wStringSid = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, StringSid, -1, wStringSid, len); @@ -3044,11 +3047,27 @@ LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) { - FIXME("%p %s %s %p %p %d 0x%08lx %p %s %p %p - stub\n", hToken, debugstr_w(lpApplicationName), - debugstr_w(lpCommandLine), lpProcessAttributes, lpThreadAttributes, bInheritHandles, - dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory), lpStartupInfo, lpProcessInformation); + FIXME("%p %s %s %p %p %d 0x%08lx %p %s %p %p - semi- stub\n", hToken, + debugstr_w(lpApplicationName), debugstr_w(lpCommandLine), lpProcessAttributes, + lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, + debugstr_w(lpCurrentDirectory), lpStartupInfo, lpProcessInformation); + + /* We should create the process with a suspended main thread */ + if (!CreateProcessW (lpApplicationName, + lpCommandLine, + lpProcessAttributes, + lpThreadAttributes, + bInheritHandles, + dwCreationFlags, /* CREATE_SUSPENDED */ + lpEnvironment, + lpCurrentDirectory, + lpStartupInfo, + lpProcessInformation)) + { + return FALSE; + } - return FALSE; + return TRUE; } /****************************************************************************** @@ -3271,14 +3290,72 @@ /****************************************************************************** * GetNamedSecurityInfoW [ADVAPI32.@] */ -DWORD WINAPI GetNamedSecurityInfoW(LPWSTR pObjectName, - SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, - PSID* ppsidOwner, PSID* ppsidGroup, PACL* ppDacl, PACL* ppSacl, - PSECURITY_DESCRIPTOR* ppSecurityDescriptor) +DWORD WINAPI GetNamedSecurityInfoW( LPWSTR name, SE_OBJECT_TYPE type, + SECURITY_INFORMATION info, PSID* owner, PSID* group, PACL* dacl, + PACL* sacl, PSECURITY_DESCRIPTOR* descriptor ) { - FIXME("%s %d %ld %p %p %p %p %p\n", debugstr_w(pObjectName), ObjectType, SecurityInfo, - ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor); - return ERROR_CALL_NOT_IMPLEMENTED; + DWORD needed, offset; + SECURITY_DESCRIPTOR_RELATIVE *relative; + BYTE *buffer; + + TRACE( "%s %d %ld %p %p %p %p %p\n", debugstr_w(name), type, info, owner, + group, dacl, sacl, descriptor ); + + if (!name || !descriptor) return ERROR_INVALID_PARAMETER; + + needed = sizeof(SECURITY_DESCRIPTOR_RELATIVE); + if (info & OWNER_SECURITY_INFORMATION) + needed += sizeof(sidWorld); + if (info & GROUP_SECURITY_INFORMATION) + needed += sizeof(sidWorld); + if (info & DACL_SECURITY_INFORMATION) + needed += WINE_SIZE_OF_WORLD_ACCESS_ACL; + if (info & SACL_SECURITY_INFORMATION) + needed += WINE_SIZE_OF_WORLD_ACCESS_ACL; + + /* must be freed by caller */ + *descriptor = HeapAlloc( GetProcessHeap(), 0, needed ); + if (!*descriptor) return ERROR_NOT_ENOUGH_MEMORY; + + if (!InitializeSecurityDescriptor( *descriptor, SECURITY_DESCRIPTOR_REVISION )) + { + HeapFree( GetProcessHeap(), 0, *descriptor ); + return ERROR_INVALID_SECURITY_DESCR; + } + + relative = (SECURITY_DESCRIPTOR_RELATIVE *)*descriptor; + relative->Control |= SE_SELF_RELATIVE; + buffer = (BYTE *)relative; + offset = sizeof(SECURITY_DESCRIPTOR_RELATIVE); + + if (owner && (info & OWNER_SECURITY_INFORMATION)) + { + memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) ); + relative->Owner = offset; + *owner = buffer + offset; + offset += sizeof(sidWorld); + } + if (group && (info & GROUP_SECURITY_INFORMATION)) + { + memcpy( buffer + offset, &sidWorld, sizeof(sidWorld) ); + relative->Group = offset; + *group = buffer + offset; + offset += sizeof(sidWorld); + } + if (dacl && (info & DACL_SECURITY_INFORMATION)) + { + GetWorldAccessACL( (PACL)(buffer + offset) ); + relative->Dacl = offset; + *dacl = (PACL)(buffer + offset); + offset += WINE_SIZE_OF_WORLD_ACCESS_ACL; + } + if (sacl && (info & SACL_SECURITY_INFORMATION)) + { + GetWorldAccessACL( (PACL)(buffer + offset) ); + relative->Sacl = offset; + *sacl = (PACL)(buffer + offset); + } + return ERROR_SUCCESS; } /****************************************************************************** @@ -3320,7 +3397,7 @@ /****************************************************************************** * SetSecurityInfo [ADVAPI32.@] */ -DWORD SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType, +DWORD WINAPI SetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID psidOwner, PSID psidGroup, PACL pDacl, PACL pSacl) { FIXME("stub\n"); diff -urN wine-20050310/dlls/advapi32/service.c wine-20050419/dlls/advapi32/service.c --- wine-20050310/dlls/advapi32/service.c 2005-03-10 12:14:04.000000000 +0100 +++ wine-20050419/dlls/advapi32/service.c 2005-04-19 12:24:22.000000000 +0200 @@ -209,6 +209,80 @@ HeapFree( GetProcessHeap(), 0, wstr ); } +/****************************************************************************** + * registry access functions and data + */ +static const WCHAR szDisplayName[] = { + 'D','i','s','p','l','a','y','N','a','m','e', 0 }; +static const WCHAR szType[] = {'T','y','p','e',0}; +static const WCHAR szStart[] = {'S','t','a','r','t',0}; +static const WCHAR szError[] = { + 'E','r','r','o','r','C','o','n','t','r','o','l', 0}; +static const WCHAR szImagePath[] = {'I','m','a','g','e','P','a','t','h',0}; +static const WCHAR szGroup[] = {'G','r','o','u','p',0}; +static const WCHAR szDependencies[] = { + 'D','e','p','e','n','d','e','n','c','i','e','s',0}; +static const WCHAR szDependOnService[] = { + 'D','e','p','e','n','d','O','n','S','e','r','v','i','c','e',0}; + +struct reg_value { + DWORD type; + DWORD size; + LPCWSTR name; + LPCVOID data; +}; + +static inline void service_set_value( struct reg_value *val, + DWORD type, LPCWSTR name, LPCVOID data, DWORD size ) +{ + val->name = name; + val->type = type; + val->data = data; + val->size = size; +} + +static inline void service_set_dword( struct reg_value *val, + LPCWSTR name, DWORD *data ) +{ + service_set_value( val, REG_DWORD, name, data, sizeof (DWORD)); +} + +static inline void service_set_string( struct reg_value *val, + LPCWSTR name, LPCWSTR string ) +{ + DWORD len = (lstrlenW(string)+1) * sizeof (WCHAR); + service_set_value( val, REG_SZ, name, string, len ); +} + +static inline void service_set_multi_string( struct reg_value *val, + LPCWSTR name, LPCWSTR string ) +{ + DWORD len = 0; + + /* determine the length of a double null terminated multi string */ + do { + len += (lstrlenW( &string[ len ] )+1); + } while ( string[ len++ ] ); + + len *= sizeof (WCHAR); + service_set_value( val, REG_MULTI_SZ, name, string, len ); +} + +static inline LONG service_write_values( HKEY hKey, + struct reg_value *val, int n ) +{ + LONG r = ERROR_SUCCESS; + int i; + + for( i=0; ihkey, lpServiceName, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &dp); if (r!=ERROR_SUCCESS) - goto error; + return NULL; if (dp != REG_CREATED_NEW_KEY) { @@ -1151,75 +1220,38 @@ goto error; } - if(lpDisplayName) - { - r = RegSetValueExW(hKey, szDisplayName, 0, REG_SZ, (const BYTE*)lpDisplayName, - (strlenW(lpDisplayName)+1)*sizeof(WCHAR) ); - if (r!=ERROR_SUCCESS) - goto error; - } + if( lpDisplayName ) + service_set_string( &val[n++], szDisplayName, lpDisplayName ); - r = RegSetValueExW(hKey, szType, 0, REG_DWORD, (LPVOID)&dwServiceType, sizeof (DWORD) ); - if (r!=ERROR_SUCCESS) - goto error; + service_set_dword( &val[n++], szType, &dwServiceType ); + service_set_dword( &val[n++], szStart, &dwStartType ); + service_set_dword( &val[n++], szError, &dwErrorControl ); - r = RegSetValueExW(hKey, szStart, 0, REG_DWORD, (LPVOID)&dwStartType, sizeof (DWORD) ); - if (r!=ERROR_SUCCESS) - goto error; - - r = RegSetValueExW(hKey, szError, 0, REG_DWORD, - (LPVOID)&dwErrorControl, sizeof (DWORD) ); - if (r!=ERROR_SUCCESS) - goto error; + if( lpBinaryPathName ) + service_set_string( &val[n++], szImagePath, lpBinaryPathName ); - if(lpBinaryPathName) - { - r = RegSetValueExW(hKey, szImagePath, 0, REG_SZ, (const BYTE*)lpBinaryPathName, - (strlenW(lpBinaryPathName)+1)*sizeof(WCHAR) ); - if (r!=ERROR_SUCCESS) - goto error; - } + if( lpLoadOrderGroup ) + service_set_string( &val[n++], szGroup, lpLoadOrderGroup ); - if(lpLoadOrderGroup) - { - r = RegSetValueExW(hKey, szGroup, 0, REG_SZ, (const BYTE*)lpLoadOrderGroup, - (strlenW(lpLoadOrderGroup)+1)*sizeof(WCHAR) ); - if (r!=ERROR_SUCCESS) - goto error; - } + if( lpDependencies ) + service_set_multi_string( &val[n++], szDependencies, lpDependencies ); - if(lpDependencies) - { - DWORD len = 0; - - /* determine the length of a double null terminated multi string */ - do { - len += (strlenW(&lpDependencies[len])+1); - } while (lpDependencies[len++]); - - r = RegSetValueExW(hKey, szDependencies, 0, REG_MULTI_SZ, - (const BYTE*)lpDependencies, len ); - if (r!=ERROR_SUCCESS) - goto error; - } - - if(lpPassword) - { + if( lpPassword ) FIXME("Don't know how to add a Password for a service.\n"); - } - if(lpServiceStartName) - { - FIXME("Don't know how to add a ServiceStartName for a service.\n"); - } + if( lpServiceStartName ) + service_set_string( &val[n++], szDependOnService, lpServiceStartName ); + + r = service_write_values( hKey, val, n ); + if( r != ERROR_SUCCESS ) + goto error; len = strlenW(lpServiceName)+1; - hsvc = sc_handle_alloc( SC_HTYPE_SERVICE, - sizeof (struct sc_service) + len*sizeof(WCHAR), - sc_handle_destroy_service ); - if (!hsvc) - return NULL; - strcpyW( hsvc->name, lpServiceName ); + len = sizeof (struct sc_service) + len*sizeof(WCHAR); + hsvc = sc_handle_alloc( SC_HTYPE_SERVICE, len, sc_handle_destroy_service ); + if( !hsvc ) + goto error; + lstrcpyW( hsvc->name, lpServiceName ); hsvc->hkey = hKey; hsvc->scm = hscm; hscm->hdr.ref_count++; @@ -1227,8 +1259,7 @@ return (SC_HANDLE) &hsvc->hdr; error: - if (hsvc) - sc_handle_free( &hsvc->hdr ); + RegCloseKey( hKey ); return NULL; } @@ -1737,16 +1768,6 @@ LPQUERY_SERVICE_CONFIGW lpServiceConfig, DWORD cbBufSize, LPDWORD pcbBytesNeeded) { - static const WCHAR szDisplayName[] = { - 'D','i','s','p','l','a','y','N','a','m','e', 0 }; - static const WCHAR szType[] = {'T','y','p','e',0}; - static const WCHAR szStart[] = {'S','t','a','r','t',0}; - static const WCHAR szError[] = { - 'E','r','r','o','r','C','o','n','t','r','o','l', 0}; - static const WCHAR szImagePath[] = {'I','m','a','g','e','P','a','t','h',0}; - static const WCHAR szGroup[] = {'G','r','o','u','p',0}; - static const WCHAR szDependencies[] = { - 'D','e','p','e','n','d','e','n','c','i','e','s',0}; WCHAR str_buffer[ MAX_PATH ]; LONG r; DWORD type, val, sz, total, n; @@ -1992,12 +2013,53 @@ LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName) { - FIXME("%p %ld %ld %ld %s %s %p %p %s %s %s\n", + struct reg_value val[10]; + struct sc_service *hsvc; + DWORD r = ERROR_SUCCESS; + HKEY hKey; + int n = 0; + + TRACE("%p %ld %ld %ld %s %s %p %p %s %s %s\n", hService, dwServiceType, dwStartType, dwErrorControl, debugstr_w(lpBinaryPathName), debugstr_w(lpLoadOrderGroup), lpdwTagId, lpDependencies, debugstr_w(lpServiceStartName), debugstr_w(lpPassword), debugstr_w(lpDisplayName) ); - return TRUE; + + hsvc = sc_handle_get_handle_data(hService, SC_HTYPE_SERVICE); + if (!hsvc) + { + SetLastError( ERROR_INVALID_HANDLE ); + return FALSE; + } + hKey = hsvc->hkey; + + if( dwServiceType != SERVICE_NO_CHANGE ) + service_set_dword( &val[n++], szType, &dwServiceType ); + + if( dwStartType != SERVICE_NO_CHANGE ) + service_set_dword( &val[n++], szStart, &dwStartType ); + + if( dwErrorControl != SERVICE_NO_CHANGE ) + service_set_dword( &val[n++], szError, &dwErrorControl ); + + if( lpBinaryPathName ) + service_set_string( &val[n++], szImagePath, lpBinaryPathName ); + + if( lpLoadOrderGroup ) + service_set_string( &val[n++], szGroup, lpLoadOrderGroup ); + + if( lpDependencies ) + service_set_multi_string( &val[n++], szDependencies, lpDependencies ); + + if( lpPassword ) + FIXME("ignoring password\n"); + + if( lpServiceStartName ) + service_set_string( &val[n++], szDependOnService, lpServiceStartName ); + + r = service_write_values( hsvc->hkey, val, n ); + + return (r == ERROR_SUCCESS) ? TRUE : FALSE ; } /****************************************************************************** diff -urN wine-20050310/dlls/advapi32/tests/crypt.c wine-20050419/dlls/advapi32/tests/crypt.c --- wine-20050310/dlls/advapi32/tests/crypt.c 2005-02-23 13:44:15.000000000 +0100 +++ wine-20050419/dlls/advapi32/tests/crypt.c 2005-04-15 18:12:14.000000000 +0200 @@ -41,6 +41,30 @@ static BOOL (WINAPI *pCryptGetDefaultProviderA)(DWORD, DWORD*, DWORD, LPSTR, DWORD*); static BOOL (WINAPI *pCryptReleaseContext)(HCRYPTPROV, DWORD); static BOOL (WINAPI *pCryptSetProviderExA)(LPCSTR, DWORD, DWORD*, DWORD); +static BOOL (WINAPI *pCryptCreateHash)(HCRYPTPROV, ALG_ID, HCRYPTKEY, DWORD, HCRYPTHASH*); +static BOOL (WINAPI *pCryptDestroyHash)(HCRYPTHASH); +static BOOL (WINAPI *pCryptGenRandom)(HCRYPTPROV, DWORD, BYTE*); +static BOOL (WINAPI *pCryptContextAddRef)(HCRYPTPROV, DWORD*, DWORD dwFlags); +static BOOL (WINAPI *pCryptGenKey)(HCRYPTPROV, ALG_ID, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptDestroyKey)(HCRYPTKEY); +static BOOL (WINAPI *pCryptDecrypt)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE*, DWORD*); +static BOOL (WINAPI *pCryptDeriveKey)(HCRYPTPROV, ALG_ID, HCRYPTHASH, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptDuplicateHash)(HCRYPTHASH, DWORD*, DWORD, HCRYPTHASH*); +static BOOL (WINAPI *pCryptDuplicateKey)(HCRYPTKEY, DWORD*, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptEncrypt)(HCRYPTKEY, HCRYPTHASH, BOOL, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptExportKey)(HCRYPTKEY, HCRYPTKEY, DWORD, DWORD, BYTE*, DWORD*); +static BOOL (WINAPI *pCryptGetHashParam)(HCRYPTHASH, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptGetKeyParam)(HCRYPTKEY, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptGetProvParam)(HCRYPTPROV, DWORD, BYTE*, DWORD*, DWORD); +static BOOL (WINAPI *pCryptGetUserKey)(HCRYPTPROV, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptHashData)(HCRYPTHASH, BYTE*, DWORD, DWORD); +static BOOL (WINAPI *pCryptHashSessionKey)(HCRYPTHASH, HCRYPTKEY, DWORD); +static BOOL (WINAPI *pCryptImportKey)(HCRYPTPROV, BYTE*, DWORD, HCRYPTKEY, DWORD, HCRYPTKEY*); +static BOOL (WINAPI *pCryptSignHashW)(HCRYPTHASH, DWORD, LPCWSTR, DWORD, BYTE*, DWORD*); +static BOOL (WINAPI *pCryptSetHashParam)(HCRYPTKEY, DWORD, BYTE*, DWORD); +static BOOL (WINAPI *pCryptSetKeyParam)(HCRYPTKEY, DWORD, BYTE*, DWORD); +static BOOL (WINAPI *pCryptSetProvParam)(HCRYPTPROV, DWORD, BYTE*, DWORD); +static BOOL (WINAPI *pCryptVerifySignatureW)(HCRYPTHASH, BYTE*, DWORD, HCRYPTKEY, LPCWSTR, DWORD); static void init_function_pointers(void) { @@ -48,16 +72,39 @@ if(hadvapi32) { - pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA"); - pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA"); - pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA"); - pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA"); - pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext"); - pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA"); + pCryptAcquireContextA = (void*)GetProcAddress(hadvapi32, "CryptAcquireContextA"); + pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA"); + pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA"); + pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA"); + pCryptReleaseContext = (void*)GetProcAddress(hadvapi32, "CryptReleaseContext"); + pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA"); + pCryptCreateHash = (void*)GetProcAddress(hadvapi32, "CryptCreateHash"); + pCryptDestroyHash = (void*)GetProcAddress(hadvapi32, "CryptDestroyHash"); + pCryptGenRandom = (void*)GetProcAddress(hadvapi32, "CryptGenRandom"); + pCryptContextAddRef = (void*)GetProcAddress(hadvapi32, "CryptContextAddRef"); + pCryptGenKey = (void*)GetProcAddress(hadvapi32, "CryptGenKey"); + pCryptDestroyKey = (void*)GetProcAddress(hadvapi32, "CryptDestroyKey"); + pCryptDecrypt = (void*)GetProcAddress(hadvapi32, "CryptDecrypt"); + pCryptDeriveKey = (void*)GetProcAddress(hadvapi32, "CryptDeriveKey"); + pCryptDuplicateHash = (void*)GetProcAddress(hadvapi32, "CryptDuplicateHash"); + pCryptDuplicateKey = (void*)GetProcAddress(hadvapi32, "CryptDuplicateKey"); + pCryptEncrypt = (void*)GetProcAddress(hadvapi32, "CryptEncrypt"); + pCryptExportKey = (void*)GetProcAddress(hadvapi32, "CryptExportKey"); + pCryptGetHashParam = (void*)GetProcAddress(hadvapi32, "CryptGetHashParam"); + pCryptGetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptGetKeyParam"); + pCryptGetProvParam = (void*)GetProcAddress(hadvapi32, "CryptGetProvParam"); + pCryptGetUserKey = (void*)GetProcAddress(hadvapi32, "CryptGetUserKey"); + pCryptHashData = (void*)GetProcAddress(hadvapi32, "CryptHashData"); + pCryptHashSessionKey = (void*)GetProcAddress(hadvapi32, "CryptHashSessionKey"); + pCryptImportKey = (void*)GetProcAddress(hadvapi32, "CryptImportKey"); + pCryptSignHashW = (void*)GetProcAddress(hadvapi32, "CryptSignHashW"); + pCryptSetHashParam = (void*)GetProcAddress(hadvapi32, "CryptSetHashParam"); + pCryptSetKeyParam = (void*)GetProcAddress(hadvapi32, "CryptSetKeyParam"); + pCryptSetProvParam = (void*)GetProcAddress(hadvapi32, "CryptSetProvParam"); + pCryptVerifySignatureW = (void*)GetProcAddress(hadvapi32, "CryptVerifySignatureW"); } } - static void init_environment(void) { HCRYPTPROV hProv; @@ -138,7 +185,7 @@ hProv = 0; SetLastError(0xdeadbeef); result = pCryptAcquireContextA(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); - ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError()); + ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE || GetLastError() == NTE_FAIL), "%d/%ld\n", result, GetLastError()); if (hProv) pCryptReleaseContext(hProv, 0); @@ -147,12 +194,149 @@ hProv = 0; SetLastError(0xdeadbeef); result = pCryptAcquireContextA(&hProv, szKeySet, "", PROV_RSA_FULL, 0); - ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError()); + ok(result && (GetLastError() == ERROR_ENVVAR_NOT_FOUND || GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE || GetLastError() == NTE_FAIL), "%d/%ld\n", result, GetLastError()); if (hProv) pCryptReleaseContext(hProv, 0); } +static void test_incorrect_api_usage(void) +{ + BOOL result; + HCRYPTPROV hProv, hProv2; + HCRYPTHASH hHash, hHash2; + HCRYPTKEY hKey, hKey2; + BYTE temp; + DWORD dwLen, dwTemp; + + /* This is to document incorrect api usage in the + * "Uru - Ages beyond Myst Demo" installer as reported by Paul Vriens. + * + * The installer destroys a hash object after having released the context + * with which the hash was created. This is not allowed according to MSDN, + * since CryptReleaseContext destroys all hash and key objects belonging to + * the respective context. However, while wine used to crash, Windows is more + * robust here and returns an ERROR_INVALID_PARAMETER code. + */ + + result = pCryptAcquireContextA(&hProv, szBadKeySet, szRsaBaseProv, + PROV_RSA_FULL, CRYPT_NEWKEYSET); + ok (result, "%08lx\n", GetLastError()); + if (!result) return; + + result = pCryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptDestroyKey(hKey2); + ok (result, "%ld\n", GetLastError()); + + dwTemp = CRYPT_MODE_ECB; + result = pCryptSetKeyParam(hKey2, KP_MODE, (BYTE*)&dwTemp, sizeof(DWORD)); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptAcquireContextA(&hProv2, szBadKeySet, NULL, PROV_RSA_FULL, + CRYPT_DELETEKEYSET); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptReleaseContext(hProv, 0); + ok (result, "%ld\n", GetLastError()); + if (!result) return; + + result = pCryptReleaseContext(hProv, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptGenRandom(hProv, 1, &temp); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptContextAddRef(hProv, NULL, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptCreateHash(hProv, CALG_SHA, 0, 0, &hHash2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDeriveKey(hProv, CALG_RC4, hHash, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDuplicateHash(hHash, NULL, 0, &hHash2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDuplicateKey(hKey, NULL, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptExportKey(hKey, (HCRYPTPROV)NULL, 0, 0, &temp, &dwLen); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptGetHashParam(hHash, 0, &temp, &dwLen, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptGetKeyParam(hKey, 0, &temp, &dwLen, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptGetProvParam(hProv, 0, &temp, &dwLen, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptGetUserKey(hProv, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptHashData(hHash, &temp, 1, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptHashSessionKey(hHash, hKey, 0); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptImportKey(hProv, &temp, 1, (HCRYPTKEY)NULL, 0, &hKey2); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + dwLen = 1; + result = pCryptSignHashW(hHash, 0, NULL, 0, &temp, &dwLen); + ok (!result && (GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%ld\n", GetLastError()); + + result = pCryptSetKeyParam(hKey, 0, &temp, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptSetHashParam(hHash, 0, &temp, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptSetProvParam(hProv, 0, &temp, 1); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptVerifySignatureW(hHash, &temp, 1, hKey, NULL, 0); + ok (!result && (GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), "%ld\n", GetLastError()); + + result = pCryptDestroyHash(hHash); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); + + result = pCryptDestroyKey(hKey); + ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); +} + static BOOL FindProvRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszProvName, DWORD *pcbProvName, DWORD *pdwProvCount) { @@ -565,6 +749,7 @@ if(pCryptAcquireContextA && pCryptReleaseContext) { init_environment(); test_acquire_context(); + test_incorrect_api_usage(); clean_up_environment(); } diff -urN wine-20050310/dlls/advapi32/tests/registry.c wine-20050419/dlls/advapi32/tests/registry.c --- wine-20050310/dlls/advapi32/tests/registry.c 2005-02-25 17:52:10.000000000 +0100 +++ wine-20050419/dlls/advapi32/tests/registry.c 2005-04-19 14:00:04.000000000 +0200 @@ -48,7 +48,7 @@ if (ret) break; } if (ret != ERROR_NO_MORE_ITEMS) return ret; - RegDeleteKeyA( hkey, NULL ); + RegDeleteKeyA( hkey, "" ); return 0; } @@ -75,6 +75,7 @@ static void test_enum_value(void) { DWORD res; + HKEY test_key; char value[20], data[20]; WCHAR valueW[20], dataW[20]; DWORD val_count, data_count, type; @@ -82,18 +83,22 @@ static const WCHAR testW[] = {'T','e','s','t',0}; static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0}; + /* create the working key for new 'Test' value */ + res = RegCreateKeyA( hkey_main, "TestKey", &test_key ); + ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res); + /* check NULL data with zero length */ - res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, NULL, 0 ); + res = RegSetValueExA( test_key, "Test", 0, REG_SZ, NULL, 0 ); if (GetVersion() & 0x80000000) ok( res == ERROR_INVALID_PARAMETER, "RegSetValueExA returned %ld\n", res ); else ok( !res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_EXPAND_SZ, NULL, 0 ); - ok( !res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_BINARY, NULL, 0 ); - ok( !res, "RegSetValueExA returned %ld\n", res ); + res = RegSetValueExA( test_key, "Test", 0, REG_EXPAND_SZ, NULL, 0 ); + ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %ld\n", res ); + res = RegSetValueExA( test_key, "Test", 0, REG_BINARY, NULL, 0 ); + ok( ERROR_SUCCESS == res || ERROR_INVALID_PARAMETER == res, "RegSetValueExA returned %ld\n", res ); - res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 ); + res = RegSetValueExA( test_key, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 ); ok( res == 0, "RegSetValueExA failed error %ld\n", res ); /* overflow both name and data */ @@ -102,7 +107,7 @@ type = 1234; strcpy( value, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); ok( val_count == 2, "val_count set to %ld\n", val_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); @@ -116,7 +121,7 @@ type = 1234; strcpy( value, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); /* Win9x returns 2 as specified by MSDN but NT returns 3... */ ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count ); @@ -134,7 +139,7 @@ type = 1234; strcpy( value, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); ok( val_count == 0, "val_count set to %ld\n", val_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); @@ -151,7 +156,7 @@ type = 1234; strcpy( value, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); ok( val_count == 20, "val_count set to %ld\n", val_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); @@ -165,7 +170,7 @@ type = 1234; strcpy( value, "xxxxxxxxxx" ); strcpy( data, "xxxxxxxxxx" ); - res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count ); + res = RegEnumValueA( test_key, 0, value, &val_count, NULL, &type, data, &data_count ); ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count ); @@ -176,9 +181,9 @@ /* Unicode tests */ SetLastError(0); - res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) ); + res = RegSetValueExW( test_key, testW, 0, REG_SZ, (const BYTE *)foobarW, 7*sizeof(WCHAR) ); if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED) - goto CLEANUP; + return; ok( res == 0, "RegSetValueExW failed error %ld\n", res ); /* overflow both name and data */ @@ -187,7 +192,7 @@ type = 1234; memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); ok( val_count == 2, "val_count set to %ld\n", val_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); @@ -201,7 +206,7 @@ type = 1234; memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); ok( val_count == 3, "val_count set to %ld\n", val_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); @@ -215,7 +220,7 @@ type = 1234; memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res ); ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); @@ -229,17 +234,13 @@ type = 1234; memcpy( valueW, xxxW, sizeof(xxxW) ); memcpy( dataW, xxxW, sizeof(xxxW) ); - res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); + res = RegEnumValueW( test_key, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count ); ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res ); ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count ); ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count ); ok( type == REG_SZ, "type %ld is not REG_SZ\n", type ); ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" ); ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" ); - -CLEANUP: - /* cleanup */ - RegDeleteValueA( hkey_main, "Test" ); } static void test_query_value_ex() @@ -269,8 +270,8 @@ /* open same key twice */ ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkResult); ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); - ok(hkResult != hkPreserve && hkResult != NULL, - "expected hkResult != hkPreserve and hkResult != NULL\n"); + ok(hkResult != hkPreserve, "epxected hkResult != hkPreserve\n"); + ok(hkResult != NULL, "hkResult != NULL\n"); RegCloseKey(hkResult); /* open nonexistent key @@ -314,7 +315,8 @@ */ hkResult = hkPreserve; ret = RegOpenKeyA(NULL, "Software\\Wine\\Test", &hkResult); - ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret); + ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */ + "expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret); ok(hkResult == hkPreserve, "expected hkResult == hkPreserve\n"); RegCloseKey(hkResult); @@ -336,12 +338,89 @@ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); /* try to close the key twice */ - ret = RegCloseKey(hkHandle); - ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret); - + ret = RegCloseKey(hkHandle); /* Windows 95 doesn't mind. */ + ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_SUCCESS, + "expected ERROR_INVALID_HANDLE or ERROR_SUCCESS, got %ld\n", ret); + /* try to close a NULL handle */ ret = RegCloseKey(NULL); - ok(ret == ERROR_INVALID_HANDLE, "expected ERROR_INVALID_HANDLE, got %ld\n", ret); + ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_BADKEY, /* Windows 95 returns BADKEY */ + "expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %ld\n", ret); +} + +static void test_reg_delete_key() +{ + DWORD ret; + + ret = RegDeleteKey(hkey_main, NULL); + ok(ret == ERROR_INVALID_PARAMETER || ret == ERROR_ACCESS_DENIED, + "expected ERROR_INVALID_PARAMETER or ERROR_ACCESS_DENIED, got %ld\n", ret); +} + +static void test_reg_save_key() +{ + DWORD ret; + + ret = RegSaveKey(hkey_main, "saved_key", NULL); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); +} + +static void test_reg_load_key() +{ + DWORD ret; + HKEY hkHandle; + + ret = RegLoadKey(HKEY_LOCAL_MACHINE, "Test", "saved_key"); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + ret = RegOpenKey(HKEY_LOCAL_MACHINE, "Test", &hkHandle); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + RegCloseKey(hkHandle); +} + +static void test_reg_unload_key() +{ + DWORD ret; + + ret = RegUnLoadKey(HKEY_LOCAL_MACHINE, "Test"); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", ret); + + DeleteFile("saved_key"); +} + +static BOOL set_privileges(LPCSTR privilege, BOOL set) +{ + TOKEN_PRIVILEGES tp; + HANDLE hToken; + LUID luid; + + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) + return FALSE; + + if(!LookupPrivilegeValue(NULL, privilege, &luid)) + { + CloseHandle(hToken); + return FALSE; + } + + tp.PrivilegeCount = 1; + tp.Privileges[0].Luid = luid; + + if (set) + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + else + tp.Privileges[0].Attributes = 0; + + AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), NULL, NULL); + if (GetLastError() != ERROR_SUCCESS) + { + CloseHandle(hToken); + return FALSE; + } + + CloseHandle(hToken); + return TRUE; } START_TEST(registry) @@ -352,6 +431,19 @@ test_query_value_ex(); test_reg_open_key(); test_reg_close_key(); + test_reg_delete_key(); + + /* SaveKey/LoadKey require the SE_BACKUP_NAME privilege to be set */ + if (set_privileges(SE_BACKUP_NAME, TRUE) && + set_privileges(SE_RESTORE_NAME, TRUE)) + { + test_reg_save_key(); + test_reg_load_key(); + test_reg_unload_key(); + + set_privileges(SE_BACKUP_NAME, FALSE); + set_privileges(SE_RESTORE_NAME, FALSE); + } /* cleanup */ delete_key( hkey_main ); diff -urN wine-20050310/dlls/advapi32/tests/security.c wine-20050419/dlls/advapi32/tests/security.c --- wine-20050310/dlls/advapi32/tests/security.c 2005-03-05 11:47:13.000000000 +0100 +++ wine-20050419/dlls/advapi32/tests/security.c 2005-03-31 12:07:11.000000000 +0200 @@ -31,6 +31,8 @@ typedef BOOL (WINAPI *fnBuildTrusteeWithNameA)( TRUSTEE *trustee, LPSTR str ); typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str ); typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid ); +typedef BOOL (WINAPI *fnGetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR, DWORD, LPDWORD); static HMODULE hmod; @@ -38,6 +40,7 @@ fnBuildTrusteeWithNameA pBuildTrusteeWithNameA; fnConvertSidToStringSidA pConvertSidToStringSidA; fnConvertStringSidToSidA pConvertStringSidToSidA; +fnGetFileSecurityA pGetFileSecurityA; struct sidRef { @@ -109,10 +112,12 @@ ok( r, "failed to allocate sid\n" ); r = pConvertSidToStringSidA( psid, &str ); ok( r, "failed to convert sid\n" ); - ok( !strcmp( str, refs[i].refStr ), - "incorrect sid, expected %s, got %s\n", refs[i].refStr, str ); - if( str ) + if (r) + { + ok( !strcmp( str, refs[i].refStr ), + "incorrect sid, expected %s, got %s\n", refs[i].refStr, str ); LocalFree( str ); + } if( psid ) FreeSid( psid ); @@ -287,7 +292,7 @@ luid.LowPart = i; cchName = sizeof(buf); ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); - ok( ret && GetLastError() != ERROR_NO_SUCH_PRIVILEGE, + ok( ret || GetLastError() == ERROR_NO_SUCH_PRIVILEGE, "LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError()); } /* check a bogus LUID */ @@ -398,6 +403,35 @@ test_lookupPrivilegeValue(); } +static void test_FileSecurity(void) +{ + char directory[MAX_PATH]; + DWORD retval, outSize; + BOOL result; + BYTE buffer[0x40]; + + pGetFileSecurityA = (fnGetFileSecurityA) + GetProcAddress( hmod, "GetFileSecurityA" ); + if( !pGetFileSecurityA ) + return; + + retval = GetTempPathA(sizeof(directory), directory); + if (!retval) { + trace("GetTempPathA failed\n"); + return; + } + + strcpy(directory, "\\Should not exist"); + + SetLastError(NO_ERROR); + result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize); + ok(!result, "GetFileSecurityA should fail for not existing directories/files\n"); + ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) || + (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) , + "last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) " + "expected, got %ld\n", GetLastError()); +} + START_TEST(security) { init(); @@ -405,4 +439,5 @@ test_sid(); test_trustee(); test_luid(); + test_FileSecurity(); } diff -urN wine-20050310/dlls/advpack/advpack.c wine-20050419/dlls/advpack/advpack.c --- wine-20050310/dlls/advpack/advpack.c 2005-01-20 21:03:13.000000000 +0100 +++ wine-20050419/dlls/advpack/advpack.c 2005-04-18 11:51:53.000000000 +0200 @@ -28,10 +28,13 @@ #include "winnls.h" #include "setupapi.h" #include "advpub.h" +#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(advpack); +typedef HRESULT (WINAPI *DLLREGISTER) (void); + /*********************************************************************** * DllMain (ADVPACK.@) @@ -47,11 +50,51 @@ } /*********************************************************************** + * RunSetupCommand (ADVPACK.@) + * + * Executes an install section in an INF file or a program. + * + * PARAMS + * hWnd [I] Handle to parent window, NULL for quiet mode + * szCmdName [I] Inf or EXE filename to execute + * szInfSection [I] Inf section to install, NULL for DefaultInstall + * szDir [I] Path to extracted files + * szTitle [I] Title of all dialogs + * phEXE [O] Handle of EXE to wait for + * dwFlags [I] Flags; see include/advpub.h + * pvReserved [I] Reserved + * + * RETURNS + * S_OK Everything OK + * S_ASYNCHRONOUS OK, required to wait on phEXE + * ERROR_SUCCESS_REBOOT_REQUIRED Reboot required + * E_INVALIDARG Invalid argument given + * HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION) + * Not supported on this Windows version + * E_UNEXPECTED Unexpected error + * HRESULT_FROM_WIN32(GetLastError()) Some other error + * + * BUGS + * Unimplemented + */ +HRESULT WINAPI RunSetupCommand( HWND hWnd, LPCSTR szCmdName, + LPCSTR szInfSection, LPCSTR szDir, + LPCSTR lpszTitle, HANDLE *phEXE, + DWORD dwFlags, LPVOID pvReserved ) +{ + FIXME("(%p, %s, %s, %s, %s, %p, 0x%08lx, %p): stub\n", + hWnd, debugstr_a(szCmdName), debugstr_a(szInfSection), + debugstr_a(szDir), debugstr_a(lpszTitle), + phEXE, dwFlags, pvReserved); + return E_UNEXPECTED; +} + +/*********************************************************************** * LaunchINFSection (ADVPACK.@) */ void WINAPI LaunchINFSection( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show ) { - FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(cmdline), show ); + FIXME("(%p %p %s %d): stub\n", hWnd, hInst, debugstr_a(cmdline), show ); } /*********************************************************************** @@ -59,7 +102,7 @@ */ void WINAPI LaunchINFSectionEx( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show ) { - FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(cmdline), show ); + FIXME("(%p %p %s %d): stub\n", hWnd, hInst, debugstr_a(cmdline), show ); } /* this structure very closely resembles parameters of RunSetupCommand() */ @@ -104,7 +147,7 @@ */ DWORD WINAPI NeedRebootInit(VOID) { - FIXME("() stub!\n"); + FIXME("(): stub\n"); return 0; } @@ -113,7 +156,7 @@ */ BOOL WINAPI NeedReboot(DWORD dwRebootCheck) { - FIXME("(0x%08lx) stub!\n", dwRebootCheck); + FIXME("(0x%08lx): stub\n", dwRebootCheck); return FALSE; } @@ -172,3 +215,80 @@ return S_OK; } + +/*********************************************************************** + * RegisterOCX (ADVPACK.@) + */ +void WINAPI RegisterOCX( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show ) +{ + WCHAR wszBuff[MAX_PATH]; + WCHAR* pwcComma; + HMODULE hm; + DLLREGISTER pfnRegister; + HRESULT hr; + + TRACE("(%s)\n", cmdline); + + MultiByteToWideChar(CP_ACP, 0, cmdline, strlen(cmdline), wszBuff, MAX_PATH); + if ((pwcComma = strchrW( wszBuff, ',' ))) *pwcComma = 0; + + TRACE("Parsed DLL name (%s)\n", debugstr_w(wszBuff)); + + hm = LoadLibraryExW(wszBuff, 0, LOAD_WITH_ALTERED_SEARCH_PATH); + if (!hm) + { + ERR("Couldn't load DLL: %s\n", debugstr_w(wszBuff)); + return; + } + + pfnRegister = (DLLREGISTER)GetProcAddress(hm, "DllRegisterServer"); + if (pfnRegister == NULL) + { + ERR("DllRegisterServer entry point not found\n"); + } + else + { + hr = pfnRegister(); + if (hr != S_OK) + { + ERR("DllRegisterServer entry point returned %08lx\n", hr); + } + } + + TRACE("Successfully registered OCX\n"); + + FreeLibrary(hm); +} + +/*********************************************************************** + * DelNode (ADVPACK.@) + * + * Deletes a file or directory + * + * PARAMS + * pszFileOrDirName [I] Name of file or directory to delete + * dwFlags [I] Flags; see include/advpub.h + * + * RETURNS + * Success: S_OK + * Failure: E_FAIL + * + * BUGS + * Unimplemented + */ +HRESULT WINAPI DelNode( LPCSTR pszFileOrDirName, DWORD dwFlags ) +{ + FIXME("(%s, 0x%08lx): stub\n", debugstr_a(pszFileOrDirName), dwFlags); + return E_FAIL; +} + +/*********************************************************************** + * DelNodeRunDLL32 (ADVPACK.@) + * + * BUGS + * Unimplemented + */ +void WINAPI DelNodeRunDLL32( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show ) +{ + FIXME("(%s): stub\n", debugstr_a(cmdline)); +} diff -urN wine-20050310/dlls/advpack/advpack.spec wine-20050419/dlls/advpack/advpack.spec --- wine-20050310/dlls/advpack/advpack.spec 2005-01-20 21:03:13.000000000 +0100 +++ wine-20050419/dlls/advpack/advpack.spec 2005-04-18 11:51:53.000000000 +0200 @@ -1,8 +1,8 @@ @ stub AddDelBackupEntry @ stub AdvInstallFile @ stub CloseINFEngine -@ stub DelNode -@ stub DelNodeRunDLL32 +@ stdcall DelNode(str long) +@ stdcall DelNodeRunDLL32(ptr ptr str long) @ stdcall DllMain(long long ptr) @ stdcall DoInfInstall(ptr) @ stub ExecuteCab @@ -23,8 +23,8 @@ @ stub RegRestoreAll @ stub RegSaveRestore @ stub RegSaveRestoreOnINF -@ stub RegisterOCX -@ stub RunSetupCommand +@ stdcall RegisterOCX(ptr ptr str long) +@ stdcall RunSetupCommand(long str str str str ptr long ptr) @ stub SetPerUserSecValues @ stub TranslateInfString @ stub TranslateInfStringEx diff -urN wine-20050310/dlls/advpack/reg.c wine-20050419/dlls/advpack/reg.c --- wine-20050310/dlls/advpack/reg.c 2004-10-07 06:20:24.000000000 +0200 +++ wine-20050419/dlls/advpack/reg.c 2005-04-19 12:24:50.000000000 +0200 @@ -112,7 +112,7 @@ TRACE("(%p %s %p)\n", hm, pszSection, pstTable); - for(i = 0; i < pstTable->cEntries; i++) + if (pstTable) for(i = 0; i < pstTable->cEntries; i++) TRACE("%d: %s -> %s\n", i, pstTable->pse[i].pszName, pstTable->pse[i].pszValue); @@ -138,7 +138,7 @@ WritePrivateProfileStringW(Strings, SYS_MOD_PATH, sys_mod_path, tmp_ini_path); /* Write the additional string table */ - for(i = 0; i < pstTable->cEntries; i++) { + if (pstTable) for(i = 0; i < pstTable->cEntries; i++) { char tmp_value[MAX_PATH + 2]; UNICODE_STRING name, value; tmp_value[0] = '\"'; diff -urN wine-20050310/dlls/atl/.cvsignore wine-20050419/dlls/atl/.cvsignore --- wine-20050310/dlls/atl/.cvsignore 2004-07-06 23:01:18.000000000 +0200 +++ wine-20050419/dlls/atl/.cvsignore 2005-03-16 20:53:41.000000000 +0100 @@ -1,3 +1,5 @@ Makefile atl.dll.dbg.c atl.spec.def +atliface.h +rsrc.res diff -urN wine-20050310/dlls/atl/Makefile.in wine-20050419/dlls/atl/Makefile.in --- wine-20050310/dlls/atl/Makefile.in 2004-08-13 02:38:59.000000000 +0200 +++ wine-20050419/dlls/atl/Makefile.in 2005-03-17 14:57:44.000000000 +0100 @@ -3,13 +3,23 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = atl.dll -IMPORTS = ole32 user32 kernel32 advapi32 -EXTRALIBS = -luuid +IMPORTS = ole32 shlwapi user32 advapi32 kernel32 +EXTRALIBS = $(LIBUNICODE) -luuid C_SRCS = \ atl_main.c \ - regsvr.c + registrar.c + +RC_SRCS = rsrc.rc + +IDL_SRCS = \ + atliface.idl @MAKE_DLL_RULES@ +rsrc.res: atl.rgs + ### Dependencies: + +# note: this will get overwritten by make depend +$(ALL_OBJS): $(IDL_SRCS:.idl=.h) diff -urN wine-20050310/dlls/atl/atl.rgs wine-20050419/dlls/atl/atl.rgs --- wine-20050310/dlls/atl/atl.rgs 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/atl/atl.rgs 2005-03-18 11:25:34.000000000 +0100 @@ -0,0 +1,17 @@ +HKCR +{ + ATL.Registrar = s 'Registrar Class' + { + CLSID = s '%CLSID_ATLRegistrar%' + } + NoRemove CLSID { + ForceRemove '%CLSID_ATLRegistrar%' = s 'Registrar Class' + { + ProgID = s 'ATL.Registrar' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Both' + } + } + } +} diff -urN wine-20050310/dlls/atl/atl.spec wine-20050419/dlls/atl/atl.spec --- wine-20050310/dlls/atl/atl.spec 2005-03-07 12:02:31.000000000 +0100 +++ wine-20050419/dlls/atl/atl.spec 2005-03-17 11:24:42.000000000 +0100 @@ -1,4 +1,4 @@ -1 stub DllCanUnloadNow +1 stdcall -private DllCanUnloadNow() ATL_DllCanUnloadNow 2 stdcall -private DllGetClassObject(ptr ptr ptr) ATL_DllGetClassObject 3 stdcall -private DllRegisterServer() ATL_DllRegisterServer 4 stdcall -private DllUnregisterServer() ATL_DllUnregisterServer diff -urN wine-20050310/dlls/atl/atl_main.c wine-20050419/dlls/atl/atl_main.c --- wine-20050310/dlls/atl/atl_main.c 2005-01-19 18:00:32.000000000 +0100 +++ wine-20050419/dlls/atl/atl_main.c 2005-03-16 20:53:41.000000000 +0100 @@ -35,11 +35,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(atl); +HINSTANCE hInst; + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(0x%p, %ld, %p)\n",hinstDLL,fdwReason,lpvReserved); - if (fdwReason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(hinstDLL); + if (fdwReason == DLL_PROCESS_ATTACH) { + DisableThreadLibraryCalls(hinstDLL); + hInst = hinstDLL; + } return TRUE; } diff -urN wine-20050310/dlls/atl/atliface.idl wine-20050419/dlls/atl/atliface.idl --- wine-20050310/dlls/atl/atliface.idl 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/atl/atliface.idl 2005-03-14 11:51:27.000000000 +0100 @@ -0,0 +1,71 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +import "ocidl.idl"; + +cpp_quote("#ifdef ATL_INITGUID") +cpp_quote("#include \"initguid.h\"") +cpp_quote("#endif") + +[ + object, + oleautomation, + uuid(44EC053B-400F-11D0-9DCD-00A0C90391D3) +] +interface IRegistrar : IUnknown +{ + HRESULT AddReplacement( + [in] LPCOLESTR Key, + [in] LPCOLESTR item); + + HRESULT ClearReplacements(); + + HRESULT ResourceRegisterSz( + [in] LPCOLESTR resFileName, + [in] LPCOLESTR szID, + [in] LPCOLESTR szType); + + HRESULT ResourceUnregisterSz( + [in] LPCOLESTR resFileName, + [in] LPCOLESTR szID, + [in] LPCOLESTR szType); + + HRESULT FileRegister( + [in] LPCOLESTR fileName); + + HRESULT FileUnregister( + [in] LPCOLESTR fileName); + + HRESULT StringRegister( + [in] LPCOLESTR data); + + HRESULT StringUnregister( + [in] LPCOLESTR data); + + HRESULT ResourceRegister( + [in] LPCOLESTR resFileName, + [in] UINT nID, + [in] LPCOLESTR szType); + + HRESULT ResourceUnregister( + [in] LPCOLESTR resFileName, + [in] UINT nID, + [in] LPCOLESTR szType); +} + +cpp_quote("DEFINE_GUID(CLSID_ATLRegistrar,0x44ec053a,0x400f,0x11d0,0x9d,0xcd,0x00,0xa0,0xc9,0x03,0x91,0xd3);") diff -urN wine-20050310/dlls/atl/registrar.c wine-20050419/dlls/atl/registrar.c --- wine-20050310/dlls/atl/registrar.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/atl/registrar.c 2005-03-21 11:52:04.000000000 +0100 @@ -0,0 +1,808 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "objbase.h" +#include "oaidl.h" +#include "shlwapi.h" + +#define ATL_INITGUID +#include "atliface.h" + +#include "wine/debug.h" +#include "wine/unicode.h" + +WINE_DEFAULT_DEBUG_CHANNEL(atl); + +ULONG dll_count = 0; + +/************************************************************** + * ATLRegistrar implementation + */ + +static struct { + WCHAR name[22]; + HKEY key; +} root_keys[] = { + {{'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}, + HKEY_CLASSES_ROOT}, + {{'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}, + HKEY_CURRENT_USER}, + {{'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}, + HKEY_LOCAL_MACHINE}, + {{'H','K','E','Y','_','U','S','E','R','S',0}, + HKEY_USERS}, + {{'H','K','E','Y','_','P','E','R','F','O','R','M','A','N','C','E','_','D','A','T','A',0}, + HKEY_PERFORMANCE_DATA}, + {{'H','K','E','Y','_','D','Y','N','_','D','A','T','A',0}, + HKEY_DYN_DATA}, + {{'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}, + HKEY_CURRENT_CONFIG}, + {{'H','K','C','R',0}, HKEY_CLASSES_ROOT}, + {{'H','K','C','U',0}, HKEY_CURRENT_USER}, + {{'H','K','L','M',0}, HKEY_LOCAL_MACHINE}, + {{'H','K','U',0}, HKEY_USERS}, + {{'H','K','P','D',0}, HKEY_PERFORMANCE_DATA}, + {{'H','K','D','D',0}, HKEY_DYN_DATA}, + {{'H','K','C','C',0}, HKEY_CURRENT_CONFIG} +}; + +typedef struct rep_list_str { + LPOLESTR key; + LPOLESTR item; + int key_len; + struct rep_list_str *next; +} rep_list; + +typedef struct { + IRegistrarVtbl *lpVtbl; + ULONG ref; + rep_list *rep; +} Registrar; + +typedef struct { + LPOLESTR str; + DWORD alloc; + DWORD len; +} strbuf; + +static void strbuf_init(strbuf *buf) +{ + buf->str = HeapAlloc(GetProcessHeap(), 0, 128*sizeof(WCHAR)); + buf->alloc = 128; + buf->len = 0; +} + +static void strbuf_write(LPCOLESTR str, strbuf *buf, int len) +{ + if(len == -1) + len = lstrlenW(str); + if(buf->len+len+1 >= buf->alloc) { + buf->alloc = (buf->len+len)<<1; + buf->str = HeapReAlloc(GetProcessHeap(), 0, buf->str, buf->alloc*sizeof(WCHAR)); + } + memcpy(buf->str+buf->len, str, len*sizeof(OLECHAR)); + buf->len += len; + buf->str[buf->len] = '\0'; +} + +static HRESULT get_word(LPCOLESTR *str, strbuf *buf) +{ + LPCOLESTR iter, iter2 = *str; + + buf->len = 0; + buf->str[0] = '\0'; + + while(isspaceW(*iter2)) + iter2++; + iter = iter2; + if(!*iter) { + *str = iter; + return S_OK; + } + + if(*iter == '{' || *iter == '}' || *iter == '=') { + strbuf_write(iter++, buf, 1); + }else if(*iter == '\'') { + iter2 = ++iter; + iter = strchrW(iter, '\''); + if(!iter) { + WARN("Unexpected end of script\n"); + *str = iter; + return DISP_E_EXCEPTION; + } + strbuf_write(iter2, buf, iter-iter2); + iter++; + }else { + while(*iter && !isspaceW(*iter)) + iter++; + strbuf_write(iter2, buf, iter-iter2); + } + + while(isspaceW(*iter)) + iter++; + *str = iter; + return S_OK; +} + +static HRESULT do_preprocess(Registrar *This, LPCOLESTR data, strbuf *buf) +{ + LPCOLESTR iter, iter2 = data; + rep_list *rep_iter; + static const WCHAR wstr[] = {'%',0}; + + iter = strchrW(data, '%'); + while(iter) { + strbuf_write(iter2, buf, iter-iter2); + + iter2 = ++iter; + if(!*iter2) + return DISP_E_EXCEPTION; + iter = strchrW(iter2, '%'); + if(!iter) + return DISP_E_EXCEPTION; + + if(iter == iter2) { + strbuf_write(wstr, buf, 1); + }else { + for(rep_iter = This->rep; rep_iter; rep_iter = rep_iter->next) { + if(rep_iter->key_len == iter-iter2 + && !memicmpW(iter2, rep_iter->key, rep_iter->key_len)) + break; + } + if(!rep_iter) { + WARN("Could not find replacement: %s\n", debugstr_wn(iter2, iter-iter2)); + return DISP_E_EXCEPTION; + } + + strbuf_write(rep_iter->item, buf, -1); + } + + iter2 = ++iter; + iter = strchrW(iter, '%'); + } + + strbuf_write(iter2, buf, -1); + TRACE("%s\n", debugstr_w(buf->str)); + + return S_OK; +} + +static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOOL do_register) +{ + LPCOLESTR iter = *pstr; + HRESULT hres; + LONG lres; + HKEY hkey = 0; + strbuf name; + + enum { + NORMAL, + NO_REMOVE, + IS_VAL, + FORCE_REMOVE, + DO_DELETE + } key_type = NORMAL; + + static const WCHAR wstrNoRemove[] = {'N','o','R','e','m','o','v','e',0}; + static const WCHAR wstrForceRemove[] = {'F','o','r','c','e','R','e','m','o','v','e',0}; + static const WCHAR wstrDelete[] = {'D','e','l','e','t','e',0}; + static const WCHAR wstrval[] = {'v','a','l',0}; + + iter = *pstr; + hres = get_word(&iter, buf); + if(FAILED(hres)) + return hres; + strbuf_init(&name); + + while(buf->str[1] || buf->str[0] != '}') { + key_type = NORMAL; + if(!lstrcmpiW(buf->str, wstrNoRemove)) + key_type = NO_REMOVE; + else if(!lstrcmpiW(buf->str, wstrForceRemove)) + key_type = FORCE_REMOVE; + else if(!lstrcmpiW(buf->str, wstrval)) + key_type = IS_VAL; + else if(!lstrcmpiW(buf->str, wstrDelete)) + key_type = DO_DELETE; + + if(key_type != NORMAL) { + hres = get_word(&iter, buf); + if(FAILED(hres)) + break; + } + TRACE("name = %s\n", debugstr_w(buf->str)); + + if(do_register) { + if(key_type == IS_VAL) { + hkey = parent_key; + strbuf_write(buf->str, &name, -1); + }else if(key_type == DO_DELETE) { + TRACE("Deleting %s\n", debugstr_w(buf->str)); + lres = SHDeleteKeyW(parent_key, buf->str); + }else { + if(key_type == FORCE_REMOVE) + SHDeleteKeyW(parent_key, buf->str); + lres = RegCreateKeyW(parent_key, buf->str, &hkey); + if(lres != ERROR_SUCCESS) { + WARN("Could not create(open) key: %08lx\n", lres); + hres = HRESULT_FROM_WIN32(lres); + break; + } + } + }else if(key_type != IS_VAL && key_type != DO_DELETE) { + strbuf_write(buf->str, &name, -1); + lres = RegOpenKeyW(parent_key, buf->str, &hkey); + if(lres != ERROR_SUCCESS) + WARN("Could not open key %s: %08lx\n", debugstr_w(name.str), lres); + } + + if(key_type != DO_DELETE && *iter == '=') { + iter++; + hres = get_word(&iter, buf); + if(FAILED(hres)) + break; + if(buf->len != 1) { + WARN("Wrong registry type: %s\n", debugstr_w(buf->str)); + hres = DISP_E_EXCEPTION; + break; + } + if(do_register) { + switch(buf->str[0]) { + case 's': + hres = get_word(&iter, buf); + if(FAILED(hres)) + break; + lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_SZ, (PBYTE)buf->str, + (lstrlenW(buf->str)+1)*sizeof(WCHAR)); + if(lres != ERROR_SUCCESS) { + WARN("Could set value of key: %08lx\n", lres); + hres = HRESULT_FROM_WIN32(lres); + break; + } + break; + case 'd': { + DWORD dw; + if(*iter == '0' && iter[1] == 'x') { + iter += 2; + dw = strtolW(iter, (WCHAR**)&iter, 16); + }else { + dw = strtolW(iter, (WCHAR**)&iter, 10); + } + lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_DWORD, + (PBYTE)&dw, sizeof(dw)); + if(lres != ERROR_SUCCESS) { + WARN("Could set value of key: %08lx\n", lres); + hres = HRESULT_FROM_WIN32(lres); + break; + } + break; + } + default: + WARN("Wrong resource type: %s\n", debugstr_w(buf->str)); + hres = DISP_E_EXCEPTION; + }; + if(FAILED(hres)) + break; + }else { + if(*iter == '-') + iter++; + hres = get_word(&iter, buf); + if(FAILED(hres)) + break; + } + }else if(key_type == IS_VAL) { + WARN("value not set!\n"); + hres = DISP_E_EXCEPTION; + break; + } + + if(key_type != IS_VAL && key_type != DO_DELETE && *iter == '{') { + hres = get_word(&iter, buf); + if(FAILED(hres)) + break; + hres = do_process_key(&iter, hkey, buf, do_register); + if(FAILED(hres)) + break; + } + + TRACE("%x %x\n", do_register, key_type); + if(!do_register && (key_type == NORMAL || key_type == FORCE_REMOVE)) { + TRACE("Deleting %s\n", debugstr_w(name.str)); + RegDeleteKeyW(parent_key, name.str); + } + + if(hkey && key_type != IS_VAL) + RegCloseKey(hkey); + hkey = 0; + name.len = 0; + + hres = get_word(&iter, buf); + if(FAILED(hres)) + break; + } + + HeapFree(GetProcessHeap(), 0, name.str); + if(hkey && key_type != IS_VAL) + RegCloseKey(hkey); + *pstr = iter; + return hres; +} + +static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register) +{ + LPCOLESTR iter = data; + strbuf buf; + HRESULT hres = S_OK; + int i; + + strbuf_init(&buf); + hres = get_word(&iter, &buf); + if(FAILED(hres)) + return hres; + + while(*iter) { + if(!buf.len) { + WARN("ward.len == 0, failed\n"); + hres = DISP_E_EXCEPTION; + break; + } + for(i=0; i(%s %p\n", iface, debugstr_guid(riid), ppvObject); + + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRegistrar, riid)) { + IRegistrar_AddRef(iface); + *ppvObject = iface; + return S_OK; + } + return E_NOINTERFACE; +} + +static ULONG WINAPI Registrar_AddRef(IRegistrar *iface) +{ + Registrar *This = (Registrar*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ->%ld\n", This, ref); + return ref; +} + +static ULONG WINAPI Registrar_Release(IRegistrar *iface) +{ + Registrar *This = (Registrar*)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ->%ld\n", This, ref); + if(!ref) { + IRegistrar_ClearReplacements(iface); + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); + } + return ref; +} + +static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key, LPCOLESTR item) +{ + Registrar *This = (Registrar*)iface; + int len; + rep_list *new_rep; + + TRACE("(%p)->(%s %s)\n", This, debugstr_w(Key), debugstr_w(item)); + + new_rep = HeapAlloc(GetProcessHeap(), 0, sizeof(rep_list)); + + new_rep->key_len = lstrlenW(Key); + new_rep->key = HeapAlloc(GetProcessHeap(), 0, new_rep->key_len*sizeof(OLECHAR)+1); + memcpy(new_rep->key, Key, (new_rep->key_len+1)*sizeof(OLECHAR)); + + len = lstrlenW(item)+1; + new_rep->item = HeapAlloc(GetProcessHeap(), 0, len*sizeof(OLECHAR)); + memcpy(new_rep->item, item, len*sizeof(OLECHAR)); + + new_rep->next = This->rep; + This->rep = new_rep; + + return S_OK; +} + +static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface) +{ + Registrar *This = (Registrar*)iface; + rep_list *iter, *iter2; + + TRACE("(%p)\n", This); + + if(!This->rep) + return S_OK; + + iter = This->rep; + while(iter) { + iter2 = iter->next; + HeapFree(GetProcessHeap(), 0, iter->key); + HeapFree(GetProcessHeap(), 0, iter->item); + HeapFree(GetProcessHeap(), 0, iter); + iter = iter2; + } + + This->rep = NULL; + return S_OK; +} + +static HRESULT WINAPI Registrar_ResourceRegisterSz(IRegistrar* iface, LPCOLESTR resFileName, + LPCOLESTR szID, LPCOLESTR szType) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType)); + return resource_register(This, resFileName, szID, szType, TRUE); +} + +static HRESULT WINAPI Registrar_ResourceUnregisterSz(IRegistrar* iface, LPCOLESTR resFileName, + LPCOLESTR szID, LPCOLESTR szType) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType)); + return resource_register(This, resFileName, szID, szType, FALSE); +} + +static HRESULT WINAPI Registrar_FileRegister(IRegistrar* iface, LPCOLESTR fileName) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s)\n", This, debugstr_w(fileName)); + return file_register(This, fileName, TRUE); +} + +static HRESULT WINAPI Registrar_FileUnregister(IRegistrar* iface, LPCOLESTR fileName) +{ + Registrar *This = (Registrar*)iface; + FIXME("(%p)->(%s)\n", This, debugstr_w(fileName)); + return file_register(This, fileName, FALSE); +} + +static HRESULT WINAPI Registrar_StringRegister(IRegistrar* iface, LPCOLESTR data) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s)\n", This, debugstr_w(data)); + return string_register(This, data, TRUE); +} + +static HRESULT WINAPI Registrar_StringUnregister(IRegistrar* iface, LPCOLESTR data) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s)\n", This, debugstr_w(data)); + return string_register(This, data, FALSE); +} + +static HRESULT WINAPI Registrar_ResourceRegister(IRegistrar* iface, LPCOLESTR resFileName, + UINT nID, LPCOLESTR szType) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s %d %s)\n", iface, debugstr_w(resFileName), nID, debugstr_w(szType)); + return resource_register(This, resFileName, (LPOLESTR)nID, szType, TRUE); +} + +static HRESULT WINAPI Registrar_ResourceUnregister(IRegistrar* iface, LPCOLESTR resFileName, + UINT nID, LPCOLESTR szType) +{ + Registrar *This = (Registrar*)iface; + TRACE("(%p)->(%s %d %s)\n", This, debugstr_w(resFileName), nID, debugstr_w(szType)); + return resource_register(This, resFileName, (LPOLESTR)nID, szType, FALSE); +} + +static IRegistrarVtbl RegistrarVtbl = { + Registrar_QueryInterface, + Registrar_AddRef, + Registrar_Release, + Registrar_AddReplacement, + Registrar_ClearReplacements, + Registrar_ResourceRegisterSz, + Registrar_ResourceUnregisterSz, + Registrar_FileRegister, + Registrar_FileUnregister, + Registrar_StringRegister, + Registrar_StringUnregister, + Registrar_ResourceRegister, + Registrar_ResourceUnregister, +}; + +static HRESULT Registrar_create(LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObject) +{ + Registrar *ret; + + if(!IsEqualGUID(&IID_IUnknown, riid) && !IsEqualGUID(&IID_IRegistrar, riid)) + return E_NOINTERFACE; + + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Registrar)); + ret->lpVtbl = &RegistrarVtbl; + ret->ref = 1; + ret->rep = NULL; + *ppvObject = ret; + + InterlockedIncrement(&dll_count); + + return S_OK; +} + +/************************************************************** + * ClassFactory implementation + */ + +static HRESULT WINAPI RegistrarCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppvObject) +{ + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); + + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRegistrar, riid)) { + *ppvObject = iface; + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI RegistrarCF_AddRef(IClassFactory *iface) +{ + InterlockedIncrement(&dll_count); + return 2; +} + +static ULONG WINAPI RegistrarCF_Release(IClassFactory *iface) +{ + InterlockedDecrement(&dll_count); + return 1; +} + +static HRESULT WINAPI RegistrarCF_CreateInstance(IClassFactory *iface, LPUNKNOWN pUnkOuter, + REFIID riid, void **ppvObject) +{ + TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject); + return Registrar_create(pUnkOuter, riid, ppvObject); +} + +static HRESULT WINAPI RegistrarCF_LockServer(IClassFactory *iface, BOOL lock) +{ + TRACE("(%p)->(%x)\n", iface, lock); + + if(lock) + InterlockedIncrement(&dll_count); + else + InterlockedDecrement(&dll_count); + + return S_OK; +} + +static const IClassFactoryVtbl IRegistrarCFVtbl = { + RegistrarCF_QueryInterface, + RegistrarCF_AddRef, + RegistrarCF_Release, + RegistrarCF_CreateInstance, + RegistrarCF_LockServer +}; + +static IClassFactory RegistrarCF = { &IRegistrarCFVtbl }; + +/************************************************************** + * DllGetClassObject implementation + */ +HRESULT WINAPI ATL_DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppvObject) +{ + TRACE("(%s %s %p)", debugstr_guid(clsid), debugstr_guid(riid), ppvObject); + + if(IsEqualGUID(&CLSID_ATLRegistrar, clsid)) { + *ppvObject = &RegistrarCF; + return S_OK; + } + + FIXME("Not supported class %s\n", debugstr_guid(clsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +extern HINSTANCE hInst; + +static HRESULT do_register_server(BOOL do_register) +{ + WCHAR buf[MAX_PATH]; + HRESULT hres; + IRegistrar *pRegistrar; + + static const WCHAR wszModule[] = {'M','O','D','U','L','E',0}; + static const WCHAR wszDll[] = {'a','t','l','.','d','l','l',0}; + static const WCHAR wszRegistry[] = {'R','E','G','I','S','T','R','Y',0}; + static const WCHAR wszCLSID_ATLRegistrar[] = + {'C','L','S','I','D','_','A','T','L','R','e','g','i','s','t','r','a','r',0}; + + Registrar_create(NULL, &IID_IRegistrar, (void**)&pRegistrar); + IRegistrar_AddReplacement(pRegistrar, wszModule, wszDll); + + StringFromGUID2(&CLSID_ATLRegistrar, buf, sizeof(buf)/sizeof(buf[0])); + IRegistrar_AddReplacement(pRegistrar, wszCLSID_ATLRegistrar, buf); + + if(do_register) + hres = IRegistrar_ResourceRegister(pRegistrar, wszDll, 1, wszRegistry); + else + hres = IRegistrar_ResourceUnregister(pRegistrar, wszDll, 1, wszRegistry); + + IRegistrar_Release(pRegistrar); + return hres; +} + +/*********************************************************************** + * DllRegisterServer (ATL.@) + */ +HRESULT WINAPI ATL_DllRegisterServer(void) +{ + TRACE("\n"); + return do_register_server(TRUE); +} + +/*********************************************************************** + * DllRegisterServer (ATL.@) + */ +HRESULT WINAPI ATL_DllUnregisterServer(void) +{ + TRACE("\n"); + return do_register_server(FALSE); +} + +/*********************************************************************** + * DllCanUnloadNow (ATL.@) + */ +HRESULT WINAPI ATL_DllCanUnloadNow(void) +{ + TRACE("dll_count = %lu\n", dll_count); + return dll_count ? S_FALSE : S_OK; +} diff -urN wine-20050310/dlls/atl/regsvr.c wine-20050419/dlls/atl/regsvr.c --- wine-20050310/dlls/atl/regsvr.c 2005-03-07 12:02:31.000000000 +0100 +++ wine-20050419/dlls/atl/regsvr.c 1970-01-01 01:00:00.000000000 +0100 @@ -1,569 +0,0 @@ -/* - * self-registerable dll functions for atl.dll - * - * Copyright (C) 2003 John K. Hohm - * Copyright (C) 2004 Steven Edwards for ReactOS - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#define COM_NO_WINDOWS_H -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "wingdi.h" -#include "winreg.h" -#include "winerror.h" - -#include "objbase.h" -#include "initguid.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(atl); - -DEFINE_GUID( CLSID_ATLRegistrar, 0x44ec053a,0x400f,0x11d0,0x9d,0xcd,0x00,0xa0,0xc9,0x03,0x91,0xd3 ); - -/* - * Near the bottom of this file are the exported DllRegisterServer and - * DllUnregisterServer, which make all this worthwhile. - */ - -/*********************************************************************** - * interface for self-registering - */ -struct regsvr_interface -{ - IID const *iid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - IID const *base_iid; /* can be NULL to omit */ - int num_methods; /* can be <0 to omit */ - CLSID const *ps_clsid; /* can be NULL to omit */ - CLSID const *ps_clsid32; /* can be NULL to omit */ -}; - -static HRESULT register_interfaces(struct regsvr_interface const *list); -static HRESULT unregister_interfaces(struct regsvr_interface const *list); - -struct regsvr_coclass -{ - CLSID const *clsid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - LPCSTR ips; /* can be NULL to omit */ - LPCSTR ips32; /* can be NULL to omit */ - LPCSTR ips32_tmodel; /* can be NULL to omit */ - LPCSTR progid; /* can be NULL to omit */ - LPCSTR viprogid; /* can be NULL to omit */ - LPCSTR progid_extra; /* can be NULL to omit */ -}; - -static HRESULT register_coclasses(struct regsvr_coclass const *list); -static HRESULT unregister_coclasses(struct regsvr_coclass const *list); - -/*********************************************************************** - * static string constants - */ -static WCHAR const interface_keyname[10] = { - 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }; -static WCHAR const base_ifa_keyname[14] = { - 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', - 'e', 0 }; -static WCHAR const num_methods_keyname[11] = { - 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }; -static WCHAR const ps_clsid_keyname[15] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', 0 }; -static WCHAR const ps_clsid32_keyname[17] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', '3', '2', 0 }; -static WCHAR const clsid_keyname[6] = { - 'C', 'L', 'S', 'I', 'D', 0 }; -static WCHAR const curver_keyname[7] = { - 'C', 'u', 'r', 'V', 'e', 'r', 0 }; -static WCHAR const ips_keyname[13] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - 0 }; -static WCHAR const ips32_keyname[15] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - '3', '2', 0 }; -static WCHAR const progid_keyname[7] = { - 'P', 'r', 'o', 'g', 'I', 'D', 0 }; -static WCHAR const viprogid_keyname[25] = { - 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p', - 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D', - 0 }; -static char const tmodel_valuename[] = "ThreadingModel"; - -/*********************************************************************** - * static helper functions - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid); -static LONG register_key_defvalueW(HKEY base, WCHAR const *name, - WCHAR const *value); -static LONG register_key_defvalueA(HKEY base, WCHAR const *name, - char const *value); -static LONG register_progid(WCHAR const *clsid, - char const *progid, char const *curver_progid, - char const *name, char const *extra); -static LONG recursive_delete_key(HKEY key); -static LONG recursive_delete_keyA(HKEY base, char const *name); -static LONG recursive_delete_keyW(HKEY base, WCHAR const *name); - -/*********************************************************************** - * register_interfaces - */ -static HRESULT register_interfaces(struct regsvr_interface const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &interface_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - HKEY iid_key; - - StringFromGUID2(list->iid, buf, 39); - res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &iid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_interface_key; - - if (list->name) { - res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->base_iid) { - register_key_guid(iid_key, base_ifa_keyname, list->base_iid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (0 <= list->num_methods) { - static WCHAR const fmt[3] = { '%', 'd', 0 }; - HKEY key; - - res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - - wsprintfW(buf, fmt, list->num_methods); - res = RegSetValueExW(key, NULL, 0, REG_SZ, - (CONST BYTE*)buf, - (lstrlenW(buf) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid) { - register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid32) { - register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - error_close_iid_key: - RegCloseKey(iid_key); - } - -error_close_interface_key: - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_interfaces - */ -static HRESULT unregister_interfaces(struct regsvr_interface const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, - KEY_READ | KEY_WRITE, &interface_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->iid, buf, 39); - res = recursive_delete_keyW(interface_key, buf); - } - - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * register_coclasses - */ -static HRESULT register_coclasses(struct regsvr_coclass const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - HKEY clsid_key; - - StringFromGUID2(list->clsid, buf, 39); - res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->name) { - res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips) { - res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips32) { - HKEY ips32_key; - - res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, - &ips32_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, - (CONST BYTE*)list->ips32, - lstrlenA(list->ips32) + 1); - if (res == ERROR_SUCCESS && list->ips32_tmodel) - res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, - (CONST BYTE*)list->ips32_tmodel, - strlen(list->ips32_tmodel) + 1); - RegCloseKey(ips32_key); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->progid) { - res = register_key_defvalueA(clsid_key, progid_keyname, - list->progid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_progid(buf, list->progid, NULL, - list->name, list->progid_extra); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->viprogid) { - res = register_key_defvalueA(clsid_key, viprogid_keyname, - list->viprogid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_progid(buf, list->viprogid, list->progid, - list->name, list->progid_extra); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - error_close_clsid_key: - RegCloseKey(clsid_key); - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_coclasses - */ -static HRESULT unregister_coclasses(struct regsvr_coclass const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, - KEY_READ | KEY_WRITE, &coclass_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->clsid, buf, 39); - res = recursive_delete_keyW(coclass_key, buf); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->progid) { - res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - - if (list->viprogid) { - res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->viprogid); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * regsvr_key_guid - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) -{ - WCHAR buf[39]; - - StringFromGUID2(guid, buf, 39); - return register_key_defvalueW(base, name, buf); -} - -/*********************************************************************** - * regsvr_key_defvalueW - */ -static LONG register_key_defvalueW( - HKEY base, - WCHAR const *name, - WCHAR const *value) -{ - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - (lstrlenW(value) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_key_defvalueA - */ -static LONG register_key_defvalueA( - HKEY base, - WCHAR const *name, - char const *value) -{ - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - lstrlenA(value) + 1); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_progid - */ -static LONG register_progid( - WCHAR const *clsid, - char const *progid, - char const *curver_progid, - char const *name, - char const *extra) -{ - LONG res; - HKEY progid_key; - - res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &progid_key, NULL); - if (res != ERROR_SUCCESS) return res; - - if (name) { - res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, - (CONST BYTE*)name, strlen(name) + 1); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (clsid) { - res = register_key_defvalueW(progid_key, clsid_keyname, clsid); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (curver_progid) { - res = register_key_defvalueA(progid_key, curver_keyname, - curver_progid); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (extra) { - HKEY extra_key; - - res = RegCreateKeyExA(progid_key, extra, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &extra_key, NULL); - if (res == ERROR_SUCCESS) - RegCloseKey(extra_key); - } - -error_close_progid_key: - RegCloseKey(progid_key); - return res; -} - -/*********************************************************************** - * recursive_delete_key - */ -static LONG recursive_delete_key(HKEY key) -{ - LONG res; - WCHAR subkey_name[MAX_PATH]; - DWORD cName; - HKEY subkey; - - for (;;) { - cName = sizeof(subkey_name) / sizeof(WCHAR); - res = RegEnumKeyExW(key, 0, subkey_name, &cName, - NULL, NULL, NULL, NULL); - if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) { - res = ERROR_SUCCESS; /* presumably we're done enumerating */ - break; - } - res = RegOpenKeyExW(key, subkey_name, 0, - KEY_READ | KEY_WRITE, &subkey); - if (res == ERROR_FILE_NOT_FOUND) continue; - if (res != ERROR_SUCCESS) break; - - res = recursive_delete_key(subkey); - RegCloseKey(subkey); - if (res != ERROR_SUCCESS) break; - } - - if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0); - return res; -} - -/*********************************************************************** - * recursive_delete_keyA - */ -static LONG recursive_delete_keyA(HKEY base, char const *name) -{ - LONG res; - HKEY key; - - res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key); - if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS; - if (res != ERROR_SUCCESS) return res; - res = recursive_delete_key(key); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * recursive_delete_keyW - */ -static LONG recursive_delete_keyW(HKEY base, WCHAR const *name) -{ - LONG res; - HKEY key; - - res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key); - if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS; - if (res != ERROR_SUCCESS) return res; - res = recursive_delete_key(key); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * coclass list - */ -static struct regsvr_coclass const coclass_list[] = { - { - &CLSID_ATLRegistrar, - "Registrar Class", - NULL, - "atl.dll", - "Both" - }, - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * interface list - */ - -static struct regsvr_interface const interface_list[] = { - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * DllRegisterServer (ATL.@) - */ -HRESULT WINAPI ATL_DllRegisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = register_coclasses(coclass_list); - if (SUCCEEDED(hr)) - hr = register_interfaces(interface_list); - return hr; -} - -/*********************************************************************** - * DllUnregisterServer (ATL.@) - */ -HRESULT WINAPI ATL_DllUnregisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = unregister_coclasses(coclass_list); - if (SUCCEEDED(hr)) - hr = unregister_interfaces(interface_list); - return hr; -} - -/*********************************************************************** - * DllGetClassObject (ATL.@) - */ -HRESULT WINAPI ATL_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) -{ - if (IsEqualCLSID (rclsid, &CLSID_ATLRegistrar)) { - FIXME("No COM Class for ATLRegistrar\n"); - return CLASS_E_CLASSNOTAVAILABLE; - } - FIXME("(%s, %s, %p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); - return CLASS_E_CLASSNOTAVAILABLE; -} diff -urN wine-20050310/dlls/atl/rsrc.rc wine-20050419/dlls/atl/rsrc.rc --- wine-20050310/dlls/atl/rsrc.rc 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/atl/rsrc.rc 2005-03-16 20:53:41.000000000 +0100 @@ -0,0 +1,19 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +1 REGISTRY atl.rgs diff -urN wine-20050310/dlls/avifil32/api.c wine-20050419/dlls/avifil32/api.c --- wine-20050310/dlls/avifil32/api.c 2004-12-27 17:58:18.000000000 +0100 +++ wine-20050419/dlls/avifil32/api.c 2005-03-21 11:55:13.000000000 +0100 @@ -190,6 +190,7 @@ } /*********************************************************************** + * AVIFileOpen (AVIFIL32.@) * AVIFileOpenA (AVIFIL32.@) * AVIFileOpen (AVIFILE.102) */ @@ -363,6 +364,7 @@ } /*********************************************************************** + * AVIFileCreateStream (AVIFIL32.@) * AVIFileCreateStreamA (AVIFIL32.@) * AVIFileCreateStream (AVIFILE.144) */ @@ -782,8 +784,9 @@ } /*********************************************************************** - * AVIStreamOpenFromFile (AVIFILE.103) + * AVIStreamOpenFromFile (AVIFIL32.@) * AVIStreamOpenFromFileA (AVIFIL32.@) + * AVIStreamOpenFromFile (AVIFILE.103) */ HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile, DWORD fccType, LONG lParam, @@ -987,6 +990,7 @@ } /*********************************************************************** + * AVIBuildFilter (AVIFIL32.@) * AVIBuildFilterA (AVIFIL32.@) * AVIBuildFilter (AVIFILE.123) */ @@ -2316,7 +2320,7 @@ return AVIERR_UNSUPPORTED; } -HRESULT WINAPI AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, +HRESULT CDECL AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...) { FIXME("(%s,%p,%p,0x%08x,%p,%p), stub!\n", debugstr_a(szFile), pclsidHandler, lpfnCallback, @@ -2325,7 +2329,7 @@ return AVIERR_UNSUPPORTED; } -HRESULT WINAPI AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, +HRESULT CDECL AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...) { FIXME("(%s,%p,%p,0x%08x,%p,%p), stub!\n", debugstr_w(szFile), pclsidHandler, lpfnCallback, diff -urN wine-20050310/dlls/cabinet/cabextract.c wine-20050419/dlls/cabinet/cabextract.c --- wine-20050310/dlls/cabinet/cabextract.c 2004-12-22 18:11:31.000000000 +0100 +++ wine-20050419/dlls/cabinet/cabextract.c 2005-04-18 17:33:15.000000000 +0200 @@ -2068,7 +2068,7 @@ */ void find_cabinet_file(char **cabname, LPCSTR origcab) { - char *tail, *cab, *name, *nextpart, nametmp[MAX_PATH], *filepart; + char *tail, *cab, *name, *nextpart, nametmp[MAX_PATH]; int found = 0; TRACE("(*cabname == ^%p, origcab == %s)\n", cabname ? *cabname : NULL, debugstr_a(origcab)); @@ -2107,11 +2107,11 @@ nextpart = strchr(name, '\\'); if (nextpart) *nextpart = '\0'; - found = SearchPathA(cab, name, NULL, MAX_PATH, nametmp, &filepart); + found = SearchPathA(cab, name, NULL, MAX_PATH, nametmp, NULL); /* if the component was not found, look for it in the current dir */ if (!found) { - found = SearchPathA(".", name, NULL, MAX_PATH, nametmp, &filepart); + found = SearchPathA(".", name, NULL, MAX_PATH, nametmp, NULL); } if (found) @@ -2135,7 +2135,7 @@ if (found) { free((void *) *cabname); *cabname = cab; - strncpy(cab, nametmp, found+1); + memcpy(cab, nametmp, found+1); TRACE("result: %s\n", debugstr_a(cab)); } else { free((void *) cab); diff -urN wine-20050310/dlls/comcat/information.c wine-20050419/dlls/comcat/information.c --- wine-20050310/dlls/comcat/information.c 2005-01-10 13:25:29.000000000 +0100 +++ wine-20050419/dlls/comcat/information.c 2005-03-22 19:26:06.000000000 +0100 @@ -437,8 +437,7 @@ if (This == NULL || ppenum == NULL) return E_POINTER; - new_this = (IEnumCATEGORYINFOImpl *) HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl)); + new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl)); if (new_this == NULL) return E_OUTOFMEMORY; new_this->lpVtbl = This->lpVtbl; @@ -467,8 +466,7 @@ { IEnumCATEGORYINFOImpl *This; - This = (IEnumCATEGORYINFOImpl *) HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl)); + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumCATEGORYINFOImpl)); if (This) { WCHAR keyname[21] = { 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n', 't', ' ', 'C', 'a', 't', 'e', 'g', 'o', @@ -515,7 +513,7 @@ struct class_categories *categories; WCHAR *strings; - categories = (struct class_categories *)HeapAlloc( + categories = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct class_categories) + ((impl_count + req_count) * 39 + 2) * sizeof(WCHAR)); @@ -740,14 +738,13 @@ if (This == NULL || ppenum == NULL) return E_POINTER; - new_this = (CLSID_IEnumGUIDImpl *) HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); + new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); if (new_this == NULL) return E_OUTOFMEMORY; new_this->lpVtbl = This->lpVtbl; new_this->ref = 1; size = HeapSize(GetProcessHeap(), 0, (LPVOID)This->categories); - new_this->categories = (struct class_categories *) + new_this->categories = HeapAlloc(GetProcessHeap(), 0, size); if (new_this->categories == NULL) { HeapFree(GetProcessHeap(), 0, new_this); @@ -778,8 +775,7 @@ { CLSID_IEnumGUIDImpl *This; - This = (CLSID_IEnumGUIDImpl *) HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CLSID_IEnumGUIDImpl)); if (This) { WCHAR keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 }; @@ -924,8 +920,7 @@ if (This == NULL || ppenum == NULL) return E_POINTER; - new_this = (CATID_IEnumGUIDImpl *) HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); + new_this = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); if (new_this == NULL) return E_OUTOFMEMORY; new_this->lpVtbl = This->lpVtbl; @@ -955,8 +950,7 @@ { CATID_IEnumGUIDImpl *This; - This = (CATID_IEnumGUIDImpl *) HeapAlloc( - GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); + This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CATID_IEnumGUIDImpl)); if (This) { WCHAR prefix[6] = { 'C', 'L', 'S', 'I', 'D', '\\' }; diff -urN wine-20050310/dlls/comctl32/animate.c wine-20050419/dlls/comctl32/animate.c --- wine-20050310/dlls/comctl32/animate.c 2004-12-23 19:24:50.000000000 +0100 +++ wine-20050419/dlls/comctl32/animate.c 2005-03-25 21:49:00.000000000 +0100 @@ -3,7 +3,8 @@ * Animation control * * Copyright 1998, 1999 Eric Kohl - * 1999 Eric Pouech + * Copyright 1999 Eric Pouech + * Copyright 2005 Dimitrie O. Paun * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,12 +21,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * NOTES - * I will only improve this control once in a while. - * Eric * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Mar. 15, 2005, by Dimitrie O. Paun. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features, or bugs, please note them below. + * * TODO: * - check for the 'rec ' list in some AVI files - * - concurrent access to infoPtr */ #define COM_NO_WINDOWS_H @@ -59,6 +64,7 @@ HMMIO hMMio; /* handle to mmio stream */ HWND hwndSelf; HWND hwndNotify; + DWORD dwStyle; /* information on the loaded AVI file */ MainAVIHeader mah; AVIStreamHeader ash; @@ -86,23 +92,23 @@ HBITMAP hbmPrevFrame; } ANIMATE_INFO; -#define ANIMATE_GetInfoPtr(hWnd) ((ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0)) #define ANIMATE_COLOR_NONE 0xffffffff -static void ANIMATE_Notify(ANIMATE_INFO* infoPtr, UINT notif) +static void ANIMATE_Notify(ANIMATE_INFO *infoPtr, UINT notif) { - SendMessageA(infoPtr->hwndNotify, WM_COMMAND, + SendMessageW(infoPtr->hwndNotify, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(infoPtr->hwndSelf), notif), (LPARAM)infoPtr->hwndSelf); } -static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName) +static BOOL ANIMATE_LoadResW(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPWSTR lpName) { + static const WCHAR aviW[] = { 'A', 'V', 'I', 0 }; HRSRC hrsrc; MMIOINFO mminfo; LPVOID lpAvi; - hrsrc = FindResourceA(hInst, lpName, "AVI"); + hrsrc = FindResourceW(hInst, lpName, aviW); if (!hrsrc) return FALSE; @@ -118,8 +124,9 @@ mminfo.fccIOProc = FOURCC_MEM; mminfo.pchBuffer = (LPSTR)lpAvi; mminfo.cchBuffer = SizeofResource(hInst, hrsrc); - infoPtr->hMMio = mmioOpenA(NULL, &mminfo, MMIO_READ); - if (!infoPtr->hMMio) { + infoPtr->hMMio = mmioOpenW(NULL, &mminfo, MMIO_READ); + if (!infoPtr->hMMio) + { FreeResource(infoPtr->hRes); return FALSE; } @@ -128,19 +135,15 @@ } -static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName) +static BOOL ANIMATE_LoadFileW(ANIMATE_INFO *infoPtr, LPWSTR lpName) { - infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, - MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); + infoPtr->hMMio = mmioOpenW(lpName, 0, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); - if (!infoPtr->hMMio) - return FALSE; - - return TRUE; + return (BOOL)infoPtr->hMMio; } -static LRESULT ANIMATE_DoStop(ANIMATE_INFO *infoPtr) +static BOOL ANIMATE_DoStop(ANIMATE_INFO *infoPtr) { EnterCriticalSection(&infoPtr->cs); @@ -187,28 +190,25 @@ FreeResource(infoPtr->hRes); infoPtr->hRes = 0; } - HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); + Free (infoPtr->lpIndex); infoPtr->lpIndex = NULL; if (infoPtr->hic) { fnIC.fnICClose(infoPtr->hic); infoPtr->hic = 0; } - HeapFree(GetProcessHeap(), 0, infoPtr->inbih); + Free (infoPtr->inbih); infoPtr->inbih = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->outbih); + Free (infoPtr->outbih); infoPtr->outbih = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->indata); + Free (infoPtr->indata); infoPtr->indata = NULL; - HeapFree(GetProcessHeap(), 0, infoPtr->outdata); + Free (infoPtr->outdata); infoPtr->outdata = NULL; if( infoPtr->hbmPrevFrame ) { DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = 0; } - infoPtr->indata = infoPtr->outdata = NULL; - infoPtr->hwndSelf = 0; - infoPtr->hMMio = 0; memset(&infoPtr->mah, 0, sizeof(infoPtr->mah)); memset(&infoPtr->ash, 0, sizeof(infoPtr->ash)); @@ -217,7 +217,7 @@ infoPtr->transparentColor = ANIMATE_COLOR_NONE; } -static void ANIMATE_TransparentBlt(ANIMATE_INFO* infoPtr, HDC hdcDest, HDC hdcSource) +static void ANIMATE_TransparentBlt(ANIMATE_INFO *infoPtr, HDC hdcDest, HDC hdcSource) { HDC hdcMask; HBITMAP hbmMask; @@ -249,7 +249,7 @@ DeleteDC(hdcMask); } -static LRESULT ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) +static BOOL ANIMATE_PaintFrame(ANIMATE_INFO* infoPtr, HDC hDC) { void* pBitmapData = NULL; LPBITMAPINFO pBitmapInfo = NULL; @@ -273,7 +273,8 @@ nWidth = infoPtr->outbih->biWidth; nHeight = infoPtr->outbih->biHeight; - } else + } + else { pBitmapData = infoPtr->indata; pBitmapInfo = (LPBITMAPINFO)infoPtr->inbih; @@ -302,7 +303,7 @@ infoPtr->transparentColor = GetPixel(hdcMem,0,0); } - if(GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_TRANSPARENT) + if(infoPtr->dwStyle & ACS_TRANSPARENT) { HDC hdcFinal = CreateCompatibleDC(hDC); HBITMAP hbmFinal = CreateCompatibleBitmap(hDC,nWidth, nHeight); @@ -325,15 +326,15 @@ DeleteDC(hdcFinal); DeleteObject(infoPtr->hbmPrevFrame); infoPtr->hbmPrevFrame = hbmFinal; - } + } - if (GetWindowLongA(infoPtr->hwndSelf, GWL_STYLE) & ACS_CENTER) + if (infoPtr->dwStyle & ACS_CENTER) { - RECT rect; + RECT rect; - GetWindowRect(infoPtr->hwndSelf, &rect); - nOffsetX = ((rect.right - rect.left) - nWidth)/2; - nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; + GetWindowRect(infoPtr->hwndSelf, &rect); + nOffsetX = ((rect.right - rect.left) - nWidth)/2; + nOffsetY = ((rect.bottom - rect.top) - nHeight)/2; } BitBlt(hDC, nOffsetX, nOffsetY, nWidth, nHeight, hdcMem, 0, 0, SRCCOPY); @@ -342,21 +343,18 @@ return TRUE; } -static LRESULT ANIMATE_DrawFrame(ANIMATE_INFO* infoPtr) +static BOOL ANIMATE_DrawFrame(ANIMATE_INFO *infoPtr) { HDC hDC; TRACE("Drawing frame %d (loop %d)\n", infoPtr->currFrame, infoPtr->nLoop); - EnterCriticalSection(&infoPtr->cs); - mmioSeek(infoPtr->hMMio, infoPtr->lpIndex[infoPtr->currFrame], SEEK_SET); mmioRead(infoPtr->hMMio, infoPtr->indata, infoPtr->ash.dwSuggestedBufferSize); if (infoPtr->hic && fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { - LeaveCriticalSection(&infoPtr->cs); WARN("Decompression error\n"); return FALSE; } @@ -374,14 +372,27 @@ } } } - LeaveCriticalSection(&infoPtr->cs); return TRUE; } +static LRESULT ANIMATE_Timer(ANIMATE_INFO *infoPtr) +{ + /* FIXME: we should pass the hDC instead of 0 to WM_CTLCOLORSTATIC */ + if (infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, + 0, (LPARAM)infoPtr->hwndSelf); + EnterCriticalSection(&infoPtr->cs); + ANIMATE_DrawFrame(infoPtr); + LeaveCriticalSection(&infoPtr->cs); + + return 0; +} + static DWORD CALLBACK ANIMATE_AnimationThread(LPVOID ptr_) { - ANIMATE_INFO* infoPtr = (ANIMATE_INFO*)ptr_; + ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)ptr_; HANDLE event; DWORD timeout; @@ -400,10 +411,8 @@ return TRUE; } -static LRESULT ANIMATE_Play(HWND hWnd, WPARAM wParam, LPARAM lParam) +static LRESULT ANIMATE_Play(ANIMATE_INFO *infoPtr, UINT cRepeat, WORD wFrom, WORD wTo) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* nothing opened */ if (!infoPtr->hMMio) return FALSE; @@ -413,9 +422,9 @@ return TRUE; } - infoPtr->nFromFrame = (INT)LOWORD(lParam); - infoPtr->nToFrame = (INT)HIWORD(lParam); - infoPtr->nLoop = (INT)wParam; + infoPtr->nFromFrame = wFrom; + infoPtr->nToFrame = wTo; + infoPtr->nLoop = cRepeat; if (infoPtr->nToFrame == 0xFFFF) infoPtr->nToFrame = infoPtr->mah.dwTotalFrames - 1; @@ -429,25 +438,25 @@ infoPtr->currFrame = infoPtr->nFromFrame; - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TIMER) { + if (infoPtr->dwStyle & ACS_TIMER) + { TRACE("Using a timer\n"); /* create a timer to display AVI */ - infoPtr->uTimer = SetTimer(hWnd, 1, infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); - } else { - if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - { - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, 0, (LPARAM)hWnd); - } + infoPtr->uTimer = SetTimer(infoPtr->hwndSelf, 1, + infoPtr->mah.dwMicroSecPerFrame / 1000, NULL); + } + else + { + if(infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, 0, + (LPARAM)infoPtr->hwndSelf); TRACE("Using an animation thread\n"); infoPtr->hStopEvent = CreateEventW( NULL, TRUE, FALSE, NULL ); - infoPtr->hThread = CreateThread(0,0,ANIMATE_AnimationThread,(LPVOID)infoPtr, 0, &infoPtr->threadId); - if(!infoPtr->hThread) - { - ERR("Could not create animation thread!\n"); - return FALSE; - } + infoPtr->hThread = CreateThread(0, 0, ANIMATE_AnimationThread, + (LPVOID)infoPtr, 0, &infoPtr->threadId); + if(!infoPtr->hThread) return FALSE; } @@ -548,7 +557,7 @@ return FALSE; } - infoPtr->inbih = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); + infoPtr->inbih = Alloc(mmckInfo.cksize); if (!infoPtr->inbih) { WARN("Can't alloc input BIH\n"); return FALSE; @@ -595,12 +604,9 @@ /* FIXME: should handle the 'rec ' LIST when present */ - infoPtr->lpIndex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - infoPtr->mah.dwTotalFrames * sizeof(DWORD)); - if (!infoPtr->lpIndex) { - WARN("Can't alloc index array\n"); + infoPtr->lpIndex = Alloc(infoPtr->mah.dwTotalFrames * sizeof(DWORD)); + if (!infoPtr->lpIndex) return FALSE; - } numFrame = insize = 0; while (mmioDescend(infoPtr->hMMio, &mmckInfo, &mmckList, 0) == 0 && @@ -620,17 +626,15 @@ infoPtr->ash.dwSuggestedBufferSize = insize; } - infoPtr->indata = HeapAlloc(GetProcessHeap(), 0, infoPtr->ash.dwSuggestedBufferSize); - if (!infoPtr->indata) { - WARN("Can't alloc input buffer\n"); + infoPtr->indata = Alloc(infoPtr->ash.dwSuggestedBufferSize); + if (!infoPtr->indata) return FALSE; - } return TRUE; } -static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) +static BOOL ANIMATE_GetAviCodec(ANIMATE_INFO *infoPtr) { DWORD outSize; @@ -653,23 +657,20 @@ outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, (DWORD)infoPtr->inbih, 0L); - infoPtr->outbih = HeapAlloc(GetProcessHeap(), 0, outSize); - if (!infoPtr->outbih) { - WARN("Can't alloc output BIH\n"); + infoPtr->outbih = Alloc(outSize); + if (!infoPtr->outbih) return FALSE; - } if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, - (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) { + (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != outSize) + { WARN("Can't get output BIH\n"); return FALSE; } - infoPtr->outdata = HeapAlloc(GetProcessHeap(), 0, infoPtr->outbih->biSizeImage); - if (!infoPtr->outdata) { - WARN("Can't alloc output buffer\n"); + infoPtr->outdata = Alloc(infoPtr->outbih->biSizeImage); + if (!infoPtr->outdata) return FALSE; - } if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { @@ -680,74 +681,93 @@ return TRUE; } -static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam) -{ - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - HINSTANCE hInstance = (HINSTANCE)wParam; +static BOOL ANIMATE_OpenW(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPWSTR lpszName) +{ ANIMATE_Free(infoPtr); - infoPtr->hwndSelf = hWnd; - if (!lParam) { + if (!lpszName) + { TRACE("Closing avi!\n"); /* installer of thebat! v1.62 requires FALSE here */ return (infoPtr->hMMio != 0); } if (!hInstance) - hInstance = (HINSTANCE)GetWindowLongPtrW(hWnd, GWLP_HINSTANCE); + hInstance = (HINSTANCE)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_HINSTANCE); - if (HIWORD(lParam)) { - TRACE("(\"%s\");\n", (LPSTR)lParam); + if (HIWORD(lpszName)) + { + TRACE("(\"%s\");\n", debugstr_w(lpszName)); - if (!ANIMATE_LoadResA(infoPtr, hInstance, (LPSTR)lParam)) { + if (!ANIMATE_LoadResW(infoPtr, hInstance, lpszName)) + { TRACE("No AVI resource found!\n"); - if (!ANIMATE_LoadFileA(infoPtr, (LPSTR)lParam)) { + if (!ANIMATE_LoadFileW(infoPtr, lpszName)) + { WARN("No AVI file found!\n"); return FALSE; } } - } else { - TRACE("(%u);\n", (WORD)LOWORD(lParam)); + } + else + { + TRACE("(%u);\n", (WORD)(DWORD)lpszName); - if (!ANIMATE_LoadResA(infoPtr, hInstance, - MAKEINTRESOURCEA((INT)lParam))) { + if (!ANIMATE_LoadResW(infoPtr, hInstance, MAKEINTRESOURCEW((INT)lpszName))) + { WARN("No AVI resource found!\n"); return FALSE; } } - if (!ANIMATE_GetAviInfo(infoPtr)) { + if (!ANIMATE_GetAviInfo(infoPtr)) + { WARN("Can't get AVI information\n"); ANIMATE_Free(infoPtr); return FALSE; } - if (!ANIMATE_GetAviCodec(infoPtr)) { + if (!ANIMATE_GetAviCodec(infoPtr)) + { WARN("Can't get AVI Codec\n"); ANIMATE_Free(infoPtr); return FALSE; } - if (!GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { - SetWindowPos(hWnd, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, + if (!(infoPtr->dwStyle & ACS_CENTER)) + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->mah.dwWidth, infoPtr->mah.dwHeight, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER); - } - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_AUTOPLAY) { - return ANIMATE_Play(hWnd, -1, (LPARAM)MAKELONG(0, infoPtr->mah.dwTotalFrames-1)); - } + if (infoPtr->dwStyle & ACS_AUTOPLAY) + return ANIMATE_Play(infoPtr, -1, 0, infoPtr->mah.dwTotalFrames - 1); return TRUE; } -/* << ANIMATE_Open32W >> */ - -static LRESULT ANIMATE_Stop(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_OpenA(ANIMATE_INFO *infoPtr, HINSTANCE hInstance, LPSTR lpszName) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); + LPWSTR lpwszName; + LRESULT result; + INT len; + + if (!HIWORD(lpszName)) + return ANIMATE_OpenW(infoPtr, hInstance, (LPWSTR)lpszName); + + len = MultiByteToWideChar(CP_ACP, 0, lpszName, -1, NULL, 0); + lpwszName = Alloc(len * sizeof(WCHAR)); + if (!lpwszName) return FALSE; + MultiByteToWideChar(CP_ACP, 0, lpszName, -1, lpwszName, len); + result = ANIMATE_OpenW(infoPtr, hInstance, lpwszName); + Free (lpwszName); + return result; +} + + +static BOOL ANIMATE_Stop(ANIMATE_INFO *infoPtr) +{ /* nothing opened */ if (!infoPtr->hMMio) return FALSE; @@ -757,18 +777,14 @@ } -static LRESULT ANIMATE_Create(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_Create(HWND hWnd, LPCREATESTRUCTW lpcs) { - ANIMATE_INFO* infoPtr; + static const WCHAR msvfw32W[] = { 'm', 's', 'v', 'f', 'w', '3', '2', '.', 'd', 'l', 'l', 0 }; + ANIMATE_INFO *infoPtr; - if (!fnIC.hModule) /* FIXME: not thread safe */ + if (!fnIC.hModule) { - /* since there's a circular dep between msvfw32 and comctl32, we could either: - * - fix the build chain to allow this circular dep - * - handle it by hand - * AJ wants the latter :-( - */ - fnIC.hModule = LoadLibraryA("msvfw32.dll"); + fnIC.hModule = LoadLibraryW(msvfw32W); if (!fnIC.hModule) return FALSE; fnIC.fnICOpen = (void*)GetProcAddress(fnIC.hModule, "ICOpen"); @@ -779,19 +795,17 @@ /* allocate memory for info structure */ infoPtr = (ANIMATE_INFO *)Alloc(sizeof(ANIMATE_INFO)); - if (!infoPtr) { - ERR("could not allocate info memory!\n"); - return 0; - } + if (!infoPtr) return FALSE; /* store crossref hWnd <-> info structure */ SetWindowLongPtrW(hWnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndSelf = hWnd; - infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; + infoPtr->hwndNotify = lpcs->hwndParent; infoPtr->transparentColor = ANIMATE_COLOR_NONE; infoPtr->hbmPrevFrame = 0; + infoPtr->dwStyle = lpcs->style; - TRACE("Animate style=0x%08lx, parent=%p\n", GetWindowLongA(hWnd, GWL_STYLE), infoPtr->hwndNotify); + TRACE("Animate style=0x%08lx, parent=%p\n", infoPtr->dwStyle, infoPtr->hwndNotify); InitializeCriticalSection(&infoPtr->cs); @@ -799,97 +813,98 @@ } -static LRESULT ANIMATE_Destroy(HWND hWnd, WPARAM wParam, LPARAM lParam) +static LRESULT ANIMATE_Destroy(ANIMATE_INFO *infoPtr) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); - - /* free avi data */ ANIMATE_Free(infoPtr); /* free animate info data */ + SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0); + + DeleteCriticalSection(&infoPtr->cs); Free(infoPtr); - SetWindowLongPtrW(hWnd, 0, 0); return 0; } -static LRESULT ANIMATE_EraseBackground(HWND hWnd, WPARAM wParam, LPARAM lParam) +static BOOL ANIMATE_EraseBackground(ANIMATE_INFO *infoPtr, HDC hdc) { - ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); RECT rect; HBRUSH hBrush = 0; - if(GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) + if(infoPtr->dwStyle & ACS_TRANSPARENT) { - hBrush = (HBRUSH)SendMessageA(infoPtr->hwndNotify,WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); + hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLORSTATIC, + (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf); } - GetClientRect(hWnd, &rect); - FillRect((HDC)wParam, &rect, hBrush ? hBrush : GetCurrentObject((HDC)wParam, OBJ_BRUSH)); + GetClientRect(infoPtr->hwndSelf, &rect); + FillRect(hdc, &rect, hBrush ? hBrush : GetCurrentObject(hdc, OBJ_BRUSH)); return TRUE; } -static LRESULT WINAPI ANIMATE_Size(HWND hWnd, WPARAM wParam, LPARAM lParam) + +static LRESULT ANIMATE_StyleChanged(ANIMATE_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss) { - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_CENTER) { - InvalidateRect(hWnd, NULL, TRUE); - } - return TRUE; + TRACE("(styletype=%x, styleOld=0x%08lx, styleNew=0x%08lx)\n", + wStyleType, lpss->styleOld, lpss->styleNew); + + if (wStyleType != GWL_STYLE) return 0; + + infoPtr->dwStyle = lpss->styleNew; + + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + return 0; } + static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + ANIMATE_INFO *infoPtr = (ANIMATE_INFO *)GetWindowLongPtrW(hWnd, 0); + TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hWnd, uMsg, wParam, lParam); - if (!ANIMATE_GetInfoPtr(hWnd) && (uMsg != WM_NCCREATE)) - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + if (!infoPtr && (uMsg != WM_NCCREATE)) + return DefWindowProcW(hWnd, uMsg, wParam, lParam); switch (uMsg) { case ACM_OPENA: - return ANIMATE_OpenA(hWnd, wParam, lParam); + return ANIMATE_OpenA(infoPtr, (HINSTANCE)wParam, (LPSTR)lParam); case ACM_OPENW: - FIXME("ACM_OPENW: stub!\n"); - /* return ANIMATE_Open32W(hWnd, wParam, lParam); */ - return 0; + return ANIMATE_OpenW(infoPtr, (HINSTANCE)wParam, (LPWSTR)lParam); case ACM_PLAY: - return ANIMATE_Play(hWnd, wParam, lParam); + return ANIMATE_Play(infoPtr, (INT)wParam, LOWORD(lParam), HIWORD(lParam)); case ACM_STOP: - return ANIMATE_Stop(hWnd, wParam, lParam); + return ANIMATE_Stop(infoPtr); + + case WM_CLOSE: + ANIMATE_Free(infoPtr); + return 0; case WM_NCCREATE: - return ANIMATE_Create(hWnd, wParam, lParam); + return ANIMATE_Create(hWnd, (LPCREATESTRUCTW)lParam); case WM_NCHITTEST: return HTTRANSPARENT; case WM_DESTROY: - return ANIMATE_Destroy(hWnd, wParam, lParam); + return ANIMATE_Destroy(infoPtr); case WM_ERASEBKGND: - return ANIMATE_EraseBackground(hWnd, wParam, lParam); + return ANIMATE_EraseBackground(infoPtr, (HDC)wParam); - /* case WM_STYLECHANGED: FIXME shall we do something ?? */ + case WM_STYLECHANGED: + return ANIMATE_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); case WM_TIMER: - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - { - ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); - } - return ANIMATE_DrawFrame(ANIMATE_GetInfoPtr(hWnd)); + return ANIMATE_Timer(infoPtr); case WM_PAINT: { - ANIMATE_INFO* infoPtr = ANIMATE_GetInfoPtr(hWnd); - /* the animation isn't playing, or has not decompressed * (and displayed) the first frame yet, don't paint */ @@ -897,13 +912,13 @@ !infoPtr->hbmPrevFrame) { /* default paint handling */ - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); } - if (GetWindowLongA(hWnd, GWL_STYLE) & ACS_TRANSPARENT) - infoPtr->hbrushBG = (HBRUSH)SendMessageA(infoPtr->hwndNotify, - WM_CTLCOLORSTATIC, - wParam, (LPARAM)hWnd); + if (infoPtr->dwStyle & ACS_TRANSPARENT) + infoPtr->hbrushBG = (HBRUSH)SendMessageW(infoPtr->hwndNotify, + WM_CTLCOLORSTATIC, + wParam, (LPARAM)infoPtr->hwndSelf); if (wParam) { @@ -913,48 +928,50 @@ } else { - PAINTSTRUCT ps; - HDC hDC = BeginPaint(hWnd, &ps); + PAINTSTRUCT ps; + HDC hDC = BeginPaint(infoPtr->hwndSelf, &ps); EnterCriticalSection(&infoPtr->cs); ANIMATE_PaintFrame(infoPtr, hDC); LeaveCriticalSection(&infoPtr->cs); - EndPaint(hWnd, &ps); - } + EndPaint(infoPtr->hwndSelf, &ps); + } } - break; + break; case WM_SIZE: - return ANIMATE_Size(hWnd, wParam, lParam); + if (infoPtr->dwStyle & ACS_CENTER) + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); default: if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA(hWnd, uMsg, wParam, lParam); + return DefWindowProcW(hWnd, uMsg, wParam, lParam); } return 0; } void ANIMATE_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = ANIMATE_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(ANIMATE_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); - wndClass.lpszClassName = ANIMATE_CLASSA; + wndClass.lpszClassName = ANIMATE_CLASSW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } void ANIMATE_Unregister(void) { - UnregisterClassA(ANIMATE_CLASSA, NULL); + UnregisterClassW(ANIMATE_CLASSW, NULL); } diff -urN wine-20050310/dlls/comctl32/comboex.c wine-20050419/dlls/comctl32/comboex.c --- wine-20050310/dlls/comctl32/comboex.c 2005-01-09 17:42:54.000000000 +0100 +++ wine-20050419/dlls/comctl32/comboex.c 2005-03-23 14:15:21.000000000 +0100 @@ -121,7 +121,11 @@ /* Offset between image and text */ #define CBE_SEP 4 -#define COMBOEX_SUBCLASS_PROP "CCComboEx32SubclassInfo" +static const WCHAR COMBOEX_SUBCLASS_PROP[] = { + 'C','C','C','o','m','b','o','E','x','3','2', + 'S','u','b','c','l','a','s','s','I','n','f','o',0 +}; + #define COMBOEX_GetInfoPtr(hwnd) ((COMBOEX_INFO *)GetWindowLongPtrW (hwnd, 0)) @@ -317,13 +321,14 @@ static void COMBOEX_GetComboFontSize (COMBOEX_INFO *infoPtr, SIZE *size) { + static const WCHAR strA[] = { 'A', 0 }; HFONT nfont, ofont; HDC mydc; mydc = GetDC (0); /* why the entire screen???? */ nfont = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); ofont = (HFONT) SelectObject (mydc, nfont); - GetTextExtentPointA (mydc, "A", 1, size); + GetTextExtentPointW (mydc, strA, 1, size); SelectObject (mydc, ofont); ReleaseDC (0, mydc); TRACE("selected font hwnd=%p, height=%ld\n", nfont, size->cy); @@ -949,7 +954,7 @@ /* Native version of ComboEx creates the ComboBox with DROPDOWNLIST */ /* specified. It then creates it's own version of the EDIT control */ /* and makes the ComboBox the parent. This is because a normal */ - /* DROPDOWNLIST does not have a EDIT control, but we need one. */ + /* DROPDOWNLIST does not have an EDIT control, but we need one. */ /* We also need to place the edit control at the proper location */ /* (allow space for the icons). */ @@ -976,7 +981,7 @@ * Setup a property to hold the pointer to the COMBOBOXEX * data structure. */ - SetPropA(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); + SetPropW(infoPtr->hwndCombo, COMBOEX_SUBCLASS_PROP, hwnd); infoPtr->prevComboWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndCombo, GWLP_WNDPROC, (DWORD_PTR)COMBOEX_ComboWndProc); infoPtr->font = (HFONT)SendMessageW (infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -1005,7 +1010,7 @@ * Setup a property to hold the pointer to the COMBOBOXEX * data structure. */ - SetPropA(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); + SetPropW(infoPtr->hwndEdit, COMBOEX_SUBCLASS_PROP, hwnd); infoPtr->prevEditWndProc = (WNDPROC)SetWindowLongPtrW(infoPtr->hwndEdit, GWLP_WNDPROC, (DWORD_PTR)COMBOEX_EditWndProc); infoPtr->font = (HFONT)SendMessageW(infoPtr->hwndCombo, WM_GETFONT, 0, 0); @@ -1547,11 +1552,12 @@ static LRESULT COMBOEX_MeasureItem (COMBOEX_INFO *infoPtr, MEASUREITEMSTRUCT *mis) { + static const WCHAR strW[] = { 'W', 0 }; SIZE mysize; HDC hdc; hdc = GetDC (0); - GetTextExtentPointA (hdc, "W", 1, &mysize); + GetTextExtentPointW (hdc, strW, 1, &mysize); ReleaseDC (0, hdc); mis->itemHeight = mysize.cy + CBE_EXTRA; @@ -1647,7 +1653,7 @@ static LRESULT WINAPI COMBOEX_EditWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; WCHAR edit_text[260]; @@ -1694,7 +1700,7 @@ case VK_ESCAPE: /* native version seems to do following for COMBOEX */ /* - * GetWindowTextA(Edit,&?, 0x104) x + * GetWindowTextW(Edit,&?, 0x104) x * CB_GETCURSEL to Combo rets -1 x * WM_NOTIFY to COMBOEX parent (rebar) x * (CBEN_ENDEDIT{A|W} @@ -1735,7 +1741,7 @@ case VK_RETURN: /* native version seems to do following for COMBOEX */ /* - * GetWindowTextA(Edit,&?, 0x104) x + * GetWindowTextW(Edit,&?, 0x104) x * CB_GETCURSEL to Combo rets -1 x * CB_GETCOUNT to Combo rets 0 * if >0 loop @@ -1846,7 +1852,7 @@ static LRESULT WINAPI COMBOEX_ComboWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND hwndComboex = (HWND)GetPropA(hwnd, COMBOEX_SUBCLASS_PROP); + HWND hwndComboex = (HWND)GetPropW(hwnd, COMBOEX_SUBCLASS_PROP); COMBOEX_INFO *infoPtr = COMBOEX_GetInfoPtr (hwndComboex); NMCBEENDEDITW cbeend; NMMOUSE nmmse; @@ -1955,7 +1961,7 @@ * Native does: * * GetFocus() retns AA - * GetWindowTextA(Edit) + * GetWindowTextW(Edit) * CB_GETCURSEL(Combo) (got -1) * WM_NOTIFY(CBEN_ENDEDITA) with CBENF_KILLFOCUS * CB_GETCURSEL(Combo) (got -1) @@ -2019,7 +2025,7 @@ INT selected = SendMessageW (infoPtr->hwndCombo, CB_GETCURSEL, 0, 0); - /* lstrlenA( lastworkingURL ) */ + /* lstrlenW( lastworkingURL ) */ GetWindowTextW (infoPtr->hwndEdit, edit_text, 260); if (selected == -1) { diff -urN wine-20050310/dlls/comctl32/comctl32undoc.c wine-20050419/dlls/comctl32/comctl32undoc.c --- wine-20050310/dlls/comctl32/comctl32undoc.c 2004-12-20 20:27:07.000000000 +0100 +++ wine-20050419/dlls/comctl32/comctl32undoc.c 2005-03-24 16:07:23.000000000 +0100 @@ -88,6 +88,8 @@ typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM); +static const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 }; + /************************************************************************** * DPA_LoadStream [COMCTL32.9] * @@ -558,7 +560,7 @@ BOOL isUnicode; /* is compare fn Unicode */ DWORD wineFlags; /* internal flags */ DWORD cursize; /* current size of realMRU */ - LPSTR realMRU; /* pointer to string of index names */ + LPWSTR realMRU; /* pointer to string of index names */ LPWINEMRUITEM *array; /* array of pointers to data */ /* in 'a' to 'z' order */ } WINEMRULIST, *LPWINEMRULIST; @@ -603,12 +605,12 @@ } if (mp->wineFlags & WMRUF_CHANGED) { mp->wineFlags &= ~WMRUF_CHANGED; - err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, - mp->realMRU, strlen(mp->realMRU) + 1); + err = RegSetValueExW(newkey, strMRUList, 0, REG_SZ, (LPBYTE)mp->realMRU, + (strlenW(mp->realMRU) + 1)*sizeof(WCHAR)); if (err) { ERR("error saving MRUList, err=%d\n", err); } - TRACE("saving MRUList=/%s/\n", mp->realMRU); + TRACE("saving MRUList=/%s/\n", debugstr_w(mp->realMRU)); } realname[1] = 0; for(i=0; icursize; i++) { @@ -768,7 +770,7 @@ if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) { /* Item exists, just move it to the front */ - LPSTR pos = strchr(mp->realMRU, replace + 'a'); + LPWSTR pos = strchrW(mp->realMRU, replace + 'a'); while (pos > mp->realMRU) { pos[0] = pos[-1]; @@ -961,7 +963,7 @@ /* get space to save indices that will turn into names * but in order of most to least recently used */ - mp->realMRU = Alloc(mp->extview.nMaxItems + 2); + mp->realMRU = Alloc((mp->extview.nMaxItems + 2) * sizeof(WCHAR)); /* get space to save pointers to actual data in order of * 'a' to 'z' (0 to n). @@ -988,14 +990,14 @@ /* get values from key 'MRUList' */ if (newkey) { datasize = mp->extview.nMaxItems + 1; - if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, - &datasize))) { + if((err=RegQueryValueExW( newkey, strMRUList, 0, &type, + (LPBYTE)mp->realMRU, &datasize))) { /* not present - set size to 1 (will become 0 later) */ datasize = 1; *mp->realMRU = 0; } - TRACE("MRU list = %s, datasize = %ld\n", mp->realMRU, datasize); + TRACE("MRU list = %s, datasize = %ld\n", debugstr_w(mp->realMRU), datasize); mp->cursize = datasize - 1; /* datasize now has number of items in the MRUList */ @@ -1824,7 +1826,7 @@ if (!hdpaNew) { /* create a new DPA */ - hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpaTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpaTemp)); hdpaTemp->hHeap = hdpa->hHeap; hdpaTemp->nGrow = hdpa->nGrow; @@ -1844,8 +1846,7 @@ nNewItems = hdpaTemp->nGrow * ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1); nSize = nNewItems * sizeof(LPVOID); - hdpaTemp->ptrs = - (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); + hdpaTemp->ptrs = HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); hdpaTemp->nMaxCount = nNewItems; /* clone the pointer array */ @@ -1985,9 +1986,9 @@ INT nSize = nNewItems * sizeof(LPVOID); if (hdpa->ptrs) - lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); + lpTemp = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); else - lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize); + lpTemp = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize); if (!lpTemp) return FALSE; @@ -2046,7 +2047,7 @@ if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount); nSize = nNewItems * sizeof(LPVOID); - lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + lpDest = HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize); if (!lpDest) return NULL; @@ -2083,7 +2084,7 @@ hdpa->nItemCount = 0; hdpa->nMaxCount = hdpa->nGrow * 2; - hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, + hdpa->ptrs = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->nMaxCount * sizeof(LPVOID)); return TRUE; @@ -2280,7 +2281,7 @@ TRACE("(%d %p)\n", nGrow, hHeap); if (hHeap) - hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa)); + hdpa = HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa)); else hdpa = Alloc (sizeof(*hdpa)); @@ -2367,7 +2368,7 @@ lpNmh->code = uCode; } - return SendMessageA (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh); + return SendMessageW (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh); } diff -urN wine-20050310/dlls/comctl32/comctl_Sv.rc wine-20050419/dlls/comctl32/comctl_Sv.rc --- wine-20050310/dlls/comctl32/comctl_Sv.rc 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/comctl32/comctl_Sv.rc 2005-04-13 13:04:49.000000000 +0200 @@ -0,0 +1,87 @@ +/* + * Copyright 2005 Andreas Bjerkeholt + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT + +IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 +STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Egenskaper för " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP + PUSHBUTTON "Avbryt", IDCANCEL,58,122,50,14 + PUSHBUTTON "&Verkställ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "Hjälp", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 +END + + +IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Guide" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Slutför", IDC_FINISH_BUTTON,121,138,50,14 + DEFPUSHBUTTON "&Nästa >", IDC_NEXT_BUTTON,121,138,50,14 + PUSHBUTTON "< &Föregående", IDC_BACK_BUTTON,71,138,50,14 + PUSHBUTTON "Avbryt", IDCANCEL,178,138,50,14 + PUSHBUTTON "Hjälp", IDHELP,235,138,50,14,WS_GROUP + LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 + LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE +END + + +IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Anpassa verktygsfältet" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "&Stäng", IDCANCEL,308,6,44,14 + PUSHBUTTON "&Återställ", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&Hjälp", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Flytta &upp", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "Flytta &ned", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "T&illgängliga knappar:", -1,4,5,84,10 + LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "&Lägg till ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- &Ta bort", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "Knappar i v&erktygsfältet:", -1,182,5,85,10 + LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +END + +STRINGTABLE DISCARDABLE +{ + IDS_CLOSE "Stäng" +} + +STRINGTABLE DISCARDABLE +{ + IDM_TODAY "Idag:" + IDM_GOTODAY "Gå till idag" +} + +STRINGTABLE DISCARDABLE +{ + IDS_SEPARATOR "Separator" +} + +STRINGTABLE DISCARDABLE +{ + HKY_NONE "Ingen" +} diff -urN wine-20050310/dlls/comctl32/commctrl.c wine-20050419/dlls/comctl32/commctrl.c --- wine-20050310/dlls/comctl32/commctrl.c 2005-01-04 21:39:55.000000000 +0100 +++ wine-20050419/dlls/comctl32/commctrl.c 2005-03-25 21:49:00.000000000 +0100 @@ -118,7 +118,7 @@ LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -LPSTR COMCTL32_aSubclass = NULL; +LPWSTR COMCTL32_wSubclass = NULL; HMODULE COMCTL32_hModule = 0; LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); HBRUSH COMCTL32_hPattern55AABrush = NULL; @@ -132,6 +132,9 @@ 0x5555, 0xaaaa, 0x5555, 0xaaaa }; +static const WCHAR strCC32SubclassInfo[] = { + 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0 +}; /*********************************************************************** * DllMain [Internal] @@ -159,8 +162,8 @@ COMCTL32_hModule = (HMODULE)hinstDLL; /* add global subclassing atom (used by 'tooltip' and 'updown') */ - COMCTL32_aSubclass = (LPSTR)(DWORD)GlobalAddAtomA ("CC32SubclassInfo"); - TRACE("Subclassing atom added: %p\n", COMCTL32_aSubclass); + COMCTL32_wSubclass = (LPWSTR)(DWORD)GlobalAddAtomW (strCC32SubclassInfo); + TRACE("Subclassing atom added: %p\n", COMCTL32_wSubclass); /* create local pattern brush */ COMCTL32_hPattern55AABitmap = CreateBitmap (8, 8, 1, 1, wPattern55AA); @@ -217,9 +220,9 @@ COMCTL32_hPattern55AABitmap = NULL; /* delete global subclassing atom */ - GlobalDeleteAtom (LOWORD(COMCTL32_aSubclass)); - TRACE("Subclassing atom deleted: %p\n", COMCTL32_aSubclass); - COMCTL32_aSubclass = NULL; + GlobalDeleteAtom (LOWORD(COMCTL32_wSubclass)); + TRACE("Subclassing atom deleted: %p\n", COMCTL32_wSubclass); + COMCTL32_wSubclass = NULL; break; } @@ -274,7 +277,7 @@ if ((HIWORD(wParam) == 0xFFFF) && (lParam == 0)) { /* menu was closed */ TRACE("menu was closed!\n"); - SendMessageA (hwndStatus, SB_SIMPLE, FALSE, 0); + SendMessageW (hwndStatus, SB_SIMPLE, FALSE, 0); } else { /* menu item was selected */ @@ -285,14 +288,14 @@ TRACE("uMenuID = %u\n", uMenuID); if (uMenuID) { - CHAR szText[256]; + WCHAR szText[256]; - if (!LoadStringA (hInst, uMenuID, szText, 256)) + if (!LoadStringW (hInst, uMenuID, szText, sizeof(szText)/sizeof(szText[0]))) szText[0] = '\0'; - SendMessageA (hwndStatus, SB_SETTEXTA, + SendMessageW (hwndStatus, SB_SETTEXTW, 255 | SBT_NOBORDERS, (LPARAM)szText); - SendMessageA (hwndStatus, SB_SIMPLE, TRUE, 0); + SendMessageW (hwndStatus, SB_SIMPLE, TRUE, 0); } } break; @@ -425,7 +428,7 @@ return; lpRun++; hwndCtrl = GetDlgItem (hwnd, *lpRun); - if (GetWindowLongA (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { + if (GetWindowLongW (hwndCtrl, GWL_STYLE) & WS_VISIBLE) { TRACE("control id 0x%x\n", *lpRun); GetWindowRect (hwndCtrl, &rcCtrl); MapWindowPoints (NULL, hwnd, (LPPOINT)&rcCtrl, 2); @@ -511,12 +514,12 @@ if ( text ) { if ( (len = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 )) ) { - if ( (textW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )) ) + if ( (textW = Alloc( len * sizeof(WCHAR) )) ) MultiByteToWideChar( CP_ACP, 0, text, -1, textW, len ); } } DrawStatusTextW( hdc, lprc, textW, style ); - HeapFree( GetProcessHeap(), 0, textW ); + Free( textW ); } @@ -603,12 +606,12 @@ HWND buddy, INT maxVal, INT minVal, INT curVal) { HWND hUD = - CreateWindowA (UPDOWN_CLASSA, 0, style, x, y, cx, cy, + CreateWindowW (UPDOWN_CLASSW, 0, style, x, y, cx, cy, parent, (HMENU)id, inst, 0); if (hUD) { - SendMessageA (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0); - SendMessageA (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); - SendMessageA (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); + SendMessageW (hUD, UDM_SETBUDDY, (WPARAM)buddy, 0); + SendMessageW (hUD, UDM_SETRANGE, 0, MAKELONG(maxVal, minVal)); + SendMessageW (hUD, UDM_SETPOS, 0, MAKELONG(curVal, 0)); } return hUD; @@ -764,13 +767,12 @@ HWND hwndTB; hwndTB = - CreateWindowExA(0, TOOLBARCLASSNAMEA, NULL, style|WS_CHILD, 0,0,100,30, + CreateWindowExW(0, TOOLBARCLASSNAMEW, NULL, style|WS_CHILD, 0,0,100,30, hwnd, (HMENU)wID, COMCTL32_hModule, NULL); if(hwndTB) { TBADDBITMAP tbab; - SendMessageA (hwndTB, TB_BUTTONSTRUCTSIZE, - (WPARAM)uStructSize, 0); + SendMessageW (hwndTB, TB_BUTTONSTRUCTSIZE, (WPARAM)uStructSize, 0); /* set bitmap and button size */ /*If CreateToolbarEx receives 0, windows sets default values*/ @@ -778,29 +780,28 @@ dxBitmap = 16; if (dyBitmap <= 0) dyBitmap = 15; - SendMessageA (hwndTB, TB_SETBITMAPSIZE, 0, - MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap)); + SendMessageW (hwndTB, TB_SETBITMAPSIZE, 0, + MAKELPARAM((WORD)dxBitmap, (WORD)dyBitmap)); if (dxButton <= 0) dxButton = 24; if (dyButton <= 0) dyButton = 22; - SendMessageA (hwndTB, TB_SETBUTTONSIZE, 0, - MAKELPARAM((WORD)dxButton, (WORD)dyButton)); + SendMessageW (hwndTB, TB_SETBUTTONSIZE, 0, + MAKELPARAM((WORD)dxButton, (WORD)dyButton)); /* add bitmaps */ if (nBitmaps > 0) { - tbab.hInst = hBMInst; - tbab.nID = wBMID; + tbab.hInst = hBMInst; + tbab.nID = wBMID; - SendMessageA (hwndTB, TB_ADDBITMAP, - (WPARAM)nBitmaps, (LPARAM)&tbab); + SendMessageW (hwndTB, TB_ADDBITMAP, (WPARAM)nBitmaps, (LPARAM)&tbab); } /* add buttons */ if(iNumButtons > 0) - SendMessageA (hwndTB, TB_ADDBUTTONSA, + SendMessageW (hwndTB, TB_ADDBUTTONSW, (WPARAM)iNumButtons, (LPARAM)lpButtons); } @@ -856,7 +857,7 @@ sysColorMap = (LPCOLORMAP)internalColorMap; } - hRsrc = FindResourceA (hInstance, (LPSTR)idBitmap, (LPSTR)RT_BITMAP); + hRsrc = FindResourceW (hInstance, (LPWSTR)idBitmap, (LPWSTR)RT_BITMAP); if (hRsrc == 0) return 0; hglb = LoadResource (hInstance, hRsrc); @@ -1103,16 +1104,15 @@ * from there. */ /* See if we have been called for this window */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { /* allocate stack */ - stack = (LPSUBCLASS_INFO)HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(SUBCLASS_INFO)); + stack = Alloc (sizeof(SUBCLASS_INFO)); if (!stack) { ERR ("Failed to allocate our Subclassing stack\n"); return FALSE; } - SetPropA (hWnd, COMCTL32_aSubclass, (HANDLE)stack); + SetPropW (hWnd, COMCTL32_wSubclass, (HANDLE)stack); /* set window procedure to our own and save the current one */ if (IsWindowUnicode (hWnd)) @@ -1136,15 +1136,15 @@ } } - proc = HeapAlloc(GetProcessHeap(), 0, sizeof(SUBCLASSPROCS)); + proc = Alloc(sizeof(SUBCLASSPROCS)); if (!proc) { ERR ("Failed to allocate subclass entry in stack\n"); if (IsWindowUnicode (hWnd)) SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); + Free (stack); + RemovePropW( hWnd, COMCTL32_wSubclass ); return FALSE; } @@ -1183,7 +1183,7 @@ TRACE ("(%p, %p, %x, %p)\n", hWnd, pfnSubclass, uID, pdwRef); /* See if we have been called for this window */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; @@ -1226,7 +1226,7 @@ TRACE ("(%p, %p, %x)\n", hWnd, pfnSubclass, uID); /* Find the Subclass to remove */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) return FALSE; @@ -1243,7 +1243,7 @@ if (stack->stackpos == proc) stack->stackpos = stack->stackpos->next; - HeapFree (GetProcessHeap (), 0, proc); + Free (proc); ret = TRUE; break; } @@ -1258,8 +1258,8 @@ SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); + Free (stack); + RemovePropW( hWnd, COMCTL32_wSubclass ); } return ret; @@ -1279,7 +1279,7 @@ TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; @@ -1300,8 +1300,8 @@ SetWindowLongPtrW (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); else SetWindowLongPtrA (hWnd, GWLP_WNDPROC, (DWORD_PTR)stack->origproc); - HeapFree (GetProcessHeap (), 0, stack); - RemovePropA( hWnd, COMCTL32_aSubclass ); + Free (stack); + RemovePropW( hWnd, COMCTL32_wSubclass ); } return ret; } @@ -1330,7 +1330,7 @@ TRACE ("(%p, 0x%08x, 0x%08x, 0x%08lx)\n", hWnd, uMsg, wParam, lParam); /* retrieve our little stack from the Properties */ - stack = (LPSUBCLASS_INFO)GetPropA (hWnd, COMCTL32_aSubclass); + stack = (LPSUBCLASS_INFO)GetPropW (hWnd, COMCTL32_wSubclass); if (!stack) { ERR ("Our sub classing stack got erased for %p!! Nothing we can do\n", hWnd); return 0; @@ -1374,7 +1374,7 @@ { HWND hwndToolTip; - hwndToolTip = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0, + hwndToolTip = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndOwner, 0, 0, 0); @@ -1390,9 +1390,9 @@ nmttc.hdr.code = NM_TOOLTIPSCREATED; nmttc.hwndToolTips = hwndToolTip; - SendMessageA(GetParent(hwndTrueOwner), WM_NOTIFY, + SendMessageW(GetParent(hwndTrueOwner), WM_NOTIFY, (WPARAM)GetWindowLongPtrW(hwndTrueOwner, GWLP_ID), - (LPARAM)&nmttc); + (LPARAM)&nmttc); } return hwndToolTip; diff -urN wine-20050310/dlls/comctl32/datetime.c wine-20050419/dlls/comctl32/datetime.c --- wine-20050310/dlls/comctl32/datetime.c 2005-01-09 17:42:54.000000000 +0100 +++ wine-20050419/dlls/comctl32/datetime.c 2005-04-18 11:52:18.000000000 +0200 @@ -82,6 +82,7 @@ int *buflen; WCHAR textbuf[256]; POINT monthcal_pos; + int pendingUpdown; } DATETIME_INFO, *LPDATETIME_INFO; /* in monthcal.c */ @@ -256,7 +257,7 @@ if (infoPtr->dwStyle & DTS_LONGDATEFORMAT) format_item = LOCALE_SLONGDATE; - else if (infoPtr->dwStyle & DTS_TIMEFORMAT) + else if ((infoPtr->dwStyle & DTS_TIMEFORMAT) == DTS_TIMEFORMAT) format_item = LOCALE_STIMEFORMAT; else /* DTS_SHORTDATEFORMAT */ format_item = LOCALE_SSHORTDATE; @@ -265,6 +266,7 @@ } DATETIME_UseFormat (infoPtr, lpszFormat); + InvalidateRect (infoPtr->hwndSelf, NULL, TRUE); return infoPtr->nrFields; } @@ -338,10 +340,22 @@ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDAYNAME1+(date.wDayOfWeek+6)%7, result, resultSize); break; case ONEDIGIT12HOUR: - wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0)); + if (date.wHour == 0) { + result[0] = '1'; + result[1] = '2'; + result[2] = 0; + } + else + wsprintfW (result, fmt_dW, date.wHour - (date.wHour > 12 ? 12 : 0)); break; case TWODIGIT12HOUR: - wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0)); + if (date.wHour == 0) { + result[0] = '1'; + result[1] = '2'; + result[2] = 0; + } + else + wsprintfW (result, fmt__2dW, date.wHour - (date.wHour > 12 ? 12 : 0)); break; case ONEDIGIT24HOUR: wsprintfW (result, fmt_dW, date.wHour); @@ -405,6 +419,19 @@ TRACE ("arg%d=%x->[%s]\n", count, infoPtr->fieldspec[count], debugstr_w(result)); } +/* Offsets of days in the week to the weekday of january 1 in a leap year. */ +static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; + +/* returns the day in the week(0 == sunday, 6 == saturday) */ +/* day(1 == 1st, 2 == 2nd... etc), year is the year value */ +static int DATETIME_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year) +{ + year-=(month < 3); + + return((year + year/4 - year/100 + year/400 + + DayOfWeekTable[month-1] + day ) % 7); +} + static int wrap(int val, int delta, int minVal, int maxVal) { val += delta; @@ -428,12 +455,14 @@ case TWODIGITYEAR: case FULLYEAR: date->wYear = wrap(date->wYear, delta, 1752, 9999); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear); break; case ONEDIGITMONTH: case TWODIGITMONTH: case THREECHARMONTH: case FULLMONTH: date->wMonth = wrap(date->wMonth, delta, 1, 12); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear); delta = 0; /* fall through */ case ONEDIGITDAY: @@ -441,6 +470,7 @@ case THREECHARDAY: case FULLDAY: date->wDay = wrap(date->wDay, delta, 1, MONTHCAL_MonthLength(date->wMonth, date->wYear)); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek(date->wDay,date->wMonth,date->wYear); break; case ONELETTERAMPM: case TWOLETTERAMPM: @@ -481,6 +511,92 @@ } +static void +DATETIME_ReturnFieldWidth (DATETIME_INFO *infoPtr, HDC hdc, int count, SHORT *fieldWidthPtr) +{ + /* fields are a fixed width, determined by the largest possible string */ + /* presumably, these widths should be language dependent */ + static const WCHAR fld_d1W[] = { '2', 0 }; + static const WCHAR fld_d2W[] = { '2', '2', 0 }; + static const WCHAR fld_d4W[] = { '2', '2', '2', '2', 0 }; + static const WCHAR fld_am1[] = { 'A', 0 }; + static const WCHAR fld_am2[] = { 'A', 'M', 0 }; + static const WCHAR fld_day[] = { 'W', 'e', 'd', 'n', 'e', 's', 'd', 'a', 'y', 0 }; + static const WCHAR fld_day3[] = { 'W', 'e', 'd', 0 }; + static const WCHAR fld_mon[] = { 'S', 'e', 'p', 't', 'e', 'm', 'b', 'e', 'r', 0 }; + static const WCHAR fld_mon3[] = { 'D', 'e', 'c', 0 }; + int spec; + WCHAR buffer[80], *bufptr; + SIZE size; + + TRACE ("%d,%d\n", infoPtr->nrFields, count); + if (count>infoPtr->nrFields || count < 0) { + WARN ("buffer overrun, have %d want %d\n", infoPtr->nrFields, count); + return; + } + + if (!infoPtr->fieldspec) return; + + spec = infoPtr->fieldspec[count]; + if (spec & DT_STRING) { + int txtlen = infoPtr->buflen[count]; + + if (txtlen > 79) + txtlen = 79; + memcpy (buffer, infoPtr->textbuf + (spec &~ DT_STRING), txtlen * sizeof(WCHAR)); + buffer[txtlen] = 0; + bufptr = buffer; + } + else { + switch (spec) { + case ONEDIGITDAY: + case ONEDIGIT12HOUR: + case ONEDIGIT24HOUR: + case ONEDIGITSECOND: + case ONEDIGITMINUTE: + case ONEDIGITMONTH: + case ONEDIGITYEAR: + /* these seem to use a two byte field */ + case TWODIGITDAY: + case TWODIGIT12HOUR: + case TWODIGIT24HOUR: + case TWODIGITSECOND: + case TWODIGITMINUTE: + case TWODIGITMONTH: + case TWODIGITYEAR: + bufptr = (WCHAR *)fld_d2W; + break; + case INVALIDFULLYEAR: + case FULLYEAR: + bufptr = (WCHAR *)fld_d4W; + break; + case THREECHARDAY: + bufptr = (WCHAR *)fld_day3; + break; + case FULLDAY: + bufptr = (WCHAR *)fld_day; + break; + case THREECHARMONTH: + bufptr = (WCHAR *)fld_mon3; + break; + case FULLMONTH: + bufptr = (WCHAR *)fld_mon; + break; + case ONELETTERAMPM: + bufptr = (WCHAR *)fld_am1; + break; + case TWOLETTERAMPM: + bufptr = (WCHAR *)fld_am2; + break; + default: + bufptr = (WCHAR *)fld_d1W; + break; + } + } + GetTextExtentPoint32W (hdc, bufptr, strlenW(bufptr), &size); + *fieldWidthPtr = size.cx; +} + static void DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc) { @@ -491,6 +607,7 @@ RECT *checkbox = &infoPtr->checkbox; SIZE size; COLORREF oldTextColor; + SHORT fieldWidth; /* draw control edge */ TRACE("\n"); @@ -509,9 +626,10 @@ for (i = 0; i < infoPtr->nrFields; i++) { DATETIME_ReturnTxt (infoPtr, i, txt, sizeof(txt)/sizeof(txt[0])); GetTextExtentPoint32W (hdc, txt, strlenW(txt), &size); + DATETIME_ReturnFieldWidth (infoPtr, hdc, i, &fieldWidth); field = &infoPtr->fieldRect[i]; field->left = prevright; - field->right = prevright+size.cx; + field->right = prevright + fieldWidth; field->top = rcDraw->top; field->bottom = rcDraw->bottom; prevright = field->right; @@ -720,12 +838,17 @@ ShowWindow(infoPtr->hMonthCal, SW_HIDE); infoPtr->dateValid = TRUE; SendMessageW (infoPtr->hMonthCal, MCM_GETCURSEL, 0, (LPARAM)&infoPtr->date); - TRACE("got from calendar %04d/%02d/%02d\n", - infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay); + TRACE("got from calendar %04d/%02d/%02d day of week %d\n", + infoPtr->date.wYear, infoPtr->date.wMonth, infoPtr->date.wDay, infoPtr->date.wDayOfWeek); SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0); InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); DATETIME_SendDateTimeChangeNotify (infoPtr); } + if ((lpnmh->hwndFrom == infoPtr->hUpdown) && (lpnmh->code == UDN_DELTAPOS)) { + LPNMUPDOWN lpnmud = (LPNMUPDOWN)lpnmh; + TRACE("Delta pos %d\n", lpnmud->iDelta); + infoPtr->pendingUpdown = lpnmud->iDelta; + } return 0; } @@ -743,6 +866,83 @@ FIXME ("Callbacks not implemented yet\n"); } + if (vkCode >= '0' && vkCode <= '9') { + /* this is a somewhat simplified version of what Windows does */ + SYSTEMTIME *date = &infoPtr->date; + switch (infoPtr->fieldspec[fieldNum]) { + case ONEDIGITYEAR: + case TWODIGITYEAR: + date->wYear = date->wYear - (date->wYear%100) + + (date->wYear%10)*10 + (vkCode-'0'); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case INVALIDFULLYEAR: + case FULLYEAR: + date->wYear = (date->wYear%1000)*10 + (vkCode-'0'); + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITMONTH: + case TWODIGITMONTH: + if ((date->wMonth%10) > 1 || (vkCode-'0') > 2) + date->wMonth = vkCode-'0'; + else + date->wMonth = (date->wMonth%10)*10+vkCode-'0'; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITDAY: + case TWODIGITDAY: + /* probably better checking here would help */ + if ((date->wDay%10) >= 3 && (vkCode-'0') > 1) + date->wDay = vkCode-'0'; + else + date->wDay = (date->wDay%10)*10+vkCode-'0'; + date->wDayOfWeek = DATETIME_CalculateDayOfWeek( + date->wDay,date->wMonth,date->wYear); + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGIT12HOUR: + case TWODIGIT12HOUR: + if ((date->wHour%10) > 1 || (vkCode-'0') > 2) + date->wHour = vkCode-'0'; + else + date->wHour = (date->wHour%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGIT24HOUR: + case TWODIGIT24HOUR: + if ((date->wHour%10) > 2) + date->wHour = vkCode-'0'; + else if ((date->wHour%10) == 2 && (vkCode-'0') > 3) + date->wHour = vkCode-'0'; + else + date->wHour = (date->wHour%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITMINUTE: + case TWODIGITMINUTE: + if ((date->wMinute%10) > 5) + date->wMinute = vkCode-'0'; + else + date->wMinute = (date->wMinute%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + case ONEDIGITSECOND: + case TWODIGITSECOND: + if ((date->wSecond%10) > 5) + date->wSecond = vkCode-'0'; + else + date->wSecond = (date->wSecond%10)*10+vkCode-'0'; + DATETIME_SendDateTimeChangeNotify (infoPtr); + break; + } + } + switch (vkCode) { case VK_ADD: case VK_UP: @@ -783,7 +983,31 @@ break; } - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); + + return 0; +} + + +static LRESULT +DATETIME_VScroll (DATETIME_INFO *infoPtr, WORD wScroll) +{ + int fieldNum = infoPtr->select & DTHT_DATEFIELD; + + if ((SHORT)LOWORD(wScroll) != SB_THUMBPOSITION) return 0; + if (!(infoPtr->haveFocus)) return 0; + if ((fieldNum==0) && (infoPtr->select)) return 0; + + if (infoPtr->pendingUpdown >= 0) { + DATETIME_IncreaseField (infoPtr, fieldNum, 1); + DATETIME_SendDateTimeChangeNotify (infoPtr); + } + else { + DATETIME_IncreaseField (infoPtr, fieldNum, -1); + DATETIME_SendDateTimeChangeNotify (infoPtr); + } + + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0; } @@ -874,13 +1098,21 @@ TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right); infoPtr->rcDraw = infoPtr->rcClient; - - /* set the size of the button that drops the calendar down */ - /* FIXME: account for style that allows button on left side */ - infoPtr->calbutton.top = infoPtr->rcDraw.top; - infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom; - infoPtr->calbutton.left = infoPtr->rcDraw.right-15; - infoPtr->calbutton.right = infoPtr->rcDraw.right; + + if (infoPtr->dwStyle & DTS_UPDOWN) { + SetWindowPos(infoPtr->hUpdown, NULL, + infoPtr->rcClient.right-14, 0, + 15, infoPtr->rcClient.bottom - infoPtr->rcClient.top, + SWP_NOACTIVATE | SWP_NOZORDER); + } + else { + /* set the size of the button that drops the calendar down */ + /* FIXME: account for style that allows button on left side */ + infoPtr->calbutton.top = infoPtr->rcDraw.top; + infoPtr->calbutton.bottom= infoPtr->rcDraw.bottom; + infoPtr->calbutton.left = infoPtr->rcDraw.right-15; + infoPtr->calbutton.right = infoPtr->rcDraw.right; + } /* set enable/disable button size for show none style being enabled */ /* FIXME: these dimensions are completely incorrect */ @@ -958,7 +1190,7 @@ 0, 0, 0, 0, infoPtr->hwndSelf, 0, 0, 0); /* initialize info structure */ - GetSystemTime (&infoPtr->date); + GetLocalTime (&infoPtr->date); infoPtr->dateValid = TRUE; infoPtr->hFont = GetStockObject(DEFAULT_GUI_FONT); @@ -1067,6 +1299,9 @@ case WM_LBUTTONUP: return DATETIME_LButtonUp (infoPtr, (WORD)wParam); + case WM_VSCROLL: + return DATETIME_VScroll (infoPtr, (WORD)wParam); + case WM_CREATE: return DATETIME_Create (hwnd, (LPCREATESTRUCTW)lParam); diff -urN wine-20050310/dlls/comctl32/flatsb.c wine-20050419/dlls/comctl32/flatsb.c --- wine-20050310/dlls/comctl32/flatsb.c 2005-01-09 17:42:54.000000000 +0100 +++ wine-20050419/dlls/comctl32/flatsb.c 2005-03-23 11:22:52.000000000 +0100 @@ -245,7 +245,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE)) - return DefWindowProcA( hwnd, uMsg, wParam, lParam ); + return DefWindowProcW( hwnd, uMsg, wParam, lParam ); switch (uMsg) { @@ -259,7 +259,7 @@ if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); } } @@ -267,23 +267,23 @@ VOID FLATSB_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS; wndClass.lpfnWndProc = FlatSB_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(FLATSB_INFO *); - wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wndClass.lpszClassName = FLATSB_CLASSA; + wndClass.lpszClassName = FLATSB_CLASSW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); } VOID FLATSB_Unregister (void) { - UnregisterClassA (FLATSB_CLASSA, NULL); + UnregisterClassW (FLATSB_CLASSW, NULL); } diff -urN wine-20050310/dlls/comctl32/header.c wine-20050419/dlls/comctl32/header.c --- wine-20050310/dlls/comctl32/header.c 2005-02-23 13:41:43.000000000 +0100 +++ wine-20050419/dlls/comctl32/header.c 2005-03-23 14:15:21.000000000 +0100 @@ -83,7 +83,7 @@ INT iHotItem; /* index of hot item (cursor is over this item) */ INT iMargin; /* width of the margin that surrounds a bitmap */ - HIMAGELIST himl; /* handle to a image list (may be 0) */ + HIMAGELIST himl; /* handle to an image list (may be 0) */ HEADER_ITEM *items; /* pointer to array of HEADER_ITEM's */ BOOL bRectsValid; /* validity flag for bounding rectangles */ } HEADER_INFO; @@ -174,7 +174,7 @@ if (r.right - r.left == 0) return phdi->rect.right; - if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) { + if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) { if (phdi->bDown) { DrawEdge (hdc, &r, BDR_RAISEDOUTER, BF_RECT | BF_FLAT | BF_MIDDLE | BF_ADJUST); @@ -200,7 +200,7 @@ dis.rcItem = r; dis.itemData = phdi->lParam; oldBkMode = SetBkMode(hdc, TRANSPARENT); - SendMessageA (infoPtr->hwndNotify, WM_DRAWITEM, + SendMessageW (infoPtr->hwndNotify, WM_DRAWITEM, (WPARAM)dis.CtlID, (LPARAM)&dis); if (oldBkMode != TRANSPARENT) SetBkMode(hdc, oldBkMode); @@ -218,7 +218,7 @@ HDC hdcBitmap; INT yD, yS, cx, cy, rx, ry; - GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); ry = r.bottom - r.top; rx = r.right - r.left; @@ -257,7 +257,7 @@ INT xD, yD, yS, cx, cy, rx, ry, tx; RECT textRect; - GetObjectA (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp); textRect = r; if (phdi->fmt & HDF_STRING) { @@ -385,7 +385,7 @@ if ((x <= rect.right) && (infoPtr->uNumItem > 0)) { rect.left = x; - if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) + if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) DrawEdge (hdc, &rect, EDGE_RAISED, BF_TOP|BF_LEFT|BF_BOTTOM|BF_SOFT); else DrawEdge (hdc, &rect, EDGE_ETCHED, BF_BOTTOM); @@ -558,7 +558,7 @@ nmhdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); nmhdr.code = code; - return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } @@ -587,7 +587,7 @@ nmitem.iOrder = infoPtr->items[iItem].iOrder; nmitem.iImage = infoPtr->items[iItem].iImage; - return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY, + return (BOOL)SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr); } @@ -1106,7 +1106,7 @@ lpLayout->pwpos->x = lpLayout->prc->left; lpLayout->pwpos->y = lpLayout->prc->top; lpLayout->pwpos->cx = lpLayout->prc->right - lpLayout->prc->left; - if (GetWindowLongA (hwnd, GWL_STYLE) & HDS_HIDDEN) + if (GetWindowLongW (hwnd, GWL_STYLE) & HDS_HIDDEN) lpLayout->pwpos->cy = 0; else { lpLayout->pwpos->cy = infoPtr->nHeight; @@ -1304,21 +1304,21 @@ HEADER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr; - TEXTMETRICA tm; + TEXTMETRICW tm; HFONT hOldFont; HDC hdc; infoPtr = (HEADER_INFO *)Alloc (sizeof(HEADER_INFO)); - SetWindowLongPtrA (hwnd, 0, (DWORD_PTR)infoPtr); + SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwndNotify = ((LPCREATESTRUCTA)lParam)->hwndParent; infoPtr->uNumItem = 0; infoPtr->hFont = 0; infoPtr->items = 0; infoPtr->bRectsValid = FALSE; - infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW); - infoPtr->hcurDivider = LoadCursorA (COMCTL32_hModule, MAKEINTRESOURCEA(IDC_DIVIDER)); - infoPtr->hcurDivopen = LoadCursorA (COMCTL32_hModule, MAKEINTRESOURCEA(IDC_DIVIDEROPEN)); + infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW); + infoPtr->hcurDivider = LoadCursorW (COMCTL32_hModule, MAKEINTRESOURCEW(IDC_DIVIDER)); + infoPtr->hcurDivopen = LoadCursorW (COMCTL32_hModule, MAKEINTRESOURCEW(IDC_DIVIDEROPEN)); infoPtr->bPressed = FALSE; infoPtr->bTracking = FALSE; infoPtr->iMoveItem = 0; @@ -1327,11 +1327,11 @@ infoPtr->bUnicode = IsWindowUnicode (hwnd); infoPtr->iMargin = 3*GetSystemMetrics(SM_CXEDGE); infoPtr->nNotifyFormat = - SendMessageA (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); + SendMessageW (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); hdc = GetDC (0); hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); - GetTextMetricsA (hdc, &tm); + GetTextMetricsW (hdc, &tm); infoPtr->nHeight = tm.tmHeight + VERT_BORDER; SelectObject (hdc, hOldFont); ReleaseDC (0, hdc); @@ -1359,8 +1359,8 @@ if (infoPtr->himl) ImageList_Destroy (infoPtr->himl); + SetWindowLongPtrW (hwnd, 0, 0); Free (infoPtr); - SetWindowLongPtrA (hwnd, 0, 0); return 0; } @@ -1385,7 +1385,7 @@ pt.y = (INT)HIWORD(lParam); HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem); - if ((GetWindowLongA (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER)) + if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER)) HEADER_SendHeaderNotify (hwnd, HDN_ITEMDBLCLICKA, nItem,0); else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) HEADER_SendHeaderNotify (hwnd, HDN_DIVIDERDBLCLICKA, nItem,0); @@ -1398,7 +1398,7 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); POINT pt; UINT flags; INT nItem; @@ -1452,7 +1452,7 @@ { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); /* - *DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + *DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); */ POINT pt; UINT flags; @@ -1551,7 +1551,7 @@ case NF_REQUERY: infoPtr->nNotifyFormat = - SendMessageA ((HWND)wParam, WM_NOTIFYFORMAT, + SendMessageW ((HWND)wParam, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_QUERY); return infoPtr->nNotifyFormat; } @@ -1564,7 +1564,7 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); POINT pt; UINT flags; INT nItem, nWidth; @@ -1661,7 +1661,7 @@ ClientToScreen(hwnd, &pt); /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */ - SendMessageA( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); + SendMessageW( hwnd, WM_CONTEXTMENU, (WPARAM) hwnd, MAKELPARAM(pt.x, pt.y)); return bRet; } @@ -1697,7 +1697,7 @@ HEADER_SetFont (HWND hwnd, WPARAM wParam, LPARAM lParam) { HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd); - TEXTMETRICA tm; + TEXTMETRICW tm; HFONT hFont, hOldFont; HDC hdc; @@ -1707,7 +1707,7 @@ hdc = GetDC (0); hOldFont = SelectObject (hdc, hFont); - GetTextMetricsA (hdc, &tm); + GetTextMetricsW (hdc, &tm); infoPtr->nHeight = tm.tmHeight + VERT_BORDER; SelectObject (hdc, hOldFont); ReleaseDC (0, hdc); @@ -1727,7 +1727,7 @@ { TRACE("hwnd=%p msg=%x wparam=%x lParam=%lx\n", hwnd, msg, wParam, lParam); if (!HEADER_GetInfoPtr (hwnd) && (msg != WM_CREATE)) - return DefWindowProcA (hwnd, msg, wParam, lParam); + return DefWindowProcW (hwnd, msg, wParam, lParam); switch (msg) { /* case HDM_CLEARFILTER: */ @@ -1857,22 +1857,22 @@ VOID HEADER_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = HEADER_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(HEADER_INFO *); - wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW); - wndClass.lpszClassName = WC_HEADERA; + wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); + wndClass.lpszClassName = WC_HEADERW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); } VOID HEADER_Unregister (void) { - UnregisterClassA (WC_HEADERA, NULL); + UnregisterClassW (WC_HEADERW, NULL); } diff -urN wine-20050310/dlls/comctl32/imagelist.c wine-20050419/dlls/comctl32/imagelist.c --- wine-20050310/dlls/comctl32/imagelist.c 2005-02-24 13:46:57.000000000 +0100 +++ wine-20050419/dlls/comctl32/imagelist.c 2005-03-25 21:49:00.000000000 +0100 @@ -1405,14 +1405,19 @@ TRACE("%p %d %d\n", himl, i, fStyle); if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL; - hdcDst = CreateCompatibleDC(0); - ii.fIcon = TRUE; ii.xHotspot = 0; ii.yHotspot = 0; + /* create colour bitmap */ + hdcDst = GetDC(0); + ii.hbmColor = CreateCompatibleBitmap(hdcDst, himl->cx, himl->cy); + ReleaseDC(0, hdcDst); + + hdcDst = CreateCompatibleDC(0); + /* draw mask*/ - ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy); + ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL); hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask); if (himl->hbmMask) { BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, @@ -1422,7 +1427,6 @@ PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); /* draw image*/ - ii.hbmColor = CreateCompatibleBitmap (himl->hdcImage, himl->cx, himl->cy); SelectObject (hdcDst, ii.hbmColor); BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, himl->hdcImage, i * himl->cx, 0, SRCCOPY); @@ -1594,11 +1598,11 @@ uType, uFlags); len = MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, NULL, 0); - lpbmpW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + lpbmpW = Alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpbmp, -1, lpbmpW, len); himl = ImageList_LoadImageW(hi, lpbmpW, cx, cGrow, clrMask, uType, uFlags); - HeapFree(GetProcessHeap(), 0, lpbmpW); + Free (lpbmpW); return himl; } @@ -2786,7 +2790,7 @@ BYTE temp; colors = 1 << himl->uBitsPixel; - bmi = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER) + + bmi = Alloc(sizeof(BITMAPINFOHEADER) + sizeof(PALETTEENTRY) * colors); pal = (LPPALETTEENTRY)bmi->bmiColors; @@ -2803,7 +2807,7 @@ } else { - bmi = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFOHEADER)); + bmi = Alloc(sizeof(BITMAPINFOHEADER)); } bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -2820,7 +2824,7 @@ hbmNewBitmap = CreateDIBSection(hdc, bmi, DIB_RGB_COLORS, &bits, 0, 0); - HeapFree(GetProcessHeap(), 0, bmi); + Free (bmi); } else /*if (ilc == ILC_COLORDDB)*/ { diff -urN wine-20050310/dlls/comctl32/listview.c wine-20050419/dlls/comctl32/listview.c --- wine-20050310/dlls/comctl32/listview.c 2005-02-21 21:38:31.000000000 +0100 +++ wine-20050419/dlls/comctl32/listview.c 2005-04-14 15:58:25.000000000 +0200 @@ -40,8 +40,7 @@ * * Bugs * -- Expand large item in ICON mode when the cursor is flying over the icon or text. - * -- Support CustonDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs. - * -- in LISTVIEW_AddGroupSelection, we would send LVN_ODSTATECHANGED + * -- Support CustomDraw options for _WIN32_IE >= 0x560 (see NMLVCUSTOMDRAW docs). * -- LVA_SNAPTOGRID not implemented * -- LISTVIEW_ApproximateViewRect partially implemented * -- LISTVIEW_[GS]etColumnOrderArray stubs @@ -98,7 +97,6 @@ * -- LVN_HOTTRACK * -- LVN_MARQUEEBEGIN * -- LVN_ODFINDITEM - * -- LVN_ODSTATECHANGED * -- LVN_SETDISPINFO * -- NM_HOVER * @@ -440,7 +438,7 @@ if (!isW && is_textT(text, isW)) { INT len = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, NULL, 0); - wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + wstr = Alloc(len * sizeof(WCHAR)); if (wstr) MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, wstr, len); } TRACE(" wstr=%s\n", text == LPSTR_TEXTCALLBACKW ? "(callback)" : debugstr_w(wstr)); @@ -449,7 +447,7 @@ static inline void textfreeT(LPWSTR wstr, BOOL isW) { - if (!isW && is_textT(wstr, isW)) HeapFree(GetProcessHeap(), 0, wstr); + if (!isW && is_textT(wstr, isW)) Free (wstr); } /* @@ -557,7 +555,7 @@ } else return "(null)"; } -static const char * debugscrollinfo(const SCROLLINFO *pScrollInfo) +static const char* debugscrollinfo(const SCROLLINFO *pScrollInfo) { char* buf = debug_getbuf(), *text = buf; int len, size = DEBUG_BUFFER_SIZE; @@ -852,8 +850,7 @@ *pdi->item.pszText = 0; /* make sure we don't process garbage */ } - pszTempBuf = HeapAlloc(GetProcessHeap(), 0, - (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax); + pszTempBuf = Alloc( (convertToUnicode ? sizeof(WCHAR) : sizeof(CHAR)) * cchTempBufMax); if (!pszTempBuf) return FALSE; if (convertToUnicode) @@ -886,7 +883,7 @@ savPszText, savCchTextMax); pdi->item.pszText = savPszText; /* restores our buffer */ pdi->item.cchTextMax = savCchTextMax; - HeapFree(GetProcessHeap(), 0, pszTempBuf); + Free (pszTempBuf); } return bResult; } @@ -1022,7 +1019,7 @@ * five versa, should leave the iterator at the same item: * prev * n, next * n = next * n, prev * n * - * The iterator has a notion of a out-of-order, special item, + * The iterator has a notion of an out-of-order, special item, * which sits at the start of the list. This is used in * LVS_ICON, and LVS_SMALLICON mode to handle the focused item, * which needs to be first, as it may overlap other items. @@ -2968,22 +2965,35 @@ { INT nFirst = min(infoPtr->nSelectionMark, nItem); INT nLast = max(infoPtr->nSelectionMark, nItem); - INT i; + NMLVODSTATECHANGE nmlv; LVITEMW item; + BOOL bOldChange; + INT i; + + /* Temporarily disable change notification + * If the control is LVS_OWNERDATA, we need to send + * only one LVN_ODSTATECHANGED notification. + * See MSDN documentation for LVN_ITEMCHANGED. + */ + bOldChange = infoPtr->bDoChangeNotify; + if (infoPtr->dwStyle & LVS_OWNERDATA) infoPtr->bDoChangeNotify = FALSE; if (nFirst == -1) nFirst = nItem; item.state = LVIS_SELECTED; item.stateMask = LVIS_SELECTED; - /* FIXME: this is not correct LVS_OWNERDATA - * setting the item states individually will generate - * a LVN_ITEMCHANGED notification for each one. Instead, - * we have to send a LVN_ODSTATECHANGED notification. - * See MSDN documentation for LVN_ITEMCHANGED. - */ for (i = nFirst; i <= nLast; i++) LISTVIEW_SetItemState(infoPtr,i,&item); + + ZeroMemory(&nmlv, sizeof(nmlv)); + nmlv.iFrom = nFirst; + nmlv.iTo = nLast; + nmlv.uNewState = 0; + nmlv.uOldState = item.state; + + notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv); + infoPtr->bDoChangeNotify = bOldChange; } @@ -7073,7 +7083,7 @@ bResult = LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE); /* - *update selection mark + * Update selection mark * * Investigation on windows 2k showed that selection mark was updated * whenever a new selection was made, but if the selected item was @@ -9547,7 +9557,7 @@ TRACE("(text=%s, ..., isW=%d)\n", debugtext_t(text, isW), isW); - style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|WS_BORDER; + style |= WS_CHILDWINDOW|WS_CLIPSIBLINGS|ES_LEFT|ES_AUTOHSCROLL|WS_BORDER; hdc = GetDC(infoPtr->hwndSelf); /* Select the font to get appropriate metric dimensions */ diff -urN wine-20050310/dlls/comctl32/monthcal.c wine-20050419/dlls/comctl32/monthcal.c --- wine-20050310/dlls/comctl32/monthcal.c 2005-01-11 11:43:03.000000000 +0100 +++ wine-20050419/dlls/comctl32/monthcal.c 2005-04-14 13:31:17.000000000 +0200 @@ -33,12 +33,11 @@ * TODO: * -- MCM_[GS]ETUNICODEFORMAT * -- MONTHCAL_GetMonthRange - * -- Unicodification * -- handle resources better (doesn't work now); * -- take care of internationalization. * -- keyboard handling. * -- GetRange: At the moment, we copy ranges anyway, regardless of - * infoPtr->rangeValid; a invalid range is simply filled + * infoPtr->rangeValid; an invalid range is simply filled * with zeros in SetRange. Is this the right behavior? * -- search for FIXME */ @@ -56,6 +55,7 @@ #include "winnls.h" #include "commctrl.h" #include "comctl32.h" +#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(monthcal); @@ -70,6 +70,8 @@ #define MC_NEXTMONTHTIMER 1 /* Timer ID's */ #define MC_PREVMONTHTIMER 2 +#define countof(arr) (sizeof(arr)/sizeof(arr[0])) + typedef struct { HWND hwndSelf; @@ -120,7 +122,7 @@ } MONTHCAL_INFO, *LPMONTHCAL_INFO; -/* Offsets of days in the week to the weekday of january 1. */ +/* Offsets of days in the week to the weekday of january 1 in a leap year */ static const int DayOfWeekTable[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4}; @@ -185,17 +187,17 @@ Need to find out if we're on a DST place & adjust the clock accordingly. Above function assumes we have a valid data. Valid for year>1752; 1 <= d <= 31, 1 <= m <= 12. - 0 = Monday. + 0 = Sunday. */ -/* returns the day in the week(0 == monday, 6 == sunday) */ +/* returns the day in the week(0 == sunday, 6 == saturday) */ /* day(1 == 1st, 2 == 2nd... etc), year is the year value */ static int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year) { year-=(month < 3); return((year + year/4 - year/100 + year/400 + - DayOfWeekTable[month-1] + day - 1 ) % 7); + DayOfWeekTable[month-1] + day ) % 7); } /* From a given point, calculate the row (weekpos), column(daypos) @@ -333,14 +335,15 @@ static void MONTHCAL_DrawDay(MONTHCAL_INFO *infoPtr, HDC hdc, int day, int month, int x, int y, int bold) { - char buf[10]; + static const WCHAR fmtW[] = { '%','d',0 }; + WCHAR buf[10]; RECT r; static int haveBoldFont, haveSelectedDay = FALSE; HBRUSH hbr; COLORREF oldCol = 0; COLORREF oldBk = 0; - sprintf(buf, "%d", day); + wsprintfW(buf, fmtW, day); /* No need to check styles: when selection is not valid, it is set to zero. * 1curSelDay) && (month==infoPtr->currentMonth)) @@ -400,6 +403,10 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps) { + static const WCHAR todayW[] = { 'T','o','d','a','y',':',0 }; + static const WCHAR fmt1W[] = { '%','s',' ','%','l','d',0 }; + static const WCHAR fmt2W[] = { '%','s',' ','%','s',0 }; + static const WCHAR fmt3W[] = { '%','d',0 }; RECT *title=&infoPtr->title; RECT *prev=&infoPtr->titlebtnprev; RECT *next=&infoPtr->titlebtnnext; @@ -413,9 +420,9 @@ SIZE size; HBRUSH hbr; HFONT currentFont; - char buf[20]; - char buf1[20]; - char buf2[32]; + WCHAR buf[20]; + WCHAR buf1[20]; + WCHAR buf2[32]; COLORREF oldTextColor, oldBkColor; DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE); RECT rcTemp; @@ -470,13 +477,13 @@ titlemonth->left = title->left; titlemonth->right = title->right; - GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, - buf1,sizeof(buf1)); - sprintf(buf, "%s %ld", buf1, infoPtr->currentYear); + GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, + buf1,countof(buf1)); + wsprintfW(buf, fmt1W, buf1, infoPtr->currentYear); if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth)) { - DrawTextA(hdc, buf, strlen(buf), titlemonth, + DrawTextW(hdc, buf, strlenW(buf), titlemonth, DT_CENTER | DT_VCENTER | DT_SINGLELINE); } @@ -486,10 +493,10 @@ * MCM_HitTestInfo wants month & year rects, so prepare these now. *(no, we can't draw them separately; the whole text is centered) */ - GetTextExtentPoint32A(hdc, buf, strlen(buf), &size); + GetTextExtentPoint32W(hdc, buf, strlenW(buf), &size); titlemonth->left = title->right / 2 - size.cx / 2; titleyear->right = title->right / 2 + size.cx / 2; - GetTextExtentPoint32A(hdc, buf1, strlen(buf1), &size); + GetTextExtentPoint32W(hdc, buf1, strlenW(buf1), &size); titlemonth->right = titlemonth->left + size.cx; titleyear->left = titlemonth->right; @@ -530,10 +537,8 @@ i = infoPtr->firstDay; for(j=0; j<7; j++) { - GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i +j)%7, - buf,sizeof(buf)); - DrawTextA(hdc, buf, strlen(buf), days, - DT_CENTER | DT_VCENTER | DT_SINGLELINE ); + GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SABBREVDAYNAME1 + (i+j+6)%7, buf, countof(buf)); + DrawTextW(hdc, buf, strlenW(buf), days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); days->left+=infoPtr->width_increment; days->right+=infoPtr->width_increment; } @@ -657,21 +662,21 @@ infoPtr->currentMonth); offset+=textWidth; } - if (!LoadStringA(COMCTL32_hModule,IDM_TODAY,buf1,sizeof(buf1))) + if (!LoadStringW(COMCTL32_hModule,IDM_TODAY,buf1,countof(buf1))) { WARN("Can't load resource\n"); - strcpy(buf1,"Today:"); + strcpyW(buf1, todayW); } MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6); MONTHCAL_CopyTime(&infoPtr->todaysDate,&localtime); - GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,sizeof(buf2)); - sprintf(buf, "%s %s", buf1,buf2); + GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,countof(buf2)); + wsprintfW(buf, fmt2W, buf1, buf2); SelectObject(hdc, infoPtr->hBoldFont); if(IntersectRect(&rcTemp, &(ps->rcPaint), &rtoday)) { - DrawTextA(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE); - DrawTextA(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE); + DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE); + DrawTextW(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE); } SelectObject(hdc, infoPtr->hFont); } @@ -689,9 +694,8 @@ LOCALE_IFIRSTWEEKOFYEAR == 1 (what contries?) The first week of the year must contain only days of the new year */ - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, - buf, sizeof(buf)); - sscanf(buf, "%d", &weeknum); + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTWEEKOFYEAR, buf, countof(buf)); + weeknum = atoiW(buf); switch (weeknum) { case 1: mindays = 6; @@ -738,16 +742,16 @@ for(i=0; i<6; i++) { if((i==0)&&(weeknum>50)) { - sprintf(buf, "%d", weeknum); + wsprintfW(buf, fmt3W, weeknum); weeknum=0; } else if((i==5)&&(weeknum>47)) { - sprintf(buf, "%d", 1); + wsprintfW(buf, fmt3W, 1); } else - sprintf(buf, "%d", weeknum + i); - DrawTextA(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); + wsprintfW(buf, fmt3W, weeknum + i); + DrawTextW(hdc, buf, -1, days, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); days->top+=infoPtr->height_increment; days->bottom+=infoPtr->height_increment; } @@ -882,15 +886,14 @@ /* sets the first day of the week that will appear in the control */ -/* 0 == Monday, 6 == Sunday */ +/* 0 == Sunday, 6 == Saturday */ /* FIXME: this needs to be implemented properly in MONTHCAL_Refresh() */ /* FIXME: we need more error checking here */ static LRESULT MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, LPARAM lParam) { int prev = infoPtr->firstDay; - char buf[40]; - int day; + WCHAR buf[40]; TRACE("day %ld\n", lParam); @@ -899,13 +902,9 @@ } else { - GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, - buf, sizeof(buf)); - TRACE("%s %d\n", buf, strlen(buf)); - if(sscanf(buf, "%d", &day) == 1) - infoPtr->firstDay = day; - else - infoPtr->firstDay = 0; + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf)); + TRACE("%s %d\n", debugstr_w(buf), strlenW(buf)); + infoPtr->firstDay = (atoiW(buf)+1)%7; } return prev; } @@ -1151,6 +1150,7 @@ y = lpht->pt.y; retval = MCHT_NOWHERE; + ZeroMemory(&lpht->st, sizeof(lpht->st)); /* Comment in for debugging... TRACE("%d %d wd[%d %d %d %d] d[%d %d %d %d] t[%d %d %d %d] wn[%d %d %d %d]\n", x, y, @@ -1238,6 +1238,7 @@ retval = MCHT_CALENDARDATE; lpht->st.wMonth = infoPtr->currentMonth; lpht->st.wDay = day; + lpht->st.wDayOfWeek = MONTHCAL_CalculateDayOfWeek(day,lpht->st.wMonth,lpht->st.wYear); } goto done; } @@ -1278,7 +1279,7 @@ nmds.cDayState = infoPtr->monthRange; nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds); for(i=0; imonthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; @@ -1309,7 +1310,7 @@ nmds.prgDayState = Alloc (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmds.nmhdr.idFrom, (LPARAM)&nmds); for(i=0; imonthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; @@ -1319,17 +1320,18 @@ static LRESULT MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { + static const WCHAR todayW[] = { 'G','o',' ','t','o',' ','T','o','d','a','y',':',0 }; HMENU hMenu; POINT menupoint; - char buf[32]; + WCHAR buf[32]; hMenu = CreatePopupMenu(); - if (!LoadStringA(COMCTL32_hModule,IDM_GOTODAY,buf,sizeof(buf))) + if (!LoadStringW(COMCTL32_hModule,IDM_GOTODAY,buf,countof(buf))) { WARN("Can't load resource\n"); - strcpy(buf,"Go to Today:"); + strcpyW(buf, todayW); } - AppendMenuA(hMenu, MF_STRING|MF_ENABLED,1, buf); + AppendMenuW(hMenu, MF_STRING|MF_ENABLED,1, buf); menupoint.x=(INT)LOWORD(lParam); menupoint.y=(INT)HIWORD(lParam); ClientToScreen(infoPtr->hwndSelf, &menupoint); @@ -1346,11 +1348,12 @@ static LRESULT MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { + static const WCHAR EditW[] = { 'E','D','I','T',0 }; MCHITTESTINFO ht; DWORD hit; HMENU hMenu; RECT rcDay; /* used in determining area to invalidate */ - char buf[32]; + WCHAR buf[32]; int i; POINT menupoint; @@ -1358,7 +1361,7 @@ if (infoPtr->hWndYearUpDown) { - infoPtr->currentYear=SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); + infoPtr->currentYear=SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)0); if(!DestroyWindow(infoPtr->hWndYearUpDown)) { FIXME("Can't destroy Updown Control\n"); @@ -1401,9 +1404,8 @@ for (i=0; i<12;i++) { - GetLocaleInfoA( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, - buf,sizeof(buf)); - AppendMenuA(hMenu, MF_STRING|MF_ENABLED,i+1, buf); + GetLocaleInfoW(LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, buf,countof(buf)); + AppendMenuW(hMenu, MF_STRING|MF_ENABLED,i+1, buf); } menupoint.x=infoPtr->titlemonth.right; menupoint.y=infoPtr->titlemonth.bottom; @@ -1417,8 +1419,8 @@ } } if(hit == MCHT_TITLEYEAR) { - infoPtr->hWndYearEdit=CreateWindowExA(0, - "EDIT", + infoPtr->hWndYearEdit=CreateWindowExW(0, + EditW, 0, WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, @@ -1428,8 +1430,8 @@ NULL, NULL, NULL); - infoPtr->hWndYearUpDown=CreateWindowExA(0, - UPDOWN_CLASSA, + infoPtr->hWndYearUpDown=CreateWindowExW(0, + UPDOWN_CLASSW, 0, WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top, @@ -1439,9 +1441,9 @@ NULL, NULL, NULL); - SendMessageA( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); - SendMessageA( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); - SendMessageA( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); + SendMessageW( infoPtr->hWndYearUpDown, UDM_SETRANGE, (WPARAM) 0, MAKELONG (9999, 1753)); + SendMessageW( infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, (LPARAM)0 ); + SendMessageW( infoPtr->hWndYearUpDown, UDM_SETPOS, (WPARAM) 0,(LPARAM)infoPtr->currentYear ); return TRUE; } @@ -1466,7 +1468,7 @@ MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart); MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmsc.nmhdr.idFrom,(LPARAM)&nmsc); @@ -1532,8 +1534,7 @@ nmhdr.code = NM_RELEASEDCAPTURE; TRACE("Sent notification from %p to %p\n", infoPtr->hwndSelf, infoPtr->hwndNotify); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); /* redraw if necessary */ if(redraw) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); @@ -1545,8 +1546,7 @@ MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart); MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd); - SendMessageA(infoPtr->hwndNotify, WM_NOTIFY, - (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmsc.nmhdr.idFrom, (LPARAM)&nmsc); } return 0; @@ -1699,6 +1699,8 @@ /* sets the size information */ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) { + static const WCHAR SunW[] = { 'S','u','n',0 }; + static const WCHAR O0W[] = { '0','0',0 }; HDC hdc = GetDC(infoPtr->hwndSelf); RECT *title=&infoPtr->title; RECT *prev=&infoPtr->titlebtnprev; @@ -1710,7 +1712,7 @@ RECT *days=&infoPtr->days; RECT *todayrect=&infoPtr->todayrect; SIZE size; - TEXTMETRICA tm; + TEXTMETRICW tm; DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE); HFONT currentFont; int xdiv, left_offset; @@ -1721,13 +1723,13 @@ currentFont = SelectObject(hdc, infoPtr->hFont); /* get the height and width of each day's text */ - GetTextMetricsA(hdc, &tm); + GetTextMetricsW(hdc, &tm); infoPtr->textHeight = tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading; - GetTextExtentPoint32A(hdc, "Sun", 3, &size); + GetTextExtentPoint32W(hdc, SunW, 3, &size); infoPtr->textWidth = size.cx + 2; /* recalculate the height and width increments and offsets */ - GetTextExtentPoint32A(hdc, "00", 2, &size); + GetTextExtentPoint32W(hdc, O0W, 2, &size); xdiv = (dwStyle & MCS_WEEKNUMBERS) ? 8 : 7; @@ -1898,7 +1900,7 @@ infoPtr = MONTHCAL_GetInfoPtr(hwnd); if (!infoPtr && (uMsg != WM_CREATE)) - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); switch(uMsg) { case MCM_GETCURSEL: @@ -2009,7 +2011,7 @@ default: if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } } @@ -2017,23 +2019,23 @@ void MONTHCAL_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS; wndClass.lpfnWndProc = MONTHCAL_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(MONTHCAL_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - wndClass.lpszClassName = MONTHCAL_CLASSA; + wndClass.lpszClassName = MONTHCAL_CLASSW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } void MONTHCAL_Unregister(void) { - UnregisterClassA(MONTHCAL_CLASSA, NULL); + UnregisterClassW(MONTHCAL_CLASSW, NULL); } diff -urN wine-20050310/dlls/comctl32/pager.c wine-20050419/dlls/comctl32/pager.c --- wine-20050310/dlls/comctl32/pager.c 2005-01-17 14:38:28.000000000 +0100 +++ wine-20050419/dlls/comctl32/pager.c 2005-03-25 11:25:45.000000000 +0100 @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * NOTES - * Tested primarily with the controlspy Pager application. - * Susan Farley (susan@codeweavers.com) * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Sep. 18, 2004, by Robert Shearman. @@ -36,6 +34,20 @@ * PGS_DRAGNDROP * Notifications: * PGN_HOTITEMCHANGE + * + * TESTING: + * Tested primarily with the controlspy Pager application. + * Susan Farley (susan@codeweavers.com) + * + * IMPLEMENTATION NOTES: + * This control uses WM_NCPAINT instead of WM_PAINT to paint itself + * as we need to scroll a child window. In order to do this we move + * the child window in the control's client area, using the clipping + * region that is automatically set around the client area. As the + * entire client area now consists of the child window, we must + * allocate space (WM_NCCALCSIZE) for the buttons and draw them as + * a non-client area (WM_NCPAINT). + * Robert Shearman */ #include @@ -45,6 +57,7 @@ #include "wingdi.h" #include "winuser.h" #include "winnls.h" +#include "windowsx.h" #include "commctrl.h" #include "comctl32.h" #include "wine/debug.h" @@ -53,9 +66,10 @@ typedef struct { + HWND hwndSelf; /* handle of the control wnd */ HWND hwndChild; /* handle of the contained wnd */ HWND hwndNotify; /* handle of the parent wnd */ - BOOL bNoResize; /* set when created with CCS_NORESIZE */ + DWORD dwStyle; /* styles for this control */ COLORREF clrBk; /* background color */ INT nBorder; /* border size for the control */ INT nButtonSize;/* size of the pager btns */ @@ -69,9 +83,6 @@ INT direction; /* direction of the scroll, (e.g. PGF_SCROLLUP) */ } PAGER_INFO; -#define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongPtrW(hwnd, 0)) -#define PAGER_IsHorizontal(hwnd) ((GetWindowLongA (hwnd, GWL_STYLE) & PGS_HORZ)) - #define MIN_ARROW_WIDTH 8 #define MIN_ARROW_HEIGHT 5 @@ -81,22 +92,22 @@ #define REPEAT_DELAY 50 static void -PAGER_GetButtonRects(HWND hwnd, PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBottomRight, BOOL bClientCoords) +PAGER_GetButtonRects(PAGER_INFO* infoPtr, RECT* prcTopLeft, RECT* prcBottomRight, BOOL bClientCoords) { RECT rcWindow; - GetWindowRect (hwnd, &rcWindow); + GetWindowRect (infoPtr->hwndSelf, &rcWindow); if (bClientCoords) { POINT pt = {rcWindow.left, rcWindow.top}; - ScreenToClient(hwnd, &pt); + ScreenToClient(infoPtr->hwndSelf, &pt); OffsetRect(&rcWindow, -(rcWindow.left-pt.x), -(rcWindow.top-pt.y)); } else OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top); *prcTopLeft = *prcBottomRight = rcWindow; - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { prcTopLeft->right = prcTopLeft->left + infoPtr->nButtonSize; prcBottomRight->left = prcBottomRight->right - infoPtr->nButtonSize; @@ -277,23 +288,20 @@ /* << PAGER_GetDropTarget >> */ static inline LRESULT -PAGER_ForwardMouse (HWND hwnd, WPARAM wParam) +PAGER_ForwardMouse (PAGER_INFO* infoPtr, BOOL bFwd) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); - infoPtr->bForward = (BOOL)wParam; + infoPtr->bForward = bFwd; return 0; } static inline LRESULT -PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_GetButtonState (PAGER_INFO* infoPtr, INT btn) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); LRESULT btnState = PGF_INVISIBLE; - INT btn = (INT)lParam; - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); if (btn == PGB_TOPORLEFT) btnState = infoPtr->TLbtnState; @@ -304,46 +312,41 @@ } -static inline LRESULT -PAGER_GetPos(HWND hwnd) +static inline INT +PAGER_GetPos(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %d\n", hwnd, infoPtr->nPos); - return (LRESULT)infoPtr->nPos; + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nPos); + return infoPtr->nPos; } -static inline LRESULT -PAGER_GetButtonSize(HWND hwnd) +static inline INT +PAGER_GetButtonSize(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %d\n", hwnd, infoPtr->nButtonSize); - return (LRESULT)infoPtr->nButtonSize; + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nButtonSize); + return infoPtr->nButtonSize; } -static inline LRESULT -PAGER_GetBorder(HWND hwnd) +static inline INT +PAGER_GetBorder(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %d\n", hwnd, infoPtr->nBorder); - return (LRESULT)infoPtr->nBorder; + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, infoPtr->nBorder); + return infoPtr->nBorder; } -static inline LRESULT -PAGER_GetBkColor(HWND hwnd) +static inline COLORREF +PAGER_GetBkColor(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] returns %06lx\n", hwnd, infoPtr->clrBk); - return (LRESULT)infoPtr->clrBk; + TRACE("[%p] returns %06lx\n", infoPtr->hwndSelf, infoPtr->clrBk); + return infoPtr->clrBk; } static void -PAGER_CalcSize (HWND hwnd, INT* size, BOOL getWidth) +PAGER_CalcSize (PAGER_INFO *infoPtr, INT* size, BOOL getWidth) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); NMPGCALCSIZE nmpgcs; ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE)); - nmpgcs.hdr.hwndFrom = hwnd; - nmpgcs.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); + nmpgcs.hdr.hwndFrom = infoPtr->hwndSelf; + nmpgcs.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID); nmpgcs.hdr.code = PGN_CALCSIZE; nmpgcs.dwFlag = getWidth ? PGF_CALCWIDTH : PGF_CALCHEIGHT; nmpgcs.iWidth = getWidth ? *size : 0; @@ -353,12 +356,12 @@ *size = getWidth ? nmpgcs.iWidth : nmpgcs.iHeight; - TRACE("[%p] PGN_CALCSIZE returns %s=%d\n", hwnd, + TRACE("[%p] PGN_CALCSIZE returns %s=%d\n", infoPtr->hwndSelf, getWidth ? "width" : "height", *size); } static void -PAGER_PositionChildWnd(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_PositionChildWnd(PAGER_INFO* infoPtr) { if (infoPtr->hwndChild) { @@ -369,15 +372,15 @@ if (infoPtr->TLbtnState == PGF_GRAYED) nPos += infoPtr->nButtonSize; - GetClientRect(hwnd, &rcClient); + GetClientRect(infoPtr->hwndSelf, &rcClient); - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { int wndSize = max(0, rcClient.right - rcClient.left); if (infoPtr->nWidth < wndSize) infoPtr->nWidth = wndSize; - TRACE("[%p] SWP %dx%d at (%d,%d)\n", hwnd, + TRACE("[%p] SWP %dx%d at (%d,%d)\n", infoPtr->hwndSelf, infoPtr->nWidth, infoPtr->nHeight, -nPos, 0); SetWindowPos(infoPtr->hwndChild, 0, @@ -391,7 +394,7 @@ if (infoPtr->nHeight < wndSize) infoPtr->nHeight = wndSize; - TRACE("[%p] SWP %dx%d at (%d,%d)\n", hwnd, + TRACE("[%p] SWP %dx%d at (%d,%d)\n", infoPtr->hwndSelf, infoPtr->nWidth, infoPtr->nHeight, 0, -nPos); SetWindowPos(infoPtr->hwndChild, 0, @@ -405,7 +408,7 @@ } static INT -PAGER_GetScrollRange(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_GetScrollRange(PAGER_INFO* infoPtr) { INT scrollRange = 0; @@ -413,18 +416,18 @@ { INT wndSize, childSize; RECT wndRect; - GetWindowRect(hwnd, &wndRect); + GetWindowRect(infoPtr->hwndSelf, &wndRect); - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { wndSize = wndRect.right - wndRect.left; - PAGER_CalcSize(hwnd, &infoPtr->nWidth, TRUE); + PAGER_CalcSize(infoPtr, &infoPtr->nWidth, TRUE); childSize = infoPtr->nWidth; } else { wndSize = wndRect.bottom - wndRect.top; - PAGER_CalcSize(hwnd, &infoPtr->nHeight, FALSE); + PAGER_CalcSize(infoPtr, &infoPtr->nHeight, FALSE); childSize = infoPtr->nHeight; } @@ -433,13 +436,12 @@ scrollRange = childSize - wndSize + infoPtr->nButtonSize; } - TRACE("[%p] returns %d\n", hwnd, scrollRange); + TRACE("[%p] returns %d\n", infoPtr->hwndSelf, scrollRange); return scrollRange; } static void -PAGER_UpdateBtns(HWND hwnd, PAGER_INFO *infoPtr, - INT scrollRange, BOOL hideGrayBtns) +PAGER_UpdateBtns(PAGER_INFO *infoPtr, INT scrollRange, BOOL hideGrayBtns) { BOOL resizeClient; BOOL repaintBtns; @@ -449,7 +451,7 @@ RECT rcTopLeft, rcBottomRight; /* get button rects */ - PAGER_GetButtonRects(hwnd, infoPtr, &rcTopLeft, &rcBottomRight, FALSE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, FALSE); GetCursorPos(&pt); @@ -485,7 +487,7 @@ ((oldBRbtnState == PGF_INVISIBLE) != (infoPtr->BRbtnState == PGF_INVISIBLE)); /* initiate NCCalcSize to resize client wnd if necessary */ if (resizeClient) - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); @@ -493,14 +495,13 @@ repaintBtns = (oldTLbtnState != infoPtr->TLbtnState) || (oldBRbtnState != infoPtr->BRbtnState); if (repaintBtns) - SendMessageW(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(infoPtr->hwndSelf, WM_NCPAINT, 0, 0); } static LRESULT -PAGER_SetPos(HWND hwnd, INT newPos, BOOL fromBtnPress) +PAGER_SetPos(PAGER_INFO* infoPtr, INT newPos, BOOL fromBtnPress) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - INT scrollRange = PAGER_GetScrollRange(hwnd, infoPtr); + INT scrollRange = PAGER_GetScrollRange(infoPtr); INT oldPos = infoPtr->nPos; if ((scrollRange <= 0) || (newPos < 0)) @@ -510,24 +511,22 @@ else infoPtr->nPos = newPos; - TRACE("[%p] pos=%d, oldpos=%d\n", hwnd, infoPtr->nPos, oldPos); + TRACE("[%p] pos=%d, oldpos=%d\n", infoPtr->hwndSelf, infoPtr->nPos, oldPos); if (infoPtr->nPos != oldPos) { /* gray and restore btns, and if from WM_SETPOS, hide the gray btns */ - PAGER_UpdateBtns(hwnd, infoPtr, scrollRange, !fromBtnPress); - PAGER_PositionChildWnd(hwnd, infoPtr); + PAGER_UpdateBtns(infoPtr, scrollRange, !fromBtnPress); + PAGER_PositionChildWnd(infoPtr); } return 0; } static LRESULT -PAGER_HandleWindowPosChanging(HWND hwnd, WPARAM wParam, WINDOWPOS *winpos) +PAGER_WindowPosChanging(PAGER_INFO* infoPtr, WINDOWPOS *winpos) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - - if (infoPtr->bNoResize && !(winpos->flags & SWP_NOSIZE)) + if ((infoPtr->dwStyle & CCS_NORESIZE) && !(winpos->flags & SWP_NOSIZE)) { /* don't let the app resize the nonscrollable dimension of a control * that was created with CCS_NORESIZE style @@ -536,7 +535,7 @@ /* except if the current dimension is 0 and app is setting for * first time, then save amount as dimension. - GA 8/01 */ - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) if (!infoPtr->nHeight && winpos->cy) infoPtr->nHeight = winpos->cy; else @@ -549,13 +548,11 @@ return 0; } - DefWindowProcW (hwnd, WM_WINDOWPOSCHANGING, wParam, (LPARAM)winpos); - - return 1; + return DefWindowProcW (infoPtr->hwndSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM)winpos); } static INT -PAGER_SetFixedWidth(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_SetFixedWidth(PAGER_INFO* infoPtr) { /* Must set the non-scrollable dimension to be less than the full height/width * so that NCCalcSize is called. The Msoft docs mention 3/4 factor for button @@ -563,12 +560,12 @@ RECT wndRect; INT delta, h; - GetWindowRect(hwnd, &wndRect); + GetWindowRect(infoPtr->hwndSelf, &wndRect); /* see what the app says for btn width */ - PAGER_CalcSize(hwnd, &infoPtr->nWidth, TRUE); + PAGER_CalcSize(infoPtr, &infoPtr->nWidth, TRUE); - if (infoPtr->bNoResize) + if (infoPtr->dwStyle & CCS_NORESIZE) { delta = wndRect.right - wndRect.left - infoPtr->nWidth; if (delta > infoPtr->nButtonSize) @@ -580,13 +577,13 @@ h = wndRect.bottom - wndRect.top + infoPtr->nButtonSize; TRACE("[%p] infoPtr->nWidth set to %d\n", - hwnd, infoPtr->nWidth); + infoPtr->hwndSelf, infoPtr->nWidth); return h; } static INT -PAGER_SetFixedHeight(HWND hwnd, PAGER_INFO* infoPtr) +PAGER_SetFixedHeight(PAGER_INFO* infoPtr) { /* Must set the non-scrollable dimension to be less than the full height/width * so that NCCalcSize is called. The Msoft docs mention 3/4 factor for button @@ -594,12 +591,12 @@ RECT wndRect; INT delta, w; - GetWindowRect(hwnd, &wndRect); + GetWindowRect(infoPtr->hwndSelf, &wndRect); /* see what the app says for btn height */ - PAGER_CalcSize(hwnd, &infoPtr->nHeight, FALSE); + PAGER_CalcSize(infoPtr, &infoPtr->nHeight, FALSE); - if (infoPtr->bNoResize) + if (infoPtr->dwStyle & CCS_NORESIZE) { delta = wndRect.bottom - wndRect.top - infoPtr->nHeight; if (delta > infoPtr->nButtonSize) @@ -611,7 +608,7 @@ w = wndRect.right - wndRect.left + infoPtr->nButtonSize; TRACE("[%p] infoPtr->nHeight set to %d\n", - hwnd, infoPtr->nHeight); + infoPtr->hwndSelf, infoPtr->nHeight); return w; } @@ -629,102 +626,96 @@ ******************************************************************/ static LRESULT -PAGER_RecalcSize(HWND hwnd) +PAGER_RecalcSize(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); if (infoPtr->hwndChild) { - INT scrollRange = PAGER_GetScrollRange(hwnd, infoPtr); + INT scrollRange = PAGER_GetScrollRange(infoPtr); if (scrollRange <= 0) { infoPtr->nPos = -1; - PAGER_SetPos(hwnd, 0, FALSE); + PAGER_SetPos(infoPtr, 0, FALSE); } else - PAGER_PositionChildWnd(hwnd, infoPtr); + PAGER_PositionChildWnd(infoPtr); } return 1; } -static LRESULT -PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam) +static COLORREF +PAGER_SetBkColor (PAGER_INFO* infoPtr, COLORREF clrBk) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); COLORREF clrTemp = infoPtr->clrBk; - infoPtr->clrBk = (COLORREF)lParam; - TRACE("[%p] %06lx\n", hwnd, infoPtr->clrBk); + infoPtr->clrBk = clrBk; + TRACE("[%p] %06lx\n", infoPtr->hwndSelf, infoPtr->clrBk); /* the native control seems to do things this way */ - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); - RedrawWindow(hwnd, 0, 0, RDW_ERASE | RDW_INVALIDATE); + RedrawWindow(infoPtr->hwndSelf, 0, 0, RDW_ERASE | RDW_INVALIDATE); - return (LRESULT)clrTemp; + return clrTemp; } -static LRESULT -PAGER_SetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam) +static INT +PAGER_SetBorder (PAGER_INFO* infoPtr, INT iBorder) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); INT nTemp = infoPtr->nBorder; - infoPtr->nBorder = (INT)lParam; - TRACE("[%p] %d\n", hwnd, infoPtr->nBorder); + infoPtr->nBorder = iBorder; + TRACE("[%p] %d\n", infoPtr->hwndSelf, infoPtr->nBorder); - PAGER_RecalcSize(hwnd); + PAGER_RecalcSize(infoPtr); - return (LRESULT)nTemp; + return nTemp; } -static LRESULT -PAGER_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam) +static INT +PAGER_SetButtonSize (PAGER_INFO* infoPtr, INT iButtonSize) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); INT nTemp = infoPtr->nButtonSize; - infoPtr->nButtonSize = (INT)lParam; - TRACE("[%p] %d\n", hwnd, infoPtr->nButtonSize); + infoPtr->nButtonSize = iButtonSize; + TRACE("[%p] %d\n", infoPtr->hwndSelf, infoPtr->nButtonSize); - PAGER_RecalcSize(hwnd); + PAGER_RecalcSize(infoPtr); - return (LRESULT)nTemp; + return nTemp; } static LRESULT -PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_SetChild (PAGER_INFO* infoPtr, HWND hwndChild) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); INT hw; - infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0; + infoPtr->hwndChild = IsWindow (hwndChild) ? hwndChild : 0; if (infoPtr->hwndChild) { - TRACE("[%p] hwndChild=%p\n", hwnd, infoPtr->hwndChild); + TRACE("[%p] hwndChild=%p\n", infoPtr->hwndSelf, infoPtr->hwndChild); - if (PAGER_IsHorizontal(hwnd)) { - hw = PAGER_SetFixedHeight(hwnd, infoPtr); + if (infoPtr->dwStyle & PGS_HORZ) { + hw = PAGER_SetFixedHeight(infoPtr); /* adjust non-scrollable dimension to fit the child */ - SetWindowPos(hwnd, 0, 0,0, hw, infoPtr->nHeight, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, hw, infoPtr->nHeight, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } else { - hw = PAGER_SetFixedWidth(hwnd, infoPtr); + hw = PAGER_SetFixedWidth(infoPtr); /* adjust non-scrollable dimension to fit the child */ - SetWindowPos(hwnd, 0, 0,0, infoPtr->nWidth, hw, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, infoPtr->nWidth, hw, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); } @@ -735,32 +726,31 @@ SWP_SHOWWINDOW | SWP_NOSIZE); /* native is 0 */ infoPtr->nPos = -1; - PAGER_SetPos(hwnd, 0, FALSE); + PAGER_SetPos(infoPtr, 0, FALSE); } return 0; } static void -PAGER_Scroll(HWND hwnd, INT dir) +PAGER_Scroll(PAGER_INFO* infoPtr, INT dir) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); NMPGSCROLL nmpgScroll; RECT rcWnd; if (infoPtr->hwndChild) { ZeroMemory (&nmpgScroll, sizeof (NMPGSCROLL)); - nmpgScroll.hdr.hwndFrom = hwnd; - nmpgScroll.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID); + nmpgScroll.hdr.hwndFrom = infoPtr->hwndSelf; + nmpgScroll.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID); nmpgScroll.hdr.code = PGN_SCROLL; - GetWindowRect(hwnd, &rcWnd); - GetClientRect(hwnd, &nmpgScroll.rcParent); + GetWindowRect(infoPtr->hwndSelf, &rcWnd); + GetClientRect(infoPtr->hwndSelf, &nmpgScroll.rcParent); nmpgScroll.iXpos = nmpgScroll.iYpos = 0; nmpgScroll.iDir = dir; - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { nmpgScroll.iScroll = rcWnd.right - rcWnd.left; nmpgScroll.iXpos = infoPtr->nPos; @@ -775,16 +765,16 @@ SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmpgScroll.hdr.idFrom, (LPARAM)&nmpgScroll); - TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", hwnd, nmpgScroll.iScroll); + TRACE("[%p] PGN_SCROLL returns iScroll=%d\n", infoPtr->hwndSelf, nmpgScroll.iScroll); if (nmpgScroll.iScroll > 0) { infoPtr->direction = dir; if (dir == PGF_SCROLLLEFT || dir == PGF_SCROLLUP) - PAGER_SetPos(hwnd, infoPtr->nPos - nmpgScroll.iScroll, TRUE); + PAGER_SetPos(infoPtr, infoPtr->nPos - nmpgScroll.iScroll, TRUE); else - PAGER_SetPos(hwnd, infoPtr->nPos + nmpgScroll.iScroll, TRUE); + PAGER_SetPos(infoPtr, infoPtr->nPos + nmpgScroll.iScroll, TRUE); } else infoPtr->direction = -1; @@ -792,12 +782,10 @@ } static LRESULT -PAGER_FmtLines(HWND hwnd) +PAGER_FmtLines(PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - /* initiate NCCalcSize to resize client wnd and get size */ - SetWindowPos(hwnd, 0, 0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); @@ -805,23 +793,24 @@ 0,0,infoPtr->nWidth,infoPtr->nHeight, 0); - return DefWindowProcW (hwnd, EM_FMTLINES, 0, 0); + return DefWindowProcW (infoPtr->hwndSelf, EM_FMTLINES, 0, 0); } static LRESULT -PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_Create (HWND hwnd, LPCREATESTRUCTW lpcs) { PAGER_INFO *infoPtr; - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); /* allocate memory for info structure */ infoPtr = (PAGER_INFO *)Alloc (sizeof(PAGER_INFO)); + if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* set default settings */ + infoPtr->hwndSelf = hwnd; infoPtr->hwndChild = NULL; - infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; - infoPtr->bNoResize = dwStyle & CCS_NORESIZE; + infoPtr->hwndNotify = lpcs->hwndParent; + infoPtr->dwStyle = lpcs->style; infoPtr->clrBk = GetSysColor(COLOR_BTNFACE); infoPtr->nBorder = 0; infoPtr->nButtonSize = 12; @@ -834,50 +823,46 @@ infoPtr->BRbtnState = PGF_INVISIBLE; infoPtr->direction = -1; - if (dwStyle & PGS_DRAGNDROP) - FIXME("[%p] Drag and Drop style is not implemented yet.\n", hwnd); + if (infoPtr->dwStyle & PGS_DRAGNDROP) + FIXME("[%p] Drag and Drop style is not implemented yet.\n", infoPtr->hwndSelf); return 0; } static LRESULT -PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_Destroy (PAGER_INFO *infoPtr) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - /* free pager info data */ - Free (infoPtr); - SetWindowLongPtrW (hwnd, 0, 0); + SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); + Free (infoPtr); /* free pager info data */ return 0; } static LRESULT -PAGER_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_NCCalcSize(PAGER_INFO* infoPtr, WPARAM wParam, LPRECT lpRect) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - LPRECT lpRect = (LPRECT)lParam; RECT rcChild, rcWindow; INT scrollRange; /* - * lParam points to a RECT struct. On entry, the struct + * lpRect points to a RECT struct. On entry, the struct * contains the proposed wnd rectangle for the window. * On exit, the struct should contain the screen * coordinates of the corresponding window's client area. */ - DefWindowProcW (hwnd, WM_NCCALCSIZE, wParam, lParam); + DefWindowProcW (infoPtr->hwndSelf, WM_NCCALCSIZE, wParam, (LPARAM)lpRect); TRACE("orig rect=%s\n", wine_dbgstr_rect(lpRect)); GetWindowRect (infoPtr->hwndChild, &rcChild); - MapWindowPoints (0, hwnd, (LPPOINT)&rcChild, 2); /* FIXME: RECT != 2 POINTS */ - GetWindowRect (hwnd, &rcWindow); + MapWindowPoints (0, infoPtr->hwndSelf, (LPPOINT)&rcChild, 2); /* FIXME: RECT != 2 POINTS */ + GetWindowRect (infoPtr->hwndSelf, &rcWindow); - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { infoPtr->nWidth = lpRect->right - lpRect->left; - PAGER_CalcSize (hwnd, &infoPtr->nWidth, TRUE); + PAGER_CalcSize (infoPtr, &infoPtr->nWidth, TRUE); scrollRange = infoPtr->nWidth - (rcWindow.right - rcWindow.left); @@ -889,7 +874,7 @@ else { infoPtr->nHeight = lpRect->bottom - lpRect->top; - PAGER_CalcSize (hwnd, &infoPtr->nHeight, FALSE); + PAGER_CalcSize (infoPtr, &infoPtr->nHeight, FALSE); scrollRange = infoPtr->nHeight - (rcWindow.bottom - rcWindow.top); @@ -904,7 +889,7 @@ wine_dbgstr_rect(&rcWindow)); TRACE("[%p] client rect set to %ldx%ld at (%ld,%ld) BtnState[%d,%d]\n", - hwnd, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, + infoPtr->hwndSelf, lpRect->right-lpRect->left, lpRect->bottom-lpRect->top, lpRect->left, lpRect->top, infoPtr->TLbtnState, infoPtr->BRbtnState); @@ -912,41 +897,37 @@ } static LRESULT -PAGER_NCPaint (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_NCPaint (PAGER_INFO* infoPtr, HRGN hRgn) { - PAGER_INFO* infoPtr = PAGER_GetInfoPtr(hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); RECT rcBottomRight, rcTopLeft; HDC hdc; - BOOL bHorizontal = PAGER_IsHorizontal(hwnd); - if (dwStyle & WS_MINIMIZE) + if (infoPtr->dwStyle & WS_MINIMIZE) return 0; - DefWindowProcW (hwnd, WM_NCPAINT, wParam, lParam); + DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)hRgn, 0); - if (!(hdc = GetDCEx (hwnd, 0, DCX_USESTYLE | DCX_WINDOW))) + if (!(hdc = GetDCEx (infoPtr->hwndSelf, 0, DCX_USESTYLE | DCX_WINDOW))) return 0; - PAGER_GetButtonRects(hwnd, infoPtr, &rcTopLeft, &rcBottomRight, FALSE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, FALSE); PAGER_DrawButton(hdc, infoPtr->clrBk, rcTopLeft, - bHorizontal, TRUE, infoPtr->TLbtnState); + infoPtr->dwStyle & PGS_HORZ, TRUE, infoPtr->TLbtnState); PAGER_DrawButton(hdc, infoPtr->clrBk, rcBottomRight, - bHorizontal, FALSE, infoPtr->BRbtnState); + infoPtr->dwStyle & PGS_HORZ, FALSE, infoPtr->BRbtnState); - ReleaseDC( hwnd, hdc ); + ReleaseDC( infoPtr->hwndSelf, hdc ); return 0; } static INT -PAGER_HitTest (HWND hwnd, const POINT * pt) +PAGER_HitTest (PAGER_INFO* infoPtr, const POINT * pt) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); RECT clientRect, rcTopLeft, rcBottomRight; POINT ptWindow; - GetClientRect (hwnd, &clientRect); + GetClientRect (infoPtr->hwndSelf, &clientRect); if (PtInRect(&clientRect, *pt)) { @@ -955,7 +936,7 @@ } ptWindow = *pt; - PAGER_GetButtonRects(hwnd, infoPtr, &rcTopLeft, &rcBottomRight, TRUE); + PAGER_GetButtonRects(infoPtr, &rcTopLeft, &rcBottomRight, TRUE); if ((infoPtr->TLbtnState != PGF_INVISIBLE) && PtInRect(&rcTopLeft, ptWindow)) { @@ -973,46 +954,43 @@ } static LRESULT -PAGER_NCHitTest (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_NCHitTest (PAGER_INFO* infoPtr, INT x, INT y) { POINT pt; INT nHit; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + pt.x = x; + pt.y = y; - ScreenToClient (hwnd, &pt); - nHit = PAGER_HitTest(hwnd, &pt); - if (nHit < 0) - return HTTRANSPARENT; - return HTCLIENT; + ScreenToClient (infoPtr->hwndSelf, &pt); + nHit = PAGER_HitTest(infoPtr, &pt); + + return (nHit < 0) ? HTTRANSPARENT : HTCLIENT; } static LRESULT -PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_MouseMove (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); POINT clpt, pt; RECT wnrect, *btnrect = NULL; - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); BOOL topLeft = FALSE; INT btnstate = 0; INT hit; HDC hdc; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + pt.x = x; + pt.y = y; - TRACE("[%p] to (%ld,%ld)\n", hwnd, pt.x, pt.y); - ClientToScreen(hwnd, &pt); - GetWindowRect(hwnd, &wnrect); + TRACE("[%p] to (%d,%d)\n", infoPtr->hwndSelf, x, y); + ClientToScreen(infoPtr->hwndSelf, &pt); + GetWindowRect(infoPtr->hwndSelf, &wnrect); if (PtInRect(&wnrect, pt)) { RECT TLbtnrect, BRbtnrect; - PAGER_GetButtonRects(hwnd, infoPtr, &TLbtnrect, &BRbtnrect, FALSE); + PAGER_GetButtonRects(infoPtr, &TLbtnrect, &BRbtnrect, FALSE); clpt = pt; - MapWindowPoints(0, hwnd, &clpt, 1); - hit = PAGER_HitTest(hwnd, &clpt); + MapWindowPoints(0, infoPtr->hwndSelf, &clpt, 1); + hit = PAGER_HitTest(infoPtr, &clpt); if ((hit == PGB_TOPORLEFT) && (infoPtr->TLbtnState == PGF_NORMAL)) { topLeft = TRUE; @@ -1032,42 +1010,42 @@ if (btnrect) { TRACE("[%p] draw btn (%ld,%ld)-(%ld,%ld), Capture %s, style %08lx\n", - hwnd, btnrect->left, btnrect->top, + infoPtr->hwndSelf, btnrect->left, btnrect->top, btnrect->right, btnrect->bottom, (infoPtr->bCapture) ? "TRUE" : "FALSE", - dwStyle); + infoPtr->dwStyle); if (!infoPtr->bCapture) { - TRACE("[%p] SetCapture\n", hwnd); - SetCapture(hwnd); + TRACE("[%p] SetCapture\n", infoPtr->hwndSelf); + SetCapture(infoPtr->hwndSelf); infoPtr->bCapture = TRUE; } - if (dwStyle & PGS_AUTOSCROLL) - SetTimer(hwnd, TIMERID1, 0x3e, 0); - hdc = GetWindowDC(hwnd); + if (infoPtr->dwStyle & PGS_AUTOSCROLL) + SetTimer(infoPtr->hwndSelf, TIMERID1, 0x3e, 0); + hdc = GetWindowDC(infoPtr->hwndSelf); /* OffsetRect(wnrect, 0 | 1, 0 | 1) */ PAGER_DrawButton(hdc, infoPtr->clrBk, *btnrect, - PAGER_IsHorizontal(hwnd), topLeft, btnstate); - ReleaseDC(hwnd, hdc); + infoPtr->dwStyle & PGS_HORZ, topLeft, btnstate); + ReleaseDC(infoPtr->hwndSelf, hdc); return 0; } } /* If we think we are captured, then do release */ - if (infoPtr->bCapture && (WindowFromPoint(pt) != hwnd)) + if (infoPtr->bCapture && (WindowFromPoint(pt) != infoPtr->hwndSelf)) { NMHDR nmhdr; infoPtr->bCapture = FALSE; - if (GetCapture() == hwnd) + if (GetCapture() == infoPtr->hwndSelf) { ReleaseCapture(); if (infoPtr->TLbtnState == PGF_GRAYED) { infoPtr->TLbtnState = PGF_INVISIBLE; - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1075,13 +1053,13 @@ { infoPtr->TLbtnState = PGF_NORMAL; /* FIXME: just invalidate button rect */ - RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + RedrawWindow(infoPtr->hwndSelf, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); } if (infoPtr->BRbtnState == PGF_GRAYED) { infoPtr->BRbtnState = PGF_INVISIBLE; - SetWindowPos(hwnd, 0,0,0,0,0, + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1089,96 +1067,94 @@ { infoPtr->BRbtnState = PGF_NORMAL; /* FIXME: just invalidate button rect */ - RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); + RedrawWindow(infoPtr->hwndSelf, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); } /* Notify parent of released mouse capture */ memset(&nmhdr, 0, sizeof(NMHDR)); - nmhdr.hwndFrom = hwnd; - nmhdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); + nmhdr.hwndFrom = infoPtr->hwndSelf; + nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); nmhdr.code = NM_RELEASEDCAPTURE; SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, (WPARAM)nmhdr.idFrom, (LPARAM)&nmhdr); } - if (IsWindow(hwnd)) - KillTimer(hwnd, TIMERID1); + if (IsWindow(infoPtr->hwndSelf)) + KillTimer(infoPtr->hwndSelf, TIMERID1); } return 0; } static LRESULT -PAGER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_LButtonDown (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); BOOL repaintBtns = FALSE; POINT pt; INT hit; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + pt.x = x; + pt.y = y; - TRACE("[%p] at (%d,%d)\n", hwnd, (short)LOWORD(lParam), (short)HIWORD(lParam)); + TRACE("[%p] at (%d,%d)\n", infoPtr->hwndSelf, x, y); - hit = PAGER_HitTest(hwnd, &pt); + hit = PAGER_HitTest(infoPtr, &pt); /* put btn in DEPRESSED state */ if (hit == PGB_TOPORLEFT) { repaintBtns = infoPtr->TLbtnState != PGF_DEPRESSED; infoPtr->TLbtnState = PGF_DEPRESSED; - SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); + SetTimer(infoPtr->hwndSelf, TIMERID1, INITIAL_DELAY, 0); } else if (hit == PGB_BOTTOMORRIGHT) { repaintBtns = infoPtr->BRbtnState != PGF_DEPRESSED; infoPtr->BRbtnState = PGF_DEPRESSED; - SetTimer(hwnd, TIMERID1, INITIAL_DELAY, 0); + SetTimer(infoPtr->hwndSelf, TIMERID1, INITIAL_DELAY, 0); } if (repaintBtns) - SendMessageW(hwnd, WM_NCPAINT, 0, 0); + SendMessageW(infoPtr->hwndSelf, WM_NCPAINT, 0, 0); switch(hit) { case PGB_TOPORLEFT: - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { - TRACE("[%p] PGF_SCROLLLEFT\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLLEFT); + TRACE("[%p] PGF_SCROLLLEFT\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLLEFT); } else { - TRACE("[%p] PGF_SCROLLUP\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLUP); + TRACE("[%p] PGF_SCROLLUP\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLUP); } break; case PGB_BOTTOMORRIGHT: - if (PAGER_IsHorizontal(hwnd)) + if (infoPtr->dwStyle & PGS_HORZ) { - TRACE("[%p] PGF_SCROLLRIGHT\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLRIGHT); + TRACE("[%p] PGF_SCROLLRIGHT\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLRIGHT); } else { - TRACE("[%p] PGF_SCROLLDOWN\n", hwnd); - PAGER_Scroll(hwnd, PGF_SCROLLDOWN); + TRACE("[%p] PGF_SCROLLDOWN\n", infoPtr->hwndSelf); + PAGER_Scroll(infoPtr, PGF_SCROLLDOWN); } break; default: break; } - return TRUE; + return 0; } static LRESULT -PAGER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_LButtonUp (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p]\n", hwnd); + TRACE("[%p]\n", infoPtr->hwndSelf); - KillTimer (hwnd, TIMERID1); - KillTimer (hwnd, TIMERID2); + KillTimer (infoPtr->hwndSelf, TIMERID1); + KillTimer (infoPtr->hwndSelf, TIMERID2); /* make PRESSED btns NORMAL but don't hide gray btns */ if (infoPtr->TLbtnState & (PGF_HOT | PGF_DEPRESSED)) @@ -1190,26 +1166,25 @@ } static LRESULT -PAGER_Timer (HWND hwnd, WPARAM wParam) +PAGER_Timer (PAGER_INFO* infoPtr, INT nTimerId) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); INT dir; /* if initial timer, kill it and start the repeat timer */ - if (wParam == TIMERID1) { + if (nTimerId == TIMERID1) { if (infoPtr->TLbtnState == PGF_HOT) - dir = PAGER_IsHorizontal(hwnd) ? + dir = (infoPtr->dwStyle & PGS_HORZ) ? PGF_SCROLLLEFT : PGF_SCROLLUP; else - dir = PAGER_IsHorizontal(hwnd) ? + dir = (infoPtr->dwStyle & PGS_HORZ) ? PGF_SCROLLRIGHT : PGF_SCROLLDOWN; - TRACE("[%p] TIMERID1: style=%08lx, dir=%d\n", hwnd, dwStyle, dir); - KillTimer(hwnd, TIMERID1); - SetTimer(hwnd, TIMERID1, REPEAT_DELAY, 0); - if (dwStyle & PGS_AUTOSCROLL) { - PAGER_Scroll(hwnd, dir); - SetWindowPos(hwnd, 0,0,0,0,0, + TRACE("[%p] TIMERID1: style=%08lx, dir=%d\n", + infoPtr->hwndSelf, infoPtr->dwStyle, dir); + KillTimer(infoPtr->hwndSelf, TIMERID1); + SetTimer(infoPtr->hwndSelf, TIMERID1, REPEAT_DELAY, 0); + if (infoPtr->dwStyle & PGS_AUTOSCROLL) { + PAGER_Scroll(infoPtr, dir); + SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); } @@ -1217,55 +1192,73 @@ } - TRACE("[%p] TIMERID2: dir=%d\n", hwnd, infoPtr->direction); - KillTimer(hwnd, TIMERID2); + TRACE("[%p] TIMERID2: dir=%d\n", infoPtr->hwndSelf, infoPtr->direction); + KillTimer(infoPtr->hwndSelf, TIMERID2); if (infoPtr->direction > 0) { - PAGER_Scroll(hwnd, infoPtr->direction); - SetTimer(hwnd, TIMERID2, REPEAT_DELAY, 0); + PAGER_Scroll(infoPtr, infoPtr->direction); + SetTimer(infoPtr->hwndSelf, TIMERID2, REPEAT_DELAY, 0); } return 0; } static LRESULT -PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_EraseBackground (PAGER_INFO* infoPtr, HDC hdc) { POINT pt, ptorig; - HDC hdc = (HDC)wParam; HWND parent; pt.x = 0; pt.y = 0; - parent = GetParent(hwnd); - MapWindowPoints(hwnd, parent, &pt, 1); + parent = GetParent(infoPtr->hwndSelf); + MapWindowPoints(infoPtr->hwndSelf, parent, &pt, 1); OffsetWindowOrgEx (hdc, pt.x, pt.y, &ptorig); - SendMessageW (parent, WM_ERASEBKGND, wParam, lParam); + SendMessageW (parent, WM_ERASEBKGND, (WPARAM)hdc, 0); SetWindowOrgEx (hdc, ptorig.x, ptorig.y, 0); - return TRUE; + return 0; } static LRESULT -PAGER_Size (HWND hwnd, WPARAM wParam, LPARAM lParam) +PAGER_Size (PAGER_INFO* infoPtr, INT type, INT x, INT y) { /* note that WM_SIZE is sent whenever NCCalcSize resizes the client wnd */ - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); - TRACE("[%p] %dx%d\n", hwnd, (short)LOWORD(lParam), (short)HIWORD(lParam)); + TRACE("[%p] %d,%d\n", infoPtr->hwndSelf, x, y); - if (PAGER_IsHorizontal(hwnd)) - infoPtr->nHeight = (short)HIWORD(lParam); + if (infoPtr->dwStyle & PGS_HORZ) + infoPtr->nHeight = x; else - infoPtr->nWidth = (short)LOWORD(lParam); + infoPtr->nWidth = y; - return PAGER_RecalcSize(hwnd); + return PAGER_RecalcSize(infoPtr); } +static LRESULT +PAGER_StyleChanged(PAGER_INFO *infoPtr, WPARAM wStyleType, LPSTYLESTRUCT lpss) +{ + DWORD oldStyle = infoPtr->dwStyle; + + TRACE("(styletype=%x, styleOld=0x%08lx, styleNew=0x%08lx)\n", + wStyleType, lpss->styleOld, lpss->styleNew); + + if (wStyleType != GWL_STYLE) return 0; + + infoPtr->dwStyle = lpss->styleNew; + + if ((oldStyle ^ lpss->styleNew) & (PGS_HORZ | PGS_VERT)) + { + PAGER_RecalcSize(infoPtr); + } + + return 0; +} + static LRESULT WINAPI PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); + PAGER_INFO *infoPtr = (PAGER_INFO *)GetWindowLongPtrW(hwnd, 0); if (!infoPtr && (uMsg != WM_CREATE)) return DefWindowProcW (hwnd, uMsg, wParam, lParam); @@ -1273,83 +1266,86 @@ switch (uMsg) { case EM_FMTLINES: - return PAGER_FmtLines(hwnd); + return PAGER_FmtLines(infoPtr); case PGM_FORWARDMOUSE: - return PAGER_ForwardMouse (hwnd, wParam); + return PAGER_ForwardMouse (infoPtr, (BOOL)wParam); case PGM_GETBKCOLOR: - return PAGER_GetBkColor(hwnd); + return PAGER_GetBkColor(infoPtr); case PGM_GETBORDER: - return PAGER_GetBorder(hwnd); + return PAGER_GetBorder(infoPtr); case PGM_GETBUTTONSIZE: - return PAGER_GetButtonSize(hwnd); + return PAGER_GetButtonSize(infoPtr); case PGM_GETPOS: - return PAGER_GetPos(hwnd); + return PAGER_GetPos(infoPtr); case PGM_GETBUTTONSTATE: - return PAGER_GetButtonState (hwnd, wParam, lParam); + return PAGER_GetButtonState (infoPtr, (INT)lParam); /* case PGM_GETDROPTARGET: */ case PGM_RECALCSIZE: - return PAGER_RecalcSize(hwnd); + return PAGER_RecalcSize(infoPtr); case PGM_SETBKCOLOR: - return PAGER_SetBkColor (hwnd, wParam, lParam); + return PAGER_SetBkColor (infoPtr, (COLORREF)lParam); case PGM_SETBORDER: - return PAGER_SetBorder (hwnd, wParam, lParam); + return PAGER_SetBorder (infoPtr, (INT)lParam); case PGM_SETBUTTONSIZE: - return PAGER_SetButtonSize (hwnd, wParam, lParam); + return PAGER_SetButtonSize (infoPtr, (INT)lParam); case PGM_SETCHILD: - return PAGER_SetChild (hwnd, wParam, lParam); + return PAGER_SetChild (infoPtr, (HWND)lParam); case PGM_SETPOS: - return PAGER_SetPos(hwnd, (INT)lParam, FALSE); + return PAGER_SetPos(infoPtr, (INT)lParam, FALSE); case WM_CREATE: - return PAGER_Create (hwnd, wParam, lParam); + return PAGER_Create (hwnd, (LPCREATESTRUCTW)lParam); case WM_DESTROY: - return PAGER_Destroy (hwnd, wParam, lParam); + return PAGER_Destroy (infoPtr); case WM_SIZE: - return PAGER_Size (hwnd, wParam, lParam); + return PAGER_Size (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_NCPAINT: - return PAGER_NCPaint (hwnd, wParam, lParam); + return PAGER_NCPaint (infoPtr, (HRGN)wParam); case WM_WINDOWPOSCHANGING: - return PAGER_HandleWindowPosChanging (hwnd, wParam, (WINDOWPOS*)lParam); + return PAGER_WindowPosChanging (infoPtr, (WINDOWPOS*)lParam); + + case WM_STYLECHANGED: + return PAGER_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); case WM_NCCALCSIZE: - return PAGER_NCCalcSize (hwnd, wParam, lParam); + return PAGER_NCCalcSize (infoPtr, wParam, (LPRECT)lParam); case WM_NCHITTEST: - return PAGER_NCHitTest (hwnd, wParam, lParam); + return PAGER_NCHitTest (infoPtr, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_MOUSEMOVE: if (infoPtr->bForward && infoPtr->hwndChild) PostMessageW(infoPtr->hwndChild, WM_MOUSEMOVE, wParam, lParam); - return PAGER_MouseMove (hwnd, wParam, lParam); + return PAGER_MouseMove (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_LBUTTONDOWN: - return PAGER_LButtonDown (hwnd, wParam, lParam); + return PAGER_LButtonDown (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_LBUTTONUP: - return PAGER_LButtonUp (hwnd, wParam, lParam); + return PAGER_LButtonUp (infoPtr, (INT)wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); case WM_ERASEBKGND: - return PAGER_EraseBackground (hwnd, wParam, lParam); + return PAGER_EraseBackground (infoPtr, (HDC)wParam); case WM_TIMER: - return PAGER_Timer (hwnd, wParam); + return PAGER_Timer (infoPtr, (INT)wParam); case WM_NOTIFY: case WM_COMMAND: diff -urN wine-20050310/dlls/comctl32/propsheet.c wine-20050419/dlls/comctl32/propsheet.c --- wine-20050310/dlls/comctl32/propsheet.c 2005-01-09 17:42:54.000000000 +0100 +++ wine-20050419/dlls/comctl32/propsheet.c 2005-03-25 21:49:00.000000000 +0100 @@ -323,7 +323,7 @@ TRACE("<%s>\n", frstr); len = MultiByteToWideChar(CP_ACP, 0, frstr, -1, 0, 0); - *tostr = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + *tostr = Alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, frstr, -1, (LPWSTR)*tostr, len); } @@ -357,7 +357,7 @@ if (HIWORD(lppsh->pszCaption)) { int len = MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, NULL, 0); - psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, len*sizeof (WCHAR) ); + psInfo->ppshheader.pszCaption = Alloc( len*sizeof (WCHAR) ); MultiByteToWideChar(CP_ACP, 0, lppsh->pszCaption, -1, (LPWSTR) psInfo->ppshheader.pszCaption, len); } } @@ -411,7 +411,7 @@ if (HIWORD(lppsh->pszCaption)) { int len = strlenW(lppsh->pszCaption); - psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof(WCHAR) ); + psInfo->ppshheader.pszCaption = Alloc( (len+1)*sizeof(WCHAR) ); strcpyW( (WCHAR *)psInfo->ppshheader.pszCaption, lppsh->pszCaption ); } } @@ -951,7 +951,7 @@ SetWindowPos(hwndButton, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); - SendMessageA(hwndParent, DM_SETDEFID, IDOK, 0); + SendMessageW(hwndParent, DM_SETDEFID, IDOK, 0); /* @@ -1708,7 +1708,7 @@ hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + msgResult = SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); if (msgResult == -1) return FALSE; else if (msgResult == 0) @@ -1789,7 +1789,7 @@ hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE) + if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) != FALSE) return FALSE; /* @@ -1803,7 +1803,7 @@ hwndPage = psInfo->proppage[i].hwndPage; if (hwndPage) { - switch (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) + switch (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) { case PSNRET_INVALID: PROPSHEET_ShowPage(hwndDlg, i, psInfo); @@ -1823,7 +1823,7 @@ psn.hdr.code = PSN_SETACTIVE; psn.lParam = 0; hwndPage = psInfo->proppage[psInfo->active_page].hwndPage; - SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); } return TRUE; @@ -1850,7 +1850,7 @@ psn.hdr.idFrom = 0; psn.lParam = 0; - if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) + if (SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn)) return; psn.hdr.code = PSN_RESET; @@ -1861,7 +1861,7 @@ hwndPage = psInfo->proppage[i].hwndPage; if (hwndPage) - SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); } if (psInfo->isModeless) @@ -1893,7 +1893,7 @@ psn.hdr.idFrom = 0; psn.lParam = 0; - SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); } /****************************************************************************** @@ -2036,7 +2036,7 @@ psn.hdr.idFrom = 0; psn.lParam = 0; - res = !SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); + res = !SendMessageW(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn); end: TRACE("<-- %d\n", res); @@ -2222,7 +2222,7 @@ EnableWindow(hwndButton, TRUE); /* Make it default pushbutton */ - SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); /* Hide Back button */ hwndButton = GetDlgItem(hwndDlg, IDC_BACK_BUTTON); @@ -2267,13 +2267,12 @@ int i = 0; HWND hwndPage; LRESULT msgResult = 0; - PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, - PropSheetInfoStr); + PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwndDlg, PropSheetInfoStr); while ((i < psInfo->nPages) && (msgResult == 0)) { hwndPage = psInfo->proppage[i].hwndPage; - msgResult = SendMessageA(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam); + msgResult = SendMessageW(hwndPage, PSM_QUERYSIBLINGS, wParam, lParam); i++; } @@ -2423,7 +2422,7 @@ PROPSHEETPAGEW* psp = (PROPSHEETPAGEW*)psInfo->proppage[index].hpage; if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[index].pszText) - HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->proppage[index].pszText); + Free ((LPVOID)psInfo->proppage[index].pszText); DestroyPropertySheetPage(psInfo->proppage[index].hpage); } @@ -2480,7 +2479,7 @@ EnableWindow(hwndNext, TRUE); /* Set the Next button as the default pushbutton */ - SendMessageA(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); + SendMessageW(hwndDlg, DM_SETDEFID, IDC_NEXT_BUTTON, 0); } if ((dwFlags & PSWIZB_FINISH) || (dwFlags & PSWIZB_DISABLEDFINISH)) @@ -2495,7 +2494,7 @@ EnableWindow(hwndFinish, TRUE); /* Set the Finish button as the default pushbutton */ - SendMessageA(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); + SendMessageW(hwndDlg, DM_SETDEFID, IDC_FINISH_BUTTON, 0); } } @@ -2694,7 +2693,7 @@ TRACE("\n"); if (!psInfo) return; if (HIWORD(psInfo->ppshheader.pszCaption)) - HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->ppshheader.pszCaption); + Free ((LPVOID)psInfo->ppshheader.pszCaption); for (i = 0; i < psInfo->nPages; i++) { @@ -2715,7 +2714,7 @@ if(psp) { if ((psp->dwFlags & PSP_USETITLE) && psInfo->proppage[i].pszText) - HeapFree(GetProcessHeap(), 0, (LPVOID)psInfo->proppage[i].pszText); + Free ((LPVOID)psInfo->proppage[i].pszText); DestroyPropertySheetPage(psInfo->proppage[i].hpage); } @@ -2866,7 +2865,7 @@ { int len = strlen(lpPropSheetPage->u.pszTemplate); - ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,len+1 ); + ppsp->u.pszTemplate = Alloc( len+1 ); strcpy( (LPSTR)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate ); } if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) ) @@ -2901,20 +2900,20 @@ { int len = strlenW(lpPropSheetPage->u.pszTemplate); - ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,(len+1)*sizeof (WCHAR) ); + ppsp->u.pszTemplate = Alloc( (len+1)*sizeof (WCHAR) ); strcpyW( (WCHAR *)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate ); } if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) ) { int len = strlenW(lpPropSheetPage->u2.pszIcon); - ppsp->u2.pszIcon = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) ); + ppsp->u2.pszIcon = Alloc( (len+1)*sizeof (WCHAR) ); strcpyW( (WCHAR *)ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon ); } if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle )) { int len = strlenW(lpPropSheetPage->pszTitle); - ppsp->pszTitle = HeapAlloc( GetProcessHeap(), 0, (len+1)*sizeof (WCHAR) ); + ppsp->pszTitle = Alloc( (len+1)*sizeof (WCHAR) ); strcpyW( (WCHAR *)ppsp->pszTitle, lpPropSheetPage->pszTitle ); } else if ( !(ppsp->dwFlags & PSP_USETITLE) ) @@ -2942,13 +2941,13 @@ return FALSE; if ( !(psp->dwFlags & PSP_DLGINDIRECT) && HIWORD( psp->u.pszTemplate ) ) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u.pszTemplate); + Free ((LPVOID)psp->u.pszTemplate); if ( (psp->dwFlags & PSP_USEICONID) && HIWORD( psp->u2.pszIcon ) ) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->u2.pszIcon); + Free ((LPVOID)psp->u2.pszIcon); if ((psp->dwFlags & PSP_USETITLE) && HIWORD( psp->pszTitle )) - HeapFree(GetProcessHeap(), 0, (LPVOID)psp->pszTitle); + Free ((LPVOID)psp->pszTitle); Free(hPropPage); @@ -2969,7 +2968,7 @@ if (lpMsg->message == WM_KEYDOWN && (GetKeyState(VK_CONTROL) & 0x8000)) { int new_page = 0; - INT dlgCode = SendMessageA(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); + INT dlgCode = SendMessageW(lpMsg->hwnd, WM_GETDLGCODE, 0, (LPARAM)lpMsg); if (!(dlgCode & DLGC_WANTMESSAGE)) { @@ -3005,7 +3004,7 @@ } } - return IsDialogMessageA(hwnd, lpMsg); + return IsDialogMessageW(hwnd, lpMsg); } /****************************************************************************** @@ -3078,7 +3077,7 @@ /****************************************************************************** * PROPSHEET_Paint */ -static LRESULT PROPSHEET_Paint(HWND hwnd) +static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) { PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr); PAINTSTRUCT ps; @@ -3093,7 +3092,7 @@ WCHAR szBuffer[256]; int nLength; - hdc = BeginPaint(hwnd, &ps); + hdc = hdcParam ? hdcParam : BeginPaint(hwnd, &ps); if (!hdc) return 1; hdcSrc = CreateCompatibleDC(0); @@ -3118,7 +3117,7 @@ MapWindowPoints(hwndLineHeader, hwnd, (LPPOINT) &r, 2); SetRect(&rzone, 0, 0, r.right + 1, r.top - 1); - GetObjectA(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm); + GetObjectW(psInfo->ppshheader.u5.hbmHeader, sizeof(BITMAP), (LPVOID)&bm); if (psInfo->ppshheader.dwFlags & PSH_WIZARD97_OLD) { @@ -3241,7 +3240,7 @@ hbr = GetSysColorBrush(COLOR_WINDOW); FillRect(hdc, &rzone, hbr); - GetObjectA(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); + GetObjectW(psInfo->ppshheader.u4.hbmWatermark, sizeof(BITMAP), (LPVOID)&bm); hbmp = SelectObject(hdcSrc, psInfo->ppshheader.u4.hbmWatermark); BitBlt(hdc, 0, offsety, min(bm.bmWidth, r.right), @@ -3267,7 +3266,7 @@ DeleteDC(hdcSrc); - EndPaint(hwnd, &ps); + if (!hdcParam) EndPaint(hwnd, &ps); return 0; } @@ -3290,7 +3289,7 @@ HWND hwndTabCtrl = GetDlgItem(hwnd, IDC_TABCONTROL); LPCPROPSHEETPAGEW ppshpage; int idx; - LOGFONTA logFont; + LOGFONTW logFont; /* Using PropSheetInfoStr to store extra data doesn't match the native * common control: native uses TCM_[GS]ETITEM @@ -3310,10 +3309,10 @@ PROPSHEET_SetWizButtons(hwnd, PSWIZB_BACK|PSWIZB_NEXT); /* Set up fonts */ - SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); - psInfo->hFont = CreateFontIndirectA (&logFont); + SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); + psInfo->hFont = CreateFontIndirectW (&logFont); logFont.lfWeight = FW_BOLD; - psInfo->hFontBold = CreateFontIndirectA (&logFont); + psInfo->hFontBold = CreateFontIndirectW (&logFont); /* * Small icon in the title bar. @@ -3397,7 +3396,7 @@ } case WM_PAINT: - PROPSHEET_Paint(hwnd); + PROPSHEET_Paint(hwnd, (HDC)wParam); return TRUE; case WM_DESTROY: diff -urN wine-20050310/dlls/comctl32/rebar.c wine-20050419/dlls/comctl32/rebar.c --- wine-20050310/dlls/comctl32/rebar.c 2005-03-02 14:53:52.000000000 +0100 +++ wine-20050419/dlls/comctl32/rebar.c 2005-03-27 19:52:16.000000000 +0200 @@ -17,6 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Oct. 19, 2004, by Robert Shearman. @@ -1245,8 +1246,9 @@ static VOID REBAR_MoveChildWindows (REBAR_INFO *infoPtr, UINT start, UINT endplus) { + const static WCHAR strComboBox[] = { 'C','o','m','b','o','B','o','x',0 }; REBAR_BAND *lpBand; - CHAR szClassName[40]; + WCHAR szClassName[40]; UINT i; NMREBARCHILDSIZE rbcz; NMHDR heightchange; @@ -1291,9 +1293,9 @@ * set flag outside of loop */ - GetClassNameA (lpBand->hwndChild, szClassName, 40); - if (!lstrcmpA (szClassName, "ComboBox") || - !lstrcmpA (szClassName, WC_COMBOBOXEXA)) { + GetClassNameW (lpBand->hwndChild, szClassName, sizeof(szClassName)/sizeof(szClassName[0])); + if (!lstrcmpW (szClassName, strComboBox) || + !lstrcmpW (szClassName, WC_COMBOBOXEXW)) { INT nEditHeight, yPos; RECT rc; @@ -2276,7 +2278,7 @@ lpBand->rcBand.right,lpBand->rcBand.bottom, clip->left, clip->top, clip->right, clip->bottom); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, 0); if (lpBand->clrBack != CLR_NONE) SetBkColor (hdc, old); } @@ -2473,7 +2475,7 @@ if (imindBand == -1) imindBand = i; /* minimum size of each band is size of header plus */ /* size of minimum child plus offset of child from header plus */ - /* a one to separate each band. */ + /* one to separate each band. */ if (i < ihitBand) LHeaderSum += (band->lcx + SEP_WIDTH); else @@ -3755,7 +3757,7 @@ static LRESULT REBAR_Create (REBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { - LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam; + LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam; RECT wnrc1, clrc1; if (TRACE_ON(rebar)) { @@ -4063,10 +4065,10 @@ static LRESULT REBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) { - LPCREATESTRUCTA cs = (LPCREATESTRUCTA) lParam; + LPCREATESTRUCTW cs = (LPCREATESTRUCTW) lParam; REBAR_INFO *infoPtr = REBAR_GetInfoPtr (hwnd); RECT wnrc1, clrc1; - NONCLIENTMETRICSA ncm; + NONCLIENTMETRICSW ncm; HFONT tfont; INT i; @@ -4098,37 +4100,35 @@ infoPtr->iGrabbedBand = -1; infoPtr->hwndSelf = hwnd; infoPtr->DoRedraw = TRUE; - infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW); - infoPtr->hcurHorz = LoadCursorA (0, (LPSTR)IDC_SIZEWE); - infoPtr->hcurVert = LoadCursorA (0, (LPSTR)IDC_SIZENS); - infoPtr->hcurDrag = LoadCursorA (0, (LPSTR)IDC_SIZE); + infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW); + infoPtr->hcurHorz = LoadCursorW (0, (LPWSTR)IDC_SIZEWE); + infoPtr->hcurVert = LoadCursorW (0, (LPWSTR)IDC_SIZENS); + infoPtr->hcurDrag = LoadCursorW (0, (LPWSTR)IDC_SIZE); infoPtr->bUnicode = IsWindowUnicode (hwnd); infoPtr->fStatus = CREATE_RUNNING; infoPtr->hFont = GetStockObject (SYSTEM_FONT); /* issue WM_NOTIFYFORMAT to get unicode status of parent */ - i = SendMessageA(REBAR_GetNotifyParent (infoPtr), + i = SendMessageW(REBAR_GetNotifyParent (infoPtr), WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY); if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { - ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", - i); + ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); i = NFR_ANSI; } infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; /* add necessary styles to the requested styles */ infoPtr->dwStyle = cs->style | WS_VISIBLE | CCS_TOP; - SetWindowLongA (hwnd, GWL_STYLE, infoPtr->dwStyle); + SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle); /* get font handle for Caption Font */ - ncm.cbSize = sizeof(NONCLIENTMETRICSA); - SystemParametersInfoA (SPI_GETNONCLIENTMETRICS, - ncm.cbSize, &ncm, 0); + ncm.cbSize = sizeof(ncm); + SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); /* if the font is bold, set to normal */ if (ncm.lfCaptionFont.lfWeight > FW_NORMAL) { ncm.lfCaptionFont.lfWeight = FW_NORMAL; } - tfont = CreateFontIndirectA (&ncm.lfCaptionFont); + tfont = CreateFontIndirectW (&ncm.lfCaptionFont); if (tfont) { infoPtr->hFont = infoPtr->hDefaultFont = tfont; } @@ -4228,11 +4228,10 @@ INT i; if (lParam == NF_REQUERY) { - i = SendMessageA(REBAR_GetNotifyParent (infoPtr), + i = SendMessageW(REBAR_GetNotifyParent (infoPtr), WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY); if ((i < NFR_ANSI) || (i > NFR_UNICODE)) { - ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", - i); + ERR("wrong response to WM_NOTIFYFORMAT (%d), assuming ANSI\n", i); i = NFR_ANSI; } infoPtr->NtfUnicode = (i == NFR_UNICODE) ? 1 : 0; @@ -4473,7 +4472,7 @@ /* Save the new origin of this window - used by _ForceResize */ infoPtr->origin.x = lpwp->x; infoPtr->origin.y = lpwp->y; - ret = DefWindowProcA(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, + ret = DefWindowProcW(infoPtr->hwndSelf, WM_WINDOWPOSCHANGED, wParam, lParam); GetWindowRect(infoPtr->hwndSelf, &rc); TRACE("hwnd %p new pos (%ld,%ld)-(%ld,%ld)\n", @@ -4490,7 +4489,7 @@ TRACE("hwnd=%p msg=%x wparam=%x lparam=%lx\n", hwnd, uMsg, wParam, lParam); if (!infoPtr && (uMsg != WM_NCCREATE)) - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); switch (uMsg) { /* case RB_BEGINDRAG: */ @@ -4707,7 +4706,7 @@ if ((uMsg >= WM_USER) && (uMsg < WM_APP)) ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); - return DefWindowProcA (hwnd, uMsg, wParam, lParam); + return DefWindowProcW (hwnd, uMsg, wParam, lParam); } } @@ -4715,9 +4714,9 @@ VOID REBAR_Register (void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; - ZeroMemory (&wndClass, sizeof(WNDCLASSA)); + ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = REBAR_WindowProc; wndClass.cbClsExtra = 0; @@ -4727,9 +4726,9 @@ #if GLATESTING wndClass.hbrBackground = CreateSolidBrush(RGB(0,128,0)); #endif - wndClass.lpszClassName = REBARCLASSNAMEA; + wndClass.lpszClassName = REBARCLASSNAMEW; - RegisterClassA (&wndClass); + RegisterClassW (&wndClass); mindragx = GetSystemMetrics (SM_CXDRAG); mindragy = GetSystemMetrics (SM_CYDRAG); @@ -4740,5 +4739,5 @@ VOID REBAR_Unregister (void) { - UnregisterClassA (REBARCLASSNAMEA, NULL); + UnregisterClassW (REBARCLASSNAMEW, NULL); } diff -urN wine-20050310/dlls/comctl32/rsrc.rc wine-20050419/dlls/comctl32/rsrc.rc --- wine-20050310/dlls/comctl32/rsrc.rc 2004-09-07 22:43:30.000000000 +0200 +++ wine-20050419/dlls/comctl32/rsrc.rc 2005-04-13 13:04:49.000000000 +0200 @@ -1206,5 +1206,6 @@ #include "comctl_Pt.rc" #include "comctl_Ru.rc" #include "comctl_Si.rc" +#include "comctl_Sv.rc" #include "comctl_Th.rc" #include "comctl_Uk.rc" diff -urN wine-20050310/dlls/comctl32/syslink.c wine-20050419/dlls/comctl32/syslink.c --- wine-20050310/dlls/comctl32/syslink.c 2005-03-02 14:53:52.000000000 +0100 +++ wine-20050419/dlls/comctl32/syslink.c 2005-04-11 14:58:30.000000000 +0200 @@ -17,11 +17,19 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES + * + * This code was audited for completeness against the documented features + * of Comctl32.dll version 6.0 on Apr. 4, 2005, by Dimitrie O. Paun. + * + * Unless otherwise noted, we believe this code to be complete, as per + * the specification mentioned above. + * If you discover missing features, or bugs, please note them below. + * * TODO: * - Fix SHIFT+TAB and TAB issue (wrong link is selected when control gets the focus) * - Better string parsing * - Improve word wrapping - * - Control styles?! * */ @@ -33,6 +41,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -40,10 +49,6 @@ INT WINAPI StrCmpNIW(LPCWSTR,LPCWSTR,INT); -#define SYSLINK_Alloc(size) HeapAlloc(GetProcessHeap(), 0, (size)) -#define SYSLINK_Free(ptr) HeapFree(GetProcessHeap(), 0, (ptr)) -#define SYSLINK_ReAlloc(ptr, size) HeapReAlloc(GetProcessHeap(), 0, ptr, (size)) - typedef struct { int nChars; @@ -85,6 +90,8 @@ typedef struct { HWND Self; /* The window handle for this control */ + HWND Notify; /* The parent handle to receive notifications */ + DWORD Style; /* Styles for this control */ PDOC_ITEM Items; /* Address to the first document item */ BOOL HasFocus; /* Whether the control has the input focus */ int MouseDownID; /* ID of the link that the mouse button first selected */ @@ -115,8 +122,8 @@ { if(DocItem->Type == slLink) { - SYSLINK_Free(DocItem->u.Link.szID); - SYSLINK_Free(DocItem->u.Link.szUrl); + Free(DocItem->u.Link.szID); + Free(DocItem->u.Link.szUrl); } if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL) @@ -127,18 +134,18 @@ /* we don't free Text because it's just a pointer to a character in the entire window text string */ - SYSLINK_Free(DocItem); + Free(DocItem); } /*********************************************************************** * SYSLINK_AppendDocItem * Create and append a new document item. */ -static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPWSTR Text, UINT textlen, +static PDOC_ITEM SYSLINK_AppendDocItem (SYSLINK_INFO *infoPtr, LPCWSTR Text, UINT textlen, SL_ITEM_TYPE type, PDOC_ITEM LastItem) { PDOC_ITEM Item; - Item = SYSLINK_Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR))); + Item = Alloc(sizeof(DOC_ITEM) + ((textlen + 1) * sizeof(WCHAR))); if(Item == NULL) { ERR("Failed to alloc DOC_ITEM structure!\n"); @@ -191,25 +198,16 @@ * Parses the window text string and creates a document. Returns the * number of document items created. */ -static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPWSTR Text) +static UINT SYSLINK_ParseText (SYSLINK_INFO *infoPtr, LPCWSTR Text) { - WCHAR *current, *textstart, *linktext, *firsttag; - int taglen = 0, textlen, linklen, docitems = 0; + LPCWSTR current, textstart = NULL, linktext = NULL, firsttag = NULL; + int taglen = 0, textlen = 0, linklen = 0, docitems = 0; PDOC_ITEM Last = NULL; SL_ITEM_TYPE CurrentType = slText; - DWORD Style; - LPWSTR lpID, lpUrl; + LPCWSTR lpID, lpUrl; UINT lenId, lenUrl; - Style = GetWindowLongW(infoPtr->Self, GWL_STYLE); - - firsttag = NULL; - textstart = NULL; - linktext = NULL; - textlen = 0; - linklen = 0; - - for(current = (WCHAR*)Text; *current != 0;) + for(current = Text; *current != 0;) { if(*current == '<') { @@ -232,9 +230,8 @@ case ' ': { /* we expect parameters, parse them */ - LPWSTR *CurrentParameter = NULL; + LPCWSTR *CurrentParameter = NULL, tmp; UINT *CurrentParameterLen = NULL; - WCHAR *tmp; taglen = 3; tmp = current + taglen; @@ -362,7 +359,7 @@ { int nc; - if(!(Style & WS_DISABLED)) + if(!(infoPtr->Style & WS_DISABLED)) { Last->u.Link.state |= LIS_ENABLED; } @@ -371,7 +368,7 @@ { nc = min(lenId, strlenW(lpID)); nc = min(nc, MAX_LINKID_TEXT); - Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + Last->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(Last->u.Link.szID != NULL) { lstrcpynW(Last->u.Link.szID, lpID, nc + 1); @@ -384,7 +381,7 @@ { nc = min(lenUrl, strlenW(lpUrl)); nc = min(nc, L_MAX_URL_LENGTH); - Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); + Last->u.Link.szUrl = Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); if(Last->u.Link.szUrl != NULL) { lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1); @@ -442,7 +439,7 @@ { int nc; - if(!(Style & WS_DISABLED)) + if(!(infoPtr->Style & WS_DISABLED)) { Last->u.Link.state |= LIS_ENABLED; } @@ -451,7 +448,7 @@ { nc = min(lenId, strlenW(lpID)); nc = min(nc, MAX_LINKID_TEXT); - Last->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + Last->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(Last->u.Link.szID != NULL) { lstrcpynW(Last->u.Link.szID, lpID, nc + 1); @@ -464,7 +461,7 @@ { nc = min(lenUrl, strlenW(lpUrl)); nc = min(nc, L_MAX_URL_LENGTH); - Last->u.Link.szUrl = SYSLINK_Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); + Last->u.Link.szUrl = Alloc((L_MAX_URL_LENGTH + 1) * sizeof(WCHAR)); if(Last->u.Link.szUrl != NULL) { lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1); @@ -479,7 +476,7 @@ if(linktext != NULL && linklen > 0) { - /* we got a unclosed link, just display the text */ + /* we got an unclosed link, just display the text */ Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slText, Last); if(Last == NULL) { @@ -737,11 +734,11 @@ if(bl != NULL) { - bl = SYSLINK_ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK)); + bl = ReAlloc(bl, ++nBlocks * sizeof(DOC_TEXTBLOCK)); } else { - bl = SYSLINK_Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK)); + bl = Alloc(++nBlocks * sizeof(DOC_TEXTBLOCK)); } if(bl != NULL) @@ -879,13 +876,14 @@ * SYSLINK_Paint * Handles the WM_PAINT message. */ -static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr) +static LRESULT SYSLINK_Paint (SYSLINK_INFO *infoPtr, HDC hdcParam) { HDC hdc; PAINTSTRUCT ps; - hdc = BeginPaint (infoPtr->Self, &ps); + + hdc = hdcParam ? hdcParam : BeginPaint (infoPtr->Self, &ps); SYSLINK_Draw (infoPtr, hdc); - EndPaint (infoPtr->Self, &ps); + if (!hdcParam) EndPaint (infoPtr->Self, &ps); return 0; } @@ -939,7 +937,7 @@ * SYSLINK_SetText * Set new text for the SysLink control. */ -static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPWSTR Text) +static LRESULT SYSLINK_SetText (SYSLINK_INFO *infoPtr, LPCWSTR Text) { int textlen; @@ -1038,7 +1036,7 @@ { if(!di->u.Link.szID) { - di->u.Link.szID = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + di->u.Link.szID = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(!Item->szID) { ERR("Unable to allocate memory for link id\n"); @@ -1055,7 +1053,7 @@ { if(!di->u.Link.szUrl) { - di->u.Link.szUrl = SYSLINK_Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); + di->u.Link.szUrl = Alloc((MAX_LINKID_TEXT + 1) * sizeof(WCHAR)); if(!Item->szUrl) { ERR("Unable to allocate memory for link url\n"); @@ -1241,7 +1239,7 @@ nml.item.szUrl[0] = 0; } - return SendMessageW(GetParent(infoPtr->Self), WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml); + return SendMessageW(infoPtr->Notify, WM_NOTIFY, (WPARAM)nml.hdr.idFrom, (LPARAM)&nml); } /*********************************************************************** @@ -1466,7 +1464,7 @@ switch(message) { case WM_PAINT: - return SYSLINK_Paint (infoPtr); + return SYSLINK_Paint (infoPtr, (HDC)wParam); case WM_SETCURSOR: { @@ -1606,14 +1604,31 @@ case WM_KILLFOCUS: return SYSLINK_KillFocus(infoPtr, (HWND)wParam); + case WM_ENABLE: + infoPtr->Style &= ~WS_DISABLED; + infoPtr->Style |= (wParam ? 0 : WS_DISABLED); + InvalidateRect (infoPtr->Self, NULL, FALSE); + return 0; + + case WM_STYLECHANGED: + if (wParam == GWL_STYLE) + { + infoPtr->Style = ((LPSTYLESTRUCT)lParam)->styleNew; + + InvalidateRect(infoPtr->Self, NULL, TRUE); + } + return 0; + case WM_CREATE: /* allocate memory for info struct */ - infoPtr = (SYSLINK_INFO *)SYSLINK_Alloc (sizeof(SYSLINK_INFO)); + infoPtr = Alloc (sizeof(SYSLINK_INFO)); if (!infoPtr) return -1; SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; + infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent; + infoPtr->Style = ((LPCREATESTRUCTW)lParam)->style; infoPtr->Font = 0; infoPtr->LinkFont = 0; infoPtr->Items = NULL; @@ -1623,8 +1638,7 @@ infoPtr->LinkColor = GetSysColor(COLOR_HIGHLIGHT); infoPtr->VisitedColor = GetSysColor(COLOR_HIGHLIGHT); TRACE("SysLink Ctrl creation, hwnd=%p\n", hwnd); - lParam = (LPARAM)(((LPCREATESTRUCTW)lParam)->lpszName); - SYSLINK_SetText(infoPtr, (LPWSTR)lParam); + SYSLINK_SetText(infoPtr, ((LPCREATESTRUCTW)lParam)->lpszName); return 0; case WM_DESTROY: @@ -1632,8 +1646,8 @@ SYSLINK_ClearDoc(infoPtr); if(infoPtr->Font != 0) DeleteObject(infoPtr->Font); if(infoPtr->LinkFont != 0) DeleteObject(infoPtr->LinkFont); - SYSLINK_Free (infoPtr); SetWindowLongPtrW(hwnd, 0, 0); + Free (infoPtr); return 0; default: diff -urN wine-20050310/dlls/comctl32/tab.c wine-20050419/dlls/comctl32/tab.c --- wine-20050310/dlls/comctl32/tab.c 2005-02-25 17:19:07.000000000 +0100 +++ wine-20050419/dlls/comctl32/tab.c 2005-04-13 16:40:12.000000000 +0200 @@ -21,7 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * TODO: - * Unicode support (under construction) * * Styles: * TCIF_RTLREADING @@ -82,7 +81,7 @@ USHORT uVItemPadding_s; /* Set amount of vertical padding, in pixels */ HFONT hFont; /* handle to the current font */ HCURSOR hcurArrow; /* handle to the current cursor */ - HIMAGELIST himl; /* handle to a image list (may be 0) */ + HIMAGELIST himl; /* handle to an image list (may be 0) */ HWND hwndToolTip; /* handle to tab's tooltip */ INT leftmostVisible; /* Used for scrolling, this member contains * the index of the first visible item */ @@ -144,7 +143,7 @@ (WPARAM) nmhdr.idFrom, (LPARAM) &nmhdr); } -static VOID +static void TAB_RelayEvent (HWND hwndTip, HWND hwndMsg, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -162,25 +161,13 @@ } static void -TAB_DumpItemExternalA(TCITEMA *pti, UINT iItem) -{ - if (TRACE_ON(tab)) { - TRACE("external tab %d, mask=0x%08x, dwState=0x%08x, dwStateMask=0x%08x, cchTextMax=0x%08x\n", - iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax); - TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextA=%s\n", - iItem, pti->iImage, pti->lParam, debugstr_a(pti->pszText)); - } -} - - -static void -TAB_DumpItemExternalW(TCITEMW *pti, UINT iItem) +TAB_DumpItemExternalT(TCITEMW *pti, UINT iItem, BOOL isW) { if (TRACE_ON(tab)) { TRACE("external tab %d, mask=0x%08x, dwState=0x%08lx, dwStateMask=0x%08lx, cchTextMax=0x%08x\n", iItem, pti->mask, pti->dwState, pti->dwStateMask, pti->cchTextMax); TRACE("external tab %d, iImage=%d, lParam=0x%08lx, pszTextW=%s\n", - iItem, pti->iImage, pti->lParam, debugstr_w(pti->pszText)); + iItem, pti->iImage, pti->lParam, isW ? debugstr_w(pti->pszText) : debugstr_a((LPSTR)pti->pszText)); } } @@ -246,7 +233,7 @@ { if (iItem < 0 || iItem >= infoPtr->uNumItem) return 0; - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) { + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) { FIXME("Should set input focus\n"); } else { int oldFocus = infoPtr->uFocus; @@ -302,7 +289,7 @@ RECT* selectedRect) { RECT tmpItemRect,clientRect; - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); /* Perform a sanity check and a trivial visibility check. */ if ( (infoPtr->uNumItem <= 0) || @@ -417,7 +404,11 @@ } } - return TRUE; + /* Check for visibility */ + if (lStyle & TCS_VERTICAL) + return (itemRect->top < clientRect.bottom) && (itemRect->bottom > clientRect.top); + else + return (itemRect->left < clientRect.right) && (itemRect->right > clientRect.left); } static inline BOOL @@ -472,7 +463,7 @@ * This method is called whenever the focus goes in or out of this control * it is used to update the visual state of the control. */ -static VOID TAB_FocusChanging(const TAB_INFO *infoPtr) +static void TAB_FocusChanging(const TAB_INFO *infoPtr) { RECT selectedRect; BOOL isVisible; @@ -566,7 +557,7 @@ TAB_RelayEvent (infoPtr->hwndToolTip, infoPtr->hwnd, WM_LBUTTONDOWN, wParam, lParam); - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_FOCUSONBUTTONDOWN ) { SetFocus (infoPtr->hwnd); } @@ -648,7 +639,7 @@ * we can check if the mouse has left our window. If so, we un-highlight * the hot-tracked tab. */ -static VOID CALLBACK +static void CALLBACK TAB_HotTrackTimerProc ( HWND hwnd, /* handle of window for timer messages */ @@ -717,7 +708,7 @@ if (out_redrawEnter != NULL) *out_redrawEnter = -1; - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_HOTTRACK) + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_HOTTRACK) { POINT pt; UINT flags; @@ -814,7 +805,7 @@ WPARAM fLarger, LPRECT prc) { - DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); LONG *iRightBottom, *iLeftTop; TRACE ("hwnd=%p fLarger=%d (%ld,%ld)-(%ld,%ld)\n", infoPtr->hwnd, fLarger, prc->left, prc->top, prc->right, prc->bottom); @@ -903,8 +894,10 @@ TAB_INFO* infoPtr, const RECT* clientRect) { + static const WCHAR msctls_updown32W[] = { 'm','s','c','t','l','s','_','u','p','d','o','w','n','3','2',0 }; + static const WCHAR emptyW[] = { 0 }; INT maxRange = 0; - DWORD lStyle = GetWindowLongA(hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(hwnd, GWL_STYLE); if (infoPtr->needsScrolling) { @@ -953,16 +946,12 @@ */ if (infoPtr->hwndUpDown==0) { - infoPtr->hwndUpDown = CreateWindowA("msctls_updown32", - "", + infoPtr->hwndUpDown = CreateWindowW(msctls_updown32W, emptyW, WS_VISIBLE | WS_CHILD | UDS_HORZ, controlPos.left, controlPos.top, controlPos.right - controlPos.left, controlPos.bottom - controlPos.top, - hwnd, - NULL, - NULL, - NULL); + hwnd, NULL, NULL, NULL); } else { @@ -1016,8 +1005,8 @@ */ static void TAB_SetItemBounds (TAB_INFO *infoPtr) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); - TEXTMETRICA fontMetrics; + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); + TEXTMETRICW fontMetrics; UINT curItem; INT curItemLeftPos; INT curItemRowCount; @@ -1069,7 +1058,7 @@ int icon_height = 0; /* Use the current font to determine the height of a tab. */ - GetTextMetricsA(hdc, &fontMetrics); + GetTextMetricsW(hdc, &fontMetrics); /* Get the icon height */ if (infoPtr->himl) @@ -1374,7 +1363,7 @@ RECT* drawRect ) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); HBRUSH hbr = CreateSolidBrush (comctl32_color.clrBtnFace); BOOL deleteBrush = TRUE; RECT rTemp = *drawRect; @@ -1441,7 +1430,7 @@ RECT* drawRect ) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); RECT localRect; @@ -1757,7 +1746,8 @@ /* Draw the text */ if(lStyle & TCS_VERTICAL) /* if we are vertical rotate the text and each character */ { - LOGFONTA logfont; + static const WCHAR ArialW[] = { 'A','r','i','a','l',0 }; + LOGFONTW logfont; HFONT hFont = 0; INT nEscapement = 900; INT nOrientation = 900; @@ -1770,13 +1760,13 @@ /* to get a font with the escapement and orientation we are looking for, we need to */ /* call CreateFontIndirectA, which requires us to set the values of the logfont we pass in */ - if (!GetObjectA((infoPtr->hFont) ? + if (!GetObjectW((infoPtr->hFont) ? infoPtr->hFont : GetStockObject(SYSTEM_FONT), - sizeof(LOGFONTA),&logfont)) + sizeof(LOGFONTW),&logfont)) { INT iPointSize = 9; - lstrcpyA(logfont.lfFaceName, "Arial"); + lstrcpyW(logfont.lfFaceName, ArialW); logfont.lfHeight = -MulDiv(iPointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); logfont.lfWeight = FW_NORMAL; @@ -1787,7 +1777,7 @@ logfont.lfEscapement = nEscapement; logfont.lfOrientation = nOrientation; - hFont = CreateFontIndirectA(&logfont); + hFont = CreateFontIndirectW(&logfont); SelectObject(hdc, hFont); if (item->pszText) @@ -1845,7 +1835,7 @@ HDC hdc, INT iItem) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); RECT itemRect; RECT selectedRect; BOOL isVisible; @@ -1957,7 +1947,7 @@ /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RIGHT|BF_TOP|BF_BOTTOM); @@ -1968,7 +1958,7 @@ r1.top = r.top; r1.right = r.right; r1.bottom = r1.top + ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.right--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT); @@ -1977,7 +1967,7 @@ r1.bottom = r.bottom; r1.right = r.right; r1.top = r1.bottom - ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.right--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT); @@ -1998,7 +1988,7 @@ /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_BOTTOM); @@ -2009,7 +1999,7 @@ r1.top = r.top; r1.right = r1.left + ROUND_CORNER_SIZE + 1; r1.bottom = r1.top + ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.left++; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT); @@ -2018,7 +2008,7 @@ r1.bottom = r.bottom; r1.right = r1.left + ROUND_CORNER_SIZE + 1; r1.top = r1.bottom - ROUND_CORNER_SIZE; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.left++; DrawEdge(hdc, &r1, EDGE_SUNKEN, BF_DIAGONAL_ENDTOPLEFT); } @@ -2052,7 +2042,7 @@ /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_BOTTOM|BF_RIGHT); @@ -2063,7 +2053,7 @@ r1.bottom = r.bottom; r1.right = r.right; r1.top = r1.bottom - ROUND_CORNER_SIZE - 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.bottom--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMLEFT); @@ -2072,7 +2062,7 @@ r1.bottom = r.bottom; r1.right = r1.left + ROUND_CORNER_SIZE; r1.top = r1.bottom - ROUND_CORNER_SIZE - 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.bottom--; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT); @@ -2106,7 +2096,7 @@ /* Clear interior */ SetBkColor(hdc, bkgnd); - ExtTextOutA(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &fillRect, NULL, 0, 0); /* Draw rectangular edge around tab */ DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_LEFT|BF_TOP|BF_RIGHT); @@ -2117,7 +2107,7 @@ r1.top = r.top; r1.right = r.right; r1.bottom = r1.top + ROUND_CORNER_SIZE + 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.top++; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDBOTTOMRIGHT); @@ -2126,7 +2116,7 @@ r1.top = r.top; r1.right = r1.left + ROUND_CORNER_SIZE; r1.bottom = r1.top + ROUND_CORNER_SIZE + 1; - ExtTextOutA(hdc, 0, 0, 2, &r1, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0); r1.top++; DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPRIGHT); } @@ -2149,7 +2139,7 @@ static void TAB_DrawBorder (TAB_INFO *infoPtr, HDC hdc) { RECT rect; - DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); GetClientRect (infoPtr->hwnd, &rect); @@ -2190,7 +2180,7 @@ hOldFont = SelectObject (hdc, infoPtr->hFont); - if (GetWindowLongA(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) + if (GetWindowLongW(infoPtr->hwnd, GWL_STYLE) & TCS_BUTTONS) { for (i = 0; i < infoPtr->uNumItem; i++) TAB_DrawItem (infoPtr, hdc, i); @@ -2241,7 +2231,7 @@ TAB_INFO* infoPtr) { INT iSelected = infoPtr->iSelected; - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); INT iOrigLeftmostVisible = infoPtr->leftmostVisible; /* set the items row to the bottommost row or topmost row depending on @@ -2360,7 +2350,7 @@ static void TAB_InvalidateTabArea(TAB_INFO* infoPtr) { RECT clientRect, rInvalidate, rAdjClient; - DWORD lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + DWORD lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); INT lastRow = infoPtr->uNumRows - 1; RECT rect; @@ -2439,10 +2429,10 @@ } static LRESULT -TAB_InsertItemAW (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode) +TAB_InsertItemT (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam, BOOL bUnicode) { TAB_ITEM *item; - TCITEMA *pti; + TCITEMW *pti; INT iItem; RECT rect; @@ -2450,17 +2440,14 @@ TRACE("Rect: %p T %li, L %li, B %li, R %li\n", infoPtr->hwnd, rect.top, rect.left, rect.bottom, rect.right); - pti = (TCITEMA *)lParam; + pti = (TCITEMW *)lParam; iItem = (INT)wParam; if (iItem < 0) return -1; if (iItem > infoPtr->uNumItem) iItem = infoPtr->uNumItem; - if (bUnicode) - TAB_DumpItemExternalW((TCITEMW*)pti, iItem); - else - TAB_DumpItemExternalA(pti, iItem); + TAB_DumpItemExternalT(pti, iItem, bUnicode); if (infoPtr->uNumItem == 0) { @@ -2502,9 +2489,9 @@ if (pti->mask & TCIF_TEXT) { if (bUnicode) - Str_SetPtrW (&item->pszText, (WCHAR*)pti->pszText); + Str_SetPtrW (&item->pszText, pti->pszText); else - Str_SetPtrAtoW (&item->pszText, pti->pszText); + Str_SetPtrAtoW (&item->pszText, (LPSTR)pti->pszText); } if (pti->mask & TCIF_IMAGE) @@ -2532,7 +2519,7 @@ static LRESULT TAB_SetItemSize (TAB_INFO *infoPtr, LPARAM lParam) { - LONG lStyle = GetWindowLongA(infoPtr->hwnd, GWL_STYLE); + LONG lStyle = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); LONG lResult = 0; BOOL bNeedPaint = FALSE; @@ -2600,7 +2587,7 @@ } static LRESULT -TAB_SetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) +TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) { TAB_ITEM *wineItem; @@ -2609,10 +2596,7 @@ if (iItem < 0 || iItem >= infoPtr->uNumItem) return FALSE; - if (bUnicode) - TAB_DumpItemExternalW((TCITEMW *)tabItem, iItem); - else - TAB_DumpItemExternalA(tabItem, iItem); + TAB_DumpItemExternalT(tabItem, iItem, bUnicode); wineItem = TAB_GetItem(infoPtr, iItem); @@ -2636,9 +2620,9 @@ wineItem->pszText = NULL; } if (bUnicode) - Str_SetPtrW(&wineItem->pszText, (WCHAR*)tabItem->pszText); + Str_SetPtrW(&wineItem->pszText, tabItem->pszText); else - Str_SetPtrAtoW(&wineItem->pszText, tabItem->pszText); + Str_SetPtrAtoW(&wineItem->pszText, (LPSTR)tabItem->pszText); } /* Update and repaint tabs */ @@ -2655,7 +2639,7 @@ static LRESULT -TAB_GetItemAW (TAB_INFO *infoPtr, INT iItem, LPTCITEMA tabItem, BOOL bUnicode) +TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) { TAB_ITEM *wineItem; @@ -2681,15 +2665,12 @@ if (tabItem->mask & TCIF_TEXT) { if (bUnicode) - Str_GetPtrW (wineItem->pszText, (WCHAR*)tabItem->pszText, tabItem->cchTextMax); + Str_GetPtrW (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); else - Str_GetPtrWtoA (wineItem->pszText, tabItem->pszText, tabItem->cchTextMax); + Str_GetPtrWtoA (wineItem->pszText, (LPSTR)tabItem->pszText, tabItem->cchTextMax); } - if (bUnicode) - TAB_DumpItemExternalW((TCITEMW*)tabItem, iItem); - else - TAB_DumpItemExternalA(tabItem, iItem); + TAB_DumpItemExternalT(tabItem, iItem, bUnicode); return TRUE; } @@ -2835,7 +2816,7 @@ GetClientRect(parent, &parent_rect); cx=LOWORD (lParam); cy=HIWORD (lParam); - if (GetWindowLongA(hwnd, GWL_STYLE) & CCS_NORESIZE) + if (GetWindowLongW(hwnd, GWL_STYLE) & CCS_NORESIZE) uPosFlags |= (SWP_NOSIZE | SWP_NOMOVE); SetWindowPos (hwnd, 0, parent_rect.left, parent_rect.top, @@ -2857,14 +2838,14 @@ static LRESULT TAB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) { TAB_INFO *infoPtr; - TEXTMETRICA fontMetrics; + TEXTMETRICW fontMetrics; HDC hdc; HFONT hOldFont; DWORD dwStyle; infoPtr = (TAB_INFO *)Alloc (sizeof(TAB_INFO)); - SetWindowLongA(hwnd, 0, (DWORD)infoPtr); + SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr); infoPtr->hwnd = hwnd; infoPtr->hwndNotify = ((LPCREATESTRUCTW)lParam)->hwndParent; @@ -2876,7 +2857,7 @@ infoPtr->uVItemPadding_s = 3; infoPtr->hFont = 0; infoPtr->items = 0; - infoPtr->hcurArrow = LoadCursorA (0, (LPSTR)IDC_ARROW); + infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW); infoPtr->iSelected = -1; infoPtr->iHotTracked = -1; infoPtr->uFocus = -1; @@ -2894,13 +2875,13 @@ /* The tab control always has the WS_CLIPSIBLINGS style. Even if you don't specify it in CreateWindow. This is necessary in order for paint to work correctly. This follows windows behaviour. */ - dwStyle = GetWindowLongA(hwnd, GWL_STYLE); - SetWindowLongA(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS); + dwStyle = GetWindowLongW(hwnd, GWL_STYLE); + SetWindowLongW(hwnd, GWL_STYLE, dwStyle|WS_CLIPSIBLINGS); if (dwStyle & TCS_TOOLTIPS) { /* Create tooltip control */ infoPtr->hwndToolTip = - CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, + CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, 0, 0, 0); @@ -2927,7 +2908,7 @@ hOldFont = SelectObject (hdc, GetStockObject (SYSTEM_FONT)); /* Use the system font to determine the initial height of a tab. */ - GetTextMetricsA(hdc, &fontMetrics); + GetTextMetricsW(hdc, &fontMetrics); /* * Make sure there is enough space for the letters + growing the @@ -2957,6 +2938,8 @@ if (!infoPtr) return 0; + SetWindowLongPtrW(infoPtr->hwnd, 0, 0); + if (infoPtr->items) { for (iItem = 0; iItem < infoPtr->uNumItem; iItem++) { if (TAB_GetItem(infoPtr, iItem)->pszText) @@ -2975,7 +2958,6 @@ KillTimer(infoPtr->hwnd, TAB_HOTTRACK_TIMER); Free (infoPtr); - SetWindowLongA(infoPtr->hwnd, 0, 0); return 0; } @@ -3017,11 +2999,11 @@ case TCM_GETITEMA: case TCM_GETITEMW: - return TAB_GetItemAW (infoPtr, (INT)wParam, (LPTCITEMA)lParam, uMsg == TCM_GETITEMW); + return TAB_GetItemT (infoPtr, (INT)wParam, (LPTCITEMW)lParam, uMsg == TCM_GETITEMW); case TCM_SETITEMA: case TCM_SETITEMW: - return TAB_SetItemAW (infoPtr, (INT)wParam, (LPTCITEMA)lParam, uMsg == TCM_SETITEMW); + return TAB_SetItemT (infoPtr, (INT)wParam, (LPTCITEMW)lParam, uMsg == TCM_SETITEMW); case TCM_DELETEITEM: return TAB_DeleteItem (infoPtr, (INT)wParam); @@ -3043,7 +3025,7 @@ case TCM_INSERTITEMA: case TCM_INSERTITEMW: - return TAB_InsertItemAW (infoPtr, wParam, lParam, uMsg == TCM_INSERTITEMW); + return TAB_InsertItemT (infoPtr, wParam, lParam, uMsg == TCM_INSERTITEMW); case TCM_SETITEMEXTRA: return TAB_SetItemExtra (infoPtr, (int)wParam); @@ -3171,7 +3153,7 @@ } -VOID +void TAB_Register (void) { WNDCLASSW wndClass; @@ -3189,7 +3171,7 @@ } -VOID +void TAB_Unregister (void) { UnregisterClassW (WC_TABCONTROLW, NULL); diff -urN wine-20050310/dlls/comctl32/tests/.cvsignore wine-20050419/dlls/comctl32/tests/.cvsignore --- wine-20050310/dlls/comctl32/tests/.cvsignore 2004-12-10 16:31:38.000000000 +0100 +++ wine-20050419/dlls/comctl32/tests/.cvsignore 2005-03-16 20:52:40.000000000 +0100 @@ -5,3 +5,4 @@ subclass.ok tab.ok testlist.c +updown.ok diff -urN wine-20050310/dlls/comctl32/tests/Makefile.in wine-20050419/dlls/comctl32/tests/Makefile.in --- wine-20050310/dlls/comctl32/tests/Makefile.in 2004-12-10 16:31:38.000000000 +0100 +++ wine-20050419/dlls/comctl32/tests/Makefile.in 2005-03-16 20:52:40.000000000 +0100 @@ -10,7 +10,8 @@ imagelist.c \ mru.c \ subclass.c \ - tab.c + tab.c \ + updown.c @MAKE_TEST_RULES@ diff -urN wine-20050310/dlls/comctl32/tests/mru.c wine-20050419/dlls/comctl32/tests/mru.c --- wine-20050310/dlls/comctl32/tests/mru.c 2004-12-10 16:31:38.000000000 +0100 +++ wine-20050419/dlls/comctl32/tests/mru.c 2005-03-14 11:10:00.000000000 +0100 @@ -224,11 +224,14 @@ iRet, GetLastError()); /* Add (NULL string) */ +#if 0 + /* Some native versions crash when passed NULL or fail to SetLastError() */ SetLastError(0); iRet = pAddMRUStringA(hMRU, NULL); ok(iRet == 0 && GetLastError() == ERROR_INVALID_PARAMETER, "AddMRUStringA(NULL str) expected 0,ERROR_INVALID_PARAMETER got %d,%ld\n", iRet, GetLastError()); +#endif /* Add 3 strings. Check the registry is correct after each add */ SetLastError(0); diff -urN wine-20050310/dlls/comctl32/tests/updown.c wine-20050419/dlls/comctl32/tests/updown.c --- wine-20050310/dlls/comctl32/tests/updown.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/comctl32/tests/updown.c 2005-03-18 15:09:12.000000000 +0100 @@ -0,0 +1,98 @@ +/* Unit test suite for updown control. + * + * Copyright 2005 C. Scott Ananian + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include + +#include "wine/test.h" + +static HDC desktopDC; +static HINSTANCE hinst; + +HWND create_edit_control (DWORD style, DWORD exstyle) +{ + HWND handle; + + handle = CreateWindowEx(exstyle, + "EDIT", + NULL, + ES_AUTOHSCROLL | ES_AUTOVSCROLL | style, + 10, 10, 300, 300, + NULL, NULL, hinst, NULL); + assert (handle); + if (winetest_interactive) + ShowWindow (handle, SW_SHOW); + return handle; +} + +HWND create_updown_control (HWND hWndEdit) +{ + HWND hWndUpDown; + + /* make the control */ + hWndUpDown = CreateWindowEx + (0L, UPDOWN_CLASS, NULL, + /* window styles */ + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | + UDS_ARROWKEYS | UDS_NOTHOUSANDS, + /* placement */ + 0, 0, 8, 8, + /* parent, etc */ + NULL, NULL, hinst, NULL); + assert (hWndUpDown); + /* set the buddy. */ + SendMessage (hWndUpDown, UDM_SETBUDDY, (LONG)hWndEdit, 0L ); + /* set the range. */ + SendMessage (hWndUpDown, UDM_SETRANGE, 0L, (LPARAM) MAKELONG(32000, 0)); + /* maybe show it. */ + if (winetest_interactive) + ShowWindow (hWndUpDown, SW_SHOW); + return hWndUpDown; +} + +static void test_updown_control (void) +{ + HWND hWndUpDown, hWndEdit; + int num; + + hWndEdit = create_edit_control (ES_AUTOHSCROLL | ES_NUMBER, 0); + hWndUpDown = create_updown_control (hWndEdit); + /* before we set a value, it should be '0' */ + num = SendMessage(hWndUpDown, UDM_GETPOS, 0, 0L); + ok(num == 0, "Expected 0 got %d\n", num); + /* set a value, check it. */ + SendMessage(hWndUpDown, UDM_SETPOS, 0L, MAKELONG( 1, 0)); + num = SendMessage(hWndUpDown, UDM_GETPOS, 0, 0L); + ok(num == 1, "Expected 1 got %d\n", num); + /* okay, done (short set of tests!) */ + DestroyWindow(hWndUpDown); + DestroyWindow(hWndEdit); +} + +START_TEST(updown) +{ + desktopDC=GetDC(NULL); + hinst = GetModuleHandleA(NULL); + + InitCommonControls(); + + test_updown_control(); +} diff -urN wine-20050310/dlls/comctl32/toolbar.c wine-20050419/dlls/comctl32/toolbar.c --- wine-20050310/dlls/comctl32/toolbar.c 2005-01-28 18:19:29.000000000 +0100 +++ wine-20050419/dlls/comctl32/toolbar.c 2005-04-15 16:09:05.000000000 +0200 @@ -21,15 +21,6 @@ * * NOTES * - * Differences between MSDN and actual native control operation: - * 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text - * to the right of the bitmap. Otherwise, this style is - * identical to TBSTYLE_FLAT." - * As implemented by both v4.71 and v5.80 of the native COMCTL32.DLL - * you can create a TBSTYLE_LIST without TBSTYLE_FLAT and the result - * is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does - * *not* imply TBSTYLE_FLAT as documented. (GA 8/2001) - * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Mar. 14, 2004, by Robert Shearman. * @@ -66,6 +57,16 @@ * setparnt.exe, setrows.exe, toolwnd.exe. * - Microsoft's controlspy examples. * - Charles Petzold's 'Programming Windows': gadgets.exe + * + * Differences between MSDN and actual native control operation: + * 1. MSDN says: "TBSTYLE_LIST: Creates a flat toolbar with button text + * to the right of the bitmap. Otherwise, this style is + * identical to TBSTYLE_FLAT." + * As implemented by both v4.71 and v5.80 of the native COMCTL32.DLL + * you can create a TBSTYLE_LIST without TBSTYLE_FLAT and the result + * is non-flat non-transparent buttons. Therefore TBSTYLE_LIST does + * *not* imply TBSTYLE_FLAT as documented. (GA 8/2001) + * */ #include @@ -116,9 +117,9 @@ typedef struct { - DWORD dwStructSize; /* size of TBBUTTON struct */ - INT nHeight; /* height of the toolbar */ - INT nWidth; /* width of the toolbar */ + DWORD dwStructSize; /* size of TBBUTTON struct */ + INT nHeight; /* height of the toolbar */ + INT nWidth; /* width of the toolbar */ RECT client_rect; RECT rcBound; /* bounding rectangle */ INT nButtonHeight; @@ -145,7 +146,7 @@ INT iListGap; /* default gap between text and image for toolbar with list style */ HFONT hDefaultFont; HFONT hFont; /* text font */ - HIMAGELIST himlInt; /* image list created internally */ + HIMAGELIST himlInt; /* image list created internally */ PIMLENTRY *himlDef; /* default image list array */ INT cimlDef; /* default image list array count */ PIMLENTRY *himlHot; /* hot image list array */ @@ -162,9 +163,9 @@ BOOL bDragOutSent; /* has TBN_DRAGOUT notification been sent for this drag? */ BOOL bUnicode; /* Notifications are ASCII (FALSE) or Unicode (TRUE)? */ BOOL bCaptured; /* mouse captured? */ - DWORD dwStyle; /* regular toolbar style */ - DWORD dwExStyle; /* extended toolbar style */ - DWORD dwDTFlags; /* DrawText flags */ + DWORD dwStyle; /* regular toolbar style */ + DWORD dwExStyle; /* extended toolbar style */ + DWORD dwDTFlags; /* DrawText flags */ COLORREF clrInsertMark; /* insert mark color */ COLORREF clrBtnHighlight; /* color for Flat Separator */ @@ -489,7 +490,7 @@ newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; oldcolor = SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); myrect.left = myrect.right; myrect.right = myrect.left + 1; @@ -497,7 +498,7 @@ newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); SetBkColor (hdc, oldcolor); } @@ -533,7 +534,7 @@ newcolor = (infoPtr->clrBtnShadow == CLR_DEFAULT) ? comctl32_color.clrBtnShadow : infoPtr->clrBtnShadow; oldcolor = SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); myrect.top = myrect.bottom; myrect.bottom = myrect.top + 1; @@ -541,7 +542,7 @@ newcolor = (infoPtr->clrBtnHighlight == CLR_DEFAULT) ? comctl32_color.clrBtnHighlight : infoPtr->clrBtnHighlight; SetBkColor (hdc, newcolor); - ExtTextOutA (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); + ExtTextOutW (hdc, 0, 0, ETO_OPAQUE, &myrect, 0, 0, 0); SetBkColor (hdc, oldcolor); } @@ -990,9 +991,9 @@ COLORREF oldclr; oldclr = SetBkColor(hdc, tbcd.clrHighlightHotTrack); - ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rc, NULL, 0, 0); if (hasDropDownArrow) - ExtTextOutA(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0); + ExtTextOutW(hdc, 0, 0, ETO_OPAQUE, &rcArrow, NULL, 0, 0); SetBkColor(hdc, oldclr); } } @@ -2531,7 +2532,7 @@ /* copy the bitmap before adding it so that the user's bitmap * doesn't get modified. */ - GetObjectA ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp); hdcImage = CreateCompatibleDC(0); hdcBitmap = CreateCompatibleDC(0); @@ -2559,48 +2560,48 @@ switch (lpAddBmp->nID) { case IDB_STD_SMALL_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_STD_SMALL)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_STD_SMALL)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_STD_LARGE_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_STD_LARGE)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_STD_LARGE)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_SMALL_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_VIEW_SMALL)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_VIEW_SMALL)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_VIEW_LARGE_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_VIEW_LARGE)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_VIEW_LARGE)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_SMALL_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_HIST_SMALL)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_HIST_SMALL)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); break; case IDB_HIST_LARGE_COLOR: - hbmLoad = LoadBitmapA (COMCTL32_hModule, - MAKEINTRESOURCEA(IDB_HIST_LARGE)); + hbmLoad = LoadBitmapW (COMCTL32_hModule, + MAKEINTRESOURCEW(IDB_HIST_LARGE)); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); @@ -2614,7 +2615,7 @@ } else { - hbmLoad = LoadBitmapA (lpAddBmp->hInst, (LPSTR)lpAddBmp->nID); + hbmLoad = LoadBitmapW (lpAddBmp->hInst, (LPWSTR)lpAddBmp->nID); nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace); DeleteObject (hbmLoad); } @@ -2807,8 +2808,7 @@ INT len; TRACE("adding string from resource!\n"); - len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, - szString, 256); + len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, szString, sizeof(szString)); TRACE("len=%d \"%s\"\n", len, szString); nIndex = infoPtr->nNumStrings; @@ -3445,7 +3445,7 @@ return MAKELONG((WORD)infoPtr->nButtonWidth, (WORD)infoPtr->nButtonHeight); else - return MAKELONG(8,7); + return MAKELONG(23,22); } @@ -4331,7 +4331,7 @@ /* copy the bitmap before adding it so that the user's bitmap * doesn't get modified. */ - GetObjectA (hBitmap, sizeof(BITMAP), (LPVOID)&bmp); + GetObjectW (hBitmap, sizeof(BITMAP), (LPVOID)&bmp); hdcImage = CreateCompatibleDC(0); hdcBitmap = CreateCompatibleDC(0); @@ -4430,7 +4430,7 @@ res = ERROR_FILE_NOT_FOUND; if (!res) { - nmtbr.pData = HeapAlloc(GetProcessHeap(), 0, dwSize); + nmtbr.pData = Alloc(dwSize); nmtbr.cbData = (UINT)dwSize; if (!nmtbr.pData) res = ERROR_OUTOFMEMORY; } @@ -4503,7 +4503,7 @@ if (infoPtr->nNumButtons > 0) ret = TRUE; } } - HeapFree(GetProcessHeap(), 0, nmtbr.pData); + Free (nmtbr.pData); RegCloseKey(hkey); return ret; @@ -4527,22 +4527,33 @@ static LRESULT TOOLBAR_SaveRestoreA (HWND hwnd, WPARAM wParam, LPTBSAVEPARAMSA lpSave) { + LPWSTR pszValueName = 0, pszSubKey = 0; TBSAVEPARAMSW SaveW; + LRESULT result = 0; int len; if (lpSave == NULL) return 0; - SaveW.hkr = lpSave->hkr; - len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, NULL, 0); - SaveW.pszSubKey = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, (LPWSTR)SaveW.pszSubKey, len); + pszSubKey = Alloc(len * sizeof(WCHAR)); + if (pszSubKey) goto exit; + MultiByteToWideChar(CP_ACP, 0, lpSave->pszSubKey, -1, pszSubKey, len); len = MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, NULL, 0); - SaveW.pszValueName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, (LPWSTR)SaveW.pszValueName, len); + pszValueName = Alloc(len * sizeof(WCHAR)); + if (!pszValueName) goto exit; + MultiByteToWideChar(CP_ACP, 0, lpSave->pszValueName, -1, pszValueName, len); + + SaveW.pszValueName = pszValueName; + SaveW.pszSubKey = pszSubKey; + SaveW.hkr = lpSave->hkr; + result = TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW); + +exit: + Free (pszValueName); + Free (pszSubKey); - return TOOLBAR_SaveRestoreW(hwnd, wParam, &SaveW); + return result; } @@ -5442,7 +5453,7 @@ { TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd); DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); - LOGFONTA logFont; + LOGFONTW logFont; TRACE("hwnd = %p\n", hwnd); @@ -5483,13 +5494,13 @@ infoPtr->bUnicode = infoPtr->hwndNotify && (NFR_UNICODE == SendMessageW(hwnd, WM_NOTIFYFORMAT, (WPARAM)hwnd, (LPARAM)NF_REQUERY)); - SystemParametersInfoA (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); - infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectA (&logFont); + SystemParametersInfoW (SPI_GETICONTITLELOGFONT, 0, &logFont, 0); + infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW (&logFont); if (dwStyle & TBSTYLE_TOOLTIPS) { /* Create tooltip control */ infoPtr->hwndToolTip = - CreateWindowExA (0, TOOLTIPS_CLASSA, NULL, 0, + CreateWindowExW (0, TOOLTIPS_CLASSW, NULL, 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, 0, 0, 0); @@ -5523,7 +5534,7 @@ DestroyWindow (infoPtr->hwndToolTip); /* delete temporary buffer for tooltip text */ - HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); + Free (infoPtr->pszTooltipText); /* delete button data */ if (infoPtr->buttons) @@ -5653,7 +5664,7 @@ if (nHit >= 0) TOOLBAR_LButtonDown (hwnd, wParam, lParam); - else if (GetWindowLongA (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) + else if (GetWindowLongW (hwnd, GWL_STYLE) & CCS_ADJUSTABLE) TOOLBAR_Customize (hwnd); return 0; @@ -6187,22 +6198,22 @@ /* native control does: * Get a lot of colors and brushes * WM_NOTIFYFORMAT - * SystemParametersInfoA(0x1f, 0x3c, adr1, 0) - * CreateFontIndirectA(adr1) + * SystemParametersInfoW(0x1f, 0x3c, adr1, 0) + * CreateFontIndirectW(adr1) * CreateBitmap(0x27, 0x24, 1, 1, 0) * hdc = GetDC(toolbar) * GetSystemMetrics(0x48) - * fnt2=CreateFontA(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, + * fnt2=CreateFontW(0xe, 0, 0, 0, 0x190, 0, 0, 0, 0, 2, * 0, 0, 0, 0, "MARLETT") * oldfnt = SelectObject(hdc, fnt2) - * GetCharWidthA(hdc, 0x36, 0x36, adr2) - * GetTextMetricsA(hdc, adr3) + * GetCharWidthW(hdc, 0x36, 0x36, adr2) + * GetTextMetricsW(hdc, adr3) * SelectObject(hdc, oldfnt) * DeleteObject(fnt2) * ReleaseDC(hdc) * InvalidateRect(toolbar, 0, 1) - * SetWindowLongA(toolbar, 0, addr) - * SetWindowLongA(toolbar, -16, xxx) **sometimes** + * SetWindowLongW(toolbar, 0, addr) + * SetWindowLongW(toolbar, -16, xxx) **sometimes** * WM_STYLECHANGING * CallWinEx old new * ie 1 0x56000a4c 0x46000a4c 0x56008a4d @@ -6277,7 +6288,7 @@ TRACE("button index = %d\n", index); - HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); + Free (infoPtr->pszTooltipText); infoPtr->pszTooltipText = NULL; if (index < 0) @@ -6307,7 +6318,7 @@ /* need to allocate temporary buffer in infoPtr as there * isn't enough space in buffer passed to us by the * tooltip control */ - infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR)); if (infoPtr->pszTooltipText) { memcpy(infoPtr->pszTooltipText, tbgit.pszText, (len+1)*sizeof(WCHAR)); @@ -6345,7 +6356,7 @@ /* need to allocate temporary buffer in infoPtr as there * isn't enough space in buffer passed to us by the * tooltip control */ - infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR)); if (infoPtr->pszTooltipText) { MultiByteToWideChar(CP_ACP, 0, tbgit.pszText, len+1, infoPtr->pszTooltipText, (len+1)*sizeof(WCHAR)); @@ -6375,7 +6386,7 @@ /* need to allocate temporary buffer in infoPtr as there * isn't enough space in buffer passed to us by the * tooltip control */ - infoPtr->pszTooltipText = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + infoPtr->pszTooltipText = Alloc((len+1)*sizeof(WCHAR)); if (infoPtr->pszTooltipText) { memcpy(infoPtr->pszTooltipText, pszText, (len+1)*sizeof(WCHAR)); diff -urN wine-20050310/dlls/comctl32/tooltips.c wine-20050419/dlls/comctl32/tooltips.c --- wine-20050310/dlls/comctl32/tooltips.c 2005-01-09 17:42:54.000000000 +0100 +++ wine-20050419/dlls/comctl32/tooltips.c 2005-04-18 12:30:57.000000000 +0200 @@ -18,6 +18,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES + * * This code was audited for completeness against the documented features * of Comctl32.dll version 6.0 on Sep. 08, 2004, by Robert Shearman. * @@ -214,7 +216,7 @@ if (infoPtr->nMaxTipWidth > -1) uFlags |= DT_WORDBREAK; - if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX) + if (GetWindowLongW (hwnd, GWL_STYLE) & TTS_NOPREFIX) uFlags |= DT_NOPREFIX; GetClientRect (hwnd, &rc); @@ -385,7 +387,7 @@ else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) { INT max_len = (ttnmdi.lpszText == &ttnmdi.szText[0]) ? sizeof(ttnmdi.szText)/sizeof(ttnmdi.szText[0]) : INFOTIPSIZE-1; - strncpyW(infoPtr->szTipText, ttnmdi.lpszText, max_len); + lstrcpynW(infoPtr->szTipText, ttnmdi.lpszText, max_len); if (ttnmdi.uFlags & TTF_DI_SETITEM) { INT len = max(strlenW(ttnmdi.lpszText), max_len); toolPtr->hinst = 0; @@ -610,8 +612,8 @@ rect.top = rect.bottom - size.cy; } - AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), - FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); + AdjustWindowRectEx (&rect, GetWindowLongW (hwnd, GWL_STYLE), + FALSE, GetWindowLongW (hwnd, GWL_EXSTYLE)); if (style & TTS_BALLOON) { @@ -782,8 +784,8 @@ rect.right = rect.left + size.cx; rect.bottom = rect.top + size.cy; - AdjustWindowRectEx (&rect, GetWindowLongA (hwnd, GWL_STYLE), - FALSE, GetWindowLongA (hwnd, GWL_EXSTYLE)); + AdjustWindowRectEx (&rect, GetWindowLongW (hwnd, GWL_STYLE), + FALSE, GetWindowLongW (hwnd, GWL_EXSTYLE)); if (GetWindowLongW(hwnd, GWL_STYLE) & TTS_BALLOON) { @@ -945,7 +947,7 @@ if (nTool == -1) return -1; - if (!(GetWindowLongA (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) { + if (!(GetWindowLongW (hwnd, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest) { if (!TOOLTIPS_IsWindowActive (GetWindow (hwnd, GW_OWNER))) return -1; } @@ -2395,8 +2397,8 @@ static LRESULT TOOLTIPS_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam) { - DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE); - DWORD dwExStyle = GetWindowLongA (hwnd, GWL_EXSTYLE); + DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); + DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE); dwStyle &= 0x0000FFFF; dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS); @@ -2405,10 +2407,10 @@ * window region, therefore it is useless to us in balloon mode */ if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER; - SetWindowLongA (hwnd, GWL_STYLE, dwStyle); + SetWindowLongW (hwnd, GWL_STYLE, dwStyle); dwExStyle |= WS_EX_TOOLWINDOW; - SetWindowLongA (hwnd, GWL_EXSTYLE, dwExStyle); + SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle); return TRUE; } diff -urN wine-20050310/dlls/comctl32/treeview.c wine-20050419/dlls/comctl32/treeview.c --- wine-20050310/dlls/comctl32/treeview.c 2005-02-22 20:31:01.000000000 +0100 +++ wine-20050419/dlls/comctl32/treeview.c 2005-04-18 12:20:51.000000000 +0200 @@ -19,6 +19,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + * NOTES + * * Note that TREEVIEW_INFO * and HTREEITEM are the same thing. * * Note2: All items always! have valid (allocated) pszText field. @@ -239,6 +241,39 @@ return DPA_GetPtrIndex(infoPtr->items, handle); } +/* Checks if item has changed and needs to be redrawn */ +static inline BOOL item_changed (TREEVIEW_ITEM *tiOld, TREEVIEW_ITEM *tiNew, LPTVITEMEXW tvChange) +{ + /* Number of children has changed */ + if ((tvChange->mask & TVIF_CHILDREN) && (tiOld->cChildren != tiNew->cChildren)) + return TRUE; + + /* Image has changed and it's not a callback */ + if ((tvChange->mask & TVIF_IMAGE) && (tiOld->iImage != tiNew->iImage) && + tiNew->iImage != I_IMAGECALLBACK) + return TRUE; + + /* Selected image has changed and it's not a callback */ + if ((tvChange->mask & TVIF_SELECTEDIMAGE) && (tiOld->iSelectedImage != tiNew->iSelectedImage) && + tiNew->iSelectedImage != I_IMAGECALLBACK) + return TRUE; + + /* Text has changed and it's not a callback */ + if ((tvChange->mask & TVIF_TEXT) && (tiOld->pszText != tiNew->pszText) && + tiNew->pszText != LPSTR_TEXTCALLBACKW) + return TRUE; + + /* Indent has changed */ + if ((tvChange->mask & TVIF_INTEGRAL) && (tiOld->iIntegral != tiNew->iIntegral)) + return TRUE; + + /* Item state has changed */ + if ((tvChange->mask & TVIF_STATE) && ((tiOld->state ^ tiNew->state) & tvChange->stateMask )) + return TRUE; + + return FALSE; +} + /*************************************************************************** * This method checks that handle is an item for this tree. */ @@ -489,7 +524,6 @@ tvItem->state = item->state; tvItem->stateMask = 0; tvItem->iImage = item->iImage; - tvItem->iImage = item->iImage; tvItem->iSelectedImage = item->iSelectedImage; tvItem->cChildren = item->cChildren; tvItem->lParam = item->lParam; @@ -615,10 +649,10 @@ static BOOL TREEVIEW_SendCustomDrawItemNotify(TREEVIEW_INFO *infoPtr, HDC hdc, - TREEVIEW_ITEM *wineItem, UINT uItemDrawState) + TREEVIEW_ITEM *wineItem, UINT uItemDrawState, + NMTVCUSTOMDRAW *nmcdhdr) { HWND hwnd = infoPtr->hwnd; - NMTVCUSTOMDRAW nmcdhdr; LPNMCUSTOMDRAW nmcd; DWORD dwDrawStage, dwItemSpec; UINT uItemState; @@ -634,7 +668,7 @@ if (wineItem == infoPtr->hotItem) uItemState |= CDIS_HOT; - nmcd = &nmcdhdr.nmcd; + nmcd = &nmcdhdr->nmcd; nmcd->hdr.hwndFrom = hwnd; nmcd->hdr.idFrom = GetWindowLongPtrW(hwnd, GWLP_ID); nmcd->hdr.code = NM_CUSTOMDRAW; @@ -644,9 +678,7 @@ nmcd->dwItemSpec = dwItemSpec; nmcd->uItemState = uItemState; nmcd->lItemlParam = wineItem->lParam; - nmcdhdr.clrText = infoPtr->clrText; - nmcdhdr.clrTextBk = infoPtr->clrBk; - nmcdhdr.iLevel = wineItem->iLevel; + nmcdhdr->iLevel = wineItem->iLevel; TRACE("drawstage:%lx hdc:%p item:%lx, itemstate:%x, lItemlParam:%lx\n", nmcd->dwDrawStage, nmcd->hdc, nmcd->dwItemSpec, @@ -654,10 +686,8 @@ retval = TREEVIEW_SendRealNotify(infoPtr, (WPARAM)nmcd->hdr.idFrom, - (LPARAM)&nmcdhdr); + (LPARAM)nmcdhdr); - infoPtr->clrText = nmcdhdr.clrText; - infoPtr->clrBk = nmcdhdr.clrTextBk; return (BOOL)retval; } @@ -974,6 +1004,9 @@ if (!newItem) return NULL; + newItem->iImage = -1; + newItem->iSelectedImage = -1; + if (DPA_InsertPtr(infoPtr->items, INT_MAX, newItem) == -1) { Free(newItem); @@ -2112,9 +2145,8 @@ /* The refresh updates everything, but we can't wait until then. */ TREEVIEW_ComputeItemInternalMetrics(infoPtr, wineItem); - /* if any of the items values changed, redraw the item */ - if(memcmp(&originalItem, wineItem, sizeof(TREEVIEW_ITEM)) || - (tvItem->stateMask & TVIS_BOLD)) + /* if any of the item's values changed and it's not a callback, redraw the item */ + if (item_changed(&originalItem, wineItem, tvItem)) { if (tvItem->mask & TVIF_INTEGRAL) { @@ -2263,10 +2295,14 @@ BOOL lar = ((infoPtr->dwStyle & (TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS)) > TVS_LINESATROOT); + HBRUSH hbr, hbrOld; if (!lar && item->iLevel == 0) return; + hbr = CreateSolidBrush(infoPtr->clrBk); + hbrOld = SelectObject(hdc, hbr); + centerx = (item->linesOffset + item->stateOffset) / 2; centery = (item->rect.top + item->rect.bottom) / 2; @@ -2333,15 +2369,10 @@ HPEN hNewPen = CreatePen(PS_SOLID, 0, infoPtr->clrLine); HPEN hOldPen = SelectObject(hdc, hNewPen); - HBRUSH hbr = CreateSolidBrush(infoPtr->clrBk); - HBRUSH hbrOld = SelectObject(hdc, hbr); Rectangle(hdc, centerx - rectsize - 1, centery - rectsize - 1, centerx + rectsize + 2, centery + rectsize + 2); - SelectObject(hdc, hbrOld); - DeleteObject(hbr); - SelectObject(hdc, hOldPen); DeleteObject(hNewPen); @@ -2371,6 +2402,8 @@ } } } + SelectObject(hdc, hbrOld); + DeleteObject(hbr); } static void @@ -2378,12 +2411,50 @@ { INT cditem; HFONT hOldFont; + COLORREF oldTextColor, oldTextBkColor; int centery; - - hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, wineItem)); + BOOL inFocus = (GetFocus() == infoPtr->hwnd); + NMTVCUSTOMDRAW nmcdhdr; TREEVIEW_UpdateDispInfo(infoPtr, wineItem, CALLBACK_MASK_ALL); + /* - If item is drop target or it is selected and window is in focus - + * use blue background (COLOR_HIGHLIGHT). + * - If item is selected, window is not in focus, but it has style + * TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE) + * - Otherwise - use background color + */ + if ((wineItem->state & TVIS_DROPHILITED) || ((wineItem == infoPtr->focusedItem) && !(wineItem->state & TVIS_SELECTED)) || + ((wineItem->state & TVIS_SELECTED) && (!infoPtr->focusedItem) && + (inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS)))) + { + if ((wineItem->state & TVIS_DROPHILITED) || inFocus) + { + nmcdhdr.clrTextBk = GetSysColor(COLOR_HIGHLIGHT); + nmcdhdr.clrText = GetSysColor(COLOR_HIGHLIGHTTEXT); + } + else + { + nmcdhdr.clrTextBk = GetSysColor(COLOR_BTNFACE); + if (infoPtr->clrText == -1) + nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT); + else + nmcdhdr.clrText = infoPtr->clrText; + } + } + else + { + nmcdhdr.clrTextBk = infoPtr->clrBk; + if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) + nmcdhdr.clrText = comctl32_color.clrHighlight; + else if (infoPtr->clrText == -1) + nmcdhdr.clrText = GetSysColor(COLOR_WINDOWTEXT); + else + nmcdhdr.clrText = infoPtr->clrText; + } + + hOldFont = SelectObject(hdc, TREEVIEW_FontForItem(infoPtr, wineItem)); + /* The custom draw handler can query the text rectangle, * so get ready. */ /* should already be known, set to 0 when changed */ @@ -2395,7 +2466,7 @@ if (infoPtr->cdmode & CDRF_NOTIFYITEMDRAW) { cditem = TREEVIEW_SendCustomDrawItemNotify - (infoPtr, hdc, wineItem, CDDS_ITEMPREPAINT); + (infoPtr, hdc, wineItem, CDDS_ITEMPREPAINT, &nmcdhdr); TRACE("prepaint:cditem-app returns 0x%x\n", cditem); if (cditem & CDRF_SKIPDEFAULT) @@ -2410,6 +2481,10 @@ TREEVIEW_DrawItemLines(infoPtr, hdc, wineItem); + /* Set colors. Custom draw handler can change these so we do this after it. */ + oldTextColor = SetTextColor(hdc, nmcdhdr.clrText); + oldTextBkColor = SetBkColor(hdc, nmcdhdr.clrTextBk); + centery = (wineItem->rect.top + wineItem->rect.bottom) / 2; /* @@ -2435,7 +2510,7 @@ * non-selected image. */ - if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage)) + if ((wineItem->state & TVIS_SELECTED) && (wineItem->iSelectedImage >= 0)) { /* The item is currently selected */ imageIndex = wineItem->iSelectedImage; @@ -2467,87 +2542,31 @@ { if (wineItem->pszText) { - COLORREF oldTextColor = 0; - INT oldBkMode; - HBRUSH hbrBk = 0; - BOOL inFocus = (GetFocus() == infoPtr->hwnd); RECT rcText; - oldBkMode = SetBkMode(hdc, TRANSPARENT); - - /* - If item is drop target or it is selected and window is in focus - - * use blue background (COLOR_HIGHLIGHT). - * - If item is selected, window is not in focus, but it has style - * TVS_SHOWSELALWAYS - use grey background (COLOR_BTNFACE) - * - Otherwise - don't fill background - */ - if ((wineItem->state & TVIS_DROPHILITED) || ((wineItem == infoPtr->focusedItem) && !(wineItem->state & TVIS_SELECTED)) || - ((wineItem->state & TVIS_SELECTED) && (!infoPtr->focusedItem) && - (inFocus || (infoPtr->dwStyle & TVS_SHOWSELALWAYS)))) - { - if ((wineItem->state & TVIS_DROPHILITED) || inFocus) - { - hbrBk = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)); - oldTextColor = - SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT)); - } - else - { - hbrBk = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); - - if (infoPtr->clrText == -1) - oldTextColor = - SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); - else - oldTextColor = SetTextColor(hdc, infoPtr->clrText); - } - } - else - { - if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) - oldTextColor = SetTextColor(hdc, comctl32_color.clrHighlight); - else if (infoPtr->clrText == -1) - oldTextColor = - SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); - else - oldTextColor = SetTextColor(hdc, infoPtr->clrText); - } - rcText.top = wineItem->rect.top; rcText.bottom = wineItem->rect.bottom; rcText.left = wineItem->textOffset; rcText.right = rcText.left + wineItem->textWidth + 4; - if (hbrBk) - { - FillRect(hdc, &rcText, hbrBk); - DeleteObject(hbrBk); - } + TRACE("drawing text %s at (%ld,%ld)-(%ld,%ld)\n", + debugstr_w(wineItem->pszText), + rcText.left, rcText.top, rcText.right, rcText.bottom); + /* Draw it */ + ExtTextOutW(hdc, rcText.left + 2, rcText.top + 1, + ETO_CLIPPED | ETO_OPAQUE, + &rcText, + wineItem->pszText, + lstrlenW(wineItem->pszText), + NULL); + /* Draw the box around the selected item */ if ((wineItem == infoPtr->selectedItem) && inFocus) { DrawFocusRect(hdc,&rcText); } - InflateRect(&rcText, -2, -1); /* allow for the focus rect */ - - TRACE("drawing text %s at (%ld,%ld)-(%ld,%ld)\n", - debugstr_w(wineItem->pszText), - rcText.left, rcText.top, rcText.right, rcText.bottom); - - /* Draw it */ - DrawTextW(hdc, - wineItem->pszText, - lstrlenW(wineItem->pszText), - &rcText, - DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); - - /* Restore the hdc state */ - SetTextColor(hdc, oldTextColor); - - if (oldBkMode != TRANSPARENT) - SetBkMode(hdc, oldBkMode); } } @@ -2591,10 +2610,13 @@ if (cditem & CDRF_NOTIFYPOSTPAINT) { cditem = TREEVIEW_SendCustomDrawItemNotify - (infoPtr, hdc, wineItem, CDDS_ITEMPOSTPAINT); + (infoPtr, hdc, wineItem, CDDS_ITEMPOSTPAINT, &nmcdhdr); TRACE("postpaint:cditem-app returns 0x%x\n", cditem); } + /* Restore the hdc state */ + SetTextColor(hdc, oldTextColor); + SetBkColor(hdc, oldTextBkColor); SelectObject(hdc, hOldFont); } @@ -2814,7 +2836,7 @@ BITMAP bitmap; hbitmap = GetCurrentObject(hdc, OBJ_BITMAP); if (!hbitmap) return 0; - GetObjectA(hbitmap, sizeof(BITMAP), &bitmap); + GetObjectW(hbitmap, sizeof(BITMAP), &bitmap); rc.left = 0; rc.top = 0; rc.right = bitmap.bmWidth; rc.bottom = bitmap.bmHeight; @@ -3807,7 +3829,7 @@ while (1) { - if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) + if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD)) { if (msg.message == WM_MOUSEMOVE) { @@ -3829,7 +3851,7 @@ break; } - DispatchMessageA(&msg); + DispatchMessageW(&msg); } if (GetCapture() != infoPtr->hwnd) @@ -4216,14 +4238,17 @@ TREEVIEW_EnsureVisible(infoPtr, infoPtr->selectedItem, FALSE); + if (prevSelect) + TREEVIEW_Invalidate(infoPtr, prevSelect); + if (newSelect) + TREEVIEW_Invalidate(infoPtr, newSelect); + TREEVIEW_SendTreeviewNotify(infoPtr, TVN_SELCHANGEDW, cause, TVIF_HANDLE | TVIF_STATE | TVIF_PARAM, prevSelect, newSelect); - TREEVIEW_Invalidate(infoPtr, prevSelect); - TREEVIEW_Invalidate(infoPtr, newSelect); break; case TVGN_DROPHILITE: @@ -4242,9 +4267,12 @@ break; case TVGN_FIRSTVISIBLE: - TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE); - TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE); - TREEVIEW_Invalidate(infoPtr, NULL); + if (newSelect != NULL) + { + TREEVIEW_EnsureVisible(infoPtr, newSelect, FALSE); + TREEVIEW_SetFirstVisible(infoPtr, newSelect, TRUE); + TREEVIEW_Invalidate(infoPtr, NULL); + } break; } @@ -4381,10 +4409,18 @@ idx=infoPtr->root->firstChild; } do { + /* At the end point, sort out wrapping */ if (idx == NULL) { + + /* If endidx is null, stop at the last item (ie top to bottom) */ if (endidx == NULL) break; + + /* Otherwise, start again at the very beginning */ idx=infoPtr->root->firstChild; + + /* But if we are stopping on the first child, end now! */ + if (idx == endidx) break; } /* get item */ @@ -5180,7 +5216,7 @@ } return 0; } - return DefWindowProcA(infoPtr->hwnd, WM_NOTIFY, wParam, lParam); + return DefWindowProcW(infoPtr->hwnd, WM_NOTIFY, wParam, lParam); } static INT TREEVIEW_NotifyFormat (TREEVIEW_INFO *infoPtr, HWND hwndFrom, UINT nCommand) @@ -5289,8 +5325,8 @@ TVC_UNKNOWN); } - TREEVIEW_SendSimpleNotify(infoPtr, NM_SETFOCUS); TREEVIEW_Invalidate(infoPtr, infoPtr->selectedItem); + TREEVIEW_SendSimpleNotify(infoPtr, NM_SETFOCUS); return 0; } @@ -5299,8 +5335,9 @@ { TRACE("\n"); - TREEVIEW_SendSimpleNotify(infoPtr, NM_KILLFOCUS); TREEVIEW_Invalidate(infoPtr, infoPtr->selectedItem); + UpdateWindow(infoPtr->hwnd); + TREEVIEW_SendSimpleNotify(infoPtr, NM_KILLFOCUS); return 0; } @@ -5567,7 +5604,7 @@ if ((uMsg >= WM_USER) && (uMsg < WM_APP)) TRACE("Unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); def: - return DefWindowProcA(hwnd, uMsg, wParam, lParam); + return DefWindowProcW(hwnd, uMsg, wParam, lParam); } } @@ -5577,28 +5614,28 @@ VOID TREEVIEW_Register(void) { - WNDCLASSA wndClass; + WNDCLASSW wndClass; TRACE("\n"); - ZeroMemory(&wndClass, sizeof(WNDCLASSA)); + ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = TREEVIEW_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(TREEVIEW_INFO *); - wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW); + wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wndClass.hbrBackground = 0; - wndClass.lpszClassName = WC_TREEVIEWA; + wndClass.lpszClassName = WC_TREEVIEWW; - RegisterClassA(&wndClass); + RegisterClassW(&wndClass); } VOID TREEVIEW_Unregister(void) { - UnregisterClassA(WC_TREEVIEWA, NULL); + UnregisterClassW(WC_TREEVIEWW, NULL); } diff -urN wine-20050310/dlls/comctl32/updown.c wine-20050419/dlls/comctl32/updown.c --- wine-20050310/dlls/comctl32/updown.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050419/dlls/comctl32/updown.c 2005-04-14 15:58:45.000000000 +0200 @@ -49,6 +49,7 @@ { HWND Self; /* Handle to this up-down control */ HWND Notify; /* Handle to the parent window */ + DWORD dwStyle; /* The GWL_STYLE for this window */ UINT AccelCount; /* Number of elements in AccelVect */ UDACCEL* AccelVect; /* Vector containing AccelCount elements */ INT AccelIndex; /* Current accel index, -1 if not accel'ing */ @@ -97,7 +98,7 @@ static const WCHAR BUDDY_UPDOWN_HWND[] = { 'b', 'u', 'd', 'd', 'y', 'U', 'p', 'D', 'o', 'w', 'n', 'H', 'W', 'N', 'D', 0 }; static const WCHAR BUDDY_SUPERCLASS_WNDPROC[] = { 'b', 'u', 'd', 'd', 'y', 'S', 'u', 'p', 'p', 'e', 'r', - 'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 }; + 'C', 'l', 'a', 's', 's', 'W', 'n', 'd', 'P', 'r', 'o', 'c', 0 }; static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action); /*********************************************************************** @@ -140,7 +141,7 @@ { /* check if we can do the modification first */ if(!UPDOWN_InBounds (infoPtr, infoPtr->CurVal+delta)) { - if (GetWindowLongW (infoPtr->Self, GWL_STYLE) & UDS_WRAP) { + if (infoPtr->dwStyle & UDS_WRAP) { delta += (delta < 0 ? -1 : 1) * (infoPtr->MaxVal < infoPtr->MinVal ? -1 : 1) * (infoPtr->MinVal - infoPtr->MaxVal) + @@ -160,9 +161,7 @@ */ static BOOL UPDOWN_HasBuddyBorder(UPDOWN_INFO* infoPtr) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); - - return ( ((dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) && + return ( ((infoPtr->dwStyle & (UDS_ALIGNLEFT | UDS_ALIGNRIGHT)) != 0) && UPDOWN_IsBuddyEdit(infoPtr) ); } @@ -176,8 +175,6 @@ */ static void UPDOWN_GetArrowRect (UPDOWN_INFO* infoPtr, RECT *rect, int arrow) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); - GetClientRect (infoPtr->Self, rect); /* @@ -185,7 +182,7 @@ * border. */ if (UPDOWN_HasBuddyBorder(infoPtr)) { - if (dwStyle & UDS_ALIGNLEFT) + if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->left += DEFAULT_BUDDYBORDER; else rect->right -= DEFAULT_BUDDYBORDER; @@ -195,7 +192,7 @@ /* now figure out if we need a space away from the buddy */ if ( IsWindow(infoPtr->Buddy) ) { - if (dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER; + if (infoPtr->dwStyle & UDS_ALIGNLEFT) rect->right -= DEFAULT_BUDDYSPACER; else rect->left += DEFAULT_BUDDYSPACER; } @@ -204,7 +201,7 @@ * separation between the buttons will lay. We make sure that we * round the uneven numbers by adding 1. */ - if (dwStyle & UDS_HORZ) { + if (infoPtr->dwStyle & UDS_HORZ) { int len = rect->right - rect->left + 1; /* compute the width */ if (arrow & FLAG_INCR) rect->left = rect->left + len/2; @@ -264,7 +261,7 @@ WCHAR txt[20], sep, *src, *dst; int newVal; - if (!IsWindow(infoPtr->Buddy)) + if (!((infoPtr->dwStyle & UDS_SETBUDDYINT) && IsWindow(infoPtr->Buddy))) return FALSE; /*if the buddy is a list window, we must set curr index */ @@ -273,7 +270,10 @@ if(newVal < 0) return FALSE; } else { /* we have a regular window, so will get the text */ - if (!GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt))) return FALSE; + /* note that a zero-length string is a legitimate value for 'txt', + * and ought to result in a successful conversion to '0'. */ + if (GetWindowTextW(infoPtr->Buddy, txt, COUNT_OF(txt)) < 0) + return FALSE; sep = UPDOWN_GetThousandSep(); @@ -306,7 +306,8 @@ WCHAR txt[20]; int len; - if (!IsWindow(infoPtr->Buddy)) return FALSE; + if (!((infoPtr->dwStyle & UDS_SETBUDDYINT) && IsWindow(infoPtr->Buddy))) + return FALSE; TRACE("set new value(%d) to buddy.\n", infoPtr->CurVal); @@ -321,7 +322,7 @@ /* Do thousands separation if necessary */ - if (!(GetWindowLongW (infoPtr->Self, GWL_STYLE) & UDS_NOTHOUSANDS) && (len > 3)) { + if (!(infoPtr->dwStyle & UDS_NOTHOUSANDS) && (len > 3)) { WCHAR tmp[COUNT_OF(txt)], *src = tmp, *dst = txt; WCHAR sep = UPDOWN_GetThousandSep(); int start = len % 3; @@ -347,7 +348,6 @@ */ static LRESULT UPDOWN_Draw (UPDOWN_INFO *infoPtr, HDC hdc) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); BOOL pressed, hot; RECT rect; @@ -356,7 +356,7 @@ GetClientRect(infoPtr->Self, &rect); DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_BOTTOM | BF_TOP | - (dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); + (infoPtr->dwStyle & UDS_ALIGNLEFT ? BF_LEFT : BF_RIGHT)); } /* Draw the incr button */ @@ -364,20 +364,20 @@ pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_INCR); hot = (infoPtr->Flags & FLAG_INCR) && (infoPtr->Flags & FLAG_MOUSEIN); DrawFrameControl(hdc, &rect, DFC_SCROLL, - (dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | - ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | + (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLRIGHT : DFCS_SCROLLUP) | + ((infoPtr->dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | (pressed ? DFCS_PUSHED : 0) | - (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); + (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); /* Draw the decr button */ UPDOWN_GetArrowRect(infoPtr, &rect, FLAG_DECR); pressed = (infoPtr->Flags & FLAG_PRESSED) && (infoPtr->Flags & FLAG_DECR); hot = (infoPtr->Flags & FLAG_DECR) && (infoPtr->Flags & FLAG_MOUSEIN); DrawFrameControl(hdc, &rect, DFC_SCROLL, - (dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | - ((dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | + (infoPtr->dwStyle & UDS_HORZ ? DFCS_SCROLLLEFT : DFCS_SCROLLDOWN) | + ((infoPtr->dwStyle & UDS_HOTTRACK) && hot ? DFCS_HOT : 0) | (pressed ? DFCS_PUSHED : 0) | - (dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); + (infoPtr->dwStyle & WS_DISABLED ? DFCS_INACTIVE : 0) ); return 0; } @@ -455,7 +455,6 @@ { static const WCHAR editW[] = { 'E', 'd', 'i', 't', 0 }; static const WCHAR listboxW[] = { 'L', 'i', 's', 't', 'b', 'o', 'x', 0 }; - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); RECT budRect; /* new coord for the buddy */ int x, width; /* new x position and width for the up-down */ WNDPROC baseWndProc; @@ -489,7 +488,7 @@ infoPtr->BuddyType = BUDDY_TYPE_LISTBOX; } - if(dwStyle & UDS_ARROWKEYS){ + if(infoPtr->dwStyle & UDS_ARROWKEYS){ /* Note that I don't clear the BUDDY_SUPERCLASS_WNDPROC property when we reset the upDown ctrl buddy to another buddy because it is not good to break the window proc chain. */ @@ -504,10 +503,10 @@ MapWindowPoints(HWND_DESKTOP, GetParent(infoPtr->Buddy), (POINT *)(&budRect.left), 2); /* now do the positioning */ - if (dwStyle & UDS_ALIGNLEFT) { + if (infoPtr->dwStyle & UDS_ALIGNLEFT) { x = budRect.left; budRect.left += DEFAULT_WIDTH + DEFAULT_XSEP; - } else if (dwStyle & UDS_ALIGNRIGHT) { + } else if (infoPtr->dwStyle & UDS_ALIGNRIGHT) { budRect.right -= DEFAULT_WIDTH + DEFAULT_XSEP; x = budRect.right+DEFAULT_XSEP; } else { @@ -531,7 +530,7 @@ * We nudge the control or change its size to overlap. */ if (UPDOWN_HasBuddyBorder(infoPtr)) { - if(dwStyle & UDS_ALIGNLEFT) + if(infoPtr->dwStyle & UDS_ALIGNLEFT) width += DEFAULT_BUDDYBORDER; else x -= DEFAULT_BUDDYBORDER; @@ -563,7 +562,6 @@ */ static void UPDOWN_DoAction (UPDOWN_INFO *infoPtr, int delta, int action) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); NM_UPDOWN ni; TRACE("%d by %d\n", action, delta); @@ -588,12 +586,12 @@ TRACE("new %d, delta: %d\n", infoPtr->CurVal, ni.iDelta); /* Now take care about our buddy */ - if (dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); + UPDOWN_SetBuddyInt (infoPtr); } } /* Also, notify it. This message is sent in any case. */ - SendMessageW( infoPtr->Notify, dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, + SendMessageW( infoPtr->Notify, (infoPtr->dwStyle & UDS_HORZ) ? WM_HSCROLL : WM_VSCROLL, MAKELONG(SB_THUMBPOSITION, infoPtr->CurVal), (LPARAM)infoPtr->Self); } @@ -652,7 +650,6 @@ */ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT y) { - DWORD dwStyle = GetWindowLongW (infoPtr->Self, GWL_STYLE); POINT pt = { x, y }; RECT rect; int temp, arrow; @@ -679,7 +676,7 @@ if (infoPtr->Flags & FLAG_ARROW) { /* Update the CurVal if necessary */ - if (dwStyle & UDS_SETBUDDYINT) UPDOWN_GetBuddyInt (infoPtr); + UPDOWN_GetBuddyInt (infoPtr); /* Set up the correct flags */ infoPtr->Flags |= FLAG_PRESSED; @@ -731,7 +728,6 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); - DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE); int temp; TRACE("hwnd=%p msg=%04x wparam=%08x lparam=%08lx\n", hwnd, message, wParam, lParam); @@ -742,13 +738,13 @@ switch(message) { case WM_CREATE: - SetWindowLongW (hwnd, GWL_STYLE, dwStyle & ~WS_BORDER); infoPtr = (UPDOWN_INFO*)Alloc (sizeof(UPDOWN_INFO)); SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr); /* initialize the info struct */ infoPtr->Self = hwnd; - infoPtr->Notify = ((LPCREATESTRUCTA)lParam)->hwndParent; + infoPtr->Notify = ((LPCREATESTRUCTW)lParam)->hwndParent; + infoPtr->dwStyle = ((LPCREATESTRUCTW)lParam)->style; infoPtr->AccelCount = 0; infoPtr->AccelVect = 0; infoPtr->AccelIndex = -1; @@ -759,8 +755,10 @@ infoPtr->Buddy = 0; /* No buddy window yet */ infoPtr->Flags = 0; /* And no flags */ + SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle & ~WS_BORDER); + /* Do we pick the buddy win ourselves? */ - if (dwStyle & UDS_AUTOBUDDY) + if (infoPtr->dwStyle & UDS_AUTOBUDDY) UPDOWN_SetBuddy (infoPtr, GetWindow (hwnd, GW_HWNDPREV)); TRACE("UpDown Ctrl creation, hwnd=%p\n", hwnd); @@ -777,10 +775,19 @@ break; case WM_ENABLE: - if (dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr); + infoPtr->dwStyle &= ~WS_DISABLED; + infoPtr->dwStyle |= (wParam ? 0 : WS_DISABLED); + if (infoPtr->dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr); InvalidateRect (infoPtr->Self, NULL, FALSE); break; + case WM_STYLECHANGED: + if (wParam == GWL_STYLE) { + infoPtr->dwStyle = ((LPSTYLESTRUCT)lParam)->styleNew; + InvalidateRect (infoPtr->Self, NULL, FALSE); + } + break; + case WM_TIMER: /* is this the auto-press timer? */ if(wParam == TIMER_AUTOPRESS) { @@ -828,7 +835,7 @@ (infoPtr->Flags & FLAG_ARROW) ) { SendMessageW( infoPtr->Notify, - dwStyle & UDS_HORZ ? WM_HSCROLL : WM_VSCROLL, + (infoPtr->dwStyle & UDS_HORZ) ? WM_HSCROLL : WM_VSCROLL, MAKELONG(SB_ENDSCROLL, infoPtr->CurVal), (LPARAM)hwnd); if (UPDOWN_IsBuddyEdit(infoPtr)) @@ -844,7 +851,7 @@ break; case WM_KEYDOWN: - if((dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) + if((infoPtr->dwStyle & UDS_ARROWKEYS) && UPDOWN_IsEnabled(infoPtr)) return UPDOWN_KeyPressed(infoPtr, (int)wParam); break; @@ -910,7 +917,7 @@ } wParam = infoPtr->CurVal; infoPtr->CurVal = temp; - if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); + UPDOWN_SetBuddyInt (infoPtr); return wParam; /* return prev value */ case UDM_GETRANGE: @@ -950,7 +957,7 @@ } temp = infoPtr->CurVal; /* save prev value */ infoPtr->CurVal = (int)lParam; /* set the new value */ - if(dwStyle & UDS_SETBUDDYINT) UPDOWN_SetBuddyInt (infoPtr); + UPDOWN_SetBuddyInt (infoPtr); return temp; /* return prev value */ case UDM_GETUNICODEFORMAT: diff -urN wine-20050310/dlls/commdlg/colordlg.c wine-20050419/dlls/commdlg/colordlg.c --- wine-20050310/dlls/commdlg/colordlg.c 2005-02-15 22:51:07.000000000 +0100 +++ wine-20050419/dlls/commdlg/colordlg.c 2005-03-23 14:15:20.000000000 +0100 @@ -65,7 +65,7 @@ /* Chose Color PRIVATE Structure: * * This structure is duplicated in the 16 bit code with - * a extra member + * an extra member */ typedef struct CCPRIVATE diff -urN wine-20050310/dlls/commdlg/colordlg16.c wine-20050419/dlls/commdlg/colordlg16.c --- wine-20050310/dlls/commdlg/colordlg16.c 2005-02-15 22:51:07.000000000 +0100 +++ wine-20050419/dlls/commdlg/colordlg16.c 2005-03-23 14:15:20.000000000 +0100 @@ -46,7 +46,7 @@ /* Chose Color PRIVATE Structure: * * This is a duplicate of the 32bit code with - * a extra member + * an extra member */ typedef struct CCPRIVATE { diff -urN wine-20050310/dlls/commdlg/filedlg.c wine-20050419/dlls/commdlg/filedlg.c --- wine-20050310/dlls/commdlg/filedlg.c 2005-02-15 22:51:07.000000000 +0100 +++ wine-20050419/dlls/commdlg/filedlg.c 2005-04-18 12:30:56.000000000 +0200 @@ -462,16 +462,17 @@ if(ofn->lpstrFile) { fodInfos.filename = MemAlloc(ofn->nMaxFile*sizeof(WCHAR)); - strncpyW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); + lstrcpynW(fodInfos.filename,ofn->lpstrFile,ofn->nMaxFile); } else fodInfos.filename = NULL; if(ofn->lpstrInitialDir) { - DWORD len = strlenW(ofn->lpstrInitialDir); - fodInfos.initdir = MemAlloc((len+1)*sizeof(WCHAR)); - strcpyW(fodInfos.initdir,ofn->lpstrInitialDir); + /* fodInfos.initdir = strdupW(ofn->lpstrInitialDir); */ + DWORD len = strlenW(ofn->lpstrInitialDir)+1; + fodInfos.initdir = MemAlloc(len*sizeof(WCHAR)); + memcpy(fodInfos.initdir,ofn->lpstrInitialDir,len*sizeof(WCHAR)); } else fodInfos.initdir = NULL; @@ -853,7 +854,7 @@ /* Prepend the current path */ n = strlenW(lpstrCurrentDir) + 1; - strncpyW( bufW, lpstrCurrentDir, size ); + memcpy( bufW, lpstrCurrentDir, min(n,size) * sizeof(WCHAR)); if(nofnInfos; - strncpyW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); + lstrcpynW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); if (ofn->Flags & OFN_ALLOWMULTISELECT) ofn->lpstrFile[lstrlenW(ofn->lpstrFile) + 1] = '\0'; } @@ -2064,7 +2065,7 @@ if(fodInfos->unicode) { LPOPENFILENAMEW ofn = fodInfos->ofnInfos; - strncpyW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); + lstrcpynW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); } else { @@ -2406,7 +2407,7 @@ /*********************************************************************** * FILEDLG95_FILETYPE_SearchExt * - * searches for a extension in the filetype box + * searches for an extension in the filetype box */ static int FILEDLG95_FILETYPE_SearchExt(HWND hwnd,LPCWSTR lpstrExt) { @@ -2958,7 +2959,7 @@ /* allocate the buffer */ if (nFiles <= 1) nLength = MAX_PATH; - lpstrAllFile = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength); + lpstrAllFile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nLength); lpstrAllFile[0] = '\0'; /* Generate the string for the edit control */ diff -urN wine-20050310/dlls/commdlg/filedlgbrowser.c wine-20050419/dlls/commdlg/filedlgbrowser.c --- wine-20050310/dlls/commdlg/filedlgbrowser.c 2005-01-10 13:25:29.000000000 +0100 +++ wine-20050419/dlls/commdlg/filedlgbrowser.c 2005-04-19 11:47:42.000000000 +0200 @@ -95,6 +95,49 @@ * Helper functions */ +#define add_flag(a) if (flags & a) {strcat(str, #a );strcat(str," ");} +static void COMDLG32_DumpSBSPFlags(UINT uflags) +{ + if (TRACE_ON(commdlg)) + { + unsigned int i; + static const struct { + DWORD mask; + const char *name; + } flags[] = { +#define FE(x) { x, #x} + /* SBSP_DEFBROWSER == 0 */ + FE(SBSP_SAMEBROWSER), + FE(SBSP_NEWBROWSER), + + /* SBSP_DEFMODE == 0 */ + FE(SBSP_OPENMODE), + FE(SBSP_EXPLOREMODE), + FE(SBSP_HELPMODE), + FE(SBSP_NOTRANSFERHIST), + + /* SBSP_ABSOLUTE == 0 */ + FE(SBSP_RELATIVE), + FE(SBSP_PARENT), + FE(SBSP_NAVIGATEBACK), + FE(SBSP_NAVIGATEFORWARD), + FE(SBSP_ALLOW_AUTONAVIGATE), + + FE(SBSP_NOAUTOSELECT), + FE(SBSP_WRITENOHISTORY), + + FE(SBSP_REDIRECT), + FE(SBSP_INITIATEDBYHLINKFRAME), + }; +#undef FE + DPRINTF("SBSP Flags: %08x =", uflags); + for (i = 0; i < (sizeof(flags) / sizeof(flags[0])); i++) + if (flags[i].mask & uflags) + DPRINTF("%s ", flags[i].name); + DPRINTF("\n"); + } +} + static void COMDLG32_UpdateCurrentDir(FileOpenDlgInfos *fodInfos) { char lpstrPath[MAX_PATH]; @@ -314,10 +357,8 @@ IShellBrowserImpl *This = (IShellBrowserImpl *)iface; - TRACE("(%p)(pidl=%p,flags=0x%08x(%s))\n", This, pidl, wFlags, - (wFlags & SBSP_RELATIVE) ? "SBSP_RELATIVE" : - (wFlags & SBSP_PARENT) ? "SBSP_PARENT" : - (wFlags & SBSP_ABSOLUTE) ? "SBSP_ABSOLUTE" : "SBPS_????"); + TRACE("(%p)(pidl=%p,flags=0x%08x)\n", This, pidl, wFlags); + COMDLG32_DumpSBSPFlags(wFlags); fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); @@ -720,7 +761,7 @@ fodInfos = (FileOpenDlgInfos *) GetPropA(This->hwndOwner,FileOpenDlgInfosStr); - /* If the selected object is not a folder, send a IDOK command to parent window */ + /* If the selected object is not a folder, send an IDOK command to parent window */ if((pidl = GetPidlFromDataObject(fodInfos->Shell.FOIDataObject, 1))) { HRESULT hRes; diff -urN wine-20050310/dlls/commdlg/printdlg.c wine-20050419/dlls/commdlg/printdlg.c --- wine-20050310/dlls/commdlg/printdlg.c 2005-01-24 12:26:23.000000000 +0100 +++ wine-20050419/dlls/commdlg/printdlg.c 2005-04-18 12:01:07.000000000 +0200 @@ -86,14 +86,14 @@ */ BOOL PRINTDLG_OpenDefaultPrinter(HANDLE *hprn) { - char buf[260]; - DWORD dwBufLen = sizeof(buf); + WCHAR buf[260]; + DWORD dwBufLen = sizeof(buf) / sizeof(buf[0]); BOOL res; - if(!GetDefaultPrinterA(buf, &dwBufLen)) + if(!GetDefaultPrinterW(buf, &dwBufLen)) return FALSE; - res = OpenPrinterA(buf, hprn, NULL); + res = OpenPrinterW(buf, hprn, NULL); if (!res) - FIXME("Could not open printer %s?!\n",buf); + WARN("Could not open printer %s\n", debugstr_w(buf)); return res; } @@ -459,7 +459,7 @@ goto out; } - Names = (char*)HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); + Names = HeapAlloc(GetProcessHeap(),0,NrOfEntries*64); if (NrOfEntries != (ret=DeviceCapabilitiesA(devname,portname,DC_PAPERNAMES,Names,dm))) { FIXME("Number of returned vals %d is not %d\n",NrOfEntries,ret); goto out; @@ -517,7 +517,7 @@ goto out; } - Names = (WCHAR*)HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*NrOfEntries*64); + Names = HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*NrOfEntries*64); if (NrOfEntries != (ret=DeviceCapabilitiesW(devname,portname,DC_PAPERNAMES,Names,dm))) { FIXME("Number of returned vals %d is not %d\n",NrOfEntries,ret); goto out; @@ -3021,15 +3021,16 @@ /*********************************************************************** * PrintDlgExA (COMDLG32.@) */ -HRESULT WINAPI PrintDlgExA(LPVOID lpPrintDlgExA) /* [???] FIXME: LPPRINTDLGEXA */ +HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA lpPrintDlgExA) { FIXME("stub\n"); return E_NOTIMPL; } + /*********************************************************************** * PrintDlgExW (COMDLG32.@) */ -HRESULT WINAPI PrintDlgExW(LPVOID lpPrintDlgExW) /* [???] FIXME: LPPRINTDLGEXW */ +HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW lpPrintDlgExW) { FIXME("stub\n"); return E_NOTIMPL; diff -urN wine-20050310/dlls/commdlg/printdlg16.c wine-20050419/dlls/commdlg/printdlg16.c --- wine-20050310/dlls/commdlg/printdlg16.c 2004-09-22 21:36:47.000000000 +0200 +++ wine-20050419/dlls/commdlg/printdlg16.c 2005-03-24 22:01:39.000000000 +0100 @@ -427,7 +427,7 @@ ptr16 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PRINT_PTRA16)); ptr16->lpPrintDlg16 = lppd; PrintStructures = &ptr16->print32; - PrintStructures->lpPrintDlg = (LPPRINTDLGA)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); + PrintStructures->lpPrintDlg = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(PRINTDLGA)); #define CVAL(x) PrintStructures->lpPrintDlg->x = lppd->x; #define MVAL(x) PrintStructures->lpPrintDlg->x = MapSL(lppd->x); CVAL(Flags); diff -urN wine-20050310/dlls/d3d8/d3d8_private.h wine-20050419/dlls/d3d8/d3d8_private.h --- wine-20050310/dlls/d3d8/d3d8_private.h 2005-03-02 13:23:22.000000000 +0100 +++ wine-20050419/dlls/d3d8/d3d8_private.h 2005-03-23 14:15:20.000000000 +0100 @@ -1094,7 +1094,7 @@ /*IDirect3DStateBlock9Vtbl *lpVtbl;*/ DWORD ref; - /* The device, to be replaced by a IDirect3DDeviceImpl */ + /* The device, to be replaced by an IDirect3DDeviceImpl */ IDirect3DDevice8Impl* device; D3DSTATEBLOCKTYPE blockType; @@ -1183,7 +1183,7 @@ /*IDirect3DVertexShaderDeclaration9Vtbl *lpVtbl;*/ DWORD ref; - /* The device, to be replaced by a IDirect3DDeviceImpl */ + /* The device, to be replaced by an IDirect3DDeviceImpl */ IDirect3DDevice8Impl* device; /** precomputed fvf if simple declaration */ @@ -1219,7 +1219,7 @@ /*IDirect3DVertexShader9Vtbl *lpVtbl;*/ DWORD ref; - /* The device, to be replaced by a IDirect3DDeviceImpl */ + /* The device, to be replaced by an IDirect3DDeviceImpl */ IDirect3DDevice8Impl* device; DWORD* function; @@ -1268,7 +1268,7 @@ /*IDirect3DPixelShader9Vtbl *lpVtbl;*/ DWORD ref; - /* The device, to be replaced by a IDirect3DDeviceImpl */ + /* The device, to be replaced by an IDirect3DDeviceImpl */ IDirect3DDevice8Impl* device; DWORD* function; diff -urN wine-20050310/dlls/d3d8/device.c wine-20050419/dlls/d3d8/device.c --- wine-20050310/dlls/d3d8/device.c 2005-02-08 13:10:57.000000000 +0100 +++ wine-20050419/dlls/d3d8/device.c 2005-03-23 14:15:20.000000000 +0100 @@ -396,11 +396,11 @@ TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot); if (D3DFMT_A8R8G8B8 != pSur->myDesc.Format) { - ERR("(%p) : surface(%p) have a invalid format\n", This, pCursorBitmap); + ERR("(%p) : surface(%p) has an invalid format\n", This, pCursorBitmap); return D3DERR_INVALIDCALL; } if (32 != pSur->myDesc.Height || 32 != pSur->myDesc.Width) { - ERR("(%p) : surface(%p) have a invalid size\n", This, pCursorBitmap); + ERR("(%p) : surface(%p) has an invalid size\n", This, pCursorBitmap); return D3DERR_INVALIDCALL; } @@ -1182,7 +1182,7 @@ FIXME("(%p) : Should return whole screen, only returns GL context window in top left corner\n", This); if (D3DFMT_A8R8G8B8 != ((IDirect3DSurface8Impl*) pDestSurface)->myDesc.Format) { - ERR("(%p) : surface(%p) have a invalid format\n", This, pDestSurface); + ERR("(%p) : surface(%p) has an invalid format\n", This, pDestSurface); return D3DERR_INVALIDCALL; } diff -urN wine-20050310/dlls/d3d8/directx.c wine-20050419/dlls/d3d8/directx.c --- wine-20050310/dlls/d3d8/directx.c 2005-02-24 11:05:06.000000000 +0100 +++ wine-20050419/dlls/d3d8/directx.c 2005-03-29 21:01:00.000000000 +0200 @@ -547,7 +547,7 @@ /* Internal function called back during the CreateDevice to create a render target */ HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height, - D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + WINED3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { HRESULT res = D3D_OK; @@ -555,7 +555,7 @@ /* Note - Throw away MultisampleQuality and SharedHandle - only relevant for d3d9 */ res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height, - Format, MultiSample, Lockable, + (D3DFORMAT)Format, MultiSample, Lockable, (IDirect3DSurface8 **)&d3dSurface); if (res == D3D_OK) { *ppSurface = d3dSurface->wineD3DSurface; diff -urN wine-20050310/dlls/d3d8/surface.c wine-20050419/dlls/d3d8/surface.c --- wine-20050310/dlls/d3d8/surface.c 2005-01-24 13:43:25.000000000 +0100 +++ wine-20050419/dlls/d3d8/surface.c 2005-03-24 22:01:39.000000000 +0100 @@ -522,8 +522,8 @@ */ UINT i; PALETTEENTRY* pal = This->Device->palettes[This->Device->currentPalette]; - VOID* surface = (VOID*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->myDesc.Width * This->myDesc.Height * sizeof(DWORD)); - BYTE* dst = (BYTE*) surface; + VOID* surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->myDesc.Width * This->myDesc.Height * sizeof(DWORD)); + BYTE* dst = surface; BYTE* src = (BYTE*) This->allocatedMemory; for (i = 0; i < This->myDesc.Width * This->myDesc.Height; i++) { diff -urN wine-20050310/dlls/d3d9/basetexture.c wine-20050419/dlls/d3d9/basetexture.c --- wine-20050310/dlls/d3d9/basetexture.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/basetexture.c 2005-03-11 11:25:30.000000000 +0100 @@ -22,16 +22,16 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DBaseTexture9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DBaseTexture9Impl_QueryInterface(LPDIRECT3DBASETEXTURE9 iface, REFIID riid, LPVOID* ppobj) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - + TRACE("(%p) Relay\n" , This); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)) { - IDirect3DBaseTexture9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -65,73 +65,87 @@ /* IDirect3DBaseTexture9 IDirect3DResource9 Interface follow: */ HRESULT WINAPI IDirect3DBaseTexture9Impl_GetDevice(LPDIRECT3DBASETEXTURE9 iface, IDirect3DDevice9** ppDevice) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice); } HRESULT WINAPI IDirect3DBaseTexture9Impl_SetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_SetPrivateData(This->wineD3DBaseTexture, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DBaseTexture9Impl_GetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetPrivateData(This->wineD3DBaseTexture, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DBaseTexture9Impl_FreePrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_FreePrivateData(This->wineD3DBaseTexture, refguid); } DWORD WINAPI IDirect3DBaseTexture9Impl_SetPriority(LPDIRECT3DBASETEXTURE9 iface, DWORD PriorityNew) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_SetPriority(This->wineD3DBaseTexture, PriorityNew); } DWORD WINAPI IDirect3DBaseTexture9Impl_GetPriority(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetPriority(This->wineD3DBaseTexture); } void WINAPI IDirect3DBaseTexture9Impl_PreLoad(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); IWineD3DBaseTexture_PreLoad(This->wineD3DBaseTexture); return ; } D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture); } /* IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DBaseTexture9Impl_SetLOD(LPDIRECT3DBASETEXTURE9 iface, DWORD LODNew) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_SetLOD(This->wineD3DBaseTexture, LODNew); } DWORD WINAPI IDirect3DBaseTexture9Impl_GetLOD(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetLOD(This->wineD3DBaseTexture); } DWORD WINAPI IDirect3DBaseTexture9Impl_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetLevelCount(This->wineD3DBaseTexture); } HRESULT WINAPI IDirect3DBaseTexture9Impl_SetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_SetAutoGenFilterType(This->wineD3DBaseTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DBaseTexture9Impl_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GetAutoGenFilterType(This->wineD3DBaseTexture); } void WINAPI IDirect3DBaseTexture9Impl_GenerateMipSubLevels(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IWineD3DBaseTexture_GenerateMipSubLevels(This->wineD3DBaseTexture); } diff -urN wine-20050310/dlls/d3d9/cubetexture.c wine-20050419/dlls/d3d9/cubetexture.c --- wine-20050310/dlls/d3d9/cubetexture.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/cubetexture.c 2005-03-29 21:01:00.000000000 +0200 @@ -2,7 +2,8 @@ * IDirect3DCubeTexture9 implementation * * Copyright 2002-2005 Jason Edmeades - * Raphael Junqueira + * Copyright 2002-2005 Raphael Junqueira + * Copyright 2005 Oliver Stieber * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,17 +23,17 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); + /* IDirect3DCubeTexture9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(LPDIRECT3DCUBETEXTURE9 iface, REFIID riid, LPVOID* ppobj) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9) || IsEqualGUID(riid, &IID_IDirect3DCubeTexture9)) { - IDirect3DCubeTexture9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -57,6 +58,7 @@ TRACE("(%p) : ReleaseRef to %ld\n", This, ref); if (ref == 0) { + TRACE("Releasing child %p\n", This->wineD3DCubeTexture); IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); HeapFree(GetProcessHeap(), 0, This); } @@ -66,82 +68,97 @@ /* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */ HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(LPDIRECT3DCUBETEXTURE9 iface, IDirect3DDevice9** ppDevice) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n" , This); return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice); } HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); } HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); } HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); } DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); } DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); } void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture); } D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); } /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); } DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This); } DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); } HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture); } void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture); } /* IDirect3DCubeTexture9 Interface follow: */ HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - WINED3DSURFACE_DESC wined3ddesc; UINT tmpInt = -1; + TRACE("(%p) Relay\n", This); + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ wined3ddesc.Format = &pDesc->Format; wined3ddesc.Type = &pDesc->Type; @@ -159,8 +176,10 @@ HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; HRESULT hrc = D3D_OK; - IWineD3DSurface *mySurface = NULL; + + TRACE("(%p) Relay\n", This); + hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, FaceType, Level, &mySurface); if (hrc == D3D_OK && NULL != ppCubeMapSurface) { IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); @@ -171,16 +190,19 @@ HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, FaceType, Level, pLockedRect, pRect, Flags); } HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, FaceType, Level); } HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) { IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, FaceType, pDirtyRect); } @@ -212,37 +234,43 @@ }; + + /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */ -HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface, - UINT EdgeLength, UINT Levels, DWORD Usage, - D3DFORMAT Format, D3DPOOL Pool, +HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface, + UINT EdgeLength, UINT Levels, DWORD Usage, + D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) { IDirect3DCubeTexture9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hr = D3D_OK; - + + TRACE("(%p) : ELen(%d) Lvl(%d) Usage(%ld) fmt(%u), Pool(%d) Shared(%p)" , This, EdgeLength, Levels, Usage, Format, Pool, pSharedHandle); + /* Allocate the storage for the device */ - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DCubeTexture9Impl)); + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (NULL == object) { FIXME("(%p) allocation of CubeTexture failed\n", This); *ppCubeTexture = NULL; return D3DERR_OUTOFVIDEOMEMORY; - } - + } object->lpVtbl = &Direct3DCubeTexture9_Vtbl; object->ref = 1; - hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage, - Format, Pool, &(object->wineD3DCubeTexture), pSharedHandle, (IUnknown *)object, + hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage, + (WINED3DFORMAT)Format, Pool, &object->wineD3DCubeTexture, pSharedHandle, (IUnknown*)object, D3D9CB_CreateSurface); - if (hr != D3D_OK) { - /* free up object */ + if (hr != D3D_OK){ + /* free up object */ FIXME("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This); HeapFree(GetProcessHeap(), 0, object); *ppCubeTexture = NULL; } else { *ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object; } + + TRACE("(%p) returning %p\n",This, *ppCubeTexture); return hr; } diff -urN wine-20050310/dlls/d3d9/d3d9_private.h wine-20050419/dlls/d3d9/d3d9_private.h --- wine-20050310/dlls/d3d9/d3d9_private.h 2005-03-03 14:57:15.000000000 +0100 +++ wine-20050419/dlls/d3d9/d3d9_private.h 2005-03-29 21:01:00.000000000 +0200 @@ -1120,11 +1120,11 @@ /* Callbacks */ extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, UINT Width, UINT Height, - D3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level, + WINED3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle); extern HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, UINT Depth, - D3DFORMAT Format, D3DPOOL Pool, DWORD Usage, + WINED3DFORMAT Format, D3DPOOL Pool, DWORD Usage, IWineD3DVolume **ppVolume, HANDLE * pSharedHandle); diff -urN wine-20050310/dlls/d3d9/device.c wine-20050419/dlls/d3d9/device.c --- wine-20050310/dlls/d3d9/device.c 2005-03-02 13:16:11.000000000 +0100 +++ wine-20050419/dlls/d3d9/device.c 2005-03-29 21:01:00.000000000 +0200 @@ -901,7 +901,7 @@ /* Internal function called back during the CreateDevice to create a render target */ HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, UINT Width, UINT Height, - D3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level, + WINED3DFORMAT Format, DWORD Usage, D3DPOOL Pool, UINT Level, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { HRESULT res = D3D_OK; @@ -912,7 +912,7 @@ Lockable = FALSE; TRACE("relay\n"); - res = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9 *)device, Width, Height, Format, Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface9 **)&d3dSurface, D3DRTYPE_SURFACE, Usage, Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, pSharedHandle); + res = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9 *)device, Width, Height, (D3DFORMAT)Format, Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface9 **)&d3dSurface, D3DRTYPE_SURFACE, Usage, Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, pSharedHandle); if (res == D3D_OK) { *ppSurface = d3dSurface->wineD3DSurface; diff -urN wine-20050310/dlls/d3d9/directx.c wine-20050419/dlls/d3d9/directx.c --- wine-20050310/dlls/d3d9/directx.c 2005-01-28 15:03:32.000000000 +0100 +++ wine-20050419/dlls/d3d9/directx.c 2005-03-29 21:01:00.000000000 +0200 @@ -159,7 +159,7 @@ /* Internal function called back during the CreateDevice to create a render target */ HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height, - D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + WINED3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { HRESULT res = D3D_OK; @@ -167,7 +167,7 @@ IDirect3DDevice9Impl* pDeviceImpl = (IDirect3DDevice9Impl*) device; res = IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9 *)device, Width, Height, - Format, MultiSample, MultisampleQuality, Lockable, + (D3DFORMAT) Format, MultiSample, MultisampleQuality, Lockable, (IDirect3DSurface9 **)&d3dSurface, pSharedHandle); if (SUCCEEDED(res)) { diff -urN wine-20050310/dlls/d3d9/indexbuffer.c wine-20050419/dlls/d3d9/indexbuffer.c --- wine-20050310/dlls/d3d9/indexbuffer.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/indexbuffer.c 2005-03-11 11:25:30.000000000 +0100 @@ -22,7 +22,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DIndexBuffer9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DIndexBuffer9Impl_QueryInterface(LPDIRECT3DINDEXBUFFER9 iface, REFIID riid, LPVOID* ppobj) { @@ -31,7 +31,7 @@ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DIndexBuffer9)) { - IDirect3DIndexBuffer9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -65,58 +65,68 @@ /* IDirect3DIndexBuffer9 IDirect3DResource9 Interface follow: */ HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDevice(LPDIRECT3DINDEXBUFFER9 iface, IDirect3DDevice9** ppDevice) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice); } HRESULT WINAPI IDirect3DIndexBuffer9Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DIndexBuffer9Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER9 iface, REFGUID refguid) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid); } DWORD WINAPI IDirect3DIndexBuffer9Impl_SetPriority(LPDIRECT3DINDEXBUFFER9 iface, DWORD PriorityNew) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew); } DWORD WINAPI IDirect3DIndexBuffer9Impl_GetPriority(LPDIRECT3DINDEXBUFFER9 iface) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer); } void WINAPI IDirect3DIndexBuffer9Impl_PreLoad(LPDIRECT3DINDEXBUFFER9 iface) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; - IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer); - return ; + TRACE("(%p) Relay\n", This); + return IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer); } D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer9Impl_GetType(LPDIRECT3DINDEXBUFFER9 iface) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer); } /* IDirect3DIndexBuffer9 Interface follow: */ HRESULT WINAPI IDirect3DIndexBuffer9Impl_Lock(LPDIRECT3DINDEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags); } HRESULT WINAPI IDirect3DIndexBuffer9Impl_Unlock(LPDIRECT3DINDEXBUFFER9 iface) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer); } HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDesc(LPDIRECT3DINDEXBUFFER9 iface, D3DINDEXBUFFER_DESC *pDesc) { IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, pDesc); } @@ -142,15 +152,16 @@ /* IDirect3DDevice9 IDirect3DIndexBuffer9 Methods follow: */ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface, - UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, - IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { + UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, + IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) { IDirect3DIndexBuffer9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK; + TRACE("(%p) Relay\n", This); /* Allocate the storage for the device */ - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DIndexBuffer9Impl)); + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (NULL == object) { FIXME("Allocation of memory failed\n"); *ppIndexBuffer = NULL; @@ -159,7 +170,8 @@ object->lpVtbl = &Direct3DIndexBuffer9_Vtbl; object->ref = 1; - hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, Pool, &(object->wineD3DIndexBuffer), pSharedHandle, (IUnknown *)object); + TRACE("Calling wined3d create index buffer\n"); + hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage, Format, Pool, &object->wineD3DIndexBuffer, pSharedHandle, (IUnknown *)object); if (hrc != D3D_OK) { /* free up object */ FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This); diff -urN wine-20050310/dlls/d3d9/resource.c wine-20050419/dlls/d3d9/resource.c --- wine-20050310/dlls/d3d9/resource.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/resource.c 2005-03-11 11:25:30.000000000 +0100 @@ -22,7 +22,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DResource9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DResource9Impl_QueryInterface(LPDIRECT3DRESOURCE9 iface, REFIID riid, LPVOID* ppobj) { @@ -65,6 +65,9 @@ HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; IWineD3DDevice *myDevice = NULL; + + TRACE("(%p) Relay\n", This); + IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice); IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); IWineD3DDevice_Release(myDevice); @@ -73,37 +76,44 @@ HRESULT WINAPI IDirect3DResource9Impl_SetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DResource9Impl_GetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DResource9Impl_FreePrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid); } DWORD WINAPI IDirect3DResource9Impl_SetPriority(LPDIRECT3DRESOURCE9 iface, DWORD PriorityNew) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew); } DWORD WINAPI IDirect3DResource9Impl_GetPriority(LPDIRECT3DRESOURCE9 iface) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DResource_GetPriority(This->wineD3DResource); } void WINAPI IDirect3DResource9Impl_PreLoad(LPDIRECT3DRESOURCE9 iface) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); IWineD3DResource_PreLoad(This->wineD3DResource); return; } D3DRESOURCETYPE WINAPI IDirect3DResource9Impl_GetType(LPDIRECT3DRESOURCE9 iface) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DResource_GetType(This->wineD3DResource); } diff -urN wine-20050310/dlls/d3d9/surface.c wine-20050419/dlls/d3d9/surface.c --- wine-20050310/dlls/d3d9/surface.c 2005-03-02 14:44:59.000000000 +0100 +++ wine-20050419/dlls/d3d9/surface.c 2005-03-23 14:15:20.000000000 +0100 @@ -22,7 +22,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DSurface9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DSurface9Impl_QueryInterface(LPDIRECT3DSURFACE9 iface, REFIID riid, LPVOID* ppobj) { @@ -31,7 +31,7 @@ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DSurface9)) { - IDirect3DSurface9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -70,37 +70,44 @@ HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); } DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_SetPriority(This->wineD3DSurface, PriorityNew); } DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_GetPriority(This->wineD3DSurface); } void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); IWineD3DSurface_PreLoad(This->wineD3DSurface); return ; } D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_GetType(This->wineD3DSurface); } @@ -108,13 +115,12 @@ HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 iface, REFIID riid, void** ppContainer) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; HRESULT res; - - /* The container returned from IWineD3DSurface_GetContainer is either a IWineD3DDevice, - one of the subclasses of IWineD3DBaseTexture or a IWineD3DSwapChain */ IUnknown *IWineContainer = NULL; TRACE("(%p) Relay\n", This); + /* The container returned from IWineD3DSurface_GetContainer is either an IWineD3DDevice, + one of the subclasses of IWineD3DBaseTexture or an IWineD3DSwapChain */ /* Get the IUnknown container. */ res = IWineD3DSurface_GetContainer(This->wineD3DSurface, &IID_IUnknown, (void **)&IWineContainer); if (res == D3D_OK && IWineContainer != NULL) { @@ -156,6 +162,7 @@ IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; WINED3DSURFACE_DESC wined3ddesc; UINT tmpInt = -1; + TRACE("(%p) Relay\n", This); /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ wined3ddesc.Format = &pDesc->Format; @@ -173,21 +180,26 @@ HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); + TRACE("(%p) calling IWineD3DSurface_LockRect %p %p %p %ld\n", This, This->wineD3DSurface, pLockedRect, pRect, Flags); return IWineD3DSurface_LockRect(This->wineD3DSurface, pLockedRect, pRect, Flags); } HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_UnlockRect(This->wineD3DSurface); } HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* phdc) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_GetDC(This->wineD3DSurface, phdc); } HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, HDC hdc) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc); } diff -urN wine-20050310/dlls/d3d9/texture.c wine-20050419/dlls/d3d9/texture.c --- wine-20050310/dlls/d3d9/texture.c 2005-01-28 15:03:32.000000000 +0100 +++ wine-20050419/dlls/d3d9/texture.c 2005-03-29 21:01:00.000000000 +0200 @@ -2,7 +2,8 @@ * IDirect3DTexture9 implementation * * Copyright 2002-2005 Jason Edmeades - * Raphael Junqueira + * Copyright 2002-2005 Raphael Junqueira + * Copyright 2005 Oliver Stieber * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,7 +23,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DTexture9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DTexture9Impl_QueryInterface(LPDIRECT3DTEXTURE9 iface, REFIID riid, LPVOID* ppobj) { @@ -32,7 +33,7 @@ || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9) || IsEqualGUID(riid, &IID_IDirect3DTexture9)) { - IDirect3DTexture9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -71,17 +72,17 @@ HRESULT WINAPI IDirect3DTexture9Impl_SetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IWineD3DTexture_SetPrivateData(This->wineD3DTexture,refguid,pData,SizeOfData,Flags); + return IWineD3DTexture_SetPrivateData(This->wineD3DTexture, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DTexture9Impl_GetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IWineD3DTexture_GetPrivateData(This->wineD3DTexture,refguid,pData,pSizeOfData); + return IWineD3DTexture_GetPrivateData(This->wineD3DTexture, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DTexture9Impl_FreePrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - return IWineD3DTexture_FreePrivateData(This->wineD3DTexture,refguid); + return IWineD3DTexture_FreePrivateData(This->wineD3DTexture, refguid); } DWORD WINAPI IDirect3DTexture9Impl_SetPriority(LPDIRECT3DTEXTURE9 iface, DWORD PriorityNew) { @@ -147,7 +148,7 @@ wined3ddesc.Type = &pDesc->Type; wined3ddesc.Usage = &pDesc->Usage; wined3ddesc.Pool = &pDesc->Pool; - wined3ddesc.Size = &tmpInt; + wined3ddesc.Size = &tmpInt; /* required for d3d8 */ wined3ddesc.MultiSampleType = &pDesc->MultiSampleType; wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality; wined3ddesc.Width = &pDesc->Width; @@ -169,7 +170,7 @@ return hrc; } -HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level,D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { +HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; return IWineD3DTexture_LockRect(This->wineD3DTexture, Level, pLockedRect, pRect, Flags); } @@ -184,7 +185,6 @@ return IWineD3DTexture_AddDirtyRect(This->wineD3DTexture, pDirtyRect); } - IDirect3DTexture9Vtbl Direct3DTexture9_Vtbl = { IDirect3DTexture9Impl_QueryInterface, @@ -198,6 +198,7 @@ IDirect3DTexture9Impl_GetPriority, IDirect3DTexture9Impl_PreLoad, IDirect3DTexture9Impl_GetType, + IDirect3DTexture9Impl_SetLOD, IDirect3DTexture9Impl_GetLOD, IDirect3DTexture9Impl_GetLevelCount, @@ -219,8 +220,11 @@ IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK; + TRACE("(%p) : W(%d) H(%d), Lvl(%d) d(%ld), Fmt(%u), Pool(%d)\n", This, Width, Height, Levels, Usage, Format, Pool); + /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTexture9Impl)); + if (NULL == object) { FIXME("Allocation of memory failed\n"); *ppTexture = NULL; @@ -230,15 +234,17 @@ object->lpVtbl = &Direct3DTexture9_Vtbl; object->ref = 1; hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage, - Format, Pool, &(object->wineD3DTexture), pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface); + (WINED3DFORMAT)Format, Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface); if (FAILED(hrc)) { /* free up object */ FIXME("(%p) call to IWineD3DDevice_CreateTexture failed\n", This); HeapFree(GetProcessHeap(), 0, object); *ppTexture = NULL; - } else { - *ppTexture = (LPDIRECT3DTEXTURE9) object; - } - return hrc; + } else { + *ppTexture= (LPDIRECT3DTEXTURE9) object; + } + + TRACE("(%p) Created Texture %p, %p\n",This,object,object->wineD3DTexture); + return hrc; } diff -urN wine-20050310/dlls/d3d9/vertexbuffer.c wine-20050419/dlls/d3d9/vertexbuffer.c --- wine-20050310/dlls/d3d9/vertexbuffer.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/vertexbuffer.c 2005-03-11 11:25:30.000000000 +0100 @@ -2,7 +2,8 @@ * IDirect3DVertexBuffer9 implementation * * Copyright 2002-2004 Jason Edmeades - * Raphael Junqueira + * Copyright 2002-2004 Raphael Junqueira + * Copyright 2005 Oliver Stieber * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,7 +23,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DVertexBuffer9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DVertexBuffer9Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER9 iface, REFIID riid, LPVOID* ppobj) { @@ -31,7 +32,7 @@ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DVertexBuffer9)) { - IDirect3DVertexBuffer9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -65,58 +66,69 @@ /* IDirect3DVertexBuffer9 IDirect3DResource9 Interface follow: */ HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFER9 iface, IDirect3DDevice9** ppDevice) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice); } HRESULT WINAPI IDirect3DVertexBuffer9Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DVertexBuffer9Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER9 iface, REFGUID refguid) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid); } DWORD WINAPI IDirect3DVertexBuffer9Impl_SetPriority(LPDIRECT3DVERTEXBUFFER9 iface, DWORD PriorityNew) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew); } DWORD WINAPI IDirect3DVertexBuffer9Impl_GetPriority(LPDIRECT3DVERTEXBUFFER9 iface) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer); } void WINAPI IDirect3DVertexBuffer9Impl_PreLoad(LPDIRECT3DVERTEXBUFFER9 iface) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer); return ; } D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer9Impl_GetType(LPDIRECT3DVERTEXBUFFER9 iface) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer); } /* IDirect3DVertexBuffer9 Interface follow: */ HRESULT WINAPI IDirect3DVertexBuffer9Impl_Lock(LPDIRECT3DVERTEXBUFFER9 iface, UINT OffsetToLock, UINT SizeToLock, void** ppbData, DWORD Flags) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags); } HRESULT WINAPI IDirect3DVertexBuffer9Impl_Unlock(LPDIRECT3DVERTEXBUFFER9 iface) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer); } HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9 iface, D3DVERTEXBUFFER_DESC* pDesc) { IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, pDesc); } @@ -141,8 +153,8 @@ /* IDirect3DDevice9 IDirect3DVertexBuffer9 Methods follow: */ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, - UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, - IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { + UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool, + IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) { IDirect3DVertexBuffer9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; diff -urN wine-20050310/dlls/d3d9/volume.c wine-20050419/dlls/d3d9/volume.c --- wine-20050310/dlls/d3d9/volume.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/volume.c 2005-03-29 21:01:00.000000000 +0200 @@ -22,7 +22,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DVolume9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(LPDIRECT3DVOLUME9 iface, REFIID riid, LPVOID* ppobj) { @@ -30,7 +30,7 @@ if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3DVolume9)) { - IDirect3DVolume9Impl_AddRef(iface); + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -74,24 +74,28 @@ HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid); } HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID riid, void** ppContainer) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; HRESULT res; - IUnknown *IWineContainer = NULL; + + TRACE("(%p) Relay\n", This); res = IWineD3DVolume_GetContainer(This->wineD3DVolume, riid, (void **)&IWineContainer); /* If this works, the only valid container is a child of resource (volumetexture) */ @@ -108,6 +112,8 @@ WINED3DVOLUME_DESC wined3ddesc; UINT tmpInt = -1; + TRACE("(%p) Relay\n", This); + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ wined3ddesc.Format = &pDesc->Format; wined3ddesc.Type = &pDesc->Type; @@ -123,11 +129,13 @@ HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; + TRACE("(%p) relay %p %p %p %ld\n", This, This->wineD3DVolume, pLockedVolume, pBox, Flags); return IWineD3DVolume_LockBox(This->wineD3DVolume, pLockedVolume, pBox, Flags); } HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) { IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; + TRACE("(%p) relay %p\n", This, This->wineD3DVolume); return IWineD3DVolume_UnlockBox(This->wineD3DVolume); } @@ -146,9 +154,10 @@ IDirect3DVolume9Impl_UnlockBox }; + /* Internal function called back during the CreateVolumeTexture */ HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, UINT Width, UINT Height, UINT Depth, - D3DFORMAT Format, D3DPOOL Pool, DWORD Usage, + WINED3DFORMAT Format, D3DPOOL Pool, DWORD Usage, IWineD3DVolume **ppVolume, HANDLE * pSharedHandle) { IDirect3DVolume9Impl *object; @@ -166,14 +175,15 @@ object->lpVtbl = &Direct3DVolume9_Vtbl; object->ref = 1; hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format, - Pool, ppVolume, pSharedHandle, (IUnknown *)object); + Pool, &object->wineD3DVolume, pSharedHandle, (IUnknown *)object); if (hrc != D3D_OK) { /* free up object */ FIXME("(%p) call to IWineD3DDevice_CreateVolume failed\n", This); HeapFree(GetProcessHeap(), 0, object); *ppVolume = NULL; } else { - *ppVolume = (IWineD3DVolume *)object; + *ppVolume = (IWineD3DVolume *)object->wineD3DVolume; } + TRACE("(%p) Created volume %p\n", This, *ppVolume); return hrc; } diff -urN wine-20050310/dlls/d3d9/volumetexture.c wine-20050419/dlls/d3d9/volumetexture.c --- wine-20050310/dlls/d3d9/volumetexture.c 2005-01-24 13:44:01.000000000 +0100 +++ wine-20050419/dlls/d3d9/volumetexture.c 2005-03-29 21:01:00.000000000 +0200 @@ -22,17 +22,17 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /* IDirect3DVolumeTexture9 IUnknown parts follow: */ HRESULT WINAPI IDirect3DVolumeTexture9Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE9 iface, REFIID riid, LPVOID* ppobj) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IDirect3DResource9) - || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9) - || IsEqualGUID(riid, &IID_IDirect3DVolumeTexture9)) { - IDirect3DVolumeTexture9Impl_AddRef(iface); + || IsEqualGUID(riid, &IID_IDirect3DResource9) + || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9) + || IsEqualGUID(riid, &IID_IDirect3DVolumeTexture9)) { + IUnknown_AddRef(iface); *ppobj = This; return D3D_OK; } @@ -66,72 +66,86 @@ /* IDirect3DVolumeTexture9 IDirect3DResource9 Interface follow: */ HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE9 iface, IDirect3DDevice9** ppDevice) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture,refguid,pData,SizeOfData,Flags); + TRACE("(%p) Relay\n", This); + return IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture,refguid,pData,pSizeOfData); + TRACE("(%p) Relay\n", This); + return IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - return IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture,refguid); + TRACE("(%p) Relay\n", This); + return IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid); } DWORD WINAPI IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD PriorityNew) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew); } DWORD WINAPI IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture); } void WINAPI IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture); } D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture); } /* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */ DWORD WINAPI IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD LODNew) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew); } DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture); } DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, FilterType); } D3DTEXTUREFILTERTYPE WINAPI IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture); } void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_GenerateMipSubLevels(This->wineD3DVolumeTexture); } @@ -141,6 +155,8 @@ WINED3DVOLUME_DESC wined3ddesc; UINT tmpInt = -1; + TRACE("(%p) Relay\n", This); + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ wined3ddesc.Format = &pDesc->Format; wined3ddesc.Type = &pDesc->Type; @@ -157,8 +173,10 @@ HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; HRESULT hrc = D3D_OK; - IWineD3DVolume *myVolume = NULL; + + TRACE("(%p) Relay\n", This); + hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); if (hrc == D3D_OK && NULL != ppVolumeLevel) { IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); @@ -169,16 +187,19 @@ HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay %p %p %p %ld\n", This, This->wineD3DVolumeTexture, pLockedVolume, pBox,Flags); return IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, pLockedVolume, pBox, Flags); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay %p %d\n", This, This->wineD3DVolumeTexture, Level); return IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level); } HRESULT WINAPI IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface, CONST D3DBOX* pDirtyBox) { IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + TRACE("(%p) Relay\n", This); return IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, pDirtyBox); } @@ -220,6 +241,8 @@ IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; HRESULT hrc = D3D_OK; + TRACE("(%p) Relay\n", This); + /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl)); if (NULL == object) { @@ -231,7 +254,7 @@ object->lpVtbl = &Direct3DVolumeTexture9_Vtbl; object->ref = 1; hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage, - Format, Pool, &(object->wineD3DVolumeTexture), pSharedHandle, + (WINED3DFORMAT)Format, Pool, &object->wineD3DVolumeTexture, pSharedHandle, (IUnknown *)object, D3D9CB_CreateVolume); @@ -243,5 +266,6 @@ } else { *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object; } + TRACE("(%p) returning %p\n", This , *ppVolumeTexture); return hrc; } diff -urN wine-20050310/dlls/d3d9/vshaderdeclaration.c wine-20050419/dlls/d3d9/vshaderdeclaration.c --- wine-20050310/dlls/d3d9/vshaderdeclaration.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050419/dlls/d3d9/vshaderdeclaration.c 2005-03-11 11:25:30.000000000 +0100 @@ -21,7 +21,7 @@ #include "config.h" #include "d3d9_private.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); +WINE_DEFAULT_DEBUG_CHANNEL(d3d9); /** * DirectX9 SDK download diff -urN wine-20050310/dlls/dbghelp/dbghelp.c wine-20050419/dlls/dbghelp/dbghelp.c --- wine-20050310/dlls/dbghelp/dbghelp.c 2005-03-07 13:24:02.000000000 +0100 +++ wine-20050419/dlls/dbghelp/dbghelp.c 2005-03-28 16:17:52.000000000 +0200 @@ -126,8 +126,7 @@ struct process* pcs = process_find_by_handle(hProcess); if (!pcs) return FALSE; - strncpy(szSearchPath, pcs->search_path, SearchPathLength); - szSearchPath[SearchPathLength - 1] = '\0'; + lstrcpynA(szSearchPath, pcs->search_path, SearchPathLength); return TRUE; } diff -urN wine-20050310/dlls/dbghelp/dbghelp_private.h wine-20050419/dlls/dbghelp/dbghelp_private.h --- wine-20050310/dlls/dbghelp/dbghelp_private.h 2005-03-01 11:39:49.000000000 +0100 +++ wine-20050419/dlls/dbghelp/dbghelp_private.h 2005-03-29 15:14:08.000000000 +0200 @@ -249,6 +249,7 @@ DMT_UNKNOWN, /* for lookup, not actually used for a module */ DMT_ELF, /* a real ELF shared module */ DMT_PE, /* a native or builtin PE module */ + DMT_PDB, /* PDB file */ }; struct module @@ -295,6 +296,7 @@ /* elf_module.c */ typedef BOOL (*elf_enum_modules_cb)(const char*, unsigned long addr, void* user); extern BOOL elf_enum_modules(HANDLE hProc, elf_enum_modules_cb, void*); +extern BOOL elf_fetch_file_info(const char* name, DWORD* base, DWORD* size, DWORD* checksum); struct elf_file_map; extern BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap); extern struct module* @@ -324,6 +326,8 @@ extern struct module* module_get_containee(const struct process* pcs, const struct module* inner); +extern enum module_type + module_get_type_by_name(const char* name); extern void module_reset_debug_info(struct module* module); extern BOOL module_remove(struct process* pcs, struct module* module); @@ -334,6 +338,7 @@ const IMAGE_SECTION_HEADER* sectp, DWORD nsect, const IMAGE_DEBUG_DIRECTORY* dbg, int nDbg); /* pe_module.c */ +extern BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth); extern struct module* pe_load_module(struct process* pcs, char* name, HANDLE hFile, DWORD base, DWORD size); diff -urN wine-20050310/dlls/dbghelp/elf_module.c wine-20050419/dlls/dbghelp/elf_module.c --- wine-20050310/dlls/dbghelp/elf_module.c 2005-03-07 12:03:21.000000000 +0100 +++ wine-20050419/dlls/dbghelp/elf_module.c 2005-03-29 15:14:08.000000000 +0200 @@ -81,12 +81,14 @@ #define ELF_INFO_DEBUG_HEADER 0x0001 #define ELF_INFO_MODULE 0x0002 +#define ELF_INFO_NAME 0x0004 struct elf_info { unsigned flags; /* IN one (or several) of the ELF_INFO constants */ unsigned long dbg_hdr_addr; /* OUT address of debug header (if ELF_INFO_DEBUG_HEADER is set) */ struct module* module; /* OUT loaded module (if ELF_INFO_MODULE is set) */ + const char* module_name; /* OUT found module name (if ELF_INFO_NAME is set) */ }; #define NO_MAP ((const void*)0xffffffff) @@ -127,7 +129,7 @@ /****************************************************************** * elf_map_section * - * Maps a single section into memory from a ELF file + * Maps a single section into memory from an ELF file */ static const char* elf_map_section(struct elf_file_map* fmap, int sidx) { @@ -139,7 +141,8 @@ return NO_MAP; /* align required information on page size (we assume pagesize is a power of 2) */ ofst = fmap->sect[sidx].shdr.sh_offset & ~(pgsz - 1); - size = (fmap->sect[sidx].shdr.sh_offset + fmap->sect[sidx].shdr.sh_size + pgsz - 1) & ~(pgsz - 1); + size = (fmap->sect[sidx].shdr.sh_offset + + fmap->sect[sidx].shdr.sh_size + pgsz - 1) & ~(pgsz - 1); fmap->sect[sidx].mapped = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fmap->fd, ofst); if (fmap->sect[sidx].mapped == NO_MAP) return NO_MAP; return fmap->sect[sidx].mapped + (fmap->sect[sidx].shdr.sh_offset & (pgsz - 1)); @@ -162,7 +165,7 @@ /****************************************************************** * elf_map_file * - * Maps a ELF file into memory (and checks it's a real ELF file) + * Maps an ELF file into memory (and checks it's a real ELF file) */ static BOOL elf_map_file(const char* filename, struct elf_file_map* fmap) { @@ -188,7 +191,8 @@ if (memcmp(fmap->elfhdr.e_ident, elf_signature, sizeof(elf_signature))) return FALSE; - fmap->sect = HeapAlloc(GetProcessHeap(), 0, fmap->elfhdr.e_shnum * sizeof(fmap->sect[0])); + fmap->sect = HeapAlloc(GetProcessHeap(), 0, + fmap->elfhdr.e_shnum * sizeof(fmap->sect[0])); if (!fmap->sect) return FALSE; lseek(fmap->fd, fmap->elfhdr.e_shoff, SEEK_SET); @@ -222,7 +226,7 @@ /****************************************************************** * elf_unmap_file * - * Unmaps a ELF file from memory (previously mapped with elf_map_file) + * Unmaps an ELF file from memory (previously mapped with elf_map_file) */ static void elf_unmap_file(struct elf_file_map* fmap) { @@ -800,7 +804,8 @@ shstrtab = elf_map_section(fmap, fmap->elfhdr.e_shstrndx); if (shstrtab == NO_MAP) return FALSE; - symtab_sect = dynsym_sect = stab_sect = stabstr_sect = debug_sect = debuglink_sect = -1; + symtab_sect = dynsym_sect = stab_sect = stabstr_sect = + debug_sect = debuglink_sect = -1; for (i = 0; i < fmap->elfhdr.e_shnum; i++) { @@ -867,7 +872,8 @@ else if (debug_sect != -1) { /* Dwarf 2 debug information */ - FIXME("Unsupported Dwarf2 information for %s\n", module->module.ModuleName); + FIXME("Unsupported Dwarf2 information for %s\n", + module->module.ModuleName); } else if (debuglink_sect != -1) { @@ -876,7 +882,8 @@ dbg_link = elf_map_section(fmap, debuglink_sect); /* The content of a debug link section is: - * 1/ a NULL terminated string, containing the file name for the debug info + * 1/ a NULL terminated string, containing the file name for the + * debug info * 2/ padding on 4 byte boundary * 3/ CRC of the linked ELF file */ @@ -884,11 +891,14 @@ { fmap_link.crc = *(const DWORD*)(dbg_link + ((DWORD_PTR)(strlen(dbg_link) + 4) & ~3)); fmap_link.with_crc = 1; - ret = elf_load_debug_info_from_map(module, &fmap_link, pool, ht_symtab); + ret = elf_load_debug_info_from_map(module, &fmap_link, pool, + ht_symtab); if (!ret) WARN("Couldn't load debug information from %s\n", dbg_link); } - else WARN("Couldn't load linked debug file for %s\n", module->module.ModuleName); + else + WARN("Couldn't load linked debug file for %s\n", + module->module.ModuleName); elf_unmap_file(&fmap_link); } } @@ -940,6 +950,22 @@ return ret; } +/****************************************************************** + * elf_fetch_file_info + * + * Gathers some more information for an ELF module from a given file + */ +BOOL elf_fetch_file_info(const char* name, DWORD* base, + DWORD* size, DWORD* checksum) +{ + struct elf_file_map fmap; + if (!elf_map_file(name, &fmap)) return FALSE; + if (base) *base = fmap.elf_start; + *size = fmap.elf_size; + *checksum = calc_crc32(&fmap); + elf_unmap_file(&fmap); + return TRUE; +} /****************************************************************** * is_dt_flag_valid @@ -1033,7 +1059,7 @@ if (!elf_module_info) goto leave; elf_info->module = module_new(pcs, filename, DMT_ELF, (load_offset) ? load_offset : fmap.elf_start, - fmap.elf_size, 0, 0); + fmap.elf_size, 0, calc_crc32(&fmap)); if (!elf_info->module) { HeapFree(GetProcessHeap(), 0, elf_module_info); @@ -1053,6 +1079,11 @@ elf_info->module->elf_info->elf_loader = 0; } else ret = TRUE; + if (elf_info->flags & ELF_INFO_NAME) + { + elf_info->module_name = strcpy(HeapAlloc(GetProcessHeap(), 0, + strlen(filename) + 1), filename); + } leave: elf_unmap_file(&fmap); @@ -1137,6 +1168,7 @@ * Enumerate ELF modules from a running process */ static BOOL elf_enum_modules_internal(const struct process* pcs, + const char* main_name, elf_enum_modules_cb cb, void* user) { struct r_debug dbg_hdr; @@ -1164,7 +1196,8 @@ ReadProcessMemory(pcs->handle, lm.l_name, bufstr, sizeof(bufstr), NULL)) { bufstr[sizeof(bufstr) - 1] = '\0'; - if (!cb(bufstr, lm.l_addr, user)) break; + if (main_name && !bufstr[0]) strcpy(bufstr, main_name); + if (!cb(bufstr, (unsigned long)lm.l_addr, user)) break; } } return TRUE; @@ -1204,7 +1237,7 @@ es.pcs = pcs; es.elf_info.flags = ELF_INFO_MODULE; - if (!elf_enum_modules_internal(pcs, elf_enum_sync_cb, &es)) + if (!elf_enum_modules_internal(pcs, NULL, elf_enum_sync_cb, &es)) return FALSE; module = pcs->lmodules; @@ -1277,13 +1310,16 @@ { struct process pcs; struct elf_info elf_info; + BOOL ret; memset(&pcs, 0, sizeof(pcs)); pcs.handle = hProc; - elf_info.flags = ELF_INFO_DEBUG_HEADER; + elf_info.flags = ELF_INFO_DEBUG_HEADER | ELF_INFO_NAME; if (!elf_search_loader(&pcs, &elf_info)) return FALSE; pcs.dbg_hdr_addr = elf_info.dbg_hdr_addr; - return elf_enum_modules_internal(&pcs, cb, user); + ret = elf_enum_modules_internal(&pcs, elf_info.module_name, cb, user); + HeapFree(GetProcessHeap(), 0, (char*)elf_info.module_name); + return ret; } struct elf_load @@ -1329,7 +1365,7 @@ { struct elf_load el; - TRACE("(%p %s)\n", pcs, name); + TRACE("(%p %s %08lx)\n", pcs, name, addr); el.elf_info.flags = ELF_INFO_MODULE; el.ret = FALSE; @@ -1337,14 +1373,14 @@ if (pcs->dbg_hdr_addr) /* we're debugging a life target */ { el.pcs = pcs; - /* do only the lookup from the filename, not the path (as we lookup module name - * in the process' loaded module list) + /* do only the lookup from the filename, not the path (as we lookup module + * name in the process' loaded module list) */ el.name = strrchr(name, '/'); if (!el.name++) el.name = name; el.ret = FALSE; - if (!elf_enum_modules_internal(pcs, elf_load_cb, &el)) + if (!elf_enum_modules_internal(pcs, NULL, elf_load_cb, &el)) return NULL; } else if (addr) diff -urN wine-20050310/dlls/dbghelp/minidump.c wine-20050419/dlls/dbghelp/minidump.c --- wine-20050310/dlls/dbghelp/minidump.c 2005-03-07 12:03:21.000000000 +0100 +++ wine-20050419/dlls/dbghelp/minidump.c 2005-03-29 15:14:08.000000000 +0200 @@ -1,7 +1,7 @@ /* * File minidump.c - management of dumps (read & write) * - * Copyright (C) 2004, Eric Pouech + * Copyright (C) 2004-2005, Eric Pouech * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -45,6 +45,8 @@ unsigned is_elf; ULONG base; ULONG size; + DWORD timestamp; + DWORD checksum; char name[MAX_PATH]; }; @@ -182,12 +184,15 @@ * Add a module to a dump context */ static BOOL add_module(struct dump_context* dc, const char* name, - DWORD base, DWORD size, BOOL is_elf) + DWORD base, DWORD size, DWORD timestamp, DWORD checksum, + BOOL is_elf) { if (!dc->module) - dc->module = HeapAlloc(GetProcessHeap(), 0, ++dc->num_module * sizeof(*dc->module)); + dc->module = HeapAlloc(GetProcessHeap(), 0, + ++dc->num_module * sizeof(*dc->module)); else - dc->module = HeapReAlloc(GetProcessHeap(), 0, dc->module, ++dc->num_module * sizeof(*dc->module)); + dc->module = HeapReAlloc(GetProcessHeap(), 0, dc->module, + ++dc->num_module * sizeof(*dc->module)); if (!dc->module) return FALSE; if (is_elf || !GetModuleFileNameExA(dc->hProcess, (HMODULE)base, @@ -197,6 +202,8 @@ sizeof(dc->module[dc->num_module - 1].name)); dc->module[dc->num_module - 1].base = base; dc->module[dc->num_module - 1].size = size; + dc->module[dc->num_module - 1].timestamp = timestamp; + dc->module[dc->num_module - 1].checksum = checksum; dc->module[dc->num_module - 1].is_elf = is_elf; return TRUE; @@ -210,24 +217,40 @@ static BOOL WINAPI fetch_pe_module_info_cb(char* name, DWORD base, DWORD size, void* user) { - return add_module((struct dump_context*)user, name, base, size, FALSE); + struct dump_context* dc = (struct dump_context*)user; + IMAGE_NT_HEADERS nth; + + if (pe_load_nt_header(dc->hProcess, base, &nth)) + add_module((struct dump_context*)user, name, base, size, + nth.FileHeader.TimeDateStamp, nth.OptionalHeader.CheckSum, + FALSE); + return TRUE; } /****************************************************************** * fetch_elf_module_info_cb * - * Callback for accumulating in dump_context a ELF modules set + * Callback for accumulating in dump_context an ELF modules set */ static BOOL fetch_elf_module_info_cb(const char* name, unsigned long base, void* user) { - return add_module((struct dump_context*)user, name, - base, 0 /* FIXME */, TRUE); + struct dump_context* dc = (struct dump_context*)user; + DWORD size, checksum; + + /* FIXME: there's no relevant timestamp on ELF modules */ + /* NB: if we have a non-null base from the live-target use it (whenever + * the ELF module is relocatable or not). If we have a null base (ELF + * module isn't relocatable) then grab its base address from ELF file + */ + if (!elf_fetch_file_info(name, base ? NULL : &base, &size, &checksum)) + size = checksum = 0; + add_module(dc, name, base, size, 0 /* FIXME */, checksum, TRUE); + return TRUE; } static void fetch_module_info(struct dump_context* dc) { - WINE_FIXME("--> %p\n", dc->hProcess); EnumerateLoadedModules(dc->hProcess, fetch_pe_module_info_cb, dc); /* Since we include ELF modules in a separate stream from the regular PE ones, * we can always include those ELF modules (they don't eat lots of space) @@ -352,7 +375,8 @@ for (i = nmod = 0; i < dc->num_module; i++) { - if ((dc->module[i].is_elf && dump_elf) || (!dc->module[i].is_elf && !dump_elf)) + if ((dc->module[i].is_elf && dump_elf) || + (!dc->module[i].is_elf && !dump_elf)) nmod++; } @@ -366,7 +390,8 @@ dc->rva += sizeof(mdModuleList.NumberOfModules) + sizeof(mdModule) * nmod; for (i = 0; i < dc->num_module; i++) { - if ((dc->module[i].is_elf && !dump_elf) || (!dc->module[i].is_elf && dump_elf)) + if ((dc->module[i].is_elf && !dump_elf) || + (!dc->module[i].is_elf && dump_elf)) continue; flags_out = ModuleWriteModule | ModuleWriteMiscRecord | ModuleWriteCvRecord; @@ -396,8 +421,8 @@ cbin.u.Module.FullPath = ms->Buffer; cbin.u.Module.BaseOfImage = dc->module[i].base; cbin.u.Module.SizeOfImage = dc->module[i].size; - cbin.u.Module.CheckSum = 0; /* FIXME */ - cbin.u.Module.TimeDateStamp = 0; /* FIXME */ + cbin.u.Module.CheckSum = dc->module[i].checksum; + cbin.u.Module.TimeDateStamp = dc->module[i].timestamp; memset(&cbin.u.Module.VersionInfo, 0, sizeof(cbin.u.Module.VersionInfo)); cbin.u.Module.CvRecord = NULL; cbin.u.Module.SizeOfCvRecord = 0; @@ -413,8 +438,8 @@ { mdModule.BaseOfImage = dc->module[i].base; mdModule.SizeOfImage = dc->module[i].size; - mdModule.CheckSum = 0; /* FIXME */ - mdModule.TimeDateStamp = 0; /* FIXME */ + mdModule.CheckSum = dc->module[i].checksum; + mdModule.TimeDateStamp = dc->module[i].timestamp; mdModule.ModuleNameRva = dc->rva; ms->Length -= sizeof(WCHAR); append(dc, ms, sizeof(ULONG) + ms->Length); @@ -619,7 +644,6 @@ /****************************************************************** * MiniDumpWriteDump (DEBUGHLP.@) * - * */ BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess, DWORD pid, HANDLE hFile, MINIDUMP_TYPE DumpType, diff -urN wine-20050310/dlls/dbghelp/module.c wine-20050419/dlls/dbghelp/module.c --- wine-20050310/dlls/dbghelp/module.c 2005-03-01 11:39:49.000000000 +0100 +++ wine-20050419/dlls/dbghelp/module.c 2005-04-18 17:33:31.000000000 +0200 @@ -35,23 +35,24 @@ static void module_fill_module(const char* in, char* out, unsigned size) { - const char* ptr; + const char *ptr,*endptr; unsigned len; - for (ptr = in + strlen(in) - 1; - *ptr != '/' && *ptr != '\\' && ptr >= in; + endptr = in + strlen(in); + for (ptr = endptr - 1; + ptr >= in && *ptr != '/' && *ptr != '\\'; ptr--); - if (ptr < in || *ptr == '/' || *ptr == '\\') ptr++; - strncpy(out, ptr, size); - out[size - 1] = '\0'; - len = strlen(out); + ptr++; + len = min(endptr-ptr,size-1); + memcpy(out, ptr, len); + out[len] = '\0'; if (len > 4 && (!strcasecmp(&out[len - 4], ".dll") || !strcasecmp(&out[len - 4], ".exe"))) out[len - 4] = '\0'; else if (((len > 12 && out[len - 13] == '/') || len == 12) && (!strcasecmp(out + len - 12, "wine-pthread") || !strcasecmp(out + len - 12, "wine-kthread"))) - strcpy(out, ""); + lstrcpynA(out, "",size); else { if (len > 7 && @@ -77,6 +78,7 @@ { struct module* module; + assert(type == DMT_ELF || type == DMT_PE); if (!(module = HeapAlloc(GetProcessHeap(), 0, sizeof(*module)))) return NULL; @@ -94,11 +96,10 @@ module->module.SizeOfStruct = sizeof(module->module); module->module.BaseOfImage = mod_addr; module->module.ImageSize = size; - module_fill_module(name, module->module.ModuleName, sizeof(module->module.ModuleName)); + module_fill_module(name, module->module.ModuleName, + sizeof(module->module.ModuleName)); module->module.ImageName[0] = '\0'; - strncpy(module->module.LoadedImageName, name, - sizeof(module->module.LoadedImageName)); - module->module.LoadedImageName[sizeof(module->module.LoadedImageName) - 1] = '\0'; + lstrcpynA(module->module.LoadedImageName, name, sizeof(module->module.LoadedImageName)); module->module.SymType = SymNone; module->module.NumSyms = 0; module->module.TimeDateStamp = stamp; @@ -142,13 +143,15 @@ for (module = pcs->lmodules; module; module = module->next) { - if (type == module->type && !strcasecmp(name, module->module.LoadedImageName)) + if (type == module->type && + !strcasecmp(name, module->module.LoadedImageName)) return module; } module_fill_module(name, modname, sizeof(modname)); for (module = pcs->lmodules; module; module = module->next) { - if (type == module->type && !strcasecmp(modname, module->module.ModuleName)) + if (type == module->type && + !strcasecmp(modname, module->module.ModuleName)) return module; } } @@ -261,7 +264,7 @@ return module; } -static BOOL module_is_elf_container_loaded(struct process* pcs, const char* ImageName, +static BOOL module_is_elf_container_loaded(struct process* pcs, const char* ImageName, const char* ModuleName) { char buffer[MAX_PATH]; @@ -284,31 +287,34 @@ return FALSE; } -static BOOL elf_is_shared_by_name(const char* name) +/****************************************************************** + * module_get_type_by_name + * + * Guesses a filename type from its extension + */ +enum module_type module_get_type_by_name(const char* name) { const char* ptr; int len = strlen(name); - /* check for terminating .so or .so.[digit]+ */ - while (len) - { - for (ptr = name + len - 1; ptr >= name; ptr--) if (*ptr == '.') break; - if (ptr < name) break; - if (ptr == name + len - 2 && isdigit(ptr[1])) - { - len -= 2; - continue; - } - if (ptr == name + len - 3 && ptr[1] == 's' && ptr[2] == 'o') - return TRUE; - break; + /* check for terminating .so or .so.[digit] */ + ptr = strrchr(name, '.'); + if (ptr) + { + if (!strcmp(ptr, ".so") || + (isdigit(ptr[1]) && !ptr[2] && ptr >= name + 3 && !memcmp(ptr - 3, ".so", 3))) + return DMT_ELF; + else if (!strcasecmp(ptr, ".pdb")) + return DMT_PDB; } - /* wine-[kp]thread is valid too */ - if (((len > 12 && name[len - 13] == '/') || len == 12) && + /* wine-[kp]thread is also an ELF module */ + else if (((len > 12 && name[len - 13] == '/') || len == 12) && (!strcasecmp(name + len - 12, "wine-pthread") || !strcasecmp(name + len - 12, "wine-kthread"))) - return TRUE; - return FALSE; + { + return DMT_ELF; + } + return DMT_PE; } /*********************************************************************** @@ -336,7 +342,8 @@ if (module_is_elf_container_loaded(pcs, ImageName, ModuleName)) { /* force the loading of DLL as builtin */ - if ((module = pe_load_module_from_pcs(pcs, ImageName, ModuleName, BaseOfDll, SizeOfDll))) + if ((module = pe_load_module_from_pcs(pcs, ImageName, ModuleName, + BaseOfDll, SizeOfDll))) goto done; WARN("Couldn't locate %s\n", ImageName); return 0; @@ -344,12 +351,13 @@ TRACE("Assuming %s as native DLL\n", ImageName); if (!(module = pe_load_module(pcs, ImageName, hFile, BaseOfDll, SizeOfDll))) { - if (elf_is_shared_by_name(ImageName) && + if (module_get_type_by_name(ImageName) == DMT_ELF && (module = elf_load_module(pcs, ImageName, BaseOfDll))) goto done; FIXME("Should have successfully loaded debug information for image %s\n", ImageName); - if ((module = pe_load_module_from_pcs(pcs, ImageName, ModuleName, BaseOfDll, SizeOfDll))) + if ((module = pe_load_module_from_pcs(pcs, ImageName, ModuleName, + BaseOfDll, SizeOfDll))) goto done; WARN("Couldn't locate %s\n", ImageName); return 0; @@ -360,13 +368,8 @@ * of ImageName. Overwrite it, if we have better information */ if (ModuleName) - { - strncpy(module->module.ModuleName, ModuleName, - sizeof(module->module.ModuleName)); - module->module.ModuleName[sizeof(module->module.ModuleName) - 1] = '\0'; - } - strncpy(module->module.ImageName, ImageName, sizeof(module->module.ImageName)); - module->module.ImageName[sizeof(module->module.ImageName) - 1] = '\0'; + lstrcpynA(module->module.ModuleName, ModuleName, sizeof(module->module.ModuleName)); + lstrcpynA(module->module.ImageName, ImageName, sizeof(module->module.ImageName)); return module->module.BaseOfImage; } @@ -469,7 +472,6 @@ !GetModuleBaseNameA(hProcess, hMods[i], base, sizeof(base))) continue; module_fill_module(base, mod, sizeof(mod)); - EnumLoadedModulesCallback(mod, (DWORD)mi.lpBaseOfDll, mi.SizeOfImage, UserContext); } diff -urN wine-20050310/dlls/dbghelp/msc.c wine-20050419/dlls/dbghelp/msc.c --- wine-20050310/dlls/dbghelp/msc.c 2005-02-09 23:21:58.000000000 +0100 +++ wine-20050419/dlls/dbghelp/msc.c 2005-03-29 13:30:57.000000000 +0200 @@ -4,7 +4,7 @@ * * Copyright (C) 1996, Eric Youngdale. * Copyright (C) 1999-2000, Ulrich Weigand. - * Copyright (C) 2004, Eric Pouech. + * Copyright (C) 2004-2005, Eric Pouech. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -496,11 +496,10 @@ { struct symt_udt* symt; const unsigned char* ptr = list; - int value, leaf_len, vpoff, vplen; + int value, leaf_len; const struct p_string* p_name; const char* c_name; struct symt* subtype; - const unsigned short int* p_vboff; symt = symt_new_udt(module, NULL, 0, UdtStruct /* don't care */); while (ptr - list < len) @@ -534,6 +533,8 @@ case LF_VBCLASS_V1: case LF_IVBCLASS_V1: { + const unsigned short int* p_vboff; + int vpoff, vplen; leaf_len = numeric_leaf(&value, &type->vbclass_v1.vbpoff); p_vboff = (const unsigned short int*)((const char*)&type->vbclass_v1.vbpoff + leaf_len); vplen = numeric_leaf(&vpoff, p_vboff); @@ -547,6 +548,8 @@ case LF_VBCLASS_V2: case LF_IVBCLASS_V2: { + const unsigned short int* p_vboff; + int vpoff, vplen; leaf_len = numeric_leaf(&value, &type->vbclass_v2.vbpoff); p_vboff = (const unsigned short int*)((const char*)&type->vbclass_v2.vbpoff + leaf_len); vplen = numeric_leaf(&vpoff, p_vboff); @@ -1156,7 +1159,8 @@ { const union codeview_symbol* sym = (const union codeview_symbol*)(root + i); length = sym->generic.len + 2; - if (length & 3) FIXME("unpadded len %u\n", length + 2); + if (i + length > size) break; + if (length & 3) FIXME("unpadded len %u\n", length); switch (sym->generic.id) { @@ -2214,6 +2218,7 @@ pdb_lookup.filename = pdb->name; pdb_lookup.kind = PDB_JG; pdb_lookup.u.jg.timestamp = pdb->timestamp; + pdb_lookup.u.jg.toc = NULL; ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup); break; } @@ -2226,6 +2231,7 @@ pdb_lookup.filename = rsds->name; pdb_lookup.kind = PDB_DS; pdb_lookup.u.ds.guid = rsds->guid; + pdb_lookup.u.ds.toc = NULL; ret = pdb_process_file(pcs, msc_dbg, &pdb_lookup); break; } diff -urN wine-20050310/dlls/dbghelp/path.c wine-20050419/dlls/dbghelp/path.c --- wine-20050310/dlls/dbghelp/path.c 2004-10-21 21:57:56.000000000 +0200 +++ wine-20050419/dlls/dbghelp/path.c 2005-03-29 15:14:08.000000000 +0200 @@ -24,6 +24,10 @@ #include #include "dbghelp_private.h" +#include "ntstatus.h" +#include "winnls.h" +#include "winreg.h" +#include "winternl.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); @@ -140,7 +144,7 @@ return mptr == match - 1; } -static BOOL do_search(const char* file, char* buffer, +static BOOL do_search(const char* file, char* buffer, BOOL recurse, PENUMDIRTREE_CALLBACK cb, void* user) { HANDLE h; @@ -161,8 +165,8 @@ if (!strcmp(fd.cFileName, ".") || !strcmp(fd.cFileName, "..")) continue; strcpy(buffer + pos, fd.cFileName); - if (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - found = do_search(file, buffer, cb, user); + if (recurse && (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + found = do_search(file, buffer, TRUE, cb, user); else if (SymMatchFileName(buffer, (char*)file, NULL, NULL)) { if (!cb || cb(buffer, user)) found = TRUE; @@ -182,7 +186,7 @@ TRACE("(%s, %s, %p)\n", debugstr_a(root), debugstr_a(file), buffer); strcpy(buffer, root); - return do_search(file, buffer, NULL, NULL); + return do_search(file, buffer, TRUE, NULL, NULL); } /****************************************************************** @@ -196,11 +200,19 @@ TRACE("(%p %s %s %p %p %p)\n", hProcess, root, file, buffer, cb, user); strcpy(buffer, root); - return do_search(file, buffer, cb, user); + return do_search(file, buffer, TRUE, cb, user); } struct sffip { + enum module_type kind; + /* pe: id -> DWORD:timestamp + * two -> size of image (from PE header) + * pdb: id -> PDB signature + * I think either DWORD:timestamp or GUID:guid depending on PDB version + * two -> PDB age ??? + * elf: id -> DWORD:CRC 32 of ELF image (Wine only) + */ PVOID id; DWORD two; DWORD three; @@ -212,11 +224,66 @@ static BOOL CALLBACK sffip_cb(LPCSTR buffer, void* user) { struct sffip* s = (struct sffip*)user; - + DWORD size, checksum; + DWORD_PTR timestamp; /* FIXME: should check that id/two/three match the file pointed * by buffer */ - /* yes, EnumDirTree and SymFindFileInPath callbacks use the opposite + switch (s->kind) + { + case DMT_PE: + { + HANDLE hFile, hMap; + void* mapping; + + timestamp = ~(DWORD_PTR)s->id; + size = ~s->two; + hFile = CreateFileA(buffer, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) return TRUE; + if ((hMap = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL) + { + if ((mapping = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) != NULL) + { + IMAGE_NT_HEADERS* nth = RtlImageNtHeader(mapping); + timestamp = nth->FileHeader.TimeDateStamp; + size = nth->OptionalHeader.SizeOfImage; + UnmapViewOfFile(mapping); + } + CloseHandle(hMap); + } + CloseHandle(hFile); + if (timestamp != (DWORD_PTR)s->id || size != s->two) + { + WARN("Found %s, but wrong size or timestamp\n", buffer); + return TRUE; + } + } + break; + case DMT_ELF: + if (elf_fetch_file_info(buffer, 0, &size, &checksum)) + { + if (checksum != (DWORD_PTR)s->id) + { + WARN("Found %s, but wrong checksums: %08lx %08lx\n", + buffer, checksum, (DWORD_PTR)s->id); + return TRUE; + } + } + else + { + WARN("Couldn't read %s\n", buffer); + return TRUE; + } + break; + case DMT_PDB: + FIXME("NIY on '%s'\n", buffer); + break; + default: + FIXME("What the heck??\n"); + return TRUE; + } + /* yes, EnumDirTree/do_search and SymFindFileInPath callbacks use the opposite * convention to stop/continue enumeration. sigh. */ return !(s->cb)((char*)buffer, s->user); @@ -226,7 +293,7 @@ * SymFindFileInPath (DBGHELP.@) * */ -BOOL WINAPI SymFindFileInPath(HANDLE hProcess, LPSTR searchPath, LPSTR file, +BOOL WINAPI SymFindFileInPath(HANDLE hProcess, LPSTR searchPath, LPSTR full_path, PVOID id, DWORD two, DWORD three, DWORD flags, LPSTR buffer, PFINDFILEINPATHCALLBACK cb, PVOID user) @@ -235,9 +302,10 @@ struct process* pcs = process_find_by_handle(hProcess); char tmp[MAX_PATH]; char* ptr; + char* filename; TRACE("(%p %s %s %p %08lx %08lx %08lx %p %p %p)\n", - hProcess, searchPath, file, id, two, three, flags, + hProcess, searchPath, full_path, id, two, three, flags, buffer, cb, user); if (!pcs) return FALSE; @@ -250,7 +318,15 @@ s.cb = cb; s.user = user; - file = file_name(file); + filename = file_name(full_path); + s.kind = module_get_type_by_name(filename); + + /* first check full path to file */ + if (sffip_cb(full_path, &s)) + { + strcpy(buffer, full_path); + return TRUE; + } while (searchPath) { @@ -266,7 +342,7 @@ strcpy(tmp, searchPath); searchPath = NULL; } - if (EnumDirTree(hProcess, tmp, file, buffer, sffip_cb, &s)) return TRUE; + if (do_search(filename, tmp, FALSE, sffip_cb, &s)) return TRUE; } return FALSE; } diff -urN wine-20050310/dlls/dbghelp/pe_module.c wine-20050419/dlls/dbghelp/pe_module.c --- wine-20050310/dlls/dbghelp/pe_module.c 2005-03-01 11:39:49.000000000 +0100 +++ wine-20050419/dlls/dbghelp/pe_module.c 2005-03-29 15:14:08.000000000 +0200 @@ -341,7 +341,7 @@ /* FIXME SetLastError */ return NULL; } - if ((hFile = FindExecutableImage(name, NULL, loaded_name)) == NULL) + if ((hFile = FindExecutableImage(name, pcs->search_path, loaded_name)) == NULL) return NULL; opened = TRUE; } @@ -381,6 +381,21 @@ } /****************************************************************** + * pe_load_nt_header + * + */ +BOOL pe_load_nt_header(HANDLE hProc, DWORD base, IMAGE_NT_HEADERS* nth) +{ + IMAGE_DOS_HEADER dos; + + return ReadProcessMemory(hProc, (char*)base, &dos, sizeof(dos), NULL) && + dos.e_magic == IMAGE_DOS_SIGNATURE && + ReadProcessMemory(hProc, (char*)(base + dos.e_lfanew), + nth, sizeof(*nth), NULL) && + nth->Signature == IMAGE_NT_SIGNATURE; +} + +/****************************************************************** * pe_load_module_from_pcs * */ @@ -408,14 +423,9 @@ { if (pcs->dbg_hdr_addr) { - IMAGE_DOS_HEADER dos; IMAGE_NT_HEADERS nth; - if (ReadProcessMemory(pcs->handle, (char*)base, &dos, sizeof(dos), NULL) && - dos.e_magic == IMAGE_DOS_SIGNATURE && - ReadProcessMemory(pcs->handle, (char*)(base + dos.e_lfanew), - &nth, sizeof(nth), NULL) && - nth.Signature == IMAGE_NT_SIGNATURE) + if (pe_load_nt_header(pcs->handle, base, &nth)) { if (!size) size = nth.OptionalHeader.SizeOfImage; module = module_new(pcs, name, DMT_PE, base, size, diff -urN wine-20050310/dlls/dbghelp/symbol.c wine-20050419/dlls/dbghelp/symbol.c --- wine-20050310/dlls/dbghelp/symbol.c 2005-01-31 12:35:00.000000000 +0100 +++ wine-20050419/dlls/dbghelp/symbol.c 2005-03-29 13:30:57.000000000 +0200 @@ -532,11 +532,11 @@ if (sym_info->MaxNameLen) { if (sym->tag != SymTagPublicSymbol || !(dbghelp_options & SYMOPT_UNDNAME) || - (sym_info->NameLen = UnDecorateSymbolName(sym_info->Name, sym_info->Name, + (sym_info->NameLen = UnDecorateSymbolName(name, sym_info->Name, sym_info->MaxNameLen, UNDNAME_COMPLETE) == 0)) { sym_info->NameLen = min(strlen(name), sym_info->MaxNameLen - 1); - strncpy(sym_info->Name, name, sym_info->NameLen); + memcpy(sym_info->Name, name, sym_info->NameLen); sym_info->Name[sym_info->NameLen] = '\0'; } } @@ -916,8 +916,7 @@ Symbol->Size = si->Size; Symbol->Flags = si->Flags; len = min(Symbol->MaxNameLength, si->MaxNameLen); - strncpy(Symbol->Name, si->Name, len); - Symbol->Name[len - 1] = '\0'; + lstrcpynA(Symbol->Name, si->Name, len); return TRUE; } @@ -992,8 +991,7 @@ Symbol->Size = si->Size; Symbol->Flags = si->Flags; len = min(Symbol->MaxNameLength, si->MaxNameLen); - strncpy(Symbol->Name, si->Name, len); - Symbol->Name[len - 1] = '\0'; + lstrcpynA(Symbol->Name, si->Name, len); return TRUE; } diff -urN wine-20050310/dlls/dbghelp/type.c wine-20050419/dlls/dbghelp/type.c --- wine-20050310/dlls/dbghelp/type.c 2005-01-09 17:42:53.000000000 +0100 +++ wine-20050419/dlls/dbghelp/type.c 2005-04-18 17:34:10.000000000 +0200 @@ -398,11 +398,12 @@ tmp = symt_get_name(type); if (tmp) { - sym_info->NameLen = strlen(tmp) + 1; - strncpy(sym_info->Name, tmp, min(sym_info->NameLen, sym_info->MaxNameLen)); - sym_info->Name[sym_info->MaxNameLen - 1] = '\0'; - } - else sym_info->Name[sym_info->NameLen = 0] = '\0'; + sym_info->NameLen = min(strlen(tmp),sym_info->MaxNameLen-1); + memcpy(sym_info->Name, tmp, sym_info->NameLen); + sym_info->Name[sym_info->NameLen] = '\0'; + } + else + sym_info->Name[sym_info->NameLen = 0] = '\0'; if (!EnumSymbolsCallback(sym_info, sym_info->Size, UserContext)) break; } return TRUE; diff -urN wine-20050310/dlls/dciman32/dciman32.spec wine-20050419/dlls/dciman32/dciman32.spec --- wine-20050310/dlls/dciman32/dciman32.spec 2005-01-03 21:47:48.000000000 +0100 +++ wine-20050419/dlls/dciman32/dciman32.spec 2005-04-15 18:11:56.000000000 +0200 @@ -2,7 +2,7 @@ @ stdcall DCICloseProvider(long) @ stub DCICreateOffscreen @ stub DCICreateOverlay -@ stub DCICreatePrimary +@ stdcall DCICreatePrimary(long ptr) @ stub DCIDestroy @ stub DCIDraw @ stub DCIEndAccess diff -urN wine-20050310/dlls/dciman32/dciman_main.c wine-20050419/dlls/dciman32/dciman_main.c --- wine-20050310/dlls/dciman32/dciman_main.c 2004-12-15 11:52:57.000000000 +0100 +++ wine-20050419/dlls/dciman32/dciman_main.c 2005-04-15 18:11:56.000000000 +0200 @@ -20,13 +20,15 @@ */ #include -#include +#include #include "windef.h" #include "winbase.h" #include "winerror.h" #include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(dciman); + /*********************************************************************** * DllEntryPoint (DCIMAN32.@) * @@ -56,3 +58,14 @@ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return; } + +/************************************************************************** + * DCICreatePrimary (DCIMAN32.@) + */ +void WINAPI +DCICreatePrimary(HDC hdc, LPVOID pDciSurfaceInfo) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("%p %p\n", hdc, pDciSurfaceInfo); + return; +} diff -urN wine-20050310/dlls/ddraw/d3ddevice/mesa.c wine-20050419/dlls/ddraw/d3ddevice/mesa.c --- wine-20050310/dlls/ddraw/d3ddevice/mesa.c 2005-02-14 12:09:46.000000000 +0100 +++ wine-20050419/dlls/ddraw/d3ddevice/mesa.c 2005-04-11 14:51:22.000000000 +0200 @@ -2257,7 +2257,7 @@ glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_TEXTURE_2D); } else { - GLenum tex_name = ((IDirect3DTextureGLImpl *) surf_ptr->tex_private)->tex_name; + GLenum tex_name = gltex_get_tex_name(surf_ptr); unit = GL_TEXTURE0_WINE + stage; if (unit != glThis->current_active_tex_unit) { @@ -3992,14 +3992,14 @@ } /* Allocate memory for the matrices */ - object->world_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); - object->view_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); - object->proj_mat = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); + object->world_mat = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); + object->view_mat = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); + object->proj_mat = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); memcpy(object->world_mat, id_mat, 16 * sizeof(float)); memcpy(object->view_mat , id_mat, 16 * sizeof(float)); memcpy(object->proj_mat , id_mat, 16 * sizeof(float)); for (tex_num = 0; tex_num < MAX_TEXTURES; tex_num++) { - object->tex_mat[tex_num] = (D3DMATRIX *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); + object->tex_mat[tex_num] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 16 * sizeof(float)); memcpy(object->tex_mat[tex_num], id_mat, 16 * sizeof(float)); object->tex_mat_is_identity[tex_num] = TRUE; } @@ -4011,7 +4011,7 @@ /* allocate the clipping planes */ object->max_clipping_planes = opengl_device_caps.wMaxUserClipPlanes; - object->clipping_planes = (d3d7clippingplane*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->max_clipping_planes * sizeof(d3d7clippingplane)); + object->clipping_planes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->max_clipping_planes * sizeof(d3d7clippingplane)); glHint(GL_FOG_HINT,GL_NICEST); diff -urN wine-20050310/dlls/ddraw/d3dtexture.c wine-20050419/dlls/ddraw/d3dtexture.c --- wine-20050310/dlls/ddraw/d3dtexture.c 2005-01-10 14:29:26.000000000 +0100 +++ wine-20050419/dlls/ddraw/d3dtexture.c 2005-04-11 14:51:22.000000000 +0200 @@ -417,6 +417,8 @@ ENTER_GL(); glGetIntegerv(GL_TEXTURE_BINDING_2D, &cur_tex); + /* This call is to create the actual texture name in GL (as we do 'late' ID creation) */ + gltex_get_tex_name(surf_ptr); glBindTexture(GL_TEXTURE_2D, gl_surf_ptr->tex_name); if ((gl_surf_ptr->dirty_flag == SURFACE_MEMORY_DIRTY) && @@ -706,9 +708,6 @@ memcpy(dst_d->lpSurface, src_d->lpSurface, src_d->u1.lPitch * src_d->dwHeight); if (gl_dst_ptr != NULL) { - /* If the GetHandle was not done, it is an error... */ - if (gl_dst_ptr->tex_name == 0) ERR("Unbound GL texture !!!\n"); - /* Set this texture as dirty */ gl_dst_ptr->dirty_flag = SURFACE_MEMORY_DIRTY; *(gl_dst_ptr->global_dirty_flag) = SURFACE_MEMORY_DIRTY; @@ -875,6 +874,8 @@ private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTextureGLImpl)); if (private == NULL) return DDERR_OUTOFMEMORY; + surf->tex_private = private; + private->final_release = surf->final_release; private->lock_update = surf->lock_update; private->unlock_update = surf->unlock_update; @@ -885,7 +886,6 @@ surf->final_release = gltex_final_release; surf->lock_update = gltex_lock_update; surf->unlock_update = gltex_unlock_update; - surf->tex_private = private; surf->aux_setcolorkey_cb = gltex_setcolorkey_cb; surf->set_palette = gltex_set_palette; @@ -895,25 +895,43 @@ surf->aux_bltfast = gltex_bltfast; TRACE(" GL texture created for surface %p (private data at %p)\n", surf, private); - + + /* Do not create the OpenGL texture id here as some game generate textures from a different thread which + cause problems.. */ + private->tex_name = 0; + if (surf->mipmap_level == 0) { + private->main = NULL; + private->global_dirty_flag = &(private->__global_dirty_flag); + } else { + private->main = main; + private->global_dirty_flag = &(((IDirect3DTextureGLImpl *) (private->main->tex_private))->__global_dirty_flag); + } + private->initial_upload_done = FALSE; + } + + return D3D_OK; +} + +GLuint gltex_get_tex_name(IDirectDrawSurfaceImpl *surf) +{ + IDirect3DTextureGLImpl *private = (IDirect3DTextureGLImpl *) (surf->tex_private); + + if (private->tex_name == 0) { + /* The texture was not created yet... */ ENTER_GL(); if (surf->mipmap_level == 0) { glGenTextures(1, &(private->tex_name)); if (private->tex_name == 0) ERR("Error at creation of OpenGL texture ID !\n"); TRACE(" GL texture id is : %d.\n", private->tex_name); - private->__global_dirty_flag = (at_creation == FALSE ? SURFACE_MEMORY_DIRTY : SURFACE_MEMORY); - private->global_dirty_flag = &(private->__global_dirty_flag); + private->__global_dirty_flag = SURFACE_MEMORY_DIRTY; } else { - private->tex_name = ((IDirect3DTextureGLImpl *) (main->tex_private))->tex_name; - TRACE(" GL texture id reusing id %d from surface %p (private at %p)).\n", private->tex_name, main, main->tex_private); - private->global_dirty_flag = &(((IDirect3DTextureGLImpl *) (main->tex_private))->__global_dirty_flag); + private->tex_name = gltex_get_tex_name(private->main); + TRACE(" GL texture id reusing id %d from surface %p (private at %p)).\n", private->tex_name, private->main, private->main->tex_private); } LEAVE_GL(); /* And set the dirty flag accordingly */ - private->dirty_flag = (at_creation == FALSE ? SURFACE_MEMORY_DIRTY : SURFACE_MEMORY); - private->initial_upload_done = FALSE; + private->dirty_flag = SURFACE_MEMORY_DIRTY; } - - return D3D_OK; + return ((IDirect3DTextureGLImpl *) (surf->tex_private))->tex_name; } diff -urN wine-20050310/dlls/ddraw/dclipper/main.c wine-20050419/dlls/ddraw/dclipper/main.c --- wine-20050310/dlls/ddraw/dclipper/main.c 2005-01-09 18:35:44.000000000 +0100 +++ wine-20050419/dlls/ddraw/dclipper/main.c 2005-03-21 11:28:49.000000000 +0100 @@ -88,7 +88,7 @@ ) { IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; - TRACE("(%p)->SetHwnd(0x%08lx,0x%08lx)\n",This,dwFlags,(DWORD)hWnd); + TRACE("(%p)->(0x%08lx,0x%08lx)\n", This, dwFlags, (DWORD)hWnd); if( dwFlags ) { FIXME("dwFlags = 0x%08lx, not supported.\n",dwFlags); return DDERR_INVALIDPARAMS; @@ -149,7 +149,7 @@ { IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; - TRACE("(%p,%p,%p,%p)\n", This, lpRect, lpClipList, lpdwSize); + TRACE("(%p,%p,%p,%p)\n", This, lpRect, lpClipList, lpdwSize); if (This->hWnd) { @@ -236,7 +236,7 @@ LPDIRECTDRAWCLIPPER iface, HWND* hWndPtr ) { IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; - FIXME("(%p)->(%p),stub!\n",This,hWndPtr); + TRACE("(%p)->(%p)\n", This, hWndPtr); *hWndPtr = This->hWnd; @@ -248,7 +248,7 @@ ) { IDirectDrawImpl* pOwner; IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; - FIXME("(%p)->(%p,0x%08lx),stub!\n",This,lpDD,dwFlags); + TRACE("(%p)->(%p,0x%08lx)\n", This, lpDD, dwFlags); if (This->ddraw_owner != NULL) return DDERR_ALREADYINITIALIZED; diff -urN wine-20050310/dlls/ddraw/dsurface/dib.c wine-20050419/dlls/ddraw/dsurface/dib.c --- wine-20050310/dlls/ddraw/dsurface/dib.c 2005-03-10 12:13:11.000000000 +0100 +++ wine-20050419/dlls/ddraw/dsurface/dib.c 2005-04-11 16:26:00.000000000 +0200 @@ -78,22 +78,21 @@ case 16: case 32: /* Allocate extra space to store the RGB bit masks. */ - b_info = (BITMAPINFO*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(BITMAPINFOHEADER) - + 3 * sizeof(DWORD)); + b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD)); break; case 24: - b_info = (BITMAPINFO*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(BITMAPINFOHEADER)); + b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(BITMAPINFOHEADER)); break; default: /* Allocate extra space for a palette. */ - b_info = (BITMAPINFO*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(BITMAPINFOHEADER) - + sizeof(RGBQUAD) - * (1 << This->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount)); + b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(BITMAPINFOHEADER) + + sizeof(RGBQUAD) + * (1 << This->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount)); break; } @@ -255,7 +254,8 @@ This->surface_desc.dwFlags |= DDSD_LPSURFACE; - if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) { + /* Ensure that DDSD_PITCH is respected for DDPF_FOURCC surfaces too */ + if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC && !(This->surface_desc.dwFlags & DDSD_PITCH)) { This->surface_desc.lpSurface = VirtualAlloc(NULL, This->surface_desc.u1.dwLinearSize, MEM_COMMIT, PAGE_READWRITE); This->surface_desc.dwFlags |= DDSD_LINEARSIZE; @@ -528,9 +528,15 @@ DD_STRUCT_INIT(&sdesc); sdesc.dwSize = sizeof(sdesc); - if (src) IDirectDrawSurface7_Lock(src, NULL, &sdesc, DDLOCK_READONLY, 0); ddesc.dwSize = sizeof(ddesc); - IDirectDrawSurface7_Lock(iface,NULL,&ddesc,DDLOCK_WRITEONLY,0); + + if (src == iface) { + IDirectDrawSurface7_Lock(iface, NULL, &ddesc, 0, 0); + DD_STRUCT_COPY_BYSIZE(&sdesc, &ddesc); + } else { + if (src) IDirectDrawSurface7_Lock(src, NULL, &sdesc, DDLOCK_READONLY, 0); + IDirectDrawSurface7_Lock(iface,NULL,&ddesc,DDLOCK_WRITEONLY,0); + } if ((sdesc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) && (ddesc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC)) { @@ -581,7 +587,8 @@ (xsrc.right > sdesc.dwWidth) || (xsrc.right < 0) || (xsrc.right < xsrc.left) || (xsrc.bottom < xsrc.top))) { WARN("Application gave us bad source rectangle for Blt.\n"); - return DDERR_INVALIDRECT; + ret = DDERR_INVALIDRECT; + goto release; } /* For the Destination rect, it can be out of bounds on the condition that a clipper is set for the given surface. @@ -593,7 +600,8 @@ (xdst.right > ddesc.dwWidth) || (xdst.right < 0) || (xdst.right < xdst.left) || (xdst.bottom < xdst.top))) { WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n"); - return DDERR_INVALIDRECT; + ret = DDERR_INVALIDRECT; + goto release; } /* Now handle negative values in the rectangles. Warning: only supported for now @@ -958,8 +966,8 @@ release: IDirectDrawSurface7_Unlock(iface,NULL); - if (src) IDirectDrawSurface7_Unlock(src,NULL); - return DD_OK; + if (src && src != iface) IDirectDrawSurface7_Unlock(src,NULL); + return ret; } /* BltBatch: generic, unimplemented */ @@ -975,7 +983,7 @@ HRESULT ret = DD_OK; LPBYTE sbuf, dbuf; RECT rsrc2; - RECT lock_src, lock_dst; + RECT lock_src, lock_dst, lock_union; if (TRACE_ON(ddraw)) { TRACE("(%p)->(%ld,%ld,%p,%p,%08lx)\n", @@ -1043,11 +1051,28 @@ lock_dst.right = dstx + w; lock_dst.bottom = dsty + h; + bpp = GET_BPP(This->surface_desc); + /* We need to lock the surfaces, or we won't get refreshes when done. */ - sdesc.dwSize = sizeof(sdesc); - IDirectDrawSurface7_Lock(src, &lock_src, &sdesc, DDLOCK_READONLY, 0); - ddesc.dwSize = sizeof(ddesc); - IDirectDrawSurface7_Lock(iface, &lock_dst, &ddesc, DDLOCK_WRITEONLY, 0); + if (src == iface) { + int pitch; + + UnionRect(&lock_union, &lock_src, &lock_dst); + + /* Lock the union of the two rectangles */ + IDirectDrawSurface7_Lock(iface, &lock_union, &ddesc, 0, 0); + + pitch = This->surface_desc.u1.lPitch; + + /* Since sdesc was originally copied from this surface's description, we can just reuse it */ + sdesc.lpSurface = (BYTE *)This->surface_desc.lpSurface + lock_src.top * pitch + lock_src.left * bpp; + ddesc.lpSurface = (BYTE *)This->surface_desc.lpSurface + lock_dst.top * pitch + lock_dst.left * bpp; + } else { + sdesc.dwSize = sizeof(sdesc); + IDirectDrawSurface7_Lock(src, &lock_src, &sdesc, DDLOCK_READONLY, 0); + ddesc.dwSize = sizeof(ddesc); + IDirectDrawSurface7_Lock(iface, &lock_dst, &ddesc, DDLOCK_WRITEONLY, 0); + } /* Handle first the FOURCC surfaces... */ if ((sdesc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) && (ddesc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC)) { @@ -1069,7 +1094,6 @@ goto error; } - bpp = GET_BPP(This->surface_desc); sbuf = (BYTE *) sdesc.lpSurface; dbuf = (BYTE *) ddesc.lpSurface; @@ -1141,8 +1165,13 @@ } error: - IDirectDrawSurface7_Unlock(iface, &lock_dst); - IDirectDrawSurface7_Unlock(src, &lock_src); + if (src == iface) { + IDirectDrawSurface7_Unlock(iface, &lock_union); + } else { + IDirectDrawSurface7_Unlock(iface, &lock_dst); + IDirectDrawSurface7_Unlock(src, &lock_src); + } + return ret; } diff -urN wine-20050310/dlls/ddraw/mesa_private.h wine-20050419/dlls/ddraw/mesa_private.h --- wine-20050310/dlls/ddraw/mesa_private.h 2005-02-14 12:09:47.000000000 +0100 +++ wine-20050419/dlls/ddraw/mesa_private.h 2005-04-11 14:51:22.000000000 +0200 @@ -63,7 +63,8 @@ { GLuint tex_name; BOOLEAN loaded; /* For the moment, this is here.. Should be part of surface management though */ - + IDirectDrawSurfaceImpl *main; /* Pointer to the 'main' surface of the mip-map set */ + /* Texture upload management */ BOOLEAN initial_upload_done; SURFACE_STATE dirty_flag; @@ -202,6 +203,9 @@ /* Used to upload the texture */ extern HRESULT gltex_upload_texture(IDirectDrawSurfaceImpl *This, IDirect3DDeviceImpl *d3ddev, DWORD stage) ; +/* Used to get the texture name */ +extern GLuint gltex_get_tex_name(IDirectDrawSurfaceImpl *This) ; + /* Used to set-up our orthographic projection */ extern void d3ddevice_set_ortho(IDirect3DDeviceImpl *This) ; diff -urN wine-20050310/dlls/ddraw/tests/ddrawmodes.c wine-20050419/dlls/ddraw/tests/ddrawmodes.c --- wine-20050310/dlls/ddraw/tests/ddrawmodes.c 2004-02-16 21:23:58.000000000 +0100 +++ wine-20050419/dlls/ddraw/tests/ddrawmodes.c 2005-03-16 20:49:25.000000000 +0100 @@ -118,7 +118,7 @@ rc = IDirectDraw_EnumDisplayModes(lpDD, DDEDM_STANDARDVGAMODES, &ddsd, 0, enummodescallback); - ok(rc==DD_OK,"EnumDisplayModes returned: %lx\n",rc); + ok(rc==DD_OK || rc==E_INVALIDARG,"EnumDisplayModes returned: %lx\n",rc); } static void setdisplaymode(int i) @@ -135,10 +135,11 @@ rc = IDirectDraw_SetDisplayMode(lpDD, modes[i].dwWidth, modes[i].dwHeight, modes[i].ddpfPixelFormat.UNION_MEMBER(1, dwRGBBitCount)); - ok(rc==DD_OK,"SetDisplayMode returned: %lx\n",rc); - rc = IDirectDraw_RestoreDisplayMode(lpDD); - ok(rc==DD_OK,"RestoreDisplayMode returned: %lx\n",rc); - + ok(DD_OK==rc || DDERR_UNSUPPORTED==rc,"SetDisplayMode returned: %lx\n",rc); + if (DD_OK==rc) { + rc = IDirectDraw_RestoreDisplayMode(lpDD); + ok(DD_OK==rc,"RestoreDisplayMode returned: %lx\n",rc); + } } } } diff -urN wine-20050310/dlls/devenum/parsedisplayname.c wine-20050419/dlls/devenum/parsedisplayname.c --- wine-20050310/dlls/devenum/parsedisplayname.c 2004-12-07 15:37:11.000000000 +0100 +++ wine-20050419/dlls/devenum/parsedisplayname.c 2005-04-18 12:30:56.000000000 +0200 @@ -94,6 +94,7 @@ MediaCatMoniker * pMoniker = NULL; CLSID clsidDevice; HRESULT res = S_OK; + int classlen; TRACE("(%p, %s, %p, %p)\n", pbc, debugstr_w(pszDisplayName), pchEaten, ppmkOut); @@ -107,12 +108,13 @@ /* size = pszBetween - pszDisplayName - 1 (for '\\' after CLSID) * + 1 (for NULL character) */ - pszClass = CoTaskMemAlloc((int)(pszBetween - pszDisplayName) * sizeof(WCHAR)); + classlen = (int)(pszBetween - pszDisplayName - 1); + pszClass = CoTaskMemAlloc((classlen + 1) * sizeof(WCHAR)); if (!pszClass) return E_OUTOFMEMORY; - strncpyW(pszClass, pszDisplayName, (int)(pszBetween - pszDisplayName) - 1); - pszClass[(int)(pszBetween - pszDisplayName) - 1] = 0; + memcpy(pszClass, pszDisplayName, classlen * sizeof(WCHAR)); + pszClass[classlen] = 0; TRACE("Device CLSID: %s\n", debugstr_w(pszClass)); diff -urN wine-20050310/dlls/dinput/data_formats.c wine-20050419/dlls/dinput/data_formats.c --- wine-20050310/dlls/dinput/data_formats.c 2004-09-03 19:27:58.000000000 +0200 +++ wine-20050419/dlls/dinput/data_formats.c 2005-04-18 16:53:27.000000000 +0200 @@ -16,10 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* TODO: - * add keyboard - */ - #include #include "windef.h" @@ -27,7 +23,7 @@ #define numObjects(x) (sizeof(x) / sizeof(x[0])) -DIOBJECTDATAFORMAT dfDIJoystick[] = { +static const DIOBJECTDATAFORMAT dfDIJoystick[] = { { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, @@ -80,10 +76,10 @@ DIDF_ABSAXIS, sizeof(DIJOYSTATE2), numObjects(dfDIJoystick), - dfDIJoystick + (LPDIOBJECTDATAFORMAT)dfDIJoystick }; -DIOBJECTDATAFORMAT dfDIJoystick2[] = { +static const DIOBJECTDATAFORMAT dfDIJoystick2[] = { { &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, { &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, { &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0}, @@ -256,10 +252,10 @@ DIDF_ABSAXIS, sizeof(DIJOYSTATE2), numObjects(dfDIJoystick2), - dfDIJoystick2 + (LPDIOBJECTDATAFORMAT)dfDIJoystick2 }; -DIOBJECTDATAFORMAT dfDIMouse[] = { +static const DIOBJECTDATAFORMAT dfDIMouse[] = { { &GUID_XAxis, DIMOFS_X, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, { &GUID_YAxis, DIMOFS_Y, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, { &GUID_ZAxis, DIMOFS_Z, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, @@ -275,10 +271,10 @@ DIDF_RELAXIS, sizeof(DIMOUSESTATE), numObjects(dfDIMouse), - dfDIMouse + (LPDIOBJECTDATAFORMAT)dfDIMouse }; -DIOBJECTDATAFORMAT dfDIMouse2[] = { +static const DIOBJECTDATAFORMAT dfDIMouse2[] = { { &GUID_XAxis, DIMOFS_X, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, { &GUID_YAxis, DIMOFS_Y, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, { &GUID_ZAxis, DIMOFS_Z, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 }, @@ -298,5 +294,273 @@ DIDF_RELAXIS, sizeof(DIMOUSESTATE2), numObjects(dfDIMouse2), - dfDIMouse2 + (LPDIOBJECTDATAFORMAT)dfDIMouse2 +}; + +static const DIOBJECTDATAFORMAT dfDIKeyboard[] = { + { &GUID_Key,0,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(0),0}, + { &GUID_Key,1,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(1),0}, + { &GUID_Key,2,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(2),0}, + { &GUID_Key,3,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(3),0}, + { &GUID_Key,4,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(4),0}, + { &GUID_Key,5,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(5),0}, + { &GUID_Key,6,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(6),0}, + { &GUID_Key,7,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(7),0}, + { &GUID_Key,8,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(8),0}, + { &GUID_Key,9,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(9),0}, + { &GUID_Key,10,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(10),0}, + { &GUID_Key,11,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(11),0}, + { &GUID_Key,12,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(12),0}, + { &GUID_Key,13,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(13),0}, + { &GUID_Key,14,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(14),0}, + { &GUID_Key,15,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(15),0}, + { &GUID_Key,16,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(16),0}, + { &GUID_Key,17,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(17),0}, + { &GUID_Key,18,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(18),0}, + { &GUID_Key,19,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(19),0}, + { &GUID_Key,20,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(20),0}, + { &GUID_Key,21,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(21),0}, + { &GUID_Key,22,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(22),0}, + { &GUID_Key,23,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(23),0}, + { &GUID_Key,24,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(24),0}, + { &GUID_Key,25,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(25),0}, + { &GUID_Key,26,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(26),0}, + { &GUID_Key,27,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(27),0}, + { &GUID_Key,28,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(28),0}, + { &GUID_Key,29,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(29),0}, + { &GUID_Key,30,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(30),0}, + { &GUID_Key,31,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(31),0}, + { &GUID_Key,32,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(32),0}, + { &GUID_Key,33,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(33),0}, + { &GUID_Key,34,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(34),0}, + { &GUID_Key,35,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(35),0}, + { &GUID_Key,36,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(36),0}, + { &GUID_Key,37,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(37),0}, + { &GUID_Key,38,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(38),0}, + { &GUID_Key,39,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(39),0}, + { &GUID_Key,40,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(40),0}, + { &GUID_Key,41,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(41),0}, + { &GUID_Key,42,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(42),0}, + { &GUID_Key,43,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(43),0}, + { &GUID_Key,44,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(44),0}, + { &GUID_Key,45,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(45),0}, + { &GUID_Key,46,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(46),0}, + { &GUID_Key,47,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(47),0}, + { &GUID_Key,48,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(48),0}, + { &GUID_Key,49,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(49),0}, + { &GUID_Key,50,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(50),0}, + { &GUID_Key,51,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(51),0}, + { &GUID_Key,52,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(52),0}, + { &GUID_Key,53,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(53),0}, + { &GUID_Key,54,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(54),0}, + { &GUID_Key,55,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(55),0}, + { &GUID_Key,56,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(56),0}, + { &GUID_Key,57,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(57),0}, + { &GUID_Key,58,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(58),0}, + { &GUID_Key,59,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(59),0}, + { &GUID_Key,60,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(60),0}, + { &GUID_Key,61,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(61),0}, + { &GUID_Key,62,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(62),0}, + { &GUID_Key,63,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(63),0}, + { &GUID_Key,64,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(64),0}, + { &GUID_Key,65,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(65),0}, + { &GUID_Key,66,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(66),0}, + { &GUID_Key,67,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(67),0}, + { &GUID_Key,68,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(68),0}, + { &GUID_Key,69,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(69),0}, + { &GUID_Key,70,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(70),0}, + { &GUID_Key,71,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(71),0}, + { &GUID_Key,72,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(72),0}, + { &GUID_Key,73,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(73),0}, + { &GUID_Key,74,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(74),0}, + { &GUID_Key,75,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(75),0}, + { &GUID_Key,76,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(76),0}, + { &GUID_Key,77,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(77),0}, + { &GUID_Key,78,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(78),0}, + { &GUID_Key,79,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(79),0}, + { &GUID_Key,80,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(80),0}, + { &GUID_Key,81,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(81),0}, + { &GUID_Key,82,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(82),0}, + { &GUID_Key,83,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(83),0}, + { &GUID_Key,84,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(84),0}, + { &GUID_Key,85,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(85),0}, + { &GUID_Key,86,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(86),0}, + { &GUID_Key,87,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(87),0}, + { &GUID_Key,88,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(88),0}, + { &GUID_Key,89,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(89),0}, + { &GUID_Key,90,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(90),0}, + { &GUID_Key,91,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(91),0}, + { &GUID_Key,92,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(92),0}, + { &GUID_Key,93,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(93),0}, + { &GUID_Key,94,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(94),0}, + { &GUID_Key,95,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(95),0}, + { &GUID_Key,96,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(96),0}, + { &GUID_Key,97,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(97),0}, + { &GUID_Key,98,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(98),0}, + { &GUID_Key,99,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(99),0}, + { &GUID_Key,100,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(100),0}, + { &GUID_Key,101,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(101),0}, + { &GUID_Key,102,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(102),0}, + { &GUID_Key,103,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(103),0}, + { &GUID_Key,104,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(104),0}, + { &GUID_Key,105,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(105),0}, + { &GUID_Key,106,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(106),0}, + { &GUID_Key,107,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(107),0}, + { &GUID_Key,108,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(108),0}, + { &GUID_Key,109,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(109),0}, + { &GUID_Key,110,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(110),0}, + { &GUID_Key,111,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(111),0}, + { &GUID_Key,112,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(112),0}, + { &GUID_Key,113,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(113),0}, + { &GUID_Key,114,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(114),0}, + { &GUID_Key,115,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(115),0}, + { &GUID_Key,116,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(116),0}, + { &GUID_Key,117,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(117),0}, + { &GUID_Key,118,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(118),0}, + { &GUID_Key,119,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(119),0}, + { &GUID_Key,120,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(120),0}, + { &GUID_Key,121,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(121),0}, + { &GUID_Key,122,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(122),0}, + { &GUID_Key,123,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(123),0}, + { &GUID_Key,124,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(124),0}, + { &GUID_Key,125,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(125),0}, + { &GUID_Key,126,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(126),0}, + { &GUID_Key,127,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(127),0}, + { &GUID_Key,128,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(128),0}, + { &GUID_Key,129,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(129),0}, + { &GUID_Key,130,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(130),0}, + { &GUID_Key,131,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(131),0}, + { &GUID_Key,132,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(132),0}, + { &GUID_Key,133,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(133),0}, + { &GUID_Key,134,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(134),0}, + { &GUID_Key,135,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(135),0}, + { &GUID_Key,136,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(136),0}, + { &GUID_Key,137,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(137),0}, + { &GUID_Key,138,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(138),0}, + { &GUID_Key,139,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(139),0}, + { &GUID_Key,140,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(140),0}, + { &GUID_Key,141,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(141),0}, + { &GUID_Key,142,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(142),0}, + { &GUID_Key,143,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(143),0}, + { &GUID_Key,144,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(144),0}, + { &GUID_Key,145,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(145),0}, + { &GUID_Key,146,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(146),0}, + { &GUID_Key,147,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(147),0}, + { &GUID_Key,148,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(148),0}, + { &GUID_Key,149,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(149),0}, + { &GUID_Key,150,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(150),0}, + { &GUID_Key,151,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(151),0}, + { &GUID_Key,152,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(152),0}, + { &GUID_Key,153,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(153),0}, + { &GUID_Key,154,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(154),0}, + { &GUID_Key,155,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(155),0}, + { &GUID_Key,156,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(156),0}, + { &GUID_Key,157,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(157),0}, + { &GUID_Key,158,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(158),0}, + { &GUID_Key,159,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(159),0}, + { &GUID_Key,160,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(160),0}, + { &GUID_Key,161,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(161),0}, + { &GUID_Key,162,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(162),0}, + { &GUID_Key,163,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(163),0}, + { &GUID_Key,164,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(164),0}, + { &GUID_Key,165,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(165),0}, + { &GUID_Key,166,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(166),0}, + { &GUID_Key,167,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(167),0}, + { &GUID_Key,168,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(168),0}, + { &GUID_Key,169,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(169),0}, + { &GUID_Key,170,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(170),0}, + { &GUID_Key,171,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(171),0}, + { &GUID_Key,172,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(172),0}, + { &GUID_Key,173,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(173),0}, + { &GUID_Key,174,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(174),0}, + { &GUID_Key,175,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(175),0}, + { &GUID_Key,176,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(176),0}, + { &GUID_Key,177,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(177),0}, + { &GUID_Key,178,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(178),0}, + { &GUID_Key,179,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(179),0}, + { &GUID_Key,180,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(180),0}, + { &GUID_Key,181,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(181),0}, + { &GUID_Key,182,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(182),0}, + { &GUID_Key,183,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(183),0}, + { &GUID_Key,184,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(184),0}, + { &GUID_Key,185,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(185),0}, + { &GUID_Key,186,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(186),0}, + { &GUID_Key,187,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(187),0}, + { &GUID_Key,188,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(188),0}, + { &GUID_Key,189,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(189),0}, + { &GUID_Key,190,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(190),0}, + { &GUID_Key,191,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(191),0}, + { &GUID_Key,192,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(192),0}, + { &GUID_Key,193,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(193),0}, + { &GUID_Key,194,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(194),0}, + { &GUID_Key,195,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(195),0}, + { &GUID_Key,196,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(196),0}, + { &GUID_Key,197,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(197),0}, + { &GUID_Key,198,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(198),0}, + { &GUID_Key,199,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(199),0}, + { &GUID_Key,200,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(200),0}, + { &GUID_Key,201,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(201),0}, + { &GUID_Key,202,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(202),0}, + { &GUID_Key,203,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(203),0}, + { &GUID_Key,204,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(204),0}, + { &GUID_Key,205,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(205),0}, + { &GUID_Key,206,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(206),0}, + { &GUID_Key,207,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(207),0}, + { &GUID_Key,208,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(208),0}, + { &GUID_Key,209,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(209),0}, + { &GUID_Key,210,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(210),0}, + { &GUID_Key,211,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(211),0}, + { &GUID_Key,212,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(212),0}, + { &GUID_Key,213,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(213),0}, + { &GUID_Key,214,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(214),0}, + { &GUID_Key,215,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(215),0}, + { &GUID_Key,216,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(216),0}, + { &GUID_Key,217,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(217),0}, + { &GUID_Key,218,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(218),0}, + { &GUID_Key,219,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(219),0}, + { &GUID_Key,220,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(220),0}, + { &GUID_Key,221,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(221),0}, + { &GUID_Key,222,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(222),0}, + { &GUID_Key,223,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(223),0}, + { &GUID_Key,224,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(224),0}, + { &GUID_Key,225,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(225),0}, + { &GUID_Key,226,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(226),0}, + { &GUID_Key,227,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(227),0}, + { &GUID_Key,228,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(228),0}, + { &GUID_Key,229,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(229),0}, + { &GUID_Key,230,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(230),0}, + { &GUID_Key,231,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(231),0}, + { &GUID_Key,232,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(232),0}, + { &GUID_Key,233,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(233),0}, + { &GUID_Key,234,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(234),0}, + { &GUID_Key,235,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(235),0}, + { &GUID_Key,236,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(236),0}, + { &GUID_Key,237,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(237),0}, + { &GUID_Key,238,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(238),0}, + { &GUID_Key,239,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(239),0}, + { &GUID_Key,240,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(240),0}, + { &GUID_Key,241,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(241),0}, + { &GUID_Key,242,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(242),0}, + { &GUID_Key,243,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(243),0}, + { &GUID_Key,244,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(244),0}, + { &GUID_Key,245,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(245),0}, + { &GUID_Key,246,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(246),0}, + { &GUID_Key,247,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(247),0}, + { &GUID_Key,248,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(248),0}, + { &GUID_Key,249,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(249),0}, + { &GUID_Key,250,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(250),0}, + { &GUID_Key,251,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(251),0}, + { &GUID_Key,252,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(252),0}, + { &GUID_Key,253,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(253),0}, + { &GUID_Key,254,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(254),0}, + { &GUID_Key,255,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(255),0} +}; + +const DIDATAFORMAT c_dfDIKeyboard = { + sizeof(DIDATAFORMAT), + sizeof(DIOBJECTDATAFORMAT), + DIDF_RELAXIS, + 256, + numObjects(dfDIKeyboard), + (LPDIOBJECTDATAFORMAT)dfDIKeyboard }; diff -urN wine-20050310/dlls/dinput/device.c wine-20050419/dlls/dinput/device.c --- wine-20050310/dlls/dinput/device.c 2005-02-08 13:11:12.000000000 +0100 +++ wine-20050419/dlls/dinput/device.c 2005-03-24 22:01:39.000000000 +0100 @@ -290,12 +290,12 @@ int index = 0; DWORD next = 0; - ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); - done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs); + done = HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs); memset(done, 0, sizeof(int) * asked_format->dwNumObjs); - dt = (DataTransform *) HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform)); + dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform)); TRACE("Creating DataTransform : \n"); diff -urN wine-20050310/dlls/dinput/dinput_main.c wine-20050419/dlls/dinput/dinput_main.c --- wine-20050310/dlls/dinput/dinput_main.c 2005-01-24 12:29:44.000000000 +0100 +++ wine-20050419/dlls/dinput/dinput_main.c 2005-03-24 22:01:39.000000000 +0100 @@ -51,10 +51,14 @@ static IDirectInput8AVtbl ddi8avt; static IDirectInput8WVtbl ddi8wvt; -/* This array will be filled a dinput.so loading */ -#define MAX_WINE_DINPUT_DEVICES 4 -static dinput_device * dinput_devices[MAX_WINE_DINPUT_DEVICES]; -static int nrof_dinput_devices = 0; +static const struct dinput_device *dinput_devices[] = +{ + &mouse_device, + &keyboard_device, + &joystick_linuxinput_device, + &joystick_linux_device +}; +#define NB_DINPUT_DEVICES (sizeof(dinput_devices)/sizeof(dinput_devices[0])) HINSTANCE DINPUT_instance = NULL; @@ -73,29 +77,6 @@ } -/* register a direct draw driver. We better not use malloc for we are in - * the ELF startup initialisation at this point. - */ -void dinput_register_device(dinput_device *device) { - int i; - - /* insert according to priority */ - for (i=0;ipref <= device->pref) { - memcpy(dinput_devices+i+1,dinput_devices+i,sizeof(dinput_devices[0])*(nrof_dinput_devices-i)); - dinput_devices[i] = device; - break; - } - } - if (i==nrof_dinput_devices) /* not found, or too low priority */ - dinput_devices[nrof_dinput_devices] = device; - - nrof_dinput_devices++; - - /* increase MAX_DDRAW_DRIVERS if the line below triggers */ - assert(nrof_dinput_devices <= MAX_WINE_DINPUT_DEVICES); -} - /****************************************************************************** * DirectInputCreateEx (DINPUT.@) */ @@ -110,7 +91,7 @@ if (IsEqualGUID(&IID_IDirectInputA,riid) || IsEqualGUID(&IID_IDirectInput2A,riid) || IsEqualGUID(&IID_IDirectInput7A,riid)) { - This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); This->lpVtbl = &ddi7avt; This->ref = 1; This->version = 1; @@ -122,7 +103,7 @@ if (IsEqualGUID(&IID_IDirectInputW,riid) || IsEqualGUID(&IID_IDirectInput2W,riid) || IsEqualGUID(&IID_IDirectInput7W,riid)) { - This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); This->lpVtbl = &ddi7wvt; This->ref = 1; This->version = 1; @@ -132,7 +113,7 @@ } if (IsEqualGUID(&IID_IDirectInput8A,riid)) { - This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); This->lpVtbl = &ddi8avt; This->ref = 1; This->version = 8; @@ -142,7 +123,7 @@ } if (IsEqualGUID(&IID_IDirectInput8W,riid)) { - This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); This->lpVtbl = &ddi8wvt; This->ref = 1; This->version = 8; @@ -161,7 +142,7 @@ { IDirectInputImpl* This; TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter); - This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); This->lpVtbl = &ddi7avt; This->ref = 1; if (dwVersion >= 0x0800) { @@ -182,7 +163,7 @@ { IDirectInputImpl* This; TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter); - This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); + This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl)); This->lpVtbl = &ddi7wvt; This->ref = 1; if (dwVersion >= 0x0800) { @@ -247,7 +228,8 @@ lpCallback, pvRef, dwFlags); TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n"); - for (i = 0; i < nrof_dinput_devices; i++) { + for (i = 0; i < NB_DINPUT_DEVICES; i++) { + if (!dinput_devices[i]->enum_deviceA) continue; for (j = 0, r = -1; r != 0; j++) { devInstance.dwSize = sizeof(devInstance); TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name); @@ -276,7 +258,8 @@ lpCallback, pvRef, dwFlags); TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n"); - for (i = 0; i < nrof_dinput_devices; i++) { + for (i = 0; i < NB_DINPUT_DEVICES; i++) { + if (!dinput_devices[i]->enum_deviceW) continue; for (j = 0, r = -1; r != 0; j++) { devInstance.dwSize = sizeof(devInstance); TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name); @@ -349,8 +332,9 @@ TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk); /* Loop on all the devices to see if anyone matches the given GUID */ - for (i = 0; i < nrof_dinput_devices; i++) { + for (i = 0; i < NB_DINPUT_DEVICES; i++) { HRESULT ret; + if (!dinput_devices[i]->create_deviceA) continue; if ((ret = dinput_devices[i]->create_deviceA(This, rguid, NULL, pdev)) == DI_OK) return DI_OK; @@ -370,8 +354,9 @@ TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk); /* Loop on all the devices to see if anyone matches the given GUID */ - for (i = 0; i < nrof_dinput_devices; i++) { + for (i = 0; i < NB_DINPUT_DEVICES; i++) { HRESULT ret; + if (!dinput_devices[i]->create_deviceW) continue; if ((ret = dinput_devices[i]->create_deviceW(This, rguid, NULL, pdev)) == DI_OK) return DI_OK; @@ -430,8 +415,9 @@ TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter); /* Loop on all the devices to see if anyone matches the given GUID */ - for (i = 0; i < nrof_dinput_devices; i++) { + for (i = 0; i < NB_DINPUT_DEVICES; i++) { HRESULT ret; + if (!dinput_devices[i]->create_deviceA) continue; if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK) return DI_OK; @@ -452,8 +438,9 @@ TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter); /* Loop on all the devices to see if anyone matches the given GUID */ - for (i = 0; i < nrof_dinput_devices; i++) { + for (i = 0; i < NB_DINPUT_DEVICES; i++) { HRESULT ret; + if (!dinput_devices[i]->create_deviceW) continue; if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK) return DI_OK; diff -urN wine-20050310/dlls/dinput/dinput_private.h wine-20050419/dlls/dinput/dinput_private.h --- wine-20050310/dlls/dinput/dinput_private.h 2004-09-13 21:16:47.000000000 +0200 +++ wine-20050419/dlls/dinput/dinput_private.h 2005-03-15 20:36:15.000000000 +0100 @@ -39,16 +39,18 @@ }; /* Function called by all devices that Wine supports */ -typedef struct dinput_device { - INT pref; +struct dinput_device { const char *name; BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id); BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id); HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev); HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev); -} dinput_device; +}; -extern void dinput_register_device(dinput_device *device); +extern const struct dinput_device mouse_device; +extern const struct dinput_device keyboard_device; +extern const struct dinput_device joystick_linux_device; +extern const struct dinput_device joystick_linuxinput_device; extern HINSTANCE DINPUT_instance; diff -urN wine-20050310/dlls/dinput/joystick_linux.c wine-20050419/dlls/dinput/joystick_linux.c --- wine-20050310/dlls/dinput/joystick_linux.c 2005-01-25 21:05:12.000000000 +0100 +++ wine-20050419/dlls/dinput/joystick_linux.c 2005-03-15 20:36:15.000000000 +0100 @@ -28,8 +28,6 @@ #include "config.h" #include "wine/port.h" -#ifdef HAVE_LINUX_22_JOYSTICK_API - #include #include #include @@ -55,7 +53,6 @@ #ifdef HAVE_LINUX_JOYSTICK_H # include #endif -#define JOYDEV "/dev/js" #include "wine/debug.h" #include "wine/unicode.h" @@ -70,6 +67,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); +#ifdef HAVE_LINUX_22_JOYSTICK_API + +#define JOYDEV "/dev/js" + typedef struct { LONG lMin; LONG lMax; @@ -646,8 +647,7 @@ return DIERR_DEVICENOTREG; } -static dinput_device joydev = { - 10, +const struct dinput_device joystick_linux_device = { "Wine Linux joystick driver", joydev_enum_deviceA, joydev_enum_deviceW, @@ -655,8 +655,6 @@ joydev_create_deviceW }; -DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); } - /****************************************************************************** * Joystick */ @@ -1695,4 +1693,14 @@ }; #undef XCAST +#else /* HAVE_LINUX_22_JOYSTICK_API */ + +const struct dinput_device joystick_linux_device = { + "Wine Linux joystick driver", + NULL, + NULL, + NULL, + NULL +}; + #endif /* HAVE_LINUX_22_JOYSTICK_API */ diff -urN wine-20050310/dlls/dinput/joystick_linuxinput.c wine-20050419/dlls/dinput/joystick_linuxinput.c --- wine-20050310/dlls/dinput/joystick_linuxinput.c 2005-02-15 16:03:03.000000000 +0100 +++ wine-20050419/dlls/dinput/joystick_linuxinput.c 2005-03-18 11:25:15.000000000 +0100 @@ -22,8 +22,6 @@ #include "config.h" #include "wine/port.h" -#ifdef HAVE_LINUX_INPUT_H - #include #include #include @@ -43,16 +41,10 @@ #ifdef HAVE_SYS_ERRNO_H # include #endif - -#ifdef HAVE_CORRECT_LINUXINPUT_H - #ifdef HAVE_LINUX_INPUT_H # include #endif - -#define EVDEVPREFIX "/dev/input/event" - #include "wine/debug.h" #include "wine/unicode.h" #include "windef.h" @@ -65,6 +57,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); +#ifdef HAVE_CORRECT_LINUXINPUT_H + +#define EVDEVPREFIX "/dev/input/event" + /* Wine joystick driver object instances */ #define WINE_JOYSTICK_AXIS_BASE 0 #define WINE_JOYSTICK_BUTTON_BASE 8 @@ -322,8 +318,7 @@ return DIERR_DEVICENOTREG; } -static dinput_device joydev = { - 20, +const struct dinput_device joystick_linuxinput_device = { "Wine Linux-input joystick driver", joydev_enum_deviceA, joydev_enum_deviceW, @@ -331,8 +326,6 @@ joydev_create_deviceW }; -DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); } - /****************************************************************************** * Joystick */ @@ -1094,6 +1087,14 @@ }; #undef XCAST -#endif /* HAVE_LINUX_INPUT_H */ +#else /* HAVE_CORRECT_LINUXINPUT_H */ -#endif +const struct dinput_device joystick_linuxinput_device = { + "Wine Linux-input joystick driver", + NULL, + NULL, + NULL, + NULL +}; + +#endif /* HAVE_CORRECT_LINUXINPUT_H */ diff -urN wine-20050310/dlls/dinput/keyboard.c wine-20050419/dlls/dinput/keyboard.c --- wine-20050310/dlls/dinput/keyboard.c 2005-03-08 18:00:38.000000000 +0100 +++ wine-20050419/dlls/dinput/keyboard.c 2005-03-24 16:08:28.000000000 +0100 @@ -3,6 +3,7 @@ * Copyright 1998 Marcus Meissner * Copyright 1998,1999 Lionel Ulmer * Copyright 2000-2001 TransGaming Technologies Inc. + * Copyright 2005 Raphael Junqueira * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,6 +38,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dinput); +#define WINE_DINPUT_KEYBOARD_MAX_KEYS 256 + static IDirectInputDevice8AVtbl SysKeyboardAvt; static IDirectInputDevice8WVtbl SysKeyboardWvt; @@ -65,14 +68,15 @@ CRITICAL_SECTION crit; }; -SysKeyboardImpl *current; /* Today's acquired device -FIXME: currently this can be only one. -Maybe this should be a linked list or st. -I don't know what the rules are for multiple acquired keyboards, -but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason. +static SysKeyboardImpl* current_lock = NULL; +/* Today's acquired device + * FIXME: currently this can be only one. + * Maybe this should be a linked list or st. + * I don't know what the rules are for multiple acquired keyboards, + * but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason. */ -static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */ +static BYTE DInputKeyState[WINE_DINPUT_KEYBOARD_MAX_KEYS]; /* array for 'GetDeviceState' */ static CRITICAL_SECTION keyboard_crit; static CRITICAL_SECTION_DEBUG critsect_debug = @@ -83,64 +87,63 @@ }; static CRITICAL_SECTION keyboard_crit = { &critsect_debug, -1, 0, 0, 0, 0 }; -static DWORD keyboard_users; -static HHOOK keyboard_hook; +static DWORD keyboard_users = 0; +static HHOOK keyboard_hook = NULL; LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam ) { + BYTE dik_code; + BOOL down; + DWORD timestamp; + KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam; + BYTE new_diks; + TRACE("(%d,%d,%ld)\n", code, wparam, lparam); - if (code == HC_ACTION) - { - BYTE dik_code; - BOOL down; - DWORD timestamp; - - { - KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam; - dik_code = hook->scanCode; - if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80; - down = !(hook->flags & LLKHF_UP); - timestamp = hook->time; - } + /** returns now if not HC_ACTION */ + if (code != HC_ACTION) return CallNextHookEx(keyboard_hook, code, wparam, lparam); + + { + dik_code = hook->scanCode; + if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80; + down = !(hook->flags & LLKHF_UP); + timestamp = hook->time; + } + + /** returns now if key event already known */ + new_diks = (down ? 0x80 : 0); + /*if (new_diks != DInputKeyState[dik_code]) return CallNextHookEx(keyboard_hook, code, wparam, lparam); TO BE FIXED */ - DInputKeyState[dik_code] = (down ? 0x80 : 0); - TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]); + DInputKeyState[dik_code] = new_diks; + TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]); + + if (current_lock != NULL) { + if (current_lock->hEvent) SetEvent(current_lock->hEvent); + + if (current_lock->buffer != NULL) { + int n; + + EnterCriticalSection(&(current_lock->crit)); + + n = (current_lock->start + current_lock->count) % current_lock->buffersize; - if (current != NULL) - { - if (current->hEvent) - SetEvent(current->hEvent); - - if (current->buffer != NULL) - { - int n; - - EnterCriticalSection(&(current->crit)); - - n = (current->start + current->count) % current->buffersize; - - current->buffer[n].dwOfs = dik_code; - current->buffer[n].dwData = down ? 0x80 : 0; - current->buffer[n].dwTimeStamp = timestamp; - current->buffer[n].dwSequence = current->dinput->evsequence++; - - TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n, - current->buffer[n].dwOfs, current->buffer[n].dwData, current->buffer[n].dwTimeStamp, current->buffer[n].dwSequence); - - if (current->count == current->buffersize) - { - current->start = ++current->start % current->buffersize; - current->overflow = TRUE; - } - else - current->count++; - - LeaveCriticalSection(&(current->crit)); - } - } + current_lock->buffer[n].dwOfs = dik_code; + current_lock->buffer[n].dwData = down ? 0x80 : 0; + current_lock->buffer[n].dwTimeStamp = timestamp; + current_lock->buffer[n].dwSequence = current_lock->dinput->evsequence++; + + TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n, + current_lock->buffer[n].dwOfs, current_lock->buffer[n].dwData, current_lock->buffer[n].dwTimeStamp, current_lock->buffer[n].dwSequence); + + if (current_lock->count == current_lock->buffersize) { + current_lock->start = ++current_lock->start % current_lock->buffersize; + current_lock->overflow = TRUE; + } else + current_lock->count++; + + LeaveCriticalSection(&(current_lock->crit)); } - + } return CallNextHookEx(keyboard_hook, code, wparam, lparam); } @@ -238,15 +241,20 @@ static SysKeyboardImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputImpl *dinput) { SysKeyboardImpl* newDevice; + DWORD kbd_users; + newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl)); newDevice->lpVtbl = kvt; newDevice->ref = 1; memcpy(&(newDevice->guid),rguid,sizeof(*rguid)); newDevice->dinput = dinput; + InitializeCriticalSection(&(newDevice->crit)); EnterCriticalSection(&keyboard_crit); - if (!keyboard_users++) - keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 ); + kbd_users = InterlockedIncrement(&keyboard_users); + if (1 == kbd_users) { + keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 ); + } LeaveCriticalSection(&keyboard_crit); return newDevice; @@ -289,8 +297,7 @@ return DIERR_DEVICENOTREG; } -static dinput_device keyboarddev = { - 100, +const struct dinput_device keyboard_device = { "Wine keyboard driver", keyboarddev_enum_deviceA, keyboarddev_enum_deviceW, @@ -298,19 +305,19 @@ keyboarddev_create_deviceW }; -DECL_GLOBAL_CONSTRUCTOR(keyboarddev_register) { dinput_register_device(&keyboarddev); } - static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface) { SysKeyboardImpl *This = (SysKeyboardImpl *)iface; ULONG ref; + DWORD kbd_users; ref = InterlockedDecrement(&(This->ref)); if (ref) return ref; - EnterCriticalSection(&keyboard_crit); - if (!--keyboard_users) { + EnterCriticalSection(&keyboard_crit); + kbd_users = InterlockedDecrement(&keyboard_users); + if (0 == kbd_users) { UnhookWindowsHookEx( keyboard_hook ); keyboard_hook = 0; } @@ -391,24 +398,29 @@ LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr ) { - TRACE("(%p)->(%ld,%p)\n", iface, len, ptr); + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + TRACE("(%p)->(%ld,%p)\n", This, len, ptr); /* Note: device does not need to be acquired */ - if (len != 256) + if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS) return DIERR_INVALIDPARAM; MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0); + EnterCriticalSection(&(This->crit)); + if (TRACE_ON(dinput)) { int i; - for (i = 0; i < 256; i++) { + for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) { if (DInputKeyState[i] != 0x00) { TRACE(" - %02X: %02x\n", i, DInputKeyState[i]); } } } - memcpy(ptr, DInputKeyState, 256); + memcpy(ptr, DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS); + LeaveCriticalSection(&(This->crit)); + return DI_OK; } @@ -493,7 +505,7 @@ memset(&ddoi, 0, sizeof(ddoi)); ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce); - for (i = 0; i < 256; i++) { + for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) { /* Report 255 keys :-) */ ddoi.guidType = GUID_Key; ddoi.dwOfs = i; @@ -534,25 +546,24 @@ This->acquired = 1; - if (current != NULL) - { - FIXME("Not more than one keyboard can be acquired at the same time.\n"); - SysKeyboardAImpl_Unacquire(iface); - } - - current = This; + if (current_lock != NULL) { + FIXME("Not more than one keyboard can be acquired at the same time.\n"); + SysKeyboardAImpl_Unacquire(iface); + } + + current_lock = This; - if (This->buffersize > 0) - { - This->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - This->buffersize * sizeof(*(This->buffer))); - This->start = 0; - This->count = 0; - This->overflow = FALSE; - InitializeCriticalSection(&(This->crit)); - } - else + if (This->buffersize > 0) { + This->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + This->buffersize * sizeof(*(This->buffer))); + This->start = 0; + This->count = 0; + This->overflow = FALSE; + } else { This->buffer = NULL; + } + + /*keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 );*/ return DI_OK; } @@ -565,19 +576,19 @@ if (This->acquired == 0) return DI_NOEFFECT; - if (current == This) - current = NULL; + /* No more locks */ + if (current_lock == This) + current_lock = NULL; else - ERR("this != current\n"); + ERR("this != current_lock\n"); + /* Unacquire device */ This->acquired = 0; - if (This->buffersize >= 0) - { - HeapFree(GetProcessHeap(), 0, This->buffer); - This->buffer = NULL; - DeleteCriticalSection(&(This->crit)); - } + if (This->buffersize >= 0) { + HeapFree(GetProcessHeap(), 0, This->buffer); + This->buffer = NULL; + } return DI_OK; } @@ -616,7 +627,7 @@ else devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); devcaps.dwAxes = 0; - devcaps.dwButtons = 256; + devcaps.dwButtons = WINE_DINPUT_KEYBOARD_MAX_KEYS; devcaps.dwPOVs = 0; devcaps.dwFFSamplePeriod = 0; devcaps.dwFFMinTimeResolution = 0; @@ -712,7 +723,7 @@ TRACE("(this=%p,%p)\n", This, pdidi); if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) { - WARN(" dinput3 not supporte yet...\n"); + WARN(" dinput3 not supported yet...\n"); return DI_OK; } @@ -727,7 +738,7 @@ TRACE("(this=%p,%p)\n", This, pdidi); if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) { - WARN(" dinput3 not supporte yet...\n"); + WARN(" dinput3 not supported yet...\n"); return DI_OK; } diff -urN wine-20050310/dlls/dinput/mouse.c wine-20050419/dlls/dinput/mouse.c --- wine-20050310/dlls/dinput/mouse.c 2005-02-15 16:03:03.000000000 +0100 +++ wine-20050419/dlls/dinput/mouse.c 2005-03-24 22:01:39.000000000 +0100 @@ -259,7 +259,7 @@ /* Per default, Wine uses its internal data format */ newDevice->df = (DIDATAFORMAT *) &Wine_InternalMouseFormat; memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int)); - newDevice->wine_df = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); + newDevice->wine_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat)); newDevice->wine_df->size = 0; newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize; newDevice->wine_df->dt = NULL; @@ -305,8 +305,8 @@ return DIERR_DEVICENOTREG; } -static dinput_device mousedev = { - 100, + +const struct dinput_device mouse_device = { "Wine mouse driver", mousedev_enum_deviceA, mousedev_enum_deviceW, @@ -314,8 +314,6 @@ mousedev_create_deviceW }; -DECL_GLOBAL_CONSTRUCTOR(mousedev_register) { dinput_register_device(&mousedev); } - /****************************************************************************** * SysMouseA (DInput Mouse support) */ @@ -580,61 +578,61 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface) { SysMouseImpl *This = (SysMouseImpl *)iface; - RECT rect; + RECT rect; + POINT point; TRACE("(this=%p)\n",This); - if (This->acquired == 0) { - POINT point; - - /* Store (in a global variable) the current lock */ - current_lock = (IDirectInputDevice8A*)This; - - /* Init the mouse state */ - GetCursorPos( &point ); - if (This->absolute) { - This->m_state.lX = point.x; - This->m_state.lY = point.y; - This->prevX = point.x; - This->prevY = point.y; - } else { - This->m_state.lX = 0; - This->m_state.lY = 0; - This->org_coords = point; - } - This->m_state.lZ = 0; - This->m_state.rgbButtons[0] = ((GetKeyState(VK_LBUTTON) & 0x80) ? 0xFF : 0x00); - This->m_state.rgbButtons[1] = ((GetKeyState(VK_RBUTTON) & 0x80) ? 0xFF : 0x00); - This->m_state.rgbButtons[2] = ((GetKeyState(VK_MBUTTON) & 0x80) ? 0xFF : 0x00); - - /* Install our mouse hook */ - if (This->dwCoopLevel & DISCL_EXCLUSIVE) - ShowCursor(FALSE); /* hide cursor */ - This->hook = SetWindowsHookExA( WH_MOUSE_LL, dinput_mouse_hook, DINPUT_instance, 0 ); - - /* Get the window dimension and find the center */ - GetWindowRect(This->win, &rect); - This->win_centerX = (rect.right - rect.left) / 2; - This->win_centerY = (rect.bottom - rect.top ) / 2; - - /* Warp the mouse to the center of the window */ - if (This->absolute == 0) { - This->mapped_center.x = This->win_centerX; - This->mapped_center.y = This->win_centerY; - MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1); - TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); - SetCursorPos( This->mapped_center.x, This->mapped_center.y ); + if (This->acquired) + return S_FALSE; + + This->acquired = 1; + + /* Store (in a global variable) the current lock */ + current_lock = (IDirectInputDevice8A*)This; + + /* Init the mouse state */ + GetCursorPos( &point ); + if (This->absolute) { + This->m_state.lX = point.x; + This->m_state.lY = point.y; + This->prevX = point.x; + This->prevY = point.y; + } else { + This->m_state.lX = 0; + This->m_state.lY = 0; + This->org_coords = point; + } + This->m_state.lZ = 0; + This->m_state.rgbButtons[0] = ((GetKeyState(VK_LBUTTON) & 0x80) ? 0xFF : 0x00); + This->m_state.rgbButtons[1] = ((GetKeyState(VK_RBUTTON) & 0x80) ? 0xFF : 0x00); + This->m_state.rgbButtons[2] = ((GetKeyState(VK_MBUTTON) & 0x80) ? 0xFF : 0x00); + + /* Install our mouse hook */ + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(FALSE); /* hide cursor */ + This->hook = SetWindowsHookExA( WH_MOUSE_LL, dinput_mouse_hook, DINPUT_instance, 0 ); + + /* Get the window dimension and find the center */ + GetWindowRect(This->win, &rect); + This->win_centerX = (rect.right - rect.left) / 2; + This->win_centerY = (rect.bottom - rect.top ) / 2; + + /* Warp the mouse to the center of the window */ + if (This->absolute == 0) { + This->mapped_center.x = This->win_centerX; + This->mapped_center.y = This->win_centerY; + MapWindowPoints(This->win, HWND_DESKTOP, &This->mapped_center, 1); + TRACE("Warping mouse to %ld - %ld\n", This->mapped_center.x, This->mapped_center.y); + SetCursorPos( This->mapped_center.x, This->mapped_center.y ); #ifdef MOUSE_HACK - This->need_warp = WARP_DONE; + This->need_warp = WARP_DONE; #else - This->need_warp = WARP_STARTED; + This->need_warp = WARP_STARTED; #endif - } - - This->acquired = 1; - return DI_OK; } - return S_FALSE; + + return DI_OK; } /****************************************************************************** @@ -646,31 +644,34 @@ TRACE("(this=%p)\n",This); - if (This->acquired) { - /* Reinstall previous mouse event handler */ - if (This->hook) { - UnhookWindowsHookEx( This->hook ); - This->hook = 0; - - if (This->dwCoopLevel & DISCL_EXCLUSIVE) - ShowCursor(TRUE); /* show cursor */ - } - - /* No more locks */ - current_lock = NULL; - - /* Unacquire device */ - This->acquired = 0; - - /* And put the mouse cursor back where it was at acquire time */ - if (This->absolute == 0) { - TRACE(" warping mouse back to (%ld , %ld)\n", This->org_coords.x, This->org_coords.y); - SetCursorPos(This->org_coords.x, This->org_coords.y); - } - } else { + if (0 == This->acquired) { return DI_NOEFFECT; } + /* Reinstall previous mouse event handler */ + if (This->hook) { + UnhookWindowsHookEx( This->hook ); + This->hook = 0; + + if (This->dwCoopLevel & DISCL_EXCLUSIVE) + ShowCursor(TRUE); /* show cursor */ + } + + /* No more locks */ + if (current_lock == (IDirectInputDevice8A*) This) + current_lock = NULL; + else + ERR("this(%p) != current_lock(%p)\n", This, current_lock); + + /* Unacquire device */ + This->acquired = 0; + + /* And put the mouse cursor back where it was at acquire time */ + if (This->absolute == 0) { + TRACE(" warping mouse back to (%ld , %ld)\n", This->org_coords.x, This->org_coords.y); + SetCursorPos(This->org_coords.x, This->org_coords.y); + } + return DI_OK; } @@ -814,8 +815,7 @@ TRACE("buffersize = %ld\n",pd->dwData); - This->data_queue = (LPDIDEVICEOBJECTDATA)HeapAlloc(GetProcessHeap(),0, - pd->dwData * sizeof(DIDEVICEOBJECTDATA)); + This->data_queue = HeapAlloc(GetProcessHeap(),0, pd->dwData * sizeof(DIDEVICEOBJECTDATA)); This->queue_head = 0; This->queue_tail = 0; This->queue_len = pd->dwData; diff -urN wine-20050310/dlls/dmband/band.c wine-20050419/dlls/dmband/band.c --- wine-20050310/dlls/dmband/band.c 2005-01-31 21:40:44.000000000 +0100 +++ wine-20050419/dlls/dmband/band.c 2005-04-18 12:30:56.000000000 +0200 @@ -163,11 +163,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) @@ -384,7 +384,7 @@ IDirectMusicObject* pObject = NULL; if (pChunk->fccID != DMUS_FOURCC_INSTRUMENT_LIST) { - ERR_(dmfile)(": %s chunk should be a INSTRUMENT list\n", debugstr_fourcc (pChunk->fccID)); + ERR_(dmfile)(": %s chunk should be an INSTRUMENT list\n", debugstr_fourcc (pChunk->fccID)); return E_FAIL; } @@ -482,7 +482,7 @@ LARGE_INTEGER liMove; /* used when skipping chunks */ if (pChunk->fccID != DMUS_FOURCC_INSTRUMENTS_LIST) { - ERR_(dmfile)(": %s chunk should be a INSTRUMENTS list\n", debugstr_fourcc (pChunk->fccID)); + ERR_(dmfile)(": %s chunk should be an INSTRUMENTS list\n", debugstr_fourcc (pChunk->fccID)); return E_FAIL; } diff -urN wine-20050310/dlls/dmcompos/chordmap.c wine-20050419/dlls/dmcompos/chordmap.c --- wine-20050310/dlls/dmcompos/chordmap.c 2005-01-12 20:26:42.000000000 +0100 +++ wine-20050419/dlls/dmcompos/chordmap.c 2005-04-18 12:30:56.000000000 +0200 @@ -147,11 +147,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dmime/audiopath.c wine-20050419/dlls/dmime/audiopath.c --- wine-20050310/dlls/dmime/audiopath.c 2005-02-02 10:31:07.000000000 +0100 +++ wine-20050419/dlls/dmime/audiopath.c 2005-04-18 12:30:56.000000000 +0200 @@ -262,11 +262,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dmime/graph.c wine-20050419/dlls/dmime/graph.c --- wine-20050310/dlls/dmime/graph.c 2005-02-02 10:31:07.000000000 +0100 +++ wine-20050419/dlls/dmime/graph.c 2005-04-18 12:30:56.000000000 +0200 @@ -228,11 +228,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dmime/segment.c wine-20050419/dlls/dmime/segment.c --- wine-20050310/dlls/dmime/segment.c 2005-02-02 10:31:07.000000000 +0100 +++ wine-20050419/dlls/dmime/segment.c 2005-04-18 12:30:56.000000000 +0200 @@ -548,11 +548,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dmloader/container.c wine-20050419/dlls/dmloader/container.c --- wine-20050310/dlls/dmloader/container.c 2005-01-09 17:42:53.000000000 +0100 +++ wine-20050419/dlls/dmloader/container.c 2005-04-18 17:36:21.000000000 +0200 @@ -111,7 +111,7 @@ if (dwCount == dwIndex) { HRESULT result = S_OK; if (pwszAlias) { - strncpyW (pwszAlias, pContainedObject->wszAlias, DMUS_MAX_FILENAME); + lstrcpynW (pwszAlias, pContainedObject->wszAlias, DMUS_MAX_FILENAME); if (strlenW (pContainedObject->wszAlias) > DMUS_MAX_FILENAME) result = DMUS_S_STRING_TRUNCATED; } @@ -199,15 +199,15 @@ dwNewFlags |= DMUS_OBJ_OBJECT; } if (pDesc->dwValidData & DMUS_OBJ_NAME) { - strncpyW (This->Desc.wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->Desc.wszName, pDesc->wszName, DMUS_MAX_NAME); dwNewFlags |= DMUS_OBJ_NAME; } if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) { - strncpyW (This->Desc.wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->Desc.wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); dwNewFlags |= DMUS_OBJ_CATEGORY; } if (pDesc->dwValidData & (DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH)) { - strncpyW (This->Desc.wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->Desc.wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); dwNewFlags |= (pDesc->dwValidData & (DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH)); } if (pDesc->dwValidData & DMUS_OBJ_VERSION) { diff -urN wine-20050310/dlls/dmloader/loaderstream.c wine-20050419/dlls/dmloader/loaderstream.c --- wine-20050310/dlls/dmloader/loaderstream.c 2004-12-22 16:13:20.000000000 +0100 +++ wine-20050419/dlls/dmloader/loaderstream.c 2005-04-18 12:30:56.000000000 +0200 @@ -67,7 +67,7 @@ } /* create IDirectMusicGetLoader */ This->pLoader = (LPDIRECTMUSICLOADER8)pLoader; - strncpyW (This->wzFileName, wzFile, MAX_PATH); + lstrcpynW (This->wzFileName, wzFile, MAX_PATH); TRACE(": succeeded\n"); return S_OK; } diff -urN wine-20050310/dlls/dmscript/script.c wine-20050419/dlls/dmscript/script.c --- wine-20050310/dlls/dmscript/script.c 2005-02-02 10:31:28.000000000 +0100 +++ wine-20050419/dlls/dmscript/script.c 2005-04-18 12:30:56.000000000 +0200 @@ -226,11 +226,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dmstyle/commandtrack.c wine-20050419/dlls/dmstyle/commandtrack.c --- wine-20050310/dlls/dmstyle/commandtrack.c 2005-01-24 20:33:23.000000000 +0100 +++ wine-20050419/dlls/dmstyle/commandtrack.c 2005-03-24 22:01:39.000000000 +0100 @@ -266,7 +266,7 @@ nrCommands = chunkSize/dwSizeOfStruct; /* and this is the number of commands */ /* load each command seperately in new entry */ for (count = 0; count < nrCommands; count++) { - LPDMUS_PRIVATE_COMMAND pNewCommand = (LPDMUS_PRIVATE_COMMAND) HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_COMMAND)); + LPDMUS_PRIVATE_COMMAND pNewCommand = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_COMMAND)); IStream_Read (pStm, &pNewCommand->pCommand, dwSizeOfStruct, NULL); list_add_tail (&This->Commands, &pNewCommand->entry); } diff -urN wine-20050310/dlls/dmstyle/style.c wine-20050419/dlls/dmstyle/style.c --- wine-20050310/dlls/dmstyle/style.c 2005-01-24 20:33:23.000000000 +0100 +++ wine-20050419/dlls/dmstyle/style.c 2005-04-18 12:30:56.000000000 +0200 @@ -230,11 +230,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dmstyle/styletrack.c wine-20050419/dlls/dmstyle/styletrack.c --- wine-20050310/dlls/dmstyle/styletrack.c 2005-01-24 20:33:23.000000000 +0100 +++ wine-20050419/dlls/dmstyle/styletrack.c 2005-03-23 14:15:20.000000000 +0100 @@ -304,7 +304,7 @@ } hr = IDirectMusicObject_QueryInterface(pObject, &IID_IDirectMusicStyle8, (LPVOID*)&pNewItem->pObject); if (FAILED(hr)) { - ERR(": Reference not a IDirectMusicStyle, exiting\n"); + ERR(": Reference not an IDirectMusicStyle, exiting\n"); exit(-1); return hr; } diff -urN wine-20050310/dlls/dmusic/collection.c wine-20050419/dlls/dmusic/collection.c --- wine-20050310/dlls/dmusic/collection.c 2005-01-26 20:41:43.000000000 +0100 +++ wine-20050419/dlls/dmusic/collection.c 2005-04-18 17:36:21.000000000 +0200 @@ -131,6 +131,7 @@ unsigned int r = 0; DMUS_PRIVATE_INSTRUMENTENTRY *tmpEntry; struct list *listEntry; + DWORD dwLen; TRACE("(%p, %ld, %p, %p, %ld)\n", This, dwIndex, pdwPatch, pwszName, dwNameLen); LIST_FOR_EACH (listEntry, &This->Instruments) { @@ -138,8 +139,11 @@ if (r == dwIndex) { ICOM_NAME_MULTI (IDirectMusicInstrumentImpl, InstrumentVtbl, tmpEntry->pInstrument, pInstrument); IDirectMusicInstrument_GetPatch (tmpEntry->pInstrument, pdwPatch); - dwNameLen = strlenW (pInstrument->wszName); - strncpyW (pwszName, pInstrument->wszName, dwNameLen); + if (pwszName) { + dwLen = min(strlenW(pInstrument->wszName),dwNameLen-1); + memcpy (pwszName, pInstrument->wszName, dwLen * sizeof(WCHAR)); + pwszName[dwLen] = '\0'; + } return S_OK; } r++; @@ -190,11 +194,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW(This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW(This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW(This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/dplayx/dplay.c wine-20050419/dlls/dplayx/dplay.c --- wine-20050310/dlls/dplayx/dplay.c 2005-01-07 16:40:09.000000000 +0100 +++ wine-20050419/dlls/dplayx/dplay.c 2005-04-19 11:48:09.000000000 +0200 @@ -236,8 +236,7 @@ { IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)lpDP; - This->unk = (DirectPlayIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->unk) ) ); + This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); if ( This->unk == NULL ) { return FALSE; @@ -262,8 +261,7 @@ { IDirectPlay2AImpl *This = (IDirectPlay2AImpl *)lpDP; - This->dp2 = (DirectPlay2Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->dp2) ) ); + This->dp2 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp2) ) ); if ( This->dp2 == NULL ) { return FALSE; @@ -286,9 +284,9 @@ } /* Provide an initial session desc with nothing in it */ - This->dp2->lpSessionDesc = (LPDPSESSIONDESC2)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *This->dp2->lpSessionDesc ) ); + This->dp2->lpSessionDesc = HeapAlloc( GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof( *This->dp2->lpSessionDesc ) ); if( This->dp2->lpSessionDesc == NULL ) { /* FIXME: Memory leak */ @@ -296,7 +294,7 @@ } This->dp2->lpSessionDesc->dwSize = sizeof( *This->dp2->lpSessionDesc ); - /* We are a emulating a dp 6 implementation */ + /* We are emulating a dp 6 implementation */ This->dp2->spData.dwSPVersion = DPSP_MAJORVERSION; This->dp2->spData.lpCB = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, @@ -426,8 +424,7 @@ { IDirectPlay3AImpl *This = (IDirectPlay3AImpl *)lpDP; - This->dp3 = (DirectPlay3Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->dp3) ) ); + This->dp3 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp3) ) ); if ( This->dp3 == NULL ) { return FALSE; @@ -450,8 +447,7 @@ { IDirectPlay4AImpl *This = (IDirectPlay4AImpl *)lpDP; - This->dp4 = (DirectPlay4Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->dp4) ) ); + This->dp4 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dp4) ) ); if ( This->dp4 == NULL ) { return FALSE; @@ -709,9 +705,7 @@ *lpdwMsgSize = This->dp2->spData.dwSPHeaderSize + sizeof( *lpReply ); - *lplpReply = (LPDPMSG_NEWPLAYERIDREPLY)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - *lpdwMsgSize ); + *lplpReply = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, *lpdwMsgSize ); FIXME( "Ignoring dwFlags 0x%08lx in request msg\n", lpcMsg->dwFlags ); @@ -810,8 +804,7 @@ } /* Create a player list (ie "shortcut" ) */ - lpNewPList = (lpPlayerList)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpNewPList ) ); + lpNewPList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpNewPList ) ); if( lpNewPList == NULL ) { return DPERR_CANTADDPLAYER; @@ -930,8 +923,7 @@ lpGroupData lpGData; /* Allocate the new space and add to end of high level group list */ - lpGData = (lpGroupData) HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpGData ) ); + lpGData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpGData ) ); if( lpGData == NULL ) { @@ -1054,9 +1046,7 @@ else { /* Insert into the system group */ - lpGroupList lpGroup = (lpGroupList) HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *lpGroup ) ); + lpGroupList lpGroup = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpGroup ) ); lpGroup->lpGData = lpGData; DPQ_INSERT( This->dp2->lpSysGroup->groups, lpGroup, groups ); @@ -1153,21 +1143,23 @@ LPVOID lpData, DWORD dwDataSize ) { /* Clear out the data with this player */ - if( ( dwFlags & DPSET_LOCAL ) && - ( lpGData->dwLocalDataSize != 0 ) - ) + if( dwFlags & DPSET_LOCAL ) { - HeapFree( GetProcessHeap(), 0, lpGData->lpLocalData ); - lpGData->lpLocalData = NULL; - lpGData->dwLocalDataSize = 0; + if ( lpGData->dwLocalDataSize != 0 ) + { + HeapFree( GetProcessHeap(), 0, lpGData->lpLocalData ); + lpGData->lpLocalData = NULL; + lpGData->dwLocalDataSize = 0; + } } - if( ( dwFlags & DPSET_REMOTE ) && - ( lpGData->dwRemoteDataSize != 0 ) - ) + else { - HeapFree( GetProcessHeap(), 0, lpGData->lpRemoteData ); - lpGData->lpRemoteData = NULL; - lpGData->dwRemoteDataSize = 0; + if( lpGData->dwRemoteDataSize != 0 ) + { + HeapFree( GetProcessHeap(), 0, lpGData->lpRemoteData ); + lpGData->lpRemoteData = NULL; + lpGData->dwRemoteDataSize = 0; + } } /* Reallocate for new data */ @@ -1177,17 +1169,16 @@ sizeof( dwDataSize ) ); CopyMemory( lpNewData, lpData, dwDataSize ); - if( dwFlags & DPSET_REMOTE ) - { - lpGData->lpRemoteData = lpNewData; - lpGData->dwRemoteDataSize = dwDataSize; - } - if( dwFlags & DPSET_LOCAL ) { lpGData->lpLocalData = lpData; lpGData->dwLocalDataSize = dwDataSize; } + else + { + lpGData->lpRemoteData = lpNewData; + lpGData->dwRemoteDataSize = dwDataSize; + } } } @@ -1203,9 +1194,7 @@ TRACE( "(%p)->(%p,%p,%u)\n", This, lpid, lpName, bAnsi ); /* Allocate the storage for the player and associate it with list element */ - lpPData = (lpPlayerData) HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *lpPData ) ); + lpPData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpPData ) ); if( lpPData == NULL ) { return NULL; @@ -1352,21 +1341,23 @@ LPVOID lpData, DWORD dwDataSize ) { /* Clear out the data with this player */ - if( ( dwFlags & DPSET_LOCAL ) && - ( lpPData->dwLocalDataSize != 0 ) - ) + if( dwFlags & DPSET_LOCAL ) { - HeapFree( GetProcessHeap(), 0, lpPData->lpLocalData ); - lpPData->lpLocalData = NULL; - lpPData->dwLocalDataSize = 0; + if ( lpPData->dwLocalDataSize != 0 ) + { + HeapFree( GetProcessHeap(), 0, lpPData->lpLocalData ); + lpPData->lpLocalData = NULL; + lpPData->dwLocalDataSize = 0; + } } - if( ( dwFlags & DPSET_REMOTE ) && - ( lpPData->dwRemoteDataSize != 0 ) - ) + else { - HeapFree( GetProcessHeap(), 0, lpPData->lpRemoteData ); - lpPData->lpRemoteData = NULL; - lpPData->dwRemoteDataSize = 0; + if( lpPData->dwRemoteDataSize != 0 ) + { + HeapFree( GetProcessHeap(), 0, lpPData->lpRemoteData ); + lpPData->lpRemoteData = NULL; + lpPData->dwRemoteDataSize = 0; + } } /* Reallocate for new data */ @@ -1376,17 +1367,16 @@ sizeof( dwDataSize ) ); CopyMemory( lpNewData, lpData, dwDataSize ); - if( dwFlags & DPSET_REMOTE ) - { - lpPData->lpRemoteData = lpNewData; - lpPData->dwRemoteDataSize = dwDataSize; - } - if( dwFlags & DPSET_LOCAL ) { lpPData->lpLocalData = lpData; lpPData->dwLocalDataSize = dwDataSize; } + else + { + lpPData->lpRemoteData = lpNewData; + lpPData->dwRemoteDataSize = dwDataSize; + } } } @@ -1496,8 +1486,7 @@ } /* Create the list object and link it in */ - lpPList = (lpPlayerList)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpPList ) ); + lpPList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpPList ) ); if( lpPList == NULL ) { FIXME( "Memory leak\n" ); @@ -2298,9 +2287,7 @@ if( !FAILED(hr) ) { EnumSessionAsyncCallbackData* lpData - = (EnumSessionAsyncCallbackData*)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *lpData ) ); + = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpData ) ); /* FIXME: need to kill the thread on object deletion */ lpData->lpSpData = &This->dp2->spData; @@ -2427,21 +2414,15 @@ } /* How much buffer is required? */ - if( dwFlags & DPSET_REMOTE ) - { - dwRequiredBufferSize = lpGData->dwRemoteDataSize; - lpCopyDataFrom = lpGData->lpRemoteData; - } - else if( dwFlags & DPSET_LOCAL ) + if( dwFlags & DPSET_LOCAL ) { dwRequiredBufferSize = lpGData->dwLocalDataSize; lpCopyDataFrom = lpGData->lpLocalData; } else { - ERR( "Neither local or remote data requested!?!\n" ); - dwRequiredBufferSize = 0; - lpCopyDataFrom = NULL; + dwRequiredBufferSize = lpGData->dwRemoteDataSize; + lpCopyDataFrom = lpGData->lpRemoteData; } /* Is the user requesting to know how big a buffer is required? */ @@ -2632,21 +2613,15 @@ } /* How much buffer is required? */ - if( dwFlags & DPSET_REMOTE ) - { - dwRequiredBufferSize = lpPList->lpPData->dwRemoteDataSize; - lpCopyDataFrom = lpPList->lpPData->lpRemoteData; - } - else if( dwFlags & DPSET_LOCAL ) + if( dwFlags & DPSET_LOCAL ) { dwRequiredBufferSize = lpPList->lpPData->dwLocalDataSize; lpCopyDataFrom = lpPList->lpPData->lpLocalData; } else { - ERR( "Neither local or remote data requested!?!\n" ); - dwRequiredBufferSize = 0; - lpCopyDataFrom = NULL; + dwRequiredBufferSize = lpPList->lpPData->dwRemoteDataSize; + lpCopyDataFrom = lpPList->lpPData->lpRemoteData; } /* Is the user requesting to know how big a buffer is required? */ @@ -3058,7 +3033,7 @@ return DPERR_INVALIDOBJECT; } - if( dwFlags & DPSET_REMOTE ) + if( !(dwFlags & DPSET_LOCAL) ) { FIXME( "Was this group created by this interface?\n" ); /* FIXME: If this is a remote update need to allow it but not @@ -3071,7 +3046,7 @@ /* FIXME: Only send a message if this group is local to the session otherwise * it will have been rejected above */ - if( dwFlags & DPSET_REMOTE ) + if( !(dwFlags & DPSET_LOCAL) ) { FIXME( "Send msg?\n" ); } @@ -3156,7 +3131,7 @@ return DPERR_INVALIDPLAYER; } - if( dwFlags & DPSET_REMOTE ) + if( !(dwFlags & DPSET_LOCAL) ) { FIXME( "Was this group created by this interface?\n" ); /* FIXME: If this is a remote update need to allow it but not @@ -3166,7 +3141,7 @@ DP_SetPlayerData( lpPList->lpPData, dwFlags, lpData, dwDataSize ); - if( dwFlags & DPSET_REMOTE ) + if( !(dwFlags & DPSET_LOCAL) ) { FIXME( "Send msg?\n" ); } @@ -3258,9 +3233,7 @@ /* FIXME: Copy into This->dp2->lpSessionDesc */ dwRequiredSize = DP_CalcSessionDescSize( lpSessDesc, bAnsi ); - lpTempSessDesc = (LPDPSESSIONDESC2)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - dwRequiredSize ); + lpTempSessDesc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwRequiredSize ); if( lpTempSessDesc == NULL ) { @@ -3424,8 +3397,7 @@ } /* Create a player list (ie "shortcut" ) */ - lpNewGList = (lpGroupList)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpNewGList ) ); + lpNewGList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpNewGList ) ); if( lpNewGList == NULL ) { return DPERR_CANTADDPLAYER; @@ -3494,8 +3466,7 @@ /* The list has now been inserted into the interface group list. We now need to put a "shortcut" to this group in the parent group */ - lpGList = (lpGroupList)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpGList ) ); + lpGList = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpGList ) ); if( lpGList == NULL ) { FIXME( "Memory leak\n" ); @@ -4636,10 +4607,8 @@ /* FIXME: This queuing should only be for async messages */ - lpMElem = (LPDPMSG)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpMElem ) ); - lpMElem->msg = (DPMSG_GENERIC*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - dwDataSize ); + lpMElem = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpMElem ) ); + lpMElem->msg = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize ); CopyMemory( lpMElem->msg, lpData, dwDataSize ); diff -urN wine-20050310/dlls/dplayx/dplaysp.c wine-20050419/dlls/dplayx/dplaysp.c --- wine-20050310/dlls/dplayx/dplaysp.c 2004-12-23 19:41:06.000000000 +0100 +++ wine-20050419/dlls/dplayx/dplaysp.c 2005-03-24 22:01:39.000000000 +0100 @@ -136,9 +136,7 @@ { IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)lpSP; - This->unk = (DirectPlaySPIUnknownData*)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *(This->unk) ) ); + This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); if ( This->unk == NULL ) { @@ -165,9 +163,7 @@ { IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)lpSP; - This->sp = (DirectPlaySPData*)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *(This->sp) ) ); + This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) ); if ( This->sp == NULL ) { diff -urN wine-20050310/dlls/dplayx/dplayx_global.c wine-20050419/dlls/dplayx/dplayx_global.c --- wine-20050310/dlls/dplayx/dplayx_global.c 2005-01-26 22:09:05.000000000 +0100 +++ wine-20050419/dlls/dplayx/dplayx_global.c 2005-03-24 22:01:39.000000000 +0100 @@ -1064,8 +1064,7 @@ LPDPSESSIONDESC2 DPLAYX_CopyAndAllocateSessionDesc2A( LPCDPSESSIONDESC2 lpSessionSrc ) { LPDPSESSIONDESC2 lpSessionDest = - (LPDPSESSIONDESC2)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, sizeof( *lpSessionSrc ) ); + HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpSessionSrc ) ); DPLAYX_CopyIntoSessionDesc2A( lpSessionDest, lpSessionSrc ); return lpSessionDest; diff -urN wine-20050310/dlls/dplayx/dplobby.c wine-20050419/dlls/dplayx/dplobby.c --- wine-20050310/dlls/dplayx/dplobby.c 2005-03-09 12:48:05.000000000 +0100 +++ wine-20050419/dlls/dplayx/dplobby.c 2005-03-24 22:01:39.000000000 +0100 @@ -151,8 +151,7 @@ { IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL; - This->unk = (DirectPlayLobbyIUnknownData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->unk) ) ); + This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); if ( This->unk == NULL ) { return FALSE; @@ -177,8 +176,7 @@ { IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL; - This->dpl = (DirectPlayLobbyData*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->dpl) ) ); + This->dpl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl) ) ); if ( This->dpl == NULL ) { return FALSE; @@ -210,8 +208,7 @@ { IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)lpDPL; - This->dpl2 = (DirectPlayLobby2Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->dpl2) ) ); + This->dpl2 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl2) ) ); if ( This->dpl2 == NULL ) { return FALSE; @@ -233,8 +230,7 @@ { IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)lpDPL; - This->dpl3 = (DirectPlayLobby3Data*)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *(This->dpl3) ) ); + This->dpl3 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl3) ) ); if ( This->dpl3 == NULL ) { return FALSE; @@ -473,7 +469,7 @@ * Connects an application to the session specified by the DPLCONNECTION * structure currently stored with the DirectPlayLobby object. * - * Returns a IDirectPlay interface. + * Returns an IDirectPlay interface. * */ static HRESULT WINAPI DPL_ConnectEx diff -urN wine-20050310/dlls/dplayx/lobbysp.c wine-20050419/dlls/dplayx/lobbysp.c --- wine-20050310/dlls/dplayx/lobbysp.c 2004-09-06 23:34:25.000000000 +0200 +++ wine-20050419/dlls/dplayx/lobbysp.c 2005-03-24 22:01:39.000000000 +0100 @@ -112,9 +112,7 @@ { IDPLobbySPImpl *This = (IDPLobbySPImpl *)lpSP; - This->unk = (DPLobbySPIUnknownData*)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *(This->unk) ) ); + This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) ); if ( This->unk == NULL ) { @@ -140,9 +138,7 @@ { IDPLobbySPImpl *This = (IDPLobbySPImpl *)lpSP; - This->sp = (DPLobbySPData*)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *(This->sp) ) ); + This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) ); if ( This->sp == NULL ) { diff -urN wine-20050310/dlls/dplayx/name_server.c wine-20050419/dlls/dplayx/name_server.c --- wine-20050310/dlls/dplayx/name_server.c 2005-02-10 20:19:36.000000000 +0100 +++ wine-20050419/dlls/dplayx/name_server.c 2005-03-24 22:01:39.000000000 +0100 @@ -120,8 +120,7 @@ } /* Add this to the list */ - lpCacheNode = (lpNSCacheData)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( *lpCacheNode ) ); + lpCacheNode = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpCacheNode ) ); if( lpCacheNode == NULL ) { @@ -133,10 +132,7 @@ dwHdrSize ); CopyMemory( lpCacheNode->lpNSAddrHdr, lpcNSAddrHdr, dwHdrSize ); - - lpCacheNode->data = (LPDPSESSIONDESC2)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *(lpCacheNode->data) ) ); + lpCacheNode->data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(lpCacheNode->data) ) ); if( lpCacheNode->data == NULL ) { @@ -283,9 +279,7 @@ /* Create and initialize a session cache */ BOOL NS_InitializeSessionCache( LPVOID* lplpNSInfo ) { - lpNSCache lpCache = (lpNSCache)HeapAlloc( GetProcessHeap(), - HEAP_ZERO_MEMORY, - sizeof( *lpCache ) ); + lpNSCache lpCache = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *lpCache ) ); *lplpNSInfo = lpCache; diff -urN wine-20050310/dlls/dsound/capture.c wine-20050419/dlls/dsound/capture.c --- wine-20050310/dlls/dsound/capture.c 2005-02-11 12:49:05.000000000 +0100 +++ wine-20050419/dlls/dsound/capture.c 2005-03-28 16:17:52.000000000 +0200 @@ -186,7 +186,7 @@ if (devs > 0) { if (GetDeviceID(&DSDEVID_DefaultCapture, &guid) == DS_OK) { for (wid = 0; wid < devs; ++wid) { - if (IsEqualGUID( &guid, &capture_guids[wid] ) ) { + if (IsEqualGUID( &guid, &DSOUND_capture_guids[wid] ) ) { err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n", @@ -203,8 +203,8 @@ err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n", - debugstr_guid(&capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext); - if (lpDSEnumCallback(&capture_guids[wid], desc.szDesc, desc.szDrvname, lpContext) == FALSE) + debugstr_guid(&DSOUND_capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext); + if (lpDSEnumCallback(&DSOUND_capture_guids[wid], desc.szDesc, desc.szDrvname, lpContext) == FALSE) return DS_OK; } } @@ -248,7 +248,7 @@ if (devs > 0) { if (GetDeviceID(&DSDEVID_DefaultCapture, &guid) == DS_OK) { for (wid = 0; wid < devs; ++wid) { - if (IsEqualGUID( &guid, &capture_guids[wid] ) ) { + if (IsEqualGUID( &guid, &DSOUND_capture_guids[wid] ) ) { err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n", @@ -269,12 +269,12 @@ err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n", - debugstr_guid(&capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext); + debugstr_guid(&DSOUND_capture_guids[wid]),desc.szDesc,desc.szDrvname,lpContext); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDesc, sizeof(wDesc)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wName, sizeof(wName)/sizeof(WCHAR) ); - if (lpDSEnumCallback((LPGUID)&capture_guids[wid], wDesc, wName, lpContext) == FALSE) + if (lpDSEnumCallback((LPGUID)&DSOUND_capture_guids[wid], wDesc, wName, lpContext) == FALSE) return DS_OK; } } @@ -306,7 +306,6 @@ This->read_position = pHdr->dwBytesRecorded; This->state = STATE_CAPTURING; } - waveInUnprepareHeader(hwi,&(This->pwave[This->index]),sizeof(WAVEHDR)); if (This->capture_buffer->nrofnotifies) SetEvent(This->capture_buffer->notifies[This->index].hEventNotify); This->index = (This->index + 1) % This->nrofpwaves; @@ -315,7 +314,6 @@ This->state = STATE_STOPPED; } else { if (This->state == STATE_CAPTURING) { - waveInPrepareHeader(hwi,&(This->pwave[index]),sizeof(WAVEHDR)); waveInAddBuffer(hwi, &(This->pwave[index]), sizeof(WAVEHDR)); } else if (This->state == STATE_STOPPING) { TRACE("stopping\n"); @@ -509,7 +507,7 @@ /* enumerate WINMM audio devices and find the one we want */ for (wid=0; widdrvcaps.dwFlags = 0; - strncpy(This->drvdesc.szDrvname, wic.szPname, - sizeof(This->drvdesc.szDrvname)); + lstrcpynA(This->drvdesc.szDrvname, wic.szPname, + sizeof(This->drvdesc.szDrvname)); This->drvcaps.dwFlags |= DSCCAPS_EMULDRIVER; This->drvcaps.dwFormats = wic.dwFormats; diff -urN wine-20050310/dlls/dsound/dsound.c wine-20050419/dlls/dsound/dsound.c --- wine-20050310/dlls/dsound/dsound.c 2005-02-25 17:50:57.000000000 +0100 +++ wine-20050419/dlls/dsound/dsound.c 2005-03-15 16:40:36.000000000 +0100 @@ -288,7 +288,7 @@ This->mixlock.DebugInfo->Spare[1] = 0; DeleteCriticalSection(&This->mixlock); HeapFree(GetProcessHeap(),0,This); - dsound = NULL; + DSOUND_renderer = NULL; TRACE("(%p) released\n", This); } return ref; @@ -748,7 +748,7 @@ TRACE(" expecting GUID %s.\n", debugstr_guid(lpcGUID)); for (wod=0; wodguid)) { - hr = IDirectSound_IDirectSound_Create((LPDIRECTSOUND8)dsound, ppDS); + if (DSOUND_renderer) { + if (IsEqualGUID(&devGuid, &DSOUND_renderer->guid)) { + hr = IDirectSound_IDirectSound_Create((LPDIRECTSOUND8)DSOUND_renderer, ppDS); if (*ppDS) IDirectSound_IDirectSound_AddRef(*ppDS); else @@ -1655,10 +1655,10 @@ if (*ppDS) { IDirectSound_IDirectSound_AddRef(*ppDS); - dsound = (IDirectSoundImpl*)pDS; + DSOUND_renderer = (IDirectSoundImpl*)pDS; timeBeginPeriod(DS_TIME_RES); - dsound->timerID = timeSetEvent(DS_TIME_DEL, DS_TIME_RES, DSOUND_timer, - (DWORD)dsound, TIME_PERIODIC | TIME_CALLBACK_FUNCTION); + DSOUND_renderer->timerID = timeSetEvent(DS_TIME_DEL, DS_TIME_RES, DSOUND_timer, + (DWORD)DSOUND_renderer, TIME_PERIODIC | TIME_CALLBACK_FUNCTION); } else { WARN("IDirectSound_IDirectSound_Create failed\n"); IDirectSound8_Release(pDS); @@ -1700,7 +1700,7 @@ hr = DSOUND_Create(lpcGUID, ppDS, pUnkOuter); if (hr == DS_OK) - IDirectSoundImpl_Initialize((LPDIRECTSOUND8)dsound, lpcGUID); + IDirectSound_Initialize(*ppDS, lpcGUID); return hr; } @@ -1738,9 +1738,9 @@ return DSERR_INVALIDPARAM; } - if (dsound) { - if (IsEqualGUID(&devGuid, &dsound->guid)) { - hr = IDirectSound8_IDirectSound8_Create((LPDIRECTSOUND8)dsound, ppDS); + if (DSOUND_renderer) { + if (IsEqualGUID(&devGuid, &DSOUND_renderer->guid)) { + hr = IDirectSound8_IDirectSound8_Create((LPDIRECTSOUND8)DSOUND_renderer, ppDS); if (*ppDS) IDirectSound8_IDirectSound8_AddRef(*ppDS); else @@ -1760,10 +1760,10 @@ if (*ppDS) { IDirectSound8_IDirectSound8_AddRef(*ppDS); - dsound = (IDirectSoundImpl*)pDS; + DSOUND_renderer = (IDirectSoundImpl*)pDS; timeBeginPeriod(DS_TIME_RES); - dsound->timerID = timeSetEvent(DS_TIME_DEL, DS_TIME_RES, DSOUND_timer, - (DWORD)dsound, TIME_PERIODIC | TIME_CALLBACK_FUNCTION); + DSOUND_renderer->timerID = timeSetEvent(DS_TIME_DEL, DS_TIME_RES, DSOUND_timer, + (DWORD)DSOUND_renderer, TIME_PERIODIC | TIME_CALLBACK_FUNCTION); } else { WARN("IDirectSound8_IDirectSound8_Create failed\n"); IDirectSound8_Release(pDS); @@ -1805,7 +1805,7 @@ hr = DSOUND_Create8(lpcGUID, ppDS, pUnkOuter); if (hr == DS_OK) - IDirectSoundImpl_Initialize((LPDIRECTSOUND8)dsound, lpcGUID); + IDirectSound8_Initialize(*ppDS, lpcGUID); return hr; } diff -urN wine-20050310/dlls/dsound/dsound_main.c wine-20050419/dlls/dsound/dsound_main.c --- wine-20050310/dlls/dsound/dsound_main.c 2005-02-11 12:49:05.000000000 +0100 +++ wine-20050419/dlls/dsound/dsound_main.c 2005-03-28 16:17:52.000000000 +0200 @@ -68,9 +68,9 @@ #define DS_SND_QUEUE_MAX 28 /* max number of fragments to prebuffer */ #define DS_SND_QUEUE_MIN 12 /* min number of fragments to prebuffer */ -IDirectSoundImpl* dsound = NULL; -GUID renderer_guids[MAXWAVEDRIVERS]; -GUID capture_guids[MAXWAVEDRIVERS]; +IDirectSoundImpl* DSOUND_renderer = NULL; +GUID DSOUND_renderer_guids[MAXWAVEDRIVERS]; +GUID DSOUND_capture_guids[MAXWAVEDRIVERS]; HRESULT mmErr(UINT err) { @@ -149,8 +149,7 @@ char appname[MAX_PATH+16]; char *p = strrchr( buffer, '\\' ); if (p!=NULL) { - appname[MAX_PATH]='\0'; - strncpy(appname,p+1,MAX_PATH); + lstrcpynA(appname,p+1,MAX_PATH); strcat(appname,"\\dsound"); TRACE("appname = [%s] \n",appname); if (RegOpenKeyA( tmpkey, appname, &appkey )) appkey = 0; @@ -268,14 +267,14 @@ if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) || IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) { - CopyMemory(pGuidDest, &renderer_guids[ds_default_playback], sizeof(GUID)); + CopyMemory(pGuidDest, &DSOUND_renderer_guids[ds_default_playback], sizeof(GUID)); TRACE("returns %s\n", get_device_id(pGuidDest)); return DS_OK; } if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) || IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) { - CopyMemory(pGuidDest, &capture_guids[ds_default_capture], sizeof(GUID)); + CopyMemory(pGuidDest, &DSOUND_capture_guids[ds_default_capture], sizeof(GUID)); TRACE("returns %s\n", get_device_id(pGuidDest)); return DS_OK; } @@ -321,7 +320,7 @@ if (devs > 0) { if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) { for (wod = 0; wod < devs; ++wod) { - if (IsEqualGUID( &guid, &renderer_guids[wod]) ) { + if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod]) ) { err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n", @@ -338,8 +337,8 @@ err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n", - debugstr_guid(&renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext); - if (lpDSEnumCallback(&renderer_guids[wod], desc.szDesc, desc.szDrvname, lpContext) == FALSE) + debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext); + if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], desc.szDesc, desc.szDrvname, lpContext) == FALSE) return DS_OK; } } @@ -382,7 +381,7 @@ if (devs > 0) { if (GetDeviceID(&DSDEVID_DefaultPlayback, &guid) == DS_OK) { for (wod = 0; wod < devs; ++wod) { - if (IsEqualGUID( &guid, &renderer_guids[wod] ) ) { + if (IsEqualGUID( &guid, &DSOUND_renderer_guids[wod] ) ) { err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(NULL,\"%s\",\"%s\",%p)\n", @@ -403,12 +402,12 @@ err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { TRACE("calling lpDSEnumCallback(%s,\"%s\",\"%s\",%p)\n", - debugstr_guid(&renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext); + debugstr_guid(&DSOUND_renderer_guids[wod]),desc.szDesc,desc.szDrvname,lpContext); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDesc, sizeof(wDesc)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wName, sizeof(wName)/sizeof(WCHAR) ); - if (lpDSEnumCallback(&renderer_guids[wod], wDesc, wName, lpContext) == FALSE) + if (lpDSEnumCallback(&DSOUND_renderer_guids[wod], wDesc, wName, lpContext) == FALSE) return DS_OK; } } @@ -665,8 +664,8 @@ case DLL_PROCESS_ATTACH: TRACE("DLL_PROCESS_ATTACH\n"); for (i = 0; i < MAXWAVEDRIVERS; i++) { - INIT_GUID(renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i); - INIT_GUID(capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i); + INIT_GUID(DSOUND_renderer_guids[i], 0xbd6dd71a, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i); + INIT_GUID(DSOUND_capture_guids[i], 0xbd6dd71b, 0x3deb, 0x11d1, 0xb1, 0x71, 0x00, 0xc0, 0x4f, 0xc2, 0x00, 0x00 + i); } break; case DLL_PROCESS_DETACH: diff -urN wine-20050310/dlls/dsound/dsound_private.h wine-20050419/dlls/dsound/dsound_private.h --- wine-20050310/dlls/dsound/dsound_private.h 2005-01-24 12:27:05.000000000 +0100 +++ wine-20050419/dlls/dsound/dsound_private.h 2005-03-15 16:40:36.000000000 +0100 @@ -494,10 +494,9 @@ #define DSOUND_FREQSHIFT (14) -extern IDirectSoundImpl* dsound; - -extern GUID renderer_guids[MAXWAVEDRIVERS]; -extern GUID capture_guids[MAXWAVEDRIVERS]; +extern IDirectSoundImpl* DSOUND_renderer; +extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS]; +extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS]; extern HRESULT mmErr(UINT err); extern void setup_dsound_options(void); diff -urN wine-20050310/dlls/dsound/mixer.c wine-20050419/dlls/dsound/mixer.c --- wine-20050310/dlls/dsound/mixer.c 2005-02-25 20:16:57.000000000 +0100 +++ wine-20050419/dlls/dsound/mixer.c 2005-03-19 18:09:33.000000000 +0100 @@ -388,8 +388,8 @@ if (len % dsb->dsound->pwfx->nBlockAlign) { INT nBlockAlign = dsb->dsound->pwfx->nBlockAlign; - len = (len / nBlockAlign) * nBlockAlign; /* data alignment */ ERR("length not a multiple of block size, len = %d, block size = %d\n", len, nBlockAlign); + len = (len / nBlockAlign) * nBlockAlign; /* data alignment */ } if (len == 0) { @@ -505,8 +505,8 @@ if (len % dsb->dsound->pwfx->nBlockAlign) { INT nBlockAlign = dsb->dsound->pwfx->nBlockAlign; - len = (len / nBlockAlign) * nBlockAlign; /* data alignment */ ERR("length not a multiple of block size, len = %ld, block size = %d\n", len, nBlockAlign); + len = (len / nBlockAlign) * nBlockAlign; /* data alignment */ } if ((buf = ibuf = DSOUND_tmpbuffer(dsb->dsound, len)) == NULL) @@ -1115,7 +1115,7 @@ TRACE("(%d,%d,0x%lx,0x%lx,0x%lx)\n",timerID,msg,dwUser,dw1,dw2); TRACE("entering at %ld\n", start_time); - if (dsound != This) { + if (DSOUND_renderer != This) { ERR("dsound died without killing us?\n"); timeKillEvent(timerID); timeEndPeriod(DS_TIME_RES); diff -urN wine-20050310/dlls/dsound/primary.c wine-20050419/dlls/dsound/primary.c --- wine-20050310/dlls/dsound/primary.c 2005-02-16 17:26:13.000000000 +0100 +++ wine-20050419/dlls/dsound/primary.c 2005-04-11 15:00:00.000000000 +0200 @@ -130,8 +130,11 @@ return err; } - if (dsound->state == STATE_PLAYING) dsound->state = STATE_STARTING; - else if (dsound->state == STATE_STOPPING) dsound->state = STATE_STOPPED; + if (This->state == STATE_PLAYING) This->state = STATE_STARTING; + else if (This->state == STATE_STOPPING) This->state = STATE_STOPPED; + This->playpos = 0; + This->mixpos = 0; + FillMemory(This->buffer, This->buflen, (This->pwfx->wBitsPerSample == 8) ? 128 : 0); } return err; @@ -492,7 +495,7 @@ return DSERR_INVALIDPARAM; } - waveOutGetVolume(dsound->hwo, &factors); + waveOutGetVolume(This->dsound->hwo, &factors); volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff; volpan.dwTotalRightAmpFactor=ampfactors >> 16; DSOUND_AmpFactorToVolPan(&volpan); @@ -813,7 +816,7 @@ return DSERR_INVALIDPARAM; } - waveOutGetVolume(dsound->hwo, &factors); + waveOutGetVolume(This->dsound->hwo, &factors); volpan.dwTotalLeftAmpFactor=ampfactors & 0xffff; volpan.dwTotalRightAmpFactor=ampfactors >> 16; DSOUND_AmpFactorToVolPan(&volpan); diff -urN wine-20050310/dlls/dsound/propset.c wine-20050419/dlls/dsound/propset.c --- wine-20050310/dlls/dsound/propset.c 2005-02-11 12:49:05.000000000 +0100 +++ wine-20050419/dlls/dsound/propset.c 2005-04-13 16:39:49.000000000 +0200 @@ -272,9 +272,10 @@ ULONG cbPropData, PULONG pcbReturned ) { + HRESULT hr = DSERR_INVALIDPARAM; PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA ppd; - FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) not implemented!\n", - debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned); + TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) not implemented!\n", + debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned); ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A_DATA) pPropData; @@ -283,20 +284,50 @@ return DSERR_INVALIDPARAM; } - FIXME("DeviceName=%s\n",ppd->DeviceName); - FIXME("DataFlow=%s\n", - ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "DIRECTSOUNDDEVICE_DATAFLOW_RENDER" : - ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? "DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE" : "UNKNOWN"); - - /* FIXME: match the name to a wave device somehow. */ - ppd->DeviceId = GUID_NULL; + if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) { + ULONG wod; + unsigned int wodn; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); + wodn = waveOutGetNumDevs(); + for (wod = 0; wod < wodn; wod++) { + WAVEOUTCAPSA capsA; + MMRESULT res; + res = waveOutGetDevCapsA(wod, &capsA, sizeof(capsA)); + if (res == MMSYSERR_NOERROR) { + if (lstrcmpA(capsA.szPname, ppd->DeviceName) == 0) { + ppd->DeviceId = DSOUND_renderer_guids[wod]; + hr = DS_OK; + TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId), + ppd->DeviceName); + break; + } + } + } + } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) { + ULONG wid; + unsigned int widn; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n"); + widn = waveInGetNumDevs(); + for (wid = 0; wid < widn; wid++) { + WAVEINCAPSA capsA; + MMRESULT res; + res = waveInGetDevCapsA(wid, &capsA, sizeof(capsA)); + if (res == MMSYSERR_NOERROR) { + if (lstrcmpA(capsA.szPname, ppd->DeviceName) == 0) { + ppd->DeviceId = DSOUND_capture_guids[wid]; + TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId), + ppd->DeviceName); + hr = DS_OK; + break; + } + } + } + } - if (pcbReturned) { + if (pcbReturned) *pcbReturned = cbPropData; - FIXME("*pcbReturned=%ld\n", *pcbReturned); - } - return S_OK; + return hr; } static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingW( @@ -305,9 +336,10 @@ ULONG cbPropData, PULONG pcbReturned ) { + HRESULT hr = DSERR_INVALIDPARAM; PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA ppd; - FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p) not implemented!\n", - debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned); + TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", + debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned); ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W_DATA) pPropData; @@ -316,20 +348,50 @@ return DSERR_INVALIDPARAM; } - FIXME("DeviceName=%s\n",debugstr_w(ppd->DeviceName)); - FIXME("DataFlow=%s\n", - ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "DIRECTSOUNDDEVICE_DATAFLOW_RENDER" : - ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? "DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE" : "UNKNOWN"); - - /* FIXME: match the name to a wave device somehow. */ - ppd->DeviceId = GUID_NULL; - - if (pcbReturned) { - *pcbReturned = cbPropData; - FIXME("*pcbReturned=%ld\n", *pcbReturned); + if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER) { + ULONG wod; + unsigned int wodn; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); + wodn = waveOutGetNumDevs(); + for (wod = 0; wod < wodn; wod++) { + WAVEOUTCAPSW capsW; + MMRESULT res; + res = waveOutGetDevCapsW(wod, &capsW, sizeof(capsW)); + if (res == MMSYSERR_NOERROR) { + if (lstrcmpW(capsW.szPname, ppd->DeviceName) == 0) { + ppd->DeviceId = DSOUND_renderer_guids[wod]; + hr = DS_OK; + TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId), + debugstr_w(ppd->DeviceName)); + break; + } + } + } + } else if (ppd->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE) { + ULONG wid; + unsigned int widn; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n"); + widn = waveInGetNumDevs(); + for (wid = 0; wid < widn; wid++) { + WAVEINCAPSW capsW; + MMRESULT res; + res = waveInGetDevCapsW(wid, &capsW, sizeof(capsW)); + if (res == MMSYSERR_NOERROR) { + if (lstrcmpW(capsW.szPname, ppd->DeviceName) == 0) { + ppd->DeviceId = DSOUND_capture_guids[wid]; + hr = DS_OK; + TRACE("found %s for %s\n", debugstr_guid(&ppd->DeviceId), + debugstr_w(ppd->DeviceName)); + break; + } + } + } } - return S_OK; + if (pcbReturned) + *pcbReturned = cbPropData; + + return hr; } static HRESULT WINAPI DSPROPERTY_Description1( @@ -377,23 +439,25 @@ ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; wodn = waveOutGetNumDevs(); for (wod = 0; wod < wodn; wod++) { - if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) { + if (IsEqualGUID( &dev_guid, &DSOUND_renderer_guids[wod] ) ) { DSDRIVERDESC desc; ppd->WaveDeviceId = wod; ppd->Devnode = wod; err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); if (err == DS_OK) { PIDSDRIVER drv = NULL; - strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1); - strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1); + lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA)); + lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA)); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) ); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); if (err == DS_OK && drv) ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); break; } else { - WARN("waveOutMessage failed\n"); + WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n"); return E_PROP_ID_UNSUPPORTED; } } @@ -413,16 +477,18 @@ err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); if (err == DS_OK) { PIDSCDRIVER drv; - strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1); - strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1); + lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA)); + lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA)); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) ); err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); if (err == DS_OK && drv) ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n"); break; } else { - WARN("waveInMessage failed\n"); + WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n"); return E_PROP_ID_UNSUPPORTED; } } @@ -434,7 +500,7 @@ /* given specific device so try the render devices first */ wodn = waveOutGetNumDevs(); for (wod = 0; wod < wodn; wod++) { - if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) { + if (IsEqualGUID( &ppd->DeviceId, &DSOUND_renderer_guids[wod] ) ) { DSDRIVERDESC desc; TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; @@ -443,17 +509,19 @@ err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); if (err == DS_OK) { PIDSDRIVER drv = NULL; - strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1); - strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1); + lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA)); + lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA)); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) ); err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); if (err == DS_OK && drv) ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); found = TRUE; break; } else { - WARN("waveOutMessage failed\n"); + WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n"); return E_PROP_ID_UNSUPPORTED; } } @@ -465,7 +533,7 @@ /* given specific device so try the capture devices next */ widn = waveInGetNumDevs(); for (wid = 0; wid < widn; wid++) { - if (IsEqualGUID( &ppd->DeviceId, &capture_guids[wid] ) ) { + if (IsEqualGUID( &ppd->DeviceId, &DSOUND_capture_guids[wid] ) ) { DSDRIVERDESC desc; TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n"); ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; @@ -474,17 +542,19 @@ err = mmErr(waveInMessage((HWAVEIN)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); if (err == DS_OK) { PIDSDRIVER drv = NULL; - strncpy(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA) - 1); - strncpy(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA) - 1); + lstrcpynA(ppd->DescriptionA, desc.szDesc, sizeof(ppd->DescriptionA)); + lstrcpynA(ppd->ModuleA, desc.szDrvname, sizeof(ppd->ModuleA)); MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, ppd->DescriptionW, sizeof(ppd->DescriptionW)/sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, ppd->ModuleW, sizeof(ppd->ModuleW)/sizeof(WCHAR) ); err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); if (err == DS_OK && drv) ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n"); found = TRUE; break; } else { - WARN("waveInMessage failed\n"); + WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n"); return E_PROP_ID_UNSUPPORTED; } } @@ -543,33 +613,43 @@ ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; wodn = waveOutGetNumDevs(); for (wod = 0; wod < wodn; wod++) { - if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) { - DSDRIVERDESC desc; - ppd->WaveDeviceId = wod; - err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); - if (err == DS_OK) { - PIDSDRIVER drv = NULL; - /* FIXME: this is a memory leak */ - CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); - CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); - CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); - - strcpy(szDescription, desc.szDesc); - strcpy(szModule, desc.szDrvname); - strcpy(szInterface, "Interface"); - - ppd->Description = szDescription; - ppd->Module = szModule; - ppd->Interface = szInterface; - err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); - if (err == DS_OK && drv) - ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; - break; + if (IsEqualGUID( &dev_guid, &DSOUND_renderer_guids[wod] ) ) { + DSDRIVERDESC desc; + ppd->WaveDeviceId = wod; + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSDRIVER drv = NULL; + /* FIXME: this is a memory leak */ + CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); + CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); + + if (szDescription && szModule && szInterface) { + strcpy(szDescription, desc.szDesc); + strcpy(szModule, desc.szDrvname); + strcpy(szInterface, "Interface"); + + ppd->Description = szDescription; + ppd->Module = szModule; + ppd->Interface = szInterface; + err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); + if (err == DS_OK && drv) + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); + break; } else { - WARN("waveOutMessage failed\n"); - return E_PROP_ID_UNSUPPORTED; + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, szDescription); + HeapFree(GetProcessHeap(), 0, szModule); + HeapFree(GetProcessHeap(), 0, szInterface); + return E_OUTOFMEMORY; } + } else { + WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; } + } } } else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) || IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) { @@ -579,33 +659,43 @@ ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; widn = waveInGetNumDevs(); for (wid = 0; wid < widn; wid++) { - if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) { - DSDRIVERDESC desc; - ppd->WaveDeviceId = wid; - err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); - if (err == DS_OK) { - PIDSCDRIVER drv; - /* FIXME: this is a memory leak */ - CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); - CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); - CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); - - strcpy(szDescription, desc.szDesc); - strcpy(szModule, desc.szDrvname); - strcpy(szInterface, "Interface"); - - ppd->Description = szDescription; - ppd->Module = szModule; - ppd->Interface = szInterface; - err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); - if (err == DS_OK && drv) - ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; - break; + if (IsEqualGUID( &dev_guid, &DSOUND_capture_guids[wid] ) ) { + DSDRIVERDESC desc; + ppd->WaveDeviceId = wid; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSCDRIVER drv; + /* FIXME: this is a memory leak */ + CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); + CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); + + if (szDescription && szModule && szInterface) { + strcpy(szDescription, desc.szDesc); + strcpy(szModule, desc.szDrvname); + strcpy(szInterface, "Interface"); + + ppd->Description = szDescription; + ppd->Module = szModule; + ppd->Interface = szInterface; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); + if (err == DS_OK && drv) + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); + break; } else { - WARN("waveInMessage failed\n"); - return E_PROP_ID_UNSUPPORTED; + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, szDescription); + HeapFree(GetProcessHeap(), 0, szModule); + HeapFree(GetProcessHeap(), 0, szInterface); + return E_OUTOFMEMORY; } + } else { + WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; } + } } } else { BOOL found = FALSE; @@ -614,19 +704,20 @@ /* given specific device so try the render devices first */ wodn = waveOutGetNumDevs(); for (wod = 0; wod < wodn; wod++) { - if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) { - DSDRIVERDESC desc; - TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); - ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; - ppd->WaveDeviceId = wod; - err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); - if (err == DS_OK) { - PIDSDRIVER drv = NULL; - /* FIXME: this is a memory leak */ - CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); - CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); - CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); + if (IsEqualGUID( &ppd->DeviceId, &DSOUND_renderer_guids[wod] ) ) { + DSDRIVERDESC desc; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); + ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + ppd->WaveDeviceId = wod; + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSDRIVER drv = NULL; + /* FIXME: this is a memory leak */ + CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); + CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); + if (szDescription && szModule && szInterface) { strcpy(szDescription, desc.szDesc); strcpy(szModule, desc.szDrvname); strcpy(szInterface, "Interface"); @@ -637,13 +728,70 @@ err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); if (err == DS_OK && drv) ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); found = TRUE; break; } else { - WARN("waveOutMessage failed\n"); - return E_PROP_ID_UNSUPPORTED; + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, szDescription); + HeapFree(GetProcessHeap(), 0, szModule); + HeapFree(GetProcessHeap(), 0, szInterface); + return E_OUTOFMEMORY; } + } else { + WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; } + } + } + + if (found == FALSE) { + ULONG wid; + unsigned int widn; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n"); + ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; + widn = waveInGetNumDevs(); + for (wid = 0; wid < widn; wid++) { + if (IsEqualGUID( &ppd->DeviceId, &DSOUND_capture_guids[wod] ) ) { + DSDRIVERDESC desc; + ppd->WaveDeviceId = wid; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSCDRIVER drv; + /* FIXME: this is a memory leak */ + CHAR * szDescription = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDesc) + 1); + CHAR * szModule = HeapAlloc(GetProcessHeap(),0,strlen(desc.szDrvname) + 1); + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,strlen("Interface") + 1); + + if (szDescription && szModule && szInterface) { + strcpy(szDescription, desc.szDesc); + strcpy(szModule, desc.szDrvname); + strcpy(szInterface, "Interface"); + + ppd->Description = szDescription; + ppd->Module = szModule; + ppd->Interface = szInterface; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); + if (err == DS_OK && drv) + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); + found = TRUE; + break; + } else { + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, szDescription); + HeapFree(GetProcessHeap(), 0, szModule); + HeapFree(GetProcessHeap(), 0, szInterface); + return E_OUTOFMEMORY; + } + } else { + WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; + } + } + } } if (found == FALSE) { @@ -698,33 +846,43 @@ ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; wodn = waveOutGetNumDevs(); for (wod = 0; wod < wodn; wod++) { - if (IsEqualGUID( &dev_guid, &renderer_guids[wod] ) ) { - DSDRIVERDESC desc; - ppd->WaveDeviceId = wod; - err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); - if (err == DS_OK) { - PIDSDRIVER drv = NULL; - /* FIXME: this is a memory leak */ - WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); - - MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); - - ppd->Description = wDescription; - ppd->Module = wModule; - ppd->Interface = wInterface; - err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); - if (err == DS_OK && drv) - ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; - break; + if (IsEqualGUID( &dev_guid, &DSOUND_renderer_guids[wod] ) ) { + DSDRIVERDESC desc; + ppd->WaveDeviceId = wod; + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSDRIVER drv = NULL; + /* FIXME: this is a memory leak */ + WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); + + if (wDescription && wModule && wInterface) { + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); + + ppd->Description = wDescription; + ppd->Module = wModule; + ppd->Interface = wInterface; + err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); + if (err == DS_OK && drv) + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); + break; } else { - WARN("waveOutMessage failed\n"); - return E_PROP_ID_UNSUPPORTED; + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, wDescription); + HeapFree(GetProcessHeap(), 0, wModule); + HeapFree(GetProcessHeap(), 0, wInterface); + return E_OUTOFMEMORY; } + } else { + WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; } + } } } else if (IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultCapture) || IsEqualGUID( &ppd->DeviceId , &DSDEVID_DefaultVoiceCapture) ) { @@ -734,33 +892,43 @@ ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; widn = waveInGetNumDevs(); for (wid = 0; wid < widn; wid++) { - if (IsEqualGUID( &dev_guid, &capture_guids[wid] ) ) { - DSDRIVERDESC desc; - ppd->WaveDeviceId = wid; - err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); - if (err == DS_OK) { - PIDSCDRIVER drv; - /* FIXME: this is a memory leak */ - WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); - - MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); - - ppd->Description = wDescription; - ppd->Module = wModule; - ppd->Interface = wInterface; - err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); - if (err == DS_OK && drv) - ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + if (IsEqualGUID( &dev_guid, &DSOUND_capture_guids[wid] ) ) { + DSDRIVERDESC desc; + ppd->WaveDeviceId = wid; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSCDRIVER drv; + /* FIXME: this is a memory leak */ + WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); + + if (wDescription && wModule && wInterface) { + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); + + ppd->Description = wDescription; + ppd->Module = wModule; + ppd->Interface = wInterface; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); + if (err == DS_OK && drv) + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n"); break; } else { - WARN("waveInMessage failed\n"); - return E_PROP_ID_UNSUPPORTED; + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, wDescription); + HeapFree(GetProcessHeap(), 0, wModule); + HeapFree(GetProcessHeap(), 0, wInterface); + return E_OUTOFMEMORY; } + } else { + WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; } + } } } else { BOOL found = FALSE; @@ -769,19 +937,20 @@ /* given specific device so try the render devices first */ wodn = waveOutGetNumDevs(); for (wod = 0; wod < wodn; wod++) { - if (IsEqualGUID( &ppd->DeviceId, &renderer_guids[wod] ) ) { - DSDRIVERDESC desc; - TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); - ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; - ppd->WaveDeviceId = wod; - err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); - if (err == DS_OK) { - PIDSDRIVER drv = NULL; - /* FIXME: this is a memory leak */ - WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); + if (IsEqualGUID( &ppd->DeviceId, &DSOUND_renderer_guids[wod] ) ) { + DSDRIVERDESC desc; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_RENDER\n"); + ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + ppd->WaveDeviceId = wod; + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSDRIVER drv = NULL; + /* FIXME: this is a memory leak */ + WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); + if (wDescription && wModule && wInterface) { MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); @@ -791,14 +960,71 @@ ppd->Interface = wInterface; err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDSOUNDIFACE, (DWORD)&drv, 0)); if (err == DS_OK && drv) - ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveOutMessage(DRV_QUERYDSOUNDIFACE) failed\n"); found = TRUE; break; } else { - WARN("waveOutMessage failed\n"); - return E_PROP_ID_UNSUPPORTED; + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, wDescription); + HeapFree(GetProcessHeap(), 0, wModule); + HeapFree(GetProcessHeap(), 0, wInterface); + return E_OUTOFMEMORY; } + } else { + WARN("waveOutMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; } + } + } + + if (found == FALSE) { + ULONG wid; + unsigned int widn; + TRACE("DataFlow=DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE\n"); + ppd->DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; + widn = waveInGetNumDevs(); + for (wid = 0; wid < widn; wid++) { + if (IsEqualGUID( &dev_guid, &DSOUND_capture_guids[wid] ) ) { + DSDRIVERDESC desc; + ppd->WaveDeviceId = wid; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&(desc),0)); + if (err == DS_OK) { + PIDSCDRIVER drv; + /* FIXME: this is a memory leak */ + WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); + + if (wDescription && wModule && wInterface) { + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); + + ppd->Description = wDescription; + ppd->Module = wModule; + ppd->Interface = wInterface; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDIFACE,(DWORD)&drv,0)); + if (err == DS_OK && drv) + ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD; + else + WARN("waveInMessage(DRV_QUERYDSOUNDIFACE) failed\n"); + found = TRUE; + break; + } else { + WARN("no memory\n"); + HeapFree(GetProcessHeap(), 0, wDescription); + HeapFree(GetProcessHeap(), 0, wModule); + HeapFree(GetProcessHeap(), 0, wInterface); + return E_OUTOFMEMORY; + } + } else { + WARN("waveInMessage(DRV_QUERYDSOUNDDESC) failed\n"); + return E_PROP_ID_UNSUPPORTED; + } + } + } } if (found == FALSE) { @@ -821,8 +1047,68 @@ ULONG cbPropData, PULONG pcbReturned ) { - FIXME("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", + PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA ppd = (PDSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA) pPropData; + HRESULT err; + TRACE("(guidPropSet=%s,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", debugstr_guid(guidPropSet),pPropData,cbPropData,pcbReturned); + + if ( IsEqualGUID( &DSPROPSETID_DirectSoundDevice, guidPropSet) ) { + if (ppd) { + if (ppd->Callback) { + unsigned devs, wod, wid; + DSDRIVERDESC desc; + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data; + + devs = waveOutGetNumDevs(); + for (wod = 0; wod < devs; ++wod) { + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); + if (err == DS_OK) { + ZeroMemory(&data, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + data.WaveDeviceId = wod; + data.DeviceId = DSOUND_renderer_guids[wod]; + lstrcpynA(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA)); + lstrcpynA(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA)); + + MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW) ); + MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW) ); + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + } + + devs = waveInGetNumDevs(); + for (wid = 0; wid < devs; ++wid) { + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); + if (err == DS_OK) { + ZeroMemory(&data, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + data.WaveDeviceId = wod; + data.DeviceId = DSOUND_renderer_guids[wod]; + lstrcpynA(data.DescriptionA, desc.szDesc, sizeof(data.DescriptionA)); + lstrcpynA(data.ModuleA, desc.szDrvname, sizeof(data.ModuleA)); + + MultiByteToWideChar( CP_ACP, 0, data.DescriptionA, -1, data.DescriptionW, sizeof(data.DescriptionW) ); + MultiByteToWideChar( CP_ACP, 0, data.ModuleA, -1, data.ModuleW, sizeof(data.ModuleW) ); + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + } + + return S_OK; + } + } + } else { + FIXME("unsupported property: %s\n",debugstr_guid(guidPropSet)); + } + + if (pcbReturned) { + *pcbReturned = 0; + FIXME("*pcbReturned=%ld\n", *pcbReturned); + } + return E_PROP_ID_UNSUPPORTED; } @@ -849,27 +1135,30 @@ err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { DWORD size; - ZeroMemory(&data, sizeof(data)); - data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; - data.WaveDeviceId = wod; - data.DeviceId = renderer_guids[wod]; - data.Description = desc.szDesc; - data.Module = desc.szDrvname; err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0)); if (err == DS_OK) { WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size); - err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); - if (err == DS_OK) { - CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); - WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); - data.Interface = szInterface; - - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); - - HeapFree(GetProcessHeap(),0,szInterface); + if (nameW) { + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); + if (err == DS_OK) { + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); + if (szInterface) { + ZeroMemory(&data, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + data.WaveDeviceId = wod; + data.DeviceId = DSOUND_renderer_guids[wod]; + data.Description = desc.szDesc; + data.Module = desc.szDrvname; + WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); + data.Interface = szInterface; + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + HeapFree(GetProcessHeap(),0,szInterface); + } } - HeapFree(GetProcessHeap(),0,nameW); + HeapFree(GetProcessHeap(),0,nameW); } } } @@ -879,27 +1168,30 @@ err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { DWORD size; - ZeroMemory(&data, sizeof(data)); - data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; - data.WaveDeviceId = wid; - data.DeviceId = capture_guids[wid]; - data.Description = desc.szDesc; - data.Module = desc.szDrvname; err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0)); if (err == DS_OK) { WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size); - err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); - if (err == DS_OK) { - CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); - WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); - data.Interface = szInterface; - - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); - - HeapFree(GetProcessHeap(),0,szInterface); + if (nameW) { + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); + if (err == DS_OK) { + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); + if (szInterface) { + ZeroMemory(&data, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; + data.WaveDeviceId = wid; + data.DeviceId = DSOUND_capture_guids[wid]; + data.Description = desc.szDesc; + data.Module = desc.szDrvname; + WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); + data.Interface = szInterface; + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + HeapFree(GetProcessHeap(),0,szInterface); + } } - HeapFree(GetProcessHeap(),0,nameW); + HeapFree(GetProcessHeap(),0,nameW); } } } @@ -943,31 +1235,35 @@ if (err == DS_OK) { WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - DWORD size; - err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); - if (err == DS_OK) { - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size); - err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size)); + if (wDescription && wModule) { + DWORD size; + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); if (err == DS_OK) { - ZeroMemory(&data, sizeof(data)); - data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; - data.WaveDeviceId = wod; - data.DeviceId = renderer_guids[wod]; - - MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); - - data.Description = wDescription; - data.Module = wModule; - data.Interface = wInterface; - - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size); + if (wInterface) { + err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size)); + if (err == DS_OK) { + ZeroMemory(&data, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + data.WaveDeviceId = wod; + data.DeviceId = DSOUND_renderer_guids[wod]; + + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); + + data.Description = wDescription; + data.Module = wModule; + data.Interface = wInterface; + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + } + HeapFree(GetProcessHeap(),0,wInterface); } - HeapFree(GetProcessHeap(),0,wInterface); } - HeapFree(GetProcessHeap(),0,wDescription); - HeapFree(GetProcessHeap(),0,wModule); + HeapFree(GetProcessHeap(),0,wDescription); + HeapFree(GetProcessHeap(),0,wModule); } } @@ -977,30 +1273,34 @@ if (err == DS_OK) { WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - DWORD size; - err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); - if (err == DS_OK) { - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size); - err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size)); + if (wDescription && wModule) { + DWORD size; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); if (err == DS_OK) { - ZeroMemory(&data, sizeof(data)); - data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; - data.WaveDeviceId = wid; - data.DeviceId = capture_guids[wid]; - - MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); - - data.Description = wDescription; - data.Module = wModule; - data.Interface = wInterface; - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size); + if (wInterface) { + err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size)); + if (err == DS_OK) { + ZeroMemory(&data, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; + data.WaveDeviceId = wid; + data.DeviceId = DSOUND_capture_guids[wid]; + + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvname, -1, wModule, 0x100 ); + + data.Description = wDescription; + data.Module = wModule; + data.Interface = wInterface; + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + } + HeapFree(GetProcessHeap(),0,wInterface); } - HeapFree(GetProcessHeap(),0,wInterface); } - HeapFree(GetProcessHeap(),0,wDescription); - HeapFree(GetProcessHeap(),0,wModule); + HeapFree(GetProcessHeap(),0,wDescription); + HeapFree(GetProcessHeap(),0,wModule); } } @@ -1027,8 +1327,8 @@ ULONG cbInstanceData, LPVOID pPropData, ULONG cbPropData, - PULONG pcbReturned -) { + PULONG pcbReturned ) +{ IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface; TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned); diff -urN wine-20050310/dlls/dsound/tests/dsound.c wine-20050419/dlls/dsound/tests/dsound.c --- wine-20050310/dlls/dsound/tests/dsound.c 2005-03-05 12:15:27.000000000 +0100 +++ wine-20050419/dlls/dsound/tests/dsound.c 2005-03-30 12:21:44.000000000 +0200 @@ -98,7 +98,7 @@ trace(" No Device\n"); return; } else if (rc==DSERR_ALLOCATED) { - trace(" Already Allocated\n"); + trace(" Already In Use\n"); return; } } diff -urN wine-20050310/dlls/dsound/tests/dsound8.c wine-20050419/dlls/dsound/tests/dsound8.c --- wine-20050310/dlls/dsound/tests/dsound8.c 2005-03-05 11:49:08.000000000 +0100 +++ wine-20050419/dlls/dsound/tests/dsound8.c 2005-04-11 14:52:00.000000000 +0200 @@ -104,15 +104,18 @@ DXGetErrorString8(rc)); rc=IDirectSound8_Initialize(dso,lpGuid); - ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, + ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "IDirectSound8_Initialize() failed: %s\n",DXGetErrorString8(rc)); if (rc==DSERR_NODRIVER) { trace(" No Driver\n"); return; + } else if (rc==E_FAIL) { + trace(" No Device\n"); + return; } else if (rc==DSERR_ALLOCATED) { trace(" Already In Use\n"); return; - } + } } /* DSOUND: Error: Invalid caps buffer */ @@ -228,21 +231,21 @@ /* try with no device specified */ rc=pDirectSoundCreate8(NULL,&dso,NULL); - ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, + ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL); /* try with default playback device specified */ rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL); - ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, + ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL); /* try with default voice playback device specified */ rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL); - ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, + ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); if (rc==DS_OK && dso) IDirectSound8_test(dso, TRUE, NULL); @@ -266,7 +269,7 @@ /* Create the DirectSound8 object */ rc=pDirectSoundCreate8(lpGuid,&dso,NULL); - ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, + ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc)); if (rc!=DS_OK) return rc; @@ -799,7 +802,7 @@ if (GetFileVersionInfoA("dsound.dll", handle, size, data)) { VS_FIXEDFILEINFO *pFixedVersionInfo; UINT len; - if (VerQueryValueA(data, "\\", (LPLPVOID)&pFixedVersionInfo, &len)) { + if (VerQueryValueA(data, "\\", (LPVOID *)&pFixedVersionInfo, &len)) { sprintf(version, "%ld.%ld.%ld.%ld", pFixedVersionInfo->dwFileVersionMS >> 16, pFixedVersionInfo->dwFileVersionMS & 0xffff, diff -urN wine-20050310/dlls/dsound/tests/propset.c wine-20050419/dlls/dsound/tests/propset.c --- wine-20050310/dlls/dsound/tests/propset.c 2005-03-05 11:49:08.000000000 +0100 +++ wine-20050419/dlls/dsound/tests/propset.c 2005-03-14 11:04:07.000000000 +0100 @@ -64,6 +64,94 @@ BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data, LPVOID context) { + trace(" found device:\n"); + trace(" Type: %s\n", + data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" : + data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" : + data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown"); + trace(" DataFlow: %s\n", + data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" : + data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? + "Capture" : "Unknown"); + trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3, + data->DeviceId.Data4[0],data->DeviceId.Data4[1], + data->DeviceId.Data4[2],data->DeviceId.Data4[3], + data->DeviceId.Data4[4],data->DeviceId.Data4[5], + data->DeviceId.Data4[6],data->DeviceId.Data4[7]); + trace(" Description: %s\n", data->Description); + trace(" Module: %s\n", data->Module); + trace(" Interface: %s\n", data->Interface); + trace(" WaveDeviceId: %ld\n", data->WaveDeviceId); + + return TRUE; +} + +BOOL CALLBACK callback1(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data, + LPVOID context) +{ + char descriptionA[0x100]; + char moduleA[MAX_PATH]; + + trace(" found device:\n"); + trace(" Type: %s\n", + data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" : + data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" : + data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown"); + trace(" DataFlow: %s\n", + data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" : + data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? + "Capture" : "Unknown"); + trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3, + data->DeviceId.Data4[0],data->DeviceId.Data4[1], + data->DeviceId.Data4[2],data->DeviceId.Data4[3], + data->DeviceId.Data4[4],data->DeviceId.Data4[5], + data->DeviceId.Data4[6],data->DeviceId.Data4[7]); + trace(" DescriptionA: %s\n", data->DescriptionA); + WideCharToMultiByte(CP_ACP, 0, data->DescriptionW, -1, descriptionA, sizeof(descriptionA), NULL, NULL); + trace(" DescriptionW: %s\n", descriptionA); + trace(" ModuleA: %s\n", data->ModuleA); + WideCharToMultiByte(CP_ACP, 0, data->ModuleW, -1, moduleA, sizeof(moduleA), NULL, NULL); + trace(" ModuleW: %s\n", moduleA); + trace(" WaveDeviceId: %ld\n", data->WaveDeviceId); + + return TRUE; +} + +BOOL CALLBACK callbackA(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A_DATA data, + LPVOID context) +{ + trace(" found device:\n"); + trace(" Type: %s\n", + data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" : + data->Type == DIRECTSOUNDDEVICE_TYPE_VXD ? "VxD" : + data->Type == DIRECTSOUNDDEVICE_TYPE_WDM ? "WDM" : "Unknown"); + trace(" DataFlow: %s\n", + data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_RENDER ? "Render" : + data->DataFlow == DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE ? + "Capture" : "Unknown"); + trace(" DeviceId: {%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n", + data->DeviceId.Data1,data->DeviceId.Data2,data->DeviceId.Data3, + data->DeviceId.Data4[0],data->DeviceId.Data4[1], + data->DeviceId.Data4[2],data->DeviceId.Data4[3], + data->DeviceId.Data4[4],data->DeviceId.Data4[5], + data->DeviceId.Data4[6],data->DeviceId.Data4[7]); + trace(" Description: %s\n", data->Description); + trace(" Module: %s\n", data->Module); + trace(" Interface: %s\n", data->Interface); + trace(" WaveDeviceId: %ld\n", data->WaveDeviceId); + + return TRUE; +} + +BOOL CALLBACK callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data, + LPVOID context) +{ + char descriptionA[0x100]; + char moduleA[MAX_PATH]; + char interfaceA[MAX_PATH]; + trace("found device:\n"); trace("\tType: %s\n", data->Type == DIRECTSOUNDDEVICE_TYPE_EMULATED ? "Emulated" : @@ -79,9 +167,12 @@ data->DeviceId.Data4[2],data->DeviceId.Data4[3], data->DeviceId.Data4[4],data->DeviceId.Data4[5], data->DeviceId.Data4[6],data->DeviceId.Data4[7]); - trace("\tDescription: %s\n", data->Description); - trace("\tModule: %s\n", data->Module); - trace("\tInterface: %s\n", data->Interface); + WideCharToMultiByte(CP_ACP, 0, data->Description, -1, descriptionA, sizeof(descriptionA), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, data->Module, -1, moduleA, sizeof(moduleA), NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, data->Interface, -1, interfaceA, sizeof(interfaceA), NULL, NULL); + trace("\tDescription: %s\n", descriptionA); + trace("\tModule: %s\n", moduleA); + trace("\tInterface: %s\n", interfaceA); trace("\tWaveDeviceId: %ld\n", data->WaveDeviceId); return TRUE; @@ -104,6 +195,7 @@ fProc = (MYPROC)GetProcAddress(hDsound, "DllGetClassObject"); /* try direct sound first */ + /* DSOUND: Error: Invalid interface buffer */ rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0); ok(rc==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, " "IID_IClassFactory) should have returned DSERR_INVALIDPARAM, " @@ -116,6 +208,7 @@ goto error; /* direct sound doesn't have an IKsPropertySet */ + /* DSOUND: Error: Invalid interface buffer */ rc = pcf->lpVtbl->CreateInstance(pcf, NULL, &IID_IKsPropertySet, (void **)0); ok(rc==DSERR_INVALIDPARAM, "CreateInstance(IID_IKsPropertySet) should have " @@ -192,8 +285,8 @@ /* try direct sound private last */ rc = (fProc)(&CLSID_DirectSoundPrivate, &IID_IClassFactory, (void **)(&pcf)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundPrivate, " - "IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc)); + + /* some early versions of Direct Sound do not have this */ if (pcf==0) goto error; @@ -205,10 +298,12 @@ if (rc!=DS_OK) goto error; + /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION */ rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION, &support); - ok(rc==DS_OK||rc==E_INVALIDARG, "QuerySupport(DSPROPSETID_DirectSoundDevice, " + ok(rc==DS_OK||rc==E_INVALIDARG, + "QuerySupport(DSPROPSETID_DirectSoundDevice, " "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION) failed: %s\n", DXGetErrorString8(rc)); if (rc!=DS_OK) { @@ -224,6 +319,70 @@ "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION: " "support = 0x%lx\n",support); + /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 */ + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1, + &support); + ok(rc==DS_OK||rc==E_INVALIDARG, + "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) { + if (rc==E_INVALIDARG) + trace(" Not Supported\n"); + goto error; + } + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET), + "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: " + "support = 0x%lx\n",support); + + /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A */ + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A, + &support); + ok(rc==DS_OK||rc==E_INVALIDARG, + "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) { + if (rc==E_INVALIDARG) + trace(" Not Supported\n"); + goto error; + } + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET), + "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A: " + "support = 0x%lx\n",support); + + /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W */ + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W, + &support); + ok(rc==DS_OK||rc==E_INVALIDARG, + "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) { + if (rc==E_INVALIDARG) + trace(" Not Supported\n"); + goto error; + } + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET), + "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W: " + "support = 0x%lx\n",support); + + /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING */ rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING, &support); ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " @@ -239,6 +398,40 @@ "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: support = " "0x%lx\n",support); + /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A */ + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A, &support); + ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto error; + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set " + "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: support = " + "0x%lx\n",support); + + /* test DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W */ + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W, &support); + ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto error; + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET), "Shouldn't be able to set " + "DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: support = " + "0x%lx\n",support); + + /* test generic DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE */ + trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE ***\n"); rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE, &support); @@ -265,6 +458,96 @@ DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE, NULL, 0, &data, sizeof(data), &bytes); ok(rc==DS_OK, "Couldn't enumerate: 0x%lx\n",rc); + } + + /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 */ + trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 ***\n"); + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1, + &support); + ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto error; + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set " + "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: support = 0x%lx\n",support); + + if (support & KSPROPERTY_SUPPORT_GET) { + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1_DATA data; + ULONG bytes; + + data.Callback = callback1; + data.Context = 0; + + rc = pps->lpVtbl->Get(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1, + NULL, 0, &data, sizeof(data), &bytes); + ok(rc==DS_OK, "Couldn't enumerate: 0x%lx\n",rc); + } + + /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A */ + trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A ***\n"); + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A, + &support); + ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto error; + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set " + "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: support = 0x%lx\n",support); + + if (support & KSPROPERTY_SUPPORT_GET) { + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A_DATA data; + ULONG bytes; + + data.Callback = callbackA; + data.Context = 0; + + rc = pps->lpVtbl->Get(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A, + NULL, 0, &data, sizeof(data), &bytes); + ok(rc==DS_OK, "Couldn't enumerate: 0x%lx\n",rc); + } + + /* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W */ + trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W ***\n"); + rc = pps->lpVtbl->QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W, + &support); + ok(rc==DS_OK, "QuerySupport(DSPROPSETID_DirectSoundDevice, " + "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n", + DXGetErrorString8(rc)); + if (rc!=DS_OK) + goto error; + + ok(support & KSPROPERTY_SUPPORT_GET, + "Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: " + "support = 0x%lx\n",support); + ok(!(support & KSPROPERTY_SUPPORT_SET),"Shouldn't be able to set " + "DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: support = 0x%lx\n",support); + + if (support & KSPROPERTY_SUPPORT_GET) { + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W_DATA data; + ULONG bytes; + + data.Callback = callbackW; + data.Context = 0; + + rc = pps->lpVtbl->Get(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W, + NULL, 0, &data, sizeof(data), &bytes); + ok(rc==DS_OK, "Couldn't enumerate: 0x%lx\n",rc); } error: diff -urN wine-20050310/dlls/dswave/dswave.c wine-20050419/dlls/dswave/dswave.c --- wine-20050310/dlls/dswave/dswave.c 2005-02-01 15:21:37.000000000 +0100 +++ wine-20050419/dlls/dswave/dswave.c 2005-03-28 16:17:52.000000000 +0200 @@ -346,11 +346,11 @@ if (pDesc->dwValidData & DMUS_OBJ_CLASS) memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); if (pDesc->dwValidData & DMUS_OBJ_NAME) - strncpyW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - strncpyW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - strncpyW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); if (pDesc->dwValidData & DMUS_OBJ_VERSION) memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); if (pDesc->dwValidData & DMUS_OBJ_DATE) diff -urN wine-20050310/dlls/gdi/bitmap.c wine-20050419/dlls/gdi/bitmap.c --- wine-20050310/dlls/gdi/bitmap.c 2004-12-23 19:41:06.000000000 +0100 +++ wine-20050419/dlls/gdi/bitmap.c 2005-04-13 18:11:18.000000000 +0200 @@ -277,7 +277,6 @@ bmpobj->bitmap = bm; bmpobj->bitmap.bmBits = NULL; bmpobj->funcs = NULL; - bmpobj->physBitmap = NULL; bmpobj->dib = NULL; bmpobj->segptr_bits = 0; diff -urN wine-20050310/dlls/gdi/clipping.c wine-20050419/dlls/gdi/clipping.c --- wine-20050310/dlls/gdi/clipping.c 2004-09-02 22:08:30.000000000 +0200 +++ wine-20050419/dlls/gdi/clipping.c 2005-03-31 12:19:40.000000000 +0200 @@ -33,12 +33,27 @@ /*********************************************************************** + * get_clip_region + * + * Return the total clip region (if any). + */ +static inline HRGN get_clip_region( DC * dc ) +{ + if (dc->hMetaClipRgn) return dc->hMetaClipRgn; + if (dc->hMetaRgn) return dc->hMetaRgn; + return dc->hClipRgn; +} + + +/*********************************************************************** * CLIPPING_UpdateGCRegion * * Update the GC clip region when the ClipRgn or VisRgn have changed. */ void CLIPPING_UpdateGCRegion( DC * dc ) { + HRGN clip_rgn; + if (!dc->hVisRgn) { ERR("hVisRgn is zero. Please report this.\n" ); @@ -47,12 +62,26 @@ if (dc->flags & DC_DIRTY) ERR( "DC is dirty. Please report this.\n" ); + /* update the intersection of meta and clip regions */ + if (dc->hMetaRgn && dc->hClipRgn) + { + if (!dc->hMetaClipRgn) dc->hMetaClipRgn = CreateRectRgn( 0, 0, 0, 0 ); + CombineRgn( dc->hMetaClipRgn, dc->hClipRgn, dc->hMetaRgn, RGN_AND ); + clip_rgn = dc->hMetaClipRgn; + } + else /* only one is set, no need for an intersection */ + { + if (dc->hMetaClipRgn) DeleteObject( dc->hMetaClipRgn ); + dc->hMetaClipRgn = 0; + clip_rgn = dc->hMetaRgn ? dc->hMetaRgn : dc->hClipRgn; + } + if (dc->funcs->pSetDeviceClipping) - dc->funcs->pSetDeviceClipping( dc->physDev, dc->hVisRgn, dc->hClipRgn ); + dc->funcs->pSetDeviceClipping( dc->physDev, dc->hVisRgn, clip_rgn ); } /*********************************************************************** - * create_default_clip_rgn + * create_default_clip_region * * Create a default clipping region when none already exists. */ @@ -346,6 +375,7 @@ { POINT pt; BOOL ret; + HRGN clip; DC *dc = DC_GetDCUpdate( hdc ); TRACE("%p %d,%d\n", hdc, x, y ); @@ -355,7 +385,7 @@ pt.y = y; LPtoDP( hdc, &pt, 1 ); ret = PtInRegion( dc->hVisRgn, pt.x, pt.y ); - if (ret && dc->hClipRgn) ret = PtInRegion( dc->hClipRgn, pt.x, pt.y ); + if (ret && (clip = get_clip_region(dc))) ret = PtInRegion( clip, pt.x, pt.y ); GDI_ReleaseObj( hdc ); return ret; } @@ -368,6 +398,7 @@ { RECT tmpRect; BOOL ret; + HRGN clip; DC *dc = DC_GetDCUpdate( hdc ); if (!dc) return FALSE; TRACE("%p %ld,%ldx%ld,%ld\n", hdc, rect->left, rect->top, rect->right, rect->bottom ); @@ -375,10 +406,10 @@ tmpRect = *rect; LPtoDP( hdc, (POINT *)&tmpRect, 2 ); - if (dc->hClipRgn) + if ((clip = get_clip_region(dc))) { HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 ); - CombineRgn( hrgn, dc->hVisRgn, dc->hClipRgn, RGN_AND ); + CombineRgn( hrgn, dc->hVisRgn, clip, RGN_AND ); ret = RectInRegion( hrgn, &tmpRect ); DeleteObject( hrgn ); } @@ -394,12 +425,13 @@ INT WINAPI GetClipBox( HDC hdc, LPRECT rect ) { INT ret; + HRGN clip; DC *dc = DC_GetDCUpdate( hdc ); if (!dc) return ERROR; - if (dc->hClipRgn) + if ((clip = get_clip_region(dc))) { HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 ); - CombineRgn( hrgn, dc->hVisRgn, dc->hClipRgn, RGN_AND ); + CombineRgn( hrgn, dc->hVisRgn, clip, RGN_AND ); ret = GetRgnBox( hrgn, rect ); DeleteObject( hrgn ); } @@ -429,44 +461,49 @@ return ret; } + +/*********************************************************************** + * GetMetaRgn (GDI32.@) + */ +INT WINAPI GetMetaRgn( HDC hdc, HRGN hRgn ) +{ + INT ret = 0; + DC * dc = DC_GetDCPtr( hdc ); + + if (dc) + { + if (dc->hMetaRgn && CombineRgn( hRgn, dc->hMetaRgn, 0, RGN_COPY ) != ERROR) + ret = 1; + GDI_ReleaseObj( hdc ); + } + return ret; +} + + /*********************************************************************** * SaveVisRgn (GDI.129) */ HRGN16 WINAPI SaveVisRgn16( HDC16 hdc16 ) { - HRGN copy; - GDIOBJHDR *obj, *copyObj; + struct saved_visrgn *saved; HDC hdc = HDC_32( hdc16 ); DC *dc = DC_GetDCUpdate( hdc ); if (!dc) return 0; TRACE("%p\n", hdc ); - if (!(obj = GDI_GetObjPtr( dc->hVisRgn, REGION_MAGIC ))) - { - GDI_ReleaseObj( hdc ); - return 0; - } - if (!(copy = CreateRectRgn( 0, 0, 0, 0 ))) - { - GDI_ReleaseObj( dc->hVisRgn ); - GDI_ReleaseObj( hdc ); - return 0; - } - CombineRgn( copy, dc->hVisRgn, 0, RGN_COPY ); - if (!(copyObj = GDI_GetObjPtr( copy, REGION_MAGIC ))) - { - DeleteObject( copy ); - GDI_ReleaseObj( dc->hVisRgn ); - GDI_ReleaseObj( hdc ); - return 0; - } - copyObj->hNext = obj->hNext; - obj->hNext = HRGN_16(copy); - GDI_ReleaseObj( copy ); - GDI_ReleaseObj( dc->hVisRgn ); + if (!(saved = HeapAlloc( GetProcessHeap(), 0, sizeof(*saved) ))) goto error; + if (!(saved->hrgn = CreateRectRgn( 0, 0, 0, 0 ))) goto error; + CombineRgn( saved->hrgn, dc->hVisRgn, 0, RGN_COPY ); + saved->next = dc->saved_visrgn; + dc->saved_visrgn = saved; GDI_ReleaseObj( hdc ); - return HRGN_16(copy); + return HRGN_16(saved->hrgn); + +error: + GDI_ReleaseObj( hdc ); + HeapFree( GetProcessHeap(), 0, saved ); + return 0; } @@ -475,8 +512,7 @@ */ INT16 WINAPI RestoreVisRgn16( HDC16 hdc16 ) { - HRGN saved; - GDIOBJHDR *obj, *savedObj; + struct saved_visrgn *saved; HDC hdc = HDC_32( hdc16 ); DC *dc = DC_GetDCPtr( hdc ); INT16 ret = ERROR; @@ -485,19 +521,14 @@ TRACE("%p\n", hdc ); - if (!(obj = GDI_GetObjPtr( dc->hVisRgn, REGION_MAGIC ))) goto done; - saved = HRGN_32(obj->hNext); + if (!(saved = dc->saved_visrgn)) goto done; - if ((savedObj = GDI_GetObjPtr( saved, REGION_MAGIC ))) - { - ret = CombineRgn( dc->hVisRgn, saved, 0, RGN_COPY ); - obj->hNext = savedObj->hNext; - GDI_ReleaseObj( saved ); - DeleteObject( saved ); - dc->flags &= ~DC_DIRTY; - CLIPPING_UpdateGCRegion( dc ); - } - GDI_ReleaseObj( dc->hVisRgn ); + ret = CombineRgn( dc->hVisRgn, saved->hrgn, 0, RGN_COPY ); + dc->saved_visrgn = saved->next; + DeleteObject( saved->hrgn ); + HeapFree( GetProcessHeap(), 0, saved ); + dc->flags &= ~DC_DIRTY; + CLIPPING_UpdateGCRegion( dc ); done: GDI_ReleaseObj( hdc ); return ret; @@ -520,59 +551,74 @@ */ INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, INT iCode) { + HRGN rgn; + DC *dc = DC_GetDCPtr( hDC ); + + if (!dc) return -1; + switch (iCode) { + case 1: + rgn = dc->hClipRgn; + break; + case 2: + rgn = dc->hMetaRgn; + break; + case 3: + rgn = dc->hMetaClipRgn; + break; case SYSRGN: /* == 4 */ - { - DC *dc = DC_GetDCPtr (hDC); - if (!dc) return -1; - - CombineRgn (hRgn, dc->hVisRgn, 0, RGN_COPY); - GDI_ReleaseObj( hDC ); - /* - * On Windows NT/2000, - * the region returned is in screen coordinates. - * On Windows 95/98, - * the region returned is in window coordinates - */ - if (!(GetVersion() & 0x80000000)) - { - POINT org; - GetDCOrgEx(hDC, &org); - OffsetRgn(hRgn, org.x, org.y); - } - return 1; - } - - case 1: /* clip region */ - return GetClipRgn (hDC, hRgn); - + rgn = dc->hVisRgn; + break; default: - WARN("Unknown iCode %d\n", iCode); + WARN("Unknown code %d\n", iCode); + GDI_ReleaseObj( hDC ); return -1; } + if (rgn) CombineRgn( hRgn, rgn, 0, RGN_COPY ); + GDI_ReleaseObj( hDC ); - return -1; + /* On Windows NT/2000, the region returned is in screen coordinates */ + if (!(GetVersion() & 0x80000000)) + { + POINT org; + GetDCOrgEx( hDC, &org ); + OffsetRgn( hRgn, org.x, org.y ); + } + return (rgn != 0); } /*********************************************************************** - * GetMetaRgn (GDI32.@) + * SetMetaRgn (GDI32.@) */ -INT WINAPI GetMetaRgn( HDC hdc, HRGN hRgn ) +INT WINAPI SetMetaRgn( HDC hdc ) { - FIXME( "stub\n" ); + INT ret; + RECT dummy; + DC *dc = DC_GetDCPtr( hdc ); - return 0; -} + if (!dc) return ERROR; + if (dc->hMetaClipRgn) + { + /* the intersection becomes the new meta region */ + DeleteObject( dc->hMetaRgn ); + DeleteObject( dc->hClipRgn ); + dc->hMetaRgn = dc->hMetaClipRgn; + dc->hClipRgn = 0; + dc->hMetaClipRgn = 0; + } + else if (dc->hClipRgn) + { + dc->hMetaRgn = dc->hClipRgn; + dc->hClipRgn = 0; + } + /* else nothing to do */ -/*********************************************************************** - * SetMetaRgn (GDI32.@) - */ -INT WINAPI SetMetaRgn( HDC hdc ) -{ - FIXME( "stub\n" ); + /* Note: no need to call CLIPPING_UpdateGCRegion, the overall clip region hasn't changed */ - return ERROR; + ret = GetRgnBox( dc->hMetaRgn, &dummy ); + GDI_ReleaseObj( hdc ); + return ret; } diff -urN wine-20050310/dlls/gdi/dc.c wine-20050419/dlls/gdi/dc.c --- wine-20050310/dlls/gdi/dc.c 2005-01-10 13:30:18.000000000 +0100 +++ wine-20050419/dlls/gdi/dc.c 2005-04-14 15:57:55.000000000 +0200 @@ -64,6 +64,7 @@ dc->funcs = funcs; dc->physDev = NULL; dc->saveLevel = 0; + dc->saved_dc = 0; dc->dwHookData = 0; dc->hookProc = NULL; dc->hookThunk = NULL; @@ -79,6 +80,8 @@ dc->flags = 0; dc->layout = 0; dc->hClipRgn = 0; + dc->hMetaRgn = 0; + dc->hMetaClipRgn = 0; dc->hVisRgn = 0; dc->hPen = GetStockObject( BLACK_PEN ); dc->hBrush = GetStockObject( WHITE_BRUSH ); @@ -121,6 +124,7 @@ dc->BoundsRect.top = 0; dc->BoundsRect.right = 0; dc->BoundsRect.bottom = 0; + dc->saved_visrgn = NULL; PATH_InitGdiPath(&dc->path); return dc; } @@ -334,23 +338,32 @@ newdc->hSelf = (HDC)handle; newdc->saveLevel = 0; + newdc->saved_dc = 0; PATH_InitGdiPath( &newdc->path ); newdc->pAbortProc = NULL; newdc->hookThunk = NULL; newdc->hookProc = 0; + newdc->saved_visrgn = NULL; /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */ - newdc->hVisRgn = 0; + newdc->hVisRgn = 0; + newdc->hClipRgn = 0; + newdc->hMetaRgn = 0; + newdc->hMetaClipRgn = 0; if (dc->hClipRgn) { - newdc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 ); - CombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY ); + newdc->hClipRgn = CreateRectRgn( 0, 0, 0, 0 ); + CombineRgn( newdc->hClipRgn, dc->hClipRgn, 0, RGN_COPY ); } - else - newdc->hClipRgn = 0; + if (dc->hMetaRgn) + { + newdc->hMetaRgn = CreateRectRgn( 0, 0, 0, 0 ); + CombineRgn( newdc->hMetaRgn, dc->hMetaRgn, 0, RGN_COPY ); + } + /* don't bother recomputing hMetaClipRgn, we'll do that in SetDCState */ if(dc->gdiFont) { newdc->gdiFont = dc->gdiFont; @@ -432,6 +445,16 @@ if (dc->hClipRgn) DeleteObject( dc->hClipRgn ); dc->hClipRgn = 0; } + if (dcs->hMetaRgn) + { + if (!dc->hMetaRgn) dc->hMetaRgn = CreateRectRgn( 0, 0, 0, 0 ); + CombineRgn( dc->hMetaRgn, dcs->hMetaRgn, 0, RGN_COPY ); + } + else + { + if (dc->hMetaRgn) DeleteObject( dc->hMetaRgn ); + dc->hMetaRgn = 0; + } CLIPPING_UpdateGCRegion( dc ); SelectObject( hdc, dcs->hBitmap ); @@ -504,8 +527,8 @@ return 0; } - dcs->header.hNext = dc->header.hNext; - dc->header.hNext = HDC_16(hdcs); + dcs->saved_dc = dc->saved_dc; + dc->saved_dc = hdcs; TRACE("(%p): returning %d\n", hdc, dc->saveLevel+1 ); ret = ++dc->saveLevel; GDI_ReleaseObj( hdcs ); @@ -548,13 +571,14 @@ success=TRUE; while (dc->saveLevel >= level) { - HDC hdcs = HDC_32(dc->header.hNext); + HDC hdcs = dc->saved_dc; if (!(dcs = DC_GetDCPtr( hdcs ))) { GDI_ReleaseObj( hdc ); return FALSE; } - dc->header.hNext = dcs->header.hNext; + dc->saved_dc = dcs->saved_dc; + dcs->saved_dc = 0; if (--dc->saveLevel < level) { SetDCState( hdc, hdcs ); @@ -766,12 +790,14 @@ while (dc->saveLevel) { - DC * dcs; - HDC hdcs = HDC_32(dc->header.hNext); - if (!(dcs = DC_GetDCPtr( hdcs ))) break; - dc->header.hNext = dcs->header.hNext; - dc->saveLevel--; + DC * dcs; + HDC hdcs = dc->saved_dc; + if (!(dcs = DC_GetDCPtr( hdcs ))) break; + dc->saved_dc = dcs->saved_dc; + dc->saveLevel--; if (dcs->hClipRgn) DeleteObject( dcs->hClipRgn ); + if (dcs->hMetaRgn) DeleteObject( dcs->hMetaRgn ); + if (dcs->hMetaClipRgn) DeleteObject( dcs->hMetaClipRgn ); if (dcs->hVisRgn) DeleteObject( dcs->hVisRgn ); PATH_DestroyGdiPath(&dcs->path); GDI_FreeObject( hdcs, dcs ); @@ -788,7 +814,16 @@ dc->physDev = NULL; } + while (dc->saved_visrgn) + { + struct saved_visrgn *next = dc->saved_visrgn->next; + DeleteObject( dc->saved_visrgn->hrgn ); + HeapFree( GetProcessHeap(), 0, dc->saved_visrgn ); + dc->saved_visrgn = next; + } if (dc->hClipRgn) DeleteObject( dc->hClipRgn ); + if (dc->hMetaRgn) DeleteObject( dc->hMetaRgn ); + if (dc->hMetaClipRgn) DeleteObject( dc->hMetaClipRgn ); if (dc->hVisRgn) DeleteObject( dc->hVisRgn ); PATH_DestroyGdiPath(&dc->path); @@ -2103,3 +2138,37 @@ } return bRet; } + +/******************************************************************* + * GdiIsMetaPrintDC [GDI32.@] + */ +BOOL WINAPI GdiIsMetaPrintDC(HDC hdc) +{ + FIXME("%p\n", hdc); + return FALSE; +} + +/******************************************************************* + * GdiIsMetaFileDC [GDI32.@] + */ +BOOL WINAPI GdiIsMetaFileDC(HDC hdc) +{ + TRACE("%p\n", hdc); + + switch( GetObjectType( hdc ) ) + { + case OBJ_METADC: + case OBJ_ENHMETADC: + return TRUE; + } + return FALSE; +} + +/******************************************************************* + * GdiIsPlayMetafileDC [GDI32.@] + */ +BOOL WINAPI GdiIsPlayMetafileDC(HDC hdc) +{ + FIXME("%p\n", hdc); + return FALSE; +} diff -urN wine-20050310/dlls/gdi/dib.c wine-20050419/dlls/gdi/dib.c --- wine-20050310/dlls/gdi/dib.c 2005-02-22 20:34:33.000000000 +0100 +++ wine-20050419/dlls/gdi/dib.c 2005-04-13 16:45:27.000000000 +0200 @@ -150,14 +150,16 @@ * 4 for V4HEADER, 5 for V5HEADER, -1 for error. */ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, - LONG *height, WORD *bpp, DWORD *compr ) + LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) { if (header->biSize == sizeof(BITMAPINFOHEADER)) { *width = header->biWidth; *height = header->biHeight; + *planes = header->biPlanes; *bpp = header->biBitCount; *compr = header->biCompression; + *size = header->biSizeImage; return 1; } if (header->biSize == sizeof(BITMAPCOREHEADER)) @@ -165,8 +167,10 @@ BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header; *width = core->bcWidth; *height = core->bcHeight; + *planes = core->bcPlanes; *bpp = core->bcBitCount; *compr = 0; + *size = 0; return 0; } if (header->biSize == sizeof(BITMAPV4HEADER)) @@ -174,8 +178,10 @@ BITMAPV4HEADER *v4hdr = (BITMAPV4HEADER *)header; *width = v4hdr->bV4Width; *height = v4hdr->bV4Height; + *planes = v4hdr->bV4Planes; *bpp = v4hdr->bV4BitCount; *compr = v4hdr->bV4V4Compression; + *size = v4hdr->bV4SizeImage; return 4; } if (header->biSize == sizeof(BITMAPV5HEADER)) @@ -183,8 +189,10 @@ BITMAPV5HEADER *v5hdr = (BITMAPV5HEADER *)header; *width = v5hdr->bV5Width; *height = v5hdr->bV5Height; + *planes = v5hdr->bV5Planes; *bpp = v5hdr->bV5BitCount; *compr = v5hdr->bV5Compression; + *size = v5hdr->bV5SizeImage; return 5; } ERR("(%ld): unknown/wrong size for header\n", header->biSize ); @@ -222,10 +230,10 @@ HDC hdcMem; LONG height; LONG width; - WORD bpp; - DWORD compr; + WORD planes, bpp; + DWORD compr, size; - if (DIB_GetBitmapInfo( (BITMAPINFOHEADER*) info, &width, &height, &bpp, &compr ) == -1) + if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, &planes, &bpp, &compr, &size ) == -1) { ERR("Invalid bitmap\n"); return 0; @@ -525,15 +533,15 @@ BOOL core_header; LONG width; LONG height; - WORD bpp; - DWORD compr; + WORD planes, bpp; + DWORD compr, size; void* colorPtr; RGBTRIPLE* rgbTriples; RGBQUAD* rgbQuads; if (!info) return 0; - bitmap_type = DIB_GetBitmapInfo( (BITMAPINFOHEADER*) info, &width, &height, &bpp, &compr); + bitmap_type = DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, &planes, &bpp, &compr, &size); if (bitmap_type == -1) { ERR("Invalid bitmap format\n"); @@ -984,11 +992,11 @@ HBITMAP handle; LONG width; LONG height; - WORD bpp; - DWORD compr; + WORD planes, bpp; + DWORD compr, size; DC *dc; - if (DIB_GetBitmapInfo( header, &width, &height, &bpp, &compr ) == -1) return 0; + if (DIB_GetBitmapInfo( header, &width, &height, &planes, &bpp, &compr, &size ) == -1) return 0; if (width < 0) { @@ -1042,28 +1050,18 @@ { const BITMAPINFOHEADER *bi = &bmi->bmiHeader; LONG width, height; - WORD bpp; - DWORD compr; - BOOL core_header; + WORD planes, bpp; + DWORD compr, size; INT width_bytes; - INT size; WORD count, sel; int i; - core_header = (DIB_GetBitmapInfo(bi, &width, &height, &bpp, &compr) == 0); + DIB_GetBitmapInfo(bi, &width, &height, &planes, &bpp, &compr, &size); height = height >= 0 ? height : -height; width_bytes = DIB_GetDIBWidthBytes(width, bpp); - - if (core_header) - { - size = width_bytes * height; - } - else - { - size = (bi->biSizeImage && compr != BI_RGB) ? - bi->biSizeImage : width_bytes * height; - } + + if (!size || (compr != BI_RLE4 && compr != BI_RLE8)) size = width_bytes * height; /* calculate number of sel's needed for size with 64K steps */ count = (size + 0xffff) / 0x10000; @@ -1087,12 +1085,118 @@ * DIB_CreateDIBSection */ HBITMAP DIB_CreateDIBSection(HDC hdc, const BITMAPINFO *bmi, UINT usage, - VOID **bits, HANDLE section, - DWORD offset, DWORD ovr_pitch) + VOID **bits, HANDLE section, + DWORD offset, DWORD ovr_pitch) { - HBITMAP hbitmap = 0; + HBITMAP ret = 0; DC *dc; BOOL bDesktopDC = FALSE; + DIBSECTION *dib; + BITMAPOBJ *bmp; + int bitmap_type; + LONG width, height; + WORD planes, bpp; + DWORD compression, sizeImage; + const DWORD *colorPtr; + void *mapBits = NULL; + + if (((bitmap_type = DIB_GetBitmapInfo( &bmi->bmiHeader, &width, &height, + &planes, &bpp, &compression, &sizeImage )) == -1)) + return 0; + + if (!(dib = HeapAlloc( GetProcessHeap(), 0, sizeof(*dib) ))) return 0; + + TRACE("format (%ld,%ld), planes %d, bpp %d, size %ld, %s\n", + width, height, planes, bpp, sizeImage, usage == DIB_PAL_COLORS? "PAL" : "RGB"); + + dib->dsBm.bmType = 0; + dib->dsBm.bmWidth = width; + dib->dsBm.bmHeight = height >= 0 ? height : -height; + dib->dsBm.bmWidthBytes = ovr_pitch ? ovr_pitch : DIB_GetDIBWidthBytes(width, bpp); + dib->dsBm.bmPlanes = planes; + dib->dsBm.bmBitsPixel = bpp; + dib->dsBm.bmBits = NULL; + + if (!bitmap_type) /* core header */ + { + /* convert the BITMAPCOREHEADER to a BITMAPINFOHEADER */ + dib->dsBmih.biSize = sizeof(BITMAPINFOHEADER); + dib->dsBmih.biWidth = width; + dib->dsBmih.biHeight = height; + dib->dsBmih.biPlanes = planes; + dib->dsBmih.biBitCount = bpp; + dib->dsBmih.biCompression = compression; + dib->dsBmih.biXPelsPerMeter = 0; + dib->dsBmih.biYPelsPerMeter = 0; + dib->dsBmih.biClrUsed = 0; + dib->dsBmih.biClrImportant = 0; + } + else + { + /* truncate extended bitmap headers (BITMAPV4HEADER etc.) */ + dib->dsBmih = bmi->bmiHeader; + dib->dsBmih.biSize = sizeof(BITMAPINFOHEADER); + } + + /* only use sizeImage if it's valid and we're dealing with a compressed bitmap */ + if (sizeImage && (compression == BI_RLE4 || compression == BI_RLE8)) + dib->dsBmih.biSizeImage = sizeImage; + else + dib->dsBmih.biSizeImage = dib->dsBm.bmWidthBytes * dib->dsBm.bmHeight; + + + /* set dsBitfields values */ + colorPtr = (const DWORD *)((const char *)bmi + (WORD) bmi->bmiHeader.biSize); + if (usage == DIB_PAL_COLORS || bpp <= 8) + { + dib->dsBitfields[0] = dib->dsBitfields[1] = dib->dsBitfields[2] = 0; + } + else switch( bpp ) + { + case 15: + case 16: + dib->dsBitfields[0] = (compression == BI_BITFIELDS) ? colorPtr[0] : 0x7c00; + dib->dsBitfields[1] = (compression == BI_BITFIELDS) ? colorPtr[1] : 0x03e0; + dib->dsBitfields[2] = (compression == BI_BITFIELDS) ? colorPtr[2] : 0x001f; + break; + case 24: + case 32: + dib->dsBitfields[0] = (compression == BI_BITFIELDS) ? colorPtr[0] : 0xff0000; + dib->dsBitfields[1] = (compression == BI_BITFIELDS) ? colorPtr[1] : 0x00ff00; + dib->dsBitfields[2] = (compression == BI_BITFIELDS) ? colorPtr[2] : 0x0000ff; + break; + } + + /* get storage location for DIB bits */ + + if (section) + { + SYSTEM_INFO SystemInfo; + DWORD mapOffset; + INT mapSize; + + GetSystemInfo( &SystemInfo ); + mapOffset = offset - (offset % SystemInfo.dwAllocationGranularity); + mapSize = dib->dsBmih.biSizeImage + (offset - mapOffset); + mapBits = MapViewOfFile( section, FILE_MAP_ALL_ACCESS, 0, mapOffset, mapSize ); + if (mapBits) dib->dsBm.bmBits = (char *)mapBits + (offset - mapOffset); + } + else if (ovr_pitch && offset) + dib->dsBm.bmBits = (LPVOID) offset; + else + { + offset = 0; + dib->dsBm.bmBits = VirtualAlloc( NULL, dib->dsBmih.biSizeImage, + MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE ); + } + dib->dshSection = section; + dib->dsOffset = offset; + + if (!dib->dsBm.bmBits) + { + HeapFree( GetProcessHeap(), 0, dib ); + return 0; + } /* If the reference hdc is null, take the desktop dc */ if (hdc == 0) @@ -1101,17 +1205,39 @@ bDesktopDC = TRUE; } - if ((dc = DC_GetDCPtr( hdc ))) + if (!(dc = DC_GetDCPtr( hdc ))) goto error; + + /* create Device Dependent Bitmap and add DIB pointer */ + ret = CreateBitmap( dib->dsBm.bmWidth, dib->dsBm.bmHeight, 1, + (bpp == 1) ? 1 : GetDeviceCaps(hdc, BITSPIXEL), NULL ); + + if (ret && ((bmp = GDI_GetObjPtr(ret, BITMAP_MAGIC)))) { - if(dc->funcs->pCreateDIBSection) - hbitmap = dc->funcs->pCreateDIBSection(dc->physDev, bmi, usage, bits, section, offset, ovr_pitch); - GDI_ReleaseObj(hdc); + bmp->dib = dib; + bmp->funcs = dc->funcs; + GDI_ReleaseObj( ret ); + + if (dc->funcs->pCreateDIBSection) + { + if (!dc->funcs->pCreateDIBSection(dc->physDev, ret, bmi, usage)) + { + DeleteObject( ret ); + ret = 0; + } + } } - if (bDesktopDC) - DeleteDC(hdc); + GDI_ReleaseObj(hdc); + if (bDesktopDC) DeleteDC( hdc ); + if (ret && bits) *bits = dib->dsBm.bmBits; + return ret; - return hbitmap; +error: + if (bDesktopDC) DeleteDC( hdc ); + if (section) UnmapViewOfFile( mapBits ); + else if (!offset) VirtualFree( dib->dsBm.bmBits, 0, MEM_RELEASE ); + HeapFree( GetProcessHeap(), 0, dib ); + return 0; } /*********************************************************************** diff -urN wine-20050310/dlls/gdi/enhmetafile.c wine-20050419/dlls/gdi/enhmetafile.c --- wine-20050310/dlls/gdi/enhmetafile.c 2005-01-03 15:50:12.000000000 +0100 +++ wine-20050419/dlls/gdi/enhmetafile.c 2005-04-13 12:57:59.000000000 +0200 @@ -2147,7 +2147,7 @@ INT mapMode = MM_TEXT; COLORREF old_text_color = 0, old_bk_color = 0; - if(!lpRect) + if(!lpRect && hdc) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -2228,7 +2228,7 @@ CombineTransform(&info->init_transform, &savedXform, &info->init_transform); } - if ( WIDTH(emh->rclFrame) && HEIGHT(emh->rclFrame) ) + if ( lpRect && WIDTH(emh->rclFrame) && HEIGHT(emh->rclFrame) ) { FLOAT xSrcPixSize, ySrcPixSize, xscale, yscale; XFORM xform; @@ -2244,6 +2244,7 @@ WIDTH(emh->rclFrame) * xSrcPixSize; yscale = (FLOAT) HEIGHT(*lpRect) * 100.0 / HEIGHT(emh->rclFrame) * ySrcPixSize; + TRACE("xscale = %f, yscale = %f\n", xscale, yscale); xform.eM11 = xscale; xform.eM12 = 0; @@ -2256,7 +2257,7 @@ } /* WinNT resets the current vp/win org/ext */ - if ( !IS_WIN9X() ) + if ( !IS_WIN9X() && hdc ) { SetMapMode(hdc, MM_TEXT); SetWindowOrgEx(hdc, 0, 0, NULL); @@ -2427,7 +2428,7 @@ /*************************************************************** * Find the EMR_EOF record and then use it to find the * palette entries for this enhanced metafile. - * The lpData is actually a pointer to a EMF_PaletteCopy struct + * The lpData is actually a pointer to an EMF_PaletteCopy struct * which contains the max number of elements to copy and where * to copy them to. * @@ -2527,14 +2528,12 @@ ) { static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' }; - HMETAFILE hmf = 0; - HENHMETAFILE ret = 0; - HDC hdc = 0, hdcdisp = 0; - METAFILEPICT mfp; + HMETAFILE hmf = NULL; + HENHMETAFILE ret = NULL; + HDC hdc = NULL, hdcdisp = NULL; RECT rc, *prcFrame = NULL; gdi_mf_comment *mfcomment; UINT mfcomment_size; - INT horzres, vertres; TRACE("(%d, %p, %p, %p)\n", cbBuffer, lpbBuffer, hdcRef, lpmfp); @@ -2542,40 +2541,27 @@ if(!hmf) { WARN("SetMetaFileBitsEx failed\n"); - return 0; + return NULL; } if(!hdcRef) hdcRef = hdcdisp = CreateDCW(szDisplayW, NULL, NULL, NULL); - if(!lpmfp) { - lpmfp = &mfp; - mfp.mm = MM_ANISOTROPIC; - mfp.xExt = -1; - mfp.yExt = -1; - } + if (lpmfp) + TRACE("mm = %ld %ldx%ld\n", lpmfp->mm, lpmfp->xExt, lpmfp->yExt); - TRACE("mm = %ld %ldx%ld\n", lpmfp->mm, lpmfp->xExt, lpmfp->yExt); - - if((lpmfp->mm == MM_ISOTROPIC || lpmfp->mm == MM_ANISOTROPIC) && - (lpmfp->xExt > 0) && (lpmfp->yExt > 0)) { + if (lpmfp && (lpmfp->mm == MM_ISOTROPIC || lpmfp->mm == MM_ANISOTROPIC)) + { rc.left = rc.top = 0; - rc.right = lpmfp->xExt; - rc.bottom = lpmfp->yExt; - prcFrame = &rc; + rc.right = lpmfp->xExt; + rc.bottom = lpmfp->yExt; + prcFrame = &rc; } - if(!(hdc = CreateEnhMetaFileW(hdcRef, NULL, prcFrame, NULL))) { + if(!(hdc = CreateEnhMetaFileW(hdcRef, NULL, prcFrame, NULL))) + { ERR("CreateEnhMetaFile fails?\n"); - goto end; - } - - horzres = GetDeviceCaps(hdcRef, HORZRES); - vertres = GetDeviceCaps(hdcRef, VERTRES); - - if(hdcdisp) { - DeleteDC(hdcdisp); - hdcRef = 0; + goto end; } /* @@ -2597,17 +2583,30 @@ HeapFree(GetProcessHeap(), 0, mfcomment); } - if(lpmfp->mm != MM_TEXT) + if(lpmfp && lpmfp->mm != MM_TEXT) SetMapMode(hdc, lpmfp->mm); - /* set the initial viewport:window ratio as 1:1 */ - SetViewportExtEx(hdc, horzres, vertres, NULL); - SetWindowExtEx(hdc, horzres, vertres, NULL); + if (lpmfp && (lpmfp->mm == MM_ISOTROPIC || lpmfp->mm == MM_ANISOTROPIC)) + { + INT horzres, vertres, horzsize, vertsize, xext, yext; + + horzres = GetDeviceCaps(hdcRef, HORZRES); + vertres = GetDeviceCaps(hdcRef, VERTRES); + horzsize = GetDeviceCaps(hdcRef, HORZSIZE); + vertsize = GetDeviceCaps(hdcRef, VERTSIZE); + + /* set the initial viewport:window ratio as 1:1 */ + xext = lpmfp->xExt*horzres/(100*horzsize); + yext = lpmfp->yExt*vertres/(100*vertsize); + SetViewportExtEx(hdc, xext, yext, NULL); + SetWindowExtEx(hdc, xext, yext, NULL); + } PlayMetaFile(hdc, hmf); ret = CloseEnhMetaFile(hdc); end: + if (hdcdisp) DeleteDC(hdcdisp); DeleteMetaFile(hmf); return ret; } diff -urN wine-20050310/dlls/gdi/enhmfdrv/init.c wine-20050419/dlls/gdi/enhmfdrv/init.c --- wine-20050310/dlls/gdi/enhmfdrv/init.c 2004-08-02 20:54:54.000000000 +0200 +++ wine-20050419/dlls/gdi/enhmfdrv/init.c 2005-03-24 22:01:38.000000000 +0100 @@ -299,7 +299,7 @@ if (!(dc = DC_AllocDC( &EMFDRV_Funcs, ENHMETAFILE_DC_MAGIC ))) return 0; - physDev = (EMFDRV_PDEVICE *)HeapAlloc(GetProcessHeap(),0,sizeof(*physDev)); + physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev)); if (!physDev) { GDI_FreeObject( dc->hSelf, dc ); return 0; diff -urN wine-20050310/dlls/gdi/env.c wine-20050419/dlls/gdi/env.c --- wine-20050310/dlls/gdi/env.c 2004-02-12 03:17:51.000000000 +0100 +++ wine-20050419/dlls/gdi/env.c 2005-03-28 16:17:52.000000000 +0200 @@ -67,8 +67,7 @@ { char buffer[256]; - strncpy( buffer, lpPortName, sizeof(buffer) ); - buffer[sizeof(buffer)-1] = 0; + lstrcpynA( buffer, lpPortName, sizeof(buffer) ); if (buffer[0] && buffer[strlen(buffer)-1] == ':') buffer[strlen(buffer)-1] = 0; diff -urN wine-20050310/dlls/gdi/font.c wine-20050419/dlls/gdi/font.c --- wine-20050310/dlls/gdi/font.c 2005-02-22 20:37:18.000000000 +0100 +++ wine-20050419/dlls/gdi/font.c 2005-04-18 12:30:56.000000000 +0200 @@ -1664,7 +1664,7 @@ if (lpDx) { unsigned int i = 0, j = 0; - lpDxW = (LPINT)HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(INT)); + lpDxW = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(INT)); while(i < count) { if(IsDBCSLeadByteEx(codepage, str[i])) { lpDxW[j++] = lpDx[i] + lpDx[i+1]; @@ -2319,7 +2319,7 @@ /* Treat the case where no special handling was requested in a fastpath way */ /* copy will do if the GCP_REORDER flag is not set */ if(lpResults->lpOutString) - strncpyW( lpResults->lpOutString, lpString, nSet ); + memcpy( lpResults->lpOutString, lpString, nSet * sizeof(WCHAR)); if(lpResults->lpOrder) { diff -urN wine-20050310/dlls/gdi/freetype.c wine-20050419/dlls/gdi/freetype.c --- wine-20050310/dlls/gdi/freetype.c 2005-02-25 14:59:22.000000000 +0100 +++ wine-20050419/dlls/gdi/freetype.c 2005-04-18 12:30:56.000000000 +0200 @@ -900,7 +900,7 @@ } -void load_system_fonts(void) +static void load_system_fonts(void) { HKEY hkey; WCHAR data[MAX_PATH], windowsdir[MAX_PATH], pathW[MAX_PATH]; @@ -934,7 +934,7 @@ * of no longer existing fonts. * */ -void update_reg_entries(void) +static void update_reg_entries(void) { HKEY winkey = 0, externalkey = 0; LPWSTR valueW; @@ -2044,13 +2044,13 @@ if(potm) { pntm->ntmTm.ntmSizeEM = potm->otmEMSquare; - strncpyW(pelf->elfLogFont.lfFaceName, + lstrcpynW(pelf->elfLogFont.lfFaceName, (WCHAR*)((char*)potm + (ptrdiff_t)potm->otmpFamilyName), LF_FACESIZE); - strncpyW(pelf->elfFullName, + lstrcpynW(pelf->elfFullName, (WCHAR*)((char*)potm + (ptrdiff_t)potm->otmpFaceName), LF_FULLFACESIZE); - strncpyW(pelf->elfStyle, + lstrcpynW(pelf->elfStyle, (WCHAR*)((char*)potm + (ptrdiff_t)potm->otmpStyleName), LF_FACESIZE); @@ -2058,8 +2058,8 @@ } else { pntm->ntmTm.ntmSizeEM = pntm->ntmTm.tmHeight - pntm->ntmTm.tmInternalLeading; - strncpyW(pelf->elfLogFont.lfFaceName, face->family->FamilyName, LF_FACESIZE); - strncpyW(pelf->elfFullName, face->family->FamilyName, LF_FACESIZE); + lstrcpynW(pelf->elfLogFont.lfFaceName, face->family->FamilyName, LF_FACESIZE); + lstrcpynW(pelf->elfFullName, face->family->FamilyName, LF_FACESIZE); pelf->elfStyle[0] = '\0'; } diff -urN wine-20050310/dlls/gdi/gdi16.c wine-20050419/dlls/gdi/gdi16.c --- wine-20050310/dlls/gdi/gdi16.c 2005-02-21 21:43:59.000000000 +0100 +++ wine-20050419/dlls/gdi/gdi16.c 2005-04-16 13:18:43.000000000 +0200 @@ -482,8 +482,7 @@ { register int i; BOOL ret; - LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, - count*sizeof(POINT) ); + LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) ); if (!pt32) return FALSE; for (i=count;i--;) @@ -504,8 +503,7 @@ { register int i; BOOL16 ret; - LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, - count*sizeof(POINT) ); + LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, count*sizeof(POINT) ); if (!pt32) return FALSE; for (i=count;i--;) @@ -799,7 +797,7 @@ HBITMAP16 WINAPI CreateBitmap16( INT16 width, INT16 height, UINT16 planes, UINT16 bpp, LPCVOID bits ) { - return HBITMAP_16( CreateBitmap( width, height, planes, bpp, bits ) ); + return HBITMAP_16( CreateBitmap( width, height, planes & 0xff, bpp & 0xff, bits ) ); } @@ -1879,7 +1877,7 @@ LPINT lpdx32 = NULL; if (lpDx) { - lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count ); + lpdx32 = HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count ); if(lpdx32 == NULL) return FALSE; for (i=count;i--;) lpdx32[i]=lpDx[i]; } @@ -2246,14 +2244,14 @@ nrpts=0; for (i=polygons;i--;) nrpts+=counts[i]; - pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts); + pt32 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts); if(pt32 == NULL) return FALSE; for (i=nrpts;i--;) { pt32[i].x = pt[i].x; pt32[i].y = pt[i].y; } - counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) ); + counts32 = HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) ); if(counts32 == NULL) { HeapFree( GetProcessHeap(), 0, pt32 ); return FALSE; @@ -2609,8 +2607,7 @@ { int i; BOOL16 ret; - LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, - cPoints*sizeof(POINT) ); + LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, cPoints*sizeof(POINT) ); if(!pt32) return FALSE; for (i=cPoints;i--;) { @@ -2630,7 +2627,7 @@ { int i; BOOL16 ret; - LPPOINT pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, + LPPOINT pt32 = HeapAlloc( GetProcessHeap(), 0, cPoints*sizeof(POINT) ); if(!pt32) return FALSE; for (i=cPoints;i--;) diff -urN wine-20050310/dlls/gdi/gdi32.spec wine-20050419/dlls/gdi/gdi32.spec --- wine-20050310/dlls/gdi/gdi32.spec 2005-01-12 20:57:08.000000000 +0100 +++ wine-20050419/dlls/gdi/gdi32.spec 2005-04-14 15:57:55.000000000 +0200 @@ -160,7 +160,9 @@ @ stub GdiGetLocalDC @ stub GdiGetLocalFont @ stdcall GdiGradientFill(long ptr long ptr long long) -@ stub GdiIsMetaFileDC +@ stdcall GdiIsMetaFileDC(long) +@ stdcall GdiIsMetaPrintDC(long) +@ stdcall GdiIsPlayMetafileDC(long) @ stub GdiPlayDCScript @ stub GdiPlayJournal @ stub GdiPlayScript @@ -421,8 +423,6 @@ # Wine extensions: Win16 functions that are needed by other dlls # @ stdcall CloseJob16(long) -@ stdcall CloseMetaFile16(long) -@ stdcall DeleteMetaFile16(long) @ stdcall DrvGetPrinterData16(str str ptr ptr long ptr) @ stdcall DrvSetPrinterData16(str str long ptr long) @ stdcall OpenJob16(str str long) diff -urN wine-20050310/dlls/gdi/gdi_private.h wine-20050419/dlls/gdi/gdi_private.h --- wine-20050310/dlls/gdi/gdi_private.h 2005-01-10 13:30:18.000000000 +0100 +++ wine-20050419/dlls/gdi/gdi_private.h 2005-04-13 18:11:18.000000000 +0200 @@ -28,6 +28,9 @@ #define METAFILE_MEMORY 1 #define METAFILE_DISK 2 +/* extra stock object: default 1x1 bitmap for memory DCs */ +#define DEFAULT_BITMAP (STOCK_LAST+1) + struct gdi_obj_funcs { HGDIOBJ (*pSelectObject)( HGDIOBJ handle, void *obj, HDC hdc ); @@ -63,7 +66,7 @@ BOOL (*pCloseFigure)(PHYSDEV); BOOL (*pCreateBitmap)(PHYSDEV,HBITMAP); BOOL (*pCreateDC)(HDC,PHYSDEV *,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*); - HBITMAP (*pCreateDIBSection)(PHYSDEV,const BITMAPINFO *,UINT,VOID **,HANDLE,DWORD,DWORD); + HBITMAP (*pCreateDIBSection)(PHYSDEV,HBITMAP,const BITMAPINFO *,UINT); BOOL (*pDeleteBitmap)(HBITMAP); BOOL (*pDeleteDC)(PHYSDEV); BOOL (*pDeleteObject)(PHYSDEV,HGDIOBJ); @@ -196,6 +199,12 @@ typedef struct tagGdiFont *GdiFont; +struct saved_visrgn +{ + struct saved_visrgn *next; + HRGN hrgn; +}; + typedef struct tagDC { GDIOBJHDR header; @@ -203,6 +212,7 @@ const struct tagDC_FUNCS *funcs; /* DC function table */ PHYSDEV physDev; /* Physical device (driver-specific) */ INT saveLevel; + HDC saved_dc; DWORD dwHookData; FARPROC16 hookProc; /* the original SEGPTR ... */ DCHOOKPROC hookThunk; /* ... and the thunk to call it */ @@ -219,8 +229,10 @@ int flags; DWORD layout; - HRGN hClipRgn; /* Clip region (may be 0) */ - HRGN hVisRgn; /* Visible region (must never be 0) */ + HRGN hClipRgn; /* Clip region (may be 0) */ + HRGN hMetaRgn; /* Meta region (may be 0) */ + HRGN hMetaClipRgn; /* Intersection of meta and clip regions (may be 0) */ + HRGN hVisRgn; /* Visible region (must never be 0) */ HPEN hPen; HBRUSH hBrush; HFONT hFont; @@ -259,6 +271,8 @@ XFORM xformVport2World; /* Inverse of the above transformation */ BOOL vport2WorldValid; /* Is xformVport2World valid? */ RECT BoundsRect; /* Current bounding rect */ + + struct saved_visrgn *saved_visrgn; } DC; /* DC flags */ @@ -280,6 +294,19 @@ return (int)floor(val + 0.5); } +/* bitmap object */ + +typedef struct tagBITMAPOBJ +{ + GDIOBJHDR header; + BITMAP bitmap; + SIZE size; /* For SetBitmapDimension() */ + const DC_FUNCTIONS *funcs; /* DC function table */ + /* For device-independent bitmaps: */ + DIBSECTION *dib; + SEGPTR segptr_bits; /* segptr to DIB bits */ +} BITMAPOBJ; + /* bidi.c */ /* Wine_GCPW Flags */ diff -urN wine-20050310/dlls/gdi/gdiobj.c wine-20050419/dlls/gdi/gdiobj.c --- wine-20050310/dlls/gdi/gdiobj.c 2005-03-10 12:20:51.000000000 +0100 +++ wine-20050419/dlls/gdi/gdiobj.c 2005-03-25 21:58:29.000000000 +0100 @@ -723,7 +723,8 @@ _EnterSysLevel( &GDI_level ); switch(magic) { - default: + case PEN_MAGIC: + case BRUSH_MAGIC: if (GDI_HeapSel) { if (!(hlocal = LOCAL_Alloc( GDI_HeapSel, LMEM_MOVEABLE, size ))) goto error; @@ -733,23 +734,11 @@ break; } /* fall through */ - case DC_MAGIC: - case DISABLED_DC_MAGIC: - case META_DC_MAGIC: - case METAFILE_MAGIC: - case METAFILE_DC_MAGIC: - case ENHMETAFILE_MAGIC: - case ENHMETAFILE_DC_MAGIC: - case MEMORY_DC_MAGIC: - case BITMAP_MAGIC: - case PALETTE_MAGIC: - case FONT_MAGIC: - case REGION_MAGIC: + default: if (!(obj = alloc_large_heap( size, handle ))) goto error; break; } - obj->hNext = 0; obj->wMagic = magic|OBJECT_NOSYSTEM; obj->dwCount = 0; obj->funcs = funcs; diff -urN wine-20050310/dlls/gdi/metafile.c wine-20050419/dlls/gdi/metafile.c --- wine-20050310/dlls/gdi/metafile.c 2005-01-26 20:41:58.000000000 +0100 +++ wine-20050419/dlls/gdi/metafile.c 2005-04-11 14:50:01.000000000 +0200 @@ -2,7 +2,9 @@ * Metafile functions * * Copyright David W. Metcalfe, 1994 - * Niels de Carpentier, Albrecht Kleine, Huw Davies 1996 + * Copyright Niels de Carpentier, 1996 + * Copyright Albrecht Kleine, 1996 + * Copyright Huw Davies, 1996 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,9 +19,9 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* + * + * NOTES + * * These functions are primarily involved with metafile playback or anything * that touches a HMETAFILE. * For recording of metafiles look in graphics/metafiledrv/ @@ -113,7 +115,7 @@ (HGDIOBJ *)&hmf, NULL ); if (metaObj) { - metaObj->mh = mh; + metaObj->mh = mh; GDI_ReleaseObj( hmf ); } return hmf; @@ -437,17 +439,17 @@ * a disk file, if a filename is given, or to a new memory based * metafile, if lpFileName is NULL. * - * RETURNS + * PARAMS + * hSrcMetaFile [I] handle of metafile to copy + * lpFilename [I] filename if copying to a file * + * RETURNS * Handle to metafile copy on success, NULL on failure. * * BUGS - * * Copying to disk returns NULL even if successful. */ -HMETAFILE WINAPI CopyMetaFileW( - HMETAFILE hSrcMetaFile, /* [in] handle of metafile to copy */ - LPCWSTR lpFilename /* [in] filename if copying to a file */) +HMETAFILE WINAPI CopyMetaFileW( HMETAFILE hSrcMetaFile, LPCWSTR lpFilename ) { METAHEADER *mh = MF_GetMetaHeader( hSrcMetaFile ); METAHEADER *mh2 = NULL; @@ -483,8 +485,7 @@ /****************************************************************** * CopyMetaFileA (GDI32.@) */ -HMETAFILE WINAPI CopyMetaFileA( HMETAFILE hSrcMetaFile, - LPCSTR lpFilename ) +HMETAFILE WINAPI CopyMetaFileA( HMETAFILE hSrcMetaFile, LPCSTR lpFilename ) { UNICODE_STRING lpFilenameW; HMETAFILE ret = 0; @@ -614,11 +615,12 @@ * * Renders the metafile specified by hmf in the DC specified by * hdc. Returns FALSE on failure, TRUE on success. + * + * PARAMS + * hdc [I] handle of DC to render in + * hmf [I] handle of metafile to render */ -BOOL WINAPI PlayMetaFile( - HDC hdc, /* [in] handle of DC to render in */ - HMETAFILE hmf /* [in] handle of metafile to render */ -) +BOOL WINAPI PlayMetaFile( HDC hdc, HMETAFILE hmf ) { METAHEADER *mh = MF_GetMetaHeader( hmf ); return MF_PlayMetaFile( hdc, mh ); @@ -727,15 +729,8 @@ * * RETURNS * TRUE on success, FALSE on failure. - * - * HISTORY - * Niels de carpentier, april 1996 */ -BOOL WINAPI EnumMetaFile( - HDC hdc, - HMETAFILE hmf, - MFENUMPROC lpEnumFunc, - LPARAM lpData) +BOOL WINAPI EnumMetaFile(HDC hdc, HMETAFILE hmf, MFENUMPROC lpEnumFunc, LPARAM lpData) { METAHEADER *mhTemp = NULL, *mh = MF_GetMetaHeader(hmf); METARECORD *mr; @@ -1215,7 +1210,12 @@ break; case META_SELECTCLIPREGION: - SelectClipRgn(hdc, *(ht->objectHandle + mr->rdParm[0])); + { + HRGN hrgn = 0; + + if (mr->rdParm[0]) hrgn = *(ht->objectHandle + mr->rdParm[0]); + SelectClipRgn(hdc, hrgn); + } break; case META_DIBCREATEPATTERNBRUSH: @@ -1304,11 +1304,11 @@ * * Trade in a metafile object handle for a handle to the metafile memory. * + * PARAMS + * hmf [I] metafile handle */ -HGLOBAL16 WINAPI GetMetaFileBits16( - HMETAFILE16 hmf /* [in] metafile handle */ - ) +HGLOBAL16 WINAPI GetMetaFileBits16( HMETAFILE16 hmf ) { TRACE("hMem out: %04x\n", hmf); return hmf; @@ -1321,11 +1321,11 @@ * The memory region should hold a proper metafile, otherwise * problems will occur when it is used. Validity of the memory is not * checked. The function is essentially just the identity function. + * + * PARAMS + * hMem [I] handle to a memory region holding a metafile */ -HMETAFILE16 WINAPI SetMetaFileBits16( - HGLOBAL16 hMem - /* [in] handle to a memory region holding a metafile */ -) +HMETAFILE16 WINAPI SetMetaFileBits16( HGLOBAL16 hMem ) { TRACE("hmf out: %04x\n", hMem); @@ -1354,12 +1354,13 @@ * SetMetaFileBitsEx (GDI32.@) * * Create a metafile from raw data. No checking of the data is performed. - * Use _GetMetaFileBitsEx_ to get raw data from a metafile. + * Use GetMetaFileBitsEx() to get raw data from a metafile. + * + * PARAMS + * size [I] size of metafile, in bytes + * lpData [I] pointer to metafile data */ -HMETAFILE WINAPI SetMetaFileBitsEx( - UINT size, /* [in] size of metafile, in bytes */ - const BYTE *lpData /* [in] pointer to metafile data */ - ) +HMETAFILE WINAPI SetMetaFileBitsEx( UINT size, const BYTE *lpData ) { METAHEADER *mh = HeapAlloc( GetProcessHeap(), 0, size ); if (!mh) return 0; @@ -1375,11 +1376,13 @@ * Copies the data from metafile _hmf_ into the buffer _buf_. * If _buf_ is zero, returns size of buffer required. Otherwise, * returns number of bytes copied. + * + * PARAMS + * hmf [I] metafile + * nSize [I] size of buf + * buf [O] buffer to receive raw metafile data */ -UINT WINAPI GetMetaFileBitsEx( - HMETAFILE hmf, /* [in] metafile */ - UINT nSize, /* [in] size of buf */ - LPVOID buf /* [out] buffer to receive raw metafile data */) +UINT WINAPI GetMetaFileBitsEx( HMETAFILE hmf, UINT nSize, LPVOID buf ) { METAHEADER *mh = MF_GetMetaHeader(hmf); UINT mfSize; @@ -1432,9 +1435,7 @@ * MF_Play_MetaCreateRegion * * Handles META_CREATEREGION for PlayMetaFileRecord(). - */ - -/* + * * The layout of the record looks something like this: * * rdParm meaning @@ -1544,8 +1545,7 @@ } else { TRACE("%s len: %ld\n", sot, mr->rdSize); - WARN( - "Please report: ExtTextOut len=%ld slen=%d rdSize=%ld opt=%04x\n", + WARN("Please report: ExtTextOut len=%ld slen=%d rdSize=%ld opt=%04x\n", len, s1, mr->rdSize, mr->rdParm[3]); dxx = NULL; /* should't happen -- but if, we continue with NULL */ } @@ -1555,7 +1555,7 @@ mr->rdParm[3], /* options */ &rect, /* rectangle */ sot, /* string */ - s1, dx); /* length, dx array */ + s1, dx); /* length, dx array */ if (dx) { TRACE("%s len: %ld dx0: %d\n", sot, mr->rdSize, dx[0]); diff -urN wine-20050310/dlls/gdi/mfdrv/bitblt.c wine-20050419/dlls/gdi/mfdrv/bitblt.c --- wine-20050310/dlls/gdi/mfdrv/bitblt.c 2004-11-24 19:08:18.000000000 +0100 +++ wine-20050419/dlls/gdi/mfdrv/bitblt.c 2005-03-24 22:01:38.000000000 +0100 @@ -156,7 +156,7 @@ info->bmiHeader.biBitCount ); len = sizeof(METARECORD) + 10 * sizeof(WORD) + infosize + imagesize; - mr = (METARECORD *)HeapAlloc( GetProcessHeap(), 0, len ); + mr = HeapAlloc( GetProcessHeap(), 0, len ); if(!mr) return 0; mr->rdSize = len / 2; @@ -198,7 +198,7 @@ info->bmiHeader.biBitCount ); len = sizeof(METARECORD) + 8 * sizeof(WORD) + infosize + imagesize; - mr = (METARECORD *)HeapAlloc( GetProcessHeap(), 0, len ); + mr = HeapAlloc( GetProcessHeap(), 0, len ); if(!mr) return 0; mr->rdSize = len / 2; diff -urN wine-20050310/dlls/gdi/mfdrv/graphics.c wine-20050419/dlls/gdi/mfdrv/graphics.c --- wine-20050310/dlls/gdi/mfdrv/graphics.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050419/dlls/gdi/mfdrv/graphics.c 2005-03-24 22:01:38.000000000 +0100 @@ -154,7 +154,7 @@ LPPOINT16 pt16; BOOL16 ret; - pt16 = (LPPOINT16)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count ); + pt16 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count ); if(!pt16) return FALSE; for (i=count;i--;) { @@ -178,7 +178,7 @@ LPPOINT16 pt16; BOOL16 ret; - pt16 = (LPPOINT16) HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count ); + pt16 = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count ); if(!pt16) return FALSE; for (i=count;i--;) { @@ -211,10 +211,8 @@ } /* allocate space for all points */ - pt16=(LPPOINT16)HeapAlloc( GetProcessHeap(), 0, - sizeof(POINT16) * totalpoint16 ); - pointcounts = (INT16*)HeapAlloc( GetProcessHeap(), 0, - sizeof(INT16) * totalpoint16 ); + pt16=HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16) * totalpoint16 ); + pointcounts = HeapAlloc( GetProcessHeap(), 0, sizeof(INT16) * totalpoint16 ); /* copy point counts */ for (i=0;ihSelf, dc ); @@ -228,10 +228,13 @@ * Create a new DC and associate it with a metafile. Pass a filename * to create a disk-based metafile, NULL to create a memory metafile. * + * PARAMS + * filename [I] Filename of disk metafile + * * RETURNS * A handle to the metafile DC if successful, NULL on failure. */ -HDC WINAPI CreateMetaFileW( LPCWSTR filename ) /* [in] Filename of disk metafile */ +HDC WINAPI CreateMetaFileW( LPCWSTR filename ) { HDC ret; DC *dc; @@ -338,10 +341,11 @@ /****************************************************************** * CloseMetaFile (GDI.126) + * + * PARAMS + * hdc [I] Metafile DC to close */ -HMETAFILE16 WINAPI CloseMetaFile16( - HDC16 hdc /* [in] Metafile DC to close */ -) +HMETAFILE16 WINAPI CloseMetaFile16(HDC16 hdc) { HMETAFILE16 hmf; METAFILEDRV_PDEVICE *physDev; @@ -364,12 +368,13 @@ * Stop recording graphics operations in metafile associated with * hdc and retrieve metafile. * + * PARAMS + * hdc [I] Metafile DC to close + * * RETURNS * Handle of newly created metafile on success, NULL on failure. */ -HMETAFILE WINAPI CloseMetaFile( - HDC hdc /* [in] Metafile DC to close */ -) +HMETAFILE WINAPI CloseMetaFile(HDC hdc) { HMETAFILE hmf; METAFILEDRV_PDEVICE *physDev; diff -urN wine-20050310/dlls/gdi/palette.c wine-20050419/dlls/gdi/palette.c --- wine-20050310/dlls/gdi/palette.c 2005-01-03 15:33:07.000000000 +0100 +++ wine-20050419/dlls/gdi/palette.c 2005-03-30 19:08:34.000000000 +0200 @@ -186,7 +186,7 @@ * Failure: 0 * * FIXME: This simply creates the halftone palette derived from running - * tests on an windows NT machine. this is assuming a color depth + * tests on a windows NT machine. This is assuming a color depth * of greater that 256 color. On a 256 color device the halftone * palette will be different and this function will be incorrect */ @@ -398,8 +398,7 @@ if( mapping ) { - int *newMap = (int*) HeapReAlloc(GetProcessHeap(), 0, - mapping, cEntries * sizeof(int) ); + int *newMap = HeapReAlloc(GetProcessHeap(), 0, mapping, cEntries * sizeof(int) ); if(newMap == NULL) { ERR("Can not resize mapping -- out of memory!\n"); diff -urN wine-20050310/dlls/gdi/path.c wine-20050419/dlls/gdi/path.c --- wine-20050310/dlls/gdi/path.c 2004-12-23 19:41:06.000000000 +0100 +++ wine-20050419/dlls/gdi/path.c 2005-03-24 22:01:38.000000000 +0100 @@ -1160,8 +1160,7 @@ numStrokes++; /* Allocate memory for number-of-points-in-stroke array */ - pNumPointsInStroke=(int *)HeapAlloc( GetProcessHeap(), 0, - sizeof(int) * numStrokes ); + pNumPointsInStroke=HeapAlloc( GetProcessHeap(), 0, sizeof(int) * numStrokes ); if(!pNumPointsInStroke) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -1281,12 +1280,10 @@ numEntriesToAllocate=numEntries; /* Allocate new arrays */ - pPointsNew=(POINT *)HeapAlloc( GetProcessHeap(), 0, - numEntriesToAllocate * sizeof(POINT) ); + pPointsNew=HeapAlloc( GetProcessHeap(), 0, numEntriesToAllocate * sizeof(POINT) ); if(!pPointsNew) return FALSE; - pFlagsNew=(BYTE *)HeapAlloc( GetProcessHeap(), 0, - numEntriesToAllocate * sizeof(BYTE) ); + pFlagsNew=HeapAlloc( GetProcessHeap(), 0, numEntriesToAllocate * sizeof(BYTE) ); if(!pFlagsNew) { HeapFree( GetProcessHeap(), 0, pPointsNew ); diff -urN wine-20050310/dlls/gdi/tests/metafile.c wine-20050419/dlls/gdi/tests/metafile.c --- wine-20050310/dlls/gdi/tests/metafile.c 2005-02-14 22:04:45.000000000 +0100 +++ wine-20050419/dlls/gdi/tests/metafile.c 2005-04-15 16:11:00.000000000 +0200 @@ -20,6 +20,7 @@ #include #include +#include #include "wine/test.h" #include "winbase.h" @@ -30,6 +31,10 @@ static LOGFONTA orig_lf; static BOOL emr_processed = FALSE; +/* Arbitrarily chosen values for the second co-ordinate of a metafile line */ +#define LINE_X 55.0f +#define LINE_Y 15.0f + static int CALLBACK emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, const ENHMETARECORD *emr, int n_objs, LPARAM param) { @@ -43,6 +48,8 @@ trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n", hdc, emr->iType, emr->nSize, (void *)param); + if(!hdc) return 1; + PlayEnhMetaFileRecord(hdc, handle_table, emr, n_objs); switch (emr->iType) @@ -190,6 +197,9 @@ ok(!EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, NULL), "A valid hdc has to require a valid rc\n"); + ok(EnumEnhMetaFile(NULL, hMetafile, emf_enum_proc, dx, NULL), + "A null hdc does not require a valid rc\n"); + ret = DeleteEnhMetaFile(hMetafile); ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError()); ret = ReleaseDC(hwnd, hdcDisplay); @@ -433,6 +443,173 @@ HeapFree (GetProcessHeap(), 0, orig_lb); } +static INT CALLBACK EmfMmTextEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData) +{ + POINT mapping[2] = { { 0, 0 }, { 1000, 1000 } }; + LPtoDP(hdc, mapping, 2); + trace("Meta record: iType = %ld, (%ld,%ld)-(%ld,%ld)\n", lpEMFR->iType, mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y); + if (lpEMFR->iType == EMR_LINETO) + { + FLOAT xSrcPixSize, ySrcPixSize, xscale, yscale; + INT xframe = LINE_X * (float)GetDeviceCaps(hdc, HORZSIZE) * 100.0f / (float)GetDeviceCaps(hdc, HORZRES); + INT yframe = LINE_Y * (float)GetDeviceCaps(hdc, VERTSIZE) * 100.0f / (float)GetDeviceCaps(hdc, VERTRES); + INT x0 = 0; + INT y0 = 0; + INT x1; + INT y1; + xSrcPixSize = (FLOAT) GetDeviceCaps(hdc, HORZSIZE) / GetDeviceCaps(hdc, HORZRES); + ySrcPixSize = (FLOAT) GetDeviceCaps(hdc, VERTSIZE) / GetDeviceCaps(hdc, VERTRES); + xscale = (FLOAT) 1000 * 100.0 / + xframe * xSrcPixSize; + yscale = (FLOAT) 1000 * 100.0 / + yframe * ySrcPixSize; + x1 = (INT)floor(xscale * 100.0 + 0.5f); + y1 = (INT)floor(yscale * 100.0 + 0.5f); + ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1, + "(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n", + mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y, + x0, y0, x1, y1); + } + PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj); + return TRUE; +} + +static INT CALLBACK EmfMmAnisotropicEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData) +{ + POINT mapping[2] = { { 0, 0 }, { 1000, 1000 } }; + LPtoDP(hdc, mapping, 2); + trace("Meta record: iType = %ld, (%ld,%ld)-(%ld,%ld)\n", lpEMFR->iType, mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y); + if (lpEMFR->iType == EMR_LINETO) + { + INT x0 = MulDiv(0, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES)); + INT y0 = MulDiv(0, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES)); + INT x1 = MulDiv(1000, GetDeviceCaps(hdc, HORZSIZE) * 100, GetDeviceCaps(hdc, HORZRES)); + INT y1 = MulDiv(1000, GetDeviceCaps(hdc, VERTSIZE) * 100, GetDeviceCaps(hdc, VERTRES)); + ok(mapping[0].x == x0 && mapping[0].y == y0 && mapping[1].x == x1 && mapping[1].y == y1, + "(%ld,%ld)->(%ld,%ld), expected (%d,%d)->(%d,%d)\n", + mapping[0].x, mapping[0].y, mapping[1].x, mapping[1].y, + x0, y0, x1, y1); + } + PlayEnhMetaFileRecord(hdc, lpHTable, lpEMFR, nObj); + return TRUE; +} + +static HENHMETAFILE create_converted_emf(const METAFILEPICT *mfp) +{ + HDC hdcMf; + HMETAFILE hmf; + BOOL ret; + UINT size; + LPBYTE pBits; + + hdcMf = CreateMetaFile(NULL); + ok(hdcMf != NULL, "CreateMetaFile failed with error %ld\n", GetLastError()); + ret = LineTo(hdcMf, (INT)LINE_X, (INT)LINE_Y); + ok(ret, "LineTo failed with error %ld\n", GetLastError()); + hmf = CloseMetaFile(hdcMf); + ok(hmf != NULL, "CloseMetaFile failed with error %ld\n", GetLastError()); + size = GetMetaFileBitsEx(hmf, 0, NULL); + ok(size, "GetMetaFileBitsEx failed with error %ld\n", GetLastError()); + pBits = HeapAlloc(GetProcessHeap(), 0, size); + GetMetaFileBitsEx(hmf, size, pBits); + DeleteMetaFile(hmf); + return SetWinMetaFileBits(size, pBits, NULL, mfp); +} + +static void test_mf_conversions() +{ + trace("Testing MF->EMF conversion (MM_ANISOTROPIC)\n"); + { + HDC hdcOffscreen = CreateCompatibleDC(NULL); + HENHMETAFILE hemf; + METAFILEPICT mfp; + RECT rect = { 0, 0, 100, 100 }; + mfp.mm = MM_ANISOTROPIC; + mfp.xExt = 100; + mfp.yExt = 100; + mfp.hMF = NULL; + hemf = create_converted_emf(&mfp); + EnumEnhMetaFile(hdcOffscreen, hemf, EmfMmAnisotropicEnumProc, NULL, &rect); + DeleteEnhMetaFile(hemf); + DeleteDC(hdcOffscreen); + } + + trace("Testing MF->EMF conversion (MM_TEXT)\n"); + { + HDC hdcOffscreen = CreateCompatibleDC(NULL); + HENHMETAFILE hemf; + METAFILEPICT mfp; + RECT rect = { 0, 0, 100, 100 }; + mfp.mm = MM_TEXT; + mfp.xExt = 0; + mfp.yExt = 0; + mfp.hMF = NULL; + hemf = create_converted_emf(&mfp); + EnumEnhMetaFile(hdcOffscreen, hemf, EmfMmTextEnumProc, NULL, &rect); + DeleteEnhMetaFile(hemf); + DeleteDC(hdcOffscreen); + } + + trace("Testing MF->EMF conversion (NULL mfp)\n"); + { + HDC hdcOffscreen = CreateCompatibleDC(NULL); + HENHMETAFILE hemf; + RECT rect = { 0, 0, 100, 100 }; + hemf = create_converted_emf(NULL); + EnumEnhMetaFile(hdcOffscreen, hemf, EmfMmTextEnumProc, NULL, &rect); + DeleteEnhMetaFile(hemf); + DeleteDC(hdcOffscreen); + } +} + +static BOOL (WINAPI *pGdiIsMetaPrintDC)(HDC); +static BOOL (WINAPI *pGdiIsMetaFileDC)(HDC); +static BOOL (WINAPI *pGdiIsPlayMetafileDC)(HDC); + +static void test_gdiis(void) +{ + RECT rect = {0,0,100,100}; + HDC hdc, hemfDC, hmfDC; + HENHMETAFILE hemf; + HMODULE hgdi32; + + /* resolve all the functions */ + hgdi32 = GetModuleHandle("gdi32"); + pGdiIsMetaPrintDC = (void*) GetProcAddress(hgdi32, "GdiIsMetaPrintDC"); + pGdiIsMetaFileDC = (void*) GetProcAddress(hgdi32, "GdiIsMetaFileDC"); + pGdiIsPlayMetafileDC = (void*) GetProcAddress(hgdi32, "GdiIsPlayMetafileDC"); + + /* they should all exist or none should exist */ + if(!pGdiIsMetaPrintDC) + return; + + /* try with nothing */ + ok(!pGdiIsMetaPrintDC(NULL), "ismetaprint with NULL parameter\n"); + ok(!pGdiIsMetaFileDC(NULL), "ismetafile with NULL parameter\n"); + ok(!pGdiIsPlayMetafileDC(NULL), "isplaymetafile with NULL parameter\n"); + + /* try with a metafile */ + hmfDC = CreateMetaFile(NULL); + ok(!pGdiIsMetaPrintDC(hmfDC), "ismetaprint on metafile\n"); + ok(pGdiIsMetaFileDC(hmfDC), "ismetafile on metafile\n"); + ok(!pGdiIsPlayMetafileDC(hmfDC), "isplaymetafile on metafile\n"); + DeleteObject(CloseMetaFile(hmfDC)); + + /* try with an enhanced metafile */ + hdc = GetDC(NULL); + hemfDC = CreateEnhMetaFileW(hdc, NULL, &rect, NULL); + ok(hemfDC != NULL, "failed to create emf\n"); + + ok(!pGdiIsMetaPrintDC(hemfDC), "ismetaprint on emf\n"); + ok(pGdiIsMetaFileDC(hemfDC), "ismetafile on emf\n"); + ok(!pGdiIsPlayMetafileDC(hemfDC), "isplaymetafile on emf\n"); + + hemf = CloseEnhMetaFile(hemfDC); + ok(hemf != NULL, "failed to close EMF\n"); + DeleteObject(hemf); + ReleaseDC(NULL,hdc); +} + START_TEST(metafile) { /* For enhanced metafiles (enhmfdrv) */ @@ -442,4 +619,9 @@ test_mf_Blank(); test_mf_Graphics(); test_mf_PatternBrush(); + + /* For metafile conversions */ + test_mf_conversions(); + + test_gdiis(); } diff -urN wine-20050310/dlls/gdi/wing.c wine-20050419/dlls/gdi/wing.c --- wine-20050310/dlls/gdi/wing.c 2004-12-16 15:35:55.000000000 +0100 +++ wine-20050419/dlls/gdi/wing.c 2005-04-13 18:11:18.000000000 +0200 @@ -23,6 +23,7 @@ #include "windef.h" #include "wownt32.h" #include "gdi.h" +#include "gdi_private.h" #include "wine/wingdi16.h" #include "wine/debug.h" diff -urN wine-20050310/dlls/hhctrl.ocx/hhctrl.c wine-20050419/dlls/hhctrl.ocx/hhctrl.c --- wine-20050310/dlls/hhctrl.ocx/hhctrl.c 2004-10-08 22:49:09.000000000 +0200 +++ wine-20050419/dlls/hhctrl.ocx/hhctrl.c 2005-04-16 12:47:46.000000000 +0200 @@ -30,26 +30,78 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp); -HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD data) +static const char *command_to_string(UINT command) { - FIXME("(%p, %s, %d, %ld): stub\n", caller, debugstr_w(filename), command, data); +#define X(x) case x: return #x + switch (command) + { + X( HH_DISPLAY_TOPIC ); + X( HH_DISPLAY_TOC ); + X( HH_DISPLAY_INDEX ); + X( HH_DISPLAY_SEARCH ); + X( HH_SET_WIN_TYPE ); + X( HH_GET_WIN_TYPE ); + X( HH_GET_WIN_HANDLE ); + X( HH_ENUM_INFO_TYPE ); + X( HH_SET_INFO_TYPE ); + X( HH_SYNC ); + X( HH_RESERVED1 ); + X( HH_RESERVED2 ); + X( HH_RESERVED3 ); + X( HH_KEYWORD_LOOKUP ); + X( HH_DISPLAY_TEXT_POPUP ); + X( HH_HELP_CONTEXT ); + X( HH_TP_HELP_CONTEXTMENU ); + X( HH_TP_HELP_WM_HELP ); + X( HH_CLOSE_ALL ); + X( HH_ALINK_LOOKUP ); + X( HH_GET_LAST_ERROR ); + X( HH_ENUM_CATEGORY ); + X( HH_ENUM_CATEGORY_IT ); + X( HH_RESET_IT_FILTER ); + X( HH_SET_INCLUSIVE_FILTER ); + X( HH_SET_EXCLUSIVE_FILTER ); + X( HH_INITIALIZE ); + X( HH_UNINITIALIZE ); + X( HH_PRETRANSLATEMESSAGE ); + X( HH_SET_GLOBAL_PROPERTY ); + default: return "???"; + } +#undef X +} - /* if command is HH_DISPLAY_TOPIC just display an informative message for now */ - if (command == HH_DISPLAY_TOPIC) - MessageBoxA( NULL, "HTML Help functionality is currently unimplemented.\n\n" - "Try installing Internet Explorer, or using a native hhctrl.ocx with the Mozilla ActiveX control.", - "Wine", MB_OK | MB_ICONEXCLAMATION ); - return 0; +HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD data) +{ + FIXME("(%p, %s, command=%s, data=%ld): stub\n", + caller, debugstr_w( filename ), + command_to_string( command ), data); + + switch (command) + { + case HH_DISPLAY_TOPIC: + case HH_DISPLAY_TOC: + case HH_DISPLAY_SEARCH: + case HH_HELP_CONTEXT: + MessageBoxA( NULL, "HTML Help functionality is currently unimplemented.\n\n" + "Try installing Internet Explorer, or using a native hhctrl.ocx with the Mozilla ActiveX control.", + "Wine", MB_OK | MB_ICONEXCLAMATION ); + default: + return 0; + } } HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD data) { WCHAR *wfile = NULL; - DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); HWND result; - wfile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR)); - MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len ); + if (filename) + { + DWORD len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 ); + + wfile = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR)); + MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len ); + } result = HtmlHelpW( caller, wfile, command, data ); diff -urN wine-20050310/dlls/imagehlp/access.c wine-20050419/dlls/imagehlp/access.c --- wine-20050310/dlls/imagehlp/access.c 2004-04-06 00:50:45.000000000 +0200 +++ wine-20050419/dlls/imagehlp/access.c 2005-03-24 22:01:38.000000000 +0100 @@ -193,9 +193,7 @@ CloseHandle(hFileMapping); hFileMapping=NULL; - pLoadedImage = (PLOADED_IMAGE) HeapAlloc( - IMAGEHLP_hHeap, 0, sizeof(LOADED_IMAGE) - ); + pLoadedImage = HeapAlloc(IMAGEHLP_hHeap, 0, sizeof(LOADED_IMAGE)); pNtHeader = RtlImageNtHeader(hModule); diff -urN wine-20050310/dlls/imm32/imm.c wine-20050419/dlls/imm32/imm.c --- wine-20050310/dlls/imm32/imm.c 2004-12-23 19:41:05.000000000 +0100 +++ wine-20050419/dlls/imm32/imm.c 2005-03-24 22:01:38.000000000 +0100 @@ -1268,14 +1268,14 @@ comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0); if (comp_len) { - CompBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,comp_len * sizeof(WCHAR)); + CompBuffer = HeapAlloc(GetProcessHeap(),0,comp_len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, CompBuffer, comp_len); } read_len = MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, NULL, 0); if (read_len) { - ReadBuffer = (WCHAR*)HeapAlloc(GetProcessHeap(),0,read_len * sizeof(WCHAR)); + ReadBuffer = HeapAlloc(GetProcessHeap(),0,read_len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpRead, dwReadLen, ReadBuffer, read_len); } diff -urN wine-20050310/dlls/iphlpapi/ifenum.c wine-20050419/dlls/iphlpapi/ifenum.c --- wine-20050310/dlls/iphlpapi/ifenum.c 2004-12-23 19:41:05.000000000 +0100 +++ wine-20050419/dlls/iphlpapi/ifenum.c 2005-03-28 16:58:52.000000000 +0200 @@ -165,7 +165,7 @@ { if (!map) { numInterfaces = max(numInterfaces, INITIAL_INTERFACES_ASSUMED); - map = (InterfaceNameMap *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + map = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InterfaceNameMap) + (numInterfaces - 1) * sizeof(InterfaceNameMapEntry)); if (map) @@ -173,7 +173,7 @@ } else { if (map->numAllocated < numInterfaces) { - map = (InterfaceNameMap *)HeapReAlloc(GetProcessHeap(), 0, map, + map = HeapReAlloc(GetProcessHeap(), 0, map, sizeof(InterfaceNameMap) + (numInterfaces - 1) * sizeof(InterfaceNameMapEntry)); if (map) @@ -191,8 +191,7 @@ if (name) { struct ifreq ifr; - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFFLAGS, &ifr) == 0) ret = ifr.ifr_flags & IFF_LOOPBACK; } @@ -245,8 +244,7 @@ /* look for new slot */ for (ndx = 0; !stored && ndx < map->numAllocated; ndx++) { if (!map->table[ndx].inUse) { - strncpy(map->table[ndx].name, name, IFNAMSIZ); - map->table[ndx].name[IFNAMSIZ-1] = '\0'; + lstrcpynA(map->table[ndx].name, name, IFNAMSIZ); map->table[ndx].inUse = TRUE; stored = TRUE; if (ndx >= map->nextAvailable) @@ -321,7 +319,7 @@ guessedNumInterfaces *= 2; HeapFree(GetProcessHeap(), 0, ifc.ifc_buf); ifc.ifc_len = sizeof(struct ifreq) * guessedNumInterfaces; - ifc.ifc_buf = (char *)HeapAlloc(GetProcessHeap(), 0, ifc.ifc_len); + ifc.ifc_buf = HeapAlloc(GetProcessHeap(), 0, ifc.ifc_len); ret = ioctl(fd, SIOCGIFCONF, &ifc); } while (ret == 0 && ifc.ifc_len == (sizeof(struct ifreq) * guessedNumInterfaces)); @@ -429,7 +427,7 @@ EnterCriticalSection(&mapCS); numInterfaces = getNumInterfaces(); - ret = (InterfaceIndexTable *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InterfaceIndexTable) + (numInterfaces - 1) * sizeof(DWORD)); if (ret) { ret->numAllocated = numInterfaces; @@ -447,7 +445,7 @@ EnterCriticalSection(&mapCS); numInterfaces = getNumNonLoopbackInterfaces(); - ret = (InterfaceIndexTable *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InterfaceIndexTable) + (numInterfaces - 1) * sizeof(DWORD)); if (ret) { ret->numAllocated = numInterfaces; @@ -467,8 +465,7 @@ if (fd != -1) { struct ifreq ifr; - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFADDR, &ifr) == 0) memcpy(&ret, ifr.ifr_addr.sa_data + 2, sizeof(DWORD)); close(fd); @@ -499,8 +496,7 @@ if (fd != -1) { struct ifreq ifr; - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFBRDADDR, &ifr) == 0) memcpy(&ret, ifr.ifr_addr.sa_data + 2, sizeof(DWORD)); close(fd); @@ -531,8 +527,7 @@ if (fd != -1) { struct ifreq ifr; - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if (ioctl(fd, SIOCGIFNETMASK, &ifr) == 0) memcpy(&ret, ifr.ifr_addr.sa_data + 2, sizeof(DWORD)); close(fd); @@ -568,8 +563,7 @@ struct ifreq ifr; memset(&ifr, 0, sizeof(struct ifreq)); - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if ((ioctl(fd, SIOCGIFHWADDR, &ifr))) ret = ERROR_INVALID_DATA; else { @@ -716,7 +710,7 @@ if (sysctl(mib, 6, NULL, &mibLen, NULL, 0) < 0) return ERROR_NO_MORE_FILES; - buf = (u_char *)HeapAlloc(GetProcessHeap(), 0, mibLen); + buf = HeapAlloc(GetProcessHeap(), 0, mibLen); if (!buf) return ERROR_NOT_ENOUGH_MEMORY; @@ -813,8 +807,7 @@ if (fd != -1) { struct ifreq ifr; - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if ((ioctl(fd, SIOCGIFMTU, &ifr))) ret = ERROR_INVALID_DATA; else { @@ -855,8 +848,7 @@ if (fd != -1) { struct ifreq ifr; - strncpy(ifr.ifr_name, name, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ-1] = '\0'; + lstrcpynA(ifr.ifr_name, name, IFNAMSIZ); if ((ioctl(fd, SIOCGIFFLAGS, &ifr))) ret = ERROR_INVALID_DATA; else { @@ -940,8 +932,7 @@ iAddr.s_addr = addr; /* extra-anal, just to make auditors happy */ - strncpy(string, inet_ntoa(iAddr), 16); - string[16] = '\0'; + lstrcpynA(string, inet_ntoa(iAddr), sizeof(string)); } return string; } diff -urN wine-20050310/dlls/iphlpapi/iphlpapi_main.c wine-20050419/dlls/iphlpapi/iphlpapi_main.c --- wine-20050310/dlls/iphlpapi/iphlpapi_main.c 2004-12-13 14:21:39.000000000 +0100 +++ wine-20050419/dlls/iphlpapi/iphlpapi_main.c 2005-03-28 16:58:52.000000000 +0200 @@ -123,7 +123,7 @@ ret = GetIfTable(*ppIfTable, &dwSize, bOrder); if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppIfTable = (PMIB_IFTABLE)HeapAlloc(heap, flags, dwSize); + *ppIfTable = HeapAlloc(heap, flags, dwSize); ret = GetIfTable(*ppIfTable, &dwSize, bOrder); } } @@ -164,7 +164,7 @@ ret = GetIpAddrTable(*ppIpAddrTable, &dwSize, bOrder); if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppIpAddrTable = (PMIB_IPADDRTABLE)HeapAlloc(heap, flags, dwSize); + *ppIpAddrTable = HeapAlloc(heap, flags, dwSize); ret = GetIpAddrTable(*ppIpAddrTable, &dwSize, bOrder); } } @@ -205,7 +205,7 @@ ret = GetIpForwardTable(*ppIpForwardTable, &dwSize, bOrder); if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppIpForwardTable = (PMIB_IPFORWARDTABLE)HeapAlloc(heap, flags, dwSize); + *ppIpForwardTable = HeapAlloc(heap, flags, dwSize); ret = GetIpForwardTable(*ppIpForwardTable, &dwSize, bOrder); } } @@ -246,7 +246,7 @@ ret = GetIpNetTable(*ppIpNetTable, &dwSize, bOrder); if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppIpNetTable = (PMIB_IPNETTABLE)HeapAlloc(heap, flags, dwSize); + *ppIpNetTable = HeapAlloc(heap, flags, dwSize); ret = GetIpNetTable(*ppIpNetTable, &dwSize, bOrder); } } @@ -287,7 +287,7 @@ ret = GetTcpTable(*ppTcpTable, &dwSize, bOrder); if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppTcpTable = (PMIB_TCPTABLE)HeapAlloc(heap, flags, dwSize); + *ppTcpTable = HeapAlloc(heap, flags, dwSize); ret = GetTcpTable(*ppTcpTable, &dwSize, bOrder); } } @@ -328,7 +328,7 @@ ret = GetUdpTable(*ppUdpTable, &dwSize, bOrder); if (ret == ERROR_INSUFFICIENT_BUFFER) { - *ppUdpTable = (PMIB_UDPTABLE)HeapAlloc(heap, flags, dwSize); + *ppUdpTable = HeapAlloc(heap, flags, dwSize); ret = GetUdpTable(*ppUdpTable, &dwSize, bOrder); } } @@ -643,10 +643,9 @@ DWORD addrLen = sizeof(ptr->Address), type; /* on Win98 this is left empty, but whatever */ - strncpy(ptr->AdapterName, + lstrcpynA(ptr->AdapterName, getInterfaceNameByIndex(table->indexes[ndx]), - sizeof(ptr->AdapterName)); - ptr->AdapterName[MAX_ADAPTER_NAME_LENGTH] = '\0'; + MAX_ADAPTER_NAME_LENGTH+1); getInterfacePhysicalByIndex(table->indexes[ndx], &addrLen, ptr->Address, &type); /* MS defines address length and type as UINT in some places and diff -urN wine-20050310/dlls/iphlpapi/ipstats.c wine-20050419/dlls/iphlpapi/ipstats.c --- wine-20050310/dlls/iphlpapi/ipstats.c 2004-12-13 14:21:39.000000000 +0100 +++ wine-20050419/dlls/iphlpapi/ipstats.c 2005-03-24 22:01:38.000000000 +0100 @@ -565,7 +565,7 @@ DWORD numRoutes = getNumRoutes(); RouteTable *ret; - ret = (RouteTable *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RouteTable) + (numRoutes - 1) * sizeof(RouteEntry)); if (ret) { FILE *fp; @@ -638,7 +638,7 @@ DWORD numEntries = getNumArpEntries(); PMIB_IPNETTABLE ret; - ret = (PMIB_IPNETTABLE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIB_IPNETTABLE) + (numEntries - 1) * sizeof(MIB_IPNETROW)); if (ret) { FILE *fp; @@ -716,7 +716,7 @@ DWORD numEntries = getNumUdpEntries(); PMIB_UDPTABLE ret; - ret = (PMIB_UDPTABLE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIB_UDPTABLE) + (numEntries - 1) * sizeof(MIB_UDPROW)); if (ret) { FILE *fp; @@ -768,7 +768,7 @@ DWORD numEntries = getNumTcpEntries(); PMIB_TCPTABLE ret; - ret = (PMIB_TCPTABLE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MIB_TCPTABLE) + (numEntries - 1) * sizeof(MIB_TCPROW)); if (ret) { FILE *fp; diff -urN wine-20050310/dlls/itss/chm_lib.c wine-20050419/dlls/itss/chm_lib.c --- wine-20050310/dlls/itss/chm_lib.c 2004-12-09 15:07:59.000000000 +0100 +++ wine-20050419/dlls/itss/chm_lib.c 2005-04-18 12:30:56.000000000 +0200 @@ -1538,7 +1538,7 @@ curPage = h->index_head; /* initialize pathname state */ - strncpyW(prefixRectified, prefix, CHM_MAX_PATHLEN); + lstrcpynW(prefixRectified, prefix, CHM_MAX_PATHLEN); prefixLen = strlenW(prefixRectified); if (prefixLen != 0) { diff -urN wine-20050310/dlls/itss/itss.c wine-20050419/dlls/itss/itss.c --- wine-20050310/dlls/itss/itss.c 2005-02-22 20:30:24.000000000 +0100 +++ wine-20050419/dlls/itss/itss.c 2005-03-21 11:55:13.000000000 +0100 @@ -168,6 +168,9 @@ }; +/*********************************************************************** + * DllGetClassObject (ITSS.@) + */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { DWORD i; diff -urN wine-20050310/dlls/kernel/atom16.c wine-20050419/dlls/kernel/atom16.c --- wine-20050310/dlls/kernel/atom16.c 2005-02-03 17:58:21.000000000 +0100 +++ wine-20050419/dlls/kernel/atom16.c 2005-03-28 16:58:52.000000000 +0200 @@ -210,14 +210,14 @@ if (ATOM_IsIntAtomA( str, &iatom )) return iatom; - TRACE("%s\n",debugstr_a(buffer)); + TRACE("%s\n",debugstr_a(str)); + + if (!(table = ATOM_GetTable( TRUE ))) return 0; /* Make a copy of the string to be sure it doesn't move in linear memory. */ lstrcpynA( buffer, str, sizeof(buffer) ); len = strlen( buffer ); - if (!(table = ATOM_GetTable( TRUE ))) return 0; - hash = ATOM_Hash( table->size, buffer, len ); entry = table->entries[hash]; while (entry) @@ -242,9 +242,10 @@ entryPtr->next = table->entries[hash]; entryPtr->refCount = 1; entryPtr->length = len; - /* Some applications _need_ the '\0' padding provided by this strncpy */ - strncpy( entryPtr->str, buffer, ae_len - sizeof(ATOMENTRY) + 1 ); - entryPtr->str[ae_len - sizeof(ATOMENTRY)] = '\0'; + memcpy( entryPtr->str, buffer, len); + /* Some applications _need_ the '\0' padding provided by memset */ + /* Note that 1 byte of the str is accounted for in the ATOMENTRY struct */ + memset( entryPtr->str+len, 0, ae_len - sizeof(ATOMENTRY) - (len - 1)); table->entries[hash] = entry; TRACE("-- new 0x%x\n", entry); return HANDLETOATOM( entry ); diff -urN wine-20050310/dlls/kernel/comm.c wine-20050419/dlls/kernel/comm.c --- wine-20050310/dlls/kernel/comm.c 2005-02-25 15:07:58.000000000 +0100 +++ wine-20050419/dlls/kernel/comm.c 2005-03-30 19:08:34.000000000 +0200 @@ -635,7 +635,7 @@ * * RETURNS * - * True on success, false on an malformed control string. + * True on success, false on a malformed control string. */ BOOL WINAPI BuildCommDCBW( LPCWSTR devid, /* [in] The unicode device control string. */ @@ -1961,7 +1961,7 @@ fd = get_comm_fd( hFile, GENERIC_WRITE ); if (fd < 0) return FALSE; - commio = (async_commio*) HeapAlloc(GetProcessHeap(), 0, sizeof (async_commio)); + commio = HeapAlloc(GetProcessHeap(), 0, sizeof (async_commio)); if (!commio) { release_comm_fd( hFile, fd ); @@ -1975,8 +1975,8 @@ commio->fd = fd; /* FIXME */ lpOverlapped->InternalHigh = 0; - lpOverlapped->Offset = 0; - lpOverlapped->OffsetHigh = 0; + lpOverlapped->u.s.Offset = 0; + lpOverlapped->u.s.OffsetHigh = 0; SERVER_START_REQ( register_async ) { diff -urN wine-20050310/dlls/kernel/computername.c wine-20050419/dlls/kernel/computername.c --- wine-20050310/dlls/kernel/computername.c 2004-12-06 12:38:25.000000000 +0100 +++ wine-20050419/dlls/kernel/computername.c 2005-03-30 19:04:55.000000000 +0200 @@ -683,23 +683,55 @@ /*********************************************************************** * DnsHostnameToComputerNameA (KERNEL32.@) */ -BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR Hostname, LPSTR ComputerName, - LPDWORD nSize) +BOOL WINAPI DnsHostnameToComputerNameA(LPCSTR hostname, + LPSTR computername, LPDWORD size) { - FIXME("(%s, %s, %08lx): stub\n", debugstr_a(Hostname), - debugstr_a(ComputerName), *nSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + DWORD len; + + FIXME("(%s, %p, %p): stub\n", debugstr_a(hostname), computername, size); + + if (!hostname || !size) return FALSE; + len = lstrlenA(hostname); + + if (len > MAX_COMPUTERNAME_LENGTH) + len = MAX_COMPUTERNAME_LENGTH; + + if (*size < len) + { + *size = len; + return FALSE; + } + if (!computername) return FALSE; + + memcpy( computername, hostname, len ); + computername[len + 1] = 0; + return TRUE; } /*********************************************************************** * DnsHostnameToComputerNameW (KERNEL32.@) */ -BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR Hostname, LPWSTR ComputerName, - LPDWORD nSize) +BOOL WINAPI DnsHostnameToComputerNameW(LPCWSTR hostname, + LPWSTR computername, LPDWORD size) { - FIXME("(%s, %s, %08lx): stub\n", debugstr_w(Hostname), - debugstr_w(ComputerName), *nSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + DWORD len; + + FIXME("(%s, %p, %p): stub\n", debugstr_w(hostname), computername, size); + + if (!hostname || !size) return FALSE; + len = lstrlenW(hostname); + + if (len > MAX_COMPUTERNAME_LENGTH) + len = MAX_COMPUTERNAME_LENGTH; + + if (*size < len) + { + *size = len; + return FALSE; + } + if (!computername) return FALSE; + + memcpy( computername, hostname, len * sizeof(WCHAR) ); + computername[len + 1] = 0; + return TRUE; } diff -urN wine-20050310/dlls/kernel/console.c wine-20050419/dlls/kernel/console.c --- wine-20050310/dlls/kernel/console.c 2005-03-09 12:44:33.000000000 +0100 +++ wine-20050419/dlls/kernel/console.c 2005-04-14 13:30:10.000000000 +0200 @@ -1130,6 +1130,11 @@ siConsole.dwFlags |= STARTF_USEFILLATTRIBUTE; siConsole.dwFillAttribute = siCurrent.dwFillAttribute; } + if (siCurrent.dwFlags & STARTF_USESHOWWINDOW) + { + siConsole.dwFlags |= STARTF_USESHOWWINDOW; + siConsole.wShowWindow = siCurrent.wShowWindow; + } /* FIXME (should pass the unicode form) */ if (siCurrent.lpTitle) siConsole.lpTitle = siCurrent.lpTitle; diff -urN wine-20050310/dlls/kernel/file.c wine-20050419/dlls/kernel/file.c --- wine-20050310/dlls/kernel/file.c 2005-01-14 20:54:39.000000000 +0100 +++ wine-20050419/dlls/kernel/file.c 2005-03-30 21:02:15.000000000 +0200 @@ -323,8 +323,8 @@ return FALSE; } - offset.u.LowPart = overlapped->Offset; - offset.u.HighPart = overlapped->OffsetHigh; + offset.u.LowPart = overlapped->u.s.Offset; + offset.u.HighPart = overlapped->u.s.OffsetHigh; io_status = (PIO_STATUS_BLOCK)overlapped; io_status->u.Status = STATUS_PENDING; @@ -364,8 +364,8 @@ if (overlapped != NULL) { - offset.u.LowPart = overlapped->Offset; - offset.u.HighPart = overlapped->OffsetHigh; + offset.u.LowPart = overlapped->u.s.Offset; + offset.u.HighPart = overlapped->u.s.OffsetHigh; poffset = &offset; hEvent = overlapped->hEvent; io_status = (PIO_STATUS_BLOCK)overlapped; @@ -405,8 +405,8 @@ SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - offset.u.LowPart = overlapped->Offset; - offset.u.HighPart = overlapped->OffsetHigh; + offset.u.LowPart = overlapped->u.s.Offset; + offset.u.HighPart = overlapped->u.s.OffsetHigh; io_status = (PIO_STATUS_BLOCK)overlapped; io_status->u.Status = STATUS_PENDING; @@ -439,8 +439,8 @@ if (overlapped) { - offset.u.LowPart = overlapped->Offset; - offset.u.HighPart = overlapped->OffsetHigh; + offset.u.LowPart = overlapped->u.s.Offset; + offset.u.HighPart = overlapped->u.s.OffsetHigh; poffset = &offset; hEvent = overlapped->hEvent; piosb = (PIO_STATUS_BLOCK)overlapped; @@ -999,13 +999,13 @@ } TRACE( "%p %lx%08lx %lx%08lx flags %lx\n", - hFile, overlapped->OffsetHigh, overlapped->Offset, + hFile, overlapped->u.s.OffsetHigh, overlapped->u.s.Offset, count_high, count_low, flags ); count.u.LowPart = count_low; count.u.HighPart = count_high; - offset.u.LowPart = overlapped->Offset; - offset.u.HighPart = overlapped->OffsetHigh; + offset.u.LowPart = overlapped->u.s.Offset; + offset.u.HighPart = overlapped->u.s.OffsetHigh; status = NtLockFile( hFile, overlapped->hEvent, NULL, NULL, NULL, &offset, &count, NULL, @@ -1050,7 +1050,7 @@ } if (overlapped->hEvent) FIXME("Unimplemented overlapped operation\n"); - return UnlockFile( hFile, overlapped->Offset, overlapped->OffsetHigh, count_low, count_high ); + return UnlockFile( hFile, overlapped->u.s.Offset, overlapped->u.s.OffsetHigh, count_low, count_high ); } @@ -1217,9 +1217,11 @@ if (!strncmpW(filename, bkslashes_with_dotW, 4)) { static const WCHAR pipeW[] = {'P','I','P','E','\\',0}; + static const WCHAR mailslotW[] = {'M','A','I','L','S','L','O','T','\\',0}; if ((isalphaW(filename[4]) && filename[5] == ':' && filename[6] == '\0') || - !strncmpiW( filename + 4, pipeW, 5 )) + !strncmpiW( filename + 4, pipeW, 5 ) || + !strncmpiW( filename + 4, mailslotW, 9 )) { dosdev = 0; } diff -urN wine-20050310/dlls/kernel/format_msg.c wine-20050419/dlls/kernel/format_msg.c --- wine-20050310/dlls/kernel/format_msg.c 2004-12-23 19:48:47.000000000 +0100 +++ wine-20050419/dlls/kernel/format_msg.c 2005-03-24 22:01:38.000000000 +0100 @@ -181,7 +181,7 @@ #define ADD_TO_T(c) do { \ *t++=c;\ if (t-target == talloced) {\ - target = (char*)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,talloced*2);\ + target = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,talloced*2);\ t = target+talloced;\ talloced*=2;\ }\ @@ -320,11 +320,11 @@ } talloced = strlen(target)+1; if (nSize && talloced> 15; - selectorTable = (LPWORD) HeapAlloc( header->heap, 0, nrBlocks * 2 ); + selectorTable = HeapAlloc( header->heap, 0, nrBlocks * 2 ); selectorEven = SELECTOR_AllocBlock( base, totSize, WINE_LDT_FLAGS_DATA ); selectorOdd = SELECTOR_AllocBlock( base + 0x8000, totSize - 0x8000, WINE_LDT_FLAGS_DATA ); if ( !selectorTable || !selectorEven || !selectorOdd ) diff -urN wine-20050310/dlls/kernel/locale.c wine-20050419/dlls/kernel/locale.c --- wine-20050310/dlls/kernel/locale.c 2005-01-19 21:59:32.000000000 +0100 +++ wine-20050419/dlls/kernel/locale.c 2005-04-18 17:42:49.000000000 +0200 @@ -130,8 +130,6 @@ WCHAR lang[128]; WCHAR country[4]; LANGID found_lang_id[NLS_MAX_LANGUAGES]; - WCHAR found_language[NLS_MAX_LANGUAGES][3]; - WCHAR found_country[NLS_MAX_LANGUAGES][3]; int n_found; } LANG_FIND_DATA; @@ -395,8 +393,6 @@ found: l_data->found_lang_id[l_data->n_found] = LangID; - strncpyW(l_data->found_country[l_data->n_found], buf_country, 3); - strncpyW(l_data->found_language[l_data->n_found], buf_language, 3); l_data->n_found++; TRACE("Found id %04X for lang %s\n", LangID, debugstr_w(l_data->lang)); return (l_data->n_found < NLS_MAX_LANGUAGES); /* continue search, unless we have enough */ @@ -1205,6 +1201,27 @@ } +/****************************************************************************** + * SetCPGlobal (KERNEL32.@) + * + * Set the current Ansi code page Id for the system. + * + * PARAMS + * acp [I] code page ID to be the new ACP. + * + * RETURNS + * The previous ACP. + */ +UINT WINAPI SetCPGlobal( UINT acp ) +{ + UINT ret = GetACP(); + const union cptable *new_cptable = wine_cp_get_table( acp ); + + if (new_cptable) ansi_cptable = new_cptable; + return ret; +} + + /*********************************************************************** * GetOEMCP (KERNEL32.@) * @@ -1302,9 +1319,15 @@ */ BOOL WINAPI GetCPInfo( UINT codepage, LPCPINFO cpinfo ) { - const union cptable *table = get_codepage_table( codepage ); + const union cptable *table; + + if (!cpinfo) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } - if (!table) + if (!(table = get_codepage_table( codepage ))) { switch(codepage) { diff -urN wine-20050310/dlls/kernel/ne_module.c wine-20050419/dlls/kernel/ne_module.c --- wine-20050310/dlls/kernel/ne_module.c 2005-03-07 20:24:44.000000000 +0100 +++ wine-20050419/dlls/kernel/ne_module.c 2005-03-30 12:31:33.000000000 +0200 @@ -632,17 +632,17 @@ if (!read_data( handle, 0, &mz_header, sizeof(mz_header)) || (mz_header.e_magic != IMAGE_DOS_SIGNATURE)) - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; if (!read_data( handle, mz_header.e_lfanew, &ne_header, sizeof(ne_header) )) - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE16)21; /* win32 exe */ if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) { MESSAGE("Sorry, this is an OS/2 linear executable (LX) file!\n"); return (HMODULE16)12; } - if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11; /* invalid exe */ + if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return ERROR_BAD_FORMAT; /* We now have a valid NE header */ @@ -651,7 +651,7 @@ * (only fail for OS/2 ne_exetyp 0x01 here?) */ if ((ne_header.ne_exetyp != 0x02 /* Windows */) && (ne_header.ne_exetyp != 0x04) /* Windows 386 */) - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; size = sizeof(NE_MODULE) + /* segment table */ @@ -673,7 +673,7 @@ sizeof(OFSTRUCT) - sizeof(ofs->szPathName) + strlen(path) + 1; hModule = GlobalAlloc16( GMEM_FIXED | GMEM_ZEROINIT, size ); - if (!hModule) return (HMODULE16)11; /* invalid exe */ + if (!hModule) return ERROR_BAD_FORMAT; FarSetOwner16( hModule, hModule ); pModule = (NE_MODULE *)GlobalLock16( hModule ); @@ -728,7 +728,7 @@ HeapFree( GetProcessHeap(), 0, buffer ); HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } pSeg = (struct ne_segment_table_entry_s *)buffer; for (i = ne_header.ne_cseg; i > 0; i--, pSeg++) @@ -742,7 +742,7 @@ { HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } /* Get the resource table */ @@ -753,7 +753,7 @@ if (!READ(mz_header.e_lfanew + ne_header.ne_rsrctab, ne_header.ne_restab - ne_header.ne_rsrctab, pData )) - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; pData += ne_header.ne_restab - ne_header.ne_rsrctab; NE_InitResourceHandler( pModule ); } @@ -768,7 +768,7 @@ { HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } pData += ne_header.ne_modtab - ne_header.ne_restab; @@ -783,7 +783,7 @@ { HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } pData += ne_header.ne_cmod * sizeof(WORD); } @@ -798,7 +798,7 @@ { HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } pData += ne_header.ne_enttab - ne_header.ne_imptab; @@ -816,7 +816,7 @@ HeapFree( GetProcessHeap(), 0, pTempEntryTable ); HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } s = pTempEntryTable; @@ -870,7 +870,7 @@ bundle->first = bundle->last = oldbundle->last + nr_entries; bundle->next = 0; - entry = (ET_ENTRY*)(((BYTE*)entry)+sizeof(ET_BUNDLE)); + entry = (ET_ENTRY*)(((BYTE*)entry)+sizeof(ET_BUNDLE)); } } } @@ -880,7 +880,7 @@ { HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } pData += ne_header.ne_cbenttab + sizeof(ET_BUNDLE) + @@ -912,7 +912,7 @@ if (!pModule->nrname_handle) { GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } FarSetOwner16( pModule->nrname_handle, hModule ); buffer = GlobalLock16( pModule->nrname_handle ); @@ -920,7 +920,7 @@ { GlobalFree16( pModule->nrname_handle ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } } else pModule->nrname_handle = 0; @@ -935,7 +935,7 @@ { if (pModule->nrname_handle) GlobalFree16( pModule->nrname_handle ); GlobalFree16( hModule ); - return (HMODULE16)11; /* invalid exe */ + return ERROR_BAD_FORMAT; } FarSetOwner16( pModule->dlls_to_init, hModule ); } @@ -1159,6 +1159,7 @@ const BUILTIN16_DESCRIPTOR *descr = NULL; char dllname[20], owner[20], *p; const char *basename; + int owner_exists; /* strip path information */ @@ -1169,23 +1170,21 @@ if (strlen(basename) < sizeof(dllname)-4) { - int file_exists; - strcpy( dllname, basename ); p = strrchr( dllname, '.' ); if (!p) strcat( dllname, ".dll" ); for (p = dllname; *p; p++) if (*p >= 'A' && *p <= 'Z') *p += 32; - if (wine_dll_get_owner( dllname, owner, sizeof(owner), &file_exists ) == -1) - { - if (file_exists) return 21; /* it may be a Win32 module then */ - } - else /* found 32-bit owner, try to load it */ + if (wine_dll_get_owner( dllname, owner, sizeof(owner), &owner_exists ) != -1) { HMODULE mod32 = LoadLibraryA( owner ); if (mod32) { - if (!(descr = find_dll_descr( dllname ))) FreeLibrary( mod32 ); + if (!(descr = find_dll_descr( dllname ))) + { + FreeLibrary( mod32 ); + owner_exists = 0; + } /* loading the 32-bit library can have the side effect of loading the module */ /* if so, simply incr the ref count and return the module */ if ((hModule = GetModuleHandle16( libname ))) @@ -1216,6 +1215,7 @@ TRACE("Trying native dll '%s'\n", libname); hinst = NE_LoadModule(libname, lib_only); if (hinst > 32) TRACE_(loaddll)("Loaded module %s : native\n", debugstr_a(libname)); + if (hinst == ERROR_FILE_NOT_FOUND && owner_exists) hinst = 21; /* win32 module */ } if (hinst > 32 && !implicit) @@ -1310,7 +1310,7 @@ { /* Special case: second instance of an already loaded NE module */ - if ( !( pModule = NE_GetPtr( hModule ) ) ) return (HINSTANCE16)11; + if ( !( pModule = NE_GetPtr( hModule ) ) ) return ERROR_BAD_FORMAT; if ( pModule->module32 ) return (HINSTANCE16)21; /* Increment refcount */ @@ -1325,7 +1325,7 @@ return hModule; if ( !(pModule = NE_GetPtr( hModule )) ) - return (HINSTANCE16)11; + return ERROR_BAD_FORMAT; } /* If library module, we just retrieve the instance handle */ @@ -1827,7 +1827,7 @@ HeapFree( GetProcessHeap(), 0, cmdline ); if (name != lpCmdLine) HeapFree( GetProcessHeap(), 0, name ); - if (ret == 21 || ret == 11) /* 32-bit module or unknown executable*/ + if (ret == 21 || ret == ERROR_BAD_FORMAT) /* 32-bit module or unknown executable*/ { DWORD count; ReleaseThunkLock( &count ); @@ -2094,11 +2094,11 @@ char filename[MAX_PATH]; IMAGE_NT_HEADERS *nt = RtlImageNtHeader( module32 ); - if (!nt) return (HMODULE16)11; /* invalid exe */ + if (!nt) return ERROR_BAD_FORMAT; /* Extract base filename */ len = GetModuleFileNameA( module32, filename, sizeof(filename) ); - if (!len || len >= sizeof(filename)) return (HMODULE16)11; /* invalid exe */ + if (!len || len >= sizeof(filename)) return ERROR_BAD_FORMAT; basename = strrchr(filename, '\\'); if (!basename) basename = filename; else basename++; @@ -2119,7 +2119,7 @@ 8; hModule = GlobalAlloc16( GMEM_MOVEABLE | GMEM_ZEROINIT, size ); - if (!hModule) return (HMODULE16)11; /* invalid exe */ + if (!hModule) return ERROR_BAD_FORMAT; FarSetOwner16( hModule, hModule ); pModule = (NE_MODULE *)GlobalLock16( hModule ); diff -urN wine-20050310/dlls/kernel/ne_segment.c wine-20050419/dlls/kernel/ne_segment.c --- wine-20050310/dlls/kernel/ne_segment.c 2004-06-16 21:02:11.000000000 +0200 +++ wine-20050419/dlls/kernel/ne_segment.c 2005-03-24 22:01:38.000000000 +0100 @@ -242,7 +242,7 @@ (char *)pModule + pModule->name_table + 1, segnum, pSeg->hSeg ); - reloc_entries = (struct relocation_entry_s *)HeapAlloc(GetProcessHeap(), 0, count * sizeof(struct relocation_entry_s)); + reloc_entries = HeapAlloc(GetProcessHeap(), 0, count * sizeof(struct relocation_entry_s)); if(reloc_entries == NULL) { WARN("Not enough memory for relocation entries!\n"); goto fail; diff -urN wine-20050310/dlls/kernel/process.c wine-20050419/dlls/kernel/process.c --- wine-20050310/dlls/kernel/process.c 2005-03-07 20:24:44.000000000 +0100 +++ wine-20050419/dlls/kernel/process.c 2005-03-19 18:14:12.000000000 +0100 @@ -2192,11 +2192,32 @@ DWORD WINAPI TlsAlloc( void ) { DWORD index; + PEB * const peb = NtCurrentTeb()->Peb; RtlAcquirePebLock(); - index = RtlFindClearBitsAndSet( NtCurrentTeb()->Peb->TlsBitmap, 1, 0 ); + index = RtlFindClearBitsAndSet( peb->TlsBitmap, 1, 0 ); if (index != ~0UL) NtCurrentTeb()->TlsSlots[index] = 0; /* clear the value */ - else SetLastError( ERROR_NO_MORE_ITEMS ); + else + { + index = RtlFindClearBitsAndSet( peb->TlsExpansionBitmap, 1, 0 ); + if (index != ~0UL) + { + if (!NtCurrentTeb()->TlsExpansionSlots && + !(NtCurrentTeb()->TlsExpansionSlots = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + 8 * sizeof(peb->TlsExpansionBitmapBits) * sizeof(void*) ))) + { + RtlClearBits( peb->TlsExpansionBitmap, index, 1 ); + index = ~0UL; + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + } + else + { + NtCurrentTeb()->TlsExpansionSlots[index] = 0; /* clear the value */ + index += TLS_MINIMUM_AVAILABLE; + } + } + else SetLastError( ERROR_NO_MORE_ITEMS ); + } RtlReleasePebLock(); return index; } @@ -2217,12 +2238,17 @@ BOOL ret; RtlAcquirePebLock(); - ret = RtlAreBitsSet( NtCurrentTeb()->Peb->TlsBitmap, index, 1 ); - if (ret) + if (index >= TLS_MINIMUM_AVAILABLE) + { + ret = RtlAreBitsSet( NtCurrentTeb()->Peb->TlsExpansionBitmap, index - TLS_MINIMUM_AVAILABLE, 1 ); + if (ret) RtlClearBits( NtCurrentTeb()->Peb->TlsExpansionBitmap, index - TLS_MINIMUM_AVAILABLE, 1 ); + } + else { - RtlClearBits( NtCurrentTeb()->Peb->TlsBitmap, index, 1 ); - NtSetInformationThread( GetCurrentThread(), ThreadZeroTlsCell, &index, sizeof(index) ); + ret = RtlAreBitsSet( NtCurrentTeb()->Peb->TlsBitmap, index, 1 ); + if (ret) RtlClearBits( NtCurrentTeb()->Peb->TlsBitmap, index, 1 ); } + if (ret) NtSetInformationThread( GetCurrentThread(), ThreadZeroTlsCell, &index, sizeof(index) ); else SetLastError( ERROR_INVALID_PARAMETER ); RtlReleasePebLock(); return TRUE; @@ -2239,13 +2265,25 @@ LPVOID WINAPI TlsGetValue( DWORD index) /* [in] TLS index to retrieve value for */ { - if (index >= NtCurrentTeb()->Peb->TlsBitmap->SizeOfBitMap) + LPVOID ret; + + if (index < TLS_MINIMUM_AVAILABLE) { - SetLastError( ERROR_INVALID_PARAMETER ); - return NULL; + ret = NtCurrentTeb()->TlsSlots[index]; + } + else + { + index -= TLS_MINIMUM_AVAILABLE; + if (index >= 8 * sizeof(NtCurrentTeb()->Peb->TlsExpansionBitmapBits)) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + if (!NtCurrentTeb()->TlsExpansionSlots) ret = NULL; + else ret = NtCurrentTeb()->TlsExpansionSlots[index]; } SetLastError( ERROR_SUCCESS ); - return NtCurrentTeb()->TlsSlots[index]; + return ret; } @@ -2260,12 +2298,27 @@ DWORD index, /* [in] TLS index to set value for */ LPVOID value) /* [in] Value to be stored */ { - if (index >= NtCurrentTeb()->Peb->TlsBitmap->SizeOfBitMap) + if (index < TLS_MINIMUM_AVAILABLE) { - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; + NtCurrentTeb()->TlsSlots[index] = value; + } + else + { + index -= TLS_MINIMUM_AVAILABLE; + if (index >= 8 * sizeof(NtCurrentTeb()->Peb->TlsExpansionBitmapBits)) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + if (!NtCurrentTeb()->TlsExpansionSlots && + !(NtCurrentTeb()->TlsExpansionSlots = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + 8 * sizeof(NtCurrentTeb()->Peb->TlsExpansionBitmapBits) * sizeof(void*) ))) + { + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + return FALSE; + } + NtCurrentTeb()->TlsExpansionSlots[index] = value; } - NtCurrentTeb()->TlsSlots[index] = value; return TRUE; } diff -urN wine-20050310/dlls/kernel/profile.c wine-20050419/dlls/kernel/profile.c --- wine-20050310/dlls/kernel/profile.c 2005-03-04 11:46:55.000000000 +0100 +++ wine-20050419/dlls/kernel/profile.c 2005-03-28 16:58:52.000000000 +0200 @@ -899,7 +899,7 @@ static INT PROFILE_GetSectionNames( LPWSTR buffer, UINT len ) { LPWSTR buf; - UINT f,l; + UINT buflen,tmplen; PROFILESECTION *section; TRACE("(%p, %d)\n", buffer, len); @@ -911,24 +911,24 @@ return 0; } - f=len-1; + buflen=len-1; buf=buffer; section = CurProfile->section; while ((section!=NULL)) { if (section->name[0]) { - l = strlenW(section->name)+1; - if (l > f) { - if (f>0) { - strncpyW(buf, section->name, f-1); - buf += f-1; + tmplen = strlenW(section->name)+1; + if (tmplen > buflen) { + if (buflen > 0) { + memcpy(buf, section->name, (buflen-1) * sizeof(WCHAR)); + buf += buflen-1; *buf++='\0'; } *buf='\0'; return len-2; } - strcpyW(buf, section->name); - buf += l; - f -= l; + memcpy(buf, section->name, tmplen * sizeof(WCHAR)); + buf += tmplen; + buflen -= tmplen; } section = section->next; } @@ -1109,7 +1109,7 @@ LPWSTR p; p = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); - strncpyW(p, def_val, len); + memcpy(p, def_val, len * sizeof(WCHAR)); p[len] = '\0'; pDefVal = p; } diff -urN wine-20050310/dlls/kernel/resource16.c wine-20050419/dlls/kernel/resource16.c --- wine-20050310/dlls/kernel/resource16.c 2004-07-23 21:09:35.000000000 +0200 +++ wine-20050419/dlls/kernel/resource16.c 2005-03-24 22:01:38.000000000 +0100 @@ -97,10 +97,10 @@ { if (map->elem) - newElem = (HRSRC_ELEM *)HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + newElem = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, map->elem, (map->nAlloc + HRSRC_MAP_BLOCKSIZE) * sizeof(HRSRC_ELEM) ); else - newElem = (HRSRC_ELEM *)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + newElem = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, (map->nAlloc + HRSRC_MAP_BLOCKSIZE) * sizeof(HRSRC_ELEM) ); if ( !newElem ) diff -urN wine-20050310/dlls/kernel/sync.c wine-20050419/dlls/kernel/sync.c --- wine-20050310/dlls/kernel/sync.c 2005-03-04 13:38:37.000000000 +0100 +++ wine-20050419/dlls/kernel/sync.c 2005-04-18 16:57:04.000000000 +0200 @@ -41,6 +41,9 @@ #include #include +#define NONAMELESSUNION +#define NONAMELESSSTRUCT + #include "ntstatus.h" #include "windef.h" #include "winbase.h" @@ -1051,15 +1054,20 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, - DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES attr ) + DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES sa ) { - HANDLE ret; + HANDLE handle; UNICODE_STRING nt_name; - static const WCHAR leadin[] = {'\\','?','?','\\','P','I','P','E','\\'}; + OBJECT_ATTRIBUTES attr; + DWORD options; + BOOLEAN pipe_type, read_mode, non_block; + NTSTATUS status; + IO_STATUS_BLOCK iosb; + LARGE_INTEGER timeout; TRACE("(%s, %#08lx, %#08lx, %ld, %ld, %ld, %ld, %p)\n", debugstr_w(name), dwOpenMode, dwPipeMode, nMaxInstances, - nOutBufferSize, nInBufferSize, nDefaultTimeOut, attr ); + nOutBufferSize, nInBufferSize, nDefaultTimeOut, sa ); if (!RtlDosPathNameToNtPathName_U( name, &nt_name, NULL, NULL )) { @@ -1072,30 +1080,42 @@ RtlFreeUnicodeString( &nt_name ); return INVALID_HANDLE_VALUE; } - if (nt_name.Length < sizeof(leadin) || - strncmpiW( nt_name.Buffer, leadin, sizeof(leadin)/sizeof(leadin[0]))) - { - SetLastError( ERROR_INVALID_NAME ); - RtlFreeUnicodeString( &nt_name ); - return INVALID_HANDLE_VALUE; - } - SERVER_START_REQ( create_named_pipe ) + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &nt_name; + attr.Attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + attr.SecurityQualityOfService = NULL; + + options = 0; + if (dwOpenMode & FILE_FLAG_WRITE_THROUGH) options |= FILE_WRITE_THROUGH; + if (!(dwOpenMode & FILE_FLAG_OVERLAPPED)) options |= FILE_SYNCHRONOUS_IO_ALERT; + if ((dwOpenMode & PIPE_ACCESS_DUPLEX) == PIPE_ACCESS_DUPLEX) + options |= FILE_PIPE_FULL_DUPLEX; + else if (dwOpenMode & PIPE_ACCESS_INBOUND) options |= FILE_PIPE_INBOUND; + else if (dwOpenMode & PIPE_ACCESS_OUTBOUND) options |= FILE_PIPE_OUTBOUND; + pipe_type = (dwPipeMode & PIPE_TYPE_MESSAGE) ? TRUE : FALSE; + read_mode = (dwPipeMode & PIPE_READMODE_MESSAGE) ? TRUE : FALSE; + non_block = (dwPipeMode & PIPE_NOWAIT) ? TRUE : FALSE; + if (nMaxInstances >= PIPE_UNLIMITED_INSTANCES) nMaxInstances = ULONG_MAX; + + timeout.QuadPart = (ULONGLONG)nDefaultTimeOut * -10000; + + SetLastError(0); + + status = NtCreateNamedPipeFile(&handle, 0, &attr, &iosb, 0, FILE_OVERWRITE_IF, + options, pipe_type, read_mode, non_block, + nMaxInstances, nInBufferSize, nOutBufferSize, + &timeout); + + RtlFreeUnicodeString( &nt_name ); + if (status) { - req->openmode = dwOpenMode; - req->pipemode = dwPipeMode; - req->maxinstances = nMaxInstances; - req->outsize = nOutBufferSize; - req->insize = nInBufferSize; - req->timeout = nDefaultTimeOut; - req->inherit = (attr && (attr->nLength>=sizeof(*attr)) && attr->bInheritHandle); - wine_server_add_data( req, nt_name.Buffer + 4, nt_name.Length - 4*sizeof(WCHAR) ); - SetLastError(0); - if (!wine_server_call_err( req )) ret = reply->handle; - else ret = INVALID_HANDLE_VALUE; + handle = INVALID_HANDLE_VALUE; + SetLastError( RtlNtStatusToDosError(status) ); } - SERVER_END_REQ; - RtlFreeUnicodeString( &nt_name ); - return ret; + return handle; } @@ -1108,6 +1128,8 @@ #ifdef FIONREAD int avail=0, fd, ret, flags; + TRACE("(%p,%p,%lu,%p,%p,%p)\n", hPipe, lpvBuffer, cbBuffer, lpcbRead, lpcbAvail, lpcbMessage); + ret = wine_server_handle_to_fd( hPipe, GENERIC_READ, &fd, &flags ); if (ret) { @@ -1153,7 +1175,7 @@ *lpcbAvail = avail; if (lpcbRead) *lpcbRead = 0; - if (avail && lpvBuffer) + if (avail && lpvBuffer && cbBuffer) { int readbytes = (avail < cbBuffer) ? avail : cbBuffer; readbytes = recv(fd, lpvBuffer, readbytes, MSG_PEEK); @@ -1175,17 +1197,21 @@ } /*********************************************************************** - * SYNC_CompletePipeOverlapped (Internal) + * PIPE_CompletionWait (Internal) */ -static void CALLBACK SYNC_CompletePipeOverlapped (LPOVERLAPPED overlapped, DWORD result) +static void CALLBACK PIPE_CompletionWait(void *user, PIO_STATUS_BLOCK iosb, ULONG status) { - TRACE("for %p result %08lx\n",overlapped,result); - if(!overlapped) - return; - overlapped->Internal = result; - SetEvent(overlapped->hEvent); -} + LPOVERLAPPED ovlp = (LPOVERLAPPED)user; + TRACE("for %p/%p, status=%08lx\n", ovlp, iosb, status); + + if (ovlp) + { + ovlp->Internal = status; + SetEvent(ovlp->hEvent); + } + TRACE("done\n"); +} /*********************************************************************** * WaitNamedPipeA (KERNEL32.@) @@ -1241,7 +1267,7 @@ { req->timeout = nTimeOut; req->overlapped = &ov; - req->func = SYNC_CompletePipeOverlapped; + req->func = PIPE_CompletionWait; wine_server_add_data( req, nt_name.Buffer + 4, nt_name.Length - 4*sizeof(WCHAR) ); ret = !wine_server_call_err( req ); } @@ -1263,63 +1289,50 @@ /*********************************************************************** - * SYNC_ConnectNamedPipe (Internal) + * ConnectNamedPipe (KERNEL32.@) */ -static BOOL SYNC_ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped) +BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped) { - BOOL ret; - - if(!overlapped) - return FALSE; - - overlapped->Internal = STATUS_PENDING; + BOOL ret; + LPOVERLAPPED pov; + OVERLAPPED ov; + + TRACE("(%p,%p)\n", hPipe, overlapped); + + if (!overlapped) + { + memset(&ov, 0, sizeof(ov)); + ov.hEvent = CreateEventW(NULL, 0, 0, NULL); + if (!ov.hEvent) return FALSE; + pov = &ov; + } + else pov = overlapped; + + pov->Internal = STATUS_PENDING; SERVER_START_REQ( connect_named_pipe ) { req->handle = hPipe; - req->overlapped = overlapped; - req->func = SYNC_CompletePipeOverlapped; + req->overlapped = pov; + req->func = PIPE_CompletionWait; ret = !wine_server_call_err( req ); } SERVER_END_REQ; - return ret; -} - -/*********************************************************************** - * ConnectNamedPipe (KERNEL32.@) - */ -BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped) -{ - OVERLAPPED ov; - BOOL ret; - - TRACE("(%p,%p)\n",hPipe, overlapped); - - if(overlapped) + if (ret) { - if(SYNC_ConnectNamedPipe(hPipe,overlapped)) + if (overlapped) + { SetLastError( ERROR_IO_PENDING ); - return FALSE; - } - - memset(&ov,0,sizeof(ov)); - ov.hEvent = CreateEventW(NULL,0,0,NULL); - if (!ov.hEvent) - return FALSE; - - ret=SYNC_ConnectNamedPipe(hPipe, &ov); - if(ret) - { - if (WAIT_OBJECT_0==WaitForSingleObject(ov.hEvent,INFINITE)) + ret = FALSE; + } + else { - SetLastError(RtlNtStatusToDosError(ov.Internal)); - ret = (ov.Internal==STATUS_SUCCESS); + ret = GetOverlappedResult(hPipe, &ov, NULL, TRUE); + CloseHandle(ov.hEvent); } } - CloseHandle(ov.hEvent); - return ret; } @@ -1389,10 +1402,19 @@ { req->handle = hNamedPipe; ret = !wine_server_call_err( req ); - if(lpFlags) *lpFlags = reply->flags; - if(lpOutputBufferSize) *lpOutputBufferSize = reply->outsize; - if(lpInputBufferSize) *lpInputBufferSize = reply->outsize; - if(lpMaxInstances) *lpMaxInstances = reply->maxinstances; + if (lpFlags) + { + *lpFlags = 0; + if (reply->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) + *lpFlags |= PIPE_TYPE_MESSAGE; + if (reply->flags & NAMED_PIPE_MESSAGE_STREAM_READ) + *lpFlags |= PIPE_READMODE_MESSAGE; + if (reply->flags & NAMED_PIPE_NONBLOCKING_MODE) + *lpFlags |= PIPE_NOWAIT; + } + if (lpOutputBufferSize) *lpOutputBufferSize = reply->outsize; + if (lpInputBufferSize) *lpInputBufferSize = reply->outsize; + if (lpMaxInstances) *lpMaxInstances = reply->maxinstances; } SERVER_END_REQ; @@ -1574,10 +1596,48 @@ HANDLE WINAPI CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES sa ) { - FIXME("(%s,%ld,%ld,%p): stub\n", debugstr_w(lpName), + HANDLE handle = INVALID_HANDLE_VALUE; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING nameW; + LARGE_INTEGER timeout; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + TRACE("%s %ld %ld %p\n", debugstr_w(lpName), nMaxMessageSize, lReadTimeout, sa); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return INVALID_HANDLE_VALUE; + + if (!RtlDosPathNameToNtPathName_U( lpName, &nameW, NULL, NULL )) + { + SetLastError( ERROR_PATH_NOT_FOUND ); + return INVALID_HANDLE_VALUE; + } + + if (nameW.Length >= MAX_PATH * sizeof(WCHAR) ) + { + SetLastError( ERROR_FILENAME_EXCED_RANGE ); + RtlFreeUnicodeString( &nameW ); + return INVALID_HANDLE_VALUE; + } + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.Attributes = OBJ_CASE_INSENSITIVE; + attr.ObjectName = &nameW; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + attr.SecurityQualityOfService = NULL; + + timeout.QuadPart = (ULONGLONG) lReadTimeout * -10000; + + status = NtCreateMailslotFile( &handle, GENERIC_READ | GENERIC_WRITE, &attr, + &iosb, 0, 0, nMaxMessageSize, &timeout ); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + handle = INVALID_HANDLE_VALUE; + } + + RtlFreeUnicodeString( &nameW ); + return handle; } @@ -1601,9 +1661,32 @@ LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout ) { - FIXME("(%p): stub\n",hMailslot); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + FILE_MAILSLOT_QUERY_INFORMATION info; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + TRACE("%p %p %p %p %p\n",hMailslot, lpMaxMessageSize, + lpNextSize, lpMessageCount, lpReadTimeout); + + status = NtQueryInformationFile( hMailslot, &iosb, &info, sizeof info, + FileMailslotQueryInformation ); + + if( status != STATUS_SUCCESS ) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + + if( lpMaxMessageSize ) + *lpMaxMessageSize = info.MaximumMessageSize; + if( lpNextSize ) + *lpNextSize = info.NextMessageSize; + if( lpMessageCount ) + *lpMessageCount = info.MessagesAvailable; + if( lpReadTimeout ) + *lpReadTimeout = info.ReadTimeout.QuadPart / -10000; + + return TRUE; } @@ -1622,9 +1705,21 @@ */ BOOL WINAPI SetMailslotInfo( HANDLE hMailslot, DWORD dwReadTimeout) { - FIXME("%p %ld: stub\n", hMailslot, dwReadTimeout); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + FILE_MAILSLOT_SET_INFORMATION info; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + TRACE("%p %ld\n", hMailslot, dwReadTimeout); + + info.ReadTimeout.QuadPart = dwReadTimeout * -10000; + status = NtSetInformationFile( hMailslot, &iosb, &info, sizeof info, + FileMailslotSetInformation ); + if( status != STATUS_SUCCESS ) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + return TRUE; } diff -urN wine-20050310/dlls/kernel/task.c wine-20050419/dlls/kernel/task.c --- wine-20050310/dlls/kernel/task.c 2004-11-03 23:18:44.000000000 +0100 +++ wine-20050419/dlls/kernel/task.c 2005-04-18 17:36:21.000000000 +0200 @@ -293,9 +293,11 @@ if (hModule) { - char name[10]; + char name[sizeof(pTask->module_name)+1]; + size_t len; GetModuleName16( hModule, name, sizeof(name) ); - strncpy( pTask->module_name, name, sizeof(pTask->module_name) ); + len = strlen(name) + 1; + memcpy(pTask->module_name, name, min(len,sizeof(pTask->module_name))); pTask->compat_flags = GetProfileIntA( "Compatibility", name, 0 ); } diff -urN wine-20050310/dlls/kernel/tests/atom.c wine-20050419/dlls/kernel/tests/atom.c --- wine-20050310/dlls/kernel/tests/atom.c 2004-01-23 03:10:33.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/atom.c 2005-04-18 17:47:18.000000000 +0200 @@ -183,9 +183,164 @@ } } +static void test_local_add_atom(void) +{ + ATOM atom, w_atom; + int i; + + SetLastError( 0xdeadbeef ); + atom = AddAtomA( "foobar" ); + ok( atom >= 0xc000, "bad atom id %x\n", atom ); + ok( GetLastError() == 0xdeadbeef, "AddAtomA set last error\n" ); + + /* Verify that it can be found (or not) appropriately */ + ok( FindAtomA( "foobar" ) == atom, "could not find atom foobar\n" ); + ok( FindAtomA( "FOOBAR" ) == atom, "could not find atom FOOBAR\n" ); + ok( !FindAtomA( "_foobar" ), "found _foobar\n" ); + + /* Add the same atom, specifying string as unicode; should + * find the first one, not add a new one */ + SetLastError( 0xdeadbeef ); + w_atom = AddAtomW( foobarW ); + if (w_atom && GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + unicode_OS = TRUE; + else + trace("WARNING: Unicode atom APIs are not supported on this platform\n"); + + if (unicode_OS) + { + ok( w_atom == atom, "Unicode atom does not match ASCII\n" ); + ok( GetLastError() == 0xdeadbeef, "AddAtomW set last error\n" ); + } + + /* Verify that it can be found (or not) appropriately via unicode name */ + if (unicode_OS) + { + ok( FindAtomW( foobarW ) == atom, "could not find atom foobar\n" ); + ok( FindAtomW( FOOBARW ) == atom, "could not find atom FOOBAR\n" ); + ok( !FindAtomW( _foobarW ), "found _foobar\n" ); + } + + /* Test integer atoms + * (0x0001 .. 0xbfff) should be valid; + * (0xc000 .. 0xffff) should be invalid */ + + SetLastError( 0xdeadbeef ); + ok( AddAtomA(0) == 0 && GetLastError() == 0xdeadbeef, "succeeded to add atom 0\n" ); + if (unicode_OS) + { + SetLastError( 0xdeadbeef ); + ok( AddAtomW(0) == 0 && GetLastError() == 0xdeadbeef, "succeeded to add atom 0\n" ); + } + + SetLastError( 0xdeadbeef ); + for (i = 1; i <= 0xbfff; i++) + { + SetLastError( 0xdeadbeef ); + ok( AddAtomA((LPCSTR)i) == i && GetLastError() == 0xdeadbeef, + "failed to add atom %x\n", i ); + if (unicode_OS) + { + SetLastError( 0xdeadbeef ); + ok( AddAtomW((LPCWSTR)i) == i && GetLastError() == 0xdeadbeef, + "failed to add atom %x\n", i ); + } + } + + for (i = 0xc000; i <= 0xffff; i++) + { + ok( !AddAtomA((LPCSTR)i), "succeeded adding %x\n", i ); + if (unicode_OS) + ok( !AddAtomW((LPCWSTR)i), "succeeded adding %x\n", i ); + } +} + +static void test_local_get_atom_name(void) +{ + char buf[10]; + WCHAR bufW[10]; + int i; + UINT len; + static const WCHAR resultW[] = {'f','o','o','b','a','r',0,'.','.','.'}; + + ATOM atom = AddAtomA( "foobar" ); + + /* Get the name of the atom we added above */ + memset( buf, '.', sizeof(buf) ); + len = GetAtomNameA( atom, buf, 10 ); + ok( len == strlen("foobar"), "bad length %d\n", len ); + ok( !memcmp( buf, "foobar\0...", 10 ), "bad buffer contents\n" ); + + /* Repeat, unicode-style */ + if (unicode_OS) + { + for (i = 0; i < 10; i++) bufW[i] = '.'; + SetLastError( 0xdeadbeef ); + len = GetAtomNameW( atom, bufW, 10 ); + ok( len && GetLastError() == 0xdeadbeef, "GetAtomNameW failed\n" ); + ok( len == lstrlenW(foobarW), "bad length %d\n", len ); + ok( !memcmp( bufW, resultW, 10*sizeof(WCHAR) ), "bad buffer contents\n" ); + } + + /* Check error code returns */ + memset(buf, '.', 10); + ok( !GetAtomNameA( atom, buf, 0 ), "succeeded\n" ); + ok( !memcmp( buf, "..........", 10 ), "should not touch buffer\n" ); + + if (unicode_OS) + { + static const WCHAR sampleW[10] = {'.','.','.','.','.','.','.','.','.','.'}; + + for (i = 0; i < 10; i++) bufW[i] = '.'; + ok( !GetAtomNameW( atom, bufW, 0 ), "succeeded\n" ); + ok( !memcmp( bufW, sampleW, 10 * sizeof(WCHAR) ), "should not touch buffer\n" ); + } + + /* Test integer atoms */ + for (i = 0; i <= 0xbfff; i++) + { + memset( buf, 'a', 10 ); + len = GetAtomNameA( (ATOM)i, buf, 10 ); + if (i) + { + char res[20]; + ok( (len > 1) && (len < 7), "bad length %d\n", len ); + sprintf( res, "#%d", i ); + memset( res + strlen(res) + 1, 'a', 10 ); + ok( !memcmp( res, buf, 10 ), "bad buffer contents %s\n", buf ); + } + else + ok( !len, "bad length %d\n", len ); + } +} + +static void test_local_error_handling(void) +{ + char buffer[260]; + WCHAR bufferW[260]; + int i; + + memset( buffer, 'a', 256 ); + buffer[256] = 0; + ok( !AddAtomA(buffer), "add succeeded\n" ); + ok( !FindAtomA(buffer), "find succeeded\n" ); + + if (unicode_OS) + { + for (i = 0; i < 256; i++) bufferW[i] = 'b'; + bufferW[256] = 0; + ok( !AddAtomW(bufferW), "add succeeded\n" ); + ok( !FindAtomW(bufferW), "find succeeded\n" ); + } +} + + START_TEST(atom) { test_add_atom(); test_get_atom_name(); test_error_handling(); + test_local_add_atom(); + test_local_get_atom_name(); + test_local_error_handling(); } diff -urN wine-20050310/dlls/kernel/tests/environ.c wine-20050419/dlls/kernel/tests/environ.c --- wine-20050310/dlls/kernel/tests/environ.c 2005-03-10 18:15:39.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/environ.c 2005-03-22 19:17:07.000000000 +0100 @@ -218,10 +218,11 @@ ret_size1 = GetWindowsDirectoryA(buf1,256); ok ((ret_size1 >0) && (ret_size1<256), "GetWindowsDirectory Failed\n"); - ret_size = ExpandEnvironmentStringsA("%SystemRoot%",buf,256); - ok(!strcmp(buf, buf1), "ExpandEnvironmentStrings failed %s vs %s\n", buf, buf1); + ret_size = ExpandEnvironmentStringsA("%SystemRoot%",buf,sizeof(buf)); + if (ERROR_ENVVAR_NOT_FOUND == GetLastError()) + return; + ok(!strcmp(buf, buf1), "ExpandEnvironmentStrings failed %s vs %s. ret_size = %ld\n", buf, buf1, ret_size); } - START_TEST(environ) { diff -urN wine-20050310/dlls/kernel/tests/file.c wine-20050419/dlls/kernel/tests/file.c --- wine-20050310/dlls/kernel/tests/file.c 2005-03-02 14:53:51.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/file.c 2005-04-19 13:59:46.000000000 +0200 @@ -28,6 +28,17 @@ #include "winbase.h" #include "winerror.h" +#ifdef NONAMELESSUNION +# define U(x) (x).u +#else +# define U(x) (x) +#endif +#ifdef NONAMELESSSTRUCT +# define S(x) (x).s +#else +# define S(x) (x) +#endif + static int dll_capable(const char *dll, const char *function) { HMODULE module = GetModuleHandleA(dll); @@ -560,9 +571,12 @@ "WriteFile error %ld\n", GetLastError()); ok(GetFileSize(hfile, NULL) == sizeof(prefix), "source file has wrong size\n"); /* get the file time and change it to prove the difference */ - ok(GetFileTime(hfile, NULL, NULL, &ft1), "GetFileTime error %ld\n", GetLastError()); + ret = GetFileTime(hfile, NULL, NULL, &ft1); + ok( ret, "GetFileTime error %ld\n", GetLastError()); ft1.dwLowDateTime -= 600000000; /* 60 second */ - ok(SetFileTime(hfile, NULL, NULL, &ft1), "SetFileTime error %ld\n", GetLastError()); + ret = SetFileTime(hfile, NULL, NULL, &ft1); + ok( ret, "SetFileTime error %ld\n", GetLastError()); + GetFileTime(hfile, NULL, NULL, &ft1); /* get the actual time back */ CloseHandle(hfile); ret = GetTempFileNameA(temp_path, prefix, 0, dest); @@ -583,8 +597,8 @@ ok(ret == sizeof(prefix), "destination file has wrong size %ld\n", ret); /* make sure that destination has the same filetime */ - ok(ret = GetFileTime(hfile, NULL, NULL, &ft1), "GetFileTime error %ld\n", GetLastError()); - ok(ret = GetFileTime(hfile, NULL, NULL, &ft2), "GetFileTime error %ld\n", GetLastError()); + ret = GetFileTime(hfile, NULL, NULL, &ft2); + ok( ret, "GetFileTime error %ld\n", GetLastError()); ok(CompareFileTime(&ft1, &ft2) == 0, "destination file has wrong filetime\n"); SetLastError(0xdeadbeef); @@ -690,10 +704,12 @@ ret = DeleteFileW(filename); ok(ret, "DeleteFileW: error %ld\n", GetLastError()); +#if 0 /* this test crashes on NT4.0 */ hFile = CreateFileW(NULL, GENERIC_READ, 0, NULL, CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); ok(hFile == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND, "CreateFileW(NULL) returned ret=%p error=%ld\n",hFile,GetLastError()); +#endif hFile = CreateFileW(emptyW, GENERIC_READ, 0, NULL, CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0); @@ -912,8 +928,8 @@ ok(done == sizeof(buf), "expected number of bytes written %lu\n", done); memset(&ov, 0, sizeof(ov)); - ov.Offset = PATTERN_OFFSET; - ov.OffsetHigh = 0; + S(U(ov)).Offset = PATTERN_OFFSET; + S(U(ov)).OffsetHigh = 0; rc=WriteFile(hFile, pattern, sizeof(pattern), &done, &ov); /* Win 9x does not support the overlapped I/O on files */ if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) { @@ -923,8 +939,8 @@ ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (PATTERN_OFFSET + sizeof(pattern)), "expected file offset %d\n", PATTERN_OFFSET + sizeof(pattern)); - ov.Offset = sizeof(buf) * 2; - ov.OffsetHigh = 0; + S(U(ov)).Offset = sizeof(buf) * 2; + S(U(ov)).OffsetHigh = 0; ret = WriteFile(hFile, pattern, sizeof(pattern), &done, &ov); ok( ret, "WriteFile error %ld\n", GetLastError()); ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done); @@ -942,8 +958,8 @@ memset(buf, 0, sizeof(buf)); memset(&ov, 0, sizeof(ov)); - ov.Offset = PATTERN_OFFSET; - ov.OffsetHigh = 0; + S(U(ov)).Offset = PATTERN_OFFSET; + S(U(ov)).OffsetHigh = 0; rc=ReadFile(hFile, buf, sizeof(pattern), &done, &ov); /* Win 9x does not support the overlapped I/O on files */ if (rc || GetLastError()!=ERROR_INVALID_PARAMETER) { @@ -1001,8 +1017,8 @@ ok( !UnlockFile( handle, 10, 0, 20, 0 ), "UnlockFile 10,20 again succeeded\n" ); ok( UnlockFile( handle, 5, 0, 5, 0 ), "UnlockFile 5,5 failed\n" ); - overlapped.Offset = 100; - overlapped.OffsetHigh = 0; + S(U(overlapped)).Offset = 100; + S(U(overlapped)).OffsetHigh = 0; overlapped.hEvent = 0; lockfileex_capable = dll_capable("kernel32", "LockFileEx"); @@ -1018,7 +1034,7 @@ } /* overlapping shared locks are OK */ - overlapped.Offset = 150; + S(U(overlapped)).Offset = 150; limited_UnLockFile || ok( LockFileEx( handle, 0, 0, 100, 0, &overlapped ), "LockFileEx 150,100 failed\n" ); /* but exclusive is not */ @@ -1031,7 +1047,7 @@ { if (!UnlockFileEx( handle, 0, 100, 0, &overlapped )) { /* UnLockFile is capable. */ - overlapped.Offset = 100; + S(U(overlapped)).Offset = 100; ok( !UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 150,100 again succeeded\n" ); } @@ -1299,8 +1315,8 @@ HANDLE hFile; LPVOID lpBuffer = HeapAlloc(GetProcessHeap(), 0, 4096); OVERLAPPED ovl; - ovl.Offset = 0; - ovl.OffsetHigh = 0; + S(U(ovl)).Offset = 0; + S(U(ovl)).OffsetHigh = 0; ovl.hEvent = hSem; completion_count = 0; szFile[0] = '\0'; @@ -1317,7 +1333,7 @@ /*printf("Offset = %ld, result = %s\n", ovl.Offset, res ? "TRUE" : "FALSE");*/ if (!res) break; - ovl.Offset += 4096; + S(U(ovl)).Offset += 4096; /* i/o completion routine only called if ReadFileEx returned success. * we only care about violations of this rule so undo what should have * been done */ diff -urN wine-20050310/dlls/kernel/tests/generated.c wine-20050419/dlls/kernel/tests/generated.c --- wine-20050310/dlls/kernel/tests/generated.c 2004-09-06 22:29:53.000000000 +0200 +++ wine-20050419/dlls/kernel/tests/generated.c 2005-03-17 20:00:09.000000000 +0100 @@ -835,10 +835,10 @@ { /* OVERLAPPED (pack 4) */ TEST_TYPE(OVERLAPPED, 20, 4); - TEST_FIELD(OVERLAPPED, DWORD, Internal, 0, 4, 4); - TEST_FIELD(OVERLAPPED, DWORD, InternalHigh, 4, 4, 4); - TEST_FIELD(OVERLAPPED, DWORD, Offset, 8, 4, 4); - TEST_FIELD(OVERLAPPED, DWORD, OffsetHigh, 12, 4, 4); + TEST_FIELD(OVERLAPPED, ULONG_PTR, Internal, 0, 4, 4); + TEST_FIELD(OVERLAPPED, ULONG_PTR, InternalHigh, 4, 4, 4); + /*TEST_FIELD(OVERLAPPED, DWORD, Offset, 8, 4, 4);*/ + /*TEST_FIELD(OVERLAPPED, DWORD, OffsetHigh, 12, 4, 4);*/ TEST_FIELD(OVERLAPPED, HANDLE, hEvent, 16, 4, 4); } diff -urN wine-20050310/dlls/kernel/tests/heap.c wine-20050419/dlls/kernel/tests/heap.c --- wine-20050310/dlls/kernel/tests/heap.c 2004-02-06 06:24:34.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/heap.c 2005-03-17 21:53:38.000000000 +0100 @@ -63,17 +63,17 @@ ok(gbl == NULL, "global realloc allocated memory\n"); /* Local*() functions */ - gbl = LocalAlloc(GMEM_MOVEABLE, 0); + gbl = LocalAlloc(LMEM_MOVEABLE, 0); ok(gbl != NULL, "local memory not allocated for size 0\n"); - gbl = LocalReAlloc(gbl, 10, GMEM_MOVEABLE); + gbl = LocalReAlloc(gbl, 10, LMEM_MOVEABLE); ok(gbl != NULL, "Can't realloc local memory\n"); size = LocalSize(gbl); ok(size >= 10 && size <= 16, "Memory not resized to size 10, instead size=%ld\n", size); todo_wine { - gbl = LocalReAlloc(gbl, 0, GMEM_MOVEABLE); + gbl = LocalReAlloc(gbl, 0, LMEM_MOVEABLE); ok(gbl != NULL, "LocalReAlloc should not fail on size 0\n"); } @@ -83,7 +83,7 @@ size = LocalSize(gbl); ok(size == 0, "Memory should have been freed, size=%ld\n", size); - gbl = LocalReAlloc(0, 10, GMEM_MOVEABLE); + gbl = LocalReAlloc(0, 10, LMEM_MOVEABLE); ok(gbl == NULL, "local realloc allocated memory\n"); } diff -urN wine-20050310/dlls/kernel/tests/mailslot.c wine-20050419/dlls/kernel/tests/mailslot.c --- wine-20050310/dlls/kernel/tests/mailslot.c 2005-02-10 20:19:36.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/mailslot.c 2005-04-11 18:11:32.000000000 +0200 @@ -57,24 +57,16 @@ hSlot = CreateMailslot( "blah", 0, 0, NULL ); ok( hSlot == INVALID_HANDLE_VALUE, "Created mailslot with invalid name\n"); - todo_wine - { - ok( GetLastError() == ERROR_INVALID_NAME, - "error should be ERROR_INVALID_NAME\n"); - } + ok( GetLastError() == ERROR_INVALID_NAME, + "error should be ERROR_INVALID_NAME\n"); /* open a mailslot with a null name */ hSlot = CreateMailslot( NULL, 0, 0, NULL ); ok( hSlot == INVALID_HANDLE_VALUE, "Created mailslot with invalid name\n"); - todo_wine - { - ok( GetLastError() == ERROR_PATH_NOT_FOUND, + ok( GetLastError() == ERROR_PATH_NOT_FOUND, "error should be ERROR_PATH_NOT_FOUND\n"); - } - todo_wine - { /* valid open, but with wacky parameters ... then check them */ hSlot = CreateMailslot( szmspath, -1, -1, NULL ); ok( hSlot != INVALID_HANDLE_VALUE , "mailslot with valid name failed\n"); @@ -83,22 +75,15 @@ "getmailslotinfo failed\n"); ok( dwMax == ~0UL, "dwMax incorrect\n"); ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n"); - } ok( dwMsgCount == 0, "dwMsgCount incorrect\n"); - todo_wine - { ok( dwTimeout == ~0UL, "dwTimeout incorrect\n"); ok( GetMailslotInfo( hSlot, NULL, NULL, NULL, NULL ), "getmailslotinfo failed\n"); ok( CloseHandle(hSlot), "failed to close mailslot\n"); - } - todo_wine - { /* now open it for real */ hSlot = CreateMailslot( szmspath, 0, 0, NULL ); ok( hSlot != INVALID_HANDLE_VALUE , "valid mailslot failed\n"); - } /* try and read/write to it */ count = 0; @@ -112,8 +97,6 @@ hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); ok( hWriter == INVALID_HANDLE_VALUE, "bad sharing mode\n"); - todo_wine - { ok( GetLastError() == ERROR_SHARING_VIOLATION, "error should be ERROR_SHARING_VIOLATION\n"); @@ -121,7 +104,6 @@ hWriter = CreateFile(szmspath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); ok( hWriter != INVALID_HANDLE_VALUE, "existing mailslot\n"); - } /* * opening a client should make no difference to @@ -138,11 +120,8 @@ */ ok( !ReadFile( hWriter, buffer, sizeof buffer/2, &count, NULL), "can read client\n"); - todo_wine - { ok( WriteFile( hWriter, buffer, sizeof buffer/2, &count, NULL), "can't write client\n"); - } ok( !ReadFile( hWriter, buffer, sizeof buffer/2, &count, NULL), "can read client\n"); @@ -150,12 +129,9 @@ * seeing as there's something in the slot, * we should be able to read it once */ - todo_wine - { ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "slot read\n"); ok( count == (sizeof buffer/2), "short read\n" ); - } /* but not again */ ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), @@ -180,8 +156,6 @@ hSlot2 = CreateMailslot( szmspath, 0, 0, NULL ); ok( hSlot2 == INVALID_HANDLE_VALUE , "opened two mailslots\n"); - todo_wine - { /* close the client again */ ok( CloseHandle( hWriter ), "closing the client\n"); @@ -192,7 +166,6 @@ hWriter = CreateFile(szmspath, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); ok( hWriter != INVALID_HANDLE_VALUE, "sharing writer\n"); - } /* * now try open another as a writer ... @@ -202,8 +175,6 @@ FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); ok( hWriter2 == INVALID_HANDLE_VALUE, "greedy writer succeeded\n"); - todo_wine - { /* now try open another as a writer ... and share with the first */ hWriter2 = CreateFile(szmspath, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); @@ -214,7 +185,6 @@ ok( GetMailslotInfo( hSlot, &dwMax, &dwNext, &dwMsgCount, &dwTimeout ), "getmailslotinfo failed\n"); ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n"); - } ok( dwMax == 0, "dwMax incorrect\n"); ok( dwMsgCount == 0, "dwMsgCount incorrect\n"); ok( dwTimeout == 0, "dwTimeout incorrect\n"); @@ -223,8 +193,6 @@ ok( !ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "slot read\n"); /* write two messages */ - todo_wine - { buffer[0] = 'a'; ok( WriteFile( hWriter, buffer, 1, &count, NULL), "1st write failed\n"); @@ -244,7 +212,9 @@ ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), "getmailslotinfo failed\n"); ok( dwNext == 1, "dwNext incorrect\n"); + todo_wine { ok( dwMsgCount == 2, "dwMsgCount incorrect\n"); + } /* write a 3rd message with zero size */ ok( WriteFile( hWriter2, buffer, 0, &count, NULL), "3rd write failed\n"); @@ -254,7 +224,9 @@ ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), "getmailslotinfo failed\n"); ok( dwNext == 1, "dwNext incorrect\n"); + todo_wine { ok( dwMsgCount == 3, "dwMsgCount incorrect\n"); + } buffer[0]=buffer[1]=0; @@ -272,7 +244,9 @@ ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), "getmailslotinfo failed\n"); ok( dwNext == 2, "dwNext incorrect\n"); + todo_wine { ok( dwMsgCount == 2, "dwMsgCount incorrect\n"); + } /* read the second message */ ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), @@ -284,13 +258,13 @@ dwNext = dwMsgCount = 0; ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), "getmailslotinfo failed\n"); - } + todo_wine { ok( dwNext == 0, "dwNext incorrect\n"); - todo_wine - { ok( dwMsgCount == 1, "dwMsgCount incorrect\n"); + } /* read the 3rd (zero length) message */ + todo_wine { ok( ReadFile( hSlot, buffer, sizeof buffer, &count, NULL), "3rd slot read failed\n"); } @@ -300,13 +274,10 @@ * now there should be no more messages * check the mailslot info */ - todo_wine - { dwNext = dwMsgCount = 0; ok( GetMailslotInfo( hSlot, NULL, &dwNext, &dwMsgCount, NULL ), "getmailslotinfo failed\n"); ok( dwNext == MAILSLOT_NO_MESSAGE, "dwNext incorrect\n"); - } ok( dwMsgCount == 0, "dwMsgCount incorrect\n"); /* check that reads fail */ @@ -314,12 +285,9 @@ "3rd slot read succeeded\n"); /* finally close the mailslot and its client */ - todo_wine - { ok( CloseHandle( hWriter2 ), "closing 2nd client\n"); ok( CloseHandle( hWriter ), "closing the client\n"); ok( CloseHandle( hSlot ), "closing the mailslot\n"); - } return 0; } diff -urN wine-20050310/dlls/kernel/tests/path.c wine-20050419/dlls/kernel/tests/path.c --- wine-20050310/dlls/kernel/tests/path.c 2005-02-10 20:19:36.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/path.c 2005-03-16 20:49:57.000000000 +0100 @@ -393,8 +393,6 @@ */ len=GetCurrentDirectoryA(MAX_PATH,origdir); ok(len!=0 && len < MAX_PATH,"GetCurrentDirectoryA failed\n"); - ok(lstrcmpiA(origdir+(len-1),"\\")!=0, - "GetCurrentDirectoryA should not have a trailing \\\n"); /* Make sure that CetCurrentDirectoryA doesn't overwrite the buffer when the buffer size is too small to hold the current directory */ diff -urN wine-20050310/dlls/kernel/tests/pipe.c wine-20050419/dlls/kernel/tests/pipe.c --- wine-20050310/dlls/kernel/tests/pipe.c 2004-12-13 22:19:02.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/pipe.c 2005-03-24 20:05:02.000000000 +0100 @@ -130,6 +130,8 @@ ok(written == sizeof(obuf2), "write file len 2\n"); ok(PeekNamedPipe(hnp, NULL, 0, NULL, &readden, NULL), "Peek\n"); ok(readden == sizeof(obuf2), "peek 2 got %ld bytes\n", readden); + ok(PeekNamedPipe(hnp, (LPVOID)1, 0, NULL, &readden, NULL), "Peek\n"); + ok(readden == sizeof(obuf2), "peek 2 got %ld bytes\n", readden); ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); ok(readden == sizeof(obuf2), "read 2 got %ld bytes\n", readden); ok(memcmp(obuf2, ibuf, written) == 0, "content 2 check\n"); @@ -149,9 +151,8 @@ } else ok(readden == sizeof(obuf), "peek3 got %ld bytes\n", readden); - todo_wine { + if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %ld bytes available\n", avail); - } pbuf = ibuf; ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 3a check\n"); if (pipemode == PIPE_TYPE_BYTE) { @@ -182,9 +183,8 @@ } else ok(readden == sizeof(obuf), "peek4 got %ld bytes\n", readden); - todo_wine { + if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %ld bytes available\n", avail); - } pbuf = ibuf; ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 4a check\n"); if (pipemode == PIPE_TYPE_BYTE) { @@ -228,9 +228,8 @@ ok(written == sizeof(obuf2), "write file len 3b\n"); ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek5\n"); ok(readden == sizeof(obuf), "peek5 got %ld bytes\n", readden); - todo_wine { + if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %ld bytes available\n", avail); - } pbuf = ibuf; ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 5a check\n"); ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); @@ -260,9 +259,8 @@ ok(written == sizeof(obuf2), "write file len 6b\n"); ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6\n"); ok(readden == sizeof(obuf), "peek6 got %ld bytes\n", readden); - todo_wine { + if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %ld bytes available\n", avail); - } pbuf = ibuf; ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 6a check\n"); ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); @@ -700,7 +698,7 @@ trace("test_NamedPipe_2 returning\n"); } -static void test_DisconnectNamedPipe(void) +static int test_DisconnectNamedPipe(void) { HANDLE hnp; HANDLE hFile; @@ -715,7 +713,10 @@ /* nInBufSize */ 1024, /* nDefaultWait */ NMPWAIT_USE_DEFAULT_WAIT, /* lpSecurityAttrib */ NULL); - ok(hnp != INVALID_HANDLE_VALUE, "CreateNamedPipe failed\n"); + if (INVALID_HANDLE_VALUE == hnp) { + trace ("Seems we have no named pipes.\n"); + return 1; + } ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL) == 0 && GetLastError() == ERROR_PIPE_LISTENING, "WriteFile to not-yet-connected pipe\n"); @@ -745,12 +746,14 @@ ok(CloseHandle(hnp), "CloseHandle\n"); + return 0; } START_TEST(pipe) { trace("test 1 of 4:\n"); - test_DisconnectNamedPipe(); + if (test_DisconnectNamedPipe()) + return; trace("test 2 of 4:\n"); test_CreateNamedPipe_instances_must_match(); trace("test 3 of 4:\n"); diff -urN wine-20050310/dlls/kernel/tests/process.c wine-20050419/dlls/kernel/tests/process.c --- wine-20050310/dlls/kernel/tests/process.c 2004-12-27 18:26:38.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/process.c 2005-03-28 16:17:52.000000000 +0200 @@ -268,8 +268,7 @@ i = 0; while (*ptrA) { - strncpy(env_var, ptrA, MAX_LISTED_ENV_VAR - 1); - env_var[MAX_LISTED_ENV_VAR - 1] = '\0'; + lstrcpynA(env_var, ptrA, MAX_LISTED_ENV_VAR); childPrintf(hFile, "env%d=%s\n", i, encodeA(env_var)); i++; ptrA += strlen(ptrA) + 1; diff -urN wine-20050310/dlls/kernel/tests/thread.c wine-20050419/dlls/kernel/tests/thread.c --- wine-20050310/dlls/kernel/tests/thread.c 2005-03-02 13:23:22.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/thread.c 2005-03-25 11:25:11.000000000 +0100 @@ -525,7 +525,7 @@ /* Check the Affinity Mask functions */ ok(GetProcessAffinityMask(curproc,&processMask,&systemMask)!=0, "GetProcessAffinityMask failed\n"); - ok(SetThreadAffinityMask(curthread,processMask)==1, + ok(SetThreadAffinityMask(curthread,processMask)==processMask, "SetThreadAffinityMask failed\n"); ok(SetThreadAffinityMask(curthread,processMask+1)==0, "SetThreadAffinityMask passed for an illegal processor\n"); diff -urN wine-20050310/dlls/kernel/tests/time.c wine-20050419/dlls/kernel/tests/time.c --- wine-20050310/dlls/kernel/tests/time.c 2004-12-27 18:26:38.000000000 +0100 +++ wine-20050419/dlls/kernel/tests/time.c 2005-03-28 12:00:25.000000000 +0200 @@ -121,15 +121,10 @@ FILETIME ft; SYSTEMTIME st; - memset(&ft,0,sizeof ft); /* Invalid argument checks */ - todo_wine { - ok( !DosDateTimeToFileTime(0,0,&ft), /* invalid dos date/time */ - "DosDateTimeToFileTime() didn't fail\n"); - } - + memset(&ft,0,sizeof ft); ok( DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft), /* this is 1 Jan 1980 00:00:00 */ "DosDateTimeToFileTime() failed\n"); @@ -146,12 +141,6 @@ ok( !SystemTimeToFileTime(&st, &ft), "bad month\n"); - /* with a bad day */ - SETUP_1980(st) - st.wDay = 0; - - ok( !SystemTimeToFileTime(&st, &ft), "bad day\n"); - /* with a bad hour */ SETUP_1980(st) st.wHour = 24; diff -urN wine-20050310/dlls/kernel/toolhelp.c wine-20050419/dlls/kernel/toolhelp.c --- wine-20050310/dlls/kernel/toolhelp.c 2005-02-21 21:57:34.000000000 +0100 +++ wine-20050419/dlls/kernel/toolhelp.c 2005-03-24 22:01:38.000000000 +0100 @@ -72,10 +72,10 @@ break; if (i==nrofnotifys) { if (notifys==NULL) - notifys=(struct notify*)HeapAlloc( GetProcessHeap(), 0, + notifys=HeapAlloc( GetProcessHeap(), 0, sizeof(struct notify) ); else - notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys, + notifys=HeapReAlloc( GetProcessHeap(), 0, notifys, sizeof(struct notify)*(nrofnotifys+1)); if (!notifys) return FALSE; nrofnotifys++; @@ -101,7 +101,7 @@ if (i==-1) return FALSE; memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1)); - notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys, + notifys=HeapReAlloc( GetProcessHeap(), 0, notifys, (nrofnotifys-1)*sizeof(struct notify)); nrofnotifys--; return TRUE; diff -urN wine-20050310/dlls/kernel/virtual.c wine-20050419/dlls/kernel/virtual.c --- wine-20050310/dlls/kernel/virtual.c 2004-10-11 22:59:06.000000000 +0200 +++ wine-20050419/dlls/kernel/virtual.c 2005-03-25 17:38:50.000000000 +0100 @@ -44,6 +44,7 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(virtual); +WINE_DECLARE_DEBUG_CHANNEL(seh); static unsigned int page_size; @@ -525,6 +526,8 @@ UINT size ) /* [in] Size of block */ { if (!size) return FALSE; /* handle 0 size case w/o reference */ + if (!ptr) return TRUE; + if (!page_size) page_size = getpagesize(); __TRY { @@ -541,7 +544,11 @@ dummy = p[0]; dummy = p[count - 1]; } - __EXCEPT(page_fault) { return TRUE; } + __EXCEPT(page_fault) + { + TRACE_(seh)("%p caused page fault during read\n", ptr); + return TRUE; + } __ENDTRY return FALSE; } @@ -559,6 +566,8 @@ UINT size ) /* [in] Size of block in bytes */ { if (!size) return FALSE; /* handle 0 size case w/o reference */ + if (!ptr) return TRUE; + if (!page_size) page_size = getpagesize(); __TRY { @@ -574,7 +583,11 @@ p[0] |= 0; p[count - 1] |= 0; } - __EXCEPT(page_fault) { return TRUE; } + __EXCEPT(page_fault) + { + TRACE_(seh)("%p caused page fault during write\n", ptr); + return TRUE; + } __ENDTRY return FALSE; } @@ -632,12 +645,18 @@ LPCSTR str, /* [in] Address of string */ UINT max ) /* [in] Maximum size of string */ { + if (!str) return TRUE; + __TRY { volatile const char *p = str; while (p != str + max) if (!*p++) break; } - __EXCEPT(page_fault) { return TRUE; } + __EXCEPT(page_fault) + { + TRACE_(seh)("%p caused page fault during read\n", str); + return TRUE; + } __ENDTRY return FALSE; } @@ -649,12 +668,18 @@ */ BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT max ) { + if (!str) return TRUE; + __TRY { volatile const WCHAR *p = str; while (p != str + max) if (!*p++) break; } - __EXCEPT(page_fault) { return TRUE; } + __EXCEPT(page_fault) + { + TRACE_(seh)("%p caused page fault during read\n", str); + return TRUE; + } __ENDTRY return FALSE; } diff -urN wine-20050310/dlls/lzexpand/lzexpand_main.c wine-20050419/dlls/lzexpand/lzexpand_main.c --- wine-20050310/dlls/lzexpand/lzexpand_main.c 2004-12-23 19:48:47.000000000 +0100 +++ wine-20050419/dlls/lzexpand/lzexpand_main.c 2005-03-24 22:01:38.000000000 +0100 @@ -508,8 +508,7 @@ static LPSTR LZEXPAND_MangleName( LPCSTR fn ) { char *p; - char *mfn = (char *)HeapAlloc( GetProcessHeap(), 0, - strlen(fn) + 3 ); /* "._" and \0 */ + char *mfn = HeapAlloc( GetProcessHeap(), 0, strlen(fn) + 3 ); /* "._" and \0 */ if(mfn == NULL) return NULL; strcpy( mfn, fn ); if (!(p = strrchr( mfn, '\\' ))) p = mfn; diff -urN wine-20050310/dlls/mapi32/Makefile.in wine-20050419/dlls/mapi32/Makefile.in --- wine-20050310/dlls/mapi32/Makefile.in 2004-11-30 18:38:52.000000000 +0100 +++ wine-20050419/dlls/mapi32/Makefile.in 2005-03-14 11:04:40.000000000 +0100 @@ -3,7 +3,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = mapi32.dll -IMPORTS = shlwapi ole32 user32 kernel32 +IMPORTS = shlwapi ole32 user32 kernel32 ntdll EXTRALIBS = -luuid $(LIBUNICODE) C_SRCS = \ diff -urN wine-20050310/dlls/mapi32/imalloc.c wine-20050419/dlls/mapi32/imalloc.c --- wine-20050310/dlls/mapi32/imalloc.c 2004-11-30 18:38:52.000000000 +0100 +++ wine-20050419/dlls/mapi32/imalloc.c 2005-03-17 21:53:38.000000000 +0100 @@ -112,7 +112,7 @@ { TRACE("(%p)->(%ld)\n", iface, cb); - return LocalAlloc(GMEM_FIXED, cb); + return LocalAlloc(LMEM_FIXED, cb); } /************************************************************************** @@ -123,10 +123,10 @@ TRACE("(%p)->(%p, %ld)\n", iface, pv, cb); if (!pv) - return LocalAlloc(GMEM_FIXED, cb); + return LocalAlloc(LMEM_FIXED, cb); if (cb) - return LocalReAlloc((HANDLE) pv, cb, GMEM_MOVEABLE); + return LocalReAlloc((HANDLE) pv, cb, LMEM_MOVEABLE); LocalFree((HANDLE) pv); return NULL; diff -urN wine-20050310/dlls/mapi32/prop.c wine-20050419/dlls/mapi32/prop.c --- wine-20050310/dlls/mapi32/prop.c 2005-02-22 15:51:03.000000000 +0100 +++ wine-20050419/dlls/mapi32/prop.c 2005-03-23 14:15:19.000000000 +0100 @@ -789,7 +789,7 @@ * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid. * * NOTES - * The resulting property value array is stored in a contigous block starting at lpDst. + * The resulting property value array is stored in a contiguous block starting at lpDst. */ SCODE WINAPI ScCopyProps(int cValues, LPSPropValue lpProps, LPVOID lpDst, ULONG *lpCount) { @@ -922,8 +922,8 @@ * between offsets and pointers. This does not work in native (it crashes), * and cannot be made to work in Wine because the original interface design * is deficient. The only use left for this function is to remap pointers - * in a contigous property array that has been copied with memcpy() to another - * memory location. + * in a contiguous property array that has been copied with memcpy() to + * another memory location. */ SCODE WINAPI ScRelocProps(int cValues, LPSPropValue lpProps, LPVOID lpOld, LPVOID lpNew, ULONG *lpCount) @@ -949,7 +949,7 @@ * The code below would handle both cases except that the design of this * function makes it impossible to know when the pointers in lpProps are * valid. If both lpOld and lpNew are non-NULL, native reads the pointers - * after converting them, so we must do the same. Its seems this + * after converting them, so we must do the same. It seems this * functionality was never tested by MS. */ @@ -1086,7 +1086,7 @@ /************************************************************************* * ScDupPropset@16 (MAPI32.174) * - * Duplicate a property value array into a contigous block of memory. + * Duplicate a property value array into a contiguous block of memory. * * PARAMS * cValues [I] Number of properties in lpProps @@ -1848,7 +1848,7 @@ /************************************************************************** * IMAPIProp_DeleteProps {MAPI32} * - * Delete one or more property values from a IMAPIProp objects. + * Delete one or more property values from an IMAPIProp object. * * PARAMS * iface [I] IMAPIProp object to remove property values from. diff -urN wine-20050310/dlls/mapi32/util.c wine-20050419/dlls/mapi32/util.c --- wine-20050310/dlls/mapi32/util.c 2005-01-03 18:05:02.000000000 +0100 +++ wine-20050419/dlls/mapi32/util.c 2005-03-24 22:01:38.000000000 +0100 @@ -121,7 +121,7 @@ if (!lppBuffer) return E_INVALIDARG; - lpBuff = (LPMAPIALLOCBUFFER)HeapAlloc(GetProcessHeap(), 0, cbSize + sizeof(*lpBuff)); + lpBuff = HeapAlloc(GetProcessHeap(), 0, cbSize + sizeof(*lpBuff)); if (!lpBuff) return MAPI_E_NOT_ENOUGH_MEMORY; diff -urN wine-20050310/dlls/mlang/tests/mlang.c wine-20050419/dlls/mlang/tests/mlang.c --- wine-20050310/dlls/mlang/tests/mlang.c 2005-02-14 22:04:45.000000000 +0100 +++ wine-20050419/dlls/mlang/tests/mlang.c 2005-03-14 22:41:27.000000000 +0100 @@ -550,7 +550,7 @@ total = n; - for (i = 0; i < n; i++) + for (i = 0; pGetCPInfoExA && i < n; i++) { CPINFOEXA cpinfoex; #ifdef DUMP_SCRIPT_INFO @@ -567,7 +567,7 @@ wine_dbgstr_w(sinfo[i].wszFixedWidthFont), wine_dbgstr_w(sinfo[i].wszProportionalFont)); #endif - if (GetCPInfoExA(sinfo[i].uiCodePage, 0, &cpinfoex)) + if (pGetCPInfoExA(sinfo[i].uiCodePage, 0, &cpinfoex)) trace("CodePage %u name: %s\n", sinfo[i].uiCodePage, cpinfoex.CodePageName); else trace("GetCPInfoExA failed for cp %u\n", sinfo[i].uiCodePage); diff -urN wine-20050310/dlls/mpr/mpr_Es.rc wine-20050419/dlls/mpr/mpr_Es.rc --- wine-20050310/dlls/mpr/mpr_Es.rc 2005-02-16 22:11:00.000000000 +0100 +++ wine-20050419/dlls/mpr/mpr_Es.rc 2005-04-11 15:01:46.000000000 +0200 @@ -1,7 +1,7 @@ /* * MPR dll Spanish resources * - * Copyright (C) 2004 José Manuel Ferrer Ortiz + * Copyright (C) 2004, 2005 José Manuel Ferrer Ortiz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,3 +24,23 @@ { IDS_ENTIRENETWORK "Toda la red" } + +IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Introduzca contraseña de red" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Por favor, introduzca su nombre de usuario y contraseña:", IDC_EXPLAIN, 40, 6, 150, 15 + LTEXT "Proxy", -1, 40, 26, 50, 10 +/* LTEXT "Realm", -1, 40, 46, 50, 10 */ + LTEXT "Usuario", -1, 40, 66, 50, 10 + LTEXT "Contraseña", -1, 40, 86, 50, 10 + LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Guardar esta contraseña (Inseguro)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Aceptar", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} diff -urN wine-20050310/dlls/mpr/wnet.c wine-20050419/dlls/mpr/wnet.c --- wine-20050310/dlls/mpr/wnet.c 2004-12-23 21:20:49.000000000 +0100 +++ wine-20050419/dlls/mpr/wnet.c 2005-03-24 22:01:38.000000000 +0100 @@ -137,7 +137,7 @@ RegQueryValueExW(hKey, szProviderName, NULL, NULL, NULL, &size); if (size) { - name = (PWSTR)HeapAlloc(GetProcessHeap(), 0, size); + name = HeapAlloc(GetProcessHeap(), 0, size); if (RegQueryValueExW(hKey, szProviderName, NULL, &type, (LPBYTE)name, &size) != ERROR_SUCCESS || type != REG_SZ) { @@ -242,7 +242,7 @@ RegQueryValueExW(hKey, providerOrder, NULL, NULL, NULL, &size); if (size) { - PWSTR providers = (PWSTR)HeapAlloc(GetProcessHeap(), 0, size); + PWSTR providers = HeapAlloc(GetProcessHeap(), 0, size); if (providers) { @@ -263,7 +263,7 @@ if (ptr) numToAllocate++; } - providerTable = (PWNetProviderTable) + providerTable = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetProviderTable) + (numToAllocate - 1) * sizeof(WNetProvider)); @@ -274,7 +274,7 @@ entireNetworkLen = LoadStringW(hInstDll, IDS_ENTIRENETWORK, NULL, 0); - providerTable->entireNetwork = (LPWSTR)HeapAlloc( + providerTable->entireNetwork = HeapAlloc( GetProcessHeap(), 0, (entireNetworkLen + 1) * sizeof(WCHAR)); if (providerTable->entireNetwork) @@ -342,8 +342,7 @@ if (lpNet) { - ret = (LPNETRESOURCEW)HeapAlloc(GetProcessHeap(), 0, - sizeof(NETRESOURCEW)); + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(NETRESOURCEW)); if (ret) { size_t len; @@ -353,8 +352,7 @@ if (lpNet->lpRemoteName) { len = strlenW(lpNet->lpRemoteName) + 1; - ret->lpRemoteName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - len * sizeof(WCHAR)); + ret->lpRemoteName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (ret->lpRemoteName) strcpyW(ret->lpRemoteName, lpNet->lpRemoteName); } @@ -376,7 +374,7 @@ static PWNetEnumerator _createNullEnumerator(void) { - PWNetEnumerator ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), + PWNetEnumerator ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) @@ -387,7 +385,7 @@ static PWNetEnumerator _createGlobalEnumeratorW(DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEW lpNet) { - PWNetEnumerator ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), + PWNetEnumerator ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) @@ -410,8 +408,7 @@ ret = NULL; else { - ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); + ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) { ret->enumType = WNET_ENUMERATOR_TYPE_PROVIDER; @@ -428,7 +425,7 @@ static PWNetEnumerator _createContextEnumerator(DWORD dwScope, DWORD dwType, DWORD dwUsage) { - PWNetEnumerator ret = (PWNetEnumerator)HeapAlloc(GetProcessHeap(), + PWNetEnumerator ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WNetEnumerator)); if (ret) @@ -640,7 +637,7 @@ ret = _thunkNetResourceArrayAToW(lpNet, &count, buf, &size); if (ret == WN_MORE_DATA) { - lpNetWide = (LPNETRESOURCEW)HeapAlloc(GetProcessHeap(), 0, + lpNetWide = HeapAlloc(GetProcessHeap(), 0, size); if (lpNetWide) { @@ -1537,7 +1534,7 @@ if (len) { - PWSTR wideLocalName = (PWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + PWSTR wideLocalName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (wideLocalName) { @@ -1568,7 +1565,7 @@ } else if (ret == WN_MORE_DATA) { - PWSTR wideRemote = (PWSTR)HeapAlloc(GetProcessHeap(), 0, + PWSTR wideRemote = HeapAlloc(GetProcessHeap(), 0, wideRemoteSize * sizeof(WCHAR)); if (wideRemote) @@ -1862,8 +1859,7 @@ len = MultiByteToWideChar(CP_ACP, 0, lpProvider, -1, NULL, 0); if (len) { - LPWSTR wideProvider = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - len * sizeof(WCHAR)); + LPWSTR wideProvider = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (wideProvider) { diff -urN wine-20050310/dlls/msacm/format.c wine-20050419/dlls/msacm/format.c --- wine-20050310/dlls/msacm/format.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050419/dlls/msacm/format.c 2005-03-29 21:49:22.000000000 +0200 @@ -72,7 +72,7 @@ if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) { ACMFORMATDETAILSA afd; - unsigned int i, idx; + unsigned int i, len; MMRESULT mmr; char buffer[ACMFORMATDETAILS_FORMAT_CHARS+16]; @@ -88,10 +88,9 @@ afd.dwFormatIndex = i; mmr = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX); if (mmr == MMSYSERR_NOERROR) { - strncpy(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS); - for (idx = strlen(buffer); - idx < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; idx++) - buffer[idx] = ' '; + lstrcpynA(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS + 1); + len = strlen(buffer); + memset(buffer+len, ' ', ACMFORMATTAGDETAILS_FORMATTAG_CHARS - len); wsprintfA(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS, "%d Ko/s", (afd.pwfx->nAvgBytesPerSec + 512) / 1024); diff -urN wine-20050310/dlls/msacm/imaadp32/imaadp32.c wine-20050419/dlls/msacm/imaadp32/imaadp32.c --- wine-20050310/dlls/msacm/imaadp32/imaadp32.c 2005-01-09 17:52:51.000000000 +0100 +++ wine-20050419/dlls/msacm/imaadp32/imaadp32.c 2005-04-18 11:54:03.000000000 +0200 @@ -372,7 +372,7 @@ for (; nblock > 0; nblock--) { - char* in_dst = dst; + unsigned char* in_dst = dst; /* generate header */ sampleL = R16(src); src += 2; @@ -435,7 +435,7 @@ for (; nblock > 0; nblock--) { - char* in_dst = dst; + unsigned char* in_dst = dst; /* generate header */ /* FIXME: what about the last effective sample from previous block ??? */ diff -urN wine-20050310/dlls/msacm/internal.c wine-20050419/dlls/msacm/internal.c --- wine-20050310/dlls/msacm/internal.c 2004-12-23 21:20:49.000000000 +0100 +++ wine-20050419/dlls/msacm/internal.c 2005-03-24 22:01:38.000000000 +0100 @@ -244,7 +244,7 @@ TRACE("(%s, %s, %p)\n", debugstr_w(pszDriverAlias), debugstr_w(pszFileName), hinstModule); - padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); + padid = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID)); padid->obj.dwType = WINE_ACMOBJ_DRIVERID; padid->obj.pACMDriverID = padid; padid->pszDriverAlias = NULL; diff -urN wine-20050310/dlls/mscms/mscms.spec wine-20050419/dlls/mscms/mscms.spec --- wine-20050310/dlls/mscms/mscms.spec 2005-03-09 19:42:52.000000000 +0100 +++ wine-20050419/dlls/mscms/mscms.spec 2005-03-14 11:04:56.000000000 +0100 @@ -1,6 +1,6 @@ @ stdcall AssociateColorProfileWithDeviceA(ptr ptr ptr) @ stdcall AssociateColorProfileWithDeviceW(ptr ptr ptr) -@ stdcall CheckBitmapBits(ptr ptr long long long ptr ptr ptr) +@ stdcall CheckBitmapBits(ptr ptr ptr long long long ptr ptr long) @ stdcall CheckColors(ptr ptr long long ptr) @ stdcall CloseColorProfile(ptr) @ stdcall ConvertColorNameToIndex(ptr ptr ptr long) diff -urN wine-20050310/dlls/mscms/profile.c wine-20050419/dlls/mscms/profile.c --- wine-20050310/dlls/mscms/profile.c 2005-03-09 19:42:52.000000000 +0100 +++ wine-20050419/dlls/mscms/profile.c 2005-04-11 20:49:40.000000000 +0200 @@ -44,11 +44,10 @@ lstrcpyW( name, &path[i] ); } -static const WCHAR rgbprofile[] = -{ 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2', - '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s', - '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', - 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; +/* FIXME: Get this directory from the registry? */ +static const WCHAR colorsubdir[] = { '\\','s','y','s','t','e','m','3','2', + '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s', + '\\','c','o','l','o','r',0 }; WINE_DEFAULT_DEBUG_CHANNEL(mscms); @@ -109,17 +108,16 @@ */ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size ) { - /* FIXME: Get this directory from the registry? */ - static const WCHAR colordir[] = - { 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2', - '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s','\\','c','o','l','o','r',0 }; - + WCHAR colordir[MAX_PATH]; DWORD len; TRACE( "( %p, %p )\n", buffer, size ); if (machine || !size) return FALSE; + GetWindowsDirectoryW( colordir, sizeof(colordir) / sizeof(WCHAR) ); + lstrcatW( colordir, colorsubdir ); + len = lstrlenW( colordir ) * sizeof(WCHAR); if (len <= *size && buffer) @@ -392,7 +390,7 @@ * machine [I] Name of the machine for which to get the standard color space. * Must be NULL, which indicates the local machine. * id [I] Id of a standard color space. - * profile [O] Buffer to recieve the profile filename. + * profile [O] Buffer to receive the profile filename. * size [I/O] Size of the filename buffer in bytes. * * RETURNS @@ -401,6 +399,9 @@ */ BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profile, PDWORD size ) { + static const WCHAR rgbprofilefile[] = { '\\','s','r','g','b',' ','c','o','l','o','r',' ', + 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; + WCHAR rgbprofile[MAX_PATH]; DWORD len; TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size ); @@ -410,7 +411,11 @@ switch (id) { case 0x52474220: /* 'RGB ' */ - len = sizeof( rgbprofile ); + GetWindowsDirectoryW( rgbprofile, sizeof( rgbprofile ) / sizeof( WCHAR ) ); + lstrcatW( rgbprofile, colorsubdir ); + lstrcatW( rgbprofile, rgbprofilefile ); + + len = lstrlenW( rgbprofile ) * sizeof( WCHAR ); if (*size < len || !profile) { @@ -811,7 +816,7 @@ return NULL; } - iccprofile = (icProfile *)HeapAlloc( GetProcessHeap(), 0, size ); + iccprofile = HeapAlloc( GetProcessHeap(), 0, size ); if (!iccprofile) { ERR( "Unable to allocate memory for color profile\n" ); diff -urN wine-20050310/dlls/mscms/tests/profile.c wine-20050419/dlls/mscms/tests/profile.c --- wine-20050310/dlls/mscms/tests/profile.c 2005-02-14 21:53:59.000000000 +0100 +++ wine-20050419/dlls/mscms/tests/profile.c 2005-04-11 20:49:40.000000000 +0200 @@ -42,20 +42,17 @@ */ /* Two common places to find the standard color space profile */ -static const char profile1[] = -"c:\\windows\\system\\color\\srgb color space profile.icm"; -static const char profile2[] = -"c:\\windows\\system32\\spool\\drivers\\color\\srgb color space profile.icm"; - -static const WCHAR profile1W[] = -{ 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m', - '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', - 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; -static const WCHAR profile2W[] = -{ 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2', - '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s', - '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', +static const char profilefile[] = +"\\color\\srgb color space profile.icm"; +static const char profilesubdir[] = +"\\system32\\spool\\drivers"; + +static const WCHAR profilefileW[] = +{ '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; +static const WCHAR profilesubdirW[] = +{ '\\', 's','y','s','t','e','m','3','2','\\','s','p','o','o','l', + '\\','d','r','i','v','e','r','s',0 }; static const unsigned char rgbheader[] = { 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02, @@ -160,7 +157,6 @@ ret = GetColorDirectoryW( NULL, buffer, &size ); ok( ret && size > 0, "GetColorDirectoryW() failed (%ld)\n", GetLastError() ); - ret = GetColorDirectoryW( NULL, buffer, &size ); } static void test_GetColorProfileElement() @@ -944,24 +940,36 @@ UINT len; HANDLE handle; char path[MAX_PATH], file[MAX_PATH]; + char profile1[MAX_PATH], profile2[MAX_PATH]; + WCHAR profile1W[MAX_PATH], profile2W[MAX_PATH]; WCHAR fileW[MAX_PATH]; /* See if we can find the standard color profile */ + GetSystemDirectoryA( profile1, sizeof(profile1) ); + GetSystemDirectoryW( profile1W, sizeof(profile1W) / sizeof(WCHAR) ); + strcat( profile1, profilefile ); + lstrcatW( profile1W, profilefileW ); handle = CreateFileA( profile1, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); if (handle != INVALID_HANDLE_VALUE) { - standardprofile = (LPSTR)&profile1; - standardprofileW = (LPWSTR)&profile1W; + standardprofile = profile1; + standardprofileW = profile1W; CloseHandle( handle ); } + GetWindowsDirectoryA( profile2, sizeof(profile2) ); + GetWindowsDirectoryW( profile2W, sizeof(profile2W) / sizeof(WCHAR) ); + strcat( profile2, profilesubdir ); + lstrcatW( profile2W, profilesubdirW ); + strcat( profile2, profilefile ); + lstrcatW( profile2W, profilefileW ); handle = CreateFileA( profile2, 0 , 0, NULL, OPEN_EXISTING, 0, NULL ); if (handle != INVALID_HANDLE_VALUE) { - standardprofile = (LPSTR)&profile2; - standardprofileW = (LPWSTR)&profile2W; + standardprofile = profile2; + standardprofileW = profile2W; CloseHandle( handle ); } diff -urN wine-20050310/dlls/msdmo/dmoreg.c wine-20050419/dlls/msdmo/dmoreg.c --- wine-20050310/dlls/msdmo/dmoreg.c 2005-01-14 17:16:44.000000000 +0100 +++ wine-20050419/dlls/msdmo/dmoreg.c 2005-03-24 22:01:38.000000000 +0100 @@ -318,8 +318,7 @@ IEnumDMOImpl* lpedmo; BOOL ret = FALSE; - lpedmo = (IEnumDMOImpl*)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, sizeof(IEnumDMOImpl)); + lpedmo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumDMOImpl)); if (lpedmo) { diff -urN wine-20050310/dlls/mshtml/Makefile.in wine-20050419/dlls/mshtml/Makefile.in --- wine-20050310/dlls/mshtml/Makefile.in 2004-08-19 21:31:20.000000000 +0200 +++ wine-20050419/dlls/mshtml/Makefile.in 2005-04-14 13:30:50.000000000 +0200 @@ -3,12 +3,16 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = mshtml.dll -IMPORTS = user32 advapi32 kernel32 ntdll +IMPORTS = user32 gdi32 advapi32 kernel32 ntdll EXTRALIBS = $(LIBUNICODE) -lstrmiids -luuid EXTRADEFS = -DCOM_NO_WINDOWS_H C_SRCS = \ - main.c + htmldoc.c \ + main.c \ + oleobj.c \ + persist.c \ + view.c @MAKE_DLL_RULES@ diff -urN wine-20050310/dlls/mshtml/htmldoc.c wine-20050419/dlls/mshtml/htmldoc.c --- wine-20050310/dlls/mshtml/htmldoc.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/mshtml/htmldoc.c 2005-04-15 18:12:45.000000000 +0200 @@ -0,0 +1,958 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "docobj.h" + +#include "mshtml.h" +#include "mshtmdid.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppvObject) +{ + HTMLDocument *This = (HTMLDocument*)iface; + + *ppvObject = NULL; + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppvObject); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IDispatch, riid)) { + TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppvObject); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IHTMLDocument, riid)) { + TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppvObject); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) { + TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppvObject); + *ppvObject = HTMLDOC(This); + }else if(IsEqualGUID(&IID_IPersist, riid)) { + TRACE("(%p)->(IID_IPersist, %p)\n", This, ppvObject); + *ppvObject = PERSIST(This); + }else if(IsEqualGUID(&IID_IPersistMoniker, riid)) { + TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppvObject); + *ppvObject = PERSISTMON(This); + }else if(IsEqualGUID(&IID_IPersistFile, riid)) { + TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppvObject); + *ppvObject = PERSISTFILE(This); + }else if(IsEqualGUID(&IID_IMonikerProp, riid)) { + TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppvObject); + *ppvObject = MONPROP(This); + }else if(IsEqualGUID(&IID_IOleObject, riid)) { + TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppvObject); + *ppvObject = OLEOBJ(This); + }else if(IsEqualGUID(&IID_IOleDocument, riid)) { + TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppvObject); + *ppvObject = OLEDOC(This); + }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) { + TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppvObject); + *ppvObject = DOCVIEW(This); + }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) { + TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppvObject); + *ppvObject = ACTOBJ(This); + } + + if(*ppvObject) { + IHTMLDocument2_AddRef(iface); + return S_OK; + } + + FIXME("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppvObject); + return E_NOINTERFACE; +} + +static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface) +{ + HTMLDocument *This = (HTMLDocument*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref = %lu\n", This, ref); + return ref; +} + +static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) +{ + HTMLDocument *This = (HTMLDocument*)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref = %lu\n", This, ref); + + if(!ref) { + if(This->client) + IOleClientSite_Release(This->client); + if(This->ipsite) + IOleInPlaceSite_Release(This->ipsite); + if(This->frame) + IOleInPlaceFrame_Release(This->frame); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo) +{ + FIXME("(%p)->(%p)\n", iface, pctinfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + FIXME("(%p)->(%u %lu %p)\n", iface, iTInfo, lcid, ppTInfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + FIXME("(%p)->(%s %p %u %lu %p)\n", iface, debugstr_guid(riid), rgszNames, cNames, + lcid, rgDispId); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + FIXME("(%p)->(%ld %s %ld %d %p %p %p %p)\n", iface, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)->()\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v) +{ + FIXME("(%p)->(%x)\n", iface, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray) +{ + FIXME("(%p)->(%p)\n", iface, psarray); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray) +{ + FIXME("(%p)->(%p)\n", iface, psarray); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name, + VARIANT features, VARIANT replace, IDispatch **pomWindowResult) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(url), pomWindowResult); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID, + BSTR *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %x %p)\n", iface, debugstr_w(cmdID), showUI, pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID, + VARIANT_BOOL *pfRet) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(cmdID), pfRet); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag, + IHTMLElement **newElem) +{ + FIXME("(%p)->(%s %p)\n", iface, debugstr_w(eTag), newElem); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, long x, long y, + IHTMLElement **elementHit) +{ + FIXME("(%p)->(%ld %ld %p)\n", iface, x, y, elementHit); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface, + IHTMLStyleSheetsCollection **p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p) +{ + FIXME("(%p)->(%p)\n", iface, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String) +{ + FIXME("(%p)->(%p)\n", iface, String); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref, + long lIndex, IHTMLStyleSheet **ppnewStyleSheet) +{ + FIXME("(%p)->(%s %ld %p)\n", iface, debugstr_w(bstrHref), lIndex, ppnewStyleSheet); + return E_NOTIMPL; +} + +static IHTMLDocument2Vtbl HTMLDocumentVtbl = { + HTMLDocument_QueryInterface, + HTMLDocument_AddRef, + HTMLDocument_Release, + HTMLDocument_GetTypeInfoCount, + HTMLDocument_GetTypeInfo, + HTMLDocument_GetIDsOfNames, + HTMLDocument_Invoke, + HTMLDocument_get_Script, + HTMLDocument_get_all, + HTMLDocument_get_body, + HTMLDocument_get_activeElement, + HTMLDocument_get_images, + HTMLDocument_get_applets, + HTMLDocument_get_links, + HTMLDocument_get_forms, + HTMLDocument_get_anchors, + HTMLDocument_put_title, + HTMLDocument_get_title, + HTMLDocument_get_scripts, + HTMLDocument_put_designMode, + HTMLDocument_get_designMode, + HTMLDocument_get_selection, + HTMLDocument_get_readyState, + HTMLDocument_get_frames, + HTMLDocument_get_embeds, + HTMLDocument_get_plugins, + HTMLDocument_put_alinkColor, + HTMLDocument_get_alinkColor, + HTMLDocument_put_bgColor, + HTMLDocument_get_bgColor, + HTMLDocument_put_fgColor, + HTMLDocument_get_fgColor, + HTMLDocument_put_linkColor, + HTMLDocument_get_linkColor, + HTMLDocument_put_vlinkColor, + HTMLDocument_get_vlinkColor, + HTMLDocument_get_referrer, + HTMLDocument_get_location, + HTMLDocument_get_lastModified, + HTMLDocument_put_URL, + HTMLDocument_get_URL, + HTMLDocument_put_domain, + HTMLDocument_get_domain, + HTMLDocument_put_cookie, + HTMLDocument_get_cookie, + HTMLDocument_put_expando, + HTMLDocument_get_expando, + HTMLDocument_put_charset, + HTMLDocument_get_charset, + HTMLDocument_put_defaultCharset, + HTMLDocument_get_defaultCharset, + HTMLDocument_get_mimeType, + HTMLDocument_get_fileSize, + HTMLDocument_get_fileCreatedDate, + HTMLDocument_get_fileModifiedDate, + HTMLDocument_get_fileUpdatedDate, + HTMLDocument_get_security, + HTMLDocument_get_protocol, + HTMLDocument_get_nameProp, + HTMLDocument_write, + HTMLDocument_writeln, + HTMLDocument_open, + HTMLDocument_close, + HTMLDocument_clear, + HTMLDocument_queryCommandSupported, + HTMLDocument_queryCommandEnabled, + HTMLDocument_queryCommandState, + HTMLDocument_queryCommandIndeterm, + HTMLDocument_queryCommandText, + HTMLDocument_queryCommandValue, + HTMLDocument_execCommand, + HTMLDocument_execCommandShowHelp, + HTMLDocument_createElement, + HTMLDocument_put_onhelp, + HTMLDocument_get_onhelp, + HTMLDocument_put_onclick, + HTMLDocument_get_onclick, + HTMLDocument_put_ondblclick, + HTMLDocument_get_ondblclick, + HTMLDocument_put_onkeyup, + HTMLDocument_get_onkeyup, + HTMLDocument_put_onkeydown, + HTMLDocument_get_onkeydown, + HTMLDocument_put_onkeypress, + HTMLDocument_get_onkeypress, + HTMLDocument_put_onmouseup, + HTMLDocument_get_onmouseup, + HTMLDocument_put_onmousedown, + HTMLDocument_get_onmousedown, + HTMLDocument_put_onmousemove, + HTMLDocument_get_onmousemove, + HTMLDocument_put_onmouseout, + HTMLDocument_get_onmouseout, + HTMLDocument_put_onmouseover, + HTMLDocument_get_onmouseover, + HTMLDocument_put_onreadystatechange, + HTMLDocument_get_onreadystatechange, + HTMLDocument_put_onafterupdate, + HTMLDocument_get_onafterupdate, + HTMLDocument_put_onrowexit, + HTMLDocument_get_onrowexit, + HTMLDocument_put_onrowenter, + HTMLDocument_get_onrowenter, + HTMLDocument_put_ondragstart, + HTMLDocument_get_ondragstart, + HTMLDocument_put_onselectstart, + HTMLDocument_get_onselectstart, + HTMLDocument_elementFromPoint, + HTMLDocument_get_parentWindow, + HTMLDocument_get_styleSheets, + HTMLDocument_put_onbeforeupdate, + HTMLDocument_get_onbeforeupdate, + HTMLDocument_put_onerrorupdate, + HTMLDocument_get_onerrorupdate, + HTMLDocument_toString, + HTMLDocument_createStyleSheet +}; + +HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) +{ + HTMLDocument *ret; + HRESULT hres; + + TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject); + + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HTMLDocument)); + ret->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl; + ret->ref = 0; + + hres = IHTMLDocument_QueryInterface(HTMLDOC(ret), riid, ppvObject); + if(FAILED(hres)) + HeapFree(GetProcessHeap(), 0, ret); + + HTMLDocument_Persist_Init(ret); + HTMLDocument_OleObj_Init(ret); + HTMLDocument_View_Init(ret); + + return hres; +} diff -urN wine-20050310/dlls/mshtml/main.c wine-20050419/dlls/mshtml/main.c --- wine-20050310/dlls/mshtml/main.c 2005-01-10 14:31:29.000000000 +0100 +++ wine-20050419/dlls/mshtml/main.c 2005-04-14 13:30:50.000000000 +0200 @@ -3,6 +3,7 @@ * * Copyright 2002 Lionel Ulmer * Copyright 2003 Mike McCormack + * Copyright 2005 Jacek Caban * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,14 +25,18 @@ #include #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winuser.h" #include "winnls.h" #include "winreg.h" #include "ole2.h" +#include "docobj.h" #include "mshtml.h" +#include "mshtml_private.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -45,8 +50,9 @@ typedef HRESULT (WINAPI *fnGetClassObject)(REFCLSID rclsid, REFIID iid, LPVOID *ppv); typedef BOOL (WINAPI *fnCanUnloadNow)(); -HMODULE hMozCtl; +static HMODULE hMozCtl; +HINSTANCE hInst; /* convert a guid to a wide character string */ static void MSHTML_guid2wstr( const GUID *guid, LPWSTR wstr ) @@ -96,61 +102,151 @@ switch(fdwReason) { case DLL_PROCESS_ATTACH: - if( !MSHTML_GetMozctlPath( szPath, sizeof szPath ) ) - { + if(MSHTML_GetMozctlPath(szPath, sizeof szPath)) { + hMozCtl = LoadLibraryExW(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + if(!hMozCtl) + ERR("Can't load the Mozilla ActiveX control\n"); + }else { MESSAGE("You need to install the Mozilla ActiveX control to\n"); MESSAGE("use Wine's builtin MSHTML dll.\n"); - return FALSE; - } - hMozCtl = LoadLibraryExW(szPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - if( !hMozCtl ) - { - ERR("Can't load the Mozilla ActiveX control\n"); - return FALSE; } + hInst = hInstDLL; break; case DLL_PROCESS_DETACH: - FreeLibrary( hMozCtl ); + if(hMozCtl) + FreeLibrary( hMozCtl ); break; } return TRUE; } -HRESULT WINAPI MSHTML_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) +/*********************************************************** + * ClassFactory implementation + */ +typedef HRESULT (*CreateInstanceFunc)(IUnknown*,REFIID,void**); +typedef struct { + const IClassFactoryVtbl *lpVtbl; + ULONG ref; + CreateInstanceFunc fnCreateInstance; +} ClassFactory; + +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFGUID riid, void **ppvObject) { - HRESULT r; - fnGetClassObject pGetClassObject; + if(IsEqualGUID(&IID_IClassFactory, riid) || IsEqualGUID(&IID_IUnknown, riid)) { + IClassFactory_AddRef(iface); + *ppvObject = iface; + return S_OK; + } + + WARN("not supported iid %s\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + ClassFactory *This = (ClassFactory*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) ref = %lu\n", This, ref); + return ref; +} - TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv ); +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + ClassFactory *This = (ClassFactory*)iface; + ULONG ref = InterlockedDecrement(&This->ref); - if( !IsEqualGUID( &CLSID_HTMLDocument, rclsid ) ) - WARN("Unknown class %s\n", debugstr_guid(rclsid) ); + TRACE("(%p) ref = %lu\n", This, ref); - pGetClassObject = (fnGetClassObject) GetProcAddress( hMozCtl, "DllGetClassObject" ); - if( !pGetClassObject ) - return CLASS_E_CLASSNOTAVAILABLE; - r = pGetClassObject( &CLSID_MozillaBrowser, iid, ppv ); + if(!ref) + HeapFree(GetProcessHeap(), 0, This); - TRACE("r = %08lx *ppv = %p\n", r, *ppv ); + return ref; +} +static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, + REFIID riid, void **ppvObject) +{ + ClassFactory *This = (ClassFactory*)iface; + return This->fnCreateInstance(pUnkOuter, riid, ppvObject); +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) +{ + FIXME("(%p)->(%x) stub\n", iface, dolock); return S_OK; } -BOOL WINAPI MSHTML_DllCanUnloadNow(void) +static const IClassFactoryVtbl HTMLClassFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + ClassFactory_CreateInstance, + ClassFactory_LockServer +}; + +static HRESULT ClassFactory_Create(REFIID riid, void **ppv, CreateInstanceFunc fnCreateInstance) +{ + ClassFactory *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(ClassFactory)); + HRESULT hres; + + ret->lpVtbl = &HTMLClassFactoryVtbl; + ret->ref = 0; + ret->fnCreateInstance = fnCreateInstance; + + hres = IClassFactory_QueryInterface((IClassFactory*)ret, riid, ppv); + if(FAILED(hres)) { + HeapFree(GetProcessHeap(), 0, ret); + *ppv = NULL; + } + return hres; +} + +HRESULT WINAPI MSHTML_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { - fnCanUnloadNow pCanUnloadNow; - BOOL r; + HRESULT hres; + fnGetClassObject pGetClassObject; - TRACE("\n"); + TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv ); - pCanUnloadNow = (fnCanUnloadNow) GetProcAddress( hMozCtl, "DllCanUnloadNow" ); - if( !pCanUnloadNow ) - return FALSE; - r = pCanUnloadNow(); + if(hMozCtl && IsEqualGUID(&CLSID_HTMLDocument, rclsid)) { + pGetClassObject = (fnGetClassObject) GetProcAddress(hMozCtl, "DllGetClassObject"); + if(pGetClassObject) { + hres = pGetClassObject(&CLSID_MozillaBrowser, riid, ppv); + if(SUCCEEDED(hres)) { + TRACE("returning Mozilla ActiveX Control hres = %08lx *ppv = %p\n", hres, *ppv); + return hres; + } + } + } + + if(IsEqualGUID(&CLSID_HTMLDocument, rclsid)) { + hres = ClassFactory_Create(riid, ppv, HTMLDocument_Create); + TRACE("hres = %08lx\n", hres); + return hres; + } + + FIXME("Unknown class %s\n", debugstr_guid(rclsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI MSHTML_DllCanUnloadNow(void) +{ + fnCanUnloadNow pCanUnloadNow = NULL; + HRESULT hres; + + TRACE("()\n"); + + if(hMozCtl) + pCanUnloadNow = (fnCanUnloadNow) GetProcAddress(hMozCtl, "DllCanUnloadNow"); + if(!pCanUnloadNow) + return S_FALSE; + + hres = pCanUnloadNow(); - TRACE("r = %d\n", r); + TRACE("hres = %08lx\n", hres); - return r; + return hres; } /* appears to have the same prototype as WinMain */ diff -urN wine-20050310/dlls/mshtml/mshtml_private.h wine-20050419/dlls/mshtml/mshtml_private.h --- wine-20050310/dlls/mshtml/mshtml_private.h 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/mshtml/mshtml_private.h 2005-04-15 18:12:45.000000000 +0200 @@ -0,0 +1,54 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +typedef struct { + IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl; + IPersistMonikerVtbl *lpPersistMonikerVtbl; + IPersistFileVtbl *lpPersistFileVtbl; + IMonikerPropVtbl *lpMonikerPropVtbl; + IOleObjectVtbl *lpOleObjectVtbl; + IOleDocumentVtbl *lpOleDocumentVtbl; + IOleDocumentViewVtbl *lpOleDocumentViewVtbl; + IOleInPlaceActiveObjectVtbl *lpOleInPlaceActiveObjectVtbl; + + ULONG ref; + + IOleClientSite *client; + IOleInPlaceSite *ipsite; + IOleInPlaceFrame *frame; + + HWND hwnd; +} HTMLDocument; + +#define HTMLDOC(x) ((IHTMLDocument2*) &(x)->lpHTMLDocument2Vtbl) +#define PERSIST(x) ((IPersist*) &(x)->lpPersistFileVtbl) +#define PERSISTMON(x) ((IPersistMoniker*) &(x)->lpPersistMonikerVtbl) +#define PERSISTFILE(x) ((IPersistFile*) &(x)->lpPersistFileVtbl) +#define MONPROP(x) ((IMonikerProp*) &(x)->lpMonikerPropVtbl) +#define OLEOBJ(x) ((IOleObject*) &(x)->lpOleObjectVtbl) +#define OLEDOC(x) ((IOleDocument*) &(x)->lpOleDocumentVtbl) +#define DOCVIEW(x) ((IOleDocumentView*) &(x)->lpOleDocumentViewVtbl) +#define ACTOBJ(x) ((IOleInPlaceActiveObject*) &(x)->lpOleInPlaceActiveObjectVtbl) + +HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**); + +void HTMLDocument_Persist_Init(HTMLDocument*); +void HTMLDocument_OleObj_Init(HTMLDocument*); +void HTMLDocument_View_Init(HTMLDocument*); + +extern HINSTANCE hInst; diff -urN wine-20050310/dlls/mshtml/oleobj.c wine-20050419/dlls/mshtml/oleobj.c --- wine-20050310/dlls/mshtml/oleobj.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/mshtml/oleobj.c 2005-04-15 18:12:45.000000000 +0200 @@ -0,0 +1,477 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "docobj.h" + +#include "mshtml.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +/********************************************************** + * IOleObject implementation + */ + +#define OLEOBJ_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleObjectVtbl)); + +static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject) +{ + OLEOBJ_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI OleObject_AddRef(IOleObject *iface) +{ + OLEOBJ_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI OleObject_Release(IOleObject *iface) +{ + OLEOBJ_THIS + return IHTMLDocument2_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite) +{ + OLEOBJ_THIS + TRACE("(%p)->(%p)\n", This, pClientSite); + + if(This->client) + IOleClientSite_Release(This->client); + if(pClientSite) + IOleClientSite_AddRef(pClientSite); + This->client = pClientSite; + + return S_OK; +} + +static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite) +{ + OLEOBJ_THIS + TRACE("(%p)->(%p)\n", This, ppClientSite); + + if(!ppClientSite) + return E_INVALIDARG; + + if(This->client) + IOleClientSite_AddRef(This->client); + *ppClientSite = This->client; + + return S_OK; +} + +static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj) +{ + OLEOBJ_THIS + FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj)); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption) +{ + OLEOBJ_THIS + FIXME("(%p)->(%08lx)\n", This, dwSaveOption); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk) +{ + OLEOBJ_THIS + FIXME("(%p %ld %p)->()\n", This, dwWhichMoniker, pmk); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation, + DWORD dwReserved) +{ + OLEOBJ_THIS + FIXME("(%p)->(%p %x %ld)\n", This, pDataObject, fCreation, dwReserved); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld %p)\n", This, dwReserved, ppDataObject); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, + LONG lindex, HWND hwndParent, LPCRECT lprcPosRect) +{ + OLEOBJ_THIS + IOleDocumentSite *pDocSite; + HRESULT hres; + + TRACE("(%p)->(%ld %p %p %ld %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect); + + if(iVerb != OLEIVERB_SHOW) { + FIXME("iVerb = %ld not supported\n", iVerb); + return E_NOTIMPL; + } + + if(!pActiveSite) + pActiveSite = This->client; + + hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite); + if(SUCCEEDED(hres)) { + IOleContainer *pContainer; + hres = IOleClientSite_GetContainer(pActiveSite, &pContainer); + if(SUCCEEDED(hres)) { + IOleContainer_LockContainer(pContainer, TRUE); + /* FIXME: Create new IOleDocumentView. See CreateView for more info. */ + hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This)); + IOleContainer_Release(pContainer); + } + IOleDocumentSite_Release(pDocSite); + }else { + hres = IOleDocumentView_UIActivate(DOCVIEW(This), TRUE); + if(SUCCEEDED(hres)) { + if(lprcPosRect) { + RECT rect; /* We need to pass rect as not const pointer */ + memcpy(&rect, lprcPosRect, sizeof(RECT)); + IOleDocumentView_SetRect(DOCVIEW(This), &rect); + } + IOleDocumentView_Show(DOCVIEW(This), TRUE); + } + } + + return hres; +} + +static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb) +{ + OLEOBJ_THIS + FIXME("(%p)->(%p)\n", This, ppEnumOleVerb); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Update(IOleObject *iface) +{ + OLEOBJ_THIS + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface) +{ + OLEOBJ_THIS + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid) +{ + OLEOBJ_THIS + TRACE("(%p)->(%p)\n", This, pClsid); + + if(!pClsid) + return E_INVALIDARG; + + memcpy(pClsid, &CLSID_HTMLDocument, sizeof(GUID)); + return S_OK; +} + +static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld %p)\n", This, dwFormOfType, pszUserType); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection) +{ + OLEOBJ_THIS + FIXME("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld)\n", This, dwConnection); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise) +{ + OLEOBJ_THIS + FIXME("(%p)->(%p)\n", This, ppenumAdvise); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus) +{ + OLEOBJ_THIS + FIXME("(%p)->(%ld %p)\n", This, dwAspect, pdwStatus); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal) +{ + OLEOBJ_THIS + FIXME("(%p)->(%p)\n", This, pLogpal); + return E_NOTIMPL; +} + +static IOleObjectVtbl OleObjectVtbl = { + OleObject_QueryInterface, + OleObject_AddRef, + OleObject_Release, + OleObject_SetClientSite, + OleObject_GetClientSite, + OleObject_SetHostNames, + OleObject_Close, + OleObject_SetMoniker, + OleObject_GetMoniker, + OleObject_InitFromData, + OleObject_GetClipboardData, + OleObject_DoVerb, + OleObject_EnumVerbs, + OleObject_Update, + OleObject_IsUpToDate, + OleObject_GetUserClassID, + OleObject_GetUserType, + OleObject_SetExtent, + OleObject_GetExtent, + OleObject_Advise, + OleObject_Unadvise, + OleObject_EnumAdvise, + OleObject_GetMiscStatus, + OleObject_SetColorScheme +}; + +/********************************************************** + * IOleDocument implementation + */ + +#define OLEDOC_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentVtbl)); + +static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppvObject) +{ + OLEDOC_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface) +{ + OLEDOC_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI OleDocument_Release(IOleDocument *iface) +{ + OLEDOC_THIS + return IHTMLDocument2_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm, + DWORD dwReserved, IOleDocumentView **ppView) +{ + OLEDOC_THIS + HRESULT hres; + + TRACE("(%p)->(%p %p %ld %p)\n", This, pIPSite, pstm, dwReserved, ppView); + + if(!ppView) + return E_INVALIDARG; + + /* FIXME: + * Windows implementation creates new IOleDocumentView when function is called for the + * first time and returns E_FAIL when it is called for the second time, but it doesn't matter + * if the application uses returned interfaces, passed to ActivateMe or returned by + * QueryInterface, so there is no reason to create new interface. This needs more testing. + */ + + if(pIPSite) { + hres = IOleDocumentView_SetInPlaceSite(DOCVIEW(This), pIPSite); + if(FAILED(hres)) + return hres; + } + + if(pstm) + FIXME("pstm is not supported\n"); + + IOleDocumentView_AddRef(DOCVIEW(This)); + *ppView = DOCVIEW(This); + return S_OK; +} + +static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus) +{ + OLEDOC_THIS + FIXME("(%p)->(%p)\n", This, pdwStatus); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum, + IOleDocumentView **ppView) +{ + OLEDOC_THIS + FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView); + return E_NOTIMPL; +} + +static IOleDocumentVtbl OleDocumentVtbl = { + OleDocument_QueryInterface, + OleDocument_AddRef, + OleDocument_Release, + OleDocument_CreateView, + OleDocument_GetDocMiscStatus, + OleDocument_EnumViews +}; + +/********************************************************** + * IOleInPlaceActiveObject implementation + */ + +#define ACTOBJ_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleInPlaceActiveObjectVtbl)); + +static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject) +{ + ACTOBJ_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface) +{ + ACTOBJ_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface) +{ + ACTOBJ_THIS + return IHTMLDocument2_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd) +{ + ACTOBJ_THIS + TRACE("(%p)->(%p)\n", This, phwnd); + + if(!phwnd) + return E_INVALIDARG; + + *phwnd = This->hwnd; + return S_OK; +} + +static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode) +{ + ACTOBJ_THIS + FIXME("(%p)->(%x)\n", This, fEnterMode); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg) +{ + ACTOBJ_THIS + FIXME("(%p)->(%p)\n", This, lpmsg); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate) +{ + ACTOBJ_THIS + FIXME("(%p)->(%x)\n", This, fActivate); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate) +{ + ACTOBJ_THIS + FIXME("(%p)->(%x)\n", This, fActivate); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder, + IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow) +{ + ACTOBJ_THIS + FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable) +{ + ACTOBJ_THIS + FIXME("(%p)->(%x)\n", This, fEnable); + return E_NOTIMPL; +} + +static IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = { + OleInPlaceActiveObject_QueryInterface, + OleInPlaceActiveObject_AddRef, + OleInPlaceActiveObject_Release, + OleInPlaceActiveObject_GetWindow, + OleInPlaceActiveObject_ContextSensitiveHelp, + OleInPlaceActiveObject_TranslateAccelerator, + OleInPlaceActiveObject_OnFrameWindowActivate, + OleInPlaceActiveObject_OnDocWindowActivate, + OleInPlaceActiveObject_ResizeBorder, + OleInPlaceActiveObject_EnableModeless +}; + +void HTMLDocument_OleObj_Init(HTMLDocument *This) +{ + This->lpOleObjectVtbl = &OleObjectVtbl; + This->lpOleDocumentVtbl = &OleDocumentVtbl; + This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl; + + This->client = NULL; +} diff -urN wine-20050310/dlls/mshtml/persist.c wine-20050419/dlls/mshtml/persist.c --- wine-20050310/dlls/mshtml/persist.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/mshtml/persist.c 2005-04-12 13:57:51.000000000 +0200 @@ -0,0 +1,237 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "docobj.h" + +#include "mshtml.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +/********************************************************** + * IPersistMoniker implementation + */ + +#define PERSISTMON_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistMonikerVtbl)); + +static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid, + void **ppvObject) +{ + PERSISTMON_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface) +{ + PERSISTMON_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface) +{ + PERSISTMON_THIS + return IHTMLDocument2_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID) +{ + PERSISTMON_THIS + return IPersist_GetClassID(PERSIST(This), pClassID); +} + +static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable, + IMoniker *pimkName, LPBC pibc, DWORD grfMode) +{ + FIXME("(%p)->(%x %p %p %08lx)\n", iface, fFullyAvailable, pimkName, pibc, grfMode); + return S_OK; +} + +static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName, + LPBC pbc, BOOL fRemember) +{ + FIXME("(%p)->(%p %p %x)\n", iface, pimkName, pbc, fRemember); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc) +{ + FIXME("(%p)->(%p %p)\n", iface, pimkName, pibc); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName) +{ + FIXME("(%p)->(%p)\n", iface, ppimkName); + return E_NOTIMPL; +} + +static IPersistMonikerVtbl PersistMonikerVtbl = { + PersistMoniker_QueryInterface, + PersistMoniker_AddRef, + PersistMoniker_Release, + PersistMoniker_GetClassID, + PersistMoniker_IsDirty, + PersistMoniker_Load, + PersistMoniker_Save, + PersistMoniker_SaveCompleted, + PersistMoniker_GetCurMoniker +}; + +/********************************************************** + * IMonikerProp implementation + */ + +#define MONPROP_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpMonikerPropVtbl)); + +static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppvObject) +{ + MONPROP_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface) +{ + MONPROP_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface) +{ + MONPROP_THIS + return IHTMLDocument_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val) +{ + FIXME("(%p)->(%d %s)\n", iface, mkp, debugstr_w(val)); + return E_NOTIMPL; +} + +static IMonikerPropVtbl MonikerPropVtbl = { + MonikerProp_QueryInterface, + MonikerProp_AddRef, + MonikerProp_Release, + MonikerProp_PutProperty +}; + +/********************************************************** + * IPersistFile implementation + */ + +#define PERSISTFILE_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistFileVtbl)); + +static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppvObject) +{ + PERSISTFILE_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface) +{ + PERSISTFILE_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI PersistFile_Release(IPersistFile *iface) +{ + PERSISTFILE_THIS + return IHTMLDocument2_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID) +{ + TRACE("(%p)->(%p)\n", iface, pClassID); + + if(!pClassID) + return E_INVALIDARG; + + memcpy(pClassID, &CLSID_HTMLDocument, sizeof(CLSID)); + return S_OK; +} + +static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface) +{ + FIXME("(%p)\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode) +{ + FIXME("(%p)->(%s %08lx)\n", iface, debugstr_w(pszFileName), dwMode); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember) +{ + FIXME("(%p)->(%s %x)\n", iface, debugstr_w(pszFileName), fRemember); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName) +{ + FIXME("(%p)->(%s)\n", iface, debugstr_w(pszFileName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName) +{ + FIXME("(%p)->(%p)\n", iface, pszFileName); + return E_NOTIMPL; +} + +static IPersistFileVtbl PersistFileVtbl = { + PersistFile_QueryInterface, + PersistFile_AddRef, + PersistFile_Release, + PersistFile_GetClassID, + PersistFile_IsDirty, + PersistFile_Load, + PersistFile_Save, + PersistFile_SaveCompleted, + PersistFile_GetCurFile +}; + +void HTMLDocument_Persist_Init(HTMLDocument *This) +{ + This->lpPersistMonikerVtbl = &PersistMonikerVtbl; + This->lpPersistFileVtbl = &PersistFileVtbl; + This->lpMonikerPropVtbl = &MonikerPropVtbl; +} diff -urN wine-20050310/dlls/mshtml/view.c wine-20050419/dlls/mshtml/view.c --- wine-20050310/dlls/mshtml/view.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050419/dlls/mshtml/view.c 2005-04-15 18:12:45.000000000 +0200 @@ -0,0 +1,384 @@ +/* + * Copyright 2005 Jacek Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "ole2.h" +#include "docobj.h" + +#include "mshtml.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +static const WCHAR wszInternetExplorer_Server[] = + {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0}; +static const WCHAR wszHTML_Document[] = + {'H','T','M','L',' ','D','o','c','u','m','e','n','t',0}; + +static ATOM serverwnd_class = 0; + +static void paint_disabled(HWND hwnd) { + HDC hdc; + PAINTSTRUCT ps; + HBRUSH brush; + RECT rect; + HFONT font; + + font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL); + brush = CreateSolidBrush(RGB(255,255,255)); + GetClientRect(hwnd, &rect); + + hdc = BeginPaint(hwnd, &ps); + SelectObject(hdc, font); + SelectObject(hdc, brush); + Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom); + DrawTextA(hdc, "HTML rendering is currently disabled.",-1, &rect, + DT_CENTER | DT_SINGLELINE | DT_VCENTER); + EndPaint(hwnd, &ps); + + DeleteObject(font); + DeleteObject(brush); +} + +static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if(msg == WM_PAINT) + paint_disabled(hwnd); + + return DefWindowProcW(hwnd, msg, wParam, lParam); +} + +static void register_serverwnd_class() +{ + static WNDCLASSEXW wndclass = { + sizeof(WNDCLASSEXW), + CS_DBLCLKS, + serverwnd_proc, + 0, 0, NULL, NULL, NULL, NULL, NULL, + wszInternetExplorer_Server, + NULL, + }; + wndclass.hInstance = hInst; + serverwnd_class = RegisterClassExW(&wndclass); +} + + +/********************************************************** + * IOleDocumentView implementation + */ + +#define DOCVIEW_THIS \ + HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentViewVtbl)); + +static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject) +{ + DOCVIEW_THIS + return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject); +} + +static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface) +{ + DOCVIEW_THIS + return IHTMLDocument2_AddRef(HTMLDOC(This)); +} + +static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface) +{ + DOCVIEW_THIS + return IHTMLDocument2_Release(HTMLDOC(This)); +} + +static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite) +{ + DOCVIEW_THIS + TRACE("(%p)->(%p)\n", This, pIPSite); + + if(!pIPSite) + return E_INVALIDARG; + + if(pIPSite) + IOleInPlaceSite_AddRef(pIPSite); + + if(This->ipsite) + IOleInPlaceSite_Release(This->ipsite); + + This->ipsite = pIPSite; + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite) +{ + DOCVIEW_THIS + TRACE("(%p)->(%p)\n", This, ppIPSite); + + if(!ppIPSite) + return E_INVALIDARG; + + if(This->ipsite) + IOleInPlaceSite_AddRef(This->ipsite); + + *ppIPSite = This->ipsite; + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk) +{ + DOCVIEW_THIS + TRACE("(%p)->(%p)\n", This, ppunk); + + if(!ppunk) + return E_INVALIDARG; + + IHTMLDocument2_AddRef(HTMLDOC(This)); + *ppunk = (IUnknown*)HTMLDOC(This); + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView) +{ + DOCVIEW_THIS + RECT rect; + + TRACE("(%p)->(%p)\n", This, prcView); + + if(!prcView) + return E_INVALIDARG; + + if(This->hwnd) { + GetClientRect(This->hwnd, &rect); + if(memcmp(prcView, &rect, sizeof(RECT))) { + InvalidateRect(This->hwnd,NULL,TRUE); + SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right, + prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE); + } + } + + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView) +{ + DOCVIEW_THIS + + TRACE("(%p)->(%p)\n", This, prcView); + + if(!prcView) + return E_INVALIDARG; + + GetClientRect(This->hwnd, prcView); + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView, + LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox) +{ + DOCVIEW_THIS + FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow) +{ + DOCVIEW_THIS + TRACE("(%p)->(%x)\n", This, fShow); + + if(This->hwnd) + ShowWindow(This->hwnd, fShow); + + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate) +{ + DOCVIEW_THIS + HRESULT hres; + IOleInPlaceUIWindow *pIPWnd; + IOleInPlaceFrame *pIPFrame; + RECT posrect, cliprect; + OLEINPLACEFRAMEINFO frameinfo; + HWND parent_hwnd, hwnd; + + TRACE("(%p)->(%x)\n", This, fUIActivate); + + if(!This->ipsite) { + FIXME("This->ipsite = NULL\n"); + return E_FAIL; + } + + if(fUIActivate) { + if(This->hwnd) + return S_OK; + if(!serverwnd_class) + register_serverwnd_class(); + + hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite); + if(hres != S_OK) { + WARN("CanInPlaceActivate returned: %08lx\n", hres); + return FAILED(hres) ? hres : E_FAIL; + } + + hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &pIPWnd, &posrect, &cliprect, &frameinfo); + if(FAILED(hres)) { + WARN("GetWindowContext failed: %08lx\n", hres); + return hres; + } + if(pIPWnd) + IOleInPlaceUIWindow_Release(pIPWnd); + TRACE("got window context: %p %p {%ld %ld %ld %ld} {%ld %ld %ld %ld} {%d %x %p %p %d}\n", + pIPFrame, pIPWnd, posrect.left, posrect.top, posrect.right, posrect.bottom, + cliprect.left, cliprect.top, cliprect.right, cliprect.bottom, + frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries); + + hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd); + if(FAILED(hres)) { + WARN("GetWindow failed: %08lx\n", hres); + return hres; + } + + hwnd = CreateWindowExW(0, wszInternetExplorer_Server, NULL, + WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top, + parent_hwnd, NULL, hInst, This); + + hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite); + if(FAILED(hres)) { + WARN("OnInPlaceActivate failed: %08lx\n", hres); + return hres; + } + + SetWindowPos(hwnd, NULL, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW); + RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN); + SetFocus(hwnd); + + /* NOTE: + * Windows implementation calls: + * RegisterWindowMessage("MSWHEEL_ROLLMSG"); + * SetTimer(This->hwnd, TIMER_ID, 100, NULL); + */ + + hres = IOleInPlaceSite_OnUIActivate(This->ipsite); + if(SUCCEEDED(hres)) { + IOleInPlaceFrame_SetActiveObject(pIPFrame, ACTOBJ(This), wszHTML_Document); + }else { + FIXME("OnUIActivate failed: %08lx\n", hres); + DestroyWindow(hwnd); + return hres; + } + if(This->frame) + IOleInPlaceFrame_Release(This->frame); + This->frame = pIPFrame; + This->hwnd = hwnd; + }else { + static const WCHAR wszEmpty[] = {0}; + + if(This->frame) + IOleInPlaceFrame_SetActiveObject(This->frame, NULL, wszEmpty); + if(This->ipsite) + IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE); + } + return S_OK; +} + +static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface) +{ + DOCVIEW_THIS + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved) +{ + DOCVIEW_THIS + TRACE("(%p)->(%lx)\n", This, dwReserved); + + if(dwRes