diff -Nru wine1.7-1.7.24/ANNOUNCE wine1.7-1.7.25/ANNOUNCE --- wine1.7-1.7.24/ANNOUNCE 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/ANNOUNCE 2014-08-22 18:39:55.000000000 +0000 @@ -1,15 +1,16 @@ -The Wine development release 1.7.24 is now available. +The Wine development release 1.7.25 is now available. What's new in this release (see below for details): - - Beginning of some DirectWrite classes implementation. - - Initial wrapper dll for the packet capture library. - - Some crypto improvements. + - Implementation of the packet capture library. + - A few more DirectWrite functions. + - Improvements in HTML table support. + - More VBScript math functions. - Various bug fixes. The source is available from the following locations: - http://prdownloads.sourceforge.net/wine/wine-1.7.24.tar.bz2 - http://mirrors.ibiblio.org/wine/source/1.7/wine-1.7.24.tar.bz2 + http://prdownloads.sourceforge.net/wine/wine-1.7.25.tar.bz2 + http://mirrors.ibiblio.org/wine/source/1.7/wine-1.7.25.tar.bz2 Binary packages for various distributions will be available from: @@ -25,201 +26,257 @@ ---------------------------------------------------------------- -Bugs fixed in 1.7.24 (total 44): +Bugs fixed in 1.7.25 (total 35): - 9121 Crash when launching winning eleven 8 - 14240 FC_Edit fails to initialize - 14943 CoDeSys 3.2 (Patch2) development environment does not work - 16365 Archlord Episode 3 Client crashes on startup (decrypting files with a RC4 session key derived from MD5 hash fails, only 40 bits are used, salt is dropped) - 17441 Anarchy Online: First run has messed up graphics and pointer - 17678 Anarchy Online fullscreen followes you when you switch desktops - 22177 Standalone version of DivX fails to install - 22896 Multiple applications and games need support for shell32 FOLDERID_LocalAppDataLow (.NET based Unity Engine games, Java JRE 6 in Vista mode) - 24711 AV Voice Changer Software Diamond 7.0 (VcsCore.exe) crashes on startup - 26346 Letters from Nowhere 2 demo: 'play trial' button does not work - 26887 Magicka crashes a few seconds after title screen - 26951 REALTEK 11n USB Wireless LAN Driver installer crashes - 27969 wine explorer crashes on startup - 28312 Assassin's Creed Brotherhood v1.03 needs "Saved Games" folder - 30454 Unknown program crashes on start - 30496 Serif WebPlus X2 and X5 crash on startup in mshtml - 30803 CCleaner 3.19 won't start, err:seh:setup_exception stack overflow - 30945 Jammer 6 demo fails to install without native ie7 - 31008 WinUAE "Browse for folder" works incorrectly - 31408 anarchy online crash new zone - 31566 Fallout 3: regression causes block at critical section when radio is enabled - 31599 Serif Photoplus X6 installer fails, reporting 'Invalid command line.' (registry command association for msi package, 'msiexec.exe' must be a fully qualified path) - 31687 DYMO Stamps can't connect to its server - 31846 World of Warcraft: graphical glitches with particle weather effects using D3D9 engine - 32318 Excel 2007 files password-protected in Wine cannot be opened in Windows, and vice versa - 32480 Shogun: Total War Demo crashes at startup - 32758 .NET 3.5 and 4.x apps using Microsoft Enhanced RSA and AES Cryptographic Provider with default WinVer = Windows XP report "PlatformNotSupportedException" (TurboTax 2012, Adicom PNV, GOG.com downloader) - 33805 LEGO Digital Designer 4.3.6 crashes on start - 33867 Uplay shop doesn't let you buy things - 34141 Thunderbird 17.07 Crashes when clicking done in account configuration window - 34324 QQ2013 SP1 can't install - 35342 Office 2013 full offline install setup crash at startup - 35571 Questrade IQ Divide by Zero error - 36629 .NET Framework 4.0 fails to install - 36716 World Of Tanks black screen - 36833 app aborted because call unimplemented function iphlpapi.dll._PfBindInterfaceToIPAddress@12 - 36835 Microsoft OneDrive/SkyDrive needs support for Shell32.dll.SHGetKnownFolderPath with 'KNOWNFOLDERID_Links' - 36888 DDO Wine website not work any more - 36927 SADX Mod Loader crashes due to missing msvcp100 function std::basic_istream::swap() - 36995 Regression: crash in msxml3 - 36998 Cube World crashes on unimplemented function msvcp110.dll.?_Xbad_alloc@std@@YAXXZ - 37001 APB Reloaded 1.x (MMORPG) launcher crashes on startup (some CIM data type to OLE variant (VT) mappings are incorrect) - 37005 Serif WebPlus Starter Edition crashes on startup (IPropertyBag2::GetPropertyInfo returns more properties than the caller requested, leading to stack smashing) - 37039 When copying data into memory, shows a dialog message then crashes (but info passes to memory) + 1908 Medieval total war demo crashes with builtin amstream + 5809 "native" (Microsoft) MSI does not work with wine 0.9.18 + 9059 Space Empires V 1.44 crashes + 10332 Irfanview crashes in thumbnail mode when previewing certain text file + 12639 Creative ZENcast Organizer installer fails with error -5002 + 13347 Skype 3.5 only works in "Win95" mode + 13934 Thief: Deadly Shadows crashes immediately + 17273 Many apps and games need SetNamedPipeHandleState implementation (support for named pipe message mode)(FireFox+Flash, Win8/NET 4.x SDK/vcrun2012, WiX installers) + 17856 JFlothows Wuerfel crashes with BAD_DRAWABLE "Cannot get FB Config for iPixelFormat 0" + 18012 DVDDecrypter 3.5.4.0 fails to detect CDROM drive with 'WinVer' set >= 'Windows 2000' (expects '\Device\Cdrom' in NT object manager namespace) + 18389 Registering after installing Roblox doesn't work + 20374 KeePass 1.09 crashes opening password database due to unimplemented bcrypt.dll.BCryptOpenAlgorithmProvider + 20414 Crash in Tales of Monkey Island + 21349 Python 2.6/2.7 crashes during run of 'PyInstaller' packaging application + 22530 CDBurnerXP 4.0.x exits with Wine-Mono when trying to enter data disc mode (needs COM/ActiveX host support) + 22687 Bonzai3D crashes and freezes when project window is moved + 22788 OriginPro 8.0 crashes on startup + 24273 Some objects in Source games are black + 24700 Explorer++ doesn't open command prompt windows properly + 25775 World of Warcraft: crashes several seconds after logging in to a character. + 26097 Mario Forever 5.0.1: fails to start + 26101 riched20/editor tests show a ton of valgrind warnings + 28823 riched20/tests/editor.ok: TRACE() of uninitialized value triggered by test_word_movement()? + 29265 WebGallery 1.x: search throws access violation (XML document labelled UTF-16 but has UTF-8 content) + 31109 Microshop 2.0 (.NET 2.0 app using System.Transactions) wants ole32 CoGetDefaultContext + 31462 Open General: corrupted tiles on the map + 32651 File path passed to linux application by winebrowser is mangled if it contains international characters + 33655 Magic MP3 Tagger crashes after adding a file + 34279 Project I.G.I: crashes when starting game + 34914 mshtml:htmldoc fails on most Windows systems + 36111 UltraVNC 1.1.9.6 installer fails + 36769 Adobe Creative Cloud Setup crashes on startup with WinVer set to 'Windows 7' (needs IDWriteFactory::RegisterFontFileLoader method implementation) + 37061 IEC 61850 v2.02 example client crashes on unimplemented function wpcap.dll.pcap_findalldevs_ex + 37062 Wireshark 1.10 'dumpcap.exe' tool crashes on unimplemented function wpcap.dll.pcap_findalldevs + 37094 Wireshark 1.10 'dumpcap.exe' tool crashes on unimplemented function wpcap.dll.pcap_open_live ---------------------------------------------------------------- -Changes since 1.7.23: +Changes since 1.7.24: -Akihiro Sagawa (1): - po: Update Japanese translation. +Adam Martinson (1): + ntdll: Implement FILE_PIPE_INFORMATION for NtQueryInformationFile. -Andreas Mohr (1): - kernel32: Fix naming/spelling/typo of macro to HasOverlappedIoCompleted(). +Alexandre Julliard (1): + kernel32: Add detection of fake dlls when determining a binary type. -Andrei Slăvoiu (5): - wined3d: Make the card selection for Nvidia binary driver use arrays only. - wined3d: Make the card selection for AMD binary driver use arrays only. - wined3d: Replace vendor specific callbacks with generic code that uses vendor specific renderer string tables. - wined3d: Make d3d_level_from_gl_info return an enum instead of a plain int. - wined3d: Use capabilities from the shader backend or the fragment pipeline to determine the D3D level. - -André Hentschel (2): - wpcap: Initial stub implementation. - wpcap: Implement pcap_lib_version. - -Aric Stewart (2): - dwrite: Make dwritefactory an allocated object. - dwrite: Basic implementation for FontCollectionLoader registration. - -Aurimas Fišeras (1): - po: Update Lithuanian translation. - -Austin English (3): - wine.inf: Use full path to msiexec. - hid: Add HidD_GetProductString stub. - wine.inf: Fix quoting for msiexec commands. +Andrei Slăvoiu (1): + wined3d: Replace vendor specific callbacks with generic code that uses vendor specific arrays. + +André Hentschel (36): + wpcap: Implement pcap_major_version and pcap_minor_version. + wpcap: Implement pcap_findalldevs. + wpcap: Implement pcap_freealldevs. + wpcap: Implement pcap_geterr. + wpcap: Implement pcap_open_live. + wpcap: Implement pcap_stats. + wpcap: Add stub for pcap_setbuff. + wpcap: Implement pcap_datalink. + wpcap: Implement pcap_lookupdev. + wpcap: Implement pcap_lookupnet. + wpcap: Implement pcap_compile. + wpcap: Implement pcap_setfilter. + shlwapi/tests: Fix SHFormatDateTimeW tests for right-to-left locales. + wpcap: Fix spec file to not print empty buffers. + wpcap: Trace strings when possible. + wpcap: Implement pcap_freecode. + wpcap: Implement pcap_snapshot. + wpcap: Implement pcap_dispatch. + wpcap: Implement pcap_loop. + wpcap: Implement pcap_breakloop. + wpcap: Implement pcap_datalink_val_to_name. + wpcap: Implement pcap_close. + wpcap: Implement pcap_datalink_name_to_val. + wpcap: Implement pcap_list_datalinks. + wpcap: Implement pcap_datalink_val_to_description. + wpcap: Implement pcap_set_datalink. + wpcap: Implement pcap_get_airpcap_handle. + wpcap: Implement pcap_open. + wpcap: Implement pcap_getnonblock. + wpcap: Implement pcap_next. + wpcap: Implement pcap_next_ex. + wpcap: Implement pcap_sendpacket. + wpcap: Implement pcap_setnonblock. + wpcap: Implement wsockinit. + wpcap: Implement pcap_findalldevs_ex. + wpcap: Add version resource. + +Aric Stewart (6): + dwrite: Implement Font File Loader registration. + dwrite: Initial implementation of CreateCustomFontFileReference. + dwrite: Beginning implementation of IDWriteFontFile_Analyze. + dwrite: Initial implementation of CreateFontFace. + dwrite: Implement TryGetFontTable and ReleaseFontTable. + dwrite/tests: Add a font resource and use it for tests. Bernhard Reiter (1): - imagehlp/tests: Add test for BindImageEx. + imagehlp/tests: Add test for BindImageEx with NULL as StatusRoutine. -Bruno Jesus (11): - rsaenh: Detect AES prototype provider correctly. - dmime/tests: Fix a crash in Windows 2000. - winhttp/tests: Add a no-content header test. - rsaenh/tests: Run the tests in the Base and Strong providers too. - rsaenh: Use a helper to get the key container. - rsaenh: The RC2 algorithm from Base provider supports only 40 bit keys. - rsaenh/tests: Add SHA-256 tests. - rsaenh/tests: Update some tests. - rsaenh: Handle the failure to set Base provider effective key length properly. - rsaenh: Use the remaining hash data as salt if requested. - rsaenh: A 40 bit key on Enhanced provider will not have salt even if asked for. - -David Hedberg (8): - shell32/tests: Tests for IShellItemGetAttributes. - shell32: Mask out attributes we didn't ask for in ShellItem::GetAttributes. - shell32: Return S_OK only if the flags matches the result exactly. - shell32: Always initialize shellitem to NULL in SHCreateShellItem. - shell32: Implement SHCreateShellItemFromIDLists. - shell32: Implement IShellItemArray::GetAttributes. - comdlg32: Support browsing for folders. - shell32: Implement IEnumShellItems for IShellItemArray. - -Erich Hoover (6): - strmbase: Fix race condition on InputPin_BeginFlush between csRenderLock and filter.csFilter. - strmbase: Fix race condition on InputPin_EndFlush between csRenderLock and filter.csFilter. - strmbase: Fix race condition on InputPin_EndOfStream between csRenderLock and filter.csFilter. - quartz: Fix race condition on EndOfStream between csRenderLock and filter.csFilter. - quartz: Fix race condition on EndFlush between csRenderLock and filter.csFilter. - quartz: Fix race condition between EndOfStream and Pause. - -Gerald Pfeifer (4): - winebuild: Remove unused empty_name_table. - winhttp: Remove unused constant proxymsg. - dbghelp: Do not try to ignore the return codes in PEV_ERROR and and PEV_ERROR1. - scrrun: Add a check for empty string in start_enumeration. - -Hao Peng (3): - iphlpapi: Add PfBindInterfaceToIPAddress function stub. - iphlpapi: Add PfDeleteInterface function stub. - iphlpapi: Add PfUnBindInterface function stub. - -Henri Verbeet (5): - wined3d: Add constant buffer support to the GLSL shader backend. - d3d10core: Implement d3d10_device_CopyResource(). - wined3d: Make the "desc" parameter to wined3d_buffer_create() const. - wined3d: Get rid of the get_drawable_size() callback in struct wined3d_surface. - wined3d: Move the "draw_binding" field from struct wined3d_surface to struct wined3d_resource. - -Indrek Altpere (1): - wbemprox: Fix a few OLE variant mappings. - -Jacek Caban (2): - mshtml: Added IHTMLWindow2::navigate implementation. - mshtml: Added IHTMLElement:scrollIntoView implementation. +Erich Hoover (3): + ddraw/tests: Remove broken tests of D3DTRANSFORM_UNCLIPPED. + ddraw: Return empty D3D hardware flags for RGB device enumeration. + dwmapi: Add stub for DwmInvalidateIconicBitmaps. + +François Gouget (3): + rsaenh/tests: Add a trailing '\n' to some ok() calls. + shell32/tests: Add a trailing '\n' to a couple of win_skip() calls. + shell32: Add a trailing '\n' to a FIXME(). + +Frédéric Delanoy (1): + po: Update French translation. + +Gerald Pfeifer (8): + xmllite: Remove unused function reader_get_len. + gdi32: Remove unused constant bit_fields_565. + winedbg: Add explicit return in the error case of print_typed_basic. + cmd: Remove fslashW. + uninstaller: Remove BackSlashW. + winex11.drv: Remove colour_is_brighter. + winex11.drv: Remove wxr_color_shifts. + ws2_32: Define fill_control_message only when it's really used. + +Henri Verbeet (30): + d3d8: Return E_OUTOFMEMORY on HeapAlloc() failure in device_parent_surface_created(). + d3d9: Return E_OUTOFMEMORY on HeapAlloc() failure in device_parent_surface_created(). + d3d8: Volumes are always part of a texture. + d3d9: Volumes are always part of a texture. + d3d8: The "forwardReference" field in struct d3d8_surface is always a texture, if set. + d3d9: The "forwardReference" field in struct d3d9_surface is always a texture, if set. + ddraw: Clamp video memory to UINT_MAX in ddraw7_GetAvailableVidMem(). + d3d8: wined3d_device_get_available_texture_mem() returns a UINT. + d3d9: wined3d_device_get_available_texture_mem() returns a UINT. + wined3d: Store the amount of video memory as a UINT64. + wined3d: Recognize some more AMD cards. + wined3d: Explicitly destroy the volume in texture3d_sub_resource_cleanup(). + wined3d: Explicitly destroy the surface in texture2d_sub_resource_cleanup(). + wined3d: Move the "map_binding" field from struct wined3d_surface to struct wined3d_resource. + wined3d: Replace surface_is_offscreen() with wined3d_resource_is_offscreen(). + wined3d: Replace surface_update_draw_binding() with wined3d_resource_update_draw_binding(). + wined3d: Move the "swapchain" field from struct wined3d_surface to struct wined3d_texture. + wined3d: Use the texture draw binding instead of the surface draw binding. + wined3d: Keep a reference to the frontbuffer texture instead of the surface in the swapchain. + wined3d: Keep a reference to the backbuffer textures instead of the surfaces in the swapchain. + wined3d: Pass a texture instead of a surface to upload_palette(). + wined3d: Keep a reference to the resource in rendertarget views. + wined3d: Introduce struct wined3d_rendertarget_view_desc. + wined3d: Make wined3d_device_clear_rendertarget_view() work with texture resources. + wined3d: Use rendertarget views for color output instead of surfaces. + wined3d: Also update the container in wined3d_surface_update_desc(). + wined3d: Use rendertarget views for depth/stencil buffers instead of surfaces. + wined3d: Get rid of wined3d_device_color_fill(). + d3d10core: Implement d3d10_device_OMSetRenderTargets(). + d3d10core: Implement d3d10_device_OMGetRenderTargets(). + +Jacek Caban (7): + d3d10_1.idl: Added some missing constants. + d3d11.idl: Added some missing declarations. + mshtml: Fixed handling NULL argument in IHTMLElement::contains implementation. + d3d10_1.idl: Added _D3D10_1_CONSTANTS guard. + mshtml: Override default onsubmit action with our submit implementation. + mshtml: Added IHTMLDocument5::get_implementation implementation. + mshtml: Added IHTMLLinkElement::rev property implementation. Jactry Zeng (1): - include: Fix wrong type in tom.idl. + riched20: Pass count of character into ME_WordBreakProc() instead of count of byte. -Ken Thomases (3): - ntdll: In find_file_in_dir(), don't test directory entries' short names if the target name isn't a short name. - winemac: Use new API when available to list all display modes available on Retina Macs. - winemac: When removing the status item for a systray icon, discard any associated events in the queue. - -Michael Müller (2): - shell32: Create profile directories available in Vista and above. - windowscodecs: Fix number of returned properties in PropertyBag_GetPropertyInfo. - -Nikolay Sivov (8): - dwrite: Added some layout tests, simplify debug output for text ranges. - dwrite: Store maximum width/height for text layout. - dwrite/tests: Added some tests for inline object and ranges handling. - msxml3/saxreader: Fix attributes array growing size. - include: Added IDWriteLocalFontFileLoader. - dwrite: Implement Resize() for bitmap render target. - dwrite: Added GetCurrentTransform() for a render target. - dwrite/tests: Some tests for drawing sequence for a layout. - -Piotr Caban (8): - msvcp100: Add ios_base::swap implementation. - msvcp100: Add basic_ios::swap implementation. - msvcp100: Add basic_istream::swap implementation. - msvcp100: Add basic_ostream::swap implementaiton. - msvcp100: Add basic_iostream::swap implementation. - msvcp100: Add basic_streambuf::swap implementation. - msvcrt: Only check for flag presence in isatty function. - msvcp110: Add _Xbad_alloc implementation. - -Shuai Meng (4): - vbscript: Implemented ScriptEngine. - vbscript: Inplemented ScriptEngineBuildVersion. - vbscript: Implemented ScriptEngineMajorVersion. - vbscript: Implemented ScriptEngineMinorVersion. - -Stefan Dösinger (1): - user32: Make GetRegisteredRawInputDevices hotpatchable. - -Thomas Faber (10): - amstream: Destroy BaseFilter after MediaStreamFilterImpl child class. - quartz: Avoid side-effects in asserts. - quartz/tests: Fix memory leaks. - dsound: Do not call CoUninitialize if CoInitialize failed. - qcap: Reference module only on successful object creation. - strmbase: Separate BasePin destructors from Release. - qcap: Destroy BaseOutputPin in VfwPin_Release. - quartz: Destroy BaseOutputPin in FileAsyncReaderPin_Release. - quartz: Fix IEnumFiltersImpl memory leak. - quartz: Destroy BaseRenderer in NullRendererInner_Release. - -Zhenbo Li (2): - mshtml/tests: Better output when an exception is caught. - mshtml: Added IHTMLStyle:: textTransform property implementation. +Julian Rüger (1): + po: Update German translation. + +Ken Thomases (1): + loader: Set LSUIElement to 1 in the embedded Mac Info.plist. + +Lauri Kenttä (1): + po: Update Finnish translation. + +Marcus Meissner (1): + dwrite: Fixed paste error (Coverity). + +Nikolay Sivov (16): + dwrite: Implement support for inline object and font weight attributes of a range. + dwrite: Support for attributes for a range. + comctl32/pager: Reduce pointer scope so it doesn't point to inner scope vars (PVS-Studio). + secur32/tests: Remove duplicated expression (PVS-Studio). + odbccp32/tests: Remove test of always true conditions (PVS-Studio). + mshtml: Free buffer for empty strings too (PVS-Studio). + urlmon: Remove duplicated check (PVS-Studio). + oleaut32: Remove duplicated expression (PVS-Studio). + oleaut32/tests: Remove redundant assignment (PVS-Studio). + oleaut32/tests: Remove redundant assignment (PVS-Studio). + oleaut32/tests: Remove duplicate code blocks (PVS-Studio). + winhttp: Fix return code check (PVS-Studio). + dwrite: Implement ranges merging. + dwrite: Implement layout getters derived from text format. + dwrite: Use layout pointer as an argument instead of neutral list. + wrc: Remove some always-true conditions (PVS-Studio). + +Piotr Caban (1): + oleaut32: Add support for VAR_TIMEVALUEONLY and VAR_DATEVALUEONLY flags in VarDateFromUdateEx. + +Sebastian Lackner (7): + server: Store pipe_flags in a separate variable for both server and client of named pipes. + server: Implement set_named_pipe_info wineserver call for NtSetInformationFile/FilePipeInformation. + ntdll/tests: Add tests for FILE_PIPE_INFORMATION. + kernel32: Implement GetNamedPipeHandleState. + kernel32: Implement SetNamedPipeHandleState. + kernel32/tests: Add better handling for test failure in test_readfileex_pending. + kernel32/tests: Always allow only one correct test result, add todo_wine where necessary. + +Shuai Meng (9): + vbscript: Implemented Fix. + vbscript: Implemented Int. + vbscript: Implemented Sqr. + vbscript: Implemented Cos. + vbscript: Implemented Sin. + vbscript: Implemented Tan. + vbscript: Implemented Atn. + vbscript: Implemented Exp. + vbscript: Implemented Log. + +Stefan Dösinger (2): + ddraw: Clear application-passed lpSurface pointers. + ddraw: Do not set lpSurface in GetSurfaceDesc. + +Thomas Faber (2): + rpcrt4: Correctly check for in-buffer memory in PointerFree. + advapi32/tests: Fix a buffer overflow when calling GetEventLogInformation. + +Vincent Povirk (5): + mscoree: Implement corruntimehost_Start. + mscoree: Implement corruntimehost_CreateDomainSetup. + mscoree: Factor out common code for calling .NET methods. + wbemprox: Implement __SystemSecurity::GetSD. + wbemprox: Stub __SystemSecurity::SetSD. + +Zhenbo Li (15): + mshtml: Added IHTMLStyle::textIndent property implementation. + mshtml: Added IHTMLStyleElement::lineHeight property. + mshtml: Added IHTMLStyle::listStylePosition property implementation. + mshtml/tests: Fix test_tr_modify(). + mshtml: Added IHTMLTable::insertRow/deleteRow methods implementation. + mshtml: Added IHTMLTable::frame property implementation. + mshtml: Added IHTMLTableCell::align property implementation. + mshtml: Added IHTMLImgElement::isMap property implementation. + mshtml: Added IHTMLInputElement::size property implementation. + mshtml: Added IHTMLImgElement::align property implementation. + mshtml: Added IHTMLInputElement::readOnly property. + mshtml: Added IHTMLInputElement_get_form method implementation. + mshtml: Added IHTMLStyle2::tableLayout property implementation. + mshtml: Added IHTMLStyle::backgroundAttachment property implementation. + mshtml: Added IHTMLStyle::listStyle property implementation. -- Alexandre Julliard diff -Nru wine1.7-1.7.24/configure wine1.7-1.7.25/configure --- wine1.7-1.7.24/configure 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/configure 2014-08-22 18:39:55.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for Wine 1.7.24. +# Generated by GNU Autoconf 2.69 for Wine 1.7.25. # # Report bugs to . # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Wine' PACKAGE_TARNAME='wine' -PACKAGE_VERSION='1.7.24' -PACKAGE_STRING='Wine 1.7.24' +PACKAGE_VERSION='1.7.25' +PACKAGE_STRING='Wine 1.7.25' PACKAGE_BUGREPORT='wine-devel@winehq.org' PACKAGE_URL='http://www.winehq.org' @@ -1979,7 +1979,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 1.7.24 to adapt to many kinds of systems. +\`configure' configures Wine 1.7.25 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2048,7 +2048,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Wine 1.7.24:";; + short | recursive ) echo "Configuration of Wine 1.7.25:";; esac cat <<\_ACEOF @@ -2244,7 +2244,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Wine configure 1.7.24 +Wine configure 1.7.25 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2762,7 +2762,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 1.7.24, which was +It was created by Wine $as_me 1.7.25, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -18172,7 +18172,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Wine $as_me 1.7.24, which was +This file was extended by Wine $as_me 1.7.25, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18243,7 +18243,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Wine config.status 1.7.24 +Wine config.status 1.7.25 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru wine1.7-1.7.24/debian/applications/wine-notepad.desktop wine1.7-1.7.25/debian/applications/wine-notepad.desktop --- wine1.7-1.7.24/debian/applications/wine-notepad.desktop 2012-01-17 17:00:33.000000000 +0000 +++ wine1.7-1.7.25/debian/applications/wine-notepad.desktop 2014-08-27 03:29:16.000000000 +0000 @@ -32,3 +32,4 @@ Type=Application Icon=wine-notepad Categories=Wine-Programs-Accessories; +StartupWMClass=notepad.exe diff -Nru wine1.7-1.7.24/debian/applications/wine-uninstaller.desktop wine1.7-1.7.25/debian/applications/wine-uninstaller.desktop --- wine1.7-1.7.24/debian/applications/wine-uninstaller.desktop 2012-01-17 17:00:33.000000000 +0000 +++ wine1.7-1.7.25/debian/applications/wine-uninstaller.desktop 2014-08-27 03:29:36.000000000 +0000 @@ -38,3 +38,4 @@ Type=Application Icon=wine-uninstaller Categories=Wine; +StartupWMClass=wine-uninstaller.exe diff -Nru wine1.7-1.7.24/debian/applications/wine-winecfg.desktop wine1.7-1.7.25/debian/applications/wine-winecfg.desktop --- wine1.7-1.7.24/debian/applications/wine-winecfg.desktop 2012-01-17 17:00:33.000000000 +0000 +++ wine1.7-1.7.25/debian/applications/wine-winecfg.desktop 2014-08-27 03:29:07.000000000 +0000 @@ -38,3 +38,4 @@ Icon=wine-winecfg Type=Application Categories=Wine; +StartupWMClass=winecfg.exe diff -Nru wine1.7-1.7.24/debian/changelog wine1.7-1.7.25/debian/changelog --- wine1.7-1.7.24/debian/changelog 2014-08-16 21:40:29.000000000 +0000 +++ wine1.7-1.7.25/debian/changelog 2014-08-27 03:28:24.000000000 +0000 @@ -1,3 +1,40 @@ +wine1.7 (1:1.7.25-0ubuntu1~ppa4) trusty; urgency=medium + + * Add StartupWMClass=foo.exe to .desktop files + - Encourages desktop to use the icon it has rather than the icon + Wine returns, which is sometimes a blurry non svg version + + -- Scott Ritchie Tue, 26 Aug 2014 20:25:42 -0700 + +wine1.7 (1:1.7.25-0ubuntu1~ppa3) trusty; urgency=medium + + * Demote libpcap0.8 to a recommends + - debian/rules: exclude wpcap.dll.so from parsing by dh_shlibdeps + - debian/control: explicitly add libpcap0.8 to recommends + + -- Scott Ritchie Tue, 26 Aug 2014 15:03:38 -0700 + +wine1.7 (1:1.7.25-0ubuntu1~ppa2) trusty; urgency=medium + + * Add libpcap0.8-dev to build-depends + - Should generate libpcap0.8 as depends on all arches + - Actual use of libpcap will still require setcap on wine-preloader binary + + -- Scott Ritchie Tue, 26 Aug 2014 12:01:43 -0700 + +wine1.7 (1:1.7.25-0ubuntu1~ppa1) trusty; urgency=medium + + * New upstream release + - Implementation of the packet capture library. + - A few more DirectWrite functions. + - Improvements in HTML table support. + - More VBScript math functions. + - Various bug fixes. + * Import patch from Michael Müller to smooth (LP: #1103833) + - Possible to be replaced by later patches + + -- Scott Ritchie Mon, 25 Aug 2014 12:38:41 -0700 + wine1.7 (1:1.7.24-0ubuntu1~ppa1) trusty; urgency=medium * New upstream release diff -Nru wine1.7-1.7.24/debian/control wine1.7-1.7.25/debian/control --- wine1.7-1.7.24/debian/control 2014-07-07 20:35:54.000000000 +0000 +++ wine1.7-1.7.25/debian/control 2014-08-26 22:04:52.000000000 +0000 @@ -33,6 +33,7 @@ libncurses5-dev | libncurses-dev, libopenal-dev, libosmesa6-dev, + libpcap0.8-dev, libpng12-dev, libpulse-dev, libsane-dev, @@ -78,6 +79,7 @@ libgnutls26, libjpeg8, libosmesa6, + libpcap0.8, libpng12-0, libpulse0, libsane, @@ -129,6 +131,7 @@ libgnutls26, libjpeg8, libosmesa6, + libpcap0.8, libpng12-0, libpulse0, libsane, diff -Nru wine1.7-1.7.24/debian/patches/0001-winex11-Prevent-window-managers-from-grouping-all-wi.patch wine1.7-1.7.25/debian/patches/0001-winex11-Prevent-window-managers-from-grouping-all-wi.patch --- wine1.7-1.7.24/debian/patches/0001-winex11-Prevent-window-managers-from-grouping-all-wi.patch 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.25/debian/patches/0001-winex11-Prevent-window-managers-from-grouping-all-wi.patch 2014-08-25 19:39:37.000000000 +0000 @@ -0,0 +1,29 @@ +From 55d50964170f5fd8cf75b5e4e7ca109a60875980 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 16 Aug 2014 01:17:27 +0200 +Subject: winex11: Prevent window managers from grouping all wine programs + together. + +--- + dlls/winex11.drv/window.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c +index 06e2294..e715642 100644 +--- a/dlls/winex11.drv/window.c ++++ b/dlls/winex11.drv/window.c +@@ -842,10 +842,8 @@ static void set_initial_wm_hints( Display *display, Window window ) + /* class hints */ + if ((class_hints = XAllocClassHint())) + { +- static char wine[] = "Wine"; +- + class_hints->res_name = process_name; +- class_hints->res_class = wine; ++ class_hints->res_class = process_name; + XSetClassHint( display, window, class_hints ); + XFree( class_hints ); + } +-- +1.9.1 + diff -Nru wine1.7-1.7.24/debian/patches/series wine1.7-1.7.25/debian/patches/series --- wine1.7-1.7.24/debian/patches/series 2014-07-14 08:03:17.000000000 +0000 +++ wine1.7-1.7.25/debian/patches/series 2014-08-25 19:39:37.000000000 +0000 @@ -41,3 +41,4 @@ 0040-Revert-winmm-Increase-mmdevapi-buffer-sizes.patch 0041-dsound-fixup-IDirectSoundCaptureBuffer_QueryInterfac.patch 0042-winepulse-handle-stream-create-failing-correctly.patch +0001-winex11-Prevent-window-managers-from-grouping-all-wi.patch diff -Nru wine1.7-1.7.24/debian/rules wine1.7-1.7.25/debian/rules --- wine1.7-1.7.24/debian/rules 2013-09-04 20:09:28.000000000 +0000 +++ wine1.7-1.7.25/debian/rules 2014-08-26 22:09:35.000000000 +0000 @@ -27,3 +27,6 @@ override_dh_strip: dh_strip -Xwine-pthread -Xwine-kthread --dbg-package=wine1.7-dbg +override_dh_shlibdeps: + dh_shlibdeps -Xwpcap.dll.so + diff -Nru wine1.7-1.7.24/dlls/advapi32/tests/eventlog.c wine1.7-1.7.25/dlls/advapi32/tests/eventlog.c --- wine1.7-1.7.24/dlls/advapi32/tests/eventlog.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/advapi32/tests/eventlog.c 2014-08-22 18:39:55.000000000 +0000 @@ -130,7 +130,8 @@ HANDLE handle; BOOL ret; DWORD needed; - EVENTLOG_FULL_INFORMATION efi; + BYTE buffer[2 * sizeof(EVENTLOG_FULL_INFORMATION)]; + EVENTLOG_FULL_INFORMATION *efi = (void *)buffer; if (!pGetEventLogInformation) { @@ -161,26 +162,26 @@ ok(GetLastError() == RPC_X_NULL_REF_POINTER, "Expected RPC_X_NULL_REF_POINTER, got %d\n", GetLastError()); SetLastError(0xdeadbeef); - ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, (LPVOID)&efi, 0, NULL); + ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, efi, 0, NULL); ok(!ret, "Expected failure\n"); ok(GetLastError() == RPC_X_NULL_REF_POINTER, "Expected RPC_X_NULL_REF_POINTER, got %d\n", GetLastError()); SetLastError(0xdeadbeef); needed = 0xdeadbeef; - efi.dwFull = 0xdeadbeef; - ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, (LPVOID)&efi, 0, &needed); + efi->dwFull = 0xdeadbeef; + ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, efi, 0, &needed); ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); ok(needed == sizeof(EVENTLOG_FULL_INFORMATION), "Expected sizeof(EVENTLOG_FULL_INFORMATION), got %d\n", needed); - ok(efi.dwFull == 0xdeadbeef, "Expected no change to the dwFull member\n"); + ok(efi->dwFull == 0xdeadbeef, "Expected no change to the dwFull member\n"); /* Not that we care, but on success last error is set to ERROR_IO_PENDING */ - efi.dwFull = 0xdeadbeef; - needed *= 2; - ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, (LPVOID)&efi, needed, &needed); + efi->dwFull = 0xdeadbeef; + needed = sizeof(buffer); + ret = pGetEventLogInformation(handle, EVENTLOG_FULL_INFO, efi, needed, &needed); ok(ret, "Expected success\n"); ok(needed == sizeof(EVENTLOG_FULL_INFORMATION), "Expected sizeof(EVENTLOG_FULL_INFORMATION), got %d\n", needed); - ok(efi.dwFull == 0 || efi.dwFull == 1, "Expected 0 (not full) or 1 (full), got %d\n", efi.dwFull); + ok(efi->dwFull == 0 || efi->dwFull == 1, "Expected 0 (not full) or 1 (full), got %d\n", efi->dwFull); CloseEventLog(handle); } diff -Nru wine1.7-1.7.24/dlls/comctl32/pager.c wine1.7-1.7.25/dlls/comctl32/pager.c --- wine1.7-1.7.24/dlls/comctl32/pager.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/comctl32/pager.c 2014-08-22 18:39:55.000000000 +0000 @@ -753,7 +753,7 @@ PAGER_MouseMove (PAGER_INFO* infoPtr, INT keys, INT x, INT y) { POINT clpt, pt; - RECT wnrect, *btnrect = NULL; + RECT wnrect; BOOL topLeft = FALSE; INT btnstate = 0; INT hit; @@ -766,8 +766,9 @@ ClientToScreen(infoPtr->hwndSelf, &pt); GetWindowRect(infoPtr->hwndSelf, &wnrect); if (PtInRect(&wnrect, pt)) { - RECT TLbtnrect, BRbtnrect; - PAGER_GetButtonRects(infoPtr, &TLbtnrect, &BRbtnrect, FALSE); + RECT topleft, bottomright, *rect = NULL; + + PAGER_GetButtonRects(infoPtr, &topleft, &bottomright, FALSE); clpt = pt; MapWindowPoints(0, infoPtr->hwndSelf, &clpt, 1); @@ -775,23 +776,23 @@ if ((hit == PGB_TOPORLEFT) && (infoPtr->TLbtnState == PGF_NORMAL)) { topLeft = TRUE; - btnrect = &TLbtnrect; + rect = &topleft; infoPtr->TLbtnState = PGF_HOT; btnstate = infoPtr->TLbtnState; } else if ((hit == PGB_BOTTOMORRIGHT) && (infoPtr->BRbtnState == PGF_NORMAL)) { topLeft = FALSE; - btnrect = &BRbtnrect; + rect = &bottomright; infoPtr->BRbtnState = PGF_HOT; btnstate = infoPtr->BRbtnState; } /* If in one of the buttons the capture and draw buttons */ - if (btnrect) + if (rect) { TRACE("[%p] draw btn (%s), Capture %s, style %08x\n", - infoPtr->hwndSelf, wine_dbgstr_rect(btnrect), + infoPtr->hwndSelf, wine_dbgstr_rect(rect), (infoPtr->bCapture) ? "TRUE" : "FALSE", infoPtr->dwStyle); if (!infoPtr->bCapture) @@ -804,7 +805,7 @@ SetTimer(infoPtr->hwndSelf, TIMERID1, 0x3e, 0); hdc = GetWindowDC(infoPtr->hwndSelf); /* OffsetRect(wnrect, 0 | 1, 0 | 1) */ - PAGER_DrawButton(hdc, infoPtr->clrBk, *btnrect, + PAGER_DrawButton(hdc, infoPtr->clrBk, *rect, infoPtr->dwStyle & PGS_HORZ, topLeft, btnstate); ReleaseDC(infoPtr->hwndSelf, hdc); return 0; diff -Nru wine1.7-1.7.24/dlls/d3d10core/d3d10core_private.h wine1.7-1.7.25/dlls/d3d10core/d3d10core_private.h --- wine1.7-1.7.24/dlls/d3d10core/d3d10core_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d10core/d3d10core_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -53,6 +53,8 @@ struct wined3d_shader_signature *output_signature; }; +extern const struct wined3d_parent_ops d3d10_null_wined3d_parent_ops DECLSPEC_HIDDEN; + /* TRACE helper functions */ const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology) DECLSPEC_HIDDEN; const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN; @@ -123,6 +125,7 @@ ID3D10DepthStencilView ID3D10DepthStencilView_iface; LONG refcount; + struct wined3d_rendertarget_view *wined3d_view; D3D10_DEPTH_STENCIL_VIEW_DESC desc; ID3D10Resource *resource; ID3D10Device1 *device; @@ -130,6 +133,7 @@ HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view, struct d3d10_device *device, ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc) DECLSPEC_HIDDEN; +struct d3d10_depthstencil_view *unsafe_impl_from_ID3D10DepthStencilView(ID3D10DepthStencilView *iface) DECLSPEC_HIDDEN; /* ID3D10RenderTargetView */ struct d3d10_rendertarget_view diff -Nru wine1.7-1.7.24/dlls/d3d10core/device.c wine1.7-1.7.25/dlls/d3d10core/device.c --- wine1.7-1.7.24/dlls/d3d10core/device.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d10core/device.c 2014-08-22 18:39:55.000000000 +0000 @@ -395,8 +395,28 @@ UINT render_target_view_count, ID3D10RenderTargetView *const *render_target_views, ID3D10DepthStencilView *depth_stencil_view) { - FIXME("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p\n", + struct d3d10_device *device = impl_from_ID3D10Device(iface); + struct d3d10_depthstencil_view *dsv; + unsigned int i; + + TRACE("iface %p, render_target_view_count %u, render_target_views %p, depth_stencil_view %p.\n", iface, render_target_view_count, render_target_views, depth_stencil_view); + + for (i = 0; i < render_target_view_count; ++i) + { + struct d3d10_rendertarget_view *rtv = unsafe_impl_from_ID3D10RenderTargetView(render_target_views[i]); + + wined3d_device_set_rendertarget_view(device->wined3d_device, i, + rtv ? rtv->wined3d_view : NULL, FALSE); + } + for (; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + wined3d_device_set_rendertarget_view(device->wined3d_device, i, NULL, FALSE); + } + + dsv = unsafe_impl_from_ID3D10DepthStencilView(depth_stencil_view); + wined3d_device_set_depth_stencil_view(device->wined3d_device, + dsv ? dsv->wined3d_view : NULL); } static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device1 *iface, @@ -535,14 +555,16 @@ static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device1 *iface, ID3D10RenderTargetView *render_target_view, const FLOAT color_rgba[4]) { - struct d3d10_device *This = impl_from_ID3D10Device(iface); + struct d3d10_device *device = impl_from_ID3D10Device(iface); struct d3d10_rendertarget_view *view = unsafe_impl_from_ID3D10RenderTargetView(render_target_view); const struct wined3d_color color = {color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]}; + HRESULT hr; - TRACE("iface %p, render_target_view %p, color_rgba [%f %f %f %f]\n", + TRACE("iface %p, render_target_view %p, color_rgba {%.8e, %.8e, %.8e, %.8e}.\n", iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]); - wined3d_device_clear_rendertarget_view(This->wined3d_device, view->wined3d_view, &color); + if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, &color))) + ERR("Failed to clear view, hr %#x.\n", hr); } static void STDMETHODCALLTYPE d3d10_device_ClearDepthStencilView(ID3D10Device1 *iface, @@ -894,8 +916,46 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetRenderTargets(ID3D10Device1 *iface, UINT view_count, ID3D10RenderTargetView **render_target_views, ID3D10DepthStencilView **depth_stencil_view) { - FIXME("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p stub!\n", + struct d3d10_device *device = impl_from_ID3D10Device(iface); + struct wined3d_rendertarget_view *wined3d_view; + + TRACE("iface %p, view_count %u, render_target_views %p, depth_stencil_view %p.\n", iface, view_count, render_target_views, depth_stencil_view); + + if (render_target_views) + { + struct d3d10_rendertarget_view *view_impl; + unsigned int i; + + for (i = 0; i < view_count; ++i) + { + if (!(wined3d_view = wined3d_device_get_rendertarget_view(device->wined3d_device, i))) + { + render_target_views[i] = NULL; + continue; + } + + view_impl = wined3d_rendertarget_view_get_parent(wined3d_view); + render_target_views[i] = &view_impl->ID3D10RenderTargetView_iface; + ID3D10RenderTargetView_AddRef(render_target_views[i]); + } + } + + if (depth_stencil_view) + { + struct d3d10_depthstencil_view *view_impl; + + if (!(wined3d_view = wined3d_device_get_depth_stencil_view(device->wined3d_device))) + { + *depth_stencil_view = NULL; + } + else + { + view_impl = wined3d_rendertarget_view_get_parent(wined3d_view); + *depth_stencil_view = &view_impl->ID3D10DepthStencilView_iface; + ID3D10DepthStencilView_AddRef(*depth_stencil_view); + } + } } static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device1 *iface, diff -Nru wine1.7-1.7.24/dlls/d3d10core/view.c wine1.7-1.7.25/dlls/d3d10core/view.c --- wine1.7-1.7.24/dlls/d3d10core/view.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d10core/view.c 2014-08-22 18:39:55.000000000 +0000 @@ -404,6 +404,7 @@ if (!refcount) { + wined3d_rendertarget_view_decref(This->wined3d_view); ID3D10Resource_Release(This->resource); ID3D10Device1_Release(This->device); HeapFree(GetProcessHeap(), 0, This); @@ -492,9 +493,63 @@ d3d10_depthstencil_view_GetDesc, }; +static void wined3d_depth_stencil_view_desc_from_d3d10core(struct wined3d_rendertarget_view_desc *wined3d_desc, + const D3D10_DEPTH_STENCIL_VIEW_DESC *desc) +{ + wined3d_desc->format_id = wined3dformat_from_dxgi_format(desc->Format); + + switch (desc->ViewDimension) + { + case D3D10_DSV_DIMENSION_TEXTURE1D: + wined3d_desc->u.texture.level_idx = desc->u.Texture1D.MipSlice; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + + case D3D10_DSV_DIMENSION_TEXTURE1DARRAY: + wined3d_desc->u.texture.level_idx = desc->u.Texture1DArray.MipSlice; + wined3d_desc->u.texture.layer_idx = desc->u.Texture1DArray.FirstArraySlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture1DArray.ArraySize; + break; + + case D3D10_DSV_DIMENSION_TEXTURE2D: + wined3d_desc->u.texture.level_idx = desc->u.Texture2D.MipSlice; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + + case D3D10_DSV_DIMENSION_TEXTURE2DARRAY: + wined3d_desc->u.texture.level_idx = desc->u.Texture2DArray.MipSlice; + wined3d_desc->u.texture.layer_idx = desc->u.Texture2DArray.FirstArraySlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture2DArray.ArraySize; + break; + + case D3D10_DSV_DIMENSION_TEXTURE2DMS: + wined3d_desc->u.texture.level_idx = 0; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + + case D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY: + wined3d_desc->u.texture.level_idx = 0; + wined3d_desc->u.texture.layer_idx = desc->u.Texture2DMSArray.FirstArraySlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture2DMSArray.ArraySize; + break; + + default: + FIXME("Unhandled view dimension %#x.\n", desc->ViewDimension); + wined3d_desc->u.texture.level_idx = 0; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + } +} + HRESULT d3d10_depthstencil_view_init(struct d3d10_depthstencil_view *view, struct d3d10_device *device, ID3D10Resource *resource, const D3D10_DEPTH_STENCIL_VIEW_DESC *desc) { + struct wined3d_rendertarget_view_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; HRESULT hr; view->ID3D10DepthStencilView_iface.lpVtbl = &d3d10_depthstencil_view_vtbl; @@ -510,6 +565,20 @@ view->desc = *desc; } + if (!(wined3d_resource = wined3d_resource_from_resource(resource))) + { + ERR("Failed to get wined3d resource for d3d10 resource %p.\n", resource); + return E_FAIL; + } + + wined3d_depth_stencil_view_desc_from_d3d10core(&wined3d_desc, &view->desc); + if (FAILED(hr = wined3d_rendertarget_view_create(&wined3d_desc, wined3d_resource, + view, &d3d10_null_wined3d_parent_ops, &view->wined3d_view))) + { + WARN("Failed to create a wined3d rendertarget view, hr %#x.\n", hr); + return hr; + } + view->resource = resource; ID3D10Resource_AddRef(resource); view->device = &device->ID3D10Device1_iface; @@ -518,6 +587,15 @@ return S_OK; } +struct d3d10_depthstencil_view *unsafe_impl_from_ID3D10DepthStencilView(ID3D10DepthStencilView *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == &d3d10_depthstencil_view_vtbl); + + return impl_from_ID3D10DepthStencilView(iface); +} + static inline struct d3d10_rendertarget_view *impl_from_ID3D10RenderTargetView(ID3D10RenderTargetView *iface) { return CONTAINING_RECORD(iface, struct d3d10_rendertarget_view, ID3D10RenderTargetView_iface); @@ -654,9 +732,73 @@ d3d10_rendertarget_view_GetDesc, }; +static void wined3d_rendertarget_view_desc_from_d3d10core(struct wined3d_rendertarget_view_desc *wined3d_desc, + const D3D10_RENDER_TARGET_VIEW_DESC *desc) +{ + wined3d_desc->format_id = wined3dformat_from_dxgi_format(desc->Format); + + switch (desc->ViewDimension) + { + case D3D10_RTV_DIMENSION_BUFFER: + wined3d_desc->u.buffer.start_idx = desc->u.Buffer.ElementOffset; + wined3d_desc->u.buffer.count = desc->u.Buffer.ElementWidth; + break; + + case D3D10_RTV_DIMENSION_TEXTURE1D: + wined3d_desc->u.texture.level_idx = desc->u.Texture1D.MipSlice; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + + case D3D10_RTV_DIMENSION_TEXTURE1DARRAY: + wined3d_desc->u.texture.level_idx = desc->u.Texture1DArray.MipSlice; + wined3d_desc->u.texture.layer_idx = desc->u.Texture1DArray.FirstArraySlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture1DArray.ArraySize; + break; + + case D3D10_RTV_DIMENSION_TEXTURE2D: + wined3d_desc->u.texture.level_idx = desc->u.Texture2D.MipSlice; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + + case D3D10_RTV_DIMENSION_TEXTURE2DARRAY: + wined3d_desc->u.texture.level_idx = desc->u.Texture2DArray.MipSlice; + wined3d_desc->u.texture.layer_idx = desc->u.Texture2DArray.FirstArraySlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture2DArray.ArraySize; + break; + + case D3D10_RTV_DIMENSION_TEXTURE2DMS: + wined3d_desc->u.texture.level_idx = 0; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + + case D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY: + wined3d_desc->u.texture.level_idx = 0; + wined3d_desc->u.texture.layer_idx = desc->u.Texture2DMSArray.FirstArraySlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture2DMSArray.ArraySize; + break; + + case D3D10_RTV_DIMENSION_TEXTURE3D: + wined3d_desc->u.texture.level_idx = desc->u.Texture3D.MipSlice; + wined3d_desc->u.texture.layer_idx = desc->u.Texture3D.FirstWSlice; + wined3d_desc->u.texture.layer_count = desc->u.Texture3D.WSize; + break; + + default: + FIXME("Unhandled view dimension %#x.\n", desc->ViewDimension); + wined3d_desc->u.texture.level_idx = 0; + wined3d_desc->u.texture.layer_idx = 0; + wined3d_desc->u.texture.layer_count = 1; + break; + } +} + HRESULT d3d10_rendertarget_view_init(struct d3d10_rendertarget_view *view, struct d3d10_device *device, ID3D10Resource *resource, const D3D10_RENDER_TARGET_VIEW_DESC *desc) { + struct wined3d_rendertarget_view_desc wined3d_desc; struct wined3d_resource *wined3d_resource; HRESULT hr; @@ -680,8 +822,9 @@ return E_FAIL; } - hr = wined3d_rendertarget_view_create(wined3d_resource, view, &view->wined3d_view); - if (FAILED(hr)) + wined3d_rendertarget_view_desc_from_d3d10core(&wined3d_desc, &view->desc); + if (FAILED(hr = wined3d_rendertarget_view_create(&wined3d_desc, wined3d_resource, + view, &d3d10_null_wined3d_parent_ops, &view->wined3d_view))) { WARN("Failed to create a wined3d rendertarget view, hr %#x.\n", hr); return hr; diff -Nru wine1.7-1.7.24/dlls/d3d8/d3d8_private.h wine1.7-1.7.25/dlls/d3d8/d3d8_private.h --- wine1.7-1.7.24/dlls/d3d8/d3d8_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d8/d3d8_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -205,12 +205,11 @@ IDirect3DVolume8 IDirect3DVolume8_iface; struct d3d8_resource resource; struct wined3d_volume *wined3d_volume; - IUnknown *container; - IUnknown *forwardReference; + struct d3d8_texture *texture; }; -void volume_init(struct d3d8_volume *volume, struct wined3d_volume *wined3d_volume, - const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; +void volume_init(struct d3d8_volume *volume, struct d3d8_texture *texture, + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d8_swapchain { @@ -228,17 +227,16 @@ IDirect3DSurface8 IDirect3DSurface8_iface; struct d3d8_resource resource; struct wined3d_surface *wined3d_surface; + struct list rtv_entry; + struct wined3d_rendertarget_view *wined3d_rtv; IDirect3DDevice8 *parent_device; - - /* The surface container */ - IUnknown *container; - - /* If set forward refcounting to this object */ - IUnknown *forwardReference; + IUnknown *container; + struct d3d8_texture *texture; }; -void surface_init(struct d3d8_surface *surface, struct wined3d_surface *wined3d_surface, - struct d3d8_device *device, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; +struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface) DECLSPEC_HIDDEN; +void surface_init(struct d3d8_surface *surface, IUnknown *container_parent, + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) DECLSPEC_HIDDEN; struct d3d8_vertexbuffer @@ -273,6 +271,7 @@ struct d3d8_resource resource; struct wined3d_texture *wined3d_texture; IDirect3DDevice8 *parent_device; + struct list rtv_list; }; HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *device, diff -Nru wine1.7-1.7.24/dlls/d3d8/device.c wine1.7-1.7.25/dlls/d3d8/device.c --- wine1.7-1.7.24/dlls/d3d8/device.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d8/device.c 2014-08-22 18:39:55.000000000 +0000 @@ -400,15 +400,15 @@ static UINT WINAPI d3d8_device_GetAvailableTextureMem(IDirect3DDevice8 *iface) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - HRESULT hr; + UINT ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = wined3d_device_get_available_texture_mem(device->wined3d_device); + ret = wined3d_device_get_available_texture_mem(device->wined3d_device); wined3d_mutex_unlock(); - return hr; + return ret; } static HRESULT WINAPI d3d8_device_ResourceManagerDiscardBytes(IDirect3DDevice8 *iface, DWORD byte_count) @@ -918,7 +918,6 @@ sub_resource = wined3d_texture_get_sub_resource(texture, 0); surface_impl = wined3d_resource_get_parent(sub_resource); - surface_impl->forwardReference = NULL; surface_impl->parent_device = &device->IDirect3DDevice8_iface; *surface = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*surface); @@ -1128,7 +1127,7 @@ struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct d3d8_surface *rt_impl = unsafe_impl_from_IDirect3DSurface8(render_target); struct d3d8_surface *ds_impl = unsafe_impl_from_IDirect3DSurface8(depth_stencil); - struct wined3d_surface *original_ds = NULL; + struct wined3d_rendertarget_view *original_dsv; HRESULT hr = D3D_OK; TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, render_target, depth_stencil); @@ -1137,19 +1136,22 @@ if (ds_impl) { + struct wined3d_rendertarget_view *original_rtv; struct wined3d_resource_desc ds_desc, rt_desc; struct wined3d_resource *wined3d_resource; - struct wined3d_surface *original_rt = NULL; + struct d3d8_surface *original_surface; /* If no render target is passed in check the size against the current RT */ if (!render_target) { - if (!(original_rt = wined3d_device_get_render_target(device->wined3d_device, 0))) + + if (!(original_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0))) { wined3d_mutex_unlock(); return D3DERR_NOTFOUND; } - wined3d_resource = wined3d_surface_get_resource(original_rt); + original_surface = wined3d_rendertarget_view_get_sub_resource_parent(original_rtv); + wined3d_resource = wined3d_surface_get_resource(original_surface->wined3d_surface); } else wined3d_resource = wined3d_surface_get_resource(rt_impl->wined3d_surface); @@ -1166,14 +1168,12 @@ } } - original_ds = wined3d_device_get_depth_stencil(device->wined3d_device); - wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL); - if (render_target) - { - hr = wined3d_device_set_render_target(device->wined3d_device, 0, rt_impl->wined3d_surface, TRUE); - if (FAILED(hr)) - wined3d_device_set_depth_stencil(device->wined3d_device, original_ds); - } + original_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device); + wined3d_device_set_depth_stencil_view(device->wined3d_device, + ds_impl ? d3d8_surface_get_rendertarget_view(ds_impl) : NULL); + if (render_target && FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, 0, + d3d8_surface_get_rendertarget_view(rt_impl), TRUE))) + wined3d_device_set_depth_stencil_view(device->wined3d_device, original_dsv); wined3d_mutex_unlock(); @@ -1183,7 +1183,7 @@ static HRESULT WINAPI d3d8_device_GetRenderTarget(IDirect3DDevice8 *iface, IDirect3DSurface8 **render_target) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - struct wined3d_surface *wined3d_surface; + struct wined3d_rendertarget_view *wined3d_rtv; struct d3d8_surface *surface_impl; HRESULT hr; @@ -1193,9 +1193,11 @@ return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - if ((wined3d_surface = wined3d_device_get_render_target(device->wined3d_device, 0))) + if ((wined3d_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0))) { - surface_impl = wined3d_surface_get_parent(wined3d_surface); + /* We want the sub resource parent here, since the view itself may be + * internal to wined3d and may not have a parent. */ + surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_rtv); *render_target = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*render_target); hr = D3D_OK; @@ -1214,7 +1216,7 @@ static HRESULT WINAPI d3d8_device_GetDepthStencilSurface(IDirect3DDevice8 *iface, IDirect3DSurface8 **depth_stencil) { struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); - struct wined3d_surface *wined3d_surface; + struct wined3d_rendertarget_view *wined3d_dsv; struct d3d8_surface *surface_impl; HRESULT hr = D3D_OK; @@ -1224,9 +1226,11 @@ return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - if ((wined3d_surface = wined3d_device_get_depth_stencil(device->wined3d_device))) + if ((wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device))) { - surface_impl = wined3d_surface_get_parent(wined3d_surface); + /* We want the sub resource parent here, since the view itself may be + * internal to wined3d and may not have a parent. */ + surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv); *depth_stencil = &surface_impl->IDirect3DSurface8_iface; IDirect3DSurface8_AddRef(*depth_stencil); } @@ -2940,29 +2944,18 @@ void *container_parent, struct wined3d_surface *surface, void **parent, const struct wined3d_parent_ops **parent_ops) { - struct d3d8_device *device = device_from_device_parent(device_parent); struct d3d8_surface *d3d_surface; TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n", device_parent, container_parent, surface, parent, parent_ops); if (!(d3d_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_surface)))) - { - FIXME("Failed to allocate surface memory.\n"); - return D3DERR_OUTOFVIDEOMEMORY; - } + return E_OUTOFMEMORY; - surface_init(d3d_surface, surface, device, parent_ops); + surface_init(d3d_surface, container_parent, surface, parent_ops); *parent = d3d_surface; TRACE("Created surface %p.\n", d3d_surface); - d3d_surface->container = container_parent; - IDirect3DDevice8_Release(d3d_surface->parent_device); - d3d_surface->parent_device = NULL; - - IDirect3DSurface8_Release(&d3d_surface->IDirect3DSurface8_iface); - d3d_surface->forwardReference = container_parent; - return D3D_OK; } @@ -2978,15 +2971,10 @@ if (!(d3d_volume = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_volume)))) return E_OUTOFMEMORY; - volume_init(d3d_volume, volume, parent_ops); + volume_init(d3d_volume, container_parent, volume, parent_ops); *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume); - d3d_volume->container = container_parent; - - IDirect3DVolume8_Release(&d3d_volume->IDirect3DVolume8_iface); - d3d_volume->forwardReference = container_parent; - return D3D_OK; } @@ -3016,7 +3004,6 @@ wined3d_texture_decref(texture); d3d_surface = wined3d_surface_get_parent(*surface); - d3d_surface->forwardReference = NULL; d3d_surface->parent_device = &device->IDirect3DDevice8_iface; return hr; diff -Nru wine1.7-1.7.24/dlls/d3d8/surface.c wine1.7-1.7.25/dlls/d3d8/surface.c --- wine1.7-1.7.24/dlls/d3d8/surface.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d8/surface.c 2014-08-22 18:39:55.000000000 +0000 @@ -50,69 +50,64 @@ static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); + ULONG refcount; TRACE("iface %p.\n", iface); - if (surface->forwardReference) + if (surface->texture) { - /* Forward refcounting */ - TRACE("Forwarding to %p.\n", surface->forwardReference); - return IUnknown_AddRef(surface->forwardReference); + TRACE("Forwarding to %p.\n", surface->texture); + return IDirect3DBaseTexture8_AddRef(&surface->texture->IDirect3DBaseTexture8_iface); } - else - { - /* No container, handle our own refcounting */ - ULONG ref = InterlockedIncrement(&surface->resource.refcount); - - TRACE("%p increasing refcount to %u.\n", iface, ref); - if (ref == 1) - { - if (surface->parent_device) - IDirect3DDevice8_AddRef(surface->parent_device); - wined3d_mutex_lock(); - wined3d_surface_incref(surface->wined3d_surface); - wined3d_mutex_unlock(); - } + refcount = InterlockedIncrement(&surface->resource.refcount); + TRACE("%p increasing refcount to %u.\n", iface, refcount); - return ref; + if (refcount == 1) + { + if (surface->parent_device) + IDirect3DDevice8_AddRef(surface->parent_device); + wined3d_mutex_lock(); + if (surface->wined3d_rtv) + wined3d_rendertarget_view_incref(surface->wined3d_rtv); + wined3d_surface_incref(surface->wined3d_surface); + wined3d_mutex_unlock(); } + + return refcount; } static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); + ULONG refcount; TRACE("iface %p.\n", iface); - if (surface->forwardReference) + if (surface->texture) { - /* Forward refcounting */ - TRACE("Forwarding to %p.\n", surface->forwardReference); - return IUnknown_Release(surface->forwardReference); + TRACE("Forwarding to %p.\n", surface->texture); + return IDirect3DBaseTexture8_Release(&surface->texture->IDirect3DBaseTexture8_iface); } - else - { - /* No container, handle our own refcounting */ - ULONG ref = InterlockedDecrement(&surface->resource.refcount); - - TRACE("%p decreasing refcount to %u.\n", iface, ref); - if (!ref) - { - IDirect3DDevice8 *parent_device = surface->parent_device; + refcount = InterlockedDecrement(&surface->resource.refcount); + TRACE("%p decreasing refcount to %u.\n", iface, refcount); - /* Implicit surfaces are destroyed with the device, not if refcount reaches 0. */ - wined3d_mutex_lock(); - wined3d_surface_decref(surface->wined3d_surface); - wined3d_mutex_unlock(); + if (!refcount) + { + IDirect3DDevice8 *parent_device = surface->parent_device; - if (parent_device) - IDirect3DDevice8_Release(parent_device); - } + wined3d_mutex_lock(); + if (surface->wined3d_rtv) + wined3d_rendertarget_view_decref(surface->wined3d_rtv); + wined3d_surface_decref(surface->wined3d_surface); + wined3d_mutex_unlock(); - return ref; + if (parent_device) + IDirect3DDevice8_Release(parent_device); } + + return refcount; } static HRESULT WINAPI d3d8_surface_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device) @@ -121,22 +116,8 @@ TRACE("iface %p, device %p.\n", iface, device); - if (surface->forwardReference) - { - IDirect3DResource8 *resource; - HRESULT hr; - - hr = IUnknown_QueryInterface(surface->forwardReference, &IID_IDirect3DResource8, (void **)&resource); - if (SUCCEEDED(hr)) - { - hr = IDirect3DResource8_GetDevice(resource, device); - IDirect3DResource8_Release(resource); - - TRACE("Returning device %p.\n", *device); - } - - return hr; - } + if (surface->texture) + return IDirect3DBaseTexture8_GetDevice(&surface->texture->IDirect3DBaseTexture8_iface, device); *device = surface->parent_device; IDirect3DDevice8_AddRef(*device); @@ -311,19 +292,70 @@ surface_wined3d_object_destroyed, }; -void surface_init(struct d3d8_surface *surface, struct wined3d_surface *wined3d_surface, - struct d3d8_device *device, const struct wined3d_parent_ops **parent_ops) +void surface_init(struct d3d8_surface *surface, IUnknown *container_parent, + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) { + IDirect3DBaseTexture8 *texture; + surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl; d3d8_resource_init(&surface->resource); - wined3d_surface_incref(wined3d_surface); + surface->resource.refcount = 0; surface->wined3d_surface = wined3d_surface; - surface->parent_device = &device->IDirect3DDevice8_iface; - IDirect3DDevice8_AddRef(surface->parent_device); + list_init(&surface->rtv_entry); + surface->container = container_parent; + + if (container_parent && SUCCEEDED(IUnknown_QueryInterface(container_parent, + &IID_IDirect3DBaseTexture8, (void **)&texture))) + { + surface->texture = unsafe_impl_from_IDirect3DBaseTexture8(texture); + IDirect3DBaseTexture8_Release(texture); + } *parent_ops = &d3d8_surface_wined3d_parent_ops; } +static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent) +{ + struct d3d8_surface *surface = parent; + + /* If the surface reference count drops to zero, we release our reference + * to the view, but don't clear the pointer yet, in case e.g. a + * GetRenderTarget() call brings the surface back before the view is + * actually destroyed. When the view is destroyed, we need to clear the + * pointer, or a subsequent surface AddRef() would reference it again. + * + * This is safe because as long as the view still has a reference to the + * texture, the surface is also still alive, and we're called before the + * view releases that reference. */ + surface->wined3d_rtv = NULL; + list_remove(&surface->rtv_entry); +} + +static const struct wined3d_parent_ops d3d8_view_wined3d_parent_ops = +{ + view_wined3d_object_destroyed, +}; + +struct wined3d_rendertarget_view *d3d8_surface_get_rendertarget_view(struct d3d8_surface *surface) +{ + HRESULT hr; + + if (surface->wined3d_rtv) + return surface->wined3d_rtv; + + if (FAILED(hr = wined3d_rendertarget_view_create_from_surface(surface->wined3d_surface, + surface, &d3d8_view_wined3d_parent_ops, &surface->wined3d_rtv))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return NULL; + } + + if (surface->texture) + list_add_head(&surface->texture->rtv_list, &surface->rtv_entry); + + return surface->wined3d_rtv; +} + struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface) { if (!iface) diff -Nru wine1.7-1.7.24/dlls/d3d8/texture.c wine1.7-1.7.25/dlls/d3d8/texture.c --- wine1.7-1.7.24/dlls/d3d8/texture.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d8/texture.c 2014-08-22 18:39:55.000000000 +0000 @@ -65,8 +65,14 @@ if (ref == 1) { + struct d3d8_surface *surface; + IDirect3DDevice8_AddRef(texture->parent_device); wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d8_surface, rtv_entry) + { + wined3d_rendertarget_view_incref(surface->wined3d_rtv); + } wined3d_texture_incref(texture->wined3d_texture); wined3d_mutex_unlock(); } @@ -84,8 +90,13 @@ if (!ref) { IDirect3DDevice8 *parent_device = texture->parent_device; + struct d3d8_surface *surface; wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d8_surface, rtv_entry) + { + wined3d_rendertarget_view_decref(surface->wined3d_rtv); + } wined3d_texture_decref(texture->wined3d_texture); wined3d_mutex_unlock(); @@ -413,8 +424,14 @@ if (ref == 1) { + struct d3d8_surface *surface; + IDirect3DDevice8_AddRef(texture->parent_device); wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d8_surface, rtv_entry) + { + wined3d_rendertarget_view_incref(surface->wined3d_rtv); + } wined3d_texture_incref(texture->wined3d_texture); wined3d_mutex_unlock(); } @@ -432,10 +449,15 @@ if (!ref) { IDirect3DDevice8 *parent_device = texture->parent_device; + struct d3d8_surface *surface; TRACE("Releasing child %p.\n", texture->wined3d_texture); wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d8_surface, rtv_entry) + { + wined3d_rendertarget_view_decref(surface->wined3d_rtv); + } wined3d_texture_decref(texture->wined3d_texture); wined3d_mutex_unlock(); @@ -1133,6 +1155,7 @@ texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl; d3d8_resource_init(&texture->resource); + list_init(&texture->rtv_list); desc.resource_type = WINED3D_RTYPE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1174,6 +1197,7 @@ texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl; d3d8_resource_init(&texture->resource); + list_init(&texture->rtv_list); desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1214,6 +1238,7 @@ texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl; d3d8_resource_init(&texture->resource); + list_init(&texture->rtv_list); desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); diff -Nru wine1.7-1.7.24/dlls/d3d8/volume.c wine1.7-1.7.25/dlls/d3d8/volume.c --- wine1.7-1.7.24/dlls/d3d8/volume.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d8/volume.c 2014-08-22 18:39:55.000000000 +0000 @@ -51,29 +51,9 @@ struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); TRACE("iface %p.\n", iface); + TRACE("Forwarding to %p.\n", volume->texture); - if (volume->forwardReference) - { - /* Forward to the containerParent */ - TRACE("Forwarding to %p,\n", volume->forwardReference); - return IUnknown_AddRef(volume->forwardReference); - } - else - { - /* No container, handle our own refcounting */ - ULONG ref = InterlockedIncrement(&volume->resource.refcount); - - TRACE("%p increasing refcount to %u.\n", iface, ref); - - if (ref == 1) - { - wined3d_mutex_lock(); - wined3d_volume_incref(volume->wined3d_volume); - wined3d_mutex_unlock(); - } - - return ref; - } + return IDirect3DBaseTexture8_AddRef(&volume->texture->IDirect3DBaseTexture8_iface); } static ULONG WINAPI d3d8_volume_Release(IDirect3DVolume8 *iface) @@ -81,49 +61,18 @@ struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); TRACE("iface %p.\n", iface); + TRACE("Forwarding to %p.\n", volume->texture); - if (volume->forwardReference) - { - /* Forward to the containerParent */ - TRACE("Forwarding to %p.\n", volume->forwardReference); - return IUnknown_Release(volume->forwardReference); - } - else - { - /* No container, handle our own refcounting */ - ULONG ref = InterlockedDecrement(&volume->resource.refcount); - - TRACE("%p decreasing refcount to %u.\n", iface, ref); - - if (!ref) - { - wined3d_mutex_lock(); - wined3d_volume_decref(volume->wined3d_volume); - wined3d_mutex_unlock(); - } - - return ref; - } + return IDirect3DBaseTexture8_Release(&volume->texture->IDirect3DBaseTexture8_iface); } static HRESULT WINAPI d3d8_volume_GetDevice(IDirect3DVolume8 *iface, IDirect3DDevice8 **device) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - IDirect3DResource8 *resource; - HRESULT hr; TRACE("iface %p, device %p.\n", iface, device); - hr = IUnknown_QueryInterface(volume->forwardReference, &IID_IDirect3DResource8, (void **)&resource); - if (SUCCEEDED(hr)) - { - hr = IDirect3DResource8_GetDevice(resource, device); - IDirect3DResource8_Release(resource); - - TRACE("Returning device %p.\n", *device); - } - - return hr; + return IDirect3DBaseTexture8_GetDevice(&volume->texture->IDirect3DBaseTexture8_iface, device); } static HRESULT WINAPI d3d8_volume_SetPrivateData(IDirect3DVolume8 *iface, REFGUID guid, @@ -157,19 +106,10 @@ static HRESULT WINAPI d3d8_volume_GetContainer(IDirect3DVolume8 *iface, REFIID riid, void **container) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - HRESULT res; - - TRACE("iface %p, riid %s, container %p.\n", - iface, debugstr_guid(riid), container); - - if (!volume->container) - return E_NOINTERFACE; - - res = IUnknown_QueryInterface(volume->container, riid, container); - TRACE("Returning %p.\n", *container); + TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), container); - return res; + return IDirect3DBaseTexture8_QueryInterface(&volume->texture->IDirect3DBaseTexture8_iface, riid, container); } static HRESULT WINAPI d3d8_volume_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DESC *desc) @@ -261,13 +201,14 @@ volume_wined3d_object_destroyed, }; -void volume_init(struct d3d8_volume *volume, struct wined3d_volume *wined3d_volume, - const struct wined3d_parent_ops **parent_ops) +void volume_init(struct d3d8_volume *volume, struct d3d8_texture *texture, + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) { volume->IDirect3DVolume8_iface.lpVtbl = &d3d8_volume_vtbl; d3d8_resource_init(&volume->resource); - wined3d_volume_incref(wined3d_volume); + volume->resource.refcount = 0; volume->wined3d_volume = wined3d_volume; + volume->texture = texture; *parent_ops = &d3d8_volume_wined3d_parent_ops; } diff -Nru wine1.7-1.7.24/dlls/d3d9/d3d9_private.h wine1.7-1.7.25/dlls/d3d9/d3d9_private.h --- wine1.7-1.7.24/dlls/d3d9/d3d9_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d9/d3d9_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -192,12 +192,11 @@ IDirect3DVolume9 IDirect3DVolume9_iface; struct d3d9_resource resource; struct wined3d_volume *wined3d_volume; - IUnknown *container; - IUnknown *forwardReference; + struct d3d9_texture *texture; }; -void volume_init(struct d3d9_volume *volume, struct wined3d_volume *wined3d_volume, - const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; +void volume_init(struct d3d9_volume *volume, struct d3d9_texture *texture, + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d9_swapchain { @@ -215,14 +214,17 @@ IDirect3DSurface9 IDirect3DSurface9_iface; struct d3d9_resource resource; struct wined3d_surface *wined3d_surface; + struct list rtv_entry; + struct wined3d_rendertarget_view *wined3d_rtv; IDirect3DDevice9Ex *parent_device; IUnknown *container; - IUnknown *forwardReference; + struct d3d9_texture *texture; BOOL getdc_supported; }; -void surface_init(struct d3d9_surface *surface, struct wined3d_surface *wined3d_surface, - struct d3d9_device *device, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; +struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface) DECLSPEC_HIDDEN; +void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) DECLSPEC_HIDDEN; struct d3d9_vertexbuffer @@ -257,6 +259,7 @@ struct d3d9_resource resource; struct wined3d_texture *wined3d_texture; IDirect3DDevice9Ex *parent_device; + struct list rtv_list; }; HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *device, diff -Nru wine1.7-1.7.24/dlls/d3d9/device.c wine1.7-1.7.25/dlls/d3d9/device.c --- wine1.7-1.7.24/dlls/d3d9/device.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d9/device.c 2014-08-22 18:39:55.000000000 +0000 @@ -343,15 +343,15 @@ static UINT WINAPI d3d9_device_GetAvailableTextureMem(IDirect3DDevice9Ex *iface) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - HRESULT hr; + UINT ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = wined3d_device_get_available_texture_mem(device->wined3d_device); + ret = wined3d_device_get_available_texture_mem(device->wined3d_device); wined3d_mutex_unlock(); - return hr; + return ret; } static HRESULT WINAPI d3d9_device_EvictManagedResources(IDirect3DDevice9Ex *iface) @@ -1026,7 +1026,6 @@ sub_resource = wined3d_texture_get_sub_resource(texture, 0); surface_impl = wined3d_resource_get_parent(sub_resource); - surface_impl->forwardReference = NULL; surface_impl->parent_device = &device->IDirect3DDevice9Ex_iface; *surface = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*surface); @@ -1272,8 +1271,14 @@ return D3DERR_INVALIDCALL; } - /* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */ - hr = wined3d_device_color_fill(device->wined3d_device, surface_impl->wined3d_surface, rect, &c); + if (desc.pool != WINED3D_POOL_DEFAULT && desc.pool != WINED3D_POOL_SYSTEM_MEM) + { + WARN("Color-fill not allowed on surfaces in pool %#x.\n", desc.pool); + return D3DERR_INVALIDCALL; + } + + hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, + d3d9_surface_get_rendertarget_view(surface_impl), rect, &c); wined3d_mutex_unlock(); @@ -1346,8 +1351,8 @@ } wined3d_mutex_lock(); - hr = wined3d_device_set_render_target(device->wined3d_device, idx, - surface_impl ? surface_impl->wined3d_surface : NULL, TRUE); + hr = wined3d_device_set_rendertarget_view(device->wined3d_device, idx, + surface_impl ? d3d9_surface_get_rendertarget_view(surface_impl) : NULL, TRUE); wined3d_mutex_unlock(); return hr; @@ -1356,7 +1361,7 @@ static HRESULT WINAPI d3d9_device_GetRenderTarget(IDirect3DDevice9Ex *iface, DWORD idx, IDirect3DSurface9 **surface) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - struct wined3d_surface *wined3d_surface; + struct wined3d_rendertarget_view *wined3d_rtv; struct d3d9_surface *surface_impl; HRESULT hr = D3D_OK; @@ -1372,9 +1377,11 @@ } wined3d_mutex_lock(); - if ((wined3d_surface = wined3d_device_get_render_target(device->wined3d_device, idx))) + if ((wined3d_rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, idx))) { - surface_impl = wined3d_surface_get_parent(wined3d_surface); + /* We want the sub resource parent here, since the view itself may be + * internal to wined3d and may not have a parent. */ + surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_rtv); *surface = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*surface); } @@ -1396,7 +1403,8 @@ TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil); wined3d_mutex_lock(); - wined3d_device_set_depth_stencil(device->wined3d_device, ds_impl ? ds_impl->wined3d_surface : NULL); + wined3d_device_set_depth_stencil_view(device->wined3d_device, + ds_impl ? d3d9_surface_get_rendertarget_view(ds_impl) : NULL); wined3d_mutex_unlock(); return D3D_OK; @@ -1405,7 +1413,7 @@ static HRESULT WINAPI d3d9_device_GetDepthStencilSurface(IDirect3DDevice9Ex *iface, IDirect3DSurface9 **depth_stencil) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); - struct wined3d_surface *wined3d_surface; + struct wined3d_rendertarget_view *wined3d_dsv; struct d3d9_surface *surface_impl; HRESULT hr = D3D_OK; @@ -1415,9 +1423,11 @@ return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - if ((wined3d_surface = wined3d_device_get_depth_stencil(device->wined3d_device))) + if ((wined3d_dsv = wined3d_device_get_depth_stencil_view(device->wined3d_device))) { - surface_impl = wined3d_surface_get_parent(wined3d_surface); + /* We want the sub resource parent here, since the view itself may be + * internal to wined3d and may not have a parent. */ + surface_impl = wined3d_rendertarget_view_get_sub_resource_parent(wined3d_dsv); *depth_stencil = &surface_impl->IDirect3DSurface9_iface; IDirect3DSurface9_AddRef(*depth_stencil); } @@ -3461,29 +3471,18 @@ void *container_parent, struct wined3d_surface *surface, void **parent, const struct wined3d_parent_ops **parent_ops) { - struct d3d9_device *device = device_from_device_parent(device_parent); struct d3d9_surface *d3d_surface; TRACE("device_parent %p, container_parent %p, surface %p, parent %p, parent_ops %p.\n", device_parent, container_parent, surface, parent, parent_ops); if (!(d3d_surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_surface)))) - { - FIXME("Failed to allocate surface memory.\n"); - return D3DERR_OUTOFVIDEOMEMORY; - } + return E_OUTOFMEMORY; - surface_init(d3d_surface, surface, device, parent_ops); + surface_init(d3d_surface, container_parent, surface, parent_ops); *parent = d3d_surface; TRACE("Created surface %p.\n", d3d_surface); - d3d_surface->container = container_parent; - IDirect3DDevice9Ex_Release(d3d_surface->parent_device); - d3d_surface->parent_device = NULL; - - IDirect3DSurface9_Release(&d3d_surface->IDirect3DSurface9_iface); - d3d_surface->forwardReference = container_parent; - return D3D_OK; } @@ -3499,15 +3498,10 @@ if (!(d3d_volume = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d3d_volume)))) return E_OUTOFMEMORY; - volume_init(d3d_volume, volume, parent_ops); + volume_init(d3d_volume, container_parent, volume, parent_ops); *parent = d3d_volume; TRACE("Created volume %p.\n", d3d_volume); - d3d_volume->container = container_parent; - - IDirect3DVolume9_Release(&d3d_volume->IDirect3DVolume9_iface); - d3d_volume->forwardReference = container_parent; - return D3D_OK; } @@ -3540,7 +3534,6 @@ wined3d_texture_decref(texture); d3d_surface = wined3d_surface_get_parent(*surface); - d3d_surface->forwardReference = NULL; d3d_surface->parent_device = &device->IDirect3DDevice9Ex_iface; return hr; diff -Nru wine1.7-1.7.24/dlls/d3d9/surface.c wine1.7-1.7.25/dlls/d3d9/surface.c --- wine1.7-1.7.24/dlls/d3d9/surface.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d9/surface.c 2014-08-22 18:39:55.000000000 +0000 @@ -55,10 +55,10 @@ TRACE("iface %p.\n", iface); - if (surface->forwardReference) + if (surface->texture) { - TRACE("Forwarding to %p.\n", surface->forwardReference); - return IUnknown_AddRef(surface->forwardReference); + TRACE("Forwarding to %p.\n", surface->texture); + return IDirect3DBaseTexture9_AddRef(&surface->texture->IDirect3DBaseTexture9_iface); } refcount = InterlockedIncrement(&surface->resource.refcount); @@ -69,6 +69,8 @@ if (surface->parent_device) IDirect3DDevice9Ex_AddRef(surface->parent_device); wined3d_mutex_lock(); + if (surface->wined3d_rtv) + wined3d_rendertarget_view_incref(surface->wined3d_rtv); wined3d_surface_incref(surface->wined3d_surface); wined3d_mutex_unlock(); } @@ -83,10 +85,10 @@ TRACE("iface %p.\n", iface); - if (surface->forwardReference) + if (surface->texture) { - TRACE("Forwarding to %p.\n", surface->forwardReference); - return IUnknown_Release(surface->forwardReference); + TRACE("Forwarding to %p.\n", surface->texture); + return IDirect3DBaseTexture9_Release(&surface->texture->IDirect3DBaseTexture9_iface); } refcount = InterlockedDecrement(&surface->resource.refcount); @@ -97,6 +99,8 @@ IDirect3DDevice9Ex *parent_device = surface->parent_device; wined3d_mutex_lock(); + if (surface->wined3d_rtv) + wined3d_rendertarget_view_decref(surface->wined3d_rtv); wined3d_surface_decref(surface->wined3d_surface); wined3d_mutex_unlock(); @@ -114,22 +118,8 @@ TRACE("iface %p, device %p.\n", iface, device); - if (surface->forwardReference) - { - IDirect3DResource9 *resource; - HRESULT hr; - - hr = IUnknown_QueryInterface(surface->forwardReference, &IID_IDirect3DResource9, (void **)&resource); - if (SUCCEEDED(hr)) - { - hr = IDirect3DResource9_GetDevice(resource, device); - IDirect3DResource9_Release(resource); - - TRACE("Returning device %p.\n", *device); - } - - return hr; - } + if (surface->texture) + return IDirect3DBaseTexture9_GetDevice(&surface->texture->IDirect3DBaseTexture9_iface, device); *device = (IDirect3DDevice9 *)surface->parent_device; IDirect3DDevice9_AddRef(*device); @@ -355,13 +345,25 @@ surface_wined3d_object_destroyed, }; -void surface_init(struct d3d9_surface *surface, struct wined3d_surface *wined3d_surface, - struct d3d9_device *device, const struct wined3d_parent_ops **parent_ops) +void surface_init(struct d3d9_surface *surface, IUnknown *container_parent, + struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) { struct wined3d_resource_desc desc; + IDirect3DBaseTexture9 *texture; surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl; d3d9_resource_init(&surface->resource); + surface->resource.refcount = 0; + surface->wined3d_surface = wined3d_surface; + list_init(&surface->rtv_entry); + surface->container = container_parent; + + if (container_parent && SUCCEEDED(IUnknown_QueryInterface(container_parent, + &IID_IDirect3DBaseTexture9, (void **)&texture))) + { + surface->texture = unsafe_impl_from_IDirect3DBaseTexture9(texture); + IDirect3DBaseTexture9_Release(texture); + } wined3d_resource_get_desc(wined3d_surface_get_resource(wined3d_surface), &desc); switch (d3dformat_from_wined3dformat(desc.format)) @@ -380,14 +382,51 @@ break; } - wined3d_surface_incref(wined3d_surface); - surface->wined3d_surface = wined3d_surface; - surface->parent_device = &device->IDirect3DDevice9Ex_iface; - IDirect3DDevice9Ex_AddRef(surface->parent_device); - *parent_ops = &d3d9_surface_wined3d_parent_ops; } +static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent) +{ + struct d3d9_surface *surface = parent; + + /* If the surface reference count drops to zero, we release our reference + * to the view, but don't clear the pointer yet, in case e.g. a + * GetRenderTarget() call brings the surface back before the view is + * actually destroyed. When the view is destroyed, we need to clear the + * pointer, or a subsequent surface AddRef() would reference it again. + * + * This is safe because as long as the view still has a reference to the + * texture, the surface is also still alive, and we're called before the + * view releases that reference. */ + surface->wined3d_rtv = NULL; + list_remove(&surface->rtv_entry); +} + +static const struct wined3d_parent_ops d3d9_view_wined3d_parent_ops = +{ + view_wined3d_object_destroyed, +}; + +struct wined3d_rendertarget_view *d3d9_surface_get_rendertarget_view(struct d3d9_surface *surface) +{ + HRESULT hr; + + if (surface->wined3d_rtv) + return surface->wined3d_rtv; + + if (FAILED(hr = wined3d_rendertarget_view_create_from_surface(surface->wined3d_surface, + surface, &d3d9_view_wined3d_parent_ops, &surface->wined3d_rtv))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return NULL; + } + + if (surface->texture) + list_add_head(&surface->texture->rtv_list, &surface->rtv_entry); + + return surface->wined3d_rtv; +} + struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface) { if (!iface) diff -Nru wine1.7-1.7.24/dlls/d3d9/texture.c wine1.7-1.7.25/dlls/d3d9/texture.c --- wine1.7-1.7.24/dlls/d3d9/texture.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d9/texture.c 2014-08-22 18:39:55.000000000 +0000 @@ -67,8 +67,14 @@ if (ref == 1) { + struct d3d9_surface *surface; + IDirect3DDevice9Ex_AddRef(texture->parent_device); wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry) + { + wined3d_rendertarget_view_incref(surface->wined3d_rtv); + } wined3d_texture_incref(texture->wined3d_texture); wined3d_mutex_unlock(); } @@ -86,8 +92,13 @@ if (!ref) { IDirect3DDevice9Ex *parent_device = texture->parent_device; + struct d3d9_surface *surface; wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry) + { + wined3d_rendertarget_view_decref(surface->wined3d_rtv); + } wined3d_texture_decref(texture->wined3d_texture); wined3d_mutex_unlock(); @@ -458,8 +469,14 @@ if (ref == 1) { + struct d3d9_surface *surface; + IDirect3DDevice9Ex_AddRef(texture->parent_device); wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry) + { + wined3d_rendertarget_view_decref(surface->wined3d_rtv); + } wined3d_texture_incref(texture->wined3d_texture); wined3d_mutex_unlock(); } @@ -477,10 +494,15 @@ if (!ref) { IDirect3DDevice9Ex *parent_device = texture->parent_device; + struct d3d9_surface *surface; TRACE("Releasing child %p.\n", texture->wined3d_texture); wined3d_mutex_lock(); + LIST_FOR_EACH_ENTRY(surface, &texture->rtv_list, struct d3d9_surface, rtv_entry) + { + wined3d_rendertarget_view_decref(surface->wined3d_rtv); + } wined3d_texture_decref(texture->wined3d_texture); wined3d_mutex_unlock(); @@ -1257,6 +1279,7 @@ texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl; d3d9_resource_init(&texture->resource); + list_init(&texture->rtv_list); desc.resource_type = WINED3D_RTYPE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1298,6 +1321,7 @@ texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl; d3d9_resource_init(&texture->resource); + list_init(&texture->rtv_list); desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1338,6 +1362,7 @@ texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl; d3d9_resource_init(&texture->resource); + list_init(&texture->rtv_list); desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); diff -Nru wine1.7-1.7.24/dlls/d3d9/volume.c wine1.7-1.7.25/dlls/d3d9/volume.c --- wine1.7-1.7.24/dlls/d3d9/volume.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/d3d9/volume.c 2014-08-22 18:39:55.000000000 +0000 @@ -50,73 +50,30 @@ static ULONG WINAPI d3d9_volume_AddRef(IDirect3DVolume9 *iface) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - ULONG refcount; TRACE("iface %p.\n", iface); + TRACE("Forwarding to %p.\n", volume->texture); - if (volume->forwardReference) - { - TRACE("Forwarding to %p.\n", volume->forwardReference); - return IUnknown_AddRef(volume->forwardReference); - } - - refcount = InterlockedIncrement(&volume->resource.refcount); - TRACE("%p increasing refcount to %u.\n", iface, refcount); - - if (refcount == 1) - { - wined3d_mutex_lock(); - wined3d_volume_incref(volume->wined3d_volume); - wined3d_mutex_unlock(); - } - - return refcount; + return IDirect3DBaseTexture9_AddRef(&volume->texture->IDirect3DBaseTexture9_iface); } static ULONG WINAPI d3d9_volume_Release(IDirect3DVolume9 *iface) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - ULONG refcount; TRACE("iface %p.\n", iface); + TRACE("Forwarding to %p.\n", volume->texture); - if (volume->forwardReference) - { - TRACE("Forwarding to %p.\n", volume->forwardReference); - return IUnknown_Release(volume->forwardReference); - } - - refcount = InterlockedDecrement(&volume->resource.refcount); - TRACE("%p decreasing refcount to %u.\n", iface, refcount); - - if (!refcount) - { - wined3d_mutex_lock(); - wined3d_volume_decref(volume->wined3d_volume); - wined3d_mutex_unlock(); - } - - return refcount; + return IDirect3DBaseTexture9_Release(&volume->texture->IDirect3DBaseTexture9_iface); } static HRESULT WINAPI d3d9_volume_GetDevice(IDirect3DVolume9 *iface, IDirect3DDevice9 **device) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - IDirect3DResource9 *resource; - HRESULT hr; TRACE("iface %p, device %p.\n", iface, device); - hr = IUnknown_QueryInterface(volume->forwardReference, &IID_IDirect3DResource9, (void **)&resource); - if (SUCCEEDED(hr)) - { - hr = IDirect3DResource9_GetDevice(resource, device); - IDirect3DResource9_Release(resource); - - TRACE("Returning device %p.\n", *device); - } - - return hr; + return IDirect3DBaseTexture9_GetDevice(&volume->texture->IDirect3DBaseTexture9_iface, device); } static HRESULT WINAPI d3d9_volume_SetPrivateData(IDirect3DVolume9 *iface, REFGUID guid, @@ -150,18 +107,10 @@ static HRESULT WINAPI d3d9_volume_GetContainer(IDirect3DVolume9 *iface, REFIID riid, void **container) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - HRESULT hr; TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), container); - if (!volume->container) - return E_NOINTERFACE; - - hr = IUnknown_QueryInterface(volume->container, riid, container); - - TRACE("Returning %p,\n", *container); - - return hr; + return IDirect3DBaseTexture9_QueryInterface(&volume->texture->IDirect3DBaseTexture9_iface, riid, container); } static HRESULT WINAPI d3d9_volume_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DESC *desc) @@ -252,13 +201,14 @@ volume_wined3d_object_destroyed, }; -void volume_init(struct d3d9_volume *volume, struct wined3d_volume *wined3d_volume, - const struct wined3d_parent_ops **parent_ops) +void volume_init(struct d3d9_volume *volume, struct d3d9_texture *texture, + struct wined3d_volume *wined3d_volume, const struct wined3d_parent_ops **parent_ops) { volume->IDirect3DVolume9_iface.lpVtbl = &d3d9_volume_vtbl; d3d9_resource_init(&volume->resource); - wined3d_volume_incref(wined3d_volume); + volume->resource.refcount = 0; volume->wined3d_volume = wined3d_volume; + volume->texture = texture; *parent_ops = &d3d9_volume_wined3d_parent_ops; } diff -Nru wine1.7-1.7.24/dlls/ddraw/ddraw.c wine1.7-1.7.25/dlls/ddraw/ddraw.c --- wine1.7-1.7.24/dlls/ddraw/ddraw.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/ddraw.c 2014-08-22 18:39:55.000000000 +0000 @@ -767,7 +767,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window, DWORD cooplevel, BOOL restore_mode_on_normal) { - struct wined3d_surface *rt = NULL, *ds = NULL; + struct wined3d_rendertarget_view *rtv = NULL, *dsv = NULL; struct wined3d_stateblock *stateblock; BOOL restore_state = FALSE; HRESULT hr; @@ -918,14 +918,15 @@ } wined3d_stateblock_capture(stateblock); - rt = wined3d_device_get_render_target(ddraw->wined3d_device, 0); - if (rt == ddraw->wined3d_frontbuffer) - rt = NULL; - else if (rt) - wined3d_surface_incref(rt); + rtv = wined3d_device_get_rendertarget_view(ddraw->wined3d_device, 0); + /* Rendering to ddraw->wined3d_frontbuffer. */ + if (rtv && !wined3d_rendertarget_view_get_sub_resource_parent(rtv)) + rtv = NULL; + else if (rtv) + wined3d_rendertarget_view_incref(rtv); - if ((ds = wined3d_device_get_depth_stencil(ddraw->wined3d_device))) - wined3d_surface_incref(ds); + if ((dsv = wined3d_device_get_depth_stencil_view(ddraw->wined3d_device))) + wined3d_rendertarget_view_incref(dsv); } ddraw_destroy_swapchain(ddraw); @@ -936,16 +937,16 @@ if (restore_state) { - if (ds) + if (dsv) { - wined3d_device_set_depth_stencil(ddraw->wined3d_device, ds); - wined3d_surface_decref(ds); + wined3d_device_set_depth_stencil_view(ddraw->wined3d_device, dsv); + wined3d_rendertarget_view_decref(dsv); } - if (rt) + if (rtv) { - wined3d_device_set_render_target(ddraw->wined3d_device, 0, rt, FALSE); - wined3d_surface_decref(rt); + wined3d_device_set_rendertarget_view(ddraw->wined3d_device, 0, rtv, FALSE); + wined3d_rendertarget_view_decref(rtv); } wined3d_stateblock_apply(stateblock); @@ -1926,7 +1927,7 @@ struct wined3d_adapter_identifier desc = {0}; hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0, &desc); - *total = desc.video_memory; + *total = min(UINT_MAX, desc.video_memory); } wined3d_mutex_unlock(); @@ -3683,6 +3684,8 @@ | D3DPTEXTURECAPS_NONPOW2CONDITIONAL | D3DPTEXTURECAPS_PERSPECTIVE); /* RGB, RAMP and MMX devices have a HAL dcmColorModel of 0 */ hal_desc.dcmColorModel = 0; + /* RGB, RAMP and MMX devices cannot report HAL hardware flags */ + hal_desc.dwFlags = 0; hr = callback((GUID *)&IID_IDirect3DRGBDevice, reference_description, device_name, &hal_desc, &hel_desc, context); diff -Nru wine1.7-1.7.24/dlls/ddraw/ddraw_private.h wine1.7-1.7.25/dlls/ddraw/ddraw_private.h --- wine1.7-1.7.24/dlls/ddraw/ddraw_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/ddraw_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -20,6 +20,7 @@ #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H #include +#include #define COBJMACROS #define NONAMELESSSTRUCT #define NONAMELESSUNION @@ -157,6 +158,7 @@ struct ddraw *ddraw; struct wined3d_surface *wined3d_surface; struct wined3d_texture *wined3d_texture; + struct wined3d_rendertarget_view *wined3d_rtv; struct wined3d_private_store private_store; struct d3d_device *device1; @@ -204,6 +206,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) DECLSPEC_HIDDEN; +struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) DECLSPEC_HIDDEN; HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, struct ddraw_texture *texture, struct wined3d_surface *wined3d_surface, const struct wined3d_parent_ops **parent_ops) DECLSPEC_HIDDEN; ULONG ddraw_surface_release_iface(struct ddraw_surface *This) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.24/dlls/ddraw/device.c wine1.7-1.7.25/dlls/ddraw/device.c --- wine1.7-1.7.24/dlls/ddraw/device.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/device.c 2014-08-22 18:39:55.000000000 +0000 @@ -246,7 +246,7 @@ if (This->vertex_buffer) wined3d_buffer_decref(This->vertex_buffer); - wined3d_device_set_render_target(This->wined3d_device, 0, NULL, FALSE); + wined3d_device_set_rendertarget_view(This->wined3d_device, 0, NULL, FALSE); /* Release the wined3d device. This won't destroy it. */ if (!wined3d_device_decref(This->wined3d_device)) @@ -1818,8 +1818,8 @@ return DDERR_INVALIDPARAMS; } - if (FAILED(hr = wined3d_device_set_render_target(device->wined3d_device, - 0, target->wined3d_surface, FALSE))) + if (FAILED(hr = wined3d_device_set_rendertarget_view(device->wined3d_device, + 0, ddraw_surface_get_rendertarget_view(target), FALSE))) return hr; IUnknown_AddRef(rt_iface); @@ -6759,13 +6759,13 @@ if (!depthStencil) { TRACE("Setting wined3d depth stencil to NULL\n"); - wined3d_device_set_depth_stencil(device->wined3d_device, NULL); + wined3d_device_set_depth_stencil_view(device->wined3d_device, NULL); return WINED3D_ZB_FALSE; } dsi = impl_from_IDirectDrawSurface7(depthStencil); - TRACE("Setting wined3d depth stencil to %p (wined3d %p)\n", dsi, dsi->wined3d_surface); - wined3d_device_set_depth_stencil(device->wined3d_device, dsi->wined3d_surface); + wined3d_device_set_depth_stencil_view(device->wined3d_device, + ddraw_surface_get_rendertarget_view(dsi)); IDirectDrawSurface7_Release(depthStencil); return WINED3D_ZB_TRUE; @@ -6818,8 +6818,8 @@ wined3d_device_incref(ddraw->wined3d_device); /* Render to the back buffer */ - hr = wined3d_device_set_render_target(ddraw->wined3d_device, 0, target->wined3d_surface, TRUE); - if (FAILED(hr)) + if (FAILED(hr = wined3d_device_set_rendertarget_view(ddraw->wined3d_device, + 0, ddraw_surface_get_rendertarget_view(target), TRUE))) { ERR("Failed to set render target, hr %#x.\n", hr); ddraw_handle_table_destroy(&device->handle_table); diff -Nru wine1.7-1.7.24/dlls/ddraw/surface.c wine1.7-1.7.25/dlls/ddraw/surface.c --- wine1.7-1.7.24/dlls/ddraw/surface.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/surface.c 2014-08-22 18:39:55.000000000 +0000 @@ -322,6 +322,8 @@ if (surface->ifaceToRelease) IUnknown_AddRef(surface->ifaceToRelease); wined3d_mutex_lock(); + if (surface->wined3d_rtv) + wined3d_rendertarget_view_incref(surface->wined3d_rtv); if (surface->wined3d_surface) wined3d_surface_incref(surface->wined3d_surface); if (surface->wined3d_texture) @@ -526,6 +528,8 @@ surface, surface->ref7, surface->ref4, surface->ref3, surface->ref2, surface->ref1); } + if (surface->wined3d_rtv) + wined3d_rendertarget_view_decref(surface->wined3d_rtv); if (surface->wined3d_texture) wined3d_texture_decref(surface->wined3d_texture); if (surface->wined3d_surface) @@ -1011,12 +1015,9 @@ SetRect(&This->ddraw->primary_lock, 0, 0, This->surface_desc.dwWidth, This->surface_desc.dwHeight); } - /* Override the memory area. The pitch should be set already. Strangely windows - * does not set the LPSURFACE flag on locked surfaces !?!. - * DDSD->dwFlags |= DDSD_LPSURFACE; - */ - This->surface_desc.lpSurface = map_desc.data; + /* Windows does not set DDSD_LPSURFACE on locked surfaces. */ DD_STRUCT_COPY_BYSIZE(DDSD,&(This->surface_desc)); + DDSD->lpSurface = map_desc.data; TRACE("locked surface returning description :\n"); if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(DDSD); @@ -1161,12 +1162,8 @@ wined3d_mutex_lock(); hr = wined3d_surface_unmap(surface->wined3d_surface); - if (SUCCEEDED(hr)) - { - if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) - hr = ddraw_surface_update_frontbuffer(surface, &surface->ddraw->primary_lock, FALSE); - surface->surface_desc.lpSurface = NULL; - } + if (SUCCEEDED(hr) && surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) + hr = ddraw_surface_update_frontbuffer(surface, &surface->ddraw->primary_lock, FALSE); wined3d_mutex_unlock(); return hr; @@ -1215,11 +1212,12 @@ { struct ddraw_surface *dst_impl = impl_from_IDirectDrawSurface7(iface); struct ddraw_surface *src_impl = unsafe_impl_from_IDirectDrawSurface7(src); + struct wined3d_rendertarget_view *tmp_rtv, *src_rtv, *rtv; struct ddraw_texture *ddraw_texture, *prev_ddraw_texture; DDSCAPS2 caps = {DDSCAPS_FLIP, 0, 0, 0}; - struct wined3d_surface *tmp, *rt; struct wined3d_texture *texture; IDirectDrawSurface7 *current; + struct wined3d_surface *tmp; HRESULT hr; TRACE("iface %p, src %p, flags %#x.\n", iface, src, flags); @@ -1232,9 +1230,10 @@ wined3d_mutex_lock(); + tmp_rtv = ddraw_surface_get_rendertarget_view(dst_impl); tmp = dst_impl->wined3d_surface; texture = dst_impl->wined3d_texture; - rt = wined3d_device_get_render_target(dst_impl->ddraw->wined3d_device, 0); + rtv = wined3d_device_get_rendertarget_view(dst_impl->ddraw->wined3d_device, 0); ddraw_texture = wined3d_texture_get_parent(dst_impl->wined3d_texture); if (src_impl) @@ -1256,8 +1255,11 @@ } } - if (rt == dst_impl->wined3d_surface) - wined3d_device_set_render_target(dst_impl->ddraw->wined3d_device, 0, src_impl->wined3d_surface, FALSE); + src_rtv = ddraw_surface_get_rendertarget_view(src_impl); + if (rtv == dst_impl->wined3d_rtv) + wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE); + wined3d_rendertarget_view_set_parent(src_rtv, dst_impl); + dst_impl->wined3d_rtv = src_rtv; wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl); dst_impl->wined3d_surface = src_impl->wined3d_surface; prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); @@ -1283,8 +1285,11 @@ } src_impl = impl_from_IDirectDrawSurface7(current); - if (rt == dst_impl->wined3d_surface) - wined3d_device_set_render_target(dst_impl->ddraw->wined3d_device, 0, src_impl->wined3d_surface, FALSE); + src_rtv = ddraw_surface_get_rendertarget_view(src_impl); + if (rtv == dst_impl->wined3d_rtv) + wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, src_rtv, FALSE); + wined3d_rendertarget_view_set_parent(src_rtv, dst_impl); + dst_impl->wined3d_rtv = src_rtv; wined3d_resource_set_parent(wined3d_surface_get_resource(src_impl->wined3d_surface), dst_impl); dst_impl->wined3d_surface = src_impl->wined3d_surface; prev_ddraw_texture = wined3d_texture_get_parent(src_impl->wined3d_texture); @@ -1297,8 +1302,10 @@ /* We don't have to worry about potential texture bindings, since * flippable surfaces can never be textures. */ - if (rt == src_impl->wined3d_surface) - wined3d_device_set_render_target(dst_impl->ddraw->wined3d_device, 0, tmp, FALSE); + if (rtv == src_impl->wined3d_rtv) + wined3d_device_set_rendertarget_view(dst_impl->ddraw->wined3d_device, 0, tmp_rtv, FALSE); + wined3d_rendertarget_view_set_parent(tmp_rtv, src_impl); + src_impl->wined3d_rtv = tmp_rtv; wined3d_resource_set_parent(wined3d_surface_get_resource(tmp), src_impl); src_impl->wined3d_surface = tmp; wined3d_resource_set_parent(wined3d_texture_get_resource(texture), ddraw_texture); @@ -6224,6 +6231,7 @@ desc->u1.lPitch = wined3d_surface_get_pitch(wined3d_surface); } } + desc->lpSurface = NULL; wined3d_surface_incref(wined3d_surface); surface->wined3d_surface = wined3d_surface; @@ -6233,3 +6241,41 @@ return DD_OK; } + +static void STDMETHODCALLTYPE view_wined3d_object_destroyed(void *parent) +{ + struct ddraw_surface *surface = parent; + + /* If the surface reference count drops to zero, we release our reference + * to the view, but don't clear the pointer yet, in case e.g. a + * GetRenderTarget() call brings the surface back before the view is + * actually destroyed. When the view is destroyed, we need to clear the + * pointer, or a subsequent surface AddRef() would reference it again. + * + * This is safe because as long as the view still has a reference to the + * texture, the surface is also still alive, and we're called before the + * view releases that reference. */ + surface->wined3d_rtv = NULL; +} + +static const struct wined3d_parent_ops ddraw_view_wined3d_parent_ops = +{ + view_wined3d_object_destroyed, +}; + +struct wined3d_rendertarget_view *ddraw_surface_get_rendertarget_view(struct ddraw_surface *surface) +{ + HRESULT hr; + + if (surface->wined3d_rtv) + return surface->wined3d_rtv; + + if (FAILED(hr = wined3d_rendertarget_view_create_from_surface(surface->wined3d_surface, + surface, &ddraw_view_wined3d_parent_ops, &surface->wined3d_rtv))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return NULL; + } + + return surface->wined3d_rtv; +} diff -Nru wine1.7-1.7.24/dlls/ddraw/tests/d3d.c wine1.7-1.7.25/dlls/ddraw/tests/d3d.c --- wine1.7-1.7.24/dlls/ddraw/tests/d3d.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/tests/d3d.c 2014-08-22 18:39:55.000000000 +0000 @@ -537,12 +537,18 @@ ok(hal->dcmColorModel == 0, "RGB Device %u hal caps has colormodel %u\n", ver, hal->dcmColorModel); ok(hel->dcmColorModel == D3DCOLOR_RGB, "RGB Device %u hel caps has colormodel %u\n", ver, hel->dcmColorModel); + + ok(hal->dwFlags == 0, "RGB Device %u hal caps has hardware flags %x\n", ver, hal->dwFlags); + ok(hel->dwFlags != 0, "RGB Device %u hel caps has hardware flags %x\n", ver, hel->dwFlags); } else if(IsEqualGUID(&IID_IDirect3DHALDevice, Guid)) { trace("HAL Device %d\n", ver); ok(hal->dcmColorModel == D3DCOLOR_RGB, "HAL Device %u hal caps has colormodel %u\n", ver, hel->dcmColorModel); ok(hel->dcmColorModel == 0, "HAL Device %u hel caps has colormodel %u\n", ver, hel->dcmColorModel); + + ok(hal->dwFlags != 0, "HAL Device %u hal caps has hardware flags %x\n", ver, hal->dwFlags); + ok(hel->dwFlags != 0, "HAL Device %u hel caps has hardware flags %x\n", ver, hel->dwFlags); } else if(IsEqualGUID(&IID_IDirect3DRefDevice, Guid)) { @@ -587,6 +593,9 @@ ok(hal->dcmColorModel == 0, "Ramp Device %u hal caps has colormodel %u\n", ver, hal->dcmColorModel); ok(hel->dcmColorModel == D3DCOLOR_MONO, "Ramp Device %u hel caps has colormodel %u\n", ver, hel->dcmColorModel); + + ok(hal->dwFlags == 0, "Ramp Device %u hal caps has hardware flags %x\n", ver, hal->dwFlags); + ok(hel->dwFlags != 0, "Ramp Device %u hel caps has hardware flags %x\n", ver, hel->dwFlags); } else if(IsEqualGUID(&IID_IDirect3DMMXDevice, Guid)) { @@ -610,6 +619,9 @@ ok(hal->dcmColorModel == 0, "MMX Device %u hal caps has colormodel %u\n", ver, hal->dcmColorModel); ok(hel->dcmColorModel == D3DCOLOR_RGB, "MMX Device %u hel caps has colormodel %u\n", ver, hel->dcmColorModel); + + ok(hal->dwFlags == 0, "MMX Device %u hal caps has hardware flags %x\n", ver, hal->dwFlags); + ok(hel->dwFlags != 0, "MMX Device %u hel caps has hardware flags %x\n", ver, hel->dwFlags); } else { @@ -1236,14 +1248,6 @@ &i); ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr); - transformdata.lpHOut = outH; - memset(outH, 0xcc, sizeof(outH)); - hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]), - &transformdata, D3DTRANSFORM_UNCLIPPED, - &i); - ok(hr == D3D_OK, "IDirect3DViewport_TransformVertices returned %08x\n", hr); - ok(i == 0, "Offscreen is %d\n", i); - for(i = 0; i < sizeof(testverts) / sizeof(testverts[0]); i++) { static const struct v_out cmp[] = { {128.0, 128.0, 0.0, 1}, {129.0, 127.0, 1.0, 1}, {127.0, 129.0, -1, 1}, @@ -1256,12 +1260,6 @@ out[i].x, out[i].y, out[i].z, out[i].rhw, cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw); } - for(i = 0; i < sizeof(outH); i++) { - if(((unsigned char *) outH)[i] != 0xcc) { - ok(FALSE, "Homogeneous output was generated despite UNCLIPPED flag\n"); - break; - } - } SET_VP_DATA(vp_data); hr = IDirect3DViewport_SetViewport(Viewport, &vp_data); @@ -1306,6 +1304,7 @@ cmp[i].x, cmp[i].y, cmp[i].z, cmp[i].rhw); } + transformdata.lpHOut = outH; memset(out, 0xcc, sizeof(out)); hr = IDirect3DViewport_TransformVertices(Viewport, sizeof(testverts) / sizeof(testverts[0]), &transformdata, D3DTRANSFORM_CLIPPED, diff -Nru wine1.7-1.7.24/dlls/ddraw/tests/ddraw1.c wine1.7-1.7.25/dlls/ddraw/tests/ddraw1.c --- wine1.7-1.7.24/dlls/ddraw/tests/ddraw1.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/tests/ddraw1.c 2014-08-22 18:39:55.000000000 +0000 @@ -4576,6 +4576,7 @@ ok(U1(surface_desc).lPitch == test_data[i].pitch_out32, "Test %u: Got unexpected pitch %u, expected %u.\n", i, U1(surface_desc).lPitch, test_data[i].pitch_out32); + ok(!surface_desc.lpSurface, "Test %u: Got unexpected lpSurface %p.\n", i, surface_desc.lpSurface); IDirectDrawSurface_Release(surface); } @@ -5575,6 +5576,62 @@ DestroyWindow(window); } +static void test_surface_desc_lock(void) +{ + IDirectDrawSurface *surface; + DDSURFACEDESC surface_desc; + IDirectDraw *ddraw; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.dwWidth = 16; + surface_desc.dwHeight = 16; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_Lock(surface, NULL, &surface_desc, 0, NULL); + ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr); + ok(surface_desc.lpSurface != NULL, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + hr = IDirectDrawSurface_Unlock(surface, NULL); + ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + IDirectDrawSurface_Release(surface); + refcount = IDirectDraw_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw1) { IDirectDraw *ddraw; @@ -5626,4 +5683,5 @@ test_palette_gdi(); test_palette_alpha(); test_lost_device(); + test_surface_desc_lock(); } diff -Nru wine1.7-1.7.24/dlls/ddraw/tests/ddraw2.c wine1.7-1.7.25/dlls/ddraw/tests/ddraw2.c --- wine1.7-1.7.24/dlls/ddraw/tests/ddraw2.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/tests/ddraw2.c 2014-08-22 18:39:55.000000000 +0000 @@ -5652,6 +5652,7 @@ ok(U1(surface_desc).lPitch == test_data[i].pitch_out32, "Test %u: Got unexpected pitch %u, expected %u.\n", i, U1(surface_desc).lPitch, test_data[i].pitch_out32); + ok(!surface_desc.lpSurface, "Test %u: Got unexpected lpSurface %p.\n", i, surface_desc.lpSurface); IDirectDrawSurface_Release(surface); } @@ -6651,6 +6652,62 @@ DestroyWindow(window); } +static void test_surface_desc_lock(void) +{ + IDirectDrawSurface *surface; + DDSURFACEDESC surface_desc; + IDirectDraw2 *ddraw; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.dwWidth = 16; + surface_desc.dwHeight = 16; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_Lock(surface, NULL, &surface_desc, 0, NULL); + ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr); + ok(surface_desc.lpSurface != NULL, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + hr = IDirectDrawSurface_Unlock(surface, NULL); + ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + IDirectDrawSurface_Release(surface); + refcount = IDirectDraw2_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw2) { IDirectDraw2 *ddraw; @@ -6708,4 +6765,5 @@ test_palette_gdi(); test_palette_alpha(); test_lost_device(); + test_surface_desc_lock(); } diff -Nru wine1.7-1.7.24/dlls/ddraw/tests/ddraw4.c wine1.7-1.7.25/dlls/ddraw/tests/ddraw4.c --- wine1.7-1.7.24/dlls/ddraw/tests/ddraw4.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/tests/ddraw4.c 2014-08-22 18:39:55.000000000 +0000 @@ -6649,6 +6649,7 @@ ok(U1(surface_desc).lPitch == test_data[i].pitch_out32, "Test %u: Got unexpected pitch %u, expected %u.\n", i, U1(surface_desc).lPitch, test_data[i].pitch_out32); + ok(!surface_desc.lpSurface, "Test %u: Got unexpected lpSurface %p.\n", i, surface_desc.lpSurface); IDirectDrawSurface4_Release(surface); } @@ -7726,6 +7727,62 @@ DestroyWindow(window); } +static void test_surface_desc_lock(void) +{ + IDirectDrawSurface4 *surface; + DDSURFACEDESC2 surface_desc; + IDirectDraw4 *ddraw; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.dwWidth = 16; + surface_desc.dwHeight = 16; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface4_Lock(surface, NULL, &surface_desc, 0, NULL); + ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr); + ok(surface_desc.lpSurface != NULL, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + hr = IDirectDrawSurface4_Unlock(surface, NULL); + ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + IDirectDrawSurface4_Release(surface); + refcount = IDirectDraw4_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw4) { IDirectDraw4 *ddraw; @@ -7790,4 +7847,5 @@ test_palette_alpha(); test_vb_writeonly(); test_lost_device(); + test_surface_desc_lock(); } diff -Nru wine1.7-1.7.24/dlls/ddraw/tests/ddraw7.c wine1.7-1.7.25/dlls/ddraw/tests/ddraw7.c --- wine1.7-1.7.24/dlls/ddraw/tests/ddraw7.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/tests/ddraw7.c 2014-08-22 18:39:55.000000000 +0000 @@ -6472,6 +6472,7 @@ ok(U1(surface_desc).lPitch == test_data[i].pitch_out32, "Test %u: Got unexpected pitch %u, expected %u.\n", i, U1(surface_desc).lPitch, test_data[i].pitch_out32); + ok(!surface_desc.lpSurface, "Test %u: Got unexpected lpSurface %p.\n", i, surface_desc.lpSurface); IDirectDrawSurface7_Release(surface); } @@ -7569,6 +7570,62 @@ DestroyWindow(window); } +static void test_surface_desc_lock(void) +{ + IDirectDrawSurface7 *surface; + DDSURFACEDESC2 surface_desc; + IDirectDraw7 *ddraw; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.dwWidth = 16; + surface_desc.dwHeight = 16; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface7_Lock(surface, NULL, &surface_desc, 0, NULL); + ok(SUCCEEDED(hr), "Failed to lock surface, hr %#x.\n", hr); + ok(surface_desc.lpSurface != NULL, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + hr = IDirectDrawSurface7_Unlock(surface, NULL); + ok(SUCCEEDED(hr), "Failed to unlock surface, hr %#x.\n", hr); + + memset(&surface_desc, 0xaa, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); + ok(!surface_desc.lpSurface, "Got unexpected lpSurface %p.\n", surface_desc.lpSurface); + + IDirectDrawSurface7_Release(surface); + refcount = IDirectDraw7_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); @@ -7641,4 +7698,5 @@ test_vb_writeonly(); test_lost_device(); test_resource_priority(); + test_surface_desc_lock(); } diff -Nru wine1.7-1.7.24/dlls/ddraw/tests/dsurface.c wine1.7-1.7.25/dlls/ddraw/tests/dsurface.c --- wine1.7-1.7.24/dlls/ddraw/tests/dsurface.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ddraw/tests/dsurface.c 2014-08-22 18:39:55.000000000 +0000 @@ -217,7 +217,7 @@ { IDirectDrawSurface *lpSrc; IDirectDrawSurface *lpDst; - DDSURFACEDESC ddsd, ddsd2, ddsd3; + DDSURFACEDESC ddsd, ddsd2; DDCOLORKEY DDColorKey; LPDWORD lpData; HRESULT rc; @@ -264,23 +264,9 @@ lpData[2] = 0xCCCCCCCC; lpData[3] = 0xCCCCCCCC; - memset(&ddsd3, 0, sizeof(ddsd3)); - ddsd3.dwSize = sizeof(ddsd3); - ddsd3.ddpfPixelFormat.dwSize = sizeof(ddsd3.ddpfPixelFormat); - rc = IDirectDrawSurface_GetSurfaceDesc(lpDst, &ddsd3); - ok(rc == DD_OK, "IDirectDrawSurface_GetSurfaceDesc between a lock/unlock pair returned %08x\n", rc); - ok(ddsd3.lpSurface == ddsd3.lpSurface, "lpSurface from GetSurfaceDesc(%p) differs from the one returned by Lock(%p)\n", ddsd3.lpSurface, ddsd2.lpSurface); - rc = IDirectDrawSurface_Unlock(lpDst, NULL); ok(rc==DD_OK,"Unlock returned: %x\n",rc); - memset(&ddsd3, 0, sizeof(ddsd3)); - ddsd3.dwSize = sizeof(ddsd3); - ddsd3.ddpfPixelFormat.dwSize = sizeof(ddsd3.ddpfPixelFormat); - rc = IDirectDrawSurface_GetSurfaceDesc(lpDst, &ddsd3); - ok(rc == DD_OK, "IDirectDrawSurface_GetSurfaceDesc between a lock/unlock pair returned %08x\n", rc); - ok(ddsd3.lpSurface == NULL, "lpSurface from GetSurfaceDesc(%p) is not NULL after unlock\n", ddsd3.lpSurface); - rc = IDirectDrawSurface_Lock(lpSrc, NULL, &ddsd2, DDLOCK_WAIT, NULL); ok(rc==DD_OK,"Lock returned: %x\n",rc); ok((ddsd2.dwFlags & DDSD_LPSURFACE) == 0, "Surface desc has LPSURFACE Flags set\n"); diff -Nru wine1.7-1.7.24/dlls/dwmapi/dwmapi_main.c wine1.7-1.7.25/dlls/dwmapi/dwmapi_main.c --- wine1.7-1.7.24/dlls/dwmapi/dwmapi_main.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwmapi/dwmapi_main.c 2014-08-22 18:39:55.000000000 +0000 @@ -108,6 +108,18 @@ } /********************************************************************** + * DwmInvalidateIconicBitmaps (DWMAPI.@) + */ +HRESULT WINAPI DwmInvalidateIconicBitmaps(HWND hwnd) +{ + static BOOL once; + + if (!once++) FIXME("(%p) stub\n", hwnd); + + return E_NOTIMPL; +} + +/********************************************************************** * DwmSetWindowAttribute (DWMAPI.@) */ HRESULT WINAPI DwmSetWindowAttribute(HWND hwnd, DWORD attributenum, LPCVOID attribute, DWORD size) diff -Nru wine1.7-1.7.24/dlls/dwmapi/dwmapi.spec wine1.7-1.7.25/dlls/dwmapi/dwmapi.spec --- wine1.7-1.7.24/dlls/dwmapi/dwmapi.spec 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwmapi/dwmapi.spec 2014-08-22 18:39:55.000000000 +0000 @@ -33,6 +33,7 @@ @ stdcall DwmGetGraphicsStreamTransformHint(long ptr) @ stdcall DwmGetTransportAttributes(ptr ptr ptr) @ stdcall DwmGetWindowAttribute(ptr long ptr long) +@ stdcall DwmInvalidateIconicBitmaps(ptr) @ stdcall DwmIsCompositionEnabled(ptr) @ stub DwmModifyPreviousDxFrameDuration @ stub DwmQueryThumbnailSourceSize diff -Nru wine1.7-1.7.24/dlls/dwrite/dwrite_private.h wine1.7-1.7.25/dlls/dwrite/dwrite_private.h --- wine1.7-1.7.24/dlls/dwrite/dwrite_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/dwrite_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -89,3 +89,9 @@ extern HRESULT get_system_fontcollection(IDWriteFontCollection**) DECLSPEC_HIDDEN; extern void release_system_fontcollection(void) DECLSPEC_HIDDEN; extern HRESULT get_textanalyzer(IDWriteTextAnalyzer**) DECLSPEC_HIDDEN; +extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN; +extern HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace **font_face) DECLSPEC_HIDDEN; + +/* Opentype font table functions */ +extern HRESULT analyze_opentype_font(const void* font_data, UINT32* font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type, BOOL *supported) DECLSPEC_HIDDEN; +extern HRESULT find_font_table(IDWriteFontFileStream *stream, UINT32 font_index, UINT32 tag, const void** table_data, void** table_context, UINT32 *table_size, BOOL* found) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.24/dlls/dwrite/font.c wine1.7-1.7.25/dlls/dwrite/font.c --- wine1.7-1.7.24/dlls/dwrite/font.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/font.c 2014-08-22 18:39:55.000000000 +0000 @@ -146,6 +146,7 @@ IDWriteFont IDWriteFont_iface; LONG ref; + BOOL is_system; IDWriteFontFamily *family; IDWriteFontFace *face; DWRITE_FONT_STYLE style; @@ -155,13 +156,38 @@ WCHAR *facename; }; +#define DWRITE_FONTTABLE_MAGIC 0xededfafa + +struct dwrite_fonttable { + UINT32 magic; + LPVOID context; + UINT32 file_index; +}; + struct dwrite_fontface { IDWriteFontFace IDWriteFontFace_iface; LONG ref; + DWRITE_FONT_FACE_TYPE type; + UINT32 file_count; + IDWriteFontFile ** files; + DWRITE_FONT_SIMULATIONS simulations; + UINT32 index; + + BOOL is_system; LOGFONTW logfont; }; +struct dwrite_fontfile { + IDWriteFontFile IDWriteFontFile_iface; + LONG ref; + + IDWriteFontFileLoader *loader; + void *reference_key; + UINT32 key_size; + IDWriteFontFileStream *stream; +}; + static HRESULT create_fontfamily(const WCHAR *familyname, IDWriteFontFamily **family); static inline struct dwrite_fontface *impl_from_IDWriteFontFace(IDWriteFontFace *iface) @@ -174,6 +200,11 @@ return CONTAINING_RECORD(iface, struct dwrite_font, IDWriteFont_iface); } +static inline struct dwrite_fontfile *impl_from_IDWriteFontFile(IDWriteFontFile *iface) +{ + return CONTAINING_RECORD(iface, struct dwrite_fontfile, IDWriteFontFile_iface); +} + static inline struct dwrite_fontfamily *impl_from_IDWriteFontFamily(IDWriteFontFamily *iface) { return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontFamily_iface); @@ -184,6 +215,25 @@ return CONTAINING_RECORD(iface, struct dwrite_fontcollection, IDWriteFontCollection_iface); } +static HRESULT WINAPI _dwritefontfile_GetFontFileStream(IDWriteFontFile *iface, IDWriteFontFileStream **stream) +{ + HRESULT hr; + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + if (!This->stream) + { + hr = IDWriteFontFileLoader_CreateStreamFromKey(This->loader, This->reference_key, This->key_size, &This->stream); + if (FAILED(hr)) + return hr; + } + if (This->stream) + { + IDWriteFontFileStream_AddRef(This->stream); + *stream = This->stream; + return S_OK; + } + return E_FAIL; +} + static HRESULT WINAPI dwritefontface_QueryInterface(IDWriteFontFace *iface, REFIID riid, void **obj) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); @@ -217,7 +267,13 @@ TRACE("(%p)->(%d)\n", This, ref); if (!ref) + { + int i; + for (i = 0; i < This->file_count; i++) + IDWriteFontFile_Release(This->files[i]); + heap_free(This->files); heap_free(This); + } return ref; } @@ -225,30 +281,45 @@ static DWRITE_FONT_FACE_TYPE WINAPI dwritefontface_GetType(IDWriteFontFace *iface) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FONT_FACE_TYPE_UNKNOWN; + TRACE("(%p)\n", This); + return This->type; } static HRESULT WINAPI dwritefontface_GetFiles(IDWriteFontFace *iface, UINT32 *number_of_files, IDWriteFontFile **fontfiles) { + int i; struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - FIXME("(%p)->(%p %p): stub\n", This, number_of_files, fontfiles); - return E_NOTIMPL; + TRACE("(%p)->(%p %p)\n", This, number_of_files, fontfiles); + if (fontfiles == NULL) + { + *number_of_files = This->file_count; + return S_OK; + } + if (*number_of_files < This->file_count) + return E_INVALIDARG; + + for (i = 0; i < This->file_count; i++) + { + IDWriteFontFile_AddRef(This->files[i]); + fontfiles[i] = This->files[i]; + } + + return S_OK; } static UINT32 WINAPI dwritefontface_GetIndex(IDWriteFontFace *iface) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - FIXME("(%p): stub\n", This); - return 0; + TRACE("(%p)\n", This); + return This->index; } static DWRITE_FONT_SIMULATIONS WINAPI dwritefontface_GetSimulations(IDWriteFontFace *iface) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FONT_SIMULATIONS_NONE; + TRACE("(%p)\n", This); + return This->simulations; } static BOOL WINAPI dwritefontface_IsSymbolFont(IDWriteFontFace *iface) @@ -283,44 +354,103 @@ UINT32 count, UINT16 *glyph_indices) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - HFONT hfont; - WCHAR *str; - HDC hdc; - unsigned int i; + if (This->is_system) + { + HFONT hfont; + WCHAR *str; + HDC hdc; + unsigned int i; - TRACE("(%p)->(%p %u %p)\n", This, codepoints, count, glyph_indices); + TRACE("(%p)->(%p %u %p)\n", This, codepoints, count, glyph_indices); - str = heap_alloc(count*sizeof(WCHAR)); - if (!str) return E_OUTOFMEMORY; + str = heap_alloc(count*sizeof(WCHAR)); + if (!str) return E_OUTOFMEMORY; - for (i = 0; i < count; i++) - str[i] = codepoints[i] < 0x10000 ? codepoints[i] : '?'; + for (i = 0; i < count; i++) + str[i] = codepoints[i] < 0x10000 ? codepoints[i] : '?'; - hdc = CreateCompatibleDC(0); - hfont = CreateFontIndirectW(&This->logfont); - SelectObject(hdc, hfont); + hdc = CreateCompatibleDC(0); + hfont = CreateFontIndirectW(&This->logfont); + SelectObject(hdc, hfont); - GetGlyphIndicesW(hdc, str, count, glyph_indices, 0); - heap_free(str); + GetGlyphIndicesW(hdc, str, count, glyph_indices, 0); + heap_free(str); - DeleteDC(hdc); - DeleteObject(hfont); + DeleteDC(hdc); + DeleteObject(hfont); - return S_OK; + return S_OK; + } + else + { + FIXME("(%p)->(%p %u %p): Stub\n", This, codepoints, count, glyph_indices); + return E_NOTIMPL; + } } static HRESULT WINAPI dwritefontface_TryGetFontTable(IDWriteFontFace *iface, UINT32 table_tag, const void **table_data, UINT32 *table_size, void **context, BOOL *exists) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - FIXME("(%p)->(%u %p %p %p %p): stub\n", This, table_tag, table_data, table_size, context, exists); - return E_NOTIMPL; + if (This->is_system) + { + FIXME("(%p)->(%u %p %p %p %p): stub\n", This, table_tag, table_data, table_size, context, exists); + return E_NOTIMPL; + } + else + { + HRESULT hr = S_OK; + int i; + struct dwrite_fonttable *table; + + TRACE("(%p)->(%u %p %p %p %p)\n", This, table_tag, table_data, table_size, context, exists); + + table = heap_alloc(sizeof(struct dwrite_fonttable)); + table->magic = DWRITE_FONTTABLE_MAGIC; + if (!table) + return E_OUTOFMEMORY; + + *exists = FALSE; + for (i = 0; i < This->file_count && !(*exists); i++) + { + IDWriteFontFileStream *stream; + hr = _dwritefontfile_GetFontFileStream(This->files[i], &stream); + if (FAILED(hr)) + continue; + table->file_index = i; + + hr = find_font_table(stream, This->index, table_tag, table_data, &table->context, table_size, exists); + + IDWriteFontFileStream_Release(stream); + } + if (FAILED(hr) && !*exists) + heap_free(table); + else + *context = (LPVOID)table; + return hr; + } } static void WINAPI dwritefontface_ReleaseFontTable(IDWriteFontFace *iface, void *table_context) { struct dwrite_fontface *This = impl_from_IDWriteFontFace(iface); - FIXME("(%p)->(%p): stub\n", This, table_context); + struct dwrite_fonttable *table = (struct dwrite_fonttable *)table_context; + IDWriteFontFileStream *stream; + HRESULT hr; + TRACE("(%p)->(%p)\n", This, table_context); + + if (table->magic != DWRITE_FONTTABLE_MAGIC) + { + TRACE("Invalid table magic\n"); + return; + } + + hr = _dwritefontfile_GetFontFileStream(This->files[table->file_index], &stream); + if (FAILED(hr)) + return; + IDWriteFontFileStream_ReleaseFileFragment(stream, table->context); + IDWriteFontFileStream_Release(stream); + heap_free(table); } static HRESULT WINAPI dwritefontface_GetGlyphRunOutline(IDWriteFontFace *iface, FLOAT emSize, @@ -380,7 +510,7 @@ dwritefontface_GetGdiCompatibleGlyphMetrics }; -static HRESULT create_fontface(struct dwrite_font *font, IDWriteFontFace **face) +static HRESULT create_system_fontface(struct dwrite_font *font, IDWriteFontFace **face) { struct dwrite_fontface *This; @@ -391,7 +521,13 @@ This->IDWriteFontFace_iface.lpVtbl = &dwritefontfacevtbl; This->ref = 1; + This->type = DWRITE_FONT_FACE_TYPE_UNKNOWN; + This->file_count = 0; + This->files = NULL; + This->index = 0; + This->simulations = DWRITE_FONT_SIMULATIONS_NONE; + This->is_system = TRUE; memset(&This->logfont, 0, sizeof(This->logfont)); This->logfont.lfItalic = font->style == DWRITE_FONT_STYLE_ITALIC; /* weight values from DWRITE_FONT_WEIGHT match values used for LOGFONT */ @@ -534,18 +670,31 @@ { struct dwrite_font *This = impl_from_IDWriteFont(iface); - TRACE("(%p)->(%p)\n", This, face); - - if (!This->face) + if (This->is_system) { - HRESULT hr = create_fontface(This, &This->face); - if (FAILED(hr)) return hr; - } + TRACE("(%p)->(%p)\n", This, face); - *face = This->face; - IDWriteFontFace_AddRef(*face); + if (!This->face) + { + HRESULT hr = create_system_fontface(This, &This->face); + if (FAILED(hr)) return hr; + } - return S_OK; + *face = This->face; + IDWriteFontFace_AddRef(*face); + + return S_OK; + } + else + { + TRACE("(%p)->(%p)\n", This, face); + if (This->face) + { + *face = This->face; + IDWriteFontFace_AddRef(*face); + } + return S_OK; + } } static const IDWriteFontVtbl dwritefontvtbl = { @@ -970,6 +1119,7 @@ This->IDWriteFont_iface.lpVtbl = &dwritefontvtbl; This->ref = 1; This->face = NULL; + This->is_system = TRUE; This->family = family; This->style = logfont->lfItalic ? DWRITE_FONT_STYLE_ITALIC : DWRITE_FONT_STYLE_NORMAL; This->facename = heap_strdupW(logfont->lfFaceName); @@ -978,3 +1128,171 @@ return S_OK; } + +static HRESULT WINAPI dwritefontfile_QueryInterface(IDWriteFontFile *iface, REFIID riid, void **obj) +{ + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteFontFile)) + { + *obj = iface; + IDWriteFontFile_AddRef(iface); + return S_OK; + } + + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI dwritefontfile_AddRef(IDWriteFontFile *iface) +{ + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI dwritefontfile_Release(IDWriteFontFile *iface) +{ + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IDWriteFontFileLoader_Release(This->loader); + if (This->stream) IDWriteFontFileStream_Release(This->stream); + heap_free(This->reference_key); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI dwritefontfile_GetReferenceKey(IDWriteFontFile *iface, const void **fontFileReferenceKey, UINT32 *fontFileReferenceKeySize) +{ + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + TRACE("(%p)->(%p, %p)\n", This, fontFileReferenceKey, fontFileReferenceKeySize); + *fontFileReferenceKey = This->reference_key; + *fontFileReferenceKeySize = This->key_size; + + return S_OK; +} + +static HRESULT WINAPI dwritefontfile_GetLoader(IDWriteFontFile *iface, IDWriteFontFileLoader **fontFileLoader) +{ + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + TRACE("(%p)->(%p)\n", This, fontFileLoader); + *fontFileLoader = This->loader; + IDWriteFontFileLoader_AddRef(This->loader); + + return S_OK; +} + +static HRESULT WINAPI dwritefontfile_Analyze(IDWriteFontFile *iface, BOOL *isSupportedFontType, DWRITE_FONT_FILE_TYPE *fontFileType, DWRITE_FONT_FACE_TYPE *fontFaceType, UINT32 *numberOfFaces) +{ + HRESULT hr; + const void *font_data; + void *context; + IDWriteFontFileStream *stream; + + struct dwrite_fontfile *This = impl_from_IDWriteFontFile(iface); + FIXME("(%p)->(%p, %p, %p, %p): Stub\n", This, isSupportedFontType, fontFileType, fontFaceType, numberOfFaces); + + *isSupportedFontType = FALSE; + *fontFileType = DWRITE_FONT_FILE_TYPE_UNKNOWN; + if (fontFaceType) + *fontFaceType = DWRITE_FONT_FACE_TYPE_UNKNOWN; + *numberOfFaces = 0; + + hr = IDWriteFontFileLoader_CreateStreamFromKey(This->loader, This->reference_key, This->key_size, &stream); + if (FAILED(hr)) + return S_OK; + hr = IDWriteFontFileStream_ReadFileFragment(stream, &font_data, 0, 28, &context); + if (SUCCEEDED(hr)) + { + hr = analyze_opentype_font(font_data, numberOfFaces, fontFileType, fontFaceType, isSupportedFontType); + IDWriteFontFileStream_ReleaseFileFragment(stream, context); + } + /* TODO: Further Analysis */ + IDWriteFontFileStream_Release(stream); + return S_OK; +} + +static const IDWriteFontFileVtbl dwritefontfilevtbl = { + dwritefontfile_QueryInterface, + dwritefontfile_AddRef, + dwritefontfile_Release, + dwritefontfile_GetReferenceKey, + dwritefontfile_GetLoader, + dwritefontfile_Analyze, +}; + +HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) +{ + struct dwrite_fontfile *This; + + This = heap_alloc(sizeof(struct dwrite_fontfile)); + if (!This) return E_OUTOFMEMORY; + + This->IDWriteFontFile_iface.lpVtbl = &dwritefontfilevtbl; + This->ref = 1; + IDWriteFontFileLoader_AddRef(loader); + This->loader = loader; + This->stream = NULL; + This->reference_key = heap_alloc(key_size); + memcpy(This->reference_key, reference_key, key_size); + This->key_size = key_size; + + *font_file = &This->IDWriteFontFile_iface; + + return S_OK; +} + +HRESULT font_create_fontface(IDWriteFactory *iface, DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace **font_face) +{ + int i; + struct dwrite_fontface *This; + HRESULT hr = S_OK; + + *font_face = NULL; + + This = heap_alloc(sizeof(struct dwrite_fontface)); + if (!This) return E_OUTOFMEMORY; + + This->IDWriteFontFace_iface.lpVtbl = &dwritefontfacevtbl; + This->ref = 1; + This->type = facetype; + This->file_count = files_number; + This->files = heap_alloc(sizeof(*This->files) * files_number); + /* Verify font file streams */ + for (i = 0; i < This->file_count && SUCCEEDED(hr); i++) + { + IDWriteFontFileStream *stream; + hr = _dwritefontfile_GetFontFileStream(font_files[i], &stream); + if (SUCCEEDED(hr)) + IDWriteFontFileStream_Release(stream); + } + if (FAILED(hr)) + { + heap_free(This->files); + heap_free(This); + return hr; + } + for (i = 0; i < This->file_count; i++) + { + This->files[i] = font_files[i]; + IDWriteFontFile_AddRef(font_files[i]); + } + + This->index = index; + This->simulations = sim_flags; + This->is_system = FALSE; + + *font_face = &This->IDWriteFontFace_iface; + + return S_OK; +} diff -Nru wine1.7-1.7.24/dlls/dwrite/layout.c wine1.7-1.7.25/dlls/dwrite/layout.c --- wine1.7-1.7.24/dlls/dwrite/layout.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/layout.c 2014-08-22 18:39:55.000000000 +0000 @@ -1,7 +1,7 @@ /* * Text format and layout * - * Copyright 2012 Nikolay Sivov for CodeWeavers + * Copyright 2012, 2014 Nikolay Sivov for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,6 +27,7 @@ #include "wingdi.h" #include "dwrite.h" #include "dwrite_private.h" +#include "wine/list.h" WINE_DEFAULT_DEBUG_CHANNEL(dwrite); @@ -57,6 +58,38 @@ IDWriteFontCollection *collection; }; +enum layout_range_attr_kind { + LAYOUT_RANGE_ATTR_WEIGHT, + LAYOUT_RANGE_ATTR_STYLE, + LAYOUT_RANGE_ATTR_EFFECT, + LAYOUT_RANGE_ATTR_INLINE, + LAYOUT_RANGE_ATTR_UNDERLINE, + LAYOUT_RANGE_ATTR_STRIKETHROUGH +}; + +struct layout_range_attr_value { + DWRITE_TEXT_RANGE range; + union { + DWRITE_FONT_WEIGHT weight; + DWRITE_FONT_STYLE style; + IDWriteInlineObject *object; + IUnknown *effect; + BOOL underline; + BOOL strikethrough; + } u; +}; + +struct layout_range { + struct list entry; + DWRITE_TEXT_RANGE range; + DWRITE_FONT_WEIGHT weight; + DWRITE_FONT_STYLE style; + IDWriteInlineObject *object; + IUnknown *effect; + BOOL underline; + BOOL strikethrough; +}; + struct dwrite_textlayout { IDWriteTextLayout IDWriteTextLayout_iface; LONG ref; @@ -66,6 +99,7 @@ struct dwrite_textformat_data format; FLOAT maxwidth; FLOAT maxheight; + struct list ranges; }; struct dwrite_textformat { @@ -109,6 +143,317 @@ return CONTAINING_RECORD(iface, struct dwrite_trimmingsign, IDWriteInlineObject_iface); } +/* To be used in IDWriteTextLayout methods to validate and fix passed range */ +static inline BOOL validate_text_range(struct dwrite_textlayout *layout, DWRITE_TEXT_RANGE *r) +{ + if (r->startPosition >= layout->len) + return FALSE; + + if (r->startPosition + r->length > layout->len) + r->length = layout->len - r->startPosition; + + return TRUE; +} + +static BOOL is_same_layout_attrvalue(struct layout_range const *range, enum layout_range_attr_kind attr, struct layout_range_attr_value *value) +{ + switch (attr) { + case LAYOUT_RANGE_ATTR_WEIGHT: + return range->weight == value->u.weight; + case LAYOUT_RANGE_ATTR_STYLE: + return range->style == value->u.style; + case LAYOUT_RANGE_ATTR_INLINE: + return range->object == value->u.object; + case LAYOUT_RANGE_ATTR_EFFECT: + return range->effect == value->u.effect; + case LAYOUT_RANGE_ATTR_UNDERLINE: + return range->underline == value->u.underline; + case LAYOUT_RANGE_ATTR_STRIKETHROUGH: + return range->strikethrough == value->u.strikethrough; + default: + ; + } + + return FALSE; +} + +static inline BOOL is_same_layout_attributes(struct layout_range const *left, struct layout_range const *right) +{ + return left->weight == right->weight && + left->style == right->style && + left->object == right->object && + left->effect == right->effect && + left->underline == right->underline && + left->strikethrough == right->strikethrough; +} + +static inline BOOL is_same_text_range(const DWRITE_TEXT_RANGE *left, const DWRITE_TEXT_RANGE *right) +{ + return left->startPosition == right->startPosition && left->length == right->length; +} + +/* Allocates range and inits it with default values from text format. */ +static struct layout_range *alloc_layout_range(struct dwrite_textlayout *layout, const DWRITE_TEXT_RANGE *r) +{ + struct layout_range *range; + + range = heap_alloc(sizeof(*range)); + if (!range) return NULL; + + range->range = *r; + range->weight = layout->format.weight; + range->style = layout->format.style; + range->object = NULL; + range->effect = NULL; + range->underline = FALSE; + range->strikethrough = FALSE; + + return range; +} + +static struct layout_range *alloc_layout_range_from(struct layout_range *from, const DWRITE_TEXT_RANGE *r) +{ + struct layout_range *range; + + range = heap_alloc(sizeof(*range)); + if (!range) return NULL; + + *range = *from; + range->range = *r; + + /* update refcounts */ + if (range->object) + IDWriteInlineObject_AddRef(range->object); + if (range->effect) + IUnknown_AddRef(range->effect); + + return range; +} + +static void free_layout_range(struct layout_range *range) +{ + if (range->object) + IDWriteInlineObject_Release(range->object); + if (range->effect) + IUnknown_Release(range->effect); + heap_free(range); +} + +static void free_layout_ranges_list(struct dwrite_textlayout *layout) +{ + struct layout_range *cur, *cur2; + LIST_FOR_EACH_ENTRY_SAFE(cur, cur2, &layout->ranges, struct layout_range, entry) { + list_remove(&cur->entry); + free_layout_range(cur); + } +} + +static struct layout_range *find_outer_range(struct dwrite_textlayout *layout, const DWRITE_TEXT_RANGE *range) +{ + struct layout_range *cur; + + LIST_FOR_EACH_ENTRY(cur, &layout->ranges, struct layout_range, entry) { + + if (cur->range.startPosition > range->startPosition) + return NULL; + + if ((cur->range.startPosition + cur->range.length < range->startPosition + range->length) && + (range->startPosition < cur->range.startPosition + cur->range.length)) + return NULL; + if (cur->range.startPosition + cur->range.length >= range->startPosition + range->length) + return cur; + } + + return NULL; +} + +static struct layout_range *get_layout_range_by_pos(struct dwrite_textlayout *layout, UINT32 pos) +{ + struct layout_range *cur; + + LIST_FOR_EACH_ENTRY(cur, &layout->ranges, struct layout_range, entry) { + DWRITE_TEXT_RANGE *r = &cur->range; + if (r->startPosition <= pos && pos < r->startPosition + r->length) + return cur; + } + + return NULL; +} + +static BOOL set_layout_range_attrval(struct layout_range *dest, enum layout_range_attr_kind attr, struct layout_range_attr_value *value) +{ + BOOL changed = FALSE; + + switch (attr) { + case LAYOUT_RANGE_ATTR_WEIGHT: + changed = dest->weight != value->u.weight; + dest->weight = value->u.weight; + break; + case LAYOUT_RANGE_ATTR_STYLE: + changed = dest->style != value->u.style; + dest->style = value->u.style; + break; + case LAYOUT_RANGE_ATTR_INLINE: + changed = dest->object != value->u.object; + if (changed && dest->object) + IDWriteInlineObject_Release(dest->object); + dest->object = value->u.object; + if (dest->object) + IDWriteInlineObject_AddRef(dest->object); + break; + case LAYOUT_RANGE_ATTR_EFFECT: + changed = dest->effect != value->u.effect; + if (changed && dest->effect) + IUnknown_Release(dest->effect); + dest->effect = value->u.effect; + if (dest->effect) + IUnknown_AddRef(dest->effect); + break; + case LAYOUT_RANGE_ATTR_UNDERLINE: + changed = dest->underline != value->u.underline; + dest->underline = value->u.underline; + break; + case LAYOUT_RANGE_ATTR_STRIKETHROUGH: + changed = dest->strikethrough != value->u.strikethrough; + dest->strikethrough = value->u.strikethrough; + break; + default: + ; + } + + return changed; +} + +static inline BOOL is_in_layout_range(const DWRITE_TEXT_RANGE *outer, const DWRITE_TEXT_RANGE *inner) +{ + return (inner->startPosition >= outer->startPosition) && + (inner->startPosition + inner->length <= outer->startPosition + outer->length); +} + +/* Set attribute value for given range, does all needed splitting/merging of existing ranges. */ +static HRESULT set_layout_range_attr(struct dwrite_textlayout *layout, enum layout_range_attr_kind attr, struct layout_range_attr_value *value) +{ + struct layout_range *outer, *right, *left, *cur; + struct list *ranges = &layout->ranges; + BOOL changed = FALSE; + DWRITE_TEXT_RANGE r; + + /* If new range is completely within existing range, split existing range in two */ + if ((outer = find_outer_range(layout, &value->range))) { + + /* no need to add same range */ + if (is_same_layout_attrvalue(outer, attr, value)) + return S_OK; + + /* for matching range bounds just replace data */ + if (is_same_text_range(&outer->range, &value->range)) { + changed = set_layout_range_attrval(outer, attr, value); + goto done; + } + + /* add new range to the left */ + if (value->range.startPosition == outer->range.startPosition) { + left = alloc_layout_range_from(outer, &value->range); + if (!left) return E_OUTOFMEMORY; + + changed = set_layout_range_attrval(left, attr, value); + list_add_before(&outer->entry, &left->entry); + outer->range.startPosition += value->range.length; + outer->range.length -= value->range.length; + goto done; + } + + /* add new range to the right */ + if (value->range.startPosition + value->range.length == outer->range.startPosition + outer->range.length) { + right = alloc_layout_range_from(outer, &value->range); + if (!right) return E_OUTOFMEMORY; + + changed = set_layout_range_attrval(right, attr, value); + list_add_after(&outer->entry, &right->entry); + outer->range.length -= value->range.length; + goto done; + } + + r.startPosition = value->range.startPosition + value->range.length; + r.length = outer->range.length + outer->range.startPosition - r.startPosition; + + /* right part */ + right = alloc_layout_range_from(outer, &r); + /* new range in the middle */ + cur = alloc_layout_range_from(outer, &value->range); + if (!right || !cur) { + free_layout_range(right); + free_layout_range(cur); + return E_OUTOFMEMORY; + } + + /* reuse container range as a left part */ + outer->range.length = value->range.startPosition - outer->range.startPosition; + + /* new part */ + set_layout_range_attrval(cur, attr, value); + + list_add_after(&outer->entry, &cur->entry); + list_add_after(&cur->entry, &right->entry); + + return S_OK; + } + + /* Now it's only possible that given range contains some existing ranges, fully or partially. + Update all of them. */ + left = get_layout_range_by_pos(layout, value->range.startPosition); + if (left->range.startPosition == value->range.startPosition) + changed = set_layout_range_attrval(left, attr, value); + else /* need to split */ { + r.startPosition = value->range.startPosition; + r.length = left->range.length - value->range.startPosition + left->range.startPosition; + left->range.length -= r.length; + cur = alloc_layout_range_from(left, &r); + changed = set_layout_range_attrval(cur, attr, value); + list_add_after(&left->entry, &cur->entry); + } + cur = LIST_ENTRY(list_next(ranges, &left->entry), struct layout_range, entry); + + /* for all existing ranges covered by new one update value */ + while (is_in_layout_range(&value->range, &cur->range)) { + changed = set_layout_range_attrval(cur, attr, value); + cur = LIST_ENTRY(list_next(ranges, &cur->entry), struct layout_range, entry); + } + + /* it's possible rightmost range intersects */ + if (cur && (cur->range.startPosition < value->range.startPosition + value->range.length)) { + r.startPosition = cur->range.startPosition; + r.length = value->range.startPosition + value->range.length - cur->range.startPosition; + left = alloc_layout_range_from(cur, &r); + changed = set_layout_range_attrval(left, attr, value); + cur->range.startPosition += left->range.length; + cur->range.length -= left->range.length; + list_add_before(&cur->entry, &left->entry); + } + +done: + if (changed) { + struct list *next, *i; + + i = list_head(ranges); + while ((next = list_next(ranges, i))) { + struct layout_range *next_range = LIST_ENTRY(next, struct layout_range, entry); + + cur = LIST_ENTRY(i, struct layout_range, entry); + if (is_same_layout_attributes(cur, next_range)) { + /* remove similar range */ + cur->range.length += next_range->range.length; + list_remove(next); + free_layout_range(next_range); + } + else + i = list_next(ranges, i); + } + } + + return S_OK; +} + static HRESULT WINAPI dwritetextlayout_QueryInterface(IDWriteTextLayout *iface, REFIID riid, void **obj) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); @@ -144,8 +489,8 @@ TRACE("(%p)->(%d)\n", This, ref); - if (!ref) - { + if (!ref) { + free_layout_ranges_list(This); release_format_data(&This->format); heap_free(This->str); heap_free(This); @@ -215,36 +560,36 @@ static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextlayout_GetTextAlignment(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_TEXT_ALIGNMENT_LEADING; + TRACE("(%p)\n", This); + return This->format.textalignment; } static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextlayout_GetParagraphAlignment(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_PARAGRAPH_ALIGNMENT_NEAR; + TRACE("(%p)\n", This); + return This->format.paralign; } static DWRITE_WORD_WRAPPING WINAPI dwritetextlayout_GetWordWrapping(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); FIXME("(%p): stub\n", This); - return DWRITE_WORD_WRAPPING_NO_WRAP; + return This->format.wrapping; } static DWRITE_READING_DIRECTION WINAPI dwritetextlayout_GetReadingDirection(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT; + TRACE("(%p)\n", This); + return This->format.readingdir; } static DWRITE_FLOW_DIRECTION WINAPI dwritetextlayout_GetFlowDirection(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM; + TRACE("(%p)\n", This); + return This->format.flow; } static FLOAT WINAPI dwritetextlayout_GetIncrementalTabStop(IDWriteTextLayout *iface) @@ -258,65 +603,85 @@ IDWriteInlineObject **trimming_sign) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p %p): stub\n", This, options, trimming_sign); - return E_NOTIMPL; + + TRACE("(%p)->(%p %p)\n", This, options, trimming_sign); + + *options = This->format.trimming; + *trimming_sign = This->format.trimmingsign; + if (*trimming_sign) + IDWriteInlineObject_AddRef(*trimming_sign); + return S_OK; } static HRESULT WINAPI dwritetextlayout_GetLineSpacing(IDWriteTextLayout *iface, DWRITE_LINE_SPACING_METHOD *method, FLOAT *spacing, FLOAT *baseline) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p %p %p): stub\n", This, method, spacing, baseline); - return E_NOTIMPL; + + TRACE("(%p)->(%p %p %p)\n", This, method, spacing, baseline); + + *method = This->format.spacingmethod; + *spacing = This->format.spacing; + *baseline = This->format.baseline; + return S_OK; } static HRESULT WINAPI dwritetextlayout_GetFontCollection(IDWriteTextLayout *iface, IDWriteFontCollection **collection) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p): stub\n", This, collection); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, collection); + + *collection = This->format.collection; + if (*collection) + IDWriteFontCollection_AddRef(*collection); + return S_OK; } static UINT32 WINAPI dwritetextlayout_GetFontFamilyNameLength(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return 0; + TRACE("(%p)\n", This); + return This->format.family_len; } static HRESULT WINAPI dwritetextlayout_GetFontFamilyName(IDWriteTextLayout *iface, WCHAR *name, UINT32 size) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p %u): stub\n", This, name, size); - return E_NOTIMPL; + + TRACE("(%p)->(%p %u)\n", This, name, size); + + if (size <= This->format.family_len) return E_NOT_SUFFICIENT_BUFFER; + strcpyW(name, This->format.family_name); + return S_OK; } static DWRITE_FONT_WEIGHT WINAPI dwritetextlayout_GetFontWeight(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FONT_WEIGHT_NORMAL; + TRACE("(%p)\n", This); + return This->format.weight; } static DWRITE_FONT_STYLE WINAPI dwritetextlayout_GetFontStyle(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FONT_STYLE_NORMAL; + TRACE("(%p)\n", This); + return This->format.style; } static DWRITE_FONT_STRETCH WINAPI dwritetextlayout_GetFontStretch(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return DWRITE_FONT_STRETCH_NORMAL; + TRACE("(%p)\n", This); + return This->format.stretch; } static FLOAT WINAPI dwritetextlayout_GetFontSize(IDWriteTextLayout *iface) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p): stub\n", This); - return 0.0; + TRACE("(%p)\n", This); + return This->format.size; } static UINT32 WINAPI dwritetextlayout_GetLocaleNameLength(IDWriteTextLayout *iface) @@ -370,15 +735,31 @@ static HRESULT WINAPI dwritetextlayout_SetFontWeight(IDWriteTextLayout *iface, DWRITE_FONT_WEIGHT weight, DWRITE_TEXT_RANGE range) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%d %s): stub\n", This, weight, debugstr_range(&range)); - return E_NOTIMPL; + struct layout_range_attr_value value; + + TRACE("(%p)->(%d %s)\n", This, weight, debugstr_range(&range)); + + if (!validate_text_range(This, &range)) + return S_OK; + + value.range = range; + value.u.weight = weight; + return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_WEIGHT, &value); } static HRESULT WINAPI dwritetextlayout_SetFontStyle(IDWriteTextLayout *iface, DWRITE_FONT_STYLE style, DWRITE_TEXT_RANGE range) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%d %s): stub\n", This, style, debugstr_range(&range)); - return E_NOTIMPL; + struct layout_range_attr_value value; + + TRACE("(%p)->(%d %s)\n", This, style, debugstr_range(&range)); + + if (!validate_text_range(This, &range)) + return S_OK; + + value.range = range; + value.u.style = style; + return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_STYLE, &value); } static HRESULT WINAPI dwritetextlayout_SetFontStretch(IDWriteTextLayout *iface, DWRITE_FONT_STRETCH stretch, DWRITE_TEXT_RANGE range) @@ -398,29 +779,62 @@ static HRESULT WINAPI dwritetextlayout_SetUnderline(IDWriteTextLayout *iface, BOOL underline, DWRITE_TEXT_RANGE range) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%d %s): stub\n", This, underline, debugstr_range(&range)); - return E_NOTIMPL; + struct layout_range_attr_value value; + + TRACE("(%p)->(%d %s)\n", This, underline, debugstr_range(&range)); + + if (!validate_text_range(This, &range)) + return S_OK; + + value.range = range; + value.u.underline = underline; + return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_UNDERLINE, &value); } static HRESULT WINAPI dwritetextlayout_SetStrikethrough(IDWriteTextLayout *iface, BOOL strikethrough, DWRITE_TEXT_RANGE range) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%d %s): stub\n", This, strikethrough, debugstr_range(&range)); - return E_NOTIMPL; + struct layout_range_attr_value value; + + TRACE("(%p)->(%d %s)\n", This, strikethrough, debugstr_range(&range)); + + if (!validate_text_range(This, &range)) + return S_OK; + + value.range = range; + value.u.underline = strikethrough; + return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_STRIKETHROUGH, &value); } static HRESULT WINAPI dwritetextlayout_SetDrawingEffect(IDWriteTextLayout *iface, IUnknown* effect, DWRITE_TEXT_RANGE range) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p %s): stub\n", This, effect, debugstr_range(&range)); - return E_NOTIMPL; + struct layout_range_attr_value value; + + TRACE("(%p)->(%p %s)\n", This, effect, debugstr_range(&range)); + + if (!validate_text_range(This, &range)) + return S_OK; + + value.range = range; + value.u.effect = effect; + return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_EFFECT, &value); } -static HRESULT WINAPI dwritetextlayout_SetInlineObject(IDWriteTextLayout *iface, IDWriteInlineObject *object, DWRITE_TEXT_RANGE range) +static HRESULT WINAPI dwritetextlayout_SetInlineObject(IDWriteTextLayout *iface, IDWriteInlineObject *object, DWRITE_TEXT_RANGE r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%p %s): stub\n", This, object, debugstr_range(&range)); - return E_NOTIMPL; + struct layout_range_attr_value attr; + + TRACE("(%p)->(%p %s)\n", This, object, debugstr_range(&r)); + + if (!validate_text_range(This, &r)) + return S_OK; + + attr.range = r; + attr.u.object = object; + + return set_layout_range_attr(This, LAYOUT_RANGE_ATTR_INLINE, &attr); } static HRESULT WINAPI dwritetextlayout_SetTypography(IDWriteTextLayout *iface, IDWriteTypography* typography, DWRITE_TEXT_RANGE range) @@ -476,19 +890,39 @@ } static HRESULT WINAPI dwritetextlayout_layout_GetFontWeight(IDWriteTextLayout *iface, - UINT32 position, DWRITE_FONT_WEIGHT *weight, DWRITE_TEXT_RANGE *range) + UINT32 position, DWRITE_FONT_WEIGHT *weight, DWRITE_TEXT_RANGE *r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, position, weight, range); - return E_NOTIMPL; + struct layout_range *range; + + TRACE("(%p)->(%u %p %p)\n", This, position, weight, r); + + if (position >= This->len) + return S_OK; + + range = get_layout_range_by_pos(This, position); + *weight = range->weight; + if (r) *r = range->range; + + return S_OK; } static HRESULT WINAPI dwritetextlayout_layout_GetFontStyle(IDWriteTextLayout *iface, - UINT32 currentPosition, DWRITE_FONT_STYLE *style, DWRITE_TEXT_RANGE *range) + UINT32 position, DWRITE_FONT_STYLE *style, DWRITE_TEXT_RANGE *r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, currentPosition, style, range); - return E_NOTIMPL; + struct layout_range *range; + + TRACE("(%p)->(%u %p %p)\n", This, position, style, r); + + if (position >= This->len) + return S_OK; + + range = get_layout_range_by_pos(This, position); + *style = range->style; + if (r) *r = range->range; + + return S_OK; } static HRESULT WINAPI dwritetextlayout_layout_GetFontStretch(IDWriteTextLayout *iface, @@ -508,35 +942,76 @@ } static HRESULT WINAPI dwritetextlayout_GetUnderline(IDWriteTextLayout *iface, - UINT32 position, BOOL *has_underline, DWRITE_TEXT_RANGE *range) + UINT32 position, BOOL *underline, DWRITE_TEXT_RANGE *r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, position, has_underline, range); - return E_NOTIMPL; + struct layout_range *range; + + TRACE("(%p)->(%u %p %p)\n", This, position, underline, r); + + if (position >= This->len) + return S_OK; + + range = get_layout_range_by_pos(This, position); + *underline = range->underline; + if (r) *r = range->range; + + return S_OK; } static HRESULT WINAPI dwritetextlayout_GetStrikethrough(IDWriteTextLayout *iface, - UINT32 position, BOOL *has_strikethrough, DWRITE_TEXT_RANGE *range) + UINT32 position, BOOL *strikethrough, DWRITE_TEXT_RANGE *r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, position, has_strikethrough, range); - return E_NOTIMPL; + struct layout_range *range; + + TRACE("(%p)->(%u %p %p)\n", This, position, strikethrough, r); + + if (position >= This->len) + return S_OK; + + range = get_layout_range_by_pos(This, position); + *strikethrough = range->strikethrough; + if (r) *r = range->range; + + return S_OK; } static HRESULT WINAPI dwritetextlayout_GetDrawingEffect(IDWriteTextLayout *iface, - UINT32 position, IUnknown **effect, DWRITE_TEXT_RANGE *range) + UINT32 position, IUnknown **effect, DWRITE_TEXT_RANGE *r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, position, effect, range); - return E_NOTIMPL; + struct layout_range *range; + + TRACE("(%p)->(%u %p %p)\n", This, position, effect, r); + + if (position >= This->len) + return S_OK; + + range = get_layout_range_by_pos(This, position); + *effect = range->effect; + if (*effect) + IUnknown_AddRef(*effect); + if (r) *r = range->range; + + return S_OK; } static HRESULT WINAPI dwritetextlayout_GetInlineObject(IDWriteTextLayout *iface, - UINT32 position, IDWriteInlineObject **object, DWRITE_TEXT_RANGE *range) + UINT32 position, IDWriteInlineObject **object, DWRITE_TEXT_RANGE *r) { struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface); - FIXME("(%p)->(%u %p %p): stub\n", This, position, object, range); - return E_NOTIMPL; + struct layout_range *range; + + TRACE("(%p)->(%u %p %p)\n", This, position, object, r); + + range = get_layout_range_by_pos(This, position); + *object = range ? range->object : NULL; + if (*object) + IDWriteInlineObject_AddRef(*object); + if (r) *r = range->range; + + return S_OK; } static HRESULT WINAPI dwritetextlayout_GetTypography(IDWriteTextLayout *iface, @@ -757,6 +1232,8 @@ HRESULT create_textlayout(const WCHAR *str, UINT32 len, IDWriteTextFormat *format, FLOAT maxwidth, FLOAT maxheight, IDWriteTextLayout **layout) { struct dwrite_textlayout *This; + struct layout_range *range; + DWRITE_TEXT_RANGE r = { 0, len }; *layout = NULL; @@ -771,6 +1248,14 @@ This->maxheight = maxheight; layout_format_from_textformat(This, format); + list_init(&This->ranges); + range = alloc_layout_range(This, &r); + if (!range) { + IDWriteTextLayout_Release(&This->IDWriteTextLayout_iface); + return E_OUTOFMEMORY; + } + list_add_head(&This->ranges, &range->entry); + *layout = &This->IDWriteTextLayout_iface; return S_OK; diff -Nru wine1.7-1.7.24/dlls/dwrite/main.c wine1.7-1.7.25/dlls/dwrite/main.c --- wine1.7-1.7.24/dlls/dwrite/main.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/main.c 2014-08-22 18:39:55.000000000 +0000 @@ -365,6 +365,8 @@ IDWriteFontCollectionLoader **loaders; LONG loader_count; + IDWriteFontFileLoader **file_loaders; + LONG file_loader_count; }; static inline struct dwritefactory *impl_from_IDWriteFactory(IDWriteFactory *iface) @@ -412,6 +414,10 @@ if (This->loaders[i]) IDWriteFontCollectionLoader_Release(This->loaders[i]); heap_free(This->loaders); + for (i = 0; i < This->file_loader_count; i++) + if (This->file_loaders[i]) + IDWriteFontFileLoader_Release(This->file_loaders[i]); + heap_free(This->file_loaders); heap_free(This); } @@ -503,9 +509,21 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory *iface, void const *reference_key, UINT32 key_size, IDWriteFontFileLoader *loader, IDWriteFontFile **font_file) { + int i; struct dwritefactory *This = impl_from_IDWriteFactory(iface); - FIXME("(%p)->(%p %u %p %p): stub\n", This, reference_key, key_size, loader, font_file); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p)->(%p %u %p %p)\n", This, reference_key, key_size, loader, font_file); + + if (loader == NULL) + return E_INVALIDARG; + + for (i = 0; i < This->file_loader_count; i++) + if (This->file_loaders[i] == loader) break; + if (i == This->file_loader_count) + return E_INVALIDARG; + hr = create_font_file(loader, reference_key, key_size, font_file); + return hr; } static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory *iface, @@ -513,8 +531,8 @@ UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace **font_face) { struct dwritefactory *This = impl_from_IDWriteFactory(iface); - FIXME("(%p)->(%d %u %p %u 0x%x %p): stub\n", This, facetype, files_number, font_files, index, sim_flags, font_face); - return E_NOTIMPL; + TRACE("(%p)->(%d %u %p %u 0x%x %p)\n", This, facetype, files_number, font_files, index, sim_flags, font_face); + return font_create_fontface(iface, facetype, files_number, font_files, index, sim_flags, font_face); } static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory *iface, IDWriteRenderingParams **params) @@ -554,16 +572,55 @@ static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory *iface, IDWriteFontFileLoader *loader) { + int i; struct dwritefactory *This = impl_from_IDWriteFactory(iface); - FIXME("(%p)->(%p): stub\n", This, loader); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, loader); + + if (!loader) + return E_INVALIDARG; + + for (i = 0; i < This->file_loader_count; i++) + if (This->file_loaders[i] == loader) + return DWRITE_E_ALREADYREGISTERED; + else if (This->file_loaders[i] == NULL) + break; + + if (i == This->file_loader_count) + { + IDWriteFontFileLoader **new_list = NULL; + int new_count = 0; + + new_count = This->file_loader_count * 2; + new_list = heap_realloc(This->file_loaders, new_count * sizeof(*This->file_loaders)); + + if (!new_list) + return E_OUTOFMEMORY; + else + { + This->file_loader_count = new_count; + This->file_loaders = new_list; + } + } + IDWriteFontFileLoader_AddRef(loader); + This->file_loaders[i] = loader; + + return S_OK; } static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory *iface, IDWriteFontFileLoader *loader) { + int i; struct dwritefactory *This = impl_from_IDWriteFactory(iface); - FIXME("(%p)->(%p): stub\n", This, loader); - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", This, loader); + + for (i = 0; i < This->file_loader_count; i++) + if (This->file_loaders[i] == loader) break; + if (i == This->file_loader_count) + return E_INVALIDARG; + IDWriteFontFileLoader_Release(This->file_loaders[i]); + This->file_loaders[i] = NULL; + + return S_OK; } static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHAR const* family_name, @@ -687,6 +744,8 @@ This->ref = 1; This->loader_count = 2; This->loaders = heap_alloc_zero(sizeof(*This->loaders) * 2); + This->file_loader_count = 2; + This->file_loaders = heap_alloc_zero(sizeof(*This->file_loaders) * 2); *factory = (IUnknown*)&This->IDWriteFactory_iface; diff -Nru wine1.7-1.7.24/dlls/dwrite/Makefile.in wine1.7-1.7.25/dlls/dwrite/Makefile.in --- wine1.7-1.7.24/dlls/dwrite/Makefile.in 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/Makefile.in 2014-08-22 18:39:55.000000000 +0000 @@ -7,4 +7,5 @@ font.c \ gdiinterop.c \ layout.c \ - main.c + main.c \ + opentype.c diff -Nru wine1.7-1.7.24/dlls/dwrite/opentype.c wine1.7-1.7.25/dlls/dwrite/opentype.c --- wine1.7-1.7.24/dlls/dwrite/opentype.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/opentype.c 2014-08-22 18:39:55.000000000 +0000 @@ -0,0 +1,171 @@ +/* + * Methods for dealing with opentype font tables + * + * Copyright 2014 Aric Stewart for CodeWeavers + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "dwrite.h" +#include "dwrite_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dwrite); + +#define DWRITE_MAKE_OPENTYPE_TAG(ch0, ch1, ch2, ch3) \ + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ + ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24)) + +#define MS_TTCF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','t','c','f') +#define MS_OTTO_TAG DWRITE_MAKE_OPENTYPE_TAG('O','T','T','O') + +#ifdef WORDS_BIGENDIAN +#define GET_BE_WORD(x) (x) +#define GET_BE_DWORD(x) (x) +#else +#define GET_BE_WORD(x) MAKEWORD(HIBYTE(x), LOBYTE(x)) +#define GET_BE_DWORD(x) MAKELONG(GET_BE_WORD(HIWORD(x)), GET_BE_WORD(LOWORD(x))) +#endif + +typedef struct { + CHAR TTCTag[4]; + DWORD Version; + DWORD numFonts; + DWORD OffsetTable[1]; +} TTC_Header_V1; + +typedef struct { + DWORD version; + WORD numTables; + WORD searchRange; + WORD entrySelector; + WORD rangeShift; +} TTC_SFNT_V1; + +typedef struct { + CHAR tag[4]; + DWORD checkSum; + DWORD offset; + DWORD length; +} TT_TableRecord; + +HRESULT analyze_opentype_font(const void* font_data, UINT32* font_count, DWRITE_FONT_FILE_TYPE *file_type, DWRITE_FONT_FACE_TYPE *face_type, BOOL *supported) +{ + /* TODO: Do font validation */ + const char* tag = font_data; + + *supported = FALSE; + *file_type = DWRITE_FONT_FILE_TYPE_UNKNOWN; + if (face_type) + *face_type = DWRITE_FONT_FACE_TYPE_UNKNOWN; + *font_count = 0; + + if (DWRITE_MAKE_OPENTYPE_TAG(tag[0], tag[1], tag[2], tag[3]) == MS_TTCF_TAG) + { + const TTC_Header_V1 *header = font_data; + *font_count = GET_BE_DWORD(header->numFonts); + *file_type = DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION; + if (face_type) + *face_type = DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION; + *supported = TRUE; + } + else if (GET_BE_DWORD(*(DWORD*)font_data) == 0x10000) + { + *font_count = 1; + *file_type = DWRITE_FONT_FILE_TYPE_TRUETYPE; + if (face_type) + *face_type = DWRITE_FONT_FACE_TYPE_TRUETYPE; + *supported = TRUE; + } + else if (DWRITE_MAKE_OPENTYPE_TAG(tag[0], tag[1], tag[2], tag[3]) == MS_OTTO_TAG) + { + *file_type = DWRITE_FONT_FILE_TYPE_CFF; + } + return S_OK; +} + +HRESULT find_font_table(IDWriteFontFileStream *stream, UINT32 font_index, UINT32 tag, const void** table_data, void** table_context, UINT32 *table_size, BOOL* found) +{ + const CHAR *first_data; + void *first_context; + HRESULT hr; + TTC_SFNT_V1 *font_header = NULL; + void *sfnt_context; + TT_TableRecord *table_record = NULL; + void *table_record_context; + int i; + int table_count; + int table_offset = 0; + + *found = FALSE; + + hr = IDWriteFontFileStream_ReadFileFragment(stream, (const void**)&first_data, 0, 4, &first_context); + if (SUCCEEDED(hr)) + { + if (DWRITE_MAKE_OPENTYPE_TAG(first_data[0], first_data[1], first_data[2], first_data[3]) == MS_TTCF_TAG) + { + const TTC_Header_V1 *ttc_header; + void * ttc_context; + hr = IDWriteFontFileStream_ReadFileFragment(stream, (const void**)&ttc_header, 0, sizeof(*ttc_header), &ttc_context); + if (SUCCEEDED(hr)) + { + table_offset = GET_BE_DWORD(ttc_header->OffsetTable[0]); + if (font_index >= GET_BE_DWORD(ttc_header->numFonts)) + hr = E_INVALIDARG; + else + hr = IDWriteFontFileStream_ReadFileFragment(stream, (const void**)&font_header, table_offset, sizeof(*font_header), &sfnt_context); + IDWriteFontFileStream_ReleaseFileFragment(stream, ttc_context); + } + } + else + { + if (font_index > 0) + hr = E_INVALIDARG; + else + hr = IDWriteFontFileStream_ReadFileFragment(stream, (const void**)&font_header, 0, sizeof(*font_header), &sfnt_context); + } + IDWriteFontFileStream_ReleaseFileFragment(stream, first_context); + } + if (FAILED(hr)) + return hr; + + table_count = GET_BE_WORD(font_header->numTables); + table_offset += sizeof(*font_header); + for (i = 0; i < table_count; i++) + { + hr = IDWriteFontFileStream_ReadFileFragment(stream, (const void**)&table_record, table_offset, sizeof(*table_record), &table_record_context); + if (FAILED(hr)) + break; + if (DWRITE_MAKE_OPENTYPE_TAG(table_record->tag[0], table_record->tag[1], table_record->tag[2], table_record->tag[3]) == tag) + break; + IDWriteFontFileStream_ReleaseFileFragment(stream, table_record_context); + table_offset += sizeof(*table_record); + } + + IDWriteFontFileStream_ReleaseFileFragment(stream, sfnt_context); + if (SUCCEEDED(hr) && i < table_count) + { + int offset = GET_BE_DWORD(table_record->offset); + int length = GET_BE_DWORD(table_record->length); + IDWriteFontFileStream_ReleaseFileFragment(stream, table_record_context); + + *found = TRUE; + *table_size = length; + hr = IDWriteFontFileStream_ReadFileFragment(stream, table_data, offset, length, table_context); + } + + return hr; +} diff -Nru wine1.7-1.7.24/dlls/dwrite/tests/font.c wine1.7-1.7.25/dlls/dwrite/tests/font.c --- wine1.7-1.7.24/dlls/dwrite/tests/font.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/tests/font.c 2014-08-22 18:39:55.000000000 +0000 @@ -41,6 +41,154 @@ static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; static const WCHAR blahW[] = {'B','l','a','h','!',0}; +/* Here is a functional custom font set of interfaces */ +struct test_fontdatastream +{ + IDWriteFontFileStream IDWriteFontFileStream_iface; + LONG ref; + + LPVOID data; + DWORD size; +}; + +static inline struct test_fontdatastream *impl_from_IDWriteFontFileStream(IDWriteFontFileStream* iface) +{ + return CONTAINING_RECORD(iface, struct test_fontdatastream, IDWriteFontFileStream_iface); +} + +static HRESULT WINAPI fontdatastream_QueryInterface(IDWriteFontFileStream *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteFontFileStream)) + { + *obj = iface; + IDWriteFontFileStream_AddRef(iface); + return S_OK; + } + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI fontdatastream_AddRef(IDWriteFontFileStream *iface) +{ + struct test_fontdatastream *This = impl_from_IDWriteFontFileStream(iface); + ULONG ref = InterlockedIncrement(&This->ref); + return ref; +} + +static ULONG WINAPI fontdatastream_Release(IDWriteFontFileStream *iface) +{ + struct test_fontdatastream *This = impl_from_IDWriteFontFileStream(iface); + ULONG ref = InterlockedDecrement(&This->ref); + if (ref == 0) + HeapFree(GetProcessHeap(), 0, This); + return ref; +} + +static HRESULT WINAPI fontdatastream_ReadFileFragment(IDWriteFontFileStream *iface, void const **fragment_start, UINT64 offset, UINT64 fragment_size, void **fragment_context) +{ + struct test_fontdatastream *This = impl_from_IDWriteFontFileStream(iface); + *fragment_context = NULL; + if (offset+fragment_size > This->size) + { + *fragment_start = NULL; + return E_FAIL; + } + else + { + *fragment_start = (BYTE*)This->data + offset; + return S_OK; + } +} + +static void WINAPI fontdatastream_ReleaseFileFragment(IDWriteFontFileStream *iface, void *fragment_context) +{ + /* Do Nothing */ +} + +static HRESULT WINAPI fontdatastream_GetFileSize(IDWriteFontFileStream *iface, UINT64 *size) +{ + struct test_fontdatastream *This = impl_from_IDWriteFontFileStream(iface); + *size = This->size; + return S_OK; +} + +static HRESULT WINAPI fontdatastream_GetLastWriteTime(IDWriteFontFileStream *iface, UINT64 *last_writetime) +{ + return E_NOTIMPL; +} + +static const IDWriteFontFileStreamVtbl fontdatastreamvtbl = +{ + fontdatastream_QueryInterface, + fontdatastream_AddRef, + fontdatastream_Release, + fontdatastream_ReadFileFragment, + fontdatastream_ReleaseFileFragment, + fontdatastream_GetFileSize, + fontdatastream_GetLastWriteTime +}; + +static HRESULT create_fontdatastream(LPVOID data, UINT size, IDWriteFontFileStream** iface) +{ + struct test_fontdatastream *This = HeapAlloc(GetProcessHeap(), 0, sizeof(struct test_fontdatastream)); + if (!This) + return E_OUTOFMEMORY; + + This->data = data; + This->size = size; + This->ref = 1; + This->IDWriteFontFileStream_iface.lpVtbl = &fontdatastreamvtbl; + + *iface = &This->IDWriteFontFileStream_iface; + return S_OK; +} + +static HRESULT WINAPI resourcefontfileloader_QueryInterface(IDWriteFontFileLoader *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteFontFileLoader)) + { + *obj = iface; + return S_OK; + } + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI resourcefontfileloader_AddRef(IDWriteFontFileLoader *iface) +{ + return 2; +} + +static ULONG WINAPI resourcefontfileloader_Release(IDWriteFontFileLoader *iface) +{ + return 1; +} + +static HRESULT WINAPI resourcefontfileloader_CreateStreamFromKey(IDWriteFontFileLoader *iface, const void *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileStream **fontFileStream) +{ + LPVOID data; + DWORD size; + HGLOBAL mem; + + mem = LoadResource(GetModuleHandleA(NULL), *(HRSRC*)fontFileReferenceKey); + ok(mem != NULL, "Failed to lock font resource\n"); + if (mem) + { + size = SizeofResource(GetModuleHandleA(NULL), *(HRSRC*)fontFileReferenceKey); + data = LockResource(mem); + return create_fontdatastream(data, size, fontFileStream); + } + return E_FAIL; +} + +static const struct IDWriteFontFileLoaderVtbl resourcefontfileloadervtbl = { + resourcefontfileloader_QueryInterface, + resourcefontfileloader_AddRef, + resourcefontfileloader_Release, + resourcefontfileloader_CreateStreamFromKey +}; + + static void test_CreateFontFromLOGFONT(void) { static const WCHAR tahomaspW[] = {'T','a','h','o','m','a',' ',0}; @@ -722,6 +870,125 @@ ok(hr == S_OK, "got 0x%08x\n", hr); } +static HRESULT WINAPI fontfileloader_QueryInterface(IDWriteFontFileLoader *iface, REFIID riid, void **obj) +{ + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDWriteFontFileLoader)) + { + *obj = iface; + IDWriteFontFileLoader_AddRef(iface); + return S_OK; + } + + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI fontfileloader_AddRef(IDWriteFontFileLoader *iface) +{ + return 2; +} + +static ULONG WINAPI fontfileloader_Release(IDWriteFontFileLoader *iface) +{ + return 1; +} + +static HRESULT WINAPI fontfileloader_CreateStreamFromKey(IDWriteFontFileLoader *iface, const void *fontFileReferenceKey, UINT32 fontFileReferenceKeySize, IDWriteFontFileStream **fontFileStream) +{ + return 0x8faecafe; +} + +static const struct IDWriteFontFileLoaderVtbl dwritefontfileloadervtbl = { + fontfileloader_QueryInterface, + fontfileloader_AddRef, + fontfileloader_Release, + fontfileloader_CreateStreamFromKey +}; + +static void test_FontLoader(void) +{ + IDWriteFontFileLoader floader = { &dwritefontfileloadervtbl }; + IDWriteFontFileLoader floader2 = { &dwritefontfileloadervtbl }; + IDWriteFontFileLoader floader3 = { &dwritefontfileloadervtbl }; + IDWriteFontFileLoader rloader = { &resourcefontfileloadervtbl }; + IDWriteFontFile *ffile = NULL; + BOOL support = 1; + DWRITE_FONT_FILE_TYPE type = 1; + DWRITE_FONT_FACE_TYPE face = 1; + UINT32 count = 1; + IDWriteFontFace *fface = NULL; + HRESULT hr; + HRSRC font; + + hr = IDWriteFactory_RegisterFontFileLoader(factory, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + hr = IDWriteFactory_RegisterFontFileLoader(factory, &floader); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IDWriteFactory_RegisterFontFileLoader(factory, &floader2); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IDWriteFactory_RegisterFontFileLoader(factory, &floader); + ok(hr == DWRITE_E_ALREADYREGISTERED, "got 0x%08x\n", hr); + hr = IDWriteFactory_RegisterFontFileLoader(factory, &rloader); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDWriteFactory_CreateCustomFontFileReference(factory, "test", 4, &floader, &ffile); + ok(hr == S_OK, "got 0x%08x\n", hr); + if (SUCCEEDED(hr)) + IDWriteFontFile_Release(ffile); + + hr = IDWriteFactory_CreateCustomFontFileReference(factory, "test", 4, &floader3, &ffile); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + if (SUCCEEDED(hr)) + IDWriteFontFile_Release(ffile); + + hr = IDWriteFactory_CreateCustomFontFileReference(factory, "test", 4, NULL, &ffile); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + if (SUCCEEDED(hr)) + IDWriteFontFile_Release(ffile); + + hr = IDWriteFactory_CreateCustomFontFileReference(factory, "test", 4, &floader, &ffile); + ok(hr == S_OK, "got 0x%08x\n", hr); + IDWriteFontFile_Analyze(ffile, &support, &type, &face, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(support == FALSE, "got %i\n", support); + ok(type == DWRITE_FONT_FILE_TYPE_UNKNOWN, "got %i\n", type); + ok(face == DWRITE_FONT_FACE_TYPE_UNKNOWN, "got %i\n", face); + ok(count == 0, "got %i\n", count); + + hr = IDWriteFactory_CreateFontFace(factory, type, 1, &ffile, 0, 0, &fface); + ok(hr == 0x8faecafe, "got 0x%08x\n", hr); + IDWriteFontFile_Release(ffile); + + font = FindResourceA(GetModuleHandleA(NULL), (LPCSTR)MAKEINTRESOURCE(1), (LPCSTR)RT_RCDATA); + ok(font != NULL, "Failed to find font resource\n"); + if (font) + { + hr = IDWriteFactory_CreateCustomFontFileReference(factory, &font, sizeof(HRSRC), &rloader, &ffile); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IDWriteFontFile_Analyze(ffile, &support, &type, &face, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(support == TRUE, "got %i\n", support); + ok(type == DWRITE_FONT_FILE_TYPE_TRUETYPE, "got %i\n", type); + ok(face == DWRITE_FONT_FACE_TYPE_TRUETYPE, "got %i\n", face); + ok(count == 1, "got %i\n", count); + + hr = IDWriteFactory_CreateFontFace(factory, face, 1, &ffile, 0, 0, &fface); + ok(hr == S_OK, "got 0x%08x\n",hr); + IDWriteFontFace_Release(fface); + IDWriteFontFile_Release(ffile); + } + + hr = IDWriteFactory_UnregisterFontFileLoader(factory, &floader); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IDWriteFactory_UnregisterFontFileLoader(factory, &floader); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + hr = IDWriteFactory_UnregisterFontFileLoader(factory, &floader2); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IDWriteFactory_UnregisterFontFileLoader(factory, &rloader); + ok(hr == S_OK, "got 0x%08x\n", hr); +} + START_TEST(font) { HRESULT hr; @@ -743,6 +1010,7 @@ test_system_fontcollection(); test_ConvertFontFaceToLOGFONT(); test_CustomFontCollection(); + test_FontLoader(); IDWriteFactory_Release(factory); } diff -Nru wine1.7-1.7.24/dlls/dwrite/tests/layout.c wine1.7-1.7.25/dlls/dwrite/tests/layout.c --- wine1.7-1.7.24/dlls/dwrite/tests/layout.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/tests/layout.c 2014-08-22 18:39:55.000000000 +0000 @@ -551,35 +551,31 @@ DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format); ok(hr == S_OK, "got 0x%08x\n", hr); - hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 0, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout); + hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IDWriteTextLayout_QueryInterface(layout, &IID_IDWriteTextFormat, (void**)&fmt2); ok(hr == S_OK, "got 0x%08x\n", hr); weight = IDWriteTextFormat_GetFontWeight(fmt2); -todo_wine ok(weight == DWRITE_FONT_WEIGHT_BOLD, "got %u\n", weight); range.startPosition = 0; range.length = 6; hr = IDWriteTextLayout_SetFontWeight(layout, DWRITE_FONT_WEIGHT_NORMAL, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); /* IDWriteTextFormat methods output doesn't reflect layout changes */ weight = IDWriteTextFormat_GetFontWeight(fmt2); -todo_wine ok(weight == DWRITE_FONT_WEIGHT_BOLD, "got %u\n", weight); range.length = 0; weight = DWRITE_FONT_WEIGHT_BOLD; hr = layout->lpVtbl->IDWriteTextLayout_GetFontWeight(layout, 0, &weight, &range); -todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); ok(weight == DWRITE_FONT_WEIGHT_NORMAL, "got %d\n", weight); ok(range.length == 6, "got %d\n", range.length); -} + IDWriteTextLayout_Release(layout); IDWriteTextFormat_Release(fmt2); IDWriteTextFormat_Release(format); @@ -593,14 +589,14 @@ IDWriteInlineObject *inlineobj, *inlineobj2, *inlinetest; IDWriteTextFormat *format; IDWriteTextLayout *layout; - DWRITE_TEXT_RANGE range; + DWRITE_TEXT_RANGE range, r2; HRESULT hr; hr = IDWriteFactory_CreateTextFormat(factory, tahomaW, NULL, DWRITE_FONT_WEIGHT_BOLD, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, 10.0, ruW, &format); ok(hr == S_OK, "got 0x%08x\n", hr); - hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 0, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout); + hr = IDWriteFactory_CreateGdiCompatibleTextLayout(factory, strW, 6, format, 100.0, 100.0, 1.0, NULL, FALSE, &layout); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IDWriteFactory_CreateEllipsisTrimmingSign(factory, format, &inlineobj); @@ -611,64 +607,72 @@ inlinetest = (void*)0x1; hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, NULL); -todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); - ok(inlinetest == NULL, "got %p\n", inlineobj); -} + ok(inlinetest == NULL, "got %p\n", inlinetest); + range.startPosition = 0; range.length = 2; hr = IDWriteTextLayout_SetInlineObject(layout, inlineobj, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); inlinetest = (void*)0x1; hr = IDWriteTextLayout_GetInlineObject(layout, 2, &inlinetest, NULL); -todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); ok(inlinetest == NULL, "got %p\n", inlinetest); -} + inlinetest = NULL; - hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, NULL); -todo_wine + r2.startPosition = r2.length = 100; + hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, &r2); ok(hr == S_OK, "got 0x%08x\n", hr); -if (hr == S_OK) { ok(inlinetest == inlineobj, "got %p\n", inlinetest); + ok(r2.startPosition == 0 && r2.length == 2, "got %d, %d\n", r2.startPosition, r2.length); IDWriteInlineObject_Release(inlinetest); -} + range.startPosition = 1; range.length = 1; hr = IDWriteTextLayout_SetInlineObject(layout, inlineobj2, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); inlinetest = NULL; - hr = IDWriteTextLayout_GetInlineObject(layout, 1, &inlinetest, NULL); -todo_wine + r2.startPosition = r2.length = 100; + hr = IDWriteTextLayout_GetInlineObject(layout, 1, &inlinetest, &r2); ok(hr == S_OK, "got 0x%08x\n", hr); -if (hr == S_OK) { ok(inlinetest == inlineobj2, "got %p\n", inlinetest); + ok(r2.startPosition == 1 && r2.length == 1, "got %d, %d\n", r2.startPosition, r2.length); IDWriteInlineObject_Release(inlinetest); -} + inlinetest = NULL; - hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, NULL); -todo_wine + r2.startPosition = r2.length = 100; + hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, &r2); ok(hr == S_OK, "got 0x%08x\n", hr); -if (hr == S_OK) { ok(inlinetest == inlineobj, "got %p\n", inlinetest); + ok(r2.startPosition == 0 && r2.length == 1, "got %d, %d\n", r2.startPosition, r2.length); IDWriteInlineObject_Release(inlinetest); -} + range.startPosition = 1; range.length = 1; hr = IDWriteTextLayout_SetInlineObject(layout, inlineobj, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + r2.startPosition = r2.length = 100; + hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, &r2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(inlinetest == inlineobj, "got %p\n", inlinetest); + ok(r2.startPosition == 0 && r2.length == 2, "got %d, %d\n", r2.startPosition, r2.length); + IDWriteInlineObject_Release(inlinetest); + range.startPosition = 1; range.length = 2; hr = IDWriteTextLayout_SetInlineObject(layout, inlineobj, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + r2.startPosition = r2.length = 100; + hr = IDWriteTextLayout_GetInlineObject(layout, 0, &inlinetest, &r2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(inlinetest == inlineobj, "got %p\n", inlinetest); + ok(r2.startPosition == 0 && r2.length == 3, "got %d, %d\n", r2.startPosition, r2.length); + IDWriteInlineObject_Release(inlinetest); + IDWriteTextLayout_Release(layout); IDWriteTextFormat_Release(format); } @@ -710,25 +714,21 @@ range.startPosition = 5; range.length = 1; hr = IDWriteTextLayout_SetStrikethrough(layout, TRUE, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); range.startPosition = 1; range.length = 1; hr = IDWriteTextLayout_SetInlineObject(layout, inlineobj, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); range.startPosition = 4; range.length = 1; hr = IDWriteTextLayout_SetDrawingEffect(layout, (IUnknown*)inlineobj, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); range.startPosition = 0; range.length = 1; hr = IDWriteTextLayout_SetUnderline(layout, TRUE, range); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); flush_sequence(sequences, RENDERER_ID); diff -Nru wine1.7-1.7.24/dlls/dwrite/tests/Makefile.in wine1.7-1.7.25/dlls/dwrite/tests/Makefile.in --- wine1.7-1.7.24/dlls/dwrite/tests/Makefile.in 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/tests/Makefile.in 2014-08-22 18:39:55.000000000 +0000 @@ -5,3 +5,8 @@ analyzer.c \ font.c \ layout.c + +FONT_SRCS = \ + wine_test.sfd + +RC_SRCS = resource.rc diff -Nru wine1.7-1.7.24/dlls/dwrite/tests/resource.rc wine1.7-1.7.25/dlls/dwrite/tests/resource.rc --- wine1.7-1.7.24/dlls/dwrite/tests/resource.rc 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/tests/resource.rc 2014-08-22 18:39:55.000000000 +0000 @@ -0,0 +1,24 @@ +/* + * Resources for dwrite test suite. + * + * Copyright 2010 Dmitry Timoshkov + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windef.h" + +/* @makedep: wine_test.ttf */ +1 RCDATA wine_test.ttf diff -Nru wine1.7-1.7.24/dlls/dwrite/tests/wine_test.sfd wine1.7-1.7.25/dlls/dwrite/tests/wine_test.sfd --- wine1.7-1.7.24/dlls/dwrite/tests/wine_test.sfd 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.25/dlls/dwrite/tests/wine_test.sfd 2014-08-22 18:39:55.000000000 +0000 @@ -0,0 +1,244 @@ +SplineFontDB: 3.0 +FontName: wine_test +FullName: wine_test +FamilyName: wine_test +Weight: Medium +Copyright: Copyright (c) 2010 Dmitry Timoshkov +Version: 001.000 +ItalicAngle: 0 +UnderlinePosition: -205 +UnderlineWidth: 102 +Ascent: 1638 +Descent: 410 +sfntRevision: 0x00010000 +LayerCount: 2 +Layer: 0 1 "Back" 1 +Layer: 1 1 "Fore" 0 +XUID: [1021 905 592216984 1247726] +FSType: 0 +OS2Version: 2 +OS2_WeightWidthSlopeOnly: 0 +OS2_UseTypoMetrics: 1 +PfmFamily: 17 +TTFWeight: 500 +TTFWidth: 5 +LineGap: 184 +VLineGap: 0 +Panose: 2 0 6 3 0 0 0 0 0 0 +OS2TypoAscent: 0 +OS2TypoAOffset: 1 +OS2TypoDescent: 0 +OS2TypoDOffset: 1 +OS2TypoLinegap: 184 +OS2WinAscent: 1638 +OS2WinAOffset: 0 +OS2WinDescent: 410 +OS2WinDOffset: 0 +HheadAscent: 0 +HheadAOffset: 1 +HheadDescent: 0 +HheadDOffset: 1 +OS2SubXSize: 1331 +OS2SubYSize: 1433 +OS2SubXOff: 0 +OS2SubYOff: 286 +OS2SupXSize: 1331 +OS2SupYSize: 1433 +OS2SupXOff: 0 +OS2SupYOff: 983 +OS2StrikeYSize: 102 +OS2StrikeYPos: 530 +OS2Vendor: 'Wine' +OS2CodePages: 00000001.00000000 +OS2UnicodeRanges: 00000001.00000000.00000000.00000000 +MarkAttachClasses: 1 +DEI: 91125 +ShortTable: cvt 2 + 68 + 1297 +EndShort +ShortTable: maxp 16 + 1 + 0 + 4 + 8 + 2 + 0 + 0 + 2 + 0 + 1 + 1 + 0 + 64 + 46 + 0 + 0 +EndShort +LangName: 1033 "" "" "" "Wine : wine_test : 4-11-2010" +GaspTable: 1 65535 2 0 +Encoding: UnicodeBmp +UnicodeInterp: none +NameList: Adobe Glyph List +DisplaySize: -24 +AntiAlias: 1 +FitToEm: 1 +WinInfo: 48 16 4 +BeginPrivate: 0 +EndPrivate +BeginChars: 65539 7 + +StartChar: .notdef +Encoding: 65536 -1 0 +AltUni2: 00fffe.ffffffff.0 00fffd.ffffffff.0 00fffc.ffffffff.0 00fffb.ffffffff.0 +Width: 748 +Flags: W +TtInstrs: +PUSHB_2 + 1 + 0 +MDAP[rnd] +ALIGNRP +PUSHB_3 + 7 + 4 + 0 +MIRP[min,rnd,black] +SHP[rp2] +PUSHB_2 + 6 + 5 +MDRP[rp0,min,rnd,grey] +ALIGNRP +PUSHB_3 + 3 + 2 + 0 +MIRP[min,rnd,black] +SHP[rp2] +SVTCA[y-axis] +PUSHB_2 + 3 + 0 +MDAP[rnd] +ALIGNRP +PUSHB_3 + 5 + 4 + 0 +MIRP[min,rnd,black] +SHP[rp2] +PUSHB_3 + 7 + 6 + 1 +MIRP[rp0,min,rnd,grey] +ALIGNRP +PUSHB_3 + 1 + 2 + 0 +MIRP[min,rnd,black] +SHP[rp2] +EndTTInstrs +LayerCount: 2 +Fore +SplineSet +68 0 m 1,0,-1 + 68 1365 l 1,1,-1 + 612 1365 l 1,2,-1 + 612 0 l 1,3,-1 + 68 0 l 1,0,-1 +136 68 m 1,4,-1 + 544 68 l 1,5,-1 + 544 1297 l 1,6,-1 + 136 1297 l 1,7,-1 + 136 68 l 1,4,-1 +EndSplineSet +EndChar + +StartChar: .null +Encoding: 65537 -1 1 +Width: 0 +Flags: W +LayerCount: 2 +EndChar + +StartChar: nonmarkingreturn +Encoding: 65538 -1 2 +Width: 682 +Flags: W +LayerCount: 2 +EndChar + +StartChar: exclam +Encoding: 33 33 3 +Width: 0 +Flags: W +LayerCount: 2 +EndChar + +StartChar: dieresis +Encoding: 168 168 4 +Width: 1000 +VWidth: 0 +Flags: W +LayerCount: 2 +Fore +SplineSet +620.215 824.429 m 1,0,1 + 760.84 777.554 760.84 777.554 713.965 636.929 c 1,2,-1 + 620.215 824.429 l 1,0,1 +154.883 324.971 m 0,3,-1 +254.492 773.213 m 1,4,5 + 310.707 834.805 310.707 834.805 374.609 767.354 c 1,6,7 + 410.471 728.672 410.471 728.672 374.609 691.182 c 0,8,9 + 308.375 621.934 308.375 621.934 254.492 688.252 c 0,10,11 + 216.406 735.127 216.406 735.127 254.492 773.213 c 1,4,5 +254.492 773.213 m 1,12,13 + 216.406 735.127 216.406 735.127 254.492 688.252 c 0,14,15 + 308.375 621.934 308.375 621.934 374.609 691.182 c 0,16,17 + 410.471 728.672 410.471 728.672 374.609 767.354 c 1,18,19 + 310.707 834.805 310.707 834.805 254.492 773.213 c 1,12,13 +EndSplineSet +EndChar + +StartChar: A +Encoding: 65 65 5 +Width: 1000 +VWidth: 0 +Flags: WO +LayerCount: 2 +Fore +SplineSet +459 1258 m 25,0,-1 + 462 1639 l 1,1,-1 + 389 1638 l 1,2,-1 + 492 1815 l 1,3,-1 + 609 1638.5 l 1,4,-1 + 531 1637.5 l 1,5,-1 + 523 1258 l 1,6,-1 + 459 1258 l 25,0,-1 +EndSplineSet +EndChar + +StartChar: D +Encoding: 68 68 6 +Width: 1000 +VWidth: 0 +Flags: WO +LayerCount: 2 +Fore +SplineSet +461 -30.7998 m 25,0,-1 + 464 -411.8 l 1,1,-1 + 391 -410.8 l 1,2,-1 + 494 -587.8 l 1,3,-1 + 611 -411.3 l 1,4,-1 + 533 -410.3 l 1,5,-1 + 525 -30.7998 l 1,6,-1 + 461 -30.7998 l 25,0,-1 +EndSplineSet +EndChar +EndChars +EndSplineFont Binary files /tmp/brKM5kcC46/wine1.7-1.7.24/dlls/dwrite/tests/wine_test.ttf and /tmp/BnQyYRu69W/wine1.7-1.7.25/dlls/dwrite/tests/wine_test.ttf differ diff -Nru wine1.7-1.7.24/dlls/gdi32/dib.c wine1.7-1.7.25/dlls/gdi32/dib.c --- wine1.7-1.7.24/dlls/gdi32/dib.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/gdi32/dib.c 2014-08-22 18:39:55.000000000 +0000 @@ -961,7 +961,6 @@ } static const DWORD bit_fields_888[3] = {0xff0000, 0x00ff00, 0x0000ff}; -static const DWORD bit_fields_565[3] = {0xf800, 0x07e0, 0x001f}; static const DWORD bit_fields_555[3] = {0x7c00, 0x03e0, 0x001f}; static int fill_query_info( BITMAPINFO *info, BITMAPOBJ *bmp ) diff -Nru wine1.7-1.7.24/dlls/imagehlp/tests/image.c wine1.7-1.7.25/dlls/imagehlp/tests/image.c --- wine1.7-1.7.24/dlls/imagehlp/tests/image.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/imagehlp/tests/image.c 2014-08-22 18:39:55.000000000 +0000 @@ -405,7 +405,12 @@ WriteFile(file, &bin, sizeof(bin), &count, NULL); CloseHandle(file); - /* call with a proper PE file */ + /* call with a proper PE file, but with StatusRoutine set to NULL */ + ret = pBindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES, temp_file, 0, 0, + NULL); + ok(ret, "BindImageEx failed: %d\n", GetLastError()); + + /* call with a proper PE file and StatusRoutine */ ret = pBindImageEx(BIND_NO_BOUND_IMPORTS | BIND_NO_UPDATE | BIND_ALL_IMAGES, temp_file, 0, 0, testing_status_routine); ok(ret, "BindImageEx failed: %d\n", GetLastError()); diff -Nru wine1.7-1.7.24/dlls/kernel32/kernel_private.h wine1.7-1.7.25/dlls/kernel32/kernel_private.h --- wine1.7-1.7.24/dlls/kernel32/kernel_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/kernel32/kernel_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -75,8 +75,9 @@ BINARY_UNIX_LIB }; -#define BINARY_FLAG_DLL 0x01 -#define BINARY_FLAG_64BIT 0x02 +#define BINARY_FLAG_DLL 0x01 +#define BINARY_FLAG_64BIT 0x02 +#define BINARY_FLAG_FAKEDLL 0x04 struct binary_info { diff -Nru wine1.7-1.7.24/dlls/kernel32/module.c wine1.7-1.7.25/dlls/kernel32/module.c --- wine1.7-1.7.24/dlls/kernel32/module.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/kernel32/module.c 2014-08-22 18:39:55.000000000 +0000 @@ -339,6 +339,9 @@ { if (len >= sizeof(ext_header.nt.FileHeader)) { + static const char fakedll_signature[] = "Wine placeholder DLL"; + char buffer[sizeof(fakedll_signature)]; + info->type = BINARY_PE; info->arch = ext_header.nt.FileHeader.Machine; if (ext_header.nt.FileHeader.Characteristics & IMAGE_FILE_DLL) @@ -356,6 +359,15 @@ info->flags |= BINARY_FLAG_64BIT; break; } + + if (header.mz.e_lfanew >= sizeof(header.mz) + sizeof(fakedll_signature) && + SetFilePointer( hfile, sizeof(header.mz), NULL, SEEK_SET ) == sizeof(header.mz) && + ReadFile( hfile, buffer, sizeof(fakedll_signature), &len, NULL ) && + len == sizeof(fakedll_signature) && + !memcmp( buffer, fakedll_signature, sizeof(fakedll_signature) )) + { + info->flags |= BINARY_FLAG_FAKEDLL; + } } } else if (!memcmp( &ext_header.os2.ne_magic, "NE", 2 )) diff -Nru wine1.7-1.7.24/dlls/kernel32/process.c wine1.7-1.7.25/dlls/kernel32/process.c --- wine1.7-1.7.24/dlls/kernel32/process.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/kernel32/process.c 2014-08-22 18:39:55.000000000 +0000 @@ -2342,9 +2342,10 @@ else switch (binary_info.type) { case BINARY_PE: - TRACE( "starting %s as Win%d binary (%p-%p, arch %04x)\n", + TRACE( "starting %s as Win%d binary (%p-%p, arch %04x%s)\n", debugstr_w(name), (binary_info.flags & BINARY_FLAG_64BIT) ? 64 : 32, - binary_info.res_start, binary_info.res_end, binary_info.arch ); + binary_info.res_start, binary_info.res_end, binary_info.arch, + (binary_info.flags & BINARY_FLAG_FAKEDLL) ? ", fakedll" : "" ); retv = create_process( hFile, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr, inherit, flags, startup_info, info, unixdir, &binary_info, FALSE ); break; diff -Nru wine1.7-1.7.24/dlls/kernel32/sync.c wine1.7-1.7.25/dlls/kernel32/sync.c --- wine1.7-1.7.24/dlls/kernel32/sync.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/kernel32/sync.c 2014-08-22 18:39:55.000000000 +0000 @@ -1712,12 +1712,16 @@ LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUsername, DWORD nUsernameMaxSize) { - FIXME("%p %p %p %p %p %p %d\n", - hNamedPipe, lpState, lpCurInstances, - lpMaxCollectionCount, lpCollectDataTimeout, - lpUsername, nUsernameMaxSize); + WARN("%p %p %p %p %p %p %d: semi-stub\n", + hNamedPipe, lpState, lpCurInstances, + lpMaxCollectionCount, lpCollectDataTimeout, + lpUsername, nUsernameMaxSize); + + if (lpUsername && nUsernameMaxSize) + *lpUsername = 0; - return FALSE; + return GetNamedPipeHandleStateW(hNamedPipe, lpState, lpCurInstances, + lpMaxCollectionCount, lpCollectDataTimeout, NULL, 0); } /*********************************************************************** @@ -1728,12 +1732,53 @@ LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUsername, DWORD nUsernameMaxSize) { - FIXME("%p %p %p %p %p %p %d\n", + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + FIXME("%p %p %p %p %p %p %d: semi-stub\n", hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout, lpUsername, nUsernameMaxSize); - return FALSE; + if (lpMaxCollectionCount) + *lpMaxCollectionCount = 0; + + if (lpCollectDataTimeout) + *lpCollectDataTimeout = 0; + + if (lpUsername && nUsernameMaxSize) + *lpUsername = 0; + + if (lpState) + { + FILE_PIPE_INFORMATION fpi; + status = NtQueryInformationFile(hNamedPipe, &iosb, &fpi, sizeof(fpi), + FilePipeInformation); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + + *lpState = (fpi.ReadMode ? PIPE_READMODE_MESSAGE : PIPE_READMODE_BYTE) | + (fpi.CompletionMode ? PIPE_NOWAIT : PIPE_WAIT); + } + + if (lpCurInstances) + { + FILE_PIPE_LOCAL_INFORMATION fpli; + status = NtQueryInformationFile(hNamedPipe, &iosb, &fpli, sizeof(fpli), + FilePipeLocalInformation); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + + *lpCurInstances = fpli.CurrentInstances; + } + + return TRUE; } /*********************************************************************** @@ -1745,9 +1790,34 @@ { /* should be a fixme, but this function is called a lot by the RPC * runtime, and it slows down InstallShield a fair bit. */ - WARN("stub: %p %p/%d %p %p\n", + WARN("semi-stub: %p %p/%d %p %p\n", hNamedPipe, lpMode, lpMode ? *lpMode : 0, lpMaxCollectionCount, lpCollectDataTimeout); - return FALSE; + + if (lpMode) + { + FILE_PIPE_INFORMATION fpi; + IO_STATUS_BLOCK iosb; + NTSTATUS status; + + if (*lpMode & ~(PIPE_READMODE_MESSAGE | PIPE_NOWAIT)) + status = STATUS_INVALID_PARAMETER; + else + { + fpi.CompletionMode = (*lpMode & PIPE_NOWAIT) ? + FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION; + fpi.ReadMode = (*lpMode & PIPE_READMODE_MESSAGE) ? + FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE; + status = NtSetInformationFile(hNamedPipe, &iosb, &fpi, sizeof(fpi), FilePipeInformation); + } + + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + } + + return TRUE; } /*********************************************************************** @@ -1809,15 +1879,11 @@ mode = PIPE_READMODE_MESSAGE; ret = SetNamedPipeHandleState(pipe, &mode, NULL, NULL); - - /* Currently SetNamedPipeHandleState() is a stub returning FALSE */ - if (ret) FIXME("Now that SetNamedPipeHandleState() is more than a stub, please update CallNamedPipeW\n"); - /* if (!ret) { CloseHandle(pipe); return FALSE; - }*/ + } ret = TransactNamedPipe(pipe, lpInput, lpInputSize, lpOutput, lpOutputSize, lpBytesRead, NULL); CloseHandle(pipe); diff -Nru wine1.7-1.7.24/dlls/kernel32/tests/pipe.c wine1.7-1.7.25/dlls/kernel32/tests/pipe.c --- wine1.7-1.7.24/dlls/kernel32/tests/pipe.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/kernel32/tests/pipe.c 2014-08-22 18:39:55.000000000 +0000 @@ -153,20 +153,13 @@ ok(written == sizeof(obuf2), "write file len 3b\n"); ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek3\n"); if (pipemode == PIPE_TYPE_BYTE) { - if (readden != sizeof(obuf)) /* Linux only returns the first message */ - ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden); - else - todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden); + todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden); } else { - if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both messages */ - ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden); - else - todo_wine ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden); + ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden); } - if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes available\n", avail); + ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes available\n", avail); pbuf = ibuf; ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 3a check\n"); if (pipemode == PIPE_TYPE_BYTE && readden >= sizeof(obuf)+sizeof(obuf2)) { @@ -188,21 +181,13 @@ ok(written == sizeof(obuf2), "write file len 4b\n"); ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek4\n"); if (pipemode == PIPE_TYPE_BYTE) { - if (readden != sizeof(obuf)) /* Linux only returns the first message */ - /* should return all 23 bytes */ - ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden); - else - todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden); + todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden); } else { - if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both messages */ - ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden); - else - todo_wine ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden); + ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden); } - if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes available\n", avail); + ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes available\n", avail); pbuf = ibuf; ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 4a check\n"); if (pipemode == PIPE_TYPE_BYTE && readden >= sizeof(obuf)+sizeof(obuf2)) { @@ -233,9 +218,7 @@ ok(!SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n"); } else { - todo_wine { - ok(SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n"); - } + ok(SetNamedPipeHandleState(hFile, &lpmode, NULL, NULL), "Change mode\n"); memset(ibuf, 0, sizeof(ibuf)); ok(WriteFile(hnp, obuf, sizeof(obuf), &written, NULL), "WriteFile5a\n"); @@ -243,14 +226,8 @@ ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), " WriteFile5b\n"); ok(written == sizeof(obuf2), "write file len 3b\n"); ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek5\n"); - if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both writes */ - ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden); - else - todo_wine ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden); - if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail); - else - todo_wine ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail); + ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden); + ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d 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"); @@ -279,12 +256,8 @@ ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), " WriteFile6b\n"); ok(written == sizeof(obuf2), "write file len 6b\n"); ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6\n"); - if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both writes */ - ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden); - else - todo_wine ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden); - if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ - ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %d bytes available\n", avail); + ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden); + ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %d 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"); @@ -1662,11 +1635,9 @@ /* lpSecurityAttrib */ NULL); ok(server != INVALID_HANDLE_VALUE, "cf failed\n"); ret = GetNamedPipeHandleStateA(server, NULL, NULL, NULL, NULL, NULL, 0); - todo_wine ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError()); ret = GetNamedPipeHandleStateA(server, &state, &instances, NULL, NULL, NULL, 0); - todo_wine ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError()); if (ret) { @@ -1687,7 +1658,6 @@ state = PIPE_READMODE_MESSAGE; SetLastError(0xdeadbeef); ret = SetNamedPipeHandleState(server, &state, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); @@ -1697,13 +1667,11 @@ state = PIPE_READMODE_BYTE; ret = SetNamedPipeHandleState(client, &state, NULL, NULL); - todo_wine ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError()); /* A byte-mode pipe client can't be changed to message mode, either. */ state = PIPE_READMODE_MESSAGE; SetLastError(0xdeadbeef); ret = SetNamedPipeHandleState(server, &state, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); @@ -1719,11 +1687,9 @@ /* lpSecurityAttrib */ NULL); ok(server != INVALID_HANDLE_VALUE, "cf failed\n"); ret = GetNamedPipeHandleStateA(server, NULL, NULL, NULL, NULL, NULL, 0); - todo_wine ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError()); ret = GetNamedPipeHandleStateA(server, &state, &instances, NULL, NULL, NULL, 0); - todo_wine ok(ret, "GetNamedPipeHandleState failed: %d\n", GetLastError()); if (ret) { @@ -1735,7 +1701,6 @@ */ state = PIPE_READMODE_BYTE; ret = SetNamedPipeHandleState(server, &state, NULL, NULL); - todo_wine ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError()); client = CreateFileA(PIPENAME, GENERIC_READ|GENERIC_WRITE, 0, NULL, @@ -1744,13 +1709,11 @@ state = PIPE_READMODE_MESSAGE; ret = SetNamedPipeHandleState(client, &state, NULL, NULL); - todo_wine ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError()); /* A message-mode pipe client can also be changed to byte mode. */ state = PIPE_READMODE_BYTE; ret = SetNamedPipeHandleState(client, &state, NULL, NULL); - todo_wine ok(ret, "SetNamedPipeHandleState failed: %d\n", GetLastError()); CloseHandle(client); @@ -1857,6 +1820,14 @@ wait = WaitForSingleObjectEx(event, 0, TRUE); ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait); + if (wait == WAIT_TIMEOUT) + { + ret = ReadFile(client, read_buf, sizeof(read_buf), &num_bytes, NULL); + ok(ret == TRUE, "ReadFile failed\n"); + ok(completion_called == 0, "completion routine called during ReadFile\n"); + wait = WaitForSingleObjectEx(event, 0, TRUE); + ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait); + } ok(completion_called == 1, "completion routine not called\n"); ok(completion_errorcode == 0, "completion called with error %x\n", completion_errorcode); diff -Nru wine1.7-1.7.24/dlls/mscoree/corruntimehost.c wine1.7-1.7.25/dlls/mscoree/corruntimehost.c --- wine1.7-1.7.24/dlls/mscoree/corruntimehost.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mscoree/corruntimehost.c 2014-08-22 18:39:55.000000000 +0000 @@ -153,23 +153,25 @@ LeaveCriticalSection(&This->lock); } -static HRESULT RuntimeHost_GetIUnknownForDomain(RuntimeHost *This, MonoDomain *domain, IUnknown **punk) +static HRESULT RuntimeHost_Invoke(RuntimeHost *This, MonoDomain *domain, + const char *assemblyname, const char *namespace, const char *typename, const char *methodname, + MonoObject *obj, void **args, int arg_count, MonoObject **result) { - HRESULT hr; - void *args[1]; MonoAssembly *assembly; MonoImage *image; MonoClass *klass; MonoMethod *method; - MonoObject *appdomain_object; - IUnknown *unk; + MonoObject *exc; + static const char *get_hresult = "get_HResult"; + + *result = NULL; mono_thread_attach(domain); - assembly = mono_domain_assembly_open(domain, "mscorlib"); + assembly = mono_domain_assembly_open(domain, assemblyname); if (!assembly) { - ERR("Cannot load mscorlib\n"); + ERR("Cannot load assembly\n"); return E_FAIL; } @@ -180,29 +182,57 @@ return E_FAIL; } - klass = mono_class_from_name(image, "System", "AppDomain"); + klass = mono_class_from_name(image, namespace, typename); if (!klass) { ERR("Couldn't get class from image\n"); return E_FAIL; } - method = mono_class_get_method_from_name(klass, "get_CurrentDomain", 0); + method = mono_class_get_method_from_name(klass, methodname, arg_count); if (!method) { ERR("Couldn't get method from class\n"); return E_FAIL; } - args[0] = NULL; - appdomain_object = mono_runtime_invoke(method, NULL, args, NULL); - if (!appdomain_object) + *result = mono_runtime_invoke(method, obj, args, &exc); + if (exc) { - ERR("Couldn't get result pointer\n"); - return E_FAIL; + HRESULT hr; + MonoObject *hr_object; + + if (methodname != get_hresult) + { + /* Map the exception to an HRESULT. */ + hr = RuntimeHost_Invoke(This, domain, "mscorlib", "System", "Exception", get_hresult, + exc, NULL, 0, &hr_object); + if (SUCCEEDED(hr)) + hr = *(HRESULT*)mono_object_unbox(hr_object); + if (SUCCEEDED(hr)) + hr = E_FAIL; + } + else + hr = E_FAIL; + ERR("Method %s.%s raised an exception, hr=%x\n", namespace, typename, hr); + *result = NULL; + return hr; } - hr = RuntimeHost_GetIUnknownForObject(This, appdomain_object, &unk); + return S_OK; +} + +static HRESULT RuntimeHost_GetIUnknownForDomain(RuntimeHost *This, MonoDomain *domain, IUnknown **punk) +{ + HRESULT hr; + MonoObject *appdomain_object; + IUnknown *unk; + + hr = RuntimeHost_Invoke(This, domain, "mscorlib", "System", "AppDomain", "get_CurrentDomain", + NULL, NULL, 0, &appdomain_object); + + if (SUCCEEDED(hr)) + hr = RuntimeHost_GetIUnknownForObject(This, appdomain_object, &unk); if (SUCCEEDED(hr)) { @@ -219,10 +249,7 @@ HRESULT hr; void *args[2]; MonoDomain *domain; - MonoAssembly *assembly; - MonoImage *image; - MonoClass *klass; - MonoMethod *method; + MonoObject *dummy; hr = RuntimeHost_GetDefaultDomain(This, &domain); if (FAILED(hr)) @@ -231,39 +258,10 @@ return; } - mono_thread_attach(domain); - - assembly = mono_domain_assembly_open(domain, "mscorlib"); - if (!assembly) - { - ERR("Cannot load mscorlib\n"); - return; - } - - image = mono_assembly_get_image(assembly); - if (!image) - { - ERR("Couldn't get assembly image\n"); - return; - } - - klass = mono_class_from_name(image, "System", "Environment"); - if (!klass) - { - ERR("Couldn't get class from image\n"); - return; - } - - method = mono_class_get_method_from_name(klass, "Exit", 1); - if (!method) - { - ERR("Couldn't get method from class\n"); - return; - } - args[0] = &exitcode; args[1] = NULL; - mono_runtime_invoke(method, NULL, args, NULL); + RuntimeHost_Invoke(This, domain, "mscorlib", "System", "Environment", "Exit", + NULL, args, 1, &dummy); ERR("Process should have exited\n"); } @@ -378,8 +376,12 @@ static HRESULT WINAPI corruntimehost_Start( ICorRuntimeHost* iface) { - FIXME("stub %p\n", iface); - return S_OK; + RuntimeHost *This = impl_from_ICorRuntimeHost( iface ); + MonoDomain *dummy; + + TRACE("%p\n", This); + + return RuntimeHost_GetDefaultDomain(This, &dummy); } static HRESULT WINAPI corruntimehost_Stop( @@ -459,8 +461,23 @@ ICorRuntimeHost* iface, IUnknown **appDomainSetup) { - FIXME("stub %p\n", iface); - return E_NOTIMPL; + RuntimeHost *This = impl_from_ICorRuntimeHost( iface ); + HRESULT hr; + MonoDomain *domain; + MonoObject *obj; + static const WCHAR classnameW[] = {'S','y','s','t','e','m','.','A','p','p','D','o','m','a','i','n','S','e','t','u','p',',','m','s','c','o','r','l','i','b',0}; + + TRACE("(%p)\n", iface); + + hr = RuntimeHost_GetDefaultDomain(This, &domain); + + if (SUCCEEDED(hr)) + hr = RuntimeHost_CreateManagedInstance(This, classnameW, domain, &obj); + + if (SUCCEEDED(hr)) + hr = RuntimeHost_GetIUnknownForObject(This, obj, appDomainSetup); + + return hr; } static HRESULT WINAPI corruntimehost_CreateEvidence( @@ -610,13 +627,8 @@ RuntimeHost *This = impl_from_ICLRRuntimeHost( iface ); HRESULT hr; MonoDomain *domain; - MonoAssembly *assembly; - MonoImage *image; - MonoClass *klass; - MonoMethod *method; MonoObject *result; MonoString *str; - void *args[2]; char *filenameA = NULL, *classA = NULL, *methodA = NULL; char *argsA = NULL, *ns; @@ -624,66 +636,60 @@ debugstr_w(pwzTypeName), debugstr_w(pwzMethodName), debugstr_w(pwzArgument)); hr = RuntimeHost_GetDefaultDomain(This, &domain); - if(hr != S_OK) - { - ERR("Couldn't get Default Domain\n"); - return hr; - } - - hr = E_FAIL; - mono_thread_attach(domain); - - filenameA = WtoA(pwzAssemblyPath); - assembly = mono_domain_assembly_open(domain, filenameA); - if (!assembly) + if (SUCCEEDED(hr)) { - ERR("Cannot open assembly %s\n", filenameA); - goto cleanup; + mono_thread_attach(domain); + + filenameA = WtoA(pwzAssemblyPath); + if (!filenameA) hr = E_OUTOFMEMORY; } - image = mono_assembly_get_image(assembly); - if (!image) + if (SUCCEEDED(hr)) { - ERR("Couldn't get assembly image\n"); - goto cleanup; + classA = WtoA(pwzTypeName); + if (!classA) hr = E_OUTOFMEMORY; } - classA = WtoA(pwzTypeName); - ns = strrchr(classA, '.'); - *ns = '\0'; - klass = mono_class_from_name(image, classA, ns+1); - if (!klass) + if (SUCCEEDED(hr)) { - ERR("Couldn't get class from image\n"); - goto cleanup; + ns = strrchr(classA, '.'); + if (ns) + *ns = '\0'; + else + hr = E_INVALIDARG; } - methodA = WtoA(pwzMethodName); - method = mono_class_get_method_from_name(klass, methodA, 1); - if (!method) + if (SUCCEEDED(hr)) { - ERR("Couldn't get method from class\n"); - goto cleanup; + methodA = WtoA(pwzMethodName); + if (!methodA) hr = E_OUTOFMEMORY; } /* The .NET function we are calling has the following declaration * public static int functionName(String param) */ - argsA = WtoA(pwzArgument); - str = mono_string_new(domain, argsA); - args[0] = str; - args[1] = NULL; - result = mono_runtime_invoke(method, NULL, args, NULL); - if (!result) - ERR("Couldn't get result pointer\n"); - else + if (SUCCEEDED(hr)) { - *pReturnValue = *(DWORD*)mono_object_unbox(result); - hr = S_OK; + argsA = WtoA(pwzArgument); + if (!argsA) hr = E_OUTOFMEMORY; } -cleanup: + if (SUCCEEDED(hr)) + { + str = mono_string_new(domain, argsA); + if (!str) hr = E_OUTOFMEMORY; + } + + if (SUCCEEDED(hr)) + { + hr = RuntimeHost_Invoke(This, domain, filenameA, classA, ns+1, methodA, + NULL, (void**)&str, 1, &result); + } + + if (SUCCEEDED(hr)) + *pReturnValue = *(DWORD*)mono_object_unbox(result); + HeapFree(GetProcessHeap(), 0, filenameA); HeapFree(GetProcessHeap(), 0, classA); HeapFree(GetProcessHeap(), 0, argsA); @@ -788,60 +794,20 @@ IUnknown **ppUnk) { MonoDomain *domain; - MonoAssembly *assembly; - MonoImage *image; - MonoClass *klass; - MonoMethod *method; MonoObject *result; - void *args[2]; + HRESULT hr; domain = mono_object_get_domain(obj); - assembly = mono_domain_assembly_open(domain, "mscorlib"); - if (!assembly) - { - ERR("Cannot load mscorlib\n"); - return E_FAIL; - } - - image = mono_assembly_get_image(assembly); - if (!image) - { - ERR("Couldn't get assembly image\n"); - return E_FAIL; - } - - klass = mono_class_from_name(image, "System.Runtime.InteropServices", "Marshal"); - if (!klass) - { - ERR("Couldn't get class from image\n"); - return E_FAIL; - } - - method = mono_class_get_method_from_name(klass, "GetIUnknownForObject", 1); - if (!method) - { - ERR("Couldn't get method from class\n"); - return E_FAIL; - } + hr = RuntimeHost_Invoke(This, domain, "mscorlib", "System.Runtime.InteropServices", "Marshal", "GetIUnknownForObject", + NULL, (void**)&obj, 1, &result); - args[0] = obj; - args[1] = NULL; - result = mono_runtime_invoke(method, NULL, args, NULL); - if (!result) - { - ERR("Couldn't get result pointer\n"); - return E_FAIL; - } - - *ppUnk = *(IUnknown**)mono_object_unbox(result); - if (!*ppUnk) - { - ERR("GetIUnknownForObject returned 0\n"); - return E_FAIL; - } + if (SUCCEEDED(hr)) + *ppUnk = *(IUnknown**)mono_object_unbox(result); + else + *ppUnk = NULL; - return S_OK; + return hr; } static void get_utf8_args(int *argc, char ***argv) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmldoc.c wine1.7-1.7.25/dlls/mshtml/htmldoc.c --- wine1.7-1.7.24/dlls/mshtml/htmldoc.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmldoc.c 2014-08-22 18:39:55.000000000 +0000 @@ -2617,8 +2617,21 @@ static HRESULT WINAPI HTMLDocument5_get_implementation(IHTMLDocument5 *iface, IHTMLDOMImplementation **p) { HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + HTMLDocumentNode *doc_node = This->doc_node; + + TRACE("(%p)->(%p)\n", This, p); + + if(!doc_node->dom_implementation) { + HRESULT hres; + + hres = create_dom_implementation(&doc_node->dom_implementation); + if(FAILED(hres)) + return hres; + } + + IHTMLDOMImplementation_AddRef(doc_node->dom_implementation); + *p = doc_node->dom_implementation; + return S_OK; } static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName, diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlelem.c wine1.7-1.7.25/dlls/mshtml/htmlelem.c --- wine1.7-1.7.24/dlls/mshtml/htmlelem.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlelem.c 2014-08-22 18:39:55.000000000 +0000 @@ -882,22 +882,22 @@ VARIANT_BOOL *pfResult) { HTMLElement *This = impl_from_IHTMLElement(iface); - HTMLElement *child; - cpp_bool result; - nsresult nsres; + cpp_bool result = FALSE; TRACE("(%p)->(%p %p)\n", This, pChild, pfResult); - child = unsafe_impl_from_IHTMLElement(pChild); - if(!child) { - ERR("not our element\n"); - return E_FAIL; - } + if(pChild) { + HTMLElement *child; + nsresult nsres; + + child = unsafe_impl_from_IHTMLElement(pChild); + if(!child) { + ERR("not our element\n"); + return E_FAIL; + } - nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result); - if(NS_FAILED(nsres)) { - ERR("failed\n"); - return E_FAIL; + nsres = nsIDOMNode_Contains(This->node.nsnode, child->node.nsnode, &result); + assert(nsres == NS_OK); } *pfResult = result ? VARIANT_TRUE : VARIANT_FALSE; diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlevent.c wine1.7-1.7.25/dlls/mshtml/htmlevent.c --- wine1.7-1.7.24/dlls/mshtml/htmlevent.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlevent.c 2014-08-22 18:39:55.000000000 +0000 @@ -218,7 +218,7 @@ {selectstartW, onselectstartW, EVENTT_MOUSE, DISPID_EVMETH_ONSELECTSTART, EVENT_CANCELABLE}, {submitW, onsubmitW, EVENTT_HTML, DISPID_EVMETH_ONSUBMIT, - EVENT_DEFAULTLISTENER|EVENT_BUBBLE|EVENT_CANCELABLE} + EVENT_DEFAULTLISTENER|EVENT_BUBBLE|EVENT_CANCELABLE|EVENT_HASDEFAULTHANDLERS} }; eventid_t str_to_eid(LPCWSTR str) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlform.c wine1.7-1.7.25/dlls/mshtml/htmlform.c --- wine1.7-1.7.24/dlls/mshtml/htmlform.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlform.c 2014-08-22 18:39:55.000000000 +0000 @@ -714,12 +714,24 @@ return S_OK; } +static HRESULT HTMLFormElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default) +{ + HTMLFormElement *This = impl_from_HTMLDOMNode(iface); + + if(eid == EVENTID_SUBMIT) { + *prevent_default = TRUE; + return IHTMLFormElement_submit(&This->IHTMLFormElement_iface); + } + + return HTMLElement_handle_event(&This->element.node, eid, event, prevent_default); +} + static const NodeImplVtbl HTMLFormElementImplVtbl = { HTMLFormElement_QI, HTMLElement_destructor, HTMLElement_cpc, HTMLElement_clone, - HTMLElement_handle_event, + HTMLFormElement_handle_event, HTMLElement_get_attr_col, NULL, NULL, diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlimg.c wine1.7-1.7.25/dlls/mshtml/htmlimg.c --- wine1.7-1.7.24/dlls/mshtml/htmlimg.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlimg.c 2014-08-22 18:39:55.000000000 +0000 @@ -102,15 +102,37 @@ static HRESULT WINAPI HTMLImgElement_put_isMap(IHTMLImgElement *iface, VARIANT_BOOL v) { HTMLImgElement *This = impl_from_IHTMLImgElement(iface); - FIXME("(%p)->(%x)\n", This, v); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%x)\n", This, v); + + nsres = nsIDOMHTMLImageElement_SetIsMap(This->nsimg, v != VARIANT_FALSE); + if (NS_FAILED(nsres)) { + ERR("Set IsMap failed: %08x\n", nsres); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLImgElement_get_isMap(IHTMLImgElement *iface, VARIANT_BOOL *p) { HTMLImgElement *This = impl_from_IHTMLImgElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + cpp_bool b; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + if (p == NULL) + return E_INVALIDARG; + + nsres = nsIDOMHTMLImageElement_GetIsMap(This->nsimg, &b); + if (NS_FAILED(nsres)) { + ERR("Get IsMap failed: %08x\n", nsres); + return E_FAIL; + } + *p = b ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI HTMLImgElement_put_useMap(IHTMLImgElement *iface, BSTR v) @@ -390,15 +412,35 @@ static HRESULT WINAPI HTMLImgElement_put_align(IHTMLImgElement *iface, BSTR v) { HTMLImgElement *This = impl_from_IHTMLImgElement(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&str, v); + + nsres = nsIDOMHTMLImageElement_SetAlign(This->nsimg, &str); + nsAString_Finish(&str); + if (NS_FAILED(nsres)){ + ERR("Set Align(%s) failed: %08x\n", debugstr_w(v), nsres); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLImgElement_get_align(IHTMLImgElement *iface, BSTR *p) { HTMLImgElement *This = impl_from_IHTMLImgElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&str, NULL); + nsres = nsIDOMHTMLImageElement_GetAlign(This->nsimg, &str); + + return return_nsstr(nsres, &str, p); } static HRESULT WINAPI HTMLImgElement_put_onload(IHTMLImgElement *iface, VARIANT v) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlinput.c wine1.7-1.7.25/dlls/mshtml/htmlinput.c --- wine1.7-1.7.24/dlls/mshtml/htmlinput.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlinput.c 2014-08-22 18:39:55.000000000 +0000 @@ -255,22 +255,66 @@ static HRESULT WINAPI HTMLInputElement_get_form(IHTMLInputElement *iface, IHTMLFormElement **p) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsIDOMHTMLFormElement *nsform; + HTMLDOMNode *node; + HRESULT hres; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMHTMLInputElement_GetForm(This->nsinput, &nsform); + if (NS_FAILED(nsres) || nsform == NULL) { + ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform); + *p = NULL; + return E_FAIL; + } + + hres = get_node(This->element.node.doc, (nsIDOMNode*)nsform, TRUE, &node); + nsIDOMHTMLFormElement_Release(nsform); + if (FAILED(hres)) + return hres; + + hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p); + + node_release(node); + return hres; } static HRESULT WINAPI HTMLInputElement_put_size(IHTMLInputElement *iface, LONG v) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%d)\n", This, v); - return E_NOTIMPL; + UINT32 val = v; + nsresult nsres; + + TRACE("(%p)->(%d)\n", This, v); + if (v <= 0) + return CTL_E_INVALIDPROPERTYVALUE; + + nsres = nsIDOMHTMLInputElement_SetSize(This->nsinput, val); + if (NS_FAILED(nsres)) { + ERR("Set Size(%u) failed: %08x\n", val, nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLInputElement_get_size(IHTMLInputElement *iface, LONG *p) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + UINT32 val; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + if (p == NULL) + return E_INVALIDARG; + + nsres = nsIDOMHTMLInputElement_GetSize(This->nsinput, &val); + if (NS_FAILED(nsres)) { + ERR("Get Size failed: %08x\n", nsres); + return E_FAIL; + } + *p = val; + return S_OK; } static HRESULT WINAPI HTMLInputElement_put_maxLength(IHTMLInputElement *iface, LONG v) @@ -389,15 +433,33 @@ static HRESULT WINAPI HTMLInputElement_put_readOnly(IHTMLInputElement *iface, VARIANT_BOOL v) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%x)\n", This, v); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%x)\n", This, v); + + nsres = nsIDOMHTMLInputElement_SetReadOnly(This->nsinput, v != VARIANT_FALSE); + if (NS_FAILED(nsres)) { + ERR("Set ReadOnly Failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLInputElement_get_readOnly(IHTMLInputElement *iface, VARIANT_BOOL *p) { HTMLInputElement *This = impl_from_IHTMLInputElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsresult nsres; + cpp_bool b; + + TRACE("(%p)->(%p)\n", This, p); + + nsres = nsIDOMHTMLInputElement_GetReadOnly(This->nsinput, &b); + if (NS_FAILED(nsres)) { + ERR("Get ReadOnly Failed: %08x\n", nsres); + return E_FAIL; + } + *p = b ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI HTMLInputElement_createTextRange(IHTMLInputElement *iface, IHTMLTxtRange **range) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmllink.c wine1.7-1.7.25/dlls/mshtml/htmllink.c --- wine1.7-1.7.24/dlls/mshtml/htmllink.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmllink.c 2014-08-22 18:39:55.000000000 +0000 @@ -161,15 +161,33 @@ static HRESULT WINAPI HTMLLinkElement_put_rev(IHTMLLinkElement *iface, BSTR v) { HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&nsstr, v); + nsres = nsIDOMHTMLLinkElement_SetRev(This->nslink, &nsstr); + nsAString_Finish(&nsstr); + if(NS_FAILED(nsres)) { + ERR("SetRev failed: %08x\n", nsres); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLLinkElement_get_rev(IHTMLLinkElement *iface, BSTR *p) { HTMLLinkElement *This = impl_from_IHTMLLinkElement(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString nsstr; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&nsstr, NULL); + nsres = nsIDOMHTMLLinkElement_GetRev(This->nslink, &nsstr); + return return_nsstr(nsres, &nsstr, p); } static HRESULT WINAPI HTMLLinkElement_put_type(IHTMLLinkElement *iface, BSTR v) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlstyle2.c wine1.7-1.7.25/dlls/mshtml/htmlstyle2.c --- wine1.7-1.7.24/dlls/mshtml/htmlstyle2.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlstyle2.c 2014-08-22 18:39:55.000000000 +0000 @@ -92,15 +92,19 @@ static HRESULT WINAPI HTMLStyle2_put_tableLayout(IHTMLStyle2 *iface, BSTR v) { HTMLStyle *This = impl_from_IHTMLStyle2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_nsstyle_attr(This->nsstyle, STYLEID_TABLE_LAYOUT, v, 0); } static HRESULT WINAPI HTMLStyle2_get_tableLayout(IHTMLStyle2 *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr(This->nsstyle, STYLEID_TABLE_LAYOUT, p, 0); } static HRESULT WINAPI HTMLStyle2_put_borderCollapse(IHTMLStyle2 *iface, BSTR v) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlstyle.c wine1.7-1.7.25/dlls/mshtml/htmlstyle.c --- wine1.7-1.7.24/dlls/mshtml/htmlstyle.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlstyle.c 2014-08-22 18:39:55.000000000 +0000 @@ -37,6 +37,8 @@ static const WCHAR attrBackground[] = {'b','a','c','k','g','r','o','u','n','d',0}; +static const WCHAR attrBackgroundAttachment[] = + {'b','a','c','k','g','r','o','u','n','d','-','a','t','t','a','c','h','m','e','n','t',0}; static const WCHAR attrBackgroundColor[] = {'b','a','c','k','g','r','o','u','n','d','-','c','o','l','o','r',0}; static const WCHAR attrBackgroundImage[] = @@ -126,8 +128,12 @@ {'l','e','t','t','e','r','-','s','p','a','c','i','n','g',0}; static const WCHAR attrLineHeight[] = {'l','i','n','e','-','h','e','i','g','h','t',0}; +static const WCHAR attrListStyle[] = + {'l','i','s','t','-','s','t','y','l','e',0}; static const WCHAR attrListStyleType[] = {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0}; +static const WCHAR attrListStylePosition[] = + {'l','i','s','t','-','s','t','y','l','e','-','p','o','s','i','t','i','o','n',0}; static const WCHAR attrMargin[] = {'m','a','r','g','i','n',0}; static const WCHAR attrMarginBottom[] = @@ -166,6 +172,8 @@ {'p','o','s','i','t','i','o','n',0}; static const WCHAR attrRight[] = {'r','i','g','h','t',0}; +static const WCHAR attrTableLayout[] = + {'t','a','b','l','e','-','l','a','y','o','u','t',0}; static const WCHAR attrTextAlign[] = {'t','e','x','t','-','a','l','i','g','n',0}; static const WCHAR attrTextDecoration[] = @@ -201,6 +209,7 @@ static const style_tbl_entry_t style_tbl[] = { {attrBackground, DISPID_IHTMLSTYLE_BACKGROUND}, + {attrBackgroundAttachment, DISPID_IHTMLSTYLE_BACKGROUNDATTACHMENT}, {attrBackgroundColor, DISPID_IHTMLSTYLE_BACKGROUNDCOLOR}, {attrBackgroundImage, DISPID_IHTMLSTYLE_BACKGROUNDIMAGE}, {attrBackgroundPosition, DISPID_IHTMLSTYLE_BACKGROUNDPOSITION}, @@ -245,6 +254,8 @@ {attrLeft, DISPID_IHTMLSTYLE_LEFT}, {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING}, {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT}, + {attrListStyle, DISPID_IHTMLSTYLE_LISTSTYLE}, + {attrListStylePosition, DISPID_IHTMLSTYLE_LISTSTYLEPOSITION}, {attrListStyleType, DISPID_IHTMLSTYLE_LISTSTYLETYPE}, {attrMargin, DISPID_IHTMLSTYLE_MARGIN}, {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM}, @@ -265,6 +276,7 @@ {attrPageBreakBefore, DISPID_IHTMLSTYLE_PAGEBREAKBEFORE}, {attrPosition, DISPID_IHTMLSTYLE2_POSITION}, {attrRight, DISPID_IHTMLSTYLE2_RIGHT}, + {attrTableLayout, DISPID_IHTMLSTYLE2_TABLELAYOUT}, {attrTextAlign, DISPID_IHTMLSTYLE_TEXTALIGN}, {attrTextDecoration, DISPID_IHTMLSTYLE_TEXTDECORATION}, {attrTextIndent, DISPID_IHTMLSTYLE_TEXTINDENT}, @@ -1071,15 +1083,19 @@ static HRESULT WINAPI HTMLStyle_put_backgroundAttachment(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_style_attr(This, STYLEID_BACKGROUND_ATTACHMENT, v, 0); } static HRESULT WINAPI HTMLStyle_get_backgroundAttachment(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_style_attr(This, STYLEID_BACKGROUND_ATTACHMENT, p); } static HRESULT WINAPI HTMLStyle_put_backgroundPosition(IHTMLStyle *iface, BSTR v) @@ -1489,29 +1505,37 @@ static HRESULT WINAPI HTMLStyle_put_textIndent(IHTMLStyle *iface, VARIANT v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_nsstyle_attr_var(This->nsstyle, STYLEID_TEXT_INDENT, &v, ATTR_FIX_PX); } static HRESULT WINAPI HTMLStyle_get_textIndent(IHTMLStyle *iface, VARIANT *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr_var(This->nsstyle, STYLEID_TEXT_INDENT, p, 0); } static HRESULT WINAPI HTMLStyle_put_lineHeight(IHTMLStyle *iface, VARIANT v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_nsstyle_attr_var(This->nsstyle, STYLEID_LINE_HEIGHT, &v, 0); } static HRESULT WINAPI HTMLStyle_get_lineHeight(IHTMLStyle *iface, VARIANT *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_nsstyle_attr_var(This->nsstyle, STYLEID_LINE_HEIGHT, p, 0); } static HRESULT WINAPI HTMLStyle_put_marginTop(IHTMLStyle *iface, VARIANT v) @@ -2188,15 +2212,19 @@ static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_style_attr(This, STYLEID_LISTSTYLEPOSITION, v, 0); } static HRESULT WINAPI HTMLStyle_get_listStylePosition(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_style_attr(This, STYLEID_LISTSTYLEPOSITION, p); } static HRESULT WINAPI HTMLStyle_put_listStyleImage(IHTMLStyle *iface, BSTR v) @@ -2216,15 +2244,19 @@ static HRESULT WINAPI HTMLStyle_put_listStyle(IHTMLStyle *iface, BSTR v) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + return set_style_attr(This, STYLEID_LIST_STYLE, v, 0); } static HRESULT WINAPI HTMLStyle_get_listStyle(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_style_attr(This, STYLEID_LIST_STYLE, p); } static HRESULT WINAPI HTMLStyle_put_whiteSpace(IHTMLStyle *iface, BSTR v) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmlstyle.h wine1.7-1.7.25/dlls/mshtml/htmlstyle.h --- wine1.7-1.7.24/dlls/mshtml/htmlstyle.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmlstyle.h 2014-08-22 18:39:55.000000000 +0000 @@ -34,6 +34,7 @@ /* NOTE: Make sure to keep in sync with style_tbl in htmlstyle.c */ typedef enum { STYLEID_BACKGROUND, + STYLEID_BACKGROUND_ATTACHMENT, STYLEID_BACKGROUND_COLOR, STYLEID_BACKGROUND_IMAGE, STYLEID_BACKGROUND_POSITION, @@ -78,6 +79,8 @@ STYLEID_LEFT, STYLEID_LETTER_SPACING, STYLEID_LINE_HEIGHT, + STYLEID_LIST_STYLE, + STYLEID_LISTSTYLEPOSITION, STYLEID_LISTSTYLETYPE, STYLEID_MARGIN, STYLEID_MARGIN_BOTTOM, @@ -98,6 +101,7 @@ STYLEID_PAGE_BREAK_BEFORE, STYLEID_POSITION, STYLEID_RIGHT, + STYLEID_TABLE_LAYOUT, STYLEID_TEXT_ALIGN, STYLEID_TEXT_DECORATION, STYLEID_TEXT_INDENT, diff -Nru wine1.7-1.7.24/dlls/mshtml/htmltable.c wine1.7-1.7.25/dlls/mshtml/htmltable.c --- wine1.7-1.7.24/dlls/mshtml/htmltable.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmltable.c 2014-08-22 18:39:55.000000000 +0000 @@ -193,15 +193,34 @@ static HRESULT WINAPI HTMLTable_put_frame(IHTMLTable *iface, BSTR v) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&str, v); + nsres = nsIDOMHTMLTableElement_SetFrame(This->nstable, &str); + nsAString_Finish(&str); + + if (NS_FAILED(nsres)) { + ERR("SetFrame(%s) failed: %08x\n", debugstr_w(v), nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLTable_get_frame(IHTMLTable *iface, BSTR *p) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&str, NULL); + nsres = nsIDOMHTMLTableElement_GetFrame(This->nstable, &str); + + return return_nsstr(nsres, &str, p); } static HRESULT WINAPI HTMLTable_put_rules(IHTMLTable *iface, BSTR v) @@ -622,15 +641,41 @@ static HRESULT WINAPI HTMLTable_insertRow(IHTMLTable *iface, LONG index, IDispatch **row) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%d %p)\n", This, index, row); - return E_NOTIMPL; + nsIDOMHTMLElement *nselem; + HTMLElement *elem; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%d %p)\n", This, index, row); + nsres = nsIDOMHTMLTableElement_InsertRow(This->nstable, index, &nselem); + if(NS_FAILED(nsres)) { + ERR("Insert Row at %d failed: %08x\n", index, nsres); + return E_FAIL; + } + + hres = HTMLTableRow_Create(This->element.node.doc, nselem, &elem); + nsIDOMHTMLElement_Release(nselem); + if (FAILED(hres)) { + ERR("Create TableRow failed: %08x\n", hres); + return hres; + } + + *row = (IDispatch *)&elem->IHTMLElement_iface; + return S_OK; } static HRESULT WINAPI HTMLTable_deleteRow(IHTMLTable *iface, LONG index) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%d)\n", This, index); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%d)\n", This, index); + nsres = nsIDOMHTMLTableElement_DeleteRow(This->nstable, index); + if(NS_FAILED(nsres)) { + ERR("Delete Row failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLTable_get_readyState(IHTMLTable *iface, BSTR *p) diff -Nru wine1.7-1.7.24/dlls/mshtml/htmltablecell.c wine1.7-1.7.25/dlls/mshtml/htmltablecell.c --- wine1.7-1.7.24/dlls/mshtml/htmltablecell.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/htmltablecell.c 2014-08-22 18:39:55.000000000 +0000 @@ -128,15 +128,33 @@ static HRESULT WINAPI HTMLTableCell_put_align(IHTMLTableCell *iface, BSTR v) { HTMLTableCell *This = impl_from_IHTMLTableCell(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&str, v); + nsres = nsIDOMHTMLTableCellElement_SetAlign(This->nscell, &str); + nsAString_Finish(&str); + if (NS_FAILED(nsres)) { + ERR("Set Align failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLTableCell_get_align(IHTMLTableCell *iface, BSTR *p) { HTMLTableCell *This = impl_from_IHTMLTableCell(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&str, NULL); + nsres = nsIDOMHTMLTableCellElement_GetAlign(This->nscell, &str); + + return return_nsstr(nsres, &str, p); } static HRESULT WINAPI HTMLTableCell_put_vAlign(IHTMLTableCell *iface, BSTR v) diff -Nru wine1.7-1.7.24/dlls/mshtml/main.c wine1.7-1.7.25/dlls/mshtml/main.c --- wine1.7-1.7.24/dlls/mshtml/main.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/main.c 2014-08-22 18:39:55.000000000 +0000 @@ -533,6 +533,7 @@ X(IID_IHTMLDocument7); X(IID_IHTMLDOMAttribute); X(IID_IHTMLDOMChildrenCollection); + X(IID_IHTMLDOMImplementation); X(IID_IHTMLDOMNode); X(IID_IHTMLDOMNode2); X(IID_IHTMLElement); diff -Nru wine1.7-1.7.24/dlls/mshtml/mshtml_private.h wine1.7-1.7.25/dlls/mshtml/mshtml_private.h --- wine1.7-1.7.24/dlls/mshtml/mshtml_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/mshtml_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -136,6 +136,7 @@ XIID(IHTMLDocument5) \ XIID(IHTMLDOMAttribute) \ XIID(IHTMLDOMChildrenCollection) \ + XIID(IHTMLDOMImplementation) \ XIID(IHTMLDOMNode) \ XIID(IHTMLDOMNode2) \ XIID(IHTMLDOMTextNode) \ @@ -732,6 +733,8 @@ BOOL content_ready; event_target_t *body_event_target; + IHTMLDOMImplementation *dom_implementation; + ICatInformation *catmgr; nsDocumentEventListener *nsevent_listener; BOOL *event_vector; @@ -762,6 +765,7 @@ IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN; HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN; HRESULT create_history(HTMLInnerWindow*,OmHistory**) DECLSPEC_HIDDEN; +HRESULT create_dom_implementation(IHTMLDOMImplementation**) DECLSPEC_HIDDEN; HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.24/dlls/mshtml/oleobj.c wine1.7-1.7.25/dlls/mshtml/oleobj.c --- wine1.7-1.7.24/dlls/mshtml/oleobj.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/oleobj.c 2014-08-22 18:39:55.000000000 +0000 @@ -375,7 +375,7 @@ (void**)&uihandler2); if(SUCCEEDED(hres)) { hres = IDocHostUIHandler2_GetOverrideKeyPath(uihandler2, &override_key_path, 0); - if(hres == S_OK && override_key_path && override_key_path[0]) { + if(hres == S_OK && override_key_path) { if(override_key_path[0]) { /*FIXME: use override_key_path */ FIXME("override_key_path = %s\n", debugstr_w(override_key_path)); diff -Nru wine1.7-1.7.24/dlls/mshtml/omnavigator.c wine1.7-1.7.25/dlls/mshtml/omnavigator.c --- wine1.7-1.7.24/dlls/mshtml/omnavigator.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/omnavigator.c 2014-08-22 18:39:55.000000000 +0000 @@ -44,6 +44,148 @@ HTMLMimeTypesCollection *mime_types; } OmNavigator; +typedef struct { + DispatchEx dispex; + IHTMLDOMImplementation IHTMLDOMImplementation_iface; + + LONG ref; +} HTMLDOMImplementation; + +static inline HTMLDOMImplementation *impl_from_IHTMLDOMImplementation(IHTMLDOMImplementation *iface) +{ + return CONTAINING_RECORD(iface, HTMLDOMImplementation, IHTMLDOMImplementation_iface); +} + +static HRESULT WINAPI HTMLDOMImplementation_QueryInterface(IHTMLDOMImplementation *iface, REFIID riid, void **ppv) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv); + + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IHTMLDOMImplementation, riid)) { + *ppv = &This->IHTMLDOMImplementation_iface; + }else if(dispex_query_interface(&This->dispex, riid, ppv)) { + return *ppv ? S_OK : E_NOINTERFACE; + }else { + WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI HTMLDOMImplementation_AddRef(IHTMLDOMImplementation *iface) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI HTMLDOMImplementation_Release(IHTMLDOMImplementation *iface) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + release_dispex(&This->dispex); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI HTMLDOMImplementation_GetTypeInfoCount(IHTMLDOMImplementation *iface, UINT *pctinfo) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLDOMImplementation_GetTypeInfo(IHTMLDOMImplementation *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLDOMImplementation_GetIDsOfNames(IHTMLDOMImplementation *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, + cNames, lcid, rgDispId); +} + +static HRESULT WINAPI HTMLDOMImplementation_Invoke(IHTMLDOMImplementation *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLDOMImplementation_hasFeature(IHTMLDOMImplementation *iface, BSTR feature, + VARIANT version, VARIANT_BOOL *pfHasFeature) +{ + HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface); + + FIXME("(%p)->(%s %s %p) returning false\n", This, debugstr_w(feature), debugstr_variant(&version), pfHasFeature); + + *pfHasFeature = VARIANT_FALSE; + return S_OK; +} + +static const IHTMLDOMImplementationVtbl HTMLDOMImplementationVtbl = { + HTMLDOMImplementation_QueryInterface, + HTMLDOMImplementation_AddRef, + HTMLDOMImplementation_Release, + HTMLDOMImplementation_GetTypeInfoCount, + HTMLDOMImplementation_GetTypeInfo, + HTMLDOMImplementation_GetIDsOfNames, + HTMLDOMImplementation_Invoke, + HTMLDOMImplementation_hasFeature +}; + +static const tid_t HTMLDOMImplementation_iface_tids[] = { + IHTMLDOMImplementation_tid, + 0 +}; +static dispex_static_data_t HTMLDOMImplementation_dispex = { + NULL, + IHTMLDOMImplementation_tid, + NULL, + HTMLDOMImplementation_iface_tids +}; + +HRESULT create_dom_implementation(IHTMLDOMImplementation **ret) +{ + HTMLDOMImplementation *dom_implementation; + + dom_implementation = heap_alloc_zero(sizeof(*dom_implementation)); + if(!dom_implementation) + return E_OUTOFMEMORY; + + dom_implementation->IHTMLDOMImplementation_iface.lpVtbl = &HTMLDOMImplementationVtbl; + dom_implementation->ref = 1; + + init_dispex(&dom_implementation->dispex, (IUnknown*)&dom_implementation->IHTMLDOMImplementation_iface, + &HTMLDOMImplementation_dispex); + + *ret = &dom_implementation->IHTMLDOMImplementation_iface; + return S_OK; +} + static inline OmHistory *impl_from_IOmHistory(IOmHistory *iface) { return CONTAINING_RECORD(iface, OmHistory, IOmHistory_iface); diff -Nru wine1.7-1.7.24/dlls/mshtml/tests/dom.c wine1.7-1.7.25/dlls/mshtml/tests/dom.c --- wine1.7-1.7.24/dlls/mshtml/tests/dom.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/tests/dom.c 2014-08-22 18:39:55.000000000 +0000 @@ -2783,6 +2783,24 @@ _test_img_alt(line, unk, alt); } +#define test_img_align(u,a) _test_img_align(__LINE__,u,a) +static void _test_img_align(unsigned line, IUnknown *unk, const char *align) +{ + IHTMLImgElement *img = _get_img_iface(line, unk); + BSTR tmp; + HRESULT hres; + + tmp = a2bstr(align); + hres = IHTMLImgElement_put_align(img, tmp); + ok_(__FILE__,line) (hres == S_OK, "put_align failed: %08x\n", hres); + SysFreeString(tmp); + + hres = IHTMLImgElement_get_align(img, &tmp); + ok_(__FILE__,line) (hres == S_OK, "put_align failed: %08x\n", hres); + ok_(__FILE__,line) (!strcmp_wa(tmp, align), "Expect %s, got %s\n", align, wine_dbgstr_w(tmp)); + SysFreeString(tmp); +} + #define test_img_name(u, c) _test_img_name(__LINE__,u, c) static void _test_img_name(unsigned line, IUnknown *unk, const char *pValue) { @@ -2810,6 +2828,25 @@ IHTMLImgElement_Release(img); } +#define test_img_isMap(u, c) _test_img_isMap(__LINE__,u, c) +static void _test_img_isMap(unsigned line, IUnknown *unk, VARIANT_BOOL v) +{ + IHTMLImgElement *img = _get_img_iface(line, unk); + VARIANT_BOOL b = 100; + HRESULT hres; + + hres = IHTMLImgElement_put_isMap(img, v); + ok_(__FILE__,line) (hres == S_OK, "put_isMap failed: %08x\n", hres); + + hres = IHTMLImgElement_get_isMap(img, &b); + ok_(__FILE__,line) (hres == S_OK, "get_isMap failed: %08x\n", hres); + ok_(__FILE__,line) (b == v, "isMap = %x, expected %x\n", b, v); + + hres = IHTMLImgElement_get_isMap(img, NULL); + ok_(__FILE__,line) (hres == E_INVALIDARG, "ret = %08x, expected E_INVALIDARG\n", hres); + IHTMLImgElement_Release(img); +} + static void test_dynamic_properties(IHTMLElement *elem) { static const WCHAR attr1W[] = {'a','t','t','r','1',0}; @@ -3032,6 +3069,40 @@ ok_(__FILE__,line)(specified == expected, "specified = %x, expected %x\n", specified, expected); } +#define test_elem_id(e,i) _test_elem_id(__LINE__,e,i) +static void _test_elem_id(unsigned line, IUnknown *unk, const char *exid) +{ + IHTMLElement *elem = _get_elem_iface(line, unk); + BSTR id = (void*)0xdeadbeef; + HRESULT hres; + + hres = IHTMLElement_get_id(elem, &id); + IHTMLElement_Release(elem); + ok_(__FILE__,line) (hres == S_OK, "get_id failed: %08x\n", hres); + + if(exid) + ok_(__FILE__,line) (!strcmp_wa(id, exid), "unexpected id %s\n", wine_dbgstr_w(id)); + else + ok_(__FILE__,line) (!id, "id=%s\n", wine_dbgstr_w(id)); + + SysFreeString(id); +} + +#define test_elem_put_id(u,i) _test_elem_put_id(__LINE__,u,i) +static void _test_elem_put_id(unsigned line, IUnknown *unk, const char *new_id) +{ + IHTMLElement *elem = _get_elem_iface(line, unk); + BSTR tmp = a2bstr(new_id); + HRESULT hres; + + hres = IHTMLElement_put_id(elem, tmp); + IHTMLElement_Release(elem); + SysFreeString(tmp); + ok_(__FILE__,line) (hres == S_OK, "put_id failed: %08x\n", hres); + + _test_elem_id(line, unk, new_id); +} + static void test_contenteditable(IUnknown *unk) { IHTMLElement3 *elem3 = get_elem3_iface(unk); @@ -3209,6 +3280,45 @@ IHTMLInputElement_Release(input); } +#define test_input_get_form(o, t) _test_input_get_form(__LINE__, o, t) +static void _test_input_get_form(unsigned line, IUnknown *unk, const char *id) +{ + IHTMLInputElement *input; + IHTMLFormElement *form; + IHTMLElement *elem; + HRESULT hres; + + ok_(__FILE__,line) (unk != NULL, "unk is NULL!\n"); + hres = IUnknown_QueryInterface(unk, &IID_IHTMLInputElement, (void**)&input); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLInputElement: %08x\n", hres); + ok_(__FILE__,line) (input != NULL, "input == NULL\n"); + if(FAILED(hres) || input == NULL) + return; + + hres = IHTMLInputElement_get_form(input, &form); + ok_(__FILE__, line) (hres == S_OK, "get_form failed: %08x\n", hres); + ok_(__FILE__, line) (form != NULL, "form == NULL\n"); + if(FAILED(hres) || form == NULL){ + IHTMLInputElement_Release(input); + return; + } + + hres = IHTMLFormElement_QueryInterface(form, &IID_IHTMLElement, (void **)&elem); + ok_(__FILE__, line) (hres == S_OK, "QueryInterface(IID_IHTMLElement) failed: %08x\n", hres); + ok_(__FILE__, line) (elem != NULL, "elem == NULL\n"); + if(FAILED(hres) || elem == NULL){ + IHTMLInputElement_Release(input); + IHTMLFormElement_Release(form); + return; + } + + _test_elem_id(line, (IUnknown*)elem, id); + + IHTMLInputElement_Release(input); + IHTMLFormElement_Release(form); + IHTMLElement_Release(elem); +} + #define test_input_put_value(o,v) _test_input_put_value(__LINE__,o,v) static void _test_input_put_value(unsigned line, IUnknown *unk, const char *val) { @@ -3302,6 +3412,43 @@ _test_input_src(line, input, src); } +#define test_input_set_size(u,s,r) _test_input_set_size(__LINE__,u,s,r) +static void _test_input_set_size(unsigned line, IHTMLInputElement *input, LONG size, HRESULT exret) +{ + HRESULT hres; + + hres = IHTMLInputElement_put_size(input, size); + ok_(__FILE__,line) (hres == exret, "Expect ret = %08x, got: %08x\n", exret, hres); +} + +#define test_input_get_size(u,s) _test_input_get_size(__LINE__,u,s) +static void _test_input_get_size(unsigned line, IHTMLInputElement *input, LONG exsize) +{ + HRESULT hres; + LONG size; + + hres = IHTMLInputElement_get_size(input, &size); + ok_(__FILE__,line) (hres == S_OK, "get_size failed: %08x\n", hres); + ok_(__FILE__,line) (size == exsize, "Expect %d, got %d\n", exsize, size); + + hres = IHTMLInputElement_get_size(input, NULL); + ok_(__FILE__,line) (hres == E_INVALIDARG, "Expect ret E_INVALIDARG, got: %08x\n", hres); +} + +#define test_input_readOnly(u,b) _test_input_readOnly(__LINE__,u,b) +static void _test_input_readOnly(unsigned line, IHTMLInputElement *input, VARIANT_BOOL v) +{ + HRESULT hres; + VARIANT_BOOL b = 100; + + hres = IHTMLInputElement_put_readOnly(input, v); + ok_(__FILE__,line)(hres == S_OK, "put readOnly failed: %08x\n", hres); + + hres = IHTMLInputElement_get_readOnly(input, &b); + ok_(__FILE__,line)(hres == S_OK, "get readOnly failed: %08x\n", hres); + ok_(__FILE__,line)(v == b, "Expect %x, got %x\n", v, b); +} + #define test_elem_class(u,c) _test_elem_class(__LINE__,u,c) static void _test_elem_class(unsigned line, IUnknown *unk, const char *exclass) { @@ -3462,40 +3609,6 @@ _test_elem_class(line, unk, class); } -#define test_elem_id(e,i) _test_elem_id(__LINE__,e,i) -static void _test_elem_id(unsigned line, IUnknown *unk, const char *exid) -{ - IHTMLElement *elem = _get_elem_iface(line, unk); - BSTR id = (void*)0xdeadbeef; - HRESULT hres; - - hres = IHTMLElement_get_id(elem, &id); - IHTMLElement_Release(elem); - ok_(__FILE__,line) (hres == S_OK, "get_id failed: %08x\n", hres); - - if(exid) - ok_(__FILE__,line) (!strcmp_wa(id, exid), "unexpected id %s\n", wine_dbgstr_w(id)); - else - ok_(__FILE__,line) (!id, "id=%s\n", wine_dbgstr_w(id)); - - SysFreeString(id); -} - -#define test_elem_put_id(u,i) _test_elem_put_id(__LINE__,u,i) -static void _test_elem_put_id(unsigned line, IUnknown *unk, const char *new_id) -{ - IHTMLElement *elem = _get_elem_iface(line, unk); - BSTR tmp = a2bstr(new_id); - HRESULT hres; - - hres = IHTMLElement_put_id(elem, tmp); - IHTMLElement_Release(elem); - SysFreeString(tmp); - ok_(__FILE__,line) (hres == S_OK, "put_id failed: %08x\n", hres); - - _test_elem_id(line, unk, new_id); -} - #define test_elem_title(u,t) _test_elem_title(__LINE__,u,t) static void _test_elem_title(unsigned line, IUnknown *unk, const char *extitle) { @@ -3951,6 +4064,37 @@ _test_link_rel(line, elem, v); } +#define test_link_rev(a,b) _test_link_rev(__LINE__,a,b) +static void _test_link_rev(unsigned line, IHTMLElement *elem, const char *v) +{ + IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem); + BSTR rev; + HRESULT hres; + + hres = IHTMLLinkElement_get_rev(link, &rev); + ok_(__FILE__,line)(hres == S_OK, "get_rev failed: %08x\n", hres); + if(v) + ok_(__FILE__,line)(!strcmp_wa(rev, v), "rev = %s, expected %s\n", wine_dbgstr_w(rev), v); + else + ok_(__FILE__,line)(!rev, "rev = %s, expected NULL\n", wine_dbgstr_w(rev)); + + IHTMLLinkElement_Release(link); +} + +#define link_put_rev(a,b) _link_put_rev(__LINE__,a,b) +static void _link_put_rev(unsigned line, IHTMLElement *elem, const char *v) +{ + IHTMLLinkElement *link = _get_link_iface(line, (IUnknown*)elem); + BSTR str = a2bstr(v); + HRESULT hres; + + hres = IHTMLLinkElement_put_rev(link, str); + ok_(__FILE__,line)(hres == S_OK, "put_disabled failed: %08x\n", hres); + SysFreeString(str); + IHTMLLinkElement_Release(link); + _test_link_rev(line, elem, v); +} + #define test_link_type(a,b) _test_link_type(__LINE__,a,b) static void _test_link_type(unsigned line, IHTMLElement *elem, const char *v) { @@ -5080,6 +5224,25 @@ } } +#define test_table_length(t,l) _test_table_length(__LINE__,t,l) +static void _test_table_length(unsigned line, IHTMLTable *table, LONG expect) +{ + IHTMLElementCollection *col; + HRESULT hres; + LONG len; + + hres = IHTMLTable_get_rows(table, &col); + ok_(__FILE__,line)(hres == S_OK, "get_rows failed: %08x\n", hres); + ok_(__FILE__,line)(col != NULL, "col = NULL\n"); + if (hres != S_OK || col == NULL) + return; + hres = IHTMLElementCollection_get_length(col, &len); + ok_(__FILE__,line)(hres == S_OK, "get_length failed: %08x\n", hres); + ok_(__FILE__,line)(len == expect, "Expect %d, got %d\n", expect, len); + + IHTMLElementCollection_Release(col); +} + static void test_navigator(IHTMLDocument2 *doc) { IHTMLWindow2 *window; @@ -5565,6 +5728,33 @@ IHTMLWindow2_Release(window); } +static void test_dom_implementation(IHTMLDocument2 *doc) +{ + IHTMLDocument5 *doc5 = get_htmldoc5_iface((IUnknown*)doc); + IHTMLDOMImplementation *dom_implementation; + VARIANT_BOOL b; + VARIANT v; + BSTR str; + HRESULT hres; + + hres = IHTMLDocument5_get_implementation(doc5, &dom_implementation); + IHTMLDocument5_Release(doc5); + ok(hres == S_OK, "get_implementation failed: %08x\n", hres); + ok(dom_implementation != NULL, "dom_implementation == NULL\n"); + + str = a2bstr("test"); + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("1.0"); + b = 100; + hres = IHTMLDOMImplementation_hasFeature(dom_implementation, str, v, &b); + SysFreeString(str); + VariantClear(&v); + ok(hres == S_OK, "hasFeature failed: %08x\n", hres); + ok(!b, "hasFeature returned %x\n", b); + + IHTMLDOMImplementation_Release(dom_implementation); +} + static void test_defaults(IHTMLDocument2 *doc) { IHTMLStyleSheetsCollection *stylesheetcol; @@ -5699,6 +5889,7 @@ test_default_selection(doc); test_doc_title(doc, ""); + test_dom_implementation(doc); } #define test_button_name(a,b) _test_button_name(__LINE__,a,b) @@ -5801,7 +5992,7 @@ { HRESULT hres; IDispatch *disp; - IUnknown *unk; + IHTMLTableCell *cell; hres = IHTMLTableRow_deleteCell(row, 0); ok(hres == S_OK, "deleteCell failed: %08x\n", hres); @@ -5810,10 +6001,11 @@ hres = IHTMLTableRow_insertCell(row, 0, &disp); ok(hres == S_OK, "insertCell failed: %08x\n", hres); ok(disp != NULL, "disp == NULL\n"); - hres = IDispatch_QueryInterface(disp, &IID_IHTMLTableCell, (void **)&unk); + hres = IDispatch_QueryInterface(disp, &IID_IHTMLTableCell, (void **)&cell); ok(hres == S_OK, "Could not get IID_IHTMLTableCell interface: %08x\n", hres); + ok(cell != NULL, "cell == NULL\n"); if (SUCCEEDED(hres)) - IUnknown_Release(unk); + IHTMLTableCell_Release(cell); test_tr_possess(elem, row, 2, "td2"); IDispatch_Release(disp); } @@ -5920,6 +6112,7 @@ IHTMLTableCell *cell; HRESULT hres; LONG lval; + BSTR str; hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLTableCell, (void**)&cell); ok(hres == S_OK, "Could not get IHTMLTableRow iface: %08x\n", hres); @@ -5931,6 +6124,20 @@ ok(hres == S_OK, "get cellIndex failed: %08x\n", hres); ok(lval == 1, "Expected 1, got %d\n", lval); + str = a2bstr("left"); + hres = IHTMLTableCell_put_align(cell, str); + ok(hres == S_OK, "put_align failed: %08x\n", hres); + SysFreeString(str); + + str = NULL; + hres = IHTMLTableCell_get_align(cell, &str); + ok(hres == S_OK, "get_align failed: %08x\n", hres); + ok(str != NULL, "str is NULL\n"); + if (str != NULL && hres == S_OK) { + ok(!strcmp_wa(str, "left"), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + } + IHTMLTableCell_Release(cell); } @@ -5989,6 +6196,40 @@ VariantClear(&v); } +static void test_table_modify(IHTMLTable *table) +{ + IDispatch *disp; + IHTMLTableRow *row; + HRESULT hres; + LONG index; + + test_table_length(table, 2); + + hres = IHTMLTable_insertRow(table, 0, &disp); + ok(hres == S_OK, "insertRow failed: %08x\n", hres); + ok(disp != NULL, "disp == NULL\n"); + test_table_length(table, 3); + if (hres != S_OK || disp == NULL) + return; + + hres = IDispatch_QueryInterface(disp, &IID_IHTMLTableRow, (void**)&row); + IDispatch_Release(disp); + + ok(hres == S_OK, "QueryInterface failed: %08x\n", hres); + ok(row != NULL, "row == NULL\n"); + + index = 0xdeadbeef; + hres = IHTMLTableRow_get_rowIndex(row, &index); + ok(hres == S_OK, "get_rowIndex failed: %08x\n", hres); + ok(index == 0, "index = %d, expected 0\n", index); + + IHTMLTableRow_Release(row); + + hres = IHTMLTable_deleteRow(table, 0); + ok(hres == S_OK, "deleteRow failed: %08x\n", hres); + test_table_length(table, 2); +} + static void test_table_elem(IHTMLElement *elem) { IHTMLElementCollection *col; @@ -6151,6 +6392,17 @@ ok(!strcmp_wa(V_BSTR(&v), "11"), "Expected 11, got %s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v); + + bstr = a2bstr("box"); + hres = IHTMLTable_put_frame(table, bstr); + ok(hres == S_OK, "put_frame = %08x\n", hres); + SysFreeString(bstr); + hres = IHTMLTable_get_frame(table, &bstr); + ok(hres == S_OK, "get_frame = %08x\n", hres); + ok(!strcmp_wa(bstr, "box"), "Expected box, got %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + test_table_modify(table); bstr = a2bstr("summary"); hres = IHTMLTable3_put_summary(table3, bstr); ok(hres == S_OK, "put_summary = %08x\n", hres); @@ -6720,6 +6972,7 @@ test_elem_contains(elem, elem3, VARIANT_FALSE); test_elem_contains(elem, elem2, VARIANT_FALSE); test_elem_contains(elem, elem, VARIANT_TRUE); + test_elem_contains(elem, NULL, VARIANT_FALSE); IHTMLElement_Release(elem2); elem2 = test_elem_get_parent((IUnknown*)elem3); @@ -6865,12 +7118,24 @@ test_input_src(input, NULL); test_input_set_src(input, "about:blank"); + test_input_set_size(input, 15, S_OK); + test_input_get_size(input, 15); + test_input_set_size(input, -100, CTL_E_INVALIDPROPERTYVALUE); + test_input_get_size(input, 15); + test_input_set_size(input, 0, CTL_E_INVALIDPROPERTYVALUE); + test_input_get_size(input, 15); + + test_input_readOnly(input, VARIANT_TRUE); + test_input_readOnly(input, VARIANT_FALSE); + IHTMLInputElement_Release(input); IHTMLElement_Release(elem); } elem = get_elem_by_id(doc, "imgid", TRUE); if(elem) { + test_img_align((IUnknown*)elem, "left"); + test_img_name((IUnknown*)elem, "WineImg"); test_img_src((IUnknown*)elem, "", NULL); test_img_set_src((IUnknown*)elem, "about:blank"); test_img_src((IUnknown*)elem, "about:blank", NULL); @@ -6878,6 +7143,8 @@ test_img_set_alt((IUnknown*)elem, "alt test"); test_img_name((IUnknown*)elem, "WineImg"); test_img_complete(elem, VARIANT_FALSE); + test_img_isMap((IUnknown*)elem, VARIANT_TRUE); + test_img_isMap((IUnknown*)elem, VARIANT_FALSE); IHTMLElement_Release(elem); } @@ -7326,11 +7593,13 @@ if(elem) { test_link_disabled(elem, VARIANT_FALSE); test_link_rel(elem, "stylesheet"); + test_link_rev(elem, NULL); test_link_type(elem, "text/css"); test_link_href(elem, "about:blank"); test_link_media(elem, "all"); link_put_disabled(elem, VARIANT_TRUE); link_put_rel(elem, "prev"); + link_put_rev(elem, "next"); link_put_type(elem, "text/plain"); link_put_href(elem, "about:prev"); IHTMLElement_Release(elem); @@ -7376,7 +7645,7 @@ test_insert_adjacent_elems(doc, div); test_elem_set_innerhtml((IUnknown*)div, - "
"); + "
"); elem = get_elem_by_id(doc, "form", TRUE); if(elem) { test_form_length((IUnknown*)elem, 2); @@ -7398,6 +7667,10 @@ test_form_reset((IUnknown*)elem); test_form_target((IUnknown*)elem); IHTMLElement_Release(elem); + + elem = get_elem_by_id(doc, "inputid", TRUE); + test_input_get_form((IUnknown*)elem, "form"); + IHTMLElement_Release(elem); } test_attr(div); diff -Nru wine1.7-1.7.24/dlls/mshtml/tests/style.c wine1.7-1.7.25/dlls/mshtml/tests/style.c --- wine1.7-1.7.24/dlls/mshtml/tests/style.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/mshtml/tests/style.c 2014-08-22 18:39:55.000000000 +0000 @@ -59,6 +59,22 @@ return ret; } +static const WCHAR *strstr_wa(const WCHAR *str, const char *suba) +{ + BSTR sub; + const WCHAR *ret = NULL; + sub = a2bstr(suba); + while (*str) + { + const WCHAR *p1 = str, *p2 = sub; + while (*p1 && *p2 && *p1 == *p2) { p1++; p2++; } + if (!*p2) {ret = str; break;} + str++; + } + SysFreeString(sub); + return ret; +} + #define test_var_bstr(a,b) _test_var_bstr(__LINE__,a,b) static void _test_var_bstr(unsigned line, const VARIANT *v, const char *expect) { @@ -421,6 +437,18 @@ hres = IHTMLStyle2_get_overflowY(style2, &str); ok(hres == S_OK, "get_overflowY failed: %08x\n", hres); ok(!strcmp_wa(str, "hidden"), "overflowX = %s\n", wine_dbgstr_w(str)); + + /* tableLayout */ + str = a2bstr("fixed"); + hres = IHTMLStyle2_put_tableLayout(style2, str); + ok(hres == S_OK, "put_tableLayout failed: %08x\n", hres); + SysFreeString(str); + + str = (void*)0xdeadbeef; + hres = IHTMLStyle2_get_tableLayout(style2, &str); + ok(hres == S_OK, "get_tableLayout failed: %08x\n", hres); + ok(!strcmp_wa(str, "fixed"), "tableLayout = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); } static void test_style3(IHTMLStyle3 *style3) @@ -742,6 +770,28 @@ todo_wine ok(!strcmp_wa(V_BSTR(&v), "#00fdfd"), "V_BSTR(color) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + V_VT(&v) = VT_I4; + V_I4(&v) = 3; + hres = IHTMLStyle_put_lineHeight(style, v); + ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres); + + hres = IHTMLStyle_get_lineHeight(style, &v); + ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "3"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + + V_VT(&v) = VT_BSTR; + V_BSTR(&v) = a2bstr("300%"); + hres = IHTMLStyle_put_lineHeight(style, v); + ok(hres == S_OK, "put_lineHeight failed: %08x\n", hres); + VariantClear(&v); + + hres = IHTMLStyle_get_lineHeight(style, &v); + ok(hres == S_OK, "get_lineHeight failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(lineHeight) = %d, expect VT_BSTR\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "300%"), "V_BSTR(lineHeight) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + VariantClear(&v); + b = 0xfefe; hres = IHTMLStyle_get_textDecorationUnderline(style, &b); ok(hres == S_OK, "get_textDecorationUnderline failed: %08x\n", hres); @@ -1248,6 +1298,23 @@ ok(!strcmp_wa(str, "center"), "textAlign = %s\n", wine_dbgstr_w(V_BSTR(&v))); SysFreeString(str); + V_VT(&v) = VT_NULL; + hres = IHTMLStyle_get_textIndent(style, &v); + ok(hres == S_OK, "get_textIndent failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v)); + ok(!V_BSTR(&v), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + + V_VT(&v) = VT_I4; + V_I4(&v) = 6; + hres = IHTMLStyle_put_textIndent(style, v); + ok(hres == S_OK, "put_textIndent failed: %08x\n", hres); + + V_VT(&v) = VT_NULL; + hres = IHTMLStyle_get_textIndent(style, &v); + ok(hres == S_OK, "get_textIndent failed: %08x\n", hres); + ok(V_VT(&v) == VT_BSTR, "V_VT(textIndent) = %d\n", V_VT(&v)); + ok(!strcmp_wa(V_BSTR(&v), "6px"), "V_BSTR(textIndent) = %s\n", wine_dbgstr_w(V_BSTR(&v))); + str = (void*)0xdeadbeef; hres = IHTMLStyle_get_textTransform(style, &str); ok(hres == S_OK, "get_textTransform failed: %08x\n", hres); @@ -1494,6 +1561,16 @@ ok(!strcmp_wa(V_BSTR(&v), "red"), "str=%s\n", wine_dbgstr_w(V_BSTR(&v))); VariantClear(&v); + str = a2bstr("fixed"); + hres = IHTMLStyle_put_backgroundAttachment(style, str); + ok(hres == S_OK, "put_backgroundAttachment failed: %08x\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_get_backgroundAttachment(style, &str); + ok(hres == S_OK, "get_backgroundAttachment failed: %08x\n", hres); + ok(!strcmp_wa(str, "fixed"), "ret = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + /* padding */ hres = IHTMLStyle_get_padding(style, &str); ok(hres == S_OK, "get_padding failed: %08x\n", hres); @@ -2122,7 +2199,34 @@ hres = IHTMLStyle_get_listStyleType(style, &str); ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres); ok(!strcmp_wa(str, "square"), "listStyleType = %s\n", wine_dbgstr_w(str)); - SysFreeString(str); + + str = a2bstr("inside"); + hres = IHTMLStyle_put_listStylePosition(style, str); + ok(hres == S_OK, "put_listStylePosition failed: %08x\n", hres); + SysFreeString(str); + + hres = IHTMLStyle_get_listStylePosition(style, &str); + ok(hres == S_OK, "get_listStylePosition failed: %08x\n", hres); + ok(!strcmp_wa(str, "inside"), "listStyleType = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + str = a2bstr("decimal-leading-zero none inside"); + hres = IHTMLStyle_put_listStyle(style, str); + ok(hres == S_OK || broken(hres == E_INVALIDARG), /* win 2000 */ + "put_listStyle(%s) failed: %08x\n", wine_dbgstr_w(str), hres); + SysFreeString(str); + + if (hres != E_INVALIDARG) { + hres = IHTMLStyle_get_listStyle(style, &str); + ok(hres == S_OK, "get_listStyle failed: %08x\n", hres); + ok(strstr_wa(str, "decimal-leading-zero") == str && + strstr_wa(str, "none") != NULL && + strstr_wa(str, "inside") != NULL, + "listStyle = %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + } else { + win_skip("IHTMLStyle_put_listStyle already failed\n"); + } hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2); ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres); diff -Nru wine1.7-1.7.24/dlls/ntdll/file.c wine1.7-1.7.25/dlls/ntdll/file.c --- wine1.7-1.7.24/dlls/ntdll/file.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ntdll/file.c 2014-08-22 18:39:55.000000000 +0000 @@ -1981,7 +1981,7 @@ sizeof(FILE_END_OF_FILE_INFORMATION), /* FileEndOfFileInformation */ 0, /* FileAlternateNameInformation */ sizeof(FILE_STREAM_INFORMATION)-sizeof(WCHAR), /* FileStreamInformation */ - 0, /* FilePipeInformation */ + sizeof(FILE_PIPE_INFORMATION), /* FilePipeInformation */ sizeof(FILE_PIPE_LOCAL_INFORMATION), /* FilePipeLocalInformation */ 0, /* FilePipeRemoteInformation */ sizeof(FILE_MAILSLOT_QUERY_INFORMATION), /* FileMailslotQueryInformation */ @@ -2032,7 +2032,7 @@ if (len < info_sizes[class]) return io->u.Status = STATUS_INFO_LENGTH_MISMATCH; - if (class != FilePipeLocalInformation) + if (class != FilePipeInformation && class != FilePipeLocalInformation) { if ((io->u.Status = server_get_unix_fd( hFile, 0, &fd, &needs_close, NULL, NULL ))) return io->u.Status; @@ -2146,6 +2146,24 @@ } } break; + case FilePipeInformation: + { + FILE_PIPE_INFORMATION* pi = ptr; + + SERVER_START_REQ( get_named_pipe_info ) + { + req->handle = wine_server_obj_handle( hFile ); + if (!(io->u.Status = wine_server_call( req ))) + { + pi->ReadMode = (reply->flags & NAMED_PIPE_MESSAGE_STREAM_READ) ? + FILE_PIPE_MESSAGE_MODE : FILE_PIPE_BYTE_STREAM_MODE; + pi->CompletionMode = (reply->flags & NAMED_PIPE_NONBLOCKING_MODE) ? + FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION; + } + } + SERVER_END_REQ; + } + break; case FilePipeLocalInformation: { FILE_PIPE_LOCAL_INFORMATION* pli = ptr; @@ -2316,6 +2334,29 @@ } else io->u.Status = STATUS_INVALID_PARAMETER_3; break; + + case FilePipeInformation: + if (len >= sizeof(FILE_PIPE_INFORMATION)) + { + FILE_PIPE_INFORMATION *info = ptr; + + if ((info->CompletionMode | info->ReadMode) & ~1) + { + io->u.Status = STATUS_INVALID_PARAMETER; + break; + } + + SERVER_START_REQ( set_named_pipe_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->flags = (info->CompletionMode ? NAMED_PIPE_NONBLOCKING_MODE : 0) | + (info->ReadMode ? NAMED_PIPE_MESSAGE_STREAM_READ : 0); + io->u.Status = wine_server_call( req ); + } + SERVER_END_REQ; + } + else io->u.Status = STATUS_INVALID_PARAMETER_3; + break; case FileMailslotSetInformation: { diff -Nru wine1.7-1.7.24/dlls/ntdll/tests/pipe.c wine1.7-1.7.25/dlls/ntdll/tests/pipe.c --- wine1.7-1.7.24/dlls/ntdll/tests/pipe.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ntdll/tests/pipe.c 2014-08-22 18:39:55.000000000 +0000 @@ -34,6 +34,11 @@ #ifndef __WINE_WINTERNL_H typedef struct { + ULONG ReadMode; + ULONG CompletionMode; +} FILE_PIPE_INFORMATION; + +typedef struct { ULONG NamedPipeType; ULONG NamedPipeConfiguration; ULONG MaximumInstances; @@ -68,6 +73,7 @@ ULONG inbound_quota, ULONG outbound_quota, PLARGE_INTEGER timeout); static NTSTATUS (WINAPI *pNtQueryInformationFile) (IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass); +static NTSTATUS (WINAPI *pNtSetInformationFile) (HANDLE handle, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS class); static NTSTATUS (WINAPI *pNtCancelIoFile) (HANDLE hFile, PIO_STATUS_BLOCK io_status); static void (WINAPI *pRtlInitUnicodeString) (PUNICODE_STRING target, PCWSTR source); @@ -87,6 +93,7 @@ loadfunc(NtFsControlFile) loadfunc(NtCreateNamedPipeFile) loadfunc(NtQueryInformationFile) + loadfunc(NtSetInformationFile) loadfunc(NtCancelIoFile) loadfunc(RtlInitUnicodeString) @@ -479,6 +486,190 @@ CloseHandle(hPipe); } +static void _check_pipe_handle_state(int line, HANDLE handle, ULONG read, ULONG completion) +{ + IO_STATUS_BLOCK iosb; + FILE_PIPE_INFORMATION fpi; + NTSTATUS res; + if (handle != INVALID_HANDLE_VALUE) + { + memset(&fpi, 0x55, sizeof(fpi)); + res = pNtQueryInformationFile(handle, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok_(__FILE__, line)(!res, "NtQueryInformationFile returned %x\n", res); + ok_(__FILE__, line)(fpi.ReadMode == read, "Unexpected ReadMode, expected %x, got %x\n", + read, fpi.ReadMode); + ok_(__FILE__, line)(fpi.CompletionMode == completion, "Unexpected CompletionMode, expected %x, got %x\n", + completion, fpi.CompletionMode); + } +} +#define check_pipe_handle_state(handle, r, c) _check_pipe_handle_state(__LINE__, handle, r, c) + +static void test_filepipeinfo(void) +{ + IO_STATUS_BLOCK iosb; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING name; + LARGE_INTEGER timeout; + HANDLE hServer, hClient; + FILE_PIPE_INFORMATION fpi; + NTSTATUS res; + + pRtlInitUnicodeString(&name, testpipe_nt); + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = &name; + attr.Attributes = 0x40; /* case insensitive */ + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + + timeout.QuadPart = -100000000000ll; + + /* test with INVALID_HANDLE_VALUE */ + res = pNtQueryInformationFile(INVALID_HANDLE_VALUE, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_OBJECT_TYPE_MISMATCH, "NtQueryInformationFile returned %x\n", res); + + fpi.ReadMode = 0; + fpi.CompletionMode = 0; + res = pNtSetInformationFile(INVALID_HANDLE_VALUE, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_OBJECT_TYPE_MISMATCH, "NtSetInformationFile returned %x\n", res); + + /* server end with read-only attributes */ + res = pNtCreateNamedPipeFile(&hServer, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, + FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /* FILE_CREATE */, + 0, 0, 0, 1, 0xFFFFFFFF, 500, 500, &timeout); + ok(!res, "NtCreateNamedPipeFile returned %x\n", res); + + check_pipe_handle_state(hServer, 0, 1); + + hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); + ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError()); + + check_pipe_handle_state(hServer, 0, 1); + check_pipe_handle_state(hClient, 0, 0); + + fpi.ReadMode = 0; + fpi.CompletionMode = 0; + res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res); + + check_pipe_handle_state(hServer, 0, 1); + check_pipe_handle_state(hClient, 0, 0); + + fpi.ReadMode = 1; /* invalid on a byte stream pipe */ + fpi.CompletionMode = 1; + res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res); + + check_pipe_handle_state(hServer, 0, 1); + check_pipe_handle_state(hClient, 0, 0); + + if (hClient != INVALID_HANDLE_VALUE) + { + fpi.ReadMode = 1; /* invalid on a byte stream pipe */ + fpi.CompletionMode = 1; + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_INVALID_PARAMETER, "NtSetInformationFile returned %x\n", res); + } + + check_pipe_handle_state(hServer, 0, 1); + check_pipe_handle_state(hClient, 0, 0); + + if (hClient != INVALID_HANDLE_VALUE) + { + fpi.ReadMode = 0; + fpi.CompletionMode = 1; + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(!res, "NtSetInformationFile returned %x\n", res); + } + + check_pipe_handle_state(hServer, 0, 1); + check_pipe_handle_state(hClient, 0, 1); + + if (hClient != INVALID_HANDLE_VALUE) + { + fpi.ReadMode = 0; + fpi.CompletionMode = 2; /* not in range 0-1 */ + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res); + + fpi.ReadMode = 2; /* not in range 0-1 */ + fpi.CompletionMode = 0; + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res); + } + + CloseHandle(hClient); + + check_pipe_handle_state(hServer, 0, 1); + + fpi.ReadMode = 0; + fpi.CompletionMode = 0; + res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_ACCESS_DENIED, "NtSetInformationFile returned %x\n", res); + + CloseHandle(hServer); + + /* message mode server with read/write attributes */ + res = pNtCreateNamedPipeFile(&hServer, FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE, &attr, &iosb, + FILE_SHARE_READ | FILE_SHARE_WRITE, 2 /* FILE_CREATE */, + 0, 1, 1, 0, 0xFFFFFFFF, 500, 500, &timeout); + ok(!res, "NtCreateNamedPipeFile returned %x\n", res); + + check_pipe_handle_state(hServer, 1, 0); + + hClient = CreateFileW(testpipe, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); + ok(hClient != INVALID_HANDLE_VALUE, "can't open pipe, GetLastError: %x\n", GetLastError()); + + check_pipe_handle_state(hServer, 1, 0); + check_pipe_handle_state(hClient, 0, 0); + + if (hClient != INVALID_HANDLE_VALUE) + { + fpi.ReadMode = 1; + fpi.CompletionMode = 1; + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(!res, "NtSetInformationFile returned %x\n", res); + } + + check_pipe_handle_state(hServer, 1, 0); + check_pipe_handle_state(hClient, 1, 1); + + fpi.ReadMode = 0; + fpi.CompletionMode = 1; + res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(!res, "NtSetInformationFile returned %x\n", res); + + check_pipe_handle_state(hServer, 0, 1); + check_pipe_handle_state(hClient, 1, 1); + + if (hClient != INVALID_HANDLE_VALUE) + { + fpi.ReadMode = 0; + fpi.CompletionMode = 2; /* not in range 0-1 */ + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res); + + fpi.ReadMode = 2; /* not in range 0-1 */ + fpi.CompletionMode = 0; + res = pNtSetInformationFile(hClient, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(res == STATUS_INVALID_PARAMETER || broken(!res) /* < Vista */, "NtSetInformationFile returned %x\n", res); + } + + CloseHandle(hClient); + + check_pipe_handle_state(hServer, 0, 1); + + fpi.ReadMode = 1; + fpi.CompletionMode = 0; + res = pNtSetInformationFile(hServer, &iosb, &fpi, sizeof(fpi), (FILE_INFORMATION_CLASS)23); + ok(!res, "NtSetInformationFile returned %x\n", res); + + check_pipe_handle_state(hServer, 1, 0); + + CloseHandle(hServer); +} + START_TEST(pipe) { if (!init_func_ptrs()) @@ -493,6 +684,9 @@ trace("starting overlapped tests\n"); test_overlapped(); + trace("starting FILE_PIPE_INFORMATION tests\n"); + test_filepipeinfo(); + if (!pOpenThread || !pQueueUserAPC) return; diff -Nru wine1.7-1.7.24/dlls/odbccp32/tests/misc.c wine1.7-1.7.25/dlls/odbccp32/tests/misc.c --- wine1.7-1.7.24/dlls/odbccp32/tests/misc.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/odbccp32/tests/misc.c 2014-08-22 18:39:55.000000000 +0000 @@ -36,11 +36,11 @@ bool_ret = SQLGetConfigMode(&config_mode); ok(bool_ret && config_mode == ODBC_BOTH_DSN, "Failed to get the initial SQLGetConfigMode or it was not both\n"); - bool_ret = SQLSetConfigMode(3); + /* try to set invalid mode */ + bool_ret = SQLSetConfigMode(ODBC_SYSTEM_DSN+1); sql_ret = SQLInstallerErrorW(1, &error_code, NULL, 0, NULL); ok(!bool_ret && sql_ret == SQL_SUCCESS_WITH_INFO && error_code == ODBC_ERROR_INVALID_PARAM_SEQUENCE, "SQLSetConfigMode with invalid argument did not fail correctly\n"); - ok (ODBC_SYSTEM_DSN == 2 && ODBC_USER_DSN == 1 && ODBC_BOTH_DSN == 0, "SQLSetConfigMode modes not as expected\n"); for (i = ODBC_SYSTEM_DSN; i >= ODBC_BOTH_DSN; --i) { ok(SQLSetConfigMode((UWORD)i), "SQLSetConfigMode Failed to set config mode\n"); diff -Nru wine1.7-1.7.24/dlls/oleaut32/tests/vartest.c wine1.7-1.7.25/dlls/oleaut32/tests/vartest.c --- wine1.7-1.7.24/dlls/oleaut32/tests/vartest.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/oleaut32/tests/vartest.c 2014-08-22 18:39:55.000000000 +0000 @@ -1934,6 +1934,12 @@ /* for DATE values 0.0 < x < 1.0, x and -x represent the same datetime */ /* but when converting to DATE, prefer the positive versions */ UD2T(30,12,1899,6,0,0,0,6,364,0,S_OK,0.25); + + UD2T(1,1,1980,18,1,16,0,2,1,VAR_TIMEVALUEONLY,S_OK,0.7508796296296296); + UD2T(1,1,1980,18,1,16,0,2,1,VAR_DATEVALUEONLY,S_OK,29221.0); + UD2T(25,12,1899,6,0,0,0,1,359,VAR_TIMEVALUEONLY,S_OK,0.25); + UD2T(25,12,1899,6,0,0,0,1,359,VAR_DATEVALUEONLY,S_OK,-5.0); + UD2T(1,-1,1980,18,1,16,0,0,0,VAR_TIMEVALUEONLY|VAR_DATEVALUEONLY,S_OK,0.7508796296296296); } static void test_st2dt(int line, WORD d, WORD m, WORD y, WORD h, WORD mn, @@ -2158,7 +2164,7 @@ V_VT(&vDst) = VT_EMPTY; hres = pVarAbs(&v,&vDst); - if (ExtraFlags[i] & (VT_ARRAY|VT_ARRAY) || + if (ExtraFlags[i] & VT_ARRAY || (!ExtraFlags[i] && (vt == VT_UNKNOWN || vt == VT_BSTR || vt == VT_DISPATCH || vt == VT_ERROR || vt == VT_RECORD))) { @@ -2332,7 +2338,6 @@ VARNOT(BSTR, (BSTR)szTrue, BOOL, VARIANT_FALSE); VARNOT(BSTR, (BSTR)szFalse, BOOL, VARIANT_TRUE); - V_VT(&v) = VT_DECIMAL; S(U(*pdec)).sign = DECIMAL_NEG; S(U(*pdec)).scale = 0; pdec->Hi32 = 0; @@ -2903,9 +2908,6 @@ } else if((l == VT_VARIANT) || (r == VT_VARIANT)) { hexpected = DISP_E_BADVARTYPE; - } else if(lFound && !rFound) - { - hexpected = DISP_E_BADVARTYPE; } else if(!lFound && !rFound) { hexpected = DISP_E_BADVARTYPE; diff -Nru wine1.7-1.7.24/dlls/oleaut32/variant.c wine1.7-1.7.25/dlls/oleaut32/variant.c --- wine1.7-1.7.24/dlls/oleaut32/variant.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/oleaut32/variant.c 2014-08-22 18:39:55.000000000 +0000 @@ -1350,7 +1350,7 @@ HRESULT WINAPI VarDateFromUdateEx(UDATE *pUdateIn, LCID lcid, ULONG dwFlags, DATE *pDateOut) { UDATE ud; - double dateVal, dateSign; + double dateVal = 0; TRACE("(%p->%d/%d/%d %d:%d:%d:%d %d %d,0x%08x,0x%08x,%p)\n", pUdateIn, pUdateIn->st.wMonth, pUdateIn->st.wDay, pUdateIn->st.wYear, @@ -1360,6 +1360,8 @@ if (lcid != MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)) FIXME("lcid possibly not handled, treating as en-us\n"); + if (dwFlags & ~(VAR_TIMEVALUEONLY|VAR_DATEVALUEONLY)) + FIXME("unsupported flags: %x\n", dwFlags); ud = *pUdateIn; @@ -1370,15 +1372,18 @@ return E_INVALIDARG; /* Date */ - dateVal = VARIANT_DateFromJulian(VARIANT_JulianFromDMY(ud.st.wYear, ud.st.wMonth, ud.st.wDay)); + if (!(dwFlags & VAR_TIMEVALUEONLY)) + dateVal = VARIANT_DateFromJulian(VARIANT_JulianFromDMY(ud.st.wYear, ud.st.wMonth, ud.st.wDay)); - /* Sign */ - dateSign = (dateVal < 0.0) ? -1.0 : 1.0; + if ((dwFlags & VAR_TIMEVALUEONLY) || !(dwFlags & VAR_DATEVALUEONLY)) + { + double dateSign = (dateVal < 0.0) ? -1.0 : 1.0; - /* Time */ - dateVal += ud.st.wHour / 24.0 * dateSign; - dateVal += ud.st.wMinute / 1440.0 * dateSign; - dateVal += ud.st.wSecond / 86400.0 * dateSign; + /* Time */ + dateVal += ud.st.wHour / 24.0 * dateSign; + dateVal += ud.st.wMinute / 1440.0 * dateSign; + dateVal += ud.st.wSecond / 86400.0 * dateSign; + } TRACE("Returning %g\n", dateVal); *pDateOut = dateVal; @@ -3016,7 +3021,6 @@ else if (leftvt == VT_I4 || rightvt == VT_I4 || leftvt == VT_UINT || rightvt == VT_UINT || leftvt == VT_INT || rightvt == VT_INT || - leftvt == VT_UINT || rightvt == VT_UINT || leftvt == VT_R4 || rightvt == VT_R4 || leftvt == VT_R8 || rightvt == VT_R8 || leftvt == VT_CY || rightvt == VT_CY || diff -Nru wine1.7-1.7.24/dlls/riched20/string.c wine1.7-1.7.25/dlls/riched20/string.c --- wine1.7-1.7.24/dlls/riched20/string.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/riched20/string.c 2014-08-22 18:39:55.000000000 +0000 @@ -125,8 +125,7 @@ /* FIXME: Native also knows about punctuation */ TRACE("s==%s, start==%d, len==%d, code==%d\n", debugstr_wn(s, len), start, len, code); - /* convert number of bytes to number of characters. */ - len /= sizeof(WCHAR); + switch (code) { case WB_ISDELIMITER: @@ -154,7 +153,7 @@ ME_CallWordBreakProc(ME_TextEditor *editor, WCHAR *str, INT len, INT start, INT code) { if (!editor->pfnWordBreak) { - return ME_WordBreakProc(str, start, len * sizeof(WCHAR), code); + return ME_WordBreakProc(str, start, len, code); } else if (!editor->bEmulateVersion10) { /* MSDN lied about the third parameter for EditWordBreakProc being the number * of characters, it is actually the number of bytes of the string. */ diff -Nru wine1.7-1.7.24/dlls/rpcrt4/ndr_marshall.c wine1.7-1.7.25/dlls/rpcrt4/ndr_marshall.c --- wine1.7-1.7.24/dlls/rpcrt4/ndr_marshall.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/rpcrt4/ndr_marshall.c 2014-08-22 18:39:55.000000000 +0000 @@ -1138,7 +1138,7 @@ * BufferStart and BufferEnd won't be reset when allocating memory for * sending the response. we don't have to check for the new buffer here as * it won't be used a type memory, only for buffer memory */ - if (Pointer >= pStubMsg->BufferStart && Pointer < pStubMsg->BufferEnd) + if (Pointer >= pStubMsg->BufferStart && Pointer <= pStubMsg->BufferEnd) goto notfree; if (attr & RPC_FC_P_ONSTACK) { diff -Nru wine1.7-1.7.24/dlls/rsaenh/tests/rsaenh.c wine1.7-1.7.25/dlls/rsaenh/tests/rsaenh.c --- wine1.7-1.7.24/dlls/rsaenh/tests/rsaenh.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/rsaenh/tests/rsaenh.c 2014-08-22 18:39:55.000000000 +0000 @@ -1536,10 +1536,10 @@ dwLen = sizeof(dwKeyLen); result = CryptGetKeyParam(hKey, KP_KEYLEN, (BYTE *)&dwKeyLen, &dwLen, 0); - ok(result, "%08x", GetLastError()); + ok(result, "%08x\n", GetLastError()); ok(dwKeyLen == 56, "%d (%08x)\n", dwKeyLen, GetLastError()); result = CryptGetKeyParam(hKey, KP_EFFECTIVE_KEYLEN, (BYTE *)&dwKeyLen, &dwLen, 0); - ok(result, "%08x", GetLastError()); + ok(result, "%08x\n", GetLastError()); ok(dwKeyLen == 56 || broken(dwKeyLen == 40), "%d (%08x)\n", dwKeyLen, GetLastError()); dwKeyLen = 128; @@ -1550,7 +1550,7 @@ dwKeyLen = 12345; ok(result, "expected success, got error 0x%08X\n", GetLastError()); result = CryptGetKeyParam(hKey, KP_EFFECTIVE_KEYLEN, (BYTE *)&dwKeyLen, &dwLen, 0); - ok(result, "%08x", GetLastError()); + ok(result, "%08x\n", GetLastError()); ok(dwKeyLen == 128, "Expected 128, got %d\n", dwKeyLen); } else @@ -1558,16 +1558,16 @@ ok(!result, "expected error\n"); ok(GetLastError() == NTE_BAD_DATA, "Expected 0x80009005, got 0x%08X\n", GetLastError()); result = CryptGetKeyParam(hKey, KP_EFFECTIVE_KEYLEN, (BYTE *)&dwKeyLen, &dwLen, 0); - ok(result, "%08x", GetLastError()); + ok(result, "%08x\n", GetLastError()); ok(dwKeyLen == 40, "Expected 40, got %d\n", dwKeyLen); } dwLen = sizeof(dwKeyLen); result = CryptGetKeyParam(hKey, KP_KEYLEN, (BYTE *)&dwKeyLen, &dwLen, 0); - ok(result, "%08x", GetLastError()); + ok(result, "%08x\n", GetLastError()); ok(dwKeyLen == 56, "%d (%08x)\n", dwKeyLen, GetLastError()); result = CryptGetKeyParam(hKey, KP_EFFECTIVE_KEYLEN, (BYTE *)&dwKeyLen, &dwLen, 0); - ok(result, "%08x", GetLastError()); + ok(result, "%08x\n", GetLastError()); ok((!BASE_PROV && dwKeyLen == 128) || (BASE_PROV && dwKeyLen == 40), "%d (%08x)\n", dwKeyLen, GetLastError()); diff -Nru wine1.7-1.7.24/dlls/secur32/tests/ntlm.c wine1.7-1.7.25/dlls/secur32/tests/ntlm.c --- wine1.7-1.7.24/dlls/secur32/tests/ntlm.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/secur32/tests/ntlm.c 2014-08-22 18:39:55.000000000 +0000 @@ -1366,9 +1366,8 @@ InitFunctionPtrs(); if(pFreeCredentialsHandle && pDeleteSecurityContext && - pDeleteSecurityContext && pAcquireCredentialsHandleA && - pInitializeSecurityContextA && pCompleteAuthToken && - pQuerySecurityPackageInfoA) + pAcquireCredentialsHandleA && pInitializeSecurityContextA && + pCompleteAuthToken && pQuerySecurityPackageInfoA) { if(!testAcquireCredentialsHandle()) goto cleanup; diff -Nru wine1.7-1.7.24/dlls/shell32/shellitem.c wine1.7-1.7.25/dlls/shell32/shellitem.c --- wine1.7-1.7.24/dlls/shell32/shellitem.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/shell32/shellitem.c 2014-08-22 18:39:55.000000000 +0000 @@ -1054,7 +1054,7 @@ TRACE("%p (%x, %x, %p)\n", This, AttribFlags, sfgaoMask, psfgaoAttribs); if(AttribFlags & ~(SIATTRIBFLAGS_AND|SIATTRIBFLAGS_OR)) - FIXME("%08x contains unsupported attribution flags", AttribFlags); + FIXME("%08x contains unsupported attribution flags\n", AttribFlags); for(i = 0; i < This->item_count; i++) { diff -Nru wine1.7-1.7.24/dlls/shell32/tests/shlfolder.c wine1.7-1.7.25/dlls/shell32/tests/shlfolder.c --- wine1.7-1.7.24/dlls/shell32/tests/shlfolder.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/shell32/tests/shlfolder.c 2014-08-22 18:39:55.000000000 +0000 @@ -3739,7 +3739,7 @@ if(!pSHCreateShellItemArray) { - win_skip("No SHCreateShellItemArray, skipping test.."); + win_skip("No SHCreateShellItemArray, skipping test...\n"); return; } @@ -4157,7 +4157,7 @@ if(!pSHCreateShellItemArrayFromShellItem) { - win_skip("No SHCreateShellItemArrayFromShellItem, skipping test.."); + win_skip("No SHCreateShellItemArrayFromShellItem, skipping test...\n"); return; } diff -Nru wine1.7-1.7.24/dlls/shlwapi/tests/ordinal.c wine1.7-1.7.25/dlls/shlwapi/tests/ordinal.c --- wine1.7-1.7.24/dlls/shlwapi/tests/ordinal.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/shlwapi/tests/ordinal.c 2014-08-22 18:39:55.000000000 +0000 @@ -1794,6 +1794,7 @@ INT ret; static const WCHAR spaceW[] = {' ',0}; #define UNICODE_LTR_MARK 0x200e +#define UNICODE_RTL_MARK 0x200f if(!pSHFormatDateTimeW) { @@ -1923,9 +1924,9 @@ p2 = buff2; while (*p2 != '\0') { - while (*p1 == UNICODE_LTR_MARK) + while (*p1 == UNICODE_LTR_MARK || *p1 == UNICODE_RTL_MARK) p1++; - while (*p2 == UNICODE_LTR_MARK) + while (*p2 == UNICODE_LTR_MARK || *p2 == UNICODE_RTL_MARK) p2++; p1++; p2++; @@ -1949,9 +1950,9 @@ p2 = buff2; while (*p2 != '\0') { - while (*p1 == UNICODE_LTR_MARK) + while (*p1 == UNICODE_LTR_MARK || *p1 == UNICODE_RTL_MARK) p1++; - while (*p2 == UNICODE_LTR_MARK) + while (*p2 == UNICODE_LTR_MARK || *p2 == UNICODE_RTL_MARK) p2++; p1++; p2++; diff -Nru wine1.7-1.7.24/dlls/urlmon/sec_mgr.c wine1.7-1.7.25/dlls/urlmon/sec_mgr.c --- wine1.7-1.7.24/dlls/urlmon/sec_mgr.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/urlmon/sec_mgr.c 2014-08-22 18:39:55.000000000 +0000 @@ -241,11 +241,9 @@ * * Doesn't match the pattern. */ - if(str_len > pattern_len) { - if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) { - matches = TRUE; - *matched = str+(str_len-pattern_len); - } + if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) { + matches = TRUE; + *matched = str+(str_len-pattern_len); } } else { /* The pattern doesn't have an implicit wildcard, or an explicit wildcard, diff -Nru wine1.7-1.7.24/dlls/vbscript/global.c wine1.7-1.7.25/dlls/vbscript/global.c --- wine1.7-1.7.24/dlls/vbscript/global.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/vbscript/global.c 2014-08-22 18:39:55.000000000 +0000 @@ -661,46 +661,94 @@ return S_OK; } -static HRESULT Global_Ant(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) +static HRESULT Global_Atn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + return return_double(res, atan(d)); } static HRESULT Global_Cos(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + return return_double(res, cos(d)); } static HRESULT Global_Sin(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + return return_double(res, sin(d)); } static HRESULT Global_Tan(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + return return_double(res, tan(d)); } static HRESULT Global_Exp(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + return return_double(res, exp(d)); } static HRESULT Global_Log(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + if(d <= 0) + return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + else + return return_double(res, log(d)); } static HRESULT Global_Sqr(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + double d; + + hres = to_double(arg, &d); + if(FAILED(hres)) + return hres; + + if(d < 0) + return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + else + return return_double(res, sqrt(d)); } static HRESULT Global_Randomize(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) @@ -1277,14 +1325,44 @@ static HRESULT Global_Fix(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + VARIANT dst; + + TRACE("(%s)\n", debugstr_variant(arg)); + + assert(args_cnt == 1); + + hres = VarFix(arg, &dst); + if(FAILED(hres)) + return hres; + + if (res) + *res = dst; + else + VariantClear(&dst); + + return S_OK; } static HRESULT Global_Int(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) { - FIXME("\n"); - return E_NOTIMPL; + HRESULT hres; + VARIANT dst; + + TRACE("(%s)\n", debugstr_variant(arg)); + + assert(args_cnt == 1); + + hres = VarInt(arg, &dst); + if(FAILED(hres)) + return hres; + + if (res) + *res = dst; + else + VariantClear(&dst); + + return S_OK; } static HRESULT Global_Sgn(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res) @@ -1970,7 +2048,7 @@ {DISPID_GLOBAL_ISNUMERIC, Global_IsNumeric, 0, 1}, {DISPID_GLOBAL_ISARRAY, Global_IsArray, 0, 1}, {DISPID_GLOBAL_ISOBJECT, Global_IsObject, 0, 1}, - {DISPID_GLOBAL_ATN, Global_Ant, 0, 1}, + {DISPID_GLOBAL_ATN, Global_Atn, 0, 1}, {DISPID_GLOBAL_COS, Global_Cos, 0, 1}, {DISPID_GLOBAL_SIN, Global_Sin, 0, 1}, {DISPID_GLOBAL_TAN, Global_Tan, 0, 1}, diff -Nru wine1.7-1.7.24/dlls/vbscript/tests/api.vbs wine1.7-1.7.25/dlls/vbscript/tests/api.vbs --- wine1.7-1.7.24/dlls/vbscript/tests/api.vbs 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/vbscript/tests/api.vbs 2014-08-22 18:39:55.000000000 +0000 @@ -993,4 +993,248 @@ Call ok(getVT(ScriptEngineMinorVersion) = "VT_I4", "getVT(ScriptEngineMinorVersion) = " & getVT(ScriptEngineMinorVersion)) +Call ok(Fix(Empty) = 0, "Fix(Empty) = " & Fix(Empty)) +Call ok(getVT(Fix(Empty)) = "VT_I2", "getVT(Fix(Empty)) = " & getVT(Fix(Empty))) +Call ok(Fix(CCur(-0.99)) = 0, "Fix(CCur(-0.99)) = " & Fix(CCur(-0.99))) +Call ok(getVT(Fix(CCur(-0.99))) = "VT_CY", "getVT(Fix(CCur(-0.99))) = " & getVT(Fix(CCur(-0.99)))) +Call ok(Fix(1.99) = 1, "Fix(1.99) = " & Fix(1.99)) +Call ok(getVT(Fix(1.99)) = "VT_R8", "getVT(Fix(1.99)) = " & getVT(Fix(1.99))) +Call ok(Fix(-1.99) = -1, "Fix(-1.99) = " & Fix(-1.99)) +Call ok(getVT(Fix(-1.99)) = "VT_R8", "getVT(Fix(-1.99)) = " & getVT(Fix(-1.99))) +If isEnglishLang Then + Call ok(Fix("1.99") = 1, "Fix(""1.99"") = " & Fix("1.99")) + Call ok(getVT(Fix("1.99")) = "VT_R8", "getVT(Fix(""1.99"")) = " & getVT(Fix("1.99"))) + Call ok(Fix("-1.99") = -1, "Fix(""-1.99"") = " & Fix("-1.99")) + Call ok(getVT(Fix("-1.99")) = "VT_R8", "getVT(Fix(""-1.99"")) = " & getVT(Fix("-1.99"))) +End If +Call ok(Fix(True) = -1, "Fix(True) = " & Fix(True)) +Call ok(getVT(Fix(True)) = "VT_I2", "getVT(Fix(True)) = " & getVT(Fix(True))) +Call ok(Fix(False) = 0, "Fix(False) = " & Fix(False)) +Call ok(getVT(Fix(False)) = "VT_I2", "getVT(Fix(False)) = " & getVT(Fix(False))) +MyObject.myval = 2.5 +Call ok(Fix(MyObject) = 2, "Fix(MyObject) = " & Fix(MyObject)) +Call ok(getVT(Fix(MyObject)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject))) +MyObject.myval = -2.5 +Call ok(Fix(MyObject) = -2, "Fix(MyObject) = " & Fix(MyObject)) +Call ok(getVT(Fix(MyObject)) = "VT_R8", "getVT(Fix(MyObject)) = " & getVT(Fix(MyObject))) + +Call ok(Int(Empty) = 0, "Int(Empty) = " & Int(Empty)) +Call ok(getVT(Int(Empty)) = "VT_I2", "getVT(Int(Empty)) = " & getVT(Int(Empty))) +Call ok(Int(CCur(-0.99)) = -1, "Int(CCur(-0.99)) = " & Int(CCur(-0.99))) +Call ok(getVT(Int(CCur(-0.99))) = "VT_CY", "getVT(Int(CCur(-0.99))) = " & getVT(Int(CCur(-0.99)))) +Call ok(Int(1.99) = 1, "Int(1.99) = " & Int(1.99)) +Call ok(getVT(Int(1.99)) = "VT_R8", "getVT(Int(1.99)) = " & getVT(Int(1.99))) +Call ok(Int(-1.99) = -2, "Int(-1.99) = " & Int(-1.99)) +Call ok(getVT(Int(-1.99)) = "VT_R8", "getVT(Int(-1.99)) = " & getVT(Int(-1.99))) +If isEnglishLang Then + Call ok(Int("1.99") = 1, "Int(""1.99"") = " & Int("1.99")) + Call ok(getVT(Int("1.99")) = "VT_R8", "getVT(Int(""1.99"")) = " & getVT(Int("1.99"))) + Call ok(Int("-1.99") = -2, "Int(""-1.99"") = " & Int("-1.99")) + Call ok(getVT(Int("-1.99")) = "VT_R8", "getVT(Int(""-1.99"")) = " & getVT(Int("-1.99"))) +End If +Call ok(Int(True) = -1, "Int(True) = " & Int(True)) +Call ok(getVT(Int(True)) = "VT_I2", "getVT(Int(True)) = " & getVT(Int(True))) +Call ok(Int(False) = 0, "Int(False) = " & Int(False)) +Call ok(getVT(Int(False)) = "VT_I2", "getVT(Int(False)) = " & getVT(Int(False))) +MyObject.myval = 2.5 +Call ok(Int(MyObject) = 2, "Int(MyObject) = " & Int(MyObject)) +Call ok(getVT(Int(MyObject)) = "VT_R8", "getVT(Int(MyObject)) = " & getVT(Int(MyObject))) +MyObject.myval = -2.5 +Call ok(Int(MyObject) = -3, "Int(MyObject) = " & Int(MyObject)) +Call ok(getVT(Int(MyObject)) = "VT_R8", "getVT(Int(MyObject)) = " & getVT(Int(MyObject))) + +Sub testSqrError(strings, error_num1, error_num2) + on error resume next + Dim x + + Call Err.clear() + x = Sqr(strings) + Call ok(Err.number = error_num1, "Err.number1 = " & Err.number) + + Call Err.clear() + Call Sqr(strings) + Call ok(Err.number = error_num2, "Err.number2 = " & Err.number) +End Sub + +Call testSqrError(-2, 5, 5) +Call testSqrError(True, 5, 5) + +Call ok(Sqr(Empty) = 0, "Sqr(Empty) = " & Sqr(Empty)) +Call ok(getVT(Sqr(Empty)) = "VT_R8", "getVT(Sqr(Empty)) = " & getVT(Sqr(Empty))) +Call ok(Sqr(0) = 0, "Sqr(0) = " & Sqr(0)) +Call ok(getVT(Sqr(0)) = "VT_R8", "getVT(Sqr(0)) = " & getVT(Sqr(0))) +Call ok(Sqr(1) = 1, "Sqr(1) = " & Sqr(1)) +Call ok(getVT(Sqr(1)) = "VT_R8", "getVT(Sqr(1)) = " & getVT(Sqr(1))) +Call ok(Sqr(CSng(121)) = 11, "Sqr(CSng(121)) = " & Sqr(CSng(121))) +Call ok(getVT(Sqr(CSng(121))) = "VT_R8", "getVT(Sqr(CSng(121))) = " & getVT(Sqr(CSng(121)))) +Call ok(Sqr(36100) = 190, "Sqr(36100) = " & Sqr(36100)) +Call ok(getVT(Sqr(36100)) = "VT_R8", "getVT(Sqr(36100)) = " & getVT(Sqr(36100))) +Call ok(Sqr(CCur(0.0625)) = 0.25, "Sqr(CCur(0.0625)) = " & Sqr(CCur(0.0625))) +Call ok(getVT(Sqr(CCur(0.0625))) = "VT_R8", "getVT(Sqr(CCur(0.0625))) = " & getVT(Sqr(CCur(0.0625)))) +Call ok(Sqr("100000000") = 10000, "Sqr(""100000000"") = " & Sqr("100000000")) +Call ok(getVT(Sqr("100000000")) = "VT_R8", "getVT(Sqr(""100000000"")) = " & getVT(Sqr("100000000"))) +Call ok(Sqr(False) = 0, "Sqr(False) = " & Sqr(False)) +Call ok(getVT(Sqr(False)) = "VT_R8", "getVT(Sqr(False)) = " & getVT(Sqr(False))) +Call ok(Sqr(CByte(225)) = 15, "Sqr(CByte(225)) = " & Sqr(CByte(225))) +Call ok(getVT(Sqr(CByte(225))) = "VT_R8", "getVT(Sqr(CByte(225))) = " & getVT(Sqr(CByte(225)))) + +Function Approch(func, res) + If Abs(func - res) < 0.001 Then + Approch = True + Else + Approch = False + End If +End Function + +Const PI = 3.1415926 + +Call ok(Approch(Cos(Empty), 1), "Cos(Empty) = " & Cos(Empty)) +Call ok(getVT(Cos(Empty)) = "VT_R8", "getVT(Cos(Empty)) = " & getVT(Cos(Empty))) +Call ok(Approch(Cos(PI / 6), Sqr(3) / 2), "Cos(PI / 6) = " & Cos(PI / 6)) +Call ok(getVT(Cos(PI / 6)) = "VT_R8", "getVT(Cos(PI / 6)) = " & getVT(Cos(PI / 6))) +Call ok(Approch(Cos(CCur(PI / 4)), Sqr(2) / 2), "Cos(CCur(PI / 4)) = " & Cos(CCur(PI / 4))) +Call ok(getVT(Cos(CCur(PI / 4))) = "VT_R8", "getVT(Cos(CCur(PI / 4))) = " & getVT(Cos(CCur(PI / 4)))) +Call ok(Approch(Cos(CSng(PI / 3)), 1 / 2), "Cos(CSng(PI / 3)) = " & Cos(CSng(PI / 3))) +Call ok(getVT(Cos(CSng(PI / 3))) = "VT_R8", "getVT(Cos(CSng(PI))) = " & getVT(Cos(CSng(PI)))) +Call ok(Approch(Cos(PI / 2), 0), "Cos(0) = " & Cos(PI / 2)) +Call ok(getVT(Cos(PI / 2)) = "VT_R8", "getVT(Cos(PI / 2)) = " & getVT(Cos(PI / 2))) +Call ok(Approch(Cos(PI), -1), "Cos(PI) = " & Cos(PI)) +Call ok(getVT(Cos(PI)) = "VT_R8", "getVT(Cos(PI)) = " & getVT(Cos(PI))) +Call ok(Approch(Cos(5 * PI / 4), -Sqr(2) / 2), "Cos(5 * PI / 4) = " & Cos(5 * PI / 4)) +Call ok(getVT(Cos(5 * PI / 4)) = "VT_R8", "getVT(Cos(5 * PI / 4)) = " & getVT(Cos(5 * PI / 4))) +Call ok(Approch(Cos(3 * PI / 2), 0), "Cos(3 * PI / 2) = " & Cos(3 * PI / 2)) +Call ok(getVT(Cos(3 * PI / 2)) = "VT_R8", "getVT(Cos(3 * PI / 2)) = " & getVT(Cos(3 * PI / 2))) +Call ok(Approch(Cos(2 * PI), 1), "Cos(2 * PI) = " & Cos(2 * PI)) +Call ok(getVT(Cos(2 * PI)) = "VT_R8", "getVT(Cos(2 * PI)) = " & getVT(Cos(2 * PI))) +Call ok(Approch(Cos("-32768"), 0.3729), "Cos(""-32768"") = " & Cos("-32768")) +Call ok(getVT(Cos("-32768")) = "VT_R8", "getVT(Cos(""-32768"")) = " & getVT(Cos("-32768"))) +Call ok(Approch(Cos(False), 1), "Cos(False) = " & Cos(False)) +Call ok(getVT(Cos(False)) = "VT_R8", "getVT(Cos(False)) = " & getVT(Cos(False))) +Call ok(Approch(Cos(True), 0.5403), "Cos(True) = " & Cos(True)) +Call ok(getVT(Cos(True)) = "VT_R8", "getVT(Cos(True)) = " & getVT(Cos(True))) +Call ok(Approch(Cos(CByte(255)), -0.8623), "Cos(CByte(255)) = " & Cos(CByte(255))) +Call ok(getVT(Cos(CByte(255))) = "VT_R8", "getVT(Cos(CByte(255))) = " & getVT(Cos(CByte(255)))) + +Call ok(Approch(Sin(Empty), 0), "Sin(Empty) = " & Sin(Empty)) +Call ok(getVT(Sin(Empty)) = "VT_R8", "getVT(Sin(Empty)) = " & getVT(Sin(Empty))) +Call ok(Approch(Sin(PI / 6), 1 / 2), "Sin(PI / 6) = " & Sin(PI / 6)) +Call ok(getVT(Sin(PI / 6)) = "VT_R8", "getVT(Sin(PI / 6)) = " & getVT(Sin(PI / 6))) +Call ok(Approch(Sin(CCur(PI / 4)), Sqr(2) / 2), "Sin(CCur(PI / 4)) = " & Sin(CCur(PI / 4))) +Call ok(getVT(Sin(CCur(PI / 4))) = "VT_R8", "getVT(Sin(CCur(PI / 4))) = " & getVT(Sin(CCur(PI / 4)))) +Call ok(Approch(Sin(CSng(PI / 3)), Sqr(3) / 2), "Sin(CSng(PI / 3)) = " & Sin(CSng(PI / 3))) +Call ok(getVT(Sin(CSng(PI / 3))) = "VT_R8", "getVT(Sin(CSng(PI))) = " & getVT(Sin(CSng(PI)))) +Call ok(Approch(Sin(PI / 2), 1), "Sin(0) = " & Sin(PI / 2)) +Call ok(getVT(Sin(PI / 2)) = "VT_R8", "getVT(Sin(PI / 2)) = " & getVT(Sin(PI / 2))) +Call ok(Approch(Sin(PI), 0), "Sin(PI) = " & Sin(PI)) +Call ok(getVT(Sin(PI)) = "VT_R8", "getVT(Sin(PI)) = " & getVT(Sin(PI))) +Call ok(Approch(Sin(5 * PI / 4), -Sqr(2) / 2), "Sin(5 * PI / 4) = " & Sin(5 * PI / 4)) +Call ok(getVT(Sin(5 * PI / 4)) = "VT_R8", "getVT(Sin(5 * PI / 4)) = " & getVT(Sin(5 * PI / 4))) +Call ok(Approch(Sin(3 * PI / 2), -1), "Sin(3 * PI / 2) = " & Sin(3 * PI / 2)) +Call ok(getVT(Sin(3 * PI / 2)) = "VT_R8", "getVT(Sin(3 * PI / 2)) = " & getVT(Sin(3 * PI / 2))) +Call ok(Approch(Sin(2 * PI), 0), "Sin(2 * PI) = " & Sin(2 * PI)) +Call ok(getVT(Sin(2 * PI)) = "VT_R8", "getVT(Sin(2 * PI)) = " & getVT(Sin(2 * PI))) +Call ok(Approch(Sin("-32768"), -0.9278), "Sin(""-32768"") = " & Sin("-32768")) +Call ok(getVT(Sin("-32768")) = "VT_R8", "getVT(Sin(""-32768"")) = " & getVT(Sin("-32768"))) +Call ok(Approch(Sin(False), 0), "Sin(False) = " & Sin(False)) +Call ok(getVT(Sin(False)) = "VT_R8", "getVT(Sin(False)) = " & getVT(Sin(False))) +Call ok(Approch(Sin(True), -0.84147), "Sin(True) = " & Sin(True)) +Call ok(getVT(Sin(True)) = "VT_R8", "getVT(Sin(True)) = " & getVT(Sin(True))) +Call ok(Approch(Sin(CByte(255)), -0.5063), "Sin(CByte(255)) = " & Sin(CByte(255))) +Call ok(getVT(Sin(CByte(255))) = "VT_R8", "getVT(Sin(CByte(255))) = " & getVT(Sin(CByte(255)))) + +Call ok(Approch(Tan(Empty), 0), "Tan(Empty) = " & Tan(Empty)) +Call ok(getVT(Tan(Empty)) = "VT_R8", "getVT(Tan(Empty)) = " & getVT(Tan(Empty))) +Call ok(Approch(Tan(PI / 6), Sqr(3) / 3), "Tan(PI / 6) = " & Tan(PI / 6)) +Call ok(getVT(Tan(PI / 6)) = "VT_R8", "getVT(Tan(PI / 6)) = " & getVT(Tan(PI / 6))) +Call ok(Approch(Tan(CCur(PI / 4)), 1), "Tan(CCur(PI / 4)) = " & Tan(CCur(PI / 4))) +Call ok(getVT(Tan(CCur(PI / 4))) = "VT_R8", "getVT(Tan(CCur(PI / 4))) = " & getVT(Tan(CCur(PI / 4)))) +Call ok(Approch(Tan(CSng(PI / 3)), Sqr(3)), "Tan(CSng(PI / 3)) = " & Tan(CSng(PI / 3))) +Call ok(getVT(Tan(CSng(PI / 3))) = "VT_R8", "getVT(Tan(CSng(PI))) = " & getVT(Tan(CSng(PI)))) +Call ok(Approch(Tan(PI), 0), "Tan(PI) = " & Tan(PI)) +Call ok(getVT(Tan(PI)) = "VT_R8", "getVT(Tan(PI)) = " & getVT(Tan(PI))) +Call ok(Approch(Tan(3 * PI / 4), -1), "Tan(3 * PI / 4) = " & Tan(3 * PI / 4)) +Call ok(getVT(Tan(3 * PI / 4)) = "VT_R8", "getVT(Tan(3 * PI / 4)) = " & getVT(Tan(3 * PI / 4))) +Call ok(Approch(Tan(5 * PI / 4), 1), "Tan(5 * PI / 4) = " & Tan(5 * PI / 4)) +Call ok(getVT(Tan(5 * PI / 4)) = "VT_R8", "getVT(Tan(5 * PI / 4)) = " & getVT(Tan(5 * PI / 4))) +Call ok(Approch(Tan(2 * PI), 0), "Tan(2 * PI) = " & Tan(2 * PI)) +Call ok(getVT(Tan(2 * PI)) = "VT_R8", "getVT(Tan(2 * PI)) = " & getVT(Tan(2 * PI))) +Call ok(Approch(Tan("-32768"), -2.4879), "Tan(""-32768"") = " & Tan("-32768")) +Call ok(getVT(Tan("-32768")) = "VT_R8", "getVT(Tan(""-32768"")) = " & getVT(Tan("-32768"))) +Call ok(Approch(Tan(False), 0), "Tan(False) = " & Tan(False)) +Call ok(getVT(Tan(False)) = "VT_R8", "getVT(Tan(False)) = " & getVT(Tan(False))) +Call ok(Approch(Tan(True), -1.5574), "Tan(True) = " & Tan(True)) +Call ok(getVT(Tan(True)) = "VT_R8", "getVT(Tan(True)) = " & getVT(Tan(True))) +Call ok(Approch(Tan(CByte(255)), 0.5872), "Tan(CByte(255)) = " & Tan(CByte(255))) +Call ok(getVT(Tan(CByte(255))) = "VT_R8", "getVT(Tan(CByte(255))) = " & getVT(Tan(CByte(255)))) + +Call ok(Approch(Atn(Empty), 0), "Atn(Empty) = " & Atn(Empty)) +Call ok(getVT(Atn(Empty)) = "VT_R8", "getVT(Atn(Empty)) = " & getVT(Atn(Empty))) +Call ok(Approch(Atn(Sqr(3) / 3), PI / 6), "Atn(Sqr(3) / 3) = " & Atn(Sqr(3) / 3)) +Call ok(getVT(Atn(Sqr(3) / 3)) = "VT_R8", "getVT(Atn(Sqr(3) / 3)) = " & getVT(Atn(Sqr(3) / 3))) +Call ok(Approch(Atn(CCur(1)), PI / 4), "Atn(CCur(1)) = " & Atn(CCur(1))) +Call ok(getVT(Atn(CCur(1))) = "VT_R8", "getVT(Atn(CCur(1))) = " & getVT(Atn(CCur(1)))) +Call ok(Approch(Atn(CSng(Sqr(3))), PI / 3), "Atn(CSng(Sqr(3))) = " & Atn(CSng(Sqr(3)))) +Call ok(getVT(Atn(CSng(Sqr(3)))) = "VT_R8", "getVT(Atn(CSng(PI))) = " & getVT(Atn(CSng(PI)))) +Call ok(Approch(Atn(0), 0), "Atn(0) = " & Atn(0)) +Call ok(getVT(Atn(0)) = "VT_R8", "getVT(Atn(0)) = " & getVT(Atn(0))) +Call ok(Approch(Atn(-1), -PI / 4), "Atn(-1) = " & Atn(-1)) +Call ok(getVT(Atn(-1)) = "VT_R8", "getVT(Atn(-1)) = " & getVT(Atn(-1))) +Call ok(Approch(Atn("-32768"), -1.5707), "Atn(""-32768"") = " & Atn("-32768")) +Call ok(getVT(Atn("-32768")) = "VT_R8", "getVT(Atn(""-32768"")) = " & getVT(Atn("-32768"))) +Call ok(Approch(Atn(False), 0), "Atn(False) = " & Atn(False)) +Call ok(getVT(Atn(False)) = "VT_R8", "getVT(Atn(False)) = " & getVT(Atn(False))) +Call ok(Approch(Atn(True), -0.7853), "Atn(True) = " & Atn(True)) +Call ok(getVT(Atn(True)) = "VT_R8", "getVT(Atn(True)) = " & getVT(Atn(True))) +Call ok(Approch(Atn(CByte(255)), 1.5668), "Atn(CByte(255)) = " & Atn(CByte(255))) +Call ok(getVT(Atn(CByte(255))) = "VT_R8", "getVT(Atn(CByte(255))) = " & getVT(Atn(CByte(255)))) + +Call ok(Approch(Exp(Empty), 1), "Exp(Empty) = " & Exp(Empty)) +Call ok(getVT(Exp(Empty)) = "VT_R8", "getVT(Exp(Empty)) = " & getVT(Exp(Empty))) +Call ok(Approch(Exp(1), 2.7182), "Exp(1) = " & Exp(1)) +Call ok(getVT(Exp(1)) = "VT_R8", "getVT(Exp(1)) = " & getVT(Exp(1))) +Call ok(Approch(Exp(CCur(-1)), 0.3678), "Exp(CCur(-1)) = " & Exp(CCur(-1))) +Call ok(getVT(Exp(CCur(-1))) = "VT_R8", "getVT(Exp(CCur(-1))) = " & getVT(Exp(CCur(-1)))) +Call ok(Approch(Exp(CSng(0.5)), 1.6487), "Exp(CSng(0.5)) = " & Exp(CSng(0.5))) +Call ok(getVT(Exp(CSng(0.5))) = "VT_R8", "getVT(Exp(CSng(PI))) = " & getVT(Exp(CSng(PI)))) +Call ok(Approch(Exp(-0.5), 0.6065), "Exp(-0.5) = " & Exp(-0.5)) +Call ok(getVT(Exp(-0.5)) = "VT_R8", "getVT(Exp(-0.5)) = " & getVT(Exp(-0.5))) +Call ok(Approch(Exp("-2"), 0.1353), "Exp(""-2"") = " & Exp("-2")) +Call ok(getVT(Exp("-2")) = "VT_R8", "getVT(Exp(""-2"")) = " & getVT(Exp("-2"))) +Call ok(Approch(Exp(False), 1), "Exp(False) = " & Exp(False)) +Call ok(getVT(Exp(False)) = "VT_R8", "getVT(Exp(False)) = " & getVT(Exp(False))) +Call ok(Approch(Exp(True), 0.3678), "Exp(True) = " & Exp(True)) +Call ok(getVT(Exp(True)) = "VT_R8", "getVT(Exp(True)) = " & getVT(Exp(True))) +Call ok(Approch(Exp(CByte(2)), 7.389), "Exp(CByte(2)) = " & Exp(CByte(2))) +Call ok(getVT(Exp(CByte(2))) = "VT_R8", "getVT(Exp(CByte(2))) = " & getVT(Exp(CByte(2)))) + +Sub testLogError(strings, error_num1, error_num2) + on error resume next + Dim x + + Call Err.clear() + x = Log(strings) + Call ok(Err.number = error_num1, "Err.number1 = " & Err.number) + + Call Err.clear() + Call Log(strings) + Call ok(Err.number = error_num2, "Err.number2 = " & Err.number) +End Sub + +Call testLogError(0, 5, 5) +Call testLogError(-2, 5, 5) +Call testLogError(False, 5, 5) +Call testLogError(True, 5, 5) +Call ok(Approch(Log(1), 0), "Log(1) = " & Log(1)) +Call ok(getVT(Log(1)) = "VT_R8", "getVT(Log(1)) = " & getVT(Log(1))) +Call ok(Approch(Log(CCur(0.5)), -0.6931), "Log(CCur(0.5)) = " & Log(CCur(0.5))) +Call ok(getVT(Log(CCur(0.5))) = "VT_R8", "getVT(Log(CCur(0.5))) = " & getVT(Log(CCur(0.5)))) +Call ok(Approch(Log(CSng(2.7182)), 1), "Log(CSng(2.7182)) = " & Log(CSng(2.7182))) +Call ok(getVT(Log(CSng(2.7182))) = "VT_R8", "getVT(Log(CSng(PI))) = " & getVT(Log(CSng(PI)))) +Call ok(Approch(Log(32768), 10.3972), "Log(32768) = " & Log(32768)) +Call ok(getVT(Log(32768)) = "VT_R8", "getVT(Log(32768)) = " & getVT(Log(32768))) +Call ok(Approch(Log("10"), 2.3025), "Log(""10"") = " & Log("10")) +Call ok(getVT(Log("10")) = "VT_R8", "getVT(Log(""10"")) = " & getVT(Log("10"))) +Call ok(Approch(Log(CByte(2)), 0.6931), "Log(CByte(2)) = " & Log(CByte(2))) +Call ok(getVT(Log(CByte(2))) = "VT_R8", "getVT(Log(CByte(2))) = " & getVT(Log(CByte(2)))) + Call reportSuccess() diff -Nru wine1.7-1.7.24/dlls/wbemprox/builtin.c wine1.7-1.7.25/dlls/wbemprox/builtin.c --- wine1.7-1.7.24/dlls/wbemprox/builtin.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/builtin.c 2014-08-22 18:39:55.000000000 +0000 @@ -493,6 +493,11 @@ { method_enumvaluesW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { method_getstringvalueW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } }; +static const struct column col_systemsecurity[] = +{ + { method_getsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_setsdW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, +}; static const struct column col_videocontroller[] = { { prop_adapterdactypeW, CIM_STRING }, @@ -800,6 +805,11 @@ class_method *enumvalues; class_method *getstringvalue; }; +struct record_systemsecurity +{ + class_method *getsd; + class_method *setsd; +}; struct record_videocontroller { const WCHAR *adapter_dactype; @@ -846,7 +856,11 @@ { class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING }, { class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING }, { class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, - { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING } + { class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING }, + { class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_systemsecurityW, method_getsdW, -1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY }, + { class_systemsecurityW, method_setsdW, 1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY }, + { class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, }; #define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\ @@ -869,6 +883,10 @@ { { reg_enum_key, reg_enum_values, reg_get_stringvalue } }; +static const struct record_systemsecurity data_systemsecurity[] = +{ + { security_get_sd, security_set_sd } +}; /* check if row matches condition and update status */ static BOOL match_row( const struct table *table, UINT row, const struct expr *cond, enum fill_status *status ) @@ -2416,6 +2434,7 @@ { class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service }, { class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice }, { class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov }, + { class_systemsecurityW, SIZEOF(col_systemsecurity), col_systemsecurity, SIZEOF(data_systemsecurity), 0, (BYTE *)data_systemsecurity }, { class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller } }; diff -Nru wine1.7-1.7.24/dlls/wbemprox/Makefile.in wine1.7-1.7.25/dlls/wbemprox/Makefile.in --- wine1.7-1.7.24/dlls/wbemprox/Makefile.in 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/Makefile.in 2014-08-22 18:39:55.000000000 +0000 @@ -9,6 +9,7 @@ qualifier.c \ query.c \ reg.c \ + security.c \ service.c \ services.c \ table.c \ diff -Nru wine1.7-1.7.24/dlls/wbemprox/query.c wine1.7-1.7.25/dlls/wbemprox/query.c --- wine1.7-1.7.24/dlls/wbemprox/query.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/query.c 2014-08-22 18:39:55.000000000 +0000 @@ -664,6 +664,8 @@ case CIM_BOOLEAN: return VT_BOOL; case CIM_STRING: case CIM_DATETIME: return VT_BSTR; + case CIM_SINT8: return VT_I1; + case CIM_UINT8: return VT_UI1; case CIM_SINT16: return VT_I2; case CIM_UINT16: return VT_UI2; case CIM_SINT32: return VT_I4; @@ -724,6 +726,12 @@ case VT_BSTR: V_BSTR( ret ) = val_ptr; break; + case VT_I1: + V_I1( ret ) = val; + break; + case VT_UI1: + V_UI1( ret ) = val; + break; case VT_I2: V_I2( ret ) = val; break; @@ -788,6 +796,12 @@ else vartype = VT_NULL; break; + case CIM_SINT8: + if (!vartype) vartype = VT_I1; + break; + case CIM_UINT8: + if (!vartype) vartype = VT_UI1; + break; case CIM_SINT16: if (!vartype) vartype = VT_I2; break; @@ -826,6 +840,8 @@ { case VT_BOOL: return CIM_BOOLEAN; case VT_BSTR: return CIM_STRING; + case VT_I1: return CIM_SINT8; + case VT_UI1: return CIM_UINT8; case VT_I2: return CIM_SINT16; case VT_UI2: return CIM_UINT16; case VT_I4: return CIM_SINT32; diff -Nru wine1.7-1.7.24/dlls/wbemprox/security.c wine1.7-1.7.25/dlls/wbemprox/security.c --- wine1.7-1.7.24/dlls/wbemprox/security.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/security.c 2014-08-22 18:39:55.000000000 +0000 @@ -0,0 +1,217 @@ +/* + * __SystemSecurity implementation + * + * Copyright 2014 Vincent Povirk for CodeWeavers + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "wbemcli.h" +#include "iads.h" + +#include "wine/debug.h" +#include "wbemprox_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wbemprox); + +static HRESULT to_byte_array( void *data, DWORD size, VARIANT *var ) +{ + SAFEARRAY *sa; + void *sadata; + HRESULT hr; + + if (!(sa = SafeArrayCreateVector( VT_UI1, 0, size ))) return E_OUTOFMEMORY; + + hr = SafeArrayAccessData( sa, &sadata ); + + if (SUCCEEDED(hr)) + { + memcpy( sadata, data, size ); + + SafeArrayUnaccessData( sa ); + } + else + { + SafeArrayDestroy( sa ); + return hr; + } + + set_variant( VT_UI1|VT_ARRAY, 0, sa, var ); + return S_OK; +} + +static HRESULT get_sd( SECURITY_DESCRIPTOR **sd, DWORD *size ) +{ + BYTE sid_admin_buffer[SECURITY_MAX_SID_SIZE]; + SID *sid_admin = (SID*)sid_admin_buffer; + BYTE sid_network_buffer[SECURITY_MAX_SID_SIZE]; + SID *sid_network = (SID*)sid_network_buffer; + BYTE sid_local_buffer[SECURITY_MAX_SID_SIZE]; + SID *sid_local = (SID*)sid_local_buffer; + BYTE sid_users_buffer[SECURITY_MAX_SID_SIZE]; + SID *sid_users = (SID*)sid_users_buffer; + BYTE acl_buffer[sizeof(ACL) + 4 * (sizeof(ACCESS_ALLOWED_ACE) - sizeof(DWORD) + SECURITY_MAX_SID_SIZE)]; + ACL *acl = (ACL*)acl_buffer; + DWORD sid_size; + SECURITY_DESCRIPTOR absolute_sd; + HRESULT hr = S_OK; + + sid_size = sizeof(sid_admin_buffer); + CreateWellKnownSid( WinBuiltinAdministratorsSid, NULL, sid_admin, &sid_size ); + + sid_size = sizeof(sid_network_buffer); + CreateWellKnownSid( WinNetworkServiceSid, NULL, sid_network, &sid_size ); + + sid_size = sizeof(sid_local_buffer); + CreateWellKnownSid( WinLocalServiceSid, NULL, sid_local, &sid_size ); + + sid_size = sizeof(sid_users_buffer); + CreateWellKnownSid( WinAuthenticatedUserSid, NULL, sid_users, &sid_size ); + + InitializeAcl( acl, sizeof(acl_buffer), ACL_REVISION ); + + AddAccessAllowedAceEx( acl, ACL_REVISION, CONTAINER_INHERIT_ACE|INHERITED_ACE, + ADS_RIGHT_DS_CREATE_CHILD|ADS_RIGHT_DS_DELETE_CHILD|ADS_RIGHT_ACTRL_DS_LIST|ADS_RIGHT_DS_SELF| + ADS_RIGHT_DS_READ_PROP|ADS_RIGHT_DS_WRITE_PROP|READ_CONTROL|WRITE_DAC, + sid_admin ); + + AddAccessAllowedAceEx( acl, ACL_REVISION, CONTAINER_INHERIT_ACE|INHERITED_ACE, + ADS_RIGHT_DS_CREATE_CHILD|ADS_RIGHT_DS_DELETE_CHILD|ADS_RIGHT_DS_READ_PROP, + sid_network ); + + AddAccessAllowedAceEx( acl, ACL_REVISION, CONTAINER_INHERIT_ACE|INHERITED_ACE, + ADS_RIGHT_DS_CREATE_CHILD|ADS_RIGHT_DS_DELETE_CHILD|ADS_RIGHT_DS_READ_PROP, + sid_local ); + + AddAccessAllowedAceEx( acl, ACL_REVISION, CONTAINER_INHERIT_ACE|INHERITED_ACE, + ADS_RIGHT_DS_CREATE_CHILD|ADS_RIGHT_DS_DELETE_CHILD|ADS_RIGHT_DS_READ_PROP, + sid_users ); + + InitializeSecurityDescriptor( &absolute_sd, SECURITY_DESCRIPTOR_REVISION ); + + SetSecurityDescriptorOwner( &absolute_sd, sid_admin, TRUE ); + SetSecurityDescriptorGroup( &absolute_sd, sid_admin, TRUE ); + SetSecurityDescriptorDacl( &absolute_sd, TRUE, acl, TRUE ); + + *size = GetSecurityDescriptorLength( &absolute_sd ); + + *sd = HeapAlloc( GetProcessHeap(), 0, *size ); + if (!*sd) + hr = E_OUTOFMEMORY; + + if (SUCCEEDED(hr)) + { + if (!MakeSelfRelativeSD(&absolute_sd, *sd, size)) + hr = E_FAIL; + } + + return hr; +} + +HRESULT security_get_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT var_sd, retval; + IWbemClassObject *sig, *out_params = NULL; + HRESULT hr, ret; + SECURITY_DESCRIPTOR *sd; + DWORD sd_size; + + TRACE("%p, %p\n", in, out); + + hr = create_signature( class_systemsecurityW, method_getsdW, PARAM_OUT, &sig ); + + if (SUCCEEDED(hr)) + { + hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params ); + + IWbemClassObject_Release( sig ); + } + + if (SUCCEEDED(hr)) + { + ret = get_sd( &sd, &sd_size ); + + if (SUCCEEDED(ret)) + { + VariantInit( &var_sd ); + + hr = to_byte_array( sd, sd_size, &var_sd ); + + if (SUCCEEDED(hr)) + hr = IWbemClassObject_Put( out_params, param_sdW, 0, &var_sd, CIM_UINT8|CIM_FLAG_ARRAY ); + + HeapFree( GetProcessHeap(), 0, sd ); + VariantClear( &var_sd ); + } + + if (SUCCEEDED(hr)) + { + set_variant( VT_UI4, ret, NULL, &retval ); + hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 ); + } + + if (SUCCEEDED(hr) && out) + { + *out = out_params; + IWbemClassObject_AddRef( out_params ); + } + + IWbemClassObject_Release( out_params ); + } + + return hr; +} + + +HRESULT security_set_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT retval; + IWbemClassObject *sig, *out_params = NULL; + HRESULT hr; + + FIXME("stub\n"); + + hr = create_signature( class_systemsecurityW, method_setsdW, PARAM_OUT, &sig ); + + if (SUCCEEDED(hr)) + { + hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params ); + + IWbemClassObject_Release( sig ); + } + + if (SUCCEEDED(hr)) + { + set_variant( VT_UI4, S_OK, NULL, &retval ); + hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 ); + + if (SUCCEEDED(hr) && out) + { + *out = out_params; + IWbemClassObject_AddRef( out_params ); + } + + IWbemClassObject_Release( out_params ); + } + + return hr; +} diff -Nru wine1.7-1.7.24/dlls/wbemprox/table.c wine1.7-1.7.25/dlls/wbemprox/table.c --- wine1.7-1.7.24/dlls/wbemprox/table.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/table.c 2014-08-22 18:39:55.000000000 +0000 @@ -52,6 +52,9 @@ { case CIM_BOOLEAN: return sizeof(int); + case CIM_SINT8: + case CIM_UINT8: + return sizeof(INT8); case CIM_SINT16: case CIM_UINT16: return sizeof(INT16); @@ -111,6 +114,12 @@ case CIM_STRING: *val = (INT_PTR)*(const WCHAR **)ptr; break; + case CIM_SINT8: + *val = *(const INT8 *)ptr; + break; + case CIM_UINT8: + *val = *(const UINT8 *)ptr; + break; case CIM_SINT16: *val = *(const INT16 *)ptr; break; @@ -215,6 +224,12 @@ case CIM_STRING: *(WCHAR **)ptr = (WCHAR *)(INT_PTR)val; break; + case CIM_SINT8: + *(INT8 *)ptr = val; + break; + case CIM_UINT8: + *(UINT8 *)ptr = val; + break; case CIM_SINT16: *(INT16 *)ptr = val; break; diff -Nru wine1.7-1.7.24/dlls/wbemprox/tests/Makefile.in wine1.7-1.7.25/dlls/wbemprox/tests/Makefile.in --- wine1.7-1.7.24/dlls/wbemprox/tests/Makefile.in 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/tests/Makefile.in 2014-08-22 18:39:55.000000000 +0000 @@ -1,5 +1,5 @@ TESTDLL = wbemprox.dll -IMPORTS = uuid oleaut32 ole32 user32 +IMPORTS = uuid oleaut32 ole32 user32 advapi32 C_SRCS = \ query.c \ diff -Nru wine1.7-1.7.24/dlls/wbemprox/tests/query.c wine1.7-1.7.25/dlls/wbemprox/tests/query.c --- wine1.7-1.7.24/dlls/wbemprox/tests/query.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/tests/query.c 2014-08-22 18:39:55.000000000 +0000 @@ -21,6 +21,7 @@ #include #include "windows.h" #include "ocidl.h" +#include "sddl.h" #include "initguid.h" #include "objidl.h" #include "wbemcli.h" @@ -650,6 +651,83 @@ SysFreeString( wql ); } +static void test_SystemSecurity( IWbemServices *services ) +{ + static const WCHAR systemsecurityW[] = {'_','_','S','y','s','t','e','m','S','e','c','u','r','i','t','y',0}; + static const WCHAR getsdW[] = {'G','e','t','S','D',0}; + static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; + static const WCHAR sdW[] = {'S','D',0}; + BSTR class = SysAllocString( systemsecurityW ), method; + IWbemClassObject *reg, *out; + VARIANT retval, var_sd; + void *data; + SECURITY_DESCRIPTOR_RELATIVE *sd; + CIMTYPE type; + HRESULT hr; + BYTE sid_admin_buffer[SECURITY_MAX_SID_SIZE]; + SID *sid_admin = (SID*)sid_admin_buffer; + DWORD sid_size; + BOOL ret; + + hr = IWbemServices_GetObject( services, class, 0, NULL, ®, NULL ); + if (hr != S_OK) + { + win_skip( "__SystemSecurity not available\n" ); + return; + } + + sid_size = sizeof(sid_admin_buffer); + ret = CreateWellKnownSid( WinBuiltinAdministratorsSid, NULL, sid_admin, &sid_size ); + ok( ret, "CreateWellKnownSid failed\n" ); + + out = NULL; + method = SysAllocString( getsdW ); + hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL ); + ok( hr == S_OK || hr == WBEM_E_ACCESS_DENIED, "failed to execute method %08x\n", hr ); + SysFreeString( method ); + + if (SUCCEEDED(hr)) + { + type = 0xdeadbeef; + VariantInit( &retval ); + hr = IWbemClassObject_Get( out, returnvalueW, 0, &retval, &type, NULL ); + ok( hr == S_OK, "failed to get return value %08x\n", hr ); + ok( V_VT( &retval ) == VT_I4, "unexpected variant type 0x%x\n", V_VT( &retval ) ); + ok( !V_I4( &retval ), "unexpected error %u\n", V_UI4( &retval ) ); + ok( type == CIM_UINT32, "unexpected type 0x%x\n", type ); + + type = 0xdeadbeef; + VariantInit( &var_sd ); + hr = IWbemClassObject_Get( out, sdW, 0, &var_sd, &type, NULL ); + ok( hr == S_OK, "failed to get names %08x\n", hr ); + ok( V_VT( &var_sd ) == (VT_UI1|VT_ARRAY), "unexpected variant type 0x%x\n", V_VT( &var_sd ) ); + ok( type == (CIM_UINT8|CIM_FLAG_ARRAY), "unexpected type 0x%x\n", type ); + + hr = SafeArrayAccessData( V_ARRAY( &var_sd ), &data ); + ok( hr == S_OK, "SafeArrayAccessData failed %x\n", hr ); + if (SUCCEEDED(hr)) + { + sd = data; + + ok( (sd->Control & SE_SELF_RELATIVE) == SE_SELF_RELATIVE, "relative flag unset\n" ); + ok( sd->Owner != 0, "no owner SID\n"); + ok( sd->Group != 0, "no owner SID\n"); + ok( EqualSid( (PSID)((LPBYTE)sd + sd->Owner), sid_admin ), "unexpected owner SID\n" ); + ok( EqualSid( (PSID)((LPBYTE)sd + sd->Group), sid_admin ), "unexpected group SID\n" ); + + hr = SafeArrayUnaccessData( V_ARRAY( &var_sd ) ); + ok( hr == S_OK, "SafeArrayUnaccessData failed %x\n", hr ); + } + + VariantClear( &var_sd ); + IWbemClassObject_Release( out ); + } + else if (hr == WBEM_E_ACCESS_DENIED) + win_skip( "insufficient privs to test __SystemSecurity\n" ); + + SysFreeString( class ); +} + START_TEST(query) { static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; @@ -682,6 +760,7 @@ test_notification_query_async( services ); test_query_async( services ); test_GetNames( services ); + test_SystemSecurity( services ); SysFreeString( path ); IWbemServices_Release( services ); diff -Nru wine1.7-1.7.24/dlls/wbemprox/wbemprox_private.h wine1.7-1.7.25/dlls/wbemprox/wbemprox_private.h --- wine1.7-1.7.24/dlls/wbemprox/wbemprox_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wbemprox/wbemprox_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -224,6 +224,8 @@ HRESULT service_resume_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT service_start_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT service_stop_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT security_get_sd(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT security_set_sd(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *heap_alloc( size_t len ) @@ -259,15 +261,18 @@ static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0}; static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0}; static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0}; +static const WCHAR class_systemsecurityW[] = {'_','_','S','y','s','t','e','m','S','e','c','u','r','i','t','y',0}; static const WCHAR prop_nameW[] = {'N','a','m','e',0}; static const WCHAR method_enumkeyW[] = {'E','n','u','m','K','e','y',0}; static const WCHAR method_enumvaluesW[] = {'E','n','u','m','V','a','l','u','e','s',0}; static const WCHAR method_getownerW[] = {'G','e','t','O','w','n','e','r',0}; +static const WCHAR method_getsdW[] = {'G','e','t','S','D',0}; static const WCHAR method_getstringvalueW[] = {'G','e','t','S','t','r','i','n','g','V','a','l','u','e',0}; static const WCHAR method_pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0}; static const WCHAR method_resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0}; +static const WCHAR method_setsdW[] = {'S','e','t','S','D',0}; static const WCHAR method_startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0}; static const WCHAR method_stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0}; @@ -275,6 +280,7 @@ static const WCHAR param_domainW[] = {'D','o','m','a','i','n',0}; static const WCHAR param_namesW[] = {'s','N','a','m','e','s',0}; static const WCHAR param_returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0}; +static const WCHAR param_sdW[] = {'S','D',0}; static const WCHAR param_subkeynameW[] = {'s','S','u','b','K','e','y','N','a','m','e',0}; static const WCHAR param_typesW[] = {'T','y','p','e','s',0}; static const WCHAR param_userW[] = {'U','s','e','r',0}; diff -Nru wine1.7-1.7.24/dlls/wined3d/arb_program_shader.c wine1.7-1.7.25/dlls/wined3d/arb_program_shader.c --- wine1.7-1.7.24/dlls/wined3d/arb_program_shader.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/arb_program_shader.c 2014-08-22 18:39:55.000000000 +0000 @@ -706,7 +706,7 @@ { const struct wined3d_shader *pshader = state->shader[WINED3D_SHADER_TYPE_PIXEL]; const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; - UINT rt_height = state->fb->render_targets[0]->resource.height; + UINT rt_height = state->fb->render_targets[0]->height; /* Load DirectX 9 float constants for pixel shader */ priv->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB, @@ -4673,7 +4673,7 @@ } else { - UINT rt_height = state->fb->render_targets[0]->resource.height; + UINT rt_height = state->fb->render_targets[0]->height; shader_arb_ps_local_constants(compiled, context, state, rt_height); } @@ -7278,12 +7278,12 @@ } /* Context activation is done by the caller. */ -static void upload_palette(const struct wined3d_surface *surface, struct wined3d_context *context) +static void upload_palette(const struct wined3d_texture *texture, struct wined3d_context *context) { - struct wined3d_device *device = surface->resource.device; + const struct wined3d_palette *palette = texture->swapchain ? texture->swapchain->palette : NULL; + struct wined3d_device *device = texture->resource.device; const struct wined3d_gl_info *gl_info = context->gl_info; struct arbfp_blit_priv *priv = device->blit_priv; - const struct wined3d_palette *palette = surface->swapchain ? surface->swapchain->palette : NULL; if (!priv->palette_texture) gl_info->gl_ops.gl.p_glGenTextures(1, &priv->palette_texture); @@ -7538,7 +7538,7 @@ } if (fixup == COMPLEX_FIXUP_P8) - upload_palette(surface, context); + upload_palette(surface->container, context); gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)"); @@ -7645,7 +7645,7 @@ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO && (src_surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_DRAWABLE)) == WINED3D_LOCATION_DRAWABLE - && !surface_is_offscreen(src_surface)) + && !wined3d_resource_is_offscreen(&src_surface->resource)) { /* Without FBO blits transferring from the drawable to the texture is * expensive, because we have to flip the data in sysmem. Since we can @@ -7662,7 +7662,7 @@ context_apply_blit_state(context, device); - if (!surface_is_offscreen(dst_surface)) + if (!wined3d_resource_is_offscreen(&dst_surface->resource)) surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect); arbfp_blit_set(device->blit_priv, context, src_surface); @@ -7674,13 +7674,14 @@ arbfp_blit_unset(context->gl_info); if (wined3d_settings.strict_draw_ordering - || (dst_surface->swapchain && (dst_surface->swapchain->front_buffer == dst_surface))) + || (dst_surface->container->swapchain + && (dst_surface->container->swapchain->front_buffer == dst_surface->container))) context->gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); - surface_validate_location(dst_surface, dst_surface->resource.draw_binding); - surface_invalidate_location(dst_surface, ~dst_surface->resource.draw_binding); + surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding); + surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding); return WINED3D_OK; } diff -Nru wine1.7-1.7.24/dlls/wined3d/buffer.c wine1.7-1.7.25/dlls/wined3d/buffer.c --- wine1.7-1.7.24/dlls/wined3d/buffer.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/buffer.c 2014-08-22 18:39:55.000000000 +0000 @@ -1113,8 +1113,20 @@ } } +static ULONG buffer_resource_incref(struct wined3d_resource *resource) +{ + return wined3d_buffer_incref(buffer_from_resource(resource)); +} + +static ULONG buffer_resource_decref(struct wined3d_resource *resource) +{ + return wined3d_buffer_decref(buffer_from_resource(resource)); +} + static const struct wined3d_resource_ops buffer_resource_ops = { + buffer_resource_incref, + buffer_resource_decref, buffer_unload, }; diff -Nru wine1.7-1.7.24/dlls/wined3d/context.c wine1.7-1.7.25/dlls/wined3d/context.c --- wine1.7-1.7.24/dlls/wined3d/context.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/context.c 2014-08-22 18:39:55.000000000 +0000 @@ -1590,7 +1590,7 @@ ret->current_rt = target; ret->tid = GetCurrentThreadId(); - ret->render_offscreen = surface_is_offscreen(target); + ret->render_offscreen = wined3d_resource_is_offscreen(&target->resource); ret->draw_buffers_mask = context_generate_rt_mask(GL_BACK); ret->valid = 1; @@ -1826,7 +1826,7 @@ { const struct wined3d_surface *rt = context->current_rt; - if (rt->swapchain && rt->swapchain->front_buffer == rt) + if (rt->container->swapchain && rt->container->swapchain->front_buffer == rt->container) { RECT window_size; @@ -2201,13 +2201,13 @@ /* The caller provides a context */ static void context_validate_onscreen_formats(struct wined3d_context *context, - const struct wined3d_surface *depth_stencil) + const struct wined3d_rendertarget_view *depth_stencil) { /* Onscreen surfaces are always in a swapchain */ - struct wined3d_swapchain *swapchain = context->current_rt->swapchain; + struct wined3d_swapchain *swapchain = context->current_rt->container->swapchain; if (context->render_offscreen || !depth_stencil) return; - if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format)) return; + if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->format)) return; /* TODO: If the requested format would satisfy the needs of the existing one(reverse match), * or no onscreen depth buffer was created, the OpenGL drawable could be changed to the new @@ -2225,7 +2225,7 @@ { if (!rt || rt->resource.format->id == WINED3DFMT_NULL) return 0; - else if (rt->swapchain) + else if (rt->container->swapchain) return context_generate_rt_mask_from_surface(rt); else return context_generate_rt_mask(device->offscreenBuffer); @@ -2245,7 +2245,7 @@ { wined3d_texture_load(rt->container, context, FALSE); - context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->resource.draw_binding); + context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->container->resource.draw_binding); if (rt->resource.format->id != WINED3DFMT_NULL) rt_mask = 1; else @@ -2280,8 +2280,8 @@ context_invalidate_state(context, STATE_FRAMEBUFFER); } -static BOOL context_validate_rt_config(UINT rt_count, - struct wined3d_surface * const *rts, const struct wined3d_surface *ds) +static BOOL context_validate_rt_config(UINT rt_count, struct wined3d_rendertarget_view * const *rts, + const struct wined3d_rendertarget_view *ds) { unsigned int i; @@ -2289,7 +2289,7 @@ for (i = 0; i < rt_count; ++i) { - if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL) + if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL) return TRUE; } @@ -2301,10 +2301,10 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb) { + struct wined3d_rendertarget_view **rts = fb->render_targets; const struct wined3d_gl_info *gl_info = context->gl_info; DWORD rt_mask = 0, *cur_mask; UINT i; - struct wined3d_surface **rts = fb->render_targets; if (isStateDirty(context, STATE_FRAMEBUFFER) || fb != &device->fb || rt_count != context->gl_info->limits.buffers) @@ -2316,12 +2316,12 @@ { context_validate_onscreen_formats(context, fb->depth_stencil); - if (!rt_count || surface_is_offscreen(rts[0])) + if (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource)) { for (i = 0; i < rt_count; ++i) { - context->blit_targets[i] = rts[i]; - if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL) + context->blit_targets[i] = wined3d_rendertarget_view_get_surface(rts[i]); + if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL) rt_mask |= (1 << i); } while (i < context->gl_info->limits.buffers) @@ -2329,13 +2329,14 @@ context->blit_targets[i] = NULL; ++i; } - context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, fb->depth_stencil, - rt_count ? rts[0]->resource.draw_binding : WINED3D_LOCATION_TEXTURE_RGB); + context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, + wined3d_rendertarget_view_get_surface(fb->depth_stencil), + rt_count ? rts[0]->resource->draw_binding : WINED3D_LOCATION_TEXTURE_RGB); } else { context_apply_fbo_state(context, GL_FRAMEBUFFER, NULL, NULL, WINED3D_LOCATION_DRAWABLE); - rt_mask = context_generate_rt_mask_from_surface(rts[0]); + rt_mask = context_generate_rt_mask_from_surface(wined3d_rendertarget_view_get_surface(rts[0])); } /* If the framebuffer is not the device's fb the device's fb has to be reapplied @@ -2345,20 +2346,23 @@ } else { - rt_mask = context_generate_rt_mask_no_fbo(device, rt_count ? rts[0] : NULL); + rt_mask = context_generate_rt_mask_no_fbo(device, + rt_count ? wined3d_rendertarget_view_get_surface(rts[0]) : NULL); } } else if (wined3d_settings.offscreen_rendering_mode == ORM_FBO - && (!rt_count || surface_is_offscreen(rts[0]))) + && (!rt_count || wined3d_resource_is_offscreen(rts[0]->resource))) { for (i = 0; i < rt_count; ++i) { - if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL) rt_mask |= (1 << i); + if (rts[i] && rts[i]->format->id != WINED3DFMT_NULL) + rt_mask |= (1 << i); } } else { - rt_mask = context_generate_rt_mask_no_fbo(device, rt_count ? rts[0] : NULL); + rt_mask = context_generate_rt_mask_no_fbo(device, + rt_count ? wined3d_rendertarget_view_get_surface(rts[0]) : NULL); } cur_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask; @@ -2395,13 +2399,15 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const struct wined3d_device *device) { const struct wined3d_state *state = &device->state; - struct wined3d_surface **rts = state->fb->render_targets; + struct wined3d_rendertarget_view **rts = state->fb->render_targets; struct wined3d_shader *ps = state->shader[WINED3D_SHADER_TYPE_PIXEL]; DWORD rt_mask, rt_mask_bits; unsigned int i; - if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return context_generate_rt_mask_no_fbo(device, rts[0]); - else if (!context->render_offscreen) return context_generate_rt_mask_from_surface(rts[0]); + if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) + return context_generate_rt_mask_no_fbo(device, wined3d_rendertarget_view_get_surface(rts[0])); + else if (!context->render_offscreen) + return context_generate_rt_mask_from_surface(wined3d_rendertarget_view_get_surface(rts[0])); rt_mask = ps ? ps->reg_maps.rt_mask : 1; rt_mask &= context->d3d_info->valid_rt_mask; @@ -2410,7 +2416,7 @@ while (rt_mask_bits) { rt_mask_bits &= ~(1 << i); - if (!rts[i] || rts[i]->resource.format->id == WINED3DFMT_NULL) + if (!rts[i] || rts[i]->format->id == WINED3DFMT_NULL) rt_mask &= ~(1 << i); i++; @@ -2435,8 +2441,15 @@ } else { - context_apply_fbo_state(context, GL_FRAMEBUFFER, fb->render_targets, fb->depth_stencil, - fb->render_targets[0]->resource.draw_binding); + unsigned int i; + + for (i = 0; i < context->gl_info->limits.buffers; ++i) + { + context->blit_targets[i] = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); + } + context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, + wined3d_rendertarget_view_get_surface(fb->depth_stencil), + fb->render_targets[0]->resource->draw_binding); } } @@ -3030,7 +3043,7 @@ { BOOL old_render_offscreen = context->render_offscreen, render_offscreen; - render_offscreen = surface_is_offscreen(target); + render_offscreen = wined3d_resource_is_offscreen(&target->resource); if (context->current_rt == target && render_offscreen == old_render_offscreen) return; /* To compensate the lack of format switching with some offscreen rendering methods and on onscreen buffers @@ -3102,9 +3115,9 @@ { struct wined3d_swapchain *swapchain = device->swapchains[0]; if (swapchain->back_buffers) - target = swapchain->back_buffers[0]; + target = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)); else - target = swapchain->front_buffer; + target = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); } } @@ -3112,11 +3125,11 @@ { context = current_context; } - else if (target->swapchain) + else if (target->container->swapchain) { TRACE("Rendering onscreen.\n"); - context = swapchain_get_context(target->swapchain); + context = swapchain_get_context(target->container->swapchain); } else { diff -Nru wine1.7-1.7.24/dlls/wined3d/cs.c wine1.7-1.7.25/dlls/wined3d/cs.c --- wine1.7-1.7.24/dlls/wined3d/cs.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/cs.c 2014-08-22 18:39:55.000000000 +0000 @@ -31,8 +31,8 @@ WINED3D_CS_OP_DRAW, WINED3D_CS_OP_SET_VIEWPORT, WINED3D_CS_OP_SET_SCISSOR_RECT, - WINED3D_CS_OP_SET_RENDER_TARGET, - WINED3D_CS_OP_SET_DEPTH_STENCIL, + WINED3D_CS_OP_SET_RENDERTARGET_VIEW, + WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW, WINED3D_CS_OP_SET_VERTEX_DECLARATION, WINED3D_CS_OP_SET_STREAM_SOURCE, WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ, @@ -95,17 +95,17 @@ const RECT *rect; }; -struct wined3d_cs_set_render_target +struct wined3d_cs_set_rendertarget_view { enum wined3d_cs_op opcode; - UINT render_target_idx; - struct wined3d_surface *render_target; + unsigned int view_idx; + struct wined3d_rendertarget_view *view; }; -struct wined3d_cs_set_depth_stencil +struct wined3d_cs_set_depth_stencil_view { enum wined3d_cs_op opcode; - struct wined3d_surface *depth_stencil; + struct wined3d_rendertarget_view *view; }; struct wined3d_cs_set_vertex_declaration @@ -346,41 +346,42 @@ cs->ops->submit(cs); } -static void wined3d_cs_exec_set_render_target(struct wined3d_cs *cs, const void *data) +static void wined3d_cs_exec_set_rendertarget_view(struct wined3d_cs *cs, const void *data) { - const struct wined3d_cs_set_render_target *op = data; + const struct wined3d_cs_set_rendertarget_view *op = data; - cs->state.fb->render_targets[op->render_target_idx] = op->render_target; + cs->state.fb->render_targets[op->view_idx] = op->view; device_invalidate_state(cs->device, STATE_FRAMEBUFFER); } -void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx, - struct wined3d_surface *render_target) +void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, + struct wined3d_rendertarget_view *view) { - struct wined3d_cs_set_render_target *op; + struct wined3d_cs_set_rendertarget_view *op; op = cs->ops->require_space(cs, sizeof(*op)); - op->opcode = WINED3D_CS_OP_SET_RENDER_TARGET; - op->render_target_idx = render_target_idx; - op->render_target = render_target; + op->opcode = WINED3D_CS_OP_SET_RENDERTARGET_VIEW; + op->view_idx = view_idx; + op->view = view; cs->ops->submit(cs); } -static void wined3d_cs_exec_set_depth_stencil(struct wined3d_cs *cs, const void *data) +static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const void *data) { - const struct wined3d_cs_set_depth_stencil *op = data; + const struct wined3d_cs_set_depth_stencil_view *op = data; struct wined3d_device *device = cs->device; - struct wined3d_surface *prev; + struct wined3d_rendertarget_view *prev; if ((prev = cs->state.fb->depth_stencil)) { - if (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL - || prev->flags & SFLAG_DISCARD) + struct wined3d_surface *prev_surface = wined3d_rendertarget_view_get_surface(prev); + + if (prev_surface && (device->swapchains[0]->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL + || prev_surface->flags & SFLAG_DISCARD)) { - surface_modify_ds_location(prev, WINED3D_LOCATION_DISCARDED, - prev->resource.width, prev->resource.height); - if (prev == device->onscreen_depth_stencil) + surface_modify_ds_location(prev_surface, WINED3D_LOCATION_DISCARDED, prev->width, prev->height); + if (prev_surface == device->onscreen_depth_stencil) { wined3d_surface_decref(device->onscreen_depth_stencil); device->onscreen_depth_stencil = NULL; @@ -388,9 +389,9 @@ } } - cs->fb.depth_stencil = op->depth_stencil; + cs->fb.depth_stencil = op->view; - if (!prev != !op->depth_stencil) + if (!prev != !op->view) { /* Swapping NULL / non NULL depth stencil affects the depth and tests */ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_ZENABLE)); @@ -398,7 +399,7 @@ device_invalidate_state(device, STATE_RENDER(WINED3D_RS_STENCILWRITEMASK)); device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); } - else if (prev && prev->resource.format->depth_size != op->depth_stencil->resource.format->depth_size) + else if (prev && prev->format->depth_size != op->view->format->depth_size) { device_invalidate_state(device, STATE_RENDER(WINED3D_RS_DEPTHBIAS)); } @@ -406,13 +407,13 @@ device_invalidate_state(device, STATE_FRAMEBUFFER); } -void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_surface *depth_stencil) +void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, struct wined3d_rendertarget_view *view) { - struct wined3d_cs_set_depth_stencil *op; + struct wined3d_cs_set_depth_stencil_view *op; op = cs->ops->require_space(cs, sizeof(*op)); - op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL; - op->depth_stencil = depth_stencil; + op->opcode = WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW; + op->view = view; cs->ops->submit(cs); } @@ -851,8 +852,8 @@ /* WINED3D_CS_OP_DRAW */ wined3d_cs_exec_draw, /* WINED3D_CS_OP_SET_VIEWPORT */ wined3d_cs_exec_set_viewport, /* WINED3D_CS_OP_SET_SCISSOR_RECT */ wined3d_cs_exec_set_scissor_rect, - /* WINED3D_CS_OP_SET_RENDER_TARGET */ wined3d_cs_exec_set_render_target, - /* WINED3D_CS_OP_SET_DEPTH_STENCIL */ wined3d_cs_exec_set_depth_stencil, + /* WINED3D_CS_OP_SET_RENDERTARGET_VIEW */ wined3d_cs_exec_set_rendertarget_view, + /* WINED3D_CS_OP_SET_DEPTH_STENCIL_VIEW */ wined3d_cs_exec_set_depth_stencil_view, /* WINED3D_CS_OP_SET_VERTEX_DECLARATION */ wined3d_cs_exec_set_vertex_declaration, /* WINED3D_CS_OP_SET_STREAM_SOURCE */ wined3d_cs_exec_set_stream_source, /* WINED3D_CS_OP_SET_STREAM_SOURCE_FREQ */ wined3d_cs_exec_set_stream_source_freq, diff -Nru wine1.7-1.7.24/dlls/wined3d/device.c wine1.7-1.7.25/dlls/wined3d/device.c --- wine1.7-1.7.24/dlls/wined3d/device.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/device.c 2014-08-22 18:39:55.000000000 +0000 @@ -286,8 +286,10 @@ UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil) { + struct wined3d_surface *target = rt_count ? wined3d_rendertarget_view_get_surface(fb->render_targets[0]) : NULL; + struct wined3d_surface *depth_stencil = fb->depth_stencil + ? wined3d_rendertarget_view_get_surface(fb->depth_stencil) : NULL; const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL; - struct wined3d_surface *target = rt_count ? fb->render_targets[0] : NULL; const struct wined3d_gl_info *gl_info; UINT drawable_width, drawable_height; struct wined3d_context *context; @@ -308,9 +310,9 @@ { for (i = 0; i < rt_count; ++i) { - struct wined3d_surface *rt = fb->render_targets[i]; + struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); if (rt) - surface_load_location(rt, rt->resource.draw_binding); + surface_load_location(rt, rt->container->resource.draw_binding); } } @@ -331,17 +333,17 @@ else { render_offscreen = TRUE; - drawable_width = fb->depth_stencil->pow2Width; - drawable_height = fb->depth_stencil->pow2Height; + drawable_width = depth_stencil->pow2Width; + drawable_height = depth_stencil->pow2Height; } if (flags & WINED3DCLEAR_ZBUFFER) { - DWORD location = render_offscreen ? fb->depth_stencil->resource.draw_binding : WINED3D_LOCATION_DRAWABLE; + DWORD location = render_offscreen ? fb->depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; - if (!render_offscreen && fb->depth_stencil != device->onscreen_depth_stencil) - device_switch_onscreen_ds(device, context, fb->depth_stencil); - prepare_ds_clear(fb->depth_stencil, context, location, + if (!render_offscreen && depth_stencil != device->onscreen_depth_stencil) + device_switch_onscreen_ds(device, context, depth_stencil); + prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect, &ds_rect); } @@ -369,9 +371,9 @@ if (flags & WINED3DCLEAR_ZBUFFER) { - DWORD location = render_offscreen ? fb->depth_stencil->resource.draw_binding : WINED3D_LOCATION_DRAWABLE; + DWORD location = render_offscreen ? fb->depth_stencil->resource->draw_binding : WINED3D_LOCATION_DRAWABLE; - surface_modify_ds_location(fb->depth_stencil, location, ds_rect.right, ds_rect.bottom); + surface_modify_ds_location(depth_stencil, location, ds_rect.right, ds_rect.bottom); gl_info->gl_ops.gl.p_glDepthMask(GL_TRUE); context_invalidate_state(context, STATE_RENDER(WINED3D_RS_ZWRITEENABLE)); @@ -384,12 +386,12 @@ { for (i = 0; i < rt_count; ++i) { - struct wined3d_surface *rt = fb->render_targets[i]; + struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(fb->render_targets[i]); if (rt) { - surface_validate_location(rt, rt->resource.draw_binding); - surface_invalidate_location(rt, ~rt->resource.draw_binding); + surface_validate_location(rt, rt->container->resource.draw_binding); + surface_invalidate_location(rt, ~rt->container->resource.draw_binding); } } @@ -460,7 +462,7 @@ } if (wined3d_settings.strict_draw_ordering || (flags & WINED3DCLEAR_TARGET - && target->swapchain && target->swapchain->front_buffer == target)) + && target->container->swapchain && target->container->swapchain->front_buffer == target->container)) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); @@ -607,9 +609,11 @@ } else { + const RECT rect = {0, 0, surface->resource.width, surface->resource.height}; const struct wined3d_color c = {1.0f, 1.0f, 1.0f, 1.0f}; + /* Fill the surface with a white color to show that wined3d is there */ - wined3d_device_color_fill(device, surface, NULL, &c); + surface_color_fill(surface, &rect, &c); } out: @@ -849,13 +853,13 @@ { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - wined3d_device_set_render_target(device, i, NULL, FALSE); + wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); } - if (swapchain->back_buffers && swapchain->back_buffers[0]) - wined3d_device_set_render_target(device, 0, swapchain->back_buffers[0], TRUE); + if (device->back_buffer_view) + wined3d_device_set_rendertarget_view(device, 0, device->back_buffer_view, TRUE); } - wined3d_device_set_depth_stencil(device, ds_enable ? device->auto_depth_stencil : NULL); + wined3d_device_set_depth_stencil_view(device, ds_enable ? device->auto_depth_stencil_view : NULL); wined3d_device_set_render_state(device, WINED3D_RS_ZENABLE, ds_enable); } @@ -901,6 +905,14 @@ goto err_out; } + if (swapchain_desc->backbuffer_count && FAILED(hr = wined3d_rendertarget_view_create_from_surface( + surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)), + NULL, &wined3d_null_parent_ops, &device->back_buffer_view))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + goto err_out; + } + device->swapchain_count = 1; device->swapchains = HeapAlloc(GetProcessHeap(), 0, device->swapchain_count * sizeof(*device->swapchains)); if (!device->swapchains) @@ -911,7 +923,8 @@ device->swapchains[0] = swapchain; device_init_swapchain_state(device, swapchain); - context = context_acquire(device, swapchain->front_buffer); + context = context_acquire(device, + surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0))); create_dummy_textures(device, context); @@ -960,6 +973,8 @@ HeapFree(GetProcessHeap(), 0, device->fb.render_targets); HeapFree(GetProcessHeap(), 0, device->swapchains); device->swapchain_count = 0; + if (device->back_buffer_view) + wined3d_rendertarget_view_decref(device->back_buffer_view); if (swapchain) wined3d_swapchain_decref(swapchain); if (device->blit_priv) @@ -1061,25 +1076,31 @@ if (device->fb.depth_stencil) { - surface = device->fb.depth_stencil; + struct wined3d_rendertarget_view *view = device->fb.depth_stencil; - TRACE("Releasing depth/stencil buffer %p.\n", surface); + TRACE("Releasing depth/stencil view %p.\n", view); device->fb.depth_stencil = NULL; - wined3d_surface_decref(surface); + wined3d_rendertarget_view_decref(view); } - if (device->auto_depth_stencil) + if (device->auto_depth_stencil_view) { - surface = device->auto_depth_stencil; - device->auto_depth_stencil = NULL; - if (wined3d_surface_decref(surface)) - FIXME("Something's still holding the auto depth stencil buffer (%p).\n", surface); + struct wined3d_rendertarget_view *view = device->auto_depth_stencil_view; + + device->auto_depth_stencil_view = NULL; + if (wined3d_rendertarget_view_decref(view)) + ERR("Something's still holding the auto depth/stencil view (%p).\n", view); } for (i = 0; i < gl_info->limits.buffers; ++i) { - wined3d_device_set_render_target(device, i, NULL, FALSE); + wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); + } + if (device->back_buffer_view) + { + wined3d_rendertarget_view_decref(device->back_buffer_view); + device->back_buffer_view = NULL; } context_release(context); @@ -1138,11 +1159,12 @@ { TRACE("device %p.\n", device); - TRACE("Emulating %d MB, returning %d MB left.\n", - device->adapter->TextureRam / (1024 * 1024), - (device->adapter->TextureRam - device->adapter->UsedTextureRam) / (1024 * 1024)); + TRACE("Emulating 0x%s bytes. 0x%s used, returning 0x%s left.\n", + wine_dbgstr_longlong(device->adapter->vram_bytes), + wine_dbgstr_longlong(device->adapter->vram_bytes_used), + wine_dbgstr_longlong(device->adapter->vram_bytes - device->adapter->vram_bytes_used)); - return device->adapter->TextureRam - device->adapter->UsedTextureRam; + return min(UINT_MAX, device->adapter->vram_bytes - device->adapter->vram_bytes_used); } void CDECL wined3d_device_set_stream_output(struct wined3d_device *device, UINT idx, @@ -1888,8 +1910,7 @@ || !(texture->resource.format->flags & WINED3DFMT_FLAG_DEPTH)) return; surface = surface_from_resource(texture->sub_resources[0]); - depth_stencil = state->fb->depth_stencil; - if (!depth_stencil) + if (!(depth_stencil = wined3d_rendertarget_view_get_surface(state->fb->depth_stencil))) return; wined3d_surface_blt(surface, NULL, depth_stencil, NULL, 0, NULL, WINED3D_TEXF_POINT); @@ -3199,7 +3220,7 @@ if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { - struct wined3d_surface *ds = device->fb.depth_stencil; + struct wined3d_rendertarget_view *ds = device->fb.depth_stencil; if (!ds) { WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); @@ -3208,8 +3229,8 @@ } else if (flags & WINED3DCLEAR_TARGET) { - if (ds->resource.width < device->fb.render_targets[0]->resource.width - || ds->resource.height < device->fb.render_targets[0]->resource.height) + if (ds->width < device->fb.render_targets[0]->width + || ds->height < device->fb.render_targets[0]->height) { WARN("Silently ignoring depth and target clear with mismatching sizes\n"); return WINED3D_OK; @@ -3527,11 +3548,10 @@ if (state->render_states[WINED3D_RS_ZENABLE] || state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_STENCILENABLE]) { - struct wined3d_surface *ds = device->fb.depth_stencil; - struct wined3d_surface *target = device->fb.render_targets[0]; + struct wined3d_rendertarget_view *rt = device->fb.render_targets[0]; + struct wined3d_rendertarget_view *ds = device->fb.depth_stencil; - if(ds && target - && (ds->resource.width < target->resource.width || ds->resource.height < target->resource.height)) + if (ds && rt && (ds->width < rt->width || ds->height < rt->height)) { WARN("Depth stencil is smaller than the color buffer, returning D3DERR_CONFLICTINGRENDERSTATE\n"); return WINED3DERR_CONFLICTINGRENDERSTATE; @@ -3640,30 +3660,6 @@ return surface_upload_from_surface(dst_surface, dst_point, src_surface, src_rect); } -HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device, - struct wined3d_surface *surface, const RECT *rect, const struct wined3d_color *color) -{ - RECT r; - - TRACE("device %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n", - device, surface, wine_dbgstr_rect(rect), - color->r, color->g, color->b, color->a); - - if (surface->resource.pool != WINED3D_POOL_DEFAULT && surface->resource.pool != WINED3D_POOL_SYSTEM_MEM) - { - WARN("Color-fill not allowed on %s surfaces.\n", debug_d3dpool(surface->resource.pool)); - return WINED3DERR_INVALIDCALL; - } - - if (!rect) - { - SetRect(&r, 0, 0, surface->resource.width, surface->resource.height); - rect = &r; - } - - return surface_color_fill(surface, rect, color); -} - void CDECL wined3d_device_copy_resource(struct wined3d_device *device, struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource) { @@ -3735,124 +3731,137 @@ } } -void CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, - struct wined3d_rendertarget_view *rendertarget_view, const struct wined3d_color *color) +HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color) { struct wined3d_resource *resource; - HRESULT hr; - RECT rect; + RECT r; - resource = rendertarget_view->resource; - if (resource->type != WINED3D_RTYPE_SURFACE) + TRACE("device %p, view %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n", + device, view, wine_dbgstr_rect(rect), color->r, color->g, color->b, color->a); + + resource = view->resource; + if (resource->type != WINED3D_RTYPE_TEXTURE && resource->type != WINED3D_RTYPE_CUBE_TEXTURE) { - FIXME("Only supported on surface resources\n"); - return; + FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(resource->type)); + return WINED3DERR_INVALIDCALL; } - SetRect(&rect, 0, 0, resource->width, resource->height); - hr = surface_color_fill(surface_from_resource(resource), &rect, color); - if (FAILED(hr)) ERR("Color fill failed, hr %#x.\n", hr); + if (view->depth > 1) + { + FIXME("Layered clears not implemented.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (!rect) + { + SetRect(&r, 0, 0, view->width, view->height); + rect = &r; + } + + resource = wined3d_texture_get_sub_resource(wined3d_texture_from_resource(resource), view->sub_resource_idx); + + return surface_color_fill(surface_from_resource(resource), rect, color); } -struct wined3d_surface * CDECL wined3d_device_get_render_target(const struct wined3d_device *device, - UINT render_target_idx) +struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device, + unsigned int view_idx) { - TRACE("device %p, render_target_idx %u.\n", device, render_target_idx); + TRACE("device %p, view_idx %u.\n", device, view_idx); - if (render_target_idx >= device->adapter->gl_info.limits.buffers) + if (view_idx >= device->adapter->gl_info.limits.buffers) { WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers); return NULL; } - return device->fb.render_targets[render_target_idx]; + return device->fb.render_targets[view_idx]; } -struct wined3d_surface * CDECL wined3d_device_get_depth_stencil(const struct wined3d_device *device) +struct wined3d_rendertarget_view * CDECL wined3d_device_get_depth_stencil_view(const struct wined3d_device *device) { TRACE("device %p.\n", device); return device->fb.depth_stencil; } -HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, - UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport) +HRESULT CDECL wined3d_device_set_rendertarget_view(struct wined3d_device *device, + unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport) { - struct wined3d_surface *prev; + struct wined3d_rendertarget_view *prev; - TRACE("device %p, render_target_idx %u, render_target %p, set_viewport %#x.\n", - device, render_target_idx, render_target, set_viewport); + TRACE("device %p, view_idx %u, view %p, set_viewport %#x.\n", + device, view_idx, view, set_viewport); - if (render_target_idx >= device->adapter->gl_info.limits.buffers) + if (view_idx >= device->adapter->gl_info.limits.buffers) { WARN("Only %u render targets are supported.\n", device->adapter->gl_info.limits.buffers); return WINED3DERR_INVALIDCALL; } - if (render_target && !(render_target->resource.usage & WINED3DUSAGE_RENDERTARGET)) + if (view && !(view->resource->usage & WINED3DUSAGE_RENDERTARGET)) { - WARN("Surface %p doesn't have render target usage.\n", render_target); + WARN("View resource %p doesn't have render target usage.\n", view->resource); return WINED3DERR_INVALIDCALL; } /* Set the viewport and scissor rectangles, if requested. Tests show that * stateblock recording is ignored, the change goes directly into the * primary stateblock. */ - if (!render_target_idx && set_viewport) + if (!view_idx && set_viewport) { struct wined3d_state *state = &device->state; state->viewport.x = 0; state->viewport.y = 0; - state->viewport.width = render_target->resource.width; - state->viewport.height = render_target->resource.height; + state->viewport.width = view->width; + state->viewport.height = view->height; state->viewport.min_z = 0.0f; state->viewport.max_z = 1.0f; wined3d_cs_emit_set_viewport(device->cs, &state->viewport); state->scissor_rect.top = 0; state->scissor_rect.left = 0; - state->scissor_rect.right = render_target->resource.width; - state->scissor_rect.bottom = render_target->resource.height; + state->scissor_rect.right = view->width; + state->scissor_rect.bottom = view->height; wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } - prev = device->fb.render_targets[render_target_idx]; - if (render_target == prev) + prev = device->fb.render_targets[view_idx]; + if (view == prev) return WINED3D_OK; - if (render_target) - wined3d_surface_incref(render_target); - device->fb.render_targets[render_target_idx] = render_target; - wined3d_cs_emit_set_render_target(device->cs, render_target_idx, render_target); + if (view) + wined3d_rendertarget_view_incref(view); + device->fb.render_targets[view_idx] = view; + wined3d_cs_emit_set_rendertarget_view(device->cs, view_idx, view); /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ if (prev) - wined3d_surface_decref(prev); + wined3d_rendertarget_view_decref(prev); return WINED3D_OK; } -void CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil) +void CDECL wined3d_device_set_depth_stencil_view(struct wined3d_device *device, struct wined3d_rendertarget_view *view) { - struct wined3d_surface *prev = device->fb.depth_stencil; + struct wined3d_rendertarget_view *prev; - TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n", - device, depth_stencil, prev); + TRACE("device %p, view %p.\n", device, view); - if (prev == depth_stencil) + prev = device->fb.depth_stencil; + if (prev == view) { TRACE("Trying to do a NOP SetRenderTarget operation.\n"); return; } - device->fb.depth_stencil = depth_stencil; - if (depth_stencil) - wined3d_surface_incref(depth_stencil); - wined3d_cs_emit_set_depth_stencil(device->cs, depth_stencil); + if ((device->fb.depth_stencil = view)) + wined3d_rendertarget_view_incref(view); + wined3d_cs_emit_set_depth_stencil_view(device->cs, view); if (prev) - wined3d_surface_decref(prev); + wined3d_rendertarget_view_decref(prev); } static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined3d_device *device, @@ -4166,7 +4175,9 @@ return E_OUTOFMEMORY; } - target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer; + target = swapchain->back_buffers + ? surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)) + : surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); if (!(context = context_create(swapchain, target, swapchain->ds_format))) { WARN("Failed to create context.\n"); @@ -4225,12 +4236,10 @@ { for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - wined3d_device_set_render_target(device, i, NULL, FALSE); + wined3d_device_set_rendertarget_view(device, i, NULL, FALSE); } - if (swapchain->back_buffers && swapchain->back_buffers[0]) - wined3d_device_set_render_target(device, 0, swapchain->back_buffers[0], FALSE); } - wined3d_device_set_depth_stencil(device, NULL); + wined3d_device_set_depth_stencil_view(device, NULL); if (device->onscreen_depth_stencil) { @@ -4297,35 +4306,6 @@ wined3d_swapchain_set_window(swapchain, NULL); } - if (swapchain_desc->enable_auto_depth_stencil && !device->auto_depth_stencil) - { - struct wined3d_resource_desc surface_desc; - - TRACE("Creating the depth stencil buffer\n"); - - surface_desc.resource_type = WINED3D_RTYPE_SURFACE; - surface_desc.format = swapchain_desc->auto_depth_stencil_format; - surface_desc.multisample_type = swapchain_desc->multisample_type; - surface_desc.multisample_quality = swapchain_desc->multisample_quality; - surface_desc.usage = WINED3DUSAGE_DEPTHSTENCIL; - surface_desc.pool = WINED3D_POOL_DEFAULT; - surface_desc.width = swapchain_desc->backbuffer_width; - surface_desc.height = swapchain_desc->backbuffer_height; - surface_desc.depth = 1; - surface_desc.size = 0; - - if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, - device->device_parent, &surface_desc, &device->auto_depth_stencil))) - { - ERR("Failed to create the depth stencil buffer, hr %#x.\n", hr); - return WINED3DERR_INVALIDCALL; - } - } - - /* Reset the depth stencil */ - if (swapchain_desc->enable_auto_depth_stencil) - wined3d_device_set_depth_stencil(device, device->auto_depth_stencil); - if (mode) { DisplayModeChanged = TRUE; @@ -4398,25 +4378,75 @@ { UINT i; - if (FAILED(hr = wined3d_surface_update_desc(swapchain->front_buffer, swapchain->desc.backbuffer_width, + if (FAILED(hr = wined3d_surface_update_desc(surface_from_resource( + wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height, swapchain->desc.backbuffer_format, swapchain->desc.multisample_type, swapchain->desc.multisample_quality, NULL, 0))) return hr; for (i = 0; i < swapchain->desc.backbuffer_count; ++i) { - if (FAILED(hr = wined3d_surface_update_desc(swapchain->back_buffers[i], swapchain->desc.backbuffer_width, + if (FAILED(hr = wined3d_surface_update_desc(surface_from_resource( + wined3d_texture_get_sub_resource(swapchain->back_buffers[i], 0)), swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height, swapchain->desc.backbuffer_format, swapchain->desc.multisample_type, swapchain->desc.multisample_quality, NULL, 0))) return hr; } - if (device->auto_depth_stencil) + } + + if (device->auto_depth_stencil_view) + { + wined3d_rendertarget_view_decref(device->auto_depth_stencil_view); + device->auto_depth_stencil_view = NULL; + } + if (swapchain->desc.enable_auto_depth_stencil) + { + struct wined3d_resource_desc surface_desc; + struct wined3d_surface *surface; + + TRACE("Creating the depth stencil buffer\n"); + + surface_desc.resource_type = WINED3D_RTYPE_SURFACE; + surface_desc.format = swapchain->desc.auto_depth_stencil_format; + surface_desc.multisample_type = swapchain->desc.multisample_type; + surface_desc.multisample_quality = swapchain->desc.multisample_quality; + surface_desc.usage = WINED3DUSAGE_DEPTHSTENCIL; + surface_desc.pool = WINED3D_POOL_DEFAULT; + surface_desc.width = swapchain->desc.backbuffer_width; + surface_desc.height = swapchain->desc.backbuffer_height; + surface_desc.depth = 1; + surface_desc.size = 0; + + if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, + device->device_parent, &surface_desc, &surface))) { - if (FAILED(hr = wined3d_surface_update_desc(device->auto_depth_stencil, swapchain->desc.backbuffer_width, - swapchain->desc.backbuffer_height, device->auto_depth_stencil->resource.format->id, - swapchain->desc.multisample_type, swapchain->desc.multisample_quality, NULL, 0))) - return hr; + ERR("Failed to create the auto depth/stencil surface, hr %#x.\n", hr); + return WINED3DERR_INVALIDCALL; + } + + hr = wined3d_rendertarget_view_create_from_surface(surface, + NULL, &wined3d_null_parent_ops, &device->auto_depth_stencil_view); + wined3d_surface_decref(surface); + if (FAILED(hr)) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return hr; } + + wined3d_device_set_depth_stencil_view(device, device->auto_depth_stencil_view); + } + + if (device->back_buffer_view) + { + wined3d_rendertarget_view_decref(device->back_buffer_view); + device->back_buffer_view = NULL; + } + if (swapchain->desc.backbuffer_count && FAILED(hr = wined3d_rendertarget_view_create_from_surface( + surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)), + NULL, &wined3d_null_parent_ops, &device->back_buffer_view))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return hr; } if (!swapchain_desc->windowed != !swapchain->desc.windowed @@ -4501,22 +4531,24 @@ device_init_swapchain_state(device, swapchain); } - else + else if (device->back_buffer_view) { - struct wined3d_surface *rt = device->fb.render_targets[0]; + struct wined3d_rendertarget_view *view = device->back_buffer_view; struct wined3d_state *state = &device->state; + wined3d_device_set_rendertarget_view(device, 0, view, FALSE); + /* Note the min_z / max_z is not reset. */ state->viewport.x = 0; state->viewport.y = 0; - state->viewport.width = rt->resource.width; - state->viewport.height = rt->resource.height; + state->viewport.width = view->width; + state->viewport.height = view->height; wined3d_cs_emit_set_viewport(device->cs, &state->viewport); state->scissor_rect.top = 0; state->scissor_rect.left = 0; - state->scissor_rect.right = rt->resource.width; - state->scissor_rect.bottom = rt->resource.height; + state->scissor_rect.right = view->width; + state->scissor_rect.bottom = view->height; wined3d_cs_emit_set_scissor_rect(device->cs, &state->scissor_rect); } @@ -4607,14 +4639,14 @@ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - if (device->fb.render_targets[i] == surface) + if (wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]) == surface) { ERR("Surface %p is still in use as render target %u.\n", surface, i); device->fb.render_targets[i] = NULL; } } - if (device->fb.depth_stencil == surface) + if (wined3d_rendertarget_view_get_surface(device->fb.depth_stencil) == surface) { ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); device->fb.depth_stencil = NULL; diff -Nru wine1.7-1.7.24/dlls/wined3d/directx.c wine1.7-1.7.25/dlls/wined3d/directx.c --- wine1.7-1.7.24/dlls/wined3d/directx.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/directx.c 2014-08-22 18:39:55.000000000 +0000 @@ -88,6 +88,7 @@ WINED3D_D3D_LEVEL_9_SM3, WINED3D_D3D_LEVEL_10, WINED3D_D3D_LEVEL_11, + WINED3D_D3D_LEVEL_COUNT }; /* The d3d device ID */ @@ -409,11 +410,13 @@ } /* Adjust the amount of used texture memory */ -unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount) +UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) { - adapter->UsedTextureRam += amount; - TRACE("Adjusted adapter memory by %d to %d.\n", amount, adapter->UsedTextureRam); - return adapter->UsedTextureRam; + adapter->vram_bytes_used += amount; + TRACE("Adjusted used adapter memory by 0x%s to 0x%s.\n", + wine_dbgstr_longlong(amount), + wine_dbgstr_longlong(adapter->vram_bytes_used)); + return adapter->vram_bytes_used; } static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter) @@ -1321,9 +1324,16 @@ {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6700, "AMD Radeon HD 6700 Series", DRIVER_AMD_R600, 1024}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6800, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600, 1024}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6900, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7660D, "AMD Radeon HD 7660D", DRIVER_AMD_R600, 2048}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7700, "AMD Radeon HD 7700 Series", DRIVER_AMD_R600, 1024}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7800, "AMD Radeon HD 7800 Series", DRIVER_AMD_R600, 2048}, {HW_VENDOR_AMD, CARD_AMD_RADEON_HD7900, "AMD Radeon HD 7900 Series", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD8600M, "AMD Radeon HD 8600M Series", DRIVER_AMD_R600, 1024}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD8670, "AMD Radeon HD 8670", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD8770, "AMD Radeon HD 8770", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_R3, "AMD Radeon HD 8400 / R3 Series", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_R7, "AMD Radeon(TM) R7 Graphics", DRIVER_AMD_R600, 2048}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_R9, "AMD Radeon R9 290", DRIVER_AMD_R600, 4096}, /* VMware */ {HW_VENDOR_VMWARE, CARD_VMWARE_SVGA3D, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE, 1024}, @@ -1498,21 +1508,21 @@ if ((gpu_desc = get_gpu_description(driver_info->vendor, driver_info->device))) { driver_info->description = gpu_desc->description; - driver_info->vidmem = gpu_desc->vidmem * 1024 * 1024; + driver_info->vram_bytes = (UINT64)gpu_desc->vidmem * 1024 * 1024; driver = gpu_desc->driver; } else { ERR("Card %04x:%04x not found in driver DB.\n", vendor, device); driver_info->description = "Direct3D HAL"; - driver_info->vidmem = WINE_DEFAULT_VIDMEM; + driver_info->vram_bytes = WINE_DEFAULT_VIDMEM; driver = DRIVER_UNKNOWN; } if (wined3d_settings.emulated_textureram) { TRACE("Overriding amount of video memory with %u bytes.\n", wined3d_settings.emulated_textureram); - driver_info->vidmem = wined3d_settings.emulated_textureram; + driver_info->vram_bytes = wined3d_settings.emulated_textureram; } /* Try to obtain driver version information for the current Windows version. This fails in @@ -1994,11 +2004,19 @@ * These are returned but not handled: RC410, RV380. */ cards_amd_mesa[] = { + /* Sea Islands */ + {"HAWAII", CARD_AMD_RADEON_R9 }, + {"KAVERI", CARD_AMD_RADEON_R7 }, + {"KABINI", CARD_AMD_RADEON_R3 }, + {"BONAIRE", CARD_AMD_RADEON_HD8770}, /* Southern Islands */ + {"OLAND", CARD_AMD_RADEON_HD8670}, + {"HAINAN", CARD_AMD_RADEON_HD8600M}, {"TAHITI", CARD_AMD_RADEON_HD7900}, {"PITCAIRN", CARD_AMD_RADEON_HD7800}, {"CAPE VERDE", CARD_AMD_RADEON_HD7700}, /* Northern Islands */ + {"ARUBA", CARD_AMD_RADEON_HD7660D}, {"CAYMAN", CARD_AMD_RADEON_HD6900}, {"BARTS", CARD_AMD_RADEON_HD6800}, {"TURKS", CARD_AMD_RADEON_HD6600}, @@ -2173,45 +2191,43 @@ {GL_VENDOR_MESA, "Mesa Intel driver", cards_intel, ARRAY_SIZE(cards_intel)}, }; -static enum wined3d_pci_device select_card_fallback_nvidia(const struct wined3d_gl_info *gl_info) +static const enum wined3d_pci_device +card_fallback_nvidia[] = { - enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info); - if (d3d_level >= WINED3D_D3D_LEVEL_10) - return CARD_NVIDIA_GEFORCE_8800GTX; - if (d3d_level >= WINED3D_D3D_LEVEL_9_SM3) - return CARD_NVIDIA_GEFORCE_6800; - if (d3d_level >= WINED3D_D3D_LEVEL_9_SM2) - return CARD_NVIDIA_GEFORCEFX_5800; - if (d3d_level >= WINED3D_D3D_LEVEL_8) - return CARD_NVIDIA_GEFORCE3; - if (d3d_level >= WINED3D_D3D_LEVEL_7) - return CARD_NVIDIA_GEFORCE; - if (d3d_level >= WINED3D_D3D_LEVEL_6) - return CARD_NVIDIA_RIVA_TNT; - return CARD_NVIDIA_RIVA_128; -} - -static enum wined3d_pci_device select_card_fallback_amd(const struct wined3d_gl_info *gl_info) + CARD_NVIDIA_RIVA_128, /* D3D5 */ + CARD_NVIDIA_RIVA_TNT, /* D3D6 */ + CARD_NVIDIA_GEFORCE, /* D3D7 */ + CARD_NVIDIA_GEFORCE3, /* D3D8 */ + CARD_NVIDIA_GEFORCEFX_5800, /* D3D9_SM2 */ + CARD_NVIDIA_GEFORCE_6800, /* D3D9_SM3 */ + CARD_NVIDIA_GEFORCE_8800GTX, /* D3D10 */ + CARD_NVIDIA_GEFORCE_GTX470, /* D3D11 */ +}, +card_fallback_amd[] = { - enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info); - if (d3d_level >= WINED3D_D3D_LEVEL_10) - return CARD_AMD_RADEON_HD2900; - if (d3d_level >= WINED3D_D3D_LEVEL_9_SM2) - return CARD_AMD_RADEON_9500; - if (d3d_level >= WINED3D_D3D_LEVEL_8) - return CARD_AMD_RADEON_8500; - if (d3d_level >= WINED3D_D3D_LEVEL_7) - return CARD_AMD_RADEON_7200; - return CARD_AMD_RAGE_128PRO; -} - -static enum wined3d_pci_device select_card_fallback_intel(const struct wined3d_gl_info *gl_info) + CARD_AMD_RAGE_128PRO, /* D3D5 */ + CARD_AMD_RAGE_128PRO, /* D3D6 */ + CARD_AMD_RADEON_7200, /* D3D7 */ + CARD_AMD_RADEON_8500, /* D3D8 */ + CARD_AMD_RADEON_9500, /* D3D9_SM2 */ + CARD_AMD_RADEON_X1600, /* D3D9_SM3 */ + CARD_AMD_RADEON_HD2900, /* D3D10 */ + CARD_AMD_RADEON_HD5600, /* D3D11 */ +}, +card_fallback_intel[] = { - enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info); - if (d3d_level >= WINED3D_D3D_LEVEL_10) - return CARD_INTEL_G45; - return CARD_INTEL_915G; -} + CARD_INTEL_915G, /* D3D5 */ + CARD_INTEL_915G, /* D3D6 */ + CARD_INTEL_915G, /* D3D7 */ + CARD_INTEL_915G, /* D3D8 */ + CARD_INTEL_915G, /* D3D9_SM2 */ + CARD_INTEL_915G, /* D3D9_SM3 */ + CARD_INTEL_G45, /* D3D10 */ + CARD_INTEL_IVBD, /* D3D11 */ +}; +C_ASSERT(ARRAY_SIZE(card_fallback_nvidia) == WINED3D_D3D_LEVEL_COUNT); +C_ASSERT(ARRAY_SIZE(card_fallback_amd) == WINED3D_D3D_LEVEL_COUNT); +C_ASSERT(ARRAY_SIZE(card_fallback_intel) == WINED3D_D3D_LEVEL_COUNT); static enum wined3d_pci_device select_card_handler(const struct gl_vendor_selection *table, unsigned int table_size, enum wined3d_gl_vendor gl_vendor, const char *gl_renderer) @@ -2244,22 +2260,22 @@ const char *description; /* Description of the card selector i.e. Apple OS/X Intel */ const struct gl_vendor_selection *gl_vendor_selection; unsigned int gl_vendor_count; - enum wined3d_pci_device (*select_card_fallback)(const struct wined3d_gl_info *gl_info); + const enum wined3d_pci_device *card_fallback; /* An array with D3D_LEVEL_COUNT elements */ } card_vendor_table[] = { {HW_VENDOR_AMD, "AMD", amd_gl_vendor_table, sizeof(amd_gl_vendor_table) / sizeof(*amd_gl_vendor_table), - select_card_fallback_amd}, + card_fallback_amd}, {HW_VENDOR_NVIDIA, "Nvidia", nvidia_gl_vendor_table, sizeof(nvidia_gl_vendor_table) / sizeof(*nvidia_gl_vendor_table), - select_card_fallback_nvidia}, + card_fallback_nvidia}, {HW_VENDOR_VMWARE, "VMware", vmware_gl_vendor_table, sizeof(vmware_gl_vendor_table) / sizeof(*vmware_gl_vendor_table), - select_card_fallback_amd}, + card_fallback_amd}, {HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table, sizeof(intel_gl_vendor_table) / sizeof(*intel_gl_vendor_table), - select_card_fallback_intel}, + card_fallback_intel}, }; @@ -2317,6 +2333,7 @@ * memory can be overruled using a registry setting. */ unsigned int i; + enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info); enum wined3d_pci_device device; for (i = 0; i < (sizeof(card_vendor_table) / sizeof(*card_vendor_table)); ++i) @@ -2331,7 +2348,7 @@ return device; TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer)); - return card_vendor_table[i].select_card_fallback(gl_info); + return card_vendor_table[i].card_fallback[d3d_level]; } FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n", @@ -2339,7 +2356,7 @@ /* Default to generic Nvidia hardware based on the supported OpenGL extensions. */ *card_vendor = HW_VENDOR_NVIDIA; - return select_card_fallback_nvidia(gl_info); + return card_fallback_nvidia[d3d_level]; } static const struct wined3d_vertex_pipe_ops *select_vertex_implementation(const struct wined3d_gl_info *gl_info, @@ -3401,7 +3418,7 @@ memcpy(&identifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(identifier->device_identifier)); identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1; memcpy(&identifier->adapter_luid, &adapter->luid, sizeof(identifier->adapter_luid)); - identifier->video_memory = adapter->TextureRam; + identifier->video_memory = min(~(SIZE_T)0, adapter->vram_bytes); return WINED3D_OK; } @@ -5104,9 +5121,9 @@ return FALSE; } - adapter->TextureRam = adapter->driver_info.vidmem; - adapter->UsedTextureRam = 0; - TRACE("Emulating %u MB of texture ram.\n", adapter->TextureRam / (1024 * 1024)); + adapter->vram_bytes = adapter->driver_info.vram_bytes; + adapter->vram_bytes_used = 0; + TRACE("Emulating 0x%s bytes of video ram.\n", wine_dbgstr_longlong(adapter->vram_bytes)); display_device.cb = sizeof(display_device); EnumDisplayDevicesW(NULL, ordinal, &display_device, 0); @@ -5132,9 +5149,9 @@ adapter->driver_info.name = "Display"; adapter->driver_info.description = "WineD3D DirectDraw Emulation"; if (wined3d_settings.emulated_textureram) - adapter->TextureRam = wined3d_settings.emulated_textureram; + adapter->vram_bytes = wined3d_settings.emulated_textureram; else - adapter->TextureRam = 128 * 1024 * 1024; + adapter->vram_bytes = 128 * 1024 * 1024; initPixelFormatsNoGL(&adapter->gl_info); diff -Nru wine1.7-1.7.24/dlls/wined3d/drawprim.c wine1.7-1.7.25/dlls/wined3d/drawprim.c --- wine1.7-1.7.24/dlls/wined3d/drawprim.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/drawprim.c 2014-08-22 18:39:55.000000000 +0000 @@ -613,16 +613,16 @@ /* Invalidate the back buffer memory so LockRect will read it the next time */ for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - struct wined3d_surface *target = device->fb.render_targets[i]; + struct wined3d_surface *target = wined3d_rendertarget_view_get_surface(device->fb.render_targets[i]); if (target) { - surface_load_location(target, target->resource.draw_binding); - surface_invalidate_location(target, ~target->resource.draw_binding); + surface_load_location(target, target->container->resource.draw_binding); + surface_invalidate_location(target, ~target->container->resource.draw_binding); } } } - context = context_acquire(device, device->fb.render_targets[0]); + context = context_acquire(device, wined3d_rendertarget_view_get_surface(device->fb.render_targets[0])); if (!context->valid) { context_release(context); @@ -638,11 +638,11 @@ * Z-compare function into account, but we could skip loading the * depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note * that we never copy the stencil data.*/ - DWORD location = context->render_offscreen ? - device->fb.depth_stencil->resource.draw_binding : WINED3D_LOCATION_DRAWABLE; + DWORD location = context->render_offscreen ? device->fb.depth_stencil->resource->draw_binding + : WINED3D_LOCATION_DRAWABLE; if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE]) { - struct wined3d_surface *ds = device->fb.depth_stencil; + struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); RECT current_rect, draw_rect, r; if (!context->render_offscreen && ds != device->onscreen_depth_stencil) @@ -670,8 +670,8 @@ if (device->fb.depth_stencil && state->render_states[WINED3D_RS_ZWRITEENABLE]) { - struct wined3d_surface *ds = device->fb.depth_stencil; - DWORD location = context->render_offscreen ? ds->resource.draw_binding : WINED3D_LOCATION_DRAWABLE; + struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(device->fb.depth_stencil); + DWORD location = context->render_offscreen ? ds->container->resource.draw_binding : WINED3D_LOCATION_DRAWABLE; surface_modify_ds_location(ds, location, ds->ds_current_size.cx, ds->ds_current_size.cy); } diff -Nru wine1.7-1.7.24/dlls/wined3d/glsl_shader.c wine1.7-1.7.25/dlls/wined3d/glsl_shader.c --- wine1.7-1.7.24/dlls/wined3d/glsl_shader.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/glsl_shader.c 2014-08-22 18:39:55.000000000 +0000 @@ -1257,7 +1257,7 @@ { float ycorrection[] = { - context->render_offscreen ? 0.0f : fb->render_targets[0]->resource.height, + context->render_offscreen ? 0.0f : fb->render_targets[0]->height, context->render_offscreen ? 1.0f : -1.0f, 0.0f, 0.0f, diff -Nru wine1.7-1.7.24/dlls/wined3d/resource.c wine1.7-1.7.25/dlls/wined3d/resource.c --- wine1.7-1.7.24/dlls/wined3d/resource.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/resource.c 2014-08-22 18:39:55.000000000 +0000 @@ -299,3 +299,37 @@ return GL_WRITE_ONLY_ARB; return GL_READ_WRITE_ARB; } + +BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) +{ + struct wined3d_swapchain *swapchain; + + if (resource->type == WINED3D_RTYPE_SURFACE) + resource = &surface_from_resource(resource)->container->resource; + + /* Only texture resources can be onscreen. */ + if (resource->type != WINED3D_RTYPE_TEXTURE) + return TRUE; + + /* Not on a swapchain - must be offscreen */ + if (!(swapchain = wined3d_texture_from_resource(resource)->swapchain)) + return TRUE; + + /* The front buffer is always onscreen */ + if (resource == &swapchain->front_buffer->resource) + return FALSE; + + /* If the swapchain is rendered to an FBO, the backbuffer is + * offscreen, otherwise onscreen */ + return swapchain->render_to_fbo; +} + +void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) +{ + if (!wined3d_resource_is_offscreen(resource) || wined3d_settings.offscreen_rendering_mode != ORM_FBO) + resource->draw_binding = WINED3D_LOCATION_DRAWABLE; + else if (resource->multisample_type) + resource->draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE; + else + resource->draw_binding = WINED3D_LOCATION_TEXTURE_RGB; +} diff -Nru wine1.7-1.7.24/dlls/wined3d/shader.c wine1.7-1.7.25/dlls/wined3d/shader.c --- wine1.7-1.7.24/dlls/wined3d/shader.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/shader.c 2014-08-22 18:39:55.000000000 +0000 @@ -2036,8 +2036,8 @@ memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE]) { - const struct wined3d_surface *rt = state->fb->render_targets[0]; - if (rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; + if (rt_format->flags & WINED3DFMT_FLAG_SRGB_WRITE) { static unsigned int warned = 0; diff -Nru wine1.7-1.7.24/dlls/wined3d/state.c wine1.7-1.7.25/dlls/wined3d/state.c --- wine1.7-1.7.24/dlls/wined3d/state.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/state.c 2014-08-22 18:39:55.000000000 +0000 @@ -381,7 +381,7 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_surface *target = state->fb->render_targets[0]; + const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; const struct wined3d_gl_info *gl_info = context->gl_info; GLenum srcBlend, dstBlend; enum wined3d_blend d3d_blend; @@ -395,8 +395,7 @@ /* Disable blending in all cases even without pixelshaders. * With blending on we could face a big performance penalty. * The d3d9 visual test confirms the behavior. */ - if (context->render_offscreen - && !(target->resource.format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) + if (context->render_offscreen && !(rt_format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { gl_info->gl_ops.gl.p_glDisable(GL_BLEND); checkGLcall("glDisable GL_BLEND"); @@ -432,9 +431,8 @@ } else { - srcBlend = gl_blend_factor(d3d_blend, target->resource.format); - dstBlend = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLEND], - target->resource.format); + srcBlend = gl_blend_factor(d3d_blend, rt_format); + dstBlend = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLEND], rt_format); } if (state->render_states[WINED3D_RS_EDGEANTIALIAS] @@ -484,9 +482,8 @@ } else { - srcBlendAlpha = gl_blend_factor(d3d_blend, target->resource.format); - dstBlendAlpha = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLENDALPHA], - target->resource.format); + srcBlendAlpha = gl_blend_factor(d3d_blend, rt_format); + dstBlendAlpha = gl_blend_factor(state->render_states[WINED3D_RS_DESTBLENDALPHA], rt_format); } GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend, dstBlend, srcBlendAlpha, dstBlendAlpha)); @@ -1768,7 +1765,7 @@ if (state->render_states[WINED3D_RS_SLOPESCALEDEPTHBIAS] || state->render_states[WINED3D_RS_DEPTHBIAS]) { - const struct wined3d_surface *depth = state->fb->depth_stencil; + const struct wined3d_rendertarget_view *depth = state->fb->depth_stencil; float scale; union @@ -1793,7 +1790,7 @@ { if (depth) { - const struct wined3d_format *fmt = depth->resource.format; + const struct wined3d_format *fmt = depth->format; scale = powf(2, fmt->depth_size) - 1; TRACE("Depth format %s, using depthbias scale of %.8e.\n", debug_d3dformat(fmt->id), scale); @@ -4637,14 +4634,14 @@ static void viewport_miscpart(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_surface *target = state->fb->render_targets[0]; + const struct wined3d_rendertarget_view *target = state->fb->render_targets[0]; const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp = state->viewport; - if (vp.width > target->resource.width) - vp.width = target->resource.width; - if (vp.height > target->resource.height) - vp.height = target->resource.height; + if (vp.width > target->width) + vp.width = target->width; + if (vp.height > target->height) + vp.height = target->height; gl_info->gl_ops.gl.p_glDepthRange(vp.min_z, vp.max_z); checkGLcall("glDepthRange"); @@ -4658,7 +4655,7 @@ { UINT width, height; - surface_get_drawable_size(target, context, &width, &height); + surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height); gl_info->gl_ops.gl.p_glViewport(vp.x, (height - (vp.y + vp.height)), vp.width, vp.height); } @@ -4817,11 +4814,11 @@ } else { - const struct wined3d_surface *target = state->fb->render_targets[0]; + const struct wined3d_rendertarget_view *target = state->fb->render_targets[0]; UINT height; UINT width; - surface_get_drawable_size(target, context, &width, &height); + surface_get_drawable_size(wined3d_rendertarget_view_get_surface(target), context, &width, &height); gl_info->gl_ops.gl.p_glScissor(r->left, height - r->bottom, r->right - r->left, r->bottom - r->top); } checkGLcall("glScissor"); @@ -4884,13 +4881,13 @@ void state_srgbwrite(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { + const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; const struct wined3d_gl_info *gl_info = context->gl_info; - const struct wined3d_surface *rt = state->fb->render_targets[0]; TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); if (state->render_states[WINED3D_RS_SRGBWRITEENABLE] - && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + && rt_format->flags & WINED3DFMT_FLAG_SRGB_WRITE) gl_info->gl_ops.gl.p_glEnable(GL_FRAMEBUFFER_SRGB); else gl_info->gl_ops.gl.p_glDisable(GL_FRAMEBUFFER_SRGB); diff -Nru wine1.7-1.7.24/dlls/wined3d/surface.c wine1.7-1.7.25/dlls/wined3d/surface.c --- wine1.7-1.7.24/dlls/wined3d/surface.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/surface.c 2014-08-22 18:39:55.000000000 +0000 @@ -103,20 +103,19 @@ resource_cleanup(&surface->resource); } -void surface_update_draw_binding(struct wined3d_surface *surface) +void wined3d_surface_destroy(struct wined3d_surface *surface) { - if (!surface_is_offscreen(surface) || wined3d_settings.offscreen_rendering_mode != ORM_FBO) - surface->resource.draw_binding = WINED3D_LOCATION_DRAWABLE; - else if (surface->resource.multisample_type) - surface->resource.draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE; - else - surface->resource.draw_binding = WINED3D_LOCATION_TEXTURE_RGB; + TRACE("surface %p.\n", surface); + + surface_cleanup(surface); + surface->resource.parent_ops->wined3d_object_destroyed(surface->resource.parent); + HeapFree(GetProcessHeap(), 0, surface); } void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, unsigned int *width, unsigned int *height) { - if (surface->swapchain) + if (surface->container->swapchain) { /* The drawable size of an onscreen drawable is the surface size. * (Actually: The window size, but the surface is created in window @@ -143,22 +142,6 @@ } } -void surface_set_swapchain(struct wined3d_surface *surface, struct wined3d_swapchain *swapchain) -{ - TRACE("surface %p, swapchain %p.\n", surface, swapchain); - - surface->swapchain = swapchain; - surface_update_draw_binding(surface); -} - -void surface_set_container(struct wined3d_surface *surface, struct wined3d_texture *container) -{ - TRACE("surface %p, container %p.\n", surface, container); - - surface->container = container; - surface_update_draw_binding(surface); -} - struct blt_info { GLenum binding; @@ -577,7 +560,7 @@ void surface_prepare_map_memory(struct wined3d_surface *surface) { - switch (surface->map_binding) + switch (surface->resource.map_binding) { case WINED3D_LOCATION_SYSMEM: surface_prepare_system_memory(surface); @@ -598,7 +581,7 @@ break; default: - ERR("Unexpected map binding %s.\n", wined3d_debug_location(surface->map_binding)); + ERR("Unexpected map binding %s.\n", wined3d_debug_location(surface->resource.map_binding)); } } @@ -723,7 +706,7 @@ surface->locations = WINED3D_LOCATION_DISCARDED; if (surface_use_pbo(surface)) - surface->map_binding = WINED3D_LOCATION_BUFFER; + surface->resource.map_binding = WINED3D_LOCATION_BUFFER; return WINED3D_OK; } @@ -738,7 +721,7 @@ memset(&surface->lockedRect, 0, sizeof(surface->lockedRect)); - switch (surface->map_binding) + switch (surface->resource.map_binding) { case WINED3D_LOCATION_SYSMEM: case WINED3D_LOCATION_USER_MEMORY: @@ -757,7 +740,7 @@ break; default: - ERR("Unexpected map binding %s.\n", wined3d_debug_location(surface->map_binding)); + ERR("Unexpected map binding %s.\n", wined3d_debug_location(surface->resource.map_binding)); } if (surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)) @@ -766,8 +749,8 @@ return; } - if (surface->swapchain && surface->swapchain->front_buffer == surface) - surface_load_location(surface, surface->resource.draw_binding); + if (surface->container->swapchain && surface->container->swapchain->front_buffer == surface->container) + surface_load_location(surface, surface->container->resource.draw_binding); else if (surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) FIXME("Depth / stencil buffer locking is not implemented.\n"); } @@ -985,7 +968,7 @@ if (wined3d_settings.strict_draw_ordering || (dst_location == WINED3D_LOCATION_DRAWABLE - && dst_surface->swapchain->front_buffer == dst_surface)) + && dst_surface->container->swapchain->front_buffer == dst_surface->container)) gl_info->gl_ops.gl.p_glFlush(); context_release(context); @@ -1039,7 +1022,7 @@ switch (format->id) { case WINED3DFMT_P8_UINT: - palette = surface->swapchain ? surface->swapchain->palette : NULL; + palette = surface->container->swapchain ? surface->container->swapchain->palette : NULL; if (palette) { @@ -1175,6 +1158,16 @@ surface_invalidate_location(surface, WINED3D_LOCATION_BUFFER); } +static ULONG surface_resource_incref(struct wined3d_resource *resource) +{ + return wined3d_surface_incref(surface_from_resource(resource)); +} + +static ULONG surface_resource_decref(struct wined3d_resource *resource) +{ + return wined3d_surface_decref(surface_from_resource(resource)); +} + static void surface_unload(struct wined3d_resource *resource) { struct wined3d_surface *surface = surface_from_resource(resource); @@ -1210,8 +1203,8 @@ else { surface_prepare_map_memory(surface); - surface_load_location(surface, surface->map_binding); - surface_invalidate_location(surface, ~surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); + surface_invalidate_location(surface, ~surface->resource.map_binding); } surface->flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); @@ -1253,6 +1246,8 @@ static const struct wined3d_resource_ops surface_resource_ops = { + surface_resource_incref, + surface_resource_decref, surface_unload, }; @@ -1294,7 +1289,7 @@ hr = surface_create_dib_section(surface); if (FAILED(hr)) return hr; - surface->map_binding = WINED3D_LOCATION_DIB; + surface->resource.map_binding = WINED3D_LOCATION_DIB; /* We don't mind the nonpow2 stuff in GDI. */ surface->pow2Width = surface->resource.width; @@ -1308,8 +1303,8 @@ TRACE("surface %p.\n", surface); /* Tell the swapchain to update the screen. */ - if (surface->swapchain && surface == surface->swapchain->front_buffer) - x11_copy_to_screen(surface->swapchain, &surface->lockedRect); + if (surface->container->swapchain && surface->container == surface->container->swapchain->front_buffer) + x11_copy_to_screen(surface->container->swapchain, &surface->lockedRect); memset(&surface->lockedRect, 0, sizeof(RECT)); } @@ -1515,7 +1510,8 @@ if (srgb) internal = format->glGammaInternal; - else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface)) + else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET + && wined3d_resource_is_offscreen(&surface->resource)) internal = format->rtInternal; else internal = format->glInternal; @@ -1622,7 +1618,8 @@ * in which the main render target uses p8. Some games like GTA Vice City use P8 for texturing which * conflicts with this. */ - if (!((blit_supported && surface->swapchain && surface == surface->swapchain->front_buffer)) + if (!((blit_supported && surface->container->swapchain + && surface->container == surface->container->swapchain->front_buffer)) || colorkey_active || !use_texturing) { format->glFormat = GL_RGBA; @@ -1857,17 +1854,12 @@ GLenum internal; if (srgb) - { internal = format->glGammaInternal; - } - else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface)) - { + else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET + && wined3d_resource_is_offscreen(&surface->resource)) internal = format->rtInternal; - } else - { internal = format->glInternal; - } if (!internal) FIXME("No GL internal format for format %s.\n", debug_d3dformat(format->id)); @@ -1995,7 +1987,7 @@ GLenum surface_get_gl_buffer(const struct wined3d_surface *surface) { - const struct wined3d_swapchain *swapchain = surface->swapchain; + const struct wined3d_swapchain *swapchain = surface->container->swapchain; TRACE("surface %p.\n", surface); @@ -2005,7 +1997,7 @@ return GL_NONE; } - if (swapchain->back_buffers && swapchain->back_buffers[0] == surface) + if (swapchain->back_buffers && swapchain->back_buffers[0] == surface->container) { if (swapchain->render_to_fbo) { @@ -2015,7 +2007,7 @@ TRACE("Returning GL_BACK\n"); return GL_BACK; } - else if (surface == swapchain->front_buffer) + else if (surface->container == swapchain->front_buffer) { TRACE("Returning GL_FRONT\n"); return GL_FRONT; @@ -2050,8 +2042,8 @@ * the surface. Make sure we have it. */ surface_prepare_map_memory(surface); - surface_load_location(surface, surface->map_binding); - surface_invalidate_location(surface, ~surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); + surface_invalidate_location(surface, ~surface->resource.map_binding); /* Switching color keying on / off may change the internal format. */ if (ck_changed) surface_force_reload(surface); @@ -2135,49 +2127,16 @@ ULONG CDECL wined3d_surface_incref(struct wined3d_surface *surface) { - ULONG refcount; - - TRACE("surface %p, swapchain %p, container %p.\n", - surface, surface->swapchain, surface->container); - - if (surface->swapchain) - return wined3d_swapchain_incref(surface->swapchain); - - if (surface->container) - return wined3d_texture_incref(surface->container); + TRACE("surface %p, container %p.\n", surface, surface->container); - refcount = InterlockedIncrement(&surface->resource.ref); - TRACE("%p increasing refcount to %u.\n", surface, refcount); - - return refcount; + return wined3d_texture_incref(surface->container); } ULONG CDECL wined3d_surface_decref(struct wined3d_surface *surface) { - ULONG refcount; - - TRACE("surface %p, swapchain %p, container %p.\n", - surface, surface->swapchain, surface->container); - - if (surface->swapchain) - return wined3d_swapchain_decref(surface->swapchain); + TRACE("surface %p, container %p.\n", surface, surface->container); - if (surface->container) - return wined3d_texture_decref(surface->container); - - refcount = InterlockedDecrement(&surface->resource.ref); - TRACE("%p decreasing refcount to %u.\n", surface, refcount); - - if (!refcount) - { - surface_cleanup(surface); - surface->resource.parent_ops->wined3d_object_destroyed(surface->resource.parent); - - TRACE("Destroyed surface %p.\n", surface); - HeapFree(GetProcessHeap(), 0, surface); - } - - return refcount; + return wined3d_texture_decref(surface->container); } void CDECL wined3d_surface_preload(struct wined3d_surface *surface) @@ -2413,6 +2372,7 @@ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); UINT resource_size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, 1); + struct wined3d_texture *texture; BOOL create_dib = FALSE; HRESULT hr; DWORD valid_location = 0; @@ -2470,7 +2430,7 @@ surface->user_memory = mem; if (surface->user_memory) { - surface->map_binding = WINED3D_LOCATION_USER_MEMORY; + surface->resource.map_binding = WINED3D_LOCATION_USER_MEMORY; valid_location = WINED3D_LOCATION_USER_MEMORY; } surface->pitch = pitch; @@ -2486,8 +2446,15 @@ * If the surface didn't use PBOs previously but could now, don't * change it - whatever made us not use PBOs might come back, e.g. * color keys. */ - if (surface->map_binding == WINED3D_LOCATION_BUFFER && !surface_use_pbo(surface)) - surface->map_binding = create_dib ? WINED3D_LOCATION_DIB : WINED3D_LOCATION_SYSMEM; + if (surface->resource.map_binding == WINED3D_LOCATION_BUFFER && !surface_use_pbo(surface)) + surface->resource.map_binding = create_dib ? WINED3D_LOCATION_DIB : WINED3D_LOCATION_SYSMEM; + + texture = surface->container; + texture->resource.format = format; + texture->resource.multisample_type = multisample_type; + texture->resource.multisample_quality = multisample_quality; + texture->resource.width = width; + texture->resource.height = height; if (create_dib) { @@ -2882,7 +2849,7 @@ * mapped regularly do not throw away the system memory copy. This avoids * the need to download the surface from OpenGL all the time. The surface * is still downloaded if the OpenGL texture is changed. */ - if (!(surface->flags & SFLAG_DYNLOCK) && surface->map_binding == WINED3D_LOCATION_SYSMEM) + if (!(surface->flags & SFLAG_DYNLOCK) && surface->resource.map_binding == WINED3D_LOCATION_SYSMEM) { if (++surface->lockCount > MAXLOCKCOUNT) { @@ -2895,21 +2862,21 @@ if (flags & WINED3D_MAP_DISCARD) { TRACE("WINED3D_MAP_DISCARD flag passed, marking %s as up to date.\n", - wined3d_debug_location(surface->map_binding)); - surface_validate_location(surface, surface->map_binding); + wined3d_debug_location(surface->resource.map_binding)); + surface_validate_location(surface, surface->resource.map_binding); } else { if (surface->resource.usage & WINED3DUSAGE_DYNAMIC) WARN_(d3d_perf)("Mapping a dynamic surface without WINED3D_MAP_DISCARD.\n"); - surface_load_location(surface, surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); } if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY))) - surface_invalidate_location(surface, ~surface->map_binding); + surface_invalidate_location(surface, ~surface->resource.map_binding); - switch (surface->map_binding) + switch (surface->resource.map_binding) { case WINED3D_LOCATION_SYSMEM: base_memory = surface->resource.heap_memory; @@ -2936,7 +2903,7 @@ break; default: - ERR("Unexpected map binding %s.\n", wined3d_debug_location(surface->map_binding)); + ERR("Unexpected map binding %s.\n", wined3d_debug_location(surface->resource.map_binding)); base_memory = NULL; } @@ -3007,10 +2974,10 @@ hr = surface_create_dib_section(surface); if (FAILED(hr)) return WINED3DERR_INVALIDCALL; - if (!(surface->map_binding == WINED3D_LOCATION_USER_MEMORY + if (!(surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY || surface->flags & SFLAG_PIN_SYSMEM || surface->pbo)) - surface->map_binding = WINED3D_LOCATION_DIB; + surface->resource.map_binding = WINED3D_LOCATION_DIB; } surface_load_location(surface, WINED3D_LOCATION_DIB); @@ -3042,8 +3009,8 @@ surface->resource.map_count--; surface->flags &= ~SFLAG_DCINUSE; - if (surface->map_binding == WINED3D_LOCATION_USER_MEMORY || (surface->flags & SFLAG_PIN_SYSMEM - && surface->map_binding != WINED3D_LOCATION_DIB)) + if (surface->resource.map_binding == WINED3D_LOCATION_USER_MEMORY || (surface->flags & SFLAG_PIN_SYSMEM + && surface->resource.map_binding != WINED3D_LOCATION_DIB)) { /* The game Salammbo modifies the surface contents without mapping the surface between * a GetDC/ReleaseDC operation and flipping the surface. If the DIB remains the active @@ -3052,7 +3019,7 @@ * copied back to the DIB in the next getdc call. * * The same consideration applies to user memory surfaces. */ - surface_load_location(surface, surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); surface_invalidate_location(surface, WINED3D_LOCATION_DIB); } @@ -3080,7 +3047,7 @@ * There is no need to keep track of the current read buffer or reset it, every part of the code * that reads sets the read buffer as desired. */ - if (surface_is_offscreen(surface)) + if (wined3d_resource_is_offscreen(&surface->resource)) { /* Mapping the primary render target which is not on a swapchain. * Read from the back buffer. */ @@ -3179,7 +3146,7 @@ TRACE("Reading back offscreen render target %p.\n", surface); - if (surface_is_offscreen(surface)) + if (wined3d_resource_is_offscreen(&surface->resource)) gl_info->gl_ops.gl.p_glReadBuffer(device->offscreenBuffer); else gl_info->gl_ops.gl.p_glReadBuffer(surface_get_gl_buffer(surface)); @@ -3282,10 +3249,10 @@ } case WINED3D_CT_PALETTED: - if (surface->swapchain && surface->swapchain->palette) + if (surface->container->swapchain && surface->container->swapchain->palette) { unsigned int x, y; - const struct wined3d_palette *palette = surface->swapchain->palette; + const struct wined3d_palette *palette = surface->container->swapchain->palette; for (y = 0; y < height; y++) { source = src + pitch * y; @@ -3546,7 +3513,7 @@ /* Bind the target texture */ context_bind_texture(context, dst_surface->container->target, dst_surface->container->texture_rgb.name); - if (surface_is_offscreen(src_surface)) + if (wined3d_resource_is_offscreen(&src_surface->resource)) { TRACE("Reading from an offscreen target\n"); upsidedown = !upsidedown; @@ -3652,7 +3619,7 @@ context_apply_blit_state(context, device); wined3d_texture_load(dst_surface->container, context, FALSE); - src_offscreen = surface_is_offscreen(src_surface); + src_offscreen = wined3d_resource_is_offscreen(&src_surface->resource); noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO; if (!noBackBufferBackup && !src_surface->container->texture_rgb.name) { @@ -3729,7 +3696,8 @@ wined3d_gl_min_mip_filter(minMipLookup, filter, WINED3D_TEXF_NONE)); checkGLcall("glTexParameteri"); - if (!src_surface->swapchain || src_surface == src_surface->swapchain->back_buffers[0]) + if (!src_surface->container->swapchain + || src_surface->container == src_surface->container->swapchain->back_buffers[0]) { src = backup ? backup : src_surface->container->texture_rgb.name; } @@ -3908,7 +3876,7 @@ { UINT drawable_height; - if (surface->swapchain && surface == surface->swapchain->front_buffer) + if (surface->container->swapchain && surface->container == surface->container->swapchain->front_buffer) { POINT offset = {0, 0}; RECT windowsize; @@ -3951,7 +3919,7 @@ /* Activate the destination context, set it up for blitting */ context_apply_blit_state(context, device); - if (!surface_is_offscreen(dst_surface)) + if (!wined3d_resource_is_offscreen(&dst_surface->resource)) surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect); device->blitter->set_shader(device->blit_priv, context, src_surface); @@ -3989,7 +3957,8 @@ device->blitter->unset_shader(context->gl_info); if (wined3d_settings.strict_draw_ordering - || (dst_surface->swapchain && dst_surface->swapchain->front_buffer == dst_surface)) + || (dst_surface->container->swapchain + && dst_surface->container->swapchain->front_buffer == dst_surface->container)) gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); @@ -4016,6 +3985,7 @@ enum wined3d_texture_filter_type filter) { struct wined3d_device *device = dst_surface->resource.device; + const struct wined3d_surface *rt = wined3d_rendertarget_view_get_surface(device->fb.render_targets[0]); const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct wined3d_swapchain *src_swapchain, *dst_swapchain; @@ -4030,7 +4000,7 @@ return WINED3DERR_INVALIDCALL; } - dst_swapchain = dst_surface->swapchain; + dst_swapchain = dst_surface->container->swapchain; if (src_surface) { @@ -4040,7 +4010,7 @@ return WINED3DERR_INVALIDCALL; } - src_swapchain = src_surface->swapchain; + src_swapchain = src_surface->container->swapchain; } else { @@ -4048,9 +4018,7 @@ } /* Early sort out of cases where no render target is used */ - if (!dst_swapchain && !src_swapchain - && src_surface != device->fb.render_targets[0] - && dst_surface != device->fb.render_targets[0]) + if (!dst_swapchain && !src_swapchain && src_surface != rt && dst_surface != rt) { TRACE("No surface is render target, not using hardware blit.\n"); return WINED3DERR_INVALIDCALL; @@ -4079,16 +4047,16 @@ if (dst_swapchain) { /* Handled with regular texture -> swapchain blit */ - if (src_surface == device->fb.render_targets[0]) + if (src_surface == rt) TRACE("Blit from active render target to a swapchain\n"); } - else if (src_swapchain && dst_surface == device->fb.render_targets[0]) + else if (src_swapchain && dst_surface == rt) { FIXME("Implement blit from a swapchain to the active render target\n"); return WINED3DERR_INVALIDCALL; } - if ((src_swapchain || src_surface == device->fb.render_targets[0]) && !dst_swapchain) + if ((src_swapchain || src_surface == rt) && !dst_swapchain) { /* Blit from render target to texture */ BOOL stretchx; @@ -4186,8 +4154,8 @@ src_surface->container->color_key_flags = old_color_key_flags; src_surface->container->src_blt_color_key = old_blt_key; - surface_validate_location(dst_surface, dst_surface->resource.draw_binding); - surface_invalidate_location(dst_surface, ~dst_surface->resource.draw_binding); + surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding); + surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding); return WINED3D_OK; } @@ -4362,7 +4330,8 @@ /* Note that we use depth_blt here as well, rather than glCopyTexImage2D * directly on the FBO texture. That's because we need to flip. */ context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, - context->swapchain->front_buffer, NULL, WINED3D_LOCATION_DRAWABLE); + surface_from_resource(wined3d_texture_get_sub_resource(context->swapchain->front_buffer, 0)), + NULL, WINED3D_LOCATION_DRAWABLE); if (surface->texture_target == GL_TEXTURE_RECTANGLE_ARB) { gl_info->gl_ops.gl.p_glGetIntegerv(GL_TEXTURE_BINDING_RECTANGLE_ARB, &old_binding); @@ -4408,7 +4377,8 @@ TRACE("Copying depth texture to onscreen depth buffer.\n"); context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, - context->swapchain->front_buffer, NULL, WINED3D_LOCATION_DRAWABLE); + surface_from_resource(wined3d_texture_get_sub_resource(context->swapchain->front_buffer, 0)), + NULL, WINED3D_LOCATION_DRAWABLE); surface_depth_blt(surface, context, surface->container->texture_rgb.name, 0, surface->pow2Height - h, w, h, surface->texture_target); checkGLcall("depth_blt"); @@ -4551,7 +4521,8 @@ { RECT r; - if (wined3d_settings.offscreen_rendering_mode == ORM_FBO && surface_is_offscreen(surface)) + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO + && wined3d_resource_is_offscreen(&surface->resource)) { ERR("Trying to load offscreen surface into WINED3D_LOCATION_DRAWABLE.\n"); return WINED3DERR_INVALIDCALL; @@ -4579,7 +4550,7 @@ BYTE *mem = NULL; if (wined3d_settings.offscreen_rendering_mode != ORM_FBO - && surface_is_offscreen(surface) + && wined3d_resource_is_offscreen(&surface->resource) && (surface->locations & WINED3D_LOCATION_DRAWABLE)) { surface_load_fb_texture(surface, srgb); @@ -4627,24 +4598,24 @@ if (srgb) { - if ((surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->map_binding)) + if ((surface->locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding)) == WINED3D_LOCATION_TEXTURE_RGB) { /* Performance warning... */ FIXME("Downloading RGB surface %p to reload it as sRGB.\n", surface); surface_prepare_map_memory(surface); - surface_load_location(surface, surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); } } else { - if ((surface->locations & (WINED3D_LOCATION_TEXTURE_SRGB | surface->map_binding)) + if ((surface->locations & (WINED3D_LOCATION_TEXTURE_SRGB | surface->resource.map_binding)) == WINED3D_LOCATION_TEXTURE_SRGB) { /* Performance warning... */ FIXME("Downloading sRGB surface %p to reload it as RGB.\n", surface); surface_prepare_map_memory(surface); - surface_load_location(surface, surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); } } @@ -4680,12 +4651,12 @@ TRACE("Removing the pbo attached to surface %p.\n", surface); if (surface->flags & SFLAG_DIBSECTION) - surface->map_binding = WINED3D_LOCATION_DIB; + surface->resource.map_binding = WINED3D_LOCATION_DIB; else - surface->map_binding = WINED3D_LOCATION_SYSMEM; + surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; surface_prepare_map_memory(surface); - surface_load_location(surface, surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); surface_remove_pbo(surface, gl_info); } @@ -4772,7 +4743,8 @@ context_release(context); return WINED3D_OK; } - else if (location & surface->locations && surface->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) + else if (location & surface->locations + && surface->container->resource.draw_binding != WINED3D_LOCATION_DRAWABLE) { /* Already up to date, nothing to do. */ return WINED3D_OK; @@ -4843,22 +4815,6 @@ return WINED3D_OK; } -BOOL surface_is_offscreen(const struct wined3d_surface *surface) -{ - struct wined3d_swapchain *swapchain; - - /* Not on a swapchain - must be offscreen */ - if (!(swapchain = surface->swapchain)) - return TRUE; - - /* The front buffer is always onscreen */ - if (surface == swapchain->front_buffer) return FALSE; - - /* If the swapchain is rendered to an FBO, the backbuffer is - * offscreen, otherwise onscreen */ - return swapchain->render_to_fbo; -} - static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } /* Context activation is done by the caller. */ static void ffp_blit_free(struct wined3d_device *device) { } @@ -4950,20 +4906,39 @@ const RECT *dst_rect, const struct wined3d_color *color) { const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; - struct wined3d_fb_state fb = {&dst_surface, NULL}; + struct wined3d_rendertarget_view *view; + struct wined3d_fb_state fb = {&view, NULL}; + HRESULT hr; + + if (FAILED(hr = wined3d_rendertarget_view_create_from_surface(dst_surface, + NULL, &wined3d_null_parent_ops, &view))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return hr; + } device_clear_render_targets(device, 1, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0); + wined3d_rendertarget_view_decref(view); return WINED3D_OK; } -static HRESULT ffp_blit_depth_fill(struct wined3d_device *device, - struct wined3d_surface *surface, const RECT *rect, float depth) +static HRESULT ffp_blit_depth_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface, + const RECT *dst_rect, float depth) { - const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height}; - struct wined3d_fb_state fb = {NULL, surface}; + const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; + struct wined3d_fb_state fb = {NULL, NULL}; + HRESULT hr; - device_clear_render_targets(device, 0, &fb, 1, rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0); + if (FAILED(hr = wined3d_rendertarget_view_create_from_surface(dst_surface, + NULL, &wined3d_null_parent_ops, &fb.depth_stencil))) + { + ERR("Failed to create rendertarget view, hr %#x.\n", hr); + return hr; + } + + device_clear_render_targets(device, 0, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0); + wined3d_rendertarget_view_decref(fb.depth_stencil); return WINED3D_OK; } @@ -5781,11 +5756,11 @@ } if (src_surface) - src_swapchain = src_surface->swapchain; + src_swapchain = src_surface->container->swapchain; else src_swapchain = NULL; - dst_swapchain = dst_surface->swapchain; + dst_swapchain = dst_surface->container->swapchain; /* This isn't strictly needed. FBO blits for example could deal with * cross-swapchain blits by first downloading the source to a texture @@ -5831,8 +5806,8 @@ return WINED3DERR_INVALIDCALL; } - if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->resource.draw_binding, &src_rect, - dst_surface, dst_surface->resource.draw_binding, &dst_rect))) + if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->container->resource.draw_binding, + &src_rect, dst_surface, dst_surface->container->resource.draw_binding, &dst_rect))) return WINED3D_OK; } } @@ -5840,8 +5815,8 @@ { /* In principle this would apply to depth blits as well, but we don't * implement those in the CPU blitter at the moment. */ - if ((dst_surface->locations & dst_surface->map_binding) - && (!src_surface || (src_surface->locations & src_surface->map_binding))) + if ((dst_surface->locations & dst_surface->resource.map_binding) + && (!src_surface || (src_surface->locations & src_surface->resource.map_binding))) { if (scale) TRACE("Not doing sysmem blit because of scaling.\n"); @@ -5881,8 +5856,8 @@ if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, &src_rect))) { - if (!surface_is_offscreen(dst_surface)) - surface_load_location(dst_surface, dst_surface->resource.draw_binding); + if (!wined3d_resource_is_offscreen(&dst_surface->resource)) + surface_load_location(dst_surface, dst_surface->container->resource.draw_binding); return WINED3D_OK; } } @@ -5895,8 +5870,8 @@ * to the frontbuffer instead of doing a Flip(). D3D8 and D3D9 * applications can't blit directly to the frontbuffer. */ if (dst_swapchain && dst_swapchain->back_buffers - && dst_surface == dst_swapchain->front_buffer - && src_surface == dst_swapchain->back_buffers[0]) + && dst_surface->container == dst_swapchain->front_buffer + && src_surface->container == dst_swapchain->back_buffers[0]) { enum wined3d_swap_effect swap_effect = dst_swapchain->desc.swap_effect; @@ -5918,10 +5893,10 @@ TRACE("Using FBO blit.\n"); surface_blt_fbo(device, filter, - src_surface, src_surface->resource.draw_binding, &src_rect, - dst_surface, dst_surface->resource.draw_binding, &dst_rect); - surface_validate_location(dst_surface, dst_surface->resource.draw_binding); - surface_invalidate_location(dst_surface, ~dst_surface->resource.draw_binding); + src_surface, src_surface->container->resource.draw_binding, &src_rect, + dst_surface, dst_surface->container->resource.draw_binding, &dst_rect); + surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding); + surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding); return WINED3D_OK; } @@ -5952,7 +5927,7 @@ } static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container, - const struct wined3d_resource_desc *desc, GLenum target, GLint level, DWORD flags) + const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags) { struct wined3d_device *device = container->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -6016,7 +5991,7 @@ return hr; } - surface_set_container(surface, container); + surface->container = container; surface_validate_location(surface, WINED3D_LOCATION_SYSMEM); list_init(&surface->renderbuffers); list_init(&surface->overlays); @@ -6031,16 +6006,15 @@ if (lockable || desc->format == WINED3DFMT_D16_LOCKABLE) surface->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU; - surface->map_binding = WINED3D_LOCATION_SYSMEM; + surface->resource.map_binding = WINED3D_LOCATION_SYSMEM; surface->texture_target = target; surface->texture_level = level; + surface->texture_layer = layer; /* Call the private setup routine */ - hr = surface->surface_ops->surface_private_setup(surface); - if (FAILED(hr)) + if (FAILED(hr = surface->surface_ops->surface_private_setup(surface))) { - ERR("Private setup failed, returning %#x\n", hr); - surface_set_container(surface, NULL); + ERR("Private setup failed, hr %#x.\n", hr); surface_cleanup(surface); return hr; } @@ -6050,9 +6024,9 @@ * after a wined3d_surface_getdc() call. */ if ((desc->usage & WINED3DUSAGE_OWNDC) && !surface->hDC && SUCCEEDED(surface_create_dib_section(surface))) - surface->map_binding = WINED3D_LOCATION_DIB; + surface->resource.map_binding = WINED3D_LOCATION_DIB; - if (surface->map_binding == WINED3D_LOCATION_DIB) + if (surface->resource.map_binding == WINED3D_LOCATION_DIB) { wined3d_resource_free_sysmem(&surface->resource); surface_validate_location(surface, WINED3D_LOCATION_DIB); @@ -6063,7 +6037,7 @@ } HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, - GLenum target, GLint level, DWORD flags, struct wined3d_surface **surface) + GLenum target, unsigned int level, unsigned int layer, DWORD flags, struct wined3d_surface **surface) { struct wined3d_device_parent *device_parent = container->resource.device->device_parent; const struct wined3d_parent_ops *parent_ops; @@ -6072,15 +6046,15 @@ HRESULT hr; TRACE("container %p, width %u, height %u, format %s, usage %s (%#x), pool %s, " - "multisample_type %#x, multisample_quality %u, target %#x, level %d, flags %#x, surface %p.\n", + "multisample_type %#x, multisample_quality %u, target %#x, level %u, layer %u, flags %#x, surface %p.\n", container, desc->width, desc->height, debug_d3dformat(desc->format), debug_d3dusage(desc->usage), desc->usage, debug_d3dpool(desc->pool), - desc->multisample_type, desc->multisample_quality, target, level, flags, surface); + desc->multisample_type, desc->multisample_quality, target, level, layer, flags, surface); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; - if (FAILED(hr = surface_init(object, container, desc, target, level, flags))) + if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags))) { WARN("Failed to initialize surface, returning %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); @@ -6091,8 +6065,7 @@ wined3d_texture_get_parent(container), object, &parent, &parent_ops))) { WARN("Failed to create surface parent, hr %#x.\n", hr); - surface_set_container(object, NULL); - wined3d_surface_decref(object); + wined3d_surface_destroy(object); return hr; } diff -Nru wine1.7-1.7.24/dlls/wined3d/swapchain.c wine1.7-1.7.25/dlls/wined3d/swapchain.c --- wine1.7-1.7.24/dlls/wined3d/swapchain.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/swapchain.c 2014-08-22 18:39:55.000000000 +0000 @@ -40,8 +40,8 @@ * is the last buffer to be destroyed, FindContext() depends on that. */ if (swapchain->front_buffer) { - surface_set_swapchain(swapchain->front_buffer, NULL); - if (wined3d_surface_decref(swapchain->front_buffer)) + wined3d_texture_set_swapchain(swapchain->front_buffer, NULL); + if (wined3d_texture_decref(swapchain->front_buffer)) WARN("Something's still holding the front buffer (%p).\n", swapchain->front_buffer); swapchain->front_buffer = NULL; } @@ -52,8 +52,8 @@ while (i--) { - surface_set_swapchain(swapchain->back_buffers[i], NULL); - if (wined3d_surface_decref(swapchain->back_buffers[i])) + wined3d_texture_set_swapchain(swapchain->back_buffers[i], NULL); + if (wined3d_texture_decref(swapchain->back_buffers[i])) WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]); } HeapFree(GetProcessHeap(), 0, swapchain->back_buffers); @@ -163,7 +163,7 @@ TRACE("swapchain %p, dst_surface %p.\n", swapchain, dst_surface); - src_surface = swapchain->front_buffer; + src_surface = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); SetRect(&src_rect, 0, 0, src_surface->resource.width, src_surface->resource.height); dst_rect = src_rect; @@ -198,7 +198,7 @@ TRACE("Returning back buffer %p.\n", swapchain->back_buffers[back_buffer_idx]); - return swapchain->back_buffers[back_buffer_idx]; + return surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[back_buffer_idx], 0)); } HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, @@ -282,7 +282,8 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect) { - struct wined3d_surface *backbuffer = swapchain->back_buffers[0]; + struct wined3d_surface *backbuffer = surface_from_resource( + wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)); UINT src_w = src_rect->right - src_rect->left; UINT src_h = src_rect->bottom - src_rect->top; GLenum gl_filter; @@ -315,7 +316,8 @@ gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0); context_check_fbo_status(context, GL_READ_FRAMEBUFFER); - context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, swapchain->front_buffer, + context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, + surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), NULL, WINED3D_LOCATION_DRAWABLE); context_set_draw_buffer(context, GL_BACK); context_invalidate_state(context, STATE_FRAMEBUFFER); @@ -344,7 +346,7 @@ float tex_right = src_rect->right; float tex_bottom = src_rect->bottom; - context2 = context_acquire(device, swapchain->back_buffers[0]); + context2 = context_acquire(device, backbuffer); context_apply_blit_state(context2, device); if (backbuffer->flags & SFLAG_NORMCOORD) @@ -358,7 +360,8 @@ if (is_complex_fixup(backbuffer->resource.format->color_fixup)) gl_filter = GL_NEAREST; - context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, swapchain->front_buffer, + context_apply_fbo_state_blit(context2, GL_FRAMEBUFFER, + surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), NULL, WINED3D_LOCATION_DRAWABLE); context_bind_texture(context2, backbuffer->texture_target, backbuffer->container->texture_rgb.name); @@ -416,10 +419,12 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in, const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags) { - struct wined3d_surface *back_buffer = swapchain->back_buffers[0]; + struct wined3d_surface *back_buffer = surface_from_resource( + wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)); const struct wined3d_fb_state *fb = &swapchain->device->fb; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; + struct wined3d_surface *front; RECT src_rect, dst_rect; BOOL render_to_fbo; @@ -513,7 +518,7 @@ } else { - surface_load_location(back_buffer, back_buffer->resource.draw_binding); + surface_load_location(back_buffer, back_buffer->container->resource.draw_binding); } if (swapchain->render_to_fbo) @@ -549,13 +554,13 @@ } } - if (!swapchain->render_to_fbo && ((swapchain->front_buffer->locations & WINED3D_LOCATION_SYSMEM) + front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); + if (!swapchain->render_to_fbo && ((front->locations & WINED3D_LOCATION_SYSMEM) || (back_buffer->locations & WINED3D_LOCATION_SYSMEM))) { /* Both memory copies of the surfaces are ok, flip them around too instead of dirtifying * Doesn't work with render_to_fbo because we're not flipping */ - struct wined3d_surface *front = swapchain->front_buffer; if (front->resource.size == back_buffer->resource.size) { @@ -576,8 +581,8 @@ } else { - surface_validate_location(swapchain->front_buffer, WINED3D_LOCATION_DRAWABLE); - surface_invalidate_location(swapchain->front_buffer, ~WINED3D_LOCATION_DRAWABLE); + surface_validate_location(front, WINED3D_LOCATION_DRAWABLE); + surface_invalidate_location(front, ~WINED3D_LOCATION_DRAWABLE); /* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM * and INTEXTURE copies can keep their old content if they have any defined content. * If the swapeffect is COPY, the content remains the same. If it is FLIP however, @@ -585,20 +590,21 @@ */ if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_FLIP) { - surface_validate_location(back_buffer, back_buffer->resource.draw_binding); - surface_invalidate_location(back_buffer, ~back_buffer->resource.draw_binding); + surface_validate_location(back_buffer, back_buffer->container->resource.draw_binding); + surface_invalidate_location(back_buffer, ~back_buffer->container->resource.draw_binding); } } if (fb->depth_stencil) { - if (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL - || fb->depth_stencil->flags & SFLAG_DISCARD) + struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(fb->depth_stencil); + + if (ds && (swapchain->desc.flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL + || ds->flags & SFLAG_DISCARD)) { - surface_modify_ds_location(fb->depth_stencil, WINED3D_LOCATION_DISCARDED, - fb->depth_stencil->resource.width, - fb->depth_stencil->resource.height); - if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil) + surface_modify_ds_location(ds, WINED3D_LOCATION_DISCARDED, + fb->depth_stencil->width, fb->depth_stencil->height); + if (ds == swapchain->device->onscreen_depth_stencil) { wined3d_surface_decref(swapchain->device->onscreen_depth_stencil); swapchain->device->onscreen_depth_stencil = NULL; @@ -625,10 +631,10 @@ TRACE("swapchain %p, rect %s.\n", swapchain, wine_dbgstr_rect(rect)); + front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); if (swapchain->palette) - wined3d_palette_apply_to_dc(swapchain->palette, swapchain->front_buffer->hDC); + wined3d_palette_apply_to_dc(swapchain->palette, front->hDC); - front = swapchain->front_buffer; if (front->resource.map_count) ERR("Trying to blit a mapped surface.\n"); @@ -666,8 +672,8 @@ { struct wined3d_surface *front, *back; - front = swapchain->front_buffer; - back = swapchain->back_buffers[0]; + front = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)); + back = surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0)); /* Flip the DC. */ { @@ -767,6 +773,7 @@ { const struct wined3d_adapter *adapter = device->adapter; struct wined3d_resource_desc surface_desc; + struct wined3d_surface *front_buffer; BOOL displaymode_set = FALSE; RECT client_rect; HWND window; @@ -848,17 +855,18 @@ surface_desc.size = 0; if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, - parent, &surface_desc, &swapchain->front_buffer))) + parent, &surface_desc, &front_buffer))) { WARN("Failed to create front buffer, hr %#x.\n", hr); goto err; } - surface_set_swapchain(swapchain->front_buffer, swapchain); + swapchain->front_buffer = front_buffer->container; + wined3d_texture_set_swapchain(swapchain->front_buffer, swapchain); if (!(device->wined3d->flags & WINED3D_NO3D)) { - surface_validate_location(swapchain->front_buffer, WINED3D_LOCATION_DRAWABLE); - surface_invalidate_location(swapchain->front_buffer, ~WINED3D_LOCATION_DRAWABLE); + surface_validate_location(front_buffer, WINED3D_LOCATION_DRAWABLE); + surface_invalidate_location(front_buffer, ~WINED3D_LOCATION_DRAWABLE); } /* MSDN says we're only allowed a single fullscreen swapchain per device, @@ -920,7 +928,7 @@ for (i = 0; i < (sizeof(formats) / sizeof(*formats)); i++) { swapchain->ds_format = wined3d_get_format(gl_info, formats[i]); - swapchain->context[0] = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format); + swapchain->context[0] = context_create(swapchain, front_buffer, swapchain->ds_format); if (swapchain->context[0]) break; TRACE("Depth stencil format %s is not supported, trying next format\n", debug_d3dformat(formats[i])); @@ -956,15 +964,18 @@ surface_desc.usage |= WINED3DUSAGE_RENDERTARGET; for (i = 0; i < swapchain->desc.backbuffer_count; ++i) { + struct wined3d_surface *back_buffer; + TRACE("Creating back buffer %u.\n", i); if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, - parent, &surface_desc, &swapchain->back_buffers[i]))) + parent, &surface_desc, &back_buffer))) { WARN("Failed to create back buffer %u, hr %#x.\n", i, hr); swapchain->desc.backbuffer_count = i; goto err; } - surface_set_swapchain(swapchain->back_buffers[i], swapchain); + swapchain->back_buffers[i] = back_buffer->container; + wined3d_texture_set_swapchain(swapchain->back_buffers[i], swapchain); } } @@ -972,15 +983,26 @@ if (desc->enable_auto_depth_stencil && !(device->wined3d->flags & WINED3D_NO3D)) { TRACE("Creating depth/stencil buffer.\n"); - if (!device->auto_depth_stencil) + if (!device->auto_depth_stencil_view) { + struct wined3d_surface *ds; + surface_desc.format = swapchain->desc.auto_depth_stencil_format; surface_desc.usage = WINED3DUSAGE_DEPTHSTENCIL; if (FAILED(hr = device->device_parent->ops->create_swapchain_surface(device->device_parent, - device->device_parent, &surface_desc, &device->auto_depth_stencil))) + device->device_parent, &surface_desc, &ds))) + { + WARN("Failed to create the auto depth/stencil surface, hr %#x.\n", hr); + goto err; + } + + hr = wined3d_rendertarget_view_create_from_surface(ds, + NULL, &wined3d_null_parent_ops, &device->auto_depth_stencil_view); + wined3d_surface_decref(ds); + if (FAILED(hr)) { - WARN("Failed to create the auto depth stencil, hr %#x.\n", hr); + ERR("Failed to create rendertarget view, hr %#x.\n", hr); goto err; } } @@ -1005,8 +1027,8 @@ { if (swapchain->back_buffers[i]) { - surface_set_swapchain(swapchain->back_buffers[i], NULL); - wined3d_surface_decref(swapchain->back_buffers[i]); + wined3d_texture_set_swapchain(swapchain->back_buffers[i], NULL); + wined3d_texture_decref(swapchain->back_buffers[i]); } } HeapFree(GetProcessHeap(), 0, swapchain->back_buffers); @@ -1025,8 +1047,8 @@ if (swapchain->front_buffer) { - surface_set_swapchain(swapchain->front_buffer, NULL); - wined3d_surface_decref(swapchain->front_buffer); + wined3d_texture_set_swapchain(swapchain->front_buffer, NULL); + wined3d_texture_decref(swapchain->front_buffer); } return hr; @@ -1066,7 +1088,9 @@ TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain, GetCurrentThreadId()); - if (!(ctx = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format))) + if (!(ctx = context_create(swapchain, + surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)), + swapchain->ds_format))) { ERR("Failed to create a new context for the swapchain\n"); return NULL; @@ -1144,10 +1168,10 @@ { UINT i; - surface_update_draw_binding(swapchain->front_buffer); + wined3d_resource_update_draw_binding(&swapchain->front_buffer->resource); for (i = 0; i < swapchain->desc.backbuffer_count; ++i) { - surface_update_draw_binding(swapchain->back_buffers[i]); + wined3d_resource_update_draw_binding(&swapchain->back_buffers[i]->resource); } } diff -Nru wine1.7-1.7.24/dlls/wined3d/texture.c wine1.7-1.7.25/dlls/wined3d/texture.c --- wine1.7-1.7.24/dlls/wined3d/texture.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/texture.c 2014-08-22 18:39:55.000000000 +0000 @@ -64,6 +64,7 @@ WARN("Failed to initialize resource, returning %#x\n", hr); return hr; } + wined3d_resource_update_draw_binding(&texture->resource); texture->texture_ops = texture_ops; texture->sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, @@ -145,6 +146,12 @@ resource_cleanup(&texture->resource); } +void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) +{ + texture->swapchain = swapchain; + wined3d_resource_update_draw_binding(&texture->resource); +} + void wined3d_texture_set_dirty(struct wined3d_texture *texture) { texture->flags &= ~(WINED3D_TEXTURE_RGB_VALID | WINED3D_TEXTURE_SRGB_VALID); @@ -476,8 +483,14 @@ ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) { - ULONG refcount = InterlockedIncrement(&texture->resource.ref); + ULONG refcount; + + TRACE("texture %p, swapchain %p.\n", texture, texture->swapchain); + if (texture->swapchain) + return wined3d_swapchain_incref(texture->swapchain); + + refcount = InterlockedIncrement(&texture->resource.ref); TRACE("%p increasing refcount to %u.\n", texture, refcount); return refcount; @@ -485,8 +498,14 @@ ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) { - ULONG refcount = InterlockedDecrement(&texture->resource.ref); + ULONG refcount; + + TRACE("texture %p, swapchain %p.\n", texture, texture->swapchain); + + if (texture->swapchain) + return wined3d_swapchain_decref(texture->swapchain); + refcount = InterlockedDecrement(&texture->resource.ref); TRACE("%p decreasing refcount to %u.\n", texture, refcount); if (!refcount) @@ -734,16 +753,15 @@ struct wined3d_surface *surface = surface_from_resource(sub_resource); surface_prepare_map_memory(surface); - surface_load_location(surface, surface->map_binding); - surface_invalidate_location(surface, ~surface->map_binding); + surface_load_location(surface, surface->resource.map_binding); + surface_invalidate_location(surface, ~surface->resource.map_binding); } static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource) { struct wined3d_surface *surface = surface_from_resource(sub_resource); - surface_set_container(surface, NULL); - wined3d_surface_decref(surface); + wined3d_surface_destroy(surface); } static const struct wined3d_texture_ops texture2d_ops = @@ -753,6 +771,16 @@ texture2d_sub_resource_cleanup, }; +static ULONG texture_resource_incref(struct wined3d_resource *resource) +{ + return wined3d_texture_incref(wined3d_texture_from_resource(resource)); +} + +static ULONG texture_resource_decref(struct wined3d_resource *resource) +{ + return wined3d_texture_decref(wined3d_texture_from_resource(resource)); +} + static void wined3d_texture_unload(struct wined3d_resource *resource) { struct wined3d_texture *texture = wined3d_texture_from_resource(resource); @@ -773,6 +801,8 @@ static const struct wined3d_resource_ops texture_resource_ops = { + texture_resource_incref, + texture_resource_decref, wined3d_texture_unload, }; @@ -877,7 +907,7 @@ struct wined3d_surface *surface; if (FAILED(hr = wined3d_surface_create(texture, &surface_desc, - cube_targets[j], i, surface_flags, &surface))) + cube_targets[j], i, j, surface_flags, &surface))) { WARN("Failed to create surface, hr %#x.\n", hr); wined3d_texture_cleanup(texture); @@ -1031,7 +1061,7 @@ struct wined3d_surface *surface; if (FAILED(hr = wined3d_surface_create(texture, &surface_desc, - texture->target, i, surface_flags, &surface))) + texture->target, i, 0, surface_flags, &surface))) { WARN("Failed to create surface, hr %#x.\n", hr); wined3d_texture_cleanup(texture); @@ -1064,9 +1094,7 @@ { struct wined3d_volume *volume = volume_from_resource(sub_resource); - /* Cleanup the container. */ - volume_set_container(volume, NULL); - wined3d_volume_decref(volume); + wined3d_volume_destroy(volume); } static const struct wined3d_texture_ops texture3d_ops = diff -Nru wine1.7-1.7.24/dlls/wined3d/utils.c wine1.7-1.7.25/dlls/wined3d/utils.c --- wine1.7-1.7.24/dlls/wined3d/utils.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/utils.c 2014-08-22 18:39:55.000000000 +0000 @@ -3213,7 +3213,7 @@ unsigned int i; DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; - const struct wined3d_surface *rt = state->fb->render_targets[0]; + const struct wined3d_format *rt_format = state->fb->render_targets[0]->format; const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_d3d_info *d3d_info = context->d3d_info; @@ -3427,7 +3427,7 @@ } if (!gl_info->supported[ARB_FRAMEBUFFER_SRGB] && state->render_states[WINED3D_RS_SRGBWRITEENABLE] - && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) + && rt_format->flags & WINED3DFMT_FLAG_SRGB_WRITE) { settings->sRGB_write = 1; } else { diff -Nru wine1.7-1.7.24/dlls/wined3d/view.c wine1.7-1.7.25/dlls/wined3d/view.c --- wine1.7-1.7.24/dlls/wined3d/view.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/view.c 2014-08-22 18:39:55.000000000 +0000 @@ -40,7 +40,13 @@ TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) + { + /* Call wined3d_object_destroyed() before releasing the resource, + * since releasing the resource may end up destroying the parent. */ + view->parent_ops->wined3d_object_destroyed(view->parent); + wined3d_resource_decref(view->resource); HeapFree(GetProcessHeap(), 0, view); + } return refcount; } @@ -52,6 +58,29 @@ return view->parent; } +void * CDECL wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view) +{ + struct wined3d_resource *sub_resource; + + TRACE("view %p.\n", view); + + if (view->resource->type == WINED3D_RTYPE_BUFFER) + return wined3d_buffer_get_parent(buffer_from_resource(view->resource)); + + if (!(sub_resource = wined3d_texture_get_sub_resource(wined3d_texture_from_resource(view->resource), + view->sub_resource_idx))) + return NULL; + + return wined3d_resource_get_parent(sub_resource); +} + +void CDECL wined3d_rendertarget_view_set_parent(struct wined3d_rendertarget_view *view, void *parent) +{ + TRACE("view %p, parent %p.\n", view, parent); + + view->parent = parent; +} + struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view) { TRACE("view %p.\n", view); @@ -60,29 +89,72 @@ } static void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, - struct wined3d_resource *resource, void *parent) + const struct wined3d_rendertarget_view_desc *desc, struct wined3d_resource *resource, + void *parent, const struct wined3d_parent_ops *parent_ops) { + const struct wined3d_gl_info *gl_info = &resource->device->adapter->gl_info; + view->refcount = 1; view->resource = resource; + wined3d_resource_incref(resource); view->parent = parent; + view->parent_ops = parent_ops; + + view->format = wined3d_get_format(gl_info, desc->format_id); + if (resource->type == WINED3D_RTYPE_BUFFER) + { + view->sub_resource_idx = 0; + view->buffer_offset = desc->u.buffer.start_idx; + view->width = desc->u.buffer.count; + view->height = 1; + view->depth = 1; + } + else + { + struct wined3d_texture *texture = wined3d_texture_from_resource(resource); + struct wined3d_resource *sub_resource; + + view->sub_resource_idx = desc->u.texture.layer_idx * texture->level_count + desc->u.texture.level_idx; + sub_resource = wined3d_texture_get_sub_resource(texture, view->sub_resource_idx); + + view->buffer_offset = 0; + view->width = sub_resource->width; + view->height = sub_resource->height; + view->depth = desc->u.texture.layer_count; + } } -HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource, - void *parent, struct wined3d_rendertarget_view **rendertarget_view) +HRESULT CDECL wined3d_rendertarget_view_create(const struct wined3d_rendertarget_view_desc *desc, + struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops, + struct wined3d_rendertarget_view **view) { struct wined3d_rendertarget_view *object; - TRACE("resource %p, parent %p, rendertarget_view %p.\n", - resource, parent, rendertarget_view); + TRACE("desc %p, resource %p, parent %p, view %p.\n", + desc, resource, parent, view); - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) + if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; - wined3d_rendertarget_view_init(object, resource, parent); + wined3d_rendertarget_view_init(object, desc, resource, parent, parent_ops); TRACE("Created render target view %p.\n", object); - *rendertarget_view = object; + *view = object; return WINED3D_OK; } + +HRESULT CDECL wined3d_rendertarget_view_create_from_surface(struct wined3d_surface *surface, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view) +{ + struct wined3d_rendertarget_view_desc desc; + + TRACE("surface %p, view %p.\n", surface, view); + + desc.format_id = surface->resource.format->id; + desc.u.texture.level_idx = surface->texture_level; + desc.u.texture.layer_idx = surface->texture_layer; + desc.u.texture.layer_count = 1; + + return wined3d_rendertarget_view_create(&desc, &surface->container->resource, parent, parent_ops, view); +} diff -Nru wine1.7-1.7.24/dlls/wined3d/volume.c wine1.7-1.7.25/dlls/wined3d/volume.c --- wine1.7-1.7.24/dlls/wined3d/volume.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/volume.c 2014-08-22 18:39:55.000000000 +0000 @@ -27,13 +27,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); WINE_DECLARE_DEBUG_CHANNEL(d3d_perf); -void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) -{ - TRACE("volume %p, container %p.\n", volume, container); - - volume->container = container; -} - static BOOL volume_prepare_system_memory(struct wined3d_volume *volume) { if (volume->resource.heap_memory) @@ -461,6 +454,18 @@ context_release(context); } +void wined3d_volume_destroy(struct wined3d_volume *volume) +{ + TRACE("volume %p.\n", volume); + + if (volume->pbo) + wined3d_volume_free_pbo(volume); + + resource_cleanup(&volume->resource); + volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent); + HeapFree(GetProcessHeap(), 0, volume); +} + static void volume_unload(struct wined3d_resource *resource) { struct wined3d_volume *volume = volume_from_resource(resource); @@ -504,46 +509,16 @@ ULONG CDECL wined3d_volume_incref(struct wined3d_volume *volume) { - ULONG refcount; - - if (volume->container) - { - TRACE("Forwarding to container %p.\n", volume->container); - return wined3d_texture_incref(volume->container); - } - - refcount = InterlockedIncrement(&volume->resource.ref); + TRACE("Forwarding to container %p.\n", volume->container); - TRACE("%p increasing refcount to %u.\n", volume, refcount); - - return refcount; + return wined3d_texture_incref(volume->container); } ULONG CDECL wined3d_volume_decref(struct wined3d_volume *volume) { - ULONG refcount; - - if (volume->container) - { - TRACE("Forwarding to container %p.\n", volume->container); - return wined3d_texture_decref(volume->container); - } - - refcount = InterlockedDecrement(&volume->resource.ref); + TRACE("Forwarding to container %p.\n", volume->container); - TRACE("%p decreasing refcount to %u.\n", volume, refcount); - - if (!refcount) - { - if (volume->pbo) - wined3d_volume_free_pbo(volume); - - resource_cleanup(&volume->resource); - volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent); - HeapFree(GetProcessHeap(), 0, volume); - } - - return refcount; + return wined3d_texture_decref(volume->container); } void * CDECL wined3d_volume_get_parent(const struct wined3d_volume *volume) @@ -797,8 +772,20 @@ return WINED3D_OK; } +static ULONG volume_resource_incref(struct wined3d_resource *resource) +{ + return wined3d_volume_incref(volume_from_resource(resource)); +} + +static ULONG volume_resource_decref(struct wined3d_resource *resource) +{ + return wined3d_volume_decref(volume_from_resource(resource)); +} + static const struct wined3d_resource_ops volume_resource_ops = { + volume_resource_incref, + volume_resource_decref, volume_unload, }; @@ -846,7 +833,7 @@ volume->flags |= WINED3D_VFLAG_PBO; } - volume_set_container(volume, container); + volume->container = container; return WINED3D_OK; } @@ -879,8 +866,7 @@ wined3d_texture_get_parent(container), object, &parent, &parent_ops))) { WARN("Failed to create volume parent, hr %#x.\n", hr); - volume_set_container(object, NULL); - wined3d_volume_decref(object); + wined3d_volume_destroy(object); return hr; } diff -Nru wine1.7-1.7.24/dlls/wined3d/wined3d_private.h wine1.7-1.7.25/dlls/wined3d/wined3d_private.h --- wine1.7-1.7.24/dlls/wined3d/wined3d_private.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/wined3d_private.h 2014-08-22 18:39:55.000000000 +0000 @@ -1175,8 +1175,8 @@ struct wined3d_fb_state { - struct wined3d_surface **render_targets; - struct wined3d_surface *depth_stencil; + struct wined3d_rendertarget_view **render_targets; + struct wined3d_rendertarget_view *depth_stencil; }; typedef void (*APPLYSTATEFUNC)(struct wined3d_context *ctx, const struct wined3d_state *state, DWORD state_id); @@ -1413,9 +1413,16 @@ CARD_AMD_RADEON_HD6700 = 0x68ba, CARD_AMD_RADEON_HD6800 = 0x6739, CARD_AMD_RADEON_HD6900 = 0x6719, + CARD_AMD_RADEON_HD7660D = 0x9901, CARD_AMD_RADEON_HD7700 = 0x683d, CARD_AMD_RADEON_HD7800 = 0x6819, CARD_AMD_RADEON_HD7900 = 0x679a, + CARD_AMD_RADEON_HD8600M = 0x6660, + CARD_AMD_RADEON_HD8670 = 0x6610, + CARD_AMD_RADEON_HD8770 = 0x665c, + CARD_AMD_RADEON_R3 = 0x9830, + CARD_AMD_RADEON_R7 = 0x130f, + CARD_AMD_RADEON_R9 = 0x67b1, CARD_NVIDIA_RIVA_128 = 0x0018, CARD_NVIDIA_RIVA_TNT = 0x0020, @@ -1634,7 +1641,7 @@ enum wined3d_pci_device device; const char *name; const char *description; - unsigned int vidmem; + UINT64 vram_bytes; DWORD version_high; DWORD version_low; }; @@ -1683,8 +1690,8 @@ WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */ unsigned int cfg_count; struct wined3d_pixel_format *cfgs; - unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */ - unsigned int UsedTextureRam; + UINT64 vram_bytes; + UINT64 vram_bytes_used; LUID luid; const struct wined3d_vertex_pipe_ops *vertex_pipe; @@ -1694,7 +1701,7 @@ }; BOOL wined3d_adapter_init_format_info(struct wined3d_adapter *adapter) DECLSPEC_HIDDEN; -unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount) DECLSPEC_HIDDEN; +UINT64 adapter_adjust_memory(struct wined3d_adapter *adapter, INT64 amount) DECLSPEC_HIDDEN; BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; @@ -1938,6 +1945,7 @@ struct wined3d_device_creation_parameters create_parms; HWND focus_window; + struct wined3d_rendertarget_view *back_buffer_view; struct wined3d_swapchain **swapchains; UINT swapchain_count; @@ -1947,7 +1955,7 @@ /* Render Target Support */ struct wined3d_fb_state fb; struct wined3d_surface *onscreen_depth_stencil; - struct wined3d_surface *auto_depth_stencil; + struct wined3d_rendertarget_view *auto_depth_stencil_view; /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; @@ -2013,6 +2021,8 @@ struct wined3d_resource_ops { + ULONG (*resource_incref)(struct wined3d_resource *resource); + ULONG (*resource_decref)(struct wined3d_resource *resource); void (*resource_unload)(struct wined3d_resource *resource); }; @@ -2030,6 +2040,7 @@ enum wined3d_pool pool; DWORD access_flags; DWORD draw_binding; + DWORD map_binding; UINT width; UINT height; UINT depth; @@ -2043,6 +2054,16 @@ const struct wined3d_resource_ops *resource_ops; }; +static inline ULONG wined3d_resource_incref(struct wined3d_resource *resource) +{ + return resource->resource_ops->resource_incref(resource); +} + +static inline ULONG wined3d_resource_decref(struct wined3d_resource *resource) +{ + return resource->resource_ops->resource_decref(resource); +} + void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, enum wined3d_resource_type type, const struct wined3d_format *format, @@ -2053,10 +2074,11 @@ void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_resource_free_sysmem(struct wined3d_resource *resource) DECLSPEC_HIDDEN; -DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, - DWORD flags) DECLSPEC_HIDDEN; GLbitfield wined3d_resource_gl_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; GLenum wined3d_resource_gl_legacy_map_flags(DWORD d3d_flags) DECLSPEC_HIDDEN; +BOOL wined3d_resource_is_offscreen(struct wined3d_resource *resource) DECLSPEC_HIDDEN; +DWORD wined3d_resource_sanitize_map_flags(const struct wined3d_resource *resource, DWORD flags) DECLSPEC_HIDDEN; +void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DECLSPEC_HIDDEN; /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 @@ -2104,6 +2126,7 @@ const struct wined3d_texture_ops *texture_ops; struct gl_texture texture_rgb, texture_srgb; struct wined3d_resource **sub_resources; + struct wined3d_swapchain *swapchain; UINT layer_count; UINT level_count; float pow2_matrix[16]; @@ -2144,6 +2167,8 @@ void wined3d_texture_load(struct wined3d_texture *texture, struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void wined3d_texture_set_dirty(struct wined3d_texture *texture) DECLSPEC_HIDDEN; +void wined3d_texture_set_swapchain(struct wined3d_texture *texture, + struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; #define WINED3D_VFLAG_ALLOCATED 0x00000001 #define WINED3D_VFLAG_SRGB_ALLOCATED 0x00000002 @@ -2181,9 +2206,9 @@ HRESULT wined3d_volume_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, unsigned int level, struct wined3d_volume **volume) DECLSPEC_HIDDEN; +void wined3d_volume_destroy(struct wined3d_volume *volume) DECLSPEC_HIDDEN; void wined3d_volume_load(struct wined3d_volume *volume, struct wined3d_context *context, BOOL srgb_mode) DECLSPEC_HIDDEN; -void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN; void wined3d_volume_invalidate_location(struct wined3d_volume *volume, DWORD location) DECLSPEC_HIDDEN; void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wined3d_context *context, const struct wined3d_bo_address *data) DECLSPEC_HIDDEN; @@ -2225,8 +2250,6 @@ struct wined3d_resource resource; const struct wined3d_surface_ops *surface_ops; struct wined3d_texture *container; - struct wined3d_swapchain *swapchain; - DWORD map_binding; void *user_memory; DWORD locations; @@ -2240,8 +2263,9 @@ GLuint pbo; GLuint rb_multisample; GLuint rb_resolved; - GLint texture_level; GLenum texture_target; + unsigned int texture_level; + unsigned int texture_layer; RECT lockedRect; int lockCount; @@ -2283,7 +2307,6 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN; void surface_invalidate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN; -BOOL surface_is_offscreen(const struct wined3d_surface *surface) DECLSPEC_HIDDEN; void surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN; void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; @@ -2296,16 +2319,15 @@ struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN; void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, const struct wined3d_surface *rt) DECLSPEC_HIDDEN; -void surface_set_container(struct wined3d_surface *surface, struct wined3d_texture *container) DECLSPEC_HIDDEN; -void surface_set_swapchain(struct wined3d_surface *surface, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void surface_set_texture_target(struct wined3d_surface *surface, GLenum target, GLint level) DECLSPEC_HIDDEN; void surface_translate_drawable_coords(const struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN; -void surface_update_draw_binding(struct wined3d_surface *surface) DECLSPEC_HIDDEN; HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface, const POINT *dst_point, struct wined3d_surface *src_surface, const RECT *src_rect) DECLSPEC_HIDDEN; void surface_validate_location(struct wined3d_surface *surface, DWORD location) DECLSPEC_HIDDEN; HRESULT wined3d_surface_create(struct wined3d_texture *container, const struct wined3d_resource_desc *desc, - GLenum target, GLint level, DWORD flags, struct wined3d_surface **surface) DECLSPEC_HIDDEN; + GLenum target, unsigned int level, unsigned int layer, DWORD flags, + struct wined3d_surface **surface) DECLSPEC_HIDDEN; +void wined3d_surface_destroy(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void surface_prepare_map_memory(struct wined3d_surface *surface) DECLSPEC_HIDDEN; void draw_textured_quad(const struct wined3d_surface *src_surface, struct wined3d_context *context, @@ -2484,14 +2506,15 @@ const struct wined3d_vec4 *plane) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_constant_buffer(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT cb_idx, struct wined3d_buffer *buffer) DECLSPEC_HIDDEN; -void wined3d_cs_emit_set_depth_stencil(struct wined3d_cs *cs, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; +void wined3d_cs_emit_set_depth_stencil_view(struct wined3d_cs *cs, + struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_index_buffer(struct wined3d_cs *cs, struct wined3d_buffer *buffer, enum wined3d_format_id format_id) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_material(struct wined3d_cs *cs, const struct wined3d_material *material) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, enum wined3d_render_state state, DWORD value) DECLSPEC_HIDDEN; -void wined3d_cs_emit_set_render_target(struct wined3d_cs *cs, UINT render_target_idx, - struct wined3d_surface *render_target) DECLSPEC_HIDDEN; +void wined3d_cs_emit_set_rendertarget_view(struct wined3d_cs *cs, unsigned int view_idx, + struct wined3d_rendertarget_view *view) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_sampler(struct wined3d_cs *cs, enum wined3d_shader_type type, UINT sampler_idx, struct wined3d_sampler *sampler) DECLSPEC_HIDDEN; void wined3d_cs_emit_set_sampler_state(struct wined3d_cs *cs, UINT sampler_idx, @@ -2598,8 +2621,36 @@ struct wined3d_resource *resource; void *parent; + const struct wined3d_parent_ops *parent_ops; + + const struct wined3d_format *format; + unsigned int sub_resource_idx; + unsigned int buffer_offset; + + unsigned int width; + unsigned int height; + unsigned int depth; }; +static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface( + const struct wined3d_rendertarget_view *view) +{ + struct wined3d_resource *resource; + struct wined3d_texture *texture; + + if (!view) + return NULL; + + if (view->resource->type != WINED3D_RTYPE_TEXTURE && view->resource->type != WINED3D_RTYPE_CUBE_TEXTURE) + return NULL; + + texture = wined3d_texture_from_resource(view->resource); + if (!(resource = wined3d_texture_get_sub_resource(texture, view->sub_resource_idx))) + return NULL; + + return surface_from_resource(resource); +} + struct wined3d_swapchain_ops { void (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, @@ -2614,8 +2665,8 @@ const struct wined3d_swapchain_ops *swapchain_ops; struct wined3d_device *device; - struct wined3d_surface **back_buffers; - struct wined3d_surface *front_buffer; + struct wined3d_texture **back_buffers; + struct wined3d_texture *front_buffer; struct wined3d_swapchain_desc desc; struct wined3d_display_mode original_mode; struct wined3d_gamma_ramp orig_gamma; diff -Nru wine1.7-1.7.24/dlls/wined3d/wined3d.spec wine1.7-1.7.25/dlls/wined3d/wined3d.spec --- wine1.7-1.7.24/dlls/wined3d/wined3d.spec 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wined3d/wined3d.spec 2014-08-22 18:39:55.000000000 +0000 @@ -36,8 +36,7 @@ @ cdecl wined3d_device_begin_scene(ptr) @ cdecl wined3d_device_begin_stateblock(ptr) @ cdecl wined3d_device_clear(ptr long ptr long ptr float long) -@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr) -@ cdecl wined3d_device_color_fill(ptr ptr ptr ptr) +@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr ptr) @ cdecl wined3d_device_copy_resource(ptr ptr ptr) @ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr) @ cdecl wined3d_device_decref(ptr) @@ -53,7 +52,7 @@ @ cdecl wined3d_device_get_clip_plane(ptr long ptr) @ cdecl wined3d_device_get_clip_status(ptr ptr) @ cdecl wined3d_device_get_creation_parameters(ptr ptr) -@ cdecl wined3d_device_get_depth_stencil(ptr) +@ cdecl wined3d_device_get_depth_stencil_view(ptr) @ cdecl wined3d_device_get_device_caps(ptr ptr) @ cdecl wined3d_device_get_display_mode(ptr long ptr ptr) @ cdecl wined3d_device_get_front_buffer_data(ptr long ptr) @@ -75,7 +74,7 @@ @ cdecl wined3d_device_get_ps_sampler(ptr long) @ cdecl wined3d_device_get_raster_status(ptr long ptr) @ cdecl wined3d_device_get_render_state(ptr long) -@ cdecl wined3d_device_get_render_target(ptr long) +@ cdecl wined3d_device_get_rendertarget_view(ptr long) @ cdecl wined3d_device_get_sampler_state(ptr long long) @ cdecl wined3d_device_get_scissor_rect(ptr ptr) @ cdecl wined3d_device_get_software_vertex_processing(ptr) @@ -110,7 +109,7 @@ @ cdecl wined3d_device_set_clip_status(ptr ptr) @ cdecl wined3d_device_set_cursor_position(ptr long long long) @ cdecl wined3d_device_set_cursor_properties(ptr long long ptr) -@ cdecl wined3d_device_set_depth_stencil(ptr ptr) +@ cdecl wined3d_device_set_depth_stencil_view(ptr ptr) @ cdecl wined3d_device_set_dialog_box_mode(ptr long) @ cdecl wined3d_device_set_gamma_ramp(ptr long long ptr) @ cdecl wined3d_device_set_geometry_shader(ptr ptr) @@ -130,7 +129,7 @@ @ cdecl wined3d_device_set_ps_consts_i(ptr long ptr long) @ cdecl wined3d_device_set_ps_sampler(ptr long ptr) @ cdecl wined3d_device_set_render_state(ptr long long) -@ cdecl wined3d_device_set_render_target(ptr long ptr long) +@ cdecl wined3d_device_set_rendertarget_view(ptr long ptr long) @ cdecl wined3d_device_set_sampler_state(ptr long long long) @ cdecl wined3d_device_set_scissor_rect(ptr ptr) @ cdecl wined3d_device_set_software_vertex_processing(ptr long) @@ -177,11 +176,14 @@ @ cdecl wined3d_resource_set_parent(ptr ptr) @ cdecl wined3d_resource_set_priority(ptr long) -@ cdecl wined3d_rendertarget_view_create(ptr ptr ptr) +@ cdecl wined3d_rendertarget_view_create(ptr ptr ptr ptr ptr) +@ cdecl wined3d_rendertarget_view_create_from_surface(ptr ptr ptr ptr) @ cdecl wined3d_rendertarget_view_decref(ptr) @ cdecl wined3d_rendertarget_view_get_parent(ptr) @ cdecl wined3d_rendertarget_view_get_resource(ptr) +@ cdecl wined3d_rendertarget_view_get_sub_resource_parent(ptr) @ cdecl wined3d_rendertarget_view_incref(ptr) +@ cdecl wined3d_rendertarget_view_set_parent(ptr ptr) @ cdecl wined3d_sampler_create(ptr ptr) @ cdecl wined3d_sampler_decref(ptr) diff -Nru wine1.7-1.7.24/dlls/winex11.drv/palette.c wine1.7-1.7.25/dlls/winex11.drv/palette.c --- wine1.7-1.7.24/dlls/winex11.drv/palette.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/winex11.drv/palette.c 2014-08-22 18:39:55.000000000 +0000 @@ -782,12 +782,6 @@ } -static inline BOOL colour_is_brighter(RGBQUAD c1, RGBQUAD c2) -{ - return (c1.rgbRed * c1.rgbRed + c1.rgbGreen * c1.rgbGreen + c1.rgbBlue * c1.rgbBlue) > - (c2.rgbRed * c2.rgbRed + c2.rgbGreen * c2.rgbGreen + c2.rgbBlue * c2.rgbBlue); -} - /*********************************************************************** * X11DRV_PALETTE_GetColor * diff -Nru wine1.7-1.7.24/dlls/winex11.drv/xrender.c wine1.7-1.7.25/dlls/winex11.drv/xrender.c --- wine1.7-1.7.24/dlls/winex11.drv/xrender.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/winex11.drv/xrender.c 2014-08-22 18:39:55.000000000 +0000 @@ -102,23 +102,6 @@ /* WXR_FORMAT_B8G8R8X8 */ { 32, 0, 0, 8, 0xff, 16, 0xff, 24, 0xff }, }; -static const ColorShifts wxr_color_shifts[WXR_NB_FORMATS] = -{ - /* format phys red phys green phys blue log red log green log blue */ -/* WXR_FORMAT_MONO */ { { 0,0,0 }, { 0,0,0 }, { 0,0,0 }, { 0,0,0 }, { 0,0,0 }, { 0,0,0 } }, -/* WXR_FORMAT_GRAY */ { { 0,0,0 }, { 0,0,0 }, { 0,0,0 }, { 0,0,0 }, { 0,0,0 }, { 0,0,0 } }, -/* WXR_FORMAT_X1R5G5B5 */ { {10,5,31}, { 5,5,31}, { 0,5,31}, {10,5,31}, { 5,5,31}, { 0,5,31} }, -/* WXR_FORMAT_X1B5G5R5 */ { { 0,5,31}, { 5,5,31}, {10,5,31}, { 0,5,31}, { 5,5,31}, {10,5,31} }, -/* WXR_FORMAT_R5G6B5 */ { {11,5,31}, { 5,6,63}, { 0,5,31}, {11,5,31}, { 5,6,63}, { 0,5,31} }, -/* WXR_FORMAT_B5G6R5 */ { { 0,5,31}, { 5,6,63}, {11,5,31}, { 0,5,31}, { 5,6,63}, {11,5,31} }, -/* WXR_FORMAT_R8G8B8 */ { {16,8,255}, { 8,8,255}, { 0,8,255}, {16,8,255}, { 8,8,255}, { 0,8,255} }, -/* WXR_FORMAT_B8G8R8 */ { { 0,8,255}, { 8,8,255}, {16,8,255}, { 0,8,255}, { 8,8,255}, {16,8,255} }, -/* WXR_FORMAT_A8R8G8B8 */ { {16,8,255}, { 8,8,255}, { 0,8,255}, {16,8,255}, { 8,8,255}, { 0,8,255} }, -/* WXR_FORMAT_B8G8R8A8 */ { { 8,8,255}, {16,8,255}, {24,8,255}, { 8,8,255}, {16,8,255}, {24,8,255} }, -/* WXR_FORMAT_X8R8G8B8 */ { {16,8,255}, { 8,8,255}, { 0,8,255}, {16,8,255}, { 8,8,255}, { 0,8,255} }, -/* WXR_FORMAT_B8G8R8X8 */ { { 8,8,255}, {16,8,255}, {24,8,255}, { 8,8,255}, {16,8,255}, {24,8,255} }, -}; - static enum wxr_format default_format = WXR_INVALID_FORMAT; static XRenderPictFormat *pict_formats[WXR_NB_FORMATS + 1 /* invalid format */]; diff -Nru wine1.7-1.7.24/dlls/winhttp/request.c wine1.7-1.7.25/dlls/winhttp/request.c --- wine1.7-1.7.24/dlls/winhttp/request.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/winhttp/request.c 2014-08-22 18:39:55.000000000 +0000 @@ -3352,7 +3352,7 @@ { sa = V_ARRAY( &data ); if ((hr = SafeArrayAccessData( sa, (void **)&ptr )) != S_OK) return hr; - if ((hr = SafeArrayGetUBound( sa, 1, &size ) != S_OK)) + if ((hr = SafeArrayGetUBound( sa, 1, &size )) != S_OK) { SafeArrayUnaccessData( sa ); return hr; diff -Nru wine1.7-1.7.24/dlls/wpcap/Makefile.in wine1.7-1.7.25/dlls/wpcap/Makefile.in --- wine1.7-1.7.24/dlls/wpcap/Makefile.in 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wpcap/Makefile.in 2014-08-22 18:39:55.000000000 +0000 @@ -1,5 +1,8 @@ MODULE = wpcap.dll +DELAYIMPORTS = ws2_32 EXTRALIBS = @LIBPCAP@ C_SRCS = \ wpcap.c + +RC_SRCS = version.rc diff -Nru wine1.7-1.7.24/dlls/wpcap/version.rc wine1.7-1.7.25/dlls/wpcap/version.rc --- wine1.7-1.7.24/dlls/wpcap/version.rc 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.25/dlls/wpcap/version.rc 2014-08-22 18:39:55.000000000 +0000 @@ -0,0 +1,26 @@ +/* + * Copyright 2014 André Hentschel + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define WINE_FILEDESCRIPTION_STR "wpcap.dll Dynamic Link Library - based on libpcap 1.0" +#define WINE_FILENAME_STR "wpcap.dll" +#define WINE_FILEVERSION 4,1,0,2980 +#define WINE_FILEVERSION_STR "4.1.0.2980" +#define WINE_PRODUCTVERSION 4,1,0,2980 +#define WINE_PRODUCTVERSION_STR "4.1.0.2980" + +#include "wine/wine_common_ver.rc" diff -Nru wine1.7-1.7.24/dlls/wpcap/wpcap.c wine1.7-1.7.25/dlls/wpcap/wpcap.c --- wine1.7-1.7.24/dlls/wpcap/wpcap.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wpcap/wpcap.c 2014-08-22 18:39:55.000000000 +0000 @@ -1,7 +1,7 @@ /* * WPcap.dll Proxy. * - * Copyright 2011 André Hentschel + * Copyright 2011, 2014 André Hentschel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,9 +19,139 @@ */ #include +#include "winsock2.h" +#include "windef.h" +#include "winbase.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wpcap); +WINE_DECLARE_DEBUG_CHANNEL(winediag); + +void CDECL wine_pcap_breakloop(pcap_t *p) +{ + TRACE("(%p)\n", p); + return pcap_breakloop(p); +} + +void CDECL wine_pcap_close(pcap_t *p) +{ + TRACE("(%p)\n", p); + pcap_close(p); +} + +int CDECL wine_pcap_compile(pcap_t *p, struct bpf_program *program, const char *buf, int optimize, + unsigned int mask) +{ + TRACE("(%p %p %s %i %u)\n", p, program, debugstr_a(buf), optimize, mask); + return pcap_compile(p, program, buf, optimize, mask); +} + +int CDECL wine_pcap_datalink(pcap_t *p) +{ + TRACE("(%p)\n", p); + return pcap_datalink(p); +} + +int CDECL wine_pcap_datalink_name_to_val(const char *name) +{ + TRACE("(%s)\n", debugstr_a(name)); + return pcap_datalink_name_to_val(name); +} + +const char* CDECL wine_pcap_datalink_val_to_description(int dlt) +{ + TRACE("(%i)\n", dlt); + return pcap_datalink_val_to_description(dlt); +} + +const char* CDECL wine_pcap_datalink_val_to_name(int dlt) +{ + TRACE("(%i)\n", dlt); + return pcap_datalink_val_to_name(dlt); +} + +typedef struct +{ + void (CALLBACK *pfn_cb)(u_char *, const struct pcap_pkthdr *, const u_char *); + void *user_data; +} PCAP_HANDLER_CALLBACK; + +static void pcap_handler_callback(u_char *user_data, const struct pcap_pkthdr *h, const u_char *p) +{ + PCAP_HANDLER_CALLBACK *pcb; + TRACE("(%p %p %p)\n", user_data, h, p); + pcb = (PCAP_HANDLER_CALLBACK *)user_data; + pcb->pfn_cb(pcb->user_data, h, p); + HeapFree(GetProcessHeap(), 0, pcb); + TRACE("Callback COMPLETED\n"); +} + +int CDECL wine_pcap_dispatch(pcap_t *p, int cnt, + void (CALLBACK *callback)(u_char *, const struct pcap_pkthdr *, const u_char *), + unsigned char *user) +{ + TRACE("(%p %i %p %p)\n", p, cnt, callback, user); + + if (callback) + { + PCAP_HANDLER_CALLBACK *pcb; + pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PCAP_HANDLER_CALLBACK)); + pcb->pfn_cb = callback; + pcb->user_data = user; + return pcap_dispatch(p, cnt, pcap_handler_callback, (unsigned char*)pcb); + } + + return pcap_dispatch(p, cnt, NULL, user); +} + +int CDECL wine_pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) +{ + int ret; + + TRACE("(%p %p)\n", alldevsp, errbuf); + ret = pcap_findalldevs(alldevsp, errbuf); + if(alldevsp && !*alldevsp) + ERR_(winediag)("Failed to access raw network (pcap), this requires special permissions.\n"); + + return ret; +} + +int CDECL wine_pcap_findalldevs_ex(char *source, void *auth, pcap_if_t **alldevs, char *errbuf) +{ + FIXME("(%s %p %p %p): partial stub\n", debugstr_a(source), auth, alldevs, errbuf); + return wine_pcap_findalldevs(alldevs, errbuf); +} + +void CDECL wine_pcap_freealldevs(pcap_if_t *alldevs) +{ + TRACE("(%p)\n", alldevs); + pcap_freealldevs(alldevs); +} + +void CDECL wine_pcap_freecode(struct bpf_program *fp) +{ + TRACE("(%p)\n", fp); + return pcap_freecode(fp); +} + +typedef struct _AirpcapHandle *PAirpcapHandle; +PAirpcapHandle CDECL wine_pcap_get_airpcap_handle(pcap_t *p) +{ + TRACE("(%p)\n", p); + return NULL; +} + +char* CDECL wine_pcap_geterr(pcap_t *p) +{ + TRACE("(%p)\n", p); + return pcap_geterr(p); +} + +int CDECL wine_pcap_getnonblock(pcap_t *p, char *errbuf) +{ + TRACE("(%p %p)\n", p, errbuf); + return pcap_getnonblock(p, errbuf); +} const char* CDECL wine_pcap_lib_version(void) { @@ -29,3 +159,132 @@ TRACE("%s\n", debugstr_a(ret)); return ret; } + +int CDECL wine_pcap_list_datalinks(pcap_t *p, int **dlt_buffer) +{ + TRACE("(%p %p)\n", p, dlt_buffer); + return pcap_list_datalinks(p, dlt_buffer); +} + +char* CDECL wine_pcap_lookupdev(char *errbuf) +{ + TRACE("(%p)\n", errbuf); + return pcap_lookupdev(errbuf); +} + +int CDECL wine_pcap_lookupnet(const char *device, unsigned int *netp, unsigned int *maskp, + char *errbuf) +{ + TRACE("(%s %p %p %p)\n", debugstr_a(device), netp, maskp, errbuf); + return pcap_lookupnet(device, netp, maskp, errbuf); +} + +int CDECL wine_pcap_loop(pcap_t *p, int cnt, + void (CALLBACK *callback)(u_char *, const struct pcap_pkthdr *, const u_char *), + unsigned char *user) +{ + TRACE("(%p %i %p %p)\n", p, cnt, callback, user); + + if (callback) + { + PCAP_HANDLER_CALLBACK *pcb; + pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PCAP_HANDLER_CALLBACK)); + pcb->pfn_cb = callback; + pcb->user_data = user; + return pcap_loop(p, cnt, pcap_handler_callback, (unsigned char*)pcb); + } + + return pcap_loop(p, cnt, NULL, user); +} + +int CDECL wine_pcap_major_version(pcap_t *p) +{ + TRACE("(%p)\n", p); + return pcap_major_version(p); +} + +int CDECL wine_pcap_minor_version(pcap_t *p) +{ + TRACE("(%p)\n", p); + return pcap_minor_version(p); +} + +const unsigned char* CDECL wine_pcap_next(pcap_t *p, struct pcap_pkthdr *h) +{ + TRACE("(%p %p)\n", p, h); + return pcap_next(p, h); +} + +int CDECL wine_pcap_next_ex(pcap_t *p, struct pcap_pkthdr **pkt_header, const unsigned char **pkt_data) +{ + TRACE("(%p %p %p)\n", p, pkt_header, pkt_data); + return pcap_next_ex(p, pkt_header, pkt_data); +} + +#define PCAP_OPENFLAG_PROMISCUOUS 1 + +pcap_t* CDECL wine_pcap_open(const char *source, int snaplen, int flags, int read_timeout, + void *auth, char *errbuf) +{ + int promisc = flags & PCAP_OPENFLAG_PROMISCUOUS; + FIXME("(%s %i %i %i %p %p): partial stub\n", debugstr_a(source), snaplen, flags, read_timeout, + auth, errbuf); + return pcap_open_live(source, snaplen, promisc, read_timeout, errbuf); +} + +pcap_t* CDECL wine_pcap_open_live(const char *source, int snaplen, int promisc, int to_ms, + char *errbuf) +{ + TRACE("(%s %i %i %i %p)\n", debugstr_a(source), snaplen, promisc, to_ms, errbuf); + return pcap_open_live(source, snaplen, promisc, to_ms, errbuf); +} + +int CDECL wine_pcap_sendpacket(pcap_t *p, const unsigned char *buf, int size) +{ + TRACE("(%p %p %i)\n", p, buf, size); + return pcap_sendpacket(p, buf, size); +} + +int CDECL wine_pcap_set_datalink(pcap_t *p, int dlt) +{ + TRACE("(%p %i)\n", p, dlt); + return pcap_set_datalink(p, dlt); +} + +int CDECL wine_pcap_setbuff(pcap_t * p, int dim) +{ + FIXME("(%p %i) stub\n", p, dim); + return 0; +} + +int CDECL wine_pcap_setfilter(pcap_t *p, struct bpf_program *fp) +{ + TRACE("(%p %p)\n", p, fp); + return pcap_setfilter(p, fp); +} + +int CDECL wine_pcap_setnonblock(pcap_t *p, int nonblock, char *errbuf) +{ + TRACE("(%p %i %p)\n", p, nonblock, errbuf); + return pcap_setnonblock(p, nonblock, errbuf); +} + +int CDECL wine_pcap_snapshot(pcap_t *p) +{ + TRACE("(%p)\n", p); + return pcap_snapshot(p); +} + +int CDECL wine_pcap_stats(pcap_t *p, struct pcap_stat *ps) +{ + TRACE("(%p %p)\n", p, ps); + return pcap_stats(p, ps); +} + +int CDECL wine_wsockinit(void) +{ + WSADATA wsadata; + TRACE("()\n"); + if (WSAStartup(MAKEWORD(1,1), &wsadata)) return -1; + return 0; +} diff -Nru wine1.7-1.7.24/dlls/wpcap/wpcap.spec wine1.7-1.7.25/dlls/wpcap/wpcap.spec --- wine1.7-1.7.24/dlls/wpcap/wpcap.spec 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/wpcap/wpcap.spec 2014-08-22 18:39:55.000000000 +0000 @@ -6,16 +6,16 @@ @ stub eproto_db @ stub getservent @ stub install_bpf_program -@ stub pcap_breakloop -@ stub pcap_close -@ stub pcap_compile +@ cdecl pcap_breakloop(ptr) wine_pcap_breakloop +@ cdecl pcap_close(ptr) wine_pcap_close +@ cdecl pcap_compile(ptr ptr str long long) wine_pcap_compile @ stub pcap_compile_nopcap @ stub pcap_createsrcstr -@ stub pcap_datalink -@ stub pcap_datalink_name_to_val -@ stub pcap_datalink_val_to_description -@ stub pcap_datalink_val_to_name -@ stub pcap_dispatch +@ cdecl pcap_datalink(ptr) wine_pcap_datalink +@ cdecl pcap_datalink_name_to_val(str) wine_pcap_datalink_name_to_val +@ cdecl pcap_datalink_val_to_description(long) wine_pcap_datalink_val_to_description +@ cdecl pcap_datalink_val_to_name(long) wine_pcap_datalink_val_to_name +@ cdecl pcap_dispatch(ptr long ptr ptr) wine_pcap_dispatch @ stub pcap_dump @ stub pcap_dump_close @ stub pcap_dump_file @@ -24,32 +24,32 @@ @ stub pcap_dump_open @ stub pcap_file @ stub pcap_fileno -@ stub pcap_findalldevs -@ stub pcap_findalldevs_ex -@ stub pcap_freealldevs -@ stub pcap_freecode -@ stub pcap_get_airpcap_handle -@ stub pcap_geterr +@ cdecl pcap_findalldevs(ptr ptr) wine_pcap_findalldevs +@ cdecl pcap_findalldevs_ex(ptr ptr ptr ptr) wine_pcap_findalldevs_ex +@ cdecl pcap_freealldevs(ptr) wine_pcap_freealldevs +@ cdecl pcap_freecode(ptr) wine_pcap_freecode +@ cdecl pcap_get_airpcap_handle(ptr) wine_pcap_get_airpcap_handle +@ cdecl pcap_geterr(ptr) wine_pcap_geterr @ stub pcap_getevent -@ stub pcap_getnonblock +@ cdecl pcap_getnonblock(ptr ptr) wine_pcap_getnonblock @ stub pcap_is_swapped @ cdecl pcap_lib_version() wine_pcap_lib_version -@ stub pcap_list_datalinks +@ cdecl pcap_list_datalinks(ptr ptr) wine_pcap_list_datalinks @ stub pcap_live_dump @ stub pcap_live_dump_ended -@ stub pcap_lookupdev -@ stub pcap_lookupnet -@ stub pcap_loop -@ stub pcap_major_version -@ stub pcap_minor_version -@ stub pcap_next +@ cdecl pcap_lookupdev(ptr) wine_pcap_lookupdev +@ cdecl pcap_lookupnet(str ptr ptr ptr) wine_pcap_lookupnet +@ cdecl pcap_loop(ptr long ptr ptr) wine_pcap_loop +@ cdecl pcap_major_version(ptr) wine_pcap_major_version +@ cdecl pcap_minor_version(ptr) wine_pcap_minor_version +@ cdecl pcap_next(ptr ptr) wine_pcap_next @ stub pcap_next_etherent -@ stub pcap_next_ex +@ cdecl pcap_next_ex(ptr ptr ptr) wine_pcap_next_ex @ stub pcap_offline_filter @ stub pcap_offline_read -@ stub pcap_open +@ cdecl pcap_open(str long long long ptr ptr) wine_pcap_open @ stub pcap_open_dead -@ stub pcap_open_live +@ cdecl pcap_open_live(str long long long ptr) wine_pcap_open_live @ stub pcap_open_offline @ stub pcap_parsesrcstr @ stub pcap_perror @@ -58,21 +58,21 @@ @ stub pcap_remoteact_cleanup @ stub pcap_remoteact_close @ stub pcap_remoteact_list -@ stub pcap_sendpacket +@ cdecl pcap_sendpacket(ptr ptr long) wine_pcap_sendpacket @ stub pcap_sendqueue_alloc @ stub pcap_sendqueue_destroy @ stub pcap_sendqueue_queue @ stub pcap_sendqueue_transmit -@ stub pcap_set_datalink -@ stub pcap_setbuff -@ stub pcap_setfilter +@ cdecl pcap_set_datalink(ptr long) wine_pcap_set_datalink +@ cdecl pcap_setbuff(ptr long) wine_pcap_setbuff +@ cdecl pcap_setfilter(ptr ptr) wine_pcap_setfilter @ stub pcap_setmintocopy @ stub pcap_setmode -@ stub pcap_setnonblock +@ cdecl pcap_setnonblock(ptr long ptr) wine_pcap_setnonblock @ stub pcap_setsampling @ stub pcap_setuserbuffer -@ stub pcap_snapshot -@ stub pcap_stats +@ cdecl pcap_snapshot(ptr) wine_pcap_snapshot +@ cdecl pcap_stats(ptr ptr) wine_pcap_stats @ stub pcap_stats_ex @ stub pcap_strerror -@ stub wsockinit +@ cdecl wsockinit() wine_wsockinit diff -Nru wine1.7-1.7.24/dlls/ws2_32/socket.c wine1.7-1.7.25/dlls/ws2_32/socket.c --- wine1.7-1.7.24/dlls/ws2_32/socket.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/ws2_32/socket.c 2014-08-22 18:39:55.000000000 +0000 @@ -569,6 +569,7 @@ static const char magic_loopback_addr[] = {127, 12, 34, 56}; #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS +#ifdef IP_PKTINFO static inline WSACMSGHDR *fill_control_message(int level, int type, WSACMSGHDR *current, ULONG *maxsize, void *data, int len) { ULONG msgsize = sizeof(WSACMSGHDR) + WSA_CMSG_ALIGN(len); @@ -586,6 +587,7 @@ /* Return the pointer to where next entry should go */ return (WSACMSGHDR *) (ptr + WSA_CMSG_ALIGN(len)); } +#endif /* IP_PKTINFO */ static inline int convert_control_headers(struct msghdr *hdr, WSABUF *control) { diff -Nru wine1.7-1.7.24/dlls/xmllite/reader.c wine1.7-1.7.25/dlls/xmllite/reader.c --- wine1.7-1.7.24/dlls/xmllite/reader.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/dlls/xmllite/reader.c 2014-08-22 18:39:55.000000000 +0000 @@ -372,12 +372,6 @@ } } -/* returns length in WCHARs from 'start' to current buffer offset */ -static inline UINT reader_get_len(const xmlreader *reader, UINT start) -{ - return reader->input->buffer->utf16.cur - start; -} - static inline void reader_init_strvalue(UINT start, UINT len, strval *v) { v->start = start; diff -Nru wine1.7-1.7.24/include/d3d10_1.idl wine1.7-1.7.25/include/d3d10_1.idl --- wine1.7-1.7.24/include/d3d10_1.idl 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/include/d3d10_1.idl 2014-08-22 18:39:55.000000000 +0000 @@ -19,6 +19,32 @@ import "oaidl.idl"; import "ocidl.idl"; +cpp_quote("#ifndef _D3D10_1_CONSTANTS") +cpp_quote("#define _D3D10_1_CONSTANTS") +const UINT D3D10_1_DEFAULT_SAMPLE_MASK = 0xffffffff; +const UINT D3D10_1_GS_INPUT_REGISTER_COUNT = 32; +const UINT D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = 32; +const UINT D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = 128; +const UINT D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = 32; +const UINT D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS = 1; +const UINT D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT = 32; +const UINT D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT = 1; +const UINT D3D10_1_SHADER_MAJOR_VERSION = 4; +const UINT D3D10_1_SHADER_MINOR_VERSION = 1; +const UINT D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; +const UINT D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 256; +const UINT D3D10_1_SO_BUFFER_SLOT_COUNT = 4; +const UINT D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = 1; +const UINT D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT = 64; +const UINT D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT = 32; +const UINT D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT = 8; +const UINT D3D10_1_VS_INPUT_REGISTER_COUNT = 32; +const UINT D3D10_1_VS_OUTPUT_REGISTER_COUNT = 32; +cpp_quote("#endif") + +cpp_quote("#define D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP (0.6)") +cpp_quote("#define D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP (0.6f)") + import "d3d10.idl"; cpp_quote("#include ") diff -Nru wine1.7-1.7.24/include/d3d11.idl wine1.7-1.7.25/include/d3d11.idl --- wine1.7-1.7.24/include/d3d11.idl 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/include/d3d11.idl 2014-08-22 18:39:55.000000000 +0000 @@ -27,6 +27,42 @@ typedef D3D_SRV_DIMENSION D3D11_SRV_DIMENSION; typedef RECT D3D11_RECT; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = 14; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = 4; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = 15; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT = 16; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = 15; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const UINT D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const UINT D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = 64; +const UINT D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = 4; +const UINT D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = 1; +const UINT D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = 1; +const UINT D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = 1; +const UINT D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = 1; +const UINT D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = 128; +const UINT D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = 1; +const UINT D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = 1; +const UINT D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = 128; +const UINT D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = 1; +const UINT D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT = 16; +const UINT D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = 1; +const UINT D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = 1; +const UINT D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT = 16; +const UINT D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = 32; +const UINT D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS = 4; +const UINT D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_COMMONSHADER_TEMP_REGISTER_COUNT = 4096; +const UINT D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = 3; +const UINT D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS = 3; +const UINT D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = 10; +const INT D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = -10; +const INT D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = -8; +const UINT D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = 7; + const UINT D3D11_DEFAULT_DEPTH_BIAS = 0; cpp_quote("#define D3D11_DEFAULT_DEPTH_BIAS_CLAMP 0.0f") const UINT D3D11_DEFAULT_MAX_ANISOTROPY = 16; @@ -66,6 +102,80 @@ const UINT D3D11_SHADER_MINOR_VERSION = 0; const UINT D3D11_VS_OUTPUT_REGISTER_COUNT = 32; +const UINT D3D11_PS_CS_UAV_REGISTER_COMPONENTS = 1; +const UINT D3D11_PS_CS_UAV_REGISTER_COUNT = 8; +const UINT D3D11_PS_CS_UAV_REGISTER_READS_PER_INST = 1; +const UINT D3D11_PS_CS_UAV_REGISTER_READ_PORTS = 1; +const UINT D3D11_PS_FRONTFACING_DEFAULT_VALUE = 0xffffffff; +const UINT D3D11_PS_FRONTFACING_FALSE_VALUE = 0; +const UINT D3D11_PS_FRONTFACING_TRUE_VALUE = 0xffffffff; +const UINT D3D11_PS_INPUT_REGISTER_COMPONENTS = 4; +const UINT D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_PS_INPUT_REGISTER_COUNT = 32; +const UINT D3D11_PS_INPUT_REGISTER_READS_PER_INST = 2; +const UINT D3D11_PS_INPUT_REGISTER_READ_PORTS = 1; +cpp_quote("#define D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT (0.0f)") +const UINT D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = 1; +const UINT D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT = 1; +const UINT D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS = 1; +const UINT D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_PS_OUTPUT_MASK_REGISTER_COUNT = 1; +const UINT D3D11_PS_OUTPUT_REGISTER_COMPONENTS = 4; +const UINT D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = 32; +const UINT D3D11_PS_OUTPUT_REGISTER_COUNT = 8; +cpp_quote("#define D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT (0.5f)") + +const UINT D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT = 16; + +const UINT D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE = 4096; +const UINT D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = 27; +const UINT D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const UINT D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE = 4096; +const UINT D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = 32; +const UINT D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = 32; +const UINT D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = 16384; +const UINT D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = 1024; +const UINT D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = 4096; +const UINT D3D11_REQ_MAXANISOTROPY = 16; +const UINT D3D11_REQ_MIP_LEVELS = 15; +const UINT D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = 2048; +const UINT D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE = 4096; +const UINT D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = 16384; +const UINT D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM = 128; +cpp_quote("#define D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM (0.25f)") +const UINT D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM = 2048; +const UINT D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP = 20; +const UINT D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE = 4096; +const UINT D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = 2048; +const UINT D3D11_REQ_TEXTURE1D_U_DIMENSION = 16384; +const UINT D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = 2048; +const UINT D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION = 16384; +const UINT D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = 2048; +const UINT D3D11_REQ_TEXTURECUBE_DIMENSION = 16384; + +const UINT D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0; + +const UINT D3D11_SHADER_MAJOR_VERSION = 5; +const UINT D3D11_SHADER_MAX_INSTANCES = 65535; +const UINT D3D11_SHADER_MAX_INTERFACES = 253; +const UINT D3D11_SHADER_MAX_INTERFACE_CALL_SITES = 4096; +const UINT D3D11_SHADER_MAX_TYPES = 65535; +const UINT D3D11_SHADER_MINOR_VERSION = 0; + +const UINT D3D11_SHIFT_INSTRUCTION_PAD_VALUE = 0; +const UINT D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = 5; + +const UINT D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT = 8; + +const UINT D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; +const UINT D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 512; +const UINT D3D11_SO_BUFFER_SLOT_COUNT = 4; +const UINT D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP = 0xffffffff; +const UINT D3D11_SO_NO_RASTERIZED_STREAM = 0xffffffff; +const UINT D3D11_SO_OUTPUT_COMPONENT_COUNT = 128; +const UINT D3D11_SO_STREAM_COUNT = 4; + cpp_quote("#if !defined(D3D11_NO_HELPERS) && defined(__cplusplus)") cpp_quote("struct CD3D11_DEFAULT {};") cpp_quote("extern const DECLSPEC_SELECTANY CD3D11_DEFAULT D3D11_DEFAULT;") @@ -343,6 +453,17 @@ D3D11_MAP_WRITE_NO_OVERWRITE } D3D11_MAP; +typedef enum D3D11_MAP_FLAG +{ + D3D11_MAP_FLAG_DO_NOT_WAIT = 0x00100000 +} D3D11_MAP_FLAG; + +typedef struct D3D11_QUERY_DATA_SO_STATISTICS +{ + UINT64 NumPrimitivesWritten; + UINT64 PrimitivesStorageNeeded; +} D3D11_QUERY_DATA_SO_STATISTICS; + typedef struct D3D11_MAPPED_SUBRESOURCE { void *pData; diff -Nru wine1.7-1.7.24/include/dwmapi.h wine1.7-1.7.25/include/dwmapi.h --- wine1.7-1.7.24/include/dwmapi.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/include/dwmapi.h 2014-08-22 18:39:55.000000000 +0000 @@ -116,6 +116,7 @@ DWMAPI DwmExtendFrameIntoClientArea(HWND,const MARGINS*); DWMAPI DwmGetColorizationColor(DWORD*,BOOL); DWMAPI DwmGetCompositionTimingInfo(HWND,DWM_TIMING_INFO*); +DWMAPI DwmInvalidateIconicBitmaps(HWND); DWMAPI DwmIsCompositionEnabled(BOOL*); DWMAPI DwmRegisterThumbnail(HWND, HWND, PHTHUMBNAIL); DWMAPI DwmSetWindowAttribute(HWND, DWORD, LPCVOID, DWORD); diff -Nru wine1.7-1.7.24/include/wine/server_protocol.h wine1.7-1.7.25/include/wine/server_protocol.h --- wine1.7-1.7.24/include/wine/server_protocol.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/include/wine/server_protocol.h 2014-08-22 18:39:55.000000000 +0000 @@ -3189,6 +3189,18 @@ }; +struct set_named_pipe_info_request +{ + struct request_header __header; + obj_handle_t handle; + unsigned int flags; + char __pad_20[4]; +}; +struct set_named_pipe_info_reply +{ + struct reply_header __header; +}; + struct create_window_request { @@ -5203,6 +5215,7 @@ REQ_get_ioctl_result, REQ_create_named_pipe, REQ_get_named_pipe_info, + REQ_set_named_pipe_info, REQ_create_window, REQ_destroy_window, REQ_get_desktop_window, @@ -5464,6 +5477,7 @@ struct get_ioctl_result_request get_ioctl_result_request; struct create_named_pipe_request create_named_pipe_request; struct get_named_pipe_info_request get_named_pipe_info_request; + struct set_named_pipe_info_request set_named_pipe_info_request; struct create_window_request create_window_request; struct destroy_window_request destroy_window_request; struct get_desktop_window_request get_desktop_window_request; @@ -5723,6 +5737,7 @@ struct get_ioctl_result_reply get_ioctl_result_reply; struct create_named_pipe_reply create_named_pipe_reply; struct get_named_pipe_info_reply get_named_pipe_info_reply; + struct set_named_pipe_info_reply set_named_pipe_info_reply; struct create_window_reply create_window_reply; struct destroy_window_reply destroy_window_reply; struct get_desktop_window_reply get_desktop_window_reply; @@ -5834,6 +5849,6 @@ struct set_suspend_context_reply set_suspend_context_reply; }; -#define SERVER_PROTOCOL_VERSION 456 +#define SERVER_PROTOCOL_VERSION 457 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff -Nru wine1.7-1.7.24/include/wine/wined3d.h wine1.7-1.7.25/include/wine/wined3d.h --- wine1.7-1.7.24/include/wine/wined3d.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/include/wine/wined3d.h 2014-08-22 18:39:55.000000000 +0000 @@ -1934,6 +1934,25 @@ UINT misc_flags; }; +struct wined3d_rendertarget_view_desc +{ + enum wined3d_format_id format_id; + union + { + struct + { + unsigned int start_idx; + unsigned int count; + } buffer; + struct + { + unsigned int level_idx; + unsigned int layer_idx; + unsigned int layer_count; + } texture; + } u; +}; + struct wined3d_shader_signature_element { const char *semantic_name; @@ -2076,10 +2095,8 @@ HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device); HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, const struct wined3d_color *color, float z, DWORD stencil); -void __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, - struct wined3d_rendertarget_view *rendertarget_view, const struct wined3d_color *color); -HRESULT __cdecl wined3d_device_color_fill(struct wined3d_device *device, struct wined3d_surface *surface, - const RECT *rect, const struct wined3d_color *color); +HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color); void __cdecl wined3d_device_copy_resource(struct wined3d_device *device, struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource); HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, @@ -2103,7 +2120,7 @@ struct wined3d_clip_status *clip_status); void __cdecl wined3d_device_get_creation_parameters(const struct wined3d_device *device, struct wined3d_device_creation_parameters *creation_parameters); -struct wined3d_surface * __cdecl wined3d_device_get_depth_stencil(const struct wined3d_device *device); +struct wined3d_rendertarget_view * __cdecl wined3d_device_get_depth_stencil_view(const struct wined3d_device *device); HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps); HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); @@ -2135,8 +2152,8 @@ HRESULT __cdecl wined3d_device_get_raster_status(const struct wined3d_device *device, UINT swapchain_idx, struct wined3d_raster_status *raster_status); DWORD __cdecl wined3d_device_get_render_state(const struct wined3d_device *device, enum wined3d_render_state state); -struct wined3d_surface * __cdecl wined3d_device_get_render_target(const struct wined3d_device *device, - UINT render_target_idx); +struct wined3d_rendertarget_view * __cdecl wined3d_device_get_rendertarget_view(const struct wined3d_device *device, + unsigned int view_idx); DWORD __cdecl wined3d_device_get_sampler_state(const struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state); void __cdecl wined3d_device_get_scissor_rect(const struct wined3d_device *device, RECT *rect); @@ -2191,7 +2208,8 @@ int x_screen_space, int y_screen_space, DWORD flags); HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device, UINT x_hotspot, UINT y_hotspot, struct wined3d_surface *cursor_surface); -void __cdecl wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil); +void __cdecl wined3d_device_set_depth_stencil_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *view); HRESULT __cdecl wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs); void __cdecl wined3d_device_set_gamma_ramp(const struct wined3d_device *device, UINT swapchain_idx, DWORD flags, const struct wined3d_gamma_ramp *ramp); @@ -2219,8 +2237,8 @@ void __cdecl wined3d_device_set_ps_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler); void __cdecl wined3d_device_set_render_state(struct wined3d_device *device, enum wined3d_render_state state, DWORD value); -HRESULT __cdecl wined3d_device_set_render_target(struct wined3d_device *device, - UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport); +HRESULT __cdecl wined3d_device_set_rendertarget_view(struct wined3d_device *device, + unsigned int view_idx, struct wined3d_rendertarget_view *view, BOOL set_viewport); void __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); void __cdecl wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect); @@ -2357,12 +2375,17 @@ void __cdecl wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent); DWORD __cdecl wined3d_resource_set_priority(struct wined3d_resource *resource, DWORD priority); -HRESULT __cdecl wined3d_rendertarget_view_create(struct wined3d_resource *resource, - void *parent, struct wined3d_rendertarget_view **rendertarget_view); +HRESULT __cdecl wined3d_rendertarget_view_create(const struct wined3d_rendertarget_view_desc *desc, + struct wined3d_resource *resource, void *parent, const struct wined3d_parent_ops *parent_ops, + struct wined3d_rendertarget_view **view); +HRESULT __cdecl wined3d_rendertarget_view_create_from_surface(struct wined3d_surface *surface, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_rendertarget_view **view); ULONG __cdecl wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view); void * __cdecl wined3d_rendertarget_view_get_parent(const struct wined3d_rendertarget_view *view); struct wined3d_resource * __cdecl wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view); +void * __cdecl wined3d_rendertarget_view_get_sub_resource_parent(const struct wined3d_rendertarget_view *view); ULONG __cdecl wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view); +void __cdecl wined3d_rendertarget_view_set_parent(struct wined3d_rendertarget_view *view, void *parent); HRESULT __cdecl wined3d_sampler_create(void *parent, struct wined3d_sampler **sampler); ULONG __cdecl wined3d_sampler_decref(struct wined3d_sampler *sampler); diff -Nru wine1.7-1.7.24/include/winternl.h wine1.7-1.7.25/include/winternl.h --- wine1.7-1.7.24/include/winternl.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/include/winternl.h 2014-08-22 18:39:55.000000000 +0000 @@ -623,6 +623,11 @@ LARGE_INTEGER ReadTimeout; } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION; +typedef struct _FILE_PIPE_INFORMATION { + ULONG ReadMode; + ULONG CompletionMode; +} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; + typedef struct _FILE_PIPE_LOCAL_INFORMATION { ULONG NamedPipeType; ULONG NamedPipeConfiguration; @@ -1602,6 +1607,12 @@ /* options for pipe's type */ #define FILE_PIPE_TYPE_MESSAGE 0x00000001 #define FILE_PIPE_TYPE_BYTE 0x00000000 +/* options for pipe's message mode */ +#define FILE_PIPE_MESSAGE_MODE 0x00000001 +#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000 +/* options for pipe's blocking mode */ +#define FILE_PIPE_COMPLETE_OPERATION 0x00000001 +#define FILE_PIPE_QUEUE_OPERATION 0x00000000 /* and client / server end */ #define FILE_PIPE_SERVER_END 0x00000001 #define FILE_PIPE_CLIENT_END 0x00000000 diff -Nru wine1.7-1.7.24/loader/wine_info.plist.in wine1.7-1.7.25/loader/wine_info.plist.in --- wine1.7-1.7.24/loader/wine_info.plist.in 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/loader/wine_info.plist.in 2014-08-22 18:39:55.000000000 +0000 @@ -22,5 +22,7 @@ @PACKAGE_VERSION@ NSPrincipalClass WineApplication + LSUIElement + 1 diff -Nru wine1.7-1.7.24/po/de.po wine1.7-1.7.25/po/de.po --- wine1.7-1.7.24/po/de.po 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/po/de.po 2014-08-22 18:39:55.000000000 +0000 @@ -5,7 +5,7 @@ "Project-Id-Version: Wine\n" "Report-Msgid-Bugs-To: http://bugs.winehq.org\n" "POT-Creation-Date: N/A\n" -"PO-Revision-Date: 2014-06-27 13:29+0200\n" +"PO-Revision-Date: 2014-08-13 01:33+0200\n" "Last-Translator: Julian Rüger\n" "Language-Team: none\n" "Language: German\n" @@ -1039,13 +1039,11 @@ #: comdlg32.rc:146 msgid "Open File" -msgstr "Öffne Datei" +msgstr "Datei öffnen" #: comdlg32.rc:147 -#, fuzzy -#| msgid "New Folder" msgid "Select Folder" -msgstr "Neuer Ordner" +msgstr "Ordner auswählen" #: comdlg32.rc:83 oleview.rc:98 msgid "Ready" diff -Nru wine1.7-1.7.24/po/fi.po wine1.7-1.7.25/po/fi.po --- wine1.7-1.7.24/po/fi.po 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/po/fi.po 2014-08-22 18:39:55.000000000 +0000 @@ -845,7 +845,7 @@ #: comdlg32.rc:40 msgid "The selection contains a non-folder object" -msgstr "" +msgstr "Valinta sisältää kohteen, joka ei ole kansio" #: comdlg32.rc:45 msgid "Up One Level" @@ -1036,10 +1036,8 @@ msgstr "Avaa tiedosto" #: comdlg32.rc:147 -#, fuzzy -#| msgid "New Folder" msgid "Select Folder" -msgstr "Uusi kansio" +msgstr "Valitse kansio" #: comdlg32.rc:83 oleview.rc:98 msgid "Ready" diff -Nru wine1.7-1.7.24/po/fr.po wine1.7-1.7.25/po/fr.po --- wine1.7-1.7.24/po/fr.po 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/po/fr.po 2014-08-22 18:39:55.000000000 +0000 @@ -1045,10 +1045,8 @@ msgstr "Ouvrir le fichier" #: comdlg32.rc:147 -#, fuzzy -#| msgid "New Folder" msgid "Select Folder" -msgstr "Nouveau dossier" +msgstr "Sélectionnez un dossier" #: comdlg32.rc:83 oleview.rc:98 msgid "Ready" @@ -6629,10 +6627,8 @@ msgstr "Cette connexion réseau n'existe pas.\n" #: winerror.mc:3746 -#, fuzzy -#| msgid "Connection refused.\n" msgid "Connection reset by peer.\n" -msgstr "Connexion refusée.\n" +msgstr "Connexion cloturée par le pair.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -7167,25 +7163,19 @@ msgstr "bouton de résumé" #: oleacc.rc:97 -#, fuzzy -#| msgid "Normal" msgctxt "object state" msgid "normal" -msgstr "Normale" +msgstr "normal" #: oleacc.rc:98 -#, fuzzy -#| msgid "Unavailable" msgctxt "object state" msgid "unavailable" -msgstr "Indisponible" +msgstr "indisponible" #: oleacc.rc:99 -#, fuzzy -#| msgid "Select" msgctxt "object state" msgid "selected" -msgstr "Sélectionner" +msgstr "sélectionné" #: oleacc.rc:100 #, fuzzy @@ -7195,30 +7185,24 @@ msgstr "En pause" #: oleacc.rc:101 -#, fuzzy -#| msgid "&Compressed" msgctxt "object state" msgid "pressed" -msgstr "&Compressé" +msgstr "pressé" #: oleacc.rc:102 msgctxt "object state" msgid "checked" -msgstr "" +msgstr "coché" #: oleacc.rc:103 -#, fuzzy -#| msgid "Mixed" msgctxt "object state" msgid "mixed" -msgstr "Mixte" +msgstr "mixte" #: oleacc.rc:104 -#, fuzzy -#| msgid "&Read Only" msgctxt "object state" msgid "read only" -msgstr "Lectu&re seule" +msgstr "lecture seule" #: oleacc.rc:105 #, fuzzy @@ -7228,31 +7212,30 @@ msgstr "Élément actif" #: oleacc.rc:106 -#, fuzzy -#| msgid "Defaults" msgctxt "object state" msgid "default" -msgstr "Valeurs par défaut" +msgstr "valeur par défaut" #: oleacc.rc:107 msgctxt "object state" msgid "expanded" -msgstr "" +msgstr "développé" #: oleacc.rc:108 +#, fuzzy msgctxt "object state" msgid "collapsed" -msgstr "" +msgstr "réduit" #: oleacc.rc:109 msgctxt "object state" msgid "busy" -msgstr "" +msgstr "occupé" #: oleacc.rc:110 msgctxt "object state" msgid "floating" -msgstr "" +msgstr "flottant" #: oleacc.rc:111 msgctxt "object state" @@ -7260,35 +7243,30 @@ msgstr "" #: oleacc.rc:112 -#, fuzzy -#| msgid "animation" msgctxt "object state" msgid "animated" -msgstr "animation" +msgstr "animé" #: oleacc.rc:113 msgctxt "object state" msgid "invisible" -msgstr "" +msgstr "invisible" #: oleacc.rc:114 msgctxt "object state" msgid "offscreen" -msgstr "" +msgstr "hors écran" #: oleacc.rc:115 #, fuzzy -#| msgid "&enable" msgctxt "object state" msgid "sizeable" msgstr "&activer" #: oleacc.rc:116 -#, fuzzy -#| msgid "&enable" msgctxt "object state" msgid "moveable" -msgstr "&activer" +msgstr "déplaçable" #: oleacc.rc:117 msgctxt "object state" @@ -7303,18 +7281,14 @@ msgstr "En pause" #: oleacc.rc:119 -#, fuzzy -#| msgid "table" msgctxt "object state" msgid "selectable" -msgstr "table" +msgstr "sélectionnable" #: oleacc.rc:120 -#, fuzzy -#| msgid "link" msgctxt "object state" msgid "linked" -msgstr "lien" +msgstr "lié" #: oleacc.rc:121 msgctxt "object state" @@ -7336,37 +7310,30 @@ msgstr "Sélectionnez un fichier." #: oleacc.rc:124 -#, fuzzy -#| msgid "alert" msgctxt "object state" msgid "alert low" -msgstr "alerte" +msgstr "alerte basse" #: oleacc.rc:125 -#, fuzzy -#| msgid "alert" msgctxt "object state" msgid "alert medium" -msgstr "alerte" +msgstr "alerte moyenne" #: oleacc.rc:126 -#, fuzzy -#| msgid "alert" msgctxt "object state" msgid "alert high" -msgstr "alerte" +msgstr "alerte haute" #: oleacc.rc:127 -#, fuzzy -#| msgid "Write protected.\n" msgctxt "object state" msgid "protected" -msgstr "Protégé contre l'écriture.\n" +msgstr "protégé" #: oleacc.rc:128 +#, fuzzy msgctxt "object state" msgid "has popup" -msgstr "" +msgstr "avec popup" #: oleaut32.rc:30 oleview.rc:147 msgid "True" diff -Nru wine1.7-1.7.24/programs/cmd/builtins.c wine1.7-1.7.25/programs/cmd/builtins.c --- wine1.7-1.7.24/programs/cmd/builtins.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/programs/cmd/builtins.c 2014-08-22 18:39:55.000000000 +0000 @@ -100,7 +100,6 @@ {'A','T','T','R','I','B','\0'}, {'X','C','O','P','Y','\0'} }; -static const WCHAR fslashW[] = {'/','\0'}; static const WCHAR onW[] = {'O','N','\0'}; static const WCHAR offW[] = {'O','F','F','\0'}; static const WCHAR parmY[] = {'/','Y','\0'}; diff -Nru wine1.7-1.7.24/programs/uninstaller/main.c wine1.7-1.7.25/programs/uninstaller/main.c --- wine1.7-1.7.24/programs/uninstaller/main.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/programs/uninstaller/main.c 2014-08-22 18:39:55.000000000 +0000 @@ -49,7 +49,6 @@ static void UninstallProgram(void); static int cmp_by_name(const void *a, const void *b); -static const WCHAR BackSlashW[] = { '\\', 0 }; static const WCHAR DisplayNameW[] = {'D','i','s','p','l','a','y','N','a','m','e',0}; static const WCHAR PathUninstallW[] = { 'S','o','f','t','w','a','r','e','\\', diff -Nru wine1.7-1.7.24/programs/winedbg/memory.c wine1.7-1.7.25/programs/winedbg/memory.c --- wine1.7-1.7.24/programs/winedbg/memory.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/programs/winedbg/memory.c 2014-08-22 18:39:55.000000000 +0000 @@ -367,6 +367,7 @@ { WINE_ERR("Couldn't get information\n"); RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL); + return; } size = (DWORD)size64; switch (bt) diff -Nru wine1.7-1.7.24/server/named_pipe.c wine1.7-1.7.25/server/named_pipe.c --- wine1.7-1.7.24/server/named_pipe.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/server/named_pipe.c 2014-08-22 18:39:55.000000000 +0000 @@ -77,6 +77,7 @@ struct timeout_user *flush_poll; struct event *event; unsigned int options; /* pipe options */ + unsigned int pipe_flags; }; struct pipe_client @@ -85,6 +86,7 @@ struct fd *fd; /* pipe file descriptor */ struct pipe_server *server; /* server that this client is connected to */ unsigned int flags; /* file flags */ + unsigned int pipe_flags; }; struct named_pipe @@ -737,7 +739,8 @@ return (struct pipe_server *) obj; } -static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options ) +static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options, + unsigned int pipe_flags ) { struct pipe_server *server; @@ -750,6 +753,7 @@ server->client = NULL; server->flush_poll = NULL; server->options = options; + server->pipe_flags = pipe_flags; list_add_head( &pipe->servers, &server->entry ); grab_object( pipe ); @@ -762,7 +766,7 @@ return server; } -static struct pipe_client *create_pipe_client( unsigned int flags ) +static struct pipe_client *create_pipe_client( unsigned int flags, unsigned int pipe_flags ) { struct pipe_client *client; @@ -773,6 +777,7 @@ client->fd = NULL; client->server = NULL; client->flags = flags; + client->pipe_flags = pipe_flags; return client; } @@ -822,7 +827,7 @@ return NULL; } - if ((client = create_pipe_client( options ))) + if ((client = create_pipe_client( options, pipe->flags ))) { if (!socketpair( PF_UNIX, SOCK_STREAM, 0, fds )) { @@ -977,7 +982,7 @@ pipe->outsize = req->outsize; pipe->maxinstances = req->maxinstances; pipe->timeout = req->timeout; - pipe->flags = req->flags; + pipe->flags = req->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE; pipe->sharing = req->sharing; } else @@ -997,7 +1002,7 @@ clear_error(); /* clear the name collision */ } - server = create_pipe_server( pipe, req->options ); + server = create_pipe_server( pipe, req->options, req->flags ); if (server) { reply->handle = alloc_handle( current->process, server, req->access, req->attributes ); @@ -1026,7 +1031,7 @@ server = client->server; } - reply->flags = server->pipe->flags; + reply->flags = client ? client->pipe_flags : server->pipe_flags; reply->sharing = server->pipe->sharing; reply->maxinstances = server->pipe->maxinstances; reply->instances = server->pipe->instances; @@ -1041,3 +1046,41 @@ release_object(server); } } + +DECL_HANDLER(set_named_pipe_info) +{ + struct pipe_server *server; + struct pipe_client *client = NULL; + + server = get_pipe_server_obj( current->process, req->handle, FILE_WRITE_ATTRIBUTES ); + if (!server) + { + if (get_error() != STATUS_OBJECT_TYPE_MISMATCH) + return; + + clear_error(); + client = (struct pipe_client *)get_handle_obj( current->process, req->handle, + 0, &pipe_client_ops ); + if (!client) return; + server = client->server; + } + + if ((req->flags & ~(NAMED_PIPE_MESSAGE_STREAM_READ | NAMED_PIPE_NONBLOCKING_MODE)) || + ((req->flags & NAMED_PIPE_MESSAGE_STREAM_READ) && !(server->pipe->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE))) + { + set_error( STATUS_INVALID_PARAMETER ); + } + else if (client) + { + client->pipe_flags = server->pipe->flags | req->flags; + } + else + { + server->pipe_flags = server->pipe->flags | req->flags; + } + + if (client) + release_object(client); + else + release_object(server); +} diff -Nru wine1.7-1.7.24/server/protocol.def wine1.7-1.7.25/server/protocol.def --- wine1.7-1.7.24/server/protocol.def 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/server/protocol.def 2014-08-22 18:39:55.000000000 +0000 @@ -2294,7 +2294,7 @@ #define NAMED_PIPE_NONBLOCKING_MODE 0x0004 #define NAMED_PIPE_SERVER_END 0x8000 - +/* Get named pipe information by handle */ @REQ(get_named_pipe_info) obj_handle_t handle; @REPLY @@ -2306,6 +2306,11 @@ unsigned int insize; @END +/* Set named pipe information by handle */ +@REQ(set_named_pipe_info) + obj_handle_t handle; + unsigned int flags; +@END /* Create a window */ @REQ(create_window) diff -Nru wine1.7-1.7.24/server/request.h wine1.7-1.7.25/server/request.h --- wine1.7-1.7.24/server/request.h 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/server/request.h 2014-08-22 18:39:55.000000000 +0000 @@ -251,6 +251,7 @@ DECL_HANDLER(get_ioctl_result); DECL_HANDLER(create_named_pipe); DECL_HANDLER(get_named_pipe_info); +DECL_HANDLER(set_named_pipe_info); DECL_HANDLER(create_window); DECL_HANDLER(destroy_window); DECL_HANDLER(get_desktop_window); @@ -511,6 +512,7 @@ (req_handler)req_get_ioctl_result, (req_handler)req_create_named_pipe, (req_handler)req_get_named_pipe_info, + (req_handler)req_set_named_pipe_info, (req_handler)req_create_window, (req_handler)req_destroy_window, (req_handler)req_get_desktop_window, @@ -1536,6 +1538,9 @@ C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, outsize) == 24 ); C_ASSERT( FIELD_OFFSET(struct get_named_pipe_info_reply, insize) == 28 ); C_ASSERT( sizeof(struct get_named_pipe_info_reply) == 32 ); +C_ASSERT( FIELD_OFFSET(struct set_named_pipe_info_request, handle) == 12 ); +C_ASSERT( FIELD_OFFSET(struct set_named_pipe_info_request, flags) == 16 ); +C_ASSERT( sizeof(struct set_named_pipe_info_request) == 24 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, parent) == 12 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, owner) == 16 ); C_ASSERT( FIELD_OFFSET(struct create_window_request, atom) == 20 ); diff -Nru wine1.7-1.7.24/server/trace.c wine1.7-1.7.25/server/trace.c --- wine1.7-1.7.24/server/trace.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/server/trace.c 2014-08-22 18:39:55.000000000 +0000 @@ -2776,6 +2776,12 @@ fprintf( stderr, ", insize=%08x", req->insize ); } +static void dump_set_named_pipe_info_request( const struct set_named_pipe_info_request *req ) +{ + fprintf( stderr, " handle=%04x", req->handle ); + fprintf( stderr, ", flags=%08x", req->flags ); +} + static void dump_create_window_request( const struct create_window_request *req ) { fprintf( stderr, " parent=%08x", req->parent ); @@ -4226,6 +4232,7 @@ (dump_func)dump_get_ioctl_result_request, (dump_func)dump_create_named_pipe_request, (dump_func)dump_get_named_pipe_info_request, + (dump_func)dump_set_named_pipe_info_request, (dump_func)dump_create_window_request, (dump_func)dump_destroy_window_request, (dump_func)dump_get_desktop_window_request, @@ -4483,6 +4490,7 @@ (dump_func)dump_get_ioctl_result_reply, (dump_func)dump_create_named_pipe_reply, (dump_func)dump_get_named_pipe_info_reply, + NULL, (dump_func)dump_create_window_reply, NULL, (dump_func)dump_get_desktop_window_reply, @@ -4740,6 +4748,7 @@ "get_ioctl_result", "create_named_pipe", "get_named_pipe_info", + "set_named_pipe_info", "create_window", "destroy_window", "get_desktop_window", diff -Nru wine1.7-1.7.24/tools/wrc/translation.c wine1.7-1.7.25/tools/wrc/translation.c --- wine1.7-1.7.24/tools/wrc/translation.c 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/tools/wrc/translation.c 2014-08-22 18:39:55.000000000 +0000 @@ -201,8 +201,7 @@ static int compare_accelerator(accelerator_t *accelerator1, accelerator_t *accelerator2) { int different = 0; event_t *ev1 = NULL, *ev2 = NULL; - if(!different && - ((accelerator1->memopt != accelerator2->memopt) || + if(((accelerator1->memopt != accelerator2->memopt) || (accelerator1->lvc.version != accelerator2->lvc.version) || (accelerator1->lvc.characts != accelerator2->lvc.characts))) different = 1; @@ -224,8 +223,7 @@ static int compare_bitmap(bitmap_t *bitmap1, bitmap_t *bitmap2) { int different = 0; - if(!different && - ((bitmap1->memopt != bitmap2->memopt) || + if(((bitmap1->memopt != bitmap2->memopt) || (bitmap1->data->lvc.version != bitmap2->data->lvc.version) || (bitmap1->data->lvc.characts != bitmap2->data->lvc.characts))) different = 1; @@ -234,8 +232,7 @@ static int compare_cursor(cursor_t *cursor1, cursor_t *cursor2) { int different = 0; - if(!different && - ((cursor1->id != cursor2->id) || + if(((cursor1->id != cursor2->id) || (cursor1->width != cursor2->width) || (cursor1->height != cursor2->height) || (cursor1->xhot != cursor2->xhot) || @@ -251,8 +248,7 @@ static int compare_cursor_group(cursor_group_t *cursor_group1, cursor_group_t *cursor_group2) { int different = 0; cursor_t *cursor1 = NULL, *cursor2 = NULL; - if(!different && - ((cursor_group1->memopt != cursor_group2->memopt) || + if(((cursor_group1->memopt != cursor_group2->memopt) || (cursor_group1->lvc.version != cursor_group2->lvc.version) || (cursor_group1->lvc.characts != cursor_group2->lvc.characts))) different = 1; @@ -279,14 +275,12 @@ int different = 0; char *nameid = NULL; int ignore_style; - if(!different && - ((control1 && !control2) || - (!control1 && control2))) - different = 1; + if(((control1 && !control2) || (!control1 && control2))) + different = 1; if(different || !control1 || !control2) return different; nameid = strdup(get_nameid_str(control1->ctlclass)); - if(!different && strcmp(nameid, get_nameid_str(control2->ctlclass))) + if(strcmp(nameid, get_nameid_str(control2->ctlclass))) different = 1; free(nameid); if (different) @@ -297,8 +291,7 @@ if (control1->ctlclass->type == name_ord && control1->ctlclass->name.i_name == CT_BUTTON) ignore_style = 0x2000; /* BS_MULTILINE*/ - if(!different && - (control1->id != control2->id)) + if((control1->id != control2->id)) different = 1; if(!different && control1->gotstyle && control2->gotstyle) { if((!control1->style || !control2->style) || @@ -332,8 +325,7 @@ int different = 0; char *nameid = NULL; control_t *ctrl1, *ctrl2; - if(!different && - ((dialog1->memopt != dialog2->memopt) || + if(((dialog1->memopt != dialog2->memopt) || (dialog1->lvc.version != dialog2->lvc.version) || (dialog1->lvc.characts != dialog2->lvc.characts))) different = 1; @@ -384,8 +376,7 @@ static int compare_font(font_t *font1, font_t *font2) { int different = 0; - if(!different && - ((font1->memopt != font2->memopt) || + if(((font1->memopt != font2->memopt) || (font1->data->lvc.version != font2->data->lvc.version) || (font1->data->lvc.characts != font2->data->lvc.characts))) different = 1; @@ -394,8 +385,7 @@ static int compare_fontdir(fontdir_t *fontdir1, fontdir_t *fontdir2) { int different = 0; - if(!different && - ((fontdir1->memopt != fontdir2->memopt) || + if(((fontdir1->memopt != fontdir2->memopt) || (fontdir1->data->lvc.version != fontdir2->data->lvc.version) || (fontdir1->data->lvc.characts != fontdir2->data->lvc.characts))) different = 1; @@ -404,8 +394,7 @@ static int compare_icon(icon_t *icon1, icon_t *icon2) { int different = 0; - if(!different && - ((icon1->id != icon2->id) || + if(((icon1->id != icon2->id) || (icon1->width != icon2->width) || (icon1->height != icon2->height))) different = 1; @@ -419,8 +408,7 @@ static int compare_icon_group(icon_group_t *icon_group1, icon_group_t *icon_group2) { int different = 0; icon_t *icon1 = NULL, *icon2 = NULL; - if(!different && - ((icon_group1->memopt != icon_group2->memopt) || + if(((icon_group1->memopt != icon_group2->memopt) || (icon_group1->lvc.version != icon_group2->lvc.version) || (icon_group1->lvc.characts != icon_group2->lvc.characts))) different = 1; @@ -524,8 +512,7 @@ static int compare_menu(menu_t *menu1, menu_t *menu2) { int different = 0; - if(!different && - ((menu1->memopt != menu2->memopt) || + if(((menu1->memopt != menu2->memopt) || (menu1->lvc.version != menu2->lvc.version) || (menu1->lvc.characts != menu2->lvc.characts))) different = 1; @@ -536,8 +523,7 @@ static int compare_rcdata(rcdata_t *rcdata1, rcdata_t *rcdata2) { int different = 0; - if(!different && - ((rcdata1->memopt != rcdata2->memopt) || + if(((rcdata1->memopt != rcdata2->memopt) || (rcdata1->data->lvc.version != rcdata2->data->lvc.version) || (rcdata1->data->lvc.characts != rcdata2->data->lvc.characts))) different = 1; @@ -546,8 +532,7 @@ static int compare_html(html_t *rcdata1, html_t *rcdata2) { int different = 0; - if(!different && - ((rcdata1->memopt != rcdata2->memopt) || + if(((rcdata1->memopt != rcdata2->memopt) || (rcdata1->data->lvc.version != rcdata2->data->lvc.version) || (rcdata1->data->lvc.characts != rcdata2->data->lvc.characts))) different = 1; @@ -585,8 +570,7 @@ static int compare_user(user_t *user1, user_t *user2) { int different = 0; char *nameid = NULL; - if(!different && - ((user1->memopt != user2->memopt) || + if(((user1->memopt != user2->memopt) || (user1->data->lvc.version != user2->data->lvc.version) || (user1->data->lvc.characts != user2->data->lvc.characts))) different = 1; @@ -599,8 +583,7 @@ static int compare_messagetable(messagetable_t *messagetable1, messagetable_t *messagetable2) { int different = 0; - if(!different && - ((messagetable1->memopt != messagetable2->memopt) || + if(((messagetable1->memopt != messagetable2->memopt) || (messagetable1->data->lvc.version != messagetable2->data->lvc.version) || (messagetable1->data->lvc.characts != messagetable2->data->lvc.characts))) different = 1; @@ -609,8 +592,7 @@ static int compare_string(string_t *string1, string_t *string2) { int different = 0; - if(!different && - ((string1->size != string2->size) || + if(((string1->size != string2->size) || (string1->type != string2->type))) different = 1; if(!different) { @@ -629,8 +611,7 @@ static int compare_ver_value(ver_value_t *ver_value1, ver_value_t *ver_value2) { int different = 0; int i = 0; - if(!different && - (ver_value1->type == ver_value2->type)) { + if((ver_value1->type == ver_value2->type)) { switch(ver_value1->type) { case val_str: if(!different && ver_value1->key && ver_value2->key) @@ -648,8 +629,7 @@ (!ver_value1->key && ver_value2->key))) different = 1; if(!different && ver_value1->value.words && ver_value2->value.words) { - if(!different && - (ver_value1->value.words->nwords != ver_value2->value.words->nwords)) + if(ver_value1->value.words->nwords != ver_value2->value.words->nwords) different = 1; if(!different) for(i = 0; i < ver_value1->value.words->nwords; i++) { @@ -681,28 +661,25 @@ static int compare_ver_block(ver_block_t *ver_block1, ver_block_t *ver_block2) { int different = 0; - ver_value_t *ver_value1 = NULL, *ver_value2 = NULL; - if(!different) { - ver_value1 = ver_block1->values; - ver_value2 = ver_block2->values; - while(!different && ver_value1 && ver_value2) { - different = compare_ver_value(ver_value1, ver_value2); - ver_value1 = ver_value1->next; - ver_value2 = ver_value2->next; - } - if(!different && - ((ver_value1 && !ver_value2) || - (!ver_value1 && ver_value2))) - different = 1; + ver_value_t *ver_value1 = ver_block1->values, *ver_value2 = ver_block2->values; + + while(!different && ver_value1 && ver_value2) { + different = compare_ver_value(ver_value1, ver_value2); + ver_value1 = ver_value1->next; + ver_value2 = ver_value2->next; } + if(!different && + ((ver_value1 && !ver_value2) || + (!ver_value1 && ver_value2))) + different = 1; + return different; } static int compare_versioninfo(versioninfo_t *versioninfo1, versioninfo_t *versioninfo2) { int different = 0; ver_block_t *ver_block1 = NULL, *ver_block2 = NULL; - if(!different && - ((versioninfo1->memopt != versioninfo2->memopt) || + if(((versioninfo1->memopt != versioninfo2->memopt) || (versioninfo1->lvc.version != versioninfo2->lvc.version) || (versioninfo1->lvc.characts != versioninfo2->lvc.characts))) different = 1; @@ -779,8 +756,7 @@ static int compare_dlginit(dlginit_t *dlginit1, dlginit_t *dlginit2) { int different = 0; - if(!different && - ((dlginit1->memopt != dlginit2->memopt) || + if(((dlginit1->memopt != dlginit2->memopt) || (dlginit1->data->lvc.version != dlginit2->data->lvc.version) || (dlginit1->data->lvc.characts != dlginit2->data->lvc.characts))) different = 1; @@ -805,8 +781,7 @@ static int compare_toolbar(toolbar_t *toolbar1, toolbar_t *toolbar2) { int different = 0; - if(!different && - ((toolbar1->memopt != toolbar2->memopt) || + if(((toolbar1->memopt != toolbar2->memopt) || (toolbar1->lvc.version != toolbar2->lvc.version) || (toolbar1->lvc.characts != toolbar2->lvc.characts))) different = 1; @@ -817,8 +792,7 @@ static int compare_ani_curico(ani_curico_t *ani_curico1, ani_curico_t *ani_curico2) { int different = 0; - if(!different && - ((ani_curico1->memopt != ani_curico2->memopt) || + if(((ani_curico1->memopt != ani_curico2->memopt) || (ani_curico1->data->lvc.version != ani_curico2->data->lvc.version) || (ani_curico1->data->lvc.characts != ani_curico2->data->lvc.characts))) different = 1; diff -Nru wine1.7-1.7.24/VERSION wine1.7-1.7.25/VERSION --- wine1.7-1.7.24/VERSION 2014-08-08 20:19:29.000000000 +0000 +++ wine1.7-1.7.25/VERSION 2014-08-22 18:39:55.000000000 +0000 @@ -1 +1 @@ -Wine version 1.7.24 +Wine version 1.7.25